solid-ui 2.4.22-dc624c1d → 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 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('div'));
13981
- div.setAttribute('style', unselectedStyle);
13982
- div.addEventListener('click', function (e) {
13983
- if (!e.metaKey) {
13984
- resetTabStyle();
13985
- resetBodyStyle();
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
- div.setAttribute('style', selectedStyle);
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 && e.altKey && ele.subject && bodyMain.asSettings !== true) {
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.textContent = (0, _utils.label)(item);
14098
+ div.innerHTML = (0, _utils.label)(item);
14099
+ ele.appendChild(ellipsis);
14008
14100
  }
14009
14101
 
14010
14102
  return ele;
@@ -14084,10 +14176,8 @@ function tabWidget(options) {
14084
14176
 
14085
14177
  if (_tab.classList.contains('unstyled')) {
14086
14178
  continue;
14087
- }
14088
-
14089
- if (_tab.children[0]) {
14090
- _tab.children[0].setAttribute('style', unselectedStyle);
14179
+ } else {
14180
+ _tab.setAttribute('style', unselectedStyle);
14091
14181
  }
14092
14182
  }
14093
14183
  }
@@ -15172,7 +15262,7 @@ function slice(s, suffix) {
15172
15262
 
15173
15263
  function getWellKnownLabel(thing) {
15174
15264
  return _solidLogic.store.any(thing, UI.ns.ui('label')) || // Prioritize ui:label
15175
- _solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label'));
15265
+ _solidLogic.store.any(thing, UI.ns.link('message')) || _solidLogic.store.any(thing, UI.ns.vcard('fn')) || _solidLogic.store.any(thing, UI.ns.foaf('name')) || _solidLogic.store.any(thing, UI.ns.dct('title')) || _solidLogic.store.any(thing, UI.ns.dc('title')) || _solidLogic.store.any(thing, UI.ns.rss('title')) || _solidLogic.store.any(thing, UI.ns.contact('fullName')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2001/04/roadmap/org#name')) || _solidLogic.store.any(thing, UI.ns.cal('summary')) || _solidLogic.store.any(thing, UI.ns.foaf('nick')) || _solidLogic.store.any(thing, UI.ns.as('name')) || _solidLogic.store.any(thing, UI.ns.schema('name')) || _solidLogic.store.any(thing, UI.ns.rdfs('label')) || _solidLogic.store.any(thing, _solidLogic.store.sym('http://www.w3.org/2004/02/skos/core#prefLabel'));
15176
15266
  }
15177
15267
  //# sourceMappingURL=label.js.map
15178
15268
 
@@ -15192,11 +15282,11 @@ Object.defineProperty(exports, "__esModule", ({
15192
15282
  }));
15193
15283
  exports.versionInfo = void 0;
15194
15284
  var versionInfo = {
15195
- buildTime: '2022-05-09T07:57:43Z',
15196
- commit: 'dc624c1d12541b19a1760ac330ffcc5bdf547f25',
15285
+ buildTime: '2022-05-25T21:53:40Z',
15286
+ commit: 'dc79c0e3372c8084fe393d058672af8389e9559a',
15197
15287
  npmInfo: {
15198
15288
  'solid-ui': '2.4.22',
15199
- npm: '6.14.16',
15289
+ npm: '6.14.17',
15200
15290
  ares: '1.18.1',
15201
15291
  brotli: '1.0.9',
15202
15292
  cldr: '40.0',
@@ -15205,12 +15295,12 @@ var versionInfo = {
15205
15295
  modules: '83',
15206
15296
  napi: '8',
15207
15297
  nghttp2: '1.42.0',
15208
- node: '14.19.1',
15298
+ node: '14.19.2',
15209
15299
  openssl: '1.1.1n',
15210
15300
  tz: '2021a3',
15211
15301
  unicode: '14.0',
15212
15302
  uv: '1.42.0',
15213
- v8: '8.4.371.23-node.85',
15303
+ v8: '8.4.371.23-node.87',
15214
15304
  zlib: '1.2.11'
15215
15305
  }
15216
15306
  };
@@ -16280,6 +16370,7 @@ function openHrefInOutlineMode(e) {
16280
16370
 
16281
16371
  if (dom.outlineManager) {
16282
16372
  // @@ TODO Remove the use of document as a global object
16373
+ // TODO fix dependency cycle to solid-panes by calling outlineManager
16283
16374
  ;
16284
16375
  dom.outlineManager.GotoSubject(_solidLogic.store.sym(uri), true, undefined, true, undefined);
16285
16376
  } else if (window && window.panes && window.panes.getOutliner) {
@@ -16407,6 +16498,7 @@ function linkButton(dom, object) {
16407
16498
  b.textContent = 'Goto ' + utils.label(object);
16408
16499
  b.addEventListener('click', function (_event) {
16409
16500
  // b.parentNode.removeChild(b)
16501
+ // TODO fix dependency cycle to solid-panes by calling outlineManager
16410
16502
  ;
16411
16503
  dom.outlineManager.GotoSubject(object, true, undefined, true, undefined);
16412
16504
  }, true);
@@ -17147,6 +17239,7 @@ exports.findClosest = findClosest;
17147
17239
  exports.formsFor = formsFor;
17148
17240
  exports.makeDescription = makeDescription;
17149
17241
  exports.makeSelectForCategory = makeSelectForCategory;
17242
+ exports.makeSelectForChoice = makeSelectForChoice;
17150
17243
  exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
17151
17244
  exports.makeSelectForOptions = makeSelectForOptions;
17152
17245
  exports.newButton = newButton;
@@ -17196,6 +17289,8 @@ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-l
17196
17289
 
17197
17290
  var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/utils/index.js"));
17198
17291
 
17292
+ var _multiSelect = __webpack_require__(/*! ./multiSelect */ "./lib/widgets/multiSelect.js");
17293
+
17199
17294
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
17200
17295
 
17201
17296
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -17258,14 +17353,16 @@ _fieldFunction.field[ns.ui('Form').uri] = _fieldFunction.field[ns.ui('Group').ur
17258
17353
  var ui = ns.ui;
17259
17354
  if (container) container.appendChild(box); // Prevent loops
17260
17355
 
17356
+ if (!form) return;
17261
17357
  var key = subject.toNT() + '|' + form.toNT();
17262
17358
 
17263
17359
  if (already[key]) {
17264
17360
  // been there done that
17265
- box.appendChild(dom.createTextNode('Group: see above ' + key));
17266
- var plist = [$rdf.st(subject, ns.owl('sameAs'), subject)]; // @@ need prev subject
17361
+ box.appendChild(dom.createTextNode('Group: see above ' + key)); // TODO fix dependency cycle to solid-panes by calling outlineManager
17362
+ // const plist = [$rdf.st(subject, ns.owl('sameAs'), subject)] // @@ need prev subject
17363
+ // dom.outlineManager.appendPropertyTRs(box, plist)
17364
+ // dom.appendChild(plist)
17267
17365
 
17268
- dom.outlineManager.appendPropertyTRs(box, plist);
17269
17366
  return box;
17270
17367
  }
17271
17368
 
@@ -17366,47 +17463,43 @@ _fieldFunction.field[ns.ui('Options').uri] = function (dom, container, already,
17366
17463
  values = kb.each(subject, dependingOn);
17367
17464
  }
17368
17465
 
17369
- if (values.length === 0) {
17370
- box.appendChild((0, _error.errorMessageBlock)(dom, "Can't select subform as no value of: " + dependingOn));
17371
- } else {
17372
- for (var i = 0; i < cases.length; i++) {
17373
- var c = cases[i];
17374
- var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
17466
+ for (var i = 0; i < cases.length; i++) {
17467
+ var c = cases[i];
17468
+ var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
17375
17469
 
17376
- var match = false;
17470
+ var match = false;
17377
17471
 
17378
- for (var j = 0; j < tests.length; j++) {
17379
- var _iterator = _createForOfIteratorHelper(values),
17380
- _step;
17472
+ for (var j = 0; j < tests.length; j++) {
17473
+ var _iterator = _createForOfIteratorHelper(values),
17474
+ _step;
17381
17475
 
17382
- try {
17383
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
17384
- var value = _step.value;
17385
- var test = tests[j];
17476
+ try {
17477
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
17478
+ var value = _step.value;
17479
+ var test = tests[j];
17386
17480
 
17387
- if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
17388
- match = true;
17389
- }
17481
+ if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
17482
+ match = true;
17390
17483
  }
17391
- } catch (err) {
17392
- _iterator.e(err);
17393
- } finally {
17394
- _iterator.f();
17395
17484
  }
17485
+ } catch (err) {
17486
+ _iterator.e(err);
17487
+ } finally {
17488
+ _iterator.f();
17396
17489
  }
17490
+ }
17397
17491
 
17398
- if (match) {
17399
- var _field3 = kb.the(c, ui('use'));
17400
-
17401
- if (!_field3) {
17402
- box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
17403
- return box;
17404
- } else {
17405
- appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
17406
- }
17492
+ if (match) {
17493
+ var _field3 = kb.the(c, ui('use'));
17407
17494
 
17408
- break;
17495
+ if (!_field3) {
17496
+ box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
17497
+ return box;
17498
+ } else {
17499
+ appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
17409
17500
  }
17501
+
17502
+ break;
17410
17503
  }
17411
17504
  } // @@ Add box.refresh() to sync fields with values
17412
17505
 
@@ -17694,7 +17787,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17694
17787
  // delete button and move buttons
17695
17788
 
17696
17789
  if (kb.updater.editable(dataDoc.uri)) {
17697
- buttons.deleteButtonWithCheck(dom, subField, utils.label(property), deleteThisItem);
17790
+ buttons.deleteButtonWithCheck(dom, subField, multipleUIlabel, deleteThisItem);
17698
17791
 
17699
17792
  if (ordered) {
17700
17793
  // Add controsl in a frame
@@ -17745,7 +17838,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17745
17838
 
17746
17839
  var _shim = dom.createElement('div');
17747
17840
 
17748
- _shim.appendChild(subField); // Subfield has its own laytout
17841
+ _shim.appendChild(subField); // Subfield has its own layout
17749
17842
 
17750
17843
 
17751
17844
  frame.appendChild(_shim);
@@ -17794,6 +17887,8 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17794
17887
  return shim;
17795
17888
  }
17796
17889
 
17890
+ var multipleUIlabel = kb.any(form, ui('label'));
17891
+ if (!multipleUIlabel) multipleUIlabel = utils.label(property);
17797
17892
  var min = kb.any(form, ui('min')); // This is the minimum number -- default 0
17798
17893
 
17799
17894
  min = min ? 0 + min.value : 0;
@@ -17834,10 +17929,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17834
17929
  img.setAttribute('src', plusIconURI); // plus sign
17835
17930
 
17836
17931
  img.setAttribute('style', 'margin: 0.2em; width: 1.5em; height:1.5em');
17837
- img.title = 'Click to add one or more ' + utils.predicateLabel(property, reverse);
17838
- var prompt = tail.appendChild(dom.createElement('span'));
17839
- prompt.textContent = (values.length === 0 ? 'Add one or more ' : 'Add more ') + utils.predicateLabel(property, reverse); // utils.label(property)
17840
-
17932
+ img.title = 'Click to add another ' + multipleUIlabel;
17933
+ var prompt = dom.createElement('span');
17934
+ prompt.textContent = (values.length === 0 ? 'Add another ' : 'Add ') + multipleUIlabel;
17841
17935
  tail.addEventListener('click', /*#__PURE__*/function () {
17842
17936
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_eventNotUsed) {
17843
17937
  return _regenerator["default"].wrap(function _callee5$(_context5) {
@@ -17859,6 +17953,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17859
17953
  return _ref3.apply(this, arguments);
17860
17954
  };
17861
17955
  }(), true);
17956
+ tail.appendChild(prompt);
17862
17957
  }
17863
17958
 
17864
17959
  function createListIfNecessary() {
@@ -18133,23 +18228,25 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
18133
18228
  ** -- radio buttons
18134
18229
  ** -- auto-complete typing
18135
18230
  **
18136
- ** Todo: Deal with multiple. Maybe merge with multiple code.
18231
+ ** TODO: according to ontology ui:choice can also have ns.ui('default') - this is not implemented yet
18137
18232
  */
18138
18233
 
18139
18234
 
18140
18235
  _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, subject, form, dataDoc, callbackFunction) {
18141
18236
  var ui = ns.ui;
18142
18237
  var kb = _solidLogic.store;
18143
- var multiple = false;
18144
18238
  var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
18145
18239
 
18146
18240
  var p;
18147
- var box = dom.createElement('div'); // Set flexDirection column?
18241
+ var box = dom.createElement('div');
18242
+ box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
18148
18243
 
18149
18244
  if (container) container.appendChild(box);
18150
18245
  var lhs = dom.createElement('div');
18246
+ lhs.setAttribute('class', 'formFieldName choiceBox-label');
18151
18247
  box.appendChild(lhs);
18152
18248
  var rhs = dom.createElement('div');
18249
+ rhs.setAttribute('class', 'formFieldValue choiceBox-selectBox');
18153
18250
  box.appendChild(rhs);
18154
18251
  var property = kb.any(form, ui('property'));
18155
18252
 
@@ -18158,103 +18255,125 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18158
18255
  }
18159
18256
 
18160
18257
  lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
18258
+ var uiFrom = kb.any(form, ui('from'));
18259
+
18260
+ if (!uiFrom) {
18261
+ return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
18262
+ }
18263
+
18161
18264
  var subForm = kb.any(form, ui('use')); // Optional
18162
18265
 
18163
18266
  var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
18164
18267
 
18165
- var possible = [];
18166
- var possibleProperties;
18167
- var firstSelectOptionText = '* Select from ' + utils.label(subject, true) + ' *';
18168
18268
  var opts = {
18169
18269
  form: form,
18170
18270
  subForm: subForm,
18171
- multiple: multiple,
18172
- firstSelectOptionText: firstSelectOptionText,
18173
18271
  disambiguate: false
18174
18272
  };
18175
- var uiFrom = kb.any(form, ui('from'));
18176
18273
 
18177
- if (!uiFrom) {
18178
- return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
18179
- }
18274
+ function getSelectorOptions() {
18275
+ var possible = [];
18276
+ var possibleProperties;
18277
+ possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
18180
18278
 
18181
- possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
18279
+ for (var x in kb.findMembersNT(uiFrom)) {
18280
+ possible.push(kb.fromNT(x));
18281
+ } // Use rdfs
18182
18282
 
18183
- for (var x in kb.findMembersNT(uiFrom)) {
18184
- possible.push(kb.fromNT(x));
18185
- } // Use rdfs
18186
18283
 
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)
18187
18288
 
18188
- if (uiFrom.sameTerm(ns.rdfs('Class'))) {
18189
- for (p in buttons.allClassURIs()) {
18190
- possible.push(kb.sym(p));
18191
- } // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
18289
+ } else if (uiFrom.sameTerm(ns.rdf('Property'))) {
18290
+ possibleProperties = buttons.propertyTriage(kb);
18192
18291
 
18193
- } else if (uiFrom.sameTerm(ns.rdf('Property'))) {
18194
- possibleProperties = buttons.propertyTriage(kb);
18292
+ for (p in possibleProperties.op) {
18293
+ possible.push(kb.fromNT(p));
18294
+ }
18195
18295
 
18196
- for (p in possibleProperties.op) {
18197
- possible.push(kb.fromNT(p));
18198
- }
18296
+ for (p in possibleProperties.dp) {
18297
+ possible.push(kb.fromNT(p));
18298
+ }
18199
18299
 
18200
- for (p in possibleProperties.dp) {
18201
- possible.push(kb.fromNT(p));
18202
- }
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);
18203
18303
 
18204
- opts.disambiguate = true; // This is a big class, and the labels won't be enough.
18205
- } else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
18206
- possibleProperties = buttons.propertyTriage(kb);
18304
+ for (p in possibleProperties.op) {
18305
+ possible.push(kb.fromNT(p));
18306
+ }
18207
18307
 
18208
- for (p in possibleProperties.op) {
18209
- possible.push(kb.fromNT(p));
18210
- }
18308
+ opts.disambiguate = true;
18309
+ } else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
18310
+ possibleProperties = buttons.propertyTriage(kb);
18211
18311
 
18212
- opts.disambiguate = true;
18213
- } else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
18214
- possibleProperties = buttons.propertyTriage(kb);
18312
+ for (p in possibleProperties.dp) {
18313
+ possible.push(kb.fromNT(p));
18314
+ }
18215
18315
 
18216
- for (p in possibleProperties.dp) {
18217
- possible.push(kb.fromNT(p));
18316
+ opts.disambiguate = true;
18218
18317
  }
18219
18318
 
18220
- opts.disambiguate = true;
18221
- }
18319
+ return possible; // return sortByLabel(possible)
18320
+ } // TODO: this checks for any occurrence, regardless of true or false setting
18222
18321
 
18223
- var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurance regardles if it is set to true or false
18224
18322
 
18225
18323
  if (kb.any(form, ui('canMintNew'))) {
18226
18324
  opts.mint = '* Create new *'; // @@ could be better
18227
18325
  }
18228
18326
 
18229
- var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, uiFrom, opts, dataDoc, callbackFunction);
18230
- rhs.appendChild(selector);
18231
- var object;
18327
+ var multiSelect = kb.any(form, ui('multiselect')); // Optional
18232
18328
 
18233
- if (selector.currentURI) {
18234
- object = $rdf.sym(selector.currentURI);
18235
- } else {
18236
- object = kb.any(subject, property);
18237
- }
18329
+ var selector; // from ui:property
18238
18330
 
18239
- if (object && subForm) {
18240
- removeNextSiblingsAfterElement(selector);
18241
- addSubFormChoice(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
18242
- }
18331
+ var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
18332
+ return object.value;
18333
+ });
18243
18334
 
18244
- return box;
18245
- };
18246
- /**
18247
- * Removes all sibling elements after specified
18248
- * @param {HTMLElement} currentElement
18249
- * @private
18250
- */
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
+ }
18251
18363
 
18364
+ if (event.action === 'ADD_OPTION') {
18365
+ selectedOptions.push(event.value);
18366
+ }
18252
18367
 
18253
- function removeNextSiblingsAfterElement(currentElement) {
18254
- while (currentElement.nextElementSibling) {
18255
- currentElement.nextElementSibling.remove();
18256
- }
18257
- }
18368
+ selector.update(selectedOptions);
18369
+ });
18370
+ }
18371
+ };
18372
+
18373
+ rhs.refresh();
18374
+ if (selector && selector.refresh) selector.refresh();
18375
+ return box;
18376
+ };
18258
18377
 
