@dile/crud 1.14.4 → 1.14.6

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.
@@ -73,6 +73,7 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
73
73
  cancelIcon: { type: Object },
74
74
  disableClearAfterInsert: { type: Boolean },
75
75
  hideActions: { type: Boolean },
76
+ _loading: { state: true },
76
77
  };
77
78
  }
78
79
 
@@ -81,6 +82,7 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
81
82
  this.responseAdapter = new ResponseApiAdapter();
82
83
  this.formIdentifier = 'form';
83
84
  this.operation = '';
85
+ this._loading = false;
84
86
  }
85
87
 
86
88
  updated(changedProperties) {
@@ -95,6 +97,15 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
95
97
  this.feedback = this.shadowRoot.getElementById('feedback');
96
98
  this.ajaxsave = this.shadowRoot.getElementById('ajaxsave');
97
99
  this.ajaxget = this.shadowRoot.getElementById('ajaxget');
100
+
101
+ // Listen to ajax request start/end events for loading feedback
102
+ this.ajaxsave.addEventListener('dile-ajax-request-start', () => {
103
+ this._loading = true;
104
+ });
105
+ this.ajaxsave.addEventListener('dile-ajax-request-end', () => {
106
+ this._loading = false;
107
+ });
108
+
98
109
  if(this.setDataOnInit) {
99
110
  this.initData();
100
111
  }
@@ -144,13 +155,13 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
144
155
  return html`
145
156
  <div class="actions">
146
157
  ${this.actionIcon
147
- ? html`<a href="#" @click=${this.doActionHandler}><dile-icon .icon=${this.actionIcon} class="actionIcon"></dile-icon></a>`
148
- : html`<dile-button @click=${this.doActionHandler}>${this.actionLabelComputed(this.actionLabel, this.translations, this.operation)}</dile-button>`
158
+ ? html`<a href="#" ?disabled=${this._loading} @click=${this.doActionHandler}><dile-icon .icon=${this.actionIcon} class="actionIcon" style="opacity: ${this._loading ? 0.6 : 1}"></dile-icon></a>`
159
+ : html`<dile-button .loading=${this._loading} @click=${this.doActionHandler}>${this.actionLabelComputed(this.actionLabel, this.translations, this.operation)}</dile-button>`
149
160
  }
150
161
  ${this.showCancelButton ?
151
162
  this.cancelIcon
152
- ? html`<a href="#" @click=${this.doCancel}><dile-icon @click=${this.doActionHandler} .icon=${this.cancelIcon} class="cancelIcon"></dile-icon></a>`
153
- : html`<dile-button class="cancel_button" @click=${this.doCancel}>${this.cancelLabelComputed(this.cancelLabel, this.translations)}</dile-button>`
163
+ ? html`<a href="#" ?disabled=${this._loading} @click=${this.doCancel}><dile-icon .icon=${this.cancelIcon} class="cancelIcon" style="opacity: ${this._loading ? 0.6 : 1}"></dile-icon></a>`
164
+ : html`<dile-button .loading=${this._loading} class="cancel_button" @click=${this.doCancel}>${this.cancelLabelComputed(this.cancelLabel, this.translations)}</dile-button>`
154
165
  : ''
155
166
  }
156
167
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "1.14.4",
3
+ "version": "1.14.6",
4
4
  "description": "Components to create a generic crud system based on Web Components and Lit",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "homepage": "https://dile-components.com/",
26
26
  "dependencies": {
27
- "@dile/ui": "^2.25.6",
27
+ "@dile/ui": "^2.26.0",
28
28
  "axios": "^1.16.0",
29
29
  "lit": "^2.7.0 || ^3.0.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "a825a71cc61133f7acb7e40729cf191500d5ac0f"
34
+ "gitHead": "90ebde5b908aab4093afeee3bda87ef3ad85904e"
35
35
  }