solid-ui 2.4.22-3cf5d0a6 → 2.4.22-3e0d1a42

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
@@ -15192,8 +15192,8 @@ Object.defineProperty(exports, "__esModule", ({
15192
15192
  }));
15193
15193
  exports.versionInfo = void 0;
15194
15194
  var versionInfo = {
15195
- buildTime: '2022-05-09T14:00:08Z',
15196
- commit: '3cf5d0a69738775a31b3b4f67fa6a846e5829bb7',
15195
+ buildTime: '2022-05-10T17:01:23Z',
15196
+ commit: '3e0d1a42e042cb5542cbc183d7ae53eec6498254',
15197
15197
  npmInfo: {
15198
15198
  'solid-ui': '2.4.22',
15199
15199
  npm: '6.14.16',
@@ -17694,7 +17694,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17694
17694
  // delete button and move buttons
17695
17695
 
17696
17696
  if (kb.updater.editable(dataDoc.uri)) {
17697
- buttons.deleteButtonWithCheck(dom, subField, utils.label(property), deleteThisItem);
17697
+ buttons.deleteButtonWithCheck(dom, subField, multipleUIlabel, deleteThisItem);
17698
17698
 
17699
17699
  if (ordered) {
17700
17700
  // Add controsl in a frame
@@ -17745,7 +17745,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17745
17745
 
17746
17746
  var _shim = dom.createElement('div');
17747
17747
 
17748
- _shim.appendChild(subField); // Subfield has its own laytout
17748
+ _shim.appendChild(subField); // Subfield has its own layout
17749
17749
 
17750
17750
 
17751
17751
  frame.appendChild(_shim);
@@ -17794,6 +17794,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17794
17794
  return shim;
17795
17795
  }
17796
17796
 
17797
+ var multipleUIlabel = kb.any(form, ui('label'));
17798
+ if (!multipleUIlabel) multipleUIlabel = utils.label(property, true); // Init capital
17799
+
17797
17800
  var min = kb.any(form, ui('min')); // This is the minimum number -- default 0
17798
17801
 
17799
17802
  min = min ? 0 + min.value : 0;
@@ -17834,10 +17837,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17834
17837
  img.setAttribute('src', plusIconURI); // plus sign
17835
17838
 
17836
17839
  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
-
17840
+ img.title = 'Click to add another ' + multipleUIlabel;
17841
+ var prompt = dom.createElement('span');
17842
+ prompt.textContent = (values.length === 0 ? 'Add another ' : 'Add ') + multipleUIlabel;
17841
17843
  tail.addEventListener('click', /*#__PURE__*/function () {
17842
17844
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_eventNotUsed) {
17843
17845
  return _regenerator["default"].wrap(function _callee5$(_context5) {
@@ -17859,6 +17861,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17859
17861
  return _ref3.apply(this, arguments);
17860
17862
  };
17861
17863
  }(), true);
17864
+ tail.appendChild(prompt);
17862
17865
  }
17863
17866
 
17864
17867
  function createListIfNecessary() {
@@ -18133,16 +18136,17 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
18133
18136
  ** -- radio buttons
18134
18137
  ** -- auto-complete typing
18135
18138
  **
18136
- ** Todo: Deal with multiple. Maybe merge with multiple code.
18137
18139
  */
18138
18140
 
18139
18141
 
18140
18142
  _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, subject, form, dataDoc, callbackFunction) {
18141
18143
  var ui = ns.ui;
18142
18144
  var kb = _solidLogic.store;
18143
- var multiple = false;
18144
18145
  var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
18145
18146
 
18147
+ var uiMultipleInUse = false; // this signals to ui:choice that it is part of a ui:multiple
18148
+
18149
+ var multiSelect = false;
18146
18150
  var p;
18147
18151
  var box = dom.createElement('div');
18148
18152
  box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
@@ -18173,12 +18177,20 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18173
18177
 
18174
18178
  var possible = [];
18175
18179
  var possibleProperties;
18176
- var firstSelectOptionText = '* Select from ' + utils.label(subject, true) + ' *';
18180
+ var firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *'; // if we do NOT have a container it means it is a ui:Multiple
18181
+ // only important for the first option text in select
18182
+
18183
+ if (!container) {
18184
+ uiMultipleInUse = true;
18185
+ firstSelectOptionText = utils.label(subject, true);
18186
+ }
18187
+
18177
18188
  var opts = {
18178
18189
  form: form,
18179
18190
  subForm: subForm,
18180
- multiple: multiple,
18191
+ multiSelect: multiSelect,
18181
18192
  firstSelectOptionText: firstSelectOptionText,
18193
+ uiMultipleInUse: uiMultipleInUse,
18182
18194
  disambiguate: false
18183
18195
  };
18184
18196
  possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
@@ -18223,7 +18235,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18223
18235
  opts.disambiguate = true;
18224
18236
  }
18225
18237
 
18226
- var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurance regardles if it is set to true or false
18238
+ var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurrence, regardless of true or false setting
18227
18239
 
18228
18240
  if (kb.any(form, ui('canMintNew'))) {
18229
18241
  opts.mint = '* Create new *'; // @@ could be better
@@ -18599,9 +18611,10 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
18599
18611
  // @param subject - a term, the subject of the statement(s) being edited.
18600
18612
  // @param predicate - a term, the predicate of the statement(s) being edited
18601
18613
  // @param possible - a list of terms, the possible value the object can take
18602
- // @param options.multiple - Boolean - Whether more than one at a time is allowed
18614
+ // @param options.multiSelect - Boolean - Whether more than one at a time is allowed
18603
18615
  // @param options.firstSelectOptionText - a string to be displayed as the
18604
- // option for none selected (for non multiple)
18616
+ // option for none selected (for non multiSelect)
18617
+ // @param options.uiMultipleInUse - signals that the ui:choise is used with a ui:multiple
18605
18618
  // @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
18606
18619
  // @param options.subForm - If mint, then the form to be used for minting the new thing
18607
18620
  // @param dataDoc - The web document being edited
@@ -18739,7 +18752,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18739
18752
 
18740
18753
  var select = dom.createElement('select');
18741
18754
  select.setAttribute('style', style.formSelectSTyle);
18742
- if (options.multiple) select.setAttribute('multiple', 'true');
18755
+ if (options.multiSelect) select.setAttribute('multiSelect', 'true');
18743
18756
  select.currentURI = null;
18744
18757
 
18745
18758
  select.refresh = function () {
@@ -18790,7 +18803,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18790
18803
  select.insertBefore(mint, select.firstChild);
18791
18804
  }
18792
18805
 
18793
- if (!select.currentURI && !options.multiple) {
18806
+ if (!select.currentURI && options.uiMultipleInUse) {
18794
18807
  var prompt = dom.createElement('option');
18795
18808
  prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
18796
18809
  prompt.disabled = true;
@@ -18816,11 +18829,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
18816
18829
  function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
18817
18830
  var du = kb.any(category, ns.owl('disjointUnionOf'));
18818
18831
  var subs;
18819
- var multiple = false;
18832
+ var multiSelect = false;
18820
18833
 
18821
18834
  if (!du) {
18822
18835
  subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
18823
- multiple = true;
18836
+ multiSelect = true;
18824
18837
  } else {
18825
18838
  subs = du.elements;
18826
18839
  }
@@ -18828,15 +18841,15 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
18828
18841
  log.debug('Select list length ' + subs.length);
18829
18842
 
18830
18843
  if (subs.length === 0) {
18831
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
18844
+ return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
18832
18845
  }
18833
18846
 
18834
18847
  if (subs.length === 1) {
18835
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
18848
+ return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
18836
18849
  }
18837
18850
 
18838
18851
  return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
18839
- multiple: multiple
18852
+ multiSelect: multiSelect
18840
18853
  }, dataDoc, callbackFunction);
18841
18854
  }
18842
18855
  /** Make SELECT element to select subclasses recurively