18259
18378
  function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
18260
18379
  (0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
@@ -18461,7 +18580,8 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
18461
18580
  b.setAttribute('type', 'button');
18462
18581
  b.setAttribute('style', 'float: right;');
18463
18582
  b.innerHTML = 'Goto ' + utils.label(theClass);
18464
- b.addEventListener('click', function (_e) {
18583
+ b.addEventListener('click', // TODO fix dependency cycle to solid-panes by calling outlineManager
18584
+ function (_e) {
18465
18585
  dom.outlineManager.GotoSubject(theClass, true, undefined, true, undefined);
18466
18586
  }, false);
18467
18587
  return box;
@@ -18596,17 +18716,15 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
18596
18716
  // @param subject - a term, the subject of the statement(s) being edited.
18597
18717
  // @param predicate - a term, the predicate of the statement(s) being edited
18598
18718
  // @param possible - a list of terms, the possible value the object can take
18599
- // @param options.multiple - Boolean - Whether more than one at a time is allowed
18600
- // @param options.firstSelectOptionText - a string to be displayed as the
18719
+ // @param options.nullLabel - a string to be displayed as the
18601
18720
  // option for none selected (for non multiple)
18602
- // @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
18603
18721
  // @param options.subForm - If mint, then the form to be used for minting the new thing
18604
18722
  // @param dataDoc - The web document being edited
18605
18723
  // @param callbackFunction - takes (boolean ok, string errorBody)
18606
18724
  */
18607
18725
 
18608
18726
 
18609
- function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, options, dataDoc, callbackFunction) {
18727
+ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
18610
18728
  log.debug('Select list length now ' + possible.length);
18611
18729
  var n = 0;
18612
18730
  var uris = {}; // Count them
@@ -18623,7 +18741,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18623
18741
  } // uris is now the set of possible options
18624
18742
 
18625
18743
 
18626
- if (n === 0 && !options.mint) {
18744
+ if (n === 0) {
18627
18745
  return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
18628
18746
  }
18629
18747
 
@@ -18649,6 +18767,8 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18649
18767
  actual = getActual();
18650
18768
 
18651
18769
  var onChange = function onChange(_e) {
18770
+ select.disabled = true; // until data written back - gives user feedback too
18771
+
18652
18772
  var ds = [];
18653
18773
  var is = [];
18654
18774
 
@@ -18658,43 +18778,18 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18658
18778
  }
18659
18779
  };
18660
18780
 
18661
- var newObject;
18662
-
18663
18781
  for (var _i = 0; _i < select.options.length; _i++) {
18664
18782
  var opt = select.options[_i];
18665
-
18666
- if (opt.selected && opt.AJAR_mint) {
18667
- // not sure if this if is used because I cannot find mintClass
18668
- if (options.mintClass) {
18669
- var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
18670
- if (!ok) {
18671
- callbackFunction(ok, body, {
18672
- change: 'new'
18673
- }); // @@ if ok, need some form of refresh of the select for the new thing
18674
- }
18675
- });
18676
- select.parentNode.appendChild(thisForm);
18677
- newObject = thisForm.AJAR_subject;
18678
- } else {
18679
- newObject = newThing(dataDoc);
18680
- }
18681
-
18682
- is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
18683
- 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
18684
-
18685
- if (options.mintStatementsFun) {
18686
- is = is.concat(options.mintStatementsFun(newObject));
18687
- }
18688
-
18689
- select.currentURI = newObject;
18690
- }
18691
-
18692
18783
  if (!opt.AJAR_uri) continue; // a prompt or mint
18693
18784
 
18694
18785
  if (opt.selected && !(opt.AJAR_uri in actual)) {
18695
18786
  // new class
18696
18787
  is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
18697
- select.currentURI = opt.AJAR_uri;
18788
+ }
18789
+
18790
+ if (!opt.selected && opt.AJAR_uri in actual) {
18791
+ // old class
18792
+ removeValue(kb.sym(opt.AJAR_uri));
18698
18793
  }
18699
18794
 
18700
18795
  if (opt.selected) select.currentURI = opt.AJAR_uri;
@@ -18714,25 +18809,25 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18714
18809
  sel = sel.superSelect;
18715
18810
  }
