@ibiz-template/vue3-components 0.7.26-alpha.1 → 0.7.26-alpha.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.
Files changed (111) hide show
  1. package/dist/{index-_h-elF6t.js → index-8tGeBxpc.js} +1 -1
  2. package/dist/{index--XeT2CTZ.js → index-CDgQJyai.js} +1 -1
  3. package/dist/index-o58Mv9D4.js +4 -0
  4. package/dist/index.min.css +1 -1
  5. package/dist/index.system.min.js +1 -1
  6. package/dist/{xlsx-util-jKx8FmtR.js → xlsx-util-Ux1_tuw5.js} +1 -1
  7. package/es/_virtual/localeData.mjs +3 -0
  8. package/es/control/calendar/calendar.css +1 -1
  9. package/es/control/calendar/calendar.d.ts +2 -3
  10. package/es/control/calendar/calendar.mjs +104 -173
  11. package/es/control/calendar/components/calendar-daily/calendar-daily.css +1 -0
  12. package/es/control/calendar/components/calendar-daily/calendar-daily.d.ts +18 -0
  13. package/es/control/calendar/components/calendar-daily/calendar-daily.mjs +175 -0
  14. package/es/control/calendar/components/calendar-daily/index.d.ts +18 -0
  15. package/es/control/calendar/components/calendar-daily/index.mjs +9 -0
  16. package/es/control/calendar/components/calendar-daily/use-calendar-daily.d.ts +154 -0
  17. package/es/control/calendar/components/calendar-daily/use-calendar-daily.mjs +196 -0
  18. package/es/control/calendar/components/calendar-month/calendar-month.css +1 -0
  19. package/es/control/calendar/components/calendar-month/calendar-month.d.ts +18 -0
  20. package/es/control/calendar/components/calendar-month/calendar-month.mjs +242 -0
  21. package/es/control/calendar/components/calendar-month/index.d.ts +18 -0
  22. package/es/control/calendar/components/calendar-month/index.mjs +9 -0
  23. package/es/control/calendar/components/calendar-month/use-calendar-month.d.ts +3 -0
  24. package/es/control/calendar/components/calendar-month/use-calendar-month.mjs +384 -0
  25. package/es/control/calendar/components/calendar-week/calendar-week.css +1 -0
  26. package/es/control/calendar/components/calendar-week/calendar-week.d.ts +18 -0
  27. package/es/control/calendar/components/calendar-week/calendar-week.mjs +241 -0
  28. package/es/control/calendar/components/calendar-week/index.d.ts +18 -0
  29. package/es/control/calendar/components/calendar-week/index.mjs +9 -0
  30. package/es/control/calendar/components/calendar-week/use-calendar-week.d.ts +159 -0
  31. package/es/control/calendar/components/calendar-week/use-calendar-week.mjs +399 -0
  32. package/es/control/calendar/components/constant/event.d.ts +5 -0
  33. package/es/control/calendar/components/constant/event.mjs +8 -0
  34. package/es/control/calendar/components/constant/index.d.ts +1 -0
  35. package/es/control/calendar/components/constant/index.mjs +3 -0
  36. package/es/control/calendar/components/custom-calendar/custom-calendar.css +1 -0
  37. package/es/control/calendar/components/custom-calendar/custom-calendar.d.ts +24 -0
  38. package/es/control/calendar/components/custom-calendar/custom-calendar.mjs +283 -0
  39. package/es/control/calendar/components/custom-calendar/index.d.ts +24 -0
  40. package/es/control/calendar/components/custom-calendar/index.mjs +12 -0
  41. package/es/control/calendar/components/custom-calendar/use-custom-calendar.d.ts +3 -0
  42. package/es/control/calendar/components/custom-calendar/use-custom-calendar.mjs +264 -0
  43. package/es/control/calendar/components/interface/calendar-daily.d.ts +12 -0
  44. package/es/control/calendar/components/interface/calendar-daily.mjs +34 -0
  45. package/es/control/calendar/components/interface/calendar-month.d.ts +20 -0
  46. package/es/control/calendar/components/interface/calendar-month.mjs +43 -0
  47. package/es/control/calendar/components/interface/calendar-week.d.ts +12 -0
  48. package/es/control/calendar/components/interface/calendar-week.mjs +34 -0
  49. package/es/control/calendar/components/interface/common.d.ts +116 -0
  50. package/es/control/calendar/components/interface/common.mjs +1 -0
  51. package/es/control/calendar/components/interface/custom-calendar.d.ts +14 -0
  52. package/es/control/calendar/components/interface/custom-calendar.mjs +67 -0
  53. package/es/control/calendar/components/interface/index.d.ts +5 -0
  54. package/es/control/calendar/components/interface/index.mjs +7 -0
  55. package/es/control/calendar/components/util/index.d.ts +1 -0
  56. package/es/control/calendar/components/util/index.mjs +4 -0
  57. package/es/control/calendar/components/util/util.d.ts +89 -0
  58. package/es/control/calendar/components/util/util.mjs +281 -0
  59. package/es/control/calendar/index.d.ts +1 -2
  60. package/es/control/calendar/index.mjs +2 -0
  61. package/es/editor/data-picker/ibiz-picker-link/ibiz-picker-link.mjs +2 -2
  62. package/es/editor/date-picker/date-picker-editor.controller.mjs +3 -0
  63. package/es/editor/date-range/date-range-editor.controller.mjs +3 -0
  64. package/es/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  65. package/es/editor/slider/ibiz-slider/ibiz-slider.d.ts +2 -0
  66. package/es/editor/slider/ibiz-slider/ibiz-slider.mjs +76 -21
  67. package/es/locale/en/index.d.ts +43 -0
  68. package/es/locale/en/index.mjs +44 -1
  69. package/es/locale/zh-CN/index.d.ts +39 -0
  70. package/es/locale/zh-CN/index.mjs +40 -1
  71. package/es/node_modules/.pnpm/dayjs@1.11.10/node_modules/dayjs/plugin/localeData.mjs +13 -0
  72. package/lib/_virtual/localeData.cjs +5 -0
  73. package/lib/control/calendar/calendar.cjs +104 -173
  74. package/lib/control/calendar/calendar.css +1 -1
  75. package/lib/control/calendar/components/calendar-daily/calendar-daily.cjs +177 -0
  76. package/lib/control/calendar/components/calendar-daily/calendar-daily.css +1 -0
  77. package/lib/control/calendar/components/calendar-daily/index.cjs +14 -0
  78. package/lib/control/calendar/components/calendar-daily/use-calendar-daily.cjs +198 -0
  79. package/lib/control/calendar/components/calendar-month/calendar-month.cjs +244 -0
  80. package/lib/control/calendar/components/calendar-month/calendar-month.css +1 -0
  81. package/lib/control/calendar/components/calendar-month/index.cjs +14 -0
  82. package/lib/control/calendar/components/calendar-month/use-calendar-month.cjs +386 -0
  83. package/lib/control/calendar/components/calendar-week/calendar-week.cjs +243 -0
  84. package/lib/control/calendar/components/calendar-week/calendar-week.css +1 -0
  85. package/lib/control/calendar/components/calendar-week/index.cjs +14 -0
  86. package/lib/control/calendar/components/calendar-week/use-calendar-week.cjs +401 -0
  87. package/lib/control/calendar/components/constant/event.cjs +14 -0
  88. package/lib/control/calendar/components/constant/index.cjs +11 -0
  89. package/lib/control/calendar/components/custom-calendar/custom-calendar.cjs +285 -0
  90. package/lib/control/calendar/components/custom-calendar/custom-calendar.css +1 -0
  91. package/lib/control/calendar/components/custom-calendar/index.cjs +17 -0
  92. package/lib/control/calendar/components/custom-calendar/use-custom-calendar.cjs +266 -0
  93. package/lib/control/calendar/components/interface/calendar-daily.cjs +37 -0
  94. package/lib/control/calendar/components/interface/calendar-month.cjs +46 -0
  95. package/lib/control/calendar/components/interface/calendar-week.cjs +37 -0
  96. package/lib/control/calendar/components/interface/common.cjs +3 -0
  97. package/lib/control/calendar/components/interface/custom-calendar.cjs +70 -0
  98. package/lib/control/calendar/components/interface/index.cjs +18 -0
  99. package/lib/control/calendar/components/util/index.cjs +42 -0
  100. package/lib/control/calendar/components/util/util.cjs +316 -0
  101. package/lib/control/calendar/index.cjs +2 -0
  102. package/lib/editor/data-picker/ibiz-picker-link/ibiz-picker-link.cjs +2 -2
  103. package/lib/editor/date-picker/date-picker-editor.controller.cjs +3 -0
  104. package/lib/editor/date-range/date-range-editor.controller.cjs +3 -0
  105. package/lib/editor/slider/ibiz-slider/ibiz-slider.cjs +76 -21
  106. package/lib/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  107. package/lib/locale/en/index.cjs +44 -1
  108. package/lib/locale/zh-CN/index.cjs +40 -1
  109. package/lib/node_modules/.pnpm/dayjs@1.11.10/node_modules/dayjs/plugin/localeData.cjs +17 -0
  110. package/package.json +5 -5
  111. package/dist/index-yupCl1Un.js +0 -4
