@cfmm/umi-plugins-ui-v2 0.0.28 → 0.0.29
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.
- package/dist/cjs/components/MySelect.tpl +6 -5
- package/dist/cjs/components/UTCDatePicker.tpl +17 -10
- package/dist/cjs/components/UTCRangePicker.tpl +17 -18
- package/dist/cjs/types/DatePickerTypes.d.ts +1 -1
- package/dist/cjs/types/DatePickerTypes.js +1 -1
- package/dist/cjs/types/MySelectTypes.d.ts +1 -1
- package/dist/cjs/types/MySelectTypes.js +1 -1
- package/dist/cjs/writeTmpFile/writeConstants.js +1 -1
- package/dist/esm/components/MySelect.tpl +6 -5
- package/dist/esm/components/UTCDatePicker.tpl +17 -10
- package/dist/esm/components/UTCRangePicker.tpl +17 -18
- package/dist/esm/types/DatePickerTypes.d.ts +1 -1
- package/dist/esm/types/DatePickerTypes.js +1 -1
- package/dist/esm/types/MySelectTypes.d.ts +1 -1
- package/dist/esm/types/MySelectTypes.js +1 -1
- package/dist/esm/writeTmpFile/writeConstants.js +1 -1
- package/package.json +1 -1
|
@@ -48,6 +48,7 @@ const MySelect = <T,>(props: MySelectProps<T>, ref: ForwardedRef<any>) => {
|
|
|
48
48
|
showDropdown,
|
|
49
49
|
getSelectList,
|
|
50
50
|
pageSize = 20,
|
|
51
|
+
searchDelay = 500,
|
|
51
52
|
mode,
|
|
52
53
|
dropDownListChange,
|
|
53
54
|
...reset
|
|
@@ -99,7 +100,7 @@ const MySelect = <T,>(props: MySelectProps<T>, ref: ForwardedRef<any>) => {
|
|
|
99
100
|
|
|
100
101
|
const handleSearch = debounce((v: string) => {
|
|
101
102
|
setSearchValue({ [searchKey]: v });
|
|
102
|
-
},
|
|
103
|
+
}, searchDelay);
|
|
103
104
|
|
|
104
105
|
// 获取数据
|
|
105
106
|
useImperativeHandle(ref, () => ({}));
|
|
@@ -116,13 +117,13 @@ const MySelect = <T,>(props: MySelectProps<T>, ref: ForwardedRef<any>) => {
|
|
|
116
117
|
// 如果显示全部,则不分页
|
|
117
118
|
params = showAllList ? params : { pageIndex: 1, pageSize, ...params };
|
|
118
119
|
const response = await request(params);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
setListData(
|
|
120
|
+
const data = response.rows || response.data;
|
|
121
|
+
if (data && data.length > 0) {
|
|
122
|
+
setListData(data);
|
|
122
123
|
|
|
123
124
|
const allList = [...allListData];
|
|
124
125
|
// 如果原有列表没有,则增加,防止getSelectList找不到选择的项
|
|
125
|
-
|
|
126
|
+
data.forEach((item) => {
|
|
126
127
|
if (!getListData.some((v) => item[keyNames.id] === v[keyNames.id])) {
|
|
127
128
|
allList.push(item);
|
|
128
129
|
}
|
|
@@ -2,31 +2,36 @@ import { useModel } from '@umijs/max';
|
|
|
2
2
|
import { DatePicker } from 'antd';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
|
-
import { UTC_FORMAT } from '../constants';
|
|
6
|
-
import { UTCDatePickerProps } from
|
|
5
|
+
import { DATE_FORMAT, DATE_TIME_FORMAT, UTC_FORMAT } from '../constants';
|
|
6
|
+
import { UTCDatePickerProps } from '../types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 带UTC时区转换功能的DatePicker组件
|
|
10
10
|
*/
|
|
11
11
|
const UTCDatePicker = (props: UTCDatePickerProps) => {
|
|
12
12
|
// 设置mode后无法显示时间
|
|
13
|
-
const { readonly, convertTimeZone
|
|
14
|
-
const { timeZone, timeFormat, dateFormat } = window.__POWERED_BY_QIANKUN__
|
|
13
|
+
const { readonly, convertTimeZone, showTime = false, mode, ...reset } = props;
|
|
14
|
+
const { timeZone, timeFormat, dateFormat } = window.__POWERED_BY_QIANKUN__
|
|
15
|
+
? useModel('@@qiankunStateFromMaster')
|
|
16
|
+
: useModel('user');
|
|
17
|
+
|
|
18
|
+
// 如果不传convertTimeZone,则根据showTime判断是否转换时区,默认showTime为true转时区,false不转时区
|
|
19
|
+
const newConvertTimeZone = typeof convertTimeZone === 'boolean' ? convertTimeZone : showTime;
|
|
15
20
|
|
|
16
21
|
// 将日期转换为地区时间显示
|
|
17
22
|
const value = useMemo(() => {
|
|
18
23
|
const v = props.value;
|
|
19
24
|
if (v && dayjs(v).isValid()) {
|
|
20
25
|
const date = dayjs(v);
|
|
21
|
-
return
|
|
26
|
+
return newConvertTimeZone ? date.tz(timeZone) : date;
|
|
22
27
|
}
|
|
23
|
-
}, [props.value,
|
|
28
|
+
}, [props.value, newConvertTimeZone, timeZone]);
|
|
24
29
|
|
|
25
30
|
// 获取设置的格式
|
|
26
31
|
const format = useMemo(() => {
|
|
27
|
-
if(typeof showTime === 'object' && showTime.format
|
|
32
|
+
if (typeof showTime === 'object' && showTime.format) {
|
|
28
33
|
return `${dateFormat} ${showTime.format}`;
|
|
29
|
-
}
|
|
34
|
+
}
|
|
30
35
|
return props.format || showTime ? `${dateFormat} ${timeFormat}` : dateFormat;
|
|
31
36
|
}, [props.format, showTime, dateFormat, timeFormat]);
|
|
32
37
|
|
|
@@ -34,8 +39,10 @@ const UTCDatePicker = (props: UTCDatePickerProps) => {
|
|
|
34
39
|
const handleChange = (date: dayjs.Dayjs, dateString: string | string[]) => {
|
|
35
40
|
if (date) {
|
|
36
41
|
// 转标准时间,显示时间转换有问题
|
|
37
|
-
const standardTime: any =
|
|
38
|
-
|
|
42
|
+
const standardTime: any = newConvertTimeZone
|
|
43
|
+
? date.utc().format(UTC_FORMAT)
|
|
44
|
+
: date.format(showTime ? DATE_TIME_FORMAT : DATE_FORMAT);
|
|
45
|
+
const dateString = newConvertTimeZone ? date.utc().format(format) : date.format(format);
|
|
39
46
|
|
|
40
47
|
props.onChange?.(standardTime, dateString);
|
|
41
48
|
return;
|
|
@@ -2,8 +2,8 @@ import { useModel } from '@umijs/max';
|
|
|
2
2
|
import { DatePicker } from 'antd';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
|
-
import { UTC_FORMAT } from '../constants';
|
|
6
|
-
import {
|
|
5
|
+
import { DATE_FORMAT, DATE_TIME_FORMAT, UTC_FORMAT } from '../constants';
|
|
6
|
+
import { RangePickerOnChangeType, RangePickerValueType, UTCRangePickerProps } from '../types';
|
|
7
7
|
|
|
8
8
|
const { RangePicker } = DatePicker;
|
|
9
9
|
|
|
@@ -12,16 +12,13 @@ const { RangePicker } = DatePicker;
|
|
|
12
12
|
*/
|
|
13
13
|
const UTCRangePicker = (props: UTCRangePickerProps) => {
|
|
14
14
|
// 设置mode后无法显示时间
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...reset
|
|
23
|
-
} = props;
|
|
24
|
-
const { timeZone, timeFormat, dateFormat } = window.__POWERED_BY_QIANKUN__ ? useModel("@@qiankunStateFromMaster") : useModel('user');
|
|
15
|
+
const { readonly, convertTimeZone, showTime = false, mode, endDateEndOfType, startDatStartOfType, ...reset } = props;
|
|
16
|
+
const { timeZone, timeFormat, dateFormat } = window.__POWERED_BY_QIANKUN__
|
|
17
|
+
? useModel('@@qiankunStateFromMaster')
|
|
18
|
+
: useModel('user');
|
|
19
|
+
|
|
20
|
+
// 如果不传convertTimeZone,则根据showTime判断是否转换时区,默认showTime为true转时区,false不转时区
|
|
21
|
+
const newConvertTimeZone = typeof convertTimeZone === 'boolean' ? convertTimeZone : showTime;
|
|
25
22
|
|
|
26
23
|
// 将日期转换为地区时间显示
|
|
27
24
|
const value: RangePickerValueType = useMemo(() => {
|
|
@@ -31,16 +28,16 @@ const UTCRangePicker = (props: UTCRangePickerProps) => {
|
|
|
31
28
|
|
|
32
29
|
const startTime = v[0] ? dayjs(v[0]) : undefined;
|
|
33
30
|
const endTime = v[1] ? dayjs(v[1]) : undefined;
|
|
34
|
-
return
|
|
31
|
+
return newConvertTimeZone
|
|
35
32
|
? [startTime ? startTime.tz(timeZone) : undefined, endTime ? endTime.tz(timeZone) : undefined]
|
|
36
33
|
: [startTime, endTime];
|
|
37
|
-
}, [props.value,
|
|
34
|
+
}, [props.value, newConvertTimeZone, timeZone]);
|
|
38
35
|
|
|
39
36
|
// 获取设置的格式
|
|
40
37
|
const format = useMemo(() => {
|
|
41
|
-
if(typeof showTime === 'object' && showTime.format
|
|
38
|
+
if (typeof showTime === 'object' && showTime.format) {
|
|
42
39
|
return `${dateFormat} ${showTime.format}`;
|
|
43
|
-
}
|
|
40
|
+
}
|
|
44
41
|
return props.format || showTime ? `${dateFormat} ${timeFormat}` : dateFormat;
|
|
45
42
|
}, [props.format, showTime, dateFormat, timeFormat]);
|
|
46
43
|
|
|
@@ -57,10 +54,12 @@ const UTCRangePicker = (props: UTCRangePickerProps) => {
|
|
|
57
54
|
const utcStartTime = startTime?.utc();
|
|
58
55
|
const utcEndTime = endTime?.utc();
|
|
59
56
|
|
|
57
|
+
const notConvertFormat = showTime ? DATE_TIME_FORMAT : DATE_FORMAT;
|
|
58
|
+
|
|
60
59
|
// 转标准时间,显示时间转换有问题
|
|
61
|
-
const standardTime: any =
|
|
60
|
+
const standardTime: any = newConvertTimeZone
|
|
62
61
|
? [utcStartTime?.format(UTC_FORMAT), utcEndTime?.format(UTC_FORMAT)]
|
|
63
|
-
: [startTime?.format(
|
|
62
|
+
: [startTime?.format(notConvertFormat), endTime?.format(notConvertFormat)];
|
|
64
63
|
const datesString: any = [startTime?.format(format), endTime?.format(format)];
|
|
65
64
|
|
|
66
65
|
props.onChange?.(standardTime, datesString);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const DatePickerTypes = "\n export type DateType = dayjs.Dayjs | string;\n export type HasNullUndefinedDateType = DateType | undefined | null;\n\n export interface UTCDatePickerProps extends DatePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\
|
|
1
|
+
export declare const DatePickerTypes = "\n export type DateType = dayjs.Dayjs | string;\n export type HasNullUndefinedDateType = DateType | undefined | null;\n\n export interface UTCDatePickerProps extends DatePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u5224\u65AD\u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u4E3Atrue\u8F6C\u65F6\u533A\uFF0Cfalse\u4E0D\u8F6C\u65F6\u533A\n */\n convertTimeZone?: boolean;\n /**\n * \u662F\u5426\u53EA\u8BFB\uFF0C\u9ED8\u8BA4false\n */\n readonly?: boolean;\n }\n\n type DatePickValueType = Pick<ProFormItemProps<import('antd').DatePickerProps>, 'fieldProps'>;\n\n export interface UTCProFormDatePickerProps extends ProFormItemProps<import('antd').DatePickerProps> {\n /**\n * DatePickerProps\n */\n fieldProps?: DatePickValueType['fieldProps'] & {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4true\n */\n convertTimeZone?: boolean;\n };\n /**\n * \u662F\u5426\u7981\u7528\uFF0C\u9ED8\u8BA4false\n */\n disabled?: boolean;\n }\n\n\n type RangePickerValueType = RangePickerProps['value'];\n export type RangePickerOnChangeType = RangePickerProps['onChange'];\n\n export type RangeDateType = [HasNullUndefinedDateType, HasNullUndefinedDateType];\n\n export interface UTCRangePickerProps extends RangePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u5224\u65AD\u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u4E3Atrue\u8F6C\u65F6\u533A\uFF0Cfalse\u4E0D\u8F6C\u65F6\u533A\n */\n convertTimeZone?: boolean;\n /**\n * \u662F\u5426\u53EA\u8BFB\uFF0C\u9ED8\u8BA4false\n */\n readonly?: boolean;\n /**\n * \u5F00\u59CB\u65E5\u671F\u7684startOf\u7C7B\u578B\n */\n startDatStartOfType?: OpUnitType;\n /**\n * \u7ED3\u675F\u65E5\u671F\u7684endOf\u7C7B\u578B\n */\n endDateEndOfType?: OpUnitType;\n }\n\n type RangePickValueType = Pick<ProFormItemProps<RangePickerProps>, 'fieldProps'>;\n\n export interface UTCProFormRangePickerProps extends ProFormItemProps<RangePickerProps> {\n /**\n * RangePickerProps\n */\n fieldProps?: RangePickValueType['fieldProps'] & {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4true\n */\n convertTimeZone?: boolean;\n };\n /**\n * \u662F\u5426\u7981\u7528\uFF0C\u9ED8\u8BA4false\n */\n disabled?: boolean;\n }\n";
|
|
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DatePickerTypes = void 0;
|
|
7
|
-
var DatePickerTypes = exports.DatePickerTypes = "\n export type DateType = dayjs.Dayjs | string;\n export type HasNullUndefinedDateType = DateType | undefined | null;\n\n export interface UTCDatePickerProps extends DatePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\
|
|
7
|
+
var DatePickerTypes = exports.DatePickerTypes = "\n export type DateType = dayjs.Dayjs | string;\n export type HasNullUndefinedDateType = DateType | undefined | null;\n\n export interface UTCDatePickerProps extends DatePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u5224\u65AD\u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u4E3Atrue\u8F6C\u65F6\u533A\uFF0Cfalse\u4E0D\u8F6C\u65F6\u533A\n */\n convertTimeZone?: boolean;\n /**\n * \u662F\u5426\u53EA\u8BFB\uFF0C\u9ED8\u8BA4false\n */\n readonly?: boolean;\n }\n\n type DatePickValueType = Pick<ProFormItemProps<import('antd').DatePickerProps>, 'fieldProps'>;\n\n export interface UTCProFormDatePickerProps extends ProFormItemProps<import('antd').DatePickerProps> {\n /**\n * DatePickerProps\n */\n fieldProps?: DatePickValueType['fieldProps'] & {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4true\n */\n convertTimeZone?: boolean;\n };\n /**\n * \u662F\u5426\u7981\u7528\uFF0C\u9ED8\u8BA4false\n */\n disabled?: boolean;\n }\n\n\n type RangePickerValueType = RangePickerProps['value'];\n export type RangePickerOnChangeType = RangePickerProps['onChange'];\n\n export type RangeDateType = [HasNullUndefinedDateType, HasNullUndefinedDateType];\n\n export interface UTCRangePickerProps extends RangePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u5224\u65AD\u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u4E3Atrue\u8F6C\u65F6\u533A\uFF0Cfalse\u4E0D\u8F6C\u65F6\u533A\n */\n convertTimeZone?: boolean;\n /**\n * \u662F\u5426\u53EA\u8BFB\uFF0C\u9ED8\u8BA4false\n */\n readonly?: boolean;\n /**\n * \u5F00\u59CB\u65E5\u671F\u7684startOf\u7C7B\u578B\n */\n startDatStartOfType?: OpUnitType;\n /**\n * \u7ED3\u675F\u65E5\u671F\u7684endOf\u7C7B\u578B\n */\n endDateEndOfType?: OpUnitType;\n }\n\n type RangePickValueType = Pick<ProFormItemProps<RangePickerProps>, 'fieldProps'>;\n\n export interface UTCProFormRangePickerProps extends ProFormItemProps<RangePickerProps> {\n /**\n * RangePickerProps\n */\n fieldProps?: RangePickValueType['fieldProps'] & {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4true\n */\n convertTimeZone?: boolean;\n };\n /**\n * \u662F\u5426\u7981\u7528\uFF0C\u9ED8\u8BA4false\n */\n disabled?: boolean;\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MySelectTypes = "\n /** \u7EC4\u4EF6\u6620\u5C04\u5B57\u6BB5 */\n export type KeyNamesType<T> = {\n /** \u4E3B\u952E */\n id: keyof T;\n /** \u7F16\u7801 */\n code?: keyof T;\n /** \u540D\u79F0 */\n name: keyof T;\n };\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export interface MySelectProps<T> extends SelectProps {\n /** \u662F\u5426\u53EA\u8BFB */\n readonly?: boolean;\n /** \u5FC5\u987B\u8F93\u5165\u641C\u7D22\u6761\u4EF6 */\n mustSearch?: boolean;\n /** \u662F\u5426\u81EA\u52A8\u9009\u4E2D */\n autoSelect?: boolean;\n /** \u662F\u5426\u663E\u793A\u6240\u6709\u6570\u636E\uFF08\u4E0D\u5206\u9875\uFF09 */\n showAllList?: boolean;\n /** \u83B7\u53D6\u591A\u5C11\u6761\u6570\u636E\uFF0C\u9ED8\u8BA420 */\n pageSize?: number;\n /** \u672C\u5730\u5217\u8868\u6570\u636E */\n localListData?: T[];\n /** \u56DE\u663E\u6570\u636E\u5217\u8868 */\n backShowList?: T[];\n /** \u8BF7\u6C42\u5217\u8868\u6570\u636E */\n request: (searchKey?: { [key: string]: any }) => Promise<API.Result_Base_List<T[]>>;\n /** \u6E32\u67D3\u7684\u503C */\n keyNames: KeyNamesType<T>;\n /** \u641C\u7D22\u7684\u5B57\u6BB5 */\n searchKey?: keyof T;\n /** Select.Option\u7684value\u5B57\u6BB5 */\n selectKey?: keyof T;\n /** \u989D\u5916\u7684\u67E5\u8BE2\u6761\u4EF6 */\n otherSearchValue?: Record<string, any>;\n /** \u53EA\u663E\u793A\u540D\u79F0 */\n onlyShowName?: boolean;\n /** \u81EA\u5B9A\u4E49\u6E32\u67D3 */\n itemRender?: (list: T[]) => React.ReactNode;\n /** \u5185\u5BB9\u7C7B\u578B */\n valueType?: 'key' | 'object';\n /** \u5224\u65AD\u4E0B\u62C9\u6846\u7684\u663E\u793A */\n showDropdown?: boolean;\n /** \u83B7\u53D6\u5DF2\u9009\u62E9\u7684\u6570\u636E\u5217\u8868 */\n getSelectList?: (item: T[]) => void;\n /** \u6570\u636E\u4E0B\u62C9\u5217\u8868\u53D8\u5316\u56DE\u8C03 */\n dropDownListChange?: (list: T[]) => void;\n }\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export type MySelectListProps<T> = Partial<MySelectProps<T>>;\n";
|
|
1
|
+
export declare const MySelectTypes = "\n /** \u7EC4\u4EF6\u6620\u5C04\u5B57\u6BB5 */\n export type KeyNamesType<T> = {\n /** \u4E3B\u952E */\n id: keyof T;\n /** \u7F16\u7801 */\n code?: keyof T;\n /** \u540D\u79F0 */\n name: keyof T;\n };\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export interface MySelectProps<T> extends SelectProps {\n /** \u662F\u5426\u53EA\u8BFB */\n readonly?: boolean;\n /** \u5FC5\u987B\u8F93\u5165\u641C\u7D22\u6761\u4EF6 */\n mustSearch?: boolean;\n /** \u641C\u7D22\u5EF6\u8FDF\u65F6\u95F4 */\n searchDelay?: number;\n /** \u662F\u5426\u81EA\u52A8\u9009\u4E2D */\n autoSelect?: boolean;\n /** \u662F\u5426\u663E\u793A\u6240\u6709\u6570\u636E\uFF08\u4E0D\u5206\u9875\uFF09 */\n showAllList?: boolean;\n /** \u83B7\u53D6\u591A\u5C11\u6761\u6570\u636E\uFF0C\u9ED8\u8BA420 */\n pageSize?: number;\n /** \u672C\u5730\u5217\u8868\u6570\u636E */\n localListData?: T[];\n /** \u56DE\u663E\u6570\u636E\u5217\u8868 */\n backShowList?: T[];\n /** \u8BF7\u6C42\u5217\u8868\u6570\u636E */\n request: (searchKey?: { [key: string]: any }) => Promise<API.Result_Base_List<T[]>>;\n /** \u6E32\u67D3\u7684\u503C */\n keyNames: KeyNamesType<T>;\n /** \u641C\u7D22\u7684\u5B57\u6BB5 */\n searchKey?: keyof T;\n /** Select.Option\u7684value\u5B57\u6BB5 */\n selectKey?: keyof T;\n /** \u989D\u5916\u7684\u67E5\u8BE2\u6761\u4EF6 */\n otherSearchValue?: Record<string, any>;\n /** \u53EA\u663E\u793A\u540D\u79F0 */\n onlyShowName?: boolean;\n /** \u81EA\u5B9A\u4E49\u6E32\u67D3 */\n itemRender?: (list: T[]) => React.ReactNode;\n /** \u5185\u5BB9\u7C7B\u578B */\n valueType?: 'key' | 'object';\n /** \u5224\u65AD\u4E0B\u62C9\u6846\u7684\u663E\u793A */\n showDropdown?: boolean;\n /** \u83B7\u53D6\u5DF2\u9009\u62E9\u7684\u6570\u636E\u5217\u8868 */\n getSelectList?: (item: T[]) => void;\n /** \u6570\u636E\u4E0B\u62C9\u5217\u8868\u53D8\u5316\u56DE\u8C03 */\n dropDownListChange?: (list: T[]) => void;\n }\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export type MySelectListProps<T> = Partial<MySelectProps<T>>;\n";
|
|
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MySelectTypes = void 0;
|
|
7
|
-
var MySelectTypes = exports.MySelectTypes = "\n /** \u7EC4\u4EF6\u6620\u5C04\u5B57\u6BB5 */\n export type KeyNamesType<T> = {\n /** \u4E3B\u952E */\n id: keyof T;\n /** \u7F16\u7801 */\n code?: keyof T;\n /** \u540D\u79F0 */\n name: keyof T;\n };\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export interface MySelectProps<T> extends SelectProps {\n /** \u662F\u5426\u53EA\u8BFB */\n readonly?: boolean;\n /** \u5FC5\u987B\u8F93\u5165\u641C\u7D22\u6761\u4EF6 */\n mustSearch?: boolean;\n /** \u662F\u5426\u81EA\u52A8\u9009\u4E2D */\n autoSelect?: boolean;\n /** \u662F\u5426\u663E\u793A\u6240\u6709\u6570\u636E\uFF08\u4E0D\u5206\u9875\uFF09 */\n showAllList?: boolean;\n /** \u83B7\u53D6\u591A\u5C11\u6761\u6570\u636E\uFF0C\u9ED8\u8BA420 */\n pageSize?: number;\n /** \u672C\u5730\u5217\u8868\u6570\u636E */\n localListData?: T[];\n /** \u56DE\u663E\u6570\u636E\u5217\u8868 */\n backShowList?: T[];\n /** \u8BF7\u6C42\u5217\u8868\u6570\u636E */\n request: (searchKey?: { [key: string]: any }) => Promise<API.Result_Base_List<T[]>>;\n /** \u6E32\u67D3\u7684\u503C */\n keyNames: KeyNamesType<T>;\n /** \u641C\u7D22\u7684\u5B57\u6BB5 */\n searchKey?: keyof T;\n /** Select.Option\u7684value\u5B57\u6BB5 */\n selectKey?: keyof T;\n /** \u989D\u5916\u7684\u67E5\u8BE2\u6761\u4EF6 */\n otherSearchValue?: Record<string, any>;\n /** \u53EA\u663E\u793A\u540D\u79F0 */\n onlyShowName?: boolean;\n /** \u81EA\u5B9A\u4E49\u6E32\u67D3 */\n itemRender?: (list: T[]) => React.ReactNode;\n /** \u5185\u5BB9\u7C7B\u578B */\n valueType?: 'key' | 'object';\n /** \u5224\u65AD\u4E0B\u62C9\u6846\u7684\u663E\u793A */\n showDropdown?: boolean;\n /** \u83B7\u53D6\u5DF2\u9009\u62E9\u7684\u6570\u636E\u5217\u8868 */\n getSelectList?: (item: T[]) => void;\n /** \u6570\u636E\u4E0B\u62C9\u5217\u8868\u53D8\u5316\u56DE\u8C03 */\n dropDownListChange?: (list: T[]) => void;\n }\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export type MySelectListProps<T> = Partial<MySelectProps<T>>;\n";
|
|
7
|
+
var MySelectTypes = exports.MySelectTypes = "\n /** \u7EC4\u4EF6\u6620\u5C04\u5B57\u6BB5 */\n export type KeyNamesType<T> = {\n /** \u4E3B\u952E */\n id: keyof T;\n /** \u7F16\u7801 */\n code?: keyof T;\n /** \u540D\u79F0 */\n name: keyof T;\n };\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export interface MySelectProps<T> extends SelectProps {\n /** \u662F\u5426\u53EA\u8BFB */\n readonly?: boolean;\n /** \u5FC5\u987B\u8F93\u5165\u641C\u7D22\u6761\u4EF6 */\n mustSearch?: boolean;\n /** \u641C\u7D22\u5EF6\u8FDF\u65F6\u95F4 */\n searchDelay?: number;\n /** \u662F\u5426\u81EA\u52A8\u9009\u4E2D */\n autoSelect?: boolean;\n /** \u662F\u5426\u663E\u793A\u6240\u6709\u6570\u636E\uFF08\u4E0D\u5206\u9875\uFF09 */\n showAllList?: boolean;\n /** \u83B7\u53D6\u591A\u5C11\u6761\u6570\u636E\uFF0C\u9ED8\u8BA420 */\n pageSize?: number;\n /** \u672C\u5730\u5217\u8868\u6570\u636E */\n localListData?: T[];\n /** \u56DE\u663E\u6570\u636E\u5217\u8868 */\n backShowList?: T[];\n /** \u8BF7\u6C42\u5217\u8868\u6570\u636E */\n request: (searchKey?: { [key: string]: any }) => Promise<API.Result_Base_List<T[]>>;\n /** \u6E32\u67D3\u7684\u503C */\n keyNames: KeyNamesType<T>;\n /** \u641C\u7D22\u7684\u5B57\u6BB5 */\n searchKey?: keyof T;\n /** Select.Option\u7684value\u5B57\u6BB5 */\n selectKey?: keyof T;\n /** \u989D\u5916\u7684\u67E5\u8BE2\u6761\u4EF6 */\n otherSearchValue?: Record<string, any>;\n /** \u53EA\u663E\u793A\u540D\u79F0 */\n onlyShowName?: boolean;\n /** \u81EA\u5B9A\u4E49\u6E32\u67D3 */\n itemRender?: (list: T[]) => React.ReactNode;\n /** \u5185\u5BB9\u7C7B\u578B */\n valueType?: 'key' | 'object';\n /** \u5224\u65AD\u4E0B\u62C9\u6846\u7684\u663E\u793A */\n showDropdown?: boolean;\n /** \u83B7\u53D6\u5DF2\u9009\u62E9\u7684\u6570\u636E\u5217\u8868 */\n getSelectList?: (item: T[]) => void;\n /** \u6570\u636E\u4E0B\u62C9\u5217\u8868\u53D8\u5316\u56DE\u8C03 */\n dropDownListChange?: (list: T[]) => void;\n }\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export type MySelectListProps<T> = Partial<MySelectProps<T>>;\n";
|
|
@@ -8,6 +8,6 @@ var _default = exports.default = function _default(api) {
|
|
|
8
8
|
var _api$userConfig$defin, _api$userConfig$defin2, _api$userConfig$defin3, _api$userConfig$defin4;
|
|
9
9
|
return {
|
|
10
10
|
path: "constants.ts",
|
|
11
|
-
content: "\n export const UTC_FORMAT = 'YYYY-MM-DDTHH:mm:ss[Z]';\n\n export const BASE_API = '/api';\n\n export const BACKEND_API_URL = '".concat((_api$userConfig$defin = (_api$userConfig$defin2 = api.userConfig.define) === null || _api$userConfig$defin2 === void 0 ? void 0 : _api$userConfig$defin2.BACKEND_API_URL) !== null && _api$userConfig$defin !== void 0 ? _api$userConfig$defin : undefined, "';\n\n export const FILE_VIEWER_URL = '").concat((_api$userConfig$defin3 = (_api$userConfig$defin4 = api.userConfig.define) === null || _api$userConfig$defin4 === void 0 ? void 0 : _api$userConfig$defin4.FILE_VIEWER_URL) !== null && _api$userConfig$defin3 !== void 0 ? _api$userConfig$defin3 : undefined, "';\n ")
|
|
11
|
+
content: "\n export const UTC_FORMAT = 'YYYY-MM-DDTHH:mm:ss[Z]';\n export const DATE_FORMAT = 'YYYY-MM-DD';\n export const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';\n export const TIME_FORMAT = 'HH:mm:ss';\n\n export const BASE_API = '/api';\n\n export const BACKEND_API_URL = '".concat((_api$userConfig$defin = (_api$userConfig$defin2 = api.userConfig.define) === null || _api$userConfig$defin2 === void 0 ? void 0 : _api$userConfig$defin2.BACKEND_API_URL) !== null && _api$userConfig$defin !== void 0 ? _api$userConfig$defin : undefined, "';\n\n export const FILE_VIEWER_URL = '").concat((_api$userConfig$defin3 = (_api$userConfig$defin4 = api.userConfig.define) === null || _api$userConfig$defin4 === void 0 ? void 0 : _api$userConfig$defin4.FILE_VIEWER_URL) !== null && _api$userConfig$defin3 !== void 0 ? _api$userConfig$defin3 : undefined, "';\n ")
|
|
12
12
|
};
|
|
13
13
|
};
|
|
@@ -48,6 +48,7 @@ const MySelect = <T,>(props: MySelectProps<T>, ref: ForwardedRef<any>) => {
|
|
|
48
48
|
showDropdown,
|
|
49
49
|
getSelectList,
|
|
50
50
|
pageSize = 20,
|
|
51
|
+
searchDelay = 500,
|
|
51
52
|
mode,
|
|
52
53
|
dropDownListChange,
|
|
53
54
|
...reset
|
|
@@ -99,7 +100,7 @@ const MySelect = <T,>(props: MySelectProps<T>, ref: ForwardedRef<any>) => {
|
|
|
99
100
|
|
|
100
101
|
const handleSearch = debounce((v: string) => {
|
|
101
102
|
setSearchValue({ [searchKey]: v });
|
|
102
|
-
},
|
|
103
|
+
}, searchDelay);
|
|
103
104
|
|
|
104
105
|
// 获取数据
|
|
105
106
|
useImperativeHandle(ref, () => ({}));
|
|
@@ -116,13 +117,13 @@ const MySelect = <T,>(props: MySelectProps<T>, ref: ForwardedRef<any>) => {
|
|
|
116
117
|
// 如果显示全部,则不分页
|
|
117
118
|
params = showAllList ? params : { pageIndex: 1, pageSize, ...params };
|
|
118
119
|
const response = await request(params);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
setListData(
|
|
120
|
+
const data = response.rows || response.data;
|
|
121
|
+
if (data && data.length > 0) {
|
|
122
|
+
setListData(data);
|
|
122
123
|
|
|
123
124
|
const allList = [...allListData];
|
|
124
125
|
// 如果原有列表没有,则增加,防止getSelectList找不到选择的项
|
|
125
|
-
|
|
126
|
+
data.forEach((item) => {
|
|
126
127
|
if (!getListData.some((v) => item[keyNames.id] === v[keyNames.id])) {
|
|
127
128
|
allList.push(item);
|
|
128
129
|
}
|
|
@@ -2,31 +2,36 @@ import { useModel } from '@umijs/max';
|
|
|
2
2
|
import { DatePicker } from 'antd';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
|
-
import { UTC_FORMAT } from '../constants';
|
|
6
|
-
import { UTCDatePickerProps } from
|
|
5
|
+
import { DATE_FORMAT, DATE_TIME_FORMAT, UTC_FORMAT } from '../constants';
|
|
6
|
+
import { UTCDatePickerProps } from '../types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 带UTC时区转换功能的DatePicker组件
|
|
10
10
|
*/
|
|
11
11
|
const UTCDatePicker = (props: UTCDatePickerProps) => {
|
|
12
12
|
// 设置mode后无法显示时间
|
|
13
|
-
const { readonly, convertTimeZone
|
|
14
|
-
const { timeZone, timeFormat, dateFormat } = window.__POWERED_BY_QIANKUN__
|
|
13
|
+
const { readonly, convertTimeZone, showTime = false, mode, ...reset } = props;
|
|
14
|
+
const { timeZone, timeFormat, dateFormat } = window.__POWERED_BY_QIANKUN__
|
|
15
|
+
? useModel('@@qiankunStateFromMaster')
|
|
16
|
+
: useModel('user');
|
|
17
|
+
|
|
18
|
+
// 如果不传convertTimeZone,则根据showTime判断是否转换时区,默认showTime为true转时区,false不转时区
|
|
19
|
+
const newConvertTimeZone = typeof convertTimeZone === 'boolean' ? convertTimeZone : showTime;
|
|
15
20
|
|
|
16
21
|
// 将日期转换为地区时间显示
|
|
17
22
|
const value = useMemo(() => {
|
|
18
23
|
const v = props.value;
|
|
19
24
|
if (v && dayjs(v).isValid()) {
|
|
20
25
|
const date = dayjs(v);
|
|
21
|
-
return
|
|
26
|
+
return newConvertTimeZone ? date.tz(timeZone) : date;
|
|
22
27
|
}
|
|
23
|
-
}, [props.value,
|
|
28
|
+
}, [props.value, newConvertTimeZone, timeZone]);
|
|
24
29
|
|
|
25
30
|
// 获取设置的格式
|
|
26
31
|
const format = useMemo(() => {
|
|
27
|
-
if(typeof showTime === 'object' && showTime.format
|
|
32
|
+
if (typeof showTime === 'object' && showTime.format) {
|
|
28
33
|
return `${dateFormat} ${showTime.format}`;
|
|
29
|
-
}
|
|
34
|
+
}
|
|
30
35
|
return props.format || showTime ? `${dateFormat} ${timeFormat}` : dateFormat;
|
|
31
36
|
}, [props.format, showTime, dateFormat, timeFormat]);
|
|
32
37
|
|
|
@@ -34,8 +39,10 @@ const UTCDatePicker = (props: UTCDatePickerProps) => {
|
|
|
34
39
|
const handleChange = (date: dayjs.Dayjs, dateString: string | string[]) => {
|
|
35
40
|
if (date) {
|
|
36
41
|
// 转标准时间,显示时间转换有问题
|
|
37
|
-
const standardTime: any =
|
|
38
|
-
|
|
42
|
+
const standardTime: any = newConvertTimeZone
|
|
43
|
+
? date.utc().format(UTC_FORMAT)
|
|
44
|
+
: date.format(showTime ? DATE_TIME_FORMAT : DATE_FORMAT);
|
|
45
|
+
const dateString = newConvertTimeZone ? date.utc().format(format) : date.format(format);
|
|
39
46
|
|
|
40
47
|
props.onChange?.(standardTime, dateString);
|
|
41
48
|
return;
|
|
@@ -2,8 +2,8 @@ import { useModel } from '@umijs/max';
|
|
|
2
2
|
import { DatePicker } from 'antd';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
|
-
import { UTC_FORMAT } from '../constants';
|
|
6
|
-
import {
|
|
5
|
+
import { DATE_FORMAT, DATE_TIME_FORMAT, UTC_FORMAT } from '../constants';
|
|
6
|
+
import { RangePickerOnChangeType, RangePickerValueType, UTCRangePickerProps } from '../types';
|
|
7
7
|
|
|
8
8
|
const { RangePicker } = DatePicker;
|
|
9
9
|
|
|
@@ -12,16 +12,13 @@ const { RangePicker } = DatePicker;
|
|
|
12
12
|
*/
|
|
13
13
|
const UTCRangePicker = (props: UTCRangePickerProps) => {
|
|
14
14
|
// 设置mode后无法显示时间
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...reset
|
|
23
|
-
} = props;
|
|
24
|
-
const { timeZone, timeFormat, dateFormat } = window.__POWERED_BY_QIANKUN__ ? useModel("@@qiankunStateFromMaster") : useModel('user');
|
|
15
|
+
const { readonly, convertTimeZone, showTime = false, mode, endDateEndOfType, startDatStartOfType, ...reset } = props;
|
|
16
|
+
const { timeZone, timeFormat, dateFormat } = window.__POWERED_BY_QIANKUN__
|
|
17
|
+
? useModel('@@qiankunStateFromMaster')
|
|
18
|
+
: useModel('user');
|
|
19
|
+
|
|
20
|
+
// 如果不传convertTimeZone,则根据showTime判断是否转换时区,默认showTime为true转时区,false不转时区
|
|
21
|
+
const newConvertTimeZone = typeof convertTimeZone === 'boolean' ? convertTimeZone : showTime;
|
|
25
22
|
|
|
26
23
|
// 将日期转换为地区时间显示
|
|
27
24
|
const value: RangePickerValueType = useMemo(() => {
|
|
@@ -31,16 +28,16 @@ const UTCRangePicker = (props: UTCRangePickerProps) => {
|
|
|
31
28
|
|
|
32
29
|
const startTime = v[0] ? dayjs(v[0]) : undefined;
|
|
33
30
|
const endTime = v[1] ? dayjs(v[1]) : undefined;
|
|
34
|
-
return
|
|
31
|
+
return newConvertTimeZone
|
|
35
32
|
? [startTime ? startTime.tz(timeZone) : undefined, endTime ? endTime.tz(timeZone) : undefined]
|
|
36
33
|
: [startTime, endTime];
|
|
37
|
-
}, [props.value,
|
|
34
|
+
}, [props.value, newConvertTimeZone, timeZone]);
|
|
38
35
|
|
|
39
36
|
// 获取设置的格式
|
|
40
37
|
const format = useMemo(() => {
|
|
41
|
-
if(typeof showTime === 'object' && showTime.format
|
|
38
|
+
if (typeof showTime === 'object' && showTime.format) {
|
|
42
39
|
return `${dateFormat} ${showTime.format}`;
|
|
43
|
-
}
|
|
40
|
+
}
|
|
44
41
|
return props.format || showTime ? `${dateFormat} ${timeFormat}` : dateFormat;
|
|
45
42
|
}, [props.format, showTime, dateFormat, timeFormat]);
|
|
46
43
|
|
|
@@ -57,10 +54,12 @@ const UTCRangePicker = (props: UTCRangePickerProps) => {
|
|
|
57
54
|
const utcStartTime = startTime?.utc();
|
|
58
55
|
const utcEndTime = endTime?.utc();
|
|
59
56
|
|
|
57
|
+
const notConvertFormat = showTime ? DATE_TIME_FORMAT : DATE_FORMAT;
|
|
58
|
+
|
|
60
59
|
// 转标准时间,显示时间转换有问题
|
|
61
|
-
const standardTime: any =
|
|
60
|
+
const standardTime: any = newConvertTimeZone
|
|
62
61
|
? [utcStartTime?.format(UTC_FORMAT), utcEndTime?.format(UTC_FORMAT)]
|
|
63
|
-
: [startTime?.format(
|
|
62
|
+
: [startTime?.format(notConvertFormat), endTime?.format(notConvertFormat)];
|
|
64
63
|
const datesString: any = [startTime?.format(format), endTime?.format(format)];
|
|
65
64
|
|
|
66
65
|
props.onChange?.(standardTime, datesString);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const DatePickerTypes = "\n export type DateType = dayjs.Dayjs | string;\n export type HasNullUndefinedDateType = DateType | undefined | null;\n\n export interface UTCDatePickerProps extends DatePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\
|
|
1
|
+
export declare const DatePickerTypes = "\n export type DateType = dayjs.Dayjs | string;\n export type HasNullUndefinedDateType = DateType | undefined | null;\n\n export interface UTCDatePickerProps extends DatePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u5224\u65AD\u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u4E3Atrue\u8F6C\u65F6\u533A\uFF0Cfalse\u4E0D\u8F6C\u65F6\u533A\n */\n convertTimeZone?: boolean;\n /**\n * \u662F\u5426\u53EA\u8BFB\uFF0C\u9ED8\u8BA4false\n */\n readonly?: boolean;\n }\n\n type DatePickValueType = Pick<ProFormItemProps<import('antd').DatePickerProps>, 'fieldProps'>;\n\n export interface UTCProFormDatePickerProps extends ProFormItemProps<import('antd').DatePickerProps> {\n /**\n * DatePickerProps\n */\n fieldProps?: DatePickValueType['fieldProps'] & {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4true\n */\n convertTimeZone?: boolean;\n };\n /**\n * \u662F\u5426\u7981\u7528\uFF0C\u9ED8\u8BA4false\n */\n disabled?: boolean;\n }\n\n\n type RangePickerValueType = RangePickerProps['value'];\n export type RangePickerOnChangeType = RangePickerProps['onChange'];\n\n export type RangeDateType = [HasNullUndefinedDateType, HasNullUndefinedDateType];\n\n export interface UTCRangePickerProps extends RangePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u5224\u65AD\u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u4E3Atrue\u8F6C\u65F6\u533A\uFF0Cfalse\u4E0D\u8F6C\u65F6\u533A\n */\n convertTimeZone?: boolean;\n /**\n * \u662F\u5426\u53EA\u8BFB\uFF0C\u9ED8\u8BA4false\n */\n readonly?: boolean;\n /**\n * \u5F00\u59CB\u65E5\u671F\u7684startOf\u7C7B\u578B\n */\n startDatStartOfType?: OpUnitType;\n /**\n * \u7ED3\u675F\u65E5\u671F\u7684endOf\u7C7B\u578B\n */\n endDateEndOfType?: OpUnitType;\n }\n\n type RangePickValueType = Pick<ProFormItemProps<RangePickerProps>, 'fieldProps'>;\n\n export interface UTCProFormRangePickerProps extends ProFormItemProps<RangePickerProps> {\n /**\n * RangePickerProps\n */\n fieldProps?: RangePickValueType['fieldProps'] & {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4true\n */\n convertTimeZone?: boolean;\n };\n /**\n * \u662F\u5426\u7981\u7528\uFF0C\u9ED8\u8BA4false\n */\n disabled?: boolean;\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var DatePickerTypes = "\n export type DateType = dayjs.Dayjs | string;\n export type HasNullUndefinedDateType = DateType | undefined | null;\n\n export interface UTCDatePickerProps extends DatePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\
|
|
1
|
+
export var DatePickerTypes = "\n export type DateType = dayjs.Dayjs | string;\n export type HasNullUndefinedDateType = DateType | undefined | null;\n\n export interface UTCDatePickerProps extends DatePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u5224\u65AD\u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u4E3Atrue\u8F6C\u65F6\u533A\uFF0Cfalse\u4E0D\u8F6C\u65F6\u533A\n */\n convertTimeZone?: boolean;\n /**\n * \u662F\u5426\u53EA\u8BFB\uFF0C\u9ED8\u8BA4false\n */\n readonly?: boolean;\n }\n\n type DatePickValueType = Pick<ProFormItemProps<import('antd').DatePickerProps>, 'fieldProps'>;\n\n export interface UTCProFormDatePickerProps extends ProFormItemProps<import('antd').DatePickerProps> {\n /**\n * DatePickerProps\n */\n fieldProps?: DatePickValueType['fieldProps'] & {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4true\n */\n convertTimeZone?: boolean;\n };\n /**\n * \u662F\u5426\u7981\u7528\uFF0C\u9ED8\u8BA4false\n */\n disabled?: boolean;\n }\n\n\n type RangePickerValueType = RangePickerProps['value'];\n export type RangePickerOnChangeType = RangePickerProps['onChange'];\n\n export type RangeDateType = [HasNullUndefinedDateType, HasNullUndefinedDateType];\n\n export interface UTCRangePickerProps extends RangePickerProps {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u5224\u65AD\u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4showTime\u4E3Atrue\u8F6C\u65F6\u533A\uFF0Cfalse\u4E0D\u8F6C\u65F6\u533A\n */\n convertTimeZone?: boolean;\n /**\n * \u662F\u5426\u53EA\u8BFB\uFF0C\u9ED8\u8BA4false\n */\n readonly?: boolean;\n /**\n * \u5F00\u59CB\u65E5\u671F\u7684startOf\u7C7B\u578B\n */\n startDatStartOfType?: OpUnitType;\n /**\n * \u7ED3\u675F\u65E5\u671F\u7684endOf\u7C7B\u578B\n */\n endDateEndOfType?: OpUnitType;\n }\n\n type RangePickValueType = Pick<ProFormItemProps<RangePickerProps>, 'fieldProps'>;\n\n export interface UTCProFormRangePickerProps extends ProFormItemProps<RangePickerProps> {\n /**\n * RangePickerProps\n */\n fieldProps?: RangePickValueType['fieldProps'] & {\n /**\n * \u662F\u5426\u8F6C\u6362\u65F6\u533A\uFF0C\u9ED8\u8BA4true\n */\n convertTimeZone?: boolean;\n };\n /**\n * \u662F\u5426\u7981\u7528\uFF0C\u9ED8\u8BA4false\n */\n disabled?: boolean;\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MySelectTypes = "\n /** \u7EC4\u4EF6\u6620\u5C04\u5B57\u6BB5 */\n export type KeyNamesType<T> = {\n /** \u4E3B\u952E */\n id: keyof T;\n /** \u7F16\u7801 */\n code?: keyof T;\n /** \u540D\u79F0 */\n name: keyof T;\n };\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export interface MySelectProps<T> extends SelectProps {\n /** \u662F\u5426\u53EA\u8BFB */\n readonly?: boolean;\n /** \u5FC5\u987B\u8F93\u5165\u641C\u7D22\u6761\u4EF6 */\n mustSearch?: boolean;\n /** \u662F\u5426\u81EA\u52A8\u9009\u4E2D */\n autoSelect?: boolean;\n /** \u662F\u5426\u663E\u793A\u6240\u6709\u6570\u636E\uFF08\u4E0D\u5206\u9875\uFF09 */\n showAllList?: boolean;\n /** \u83B7\u53D6\u591A\u5C11\u6761\u6570\u636E\uFF0C\u9ED8\u8BA420 */\n pageSize?: number;\n /** \u672C\u5730\u5217\u8868\u6570\u636E */\n localListData?: T[];\n /** \u56DE\u663E\u6570\u636E\u5217\u8868 */\n backShowList?: T[];\n /** \u8BF7\u6C42\u5217\u8868\u6570\u636E */\n request: (searchKey?: { [key: string]: any }) => Promise<API.Result_Base_List<T[]>>;\n /** \u6E32\u67D3\u7684\u503C */\n keyNames: KeyNamesType<T>;\n /** \u641C\u7D22\u7684\u5B57\u6BB5 */\n searchKey?: keyof T;\n /** Select.Option\u7684value\u5B57\u6BB5 */\n selectKey?: keyof T;\n /** \u989D\u5916\u7684\u67E5\u8BE2\u6761\u4EF6 */\n otherSearchValue?: Record<string, any>;\n /** \u53EA\u663E\u793A\u540D\u79F0 */\n onlyShowName?: boolean;\n /** \u81EA\u5B9A\u4E49\u6E32\u67D3 */\n itemRender?: (list: T[]) => React.ReactNode;\n /** \u5185\u5BB9\u7C7B\u578B */\n valueType?: 'key' | 'object';\n /** \u5224\u65AD\u4E0B\u62C9\u6846\u7684\u663E\u793A */\n showDropdown?: boolean;\n /** \u83B7\u53D6\u5DF2\u9009\u62E9\u7684\u6570\u636E\u5217\u8868 */\n getSelectList?: (item: T[]) => void;\n /** \u6570\u636E\u4E0B\u62C9\u5217\u8868\u53D8\u5316\u56DE\u8C03 */\n dropDownListChange?: (list: T[]) => void;\n }\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export type MySelectListProps<T> = Partial<MySelectProps<T>>;\n";
|
|
1
|
+
export declare const MySelectTypes = "\n /** \u7EC4\u4EF6\u6620\u5C04\u5B57\u6BB5 */\n export type KeyNamesType<T> = {\n /** \u4E3B\u952E */\n id: keyof T;\n /** \u7F16\u7801 */\n code?: keyof T;\n /** \u540D\u79F0 */\n name: keyof T;\n };\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export interface MySelectProps<T> extends SelectProps {\n /** \u662F\u5426\u53EA\u8BFB */\n readonly?: boolean;\n /** \u5FC5\u987B\u8F93\u5165\u641C\u7D22\u6761\u4EF6 */\n mustSearch?: boolean;\n /** \u641C\u7D22\u5EF6\u8FDF\u65F6\u95F4 */\n searchDelay?: number;\n /** \u662F\u5426\u81EA\u52A8\u9009\u4E2D */\n autoSelect?: boolean;\n /** \u662F\u5426\u663E\u793A\u6240\u6709\u6570\u636E\uFF08\u4E0D\u5206\u9875\uFF09 */\n showAllList?: boolean;\n /** \u83B7\u53D6\u591A\u5C11\u6761\u6570\u636E\uFF0C\u9ED8\u8BA420 */\n pageSize?: number;\n /** \u672C\u5730\u5217\u8868\u6570\u636E */\n localListData?: T[];\n /** \u56DE\u663E\u6570\u636E\u5217\u8868 */\n backShowList?: T[];\n /** \u8BF7\u6C42\u5217\u8868\u6570\u636E */\n request: (searchKey?: { [key: string]: any }) => Promise<API.Result_Base_List<T[]>>;\n /** \u6E32\u67D3\u7684\u503C */\n keyNames: KeyNamesType<T>;\n /** \u641C\u7D22\u7684\u5B57\u6BB5 */\n searchKey?: keyof T;\n /** Select.Option\u7684value\u5B57\u6BB5 */\n selectKey?: keyof T;\n /** \u989D\u5916\u7684\u67E5\u8BE2\u6761\u4EF6 */\n otherSearchValue?: Record<string, any>;\n /** \u53EA\u663E\u793A\u540D\u79F0 */\n onlyShowName?: boolean;\n /** \u81EA\u5B9A\u4E49\u6E32\u67D3 */\n itemRender?: (list: T[]) => React.ReactNode;\n /** \u5185\u5BB9\u7C7B\u578B */\n valueType?: 'key' | 'object';\n /** \u5224\u65AD\u4E0B\u62C9\u6846\u7684\u663E\u793A */\n showDropdown?: boolean;\n /** \u83B7\u53D6\u5DF2\u9009\u62E9\u7684\u6570\u636E\u5217\u8868 */\n getSelectList?: (item: T[]) => void;\n /** \u6570\u636E\u4E0B\u62C9\u5217\u8868\u53D8\u5316\u56DE\u8C03 */\n dropDownListChange?: (list: T[]) => void;\n }\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export type MySelectListProps<T> = Partial<MySelectProps<T>>;\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var MySelectTypes = "\n /** \u7EC4\u4EF6\u6620\u5C04\u5B57\u6BB5 */\n export type KeyNamesType<T> = {\n /** \u4E3B\u952E */\n id: keyof T;\n /** \u7F16\u7801 */\n code?: keyof T;\n /** \u540D\u79F0 */\n name: keyof T;\n };\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export interface MySelectProps<T> extends SelectProps {\n /** \u662F\u5426\u53EA\u8BFB */\n readonly?: boolean;\n /** \u5FC5\u987B\u8F93\u5165\u641C\u7D22\u6761\u4EF6 */\n mustSearch?: boolean;\n /** \u662F\u5426\u81EA\u52A8\u9009\u4E2D */\n autoSelect?: boolean;\n /** \u662F\u5426\u663E\u793A\u6240\u6709\u6570\u636E\uFF08\u4E0D\u5206\u9875\uFF09 */\n showAllList?: boolean;\n /** \u83B7\u53D6\u591A\u5C11\u6761\u6570\u636E\uFF0C\u9ED8\u8BA420 */\n pageSize?: number;\n /** \u672C\u5730\u5217\u8868\u6570\u636E */\n localListData?: T[];\n /** \u56DE\u663E\u6570\u636E\u5217\u8868 */\n backShowList?: T[];\n /** \u8BF7\u6C42\u5217\u8868\u6570\u636E */\n request: (searchKey?: { [key: string]: any }) => Promise<API.Result_Base_List<T[]>>;\n /** \u6E32\u67D3\u7684\u503C */\n keyNames: KeyNamesType<T>;\n /** \u641C\u7D22\u7684\u5B57\u6BB5 */\n searchKey?: keyof T;\n /** Select.Option\u7684value\u5B57\u6BB5 */\n selectKey?: keyof T;\n /** \u989D\u5916\u7684\u67E5\u8BE2\u6761\u4EF6 */\n otherSearchValue?: Record<string, any>;\n /** \u53EA\u663E\u793A\u540D\u79F0 */\n onlyShowName?: boolean;\n /** \u81EA\u5B9A\u4E49\u6E32\u67D3 */\n itemRender?: (list: T[]) => React.ReactNode;\n /** \u5185\u5BB9\u7C7B\u578B */\n valueType?: 'key' | 'object';\n /** \u5224\u65AD\u4E0B\u62C9\u6846\u7684\u663E\u793A */\n showDropdown?: boolean;\n /** \u83B7\u53D6\u5DF2\u9009\u62E9\u7684\u6570\u636E\u5217\u8868 */\n getSelectList?: (item: T[]) => void;\n /** \u6570\u636E\u4E0B\u62C9\u5217\u8868\u53D8\u5316\u56DE\u8C03 */\n dropDownListChange?: (list: T[]) => void;\n }\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export type MySelectListProps<T> = Partial<MySelectProps<T>>;\n";
|
|
1
|
+
export var MySelectTypes = "\n /** \u7EC4\u4EF6\u6620\u5C04\u5B57\u6BB5 */\n export type KeyNamesType<T> = {\n /** \u4E3B\u952E */\n id: keyof T;\n /** \u7F16\u7801 */\n code?: keyof T;\n /** \u540D\u79F0 */\n name: keyof T;\n };\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export interface MySelectProps<T> extends SelectProps {\n /** \u662F\u5426\u53EA\u8BFB */\n readonly?: boolean;\n /** \u5FC5\u987B\u8F93\u5165\u641C\u7D22\u6761\u4EF6 */\n mustSearch?: boolean;\n /** \u641C\u7D22\u5EF6\u8FDF\u65F6\u95F4 */\n searchDelay?: number;\n /** \u662F\u5426\u81EA\u52A8\u9009\u4E2D */\n autoSelect?: boolean;\n /** \u662F\u5426\u663E\u793A\u6240\u6709\u6570\u636E\uFF08\u4E0D\u5206\u9875\uFF09 */\n showAllList?: boolean;\n /** \u83B7\u53D6\u591A\u5C11\u6761\u6570\u636E\uFF0C\u9ED8\u8BA420 */\n pageSize?: number;\n /** \u672C\u5730\u5217\u8868\u6570\u636E */\n localListData?: T[];\n /** \u56DE\u663E\u6570\u636E\u5217\u8868 */\n backShowList?: T[];\n /** \u8BF7\u6C42\u5217\u8868\u6570\u636E */\n request: (searchKey?: { [key: string]: any }) => Promise<API.Result_Base_List<T[]>>;\n /** \u6E32\u67D3\u7684\u503C */\n keyNames: KeyNamesType<T>;\n /** \u641C\u7D22\u7684\u5B57\u6BB5 */\n searchKey?: keyof T;\n /** Select.Option\u7684value\u5B57\u6BB5 */\n selectKey?: keyof T;\n /** \u989D\u5916\u7684\u67E5\u8BE2\u6761\u4EF6 */\n otherSearchValue?: Record<string, any>;\n /** \u53EA\u663E\u793A\u540D\u79F0 */\n onlyShowName?: boolean;\n /** \u81EA\u5B9A\u4E49\u6E32\u67D3 */\n itemRender?: (list: T[]) => React.ReactNode;\n /** \u5185\u5BB9\u7C7B\u578B */\n valueType?: 'key' | 'object';\n /** \u5224\u65AD\u4E0B\u62C9\u6846\u7684\u663E\u793A */\n showDropdown?: boolean;\n /** \u83B7\u53D6\u5DF2\u9009\u62E9\u7684\u6570\u636E\u5217\u8868 */\n getSelectList?: (item: T[]) => void;\n /** \u6570\u636E\u4E0B\u62C9\u5217\u8868\u53D8\u5316\u56DE\u8C03 */\n dropDownListChange?: (list: T[]) => void;\n }\n\n /** \u7EC4\u4EF6Select\u7684\u53C2\u6570 */\n export type MySelectListProps<T> = Partial<MySelectProps<T>>;\n";
|
|
@@ -2,6 +2,6 @@ export default (function (api) {
|
|
|
2
2
|
var _api$userConfig$defin, _api$userConfig$defin2, _api$userConfig$defin3, _api$userConfig$defin4;
|
|
3
3
|
return {
|
|
4
4
|
path: "constants.ts",
|
|
5
|
-
content: "\n export const UTC_FORMAT = 'YYYY-MM-DDTHH:mm:ss[Z]';\n\n export const BASE_API = '/api';\n\n export const BACKEND_API_URL = '".concat((_api$userConfig$defin = (_api$userConfig$defin2 = api.userConfig.define) === null || _api$userConfig$defin2 === void 0 ? void 0 : _api$userConfig$defin2.BACKEND_API_URL) !== null && _api$userConfig$defin !== void 0 ? _api$userConfig$defin : undefined, "';\n\n export const FILE_VIEWER_URL = '").concat((_api$userConfig$defin3 = (_api$userConfig$defin4 = api.userConfig.define) === null || _api$userConfig$defin4 === void 0 ? void 0 : _api$userConfig$defin4.FILE_VIEWER_URL) !== null && _api$userConfig$defin3 !== void 0 ? _api$userConfig$defin3 : undefined, "';\n ")
|
|
5
|
+
content: "\n export const UTC_FORMAT = 'YYYY-MM-DDTHH:mm:ss[Z]';\n export const DATE_FORMAT = 'YYYY-MM-DD';\n export const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';\n export const TIME_FORMAT = 'HH:mm:ss';\n\n export const BASE_API = '/api';\n\n export const BACKEND_API_URL = '".concat((_api$userConfig$defin = (_api$userConfig$defin2 = api.userConfig.define) === null || _api$userConfig$defin2 === void 0 ? void 0 : _api$userConfig$defin2.BACKEND_API_URL) !== null && _api$userConfig$defin !== void 0 ? _api$userConfig$defin : undefined, "';\n\n export const FILE_VIEWER_URL = '").concat((_api$userConfig$defin3 = (_api$userConfig$defin4 = api.userConfig.define) === null || _api$userConfig$defin4 === void 0 ? void 0 : _api$userConfig$defin4.FILE_VIEWER_URL) !== null && _api$userConfig$defin3 !== void 0 ? _api$userConfig$defin3 : undefined, "';\n ")
|
|
6
6
|
};
|
|
7
7
|
});
|