solid-ui 2.4.22-34747cd0 → 2.4.22-b44c9cf2
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 +64 -51
- 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 +62 -49
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +3 -2
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-06T08:22:55Z',
|
|
15196
|
+
commit: 'b44c9cf2e68393ba76311294f65964fdb45d2dd9',
|
|
15197
15197
|
npmInfo: {
|
|
15198
15198
|
'solid-ui': '2.4.22',
|
|
15199
15199
|
npm: '6.14.16',
|
|
@@ -18120,6 +18120,14 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
18120
18120
|
**
|
|
18121
18121
|
** Not nested. Generates a link to something from a given class.
|
|
18122
18122
|
** Optional subform for the thing selected.
|
|
18123
|
+
** Generates a subForm based on a ui:use form
|
|
18124
|
+
** Will look like:
|
|
18125
|
+
** <div id=dropDownDiv>
|
|
18126
|
+
** <div id=labelOfDropDown>
|
|
18127
|
+
** <div id=selectDiv>
|
|
18128
|
+
** <select id=dropDownSelect>
|
|
18129
|
+
** <option> ....
|
|
18130
|
+
** <subForm>
|
|
18123
18131
|
** Alternative implementatons caould be:
|
|
18124
18132
|
** -- pop-up menu (as here)
|
|
18125
18133
|
** -- radio buttons
|
|
@@ -18162,11 +18170,12 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18162
18170
|
|
|
18163
18171
|
var possible = [];
|
|
18164
18172
|
var possibleProperties;
|
|
18165
|
-
var
|
|
18173
|
+
var firstSelectOptionText = '* Select from ' + utils.label(subject, true) + ' *';
|
|
18166
18174
|
var opts = {
|
|
18167
18175
|
form: form,
|
|
18176
|
+
subForm: subForm,
|
|
18168
18177
|
multiple: multiple,
|
|
18169
|
-
|
|
18178
|
+
firstSelectOptionText: firstSelectOptionText,
|
|
18170
18179
|
disambiguate: false
|
|
18171
18180
|
};
|
|
18172
18181
|
possible = kb.each(undefined, ns.rdf('type'), from, formDoc);
|
|
@@ -18211,26 +18220,45 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18211
18220
|
opts.disambiguate = true;
|
|
18212
18221
|
}
|
|
18213
18222
|
|
|
18214
|
-
var
|
|
18223
|
+
var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurance regardles if it is set to true or false
|
|
18215
18224
|
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
|
|
18225
|
+
if (kb.any(form, ui('canMintNew'))) {
|
|
18226
|
+
opts.mint = '* Create new *'; // @@ could be better
|
|
18219
18227
|
}
|
|
18220
18228
|
|
|
18221
|
-
var
|
|
18229
|
+
var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, opts, dataDoc, callbackFunction);
|
|
18230
|
+
rhs.appendChild(selector);
|
|
18231
|
+
var object;
|
|
18222
18232
|
|
|
18223
|
-
if (
|
|
18224
|
-
|
|
18233
|
+
if (selector.currentURI) {
|
|
18234
|
+
object = $rdf.sym(selector.currentURI);
|
|
18235
|
+
} else {
|
|
18236
|
+
object = kb.any(subject, property);
|
|
18237
|
+
}
|
|
18225
18238
|
|
|
18226
|
-
|
|
18239
|
+
if (object && subForm) {
|
|
18240
|
+
removeNextSiblingsAfterElement(selector);
|
|
18241
|
+
addSubFormDropDown(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
|
|
18227
18242
|
}
|
|
18228
18243
|
|
|
18229
|
-
var selector = makeSelectForOptions(dom, kb, subject, property, possible2, opts, dataDoc, callbackFunction);
|
|
18230
|
-
rhs.appendChild(selector);
|
|
18231
|
-
if (object && subForm) addSubForm();
|
|
18232
18244
|
return box;
|
|
18233
|
-
};
|
|
18245
|
+
};
|
|
18246
|
+
/**
|
|
18247
|
+
* Removes all sibling elements after specified
|
|
18248
|
+
* @param {HTMLElement} currentElement
|
|
18249
|
+
* @private
|
|
18250
|
+
*/
|
|
18251
|
+
|
|
18252
|
+
|
|
18253
|
+
function removeNextSiblingsAfterElement(currentElement) {
|
|
18254
|
+
while (currentElement.nextElementSibling) {
|
|
18255
|
+
currentElement.nextElementSibling.remove();
|
|
18256
|
+
}
|
|
18257
|
+
}
|
|
18258
|
+
|
|
18259
|
+
function addSubFormDropDown(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
|
|
18260
|
+
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
|
|
18261
|
+
} // Documentation - non-interactive fields
|
|
18234
18262
|
//
|
|
18235
18263
|
|
|
18236
18264
|
|
|
@@ -18569,7 +18597,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
18569
18597
|
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
18570
18598
|
// @param possible - a list of terms, the possible value the object can take
|
|
18571
18599
|
// @param options.multiple - Boolean - Whether more than one at a time is allowed
|
|
18572
|
-
// @param options.
|
|
18600
|
+
// @param options.firstSelectOptionText - a string to be displayed as the
|
|
18573
18601
|
// option for none selected (for non multiple)
|
|
18574
18602
|
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
18575
18603
|
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
@@ -18609,7 +18637,9 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18609
18637
|
actual = kb.findTypeURIs(subject);
|
|
18610
18638
|
} else {
|
|
18611
18639
|
kb.each(subject, predicate, null, dataDoc).forEach(function (x) {
|
|
18612
|
-
|
|
18640
|
+
if (x.uri) {
|
|
18641
|
+
actual[x.uri] = true;
|
|
18642
|
+
}
|
|
18613
18643
|
});
|
|
18614
18644
|
}
|
|
18615
18645
|
|
|
@@ -18636,25 +18666,9 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18636
18666
|
var opt = select.options[_i];
|
|
18637
18667
|
|
|
18638
18668
|
if (opt.selected && opt.AJAR_mint) {
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
callbackFunction(ok, body, {
|
|
18643
|
-
change: 'new'
|
|
18644
|
-
}); // @@ if ok, need some form of refresh of the select for the new thing
|
|
18645
|
-
}
|
|
18646
|
-
});
|
|
18647
|
-
select.parentNode.appendChild(thisForm);
|
|
18648
|
-
newObject = thisForm.AJAR_subject;
|
|
18649
|
-
} else {
|
|
18650
|
-
newObject = newThing(dataDoc);
|
|
18651
|
-
}
|
|
18652
|
-
|
|
18653
|
-
is.push($rdf.st(subject, predicate, newObject, dataDoc));
|
|
18654
|
-
|
|
18655
|
-
if (options.mintStatementsFun) {
|
|
18656
|
-
is = is.concat(options.mintStatementsFun(newObject));
|
|
18657
|
-
}
|
|
18669
|
+
newObject = newThing(dataDoc);
|
|
18670
|
+
removeNextSiblingsAfterElement(select);
|
|
18671
|
+
addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(newObject), options.subForm, dataDoc, callbackFunction);
|
|
18658
18672
|
}
|
|
18659
18673
|
|
|
18660
18674
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
@@ -18664,11 +18678,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18664
18678
|
is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
|
|
18665
18679
|
}
|
|
18666
18680
|
|
|
18667
|
-
if (!opt.selected && opt.AJAR_uri in actual) {
|
|
18668
|
-
// old class
|
|
18669
|
-
removeValue(kb.sym(opt.AJAR_uri));
|
|
18670
|
-
}
|
|
18671
|
-
|
|
18672
18681
|
if (opt.selected) select.currentURI = opt.AJAR_uri;
|
|
18673
18682
|
}
|
|
18674
18683
|
|
|
@@ -18694,16 +18703,18 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18694
18703
|
}
|
|
18695
18704
|
|
|
18696
18705
|
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
18706
|
+
removeNextSiblingsAfterElement(select);
|
|
18707
|
+
addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, callbackFunction);
|
|
18697
18708
|
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
18698
18709
|
actual = getActual(); // refresh
|
|
18699
18710
|
|
|
18700
18711
|
if (ok) {
|
|
18701
|
-
select.disabled = false; // data written back
|
|
18702
|
-
|
|
18703
18712
|
if (newObject) {
|
|
18704
|
-
|
|
18705
|
-
|
|
18713
|
+
removeNextSiblingsAfterElement(select);
|
|
18714
|
+
addSubFormDropDown(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
|
|
18706
18715
|
}
|
|
18716
|
+
|
|
18717
|
+
select.disabled = false; // data written back
|
|
18707
18718
|
} else {
|
|
18708
18719
|
return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
18709
18720
|
}
|
|
@@ -18768,11 +18779,14 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18768
18779
|
select.insertBefore(mint, select.firstChild);
|
|
18769
18780
|
}
|
|
18770
18781
|
|
|
18771
|
-
if (select.currentURI
|
|
18782
|
+
if (!select.currentURI && !options.multiple) {
|
|
18772
18783
|
var prompt = dom.createElement('option');
|
|
18773
|
-
prompt.appendChild(dom.createTextNode(options.
|
|
18774
|
-
select.insertBefore(prompt, select.firstChild);
|
|
18784
|
+
prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
|
|
18775
18785
|
prompt.selected = true;
|
|
18786
|
+
prompt.disabled = true;
|
|
18787
|
+
prompt.value = true;
|
|
18788
|
+
prompt.hidden = true;
|
|
18789
|
+
select.insertBefore(prompt, select.firstChild);
|
|
18776
18790
|
}
|
|
18777
18791
|
|
|
18778
18792
|
if (editable) {
|
|
@@ -18811,8 +18825,7 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
|
|
|
18811
18825
|
}
|
|
18812
18826
|
|
|
18813
18827
|
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
|
|
18814
|
-
multiple: multiple
|
|
18815
|
-
nullPrompt: '--classify--'
|
|
18828
|
+
multiple: multiple
|
|
18816
18829
|
}, dataDoc, callbackFunction);
|
|
18817
18830
|
}
|
|
18818
18831
|
/** Make SELECT element to select subclasses recurively
|