solid-ui 2.4.22-d52421dc → 2.4.22-d6a4e62e
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 +9579 -9553
- package/dist/main.js.map +1 -1
- package/lib/acl/access-controller.js +14 -9
- package/lib/acl/access-controller.js.map +1 -1
- package/lib/acl/access-groups.js +15 -10
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl-control.js +13 -9
- package/lib/acl/acl-control.js.map +1 -1
- package/lib/acl/acl.js +11 -7
- package/lib/acl/acl.js.map +1 -1
- package/lib/acl/add-agent-buttons.js +18 -13
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/chat/bookmarks.js +21 -18
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +15 -9
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js +17 -12
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +37 -29
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +14 -14
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +23 -10
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +9 -4
- package/lib/chat/thread.js.map +1 -1
- package/lib/footer/index.js +10 -8
- package/lib/footer/index.js.map +1 -1
- package/lib/header/index.js +17 -9
- package/lib/header/index.js.map +1 -1
- package/lib/iconBase.js +3 -2
- package/lib/iconBase.js.map +1 -1
- package/lib/login/login.d.ts +9 -8
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +303 -313
- package/lib/login/login.js.map +1 -1
- package/lib/media/media-capture.js +20 -4
- package/lib/media/media-capture.js.map +1 -1
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +21 -18
- package/lib/tabs.js.map +1 -1
- package/lib/utils/headerFooterHelpers.js +7 -5
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/versionInfo.d.ts +9 -9
- package/lib/versionInfo.js +13 -13
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/error.d.ts +0 -12
- package/lib/widgets/error.d.ts.map +1 -1
- package/lib/widgets/error.js +5 -0
- package/lib/widgets/error.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js +15 -17
- package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteField.js +8 -5
- package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js +19 -21
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +15 -8
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js +27 -22
- package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
- package/lib/widgets/forms.js +270 -27
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +46 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocompleteBar.js","names":["WEBID_NOUN","GREEN_PLUS","icons","iconBase","SEARCH_ICON","EDIT_ICON","renderAutocompleteControl","dom","person","barOptions","acOptions","addOneIdAndRefresh","deleteOne","autoCompleteDone","greenButtonHandler","removeDecorated","displayAutocomplete","searchButtonHandler","droppedURIHandler","syncEditingStatus","editing","setVisible","editButton","acceptButton","cancelButton","uris","webid","_event","decoratedAutocomplete","creationArea","removeChild","undefined","createElement","setAttribute","renderAutoComplete","decoration","appendChild","deleteButtonContainer","widgets","askName","store","ns","vcard","object","name","permanent","continueButton","noun","targetClass","utils","label","deleteButton","deleteButtonWithCheck","button","style","display","flexDirection","currentObject","editable","width","manualURIEntry","plus","idNoun","makeDropTarget","dbLookup"],"sources":["../../../../src/widgets/forms/autocomplete/autocompleteBar.ts"],"sourcesContent":["/* The Autocomplete Control with decorations\n\nThis control has the buttons which control the state between editing, viewing, searching, accepting\nand so on. See the state diagram in the documentation. The AUtocomplete Picker does the main work.\n\n*/\nimport * as ns from '../../../ns'\nimport { icons } from '../../../iconBase'\nimport { store } from 'solid-logic'\nimport * as widgets from '../../../widgets'\nimport * as utils from '../../../utils'\n\nimport { renderAutoComplete, AutocompleteDecoration, setVisible } from './autocompletePicker' // dbpediaParameters\n\nimport { NamedNode } from 'rdflib'\n\nconst WEBID_NOUN = 'Solid ID'\n\nconst GREEN_PLUS = icons.iconBase + 'noun_34653_green.svg'\nconst SEARCH_ICON = icons.iconBase + 'noun_Search_875351.svg'\nconst EDIT_ICON = icons.iconBase + 'noun_253504.svg'\n// const DELETE_ICON = icons.iconBase + 'noun_2188_red.svg'\n\nexport async function renderAutocompleteControl (dom:HTMLDocument,\n person:NamedNode,\n barOptions,\n acOptions,\n addOneIdAndRefresh,\n deleteOne): Promise<HTMLElement> {\n async function autoCompleteDone (object, name) {\n if (acOptions.permanent) { // remember to set this in publicid panel\n setVisible(editButton, true)\n setVisible(acceptButton, false)\n setVisible(cancelButton, false)\n } else {\n // console.log('temporary - removed decoratiion')\n removeDecorated()\n }\n return addOneIdAndRefresh(object, name)\n }\n\n async function greenButtonHandler (_event) {\n const webid = await widgets.askName(dom, store, creationArea, ns.vcard('url'), undefined, WEBID_NOUN)\n if (!webid) {\n return // cancelled by user\n }\n return addOneIdAndRefresh(person, webid)\n }\n\n function removeDecorated () {\n if (decoratedAutocomplete) {\n creationArea.removeChild(decoratedAutocomplete)\n decoratedAutocomplete = undefined\n }\n }\n\n async function displayAutocomplete () {\n decoratedAutocomplete = dom.createElement('div') as HTMLElement\n decoratedAutocomplete.setAttribute('style', 'display: flex; flex-flow: wrap;')\n decoratedAutocomplete.appendChild(await renderAutoComplete(dom, acOptions, decoration, autoCompleteDone))\n // console.log('@@ acceptButton', acceptButton)\n decoratedAutocomplete.appendChild(acceptButton)\n // console.log('@@ cancelButton', cancelButton)\n\n decoratedAutocomplete.appendChild(cancelButton)\n // console.log('@@ editButton', editButton)\n\n decoratedAutocomplete.appendChild(editButton)\n // console.log('@@ deleteButtonContainer', deleteButtonContainer)\n\n decoratedAutocomplete.appendChild(deleteButtonContainer)\n creationArea.appendChild(decoratedAutocomplete)\n }\n\n async function searchButtonHandler (_event) {\n if (decoratedAutocomplete) {\n creationArea.removeChild(decoratedAutocomplete)\n decoratedAutocomplete = undefined\n } else {\n await displayAutocomplete()\n }\n }\n\n async function droppedURIHandler (uris) {\n for (const webid of uris) { // normally one but can be more than one\n await addOneIdAndRefresh(person, webid)\n }\n }\n\n const acceptButton = widgets.continueButton(dom)\n acceptButton.setAttribute('data-testid', 'accept-button')\n\n const cancelButton = widgets.cancelButton(dom)\n cancelButton.setAttribute('data-testid', 'cancel-button')\n const deleteButtonContainer = dom.createElement('div')\n const noun = acOptions.targetClass ? utils.label(acOptions.targetClass) : 'item'\n const deleteButton = widgets.deleteButtonWithCheck(dom, deleteButtonContainer, noun, deleteOne) // need to knock out this UI or caller does that\n deleteButton.setAttribute('data-testid', 'delete-button')\n const editButton = widgets.button(dom, EDIT_ICON, 'Edit', _event => {\n editing = !editing\n syncEditingStatus()\n })\n editButton.setAttribute('data-testid', 'edit-button')\n let editing = true\n\n function syncEditingStatus () {\n if (editing) {\n setVisible(editButton, false)\n setVisible(acceptButton, false) // not till got it\n setVisible(cancelButton, false)\n } else {\n setVisible(editButton, true)\n setVisible(acceptButton, false)\n setVisible(cancelButton, false)\n }\n }\n\n const decoration:AutocompleteDecoration = {\n acceptButton, cancelButton, editButton, deleteButton\n }\n\n let decoratedAutocomplete = undefined as HTMLElement | undefined\n\n const creationArea = dom.createElement('div')\n creationArea.style.display = 'flex'\n creationArea.style.flexDirection = 'row'\n\n if (acOptions.permanent || acOptions.currentObject) {\n await displayAutocomplete()\n }\n if (barOptions.editable) {\n // creationArea.appendChild(await renderAutoComplete(dom, barOptions, autoCompleteDone)) wait for searchButton\n creationArea.style.width = '100%'\n if (barOptions.manualURIEntry) {\n const plus = creationArea.appendChild(widgets.button(dom, GREEN_PLUS, barOptions.idNoun, greenButtonHandler))\n widgets.makeDropTarget(plus, droppedURIHandler, undefined)\n }\n if (barOptions.dbLookup && !acOptions.currentObject && !acOptions.permanent) {\n creationArea.appendChild(widgets.button(dom, SEARCH_ICON, barOptions.idNoun, searchButtonHandler))\n }\n }\n syncEditingStatus()\n return creationArea\n} // renderAutocompleteControl\n\n// ends\n"],"mappings":";;;;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;+CAXA,oJ;;AAeA,IAAMA,UAAU,GAAG,UAAnB;AAEA,IAAMC,UAAU,GAAGC,eAAA,CAAMC,QAAN,GAAiB,sBAApC;AACA,IAAMC,WAAW,GAAGF,eAAA,CAAMC,QAAN,GAAiB,wBAArC;AACA,IAAME,SAAS,GAAGH,eAAA,CAAMC,QAAN,GAAiB,iBAAnC,C,CACA;;SAEsBG,yB;;EAwHpB;AAEF;;;;2GA1HO,kBAA0CC,GAA1C,EACLC,MADK,EAELC,UAFK,EAGLC,SAHK,EAILC,kBAJK,EAKLC,SALK;IAAA,IAMUC,gBANV,qBAkBUC,kBAlBV,uBA0BIC,eA1BJ,EAiCUC,mBAjCV,wBAmDUC,mBAnDV,wBA4DUC,iBA5DV,kHAkFIC,iBAlFJ;;IAAA;MAAA;QAAA;UAAA;YAkFIA,iBAlFJ,iCAkFyB;cAC5B,IAAIC,OAAJ,EAAa;gBACX,IAAAC,8BAAA,EAAWC,UAAX,EAAuB,KAAvB;gBACA,IAAAD,8BAAA,EAAWE,YAAX,EAAyB,KAAzB,EAFW,CAEqB;;gBAChC,IAAAF,8BAAA,EAAWG,YAAX,EAAyB,KAAzB;cACD,CAJD,MAIO;gBACL,IAAAH,8BAAA,EAAWC,UAAX,EAAuB,IAAvB;gBACA,IAAAD,8BAAA,EAAWE,YAAX,EAAyB,KAAzB;gBACA,IAAAF,8BAAA,EAAWG,YAAX,EAAyB,KAAzB;cACD;YACF,CA5FI;;YAAA;cAAA,iGA4DL,kBAAkCC,IAAlC;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LH,YAAY,CAACyB,KAAb,CAAmBC,OAAnB,GAA6B,MAA7B;YACA1B,YAAY,CAACyB,KAAb,CAAmBE,aAAnB,GAAmC,KAAnC;;YAtGK,MAwGD9C,SAAS,CAACmC,SAAV,IAAuBnC,SAAS,CAAC+C,aAxGhC;cAAA;cAAA;YAAA;;YAAA;YAAA,OAyGGzC,mBAAmB,EAzGtB;;UAAA;YA2GL,IAAIP,UAAU,CAACiD,QAAf,EAAyB;cACvB;cACA7B,YAAY,CAACyB,KAAb,CAAmBK,KAAnB,GAA2B,MAA3B;;cACA,IAAIlD,UAAU,CAACmD,cAAf,EAA+B;gBACvBC,IADuB,GAChBhC,YAAY,CAACO,WAAb,CAAyBE,OAAO,CAACe,MAAR,CAAe9C,GAAf,EAAoBN,UAApB,EAAgCQ,UAAU,CAACqD,MAA3C,EAAmDhD,kBAAnD,CAAzB,CADgB;gBAE7BwB,OAAO,CAACyB,cAAR,CAAuBF,IAAvB,EAA6B3C,iBAA7B,EAAgDa,SAAhD;cACD;;cACD,IAAItB,UAAU,CAACuD,QAAX,IAAuB,CAACtD,SAAS,CAAC+C,aAAlC,IAAmD,CAAC/C,SAAS,CAACmC,SAAlE,EAA6E;gBAC3EhB,YAAY,CAACO,WAAb,CAAyBE,OAAO,CAACe,MAAR,CAAe9C,GAAf,EAAoBH,WAApB,EAAiCK,UAAU,CAACqD,MAA5C,EAAoD7C,mBAApD,CAAzB;cACD;YACF;;YACDE,iBAAiB;YAtHZ,kCAuHEU,YAvHF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
|
|
1
|
+
{"version":3,"file":"autocompleteBar.js","names":["WEBID_NOUN","GREEN_PLUS","icons","iconBase","SEARCH_ICON","EDIT_ICON","renderAutocompleteControl","dom","person","barOptions","acOptions","addOneIdAndRefresh","deleteOne","autoCompleteDone","greenButtonHandler","removeDecorated","displayAutocomplete","searchButtonHandler","droppedURIHandler","syncEditingStatus","editing","setVisible","editButton","acceptButton","cancelButton","uris","webid","_event","decoratedAutocomplete","creationArea","removeChild","undefined","createElement","setAttribute","renderAutoComplete","decoration","appendChild","deleteButtonContainer","widgets","askName","store","ns","vcard","object","name","permanent","continueButton","noun","targetClass","utils","label","deleteButton","deleteButtonWithCheck","button","style","display","flexDirection","currentObject","editable","width","manualURIEntry","plus","idNoun","makeDropTarget","dbLookup"],"sources":["../../../../src/widgets/forms/autocomplete/autocompleteBar.ts"],"sourcesContent":["/* The Autocomplete Control with decorations\n\nThis control has the buttons which control the state between editing, viewing, searching, accepting\nand so on. See the state diagram in the documentation. The AUtocomplete Picker does the main work.\n\n*/\nimport * as ns from '../../../ns'\nimport { icons } from '../../../iconBase'\nimport { store } from 'solid-logic'\nimport * as widgets from '../../../widgets'\nimport * as utils from '../../../utils'\n\nimport { renderAutoComplete, AutocompleteDecoration, setVisible } from './autocompletePicker' // dbpediaParameters\n\nimport { NamedNode } from 'rdflib'\n\nconst WEBID_NOUN = 'Solid ID'\n\nconst GREEN_PLUS = icons.iconBase + 'noun_34653_green.svg'\nconst SEARCH_ICON = icons.iconBase + 'noun_Search_875351.svg'\nconst EDIT_ICON = icons.iconBase + 'noun_253504.svg'\n// const DELETE_ICON = icons.iconBase + 'noun_2188_red.svg'\n\nexport async function renderAutocompleteControl (dom:HTMLDocument,\n person:NamedNode,\n barOptions,\n acOptions,\n addOneIdAndRefresh,\n deleteOne): Promise<HTMLElement> {\n async function autoCompleteDone (object, name) {\n if (acOptions.permanent) { // remember to set this in publicid panel\n setVisible(editButton, true)\n setVisible(acceptButton, false)\n setVisible(cancelButton, false)\n } else {\n // console.log('temporary - removed decoratiion')\n removeDecorated()\n }\n return addOneIdAndRefresh(object, name)\n }\n\n async function greenButtonHandler (_event) {\n const webid = await widgets.askName(dom, store, creationArea, ns.vcard('url'), undefined, WEBID_NOUN)\n if (!webid) {\n return // cancelled by user\n }\n return addOneIdAndRefresh(person, webid)\n }\n\n function removeDecorated () {\n if (decoratedAutocomplete) {\n creationArea.removeChild(decoratedAutocomplete)\n decoratedAutocomplete = undefined\n }\n }\n\n async function displayAutocomplete () {\n decoratedAutocomplete = dom.createElement('div') as HTMLElement\n decoratedAutocomplete.setAttribute('style', 'display: flex; flex-flow: wrap;')\n decoratedAutocomplete.appendChild(await renderAutoComplete(dom, acOptions, decoration, autoCompleteDone))\n // console.log('@@ acceptButton', acceptButton)\n decoratedAutocomplete.appendChild(acceptButton)\n // console.log('@@ cancelButton', cancelButton)\n\n decoratedAutocomplete.appendChild(cancelButton)\n // console.log('@@ editButton', editButton)\n\n decoratedAutocomplete.appendChild(editButton)\n // console.log('@@ deleteButtonContainer', deleteButtonContainer)\n\n decoratedAutocomplete.appendChild(deleteButtonContainer)\n creationArea.appendChild(decoratedAutocomplete)\n }\n\n async function searchButtonHandler (_event) {\n if (decoratedAutocomplete) {\n creationArea.removeChild(decoratedAutocomplete)\n decoratedAutocomplete = undefined\n } else {\n await displayAutocomplete()\n }\n }\n\n async function droppedURIHandler (uris) {\n for (const webid of uris) { // normally one but can be more than one\n await addOneIdAndRefresh(person, webid)\n }\n }\n\n const acceptButton = widgets.continueButton(dom)\n acceptButton.setAttribute('data-testid', 'accept-button')\n\n const cancelButton = widgets.cancelButton(dom)\n cancelButton.setAttribute('data-testid', 'cancel-button')\n const deleteButtonContainer = dom.createElement('div')\n const noun = acOptions.targetClass ? utils.label(acOptions.targetClass) : 'item'\n const deleteButton = widgets.deleteButtonWithCheck(dom, deleteButtonContainer, noun, deleteOne) // need to knock out this UI or caller does that\n deleteButton.setAttribute('data-testid', 'delete-button')\n const editButton = widgets.button(dom, EDIT_ICON, 'Edit', _event => {\n editing = !editing\n syncEditingStatus()\n })\n editButton.setAttribute('data-testid', 'edit-button')\n let editing = true\n\n function syncEditingStatus () {\n if (editing) {\n setVisible(editButton, false)\n setVisible(acceptButton, false) // not till got it\n setVisible(cancelButton, false)\n } else {\n setVisible(editButton, true)\n setVisible(acceptButton, false)\n setVisible(cancelButton, false)\n }\n }\n\n const decoration:AutocompleteDecoration = {\n acceptButton, cancelButton, editButton, deleteButton\n }\n\n let decoratedAutocomplete = undefined as HTMLElement | undefined\n\n const creationArea = dom.createElement('div')\n creationArea.style.display = 'flex'\n creationArea.style.flexDirection = 'row'\n\n if (acOptions.permanent || acOptions.currentObject) {\n await displayAutocomplete()\n }\n if (barOptions.editable) {\n // creationArea.appendChild(await renderAutoComplete(dom, barOptions, autoCompleteDone)) wait for searchButton\n creationArea.style.width = '100%'\n if (barOptions.manualURIEntry) {\n const plus = creationArea.appendChild(widgets.button(dom, GREEN_PLUS, barOptions.idNoun, greenButtonHandler))\n widgets.makeDropTarget(plus, droppedURIHandler, undefined)\n }\n if (barOptions.dbLookup && !acOptions.currentObject && !acOptions.permanent) {\n creationArea.appendChild(widgets.button(dom, SEARCH_ICON, barOptions.idNoun, searchButtonHandler))\n }\n }\n syncEditingStatus()\n return creationArea\n} // renderAutocompleteControl\n\n// ends\n"],"mappings":";;;;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;AAIA,IAAMA,UAAU,GAAG,UAAnB;AAEA,IAAMC,UAAU,GAAGC,eAAA,CAAMC,QAAN,GAAiB,sBAApC;AACA,IAAMC,WAAW,GAAGF,eAAA,CAAMC,QAAN,GAAiB,wBAArC;AACA,IAAME,SAAS,GAAGH,eAAA,CAAMC,QAAN,GAAiB,iBAAnC,C,CACA;;SAEsBG,yB;;EAwHpB;AAEF;;;;6GA1HO,kBAA0CC,GAA1C,EACLC,MADK,EAELC,UAFK,EAGLC,SAHK,EAILC,kBAJK,EAKLC,SALK;IAAA,IAMUC,gBANV,qBAkBUC,kBAlBV,uBA0BIC,eA1BJ,EAiCUC,mBAjCV,wBAmDUC,mBAnDV,wBA4DUC,iBA5DV,kHAkFIC,iBAlFJ;;IAAA;MAAA;QAAA;UAAA;YAkFIA,iBAlFJ,iCAkFyB;cAC5B,IAAIC,OAAJ,EAAa;gBACX,IAAAC,8BAAA,EAAWC,UAAX,EAAuB,KAAvB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B;YAtHZ,kCAuHEU,YAvHF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
|
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.autocompleteField = autocompleteField;
|
|
11
11
|
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
12
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
15
|
|
|
14
16
|
var ns = _interopRequireWildcard(require("../../../ns"));
|
|
@@ -27,7 +29,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
27
29
|
|
|
28
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
31
|
|
|
30
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
32
|
+
/* Form field for doing autocompleete
|
|
33
|
+
*/
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
36
|
* Render a autocomplete form field
|
|
@@ -62,10 +65,10 @@ function autocompleteField(dom, container, already, subject, form, doc, callback
|
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
function _addOneIdAndRefresh() {
|
|
65
|
-
_addOneIdAndRefresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
68
|
+
_addOneIdAndRefresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(result, name) {
|
|
66
69
|
var oldValue, oldName, deletables, insertables, _kb$updater2;
|
|
67
70
|
|
|
68
|
-
return
|
|
71
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
69
72
|
while (1) {
|
|
70
73
|
switch (_context.prev = _context.next) {
|
|
71
74
|
case 0:
|
|
@@ -132,10 +135,10 @@ function autocompleteField(dom, container, already, subject, form, doc, callback
|
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
function _deleteOne() {
|
|
135
|
-
_deleteOne = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
138
|
+
_deleteOne = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_result, _name) {
|
|
136
139
|
var oldValue, deletables, insertables, _kb$updater3, e2;
|
|
137
140
|
|
|
138
|
-
return
|
|
141
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
139
142
|
while (1) {
|
|
140
143
|
switch (_context2.prev = _context2.next) {
|
|
141
144
|
case 0:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocompleteField.js","names":["autocompleteField","dom","container","already","subject","form","doc","callbackFunction","addOneIdAndRefresh","result","name","Error","oldValue","kb","the","property","oldName","any","labelProperty","equals","sameTerm","deletables","statementsMatching","concat","insertables","st","updater","updateMany","box","appendChild","widgets","errorMessageBlock","deleteOne","_result","_name","e2","termType","store","formDoc","createElement","lhs","setAttribute","style","formFieldNameBoxStyle","rhs","ns","ui","schema","dataSource","queryParams","label","anyJS","logo","targetClass","objectURIBase","undefined","endpoint","searchByNameQuery","insitituteDetailsQuery","searchByNameURI","suppressEmptyUneditable","editable","uri","autocompleteOptions","permanent","size","obj","currentObject","currentName","display","fieldLabel","barOptions","dbLookup","renderAutocompleteControl","then","control","err"],"sources":["../../../../src/widgets/forms/autocomplete/autocompleteField.ts"],"sourcesContent":["/* Form field for doing autocompleete\n */\nimport * as ns from '../../../ns'\nimport { store } from 'solid-logic'\nimport * as widgets from '../../../widgets'\nimport * as style from '../../../style'\nimport { renderAutocompleteControl } from './autocompleteBar'\nimport { QueryParameters } from './publicData'\nimport { NamedNode, BlankNode, Literal, Variable, st } from 'rdflib'\nimport { AutocompleteOptions } from './autocompletePicker'\n/**\n * Render a autocomplete form field\n *\n * The autocomplete form searches for an object in a definitive public database,\n * and allows the user to search for it by name, displaying a list of objects whose names match\n * the input to date, and letting the user either click on one of the list,\n * or just go on untill there is only one. The process then returns two values,\n * the URiI of the object and its name.\n *\n * @param dom The HTML Document object aka Document Object Model\n * @param container If present, the created widget will be appended to this\n * @param already A hash table of (form, subject) kept to prevent recursive forms looping\n * @param subject The thing about which the form displays/edits data\n * @param form The form or field to be rendered\n * @param doc The web document in which the data is\n * @param callbackFunction Called when data is changed so other parts can be refreshed.\n *\n * Form properties:\n * @param ui:property The property to store the object itself\n * @param ui:labelProperty The property used to store the name of the object\n * @param ui:category The class of objects to be searched, if fixed (else dep on class of subject)\n *\n * @returns The HTML widget created\n */\n// eslint-disable-next-line complexity\nexport function autocompleteField (\n dom: HTMLDocument,\n container: HTMLElement | undefined,\n already,\n subject: NamedNode | BlankNode | Variable,\n form: NamedNode,\n doc: NamedNode | undefined,\n callbackFunction: (_ok: boolean, _errorMessage: string) => void\n): HTMLElement {\n async function addOneIdAndRefresh (result:NamedNode | Literal, name: Literal) {\n if (!name) {\n throw new Error('autocompleteField: No name set.')\n }\n const oldValue = kb.the(subject, property as any, null, doc)\n if (oldValue) {\n const oldName = kb.any(oldValue as any, labelProperty as any, null, doc)\n if (oldValue.equals(result) && oldName && oldName.sameTerm(name)) {\n // console.log('No change: same values.')\n return\n }\n }\n const deletables = oldValue\n ? kb.statementsMatching(subject, property as any, oldValue, doc)\n .concat(kb.statementsMatching(oldValue as any, labelProperty as any, null, doc))\n : []\n // console.log('autocompleteField Deletables ' + deletables.map(st => st.toNT()))\n const insertables = [st(subject, property as any, result, doc),\n st(result as any, labelProperty as any, name, doc)] // @@ track the language of the name too!\n // console.log(`AC form: ${deletables.length} to delete and ${insertables.length} to insert`)\n try {\n // console.log('@@@ AC updating ', deletables, insertables)\n await kb.updater?.updateMany(deletables, insertables)\n } catch (err) {\n callbackFunction(false, err)\n box.appendChild(widgets.errorMessageBlock(dom, 'Autocomplete form data update error:' + err, null, err))\n return\n }\n callbackFunction(true, '')\n }\n\n async function deleteOne (_result:NamedNode | Literal, _name: Literal) {\n const oldValue = kb.the(subject, property as any, null, doc)\n if (!oldValue) {\n callbackFunction(false, 'NO data to elete')\n box.appendChild(widgets.errorMessageBlock(dom, 'Autocomplete delete: no old data!'))\n return\n }\n // const oldName = kb.any(oldValue as any, labelProperty as any, null, doc)\n const deletables = kb.statementsMatching(subject, property as any, oldValue, doc)\n .concat(kb.statementsMatching(oldValue as any, labelProperty as any, null, doc))\n // console.log('autocompleteField Deletables ' + deletables.map(st => st.toNT()))\n const insertables = []\n // console.log(`AC form delete: ${deletables.length} to delete and ${insertables.length} to insert`)\n try {\n // console.log('@@@ AC updating ', deletables, insertables)\n await kb.updater?.updateMany(deletables, insertables)\n } catch (err) {\n const e2 = new Error('Autocomplete form data delete error:' + err)\n callbackFunction(false, err)\n box.appendChild(widgets.errorMessageBlock(dom, e2, null, err))\n return\n }\n callbackFunction(true, '') // changed\n }\n\n if (subject.termType !== 'NamedNode') {\n throw new Error('Sorry this field only works on NamedNode subjects (for editable)')\n }\n const kb = store\n const formDoc = form.doc ? form.doc() : null // @@ if blank no way to know\n\n const box = dom.createElement('div')\n if (container) container.appendChild(box)\n const lhs = dom.createElement('div')\n lhs.setAttribute('class', 'formFieldName')\n lhs.setAttribute('style', style.formFieldNameBoxStyle)\n box.appendChild(lhs)\n const rhs = dom.createElement('div')\n rhs.setAttribute('class', 'formFieldValue')\n box.appendChild(rhs)\n\n const property = kb.any(form, ns.ui('property'))\n if (!property) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No property given for autocomplete field: ' + form)\n )\n }\n const labelProperty = kb.any(form, ns.ui('labelProperty')) || ns.schema('name')\n\n // Parse the data source into query options\n\n const dataSource = kb.any(form, ns.ui('dataSource')) as NamedNode | undefined\n if (!dataSource) {\n // console.log('@@ connectedStatements ACF ', kb.connectedStatements(form).map(x => x.toNT()).join('\\n'))\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No data source given for autocomplete field: ' + form)\n )\n }\n const queryParams:QueryParameters = {\n // targetClass: kb.any(dataSource, ns.ui('targetClass'), null, dataSource.doc()) as NamedNode | undefined,\n label: kb.anyJS(dataSource, ns.schema('name'), null, dataSource.doc()),\n logo: (kb.any(dataSource, ns.schema('logo'), null, dataSource.doc())) as NamedNode | undefined\n }\n\n // @@ Should we pass the target class in from the data source definition or use a current type of the subject\n const targetClass = (kb.any(form, ns.ui('targetClass'), null, form.doc()) || // class in form takes pecedence\n kb.any(dataSource, ns.ui('targetClass'), null, dataSource.doc())) as NamedNode | undefined\n if (targetClass) {\n queryParams.targetClass = targetClass\n }\n\n queryParams.objectURIBase = (kb.any(dataSource, ns.ui('objectURIBase'), null, dataSource.doc()) || undefined) as NamedNode | undefined\n\n /*\n if (!queryParams.targetClass) {\n const klass = kb.any(subject, ns.rdf('type')) as NamedNode | undefined\n // @@ be more selective of which class if many\n // @@ todo: Take ALL classes, and compare them with those the data source knows about\n // with translation where necessary. Find most specific of the classes for the search.\n if (!klass) throw new Error('Autocomplete: No class specified or is current type of' + subject)\n queryParams.targetClass = klass\n }\n */\n const endpoint = kb.anyJS(dataSource, ns.ui('endpoint'), null, dataSource.doc()) as string | undefined\n if (endpoint) { // SPARQL\n queryParams.endpoint = endpoint\n\n queryParams.searchByNameQuery = kb.anyJS(dataSource, ns.ui('searchByNameQuery'), null, dataSource.doc())\n if (!queryParams.searchByNameQuery) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No searchByNameQuery given for endpoint data Source: ' + form))\n }\n queryParams.insitituteDetailsQuery = kb.anyJS(dataSource, ns.ui('insitituteDetailsQuery'), null, dataSource.doc())\n } else {\n // return box.appendChild(\n // widgets.errorMessageBlock(dom, 'Error: No SPARQL endpoint given for autocomplete field: ' + form))\n const searchByNameURI = kb.anyJS(dataSource, ns.ui('searchByNameURI'))\n if (!searchByNameURI) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No searchByNameURI OR sparql endpoint given for dataSource: ' + dataSource)\n )\n }\n queryParams.searchByNameURI = searchByNameURI\n }\n // It can be cleaner to just remove empty fields if you can't edit them anyway\n const suppressEmptyUneditable = kb.anyJS(form, ns.ui('suppressEmptyUneditable'), null, formDoc)\n const editable = kb.updater?.editable((doc as NamedNode).uri)\n\n const autocompleteOptions:AutocompleteOptions = { // cancelButton?: HTMLElement,\n permanent: true,\n targetClass: queryParams.targetClass, // @@ simplify?\n queryParams\n }\n\n autocompleteOptions.size = kb.anyJS(form, ns.ui('size'), null, formDoc) || undefined\n\n let obj = kb.any(subject, property as any, undefined, doc)\n if (!obj) {\n obj = kb.any(form, ns.ui('default'))\n if (obj) {\n autocompleteOptions.currentObject = obj as NamedNode\n autocompleteOptions.currentName = kb.any(autocompleteOptions.currentObject, labelProperty, null, doc) as Literal\n } else { // No data or default. Should we suprress the whole field?\n if (suppressEmptyUneditable && !editable) {\n box.style.display = 'none' // clutter removal\n return box\n }\n }\n } else { // get object and name from target data:\n autocompleteOptions.currentObject = obj as NamedNode\n autocompleteOptions.currentName = kb.any(autocompleteOptions.currentObject, labelProperty, null, doc) as Literal\n }\n\n lhs.appendChild(widgets.fieldLabel(dom, property as any, form))\n\n const barOptions = {\n editable,\n dbLookup: true\n }\n\n renderAutocompleteControl(dom, subject as NamedNode, barOptions, autocompleteOptions, addOneIdAndRefresh, deleteOne).then((control) => {\n rhs.appendChild(control)\n }, (err) => {\n rhs.appendChild(widgets.errorMessageBlock(dom, `Error rendering autocomplete ${form}: ${err}`, '#fee', err)) //\n })\n return box\n}\n\n// ends\n"],"mappings":";;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;+CAPA,oJ;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAT,CACLC,GADK,EAELC,SAFK,EAGLC,OAHK,EAILC,OAJK,EAKLC,IALK,EAMLC,GANK,EAOLC,gBAPK,EAQQ;EAAA;;EAAA,SACEC,kBADF;IAAA;EAAA;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AE;IACPmC,mBAAmB,CAACI,aAApB,GAAoCD,GAApC;IACAH,mBAAmB,CAACK,WAApB,GAAkCvD,EAAE,CAACI,GAAH,CAAO8C,mBAAmB,CAACI,aAA3B,EAA0CjD,aAA1C,EAAyD,IAAzD,EAA+DZ,GAA/D,CAAlC;EACD;;EAEDkC,GAAG,CAACX,WAAJ,CAAgBC,OAAO,CAACwC,UAAR,CAAmBrE,GAAnB,EAAwBc,QAAxB,EAAyCV,IAAzC,CAAhB;EAEA,IAAMkE,UAAU,GAAG;IACjBV,QAAQ,EAARA,QADiB;IAEjBW,QAAQ,EAAE;EAFO,CAAnB;EAKA,IAAAC,0CAAA,EAA0BxE,GAA1B,EAA+BG,OAA/B,EAAqDmE,UAArD,EAAiER,mBAAjE,EAAsFvD,kBAAtF,EAA0GwB,SAA1G,EAAqH0C,IAArH,CAA0H,UAACC,OAAD,EAAa;IACrI/B,GAAG,CAACf,WAAJ,CAAgB8C,OAAhB;EACD,CAFD,EAEG,UAACC,GAAD,EAAS;IACVhC,GAAG,CAACf,WAAJ,CAAgBC,OAAO,CAACC,iBAAR,CAA0B9B,GAA1B,yCAA+DI,IAA/D,eAAwEuE,GAAxE,GAA+E,MAA/E,EAAuFA,GAAvF,CAAhB,EADU,CACmG;EAC9G,CAJD;EAKA,OAAOhD,GAAP;AACD,C,CAED"}
|
|
1
|
+
{"version":3,"file":"autocompleteField.js","names":["autocompleteField","dom","container","already","subject","form","doc","callbackFunction","addOneIdAndRefresh","result","name","Error","oldValue","kb","the","property","oldName","any","labelProperty","equals","sameTerm","deletables","statementsMatching","concat","insertables","st","updater","updateMany","box","appendChild","widgets","errorMessageBlock","deleteOne","_result","_name","e2","termType","store","formDoc","createElement","lhs","setAttribute","style","formFieldNameBoxStyle","rhs","ns","ui","schema","dataSource","queryParams","label","anyJS","logo","targetClass","objectURIBase","undefined","endpoint","searchByNameQuery","insitituteDetailsQuery","searchByNameURI","suppressEmptyUneditable","editable","uri","autocompleteOptions","permanent","size","obj","currentObject","currentName","display","fieldLabel","barOptions","dbLookup","renderAutocompleteControl","then","control","err"],"sources":["../../../../src/widgets/forms/autocomplete/autocompleteField.ts"],"sourcesContent":["/* Form field for doing autocompleete\n */\nimport * as ns from '../../../ns'\nimport { store } from 'solid-logic'\nimport * as widgets from '../../../widgets'\nimport * as style from '../../../style'\nimport { renderAutocompleteControl } from './autocompleteBar'\nimport { QueryParameters } from './publicData'\nimport { NamedNode, BlankNode, Literal, Variable, st } from 'rdflib'\nimport { AutocompleteOptions } from './autocompletePicker'\n/**\n * Render a autocomplete form field\n *\n * The autocomplete form searches for an object in a definitive public database,\n * and allows the user to search for it by name, displaying a list of objects whose names match\n * the input to date, and letting the user either click on one of the list,\n * or just go on untill there is only one. The process then returns two values,\n * the URiI of the object and its name.\n *\n * @param dom The HTML Document object aka Document Object Model\n * @param container If present, the created widget will be appended to this\n * @param already A hash table of (form, subject) kept to prevent recursive forms looping\n * @param subject The thing about which the form displays/edits data\n * @param form The form or field to be rendered\n * @param doc The web document in which the data is\n * @param callbackFunction Called when data is changed so other parts can be refreshed.\n *\n * Form properties:\n * @param ui:property The property to store the object itself\n * @param ui:labelProperty The property used to store the name of the object\n * @param ui:category The class of objects to be searched, if fixed (else dep on class of subject)\n *\n * @returns The HTML widget created\n */\n// eslint-disable-next-line complexity\nexport function autocompleteField (\n dom: HTMLDocument,\n container: HTMLElement | undefined,\n already,\n subject: NamedNode | BlankNode | Variable,\n form: NamedNode,\n doc: NamedNode | undefined,\n callbackFunction: (_ok: boolean, _errorMessage: string) => void\n): HTMLElement {\n async function addOneIdAndRefresh (result:NamedNode | Literal, name: Literal) {\n if (!name) {\n throw new Error('autocompleteField: No name set.')\n }\n const oldValue = kb.the(subject, property as any, null, doc)\n if (oldValue) {\n const oldName = kb.any(oldValue as any, labelProperty as any, null, doc)\n if (oldValue.equals(result) && oldName && oldName.sameTerm(name)) {\n // console.log('No change: same values.')\n return\n }\n }\n const deletables = oldValue\n ? kb.statementsMatching(subject, property as any, oldValue, doc)\n .concat(kb.statementsMatching(oldValue as any, labelProperty as any, null, doc))\n : []\n // console.log('autocompleteField Deletables ' + deletables.map(st => st.toNT()))\n const insertables = [st(subject, property as any, result, doc),\n st(result as any, labelProperty as any, name, doc)] // @@ track the language of the name too!\n // console.log(`AC form: ${deletables.length} to delete and ${insertables.length} to insert`)\n try {\n // console.log('@@@ AC updating ', deletables, insertables)\n await kb.updater?.updateMany(deletables, insertables)\n } catch (err) {\n callbackFunction(false, err)\n box.appendChild(widgets.errorMessageBlock(dom, 'Autocomplete form data update error:' + err, null, err))\n return\n }\n callbackFunction(true, '')\n }\n\n async function deleteOne (_result:NamedNode | Literal, _name: Literal) {\n const oldValue = kb.the(subject, property as any, null, doc)\n if (!oldValue) {\n callbackFunction(false, 'NO data to elete')\n box.appendChild(widgets.errorMessageBlock(dom, 'Autocomplete delete: no old data!'))\n return\n }\n // const oldName = kb.any(oldValue as any, labelProperty as any, null, doc)\n const deletables = kb.statementsMatching(subject, property as any, oldValue, doc)\n .concat(kb.statementsMatching(oldValue as any, labelProperty as any, null, doc))\n // console.log('autocompleteField Deletables ' + deletables.map(st => st.toNT()))\n const insertables = []\n // console.log(`AC form delete: ${deletables.length} to delete and ${insertables.length} to insert`)\n try {\n // console.log('@@@ AC updating ', deletables, insertables)\n await kb.updater?.updateMany(deletables, insertables)\n } catch (err) {\n const e2 = new Error('Autocomplete form data delete error:' + err)\n callbackFunction(false, err)\n box.appendChild(widgets.errorMessageBlock(dom, e2, null, err))\n return\n }\n callbackFunction(true, '') // changed\n }\n\n if (subject.termType !== 'NamedNode') {\n throw new Error('Sorry this field only works on NamedNode subjects (for editable)')\n }\n const kb = store\n const formDoc = form.doc ? form.doc() : null // @@ if blank no way to know\n\n const box = dom.createElement('div')\n if (container) container.appendChild(box)\n const lhs = dom.createElement('div')\n lhs.setAttribute('class', 'formFieldName')\n lhs.setAttribute('style', style.formFieldNameBoxStyle)\n box.appendChild(lhs)\n const rhs = dom.createElement('div')\n rhs.setAttribute('class', 'formFieldValue')\n box.appendChild(rhs)\n\n const property = kb.any(form, ns.ui('property'))\n if (!property) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No property given for autocomplete field: ' + form)\n )\n }\n const labelProperty = kb.any(form, ns.ui('labelProperty')) || ns.schema('name')\n\n // Parse the data source into query options\n\n const dataSource = kb.any(form, ns.ui('dataSource')) as NamedNode | undefined\n if (!dataSource) {\n // console.log('@@ connectedStatements ACF ', kb.connectedStatements(form).map(x => x.toNT()).join('\\n'))\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No data source given for autocomplete field: ' + form)\n )\n }\n const queryParams:QueryParameters = {\n // targetClass: kb.any(dataSource, ns.ui('targetClass'), null, dataSource.doc()) as NamedNode | undefined,\n label: kb.anyJS(dataSource, ns.schema('name'), null, dataSource.doc()),\n logo: (kb.any(dataSource, ns.schema('logo'), null, dataSource.doc())) as NamedNode | undefined\n }\n\n // @@ Should we pass the target class in from the data source definition or use a current type of the subject\n const targetClass = (kb.any(form, ns.ui('targetClass'), null, form.doc()) || // class in form takes pecedence\n kb.any(dataSource, ns.ui('targetClass'), null, dataSource.doc())) as NamedNode | undefined\n if (targetClass) {\n queryParams.targetClass = targetClass\n }\n\n queryParams.objectURIBase = (kb.any(dataSource, ns.ui('objectURIBase'), null, dataSource.doc()) || undefined) as NamedNode | undefined\n\n /*\n if (!queryParams.targetClass) {\n const klass = kb.any(subject, ns.rdf('type')) as NamedNode | undefined\n // @@ be more selective of which class if many\n // @@ todo: Take ALL classes, and compare them with those the data source knows about\n // with translation where necessary. Find most specific of the classes for the search.\n if (!klass) throw new Error('Autocomplete: No class specified or is current type of' + subject)\n queryParams.targetClass = klass\n }\n */\n const endpoint = kb.anyJS(dataSource, ns.ui('endpoint'), null, dataSource.doc()) as string | undefined\n if (endpoint) { // SPARQL\n queryParams.endpoint = endpoint\n\n queryParams.searchByNameQuery = kb.anyJS(dataSource, ns.ui('searchByNameQuery'), null, dataSource.doc())\n if (!queryParams.searchByNameQuery) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No searchByNameQuery given for endpoint data Source: ' + form))\n }\n queryParams.insitituteDetailsQuery = kb.anyJS(dataSource, ns.ui('insitituteDetailsQuery'), null, dataSource.doc())\n } else {\n // return box.appendChild(\n // widgets.errorMessageBlock(dom, 'Error: No SPARQL endpoint given for autocomplete field: ' + form))\n const searchByNameURI = kb.anyJS(dataSource, ns.ui('searchByNameURI'))\n if (!searchByNameURI) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No searchByNameURI OR sparql endpoint given for dataSource: ' + dataSource)\n )\n }\n queryParams.searchByNameURI = searchByNameURI\n }\n // It can be cleaner to just remove empty fields if you can't edit them anyway\n const suppressEmptyUneditable = kb.anyJS(form, ns.ui('suppressEmptyUneditable'), null, formDoc)\n const editable = kb.updater?.editable((doc as NamedNode).uri)\n\n const autocompleteOptions:AutocompleteOptions = { // cancelButton?: HTMLElement,\n permanent: true,\n targetClass: queryParams.targetClass, // @@ simplify?\n queryParams\n }\n\n autocompleteOptions.size = kb.anyJS(form, ns.ui('size'), null, formDoc) || undefined\n\n let obj = kb.any(subject, property as any, undefined, doc)\n if (!obj) {\n obj = kb.any(form, ns.ui('default'))\n if (obj) {\n autocompleteOptions.currentObject = obj as NamedNode\n autocompleteOptions.currentName = kb.any(autocompleteOptions.currentObject, labelProperty, null, doc) as Literal\n } else { // No data or default. Should we suprress the whole field?\n if (suppressEmptyUneditable && !editable) {\n box.style.display = 'none' // clutter removal\n return box\n }\n }\n } else { // get object and name from target data:\n autocompleteOptions.currentObject = obj as NamedNode\n autocompleteOptions.currentName = kb.any(autocompleteOptions.currentObject, labelProperty, null, doc) as Literal\n }\n\n lhs.appendChild(widgets.fieldLabel(dom, property as any, form))\n\n const barOptions = {\n editable,\n dbLookup: true\n }\n\n renderAutocompleteControl(dom, subject as NamedNode, barOptions, autocompleteOptions, addOneIdAndRefresh, deleteOne).then((control) => {\n rhs.appendChild(control)\n }, (err) => {\n rhs.appendChild(widgets.errorMessageBlock(dom, `Error rendering autocomplete ${form}: ${err}`, '#fee', err)) //\n })\n return box\n}\n\n// ends\n"],"mappings":";;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AARA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAT,CACLC,GADK,EAELC,SAFK,EAGLC,OAHK,EAILC,OAJK,EAKLC,IALK,EAMLC,GANK,EAOLC,gBAPK,EAQQ;EAAA;;EAAA,SACEC,kBADF;IAAA;EAAA;;EAAA;IAAA,oGACb,iBAAmCC,MAAnC,EAA+DC,IAA/D;MAAA;;MAAA;QAAA;UAAA;YAAA;cAAA,IACOA,IADP;gBAAA;gBAAA;cAAA;;cAAA,MAEU,IAAIC,KAAJ,CAAU,kCAAV,CAFV;;YAAA;cAIQC,QAJR,GAImBC,EAAE,CAACC,GAAH,CAAOV,OAAP,EAAgBW,QAAhB,EAAiC,IAAjC,EAAuCT,GAAvC,CAJnB;;cAAA,KAKMM,QALN;gBAAA;gBAAA;cAAA;;cAMUI,OANV,GAMoBH,EAAE,CAACI,GAAH,CAAOL,QAAP,EAAwBM,aAAxB,EAA8C,IAA9C,EAAoDZ,GAApD,CANpB;;cAAA,MAOQM,QAAQ,CAACO,MAAT,CAAgBV,MAAhB,KAA2BO,OAA3B,IAAsCA,OAAO,CAACI,QAAR,CAAiBV,IAAjB,CAP9C;gBAAA;gBAAA;cAAA;;cAAA;;YAAA;cAYQW,UAZR,GAYqBT,QAAQ,GACvBC,EAAE,CAACS,kBAAH,CAAsBlB,OAAtB,EAA+BW,QAA/B,EAAgDH,QAAhD,EAA0DN,GAA1D,EACCiB,MADD,CACQV,EAAE,CAACS,kBAAH,CAAsBV,QAAtB,EAAuCM,aAAvC,EAA6D,IAA7D,EAAmEZ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AC9G,CAJD;EAKA,OAAOhD,GAAP;AACD,C,CAED"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
exports.renderAutoComplete = renderAutoComplete;
|
|
11
11
|
exports.setVisible = setVisible;
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
14
|
|
|
15
15
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
16
|
|
|
@@ -28,7 +28,7 @@ var _language = require("./language");
|
|
|
28
28
|
|
|
29
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
30
30
|
|
|
31
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
31
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
32
|
|
|
33
33
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
34
34
|
|
|
@@ -36,8 +36,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
36
36
|
|
|
37
37
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
38
38
|
|
|
39
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == (0, _typeof2["default"])(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
40
|
-
|
|
41
39
|
var AUTOCOMPLETE_THRESHOLD = 4; // don't check until this many characters typed
|
|
42
40
|
|
|
43
41
|
var AUTOCOMPLETE_ROWS = 20; // 20?
|
|
@@ -68,10 +66,10 @@ function renderAutoComplete(_x, _x2, _x3, _x4) {
|
|
|
68
66
|
|
|
69
67
|
|
|
70
68
|
function _renderAutoComplete() {
|
|
71
|
-
_renderAutoComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
69
|
+
_renderAutoComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(dom, acOptions, decoration, callback) {
|
|
72
70
|
var complain, finish, gotIt, _gotIt, acceptButtonHandler, _acceptButtonHandler, cancelButtonHandler, _cancelButtonHandler, nameMatch, clearList, inputEventHHandler, _inputEventHHandler, loadBindingsAndFilterByLanguage, _loadBindingsAndFilterByLanguage, filterByName, refreshList, _refreshList, initialize, targetClass, lastBindings, loadedEnough, inputEventHandlerLock, allDisplayed, lastFilter, numberOfRows, div, foundName, foundObject, table, head, cell, searchInput, size, searchInputStyle;
|
|
73
71
|
|
|
74
|
-
return
|
|
72
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
75
73
|
while (1) {
|
|
76
74
|
switch (_context8.prev = _context8.next) {
|
|
77
75
|
case 0:
|
|
@@ -109,10 +107,10 @@ function _renderAutoComplete() {
|
|
|
109
107
|
};
|
|
110
108
|
|
|
111
109
|
_refreshList = function _refreshList3() {
|
|
112
|
-
_refreshList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
110
|
+
_refreshList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
113
111
|
var rowForBinding, compareBindingsByName, languagePrefs, filter, slimmed, displayable, _iterator, _step, binding;
|
|
114
112
|
|
|
115
|
-
return
|
|
113
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
116
114
|
while (1) {
|
|
117
115
|
switch (_context7.prev = _context7.next) {
|
|
118
116
|
case 0:
|
|
@@ -130,8 +128,8 @@ function _renderAutoComplete() {
|
|
|
130
128
|
var object = (0, _publicData.bindingToTerm)(binding.subject);
|
|
131
129
|
var nameTerm = (0, _publicData.bindingToTerm)(binding.name);
|
|
132
130
|
row.addEventListener('click', /*#__PURE__*/function () {
|
|
133
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
134
|
-
return
|
|
131
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(_event) {
|
|
132
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
135
133
|
while (1) {
|
|
136
134
|
switch (_context6.prev = _context6.next) {
|
|
137
135
|
case 0:
|
|
@@ -255,9 +253,9 @@ function _renderAutoComplete() {
|
|
|
255
253
|
};
|
|
256
254
|
|
|
257
255
|
_loadBindingsAndFilterByLanguage = function _loadBindingsAndFilte2() {
|
|
258
|
-
_loadBindingsAndFilterByLanguage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
256
|
+
_loadBindingsAndFilterByLanguage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(filter, languagePrefs) {
|
|
259
257
|
var bindings, slimmed;
|
|
260
|
-
return
|
|
258
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
261
259
|
while (1) {
|
|
262
260
|
switch (_context5.prev = _context5.next) {
|
|
263
261
|
case 0:
|
|
@@ -305,8 +303,8 @@ function _renderAutoComplete() {
|
|
|
305
303
|
};
|
|
306
304
|
|
|
307
305
|
_inputEventHHandler = function _inputEventHHandler3() {
|
|
308
|
-
_inputEventHHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
309
|
-
return
|
|
306
|
+
_inputEventHHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
307
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
310
308
|
while (1) {
|
|
311
309
|
switch (_context4.prev = _context4.next) {
|
|
312
310
|
case 0:
|
|
@@ -354,8 +352,8 @@ function _renderAutoComplete() {
|
|
|
354
352
|
};
|
|
355
353
|
|
|
356
354
|
_cancelButtonHandler = function _cancelButtonHandler3() {
|
|
357
|
-
_cancelButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
358
|
-
return
|
|
355
|
+
_cancelButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(_event) {
|
|
356
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
359
357
|
while (1) {
|
|
360
358
|
switch (_context3.prev = _context3.next) {
|
|
361
359
|
case 0:
|
|
@@ -384,8 +382,8 @@ function _renderAutoComplete() {
|
|
|
384
382
|
};
|
|
385
383
|
|
|
386
384
|
_acceptButtonHandler = function _acceptButtonHandler3() {
|
|
387
|
-
_acceptButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
388
|
-
return
|
|
385
|
+
_acceptButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_event) {
|
|
386
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
389
387
|
while (1) {
|
|
390
388
|
switch (_context2.prev = _context2.next) {
|
|
391
389
|
case 0:
|
|
@@ -409,8 +407,8 @@ function _renderAutoComplete() {
|
|
|
409
407
|
};
|
|
410
408
|
|
|
411
409
|
_gotIt = function _gotIt3() {
|
|
412
|
-
_gotIt = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
413
|
-
return
|
|
410
|
+
_gotIt = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(object, name) {
|
|
411
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
414
412
|
while (1) {
|
|
415
413
|
switch (_context.prev = _context.next) {
|
|
416
414
|
case 0:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocompletePicker.js","names":["AUTOCOMPLETE_THRESHOLD","AUTOCOMPLETE_ROWS","AUTOCOMPLETE_ROWS_STRETCH","setVisible","element","visible","style","display","renderAutoComplete","dom","acOptions","decoration","callback","complain","finish","gotIt","acceptButtonHandler","cancelButtonHandler","nameMatch","clearList","inputEventHHandler","loadBindingsAndFilterByLanguage","filterByName","refreshList","initialize","currentObject","searchInput","value","currentName","foundName","lastFilter","undefined","foundObject","deleteButton","acceptButton","editButton","cancelButton","inputEventHandlerLock","rowForBinding","compareBindingsByName","self","other","name","binding","row","createElement","setStyle","setAttribute","color","allDisplayed","textContent","object","bindingToTerm","subject","nameTerm","addEventListener","_event","debug","log","getPreferredLanguages","languagePrefs","filter","trim","toLowerCase","length","numberOfRows","startsWith","lastBindings","slimmed","loadedEnough","displayable","slice","sort","table","appendChild","bindings","queryPublicDataByName","targetClass","defaultPreferredLanguages","queryParams","AUTOCOMPLETE_LIMIT","filterByLanguage","children","removeChild","lastChild","candidate","parts","split","j","word","indexOf","permanent","div","parentNode","disbaled","termType","objectURIBase","store","sym","message","errorRow","err","Error","widgets","errorMessageBlock","padding","head","cell","size","textInputSize","searchInputStyle","textInputStyle","event","keyCode"],"sources":["../../../../src/widgets/forms/autocomplete/autocompletePicker.ts"],"sourcesContent":["/* Autocomplete Picker: Create and edit data using public data\n**\n** As the data source is passed as a parameter, all kinds of APIa and query services can be used\n**\n*/\nimport * as debug from '../../../debug'\nimport * as style from '../../../style'\nimport * as widgets from '../../../widgets'\nimport { store } from 'solid-logic'\nimport { NamedNode, Literal } from 'rdflib'\nimport { queryPublicDataByName, bindingToTerm, AUTOCOMPLETE_LIMIT, QueryParameters } from './publicData'\nimport { filterByLanguage, getPreferredLanguages, defaultPreferredLanguages } from './language'\n\nconst AUTOCOMPLETE_THRESHOLD = 4 // don't check until this many characters typed\nconst AUTOCOMPLETE_ROWS = 20 // 20?\nconst AUTOCOMPLETE_ROWS_STRETCH = 40\n\n/*\nAutocomplete happens in 6 phases:\n 1. The search string is too small to bother\n 2. The search string is big enough, and we have not loaded the array\n 3. The search string is big enough, and we have loaded array up to the limit\n Display them and wait for more user input\n 4. The search string is big enough, and we have loaded array NOT to the limit\n but including all matches. No more fetches.\n If user gets more precise, wait for them to select one - or reduce to a single\n 5. Single one selected. Optionally waiting for accept button to be pressed, OR can change string and go to 5 or 2\n 6. Locked with a value. Press 'edit' button to return to 5\n*/\n\nexport type AutocompleteDecoration = {\n acceptButton?: HTMLElement,\n cancelButton: HTMLElement, // Must have cancel button\n editButton?: HTMLElement,\n deleteButton?: HTMLElement\n}\nexport type AutocompleteOptions = {\n targetClass?: NamedNode,\n currentObject?: NamedNode,\n currentName?: Literal,\n queryParams: QueryParameters,\n size?: number,\n permanent?: boolean\n}\n\ninterface Callback1 {\n (_subject: NamedNode, _name: Literal): any;\n}\n\nexport function setVisible (element:HTMLElement, visible:boolean) {\n element.style.display = visible ? '' : 'none' // Do not use visibility, it holds the real estate\n}\n\n// The core of the autocomplete UI\nexport async function renderAutoComplete (dom: HTMLDocument,\n acOptions:AutocompleteOptions,\n decoration: AutocompleteDecoration,\n callback: Callback1) {\n function complain (message) {\n const errorRow = table.appendChild(dom.createElement('tr'))\n debug.log(message)\n const err = new Error(message)\n errorRow.appendChild(widgets.errorMessageBlock(dom, err, 'pink'))\n // errorMessageBlock will log the stack to the console\n style.setStyle(errorRow, 'autocompleteRowStyle')\n errorRow.style.padding = '1em'\n }\n\n function finish (object, name) {\n debug.log('Auto complete: finish! ' + object)\n if (object.termType === 'Literal' && acOptions.queryParams.objectURIBase) {\n object = store.sym(acOptions.queryParams.objectURIBase.value + object.value)\n }\n // remove(decoration.cancelButton)\n // remove(decoration.acceptButton)\n // remove(div)\n clearList()\n callback(object, name)\n }\n async function gotIt (object:NamedNode | Literal, name: Literal) {\n if (decoration.acceptButton) {\n (decoration.acceptButton as any).disbaled = false\n setVisible(decoration.acceptButton, true) // now wait for confirmation\n searchInput.value = name.value // complete it\n foundName = name\n foundObject = object\n debug.log('Auto complete: name: ' + name)\n debug.log('Auto complete: waiting for accept ' + object)\n clearList() // This may be an option - nice and clean but does not allow change of mind\n return\n }\n setVisible(decoration.cancelButton, true)\n finish(object, name)\n }\n\n async function acceptButtonHandler (_event) {\n if (foundName && searchInput.value === foundName.value) { // still\n finish(foundObject, foundName)\n }\n }\n\n async function cancelButtonHandler (_event) {\n debug.log('Auto complete: Canceled by user! ')\n if (acOptions.permanent) {\n initialize()\n } else {\n if (div.parentNode) {\n div.parentNode.removeChild(div)\n }\n }\n }\n\n function nameMatch (filter:string, candidate: string):boolean {\n const parts = filter.split(' ') // Each name part must be somewhere\n for (let j = 0; j < parts.length; j++) {\n const word = parts[j]\n if (candidate.toLowerCase().indexOf(word) < 0) return false\n }\n return true\n }\n\n function clearList () {\n while (table.children.length > 1) {\n table.removeChild(table.lastChild as Node)\n }\n }\n\n async function inputEventHHandler (_event) {\n // console.log('@@ AC inputEventHHandler called')\n setVisible(decoration.cancelButton, true) // only allow cancel when there is something to cancel\n refreshList() /// @@ debounqce does not work with jest\n /*\n if (runningTimeout) {\n clearTimeout(runningTimeout)\n }\n runningTimeout = setTimeout(refreshList, AUTOCOMPLETE_DEBOUNCE_MS)\n */\n }\n\n async function loadBindingsAndFilterByLanguage (filter, languagePrefs) {\n // console.log('@@ loadBindingsAndFilterByLanguage ' + filter)\n let bindings\n try {\n bindings = await queryPublicDataByName(filter, targetClass as any,\n languagePrefs || defaultPreferredLanguages, acOptions.queryParams)\n } catch (err) {\n complain('Error querying db of organizations: ' + err)\n inputEventHandlerLock = false\n return\n }\n loadedEnough = bindings.length < AUTOCOMPLETE_LIMIT\n if (loadedEnough) {\n lastFilter = filter\n } else {\n lastFilter = undefined\n }\n clearList()\n const slimmed = filterByLanguage(bindings, languagePrefs)\n return slimmed\n }\n\n function filterByName (filter, bindings) {\n return bindings.filter(binding => nameMatch(filter, binding.name.value))\n }\n\n async function refreshList () {\n // console.log('@@ refreshList called')\n function rowForBinding (binding) {\n const row = dom.createElement('tr')\n style.setStyle(row, 'autocompleteRowStyle')\n row.setAttribute('style', 'padding: 0.3em;')\n row.style.color = allDisplayed ? '#080' : '#088' // green means 'you should find it here'\n row.textContent = binding.name.value\n const object = bindingToTerm(binding.subject)\n const nameTerm = bindingToTerm(binding.name)\n row.addEventListener('click', async _event => {\n debug.log(' click row textContent: ' + row.textContent)\n debug.log(' click name: ' + nameTerm.value)\n if (object && nameTerm) {\n gotIt(object, nameTerm as Literal)\n }\n })\n return row\n } // rowForBinding\n function compareBindingsByName (self, other) {\n return other.name.value > self.name.value\n ? 1\n : other.name.name < self.name.value ? -1 : 0\n }\n\n if (inputEventHandlerLock) {\n debug.log(`Ignoring \"${searchInput.value}\" because of lock `)\n return\n }\n debug.log(`Setting lock at \"${searchInput.value}\"`)\n\n inputEventHandlerLock = true\n const languagePrefs = await getPreferredLanguages()\n const filter = searchInput.value.trim().toLowerCase()\n if (filter.length < AUTOCOMPLETE_THRESHOLD) { // too small\n clearList()\n // candidatesLoaded = false\n numberOfRows = AUTOCOMPLETE_ROWS\n } else {\n if (!allDisplayed || !lastFilter || !filter.startsWith(lastFilter)) {\n debug.log(` Querying database at \"${filter}\" cf last \"${lastFilter}\".`)\n lastBindings = await loadBindingsAndFilterByLanguage(filter, languagePrefs) // freesh query\n }\n // Trim table as search gets tighter:\n const slimmed = filterByName(filter, lastBindings)\n if (loadedEnough && slimmed.length <= AUTOCOMPLETE_ROWS_STRETCH) {\n numberOfRows = slimmed.length // stretch if it means we get all items\n }\n allDisplayed = loadedEnough && slimmed.length <= numberOfRows\n debug.log(` Filter:\"${filter}\" lastBindings: ${lastBindings.length}, slimmed to ${slimmed.length}; rows: ${numberOfRows}, Enough? ${loadedEnough}, All displayed? ${allDisplayed}`)\n\n const displayable = slimmed.slice(0, numberOfRows)\n\n displayable.sort(compareBindingsByName)\n clearList()\n for (const binding of displayable) {\n table.appendChild(rowForBinding(binding))\n }\n if (slimmed.length === 1) {\n gotIt(bindingToTerm(slimmed[0].subject), bindingToTerm(slimmed[0].name) as Literal)\n }\n } // else\n inputEventHandlerLock = false\n } // refreshList\n\n function initialize () {\n if (acOptions.currentObject) { // If have existing value then jump into the endgame of the autocomplete\n searchInput.value = acOptions.currentName ? acOptions.currentName.value : '??? wot no name for ' + acOptions.currentObject\n foundName = acOptions.currentName\n lastFilter = acOptions.currentName ? acOptions.currentName.value : undefined\n foundObject = acOptions.currentObject\n } else {\n searchInput.value = ''\n lastFilter = undefined\n foundObject = undefined\n }\n if (decoration.deleteButton) {\n setVisible(decoration.deleteButton, !!acOptions.currentObject)\n }\n\n if (decoration.acceptButton) {\n setVisible(decoration.acceptButton, false) // hide until input complete\n }\n if (decoration.editButton) {\n setVisible(decoration.editButton, true)\n }\n if (decoration.cancelButton) {\n setVisible(decoration.cancelButton, false) // only allow cancel when there is something to cancel\n }\n inputEventHandlerLock = false\n clearList()\n } // initialiize\n\n // const queryParams: QueryParameters = acOptions.queryParams\n const targetClass = acOptions.targetClass\n if (!targetClass) throw new Error('renderAutoComplete: missing targetClass')\n // console.log(`renderAutoComplete: targetClass=${targetClass}` )\n if (decoration.acceptButton) {\n decoration.acceptButton.addEventListener('click', acceptButtonHandler, false)\n }\n if (decoration.cancelButton) {\n decoration.cancelButton.addEventListener('click', cancelButtonHandler, false)\n }\n\n // var candidatesLoaded = false\n let lastBindings\n let loadedEnough = false\n let inputEventHandlerLock = false\n let allDisplayed = false\n let lastFilter = undefined as (string | undefined)\n let numberOfRows = AUTOCOMPLETE_ROWS // this gets slimmed down\n const div = dom.createElement('div')\n let foundName = undefined as (Literal | undefined)// once found accepted string must match this\n let foundObject = undefined as (NamedNode | Literal | undefined)\n const table = div.appendChild(dom.createElement('table'))\n table.setAttribute('data-testid', 'autocomplete-table')\n table.setAttribute('style', 'max-width: 30em; margin: 0.5em;')\n const head = table.appendChild(dom.createElement('tr'))\n style.setStyle(head, 'autocompleteRowStyle') // textInputStyle or\n const cell = head.appendChild(dom.createElement('td'))\n const searchInput = cell.appendChild(dom.createElement('input'))\n searchInput.setAttribute('type', 'text')\n\n initialize()\n\n const size = acOptions.size || style.textInputSize || 20\n searchInput.setAttribute('size', size)\n searchInput.setAttribute('data-testid', 'autocomplete-input')\n\n const searchInputStyle = style.textInputStyle || // searchInputStyle ?\n 'border: 0.1em solid #444; border-radius: 0.5em; width: 100%; font-size: 100%; padding: 0.1em 0.6em' // @\n searchInput.setAttribute('style', searchInputStyle)\n searchInput.addEventListener('keyup', function (event) {\n if (event.keyCode === 13) {\n acceptButtonHandler(event)\n }\n }, false)\n\n searchInput.addEventListener('input', inputEventHHandler)\n // console.log('@@ renderAutoComplete returns ' + div.innerHTML)\n return div\n} // renderAutoComplete\n\n// ENDS\n"],"mappings":";;;;;;;;;;;;;;;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;;;+CAVA,oJ;;AAYA,IAAMA,sBAAsB,GAAG,CAA/B,C,CAAiC;;AACjC,IAAMC,iBAAiB,GAAG,EAA1B,C,CAA6B;;AAC7B,IAAMC,yBAAyB,GAAG,EA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AAZ,CAA6B,OAA7B,EAAsC,UAAUyD,KAAV,EAAiB;cACrD,IAAIA,KAAK,CAACC,OAAN,KAAkB,EAAtB,EAA0B;gBACxBjG,mBAAmB,CAACgG,KAAD,CAAnB;cACD;YACF,CAJD,EAIG,KAJH;YAMAtF,WAAW,CAAC6B,gBAAZ,CAA6B,OAA7B,EAAsCnC,kBAAtC,EAzPK,CA0PL;;YA1PK,kCA2PEwE,GA3PF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
|
|
1
|
+
{"version":3,"file":"autocompletePicker.js","names":["AUTOCOMPLETE_THRESHOLD","AUTOCOMPLETE_ROWS","AUTOCOMPLETE_ROWS_STRETCH","setVisible","element","visible","style","display","renderAutoComplete","dom","acOptions","decoration","callback","complain","finish","gotIt","acceptButtonHandler","cancelButtonHandler","nameMatch","clearList","inputEventHHandler","loadBindingsAndFilterByLanguage","filterByName","refreshList","initialize","currentObject","searchInput","value","currentName","foundName","lastFilter","undefined","foundObject","deleteButton","acceptButton","editButton","cancelButton","inputEventHandlerLock","rowForBinding","compareBindingsByName","self","other","name","binding","row","createElement","setStyle","setAttribute","color","allDisplayed","textContent","object","bindingToTerm","subject","nameTerm","addEventListener","_event","debug","log","getPreferredLanguages","languagePrefs","filter","trim","toLowerCase","length","numberOfRows","startsWith","lastBindings","slimmed","loadedEnough","displayable","slice","sort","table","appendChild","bindings","queryPublicDataByName","targetClass","defaultPreferredLanguages","queryParams","AUTOCOMPLETE_LIMIT","filterByLanguage","children","removeChild","lastChild","candidate","parts","split","j","word","indexOf","permanent","div","parentNode","disbaled","termType","objectURIBase","store","sym","message","errorRow","err","Error","widgets","errorMessageBlock","padding","head","cell","size","textInputSize","searchInputStyle","textInputStyle","event","keyCode"],"sources":["../../../../src/widgets/forms/autocomplete/autocompletePicker.ts"],"sourcesContent":["/* Autocomplete Picker: Create and edit data using public data\n**\n** As the data source is passed as a parameter, all kinds of APIa and query services can be used\n**\n*/\nimport * as debug from '../../../debug'\nimport * as style from '../../../style'\nimport * as widgets from '../../../widgets'\nimport { store } from 'solid-logic'\nimport { NamedNode, Literal } from 'rdflib'\nimport { queryPublicDataByName, bindingToTerm, AUTOCOMPLETE_LIMIT, QueryParameters } from './publicData'\nimport { filterByLanguage, getPreferredLanguages, defaultPreferredLanguages } from './language'\n\nconst AUTOCOMPLETE_THRESHOLD = 4 // don't check until this many characters typed\nconst AUTOCOMPLETE_ROWS = 20 // 20?\nconst AUTOCOMPLETE_ROWS_STRETCH = 40\n\n/*\nAutocomplete happens in 6 phases:\n 1. The search string is too small to bother\n 2. The search string is big enough, and we have not loaded the array\n 3. The search string is big enough, and we have loaded array up to the limit\n Display them and wait for more user input\n 4. The search string is big enough, and we have loaded array NOT to the limit\n but including all matches. No more fetches.\n If user gets more precise, wait for them to select one - or reduce to a single\n 5. Single one selected. Optionally waiting for accept button to be pressed, OR can change string and go to 5 or 2\n 6. Locked with a value. Press 'edit' button to return to 5\n*/\n\nexport type AutocompleteDecoration = {\n acceptButton?: HTMLElement,\n cancelButton: HTMLElement, // Must have cancel button\n editButton?: HTMLElement,\n deleteButton?: HTMLElement\n}\nexport type AutocompleteOptions = {\n targetClass?: NamedNode,\n currentObject?: NamedNode,\n currentName?: Literal,\n queryParams: QueryParameters,\n size?: number,\n permanent?: boolean\n}\n\ninterface Callback1 {\n (_subject: NamedNode, _name: Literal): any;\n}\n\nexport function setVisible (element:HTMLElement, visible:boolean) {\n element.style.display = visible ? '' : 'none' // Do not use visibility, it holds the real estate\n}\n\n// The core of the autocomplete UI\nexport async function renderAutoComplete (dom: HTMLDocument,\n acOptions:AutocompleteOptions,\n decoration: AutocompleteDecoration,\n callback: Callback1) {\n function complain (message) {\n const errorRow = table.appendChild(dom.createElement('tr'))\n debug.log(message)\n const err = new Error(message)\n errorRow.appendChild(widgets.errorMessageBlock(dom, err, 'pink'))\n // errorMessageBlock will log the stack to the console\n style.setStyle(errorRow, 'autocompleteRowStyle')\n errorRow.style.padding = '1em'\n }\n\n function finish (object, name) {\n debug.log('Auto complete: finish! ' + object)\n if (object.termType === 'Literal' && acOptions.queryParams.objectURIBase) {\n object = store.sym(acOptions.queryParams.objectURIBase.value + object.value)\n }\n // remove(decoration.cancelButton)\n // remove(decoration.acceptButton)\n // remove(div)\n clearList()\n callback(object, name)\n }\n async function gotIt (object:NamedNode | Literal, name: Literal) {\n if (decoration.acceptButton) {\n (decoration.acceptButton as any).disbaled = false\n setVisible(decoration.acceptButton, true) // now wait for confirmation\n searchInput.value = name.value // complete it\n foundName = name\n foundObject = object\n debug.log('Auto complete: name: ' + name)\n debug.log('Auto complete: waiting for accept ' + object)\n clearList() // This may be an option - nice and clean but does not allow change of mind\n return\n }\n setVisible(decoration.cancelButton, true)\n finish(object, name)\n }\n\n async function acceptButtonHandler (_event) {\n if (foundName && searchInput.value === foundName.value) { // still\n finish(foundObject, foundName)\n }\n }\n\n async function cancelButtonHandler (_event) {\n debug.log('Auto complete: Canceled by user! ')\n if (acOptions.permanent) {\n initialize()\n } else {\n if (div.parentNode) {\n div.parentNode.removeChild(div)\n }\n }\n }\n\n function nameMatch (filter:string, candidate: string):boolean {\n const parts = filter.split(' ') // Each name part must be somewhere\n for (let j = 0; j < parts.length; j++) {\n const word = parts[j]\n if (candidate.toLowerCase().indexOf(word) < 0) return false\n }\n return true\n }\n\n function clearList () {\n while (table.children.length > 1) {\n table.removeChild(table.lastChild as Node)\n }\n }\n\n async function inputEventHHandler (_event) {\n // console.log('@@ AC inputEventHHandler called')\n setVisible(decoration.cancelButton, true) // only allow cancel when there is something to cancel\n refreshList() /// @@ debounqce does not work with jest\n /*\n if (runningTimeout) {\n clearTimeout(runningTimeout)\n }\n runningTimeout = setTimeout(refreshList, AUTOCOMPLETE_DEBOUNCE_MS)\n */\n }\n\n async function loadBindingsAndFilterByLanguage (filter, languagePrefs) {\n // console.log('@@ loadBindingsAndFilterByLanguage ' + filter)\n let bindings\n try {\n bindings = await queryPublicDataByName(filter, targetClass as any,\n languagePrefs || defaultPreferredLanguages, acOptions.queryParams)\n } catch (err) {\n complain('Error querying db of organizations: ' + err)\n inputEventHandlerLock = false\n return\n }\n loadedEnough = bindings.length < AUTOCOMPLETE_LIMIT\n if (loadedEnough) {\n lastFilter = filter\n } else {\n lastFilter = undefined\n }\n clearList()\n const slimmed = filterByLanguage(bindings, languagePrefs)\n return slimmed\n }\n\n function filterByName (filter, bindings) {\n return bindings.filter(binding => nameMatch(filter, binding.name.value))\n }\n\n async function refreshList () {\n // console.log('@@ refreshList called')\n function rowForBinding (binding) {\n const row = dom.createElement('tr')\n style.setStyle(row, 'autocompleteRowStyle')\n row.setAttribute('style', 'padding: 0.3em;')\n row.style.color = allDisplayed ? '#080' : '#088' // green means 'you should find it here'\n row.textContent = binding.name.value\n const object = bindingToTerm(binding.subject)\n const nameTerm = bindingToTerm(binding.name)\n row.addEventListener('click', async _event => {\n debug.log(' click row textContent: ' + row.textContent)\n debug.log(' click name: ' + nameTerm.value)\n if (object && nameTerm) {\n gotIt(object, nameTerm as Literal)\n }\n })\n return row\n } // rowForBinding\n function compareBindingsByName (self, other) {\n return other.name.value > self.name.value\n ? 1\n : other.name.name < self.name.value ? -1 : 0\n }\n\n if (inputEventHandlerLock) {\n debug.log(`Ignoring \"${searchInput.value}\" because of lock `)\n return\n }\n debug.log(`Setting lock at \"${searchInput.value}\"`)\n\n inputEventHandlerLock = true\n const languagePrefs = await getPreferredLanguages()\n const filter = searchInput.value.trim().toLowerCase()\n if (filter.length < AUTOCOMPLETE_THRESHOLD) { // too small\n clearList()\n // candidatesLoaded = false\n numberOfRows = AUTOCOMPLETE_ROWS\n } else {\n if (!allDisplayed || !lastFilter || !filter.startsWith(lastFilter)) {\n debug.log(` Querying database at \"${filter}\" cf last \"${lastFilter}\".`)\n lastBindings = await loadBindingsAndFilterByLanguage(filter, languagePrefs) // freesh query\n }\n // Trim table as search gets tighter:\n const slimmed = filterByName(filter, lastBindings)\n if (loadedEnough && slimmed.length <= AUTOCOMPLETE_ROWS_STRETCH) {\n numberOfRows = slimmed.length // stretch if it means we get all items\n }\n allDisplayed = loadedEnough && slimmed.length <= numberOfRows\n debug.log(` Filter:\"${filter}\" lastBindings: ${lastBindings.length}, slimmed to ${slimmed.length}; rows: ${numberOfRows}, Enough? ${loadedEnough}, All displayed? ${allDisplayed}`)\n\n const displayable = slimmed.slice(0, numberOfRows)\n\n displayable.sort(compareBindingsByName)\n clearList()\n for (const binding of displayable) {\n table.appendChild(rowForBinding(binding))\n }\n if (slimmed.length === 1) {\n gotIt(bindingToTerm(slimmed[0].subject), bindingToTerm(slimmed[0].name) as Literal)\n }\n } // else\n inputEventHandlerLock = false\n } // refreshList\n\n function initialize () {\n if (acOptions.currentObject) { // If have existing value then jump into the endgame of the autocomplete\n searchInput.value = acOptions.currentName ? acOptions.currentName.value : '??? wot no name for ' + acOptions.currentObject\n foundName = acOptions.currentName\n lastFilter = acOptions.currentName ? acOptions.currentName.value : undefined\n foundObject = acOptions.currentObject\n } else {\n searchInput.value = ''\n lastFilter = undefined\n foundObject = undefined\n }\n if (decoration.deleteButton) {\n setVisible(decoration.deleteButton, !!acOptions.currentObject)\n }\n\n if (decoration.acceptButton) {\n setVisible(decoration.acceptButton, false) // hide until input complete\n }\n if (decoration.editButton) {\n setVisible(decoration.editButton, true)\n }\n if (decoration.cancelButton) {\n setVisible(decoration.cancelButton, false) // only allow cancel when there is something to cancel\n }\n inputEventHandlerLock = false\n clearList()\n } // initialiize\n\n // const queryParams: QueryParameters = acOptions.queryParams\n const targetClass = acOptions.targetClass\n if (!targetClass) throw new Error('renderAutoComplete: missing targetClass')\n // console.log(`renderAutoComplete: targetClass=${targetClass}` )\n if (decoration.acceptButton) {\n decoration.acceptButton.addEventListener('click', acceptButtonHandler, false)\n }\n if (decoration.cancelButton) {\n decoration.cancelButton.addEventListener('click', cancelButtonHandler, false)\n }\n\n // var candidatesLoaded = false\n let lastBindings\n let loadedEnough = false\n let inputEventHandlerLock = false\n let allDisplayed = false\n let lastFilter = undefined as (string | undefined)\n let numberOfRows = AUTOCOMPLETE_ROWS // this gets slimmed down\n const div = dom.createElement('div')\n let foundName = undefined as (Literal | undefined)// once found accepted string must match this\n let foundObject = undefined as (NamedNode | Literal | undefined)\n const table = div.appendChild(dom.createElement('table'))\n table.setAttribute('data-testid', 'autocomplete-table')\n table.setAttribute('style', 'max-width: 30em; margin: 0.5em;')\n const head = table.appendChild(dom.createElement('tr'))\n style.setStyle(head, 'autocompleteRowStyle') // textInputStyle or\n const cell = head.appendChild(dom.createElement('td'))\n const searchInput = cell.appendChild(dom.createElement('input'))\n searchInput.setAttribute('type', 'text')\n\n initialize()\n\n const size = acOptions.size || style.textInputSize || 20\n searchInput.setAttribute('size', size)\n searchInput.setAttribute('data-testid', 'autocomplete-input')\n\n const searchInputStyle = style.textInputStyle || // searchInputStyle ?\n 'border: 0.1em solid #444; border-radius: 0.5em; width: 100%; font-size: 100%; padding: 0.1em 0.6em' // @\n searchInput.setAttribute('style', searchInputStyle)\n searchInput.addEventListener('keyup', function (event) {\n if (event.keyCode === 13) {\n acceptButtonHandler(event)\n }\n }, false)\n\n searchInput.addEventListener('input', inputEventHHandler)\n // console.log('@@ renderAutoComplete returns ' + div.innerHTML)\n return div\n} // renderAutoComplete\n\n// ENDS\n"],"mappings":";;;;;;;;;;;;;;;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;;;AAEA,IAAMA,sBAAsB,GAAG,CAA/B,C,CAAiC;;AACjC,IAAMC,iBAAiB,GAAG,EAA1B,C,CAA6B;;AAC7B,IAAMC,yBAAyB,GAAG,EAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBO,SAASC,UAAT,CAAqBC,OAArB,EAA0CC,OAA1C,EAA2D;EAChED,OAAO,CAACE,KAAR,CAAcC,OAAd,GAAwBF,OAAO,GAAG,EAAH,GAAQ,MAAvC,CADgE,CAClB;AAC/C,C,CAED;;;SACsBG,kB;;EA4PpB;AAEF;;;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