zhytech-ui-mobile 1.0.12 → 1.0.13

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.
@@ -1,7 +1,9 @@
1
1
  import { default as checkbox } from './checkbox';
2
2
  import { default as input } from './input';
3
+ import { default as inputNumber } from './inputNumber';
3
4
  import { default as label } from './label';
4
5
  import { default as radio } from './radio';
5
- import { default as inputNumber } from './inputNumber';
6
+ import { default as date } from './date';
7
+ import { default as time } from './time';
6
8
 
7
- export { label, input, radio, checkbox, inputNumber };
9
+ export { label, input, radio, checkbox, inputNumber, date, time };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @description:日期时间(date/time)独有属性
3
+ */
4
+ export interface datetimeAttribute {
5
+ /**
6
+ * @description: 日期时间类型:'year' | 'years' |'month' | 'months' | 'date' | 'dates' | 'datetime' | 'week' | 'datetimerange' | 'daterange' | 'monthrange' | 'yearrange' | 'timeSelect' | 'timePicker'
7
+ *
8
+ */
9
+ datetimeType?: string;
10
+ /**
11
+ * 日期时间格式
12
+ */
13
+ format?: string;
14
+ /**
15
+ * 日期时间值格式
16
+ */
17
+ valueFormat?: string;
18
+ /**
19
+ * 最大时间
20
+ */
21
+ maxTime?: string;
22
+ /**
23
+ * 最小时间
24
+ */
25
+ minTime?: string;
26
+ /**
27
+ * 允许选择当前时间之前的年/月/周/天/小时/分钟
28
+ */
29
+ beforeTimeThreshold?: number;
30
+ /**
31
+ * 允许选择当前时间之后的年/月/周/天/小时/分钟
32
+ */
33
+ afterTimeThreshold?: number;
34
+ /**
35
+ * 日期/时间区间连接符
36
+ */
37
+ rangeSeparator?: string;
38
+ /**
39
+ * 是否为时间区间
40
+ */
41
+ isRange?: string;
42
+ /**
43
+ * 开始时间
44
+ */
45
+ startTime?: string;
46
+ /**
47
+ * 结束时间
48
+ */
49
+ endTime?: string;
50
+ /**
51
+ * 间隔时间
52
+ */
53
+ timeStep?: string;
54
+ }
@@ -3,6 +3,7 @@ import { editAttribute } from './editAttribute';
3
3
  import { checkboxAttribute } from './base/checkboxAttribute';
4
4
  import { inputAttribute } from './base/inputAttribute';
5
5
  import { radioAttribute } from './base/radioAttribute';
6
+ import { datetimeAttribute } from './base/datetimeAttribute';
6
7
  import { inputNumberAttribute } from './base/inputNumberAttribute';
7
8
  import { uploadAttribute } from './advanced/uploadAttribute';
8
9
  import { employeeAttribute } from './application/employeeAttribute';
@@ -11,4 +12,4 @@ import { gradeAttribute } from './application/gradeAttribute';
11
12
  import { groupLayoutAttribute } from './layout/groupLayoutAttribute';
12
13
  import { tabsLayoutAttribute } from './layout/tabsLayoutAttribute';
13
14
 
