|
|
@ -1,5 +1,5 @@ |
|
|
import { Model } from 'common'; |
|
|
import { Model } from 'common'; |
|
|
import { isUndefined, isString, isArray, result, keys } from 'underscore'; |
|
|
import { isUndefined, isString, isArray, result, keys, each } from 'underscore'; |
|
|
import { capitalize, camelCase } from 'utils/mixins'; |
|
|
import { capitalize, camelCase } from 'utils/mixins'; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -23,10 +23,6 @@ export default class Property extends Model { |
|
|
Property.callInit(this, props, opts); |
|
|
Property.callInit(this, props, opts); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// __hasCustom() {
|
|
|
|
|
|
// return !!this.em?.get('StyleManager').getConfig().custom;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
__getParentProp() { |
|
|
__getParentProp() { |
|
|
return this.collection?.opts?.parentProp; |
|
|
return this.collection?.opts?.parentProp; |
|
|
} |
|
|
} |
|
|
@ -191,16 +187,6 @@ export default class Property extends Model { |
|
|
return { value: '', status: '' }; |
|
|
return { value: '', status: '' }; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Clear the value |
|
|
|
|
|
* @return {this} |
|
|
|
|
|
* @private |
|
|
|
|
|
*/ |
|
|
|
|
|
clearValue(opts = {}) { |
|
|
|
|
|
this.set({ value: undefined, status: '' }, opts); |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Update value |
|
|
* Update value |
|
|
* @param {any} value |
|
|
* @param {any} value |
|
|
@ -286,32 +272,32 @@ export default class Property extends Model { |
|
|
* @param {String} [separator] Separator |
|
|
* @param {String} [separator] Separator |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
splitValues(values, separator = ',') { |
|
|
// splitValues(values, separator = ',') {
|
|
|
const res = []; |
|
|
// const res = [];
|
|
|
const op = '('; |
|
|
// const op = '(';
|
|
|
const cl = ')'; |
|
|
// const cl = ')';
|
|
|
let curr = ''; |
|
|
// let curr = '';
|
|
|
let acc = 0; |
|
|
// let acc = 0;
|
|
|
|
|
|
|
|
|
(values || '').split('').forEach(str => { |
|
|
// (values || '').split('').forEach(str => {
|
|
|
if (str == op) { |
|
|
// if (str == op) {
|
|
|
acc++; |
|
|
// acc++;
|
|
|
curr = curr + op; |
|
|
// curr = curr + op;
|
|
|
} else if (str == cl && acc > 0) { |
|
|
// } else if (str == cl && acc > 0) {
|
|
|
acc--; |
|
|
// acc--;
|
|
|
curr = curr + cl; |
|
|
// curr = curr + cl;
|
|
|
} else if (str === separator && acc == 0) { |
|
|
// } else if (str === separator && acc == 0) {
|
|
|
res.push(curr); |
|
|
// res.push(curr);
|
|
|
curr = ''; |
|
|
// curr = '';
|
|
|
} else { |
|
|
// } else {
|
|
|
curr = curr + str; |
|
|
// curr = curr + str;
|
|
|
} |
|
|
// }
|
|
|
}); |
|
|
// });
|
|
|
|
|
|
|
|
|
curr !== '' && res.push(curr); |
|
|
// curr !== '' && res.push(curr);
|
|
|
|
|
|
|
|
|
return res.map(i => i.trim()); |
|
|
// return res.map(i => i.trim());
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
__getFullValue({ withDefault } = {}) { |
|
|
__getFullValue({ withDefault } = {}) { |
|
|
return !this.hasValue() && withDefault ? this.getDefaultValue() : this.getFullValue(); |
|
|
return !this.hasValue() && withDefault ? this.getDefaultValue() : this.getFullValue(); |
|
|
|