diff --git a/src/style_manager/index.js b/src/style_manager/index.js index b4eb542fd..11ab15d7f 100644 --- a/src/style_manager/index.js +++ b/src/style_manager/index.js @@ -577,16 +577,37 @@ export default () => { /** * Return built-in property definition - * @param {String} prop - * @returns {Object} Property definition + * @param {String} prop Property name. + * @returns {Object|null} Property definition. */ - getBuiltIn(prop = '') { + getBuiltIn(prop) { return this.builtIn.get(prop); }, - getBuiltInAll() {}, + /** + * Get all the available built-in property definitions. + * @returns {Object} + */ + getBuiltInAll() { + return this.builtIn.props; + }, - addBuiltIn(prop, def = {}) {}, + /** + * Add built-in property definition. + * If the property exists already, it will extend it. + * @param {String} prop Property name. + * @param {Object} definition Property definition. + * @returns {Object} Added property definition. + * @example + * const sector = styleManager.addBuiltIn('new-property', { + * type: 'select', + * default: 'value1', + * options: [{ id: 'value1', label: 'Some label' }, ...], + * }) + */ + addBuiltIn(prop, definition) { + return this.builtIn.add(prop, definition); + }, __upProp(prop, style, parentStyles, opts) { const name = prop.getName(); diff --git a/src/style_manager/model/PropertyFactory.js b/src/style_manager/model/PropertyFactory.js index d80c1e7dc..81ca01b15 100644 --- a/src/style_manager/model/PropertyFactory.js +++ b/src/style_manager/model/PropertyFactory.js @@ -390,6 +390,7 @@ export default class PropertyFactory { result.properties = result.properties(); } this.props[property] = result; + return result; } get(prop) {