@uzum-tech/ui 1.12.21 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/index.js +2789 -510
  2. package/dist/index.prod.js +4 -4
  3. package/es/_styles/common/dark.js +1 -1
  4. package/es/_styles/common/light.d.ts +1 -0
  5. package/es/_styles/common/light.js +1 -1
  6. package/es/chat/src/ChatMessages.js +6 -1
  7. package/es/chat/src/styles/index.cssr.js +5 -1
  8. package/es/components.d.ts +1 -0
  9. package/es/components.js +1 -0
  10. package/es/config-provider/src/internal-interface.d.ts +3 -0
  11. package/es/date-picker-v2/index.d.ts +5 -0
  12. package/es/date-picker-v2/index.js +2 -0
  13. package/es/date-picker-v2/src/DatePickerV2.d.ts +4765 -0
  14. package/es/date-picker-v2/src/DatePickerV2.js +750 -0
  15. package/es/date-picker-v2/src/composables/useCalendarScroll.d.ts +1133 -0
  16. package/es/date-picker-v2/src/composables/useCalendarScroll.js +61 -0
  17. package/es/date-picker-v2/src/config.d.ts +14 -0
  18. package/es/date-picker-v2/src/config.js +34 -0
  19. package/es/date-picker-v2/src/interface.d.ts +42 -0
  20. package/es/date-picker-v2/src/interface.js +1 -0
  21. package/es/date-picker-v2/src/panel/CalendarPanel.d.ts +1222 -0
  22. package/es/date-picker-v2/src/panel/CalendarPanel.js +186 -0
  23. package/es/date-picker-v2/src/panel/CalendarRangePanel.d.ts +1246 -0
  24. package/es/date-picker-v2/src/panel/CalendarRangePanel.js +205 -0
  25. package/es/date-picker-v2/src/styles/index.cssr.d.ts +2 -0
  26. package/es/date-picker-v2/src/styles/index.cssr.js +190 -0
  27. package/es/date-picker-v2/src/utils.d.ts +12 -0
  28. package/es/date-picker-v2/src/utils.js +92 -0
  29. package/es/date-picker-v2/styles/dark.d.ts +447 -0
  30. package/es/date-picker-v2/styles/dark.js +19 -0
  31. package/es/date-picker-v2/styles/index.d.ts +3 -0
  32. package/es/date-picker-v2/styles/index.js +2 -0
  33. package/es/date-picker-v2/styles/light.d.ts +477 -0
  34. package/es/date-picker-v2/styles/light.js +56 -0
  35. package/es/dialog/src/DialogProvider.d.ts +2 -0
  36. package/es/header/src/Header.js +4 -1
  37. package/es/header/src/HeaderSearchDesktop.d.ts +12 -0
  38. package/es/header/src/HeaderSearchDesktop.js +21 -4
  39. package/es/header/src/HeaderSearchMobile.d.ts +12 -0
  40. package/es/header/src/HeaderSearchMobile.js +8 -2
  41. package/es/header/src/mobile/HeaderMobile.js +18 -3
  42. package/es/locales/common/enUS.js +1 -1
  43. package/es/theme-editor/src/ThemeEditor.d.ts +1 -0
  44. package/es/themes/dark.js +2 -0
  45. package/es/themes/light.js +2 -0
  46. package/es/version.d.ts +1 -1
  47. package/es/version.js +1 -1
  48. package/lib/_styles/common/dark.js +1 -1
  49. package/lib/_styles/common/light.d.ts +1 -0
  50. package/lib/_styles/common/light.js +1 -1
  51. package/lib/chat/src/ChatMessages.js +6 -1
  52. package/lib/chat/src/styles/index.cssr.js +5 -1
  53. package/lib/components.d.ts +1 -0
  54. package/lib/components.js +1 -0
  55. package/lib/config-provider/src/internal-interface.d.ts +3 -0
  56. package/lib/date-picker-v2/index.d.ts +5 -0
  57. package/lib/date-picker-v2/index.js +11 -0
  58. package/lib/date-picker-v2/src/DatePickerV2.d.ts +4765 -0
  59. package/lib/date-picker-v2/src/DatePickerV2.js +756 -0
  60. package/lib/date-picker-v2/src/composables/useCalendarScroll.d.ts +1133 -0
  61. package/lib/date-picker-v2/src/composables/useCalendarScroll.js +64 -0
  62. package/lib/date-picker-v2/src/config.d.ts +14 -0
  63. package/lib/date-picker-v2/src/config.js +37 -0
  64. package/lib/date-picker-v2/src/interface.d.ts +42 -0
  65. package/lib/date-picker-v2/src/interface.js +4 -0
  66. package/lib/date-picker-v2/src/panel/CalendarPanel.d.ts +1222 -0
  67. package/lib/date-picker-v2/src/panel/CalendarPanel.js +188 -0
  68. package/lib/date-picker-v2/src/panel/CalendarRangePanel.d.ts +1246 -0
  69. package/lib/date-picker-v2/src/panel/CalendarRangePanel.js +207 -0
  70. package/lib/date-picker-v2/src/styles/index.cssr.d.ts +2 -0
  71. package/lib/date-picker-v2/src/styles/index.cssr.js +195 -0
  72. package/lib/date-picker-v2/src/utils.d.ts +12 -0
  73. package/lib/date-picker-v2/src/utils.js +101 -0
  74. package/lib/date-picker-v2/styles/dark.d.ts +447 -0
  75. package/lib/date-picker-v2/styles/dark.js +21 -0
  76. package/lib/date-picker-v2/styles/index.d.ts +3 -0
  77. package/lib/date-picker-v2/styles/index.js +10 -0
  78. package/lib/date-picker-v2/styles/light.d.ts +477 -0
  79. package/lib/date-picker-v2/styles/light.js +60 -0
  80. package/lib/dialog/src/DialogProvider.d.ts +2 -0
  81. package/lib/header/src/Header.js +4 -1
  82. package/lib/header/src/HeaderSearchDesktop.d.ts +12 -0
  83. package/lib/header/src/HeaderSearchDesktop.js +20 -3
  84. package/lib/header/src/HeaderSearchMobile.d.ts +12 -0
  85. package/lib/header/src/HeaderSearchMobile.js +7 -1
  86. package/lib/header/src/mobile/HeaderMobile.js +18 -3
  87. package/lib/locales/common/enUS.js +1 -1
  88. package/lib/theme-editor/src/ThemeEditor.d.ts +1 -0
  89. package/lib/themes/dark.js +2 -0
  90. package/lib/themes/light.js +2 -0
  91. package/lib/version.d.ts +1 -1
  92. package/lib/version.js +1 -1
  93. package/package.json +1 -1
  94. package/volar.d.ts +1 -0
  95. package/web-types.json +161 -1
