solid-ui 2.4.22-34747cd0 → 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 +116 -79
- 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 +115 -78
- 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-10T17:01:23Z',
|
|
9
|
+
commit: '3e0d1a42e042cb5542cbc183d7ae53eec6498254',
|
|
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-10T17:01:23Z',\n commit: '3e0d1a42e042cb5542cbc183d7ae53eec6498254',\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
|
@@ -591,7 +591,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
591
591
|
// delete button and move buttons
|
|
592
592
|
|
|
593
593
|
if (kb.updater.editable(dataDoc.uri)) {
|
|
594
|
-
buttons.deleteButtonWithCheck(dom, subField,
|
|
594
|
+
buttons.deleteButtonWithCheck(dom, subField, multipleUIlabel, deleteThisItem);
|
|
595
595
|
|
|
596
596
|
if (ordered) {
|
|
597
597
|
// Add controsl in a frame
|
|
@@ -642,7 +642,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
642
642
|
|
|
643
643
|
var _shim = dom.createElement('div');
|
|
644
644
|
|
|
645
|
-
_shim.appendChild(subField); // Subfield has its own
|
|
645
|
+
_shim.appendChild(subField); // Subfield has its own layout
|
|
646
646
|
|
|
647
647
|
|
|
648
648
|
frame.appendChild(_shim);
|
|
@@ -691,6 +691,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
691
691
|
return shim;
|
|
692
692
|
}
|
|
693
693
|
|
|
694
|
+
var multipleUIlabel = kb.any(form, ui('label'));
|
|
695
|
+
if (!multipleUIlabel) multipleUIlabel = utils.label(property, true); // Init capital
|
|
696
|
+
|
|
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;
|
|
@@ -731,10 +734,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
731
734
|
img.setAttribute('src', plusIconURI); // plus sign
|
|
732
735
|
|
|
733
736
|
img.setAttribute('style', 'margin: 0.2em; width: 1.5em; height:1.5em');
|
|
734
|
-
img.title = 'Click to add
|
|
735
|
-
var prompt =
|
|
736
|
-
prompt.textContent = (values.length === 0 ? 'Add
|
|
737
|
-
|
|
737
|
+
img.title = 'Click to add another ' + multipleUIlabel;
|
|
738
|
+
var prompt = dom.createElement('span');
|
|
739
|
+
prompt.textContent = (values.length === 0 ? 'Add another ' : 'Add ') + multipleUIlabel;
|
|
738
740
|
tail.addEventListener('click', /*#__PURE__*/function () {
|
|
739
741
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_eventNotUsed) {
|
|
740
742
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
@@ -756,6 +758,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
|
|
|
756
758
|
return _ref3.apply(this, arguments);
|
|
757
759
|
};
|
|
758
760
|
}(), true);
|
|
761
|
+
tail.appendChild(prompt);
|
|
759
762
|
}
|
|
760
763
|
|
|
761
764
|
function createListIfNecessary() {
|
|
@@ -1017,28 +1020,40 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
1017
1020
|
**
|
|
1018
1021
|
** Not nested. Generates a link to something from a given class.
|
|
1019
1022
|
** Optional subform for the thing selected.
|
|
1023
|
+
** Generates a subForm based on a ui:use form
|
|
1024
|
+
** Will look like:
|
|
1025
|
+
** <div id=dropDownDiv>
|
|
1026
|
+
** <div id=labelOfDropDown>
|
|
1027
|
+
** <div id=selectDiv>
|
|
1028
|
+
** <select id=dropDownSelect>
|
|
1029
|
+
** <option> ....
|
|
1030
|
+
** <subForm>
|
|
1020
1031
|
** Alternative implementatons caould be:
|
|
1021
1032
|
** -- pop-up menu (as here)
|
|
1022
1033
|
** -- radio buttons
|
|
1023
1034
|
** -- auto-complete typing
|
|
1024
1035
|
**
|
|
1025
|
-
** Todo: Deal with multiple. Maybe merge with multiple code.
|
|
1026
1036
|
*/
|
|
1027
1037
|
|
|
1028
1038
|
|
|
1029
1039
|
_fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, subject, form, dataDoc, callbackFunction) {
|
|
1030
1040
|
var ui = ns.ui;
|
|
1031
1041
|
var kb = _solidLogic.store;
|
|
1032
|
-
var multiple = false;
|
|
1033
1042
|
var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
|
|
1034
1043
|
|
|
1044
|
+
var uiMultipleInUse = false; // this signals to ui:choice that it is part of a ui:multiple
|
|
1045
|
+
|
|
1046
|
+
var multiSelect = false;
|
|
1035
1047
|
var p;
|
|
1036
|
-
var box = dom.createElement('div');
|
|
1048
|
+
var box = dom.createElement('div');
|
|
1049
|
+
box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
|
|
1037
1050
|
|
|
1038
1051
|
if (container) container.appendChild(box);
|
|
1039
1052
|
var lhs = dom.createElement('div');
|
|
1053
|
+
lhs.setAttribute('class', 'formFieldName choiceBox-label');
|
|
1040
1054
|
box.appendChild(lhs);
|
|
1041
1055
|
var rhs = dom.createElement('div');
|
|
1056
|
+
rhs.setAttribute('class', 'formFieldValue choiceBox-selectBox');
|
|
1042
1057
|
box.appendChild(rhs);
|
|
1043
1058
|
var property = kb.any(form, ui('property'));
|
|
1044
1059
|
|
|
@@ -1047,9 +1062,9 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1047
1062
|
}
|
|
1048
1063
|
|
|
1049
1064
|
lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
|
|
1050
|
-
var
|
|
1065
|
+
var uiFrom = kb.any(form, ui('from'));
|
|
1051
1066
|
|
|
1052
|
-
if (!
|
|
1067
|
+
if (!uiFrom) {
|
|
1053
1068
|
return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
|
|
1054
1069
|
}
|
|
1055
1070
|
|
|
@@ -1059,26 +1074,35 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1059
1074
|
|
|
1060
1075
|
var possible = [];
|
|
1061
1076
|
var possibleProperties;
|
|
1062
|
-
var
|
|
1077
|
+
var firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *'; // if we do NOT have a container it means it is a ui:Multiple
|
|
1078
|
+
// only important for the first option text in select
|
|
1079
|
+
|
|
1080
|
+
if (!container) {
|
|
1081
|
+
uiMultipleInUse = true;
|
|
1082
|
+
firstSelectOptionText = utils.label(subject, true);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1063
1085
|
var opts = {
|
|
1064
1086
|
form: form,
|
|
1065
|
-
|
|
1066
|
-
|
|
1087
|
+
subForm: subForm,
|
|
1088
|
+
multiSelect: multiSelect,
|
|
1089
|
+
firstSelectOptionText: firstSelectOptionText,
|
|
1090
|
+
uiMultipleInUse: uiMultipleInUse,
|
|
1067
1091
|
disambiguate: false
|
|
1068
1092
|
};
|
|
1069
|
-
possible = kb.each(undefined, ns.rdf('type'),
|
|
1093
|
+
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
1070
1094
|
|
|
1071
|
-
for (var x in kb.findMembersNT(
|
|
1095
|
+
for (var x in kb.findMembersNT(uiFrom)) {
|
|
1072
1096
|
possible.push(kb.fromNT(x));
|
|
1073
1097
|
} // Use rdfs
|
|
1074
1098
|
|
|
1075
1099
|
|
|
1076
|
-
if (
|
|
1100
|
+
if (uiFrom.sameTerm(ns.rdfs('Class'))) {
|
|
1077
1101
|
for (p in buttons.allClassURIs()) {
|
|
1078
1102
|
possible.push(kb.sym(p));
|
|
1079
1103
|
} // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
|
|
1080
1104
|
|
|
1081
|
-
} else if (
|
|
1105
|
+
} else if (uiFrom.sameTerm(ns.rdf('Property'))) {
|
|
1082
1106
|
possibleProperties = buttons.propertyTriage(kb);
|
|
1083
1107
|
|
|
1084
1108
|
for (p in possibleProperties.op) {
|
|
@@ -1090,7 +1114,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1090
1114
|
}
|
|
1091
1115
|
|
|
1092
1116
|
opts.disambiguate = true; // This is a big class, and the labels won't be enough.
|
|
1093
|
-
} else if (
|
|
1117
|
+
} else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
|
|
1094
1118
|
possibleProperties = buttons.propertyTriage(kb);
|
|
1095
1119
|
|
|
1096
1120
|
for (p in possibleProperties.op) {
|
|
@@ -1098,7 +1122,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1098
1122
|
}
|
|
1099
1123
|
|
|
1100
1124
|
opts.disambiguate = true;
|
|
1101
|
-
} else if (
|
|
1125
|
+
} else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
|
|
1102
1126
|
possibleProperties = buttons.propertyTriage(kb);
|
|
1103
1127
|
|
|
1104
1128
|
for (p in possibleProperties.dp) {
|
|
@@ -1108,26 +1132,45 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1108
1132
|
opts.disambiguate = true;
|
|
1109
1133
|
}
|
|
1110
1134
|
|
|
1111
|
-
var
|
|
1135
|
+
var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurrence, regardless of true or false setting
|
|
1112
1136
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
|
|
1137
|
+
if (kb.any(form, ui('canMintNew'))) {
|
|
1138
|
+
opts.mint = '* Create new *'; // @@ could be better
|
|
1116
1139
|
}
|
|
1117
1140
|
|
|
1118
|
-
var
|
|
1141
|
+
var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, uiFrom, opts, dataDoc, callbackFunction);
|
|
1142
|
+
rhs.appendChild(selector);
|
|
1143
|
+
var object;
|
|
1119
1144
|
|
|
1120
|
-
if (
|
|
1121
|
-
|
|
1145
|
+
if (selector.currentURI) {
|
|
1146
|
+
object = $rdf.sym(selector.currentURI);
|
|
1147
|
+
} else {
|
|
1148
|
+
object = kb.any(subject, property);
|
|
1149
|
+
}
|
|
1122
1150
|
|
|
1123
|
-
|
|
1151
|
+
if (object && subForm) {
|
|
1152
|
+
removeNextSiblingsAfterElement(selector);
|
|
1153
|
+
addSubFormChoice(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
|
|
1124
1154
|
}
|
|
1125
1155
|
|
|
1126
|
-
var selector = makeSelectForOptions(dom, kb, subject, property, possible2, opts, dataDoc, callbackFunction);
|
|
1127
|
-
rhs.appendChild(selector);
|
|
1128
|
-
if (object && subForm) addSubForm();
|
|
1129
1156
|
return box;
|
|
1130
|
-
};
|
|
1157
|
+
};
|
|
1158
|
+
/**
|
|
1159
|
+
* Removes all sibling elements after specified
|
|
1160
|
+
* @param {HTMLElement} currentElement
|
|
1161
|
+
* @private
|
|
1162
|
+
*/
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
function removeNextSiblingsAfterElement(currentElement) {
|
|
1166
|
+
while (currentElement.nextElementSibling) {
|
|
1167
|
+
currentElement.nextElementSibling.remove();
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
|
|
1172
|
+
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
|
|
1173
|
+
} // Documentation - non-interactive fields
|
|
1131
1174
|
//
|
|
1132
1175
|
|
|
1133
1176
|
|
|
@@ -1465,9 +1508,10 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
1465
1508
|
// @param subject - a term, the subject of the statement(s) being edited.
|
|
1466
1509
|
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
1467
1510
|
// @param possible - a list of terms, the possible value the object can take
|
|
1468
|
-
// @param options.
|
|
1469
|
-
// @param options.
|
|
1470
|
-
// option for none selected (for non
|
|
1511
|
+
// @param options.multiSelect - Boolean - Whether more than one at a time is allowed
|
|
1512
|
+
// @param options.firstSelectOptionText - a string to be displayed as the
|
|
1513
|
+
// option for none selected (for non multiSelect)
|
|
1514
|
+
// @param options.uiMultipleInUse - signals that the ui:choise is used with a ui:multiple
|
|
1471
1515
|
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
1472
1516
|
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
1473
1517
|
// @param dataDoc - The web document being edited
|
|
@@ -1475,7 +1519,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
1475
1519
|
*/
|
|
1476
1520
|
|
|
1477
1521
|
|
|
1478
|
-
function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
|
|
1522
|
+
function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, options, dataDoc, callbackFunction) {
|
|
1479
1523
|
log.debug('Select list length now ' + possible.length);
|
|
1480
1524
|
var n = 0;
|
|
1481
1525
|
var uris = {}; // Count them
|
|
@@ -1506,7 +1550,9 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1506
1550
|
actual = kb.findTypeURIs(subject);
|
|
1507
1551
|
} else {
|
|
1508
1552
|
kb.each(subject, predicate, null, dataDoc).forEach(function (x) {
|
|
1509
|
-
|
|
1553
|
+
if (x.uri) {
|
|
1554
|
+
actual[x.uri] = true;
|
|
1555
|
+
}
|
|
1510
1556
|
});
|
|
1511
1557
|
}
|
|
1512
1558
|
|
|
@@ -1516,8 +1562,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1516
1562
|
actual = getActual();
|
|
1517
1563
|
|
|
1518
1564
|
var onChange = function onChange(_e) {
|
|
1519
|
-
select.disabled = true; // until data written back - gives user feedback too
|
|
1520
|
-
|
|
1521
1565
|
var ds = [];
|
|
1522
1566
|
var is = [];
|
|
1523
1567
|
|
|
@@ -1533,6 +1577,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1533
1577
|
var opt = select.options[_i];
|
|
1534
1578
|
|
|
1535
1579
|
if (opt.selected && opt.AJAR_mint) {
|
|
1580
|
+
// not sure if this 'if' is used because I cannot find mintClass
|
|
1536
1581
|
if (options.mintClass) {
|
|
1537
1582
|
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
1538
1583
|
if (!ok) {
|
|
@@ -1547,11 +1592,14 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1547
1592
|
newObject = newThing(dataDoc);
|
|
1548
1593
|
}
|
|
1549
1594
|
|
|
1550
|
-
is.push($rdf.st(subject, predicate, newObject, dataDoc));
|
|
1595
|
+
is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
|
|
1596
|
+
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
1597
|
|
|
1552
1598
|
if (options.mintStatementsFun) {
|
|
1553
1599
|
is = is.concat(options.mintStatementsFun(newObject));
|
|
1554
1600
|
}
|
|
1601
|
+
|
|
1602
|
+
select.currentURI = newObject;
|
|
1555
1603
|
}
|
|
1556
1604
|
|
|
1557
1605
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
@@ -1559,11 +1607,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1559
1607
|
if (opt.selected && !(opt.AJAR_uri in actual)) {
|
|
1560
1608
|
// new class
|
|
1561
1609
|
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));
|
|
1610
|
+
select.currentURI = opt.AJAR_uri;
|
|
1567
1611
|
}
|
|
1568
1612
|
|
|
1569
1613
|
if (opt.selected) select.currentURI = opt.AJAR_uri;
|
|
@@ -1583,38 +1627,29 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1583
1627
|
sel = sel.superSelect;
|
|
1584
1628
|
}
|
|
1585
1629
|
|
|
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
|
|
1630
|
+
log.info('selectForOptions: data doc = ' + dataDoc); // refresh subForm
|
|
1596
1631
|
|
|
1632
|
+
removeNextSiblingsAfterElement(select);
|
|
1633
|
+
addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
|
|
1597
1634
|
if (ok) {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1635
|
+
kb.updater.update(ds, is, function (uri, success, errorBody) {
|
|
1636
|
+
actual = getActual(); // refresh
|
|
1637
|
+
|
|
1638
|
+
if (!success) select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
|
|
1639
|
+
});
|
|
1640
|
+
if (callbackFunction) callbackFunction(ok, {
|
|
1641
|
+
widget: 'select',
|
|
1642
|
+
event: 'new'
|
|
1643
|
+
});
|
|
1604
1644
|
} else {
|
|
1605
|
-
|
|
1645
|
+
select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
|
|
1606
1646
|
}
|
|
1607
|
-
|
|
1608
|
-
if (callbackFunction) callbackFunction(ok, {
|
|
1609
|
-
widget: 'select',
|
|
1610
|
-
event: 'change'
|
|
1611
|
-
});
|
|
1612
1647
|
});
|
|
1613
1648
|
};
|
|
1614
1649
|
|
|
1615
1650
|
var select = dom.createElement('select');
|
|
1616
1651
|
select.setAttribute('style', style.formSelectSTyle);
|
|
1617
|
-
if (options.
|
|
1652
|
+
if (options.multiSelect) select.setAttribute('multiSelect', 'true');
|
|
1618
1653
|
select.currentURI = null;
|
|
1619
1654
|
|
|
1620
1655
|
select.refresh = function () {
|
|
@@ -1665,11 +1700,14 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1665
1700
|
select.insertBefore(mint, select.firstChild);
|
|
1666
1701
|
}
|
|
1667
1702
|
|
|
1668
|
-
if (select.currentURI
|
|
1703
|
+
if (!select.currentURI && options.uiMultipleInUse) {
|
|
1669
1704
|
var prompt = dom.createElement('option');
|
|
1670
|
-
prompt.appendChild(dom.createTextNode(options.
|
|
1671
|
-
|
|
1705
|
+
prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
|
|
1706
|
+
prompt.disabled = true;
|
|
1707
|
+
prompt.value = true;
|
|
1708
|
+
prompt.hidden = true;
|
|
1672
1709
|
prompt.selected = true;
|
|
1710
|
+
select.insertBefore(prompt, select.firstChild);
|
|
1673
1711
|
}
|
|
1674
1712
|
|
|
1675
1713
|
if (editable) {
|
|
@@ -1688,11 +1726,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
1688
1726
|
function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
|
|
1689
1727
|
var du = kb.any(category, ns.owl('disjointUnionOf'));
|
|
1690
1728
|
var subs;
|
|
1691
|
-
var
|
|
1729
|
+
var multiSelect = false;
|
|
1692
1730
|
|
|
1693
1731
|
if (!du) {
|
|
1694
1732
|
subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
|
|
1695
|
-
|
|
1733
|
+
multiSelect = true;
|
|
1696
1734
|
} else {
|
|
1697
1735
|
subs = du.elements;
|
|
1698
1736
|
}
|
|
@@ -1700,16 +1738,15 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
|
|
|
1700
1738
|
log.debug('Select list length ' + subs.length);
|
|
1701
1739
|
|
|
1702
1740
|
if (subs.length === 0) {
|
|
1703
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (
|
|
1741
|
+
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
|
|
1704
1742
|
}
|
|
1705
1743
|
|
|
1706
1744
|
if (subs.length === 1) {
|
|
1707
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (
|
|
1745
|
+
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
|
|
1708
1746
|
}
|
|
1709
1747
|
|
|
1710
|
-
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
|
|
1711
|
-
|
|
1712
|
-
nullPrompt: '--classify--'
|
|
1748
|
+
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
|
|
1749
|
+
multiSelect: multiSelect
|
|
1713
1750
|
}, dataDoc, callbackFunction);
|
|
1714
1751
|
}
|
|
1715
1752
|
/** Make SELECT element to select subclasses recurively
|