14
- export type { baseAttribute, editAttribute, checkboxAttribute, inputAttribute, radioAttribute, inputNumberAttribute, employeeAttribute, postAttribute, gradeAttribute, uploadAttribute, groupLayoutAttribute, tabsLayoutAttribute };
15
+ export type { baseAttribute, editAttribute, checkboxAttribute, datetimeAttribute, inputAttribute, radioAttribute, inputNumberAttribute, employeeAttribute, postAttribute, gradeAttribute, uploadAttribute, groupLayoutAttribute, tabsLayoutAttribute };
@@ -0,0 +1,132 @@
1
+ import { default as dayjs } from 'dayjs';
2
+
3
+ export default function useDate(): {
4
+ /**
5
+ * 校检日期格式是否为YYYY-MM-DD这种格式
6
+ * @param date
7
+ * @returns
8
+ */
9
+ isValidDate(date: dayjs.ConfigType): boolean;
10
+ /**
11
+ * 校检日期格式是否为YYYY-MM-DD HH:mm:ss这种格式
12
+ * @param date
13
+ * @returns
14
+ */
15
+ isValidDateTime(date: dayjs.ConfigType): boolean;
16
+ /**
17
+ * 格式化日期年月日,时间格式为format,默认YYYY-MM-DD
18
+ * @param date
19
+ * @param format
20
+ * @returns
21
+ */
22
+ formatDate: (date: dayjs.ConfigType, format?: string) => string;
23
+ /**
24
+ * 获取当前日期年月日,时间格式为YYYY-MM-DD
25
+ * @param format
26
+ * @returns
27
+ */
28
+ getCurrentDate(format?: string): string;
29
+ /**
30
+ * 获取当前日期年月日时分秒,时间格式为YYYY-MM-DD HH:mm:ss(24小时制,如果hh为小写表示为12小时制)
31
+ * @param format
32
+ * @returns
33
+ */
34
+ getCurrentDateTime(format?: string): string;
35
+ /**
36
+ * 获取日期的毫秒数
37
+ * @param date
38
+ * @returns
39
+ */
40
+ getMilliseconds(date?: dayjs.ConfigType): number;
41
+ /**
42
+ * 获取日期的指定值
43
+ * @param date
44
+ * @param dateType 为要获取日期类型,有如下类型:'minute','hour','day','month','year'这六种类型
45
+ * @returns
46
+ */
47
+ getTimeByType(dateType: dayjs.ManipulateType, date?: dayjs.ConfigType): any;
48
+ /**
49
+ * 将传过来的日期加X日期且时间格式为YYYY-MM-DD这种格式,如:getXAfterDate('2023-11-11',1,'day'),结果为2023-11-12
50
+ * @param date:为传过来的日期
51
+ * @param num:在当前日期加num,类型为int
52
+ * @param dateType:为要加的日期类型,有如下类型:'minute','hour','day','week','month','year'这六种类型
53
+ * @returns
54
+ */
55
+ getXAfterDate: (date: dayjs.ConfigType, num: number, dateType: dayjs.ManipulateType) => string;
56
+ /**
57
+ * 将传过来的日期加X日期且时间格式为YYYY-MM-DD HH:mm:ss这种格式,如:getXAfterDateTime('2023-11-11 10:23:45',1,'day'),结果为2023-11-12 10:23:45
58
+ * @param date:为传过来的日期
59
+ * @param num:在当前日期加num,类型为int
60
+ * @param dateType:为要加的日期类型,有如下类型:'minute','hour','day','week','month','year'这六种类型
61
+ * @returns
62
+ */
63
+ getXAfterDateTime(date: dayjs.ConfigType, num: number, dateType: dayjs.ManipulateType): string;
64
+ /**
65
+ * 将传过来的日期减去X日期且时间格式为YYYY-MM-DD这种格式,如:getXBeforeDate('2023-11-11',1,'day'),结果为2023-11-10
66
+ * @param date:为传过来的日期
67
+ * @param num:在当前日期加num,类型为int
68
+ * @param dateType:为要加的日期类型,有如下类型:'minute','hour','day','week','month','year'这六种类型
69
+ * @returns
70
+ */
71
+ getXBeforeDate(date: dayjs.ConfigType, num: number, dateType: dayjs.ManipulateType): string;
72
+ /**
73
+ * 将传过来的日期减去X日期且时间格式为YYYY-MM-DD HH:mm:ss这种格式,如:getXBeforeDateTime('2023-11-11 10:23:45',1,'day'),结果为2023-11-10 10:23:45
74
+ * @param date:为传过来的日期
75
+ * @param num:在当前日期加day,类型为int
76
+ * @param dateType:为要加的日期类型,有如下类型:'minute','hour','day','week','month','year'这六种类型
77
+ * @returns
78
+ */
79
+ getXBeforeDateTime(date: dayjs.ConfigType, num: number, dateType: dayjs.ManipulateType): string;
80
+ /**
81
+ * 计算2个日期之间的差值
82
+ * @param startDate:开始日期
83
+ * @param endDate:结束日期,结束日期要比开始日期大
84
+ * @param dateType:日期类型,有如下类型:'minute','hour','day','week','month','year'这六种类型
85
+ * @returns
86
+ */
87
+ getDateDiff(startDate: dayjs.ConfigType, endDate: dayjs.ConfigType, dateType: dayjs.ManipulateType): number;
88
+ /**
89
+ * 判断date1是否在date2之前,比如:date1:2023-01-01 13:30:23,date2:2022-12-01 13:30:23,结果为false
90
+ * @param date1
91
+ * @param date2
92
+ * @returns
93
+ */
94
+ isBefore: (date1: dayjs.ConfigType, date2: dayjs.ConfigType) => boolean;
95
+ /**
96
+ * 判断date1是否在date2之后,比如:date1:2023-01-01 13:30:23,date2:2022-12-01 13:30:23,结果为true
97
+ * @param date1
98
+ * @param date2
99
+ * @returns
100
+ */
101
+ isAfter(date1: dayjs.ConfigType, date2: dayjs.ConfigType): boolean;
102
+ /**
103
+ * 判断date1是否与date2相同,比如:date1:2023-01-01 13:30:23,date2:2022-12-01 13:30:23,结果为false
104
+ * @param date1
105
+ * @param date2
106
+ * @returns
107
+ */
108
+ isSame(date1: dayjs.ConfigType, date2: dayjs.ConfigType): boolean;
109
+ /**
110
+ * 将传过来的日期转为当年的1月1号或者当月的1号或者当周的周一
111
+ * @param date:传过来日期
112
+ * @param dateType,日期类型,为:year,month,week这3种
113
+ * @returns
114
+ */
115
+ getEarlyDaysDate(date: dayjs.ConfigType, dateType: dayjs.ManipulateType): string;
116
+ /**
117
+ * 将传过来的日期转为当年的12月31号或者当月的最后一天或者当周的周日
118
+ * @param date:传过来日期
119
+ * @param dateType,日期类型,为:year,month,week这3种
120
+ * @returns
121
+ */
122
+ getLastDaysDate(date: dayjs.ConfigType, dateType: dayjs.ManipulateType): string;
123
+ /**
124
+ * 获取2个日期之间的所有日期,包括开始日期和结束日期,如:getIntermediateDate('2023-12-01','2023-12-15',1,'day'))
125
+ * @param startDate:开始日期
126
+ * @param endDate:结束日期要大于开始日期
127
+ * @param num:在开始日期上加num,int类型,如果dateType为day,num为1那么就是在开始日期上加一天
128
+ * @param dateType,日期类型,类型如下:'minute','hour','day','week','month','year'这六种类型
129
+ * @returns
130
+ */
131
+ getIntermediateDate(startDate: dayjs.ConfigType, endDate: dayjs.ConfigType, num: number, dateType: dayjs.ManipulateType): (string | number | Date | dayjs.Dayjs)[];
132
+ };