solid-ui 2.4.22-a5a36443 → 2.4.22-ad7ebd96
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 +7552 -7079
- package/dist/main.js.map +1 -1
- package/lib/acl/access-controller.js.map +1 -1
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl-control.js.map +1 -1
- package/lib/acl/acl.js.map +1 -1
- package/lib/acl/add-agent-buttons.js +0 -1
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/acl/index.js.map +1 -1
- package/lib/acl/styles.js.map +1 -1
- package/lib/acl/types.js.map +1 -1
- package/lib/chat/bookmarks.js +2 -4
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js.map +1 -1
- package/lib/create/create.js.map +1 -1
- package/lib/create/index.js.map +1 -1
- package/lib/create/types.js.map +1 -1
- package/lib/debug.js.map +1 -1
- package/lib/folders.js.map +1 -1
- package/lib/footer/index.js.map +1 -1
- package/lib/footer/styleMap.js.map +1 -1
- package/lib/header/empty-profile.js.map +1 -1
- package/lib/header/index.js.map +1 -1
- package/lib/header/styleMap.js.map +1 -1
- package/lib/iconBase.js +3 -2
- package/lib/iconBase.js.map +1 -1
- package/lib/icons/solid_logo.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jss/index.js.map +1 -1
- package/lib/log.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 +290 -342
- package/lib/login/login.js.map +1 -1
- package/lib/matrix/index.js.map +1 -1
- package/lib/matrix/matrix.js.map +1 -1
- package/lib/matrix/types.js.map +1 -1
- package/lib/media/index.js.map +1 -1
- package/lib/media/media-capture.js.map +1 -1
- package/lib/messageArea.js.map +1 -1
- package/lib/noun_Camera_1618446_000000.js.map +1 -1
- package/lib/ns.js.map +1 -1
- package/lib/pad.js.map +1 -1
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js.map +1 -1
- package/lib/signup/config-default.js.map +1 -1
- package/lib/signup/signup.js.map +1 -1
- package/lib/stories/decorators.js.map +1 -1
- package/lib/style.js.map +1 -1
- package/lib/style_multiSelect.js +67 -0
- package/lib/style_multiSelect.js.map +1 -0
- package/lib/table.js.map +1 -1
- package/lib/tabs.d.ts +1 -1
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +34 -21
- package/lib/tabs.js.map +1 -1
- package/lib/typings.d.js.map +1 -1
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/label.js.map +1 -1
- package/lib/versionInfo.d.ts +9 -9
- package/lib/versionInfo.js +14 -14
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons/iconLinks.js.map +1 -1
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/dragAndDrop.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.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
- package/lib/widgets/forms/basic.js.map +1 -1
- package/lib/widgets/forms/comment.js.map +1 -1
- package/lib/widgets/forms/fieldFunction.js.map +1 -1
- package/lib/widgets/forms/fieldParams.js.map +1 -1
- package/lib/widgets/forms/formStyle.js.map +1 -1
- package/lib/widgets/forms.js +168 -66
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/index.js.map +1 -1
- package/lib/widgets/multiSelect.js +784 -0
- package/lib/widgets/multiSelect.js.map +1 -0
- package/lib/widgets/peoplePicker.js.map +1 -1
- package/lib/widgets/widgetHelpers.js.map +1 -1
- package/package.json +11 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/widgets/forms/basic.ts"],"names":["store","solidLogicSingleton","renderNameValuePair","dom","kb","box","form","label","style","display","flexDirection","lhs","appendChild","createElement","width","formFieldNameBoxWidth","rhs","setAttribute","formFieldNameBoxStyle","createTextNode","any","ns","ui","fieldLabel","property","fieldInQuestion","lab","undefined","anchor","uri","textContent","fieldStore","subject","predicate","def","sts","statementsMatching","length","updater","Error","why","value","editable","sym","basicField","container","already","doc","callbackFunction","formDoc","suppressEmptyUneditable","anyJS","params","fieldParams","paramStyle","textInputStyle","field","type","size","textInputSize","maxLength","obj","uriPrefix","decodeURIComponent","replace","readOnly","textInputStyleUneditable","addEventListener","_e","pattern","match","disabled","ds","result","namedNode","encodeURIComponent","dt","Literal","trim","xsd","is","map","statement","updateMany","callback","docs","forEach","st","includes","push","update","pop","is1","filter","is2","ds1","ds2","ok","body"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,KAAK,GAAGC,gCAAoBD,KAAlC;AAEA;AACA;;AACO,SAASE,mBAAT,CAA8BC,GAA9B,EAAiDC,EAAjD,EAA4DC,GAA5D,EAA8EC,IAA9E,EAA+FC,KAA/F,EAA2H;AAChI;AACAF,EAAAA,GAAG,CAACG,KAAJ,CAAUC,OAAV,GAAoB,MAApB;AACAJ,EAAAA,GAAG,CAACG,KAAJ,CAAUE,aAAV,GAA0B,KAA1B;AACA,MAAMC,GAAG,GAAGN,GAAG,CAACO,WAAJ,CAAgBT,GAAG,CAACU,aAAJ,CAAkB,KAAlB,CAAhB,CAAZ;AACAF,EAAAA,GAAG,CAACH,KAAJ,CAAUM,KAAV,GAAkBC,4BAAlB;AACA,MAAM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,IAAvB,CAAhB;AACD;;AACDlD,MAAAA,gBAAgB,CAACiD,EAAD,EAAKC,IAAL,CAAhB;AACD,KATS,CAAV;AAUD,GA5EH,EA6EE,IA7EF;AA+EA,SAAO7F,GAAP;AACD","sourcesContent":["import { BlankNode, Literal, NamedNode, Node, st, Store, Variable } from 'rdflib'\nimport { solidLogicSingleton } from 'solid-logic'\nimport * as ns from '../../ns'\nimport { formFieldNameBoxStyle, formFieldNameBoxWidth, textInputSize, textInputStyle, textInputStyleUneditable } from '../../style'\nimport { label } from '../../utils'\nimport { errorMessageBlock } from '../error'\nimport { mostSpecificClassURI } from './fieldFunction'\nimport { fieldParams } from './fieldParams'\n\nconst store = solidLogicSingleton.store\n\n/* Style and create a name, value pair\n*/\nexport function renderNameValuePair (dom: HTMLDocument, kb: Store, box: HTMLElement, form: NamedNode, label?: string):HTMLElement {\n // const property = kb.any(form, ns.ui('property'))\n box.style.display = 'flex'\n box.style.flexDirection = 'row'\n const lhs = box.appendChild(dom.createElement('div'))\n lhs.style.width = formFieldNameBoxWidth\n const rhs = box.appendChild(dom.createElement('div'))\n\n lhs.setAttribute('class', 'formFieldName')\n lhs.setAttribute('style', formFieldNameBoxStyle)\n rhs.setAttribute('class', 'formFieldValue')\n if (label) {\n lhs.appendChild(dom.createTextNode(label))\n } else if (kb.any(form, ns.ui('property'))) { // Assume more space for error on right\n lhs.appendChild(fieldLabel(dom, kb.any(form, ns.ui('property')) as NamedNode, form))\n } else {\n rhs.appendChild(errorMessageBlock(dom, 'No property or label given for form field: ' + form))\n lhs.appendChild(dom.createTextNode('???'))\n }\n return rhs\n}\n\n/**\n * Create an anchor element with a label as the anchor text.\n *\n * @param dom The DOM\n * @param property href for the anchor element\n * @param fieldInQuestion field to produce a label for\n *\n * @internal exporting this only for unit tests\n */\nexport function fieldLabel (dom: HTMLDocument, property: NamedNode | undefined, fieldInQuestion: Node): HTMLElement | Text {\n let lab = store.any(fieldInQuestion as any, ns.ui('label'))\n if (!lab) lab = label(property, true) // Init capital\n if (property === undefined) {\n return dom.createTextNode('@@Internal error: undefined property')\n }\n const anchor = dom.createElement('a')\n /* istanbul ignore next */\n if (property.uri) anchor.setAttribute('href', property.uri)\n anchor.setAttribute('style', 'color: #3B5998; text-decoration: none;') // Not too blue and no underline\n anchor.textContent = lab as any\n return anchor\n}\n\n/**\n * Returns the document for the first quad that matches\n * the subject and predicate provided, or default if that\n * store is not editable.\n *\n * @param subject Subject about which we want to find an editable RDF document\n * @param predicate Predicate about which we want to find an editable RDF document\n * @param def default RDF document to return if none found\n *\n * @internal exporting this only for unit tests\n */\nexport function fieldStore (subject: NamedNode | BlankNode | Variable, predicate: NamedNode | Variable, def: NamedNode | undefined): NamedNode | undefined {\n const sts = store.statementsMatching(subject, predicate)\n if (sts.length === 0) return def // can used default as no data yet\n if (!store.updater) {\n throw new Error('Store has no updater')\n }\n if (\n sts.length > 0 &&\n sts[0].why.value &&\n store.updater.editable(sts[0].why.value, store)\n ) {\n return store.sym(sts[0].why.value)\n }\n return def\n}\n\n/**\n * Render a basic form field\n *\n * The same function is used for many similar one-value fields, with different\n * regexps used to validate.\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?\n *\n * @returns The HTML widget created\n */\n// eslint-disable-next-line complexity\nexport function basicField (\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 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\n const property = kb.any(form, ns.ui('property'))\n if (container) container.appendChild(box)\n if (!property) {\n return box.appendChild(\n errorMessageBlock(dom, 'Error: No property given for text field: ' + form)\n )\n }\n const rhs = renderNameValuePair(dom, kb, box, form)\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\n const uri = mostSpecificClassURI(form)\n let params = fieldParams[uri]\n if (params === undefined) params = { style: '' } // non-bottom field types can do this\n const paramStyle = params.style || ''\n const style = textInputStyle + paramStyle\n const field = dom.createElement('input')\n ;(field as any).style = style\n rhs.appendChild(field)\n field.setAttribute('type', params.type ? params.type : 'text')\n\n const size = kb.anyJS(form, ns.ui('size')) || textInputSize || 20\n field.setAttribute('size', size)\n\n const maxLength = kb.any(form, ns.ui('maxLength'))\n field.setAttribute('maxLength', maxLength ? '' + maxLength : '4096')\n\n doc = doc || fieldStore(subject, property as any, doc)\n\n let obj = kb.any(subject, property as any, undefined, doc)\n if (!obj) {\n obj = kb.any(form, ns.ui('default'))\n }\n if (obj && obj.value && params.uriPrefix) {\n // eg tel: or mailto:\n field.value = decodeURIComponent(obj.value.replace(params.uriPrefix, '')) // should have no spaces but in case\n .replace(/ /g, '')\n } else if (obj) {\n /* istanbul ignore next */\n field.value = obj.value || obj.value || ''\n }\n field.setAttribute('style', style)\n if (!kb.updater) {\n throw new Error('kb has no updater')\n }\n if (!kb.updater.editable((doc as NamedNode).uri)) {\n field.readOnly = true // was: disabled. readOnly is better\n ;(field as any).style = textInputStyleUneditable + paramStyle\n // backgroundColor = textInputBackgroundColorUneditable\n if (suppressEmptyUneditable && field.value === '') {\n box.style.display = 'none' // clutter\n }\n return box\n }\n\n // read-write:\n field.addEventListener(\n 'keyup',\n function (_e) {\n if (params.pattern) {\n field.setAttribute(\n 'style',\n style +\n (field.value.match(params.pattern)\n ? 'color: green;'\n : 'color: red;')\n )\n }\n },\n true\n )\n field.addEventListener(\n 'change',\n function (_e) {\n // i.e. lose focus with changed data\n if (params.pattern && !field.value.match(params.pattern)) return\n field.disabled = true // See if this stops getting two dates from fumbling e.g the chrome datepicker.\n field.setAttribute('style', style + 'color: gray;') // pending\n const ds = kb.statementsMatching(subject, property as any) // remove any multiple values\n let result\n if (params.namedNode) {\n result = kb.sym(field.value)\n } else if (params.uriPrefix) {\n result = encodeURIComponent(field.value.replace(/ /g, ''))\n result = kb.sym(params.uriPrefix + field.value)\n } else {\n if (params.dt) {\n result = new Literal(\n field.value.trim(),\n undefined,\n ns.xsd(params.dt)\n )\n } else {\n result = new Literal(field.value)\n }\n }\n let is = ds.map(statement => st(statement.subject, statement.predicate, result, statement.why)) // can include >1 doc\n if (is.length === 0) {\n // or none\n is = [st(subject, property as any, result, doc)]\n }\n\n function updateMany (ds, is: { why: { uri: string } }[], callback) {\n const docs: any[] = []\n is.forEach(st => {\n if (!docs.includes(st.why.uri)) docs.push(st.why.uri)\n })\n ds.forEach(st => {\n /* istanbul ignore next */\n if (!docs.includes(st.why.uri)) docs.push(st.why.uri)\n })\n /* istanbul ignore next */\n if (docs.length === 0) {\n throw new Error('updateMany has no docs to patch')\n }\n if (!kb.updater) {\n throw new Error('kb has no updater')\n }\n if (docs.length === 1) {\n return kb.updater.update(ds, is as any, callback)\n }\n // return kb.updater.update(ds, is, callback)\n\n const doc = docs.pop()\n const is1 = is.filter(st => st.why.uri === doc)\n const is2 = is.filter(st => st.why.uri !== doc)\n const ds1 = ds.filter(st => st.why.uri === doc)\n const ds2 = ds.filter(st => st.why.uri !== doc)\n kb.updater.update(ds1, is1 as any, function (uri, ok, body) {\n if (ok) {\n updateMany(ds2, is2, callback)\n } else {\n callback(uri, ok, body)\n }\n })\n }\n\n updateMany(ds, is as any, function (uri, ok, body) {\n // kb.updater.update(ds, is, function (uri, ok, body) {\n if (ok) {\n field.disabled = false\n field.setAttribute('style', style)\n } else {\n box.appendChild(errorMessageBlock(dom, body))\n }\n callbackFunction(ok, body)\n })\n },\n true\n )\n return box\n}\n"],"file":"basic.js"}
|
|
1
|
+
{"version":3,"file":"basic.js","names":["store","solidLogicSingleton","renderNameValuePair","dom","kb","box","form","label","style","display","flexDirection","lhs","appendChild","createElement","width","formFieldNameBoxWidth","rhs","setAttribute","formFieldNameBoxStyle","createTextNode","any","ns","ui","fieldLabel","errorMessageBlock","property","fieldInQuestion","lab","undefined","anchor","uri","textContent","fieldStore","subject","predicate","def","sts","statementsMatching","length","updater","Error","why","value","editable","sym","basicField","container","already","doc","callbackFunction","formDoc","suppressEmptyUneditable","anyJS","mostSpecificClassURI","params","fieldParams","paramStyle","textInputStyle","field","type","size","textInputSize","maxLength","obj","uriPrefix","decodeURIComponent","replace","readOnly","textInputStyleUneditable","addEventListener","_e","pattern","match","disabled","ds","result","namedNode","encodeURIComponent","dt","Literal","trim","xsd","is","map","statement","st","updateMany","callback","docs","forEach","includes","push","update","pop","is1","filter","is2","ds1","ds2","ok","body"],"sources":["../../../src/widgets/forms/basic.ts"],"sourcesContent":["import { BlankNode, Literal, NamedNode, Node, st, Store, Variable } from 'rdflib'\nimport { solidLogicSingleton } from 'solid-logic'\nimport * as ns from '../../ns'\nimport { formFieldNameBoxStyle, formFieldNameBoxWidth, textInputSize, textInputStyle, textInputStyleUneditable } from '../../style'\nimport { label } from '../../utils'\nimport { errorMessageBlock } from '../error'\nimport { mostSpecificClassURI } from './fieldFunction'\nimport { fieldParams } from './fieldParams'\n\nconst store = solidLogicSingleton.store\n\n/* Style and create a name, value pair\n*/\nexport function renderNameValuePair (dom: HTMLDocument, kb: Store, box: HTMLElement, form: NamedNode, label?: string):HTMLElement {\n // const property = kb.any(form, ns.ui('property'))\n box.style.display = 'flex'\n box.style.flexDirection = 'row'\n const lhs = box.appendChild(dom.createElement('div'))\n lhs.style.width = formFieldNameBoxWidth\n const rhs = box.appendChild(dom.createElement('div'))\n\n lhs.setAttribute('class', 'formFieldName')\n lhs.setAttribute('style', formFieldNameBoxStyle)\n rhs.setAttribute('class', 'formFieldValue')\n if (label) {\n lhs.appendChild(dom.createTextNode(label))\n } else if (kb.any(form, ns.ui('property'))) { // Assume more space for error on right\n lhs.appendChild(fieldLabel(dom, kb.any(form, ns.ui('property')) as NamedNode, form))\n } else {\n rhs.appendChild(errorMessageBlock(dom, 'No property or label given for form field: ' + form))\n lhs.appendChild(dom.createTextNode('???'))\n }\n return rhs\n}\n\n/**\n * Create an anchor element with a label as the anchor text.\n *\n * @param dom The DOM\n * @param property href for the anchor element\n * @param fieldInQuestion field to produce a label for\n *\n * @internal exporting this only for unit tests\n */\nexport function fieldLabel (dom: HTMLDocument, property: NamedNode | undefined, fieldInQuestion: Node): HTMLElement | Text {\n let lab = store.any(fieldInQuestion as any, ns.ui('label'))\n if (!lab) lab = label(property, true) // Init capital\n if (property === undefined) {\n return dom.createTextNode('@@Internal error: undefined property')\n }\n const anchor = dom.createElement('a')\n /* istanbul ignore next */\n if (property.uri) anchor.setAttribute('href', property.uri)\n anchor.setAttribute('style', 'color: #3B5998; text-decoration: none;') // Not too blue and no underline\n anchor.textContent = lab as any\n return anchor\n}\n\n/**\n * Returns the document for the first quad that matches\n * the subject and predicate provided, or default if that\n * store is not editable.\n *\n * @param subject Subject about which we want to find an editable RDF document\n * @param predicate Predicate about which we want to find an editable RDF document\n * @param def default RDF document to return if none found\n *\n * @internal exporting this only for unit tests\n */\nexport function fieldStore (subject: NamedNode | BlankNode | Variable, predicate: NamedNode | Variable, def: NamedNode | undefined): NamedNode | undefined {\n const sts = store.statementsMatching(subject, predicate)\n if (sts.length === 0) return def // can used default as no data yet\n if (!store.updater) {\n throw new Error('Store has no updater')\n }\n if (\n sts.length > 0 &&\n sts[0].why.value &&\n store.updater.editable(sts[0].why.value, store)\n ) {\n return store.sym(sts[0].why.value)\n }\n return def\n}\n\n/**\n * Render a basic form field\n *\n * The same function is used for many similar one-value fields, with different\n * regexps used to validate.\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?\n *\n * @returns The HTML widget created\n */\n// eslint-disable-next-line complexity\nexport function basicField (\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 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\n const property = kb.any(form, ns.ui('property'))\n if (container) container.appendChild(box)\n if (!property) {\n return box.appendChild(\n errorMessageBlock(dom, 'Error: No property given for text field: ' + form)\n )\n }\n const rhs = renderNameValuePair(dom, kb, box, form)\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\n const uri = mostSpecificClassURI(form)\n let params = fieldParams[uri]\n if (params === undefined) params = { style: '' } // non-bottom field types can do this\n const paramStyle = params.style || ''\n const style = textInputStyle + paramStyle\n const field = dom.createElement('input')\n ;(field as any).style = style\n rhs.appendChild(field)\n field.setAttribute('type', params.type ? params.type : 'text')\n\n const size = kb.anyJS(form, ns.ui('size')) || textInputSize || 20\n field.setAttribute('size', size)\n\n const maxLength = kb.any(form, ns.ui('maxLength'))\n field.setAttribute('maxLength', maxLength ? '' + maxLength : '4096')\n\n doc = doc || fieldStore(subject, property as any, doc)\n\n let obj = kb.any(subject, property as any, undefined, doc)\n if (!obj) {\n obj = kb.any(form, ns.ui('default'))\n }\n if (obj && obj.value && params.uriPrefix) {\n // eg tel: or mailto:\n field.value = decodeURIComponent(obj.value.replace(params.uriPrefix, '')) // should have no spaces but in case\n .replace(/ /g, '')\n } else if (obj) {\n /* istanbul ignore next */\n field.value = obj.value || obj.value || ''\n }\n field.setAttribute('style', style)\n if (!kb.updater) {\n throw new Error('kb has no updater')\n }\n if (!kb.updater.editable((doc as NamedNode).uri)) {\n field.readOnly = true // was: disabled. readOnly is better\n ;(field as any).style = textInputStyleUneditable + paramStyle\n // backgroundColor = textInputBackgroundColorUneditable\n if (suppressEmptyUneditable && field.value === '') {\n box.style.display = 'none' // clutter\n }\n return box\n }\n\n // read-write:\n field.addEventListener(\n 'keyup',\n function (_e) {\n if (params.pattern) {\n field.setAttribute(\n 'style',\n style +\n (field.value.match(params.pattern)\n ? 'color: green;'\n : 'color: red;')\n )\n }\n },\n true\n )\n field.addEventListener(\n 'change',\n function (_e) {\n // i.e. lose focus with changed data\n if (params.pattern && !field.value.match(params.pattern)) return\n field.disabled = true // See if this stops getting two dates from fumbling e.g the chrome datepicker.\n field.setAttribute('style', style + 'color: gray;') // pending\n const ds = kb.statementsMatching(subject, property as any) // remove any multiple values\n let result\n if (params.namedNode) {\n result = kb.sym(field.value)\n } else if (params.uriPrefix) {\n result = encodeURIComponent(field.value.replace(/ /g, ''))\n result = kb.sym(params.uriPrefix + field.value)\n } else {\n if (params.dt) {\n result = new Literal(\n field.value.trim(),\n undefined,\n ns.xsd(params.dt)\n )\n } else {\n result = new Literal(field.value)\n }\n }\n let is = ds.map(statement => st(statement.subject, statement.predicate, result, statement.why)) // can include >1 doc\n if (is.length === 0) {\n // or none\n is = [st(subject, property as any, result, doc)]\n }\n\n function updateMany (ds, is: { why: { uri: string } }[], callback) {\n const docs: any[] = []\n is.forEach(st => {\n if (!docs.includes(st.why.uri)) docs.push(st.why.uri)\n })\n ds.forEach(st => {\n /* istanbul ignore next */\n if (!docs.includes(st.why.uri)) docs.push(st.why.uri)\n })\n /* istanbul ignore next */\n if (docs.length === 0) {\n throw new Error('updateMany has no docs to patch')\n }\n if (!kb.updater) {\n throw new Error('kb has no updater')\n }\n if (docs.length === 1) {\n return kb.updater.update(ds, is as any, callback)\n }\n // return kb.updater.update(ds, is, callback)\n\n const doc = docs.pop()\n const is1 = is.filter(st => st.why.uri === doc)\n const is2 = is.filter(st => st.why.uri !== doc)\n const ds1 = ds.filter(st => st.why.uri === doc)\n const ds2 = ds.filter(st => st.why.uri !== doc)\n kb.updater.update(ds1, is1 as any, function (uri, ok, body) {\n if (ok) {\n updateMany(ds2, is2, callback)\n } else {\n callback(uri, ok, body)\n }\n })\n }\n\n updateMany(ds, is as any, function (uri, ok, body) {\n // kb.updater.update(ds, is, function (uri, ok, body) {\n if (ok) {\n field.disabled = false\n field.setAttribute('style', style)\n } else {\n box.appendChild(errorMessageBlock(dom, body))\n }\n callbackFunction(ok, body)\n })\n },\n true\n )\n return box\n}\n"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,KAAK,GAAGC,+BAAA,CAAoBD,KAAlC;AAEA;AACA;;AACO,SAASE,mBAAT,CAA8BC,GAA9B,EAAiDC,EAAjD,EAA4DC,GAA5D,EAA8EC,IAA9E,EAA+FC,KAA/F,EAA2H;EAChI;EACAF,GAAG,CAACG,KAAJ,CAAUC,OAAV,GAAoB,MAApB;EACAJ,GAAG,CAACG,KAAJ,CAAUE,aAAV,GAA0B,KAA1B;EACA,IAAMC,GAAG,GAAGN,GAAG,CAACO,WAAJ,CAAgBT,GAAG,CAACU,aAAJ,CAAkB,KAAlB,CAAhB,CAAZ;EACAF,GAAG,CAACH,KAAJ,CAAUM,KAAV,GAAkBC,4BAAlB;EACA,IAAMC,GAAG,GAAGX,GAAG,CAACO,WAAJ,CAAgBT,GAAG,CAACU,aAAJ,CAAkB,KAAlB,CAAhB,CAAZ;EAEAF,GAAG,CAACM,YAAJ,CAAiB,OAAjB,EAA0B,eAA1B;EACAN,GAAG,CAACM,YAAJ,CAAiB,OAAjB,EAA0BC,4BAA1B;EACAF,GAAG,CAACC,YAAJ,CAAiB,OAAjB,EAA0B,gBAA1B;;EACA,IAAIV,KAAJ,EAAW;IACTI,GAAG,CAACC,WAAJ,CAAgBT,GAAG,CAACgB,cAAJ,CAAmBZ,KAAnB,CAAhB;EACD,CAFD,MAEO,IAAIH,EAAE,CAACgB,GAAH,CAAOd,IAAP,EAAae,EAAE,CAACC,EAAH,CAAM,UAAN,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D,MAAX,CAAkBK,GAAlB,EAAuBH,GAAvB,EAAmC,UAAUhE,GAAV,EAAeqE,EAAf,EAAmBC,IAAnB,EAAyB;QAC1D,IAAID,EAAJ,EAAQ;UACNb,UAAU,CAACY,GAAD,EAAMF,GAAN,EAAWT,QAAX,CAAV;QACD,CAFD,MAEO;UACLA,QAAQ,CAACzD,GAAD,EAAMqE,EAAN,EAAUC,IAAV,CAAR;QACD;MACF,CAND;IAOD;;IAEDd,UAAU,CAACZ,EAAD,EAAKQ,EAAL,EAAgB,UAAUpD,GAAV,EAAeqE,EAAf,EAAmBC,IAAnB,EAAyB;MACjD;MACA,IAAID,EAAJ,EAAQ;QACNzC,KAAK,CAACe,QAAN,GAAiB,KAAjB;QACAf,KAAK,CAACzC,YAAN,CAAmB,OAAnB,EAA4BT,KAA5B;MACD,CAHD,MAGO;QACLH,GAAG,CAACO,WAAJ,CAAgB,IAAAY,wBAAA,EAAkBrB,GAAlB,EAAuBiG,IAAvB,CAAhB;MACD;;MACDnD,gBAAgB,CAACkD,EAAD,EAAKC,IAAL,CAAhB;IACD,CATS,CAAV;EAUD,CA5EH,EA6EE,IA7EF;EA+EA,OAAO/F,GAAP;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"comment.js","names":["store","solidLogicSingleton","commentField","dom","container","already","subject","form","_doc","_callbackFunction","kb","contents","any","ns","ui","uri","mostSpecificClassURI","params","fieldParams","undefined","box","createElement","appendChild","p","element","textContent","style","setAttribute"],"sources":["../../../src/widgets/forms/comment.ts"],"sourcesContent":["import { solidLogicSingleton } from 'solid-logic'\nimport * as ns from '../../ns'\nimport { mostSpecificClassURI } from './fieldFunction'\nimport { fieldParams } from './fieldParams'\n\nconst store = solidLogicSingleton.store\n\n/**\n * A [[FieldFunction]] for a simple comment box. It will look for\n * the first (form, ns.ui('contents'), ?) triple it can find in\n * store and use the value of the object of that triple as\n * the comment text.\n *\n * @param dom The DOM\n * @param container If set, the result will be appended to it as a child\n * @param already Unused\n * @param subject Unused\n * @param form RDF node with `ns.ui('contents')` attribute\n * @param _doc Unused\n * @param _callbackFunction Unused\n *\n * @returns a DOM element containing the comment.\n */\nexport function commentField (\n dom: HTMLDocument,\n container: HTMLElement | undefined,\n already: any,\n subject: any,\n form,\n _doc,\n _callbackFunction\n) {\n const kb = store\n let contents: any = kb.any(form, ns.ui('contents'))\n if (!contents) {\n contents = 'Error: No contents in comment field.'\n }\n const uri = mostSpecificClassURI(form)\n let params = fieldParams[uri]\n if (params === undefined) {\n params = {}\n } // non-bottom field types can do this\n\n const box = dom.createElement('div')\n if (container) container.appendChild(box)\n const p = box.appendChild(dom.createElement(params.element || 'p'))\n p.textContent = contents\n\n let style: any = kb.any(form, ns.ui('style'))\n if (style === undefined) {\n style = params.style ? params.style : ''\n }\n if (style) p.setAttribute('style', style as any)\n\n return box\n}\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,KAAK,GAAGC,+BAAA,CAAoBD,KAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASE,YAAT,CACLC,GADK,EAELC,SAFK,EAGLC,OAHK,EAILC,OAJK,EAKLC,IALK,EAMLC,IANK,EAOLC,iBAPK,EAQL;EACA,IAAMC,EAAE,GAAGV,KAAX;EACA,IAAIW,QAAa,GAAGD,EAAE,CAACE,GAAH,CAAOL,IAAP,EAAaM,EAAE,CAACC,EAAH,CAAM,UAAN,CAAb,CAApB;;EACA,IAAI,CAACH,QAAL,EAAe;IACbA,QAAQ,GAAG,sCAAX;EACD;;EACD,IAAMI,GAAG,GAAG,IAAAC,mCAAA,EAAqBT,IAArB,CAAZ;EACA,IAAIU,MAAM,GAAGC,wBAAA,CAAYH,GAAZ,CAAb;;EACA,IAAIE,MAAM,KAAKE,SAAf,EAA0B;IACxBF,MAAM,GAAG,EAAT;EACD,CAVD,CAUE;;;EAEF,IAAMG,GAAG,GAAGjB,GAAG,CAACkB,aAAJ,CAAkB,KAAlB,CAAZ;EACA,IAAIjB,SAAJ,EAAeA,SAAS,CAACkB,WAAV,CAAsBF,GAAtB;EACf,IAAMG,CAAC,GAAGH,GAAG,CAACE,WAAJ,CAAgBnB,GAAG,CAACkB,aAAJ,CAAkBJ,MAAM,CAACO,OAAP,IAAkB,GAApC,CAAhB,CAAV;EACAD,CAAC,CAACE,WAAF,GAAgBd,QAAhB;EAEA,IAAIe,KAAU,GAAGhB,EAAE,CAACE,GAAH,CAAOL,IAAP,EAAaM,EAAE,CAACC,EAAH,CAAM,OAAN,CAAb,CAAjB;;EACA,IAAIY,KAAK,KAAKP,SAAd,EAAyB;IACvBO,KAAK,GAAGT,MAAM,CAACS,KAAP,GAAeT,MAAM,CAACS,KAAtB,GAA8B,EAAtC;EACD;;EACD,IAAIA,KAAJ,EAAWH,CAAC,CAACI,YAAF,CAAe,OAAf,EAAwBD,KAAxB;EAEX,OAAON,GAAP;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fieldFunction.js","names":["store","solidLogicSingleton","field","mostSpecificClassURI","x","kb","ft","findTypeURIs","bot","bottomTypeURIs","bots","b","push","fieldFunction","dom","fieldInQuestion","uri","fun","debug","dom2","container","box","errorMessageBlock","appendChild"],"sources":["../../../src/widgets/forms/fieldFunction.ts"],"sourcesContent":["import { Node } from 'rdflib'\nimport { solidLogicSingleton } from 'solid-logic'\nimport { debug } from '../../log'\nimport { errorMessageBlock } from '../error'\n\nconst store = solidLogicSingleton.store\n\nexport type FieldFunction = (\n dom: HTMLDocument, // the DOM\n container: HTMLElement | undefined, // if defined, the box will be appended to it\n already: { }, // used to avoid looping in nested forms\n subject: Node, // the thing for which data will be loaded into the form element\n form: Node, // the RDF declaration for what the form should have\n doc: Node, // the online RDF document for data binding (form input values will be read/saved automatically)\n callbackFunction: (ok: boolean, errorMessage: string) => void // this will be called when data changes (TODO: check this with unit tests)\n) => HTMLElement\n\nexport const field: { [classUri: string]: FieldFunction } = {} // Form field functions by URI of field type.\n\n/**\n * Which class of field is this? Relies on http://www.w3.org/2000/01/rdf-schema#subClassOf and\n * https://linkeddata.github.io/rdflib.js/doc/classes/formula.html#bottomtypeuris\n * to find the most specific RDF type if there are multiple.\n *\n * @param x a form field, e.g. `namedNode('https://timbl.com/timbl/Public/Test/Forms/individualForm.ttl#fullNameField')`\n * @returns the URI of the most specific known class, e.g. `http://www.w3.org/ns/ui#SingleLineTextField`\n */\nexport function mostSpecificClassURI (x: Node): string {\n const kb = store\n const ft = kb.findTypeURIs(x as any)\n const bot = kb.bottomTypeURIs(ft) // most specific\n const bots: any[] = []\n for (const b in bot) bots.push(b)\n // if (bots.length > 1) throw \"Didn't expect \"+x+\" to have multiple bottom types: \"+bots\n return bots[0]\n}\n\n/**\n * Returns a function that creates a form widget\n * @param dom unused\n * @param fieldInQuestion the field for which to create a form, e.g. namedNode('https://timbl.com/timbl/Public/Test/Forms/individualForm.ttl#fullNameField')\n */\nexport function fieldFunction (dom: any /* unused */, fieldInQuestion: Node): FieldFunction {\n const uri = mostSpecificClassURI(fieldInQuestion) // What type\n // const uri = field.uri\n const fun = field[uri]\n debug(\n 'paneUtils: Going to implement field ' + fieldInQuestion + ' of type ' + uri\n )\n if (!fun) {\n return function (dom2: HTMLDocument, container?: HTMLElement): HTMLElement {\n const box = errorMessageBlock(\n dom2,\n 'No handler for field ' + fieldInQuestion + ' of type ' + uri\n )\n if (container) container.appendChild(box)\n\n return box\n }\n }\n return fun\n}\n"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AAEA,IAAMA,KAAK,GAAGC,+BAAA,CAAoBD,KAAlC;AAYO,IAAME,KAA4C,GAAG,EAArD,C,CAAwD;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,oBAAT,CAA+BC,CAA/B,EAAgD;EACrD,IAAMC,EAAE,GAAGL,KAAX;EACA,IAAMM,EAAE,GAAGD,EAAE,CAACE,YAAH,CAAgBH,CAAhB,CAAX;EACA,IAAMI,GAAG,GAAGH,EAAE,CAACI,cAAH,CAAkBH,EAAlB,CAAZ,CAHqD,CAGnB;;EAClC,IAAMI,IAAW,GAAG,EAApB;;EACA,KAAK,IAAMC,CAAX,IAAgBH,GAAhB;IAAqBE,IAAI,CAACE,IAAL,CAAUD,CAAV;EAArB,CALqD,CAMrD;;;EACA,OAAOD,IAAI,CAAC,CAAD,CAAX;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASG,aAAT,CAAwBC,GAAxB,EAA+CC,eAA/C,EAAqF;EAC1F,IAAMC,GAAG,GAAGb,oBAAoB,CAACY,eAAD,CAAhC,CAD0F,CACxC;EAClD;;EACA,IAAME,GAAG,GAAGf,KAAK,CAACc,GAAD,CAAjB;EACA,IAAAE,UAAA,EACE,yCAAyCH,eAAzC,GAA2D,WAA3D,GAAyEC,GAD3E;;EAGA,IAAI,CAACC,GAAL,EAAU;IACR,OAAO,UAAUE,IAAV,EAA8BC,SAA9B,EAAoE;MACzE,IAAMC,GAAG,GAAG,IAAAC,wBAAA,EACVH,IADU,EAEV,0BAA0BJ,eAA1B,GAA4C,WAA5C,GAA0DC,GAFhD,CAAZ;MAIA,IAAII,SAAJ,EAAeA,SAAS,CAACG,WAAV,CAAsBF,GAAtB;MAEf,OAAOA,GAAP;IACD,CARD;EASD;;EACD,OAAOJ,GAAP;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"fieldParams.js","names":["fieldParams","ns","ui","uri","size","type","style","dt","pattern","namedNode","uriPrefix","formGroupStyle","element","commentStyle","formHeadingStyle"],"sources":["../../../src/widgets/forms/fieldParams.ts"],"sourcesContent":["import * as ns from '../../ns'\nimport { commentStyle, formHeadingStyle, formGroupStyle } from '../../style'\n\nexport type FieldParamsObject = {\n size?: number, // input element size attribute\n type?: string, // input element type attribute. Default: 'text' (not for Comment and Heading)\n element?: string, // element type to use (Comment and Heading only)\n style?: string, // style to use\n dt?: string, // xsd data type for the RDF Literal corresponding to the field value. Default: xsd:string\n uriPrefix?: string, // e.g. 'mailto:', will be removed when displaying value to user. Overrides dt.\n namedNode?: boolean, // if true, field value corresponds to the URI of an RDF NamedNode. Overrides dt and uriPrefix.\n pattern?: RegExp // for client-side input validation; field will go red if violated, green if ok\n}\n\n/**\n * The fieldParams object defines various constants\n * for use in various form fields. Depending on the\n * field in questions, different values may be read\n * from here.\n */\nexport const fieldParams: { [ fieldUri: string ]: FieldParamsObject } = {\n /**\n * Text field\n *\n * For possible date popups see e.g. http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm\n * or use HTML5: http://www.w3.org/TR/2011/WD-html-markup-20110113/input.date.html\n */\n [ns.ui('ColorField').uri]: {\n size: 9,\n type: 'color',\n style: 'height: 3em;', // around 1.5em is padding\n dt: 'color',\n pattern: /^\\s*#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]([0-9a-f][0-9a-f])?\\s*$/\n }, // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color\n\n [ns.ui('DateField').uri]: {\n size: 20,\n type: 'date',\n dt: 'date',\n pattern: /^\\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?Z?\\s*$/\n },\n\n [ns.ui('DateTimeField').uri]: {\n size: 20,\n type: 'datetime-local', // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime\n dt: 'dateTime',\n pattern: /^\\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?(T[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)?Z?\\s*$/\n },\n\n [ns.ui('TimeField').uri]: {\n size: 10,\n type: 'time',\n dt: 'time',\n pattern: /^\\s*([0-2]?[0-9]:[0-5][0-9](:[0-5][0-9])?)\\s*$/\n },\n\n [ns.ui('IntegerField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'integer',\n pattern: /^\\s*-?[0-9]+\\s*$/\n },\n\n [ns.ui('DecimalField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'decimal',\n pattern: /^\\s*-?[0-9]*(\\.[0-9]*)?\\s*$/\n },\n\n [ns.ui('FloatField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'float',\n pattern: /^\\s*-?[0-9]*(\\.[0-9]*)?((e|E)-?[0-9]*)?\\s*$/\n },\n\n [ns.ui('SingleLineTextField').uri]: {\n\n },\n [ns.ui('NamedNodeURIField').uri]: {\n namedNode: true\n },\n [ns.ui('TextField').uri]: {\n\n },\n\n [ns.ui('PhoneField').uri]: {\n size: 20,\n uriPrefix: 'tel:',\n pattern: /^\\+?[\\d-]+[\\d]*$/\n },\n\n [ns.ui('EmailField').uri]: {\n size: 30,\n uriPrefix: 'mailto:',\n pattern: /^\\s*.*@.*\\..*\\s*$/ // @@ Get the right regexp here\n },\n\n [ns.ui('Group').uri]: {\n style: formGroupStyle\n },\n\n /**\n * Non-interactive fields\n */\n [ns.ui('Comment').uri]: {\n element: 'p',\n style: commentStyle // was `padding: 0.1em 1.5em; color: ${formHeadingColor}; white-space: pre-wrap;`\n },\n [ns.ui('Heading').uri]: {\n element: 'h3',\n style: formHeadingStyle // was: `font-size: 110%; font-weight: bold; color: ${formHeadingColor}; padding: 0.2em;`\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;;;;;;;AAaA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,WAAwD,sEAOlEC,EAAE,CAACC,EAAH,CAAM,YAAN,EAAoBC,GAP8C,EAOxC;EACzBC,IAAI,EAAE,CADmB;EAEzBC,IAAI,EAAE,OAFmB;EAGzBC,KAAK,EAAE,cAHkB;EAGF;EACvBC,EAAE,EAAE,OAJqB;EAKzBC,OAAO,EAAE;AALgB,CAPwC,kDAelEP,EAAE,CAACC,EAAH,CAAM,WAAN,EAAmBC,GAf+C,EAezC;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C,EAAH,CAAM,WAAN,EAAmBC,GA/D+C,EA+DzC,EA/DyC,kDAmElEF,EAAE,CAACC,EAAH,CAAM,YAAN,EAAoBC,GAnE8C,EAmExC;EACzBC,IAAI,EAAE,EADmB;EAEzBM,SAAS,EAAE,MAFc;EAGzBF,OAAO,EAAE;AAHgB,CAnEwC,kDAyElEP,EAAE,CAACC,EAAH,CAAM,YAAN,EAAoBC,GAzE8C,EAyExC;EACzBC,IAAI,EAAE,EADmB;EAEzBM,SAAS,EAAE,SAFc;EAGzBF,OAAO,EAAE,mBAHgB,CAGI;;AAHJ,CAzEwC,kDA+ElEP,EAAE,CAACC,EAAH,CAAM,OAAN,EAAeC,GA/EmD,EA+E7C;EACpBG,KAAK,EAAEK;AADa,CA/E6C,kDAsFlEV,EAAE,CAACC,EAAH,CAAM,SAAN,EAAiBC,GAtFiD,EAsF3C;EACtBS,OAAO,EAAE,GADa;EAEtBN,KAAK,EAAEO,mBAFe,CAEF;;AAFE,CAtF2C,kDA0FlEZ,EAAE,CAACC,EAAH,CAAM,SAAN,EAAiBC,GA1FiD,EA0F3C;EACtBS,OAAO,EAAE,IADa;EAEtBN,KAAK,EAAEQ,uBAFe,CAEE;;AAFF,CA1F2C,gBAA9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"formStyle.js","names":["STYLE_URI_PREFIX","setFieldStyle","ele","field","classUri","mostSpecificClassURI","params","fieldParams","style","store","any","ns","ui","setAttribute","termType","value","sts","statementsMatching","doc","forEach","st","predicate","uri","startsWith","cssAttribute","slice","length","object","err","console","warn","tagName"],"sources":["../../../src/widgets/forms/formStyle.ts"],"sourcesContent":["import * as ns from '../../ns'\nimport { Node } from 'rdflib'\nimport { store } from 'solid-logic'\nimport { fieldParams } from './fieldParams'\n\nimport { mostSpecificClassURI } from './fieldFunction'\n\nconst STYLE_URI_PREFIX = 'https://www.w3.org/ns/css#'\n\n/* eslint-disable no-console */\n\nexport function setFieldStyle (ele:HTMLElement, field:Node) {\n const classUri = mostSpecificClassURI(field)\n const params = fieldParams[classUri] || {}\n\n const style = store.any(field as any, ns.ui('style'))\n if (!style) {\n if (params.style) {\n ele.setAttribute('style', params.style)\n }\n return\n }\n if (style.termType === 'Literal') {\n if (style) ele.setAttribute('style', style.value)\n } else {\n const sts = store.statementsMatching(style as any, null, null, (field as any).doc())\n sts.forEach(st => {\n if (st.predicate.uri && st.predicate.uri.startsWith(STYLE_URI_PREFIX)) {\n const cssAttribute = st.predicate.uri.slice(STYLE_URI_PREFIX.length)\n try {\n ele.style[cssAttribute] = st.object.value\n } catch (err) {\n console.warn(`setFieldStyle: Error setting element style ${cssAttribute} to \"${st.object.value}\"`)\n console.warn(`setFieldStyle: ... Element tagName was \"${ele.tagName || '???'}\"`)\n }\n }\n })\n }\n}\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;;;;;AAEA,IAAMA,gBAAgB,GAAG,4BAAzB;AAEA;;AAEO,SAASC,aAAT,CAAwBC,GAAxB,EAAyCC,KAAzC,EAAqD;EAC1D,IAAMC,QAAQ,GAAG,IAAAC,mCAAA,EAAqBF,KAArB,CAAjB;EACA,IAAMG,MAAM,GAAGC,wBAAA,CAAYH,QAAZ,KAAyB,EAAxC;;EAEA,IAAMI,KAAK,GAAGC,iBAAA,CAAMC,GAAN,CAAUP,KAAV,EAAwBQ,EAAE,CAACC,EAAH,CAAM,OAAN,CAAxB,CAAd;;EACA,IAAI,CAACJ,KAAL,EAAY;IACV,IAAIF,MAAM,CAACE,KAAX,EAAkB;MAChBN,GAAG,CAACW,YAAJ,CAAiB,OAAjB,EAA0BP,MAAM,CAACE,KAAjC;IACD;;IACD;EACD;;EACD,IAAIA,KAAK,CAACM,QAAN,KAAmB,SAAvB,EAAkC;IAChC,IAAIN,KAAJ,EAAWN,GAAG,CAACW,YAAJ,CAAiB,OAAjB,EAA0BL,KAAK,CAACO,KAAhC;EACZ,CAFD,MAEO;IACL,IAAMC,GAAG,GAAGP,iBAAA,CAAMQ,kBAAN,CAAyBT,KAAzB,EAAuC,IAAvC,EAA6C,IAA7C,EAAoDL,KAAD,CAAee,GAAf,EAAnD,CAAZ;;IACAF,GAAG,CAACG,OAAJ,CAAY,UAAAC,EAAE,EAAI;MAChB,IAAIA,EAAE,CAACC,SAAH,CAAaC,GAAb,IAAoBF,EAAE,CAACC,SAAH,CAAaC,GAAb,CAAiBC,UAAjB,CAA4BvB,gBAA5B,CAAxB,EAAuE;QACrE,IAAMwB,YAAY,GAAGJ,EAAE,CAACC,SAAH,CAAaC,GAAb,CAAiBG,KAAjB,CAAuBzB,gBAAgB,CAAC0B,MAAxC,CAArB;;QACA,IAAI;UACFxB,GAAG,CAACM,KAAJ,CAAUgB,YAAV,IAA0BJ,EAAE,CAACO,MAAH,CAAUZ,KAApC;QACD,CAFD,CAEE,OAAOa,GAAP,EAAY;UACZC,OAAO,CAACC,IAAR,sDAA2DN,YAA3D,mBAA+EJ,EAAE,CAACO,MAAH,CAAUZ,KAAzF;UACAc,OAAO,CAACC,IAAR,sDAA0D5B,GAAG,CAAC6B,OAAJ,IAAe,KAAzE;QACD;MACF;IACF,CAVD;EAWD;AACF"}
|
package/lib/widgets/forms.js
CHANGED
|
@@ -22,6 +22,12 @@ Object.defineProperty(exports, "field", {
|
|
|
22
22
|
return _fieldFunction.field;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "fieldFunction", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _fieldFunction.fieldFunction;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
25
31
|
Object.defineProperty(exports, "fieldLabel", {
|
|
26
32
|
enumerable: true,
|
|
27
33
|
get: function get() {
|
|
@@ -47,6 +53,12 @@ exports.makeSelectForCategory = makeSelectForCategory;
|
|
|
47
53
|
exports.makeSelectForChoice = makeSelectForChoice;
|
|
48
54
|
exports.makeSelectForNestedCategory = makeSelectForNestedCategory;
|
|
49
55
|
exports.makeSelectForOptions = makeSelectForOptions;
|
|
56
|
+
Object.defineProperty(exports, "mostSpecificClassURI", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function get() {
|
|
59
|
+
return _fieldFunction.mostSpecificClassURI;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
50
62
|
exports.newButton = newButton;
|
|
51
63
|
exports.newThing = newThing;
|
|
52
64
|
exports.promptForNew = promptForNew;
|
|
@@ -94,6 +106,8 @@ var _solidLogic = require("solid-logic");
|
|
|
94
106
|
|
|
95
107
|
var utils = _interopRequireWildcard(require("../utils"));
|
|
96
108
|
|
|
109
|
+
var _multiSelect = require("./multiSelect");
|
|
110
|
+
|
|
97
111
|
var widgets = _interopRequireWildcard(require("../widgets"));
|
|
98
112
|
|
|
99
113
|
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); }
|
|
@@ -1040,7 +1054,6 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1040
1054
|
var kb = _solidLogic.store;
|
|
1041
1055
|
var formDoc = form.doc ? form.doc() : null; // @@ if blank no way to know
|
|
1042
1056
|
|
|
1043
|
-
var multiSelect = false;
|
|
1044
1057
|
var p;
|
|
1045
1058
|
var box = dom.createElement('div');
|
|
1046
1059
|
box.setAttribute('class', 'choiceBox'); // Set flexDirection column?
|
|
@@ -1066,13 +1079,11 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1066
1079
|
}
|
|
1067
1080
|
|
|
1068
1081
|
var subForm = kb.any(form, ui('use')); // Optional
|
|
1069
|
-
|
|
1070
|
-
var follow = kb.anyJS(form, ui('follow'), null, formDoc); // data doc moves to new subject?
|
|
1082
|
+
// const follow = kb.anyJS(form, ui('follow'), null, formDoc) // data doc moves to new subject?
|
|
1071
1083
|
|
|
1072
1084
|
var opts = {
|
|
1073
1085
|
form: form,
|
|
1074
1086
|
subForm: subForm,
|
|
1075
|
-
multiSelect: multiSelect,
|
|
1076
1087
|
disambiguate: false
|
|
1077
1088
|
};
|
|
1078
1089
|
|
|
@@ -1121,9 +1132,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1121
1132
|
opts.disambiguate = true;
|
|
1122
1133
|
}
|
|
1123
1134
|
|
|
1124
|
-
|
|
1125
|
-
if (object) possible.push(object);
|
|
1126
|
-
return sortByLabel(possible);
|
|
1135
|
+
return possible; // return sortByLabel(possible)
|
|
1127
1136
|
} // TODO: this checks for any occurrence, regardless of true or false setting
|
|
1128
1137
|
|
|
1129
1138
|
|
|
@@ -1131,31 +1140,56 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
1131
1140
|
opts.mint = '* Create new *'; // @@ could be better
|
|
1132
1141
|
}
|
|
1133
1142
|
|
|
1143
|
+
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
1144
|
+
|
|
1134
1145
|
var selector;
|
|
1135
1146
|
|
|
1136
1147
|
rhs.refresh = function () {
|
|
1137
|
-
|
|
1138
|
-
|
|
1148
|
+
// from ui:property
|
|
1149
|
+
var selectedOptions = kb.each(subject, property, null, dataDoc).map(function (object) {
|
|
1150
|
+
return object.value;
|
|
1151
|
+
}); // from ui:from + ui:property
|
|
1152
|
+
|
|
1153
|
+
var possibleOptions = getSelectorOptions();
|
|
1154
|
+
possibleOptions.push(selectedOptions);
|
|
1155
|
+
possibleOptions = sortByLabel(possibleOptions);
|
|
1156
|
+
selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
|
|
1139
1157
|
rhs.innerHTML = '';
|
|
1140
1158
|
rhs.appendChild(selector);
|
|
1159
|
+
|
|
1160
|
+
if (multiSelect) {
|
|
1161
|
+
var multiSelectDiv = new _multiSelect.IconicMultiSelect({
|
|
1162
|
+
placeholder: selector.selected,
|
|
1163
|
+
select: selector,
|
|
1164
|
+
container: rhs,
|
|
1165
|
+
textField: 'textField',
|
|
1166
|
+
valueField: 'valueField'
|
|
1167
|
+
});
|
|
1168
|
+
multiSelectDiv.init();
|
|
1169
|
+
multiSelectDiv.subscribe(function (event) {
|
|
1170
|
+
if (event.action === 'REMOVE_OPTION') {
|
|
1171
|
+
selectedOptions = selectedOptions.filter(function (value) {
|
|
1172
|
+
return value !== event.value;
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
if (event.action === 'CLEAR_ALL_OPTIONS') {
|
|
1177
|
+
selectedOptions = [];
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
if (event.action === 'ADD_OPTION') {
|
|
1181
|
+
selectedOptions.push(event.value);
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
selector.update(selectedOptions);
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1141
1187
|
};
|
|
1142
1188
|
|
|
1143
1189
|
rhs.refresh();
|
|
1144
1190
|
if (selector && selector.refresh) selector.refresh();
|
|
1145
1191
|
return box;
|
|
1146
1192
|
};
|
|
1147
|
-
/**
|
|
1148
|
-
* Removes all sibling elements after specified
|
|
1149
|
-
* @param {HTMLElement} currentElement
|
|
1150
|
-
* @private
|
|
1151
|
-
*/
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
function removeNextSiblingsAfterElement(currentElement) {
|
|
1155
|
-
while (currentElement.nextElementSibling) {
|
|
1156
|
-
currentElement.nextElementSibling.remove();
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
1193
|
|
|
1160
1194
|
function addSubFormChoice(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction) {
|
|
1161
1195
|
(0, _fieldFunction.fieldFunction)(dom, subForm)(dom, selectDiv, already, subject, subForm, dataDoc, callbackFunction);
|
|
@@ -1878,8 +1912,6 @@ function newThing(doc) {
|
|
|
1878
1912
|
// @param subject - a term, the subject of the statement(s) being edited.
|
|
1879
1913
|
// @param predicate - a term, the predicate of the statement(s) being edited
|
|
1880
1914
|
// @param possible - a list of terms, the possible value the object can take
|
|
1881
|
-
// @param options.multiSelect - Boolean - Whether more than one at a time is allowed
|
|
1882
|
-
// @param options.uiMultipleInUse - signals that the ui:choise is used with a ui:multiple
|
|
1883
1915
|
// @param options.mint - User may create thing if this sent to the prompt string eg "New foo"
|
|
1884
1916
|
// @param options.subForm - If mint, then the form to be used for minting the new thing
|
|
1885
1917
|
// @param dataDoc - The web document being edited
|
|
@@ -1887,31 +1919,29 @@ function newThing(doc) {
|
|
|
1887
1919
|
*/
|
|
1888
1920
|
|
|
1889
1921
|
|
|
1890
|
-
function makeSelectForChoice(dom, container, kb, subject, predicate,
|
|
1891
|
-
var
|
|
1892
|
-
var uris = {}; // Count them
|
|
1922
|
+
function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossibleOptions, selectedOptions, uiFrom, options, dataDoc, callbackFunction) {
|
|
1923
|
+
var optionsFromClassUIfrom = {}; // Count them
|
|
1893
1924
|
|
|
1894
1925
|
var editable = kb.updater.editable(dataDoc.uri);
|
|
1895
1926
|
|
|
1896
|
-
for (var i = 0; i <
|
|
1897
|
-
var sub =
|
|
1927
|
+
for (var i = 0; i < inputPossibleOptions.length; i++) {
|
|
1928
|
+
var sub = inputPossibleOptions[i]; // @@ Maybe; make this so it works with blank nodes too
|
|
1929
|
+
// if (!sub.uri) debug.warn(`makeSelectForChoice: option does not have an uri: ${sub}, with predicate: ${predicate}`)
|
|
1898
1930
|
|
|
1899
|
-
if (!sub.uri
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
n++;
|
|
1903
|
-
} // uris is now the set of possible options
|
|
1931
|
+
if (!sub.uri || sub.uri in optionsFromClassUIfrom) continue;
|
|
1932
|
+
optionsFromClassUIfrom[sub.uri] = true;
|
|
1933
|
+
}
|
|
1904
1934
|
|
|
1935
|
+
var isEmpty = Object.keys(optionsFromClassUIfrom).length === 0;
|
|
1905
1936
|
|
|
1906
|
-
if (
|
|
1937
|
+
if (isEmpty && !options.mint) {
|
|
1907
1938
|
return (0, _error.errorMessageBlock)(dom, "Can't do selector with no options, subject= " + subject + ' property = ' + predicate + '.');
|
|
1908
1939
|
}
|
|
1909
1940
|
|
|
1910
|
-
log.debug('
|
|
1941
|
+
log.debug('makeSelectForChoice: dataDoc=' + dataDoc);
|
|
1911
1942
|
|
|
1912
|
-
function
|
|
1913
|
-
var firstSelectOptionText = '---
|
|
1914
|
-
var option = dom.createElement('option');
|
|
1943
|
+
function createDefaultSelectOptionText() {
|
|
1944
|
+
var firstSelectOptionText = '--- choice ---';
|
|
1915
1945
|
|
|
1916
1946
|
if (predicate && !(predicate.termType === 'BlankNode')) {
|
|
1917
1947
|
firstSelectOptionText = '* Select for property: ' + utils.label(predicate) + ' *';
|
|
@@ -1921,7 +1951,12 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
1921
1951
|
firstSelectOptionText = '* Select for ' + utils.label(subject, true) + ' *';
|
|
1922
1952
|
}
|
|
1923
1953
|
|
|
1924
|
-
|
|
1954
|
+
return firstSelectOptionText;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
function createDefaultSelectOption() {
|
|
1958
|
+
var option = dom.createElement('option');
|
|
1959
|
+
option.appendChild(dom.createTextNode(createDefaultSelectOptionText()));
|
|
1925
1960
|
option.disabled = true;
|
|
1926
1961
|
option.value = true;
|
|
1927
1962
|
option.hidden = true;
|
|
@@ -1930,15 +1965,16 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
1930
1965
|
}
|
|
1931
1966
|
|
|
1932
1967
|
var onChange = function onChange(_e) {
|
|
1968
|
+
container.removeChild(container.lastChild);
|
|
1933
1969
|
select.refresh();
|
|
1934
1970
|
};
|
|
1935
1971
|
|
|
1936
1972
|
var select = dom.createElement('select');
|
|
1937
1973
|
select.setAttribute('style', style.formSelectSTyle);
|
|
1938
|
-
|
|
1974
|
+
select.setAttribute('id', 'formSelect');
|
|
1939
1975
|
select.currentURI = null;
|
|
1940
1976
|
|
|
1941
|
-
for (var uri in
|
|
1977
|
+
for (var uri in optionsFromClassUIfrom) {
|
|
1942
1978
|
select.appendChild(createOption(uri));
|
|
1943
1979
|
}
|
|
1944
1980
|
|
|
@@ -1950,11 +1986,10 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
1950
1986
|
select.insertBefore(mint, select.firstChild);
|
|
1951
1987
|
}
|
|
1952
1988
|
|
|
1953
|
-
if (select.children.length === 0) select.insertBefore(
|
|
1954
|
-
|
|
1955
|
-
select.refresh = function () {
|
|
1956
|
-
select.disabled = true; // unlocked any conflict we had got into
|
|
1989
|
+
if (select.children.length === 0) select.insertBefore(createDefaultSelectOption(), select.firstChild);
|
|
1957
1990
|
|
|
1991
|
+
select.update = function (newSelectedOptions) {
|
|
1992
|
+
selectedOptions = newSelectedOptions;
|
|
1958
1993
|
var ds = [];
|
|
1959
1994
|
var is = [];
|
|
1960
1995
|
|
|
@@ -1964,6 +1999,62 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
1964
1999
|
}
|
|
1965
2000
|
};
|
|
1966
2001
|
|
|
2002
|
+
var addValue = function addValue(t) {
|
|
2003
|
+
if (!kb.holds(subject, predicate, t, dataDoc)) {
|
|
2004
|
+
is.push($rdf.st(subject, predicate, t, dataDoc)); // console.log("----value added " + t)
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
if (uiFrom && !kb.holds(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)) {
|
|
2008
|
+
is.push($rdf.st(t, ns.rdf('type'), kb.sym(uiFrom), dataDoc)); // console.log("----added type to value " + uiFrom)
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
2011
|
+
|
|
2012
|
+
var existingValues = kb.each(subject, predicate, null, dataDoc).map(function (object) {
|
|
2013
|
+
return object.value;
|
|
2014
|
+
});
|
|
2015
|
+
|
|
2016
|
+
var _iterator2 = _createForOfIteratorHelper(existingValues),
|
|
2017
|
+
_step2;
|
|
2018
|
+
|
|
2019
|
+
try {
|
|
2020
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2021
|
+
var value = _step2.value;
|
|
2022
|
+
if (!containsObject(value, selectedOptions)) removeValue($rdf.sym(value));
|
|
2023
|
+
}
|
|
2024
|
+
} catch (err) {
|
|
2025
|
+
_iterator2.e(err);
|
|
2026
|
+
} finally {
|
|
2027
|
+
_iterator2.f();
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
var _iterator3 = _createForOfIteratorHelper(selectedOptions),
|
|
2031
|
+
_step3;
|
|
2032
|
+
|
|
2033
|
+
try {
|
|
2034
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2035
|
+
var _value = _step3.value;
|
|
2036
|
+
if (!(_value in existingValues)) addValue($rdf.sym(_value));
|
|
2037
|
+
}
|
|
2038
|
+
} catch (err) {
|
|
2039
|
+
_iterator3.e(err);
|
|
2040
|
+
} finally {
|
|
2041
|
+
_iterator3.f();
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
2045
|
+
if (!ok) return select.parentNode.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in select: ' + body));
|
|
2046
|
+
select.refresh();
|
|
2047
|
+
if (callbackFunction) callbackFunction(ok, {
|
|
2048
|
+
widget: 'select',
|
|
2049
|
+
event: 'change'
|
|
2050
|
+
});
|
|
2051
|
+
});
|
|
2052
|
+
};
|
|
2053
|
+
|
|
2054
|
+
select.refresh = function () {
|
|
2055
|
+
select.disabled = true; // unlocked any conflict we had got into
|
|
2056
|
+
|
|
2057
|
+
var is = [];
|
|
1967
2058
|
var newObject;
|
|
1968
2059
|
|
|
1969
2060
|
for (var _i3 = 0; _i3 < select.options.length; _i3++) {
|
|
@@ -1997,36 +2088,26 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
1997
2088
|
|
|
1998
2089
|
if (!opt.AJAR_uri) continue; // a prompt or mint
|
|
1999
2090
|
|
|
2000
|
-
if (opt.selected
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
var sel = select.subSelect; // All subclasses must also go
|
|
2004
|
-
|
|
2005
|
-
while (sel && sel.currentURI) {
|
|
2006
|
-
removeValue(kb.sym(sel.currentURI));
|
|
2007
|
-
sel = sel.subSelect;
|
|
2008
|
-
}
|
|
2009
|
-
|
|
2010
|
-
sel = select.superSelect; // All superclasses are redundant
|
|
2091
|
+
if (opt.selected && containsObject(opt.AJAR_uri, selectedOptions)) {
|
|
2092
|
+
select.currentURI = opt.AJAR_uri;
|
|
2093
|
+
}
|
|
2011
2094
|
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
sel = sel.superSelect;
|
|
2095
|
+
if (!containsObject(opt.AJAR_uri, selectedOptions)) opt.removeAttribute('selected');
|
|
2096
|
+
if (containsObject(opt.AJAR_uri, selectedOptions)) opt.setAttribute('selected', 'true');
|
|
2015
2097
|
}
|
|
2016
2098
|
|
|
2017
2099
|
log.info('selectForOptions: data doc = ' + dataDoc);
|
|
2018
2100
|
|
|
2019
|
-
if (select.currentURI) {
|
|
2020
|
-
removeNextSiblingsAfterElement(select);
|
|
2101
|
+
if (select.currentURI && options.subForm) {
|
|
2021
2102
|
addSubFormChoice(dom, container, {}, $rdf.sym(select.currentURI), options.subForm, dataDoc, function (ok, body) {
|
|
2022
2103
|
if (ok) {
|
|
2023
|
-
kb.updater.update(
|
|
2104
|
+
kb.updater.update([], is, function (uri, success, errorBody) {
|
|
2024
2105
|
if (!success) container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating select: ' + errorBody));
|
|
2025
2106
|
});
|
|
2026
2107
|
if (callbackFunction) callbackFunction(ok, {
|
|
2027
2108
|
widget: 'select',
|
|
2028
2109
|
event: 'new'
|
|
2029
|
-
});
|
|
2110
|
+
});
|
|
2030
2111
|
} else {
|
|
2031
2112
|
container.appendChild((0, _error.errorMessageBlock)(dom, 'Error updating data in field of select: ' + body));
|
|
2032
2113
|
}
|
|
@@ -2039,13 +2120,17 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
2039
2120
|
function createOption(uri) {
|
|
2040
2121
|
var option = dom.createElement('option');
|
|
2041
2122
|
var c = kb.sym(uri);
|
|
2123
|
+
var label;
|
|
2042
2124
|
|
|
2043
2125
|
if (options.disambiguate) {
|
|
2044
|
-
|
|
2126
|
+
label = utils.labelWithOntology(c, true); // Init. cap
|
|
2045
2127
|
} else {
|
|
2046
|
-
|
|
2128
|
+
label = utils.label(c, true);
|
|
2047
2129
|
}
|
|
2048
2130
|
|
|
2131
|
+
option.appendChild(dom.createTextNode(label)); // Init.
|
|
2132
|
+
|
|
2133
|
+
option.setAttribute('value', uri);
|
|
2049
2134
|
var backgroundColor = kb.any(c, kb.sym('http://www.w3.org/ns/ui#backgroundColor'));
|
|
2050
2135
|
|
|
2051
2136
|
if (backgroundColor) {
|
|
@@ -2053,7 +2138,11 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
2053
2138
|
}
|
|
2054
2139
|
|
|
2055
2140
|
option.AJAR_uri = uri;
|
|
2056
|
-
|
|
2141
|
+
|
|
2142
|
+
if (containsObject(c.value, selectedOptions)) {
|
|
2143
|
+
option.setAttribute('selected', 'true');
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2057
2146
|
return option;
|
|
2058
2147
|
}
|
|
2059
2148
|
|
|
@@ -2063,4 +2152,17 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, possible, u
|
|
|
2063
2152
|
|
|
2064
2153
|
return select;
|
|
2065
2154
|
} // makeSelectForChoice
|
|
2155
|
+
|
|
2156
|
+
|
|
2157
|
+
function containsObject(obj, list) {
|
|
2158
|
+
var i;
|
|
2159
|
+
|
|
2160
|
+
for (i = 0; i < list.length; i++) {
|
|
2161
|
+
if (list[i] === obj) {
|
|
2162
|
+
return true;
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
return false;
|
|
2167
|
+
}
|
|
2066
2168
|
//# sourceMappingURL=forms.js.map
|