solid-ui 2.4.22-179d5c10 → 2.4.22-2b59ecec

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-05-05T15:17:36Z',
9
- commit: '179d5c10c63ea5c2237ce00981e2dd2b8ae8cd05',
8
+ buildTime: '2022-05-06T18:28:57Z',
9
+ commit: '2b59ececdbeff0b9fc6c2b0710d65711cb6fce3b',
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-05-05T15:17:36Z',\n commit: '179d5c10c63ea5c2237ce00981e2dd2b8ae8cd05',\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-06T18:28:57Z',\n commit: '2b59ececdbeff0b9fc6c2b0710d65711cb6fce3b',\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"}
@@ -1055,12 +1055,6 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
1055
1055
  }
1056
1056
 
1057
1057
  lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
1058
- var from = kb.any(form, ui('from'));
1059
-
1060
- if (!from) {
1061
- return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
1062
- }
1063
-
1064
1058
  var subForm = kb.any(form, ui('use')); // Optional
1065
1059
 
1066
1060
  var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
@@ -1075,19 +1069,25 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
1075
1069
  firstSelectOptionText: firstSelectOptionText,
1076
1070
  disambiguate: false
1077
1071
  };
1078
- possible = kb.each(undefined, ns.rdf('type'), from, formDoc);
1072
+ var uiFrom = kb.any(form, ui('from'));
1073
+
1074
+ if (!uiFrom) {
1075
+ return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
1076
+ }
1079
1077
 
1080
- for (var x in kb.findMembersNT(from)) {
1078
+ possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
1079
+
1080
+ for (var x in kb.findMembersNT(uiFrom)) {
1081
1081
  possible.push(kb.fromNT(x));
1082
1082
  } // Use rdfs
1083
1083
 
1084
1084
 
1085
- if (from.sameTerm(ns.rdfs('Class'))) {
1085
+ if (uiFrom.sameTerm(ns.rdfs('Class'))) {
1086
1086
  for (p in buttons.allClassURIs()) {
1087
1087
  possible.push(kb.sym(p));
1088
1088
  } // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
1089
1089
 
1090
- } else if (from.sameTerm(ns.rdf('Property'))) {
1090
+ } else if (uiFrom.sameTerm(ns.rdf('Property'))) {
1091
1091
  possibleProperties = buttons.propertyTriage(kb);
1092
1092
 
1093
1093
  for (p in possibleProperties.op) {
@@ -1099,7 +1099,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
1099
1099
  }
1100
1100
 
1101
1101
  opts.disambiguate = true; // This is a big class, and the labels won't be enough.
1102
- } else if (from.sameTerm(ns.owl('ObjectProperty'))) {
1102
+ } else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
1103
1103
  possibleProperties = buttons.propertyTriage(kb);
1104
1104
 
1105
1105
  for (p in possibleProperties.op) {
@@ -1107,7 +1107,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
1107
1107
  }
1108
1108
 
1109
1109
  opts.disambiguate = true;
1110
- } else if (from.sameTerm(ns.owl('DatatypeProperty'))) {
1110
+ } else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
1111
1111
  possibleProperties = buttons.propertyTriage(kb);
1112
1112
 
1113
1113
  for (p in possibleProperties.dp) {
@@ -1123,7 +1123,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
1123
1123
  opts.mint = '* Create new *'; // @@ could be better
1124
1124
  }
1125
1125
 
1126
- var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, opts, dataDoc, callbackFunction);
1126
+ var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, uiFrom, opts, dataDoc, callbackFunction);
1127
1127
  rhs.appendChild(selector);
1128
1128
  var object;
1129
1129
 
@@ -1135,7 +1135,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
1135
1135
 
