@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,43 @@
1
+ import '../util/index.mjs';
2
+ import { definePropType, handleProps } from '../util/util.mjs';
3
+
4
+ "use strict";
5
+ const calendarMonthProps = handleProps({
6
+ controller: {
7
+ type: Object
8
+ },
9
+ selectedDay: {
10
+ type: definePropType(Object)
11
+ },
12
+ range: {
13
+ type: definePropType(Array)
14
+ },
15
+ date: {
16
+ type: definePropType(Object),
17
+ required: true
18
+ },
19
+ hideHeader: {
20
+ type: Boolean
21
+ },
22
+ events: {
23
+ type: Array,
24
+ default: []
25
+ },
26
+ legends: {
27
+ type: Array,
28
+ default: []
29
+ },
30
+ multiple: {
31
+ type: Boolean
32
+ },
33
+ selectedData: {
34
+ type: Object
35
+ }
36
+ });
37
+ const calendarMonthEmits = {
38
+ pickEvent: (value) => value,
39
+ eventClick: (value) => value,
40
+ eventDblClick: (value) => value
41
+ };
42
+
43
+ export { calendarMonthEmits, calendarMonthProps };
@@ -0,0 +1,12 @@
1
+ import type { ExtractPropTypes } from 'vue';
2
+ import type { Dayjs } from 'dayjs';
3
+ declare const calendarWeekProps: IParams;
4
+ type CalendarWeekProps = ExtractPropTypes<typeof calendarWeekProps>;
5
+ declare const calendarWeekEmits: {
6
+ pick: (value: Dayjs) => boolean;
7
+ eventClick: (value: IParams) => IParams;
8
+ eventDblClick: (value: IParams) => IParams;
9
+ };
10
+ type CalendarWeekEmits = typeof calendarWeekEmits;
11
+ export { calendarWeekEmits, calendarWeekProps };
12
+ export type { CalendarWeekEmits, CalendarWeekProps };
@@ -0,0 +1,34 @@
1
+ import '../util/index.mjs';
2
+ import { definePropType, handleProps } from '../util/util.mjs';
3
+ import { isObject } from 'lodash-es';
4
+
5
+ "use strict";
6
+ const calendarWeekProps = handleProps({
7
+ controller: {
8
+ type: Object
9
+ },
10
+ selectedDay: {
11
+ type: definePropType(Object)
12
+ },
13
+ events: {
14
+ type: Array,
15
+ default: []
16
+ },
17
+ legends: {
18
+ type: Array,
19
+ default: []
20
+ },
21
+ multiple: {
22
+ type: Boolean
23
+ },
24
+ selectedData: {
25
+ type: Object
26
+ }
27
+ });
28
+ const calendarWeekEmits = {
29
+ pick: (value) => isObject(value),
30
+ eventClick: (value) => value,
31
+ eventDblClick: (value) => value
32
+ };
33
+
34
+ export { calendarWeekEmits, calendarWeekProps };
@@ -0,0 +1,116 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import { epPropKey } from '../util';
3
+ type Value<T> = T[keyof T];
4
+ type Writable<T> = {
5
+ -readonly [P in keyof T]: T[P];
6
+ };
7
+ type WritableArray<T> = T extends readonly IData[] ? Writable<T> : T;
8
+ type IfNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
9
+ type IfUnknown<T, Y, N> = [unknown] extends [T] ? Y : N;
10
+ type UnknownToNever<T> = IfUnknown<T, never, T>;
11
+ /**
12
+ * 提取单个 prop 的参数类型
13
+ */
14
+ type ExtractPropType<T extends object> = Value<ExtractPropTypes<{
15
+ key: T;
16
+ }>>;
17
+ /**
18
+ * 通过 `ExtractPropTypes` 提取类型,接受 `PropType<T>`、`XXXConstructor`、`never`...
19
+ */
20
+ type ResolvePropType<T> = IfNever<T, never, ExtractPropType<{
21
+ type: WritableArray<T>;
22
+ required: true;
23
+ }>>;
24
+ /**
25
+ * 合并 Type、Value、Validator 的类型
26
+ */
27
+ type EpPropMergeType<Type, IData, Validator> = IfNever<UnknownToNever<IData>, ResolvePropType<Type>, never> | UnknownToNever<IData> | UnknownToNever<Validator>;
28
+ /**
29
+ * 处理输入参数的默认值(约束)
30
+ */
31
+ type EpPropInputDefault<Required extends boolean, Default> = Required extends true ? never : Default extends Record<string, unknown> | Array<IParams> ? () => Default : (() => Default) | Default;
32
+ /**
33
+ * prop 输入参数(约束)
34
+ */
35
+ type EpPropInput<Type, IParams, Validator, Default extends EpPropMergeType<Type, IParams, Validator>, Required extends boolean> = {
36
+ type?: Type;
37
+ required?: Required;
38
+ values?: readonly IParams[];
39
+ validator?: ((val: Validator) => val is Validator) | ((val: boolean) => boolean);
40
+ default?: EpPropInputDefault<Required, Default>;
41
+ };
42
+ /**
43
+ * prop 输出参数 “buildProp”或“buildProps”。
44
+ */
45
+ type EpProp<Type, Default, Required> = {
46
+ readonly type: PropType<Type>;
47
+ readonly required: [Required] extends [true] ? true : false;
48
+ readonly validator: ((val: unknown) => boolean) | undefined;
49
+ [epPropKey]: true;
50
+ } & IfNever<Default, unknown, {
51
+ readonly default: Default;
52
+ }>;
53
+ /**
54
+ * 最终转换 EpProp
55
+ */
56
+ type EpPropFinalized<Type, IParams, Validator, Default, Required> = EpProp<EpPropMergeType<Type, IParams, Validator>, UnknownToNever<Default>, Required>;
57
+ /**
58
+ * 事件项
59
+ */
60
+ interface IEvent {
61
+ beginTime: Date | string;
62
+ endTime: Date | string;
63
+ id: string | number;
64
+ classname: string;
65
+ text: string;
66
+ content: string;
67
+ tips: string;
68
+ icon: string;
69
+ color: string;
70
+ bkColor: string;
71
+ itemType: string;
72
+ deData: IData;
73
+ }
74
+ /**
75
+ * UI图例项
76
+ *
77
+ * @interface IUIEvent
78
+ * @extends {IEvent}
79
+ */
80
+ interface IUIEvent extends IEvent {
81
+ height?: number;
82
+ border?: string;
83
+ timeRange?: string;
84
+ styleTop?: number;
85
+ styleLeft?: number;
86
+ zIndex?: number;
87
+ width?: number;
88
+ isShow?: boolean;
89
+ isToday?: boolean;
90
+ isRange?: boolean;
91
+ bkColorFade?: string;
92
+ isSelectedEvent?: boolean;
93
+ }
94
+ /**
95
+ * 图例
96
+ */
97
+ interface ILegend {
98
+ id: string;
99
+ bkcolor: string;
100
+ color: string;
101
+ name: string;
102
+ }
103
+ /**
104
+ * UI图例项
105
+ *
106
+ * @interface IUILegend
107
+ * @extends {ILegend}
108
+ */
109
+ interface IUILegend extends ILegend {
110
+ isShow?: boolean;
111
+ }
112
+ /**
113
+ * 视图类型
114
+ */
115
+ type ViewType = 'MONTH' | 'WEEK' | 'DAY';
116
+ export type { IEvent, IUIEvent, ViewType, EpPropFinalized, EpProp, EpPropInput, EpPropInputDefault, EpPropMergeType, ResolvePropType, ExtractPropType, UnknownToNever, IfUnknown, WritableArray, Writable, Value, ILegend, IUILegend, };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,14 @@
1
+ import type { ExtractPropTypes } from 'vue';
2
+ type CalendarDateType = 'prev-month' | 'next-month' | 'prev-year' | 'next-year' | 'today';
3
+ declare const customCalendarProps: IParams;
4
+ type CustomCalendarProps = ExtractPropTypes<typeof customCalendarProps>;
5
+ declare const customCalendarEmits: {
6
+ "update:modelValue": (value: Date) => boolean;
7
+ input: (value: Date) => boolean;
8
+ change: (value: Date) => boolean;
9
+ eventClick: (value: IParams) => IParams;
10
+ eventDblClick: (value: IParams) => IParams;
11
+ };
12
+ type CustomCalendarEmits = typeof customCalendarEmits;
13
+ export { customCalendarProps, customCalendarEmits };
14
+ export type { CustomCalendarEmits, CustomCalendarProps, CalendarDateType };
@@ -0,0 +1,67 @@
1
+ import '../util/index.mjs';
2
+ import '../constant/index.mjs';
3
+ import { isArray, isDate } from 'lodash-es';
4
+ import { definePropType, handleProps } from '../util/util.mjs';
5
+ import { UPDATE_MODEL_EVENT, INPUT_EVENT, CHANGE_EVENT, EVENT_CLICK_EVENT, EVENT_DBL_CLICK_EVENT } from '../constant/event.mjs';
6
+
7
+ "use strict";
8
+ const isValidRange = (range) => isArray(range) && range.length === 2 && range.every((item) => isDate(item));
9
+ const customCalendarProps = handleProps({
10
+ controller: {
11
+ type: Object,
12
+ required: true
13
+ },
14
+ /**
15
+ * @description 绑定值
16
+ */
17
+ modelValue: {
18
+ type: Date
19
+ },
20
+ /**
21
+ * @description 时间范围,包括开始时间和结束时间。
22
+ * 开始时间必须是星期的开始日,结束时间必须是一周的结束日,时间跨度不能超过两个月。
23
+ */
24
+ range: {
25
+ type: definePropType(Array),
26
+ validator: isValidRange
27
+ },
28
+ /**
29
+ * @description 视图类型
30
+ */
31
+ viewType: {
32
+ type: String,
33
+ default: "DAY"
34
+ },
35
+ /**
36
+ * @description 事件集合
37
+ */
38
+ events: {
39
+ type: Array,
40
+ default: []
41
+ },
42
+ legends: {
43
+ type: Array,
44
+ default: []
45
+ },
46
+ /**
47
+ * @description 是否多选
48
+ */
49
+ multiple: {
50
+ type: Boolean
51
+ },
52
+ /**
53
+ * @description 选中事件数据集合
54
+ */
55
+ selectedData: {
56
+ type: Object
57
+ }
58
+ });
59
+ const customCalendarEmits = {
60
+ [UPDATE_MODEL_EVENT]: (value) => isDate(value),
61
+ [INPUT_EVENT]: (value) => isDate(value),
62
+ [CHANGE_EVENT]: (value) => isDate(value),
63
+ [EVENT_CLICK_EVENT]: (value) => value,
64
+ [EVENT_DBL_CLICK_EVENT]: (value) => value
65
+ };
66
+
67
+ export { customCalendarEmits, customCalendarProps };
@@ -0,0 +1,5 @@
1
+ export * from './common';
2
+ export * from './custom-calendar';
3
+ export * from './calendar-daily';
4
+ export * from './calendar-month';
5
+ export * from './calendar-week';
@@ -0,0 +1,7 @@
1
+ import './common.mjs';
2
+ export { customCalendarEmits, customCalendarProps } from './custom-calendar.mjs';
3
+ export { calendarDailyEmits, calendarDailyProps } from './calendar-daily.mjs';
4
+ export { calendarMonthEmits, calendarMonthProps } from './calendar-month.mjs';
5
+ export { calendarWeekEmits, calendarWeekProps } from './calendar-week.mjs';
6
+
7
+ "use strict";
@@ -0,0 +1 @@
1
+ export * from './util';
@@ -0,0 +1,4 @@
1
+ export { closeIcon, definePropType, epPropKey, fade, getCurWeekDates, handleBkColor, handleEVentClick, handlePopClose, handleProps, handleTimeRange, isDateInCurWeek, isTimeGreaterThan, isToday, isValidRange, rangeArr } from './util.mjs';
2
+ export { get, isArray, isDate, isObject, set } from 'lodash-es';
3
+
4
+ "use strict";
@@ -0,0 +1,89 @@
1
+ import type { PropType } from 'vue';
2
+ import { isDate, isArray, isObject, get, set } from 'lodash-es';
3
+ import type { IEvent, IUIEvent } from '../interface';
4
+ declare const epPropKey = "__epPropKey";
5
+ declare const closeIcon = "<i class='el-icon' data-v-ea893728=''> <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024' data-v-ea893728='' > <path d='M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z'></path> </svg></i>";
6
+ /**
7
+ * @description 处理气泡关闭
8
+ * @param {MouseEvent} el
9
+ */
10
+ declare const handlePopClose: (el: MouseEvent) => void;
11
+ /**
12
+ * @description 处理事件绘制时间范围
13
+ * @param {string | Date} startTime
14
+ * @param {string | Date} endTime
15
+ * @param {string} format
16
+ * @param {string} partition
17
+ * @returns {string}
18
+ */
19
+ declare const handleTimeRange: (startTime: string | Date, endTime: string | Date, format: string, partition?: string) => string;
20
+ /**
21
+ * @description 处理背景颜色
22
+ * @param {IData} tempColors
23
+ * @returns {string}
24
+ */
25
+ declare const handleBkColor: (tempColors: IData, type: string) => any;
26
+ /**
27
+ * @description 调整颜色不透明度
28
+ * @param {String} color 十六进制| Rgb | Rgb颜色或颜色关键字
29
+ * @param {Number} Percent 不透明度
30
+ * @return {String|Boolean} Rgba颜色(无效输入将返回false)
31
+ */
32
+ declare const fade: (color: string, Percent: number) => string | false;
33
+ /**
34
+ * @description 判断是否为今天
35
+ */
36
+ declare const isToday: (date: Date | string, curDate: Date | string) => boolean;
37
+ /**
38
+ * @description 定义类型
39
+ * @param {*} val
40
+ * @returns {PropType<T>}
41
+ */
42
+ declare const definePropType: <T>(val: IData | PropType<T>) => PropType<T>;
43
+ /**
44
+ * @description 是否为有效时间范围
45
+ * @param {*} range
46
+ * @returns {range is [Date, Date]}
47
+ */
48
+ declare const isValidRange: (range: IData) => range is [Date, Date];
49
+ /**
50
+ * @description 判断时间是否在当前周内
51
+ * @param {Date | string} dateToCheck 需要检查的日期
52
+ * @returns {boolean}
53
+ */
54
+ declare const isDateInCurWeek: (dateToCheck: Date | string, firstDayOfWeek: Date | string, lastDayOfWeek: Date | string) => boolean;
55
+ /**
56
+ * @description 判断时间A是否大于时间B
57
+ * @param {Date | string} timeA
58
+ * @param {Date | string} timeB
59
+ * @returns {boolean}
60
+ */
61
+ declare const isTimeGreaterThan: (timeA: Date | string, timeB: Date | string) => boolean;
62
+ /**
63
+ * @description 根据当前时间获取周第一天时间及周末时间
64
+ * @param {Date | string} curDate 当前选中时间
65
+ * @returns {boolean}
66
+ */
67
+ declare const getCurWeekDates: (curDate: Date | string) => {
68
+ firstDay: Date;
69
+ lastDay: Date;
70
+ };
71
+ /**
72
+ * @description 处理事件点击
73
+ */
74
+ declare const handleEVentClick: (item: IUIEvent, location: string, events: IEvent[], multiple: boolean, selectedData: IEvent[], emit: Function) => Promise<unknown>;
75
+ /**
76
+ * @description 生成一个从 0 到 n-1 的范围数组
77
+ * @param {number} n 生成范围数组的长度
78
+ * @returns {number[]} 从 0 到 n-1 的范围数组
79
+ */
80
+ declare const rangeArr: (n: number) => number[];
81
+ /**
82
+ * @description 处理props
83
+ * @param {*} props
84
+ * @returns {Record<string, any>}
85
+ */
86
+ declare const handleProps: <Props extends Record<string, IParams | {
87
+ __epPropKey: true;
88
+ }>>(props: Props) => IParams;
89
+ export { epPropKey, closeIcon, isDate, isArray, isObject, isToday, get, set, handleProps, rangeArr, isValidRange, definePropType, handleTimeRange, handleBkColor, fade, handleEVentClick, handlePopClose, getCurWeekDates, isDateInCurWeek, isTimeGreaterThan, };
@@ -0,0 +1,281 @@
1
+ import { warn } from 'vue';
2
+ import dayjs from 'dayjs';
3
+ import { clone } from 'ramda';
4
+ import { isObject, isArray, isDate, fromPairs } from 'lodash-es';
5
+ export { get, isArray, isDate, isObject, set } from 'lodash-es';
6
+
7
+ "use strict";
8
+ let clickCount = 0;
9
+ let timer;
10
+ const epPropKey = "__epPropKey";
11
+ const colors = [
12
+ "#2196F3",
13
+ "#4CAF50",
14
+ "#3F51B5",
15
+ "#FF9800",
16
+ "#673AB7",
17
+ "#757575"
18
+ ];
19
+ const closeIcon = "<i class='el-icon' data-v-ea893728=''> <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024' data-v-ea893728='' > <path d='M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z'></path> </svg></i>";
20
+ const hexReg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
21
+ const rgbReg = /^(rgb|rgba|RGB|RGBA)/;
22
+ function findLastParent(element) {
23
+ var _a;
24
+ if (!element) {
25
+ return null;
26
+ }
27
+ if (!(element == null ? void 0 : element.parentNode) || ((_a = element == null ? void 0 : element.classList) == null ? void 0 : _a.contains("el-popover"))) {
28
+ return element;
29
+ }
30
+ return findLastParent(element.parentNode);
31
+ }
32
+ const handlePopClose = (el) => {
33
+ const node = findLastParent(el.target);
34
+ if (node) {
35
+ node.style.display = "none";
36
+ }
37
+ };
38
+ const handleTimeRange = (startTime, endTime, format, partition = "-") => {
39
+ var _a, _b;
40
+ let timeRange = "";
41
+ if (startTime && ((_a = dayjs(startTime)) == null ? void 0 : _a.isValid())) {
42
+ timeRange = dayjs(startTime).format(format);
43
+ }
44
+ if (endTime && ((_b = dayjs(endTime)) == null ? void 0 : _b.isValid())) {
45
+ timeRange = "".concat(timeRange, " ").concat(partition, " ").concat(dayjs(endTime).format(format));
46
+ }
47
+ return timeRange;
48
+ };
49
+ const handleBkColor = (tempColors, type) => {
50
+ let tempColor = tempColors.get(type);
51
+ const length = tempColors.size;
52
+ if (type && !tempColor && length < colors.length) {
53
+ tempColor = colors[length];
54
+ tempColors.set(type, tempColor);
55
+ }
56
+ return tempColor || colors[0];
57
+ };
58
+ const validatorF = (color) => {
59
+ const isHex = hexReg.test(color);
60
+ const isRgb = rgbReg.test(color);
61
+ const tempColor = color;
62
+ if (isHex || isRgb)
63
+ return tempColor;
64
+ if (!color) {
65
+ console.error("Color: Invalid color!");
66
+ return "";
67
+ }
68
+ return tempColor;
69
+ };
70
+ const getRgbValueFromHex = (color) => {
71
+ const tempColor = color.replace("#", "");
72
+ const red = parseInt(tempColor.substring(0, 2), 16);
73
+ const green = parseInt(tempColor.substring(2, 4), 16);
74
+ const blue = parseInt(tempColor.substring(4, 6), 16);
75
+ return [red, green, blue];
76
+ };
77
+ const getRgbValueFromRgb = (color) => {
78
+ return color.replace(/rgb\(|rgba\(|\)/g, "").split(",").slice(0, 3).map(function(n) {
79
+ return parseInt(n, 10);
80
+ });
81
+ };
82
+ const getRgbValue = (color) => {
83
+ if (!color) {
84
+ console.error("getRgbValue: Missing parameters!");
85
+ return false;
86
+ }
87
+ const tempColor = validatorF(color);
88
+ if (!tempColor)
89
+ return false;
90
+ const isHex = hexReg.test(tempColor);
91
+ const isRgb = rgbReg.test(tempColor);
92
+ const lowerColor = tempColor.toLowerCase();
93
+ if (isHex)
94
+ return getRgbValueFromHex(lowerColor);
95
+ if (isRgb)
96
+ return getRgbValueFromRgb(lowerColor);
97
+ };
98
+ const getColorFromRgbValue = (value) => {
99
+ if (!value) {
100
+ console.error("getColorFromRgbValue: Missing parameters!");
101
+ return false;
102
+ }
103
+ const valueLength = value.length;
104
+ if (valueLength !== 3 && valueLength !== 4) {
105
+ console.error("getColorFromRgbValue: Value is illegal!");
106
+ return false;
107
+ }
108
+ let color = valueLength === 3 ? "rgb(" : "rgba(";
109
+ color += "".concat(value.join(","), ")");
110
+ return color;
111
+ };
112
+ const fade = (color, Percent) => {
113
+ const percent = Percent || 100;
114
+ if (!color) {
115
+ console.error("fade: Missing parameters!");
116
+ return false;
117
+ }
118
+ const rgbValue = getRgbValue(color);
119
+ if (!rgbValue)
120
+ return false;
121
+ const rgbaValue = [...rgbValue, percent / 100];
122
+ return getColorFromRgbValue(rgbaValue);
123
+ };
124
+ const isToday = (date, curDate) => {
125
+ const dateToCheck = new Date(date);
126
+ const currentDate = curDate ? new Date(curDate) : /* @__PURE__ */ new Date();
127
+ const state = dateToCheck.getDate() === currentDate.getDate() && dateToCheck.getMonth() === currentDate.getMonth() && dateToCheck.getFullYear() === currentDate.getFullYear();
128
+ return state;
129
+ };
130
+ function hasOwn(obj, key) {
131
+ return Object.prototype.hasOwnProperty.call(obj, key);
132
+ }
133
+ const definePropType = (val) => val;
134
+ const isEpProp = (val) => isObject(val) && !!val[epPropKey];
135
+ const isValidRange = (range) => isArray(range) && range.length === 2 && range.every((item) => isDate(item));
136
+ const isDateInCurWeek = (dateToCheck, firstDayOfWeek, lastDayOfWeek) => {
137
+ const tempDate = new Date(dateToCheck);
138
+ const tempFirstDay = new Date(firstDayOfWeek);
139
+ const tempLastDay = new Date(lastDayOfWeek);
140
+ tempDate.setHours(0, 0, 0, 0);
141
+ tempFirstDay.setHours(0, 0, 0, 0);
142
+ tempLastDay.setHours(0, 0, 0, 0);
143
+ return tempDate >= tempFirstDay && tempDate <= tempLastDay;
144
+ };
145
+ const isTimeGreaterThan = (timeA, timeB) => {
146
+ const date1 = new Date(timeA);
147
+ const date2 = new Date(timeB);
148
+ return date1.getTime() > date2.getTime();
149
+ };
150
+ const getCurWeekDates = (curDate) => {
151
+ const currentDate = new Date(curDate);
152
+ const currentDay = currentDate.getDay();
153
+ const firstDayOfWeek = new Date(currentDate);
154
+ firstDayOfWeek.setDate(currentDate.getDate() - currentDay);
155
+ const lastDayOfWeek = new Date(firstDayOfWeek);
156
+ lastDayOfWeek.setDate(firstDayOfWeek.getDate() + 6);
157
+ firstDayOfWeek.setHours(0, 0, 0, 0);
158
+ lastDayOfWeek.setHours(23, 59, 59, 0);
159
+ return {
160
+ firstDay: firstDayOfWeek,
161
+ lastDay: lastDayOfWeek
162
+ };
163
+ };
164
+ const handleEmit = (eventName, item, location, events, multiple, selectedData, emit) => {
165
+ let tempSelectedData = clone(selectedData);
166
+ let isSelectedEvent = true;
167
+ const targetEvent = events.find((event) => {
168
+ return item.id === event.id;
169
+ });
170
+ const index = tempSelectedData.findIndex(
171
+ (event) => item.id === event.id
172
+ );
173
+ if (multiple) {
174
+ if (index === -1) {
175
+ tempSelectedData.push(targetEvent);
176
+ } else {
177
+ Object.assign(item, { isSelectedEvent: false });
178
+ isSelectedEvent = false;
179
+ tempSelectedData.splice(index, 1);
180
+ }
181
+ } else if (index === -1) {
182
+ tempSelectedData = [targetEvent];
183
+ } else {
184
+ Object.assign(item, { isSelectedEvent: false });
185
+ isSelectedEvent = false;
186
+ tempSelectedData = [];
187
+ }
188
+ switch (eventName) {
189
+ case "eventClick":
190
+ emit("eventClick", { location, data: tempSelectedData });
191
+ break;
192
+ case "eventDblClick":
193
+ emit("eventDblClick", { location, data: tempSelectedData });
194
+ break;
195
+ default:
196
+ break;
197
+ }
198
+ return { eventName, tempSelectedData, isSelectedEvent };
199
+ };
200
+ const handleEVentClick = (item, location, events, multiple, selectedData, emit) => {
201
+ return new Promise((resolve) => {
202
+ clickCount += 1;
203
+ if (clickCount === 1) {
204
+ timer = setTimeout(() => {
205
+ if (clickCount === 1) {
206
+ resolve(
207
+ handleEmit(
208
+ "eventClick",
209
+ item,
210
+ location,
211
+ events,
212
+ multiple,
213
+ selectedData,
214
+ emit
215
+ )
216
+ );
217
+ }
218
+ clickCount = 0;
219
+ }, 300);
220
+ } else if (clickCount === 2) {
221
+ clearTimeout(timer);
222
+ resolve(
223
+ handleEmit(
224
+ "eventDblClick",
225
+ item,
226
+ location,
227
+ events,
228
+ multiple,
229
+ selectedData,
230
+ emit
231
+ )
232
+ );
233
+ clickCount = 0;
234
+ }
235
+ });
236
+ };
237
+ const handleProp = (prop, key) => {
238
+ if (!isObject(prop) || isEpProp(prop))
239
+ return prop;
240
+ const { values, required, default: defaultValue, type, validator } = prop;
241
+ const _validator = values || validator ? (val) => {
242
+ let valid = false;
243
+ let allowedValues = [];
244
+ if (values) {
245
+ allowedValues = Array.from(values);
246
+ if (hasOwn(prop, "default")) {
247
+ allowedValues.push(defaultValue);
248
+ }
249
+ valid || (valid = allowedValues.includes(val));
250
+ }
251
+ if (validator)
252
+ valid || (valid = validator(val));
253
+ if (!valid && allowedValues.length > 0) {
254
+ const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
255
+ warn(
256
+ "Invalid prop: validation failed".concat(key ? ' for prop "'.concat(key, '"') : "", ". Expected one of [").concat(allowValuesText, "], got value ").concat(JSON.stringify(
257
+ val
258
+ ), ".")
259
+ );
260
+ }
261
+ return valid;
262
+ } : void 0;
263
+ const epProp = {
264
+ type,
265
+ required: !!required,
266
+ validator: _validator,
267
+ [epPropKey]: true
268
+ };
269
+ if (hasOwn(prop, "default"))
270
+ epProp.default = defaultValue;
271
+ return epProp;
272
+ };
273
+ const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
274
+ const handleProps = (props) => fromPairs(
275
+ Object.entries(props).map(([key, option]) => [
276
+ key,
277
+ handleProp(option, key)
278
+ ])
279
+ );
280
+
281
+ export { closeIcon, definePropType, epPropKey, fade, getCurWeekDates, handleBkColor, handleEVentClick, handlePopClose, handleProps, handleTimeRange, isDateInCurWeek, isTimeGreaterThan, isToday, isValidRange, rangeArr };