solid-ui 2.4.22-b44c9cf2 → 2.4.22-b6c56d6e

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/README.md CHANGED
@@ -7,13 +7,26 @@ User Interface widgets and utilities for Solid (solid-ui)
7
7
  These are HTML5 widgets which connect to a solid store. Building blocks for solid-based apps.
8
8
  Vanilla JS. Includes large widgets like chat, table, matrix, form fields, and small widgets.
9
9
 
10
+ See [Solid-Ui Storybook](http://solidos.github.io/solid-ui/examples/storybook/) for SolidUI widgets.
11
+ See [Solid-UI API](https://solidos.github.io/solid-ui/Documentation/api/) for SolidUI functions.
12
+ See [Forms introduction](./Documentation/FormsReadme.md) for UI vocabulary implementation.
13
+
14
+ Table of content:
15
+ - Getting started(#getting-started)
16
+ - Further documentation(#further-ocumentation)
17
+
18
+
10
19
  ## Getting started
20
+
21
+ Contributions of bug fixes and new functionality, documentation, and tests are
22
+ always appreciated.
23
+
11
24
  ### In npm-based projects
12
25
  When including solid-ui in an npm-based project, you can use it with:
13
26
 
14
27
  ```js
15
- import { ns, rdf, acl, aclControl, authn, create, dom, icons, log, matrix, media,
16
- messageArea, infiniteMessageArea, pad, preferences, store, style, table, tabs, utils, widgets, versionInfo
28
+ import { ns, rdf, acl, aclControl, create, dom, icons, log, matrix, media,
29
+ messageArea, infiniteMessageArea, pad, preferences, style, table, tabs, utils, widgets, versionInfo
17
30
  } from 'solid-ui'
18
31
 
19
32
  ```
@@ -23,10 +36,8 @@ Clone this repo, and in the repo root run:
23
36
  * `npm install`
24
37
  * `npm run build`
25
38
 
26
- This will generate a `lib/` folder containing, among other artifacts, `lib/webpack-bundle.js`.
27
- Now run `npx serve` and go to http://localhost:5000/examples/ with your browser to see some examples.
28
- See the ['examples' folder](https://github.com/solidos/solid-ui/tree/examples/examples) for the
29
- source code of those examples.
39
+ This will generate a `dist/` folder containing, among other artifacts, `dist/main.js`.
40
+ Now run `npx serve` and go to http://localhost:3000/Documentation/ with your browser to see some examples.
30
41
 
31
42
  While viewing one of those examples, you can open the web console in your browser and for instance
32
43
  try how you can create a button:
@@ -44,56 +55,7 @@ const chat = UI.infiniteMessageArea(document, store, UI.rdf.namedNode(chatChanne
44
55
  document.body.appendChild(chat)
45
56
  ```
46
57
 
47
- Or a full ACL Control Box:
48
- ```js
49
- const exampleFolder = 'https://example-user.inrupt.net/public/public-control/'
50
- const aclControlBox = UI.aclControl.ACLControlBox5(UI.rdf.namedNode(exampleFolder), { dom: document }, '', store)
51
- document.body.appendChild(aclControlBox)
52
- ```
53
-
54
-
55
- ## Documentation
56
- - [talk presentation](https://solidos.github.io/solid-ui/Documentation/talks/FormsTalk.html)
57
- - API https://solidos.github.io/solid-ui/Documentation/api/ for the API documentation.
58
- - The UI components are presented in a [storybook](http://solidos.github.io/solid-ui/examples/storybook/).
59
-
60
- ## Overview
61
- This has been a place to put any functionality from solid views which has been generalized to be usable in other views.
62
-
63
- - Authentication UI: manage the user's logged in/out state.
64
- - Discovery: finding the user's stuff, and leaving records of new things
65
- - Preferences: UI for managing a user's preferences with two axes of defaults
66
- - An Access Control List widget for Solid ACL system
67
- - Acess Control Logic
68
- - Create a new object from modules/extensions which have registered their ability to create things
69
-
70
- - A [form system](https://solidos.github.io/solid-ui/Documentation/forms-intro.html): Forms are defined in RDF, and create/edit RDF data, including form definitions
71
- - A collection of shortcut namespace objects for a selection of relevant RDF vocabularies.
72
- - Small atomic widgets (buttons etc) of which the others are constructed.
73
- - An error message panel
74
-
75
- Some of the larger controls include:
76
-
77
- - A chat widget: add discussion to any object. Infinite scroll, embedded images, social reactions, etc etc
78
- - A people picker widget for choosing a set of people or an existing group
79
- - A general purpose table display with built-in faceted browsing
80
- - A two-dimentional matrix of editable live data that extends in both dimensions.
81
- - A notepad of shared notes for real-time collaboration
82
- - Drag and drop code for linking things and uploading files
83
- - A set of tabs for holding other widgets and arbitrary UI elements
84
-
85
- The typical style of the widgets is to know what data it has been derived from,
86
- allow users to edit it, and to automatically sync with data as it changes in the future.
87
- To see how these are used, see the panes which use them within the data browser.
88
-
89
- The level of support for this varies.
90
-
91
- See also: [A short introduction to the Form system](https://solidos.github.io/solid-ui/Documentation/forms-intro.html)
92
-
93
- Contributions of bug fixes and new functionality, documentation, and tests are
94
- always appreciated.
95
-
96
- ## Development
58
+ ### Development new components
97
59
 
98
60
  When developing a component in solid-ui you can test it in isolation using storybook
99
61
 
@@ -104,5 +66,8 @@ npm run storybook
104
66
 
105
67
  If there is no story for the component yet, add a new one to `./src/stories`.
106
68
 
107
- When you want to test the component within a solid-pane, you can use the [development mode of solid-panes](https://github.com/solidos/solid-panes#development) or
108
- [mashlib-dev](https://github.com/solidos/mashlib-dev).
69
+ When you want to test the component within a solid-pane, you can use the [development mode of solid-panes](https://github.com/solidos/solid-panes#development).
70
+
71
+ ## Further documentation
72
+
73
+ - [Some code know-how](https://github.com/SolidOS/solidos/wiki/2.-Solid-UI-know-how)
package/dist/main.js CHANGED
@@ -15192,11 +15192,11 @@ Object.defineProperty(exports, "__esModule", ({
15192
15192
  }));
15193
15193
  exports.versionInfo = void 0;
15194
15194
  var versionInfo = {
15195
- buildTime: '2022-05-06T08:22:55Z',
15196
- commit: 'b44c9cf2e68393ba76311294f65964fdb45d2dd9',
15195
+ buildTime: '2022-05-13T07:24:35Z',
15196
+ commit: 'b6c56d6e4cc213af98abeaf6c3e853f34c7dd939',
15197
15197
  npmInfo: {
15198
15198
  'solid-ui': '2.4.22',
15199
- npm: '6.14.16',
15199
+ npm: '6.14.17',
15200
15200
  ares: '1.18.1',
15201
15201
  brotli: '1.0.9',
15202
15202
  cldr: '40.0',
@@ -15205,12 +15205,12 @@ var versionInfo = {
15205
15205
  modules: '83',
15206
15206
  napi: '8',
15207
15207
  nghttp2: '1.42.0',
15208
- node: '14.19.1',
15208
+ node: '14.19.2',
15209
15209
  openssl: '1.1.1n',
15210
15210
  tz: '2021a3',
15211
15211
  unicode: '14.0',
15212
15212
  uv: '1.42.0',
15213
- v8: '8.4.371.23-node.85',
15213
+ v8: '8.4.371.23-node.87',
15214
15214
  zlib: '1.2.11'
15215
15215
  }
15216
15216
  };
@@ -16280,6 +16280,7 @@ function openHrefInOutlineMode(e) {
16280
16280
 
16281
16281
  if (dom.outlineManager) {
16282
16282
  // @@ TODO Remove the use of document as a global object
16283
+ // TODO fix dependency cycle to solid-panes by calling outlineManager
16283
16284
  ;
16284
16285
  dom.outlineManager.GotoSubject(_solidLogic.store.sym(uri), true, undefined, true, undefined);
16285
16286
  } else if (window && window.panes && window.panes.getOutliner) {
@@ -16407,6 +16408,7 @@ function linkButton(dom, object) {
16407
16408
  b.textContent = 'Goto ' + utils.label(object);
16408
16409
  b.addEventListener('click', function (_event) {
16409
16410
  // b.parentNode.removeChild(b)
16411
+ // TODO fix dependency cycle to solid-panes by calling outlineManager
16410
16412
  ;
16411
16413
  dom.outlineManager.GotoSubject(object, true, undefined, true, undefined);
16412
16414
  }, true);
@@ -17262,10 +17264,11 @@ _fieldFunction.field[ns.ui('Form').uri] = _fieldFunction.field[ns.ui('Group').ur
17262
17264
 
17263
17265
  if (already[key]) {
17264
17266
  // been there done that
17265
- box.appendChild(dom.createTextNode('Group: see above ' + key));
17266
- var plist = [$rdf.st(subject, ns.owl('sameAs'), subject)]; // @@ need prev subject
17267
+ box.appendChild(dom.createTextNode('Group: see above ' + key)); // TODO fix dependency cycle to solid-panes by calling outlineManager
17268
+ // const plist = [$rdf.st(subject, ns.owl('sameAs'), subject)] // @@ need prev subject
17269
+ // dom.outlineManager.appendPropertyTRs(box, plist)
17270
+ // dom.appendChild(plist)
17267
17271
 
17268
- dom.outlineManager.appendPropertyTRs(box, plist);
17269
17272
  return box;
17270
17273
  }
17271
17274
 
@@ -17694,7 +17697,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17694
17697
  // delete button and move buttons
17695
17698
 
17696
17699
  if (kb.updater.editable(dataDoc.uri)) {
17697
- buttons.deleteButtonWithCheck(dom, subField, utils.label(property), deleteThisItem);
17700
+ buttons.deleteButtonWithCheck(dom, subField, multipleUIlabel, deleteThisItem);
17698
17701
 
17699
17702
  if (ordered) {
17700
17703
  // Add controsl in a frame
@@ -17745,7 +17748,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17745
17748
 
17746
17749
  var _shim = dom.createElement('div');
17747
17750
 
17748
- _shim.appendChild(subField); // Subfield has its own laytout
17751
+ _shim.appendChild(subField); // Subfield has its own layout
17749
17752
 
17750
17753
 
17751
17754
  frame.appendChild(_shim);
@@ -17794,6 +17797,8 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17794
17797
  return shim;
17795
17798
  }
17796
17799
 
17800
+ var multipleUIlabel = kb.any(form, ui('label'));
17801
+ if (!multipleUIlabel) multipleUIlabel = utils.label(property);
17797
17802
  var min = kb.any(form, ui('min')); // This is the minimum number -- default 0
17798
17803
 
17799
17804
  min = min ? 0 + min.value : 0;
@@ -17834,10 +17839,9 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17834
17839
  img.setAttribute('src', plusIconURI); // plus sign
17835
17840
 
17836
17841
  img.setAttribute('style', 'margin: 0.2em; width: 1.5em; height:1.5em');
17837
- img.title = 'Click to add one or more ' + utils.predicateLabel(property, reverse);
17838
- var prompt = tail.appendChild(dom.createElement('span'));
17839
- prompt.textContent = (values.length === 0 ? 'Add one or more ' : 'Add more ') + utils.predicateLabel(property, reverse); // utils.label(property)
17840
-
17842
+ img.title = 'Click to add another ' + multipleUIlabel;
17843
+ var prompt = dom.createElement('span');
17844
+ prompt.textContent = (values.length === 0 ? 'Add another ' : 'Add ') + multipleUIlabel;
17841
17845
  tail.addEventListener('click', /*#__PURE__*/function () {
17842
17846
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_eventNotUsed) {
17843
17847
  return _regenerator["default"].wrap(function _callee5$(_context5) {
@@ -17859,6 +17863,7 @@ _fieldFunction.field[ns.ui('Multiple').uri] = function (dom, container, already,
17859
17863
  return _ref3.apply(this, arguments);
17860
17864
  };
17861
17865
  }(), true);
17866
+ tail.appendChild(prompt);
17862
17867
  }
17863
17868
 
17864
17869
  function createListIfNecessary() {
@@ -18133,23 +18138,28 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
18133
18138
  ** -- radio buttons
18134
18139
  ** -- auto-complete typing
18135
18140
  **
18136
- ** Todo: Deal with multiple. Maybe merge with multiple code.
18141
+ ** TODO: according to ontology ui:choice can also have ns.ui('default') - this is not implemented yet
18137
18142
  */
18138
18143
 
18139
18144
 
18140
18145
  _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, subject, form, dataDoc, callbackFunction) {
18141
18146
  var ui = ns.ui;
18142
18147
  var kb = _solidLogic.store;
18143
- var multiple = false;
18144
18148
  var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
18145
18149
 
18150
+ var uiMultipleInUse = false; // this signals to ui:choice that it is part of a ui:multiple
18151
+
18152
+ var multiSelect = false;
18146
18153
  var p;
18147
- var box = dom.createElement('div'); // Set flexDirection column?
18154
+ var box = dom.createElement('div');
18155
+ box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
18148
18156
 
18149
18157
  if (container) container.appendChild(box);
18150
18158
  var lhs = dom.createElement('div');
18159
+ lhs.setAttribute('class', 'formFieldName choiceBox-label');
18151
18160
  box.appendChild(lhs);
18152
18161
  var rhs = dom.createElement('div');
18162
+ rhs.setAttribute('class', 'formFieldValue choiceBox-selectBox');
18153
18163
  box.appendChild(rhs);
18154
18164
  var property = kb.any(form, ui('property'));
18155
18165
 
@@ -18158,9 +18168,9 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18158
18168
  }
18159
18169
 
18160
18170
  lhs.appendChild((0, _basic.fieldLabel)(dom, property, form));
18161
- var from = kb.any(form, ui('from'));
18171
+ var uiFrom = kb.any(form, ui('from'));
18162
18172
 
18163
- if (!from) {
18173
+ if (!uiFrom) {
18164
18174
  return (0, _error.errorMessageBlock)(dom, "No 'from' for Choice: " + form);
18165
18175
  }
18166
18176
 
@@ -18170,27 +18180,39 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18170
18180
 
18171
18181
  var possible = [];
18172
18182
  var possibleProperties;
18173
- var firstSelectOptionText = '* Select from ' + utils.label(subject, true) + ' *';
18183
+ var firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *'; // if we do NOT have a container it means it is a ui:Multiple
18184
+ // only important for the first option text in select
18185
+
18186
+ if (!container) {
18187
+ uiMultipleInUse = true;
18188
+ firstSelectOptionText = utils.label(subject, true);
18189
+ }
18190
+
18191
+ if (subject.termType === 'BlankNode') {
18192
+ firstSelectOptionText = '* Select for ' + utils.label(property) + ' *';
18193
+ }
18194
+
18174
18195
  var opts = {
18175
18196
  form: form,
18176
18197
  subForm: subForm,
18177
- multiple: multiple,
18198
+ multiSelect: multiSelect,
18178
18199
  firstSelectOptionText: firstSelectOptionText,
18200
+ uiMultipleInUse: uiMultipleInUse,
18179
18201
  disambiguate: false
18180
18202
  };
18181
- possible = kb.each(undefined, ns.rdf('type'), from, formDoc);
18203
+ possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
18182
18204
 
18183
- for (var x in kb.findMembersNT(from)) {
18205
+ for (var x in kb.findMembersNT(uiFrom)) {
18184
18206
  possible.push(kb.fromNT(x));
18185
18207
  } // Use rdfs
18186
18208
 
18187
18209
 
18188
- if (from.sameTerm(ns.rdfs('Class'))) {
18210
+ if (uiFrom.sameTerm(ns.rdfs('Class'))) {
18189
18211
  for (p in buttons.allClassURIs()) {
18190
18212
  possible.push(kb.sym(p));
18191
18213
  } // log.debug("%%% Choice field: possible.length 2 = "+possible.length)
18192
18214
 
18193
- } else if (from.sameTerm(ns.rdf('Property'))) {
18215
+ } else if (uiFrom.sameTerm(ns.rdf('Property'))) {
18194
18216
  possibleProperties = buttons.propertyTriage(kb);
18195
18217
 
18196
18218
  for (p in possibleProperties.op) {
@@ -18202,7 +18224,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18202
18224
  }
18203
18225
 
18204
18226
  opts.disambiguate = true; // This is a big class, and the labels won't be enough.
18205
- } else if (from.sameTerm(ns.owl('ObjectProperty'))) {
18227
+ } else if (uiFrom.sameTerm(ns.owl('ObjectProperty'))) {
18206
18228
  possibleProperties = buttons.propertyTriage(kb);
18207
18229
 
18208
18230
  for (p in possibleProperties.op) {
@@ -18210,7 +18232,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18210
18232
  }
18211
18233
 
18212
18234
  opts.disambiguate = true;
18213
- } else if (from.sameTerm(ns.owl('DatatypeProperty'))) {
18235
+ } else if (uiFrom.sameTerm(ns.owl('DatatypeProperty'))) {
18214
18236
  possibleProperties = buttons.propertyTriage(kb);
18215
18237
 
18216
18238
  for (p in possibleProperties.dp) {
@@ -18220,13 +18242,13 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18220
18242
  opts.disambiguate = true;
18221
18243
  }
18222
18244
 
18223
- var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurance regardles if it is set to true or false
18245
+ var sortedPossible = sortByLabel(possible); // TODO: this checks for any occurrence, regardless of true or false setting
18224
18246
 
18225
18247
  if (kb.any(form, ui('canMintNew'))) {
18226
18248
  opts.mint = '* Create new *'; // @@ could be better
18227
18249
  }
18228
18250
 
18229
- var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, opts, dataDoc, callbackFunction);
18251
+ var selector = makeSelectForOptions(dom, kb, subject, property, sortedPossible, uiFrom, opts, dataDoc, callbackFunction);
18230
18252
  rhs.appendChild(selector);
18231
18253
  var object;
18232
18254
 
@@ -18238,7 +18260,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
18238
18260
 
18239
18261
  if (object && subForm) {
18240
18262
  removeNextSiblingsAfterElement(selector);
18241
- addSubFormDropDown(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
18263
+ addSubFormChoice(dom, rhs, already, object, subForm, follow ? object.doc() : dataDoc, callbackFunction);
18242
18264
  }
18243
18265
 
18244
18266
  return box;
@@ -18256,7 +18278,7 @@ function removeNextSiblingsAfterElement(currentElement) {
18256
18278
  }
18257
18279
  }
18258
18280
 
18259
- function addSubFormDropDown(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
18281
+ function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
18260
18282
  (0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
18261
18283
  } // Documentation - non-interactive fields
18262
18284
  //
@@ -18461,7 +18483,8 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
18461
18483
  b.setAttribute('type', 'button');
18462
18484
  b.setAttribute('style', 'float: right;');
18463
18485
  b.innerHTML = 'Goto ' + utils.label(theClass);
18464
- b.addEventListener('click', function (_e) {
18486
+ b.addEventListener('click', // TODO fix dependency cycle to solid-panes by calling outlineManager
18487
+ function (_e) {
18465
18488
  dom.outlineManager.GotoSubject(theClass, true, undefined, true, undefined);
18466
18489
  }, false);
18467
18490
  return box;
@@ -18596,9 +18619,10 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
18596
18619
  // @param subject - a term, the subject of the statement(s) being edited.
18597
18620
  // @param predicate - a term, the predicate of the statement(s) being edited
18598
18621
  // @param possible - a list of terms, the possible value the object can take
18599
- // @param options.multiple - Boolean - Whether more than one at a time is allowed
18622
+ // @param options.multiSelect - Boolean - Whether more than one at a time is allowed
18600
18623
  // @param options.firstSelectOptionText - a string to be displayed as the
18601
- // option for none selected (for non multiple)
18624
+ // option for none selected (for non multiSelect)
18625
+ // @param options.uiMultipleInUse - signals that the ui:choise is used with a ui:multiple
18602
18626
  // @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
18603
18627
  // @param options.subForm - If mint, then the form to be used for minting the new thing
18604
18628
  // @param dataDoc - The web document being edited
@@ -18606,7 +18630,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
18606
18630
  */
18607
18631
 
18608
18632
 
18609
- function makeSelectForOptions(dom, kb, subject, predicate, possible, options, dataDoc, callbackFunction) {
18633
+ function makeSelectForOptions(dom, kb, subject, predicate, possible, uiFrom, options, dataDoc, callbackFunction) {
18610
18634
  log.debug('Select list length now ' + possible.length);
18611
18635
  var n = 0;
18612
18636
  var uris = {}; // Count them
@@ -18649,8 +18673,6 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18649
18673
  actual = getActual();
18650
18674
 
18651
18675
  var onChange = function onChange(_e) {
18652
- select.disabled = true; // until data written back - gives user feedback too
18653
-
18654
18676
  var ds = [];
18655
18677
  var is = [];
18656
18678
 
@@ -18666,9 +18688,29 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18666
18688
  var opt = select.options[_i];
18667
18689
 
18668
18690
  if (opt.selected && opt.AJAR_mint) {
18669
- newObject = newThing(dataDoc);
18670
- removeNextSiblingsAfterElement(select);
18671
- addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(newObject), options.subForm, dataDoc, callbackFunction);
18691
+ // not sure if this 'if' is used because I cannot find mintClass
18692
+ if (options.mintClass) {
18693
+ var thisForm = promptForNew(dom, kb, subject, predicate, options.mintClass, null, dataDoc, function (ok, body) {
18694
+ if (!ok) {
18695
+ callbackFunction(ok, body, {
18696
+ change: 'new'
18697
+ }); // @@ if ok, need some form of refresh of the select for the new thing
18698
+ }
18699
+ });
18700
+ select.parentNode.appendChild(thisForm);
18701
+ newObject = thisForm.AJAR_subject;
18702
+ } else {
18703
+ newObject = newThing(dataDoc);
18704
+ }
18705
+
18706
+ is.push($rdf.st(subject, predicate, kb.sym(newObject), dataDoc));
18707
+ 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
18708
+
18709
+ if (options.mintStatementsFun) {
18710
+ is = is.concat(options.mintStatementsFun(newObject));
18711
+ }
18712
+
18713
+ select.currentURI = newObject;
18672
18714
  }
18673
18715
 
18674
18716
  if (!opt.AJAR_uri) continue; // a prompt or mint
@@ -18676,6 +18718,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18676
18718
  if (opt.selected && !(opt.AJAR_uri in actual)) {
18677
18719
  // new class
18678
18720
  is.push($rdf.st(subject, predicate, kb.sym(opt.AJAR_uri), dataDoc));
18721
+ select.currentURI = opt.AJAR_uri;
18679
18722
  }
18680
18723
 
18681
18724
  if (opt.selected) select.currentURI = opt.AJAR_uri;
@@ -18695,40 +18738,29 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18695
18738
  sel = sel.superSelect;
18696
18739
  }
18697
18740
 
18698
- function doneNew(ok, _body) {
18699
- callbackFunction(ok, {
18700
- widget: 'select',
18701
- event: 'new'
18702
- });
18703
- }
18741
+ log.info('selectForOptions: data doc = ' + dataDoc); // refresh subForm
18704
18742
 
18705
- log.info('selectForOptions: data doc = ' + dataDoc);
18706
18743
  removeNextSiblingsAfterElement(select);
18707
- addSubFormDropDown(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, callbackFunction);
18708
- kb.updater.update(ds, is, function (uri, ok, body) {
18709
- actual = getActual(); // refresh
18710
-
18744
+ addSubFormChoice(dom, select.parentNode, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
18711
18745
  if (ok) {
18712
- if (newObject) {
18713
- removeNextSiblingsAfterElement(select);
18714
- addSubFormDropDown(dom, select.parentNode, {}, newObject, options.subForm, dataDoc, doneNew);
18715
- }
18746
+ kb.updater.update(ds, is, function (uri, success, errorBody) {
18747
+ actual = getActual(); // refresh
18716
18748
 
18717
- select.disabled = false; // data written back
18749
+ if (!success) select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
18750
+ });
18751
+ if (callbackFunction) callbackFunction(ok, {
18752
+ widget: 'select',
18753
+ event: 'new'
18754
+ });
18718
18755
  } else {
18719
- return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
18756
+ select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
18720
18757
  }
18721
-
18722
- if (callbackFunction) callbackFunction(ok, {
18723
- widget: 'select',
18724
- event: 'change'
18725
- });
18726
18758
  });
18727
18759
  };
18728
18760
 
18729
18761
  var select = dom.createElement('select');
18730
18762
  select.setAttribute('style', style.formSelectSTyle);
18731
- if (options.multiple) select.setAttribute('multiple', 'true');
18763
+ if (options.multiSelect) select.setAttribute('multiSelect', 'true');
18732
18764
  select.currentURI = null;
18733
18765
 
18734
18766
  select.refresh = function () {
@@ -18779,13 +18811,13 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18779
18811
  select.insertBefore(mint, select.firstChild);
18780
18812
  }
18781
18813
 
18782
- if (!select.currentURI && !options.multiple) {
18814
+ if (!select.currentURI && options.uiMultipleInUse) {
18783
18815
  var prompt = dom.createElement('option');
18784
18816
  prompt.appendChild(dom.createTextNode(options.firstSelectOptionText));
18785
- prompt.selected = true;
18786
18817
  prompt.disabled = true;
18787
18818
  prompt.value = true;
18788
18819
  prompt.hidden = true;
18820
+ prompt.selected = true;
18789
18821
  select.insertBefore(prompt, select.firstChild);
18790
18822
  }
18791
18823
 
@@ -18805,11 +18837,11 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
18805
18837
  function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunction) {
18806
18838
  var du = kb.any(category, ns.owl('disjointUnionOf'));
18807
18839
  var subs;
18808
- var multiple = false;
18840
+ var multiSelect = false;
18809
18841
 
18810
18842
  if (!du) {
18811
18843
  subs = kb.each(undefined, ns.rdfs('subClassOf'), category);
18812
- multiple = true;
18844
+ multiSelect = true;
18813
18845
  } else {
18814
18846
  subs = du.elements;
18815
18847
  }
@@ -18817,15 +18849,15 @@ function makeSelectForCategory(dom, kb, subject, category, dataDoc, callbackFunc
18817
18849
  log.debug('Select list length ' + subs.length);
18818
18850
 
18819
18851
  if (subs.length === 0) {
18820
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
18852
+ return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with no subclasses of category: ' + category);
18821
18853
  }
18822
18854
 
18823
18855
  if (subs.length === 1) {
18824
- return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiple ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
18856
+ return (0, _error.errorMessageBlock)(dom, "Can't do " + (multiSelect ? 'multiple ' : '') + 'selector with only 1 subclass of category: ' + category + ':' + subs[1]);
18825
18857
  }
18826
18858
 
18827
- return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, {
18828
- multiple: multiple
18859
+ return makeSelectForOptions(dom, kb, subject, ns.rdf('type'), subs, null, {
18860
+ multiSelect: multiSelect
18829
18861
  }, dataDoc, callbackFunction);
18830
18862
  }
18831
18863
  /** Make SELECT element to select subclasses recurively