@dile/crud 2.10.11 → 2.11.0
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.
|
@@ -139,6 +139,14 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
139
139
|
this.actionIds = [];
|
|
140
140
|
this.filtersAlwaysVisible = false;
|
|
141
141
|
this._viewMode = 'item';
|
|
142
|
+
this.keyword = '';
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
updated(changedProperties) {
|
|
146
|
+
super.updated?.(changedProperties);
|
|
147
|
+
if (changedProperties.has('keyword')) {
|
|
148
|
+
this.applyKeywordToList(this.keyword ?? '');
|
|
149
|
+
}
|
|
142
150
|
}
|
|
143
151
|
|
|
144
152
|
// GETTERS ELEMENTOS
|
|
@@ -160,6 +168,9 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
160
168
|
get sortFormElement() {
|
|
161
169
|
return this.shadowRoot.getElementById('elsort');
|
|
162
170
|
}
|
|
171
|
+
get searchInputElement() {
|
|
172
|
+
return this.shadowRoot.querySelector('dile-input-search');
|
|
173
|
+
}
|
|
163
174
|
|
|
164
175
|
// TEMPLATES
|
|
165
176
|
|
|
@@ -171,7 +182,7 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
171
182
|
: ''
|
|
172
183
|
}
|
|
173
184
|
${this.config.customization.disableInsert ? '' : this.insertButtomTemplate}
|
|
174
|
-
${this.config.customization.disableKeywordSearch ? '' : html`<dile-input-search @dile-input-search=${this.keywordChanged}></dile-input-search>`}
|
|
185
|
+
${this.config.customization.disableKeywordSearch ? '' : html`<dile-input-search .value=${this.keyword ?? ''} @dile-input-search=${this.keywordChanged}></dile-input-search>`}
|
|
175
186
|
</header>
|
|
176
187
|
|
|
177
188
|
<main>
|
|
@@ -427,7 +438,24 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
427
438
|
}
|
|
428
439
|
|
|
429
440
|
setKeyword(keyword) {
|
|
430
|
-
this.
|
|
441
|
+
this.keyword = keyword ?? '';
|
|
442
|
+
this.applyKeywordToList(this.keyword, { force: true });
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// Moves the keyword into dile-crud-list. Before the list has run its first update it
|
|
446
|
+
// only receives the value, so its initial load (DileCrudList.firstUpdated → refresh)
|
|
447
|
+
// is already filtered and no unfiltered request is made. Afterwards it triggers a new
|
|
448
|
+
// search, unless the list already has that keyword (e.g. updated() after setKeyword()).
|
|
449
|
+
applyKeywordToList(keyword, { force = false } = {}) {
|
|
450
|
+
const list = this.shadowRoot?.querySelector('dile-crud-list');
|
|
451
|
+
if (!list) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (!list.hasUpdated) {
|
|
455
|
+
list.keyword = keyword;
|
|
456
|
+
} else if (force || list.keyword !== keyword) {
|
|
457
|
+
list.setKeyword(keyword);
|
|
458
|
+
}
|
|
431
459
|
}
|
|
432
460
|
|
|
433
461
|
sortFormChanged(e) {
|
|
@@ -499,7 +527,13 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
499
527
|
|
|
500
528
|
removeFilter(e) {
|
|
501
529
|
if(e.detail.name == 'keyword') {
|
|
502
|
-
this.
|
|
530
|
+
const searchInput = this.searchInputElement;
|
|
531
|
+
if (searchInput?.value) {
|
|
532
|
+
// clear() emits dile-input-search('') → keywordChanged → setKeyword('')
|
|
533
|
+
searchInput.clear();
|
|
534
|
+
} else {
|
|
535
|
+
this.setKeyword('');
|
|
536
|
+
}
|
|
503
537
|
} else {
|
|
504
538
|
this.filtersElement.removeFilter(e.detail.name);
|
|
505
539
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Components to create a generic crud system based on Web Components and Lit",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://dile-components.com/",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@dile/ui": "^3.
|
|
28
|
+
"@dile/ui": "^3.19.1",
|
|
29
29
|
"axios": "^1.19.0",
|
|
30
30
|
"lit": "^2.7.0 || ^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "33fa981c48f488be6c9a381f1a32eeffa5b92b24"
|
|
36
36
|
}
|