@dile/crud 2.5.6 → 2.5.7

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.
@@ -90,4 +90,45 @@ describe('dile-crud initial filters', () => {
90
90
  expect(el.listElement.filters[0].active).toBe(false);
91
91
  expect(el.listElement.filters[0].value).toBe('');
92
92
  });
93
+
94
+ it('keeps an inactive select filter inactive when config uses the false sentinel', async () => {
95
+ const config = new CrudConfigBuilder('https://example.test/api/countries', {
96
+ customization: {
97
+ disableInsert: true,
98
+ disableHelp: true,
99
+ disableKeywordSearch: true,
100
+ disableSort: true,
101
+ disableFilter: false,
102
+ disablePagination: true,
103
+ hideCheckboxSelection: true,
104
+ },
105
+ availableFilters: [
106
+ {
107
+ name: 'continent',
108
+ label: 'Continent',
109
+ active: false,
110
+ value: false,
111
+ type: 'select',
112
+ options: [
113
+ { value: 'Europe', label: 'Europe' },
114
+ { value: 'Asia', label: 'Asia' },
115
+ ],
116
+ },
117
+ ],
118
+ }).getConfig();
119
+
120
+ const el = document.createElement('dile-crud');
121
+ el.config = config;
122
+ document.body.appendChild(el);
123
+ await el.updateComplete;
124
+ await Promise.resolve();
125
+
126
+ expect(el.listElement.filters).toHaveLength(0);
127
+
128
+ const filtersForm = el.shadowRoot
129
+ .querySelector('dile-crud-filters')
130
+ .shadowRoot.querySelector('dile-crud-filters-form');
131
+ const select = filtersForm.shadowRoot.querySelector('dile-select');
132
+ expect(select.value).toBe('');
133
+ });
93
134
  });
@@ -43,7 +43,7 @@ export class DileCrudFiltersForm extends DileFormChangeDetect(DileForm(LitElemen
43
43
  switch (filter.type) {
44
44
  case 'select':
45
45
  return html`
46
- <dile-select label="${filter.label}" name="${filter.name}" value="${filter.value ?? ''}">
46
+ <dile-select label="${filter.label}" name="${filter.name}" value="${filter.value || ''}">
47
47
  <select slot="select">
48
48
  <option value="">-</option>
49
49
  ${filter.options.map(option => html`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
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",
@@ -32,5 +32,5 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "d62c55983a8fcdf7b1a4cb2b6da64d4d1e30b9c6"
35
+ "gitHead": "71da804b9b5ddb1e5d9c29b66b30eb8c2e7a6a90"
36
36
  }