@mgdis/mg-components 3.1.0 → 3.2.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.
- package/dist/cjs/css-shim-629916b0.js +6 -0
- package/dist/cjs/index-369388eb.js +146 -0
- package/dist/cjs/{index-85a4a0b6.js → index-bead7dbd.js} +78 -2
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/mg-badge_21.cjs.entry.js +3313 -0
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-modal.cjs.entry.js +111 -0
- package/dist/cjs/mg-popover.cjs.entry.js +165 -0
- package/dist/cjs/popper-0c3964e7.js +1786 -0
- package/dist/cjs/{shadow-css-8940f82d.js → shadow-css-546083ef.js} +1 -1
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +11 -7
- package/dist/collection/components/atoms/mg-badge/mg-badge.stories.js +3 -0
- package/dist/collection/components/atoms/mg-button/mg-button.css +26 -17
- package/dist/collection/components/atoms/mg-button/mg-button.js +71 -2
- package/dist/collection/components/atoms/mg-button/mg-button.stories.js +5 -0
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +12 -1
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.stories.js +8 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +8 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +5 -7
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +11 -1
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.css +4 -4
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +14 -3
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +10 -3
- package/dist/collection/components/atoms/mg-tag/mg-tag.stories.js +3 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +9 -0
- package/dist/collection/components/molecules/inputs/MgInput.js +20 -14
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +9 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +103 -40
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +125 -56
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +144 -68
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +101 -35
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +9 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +115 -37
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +28 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +132 -51
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.stories.js +14 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +155 -53
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.stories.js +7 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +27 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +108 -42
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.js +7 -2
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +60 -31
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.js +6 -1
- package/dist/collection/components/molecules/mg-form/mg-form.css +15 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +269 -0
- package/dist/collection/components/molecules/mg-form/mg-form.stories.js +58 -0
- package/dist/collection/components/molecules/mg-message/mg-message.css +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -4
- package/dist/collection/components/molecules/mg-message/mg-message.stories.js +5 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +54 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +233 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.stories.js +51 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +32 -12
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.stories.js +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +42 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +255 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.stories.js +31 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +19 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +4 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +14 -3
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +68 -20
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.stories.js +10 -1
- package/dist/collection/stories/messages.stories.js +1 -1
- package/dist/collection/utils/components.utils.js +16 -9
- package/dist/collection/utils/locale.utils.js +6 -3
- package/dist/collection/utils/test.utils.js +27 -15
- package/dist/collection/variables.css +30 -1
- package/dist/collection/variables.scss +30 -1
- package/dist/components/MgInput.js +20 -14
- package/dist/components/components.utils.js +16 -9
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index2.js +22 -12
- package/dist/components/locale.utils.js +6 -3
- package/dist/components/mg-badge2.js +9 -5
- package/dist/components/mg-button2.js +21 -2
- package/dist/components/mg-character-left2.js +12 -1
- package/dist/components/mg-form.d.ts +11 -0
- package/dist/components/mg-form.js +146 -0
- package/dist/components/mg-icon2.js +20 -2
- package/dist/components/mg-input-checkbox.js +65 -36
- package/dist/components/mg-input-date.js +87 -52
- package/dist/components/mg-input-numeric.js +105 -63
- package/dist/components/mg-input-password.js +60 -29
- package/dist/components/mg-input-radio.js +74 -34
- package/dist/components/mg-input-select2.js +89 -46
- package/dist/components/mg-input-text.js +1 -237
- package/dist/components/mg-input-text2.js +288 -0
- package/dist/components/mg-input-textarea.js +67 -36
- package/dist/components/mg-input-title2.js +13 -4
- package/dist/components/mg-input-toggle.js +30 -22
- package/dist/components/mg-message.js +10 -3
- package/dist/components/mg-modal.d.ts +11 -0
- package/dist/components/mg-modal.js +147 -0
- package/dist/components/mg-pagination.js +31 -11
- package/dist/components/mg-panel.d.ts +11 -0
- package/dist/components/mg-panel.js +210 -0
- package/dist/components/mg-popover.js +20 -5
- package/dist/components/mg-tabs.js +43 -11
- package/dist/components/mg-tag.js +8 -1
- package/dist/components/mg-tooltip2.js +9 -0
- package/dist/esm/css-shim-0993aa3b.js +4 -0
- package/dist/esm/{index-e3e84606.js → index-9e877561.js} +78 -2
- package/dist/esm/index-c346f52d.js +139 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/mg-badge_21.entry.js +3289 -0
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-modal.entry.js +107 -0
- package/dist/esm/mg-popover.entry.js +161 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/popper-8874fd6c.js +1784 -0
- package/dist/esm/{shadow-css-5d2d01ce.js → shadow-css-dfa0587f.js} +1 -1
- package/dist/esm-es5/css-shim-0993aa3b.js +1 -0
- package/dist/esm-es5/index-9e877561.js +1 -0
- package/dist/esm-es5/index-c346f52d.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mg-badge_21.entry.js +2 -0
- package/dist/esm-es5/mg-components.js +1 -1
- package/dist/esm-es5/mg-modal.entry.js +1 -0
- package/dist/esm-es5/mg-popover.entry.js +1 -0
- package/dist/esm-es5/popper-8874fd6c.js +1 -0
- package/dist/esm-es5/{shadow-css-5d2d01ce.js → shadow-css-dfa0587f.js} +0 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.js +2 -2
- package/dist/mg-components/p-3633e9e1.system.entry.js +2 -0
- package/dist/mg-components/p-3c14153d.js +1 -0
- package/dist/mg-components/p-55a22b35.system.js +1 -0
- package/dist/mg-components/{p-f6455ab3.js → p-5e796581.js} +0 -0
- package/dist/mg-components/p-656b5efb.system.js +1 -0
- package/dist/mg-components/p-68d6f104.js +1 -0
- package/dist/mg-components/{p-366a224e.js → p-6d49ed95.js} +1 -1
- package/dist/mg-components/p-70177194.entry.js +1 -0
- package/dist/mg-components/{p-71d57b8b.system.js → p-8b2d8a2a.system.js} +0 -0
- package/dist/mg-components/p-8cb61c3f.system.js +1 -0
- package/dist/mg-components/p-ace173b1.js +1 -0
- package/dist/mg-components/p-c46fbd54.entry.js +1 -0
- package/dist/mg-components/p-c90cc4bf.system.js +1 -0
- package/dist/mg-components/p-cd2a4acc.system.entry.js +1 -0
- package/dist/mg-components/p-de1164fa.system.entry.js +1 -0
- package/dist/mg-components/p-dfe25da3.entry.js +1 -0
- package/dist/mg-components/p-e4a502b5.system.js +1 -0
- package/dist/mg-components/variables.css +30 -1
- package/dist/mg-components/variables.scss +30 -1
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -4
- package/dist/types/components/atoms/mg-badge/mg-badge.stories.d.ts +5 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +22 -2
- package/dist/types/components/atoms/mg-button/mg-button.stories.d.ts +5 -0
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +13 -2
- package/dist/types/components/atoms/mg-character-left/mg-character-left.stories.d.ts +9 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +11 -1
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +11 -1
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +10 -3
- package/dist/types/components/atoms/mg-tag/mg-tag.stories.d.ts +5 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -2
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +8 -0
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -4
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +31 -11
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +39 -14
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +53 -14
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +28 -9
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +37 -8
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +30 -7
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.stories.d.ts +14 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +46 -10
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +30 -10
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.stories.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +27 -12
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.stories.d.ts +5 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +82 -0
- package/dist/types/components/molecules/mg-form/mg-form.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +11 -4
- package/dist/types/components/molecules/mg-message/mg-message.stories.d.ts +10 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +83 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.stories.d.ts +13 -0
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +23 -7
- package/dist/types/components/molecules/mg-pagination/mg-pagination.stories.d.ts +5 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +110 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.stories.d.ts +6 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +18 -3
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +5 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +21 -6
- package/dist/types/components/molecules/mg-tabs/mg-tabs.stories.d.ts +8 -0
- package/dist/types/components.d.ts +365 -78
- package/dist/types/locales/index.d.ts +15 -8
- package/dist/types/utils/components.utils.d.ts +16 -9
- package/dist/types/utils/locale.utils.d.ts +6 -3
- package/dist/types/utils/test.utils.d.ts +13 -1
- package/package.json +13 -9
- package/readme.md +3 -0
- package/dist/cjs/css-shim-a22512c4.js +0 -6
- package/dist/cjs/mg-badge_20.cjs.entry.js +0 -4661
- package/dist/esm/css-shim-7c240feb.js +0 -4
- package/dist/esm/mg-badge_20.entry.js +0 -4638
- package/dist/esm-es5/css-shim-7c240feb.js +0 -1
- package/dist/esm-es5/index-e3e84606.js +0 -1
- package/dist/esm-es5/mg-badge_20.entry.js +0 -2
- package/dist/mg-components/p-1cd24462.system.js +0 -1
- package/dist/mg-components/p-2e2f6b27.system.entry.js +0 -2
- package/dist/mg-components/p-422c429b.system.js +0 -1
- package/dist/mg-components/p-62fa3797.js +0 -1
- package/dist/mg-components/p-9a215712.system.js +0 -1
- package/dist/mg-components/p-cbf0464b.entry.js +0 -1
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
import { Component, Event, h, Prop, State, Watch, Method } from '@stencil/core';
|
|
2
4
|
import { MgInput } from '../MgInput';
|
|
5
|
+
import { InputClass } from '../MgInput.conf';
|
|
3
6
|
import { createID, ClassList, allItemsAreString } from '../../../../utils/components.utils';
|
|
4
7
|
import { messages } from '../../../../locales';
|
|
5
|
-
import { InputClass } from '../MgInput.conf';
|
|
6
8
|
/**
|
|
7
9
|
* Check if item is a well configured option
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
10
|
+
*
|
|
11
|
+
* @param {SelectOption} option select option
|
|
12
|
+
* @returns {boolean} select option type is valid
|
|
10
13
|
*/
|
|
11
14
|
const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
|
|
12
15
|
/**
|
|
13
16
|
* Group options
|
|
14
|
-
*
|
|
15
|
-
* @param {SelectOption}
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {string} item.
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
* @
|
|
17
|
+
*
|
|
18
|
+
* @param {(SelectOption | OptGroup)[]} acc reduce accumulator
|
|
19
|
+
* @param {SelectOption} item item to add
|
|
20
|
+
* @param {string} item.group item group
|
|
21
|
+
* @param {string} item.title item title
|
|
22
|
+
* @param {unknown} item.value item value
|
|
23
|
+
* @param {boolean} item.disabled is item disabled
|
|
24
|
+
* @returns {(SelectOption | OptGroup)[]} grouped options
|
|
21
25
|
*/
|
|
22
26
|
const groupOptions = (acc, { group, title, value, disabled }) => {
|
|
23
27
|
if (group !== undefined) {
|
|
24
28
|
// Check if group is already created
|
|
25
|
-
const
|
|
29
|
+
const optGroup = acc.find(grp => grp.group === group);
|
|
26
30
|
// Add to group
|
|
27
|
-
if (
|
|
28
|
-
|
|
31
|
+
if (optGroup !== undefined) {
|
|
32
|
+
optGroup.options.push({ title, value, disabled });
|
|
29
33
|
}
|
|
30
34
|
// Create group
|
|
31
35
|
else {
|
|
@@ -92,8 +96,12 @@ export class MgInputSelect {
|
|
|
92
96
|
*/
|
|
93
97
|
this.handleInput = () => {
|
|
94
98
|
this.checkValidity();
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
if (this.input.value !== '') {
|
|
100
|
+
this.value = allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.title === this.input.value).value;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.value = null;
|
|
104
|
+
}
|
|
97
105
|
};
|
|
98
106
|
/**
|
|
99
107
|
* Handle blur event
|
|
@@ -102,18 +110,57 @@ export class MgInputSelect {
|
|
|
102
110
|
this.checkValidity();
|
|
103
111
|
this.checkError();
|
|
104
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* Check if input is valid
|
|
115
|
+
*/
|
|
116
|
+
this.checkValidity = () => {
|
|
117
|
+
if (!this.readonly && this.input !== undefined) {
|
|
118
|
+
const validity = this.input.checkValidity && this.input.checkValidity();
|
|
119
|
+
// Set validity
|
|
120
|
+
this.valid = validity;
|
|
121
|
+
this.invalid = !validity;
|
|
122
|
+
//Send event
|
|
123
|
+
this.inputValid.emit(validity);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Check input errors
|
|
128
|
+
*/
|
|
129
|
+
this.checkError = () => {
|
|
130
|
+
// Set error message
|
|
131
|
+
this.errorMessage = undefined;
|
|
132
|
+
if (!this.valid && this.input.validity.valueMissing) {
|
|
133
|
+
this.errorMessage = messages.errors.required;
|
|
134
|
+
}
|
|
135
|
+
// Update class
|
|
136
|
+
if (this.valid) {
|
|
137
|
+
this.classList.delete(this.classError);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
this.classList.add(this.classError);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
handleValue(newValue) {
|
|
145
|
+
if (newValue !== null) {
|
|
146
|
+
this.readonlyValue = allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.value === newValue).title;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.readonlyValue = null;
|
|
150
|
+
}
|
|
151
|
+
this.valueChange.emit(newValue);
|
|
105
152
|
}
|
|
106
153
|
validateItems(newValue) {
|
|
107
154
|
// String array
|
|
108
155
|
if (allItemsAreString(newValue)) {
|
|
109
156
|
this.valueExist = newValue.includes(this.value);
|
|
110
|
-
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
157
|
+
this.options = newValue.map((item) => ({ title: item, value: item }));
|
|
111
158
|
}
|
|
112
159
|
// Object array
|
|
113
160
|
else if (newValue && newValue.every(item => isOption(item))) {
|
|
114
161
|
this.valueExist = newValue.map(item => item.value).includes(this.value);
|
|
115
162
|
// Grouped object options
|
|
116
|
-
if (newValue.some(
|
|
163
|
+
if (newValue.some(item => item.group !== undefined)) {
|
|
117
164
|
this.options = newValue.reduce(groupOptions, []);
|
|
118
165
|
}
|
|
119
166
|
// Standart object options
|
|
@@ -126,49 +173,43 @@ export class MgInputSelect {
|
|
|
126
173
|
}
|
|
127
174
|
}
|
|
128
175
|
/**
|
|
129
|
-
*
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (!this.readonly && this.input !== undefined) {
|
|
133
|
-
const validity = this.input.checkValidity && this.input.checkValidity();
|
|
134
|
-
// Set validity
|
|
135
|
-
this.valid = validity;
|
|
136
|
-
this.invalid = !validity;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Check input errors
|
|
176
|
+
* Public method to display errors
|
|
177
|
+
*
|
|
178
|
+
* @returns {Promise<void>}
|
|
141
179
|
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.
|
|
145
|
-
if (!this.valid && this.input.validity.valueMissing) {
|
|
146
|
-
this.errorMessage = messages.errors.required;
|
|
147
|
-
}
|
|
148
|
-
// Update class
|
|
149
|
-
if (this.valid) {
|
|
150
|
-
this.classList.delete(this.classError);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
this.classList.add(this.classError);
|
|
154
|
-
}
|
|
180
|
+
async displayError() {
|
|
181
|
+
this.checkValidity();
|
|
182
|
+
this.checkError();
|
|
155
183
|
}
|
|
156
184
|
/*************
|
|
157
185
|
* Lifecycle *
|
|
158
186
|
*************/
|
|
187
|
+
/**
|
|
188
|
+
* Check if component props are well configured on init
|
|
189
|
+
*
|
|
190
|
+
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
191
|
+
*/
|
|
159
192
|
componentWillLoad() {
|
|
160
193
|
// Check items format
|
|
161
194
|
this.validateItems(this.items);
|
|
195
|
+
// Check validity when component is ready
|
|
162
196
|
// return a promise to process action only in the FIRST render().
|
|
163
197
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
164
|
-
return setTimeout(() =>
|
|
198
|
+
return setTimeout(() => {
|
|
199
|
+
this.checkValidity();
|
|
200
|
+
}, 0);
|
|
165
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Render
|
|
204
|
+
*
|
|
205
|
+
* @returns {HTMLElement} HTML Element
|
|
206
|
+
*/
|
|
166
207
|
render() {
|
|
167
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, width: this.width, disabled: this.disabled, value: this.value, readonlyValue:
|
|
208
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, width: this.width, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
|
|
168
209
|
h("select", { class: "mg-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => (this.input = el) },
|
|
169
210
|
(!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
170
211
|
h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)),
|
|
171
|
-
this.options.map(
|
|
212
|
+
this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
|
|
172
213
|
}
|
|
173
214
|
static get is() { return "mg-input-select"; }
|
|
174
215
|
static get encapsulation() { return "shadow"; }
|
|
@@ -264,7 +305,7 @@ export class MgInputSelect {
|
|
|
264
305
|
"optional": false,
|
|
265
306
|
"docs": {
|
|
266
307
|
"tags": [],
|
|
267
|
-
"text": "Input label
|
|
308
|
+
"text": "Input label"
|
|
268
309
|
},
|
|
269
310
|
"attribute": "label",
|
|
270
311
|
"reflect": false
|
|
@@ -507,7 +548,8 @@ export class MgInputSelect {
|
|
|
507
548
|
"classList": {},
|
|
508
549
|
"errorMessage": {},
|
|
509
550
|
"options": {},
|
|
510
|
-
"valueExist": {}
|
|
551
|
+
"valueExist": {},
|
|
552
|
+
"readonlyValue": {}
|
|
511
553
|
}; }
|
|
512
554
|
static get events() { return [{
|
|
513
555
|
"method": "valueChange",
|
|
@@ -517,15 +559,54 @@ export class MgInputSelect {
|
|
|
517
559
|
"composed": true,
|
|
518
560
|
"docs": {
|
|
519
561
|
"tags": [],
|
|
520
|
-
"text": "
|
|
562
|
+
"text": "Emited event when value change"
|
|
521
563
|
},
|
|
522
564
|
"complexType": {
|
|
523
|
-
"original": "
|
|
524
|
-
"resolved": "
|
|
565
|
+
"original": "any",
|
|
566
|
+
"resolved": "any",
|
|
567
|
+
"references": {}
|
|
568
|
+
}
|
|
569
|
+
}, {
|
|
570
|
+
"method": "inputValid",
|
|
571
|
+
"name": "input-valid",
|
|
572
|
+
"bubbles": true,
|
|
573
|
+
"cancelable": true,
|
|
574
|
+
"composed": true,
|
|
575
|
+
"docs": {
|
|
576
|
+
"tags": [],
|
|
577
|
+
"text": "Emited event when checking validity"
|
|
578
|
+
},
|
|
579
|
+
"complexType": {
|
|
580
|
+
"original": "boolean",
|
|
581
|
+
"resolved": "boolean",
|
|
525
582
|
"references": {}
|
|
526
583
|
}
|
|
527
584
|
}]; }
|
|
585
|
+
static get methods() { return {
|
|
586
|
+
"displayError": {
|
|
587
|
+
"complexType": {
|
|
588
|
+
"signature": "() => Promise<void>",
|
|
589
|
+
"parameters": [],
|
|
590
|
+
"references": {
|
|
591
|
+
"Promise": {
|
|
592
|
+
"location": "global"
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
"return": "Promise<void>"
|
|
596
|
+
},
|
|
597
|
+
"docs": {
|
|
598
|
+
"text": "Public method to display errors",
|
|
599
|
+
"tags": [{
|
|
600
|
+
"name": "returns",
|
|
601
|
+
"text": undefined
|
|
602
|
+
}]
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}; }
|
|
528
606
|
static get watchers() { return [{
|
|
607
|
+
"propName": "value",
|
|
608
|
+
"methodName": "handleValue"
|
|
609
|
+
}, {
|
|
529
610
|
"propName": "items",
|
|
530
611
|
"methodName": "validateItems"
|
|
531
612
|
}]; }
|
package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.stories.js
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
+
import { messages } from '../../../../locales';
|
|
2
3
|
export default {
|
|
3
4
|
component: 'mg-input-select',
|
|
4
5
|
title: 'Molecules/Inputs/mg-input-select',
|
|
6
|
+
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
7
|
+
argTypes: {
|
|
8
|
+
placeholder: {
|
|
9
|
+
table: {
|
|
10
|
+
defaultValue: { summary: messages.input.select.placeholder },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
5
14
|
};
|
|
6
15
|
/**
|
|
7
16
|
* 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
|
|
8
17
|
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
18
|
+
*
|
|
19
|
+
* @param {any} args component arguments
|
|
20
|
+
* @returns {HTMLElement} HTMLElement
|
|
9
21
|
*/
|
|
10
|
-
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
const Template = (args) => {
|
|
11
24
|
const labelOnTop = args.labelOnTop;
|
|
12
25
|
delete args.labelOnTop;
|
|
13
26
|
const labelHide = args.labelHide;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
align-items: flex-start;
|
|
11
11
|
min-height: var(--default-size);
|
|
12
12
|
max-width: 100%;
|
|
13
|
+
margin-bottom: var(--mg-inputs-margin-bottom, 0);
|
|
13
14
|
/* Style when input is not valid */
|
|
14
15
|
/* Label */
|
|
15
16
|
/* Label-on-top */
|
|
@@ -96,6 +97,7 @@
|
|
|
96
97
|
*/
|
|
97
98
|
.mg-input__box {
|
|
98
99
|
padding: calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2) var(--mg-inputs-spacer);
|
|
100
|
+
width: 100%;
|
|
99
101
|
height: var(--default-size);
|
|
100
102
|
box-sizing: border-box;
|
|
101
103
|
border-width: var(--mg-inputs-border-width);
|
|
@@ -145,6 +147,31 @@
|
|
|
145
147
|
display: none;
|
|
146
148
|
}
|
|
147
149
|
|
|
150
|
+
.mg-input.mg-input--label-on-top .mg-input__box {
|
|
151
|
+
width: auto;
|
|
152
|
+
max-width: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]) {
|
|
156
|
+
--mg-button-border-radius-top-right: 0;
|
|
157
|
+
--mg-button-border-radius-bottom-right: 0;
|
|
158
|
+
--mg-button-border-radius-top-left: 0;
|
|
159
|
+
/* IE FIX */
|
|
160
|
+
--mg-button-border-radius-bottom-left: 0;
|
|
161
|
+
/* IE FIX */
|
|
162
|
+
}
|
|
163
|
+
.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)) {
|
|
164
|
+
--mg-button-border-right-width: 0;
|
|
165
|
+
}
|
|
166
|
+
.mg-input.mg-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type) {
|
|
167
|
+
--mg-button-border-radius-top-right: var(--mg-inputs-border-radius);
|
|
168
|
+
--mg-button-border-radius-bottom-right: var(--mg-inputs-border-radius);
|
|
169
|
+
--mg-button-border-radius-top-left: 0;
|
|
170
|
+
/* IE FIX */
|
|
171
|
+
--mg-button-border-radius-bottom-left: 0;
|
|
172
|
+
/* IE FIX */
|
|
173
|
+
}
|
|
174
|
+
|
|
148
175
|
.mg-input.mg-input--is-append-input-slot-content:not(.mg-input--readonly) ::slotted([slot=append-input]) {
|
|
149
176
|
padding-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
150
177
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Component, Event, h, Prop, State, Element } from '@stencil/core';
|
|
1
|
+
import { Component, Event, h, Prop, State, Element, Method, Watch } from '@stencil/core';
|
|
2
2
|
import { MgInput } from '../MgInput';
|
|
3
|
+
import { InputClass } from '../MgInput.conf';
|
|
3
4
|
import { createID, ClassList } from '../../../../utils/components.utils';
|
|
4
5
|
import { messages } from '../../../../locales';
|
|
5
|
-
import { InputClass } from '../MgInput.conf';
|
|
6
6
|
export class MgInputText {
|
|
7
7
|
constructor() {
|
|
8
8
|
/************
|
|
@@ -10,6 +10,7 @@ export class MgInputText {
|
|
|
10
10
|
************/
|
|
11
11
|
// classes
|
|
12
12
|
this.classFocus = 'is-focused';
|
|
13
|
+
this.isInputGroupAppend = 'mg-input--is-input-group-append';
|
|
13
14
|
this.classError = InputClass.ERROR;
|
|
14
15
|
/**
|
|
15
16
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
@@ -59,14 +60,17 @@ export class MgInputText {
|
|
|
59
60
|
this.classList = new ClassList(['mg-input--text']);
|
|
60
61
|
/**
|
|
61
62
|
* Handle input event
|
|
63
|
+
*
|
|
64
|
+
* @returns {void}
|
|
62
65
|
*/
|
|
63
66
|
this.handleInput = () => {
|
|
64
67
|
this.checkValidity();
|
|
65
68
|
this.value = this.input.value;
|
|
66
|
-
this.valueChange.emit(this.value);
|
|
67
69
|
};
|
|
68
70
|
/**
|
|
69
71
|
* Handle focus event
|
|
72
|
+
*
|
|
73
|
+
* @returns {void}
|
|
70
74
|
*/
|
|
71
75
|
this.handleFocus = () => {
|
|
72
76
|
this.classList.add(this.classFocus);
|
|
@@ -74,6 +78,8 @@ export class MgInputText {
|
|
|
74
78
|
};
|
|
75
79
|
/**
|
|
76
80
|
* Handle blur event
|
|
81
|
+
*
|
|
82
|
+
* @returns {void}
|
|
77
83
|
*/
|
|
78
84
|
this.handleBlur = () => {
|
|
79
85
|
// Manage focus
|
|
@@ -83,8 +89,49 @@ export class MgInputText {
|
|
|
83
89
|
this.checkValidity();
|
|
84
90
|
this.checkError();
|
|
85
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Check if input is valid
|
|
94
|
+
*
|
|
95
|
+
* @returns {void}
|
|
96
|
+
*/
|
|
97
|
+
this.checkValidity = () => {
|
|
98
|
+
if (!this.readonly && this.input !== undefined) {
|
|
99
|
+
const validity = this.input.checkValidity();
|
|
100
|
+
// Set validity
|
|
101
|
+
this.valid = validity;
|
|
102
|
+
this.invalid = !validity;
|
|
103
|
+
//Send event
|
|
104
|
+
this.inputValid.emit(validity);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Check input errors
|
|
109
|
+
*
|
|
110
|
+
* @returns {void}
|
|
111
|
+
*/
|
|
112
|
+
this.checkError = () => {
|
|
113
|
+
// Set error message
|
|
114
|
+
this.errorMessage = undefined;
|
|
115
|
+
// Does not match pattern
|
|
116
|
+
if (!this.valid && this.input.validity.patternMismatch) {
|
|
117
|
+
this.errorMessage = this.patternErrorMessage;
|
|
118
|
+
}
|
|
119
|
+
// required
|
|
120
|
+
else if (!this.valid && this.input.validity.valueMissing) {
|
|
121
|
+
this.errorMessage = messages.errors.required;
|
|
122
|
+
}
|
|
123
|
+
// Update class
|
|
124
|
+
if (this.valid) {
|
|
125
|
+
this.classList.delete(this.classError);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.classList.add(this.classError);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
86
131
|
/**
|
|
87
132
|
* Validate patern configuration
|
|
133
|
+
*
|
|
134
|
+
* @returns {void}
|
|
88
135
|
*/
|
|
89
136
|
this.validatePattern = () => {
|
|
90
137
|
if (this.pattern &&
|
|
@@ -94,72 +141,68 @@ export class MgInputText {
|
|
|
94
141
|
throw new Error('<mg-input-text> prop "pattern" must be paired with the prop "patternErrorMessage"');
|
|
95
142
|
}
|
|
96
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* Validate append slot
|
|
146
|
+
*
|
|
147
|
+
* @returns {void}
|
|
148
|
+
*/
|
|
149
|
+
this.validateAppendSlot = () => {
|
|
150
|
+
const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
|
|
151
|
+
if (slotAppendInput.length === 1) {
|
|
152
|
+
this.classList.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.isInputGroupAppend : 'mg-input--is-append-input-slot-content');
|
|
153
|
+
}
|
|
154
|
+
else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
|
|
155
|
+
this.classList.add(this.isInputGroupAppend);
|
|
156
|
+
this.classList.add('mg-input--has-buttons-group-append');
|
|
157
|
+
}
|
|
158
|
+
};
|
|
97
159
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*/
|
|
101
|
-
checkValidity() {
|
|
102
|
-
if (!this.readonly && this.input !== undefined) {
|
|
103
|
-
const validity = this.input.checkValidity();
|
|
104
|
-
// Set validity
|
|
105
|
-
this.valid = validity;
|
|
106
|
-
this.invalid = !validity;
|
|
107
|
-
}
|
|
160
|
+
handleValue(newValue) {
|
|
161
|
+
this.valueChange.emit(newValue);
|
|
108
162
|
}
|
|
109
163
|
/**
|
|
110
|
-
*
|
|
164
|
+
* Public method to play input focus
|
|
165
|
+
*
|
|
166
|
+
* @returns {Promise<void>}
|
|
111
167
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.errorMessage = undefined;
|
|
115
|
-
// Does not match pattern
|
|
116
|
-
if (!this.valid && this.input.validity.patternMismatch) {
|
|
117
|
-
this.errorMessage = this.patternErrorMessage;
|
|
118
|
-
}
|
|
119
|
-
// required
|
|
120
|
-
else if (!this.valid && this.input.validity.valueMissing) {
|
|
121
|
-
this.errorMessage = messages.errors.required;
|
|
122
|
-
}
|
|
123
|
-
// Update class
|
|
124
|
-
if (this.valid) {
|
|
125
|
-
this.classList.delete(this.classError);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
this.classList.add(this.classError);
|
|
129
|
-
}
|
|
168
|
+
async setFocus() {
|
|
169
|
+
this.input.focus();
|
|
130
170
|
}
|
|
131
171
|
/**
|
|
132
|
-
*
|
|
172
|
+
* Public method to display errors
|
|
173
|
+
*
|
|
174
|
+
* @returns {Promise<void>}
|
|
133
175
|
*/
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this.classList.add('mg-input--is-input-group-append');
|
|
138
|
-
this.classList = new ClassList(this.classList.classes);
|
|
139
|
-
}
|
|
140
|
-
else if (slotAppendInput !== null) {
|
|
141
|
-
this.classList.add('mg-input--is-append-input-slot-content');
|
|
142
|
-
this.classList = new ClassList(this.classList.classes);
|
|
143
|
-
}
|
|
176
|
+
async displayError() {
|
|
177
|
+
this.checkValidity();
|
|
178
|
+
this.checkError();
|
|
144
179
|
}
|
|
145
180
|
/*************
|
|
146
181
|
* Lifecycle *
|
|
147
182
|
*************/
|
|
148
183
|
/**
|
|
149
184
|
* Check if component props are well configured on init
|
|
185
|
+
*
|
|
186
|
+
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
150
187
|
*/
|
|
151
188
|
componentWillLoad() {
|
|
152
189
|
if (this.icon !== undefined) {
|
|
153
190
|
this.classList.add('mg-input--has-icon');
|
|
154
191
|
}
|
|
155
192
|
this.validatePattern();
|
|
193
|
+
this.validateAppendSlot();
|
|
194
|
+
// Check validity when component is ready
|
|
156
195
|
// return a promise to process action only in the FIRST render().
|
|
157
196
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
158
|
-
return setTimeout(() =>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.validateAppendSlot();
|
|
197
|
+
return setTimeout(() => {
|
|
198
|
+
this.checkValidity();
|
|
199
|
+
}, 0);
|
|
162
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Render
|
|
203
|
+
*
|
|
204
|
+
* @returns {HTMLElement} HTML Element
|
|
205
|
+
*/
|
|
163
206
|
render() {
|
|
164
207
|
return (h(MgInput, { identifier: this.identifier, classList: this.classList, label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, width: this.width, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, displayCharacterLeft: this.displayCharacterLeft, characterLeftTemplate: this.characterLeftTemplate, maxlength: this.maxlength, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
|
|
165
208
|
this.icon !== undefined && h("mg-icon", { icon: this.icon }),
|
|
@@ -201,7 +244,7 @@ export class MgInputText {
|
|
|
201
244
|
"references": {}
|
|
202
245
|
},
|
|
203
246
|
"required": false,
|
|
204
|
-
"optional":
|
|
247
|
+
"optional": false,
|
|
205
248
|
"docs": {
|
|
206
249
|
"tags": [],
|
|
207
250
|
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
@@ -219,7 +262,7 @@ export class MgInputText {
|
|
|
219
262
|
"references": {}
|
|
220
263
|
},
|
|
221
264
|
"required": false,
|
|
222
|
-
"optional":
|
|
265
|
+
"optional": false,
|
|
223
266
|
"docs": {
|
|
224
267
|
"tags": [],
|
|
225
268
|
"text": "Input name\nIf not set the value equals the identifier"
|
|
@@ -240,7 +283,7 @@ export class MgInputText {
|
|
|
240
283
|
"optional": false,
|
|
241
284
|
"docs": {
|
|
242
285
|
"tags": [],
|
|
243
|
-
"text": "Input label
|
|
286
|
+
"text": "Input label"
|
|
244
287
|
},
|
|
245
288
|
"attribute": "label",
|
|
246
289
|
"reflect": false
|
|
@@ -542,7 +585,7 @@ export class MgInputText {
|
|
|
542
585
|
"optional": false,
|
|
543
586
|
"docs": {
|
|
544
587
|
"tags": [],
|
|
545
|
-
"text": "Define input
|
|
588
|
+
"text": "Define input valid state"
|
|
546
589
|
},
|
|
547
590
|
"attribute": "valid",
|
|
548
591
|
"reflect": false
|
|
@@ -559,7 +602,7 @@ export class MgInputText {
|
|
|
559
602
|
"optional": false,
|
|
560
603
|
"docs": {
|
|
561
604
|
"tags": [],
|
|
562
|
-
"text": "Define input
|
|
605
|
+
"text": "Define input invalid state"
|
|
563
606
|
},
|
|
564
607
|
"attribute": "invalid",
|
|
565
608
|
"reflect": false
|
|
@@ -577,13 +620,72 @@ export class MgInputText {
|
|
|
577
620
|
"composed": true,
|
|
578
621
|
"docs": {
|
|
579
622
|
"tags": [],
|
|
580
|
-
"text": "
|
|
623
|
+
"text": "Emited event when value change"
|
|
581
624
|
},
|
|
582
625
|
"complexType": {
|
|
583
626
|
"original": "string",
|
|
584
627
|
"resolved": "string",
|
|
585
628
|
"references": {}
|
|
586
629
|
}
|
|
630
|
+
}, {
|
|
631
|
+
"method": "inputValid",
|
|
632
|
+
"name": "input-valid",
|
|
633
|
+
"bubbles": true,
|
|
634
|
+
"cancelable": true,
|
|
635
|
+
"composed": true,
|
|
636
|
+
"docs": {
|
|
637
|
+
"tags": [],
|
|
638
|
+
"text": "Emited event when checking validity"
|
|
639
|
+
},
|
|
640
|
+
"complexType": {
|
|
641
|
+
"original": "boolean",
|
|
642
|
+
"resolved": "boolean",
|
|
643
|
+
"references": {}
|
|
644
|
+
}
|
|
587
645
|
}]; }
|
|
646
|
+
static get methods() { return {
|
|
647
|
+
"setFocus": {
|
|
648
|
+
"complexType": {
|
|
649
|
+
"signature": "() => Promise<void>",
|
|
650
|
+
"parameters": [],
|
|
651
|
+
"references": {
|
|
652
|
+
"Promise": {
|
|
653
|
+
"location": "global"
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
"return": "Promise<void>"
|
|
657
|
+
},
|
|
658
|
+
"docs": {
|
|
659
|
+
"text": "Public method to play input focus",
|
|
660
|
+
"tags": [{
|
|
661
|
+
"name": "returns",
|
|
662
|
+
"text": undefined
|
|
663
|
+
}]
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
"displayError": {
|
|
667
|
+
"complexType": {
|
|
668
|
+
"signature": "() => Promise<void>",
|
|
669
|
+
"parameters": [],
|
|
670
|
+
"references": {
|
|
671
|
+
"Promise": {
|
|
672
|
+
"location": "global"
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
"return": "Promise<void>"
|
|
676
|
+
},
|
|
677
|
+
"docs": {
|
|
678
|
+
"text": "Public method to display errors",
|
|
679
|
+
"tags": [{
|
|
680
|
+
"name": "returns",
|
|
681
|
+
"text": undefined
|
|
682
|
+
}]
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}; }
|
|
588
686
|
static get elementRef() { return "element"; }
|
|
687
|
+
static get watchers() { return [{
|
|
688
|
+
"propName": "value",
|
|
689
|
+
"methodName": "handleValue"
|
|
690
|
+
}]; }
|
|
589
691
|
}
|