@madgex/design-system 1.47.2 → 1.47.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/coverage/cobertura-coverage.xml +61 -59
- package/coverage/components/accordion/accordion.js.html +1 -1
- package/coverage/components/accordion/index.html +1 -1
- package/coverage/components/inputs/combobox/combobox.js.html +121 -0
- package/coverage/components/inputs/combobox/index.html +110 -0
- package/coverage/components/inputs/combobox/vue-components/Combobox.vue.html +1 -1
- package/coverage/components/inputs/combobox/vue-components/index.html +1 -1
- package/coverage/components/inputs/multi-select/index.html +110 -0
- package/coverage/{js/fractal-scripts/multiselect.js.html → components/inputs/multi-select/multi-select.js.html} +41 -56
- package/coverage/components/inputs/multi-select/vue-components/MultiSelect.vue.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckbox.vue.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckboxGroup.vue.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/index.html +1 -1
- package/coverage/components/modal/index.html +1 -1
- package/coverage/components/modal/modal.js.html +1 -1
- package/coverage/components/notification/index.html +1 -1
- package/coverage/components/notification/notification.js.html +1 -1
- package/coverage/components/popover/index.html +1 -1
- package/coverage/components/popover/popover.js.html +1 -1
- package/coverage/components/switch-state/index.html +1 -1
- package/coverage/components/switch-state/switch-state.js.html +1 -1
- package/coverage/components/tabs/index.html +1 -1
- package/coverage/components/tabs/tabs.js.html +1 -1
- package/coverage/index.html +47 -17
- package/coverage/js/common.js.html +1 -1
- package/coverage/js/fractal-scripts/combobox.js.html +1 -1
- package/coverage/js/fractal-scripts/index.html +5 -20
- package/coverage/js/fractal-scripts/notification.js.html +1 -1
- package/coverage/js/fractal-scripts/switch-state.js.html +1 -1
- package/coverage/js/index-fractal.js.html +4 -10
- package/coverage/js/index-polyfills.js.html +1 -1
- package/coverage/js/index-vue.js.html +10 -34
- package/coverage/js/index.html +11 -11
- package/coverage/js/index.js.html +1 -1
- package/coverage/js/polyfills/closest.js.html +1 -1
- package/coverage/js/polyfills/index.html +1 -1
- package/coverage/js/polyfills/remove.js.html +1 -1
- package/coverage/tokens/_config.js.html +1 -1
- package/coverage/tokens/index.html +1 -1
- package/dist/_tokens/css/_tokens.css +1 -1
- package/dist/_tokens/js/_tokens-module.js +1 -1
- package/dist/_tokens/scss/_tokens.scss +1 -1
- package/dist/assets/icons.json +1 -1
- package/dist/js/index.js +6 -6
- package/package.json +1 -1
- package/src/components/inputs/combobox/combobox.js +14 -0
- package/src/components/inputs/multi-select/multi-select.js +32 -0
- package/src/js/index-fractal.js +0 -2
- package/src/js/index-vue.js +4 -12
- package/src/js/fractal-scripts/multiselect.js +0 -37
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Combobox from './vue-components/Combobox.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'mds-combobox',
|
|
5
|
+
component: Combobox,
|
|
6
|
+
hooks: {
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
// If the custom element has loaded, clear up any fallback elements that could cause ID clashes or weirdness in form submission
|
|
9
|
+
const fallbackInput = this.parentElement.querySelector('input');
|
|
10
|
+
|
|
11
|
+
if (fallbackInput) fallbackInput.remove();
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import MultiSelect from './vue-components/MultiSelect.vue';
|
|
2
|
+
|
|
3
|
+
const optionsGroupSelector = '.mds-multiselect__checkbox-group';
|
|
4
|
+
const optionSelector = ':scope > .mds-multiselect__checkbox';
|
|
5
|
+
|
|
6
|
+
function constructOptionsList(rootGroup) {
|
|
7
|
+
const parentOptions = Array.from(rootGroup.querySelectorAll(optionSelector));
|
|
8
|
+
return parentOptions.reduce((optionsList, option) => {
|
|
9
|
+
const childGroup = option.querySelector(optionsGroupSelector);
|
|
10
|
+
const input = option.querySelector('input');
|
|
11
|
+
const label = option.querySelector('label');
|
|
12
|
+
optionsList.push({
|
|
13
|
+
id: input.id,
|
|
14
|
+
name: input.name,
|
|
15
|
+
value: input.value,
|
|
16
|
+
label: label.innerText,
|
|
17
|
+
checked: input.checked,
|
|
18
|
+
children: childGroup ? constructOptionsList(childGroup) : null,
|
|
19
|
+
});
|
|
20
|
+
return optionsList;
|
|
21
|
+
}, []);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
name: 'mds-multiselect',
|
|
26
|
+
component: MultiSelect,
|
|
27
|
+
hooks: {
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
this.options = constructOptionsList(this.parentElement.querySelector(optionsGroupSelector));
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
package/src/js/index-fractal.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import switchStateScript from './fractal-scripts/switch-state';
|
|
2
2
|
import notificationScript from './fractal-scripts/notification';
|
|
3
3
|
import comboboxScript from './fractal-scripts/combobox';
|
|
4
|
-
import multiselectScript from './fractal-scripts/multiselect';
|
|
5
4
|
|
|
6
5
|
document.addEventListener('DOMContentLoaded', () => {
|
|
7
6
|
switchStateScript.init();
|
|
8
7
|
notificationScript.init();
|
|
9
8
|
comboboxScript.init();
|
|
10
|
-
multiselectScript.init();
|
|
11
9
|
});
|
package/src/js/index-vue.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import 'document-register-element/build/document-register-element';
|
|
2
2
|
import Vue from 'vue';
|
|
3
3
|
import vueCustomElement from 'vue-custom-element';
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import MultiSelect from '../components/inputs/multi-select/vue-components/MultiSelect.vue';
|
|
4
|
+
import MdsCombobox from '../components/inputs/combobox/combobox';
|
|
5
|
+
import MdsMultiSelect from '../components/inputs/multi-select/multi-select';
|
|
7
6
|
|
|
8
7
|
Vue.use(vueCustomElement);
|
|
9
8
|
Vue.config.devtools = process.env.NODE_ENV === 'development';
|
|
@@ -11,13 +10,6 @@ Vue.config.devtools = process.env.NODE_ENV === 'development';
|
|
|
11
10
|
Vue.config.keyCodes.end = 35;
|
|
12
11
|
Vue.config.keyCodes.home = 36;
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// If the custom element has loaded, clear up any fallback elements that could cause ID clashes or weirdness in form submission
|
|
17
|
-
const fallbackInput = this.parentElement.querySelector('input');
|
|
18
|
-
|
|
19
|
-
if (fallbackInput) fallbackInput.remove();
|
|
20
|
-
},
|
|
13
|
+
[MdsCombobox, MdsMultiSelect].forEach(({ name, component, hooks }) => {
|
|
14
|
+
Vue.customElement(name, component, hooks);
|
|
21
15
|
});
|
|
22
|
-
|
|
23
|
-
Vue.customElement('mds-multiselect', MultiSelect);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
function constructNode(rootNode) {
|
|
2
|
-
const localObj = [];
|
|
3
|
-
const parentNodes = rootNode.querySelectorAll(':scope > .mds-multiselect__checkbox');
|
|
4
|
-
parentNodes.forEach((node, index) => {
|
|
5
|
-
let childGroup = 'null';
|
|
6
|
-
if (node.childElementCount === 3) {
|
|
7
|
-
childGroup = node.querySelector('.mds-multiselect__checkbox-group');
|
|
8
|
-
}
|
|
9
|
-
const input = node.querySelector('input');
|
|
10
|
-
const label = node.querySelector('label');
|
|
11
|
-
localObj[`${index}`] = {
|
|
12
|
-
id: input.id,
|
|
13
|
-
name: input.name,
|
|
14
|
-
value: input.value,
|
|
15
|
-
label: label.innerText,
|
|
16
|
-
checked: input.checked,
|
|
17
|
-
children: childGroup !== 'null' ? constructNode(childGroup) : null,
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
return localObj;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function bindData() {
|
|
24
|
-
const elements = Array.from(document.querySelectorAll('.js-mds-multiselect'));
|
|
25
|
-
elements.forEach((element) => {
|
|
26
|
-
const vueMultiselect = element.querySelector('mds-multiselect');
|
|
27
|
-
vueMultiselect.options = constructNode(element.querySelector('.mds-multiselect__checkbox-group'));
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const multiselect = {
|
|
32
|
-
init: () => {
|
|
33
|
-
bindData();
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default multiselect;
|