1136
1136
  if (object && subForm) {
1137
1137
  removeNextSiblingsAfterElement(selector);
1138
- addSubFormDropDown(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
1138
+ addSubFormChoice(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
1139
1139
  }
1140
1140
 
1141
1141
  return box;
@@ -1153,7 +1153,7 @@ function removeNextSiblingsAfterElement(currentElement) {
1153
1153
  }
1154
1154
  }
1155
1155
 
1156
- function addSubFormDropDown(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
1156
+ function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
1157
1157
  (0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
1158
1158
  } // Documentation - non-interactive fields
1159
1159
  //
@@ -1503,7 +1503,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
1503
1503
  */
1504
1504
 
1505
1505
 
1506
- function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
1506
+ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, options, dataDoc, callbackFunction) {
1507
1507
  log.debug('Select list length now ' + possible.length);
1508
1508
  var n = 0;
1509
1509
  var uris = {}; // Count them
@@ -1546,8 +1546,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1546
1546
  actual = getActual();
1547
1547
 
1548
1548
  var onChange = function onChange(_e) {
1549
- select.disabled = true; // until data written back - gives user feedback too
1550
-
1551
1549
  var ds = [];
1552
1550
  var is = [];
1553
1551
 
@@ -1563,9 +1561,29 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1563
1561
  var opt = select.options[_i];
1564
1562
 
1565
1563
  if (opt.selected && opt.AJAR_mint) {
1566
- newObject = newThing(dataDoc);
1567
- removeNextSiblingsAfterElement(select);
1568
- addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(newObject), options.subForm, dataDoc, callbackFunction);
1564
+ // not sure if this if is used because I cannot find mintClass
1565
+ if (options.mintClass) {
1566
+ var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
1567
+ if (!ok) {
1568
+ callbackFunction(ok, body, {
1569
+ change: 'new'
1570
+ }); // @@ if ok, need some form of refresh of the select for the new thing
1571
+ }
1572
+ });
1573
+ select.parentNode.appendChild(thisForm);
1574
+ newObject = thisForm.AJAR_subject;
1575
+ } else {
1576
+ newObject = newThing(dataDoc);
1577
+ }
1578
+
1579
+ is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
1580
+ 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
1581
+
1582
+ if (options.mintStatementsFun) {
1583
+ is = is.concat(options.mintStatementsFun(newObject));
1584
+ }
1585
+
1586
+ select.currentURI = newObject;
1569
1587
  }
1570
1588
 
1571
1589
  if (!opt.AJAR_uri) continue; // a prompt or mint
@@ -1573,6 +1591,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1573
1591
  if (opt.selected && !(opt.AJAR_uri in actual)) {
1574
1592
  // new class
1575
1593
  is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
1594
+ select.currentURI = opt.AJAR_uri;
1576
1595
  }
1577
1596
 
1578
1597
  if (opt.selected) select.currentURI = opt.AJAR_uri;
@@ -1592,34 +1611,21 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
1592
1611
  sel = sel.superSelect;
1593
1612
  }
1594
1613
 
1595
- function doneNew(ok, _body) {
1596
- callbackFunction(ok, {
1597
- widget: 'select',
1598
- event: 'new'
1599
- });
1600
- }
1614
+ log.info('selectForOptions: data doc = ' + dataDoc); // refresh subForm
1601
1615
 
1602
- log.info('selectForOptions: data doc = ' + dataDoc);
1603
1616
  removeNextSiblingsAfterElement(select);
1604
- addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, callbackFunction);
1605
- kb.updater.update(ds, is, function (uri, ok, body) {
1606
- actual = getActual(); // refresh
1607
-
1617
+ addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
1608
1618
  if (ok) {
1609
- if (newObject) {
1610
- removeNextSiblingsAfterElement(select);
1611
- addSubFormDropDown(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
1612
- }
1613
-
1614
- select.disabled = false; // data written back
1615
- } else {
1616
- return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
1617
- }
1618
-
1619
- if (callbackFunction) callbackFunction(ok, {
1620
- widget: 'select',
1621
- event: 'change'
1622
- });
1619
+ kb.updater.update(ds, is, function (uri, success, errorBody) {
1620
+ actual = getActual(); // refresh
1621
+
1622
+ if (!success) return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + errorBody));
1623
+ if (callbackFunction) callbackFunction(success, {
1624
+ widget: 'select',
1625
+ event: 'new'
1626
+ });
1627
+ });
1628
+ } else return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
1623
1629
  });
1624
1630
  };
1625
1631
 
@@ -1721,7 +1727,7 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
1721
1727
  return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
1722
1728
  }
1723
1729
 
1724
- return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
1730
+ return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
1725
1731
  multiple: multiple
1726
1732
  }, dataDoc, callbackFunction);
1727
1733
  }