solid-ui 2.4.22-6ae4df24 → 2.4.22-72a79d76
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 +37 -26
- package/dist/main.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +2 -0
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/forms.js +33 -24
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +1 -1
package/lib/widgets/forms.js
CHANGED
|
@@ -159,10 +159,11 @@ _fieldFunction.field[ns.ui('Form').uri] = _fieldFunction.field[ns.ui('Group').ur
|
|
|
159
159
|
|
|
160
160
|
if (already[key]) {
|
|
161
161
|
// been there done that
|
|
162
|
-
box.appendChild(dom.createTextNode('Group: see above ' + key));
|
|
163
|
-
|
|
162
|
+
box.appendChild(dom.createTextNode('Group: see above ' + key)); // TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
163
|
+
// const plist = [$rdf.st(subject, ns.owl('sameAs'), subject)] // @@ need prev subject
|
|
164
|
+
// dom.outlineManager.appendPropertyTRs(box, plist)
|
|
165
|
+
// dom.appendChild(plist)
|
|
164
166
|
|
|
165
|
-
dom.outlineManager.appendPropertyTRs(box, plist);
|
|
166
167
|
return box;
|
|
167
168
|
}
|
|
168
169
|
|
|
@@ -591,7 +592,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
591
592
|
// delete button and move buttons
|
|
592
593
|
|
|
593
594
|
if (kb.updater.editable(dataDoc.uri)) {
|
|
594
|
-
buttons.deleteButtonWithCheck(dom, subField,
|
|
595
|
+
buttons.deleteButtonWithCheck(dom, subField, multipleUIlabel, deleteThisItem);
|
|
595
596
|
|
|
596
597
|
if (ordered) {
|
|
597
598
|
// Add controsl in a frame
|
|
@@ -691,6 +692,8 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
691
692
|
return shim;
|
|
692
693
|
}
|
|
693
694
|
|
|
695
|
+
var multipleUIlabel = kb.any(form, ui('label'));
|
|
696
|
+
if (!multipleUIlabel) multipleUIlabel = utils.label(property);
|
|
694
697
|
var min = kb.any(form, ui('min')); // This is the minimum number -- default 0
|
|
695
698
|
|
|
696
699
|
min = min ? 0 + min.value : 0;
|
|
@@ -727,16 +730,13 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
727
730
|
if (kb.updater.editable(dataDoc.uri)) {
|
|
728
731
|
var tail = box.appendChild(dom.createElement('div'));
|
|
729
732
|
tail.style.padding = '0.5em';
|
|
730
|
-
var label = kb.any(form, ui('label'));
|
|
731
|
-
if (!label) label = utils.label(property, true); // Init capital
|
|
732
|
-
|
|
733
733
|
var img = tail.appendChild(dom.createElement('img'));
|
|
734
734
|
img.setAttribute('src', plusIconURI); // plus sign
|
|
735
735
|
|
|
736
736
|
img.setAttribute('style', 'margin: 0.2em; width: 1.5em; height:1.5em');
|
|
737
|
-
img.title = 'Click to add
|
|
737
|
+
img.title = 'Click to add another ' + multipleUIlabel;
|
|
738
738
|
var prompt = dom.createElement('span');
|
|
739
|
-
prompt.textContent = (values.length === 0 ? 'Add
|
|
739
|
+
prompt.textContent = (values.length === 0 ? 'Add another ' : 'Add ') + multipleUIlabel;
|
|
740
740
|
tail.addEventListener('click', /*#__PURE__*/function () {
|
|
741
741
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_eventNotUsed) {
|
|
742
742
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
@@ -1033,7 +1033,7 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
1033
1033
|
** -- radio buttons
|
|
1034
1034
|
** -- auto-complete typing
|
|
1035
1035
|
**
|
|
1036
|
-
**
|
|
1036
|
+
** TODO: according to ontology ui:choice can also have ns.ui('default') - this is not implemented yet
|
|
1037
1037
|
*/
|
|
1038
1038
|
|
|
1039
1039
|
|
|
@@ -1042,6 +1042,9 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1042
1042
|
var kb = _solidLogic.store;
|
|
1043
1043
|
var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
|
|
1044
1044
|
|
|
1045
|
+
var uiMultipleInUse = false; // this signals to ui:choice that it is part of a ui:multiple
|
|
1046
|
+
|
|
1047
|
+
var multiSelect = false;
|
|
1045
1048
|
var p;
|
|
1046
1049
|
var box = dom.createElement('div');
|
|
1047
1050
|
box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
|
|
@@ -1072,20 +1075,24 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1072
1075
|
|
|
1073
1076
|
var possible = [];
|
|
1074
1077
|
var possibleProperties;
|
|
1075
|
-
var multiple = false;
|
|
1076
1078
|
var firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *'; // if we do NOT have a container it means it is a ui:Multiple
|
|
1077
1079
|
// only important for the first option text in select
|
|
1078
1080
|
|
|
1079
1081
|
if (!container) {
|
|
1080
|
-
|
|
1082
|
+
uiMultipleInUse = true;
|
|
1081
1083
|
firstSelectOptionText = utils.label(subject, true);
|
|
1082
1084
|
}
|
|
1083
1085
|
|
|
1086
|
+
if (subject.termType === 'BlankNode') {
|
|
1087
|
+
firstSelectOptionText = '* Select for ' + utils.label(property) + ' *';
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1084
1090
|
var opts = {
|
|
1085
1091
|
form: form,
|
|
1086
1092
|
subForm: subForm,
|
|
1087
|
-
|
|
1093
|
+
multiSelect: multiSelect,
|
|
1088
1094
|
firstSelectOptionText: firstSelectOptionText,
|
|
1095
|
+
uiMultipleInUse: uiMultipleInUse,
|
|
1089
1096
|
disambiguate: false
|
|
1090
1097
|
};
|
|
1091
1098
|
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
@@ -1371,7 +1378,8 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
|
|
|
1371
1378
|
b.setAttribute('type', 'button');
|
|
1372
1379
|
b.setAttribute('style', 'float: right;');
|
|
1373
1380
|
b.innerHTML = 'Goto ' + utils.label(theClass);
|
|
1374
|
-
b.addEventListener('click',
|
|
1381
|
+
b.addEventListener('click', // TODO fix dependency cycle to solid-panes by calling outlineManager
|
|
1382
|
+
function (_e) {
|
|
1375
1383
|
dom.outlineManager.GotoSubject(theClass, true, undefined, true, undefined);
|
|
1376
1384
|
}, false);
|
|
1377
1385
|
return box;
|
|
@@ -1506,9 +1514,10 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
1506
1514
|
// @param subject - a term, the subject of the statement(s) being edited.
|
|
1507
1515
|
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
1508
1516
|
// @param possible - a list of terms, the possible value the object can take
|
|
1509
|
-
// @param options.
|
|
1517
|
+
// @param options.multiSelect - Boolean - Whether more than one at a time is allowed
|
|
1510
1518
|
// @param options.firstSelectOptionText - a string to be displayed as the
|
|
1511
|
-
// option for none selected (for non
|
|
1519
|
+
// option for none selected (for non multiSelect)
|
|
1520
|
+
// @param options.uiMultipleInUse - signals that the ui:choise is used with a ui:multiple
|
|
1512
1521
|
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
1513
1522
|
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
1514
1523
|
// @param dataDoc - The web document being edited
|
|
@@ -1645,8 +1654,8 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
1645
1654
|
};
|
|
1646
1655
|
|
|
1647
1656
|
var select = dom.createElement('select');
|
|
1648
|
-
select.setAttribute('style', style.formSelectSTyle);
|
|
1649
|
-
|
|
1657
|
+
select.setAttribute('style', style.formSelectSTyle);
|
|
1658
|
+
if (options.multiSelect) select.setAttribute('multiSelect', 'true');
|
|
1650
1659
|
select.currentURI = null;
|
|
1651
1660
|
|
|
1652
1661
|
select.refresh = function () {
|
|
@@ -1697,7 +1706,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
1697
1706
|
select.insertBefore(mint, select.firstChild);
|
|
1698
1707
|
}
|
|
1699
1708
|
|
|
1700
|
-
if (!select.currentURI && options.
|
|
1709
|
+
if (!select.currentURI && options.uiMultipleInUse) {
|
|
1701
1710
|
var prompt = dom.createElement('option');
|
|
1702
1711
|
prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
|
|
1703
1712
|
prompt.disabled = true;
|
|
@@ -1723,11 +1732,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, opt
|
|
|
1723
1732
|
function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
|
|
1724
1733
|
var du = kb.any(category, ns.owl('disjointUnionOf'));
|
|
1725
1734
|
var subs;
|
|
1726
|
-
var
|
|
1735
|
+
var multiSelect = false;
|
|
1727
1736
|
|
|
1728
1737
|
if (!du) {
|
|
1729
1738
|
subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
|
|
1730
|
-
|
|
1739
|
+
multiSelect = true;
|
|
1731
1740
|
} else {
|
|
1732
1741
|
subs = du.elements;
|
|
1733
1742
|
}
|
|
@@ -1735,15 +1744,15 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
|
|
|
1735
1744
|
log.debug('Select list length ' + subs.length);
|
|
1736
1745
|
|
|
1737
1746
|
if (subs.length === 0) {
|
|
1738
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (
|
|
1747
|
+
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
|
|
1739
1748
|
}
|
|
1740
1749
|
|
|
1741
1750
|
if (subs.length === 1) {
|
|
1742
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (
|
|
1751
|
+
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
|
|
1743
1752
|
}
|
|
1744
1753
|
|
|
1745
1754
|
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
|
|
1746
|
-
|
|
1755
|
+
multiSelect: multiSelect
|
|
1747
1756
|
}, dataDoc, callbackFunction);
|
|
1748
1757
|
}
|
|
1749
1758
|
/** Make SELECT element to select subclasses recurively
|