solid-ui 2.4.22-d2646734 → 2.4.22-dc79c0e3
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/dist/main.js +1458 -295
- 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 +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/forms.js +398 -185
- 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,8 +15282,8 @@ 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-25T21:53:40Z',
|
|
15286
|
+
commit: 'dc79c0e3372c8084fe393d058672af8389e9559a',
|
|
15197
15287
|
npmInfo: {
|
|
15198
15288
|
'solid-ui': '2.4.22',
|
|
15199
15289
|
npm: '6.14.17',
|
|
@@ -17149,6 +17239,7 @@ exports.findClosest = findClosest;
|
|
|
17149
17239
|
exports.formsFor = formsFor;
|
|
17150
17240
|
exports.makeDescription = makeDescription;
|
|
17151
17241
|
exports.makeSelectForCategory = makeSelectForCategory;
|
|
17242
|
+
exports.makeSelectForChoice = makeSelectForChoice;
|
|
17152
17243
|
exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
|
|
17153
17244
|
exports.makeSelectForOptions = makeSelectForOptions;
|
|
17154
17245
|
exports.newButton = newButton;
|
|
@@ -17198,6 +17289,8 @@ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-l
|
|
|
17198
17289
|
|
|
17199
17290
|
var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
|
|
17200
17291
|
|
|
17292
|
+
var _multiSelect = __webpack_require__(/*! ./multiSelect */ "./lib/widgets/multiSelect.js");
|
|
17293
|
+
|
|
17201
17294
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
17202
17295
|
|
|
17203
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); }
|
|
@@ -17260,6 +17353,7 @@ _fieldFunction.field[ns.ui('Form').uri] = _fieldFunction.field[ns.ui('Group').ur
|
|
|
17260
17353
|
var ui = ns.ui;
|
|
17261
17354
|
if (container) container.appendChild(box); // Prevent loops
|
|
17262
17355
|
|
|
17356
|
+
if (!form) return;
|
|
17263
17357
|
var key = subject.toNT() + '|' + form.toNT();
|
|
17264
17358
|
|
|
17265
17359
|
if (already[key]) {
|
|
@@ -17369,47 +17463,43 @@ _fieldFunction.field[ns.ui('Options').uri] = function (dom, container, already,
|
|
|
17369
17463
|
values = kb.each(subject, dependingOn);
|
|
17370
17464
|
}
|
|
17371
17465
|
|
|
17372
|
-
|
|
17373
|
-
|
|
17374
|
-
|
|
17375
|
-
for (var i = 0; i < cases.length; i++) {
|
|
17376
|
-
var c = cases[i];
|
|
17377
|
-
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'
|
|
17378
17469
|
|
|
17379
|
-
|
|
17470
|
+
var match = false;
|
|
17380
17471
|
|
|
17381
|
-
|
|
17382
|
-
|
|
17383
|
-
|
|
17472
|
+
for (var j = 0; j < tests.length; j++) {
|
|
17473
|
+
var _iterator = _createForOfIteratorHelper(values),
|
|
17474
|
+
_step;
|
|
17384
17475
|
|
|
17385
|
-
|
|
17386
|
-
|
|
17387
|
-
|
|
17388
|
-
|
|
17476
|
+
try {
|
|
17477
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
17478
|
+
var value = _step.value;
|
|
17479
|
+
var test = tests[j];
|
|
17389
17480
|
|
|
17390
|
-
|
|
17391
|
-
|
|
17392
|
-
}
|
|
17481
|
+
if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
|
|
17482
|
+
match = true;
|
|
17393
17483
|
}
|
|
17394
|
-
} catch (err) {
|
|
17395
|
-
_iterator.e(err);
|
|
17396
|
-
} finally {
|
|
17397
|
-
_iterator.f();
|
|
17398
17484
|
}
|
|
17485
|
+
} catch (err) {
|
|
17486
|
+
_iterator.e(err);
|
|
17487
|
+
} finally {
|
|
17488
|
+
_iterator.f();
|
|
17399
17489
|
}
|
|
17490
|
+
}
|
|
17400
17491
|
|
|
17401
|
-
|
|
17402
|
-
|
|
17403
|
-
|
|
17404
|
-
if (!_field3) {
|
|
17405
|
-
box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
|
|
17406
|
-
return box;
|
|
17407
|
-
} else {
|
|
17408
|
-
appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
|
|
17409
|
-
}
|
|
17492
|
+
if (match) {
|
|
17493
|
+
var _field3 = kb.the(c, ui('use'));
|
|
17410
17494
|
|
|
17411
|
-
|
|
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);
|
|
17412
17500
|
}
|
|
17501
|
+
|
|
17502
|
+
break;
|
|
17413
17503
|
}
|
|
17414
17504
|
} // @@ Add box.refresh() to sync fields with values
|
|
17415
17505
|
|
|
@@ -18147,9 +18237,6 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18147
18237
|
var kb = _solidLogic.store;
|
|
18148
18238
|
var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
|
|
18149
18239
|
|
|
18150
|
-
var uiMultipleInUse = false; // this signals to ui:choice that it is part of a ui:multiple
|
|
18151
|
-
|
|
18152
|
-
var multiSelect = false;
|
|
18153
18240
|
var p;
|
|
18154
18241
|
var box = dom.createElement('div');
|
|
18155
18242
|
box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
|
|
@@ -18178,105 +18265,115 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18178
18265
|
|
|
18179
18266
|
var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
|
|
18180
18267
|
|
|
18181
|
-
var possible = [];
|
|
18182
|
-
var possibleProperties;
|
|
18183
|
-
var firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *'; // if we do NOT have a container it means it is a ui:Multiple
|
|
18184
|
-
// only important for the first option text in select
|
|
18185
|
-
|
|
18186
|
-
if (!container) {
|
|
18187
|
-
uiMultipleInUse = true;
|
|
18188
|
-
firstSelectOptionText = utils.label(subject, true);
|
|
18189
|
-
}
|
|
18190
|
-
|
|
18191
|
-
if (subject.termType === 'BlankNode') {
|
|
18192
|
-
firstSelectOptionText = '* Select for ' + utils.label(property) + ' *';
|
|
18193
|
-
}
|
|
18194
|
-
|
|
18195
18268
|
var opts = {
|
|
18196
18269
|
form: form,
|
|
18197
18270
|
subForm: subForm,
|
|
18198
|
-
multiSelect: multiSelect,
|
|
18199
|
-
firstSelectOptionText: firstSelectOptionText,
|
|
18200
|
-
uiMultipleInUse: uiMultipleInUse,
|
|
18201
18271
|
disambiguate: false
|
|
18202
18272
|
};
|
|
18203
|
-
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
18204
18273
|
|
|
18205
|
-
|
|
18206
|
-
possible
|
|
18207
|
-
|
|
18274
|
+
function getSelectorOptions() {
|
|
18275
|
+
var possible = [];
|
|
18276
|
+
var possibleProperties;
|
|
18277
|
+
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
18208
18278
|
|
|
18279
|
+
for (var x in kb.findMembersNT(uiFrom)) {
|
|
18280
|
+
possible.push(kb.fromNT(x));
|
|
18281
|
+
} // Use rdfs
|
|
18209
18282
|
|
|
18210
|
-
if (uiFrom.sameTerm(ns.rdfs('Class'))) {
|
|
18211
|
-
for (p in buttons.allClassURIs()) {
|
|
18212
|
-
possible.push(kb.sym(p));
|
|
18213
|
-
} // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
|
|
18214
18283
|
|
|
18215
|
-
|
|
18216
|
-
|
|
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)
|
|
18217
18288
|
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
}
|
|
18289
|
+
} else if (uiFrom.sameTerm(ns.rdf('Property'))) {
|
|
18290
|
+
possibleProperties = buttons.propertyTriage(kb);
|
|
18221
18291
|
|
|
18222
|
-
|
|
18223
|
-
|
|
18224
|
-
|
|
18292
|
+
for (p in possibleProperties.op) {
|
|
18293
|
+
possible.push(kb.fromNT(p));
|
|
18294
|
+
}
|
|
18295
|
+
|
|
18296
|
+
for (p in possibleProperties.dp) {
|
|
18297
|
+
possible.push(kb.fromNT(p));
|
|
18298
|
+
}
|
|
18225
18299
|
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
|
|
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);
|
|
18229
18303
|
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
|
|
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);
|
|
18233
18311
|
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
|
|
18312
|
+
for (p in possibleProperties.dp) {
|
|
18313
|
+
possible.push(kb.fromNT(p));
|
|
18314
|
+
}
|
|
18237
18315
|
|
|
18238
|
-
|
|
18239
|
-
possible.push(kb.fromNT(p));
|
|
18316
|
+
opts.disambiguate = true;
|
|
18240
18317
|
}
|
|
18241
18318
|
|
|
18242
|
-
|
|
18243
|
-
}
|
|
18319
|
+
return possible; // return sortByLabel(possible)
|
|
18320
|
+
} // TODO: this checks for any occurrence, regardless of true or false setting
|
|
18244
18321
|
|
|
18245
|
-
var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurrence, regardless of true or false setting
|
|
18246
18322
|
|
|
18247
18323
|
if (kb.any(form, ui('canMintNew'))) {
|
|
18248
18324
|
opts.mint = '* Create new *'; // @@ could be better
|
|
18249
18325
|
}
|
|
18250
18326
|
|
|
18251
|
-
var
|
|
18252
|
-
rhs.appendChild(selector);
|
|
18253
|
-
var object;
|
|
18327
|
+
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
18254
18328
|
|
|
18255
|
-
|
|
18256
|
-
object = $rdf.sym(selector.currentURI);
|
|
18257
|
-
} else {
|
|
18258
|
-
object = kb.any(subject, property);
|
|
18259
|
-
}
|
|
18329
|
+
var selector; // from ui:property
|
|
18260
18330
|
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
}
|
|
18331
|
+
var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
|
|
18332
|
+
return object.value;
|
|
18333
|
+
});
|
|
18265
18334
|
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
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
|
+
}
|
|
18359
|
+
|
|
18360
|
+
if (event.action === 'CLEAR_ALL_OPTIONS') {
|
|
18361
|
+
selectedOptions = [];
|
|
18362
|
+
}
|
|
18273
18363
|
|
|
18364
|
+
if (event.action === 'ADD_OPTION') {
|
|
18365
|
+
selectedOptions.push(event.value);
|
|
18366
|
+
}
|
|
18274
18367
|
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
}
|
|
18279
|
-
|
|
18368
|
+
selector.update(selectedOptions);
|
|
18369
|
+
});
|
|
18370
|
+
}
|
|
18371
|
+
};
|
|
18372
|
+
|
|
18373
|
+
rhs.refresh();
|
|
18374
|
+
if (selector && selector.refresh) selector.refresh();
|
|
18375
|
+
return box;
|
|
18376
|
+
};
|
|
18280
18377
|
|
|
18281
18378
|
function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
|
|
18282
18379
|
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
|
|
@@ -18619,18 +18716,15 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
18619
18716
|
// @param subject - a term, the subject of the statement(s) being edited.
|
|
18620
18717
|
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
18621
18718
|
// @param possible - a list of terms, the possible value the object can take
|
|
18622
|
-
// @param options.
|
|
18623
|
-
//
|
|
18624
|
-
// option for none selected (for non multiSelect)
|
|
18625
|
-
// @param options.uiMultipleInUse - signals that the ui:choise is used with a ui:multiple
|
|
18626
|
-
// @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)
|
|
18627
18721
|
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
18628
18722
|
// @param dataDoc - The web document being edited
|
|
18629
18723
|
// @param callbackFunction - takes (boolean ok, string errorBody)
|
|
18630
18724
|
*/
|
|
18631
18725
|
|
|
18632
18726
|
|
|
18633
|
-
function makeSelectForOptions(dom, kb, subject, predicate, possible,
|
|
18727
|
+
function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
|
|
18634
18728
|
log.debug('Select list length now ' + possible.length);
|
|
18635
18729
|
var n = 0;
|
|
18636
18730
|
var uris = {}; // Count them
|
|
@@ -18647,7 +18741,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18647
18741
|
} // uris is now the set of possible options
|
|
18648
18742
|
|
|
18649
18743
|
|
|
18650
|
-
if (n === 0
|
|
18744
|
+
if (n === 0) {
|
|
18651
18745
|
return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
|
|
18652
18746
|
}
|
|
18653
18747
|
|
|
@@ -18673,6 +18767,8 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18673
18767
|
actual = getActual();
|
|
18674
18768
|
|
|
18675
18769
|
var onChange = function onChange(_e) {
|
|
18770
|
+
select.disabled = true; // until data written back - gives user feedback too
|
|
18771
|
+
|
|
18676
18772
|
var ds = [];
|
|
18677
18773
|
var is = [];
|
|
18678
18774
|
|
|
@@ -18682,43 +18778,18 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18682
18778
|
}
|
|
18683
18779
|
};
|
|
18684
18780
|
|
|
18685
|
-
var newObject;
|
|
18686
|
-
|
|
18687
18781
|
for (var _i = 0; _i < select.options.length; _i++) {
|
|
18688
18782
|
var opt = select.options[_i];
|
|
18689
|
-
|
|
18690
|
-
if (opt.selected && opt.AJAR_mint) {
|
|
18691
|
-
// not sure if this 'if' is used because I cannot find mintClass
|
|
18692
|
-
if (options.mintClass) {
|
|
18693
|
-
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
18694
|
-
if (!ok) {
|
|
18695
|
-
callbackFunction(ok, body, {
|
|
18696
|
-
change: 'new'
|
|
18697
|
-
}); // @@ if ok, need some form of refresh of the select for the new thing
|
|
18698
|
-
}
|
|
18699
|
-
});
|
|
18700
|
-
select.parentNode.appendChild(thisForm);
|
|
18701
|
-
newObject = thisForm.AJAR_subject;
|
|
18702
|
-
} else {
|
|
18703
|
-
newObject = newThing(dataDoc);
|
|
18704
|
-
}
|
|
18705
|
-
|
|
18706
|
-
is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
|
|
18707
|
-
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
|
|
18708
|
-
|
|
18709
|
-
if (options.mintStatementsFun) {
|
|
18710
|
-
is = is.concat(options.mintStatementsFun(newObject));
|
|
18711
|
-
}
|
|
18712
|
-
|
|
18713
|
-
select.currentURI = newObject;
|
|
18714
|
-
}
|
|
18715
|
-
|
|
18716
18783
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
18717
18784
|
|
|
18718
18785
|
if (opt.selected && !(opt.AJAR_uri in actual)) {
|
|
18719
18786
|
// new class
|
|
18720
18787
|
is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
|
|
18721
|
-
|
|
18788
|
+
}
|
|
18789
|
+
|
|
18790
|
+
if (!opt.selected && opt.AJAR_uri in actual) {
|
|
18791
|
+
// old class
|
|
18792
|
+
removeValue(kb.sym(opt.AJAR_uri));
|
|
18722
18793
|
}
|
|
18723
18794
|
|
|
18724
18795
|
if (opt.selected) select.currentURI = opt.AJAR_uri;
|
|
@@ -18738,29 +18809,25 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18738
18809
|
sel = sel.superSelect;
|
|
18739
18810
|
}
|
|
18740
18811
|
|
|
18741
|
-
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
|
|
18742
18815
|
|
|
18743
|
-
removeNextSiblingsAfterElement(select);
|
|
18744
|
-
addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
|
|
18745
18816
|
if (ok) {
|
|
18746
|
-
|
|
18747
|
-
actual = getActual(); // refresh
|
|
18748
|
-
|
|
18749
|
-
if (!success) select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
|
|
18750
|
-
});
|
|
18751
|
-
if (callbackFunction) callbackFunction(ok, {
|
|
18752
|
-
widget: 'select',
|
|
18753
|
-
event: 'new'
|
|
18754
|
-
});
|
|
18817
|
+
select.disabled = false; // data written back
|
|
18755
18818
|
} else {
|
|
18756
|
-
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));
|
|
18757
18820
|
}
|
|
18821
|
+
|
|
18822
|
+
if (callbackFunction) callbackFunction(ok, {
|
|
18823
|
+
widget: 'select',
|
|
18824
|
+
event: 'change'
|
|
18825
|
+
});
|
|
18758
18826
|
});
|
|
18759
18827
|
};
|
|
18760
18828
|
|
|
18761
18829
|
var select = dom.createElement('select');
|
|
18762
18830
|
select.setAttribute('style', style.formSelectSTyle);
|
|
18763
|
-
if (options.multiSelect) select.setAttribute('multiSelect', 'true');
|
|
18764
18831
|
select.currentURI = null;
|
|
18765
18832
|
|
|
18766
18833
|
select.refresh = function () {
|
|
@@ -18803,22 +18870,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18803
18870
|
select.appendChild(option);
|
|
18804
18871
|
}
|
|
18805
18872
|
|
|
18806
|
-
if (
|
|
18807
|
-
var mint = dom.createElement('option');
|
|
18808
|
-
mint.appendChild(dom.createTextNode(options.mint));
|
|
18809
|
-
mint.AJAR_mint = true; // Flag it
|
|
18810
|
-
|
|
18811
|
-
select.insertBefore(mint, select.firstChild);
|
|
18812
|
-
}
|
|
18813
|
-
|
|
18814
|
-
if (!select.currentURI && options.uiMultipleInUse) {
|
|
18873
|
+
if (!select.currentURI) {
|
|
18815
18874
|
var prompt = dom.createElement('option');
|
|
18816
|
-
prompt.appendChild(dom.createTextNode(options.
|
|
18817
|
-
prompt.disabled = true;
|
|
18818
|
-
prompt.value = true;
|
|
18819
|
-
prompt.hidden = true;
|
|
18820
|
-
prompt.selected = true;
|
|
18875
|
+
prompt.appendChild(dom.createTextNode(options.nullLabel));
|
|
18821
18876
|
select.insertBefore(prompt, select.firstChild);
|
|
18877
|
+
prompt.selected = true;
|
|
18822
18878
|
}
|
|
18823
18879
|
|
|
18824
18880
|
if (editable) {
|
|
@@ -18837,27 +18893,16 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
18837
18893
|
function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
|
|
18838
18894
|
var du = kb.any(category, ns.owl('disjointUnionOf'));
|
|
18839
18895
|
var subs;
|
|
18840
|
-
var multiSelect = false;
|
|
18841
18896
|
|
|
18842
18897
|
if (!du) {
|
|
18843
18898
|
subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
|
|
18844
|
-
multiSelect = true;
|
|
18845
18899
|
} else {
|
|
18846
18900
|
subs = du.elements;
|
|
18847
18901
|
}
|
|
18848
18902
|
|
|
18849
18903
|
log.debug('Select list length ' + subs.length);
|
|
18850
|
-
|
|
18851
|
-
|
|
18852
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
|
|
18853
|
-
}
|
|
18854
|
-
|
|
18855
|
-
if (subs.length === 1) {
|
|
18856
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
|
|
18857
|
-
}
|
|
18858
|
-
|
|
18859
|
-
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
|
|
18860
|
-
multiSelect: multiSelect
|
|
18904
|
+
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
|
|
18905
|
+
nullLabel: '* Select type *'
|
|
18861
18906
|
}, dataDoc, callbackFunction);
|
|
18862
18907
|
}
|
|
18863
18908
|
/** Make SELECT element to select subclasses recurively
|
|
@@ -18891,8 +18936,7 @@ function makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, callba
|
|
|
18891
18936
|
function onChange(ok, body) {
|
|
18892
18937
|
if (ok) update();
|
|
18893
18938
|
callbackFunction(ok, body);
|
|
18894
|
-
}
|
|
18895
|
-
|
|
18939
|
+
}
|
|
18896
18940
|
|
|
18897
18941
|
var select = makeSelectForCategory(dom, kb, subject, category, dataDoc, onChange);
|
|
18898
18942
|
container.appendChild(select);
|
|
@@ -19047,71 +19091,330 @@ function newThing(doc) {
|
|
|
19047
19091
|
var now = new Date();
|
|
19048
19092
|
return $rdf.sym(doc.uri + '#' + 'id' + ('' + now.getTime()));
|
|
19049
19093
|
}
|
|
19050
|
-
|
|
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
|
+
*/
|
|
19051
19104
|
|
|
19052
|
-
/***/ }),
|
|
19053
19105
|
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
!*** ./lib/widgets/forms/autocomplete/autocompleteBar.js ***!
|
|
19057
|
-
\***********************************************************/
|
|
19058
|
-
/***/ ((__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
|
|
19059
19108
|
|
|
19060
|
-
|
|
19109
|
+
var editable = kb.updater.editable(dataDoc.uri);
|
|
19061
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}`)
|
|
19062
19114
|
|
|
19063
|
-
|
|
19115
|
+
if (!sub.uri || sub.uri in optionsFromClassUIfrom) continue;
|
|
19116
|
+
optionsFromClassUIfrom[sub.uri] = true;
|
|
19117
|
+
}
|
|
19064
19118
|
|
|
19065
|
-
var
|
|
19119
|
+
var isEmpty = Object.keys(optionsFromClassUIfrom).length === 0;
|
|
19066
19120
|
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
}
|
|
19070
|
-
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
|
+
}
|
|
19071
19124
|
|
|
19072
|
-
|
|
19125
|
+
log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
|
|
19073
19126
|
|
|
19074
|
-
|
|
19127
|
+
function determineFitstSelectOptionText() {
|
|
19128
|
+
var firstSelectOptionText = '--- choice ---';
|
|
19075
19129
|
|
|
19076
|
-
|
|
19130
|
+
if (predicate && !(predicate.termType === 'BlankNode')) {
|
|
19131
|
+
firstSelectOptionText = '* Select for property: ' + utils.label(predicate) + ' *';
|
|
19132
|
+
}
|
|
19077
19133
|
|
|
19078
|
-
|
|
19134
|
+
if (subject && !(subject.termType === 'BlankNode')) {
|
|
19135
|
+
firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *';
|
|
19136
|
+
}
|
|
19079
19137
|
|
|
19080
|
-
|
|
19138
|
+
return firstSelectOptionText;
|
|
19139
|
+
}
|
|
19081
19140
|
|
|
19082
|
-
|
|
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
|
+
}
|
|
19083
19150
|
|
|
19084
|
-
var
|
|
19151
|
+
var onChange = function onChange(_e) {
|
|
19152
|
+
container.removeChild(container.lastChild);
|
|
19153
|
+
select.refresh();
|
|
19154
|
+
};
|
|
19085
19155
|
|
|
19086
|
-
var
|
|
19156
|
+
var select = dom.createElement('select');
|
|
19157
|
+
select.setAttribute('style', style.formSelectSTyle);
|
|
19158
|
+
select.setAttribute('id', 'formSelect');
|
|
19159
|
+
select.currentURI = null;
|
|
19087
19160
|
|
|
19088
|
-
|
|
19161
|
+
for (var uri in optionsFromClassUIfrom) {
|
|
19162
|
+
select.appendChild(createOption(uri));
|
|
19163
|
+
}
|
|
19089
19164
|
|
|
19090
|
-
|
|
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
|
|
19091
19169
|
|
|
19092
|
-
|
|
19170
|
+
select.insertBefore(mint, select.firstChild);
|
|
19171
|
+
}
|
|
19093
19172
|
|
|
19094
|
-
|
|
19173
|
+
if (select.children.length === 0) select.insertBefore(determinFirstSelectOption(), select.firstChild);
|
|
19095
19174
|
|
|
19096
|
-
|
|
19175
|
+
select.update = function (newSelectedOptions) {
|
|
19176
|
+
selectedOptions = newSelectedOptions;
|
|
19177
|
+
var ds = [];
|
|
19178
|
+
var is = [];
|
|
19097
19179
|
|
|
19098
|
-
var
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
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
|
+
};
|
|
19102
19185
|
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
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
|
+
}
|
|
19107
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
|
+
};
|
|
19108
19195
|
|
|
19109
|
-
function
|
|
19110
|
-
|
|
19111
|
-
|
|
19196
|
+
var existingValues = kb.each(subject, predicate, null, dataDoc).map(function (object) {
|
|
19197
|
+
return object.value;
|
|
19198
|
+
});
|
|
19112
19199
|
|
|
19113
|
-
|
|
19114
|
-
|
|
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) {
|
|
19115
19418
|
switch (_context6.prev = _context6.next) {
|
|
19116
19419
|
case 0:
|
|
19117
19420
|
syncEditingStatus = function _syncEditingStatus() {
|
|
@@ -22021,10 +22324,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
22021
22324
|
|
|
22022
22325
|
/***/ }),
|
|
22023
22326
|
|
|
22024
|
-
/***/ "./lib/widgets/
|
|
22025
|
-
|
|
22026
|
-
!*** ./lib/widgets/
|
|
22027
|
-
|
|
22327
|
+
/***/ "./lib/widgets/multiSelect.js":
|
|
22328
|
+
/*!************************************!*\
|
|
22329
|
+
!*** ./lib/widgets/multiSelect.js ***!
|
|
22330
|
+
\************************************/
|
|
22028
22331
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
22029
22332
|
|
|
22030
22333
|
"use strict";
|
|
@@ -22037,72 +22340,866 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
22037
22340
|
Object.defineProperty(exports, "__esModule", ({
|
|
22038
22341
|
value: true
|
|
22039
22342
|
}));
|
|
22040
|
-
exports.
|
|
22343
|
+
exports.IconicMultiSelect = void 0;
|
|
22041
22344
|
|
|
22042
|
-
var
|
|
22345
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
22043
22346
|
|
|
22044
22347
|
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
22045
22348
|
|
|
22046
22349
|
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
22047
22350
|
|
|
22048
|
-
var
|
|
22351
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
22049
22352
|
|
|
22050
|
-
var
|
|
22353
|
+
var style = _interopRequireWildcard(__webpack_require__(/*! ../style_multiSelect */ "./lib/style_multiSelect.js"));
|
|
22051
22354
|
|
|
22052
|
-
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); }
|
|
22053
22356
|
|
|
22054
|
-
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; }
|
|
22055
22358
|
|
|
22056
|
-
|
|
22359
|
+
/*
|
|
22360
|
+
* IconicMultiSelect v0.7.0
|
|
22361
|
+
* Licence: MIT
|
|
22362
|
+
* (c) 2021 Sidney Wimart.
|
|
22363
|
+
* repo & configuration: https://github.com/sidneywm/iconic-multiselect
|
|
22364
|
+
*/
|
|
22057
22365
|
|
|
22058
|
-
|
|
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
|
+
*/
|
|
22059
22425
|
|
|
22060
|
-
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
22061
22426
|
|
|
22062
|
-
|
|
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
|
+
}
|
|
22063
22435
|
|
|
22064
|
-
|
|
22436
|
+
if (this._tagTemplate && this._data.length === 0) {
|
|
22437
|
+
throw new Error('tagTemplate must be initialized with data from the component settings');
|
|
22438
|
+
}
|
|
22065
22439
|
|
|
22066
|
-
|
|
22440
|
+
this._options = this._data.length > 0 ? this._getDataFromSettings() : this._getDataFromSelectTag();
|
|
22067
22441
|
|
|
22068
|
-
|
|
22442
|
+
this._renderMultiselect();
|
|
22069
22443
|
|
|
22070
|
-
|
|
22444
|
+
this._renderOptionsList();
|
|
22071
22445
|
|
|
22072
|
-
|
|
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
|
+
}
|
|
22073
22458
|
|
|
22074
|
-
|
|
22075
|
-
|
|
22076
|
-
|
|
22077
|
-
|
|
22078
|
-
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
this.groupPickedCb = groupPickedCb;
|
|
22082
|
-
this.selectedgroup = this.options.selectedgroup; // current selected group if any
|
|
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
|
+
}
|
|
22083
22466
|
|
|
22084
|
-
|
|
22085
|
-
|
|
22467
|
+
return false;
|
|
22468
|
+
}
|
|
22469
|
+
}
|
|
22470
|
+
};
|
|
22086
22471
|
|
|
22087
|
-
|
|
22088
|
-
|
|
22089
|
-
|
|
22472
|
+
this._enableEventListenners();
|
|
22473
|
+
|
|
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
|
+
*/
|
|
22484
|
+
|
|
22485
|
+
}, {
|
|
22486
|
+
key: "subscribe",
|
|
22487
|
+
value: function subscribe(callback) {
|
|
22488
|
+
if (typeof callback === 'function') {
|
|
22489
|
+
this._event = callback;
|
|
22490
|
+
} else {
|
|
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) {
|
|
22090
22503
|
var _this = this;
|
|
22091
22504
|
|
|
22092
|
-
var
|
|
22093
|
-
container.style.maxWidth = '350px';
|
|
22094
|
-
container.style.minHeight = '200px';
|
|
22095
|
-
container.style.outline = '1px solid black';
|
|
22096
|
-
container.style.display = 'flex';
|
|
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>");
|
|
22097
22506
|
|
|
22098
|
-
|
|
22099
|
-
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
|
|
22103
|
-
|
|
22104
|
-
|
|
22105
|
-
|
|
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;
|
|
22106
23203
|
|
|
22107
23204
|
_this.render();
|
|
22108
23205
|
});
|
|
@@ -22692,6 +23789,22 @@ module.exports = _arrayWithHoles, module.exports.__esModule = true, module.expor
|
|
|
22692
23789
|
|
|
22693
23790
|
/***/ }),
|
|
22694
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
|
+
|
|
22695
23808
|
/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
|
|
22696
23809
|
/*!**********************************************************************!*\
|
|
22697
23810
|
!*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
|
|
@@ -22957,6 +24070,20 @@ module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, mo
|
|
|
22957
24070
|
|
|
22958
24071
|
/***/ }),
|
|
22959
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
|
+
|
|
22960
24087
|
/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
|
|
22961
24088
|
/*!*********************************************************************!*\
|
|
22962
24089
|
!*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
|
|
@@ -23011,6 +24138,20 @@ module.exports = _nonIterableRest, module.exports.__esModule = true, module.expo
|
|
|
23011
24138
|
|
|
23012
24139
|
/***/ }),
|
|
23013
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
|
+
|
|
23014
24155
|
/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
|
|
23015
24156
|
/*!**************************************************************************!*\
|
|
23016
24157
|
!*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
|
|
@@ -23097,6 +24238,28 @@ module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, modul
|
|
|
23097
24238
|
|
|
23098
24239
|
/***/ }),
|
|
23099
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
|
+
|
|
23100
24263
|
/***/ "./node_modules/@babel/runtime/helpers/typeof.js":
|
|
23101
24264
|
/*!*******************************************************!*\
|
|
23102
24265
|
!*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
|