@iamproperty/components 7.5.1--beta5 → 7.5.1--beta7
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/assets/css/components/actionbar.component.css +1 -1
- package/assets/css/components/actionbar.component.css.map +1 -1
- package/assets/css/components/address-lookup.component.css +1 -1
- package/assets/css/components/address-lookup.component.css.map +1 -1
- package/assets/css/components/applied-filters.css +1 -1
- package/assets/css/components/applied-filters.css.map +1 -1
- package/assets/css/components/calendar.component.css +1 -1
- package/assets/css/components/calendar.component.css.map +1 -1
- package/assets/css/components/card.component.css +1 -1
- package/assets/css/components/card.component.css.map +1 -1
- package/assets/css/components/fileupload.css +1 -1
- package/assets/css/components/fileupload.css.map +1 -1
- package/assets/css/components/input-range.component.css +1 -0
- package/assets/css/components/input-range.component.css.map +1 -0
- package/assets/css/components/input.component.css +1 -0
- package/assets/css/components/input.component.css.map +1 -0
- package/assets/css/components/modal.component.css +1 -0
- package/assets/css/components/modal.component.css.map +1 -0
- package/assets/css/components/multi-step-modal.component.css +1 -0
- package/assets/css/components/multi-step-modal.component.css.map +1 -0
- package/assets/css/components/multi-step-modal.global.css +1 -0
- package/assets/css/components/multi-step-modal.global.css.map +1 -0
- package/assets/css/components/multiselect.css +1 -1
- package/assets/css/components/multiselect.css.map +1 -1
- package/assets/css/components/nav.component.css +1 -1
- package/assets/css/components/nav.component.css.map +1 -1
- package/assets/css/components/pagination.css +1 -1
- package/assets/css/components/pagination.css.map +1 -1
- package/assets/css/components/password.component.css +1 -0
- package/assets/css/components/password.component.css.map +1 -0
- package/assets/css/components/slider.css +1 -1
- package/assets/css/components/slider.css.map +1 -1
- package/assets/css/components/tabs.component.css +1 -1
- package/assets/css/components/tabs.component.css.map +1 -1
- package/assets/css/components/tabs.config.css +1 -1
- package/assets/css/components/tabs.config.css.map +1 -1
- package/assets/css/core.min.css +1 -1
- package/assets/css/core.min.css.map +1 -1
- package/assets/css/mobile-core.min.css +1 -1
- package/assets/css/mobile-core.min.css.map +1 -1
- package/assets/css/mobile.min.css +1 -1
- package/assets/css/mobile.min.css.map +1 -1
- package/assets/css/style.min.css +1 -1
- package/assets/css/style.min.css.map +1 -1
- package/assets/js/components/accordion/accordion.component.js +1 -1
- package/assets/js/components/accordion/accordion.component.min.js +3 -3
- package/assets/js/components/accordion/accordion.component.min.js.map +1 -1
- package/assets/js/components/actionbar/actionbar.component.js +2 -4
- package/assets/js/components/actionbar/actionbar.component.min.js +4 -4
- package/assets/js/components/actionbar/actionbar.component.min.js.map +1 -1
- package/assets/js/components/address-lookup/address-lookup.component.js +45 -0
- package/assets/js/components/address-lookup/address-lookup.component.min.js +12 -4
- package/assets/js/components/address-lookup/address-lookup.component.min.js.map +1 -1
- package/assets/js/components/advanced-select/advanced-select.component.min.js +1 -1
- package/assets/js/components/applied-filters/applied-filters.component.js +0 -2
- package/assets/js/components/applied-filters/applied-filters.component.min.js +5 -7
- package/assets/js/components/applied-filters/applied-filters.component.min.js.map +1 -1
- package/assets/js/components/barchart/barchart.component.min.js +1 -1
- package/assets/js/components/bento-grid/bento-grid.component.min.js +1 -1
- package/assets/js/components/calendar/calendar.component.min.js +5 -5
- package/assets/js/components/card/card.component.min.js +8 -8
- package/assets/js/components/card/card.component.min.js.map +1 -1
- package/assets/js/components/carousel/carousel.component.min.js +1 -1
- package/assets/js/components/collapsible-side/collapsible-side.component.min.js +1 -1
- package/assets/js/components/content/content.component.min.js +1 -1
- package/assets/js/components/darkmode/darkmode.component.min.js +1 -1
- package/assets/js/components/doughnutchart/doughnutchart.component.min.js +1 -1
- package/assets/js/components/fileupload/fileupload.component.min.js +4 -4
- package/assets/js/components/filter-card/filter-card.component.js +19 -0
- package/assets/js/components/filter-card/filter-card.component.min.js +4 -4
- package/assets/js/components/filter-card/filter-card.component.min.js.map +1 -1
- package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
- package/assets/js/components/header/header.component.min.js +1 -1
- package/assets/js/components/inline-edit/inline-edit.component.min.js +1 -1
- package/assets/js/components/input/input.component.js +128 -0
- package/assets/js/components/input/input.component.min.js +16 -0
- package/assets/js/components/input/input.component.min.js.map +1 -0
- package/assets/js/components/input-range/input-range.component.js +62 -0
- package/assets/js/components/input-range/input-range.component.min.js +14 -0
- package/assets/js/components/input-range/input-range.component.min.js.map +1 -0
- package/assets/js/components/marketing/marketing.component.min.js +1 -1
- package/assets/js/components/menu/menu.component.min.js +1 -1
- package/assets/js/components/milestone/milestone.component.min.js +1 -1
- package/assets/js/components/milestone-group/milestone-group.component.min.js +1 -1
- package/assets/js/components/modal/modal.component.js +141 -0
- package/assets/js/components/modal/modal.component.min.js +28 -0
- package/assets/js/components/modal/modal.component.min.js.map +1 -0
- package/assets/js/components/multi-step/multi-step.component.min.js +1 -1
- package/assets/js/components/multi-step-modal/multi-step-modal.component.js +233 -0
- package/assets/js/components/multi-step-modal/multi-step-modal.component.min.js +17 -0
- package/assets/js/components/multi-step-modal/multi-step-modal.component.min.js.map +1 -0
- package/assets/js/components/multiselect/multiselect.component.js +1 -1
- package/assets/js/components/multiselect/multiselect.component.min.js +5 -5
- package/assets/js/components/multiselect/multiselect.component.min.js.map +1 -1
- package/assets/js/components/nav/nav.component.min.js +5 -5
- package/assets/js/components/nav/nav.component.min.js.map +1 -1
- package/assets/js/components/notification/notification.component.min.js +1 -1
- package/assets/js/components/pagination/pagination.component.min.js +3 -3
- package/assets/js/components/password/password.component.js +93 -0
- package/assets/js/components/password/password.component.min.js +17 -0
- package/assets/js/components/password/password.component.min.js.map +1 -0
- package/assets/js/components/rank/rank.component.min.js +1 -1
- package/assets/js/components/rankings/rankings.component.min.js +1 -1
- package/assets/js/components/record-card/record-card.component.min.js +4 -4
- package/assets/js/components/record-card/record-card.component.min.js.map +1 -1
- package/assets/js/components/search/search.component.js +1 -1
- package/assets/js/components/search/search.component.min.js +5 -5
- package/assets/js/components/search/search.component.min.js.map +1 -1
- package/assets/js/components/slider/slider.component.min.js +3 -3
- package/assets/js/components/split-button/split-button.component.min.js +1 -1
- package/assets/js/components/std-address-lookup/std-address-lookup.component.js +5 -1
- package/assets/js/components/std-address-lookup/std-address-lookup.component.min.js +22 -9
- package/assets/js/components/std-address-lookup/std-address-lookup.component.min.js.map +1 -1
- package/assets/js/components/table/table.component.min.js +3 -3
- package/assets/js/components/table/table.component.min.js.map +1 -1
- package/assets/js/components/table-ajax/table-ajax.component.min.js +4 -4
- package/assets/js/components/table-ajax/table-ajax.component.min.js.map +1 -1
- package/assets/js/components/table-basic/table-basic.component.min.js +1 -1
- package/assets/js/components/table-basic/table-basic.component.min.js.map +1 -1
- package/assets/js/components/table-no-submit/table-no-submit.component.min.js +1 -1
- package/assets/js/components/table-no-submit/table-no-submit.component.min.js.map +1 -1
- package/assets/js/components/table-submit/table-submit.component.min.js +1 -1
- package/assets/js/components/table-submit/table-submit.component.min.js.map +1 -1
- package/assets/js/components/tabs/tabs.component.min.js +2 -2
- package/assets/js/components/video-card/video-card.component.min.js +4 -4
- package/assets/js/components/video-card/video-card.component.min.js.map +1 -1
- package/assets/js/components/word-count/word-count.component.min.js +1 -1
- package/assets/js/modules/applied-filters.js +78 -61
- package/assets/js/modules/card.module.js +6 -1
- package/assets/js/modules/dialogs.js +6 -2
- package/assets/js/modules/password.js +72 -0
- package/assets/js/modules/table.js +10 -6
- package/assets/js/scripts.bundle.js +2 -3
- package/assets/js/scripts.bundle.js.map +1 -1
- package/assets/js/scripts.bundle.min.js +2 -2
- package/assets/js/scripts.bundle.min.js.map +1 -1
- package/assets/js/scripts.js +0 -2
- package/assets/js/tests/helpers.spec.js +54 -1
- package/assets/sass/_components.scss +2 -0
- package/assets/sass/_elements.scss +2 -0
- package/assets/sass/components/actionbar.component.scss +1 -0
- package/assets/sass/components/address-lookup.component.scss +24 -0
- package/assets/sass/components/applied-filters.scss +10 -14
- package/assets/sass/components/input-range.component.scss +38 -0
- package/assets/sass/components/input.component.scss +102 -0
- package/assets/sass/components/modal.component.scss +269 -0
- package/assets/sass/components/multi-step-modal.component.scss +255 -0
- package/assets/sass/components/multi-step-modal.global.scss +92 -0
- package/assets/sass/components/multiselect.scss +2 -2
- package/assets/sass/components/password.component.scss +60 -0
- package/assets/sass/components/tabs.config.scss +2 -2
- package/assets/sass/elements/badge-tag.scss +0 -1
- package/assets/sass/elements/details.scss +12 -7
- package/assets/sass/elements/dialog.scss +46 -5
- package/assets/sass/elements/forms.scss +41 -177
- package/assets/sass/elements/hr.scss +1 -1
- package/assets/sass/elements/modal.scss +19 -21
- package/assets/sass/elements/prefix.scss +115 -0
- package/assets/ts/components/accordion/accordion.component.ts +1 -1
- package/assets/ts/components/actionbar/actionbar.component.ts +3 -10
- package/assets/ts/components/address-lookup/address-lookup.component.ts +60 -0
- package/assets/ts/components/applied-filters/applied-filters.component.ts +0 -2
- package/assets/ts/components/filter-card/filter-card.component.ts +27 -0
- package/assets/ts/components/input/input.component.ts +168 -0
- package/assets/ts/components/input-range/input-range.component.ts +78 -0
- package/assets/ts/components/modal/modal.component.ts +188 -0
- package/assets/ts/components/multi-step-modal/multi-step-modal.component.ts +304 -0
- package/assets/ts/components/multiselect/multiselect.component.ts +1 -1
- package/assets/ts/components/password/password.component.ts +118 -0
- package/assets/ts/components/search/search.component.ts +1 -1
- package/assets/ts/components/std-address-lookup/std-address-lookup.component.ts +5 -3
- package/assets/ts/modules/applied-filters.ts +107 -71
- package/assets/ts/modules/card.module.ts +9 -4
- package/assets/ts/modules/dialogs.ts +6 -2
- package/assets/ts/modules/password.ts +82 -0
- package/assets/ts/modules/table.ts +13 -6
- package/assets/ts/scripts.ts +2 -2
- package/assets/ts/tests/helpers.spec.ts +100 -1
- package/dist/components.es.js +641 -959
- package/dist/components.umd.js +281 -182
- package/package.json +2 -2
- package/src/components/Input/Input.vue +19 -363
- package/src/components/InputRange/InputRange.vue +22 -0
- package/src/components/Modal/Modal.vue +22 -0
- package/src/components/MultiStepModal/MultiStepModal.vue +23 -0
- package/src/components/{PasswordIndicator/PasswordIndicator.vue → Password/Password.vue} +23 -23
- package/assets/js/components/password-indicator/password-indicator.component.js +0 -19
- package/assets/js/components/password-indicator/password-indicator.component.min.js +0 -7
- package/assets/js/components/password-indicator/password-indicator.component.min.js.map +0 -1
- package/assets/js/modules/form.js +0 -125
- package/assets/js/modules/inputs.js +0 -151
- package/assets/js/modules/password-indicator.js +0 -21
- package/assets/ts/components/password-indicator/password-indicator.component.ts +0 -24
- package/assets/ts/modules/form.ts +0 -166
- package/assets/ts/modules/inputs.ts +0 -181
- package/assets/ts/modules/password-indicator.ts +0 -29
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
function createAppliedFilters(container, filters): void {
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const dialog = container.closest('dialog');
|
|
4
|
+
|
|
5
|
+
const addFilterButton = (filters, input, setFilter = false): void | boolean => {
|
|
3
6
|
let shouldRemoveFilter = false;
|
|
4
7
|
let inputName = input.getAttribute('name');
|
|
5
8
|
|
|
@@ -26,7 +29,7 @@ function createAppliedFilters(container, filters): void {
|
|
|
26
29
|
filter.classList.add('filter');
|
|
27
30
|
filter.classList.add('tag');
|
|
28
31
|
|
|
29
|
-
if (
|
|
32
|
+
if (!setFilter) filter.classList.add('tag--not-set');
|
|
30
33
|
|
|
31
34
|
filter.setAttribute('data-name', inputName);
|
|
32
35
|
|
|
@@ -55,7 +58,7 @@ function createAppliedFilters(container, filters): void {
|
|
|
55
58
|
childFilter.classList.add('filter');
|
|
56
59
|
childFilter.classList.add('tag');
|
|
57
60
|
|
|
58
|
-
if (
|
|
61
|
+
if (!setFilter) filter.classList.add('tag--not-set');
|
|
59
62
|
|
|
60
63
|
childFilter.setAttribute('data-name', name);
|
|
61
64
|
childFilter.innerHTML = filterText.replace('$value', element.value);
|
|
@@ -82,107 +85,140 @@ function createAppliedFilters(container, filters): void {
|
|
|
82
85
|
parentFilter.classList.add('filter');
|
|
83
86
|
parentFilter.classList.add('tag');
|
|
84
87
|
|
|
85
|
-
if (
|
|
88
|
+
if (!setFilter) filter.classList.add('tag--not-set');
|
|
86
89
|
|
|
87
90
|
parentFilter.setAttribute('data-name', inputName);
|
|
88
91
|
parentFilter.innerHTML = newFilterText;
|
|
89
92
|
filters.appendChild(parentFilter);
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
|
-
}
|
|
95
|
+
};
|
|
93
96
|
|
|
94
|
-
|
|
95
|
-
Array.from(
|
|
96
|
-
container.querySelectorAll('input[type="checkbox"]:checked, input:not([type="checkbox"]):not([type="radio"])')
|
|
97
|
-
).forEach((input) => {
|
|
98
|
-
addFilterButton(filters, input, false);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
const dialog = container.closest('dialog');
|
|
97
|
+
const checkForChecked = (setFilter = false) => {
|
|
102
98
|
|
|
103
|
-
if (dialog) {
|
|
104
|
-
const observer = new MutationObserver(function (event) {
|
|
105
|
-
if (event[0].attributeName == 'open') {
|
|
106
|
-
Array.from(
|
|
107
|
-
container.querySelectorAll('input[type="checkbox"]:checked, input:not([type="checkbox"]):not([type="radio"])')
|
|
108
|
-
).forEach((input) => {
|
|
109
|
-
addFilterButton(filters, input, false);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
observer.observe(dialog, { attributes: true });
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
container.addEventListener('tags-set', function () {
|
|
118
99
|
filters.innerHTML = '';
|
|
119
100
|
Array.from(
|
|
120
|
-
container.querySelectorAll('input[type="checkbox"]:checked, input:not([type="checkbox"]
|
|
101
|
+
container.querySelectorAll('input:is([type="checkbox"],[type="radio"]):checked, input:not([type="checkbox"], [type="radio"])')
|
|
121
102
|
).forEach((input) => {
|
|
122
|
-
addFilterButton(filters, input,
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
// check for change in displayed inputs
|
|
127
|
-
Array.from(
|
|
128
|
-
container.querySelectorAll('input[type="checkbox"]:checked, input:not([type="checkbox"]):not([type="radio"])')
|
|
129
|
-
).forEach((input) => {
|
|
130
|
-
input.addEventListener('change', function (event) {
|
|
131
|
-
if (!container.hasAttribute('data-keep-same')) addFilterButton(filters, input);
|
|
132
|
-
|
|
133
|
-
event.stopPropagation(); // Don't allow the below event handler to trigger
|
|
103
|
+
addFilterButton(filters, input, setFilter);
|
|
134
104
|
});
|
|
135
|
-
}
|
|
105
|
+
};
|
|
106
|
+
// Check for which inputs have been set, setting true sets the filter as set (blue)
|
|
107
|
+
checkForChecked(true);
|
|
136
108
|
|
|
137
|
-
//
|
|
109
|
+
// Create the main event listener for the component watching for inputs to change
|
|
138
110
|
container.addEventListener('change', function (event) {
|
|
139
111
|
if (event && event.target instanceof HTMLElement && event.target.closest('input[data-filter-text]')) {
|
|
112
|
+
|
|
113
|
+
const setFilter = container.closest('dialog') ? false : true;
|
|
114
|
+
|
|
140
115
|
const input = event.target.closest('input[data-filter-text]');
|
|
141
|
-
|
|
116
|
+
|
|
117
|
+
if (!container.hasAttribute('data-keep-same') && !container.querySelector('dialog'))
|
|
118
|
+
addFilterButton(filters, input, setFilter);
|
|
119
|
+
|
|
120
|
+
if(setFilter){
|
|
121
|
+
|
|
122
|
+
const event = new CustomEvent('update');
|
|
123
|
+
container.parentElement.closest('iam-applied-filters')?.dispatchEvent(event);
|
|
124
|
+
}
|
|
142
125
|
}
|
|
143
126
|
});
|
|
144
127
|
|
|
128
|
+
|
|
129
|
+
const filterClicked = (filter) => {
|
|
130
|
+
const names = filter.getAttribute('data-name').split(',');
|
|
131
|
+
|
|
132
|
+
for (let t = 0; t < names.length; t++) {
|
|
133
|
+
const name = names[t];
|
|
134
|
+
let selector = `[name="${name}"]`;
|
|
135
|
+
|
|
136
|
+
if (name.match(/\[(.*)\]/)) {
|
|
137
|
+
//const newName = name.replace(/\[(.*)\]/, `[]`);
|
|
138
|
+
const value = name.replace(/.*\[(.*)\]/, `$1`);
|
|
139
|
+
selector = `[value="${value}"]`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const inputs = container.querySelectorAll(selector);
|
|
143
|
+
|
|
144
|
+
for (let i = 0; i < inputs.length; i++) {
|
|
145
|
+
const input = inputs[i];
|
|
146
|
+
|
|
147
|
+
if (input.getAttribute('type') != 'radio' && input.getAttribute('type') != 'checkbox') {
|
|
148
|
+
input.value = '';
|
|
149
|
+
} else {
|
|
150
|
+
input.checked = false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
filter.remove();
|
|
156
|
+
checkForChecked();
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
145
163
|
filters.addEventListener(
|
|
146
164
|
'click',
|
|
147
165
|
function (event) {
|
|
148
166
|
if (event && event.target instanceof HTMLElement && event.target.closest('.filter')) {
|
|
149
167
|
const filter = event.target.closest('.filter');
|
|
150
|
-
const
|
|
168
|
+
const filterName = filter.getAttribute('data-name');
|
|
169
|
+
|
|
170
|
+
filterClicked(filter);
|
|
171
|
+
|
|
172
|
+
// If you clicked on the filter on the parent component we want to tell the child component which filter to copy
|
|
173
|
+
if(container.querySelector('dialog iam-applied-filters')) {
|
|
174
|
+
const event = new CustomEvent('filter',{'detail':filterName });
|
|
175
|
+
container.querySelector('dialog iam-applied-filters').dispatchEvent(event);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
false
|
|
180
|
+
);
|
|
151
181
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
let selector = `[name="${name}"]`;
|
|
182
|
+
// Listen for
|
|
183
|
+
container.addEventListener('filter', (e) => {
|
|
155
184
|
|
|
156
|
-
|
|
157
|
-
//const newName = name.replace(/\[(.*)\]/, `[]`);
|
|
158
|
-
const value = name.replace(/.*\[(.*)\]/, `$1`);
|
|
159
|
-
selector = `[value="${value}"]`;
|
|
160
|
-
}
|
|
185
|
+
const filter = container.shadowRoot.querySelector(`[data-name="${e.detail}"]`);
|
|
161
186
|
|
|
162
|
-
|
|
187
|
+
filterClicked(filter);
|
|
188
|
+
});
|
|
163
189
|
|
|
164
|
-
|
|
165
|
-
const input = inputs[i];
|
|
190
|
+
container.addEventListener('set-filters', (e) => {
|
|
166
191
|
|
|
167
|
-
|
|
168
|
-
|
|
192
|
+
checkForChecked(true);
|
|
193
|
+
});
|
|
169
194
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
input.checked = false;
|
|
195
|
+
if(dialog){
|
|
196
|
+
// Force the filters inside of the dialog to effect the filters above
|
|
197
|
+
container.querySelector('.btn-primary')?.addEventListener('click', (e) => {
|
|
174
198
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
199
|
+
const event = new CustomEvent('update');
|
|
200
|
+
|
|
201
|
+
if(container.parentElement.closest('iam-applied-filters'))
|
|
202
|
+
container.parentElement.closest('iam-applied-filters').dispatchEvent(event);
|
|
180
203
|
|
|
181
|
-
|
|
204
|
+
if(container.parentElement && container.parentElement.closest('iam-applied-filters') && !container.parentElement.closest('iam-applied-filters').closest('dialog')){
|
|
205
|
+
|
|
206
|
+
const event = new CustomEvent('set-filters');
|
|
207
|
+
container.parentElement.closest('iam-applied-filters').dispatchEvent(event);
|
|
182
208
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
checkForChecked(true);
|
|
212
|
+
|
|
213
|
+
if(!container.querySelector('.btn-primary').hasAttribute('command')){
|
|
214
|
+
|
|
215
|
+
dialog.close();
|
|
216
|
+
const event = new Event('close');
|
|
217
|
+
dialog.dispatchEvent(event);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
});
|
|
221
|
+
}
|
|
186
222
|
}
|
|
187
223
|
|
|
188
224
|
export default createAppliedFilters;
|
|
@@ -25,10 +25,15 @@ export const setupCard = (cardComponent: any): void => {
|
|
|
25
25
|
|
|
26
26
|
// Inset the HTML for the data total or icon fallback
|
|
27
27
|
if (cardComponent.hasAttribute('data-total')) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
|
|
29
|
+
if(!cardBody?.querySelector('.card__total'))
|
|
30
|
+
cardBody.insertAdjacentHTML(
|
|
31
|
+
'beforeend',
|
|
32
|
+
`<div class="card__total">${cardComponent.getAttribute('data-total')}</div>`
|
|
33
|
+
);
|
|
34
|
+
else {
|
|
35
|
+
cardBody?.querySelector('.card__total')?.innerHTML = cardComponent.getAttribute('data-total');
|
|
36
|
+
}
|
|
32
37
|
} else if (cardComponent.querySelector('[slot="total-icon"]')) {
|
|
33
38
|
cardBody.insertAdjacentHTML('beforeend', `<div class="card__total"><slot name="total-icon"></slot></div>`);
|
|
34
39
|
}
|
|
@@ -23,6 +23,10 @@ const extendDialogs = (body): void => {
|
|
|
23
23
|
: button.getAttribute('data-filter');
|
|
24
24
|
const dialog = document.querySelector(`dialog#${modalID}`);
|
|
25
25
|
|
|
26
|
+
if(document.querySelector(`iam-modal#${modalID}`)) return false;
|
|
27
|
+
|
|
28
|
+
if(document.querySelector(`iam-multi-step-modal#${modalID}`)) return false;
|
|
29
|
+
|
|
26
30
|
createDialog(dialog);
|
|
27
31
|
|
|
28
32
|
// Open the modal!
|
|
@@ -232,7 +236,7 @@ const extendDialogs = (body): void => {
|
|
|
232
236
|
|
|
233
237
|
export const createDialog = (dialog): void => {
|
|
234
238
|
// If you are using Vue eevents and bindings its recommended to add in the .mh-lg div manually to the dialog
|
|
235
|
-
if (!dialog.querySelector(':scope .mh-lg') && !dialog.querySelector('iam-multi-step')) {
|
|
239
|
+
if (dialog && !dialog.querySelector(':scope .mh-lg') && !dialog.querySelector('iam-multi-step')) {
|
|
236
240
|
dialog.innerHTML = `<div class="mh-lg">${dialog.innerHTML}</div>`;
|
|
237
241
|
|
|
238
242
|
const dialogContent = dialog.querySelector('.mh-lg');
|
|
@@ -248,7 +252,7 @@ export const createDialog = (dialog): void => {
|
|
|
248
252
|
}
|
|
249
253
|
|
|
250
254
|
// Create close button is needed
|
|
251
|
-
if (!dialog.querySelector(':scope > button:first-child'))
|
|
255
|
+
if (dialog && !dialog.querySelector(':scope > button:first-child'))
|
|
252
256
|
dialog.insertAdjacentHTML('afterbegin', `<button class="dialog__close">Close</button>`);
|
|
253
257
|
};
|
|
254
258
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import hibpCheck from '../vendor/hibp.js';
|
|
2
|
+
|
|
3
|
+
export const changeType = function (element: Element): void {
|
|
4
|
+
const buttonEle = element.querySelector('button')
|
|
5
|
+
const associatedInput = element?.parentNode?.querySelector('input');
|
|
6
|
+
|
|
7
|
+
element.addEventListener('click', (event) => {
|
|
8
|
+
const currentType = associatedInput.type;
|
|
9
|
+
|
|
10
|
+
const newType = currentType === 'password' ? 'text' : 'password';
|
|
11
|
+
const isPasswordType = currentType === 'password';
|
|
12
|
+
|
|
13
|
+
associatedInput.setAttribute('type', newType);
|
|
14
|
+
associatedInput.setAttribute('data-password-type', isPasswordType);
|
|
15
|
+
|
|
16
|
+
if (element.hasAttribute('data-alt-class')) {
|
|
17
|
+
const newClass = element.getAttribute('data-alt-class');
|
|
18
|
+
element.setAttribute('data-alt-class', buttonEle.getAttribute('class'));
|
|
19
|
+
buttonEle.setAttribute('class', newClass);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export const checkPWDStrength = (input, check = 'no'): void => {
|
|
27
|
+
const pwdChecker = document.getElementById(input.getAttribute('data-strength-checker'));
|
|
28
|
+
const password = input.value;
|
|
29
|
+
const minChars = input.hasAttribute('minlength') ? input.getAttribute('minlength') : 12;
|
|
30
|
+
|
|
31
|
+
let strength = 1;
|
|
32
|
+
const strengthName = ['Very weak', 'Weak', 'Average', 'Strong', 'Very strong'];
|
|
33
|
+
let extraMsg = '';
|
|
34
|
+
|
|
35
|
+
//has number
|
|
36
|
+
if (password.match(/(?=.*[0-9])/)) strength += 1;
|
|
37
|
+
// has special character
|
|
38
|
+
if (password.match(/(?=.*[!,%,&,#,$,^,*,?,_,~,<,>,])/)) strength += 1;
|
|
39
|
+
// has lowercase alpha
|
|
40
|
+
if (password.match(/(?=.*[a-z])/)) strength += 1;
|
|
41
|
+
// has uppercase alpha
|
|
42
|
+
if (password.match(/(?=.*[A-Z])/)) strength += 1;
|
|
43
|
+
|
|
44
|
+
if (password.length < minChars) {
|
|
45
|
+
strength = 1;
|
|
46
|
+
extraMsg = `(must be at least ${minChars} characters.)`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// if the strength is above weak and above the minimum length do some kind of api call to check if its in a list of passwords
|
|
50
|
+
|
|
51
|
+
if (strength >= 3 && check == 'no') {
|
|
52
|
+
hibpCheck(password, input);
|
|
53
|
+
|
|
54
|
+
input.addEventListener('hibpCheck', function (event) {
|
|
55
|
+
checkhibpCheck(event, input);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function checkhibpCheck(event, input): void {
|
|
59
|
+
if (event.detail) {
|
|
60
|
+
// found
|
|
61
|
+
checkPWDStrength(input, 'danger');
|
|
62
|
+
} else {
|
|
63
|
+
// not found
|
|
64
|
+
checkPWDStrength(input, 'success');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
input.removeEventListener('hibpCheck', checkhibpCheck); // Succeeds
|
|
68
|
+
}
|
|
69
|
+
} else if (strength >= 3 && check == 'danger') {
|
|
70
|
+
strength = 3;
|
|
71
|
+
extraMsg = `(this password is very common)`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (pwdChecker) {
|
|
75
|
+
if (strength <= 3) pwdChecker.classList.add('invalid-feedback');
|
|
76
|
+
else pwdChecker.classList.remove('invalid-feedback');
|
|
77
|
+
|
|
78
|
+
pwdChecker.setAttribute('data-strength', strength);
|
|
79
|
+
pwdChecker.innerHTML = `Password strength: ${strengthName[strength - 1]} ${extraMsg}`;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
@@ -1257,6 +1257,14 @@ export const setupAjaxTable = (component, table, form, pagination): void => {
|
|
|
1257
1257
|
event.preventDefault();
|
|
1258
1258
|
});
|
|
1259
1259
|
|
|
1260
|
+
form.addEventListener('change', (event) => {
|
|
1261
|
+
|
|
1262
|
+
if(!event.target.closest('iam-modal')){
|
|
1263
|
+
|
|
1264
|
+
loadAjaxTable(component, table, form, pagination);
|
|
1265
|
+
}
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1260
1268
|
if (actionbar) {
|
|
1261
1269
|
actionbar.addEventListener('change', (event) => {
|
|
1262
1270
|
loadAjaxTable(component, table, form, pagination);
|
|
@@ -1278,7 +1286,6 @@ export const setupAjaxTable = (component, table, form, pagination): void => {
|
|
|
1278
1286
|
component.dispatchEvent(submitEvent);
|
|
1279
1287
|
|
|
1280
1288
|
loadAjaxTable(component, table, form, pagination);
|
|
1281
|
-
console.log('hello');
|
|
1282
1289
|
});
|
|
1283
1290
|
}
|
|
1284
1291
|
|
|
@@ -1372,12 +1379,12 @@ export const loadAjaxTable = async function (component, table, form, pagination)
|
|
|
1372
1379
|
})
|
|
1373
1380
|
.then((response) => response.json())
|
|
1374
1381
|
.then((response) => {
|
|
1375
|
-
const schema =
|
|
1376
|
-
const totalNumberSchema =
|
|
1377
|
-
?
|
|
1382
|
+
const schema = component.hasAttribute('data-schema') ? component.getAttribute('data-schema') : 'data';
|
|
1383
|
+
const totalNumberSchema = component.hasAttribute('data-schema-total')
|
|
1384
|
+
? component.getAttribute('data-schema-total')
|
|
1378
1385
|
: 'meta.total';
|
|
1379
|
-
const currentPageSchema =
|
|
1380
|
-
?
|
|
1386
|
+
const currentPageSchema = component.hasAttribute('data-schema-page')
|
|
1387
|
+
? component.getAttribute('data-schema-page')
|
|
1381
1388
|
: 'meta.current_page';
|
|
1382
1389
|
|
|
1383
1390
|
const totalNumber = resolvePath(response, totalNumberSchema, 15);
|
package/assets/ts/scripts.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as helpers from './modules/helpers';
|
|
3
3
|
import extendDialogs from './modules/dialogs';
|
|
4
4
|
import createDataLayer from './modules/data-layer';
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
import createDynamicEvents from './modules/dynamicEvents';
|
|
7
7
|
import videoSupport from './modules/videos';
|
|
8
8
|
|
|
@@ -56,7 +56,7 @@ document.addEventListener('DOMContentLoaded', async (): void => {
|
|
|
56
56
|
helpers.addGlobalEvents(document.body);
|
|
57
57
|
|
|
58
58
|
extendDialogs(document.body);
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
|
|
61
61
|
videoSupport(document.body);
|
|
62
62
|
|
|
@@ -3,6 +3,7 @@ import { isValidPostcode } from '../modules/helpers';
|
|
|
3
3
|
|
|
4
4
|
describe('The postcode helper function', () => {
|
|
5
5
|
|
|
6
|
+
// #region valid pattern variations
|
|
6
7
|
test('should return true when testing the postcode "ne33hd"', () => {
|
|
7
8
|
|
|
8
9
|
expect(isValidPostcode("ne33hd")).toBe(true);
|
|
@@ -29,10 +30,108 @@ describe('The postcode helper function', () => {
|
|
|
29
30
|
|
|
30
31
|
expect(isValidPostcode(" NE33HD ")).toBe(true);
|
|
31
32
|
});
|
|
33
|
+
// #endregion
|
|
34
|
+
|
|
35
|
+
// #region Valid postcodes
|
|
36
|
+
|
|
37
|
+
test('should return true when testing the postcode "NE3 5DP"', () => {
|
|
38
|
+
|
|
39
|
+
expect(isValidPostcode("NE3 5DP")).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('should return true when testing the postcode "CW11 1SX"', () => {
|
|
43
|
+
|
|
44
|
+
expect(isValidPostcode("CW11 1SX")).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
test('should return true when testing the postcode "NE21 6RB"', () => {
|
|
49
|
+
|
|
50
|
+
expect(isValidPostcode("NE21 6RB")).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
test('should return true when testing the postcode "SW1A 1AA"', () => {
|
|
55
|
+
|
|
56
|
+
expect(isValidPostcode("SW1A 1AA")).toBe(true);
|
|
57
|
+
});
|
|
32
58
|
|
|
33
|
-
|
|
59
|
+
|
|
60
|
+
test('should return true when testing the postcode "M1 1AE"', () => {
|
|
61
|
+
|
|
62
|
+
expect(isValidPostcode("M1 1AE")).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// #endregion
|
|
66
|
+
|
|
67
|
+
// incorrect pattern
|
|
34
68
|
test('should return false when testing the postcode "NE3"', () => {
|
|
35
69
|
|
|
36
70
|
expect(isValidPostcode("NE3")).toBe(false);
|
|
37
71
|
});
|
|
72
|
+
|
|
73
|
+
// #region Invalid postcodes correct pattern
|
|
74
|
+
|
|
75
|
+
test('should return false when testing the postcode "Q1A 4BT"', () => {
|
|
76
|
+
|
|
77
|
+
expect(isValidPostcode("Q1A 4BT")).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('should return false when testing the postcode "AB0 7RE"', () => {
|
|
81
|
+
|
|
82
|
+
expect(isValidPostcode("AB0 7RE")).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('should return false when testing the postcode "LN0A 4JP"', () => {
|
|
86
|
+
|
|
87
|
+
expect(isValidPostcode("LN0A 4JP")).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('should return false when testing the postcode "WS0 9ND"', () => {
|
|
91
|
+
|
|
92
|
+
expect(isValidPostcode("WS0 9ND")).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('should return false when testing the postcode "X8 2HR"', () => {
|
|
96
|
+
|
|
97
|
+
expect(isValidPostcode("X8 2HR")).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// #endregion
|
|
101
|
+
|
|
102
|
+
// #region Invalid postcodes incorrect pattern
|
|
103
|
+
|
|
104
|
+
test('should return false when testing the postcode "ZZ2 TYD"', () => {
|
|
105
|
+
|
|
106
|
+
expect(isValidPostcode("ZZ2 TYD")).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
test('should return false when testing the postcode "ABC EFG"', () => {
|
|
111
|
+
|
|
112
|
+
expect(isValidPostcode("ABC EFG")).toBe(false);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
test('should return false when testing the postcode "1234 567"', () => {
|
|
117
|
+
|
|
118
|
+
expect(isValidPostcode("1234 567")).toBe(false);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
test('should return false when testing the postcode "23A PP2"', () => {
|
|
123
|
+
|
|
124
|
+
expect(isValidPostcode("23A PP2")).toBe(false);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
test('should return false when testing the postcode "NE3 H23"', () => {
|
|
129
|
+
|
|
130
|
+
expect(isValidPostcode("NE3 H23")).toBe(false);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
// #endregion
|
|
135
|
+
|
|
136
|
+
|
|
38
137
|
});
|