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