doui-react 1.0.0 → 2.0.0
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/es/api/component/common.d.ts +2 -2
- package/es/api/component/common.js +3 -0
- package/es/api/component/global-style.d.ts +0 -1
- package/es/api/component/global-style.js +2 -3
- package/es/api/component/react-dom.js +9 -21
- package/es/api/component/validate-input.js +3 -5
- package/es/button/component/index.js +9 -10
- package/es/button/type/index.d.ts +3 -7
- package/es/checkbox/type/index.d.ts +1 -1
- package/es/date-picker/component/index.js +13 -17
- package/es/date-picker/type/index.d.ts +5 -14
- package/es/form/component/constant.js +2 -2
- package/es/form/component/form-item-map.d.ts +1 -1
- package/es/form/component/form-item.js +1 -3
- package/es/form/component/form-list.d.ts +2 -2
- package/es/form/component/utils.d.ts +33 -23
- package/es/form/component/utils.js +4 -4
- package/es/form/style/form-item.d.ts +1 -1
- package/es/form/style/form-item.js +4 -11
- package/es/form/style/index.js +2 -2
- package/es/form/type/form-item.d.ts +6 -6
- package/es/form/type/form-list.d.ts +2 -2
- package/es/form/type/index.d.ts +3 -3
- package/es/grid/component/pagination.d.ts +72 -15
- package/es/icon/hook/index.d.ts +195 -190
- package/es/input/component/index.js +1 -1
- package/es/input/component/number.d.ts +1 -1
- package/es/input/component/number.js +8 -30
- package/es/input/component/utils.d.ts +3 -2
- package/es/input/component/utils.js +40 -5
- package/es/input/type/index.d.ts +8 -3
- package/es/modal-prompt/component/index.js +3 -1
- package/es/modal-prompt/component/utils.js +2 -1
- package/es/modal-prompt/type/index.d.ts +2 -2
- package/es/open-modal/component/footer.d.ts +1 -1
- package/es/open-modal/component/footer.js +2 -4
- package/es/open-modal/component/modal.js +14 -6
- package/es/open-modal/component/utils.js +2 -6
- package/es/open-modal/hook/use-modal.js +1 -1
- package/es/open-modal/style/index.js +1 -2
- package/es/open-modal/style/wrap.js +1 -1
- package/es/open-modal/type/index.d.ts +2 -2
- package/es/radio/component/abstract-box.d.ts +84 -112
- package/es/radio/component/abstract-box.js +1 -5
- package/es/radio/component/use-radio.d.ts +7 -5
- package/es/radio/type/index.d.ts +2 -2
- package/es/select/component/use-select.js +5 -8
- package/es/select/component/utils.d.ts +1 -2
- package/es/select/type/index.d.ts +1 -1
- package/es/stack/style/index.d.ts +2 -1
- package/es/switch/type/index.d.ts +2 -2
- package/es/table/component/action-button.js +0 -1
- package/es/table/component/filter.d.ts +1 -1
- package/es/table/component/filter.js +1 -1
- package/es/table/component/sort.d.ts +1 -1
- package/es/table/component/time.js +2 -2
- package/es/table/component/utils.d.ts +3 -77
- package/es/table/component/utils.js +1 -3
- package/es/table/hook/search.d.ts +1 -1
- package/es/table/hook/search.js +8 -6
- package/es/table/type/action.d.ts +2 -7
- package/es/table/type/column.d.ts +3 -3
- package/es/tabs/component/utils.d.ts +7 -7
- package/es/tabs/type/index.d.ts +1 -1
- package/es/text/component/index.js +15 -16
- package/es/text/component/use-text.d.ts +3 -2
- package/es/text/component/use-text.js +12 -19
- package/es/text/component/utils.d.ts +1 -1
- package/es/text/style/index.js +1 -1
- package/es/text/type/index.d.ts +2 -2
- package/es/tooltip/component/index.d.ts +31 -21
- package/es/tooltip/component/index.js +6 -2
- package/es/tooltip/type/index.d.ts +1 -1
- package/es/tree/component/index.d.ts +1 -1
- package/es/tree/style/index.js +1 -1
- package/es/tree-select/component/use-tree-select.js +4 -4
- package/es/tree-select/style/index.js +1 -1
- package/es/virtual-list/type/index.d.ts +1 -1
- package/lib/api/component/common.d.ts +2 -2
- package/lib/api/component/common.js +3 -0
- package/lib/api/component/global-style.d.ts +0 -1
- package/lib/api/component/global-style.js +3 -4
- package/lib/api/component/react-dom.js +9 -21
- package/lib/api/component/validate-input.js +3 -5
- package/lib/button/component/index.js +9 -10
- package/lib/button/type/index.d.ts +3 -7
- package/lib/checkbox/type/index.d.ts +1 -1
- package/lib/date-picker/component/index.js +13 -17
- package/lib/date-picker/type/index.d.ts +5 -14
- package/lib/form/component/constant.js +2 -2
- package/lib/form/component/form-item-map.d.ts +1 -1
- package/lib/form/component/form-item.js +1 -3
- package/lib/form/component/form-list.d.ts +2 -2
- package/lib/form/component/utils.d.ts +32 -22
- package/lib/form/component/utils.js +4 -4
- package/lib/form/style/form-item.d.ts +1 -1
- package/lib/form/style/form-item.js +4 -11
- package/lib/form/style/index.js +1 -1
- package/lib/form/type/form-item.d.ts +6 -6
- package/lib/form/type/form-list.d.ts +2 -2
- package/lib/form/type/index.d.ts +3 -3
- package/lib/grid/component/pagination.d.ts +72 -15
- package/lib/icon/hook/index.d.ts +195 -190
- package/lib/input/component/index.js +1 -1
- package/lib/input/component/number.d.ts +1 -1
- package/lib/input/component/number.js +7 -28
- package/lib/input/component/utils.d.ts +3 -2
- package/lib/input/component/utils.js +41 -6
- package/lib/input/type/index.d.ts +8 -3
- package/lib/modal-prompt/component/index.js +3 -1
- package/lib/modal-prompt/component/utils.js +2 -1
- package/lib/modal-prompt/type/index.d.ts +2 -2
- package/lib/open-modal/component/footer.d.ts +1 -1
- package/lib/open-modal/component/footer.js +2 -4
- package/lib/open-modal/component/modal.js +12 -4
- package/lib/open-modal/component/utils.js +2 -6
- package/lib/open-modal/hook/use-modal.js +1 -1
- package/lib/open-modal/style/index.js +1 -2
- package/lib/open-modal/style/wrap.js +1 -1
- package/lib/open-modal/type/index.d.ts +2 -2
- package/lib/radio/component/abstract-box.d.ts +86 -114
- package/lib/radio/component/abstract-box.js +1 -5
- package/lib/radio/component/use-radio.d.ts +7 -5
- package/lib/radio/type/index.d.ts +2 -2
- package/lib/select/component/use-select.js +5 -8
- package/lib/select/component/utils.d.ts +1 -2
- package/lib/select/type/index.d.ts +1 -1
- package/lib/stack/style/index.d.ts +2 -1
- package/lib/switch/type/index.d.ts +2 -2
- package/lib/table/component/action-button.js +0 -1
- package/lib/table/component/filter.d.ts +1 -1
- package/lib/table/component/filter.js +1 -1
- package/lib/table/component/sort.d.ts +1 -1
- package/lib/table/component/time.js +2 -2
- package/lib/table/component/utils.d.ts +3 -77
- package/lib/table/component/utils.js +1 -3
- package/lib/table/hook/search.d.ts +1 -1
- package/lib/table/hook/search.js +8 -6
- package/lib/table/type/action.d.ts +2 -7
- package/lib/table/type/column.d.ts +3 -3
- package/lib/tabs/component/utils.d.ts +7 -7
- package/lib/tabs/type/index.d.ts +1 -1
- package/lib/text/component/index.js +15 -16
- package/lib/text/component/use-text.d.ts +3 -2
- package/lib/text/component/use-text.js +11 -18
- package/lib/text/component/utils.d.ts +1 -1
- package/lib/text/style/index.js +1 -1
- package/lib/text/type/index.d.ts +2 -2
- package/lib/tooltip/component/index.d.ts +30 -20
- package/lib/tooltip/component/index.js +6 -2
- package/lib/tooltip/type/index.d.ts +1 -1
- package/lib/tree/component/index.d.ts +1 -1
- package/lib/tree/style/index.js +1 -1
- package/lib/tree-select/component/use-tree-select.js +4 -4
- package/lib/tree-select/style/index.js +1 -1
- package/lib/virtual-list/type/index.d.ts +1 -1
- package/package.json +10 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputNumberProps } from 'antd/
|
|
1
|
+
import { InputNumberProps } from 'antd/es/input-number';
|
|
2
2
|
import { InputProps } from '../type';
|
|
3
3
|
export declare function useNumber({ validate, onBlur, refs, allowResetOnEmpty, ...props }: InputProps): InputNumberProps;
|
|
4
4
|
export declare function Number(props: InputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -10,43 +10,22 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _api = require("../../api");
|
|
12
12
|
var _antd = require("antd");
|
|
13
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
14
|
-
var _reactUse = require("react-use");
|
|
15
13
|
var _style = _interopRequireDefault(require("../style"));
|
|
16
14
|
var _utils = require("./utils");
|
|
17
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
18
16
|
var _excluded = ["validate", "onBlur", "refs", "allowResetOnEmpty"];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
precision = _ref.precision,
|
|
26
|
-
onChange = _ref.onChange;
|
|
27
|
-
var prevValue = (0, _reactUse.usePrevious)(value);
|
|
28
|
-
function onBlur() {
|
|
29
|
-
if (prevValue === value || _lodash.default.isNil(value) || _lodash.default.isNil(precision)) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
var numberValue = (0, _utils.formatNumber)(+value, precision);
|
|
33
|
-
onChange === null || onChange === void 0 || onChange(numberValue);
|
|
34
|
-
}
|
|
35
|
-
return onBlur;
|
|
36
|
-
}
|
|
37
|
-
function useNumber(_ref2) {
|
|
38
|
-
var validate = _ref2.validate,
|
|
39
|
-
onBlur = _ref2.onBlur,
|
|
40
|
-
refs = _ref2.refs,
|
|
41
|
-
allowResetOnEmpty = _ref2.allowResetOnEmpty,
|
|
42
|
-
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
43
|
-
var changeOnBlur = useChangeWhenHasPrecision(props);
|
|
17
|
+
function useNumber(_ref) {
|
|
18
|
+
var validate = _ref.validate,
|
|
19
|
+
onBlur = _ref.onBlur,
|
|
20
|
+
refs = _ref.refs,
|
|
21
|
+
allowResetOnEmpty = _ref.allowResetOnEmpty,
|
|
22
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
44
23
|
var resetOnEmpty = (0, _utils.useResetOnEmpty)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
45
24
|
allowResetOnEmpty: allowResetOnEmpty
|
|
46
25
|
}));
|
|
47
26
|
return (0, _objectSpread2.default)({
|
|
48
27
|
ref: refs,
|
|
49
|
-
onBlur: (0, _api.mergeFunction)(
|
|
28
|
+
onBlur: (0, _api.mergeFunction)(onBlur, resetOnEmpty)
|
|
50
29
|
}, props);
|
|
51
30
|
}
|
|
52
31
|
function Number(props) {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { validateScript, validateString } from "../../api";
|
|
2
2
|
import { InputProps } from "..";
|
|
3
|
+
import { FocusEvent } from 'react';
|
|
3
4
|
export declare const validateTypeMap: {
|
|
4
5
|
default: typeof validateString;
|
|
5
6
|
script: typeof validateScript;
|
|
6
7
|
};
|
|
7
8
|
export declare function validateInput(value: string, validate?: InputProps['validate']): boolean;
|
|
8
9
|
export declare function validateEnter(value: any, allowEnter: boolean): boolean;
|
|
9
|
-
export declare function useInputValidate({ value, onChange, onBlur, validate, refs, allowEnter, allowResetOnEmpty, ...props }: InputProps): any;
|
|
10
|
-
export declare function formatNumber(value: number, precision: number): number;
|
|
10
|
+
export declare function useInputValidate({ value, onChange, onBlur, validate, refs, allowEnter, allowResetOnEmpty, allowTrim, ...props }: InputProps): any;
|
|
11
11
|
interface ResetOnEmptyProps extends InputProps {
|
|
12
12
|
validate?: (value: string | number) => boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare function useResetOnEmpty({ name, allowResetOnEmpty, validate }: ResetOnEmptyProps): () => Promise<void>;
|
|
15
|
+
export declare function useTrim({ value, onChange, allowTrim }: InputProps): (event: FocusEvent<HTMLInputElement>) => Promise<void>;
|
|
15
16
|
export {};
|
|
@@ -4,9 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.formatNumber = formatNumber;
|
|
8
7
|
exports.useInputValidate = useInputValidate;
|
|
9
8
|
exports.useResetOnEmpty = useResetOnEmpty;
|
|
9
|
+
exports.useTrim = useTrim;
|
|
10
10
|
exports.validateEnter = validateEnter;
|
|
11
11
|
exports.validateInput = validateInput;
|
|
12
12
|
exports.validateTypeMap = void 0;
|
|
@@ -19,7 +19,7 @@ var _form = require("../../form");
|
|
|
19
19
|
var _utils = require("../../form/component/utils");
|
|
20
20
|
var _delay = _interopRequireDefault(require("delay"));
|
|
21
21
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
22
|
-
var _excluded = ["value", "onChange", "onBlur", "validate", "refs", "allowEnter", "allowResetOnEmpty"];
|
|
22
|
+
var _excluded = ["value", "onChange", "onBlur", "validate", "refs", "allowEnter", "allowResetOnEmpty", "allowTrim"];
|
|
23
23
|
var validateTypeMap = exports.validateTypeMap = {
|
|
24
24
|
default: _api.validateString,
|
|
25
25
|
script: _api.validateScript
|
|
@@ -47,6 +47,7 @@ function useInputValidate(_ref) {
|
|
|
47
47
|
_ref$allowEnter = _ref.allowEnter,
|
|
48
48
|
allowEnter = _ref$allowEnter === void 0 ? true : _ref$allowEnter,
|
|
49
49
|
allowResetOnEmpty = _ref.allowResetOnEmpty,
|
|
50
|
+
allowTrim = _ref.allowTrim,
|
|
50
51
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
51
52
|
var resetOnEmpty = useResetOnEmpty((0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
52
53
|
allowResetOnEmpty: allowResetOnEmpty,
|
|
@@ -54,6 +55,11 @@ function useInputValidate(_ref) {
|
|
|
54
55
|
return !value;
|
|
55
56
|
}
|
|
56
57
|
}));
|
|
58
|
+
var trim = useTrim({
|
|
59
|
+
value: value,
|
|
60
|
+
onChange: onChange,
|
|
61
|
+
allowTrim: allowTrim
|
|
62
|
+
});
|
|
57
63
|
var handleChange = function handleChange(e) {
|
|
58
64
|
var value = e.target.value;
|
|
59
65
|
if (validateInput(value, validate) && validateEnter(value, allowEnter)) {
|
|
@@ -67,12 +73,9 @@ function useInputValidate(_ref) {
|
|
|
67
73
|
autoComplete: 'off',
|
|
68
74
|
value: _lodash.default.isNil(value) ? '' : value,
|
|
69
75
|
onChange: handleChange,
|
|
70
|
-
onBlur: (0, _api.mergeFunction)(
|
|
76
|
+
onBlur: (0, _api.mergeFunction)(trim, resetOnEmpty, onBlur)
|
|
71
77
|
});
|
|
72
78
|
}
|
|
73
|
-
function formatNumber(value, precision) {
|
|
74
|
-
return +value.toFixed(precision);
|
|
75
|
-
}
|
|
76
79
|
function useResetOnEmpty(_ref2) {
|
|
77
80
|
var name = _ref2.name,
|
|
78
81
|
allowResetOnEmpty = _ref2.allowResetOnEmpty,
|
|
@@ -111,4 +114,36 @@ function useResetOnEmpty(_ref2) {
|
|
|
111
114
|
return _onBlur.apply(this, arguments);
|
|
112
115
|
}
|
|
113
116
|
return onBlur;
|
|
117
|
+
}
|
|
118
|
+
function useTrim(_ref3) {
|
|
119
|
+
var value = _ref3.value,
|
|
120
|
+
onChange = _ref3.onChange,
|
|
121
|
+
allowTrim = _ref3.allowTrim;
|
|
122
|
+
function onBlur(_x) {
|
|
123
|
+
return _onBlur2.apply(this, arguments);
|
|
124
|
+
}
|
|
125
|
+
function _onBlur2() {
|
|
126
|
+
_onBlur2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(event) {
|
|
127
|
+
var trimValue;
|
|
128
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
129
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
if (!(!allowTrim || !value)) {
|
|
132
|
+
_context2.next = 2;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
return _context2.abrupt("return");
|
|
136
|
+
case 2:
|
|
137
|
+
trimValue = _lodash.default.trim("".concat(value));
|
|
138
|
+
onChange === null || onChange === void 0 || onChange(trimValue);
|
|
139
|
+
_lodash.default.set(event, 'target.value', trimValue);
|
|
140
|
+
case 5:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context2.stop();
|
|
143
|
+
}
|
|
144
|
+
}, _callee2);
|
|
145
|
+
}));
|
|
146
|
+
return _onBlur2.apply(this, arguments);
|
|
147
|
+
}
|
|
148
|
+
return onBlur;
|
|
114
149
|
}
|
|
@@ -2,9 +2,9 @@ import { BaseComponentProps } from "../../api";
|
|
|
2
2
|
import { inputMap } from "../component";
|
|
3
3
|
import { validateTypeMap } from "../component/utils";
|
|
4
4
|
import { InputProps as AntdInputProps } from 'antd';
|
|
5
|
-
import { InputNumberProps } from 'antd/
|
|
6
|
-
import { PasswordProps } from 'antd/
|
|
7
|
-
import { TextAreaProps } from 'antd/
|
|
5
|
+
import { InputNumberProps } from 'antd/es/input-number';
|
|
6
|
+
import { PasswordProps } from 'antd/es/input/Password';
|
|
7
|
+
import { TextAreaProps } from 'antd/es/input/TextArea';
|
|
8
8
|
type UnionType = BaseComponentProps & AntdInputProps & TextAreaProps & InputNumberProps & PasswordProps;
|
|
9
9
|
export interface InputProps extends Omit<UnionType, 'form' | 'onChange'> {
|
|
10
10
|
/**
|
|
@@ -32,6 +32,11 @@ export interface InputProps extends Omit<UnionType, 'form' | 'onChange'> {
|
|
|
32
32
|
* @default false
|
|
33
33
|
*/
|
|
34
34
|
allowResetOnEmpty?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @description 是否 trim 输入框前后空格
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
allowTrim?: boolean;
|
|
35
40
|
/**
|
|
36
41
|
* @description 输入框值改变的回调
|
|
37
42
|
*/
|
|
@@ -50,7 +50,9 @@ function openConfirm(_ref) {
|
|
|
50
50
|
style: {
|
|
51
51
|
display: showCancel ? 'unset' : 'none'
|
|
52
52
|
}
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
|
+
okText: '确定',
|
|
55
|
+
cancelText: '取消'
|
|
54
56
|
}, props);
|
|
55
57
|
return new Promise(function (resolve) {
|
|
56
58
|
_antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)({}, mergedProps), {}, {
|
|
@@ -39,7 +39,8 @@ function openModalFunction(props) {
|
|
|
39
39
|
duration = _mergeProps.duration,
|
|
40
40
|
restProps = (0, _objectWithoutProperties2.default)(_mergeProps, _excluded2);
|
|
41
41
|
return new Promise(function (resolve) {
|
|
42
|
-
var
|
|
42
|
+
var modalMethod = _antd.Modal[type];
|
|
43
|
+
var modal = modalMethod((0, _objectSpread2.default)((0, _objectSpread2.default)({}, restProps), {}, {
|
|
43
44
|
onOk: function onOk() {
|
|
44
45
|
return resolve();
|
|
45
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModalFuncProps as AntdModalFuncProps } from 'antd/
|
|
2
|
-
import { SpinProps } from 'antd/
|
|
1
|
+
import type { ModalFuncProps as AntdModalFuncProps } from 'antd/es/modal';
|
|
2
|
+
import { SpinProps } from 'antd/es/spin';
|
|
3
3
|
import { CSSProperties, ReactNode } from 'react';
|
|
4
4
|
export interface ConfirmModalProps extends AntdModalFuncProps {
|
|
5
5
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HStackProps } from "../../stack";
|
|
2
|
-
export declare function Footer({ className, children
|
|
2
|
+
export declare function Footer({ className, children, ...props }: HStackProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -11,13 +11,12 @@ var _form = require("../../form");
|
|
|
11
11
|
var _portal = require("../../portal");
|
|
12
12
|
var _stack = require("../../stack");
|
|
13
13
|
var _css = require("@emotion/css");
|
|
14
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
15
14
|
var _reactUse = require("react-use");
|
|
16
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
16
|
var _excluded = ["className", "children"];
|
|
18
17
|
function Footer(_ref) {
|
|
19
18
|
var className = _ref.className,
|
|
20
|
-
|
|
19
|
+
children = _ref.children,
|
|
21
20
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
22
21
|
var _useFormContext = (0, _form.useFormContext)(),
|
|
23
22
|
setModalProps = _useFormContext.setModalProps;
|
|
@@ -26,7 +25,6 @@ function Footer(_ref) {
|
|
|
26
25
|
footer: null
|
|
27
26
|
});
|
|
28
27
|
});
|
|
29
|
-
var component = _lodash.default.isFunction(Children) ? (0, _jsxRuntime.jsx)(Children, {}) : Children;
|
|
30
28
|
return (0, _jsxRuntime.jsx)(_portal.Portal, {
|
|
31
29
|
container: function container(current) {
|
|
32
30
|
return current.closest('.ant-modal-content');
|
|
@@ -35,7 +33,7 @@ function Footer(_ref) {
|
|
|
35
33
|
className: (0, _css.cx)('ant-modal-footer', className),
|
|
36
34
|
justify: "right"
|
|
37
35
|
}, props), {}, {
|
|
38
|
-
children:
|
|
36
|
+
children: children
|
|
39
37
|
}))
|
|
40
38
|
});
|
|
41
39
|
}
|
|
@@ -24,9 +24,9 @@ var Modal = exports.Modal = function Modal(props) {
|
|
|
24
24
|
ok = context.ok,
|
|
25
25
|
close = context.close;
|
|
26
26
|
return (0, _jsxRuntime.jsx)(_hook.ModalProvider, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, context), {}, {
|
|
27
|
-
children: (0, _jsxRuntime.
|
|
27
|
+
children: (0, _jsxRuntime.jsxs)(_antd.Modal, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
28
28
|
open: open,
|
|
29
|
-
|
|
29
|
+
destroyOnHidden: true
|
|
30
30
|
}, modalProps), {}, {
|
|
31
31
|
title: (0, _jsxRuntime.jsx)(_text.Text, {
|
|
32
32
|
children: modalProps.title
|
|
@@ -34,9 +34,17 @@ var Modal = exports.Modal = function Modal(props) {
|
|
|
34
34
|
confirmLoading: confirmLoading,
|
|
35
35
|
onCancel: close,
|
|
36
36
|
onOk: ok,
|
|
37
|
-
children: (0, _jsxRuntime.jsx)(
|
|
37
|
+
children: [(0, _jsxRuntime.jsx)(_antd.Divider, {
|
|
38
|
+
style: {
|
|
39
|
+
margin: '15px 0 24px'
|
|
40
|
+
}
|
|
41
|
+
}), (0, _jsxRuntime.jsx)(_form.Form, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, formProps), {}, {
|
|
38
42
|
context: context
|
|
39
|
-
}))
|
|
43
|
+
})), (0, _jsxRuntime.jsx)(_antd.Divider, {
|
|
44
|
+
style: {
|
|
45
|
+
margin: '15px 0 20px'
|
|
46
|
+
}
|
|
47
|
+
})]
|
|
40
48
|
}))
|
|
41
49
|
}));
|
|
42
50
|
};
|
|
@@ -81,7 +81,7 @@ function getModalAndFormProps(props) {
|
|
|
81
81
|
footer: _lodash.default.isNull(formProps.footer) ? null : undefined,
|
|
82
82
|
// 为 null 时,不显示 footer
|
|
83
83
|
css: _style.default.wrapper({
|
|
84
|
-
bodyBottomMargin: getBodyBottomMargin(bodyBottomMargin
|
|
84
|
+
bodyBottomMargin: getBodyBottomMargin(bodyBottomMargin),
|
|
85
85
|
titleCenter: titleCenter
|
|
86
86
|
}),
|
|
87
87
|
style: modalProps.centered ? {} : {
|
|
@@ -94,14 +94,10 @@ function getModalAndFormProps(props) {
|
|
|
94
94
|
modalProps: mergedModalProps
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function getBodyBottomMargin(bodyBottomMargin
|
|
98
|
-
var _formProps$items;
|
|
97
|
+
function getBodyBottomMargin(bodyBottomMargin) {
|
|
99
98
|
if (!_lodash.default.isNil(bodyBottomMargin)) {
|
|
100
99
|
return (0, _api.transformValueWithStyleUnit)(bodyBottomMargin);
|
|
101
100
|
}
|
|
102
|
-
if ((_formProps$items = formProps.items) !== null && _formProps$items !== void 0 && _formProps$items.length) {
|
|
103
|
-
return '10px';
|
|
104
|
-
}
|
|
105
101
|
}
|
|
106
102
|
function shouldEnableButton(_ref2) {
|
|
107
103
|
var _onValidate;
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useModal = useModal;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _usePatchElement3 = _interopRequireDefault(require("antd/
|
|
10
|
+
var _usePatchElement3 = _interopRequireDefault(require("antd/es/_util/hooks/usePatchElement"));
|
|
11
11
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
12
12
|
var _component = require("../component");
|
|
13
13
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _api = require("../../api");
|
|
10
9
|
var _react = require("@emotion/react");
|
|
11
10
|
var _templateObject, _templateObject2, _templateObject3;
|
|
12
11
|
function titleStyle(titleCenter) {
|
|
@@ -19,7 +18,7 @@ var style = {
|
|
|
19
18
|
wrapper: function wrapper(_ref) {
|
|
20
19
|
var bodyBottomMargin = _ref.bodyBottomMargin,
|
|
21
20
|
titleCenter = _ref.titleCenter;
|
|
22
|
-
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n
|
|
21
|
+
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .ant-modal-title {\n font-size: 16px;\n ", "\n }\n\n .ant-modal-body {\n padding-bottom: ", ";\n }\n "])), titleStyle(titleCenter), bodyBottomMargin);
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
24
|
var _default = exports.default = style;
|
|
@@ -9,5 +9,5 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
9
9
|
var _css = require("@emotion/css");
|
|
10
10
|
var _templateObject;
|
|
11
11
|
function getWrapStyle(wrapStyle) {
|
|
12
|
-
return (0, _css.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n
|
|
12
|
+
return (0, _css.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n "])), wrapStyle);
|
|
13
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FunctionReturn } from "../../api";
|
|
2
2
|
import { FormInstance, FormItemProps, FormProps, FormValues } from "../../form";
|
|
3
3
|
import { CSSObject } from '@emotion/react';
|
|
4
|
-
import { ModalProps as AntdModalProps } from 'antd/
|
|
4
|
+
import type { ModalProps as AntdModalProps } from 'antd/es/modal';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
type AntdComponentProps = Omit<AntdModalProps, 'onOk' | 'children'> & Omit<FormProps, 'children' | 'content' | 'title'>;
|
|
7
7
|
/**
|
|
@@ -56,7 +56,7 @@ export interface OpenModalProps extends AntdComponentProps {
|
|
|
56
56
|
*/
|
|
57
57
|
onOk?(values: FormValues, form: FormInstance): FunctionReturn<boolean | void>;
|
|
58
58
|
/**
|
|
59
|
-
* @description
|
|
59
|
+
* @description 关闭弹窗时的回调
|
|
60
60
|
*/
|
|
61
61
|
unmount?: () => void;
|
|
62
62
|
}
|