@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,4 +1,4 @@
|
|
|
1
|
-
import { Component, Event, h, Prop, State, Watch } from '@stencil/core';
|
|
1
|
+
import { Component, Event, h, Prop, State, Watch, Method } from '@stencil/core';
|
|
2
2
|
import { MgInput } from '../MgInput';
|
|
3
3
|
import { InputError } from './mg-input-date.conf';
|
|
4
4
|
import { createID, ClassList } from '../../../../utils/components.utils';
|
|
@@ -48,7 +48,6 @@ export class MgInputDate {
|
|
|
48
48
|
this.handleInput = () => {
|
|
49
49
|
this.checkValidity();
|
|
50
50
|
this.value = this.input.value;
|
|
51
|
-
this.valueChange.emit(this.value);
|
|
52
51
|
};
|
|
53
52
|
/**
|
|
54
53
|
* Handle blur event
|
|
@@ -57,9 +56,23 @@ export class MgInputDate {
|
|
|
57
56
|
this.checkValidity();
|
|
58
57
|
this.checkError();
|
|
59
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Check if input is valid
|
|
61
|
+
*/
|
|
62
|
+
this.checkValidity = () => {
|
|
63
|
+
if (!this.readonly && this.input !== undefined) {
|
|
64
|
+
const validity = this.input.checkValidity();
|
|
65
|
+
// Set validity
|
|
66
|
+
this.valid = validity;
|
|
67
|
+
this.invalid = !validity;
|
|
68
|
+
//Send event
|
|
69
|
+
this.inputValid.emit(validity);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
60
72
|
/**
|
|
61
73
|
* get input error code
|
|
62
|
-
*
|
|
74
|
+
*
|
|
75
|
+
* @returns {null | InputError} error code
|
|
63
76
|
*/
|
|
64
77
|
this.getInputError = () => {
|
|
65
78
|
var _a, _b;
|
|
@@ -82,11 +95,52 @@ export class MgInputDate {
|
|
|
82
95
|
}
|
|
83
96
|
return inputError;
|
|
84
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Set error message
|
|
100
|
+
*
|
|
101
|
+
* @returns {void}
|
|
102
|
+
*/
|
|
103
|
+
this.setErrorMessage = () => {
|
|
104
|
+
var _a;
|
|
105
|
+
const inputError = this.getInputError();
|
|
106
|
+
// required
|
|
107
|
+
if (inputError === InputError.REQUIRED) {
|
|
108
|
+
this.errorMessage = messages.errors[inputError];
|
|
109
|
+
}
|
|
110
|
+
// min, max & minMax
|
|
111
|
+
else if ([InputError.MIN, InputError.MAX, InputError.MINMAX].includes(inputError)) {
|
|
112
|
+
this.errorMessage = messages.errors.date[inputError].replace('{min}', localeDate(this.min)).replace('{max}', localeDate(this.max));
|
|
113
|
+
}
|
|
114
|
+
// wrong date format
|
|
115
|
+
// element.validity.badInput is default error message
|
|
116
|
+
else {
|
|
117
|
+
this.errorMessage = messages.errors.date.badInput.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? localeDate(this.min) : localeDate('1900-01-01'));
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Check input errors
|
|
122
|
+
*
|
|
123
|
+
* @returns {void}
|
|
124
|
+
*/
|
|
125
|
+
this.checkError = () => {
|
|
126
|
+
// Set error message
|
|
127
|
+
this.errorMessage = undefined;
|
|
128
|
+
if (!this.valid) {
|
|
129
|
+
this.setErrorMessage();
|
|
130
|
+
this.classList.add(this.classError);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.classList.delete(this.classError);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
85
136
|
}
|
|
86
137
|
validateValue(newValue) {
|
|
87
138
|
if (newValue !== undefined && newValue !== '' && !(typeof newValue === 'string' && dateRegExp.test(newValue))) {
|
|
88
139
|
throw new Error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
89
140
|
}
|
|
141
|
+
else {
|
|
142
|
+
this.valueChange.emit(this.value);
|
|
143
|
+
}
|
|
90
144
|
}
|
|
91
145
|
validateMin(newValue) {
|
|
92
146
|
this.validateDateFormat(newValue);
|
|
@@ -94,71 +148,50 @@ export class MgInputDate {
|
|
|
94
148
|
validateMax(newValue) {
|
|
95
149
|
this.validateDateFormat(newValue);
|
|
96
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Public method to display errors
|
|
153
|
+
*
|
|
154
|
+
* @returns {Promise<void>}
|
|
155
|
+
*/
|
|
156
|
+
async displayError() {
|
|
157
|
+
this.checkValidity();
|
|
158
|
+
this.checkError();
|
|
159
|
+
}
|
|
97
160
|
/**
|
|
98
161
|
* Date format validation
|
|
99
|
-
*
|
|
162
|
+
*
|
|
163
|
+
* @param {string} date date to validate
|
|
164
|
+
* @returns {void}
|
|
100
165
|
*/
|
|
101
166
|
validateDateFormat(date) {
|
|
102
167
|
if ((date === null || date === void 0 ? void 0 : date.length) > 0 && !(typeof date === 'string' && dateRegExp.test(date))) {
|
|
103
168
|
throw new Error("<mg-input-date> props 'min/max' doesn't match pattern: yyyy-mm-dd");
|
|
104
169
|
}
|
|
105
170
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Check if input is valid
|
|
108
|
-
*/
|
|
109
|
-
checkValidity() {
|
|
110
|
-
if (!this.readonly && this.input !== undefined) {
|
|
111
|
-
const validity = this.input.checkValidity();
|
|
112
|
-
// Set validity
|
|
113
|
-
this.valid = validity;
|
|
114
|
-
this.invalid = !validity;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Set error message
|
|
119
|
-
*/
|
|
120
|
-
setErrorMessage() {
|
|
121
|
-
var _a;
|
|
122
|
-
const inputError = this.getInputError();
|
|
123
|
-
// required
|
|
124
|
-
if (inputError === InputError.REQUIRED) {
|
|
125
|
-
this.errorMessage = messages.errors[inputError];
|
|
126
|
-
}
|
|
127
|
-
// min, max & minMax
|
|
128
|
-
else if ([InputError.MIN, InputError.MAX, InputError.MINMAX].includes(inputError)) {
|
|
129
|
-
this.errorMessage = messages.errors.date[inputError].replace('{min}', localeDate(this.min)).replace('{max}', localeDate(this.max));
|
|
130
|
-
}
|
|
131
|
-
// wrong date format
|
|
132
|
-
// element.validity.badInput is default error message
|
|
133
|
-
else {
|
|
134
|
-
this.errorMessage = messages.errors.date.badInput.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? localeDate(this.min) : localeDate('1900-01-01'));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Check input errors
|
|
139
|
-
*/
|
|
140
|
-
checkError() {
|
|
141
|
-
// Set error message
|
|
142
|
-
this.errorMessage = undefined;
|
|
143
|
-
if (!this.valid) {
|
|
144
|
-
this.setErrorMessage();
|
|
145
|
-
this.classList.add(this.classError);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
this.classList.delete(this.classError);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
171
|
/*************
|
|
152
172
|
* Lifecycle *
|
|
153
173
|
*************/
|
|
174
|
+
/**
|
|
175
|
+
* Check if component props are well configured on init
|
|
176
|
+
*
|
|
177
|
+
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
178
|
+
*/
|
|
154
179
|
componentWillLoad() {
|
|
155
180
|
this.validateValue(this.value);
|
|
156
181
|
this.validateMin(this.min);
|
|
157
182
|
this.validateMax(this.max);
|
|
183
|
+
// Check validity when component is ready
|
|
158
184
|
// return a promise to process action only in the FIRST render().
|
|
159
185
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
160
|
-
return setTimeout(() =>
|
|
186
|
+
return setTimeout(() => {
|
|
187
|
+
this.checkValidity();
|
|
188
|
+
}, 0);
|
|
161
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Render
|
|
192
|
+
*
|
|
193
|
+
* @returns {HTMLElement} HTML Element
|
|
194
|
+
*/
|
|
162
195
|
render() {
|
|
163
196
|
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: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value), tooltip: this.tooltip, displayCharacterLeft: undefined, characterLeftTemplate: undefined, maxlength: undefined, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false },
|
|
164
197
|
h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, pattern: "[0-9]{4}-[0-9]{2}-[0-9]{2}", ref: el => (this.input = el) })));
|
|
@@ -198,7 +231,7 @@ export class MgInputDate {
|
|
|
198
231
|
"references": {}
|
|
199
232
|
},
|
|
200
233
|
"required": false,
|
|
201
|
-
"optional":
|
|
234
|
+
"optional": false,
|
|
202
235
|
"docs": {
|
|
203
236
|
"tags": [],
|
|
204
237
|
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
@@ -216,7 +249,7 @@ export class MgInputDate {
|
|
|
216
249
|
"references": {}
|
|
217
250
|
},
|
|
218
251
|
"required": false,
|
|
219
|
-
"optional":
|
|
252
|
+
"optional": false,
|
|
220
253
|
"docs": {
|
|
221
254
|
"tags": [],
|
|
222
255
|
"text": "Input name\nIf not set the value equals the identifier"
|
|
@@ -237,7 +270,7 @@ export class MgInputDate {
|
|
|
237
270
|
"optional": false,
|
|
238
271
|
"docs": {
|
|
239
272
|
"tags": [],
|
|
240
|
-
"text": "Input label
|
|
273
|
+
"text": "Input label"
|
|
241
274
|
},
|
|
242
275
|
"attribute": "label",
|
|
243
276
|
"reflect": false
|
|
@@ -377,7 +410,7 @@ export class MgInputDate {
|
|
|
377
410
|
"optional": false,
|
|
378
411
|
"docs": {
|
|
379
412
|
"tags": [],
|
|
380
|
-
"text": "Define input
|
|
413
|
+
"text": "Define input valid state"
|
|
381
414
|
},
|
|
382
415
|
"attribute": "valid",
|
|
383
416
|
"reflect": false
|
|
@@ -394,7 +427,7 @@ export class MgInputDate {
|
|
|
394
427
|
"optional": false,
|
|
395
428
|
"docs": {
|
|
396
429
|
"tags": [],
|
|
397
|
-
"text": "Define input
|
|
430
|
+
"text": "Define input invalid state"
|
|
398
431
|
},
|
|
399
432
|
"attribute": "invalid",
|
|
400
433
|
"reflect": false
|
|
@@ -446,14 +479,50 @@ export class MgInputDate {
|
|
|
446
479
|
"composed": true,
|
|
447
480
|
"docs": {
|
|
448
481
|
"tags": [],
|
|
449
|
-
"text": "
|
|
482
|
+
"text": "Emited event when value change"
|
|
450
483
|
},
|
|
451
484
|
"complexType": {
|
|
452
485
|
"original": "string",
|
|
453
486
|
"resolved": "string",
|
|
454
487
|
"references": {}
|
|
455
488
|
}
|
|
489
|
+
}, {
|
|
490
|
+
"method": "inputValid",
|
|
491
|
+
"name": "input-valid",
|
|
492
|
+
"bubbles": true,
|
|
493
|
+
"cancelable": true,
|
|
494
|
+
"composed": true,
|
|
495
|
+
"docs": {
|
|
496
|
+
"tags": [],
|
|
497
|
+
"text": "Emited event when checking validity"
|
|
498
|
+
},
|
|
499
|
+
"complexType": {
|
|
500
|
+
"original": "boolean",
|
|
501
|
+
"resolved": "boolean",
|
|
502
|
+
"references": {}
|
|
503
|
+
}
|
|
456
504
|
}]; }
|
|
505
|
+
static get methods() { return {
|
|
506
|
+
"displayError": {
|
|
507
|
+
"complexType": {
|
|
508
|
+
"signature": "() => Promise<void>",
|
|
509
|
+
"parameters": [],
|
|
510
|
+
"references": {
|
|
511
|
+
"Promise": {
|
|
512
|
+
"location": "global"
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
"return": "Promise<void>"
|
|
516
|
+
},
|
|
517
|
+
"docs": {
|
|
518
|
+
"text": "Public method to display errors",
|
|
519
|
+
"tags": [{
|
|
520
|
+
"name": "returns",
|
|
521
|
+
"text": undefined
|
|
522
|
+
}]
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}; }
|
|
457
526
|
static get watchers() { return [{
|
|
458
527
|
"propName": "value",
|
|
459
528
|
"methodName": "validateValue"
|
|
@@ -2,12 +2,17 @@ import { h } from '@stencil/core';
|
|
|
2
2
|
export default {
|
|
3
3
|
component: 'mg-input-date',
|
|
4
4
|
title: 'Molecules/Inputs/mg-input-date',
|
|
5
|
+
parameters: { actions: { handles: ['value-change', 'input-valid'] } },
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* 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
9
|
* 2. boolean arguments with a default true value must be added like display-character-left={args.displayCharacterLeft ? 'true' : 'false'}
|
|
10
|
+
*
|
|
11
|
+
* @param {any} args component arguments
|
|
12
|
+
* @returns {HTMLElement} HTMLElement
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const Template = (args) => {
|
|
11
16
|
const labelOnTop = args.labelOnTop;
|
|
12
17
|
delete args.labelOnTop;
|
|
13
18
|
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,10 +1,10 @@
|
|
|
1
|
-
import { Component, Element, Event, h, Prop, State, Watch } from '@stencil/core';
|
|
1
|
+
import { Component, Element, Event, h, Prop, State, Watch, Method } from '@stencil/core';
|
|
2
2
|
import { MgInput } from '../MgInput';
|
|
3
|
+
import { InputClass } from '../MgInput.conf';
|
|
3
4
|
import { types, InputError } from './mg-input-numeric.conf';
|
|
4
5
|
import { createID, ClassList } from '../../../../utils/components.utils';
|
|
5
6
|
import { messages } from '../../../../locales';
|
|
6
7
|
import { localeCurrency, localeNumber } from '../../../../utils/locale.utils';
|
|
7
|
-
import { InputClass } from '../MgInput.conf';
|
|
8
8
|
export class MgInputNumeric {
|
|
9
9
|
constructor() {
|
|
10
10
|
// Classes
|
|
@@ -53,8 +53,14 @@ export class MgInputNumeric {
|
|
|
53
53
|
* Component classes
|
|
54
54
|
*/
|
|
55
55
|
this.classList = new ClassList(['mg-input--numeric']);
|
|
56
|
+
/**
|
|
57
|
+
* Define if input has focus
|
|
58
|
+
*/
|
|
59
|
+
this.hasFocus = false;
|
|
56
60
|
/**
|
|
57
61
|
* Handle input event
|
|
62
|
+
*
|
|
63
|
+
* @returns {void}
|
|
58
64
|
*/
|
|
59
65
|
this.handleInput = () => {
|
|
60
66
|
// Check validity
|
|
@@ -63,23 +69,73 @@ export class MgInputNumeric {
|
|
|
63
69
|
};
|
|
64
70
|
/**
|
|
65
71
|
* Handle focus event
|
|
72
|
+
*
|
|
73
|
+
* @returns {void}
|
|
66
74
|
*/
|
|
67
75
|
this.handleFocus = () => {
|
|
68
|
-
this.
|
|
76
|
+
this.hasFocus = true;
|
|
69
77
|
};
|
|
70
78
|
/**
|
|
71
79
|
* Handle blur event
|
|
80
|
+
*
|
|
81
|
+
* @returns {void}
|
|
72
82
|
*/
|
|
73
83
|
this.handleBlur = () => {
|
|
74
84
|
// Check validity
|
|
75
85
|
this.checkValidity();
|
|
76
86
|
this.checkError();
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
this.hasFocus = false;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Check if input is valid
|
|
91
|
+
*
|
|
92
|
+
* @returns {void}
|
|
93
|
+
*/
|
|
94
|
+
this.checkValidity = () => {
|
|
95
|
+
if (!this.readonly) {
|
|
96
|
+
const validity = this.getInputError() === null;
|
|
97
|
+
// Set validity
|
|
98
|
+
this.valid = validity;
|
|
99
|
+
this.invalid = !validity;
|
|
100
|
+
//Send event
|
|
101
|
+
this.inputValid.emit(validity);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Set error message
|
|
106
|
+
*
|
|
107
|
+
* @returns {void}
|
|
108
|
+
*/
|
|
109
|
+
this.setErrorMessage = () => {
|
|
110
|
+
const inputError = this.getInputError();
|
|
111
|
+
if (inputError === InputError.REQUIRED) {
|
|
112
|
+
this.errorMessage = messages.errors[inputError];
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.errorMessage = messages.errors.numeric[inputError].replace('{min}', `${this.formatValue(this.min)}`).replace('{max}', `${this.formatValue(this.max)}`);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Check input errors
|
|
120
|
+
*
|
|
121
|
+
* @returns {void}
|
|
122
|
+
*/
|
|
123
|
+
this.checkError = () => {
|
|
124
|
+
// Set error message
|
|
125
|
+
this.errorMessage = undefined;
|
|
126
|
+
// Update class
|
|
127
|
+
if (!this.valid) {
|
|
128
|
+
this.setErrorMessage();
|
|
129
|
+
this.classList.add(this.classError);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
this.classList.delete(this.classError);
|
|
133
|
+
}
|
|
79
134
|
};
|
|
80
135
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
136
|
+
* Get input error code
|
|
137
|
+
*
|
|
138
|
+
* @returns {null | InputError} error code
|
|
83
139
|
*/
|
|
84
140
|
this.getInputError = () => {
|
|
85
141
|
let inputError = null;
|
|
@@ -90,7 +146,7 @@ export class MgInputNumeric {
|
|
|
90
146
|
inputError = InputError.REQUIRED;
|
|
91
147
|
}
|
|
92
148
|
// Min & Max
|
|
93
|
-
if (this.min !== undefined && this.numericValue < this.min && this.max === undefined) {
|
|
149
|
+
else if (this.min !== undefined && this.numericValue < this.min && this.max === undefined) {
|
|
94
150
|
// Only a min value is set
|
|
95
151
|
inputError = InputError.MIN;
|
|
96
152
|
}
|
|
@@ -106,10 +162,22 @@ export class MgInputNumeric {
|
|
|
106
162
|
};
|
|
107
163
|
/**
|
|
108
164
|
* Format value based on type
|
|
109
|
-
*
|
|
165
|
+
*
|
|
166
|
+
* @param {number} value value to format
|
|
110
167
|
* @returns {string} formated local value
|
|
111
168
|
*/
|
|
112
169
|
this.formatValue = (value) => (this.type === 'currency' ? localeCurrency(value) : localeNumber(value));
|
|
170
|
+
/**
|
|
171
|
+
* Validate append slot
|
|
172
|
+
*
|
|
173
|
+
* @returns {void}
|
|
174
|
+
*/
|
|
175
|
+
this.validateAppendSlot = () => {
|
|
176
|
+
const slotAppendInput = this.element.querySelector('[slot="append-input"]');
|
|
177
|
+
if (slotAppendInput !== null) {
|
|
178
|
+
this.classList.add(slotAppendInput.nodeName === 'MG-BUTTON' ? 'mg-input--is-input-group-append' : 'mg-input--is-append-input-slot-content');
|
|
179
|
+
}
|
|
180
|
+
};
|
|
113
181
|
}
|
|
114
182
|
validateValue(newValue) {
|
|
115
183
|
if (newValue !== undefined && newValue !== null) {
|
|
@@ -155,80 +223,52 @@ export class MgInputNumeric {
|
|
|
155
223
|
}
|
|
156
224
|
}
|
|
157
225
|
/**
|
|
158
|
-
*
|
|
226
|
+
* Public method to display errors
|
|
227
|
+
*
|
|
228
|
+
* @returns {Promise<void>}
|
|
159
229
|
*/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// Set validity
|
|
164
|
-
this.valid = validity;
|
|
165
|
-
this.invalid = !validity;
|
|
166
|
-
}
|
|
230
|
+
async displayError() {
|
|
231
|
+
this.checkValidity();
|
|
232
|
+
this.checkError();
|
|
167
233
|
}
|
|
168
234
|
/**
|
|
169
|
-
*
|
|
235
|
+
* Displayed value in input
|
|
236
|
+
* Change on focus/blur
|
|
237
|
+
*
|
|
238
|
+
* @returns {string} display value
|
|
170
239
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (inputError === InputError.REQUIRED) {
|
|
174
|
-
this.errorMessage = messages.errors[inputError];
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
this.errorMessage = messages.errors.numeric[inputError].replace('{min}', `${this.formatValue(this.min)}`).replace('{max}', `${this.formatValue(this.max)}`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Check input errors
|
|
182
|
-
*/
|
|
183
|
-
checkError() {
|
|
184
|
-
// Set error message
|
|
185
|
-
this.errorMessage = undefined;
|
|
186
|
-
// Update class
|
|
187
|
-
if (!this.valid) {
|
|
188
|
-
this.setErrorMessage();
|
|
189
|
-
this.classList.add(this.classError);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
this.classList.delete(this.classError);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Validate append slot
|
|
197
|
-
*/
|
|
198
|
-
validateAppendSlot() {
|
|
199
|
-
const slotAppendInput = this.element.querySelector('[slot="append-input"]');
|
|
200
|
-
if (slotAppendInput !== null && slotAppendInput.querySelector('.mg-button') !== null) {
|
|
201
|
-
this.classList.add('mg-input--is-input-group-append');
|
|
202
|
-
this.classList = new ClassList(this.classList.classes);
|
|
203
|
-
}
|
|
204
|
-
else if (slotAppendInput !== null) {
|
|
205
|
-
this.classList.add('mg-input--is-append-input-slot-content');
|
|
206
|
-
this.classList = new ClassList(this.classList.classes);
|
|
207
|
-
}
|
|
240
|
+
displayValue() {
|
|
241
|
+
return this.hasFocus ? this.value : this.readonlyValue;
|
|
208
242
|
}
|
|
209
243
|
/*************
|
|
210
244
|
* Lifecycle *
|
|
211
245
|
*************/
|
|
246
|
+
/**
|
|
247
|
+
* Check if component props are well configured on init
|
|
248
|
+
*
|
|
249
|
+
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
250
|
+
*/
|
|
212
251
|
componentWillLoad() {
|
|
213
252
|
this.validateValue(this.value);
|
|
214
|
-
// Set displayed value
|
|
215
|
-
this.displayValue = this.readonlyValue;
|
|
216
253
|
this.validateType(this.type);
|
|
217
254
|
this.validateIntegerLength(this.integerLength);
|
|
218
255
|
this.validateDecimalLength(this.decimalLength);
|
|
256
|
+
this.validateAppendSlot();
|
|
257
|
+
// Check validity when component is ready
|
|
219
258
|
// return a promise to process action only in the FIRST render().
|
|
220
259
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
221
|
-
return setTimeout(() =>
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this.validateAppendSlot();
|
|
260
|
+
return setTimeout(() => {
|
|
261
|
+
this.checkValidity();
|
|
262
|
+
}, 0);
|
|
225
263
|
}
|
|
226
264
|
/**
|
|
227
|
-
*
|
|
265
|
+
* Render
|
|
266
|
+
*
|
|
267
|
+
* @returns {HTMLElement} HTML Element
|
|
228
268
|
*/
|
|
229
269
|
render() {
|
|
230
270
|
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 },
|
|
231
|
-
h("input", { type: "text", class: "mg-input__box", value: this.displayValue, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }),
|
|
271
|
+
h("input", { type: "text", class: "mg-input__box", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => (this.input = el) }),
|
|
232
272
|
h("slot", { name: "append-input" })));
|
|
233
273
|
}
|
|
234
274
|
static get is() { return "mg-input-numeric"; }
|
|
@@ -266,7 +306,7 @@ export class MgInputNumeric {
|
|
|
266
306
|
"references": {}
|
|
267
307
|
},
|
|
268
308
|
"required": false,
|
|
269
|
-
"optional":
|
|
309
|
+
"optional": false,
|
|
270
310
|
"docs": {
|
|
271
311
|
"tags": [],
|
|
272
312
|
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)\nIf not set, it will be created."
|
|
@@ -284,7 +324,7 @@ export class MgInputNumeric {
|
|
|
284
324
|
"references": {}
|
|
285
325
|
},
|
|
286
326
|
"required": false,
|
|
287
|
-
"optional":
|
|
327
|
+
"optional": false,
|
|
288
328
|
"docs": {
|
|
289
329
|
"tags": [],
|
|
290
330
|
"text": "Input name\nIf not set the value equals the identifier"
|
|
@@ -305,7 +345,7 @@ export class MgInputNumeric {
|
|
|
305
345
|
"optional": false,
|
|
306
346
|
"docs": {
|
|
307
347
|
"tags": [],
|
|
308
|
-
"text": "Input label
|
|
348
|
+
"text": "Input label"
|
|
309
349
|
},
|
|
310
350
|
"attribute": "label",
|
|
311
351
|
"reflect": false
|
|
@@ -598,7 +638,7 @@ export class MgInputNumeric {
|
|
|
598
638
|
static get states() { return {
|
|
599
639
|
"classList": {},
|
|
600
640
|
"errorMessage": {},
|
|
601
|
-
"
|
|
641
|
+
"hasFocus": {}
|
|
602
642
|
}; }
|
|
603
643
|
static get events() { return [{
|
|
604
644
|
"method": "valueChange",
|
|
@@ -608,14 +648,50 @@ export class MgInputNumeric {
|
|
|
608
648
|
"composed": true,
|
|
609
649
|
"docs": {
|
|
610
650
|
"tags": [],
|
|
611
|
-
"text": "
|
|
651
|
+
"text": "Emited event when value change"
|
|
612
652
|
},
|
|
613
653
|
"complexType": {
|
|
614
654
|
"original": "number",
|
|
615
655
|
"resolved": "number",
|
|
616
656
|
"references": {}
|
|
617
657
|
}
|
|
658
|
+
}, {
|
|
659
|
+
"method": "inputValid",
|
|
660
|
+
"name": "input-valid",
|
|
661
|
+
"bubbles": true,
|
|
662
|
+
"cancelable": true,
|
|
663
|
+
"composed": true,
|
|
664
|
+
"docs": {
|
|
665
|
+
"tags": [],
|
|
666
|
+
"text": "Emited event when checking validity"
|
|
667
|
+
},
|
|
668
|
+
"complexType": {
|
|
669
|
+
"original": "boolean",
|
|
670
|
+
"resolved": "boolean",
|
|
671
|
+
"references": {}
|
|
672
|
+
}
|
|
618
673
|
}]; }
|
|
674
|
+
static get methods() { return {
|
|
675
|
+
"displayError": {
|
|
676
|
+
"complexType": {
|
|
677
|
+
"signature": "() => Promise<void>",
|
|
678
|
+
"parameters": [],
|
|
679
|
+
"references": {
|
|
680
|
+
"Promise": {
|
|
681
|
+
"location": "global"
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
"return": "Promise<void>"
|
|
685
|
+
},
|
|
686
|
+
"docs": {
|
|
687
|
+
"text": "Public method to display errors",
|
|
688
|
+
"tags": [{
|
|
689
|
+
"name": "returns",
|
|
690
|
+
"text": undefined
|
|
691
|
+
}]
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}; }
|
|
619
695
|
static get elementRef() { return "element"; }
|
|
620
696
|
static get watchers() { return [{
|
|
621
697
|
"propName": "value",
|