@oiz/stzh-components 2.6.0 → 2.7.0-alpha
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/{app-globals-4dcdf160.js → app-globals-5dfa53d1.js} +2 -2
- package/dist/cjs/{app-globals-4dcdf160.js.map → app-globals-5dfa53d1.js.map} +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stzh-amount.cjs.entry.js +30 -79
- package/dist/cjs/stzh-amount.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-components.cjs.js +2 -2
- package/dist/cjs/stzh-datepicker_3.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-dropdown.cjs.entry.js +60 -25
- package/dist/cjs/stzh-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-monthyearpicker.cjs.entry.js +191 -0
- package/dist/cjs/stzh-monthyearpicker.cjs.entry.js.map +1 -0
- package/dist/cjs/stzh-skin-portal-mitwirken.cjs.entry.js +1 -1
- package/dist/cjs/stzh-skin-portal-mitwirken.cjs.entry.js.map +1 -1
- package/dist/cjs/stzh-timepicker.cjs.entry.js +82 -0
- package/dist/cjs/stzh-timepicker.cjs.entry.js.map +1 -0
- package/dist/cjs/translation-utils-73073e44.js.map +1 -1
- package/dist/collection/assets/i18n/de.json +10 -7
- package/dist/collection/assets/i18n/en.json +8 -5
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/stzh-amount/stzh-amount.js +32 -85
- package/dist/collection/components/stzh-amount/stzh-amount.js.map +1 -1
- package/dist/collection/components/stzh-amount/stzh-amount.localization.js.map +1 -1
- package/dist/collection/components/stzh-amount/stzh-amount.stories.js +1 -1
- package/dist/collection/components/stzh-datepicker/stzh-datepicker.js +1 -1
- package/dist/collection/components/stzh-datepicker/stzh-datepicker.js.map +1 -1
- package/dist/collection/components/stzh-datepicker/stzh-datepicker.stories.js +3 -0
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.css +32 -20
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js +40 -9
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js.map +1 -1
- package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.css +123 -0
- package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.js +724 -0
- package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.js.map +1 -0
- package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.js +2 -0
- package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.js.map +1 -0
- package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.stories.js +61 -0
- package/dist/collection/components/stzh-skin-portal-mitwirken/stzh-skin-portal-mitwirken.css +1 -1
- package/dist/collection/components/stzh-timepicker/stzh-timepicker.css +109 -0
- package/dist/collection/components/stzh-timepicker/stzh-timepicker.js +438 -0
- package/dist/collection/components/stzh-timepicker/stzh-timepicker.js.map +1 -0
- package/dist/collection/components/stzh-timepicker/stzh-timepicker.localization.js +2 -0
- package/dist/collection/components/stzh-timepicker/stzh-timepicker.localization.js.map +1 -0
- package/dist/collection/components/stzh-timepicker/stzh-timepicker.stories.js +45 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/libraries/tom-select/cjs/tom-select.complete.js +47 -18
- package/dist/collection/libraries/tom-select/cjs/tom-select.js +47 -18
- package/dist/collection/libraries/tom-select/cjs/tom-select.popular.js +47 -18
- package/dist/collection/libraries/tom-select/esm/tom-select.complete.js +47 -18
- package/dist/collection/libraries/tom-select/esm/tom-select.js +47 -18
- package/dist/collection/libraries/tom-select/esm/tom-select.popular.js +47 -18
- package/dist/collection/libraries/tom-select/js/tom-select.base.js +47 -18
- package/dist/collection/libraries/tom-select/js/tom-select.base.min.js +16 -17
- package/dist/collection/libraries/tom-select/js/tom-select.complete.js +47 -18
- package/dist/collection/libraries/tom-select/js/tom-select.complete.min.js +12 -13
- package/dist/collection/libraries/tom-select/js/tom-select.popular.js +47 -18
- package/dist/collection/libraries/tom-select/js/tom-select.popular.min.js +21 -22
- package/dist/collection/utils/translation-utils.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js.map +1 -1
- package/dist/components/stzh-amount.js +40 -83
- package/dist/components/stzh-amount.js.map +1 -1
- package/dist/components/stzh-buttongroup.js +1 -31
- package/dist/components/stzh-buttongroup.js.map +1 -1
- package/dist/components/stzh-buttongroup2.js +35 -0
- package/dist/components/stzh-buttongroup2.js.map +1 -0
- package/dist/components/stzh-datepicker2.js.map +1 -1
- package/dist/components/stzh-dropdown2.js +61 -25
- package/dist/components/stzh-dropdown2.js.map +1 -1
- package/dist/components/stzh-monthyearpicker.d.ts +11 -0
- package/dist/components/stzh-monthyearpicker.js +251 -0
- package/dist/components/stzh-monthyearpicker.js.map +1 -0
- package/dist/components/stzh-skin-portal-mitwirken.js +1 -1
- package/dist/components/stzh-skin-portal-mitwirken.js.map +1 -1
- package/dist/components/stzh-timepicker.d.ts +11 -0
- package/dist/components/stzh-timepicker.js +132 -0
- package/dist/components/stzh-timepicker.js.map +1 -0
- package/dist/components/translation-utils.js.map +1 -1
- package/dist/esm/{app-globals-91875913.js → app-globals-862dc6d0.js} +2 -2
- package/dist/esm/{app-globals-91875913.js.map → app-globals-862dc6d0.js.map} +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stzh-amount.entry.js +30 -79
- package/dist/esm/stzh-amount.entry.js.map +1 -1
- package/dist/esm/stzh-components.js +2 -2
- package/dist/esm/stzh-datepicker_3.entry.js.map +1 -1
- package/dist/esm/stzh-dropdown.entry.js +60 -25
- package/dist/esm/stzh-dropdown.entry.js.map +1 -1
- package/dist/esm/stzh-monthyearpicker.entry.js +187 -0
- package/dist/esm/stzh-monthyearpicker.entry.js.map +1 -0
- package/dist/esm/stzh-skin-portal-mitwirken.entry.js +1 -1
- package/dist/esm/stzh-skin-portal-mitwirken.entry.js.map +1 -1
- package/dist/esm/stzh-timepicker.entry.js +78 -0
- package/dist/esm/stzh-timepicker.entry.js.map +1 -0
- package/dist/esm/translation-utils-2623783f.js.map +1 -1
- package/dist/esm-es5/{app-globals-91875913.js → app-globals-862dc6d0.js} +2 -2
- package/dist/esm-es5/{app-globals-91875913.js.map → app-globals-862dc6d0.js.map} +1 -1
- package/dist/esm-es5/index.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/stzh-amount.entry.js +1 -1
- package/dist/esm-es5/stzh-amount.entry.js.map +1 -1
- package/dist/esm-es5/stzh-components.js +1 -1
- package/dist/esm-es5/stzh-components.js.map +1 -1
- package/dist/esm-es5/stzh-datepicker_3.entry.js.map +1 -1
- package/dist/esm-es5/stzh-dropdown.entry.js +2 -2
- package/dist/esm-es5/stzh-dropdown.entry.js.map +1 -1
- package/dist/esm-es5/stzh-monthyearpicker.entry.js +2 -0
- package/dist/esm-es5/stzh-monthyearpicker.entry.js.map +1 -0
- package/dist/esm-es5/stzh-skin-portal-mitwirken.entry.js +1 -1
- package/dist/esm-es5/stzh-skin-portal-mitwirken.entry.js.map +1 -1
- package/dist/esm-es5/stzh-timepicker.entry.js +2 -0
- package/dist/esm-es5/stzh-timepicker.entry.js.map +1 -0
- package/dist/esm-es5/translation-utils-2623783f.js.map +1 -1
- package/dist/stzh-components/assets/i18n/de.json +10 -7
- package/dist/stzh-components/assets/i18n/en.json +8 -5
- package/dist/stzh-components/index.esm.js.map +1 -1
- package/dist/stzh-components/p-14e782cb.entry.js +2 -0
- package/dist/stzh-components/{p-85504842.entry.js.map → p-14e782cb.entry.js.map} +1 -1
- package/dist/stzh-components/p-1678e09c.system.js +2 -0
- package/dist/stzh-components/{p-3e10addb.system.js.map → p-1678e09c.system.js.map} +1 -1
- package/dist/stzh-components/p-25a09313.js.map +1 -1
- package/dist/stzh-components/{p-61b66e55.system.js → p-3b4833a0.system.js} +2 -2
- package/dist/stzh-components/{p-61b66e55.system.js.map → p-3b4833a0.system.js.map} +1 -1
- package/dist/stzh-components/p-51f1714c.system.entry.js +2 -0
- package/dist/stzh-components/p-51f1714c.system.entry.js.map +1 -0
- package/dist/stzh-components/p-5aa96b49.system.entry.js +2 -0
- package/dist/stzh-components/p-5aa96b49.system.entry.js.map +1 -0
- package/dist/stzh-components/p-82e886d4.entry.js.map +1 -1
- package/dist/stzh-components/p-9f31cf7d.entry.js +2 -0
- package/dist/stzh-components/p-9f31cf7d.entry.js.map +1 -0
- package/dist/stzh-components/p-9fe69be8.system.entry.js +2 -0
- package/dist/stzh-components/{p-479a02fb.system.entry.js.map → p-9fe69be8.system.entry.js.map} +1 -1
- package/dist/stzh-components/p-a408bfba.system.js.map +1 -1
- package/dist/stzh-components/p-ad33db31.entry.js +2 -0
- package/dist/stzh-components/p-ad33db31.entry.js.map +1 -0
- package/dist/stzh-components/p-b5cda655.entry.js +2 -0
- package/dist/stzh-components/p-b5cda655.entry.js.map +1 -0
- package/dist/stzh-components/{p-362af013.js → p-bc82ed48.js} +2 -2
- package/dist/stzh-components/{p-362af013.js.map → p-bc82ed48.js.map} +1 -1
- package/dist/stzh-components/p-c0f971f2.entry.js +9 -0
- package/dist/stzh-components/p-c0f971f2.entry.js.map +1 -0
- package/dist/stzh-components/p-c901fe72.system.entry.js +9 -0
- package/dist/stzh-components/p-c901fe72.system.entry.js.map +1 -0
- package/dist/stzh-components/p-e8545386.system.entry.js +2 -0
- package/dist/stzh-components/p-e8545386.system.entry.js.map +1 -0
- package/dist/stzh-components/p-eaa65f52.system.js.map +1 -1
- package/dist/stzh-components/p-f2d74491.system.entry.js.map +1 -1
- package/dist/stzh-components/stzh-components.css +1 -1
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/dist/stzh-components/stzh-components.esm.js.map +1 -1
- package/dist/stzh-components/stzh-components.js +1 -1
- package/dist/types/components/stzh-amount/stzh-amount.localization.d.ts +0 -2
- package/dist/types/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.d.ts +5 -0
- package/dist/types/components/stzh-timepicker/stzh-timepicker.localization.d.ts +2 -0
- package/dist/types/components.d.ts +428 -6
- package/dist/types/index.d.ts +14 -0
- package/dist/types/utils/translation-utils.d.ts +1 -0
- package/dist/vscode-data.json +263 -1
- package/package.json +1 -1
- package/dist/stzh-components/p-1cc48f98.entry.js +0 -9
- package/dist/stzh-components/p-1cc48f98.entry.js.map +0 -1
- package/dist/stzh-components/p-3e10addb.system.js +0 -2
- package/dist/stzh-components/p-479a02fb.system.entry.js +0 -2
- package/dist/stzh-components/p-67b11b03.system.entry.js +0 -2
- package/dist/stzh-components/p-67b11b03.system.entry.js.map +0 -1
- package/dist/stzh-components/p-6bb83b30.system.entry.js +0 -9
- package/dist/stzh-components/p-6bb83b30.system.entry.js.map +0 -1
- package/dist/stzh-components/p-85504842.entry.js +0 -2
- package/dist/stzh-components/p-c94f7331.entry.js +0 -2
- package/dist/stzh-components/p-c94f7331.entry.js.map +0 -1
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, a as Host, g as getElement } from './index-67fd55c9.js';
|
|
2
|
+
import { f as fetchTranslations } from './translation-utils-2623783f.js';
|
|
3
|
+
|
|
4
|
+
const stzhMonthyearpickerCss = ".sc-stzh-monthyearpicker-h{font-family:var(--stzh-font-family-regular);font-weight:var(--stzh-font-weight-regular);font-style:normal;color:var(--stzh-base-color);-webkit-box-sizing:border-box;box-sizing:border-box;display:block}[hidden].sc-stzh-monthyearpicker-h{display:none}.sc-stzh-monthyearpicker-h *.sc-stzh-monthyearpicker,.sc-stzh-monthyearpicker-h *.sc-stzh-monthyearpicker::before,.sc-stzh-monthyearpicker-h *.sc-stzh-monthyearpicker::after{-webkit-box-sizing:border-box;box-sizing:border-box;text-underline-offset:var(--stzh-link-text-underline-offset);text-decoration-thickness:var(--stzh-link-text-decoration-thickness)}.sc-stzh-monthyearpicker-h{width:100%;--separator-height:var(--stzh-form-input-height)}[size=small].sc-stzh-monthyearpicker-h{--separator-height:var(--stzh-form-input-small-height)}.stzh-monthyearpicker__wrapper.sc-stzh-monthyearpicker{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start}.stzh-monthyearpicker__separator.sc-stzh-monthyearpicker{font-size:var(--stzh-font-milli-font-size);line-height:var(--stzh-font-milli-text-line-height);letter-spacing:var(--stzh-font-curve---text-letter-spacing);margin-left:var(--stzh-space-medium);margin-right:var(--stzh-space-medium);height:var(--separator-height);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}";
|
|
5
|
+
|
|
6
|
+
const StzhMonthyearpicker = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.stzhChange = createEvent(this, "stzhChange", 7);
|
|
10
|
+
this.onRootFocus = () => {
|
|
11
|
+
if (this.monthsDropdown) {
|
|
12
|
+
this.monthsDropdown.setFocus();
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
this.onMonthsDropdownChange = (event) => {
|
|
16
|
+
const year = this.value.split("-")[0] || "0000";
|
|
17
|
+
const month = event.detail.value || "00";
|
|
18
|
+
this.onChange(year, month);
|
|
19
|
+
};
|
|
20
|
+
this.onYearsDropdownChange = (event) => {
|
|
21
|
+
const year = event.detail.value || "0000";
|
|
22
|
+
const month = this.value.split("-")[1] || "00";
|
|
23
|
+
this.onChange(year, month);
|
|
24
|
+
};
|
|
25
|
+
this.months = undefined;
|
|
26
|
+
this.years = undefined;
|
|
27
|
+
this.min = undefined;
|
|
28
|
+
this.max = undefined;
|
|
29
|
+
this.minYear = undefined;
|
|
30
|
+
this.maxYear = undefined;
|
|
31
|
+
this.format = "default";
|
|
32
|
+
this.name = "";
|
|
33
|
+
this.value = "0000-00";
|
|
34
|
+
this.popoverPlacement = "bottom";
|
|
35
|
+
this.monthLabel = "";
|
|
36
|
+
this.yearLabel = "";
|
|
37
|
+
this.readonly = false;
|
|
38
|
+
this.disabled = false;
|
|
39
|
+
this.required = false;
|
|
40
|
+
this.showMarker = false;
|
|
41
|
+
this.size = "default";
|
|
42
|
+
this.descriptionMonth = undefined;
|
|
43
|
+
this.descriptionYear = undefined;
|
|
44
|
+
this.descriptionLongMonth = undefined;
|
|
45
|
+
this.descriptionLongYear = undefined;
|
|
46
|
+
this.errorMonth = undefined;
|
|
47
|
+
this.errorYear = undefined;
|
|
48
|
+
this.invalidMonth = false;
|
|
49
|
+
this.invalidYear = false;
|
|
50
|
+
this.a11yDescribedbyMonth = "";
|
|
51
|
+
this.a11yDescribedbyYear = "";
|
|
52
|
+
this.localization = undefined;
|
|
53
|
+
}
|
|
54
|
+
monthsWatcher(newValue) {
|
|
55
|
+
if (typeof newValue === "string") {
|
|
56
|
+
this._months = JSON.parse(newValue);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this._months = newValue;
|
|
60
|
+
}
|
|
61
|
+
this.updateMonthOptions();
|
|
62
|
+
}
|
|
63
|
+
yearsWatcher(newValue) {
|
|
64
|
+
if (typeof newValue === "string") {
|
|
65
|
+
this._years = JSON.parse(newValue);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this._years = newValue;
|
|
69
|
+
}
|
|
70
|
+
this.updateYearOptions();
|
|
71
|
+
}
|
|
72
|
+
minMaxWatcher() {
|
|
73
|
+
this.updateMonthOptions();
|
|
74
|
+
this.updateYearOptions();
|
|
75
|
+
}
|
|
76
|
+
onChange(year, month) {
|
|
77
|
+
this.value = `${year}-${month}`;
|
|
78
|
+
this.stzhChange.emit({
|
|
79
|
+
component: "stzh-monthyearpicker",
|
|
80
|
+
value: this.value,
|
|
81
|
+
valueMonth: month,
|
|
82
|
+
valueYear: year
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
updateMonthOptions() {
|
|
86
|
+
const options = [];
|
|
87
|
+
let months = [];
|
|
88
|
+
if (this._months) {
|
|
89
|
+
months = this._months;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const currentYear = Number(this.value.split("-")[0] || "0000");
|
|
93
|
+
let minMonth = 1;
|
|
94
|
+
let maxMonth = 12;
|
|
95
|
+
if (this.min) {
|
|
96
|
+
const minDate = new Date(this.min);
|
|
97
|
+
if (currentYear === minDate.getFullYear()) {
|
|
98
|
+
minMonth = minDate.getMonth() + 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (this.max) {
|
|
102
|
+
const maxDate = new Date(this.max);
|
|
103
|
+
if (currentYear === maxDate.getFullYear()) {
|
|
104
|
+
maxMonth = maxDate.getMonth() + 1;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (let i = minMonth; i <= maxMonth; i++) {
|
|
108
|
+
months.push(i);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
months.forEach((month) => {
|
|
112
|
+
const paddedMonth = ("00" + month).slice(-2);
|
|
113
|
+
const monthName = this.localization.$globals.monthNames[month - 1];
|
|
114
|
+
options.push({
|
|
115
|
+
text: this.format === "creditcard"
|
|
116
|
+
? `${paddedMonth} (${monthName})`
|
|
117
|
+
: monthName,
|
|
118
|
+
value: paddedMonth
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
this.dropdownMonthOptions = options;
|
|
122
|
+
}
|
|
123
|
+
updateYearOptions() {
|
|
124
|
+
const options = [];
|
|
125
|
+
let years = [];
|
|
126
|
+
if (this._years) {
|
|
127
|
+
years = this._years;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const currentMonth = Number(this.value.split("-")[1] || "00");
|
|
131
|
+
const yearNow = new Date().getFullYear();
|
|
132
|
+
let minYear = this.minYear || (yearNow - 10);
|
|
133
|
+
let maxYear = this.maxYear || (yearNow + 10);
|
|
134
|
+
if (this.min) {
|
|
135
|
+
const minDate = new Date(this.min);
|
|
136
|
+
if (currentMonth && currentMonth < minDate.getMonth() + 1) {
|
|
137
|
+
minYear = minDate.getFullYear() + 1;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
minYear = minDate.getFullYear();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (this.max) {
|
|
144
|
+
const maxDate = new Date(this.max);
|
|
145
|
+
if (currentMonth && currentMonth > maxDate.getMonth() + 1) {
|
|
146
|
+
maxYear = maxDate.getFullYear() - 1;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
maxYear = maxDate.getFullYear();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
for (let i = minYear; i <= maxYear; i++) {
|
|
153
|
+
years.push(i);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
years.forEach((year) => {
|
|
157
|
+
options.push({ text: year, value: year });
|
|
158
|
+
});
|
|
159
|
+
this.dropdownYearOptions = options;
|
|
160
|
+
}
|
|
161
|
+
async componentWillLoad() {
|
|
162
|
+
if (!this.localization) {
|
|
163
|
+
this.localization = await fetchTranslations(this.element, "monthyearpicker");
|
|
164
|
+
}
|
|
165
|
+
this.monthsWatcher(this.months);
|
|
166
|
+
this.yearsWatcher(this.years);
|
|
167
|
+
}
|
|
168
|
+
render() {
|
|
169
|
+
const classes = {
|
|
170
|
+
"stzh-monthyearpicker": true
|
|
171
|
+
};
|
|
172
|
+
return (h(Host, { tabindex: this.disabled ? null : "-1", onFocus: this.onRootFocus }, h("div", { class: classes }, h("input", { type: "hidden", name: this.name, value: this.value }), h("div", { class: "stzh-monthyearpicker__wrapper" }, h("stzh-dropdown", { name: `${this.name}-month`, class: "stzh-monthyearpicker__months-dropdown", label: this.monthLabel || this.localization.monthLabel, ref: (el) => (this.monthsDropdown = el), onStzhChange: this.onMonthsDropdownChange, options: this.dropdownMonthOptions, items: [this.value.split("-")[1]], required: this.required, disabled: this.disabled, size: this.size, showMarker: this.showMarker, popoverPlacement: this.popoverPlacement, description: this.descriptionMonth, descriptionLong: this.descriptionLongMonth, error: this.errorMonth, a11yDescribedby: this.a11yDescribedbyMonth, invalid: this.invalidMonth }), h("div", { class: "stzh-monthyearpicker__separator" }, "/"), h("stzh-dropdown", { name: `${this.name}-year`, class: "stzh-monthyearpicker__years-dropdown", label: this.yearLabel || this.localization.yearLabel, onStzhChange: this.onYearsDropdownChange, options: this.dropdownYearOptions, items: [this.value.split("-")[0]], required: this.required, disabled: this.disabled, size: this.size, showMarker: this.showMarker, popoverPlacement: this.popoverPlacement, description: this.descriptionYear, descriptionLong: this.descriptionLongYear, error: this.errorYear, a11yDescribedby: this.a11yDescribedbyYear, invalid: this.invalidYear })))));
|
|
173
|
+
}
|
|
174
|
+
get element() { return getElement(this); }
|
|
175
|
+
static get watchers() { return {
|
|
176
|
+
"months": ["monthsWatcher"],
|
|
177
|
+
"years": ["yearsWatcher"],
|
|
178
|
+
"value": ["minMaxWatcher"],
|
|
179
|
+
"min": ["minMaxWatcher"],
|
|
180
|
+
"max": ["minMaxWatcher"]
|
|
181
|
+
}; }
|
|
182
|
+
};
|
|
183
|
+
StzhMonthyearpicker.style = stzhMonthyearpickerCss;
|
|
184
|
+
|
|
185
|
+
export { StzhMonthyearpicker as stzh_monthyearpicker };
|
|
186
|
+
|
|
187
|
+
//# sourceMappingURL=stzh-monthyearpicker.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"stzh-monthyearpicker.entry.js","mappings":";;;AAAA,MAAM,sBAAsB,GAAG,2zCAA2zC;;MC2B70C,mBAAmB;;;;IA0ItB,gBAAW,GAAG;MACpB,IAAI,IAAI,CAAC,cAAc,EAAE;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;OAChC;KACF,CAAA;IAEO,2BAAsB,GAAG,CAAC,KAA2C;MAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;MAChD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC;MACzC,IAAI,CAAC,QAAQ,CAAC,I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,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,WAAW,EAAE,IAAI,CAAC,eAAe,EACjC,eAAe,EAAE,IAAI,CAAC,mBAAmB,EACzC,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,eAAe,EAAE,IAAI,CAAC,mBAAmB,EACzC,OAAO,EAAE,IAAI,CAAC,WAAW,GACV,CACb,CACF,CACD,EACP;GACH;;;;;;;;;;;;;;","names":[],"sources":["./src/components/stzh-monthyearpicker/stzh-monthyearpicker.scss?tag=stzh-monthyearpicker&encapsulation=scoped","./src/components/stzh-monthyearpicker/stzh-monthyearpicker.tsx"],"sourcesContent":[":host {\n width: 100%;\n --separator-height: #{$formInputHeight};\n\n &[size=\"small\"] {\n --separator-height: #{$formInputHeightSmall};\n }\n}\n\n.stzh-monthyearpicker {\n &__wrapper {\n display: flex;\n align-items: flex-start;\n }\n\n &__separator {\n @include fontSize('milli');\n margin-left: space('medium');\n margin-right: space('medium');\n height: var(--separator-height);\n display: flex;\n align-items: center;\n }\n}\n","import {\n Component,\n Prop,\n Host,\n Element,\n h,\n Event,\n EventEmitter,\n Watch,\n} from \"@stencil/core\";\n\nimport {\n StzhDropdownOption,\n StzhDropdownChangeEvent,\n StzhMonthyearpickerChangeEvent\n} from \"../../index\";\n\nimport { fetchTranslations } from \"../../utils/translation-utils\";\nimport { StzhMonthyearpickerLocalizedText } from \"./stzh-monthyearpicker.localization\";\n\n/**\n */\n@Component({\n tag: \"stzh-monthyearpicker\",\n styleUrl: \"stzh-monthyearpicker.scss\",\n scoped: true\n})\nexport class StzhMonthyearpicker {\n /** Set which months to show (overwrites months from min/max) */\n @Prop() months: number[] | string;\n private _months: number[];\n\n /** Set which years to show (overwrites years from min/max) */\n @Prop() years: number[] | string;\n private _years: number[];\n\n /**\n * Minimum month and year allowed to be picked in `YYYY-MM` format.\n * This setting can be used alone or together with the `max` property.\n */\n @Prop() min: string;\n\n /**\n * Maximum month and year allowed to be picked in `YYYY-MM` format.\n * This setting can be used alone or together with the `min` property.\n */\n @Prop() max: string;\n\n /**\n * Minimum year (will be overwritten if `min` is used).\n * This setting can be used alone or together with the `maxYear` property.\n */\n @Prop() minYear: number;\n\n /**\n * Maximum year (will be overwritten if `max` is used).\n * This setting can be used alone or together with the `minYear` property.\n */\n @Prop() maxYear: number;\n\n /** Picker format. */\n @Prop({ reflect: true }) format: \"default\" | \"creditcard\" = \"default\";\n\n /** Name of the hidden date picker input. */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Value of hidden input (current selected year and month YYYY-MM). */\n @Prop({ mutable: true }) value: string = \"0000-00\";\n\n /** Popover placement for the dropdown (if applicable) */\n @Prop({ reflect: true }) popoverPlacement: \"bottom\" | \"bottom-end\" | \"bottom-center\" | \"top\" | \"top-end\" | \"top-center\" = \"bottom\";\n\n /** Month dropdown label */\n @Prop() monthLabel: string = \"\";\n\n /** Year dropdown label */\n @Prop() yearLabel: string = \"\";\n\n /** Whether the element is readonly or not */\n @Prop({ reflect: true }) readonly: boolean = false;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Description message for month */\n @Prop() descriptionMonth: string;\n\n /** Description message for year */\n @Prop() descriptionYear: string;\n\n /** Long description message appearing in a popover for month */\n @Prop() descriptionLongMonth: string;\n\n /** Long description message appearing in a popover for year */\n @Prop() descriptionLongYear: string;\n\n /** One or multiple error message for month */\n @Prop() errorMonth: string | string[];\n\n /** One or multiple error message for year */\n @Prop() errorYear: string | string[];\n\n /** Invalid status for month */\n @Prop({ reflect: true }) invalidMonth: boolean = false;\n\n /** Invalid status for year */\n @Prop({ reflect: true }) invalidYear: boolean = false;\n\n /** Id of the element which describes the month dropdown */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedbyMonth: string = \"\";\n\n /** Id of the element which describes the year dropdown */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedbyYear: string = \"\";\n\n /** Translation strings. */\n @Prop() localization: StzhMonthyearpickerLocalizedText;\n\n /** Monthyearpicker change event */\n @Event() stzhChange: EventEmitter<StzhMonthyearpickerChangeEvent>;\n\n @Element() element: HTMLStzhMonthyearpickerElement;\n\n @Watch(\"months\")\n monthsWatcher(newValue: number[] | string) {\n if (typeof newValue === \"string\") {\n this._months = JSON.parse(newValue);\n } else {\n this._months = newValue;\n }\n\n this.updateMonthOptions();\n }\n\n @Watch(\"years\")\n yearsWatcher(newValue: number[] | string) {\n if (typeof newValue === \"string\") {\n this._years = JSON.parse(newValue);\n } else {\n this._years = newValue;\n }\n\n this.updateYearOptions();\n }\n\n @Watch(\"value\")\n @Watch(\"min\")\n @Watch(\"max\")\n minMaxWatcher() {\n this.updateMonthOptions();\n this.updateYearOptions();\n }\n\n private monthsDropdown: HTMLStzhDropdownElement;\n private dropdownMonthOptions: StzhDropdownOption[];\n private dropdownYearOptions: StzhDropdownOption[];\n\n private onRootFocus = () => {\n if (this.monthsDropdown) {\n this.monthsDropdown.setFocus();\n }\n }\n\n private onMonthsDropdownChange = (event: CustomEvent<StzhDropdownChangeEvent>) => {\n const year = this.value.split(\"-\")[0] || \"0000\";\n const month = event.detail.value || \"00\";\n this.onChange(year, month);\n }\n\n private onYearsDropdownChange = (event: CustomEvent<StzhDropdownChangeEvent>) => {\n const year = event.detail.value || \"0000\";\n const month = this.value.split(\"-\")[1] || \"00\";\n this.onChange(year, month);\n }\n\n private onChange(year, month) {\n this.value = `${year}-${month}`;\n this.stzhChange.emit({\n component: \"stzh-monthyearpicker\",\n value: this.value,\n valueMonth: month,\n valueYear: year\n });\n }\n\n private updateMonthOptions() {\n const options = [];\n let months = [];\n\n if (this._months) {\n months = this._months;\n } else {\n const currentYear = Number(this.value.split(\"-\")[0] || \"0000\");\n\n let minMonth = 1;\n let maxMonth = 12;\n\n if (this.min) {\n const minDate = new Date(this.min);\n\n if (currentYear === minDate.getFullYear()) {\n minMonth = minDate.getMonth() + 1;\n }\n }\n\n if (this.max) {\n const maxDate = new Date(this.max);\n\n if (currentYear === maxDate.getFullYear()) {\n maxMonth = maxDate.getMonth() + 1;\n }\n }\n\n for (let i = minMonth; i <= maxMonth; i++) {\n months.push(i);\n }\n }\n\n months.forEach((month) => {\n const paddedMonth = (\"00\" + month).slice(-2);\n const monthName = this.localization.$globals.monthNames[month - 1];\n\n options.push({\n text: this.format === \"creditcard\"\n ? `${paddedMonth} (${monthName})`\n : monthName,\n value: paddedMonth\n });\n });\n\n this.dropdownMonthOptions = options;\n }\n\n private updateYearOptions(): void {\n const options = [];\n let years = [];\n\n if (this._years) {\n years = this._years;\n } else {\n const currentMonth = Number(this.value.split(\"-\")[1] || \"00\");\n\n const yearNow = new Date().getFullYear();\n let minYear = this.minYear || (yearNow - 10);\n let maxYear = this.maxYear || (yearNow + 10);\n\n if (this.min) {\n const minDate = new Date(this.min);\n\n if (currentMonth && currentMonth < minDate.getMonth() + 1) {\n minYear = minDate.getFullYear() + 1;\n } else {\n minYear = minDate.getFullYear();\n }\n }\n\n if (this.max) {\n const maxDate = new Date(this.max);\n\n if (currentMonth && currentMonth > maxDate.getMonth() + 1) {\n maxYear = maxDate.getFullYear() - 1;\n } else {\n maxYear = maxDate.getFullYear();\n }\n }\n\n for (let i = minYear; i <= maxYear; i++) {\n years.push(i);\n }\n }\n\n years.forEach((year) => {\n options.push({ text: year, value: year });\n });\n\n this.dropdownYearOptions = options;\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"monthyearpicker\");\n }\n\n this.monthsWatcher(this.months);\n this.yearsWatcher(this.years);\n }\n\n render() {\n const classes = {\n \"stzh-monthyearpicker\": true\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n <input\n type=\"hidden\"\n name={this.name}\n value={this.value}\n />\n\n <div class=\"stzh-monthyearpicker__wrapper\">\n <stzh-dropdown\n name={`${this.name}-month`}\n class=\"stzh-monthyearpicker__months-dropdown\"\n label={this.monthLabel || this.localization.monthLabel}\n ref={(el) => (this.monthsDropdown = el as HTMLStzhDropdownElement)}\n onStzhChange={this.onMonthsDropdownChange}\n options={this.dropdownMonthOptions}\n items={[this.value.split(\"-\")[1]]}\n required={this.required}\n disabled={this.disabled}\n size={this.size}\n showMarker={this.showMarker}\n popoverPlacement={this.popoverPlacement}\n description={this.descriptionMonth}\n descriptionLong={this.descriptionLongMonth}\n error={this.errorMonth}\n a11yDescribedby={this.a11yDescribedbyMonth}\n invalid={this.invalidMonth}\n ></stzh-dropdown>\n\n <div class=\"stzh-monthyearpicker__separator\">/</div>\n\n <stzh-dropdown\n name={`${this.name}-year`}\n class=\"stzh-monthyearpicker__years-dropdown\"\n label={this.yearLabel || this.localization.yearLabel}\n onStzhChange={this.onYearsDropdownChange}\n options={this.dropdownYearOptions}\n items={[this.value.split(\"-\")[0]]}\n required={this.required}\n disabled={this.disabled}\n size={this.size}\n showMarker={this.showMarker}\n popoverPlacement={this.popoverPlacement}\n description={this.descriptionYear}\n descriptionLong={this.descriptionLongYear}\n error={this.errorYear}\n a11yDescribedby={this.a11yDescribedbyYear}\n invalid={this.invalidYear}\n ></stzh-dropdown>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|