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.
- package/dist/main.js +54 -48
- 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 +53 -47
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -15192,8 +15192,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
15192
15192
|
}));
|
|
15193
15193
|
exports.versionInfo = void 0;
|
|
15194
15194
|
var versionInfo = {
|
|
15195
|
-
buildTime: '2022-05-
|
|
15196
|
-
commit: '
|
|
15195
|
+
buildTime: '2022-05-06T18:28:57Z',
|
|
15196
|
+
commit: '2b59ececdbeff0b9fc6c2b0710d65711cb6fce3b',
|
|
15197
15197
|
npmInfo: {
|
|
15198
15198
|
'solid-ui': '2.4.22',
|
|
15199
15199
|
npm: '6.14.16',
|
|
@@ -18158,12 +18158,6 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18158
18158
|
}
|
|
18159
18159
|
|
|
18160
18160
|
lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
|
|
18161
|
-
var from = kb.any(form, ui('from'));
|
|
18162
|
-
|
|
18163
|
-
if (!from) {
|
|
18164
|
-
return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
|
|
18165
|
-
}
|
|
18166
|
-
|
|
18167
18161
|
var subForm = kb.any(form, ui('use')); // Optional
|
|
18168
18162
|
|
|
18169
18163
|
var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
|
|
@@ -18178,19 +18172,25 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18178
18172
|
firstSelectOptionText: firstSelectOptionText,
|
|
18179
18173
|
disambiguate: false
|
|
18180
18174
|
};
|
|
18181
|
-
|
|
18175
|
+
var uiFrom = kb.any(form, ui('from'));
|
|
18176
|
+
|
|
18177
|
+
if (!uiFrom) {
|
|
18178
|
+
return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
|
|
18179
|
+
}
|
|
18180
|
+
|
|
18181
|
+
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
18182
18182
|
|
|
18183
|
-
for (var x in kb.findMembersNT(
|
|
18183
|
+
for (var x in kb.findMembersNT(uiFrom)) {
|
|
18184
18184
|
possible.push(kb.fromNT(x));
|
|
18185
18185
|
} // Use rdfs
|
|
18186
18186
|
|
|
18187
18187
|
|
|
18188
|
-
if (
|
|
18188
|
+
if (uiFrom.sameTerm(ns.rdfs('Class'))) {
|
|
18189
18189
|
for (p in buttons.allClassURIs()) {
|
|
18190
18190
|
possible.push(kb.sym(p));
|
|
18191
18191
|
} // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
|
|
18192
18192
|
|
|
18193
|
-
} else if (
|
|
18193
|
+
} else if (uiFrom.sameTerm(ns.rdf('Property'))) {
|
|
18194
18194
|
possibleProperties = buttons.propertyTriage(kb);
|
|
18195
18195
|
|
|
18196
18196
|
for (p in possibleProperties.op) {
|
|
@@ -18202,7 +18202,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18202
18202
|
}
|
|
18203
18203
|
|
|
18204
18204
|
opts.disambiguate = true; // This is a big class, and the labels won't be enough.
|
|
18205
|
-
} else if (
|
|
18205
|
+
} else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
|
|
18206
18206
|
possibleProperties = buttons.propertyTriage(kb);
|
|
18207
18207
|
|
|
18208
18208
|
for (p in possibleProperties.op) {
|
|
@@ -18210,7 +18210,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18210
18210
|
}
|
|
18211
18211
|
|
|
18212
18212
|
opts.disambiguate = true;
|
|
18213
|
-
} else if (
|
|
18213
|
+
} else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
|
|
18214
18214
|
possibleProperties = buttons.propertyTriage(kb);
|
|
18215
18215
|
|
|
18216
18216
|
for (p in possibleProperties.dp) {
|
|
@@ -18226,7 +18226,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18226
18226
|
opts.mint = '* Create new *'; // @@ could be better
|
|
18227
18227
|
}
|
|
18228
18228
|
|
|
18229
|
-
var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, opts, dataDoc, callbackFunction);
|
|
18229
|
+
var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, uiFrom, opts, dataDoc, callbackFunction);
|
|
18230
18230
|
rhs.appendChild(selector);
|
|
18231
18231
|
var object;
|
|
18232
18232
|
|
|
@@ -18238,7 +18238,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18238
18238
|
|
|
18239
18239
|
if (object && subForm) {
|
|
18240
18240
|
removeNextSiblingsAfterElement(selector);
|
|
18241
|
-
|
|
18241
|
+
addSubFormChoice(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
|
|
18242
18242
|
}
|
|
18243
18243
|
|
|
18244
18244
|
return box;
|
|
@@ -18256,7 +18256,7 @@ function removeNextSiblingsAfterElement(currentElement) {
|
|
|
18256
18256
|
}
|
|
18257
18257
|
}
|
|
18258
18258
|
|
|
18259
|
-
function
|
|
18259
|
+
function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
|
|
18260
18260
|
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
|
|
18261
18261
|
} // Documentation - non-interactive fields
|
|
18262
18262
|
//
|
|
@@ -18606,7 +18606,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
18606
18606
|
*/
|
|
18607
18607
|
|
|
18608
18608
|
|
|
18609
|
-
function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
|
|
18609
|
+
function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, options, dataDoc, callbackFunction) {
|
|
18610
18610
|
log.debug('Select list length now ' + possible.length);
|
|
18611
18611
|
var n = 0;
|
|
18612
18612
|
var uris = {}; // Count them
|
|
@@ -18649,8 +18649,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18649
18649
|
actual = getActual();
|
|
18650
18650
|
|
|
18651
18651
|
var onChange = function onChange(_e) {
|
|
18652
|
-
select.disabled = true; // until data written back - gives user feedback too
|
|
18653
|
-
|
|
18654
18652
|
var ds = [];
|
|
18655
18653
|
var is = [];
|
|
18656
18654
|
|
|
@@ -18666,9 +18664,29 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18666
18664
|
var opt = select.options[_i];
|
|
18667
18665
|
|
|
18668
18666
|
if (opt.selected && opt.AJAR_mint) {
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18667
|
+
// not sure if this if is used because I cannot find mintClass
|
|
18668
|
+
if (options.mintClass) {
|
|
18669
|
+
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
18670
|
+
if (!ok) {
|
|
18671
|
+
callbackFunction(ok, body, {
|
|
18672
|
+
change: 'new'
|
|
18673
|
+
}); // @@ if ok, need some form of refresh of the select for the new thing
|
|
18674
|
+
}
|
|
18675
|
+
});
|
|
18676
|
+
select.parentNode.appendChild(thisForm);
|
|
18677
|
+
newObject = thisForm.AJAR_subject;
|
|
18678
|
+
} else {
|
|
18679
|
+
newObject = newThing(dataDoc);
|
|
18680
|
+
}
|
|
18681
|
+
|
|
18682
|
+
is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
|
|
18683
|
+
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
|
|
18684
|
+
|
|
18685
|
+
if (options.mintStatementsFun) {
|
|
18686
|
+
is = is.concat(options.mintStatementsFun(newObject));
|
|
18687
|
+
}
|
|
18688
|
+
|
|
18689
|
+
select.currentURI = newObject;
|
|
18672
18690
|
}
|
|
18673
18691
|
|
|
18674
18692
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
@@ -18676,6 +18694,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18676
18694
|
if (opt.selected && !(opt.AJAR_uri in actual)) {
|
|
18677
18695
|
// new class
|
|
18678
18696
|
is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
|
|
18697
|
+
select.currentURI = opt.AJAR_uri;
|
|
18679
18698
|
}
|
|
18680
18699
|
|
|
18681
18700
|
if (opt.selected) select.currentURI = opt.AJAR_uri;
|
|
@@ -18695,34 +18714,21 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18695
18714
|
sel = sel.superSelect;
|
|
18696
18715
|
}
|
|
18697
18716
|
|
|
18698
|
-
|
|
18699
|
-
callbackFunction(ok, {
|
|
18700
|
-
widget: 'select',
|
|
18701
|
-
event: 'new'
|
|
18702
|
-
});
|
|
18703
|
-
}
|
|
18717
|
+
log.info('selectForOptions: data doc = ' + dataDoc); // refresh subForm
|
|
18704
18718
|
|
|
18705
|
-
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
18706
18719
|
removeNextSiblingsAfterElement(select);
|
|
18707
|
-
|
|
18708
|
-
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
18709
|
-
actual = getActual(); // refresh
|
|
18710
|
-
|
|
18720
|
+
addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
|
|
18711
18721
|
if (ok) {
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
addSubFormDropDown(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
|
|
18715
|
-
}
|
|
18716
|
-
|
|
18717
|
-
select.disabled = false; // data written back
|
|
18718
|
-
} else {
|
|
18719
|
-
return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
18720
|
-
}
|
|
18722
|
+
kb.updater.update(ds, is, function (uri, success, errorBody) {
|
|
18723
|
+
actual = getActual(); // refresh
|
|
18721
18724
|
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18725
|
+
if (!success) return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + errorBody));
|
|
18726
|
+
if (callbackFunction) callbackFunction(success, {
|
|
18727
|
+
widget: 'select',
|
|
18728
|
+
event: 'new'
|
|
18729
|
+
});
|
|
18730
|
+
});
|
|
18731
|
+
} else return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
|
|
18726
18732
|
});
|
|
18727
18733
|
};
|
|
18728
18734
|
|
|
@@ -18824,7 +18830,7 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
|
|
|
18824
18830
|
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
|
|
18825
18831
|
}
|
|
18826
18832
|
|
|
18827
|
-
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
|
|
18833
|
+
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
|
|
18828
18834
|
multiple: multiple
|
|
18829
18835
|
}, dataDoc, callbackFunction);
|
|
18830
18836
|
}
|