solid-ui 2.4.22-8f207a1d → 2.4.22-b44c9cf2

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.
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.versionInfo = void 0;
7
7
  var versionInfo = {
8
- buildTime: '2022-04-14T16:39:29Z',
9
- commit: '8f207a1dbaad449bbc4b82e43887dcf3d5499424',
8
+ buildTime: '2022-05-06T08:22:55Z',
9
+ commit: 'b44c9cf2e68393ba76311294f65964fdb45d2dd9',
10
10
  npmInfo: {
11
11
  'solid-ui': '2.4.22',
12
12
  npm: '6.14.16',
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/versionInfo.ts"],"names":["versionInfo","buildTime","commit","npmInfo","npm","ares","brotli","cldr","icu","llhttp","modules","napi","nghttp2","node","openssl","tz","unicode","uv","v8","zlib"],"mappings":";;;;;;AAAO,IAAMA,WAAW,GAAG;AACzBC,EAAAA,SAAS,EAAE,sBADc;AAEzBC,EAAAA,MAAM,EAAE,0CAFiB;AAGzBC,EAAAA,OAAO,EACT;AACE,gBAAY,QADd;AAEEC,IAAAA,GAAG,EAAE,SAFP;AAGEC,IAAAA,IAAI,EAAE,QAHR;AAIEC,IAAAA,MAAM,EAAE,OAJV;AAKEC,IAAAA,IAAI,EAAE,MALR;AAMEC,IAAAA,GAAG,EAAE,MANP;AAOEC,IAAAA,MAAM,EAAE,OAPV;AAQEC,IAAAA,OAAO,EAAE,IARX;AASEC,IAAAA,IAAI,EAAE,GATR;AAUEC,IAAAA,OAAO,EAAE,QAVX;AAWEC,IAAAA,IAAI,EAAE,SAXR;AAYEC,IAAAA,OAAO,EAAE,QAZX;AAaEC,IAAAA,EAAE,EAAE,QAbN;AAcEC,IAAAA,OAAO,EAAE,MAdX;AAeEC,IAAAA,EAAE,EAAE,QAfN;AAgBEC,IAAAA,EAAE,EAAE,oBAhBN;AAiBEC,IAAAA,IAAI,EAAE;AAjBR;AAJ2B,CAApB","sourcesContent":["export const versionInfo = {\n buildTime: '2022-04-14T16:39:29Z',\n commit: '8f207a1dbaad449bbc4b82e43887dcf3d5499424',\n npmInfo:\n{\n 'solid-ui': '2.4.22',\n npm: '6.14.16',\n ares: '1.18.1',\n brotli: '1.0.9',\n cldr: '40.0',\n icu: '70.1',\n llhttp: '2.1.4',\n modules: '83',\n napi: '8',\n nghttp2: '1.42.0',\n node: '14.19.1',\n openssl: '1.1.1n',\n tz: '2021a3',\n unicode: '14.0',\n uv: '1.42.0',\n v8: '8.4.371.23-node.85',\n zlib: '1.2.11'\n}\n}\n"],"file":"versionInfo.js"}
1
+ {"version":3,"sources":["../src/versionInfo.ts"],"names":["versionInfo","buildTime","commit","npmInfo","npm","ares","brotli","cldr","icu","llhttp","modules","napi","nghttp2","node","openssl","tz","unicode","uv","v8","zlib"],"mappings":";;;;;;AAAO,IAAMA,WAAW,GAAG;AACzBC,EAAAA,SAAS,EAAE,sBADc;AAEzBC,EAAAA,MAAM,EAAE,0CAFiB;AAGzBC,EAAAA,OAAO,EACT;AACE,gBAAY,QADd;AAEEC,IAAAA,GAAG,EAAE,SAFP;AAGEC,IAAAA,IAAI,EAAE,QAHR;AAIEC,IAAAA,MAAM,EAAE,OAJV;AAKEC,IAAAA,IAAI,EAAE,MALR;AAMEC,IAAAA,GAAG,EAAE,MANP;AAOEC,IAAAA,MAAM,EAAE,OAPV;AAQEC,IAAAA,OAAO,EAAE,IARX;AASEC,IAAAA,IAAI,EAAE,GATR;AAUEC,IAAAA,OAAO,EAAE,QAVX;AAWEC,IAAAA,IAAI,EAAE,SAXR;AAYEC,IAAAA,OAAO,EAAE,QAZX;AAaEC,IAAAA,EAAE,EAAE,QAbN;AAcEC,IAAAA,OAAO,EAAE,MAdX;AAeEC,IAAAA,EAAE,EAAE,QAfN;AAgBEC,IAAAA,EAAE,EAAE,oBAhBN;AAiBEC,IAAAA,IAAI,EAAE;AAjBR;AAJ2B,CAApB","sourcesContent":["export const versionInfo = {\n buildTime: '2022-05-06T08:22:55Z',\n commit: 'b44c9cf2e68393ba76311294f65964fdb45d2dd9',\n npmInfo:\n{\n 'solid-ui': '2.4.22',\n npm: '6.14.16',\n ares: '1.18.1',\n brotli: '1.0.9',\n cldr: '40.0',\n icu: '70.1',\n llhttp: '2.1.4',\n modules: '83',\n napi: '8',\n nghttp2: '1.42.0',\n node: '14.19.1',\n openssl: '1.1.1n',\n tz: '2021a3',\n unicode: '14.0',\n uv: '1.42.0',\n v8: '8.4.371.23-node.85',\n zlib: '1.2.11'\n}\n}\n"],"file":"versionInfo.js"}
@@ -1017,6 +1017,14 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
1017
1017
  **
1018
1018
  ** Not nested. Generates a link to something from a given class.
1019
1019
  ** Optional subform for the thing selected.
1020
+ ** Generates a subForm based on a ui:use form
1021
+ ** Will look like:
1022
+ ** <div id=dropDownDiv>
1023
+ ** <div id=labelOfDropDown>
1024
+ ** <div id=selectDiv>
1025
+ ** <select id=dropDownSelect>
1026
+ ** <option> ....
1027
+ ** <subForm>
1020
1028
  ** Alternative implementatons caould be:
1021
1029
  ** -- pop-up menu (as here)
1022
1030
  ** -- radio buttons
@@ -1059,11 +1067,12 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
1059
1067
 
1060
1068
  var possible = [];
1061
1069
  var possibleProperties;
1062
- var nullLabel = '--' + utils.label(property) + '-?';
1070
+ var firstSelectOptionText = '* Select from ' + utils.label(subject, true) + ' *';
1063
1071
  var opts = {
1064
1072
  form: form,
1073
+ subForm: subForm,
1065
1074
  multiple: multiple,
1066
- nullLabel: nullLabel,
1075
+ firstSelectOptionText: firstSelectOptionText,
1067
1076
  disambiguate: false
1068
1077
  };
1069
1078
  possible = kb.each(undefined, ns.rdf('type'), from, formDoc);
@@ -1108,26 +1117,45 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
1108
1117
  opts.disambiguate = true;
1109
1118
  }
1110
1119
 
1111
- var object = kb.any(subject, property);
1120
+ var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurance regardles if it is set to true or false
1112
1121
 
1113
- function addSubForm() {
1114
- object = kb.any(subject, property);
1115
- (0, _fieldFunction.fieldFunction)(dom, subForm)(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
1122
+ if (kb.any(form, ui('canMintNew'))) {
1123
+ opts.mint = '* Create new *'; // @@ could be better
1116
1124
  }
1117
1125
 
1118
- var possible2 = sortByLabel(possible);
1126
+ var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, opts, dataDoc, callbackFunction);
1127
+ rhs.appendChild(selector);
1128
+ var object;
1119
1129
 
1120
- if (kb.any(form, ui('canMintNew'))) {
1121
- opts.mint = '* New *'; // @@ could be better
1130
+ if (selector.currentURI) {
1131
+ object = $rdf.sym(selector.currentURI);
1132
+ } else {
1133
+ object = kb.any(subject, property);
1134
+ }
1122
1135
 
1123
- opts.subForm = subForm;
1136
+ if (object && subForm) {
1137
+ removeNextSiblingsAfterElement(selector);
1138
+ addSubFormDropDown(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
1124
1139
  }
1125
1140
 
1126
- var selector = makeSelectForOptions(dom, kb, subject, property, possible2, opts, dataDoc, callbackFunction);
1127
- rhs.appendChild(selector);
1128
- if (object && subForm) addSubForm();
1129
1141
  return box;
1130
- }; // Documentation - non-interactive fields
1142
+ };
1143
+ /**
1144
+ * Removes all sibling elements after specified
1145
+ * @param {HTMLElement} currentElement
1146
+ * @private
1147
+ */
1148
+
1149
+
1150
+ function removeNextSiblingsAfterElement(currentElement) {
1151
+ while (currentElement.nextElementSibling) {
1152
+ currentElement.nextElementSibling.remove();
1153
+ }
1154
+ }
1155
+
1156
+ function addSubFormDropDown(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
1157
+ (0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
1158
+ } // Documentation - non-interactive fields
1131
1159
  //
1132
1160
 
1133
1161
 
@@ -1466,7 +1494,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
1466
1494
  // @param predicate - a term, the predicate of the statement(s) being edited
1467
1495
  // @param possible - a list of terms, the possible value the object can take
1468
1496
  // @param options.multiple - Boolean - Whether more than one at a time is allowed
1469
- // @param options.nullLabel - a string to be displayed as the
1497
+ // @param options.firstSelectOptionText - a string to be displayed as the
1470
1498
  // option for none selected (for non multiple)
1471
1499
  // @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
1472
1500
  // @param options.subForm - If mint, then the form to be used for minting the new thing
@@ -1506,7 +1534,9 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1506
1534
  actual = kb.findTypeURIs(subject);
1507
1535
  } else {
1508
1536
  kb.each(subject, predicate, null, dataDoc).forEach(function (x) {
1509
- actual[x.uri] = true;
1537
+ if (x.uri) {
1538
+ actual[x.uri] = true;
1539
+ }
1510
1540
  });
1511
1541
  }
1512
1542
 
@@ -1533,25 +1563,9 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1533
1563
  var opt = select.options[_i];
1534
1564
 
1535
1565
  if (opt.selected && opt.AJAR_mint) {
1536
- if (options.mintClass) {
1537
- var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
1538
- if (!ok) {
1539
- callbackFunction(ok, body, {
1540
- change: 'new'
1541
- }); // @@ if ok, need some form of refresh of the select for the new thing
1542
- }
1543
- });
1544
- select.parentNode.appendChild(thisForm);
1545
- newObject = thisForm.AJAR_subject;
1546
- } else {
1547
- newObject = newThing(dataDoc);
1548
- }
1549
-
1550
- is.push($rdf.st(subject, predicate, newObject, dataDoc));
1551
-
1552
- if (options.mintStatementsFun) {
1553
- is = is.concat(options.mintStatementsFun(newObject));
1554
- }
1566
+ newObject = newThing(dataDoc);
1567
+ removeNextSiblingsAfterElement(select);
1568
+ addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(newObject), options.subForm, dataDoc, callbackFunction);
1555
1569
  }
