@zat-design/sisyphus-react 3.3.0-beta.1 → 3.3.0-beta.11
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/index.esm.css +7 -0
- package/es/ProEditTable/index.js +4 -3
- package/es/ProEnum/index.js +7 -18
- package/es/ProEnum/propsType.d.ts +1 -0
- package/es/ProForm/components/base/DatePicker/index.d.ts +2 -2
- package/es/ProForm/components/base/DatePicker/index.js +5 -5
- package/es/ProForm/components/base/RangePicker/index.d.ts +3 -2
- package/es/ProForm/components/base/RangePicker/index.js +3 -5
- package/es/ProForm/components/base/TimePicker/index.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/index.js +0 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
- package/es/ProForm/components/combination/ProRangeLimit/index.js +6 -6
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +2 -2
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +2 -2
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +2 -2
- package/es/ProForm/components/combination/ProTimeLimit/index.js +4 -4
- package/es/ProForm/components/old/ProCertValidity/index.js +16 -16
- package/es/ProForm/components/old/ProCertValidity/propsType.d.ts +4 -4
- package/es/ProForm/components/render/Render.js +14 -23
- package/es/ProForm/components/render/RenderFields.js +7 -3
- package/es/ProForm/utils/rulesCreator.js +2 -1
- package/es/ProForm/utils/useRules.js +6 -5
- package/es/ProLayout/components/ProHeader/index.js +4 -4
- package/es/ProTable/style/index.less +6 -6
- package/es/ProTable/utils.js +14 -14
- package/es/ProTreeModal/style/index.less +85 -84
- package/es/ProUpload/components/ImageRender.js +4 -5
- package/es/locale/index.js +2 -2
- package/es/old/ProCertValidity/index.js +16 -16
- package/es/old/ProCertValidity/propsType.d.ts +4 -4
- package/es/old/ProEditableTable/utils.d.ts +5 -5
- package/es/old/ProEditableTable/utils.js +5 -5
- package/lib/ProEditTable/index.js +4 -3
- package/lib/ProEnum/index.js +6 -17
- package/lib/ProEnum/propsType.d.ts +1 -0
- package/lib/ProForm/components/base/DatePicker/index.d.ts +2 -2
- package/lib/ProForm/components/base/DatePicker/index.js +5 -5
- package/lib/ProForm/components/base/RangePicker/index.d.ts +3 -2
- package/lib/ProForm/components/base/RangePicker/index.js +4 -4
- package/lib/ProForm/components/base/TimePicker/index.js +3 -3
- package/lib/ProForm/components/combination/ProModalSelect/index.js +0 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +6 -6
- package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +2 -2
- package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +2 -2
- package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +2 -2
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +4 -4
- package/lib/ProForm/components/old/ProCertValidity/index.js +16 -16
- package/lib/ProForm/components/old/ProCertValidity/propsType.d.ts +4 -4
- package/lib/ProForm/components/render/Render.js +14 -23
- package/lib/ProForm/components/render/RenderFields.js +6 -2
- package/lib/ProForm/utils/rulesCreator.js +2 -1
- package/lib/ProForm/utils/useRules.js +5 -4
- package/lib/ProLayout/components/ProHeader/index.js +4 -4
- package/lib/ProTable/style/index.less +6 -6
- package/lib/ProTable/utils.js +14 -14
- package/lib/ProTreeModal/style/index.less +85 -84
- package/lib/ProUpload/components/ImageRender.js +4 -5
- package/lib/locale/index.js +2 -2
- package/lib/old/ProCertValidity/index.js +16 -16
- package/lib/old/ProCertValidity/propsType.d.ts +4 -4
- package/lib/old/ProEditableTable/utils.d.ts +5 -5
- package/lib/old/ProEditableTable/utils.js +5 -5
- package/package.json +3 -2
package/dist/index.esm.css
CHANGED
|
@@ -1629,6 +1629,12 @@
|
|
|
1629
1629
|
.pro-table .ant-table-tbody .ant-table-cell-fix-right {
|
|
1630
1630
|
background: unset !important;
|
|
1631
1631
|
}
|
|
1632
|
+
.pro-table .ant-table-body .ant-table-tbody .ant-table-row:nth-child(odd).new-cell {
|
|
1633
|
+
background: #d2fff4 !important;
|
|
1634
|
+
}
|
|
1635
|
+
.pro-table .ant-table-body .ant-table-tbody .ant-table-row:nth-child(odd).new-cell td {
|
|
1636
|
+
background: #d2fff4 !important;
|
|
1637
|
+
}
|
|
1632
1638
|
.pro-table .ant-table-body .ant-table-cell .varied-cell {
|
|
1633
1639
|
margin-left: -8px;
|
|
1634
1640
|
background: var(--zaui-contract-bg, #fffaa1);
|
|
@@ -3324,6 +3330,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3324
3330
|
}
|
|
3325
3331
|
.pro-tree-modal-checkbox-close {
|
|
3326
3332
|
padding-left: var(--zaui-space-size-sm, 8px);
|
|
3333
|
+
color: #c5c7cd;
|
|
3327
3334
|
font-size: var(--zaui-font-size-sm, 12px);
|
|
3328
3335
|
}
|
|
3329
3336
|
.pro-tree-modal-tree-node {
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -101,7 +101,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
101
101
|
var getRowKey = function getRowKey(record) {
|
|
102
102
|
var key = record.rowKey || getRandom();
|
|
103
103
|
if (rowKey) {
|
|
104
|
-
|
|
104
|
+
var _ref2;
|
|
105
|
+
key = (_ref2 = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref2 !== void 0 ? _ref2 : key;
|
|
105
106
|
}
|
|
106
107
|
return key;
|
|
107
108
|
};
|
|
@@ -212,7 +213,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
212
213
|
return isForbiddenBtn('mulDelete') ? rowSelection : _rowSelection;
|
|
213
214
|
};
|
|
214
215
|
var setColumns = /*#__PURE__*/function () {
|
|
215
|
-
var
|
|
216
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
216
217
|
var nextColumns;
|
|
217
218
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
218
219
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -231,7 +232,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
231
232
|
}, _callee);
|
|
232
233
|
}));
|
|
233
234
|
return function setColumns() {
|
|
234
|
-
return
|
|
235
|
+
return _ref3.apply(this, arguments);
|
|
235
236
|
};
|
|
236
237
|
}();
|
|
237
238
|
useDebounceEffect(function () {
|
package/es/ProEnum/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component
|
|
|
16
16
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
17
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
|
18
18
|
import React, { useState, useEffect, useMemo } from 'react';
|
|
19
|
-
import { cloneDeep, isFunction, isString, isArray } from 'lodash';
|
|
19
|
+
import { cloneDeep, isFunction, isString, isArray, omit } from 'lodash';
|
|
20
20
|
import ProSelect from '../ProSelect';
|
|
21
21
|
import { useProConfig } from '../ProConfigProvider';
|
|
22
22
|
import ProEnumTag from './components/Tag';
|
|
@@ -79,7 +79,6 @@ var ProEnum = function ProEnum(props) {
|
|
|
79
79
|
var _useProConfig = useProConfig('ProEnum'),
|
|
80
80
|
_useProConfig$dics = _useProConfig.dics,
|
|
81
81
|
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
|
82
|
-
// const enumList = dics?.[code] || [];
|
|
83
82
|
var _useRequestFunc = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
|
|
84
83
|
manual: true,
|
|
85
84
|
cacheTime: -1
|
|
@@ -173,26 +172,16 @@ var ProEnum = function ProEnum(props) {
|
|
|
173
172
|
onChange: onChange
|
|
174
173
|
}));
|
|
175
174
|
case 'Radio':
|
|
176
|
-
return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, enumProps), {}, {
|
|
175
|
+
return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
|
|
176
|
+
options: list,
|
|
177
177
|
value: value,
|
|
178
|
-
onChange: onChange
|
|
179
|
-
children: list.map(function (item) {
|
|
180
|
-
return _jsx(_Radio, {
|
|
181
|
-
value: item[fieldValue],
|
|
182
|
-
children: item[label]
|
|
183
|
-
}, item[fieldValue]);
|
|
184
|
-
})
|
|
178
|
+
onChange: onChange
|
|
185
179
|
}));
|
|
186
180
|
case 'Checkbox':
|
|
187
|
-
return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, enumProps), {}, {
|
|
181
|
+
return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
|
|
182
|
+
options: list,
|
|
188
183
|
value: value,
|
|
189
|
-
onChange: onChange
|
|
190
|
-
children: list.map(function (item) {
|
|
191
|
-
return _jsx(_Checkbox, {
|
|
192
|
-
value: item[fieldValue],
|
|
193
|
-
children: item[label]
|
|
194
|
-
}, item[fieldValue]);
|
|
195
|
-
})
|
|
184
|
+
onChange: onChange
|
|
196
185
|
}));
|
|
197
186
|
case 'Tag':
|
|
198
187
|
return _jsx(ProEnumTag, {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DatePickerProps, TimePickerProps } from 'antd';
|
|
2
|
-
import {
|
|
2
|
+
import { Dayjs } from 'dayjs';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { PickerPanelDateProps } from 'antd/lib/calendar/generateCalendar';
|
|
5
5
|
export type Props = DatePickerProps & TimePickerProps & {
|
|
6
6
|
isView?: boolean;
|
|
7
7
|
viewEmpty?: React.ReactNode;
|
|
8
8
|
format?: string;
|
|
9
|
-
showTime?: PickerPanelDateProps<
|
|
9
|
+
showTime?: PickerPanelDateProps<Dayjs>['showTime'];
|
|
10
10
|
showNow?: boolean;
|
|
11
11
|
};
|
|
12
12
|
declare const DatePicker: React.FC<Props>;
|
|
@@ -7,7 +7,7 @@ var _excluded = ["className", "format"];
|
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { isFunction, isString } from 'lodash';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
|
-
import
|
|
10
|
+
import dayjs from 'dayjs';
|
|
11
11
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
12
12
|
import ProForm from '../../../../ProForm';
|
|
13
13
|
import Container from '../../Container';
|
|
@@ -30,12 +30,12 @@ var DatePicker = function DatePicker(props) {
|
|
|
30
30
|
var viewChildren = null;
|
|
31
31
|
if (!value) {
|
|
32
32
|
viewChildren = null;
|
|
33
|
-
} else if (typeof format === 'string' &&
|
|
33
|
+
} else if (typeof format === 'string' && dayjs.isDayjs(value)) {
|
|
34
34
|
viewChildren = value.format(format);
|
|
35
35
|
} else if (isFunction(format)) {
|
|
36
36
|
viewChildren = format(value);
|
|
37
37
|
} else if (isString(value)) {
|
|
38
|
-
viewChildren =
|
|
38
|
+
viewChildren = dayjs(value).format(format);
|
|
39
39
|
}
|
|
40
40
|
return _jsx(Container, {
|
|
41
41
|
viewEmpty: viewEmpty,
|
|
@@ -48,11 +48,11 @@ var DatePicker = function DatePicker(props) {
|
|
|
48
48
|
});
|
|
49
49
|
// 字符串时间格式兼容
|
|
50
50
|
if (isString(_rest.value)) {
|
|
51
|
-
_rest.value =
|
|
51
|
+
_rest.value = dayjs(_rest.value);
|
|
52
52
|
}
|
|
53
53
|
if (['dateStartTime', 'dateEndTime'].includes(valueType) && rest.showTime === undefined) {
|
|
54
54
|
_rest.showTime = {
|
|
55
|
-
value:
|
|
55
|
+
value: dayjs(valueType === 'dateStartTime' ? '00:00:00' : '23:59:59', 'HH:mm:ss'),
|
|
56
56
|
disabled: true
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { RangePickerProps } from 'antd/es/date-picker';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import { Dayjs } from 'dayjs';
|
|
3
|
+
import { RangePickerProps } from 'antd/lib/date-picker/generatePicker';
|
|
3
4
|
import { ProFormOtherProps } from '../../../propsType';
|
|
4
5
|
export type Props = {
|
|
5
6
|
otherProps?: ProFormOtherProps;
|
|
6
7
|
separator?: any;
|
|
7
8
|
showTime?: any;
|
|
8
9
|
isView?: boolean;
|
|
9
|
-
} & Omit<RangePickerProps
|
|
10
|
+
} & Omit<RangePickerProps<Dayjs>, 'separator'>;
|
|
10
11
|
declare const RangePicker: React.FC<Props>;
|
|
11
12
|
export default RangePicker;
|
|
@@ -4,10 +4,8 @@ import "antd/es/date-picker/style";
|
|
|
4
4
|
import _DatePicker from "antd/es/date-picker";
|
|
5
5
|
var _excluded = ["format", "otherProps", "separator"];
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
// @ts-check
|
|
8
|
-
|
|
9
7
|
import { isFunction, isString, omit } from 'lodash';
|
|
10
|
-
import
|
|
8
|
+
import dayjs from 'dayjs';
|
|
11
9
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
12
10
|
import ProForm from '../../../../ProForm';
|
|
13
11
|
import Container from '../../Container';
|
|
@@ -52,9 +50,9 @@ var RangePicker = function RangePicker(props) {
|
|
|
52
50
|
var _res = _objectSpread(_objectSpread({}, rest), {}, {
|
|
53
51
|
showTime: !rest.showTime && valueType === 'dateTime' || rest.showTime
|
|
54
52
|
});
|
|
55
|
-
// 字符串时间格式兼容
|
|
53
|
+
// // 字符串时间格式兼容
|
|
56
54
|
if (Array.isArray(_res.value) && isString(_res.value[0]) && isString(_res.value[1])) {
|
|
57
|
-
_res.value = [
|
|
55
|
+
_res.value = [dayjs(_res.value[0]), dayjs(_res.value[1])];
|
|
58
56
|
}
|
|
59
57
|
return _jsx(AntRangePicker, _objectSpread(_objectSpread({}, initialConfig), omit(_res, ['separator'])));
|
|
60
58
|
};
|
|
@@ -4,7 +4,7 @@ import _TimePicker from "antd/es/time-picker";
|
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["format", "onChange", "value", "otherProps"];
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
8
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
9
9
|
import Container from '../../Container';
|
|
10
10
|
import ProForm from '../../../../ProForm';
|
|
@@ -25,7 +25,7 @@ var TimePicker = function TimePicker(props) {
|
|
|
25
25
|
var initialConfig = useProConfig('AntTimePicker');
|
|
26
26
|
var handleChange = function handleChange(value) {
|
|
27
27
|
if (valueType === 'dateTime') {
|
|
28
|
-
onChange && onChange(value ?
|
|
28
|
+
onChange && onChange(value ? dayjs(value).format(format) : undefined);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
if (isView) {
|
|
@@ -35,7 +35,7 @@ var TimePicker = function TimePicker(props) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
return _jsx(_TimePicker, _objectSpread(_objectSpread(_objectSpread({
|
|
38
|
-
value: value ?
|
|
38
|
+
value: value ? dayjs(value, format) : undefined
|
|
39
39
|
}, initialConfig), rest), {}, {
|
|
40
40
|
format: format,
|
|
41
41
|
onChange: handleChange
|
|
@@ -651,7 +651,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
651
651
|
onChange: handleChangeValue,
|
|
652
652
|
disabled: disabled,
|
|
653
653
|
addonAfter: forceAddonAfterRender(),
|
|
654
|
-
placeholder: locale.ProModalSelect.select,
|
|
655
654
|
autoComplete: "off"
|
|
656
655
|
}, restInputProps)), _jsx(_Input, {
|
|
657
656
|
type: "hidden",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RangePickerProps } from 'antd/es/date-picker';
|
|
3
|
-
import {
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
4
4
|
export type Props = Omit<RangePickerProps, 'value' | 'onChange' | 'format' | 'separator' | 'mode'> & {
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
foreverText?: string;
|
|
@@ -12,7 +12,7 @@ export type Props = Omit<RangePickerProps, 'value' | 'onChange' | 'format' | 'se
|
|
|
12
12
|
separator?: any;
|
|
13
13
|
isView?: boolean;
|
|
14
14
|
};
|
|
15
|
-
type Value = [
|
|
15
|
+
type Value = [Dayjs?, Dayjs?, boolean?];
|
|
16
16
|
type ValueStr = [string?, string?, string?];
|
|
17
17
|
type HandleChange = (value: ValueStr | null, valueStr: Value | null) => void;
|
|
18
18
|
declare const ProRangeLimit: React.FC<Props>;
|
|
@@ -12,12 +12,12 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
12
12
|
import { useMemo, useState } from 'react';
|
|
13
13
|
import { omit } from 'lodash';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
|
-
import
|
|
15
|
+
import dayjs from 'dayjs';
|
|
16
16
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
17
17
|
import Container from '../../Container';
|
|
18
18
|
import locale from '../../../../locale';
|
|
19
19
|
import ProForm from '../../../../ProForm';
|
|
20
|
-
var defaultPickerValue = [
|
|
20
|
+
var defaultPickerValue = [dayjs(), dayjs()];
|
|
21
21
|
var useControlled = function useControlled(props) {
|
|
22
22
|
var _useState = useState(),
|
|
23
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -25,7 +25,7 @@ var useControlled = function useControlled(props) {
|
|
|
25
25
|
setValue = _useState2[1];
|
|
26
26
|
if ('value' in props) {
|
|
27
27
|
var _props$value, _props$value2;
|
|
28
|
-
var internalValue = [((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value[0]) &&
|
|
28
|
+
var internalValue = [((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value[0]) && dayjs(props.value[0], props.format), ((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2[1]) && dayjs(props.value[1], props.format)];
|
|
29
29
|
var handleChange = function handleChange(value, other) {
|
|
30
30
|
var _value = _slicedToArray(value, 2),
|
|
31
31
|
start = _value[0],
|
|
@@ -74,10 +74,10 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
74
74
|
'forever-checkbox': true
|
|
75
75
|
});
|
|
76
76
|
var _isForever = useMemo(function () {
|
|
77
|
-
return
|
|
77
|
+
return dayjs(foreverDate, format).isSame(endDate);
|
|
78
78
|
}, [value]);
|
|
79
79
|
var foreverMoment = useMemo(function () {
|
|
80
|
-
return
|
|
80
|
+
return dayjs(foreverDate, format);
|
|
81
81
|
}, [foreverDate, format]);
|
|
82
82
|
if (isView) {
|
|
83
83
|
var _props$value3, _props$value4;
|
|
@@ -115,7 +115,7 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
115
115
|
start = _ref9[0],
|
|
116
116
|
end = _ref9[1];
|
|
117
117
|
if (e.target.checked) {
|
|
118
|
-
start = start ||
|
|
118
|
+
start = start || dayjs().startOf('day');
|
|
119
119
|
end = foreverMoment;
|
|
120
120
|
} else {
|
|
121
121
|
start = undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
2
2
|
interface Props<T = any> {
|
|
3
3
|
value?: T;
|
|
4
4
|
onChange?: (value: T, ...rest: any[]) => void;
|
|
5
5
|
format?: string;
|
|
6
6
|
}
|
|
7
|
-
declare const useControlled: (props: Props) => [
|
|
7
|
+
declare const useControlled: (props: Props) => [dayjs.Dayjs, (value: Dayjs | undefined) => void];
|
|
8
8
|
export default useControlled;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
var useControlled = function useControlled(props) {
|
|
5
5
|
var value = props.value,
|
|
@@ -18,7 +18,7 @@ var useControlled = function useControlled(props) {
|
|
|
18
18
|
onChange(_value, value);
|
|
19
19
|
};
|
|
20
20
|
if ('value' in props) {
|
|
21
|
-
return [value &&
|
|
21
|
+
return [value && dayjs(value, format).startOf('day'), handleChange];
|
|
22
22
|
}
|
|
23
23
|
return [valueState, handleChange];
|
|
24
24
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DatePickerProps } from 'antd';
|
|
2
|
-
import {
|
|
2
|
+
import { Dayjs } from 'dayjs';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ProFormOtherProps } from '../../../propsType';
|
|
5
5
|
import { Props as ProRangeLimitProps } from '../ProRangeLimit';
|
|
6
6
|
export type DateType = DatePickerProps['value'];
|
|
7
7
|
export type ProTimeLimitProps = DistributiveOmit<DatePickerProps, 'value' | 'onChange' | 'mode'> & {
|
|
8
8
|
value?: string;
|
|
9
|
-
onChange?: (value: ProTimeLimitProps['value'] | null, valueData:
|
|
9
|
+
onChange?: (value: ProTimeLimitProps['value'] | null, valueData: Dayjs) => void;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
foreverTime?: string;
|
|
12
12
|
foreverText?: string;
|
|
@@ -12,7 +12,7 @@ var _excluded = ["format", "disabled", "foreverTime", "foreverText", "valueType"
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { omit } from 'lodash';
|
|
15
|
-
import
|
|
15
|
+
import dayjs, { isDayjs } from 'dayjs';
|
|
16
16
|
import { useMemo } from 'react';
|
|
17
17
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
18
18
|
import Container from '../../Container';
|
|
@@ -37,7 +37,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
37
37
|
viewEmpty = _ref.viewEmpty;
|
|
38
38
|
var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
|
|
39
39
|
var _useMemo = useMemo(function () {
|
|
40
|
-
var foreverMoment = foreverTime ?
|
|
40
|
+
var foreverMoment = foreverTime ? dayjs(foreverTime, format) : dayjs('9999-01-01', 'YYYY-MM-DD');
|
|
41
41
|
var foreverString = foreverTime || foreverMoment.format(format);
|
|
42
42
|
return [foreverString, foreverMoment];
|
|
43
43
|
}, [format, foreverTime]),
|
|
@@ -53,7 +53,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
53
53
|
onChange = _useControlled2[1];
|
|
54
54
|
var initialConfig = useProConfig('ProTimeLimit');
|
|
55
55
|
var isForever = useMemo(function () {
|
|
56
|
-
if (
|
|
56
|
+
if (isDayjs(value)) {
|
|
57
57
|
return foreverMoment.format(format) === value.format(format);
|
|
58
58
|
}
|
|
59
59
|
return false;
|
|
@@ -61,7 +61,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
61
61
|
var foreverChange = function foreverChange(e) {
|
|
62
62
|
var checkedForever = e.target.checked;
|
|
63
63
|
if (checkedForever) {
|
|
64
|
-
onChange(
|
|
64
|
+
onChange(dayjs(foreverString, format));
|
|
65
65
|
} else {
|
|
66
66
|
onChange(null);
|
|
67
67
|
}
|
|
@@ -10,7 +10,7 @@ var _excluded = ["value", "onChange", "disabled", "isRange", "getPopupContainer"
|
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
// @ts-nocheck
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import dayjs from 'dayjs';
|
|
14
14
|
import { forwardRef, useMemo, useRef } from 'react';
|
|
15
15
|
var RangePicker = _DatePicker.RangePicker;
|
|
16
16
|
var defaultFormatDate = 'YYYY-MM-DD';
|
|
@@ -50,37 +50,37 @@ export var ProCertValidity = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
50
50
|
forever = _value2.forever;
|
|
51
51
|
if (forever === 'Y') {
|
|
52
52
|
return {
|
|
53
|
-
range: [
|
|
53
|
+
range: [dayjs('9999-01-01'), dayjs('9999-01-01')],
|
|
54
54
|
forever: true
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
if (startTime && endTime) {
|
|
58
|
-
var tempStartDate =
|
|
59
|
-
var tempEndDate =
|
|
58
|
+
var tempStartDate = dayjs(startTime).format(defaultFormatDate);
|
|
59
|
+
var tempEndDate = dayjs(endTime).format(defaultFormatDate);
|
|
60
60
|
if ((!forever || forever === 'N') && !checkIsForever(tempStartDate) && !checkIsForever(tempEndDate)) {
|
|
61
61
|
return {
|
|
62
|
-
range: [
|
|
62
|
+
range: [dayjs(startTime), dayjs(endTime)],
|
|
63
63
|
forever: false
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
if (checkIsForever(tempStartDate) && checkIsForever(tempEndDate) && !isChange.current) {
|
|
67
67
|
return {
|
|
68
|
-
range: [
|
|
68
|
+
range: [dayjs('9999-01-01'), dayjs('9999-01-01')],
|
|
69
69
|
forever: true
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
} else {
|
|
74
74
|
if (typeof value === 'string' || value._isAMomentObject) {
|
|
75
|
-
var tempDate =
|
|
75
|
+
var tempDate = dayjs(value).format(defaultFormatDate);
|
|
76
76
|
if (tempDate && tempDate === '9999-01-01') {
|
|
77
77
|
return {
|
|
78
|
-
range:
|
|
78
|
+
range: dayjs('9999-01-01'),
|
|
79
79
|
forever: true
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
return {
|
|
83
|
-
range:
|
|
83
|
+
range: dayjs(value),
|
|
84
84
|
forever: false
|
|
85
85
|
};
|
|
86
86
|
}
|
|
@@ -89,21 +89,21 @@ export var ProCertValidity = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
89
89
|
_forever = _value3.forever;
|
|
90
90
|
if (_forever === 'Y') {
|
|
91
91
|
return {
|
|
92
|
-
range:
|
|
92
|
+
range: dayjs('9999-01-01'),
|
|
93
93
|
forever: true
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
if (dateTime) {
|
|
97
|
-
var _tempDate =
|
|
97
|
+
var _tempDate = dayjs(dateTime).format(defaultFormatDate);
|
|
98
98
|
if ((!_forever || _forever === 'N') && _tempDate !== '9999-01-01') {
|
|
99
99
|
return {
|
|
100
|
-
range:
|
|
100
|
+
range: dayjs(dateTime),
|
|
101
101
|
forever: false
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
if (_tempDate && _tempDate === '9999-01-01' && !isChange.current) {
|
|
105
105
|
return {
|
|
106
|
-
range:
|
|
106
|
+
range: dayjs('9999-01-01'),
|
|
107
107
|
forever: true
|
|
108
108
|
};
|
|
109
109
|
}
|
|
@@ -113,8 +113,8 @@ export var ProCertValidity = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
113
113
|
}, [value, (_value4 = value) === null || _value4 === void 0 ? void 0 : _value4.dateTime]);
|
|
114
114
|
var changeRangeTime = function changeRangeTime(values) {
|
|
115
115
|
onChange({
|
|
116
|
-
startTime: values ?
|
|
117
|
-
endTime: values ?
|
|
116
|
+
startTime: values ? dayjs(values === null || values === void 0 ? void 0 : values[0]).format(defaultFormatDate) : null,
|
|
117
|
+
endTime: values ? dayjs(values === null || values === void 0 ? void 0 : values[1]).format(defaultFormatDate) : null,
|
|
118
118
|
forever: 'N'
|
|
119
119
|
});
|
|
120
120
|
};
|
|
@@ -142,7 +142,7 @@ export var ProCertValidity = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
142
142
|
if (rangeTime.forever) {
|
|
143
143
|
_value = '长期';
|
|
144
144
|
} else {
|
|
145
|
-
_value = rangeTime.range ?
|
|
145
|
+
_value = rangeTime.range ? dayjs(rangeTime.range).format(defaultFormatDate) : null;
|
|
146
146
|
}
|
|
147
147
|
return _jsx(_Input, {
|
|
148
148
|
value: _value,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DatePickerProps, RangePickerProps } from 'antd/es/date-picker';
|
|
2
|
-
import
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
3
|
interface ICertValidityValuePropsType {
|
|
4
|
-
dateTime?:
|
|
4
|
+
dateTime?: dayjs.Dayjs | string;
|
|
5
5
|
forever?: string;
|
|
6
6
|
}
|
|
7
7
|
interface ICertValidityRangeValuePropsType {
|
|
8
|
-
startTime?:
|
|
9
|
-
endTime?:
|
|
8
|
+
startTime?: dayjs.Dayjs | string;
|
|
9
|
+
endTime?: dayjs.Dayjs | string;
|
|
10
10
|
forever?: string;
|
|
11
11
|
}
|
|
12
12
|
interface IProCertValidityExtraPropsType {
|
|
@@ -363,9 +363,7 @@ var Render = function Render(props) {
|
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
365
|
// 需要过滤掉的form_item的key
|
|
366
|
-
var filterFormItemKey = ['onFieldChange',
|
|
367
|
-
// 'shouldUpdate',
|
|
368
|
-
'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
|
|
366
|
+
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
|
|
369
367
|
if (type === 'FormList') {
|
|
370
368
|
lastComponentProps.disabled = lastDisabled;
|
|
371
369
|
var lessMode = lastComponentProps.mode === 'less';
|
|
@@ -389,31 +387,24 @@ var Render = function Render(props) {
|
|
|
389
387
|
span: 24 // 默认占一行
|
|
390
388
|
});
|
|
391
389
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
// return (
|
|
395
|
-
// <Form.Item shouldUpdate={_otherFormItemProps.shouldUpdate} noStyle>
|
|
396
|
-
// {() => {
|
|
397
|
-
// return (
|
|
398
|
-
// <Form.Item
|
|
399
|
-
// {...omit(_otherFormItemProps, filterFormItemKey)}
|
|
400
|
-
// // @ts-ignore
|
|
401
|
-
// _internalItemRender={internalItemRender}
|
|
402
|
-
// className={_className}
|
|
403
|
-
// >
|
|
404
|
-
// {child}
|
|
405
|
-
// </Form.Item>
|
|
406
|
-
// );
|
|
407
|
-
// }}
|
|
408
|
-
// </Form.Item>
|
|
409
|
-
// );
|
|
410
|
-
// }
|
|
411
|
-
var formItem = _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(_otherFormItemProps, filterFormItemKey)), {}, {
|
|
390
|
+
|
|
391
|
+
var orgFormItem = _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(_otherFormItemProps, filterFormItemKey)), {}, {
|
|
412
392
|
// @ts-ignore
|
|
413
393
|
_internalItemRender: internalItemRender,
|
|
414
394
|
className: _className,
|
|
415
395
|
children: child
|
|
416
396
|
}));
|
|
397
|
+
var formItem = orgFormItem;
|
|
398
|
+
// 当存在shouldUpdate时捕获所有form变更(防止表单onchange设置form值时无法更新的问题)
|
|
399
|
+
if (_otherFormItemProps.shouldUpdate) {
|
|
400
|
+
formItem = _jsx(_Form.Item, {
|
|
401
|
+
shouldUpdate: _otherFormItemProps.shouldUpdate,
|
|
402
|
+
noStyle: true,
|
|
403
|
+
children: function children() {
|
|
404
|
+
return orgFormItem;
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
417
408
|
// 不渲染tooltip
|
|
418
409
|
if (!originalTip || ['FormList', 'ProEditTable'].includes(type)) {
|
|
419
410
|
return formItem;
|
|
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["show", "type", "viewRender", "viewType", "valueType", "formItemProps", "colProps", "formItemChildProps", "fieldProps", "disabled", "equalWith", "clearNotShow", "required"];
|
|
4
4
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { isBoolean, isFunction, union } from 'lodash';
|
|
6
|
+
import { isBoolean, isFunction, union, isString } from 'lodash';
|
|
7
7
|
import Render from './Render';
|
|
8
8
|
import * as componentMap from '../index';
|
|
9
9
|
import { isSelect } from '../../utils';
|
|
@@ -129,7 +129,11 @@ var RenderFields = function RenderFields(props) {
|
|
|
129
129
|
dataSource: dataSource,
|
|
130
130
|
type: _type
|
|
131
131
|
});
|
|
132
|
-
var
|
|
132
|
+
var placeholderHandle = function placeholderHandle() {
|
|
133
|
+
var _label = isString(label) ? label : '';
|
|
134
|
+
var _formLabel = isString(formLabel) ? formLabel : '';
|
|
135
|
+
return placeholder || "".concat(_isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(_label || _formLabel || '');
|
|
136
|
+
};
|
|
133
137
|
// 表单组件Props 兼容2.0版本
|
|
134
138
|
var _fieldProps = _objectSpread(_objectSpread({}, formItemChildProps), fieldProps);
|
|
135
139
|
if (isBoolean(formDisabled)) {
|
|
@@ -137,7 +141,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
137
141
|
}
|
|
138
142
|
var componentProps = _objectSpread(_objectSpread({
|
|
139
143
|
disabledStrictly: true,
|
|
140
|
-
placeholder:
|
|
144
|
+
placeholder: placeholderHandle()
|
|
141
145
|
}, _fieldProps), {}, {
|
|
142
146
|
disabled: _disabled
|
|
143
147
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import { validate, regExp } from '@zat-design/utils';
|
|
3
|
+
import { isString } from 'lodash';
|
|
3
4
|
import { isNullValue } from './index';
|
|
4
5
|
import locale from '../../locale';
|
|
5
6
|
export var rulesCreator = function rulesCreator(rules, label, isSelect) {
|
|
6
7
|
var _result;
|
|
7
|
-
var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(label
|
|
8
|
+
var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(isString(label) ? label : '');
|
|
8
9
|
var result = [];
|
|
9
10
|
result = rules.map(function (ruleItem) {
|
|
10
11
|
var rule = _objectSpread({}, ruleItem);
|