@@ -0,0 +1,285 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var dayjs = require('dayjs');
5
+ var vue3Util = require('@ibiz-template/vue3-util');
6
+ var index$2 = require('../calendar-daily/index.cjs');
7
+ var index$1 = require('../calendar-week/index.cjs');
8
+ var index = require('../calendar-month/index.cjs');
9
+ var useCustomCalendar = require('./use-custom-calendar.cjs');
10
+ require('./custom-calendar.css');
11
+ require('../interface/index.cjs');
12
+ var customCalendar = require('../interface/custom-calendar.cjs');
13
+
14
+ "use strict";
15
+ const CustomCalendar = /* @__PURE__ */ vue.defineComponent({
16
+ name: "CustomCalendar",
17
+ props: customCalendar.customCalendarProps,
18
+ emits: customCalendar.customCalendarEmits,
19
+ setup(props, {
20
+ emit,
21
+ slots
22
+ }) {
23
+ const ns = vue3Util.useNamespace("custom-calendar");
24
+ const {
25
+ date,
26
+ events,
27
+ i18nDate,
28
+ shortcuts,
29
+ viewType,
30
+ validatedRange,
31
+ realSelectedDay,
32
+ curWeek,
33
+ legends,
34
+ multiple,
35
+ selectedData,
36
+ pickDay,
37
+ handleEVentClick,
38
+ handleEVentDblClick,
39
+ selectDate,
40
+ selectLegend
41
+ } = useCustomCalendar.useCustomCalendar(props, emit, "custom-calendar");
42
+ vue.onMounted(() => {
43
+ pickDay(dayjs(/* @__PURE__ */ new Date()));
44
+ });
45
+ const renderMonth = () => {
46
+ var _a;
47
+ return vue.createVNode("div", {
48
+ "class": [ns.e("calendar-month")]
49
+ }, [(slots == null ? void 0 : slots.header) ? vue.createVNode("div", {
50
+ "class": [ns.em("calendar-month", "header")]
51
+ }, [(_a = slots == null ? void 0 : slots.header) == null ? void 0 : _a.call(slots, {
52
+ date: i18nDate.value,
53
+ legends: legends.value
54
+ })]) : vue.createVNode("div", {
55
+ "class": [ns.em("calendar-month", "header")]
56
+ }, [vue.createVNode("div", {
57
+ "class": [ns.em("header", "title")]
58
+ }, [i18nDate.value]), vue.createVNode("div", {
59
+ "class": ns.em("calendar-month", "legend")
60
+ }, [legends.value.length > 1 && legends.value.map((legend) => {
61
+ return vue.createVNode("div", {
62
+ "class": ns.em("calendar-month", "legend-item"),
63
+ "onClick": () => selectLegend(legend)
64
+ }, [vue.createVNode("div", {
65
+ "class": ns.em("calendar-month", "legend-item-tip"),
66
+ "style": {
67
+ background: legend.isShow ? legend.bkcolor : "#CCCCCC"
68
+ }
69
+ }, null), vue.createVNode("div", {
70
+ "class": ns.em("calendar-month", "legend-item-text"),
71
+ "style": {
72
+ color: legend.isShow ? legend.color : "#CCCCCC"
73
+ },
74
+ "title": legend.name
75
+ }, [legend.name])]);
76
+ })]), validatedRange.value.length === 0 && vue.createVNode("div", {
77
+ "class": [ns.em("calendar-month", "button-group")]
78
+ }, [vue.createVNode(vue.resolveComponent("el-date-picker"), {
79
+ "modelValue": realSelectedDay.value,
80
+ "onUpdate:modelValue": ($event) => realSelectedDay.value = $event,
81
+ "type": "month"
82
+ }, null), vue.createVNode(vue.resolveComponent("el-button-group"), null, {
83
+ default: () => [vue.createVNode(vue.resolveComponent("el-button"), {
84
+ "size": "small",
85
+ "onClick": () => {
86
+ selectDate("prev-year");
87
+ }
88
+ }, {
89
+ default: () => [vue.createTextVNode("\u53BB\u5E74")]
90
+ }), vue.createVNode(vue.resolveComponent("el-button"), {
91
+ "size": "small",
92
+ "onClick": () => {
93
+ selectDate("prev-month");
94
+ }
95
+ }, {
96
+ default: () => [vue.createTextVNode("\u4E0A\u4E2A\u6708")]
97
+ }), vue.createVNode(vue.resolveComponent("el-button"), {
98
+ "size": "small",
99
+ "onClick": () => {
100
+ selectDate("today");
101
+ }
102
+ }, {
103
+ default: () => [vue.createTextVNode("\u4ECA\u5929")]
104
+ }), vue.createVNode(vue.resolveComponent("el-button"), {
105
+ "size": "small",
106
+ "onClick": () => {
107
+ selectDate("next-month");
108
+ }
109
+ }, {
110
+ default: () => [vue.createTextVNode("\u4E0B\u4E2A\u6708")]
111
+ }), vue.createVNode(vue.resolveComponent("el-button"), {
112
+ "size": "small",
113
+ "onClick": () => {
114
+ selectDate("next-year");
115
+ }
116
+ }, {
117
+ default: () => [vue.createTextVNode("\u660E\u5E74")]
118
+ })]
119
+ })])]), validatedRange.value.length === 0 ? vue.createVNode("div", {
120
+ "class": [ns.em("calendar-month", "body")]
121
+ }, [vue.createVNode(index.IBizCalendarMonth, {
122
+ "date": date.value,
123
+ "controller": props.controller,
124
+ "selected-day": realSelectedDay.value,
125
+ "events": events.value,
126
+ "legends": legends.value,
127
+ "multiple": multiple.value,
128
+ "selectedData": selectedData.value,
129
+ "onPickEvent": (day) => pickDay(day),
130
+ "onEventClick": (value) => handleEVentClick(value),
131
+ "onEventDblClick": (value) => handleEVentDblClick(value)
132
+ }, slots)]) : vue.createVNode("div", {
133
+ "class": [ns.em("calendar-month", "body")]
134
+ }, [validatedRange.value.map((item, index$1) => {
135
+ return vue.createVNode(index.IBizCalendarMonth, {
136
+ "date": item[0],
137
+ "controller": props.controller,
138
+ "selected-day": realSelectedDay.value,
139
+ "range": item,
140
+ "hide-header": index$1 !== 0,
141
+ "onPickEvent": (day) => pickDay(day),
142
+ "events": events.value,
143
+ "legends": legends.value,
144
+ "multiple": multiple.value,
145
+ "selectedData": selectedData.value,
146
+ "onEventClick": (value) => handleEVentClick(value),
147
+ "onEventDblClick": (value) => handleEVentDblClick(value)
148
+ }, slots);
149
+ })])]);
150
+ };
151
+ const renderWeek = () => {
152
+ var _a;
153
+ return vue.createVNode("div", {
154
+ "class": [ns.e("calendar-week")]
155
+ }, [(slots == null ? void 0 : slots.header) ? vue.createVNode("div", {
156
+ "class": [ns.em("calendar-month", "header")]
157
+ }, [(_a = slots == null ? void 0 : slots.header) == null ? void 0 : _a.call(slots, {
158
+ date: dayjs(realSelectedDay.value).format("YYYY-MM-DD"),
159
+ legends: legends.value
160
+ })]) : vue.createVNode("div", {
161
+ "class": [ns.em("calendar-week", "header")]
162
+ }, [vue.createVNode("div", {
163
+ "class": ns.em("calendar-week", "header-top")
164
+ }, [vue.createVNode("div", {
165
+ "class": ns.em("calendar-week", "title")
166
+ }, [props.controller.state.calendarTitle || ibiz.i18n.t("control.calendar.title")]), vue.createVNode("div", {
167
+ "class": ns.em("calendar-week", "legend")
168
+ }, [legends.value.length > 1 && legends.value.map((item) => {
169
+ return vue.createVNode("div", {
170
+ "class": ns.em("calendar-week", "legend-item"),
171
+ "onClick": () => selectLegend(item)
172
+ }, [vue.createVNode("div", {
173
+ "class": ns.em("calendar-week", "legend-item-tip"),
174
+ "style": {
175
+ background: item.isShow ? item.bkcolor : "#CCCCCC"
176
+ }
177
+ }, null), vue.createVNode("div", {
178
+ "class": ns.em("calendar-week", "legend-item-text"),
179
+ "style": {
180
+ color: item.isShow ? item.color : "#CCCCCC"
181
+ },
182
+ "title": item.name
183
+ }, [item.name])]);
184
+ })]), vue.createVNode("div", {
185
+ "class": ns.em("calendar-week", "select-time")
186
+ }, [vue.createVNode(vue.resolveComponent("el-date-picker"), {
187
+ "modelValue": realSelectedDay.value,
188
+ "onUpdate:modelValue": ($event) => realSelectedDay.value = $event,
189
+ "type": "date",
190
+ "placeholder": "\u9009\u62E9\u65E5\u671F",
191
+ "shortcuts": shortcuts
192
+ }, null)])])]), vue.createVNode(index$1.IBizCalendarWeek, {
193
+ "selected-day": realSelectedDay.value,
194
+ "controller": props.controller,
195
+ "events": events.value,
196
+ "legends": legends.value,
197
+ "multiple": multiple.value,
198
+ "selectedData": selectedData.value,
199
+ "onEventClick": (value) => handleEVentClick(value),
200
+ "onEventDblClick": (value) => handleEVentDblClick(value)
201
+ }, slots)]);
202
+ };
203
+ const renderDay = () => {
204
+ var _a;
205
+ return vue.createVNode("div", {
206
+ "class": [ns.e("calendar-week")]
207
+ }, [(slots == null ? void 0 : slots.header) ? vue.createVNode("div", {
208
+ "class": [ns.em("calendar-month", "header")]
209
+ }, [(_a = slots == null ? void 0 : slots.header) == null ? void 0 : _a.call(slots, {
210
+ date: dayjs(realSelectedDay.value).format("YYYY-MM-DD"),
211
+ legends: legends.value
212
+ })]) : vue.createVNode("div", {
213
+ "class": [ns.em("calendar-week", "header")]
214
+ }, [vue.createVNode("div", {
215
+ "class": ns.em("calendar-week", "header-top")
216
+ }, [vue.createVNode("div", {
217
+ "class": ns.em("calendar-week", "title")
218
+ }, [props.controller.state.calendarTitle || ibiz.i18n.t("control.calendar.title")]), vue.createVNode("div", {
219
+ "class": ns.em("calendar-week", "legend")
220
+ }, [legends.value.length > 1 && legends.value.map((item) => {
221
+ return vue.createVNode("div", {
222
+ "class": ns.em("calendar-week", "legend-item"),
223
+ "onClick": () => selectLegend(item)
224
+ }, [vue.createVNode("div", {
225
+ "class": ns.em("calendar-week", "legend-item-tip"),
226
+ "style": {
227
+ background: item.isShow ? item.bkcolor : "#CCCCCC"
228
+ }
229
+ }, null), vue.createVNode("div", {
230
+ "class": ns.em("calendar-week", "legend-item-text"),
231
+ "style": {
232
+ color: item.isShow ? item.color : "#CCCCCC"
233
+ },
234
+ "title": item.name
235
+ }, [item.name])]);
236
+ })]), vue.createVNode("div", {
237
+ "class": ns.em("calendar-week", "select-time")
238
+ }, [vue.createVNode(vue.resolveComponent("el-date-picker"), {
239
+ "modelValue": realSelectedDay.value,
240
+ "onUpdate:modelValue": ($event) => realSelectedDay.value = $event,
241
+ "type": "date",
242
+ "placeholder": "\u9009\u62E9\u65E5\u671F",
243
+ "shortcuts": shortcuts
244
+ }, null)])]), vue.createVNode("div", {
245
+ "class": ns.em("calendar-week", "text-secondary")
246
+ }, [curWeek.value])]), vue.createVNode(index$2.IBizCalendarDaily, {
247
+ "selected-day": realSelectedDay.value,
248
+ "controller": props.controller,
249
+ "events": events.value,
250
+ "legends": legends.value,
251
+ "multiple": multiple.value,
252
+ "selectedData": selectedData.value,
253
+ "onEventClick": (value) => handleEVentClick(value),
254
+ "onEventDblClick": (value) => handleEVentDblClick(value)
255
+ }, slots)]);
256
+ };
257
+ const renderContent = () => {
258
+ switch (viewType.value) {
259
+ case "MONTH":
260
+ return renderMonth();
261
+ case "DAY":
262
+ return renderDay();
263
+ case "WEEK":
264
+ return renderWeek();
265
+ default:
266
+ return null;
267
+ }
268
+ };
269
+ return {
270
+ ns,
271
+ date,
272
+ validatedRange,
273
+ pickDay,
274
+ selectDate,
275
+ renderContent
276
+ };
277
+ },
278
+ render() {
279
+ return vue.createVNode("div", {
280
+ "class": [this.ns.b()]
281
+ }, [this.renderContent()]);
282
+ }
283
+ });
284
+
285
+ exports.CustomCalendar = CustomCalendar;
@@ -0,0 +1 @@
1
+ .ibiz-custom-calendar{width:100%;height:100%}.ibiz-custom-calendar__calendar-day{display:flex;flex-direction:column;width:100%;min-width:380px;height:100%;min-height:900px;border:1px solid var(--ibiz-color-border)}.ibiz-custom-calendar__calendar-day--header{padding:0 40px;border-bottom:1px solid var(--ibiz-color-border)}.ibiz-custom-calendar__calendar-day--header-top{display:flex;align-items:center;justify-content:space-between;height:70px}.ibiz-custom-calendar__calendar-day--title{min-width:80px;font-size:20px}.ibiz-custom-calendar__calendar-day--text-secondary{height:56px;line-height:56px;text-align:left}.ibiz-custom-calendar__calendar-day--select-time{width:130px;height:32px}.ibiz-custom-calendar__calendar-day--select-time .el-input__suffix{display:none}.ibiz-custom-calendar__calendar-day--legend{display:flex;flex-grow:1;align-items:center;justify-content:center;height:100%;overflow:auto}.ibiz-custom-calendar__calendar-day--legend-item{display:flex;align-items:center;width:auto;height:auto;padding:0 3px;cursor:pointer}.ibiz-custom-calendar__calendar-day--legend-item-tip{display:inline-block;width:26px;height:14px;margin-right:6px;border-radius:4px}.ibiz-custom-calendar__calendar-day--legend-item-text{display:inline-block;width:auto;max-width:100px;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.ibiz-custom-calendar__calendar-week{display:flex;flex-direction:column;width:100%;min-width:380px;height:100%;border:1px solid var(--ibiz-color-border)}.ibiz-custom-calendar__calendar-week--header{padding:0 40px;border-bottom:1px solid var(--ibiz-color-border)}.ibiz-custom-calendar__calendar-week--header-top{display:flex;align-items:center;justify-content:space-between;height:70px}.ibiz-custom-calendar__calendar-week--title{min-width:80px;font-size:20px}.ibiz-custom-calendar__calendar-week--text-secondary{height:56px;line-height:56px;text-align:left}.ibiz-custom-calendar__calendar-week--select-time{width:130px;height:32px}.ibiz-custom-calendar__calendar-week--select-time .el-input__suffix{display:none}.ibiz-custom-calendar__calendar-week--legend{display:flex;flex-grow:1;align-items:center;justify-content:center;height:100%;overflow:auto}.ibiz-custom-calendar__calendar-week--legend-item{display:flex;align-items:center;width:auto;height:auto;padding:0 3px;cursor:pointer}.ibiz-custom-calendar__calendar-week--legend-item-tip{display:inline-block;width:26px;height:14px;margin-right:6px;border-radius:4px}.ibiz-custom-calendar__calendar-week--legend-item-text{display:inline-block;width:auto;max-width:100px;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.ibiz-custom-calendar__calendar-month{display:flex;flex-direction:column;width:100%;height:100%}.ibiz-custom-calendar__calendar-month--body{flex-grow:1;width:100%;height:calc(100% - 58px)}.ibiz-custom-calendar__calendar-month--legend{display:flex;align-items:center;justify-content:center;width:auto;height:100%}.ibiz-custom-calendar__calendar-month--legend-item{display:flex;align-items:center;width:auto;height:auto;padding:0 3px;cursor:pointer}.ibiz-custom-calendar__calendar-month--legend-item-tip{display:inline-block;width:26px;height:14px;margin-right:6px;border-radius:4px}.ibiz-custom-calendar__calendar-month--legend-item-text{display:inline-block;width:auto;max-width:100px;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.ibiz-custom-calendar__calendar-month--header{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:58px;padding:12px 20px;border-bottom:1px solid var(--ibiz-color-border)}.ibiz-custom-calendar__calendar-month--button-group{display:flex;align-items:center;justify-content:space-between;width:388px}.ibiz-custom-calendar__header--title{min-width:120px}.ibiz-custom-calendar .el-date-editor.el-input,.ibiz-custom-calendar .el-date-editor.el-input__wrapper{width:130px;height:32px}
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue3Util = require('@ibiz-template/vue3-util');
6
+ var customCalendar = require('./custom-calendar.cjs');
7
+
8
+ "use strict";
9
+ const IBizCustomCalendar = vue3Util.withInstall(
10
+ customCalendar.CustomCalendar,
11
+ function(v) {
12
+ v.component(customCalendar.CustomCalendar.name, customCalendar.CustomCalendar);
13
+ }
14
+ );
15
+
16
+ exports.IBizCustomCalendar = IBizCustomCalendar;
17
+ exports.default = IBizCustomCalendar;
@@ -0,0 +1,266 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var dayjs = require('dayjs');
5
+ var ElementPlus = require('element-plus');
6
+ require('../util/index.cjs');
7
+ require('../constant/index.cjs');
8
+ var util = require('../util/util.cjs');
9
+ var event = require('../constant/event.cjs');
10
+
11
+ "use strict";
12
+ const adjacentMonth = (start, end) => {
13
+ const firstMonthLastDay = start.endOf("month");
14
+ const lastMonthFirstDay = end.startOf("month");
15
+ const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
16
+ const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
17
+ return [
18
+ [start, firstMonthLastDay],
19
+ [lastMonthStartDay.startOf("week"), end]
20
+ ];
21
+ };
22
+ const threeConsecutiveMonth = (start, end) => {
23
+ const firstMonthLastDay = start.endOf("month");
24
+ const secondMonthFirstDay = start.add(1, "month").startOf("month");
25
+ const secondMonthStartDay = firstMonthLastDay.isSame(
26
+ secondMonthFirstDay,
27
+ "week"
28
+ ) ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
29
+ const secondMonthLastDay = secondMonthStartDay.endOf("month");
30
+ const lastMonthFirstDay = end.startOf("month");
31
+ const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
32
+ return [
33
+ [start, firstMonthLastDay],
34
+ [secondMonthStartDay.startOf("week"), secondMonthLastDay],
35
+ [lastMonthStartDay.startOf("week"), end]
36
+ ];
37
+ };
38
+ const useCustomCalendar = (props, emit, _componentName) => {
39
+ const { lang } = ElementPlus.useLocale();
40
+ const selectedDay = vue.ref();
41
+ const now = dayjs().locale(lang.value);
42
+ const tempRealSelectedDay = vue.ref();
43
+ const viewType = vue.computed(() => props.viewType);
44
+ const legends = vue.ref([]);
45
+ const tempColors = /* @__PURE__ */ new Map();
46
+ const multiple = vue.computed(() => props.multiple === true);
47
+ const selectedData = vue.computed(() => props.selectedData);
48
+ vue.watch(
49
+ () => props.legends,
50
+ (newVal) => {
51
+ const tempLegend = [];
52
+ if (newVal) {
53
+ props.legends.forEach((item) => {
54
+ const tempItem = {};
55
+ Object.assign(tempItem, item);
56
+ Object.assign(tempItem, { isShow: true });
57
+ if (item && !item.bkcolor) {
58
+ const bkcolor = util.handleBkColor(tempColors, item.id);
59
+ Object.assign(tempItem, { bkcolor });
60
+ }
61
+ tempLegend.push(tempItem);
62
+ });
63
+ }
64
+ legends.value = tempLegend;
65
+ },
66
+ { immediate: true, deep: true }
67
+ );
68
+ const calculateValidatedDateRange = (startDayjs, endDayjs) => {
69
+ const firstDay = startDayjs.startOf("week");
70
+ const lastDay = endDayjs.endOf("week");
71
+ const firstMonth = firstDay.get("month");
72
+ const lastMonth = lastDay.get("month");
73
+ let dateRange;
74
+ if (firstMonth === lastMonth) {
75
+ dateRange = [[firstDay, lastDay]];
76
+ } else if ((firstMonth + 1) % 12 === lastMonth) {
77
+ dateRange = adjacentMonth(firstDay, lastDay);
78
+ } else if (
79
+ // 连续三个月(兼容时间:2021-01-30至2021-02-28)
80
+ firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth
81
+ ) {
82
+ dateRange = threeConsecutiveMonth(firstDay, lastDay);
83
+ } else {
84
+ dateRange = [];
85
+ }
86
+ return dateRange;
87
+ };
88
+ const validatedRange = vue.computed(() => {
89
+ if (!props.range)
90
+ return [];
91
+ let tempRange = [];
92
+ const rangeArrDayjs = props.range.map(
93
+ (item) => dayjs(item).locale(lang.value)
94
+ );
95
+ const [startDayjs, endDayjs] = rangeArrDayjs;
96
+ if (startDayjs.isAfter(endDayjs)) {
97
+ tempRange = [];
98
+ }
99
+ if (startDayjs.isSame(endDayjs, "month")) {
100
+ tempRange = calculateValidatedDateRange(startDayjs, endDayjs);
101
+ } else {
102
+ if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
103
+ tempRange = [];
104
+ }
105
+ tempRange = calculateValidatedDateRange(startDayjs, endDayjs);
106
+ }
107
+ return tempRange;
108
+ });
109
+ const date = vue.computed(() => {
110
+ let tempVal;
111
+ if (!props.modelValue) {
112
+ tempVal = tempRealSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
113
+ } else {
114
+ tempVal = dayjs(props.modelValue).locale(lang.value);
115
+ }
116
+ return tempVal;
117
+ });
118
+ const realSelectedDay = vue.computed({
119
+ get() {
120
+ let tempVal = date.value;
121
+ if (!props.modelValue) {
122
+ tempVal = selectedDay.value;
123
+ }
124
+ tempRealSelectedDay.value = tempVal;
125
+ return tempVal;
126
+ },
127
+ set(val) {
128
+ if (!val)
129
+ return;
130
+ const tempVal = dayjs(val);
131
+ selectedDay.value = tempVal;
132
+ const result = tempVal.toDate();
133
+ emit(event.INPUT_EVENT, result);
134
+ emit(event.CHANGE_EVENT, result);
135
+ emit(event.UPDATE_MODEL_EVENT, result);
136
+ }
137
+ });
138
+ const events = vue.computed(() => {
139
+ if (props.events.length > 0)
140
+ return props.events.map((event) => {
141
+ const tempItem = {};
142
+ Object.assign(tempItem, event);
143
+ Object.assign(tempItem, {
144
+ deData: event.deData,
145
+ beginTime: event.beginTime,
146
+ endTime: event.endTime,
147
+ id: event.id,
148
+ classname: event.classname,
149
+ text: event.text,
150
+ content: event.content,
151
+ tips: event.tips,
152
+ icon: event.icon,
153
+ color: event.color,
154
+ bkColor: event.bkColor,
155
+ itemType: event.itemType
156
+ });
157
+ return tempItem;
158
+ });
159
+ });
160
+ const prevMonthDayjs = vue.computed(
161
+ () => date.value.subtract(1, "month").date(1)
162
+ );
163
+ const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
164
+ const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
165
+ const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
166
+ const pickDay = (day) => {
167
+ realSelectedDay.value = day;
168
+ };
169
+ const selectDate = (type) => {
170
+ const dateMap = {
171
+ "prev-month": prevMonthDayjs.value,
172
+ "next-month": nextMonthDayjs.value,
173
+ "prev-year": prevYearDayjs.value,
174
+ "next-year": nextYearDayjs.value,
175
+ today: now
176
+ };
177
+ const day = dateMap[type];
178
+ if (!day.isSame(date.value, "day")) {
179
+ pickDay(day);
180
+ }
181
+ };
182
+ const i18nDate = vue.computed(() => {
183
+ const pickedMonth = "".concat(date.value.format("M"));
184
+ return "".concat(date.value.year(), " ").concat(ibiz.i18n.t(
185
+ "control.calendar.year"
186
+ ), " ").concat(pickedMonth, " ").concat(ibiz.i18n.t("control.calendar.month"));
187
+ });
188
+ const shortcuts = [
189
+ {
190
+ text: ibiz.i18n.t("control.calendar.today"),
191
+ value: /* @__PURE__ */ new Date()
192
+ },
193
+ {
194
+ text: ibiz.i18n.t("control.calendar.calendardaily.tomorrow"),
195
+ value: () => {
196
+ const tempDate = /* @__PURE__ */ new Date();
197
+ tempDate.setTime(tempDate.getTime() + 3600 * 1e3 * 24);
198
+ return tempDate;
199
+ }
200
+ },
201
+ {
202
+ text: ibiz.i18n.t("control.calendar.calendardaily.nextweek"),
203
+ value: () => {
204
+ const tempDate = /* @__PURE__ */ new Date();
205
+ tempDate.setTime(tempDate.getTime() + 3600 * 1e3 * 24 * 7);
206
+ return tempDate;
207
+ }
208
+ }
209
+ ];
210
+ const handleEVentClick = (value) => {
211
+ emit("eventClick", value);
212
+ };
213
+ const handleEVentDblClick = (value) => {
214
+ emit("eventDblClick", value);
215
+ };
216
+ const curWeek = vue.computed(() => {
217
+ let tempWeek = "";
218
+ if (realSelectedDay.value) {
219
+ const curDate = realSelectedDay.value.day();
220
+ const tempWeeks = [
221
+ "sunday",
222
+ "monday",
223
+ "tuesday",
224
+ "wednesday",
225
+ "thursday",
226
+ "friday",
227
+ "saturday"
228
+ ];
229
+ const weeks = tempWeeks.map((item) => {
230
+ return ibiz.i18n.t("control.calendar.calendardaily.weeks.".concat(item));
231
+ });
232
+ tempWeek = weeks[curDate];
233
+ }
234
+ return tempWeek;
235
+ });
236
+ const selectLegend = (item) => {
237
+ const targetLegend = legends.value.find(
238
+ (legend) => {
239
+ return item.id === legend.id;
240
+ }
241
+ );
242
+ if (targetLegend)
243
+ Object.assign(targetLegend, { isShow: !item.isShow });
244
+ };
245
+ return {
246
+ date,
247
+ viewType,
248
+ i18nDate,
249
+ events,
250
+ shortcuts,
251
+ validatedRange,
252
+ realSelectedDay,
253
+ curWeek,
254
+ legends,
255
+ multiple,
256
+ selectedData,
257
+ calculateValidatedDateRange,
258
+ pickDay,
259
+ selectDate,
260
+ handleEVentClick,
261
+ handleEVentDblClick,
262
+ selectLegend
263
+ };
264
+ };
265
+
266
+ exports.useCustomCalendar = useCustomCalendar;
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ require('../util/index.cjs');
4
+ var util = require('../util/util.cjs');
5
+ var lodashEs = require('lodash-es');
6
+
7
+ "use strict";
8
+ const calendarDailyProps = util.handleProps({
9
+ controller: {
10
+ type: Object
11
+ },
12
+ selectedDay: {
13
+ type: util.definePropType(Object)
14
+ },
15
+ events: {
16
+ type: Array,
17
+ default: []
18
+ },
19
+ legends: {
20
+ type: Array,
21
+ default: []
22
+ },
23
+ multiple: {
24
+ type: Boolean
25
+ },
26
+ selectedData: {
27
+ type: Object
28
+ }
29
+ });
30
+ const calendarDailyEmits = {
31
+ pick: (value) => lodashEs.isObject(value),
32
+ eventClick: (value) => value,
33
+ eventDblClick: (value) => value
34
+ };
35
+
36
+ exports.calendarDailyEmits = calendarDailyEmits;
37
+ exports.calendarDailyProps = calendarDailyProps;
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ require('../util/index.cjs');
4
+ var util = require('../util/util.cjs');
5
+
6
+ "use strict";
7
+ const calendarMonthProps = util.handleProps({
8
+ controller: {
9
+ type: Object
10
+ },
11
+ selectedDay: {
12
+ type: util.definePropType(Object)
13
+ },
14
+ range: {
15
+ type: util.definePropType(Array)
16
+ },
17
+ date: {
18
+ type: util.definePropType(Object),
19
+ required: true
20
+ },
21
+ hideHeader: {
22
+ type: Boolean
23
+ },
24
+ events: {
25
+ type: Array,
26
+ default: []
27
+ },
28
+ legends: {
29
+ type: Array,
30
+ default: []
31
+ },
32
+ multiple: {
33
+ type: Boolean
34
+ },
35
+ selectedData: {
36
+ type: Object
37
+ }
38
+ });
39
+ const calendarMonthEmits = {
40
+ pickEvent: (value) => value,
41
+ eventClick: (value) => value,
42
+ eventDblClick: (value) => value
43
+ };
44
+
45
+ exports.calendarMonthEmits = calendarMonthEmits;
46
+ exports.calendarMonthProps = calendarMonthProps;