18716
18811
 
18717
- log.info('selectForOptions: data doc = ' + dataDoc); // refresh subForm
18812
+ log.info('selectForOptions: data doc = ' + dataDoc);
18813
+ kb.updater.update(ds, is, function (uri, ok, body) {
18814
+ actual = getActual(); // refresh
18718
18815
 
18719
- removeNextSiblingsAfterElement(select);
18720
- addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
18721
18816
  if (ok) {
18722
- kb.updater.update(ds, is, function (uri, success, errorBody) {
18723
- actual = getActual(); // refresh
18724
-
18725
- if (!success) select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
18726
- }); // if (callbackFunction) callbackFunction(ok, { widget: 'select', event: 'new' })
18817
+ select.disabled = false; // data written back
18727
18818
  } else {
18728
- select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
18819
+ return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
18729
18820
  }
18821
+
18822
+ if (callbackFunction) callbackFunction(ok, {
18823
+ widget: 'select',
18824
+ event: 'change'
18825
+ });
18730
18826
  });
18731
18827
  };
18732
18828
 
18733
18829
  var select = dom.createElement('select');
18734
18830
  select.setAttribute('style', style.formSelectSTyle);
18735
- if (options.multiple) select.setAttribute('multiple', 'true');
18736
18831
  select.currentURI = null;
