@ulb-darmstadt/shacl-form 1.10.1 → 1.10.2
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/form-bootstrap.js +3 -3
- package/dist/form-default.js +3 -3
- package/dist/form-material.js +3 -3
- package/package.json +1 -1
- package/src/form.ts +3 -0
- package/src/property-template.ts +9 -11
- package/src/property.ts +1 -3
package/package.json
CHANGED
package/src/form.ts
CHANGED
|
@@ -44,6 +44,8 @@ export class ShaclForm extends HTMLElement {
|
|
|
44
44
|
private initialize() {
|
|
45
45
|
clearTimeout(this.initDebounceTimeout)
|
|
46
46
|
this.initDebounceTimeout = setTimeout(async () => {
|
|
47
|
+
// set loading attribute on element so that hosting app can apply special css rules
|
|
48
|
+
this.setAttribute('loading', '')
|
|
47
49
|
// remove all child elements from form and show loading indicator
|
|
48
50
|
this.form.replaceChildren(document.createTextNode(this.config.attributes.loading))
|
|
49
51
|
try {
|
|
@@ -116,6 +118,7 @@ export class ShaclForm extends HTMLElement {
|
|
|
116
118
|
errorDisplay.innerText = String(e)
|
|
117
119
|
this.form.replaceChildren(errorDisplay)
|
|
118
120
|
}
|
|
121
|
+
this.removeAttribute('loading')
|
|
119
122
|
}, 200)
|
|
120
123
|
}
|
|
121
124
|
|
package/src/property-template.ts
CHANGED
|
@@ -115,17 +115,15 @@ export class ShaclPropertyTemplate {
|
|
|
115
115
|
if (!this.label && !this.shaclAnd) {
|
|
116
116
|
this.label = this.path ? removePrefixes(this.path, this.config.prefixes) : 'unknown'
|
|
117
117
|
}
|
|
118
|
-
//
|
|
119
|
-
if (this.node
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.extendedShapes.push(node as NamedNode)
|
|
128
|
-
}
|
|
118
|
+
// register extended shapes
|
|
119
|
+
if (this.node) {
|
|
120
|
+
this.extendedShapes.push(this.node)
|
|
121
|
+
}
|
|
122
|
+
if (this.shaclAnd) {
|
|
123
|
+
const list = this.config.lists[this.shaclAnd]
|
|
124
|
+
if (list?.length) {
|
|
125
|
+
for (const node of list) {
|
|
126
|
+
this.extendedShapes.push(node as NamedNode)
|
|
129
127
|
}
|
|
130
128
|
}
|
|
131
129
|
}
|
package/src/property.ts
CHANGED
|
@@ -19,14 +19,13 @@ export class ShaclProperty extends HTMLElement {
|
|
|
19
19
|
constructor(shaclSubject: BlankNode | NamedNode, parent: ShaclNode, config: Config, valueSubject?: NamedNode | BlankNode) {
|
|
20
20
|
super()
|
|
21
21
|
this.template = new ShaclPropertyTemplate(config.store.getQuads(shaclSubject, null, null, null), parent, config)
|
|
22
|
+
this.container = this
|
|
22
23
|
if (this.template.extendedShapes.length && this.template.config.attributes.collapse !== null && (!this.template.maxCount || this.template.maxCount > 1)) {
|
|
23
24
|
const collapsible = new RokitCollapsible()
|
|
24
25
|
collapsible.classList.add('collapsible', 'shacl-group');
|
|
25
26
|
collapsible.open = config.attributes.collapse === 'open';
|
|
26
27
|
collapsible.label = this.template.label;
|
|
27
28
|
this.container = collapsible
|
|
28
|
-
} else {
|
|
29
|
-
this.container = this
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
if (this.template.order !== undefined) {
|
|
@@ -35,7 +34,6 @@ export class ShaclProperty extends HTMLElement {
|
|
|
35
34
|
if (this.template.cssClass) {
|
|
36
35
|
this.classList.add(this.template.cssClass)
|
|
37
36
|
}
|
|
38
|
-
|
|
39
37
|
if (config.editMode && !parent.linked) {
|
|
40
38
|
this.addButton = this.createAddButton()
|
|
41
39
|
this.container.appendChild(this.addButton)
|