@zat-design/sisyphus-react 3.3.0-beta.9 → 3.3.1
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 +6 -2
- package/es/ProDownload/utils.js +0 -2
- 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 +2 -3
- package/es/ProForm/components/base/RangePicker/index.js +5 -3
- package/es/ProForm/components/base/TimePicker/index.js +3 -3
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/es/ProForm/components/combination/FormList/index.js +1 -1
- 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/combination/ProTimeLimit/style/index.less +9 -2
- 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 +3 -1
- package/es/ProForm/components/render/RenderFields.js +7 -3
- package/es/ProForm/utils/useForm.js +15 -7
- package/es/ProForm/utils/useRules.js +6 -5
- package/es/ProLayout/components/ProHeader/index.js +4 -4
- package/es/ProTable/utils.js +14 -14
- package/es/ProTreeModal/components/Trigger.js +2 -0
- package/es/ProTreeModal/index.js +3 -3
- package/es/ProUpload/components/DragRender.js +2 -1
- 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/components/RenderField/index.js +0 -2
- 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 +2 -3
- package/lib/ProForm/components/base/RangePicker/index.js +3 -3
- package/lib/ProForm/components/base/TimePicker/index.js +3 -3
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/lib/ProForm/components/combination/FormList/index.js +1 -1
- 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/combination/ProTimeLimit/style/index.less +9 -2
- package/lib/ProForm/components/old/InputRange/index.js +1 -0
- package/lib/ProForm/components/old/ProCertValidity/index.js +17 -17
- package/lib/ProForm/components/old/ProCertValidity/propsType.d.ts +4 -4
- package/lib/ProForm/components/render/Render.js +3 -2
- package/lib/ProForm/components/render/RenderFields.js +6 -2
- package/lib/ProForm/utils/useForm.js +15 -7
- package/lib/ProForm/utils/useRules.js +5 -4
- package/lib/ProLayout/components/ProHeader/index.js +4 -4
- package/lib/ProTable/components/TableResizable/index.js +0 -8
- package/lib/ProTable/utils.js +14 -14
- package/lib/ProTabs/index.js +0 -1
- package/lib/ProThemeTools/index.js +0 -1
- package/lib/ProTree/components/Tree.js +0 -7
- package/lib/ProTree/index.js +1 -0
- package/lib/ProTreeModal/components/Tree.js +0 -1
- package/lib/ProTreeModal/components/Trigger.js +2 -0
- package/lib/ProTreeModal/index.js +3 -3
- package/lib/ProUpload/components/DragRender.js +2 -1
- package/lib/ProUpload/index.js +0 -7
- package/lib/ProViewer/index.js +0 -1
- package/lib/locale/index.js +2 -2
- package/lib/old/ProCertValidity/index.js +17 -17
- 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 +2 -3
package/dist/index.esm.css
CHANGED
|
@@ -2002,11 +2002,11 @@ div.pro-textarea-view::after {
|
|
|
2002
2002
|
.pro-form-list-action .ant-btn-text:hover {
|
|
2003
2003
|
background: transparent;
|
|
2004
2004
|
}
|
|
2005
|
-
.ant-form-item-has-error .ant-picker-status-error ~ .forever-checkbox:not(.ant-input-disabled):not(.ant-input-borderless).ant-input {
|
|
2005
|
+
.ant-form-item-has-error .ant-picker-status-error ~ .forever-checkbox:not(.ant-input-disabled):not( .ant-input-borderless).ant-input {
|
|
2006
2006
|
background: var(--zaui-base-bg, #ffffff);
|
|
2007
2007
|
border-color: var(--ant-error-color);
|
|
2008
2008
|
}
|
|
2009
|
-
.ant-form-item-has-error .forever-checkbox:not(.ant-input-disabled):not(.ant-input-borderless).ant-input:focus {
|
|
2009
|
+
.ant-form-item-has-error .forever-checkbox:not(.ant-input-disabled):not( .ant-input-borderless).ant-input:focus {
|
|
2010
2010
|
border-color: var(--ant-error-color-hover);
|
|
2011
2011
|
border-right-width: 1px;
|
|
2012
2012
|
outline: 0;
|
|
@@ -2027,6 +2027,10 @@ span.ant-input-group-compact.pro-range-limit .ant-picker {
|
|
|
2027
2027
|
-ms-flex: 1;
|
|
2028
2028
|
flex: 1;
|
|
2029
2029
|
}
|
|
2030
|
+
span.ant-input-group-compact.pro-time-limit .ant-picker-focused,
|
|
2031
|
+
span.ant-input-group-compact.pro-range-limit .ant-picker-focused {
|
|
2032
|
+
z-index: 1;
|
|
2033
|
+
}
|
|
2030
2034
|
span.ant-input-group-compact.pro-time-limit .forever-checkbox,
|
|
2031
2035
|
span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
2032
2036
|
-webkit-box-flex: 0;
|
package/es/ProDownload/utils.js
CHANGED
|
@@ -4,8 +4,6 @@ import _message from "antd/es/message";
|
|
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
5
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
|
-
/* eslint-disable no-empty */
|
|
8
|
-
/* eslint-disable prefer-promise-reject-errors */
|
|
9
7
|
import { isFunction, get } from 'lodash';
|
|
10
8
|
import locale from '../locale';
|
|
11
9
|
var stringify = function stringify(data) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DatePickerProps, TimePickerProps } from 'antd';
|
|
2
|
-
import {
|
|
2
|
+
import { Moment } from 'moment';
|
|
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<Moment>['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 moment from 'moment';
|
|
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' && moment.isMoment(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 = moment(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 = moment(_rest.value);
|
|
52
52
|
}
|
|
53
53
|
if (['dateStartTime', 'dateEndTime'].includes(valueType) && rest.showTime === undefined) {
|
|
54
54
|
_rest.showTime = {
|
|
55
|
-
value:
|
|
55
|
+
value: moment(valueType === 'dateStartTime' ? '00:00:00' : '23:59:59', 'HH:mm:ss'),
|
|
56
56
|
disabled: true
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import type { RangePickerProps } from 'antd/es/date-picker';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { Dayjs } from 'dayjs';
|
|
3
|
-
import { RangePickerProps } from 'antd/lib/date-picker/generatePicker';
|
|
4
3
|
import { ProFormOtherProps } from '../../../propsType';
|
|
5
4
|
export type Props = {
|
|
6
5
|
otherProps?: ProFormOtherProps;
|
|
7
6
|
separator?: any;
|
|
8
7
|
showTime?: any;
|
|
9
8
|
isView?: boolean;
|
|
10
|
-
} & Omit<RangePickerProps
|
|
9
|
+
} & Omit<RangePickerProps, 'separator'>;
|
|
11
10
|
declare const RangePicker: React.FC<Props>;
|
|
12
11
|
export default RangePicker;
|
|
@@ -4,8 +4,10 @@ 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
|
+
|
|
7
9
|
import { isFunction, isString, omit } from 'lodash';
|
|
8
|
-
import
|
|
10
|
+
import moment from 'moment';
|
|
9
11
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
10
12
|
import ProForm from '../../../../ProForm';
|
|
11
13
|
import Container from '../../Container';
|
|
@@ -50,9 +52,9 @@ var RangePicker = function RangePicker(props) {
|
|
|
50
52
|
var _res = _objectSpread(_objectSpread({}, rest), {}, {
|
|
51
53
|
showTime: !rest.showTime && valueType === 'dateTime' || rest.showTime
|
|
52
54
|
});
|
|
53
|
-
//
|
|
55
|
+
// 字符串时间格式兼容
|
|
54
56
|
if (Array.isArray(_res.value) && isString(_res.value[0]) && isString(_res.value[1])) {
|
|
55
|
-
_res.value = [
|
|
57
|
+
_res.value = [moment(_res.value[0]), moment(_res.value[1])];
|
|
56
58
|
}
|
|
57
59
|
return _jsx(AntRangePicker, _objectSpread(_objectSpread({}, initialConfig), omit(_res, ['separator'])));
|
|
58
60
|
};
|
|
@@ -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 moment from 'moment';
|
|
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 ? moment(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 ? moment(value, format) : undefined
|
|
39
39
|
}, initialConfig), rest), {}, {
|
|
40
40
|
format: format,
|
|
41
41
|
onChange: handleChange
|
|
@@ -145,13 +145,13 @@ var ActionButton = function ActionButton(props) {
|
|
|
145
145
|
align: "start",
|
|
146
146
|
className: "pro-form-list-action",
|
|
147
147
|
children: actionProps === null || actionProps === void 0 ? void 0 : actionProps.map(function (item) {
|
|
148
|
-
if (item.show === false) return _jsx(
|
|
148
|
+
if (item.show === false) return _jsx("span", {}, "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
|
|
149
149
|
if (isFunction(item.show) && !item.show(form.getFieldValue(namePath), {
|
|
150
150
|
namePath: namePath,
|
|
151
151
|
index: index,
|
|
152
152
|
form: form
|
|
153
153
|
})) {
|
|
154
|
-
return _jsx(
|
|
154
|
+
return _jsx("span", {}, "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
|
|
155
155
|
}
|
|
156
156
|
var label = item.label,
|
|
157
157
|
onClick = item.onClick,
|
|
@@ -62,7 +62,7 @@ var FormList = function FormList(props, ref) {
|
|
|
62
62
|
var handleDragEnd = function handleDragEnd(drag) {
|
|
63
63
|
var active = drag.active,
|
|
64
64
|
over = drag.over;
|
|
65
|
-
if (active.id !== over.id) {
|
|
65
|
+
if (_fields.length > 1 && active.id !== over.id) {
|
|
66
66
|
var activeIndex = _fields.findIndex(function (item) {
|
|
67
67
|
return item.key === active.id;
|
|
68
68
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RangePickerProps } from 'antd/es/date-picker';
|
|
3
|
-
import {
|
|
3
|
+
import { Moment } from 'moment';
|
|
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 = [Moment?, Moment?, 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 moment from 'moment';
|
|
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 = [moment(), moment()];
|
|
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]) && moment(props.value[0], props.format), ((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2[1]) && moment(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 moment(foreverDate, format).isSame(endDate);
|
|
78
78
|
}, [value]);
|
|
79
79
|
var foreverMoment = useMemo(function () {
|
|
80
|
-
return
|
|
80
|
+
return moment(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 || moment().startOf('day');
|
|
119
119
|
end = foreverMoment;
|
|
120
120
|
} else {
|
|
121
121
|
start = undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import moment, { Moment } from 'moment';
|
|
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) => [moment.Moment, (value: Moment | 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 moment from 'moment';
|
|
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 && moment(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 { Moment } from 'moment';
|
|
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: Moment) => 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 moment, { isMoment } from 'moment';
|
|
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 ? moment(foreverTime, format) : moment('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 (isMoment(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(moment(foreverString, format));
|
|
65
65
|
} else {
|
|
66
66
|
onChange(null);
|
|
67
67
|
}
|
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
.@{ant-prefix}-form-item-has-error {
|
|
5
5
|
.@{ant-prefix}-picker-status-error
|
|
6
|
-
~ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
|
|
6
|
+
~ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
|
|
7
|
+
.@{ant-prefix}-input-borderless
|
|
8
|
+
).@{ant-prefix}-input {
|
|
7
9
|
background: @zaui-base-bg;
|
|
8
10
|
border-color: var(--ant-error-color);
|
|
9
11
|
}
|
|
10
|
-
.forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
|
|
12
|
+
.forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
|
|
13
|
+
.@{ant-prefix}-input-borderless
|
|
14
|
+
).@{ant-prefix}-input:focus {
|
|
11
15
|
border-color: var(--ant-error-color-hover);
|
|
12
16
|
border-right-width: 1px;
|
|
13
17
|
outline: 0;
|
|
@@ -24,6 +28,9 @@ span.@{ant-prefix}-input-group-compact {
|
|
|
24
28
|
flex: 1;
|
|
25
29
|
}
|
|
26
30
|
|
|
31
|
+
.@{ant-prefix}-picker-focused {
|
|
32
|
+
z-index: 1;
|
|
33
|
+
}
|
|
27
34
|
.forever-checkbox {
|
|
28
35
|
flex: 0;
|
|
29
36
|
min-width: unset;
|
|
@@ -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 moment from 'moment';
|
|
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: [moment('9999-01-01'), moment('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 = moment(startTime).format(defaultFormatDate);
|
|
59
|
+
var tempEndDate = moment(endTime).format(defaultFormatDate);
|
|
60
60
|
if ((!forever || forever === 'N') && !checkIsForever(tempStartDate) && !checkIsForever(tempEndDate)) {
|
|
61
61
|
return {
|
|
62
|
-
range: [
|
|
62
|
+
range: [moment(startTime), moment(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: [moment('9999-01-01'), moment('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 = moment(value).format(defaultFormatDate);
|
|
76
76
|
if (tempDate && tempDate === '9999-01-01') {
|
|
77
77
|
return {
|
|
78
|
-
range:
|
|
78
|
+
range: moment('9999-01-01'),
|
|
79
79
|
forever: true
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
return {
|
|
83
|
-
range:
|
|
83
|
+
range: moment(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: moment('9999-01-01'),
|
|
93
93
|
forever: true
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
if (dateTime) {
|
|
97
|
-
var _tempDate =
|
|
97
|
+
var _tempDate = moment(dateTime).format(defaultFormatDate);
|
|
98
98
|
if ((!_forever || _forever === 'N') && _tempDate !== '9999-01-01') {
|
|
99
99
|
return {
|
|
100
|
-
range:
|
|
100
|
+
range: moment(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: moment('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 ? moment(values === null || values === void 0 ? void 0 : values[0]).format(defaultFormatDate) : null,
|
|
117
|
+
endTime: values ? moment(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 ? moment(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 moment from 'moment';
|
|
3
3
|
interface ICertValidityValuePropsType {
|
|
4
|
-
dateTime?:
|
|
4
|
+
dateTime?: moment.Moment | string;
|
|
5
5
|
forever?: string;
|
|
6
6
|
}
|
|
7
7
|
interface ICertValidityRangeValuePropsType {
|
|
8
|
-
startTime?:
|
|
9
|
-
endTime?:
|
|
8
|
+
startTime?: moment.Moment | string;
|
|
9
|
+
endTime?: moment.Moment | string;
|
|
10
10
|
forever?: string;
|
|
11
11
|
}
|
|
12
12
|
interface IProCertValidityExtraPropsType {
|
|
@@ -367,7 +367,9 @@ var Render = function Render(props) {
|
|
|
367
367
|
if (type === 'FormList') {
|
|
368
368
|
lastComponentProps.disabled = lastDisabled;
|
|
369
369
|
var lessMode = lastComponentProps.mode === 'less';
|
|
370
|
-
child = _jsx(_Form.List, _objectSpread(_objectSpread({
|
|
370
|
+
child = _jsx(_Form.List, _objectSpread(_objectSpread({
|
|
371
|
+
name: _otherFormItemProps.name
|
|
372
|
+
}, omit(_otherFormItemProps, ['rules'])), {}, {
|
|
371
373
|
children: function children(fields, operation, meta) {
|
|
372
374
|
return _jsx(AutoComponent, _objectSpread(_objectSpread({}, omit(lastComponentProps, ['onFieldChange', 'disabledStrictly'])), {}, {
|
|
373
375
|
otherProps: otherProps,
|
|
@@ -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
|
});
|
|
@@ -47,23 +47,31 @@ export var useForm = function useForm(originForm) {
|
|
|
47
47
|
};
|
|
48
48
|
var _validateFields = /*#__PURE__*/function () {
|
|
49
49
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nameList) {
|
|
50
|
-
var
|
|
50
|
+
var _len,
|
|
51
|
+
rest,
|
|
52
|
+
_key,
|
|
53
|
+
values,
|
|
54
|
+
_values,
|
|
55
|
+
_args = arguments;
|
|
51
56
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
52
57
|
while (1) switch (_context.prev = _context.next) {
|
|
53
58
|
case 0:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
for (_len = _args.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
60
|
+
rest[_key - 1] = _args[_key];
|
|
61
|
+
}
|
|
62
|
+
_context.next = 3;
|
|
63
|
+
return validateFields.apply(void 0, [nameList].concat(rest));
|
|
64
|
+
case 3:
|
|
57
65
|
values = _context.sent;
|
|
58
66
|
if (!nameList) {
|
|
59
|
-
_context.next =
|
|
67
|
+
_context.next = 6;
|
|
60
68
|
break;
|
|
61
69
|
}
|
|
62
70
|
return _context.abrupt("return", values);
|
|
63
|
-
case
|
|
71
|
+
case 6:
|
|
64
72
|
_values = _getFieldsValue();
|
|
65
73
|
return _context.abrupt("return", _values);
|
|
66
|
-
case
|
|
74
|
+
case 8:
|
|
67
75
|
case "end":
|
|
68
76
|
return _context.stop();
|
|
69
77
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import { useEffect, useMemo } from 'react';
|
|
3
|
-
import { isBoolean } from 'lodash';
|
|
3
|
+
import { isBoolean, isString } from 'lodash';
|
|
4
4
|
import { rulesCreator } from './rulesCreator';
|
|
5
5
|
import { isNotFullArray, isNullArray } from './index';
|
|
6
6
|
import locale from '../../locale';
|
|
@@ -12,6 +12,7 @@ var useRules = function useRules(props) {
|
|
|
12
12
|
names = props.names,
|
|
13
13
|
labelRequired = props.labelRequired,
|
|
14
14
|
type = props.type;
|
|
15
|
+
var _label = isString(label) ? label : '';
|
|
15
16
|
// 根据 required 添加 rules, names 字段会添加数组的必填校验
|
|
16
17
|
var internalRule = useMemo(function () {
|
|
17
18
|
var result = {
|
|
@@ -22,7 +23,7 @@ var useRules = function useRules(props) {
|
|
|
22
23
|
return 'required' in rule;
|
|
23
24
|
}));
|
|
24
25
|
if (!requiredRule) {
|
|
25
|
-
var message = isSelect ? "".concat(locale.ProForm.selectPlaceHolder).concat(
|
|
26
|
+
var message = isSelect ? "".concat(locale.ProForm.selectPlaceHolder).concat(_label) : "".concat(locale.ProForm.inputPlaceholder).concat(_label);
|
|
26
27
|
var rule = {
|
|
27
28
|
required: required,
|
|
28
29
|
message: message
|
|
@@ -31,7 +32,7 @@ var useRules = function useRules(props) {
|
|
|
31
32
|
if (names === null || names === void 0 ? void 0 : names.length) {
|
|
32
33
|
rule.validator = function (_, value) {
|
|
33
34
|
if (!value || isNullArray(value)) {
|
|
34
|
-
return Promise.reject(new Error("".concat(locale.ProForm.inputPlaceholder).concat(
|
|
35
|
+
return Promise.reject(new Error("".concat(locale.ProForm.inputPlaceholder).concat(_label)));
|
|
35
36
|
}
|
|
36
37
|
return Promise.resolve();
|
|
37
38
|
};
|
|
@@ -42,7 +43,7 @@ var useRules = function useRules(props) {
|
|
|
42
43
|
return result;
|
|
43
44
|
}, [rules, required]);
|
|
44
45
|
// type转换为内置rules
|
|
45
|
-
internalRule.rules = internalRule.rules && rulesCreator(internalRule.rules,
|
|
46
|
+
internalRule.rules = internalRule.rules && rulesCreator(internalRule.rules, _label, isSelect);
|
|
46
47
|
useEffect(function () {
|
|
47
48
|
// 添加完整性校验
|
|
48
49
|
if (names && !isBoolean(labelRequired) || type === 'Group' && Array.isArray(names) && required) {
|
|
@@ -50,7 +51,7 @@ var useRules = function useRules(props) {
|
|
|
50
51
|
validator: function validator(rules, value) {
|
|
51
52
|
// 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
|
|
52
53
|
if (Array.isArray(value) && !isNullArray(value) && isNotFullArray(value, names.length)) {
|
|
53
|
-
return Promise.reject(new Error("".concat(locale.ProForm.completeText).concat(
|
|
54
|
+
return Promise.reject(new Error("".concat(locale.ProForm.completeText).concat(_label)));
|
|
54
55
|
}
|
|
55
56
|
return Promise.resolve();
|
|
56
57
|
}
|