|
|
|
@ -4,6 +4,7 @@ import Component from '../../dom_components/model/Component'; |
|
|
|
import EditorModel from '../../editor/model/Editor'; |
|
|
|
import { capitalize, camelCase, hasWin } from '../../utils/mixins'; |
|
|
|
import Sector from './Sector'; |
|
|
|
import PropertyComposite from './PropertyComposite'; |
|
|
|
|
|
|
|
/** @private */ |
|
|
|
export interface PropertyProps { |
|
|
|
@ -146,7 +147,7 @@ export default class Property<T extends Record<string, any> = PropertyProps> ext |
|
|
|
Property.callInit(this, props, opts); |
|
|
|
} |
|
|
|
|
|
|
|
__getParentProp() { |
|
|
|
__getParentProp<T = PropertyComposite>(): T { |
|
|
|
// @ts-ignore
|
|
|
|
return this.collection?.opts?.parentProp; |
|
|
|
} |
|
|
|
@ -328,7 +329,7 @@ export default class Property<T extends Record<string, any> = PropertyProps> ext |
|
|
|
* Indicates if the current value comes directly from the selected target and so can be cleared. |
|
|
|
* @returns {Boolean} |
|
|
|
*/ |
|
|
|
canClear() { |
|
|
|
canClear(): boolean { |
|
|
|
const parent = this.getParent(); |
|
|
|
return parent ? parent.__canClearProp(this) : this.hasValue({ noParent: true }); |
|
|
|
} |
|
|
|
@ -338,7 +339,7 @@ export default class Property<T extends Record<string, any> = PropertyProps> ext |
|
|
|
* @returns {[Property]|null} |
|
|
|
*/ |
|
|
|
getParent() { |
|
|
|
return this.__getParentProp() || null; |
|
|
|
return this.__getParentProp(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -369,7 +370,6 @@ export default class Property<T extends Record<string, any> = PropertyProps> ext |
|
|
|
const avoidStore = !complete; |
|
|
|
// @ts-ignore
|
|
|
|
!avoidStore && this.set({ value: undefined }, { avoidStore, silent: true }); |
|
|
|
// @ts-ignore
|
|
|
|
this.set(parsed, { avoidStore, ...opts }); |
|
|
|
} |
|
|
|
|
|
|
|
@ -428,7 +428,6 @@ export default class Property<T extends Record<string, any> = PropertyProps> ext |
|
|
|
|
|
|
|
if (opts.numeric) { |
|
|
|
const num = parseFloat(result.value); |
|
|
|
// @ts-ignore
|
|
|
|
result.unit = result.value.replace(num, ''); |
|
|
|
result.value = num; |
|
|
|
} |
|
|
|
@ -488,7 +487,7 @@ export default class Property<T extends Record<string, any> = PropertyProps> ext |
|
|
|
getFullValue(val?: string, opts: any = {}) { |
|
|
|
const fn = this.get('functionName'); |
|
|
|
const def = this.getDefaultValue(); |
|
|
|
let value = isUndefined(val) ? this.get('value') : val; |
|
|
|
let value = isUndefined(val) ? (this.get('value') as string) : val; |
|
|
|
const hasValue = !isUndefined(value) && value !== ''; |
|
|
|
|
|
|
|
if (value && def && value === def) { |
|
|
|
@ -496,7 +495,6 @@ export default class Property<T extends Record<string, any> = PropertyProps> ext |
|
|
|
} |
|
|
|
|
|
|
|
if (fn && hasValue) { |
|
|
|
// @ts-ignore
|
|
|
|
const fnParameter = fn === 'url' ? `'${value.replace(/'|"/g, '')}'` : value; |
|
|
|
value = `${fn}(${fnParameter})`; |
|
|
|
} |
|
|
|
@ -601,8 +599,3 @@ Property.callParentInit = function (property, ctx, props, opts = {}) { |
|
|
|
Property.callInit = function (context, props, opts: any = {}) { |
|
|
|
!opts.skipInit && context.init(props, opts); |
|
|
|
}; |
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
// Property.getDefaults = function () {
|
|
|
|
// return result(this.prototype, 'defaults');
|
|
|
|
// };
|
|
|
|
|