solid-ui 2.4.22-580e8bf6 → 2.4.22-62779f1d
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 +69 -123
- package/dist/main.js.map +1 -1
- package/lib/tabs.d.ts +1 -1
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +34 -21
- package/lib/tabs.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/forms.js +33 -100
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -13914,9 +13914,9 @@ function tabWidget(options) {
|
|
|
13914
13914
|
var marginsPrepped = margins.concat(margins).slice(orientation, orientation + 4);
|
|
13915
13915
|
var marginsStyle = "margin: ".concat(marginsPrepped.join(' '), ";");
|
|
13916
13916
|
var paddingStyle = "padding: ".concat(marginsPrepped.join(' '), ";");
|
|
13917
|
-
var tabStyle = cornersStyle + "padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
|
|
13918
|
-
var unselectedStyle = "".concat(tabStyle + marginsStyle, "opacity: 50%; background-color: ").concat(backgroundColor, ";");
|
|
13919
|
-
var selectedStyle = "".concat(tabStyle + marginsStyle, "background-color: ").concat(selectedColor, ";");
|
|
13917
|
+
var tabStyle = cornersStyle + "position: relative; padding: 0.7em; max-width: 20em; color: ".concat(color, ";");
|
|
13918
|
+
var unselectedStyle = "".concat(tabStyle + marginsStyle, " opacity: 50%; background-color: ").concat(backgroundColor, ";");
|
|
13919
|
+
var selectedStyle = "".concat(tabStyle + marginsStyle, " background-color: ").concat(selectedColor, ";");
|
|
13920
13920
|
var shownStyle = 'height: 100%; width: 100%;';
|
|
13921
13921
|
var hiddenStyle = shownStyle + 'display: none;';
|
|
13922
13922
|
rootElement.refresh = orderedSync;
|
|
@@ -13976,35 +13976,50 @@ function tabWidget(options) {
|
|
|
13976
13976
|
|
|
13977
13977
|
function makeNewSlot(item) {
|
|
13978
13978
|
var ele = dom.createElement(tabElement);
|
|
13979
|
+
ele.setAttribute('style', unselectedStyle);
|
|
13979
13980
|
ele.subject = item;
|
|
13980
|
-
var div = ele.appendChild(dom.createElement('
|
|
13981
|
-
div.setAttribute('style',
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13981
|
+
var div = ele.appendChild(dom.createElement('button'));
|
|
13982
|
+
div.setAttribute('style', 'background: none; border: none; font: inherit; cursor: pointer');
|
|
13983
|
+
var ellipsis = dom.createElement('button');
|
|
13984
|
+
ellipsis.textContent = '...';
|
|
13985
|
+
ellipsis.setAttribute('style', 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;');
|
|
13986
|
+
|
|
13987
|
+
div.onclick = function () {
|
|
13988
|
+
resetTabStyle();
|
|
13989
|
+
resetBodyStyle();
|
|
13990
|
+
ele.setAttribute('style', selectedStyle);
|
|
13991
|
+
if (!ele.bodyTR) return;
|
|
13992
|
+
ele.bodyTR.setAttribute('style', shownStyle);
|
|
13993
|
+
var bodyMain = getOrCreateContainerElement(ele);
|
|
13994
|
+
|
|
13995
|
+
if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
|
|
13996
|
+
bodyMain.innerHTML = 'loading item ...' + item;
|
|
13997
|
+
options.renderMain(bodyMain, ele.subject);
|
|
13998
|
+
bodyMain.asSettings = false;
|
|
13986
13999
|
}
|
|
14000
|
+
};
|
|
13987
14001
|
|
|
13988
|
-
|
|
14002
|
+
ellipsis.onclick = function () {
|
|
14003
|
+
resetTabStyle();
|
|
14004
|
+
resetBodyStyle();
|
|
14005
|
+
ele.setAttribute('style', selectedStyle);
|
|
13989
14006
|
if (!ele.bodyTR) return;
|
|
13990
14007
|
ele.bodyTR.setAttribute('style', shownStyle);
|
|
13991
14008
|
var bodyMain = getOrCreateContainerElement(ele);
|
|
13992
14009
|
|
|
13993
|
-
if (options.renderTabSettings &&
|
|
14010
|
+
if (options.renderTabSettings && ele.subject && bodyMain.asSettings !== true) {
|
|
13994
14011
|
bodyMain.innerHTML = 'loading settings ...' + item;
|
|
13995
14012
|
options.renderTabSettings(bodyMain, ele.subject);
|
|
13996
14013
|
bodyMain.asSettings = true;
|
|
13997
|
-
} else if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {
|
|
13998
|
-
bodyMain.innerHTML = 'loading item ...' + item;
|
|
13999
|
-
options.renderMain(bodyMain, ele.subject);
|
|
14000
|
-
bodyMain.asSettings = false;
|
|
14001
14014
|
}
|
|
14002
|
-
}
|
|
14015
|
+
};
|
|
14003
14016
|
|
|
14004
14017
|
if (options.renderTab) {
|
|
14005
14018
|
options.renderTab(div, item);
|
|
14019
|
+
ele.appendChild(ellipsis);
|
|
14006
14020
|
} else {
|
|
14007
|
-
div.
|
|
14021
|
+
div.innerHTML = (0, _utils.label)(item);
|
|
14022
|
+
ele.appendChild(ellipsis);
|
|
14008
14023
|
}
|
|
14009
14024
|
|
|
14010
14025
|
return ele;
|
|
@@ -14084,10 +14099,8 @@ function tabWidget(options) {
|
|
|
14084
14099
|
|
|
14085
14100
|
if (_tab.classList.contains('unstyled')) {
|
|
14086
14101
|
continue;
|
|
14087
|
-
}
|
|
14088
|
-
|
|
14089
|
-
if (_tab.children[0]) {
|
|
14090
|
-
_tab.children[0].setAttribute('style', unselectedStyle);
|
|
14102
|
+
} else {
|
|
14103
|
+
_tab.setAttribute('style', unselectedStyle);
|
|
14091
14104
|
}
|
|
14092
14105
|
}
|
|
14093
14106
|
}
|
|
@@ -15192,8 +15205,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
15192
15205
|
}));
|
|
15193
15206
|
exports.versionInfo = void 0;
|
|
15194
15207
|
var versionInfo = {
|
|
15195
|
-
buildTime: '2022-05-
|
|
15196
|
-
commit: '
|
|
15208
|
+
buildTime: '2022-05-25T07:28:38Z',
|
|
15209
|
+
commit: '62779f1dbf177b64898b43dc69f011f10a8b1cf8',
|
|
15197
15210
|
npmInfo: {
|
|
15198
15211
|
'solid-ui': '2.4.22',
|
|
15199
15212
|
npm: '6.14.17',
|
|
@@ -17371,47 +17384,43 @@ _fieldFunction.field[ns.ui('Options').uri] = function (dom, container, already,
|
|
|
17371
17384
|
values = kb.each(subject, dependingOn);
|
|
17372
17385
|
}
|
|
17373
17386
|
|
|
17374
|
-
|
|
17375
|
-
|
|
17376
|
-
|
|
17377
|
-
for (var i = 0; i < cases.length; i++) {
|
|
17378
|
-
var c = cases[i];
|
|
17379
|
-
var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
|
|
17387
|
+
for (var i = 0; i < cases.length; i++) {
|
|
17388
|
+
var c = cases[i];
|
|
17389
|
+
var tests = kb.each(c, ui('for'), null, formDoc); // There can be multiple 'for'
|
|
17380
17390
|
|
|
17381
|
-
|
|
17391
|
+
var match = false;
|
|
17382
17392
|
|
|
17383
|
-
|
|
17384
|
-
|
|
17385
|
-
|
|
17393
|
+
for (var j = 0; j < tests.length; j++) {
|
|
17394
|
+
var _iterator = _createForOfIteratorHelper(values),
|
|
17395
|
+
_step;
|
|
17386
17396
|
|
|
17387
|
-
|
|
17388
|
-
|
|
17389
|
-
|
|
17390
|
-
|
|
17397
|
+
try {
|
|
17398
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
17399
|
+
var value = _step.value;
|
|
17400
|
+
var test = tests[j];
|
|
17391
17401
|
|
|
17392
|
-
|
|
17393
|
-
|
|
17394
|
-
}
|
|
17402
|
+
if (value.sameTerm(tests) || value.termType === test.termType && value.value === test.value) {
|
|
17403
|
+
match = true;
|
|
17395
17404
|
}
|
|
17396
|
-
} catch (err) {
|
|
17397
|
-
_iterator.e(err);
|
|
17398
|
-
} finally {
|
|
17399
|
-
_iterator.f();
|
|
17400
17405
|
}
|
|
17406
|
+
} catch (err) {
|
|
17407
|
+
_iterator.e(err);
|
|
17408
|
+
} finally {
|
|
17409
|
+
_iterator.f();
|
|
17401
17410
|
}
|
|
17411
|
+
}
|
|
17402
17412
|
|
|
17403
|
-
|
|
17404
|
-
|
|
17405
|
-
|
|
17406
|
-
if (!_field3) {
|
|
17407
|
-
box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
|
|
17408
|
-
return box;
|
|
17409
|
-
} else {
|
|
17410
|
-
appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
|
|
17411
|
-
}
|
|
17413
|
+
if (match) {
|
|
17414
|
+
var _field3 = kb.the(c, ui('use'));
|
|
17412
17415
|
|
|
17413
|
-
|
|
17416
|
+
if (!_field3) {
|
|
17417
|
+
box.appendChild((0, _error.errorMessageBlock)(dom, 'No "use" part for case in form ' + form));
|
|
17418
|
+
return box;
|
|
17419
|
+
} else {
|
|
17420
|
+
appendForm(dom, box, already, subject, _field3, dataDoc, callbackFunction);
|
|
17414
17421
|
}
|
|
17422
|
+
|
|
17423
|
+
break;
|
|
17415
17424
|
}
|
|
17416
17425
|
} // @@ Add box.refresh() to sync fields with values
|
|
17417
17426
|
|
|
@@ -18230,6 +18239,8 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
18230
18239
|
opts.disambiguate = true;
|
|
18231
18240
|
}
|
|
18232
18241
|
|
|
18242
|
+
var object = kb.any(subject, property);
|
|
18243
|
+
if (object) possible.push(object);
|
|
18233
18244
|
return sortByLabel(possible);
|
|
18234
18245
|
} // TODO: this checks for any occurrence, regardless of true or false setting
|
|
18235
18246
|
|
|
@@ -18605,10 +18616,8 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
18605
18616
|
// @param subject - a term, the subject of the statement(s) being edited.
|
|
18606
18617
|
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
18607
18618
|
// @param possible - a list of terms, the possible value the object can take
|
|
18608
|
-
// @param options.multiple - Boolean - Whether more than one at a time is allowed
|
|
18609
18619
|
// @param options.nullLabel - a string to be displayed as the
|
|
18610
18620
|
// option for none selected (for non multiple)
|
|
18611
|
-
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
18612
18621
|
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
18613
18622
|
// @param dataDoc - The web document being edited
|
|
18614
18623
|
// @param callbackFunction - takes (boolean ok, string errorBody)
|
|
@@ -18632,7 +18641,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18632
18641
|
} // uris is now the set of possible options
|
|
18633
18642
|
|
|
18634
18643
|
|
|
18635
|
-
if (n === 0
|
|
18644
|
+
if (n === 0) {
|
|
18636
18645
|
return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
|
|
18637
18646
|
}
|
|
18638
18647
|
|
|
@@ -18669,34 +18678,8 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18669
18678
|
}
|
|
18670
18679
|
};
|
|
18671
18680
|
|
|
18672
|
-
var newObject;
|
|
18673
|
-
|
|
18674
18681
|
for (var _i = 0; _i < select.options.length; _i++) {
|
|
18675
18682
|
var opt = select.options[_i];
|
|
18676
|
-
|
|
18677
|
-
if (opt.selected && opt.AJAR_mint) {
|
|
18678
|
-
// not sure if this 'if' is used because I cannot find mintClass
|
|
18679
|
-
if (options.mintClass) {
|
|
18680
|
-
var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
|
|
18681
|
-
if (!ok) {
|
|
18682
|
-
callbackFunction(ok, body, {
|
|
18683
|
-
change: 'new'
|
|
18684
|
-
}); // @@ if ok, need some form of refresh of the select for the new thing
|
|
18685
|
-
}
|
|
18686
|
-
});
|
|
18687
|
-
select.parentNode.appendChild(thisForm);
|
|
18688
|
-
newObject = thisForm.AJAR_subject;
|
|
18689
|
-
} else {
|
|
18690
|
-
newObject = newThing(dataDoc);
|
|
18691
|
-
}
|
|
18692
|
-
|
|
18693
|
-
is.push($rdf.st(subject, predicate, newObject, dataDoc)); // not sure if this 'if' is used because I cannot find mintStatementsFun
|
|
18694
|
-
|
|
18695
|
-
if (options.mintStatementsFun) {
|
|
18696
|
-
is = is.concat(options.mintStatementsFun(newObject));
|
|
18697
|
-
}
|
|
18698
|
-
}
|
|
18699
|
-
|
|
18700
18683
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
18701
18684
|
|
|
18702
18685
|
if (opt.selected && !(opt.AJAR_uri in actual)) {
|
|
@@ -18726,24 +18709,12 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18726
18709
|
sel = sel.superSelect;
|
|
18727
18710
|
}
|
|
18728
18711
|
|
|
18729
|
-
function doneNew(ok, _body) {
|
|
18730
|
-
callbackFunction(ok, {
|
|
18731
|
-
widget: 'select',
|
|
18732
|
-
event: 'new'
|
|
18733
|
-
});
|
|
18734
|
-
}
|
|
18735
|
-
|
|
18736
18712
|
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
18737
18713
|
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
18738
18714
|
actual = getActual(); // refresh
|
|
18739
18715
|
|
|
18740
18716
|
if (ok) {
|
|
18741
18717
|
select.disabled = false; // data written back
|
|
18742
|
-
|
|
18743
|
-
if (newObject) {
|
|
18744
|
-
var fn = (0, _fieldFunction.fieldFunction)(dom, options.subForm);
|
|
18745
|
-
fn(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
|
|
18746
|
-
}
|
|
18747
18718
|
} else {
|
|
18748
18719
|
return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
18749
18720
|
}
|
|
@@ -18757,7 +18728,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18757
18728
|
|
|
18758
18729
|
var select = dom.createElement('select');
|
|
18759
18730
|
select.setAttribute('style', style.formSelectSTyle);
|
|
18760
|
-
if (options.multiple) select.setAttribute('multiple', 'true');
|
|
18761
18731
|
select.currentURI = null;
|
|
18762
18732
|
|
|
18763
18733
|
select.refresh = function () {
|
|
@@ -18800,15 +18770,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18800
18770
|
select.appendChild(option);
|
|
18801
18771
|
}
|
|
18802
18772
|
|
|
18803
|
-
if (
|
|
18804
|
-
var mint = dom.createElement('option');
|
|
18805
|
-
mint.appendChild(dom.createTextNode(options.mint));
|
|
18806
|
-
mint.AJAR_mint = true; // Flag it
|
|
18807
|
-
|
|
18808
|
-
select.insertBefore(mint, select.firstChild);
|
|
18809
|
-
}
|
|
18810
|
-
|
|
18811
|
-
if (select.currentURI == null && !options.multiple) {
|
|
18773
|
+
if (!select.currentURI) {
|
|
18812
18774
|
var prompt = dom.createElement('option');
|
|
18813
18775
|
prompt.appendChild(dom.createTextNode(options.nullLabel));
|
|
18814
18776
|
select.insertBefore(prompt, select.firstChild);
|
|
@@ -18831,28 +18793,16 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
18831
18793
|
function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
|
|
18832
18794
|
var du = kb.any(category, ns.owl('disjointUnionOf'));
|
|
18833
18795
|
var subs;
|
|
18834
|
-
var multiple = false;
|
|
18835
18796
|
|
|
18836
18797
|
if (!du) {
|
|
18837
18798
|
subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
|
|
18838
|
-
multiple = true;
|
|
18839
18799
|
} else {
|
|
18840
18800
|
subs = du.elements;
|
|
18841
18801
|
}
|
|
18842
18802
|
|
|
18843
18803
|
log.debug('Select list length ' + subs.length);
|
|
18844
|
-
|
|
18845
|
-
if (subs.length === 0) {
|
|
18846
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
|
|
18847
|
-
}
|
|
18848
|
-
|
|
18849
|
-
if (subs.length === 1) {
|
|
18850
|
-
return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
|
|
18851
|
-
}
|
|
18852
|
-
|
|
18853
18804
|
return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
|
|
18854
|
-
|
|
18855
|
-
nullPrompt: '--classify--'
|
|
18805
|
+
nullLabel: '* Select type *'
|
|
18856
18806
|
}, dataDoc, callbackFunction);
|
|
18857
18807
|
}
|
|
18858
18808
|
/** Make SELECT element to select subclasses recurively
|
|
@@ -18886,8 +18836,7 @@ function makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, callba
|
|
|
18886
18836
|
function onChange(ok, body) {
|
|
18887
18837
|
if (ok) update();
|
|
18888
18838
|
callbackFunction(ok, body);
|
|
18889
|
-
}
|
|
18890
|
-
|
|
18839
|
+
}
|
|
18891
18840
|
|
|
18892
18841
|
var select = makeSelectForCategory(dom, kb, subject, category, dataDoc, onChange);
|
|
18893
18842
|
container.appendChild(select);
|
|
@@ -19106,8 +19055,6 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
19106
19055
|
select.setAttribute('style', style.formSelectSTyle);
|
|
19107
19056
|
if (options.multiSelect) select.setAttribute('multiSelect', 'true');
|
|
19108
19057
|
select.currentURI = null;
|
|
19109
|
-
var object = kb.any(subject, predicate);
|
|
19110
|
-
if (object) select.currentURI = object;
|
|
19111
19058
|
|
|
19112
19059
|
for (var uri in uris) {
|
|
19113
19060
|
select.appendChild(createOption(uri));
|
|
@@ -19232,7 +19179,6 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
19232
19179
|
select.addEventListener('change', onChange, false);
|
|
19233
19180
|
}
|
|
19234
19181
|
|
|
19235
|
-
select.refresh();
|
|
19236
19182
|
return select;
|
|
19237
19183
|
} // makeSelectForChoice
|
|
19238
19184
|
//# sourceMappingURL=forms.js.map
|