18737
18832
 
18738
18833
  select.refresh = function () {
@@ -18775,22 +18870,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18775
18870
  select.appendChild(option);
18776
18871
  }
18777
18872
 
18778
- if (editable && options.mint) {
18779
- var mint = dom.createElement('option');
18780
- mint.appendChild(dom.createTextNode(options.mint));
18781
- mint.AJAR_mint = true; // Flag it
18782
-
18783
- select.insertBefore(mint, select.firstChild);
18784
- }
18785
-
18786
- if (!select.currentURI && !options.multiple) {
18873
+ if (!select.currentURI) {
18787
18874
  var prompt = dom.createElement('option');
18788
- prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
18789
- prompt.selected = true;
18790
- prompt.disabled = true;
18791
- prompt.value = true;
18792
- prompt.hidden = true;
18875
+ prompt.appendChild(dom.createTextNode(options.nullLabel));
18793
18876
  select.insertBefore(prompt, select.firstChild);
18877
+ prompt.selected = true;
18794
18878
  }
18795
18879
 
18796
18880
  if (editable) {
@@ -18809,27 +18893,16 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18809
18893
  function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
18810
18894
  var du = kb.any(category, ns.owl('disjointUnionOf'));
18811
18895
  var subs;
18812
- var multiple = false;
18813
18896
 
18814
18897
  if (!du) {
18815
18898
  subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
18816
- multiple = true;
18817
18899
  } else {
18818
18900
  subs = du.elements;
18819
18901
  }
18820
18902
 
18821
18903
  log.debug('Select list length ' + subs.length);
18822
-
18823
- if (subs.length === 0) {
18824
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
18825
- }
18826
-
18827
- if (subs.length === 1) {
18828
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
18829
- }
18830
-
18831
- return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
18832
- multiple: multiple
18904
+ return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
18905
+ nullLabel: '* Select type *'
18833
18906
  }, dataDoc, callbackFunction);
18834
18907
  }
18835
18908
  /** Make SELECT element to select subclasses recurively
@@ -18863,8 +18936,7 @@ function makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, callba
18863
18936
  function onChange(ok, body) {
18864
18937
  if (ok) update();
18865
18938
  callbackFunction(ok, body);
18866
- } // eslint-disable-next-line prefer-const
18867
-
18939
+ }
18868
18940
 
18869
18941
  var select = makeSelectForCategory(dom, kb, subject, category, dataDoc, onChange);
18870
18942
  container.appendChild(select);
@@ -19019,71 +19091,330 @@ function newThing(doc) {
19019
19091
  var now = new Date();
19020
19092
  return $rdf.sym(doc.uri + '#' + 'id' + ('' + now.getTime()));
19021
19093
  }
19022
- //# sourceMappingURL=forms.js.map
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
+ */
19023
19104
 
19024
- /***/ }),
19025
19105
 
