From b6a69ecfbd8370753c24f2d6006590b954efa33b Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 18 Dec 2019 00:45:22 +0100 Subject: [PATCH] Add render option in Selector Manager for a custom template --- src/selector_manager/config/config.js | 56 +++++++++++++++++++ src/selector_manager/view/ClassTagsView.js | 63 ++++++++++++++-------- 2 files changed, 96 insertions(+), 23 deletions(-) diff --git a/src/selector_manager/config/config.js b/src/selector_manager/config/config.js index c4e24ae47..74089d2f2 100644 --- a/src/selector_manager/config/config.js +++ b/src/selector_manager/config/config.js @@ -22,6 +22,62 @@ export default { // } selectedName: 0, + // Icon used to add new selector + iconAdd: + '', + + // Icon used to sync styles + iconSync: + '', + + /** + * Custom render function for the Select Manager + * @example + * render: ({ el, labelHead, labelStates, labelInfo, }) => { + * // You can use the default `el` to extend/edit the current + * // DOM element of the Selector Manager + * const someEl = document.createElement('div'); + * // ... + * el.appendChild(someEl); + * // no need to return anything from the function + * + * // Create and return a new DOM element + * const newEl = document.createElement('div'); + * // ... + * return newEl; + * + * // Return an HTML string for a completely different layout. + * // Use `data-*` attributes to make the module recognize some elements: + * // `data-states` - Where to append state `