@everymatrix/helper-date-navigator 0.0.1

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.
Files changed (57) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/helper-date-navigator-ec7c6e2d.js +7070 -0
  3. package/dist/cjs/helper-date-navigator.cjs.entry.js +10 -0
  4. package/dist/cjs/helper-date-navigator.cjs.js +25 -0
  5. package/dist/cjs/index-4edbea76.js +1235 -0
  6. package/dist/cjs/index.cjs.js +10 -0
  7. package/dist/cjs/loader.cjs.js +15 -0
  8. package/dist/collection/collection-manifest.json +12 -0
  9. package/dist/collection/components/helper-date-navigator/helper-date-navigator.css +144 -0
  10. package/dist/collection/components/helper-date-navigator/helper-date-navigator.js +454 -0
  11. package/dist/collection/components/helper-date-navigator/index.js +1 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +39 -0
  14. package/dist/collection/utils/utils.js +3 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/helper-date-navigator-9d4b05fa.js +7068 -0
  17. package/dist/esm/helper-date-navigator.entry.js +2 -0
  18. package/dist/esm/helper-date-navigator.js +20 -0
  19. package/dist/esm/index-aec7c9dd.js +1208 -0
  20. package/dist/esm/index.js +2 -0
  21. package/dist/esm/loader.js +11 -0
  22. package/dist/helper-date-navigator/app-globals-0f993ce5.js +1 -0
  23. package/dist/helper-date-navigator/helper-date-navigator-9d4b05fa.js +6657 -0
  24. package/dist/helper-date-navigator/helper-date-navigator.entry.js +1 -0
  25. package/dist/helper-date-navigator/helper-date-navigator.esm.js +1 -0
  26. package/dist/helper-date-navigator/index-aec7c9dd.js +2 -0
  27. package/dist/helper-date-navigator/index.esm.js +1 -0
  28. package/dist/index.cjs.js +1 -0
  29. package/dist/index.js +1 -0
  30. package/dist/stencil.config.dev.js +19 -0
  31. package/dist/stencil.config.js +19 -0
  32. package/dist/storybook/main.js +43 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/packages/stencil/helper-date-navigator/stencil.config.d.ts +2 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/packages/stencil/helper-date-navigator/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/packages/stencil/helper-date-navigator/storybook/main.d.ts +3 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/packages/stencil/helper-date-navigator/storybook/preview.d.ts +70 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/tools/plugins/index.d.ts +4 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/helper-date-navigator/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  44. package/dist/types/components/helper-date-navigator/helper-date-navigator.d.ts +91 -0
  45. package/dist/types/components/helper-date-navigator/index.d.ts +1 -0
  46. package/dist/types/components.d.ts +101 -0
  47. package/dist/types/index.d.ts +1 -0
  48. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  49. package/dist/types/utils/locale.utils.d.ts +3 -0
  50. package/dist/types/utils/utils.d.ts +1 -0
  51. package/loader/cdn.js +1 -0
  52. package/loader/index.cjs.js +1 -0
  53. package/loader/index.d.ts +24 -0
  54. package/loader/index.es2017.js +1 -0
  55. package/loader/index.js +2 -0
  56. package/loader/package.json +11 -0
  57. package/package.json +27 -0
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const helperDateNavigator = require('./helper-date-navigator-ec7c6e2d.js');
6
+ require('./index-4edbea76.js');
7
+
8
+
9
+
10
+ exports.HelperDateNavigator = helperDateNavigator.HelperDateNavigator;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4edbea76.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ const defineCustomElements = async (win, options) => {
9
+ if (typeof window === 'undefined') return undefined;
10
+ await appGlobals.globalScripts();
11
+ return index.bootstrapLazy([["helper-date-navigator.cjs",[[1,"helper-date-navigator",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"language":[513],"date":[1],"defaultHighlightDates":[1,"default-highlight-dates"],"highlightDates":[32],"weeks":[32],"days":[32],"alterDate":[32],"curDate":[32],"recordInfo":[32],"showCalendar":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"defaultHighlightDates":["handleGameIdStringChange"],"date":["handleDateChange"]}]]]], options);
12
+ };
13
+
14
+ exports.setNonce = index.setNonce;
15
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "components/helper-date-navigator/helper-date-navigator.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "4.19.2",
8
+ "typescriptVersion": "5.4.5"
9
+ },
10
+ "collections": [],
11
+ "bundles": []
12
+ }
@@ -0,0 +1,144 @@
1
+ .lottery-tipping-calendar {
2
+ position: relative;
3
+ display: inline-block;
4
+ }
5
+
6
+ .calendar-visible {
7
+ opacity: 1;
8
+ visibility: visible;
9
+ }
10
+
11
+ .calendar-leave {
12
+ opacity: 0;
13
+ visibility: hidden;
14
+ }
15
+
16
+ .calendar {
17
+ position: absolute;
18
+ top: 40px;
19
+ left: -50%;
20
+ background: var(--emw--color-background, #fff);
21
+ color: var(--emw--color-typography-secondary, #6f6f6f);
22
+ padding: 16px;
23
+ width: fit-content;
24
+ border: var(--emw--button-border, 1px solid rgba(221, 221, 221, 0.8666666667));
25
+ border-radius: var(--emw--border-radius-small, 4px);
26
+ box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.1);
27
+ cursor: pointer;
28
+ transition: opacity 0.2s ease, visibility 0.2s ease;
29
+ z-index: 99;
30
+ }
31
+ .calendar-header {
32
+ display: flex;
33
+ align-items: center;
34
+ }
35
+ .calendar-header .date-picker {
36
+ display: flex;
37
+ margin: 0 18px;
38
+ align-items: center;
39
+ }
40
+ .calendar-header .date-picker-delimiter {
41
+ font-size: 16px;
42
+ margin: auto 4px;
43
+ }
44
+ .calendar-header .month-plus,
45
+ .calendar-header .month-minus,
46
+ .calendar-header .year-plus,
47
+ .calendar-header .year-minus {
48
+ cursor: pointer;
49
+ font-size: 14px;
50
+ }
51
+ .calendar-header .month-plus:hover,
52
+ .calendar-header .month-minus:hover,
53
+ .calendar-header .year-plus:hover,
54
+ .calendar-header .year-minus:hover {
55
+ color: var(--emw-pool-game-acition-active, #005fdb);
56
+ transition: color 0.2s;
57
+ }
58
+ .calendar-header .year-minus,
59
+ .calendar-header .month-plus {
60
+ margin-right: 6px;
61
+ }
62
+ .calendar-content {
63
+ padding: 3px;
64
+ width: fit-content;
65
+ }
66
+ .calendar-content .day-item {
67
+ text-align: center;
68
+ line-height: 40px;
69
+ cursor: not-allowed;
70
+ position: relative;
71
+ pointer-events: none;
72
+ }
73
+ .calendar-content .day-item:hover {
74
+ background-color: var(--emw--color-background-secondary, #f5f5f5);
75
+ }
76
+ .calendar-content .day-item.isCurDay {
77
+ border-radius: 4px;
78
+ background: var(--emw--color-secondary, #fff3b9);
79
+ background-size: 50%;
80
+ color: var(--emw--color-typography-secondary, #6f6f6f);
81
+ font-weight: 600;
82
+ box-shadow: 2px 2px 2px var(--emw-calender-curday-box-shadow, rgba(0, 0, 0, 0.09));
83
+ cursor: pointer;
84
+ pointer-events: all;
85
+ }
86
+ .calendar-content .day-item.isHighLight {
87
+ cursor: pointer;
88
+ pointer-events: all;
89
+ }
90
+ .calendar-content .day-item.isHighLight::after {
91
+ content: "";
92
+ position: absolute;
93
+ left: calc(50% - 4px);
94
+ bottom: 0;
95
+ width: 6px;
96
+ height: 6px;
97
+ border-radius: 50%;
98
+ background-color: var(--emw--color-error, red);
99
+ }
100
+ .calendar-content-week {
101
+ display: grid;
102
+ grid-template-columns: repeat(7, 40px);
103
+ grid-template-rows: repeat(1, 36px);
104
+ justify-items: center;
105
+ align-items: center;
106
+ border-bottom: var(--emw--button-border, 1px solid rgba(221, 221, 221, 0.8666666667));
107
+ color: var(--emw--color-typography-secondary, #6f6f6f);
108
+ }
109
+ .calendar-content-day {
110
+ margin-top: 4px;
111
+ display: grid;
112
+ grid-template-rows: repeat(6, 40px);
113
+ grid-template-columns: repeat(7, 40px);
114
+ }
115
+
116
+ .calling-input {
117
+ height: 36px;
118
+ width: 160px;
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: space-between;
122
+ padding: 0px 4px;
123
+ background-color: var(--emw--color-background, #f5f5f5);
124
+ border-radius: var(--emw--border-radius-small, 4px);
125
+ border: var(--emw--button-border, 1px solid rgba(221, 221, 221, 0.8666666667));
126
+ cursor: pointer;
127
+ }
128
+ .calling-input .input {
129
+ color: var(--emw--color-typography, #000);
130
+ }
131
+ .calling-input-text {
132
+ color: var(--emw--color-typography, #000);
133
+ }
134
+
135
+ .date-selection {
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ gap: 24px;
140
+ }
141
+ .date-selection-leftIcon, .date-selection-rightIcon {
142
+ cursor: pointer;
143
+ color: var(--emw--color-typography, #000);
144
+ }
@@ -0,0 +1,454 @@
1
+ import { CalendarOutlined, LeftOutlined, RightOutlined } from "@ant-design/icons-svg";
2
+ import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers";
3
+ import { h } from "@stencil/core";
4
+ import "../../../../../../../libs/vaadin-facade/index";
5
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
6
+ import { resolveTranslationUrl, translate } from "../../utils/locale.utils";
7
+ const leftArrowIcon = renderIconDefinitionToSVGElement(LeftOutlined, {
8
+ extraSVGAttrs: { width: '16px', height: '16px', fill: 'currentColor' }
9
+ });
10
+ const rightArrowIcon = renderIconDefinitionToSVGElement(RightOutlined, {
11
+ extraSVGAttrs: { width: '16px', height: '16px', fill: 'currentColor' }
12
+ });
13
+ const calendarIcon = renderIconDefinitionToSVGElement(CalendarOutlined, {
14
+ extraSVGAttrs: { width: '18px', height: '18px', fill: 'var(--emw--color-primary-variant, #1367e7)' }
15
+ });
16
+ export class HelperDateNavigator {
17
+ constructor() {
18
+ this.handleOutsideClick = (event) => {
19
+ if (!this.showCalendar)
20
+ return;
21
+ const path = event.composedPath ? event.composedPath() : [];
22
+ // check if clicked on calendar
23
+ const isCalendarClick = path.includes(this.calendarRef);
24
+ // check if click select option
25
+ const isSelectOption = path.some((el) => {
26
+ var _a, _b;
27
+ return el instanceof HTMLElement &&
28
+ (((_a = el.getAttribute('part')) === null || _a === void 0 ? void 0 : _a.includes('item')) || ((_b = el.getAttribute('part')) === null || _b === void 0 ? void 0 : _b.includes('overlay')));
29
+ });
30
+ if (!isCalendarClick && !isSelectOption) {
31
+ this.showCalendar = false;
32
+ }
33
+ };
34
+ this.onYearMinus = () => {
35
+ const years = this.yearOptions.map((item) => Number(item.value));
36
+ if (this.alterDate.year - 1 < Math.min(...years))
37
+ return;
38
+ this.alterDate.year--;
39
+ this.loadRecords();
40
+ };
41
+ this.onYearPlus = () => {
42
+ const years = this.yearOptions.map((item) => Number(item.value));
43
+ if (this.alterDate.year + 1 > Math.max(...years))
44
+ return;
45
+ this.alterDate.year++;
46
+ this.loadRecords();
47
+ };
48
+ this.onMonthMinus = () => {
49
+ if (this.alterDate.month === 0) {
50
+ this.onYearMinus();
51
+ this.alterDate.month = 11;
52
+ }
53
+ else {
54
+ this.alterDate.month--;
55
+ this.loadRecords();
56
+ }
57
+ };
58
+ this.onMonthPlus = () => {
59
+ if (this.alterDate.month === 11) {
60
+ this.onYearPlus();
61
+ this.alterDate.month = 0;
62
+ }
63
+ else {
64
+ this.alterDate.month++;
65
+ this.loadRecords();
66
+ }
67
+ };
68
+ this.onYearChange = (e) => {
69
+ this.alterDate.year = parseInt(e.detail.value);
70
+ this.loadRecords();
71
+ };
72
+ this.onMonthChange = (e) => {
73
+ this.alterDate.month = parseInt(e.detail.value) - 1;
74
+ this.loadRecords();
75
+ };
76
+ this.mbSource = undefined;
77
+ this.clientStyling = undefined;
78
+ this.clientStylingUrl = undefined;
79
+ this.translationUrl = '';
80
+ this.language = 'en';
81
+ this.date = '';
82
+ this.defaultHighlightDates = undefined;
83
+ this.highlightDates = [];
84
+ this.weeks = undefined;
85
+ this.days = [];
86
+ this.alterDate = { year: 0, month: 0, day: 0 };
87
+ this.curDate = { year: 0, month: 0, day: 0 };
88
+ this.recordInfo = [];
89
+ this.showCalendar = false;
90
+ }
91
+ handleClientStylingChange(newValue, oldValue) {
92
+ if (newValue != oldValue) {
93
+ setClientStyling(this.stylingContainer, this.clientStyling);
94
+ }
95
+ }
96
+ handleClientStylingUrlChange(newValue, oldValue) {
97
+ if (newValue != oldValue) {
98
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
99
+ }
100
+ }
101
+ handleMbSourceChange(newValue, oldValue) {
102
+ if (newValue != oldValue) {
103
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
104
+ }
105
+ }
106
+ handleGameIdStringChange(newValue, oldValue) {
107
+ if (newValue != oldValue) {
108
+ this.setHighlightDates();
109
+ }
110
+ }
111
+ componentWillLoad() {
112
+ resolveTranslationUrl(this.translationUrl);
113
+ this.weeks = translate('weeks', this.language);
114
+ const d = this.date ? new Date(this.date) : new Date();
115
+ this.alterDate = { year: d.getFullYear(), month: d.getMonth(), day: d.getDate() };
116
+ this.curDate = Object.assign({}, this.alterDate);
117
+ this.loadRecords();
118
+ }
119
+ handleDateChange() {
120
+ const d = this.date ? new Date(this.date) : new Date();
121
+ this.alterDate = { year: d.getFullYear(), month: d.getMonth(), day: d.getDate() };
122
+ this.curDate = Object.assign({}, this.alterDate);
123
+ this.loadRecords();
124
+ }
125
+ setHighlightDates() {
126
+ if (this.defaultHighlightDates) {
127
+ try {
128
+ this.highlightDates = JSON.parse(this.defaultHighlightDates);
129
+ }
130
+ catch (_a) {
131
+ this.highlightDates = [];
132
+ }
133
+ }
134
+ }
135
+ componentDidLoad() {
136
+ if (this.stylingContainer) {
137
+ if (this.mbSource)
138
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
139
+ if (this.clientStyling)
140
+ setClientStyling(this.stylingContainer, this.clientStyling);
141
+ if (this.clientStylingUrl)
142
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
143
+ }
144
+ this.setHighlightDates();
145
+ document.addEventListener('click', this.handleOutsideClick);
146
+ }
147
+ disconnectedCallback() {
148
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
149
+ document.removeEventListener('click', this.handleOutsideClick);
150
+ }
151
+ get yearOptions() {
152
+ const years = Array.from({ length: 101 }, (_, i) => this.alterDate.year - 50 + i);
153
+ return years.map((item) => {
154
+ return {
155
+ label: String(item),
156
+ value: String(item)
157
+ };
158
+ });
159
+ }
160
+ get monthOptions() {
161
+ const months = Array.from({ length: 12 }, (_, i) => i + 1);
162
+ return months.map((item) => {
163
+ return {
164
+ label: String(item),
165
+ value: String(item)
166
+ };
167
+ });
168
+ }
169
+ loadRecords() {
170
+ const { year, month } = this.alterDate;
171
+ this.setDays(year, month);
172
+ }
173
+ setDays(year, month) {
174
+ this.days = [];
175
+ const firstDayOfMonth = new Date(year, month, 1);
176
+ const firstDayWeek = firstDayOfMonth.getDay();
177
+ const startDate = new Date(year, month, 1 - firstDayWeek);
178
+ for (let i = 0; i < 42; i++) {
179
+ const temp = new Date(startDate);
180
+ temp.setDate(startDate.getDate() + i);
181
+ const day = {
182
+ date: temp.getDate(),
183
+ month: temp.getMonth(),
184
+ year: temp.getFullYear()
185
+ };
186
+ this.days.push(day);
187
+ }
188
+ }
189
+ getFullDayOfMonth(year, month) {
190
+ return new Date(year, month, 0).getDate();
191
+ }
192
+ showFormatedDate(date) {
193
+ return `${date.day}/${date.month + 1}/${date.year}`;
194
+ }
195
+ handleSelectDate(curDay, curMonth, curYear) {
196
+ this.alterDate.day = curDay;
197
+ this.curDate = Object.assign({}, this.alterDate);
198
+ this.showCalendar = false;
199
+ const formattedHighLightArr = this.highlightDates.map((date) => {
200
+ const d = new Date(date);
201
+ return { year: d.getFullYear(), month: d.getMonth(), day: d.getDate() };
202
+ });
203
+ const idx = formattedHighLightArr.findIndex((obj) => {
204
+ const { year, month, day } = obj;
205
+ return curMonth === month && curYear === year && curDay === day;
206
+ });
207
+ if (idx > -1) {
208
+ this.changeDate.emit(idx);
209
+ }
210
+ }
211
+ tellIsCurDay(curDay, curMonth, curYear) {
212
+ return this.curDate.day === curDay && this.curDate.month === curMonth && this.curDate.year === curYear;
213
+ }
214
+ tellIsHighLight(curDay, curMonth, curYear) {
215
+ if (!this.highlightDates || !this.highlightDates.length)
216
+ return false;
217
+ const formattedHighLightArr = this.highlightDates.map((date) => {
218
+ const d = new Date(date);
219
+ return { year: d.getFullYear(), month: d.getMonth(), day: d.getDate() };
220
+ });
221
+ return formattedHighLightArr.some((obj) => {
222
+ const { year, month, day } = obj;
223
+ return curMonth === month && curYear === year && curDay === day;
224
+ });
225
+ }
226
+ renderInner() {
227
+ const calendarClass = ['calendar', this.showCalendar ? 'calendar-visible' : 'calendar-leave'];
228
+ return (h("div", { class: "lottery-tipping-calendar", ref: (el) => (this.calendarRef = el) }, h("div", { class: "calling-input", onClick: () => {
229
+ this.showCalendar = true;
230
+ } }, h("div", { class: "calling-input-text" }, this.showFormatedDate(this.curDate)), h("div", { class: "calling-input-icon", innerHTML: calendarIcon })), h("div", { class: calendarClass.join(' ') }, h("div", { class: "calendar-header" }, h("div", { class: "date-controller year-minus", onClick: this.onYearMinus }, "<"), h("div", { class: "date-controller month-minus", onClick: this.onMonthMinus }, "<"), h("div", { class: "date-picker" }, h("div", { class: "date-picker-year" }, h("vaadin-select", { items: this.yearOptions, value: this.alterDate.year, style: { '--vaadin-field-default-width': '90px' }, "on-value-changed": this.onYearChange.bind(this) })), h("div", { class: "date-picker-delimiter" }, "-"), h("div", { class: "date-picker-month" }, h("vaadin-select", { items: this.monthOptions, value: this.alterDate.month + 1, style: { '--vaadin-field-default-width': '64px' }, "on-value-changed": this.onMonthChange.bind(this) })), h("div", { class: "date-picker-delimiter" }, "-"), h("div", { class: "date-picker-day" }, this.alterDate.day)), h("div", { class: "date-controller month-plus", onClick: this.onMonthPlus }, ">"), h("div", { class: "date-controller year-plus", onClick: this.onYearPlus }, ">")), h("div", { class: "calendar-content" }, h("div", { class: "calendar-content-week" }, this.weeks.map((week) => (h("div", { class: "week-item" }, week)))), h("div", { class: "calendar-content-day" }, this.days.map((item) => (h("div", { class: {
231
+ 'day-item': true,
232
+ isCurDay: this.tellIsCurDay(item.date, item.month, item.year),
233
+ isHighLight: this.tellIsHighLight(item.date, item.month, item.year)
234
+ }, onClick: () => this.handleSelectDate(item.date, item.month, item.year) }, item.date))))))));
235
+ }
236
+ render() {
237
+ return (h("div", { key: 'da34c4c86cac49411fb15ab8bceda89e379befc6', class: "date-selection" }, h("div", { key: '29f06ef7a5df466018ae6561b54fcbdfbab9f23b', class: "date-selection-leftIcon", innerHTML: leftArrowIcon, onClick: () => this.handlePrev.emit() }), h("div", { key: 'c6d75d873c2683752c37d4083c57761c4f7e523b', class: "date-selection-calendar" }, this.renderInner()), h("div", { key: '8b16b3e0761dd4c877f169aea84d028aaf193b69', class: "date-selection-rightIcon", innerHTML: rightArrowIcon, onClick: () => this.handleNext.emit() })));
238
+ }
239
+ static get is() { return "helper-date-navigator"; }
240
+ static get encapsulation() { return "shadow"; }
241
+ static get originalStyleUrls() {
242
+ return {
243
+ "$": ["helper-date-navigator.scss"]
244
+ };
245
+ }
246
+ static get styleUrls() {
247
+ return {
248
+ "$": ["helper-date-navigator.css"]
249
+ };
250
+ }
251
+ static get properties() {
252
+ return {
253
+ "mbSource": {
254
+ "type": "string",
255
+ "mutable": false,
256
+ "complexType": {
257
+ "original": "string",
258
+ "resolved": "string",
259
+ "references": {}
260
+ },
261
+ "required": false,
262
+ "optional": false,
263
+ "docs": {
264
+ "tags": [],
265
+ "text": "Client custom styling via message bus"
266
+ },
267
+ "attribute": "mb-source",
268
+ "reflect": true
269
+ },
270
+ "clientStyling": {
271
+ "type": "string",
272
+ "mutable": false,
273
+ "complexType": {
274
+ "original": "string",
275
+ "resolved": "string",
276
+ "references": {}
277
+ },
278
+ "required": false,
279
+ "optional": false,
280
+ "docs": {
281
+ "tags": [],
282
+ "text": "Client custom styling via string"
283
+ },
284
+ "attribute": "client-styling",
285
+ "reflect": true
286
+ },
287
+ "clientStylingUrl": {
288
+ "type": "string",
289
+ "mutable": false,
290
+ "complexType": {
291
+ "original": "string",
292
+ "resolved": "string",
293
+ "references": {}
294
+ },
295
+ "required": false,
296
+ "optional": false,
297
+ "docs": {
298
+ "tags": [],
299
+ "text": "Client custom styling via css file url"
300
+ },
301
+ "attribute": "client-styling-url",
302
+ "reflect": true
303
+ },
304
+ "translationUrl": {
305
+ "type": "string",
306
+ "mutable": false,
307
+ "complexType": {
308
+ "original": "string",
309
+ "resolved": "string",
310
+ "references": {}
311
+ },
312
+ "required": false,
313
+ "optional": false,
314
+ "docs": {
315
+ "tags": [],
316
+ "text": "Client custom translation via json file url"
317
+ },
318
+ "attribute": "translation-url",
319
+ "reflect": true,
320
+ "defaultValue": "''"
321
+ },
322
+ "language": {
323
+ "type": "string",
324
+ "mutable": false,
325
+ "complexType": {
326
+ "original": "string",
327
+ "resolved": "string",
328
+ "references": {}
329
+ },
330
+ "required": false,
331
+ "optional": false,
332
+ "docs": {
333
+ "tags": [],
334
+ "text": "Client custom language for translation"
335
+ },
336
+ "attribute": "language",
337
+ "reflect": true,
338
+ "defaultValue": "'en'"
339
+ },
340
+ "date": {
341
+ "type": "string",
342
+ "mutable": false,
343
+ "complexType": {
344
+ "original": "string",
345
+ "resolved": "string",
346
+ "references": {}
347
+ },
348
+ "required": false,
349
+ "optional": false,
350
+ "docs": {
351
+ "tags": [],
352
+ "text": ""
353
+ },
354
+ "attribute": "date",
355
+ "reflect": false,
356
+ "defaultValue": "''"
357
+ },
358
+ "defaultHighlightDates": {
359
+ "type": "string",
360
+ "mutable": false,
361
+ "complexType": {
362
+ "original": "string",
363
+ "resolved": "string",
364
+ "references": {}
365
+ },
366
+ "required": false,
367
+ "optional": false,
368
+ "docs": {
369
+ "tags": [],
370
+ "text": ""
371
+ },
372
+ "attribute": "default-highlight-dates",
373
+ "reflect": false
374
+ }
375
+ };
376
+ }
377
+ static get states() {
378
+ return {
379
+ "highlightDates": {},
380
+ "weeks": {},
381
+ "days": {},
382
+ "alterDate": {},
383
+ "curDate": {},
384
+ "recordInfo": {},
385
+ "showCalendar": {}
386
+ };
387
+ }
388
+ static get events() {
389
+ return [{
390
+ "method": "changeDate",
391
+ "name": "changeDate",
392
+ "bubbles": true,
393
+ "cancelable": true,
394
+ "composed": true,
395
+ "docs": {
396
+ "tags": [],
397
+ "text": ""
398
+ },
399
+ "complexType": {
400
+ "original": "number",
401
+ "resolved": "number",
402
+ "references": {}
403
+ }
404
+ }, {
405
+ "method": "handleNext",
406
+ "name": "next",
407
+ "bubbles": true,
408
+ "cancelable": true,
409
+ "composed": true,
410
+ "docs": {
411
+ "tags": [],
412
+ "text": ""
413
+ },
414
+ "complexType": {
415
+ "original": "void",
416
+ "resolved": "void",
417
+ "references": {}
418
+ }
419
+ }, {
420
+ "method": "handlePrev",
421
+ "name": "prev",
422
+ "bubbles": true,
423
+ "cancelable": true,
424
+ "composed": true,
425
+ "docs": {
426
+ "tags": [],
427
+ "text": ""
428
+ },
429
+ "complexType": {
430
+ "original": "void",
431
+ "resolved": "void",
432
+ "references": {}
433
+ }
434
+ }];
435
+ }
436
+ static get watchers() {
437
+ return [{
438
+ "propName": "clientStyling",
439
+ "methodName": "handleClientStylingChange"
440
+ }, {
441
+ "propName": "clientStylingUrl",
442
+ "methodName": "handleClientStylingUrlChange"
443
+ }, {
444
+ "propName": "mbSource",
445
+ "methodName": "handleMbSourceChange"
446
+ }, {
447
+ "propName": "defaultHighlightDates",
448
+ "methodName": "handleGameIdStringChange"
449
+ }, {
450
+ "propName": "date",
451
+ "methodName": "handleDateChange"
452
+ }];
453
+ }
454
+ }
@@ -0,0 +1 @@
1
+ export { HelperDateNavigator } from './helper-date-navigator';
@@ -0,0 +1 @@
1
+ export * from './components/helper-date-navigator';
@@ -0,0 +1,39 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
6
+ },
7
+ };
8
+ export const translate = (key, customLang, replacements) => {
9
+ const lang = customLang;
10
+ let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
11
+ if (replacements) {
12
+ Object.keys(replacements).forEach((placeholder) => {
13
+ translation = translation.replace(`{${placeholder}}`, replacements[placeholder]);
14
+ });
15
+ }
16
+ return translation;
17
+ };
18
+ export const getTranslations = (data) => {
19
+ Object.keys(data).forEach((item) => {
20
+ for (let key in data[item]) {
21
+ TRANSLATIONS[item][key] = data[item][key];
22
+ }
23
+ });
24
+ };
25
+ export const resolveTranslationUrl = async (translationUrl) => {
26
+ if (translationUrl) {
27
+ try {
28
+ const response = await fetch(translationUrl);
29
+ if (!response.ok) {
30
+ throw new Error(`HTTP error! status: ${response.status}`);
31
+ }
32
+ const translations = await response.json();
33
+ getTranslations(translations);
34
+ }
35
+ catch (error) {
36
+ console.error('Failed to fetch or parse translations from URL:', error);
37
+ }
38
+ }
39
+ };
@@ -0,0 +1,3 @@
1
+ export function format(first, middle, last) {
2
+ return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
3
+ }