nsw-design-system 3.5.2 → 3.5.3
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/js/main.js +41 -33
- package/package.json +1 -1
- package/src/components/filters/filters.js +24 -17
- package/src/components/select/select.js +2 -0
package/dist/js/main.js
CHANGED
|
@@ -788,38 +788,43 @@
|
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
790
|
selectedItems() {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
791
|
+
const stateCheck = setInterval(() => {
|
|
792
|
+
if (document.readyState === 'complete') {
|
|
793
|
+
clearInterval(stateCheck);
|
|
794
|
+
this.filtersItems.forEach(filter => {
|
|
795
|
+
const button = filter.querySelector('.nsw-filters__item-name');
|
|
796
|
+
const content = filter.querySelector('.nsw-filters__item-content');
|
|
797
|
+
const text = content ? content.querySelectorAll('input[type="text"]') : null;
|
|
798
|
+
const selects = content ? content.querySelectorAll('select') : null;
|
|
799
|
+
const checkboxes = content ? content.querySelectorAll('input[type="checkbox"]:not([id$="-all"])') : null;
|
|
800
|
+
if (!content) return;
|
|
801
|
+
this.updateCount({
|
|
802
|
+
array: text,
|
|
803
|
+
title: button
|
|
804
|
+
});
|
|
805
|
+
this.updateCount({
|
|
806
|
+
array: selects,
|
|
807
|
+
title: button
|
|
808
|
+
});
|
|
809
|
+
this.updateCount({
|
|
810
|
+
array: checkboxes,
|
|
811
|
+
title: button
|
|
812
|
+
});
|
|
813
|
+
this.updateStatus({
|
|
814
|
+
array: text,
|
|
815
|
+
title: button
|
|
816
|
+
});
|
|
817
|
+
this.updateStatus({
|
|
818
|
+
array: selects,
|
|
819
|
+
title: button
|
|
820
|
+
});
|
|
821
|
+
this.updateStatus({
|
|
822
|
+
array: checkboxes,
|
|
823
|
+
title: button
|
|
824
|
+
});
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
}, 100);
|
|
823
828
|
}
|
|
824
829
|
clearAllFilters(e) {
|
|
825
830
|
e.preventDefault();
|
|
@@ -829,7 +834,7 @@
|
|
|
829
834
|
const content = filter.querySelector('.nsw-filters__item-content');
|
|
830
835
|
const text = content.querySelectorAll('input[type="text"]');
|
|
831
836
|
const selects = content.querySelectorAll('select');
|
|
832
|
-
const checkboxes = content.querySelectorAll('input[type="checkbox"]');
|
|
837
|
+
const checkboxes = content.querySelectorAll('input[type="checkbox"]:not([id$="-all"])');
|
|
833
838
|
const allFields = [...text, ...selects, ...checkboxes];
|
|
834
839
|
if (!content) return;
|
|
835
840
|
if (allFields.length > 0) {
|
|
@@ -838,6 +843,7 @@
|
|
|
838
843
|
if (this.constructor.getCondition(field) && (field.type === 'text' || field.type === 'select-one')) {
|
|
839
844
|
field.value = '';
|
|
840
845
|
} else {
|
|
846
|
+
field.click();
|
|
841
847
|
field.checked = false;
|
|
842
848
|
}
|
|
843
849
|
});
|
|
@@ -1205,11 +1211,13 @@
|
|
|
1205
1211
|
this.customOptions.forEach(check => {
|
|
1206
1212
|
const input = check.querySelector('.nsw-form__checkbox-input');
|
|
1207
1213
|
if (count === this.options.length) {
|
|
1214
|
+
input.click();
|
|
1208
1215
|
input.checked = false;
|
|
1209
1216
|
input.removeAttribute('checked');
|
|
1210
1217
|
check.setAttribute('aria-selected', 'false');
|
|
1211
1218
|
this.updateNativeSelect(check.getAttribute('data-index'), false);
|
|
1212
1219
|
} else {
|
|
1220
|
+
input.click();
|
|
1213
1221
|
input.checked = true;
|
|
1214
1222
|
input.setAttribute('checked', '');
|
|
1215
1223
|
check.setAttribute('aria-selected', 'true');
|
package/package.json
CHANGED
|
@@ -231,6 +231,7 @@ class Filters {
|
|
|
231
231
|
updateCount(options) {
|
|
232
232
|
const id = uniqueId()
|
|
233
233
|
const GroupArray = []
|
|
234
|
+
|
|
234
235
|
if (options.array.length > 0) {
|
|
235
236
|
options.array.forEach((element, index) => {
|
|
236
237
|
const getEventType = this.constructor.getEventType(element.type)
|
|
@@ -307,22 +308,27 @@ class Filters {
|
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
selectedItems() {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
311
|
+
const stateCheck = setInterval(() => {
|
|
312
|
+
if (document.readyState === 'complete') {
|
|
313
|
+
clearInterval(stateCheck)
|
|
314
|
+
this.filtersItems.forEach((filter) => {
|
|
315
|
+
const button = filter.querySelector('.nsw-filters__item-name')
|
|
316
|
+
const content = filter.querySelector('.nsw-filters__item-content')
|
|
317
|
+
const text = content ? content.querySelectorAll('input[type="text"]') : null
|
|
318
|
+
const selects = content ? content.querySelectorAll('select') : null
|
|
319
|
+
const checkboxes = content ? content.querySelectorAll('input[type="checkbox"]:not([id$="-all"])') : null
|
|
320
|
+
|
|
321
|
+
if (!content) return
|
|
322
|
+
|
|
323
|
+
this.updateCount({ array: text, title: button })
|
|
324
|
+
this.updateCount({ array: selects, title: button })
|
|
325
|
+
this.updateCount({ array: checkboxes, title: button })
|
|
326
|
+
this.updateStatus({ array: text, title: button })
|
|
327
|
+
this.updateStatus({ array: selects, title: button })
|
|
328
|
+
this.updateStatus({ array: checkboxes, title: button })
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
|
+
}, 100)
|
|
326
332
|
}
|
|
327
333
|
|
|
328
334
|
clearAllFilters(e) {
|
|
@@ -333,7 +339,7 @@ class Filters {
|
|
|
333
339
|
const content = filter.querySelector('.nsw-filters__item-content')
|
|
334
340
|
const text = content.querySelectorAll('input[type="text"]')
|
|
335
341
|
const selects = content.querySelectorAll('select')
|
|
336
|
-
const checkboxes = content.querySelectorAll('input[type="checkbox"]')
|
|
342
|
+
const checkboxes = content.querySelectorAll('input[type="checkbox"]:not([id$="-all"])')
|
|
337
343
|
const allFields = [...text, ...selects, ...checkboxes]
|
|
338
344
|
|
|
339
345
|
if (!content) return
|
|
@@ -344,6 +350,7 @@ class Filters {
|
|
|
344
350
|
if (this.constructor.getCondition(field) && (field.type === 'text' || field.type === 'select-one')) {
|
|
345
351
|
field.value = ''
|
|
346
352
|
} else {
|
|
353
|
+
field.click()
|
|
347
354
|
field.checked = false
|
|
348
355
|
}
|
|
349
356
|
})
|
|
@@ -160,12 +160,14 @@ class Select {
|
|
|
160
160
|
const input = check.querySelector('.nsw-form__checkbox-input')
|
|
161
161
|
|
|
162
162
|
if (count === this.options.length) {
|
|
163
|
+
input.click()
|
|
163
164
|
input.checked = false
|
|
164
165
|
input.removeAttribute('checked')
|
|
165
166
|
check.setAttribute('aria-selected', 'false')
|
|
166
167
|
|
|
167
168
|
this.updateNativeSelect(check.getAttribute('data-index'), false)
|
|
168
169
|
} else {
|
|
170
|
+
input.click()
|
|
169
171
|
input.checked = true
|
|
170
172
|
input.setAttribute('checked', '')
|
|
171
173
|
check.setAttribute('aria-selected', 'true')
|