@@ -0,0 +1,186 @@
1
+ import { h, defineComponent, computed, inject } from 'vue';
2
+ import { UScrollbar, UBaseIcon } from '../../../_internal';
3
+ import { ChevronDownIcon } from '../../../_internal/icons';
4
+ import { generateDatesForMonth, generateAllMonths, generateYears, getMonthLabel, getWeekdayNames } from '../utils';
5
+ import { datePickerV2InjectionKey } from '../interface';
6
+ import { YEAR_GROUP_HEIGHT, START_YEAR, END_YEAR } from '../config';
7
+ import { useCalendarScroll } from '../composables/useCalendarScroll';
8
+ export default defineComponent({
9
+ name: 'CalendarPanel',
10
+ props: {
11
+ value: [Number, null],
12
+ displayYear: {
13
+ type: Number,
14
+ required: true
15
+ },
16
+ displayMonth: {
17
+ type: Number,
18
+ required: true
19
+ },
20
+ showYearDropdown: {
21
+ type: Boolean,
22
+ required: true
23
+ },
24
+ isDateDisabled: Function,
25
+ onDateClick: {
26
+ type: Function,
27
+ required: true
28
+ },
29
+ onMonthSelect: {
30
+ type: Function,
31
+ required: true
32
+ },
33
+ onYearSelect: {
34
+ type: Function,
35
+ required: true
36
+ },
37
+ onToggleYearDropdown: {
38
+ type: Function,
39
+ required: true
40
+ },
41
+ onMonthScroll: {
42
+ type: Function,
43
+ required: true
44
+ },
45
+ style: [Object, String],
46
+ themeClass: String
47
+ },
48
+ setup(props, { expose }) {
49
+ const injection = inject(datePickerV2InjectionKey);
50
+ const mergedClsPrefix = (injection === null || injection === void 0 ? void 0 : injection.mergedClsPrefixRef.value) || 'u';
51
+ const dateLocaleRef = injection === null || injection === void 0 ? void 0 : injection.dateLocaleRef;
52
+ const localeRef = injection === null || injection === void 0 ? void 0 : injection.localeRef;
53
+ const dateFnsOptions = computed(() => {
54
+ var _a;
55
+ const loc = (_a = dateLocaleRef === null || dateLocaleRef === void 0 ? void 0 : dateLocaleRef.value) === null || _a === void 0 ? void 0 : _a.locale;
56
+ return loc ? { locale: loc } : undefined;
57
+ });
58
+ const now = Date.now();
59
+ // Используем composable для скролла
60
+ const { monthScrollbarRef, yearScrollbarRef, calendarScrollbarRef, scrollToMonthInMonthList, scrollToYear, scrollToMonthInCalendar: scrollToMonthInCalendarRaw } = useCalendarScroll();
61
+ // Все месяцы для навигации (с локализацией)
62
+ const monthFormat = computed(() => { var _a; return (_a = localeRef === null || localeRef === void 0 ? void 0 : localeRef.value) === null || _a === void 0 ? void 0 : _a.monthFormat; });
63
+ const allMonthsRef = computed(() => generateAllMonths(START_YEAR, END_YEAR, dateFnsOptions.value, monthFormat.value));
64
+ // Названия дней недели (с локализацией)
65
+ const dayFormat = computed(() => { var _a; return (_a = localeRef === null || localeRef === void 0 ? void 0 : localeRef.value) === null || _a === void 0 ? void 0 : _a.dayFormat; });
66
+ const weekdayNamesRef = computed(() => getWeekdayNames(dateFnsOptions.value, dayFormat.value));
67
+ // Все годы для dropdown
68
+ const yearsRef = computed(() => generateYears());
69
+ // Группировка месяцев по годам для отображения с заголовками
70
+ const groupedMonthsRef = computed(() => {
71
+ const months = allMonthsRef.value;
72
+ const groups = [];
73
+ let currentYear = -1;
74
+ let currentGroup = [];
75
+ for (const month of months) {
76
+ if (month.year !== currentYear) {
77
+ if (currentGroup.length > 0) {
78
+ groups.push({ year: currentYear, months: currentGroup });
79
+ }
80
+ currentYear = month.year;
81
+ currentGroup = [];
82
+ }
83
+ currentGroup.push(month);
84
+ }
85
+ if (currentGroup.length > 0) {
86
+ groups.push({ year: currentYear, months: currentGroup });
87
+ }
88
+ return groups;
89
+ });
90
+ // Все месяцы текущего года с их днями для скролла
91
+ const yearMonthsWithDatesRef = computed(() => {
92
+ var _a;
93
+ const year = props.displayYear;
94
+ const months = [];
95
+ for (let month = 0; month < 12; month++) {
96
+ months.push({
97
+ year,
98
+ month,
99
+ label: getMonthLabel(month, dateFnsOptions.value),
100
+ dates: generateDatesForMonth(year, month, (_a = props.value) !== null && _a !== void 0 ? _a : null, null, now, props.isDateDisabled)
101
+ });
102
+ }
103
+ return months;
104
+ });
105
+ function scrollToMonthInCalendar(month) {
106
+ const monthRows = yearMonthsWithDatesRef.value.map((item) => Math.ceil(item.dates.length / 7));
107
+ scrollToMonthInCalendarRaw(month, monthRows);
108
+ }
109
+ // Экспортируем методы для родительского компонента
110
+ expose({
111
+ scrollToMonthInMonthList,
112
+ scrollToYear,
113
+ scrollToMonthInCalendar
114
+ });
115
+ return {
116
+ mergedClsPrefix,
117
+ allMonthsRef,
118
+ groupedMonthsRef,
119
+ yearsRef,
120
+ yearMonthsWithDatesRef,
121
+ weekdayNamesRef,
122
+ monthScrollbarRef,
123
+ yearScrollbarRef,
124
+ calendarScrollbarRef,
125
+ now
126
+ };
127
+ },
128
+ render() {
129
+ const { mergedClsPrefix, displayYear, displayMonth, showYearDropdown, groupedMonthsRef, yearsRef, yearMonthsWithDatesRef, weekdayNamesRef } = this;
130
+ return (h("div", { class: [`${mergedClsPrefix}-date-picker-v2-panel`, this.themeClass], style: this.style },
131
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__left` },
132
+ h("div", { class: [
133
+ `${mergedClsPrefix}-date-picker-v2-panel__year-trigger`,
134
+ showYearDropdown &&
135
+ `${mergedClsPrefix}-date-picker-v2-panel__year-trigger--active`
136
+ ], onClick: this.onToggleYearDropdown },
137
+ h("span", null, displayYear),
138
+ h(UBaseIcon, { clsPrefix: mergedClsPrefix }, { default: () => h(ChevronDownIcon, null) })),
139
+ showYearDropdown ? (h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__year-dropdown` },
140
+ h(UScrollbar, { ref: "yearScrollbarRef", style: { maxHeight: '320px' } },
141
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__year-list` }, yearsRef.map((item) => (h("div", { key: item.year, class: [
142
+ `${mergedClsPrefix}-date-picker-v2-panel__year-item`,
143
+ item.year === displayYear &&
144
+ `${mergedClsPrefix}-date-picker-v2-panel__year-item--selected`
145
+ ], onClick: () => {
146
+ this.onYearSelect(item.year);
147
+ } }, item.year))))))) : (h(UScrollbar, { ref: "monthScrollbarRef", style: { flex: 1 }, onScroll: (e) => {
148
+ const target = e.target;
149
+ const scrollTop = target.scrollTop;
150
+ // Определяем год по позиции скролла
151
+ const yearIndex = Math.floor(scrollTop / YEAR_GROUP_HEIGHT);
152
+ const year = START_YEAR + yearIndex;
153
+ this.onMonthScroll(year);
154
+ } },
155
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__month-list` }, groupedMonthsRef.map((group) => (h("div", { key: group.year, class: `${mergedClsPrefix}-date-picker-v2-panel__year-group` },
156
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__year-header` }, group.year),
157
+ group.months.map((item) => (h("div", { key: String(item.year) + '-' + String(item.month), class: [
158
+ `${mergedClsPrefix}-date-picker-v2-panel__month-item`,
159
+ item.year === displayYear &&
160
+ item.month === displayMonth &&
161
+ `${mergedClsPrefix}-date-picker-v2-panel__month-item--selected`
162
+ ], onClick: () => {
163
+ this.onMonthSelect(item.year, item.month);
164
+ } }, item.label)))))))))),
165
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__right` },
166
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__weekdays` }, weekdayNamesRef.map((day, i) => (h("div", { key: day, class: [
167
+ `${mergedClsPrefix}-date-picker-v2-panel__weekday`,
168
+ i >= 5 &&
169
+ `${mergedClsPrefix}-date-picker-v2-panel__weekday--weekend`
170
+ ] }, day)))),
171
+ h(UScrollbar, { ref: "calendarScrollbarRef", style: { flex: 1 } },
172
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__calendar-scroll` }, yearMonthsWithDatesRef.map((monthData) => (h("div", { key: `${monthData.year}-${monthData.month}`, class: `${mergedClsPrefix}-date-picker-v2-panel__month-section` },
173
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__month-title` }, monthData.label),
174
+ h("div", { class: `${mergedClsPrefix}-date-picker-v2-panel__dates` }, monthData.dates.map((dateItem) => dateItem.isCurrentMonth ? (h("div", { key: dateItem.ts, class: [
175
+ `${mergedClsPrefix}-date-picker-v2-panel__date`,
176
+ dateItem.isCurrentDate &&
177
+ `${mergedClsPrefix}-date-picker-v2-panel__date--current`,
178
+ dateItem.selected &&
179
+ `${mergedClsPrefix}-date-picker-v2-panel__date--selected`,
180
+ dateItem.disabled &&
181
+ `${mergedClsPrefix}-date-picker-v2-panel__date--disabled`
182
+ ], onClick: () => {
183
+ this.onDateClick(dateItem.ts);
184
+ } }, dateItem.date)) : (h("div", { key: dateItem.ts, class: `${mergedClsPrefix}-date-picker-v2-panel__date ${mergedClsPrefix}-date-picker-v2-panel__date--empty` }))))))))))));
185
+ }
186
+ });