solid-ui 2.4.22-b483f37e → 2.4.22-c76aca59
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 +87 -68
- package/dist/main.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/forms.js +85 -66
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +3 -2
package/lib/versionInfo.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.versionInfo = void 0;
|
|
7
7
|
var versionInfo = {
|
|
8
|
-
buildTime: '2022-05-
|
|
9
|
-
commit: '
|
|
8
|
+
buildTime: '2022-05-06T16:51:17Z',
|
|
9
|
+
commit: 'c76aca592b65d7a8c0f48525e4bbf1ea926f1f06',
|
|
10
10
|
npmInfo: {
|
|
11
11
|
'solid-ui': '2.4.22',
|
|
12
12
|
npm: '6.14.16',
|
package/lib/versionInfo.js.map
CHANGED
|
@@ -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-
|
|
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-06T16:51:17Z',\n commit: 'c76aca592b65d7a8c0f48525e4bbf1ea926f1f06',\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"}
|
package/lib/widgets/forms.js
CHANGED
|
@@ -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
|
|
@@ -1047,38 +1055,39 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1047
1055
|
}
|
|
1048
1056
|
|
|
1049
1057
|
lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
|
|
1050
|
-
var from = kb.any(form, ui('from'));
|
|
1051
|
-
|
|
1052
|
-
if (!from) {
|
|
1053
|
-
return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
1058
|
var subForm = kb.any(form, ui('use')); // Optional
|
|
1057
1059
|
|
|
1058
1060
|
var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
|
|
1059
1061
|
|
|
1060
1062
|
var possible = [];
|
|
1061
1063
|
var possibleProperties;
|
|
1062
|
-
var
|
|
1064
|
+
var firstSelectOptionText = '* Select from ' + utils.label(subject, true) + ' *';
|
|
1063
1065
|
var opts = {
|
|
1064
1066
|
form: form,
|
|
1067
|
+
subForm: subForm,
|
|
1065
1068
|
multiple: multiple,
|
|
1066
|
-
|
|
1069
|
+
firstSelectOptionText: firstSelectOptionText,
|
|
1067
1070
|
disambiguate: false
|
|
1068
1071
|
};
|
|
1069
|
-
|
|
1072
|
+
var uiFrom = kb.any(form, ui('from'));
|
|
1070
1073
|
|
|
1071
|
-
|
|
1074
|
+
if (!uiFrom) {
|
|
1075
|
+
return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
1079
|
+
|
|
1080
|
+
for (var x in kb.findMembersNT(uiFrom)) {
|
|
1072
1081
|
possible.push(kb.fromNT(x));
|
|
1073
1082
|
} // Use rdfs
|
|
1074
1083
|
|
|
1075
1084
|
|
|
1076
|
-
if (
|
|
1085
|
+
if (uiFrom.sameTerm(ns.rdfs('Class'))) {
|
|
1077
1086
|
for (p in buttons.allClassURIs()) {
|
|
1078
1087
|
possible.push(kb.sym(p));
|
|
1079
1088
|
} // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
|
|
1080
1089
|
|
|
1081
|
-
} else if (
|
|
1090
|
+
} else if (uiFrom.sameTerm(ns.rdf('Property'))) {
|
|
1082
1091
|
possibleProperties = buttons.propertyTriage(kb);
|
|
1083
1092
|
|
|
1084
1093
|
for (p in possibleProperties.op) {
|
|
@@ -1090,7 +1099,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1090
1099
|
}
|
|
1091
1100
|
|
|
1092
1101
|
opts.disambiguate = true; // This is a big class, and the labels won't be enough.
|
|
1093
|
-
} else if (
|
|
1102
|
+
} else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
|
|
1094
1103
|
possibleProperties = buttons.propertyTriage(kb);
|
|
1095
1104
|
|
|
1096
1105
|
for (p in possibleProperties.op) {
|
|
@@ -1098,7 +1107,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1098
1107
|
}
|
|
1099
1108
|
|
|
1100
1109
|
opts.disambiguate = true;
|
|
1101
|
-
} else if (
|
|
1110
|
+
} else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
|
|
1102
1111
|
possibleProperties = buttons.propertyTriage(kb);
|
|
1103
1112
|
|
|
1104
1113
|
for (p in possibleProperties.dp) {
|
|
@@ -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
|
|
1120
|
+
var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurance regardles if it is set to true or false
|
|
1112
1121
|
|
|
1113
|
-
|
|
1114
|
-
|
|
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
|
|
1126
|
+
var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, uiFrom, opts, dataDoc, callbackFunction);
|
|
1127
|
+
rhs.appendChild(selector);
|
|
1128
|
+
var object;
|
|
1119
1129
|
|
|
1120
|
-
if (
|
|
1121
|
-
|
|
1130
|
+
if (selector.currentURI) {
|
|
1131
|
+
object = $rdf.sym(selector.currentURI);
|
|
1132
|
+
} else {
|
|
1133
|
+
object = kb.any(subject, property);
|
|
1134
|
+
}
|
|
1122
1135
|
|
|
1123
|
-
|
|
1136
|
+
if (object && subForm) {
|
|
1137
|
+
removeNextSiblingsAfterElement(selector);
|
|
1138
|
+
addSubFormChoice(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
|
-
};
|
|
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 addSubFormChoice(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.
|
|
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
|
|
@@ -1475,7 +1503,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
1475
1503
|
*/
|
|
1476
1504
|
|
|
1477
1505
|
|
|
1478
|
-
function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
|
|
1506
|
+
function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, options, dataDoc, callbackFunction) {
|
|
1479
1507
|
log.debug('Select list length now ' + possible.length);
|
|
1480
1508
|
var n = 0;
|
|
1481
1509
|
var uris = {}; // Count them
|
|
@@ -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
|
-
|
|
1537
|
+
if (x.uri) {
|
|
1538
|
+
actual[x.uri] = true;
|
|
1539
|
+
}
|
|
1510
1540
|
});
|
|
1511
1541
|
}
|
|
1512
1542
|
|
|
@@ -1516,8 +1546,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1516
1546
|
actual = getActual();
|
|
1517
1547
|
|
|
1518
1548
|
var onChange = function onChange(_e) {
|
|
1519
|
-
select.disabled = true; // until data written back - gives user feedback too
|
|
1520
|
-
|
|
1521
1549
|
var ds = [];
|
|
1522
1550
|
var is = [];
|
|
1523
1551
|
|
|
@@ -1533,6 +1561,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1533
1561
|
var opt = select.options[_i];
|
|
1534
1562
|
|
|
1535
1563
|
if (opt.selected && opt.AJAR_mint) {
|
|
1564
|
+
// not sure if this if is used because I cannot find mintClass
|
|
1536
1565
|
if (options.mintClass) {
|
|
1537
1566
|
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
1538
1567
|
if (!ok) {
|
|
@@ -1547,11 +1576,14 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1547
1576
|
newObject = newThing(dataDoc);
|
|
1548
1577
|
}
|
|
1549
1578
|
|
|
1550
|
-
is.push($rdf.st(subject, predicate, newObject, dataDoc));
|
|
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
|
|
1551
1581
|
|
|
1552
1582
|
if (options.mintStatementsFun) {
|
|
1553
1583
|
is = is.concat(options.mintStatementsFun(newObject));
|
|
1554
1584
|
}
|
|
1585
|
+
|
|
1586
|
+
select.currentURI = newObject;
|
|
1555
1587
|
}
|
|
1556
1588
|
|
|
1557
1589
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
@@ -1559,11 +1591,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1559
1591
|
if (opt.selected && !(opt.AJAR_uri in actual)) {
|
|
1560
1592
|
// new class
|
|
1561
1593
|
is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
if (!opt.selected && opt.AJAR_uri in actual) {
|
|
1565
|
-
// old class
|
|
1566
|
-
removeValue(kb.sym(opt.AJAR_uri));
|
|
1594
|
+
select.currentURI = opt.AJAR_uri;
|
|
1567
1595
|
}
|
|
1568
1596
|
|
|
1569
1597
|
if (opt.selected) select.currentURI = opt.AJAR_uri;
|
|
@@ -1583,32 +1611,21 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1583
1611
|
sel = sel.superSelect;
|
|
1584
1612
|
}
|
|
1585
1613
|
|
|
1586
|
-
|
|
1587
|
-
callbackFunction(ok, {
|
|
1588
|
-
widget: 'select',
|
|
1589
|
-
event: 'new'
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
1594
|
-
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
1595
|
-
actual = getActual(); // refresh
|
|
1614
|
+
log.info('selectForOptions: data doc = ' + dataDoc); // refresh subForm
|
|
1596
1615
|
|
|
1616
|
+
removeNextSiblingsAfterElement(select);
|
|
1617
|
+
addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
|
|
1597
1618
|
if (ok) {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
if (newObject) {
|
|
1601
|
-
var fn = (0, _fieldFunction.fieldFunction)(dom, options.subForm);
|
|
1602
|
-
fn(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
|
|
1603
|
-
}
|
|
1604
|
-
} else {
|
|
1605
|
-
return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
1606
|
-
}
|
|
1619
|
+
kb.updater.update(ds, is, function (uri, success, errorBody) {
|
|
1620
|
+
actual = getActual(); // refresh
|
|
1607
1621
|
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
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));
|
|
1612
1629
|
});
|
|
1613
1630
|
};
|
|
1614
1631
|
|
|
@@ -1665,11 +1682,14 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1665
1682
|
select.insertBefore(mint, select.firstChild);
|
|
1666
1683
|
}
|
|
1667
1684
|
|
|
1668
|
-
if (select.currentURI
|
|
1685
|
+
if (!select.currentURI && !options.multiple) {
|
|
1669
1686
|
var prompt = dom.createElement('option');
|
|
1670
|
-
prompt.appendChild(dom.createTextNode(options.
|
|
1671
|
-
select.insertBefore(prompt, select.firstChild);
|
|
1687
|
+
prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
|
|
1672
1688
|
prompt.selected = true;
|
|
1689
|
+
prompt.disabled = true;
|
|
1690
|
+
prompt.value = true;
|
|
1691
|
+
prompt.hidden = true;
|
|
1692
|
+
select.insertBefore(prompt, select.firstChild);
|
|
1673
1693
|
}
|
|
1674
1694
|
|
|
1675
1695
|
if (editable) {
|
|
@@ -1707,9 +1727,8 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
|
|
|
1707
1727
|
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
|
|
1708
1728
|
}
|
|
1709
1729
|
|
|
1710
|
-
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
|
|
1711
|
-
multiple: multiple
|
|
1712
|
-
nullPrompt: '--classify--'
|
|
1730
|
+
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
|
|
1731
|
+
multiple: multiple
|
|
1713
1732
|
}, dataDoc, callbackFunction);
|
|
1714
1733
|
}
|
|
1715
1734
|
/** Make SELECT element to select subclasses recurively
|