@startinblox/core 0.17.20 → 0.17.21-beta.4
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/components/solid-ac-checker.js +3 -10
- package/dist/components/solid-ac-checker.js.map +1 -1
- package/dist/components/solid-display.js +1 -1
- package/dist/components/solid-display.js.map +1 -1
- package/dist/libs/store/store.js +67 -9
- package/dist/libs/store/store.js.map +1 -1
- package/dist/mixins/widgetMixin.js +2 -2
- package/dist/mixins/widgetMixin.js.map +1 -1
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js +4 -3
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +1 -1
- package/dist/new-widgets/templates/displayTemplatesDirectory.js +4 -3
- package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +1 -1
- package/dist/new-widgets/templates/formTemplatesDirectory.js +3 -3
- package/dist/new-widgets/templates/formTemplatesDirectory.js.map +1 -1
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js +14 -0
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js.map +1 -0
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +18 -0
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +1 -1
- package/package.json +2 -2
|
@@ -21,25 +21,18 @@ export const SolidAcChecker = {
|
|
|
21
21
|
const ContextParser = JSONLDContextParser.ContextParser;
|
|
22
22
|
const myParser = new ContextParser();
|
|
23
23
|
const context = await myParser.parse(this.context);
|
|
24
|
+
const permissions = await this.resource.permissions;
|
|
24
25
|
|
|
25
26
|
if (this.permission) {
|
|
26
27
|
// User has permission of ...
|
|
27
|
-
displayElement =
|
|
28
|
+
displayElement = permissions.some(p => {
|
|
28
29
|
return ContextParser.compactIri(p, context) === this.permission;
|
|
29
30
|
});
|
|
30
|
-
/* displayElement = await asyncSome(
|
|
31
|
-
(permission: object) => ContextParser.compactIri(permission.toString(), context) === this.permission,
|
|
32
|
-
this.resource.permissions.mode['@type']
|
|
33
|
-
)*/
|
|
34
31
|
} else if (this.noPermission) {
|
|
35
32
|
// User has no permission of ...
|
|
36
|
-
displayElement =
|
|
33
|
+
displayElement = permissions.every(p => {
|
|
37
34
|
return ContextParser.compactIri(p, context) !== this.noPermission;
|
|
38
35
|
});
|
|
39
|
-
/*displayElement = await asyncEvery(
|
|
40
|
-
(permission: object) => ContextParser.compactIri(permission.toString(), context) !== this.noPermission,
|
|
41
|
-
this.resource.permissions.mode['@type']
|
|
42
|
-
)*/
|
|
43
36
|
} else {
|
|
44
37
|
// No parameter provided
|
|
45
38
|
console.warn('solid-ac-checker: you should define at least one of "permission" or "no-permission" attribute.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["solid-ac-checker.ts"],"names":["JSONLDContextParser","Sib","StoreMixin","SolidAcChecker","name","use","attributes","permission","type","String","default","noPermission","populate","resource","displayElement","ContextParser","myParser","context","parse","permissions","some","p","compactIri","every","console","warn","element","removeAttribute","empty","setAttribute","register"],"mappings":"AAAA,OAAOA,mBAAP,MAAgC,uBAAhC;AACA,SAASC,GAAT,QAAoB,aAApB;AACA,SAASC,UAAT,QAA2B,sBAA3B;AAEA,OAAO,MAAMC,cAAc,GAAG;AAC5BC,EAAAA,IAAI,EAAE,kBADsB;AAE5BC,EAAAA,GAAG,EAAE,CAACH,UAAD,CAFuB;AAG5BI,EAAAA,UAAU,EAAE;AACVC,IAAAA,UAAU,EAAE;AACVC,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE;AAFC,KADF;AAKVC,IAAAA,YAAY,EAAE;AACZH,MAAAA,IAAI,EAAEC,MADM;AAEZC,MAAAA,OAAO,EAAE;AAFG;AALJ,GAHgB;;AAc5B,QAAME,QAAN,GAAgC;AAC9B,QAAI,CAAC,KAAKC,QAAV,EAAoB;AACpB,QAAIC,cAAJ;AACA,UAAMC,aAAa,GAAGf,mBAAmB,CAACe,aAA1C;AACA,UAAMC,QAAQ,GAAG,IAAID,aAAJ,EAAjB;AACA,UAAME,OAAO,GAAG,MAAMD,QAAQ,CAACE,KAAT,CAAe,KAAKD,OAApB,CAAtB;;AAEA,QAAI,
|
|
1
|
+
{"version":3,"sources":["solid-ac-checker.ts"],"names":["JSONLDContextParser","Sib","StoreMixin","SolidAcChecker","name","use","attributes","permission","type","String","default","noPermission","populate","resource","displayElement","ContextParser","myParser","context","parse","permissions","some","p","compactIri","every","console","warn","element","removeAttribute","empty","setAttribute","register"],"mappings":"AAAA,OAAOA,mBAAP,MAAgC,uBAAhC;AACA,SAASC,GAAT,QAAoB,aAApB;AACA,SAASC,UAAT,QAA2B,sBAA3B;AAEA,OAAO,MAAMC,cAAc,GAAG;AAC5BC,EAAAA,IAAI,EAAE,kBADsB;AAE5BC,EAAAA,GAAG,EAAE,CAACH,UAAD,CAFuB;AAG5BI,EAAAA,UAAU,EAAE;AACVC,IAAAA,UAAU,EAAE;AACVC,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE;AAFC,KADF;AAKVC,IAAAA,YAAY,EAAE;AACZH,MAAAA,IAAI,EAAEC,MADM;AAEZC,MAAAA,OAAO,EAAE;AAFG;AALJ,GAHgB;;AAc5B,QAAME,QAAN,GAAgC;AAC9B,QAAI,CAAC,KAAKC,QAAV,EAAoB;AACpB,QAAIC,cAAJ;AACA,UAAMC,aAAa,GAAGf,mBAAmB,CAACe,aAA1C;AACA,UAAMC,QAAQ,GAAG,IAAID,aAAJ,EAAjB;AACA,UAAME,OAAO,GAAG,MAAMD,QAAQ,CAACE,KAAT,CAAe,KAAKD,OAApB,CAAtB;AACA,UAAME,WAAW,GAAG,MAAM,KAAKN,QAAL,CAAcM,WAAxC;;AAEA,QAAI,KAAKZ,UAAT,EAAqB;AAAE;AACrBO,MAAAA,cAAc,GAAGK,WAAW,CAACC,IAAZ,CAAkBC,CAAD,IAAW;AAC3C,eAAON,aAAa,CAACO,UAAd,CAAyBD,CAAzB,EAA4BJ,OAA5B,MAAyC,KAAKV,UAArD;AACD,OAFgB,CAAjB;AAGD,KAJD,MAIO,IAAI,KAAKI,YAAT,EAAuB;AAAE;AAC9BG,MAAAA,cAAc,GAAGK,WAAW,CAACI,KAAZ,CAAmBF,CAAD,IAAW;AAC5C,eAAON,aAAa,CAACO,UAAd,CAAyBD,CAAzB,EAA4BJ,OAA5B,MAAyC,KAAKN,YAArD;AACD,OAFgB,CAAjB;AAGD,KAJM,MAIA;AAAE;AACPa,MAAAA,OAAO,CAACC,IAAR,CAAa,gGAAb;AACA;AACD;;AAED,QAAIX,cAAJ,EAAoB,KAAKY,OAAL,CAAaC,eAAb,CAA6B,QAA7B;AACrB,GApC2B;;AAqC5BC,EAAAA,KAAK,GAAS;AACZ,SAAKF,OAAL,CAAaG,YAAb,CAA0B,QAA1B,EAAoC,EAApC;AACD;;AAvC2B,CAAvB;AA0CP5B,GAAG,CAAC6B,QAAJ,CAAa3B,cAAb","sourcesContent":["import JSONLDContextParser from 'jsonld-context-parser';\nimport { Sib } from '../libs/Sib';\nimport { StoreMixin } from '../mixins/storeMixin';\n\nexport const SolidAcChecker = {\n name: 'solid-ac-checker',\n use: [StoreMixin],\n attributes: {\n permission: {\n type: String,\n default: '',\n },\n noPermission: {\n type: String,\n default: '',\n }\n },\n\n async populate(): Promise<void> {\n if (!this.resource) return;\n let displayElement: boolean;\n const ContextParser = JSONLDContextParser.ContextParser;\n const myParser = new ContextParser();\n const context = await myParser.parse(this.context);\n const permissions = await this.resource.permissions;\n\n if (this.permission) { // User has permission of ...\n displayElement = permissions.some((p:any) => {\n return ContextParser.compactIri(p, context) === this.permission;\n });\n } else if (this.noPermission) { // User has no permission of ...\n displayElement = permissions.every((p:any) => {\n return ContextParser.compactIri(p, context) !== this.noPermission;\n });\n } else { // No parameter provided\n console.warn('solid-ac-checker: you should define at least one of \"permission\" or \"no-permission\" attribute.');\n return;\n }\n\n if (displayElement) this.element.removeAttribute('hidden');\n },\n empty(): void {\n this.element.setAttribute('hidden', '');\n }\n};\n\nSib.register(SolidAcChecker);"]}
|
|
@@ -177,7 +177,7 @@ export const SolidDisplay = {
|
|
|
177
177
|
|
|
178
178
|
for (let attr of this.element.attributes) {
|
|
179
179
|
//copy widget and value attributes
|
|
180
|
-
if (attr.name.startsWith('value-') || attr.name.startsWith('label-') || attr.name.startsWith('placeholder-') || attr.name.startsWith('widget-') || attr.name.startsWith('class-') || attr.name.startsWith('multiple-') || attr.name.startsWith('editable-') || attr.name.startsWith('action-') || attr.name.startsWith('default-') || attr.name == 'extra-context') attributes[attr.name] = attr.value;
|
|
180
|
+
if (attr.name.startsWith('value-') || attr.name.startsWith('label-') || attr.name.startsWith('placeholder-') || attr.name.startsWith('widget-') || attr.name.startsWith('class-') || attr.name.startsWith('multiple-') || attr.name.startsWith('editable-') || attr.name.startsWith('action-') || attr.name.startsWith('default-') || attr.name.startsWith('link-text-') || attr.name == 'extra-context') attributes[attr.name] = attr.value;
|
|
181
181
|
if (attr.name.startsWith('child-')) attributes[attr.name.replace(/^child-/, '')] = attr.value;
|
|
182
182
|
|
|
183
183
|
if (attr.name == 'next') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["solid-display.ts"],"names":["Sib","WidgetMixin","ListMixin","StoreMixin","PaginateMixin","FilterMixin","CounterMixin","SorterMixin","GrouperMixin","FederationMixin","HighlighterMixin","NextMixin","RequiredMixin","spread","html","render","ifDefined","SolidDisplay","name","use","attributes","defaultWidget","type","String","default","initialState","activeSubscription","removeActiveSubscription","created","route","document","querySelector","setTimeout","resourceId","addActiveCallback","detached","PubSub","unsubscribe","updateNavigateSubscription","subscribe","bind","element","setAttribute","removeActiveCallback","removeAttribute","childTag","dataset","child","tagName","defaultMultipleWidget","defaultSetWidget","dispatchSelect","event","linkTarget","target","closest","hasAttribute","resource","dispatchEvent","CustomEvent","detail","goToNext","enterKeydownAction","keyCode","getChildTemplate","template","fields","appendSingleElt","parent","getFields","widgetTemplates","Promise","all","map","field","createWidgetTemplate","renderDOM","resources","listPostProcessors","div","context","getChildAttributes","r","nextProcessor","shift","attr","startsWith","value","replace","register"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAT,QAAoB,aAApB;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,SAASC,UAAT,QAA2B,sBAA3B;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,eAAT,QAAgC,2BAAhC;AACA,SAASC,gBAAT,QAAiC,4BAAjC;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA,SAASC,IAAT,EAAeC,MAAf,QAA6B,UAA7B;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,OAAO,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,IAAI,EAAE,eADoB;AAE1BC,EAAAA,GAAG,EAAE,CACHlB,WADG,EAEHC,SAFG,EAGHC,UAHG,EAIHC,aAJG,EAKHI,YALG,EAMHF,YANG,EAOHI,gBAPG,EAQHL,WARG,EASHE,WATG,EAUHK,aAVG,EAWHH,eAXG,EAYHE,SAZG,CAFqB;AAgB1BS,EAAAA,UAAU,EAAE;AACVC,IAAAA,aAAa,EAAE;AACbC,MAAAA,IAAI,EAAEC,MADO;AAEbC,MAAAA,OAAO,EAAE;AAFI;AADL,GAhBc;AAsB1BC,EAAAA,YAAY,EAAE;AACZC,IAAAA,kBAAkB,EAAE,IADR;AAEZC,IAAAA,wBAAwB,EAAE;AAFd,GAtBY;;AA0B1BC,EAAAA,OAAO,GAAS;AACd;AACA,UAAMC,KAAK,GAAGC,QAAQ,CAACC,aAAT,CAAuB,qBAAvB,CAAd;AACA,QAAI,CAACF,KAAL,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IAGAD,IAAI,CAACnE,IAAL,CAAUoE,UAAV,CAAqB,SAArB,CAHA,IAIAD,IAAI,CAACnE,IAAL,CAAUoE,UAAV,CAAqB,QAArB,CAJA,IAKAD,IAAI,CAACnE,IAAL,CAAUoE,UAAV,CAAqB,WAArB,CALA,IAMAD,IAAI,CAACnE,IAAL,CAAUoE,UAAV,CAAqB,WAArB,CANA,IAOAD,IAAI,CAACnE,IAAL,CAAUoE,UAAV,CAAqB,SAArB,CAPA,IAQAD,IAAI,CAACnE,IAAL,CAAUoE,UAAV,CAAqB,UAArB,CARA,IASAD,IAAI,CAACnE,IAAL,IAAa,eAVf,EAYEE,UAAU,CAACiE,IAAI,CAACnE,IAAN,CAAV,GAAwBmE,IAAI,CAACE,KAA7B;AACF,UAAIF,IAAI,CAACnE,IAAL,CAAUoE,UAAV,CAAqB,QAArB,CAAJ,EACElE,UAAU,CAACiE,IAAI,CAACnE,IAAL,CAAUsE,OAAV,CAAkB,SAAlB,EAA6B,EAA7B,CAAD,CAAV,GAA+CH,IAAI,CAACE,KAApD;;AACF,UAAIF,IAAI,CAACnE,IAAL,IAAa,MAAjB,EAAyB;AACvBE,QAAAA,UAAU,CAAC,MAAD,CAAV,GAAqB,QAArB;AACAA,QAAAA,UAAU,CAAC,UAAD,CAAV,GAAyB,GAAzB;AACD;AACF;;AACD,WAAOA,UAAP;AACD;;AA9KyB,CAArB;AAiLPpB,GAAG,CAACyF,QAAJ,CAAaxE,YAAb","sourcesContent":["import { Sib } from '../libs/Sib';\nimport { WidgetMixin } from '../mixins/widgetMixin';\nimport { ListMixin } from '../mixins/listMixin';\nimport { StoreMixin } from '../mixins/storeMixin';\nimport { PaginateMixin } from '../mixins/paginateMixin';\nimport { FilterMixin } from '../mixins/filterMixin';\nimport { CounterMixin } from '../mixins/counterMixin';\nimport { SorterMixin } from '../mixins/sorterMixin';\nimport { GrouperMixin } from '../mixins/grouperMixin';\nimport { FederationMixin } from '../mixins/federationMixin';\nimport { HighlighterMixin } from '../mixins/highlighterMixin';\nimport { NextMixin } from '../mixins/nextMixin';\nimport { RequiredMixin } from '../mixins/requiredMixin';\nimport { spread } from '../libs/lit-helpers';\n\nimport { html, render } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const SolidDisplay = {\n name: 'solid-display',\n use: [\n WidgetMixin,\n ListMixin,\n StoreMixin,\n PaginateMixin,\n GrouperMixin,\n CounterMixin,\n HighlighterMixin,\n FilterMixin,\n SorterMixin,\n RequiredMixin,\n FederationMixin,\n NextMixin,\n ],\n attributes: {\n defaultWidget: {\n type: String,\n default: 'solid-display-value',\n },\n },\n initialState: {\n activeSubscription: null,\n removeActiveSubscription: null,\n },\n created(): void {\n // Set route active at initialization\n const route = document.querySelector('solid-route[active]') as any;\n if (!route) return;\n setTimeout(() => {\n if (route['resourceId'] === this.resourceId) this.addActiveCallback();\n });\n },\n detached(): void {\n if (this.activeSubscription) PubSub.unsubscribe(this.activeSubscription);\n if (this.removeActiveSubscription) PubSub.unsubscribe(this.removeActiveSubscription);\n },\n // Update subscription when id changes\n updateNavigateSubscription() {\n if (this.activeSubscription) PubSub.unsubscribe(this.activeSubscription);\n\n if (this.resourceId) {\n this.activeSubscription = PubSub.subscribe(\n 'enterRoute.' + this.resourceId,\n this.addActiveCallback.bind(this)\n );\n }\n },\n addActiveCallback() {\n this.element.setAttribute('active', '');\n this.removeActiveSubscription = PubSub.subscribe(\n 'leaveRoute',\n this.removeActiveCallback.bind(this)\n );\n },\n removeActiveCallback() {\n this.element.removeAttribute('active');\n PubSub.unsubscribe(this.removeActiveSubscription);\n },\n get childTag(): string {\n return this.element.dataset.child || this.element.tagName;\n },\n get defaultMultipleWidget(): string {\n return 'solid-multiple';\n },\n get defaultSetWidget(): string {\n return 'solid-set-default';\n },\n // Here \"even.target\" points to the content of the widgets of the children of solid-display\n dispatchSelect(event: Event, resourceId: string): void {\n const linkTarget = (event!.target as Element).closest('a');\n if (linkTarget && linkTarget.hasAttribute('href')) return;\n const resource = { \"@id\": resourceId };\n this.element.dispatchEvent(\n new CustomEvent('resourceSelect', { detail: { resource: resource } }),\n );\n this.goToNext(resource);\n },\n \n enterKeydownAction (event, resourceId: string): void {\n if (event.keyCode === 13) {\n const resource = { \"@id\" : resourceId };\n this.goToNext(resource);\n }\n },\n /**\n * Returns template of a child element (resource)\n * @param resourceId\n * @param attributes\n */\n getChildTemplate(resourceId: string, attributes: object) {\n let template = html`\n <solid-display\n data-src=${resourceId}\n @click=${(event: Event) => this.dispatchSelect(event, resourceId)}\n @keydown=${(event: Event) => this.enterKeydownAction(event, resourceId)}\n fields=${ifDefined(this.fields)}\n ...=${spread(attributes)}\n ></solid-display>\n `\n return template;\n },\n\n /**\n * Creates and render the content of a single element (resource)\n * @param parent\n */\n async appendSingleElt(parent: HTMLElement): Promise<void> {\n const fields = await this.getFields();\n const widgetTemplates = await Promise.all( // generate all widget templates\n fields.map((field: string) => this.createWidgetTemplate(field))\n );\n render(html`${widgetTemplates}`, parent);\n },\n\n /**\n * @override listMixin method to use litHtml\n *\n * Render resources from a container\n * @param resources\n * @param listPostProcessors\n * @param div\n * @param context\n */\n async renderDOM(\n resources: object[],\n listPostProcessors: Function[],\n div: HTMLElement,\n context: string,\n ) {\n const attributes = this.getChildAttributes(); // get attributes of children only once\n // and create a child template for each resource\n const template = html`${resources.map(r => r ? this.getChildTemplate(r['@id'], attributes) : null)}`;\n render(template, div);\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor)\n await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n },\n\n /**\n * Get attributes to dispatch to children from current element\n */\n getChildAttributes() {\n const attributes:{[key:string]: string} = {};\n for (let attr of this.element.attributes) {\n //copy widget and value attributes\n if (\n attr.name.startsWith('value-') ||\n attr.name.startsWith('label-') ||\n attr.name.startsWith('placeholder-') ||\n attr.name.startsWith('widget-') ||\n attr.name.startsWith('class-') ||\n attr.name.startsWith('multiple-') ||\n attr.name.startsWith('editable-') ||\n attr.name.startsWith('action-') ||\n attr.name.startsWith('default-') ||\n attr.name == 'extra-context'\n )\n attributes[attr.name] = attr.value;\n if (attr.name.startsWith('child-'))\n attributes[attr.name.replace(/^child-/, '')] = attr.value;\n if (attr.name == 'next') {\n attributes['role'] = 'button';\n attributes['tabindex'] = '0';\n }\n }\n return attributes;\n }\n};\n\nSib.register(SolidDisplay);\n"]}
|
|
1
|
+
{"version":3,"sources":["solid-display.ts"],"names":["Sib","WidgetMixin","ListMixin","StoreMixin","PaginateMixin","FilterMixin","CounterMixin","SorterMixin","GrouperMixin","FederationMixin","HighlighterMixin","NextMixin","RequiredMixin","spread","html","render","ifDefined","SolidDisplay","name","use","attributes","defaultWidget","type","String","default","initialState","activeSubscription","removeActiveSubscription","created","route","document","querySelector","setTimeout","resourceId","addActiveCallback","detached","PubSub","unsubscribe","updateNavigateSubscription","subscribe","bind","element","setAttribute","removeActiveCallback","removeAttribute","childTag","dataset","child","tagName","defaultMultipleWidget","defaultSetWidget","dispatchSelect","event","linkTarget","target","closest","hasAttribute","resource","dispatchEvent","CustomEvent","detail","goToNext","enterKeydownAction","keyCode","getChildTemplate","template","fields","appendSingleElt","parent","getFields","widgetTemplates","Promise","all","map","field","createWidgetTemplate","renderDOM","resources","listPostProcessors","div","context","getChildAttributes","r","nextProcessor","shift","attr","startsWith","value","replace","register"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAT,QAAoB,aAApB;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,SAASC,UAAT,QAA2B,sBAA3B;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,eAAT,QAAgC,2BAAhC;AACA,SAASC,gBAAT,QAAiC,4BAAjC;AACA,SAASC,S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E,UAAU,CAACiE,IAAI,CAACnE,IAAN,CAAV,GAAwBmE,IAAI,CAACE,KAA7B;AACF,UAAIF,IAAI,CAACnE,IAAL,CAAUoE,UAAV,CAAqB,QAArB,CAAJ,EACElE,UAAU,CAACiE,IAAI,CAACnE,IAAL,CAAUsE,OAAV,CAAkB,SAAlB,EAA6B,EAA7B,CAAD,CAAV,GAA+CH,IAAI,CAACE,KAApD;;AACF,UAAIF,IAAI,CAACnE,IAAL,IAAa,MAAjB,EAAyB;AACvBE,QAAAA,UAAU,CAAC,MAAD,CAAV,GAAqB,QAArB;AACAA,QAAAA,UAAU,CAAC,UAAD,CAAV,GAAyB,GAAzB;AACD;AACF;;AACD,WAAOA,UAAP;AACD;;AA/KyB,CAArB;AAkLPpB,GAAG,CAACyF,QAAJ,CAAaxE,YAAb","sourcesContent":["import { Sib } from '../libs/Sib';\nimport { WidgetMixin } from '../mixins/widgetMixin';\nimport { ListMixin } from '../mixins/listMixin';\nimport { StoreMixin } from '../mixins/storeMixin';\nimport { PaginateMixin } from '../mixins/paginateMixin';\nimport { FilterMixin } from '../mixins/filterMixin';\nimport { CounterMixin } from '../mixins/counterMixin';\nimport { SorterMixin } from '../mixins/sorterMixin';\nimport { GrouperMixin } from '../mixins/grouperMixin';\nimport { FederationMixin } from '../mixins/federationMixin';\nimport { HighlighterMixin } from '../mixins/highlighterMixin';\nimport { NextMixin } from '../mixins/nextMixin';\nimport { RequiredMixin } from '../mixins/requiredMixin';\nimport { spread } from '../libs/lit-helpers';\n\nimport { html, render } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const SolidDisplay = {\n name: 'solid-display',\n use: [\n WidgetMixin,\n ListMixin,\n StoreMixin,\n PaginateMixin,\n GrouperMixin,\n CounterMixin,\n HighlighterMixin,\n FilterMixin,\n SorterMixin,\n RequiredMixin,\n FederationMixin,\n NextMixin,\n ],\n attributes: {\n defaultWidget: {\n type: String,\n default: 'solid-display-value',\n },\n },\n initialState: {\n activeSubscription: null,\n removeActiveSubscription: null,\n },\n created(): void {\n // Set route active at initialization\n const route = document.querySelector('solid-route[active]') as any;\n if (!route) return;\n setTimeout(() => {\n if (route['resourceId'] === this.resourceId) this.addActiveCallback();\n });\n },\n detached(): void {\n if (this.activeSubscription) PubSub.unsubscribe(this.activeSubscription);\n if (this.removeActiveSubscription) PubSub.unsubscribe(this.removeActiveSubscription);\n },\n // Update subscription when id changes\n updateNavigateSubscription() {\n if (this.activeSubscription) PubSub.unsubscribe(this.activeSubscription);\n\n if (this.resourceId) {\n this.activeSubscription = PubSub.subscribe(\n 'enterRoute.' + this.resourceId,\n this.addActiveCallback.bind(this)\n );\n }\n },\n addActiveCallback() {\n this.element.setAttribute('active', '');\n this.removeActiveSubscription = PubSub.subscribe(\n 'leaveRoute',\n this.removeActiveCallback.bind(this)\n );\n },\n removeActiveCallback() {\n this.element.removeAttribute('active');\n PubSub.unsubscribe(this.removeActiveSubscription);\n },\n get childTag(): string {\n return this.element.dataset.child || this.element.tagName;\n },\n get defaultMultipleWidget(): string {\n return 'solid-multiple';\n },\n get defaultSetWidget(): string {\n return 'solid-set-default';\n },\n // Here \"even.target\" points to the content of the widgets of the children of solid-display\n dispatchSelect(event: Event, resourceId: string): void {\n const linkTarget = (event!.target as Element).closest('a');\n if (linkTarget && linkTarget.hasAttribute('href')) return;\n const resource = { \"@id\": resourceId };\n this.element.dispatchEvent(\n new CustomEvent('resourceSelect', { detail: { resource: resource } }),\n );\n this.goToNext(resource);\n },\n \n enterKeydownAction (event, resourceId: string): void {\n if (event.keyCode === 13) {\n const resource = { \"@id\" : resourceId };\n this.goToNext(resource);\n }\n },\n /**\n * Returns template of a child element (resource)\n * @param resourceId\n * @param attributes\n */\n getChildTemplate(resourceId: string, attributes: object) {\n let template = html`\n <solid-display\n data-src=${resourceId}\n @click=${(event: Event) => this.dispatchSelect(event, resourceId)}\n @keydown=${(event: Event) => this.enterKeydownAction(event, resourceId)}\n fields=${ifDefined(this.fields)}\n ...=${spread(attributes)}\n ></solid-display>\n `\n return template;\n },\n\n /**\n * Creates and render the content of a single element (resource)\n * @param parent\n */\n async appendSingleElt(parent: HTMLElement): Promise<void> {\n const fields = await this.getFields();\n const widgetTemplates = await Promise.all( // generate all widget templates\n fields.map((field: string) => this.createWidgetTemplate(field))\n );\n render(html`${widgetTemplates}`, parent);\n },\n\n /**\n * @override listMixin method to use litHtml\n *\n * Render resources from a container\n * @param resources\n * @param listPostProcessors\n * @param div\n * @param context\n */\n async renderDOM(\n resources: object[],\n listPostProcessors: Function[],\n div: HTMLElement,\n context: string,\n ) {\n const attributes = this.getChildAttributes(); // get attributes of children only once\n // and create a child template for each resource\n const template = html`${resources.map(r => r ? this.getChildTemplate(r['@id'], attributes) : null)}`;\n render(template, div);\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor)\n await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n },\n\n /**\n * Get attributes to dispatch to children from current element\n */\n getChildAttributes() {\n const attributes:{[key:string]: string} = {};\n for (let attr of this.element.attributes) {\n //copy widget and value attributes\n if (\n attr.name.startsWith('value-') ||\n attr.name.startsWith('label-') ||\n attr.name.startsWith('placeholder-') ||\n attr.name.startsWith('widget-') ||\n attr.name.startsWith('class-') ||\n attr.name.startsWith('multiple-') ||\n attr.name.startsWith('editable-') ||\n attr.name.startsWith('action-') ||\n attr.name.startsWith('default-') ||\n attr.name.startsWith('link-text-') ||\n attr.name == 'extra-context'\n )\n attributes[attr.name] = attr.value;\n if (attr.name.startsWith('child-'))\n attributes[attr.name.replace(/^child-/, '')] = attr.value;\n if (attr.name == 'next') {\n attributes['role'] = 'button';\n attributes['tabindex'] = '0';\n }\n }\n return attributes;\n }\n};\n\nSib.register(SolidDisplay);\n"]}
|
package/dist/libs/store/store.js
CHANGED
|
@@ -69,6 +69,8 @@ class Store {
|
|
|
69
69
|
* @param id - uri of the resource to fetch
|
|
70
70
|
* @param context - context used to expand id and predicates when accessing the resource
|
|
71
71
|
* @param idParent - uri of the parent caller used to expand uri for local files
|
|
72
|
+
* @param localData - data to put in cache
|
|
73
|
+
* @param forceFetch - force the fetch of data
|
|
72
74
|
*
|
|
73
75
|
* @returns The fetched resource
|
|
74
76
|
*
|
|
@@ -76,10 +78,10 @@ class Store {
|
|
|
76
78
|
*/
|
|
77
79
|
|
|
78
80
|
|
|
79
|
-
async getData(id, context = {}, idParent = "", localData) {
|
|
81
|
+
async getData(id, context = {}, idParent = "", localData, forceFetch = false) {
|
|
80
82
|
if (localData == null && this.cache.has(id) && !this.loadingList.has(id)) {
|
|
81
83
|
const resource = this.get(id);
|
|
82
|
-
if (resource && resource.isFullResource()) return resource; // if resource is not complete, re-fetch it
|
|
84
|
+
if (resource && resource.isFullResource() && !forceFetch) return resource; // if resource is not complete, re-fetch it
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
return new Promise(async resolve => {
|
|
@@ -130,7 +132,14 @@ class Store {
|
|
|
130
132
|
} else {
|
|
131
133
|
// anonymous
|
|
132
134
|
if (options.headers) options.headers = this._convertHeaders(options.headers);
|
|
133
|
-
return fetch(iri, options)
|
|
135
|
+
return fetch(iri, options).then(function (response) {
|
|
136
|
+
if (options.method === "PURGE" && !response.ok && response.status === 404) {
|
|
137
|
+
const err = new Error("PURGE call is returning 404");
|
|
138
|
+
throw err;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return response;
|
|
142
|
+
});
|
|
134
143
|
}
|
|
135
144
|
}
|
|
136
145
|
|
|
@@ -236,11 +245,15 @@ class Store {
|
|
|
236
245
|
|
|
237
246
|
const expandedId = this._getExpandedId(id, context);
|
|
238
247
|
|
|
239
|
-
return this._fetch(method, resource, id).then(response => {
|
|
248
|
+
return this._fetch(method, resource, id).then(async response => {
|
|
240
249
|
if (response.ok) {
|
|
241
250
|
var _response$headers;
|
|
242
251
|
|
|
243
|
-
if (method !== '_LOCAL')
|
|
252
|
+
if (method !== '_LOCAL') {
|
|
253
|
+
await this.purge(id);
|
|
254
|
+
this.clearCache(expandedId);
|
|
255
|
+
} // clear cache
|
|
256
|
+
|
|
244
257
|
|
|
245
258
|
this.getData(expandedId, resource['@context']).then(async () => {
|
|
246
259
|
// re-fetch data
|
|
@@ -396,6 +409,41 @@ class Store {
|
|
|
396
409
|
async patch(resource, id) {
|
|
397
410
|
return this._updateResource('PATCH', resource, id);
|
|
398
411
|
}
|
|
412
|
+
/**
|
|
413
|
+
* Send a PURGE request to remove a resource from REDIS AD cache
|
|
414
|
+
* @param id - uri of the resource to patch
|
|
415
|
+
*
|
|
416
|
+
* @returns id of the edited resource
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
async purge(id) {
|
|
421
|
+
console.log('Purging resource ' + id);
|
|
422
|
+
await this.fetchAuthn(id, {
|
|
423
|
+
method: "PURGE",
|
|
424
|
+
headers: this.headers
|
|
425
|
+
}).catch(function (error) {
|
|
426
|
+
console.warn('No purge method allowed: ' + error);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
try {
|
|
430
|
+
const fullURL = new URL(id);
|
|
431
|
+
var pathArray = fullURL.pathname.split('/');
|
|
432
|
+
var containerUrl = fullURL.origin + '/' + pathArray[1];
|
|
433
|
+
const headers = { ...this.headers,
|
|
434
|
+
'X-Cache-Purge-Match': 'wildcard'
|
|
435
|
+
};
|
|
436
|
+
await this.fetchAuthn(containerUrl + '/*', {
|
|
437
|
+
method: "PURGE",
|
|
438
|
+
headers: headers
|
|
439
|
+
}).catch(function (error) {
|
|
440
|
+
console.warn('No purge method allowed: ' + error);
|
|
441
|
+
});
|
|
442
|
+
} catch (error) {
|
|
443
|
+
console.warn('The resource ID is not a complete URL: ' + error);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
399
447
|
/**
|
|
400
448
|
* Send a DELETE request to delete a resource
|
|
401
449
|
* @param id - uri of the resource to delete
|
|
@@ -413,6 +461,7 @@ class Store {
|
|
|
413
461
|
headers: this.headers,
|
|
414
462
|
credentials: 'include'
|
|
415
463
|
});
|
|
464
|
+
await this.purge(id);
|
|
416
465
|
const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];
|
|
417
466
|
const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];
|
|
418
467
|
this.refreshResources([...resourcesToNotify, ...resourcesToRefresh]).then(resourceIds => this.notifyResources(resourceIds));
|
|
@@ -634,11 +683,12 @@ class CustomGetter {
|
|
|
634
683
|
* @param id
|
|
635
684
|
* @param context
|
|
636
685
|
* @param iriParent
|
|
686
|
+
* @param forceFetch
|
|
637
687
|
*/
|
|
638
688
|
|
|
639
689
|
|
|
640
|
-
async getResource(id, context, iriParent) {
|
|
641
|
-
return store.getData(id, context, iriParent);
|
|
690
|
+
async getResource(id, context, iriParent, forceFetch = false) {
|
|
691
|
+
return store.getData(id, context, iriParent, undefined, forceFetch);
|
|
642
692
|
}
|
|
643
693
|
/**
|
|
644
694
|
* Return true if the resource is a container
|
|
@@ -721,8 +771,16 @@ class CustomGetter {
|
|
|
721
771
|
return Object.keys(this.resource).filter(p => !p.startsWith('@')).length > 0;
|
|
722
772
|
}
|
|
723
773
|
|
|
724
|
-
getPermissions() {
|
|
725
|
-
const
|
|
774
|
+
async getPermissions() {
|
|
775
|
+
const permissionPredicate = this.getExpandedPredicate("permissions");
|
|
776
|
+
let permissions = this.resource[permissionPredicate];
|
|
777
|
+
|
|
778
|
+
if (!permissions) {
|
|
779
|
+
// if no permission, re-fetch data
|
|
780
|
+
await this.getResource(this.resourceId, this.clientContext, this.parentId, true);
|
|
781
|
+
permissions = this.resource[permissionPredicate];
|
|
782
|
+
}
|
|
783
|
+
|
|
726
784
|
return permissions ? permissions.map(perm => ContextParser.expandTerm(perm.mode['@type'], this.serverContext, true)) : [];
|
|
727
785
|
}
|
|
728
786
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["store.ts"],"names":["JSONLDContextParser","PubSub","ContextParser","myParser","base_context","rdf","rdfs","ldp","foaf","name","acl","permissions","mode","geo","lat","lng","Store","constructor","storeOptions","id","resolve","handler","event","detail","resource","document","removeEventListener","cache","Map","subscriptionIndex","subscriptionVirtualContainersIndex","loadingList","Set","headers","fetch","fetchMethod","session","getData","context","idParent","localData","has","get","isFullResource","Promise","addEventListener","resolveResource","add","clientContext","parse","_isLocalId","fetchData","error","console","delete","serverContext","resourceProxy","CustomGetter","getProxy","cacheGraph","dispatchEvent","CustomEvent","fetchAuthn","iri","options","authenticated","then","fn","_convertHeaders","_getAbsoluteIri","_getLanguage","method","credentials","response","ok","json","key","parentContext","parentId","properties","merge","set","getSubObjects","res","newParentContext","getChildren","cacheChildrenPromises","subscribeResourceTo","push","all","match","_fetch","body","JSON","stringify","store","clearCache","_updateResource","includes","Error","expandedId","_getExpandedId","nestedResources","getNestedResources","resourcesToRefresh","resourcesToNotify","refreshResources","resourceIds","notifyResources","filter","resourceWithContexts","map","resourceId","publish","cachedResource","isContainer","nestedProperties","excludeKeys","p","Object","keys","forEach","child","setLocalData","post","put","patch","deleted","headersObject","Headers","value","entries","expandTerm","startsWith","nestedResourceId","existingSubscriptions","subscribeVirtualContainerTo","virtualContainerId","parentIri","URL","location","href","_resourceIsComplete","length","localStorage","getItem","window","navigator","language","slice","selectLanguage","selectedLanguageCode","setItem","sibStore","sibAuth","querySelector","sibAuthDefined","customElements","whenDefined","localName","getFetch","Symbol","toPrimitive","expandProperties","prop","objectReplaceProperty","object","oldProp","newProp","defineProperty","getOwnPropertyDescriptor","path","path1","split","path2","getResource","getExpandedPredicate","e","lastPath1El","pop","unshift","undefined","join","iriParent","getProperties","getCompactedPredicate","getLdpContains","children","subObjects","property","isFullNestedResource","getResourceData","getPermissions","perm","compactIri","getCompactedIri","toString","Proxy","bind"],"mappings":";;;;AAAA,OAAOA,mBAAP,MAAgC,uBAAhC,C,CACA;;AACA,OAAOC,MAAP,MAAmB,mCAAnB;AAGA,MAAMC,aAAa,GAAGF,mBAAmB,CAACE,aAA1C;AACA,MAAMC,QAAQ,GAAG,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P;AAyBD;;AA7MgB","sourcesContent":["import JSONLDContextParser from 'jsonld-context-parser';\n//@ts-ignore\nimport PubSub from 'https://cdn.skypack.dev/pubsub-js';\nimport type { Resource } from '../../mixins/interfaces';\n\nconst ContextParser = JSONLDContextParser.ContextParser;\nconst myParser = new ContextParser();\n\nexport const base_context = {\n '@vocab': 'http://happy-dev.fr/owl/#',\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n ldp: 'http://www.w3.org/ns/ldp#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n name: 'rdfs:label',\n acl: 'http://www.w3.org/ns/auth/acl#',\n permissions: 'acl:accessControl',\n mode: 'acl:mode',\n geo: \"http://www.w3.org/2003/01/geo/wgs84_pos#\",\n lat: \"geo:lat\",\n lng: \"geo:long\"\n};\n\nclass Store {\n cache: Map<string, any>;\n subscriptionIndex: Map<string, any>; // index of all the containers per resource\n subscriptionVirtualContainersIndex: Map<string, any>; // index of all the containers per resource\n loadingList: Set<String>;\n headers: object;\n fetch: Promise<any> | undefined;\n session: Promise<any> | undefined;\n\n constructor(private storeOptions: StoreOptions) {\n this.cache = new Map();\n this.subscriptionIndex = new Map();\n this.subscriptionVirtualContainersIndex = new Map();\n this.loadingList = new Set();\n this.headers = {'Content-Type': 'application/ld+json'};\n this.fetch = this.storeOptions.fetchMethod;\n this.session = this.storeOptions.session;\n }\n\n /**\n * Fetch data and cache it\n * @param id - uri of the resource to fetch\n * @param context - context used to expand id and predicates when accessing the resource\n * @param idParent - uri of the parent caller used to expand uri for local files\n *\n * @returns The fetched resource\n *\n * @async\n */\n\n async getData(id: string, context:any = {}, idParent = \"\", localData?: object): Promise<Resource|null> {\n if (localData == null && this.cache.has(id) && !this.loadingList.has(id)) {\n const resource = this.get(id);\n if (resource && resource.isFullResource()) return resource; // if resource is not complete, re-fetch it\n }\n\n return new Promise(async (resolve) => {\n document.addEventListener('resourceReady', this.resolveResource(id, resolve));\n\n if (this.loadingList.has(id)) return;\n this.loadingList.add(id);\n\n // Generate proxy\n const clientContext = await myParser.parse(context);\n let resource: any = null;\n if(this._isLocalId(id)) {\n if(localData == null) localData = {};\n localData[\"@id\"] = id;\n resource = localData;\n } else try {\n resource = localData || await this.fetchData(id, clientContext, idParent);\n } catch (error) { console.error(error) }\n if (!resource) {\n this.loadingList.delete(id);\n resolve(null);\n return;\n }\n const serverContext = await myParser.parse([resource['@context'] || {}]);\n const resourceProxy = new CustomGetter(id, resource, clientContext, serverContext, idParent).getProxy();\n\n // Cache proxy\n await this.cacheGraph(id, resourceProxy, clientContext, serverContext, idParent || id);\n this.loadingList.delete(id);\n document.dispatchEvent(new CustomEvent('resourceReady', { detail: { id: id, resource: this.get(id) } }));\n });\n }\n\n async fetchAuthn(iri: string, options: any) {\n let authenticated = false;\n if (this.session) authenticated = await this.session;\n\n if (this.fetch && authenticated) { // authenticated\n return this.fetch.then(fn => fn(iri, options))\n } else { // anonymous\n if (options.headers) options.headers = this._convertHeaders(options.headers);\n return fetch(iri, options);\n }\n }\n\n async fetchData(id: string, context = {}, idParent = \"\") {\n const iri = this._getAbsoluteIri(id, context, idParent);\n const headers = { ...this.headers, 'accept-language': this._getLanguage() };\n return this.fetchAuthn(iri, {\n method: 'GET',\n headers: headers,\n credentials: 'include'\n }).then(response => {\n if (!response.ok) return;\n return response.json()\n })\n }\n\n async cacheGraph(key: string, resource: any, clientContext: object, parentContext: object, parentId: string) {\n if (resource.properties) { // if proxy, cache it\n if (this.get(key)) { // if already cached, merge data\n this.cache.get(key).merge(resource);\n } else { // else, put in cache\n this.cache.set(key, resource);\n }\n }\n\n // Cache nested resources\n if (resource.getSubObjects) {\n for (let res of resource.getSubObjects()) {\n let newParentContext = parentContext;\n // If additional context in resource, use it to expand properties\n if (res['@context']) newParentContext = await myParser.parse({ ...parentContext, ...res['@context'] });\n const resourceProxy = new CustomGetter(res['@id'], res, clientContext, newParentContext, parentId).getProxy();\n // this.subscribeResourceTo(resource['@id'], res['@id']); // removed to prevent useless updates\n await this.cacheGraph(res['@id'], resourceProxy, clientContext, parentContext, parentId);\n }\n }\n\n // Cache children of container\n if (resource['@type'] == \"ldp:Container\" && resource.getChildren) {\n const cacheChildrenPromises: Promise<void>[] = [];\n for (let res of resource.getChildren()) {\n this.subscribeResourceTo(resource['@id'], res['@id']);\n cacheChildrenPromises.push(this.cacheGraph(res['@id'], res, clientContext, parentContext, parentId))\n }\n await Promise.all(cacheChildrenPromises);\n return;\n }\n\n // Create proxy, (fetch data) and cache resource\n if (resource['@id'] && !resource.properties) {\n if (resource['@id'].match(/^b\\d+$/)) return; // not anonymous node\n // Fetch data if\n if (resource['@type'] === \"sib:federatedContainer\" && resource['@cache'] !== 'false') { // if object is federated container\n await this.getData(resource['@id'], clientContext, parentId); // then init graph\n return;\n }\n const resourceProxy = new CustomGetter(resource['@id'], resource, clientContext, parentContext, parentId).getProxy();\n await this.cacheGraph(key, resourceProxy, clientContext, parentContext, parentId);\n }\n }\n\n /**\n * Update fetch\n * @param method - 'POST', 'PATCH', 'PUT', '_LOCAL'\n * @param resource - resource to send\n * @param id - uri to update\n * @returns - object\n */\n async _fetch(method: string, resource: object, id: string): Promise<any> {\n if (method !== '_LOCAL')\n return this.fetchAuthn(id, {\n method: method,\n headers: this.headers,\n body: JSON.stringify(resource),\n credentials: 'include'\n })\n\n const resourceProxy = store.get(id);\n const clientContext = resourceProxy ? resourceProxy.clientContext : resource['@context']\n this.clearCache(id);\n await this.getData(id, clientContext, '', resource);\n return {ok: true}\n }\n\n async _updateResource(method: string, resource: object, id: string) {\n if (!['POST', 'PUT', 'PATCH', '_LOCAL'].includes(method)) throw new Error('Error: method not allowed');\n\n const context = await myParser.parse([resource['@context'] || {}]); // parse context before expandTerm\n const expandedId = this._getExpandedId(id, context);\n return this._fetch(method, resource, id).then(response => {\n if (response.ok) {\n if(method !== '_LOCAL') this.clearCache(expandedId); // clear cache\n this.getData(expandedId, resource['@context']).then(async () => { // re-fetch data\n const nestedResources = await this.getNestedResources(resource, id);\n const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];\n const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];\n\n return this.refreshResources([...nestedResources, ...resourcesToRefresh]) // refresh related resources\n .then(resourceIds => this.notifyResources([expandedId, ...resourceIds, ...resourcesToNotify])); // notify components\n });\n return response.headers?.get('Location') || null;\n } else {\n throw response;\n }\n });\n }\n\n /**\n * Clear cache and refetch data for a list of ids\n * @param resourceIds -\n * @returns - all the resource ids\n */\n async refreshResources(resourceIds: string[]) {\n resourceIds = [...new Set(resourceIds.filter(id => this.cache.has(id)))]; // remove duplicates and not cached resources\n const resourceWithContexts = resourceIds.map(resourceId => ({ \"id\": resourceId, \"context\": store.get(resourceId)?.clientContext }));\n for (const resource of resourceWithContexts) {\n if (!this._isLocalId(resource.id)) this.clearCache(resource.id);\n }\n await Promise.all(resourceWithContexts.map(({ id, context }) => this.getData(id, context || base_context)))\n return resourceIds;\n }\n /**\n * Notifies all components for a list of ids\n * @param resourceIds -\n */\n async notifyResources(resourceIds: string[]) {\n resourceIds = [...new Set(resourceIds)]; // remove duplicates\n for (const id of resourceIds) PubSub.publish(id);\n }\n\n /**\n * Return id of nested properties of a resource\n * @param resource - object\n * @param id - string\n */\n async getNestedResources(resource: object, id: string) {\n const cachedResource = store.get(id);\n if (!cachedResource || cachedResource.isContainer()) return [];\n let nestedProperties:any[] = [];\n const excludeKeys = ['@context'];\n for (let p of Object.keys(resource)) {\n if (resource[p]\n && typeof resource[p] === 'object'\n && !excludeKeys.includes(p)\n && resource[p]['@id']) {\n nestedProperties.push(resource[p]['@id']);\n }\n }\n return nestedProperties;\n }\n\n /**\n * Returns the resource with id from the cache\n * @param id - id of the resource to retrieve\n *\n * @returns Resource (Proxy) if in the cache, null otherwise\n */\n get(id: string): Resource | null {\n return this.cache.get(id) || null;\n }\n\n\n /**\n * Removes a resource from the cache\n * @param id - id of the resource to remove from the cache\n */\n clearCache(id: string): void {\n if (this.cache.has(id)) {\n // For federation, clear each source\n const resource = this.cache.get(id);\n if (resource['@type'] === 'ldp:Container') {\n resource['ldp:contains'].forEach((child: object) => {\n if (child && child['@type'] === 'ldp:Container') this.cache.delete(child['@id'])\n })\n }\n\n this.cache.delete(id);\n }\n }\n\n /**\n * Send data to create a local resource in a container\n * @param resource - resource to create\n * @param id - uri of the container to add resource. should start with ``\n *\n * @returns id of the posted resource\n */\n async setLocalData(resource: object, id: string): Promise<string | null> {\n return this._updateResource('_LOCAL', resource, id);\n }\n\n /**\n * Send a POST request to create a resource in a container\n * @param resource - resource to create\n * @param id - uri of the container to add resource\n *\n * @returns id of the posted resource\n */\n async post(resource: object, id: string): Promise<string | null> {\n return this._updateResource('POST', resource, id);\n }\n\n /**\n * Send a PUT request to edit a resource\n * @param resource - resource data to send\n * @param id - uri of the resource to edit\n *\n * @returns id of the edited resource\n */\n async put(resource: object, id: string): Promise<string | null> {\n return this._updateResource('PUT', resource, id);\n }\n\n /**\n * Send a PATCH request to edit a resource\n * @param resource - resource data to send\n * @param id - uri of the resource to patch\n *\n * @returns id of the edited resource\n */\n async patch(resource: object, id: string): Promise<string | null> {\n return this._updateResource('PATCH', resource, id);\n }\n\n /**\n * Send a DELETE request to delete a resource\n * @param id - uri of the resource to delete\n * @param context - can be used to expand id\n *\n * @returns id of the deleted resource\n */\n async delete(id: string, context: object = {}) {\n const expandedId = this._getExpandedId(id, context);\n const deleted = await this.fetchAuthn(expandedId, {\n method: 'DELETE',\n headers: this.headers,\n credentials: 'include'\n });\n\n const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];\n const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];\n\n this.refreshResources([...resourcesToNotify, ...resourcesToRefresh])\n .then(resourceIds => this.notifyResources(resourceIds));\n\n return deleted;\n }\n\n /**\n * Convert headers object to Headers\n * @param headersObject - object\n * @returns {Headers}\n */\n _convertHeaders(headersObject: object): Headers {\n const headers = new Headers();\n for (const [key, value] of Object.entries(headersObject)){\n headers.set(key, value as string);\n }\n return headers;\n }\n\n _getExpandedId(id: string, context: object) {\n return (context && Object.keys(context)) ? ContextParser.expandTerm(id, context) : id;\n }\n\n _isLocalId(id: string) {\n return id.startsWith('store://local.');\n }\n\n /**\n * Make a resource listen changes of another one\n * @param resourceId - id of the resource which needs to be updated\n * @param nestedResourceId - id of the resource which will change\n */\n subscribeResourceTo(resourceId: string, nestedResourceId: string) {\n const existingSubscriptions = this.subscriptionIndex.get(nestedResourceId) || [];\n this.subscriptionIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, resourceId])])\n }\n\n /**\n * Make a virtual container listen for changes of a resource\n * @param virtualContainerId - id of the container which needs to be updated\n * @param nestedResourceId - id of the resource which will change\n */\n subscribeVirtualContainerTo(virtualContainerId: string, nestedResourceId: string) {\n const existingSubscriptions = this.subscriptionVirtualContainersIndex.get(nestedResourceId) || [];\n this.subscriptionVirtualContainersIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, virtualContainerId])])\n }\n\n /**\n * Return absolute IRI of the resource\n * @param id\n * @param context\n * @param parentId\n */\n _getAbsoluteIri(id: string, context: object, parentId: string): string {\n let iri = ContextParser.expandTerm(id, context); // expand if reduced ids\n if (parentId) { // and get full URL from parent caller for local files\n let parentIri = new URL(parentId, document.location.href).href;\n iri = new URL(iri, parentIri).href;\n } else {\n iri = new URL(iri, document.location.href).href;\n }\n return iri;\n }\n\n /**\n * Check if object is a full resource\n * @param resource\n */\n _resourceIsComplete(resource: object) {\n return !!(Object.keys(resource).filter(p => !p.startsWith('@')).length > 0 && resource['@id'])\n }\n\n /**\n * Return language of the users\n */\n _getLanguage() {\n return localStorage.getItem('language') || window.navigator.language.slice(0,2);\n }\n\n /**\n * Save the preferred language of the user\n * @param selectedLanguageCode\n */\n selectLanguage(selectedLanguageCode: string) {\n localStorage.setItem('language', selectedLanguageCode);\n }\n\n resolveResource = function(id: string, resolve) {\n const handler = function(event) {\n if (event.detail.id === id) {\n resolve(event.detail.resource);\n // TODO : callback\n document.removeEventListener('resourceReady', handler);\n }\n };\n return handler;\n };\n}\n\nlet store: Store;\nif (window.sibStore) {\n store = window.sibStore;\n} else {\n const sibAuth = document.querySelector('sib-auth');\n const storeOptions: StoreOptions = {}\n\n if (sibAuth) {\n const sibAuthDefined = customElements.whenDefined(sibAuth.localName);\n storeOptions.session = sibAuthDefined.then(() => (sibAuth as any).session)\n storeOptions.fetchMethod = sibAuthDefined.then(() => (sibAuth as any).getFetch())\n }\n\n store = new Store(storeOptions);\n window.sibStore = store;\n}\n\nexport {\n store\n};\n\n\nclass CustomGetter {\n resource: any; // content of the requested resource\n resourceId: string;\n clientContext: object; // context given by the app\n serverContext: object; // context given by the server\n parentId: string; // id of the parent resource, used to get the absolute url of the current resource\n\n constructor(resourceId: string, resource: object, clientContext: object, serverContext: object = {}, parentId: string = \"\") {\n this.clientContext = clientContext;\n this.serverContext = serverContext;\n this.parentId = parentId;\n this.resource = this.expandProperties({ ...resource }, serverContext);\n this.resourceId = resourceId;\n }\n\n /**\n * Expand all predicates of a resource with a given context\n * @param resource: object\n * @param context: object\n */\n expandProperties(resource: object, context: object | string) {\n for (let prop of Object.keys(resource)) {\n if (!prop) continue;\n this.objectReplaceProperty(resource, prop, ContextParser.expandTerm(prop, context as JSONLDContextParser.IJsonLdContextNormalized, true));\n }\n return resource\n }\n\n /**\n * Change the key of an object\n * @param object: object\n * @param oldProp: string - current key\n * @param newProp: string - new key to set\n */\n objectReplaceProperty(object: object, oldProp: string, newProp: string) {\n if (newProp !== oldProp) {\n Object.defineProperty(\n object,\n newProp,\n Object.getOwnPropertyDescriptor(object, oldProp) || ''\n );\n delete object[oldProp];\n }\n }\n\n /**\n * Get the property of a resource for a given path\n * @param path: string\n */\n async get(path: any) {\n if (!path) return;\n const path1: string[] = path.split('.');\n const path2: string[] = [];\n let value: any;\n if (!this.isFullResource()) { // if resource is not complete, fetch it first\n await this.getResource(this.resourceId, this.clientContext, this.parentId);\n }\n while (true) {\n try {\n value = this.resource[this.getExpandedPredicate(path1[0])];\n } catch (e) { break }\n\n if (path1.length <= 1) break; // no dot path\n const lastPath1El = path1.pop();\n if(lastPath1El) path2.unshift(lastPath1El);\n }\n if (path2.length === 0) { // end of the path\n if (!value || !value['@id']) return value; // no value or not a resource\n return await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId); // return complete resource\n }\n if (!value) return undefined;\n let resource = await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId);\n\n store.subscribeResourceTo(this.resourceId, value['@id']);\n return resource ? await resource[path2.join('.')] : undefined; // return value\n }\n\n /**\n * Cache resource in the store, and return the created proxy\n * @param id\n * @param context\n * @param iriParent\n */\n async getResource(id: string, context: object, iriParent: string): Promise<Resource | null> {\n return store.getData(id, context, iriParent);\n }\n\n /**\n * Return true if the resource is a container\n */\n isContainer(): boolean {\n return this.resource[\"@type\"] == \"ldp:Container\" || this.resource[\"@type\"] == \"sib:federatedContainer\";\n }\n\n /**\n * Get all properties of a resource\n */\n getProperties(): string[] {\n return Object.keys(this.resource).map(prop => this.getCompactedPredicate(prop));\n }\n\n /**\n * Get children of container as objects\n */\n getChildren(): object[] {\n return this.resource[this.getExpandedPredicate(\"ldp:contains\")] || [];\n }\n\n /**\n * Get children of container as Proxys\n */\n getLdpContains(): CustomGetter[] {\n const children = this.resource[this.getExpandedPredicate(\"ldp:contains\")];\n return children ? children.map((res: object) => store.get(res['@id'])) : [];\n }\n\n /**\n * Get all nested resource or containers which contains datas\n */\n getSubObjects() {\n let subObjects: any = [];\n for (let p of Object.keys(this.resource)) {\n let property = this.resource[p];\n if (!this.isFullNestedResource(property)) continue; // if not a resource, stop\n if (property['@type'] == \"ldp:Container\" &&\n (property['ldp:contains'] == undefined ||\n (property['ldp:contains'].length >= 1 && !this.isFullNestedResource(property['ldp:contains'][0])))\n ) continue; // if not a full container\n subObjects.push(property)\n }\n return subObjects;\n }\n\n merge(resource: CustomGetter) {\n this.resource = {...this.getResourceData(), ...resource.getResourceData()}\n }\n\n getResourceData(): object { return this.resource }\n\n /**\n * return true if prop is a resource with an @id and some properties\n * @param prop\n */\n isFullNestedResource(prop: any): boolean {\n return prop &&\n typeof prop == \"object\" &&\n prop['@id'] != undefined &&\n Object.keys(prop).filter(p => !p.startsWith('@')).length > 0;\n }\n /**\n * return true resource seems complete\n * @param prop\n */\n isFullResource(): boolean {\n return Object.keys(this.resource).filter(p => !p.startsWith('@')).length > 0;\n }\n\n getPermissions(): string[] {\n const permissions = this.resource[this.getExpandedPredicate(\"permissions\")];\n return permissions ? permissions.map(perm => ContextParser.expandTerm(perm.mode['@type'], this.serverContext, true)) : [];\n }\n\n /**\n * Remove the resource from the cache\n */\n clearCache(): void {\n store.clearCache(this.resourceId);\n }\n\n getExpandedPredicate(property: string) { return ContextParser.expandTerm(property, this.clientContext, true) }\n getCompactedPredicate(property: string) { return ContextParser.compactIri(property, this.clientContext, true) }\n getCompactedIri(id: string) { return ContextParser.compactIri(id, this.clientContext) }\n toString() { return this.getCompactedIri(this.resource['@id']) }\n [Symbol.toPrimitive]() { return this.getCompactedIri(this.resource['@id']) }\n\n\n /**\n * Returns a Proxy which handles the different get requests\n */\n getProxy() {\n return new Proxy(this, {\n get: (resource, property) => {\n if (!this.resource) return undefined;\n if (typeof resource[property] === 'function') return resource[property].bind(resource)\n\n switch (property) {\n case '@id':\n return this.getCompactedIri(this.resource['@id']); // Compact @id if possible\n case '@type':\n return this.resource['@type']; // return synchronously\n case 'properties':\n return this.getProperties();\n case 'ldp:contains':\n return this.getLdpContains(); // returns standard arrays synchronously\n case 'permissions':\n return this.getPermissions(); // get expanded permissions\n case 'clientContext':\n return this.clientContext; // get saved client context to re-fetch easily a resource\n case 'then':\n return;\n default:\n return resource.get(property);\n }\n }\n })\n }\n}"]}
|
|
1
|
+
{"version":3,"sources":["store.ts"],"names":["JSONLDContextParser","PubSub","ContextParser","myParser","base_context","rdf","rdfs","ldp","foaf","name","acl","permissions","mode","geo","lat","lng","Store","constructor","storeOptions","id","resolve","handler","event","detail","resource","document","removeEventListener","cache","Map","subscriptionIndex","subscriptionVirtualContainersIndex","loadingList","Set","headers","fetch","fetchMethod","session","getData","context","idParent","localData","forceFetch","has","get","isFullResource","Promise","addEventListener","resolveResource","add","clientContext","parse","_isLocalId","fetchData","error","console","delete","serverContext","resourceProxy","CustomGetter","getProxy","cacheGraph","dispatchEvent","CustomEvent","fetchAuthn","iri","options","authenticated","then","fn","_convertHeaders","response","method","ok","status","err","Error","_getAbsoluteIri","_getLanguage","credentials","json","key","parentContext","parentId","properties","merge","set","getSubObjects","res","newParentContext","getChildren","cacheChildrenPromises","subscribeResourceTo","push","all","match","_fetch","body","JSON","stringify","store","clearCache","_updateResource","includes","expandedId","_getExpandedId","purge","nestedResources","getNestedResources","resourcesToRefresh","resourcesToNotify","refreshResources","resourceIds","notifyResources","filter","resourceWithContexts","map","resourceId","publish","cachedResource","isContainer","nestedProperties","excludeKeys","p","Object","keys","forEach","child","setLocalData","post","put","patch","log","catch","warn","fullURL","URL","pathArray","pathname","split","containerUrl","origin","deleted","headersObject","Headers","value","entries","expandTerm","startsWith","nestedResourceId","existingSubscriptions","subscribeVirtualContainerTo","virtualContainerId","parentIri","location","href","_resourceIsComplete","length","localStorage","getItem","window","navigator","language","slice","selectLanguage","selectedLanguageCode","setItem","sibStore","sibAuth","querySelector","sibAuthDefined","customElements","whenDefined","localName","getFetch","Symbol","toPrimitive","expandProperties","prop","objectReplaceProperty","object","oldProp","newProp","defineProperty","getOwnPropertyDescriptor","path","path1","path2","getResource","getExpandedPredicate","e","lastPath1El","pop","unshift","undefined","join","iriParent","getProperties","getCompactedPredicate","getLdpContains","children","subObjects","property","isFullNestedResource","getResourceData","getPermissions","permissionPredicate","perm","compactIri","getCompactedIri","toString","Proxy","bind"],"mappings":";;;;AAAA,OAAOA,mBAAP,MAAgC,uBAAhC,C,CACA;;AACA,OAAOC,MAAP,MAAmB,mCAAnB;AAGA,MAAMC,aAAa,GAAGF,mBAAmB,CAACE,aAA1C;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AAOzK,QAAQ,CAACiL,QAAD,CAAf,KAA8B,UAAlC,EAA8C,OAAOjL,QAAQ,CAACiL,QAAD,CAAR,CAAmBU,IAAnB,CAAwB3L,QAAxB,CAAP;;AAE9C,gBAAQiL,QAAR;AACE,eAAK,KAAL;AACE,mBAAO,KAAKO,eAAL,CAAqB,KAAKxL,QAAL,CAAc,KAAd,CAArB,CAAP;AAAmD;;AACrD,eAAK,OAAL;AACE,mBAAO,KAAKA,QAAL,CAAc,OAAd,CAAP;AAA+B;;AACjC,eAAK,YAAL;AACE,mBAAO,KAAK4K,aAAL,EAAP;;AACF,eAAK,cAAL;AACE,mBAAO,KAAKE,cAAL,EAAP;AAA8B;;AAChC,eAAK,aAAL;AACE,mBAAO,KAAKM,cAAL,EAAP;AAA8B;;AAChC,eAAK,eAAL;AACE,mBAAO,KAAK3J,aAAZ;AAA2B;;AAC7B,eAAK,MAAL;AACE;;AACF;AACE,mBAAOzB,QAAQ,CAACmB,GAAT,CAAa8J,QAAb,CAAP;AAhBJ;AAkBD;AAvBoB,KAAhB,CAAP;AAyBD;;AAnNgB","sourcesContent":["import JSONLDContextParser from 'jsonld-context-parser';\n//@ts-ignore\nimport PubSub from 'https://cdn.skypack.dev/pubsub-js';\nimport type { Resource } from '../../mixins/interfaces';\n\nconst ContextParser = JSONLDContextParser.ContextParser;\nconst myParser = new ContextParser();\n\nexport const base_context = {\n '@vocab': 'http://happy-dev.fr/owl/#',\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n ldp: 'http://www.w3.org/ns/ldp#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n name: 'rdfs:label',\n acl: 'http://www.w3.org/ns/auth/acl#',\n permissions: 'acl:accessControl',\n mode: 'acl:mode',\n geo: \"http://www.w3.org/2003/01/geo/wgs84_pos#\",\n lat: \"geo:lat\",\n lng: \"geo:long\"\n};\n\nclass Store {\n cache: Map<string, any>;\n subscriptionIndex: Map<string, any>; // index of all the containers per resource\n subscriptionVirtualContainersIndex: Map<string, any>; // index of all the containers per resource\n loadingList: Set<String>;\n headers: object;\n fetch: Promise<any> | undefined;\n session: Promise<any> | undefined;\n\n constructor(private storeOptions: StoreOptions) {\n this.cache = new Map();\n this.subscriptionIndex = new Map();\n this.subscriptionVirtualContainersIndex = new Map();\n this.loadingList = new Set();\n this.headers = {'Content-Type': 'application/ld+json'};\n this.fetch = this.storeOptions.fetchMethod;\n this.session = this.storeOptions.session;\n }\n\n /**\n * Fetch data and cache it\n * @param id - uri of the resource to fetch\n * @param context - context used to expand id and predicates when accessing the resource\n * @param idParent - uri of the parent caller used to expand uri for local files\n * @param localData - data to put in cache\n * @param forceFetch - force the fetch of data\n *\n * @returns The fetched resource\n *\n * @async\n */\n\n async getData(id: string, context:any = {}, idParent = \"\", localData?: object, forceFetch: boolean = false): Promise<Resource|null> {\n if (localData == null && this.cache.has(id) && !this.loadingList.has(id)) {\n const resource = this.get(id);\n if (resource && resource.isFullResource() && !forceFetch) return resource; // if resource is not complete, re-fetch it\n }\n\n return new Promise(async (resolve) => {\n document.addEventListener('resourceReady', this.resolveResource(id, resolve));\n\n if (this.loadingList.has(id)) return;\n this.loadingList.add(id);\n\n // Generate proxy\n const clientContext = await myParser.parse(context);\n let resource: any = null;\n if(this._isLocalId(id)) {\n if(localData == null) localData = {};\n localData[\"@id\"] = id;\n resource = localData;\n } else try {\n resource = localData || await this.fetchData(id, clientContext, idParent);\n } catch (error) { console.error(error) }\n if (!resource) {\n this.loadingList.delete(id);\n resolve(null);\n return;\n }\n const serverContext = await myParser.parse([resource['@context'] || {}]);\n const resourceProxy = new CustomGetter(id, resource, clientContext, serverContext, idParent).getProxy();\n\n // Cache proxy\n await this.cacheGraph(id, resourceProxy, clientContext, serverContext, idParent || id);\n this.loadingList.delete(id);\n document.dispatchEvent(new CustomEvent('resourceReady', { detail: { id: id, resource: this.get(id) } }));\n });\n }\n\n async fetchAuthn(iri: string, options: any) {\n let authenticated = false;\n if (this.session) authenticated = await this.session;\n\n if (this.fetch && authenticated) { // authenticated\n return this.fetch.then(fn => fn(iri, options))\n } else { // anonymous\n if (options.headers) options.headers = this._convertHeaders(options.headers);\n return fetch(iri, options).then(function(response) {\n if (options.method === \"PURGE\" && !response.ok && response.status === 404) {\n const err = new Error(\"PURGE call is returning 404\");\n throw err;\n }\n return response;\n });\n }\n }\n\n async fetchData(id: string, context = {}, idParent = \"\") {\n const iri = this._getAbsoluteIri(id, context, idParent);\n const headers = { ...this.headers, 'accept-language': this._getLanguage() };\n return this.fetchAuthn(iri, {\n method: 'GET',\n headers: headers,\n credentials: 'include'\n }).then(response => {\n if (!response.ok) return;\n return response.json()\n })\n }\n\n async cacheGraph(key: string, resource: any, clientContext: object, parentContext: object, parentId: string) {\n if (resource.properties) { // if proxy, cache it\n if (this.get(key)) { // if already cached, merge data\n this.cache.get(key).merge(resource);\n } else { // else, put in cache\n this.cache.set(key, resource);\n }\n }\n\n // Cache nested resources\n if (resource.getSubObjects) {\n for (let res of resource.getSubObjects()) {\n let newParentContext = parentContext;\n // If additional context in resource, use it to expand properties\n if (res['@context']) newParentContext = await myParser.parse({ ...parentContext, ...res['@context'] });\n const resourceProxy = new CustomGetter(res['@id'], res, clientContext, newParentContext, parentId).getProxy();\n // this.subscribeResourceTo(resource['@id'], res['@id']); // removed to prevent useless updates\n await this.cacheGraph(res['@id'], resourceProxy, clientContext, parentContext, parentId);\n }\n }\n\n // Cache children of container\n if (resource['@type'] == \"ldp:Container\" && resource.getChildren) {\n const cacheChildrenPromises: Promise<void>[] = [];\n for (let res of resource.getChildren()) {\n this.subscribeResourceTo(resource['@id'], res['@id']);\n cacheChildrenPromises.push(this.cacheGraph(res['@id'], res, clientContext, parentContext, parentId))\n }\n await Promise.all(cacheChildrenPromises);\n return;\n }\n\n // Create proxy, (fetch data) and cache resource\n if (resource['@id'] && !resource.properties) {\n if (resource['@id'].match(/^b\\d+$/)) return; // not anonymous node\n // Fetch data if\n if (resource['@type'] === \"sib:federatedContainer\" && resource['@cache'] !== 'false') { // if object is federated container\n await this.getData(resource['@id'], clientContext, parentId); // then init graph\n return;\n }\n const resourceProxy = new CustomGetter(resource['@id'], resource, clientContext, parentContext, parentId).getProxy();\n await this.cacheGraph(key, resourceProxy, clientContext, parentContext, parentId);\n }\n }\n\n /**\n * Update fetch\n * @param method - 'POST', 'PATCH', 'PUT', '_LOCAL'\n * @param resource - resource to send\n * @param id - uri to update\n * @returns - object\n */\n async _fetch(method: string, resource: object, id: string): Promise<any> {\n if (method !== '_LOCAL')\n return this.fetchAuthn(id, {\n method: method,\n headers: this.headers,\n body: JSON.stringify(resource),\n credentials: 'include'\n });\n\n const resourceProxy = store.get(id);\n const clientContext = resourceProxy ? resourceProxy.clientContext : resource['@context']\n this.clearCache(id);\n await this.getData(id, clientContext, '', resource);\n return {ok: true}\n }\n\n async _updateResource(method: string, resource: object, id: string) {\n if (!['POST', 'PUT', 'PATCH', '_LOCAL'].includes(method)) throw new Error('Error: method not allowed');\n\n const context = await myParser.parse([resource['@context'] || {}]); // parse context before expandTerm\n const expandedId = this._getExpandedId(id, context);\n return this._fetch(method, resource, id).then(async(response) => {\n if (response.ok) {\n if(method !== '_LOCAL') {\n await this.purge(id);\n this.clearCache(expandedId);\n } // clear cache\n this.getData(expandedId, resource['@context']).then(async () => { // re-fetch data\n const nestedResources = await this.getNestedResources(resource, id);\n const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];\n const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];\n\n return this.refreshResources([...nestedResources, ...resourcesToRefresh]) // refresh related resources\n .then(resourceIds => this.notifyResources([expandedId, ...resourceIds, ...resourcesToNotify])); // notify components\n });\n return response.headers?.get('Location') || null;\n } else {\n throw response;\n }\n });\n }\n\n /**\n * Clear cache and refetch data for a list of ids\n * @param resourceIds -\n * @returns - all the resource ids\n */\n async refreshResources(resourceIds: string[]) {\n resourceIds = [...new Set(resourceIds.filter(id => this.cache.has(id)))]; // remove duplicates and not cached resources\n const resourceWithContexts = resourceIds.map(resourceId => ({ \"id\": resourceId, \"context\": store.get(resourceId)?.clientContext }));\n for (const resource of resourceWithContexts) {\n if (!this._isLocalId(resource.id)) this.clearCache(resource.id);\n }\n await Promise.all(resourceWithContexts.map(({ id, context }) => this.getData(id, context || base_context)))\n return resourceIds;\n }\n /**\n * Notifies all components for a list of ids\n * @param resourceIds -\n */\n async notifyResources(resourceIds: string[]) {\n resourceIds = [...new Set(resourceIds)]; // remove duplicates\n for (const id of resourceIds) PubSub.publish(id);\n }\n\n /**\n * Return id of nested properties of a resource\n * @param resource - object\n * @param id - string\n */\n async getNestedResources(resource: object, id: string) {\n const cachedResource = store.get(id);\n if (!cachedResource || cachedResource.isContainer()) return [];\n let nestedProperties:any[] = [];\n const excludeKeys = ['@context'];\n for (let p of Object.keys(resource)) {\n if (resource[p]\n && typeof resource[p] === 'object'\n && !excludeKeys.includes(p)\n && resource[p]['@id']) {\n nestedProperties.push(resource[p]['@id']);\n }\n }\n return nestedProperties;\n }\n\n /**\n * Returns the resource with id from the cache\n * @param id - id of the resource to retrieve\n *\n * @returns Resource (Proxy) if in the cache, null otherwise\n */\n get(id: string): Resource | null {\n return this.cache.get(id) || null;\n }\n\n\n /**\n * Removes a resource from the cache\n * @param id - id of the resource to remove from the cache\n */\n clearCache(id: string): void {\n if (this.cache.has(id)) {\n // For federation, clear each source\n const resource = this.cache.get(id);\n if (resource['@type'] === 'ldp:Container') {\n resource['ldp:contains'].forEach((child: object) => {\n if (child && child['@type'] === 'ldp:Container') this.cache.delete(child['@id'])\n })\n }\n\n this.cache.delete(id);\n }\n }\n\n /**\n * Send data to create a local resource in a container\n * @param resource - resource to create\n * @param id - uri of the container to add resource. should start with ``\n *\n * @returns id of the posted resource\n */\n async setLocalData(resource: object, id: string): Promise<string | null> {\n return this._updateResource('_LOCAL', resource, id);\n }\n\n /**\n * Send a POST request to create a resource in a container\n * @param resource - resource to create\n * @param id - uri of the container to add resource\n *\n * @returns id of the posted resource\n */\n async post(resource: object, id: string): Promise<string | null> {\n return this._updateResource('POST', resource, id);\n }\n\n /**\n * Send a PUT request to edit a resource\n * @param resource - resource data to send\n * @param id - uri of the resource to edit\n *\n * @returns id of the edited resource\n */\n async put(resource: object, id: string): Promise<string | null> {\n return this._updateResource('PUT', resource, id);\n }\n\n /**\n * Send a PATCH request to edit a resource\n * @param resource - resource data to send\n * @param id - uri of the resource to patch\n *\n * @returns id of the edited resource\n */\n async patch(resource: object, id: string): Promise<string | null> {\n return this._updateResource('PATCH', resource, id);\n }\n\n /**\n * Send a PURGE request to remove a resource from REDIS AD cache\n * @param id - uri of the resource to patch\n *\n * @returns id of the edited resource\n */\n async purge(id: string) {\n console.log('Purging resource ' + id);\n await this.fetchAuthn(id, {\n method: \"PURGE\",\n headers: this.headers\n }).catch(function(error) {\n console.warn('No purge method allowed: ' + error)\n });\n\n try {\n const fullURL = new URL(id);\n\n var pathArray = fullURL.pathname.split('/');\n var containerUrl = fullURL.origin + '/' + pathArray[1];\n const headers = { ...this.headers, 'X-Cache-Purge-Match': 'wildcard' };\n await this.fetchAuthn(containerUrl + '/*', {\n method: \"PURGE\",\n headers: headers\n }).catch(function(error) {\n console.warn('No purge method allowed: ' + error)\n });\n } catch (error) {\n console.warn('The resource ID is not a complete URL: ' + error);\n return;\n }\n }\n\n /**\n * Send a DELETE request to delete a resource\n * @param id - uri of the resource to delete\n * @param context - can be used to expand id\n *\n * @returns id of the deleted resource\n */\n async delete(id: string, context: object = {}) {\n const expandedId = this._getExpandedId(id, context);\n const deleted = await this.fetchAuthn(expandedId, {\n method: 'DELETE',\n headers: this.headers,\n credentials: 'include'\n });\n await this.purge(id);\n\n const resourcesToNotify = this.subscriptionIndex.get(expandedId) || [];\n const resourcesToRefresh = this.subscriptionVirtualContainersIndex.get(expandedId) || [];\n\n this.refreshResources([...resourcesToNotify, ...resourcesToRefresh])\n .then(resourceIds => this.notifyResources(resourceIds));\n\n return deleted;\n }\n\n /**\n * Convert headers object to Headers\n * @param headersObject - object\n * @returns {Headers}\n */\n _convertHeaders(headersObject: object): Headers {\n const headers = new Headers();\n for (const [key, value] of Object.entries(headersObject)){\n headers.set(key, value as string);\n }\n return headers;\n }\n\n _getExpandedId(id: string, context: object) {\n return (context && Object.keys(context)) ? ContextParser.expandTerm(id, context) : id;\n }\n\n _isLocalId(id: string) {\n return id.startsWith('store://local.');\n }\n\n /**\n * Make a resource listen changes of another one\n * @param resourceId - id of the resource which needs to be updated\n * @param nestedResourceId - id of the resource which will change\n */\n subscribeResourceTo(resourceId: string, nestedResourceId: string) {\n const existingSubscriptions = this.subscriptionIndex.get(nestedResourceId) || [];\n this.subscriptionIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, resourceId])])\n }\n\n /**\n * Make a virtual container listen for changes of a resource\n * @param virtualContainerId - id of the container which needs to be updated\n * @param nestedResourceId - id of the resource which will change\n */\n subscribeVirtualContainerTo(virtualContainerId: string, nestedResourceId: string) {\n const existingSubscriptions = this.subscriptionVirtualContainersIndex.get(nestedResourceId) || [];\n this.subscriptionVirtualContainersIndex.set(nestedResourceId, [...new Set([...existingSubscriptions, virtualContainerId])])\n }\n\n /**\n * Return absolute IRI of the resource\n * @param id\n * @param context\n * @param parentId\n */\n _getAbsoluteIri(id: string, context: object, parentId: string): string {\n let iri = ContextParser.expandTerm(id, context); // expand if reduced ids\n if (parentId) { // and get full URL from parent caller for local files\n let parentIri = new URL(parentId, document.location.href).href;\n iri = new URL(iri, parentIri).href;\n } else {\n iri = new URL(iri, document.location.href).href;\n }\n return iri;\n }\n\n /**\n * Check if object is a full resource\n * @param resource\n */\n _resourceIsComplete(resource: object) {\n return !!(Object.keys(resource).filter(p => !p.startsWith('@')).length > 0 && resource['@id'])\n }\n\n /**\n * Return language of the users\n */\n _getLanguage() {\n return localStorage.getItem('language') || window.navigator.language.slice(0,2);\n }\n\n /**\n * Save the preferred language of the user\n * @param selectedLanguageCode\n */\n selectLanguage(selectedLanguageCode: string) {\n localStorage.setItem('language', selectedLanguageCode);\n }\n\n resolveResource = function(id: string, resolve) {\n const handler = function(event) {\n if (event.detail.id === id) {\n resolve(event.detail.resource);\n // TODO : callback\n document.removeEventListener('resourceReady', handler);\n }\n };\n return handler;\n };\n}\n\nlet store: Store;\nif (window.sibStore) {\n store = window.sibStore;\n} else {\n const sibAuth = document.querySelector('sib-auth');\n const storeOptions: StoreOptions = {}\n\n if (sibAuth) {\n const sibAuthDefined = customElements.whenDefined(sibAuth.localName);\n storeOptions.session = sibAuthDefined.then(() => (sibAuth as any).session)\n storeOptions.fetchMethod = sibAuthDefined.then(() => (sibAuth as any).getFetch())\n }\n\n store = new Store(storeOptions);\n window.sibStore = store;\n}\n\nexport {\n store\n};\n\n\nclass CustomGetter {\n resource: any; // content of the requested resource\n resourceId: string;\n clientContext: object; // context given by the app\n serverContext: object; // context given by the server\n parentId: string; // id of the parent resource, used to get the absolute url of the current resource\n\n constructor(resourceId: string, resource: object, clientContext: object, serverContext: object = {}, parentId: string = \"\") {\n this.clientContext = clientContext;\n this.serverContext = serverContext;\n this.parentId = parentId;\n this.resource = this.expandProperties({ ...resource }, serverContext);\n this.resourceId = resourceId;\n }\n\n /**\n * Expand all predicates of a resource with a given context\n * @param resource: object\n * @param context: object\n */\n expandProperties(resource: object, context: object | string) {\n for (let prop of Object.keys(resource)) {\n if (!prop) continue;\n this.objectReplaceProperty(resource, prop, ContextParser.expandTerm(prop, context as JSONLDContextParser.IJsonLdContextNormalized, true));\n }\n return resource\n }\n\n /**\n * Change the key of an object\n * @param object: object\n * @param oldProp: string - current key\n * @param newProp: string - new key to set\n */\n objectReplaceProperty(object: object, oldProp: string, newProp: string) {\n if (newProp !== oldProp) {\n Object.defineProperty(\n object,\n newProp,\n Object.getOwnPropertyDescriptor(object, oldProp) || ''\n );\n delete object[oldProp];\n }\n }\n\n /**\n * Get the property of a resource for a given path\n * @param path: string\n */\n async get(path: any) {\n if (!path) return;\n const path1: string[] = path.split('.');\n const path2: string[] = [];\n let value: any;\n if (!this.isFullResource()) { // if resource is not complete, fetch it first\n await this.getResource(this.resourceId, this.clientContext, this.parentId);\n }\n while (true) {\n try {\n value = this.resource[this.getExpandedPredicate(path1[0])];\n } catch (e) { break }\n\n if (path1.length <= 1) break; // no dot path\n const lastPath1El = path1.pop();\n if(lastPath1El) path2.unshift(lastPath1El);\n }\n if (path2.length === 0) { // end of the path\n if (!value || !value['@id']) return value; // no value or not a resource\n return await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId); // return complete resource\n }\n if (!value) return undefined;\n let resource = await this.getResource(value['@id'], this.clientContext, this.parentId || this.resourceId);\n\n store.subscribeResourceTo(this.resourceId, value['@id']);\n return resource ? await resource[path2.join('.')] : undefined; // return value\n }\n\n /**\n * Cache resource in the store, and return the created proxy\n * @param id\n * @param context\n * @param iriParent\n * @param forceFetch\n */\n async getResource(id: string, context: object, iriParent: string, forceFetch: boolean = false): Promise<Resource | null> {\n return store.getData(id, context, iriParent, undefined, forceFetch);\n }\n\n /**\n * Return true if the resource is a container\n */\n isContainer(): boolean {\n return this.resource[\"@type\"] == \"ldp:Container\" || this.resource[\"@type\"] == \"sib:federatedContainer\";\n }\n\n /**\n * Get all properties of a resource\n */\n getProperties(): string[] {\n return Object.keys(this.resource).map(prop => this.getCompactedPredicate(prop));\n }\n\n /**\n * Get children of container as objects\n */\n getChildren(): object[] {\n return this.resource[this.getExpandedPredicate(\"ldp:contains\")] || [];\n }\n\n /**\n * Get children of container as Proxys\n */\n getLdpContains(): CustomGetter[] {\n const children = this.resource[this.getExpandedPredicate(\"ldp:contains\")];\n return children ? children.map((res: object) => store.get(res['@id'])) : [];\n }\n\n /**\n * Get all nested resource or containers which contains datas\n */\n getSubObjects() {\n let subObjects: any = [];\n for (let p of Object.keys(this.resource)) {\n let property = this.resource[p];\n if (!this.isFullNestedResource(property)) continue; // if not a resource, stop\n if (property['@type'] == \"ldp:Container\" &&\n (property['ldp:contains'] == undefined ||\n (property['ldp:contains'].length >= 1 && !this.isFullNestedResource(property['ldp:contains'][0])))\n ) continue; // if not a full container\n subObjects.push(property)\n }\n return subObjects;\n }\n\n merge(resource: CustomGetter) {\n this.resource = {...this.getResourceData(), ...resource.getResourceData()}\n }\n\n getResourceData(): object { return this.resource }\n\n /**\n * return true if prop is a resource with an @id and some properties\n * @param prop\n */\n isFullNestedResource(prop: any): boolean {\n return prop &&\n typeof prop == \"object\" &&\n prop['@id'] != undefined &&\n Object.keys(prop).filter(p => !p.startsWith('@')).length > 0;\n }\n /**\n * return true resource seems complete\n * @param prop\n */\n isFullResource(): boolean {\n return Object.keys(this.resource).filter(p => !p.startsWith('@')).length > 0;\n }\n\n async getPermissions(): Promise<string[]> {\n const permissionPredicate = this.getExpandedPredicate(\"permissions\");\n let permissions = this.resource[permissionPredicate];\n if (!permissions) { // if no permission, re-fetch data\n await this.getResource(this.resourceId, this.clientContext, this.parentId, true);\n permissions = this.resource[permissionPredicate];\n }\n return permissions ? permissions.map(perm => ContextParser.expandTerm(perm.mode['@type'], this.serverContext, true)) : [];\n }\n\n /**\n * Remove the resource from the cache\n */\n clearCache(): void {\n store.clearCache(this.resourceId);\n }\n\n getExpandedPredicate(property: string) { return ContextParser.expandTerm(property, this.clientContext, true) }\n getCompactedPredicate(property: string) { return ContextParser.compactIri(property, this.clientContext, true) }\n getCompactedIri(id: string) { return ContextParser.compactIri(id, this.clientContext) }\n toString() { return this.getCompactedIri(this.resource['@id']) }\n [Symbol.toPrimitive]() { return this.getCompactedIri(this.resource['@id']) }\n\n\n /**\n * Returns a Proxy which handles the different get requests\n */\n getProxy() {\n return new Proxy(this, {\n get: (resource, property) => {\n if (!this.resource) return undefined;\n if (typeof resource[property] === 'function') return resource[property].bind(resource)\n\n switch (property) {\n case '@id':\n return this.getCompactedIri(this.resource['@id']); // Compact @id if possible\n case '@type':\n return this.resource['@type']; // return synchronously\n case 'properties':\n return this.getProperties();\n case 'ldp:contains':\n return this.getLdpContains(); // returns standard arrays synchronously\n case 'permissions':\n return this.getPermissions(); // get expanded permissions\n case 'clientContext':\n return this.clientContext; // get saved client context to re-fetch easily a resource\n case 'then':\n return;\n default:\n return resource.get(property);\n }\n }\n })\n }\n}"]}
|
|
@@ -286,7 +286,7 @@ const WidgetMixin = {
|
|
|
286
286
|
};
|
|
287
287
|
const escapedField = this.getEscapedField(field); // transfer all multiple-[field]-[attr] attributes as [attr] for multiple widget [field]
|
|
288
288
|
|
|
289
|
-
const multipleAttributes = ['fields', 'label', 'widget', 'add-label', 'remove-label', 'next', 'empty-widget'];
|
|
289
|
+
const multipleAttributes = ['fields', 'label', 'widget', 'add-label', 'remove-label', 'next', 'empty-widget', 'add-class', 'remove-class'];
|
|
290
290
|
|
|
291
291
|
for (let attr of multipleAttributes) this.addToAttributes("multiple-".concat(escapedField, "-").concat(attr), attr, attrs); // transfer all [attr]-[field] attributes as [attr] attribute for widget [field]
|
|
292
292
|
|
|
@@ -294,7 +294,7 @@ const WidgetMixin = {
|
|
|
294
294
|
const defaultAttributes = ['range', 'enum', 'label', 'placeholder', 'class',,
|
|
295
295
|
/* 'widget', */
|
|
296
296
|
'required', 'editable', 'autocomplete', 'upload-url', 'option-label', 'option-value', 'order-by', // deprecated. Remove in 0.15
|
|
297
|
-
'each-label', 'order-asc', 'order-desc', 'min', 'max', 'pattern', 'title', 'start-value', 'end-value', 'alt', 'step', 'maxlength', 'minlength', 'search-text', 'search-placeholder'];
|
|
297
|
+
'each-label', 'order-asc', 'order-desc', 'min', 'max', 'pattern', 'title', 'start-value', 'end-value', 'alt', 'step', 'maxlength', 'minlength', 'search-text', 'search-placeholder', 'link-text'];
|
|
298
298
|
|
|
299
299
|
for (let attr of defaultAttributes) this.addToAttributes("".concat(attr, "-").concat(escapedField), attr, attrs);
|
|
300
300
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["widgetMixin.ts"],"names":["spread","preHTML","parseFieldsString","findClosingBracketMatchIndex","newWidgetFactory","WidgetType","html","render","ifDefined","WidgetMixin","name","use","attributes","fields","type","String","default","undefined","initialState","nameWidgets","_div","created","attached","dataSrc","resource","noRender","populate","parentElement","div","document","createElement","element","appendChild","value","widgets","map","querySelector","getFields","attr","isContainer","res","console","error","Error","prop","properties","startsWith","push","getAction","field","action","getAttribute","editable","hasAttribute","getSetRegexp","RegExp","getSet","setString","match","firstSetBracket","indexOf","length","lastSetBracket","set","substring","isSet","foundSets","isString","fetchValue","getValue","escapedField","getEscapedField","resourceValue","empty","widgetFromTagName","tagName","CUSTOM","USER","customElements","get","NATIVE","getWidget","widget","defaultWidget","defaultSetWidget","multiple","attribute","defaultMultipleWidget","addToAttributes","lookForAttr","setAttrKey","widgetAttributes","attrs","multipleAttributes","defaultAttributes","addableAttributes","Array","from","filter","a","replace","resourceId","createWidgetTemplate","transformAttributes","createString","createSet","currentResource","widgetMeta","widgetTemplate","class","defineAttribute","setAttribute","setWidget","setAttributes","initializing","Object","keys","component","setFields","hasOnlyEmpty","valueSet","widgetsTemplate","Promise","all","template","slice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAT,EAAiBC,OAAjB,QAAgC,qBAAhC;AACA,SAASC,iBAAT,EAA4BC,4BAA5B,QAAgE,iBAAhE;AACA,SAASC,gBAAT,QAAiC,mCAAjC;AACA,SAA0BC,UAA1B,QAAsD,cAAtD;AACA,SAASC,IAAT,EAAeC,MAAf,QAA6C,UAA7C;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,MAAMC,WAAW,GAAG;AAClBC,EAAAA,IAAI,EAAE,cADY;AAElBC,EAAAA,GAAG,EAAE,EAFa;AAGlBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAEC,MADA;AAENC,MAAAA,OAAO,EAAEC;AAFH;AADE,GAHM;AASlBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,WAAW,EAAE,IADD;AAEZC,IAAAA,IAAI,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0CtD;;;AACA,UAAM8C,eAAe,GAAG,MAAMC,OAAO,CAACC,GAAR,CAAYL,SAAS,CAACnF,GAAV,CAAec,KAAD,IAAmB,KAAKqD,oBAAL,CAA0BrD,KAA1B,CAAjC,CAAZ,CAA9B;AACA,UAAM2E,QAAQ,GAAGtH,IAAH,qBAAUmH,eAAV,CAAd;AACAlH,IAAAA,MAAM,CAACqH,QAAD,EAAW1C,MAAM,CAAC9C,aAAP,CAAqB,gBAArB,KAA0C8C,MAArD,CAAN;AACA,WAAOA,MAAP;AACD,GA/ViB;;AAgWlBsB,EAAAA,YAAY,CAACvE,KAAD,EAAgC;AAC1C,WAAO3B,IAAP,qBACU2B,KAAK,CAAC4F,KAAN,CAAY,CAAZ,EAAe,CAAC,CAAhB,EAAmBzB,OAAnB,CAA2B,WAA3B,EAAwC,IAAxC,CADV;AAGD,GApWiB;;AAqWlB;AACF;AACA;AACA;AACE7B,EAAAA,eAAe,CAACtB,KAAD,EAAwB;AACrC,WAAOA,KAAK,CAACH,UAAN,CAAiB,GAAjB,IAAwBG,KAAK,CAAC4E,KAAN,CAAY,CAAZ,EAAe5E,KAAK,CAACY,MAArB,CAAxB,GAAuDZ,KAA9D;AACD;;AA3WiB,CAApB;AA8WA,SACExC,WADF","sourcesContent":["import { spread, preHTML } from '../libs/lit-helpers';\nimport { parseFieldsString, findClosingBracketMatchIndex } from '../libs/helpers';\nimport { newWidgetFactory } from '../new-widgets/new-widget-factory';\nimport { WidgetInterface, WidgetType, Resource } from './interfaces';\nimport { html, render, TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst WidgetMixin = {\n name: 'widget-mixin',\n use: [],\n attributes: {\n fields: {\n type: String,\n default: undefined,\n }\n },\n initialState: {\n nameWidgets: null,\n _div: null\n },\n created(): void {\n this.nameWidgets = [];\n },\n attached(): void {\n if (!this.dataSrc && !this.resource && this.noRender === null) this.populate();\n },\n get parentElement(): string {\n return 'div';\n },\n get div(): HTMLElement {\n if (this._div) return this._div;\n this._div = document.createElement(this.parentElement);\n this.element.appendChild(this._div);\n return this._div;\n },\n set div(value) {\n this._div = value\n },\n get widgets() {\n return this.nameWidgets.map((name: string) => this.element.querySelector(`[name=\"${name}\"]`));\n },\n /**\n * Return field list of the component\n */\n async getFields(): Promise<string[]>{ // TODO : improve code\n const attr = this.fields;\n if (attr === '') return [];\n if (attr) return parseFieldsString(attr);\n\n let resource = this.resource as Resource;\n if (resource && resource.isContainer()) { // If container, keep the 1rst resource\n for (let res of resource['ldp:contains']) {\n resource = res;\n break;\n }\n }\n\n if (!this.dataSrc) console.error(new Error('You must provide a \"fields\" attribute'));\n if(!resource) return [];\n\n let fields: string[] = [];\n for (const prop of resource.properties) {\n if ((!prop.startsWith('@') && !(prop === \"permissions\")) && await resource[prop]) fields.push(prop);\n }\n return fields;\n },\n /**\n * return attribute if \"field\" is an action\n * @param field - string\n */\n getAction(field: string): string {\n const action = this.element.getAttribute('action-' + field);\n return action;\n },\n /**\n * return true if \"field\" is editable\n * @param field - string\n */\n editable(field: string): string {\n return this.element.hasAttribute('editable-' + field);\n },\n /**\n * Return regexp to check if \"field\" is a set\n * @param field - string\n */\n getSetRegexp(field: string) {\n return new RegExp(`(^|\\\\,|\\\\(|\\\\s)\\\\s*${field}\\\\s*\\\\(`, 'g')\n },\n /**\n * Return fields contained in set \"field\"\n * @param field - string\n */\n getSet(field: string): string[] {\n const setString = this.fields.match(this.getSetRegexp(field));\n if (!setString) return [];\n const firstSetBracket = this.fields.indexOf(setString[0]) + (setString[0].length) - 1;\n const lastSetBracket = findClosingBracketMatchIndex(this.fields, firstSetBracket);\n const set = this.fields.substring(firstSetBracket + 1, lastSetBracket);\n return parseFieldsString(set);\n },\n /**\n * Return true if \"field\" is a set\n * @param field - string\n */\n isSet(field: string): boolean {\n if (!this.fields) return false;\n let foundSets = this.fields.match(this.getSetRegexp(field));\n return foundSets ? foundSets.length > 0 : false;\n },\n isString(field: string): boolean {\n return field.startsWith('\\'') || field.startsWith('\\\"');\n },\n /**\n * Return the value of \"resource\" for predicate \"field\"\n * @param field - string\n * @param resource - Resource\n */\n async fetchValue(field: string, resource: Resource) {\n return resource && !resource.isContainer() ? await resource[field] : undefined;\n },\n /**\n * Return the value of the field\n * @param field - field\n */\n async getValue(field: string, resource: Resource) {\n const escapedField = this.getEscapedField(field);\n if (this.getAction(escapedField)) {\n return this.getAction(escapedField);\n }\n if (this.element.hasAttribute('value-' + field)) {\n return this.element.getAttribute('value-' + field);\n }\n let resourceValue = await this.fetchValue(field, resource);\n\n // Empty value\n if (resourceValue === undefined || resourceValue === '' || resourceValue === null) // If null or empty, return field default value\n return this.element.hasAttribute('default-' + field) ?\n this.element.getAttribute('default-' + field) : '';\n\n return resourceValue;\n },\n empty(): void {},\n /**\n * Return a widget from a tagName, and create it if necessary\n * @param tagName - string\n */\n widgetFromTagName(tagName: string) {\n let type = tagName.startsWith('solid') ? WidgetType.CUSTOM : WidgetType.USER;\n if (!customElements.get(tagName)) { // component does not exist\n if (tagName.startsWith('solid')) newWidgetFactory(tagName); // solid- -> create it\n else type = WidgetType.NATIVE; // or use a native tag\n }\n return { tagName, type }; // return tagName\n },\n /**\n * Return widget for field \"field\"\n * @param field - string\n * @param isSet - boolean\n */\n getWidget(field: string, isSet: boolean = false): WidgetInterface {\n const widget = this.element.getAttribute('widget-' + field);\n\n if (widget) return this.widgetFromTagName(widget);\n if (this.getAction(field)) return this.widgetFromTagName('solid-action');\n\n return !isSet ? this.widgetFromTagName(this.defaultWidget) : this.widgetFromTagName(this.defaultSetWidget);\n },\n /**\n * Return multiple widget if \"field\" is a multiple, false if it's not\n * @param field - string\n */\n multiple(field: string): WidgetInterface|null {\n const attribute = 'multiple-' + field;\n if (!this.element.hasAttribute(attribute)) return null;\n const widget = this.element.getAttribute(attribute) || this.defaultMultipleWidget;\n return this.widgetFromTagName(widget);\n },\n /**\n * If attribute \"lookForAttr\" is set on element, add \"attrKey\" to the \"attributes\" list\n * @param lookForAttr - string\n * @param setAttrKey - string\n * @param attributes - object\n */\n addToAttributes(lookForAttr: string, setAttrKey: string, attributes: object) {\n const attribute = this.element.getAttribute(lookForAttr);\n if (attribute == null) return;\n attributes[setAttrKey] = attribute;\n },\n /**\n * Return all the attributes of widget \"field\"\n * @param field - string\n * @param resource - Resource\n */\n widgetAttributes(field: string, resource: Resource): object {\n const attrs = { name: field };\n const escapedField = this.getEscapedField(field);\n\n // transfer all multiple-[field]-[attr] attributes as [attr] for multiple widget [field]\n const multipleAttributes = [\n 'fields',\n 'label',\n 'widget',\n 'add-label',\n 'remove-label',\n 'next', \n 'empty-widget'\n ];\n for (let attr of multipleAttributes) this.addToAttributes(`multiple-${escapedField}-${attr}`, attr, attrs)\n\n // transfer all [attr]-[field] attributes as [attr] attribute for widget [field]\n const defaultAttributes = [\n 'range',\n 'enum',\n 'label',\n 'placeholder',\n 'class',\n /* 'widget', */,\n 'required',\n 'editable',\n 'autocomplete',\n 'upload-url',\n 'option-label',\n 'option-value',\n 'order-by', // deprecated. Remove in 0.15\n 'each-label',\n 'order-asc',\n 'order-desc',\n 'min',\n 'max',\n 'pattern',\n 'title',\n 'start-value',\n 'end-value',\n 'alt',\n 'step',\n 'maxlength',\n 'minlength',\n 'search-text',\n 'search-placeholder',\n ];\n for (let attr of defaultAttributes) this.addToAttributes(`${attr}-${escapedField}`, attr, attrs)\n\n const addableAttributes: Attr[] = (Array.from(this.element.attributes) as Attr[]).filter((a: Attr) => a.name.startsWith(`addable-${escapedField}`));\n for (let attr of addableAttributes) this.addToAttributes(attr.name, attr.name.replace(`addable-${escapedField}`, 'addable'), attrs)\n\n const resourceId = resource ? resource!['@id'] : null;\n if (this.multiple(escapedField)) attrs['widget'] = this.getWidget(escapedField).tagName;\n if (this.getAction(escapedField) && resourceId) attrs['src'] = this.element.getAttribute('src-' + escapedField) || resourceId;\n if (this.editable(escapedField) && resourceId) attrs['value-id'] = resourceId;\n\n return attrs;\n },\n /**\n * Creates and return a widget for field + add it to the widget list\n * @param field - string\n */\n async createWidgetTemplate(field: string, resource = null, transformAttributes = false): Promise<TemplateResult> {\n if (this.isString(field)) return this.createString(field); // field is a static string\n if (this.isSet(field)) return await this.createSet(field);\n\n const currentResource = resource || this.resource;\n let attributes = this.widgetAttributes(field, currentResource);\n const escapedField = this.getEscapedField(field);\n const widgetMeta = this.multiple(escapedField) || this.getWidget(escapedField);\n let tagName = widgetMeta.tagName;\n let widgetTemplate = html``;\n\n // Set attributes\n let value = await this.getValue(field, currentResource);\n if (widgetMeta.type === WidgetType.NATIVE) { // native widget (ie: h1)\n widgetTemplate = preHTML`\n <${tagName}\n name=\"${ifDefined(attributes.name)}\"\n class=\"${ifDefined(attributes.class)}\"\n >${value}</${tagName}>\n `;\n } else { // custom widget (ie: solid-display-value)\n // Check if value is defined, and if the default widget is needed\n if ((value === null || value === '') && this.element.hasAttribute('default-widget-' + field)) {\n tagName = this.element.getAttribute('default-widget-' + field);\n }\n // Set attributes to the widget\n // setAttribute set a string. Make sure null values are empty\n if (value === null || value === undefined) attributes.value = '';\n if (widgetMeta.type === WidgetType.USER && value['@id']) { // if value is a resource and solid-widget used, set data-src\n attributes['data-src'] = value['@id'];\n } else { // otherwise, set value attribute\n attributes['value'] = value;\n }\n\n // Subscribe widgets if they show a resource\n if (value && value['@id']) attributes['auto-subscribe'] = value['@id'];\n\n // Transform store://XXX attributes\n if (transformAttributes) attributes = await this.transformAttributes(attributes, currentResource);\n\n widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n }\n\n this.nameWidgets.push(field);\n return widgetTemplate;\n },\n defineAttribute(widget: HTMLElement, attribute: string, value: any) {\n if (widget.getAttribute(attribute) !== value) { // if attribute is different than previous one\n widget.setAttribute(attribute, value); // set it\n }\n },\n /**\n * Create a set and add fields to it\n * @param field - string\n */\n async createSet(field: string): Promise<TemplateResult> {\n const setWidget = this.getWidget(field, true);\n\n // Get set attributes\n const attrs = { name: field };\n const setAttributes = [\n 'class',\n 'label'\n ];\n for (let attr of setAttributes) this.addToAttributes(`${attr}-${field}`, attr, attrs);\n\n // Create widget if not already existing\n let widget = this.element.querySelector(`${setWidget.tagName}[name=\"${field}\"]`);\n let initializing = false; // used to render widget only first time\n if (!widget) {\n widget = document.createElement(setWidget.tagName);\n initializing = true;\n }\n for (let name of Object.keys(attrs)) {\n this.defineAttribute(widget, name, attrs[name], setWidget.type);\n }\n if (widget.component && initializing) widget.component.render();\n let setFields = this.getSet(field);\n // Catch widget for the set if all these fields are empty\n if (this.element.hasAttribute('empty-' + field)) {\n let hasOnlyEmpty = true;\n for(let field of setFields) {\n let value: string = await this.getValue(field, this.resource);\n if (value !== '') { // if one not empty\n hasOnlyEmpty = false;\n continue; // break loop\n }\n };\n if(hasOnlyEmpty) { // if only empty values, return empty-widget\n const attributes = this.widgetAttributes(field, this.resource);\n const tagName = this.element.getAttribute(`empty-${field}`);\n const valueSet = this.element.getAttribute(`empty-${field}-value`);\n if (valueSet) attributes.value = valueSet;\n return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n };\n }\n\n // Render template\n const widgetsTemplate = await Promise.all(setFields.map((field: string) => this.createWidgetTemplate(field)));\n const template = html`${widgetsTemplate}`;\n render(template, widget.querySelector('[data-content]') || widget);\n return widget;\n },\n createString(value: string): TemplateResult {\n return html`\n <span>${value.slice(1, -1).replace(/\\\\(['\"])/g, '$1')}</span>\n `;\n },\n /**\n * Returns field name without starting \"@\"\n * @param field\n */\n getEscapedField(field: string): string {\n return field.startsWith('@') ? field.slice(1, field.length) : field;\n }\n}\n\nexport {\n WidgetMixin\n}"]}
|
|
1
|
+
{"version":3,"sources":["widgetMixin.ts"],"names":["spread","preHTML","parseFieldsString","findClosingBracketMatchIndex","newWidgetFactory","WidgetType","html","render","ifDefined","WidgetMixin","name","use","attributes","fields","type","String","default","undefined","initialState","nameWidgets","_div","created","attached","dataSrc","resource","noRender","populate","parentElement","div","document","createElement","element","appendChild","value","widgets","map","querySelector","getFields","attr","isContainer","res","console","error","Error","prop","properties","startsWith","push","getAction","field","action","getAttribute","editable","hasAttribute","getSetRegexp","RegExp","getSet","setString","match","firstSetBracket","indexOf","length","lastSetBracket","set","substring","isSet","foundSets","isString","fetchValue","getValue","escapedField","getEscapedField","resourceValue","empty","widgetFromTagName","tagName","CUSTOM","USER","customElements","get","NATIVE","getWidget","widget","defaultWidget","defaultSetWidget","multiple","attribute","defaultMultipleWidget","addToAttributes","lookForAttr","setAttrKey","widgetAttributes","attrs","multipleAttributes","defaultAttributes","addableAttributes","Array","from","filter","a","replace","resourceId","createWidgetTemplate","transformAttributes","createString","createSet","currentResource","widgetMeta","widgetTemplate","class","defineAttribute","setAttribute","setWidget","setAttributes","initializing","Object","keys","component","setFields","hasOnlyEmpty","valueSet","widgetsTemplate","Promise","all","template","slice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAT,EAAiBC,OAAjB,QAAgC,qBAAhC;AACA,SAASC,iBAAT,EAA4BC,4BAA5B,QAAgE,iBAAhE;AACA,SAASC,gBAAT,QAAiC,mCAAjC;AACA,SAA0BC,UAA1B,QAAsD,cAAtD;AACA,SAASC,IAAT,EAAeC,MAAf,QAA6C,UAA7C;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,MAAMC,WAAW,GAAG;AAClBC,EAAAA,IAAI,EAAE,cADY;AAElBC,EAAAA,GAAG,EAAE,EAFa;AAGlBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAEC,MADA;AAENC,MAAAA,OAAO,EAAEC;AAFH;AADE,GAHM;AASlBC,EAAAA,YAAY,EAAE;AACZC,IAAAA,WAAW,EAAE,IADD;AAEZC,IAAAA,IAAI,EAAE;AAFM,GATI;;AAalBC,EAAAA,OAAO,GAAS;AACd,SAAKF,WAAL,GAAmB,EAAnB;AACD,GAfiB;;AAgBlBG,EAAAA,QAAQ,GAAS;AACf,QAAI,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CAAec,KAAD,IAAmB,KAAKqD,oBAAL,CAA0BrD,KAA1B,CAAjC,CAAZ,CAA9B;AACA,UAAM2E,QAAQ,GAAGtH,IAAH,qBAAUmH,eAAV,CAAd;AACAlH,IAAAA,MAAM,CAACqH,QAAD,EAAW1C,MAAM,CAAC9C,aAAP,CAAqB,gBAArB,KAA0C8C,MAArD,CAAN;AACA,WAAOA,MAAP;AACD,GAlWiB;;AAmWlBsB,EAAAA,YAAY,CAACvE,KAAD,EAAgC;AAC1C,WAAO3B,IAAP,qBACU2B,KAAK,CAAC4F,KAAN,CAAY,CAAZ,EAAe,CAAC,CAAhB,EAAmBzB,OAAnB,CAA2B,WAA3B,EAAwC,IAAxC,CADV;AAGD,GAvWiB;;AAwWlB;AACF;AACA;AACA;AACE7B,EAAAA,eAAe,CAACtB,KAAD,EAAwB;AACrC,WAAOA,KAAK,CAACH,UAAN,CAAiB,GAAjB,IAAwBG,KAAK,CAAC4E,KAAN,CAAY,CAAZ,EAAe5E,KAAK,CAACY,MAArB,CAAxB,GAAuDZ,KAA9D;AACD;;AA9WiB,CAApB;AAiXA,SACExC,WADF","sourcesContent":["import { spread, preHTML } from '../libs/lit-helpers';\nimport { parseFieldsString, findClosingBracketMatchIndex } from '../libs/helpers';\nimport { newWidgetFactory } from '../new-widgets/new-widget-factory';\nimport { WidgetInterface, WidgetType, Resource } from './interfaces';\nimport { html, render, TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst WidgetMixin = {\n name: 'widget-mixin',\n use: [],\n attributes: {\n fields: {\n type: String,\n default: undefined,\n }\n },\n initialState: {\n nameWidgets: null,\n _div: null\n },\n created(): void {\n this.nameWidgets = [];\n },\n attached(): void {\n if (!this.dataSrc && !this.resource && this.noRender === null) this.populate();\n },\n get parentElement(): string {\n return 'div';\n },\n get div(): HTMLElement {\n if (this._div) return this._div;\n this._div = document.createElement(this.parentElement);\n this.element.appendChild(this._div);\n return this._div;\n },\n set div(value) {\n this._div = value\n },\n get widgets() {\n return this.nameWidgets.map((name: string) => this.element.querySelector(`[name=\"${name}\"]`));\n },\n /**\n * Return field list of the component\n */\n async getFields(): Promise<string[]>{ // TODO : improve code\n const attr = this.fields;\n if (attr === '') return [];\n if (attr) return parseFieldsString(attr);\n\n let resource = this.resource as Resource;\n if (resource && resource.isContainer()) { // If container, keep the 1rst resource\n for (let res of resource['ldp:contains']) {\n resource = res;\n break;\n }\n }\n\n if (!this.dataSrc) console.error(new Error('You must provide a \"fields\" attribute'));\n if(!resource) return [];\n\n let fields: string[] = [];\n for (const prop of resource.properties) {\n if ((!prop.startsWith('@') && !(prop === \"permissions\")) && await resource[prop]) fields.push(prop);\n }\n return fields;\n },\n /**\n * return attribute if \"field\" is an action\n * @param field - string\n */\n getAction(field: string): string {\n const action = this.element.getAttribute('action-' + field);\n return action;\n },\n /**\n * return true if \"field\" is editable\n * @param field - string\n */\n editable(field: string): string {\n return this.element.hasAttribute('editable-' + field);\n },\n /**\n * Return regexp to check if \"field\" is a set\n * @param field - string\n */\n getSetRegexp(field: string) {\n return new RegExp(`(^|\\\\,|\\\\(|\\\\s)\\\\s*${field}\\\\s*\\\\(`, 'g')\n },\n /**\n * Return fields contained in set \"field\"\n * @param field - string\n */\n getSet(field: string): string[] {\n const setString = this.fields.match(this.getSetRegexp(field));\n if (!setString) return [];\n const firstSetBracket = this.fields.indexOf(setString[0]) + (setString[0].length) - 1;\n const lastSetBracket = findClosingBracketMatchIndex(this.fields, firstSetBracket);\n const set = this.fields.substring(firstSetBracket + 1, lastSetBracket);\n return parseFieldsString(set);\n },\n /**\n * Return true if \"field\" is a set\n * @param field - string\n */\n isSet(field: string): boolean {\n if (!this.fields) return false;\n let foundSets = this.fields.match(this.getSetRegexp(field));\n return foundSets ? foundSets.length > 0 : false;\n },\n isString(field: string): boolean {\n return field.startsWith('\\'') || field.startsWith('\\\"');\n },\n /**\n * Return the value of \"resource\" for predicate \"field\"\n * @param field - string\n * @param resource - Resource\n */\n async fetchValue(field: string, resource: Resource) {\n return resource && !resource.isContainer() ? await resource[field] : undefined;\n },\n /**\n * Return the value of the field\n * @param field - field\n */\n async getValue(field: string, resource: Resource) {\n const escapedField = this.getEscapedField(field);\n if (this.getAction(escapedField)) {\n return this.getAction(escapedField);\n }\n if (this.element.hasAttribute('value-' + field)) {\n return this.element.getAttribute('value-' + field);\n }\n let resourceValue = await this.fetchValue(field, resource);\n\n // Empty value\n if (resourceValue === undefined || resourceValue === '' || resourceValue === null) // If null or empty, return field default value\n return this.element.hasAttribute('default-' + field) ?\n this.element.getAttribute('default-' + field) : '';\n\n return resourceValue;\n },\n empty(): void {},\n /**\n * Return a widget from a tagName, and create it if necessary\n * @param tagName - string\n */\n widgetFromTagName(tagName: string) {\n let type = tagName.startsWith('solid') ? WidgetType.CUSTOM : WidgetType.USER;\n if (!customElements.get(tagName)) { // component does not exist\n if (tagName.startsWith('solid')) newWidgetFactory(tagName); // solid- -> create it\n else type = WidgetType.NATIVE; // or use a native tag\n }\n return { tagName, type }; // return tagName\n },\n /**\n * Return widget for field \"field\"\n * @param field - string\n * @param isSet - boolean\n */\n getWidget(field: string, isSet: boolean = false): WidgetInterface {\n const widget = this.element.getAttribute('widget-' + field);\n\n if (widget) return this.widgetFromTagName(widget);\n if (this.getAction(field)) return this.widgetFromTagName('solid-action');\n\n return !isSet ? this.widgetFromTagName(this.defaultWidget) : this.widgetFromTagName(this.defaultSetWidget);\n },\n /**\n * Return multiple widget if \"field\" is a multiple, false if it's not\n * @param field - string\n */\n multiple(field: string): WidgetInterface|null {\n const attribute = 'multiple-' + field;\n if (!this.element.hasAttribute(attribute)) return null;\n const widget = this.element.getAttribute(attribute) || this.defaultMultipleWidget;\n return this.widgetFromTagName(widget);\n },\n /**\n * If attribute \"lookForAttr\" is set on element, add \"attrKey\" to the \"attributes\" list\n * @param lookForAttr - string\n * @param setAttrKey - string\n * @param attributes - object\n */\n addToAttributes(lookForAttr: string, setAttrKey: string, attributes: object) {\n const attribute = this.element.getAttribute(lookForAttr);\n if (attribute == null) return;\n attributes[setAttrKey] = attribute;\n },\n /**\n * Return all the attributes of widget \"field\"\n * @param field - string\n * @param resource - Resource\n */\n widgetAttributes(field: string, resource: Resource): object {\n const attrs = { name: field };\n const escapedField = this.getEscapedField(field);\n\n // transfer all multiple-[field]-[attr] attributes as [attr] for multiple widget [field]\n const multipleAttributes = [\n 'fields',\n 'label',\n 'widget',\n 'add-label',\n 'remove-label',\n 'next', \n 'empty-widget',\n 'add-class',\n 'remove-class'\n ];\n for (let attr of multipleAttributes) this.addToAttributes(`multiple-${escapedField}-${attr}`, attr, attrs)\n\n // transfer all [attr]-[field] attributes as [attr] attribute for widget [field]\n const defaultAttributes = [\n 'range',\n 'enum',\n 'label',\n 'placeholder',\n 'class',\n /* 'widget', */,\n 'required',\n 'editable',\n 'autocomplete',\n 'upload-url',\n 'option-label',\n 'option-value',\n 'order-by', // deprecated. Remove in 0.15\n 'each-label',\n 'order-asc',\n 'order-desc',\n 'min',\n 'max',\n 'pattern',\n 'title',\n 'start-value',\n 'end-value',\n 'alt',\n 'step',\n 'maxlength',\n 'minlength',\n 'search-text',\n 'search-placeholder',\n 'link-text',\n ];\n for (let attr of defaultAttributes) this.addToAttributes(`${attr}-${escapedField}`, attr, attrs)\n\n const addableAttributes: Attr[] = (Array.from(this.element.attributes) as Attr[]).filter((a: Attr) => a.name.startsWith(`addable-${escapedField}`));\n for (let attr of addableAttributes) this.addToAttributes(attr.name, attr.name.replace(`addable-${escapedField}`, 'addable'), attrs)\n\n const resourceId = resource ? resource!['@id'] : null;\n if (this.multiple(escapedField)) attrs['widget'] = this.getWidget(escapedField).tagName;\n if (this.getAction(escapedField) && resourceId) attrs['src'] = this.element.getAttribute('src-' + escapedField) || resourceId;\n if (this.editable(escapedField) && resourceId) attrs['value-id'] = resourceId;\n\n return attrs;\n },\n /**\n * Creates and return a widget for field + add it to the widget list\n * @param field - string\n */\n async createWidgetTemplate(field: string, resource = null, transformAttributes = false): Promise<TemplateResult> {\n if (this.isString(field)) return this.createString(field); // field is a static string\n if (this.isSet(field)) return await this.createSet(field);\n\n const currentResource = resource || this.resource;\n let attributes = this.widgetAttributes(field, currentResource);\n const escapedField = this.getEscapedField(field);\n const widgetMeta = this.multiple(escapedField) || this.getWidget(escapedField);\n let tagName = widgetMeta.tagName;\n let widgetTemplate = html``;\n\n // Set attributes\n let value = await this.getValue(field, currentResource);\n if (widgetMeta.type === WidgetType.NATIVE) { // native widget (ie: h1)\n widgetTemplate = preHTML`\n <${tagName}\n name=\"${ifDefined(attributes.name)}\"\n class=\"${ifDefined(attributes.class)}\"\n >${value}</${tagName}>\n `;\n } else { // custom widget (ie: solid-display-value)\n // Check if value is defined, and if the default widget is needed\n if ((value === null || value === '') && this.element.hasAttribute('default-widget-' + field)) {\n tagName = this.element.getAttribute('default-widget-' + field);\n }\n // Set attributes to the widget\n // setAttribute set a string. Make sure null values are empty\n if (value === null || value === undefined) attributes.value = '';\n if (widgetMeta.type === WidgetType.USER && value['@id']) { // if value is a resource and solid-widget used, set data-src\n attributes['data-src'] = value['@id'];\n } else { // otherwise, set value attribute\n attributes['value'] = value;\n }\n\n // Subscribe widgets if they show a resource\n if (value && value['@id']) attributes['auto-subscribe'] = value['@id'];\n\n // Transform store://XXX attributes\n if (transformAttributes) attributes = await this.transformAttributes(attributes, currentResource);\n\n widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n }\n\n this.nameWidgets.push(field);\n return widgetTemplate;\n },\n defineAttribute(widget: HTMLElement, attribute: string, value: any) {\n if (widget.getAttribute(attribute) !== value) { // if attribute is different than previous one\n widget.setAttribute(attribute, value); // set it\n }\n },\n /**\n * Create a set and add fields to it\n * @param field - string\n */\n async createSet(field: string): Promise<TemplateResult> {\n const setWidget = this.getWidget(field, true);\n\n // Get set attributes\n const attrs = { name: field };\n const setAttributes = [\n 'class',\n 'label'\n ];\n for (let attr of setAttributes) this.addToAttributes(`${attr}-${field}`, attr, attrs);\n\n // Create widget if not already existing\n let widget = this.element.querySelector(`${setWidget.tagName}[name=\"${field}\"]`);\n let initializing = false; // used to render widget only first time\n if (!widget) {\n widget = document.createElement(setWidget.tagName);\n initializing = true;\n }\n for (let name of Object.keys(attrs)) {\n this.defineAttribute(widget, name, attrs[name], setWidget.type);\n }\n if (widget.component && initializing) widget.component.render();\n let setFields = this.getSet(field);\n // Catch widget for the set if all these fields are empty\n if (this.element.hasAttribute('empty-' + field)) {\n let hasOnlyEmpty = true;\n for(let field of setFields) {\n let value: string = await this.getValue(field, this.resource);\n if (value !== '') { // if one not empty\n hasOnlyEmpty = false;\n continue; // break loop\n }\n };\n if(hasOnlyEmpty) { // if only empty values, return empty-widget\n const attributes = this.widgetAttributes(field, this.resource);\n const tagName = this.element.getAttribute(`empty-${field}`);\n const valueSet = this.element.getAttribute(`empty-${field}-value`);\n if (valueSet) attributes.value = valueSet;\n return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;\n };\n }\n\n // Render template\n const widgetsTemplate = await Promise.all(setFields.map((field: string) => this.createWidgetTemplate(field)));\n const template = html`${widgetsTemplate}`;\n render(template, widget.querySelector('[data-content]') || widget);\n return widget;\n },\n createString(value: string): TemplateResult {\n return html`\n <span>${value.slice(1, -1).replace(/\\\\(['\"])/g, '$1')}</span>\n `;\n },\n /**\n * Returns field name without starting \"@\"\n * @param field\n */\n getEscapedField(field: string): string {\n return field.startsWith('@') ? field.slice(1, field.length) : field;\n }\n}\n\nexport {\n WidgetMixin\n}"]}
|
|
@@ -9,7 +9,7 @@ function _templateObject2() {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function _templateObject() {
|
|
12
|
-
const data = _taggedTemplateLiteral(["\n <solid-link\n data-src=", "\n next=", "\n >\n ", "\n </solid-link>\n "]);
|
|
12
|
+
const data = _taggedTemplateLiteral(["\n <solid-link\n data-src=", "\n next=", "\n id=", "\n link-text=", "\n >\n ", "\n </solid-link>\n "]);
|
|
13
13
|
|
|
14
14
|
_templateObject = function () {
|
|
15
15
|
return data;
|
|
@@ -22,10 +22,11 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
22
22
|
|
|
23
23
|
import { html } from '../../_snowpack/pkg/lit-html.js';
|
|
24
24
|
import { ifDefined } from '../../_snowpack/pkg/lit-html/directives/if-defined.js';
|
|
25
|
+
import { LinkTextMixin } from '../templatesDependencies/linkTextMixin.js';
|
|
25
26
|
export const defaultTemplates = {
|
|
26
27
|
action: {
|
|
27
|
-
template: (value, attributes) => html(_templateObject(), ifDefined(attributes.src), ifDefined(value), attributes.
|
|
28
|
-
dependencies: []
|
|
28
|
+
template: (value, attributes) => html(_templateObject(), ifDefined(attributes.src), ifDefined(value), ifDefined(attributes.id), ifDefined(attributes.linkText), attributes.linkText == null ? attributes.name || '' : attributes.linkText),
|
|
29
|
+
dependencies: [LinkTextMixin]
|
|
29
30
|
},
|
|
30
31
|
multiple: {
|
|
31
32
|
template: (value, attributes) => html(_templateObject2(), value || '', ifDefined(attributes.fields), ifDefined(attributes.next), ifDefined(attributes.emptyWidget)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["defaultTemplatesDirectory.ts"],"names":["html","ifDefined","defaultTemplates","action","template","value","attributes","src","
|
|
1
|
+
{"version":3,"sources":["defaultTemplatesDirectory.ts"],"names":["html","ifDefined","LinkTextMixin","defaultTemplates","action","template","value","attributes","src","id","linkText","name","dependencies","multiple","fields","next","emptyWidget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,IAAT,QAAqB,UAArB;AACA,SAASC,SAAT,QAA0B,gCAA1B;AACA,SAASC,aAAT,QAA8B,wCAA9B;AAEA,OAAO,MAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,MAAM,EAAE;AACNC,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAgBC,UAAhB,KAAoCP,IAApC,oBAEKC,SAAS,CAACM,UAAU,CAACC,GAAZ,CAFd,EAGCP,SAAS,CAACK,KAAD,CAHV,EAIDL,SAAS,CAACM,UAAU,CAACE,EAAZ,CAJR,EAKMR,SAAS,CAACM,UAAU,CAACG,QAAZ,CALf,EAOJH,UAAU,CAACG,QAAX,IAAuB,IAAvB,GAA+BH,UAAU,CAACI,IAAX,IAAmB,EAAlD,GAAwDJ,UAAU,CAACG,QAP/D,CADJ;AAWNE,IAAAA,YAAY,EAAE,CAACV,aAAD;AAXR,GADsB;AAc9BW,EAAAA,QAAQ,EAAE;AACRR,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAgBC,UAAhB,KAAoCP,IAApC,qBAEKM,KAAK,IAAI,EAFd,EAGGL,SAAS,CAACM,UAAU,CAACO,MAAZ,CAHZ,EAICb,SAAS,CAACM,UAAU,CAACQ,IAAZ,CAJV,EAKSd,SAAS,CAACM,UAAU,CAACS,WAAZ,CALlB,CADF;AASRJ,IAAAA,YAAY,EAAE;AATN;AAdoB,CAAzB","sourcesContent":["import { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { LinkTextMixin } from '../templatesDependencies/linkTextMixin';\n\nexport const defaultTemplates = {\n action: {\n template: (value: string, attributes: any) => html`\n <solid-link\n data-src=${ifDefined(attributes.src)}\n next=${ifDefined(value)}\n id=${ifDefined(attributes.id)}\n link-text=${ifDefined(attributes.linkText)}\n >\n ${attributes.linkText == null ? (attributes.name || '') : attributes.linkText}\n </solid-link>\n `,\n dependencies: [LinkTextMixin]\n },\n multiple: {\n template: (value: string, attributes: any) => html`\n <solid-display\n data-src=${value || ''}\n fields=${ifDefined(attributes.fields)}\n next=${ifDefined(attributes.next)}\n empty-widget=${ifDefined(attributes.emptyWidget)}\n ></solid-display>\n `,\n dependencies: []\n },\n}\n"]}
|
|
@@ -29,7 +29,7 @@ function _templateObject4() {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function _templateObject3() {
|
|
32
|
-
const data = _taggedTemplateLiteral(["\n <a\n name=", "\n href=", "\n target=", "\n ?data-editable=", "\n >\n ", "\n </a>\n "]);
|
|
32
|
+
const data = _taggedTemplateLiteral(["\n <a\n name=", "\n href=", "\n target=", "\n ?data-editable=", "\n id=", "\n link-text=", "\n >\n ", "\n </a>\n "]);
|
|
33
33
|
|
|
34
34
|
_templateObject3 = function () {
|
|
35
35
|
return data;
|
|
@@ -62,6 +62,7 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
62
62
|
|
|
63
63
|
import { EditableMixin } from '../templatesDependencies/editableMixin.js';
|
|
64
64
|
import { AltMixin } from '../templatesDependencies/altMixin.js';
|
|
65
|
+
import { LinkTextMixin } from '../templatesDependencies/linkTextMixin.js';
|
|
65
66
|
import { html } from '../../_snowpack/pkg/lit-html.js';
|
|
66
67
|
import { ifDefined } from '../../_snowpack/pkg/lit-html/directives/if-defined.js';
|
|
67
68
|
export const displayTemplates = {
|
|
@@ -74,8 +75,8 @@ export const displayTemplates = {
|
|
|
74
75
|
dependencies: [EditableMixin]
|
|
75
76
|
},
|
|
76
77
|
link: {
|
|
77
|
-
template: (value, attributes) => html(_templateObject3(), ifDefined(attributes.name), (attributes.mailto || attributes.tel || '') + (value || '#'), ifDefined(attributes.target), attributes.editable, attributes.
|
|
78
|
-
dependencies: [EditableMixin]
|
|
78
|
+
template: (value, attributes) => html(_templateObject3(), ifDefined(attributes.name), (attributes.mailto || attributes.tel || '') + (value || '#'), ifDefined(attributes.target), attributes.editable, ifDefined(attributes.id), ifDefined(attributes.linkText), attributes.linkText || value || ''),
|
|
79
|
+
dependencies: [EditableMixin, LinkTextMixin]
|
|
79
80
|
},
|
|
80
81
|
img: {
|
|
81
82
|
template: (value, attributes) => html(_templateObject4(), ifDefined(attributes.name), ifDefined(value), ifDefined(attributes.alt)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["displayTemplatesDirectory.ts"],"names":["EditableMixin","AltMixin","html","ifDefined","displayTemplates","value","template","dependencies","div","attributes","name","editable","link","mailto","tel","target","
|
|
1
|
+
{"version":3,"sources":["displayTemplatesDirectory.ts"],"names":["EditableMixin","AltMixin","LinkTextMixin","html","ifDefined","displayTemplates","value","template","dependencies","div","attributes","name","editable","link","mailto","tel","target","id","linkText","img","alt","boolean","label"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,aAAT,QAA8B,wCAA9B;AACA,SAASC,QAAT,QAAyB,mCAAzB;AACA,SAASC,aAAT,QAA8B,wCAA9B;AAEA,SAASC,IAAT,QAAqB,UAArB;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,OAAO,MAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAGD,KAAD,IAAmBH,IAAnB,oBAA0BG,KAA1B,CADL;AAELE,IAAAA,YAAY,EAAE;AAFT,GADuB;AAK9BC,EAAAA,GAAG,EAAE;AACHF,IAAAA,QAAQ,EAAE,CAACD,KAAD,EAAgBI,UAAhB,KAAoCP,IAApC,qBAECC,SAAS,CAACM,UAAU,CAACC,IAAZ,CAFV,EAGWD,UAAU,CAACE,QAHtB,EAKJN,KALI,CADP;AASHE,IAAAA,YAAY,EAAE,CAAER,aAAF;AATX,GALyB;AAgB9Ba,EAAAA,IAAI,EAAE;AACJN,IAAAA,QAAQ,EAAE,CAACD,KAAD,EAAgBI,UAAhB,KAAoCP,IAApC,qBAECC,SAAS,CAACM,UAAU,CAACC,IAAZ,CAFV,EAGC,CAACD,UAAU,CAACI,MAAX,IAAqBJ,UAAU,CAACK,GAAhC,IAAuC,EAAxC,KAA6CT,KAAK,IAAI,GAAtD,CAHD,EAIGF,SAAS,CAACM,UAAU,CAACM,MAAZ,CAJZ,EAKWN,UAAU,CAACE,QALtB,EAMDR,SAAS,CAACM,UAAU,CAACO,EAAZ,CANR,EAOMb,SAAS,CAACM,UAAU,CAACQ,QAAZ,CAPf,EASJR,UAAU,CAACQ,QAAX,IAAuBZ,KAAvB,IAAgC,EAT5B,CADN;AAaJE,IAAAA,YAAY,EAAE,CAAER,aAAF,EAAkBE,aAAlB;AAbV,GAhBwB;AA+B9BiB,EAAAA,GAAG,EAAE;AACHZ,IAAAA,QAAQ,EAAE,CAACD,KAAD,EAAgBI,UAAhB,KAAoCP,IAApC,qBAECC,SAAS,CAACM,UAAU,CAACC,IAAZ,CAFV,EAGAP,SAAS,CAACE,KAAD,CAHT,EAIAF,SAAS,CAACM,UAAU,CAACU,GAAZ,CAJT,CADP;AASHZ,IAAAA,YAAY,EAAE,CAACP,QAAD;AATX,GA/ByB;AA0C9BoB,EAAAA,OAAO,EAAE;AACPd,IAAAA,QAAQ,EAAE,CAACD,KAAD,EAAgBI,UAAhB,KAAoCP,IAApC,qBACNG,KAAK,KAAK,MAAV,GAAmBH,IAAnB,qBAAiCO,UAAU,CAACY,KAAX,IAAoBZ,UAAU,CAACC,IAA/B,IAAuC,EAAxE,IAAuF,EADjF,CADH;AAIPH,IAAAA,YAAY,EAAE;AAJP;AA1CqB,CAAzB","sourcesContent":["import { EditableMixin } from '../templatesDependencies/editableMixin';\nimport { AltMixin } from '../templatesDependencies/altMixin';\nimport { LinkTextMixin } from '../templatesDependencies/linkTextMixin';\n\nimport { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const displayTemplates = {\n value: {\n template: (value: string) => html`${value}`,\n dependencies: []\n },\n div: {\n template: (value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n ?data-editable=${attributes.editable}\n >\n ${value}\n </div>\n `,\n dependencies: [ EditableMixin ]\n },\n link: {\n template: (value: string, attributes: any) => html`\n <a\n name=${ifDefined(attributes.name)}\n href=${(attributes.mailto || attributes.tel || '')+(value || '#')}\n target=${ifDefined(attributes.target)}\n ?data-editable=${attributes.editable}\n id=${ifDefined(attributes.id)}\n link-text=${ifDefined(attributes.linkText)}\n >\n ${attributes.linkText || value || ''}\n </a>\n `,\n dependencies: [ EditableMixin, LinkTextMixin ]\n },\n img: {\n template: (value: string, attributes: any) => html`\n <img\n name=${ifDefined(attributes.name)}\n src=${ifDefined(value)}\n alt=${ifDefined(attributes.alt)}\n style=\"max-width: 100%; max-height: 100%;\"\n />\n `,\n dependencies: [AltMixin]\n },\n boolean: {\n template: (value: string, attributes: any) => html`\n ${value === 'true' ? html`<label>${attributes.label || attributes.name || ''}</label>` : ''}\n `,\n dependencies: []\n },\n}\n"]}
|
|
@@ -79,7 +79,7 @@ function _templateObject22() {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function _templateObject21() {
|
|
82
|
-
const data = _taggedTemplateLiteral(["\n <div data-index=", ">\n ", "\n <button type=\"button\" @click=", ">", "</button>\n </div>\n "]);
|
|
82
|
+
const data = _taggedTemplateLiteral(["\n <div data-index=", ">\n ", "\n <button type=\"button\" class=", " @click=", ">", "</button>\n </div>\n "]);
|
|
83
83
|
|
|
84
84
|
_templateObject21 = function () {
|
|
85
85
|
return data;
|
|
@@ -89,7 +89,7 @@ function _templateObject21() {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function _templateObject20() {
|
|
92
|
-
const data = _taggedTemplateLiteral(["\n ", "\n <button type=\"button\" @click=", ">", "</button>\n "]);
|
|
92
|
+
const data = _taggedTemplateLiteral(["\n ", "\n <button type=\"button\" class=", " @click=", ">", "</button>\n "]);
|
|
93
93
|
|
|
94
94
|
_templateObject20 = function () {
|
|
95
95
|
return data;
|
|
@@ -358,7 +358,7 @@ export const formTemplates = {
|
|
|
358
358
|
dependencies: [MultipleselectFormMixin, FormMixin]
|
|
359
359
|
},
|
|
360
360
|
multiple: {
|
|
361
|
-
template: (_value, attributes) => html(_templateObject20(), (attributes.children || []).map((child, index) => html(_templateObject21(), attributes.name + index, child, () => attributes.removeItem(index), attributes.removeLabel)), attributes.addItem, attributes.addLabel),
|
|
361
|
+
template: (_value, attributes) => html(_templateObject20(), (attributes.children || []).map((child, index) => html(_templateObject21(), attributes.name + index, child, ifDefined(attributes.removeClass), () => attributes.removeItem(index), attributes.removeLabel)), ifDefined(attributes.addClass), attributes.addItem, attributes.addLabel),
|
|
362
362
|
dependencies: [MultipleFormMixin, FormMixin]
|
|
363
363
|
},
|
|
364
364
|
multipleselect: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["formTemplatesDirectory.ts"],"names":["FormMixin","FormCheckboxMixin","FormMinMaxMixin","FormNumberMixin","FormDropdownMixin","FormCheckboxesMixin","FormRadioMixin","FormFileMixin","MultipleFormMixin","MultipleselectFormMixin","RangeMixin","FilterRangeFormMixin","ValueRichtextMixin","PatternMixin","FormStepMixin","FormLengthMixin","html","ifDefined","formTemplates","text","template","value","attributes","placeholder","name","id","pattern","title","required","autocomplete","maxlength","minlength","onChange","dependencies","textarea","checkbox","label","date","_value","originalValue","rangedate","startValue","endValue","number","min","max","step","rangenumber","hidden","dropdown","multiple","range","map","el","selectedValue","values","includes","Object","entries","enum","key","val","radio","multicheckbox","checkboxes","orderAsc","orderDesc","children","child","index","removeItem","removeLabel","addItem","addLabel","multipleselect","file","fileValue","selectFile","resetButtonHidden","resetFile","output","image","richtext","color","email","password","time"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,SAAT,QAA0B,oCAA1B;AACA,SAASC,iBAAT,QAAkC,4CAAlC;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,iBAAT,QAAkC,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Z,CAPT,EAQA3B,SAAS,CAACK,UAAU,CAACuB,GAAZ,CART,EASC5B,SAAS,CAACK,UAAU,CAACwB,IAAZ,CATV,EAUMxB,UAAU,CAACM,QAVjB,EAYIN,UAAU,CAACU,QAZf,CADN;AAgBJC,IAAAA,YAAY,EAAE,CAAEjC,SAAF,EAAaE,eAAb,EAA8BY,aAA9B;AAhBV;AAnYqB,CAAtB","sourcesContent":["import { FormMixin } from '../templatesDependencies/formMixin';\nimport { FormCheckboxMixin } from '../templatesDependencies/formCheckboxMixin';\nimport { FormMinMaxMixin } from '../templatesDependencies/formMinMaxMixin';\nimport { FormNumberMixin } from '../templatesDependencies/formNumberMixin';\nimport { FormDropdownMixin } from '../templatesDependencies/formDropdownMixin';\nimport { FormCheckboxesMixin } from '../templatesDependencies/formCheckboxesMixin';\nimport { FormRadioMixin } from '../templatesDependencies/formRadioMixin';\nimport { FormFileMixin } from '../templatesDependencies/formFileMixin';\nimport { MultipleFormMixin } from '../templatesDependencies/multipleFormMixin';\nimport { MultipleselectFormMixin } from '../templatesDependencies/multipleselectFormMixin';\nimport { RangeMixin } from '../templatesDependencies/rangeMixin';\nimport { FilterRangeFormMixin } from '../templatesDependencies/filterRangeFormMixin';\nimport { ValueRichtextMixin } from '../templatesDependencies/valueRichtextMixin';\nimport { PatternMixin } from '../templatesDependencies/patternMixin';\nimport { FormStepMixin } from '../templatesDependencies/formStepMixin';\nimport { FormLengthMixin } from '../templatesDependencies/formLengthMixin';\n\nimport { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const formTemplates = {\n text: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"text\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value || ''}\n pattern=${ifDefined(attributes.pattern)}\n title=${ifDefined(attributes.title)}\n ?required=${attributes.required}\n autocomplete=${ifDefined(attributes.autocomplete)}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, PatternMixin, FormLengthMixin ]\n },\n textarea: {\n template: (value: string, attributes: any) => html`\n <textarea\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n placeholder=${ifDefined(attributes.placeholder)}\n data-holder\n ?required=${attributes.required}\n autocomplete=${ifDefined(attributes.autocomplete)}\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n >${value}</textarea>\n `,\n dependencies: [ FormMixin, FormLengthMixin ]\n },\n checkbox: {\n template: (value: string, attributes: any) => html`\n <label>\n <input\n data-holder\n type=\"checkbox\"\n name=${ifDefined(attributes.name)}\n ?required=${attributes.required}\n ?checked=${value === 'true'}\n @change=${attributes.onChange}\n >\n <div>${attributes.label || attributes.name}</div>\n </label>\n `,\n dependencies: [ FormCheckboxMixin, FormMixin ]\n },\n date: {\n template: (_value: string, attributes: any) => html`\n <input\n type=\"date\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n ?required=${attributes.required}\n value=${ifDefined(attributes.originalValue)}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n rangedate: {\n template: (_value: string, attributes: any) => html`\n <input\n data-holder\n type=\"date\"\n name=\"${attributes.name || ''}-start\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.startValue)}\n />\n <input\n data-holder\n type=\"date\"\n name=\"${attributes.name || ''}-end\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.endValue)}\n />\n `,\n dependencies: [ FilterRangeFormMixin, FormMixin ]\n },\n number: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"number\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value}\n min=${ifDefined(attributes.min)}\n max=${ifDefined(attributes.max)}\n step=${ifDefined(attributes.step)}\n ?required=${attributes.required}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormNumberMixin, FormMinMaxMixin, FormMixin, FormStepMixin ]\n },\n rangenumber: {\n template: (_value: string, attributes: any) => html`\n <input\n data-holder\n type=\"number\"\n name=\"${attributes.name || ''}-start\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.startValue)}\n />\n <input\n data-holder\n type=\"number\"\n name=\"${attributes.name || ''}-end\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.endValue)}\n />\n `,\n dependencies: [ FilterRangeFormMixin, FormNumberMixin, FormMixin ]\n },\n hidden: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"hidden\"\n name=${ifDefined(attributes.name)}\n value=${value}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n dropdown: {\n template: (value: string, attributes: any) => html`\n <select\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n data-holder\n ?required=${attributes.required}\n ?multiple=${attributes.multiple}\n autocomplete=${ifDefined(attributes.autocomplete)}\n @change=${attributes.onChange}\n >\n ${!(attributes.multiple || attributes.autocomplete) ? html`\n <option value=\"\" ?selected=${value === \"\"}>\n ${attributes.placeholder || '-'}\n </option>\n ` : ''}\n ${(attributes.range || []).map(el => html`\n <option\n value=${el.value}\n ?selected=${!attributes.multiple ? value === el.selectedValue : attributes.values.includes(el.selectedValue)}\n >\n ${el.label}\n </option>\n `)}\n ${Object.entries(attributes.enum || []).map(([key, val]) => html`\n <option\n value=\"${key}\"\n ?selected=${!attributes.multiple ? value === key : attributes.values.includes(key)}\n >\n ${val}\n </option>\n `)}\n </select>\n `,\n dependencies: [ FormDropdownMixin, FormMixin, RangeMixin ]\n },\n radio: {\n template: (value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n >\n ${(attributes.range || []).map(el => html`\n <label>\n <input\n type=\"radio\"\n name=${ifDefined(attributes.id)}\n value=${el.value}\n ?required=${attributes.required}\n ?checked=${value === el.selectedValue}\n > <span>${el.label}</span>\n </label>\n `)}\n ${Object.entries(attributes.enum || []).map(([key, val]) => html`\n <label>\n <input\n type=\"radio\"\n value=\"${key}\"\n name=${ifDefined(attributes.id)}\n ?required=${attributes.required}\n ?checked=${value === key}\n > <span>${val}</span>\n </label>\n `)}\n `,\n dependencies: [ FormRadioMixin, FormMixin, RangeMixin ]\n },\n multicheckbox: {\n template: (_value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n >\n ${(attributes.range || []).map(el => html`\n <label>\n <input\n type=\"checkbox\"\n value=${el.value}\n ?checked=${attributes.values.includes(el.selectedValue)}\n /> <span>${el.label}</span>\n </label>\n `)}\n ${Object.entries(attributes.enum || [])\n .map(([key, val]) => html`\n <label>\n <input type=\"checkbox\"\n value=\"${key}\"\n /> <span>${val}</span>\n </label>\n `)}\n </select>\n `,\n dependencies: [ FormCheckboxesMixin, FormMixin, RangeMixin ]\n },\n checkboxes: {\n template: (_value: string, attributes: any) => html`\n <solid-form-multicheckbox\n data-holder\n name=${ifDefined(attributes.name)}\n range=${ifDefined(attributes.range)}\n enum=${ifDefined(attributes.enum)}\n values=${ifDefined(attributes.values)}\n order-asc=${ifDefined(attributes.orderAsc)}\n order-desc=${ifDefined(attributes.orderDesc)}\n ?required=${attributes.required}\n ></solid-form-multicheckbox>\n `,\n dependencies: [ MultipleselectFormMixin, FormMixin ]\n },\n multiple: {\n template: (_value: string, attributes: any) => html`\n ${(attributes.children || []).map((child, index) => html`\n <div data-index=${attributes.name + index}>\n ${child}\n <button type=\"button\" @click=${() => attributes.removeItem(index)}>${attributes.removeLabel}</button>\n </div>\n `)}\n <button type=\"button\" @click=${attributes.addItem}>${attributes.addLabel}</button>\n `,\n dependencies: [ MultipleFormMixin, FormMixin ]\n },\n multipleselect: {\n template: (_value: string, attributes: any) => html`\n <solid-form-dropdown\n data-holder\n name=${ifDefined(attributes.name)}\n data-id=${ifDefined(attributes.id)}\n range=${ifDefined(attributes.range)}\n values=${ifDefined(attributes.values)}\n order-asc=${ifDefined(attributes.orderAsc)}\n order-desc=${ifDefined(attributes.orderDesc)}\n ?required=${attributes.required}\n multiple\n ></solid-form-dropdown>\n `,\n dependencies: [ MultipleselectFormMixin, FormMixin ]\n },\n file: {\n template: (value: string, attributes: any) => html`\n <div>\n <input\n data-holder\n type=\"text\"\n ?required=${attributes.required}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n >\n <input\n type=\"file\"\n id=${ifDefined(attributes.id)}\n value=${ifDefined(attributes.fileValue)}\n @change=${attributes.selectFile}\n />\n <button\n ?hidden=${attributes.resetButtonHidden}\n @click=${attributes.resetFile}\n >×</button>\n <span>${attributes.output}</span>\n </div>\n `,\n dependencies: [ FormFileMixin, FormMixin ]\n },\n image: {\n template: (value: string, attributes: any) => html`\n <div>\n <input\n data-holder\n type=\"text\"\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n >\n <input\n type=\"file\"\n accept=\"image/*\"\n id=${ifDefined(attributes.id)}\n value=${ifDefined(attributes.fileValue)}\n @change=${attributes.selectFile}\n />\n <img\n src=${value || ''}\n ?hidden=${value === ''}\n />\n <button\n ?hidden=${attributes.resetButtonHidden}\n @click=${attributes.resetFile}\n >×</button>\n <span>${attributes.output}</span>\n </div>\n `,\n dependencies: [ FormFileMixin, FormMixin ]\n },\n richtext: {\n template: (_value: string, attributes: any) => html`\n <div \n data-richtext\n name=${ifDefined(attributes.name)}\n data-holder\n ></div>\n `,\n dependencies: [ ValueRichtextMixin, FormMixin ]\n },\n color: {\n template: (_value: string, attributes: any) => html`\n <input\n type=\"color\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n ?required=${attributes.required}\n value=${ifDefined(attributes.originalValue)}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n email: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"email\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, FormLengthMixin ]\n },\n password: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"password\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n pattern=${ifDefined(attributes.pattern)}\n title=${ifDefined(attributes.title)}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, PatternMixin, FormLengthMixin ]\n },\n time: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"time\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value || ''}\n min=${ifDefined(attributes.min)}\n max=${ifDefined(attributes.max)}\n step=${ifDefined(attributes.step)}\n ?required=${attributes.required}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, FormMinMaxMixin, FormStepMixin ]\n },\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["formTemplatesDirectory.ts"],"names":["FormMixin","FormCheckboxMixin","FormMinMaxMixin","FormNumberMixin","FormDropdownMixin","FormCheckboxesMixin","FormRadioMixin","FormFileMixin","MultipleFormMixin","MultipleselectFormMixin","RangeMixin","FilterRangeFormMixin","ValueRichtextMixin","PatternMixin","FormStepMixin","FormLengthMixin","html","ifDefined","formTemplates","text","template","value","attributes","placeholder","name","id","pattern","title","required","autocomplete","maxlength","minlength","onChange","dependencies","textarea","checkbox","label","date","_value","originalValue","rangedate","startValue","endValue","number","min","max","step","rangenumber","hidden","dropdown","multiple","range","map","el","selectedValue","values","includes","Object","entries","enum","key","val","radio","multicheckbox","checkboxes","orderAsc","orderDesc","children","child","index","removeClass","removeItem","removeLabel","addClass","addItem","addLabel","multipleselect","file","fileValue","selectFile","resetButtonHidden","resetFile","output","image","richtext","color","email","password","time"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,SAAT,QAA0B,oCAA1B;AACA,SAASC,iBAAT,QAAkC,4CAAlC;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,iBAAT,QAAkC,4CAAlC;AACA,SAASC,mBAAT,QAAoC,8CAApC;AACA,SAASC,cAAT,QAA+B,yCAA/B;AACA,SAASC,aAAT,QAA8B,wCAA9B;AACA,SAASC,iBAAT,QAAkC,4CAAlC;AACA,SAASC,uBAAT,QAAwC,kDAAxC;AACA,SAASC,UAAT,QAA2B,qCAA3B;AACA,SAASC,oBAAT,QAAqC,+CAArC;AACA,SAASC,kBAAT,QAAmC,6CAAnC;AACA,SAASC,YAAT,QAA6B,uCAA7B;AACA,SAASC,aAAT,QAA8B,wCAA9B;AACA,SAASC,eAAT,QAAgC,0CAAhC;AAEA,SAASC,IAAT,QAAqB,UAArB;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,OAAO,MAAMC,aAAa,GAAG;AAC3BC,EAAAA,IAAI,EAAE;AACJC,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAgBC,UAAhB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AhB,KAAoCN,IAApC,sBAGQC,SAAS,CAACK,UAAU,CAACC,WAAZ,CAHjB,EAIDN,SAAS,CAACK,UAAU,CAACG,EAAZ,CAJR,EAKCR,SAAS,CAACK,UAAU,CAACE,IAAZ,CALV,EAMEH,KAAK,IAAI,EANX,EAOMC,UAAU,CAACM,QAPjB,EAQIX,SAAS,CAACK,UAAU,CAACI,OAAZ,CARb,EASET,SAAS,CAACK,UAAU,CAACK,KAAZ,CATX,EAWMV,SAAS,CAACK,UAAU,CAACQ,SAAZ,CAXf,EAYMb,SAAS,CAACK,UAAU,CAACS,SAAZ,CAZf,EAaIT,UAAU,CAACU,QAbf,CADF;AAiBRC,IAAAA,YAAY,EAAE,CAAEjC,SAAF,EAAaa,YAAb,EAA2BE,eAA3B;AAjBN,GAhXiB;AAmY3ByE,EAAAA,IAAI,EAAE;AACJpE,IAAAA,QAAQ,EAAE,CAACC,KAAD,EAAgBC,UAAhB,KAAoCN,IAApC,sBAGQC,SAAS,CAACK,UAAU,CAACC,WAAZ,CAHjB,EAICN,SAAS,CAACK,UAAU,CAACE,IAAZ,CAJV,EAKDP,SAAS,CAACK,UAAU,CAACG,EAAZ,CALR,EAMEJ,KAAK,IAAI,EANX,EAOAJ,SAAS,CAACK,UAAU,CAACsB,GAAZ,CAPT,EAQA3B,SAAS,CAACK,UAAU,CAACuB,GAAZ,CART,EASC5B,SAAS,CAACK,UAAU,CAACwB,IAAZ,CATV,EAUMxB,UAAU,CAACM,QAVjB,EAYIN,UAAU,CAACU,QAZf,CADN;AAgBJC,IAAAA,YAAY,EAAE,CAAEjC,SAAF,EAAaE,eAAb,EAA8BY,aAA9B;AAhBV;AAnYqB,CAAtB","sourcesContent":["import { FormMixin } from '../templatesDependencies/formMixin';\nimport { FormCheckboxMixin } from '../templatesDependencies/formCheckboxMixin';\nimport { FormMinMaxMixin } from '../templatesDependencies/formMinMaxMixin';\nimport { FormNumberMixin } from '../templatesDependencies/formNumberMixin';\nimport { FormDropdownMixin } from '../templatesDependencies/formDropdownMixin';\nimport { FormCheckboxesMixin } from '../templatesDependencies/formCheckboxesMixin';\nimport { FormRadioMixin } from '../templatesDependencies/formRadioMixin';\nimport { FormFileMixin } from '../templatesDependencies/formFileMixin';\nimport { MultipleFormMixin } from '../templatesDependencies/multipleFormMixin';\nimport { MultipleselectFormMixin } from '../templatesDependencies/multipleselectFormMixin';\nimport { RangeMixin } from '../templatesDependencies/rangeMixin';\nimport { FilterRangeFormMixin } from '../templatesDependencies/filterRangeFormMixin';\nimport { ValueRichtextMixin } from '../templatesDependencies/valueRichtextMixin';\nimport { PatternMixin } from '../templatesDependencies/patternMixin';\nimport { FormStepMixin } from '../templatesDependencies/formStepMixin';\nimport { FormLengthMixin } from '../templatesDependencies/formLengthMixin';\n\nimport { html } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const formTemplates = {\n text: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"text\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value || ''}\n pattern=${ifDefined(attributes.pattern)}\n title=${ifDefined(attributes.title)}\n ?required=${attributes.required}\n autocomplete=${ifDefined(attributes.autocomplete)}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, PatternMixin, FormLengthMixin ]\n },\n textarea: {\n template: (value: string, attributes: any) => html`\n <textarea\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n placeholder=${ifDefined(attributes.placeholder)}\n data-holder\n ?required=${attributes.required}\n autocomplete=${ifDefined(attributes.autocomplete)}\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n >${value}</textarea>\n `,\n dependencies: [ FormMixin, FormLengthMixin ]\n },\n checkbox: {\n template: (value: string, attributes: any) => html`\n <label>\n <input\n data-holder\n type=\"checkbox\"\n name=${ifDefined(attributes.name)}\n ?required=${attributes.required}\n ?checked=${value === 'true'}\n @change=${attributes.onChange}\n >\n <div>${attributes.label || attributes.name}</div>\n </label>\n `,\n dependencies: [ FormCheckboxMixin, FormMixin ]\n },\n date: {\n template: (_value: string, attributes: any) => html`\n <input\n type=\"date\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n ?required=${attributes.required}\n value=${ifDefined(attributes.originalValue)}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n rangedate: {\n template: (_value: string, attributes: any) => html`\n <input\n data-holder\n type=\"date\"\n name=\"${attributes.name || ''}-start\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.startValue)}\n />\n <input\n data-holder\n type=\"date\"\n name=\"${attributes.name || ''}-end\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.endValue)}\n />\n `,\n dependencies: [ FilterRangeFormMixin, FormMixin ]\n },\n number: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"number\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value}\n min=${ifDefined(attributes.min)}\n max=${ifDefined(attributes.max)}\n step=${ifDefined(attributes.step)}\n ?required=${attributes.required}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormNumberMixin, FormMinMaxMixin, FormMixin, FormStepMixin ]\n },\n rangenumber: {\n template: (_value: string, attributes: any) => html`\n <input\n data-holder\n type=\"number\"\n name=\"${attributes.name || ''}-start\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.startValue)}\n />\n <input\n data-holder\n type=\"number\"\n name=\"${attributes.name || ''}-end\"\n @change=${attributes.onChange}\n value=${ifDefined(attributes.endValue)}\n />\n `,\n dependencies: [ FilterRangeFormMixin, FormNumberMixin, FormMixin ]\n },\n hidden: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"hidden\"\n name=${ifDefined(attributes.name)}\n value=${value}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n dropdown: {\n template: (value: string, attributes: any) => html`\n <select\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n data-holder\n ?required=${attributes.required}\n ?multiple=${attributes.multiple}\n autocomplete=${ifDefined(attributes.autocomplete)}\n @change=${attributes.onChange}\n >\n ${!(attributes.multiple || attributes.autocomplete) ? html`\n <option value=\"\" ?selected=${value === \"\"}>\n ${attributes.placeholder || '-'}\n </option>\n ` : ''}\n ${(attributes.range || []).map(el => html`\n <option\n value=${el.value}\n ?selected=${!attributes.multiple ? value === el.selectedValue : attributes.values.includes(el.selectedValue)}\n >\n ${el.label}\n </option>\n `)}\n ${Object.entries(attributes.enum || []).map(([key, val]) => html`\n <option\n value=\"${key}\"\n ?selected=${!attributes.multiple ? value === key : attributes.values.includes(key)}\n >\n ${val}\n </option>\n `)}\n </select>\n `,\n dependencies: [ FormDropdownMixin, FormMixin, RangeMixin ]\n },\n radio: {\n template: (value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n >\n ${(attributes.range || []).map(el => html`\n <label>\n <input\n type=\"radio\"\n name=${ifDefined(attributes.id)}\n value=${el.value}\n ?required=${attributes.required}\n ?checked=${value === el.selectedValue}\n > <span>${el.label}</span>\n </label>\n `)}\n ${Object.entries(attributes.enum || []).map(([key, val]) => html`\n <label>\n <input\n type=\"radio\"\n value=\"${key}\"\n name=${ifDefined(attributes.id)}\n ?required=${attributes.required}\n ?checked=${value === key}\n > <span>${val}</span>\n </label>\n `)}\n `,\n dependencies: [ FormRadioMixin, FormMixin, RangeMixin ]\n },\n multicheckbox: {\n template: (_value: string, attributes: any) => html`\n <div\n name=${ifDefined(attributes.name)}\n >\n ${(attributes.range || []).map(el => html`\n <label>\n <input\n type=\"checkbox\"\n value=${el.value}\n ?checked=${attributes.values.includes(el.selectedValue)}\n /> <span>${el.label}</span>\n </label>\n `)}\n ${Object.entries(attributes.enum || [])\n .map(([key, val]) => html`\n <label>\n <input type=\"checkbox\"\n value=\"${key}\"\n /> <span>${val}</span>\n </label>\n `)}\n </select>\n `,\n dependencies: [ FormCheckboxesMixin, FormMixin, RangeMixin ]\n },\n checkboxes: {\n template: (_value: string, attributes: any) => html`\n <solid-form-multicheckbox\n data-holder\n name=${ifDefined(attributes.name)}\n range=${ifDefined(attributes.range)}\n enum=${ifDefined(attributes.enum)}\n values=${ifDefined(attributes.values)}\n order-asc=${ifDefined(attributes.orderAsc)}\n order-desc=${ifDefined(attributes.orderDesc)}\n ?required=${attributes.required}\n ></solid-form-multicheckbox>\n `,\n dependencies: [ MultipleselectFormMixin, FormMixin ]\n },\n multiple: {\n template: (_value: string, attributes: any) => html`\n ${(attributes.children || []).map((child, index) => html`\n <div data-index=${attributes.name + index}>\n ${child}\n <button type=\"button\" class=${ifDefined(attributes.removeClass)} @click=${() => attributes.removeItem(index)}>${attributes.removeLabel}</button>\n </div>\n `)}\n <button type=\"button\" class=${ifDefined(attributes.addClass)} @click=${attributes.addItem}>${attributes.addLabel}</button>\n `,\n dependencies: [ MultipleFormMixin, FormMixin ]\n },\n multipleselect: {\n template: (_value: string, attributes: any) => html`\n <solid-form-dropdown\n data-holder\n name=${ifDefined(attributes.name)}\n data-id=${ifDefined(attributes.id)}\n range=${ifDefined(attributes.range)}\n values=${ifDefined(attributes.values)}\n order-asc=${ifDefined(attributes.orderAsc)}\n order-desc=${ifDefined(attributes.orderDesc)}\n ?required=${attributes.required}\n multiple\n ></solid-form-dropdown>\n `,\n dependencies: [ MultipleselectFormMixin, FormMixin ]\n },\n file: {\n template: (value: string, attributes: any) => html`\n <div>\n <input\n data-holder\n type=\"text\"\n ?required=${attributes.required}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n >\n <input\n type=\"file\"\n id=${ifDefined(attributes.id)}\n value=${ifDefined(attributes.fileValue)}\n @change=${attributes.selectFile}\n />\n <button\n ?hidden=${attributes.resetButtonHidden}\n @click=${attributes.resetFile}\n >×</button>\n <span>${attributes.output}</span>\n </div>\n `,\n dependencies: [ FormFileMixin, FormMixin ]\n },\n image: {\n template: (value: string, attributes: any) => html`\n <div>\n <input\n data-holder\n type=\"text\"\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n >\n <input\n type=\"file\"\n accept=\"image/*\"\n id=${ifDefined(attributes.id)}\n value=${ifDefined(attributes.fileValue)}\n @change=${attributes.selectFile}\n />\n <img\n src=${value || ''}\n ?hidden=${value === ''}\n />\n <button\n ?hidden=${attributes.resetButtonHidden}\n @click=${attributes.resetFile}\n >×</button>\n <span>${attributes.output}</span>\n </div>\n `,\n dependencies: [ FormFileMixin, FormMixin ]\n },\n richtext: {\n template: (_value: string, attributes: any) => html`\n <div \n data-richtext\n name=${ifDefined(attributes.name)}\n data-holder\n ></div>\n `,\n dependencies: [ ValueRichtextMixin, FormMixin ]\n },\n color: {\n template: (_value: string, attributes: any) => html`\n <input\n type=\"color\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n ?required=${attributes.required}\n value=${ifDefined(attributes.originalValue)}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin ]\n },\n email: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"email\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, FormLengthMixin ]\n },\n password: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"password\"\n placeholder=${ifDefined(attributes.placeholder)}\n id=${ifDefined(attributes.id)}\n name=${ifDefined(attributes.name)}\n value=${value || ''}\n ?required=${attributes.required}\n pattern=${ifDefined(attributes.pattern)}\n title=${ifDefined(attributes.title)}\n data-holder\n maxlength=${ifDefined(attributes.maxlength)}\n minlength=${ifDefined(attributes.minlength)}\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, PatternMixin, FormLengthMixin ]\n },\n time: {\n template: (value: string, attributes: any) => html`\n <input\n type=\"time\"\n placeholder=${ifDefined(attributes.placeholder)}\n name=${ifDefined(attributes.name)}\n id=${ifDefined(attributes.id)}\n value=${value || ''}\n min=${ifDefined(attributes.min)}\n max=${ifDefined(attributes.max)}\n step=${ifDefined(attributes.step)}\n ?required=${attributes.required}\n data-holder\n @change=${attributes.onChange}\n />\n `,\n dependencies: [ FormMixin, FormMinMaxMixin, FormStepMixin ]\n },\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const LinkTextMixin = {
|
|
2
|
+
name: 'link-text-mixin',
|
|
3
|
+
attributes: {
|
|
4
|
+
linkText: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: '',
|
|
7
|
+
callback: function (newValue) {
|
|
8
|
+
this.addToAttributes(newValue, 'linkText');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export { LinkTextMixin };
|
|
14
|
+
//# sourceMappingURL=linkTextMixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["linkTextMixin.ts"],"names":["LinkTextMixin","name","attributes","linkText","type","String","default","callback","newValue","addToAttributes"],"mappings":"AAAA,MAAMA,aAAa,GAAG;AACpBC,EAAAA,IAAI,EAAE,iBADc;AAEpBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,IAAI,EAAEC,MADE;AAERC,MAAAA,OAAO,EAAE,EAFD;AAGRC,MAAAA,QAAQ,EAAE,UAAUC,QAAV,EAA4B;AACpC,aAAKC,eAAL,CAAqBD,QAArB,EAA+B,UAA/B;AACD;AALO;AADA;AAFQ,CAAtB;AAaA,SACER,aADF","sourcesContent":["const LinkTextMixin = {\n name: 'link-text-mixin',\n attributes: {\n linkText: {\n type: String,\n default: '',\n callback: function (newValue: string) {\n this.addToAttributes(newValue, 'linkText');\n }\n },\n },\n}\n\nexport {\n LinkTextMixin\n}"]}
|
|
@@ -26,6 +26,22 @@ const MultipleFormMixin = {
|
|
|
26
26
|
range: {
|
|
27
27
|
type: String,
|
|
28
28
|
default: ''
|
|
29
|
+
},
|
|
30
|
+
addClass: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: undefined,
|
|
33
|
+
callback: function (value) {
|
|
34
|
+
if (value !== this.listAttributes['addClass']) this.listAttributes['addClass'] = value;
|
|
35
|
+
this.planRender();
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
removeClass: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: undefined,
|
|
41
|
+
callback: function (value) {
|
|
42
|
+
if (value !== this.listAttributes['removeClass']) this.listAttributes['removeClass'] = value;
|
|
43
|
+
this.planRender();
|
|
44
|
+
}
|
|
29
45
|
}
|
|
30
46
|
},
|
|
31
47
|
|
|
@@ -34,6 +50,8 @@ const MultipleFormMixin = {
|
|
|
34
50
|
this.listAttributes['children'] = [];
|
|
35
51
|
this.listAttributes['addLabel'] = this.addLabel;
|
|
36
52
|
this.listAttributes['removeLabel'] = this.removeLabel;
|
|
53
|
+
this.listAttributes['addClass'] = this.addClass;
|
|
54
|
+
this.listAttributes['removeClass'] = this.removeClass;
|
|
37
55
|
|
|
38
56
|
this.listAttributes['addItem'] = () => {
|
|
39
57
|
this.insertWidget();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["multipleFormMixin.ts"],"names":["StoreMixin","MultipleFormMixin","name","use","attributes","widget","type","String","default","addLabel","callback","value","listAttributes","planRender","removeLabel","range","created","listValueTransformations","push","setDataSrc","bind","insertWidget","index","element","querySelector","remove","dispatchEvent","Event","bubbles","dataSrc","nextProcessor","shift","populate","resource","document","createElement","Object","keys","toggleAttribute","setAttribute","empty","getValue","dataHolder","Array","from","map","getValueFromElement","multiple"],"mappings":"AAAA,SAASA,UAAT,QAA2B,yBAA3B;AAEA,MAAMC,iBAAiB,GAAG;AACxBC,EAAAA,IAAI,EAAE,qBADkB;AAExBC,EAAAA,GAAG,EAAE,CAAEH,UAAF,CAFmB;AAGxBI,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAEC,MADA;AAENC,MAAAA,OAAO,EAAE;AAFH,KADE;AAKVC,IAAAA,QAAQ,EAAE;AACRH,MAAAA,IAAI,EAAEC,MADE;AAERC,MAAAA,OAAO,EAAE,GAFD;AAGRE,MAAAA,QAAQ,EAAE,UAASC,KAAT,EAAgB;AACxB,YAAIA,KAAK,KAAK,KAAKC,cAAL,CAAoB,UAApB,CAAd,EAA+C,KAAKA,cAAL,CAAoB,UAApB,IAAkCD,KAAlC;AAC/C,aAAKE,UAAL;AACD;AANO,KALA;AAaVC,IAAAA,WAAW,EAAE;AACXR,MAAAA,IAAI,EAAEC,MADK;AAEXC,MAAAA,OAAO,EAAE,GAFE;AAGXE,MAAAA,QAAQ,EAAE,UAASC,KAAT,EAAgB;AACxB,YAAIA,KAAK,KAAK,KAAKC,cAAL,CAAoB,aAApB,CAAd,EAAkD,KAAKA,cAAL,CAAoB,aAApB,IAAqCD,KAArC;AAClD,aAAKE,UAAL;AACD;AANU,KAbH;AAqBVE,IAAAA,KAAK,EAAE;AACLT,MAAAA,IAAI,EAAEC,MADD;AAELC,MAAAA,OAAO,EAAE;AAFJ;
|
|
1
|
+
{"version":3,"sources":["multipleFormMixin.ts"],"names":["StoreMixin","MultipleFormMixin","name","use","attributes","widget","type","String","default","addLabel","callback","value","listAttributes","planRender","removeLabel","range","addClass","undefined","removeClass","created","listValueTransformations","push","setDataSrc","bind","insertWidget","index","element","querySelector","remove","dispatchEvent","Event","bubbles","dataSrc","nextProcessor","shift","populate","resource","document","createElement","Object","keys","toggleAttribute","setAttribute","empty","getValue","data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,SAAKC,UAAL;AACD,GAjGuB;;AAkGxB+B,EAAAA,QAAQ,GAAG;AACT,QAAI,CAAC,KAAKC,UAAV,EAAsB,OAAO,EAAP;AACtB,WAAOC,KAAK,CAACC,IAAN,CAAW,KAAKF,UAAhB,EAA4BG,GAA5B,CAAiCtB,OAAD,IAAkB,KAAKuB,mBAAL,CAAyBvB,OAAzB,CAAlD,CAAP;AACD,GArGuB;;AAsGxB,MAAIpB,IAAJ,GAAW;AACT,WAAO,UAAP;AACD,GAxGuB;;AAyGxB,MAAI4C,QAAJ,GAAe;AACb,WAAO,IAAP;AACD;;AA3GuB,CAA1B;AA+GA,SACEjD,iBADF","sourcesContent":["import { StoreMixin } from '../../mixins/storeMixin';\n\nconst MultipleFormMixin = {\n name: 'multiple-form-mixin',\n use: [ StoreMixin ],\n attributes: {\n widget: {\n type: String,\n default: 'solid-form-text'\n },\n addLabel: {\n type: String,\n default: '+',\n callback: function(value) {\n if (value !== this.listAttributes['addLabel']) this.listAttributes['addLabel'] = value;\n this.planRender();\n }\n },\n removeLabel: {\n type: String,\n default: '×',\n callback: function(value) {\n if (value !== this.listAttributes['removeLabel']) this.listAttributes['removeLabel'] = value;\n this.planRender();\n }\n },\n range: {\n type: String,\n default: '',\n \n },\n addClass: {\n type: String,\n default: undefined,\n callback: function(value) {\n if (value !== this.listAttributes['addClass']) this.listAttributes['addClass'] = value;\n this.planRender();\n }\n },\n removeClass: {\n type: String,\n default: undefined,\n callback: function(value) {\n if (value !== this.listAttributes['removeClass']) this.listAttributes['removeClass'] = value;\n this.planRender();\n }\n }\n },\n created() {\n this.listValueTransformations.push(this.setDataSrc.bind(this));\n\n this.listAttributes['children'] = [];\n this.listAttributes['addLabel'] = this.addLabel;\n this.listAttributes['removeLabel'] = this.removeLabel;\n this.listAttributes['addClass'] = this.addClass;\n this.listAttributes['removeClass'] = this.removeClass;\n this.listAttributes['addItem'] = () => {\n this.insertWidget();\n this.planRender();\n };\n this.listAttributes['removeItem'] = (index) => {\n this.element.querySelector(`[data-index=\"${this.name + index}\"]`).remove();\n this.element.dispatchEvent(new Event('change', {bubbles: true}));\n };\n },\n setDataSrc(value: string, listValueTransformations: Function[]) {\n if (value && value !== this.dataSrc) this.dataSrc = value;\n const nextProcessor = listValueTransformations.shift();\n if(nextProcessor) nextProcessor(value, listValueTransformations);\n },\n populate() {\n if (!this.resource || !this.resource['ldp:contains']) return;\n\n this.listAttributes['children'] = []; // reset list\n\n // set value in form\n for (let resource of this.resource['ldp:contains']) { // for each resource\n this.insertWidget(resource['@id']); // create a widget\n }\n this.planRender();\n },\n insertWidget(value: string = '') {\n if (!this.widget) return;\n const widget = document.createElement(this.widget);\n const attributes = {\n 'data-holder': true,\n 'name': this.name,\n 'value': value,\n 'range': this.range\n };\n for (let name of Object.keys(attributes)) {\n if (typeof attributes[name] === \"boolean\") widget.toggleAttribute(name, attributes[name]);\n else widget.setAttribute(name, attributes[name]);\n }\n this.listAttributes['children'].push(widget);\n },\n empty() {\n this.listAttributes['children'] = [];\n this.planRender();\n },\n getValue() {\n if (!this.dataHolder) return [];\n return Array.from(this.dataHolder).map((element: any) => this.getValueFromElement(element));\n },\n get type() {\n return 'resource';\n },\n get multiple() {\n return true;\n }\n\n}\n\nexport {\n MultipleFormMixin\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startinblox/core",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.21-beta.4",
|
|
4
4
|
"description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"babel-loader": "^8.2.2",
|
|
83
83
|
"babel-plugin-remove-import-js-extension": "0.0.3",
|
|
84
84
|
"body-parser": "^1.19.0",
|
|
85
|
-
"cypress": "^6.
|
|
85
|
+
"cypress": "^6.9.1",
|
|
86
86
|
"cypress-plugin-tab": "^1.0.5",
|
|
87
87
|
"delta-markdown-for-quill": "0.0.9",
|
|
88
88
|
"dialog-polyfill": "^0.5.6",
|