1556
1570
 
1557
1571
  if (!opt.AJAR_uri) continue; // a prompt or mint
@@ -1561,11 +1575,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1561
1575
  is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
1562
1576
  }
1563
1577
 
1564
- if (!opt.selected && opt.AJAR_uri in actual) {
1565
- // old class
1566
- removeValue(kb.sym(opt.AJAR_uri));
1567
- }
1568
-
1569
1578
  if (opt.selected) select.currentURI = opt.AJAR_uri;
1570
1579
  }
1571
1580
 
@@ -1591,16 +1600,18 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1591
1600
  }
1592
1601
 
1593
1602
  log.info('selectForOptions: data doc = ' + dataDoc);
1603
+ removeNextSiblingsAfterElement(select);
1604
+ addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, callbackFunction);
1594
1605
  kb.updater.update(ds, is, function (uri, ok, body) {
1595
1606
  actual = getActual(); // refresh
1596
1607
 
1597
1608
  if (ok) {
1598
- select.disabled = false; // data written back
1599
-
1600
1609
  if (newObject) {
1601
- var fn = (0, _fieldFunction.fieldFunction)(dom, options.subForm);
1602
- fn(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
1610
+ removeNextSiblingsAfterElement(select);
1611
+ addSubFormDropDown(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
1603
1612
  }
1613
+
1614
+ select.disabled = false; // data written back
1604
1615
  } else {
1605
1616
  return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
1606
1617
  }
@@ -1665,11 +1676,14 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1665
1676
  select.insertBefore(mint, select.firstChild);
1666
1677
  }
1667
1678
 
1668
- if (select.currentURI == null && !options.multiple) {
1679
+ if (!select.currentURI && !options.multiple) {
1669
1680
  var prompt = dom.createElement('option');
1670
- prompt.appendChild(dom.createTextNode(options.nullLabel));
1671
- select.insertBefore(prompt, select.firstChild);
1681
+ prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
1672
1682
  prompt.selected = true;
1683
+ prompt.disabled = true;
1684
+ prompt.value = true;
1685
+ prompt.hidden = true;
1686
+ select.insertBefore(prompt, select.firstChild);
1673
1687
  }
1674
1688
 
1675
1689
  if (editable) {
@@ -1708,8 +1722,7 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
1708
1722
  }
1709
1723
 
1710
1724
  return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
1711
- multiple: multiple,
1712
- nullPrompt: '--classify--'
1725
+ multiple: multiple
1713
1726
  }, dataDoc, callbackFunction);
1714
1727
  }
1715
1728
  /** Make SELECT element to select subclasses recurively