@maggioli-design-system/magma 1.11.1 → 1.11.2
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/loader.cjs.js +1 -1
- package/dist/cjs/magma-components.cjs.js +1 -1
- package/dist/cjs/mds-input-date-range.cjs.entry.js +67 -3
- package/dist/cjs/mds-input-date.cjs.entry.js +12 -3
- package/dist/cjs/mds-input-range.cjs.entry.js +1 -1
- package/dist/collection/components/mds-input-date/mds-input-date.js +25 -3
- package/dist/collection/components/mds-input-date-range/mds-input-date-range.js +85 -3
- package/dist/collection/components/mds-input-range/mds-input-range.js +20 -1
- package/dist/components/mds-input-date-range.js +66 -4
- package/dist/components/mds-input-date.js +8 -4
- package/dist/components/mds-input-range.js +2 -1
- package/dist/documentation.json +79 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/magma-components.js +1 -1
- package/dist/esm/mds-input-date-range.entry.js +67 -3
- package/dist/esm/mds-input-date.entry.js +12 -3
- package/dist/esm/mds-input-range.entry.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/magma-components.js +1 -1
- package/dist/esm-es5/mds-input-date-range.entry.js +1 -1
- package/dist/esm-es5/mds-input-date.entry.js +1 -1
- package/dist/esm-es5/mds-input-range.entry.js +1 -1
- package/dist/hydrate/index.js +88 -12
- package/dist/hydrate/index.mjs +88 -12
- package/dist/magma-components/magma-components.esm.js +1 -1
- package/dist/magma-components/p-26cd6ec8.system.js +1 -1
- package/dist/magma-components/{p-5fe92148.system.entry.js → p-3da97c74.system.entry.js} +1 -1
- package/dist/magma-components/{p-d5c9cff6.system.entry.js → p-8115a5c3.system.entry.js} +1 -1
- package/dist/magma-components/{p-36618607.system.entry.js → p-88a0f02c.system.entry.js} +1 -1
- package/dist/magma-components/p-987e1cd6.entry.js +1 -0
- package/dist/magma-components/p-e1f3cc6d.entry.js +1 -0
- package/dist/magma-components/p-ecb4d569.entry.js +1 -0
- package/dist/stats.json +185 -48
- package/dist/types/components/mds-input-date/mds-input-date.d.ts +5 -0
- package/dist/types/components/mds-input-date-range/mds-input-date-range.d.ts +12 -0
- package/dist/types/components/mds-input-range/mds-input-range.d.ts +4 -0
- package/dist/types/components.d.ts +24 -0
- package/package.json +1 -1
- package/dist/magma-components/p-6446a604.entry.js +0 -1
- package/dist/magma-components/p-99ac301a.entry.js +0 -1
- package/dist/magma-components/p-a818a6c0.entry.js +0 -1
|
@@ -74,6 +74,7 @@ export class MdsInputDate {
|
|
|
74
74
|
handleValue() {
|
|
75
75
|
this.valueChange.emit(this.value);
|
|
76
76
|
this.validateValue();
|
|
77
|
+
this.internals.setFormValue(this.value);
|
|
77
78
|
}
|
|
78
79
|
validateValue() {
|
|
79
80
|
const date = DateTime.fromISO(this.value);
|
|
@@ -120,10 +121,10 @@ export class MdsInputDate {
|
|
|
120
121
|
this.validateValue();
|
|
121
122
|
}
|
|
122
123
|
render() {
|
|
123
|
-
return (h(Host, { key: '
|
|
124
|
+
return (h(Host, { key: '5c8a9e0aa8f76679abfbdaa2c709ae11312ee46d' }, h("input", { key: '1f6dddc1ed8477f8b6160d90f7bf15c6d711ef95', value: this.value, id: "dateInput", class: "input", part: "input-date", type: "date", disabled: this.disabled, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.handleChange, onChange: this.handleChange }), !this.isSlotted && h("mds-button", { key: 'caefb1f5d8da17ea06dfc547902e19900cd02abf', id: "calendar-dropdown", class: "action-open-calendar", disabled: this.disabled, variant: "dark", tone: "quiet", icon: miBaselineCalendarToday, onClick: () => {
|
|
124
125
|
this.calendarKey += 1;
|
|
125
|
-
} }), h("mds-input-tip", { key: '
|
|
126
|
-
h("mds-input-tip-item", { key: '
|
|
126
|
+
} }), h("mds-input-tip", { key: '3f60d0e56e101776b19c1564d92f361b3f0178d7', lang: this.language, position: "top", active: this.hasFocus }, this.disabled && h("mds-input-tip-item", { key: '25a86b26eb2bd743d0291ff1514828274d13ae17', expanded: true, variant: "disabled" }), this.readonly && h("mds-input-tip-item", { key: 'c63d2f830dec87f180bc828b16cebd8e8d8a7060', expanded: true, variant: "readonly" }), this.required &&
|
|
127
|
+
h("mds-input-tip-item", { key: '2d2e3f021e3e4ef8c99be55132edf4f99be3b900', expanded: this.hasFocus, variant: this.isValid ? 'required-success' : 'required' })), !this.isSlotted && h("mds-dropdown", { key: '370a33a1f273a3eafc045c1e62c84db41ff52c23', placement: "bottom-end", "auto-placement": false, ref: el => this.dropdownRef = el, target: "#calendar-dropdown" }, h("mds-calendar", Object.assign({ key: this.calendarKey, rangePicker: false, lang: this.language, onMdsCalendarChange: ev => {
|
|
127
128
|
this.value = ev.detail.startDate;
|
|
128
129
|
if (this.delay === 0)
|
|
129
130
|
return;
|
|
@@ -137,6 +138,7 @@ export class MdsInputDate {
|
|
|
137
138
|
}
|
|
138
139
|
static get is() { return "mds-input-date"; }
|
|
139
140
|
static get encapsulation() { return "shadow"; }
|
|
141
|
+
static get formAssociated() { return true; }
|
|
140
142
|
static get originalStyleUrls() {
|
|
141
143
|
return {
|
|
142
144
|
"$": ["mds-input-date.css"]
|
|
@@ -172,6 +174,25 @@ export class MdsInputDate {
|
|
|
172
174
|
"reflect": true,
|
|
173
175
|
"defaultValue": "''"
|
|
174
176
|
},
|
|
177
|
+
"name": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"mutable": false,
|
|
180
|
+
"complexType": {
|
|
181
|
+
"original": "string",
|
|
182
|
+
"resolved": "string | undefined",
|
|
183
|
+
"references": {}
|
|
184
|
+
},
|
|
185
|
+
"required": false,
|
|
186
|
+
"optional": true,
|
|
187
|
+
"docs": {
|
|
188
|
+
"tags": [],
|
|
189
|
+
"text": "Is needed to reference the form data after the form is submitted"
|
|
190
|
+
},
|
|
191
|
+
"getter": false,
|
|
192
|
+
"setter": false,
|
|
193
|
+
"attribute": "name",
|
|
194
|
+
"reflect": true
|
|
195
|
+
},
|
|
175
196
|
"variant": {
|
|
176
197
|
"type": "string",
|
|
177
198
|
"mutable": true,
|
|
@@ -427,4 +448,5 @@ export class MdsInputDate {
|
|
|
427
448
|
"methodName": "handleValue"
|
|
428
449
|
}];
|
|
429
450
|
}
|
|
451
|
+
static get attachInternalsMemberName() { return "internals"; }
|
|
430
452
|
}
|
|
@@ -46,12 +46,15 @@ export class MdsInputDateRange {
|
|
|
46
46
|
this.delay = 500;
|
|
47
47
|
this.lastEmittedStartDate = null;
|
|
48
48
|
this.lastEmittedEndDate = null;
|
|
49
|
+
this.initialStartDate = '';
|
|
50
|
+
this.initialEndDate = '';
|
|
49
51
|
this.handleFocusOut = (event) => {
|
|
50
52
|
if (!this.host.contains(event.relatedTarget)) {
|
|
51
53
|
const startValid = DateTime.fromISO(this.internalStartDate).isValid;
|
|
52
54
|
const endValid = DateTime.fromISO(this.internalEndDate).isValid;
|
|
53
55
|
if (startValid && endValid) {
|
|
54
56
|
this.validateDateRange();
|
|
57
|
+
this.syncFormValue();
|
|
55
58
|
this.dateRangeSelected.emit({
|
|
56
59
|
startDate: this.internalStartDate,
|
|
57
60
|
endDate: this.internalEndDate,
|
|
@@ -92,10 +95,18 @@ export class MdsInputDateRange {
|
|
|
92
95
|
async updateLang() {
|
|
93
96
|
this.language = this.t.lang(this.host);
|
|
94
97
|
}
|
|
98
|
+
handleStartDateChange(newValue) {
|
|
99
|
+
this.syncExternalDate('start', newValue);
|
|
100
|
+
}
|
|
101
|
+
handleEndDateChange(newValue) {
|
|
102
|
+
this.syncExternalDate('end', newValue);
|
|
103
|
+
}
|
|
95
104
|
componentWillLoad() {
|
|
96
105
|
this.language = this.t.lang(this.host);
|
|
97
106
|
this.internalStartDate = this.startDate;
|
|
98
107
|
this.internalEndDate = this.endDate;
|
|
108
|
+
this.initialStartDate = this.startDate;
|
|
109
|
+
this.initialEndDate = this.endDate;
|
|
99
110
|
// Se max è precedente a min, imposto max uguale a min
|
|
100
111
|
if (this.min && this.max) {
|
|
101
112
|
const minDate = DateTime.fromISO(this.min);
|
|
@@ -104,6 +115,7 @@ export class MdsInputDateRange {
|
|
|
104
115
|
this.max = this.min;
|
|
105
116
|
}
|
|
106
117
|
}
|
|
118
|
+
this.syncFormValue();
|
|
107
119
|
}
|
|
108
120
|
disconnectedCallback() {
|
|
109
121
|
this.host.removeEventListener('focusout', this.handleFocusOut);
|
|
@@ -132,6 +144,7 @@ export class MdsInputDateRange {
|
|
|
132
144
|
this.internalEndDate = event.start;
|
|
133
145
|
}
|
|
134
146
|
this.updateInputValue('end', this.internalEndDate);
|
|
147
|
+
this.syncFormValue();
|
|
135
148
|
const calendar = (_b = (_a = this.host) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mds-calendar');
|
|
136
149
|
if (calendar) {
|
|
137
150
|
await calendar.updateCurrentDate(this.internalStartDate);
|
|
@@ -151,8 +164,35 @@ export class MdsInputDateRange {
|
|
|
151
164
|
this.updateInputListeners();
|
|
152
165
|
this.updateInputValue('start', this.internalStartDate);
|
|
153
166
|
this.updateInputValue('end', this.internalEndDate);
|
|
167
|
+
this.syncFormValue();
|
|
154
168
|
this.host.addEventListener('focusout', this.handleFocusOut);
|
|
155
169
|
}
|
|
170
|
+
formResetCallback() {
|
|
171
|
+
this.internalStartDate = this.initialStartDate;
|
|
172
|
+
this.internalEndDate = this.initialEndDate;
|
|
173
|
+
this.updateInputValue('start', this.internalStartDate);
|
|
174
|
+
this.updateInputValue('end', this.internalEndDate);
|
|
175
|
+
this.checkPreselections();
|
|
176
|
+
this.syncFormValue();
|
|
177
|
+
}
|
|
178
|
+
syncExternalDate(slotName, newValue) {
|
|
179
|
+
const normalizedValue = newValue !== null && newValue !== void 0 ? newValue : '';
|
|
180
|
+
if (slotName === 'start') {
|
|
181
|
+
if (normalizedValue === this.internalStartDate)
|
|
182
|
+
return;
|
|
183
|
+
this.internalStartDate = normalizedValue;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
if (normalizedValue === this.internalEndDate)
|
|
187
|
+
return;
|
|
188
|
+
this.internalEndDate = normalizedValue;
|
|
189
|
+
}
|
|
190
|
+
this.validateDateRange();
|
|
191
|
+
this.updateInputValue('start', this.internalStartDate);
|
|
192
|
+
this.updateInputValue('end', this.internalEndDate);
|
|
193
|
+
this.checkPreselections();
|
|
194
|
+
this.syncFormValue();
|
|
195
|
+
}
|
|
156
196
|
updateInputValue(slotName, newValue) {
|
|
157
197
|
var _a;
|
|
158
198
|
const slot = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`slot[name="${slotName}"]`);
|
|
@@ -184,6 +224,7 @@ export class MdsInputDateRange {
|
|
|
184
224
|
else {
|
|
185
225
|
this.internalEndDate = event.detail;
|
|
186
226
|
}
|
|
227
|
+
this.syncFormValue();
|
|
187
228
|
};
|
|
188
229
|
}
|
|
189
230
|
validateDateRange() {
|
|
@@ -216,15 +257,16 @@ export class MdsInputDateRange {
|
|
|
216
257
|
}
|
|
217
258
|
}
|
|
218
259
|
render() {
|
|
219
|
-
return (h(Host, { key: '
|
|
260
|
+
return (h(Host, { key: 'a0d2991f2840c21d10410d9a2759bea2140b5fb8', onClick: this.focusDateInput }, h("div", { key: '42a70b643de49c02a1db422e9f7e69c4c16b5df2', class: "inputs" }, h("div", { key: '9aaef7664e161099e93dcf09f70e8a12ac26cba5', class: "input-element" }, h("mds-text", { key: 'd7a2f85dbd2ad2d4f2dbeefcad2d23c7062fa193', class: "date-label", typography: "detail", onClick: this.focusStartDateInput }, this.t.get('from')), h("div", { key: 'c430288d5850666258269faf269934c9771b62bf', class: "input-wrapper" }, h("slot", { key: '3cfdeacc1c9b024ce7f5a2a306425eeaa51f1130', name: "start" }))), h("div", { key: 'e8543d95071704939d879f87790f0fc711a34046', class: "input-element" }, h("mds-text", { key: '125cb1e5b7fe872f353624555af070cad0da30b0', class: "date-label", typography: "detail", onClick: this.focusEndDateInput }, this.t.get('to')), h("div", { key: '35884f542a3ebd824dab00a514e3aec69c79ae11', class: "input-wrapper" }, h("slot", { key: '74f1b59daecc34daf576297c93fff43071dccabd', name: "end" })))), h("mds-button", { key: 'be0b0f4af844d95a82211330de00c3545b136da3', class: "action-open-calendar", variant: "dark", tone: "quiet", icon: miBaselineCalendarToday, id: "calendar-dropdown", onClick: () => {
|
|
220
261
|
this.calendarKey += 1;
|
|
221
|
-
} }), h("mds-dropdown", { key: '
|
|
262
|
+
} }), h("mds-dropdown", { key: 'd7bd7782dbcb0f7647643d6054b5fec2947e81e9', ref: el => this.dropdownRef = el, target: "#calendar-dropdown", "auto-placement": false, placement: "bottom-end" }, h("mds-calendar", Object.assign({ lang: this.language, key: this.calendarKey, rangePicker: true, onMdsCalendarChange: ev => {
|
|
222
263
|
this.internalStartDate = ev.detail.startDate;
|
|
223
264
|
this.updateInputValue('start', this.internalStartDate);
|
|
224
265
|
if (ev.detail.endDate) {
|
|
225
266
|
this.internalEndDate = ev.detail.endDate;
|
|
226
267
|
this.updateInputValue('end', this.internalEndDate);
|
|
227
268
|
}
|
|
269
|
+
this.syncFormValue();
|
|
228
270
|
if (this.internalStartDate && this.internalEndDate) {
|
|
229
271
|
this.dateRangeSelected.emit({
|
|
230
272
|
startDate: this.internalStartDate,
|
|
@@ -241,10 +283,21 @@ export class MdsInputDateRange {
|
|
|
241
283
|
}
|
|
242
284
|
}, onMdsCalendarPreselect: () => {
|
|
243
285
|
this.checkPreselections();
|
|
244
|
-
}, startDate: this.internalStartDate, endDate: this.internalEndDate }, (this.min ? { min: this.min } : {}), (this.max ? { max: this.max } : {})), h("div", { key: '
|
|
286
|
+
}, startDate: this.internalStartDate, endDate: this.internalEndDate }, (this.min ? { min: this.min } : {}), (this.max ? { max: this.max } : {})), h("div", { key: '5f94b5fef9bdca001020776e18c79875015452c7', slot: "preselection", class: clsx('date-preselection', this.hasPreselection && 'date-preselection--has-preselection') }, h("slot", { key: '58524f199d07343671ffc752be0ed74d21c3f021', name: "calendar-preselection" }))))));
|
|
287
|
+
}
|
|
288
|
+
syncFormValue() {
|
|
289
|
+
var _a, _b, _c, _d;
|
|
290
|
+
const startDate = (_b = (_a = this.internalStartDate) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
|
|
291
|
+
const endDate = (_d = (_c = this.internalEndDate) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : '';
|
|
292
|
+
if (!startDate && !endDate) {
|
|
293
|
+
this.internals.setFormValue(null);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
this.internals.setFormValue(JSON.stringify({ startDate, endDate }));
|
|
245
297
|
}
|
|
246
298
|
static get is() { return "mds-input-date-range"; }
|
|
247
299
|
static get encapsulation() { return "shadow"; }
|
|
300
|
+
static get formAssociated() { return true; }
|
|
248
301
|
static get originalStyleUrls() {
|
|
249
302
|
return {
|
|
250
303
|
"$": ["mds-input-date-range.css"]
|
|
@@ -371,6 +424,25 @@ export class MdsInputDateRange {
|
|
|
371
424
|
"attribute": "delay",
|
|
372
425
|
"reflect": true,
|
|
373
426
|
"defaultValue": "500"
|
|
427
|
+
},
|
|
428
|
+
"name": {
|
|
429
|
+
"type": "string",
|
|
430
|
+
"mutable": false,
|
|
431
|
+
"complexType": {
|
|
432
|
+
"original": "string",
|
|
433
|
+
"resolved": "string | undefined",
|
|
434
|
+
"references": {}
|
|
435
|
+
},
|
|
436
|
+
"required": false,
|
|
437
|
+
"optional": true,
|
|
438
|
+
"docs": {
|
|
439
|
+
"tags": [],
|
|
440
|
+
"text": "Is needed to reference the form data after the form is submitted"
|
|
441
|
+
},
|
|
442
|
+
"getter": false,
|
|
443
|
+
"setter": false,
|
|
444
|
+
"attribute": "name",
|
|
445
|
+
"reflect": true
|
|
374
446
|
}
|
|
375
447
|
};
|
|
376
448
|
}
|
|
@@ -469,4 +541,14 @@ export class MdsInputDateRange {
|
|
|
469
541
|
};
|
|
470
542
|
}
|
|
471
543
|
static get elementRef() { return "host"; }
|
|
544
|
+
static get watchers() {
|
|
545
|
+
return [{
|
|
546
|
+
"propName": "startDate",
|
|
547
|
+
"methodName": "handleStartDateChange"
|
|
548
|
+
}, {
|
|
549
|
+
"propName": "endDate",
|
|
550
|
+
"methodName": "handleEndDateChange"
|
|
551
|
+
}];
|
|
552
|
+
}
|
|
553
|
+
static get attachInternalsMemberName() { return "internals"; }
|
|
472
554
|
}
|
|
@@ -89,7 +89,7 @@ export class MdsInputRange {
|
|
|
89
89
|
}
|
|
90
90
|
render() {
|
|
91
91
|
var _a;
|
|
92
|
-
return (h(Host, { key: '
|
|
92
|
+
return (h(Host, { key: '2d5f241c653b2c34225a94f3c0d782c9a8b34583' }, h("header", { key: 'ac46c16897c7a1d63b9887ca9580a8b33da77bb3', class: "header", part: "header" }, h("mds-text", { key: '0f93eec8872302990d9c42fd9a7f5a8d262f6112', class: "label", typography: "label" }, h("slot", { key: '7762eaa602de8d50af9a8184709fd147d44a38e9' })), h("mds-text", { key: '3f7d37ce1d04675bcf37602636c0ff8c6a8cc4ed', class: "value", typography: "label" }, this.formatValue ? this.formatValue(this.value) : this.value)), h("div", { key: 'c1f864c056a9bf9e533cee469fa4b65492c15573', class: "range" }, h("div", { key: '00af079b65bed2f361cc28ebb968c914a841ebe4', class: "track", part: "track" }, h("div", { key: 'de58f9fa9d557ce7878a899eb99f22d5594e30d9', class: "contrast-area" }), h("div", { key: '4a5f74d269710d7bc6e5c17cf5a76608c5d4efa7', class: "track-total" }, h("div", { key: '6622da98d34831538a686d8c08637e52df8a35b2', class: "track-progress", style: { '--mds-input-range-progress': `${(_a = this.progress) !== null && _a !== void 0 ? _a : 0}` } }))), h("input", { key: '6a41ec9f335ae724811adf9f6b274aa763e2bc0e', ref: el => this.inputElement = el, class: "field", "aria-label": this.label, disabled: this.disabled, max: this.max, min: this.min, onInput: this.onInput, step: this.step, type: "range", value: this.value, name: this.name }))));
|
|
93
93
|
}
|
|
94
94
|
static get is() { return "mds-input-range"; }
|
|
95
95
|
static get encapsulation() { return "shadow"; }
|
|
@@ -123,6 +123,25 @@ export class MdsInputRange {
|
|
|
123
123
|
"getter": false,
|
|
124
124
|
"setter": false
|
|
125
125
|
},
|
|
126
|
+
"name": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "string",
|
|
131
|
+
"resolved": "string | undefined",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": true,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": "Is needed to reference the form data after the form is submitted"
|
|
139
|
+
},
|
|
140
|
+
"getter": false,
|
|
141
|
+
"setter": false,
|
|
142
|
+
"attribute": "name",
|
|
143
|
+
"reflect": true
|
|
144
|
+
},
|
|
126
145
|
"max": {
|
|
127
146
|
"type": "number",
|
|
128
147
|
"mutable": false,
|
|
@@ -48,6 +48,7 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
48
48
|
this.__attachShadow();
|
|
49
49
|
this.dateRangeSelected = createEvent(this, "mdsInputDateRangeSelect", 7);
|
|
50
50
|
this.valueChanged = createEvent(this, "mdsInputDateRangeValueChange", 7);
|
|
51
|
+
this.internals = this.attachInternals();
|
|
51
52
|
this.calendarKey = 0;
|
|
52
53
|
this.internalStartDate = '';
|
|
53
54
|
this.internalEndDate = '';
|
|
@@ -85,12 +86,15 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
85
86
|
this.delay = 500;
|
|
86
87
|
this.lastEmittedStartDate = null;
|
|
87
88
|
this.lastEmittedEndDate = null;
|
|
89
|
+
this.initialStartDate = '';
|
|
90
|
+
this.initialEndDate = '';
|
|
88
91
|
this.handleFocusOut = (event) => {
|
|
89
92
|
if (!this.host.contains(event.relatedTarget)) {
|
|
90
93
|
const startValid = DateTime_1.fromISO(this.internalStartDate).isValid;
|
|
91
94
|
const endValid = DateTime_1.fromISO(this.internalEndDate).isValid;
|
|
92
95
|
if (startValid && endValid) {
|
|
93
96
|
this.validateDateRange();
|
|
97
|
+
this.syncFormValue();
|
|
94
98
|
this.dateRangeSelected.emit({
|
|
95
99
|
startDate: this.internalStartDate,
|
|
96
100
|
endDate: this.internalEndDate,
|
|
@@ -131,10 +135,18 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
131
135
|
async updateLang() {
|
|
132
136
|
this.language = this.t.lang(this.host);
|
|
133
137
|
}
|
|
138
|
+
handleStartDateChange(newValue) {
|
|
139
|
+
this.syncExternalDate('start', newValue);
|
|
140
|
+
}
|
|
141
|
+
handleEndDateChange(newValue) {
|
|
142
|
+
this.syncExternalDate('end', newValue);
|
|
143
|
+
}
|
|
134
144
|
componentWillLoad() {
|
|
135
145
|
this.language = this.t.lang(this.host);
|
|
136
146
|
this.internalStartDate = this.startDate;
|
|
137
147
|
this.internalEndDate = this.endDate;
|
|
148
|
+
this.initialStartDate = this.startDate;
|
|
149
|
+
this.initialEndDate = this.endDate;
|
|
138
150
|
// Se max è precedente a min, imposto max uguale a min
|
|
139
151
|
if (this.min && this.max) {
|
|
140
152
|
const minDate = DateTime_1.fromISO(this.min);
|
|
@@ -143,6 +155,7 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
143
155
|
this.max = this.min;
|
|
144
156
|
}
|
|
145
157
|
}
|
|
158
|
+
this.syncFormValue();
|
|
146
159
|
}
|
|
147
160
|
disconnectedCallback() {
|
|
148
161
|
this.host.removeEventListener('focusout', this.handleFocusOut);
|
|
@@ -171,6 +184,7 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
171
184
|
this.internalEndDate = event.start;
|
|
172
185
|
}
|
|
173
186
|
this.updateInputValue('end', this.internalEndDate);
|
|
187
|
+
this.syncFormValue();
|
|
174
188
|
const calendar = (_b = (_a = this.host) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mds-calendar');
|
|
175
189
|
if (calendar) {
|
|
176
190
|
await calendar.updateCurrentDate(this.internalStartDate);
|
|
@@ -190,8 +204,35 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
190
204
|
this.updateInputListeners();
|
|
191
205
|
this.updateInputValue('start', this.internalStartDate);
|
|
192
206
|
this.updateInputValue('end', this.internalEndDate);
|
|
207
|
+
this.syncFormValue();
|
|
193
208
|
this.host.addEventListener('focusout', this.handleFocusOut);
|
|
194
209
|
}
|
|
210
|
+
formResetCallback() {
|
|
211
|
+
this.internalStartDate = this.initialStartDate;
|
|
212
|
+
this.internalEndDate = this.initialEndDate;
|
|
213
|
+
this.updateInputValue('start', this.internalStartDate);
|
|
214
|
+
this.updateInputValue('end', this.internalEndDate);
|
|
215
|
+
this.checkPreselections();
|
|
216
|
+
this.syncFormValue();
|
|
217
|
+
}
|
|
218
|
+
syncExternalDate(slotName, newValue) {
|
|
219
|
+
const normalizedValue = newValue !== null && newValue !== void 0 ? newValue : '';
|
|
220
|
+
if (slotName === 'start') {
|
|
221
|
+
if (normalizedValue === this.internalStartDate)
|
|
222
|
+
return;
|
|
223
|
+
this.internalStartDate = normalizedValue;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
if (normalizedValue === this.internalEndDate)
|
|
227
|
+
return;
|
|
228
|
+
this.internalEndDate = normalizedValue;
|
|
229
|
+
}
|
|
230
|
+
this.validateDateRange();
|
|
231
|
+
this.updateInputValue('start', this.internalStartDate);
|
|
232
|
+
this.updateInputValue('end', this.internalEndDate);
|
|
233
|
+
this.checkPreselections();
|
|
234
|
+
this.syncFormValue();
|
|
235
|
+
}
|
|
195
236
|
updateInputValue(slotName, newValue) {
|
|
196
237
|
var _a;
|
|
197
238
|
const slot = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`slot[name="${slotName}"]`);
|
|
@@ -223,6 +264,7 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
223
264
|
else {
|
|
224
265
|
this.internalEndDate = event.detail;
|
|
225
266
|
}
|
|
267
|
+
this.syncFormValue();
|
|
226
268
|
};
|
|
227
269
|
}
|
|
228
270
|
validateDateRange() {
|
|
@@ -255,15 +297,16 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
255
297
|
}
|
|
256
298
|
}
|
|
257
299
|
render() {
|
|
258
|
-
return (h(Host, { key: '
|
|
300
|
+
return (h(Host, { key: 'a0d2991f2840c21d10410d9a2759bea2140b5fb8', onClick: this.focusDateInput }, h("div", { key: '42a70b643de49c02a1db422e9f7e69c4c16b5df2', class: "inputs" }, h("div", { key: '9aaef7664e161099e93dcf09f70e8a12ac26cba5', class: "input-element" }, h("mds-text", { key: 'd7a2f85dbd2ad2d4f2dbeefcad2d23c7062fa193', class: "date-label", typography: "detail", onClick: this.focusStartDateInput }, this.t.get('from')), h("div", { key: 'c430288d5850666258269faf269934c9771b62bf', class: "input-wrapper" }, h("slot", { key: '3cfdeacc1c9b024ce7f5a2a306425eeaa51f1130', name: "start" }))), h("div", { key: 'e8543d95071704939d879f87790f0fc711a34046', class: "input-element" }, h("mds-text", { key: '125cb1e5b7fe872f353624555af070cad0da30b0', class: "date-label", typography: "detail", onClick: this.focusEndDateInput }, this.t.get('to')), h("div", { key: '35884f542a3ebd824dab00a514e3aec69c79ae11', class: "input-wrapper" }, h("slot", { key: '74f1b59daecc34daf576297c93fff43071dccabd', name: "end" })))), h("mds-button", { key: 'be0b0f4af844d95a82211330de00c3545b136da3', class: "action-open-calendar", variant: "dark", tone: "quiet", icon: miBaselineCalendarToday, id: "calendar-dropdown", onClick: () => {
|
|
259
301
|
this.calendarKey += 1;
|
|
260
|
-
} }), h("mds-dropdown", { key: '
|
|
302
|
+
} }), h("mds-dropdown", { key: 'd7bd7782dbcb0f7647643d6054b5fec2947e81e9', ref: el => this.dropdownRef = el, target: "#calendar-dropdown", "auto-placement": false, placement: "bottom-end" }, h("mds-calendar", Object.assign({ lang: this.language, key: this.calendarKey, rangePicker: true, onMdsCalendarChange: ev => {
|
|
261
303
|
this.internalStartDate = ev.detail.startDate;
|
|
262
304
|
this.updateInputValue('start', this.internalStartDate);
|
|
263
305
|
if (ev.detail.endDate) {
|
|
264
306
|
this.internalEndDate = ev.detail.endDate;
|
|
265
307
|
this.updateInputValue('end', this.internalEndDate);
|
|
266
308
|
}
|
|
309
|
+
this.syncFormValue();
|
|
267
310
|
if (this.internalStartDate && this.internalEndDate) {
|
|
268
311
|
this.dateRangeSelected.emit({
|
|
269
312
|
startDate: this.internalStartDate,
|
|
@@ -280,16 +323,32 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
280
323
|
}
|
|
281
324
|
}, onMdsCalendarPreselect: () => {
|
|
282
325
|
this.checkPreselections();
|
|
283
|
-
}, startDate: this.internalStartDate, endDate: this.internalEndDate }, (this.min ? { min: this.min } : {}), (this.max ? { max: this.max } : {})), h("div", { key: '
|
|
326
|
+
}, startDate: this.internalStartDate, endDate: this.internalEndDate }, (this.min ? { min: this.min } : {}), (this.max ? { max: this.max } : {})), h("div", { key: '5f94b5fef9bdca001020776e18c79875015452c7', slot: "preselection", class: clsx('date-preselection', this.hasPreselection && 'date-preselection--has-preselection') }, h("slot", { key: '58524f199d07343671ffc752be0ed74d21c3f021', name: "calendar-preselection" }))))));
|
|
327
|
+
}
|
|
328
|
+
syncFormValue() {
|
|
329
|
+
var _a, _b, _c, _d;
|
|
330
|
+
const startDate = (_b = (_a = this.internalStartDate) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
|
|
331
|
+
const endDate = (_d = (_c = this.internalEndDate) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : '';
|
|
332
|
+
if (!startDate && !endDate) {
|
|
333
|
+
this.internals.setFormValue(null);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
this.internals.setFormValue(JSON.stringify({ startDate, endDate }));
|
|
284
337
|
}
|
|
338
|
+
static get formAssociated() { return true; }
|
|
285
339
|
get host() { return this; }
|
|
340
|
+
static get watchers() { return {
|
|
341
|
+
"startDate": ["handleStartDateChange"],
|
|
342
|
+
"endDate": ["handleEndDateChange"]
|
|
343
|
+
}; }
|
|
286
344
|
static get style() { return MdsInputDateRangeStyle0; }
|
|
287
|
-
}, [
|
|
345
|
+
}, [65, "mds-input-date-range", {
|
|
288
346
|
"startDate": [513, "start-date"],
|
|
289
347
|
"endDate": [513, "end-date"],
|
|
290
348
|
"min": [513],
|
|
291
349
|
"max": [513],
|
|
292
350
|
"delay": [514],
|
|
351
|
+
"name": [513],
|
|
293
352
|
"calendarKey": [32],
|
|
294
353
|
"internalStartDate": [32],
|
|
295
354
|
"internalEndDate": [32],
|
|
@@ -298,6 +357,9 @@ const MdsInputDateRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDateR
|
|
|
298
357
|
"language": [32],
|
|
299
358
|
"updateLang": [64],
|
|
300
359
|
"preselect": [64]
|
|
360
|
+
}, undefined, {
|
|
361
|
+
"startDate": ["handleStartDateChange"],
|
|
362
|
+
"endDate": ["handleEndDateChange"]
|
|
301
363
|
}]);
|
|
302
364
|
function defineCustomElement$1() {
|
|
303
365
|
if (typeof customElements === "undefined") {
|
|
@@ -20,6 +20,7 @@ const MdsInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDate exten
|
|
|
20
20
|
this.__registerHost();
|
|
21
21
|
this.__attachShadow();
|
|
22
22
|
this.valueChange = createEvent(this, "mdsInputDateSelect", 7);
|
|
23
|
+
this.internals = this.attachInternals();
|
|
23
24
|
this.isSlotted = false;
|
|
24
25
|
this.t = new Locale({
|
|
25
26
|
el: {},
|
|
@@ -89,6 +90,7 @@ const MdsInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDate exten
|
|
|
89
90
|
handleValue() {
|
|
90
91
|
this.valueChange.emit(this.value);
|
|
91
92
|
this.validateValue();
|
|
93
|
+
this.internals.setFormValue(this.value);
|
|
92
94
|
}
|
|
93
95
|
validateValue() {
|
|
94
96
|
const date = DateTime_1.fromISO(this.value);
|
|
@@ -135,10 +137,10 @@ const MdsInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDate exten
|
|
|
135
137
|
this.validateValue();
|
|
136
138
|
}
|
|
137
139
|
render() {
|
|
138
|
-
return (h(Host, { key: '
|
|
140
|
+
return (h(Host, { key: '5c8a9e0aa8f76679abfbdaa2c709ae11312ee46d' }, h("input", { key: '1f6dddc1ed8477f8b6160d90f7bf15c6d711ef95', value: this.value, id: "dateInput", class: "input", part: "input-date", type: "date", disabled: this.disabled, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.handleChange, onChange: this.handleChange }), !this.isSlotted && h("mds-button", { key: 'caefb1f5d8da17ea06dfc547902e19900cd02abf', id: "calendar-dropdown", class: "action-open-calendar", disabled: this.disabled, variant: "dark", tone: "quiet", icon: miBaselineCalendarToday, onClick: () => {
|
|
139
141
|
this.calendarKey += 1;
|
|
140
|
-
} }), h("mds-input-tip", { key: '
|
|
141
|
-
h("mds-input-tip-item", { key: '
|
|
142
|
+
} }), h("mds-input-tip", { key: '3f60d0e56e101776b19c1564d92f361b3f0178d7', lang: this.language, position: "top", active: this.hasFocus }, this.disabled && h("mds-input-tip-item", { key: '25a86b26eb2bd743d0291ff1514828274d13ae17', expanded: true, variant: "disabled" }), this.readonly && h("mds-input-tip-item", { key: 'c63d2f830dec87f180bc828b16cebd8e8d8a7060', expanded: true, variant: "readonly" }), this.required &&
|
|
143
|
+
h("mds-input-tip-item", { key: '2d2e3f021e3e4ef8c99be55132edf4f99be3b900', expanded: this.hasFocus, variant: this.isValid ? 'required-success' : 'required' })), !this.isSlotted && h("mds-dropdown", { key: '370a33a1f273a3eafc045c1e62c84db41ff52c23', placement: "bottom-end", "auto-placement": false, ref: el => this.dropdownRef = el, target: "#calendar-dropdown" }, h("mds-calendar", Object.assign({ key: this.calendarKey, rangePicker: false, lang: this.language, onMdsCalendarChange: ev => {
|
|
142
144
|
this.value = ev.detail.startDate;
|
|
143
145
|
if (this.delay === 0)
|
|
144
146
|
return;
|
|
@@ -150,13 +152,15 @@ const MdsInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputDate exten
|
|
|
150
152
|
}
|
|
151
153
|
}, startDate: this.value }, this.min ? { min: this.min } : {}, this.max ? { max: this.max } : {})))));
|
|
152
154
|
}
|
|
155
|
+
static get formAssociated() { return true; }
|
|
153
156
|
get host() { return this; }
|
|
154
157
|
static get watchers() { return {
|
|
155
158
|
"value": ["handleValue"]
|
|
156
159
|
}; }
|
|
157
160
|
static get style() { return MdsInputDateStyle0; }
|
|
158
|
-
}, [
|
|
161
|
+
}, [65, "mds-input-date", {
|
|
159
162
|
"value": [513],
|
|
163
|
+
"name": [513],
|
|
160
164
|
"variant": [1537],
|
|
161
165
|
"min": [1537],
|
|
162
166
|
"max": [1537],
|
|
@@ -95,7 +95,7 @@ const MdsInputRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputRange ext
|
|
|
95
95
|
}
|
|
96
96
|
render() {
|
|
97
97
|
var _a;
|
|
98
|
-
return (h(Host, { key: '
|
|
98
|
+
return (h(Host, { key: '2d5f241c653b2c34225a94f3c0d782c9a8b34583' }, h("header", { key: 'ac46c16897c7a1d63b9887ca9580a8b33da77bb3', class: "header", part: "header" }, h("mds-text", { key: '0f93eec8872302990d9c42fd9a7f5a8d262f6112', class: "label", typography: "label" }, h("slot", { key: '7762eaa602de8d50af9a8184709fd147d44a38e9' })), h("mds-text", { key: '3f7d37ce1d04675bcf37602636c0ff8c6a8cc4ed', class: "value", typography: "label" }, this.formatValue ? this.formatValue(this.value) : this.value)), h("div", { key: 'c1f864c056a9bf9e533cee469fa4b65492c15573', class: "range" }, h("div", { key: '00af079b65bed2f361cc28ebb968c914a841ebe4', class: "track", part: "track" }, h("div", { key: 'de58f9fa9d557ce7878a899eb99f22d5594e30d9', class: "contrast-area" }), h("div", { key: '4a5f74d269710d7bc6e5c17cf5a76608c5d4efa7', class: "track-total" }, h("div", { key: '6622da98d34831538a686d8c08637e52df8a35b2', class: "track-progress", style: { '--mds-input-range-progress': `${(_a = this.progress) !== null && _a !== void 0 ? _a : 0}` } }))), h("input", { key: '6a41ec9f335ae724811adf9f6b274aa763e2bc0e', ref: el => this.inputElement = el, class: "field", "aria-label": this.label, disabled: this.disabled, max: this.max, min: this.min, onInput: this.onInput, step: this.step, type: "range", value: this.value, name: this.name }))));
|
|
99
99
|
}
|
|
100
100
|
static get formAssociated() { return true; }
|
|
101
101
|
get element() { return this; }
|
|
@@ -109,6 +109,7 @@ const MdsInputRange$1 = /*@__PURE__*/ proxyCustomElement(class MdsInputRange ext
|
|
|
109
109
|
static get style() { return MdsInputRangeStyle0; }
|
|
110
110
|
}, [65, "mds-input-range", {
|
|
111
111
|
"formatValue": [16],
|
|
112
|
+
"name": [513],
|
|
112
113
|
"max": [2],
|
|
113
114
|
"min": [2],
|
|
114
115
|
"step": [2],
|
package/dist/documentation.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2026-03-
|
|
2
|
+
"timestamp": "2026-03-24T16:26:27",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.27.2",
|
|
@@ -11424,6 +11424,32 @@
|
|
|
11424
11424
|
"getter": false,
|
|
11425
11425
|
"setter": false
|
|
11426
11426
|
},
|
|
11427
|
+
{
|
|
11428
|
+
"name": "name",
|
|
11429
|
+
"type": "string | undefined",
|
|
11430
|
+
"complexType": {
|
|
11431
|
+
"original": "string",
|
|
11432
|
+
"resolved": "string | undefined",
|
|
11433
|
+
"references": {}
|
|
11434
|
+
},
|
|
11435
|
+
"mutable": false,
|
|
11436
|
+
"attr": "name",
|
|
11437
|
+
"reflectToAttr": true,
|
|
11438
|
+
"docs": "Is needed to reference the form data after the form is submitted",
|
|
11439
|
+
"docsTags": [],
|
|
11440
|
+
"values": [
|
|
11441
|
+
{
|
|
11442
|
+
"type": "string"
|
|
11443
|
+
},
|
|
11444
|
+
{
|
|
11445
|
+
"type": "undefined"
|
|
11446
|
+
}
|
|
11447
|
+
],
|
|
11448
|
+
"optional": true,
|
|
11449
|
+
"required": false,
|
|
11450
|
+
"getter": false,
|
|
11451
|
+
"setter": false
|
|
11452
|
+
},
|
|
11427
11453
|
{
|
|
11428
11454
|
"name": "readonly",
|
|
11429
11455
|
"type": "boolean | undefined",
|
|
@@ -11871,6 +11897,32 @@
|
|
|
11871
11897
|
"getter": false,
|
|
11872
11898
|
"setter": false
|
|
11873
11899
|
},
|
|
11900
|
+
{
|
|
11901
|
+
"name": "name",
|
|
11902
|
+
"type": "string | undefined",
|
|
11903
|
+
"complexType": {
|
|
11904
|
+
"original": "string",
|
|
11905
|
+
"resolved": "string | undefined",
|
|
11906
|
+
"references": {}
|
|
11907
|
+
},
|
|
11908
|
+
"mutable": false,
|
|
11909
|
+
"attr": "name",
|
|
11910
|
+
"reflectToAttr": true,
|
|
11911
|
+
"docs": "Is needed to reference the form data after the form is submitted",
|
|
11912
|
+
"docsTags": [],
|
|
11913
|
+
"values": [
|
|
11914
|
+
{
|
|
11915
|
+
"type": "string"
|
|
11916
|
+
},
|
|
11917
|
+
{
|
|
11918
|
+
"type": "undefined"
|
|
11919
|
+
}
|
|
11920
|
+
],
|
|
11921
|
+
"optional": true,
|
|
11922
|
+
"required": false,
|
|
11923
|
+
"getter": false,
|
|
11924
|
+
"setter": false
|
|
11925
|
+
},
|
|
11874
11926
|
{
|
|
11875
11927
|
"name": "startDate",
|
|
11876
11928
|
"type": "string",
|
|
@@ -12553,6 +12605,32 @@
|
|
|
12553
12605
|
"getter": false,
|
|
12554
12606
|
"setter": false
|
|
12555
12607
|
},
|
|
12608
|
+
{
|
|
12609
|
+
"name": "name",
|
|
12610
|
+
"type": "string | undefined",
|
|
12611
|
+
"complexType": {
|
|
12612
|
+
"original": "string",
|
|
12613
|
+
"resolved": "string | undefined",
|
|
12614
|
+
"references": {}
|
|
12615
|
+
},
|
|
12616
|
+
"mutable": false,
|
|
12617
|
+
"attr": "name",
|
|
12618
|
+
"reflectToAttr": true,
|
|
12619
|
+
"docs": "Is needed to reference the form data after the form is submitted",
|
|
12620
|
+
"docsTags": [],
|
|
12621
|
+
"values": [
|
|
12622
|
+
{
|
|
12623
|
+
"type": "string"
|
|
12624
|
+
},
|
|
12625
|
+
{
|
|
12626
|
+
"type": "undefined"
|
|
12627
|
+
}
|
|
12628
|
+
],
|
|
12629
|
+
"optional": true,
|
|
12630
|
+
"required": false,
|
|
12631
|
+
"getter": false,
|
|
12632
|
+
"setter": false
|
|
12633
|
+
},
|
|
12556
12634
|
{
|
|
12557
12635
|
"name": "step",
|
|
12558
12636
|
"type": "number",
|