19026
- /***/ "./lib/widgets/forms/autocomplete/autocompleteBar.js":
19027
- /*!***********************************************************!*\
19028
- !*** ./lib/widgets/forms/autocomplete/autocompleteBar.js ***!
19029
- \***********************************************************/
19030
- /***/ ((__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
19031
19108
 
19032
- "use strict";
19109
+ var editable = kb.updater.editable(dataDoc.uri);
19033
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}`)
19034
19114
 
19035
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
19115
+ if (!sub.uri || sub.uri in optionsFromClassUIfrom) continue;
19116
+ optionsFromClassUIfrom[sub.uri] = true;
19117
+ }
19036
19118
 
19037
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
19119
+ var isEmpty = Object.keys(optionsFromClassUIfrom).length === 0;
19038
19120
 
19039
- Object.defineProperty(exports, "__esModule", ({
19040
- value: true
19041
- }));
19042
- 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
+ }
19043
19124
 
19044
- var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
19125
+ log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
19045
19126
 
19046
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
19127
+ function determineFitstSelectOptionText() {
19128
+ var firstSelectOptionText = '--- choice ---';
19047
19129
 
19048
- var ns = _interopRequireWildcard(__webpack_require__(/*! ../../../ns */ "./lib/ns.js"));
19130
+ if (predicate && !(predicate.termType === 'BlankNode')) {
19131
+ firstSelectOptionText = '* Select for property: ' + utils.label(predicate) + ' *';
19132
+ }
19049
19133
 
19050
- var _iconBase = __webpack_require__(/*! ../../../iconBase */ "./lib/iconBase.js");
19134
+ if (subject && !(subject.termType === 'BlankNode')) {
19135
+ firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *';
19136
+ }
19051
19137
 
19052
- var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
19138
+ return firstSelectOptionText;
19139
+ }
19053
19140
 
19054
- var widgets = _interopRequireWildcard(__webpack_require__(/*! ../../../widgets */ "./lib/widgets/index.js"));
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
+ }
19055
19150
 
19056
- var utils = _interopRequireWildcard(__webpack_require__(/*! ../../../utils */ "./lib/utils/index.js"));
19151
+ var onChange = function onChange(_e) {
19152
+ container.removeChild(container.lastChild);
19153
+ select.refresh();
19154
+ };
19057
19155
 
19058
- var _autocompletePicker = __webpack_require__(/*! ./autocompletePicker */ "./lib/widgets/forms/autocomplete/autocompletePicker.js");
19156
+ var select = dom.createElement('select');
19157
+ select.setAttribute('style', style.formSelectSTyle);
19158
+ select.setAttribute('id', 'formSelect');
19159
+ select.currentURI = null;
19059
19160
 
19060
- 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); }
19161
+ for (var uri in optionsFromClassUIfrom) {
19162
+ select.appendChild(createOption(uri));
19163
+ }
19061
19164
 
19062
- 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; }
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
19063
19169
 
19064
- 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; } } }; }
19170
+ select.insertBefore(mint, select.firstChild);
19171
+ }
19065
19172
 
19066
- 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); }
19173
+ if (select.children.length === 0) select.insertBefore(determinFirstSelectOption(), select.firstChild);
19067
19174
 
19068
- 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; }
19175
+ select.update = function (newSelectedOptions) {
19176
+ selectedOptions = newSelectedOptions;
19177
+ var ds = [];
19178
+ var is = [];
19069
19179
 
19070
- var WEBID_NOUN = 'Solid ID';
19071
- var GREEN_PLUS = _iconBase.icons.iconBase + 'noun_34653_green.svg';
19072
- var SEARCH_ICON = _iconBase.icons.iconBase + 'noun_Search_875351.svg';
19073
- var EDIT_ICON = _iconBase.icons.iconBase + 'noun_253504.svg'; // const DELETE_ICON = icons.iconBase + 'noun_2188_red.svg'
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
+ };
19074
19185
 
19075
- function renderAutocompleteControl(_x, _x2, _x3, _x4, _x5, _x6) {
19076
- return _renderAutocompleteControl.apply(this, arguments);
19077
- } // renderAutocompleteControl
19078
- // ends
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
+ }
19079
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
+ };
19080
19195
 
19081
- function _renderAutocompleteControl() {
19082
- _renderAutocompleteControl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(dom, person, barOptions, acOptions, addOneIdAndRefresh, deleteOne) {
19083
- var autoCompleteDone, _autoCompleteDone, greenButtonHandler, _greenButtonHandler, removeDecorated, displayAutocomplete, _displayAutocomplete, searchButtonHandler, _searchButtonHandler, droppedURIHandler, _droppedURIHandler, acceptButton, cancelButton, deleteButtonContainer, noun, deleteButton, editButton, editing, syncEditingStatus, decoration, decoratedAutocomplete, creationArea, plus;
19196
+ var existingValues = kb.each(subject, predicate, null, dataDoc).map(function (object) {
19197
+ return object.value;
19198
+ });
19084
19199
 
19085
- return _regenerator["default"].wrap(function _callee6$(_context6) {
19086
- while (1) {
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) {
19087
19418
  switch (_context6.prev = _context6.next) {
19088
19419
  case 0:
19089
19420
  syncEditingStatus = function _syncEditingStatus() {
@@ -21993,10 +22324,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21993
22324
 
21994
22325
  /***/ }),
21995
22326
 
21996
- /***/ "./lib/widgets/peoplePicker.js":
21997
- /*!*************************************!*\
21998
- !*** ./lib/widgets/peoplePicker.js ***!
21999
- \*************************************/
22327
+ /***/ "./lib/widgets/multiSelect.js":
22328
+ /*!************************************!*\
22329
+ !*** ./lib/widgets/multiSelect.js ***!
22330
+ \************************************/
22000
22331
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
22001
22332
 
22002
22333
  "use strict";
@@ -22009,74 +22340,868 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
22009
22340
  Object.defineProperty(exports, "__esModule", ({
22010
22341
  value: true
22011
22342
  }));
22012
- exports.Person = exports.PeoplePicker = exports.GroupPicker = exports.GroupBuilder = exports.Group = void 0;
22343
+ exports.IconicMultiSelect = void 0;
22013
22344
 
22014
- var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteral */ "./node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js"));
22345
+ var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
22015
22346
 
22016
22347
  var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
22017
22348
 
22018
22349
  var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
22019
22350
 
22020
- var _escapeHtml = _interopRequireDefault(__webpack_require__(/*! escape-html */ "./node_modules/escape-html/index.js"));
22351
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
22021
22352
 
22022
- var _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/index.js"));
22353
+ var style = _interopRequireWildcard(__webpack_require__(/*! ../style_multiSelect */ "./lib/style_multiSelect.js"));
22023
22354
 
22024
- var rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
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); }
22025
22356
 
22026
- var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
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; }
22027
22358
 
22028
- var _dragAndDrop = __webpack_require__(/*! ./dragAndDrop */ "./lib/widgets/dragAndDrop.js");
22359
+ /*
22360
+ * IconicMultiSelect v0.7.0
22361
+ * Licence: MIT
22362
+ * (c) 2021 Sidney Wimart.
22363
+ * repo & configuration: https://github.com/sidneywm/iconic-multiselect
22364
+ */
22029
22365
 
22030
- var _error = __webpack_require__(/*! ./error */ "./lib/widgets/error.js");
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
+ */
22031
22425
 
22032
- var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
22033
22426
 
22034
- var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
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
+ }
22035
22435
 
22036
- var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
22436
+ if (this._tagTemplate && this._data.length === 0) {
22437
+ throw new Error('tagTemplate must be initialized with data from the component settings');
22438
+ }
22037
22439
 
22038
- var _templateObject;
22440
+ this._options = this._data.length > 0 ? this._getDataFromSettings() : this._getDataFromSelectTag();
22039
22441
 
22040
- 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); }
22442
+ this._renderMultiselect();
22041
22443
 
22042
- 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; }
22444
+ this._renderOptionsList();
22043
22445
 
22044
- var kb = _solidLogic.solidLogicSingleton.store;
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
+ }
22045
22458
 
22046
- var PeoplePicker = /*#__PURE__*/function () {
22047
- function PeoplePicker(element, typeIndex, groupPickedCb, options) {
22048
- (0, _classCallCheck2["default"])(this, PeoplePicker);
22049
- // @@ can't expect typeindex to be passed
22050
- this.options = options || {};
22051
- this.element = element;
22052
- this.typeIndex = typeIndex;
22053
- this.groupPickedCb = groupPickedCb;
22054
- 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
+ }
22055
22466
 
22056
- this.onSelectGroup = this.onSelectGroup.bind(this);
22057
- }
22467
+ return false;
22468
+ }
22469
+ }
22470
+ };
22058
22471
 
22059
- (0, _createClass2["default"])(PeoplePicker, [{
22060
- key: "render",
22061
- value: function render() {
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) {
22062
22503
  var _this = this;
22063
22504
 
22064
- var container = document.createElement('div');
22065
- container.style.maxWidth = '350px';
22066
- container.style.minHeight = '200px';
22067
- container.style.outline = '1px solid black';
22068
- 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>");
22069
22506
 
22070
- if (this.selectedgroup) {
22071
- container.style.flexDirection = 'column';
22072
- var selectedGroup = document.createElement('div');
22073
- new Group(selectedGroup, this.selectedgroup).render();
22074
- var changeGroupButton = document.createElement('button');
22075
- changeGroupButton.textContent = (0, _escapeHtml["default"])('Change group');
22076
- changeGroupButton.addEventListener('click', function (_event) {
22077
- _this.selectedgroup = null;
22507
+ this._domElements.input.insertAdjacentHTML('beforebegin', html);
22078
22508
 
22079
- _this.render();
22509
+ var _this$_multiselect$qu = this._multiselect.querySelector("span[data-value=\"".concat(option.value, "\"]")),
22510
+ removeBtn = _this$_multiselect$qu.lastElementChild;
22511
+
22512
+ removeBtn.addEventListener('click', function () {
22513
+ var target = _this._domElements.options.find(function (el) {
22514
+ return el.dataset.value === option.value;
22515
+ });
22516
+
22517
+ _this._handleOption(target);
22518
+ });
22519
+ }
22520
+ /**
22521
+ * Clears all selected options.
22522
+ * @private
22523
+ */
22524
+
22525
+ }, {
22526
+ key: "_clearSelection",
22527
+ value: function _clearSelection() {
22528
+ var _this2 = this;
22529
+
22530
+ var _loop = function _loop(i) {
22531
+ var option = _this2._selectedOptions[i];
22532
+
22533
+ var target = _this2._domElements.options.find(function (el) {
22534
+ return el.dataset.value === option.value;
22535
+ });
22536
+
22537
+ target.classList.remove('multiselect__options--selected');
22538
+ target.setAttribute('style', style.multiselect__options);
22539
+
22540
+ _this2._removeOptionFromList(target.dataset.value);
22541
+ };
22542
+
22543
+ for (var i = 0; i < this._selectedOptions.length; i++) {
22544
+ _loop(i);
22545
+ }
22546
+
22547
+ this._selectedOptions = [];
22548
+
22549
+ this._handleClearSelectionBtn();
22550
+
22551
+ this._handlePlaceholder();
22552
+
22553
+ this._dispatchEvent({
22554
+ action: 'CLEAR_ALL_OPTIONS',
22555
+ selection: this._selectedOptions
22556
+ });
22557
+ }
22558
+ /**
22559
+ * Close the options container.
22560
+ * @private
22561
+ */
22562
+
22563
+ }, {
22564
+ key: "_closeList",
22565
+ value: function _closeList() {
22566
+ this._domElements.input.value = '';
22567
+
22568
+ this._domElements.optionsContainer.classList.remove('visible');
22569
+
22570
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
22571
+
22572
+ this._filterOptions('');
22573
+
22574
+ this._removeAllArrowSelected();
22575
+ }
22576
+ /**
22577
+ * Dispatches new events.
22578
+ * @param { object : { action: string; selection: { option: string; text: string; }[]; value?: string; } } event
22579
+ * @private
22580
+ */
22581
+
22582
+ }, {
22583
+ key: "_dispatchEvent",
22584
+ value: function _dispatchEvent(event) {
22585
+ this._event(event);
22586
+ }
22587
+ /**
22588
+ * Enables all main event listenners.
22589
+ * @private
22590
+ */
22591
+
22592
+ }, {
22593
+ key: "_enableEventListenners",
22594
+ value: function _enableEventListenners() {
22595
+ var _this3 = this;
22596
+
22597
+ document.addEventListener('mouseup', function (_ref2) {
22598
+ var target = _ref2.target;
22599
+
22600
+ if (!_this3._multiselect.contains(target)) {
22601
+ _this3._filterOptions('');
22602
+
22603
+ _this3._closeList();
22604
+
22605
+ _this3._handlePlaceholder();
22606
+ }
22607
+ });
22608
+
22609
+ this._domElements.clear.addEventListener('click', function () {
22610
+ _this3._clearSelection();
22611
+ });
22612
+
22613
+ for (var i = 0; i < this._domElements.options.list.length; i++) {
22614
+ var option = this._domElements.options.list[i];
22615
+ option.addEventListener('click', function (_ref3) {
22616
+ var target = _ref3.target;
22617
+
22618
+ _this3._handleOption(target);
22619
+
22620
+ _this3._closeList();
22621
+ });
22622
+ }
22623
+
22624
+ this._domElements.input.addEventListener('focus', function () {
22625
+ _this3._domElements.optionsContainer.classList.add('visible');
22626
+
22627
+ _this3._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22628
+ });
22629
+
22630
+ this._domElements.input.addEventListener('input', function (_ref4) {
22631
+ var value = _ref4.target.value;
22632
+
22633
+ if (_this3._domElements.options.list.length > 0) {
22634
+ _this3._filterOptions(value);
22635
+ }
22636
+ });
22637
+
22638
+ this._domElements.input.addEventListener('keydown', function (e) {
22639
+ _this3._handleArrows(e);
22640
+
22641
+ _this3._handleBackspace(e);
22642
+
22643
+ _this3._handleEnter(e);
22644
+ });
22645
+ }
22646
+ /**
22647
+ * Filters user input.
22648
+ * @param { string } value
22649
+ * @private
22650
+ */
22651
+
22652
+ }, {
22653
+ key: "_filterOptions",
22654
+ value: function _filterOptions(value) {
22655
+ var _this4 = this;
22656
+
22657
+ var isOpen = this._domElements.optionsContainer.classList.contains('visible');
22658
+
22659
+ var valueLowerCase = value.toLowerCase();
22660
+
22661
+ if (!isOpen && value.length > 0) {
22662
+ this._domElements.optionsContainer.classList.add('visible');
22663
+
22664
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22665
+ }
22666
+
22667
+ if (this._domElements.options.list.length > 0) {
22668
+ for (var i = 0; i < this._domElements.options.list.length; i++) {
22669
+ var el = this._domElements.options.list[i];
22670
+ var text = this._itemTemplate ? this._data[i][this._textField] : el.textContent;
22671
+
22672
+ if (text.toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase) {
22673
+ this._domElements.optionsContainerList.appendChild(el);
22674
+ } else {
22675
+ el.parentNode && el.parentNode.removeChild(el);
22676
+ }
22677
+ }
22678
+
22679
+ var hasResults = this._domElements.options.some(function (el, index) {
22680
+ return (_this4._itemTemplate ? _this4._data[index][_this4._textField] : el.textContent).toLowerCase().substring(0, valueLowerCase.length) === valueLowerCase;
22681
+ });
22682
+
22683
+ this._showNoResults(!hasResults);
22684
+ }
22685
+ }
22686
+ }, {
22687
+ key: "_generateId",
22688
+ value: function _generateId(length) {
22689
+ var result = '';
22690
+ var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
22691
+ var charactersLength = characters.length;
22692
+
22693
+ for (var i = 0; i < length; i++) {
22694
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
22695
+ }
22696
+
22697
+ return result;
22698
+ }
22699
+ /**
22700
+ * Gets data from select tag.
22701
+ * @private
22702
+ */
22703
+
22704
+ }, {
22705
+ key: "_getDataFromSelectTag",
22706
+ value: function _getDataFromSelectTag() {
22707
+ var arr = [];
22708
+ var options = this._select.options;
22709
+
22710
+ for (var i = 0; i < options.length; i++) {
22711
+ var item = options[i];
22712
+ arr.push({
22713
+ text: item.text,
22714
+ value: item.value,
22715
+ selected: item.hasAttribute('selected')
22716
+ });
22717
+ }
22718
+
22719
+ return arr;
22720
+ }
22721
+ /**
22722
+ * Gets data from settings.
22723
+ * @private
22724
+ */
22725
+
22726
+ }, {
22727
+ key: "_getDataFromSettings",
22728
+ value: function _getDataFromSettings() {
22729
+ if (this._data.length > 0 && this._valueField && this._textField) {
22730
+ var isValueFieldValid = typeof this._valueField === 'string';
22731
+ var isTextFieldValid = typeof this._textField === 'string';
22732
+ var arr = [];
22733
+
22734
+ if (!isValueFieldValid || !isTextFieldValid) {
22735
+ throw new Error('textField and valueField must be of type string');
22736
+ }
22737
+
22738
+ for (var i = 0; i < this._data.length; i++) {
22739
+ var item = this._data[i];
22740
+ arr.push({
22741
+ value: item[this._valueField],
22742
+ text: item[this._textField],
22743
+ selected: typeof item.selected === 'boolean' ? item.selected : false
22744
+ });
22745
+ }
22746
+
22747
+ return arr;
22748
+ } else {
22749
+ return null;
22750
+ }
22751
+ }
22752
+ /**
22753
+ * Handles Arrow up & Down. Selection of an option is also possible with these keys.
22754
+ * @param { Event } event
22755
+ * @private
22756
+ */
22757
+
22758
+ }, {
22759
+ key: "_handleArrows",
22760
+ value: function _handleArrows(event) {
22761
+ if (event.keyCode === 40 || event.keyCode === 38) {
22762
+ event.preventDefault();
22763
+
22764
+ var isOpen = this._domElements.optionsContainer.classList.contains('visible'); // An updated view of the container is needed because of the filtering option
22765
+
22766
+
22767
+ var optionsContainerList = this._multiselect.querySelector('.multiselect__options > ul');
22768
+
22769
+ if (!isOpen) {
22770
+ this._domElements.optionsContainer.classList.add('visible');
22771
+
22772
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options_visible);
22773
+
22774
+ optionsContainerList.firstElementChild.classList.add('arrow-selected');
22775
+ optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22776
+ optionsContainerList.firstElementChild.scrollIntoView(false);
22777
+ } else {
22778
+ var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
22779
+
22780
+ var action = {
22781
+ ArrowUp: 'previous',
22782
+ Up: 'previous',
22783
+ ArrowDown: 'next',
22784
+ Down: 'next'
22785
+ };
22786
+
22787
+ if (!selected) {
22788
+ optionsContainerList.firstElementChild.classList.add('arrow-selected');
22789
+ optionsContainerList.firstElementChild.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22790
+ optionsContainerList.firstElementChild.scrollIntoView(false);
22791
+ return;
22792
+ }
22793
+
22794
+ selected.classList.remove('arrow-selected');
22795
+ selected.setAttribute('style', style.multiselect__options_ul_li);
22796
+ selected = selected[action[event.key] + 'ElementSibling']; // Go to start or end of the popup list
22797
+
22798
+ if (!selected) {
22799
+ selected = optionsContainerList.children[action[event.key] === 'next' ? 0 : optionsContainerList.children.length - 1];
22800
+ selected.classList.add('arrow-selected');
22801
+ selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22802
+
22803
+ this._scrollIntoView(optionsContainerList, selected);
22804
+
22805
+ return;
22806
+ }
22807
+
22808
+ selected.classList.add('arrow-selected');
22809
+ selected.setAttribute('style', style.multiselect__options_ul_li_arrow_selected);
22810
+
22811
+ this._scrollIntoView(optionsContainerList, selected);
22812
+ }
22813
+ }
22814
+ }
22815
+ /**
22816
+ * Handles the backspace key event - Deletes the preceding option in the selection list.
22817
+ * @param { Event } e
22818
+ * @private
22819
+ */
22820
+
22821
+ }, {
22822
+ key: "_handleBackspace",
22823
+ value: function _handleBackspace(e) {
22824
+ if (e.keyCode === 8 && e.target.value === '') {
22825
+ var lastSelectedOption = this._selectedOptions.length > 0 ? this._selectedOptions[this._selectedOptions.length - 1] : null;
22826
+
22827
+ if (lastSelectedOption) {
22828
+ var targetLastSelectedOption = this._multiselect.querySelector("li[data-value=\"".concat(lastSelectedOption.value, "\"]"));
22829
+
22830
+ this._handleOption(targetLastSelectedOption);
22831
+
22832
+ if (this._selectedOptions.length === 0) {
22833
+ this._domElements.optionsContainer.classList.remove('visible');
22834
+
22835
+ this._domElements.optionsContainer.setAttribute('style', style.multiselect__options);
22836
+ }
22837
+ }
22838
+ }
22839
+ }
22840
+ /**
22841
+ * Shows clear selection button if some options are selected.
22842
+ * @private
22843
+ */
22844
+
22845
+ }, {
22846
+ key: "_handleClearSelectionBtn",
22847
+ value: function _handleClearSelectionBtn() {
22848
+ if (this._selectedOptions.length > 0) {
22849
+ this._domElements.clear.style.display = 'flex';
22850
+ } else {
22851
+ this._domElements.clear.style.display = 'none';
22852
+ }
22853
+ }
22854
+ /**
22855
+ * Handles the enter key event.
22856
+ * @param { Event } event
22857
+ * @private
22858
+ */
22859
+
22860
+ }, {
22861
+ key: "_handleEnter",
22862
+ value: function _handleEnter(event) {
22863
+ if (event.keyCode === 13) {
22864
+ var selected = this._multiselect.querySelector('.multiselect__options ul li.arrow-selected');
22865
+
22866
+ if (selected) {
22867
+ this._handleOption(selected);
22868
+
22869
+ this._closeList();
22870
+ }
22871
+ }
22872
+ }
22873
+ }, {
22874
+ key: "_handleOption",
22875
+ value: function _handleOption(target) {
22876
+ var dispatchEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
22877
+
22878
+ // Remove
22879
+ for (var i = 0; i < this._selectedOptions.length; i++) {
22880
+ var el = this._selectedOptions[i];
22881
+
22882
+ if (el.value === target.dataset.value) {
22883
+ target.classList.remove('multiselect__options--selected');
22884
+ target.setAttribute('style', style.multiselect__options);
22885
+
22886
+ this._selectedOptions.splice(i, 1);
22887
+
22888
+ this._removeOptionFromList(target.dataset.value);
22889
+
22890
+ this._handleClearSelectionBtn();
22891
+
22892
+ this._handlePlaceholder();
22893
+
22894
+ return dispatchEvent && this._dispatchEvent({
22895
+ action: 'REMOVE_OPTION',
22896
+ value: target.dataset.value,
22897
+ selection: this._selectedOptions
22898
+ });
22899
+ }
22900
+ } // Add
22901
+
22902
+
22903
+ for (var _i = 0; _i < this._options.length; _i++) {
22904
+ var option = this._options[_i];
22905
+
22906
+ if (option.value === target.dataset.value) {
22907
+ target.classList.add('multiselect__options--selected');
22908
+ target.setAttribute('style', style.multiselect__options_selected);
22909
+ this._selectedOptions = [].concat((0, _toConsumableArray2["default"])(this._selectedOptions), [option]);
22910
+
22911
+ this._addOptionToList(option, _i);
22912
+
22913
+ this._handleClearSelectionBtn();
22914
+
22915
+ this._handlePlaceholder();
22916
+
22917
+ return dispatchEvent && this._dispatchEvent({
22918
+ action: 'ADD_OPTION',
22919
+ value: target.dataset.value,
22920
+ selection: this._selectedOptions
22921
+ });
22922
+ }
22923
+ }
22924
+ }
22925
+ /**
22926
+ * Shows the placeholder if no options are selected.
22927
+ * @private
22928
+ */
22929
+
22930
+ }, {
22931
+ key: "_handlePlaceholder",
22932
+ value: function _handlePlaceholder() {
22933
+ this._domElements.input.placeholder = this._placeholder;
22934
+ }
22935
+ }, {
22936
+ key: "_initSelectedList",
22937
+ value: function _initSelectedList() {
22938
+ var _this5 = this;
22939
+
22940
+ var hasItemsSelected = false;
22941
+
22942
+ var _loop2 = function _loop2(i) {
22943
+ var option = _this5._options[i];
22944
+
22945
+ if (option.selected) {
22946
+ hasItemsSelected = true;
22947
+
22948
+ var target = _this5._domElements.options.find(function (el) {
22949
+ return el.dataset.value === option.value;
22950
+ });
22951
+
22952
+ target.classList.add('multiselect__options--selected');
22953
+ target.setAttribute('style', style.multiselect__options_selected);
22954
+ _this5._selectedOptions = [].concat((0, _toConsumableArray2["default"])(_this5._selectedOptions), [option]);
22955
+
22956
+ _this5._addOptionToList(option, i);
22957
+ }
22958
+ };
22959
+
22960
+ for (var i = 0; i < this._options.length; i++) {
22961
+ _loop2(i);
22962
+ }
22963
+
22964
+ if (hasItemsSelected) {
22965
+ this._handleClearSelectionBtn();
22966
+ }
22967
+
22968
+ this._handlePlaceholder();
22969
+ }
22970
+ /**
22971
+ * Process the custom template.
22972
+ * @param { string } template
22973
+ * @private
22974
+ */
22975
+
22976
+ }, {
22977
+ key: "_processTemplate",
22978
+ value: function _processTemplate(template, index) {
22979
+ var processedTemplate = template;
22980
+ var objAttr = template.match(/\$\{(\w+)\}/g).map(function (e) {
22981
+ return e.replace(/\$\{|\}/g, '');
22982
+ });
22983
+
22984
+ for (var i = 0; i < objAttr.length; i++) {
22985
+ var _this$_data$index$att;
22986
+
22987
+ var attr = objAttr[i]; // eslint-disable-next-line no-useless-escape
22988
+
22989
+ processedTemplate = processedTemplate.replace("${".concat(attr, "}"), (_this$_data$index$att = this._data[index][attr]) !== null && _this$_data$index$att !== void 0 ? _this$_data$index$att : '');
22990
+ }
22991
+
22992
+ return processedTemplate;
22993
+ }
22994
+ }, {
22995
+ key: "_removeAllArrowSelected",
22996
+ value: function _removeAllArrowSelected() {
22997
+ var className = 'arrow-selected';
22998
+
22999
+ var target = this._domElements.options.find(function (el) {
23000
+ return el.classList.contains(className);
23001
+ });
23002
+
23003
+ target && target.classList.remove(className) && target.setAttribute('style', style.multiselect__options_ul_li);
23004
+ }
23005
+ /**
23006
+ * Removes an option from the list.
23007
+ * @param { string } value
23008
+ * @private
23009
+ */
23010
+
23011
+ }, {
23012
+ key: "_removeOptionFromList",
23013
+ value: function _removeOptionFromList(value) {
23014
+ var optionDom = this._multiselect.querySelector("span[data-value=\"".concat(value, "\"]"));
23015
+
23016
+ optionDom && optionDom.parentNode && optionDom.parentNode.removeChild(optionDom);
23017
+ }
23018
+ /**
23019
+ * Renders the multiselect options list view.
23020
+ * @private
23021
+ */
23022
+
23023
+ }, {
23024
+ key: "_renderOptionsList",
23025
+ value: function _renderOptionsList() {
23026
+ var _this6 = this;
23027
+
23028
+ var html = "\n <div class=\"multiselect__options\" style=\"".concat(style.multiselect__options, "\">\n <ul style=\"").concat(style.multiselect__options_ul, "\">\n ").concat(this._options.length > 0 && !this._itemTemplate ? this._options.map(function (option) {
23029
+ return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(option.text, "</li>\n ");
23030
+ }).join('') : '', "\n\n ").concat(this._options.length > 0 && this._itemTemplate ? this._options.map(function (option, index) {
23031
+ return "\n <li data-value=\"".concat(option.value, "\" style=\"").concat(style.multiselect__options_ul_li, "\">").concat(_this6._processTemplate(_this6._itemTemplate, index), "</li>\n ");
23032
+ }).join('') : '', "\n ").concat(this._showNoData(this._options.length === 0), "\n </ul>\n </div>\n ");
23033
+
23034
+ this._multiselect.insertAdjacentHTML('beforeend', html);
23035
+ }
23036
+ /**
23037
+ * Renders the multiselect view.
23038
+ * @private
23039
+ */
23040
+
23041
+ }, {
23042
+ key: "_renderMultiselect",
23043
+ value: function _renderMultiselect() {
23044
+ this._select.style.display = 'none';
23045
+
23046
+ var id = 'iconic-' + this._generateId(20); // Timea created dedicated div element because previous code was not rendering
23047
+
23048
+
23049
+ this._multiselect = document.createElement('div');
23050
+
23051
+ this._multiselect.setAttribute('id', id);
23052
+
23053
+ this._multiselect.setAttribute('class', 'multiselect__container');
23054
+
23055
+ this._multiselect.setAttribute('style', style.multiselect__container);
23056
+
23057
+ var html = "\n <div class=\"multiselect__wrapper\" style=\"".concat(style.multiselect__wrapper, "\">\n <input class=\"multiselect__input\" style=\"").concat(style.multiselect__input, "\" placeholder=\"").concat(this._placeholder, "\" />\n </div>\n <span style=\"display: none;\" class=\"multiselect__clear-btn\" style=\"").concat(style.multiselect__clear_btn, "\">").concat(this._cross, "</span>\n ");
23058
+ this._multiselect.innerHTML = html;
23059
+
23060
+ this._selectContainer.appendChild(this._multiselect);
23061
+ }
23062
+ /**
23063
+ * ScrollIntoView - This small utility reproduces the behavior of .scrollIntoView({ block: "nearest", inline: "nearest" })
23064
+ * This is for IE compatibility without a need of a polyfill
23065
+ * @private
23066
+ */
23067
+
23068
+ }, {
23069
+ key: "_scrollIntoView",
23070
+ value: function _scrollIntoView(parent, child) {
23071
+ var rectParent = parent.getBoundingClientRect();
23072
+ var rectChild = child.getBoundingClientRect(); // Detect if not visible at top and then scroll to the top
23073
+
23074
+ if (!(rectParent.top < rectChild.bottom - child.offsetHeight)) {
23075
+ parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight);
23076
+ } // Detect if not visible at bottom and then scroll to the bottom
23077
+
23078
+
23079
+ if (!(rectParent.bottom > rectChild.top + child.offsetHeight)) {
23080
+ parent.scrollTop = child.clientHeight + (child.offsetTop - child.offsetHeight) - (parent.offsetHeight - (child.offsetHeight + (child.offsetHeight - child.clientHeight)));
23081
+ }
23082
+ }
23083
+ /**
23084
+ * Shows a no data message.
23085
+ * @param { boolean } condition
23086
+ * @private
23087
+ */
23088
+
23089
+ }, {
23090
+ key: "_showNoData",
23091
+ value: function _showNoData(condition) {
23092
+ return condition ? "<p class=\"multiselect__options--no-data\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_data, "\">").concat(this._noData, "</p>") : '';
23093
+ }
23094
+ /**
23095
+ * Shows a no results message.
23096
+ * @param { boolean } condition
23097
+ * @private
23098
+ */
23099
+
23100
+ }, {
23101
+ key: "_showNoResults",
23102
+ value: function _showNoResults(condition) {
23103
+ var dom = this._multiselect.querySelector('.multiselect__options--no-results');
23104
+
23105
+ if (condition) {
23106
+ var html = "<p class=\"multiselect__options--no-results\" style=\"".concat(style.multiselect__options_ul_p_multiselect__options_no_results, "\">").concat(this._noResults, "</p>");
23107
+ !dom && this._domElements.optionsContainerList.insertAdjacentHTML('beforeend', html);
23108
+ } else {
23109
+ dom && dom.parentNode && dom.parentNode.removeChild(dom);
23110
+ }
23111
+ }
23112
+ }]);
23113
+ return IconicMultiSelect;
23114
+ }();
23115
+
23116
+ exports.IconicMultiSelect = IconicMultiSelect;
23117
+ //# sourceMappingURL=multiSelect.js.map
23118
+
23119
+ /***/ }),
23120
+
23121
+ /***/ "./lib/widgets/peoplePicker.js":
23122
+ /*!*************************************!*\
23123
+ !*** ./lib/widgets/peoplePicker.js ***!
23124
+ \*************************************/
23125
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
23126
+
23127
+ "use strict";
23128
+
23129
+
23130
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
23131
+
23132
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
23133
+
23134
+ Object.defineProperty(exports, "__esModule", ({
23135
+ value: true
23136
+ }));
23137
+ exports.Person = exports.PeoplePicker = exports.GroupPicker = exports.GroupBuilder = exports.Group = void 0;
23138
+
23139
+ var _taggedTemplateLiteral2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteral */ "./node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js"));
23140
+
23141
+ var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
23142
+
23143
+ var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
23144
+
23145
+ var _escapeHtml = _interopRequireDefault(__webpack_require__(/*! escape-html */ "./node_modules/escape-html/index.js"));
23146
+
23147
+ var _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/index.js"));
23148
+
23149
+ var rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
23150
+
23151
+ var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
23152
+
23153
+ var _dragAndDrop = __webpack_require__(/*! ./dragAndDrop */ "./lib/widgets/dragAndDrop.js");
23154
+
23155
+ var _error = __webpack_require__(/*! ./error */ "./lib/widgets/error.js");
23156
+
23157
+ var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
23158
+
23159
+ var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
23160
+
23161
+ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
23162
+
23163
+ var _templateObject;
23164
+
23165
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23166
+
23167
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23168
+
23169
+ var kb = _solidLogic.solidLogicSingleton.store;
23170
+
23171
+ var PeoplePicker = /*#__PURE__*/function () {
23172
+ function PeoplePicker(element, typeIndex, groupPickedCb, options) {
23173
+ (0, _classCallCheck2["default"])(this, PeoplePicker);
23174
+ // @@ can't expect typeindex to be passed
23175
+ this.options = options || {};
23176
+ this.element = element;
23177
+ this.typeIndex = typeIndex;
23178
+ this.groupPickedCb = groupPickedCb;
23179
+ this.selectedgroup = this.options.selectedgroup; // current selected group if any
23180
+
23181
+ this.onSelectGroup = this.onSelectGroup.bind(this);
23182
+ }
23183
+
23184
+ (0, _createClass2["default"])(PeoplePicker, [{
23185
+ key: "render",
23186
+ value: function render() {
23187
+ var _this = this;
23188
+
23189
+ var container = document.createElement('div');
23190
+ container.style.maxWidth = '350px';
23191
+ container.style.minHeight = '200px';
23192
+ container.style.outline = '1px solid black';
23193
+ container.style.display = 'flex';
23194
+
23195
+ if (this.selectedgroup) {
23196
+ container.style.flexDirection = 'column';
23197
+ var selectedGroup = document.createElement('div');
23198
+ new Group(selectedGroup, this.selectedgroup).render();
23199
+ var changeGroupButton = document.createElement('button');
23200
+ changeGroupButton.textContent = (0, _escapeHtml["default"])('Change group');
23201
+ changeGroupButton.addEventListener('click', function (_event) {
23202
+ _this.selectedgroup = null;
23203
+
23204
+ _this.render();
22080
23205
  });
22081
23206
  container.appendChild(selectedGroup);
22082
23207
  container.appendChild(changeGroupButton);
@@ -22664,6 +23789,22 @@ module.exports = _arrayWithHoles, module.exports.__esModule = true, module.expor
22664
23789
 
22665
23790
  /***/ }),
22666
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
+
22667
23808
  /***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
22668
23809
  /*!**********************************************************************!*\
22669
23810
  !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
@@ -22929,6 +24070,20 @@ module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, mo
22929
24070
 
22930
24071
  /***/ }),
22931
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
+
22932
24087
  /***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
22933
24088
  /*!*********************************************************************!*\
22934
24089
  !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
@@ -22983,6 +24138,20 @@ module.exports = _nonIterableRest, module.exports.__esModule = true, module.expo
22983
24138
 
22984
24139
  /***/ }),
22985
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
+
22986
24155
  /***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
22987
24156
  /*!**************************************************************************!*\
22988
24157
  !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
@@ -23069,6 +24238,28 @@ module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, modul
23069
24238
 
23070
24239
  /***/ }),
23071
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
+
23072
24263
  /***/ "./node_modules/@babel/runtime/helpers/typeof.js":
23073
24264
  /*!*******************************************************!*\
23074
24265
  !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!