@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulb-darmstadt/shacl-form",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "SHACL form generator",
5
5
  "main": "dist/form-default.js",
6
6
  "module": "dist/form-default.js",
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
 
@@ -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
- // resolve extended shapes
119
- if (this.node || this.shaclAnd) {
120
- if (this.node) {
121
- this.extendedShapes.push(this.node)
122
- }
123
- if (this.shaclAnd) {
124
- const list = this.config.lists[this.shaclAnd]
125
- if (list?.length) {
126
- for (const node of list) {
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)