solid-ui 2.4.22-72c4afee → 2.4.22-78b35534
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -58
- package/dist/main.js +1481 -310
- package/dist/main.js.map +1 -1
- package/lib/style_multiSelect.js +67 -0
- package/lib/style_multiSelect.js.map +1 -0
- package/lib/tabs.d.ts +1 -1
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +34 -21
- package/lib/tabs.js.map +1 -1
- package/lib/utils/label.js +1 -1
- package/lib/utils/label.js.map +1 -1
- package/lib/versionInfo.js +5 -5
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +2 -0
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/forms.js +406 -187
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/multiSelect.js +784 -0
- package/lib/widgets/multiSelect.js.map +1 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -12026,6 +12026,83 @@ module.exports = style; // @@ No way to do this in ESM
|
|
|
12026
12026
|
|
|
12027
12027
|
/***/ }),
|
|
12028
12028
|
|
|
12029
|
+
/***/ "./lib/style_multiSelect.js":
|
|
12030
|
+
/*!**********************************!*\
|
|
12031
|
+
!*** ./lib/style_multiSelect.js ***!
|
|
12032
|
+
\**********************************/
|
|
12033
|
+
/***/ ((module, exports) => {
|
|
12034
|
+
|
|
12035
|
+
"use strict";
|
|
12036
|
+
|
|
12037
|
+
|
|
12038
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
12039
|
+
value: true
|
|
12040
|
+
}));
|
|
12041
|
+
exports.style = void 0;
|
|
12042
|
+
|
|
12043
|
+
/*
|
|
12044
|
+
* BASED ON:
|
|
12045
|
+
* IconicMultiSelect v0.7.0
|
|
12046
|
+
* Licence: MIT
|
|
12047
|
+
* (c) 2021 Sidney Wimart.
|
|
12048
|
+
* repo & configuration: https://github.com/sidneywm/iconic-multiselect
|
|
12049
|
+
*/
|
|
12050
|
+
|
|
12051
|
+
/**
|
|
12052
|
+
* @version IconicMultiSelect v0.7.0
|
|
12053
|
+
* @licence MIT
|
|
12054
|
+
*/
|
|
12055
|
+
var style = {
|
|
12056
|
+
multiselect__container: "\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n background-color: #fff;\n border-radius: 2px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n min-height: 36px;\n padding: 4px 8px 0 8px;\n position: relative;\n width: 354px;\n margin-bottom: 5px;\n font-size: 100%\n ",
|
|
12057
|
+
|
|
12058
|
+
/*
|
|
12059
|
+
multiselect__container:after: `
|
|
12060
|
+
content: '';
|
|
12061
|
+
min-height:inherit;
|
|
12062
|
+
font-size:0;
|
|
12063
|
+
`,
|
|
12064
|
+
multiselect__container > *: `
|
|
12065
|
+
color: #656565;
|
|
12066
|
+
font-size: 14px;
|
|
12067
|
+
`,
|
|
12068
|
+
*/
|
|
12069
|
+
multiselect__wrapper: "\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n height: 100%;\n width: 100%;\n ",
|
|
12070
|
+
multiselect__clear_btn: "\n cursor: pointer;\n align-items: center;\n margin-bottom: 4px;\n margin-left: 4px;\n ",
|
|
12071
|
+
multiselect__options: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n ",
|
|
12072
|
+
multiselect__options_visible: "\n background-color: #f6f6f6;\n border-radius: 2px;\n left: 0;\n max-height: 0;\n overflow: hidden;\n position: absolute;\n top: calc(100% + 3px);\n z-index: 9999;\n width: 100%;\n opacity: 0;\n transition: max-height 0.1s ease;\n max-height: 200px;\n -webkit-box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n box-shadow: 0 1px 3px 0 #d1d1d2, 0 0 0 1px #d1d1d2;\n opacity: 1;\n transition: max-height 0.2s ease;\n ",
|
|
12073
|
+
multiselect__options_ul: "\n list-style: none;\n margin: 0;\n padding: 2px 0;\n max-height: 200px;\n overflow: auto;\n ",
|
|
12074
|
+
multiselect__options_ul_li: "\n cursor: pointer;\n padding: 4px 8px;\n ",
|
|
12075
|
+
// multiselect__options ul li:hover: `
|
|
12076
|
+
multiselect__options_ul_li_hover: "\n background-color: #dedede;\n ",
|
|
12077
|
+
|
|
12078
|
+
/*
|
|
12079
|
+
multiselect__options ul li *: `
|
|
12080
|
+
pointer-events: none;
|
|
12081
|
+
`,
|
|
12082
|
+
*/
|
|
12083
|
+
multiselect__options_ul_p_multiselect__options_no_results: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
|
|
12084
|
+
multiselect__options_ul_p_multiselect__options_no_data: "\n margin: 0;\n padding: 8px;\n text-align: center;\n ",
|
|
12085
|
+
// multiselect__options ul li.multiselect__options--selected: `
|
|
12086
|
+
multiselect__options_ul_li_multiselect__options_selected: "\n background-color: #656565;\n color: #fff;\n ",
|
|
12087
|
+
// multiselect__options ul li.multiselect__options--selected:hover: `
|
|
12088
|
+
multiselect__options_ul_li_multiselect__options_selected_hover: "\n background-color: #656565;\n ",
|
|
12089
|
+
// multiselect__options ul li.arrow-selected: `
|
|
12090
|
+
multiselect__options_ul_li_arrow_selected: "\n border: 2px solid rgba(101, 101, 101, 0.5);\n ",
|
|
12091
|
+
multiselect__selected: "\n background-color: #656565;\n border-radius: 2px;\n color: #fff;\n margin-bottom: 4px;\n margin-right: 4px;\n padding: 4px 8px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n ",
|
|
12092
|
+
multiselect__selected_multiselect__remove_btn: "\n cursor: pointer;\n display: flex;\n margin-left: 6px;\n ",
|
|
12093
|
+
multiselect__input: "\n border: none;\n -ms-flex-preferred-size: 40%;\n flex-basis: 40%;\n -webkit-box-flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n height: 5px; \n margin-bottom: 4px;\n min-width: 40%;\n outline: none; \n "
|
|
12094
|
+
};
|
|
12095
|
+
exports.style = style;
|
|
12096
|
+
|
|
12097
|
+
style.setStyle = function setStyle(ele, styleName) {
|
|
12098
|
+
ele.style = style[styleName];
|
|
12099
|
+
};
|
|
12100
|
+
|
|
12101
|
+
module.exports = style;
|
|
12102
|
+
//# sourceMappingURL=style_multiSelect.js.map
|
|
12103
|
+
|
|
12104
|
+
/***/ }),
|
|
12105
|
+
|
|
12029
12106
|
/***/ "./lib/table.js":
|
|
12030
12107
|
/*!**********************!*\
|
|
12031
12108
|
!*** ./lib/table.js ***!
|
|
@@ -13914,9 +13991,9 @@ function tabWidget(options) {
|
|
|
13914
13991
|
var marginsPrepped = margins.concat(margins).slice(orientation, orientation + 4);
|
|
13915
13992
|
var marginsStyle = "margin: ".concat(marginsPrepped.join(' '), ";");
|
|
13916
13993
|
var paddingStyle = "padding: ".concat(marginsPrepped.join(' '), ";");
|
|
13917
|
-
var tabStyle = cornersStyle + "padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
|
|
13918
|
-
var unselectedStyle = "".concat(tabStyle + marginsStyle, "opacity: 50%; background-color: ").concat(backgroundColor, ";");
|
|
13919
|
-
var selectedStyle = "".concat(tabStyle + marginsStyle, "background-color: ").concat(selectedColor, ";");
|
|
13994
|
+
var tabStyle = cornersStyle + "position: relative; padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
|
|
13995
|
+
var unselectedStyle = "".concat(tabStyle + marginsStyle, " opacity: 50%; background-color: ").concat(backgroundColor, ";");
|
|
13996
|
+
var selectedStyle = "".concat(tabStyle + marginsStyle, " background-color: ").concat(selectedColor, ";");
|
|
13920
13997
|
var shownStyle = 'height: 100%; width: 100%;';
|
|
13921
13998
|
var hiddenStyle = shownStyle + 'display: none;';
|
|
13922
13999
|
rootElement.refresh = orderedSync;
|
|
@@ -13976,35 +14053,50 @@ function tabWidget(options) {
|
|
|
13976
14053
|
|
|
13977
14054
|
function makeNewSlot(item) {
|
|
13978
14055
|
var ele = dom.createElement(tabElement);
|
|
14056
|
+
ele.setAttribute('style', unselectedStyle);
|
|
13979
14057
|
ele.subject = item;
|
|
13980
|
-
var div = ele.appendChild(dom.createElement('
|
|
13981
|
-
div.setAttribute('style',
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
14058
|
+
var div = ele.appendChild(dom.createElement('button'));
|
|
14059
|
+
div.setAttribute('style', 'background: none; border: none; font: inherit; cursor: pointer');
|
|
14060
|
+
var ellipsis = dom.createElement('button');
|
|
14061
|
+
ellipsis.textContent = '...';
|
|
14062
|
+
ellipsis.setAttribute('style', 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;');
|
|
14063
|
+
|
|
14064
|
+
div.onclick = function () {
|
|
14065
|
+
resetTabStyle();
|
|
14066
|
+
resetBodyStyle();
|
|
14067
|
+
ele.setAttribute('style', selectedStyle);
|
|
14068
|
+
if (!ele.bodyTR) return;
|
|
14069
|
+
ele.bodyTR.setAttribute('style', shownStyle);
|
|
14070
|
+
var bodyMain = getOrCreateContainerElement(ele);
|
|
14071
|
+
|
|
14072
|
+
if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
|
|
14073
|
+
bodyMain.innerHTML = 'loading item ...' + item;
|
|
14074
|
+
options.renderMain(bodyMain, ele.subject);
|
|
14075
|
+
bodyMain.asSettings = false;
|
|
13986
14076
|
}
|
|
14077
|
+
};
|
|
13987
14078
|
|
|
13988
|
-
|
|
14079
|
+
ellipsis.onclick = function () {
|
|
14080
|
+
resetTabStyle();
|
|
14081
|
+
resetBodyStyle();
|
|
14082
|
+
ele.setAttribute('style', selectedStyle);
|
|
13989
14083
|
if (!ele.bodyTR) return;
|
|
13990
14084
|
ele.bodyTR.setAttribute('style', shownStyle);
|
|
13991
14085
|
var bodyMain = getOrCreateContainerElement(ele);
|
|
13992
14086
|
|
|
13993
|
-
if (options.renderTabSettings &&
|
|
14087
|
+
if (options.renderTabSettings && ele.subject && bodyMain.asSettings !== true) {
|
|
13994
14088
|
bodyMain.innerHTML = 'loading settings ...' + item;
|
|
13995
14089
|
options.renderTabSettings(bodyMain, ele.subject);
|
|
13996
14090
|
bodyMain.asSettings = true;
|
|
13997
|
-
} else if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
|
|
13998
|
-
bodyMain.innerHTML = 'loading item ...' + item;
|
|
13999
|
-
options.renderMain(bodyMain, ele.subject);
|
|
14000
|
-
bodyMain.asSettings = false;
|
|
14001
14091
|
}
|
|
14002
|
-
}
|
|
14092
|
+
};
|
|
14003
14093
|
|
|
14004
14094
|
if (options.renderTab) {
|
|
14005
14095
|
options.renderTab(div, item);
|
|
14096
|
+
ele.appendChild(ellipsis);
|
|
14006
14097
|
} else {
|
|
14007
|
-
div.
|
|
14098
|
+
div.innerHTML = (0, _utils.label)(item);
|
|
14099
|
+
ele.appendChild(ellipsis);
|
|
14008
14100
|
}
|
|
14009
14101
|
|
|
14010
14102
|
return ele;
|
|
@@ -14084,10 +14176,8 @@ function tabWidget(options) {
|
|
|
14084
14176
|
|
|
14085
14177
|
if (_tab.classList.contains('unstyled')) {
|
|
14086
14178
|
continue;
|
|
14087
|
-
}
|
|
14088
|
-
|
|
14089
|
-
if (_tab.children[0]) {
|
|
14090
|
-
_tab.children[0].setAttribute('style', unselectedStyle);
|
|
14179
|
+
} else {
|
|
14180
|
+
_tab.setAttribute('style', unselectedStyle);
|
|
14091
14181
|
}
|
|
14092
14182
|
}
|
|
14093
14183
|
}
|
|
@@ -15172,7 +15262,7 @@ function slice(s, suffix) {
|
|
|
15172
15262
|
|
|
15173
15263
|
function getWellKnownLabel(thing) {
|
|
15174
15264
|
return _solidLogic.store.any(thing, UI.ns.ui('label')) || // Prioritize ui:label
|
|
15175
|
-
_solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label'));
|
|
15265
|
+
_solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2004/02/skos/core#prefLabel'));
|
|
15176
15266
|
}
|
|
15177
15267
|
//# sourceMappingURL=label.js.map
|
|
15178
15268
|
|
|
@@ -15192,11 +15282,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
15192
15282
|
}));
|
|
15193
15283
|
exports.versionInfo = void 0;
|
|
15194
15284
|
var versionInfo = {
|
|
15195
|
-
buildTime: '2022-05-
|
|
15196
|
-
commit: '
|
|
15285
|
+
buildTime: '2022-05-25T22:15:49Z',
|
|
15286
|
+
commit: '78b3553416b2809ddb15ed7c7096d96ee54a319d',
|
|
15197
15287
|
npmInfo: {
|
|
15198
15288
|
'solid-ui': '2.4.22',
|
|
15199
|
-
npm: '6.14.
|
|
15289
|
+
npm: '6.14.17',
|
|
15200
15290
|
ares: '1.18.1',
|
|
15201
15291
|
brotli: '1.0.9',
|
|
15202
15292
|
cldr: '40.0',
|
|
@@ -15205,12 +15295,12 @@ var versionInfo = {
|
|
|
15205
15295
|
modules: '83',
|
|
15206
15296
|
napi: '8',
|
|
15207
15297
|
nghttp2: '1.42.0',
|
|
15208
|
-
node: '14.19.
|
|
15298
|
+
node: '14.19.2',
|
|
15209
15299
|
openssl: '1.1.1n',
|
|
15210
15300
|
tz: '2021a3',
|
|
15211
15301
|
unicode: '14.0',
|
|
15212
15302
|
uv: '1.42.0',
|
|
15213
|
-
v8: '8.4.371.23-node.
|
|
15303
|
+
v8: '8.4.371.23-node.87',
|
|
15214
15304
|
zlib: '1.2.11'
|
|
15215
15305
|
}
|
|
15216
15306
|
};
|
|
@@ -16280,6 +16370,7 @@ function openHrefInOutlineMode(e) {
|
|
|
16280
16370
|
|
|
16281
16371
|
if (dom.outlineManager) {
|
|
16282
16372
|
// @@ TODO Remove the use of document as a global object
|
|
16373
|
+
// TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
16283
16374
|
;
|
|
16284
16375
|
dom.outlineManager.GotoSubject(_solidLogic.store.sym(uri), true, undefined, true, undefined);
|
|
16285
16376
|
} else if (window && window.panes && window.panes.getOutliner) {
|
|
@@ -16407,6 +16498,7 @@ function linkButton(dom, object) {
|
|
|
16407
16498
|
b.textContent = 'Goto ' + utils.label(object);
|
|
16408
16499
|
b.addEventListener('click', function (_event) {
|
|
16409
16500
|
// b.parentNode.removeChild(b)
|
|
16501
|
+
// TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
16410
16502
|
;
|
|
16411
16503
|
dom.outlineManager.GotoSubject(object, true, undefined, true, undefined);
|
|
16412
16504
|
}, true);
|
|
@@ -17147,6 +17239,7 @@ exports.findClosest = findClosest;
|
|
|
17147
17239
|
exports.formsFor = formsFor;
|
|
17148
17240
|
exports.makeDescription = makeDescription;
|
|
17149
17241
|
exports.makeSelectForCategory = makeSelectForCategory;
|
|
17242
|
+
exports.makeSelectForChoice = makeSelectForChoice;
|
|
17150
17243
|
exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
|
|
17151
17244
|
exports.makeSelectForOptions = makeSelectForOptions;
|
|
17152
17245
|
exports.newButton = newButton;
|
|
@@ -17196,6 +17289,8 @@ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-l
|
|
|
17196
17289
|
|
|
17197
17290
|
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
17198
17291
|
|
|
17292
|
+
var _multiSelect = __webpack_require__(/*! ./multiSelect */ "./lib/widgets/multiSelect.js");
|
|
17293
|
+
|
|
17199
17294
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
17200
17295
|
|
|
17201
17296
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -17258,14 +17353,16 @@ _fieldFunction.field[ns.ui('Form').uri] = _fieldFunction.field[ns.ui('Group').ur
|
|
|
17258
17353
|
var ui = ns.ui;
|
|
17259
17354
|
if (container) container.appendChild(box); // Prevent loops
|
|
17260
17355
|
|
|
17356
|
+
if (!form) return;
|
|
17261
17357
|
var key = subject.toNT() + '|' + form.toNT();
|
|
17262
17358
|
|
|
17263
17359
|
if (already[key]) {
|
|
17264
17360
|
// been there done that
|
|
17265
|
-
box.appendChild(dom.createTextNode('Group: see above ' + key));
|
|
17266
|
-
|
|
17361
|
+
box.appendChild(dom.createTextNode('Group: see above ' + key)); // TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
17362
|
+
// const plist = [$rdf.st(subject, ns.owl('sameAs'), subject)] // @@ need prev subject
|
|
17363
|
+
// dom.outlineManager.appendPropertyTRs(box, plist)
|
|
17364
|
+
// dom.appendChild(plist)
|
|
17267
17365
|
|
|
17268
|
-
dom.outlineManager.appendPropertyTRs(box, plist);
|
|
17269
17366
|
return box;
|
|
17270
17367
|
}
|
|
17271
17368
|
|
|
@@ -17366,47 +17463,43 @@ _fieldFunction.field[ns.ui('Options').uri] = function (dom, container, already,
|
|
|
17366
17463
|
values = kb.each(subject, dependingOn);
|
|
17367
17464
|
}
|
|
17368
17465
|
|
|
17369
|
-
|
|
17370
|
-
|
|
17371
|
-
|
|
17372
|
-
for (var i = 0; i < cases.length; i++) {
|
|
17373
|
-
var c = cases[i];
|
|
17374
|
-
var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
|
|
17466
|
+
for (var i = 0; i < cases.length; i++) {
|
|
17467
|
+
var c = cases[i];
|
|
17468
|
+
var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
|
|
17375
17469
|
|
|
17376
|
-
|
|
17470
|
+
var match = false;
|
|
17377
17471
|
|
|
17378
|
-
|
|
17379
|
-
|
|
17380
|
-
|
|
17472
|
+
for (var j = 0; j < tests.length; j++) {
|
|
17473
|
+
var _iterator = _createForOfIteratorHelper(values),
|
|
17474
|
+
_step;
|
|
17381
17475
|
|
|
17382
|
-
|
|
17383
|
-
|
|
17384
|
-
|
|
17385
|
-
|
|
17476
|
+
try {
|
|
17477
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
17478
|
+
var value = _step.value;
|
|
17479
|
+
var test = tests[j];
|
|
17386
17480
|
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
}
|
|
17481
|
+
if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
|
|
17482
|
+
match = true;
|
|
17390
17483
|
}
|
|
17391
|
-
} catch (err) {
|
|
17392
|
-
_iterator.e(err);
|
|
17393
|
-
} finally {
|
|
17394
|
-
_iterator.f();
|
|
17395
17484
|
}
|
|
17485
|
+
} catch (err) {
|
|
17486
|
+
_iterator.e(err);
|
|
17487
|
+
} finally {
|
|
17488
|
+
_iterator.f();
|
|
17396
17489
|
}
|
|
17490
|
+
}
|
|
17397
17491
|
|
|
17398
|
-
|
|
17399
|
-
|
|
17400
|
-
|
|
17401
|
-
if (!_field3) {
|
|
17402
|
-
box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
|
|
17403
|
-
return box;
|
|
17404
|
-
} else {
|
|
17405
|
-
appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
|
|
17406
|
-
}
|
|
17492
|
+
if (match) {
|
|
17493
|
+
var _field3 = kb.the(c, ui('use'));
|
|
17407
17494
|
|
|
17408
|
-
|
|
17495
|
+
if (!_field3) {
|
|
17496
|
+
box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
|
|
17497
|
+
return box;
|
|
17498
|
+
} else {
|
|
17499
|
+
appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
|
|
17409
17500
|
}
|
|
17501
|
+
|
|
17502
|
+
break;
|
|
17410
17503
|
}
|
|
17411
17504
|
} // @@ Add box.refresh() to sync fields with values
|
|
17412
17505
|
|
|
@@ -17795,8 +17888,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
17795
17888
|
}
|
|
17796
17889
|
|
|
17797
17890
|
var multipleUIlabel = kb.any(form, ui('label'));
|
|
17798
|
-
if (!multipleUIlabel) multipleUIlabel = utils.label(property
|
|
17799
|
-
|
|
17891
|
+
if (!multipleUIlabel) multipleUIlabel = utils.label(property);
|
|
17800
17892
|
var min = kb.any(form, ui('min')); // This is the minimum number -- default 0
|
|
17801
17893
|
|
|
17802
17894
|
min = min ? 0 + min.value : 0;
|
|
@@ -18136,6 +18228,7 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
18136
18228
|
** -- radio buttons
|
|
18137
18229
|
** -- auto-complete typing
|
|
18138
18230
|
**
|
|
18231
|
+
** TODO: according to ontology ui:choice can also have ns.ui('default') - this is not implemented yet
|
|
18139
18232
|
*/
|
|
18140
18233
|
|
|
18141
18234
|
|
|
@@ -18144,9 +18237,6 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18144
18237
|
var kb = _solidLogic.store;
|
|
18145
18238
|
var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
|
|
18146
18239
|
|
|
18147
|
-
var uiMultipleInUse = false; // this signals to ui:choice that it is part of a ui:multiple
|
|
18148
|
-
|
|
18149
|
-
var multiSelect = false;
|
|
18150
18240
|
var p;
|
|
18151
18241
|
var box = dom.createElement('div');
|
|
18152
18242
|
box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
|
|
@@ -18175,101 +18265,115 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18175
18265
|
|
|
18176
18266
|
var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
|
|
18177
18267
|
|
|
18178
|
-
var possible = [];
|
|
18179
|
-
var possibleProperties;
|
|
18180
|
-
var firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *'; // if we do NOT have a container it means it is a ui:Multiple
|
|
18181
|
-
// only important for the first option text in select
|
|
18182
|
-
|
|
18183
|
-
if (!container) {
|
|
18184
|
-
uiMultipleInUse = true;
|
|
18185
|
-
firstSelectOptionText = utils.label(subject, true);
|
|
18186
|
-
}
|
|
18187
|
-
|
|
18188
18268
|
var opts = {
|
|
18189
18269
|
form: form,
|
|
18190
18270
|
subForm: subForm,
|
|
18191
|
-
multiSelect: multiSelect,
|
|
18192
|
-
firstSelectOptionText: firstSelectOptionText,
|
|
18193
|
-
uiMultipleInUse: uiMultipleInUse,
|
|
18194
18271
|
disambiguate: false
|
|
18195
18272
|
};
|
|
18196
|
-
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
18197
18273
|
|
|
18198
|
-
|
|
18199
|
-
possible
|
|
18200
|
-
|
|
18274
|
+
function getSelectorOptions() {
|
|
18275
|
+
var possible = [];
|
|
18276
|
+
var possibleProperties;
|
|
18277
|
+
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
18201
18278
|
|
|
18279
|
+
for (var x in kb.findMembersNT(uiFrom)) {
|
|
18280
|
+
possible.push(kb.fromNT(x));
|
|
18281
|
+
} // Use rdfs
|
|
18202
18282
|
|
|
18203
|
-
if (uiFrom.sameTerm(ns.rdfs('Class'))) {
|
|
18204
|
-
for (p in buttons.allClassURIs()) {
|
|
18205
|
-
possible.push(kb.sym(p));
|
|
18206
|
-
} // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
|
|
18207
18283
|
|
|
18208
|
-
|
|
18209
|
-
|
|
18284
|
+
if (uiFrom.sameTerm(ns.rdfs('Class'))) {
|
|
18285
|
+
for (p in buttons.allClassURIs()) {
|
|
18286
|
+
possible.push(kb.sym(p));
|
|
18287
|
+
} // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
|
|
18210
18288
|
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
}
|
|
18289
|
+
} else if (uiFrom.sameTerm(ns.rdf('Property'))) {
|
|
18290
|
+
possibleProperties = buttons.propertyTriage(kb);
|
|
18214
18291
|
|
|
18215
|
-
|
|
18216
|
-
|
|
18217
|
-
|
|
18292
|
+
for (p in possibleProperties.op) {
|
|
18293
|
+
possible.push(kb.fromNT(p));
|
|
18294
|
+
}
|
|
18218
18295
|
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
|
|
18296
|
+
for (p in possibleProperties.dp) {
|
|
18297
|
+
possible.push(kb.fromNT(p));
|
|
18298
|
+
}
|
|
18222
18299
|
|
|
18223
|
-
|
|
18224
|
-
|
|
18225
|
-
|
|
18300
|
+
opts.disambiguate = true; // This is a big class, and the labels won't be enough.
|
|
18301
|
+
} else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
|
|
18302
|
+
possibleProperties = buttons.propertyTriage(kb);
|
|
18226
18303
|
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
|
|
18304
|
+
for (p in possibleProperties.op) {
|
|
18305
|
+
possible.push(kb.fromNT(p));
|
|
18306
|
+
}
|
|
18307
|
+
|
|
18308
|
+
opts.disambiguate = true;
|
|
18309
|
+
} else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
|
|
18310
|
+
possibleProperties = buttons.propertyTriage(kb);
|
|
18311
|
+
|
|
18312
|
+
for (p in possibleProperties.dp) {
|
|
18313
|
+
possible.push(kb.fromNT(p));
|
|
18314
|
+
}
|
|
18230
18315
|
|
|
18231
|
-
|
|
18232
|
-
possible.push(kb.fromNT(p));
|
|
18316
|
+
opts.disambiguate = true;
|
|
18233
18317
|
}
|
|
18234
18318
|
|
|
18235
|
-
|
|
18236
|
-
}
|
|
18319
|
+
return possible; // return sortByLabel(possible)
|
|
18320
|
+
} // TODO: this checks for any occurrence, regardless of true or false setting
|
|
18237
18321
|
|
|
18238
|
-
var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurrence, regardless of true or false setting
|
|
18239
18322
|
|
|
18240
18323
|
if (kb.any(form, ui('canMintNew'))) {
|
|
18241
18324
|
opts.mint = '* Create new *'; // @@ could be better
|
|
18242
18325
|
}
|
|
18243
18326
|
|
|
18244
|
-
var
|
|
18245
|
-
rhs.appendChild(selector);
|
|
18246
|
-
var object;
|
|
18327
|
+
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
18247
18328
|
|
|
18248
|
-
|
|
18249
|
-
object = $rdf.sym(selector.currentURI);
|
|
18250
|
-
} else {
|
|
18251
|
-
object = kb.any(subject, property);
|
|
18252
|
-
}
|
|
18329
|
+
var selector; // from ui:property
|
|
18253
18330
|
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
}
|
|
18331
|
+
var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
|
|
18332
|
+
return object.value;
|
|
18333
|
+
});
|
|
18258
18334
|
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18335
|
+
rhs.refresh = function () {
|
|
18336
|
+
// from ui:from + ui:property
|
|
18337
|
+
var possibleOptions = getSelectorOptions();
|
|
18338
|
+
possibleOptions.push(selectedOptions);
|
|
18339
|
+
possibleOptions = sortByLabel(possibleOptions);
|
|
18340
|
+
selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
|
|
18341
|
+
rhs.innerHTML = '';
|
|
18342
|
+
rhs.appendChild(selector);
|
|
18343
|
+
|
|
18344
|
+
if (multiSelect) {
|
|
18345
|
+
var multiSelectDiv = new _multiSelect.IconicMultiSelect({
|
|
18346
|
+
placeholder: selector.selected,
|
|
18347
|
+
select: selector,
|
|
18348
|
+
container: rhs,
|
|
18349
|
+
textField: 'textField',
|
|
18350
|
+
valueField: 'valueField'
|
|
18351
|
+
});
|
|
18352
|
+
multiSelectDiv.init();
|
|
18353
|
+
multiSelectDiv.subscribe(function (event) {
|
|
18354
|
+
if (event.action === 'REMOVE_OPTION') {
|
|
18355
|
+
selectedOptions = selectedOptions.filter(function (value) {
|
|
18356
|
+
return value !== event.value;
|
|
18357
|
+
});
|
|
18358
|
+
}
|
|
18266
18359
|
|
|
18360
|
+
if (event.action === 'CLEAR_ALL_OPTIONS') {
|
|
18361
|
+
selectedOptions = [];
|
|
18362
|
+
}
|
|
18267
18363
|
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18364
|
+
if (event.action === 'ADD_OPTION') {
|
|
18365
|
+
selectedOptions.push(event.value);
|
|
18366
|
+
}
|
|
18367
|
+
|
|
18368
|
+
selector.update(selectedOptions);
|
|
18369
|
+
});
|
|
18370
|
+
}
|
|
18371
|
+
};
|
|
18372
|
+
|
|
18373
|
+
rhs.refresh();
|
|
18374
|
+
if (selector && selector.refresh) selector.refresh();
|
|
18375
|
+
return box;
|
|
18376
|
+
};
|
|
18273
18377
|
|
|
18274
18378
|
function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
|
|
18275
18379
|
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
|
|
@@ -18476,7 +18580,8 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
|
|
|
18476
18580
|
b.setAttribute('type', 'button');
|
|
18477
18581
|
b.setAttribute('style', 'float: right;');
|
|
18478
18582
|
b.innerHTML = 'Goto ' + utils.label(theClass);
|
|
18479
|
-
b.addEventListener('click',
|
|
18583
|
+
b.addEventListener('click', // TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
18584
|
+
function (_e) {
|
|
18480
18585
|
dom.outlineManager.GotoSubject(theClass, true, undefined, true, undefined);
|
|
18481
18586
|
}, false);
|
|
18482
18587
|
return box;
|
|
@@ -18611,18 +18716,15 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
18611
18716
|
// @param subject - a term, the subject of the statement(s) being edited.
|
|
18612
18717
|
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
18613
18718
|
// @param possible - a list of terms, the possible value the object can take
|
|
18614
|
-
// @param options.
|
|
18615
|
-
//
|
|
18616
|
-
// option for none selected (for non multiSelect)
|
|
18617
|
-
// @param options.uiMultipleInUse - signals that the ui:choise is used with a ui:multiple
|
|
18618
|
-
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
18719
|
+
// @param options.nullLabel - a string to be displayed as the
|
|
18720
|
+
// option for none selected (for non multiple)
|
|
18619
18721
|
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
18620
18722
|
// @param dataDoc - The web document being edited
|
|
18621
18723
|
// @param callbackFunction - takes (boolean ok, string errorBody)
|
|
18622
18724
|
*/
|
|
18623
18725
|
|
|
18624
18726
|
|
|
18625
|
-
function makeSelectForOptions(dom, kb, subject, predicate, possible,
|
|
18727
|
+
function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
|
|
18626
18728
|
log.debug('Select list length now ' + possible.length);
|
|
18627
18729
|
var n = 0;
|
|
18628
18730
|
var uris = {}; // Count them
|
|
@@ -18639,7 +18741,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18639
18741
|
} // uris is now the set of possible options
|
|
18640
18742
|
|
|
18641
18743
|
|
|
18642
|
-
if (n === 0
|
|
18744
|
+
if (n === 0) {
|
|
18643
18745
|
return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
|
|
18644
18746
|
}
|
|
18645
18747
|
|
|
@@ -18665,6 +18767,8 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18665
18767
|
actual = getActual();
|
|
18666
18768
|
|
|
18667
18769
|
var onChange = function onChange(_e) {
|
|
18770
|
+
select.disabled = true; // until data written back - gives user feedback too
|
|
18771
|
+
|
|
18668
18772
|
var ds = [];
|
|
18669
18773
|
var is = [];
|
|
18670
18774
|
|
|
@@ -18674,43 +18778,18 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18674
18778
|
}
|
|
18675
18779
|
};
|
|
18676
18780
|
|
|
18677
|
-
var newObject;
|
|
18678
|
-
|
|
18679
18781
|
for (var _i = 0; _i < select.options.length; _i++) {
|
|
18680
18782
|
var opt = select.options[_i];
|
|
18681
|
-
|
|
18682
|
-
if (opt.selected && opt.AJAR_mint) {
|
|
18683
|
-
// not sure if this 'if' is used because I cannot find mintClass
|
|
18684
|
-
if (options.mintClass) {
|
|
18685
|
-
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
18686
|
-
if (!ok) {
|
|
18687
|
-
callbackFunction(ok, body, {
|
|
18688
|
-
change: 'new'
|
|
18689
|
-
}); // @@ if ok, need some form of refresh of the select for the new thing
|
|
18690
|
-
}
|
|
18691
|
-
});
|
|
18692
|
-
select.parentNode.appendChild(thisForm);
|
|
18693
|
-
newObject = thisForm.AJAR_subject;
|
|
18694
|
-
} else {
|
|
18695
|
-
newObject = newThing(dataDoc);
|
|
18696
|
-
}
|
|
18697
|
-
|
|
18698
|
-
is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
|
|
18699
|
-
if (uiFrom) is.push($rdf.st(newObject, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // not sure if this 'if' is used because I cannot find mintStatementsFun
|
|
18700
|
-
|
|
18701
|
-
if (options.mintStatementsFun) {
|
|
18702
|
-
is = is.concat(options.mintStatementsFun(newObject));
|
|
18703
|
-
}
|
|
18704
|
-
|
|
18705
|
-
select.currentURI = newObject;
|
|
18706
|
-
}
|
|
18707
|
-
|
|
18708
18783
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
18709
18784
|
|
|
18710
18785
|
if (opt.selected && !(opt.AJAR_uri in actual)) {
|
|
18711
18786
|
// new class
|
|
18712
18787
|
is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
|
|
18713
|
-
|
|
18788
|
+
}
|
|
18789
|
+
|
|
18790
|
+
if (!opt.selected && opt.AJAR_uri in actual) {
|
|
18791
|
+
// old class
|
|
18792
|
+
removeValue(kb.sym(opt.AJAR_uri));
|
|
18714
18793
|
}
|
|
18715
18794
|
|
|
18716
18795
|
if (opt.selected) select.currentURI = opt.AJAR_uri;
|
|
@@ -18730,29 +18809,25 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18730
18809
|
sel = sel.superSelect;
|
|
18731
18810
|
}
|
|
18732
18811
|
|
|
18733
|
-
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
18812
|
+
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
18813
|
+
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
18814
|
+
actual = getActual(); // refresh
|
|
18734
18815
|
|
|
18735
|
-
removeNextSiblingsAfterElement(select);
|
|
18736
|
-
addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
|
|
18737
18816
|
if (ok) {
|
|
18738
|
-
|
|
18739
|
-
actual = getActual(); // refresh
|
|
18740
|
-
|
|
18741
|
-
if (!success) select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
|
|
18742
|
-
});
|
|
18743
|
-
if (callbackFunction) callbackFunction(ok, {
|
|
18744
|
-
widget: 'select',
|
|
18745
|
-
event: 'new'
|
|
18746
|
-
});
|
|
18817
|
+
select.disabled = false; // data written back
|
|
18747
18818
|
} else {
|
|
18748
|
-
select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in
|
|
18819
|
+
return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
18749
18820
|
}
|
|
18821
|
+
|
|
18822
|
+
if (callbackFunction) callbackFunction(ok, {
|
|
18823
|
+
widget: 'select',
|
|
18824
|
+
event: 'change'
|
|
18825
|
+
});
|
|
18750
18826
|
});
|
|
18751
18827
|
};
|
|
18752
18828
|
|
|
18753
18829
|
var select = dom.createElement('select');
|
|
18754
18830
|
select.setAttribute('style', style.formSelectSTyle);
|
|
18755
|
-
if (options.multiSelect) select.setAttribute('multiSelect', 'true');
|
|
18756
18831
|
select.currentURI = null;
|
|
18757
18832
|
|
|
18758
18833
|
select.refresh = function () {
|
|
@@ -18795,22 +18870,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18795
18870
|
select.appendChild(option);
|
|
18796
18871
|
}
|
|
18797
18872
|
|
|
18798
|
-
if (
|
|
18799
|
-
var mint = dom.createElement('option');
|
|
18800
|
-
mint.appendChild(dom.createTextNode(options.mint));
|
|
18801
|
-
mint.AJAR_mint = true; // Flag it
|
|
18802
|
-
|
|
18803
|
-
select.insertBefore(mint, select.firstChild);
|
|
18804
|
-
}
|
|
18805
|
-
|
|
18806
|
-
if (!select.currentURI && options.uiMultipleInUse) {
|
|
18873
|
+
if (!select.currentURI) {
|
|
18807
18874
|
var prompt = dom.createElement('option');
|
|
18808
|
-
prompt.appendChild(dom.createTextNode(options.
|
|
18809
|
-
prompt.disabled = true;
|
|
18810
|
-
prompt.value = true;
|
|
18811
|
-
prompt.hidden = true;
|
|
18812
|
-
prompt.selected = true;
|
|
18875
|
+
prompt.appendChild(dom.createTextNode(options.nullLabel));
|
|
18813
18876
|
select.insertBefore(prompt, select.firstChild);
|
|
18877
|
+
prompt.selected = true;
|
|
18814
18878
|
}
|
|
18815
18879
|
|
|
18816
18880
|
if (editable) {
|
|
@@ -18829,27 +18893,16 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18829
18893
|
function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
|
|
18830
18894
|
var du = kb.any(category, ns.owl('disjointUnionOf'));
|
|
18831
18895
|
var subs;
|
|
18832
|
-
var multiSelect = false;
|
|
18833
18896
|
|
|
18834
18897
|
if (!du) {
|
|
18835
18898
|
subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
|
|
18836
|
-
multiSelect = true;
|
|
18837
18899
|
} else {
|
|
18838
18900
|
subs = du.elements;
|
|
18839
18901
|
}
|
|
18840
18902
|
|
|
18841
18903
|
log.debug('Select list length ' + subs.length);
|
|
18842
|
-
|
|
18843
|
-
|
|
18844
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
|
|
18845
|
-
}
|
|
18846
|
-
|
|
18847
|
-
if (subs.length === 1) {
|
|
18848
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
|
|
18849
|
-
}
|
|
18850
|
-
|
|
18851
|
-
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
|
|
18852
|
-
multiSelect: multiSelect
|
|
18904
|
+
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
|
|
18905
|
+
nullLabel: '* Select type *'
|
|
18853
18906
|
}, dataDoc, callbackFunction);
|
|
18854
18907
|
}
|
|
18855
18908
|
/** Make SELECT element to select subclasses recurively
|
|
@@ -18883,8 +18936,7 @@ function makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, callba
|
|
|
18883
18936
|
function onChange(ok, body) {
|
|
18884
18937
|
if (ok) update();
|
|
18885
18938
|
callbackFunction(ok, body);
|
|
18886
|
-
}
|
|
18887
|
-
|
|
18939
|
+
}
|
|
18888
18940
|
|
|
18889
18941
|
var select = makeSelectForCategory(dom, kb, subject, category, dataDoc, onChange);
|
|
18890
18942
|
container.appendChild(select);
|
|
@@ -19039,72 +19091,331 @@ function newThing(doc) {
|
|
|
19039
19091
|
var now = new Date();
|
|
19040
19092
|
return $rdf.sym(doc.uri + '#' + 'id' + ('' + now.getTime()));
|
|
19041
19093
|
}
|
|
19042
|
-
|
|
19094
|
+
/** Make SELECT element to select options
|
|
19095
|
+
//
|
|
19096
|
+
// @param subject - a term, the subject of the statement(s) being edited.
|
|
19097
|
+
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
19098
|
+
// @param possible - a list of terms, the possible value the object can take
|
|
19099
|
+
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
19100
|
+
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
19101
|
+
// @param dataDoc - The web document being edited
|
|
19102
|
+
// @param callbackFunction - takes (boolean ok, string errorBody)
|
|
19103
|
+
*/
|
|
19043
19104
|
|
|
19044
|
-
/***/ }),
|
|
19045
19105
|
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
!*** ./lib/widgets/forms/autocomplete/autocompleteBar.js ***!
|
|
19049
|
-
\***********************************************************/
|
|
19050
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
19106
|
+
function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossibleOptions, selectedOptions, uiFrom, options, dataDoc, callbackFunction) {
|
|
19107
|
+
var optionsFromClassUIfrom = {}; // Count them
|
|
19051
19108
|
|
|
19052
|
-
|
|
19109
|
+
var editable = kb.updater.editable(dataDoc.uri);
|
|
19053
19110
|
|
|
19111
|
+
for (var i = 0; i < inputPossibleOptions.length; i++) {
|
|
19112
|
+
var sub = inputPossibleOptions[i]; // @@ Maybe; make this so it works with blank nodes too
|
|
19113
|
+
// if (!sub.uri) debug.warn(`makeSelectForChoice: option does not have an uri: ${sub}, with predicate: ${predicate}`)
|
|
19054
19114
|
|
|
19055
|
-
|
|
19115
|
+
if (!sub.uri || sub.uri in optionsFromClassUIfrom) continue;
|
|
19116
|
+
optionsFromClassUIfrom[sub.uri] = true;
|
|
19117
|
+
}
|
|
19056
19118
|
|
|
19057
|
-
var
|
|
19119
|
+
var isEmpty = Object.keys(optionsFromClassUIfrom).length === 0;
|
|
19058
19120
|
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
}
|
|
19062
|
-
exports.renderAutocompleteControl = renderAutocompleteControl;
|
|
19121
|
+
if (isEmpty && !options.mint) {
|
|
19122
|
+
return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
|
|
19123
|
+
}
|
|
19063
19124
|
|
|
19064
|
-
|
|
19125
|
+
log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
|
|
19065
19126
|
|
|
19066
|
-
|
|
19127
|
+
function determineFitstSelectOptionText() {
|
|
19128
|
+
var firstSelectOptionText = '--- choice ---';
|
|
19067
19129
|
|
|
19068
|
-
|
|
19130
|
+
if (predicate && !(predicate.termType === 'BlankNode')) {
|
|
19131
|
+
firstSelectOptionText = '* Select for property: ' + utils.label(predicate) + ' *';
|
|
19132
|
+
}
|
|
19069
19133
|
|
|
19070
|
-
|
|
19134
|
+
if (subject && !(subject.termType === 'BlankNode')) {
|
|
19135
|
+
firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *';
|
|
19136
|
+
}
|
|
19071
19137
|
|
|
19072
|
-
|
|
19138
|
+
return firstSelectOptionText;
|
|
19139
|
+
}
|
|
19073
19140
|
|
|
19074
|
-
|
|
19141
|
+
function determinFirstSelectOption() {
|
|
19142
|
+
var option = dom.createElement('option');
|
|
19143
|
+
option.appendChild(dom.createTextNode(determineFitstSelectOptionText()));
|
|
19144
|
+
option.disabled = true;
|
|
19145
|
+
option.value = true;
|
|
19146
|
+
option.hidden = true;
|
|
19147
|
+
option.selected = true;
|
|
19148
|
+
return option;
|
|
19149
|
+
}
|
|
19075
19150
|
|
|
19076
|
-
var
|
|
19151
|
+
var onChange = function onChange(_e) {
|
|
19152
|
+
container.removeChild(container.lastChild);
|
|
19153
|
+
select.refresh();
|
|
19154
|
+
};
|
|
19077
19155
|
|
|
19078
|
-
var
|
|
19156
|
+
var select = dom.createElement('select');
|
|
19157
|
+
select.setAttribute('style', style.formSelectSTyle);
|
|
19158
|
+
select.setAttribute('id', 'formSelect');
|
|
19159
|
+
select.currentURI = null;
|
|
19079
19160
|
|
|
19080
|
-
|
|
19161
|
+
for (var uri in optionsFromClassUIfrom) {
|
|
19162
|
+
select.appendChild(createOption(uri));
|
|
19163
|
+
}
|
|
19081
19164
|
|
|
19082
|
-
|
|
19165
|
+
if (editable && options.mint) {
|
|
19166
|
+
var mint = dom.createElement('option');
|
|
19167
|
+
mint.appendChild(dom.createTextNode(options.mint));
|
|
19168
|
+
mint.AJAR_mint = true; // Flag it
|
|
19083
19169
|
|
|
19084
|
-
|
|
19170
|
+
select.insertBefore(mint, select.firstChild);
|
|
19171
|
+
}
|
|
19085
19172
|
|
|
19086
|
-
|
|
19173
|
+
if (select.children.length === 0) select.insertBefore(determinFirstSelectOption(), select.firstChild);
|
|
19087
19174
|
|
|
19088
|
-
|
|
19175
|
+
select.update = function (newSelectedOptions) {
|
|
19176
|
+
selectedOptions = newSelectedOptions;
|
|
19177
|
+
var ds = [];
|
|
19178
|
+
var is = [];
|
|
19089
19179
|
|
|
19090
|
-
var
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19180
|
+
var removeValue = function removeValue(t) {
|
|
19181
|
+
if (kb.holds(subject, predicate, t, dataDoc)) {
|
|
19182
|
+
ds.push($rdf.st(subject, predicate, t, dataDoc)); // console.log("----value removed " + t)
|
|
19183
|
+
}
|
|
19184
|
+
};
|
|
19094
19185
|
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19186
|
+
var addValue = function addValue(t) {
|
|
19187
|
+
if (!kb.holds(subject, predicate, t, dataDoc)) {
|
|
19188
|
+
is.push($rdf.st(subject, predicate, t, dataDoc)); // console.log("----value added " + t)
|
|
19189
|
+
}
|
|
19099
19190
|
|
|
19191
|
+
if (uiFrom && !kb.holds(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)) {
|
|
19192
|
+
is.push($rdf.st(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // console.log("----added type to value " + uiFrom)
|
|
19193
|
+
}
|
|
19194
|
+
};
|
|
19100
19195
|
|
|
19101
|
-
function
|
|
19102
|
-
|
|
19103
|
-
|
|
19196
|
+
var existingValues = kb.each(subject, predicate, null, dataDoc).map(function (object) {
|
|
19197
|
+
return object.value;
|
|
19198
|
+
});
|
|
19104
19199
|
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19200
|
+
var _iterator2 = _createForOfIteratorHelper(existingValues),
|
|
19201
|
+
_step2;
|
|
19202
|
+
|
|
19203
|
+
try {
|
|
19204
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
19205
|
+
var value = _step2.value;
|
|
19206
|
+
if (!containsObject(value, selectedOptions)) removeValue($rdf.sym(value));
|
|
19207
|
+
}
|
|
19208
|
+
} catch (err) {
|
|
19209
|
+
_iterator2.e(err);
|
|
19210
|
+
} finally {
|
|
19211
|
+
_iterator2.f();
|
|
19212
|
+
}
|
|
19213
|
+
|
|
19214
|
+
var _iterator3 = _createForOfIteratorHelper(selectedOptions),
|
|
19215
|
+
_step3;
|
|
19216
|
+
|
|
19217
|
+
try {
|
|
19218
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
19219
|
+
var _value = _step3.value;
|
|
19220
|
+
if (!(_value in existingValues)) addValue($rdf.sym(_value));
|
|
19221
|
+
}
|
|
19222
|
+
} catch (err) {
|
|
19223
|
+
_iterator3.e(err);
|
|
19224
|
+
} finally {
|
|
19225
|
+
_iterator3.f();
|
|
19226
|
+
}
|
|
19227
|
+
|
|
19228
|
+
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
19229
|
+
if (!ok) return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
19230
|
+
select.refresh();
|
|
19231
|
+
if (callbackFunction) callbackFunction(ok, {
|
|
19232
|
+
widget: 'select',
|
|
19233
|
+
event: 'change'
|
|
19234
|
+
});
|
|
19235
|
+
});
|
|
19236
|
+
};
|
|
19237
|
+
|
|
19238
|
+
select.refresh = function () {
|
|
19239
|
+
select.disabled = true; // unlocked any conflict we had got into
|
|
19240
|
+
|
|
19241
|
+
var is = [];
|
|
19242
|
+
var newObject;
|
|
19243
|
+
|
|
19244
|
+
for (var _i3 = 0; _i3 < select.options.length; _i3++) {
|
|
19245
|
+
var opt = select.options[_i3];
|
|
19246
|
+
|
|
19247
|
+
if (opt.selected && opt.AJAR_mint) {
|
|
19248
|
+
// not sure if this 'if' is used because I cannot find mintClass
|
|
19249
|
+
if (options.mintClass) {
|
|
19250
|
+
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
19251
|
+
if (!ok) {
|
|
19252
|
+
callbackFunction(ok, body, {
|
|
19253
|
+
change: 'new'
|
|
19254
|
+
}); // @@ if ok, need some form of refresh of the select for the new thing
|
|
19255
|
+
}
|
|
19256
|
+
});
|
|
19257
|
+
select.parentNode.appendChild(thisForm);
|
|
19258
|
+
newObject = thisForm.AJAR_subject;
|
|
19259
|
+
} else {
|
|
19260
|
+
newObject = newThing(dataDoc);
|
|
19261
|
+
}
|
|
19262
|
+
|
|
19263
|
+
is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
|
|
19264
|
+
if (uiFrom) is.push($rdf.st(newObject, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // not sure if this 'if' is used because I cannot find mintStatementsFun
|
|
19265
|
+
|
|
19266
|
+
if (options.mintStatementsFun) {
|
|
19267
|
+
is = is.concat(options.mintStatementsFun(newObject));
|
|
19268
|
+
}
|
|
19269
|
+
|
|
19270
|
+
select.currentURI = newObject;
|
|
19271
|
+
}
|
|
19272
|
+
|
|
19273
|
+
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
19274
|
+
|
|
19275
|
+
if (opt.selected && containsObject(opt.AJAR_uri, selectedOptions)) {
|
|
19276
|
+
select.currentURI = opt.AJAR_uri;
|
|
19277
|
+
}
|
|
19278
|
+
|
|
19279
|
+
if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'false');
|
|
19280
|
+
if (containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'true');
|
|
19281
|
+
}
|
|
19282
|
+
|
|
19283
|
+
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
19284
|
+
|
|
19285
|
+
if (select.currentURI) {
|
|
19286
|
+
addSubFormChoice(dom, container, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
|
|
19287
|
+
if (ok) {
|
|
19288
|
+
kb.updater.update([], is, function (uri, success, errorBody) {
|
|
19289
|
+
if (!success) container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
|
|
19290
|
+
});
|
|
19291
|
+
if (callbackFunction) callbackFunction(ok, {
|
|
19292
|
+
widget: 'select',
|
|
19293
|
+
event: 'new'
|
|
19294
|
+
});
|
|
19295
|
+
} else {
|
|
19296
|
+
container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
|
|
19297
|
+
}
|
|
19298
|
+
});
|
|
19299
|
+
}
|
|
19300
|
+
|
|
19301
|
+
select.disabled = false;
|
|
19302
|
+
};
|
|
19303
|
+
|
|
19304
|
+
function createOption(uri) {
|
|
19305
|
+
var option = dom.createElement('option');
|
|
19306
|
+
var c = kb.sym(uri);
|
|
19307
|
+
var label;
|
|
19308
|
+
|
|
19309
|
+
if (options.disambiguate) {
|
|
19310
|
+
label = utils.labelWithOntology(c, true); // Init. cap
|
|
19311
|
+
} else {
|
|
19312
|
+
label = utils.label(c, true);
|
|
19313
|
+
}
|
|
19314
|
+
|
|
19315
|
+
option.appendChild(dom.createTextNode(label)); // Init.
|
|
19316
|
+
|
|
19317
|
+
option.setAttribute('value', uri);
|
|
19318
|
+
var backgroundColor = kb.any(c, kb.sym('http://www.w3.org/ns/ui#backgroundColor'));
|
|
19319
|
+
|
|
19320
|
+
if (backgroundColor) {
|
|
19321
|
+
option.setAttribute('style', 'background-color: ' + backgroundColor.value + '; ');
|
|
19322
|
+
}
|
|
19323
|
+
|
|
19324
|
+
option.AJAR_uri = uri;
|
|
19325
|
+
|
|
19326
|
+
if (c.value === '' + select.currentURI || containsObject(c.value, selectedOptions)) {
|
|
19327
|
+
option.selected = true;
|
|
19328
|
+
option.setAttribute('selected', 'true');
|
|
19329
|
+
}
|
|
19330
|
+
|
|
19331
|
+
return option;
|
|
19332
|
+
}
|
|
19333
|
+
|
|
19334
|
+
if (editable) {
|
|
19335
|
+
select.addEventListener('change', onChange, false);
|
|
19336
|
+
}
|
|
19337
|
+
|
|
19338
|
+
return select;
|
|
19339
|
+
} // makeSelectForChoice
|
|
19340
|
+
|
|
19341
|
+
|
|
19342
|
+
function containsObject(obj, list) {
|
|
19343
|
+
var i;
|
|
19344
|
+
|
|
19345
|
+
for (i = 0; i < list.length; i++) {
|
|
19346
|
+
if (list[i] === obj) {
|
|
19347
|
+
return true;
|
|
19348
|
+
}
|
|
19349
|
+
}
|
|
19350
|
+
|
|
19351
|
+
return false;
|
|
19352
|
+
}
|
|
19353
|
+
//# sourceMappingURL=forms.js.map
|
|
19354
|
+
|
|
19355
|
+
/***/ }),
|
|
19356
|
+
|
|
19357
|
+
/***/ "./lib/widgets/forms/autocomplete/autocompleteBar.js":
|
|
19358
|
+
/*!***********************************************************!*\
|
|
19359
|
+
!*** ./lib/widgets/forms/autocomplete/autocompleteBar.js ***!
|
|
19360
|
+
\***********************************************************/
|
|
19361
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
19362
|
+
|
|
19363
|
+
"use strict";
|
|
19364
|
+
|
|
19365
|
+
|
|
19366
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19367
|
+
|
|
19368
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
19369
|
+
|
|
19370
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
19371
|
+
value: true
|
|
19372
|
+
}));
|
|
19373
|
+
exports.renderAutocompleteControl = renderAutocompleteControl;
|
|
19374
|
+
|
|
19375
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
19376
|
+
|
|
19377
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
19378
|
+
|
|
19379
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../../../ns */ "./lib/ns.js"));
|
|
19380
|
+
|
|
19381
|
+
var _iconBase = __webpack_require__(/*! ../../../iconBase */ "./lib/iconBase.js");
|
|
19382
|
+
|
|
19383
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
19384
|
+
|
|
19385
|
+
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../../../widgets */ "./lib/widgets/index.js"));
|
|
19386
|
+
|
|
19387
|
+
var utils = _interopRequireWildcard(__webpack_require__(/*! ../../../utils */ "./lib/utils/index.js"));
|
|
19388
|
+
|
|
19389
|
+
var _autocompletePicker = __webpack_require__(/*! ./autocompletePicker */ "./lib/widgets/forms/autocomplete/autocompletePicker.js");
|
|
19390
|
+
|
|
19391
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19392
|
+
|
|
19393
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19394
|
+
|
|
19395
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
19396
|
+
|
|
19397
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19398
|
+
|
|
19399
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19400
|
+
|
|
19401
|
+
var WEBID_NOUN = 'Solid ID';
|
|
19402
|
+
var GREEN_PLUS = _iconBase.icons.iconBase + 'noun_34653_green.svg';
|
|
19403
|
+
var SEARCH_ICON = _iconBase.icons.iconBase + 'noun_Search_875351.svg';
|
|
19404
|
+
var EDIT_ICON = _iconBase.icons.iconBase + 'noun_253504.svg'; // const DELETE_ICON = icons.iconBase + 'noun_2188_red.svg'
|
|
19405
|
+
|
|
19406
|
+
function renderAutocompleteControl(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
19407
|
+
return _renderAutocompleteControl.apply(this, arguments);
|
|
19408
|
+
} // renderAutocompleteControl
|
|
19409
|
+
// ends
|
|
19410
|
+
|
|
19411
|
+
|
|
19412
|
+
function _renderAutocompleteControl() {
|
|
19413
|
+
_renderAutocompleteControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(dom, person, barOptions, acOptions, addOneIdAndRefresh, deleteOne) {
|
|
19414
|
+
var autoCompleteDone, _autoCompleteDone, greenButtonHandler, _greenButtonHandler, removeDecorated, displayAutocomplete, _displayAutocomplete, searchButtonHandler, _searchButtonHandler, droppedURIHandler, _droppedURIHandler, acceptButton, cancelButton, deleteButtonContainer, noun, deleteButton, editButton, editing, syncEditingStatus, decoration, decoratedAutocomplete, creationArea, plus;
|
|
19415
|
+
|
|
19416
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
19417
|
+
while (1) {
|
|
19418
|
+
switch (_context6.prev = _context6.next) {
|
|
19108
19419
|
case 0:
|
|
19109
19420
|
syncEditingStatus = function _syncEditingStatus() {
|
|
19110
19421
|
if (editing) {
|
|
@@ -22013,10 +22324,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
22013
22324
|
|
|
22014
22325
|
/***/ }),
|
|
22015
22326
|
|
|
22016
|
-
/***/ "./lib/widgets/
|
|
22017
|
-
|
|
22018
|
-
!*** ./lib/widgets/
|
|
22019
|
-
|
|
22327
|
+
/***/ "./lib/widgets/multiSelect.js":
|
|
22328
|
+
/*!************************************!*\
|
|
22329
|
+
!*** ./lib/widgets/multiSelect.js ***!
|
|
22330
|
+
\************************************/
|
|
22020
22331
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
22021
22332
|
|
|
22022
22333
|
"use strict";
|
|
@@ -22029,81 +22340,875 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
22029
22340
|
Object.defineProperty(exports, "__esModule", ({
|
|
22030
22341
|
value: true
|
|
22031
22342
|
}));
|
|
22032
|
-
exports.
|
|
22343
|
+
exports.IconicMultiSelect = void 0;
|
|
22033
22344
|
|
|
22034
|
-
var
|
|
22345
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
22035
22346
|
|
|
22036
22347
|
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
22037
22348
|
|
|
22038
22349
|
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
22039
22350
|
|
|
22040
|
-
var
|
|
22041
|
-
|
|
22042
|
-
var _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/index.js"));
|
|
22351
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
22043
22352
|
|
|
22044
|
-
var
|
|
22353
|
+
var style = _interopRequireWildcard(__webpack_require__(/*! ../style_multiSelect */ "./lib/style_multiSelect.js"));
|
|
22045
22354
|
|
|
22046
|
-
var
|
|
22355
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22047
22356
|
|
|
22048
|
-
var
|
|
22357
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22049
22358
|
|
|
22050
|
-
|
|
22359
|
+
/*
|
|
22360
|
+
* IconicMultiSelect v0.7.0
|
|
22361
|
+
* Licence: MIT
|
|
22362
|
+
* (c) 2021 Sidney Wimart.
|
|
22363
|
+
* repo & configuration: https://github.com/sidneywm/iconic-multiselect
|
|
22364
|
+
*/
|
|
22051
22365
|
|
|
22052
|
-
|
|
22366
|
+
/**
|
|
22367
|
+
* @version IconicMultiSelect v0.7.0
|
|
22368
|
+
* @licence MIT
|
|
22369
|
+
*/
|
|
22370
|
+
var IconicMultiSelect = /*#__PURE__*/function () {
|
|
22371
|
+
/**
|
|
22372
|
+
* Iconic Multiselect constructor.
|
|
22373
|
+
* @param { Object[] } data - Array of objects.
|
|
22374
|
+
* @param { string } noData - Defines the message when there is no data input.
|
|
22375
|
+
* @param { string } noResults - Defines the message when there is no result if options are filtered.
|
|
22376
|
+
* @param { string } placeholder - Defines the placeholder's text.
|
|
22377
|
+
* @param { string } select - DOM element to be selected. It must be a HTML Select tag - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
|
|
22378
|
+
* @param { string } textField - Field to select in the object for the text.
|
|
22379
|
+
* @param { string } valueField - Field to select in the object for the value.
|
|
22380
|
+
*/
|
|
22381
|
+
function IconicMultiSelect(_ref) {
|
|
22382
|
+
var data = _ref.data,
|
|
22383
|
+
itemTemplate = _ref.itemTemplate,
|
|
22384
|
+
noData = _ref.noData,
|
|
22385
|
+
noResults = _ref.noResults,
|
|
22386
|
+
placeholder = _ref.placeholder,
|
|
22387
|
+
select = _ref.select,
|
|
22388
|
+
container = _ref.container,
|
|
22389
|
+
tagTemplate = _ref.tagTemplate,
|
|
22390
|
+
textField = _ref.textField,
|
|
22391
|
+
valueField = _ref.valueField;
|
|
22392
|
+
(0, _classCallCheck2["default"])(this, IconicMultiSelect);
|
|
22393
|
+
(0, _defineProperty2["default"])(this, "_data", void 0);
|
|
22394
|
+
(0, _defineProperty2["default"])(this, "_domElements", void 0);
|
|
22395
|
+
(0, _defineProperty2["default"])(this, "_event", function () {});
|
|
22396
|
+
(0, _defineProperty2["default"])(this, "_itemTemplate", void 0);
|
|
22397
|
+
(0, _defineProperty2["default"])(this, "_multiselect", void 0);
|
|
22398
|
+
(0, _defineProperty2["default"])(this, "_noData", void 0);
|
|
22399
|
+
(0, _defineProperty2["default"])(this, "_noResults", void 0);
|
|
22400
|
+
(0, _defineProperty2["default"])(this, "_options", []);
|
|
22401
|
+
(0, _defineProperty2["default"])(this, "_placeholder", void 0);
|
|
22402
|
+
(0, _defineProperty2["default"])(this, "_select", void 0);
|
|
22403
|
+
(0, _defineProperty2["default"])(this, "_selectContainer", void 0);
|
|
22404
|
+
(0, _defineProperty2["default"])(this, "_selectedOptions", []);
|
|
22405
|
+
(0, _defineProperty2["default"])(this, "_tagTemplate", void 0);
|
|
22406
|
+
(0, _defineProperty2["default"])(this, "_textField", void 0);
|
|
22407
|
+
(0, _defineProperty2["default"])(this, "_valueField", void 0);
|
|
22408
|
+
(0, _defineProperty2["default"])(this, "_cross", "\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M6.2253 4.81108C5.83477 4.42056 5.20161 4.42056 4.81108 4.81108C4.42056 5.20161 4.42056 5.83477 4.81108 6.2253L10.5858 12L4.81114 17.7747C4.42062 18.1652 4.42062 18.7984 4.81114 19.1889C5.20167 19.5794 5.83483 19.5794 6.22535 19.1889L12 13.4142L17.7747 19.1889C18.1652 19.5794 18.7984 19.5794 19.1889 19.1889C19.5794 18.7984 19.5794 18.1652 19.1889 17.7747L13.4142 12L19.189 6.2253C19.5795 5.83477 19.5795 5.20161 19.189 4.81108C18.7985 4.42056 18.1653 4.42056 17.7748 4.81108L12 10.5858L6.2253 4.81108Z\"\n fill=\"currentColor\"\n />\n </svg>\n ");
|
|
22409
|
+
this._data = data !== null && data !== void 0 ? data : [];
|
|
22410
|
+
this._itemTemplate = itemTemplate !== null && itemTemplate !== void 0 ? itemTemplate : null;
|
|
22411
|
+
this._noData = noData !== null && noData !== void 0 ? noData : 'No data found.';
|
|
22412
|
+
this._noResults = noResults !== null && noResults !== void 0 ? noResults : 'No results found.';
|
|
22413
|
+
this._placeholder = placeholder !== null && placeholder !== void 0 ? placeholder : 'Select...';
|
|
22414
|
+
this._select = select; // Timea added a container here
|
|
22415
|
+
|
|
22416
|
+
this._selectContainer = container;
|
|
22417
|
+
this._tagTemplate = tagTemplate !== null && tagTemplate !== void 0 ? tagTemplate : null;
|
|
22418
|
+
this._textField = textField !== null && textField !== void 0 ? textField : null;
|
|
22419
|
+
this._valueField = valueField !== null && valueField !== void 0 ? valueField : null;
|
|
22420
|
+
}
|
|
22421
|
+
/**
|
|
22422
|
+
* Initialize the Iconic Multiselect component.
|
|
22423
|
+
* @public
|
|
22424
|
+
*/
|
|
22053
22425
|
|
|
22054
|
-
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
22055
22426
|
|
|
22056
|
-
|
|
22427
|
+
(0, _createClass2["default"])(IconicMultiSelect, [{
|
|
22428
|
+
key: "init",
|
|
22429
|
+
value: function init() {
|
|
22430
|
+
// Timea change to use this._select instead of this._selectContainer
|
|
22431
|
+
if (this._select && this._select.nodeName === 'SELECT') {
|
|
22432
|
+
if (this._itemTemplate && this._data.length === 0) {
|
|
22433
|
+
throw new Error('itemTemplate must be initialized with data from the component settings');
|
|
22434
|
+
}
|
|
22057
22435
|
|
|
22058
|
-
|
|
22436
|
+
if (this._tagTemplate && this._data.length === 0) {
|
|
22437
|
+
throw new Error('tagTemplate must be initialized with data from the component settings');
|
|
22438
|
+
}
|
|
22059
22439
|
|
|
22060
|
-
|
|
22440
|
+
this._options = this._data.length > 0 ? this._getDataFromSettings() : this._getDataFromSelectTag();
|
|
22061
22441
|
|
|
22062
|
-
|
|
22442
|
+
this._renderMultiselect();
|
|
22063
22443
|
|
|
22064
|
-
|
|
22444
|
+
this._renderOptionsList();
|
|
22065
22445
|
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
22446
|
+
this._domElements = {
|
|
22447
|
+
clear: this._multiselect.querySelector('.multiselect__clear-btn'),
|
|
22448
|
+
input: this._multiselect.querySelector('.multiselect__input'),
|
|
22449
|
+
optionsContainer: this._multiselect.querySelector('.multiselect__options'),
|
|
22450
|
+
optionsContainerList: this._multiselect.querySelector('.multiselect__options > ul'),
|
|
22451
|
+
options: {
|
|
22452
|
+
list: this._multiselect.querySelectorAll('.multiselect__options > ul > li'),
|
|
22453
|
+
find: function find(callbackFn) {
|
|
22454
|
+
for (var i = 0; i < this.list.length; i++) {
|
|
22455
|
+
var node = this.list[i];
|
|
22456
|
+
if (callbackFn(node)) return node;
|
|
22457
|
+
}
|
|
22075
22458
|
|
|
22076
|
-
|
|
22077
|
-
|
|
22459
|
+
return undefined;
|
|
22460
|
+
},
|
|
22461
|
+
some: function some(callbackFn) {
|
|
22462
|
+
for (var i = 0; i < this.list.length; i++) {
|
|
22463
|
+
var node = this.list[i];
|
|
22464
|
+
if (callbackFn(node, i)) return true;
|
|
22465
|
+
}
|
|
22078
22466
|
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
|
|
22467
|
+
return false;
|
|
22468
|
+
}
|
|
22469
|
+
}
|
|
22470
|
+
};
|
|
22083
22471
|
|
|
22084
|
-
|
|
22085
|
-
container.style.maxWidth = '350px';
|
|
22086
|
-
container.style.minHeight = '200px';
|
|
22087
|
-
container.style.outline = '1px solid black';
|
|
22088
|
-
container.style.display = 'flex';
|
|
22472
|
+
this._enableEventListenners();
|
|
22089
22473
|
|
|
22090
|
-
|
|
22091
|
-
|
|
22092
|
-
|
|
22093
|
-
|
|
22094
|
-
|
|
22095
|
-
|
|
22096
|
-
|
|
22097
|
-
|
|
22474
|
+
this._initSelectedList();
|
|
22475
|
+
} else {
|
|
22476
|
+
throw new Error("The selector '".concat(this._select, "' did not select any valid select tag."));
|
|
22477
|
+
}
|
|
22478
|
+
}
|
|
22479
|
+
/**
|
|
22480
|
+
* Subscribes to the emitted events.
|
|
22481
|
+
* @param { Function } callback - Callback function which emits a custom event object.
|
|
22482
|
+
* @public
|
|
22483
|
+
*/
|
|
22098
22484
|
|
|
22099
|
-
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
|
|
22485
|
+
}, {
|
|
22486
|
+
key: "subscribe",
|
|
22487
|
+
value: function subscribe(callback) {
|
|
22488
|
+
if (typeof callback === 'function') {
|
|
22489
|
+
this._event = callback;
|
|
22103
22490
|
} else {
|
|
22104
|
-
|
|
22105
|
-
|
|
22106
|
-
|
|
22491
|
+
throw new Error('parameter in the subscribe method is not a function');
|
|
22492
|
+
}
|
|
22493
|
+
}
|
|
22494
|
+
/**
|
|
22495
|
+
* Add an option to the selection list.
|
|
22496
|
+
* @param { Object: { text: string; value: string; }} option
|
|
22497
|
+
* @private
|
|
22498
|
+
*/
|
|
22499
|
+
|
|
22500
|
+
}, {
|
|
22501
|
+
key: "_addOptionToList",
|
|
22502
|
+
value: function _addOptionToList(option, index) {
|
|
22503
|
+
var _this = this;
|
|
22504
|
+
|
|
22505
|
+
var html = "<span class=\"multiselect__selected\" style=\"".concat(style.multiselect__selected, "\" data-value=\"").concat(option.value, "\">").concat(this._tagTemplate ? this._processTemplate(this._tagTemplate, index) : option.text, "<span class=\"multiselect__remove-btn\" style=\"").concat(style.multiselect__remove_btn, "\">").concat(this._cross, "</span></span>");
|
|
22506
|
+
|
|
22507
|
+
this._domElements.input.insertAdjacentHTML('beforebegin', html);
|
|
22508
|
+
|
|
22509
|
+
var _this$_multiselect$qu = this._multiselect.querySelector("span[data-value=\"".concat(option.value, "\"]")),
|
|
22510
|
+
removeBtn = _this$_multiselect$qu.lastElementChild;
|
|
22511
|
+
|
|
22512
|
+
removeBtn.addEventListener('click', function () {
|
|
22513
|
+
var target = _this._domElements.options.find(function (el) {
|
|
22514
|
+
return el.dataset.value === option.value;
|
|
22515
|
+
});
|
|
22516
|
+
|
|
22517
|
+
_this._handleOption(target);
|
|
22518
|
+
});
|
|
22519
|
+
}
|
|
22520
|
+
/**
|
|
22521
|
+
* Clears all selected options.
|
|
22522
|
+
* @private
|
|
22523
|
+
*/
|
|
22524
|
+
|
|
22525
|
+
}, {
|
|
22526
|
+
key: "_clearSelection",
|
|
22527
|
+
value: function _clearSelection() {
|
|
22528
|
+
var _this2 = this;
|
|
22529
|
+
|
|
22530
|
+
var _loop = function _loop(i) {
|
|
22531
|
+
var option = _this2._selectedOptions[i];
|
|
22532
|
+
|
|
22533
|
+
var target = _this2._domElements.options.find(function (el) {
|
|
22534
|
+
return el.dataset.value === option.value;
|
|
22535
|
+
});
|
|
22536
|
+
|
|
22537
|
+
target.classList.remove('multiselect__options--selected');
|
|
22538
|
+
target.setAttribute('style', style.multiselect__options);
|
|
22539
|
+
|
|
22540
|
+
_this2._removeOptionFromList(target.dataset.value);
|
|
22541
|
+
};
|
|
22542
|
+
|
|
22543
|
+
for (var i = 0; i < this._selectedOptions.length; i++) {
|
|
22544
|
+
_loop(i);
|
|
22545
|
+
}
|
|
22546
|
+
|
|
22547
|
+
this._selectedOptions = [];
|
|
22548
|
+
|
|
22549
|
+
this._handleClearSelectionBtn();
|
|
22550
|
+
|
|
22551
|
+
this._handlePlaceholder();
|
|
22552
|
+
|
|
22553
|
+
this._dispatchEvent({
|
|
22554
|
+
action: 'CLEAR_ALL_OPTIONS',
|
|
22555
|
+
selection: this._selectedOptions
|
|
22556
|
+
});
|
|
22557
|
+
}
|
|
22558
|
+
/**
|
|
22559
|
+
* Close the options container.
|
|
22560
|
+
* @private
|
|
22561
|
+
*/
|
|
22562
|
+
|
|
22563
|
+
}, {
|
|
22564
|
+
key: "_closeList",
|
|
22565
|
+
value: function _closeList() {
|
|
22566
|
+
this._domElements.input.value = '';
|
|
22567
|
+
|
|
22568
|
+
this._domElements.optionsContainer.classList.remove('visible');
|
|
22569
|
+
|
|
22570
|
+
this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
|
|
22571
|
+
|
|
22572
|
+
this._filterOptions('');
|
|
22573
|
+
|
|
22574
|
+
this._removeAllArrowSelected();
|
|
22575
|
+
}
|
|
22576
|
+
/**
|
|
22577
|
+
* Dispatches new events.
|
|
22578
|
+
* @param { object : { action: string; selection: { option: string; text: string; }[]; value?: string; } } event
|
|
22579
|
+
* @private
|
|
22580
|
+
*/
|
|
22581
|
+
|
|
22582
|
+
}, {
|
|
22583
|
+
key: "_dispatchEvent",
|
|
22584
|
+
value: function _dispatchEvent(event) {
|
|
22585
|
+
this._event(event);
|
|
22586
|
+
}
|
|
22587
|
+
/**
|
|
22588
|
+
* Enables all main event listenners.
|
|
22589
|
+
* @private
|
|
22590
|
+
*/
|
|
22591
|
+
|
|
22592
|
+
}, {
|
|
22593
|
+
key: "_enableEventListenners",
|
|
22594
|
+
value: function _enableEventListenners() {
|
|
22595
|
+
var _this3 = this;
|
|
22596
|
+
|
|
22597
|
+
document.addEventListener('mouseup', function (_ref2) {
|
|
22598
|
+
var target = _ref2.target;
|
|
22599
|
+
|
|
22600
|
+
if (!_this3._multiselect.contains(target)) {
|
|
22601
|
+
_this3._filterOptions('');
|
|
22602
|
+
|
|
22603
|
+
_this3._closeList();
|
|
22604
|
+
|
|
22605
|
+
_this3._handlePlaceholder();
|
|
22606
|
+
}
|
|
22607
|
+
});
|
|
22608
|
+
|
|
22609
|
+
this._domElements.clear.addEventListener('click', function () {
|
|
22610
|
+
_this3._clearSelection();
|
|
22611
|
+
});
|
|
22612
|
+
|
|
22613
|
+
for (var i = 0; i < this._domElements.options.list.length; i++) {
|
|
22614
|
+
var option = this._domElements.options.list[i];
|
|
22615
|
+
option.addEventListener('click', function (_ref3) {
|
|
22616
|
+
var target = _ref3.target;
|
|
22617
|
+
|
|
22618
|
+
_this3._handleOption(target);
|
|
22619
|
+
|
|
22620
|
+
_this3._closeList();
|
|
22621
|
+
});
|
|
22622
|
+
}
|
|
22623
|
+
|
|
22624
|
+
this._domElements.input.addEventListener('focus', function () {
|
|
22625
|
+
_this3._domElements.optionsContainer.classList.add('visible');
|
|
22626
|
+
|
|
22627
|
+
_this3._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
|
|
22628
|
+
});
|
|
22629
|
+
|
|
22630
|
+
this._domElements.input.addEventListener('input', function (_ref4) {
|
|
22631
|
+
var value = _ref4.target.value;
|
|
22632
|
+
|
|
22633
|
+
if (_this3._domElements.options.list.length > 0) {
|
|
22634
|
+
_this3._filterOptions(value);
|
|
22635
|
+
}
|
|
22636
|
+
});
|
|
22637
|
+
|
|
22638
|
+
this._domElements.input.addEventListener('keydown', function (e) {
|
|
22639
|
+
_this3._handleArrows(e);
|
|
22640
|
+
|
|
22641
|
+
_this3._handleBackspace(e);
|
|
22642
|
+
|
|
22643
|
+
_this3._handleEnter(e);
|
|
22644
|
+
});
|
|
22645
|
+
}
|
|
22646
|
+
/**
|
|
22647
|
+
* Filters user input.
|
|
22648
|
+
* @param { string } value
|
|
22649
|
+
* @private
|
|
22650
|
+
*/
|
|
22651
|
+
|
|
22652
|
+
}, {
|
|
22653
|
+
key: "_filterOptions",
|
|
22654
|
+
value: function _filterOptions(value) {
|
|
22655
|
+
var _this4 = this;
|
|
22656
|
+
|
|
22657
|
+
var isOpen = this._domElements.optionsContainer.classList.contains('visible');
|
|
22658
|
+
|
|
22659
|
+
var valueLowerCase = value.toLowerCase();
|
|
22660
|
+
|
|
22661
|
+
if (!isOpen && value.length > 0) {
|
|
22662
|
+
this._domElements.optionsContainer.classList.add('visible');
|
|
22663
|
+
|
|
22664
|
+
this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
|
|
22665
|
+
}
|
|
22666
|
+
|
|
22667
|
+
if (this._domElements.options.list.length > 0) {
|
|
22668
|
+
for (var i = 0; i < this._domElements.options.list.length; i++) {
|
|
22669
|
+
var el = this._domElements.options.list[i];
|
|
22670
|
+
var text = this._itemTemplate ? this._data[i][this._textField] : el.textContent;
|
|
22671
|
+
|
|
22672
|
+
if (text.toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase) {
|
|
22673
|
+
this._domElements.optionsContainerList.appendChild(el);
|
|
22674
|
+
} else {
|
|
22675
|
+
el.parentNode && el.parentNode.removeChild(el);
|
|
22676
|
+
}
|
|
22677
|
+
}
|
|
22678
|
+
|
|
22679
|
+
var hasResults = this._domElements.options.some(function (el, index) {
|
|
22680
|
+
return (_this4._itemTemplate ? _this4._data[index][_this4._textField] : el.textContent).toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase;
|
|
22681
|
+
});
|
|
22682
|
+
|
|
22683
|
+
this._showNoResults(!hasResults);
|
|
22684
|
+
}
|
|
22685
|
+
}
|
|
22686
|
+
}, {
|
|
22687
|
+
key: "_generateId",
|
|
22688
|
+
value: function _generateId(length) {
|
|
22689
|
+
var result = '';
|
|
22690
|
+
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
22691
|
+
var charactersLength = characters.length;
|
|
22692
|
+
|
|
22693
|
+
for (var i = 0; i < length; i++) {
|
|
22694
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
22695
|
+
}
|
|
22696
|
+
|
|
22697
|
+
return result;
|
|
22698
|
+
}
|
|
22699
|
+
/**
|
|
22700
|
+
* Gets data from select tag.
|
|
22701
|
+
* @private
|
|
22702
|
+
*/
|
|
22703
|
+
|
|
22704
|
+
}, {
|
|
22705
|
+
key: "_getDataFromSelectTag",
|
|
22706
|
+
value: function _getDataFromSelectTag() {
|
|
22707
|
+
var arr = [];
|
|
22708
|
+
var options = this._select.options;
|
|
22709
|
+
|
|
22710
|
+
for (var i = 0; i < options.length; i++) {
|
|
22711
|
+
var item = options[i];
|
|
22712
|
+
arr.push({
|
|
22713
|
+
text: item.text,
|
|
22714
|
+
value: item.value,
|
|
22715
|
+
selected: item.hasAttribute('selected')
|
|
22716
|
+
});
|
|
22717
|
+
}
|
|
22718
|
+
|
|
22719
|
+
return arr;
|
|
22720
|
+
}
|
|
22721
|
+
/**
|
|
22722
|
+
* Gets data from settings.
|
|
22723
|
+
* @private
|
|
22724
|
+
*/
|
|
22725
|
+
|
|
22726
|
+
}, {
|
|
22727
|
+
key: "_getDataFromSettings",
|
|
22728
|
+
value: function _getDataFromSettings() {
|
|
22729
|
+
if (this._data.length > 0 && this._valueField && this._textField) {
|
|
22730
|
+
var isValueFieldValid = typeof this._valueField === 'string';
|
|
22731
|
+
var isTextFieldValid = typeof this._textField === 'string';
|
|
22732
|
+
var arr = [];
|
|
22733
|
+
|
|
22734
|
+
if (!isValueFieldValid || !isTextFieldValid) {
|
|
22735
|
+
throw new Error('textField and valueField must be of type string');
|
|
22736
|
+
}
|
|
22737
|
+
|
|
22738
|
+
for (var i = 0; i < this._data.length; i++) {
|
|
22739
|
+
var item = this._data[i];
|
|
22740
|
+
arr.push({
|
|
22741
|
+
value: item[this._valueField],
|
|
22742
|
+
text: item[this._textField],
|
|
22743
|
+
selected: typeof item.selected === 'boolean' ? item.selected : false
|
|
22744
|
+
});
|
|
22745
|
+
}
|
|
22746
|
+
|
|
22747
|
+
return arr;
|
|
22748
|
+
} else {
|
|
22749
|
+
return null;
|
|
22750
|
+
}
|
|
22751
|
+
}
|
|
22752
|
+
/**
|
|
22753
|
+
* Handles Arrow up & Down. Selection of an option is also possible with these keys.
|
|
22754
|
+
* @param { Event } event
|
|
22755
|
+
* @private
|
|
22756
|
+
*/
|
|
22757
|
+
|
|
22758
|
+
}, {
|
|
22759
|
+
key: "_handleArrows",
|
|
22760
|
+
value: function _handleArrows(event) {
|
|
22761
|
+
if (event.keyCode === 40 || event.keyCode === 38) {
|
|
22762
|
+
event.preventDefault();
|
|
22763
|
+
|
|
22764
|
+
var isOpen = this._domElements.optionsContainer.classList.contains('visible'); // An updated view of the container is needed because of the filtering option
|
|
22765
|
+
|
|
22766
|
+
|
|
22767
|
+
var optionsContainerList = this._multiselect.querySelector('.multiselect__options > ul');
|
|
22768
|
+
|
|
22769
|
+
if (!isOpen) {
|
|
22770
|
+
this._domElements.optionsContainer.classList.add('visible');
|
|
22771
|
+
|
|
22772
|
+
this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
|
|
22773
|
+
|
|
22774
|
+
optionsContainerList.firstElementChild.classList.add('arrow-selected');
|
|
22775
|
+
optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
|
|
22776
|
+
optionsContainerList.firstElementChild.scrollIntoView(false);
|
|
22777
|
+
} else {
|
|
22778
|
+
var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
|
|
22779
|
+
|
|
22780
|
+
var action = {
|
|
22781
|
+
ArrowUp: 'previous',
|
|
22782
|
+
Up: 'previous',
|
|
22783
|
+
ArrowDown: 'next',
|
|
22784
|
+
Down: 'next'
|
|
22785
|
+
};
|
|
22786
|
+
|
|
22787
|
+
if (!selected) {
|
|
22788
|
+
optionsContainerList.firstElementChild.classList.add('arrow-selected');
|
|
22789
|
+
optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
|
|
22790
|
+
optionsContainerList.firstElementChild.scrollIntoView(false);
|
|
22791
|
+
return;
|
|
22792
|
+
}
|
|
22793
|
+
|
|
22794
|
+
selected.classList.remove('arrow-selected');
|
|
22795
|
+
selected.setAttribute('style', style.multiselect__options_ul_li);
|
|
22796
|
+
selected = selected[action[event.key] + 'ElementSibling']; // Go to start or end of the popup list
|
|
22797
|
+
|
|
22798
|
+
if (!selected) {
|
|
22799
|
+
selected = optionsContainerList.children[action[event.key] === 'next' ? 0 : optionsContainerList.children.length - 1];
|
|
22800
|
+
selected.classList.add('arrow-selected');
|
|
22801
|
+
selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
|
|
22802
|
+
|
|
22803
|
+
this._scrollIntoView(optionsContainerList, selected);
|
|
22804
|
+
|
|
22805
|
+
return;
|
|
22806
|
+
}
|
|
22807
|
+
|
|
22808
|
+
selected.classList.add('arrow-selected');
|
|
22809
|
+
selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
|
|
22810
|
+
|
|
22811
|
+
this._scrollIntoView(optionsContainerList, selected);
|
|
22812
|
+
}
|
|
22813
|
+
}
|
|
22814
|
+
}
|
|
22815
|
+
/**
|
|
22816
|
+
* Handles the backspace key event - Deletes the preceding option in the selection list.
|
|
22817
|
+
* @param { Event } e
|
|
22818
|
+
* @private
|
|
22819
|
+
*/
|
|
22820
|
+
|
|
22821
|
+
}, {
|
|
22822
|
+
key: "_handleBackspace",
|
|
22823
|
+
value: function _handleBackspace(e) {
|
|
22824
|
+
if (e.keyCode === 8 && e.target.value === '') {
|
|
22825
|
+
var lastSelectedOption = this._selectedOptions.length > 0 ? this._selectedOptions[this._selectedOptions.length - 1] : null;
|
|
22826
|
+
|
|
22827
|
+
if (lastSelectedOption) {
|
|
22828
|
+
var targetLastSelectedOption = this._multiselect.querySelector("li[data-value=\"".concat(lastSelectedOption.value, "\"]"));
|
|
22829
|
+
|
|
22830
|
+
this._handleOption(targetLastSelectedOption);
|
|
22831
|
+
|
|
22832
|
+
if (this._selectedOptions.length === 0) {
|
|
22833
|
+
this._domElements.optionsContainer.classList.remove('visible');
|
|
22834
|
+
|
|
22835
|
+
this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
|
|
22836
|
+
}
|
|
22837
|
+
}
|
|
22838
|
+
}
|
|
22839
|
+
}
|
|
22840
|
+
/**
|
|
22841
|
+
* Shows clear selection button if some options are selected.
|
|
22842
|
+
* @private
|
|
22843
|
+
*/
|
|
22844
|
+
|
|
22845
|
+
}, {
|
|
22846
|
+
key: "_handleClearSelectionBtn",
|
|
22847
|
+
value: function _handleClearSelectionBtn() {
|
|
22848
|
+
if (this._selectedOptions.length > 0) {
|
|
22849
|
+
this._domElements.clear.style.display = 'flex';
|
|
22850
|
+
} else {
|
|
22851
|
+
this._domElements.clear.style.display = 'none';
|
|
22852
|
+
}
|
|
22853
|
+
}
|
|
22854
|
+
/**
|
|
22855
|
+
* Handles the enter key event.
|
|
22856
|
+
* @param { Event } event
|
|
22857
|
+
* @private
|
|
22858
|
+
*/
|
|
22859
|
+
|
|
22860
|
+
}, {
|
|
22861
|
+
key: "_handleEnter",
|
|
22862
|
+
value: function _handleEnter(event) {
|
|
22863
|
+
if (event.keyCode === 13) {
|
|
22864
|
+
var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
|
|
22865
|
+
|
|
22866
|
+
if (selected) {
|
|
22867
|
+
this._handleOption(selected);
|
|
22868
|
+
|
|
22869
|
+
this._closeList();
|
|
22870
|
+
}
|
|
22871
|
+
}
|
|
22872
|
+
}
|
|
22873
|
+
}, {
|
|
22874
|
+
key: "_handleOption",
|
|
22875
|
+
value: function _handleOption(target) {
|
|
22876
|
+
var dispatchEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
22877
|
+
|
|
22878
|
+
// Remove
|
|
22879
|
+
for (var i = 0; i < this._selectedOptions.length; i++) {
|
|
22880
|
+
var el = this._selectedOptions[i];
|
|
22881
|
+
|
|
22882
|
+
if (el.value === target.dataset.value) {
|
|
22883
|
+
target.classList.remove('multiselect__options--selected');
|
|
22884
|
+
target.setAttribute('style', style.multiselect__options);
|
|
22885
|
+
|
|
22886
|
+
this._selectedOptions.splice(i, 1);
|
|
22887
|
+
|
|
22888
|
+
this._removeOptionFromList(target.dataset.value);
|
|
22889
|
+
|
|
22890
|
+
this._handleClearSelectionBtn();
|
|
22891
|
+
|
|
22892
|
+
this._handlePlaceholder();
|
|
22893
|
+
|
|
22894
|
+
return dispatchEvent && this._dispatchEvent({
|
|
22895
|
+
action: 'REMOVE_OPTION',
|
|
22896
|
+
value: target.dataset.value,
|
|
22897
|
+
selection: this._selectedOptions
|
|
22898
|
+
});
|
|
22899
|
+
}
|
|
22900
|
+
} // Add
|
|
22901
|
+
|
|
22902
|
+
|
|
22903
|
+
for (var _i = 0; _i < this._options.length; _i++) {
|
|
22904
|
+
var option = this._options[_i];
|
|
22905
|
+
|
|
22906
|
+
if (option.value === target.dataset.value) {
|
|
22907
|
+
target.classList.add('multiselect__options--selected');
|
|
22908
|
+
target.setAttribute('style', style.multiselect__options_selected);
|
|
22909
|
+
this._selectedOptions = [].concat((0, _toConsumableArray2["default"])(this._selectedOptions), [option]);
|
|
22910
|
+
|
|
22911
|
+
this._addOptionToList(option, _i);
|
|
22912
|
+
|
|
22913
|
+
this._handleClearSelectionBtn();
|
|
22914
|
+
|
|
22915
|
+
this._handlePlaceholder();
|
|
22916
|
+
|
|
22917
|
+
return dispatchEvent && this._dispatchEvent({
|
|
22918
|
+
action: 'ADD_OPTION',
|
|
22919
|
+
value: target.dataset.value,
|
|
22920
|
+
selection: this._selectedOptions
|
|
22921
|
+
});
|
|
22922
|
+
}
|
|
22923
|
+
}
|
|
22924
|
+
}
|
|
22925
|
+
/**
|
|
22926
|
+
* Shows the placeholder if no options are selected.
|
|
22927
|
+
* @private
|
|
22928
|
+
*/
|
|
22929
|
+
|
|
22930
|
+
}, {
|
|
22931
|
+
key: "_handlePlaceholder",
|
|
22932
|
+
value: function _handlePlaceholder() {
|
|
22933
|
+
this._domElements.input.placeholder = this._placeholder;
|
|
22934
|
+
}
|
|
22935
|
+
}, {
|
|
22936
|
+
key: "_initSelectedList",
|
|
22937
|
+
value: function _initSelectedList() {
|
|
22938
|
+
var _this5 = this;
|
|
22939
|
+
|
|
22940
|
+
var hasItemsSelected = false;
|
|
22941
|
+
|
|
22942
|
+
var _loop2 = function _loop2(i) {
|
|
22943
|
+
var option = _this5._options[i];
|
|
22944
|
+
|
|
22945
|
+
if (option.selected) {
|
|
22946
|
+
hasItemsSelected = true;
|
|
22947
|
+
|
|
22948
|
+
var target = _this5._domElements.options.find(function (el) {
|
|
22949
|
+
return el.dataset.value === option.value;
|
|
22950
|
+
});
|
|
22951
|
+
|
|
22952
|
+
target.classList.add('multiselect__options--selected');
|
|
22953
|
+
target.setAttribute('style', style.multiselect__options_selected);
|
|
22954
|
+
_this5._selectedOptions = [].concat((0, _toConsumableArray2["default"])(_this5._selectedOptions), [option]);
|
|
22955
|
+
|
|
22956
|
+
_this5._addOptionToList(option, i);
|
|
22957
|
+
}
|
|
22958
|
+
};
|
|
22959
|
+
|
|
22960
|
+
for (var i = 0; i < this._options.length; i++) {
|
|
22961
|
+
_loop2(i);
|
|
22962
|
+
}
|
|
22963
|
+
|
|
22964
|
+
if (hasItemsSelected) {
|
|
22965
|
+
this._handleClearSelectionBtn();
|
|
22966
|
+
}
|
|
22967
|
+
|
|
22968
|
+
this._handlePlaceholder();
|
|
22969
|
+
}
|
|
22970
|
+
/**
|
|
22971
|
+
* Process the custom template.
|
|
22972
|
+
* @param { string } template
|
|
22973
|
+
* @private
|
|
22974
|
+
*/
|
|
22975
|
+
|
|
22976
|
+
}, {
|
|
22977
|
+
key: "_processTemplate",
|
|
22978
|
+
value: function _processTemplate(template, index) {
|
|
22979
|
+
var processedTemplate = template;
|
|
22980
|
+
var objAttr = template.match(/\$\{(\w+)\}/g).map(function (e) {
|
|
22981
|
+
return e.replace(/\$\{|\}/g, '');
|
|
22982
|
+
});
|
|
22983
|
+
|
|
22984
|
+
for (var i = 0; i < objAttr.length; i++) {
|
|
22985
|
+
var _this$_data$index$att;
|
|
22986
|
+
|
|
22987
|
+
var attr = objAttr[i]; // eslint-disable-next-line no-useless-escape
|
|
22988
|
+
|
|
22989
|
+
processedTemplate = processedTemplate.replace("${".concat(attr, "}"), (_this$_data$index$att = this._data[index][attr]) !== null && _this$_data$index$att !== void 0 ? _this$_data$index$att : '');
|
|
22990
|
+
}
|
|
22991
|
+
|
|
22992
|
+
return processedTemplate;
|
|
22993
|
+
}
|
|
22994
|
+
}, {
|
|
22995
|
+
key: "_removeAllArrowSelected",
|
|
22996
|
+
value: function _removeAllArrowSelected() {
|
|
22997
|
+
var className = 'arrow-selected';
|
|
22998
|
+
|
|
22999
|
+
var target = this._domElements.options.find(function (el) {
|
|
23000
|
+
return el.classList.contains(className);
|
|
23001
|
+
});
|
|
23002
|
+
|
|
23003
|
+
target && target.classList.remove(className) && target.setAttribute('style', style.multiselect__options_ul_li);
|
|
23004
|
+
}
|
|
23005
|
+
/**
|
|
23006
|
+
* Removes an option from the list.
|
|
23007
|
+
* @param { string } value
|
|
23008
|
+
* @private
|
|
23009
|
+
*/
|
|
23010
|
+
|
|
23011
|
+
}, {
|
|
23012
|
+
key: "_removeOptionFromList",
|
|
23013
|
+
value: function _removeOptionFromList(value) {
|
|
23014
|
+
var optionDom = this._multiselect.querySelector("span[data-value=\"".concat(value, "\"]"));
|
|
23015
|
+
|
|
23016
|
+
optionDom && optionDom.parentNode && optionDom.parentNode.removeChild(optionDom);
|
|
23017
|
+
}
|
|
23018
|
+
/**
|
|
23019
|
+
* Renders the multiselect options list view.
|
|
23020
|
+
* @private
|
|
23021
|
+
*/
|
|
23022
|
+
|
|
23023
|
+
}, {
|
|
23024
|
+
key: "_renderOptionsList",
|
|
23025
|
+
value: function _renderOptionsList() {
|
|
23026
|
+
var _this6 = this;
|
|
23027
|
+
|
|
23028
|
+
var html = "\n <div class=\"multiselect__options\" style=\"".concat(style.multiselect__options, "\">\n <ul style=\"").concat(style.multiselect__options_ul, "\">\n ").concat(this._options.length > 0 && !this._itemTemplate ? this._options.map(function (option) {
|
|
23029
|
+
return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(option.text, "</li>\n ");
|
|
23030
|
+
}).join('') : '', "\n\n ").concat(this._options.length > 0 && this._itemTemplate ? this._options.map(function (option, index) {
|
|
23031
|
+
return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(_this6._processTemplate(_this6._itemTemplate, index), "</li>\n ");
|
|
23032
|
+
}).join('') : '', "\n ").concat(this._showNoData(this._options.length === 0), "\n </ul>\n </div>\n ");
|
|
23033
|
+
|
|
23034
|
+
this._multiselect.insertAdjacentHTML('beforeend', html);
|
|
23035
|
+
}
|
|
23036
|
+
/**
|
|
23037
|
+
* Renders the multiselect view.
|
|
23038
|
+
* @private
|
|
23039
|
+
*/
|
|
23040
|
+
|
|
23041
|
+
}, {
|
|
23042
|
+
key: "_renderMultiselect",
|
|
23043
|
+
value: function _renderMultiselect() {
|
|
23044
|
+
this._select.style.display = 'none';
|
|
23045
|
+
|
|
23046
|
+
var id = 'iconic-' + this._generateId(20); // Timea created dedicated div element because previous code was not rendering
|
|
23047
|
+
|
|
23048
|
+
|
|
23049
|
+
this._multiselect = document.createElement('div');
|
|
23050
|
+
|
|
23051
|
+
this._multiselect.setAttribute('id', id);
|
|
23052
|
+
|
|
23053
|
+
this._multiselect.setAttribute('class', 'multiselect__container');
|
|
23054
|
+
|
|
23055
|
+
this._multiselect.setAttribute('style', style.multiselect__container);
|
|
23056
|
+
|
|
23057
|
+
var html = "\n <div class=\"multiselect__wrapper\" style=\"".concat(style.multiselect__wrapper, "\">\n <input class=\"multiselect__input\" style=\"").concat(style.multiselect__input, "\" placeholder=\"").concat(this._placeholder, "\" />\n </div>\n <span style=\"display: none;\" class=\"multiselect__clear-btn\" style=\"").concat(style.multiselect__clear_btn, "\">").concat(this._cross, "</span>\n ");
|
|
23058
|
+
this._multiselect.innerHTML = html;
|
|
23059
|
+
|
|
23060
|
+
this._selectContainer.appendChild(this._multiselect);
|
|
23061
|
+
}
|
|
23062
|
+
/**
|
|
23063
|
+
* ScrollIntoView - This small utility reproduces the behavior of .scrollIntoView({ block: "nearest", inline: "nearest" })
|
|
23064
|
+
* This is for IE compatibility without a need of a polyfill
|
|
23065
|
+
* @private
|
|
23066
|
+
*/
|
|
23067
|
+
|
|
23068
|
+
}, {
|
|
23069
|
+
key: "_scrollIntoView",
|
|
23070
|
+
value: function _scrollIntoView(parent, child) {
|
|
23071
|
+
var rectParent = parent.getBoundingClientRect();
|
|
23072
|
+
var rectChild = child.getBoundingClientRect(); // Detect if not visible at top and then scroll to the top
|
|
23073
|
+
|
|
23074
|
+
if (!(rectParent.top < rectChild.bottom - child.offsetHeight)) {
|
|
23075
|
+
parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight);
|
|
23076
|
+
} // Detect if not visible at bottom and then scroll to the bottom
|
|
23077
|
+
|
|
23078
|
+
|
|
23079
|
+
if (!(rectParent.bottom > rectChild.top + child.offsetHeight)) {
|
|
23080
|
+
parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight) - (parent.offsetHeight - (child.offsetHeight + (child.offsetHeight - child.clientHeight)));
|
|
23081
|
+
}
|
|
23082
|
+
}
|
|
23083
|
+
/**
|
|
23084
|
+
* Shows a no data message.
|
|
23085
|
+
* @param { boolean } condition
|
|
23086
|
+
* @private
|
|
23087
|
+
*/
|
|
23088
|
+
|
|
23089
|
+
}, {
|
|
23090
|
+
key: "_showNoData",
|
|
23091
|
+
value: function _showNoData(condition) {
|
|
23092
|
+
return condition ? "<p class=\"multiselect__options--no-data\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_data, "\">").concat(this._noData, "</p>") : '';
|
|
23093
|
+
}
|
|
23094
|
+
/**
|
|
23095
|
+
* Shows a no results message.
|
|
23096
|
+
* @param { boolean } condition
|
|
23097
|
+
* @private
|
|
23098
|
+
*/
|
|
23099
|
+
|
|
23100
|
+
}, {
|
|
23101
|
+
key: "_showNoResults",
|
|
23102
|
+
value: function _showNoResults(condition) {
|
|
23103
|
+
var dom = this._multiselect.querySelector('.multiselect__options--no-results');
|
|
23104
|
+
|
|
23105
|
+
if (condition) {
|
|
23106
|
+
var html = "<p class=\"multiselect__options--no-results\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_results, "\">").concat(this._noResults, "</p>");
|
|
23107
|
+
!dom && this._domElements.optionsContainerList.insertAdjacentHTML('beforeend', html);
|
|
23108
|
+
} else {
|
|
23109
|
+
dom && dom.parentNode && dom.parentNode.removeChild(dom);
|
|
23110
|
+
}
|
|
23111
|
+
}
|
|
23112
|
+
}]);
|
|
23113
|
+
return IconicMultiSelect;
|
|
23114
|
+
}();
|
|
23115
|
+
|
|
23116
|
+
exports.IconicMultiSelect = IconicMultiSelect;
|
|
23117
|
+
//# sourceMappingURL=multiSelect.js.map
|
|
23118
|
+
|
|
23119
|
+
/***/ }),
|
|
23120
|
+
|
|
23121
|
+
/***/ "./lib/widgets/peoplePicker.js":
|
|
23122
|
+
/*!*************************************!*\
|
|
23123
|
+
!*** ./lib/widgets/peoplePicker.js ***!
|
|
23124
|
+
\*************************************/
|
|
23125
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
23126
|
+
|
|
23127
|
+
"use strict";
|
|
23128
|
+
|
|
23129
|
+
|
|
23130
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
23131
|
+
|
|
23132
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
23133
|
+
|
|
23134
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
23135
|
+
value: true
|
|
23136
|
+
}));
|
|
23137
|
+
exports.Person = exports.PeoplePicker = exports.GroupPicker = exports.GroupBuilder = exports.Group = void 0;
|
|
23138
|
+
|
|
23139
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteral */ "./node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js"));
|
|
23140
|
+
|
|
23141
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
23142
|
+
|
|
23143
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
23144
|
+
|
|
23145
|
+
var _escapeHtml = _interopRequireDefault(__webpack_require__(/*! escape-html */ "./node_modules/escape-html/index.js"));
|
|
23146
|
+
|
|
23147
|
+
var _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/index.js"));
|
|
23148
|
+
|
|
23149
|
+
var rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
23150
|
+
|
|
23151
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
23152
|
+
|
|
23153
|
+
var _dragAndDrop = __webpack_require__(/*! ./dragAndDrop */ "./lib/widgets/dragAndDrop.js");
|
|
23154
|
+
|
|
23155
|
+
var _error = __webpack_require__(/*! ./error */ "./lib/widgets/error.js");
|
|
23156
|
+
|
|
23157
|
+
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
23158
|
+
|
|
23159
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
23160
|
+
|
|
23161
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
23162
|
+
|
|
23163
|
+
var _templateObject;
|
|
23164
|
+
|
|
23165
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23166
|
+
|
|
23167
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23168
|
+
|
|
23169
|
+
var kb = _solidLogic.solidLogicSingleton.store;
|
|
23170
|
+
|
|
23171
|
+
var PeoplePicker = /*#__PURE__*/function () {
|
|
23172
|
+
function PeoplePicker(element, typeIndex, groupPickedCb, options) {
|
|
23173
|
+
(0, _classCallCheck2["default"])(this, PeoplePicker);
|
|
23174
|
+
// @@ can't expect typeindex to be passed
|
|
23175
|
+
this.options = options || {};
|
|
23176
|
+
this.element = element;
|
|
23177
|
+
this.typeIndex = typeIndex;
|
|
23178
|
+
this.groupPickedCb = groupPickedCb;
|
|
23179
|
+
this.selectedgroup = this.options.selectedgroup; // current selected group if any
|
|
23180
|
+
|
|
23181
|
+
this.onSelectGroup = this.onSelectGroup.bind(this);
|
|
23182
|
+
}
|
|
23183
|
+
|
|
23184
|
+
(0, _createClass2["default"])(PeoplePicker, [{
|
|
23185
|
+
key: "render",
|
|
23186
|
+
value: function render() {
|
|
23187
|
+
var _this = this;
|
|
23188
|
+
|
|
23189
|
+
var container = document.createElement('div');
|
|
23190
|
+
container.style.maxWidth = '350px';
|
|
23191
|
+
container.style.minHeight = '200px';
|
|
23192
|
+
container.style.outline = '1px solid black';
|
|
23193
|
+
container.style.display = 'flex';
|
|
23194
|
+
|
|
23195
|
+
if (this.selectedgroup) {
|
|
23196
|
+
container.style.flexDirection = 'column';
|
|
23197
|
+
var selectedGroup = document.createElement('div');
|
|
23198
|
+
new Group(selectedGroup, this.selectedgroup).render();
|
|
23199
|
+
var changeGroupButton = document.createElement('button');
|
|
23200
|
+
changeGroupButton.textContent = (0, _escapeHtml["default"])('Change group');
|
|
23201
|
+
changeGroupButton.addEventListener('click', function (_event) {
|
|
23202
|
+
_this.selectedgroup = null;
|
|
23203
|
+
|
|
23204
|
+
_this.render();
|
|
23205
|
+
});
|
|
23206
|
+
container.appendChild(selectedGroup);
|
|
23207
|
+
container.appendChild(changeGroupButton);
|
|
23208
|
+
} else {
|
|
23209
|
+
this.findAddressBook(this.typeIndex).then(function (_ref) {
|
|
23210
|
+
var book = _ref.book;
|
|
23211
|
+
var chooseExistingGroupButton = document.createElement('button');
|
|
22107
23212
|
chooseExistingGroupButton.textContent = (0, _escapeHtml["default"])('Pick an existing group');
|
|
22108
23213
|
chooseExistingGroupButton.style.margin = 'auto';
|
|
22109
23214
|
chooseExistingGroupButton.addEventListener('click', function (_event) {
|
|
@@ -22684,6 +23789,22 @@ module.exports = _arrayWithHoles, module.exports.__esModule = true, module.expor
|
|
|
22684
23789
|
|
|
22685
23790
|
/***/ }),
|
|
22686
23791
|
|
|
23792
|
+
/***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
|
|
23793
|
+
/*!******************************************************************!*\
|
|
23794
|
+
!*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
|
|
23795
|
+
\******************************************************************/
|
|
23796
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
23797
|
+
|
|
23798
|
+
var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
|
|
23799
|
+
|
|
23800
|
+
function _arrayWithoutHoles(arr) {
|
|
23801
|
+
if (Array.isArray(arr)) return arrayLikeToArray(arr);
|
|
23802
|
+
}
|
|
23803
|
+
|
|
23804
|
+
module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
23805
|
+
|
|
23806
|
+
/***/ }),
|
|
23807
|
+
|
|
22687
23808
|
/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
|
|
22688
23809
|
/*!**********************************************************************!*\
|
|
22689
23810
|
!*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
|
|
@@ -22949,6 +24070,20 @@ module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, mo
|
|
|
22949
24070
|
|
|
22950
24071
|
/***/ }),
|
|
22951
24072
|
|
|
24073
|
+
/***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js":
|
|
24074
|
+
/*!****************************************************************!*\
|
|
24075
|
+
!*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
|
|
24076
|
+
\****************************************************************/
|
|
24077
|
+
/***/ ((module) => {
|
|
24078
|
+
|
|
24079
|
+
function _iterableToArray(iter) {
|
|
24080
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
24081
|
+
}
|
|
24082
|
+
|
|
24083
|
+
module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
24084
|
+
|
|
24085
|
+
/***/ }),
|
|
24086
|
+
|
|
22952
24087
|
/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
|
|
22953
24088
|
/*!*********************************************************************!*\
|
|
22954
24089
|
!*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
|
|
@@ -23003,6 +24138,20 @@ module.exports = _nonIterableRest, module.exports.__esModule = true, module.expo
|
|
|
23003
24138
|
|
|
23004
24139
|
/***/ }),
|
|
23005
24140
|
|
|
24141
|
+
/***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js":
|
|
24142
|
+
/*!******************************************************************!*\
|
|
24143
|
+
!*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
|
|
24144
|
+
\******************************************************************/
|
|
24145
|
+
/***/ ((module) => {
|
|
24146
|
+
|
|
24147
|
+
function _nonIterableSpread() {
|
|
24148
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
24149
|
+
}
|
|
24150
|
+
|
|
24151
|
+
module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
24152
|
+
|
|
24153
|
+
/***/ }),
|
|
24154
|
+
|
|
23006
24155
|
/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
|
|
23007
24156
|
/*!**************************************************************************!*\
|
|
23008
24157
|
!*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
|
|
@@ -23089,6 +24238,28 @@ module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, modul
|
|
|
23089
24238
|
|
|
23090
24239
|
/***/ }),
|
|
23091
24240
|
|
|
24241
|
+
/***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js":
|
|
24242
|
+
/*!******************************************************************!*\
|
|
24243
|
+
!*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
|
|
24244
|
+
\******************************************************************/
|
|
24245
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
24246
|
+
|
|
24247
|
+
var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js");
|
|
24248
|
+
|
|
24249
|
+
var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/iterableToArray.js");
|
|
24250
|
+
|
|
24251
|
+
var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
|
|
24252
|
+
|
|
24253
|
+
var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js");
|
|
24254
|
+
|
|
24255
|
+
function _toConsumableArray(arr) {
|
|
24256
|
+
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
|
|
24257
|
+
}
|
|
24258
|
+
|
|
24259
|
+
module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
24260
|
+
|
|
24261
|
+
/***/ }),
|
|
24262
|
+
|
|
23092
24263
|
/***/ "./node_modules/@babel/runtime/helpers/typeof.js":
|
|
23093
24264
|
/*!*******************************************************!*\
|
|
23094
24265
|
!*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
|