@hw-component/form 0.0.8-beta-v5 → 0.0.8-beta-v7
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/DialogForm/DrawerForm/index.d.ts +1 -1
- package/es/DialogForm/DrawerForm/index.js +42 -40
- package/es/DialogForm/ModalForm.d.ts +1 -1
- package/es/DialogForm/ModalForm.js +41 -39
- package/es/DialogForm/modal.d.ts +2 -0
- package/es/Form/HFormConnect.js +21 -14
- package/es/Form/config.js +4 -4
- package/es/Form/modal.d.ts +4 -2
- package/es/TDPicker/TimePicker.d.ts +2 -2
- package/es/TDPicker/TimePicker.js +7 -3
- package/es/TDPicker/index.d.ts +2 -3
- package/es/TDPicker/index.js +6 -2
- package/es/TDPicker/modal.d.ts +2 -0
- package/lib/DialogForm/DrawerForm/index.d.ts +1 -1
- package/lib/DialogForm/DrawerForm/index.js +42 -40
- package/lib/DialogForm/ModalForm.d.ts +1 -1
- package/lib/DialogForm/ModalForm.js +41 -39
- package/lib/DialogForm/modal.d.ts +2 -0
- package/lib/Form/HFormConnect.js +21 -14
- package/lib/Form/modal.d.ts +4 -2
- package/lib/TDPicker/TimePicker.d.ts +2 -2
- package/lib/TDPicker/TimePicker.js +7 -3
- package/lib/TDPicker/index.d.ts +2 -3
- package/lib/TDPicker/index.js +6 -2
- package/lib/TDPicker/modal.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/DialogForm/DrawerForm/index.tsx +20 -18
- package/src/components/DialogForm/ModalForm.tsx +19 -17
- package/src/components/DialogForm/modal.ts +2 -0
- package/src/components/Form/HFormConnect.tsx +19 -12
- package/src/components/Form/hooks/useHForm.ts +1 -1
- package/src/components/Form/modal.ts +4 -2
- package/src/components/TDPicker/TimePicker.tsx +5 -1
- package/src/components/TDPicker/index.tsx +4 -1
- package/src/components/TDPicker/modal.ts +2 -0
- package/src/pages/Form/index.tsx +13 -0
- package/src/pages/ModalForm/index.tsx +6 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DialogFormProps } from "../modal";
|
|
2
|
-
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, ...props }: DialogFormProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, contentRender, ...props }: DialogFormProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
|
@@ -18,7 +18,7 @@ import Title from './Title.js';
|
|
|
18
18
|
import Footer from './Footer.js';
|
|
19
19
|
import Index, { useFormConfigContext } from '../../Form/Context/FormConfigProvider.js';
|
|
20
20
|
|
|
21
|
-
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange", "autoClear"];
|
|
21
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange", "autoClear", "contentRender"];
|
|
22
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
24
|
var DrawerForm = (function (_ref) {
|
|
@@ -43,6 +43,7 @@ var DrawerForm = (function (_ref) {
|
|
|
43
43
|
onValuesChange = _ref.onValuesChange,
|
|
44
44
|
_ref$autoClear = _ref.autoClear,
|
|
45
45
|
autoClear = _ref$autoClear === void 0 ? true : _ref$autoClear,
|
|
46
|
+
contentRender = _ref.contentRender,
|
|
46
47
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
48
|
var currentForm = useCurrentForm(dialogForm);
|
|
48
49
|
var providerConfig = useFormConfigContext();
|
|
@@ -86,6 +87,45 @@ var DrawerForm = (function (_ref) {
|
|
|
86
87
|
confirmLoading: loading
|
|
87
88
|
});
|
|
88
89
|
};
|
|
90
|
+
var node = jsx(HForm, _objectSpread(_objectSpread({
|
|
91
|
+
configData: modalFormData,
|
|
92
|
+
initialValues: initValue,
|
|
93
|
+
onValuesChange: onValuesChange
|
|
94
|
+
}, props), {}, {
|
|
95
|
+
form: currentForm,
|
|
96
|
+
params: formParams,
|
|
97
|
+
onFinish: function () {
|
|
98
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
|
|
99
|
+
var result, close;
|
|
100
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
101
|
+
while (1) switch (_context.prev = _context.next) {
|
|
102
|
+
case 0:
|
|
103
|
+
_context.next = 2;
|
|
104
|
+
return run(values, subParams);
|
|
105
|
+
case 2:
|
|
106
|
+
result = _context.sent;
|
|
107
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
|
|
108
|
+
if (!(close === false)) {
|
|
109
|
+
_context.next = 6;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return _context.abrupt("return");
|
|
113
|
+
case 6:
|
|
114
|
+
cancel();
|
|
115
|
+
case 7:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context.stop();
|
|
118
|
+
}
|
|
119
|
+
}, _callee);
|
|
120
|
+
}));
|
|
121
|
+
function onFinish(_x, _x2) {
|
|
122
|
+
return _onFinish.apply(this, arguments);
|
|
123
|
+
}
|
|
124
|
+
return onFinish;
|
|
125
|
+
}(),
|
|
126
|
+
infoRequest: infoRequest,
|
|
127
|
+
labelWidth: labelWidth
|
|
128
|
+
}));
|
|
89
129
|
return jsx(Drawer, _objectSpread(_objectSpread({
|
|
90
130
|
visible: modalVisible,
|
|
91
131
|
title: jsx(Title, {
|
|
@@ -99,45 +139,7 @@ var DrawerForm = (function (_ref) {
|
|
|
99
139
|
destroyOnClose: true,
|
|
100
140
|
footer: footerComponent(),
|
|
101
141
|
children: jsx(Index, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
102
|
-
children:
|
|
103
|
-
configData: modalFormData,
|
|
104
|
-
initialValues: initValue,
|
|
105
|
-
onValuesChange: onValuesChange
|
|
106
|
-
}, props), {}, {
|
|
107
|
-
form: currentForm,
|
|
108
|
-
params: formParams,
|
|
109
|
-
onFinish: function () {
|
|
110
|
-
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
|
|
111
|
-
var result, close;
|
|
112
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
113
|
-
while (1) switch (_context.prev = _context.next) {
|
|
114
|
-
case 0:
|
|
115
|
-
_context.next = 2;
|
|
116
|
-
return run(values, subParams);
|
|
117
|
-
case 2:
|
|
118
|
-
result = _context.sent;
|
|
119
|
-
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
|
|
120
|
-
if (!(close === false)) {
|
|
121
|
-
_context.next = 6;
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
return _context.abrupt("return");
|
|
125
|
-
case 6:
|
|
126
|
-
cancel();
|
|
127
|
-
case 7:
|
|
128
|
-
case "end":
|
|
129
|
-
return _context.stop();
|
|
130
|
-
}
|
|
131
|
-
}, _callee);
|
|
132
|
-
}));
|
|
133
|
-
function onFinish(_x, _x2) {
|
|
134
|
-
return _onFinish.apply(this, arguments);
|
|
135
|
-
}
|
|
136
|
-
return onFinish;
|
|
137
|
-
}(),
|
|
138
|
-
infoRequest: infoRequest,
|
|
139
|
-
labelWidth: labelWidth
|
|
140
|
-
}))
|
|
142
|
+
children: contentRender ? contentRender(node, currentForm) : node
|
|
141
143
|
}))
|
|
142
144
|
}));
|
|
143
145
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DialogFormProps } from "./modal";
|
|
2
|
-
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, ...props }: DialogFormProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, contentRender, ...props }: DialogFormProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
|
@@ -16,7 +16,7 @@ import HForm from '../Form/index.js';
|
|
|
16
16
|
import Index, { useFormConfigContext } from '../Form/Context/FormConfigProvider.js';
|
|
17
17
|
import { useCurrentForm, useModifyProps, useSub } from './hooks.js';
|
|
18
18
|
|
|
19
|
-
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange", "autoClear"];
|
|
19
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange", "autoClear", "contentRender"];
|
|
20
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
22
|
var ModalForm = (function (_ref) {
|
|
@@ -35,6 +35,7 @@ var ModalForm = (function (_ref) {
|
|
|
35
35
|
onValuesChange = _ref.onValuesChange,
|
|
36
36
|
_ref$autoClear = _ref.autoClear,
|
|
37
37
|
autoClear = _ref$autoClear === void 0 ? true : _ref$autoClear,
|
|
38
|
+
contentRender = _ref.contentRender,
|
|
38
39
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
39
40
|
var currentForm = useCurrentForm(dialogForm);
|
|
40
41
|
var providerConfig = useFormConfigContext();
|
|
@@ -65,6 +66,44 @@ var ModalForm = (function (_ref) {
|
|
|
65
66
|
}),
|
|
66
67
|
loading = _useSub.loading,
|
|
67
68
|
run = _useSub.run;
|
|
69
|
+
var node = jsx(HForm, _objectSpread(_objectSpread({
|
|
70
|
+
configData: modalFormData,
|
|
71
|
+
initialValues: initValue,
|
|
72
|
+
onValuesChange: onValuesChange,
|
|
73
|
+
onFinish: function () {
|
|
74
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
75
|
+
var result, close;
|
|
76
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
77
|
+
while (1) switch (_context.prev = _context.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
_context.next = 2;
|
|
80
|
+
return run(values, outParams);
|
|
81
|
+
case 2:
|
|
82
|
+
result = _context.sent;
|
|
83
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
84
|
+
if (!(close === false)) {
|
|
85
|
+
_context.next = 6;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return _context.abrupt("return");
|
|
89
|
+
case 6:
|
|
90
|
+
cancel();
|
|
91
|
+
case 7:
|
|
92
|
+
case "end":
|
|
93
|
+
return _context.stop();
|
|
94
|
+
}
|
|
95
|
+
}, _callee);
|
|
96
|
+
}));
|
|
97
|
+
function onFinish(_x, _x2) {
|
|
98
|
+
return _onFinish.apply(this, arguments);
|
|
99
|
+
}
|
|
100
|
+
return onFinish;
|
|
101
|
+
}()
|
|
102
|
+
}, props), {}, {
|
|
103
|
+
params: formParams,
|
|
104
|
+
form: currentForm,
|
|
105
|
+
infoRequest: infoRequest
|
|
106
|
+
}));
|
|
68
107
|
return jsx(Modal, _objectSpread(_objectSpread({
|
|
69
108
|
title: modalTitle,
|
|
70
109
|
visible: modalVisible,
|
|
@@ -80,44 +119,7 @@ var ModalForm = (function (_ref) {
|
|
|
80
119
|
onOk: currentForm.submit,
|
|
81
120
|
destroyOnClose: true,
|
|
82
121
|
children: jsx(Index, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
83
|
-
children:
|
|
84
|
-
configData: modalFormData,
|
|
85
|
-
initialValues: initValue,
|
|
86
|
-
onValuesChange: onValuesChange,
|
|
87
|
-
onFinish: function () {
|
|
88
|
-
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
89
|
-
var result, close;
|
|
90
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
91
|
-
while (1) switch (_context.prev = _context.next) {
|
|
92
|
-
case 0:
|
|
93
|
-
_context.next = 2;
|
|
94
|
-
return run(values, outParams);
|
|
95
|
-
case 2:
|
|
96
|
-
result = _context.sent;
|
|
97
|
-
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
98
|
-
if (!(close === false)) {
|
|
99
|
-
_context.next = 6;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
return _context.abrupt("return");
|
|
103
|
-
case 6:
|
|
104
|
-
cancel();
|
|
105
|
-
case 7:
|
|
106
|
-
case "end":
|
|
107
|
-
return _context.stop();
|
|
108
|
-
}
|
|
109
|
-
}, _callee);
|
|
110
|
-
}));
|
|
111
|
-
function onFinish(_x, _x2) {
|
|
112
|
-
return _onFinish.apply(this, arguments);
|
|
113
|
-
}
|
|
114
|
-
return onFinish;
|
|
115
|
-
}()
|
|
116
|
-
}, props), {}, {
|
|
117
|
-
params: formParams,
|
|
118
|
-
form: currentForm,
|
|
119
|
-
infoRequest: infoRequest
|
|
120
|
-
}))
|
|
122
|
+
children: contentRender ? contentRender === null || contentRender === void 0 ? void 0 : contentRender(node, currentForm) : node
|
|
121
123
|
}))
|
|
122
124
|
}));
|
|
123
125
|
});
|
package/es/DialogForm/modal.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModalProps } from "antd";
|
|
2
2
|
import type { HFormInstance, HItemProps, HFormProps } from "../Form/modal";
|
|
3
3
|
import type { PromiseFnResult } from "../modal";
|
|
4
|
+
import React from "react";
|
|
4
5
|
type RootProps = HFormProps & ModalProps;
|
|
5
6
|
export interface ModifyPropsModal<P = any> {
|
|
6
7
|
configData: HItemProps[];
|
|
@@ -32,5 +33,6 @@ export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFi
|
|
|
32
33
|
onOk?: (data: T, params: P) => boolean | void;
|
|
33
34
|
infoRequest?: (params: P) => Promise<T>;
|
|
34
35
|
autoClear?: boolean;
|
|
36
|
+
contentRender?: (dom: React.ReactNode, form: HDialogFormInstance) => React.ReactNode;
|
|
35
37
|
}
|
|
36
38
|
export {};
|
package/es/Form/HFormConnect.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
2
3
|
import 'core-js/modules/es.object.keys.js';
|
|
4
|
+
import 'core-js/modules/es.function.name.js';
|
|
3
5
|
import 'core-js/modules/es.symbol.js';
|
|
4
6
|
import 'core-js/modules/es.array.filter.js';
|
|
5
7
|
import 'core-js/modules/es.object.to-string.js';
|
|
6
8
|
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
7
9
|
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
8
10
|
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
9
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
10
|
-
import 'core-js/modules/es.function.name.js';
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
12
|
import { useFormContext } from './Context/index.js';
|
|
13
13
|
import React, { useEffect } from 'react';
|
|
@@ -15,19 +15,26 @@ import React, { useEffect } from 'react';
|
|
|
15
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
17
|
var formatMaker = function formatMaker(itemProps, formats) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
var _ref = formats || {},
|
|
19
|
+
inputValue = _ref.inputValue,
|
|
20
|
+
outputValue = _ref.outputValue;
|
|
21
|
+
var _itemProps$initValueP = itemProps.initValueProvider,
|
|
22
|
+
initValueProvider = _itemProps$initValueP === void 0 ? inputValue : _itemProps$initValueP,
|
|
23
|
+
_itemProps$subProvide = itemProps.subProvider,
|
|
24
|
+
subProvider = _itemProps$subProvide === void 0 ? outputValue : _itemProps$subProvide;
|
|
25
|
+
var resultObj = {};
|
|
26
|
+
if (initValueProvider) {
|
|
27
|
+
resultObj.inputValue = function (value) {
|
|
28
|
+
return initValueProvider(itemProps, value);
|
|
29
|
+
};
|
|
20
30
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return _outputValue(itemProps, value);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
+
if (subProvider) {
|
|
32
|
+
resultObj.outputValue = function (value) {
|
|
33
|
+
return subProvider(itemProps, value);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
var keysLen = Object.keys(resultObj).length;
|
|
37
|
+
return keysLen === 0 ? undefined : resultObj;
|
|
31
38
|
};
|
|
32
39
|
var HFormConnect = (function (component) {
|
|
33
40
|
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
package/es/Form/config.js
CHANGED
|
@@ -8,11 +8,11 @@ import HCheckboxGroup from '../CheckboxGroup/index.js';
|
|
|
8
8
|
import Index$1 from '../CheckboxGroup/CheckBox/index.js';
|
|
9
9
|
import HRadioGroup from '../RadioGroup/index.js';
|
|
10
10
|
import Index$2 from '../Switch/index.js';
|
|
11
|
-
import
|
|
11
|
+
import HDatePicker from '../TDPicker/index.js';
|
|
12
12
|
import HRangePicker from '../TDPicker/RangePicker.js';
|
|
13
13
|
import HTimePicker from '../TDPicker/TimePicker.js';
|
|
14
14
|
import HUpload from '../Upload/index.js';
|
|
15
|
-
import Index$
|
|
15
|
+
import Index$3 from '../Upload/UrlUpload/index.js';
|
|
16
16
|
import HSubmit from '../Submit/index.js';
|
|
17
17
|
import TextArea from '../TextArea/index.js';
|
|
18
18
|
import ColorInput from '../Input/ColorInput/index.js';
|
|
@@ -32,12 +32,12 @@ var componentConfig = {
|
|
|
32
32
|
checkBox: Index$1,
|
|
33
33
|
radioGroup: HRadioGroup,
|
|
34
34
|
switch: Index$2,
|
|
35
|
-
datePicker:
|
|
35
|
+
datePicker: HDatePicker,
|
|
36
36
|
rangePicker: HRangePicker,
|
|
37
37
|
timePicker: HTimePicker,
|
|
38
38
|
input: HInput,
|
|
39
39
|
upload: HUpload,
|
|
40
|
-
urlUpload: Index$
|
|
40
|
+
urlUpload: Index$3,
|
|
41
41
|
submit: HSubmit,
|
|
42
42
|
textArea: TextArea,
|
|
43
43
|
colorInput: ColorInput,
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export interface HFormItemProps extends HItemProps {
|
|
|
60
60
|
value?: any;
|
|
61
61
|
onChange?: (val: any, item: any) => void;
|
|
62
62
|
itemSpan?: ColProps;
|
|
63
|
+
initValueProvider?: AddValueFormat;
|
|
64
|
+
subProvider?: AddValueFormat;
|
|
63
65
|
}
|
|
64
66
|
export type argsFn = (...args: any[]) => void;
|
|
65
67
|
export interface FormContextProps {
|
|
@@ -110,8 +112,8 @@ export interface ConnectConfigModal {
|
|
|
110
112
|
}
|
|
111
113
|
type ValueFormat = (value: Record<string, any>) => Record<string, any>;
|
|
112
114
|
export interface FormatItemModal {
|
|
113
|
-
inputValue
|
|
114
|
-
outputValue
|
|
115
|
+
inputValue?: ValueFormat;
|
|
116
|
+
outputValue?: ValueFormat;
|
|
115
117
|
}
|
|
116
118
|
type AddValueFormat = (item: HFormItemProps, value: Record<string, any>) => Record<string, any>;
|
|
117
119
|
export interface addFormatItemModal {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: (
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
3
3
|
export default _default;
|
|
@@ -11,17 +11,20 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
|
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
12
|
import { TimePicker } from 'antd';
|
|
13
13
|
import { useTimePickerValue, useTimePickerChange } from './hooks.js';
|
|
14
|
+
import HFormConnect from '../Form/HFormConnect.js';
|
|
14
15
|
|
|
15
|
-
var _excluded = ["value", "format", "onChange", "disabledDate"];
|
|
16
|
+
var _excluded = ["value", "format", "onChange", "addFormat", "disabledDate"];
|
|
16
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
-
var
|
|
19
|
+
var Index = function Index(_ref) {
|
|
19
20
|
var value = _ref.value,
|
|
20
21
|
_ref$format = _ref.format,
|
|
21
22
|
format = _ref$format === void 0 ? "X" : _ref$format,
|
|
22
23
|
onChange = _ref.onChange,
|
|
24
|
+
addFormat = _ref.addFormat,
|
|
23
25
|
_disabledDate = _ref.disabledDate,
|
|
24
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
addFormat === null || addFormat === void 0 || addFormat({});
|
|
25
28
|
var timeVal = useTimePickerValue({
|
|
26
29
|
value: value,
|
|
27
30
|
format: format
|
|
@@ -38,7 +41,8 @@ var HTimePicker = (function (_ref) {
|
|
|
38
41
|
return !!(_disabledDate !== null && _disabledDate !== void 0 && _disabledDate(currentDate, timeVal));
|
|
39
42
|
}
|
|
40
43
|
}, props));
|
|
41
|
-
}
|
|
44
|
+
};
|
|
45
|
+
var HTimePicker = HFormConnect(Index);
|
|
42
46
|
|
|
43
47
|
export { HTimePicker as default };
|
|
44
48
|
// powered by hdj
|
package/es/TDPicker/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { HDatePickerProps } from "./modal";
|
|
2
1
|
import React from "react";
|
|
3
|
-
declare const
|
|
4
|
-
export default
|
|
2
|
+
declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
3
|
+
export default _default;
|
package/es/TDPicker/index.js
CHANGED
|
@@ -11,8 +11,9 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
|
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
12
|
import { DatePicker } from 'antd';
|
|
13
13
|
import { useTimeVal, useTimeChange } from './hooks.js';
|
|
14
|
+
import HFormConnect from '../Form/HFormConnect.js';
|
|
14
15
|
|
|
15
|
-
var _excluded = ["value", "onChange", "showTime", "format", "disabledDate"];
|
|
16
|
+
var _excluded = ["value", "onChange", "showTime", "format", "disabledDate", "addFormat"];
|
|
16
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
19
|
var Picker = DatePicker;
|
|
@@ -24,7 +25,9 @@ var Index = function Index(_ref) {
|
|
|
24
25
|
_ref$format = _ref.format,
|
|
25
26
|
format = _ref$format === void 0 ? "X" : _ref$format,
|
|
26
27
|
_disabledDate = _ref.disabledDate,
|
|
28
|
+
addFormat = _ref.addFormat,
|
|
27
29
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
addFormat === null || addFormat === void 0 || addFormat({});
|
|
28
31
|
var timeVal = useTimeVal({
|
|
29
32
|
value: value,
|
|
30
33
|
format: format
|
|
@@ -42,6 +45,7 @@ var Index = function Index(_ref) {
|
|
|
42
45
|
}
|
|
43
46
|
}, props));
|
|
44
47
|
};
|
|
48
|
+
var HDatePicker = HFormConnect(Index);
|
|
45
49
|
|
|
46
|
-
export {
|
|
50
|
+
export { HDatePicker as default };
|
|
47
51
|
// powered by hdj
|
package/es/TDPicker/modal.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface HDatePickerProps extends Omit<DatePickerProps, "onChange" | "fo
|
|
|
14
14
|
format?: string;
|
|
15
15
|
showTime?: boolean | SharedTimeProps<Moment>;
|
|
16
16
|
disabledDate?: DisabledDateFnModal;
|
|
17
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
17
18
|
}
|
|
18
19
|
export interface HRangePickerProps extends Omit<RangePickerProps, "onChange" | "format" | "ranges" | "value" | "disabledDate"> {
|
|
19
20
|
value?: [any, any] | Record<string, any>;
|
|
@@ -31,5 +32,6 @@ export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "fo
|
|
|
31
32
|
onChange?: (time?: Moment | string | number) => void;
|
|
32
33
|
format?: DurationInputArg2 | string;
|
|
33
34
|
disabledDate?: DisabledDateFnModal;
|
|
35
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
34
36
|
}
|
|
35
37
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DialogFormProps } from "../modal";
|
|
2
|
-
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, ...props }: DialogFormProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, autoClear, contentRender, ...props }: DialogFormProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
|
@@ -21,7 +21,7 @@ var Title = require('./Title.js');
|
|
|
21
21
|
var Footer = require('./Footer.js');
|
|
22
22
|
var FormConfigProvider = require('../../Form/Context/FormConfigProvider.js');
|
|
23
23
|
|
|
24
|
-
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange", "autoClear"];
|
|
24
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "closable", "initialValues", "labelWidth", "onOk", "onFinish", "size", "form", "footer", "params", "onValuesChange", "autoClear", "contentRender"];
|
|
25
25
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
27
|
var DrawerForm = (function (_ref) {
|
|
@@ -46,6 +46,7 @@ var DrawerForm = (function (_ref) {
|
|
|
46
46
|
onValuesChange = _ref.onValuesChange,
|
|
47
47
|
_ref$autoClear = _ref.autoClear,
|
|
48
48
|
autoClear = _ref$autoClear === void 0 ? true : _ref$autoClear,
|
|
49
|
+
contentRender = _ref.contentRender,
|
|
49
50
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
50
51
|
var currentForm = hooks.useCurrentForm(dialogForm);
|
|
51
52
|
var providerConfig = FormConfigProvider.useFormConfigContext();
|
|
@@ -89,6 +90,45 @@ var DrawerForm = (function (_ref) {
|
|
|
89
90
|
confirmLoading: loading
|
|
90
91
|
});
|
|
91
92
|
};
|
|
93
|
+
var node = jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({
|
|
94
|
+
configData: modalFormData,
|
|
95
|
+
initialValues: initValue,
|
|
96
|
+
onValuesChange: onValuesChange
|
|
97
|
+
}, props), {}, {
|
|
98
|
+
form: currentForm,
|
|
99
|
+
params: formParams,
|
|
100
|
+
onFinish: function () {
|
|
101
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
|
|
102
|
+
var result, close;
|
|
103
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
104
|
+
while (1) switch (_context.prev = _context.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
_context.next = 2;
|
|
107
|
+
return run(values, subParams);
|
|
108
|
+
case 2:
|
|
109
|
+
result = _context.sent;
|
|
110
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
|
|
111
|
+
if (!(close === false)) {
|
|
112
|
+
_context.next = 6;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
return _context.abrupt("return");
|
|
116
|
+
case 6:
|
|
117
|
+
cancel();
|
|
118
|
+
case 7:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
function onFinish(_x, _x2) {
|
|
125
|
+
return _onFinish.apply(this, arguments);
|
|
126
|
+
}
|
|
127
|
+
return onFinish;
|
|
128
|
+
}(),
|
|
129
|
+
infoRequest: infoRequest,
|
|
130
|
+
labelWidth: labelWidth
|
|
131
|
+
}));
|
|
92
132
|
return jsxRuntime.jsx(antd.Drawer, _objectSpread(_objectSpread({
|
|
93
133
|
visible: modalVisible,
|
|
94
134
|
title: jsxRuntime.jsx(Title.default, {
|
|
@@ -102,45 +142,7 @@ var DrawerForm = (function (_ref) {
|
|
|
102
142
|
destroyOnClose: true,
|
|
103
143
|
footer: footerComponent(),
|
|
104
144
|
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
105
|
-
children:
|
|
106
|
-
configData: modalFormData,
|
|
107
|
-
initialValues: initValue,
|
|
108
|
-
onValuesChange: onValuesChange
|
|
109
|
-
}, props), {}, {
|
|
110
|
-
form: currentForm,
|
|
111
|
-
params: formParams,
|
|
112
|
-
onFinish: function () {
|
|
113
|
-
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, subParams) {
|
|
114
|
-
var result, close;
|
|
115
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
116
|
-
while (1) switch (_context.prev = _context.next) {
|
|
117
|
-
case 0:
|
|
118
|
-
_context.next = 2;
|
|
119
|
-
return run(values, subParams);
|
|
120
|
-
case 2:
|
|
121
|
-
result = _context.sent;
|
|
122
|
-
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, subParams);
|
|
123
|
-
if (!(close === false)) {
|
|
124
|
-
_context.next = 6;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
return _context.abrupt("return");
|
|
128
|
-
case 6:
|
|
129
|
-
cancel();
|
|
130
|
-
case 7:
|
|
131
|
-
case "end":
|
|
132
|
-
return _context.stop();
|
|
133
|
-
}
|
|
134
|
-
}, _callee);
|
|
135
|
-
}));
|
|
136
|
-
function onFinish(_x, _x2) {
|
|
137
|
-
return _onFinish.apply(this, arguments);
|
|
138
|
-
}
|
|
139
|
-
return onFinish;
|
|
140
|
-
}(),
|
|
141
|
-
infoRequest: infoRequest,
|
|
142
|
-
labelWidth: labelWidth
|
|
143
|
-
}))
|
|
145
|
+
children: contentRender ? contentRender(node, currentForm) : node
|
|
144
146
|
}))
|
|
145
147
|
}));
|
|
146
148
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DialogFormProps } from "./modal";
|
|
2
|
-
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, ...props }: DialogFormProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, autoClear, contentRender, ...props }: DialogFormProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
|
@@ -19,7 +19,7 @@ var index = require('../Form/index.js');
|
|
|
19
19
|
var FormConfigProvider = require('../Form/Context/FormConfigProvider.js');
|
|
20
20
|
var hooks = require('./hooks.js');
|
|
21
21
|
|
|
22
|
-
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange", "autoClear"];
|
|
22
|
+
var _excluded = ["visible", "title", "onCancel", "configData", "infoRequest", "request", "afterClose", "dialogForm", "initialValues", "onFinish", "params", "onOk", "onValuesChange", "autoClear", "contentRender"];
|
|
23
23
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
24
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
25
|
var ModalForm = (function (_ref) {
|
|
@@ -38,6 +38,7 @@ var ModalForm = (function (_ref) {
|
|
|
38
38
|
onValuesChange = _ref.onValuesChange,
|
|
39
39
|
_ref$autoClear = _ref.autoClear,
|
|
40
40
|
autoClear = _ref$autoClear === void 0 ? true : _ref$autoClear,
|
|
41
|
+
contentRender = _ref.contentRender,
|
|
41
42
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
43
|
var currentForm = hooks.useCurrentForm(dialogForm);
|
|
43
44
|
var providerConfig = FormConfigProvider.useFormConfigContext();
|
|
@@ -68,6 +69,44 @@ var ModalForm = (function (_ref) {
|
|
|
68
69
|
}),
|
|
69
70
|
loading = _useSub.loading,
|
|
70
71
|
run = _useSub.run;
|
|
72
|
+
var node = jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({
|
|
73
|
+
configData: modalFormData,
|
|
74
|
+
initialValues: initValue,
|
|
75
|
+
onValuesChange: onValuesChange,
|
|
76
|
+
onFinish: function () {
|
|
77
|
+
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
78
|
+
var result, close;
|
|
79
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
80
|
+
while (1) switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
_context.next = 2;
|
|
83
|
+
return run(values, outParams);
|
|
84
|
+
case 2:
|
|
85
|
+
result = _context.sent;
|
|
86
|
+
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
87
|
+
if (!(close === false)) {
|
|
88
|
+
_context.next = 6;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
return _context.abrupt("return");
|
|
92
|
+
case 6:
|
|
93
|
+
cancel();
|
|
94
|
+
case 7:
|
|
95
|
+
case "end":
|
|
96
|
+
return _context.stop();
|
|
97
|
+
}
|
|
98
|
+
}, _callee);
|
|
99
|
+
}));
|
|
100
|
+
function onFinish(_x, _x2) {
|
|
101
|
+
return _onFinish.apply(this, arguments);
|
|
102
|
+
}
|
|
103
|
+
return onFinish;
|
|
104
|
+
}()
|
|
105
|
+
}, props), {}, {
|
|
106
|
+
params: formParams,
|
|
107
|
+
form: currentForm,
|
|
108
|
+
infoRequest: infoRequest
|
|
109
|
+
}));
|
|
71
110
|
return jsxRuntime.jsx(antd.Modal, _objectSpread(_objectSpread({
|
|
72
111
|
title: modalTitle,
|
|
73
112
|
visible: modalVisible,
|
|
@@ -83,44 +122,7 @@ var ModalForm = (function (_ref) {
|
|
|
83
122
|
onOk: currentForm.submit,
|
|
84
123
|
destroyOnClose: true,
|
|
85
124
|
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
86
|
-
children:
|
|
87
|
-
configData: modalFormData,
|
|
88
|
-
initialValues: initValue,
|
|
89
|
-
onValuesChange: onValuesChange,
|
|
90
|
-
onFinish: function () {
|
|
91
|
-
var _onFinish = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, outParams) {
|
|
92
|
-
var result, close;
|
|
93
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
94
|
-
while (1) switch (_context.prev = _context.next) {
|
|
95
|
-
case 0:
|
|
96
|
-
_context.next = 2;
|
|
97
|
-
return run(values, outParams);
|
|
98
|
-
case 2:
|
|
99
|
-
result = _context.sent;
|
|
100
|
-
close = onOk === null || onOk === void 0 ? void 0 : onOk(result, outParams);
|
|
101
|
-
if (!(close === false)) {
|
|
102
|
-
_context.next = 6;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
return _context.abrupt("return");
|
|
106
|
-
case 6:
|
|
107
|
-
cancel();
|
|
108
|
-
case 7:
|
|
109
|
-
case "end":
|
|
110
|
-
return _context.stop();
|
|
111
|
-
}
|
|
112
|
-
}, _callee);
|
|
113
|
-
}));
|
|
114
|
-
function onFinish(_x, _x2) {
|
|
115
|
-
return _onFinish.apply(this, arguments);
|
|
116
|
-
}
|
|
117
|
-
return onFinish;
|
|
118
|
-
}()
|
|
119
|
-
}, props), {}, {
|
|
120
|
-
params: formParams,
|
|
121
|
-
form: currentForm,
|
|
122
|
-
infoRequest: infoRequest
|
|
123
|
-
}))
|
|
125
|
+
children: contentRender ? contentRender === null || contentRender === void 0 ? void 0 : contentRender(node, currentForm) : node
|
|
124
126
|
}))
|
|
125
127
|
}));
|
|
126
128
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModalProps } from "antd";
|
|
2
2
|
import type { HFormInstance, HItemProps, HFormProps } from "../Form/modal";
|
|
3
3
|
import type { PromiseFnResult } from "../modal";
|
|
4
|
+
import React from "react";
|
|
4
5
|
type RootProps = HFormProps & ModalProps;
|
|
5
6
|
export interface ModifyPropsModal<P = any> {
|
|
6
7
|
configData: HItemProps[];
|
|
@@ -32,5 +33,6 @@ export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFi
|
|
|
32
33
|
onOk?: (data: T, params: P) => boolean | void;
|
|
33
34
|
infoRequest?: (params: P) => Promise<T>;
|
|
34
35
|
autoClear?: boolean;
|
|
36
|
+
contentRender?: (dom: React.ReactNode, form: HDialogFormInstance) => React.ReactNode;
|
|
35
37
|
}
|
|
36
38
|
export {};
|
package/lib/Form/HFormConnect.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
5
6
|
require('core-js/modules/es.object.keys.js');
|
|
7
|
+
require('core-js/modules/es.function.name.js');
|
|
6
8
|
require('core-js/modules/es.symbol.js');
|
|
7
9
|
require('core-js/modules/es.array.filter.js');
|
|
8
10
|
require('core-js/modules/es.object.to-string.js');
|
|
9
11
|
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
10
12
|
require('core-js/modules/web.dom-collections.for-each.js');
|
|
11
13
|
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
12
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
|
-
require('core-js/modules/es.function.name.js');
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
var index = require('./Context/index.js');
|
|
16
16
|
var React = require('react');
|
|
@@ -18,19 +18,26 @@ var React = require('react');
|
|
|
18
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
20
|
var formatMaker = function formatMaker(itemProps, formats) {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
var _ref = formats || {},
|
|
22
|
+
inputValue = _ref.inputValue,
|
|
23
|
+
outputValue = _ref.outputValue;
|
|
24
|
+
var _itemProps$initValueP = itemProps.initValueProvider,
|
|
25
|
+
initValueProvider = _itemProps$initValueP === void 0 ? inputValue : _itemProps$initValueP,
|
|
26
|
+
_itemProps$subProvide = itemProps.subProvider,
|
|
27
|
+
subProvider = _itemProps$subProvide === void 0 ? outputValue : _itemProps$subProvide;
|
|
28
|
+
var resultObj = {};
|
|
29
|
+
if (initValueProvider) {
|
|
30
|
+
resultObj.inputValue = function (value) {
|
|
31
|
+
return initValueProvider(itemProps, value);
|
|
32
|
+
};
|
|
23
33
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return _outputValue(itemProps, value);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
+
if (subProvider) {
|
|
35
|
+
resultObj.outputValue = function (value) {
|
|
36
|
+
return subProvider(itemProps, value);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
var keysLen = Object.keys(resultObj).length;
|
|
40
|
+
return keysLen === 0 ? undefined : resultObj;
|
|
34
41
|
};
|
|
35
42
|
var HFormConnect = (function (component) {
|
|
36
43
|
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export interface HFormItemProps extends HItemProps {
|
|
|
60
60
|
value?: any;
|
|
61
61
|
onChange?: (val: any, item: any) => void;
|
|
62
62
|
itemSpan?: ColProps;
|
|
63
|
+
initValueProvider?: AddValueFormat;
|
|
64
|
+
subProvider?: AddValueFormat;
|
|
63
65
|
}
|
|
64
66
|
export type argsFn = (...args: any[]) => void;
|
|
65
67
|
export interface FormContextProps {
|
|
@@ -110,8 +112,8 @@ export interface ConnectConfigModal {
|
|
|
110
112
|
}
|
|
111
113
|
type ValueFormat = (value: Record<string, any>) => Record<string, any>;
|
|
112
114
|
export interface FormatItemModal {
|
|
113
|
-
inputValue
|
|
114
|
-
outputValue
|
|
115
|
+
inputValue?: ValueFormat;
|
|
116
|
+
outputValue?: ValueFormat;
|
|
115
117
|
}
|
|
116
118
|
type AddValueFormat = (item: HFormItemProps, value: Record<string, any>) => Record<string, any>;
|
|
117
119
|
export interface addFormatItemModal {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: (
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
3
3
|
export default _default;
|
|
@@ -14,17 +14,20 @@ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWit
|
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
var antd = require('antd');
|
|
16
16
|
var hooks = require('./hooks.js');
|
|
17
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
17
18
|
|
|
18
|
-
var _excluded = ["value", "format", "onChange", "disabledDate"];
|
|
19
|
+
var _excluded = ["value", "format", "onChange", "addFormat", "disabledDate"];
|
|
19
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
var
|
|
22
|
+
var Index = function Index(_ref) {
|
|
22
23
|
var value = _ref.value,
|
|
23
24
|
_ref$format = _ref.format,
|
|
24
25
|
format = _ref$format === void 0 ? "X" : _ref$format,
|
|
25
26
|
onChange = _ref.onChange,
|
|
27
|
+
addFormat = _ref.addFormat,
|
|
26
28
|
_disabledDate = _ref.disabledDate,
|
|
27
29
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
addFormat === null || addFormat === void 0 || addFormat({});
|
|
28
31
|
var timeVal = hooks.useTimePickerValue({
|
|
29
32
|
value: value,
|
|
30
33
|
format: format
|
|
@@ -41,7 +44,8 @@ var HTimePicker = (function (_ref) {
|
|
|
41
44
|
return !!(_disabledDate !== null && _disabledDate !== void 0 && _disabledDate(currentDate, timeVal));
|
|
42
45
|
}
|
|
43
46
|
}, props));
|
|
44
|
-
}
|
|
47
|
+
};
|
|
48
|
+
var HTimePicker = HFormConnect.default(Index);
|
|
45
49
|
|
|
46
50
|
exports.default = HTimePicker;
|
|
47
51
|
// powered by h
|
package/lib/TDPicker/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { HDatePickerProps } from "./modal";
|
|
2
1
|
import React from "react";
|
|
3
|
-
declare const
|
|
4
|
-
export default
|
|
2
|
+
declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
|
|
3
|
+
export default _default;
|
package/lib/TDPicker/index.js
CHANGED
|
@@ -14,8 +14,9 @@ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWit
|
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
var antd = require('antd');
|
|
16
16
|
var hooks = require('./hooks.js');
|
|
17
|
+
var HFormConnect = require('../Form/HFormConnect.js');
|
|
17
18
|
|
|
18
|
-
var _excluded = ["value", "onChange", "showTime", "format", "disabledDate"];
|
|
19
|
+
var _excluded = ["value", "onChange", "showTime", "format", "disabledDate", "addFormat"];
|
|
19
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
22
|
var Picker = antd.DatePicker;
|
|
@@ -27,7 +28,9 @@ var Index = function Index(_ref) {
|
|
|
27
28
|
_ref$format = _ref.format,
|
|
28
29
|
format = _ref$format === void 0 ? "X" : _ref$format,
|
|
29
30
|
_disabledDate = _ref.disabledDate,
|
|
31
|
+
addFormat = _ref.addFormat,
|
|
30
32
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
addFormat === null || addFormat === void 0 || addFormat({});
|
|
31
34
|
var timeVal = hooks.useTimeVal({
|
|
32
35
|
value: value,
|
|
33
36
|
format: format
|
|
@@ -45,6 +48,7 @@ var Index = function Index(_ref) {
|
|
|
45
48
|
}
|
|
46
49
|
}, props));
|
|
47
50
|
};
|
|
51
|
+
var HDatePicker = HFormConnect.default(Index);
|
|
48
52
|
|
|
49
|
-
exports.default =
|
|
53
|
+
exports.default = HDatePicker;
|
|
50
54
|
// powered by h
|
package/lib/TDPicker/modal.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface HDatePickerProps extends Omit<DatePickerProps, "onChange" | "fo
|
|
|
14
14
|
format?: string;
|
|
15
15
|
showTime?: boolean | SharedTimeProps<Moment>;
|
|
16
16
|
disabledDate?: DisabledDateFnModal;
|
|
17
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
17
18
|
}
|
|
18
19
|
export interface HRangePickerProps extends Omit<RangePickerProps, "onChange" | "format" | "ranges" | "value" | "disabledDate"> {
|
|
19
20
|
value?: [any, any] | Record<string, any>;
|
|
@@ -31,5 +32,6 @@ export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "fo
|
|
|
31
32
|
onChange?: (time?: Moment | string | number) => void;
|
|
32
33
|
format?: DurationInputArg2 | string;
|
|
33
34
|
disabledDate?: DisabledDateFnModal;
|
|
35
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
34
36
|
}
|
|
35
37
|
export {};
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export default ({
|
|
|
27
27
|
params,
|
|
28
28
|
onValuesChange,
|
|
29
29
|
autoClear = true,
|
|
30
|
+
contentRender,
|
|
30
31
|
...props
|
|
31
32
|
}: DialogFormProps) => {
|
|
32
33
|
const currentForm = useCurrentForm(dialogForm);
|
|
@@ -71,6 +72,24 @@ export default ({
|
|
|
71
72
|
)
|
|
72
73
|
);
|
|
73
74
|
};
|
|
75
|
+
const node=<HForm
|
|
76
|
+
configData={modalFormData}
|
|
77
|
+
initialValues={initValue}
|
|
78
|
+
onValuesChange={onValuesChange}
|
|
79
|
+
{...props}
|
|
80
|
+
form={currentForm}
|
|
81
|
+
params={formParams}
|
|
82
|
+
onFinish={async (values, subParams) => {
|
|
83
|
+
const result = await run(values, subParams);
|
|
84
|
+
const close = onOk?.(result, subParams);
|
|
85
|
+
if (close === false) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
cancel();
|
|
89
|
+
}}
|
|
90
|
+
infoRequest={infoRequest}
|
|
91
|
+
labelWidth={labelWidth}
|
|
92
|
+
/>;
|
|
74
93
|
return (
|
|
75
94
|
<Drawer
|
|
76
95
|
visible={modalVisible}
|
|
@@ -82,24 +101,7 @@ export default ({
|
|
|
82
101
|
footer={footerComponent()}
|
|
83
102
|
>
|
|
84
103
|
<FormConfigProvider {...providerConfig}>
|
|
85
|
-
|
|
86
|
-
configData={modalFormData}
|
|
87
|
-
initialValues={initValue}
|
|
88
|
-
onValuesChange={onValuesChange}
|
|
89
|
-
{...props}
|
|
90
|
-
form={currentForm}
|
|
91
|
-
params={formParams}
|
|
92
|
-
onFinish={async (values, subParams) => {
|
|
93
|
-
const result = await run(values, subParams);
|
|
94
|
-
const close = onOk?.(result, subParams);
|
|
95
|
-
if (close === false) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
cancel();
|
|
99
|
-
}}
|
|
100
|
-
infoRequest={infoRequest}
|
|
101
|
-
labelWidth={labelWidth}
|
|
102
|
-
/>
|
|
104
|
+
{contentRender?contentRender(node,currentForm):node}
|
|
103
105
|
</FormConfigProvider>
|
|
104
106
|
</Drawer>
|
|
105
107
|
);
|
|
@@ -20,6 +20,7 @@ export default ({
|
|
|
20
20
|
onOk,
|
|
21
21
|
onValuesChange,
|
|
22
22
|
autoClear = true,
|
|
23
|
+
contentRender,
|
|
23
24
|
...props
|
|
24
25
|
}: DialogFormProps) => {
|
|
25
26
|
const currentForm = useCurrentForm(dialogForm);
|
|
@@ -47,6 +48,23 @@ export default ({
|
|
|
47
48
|
setModalVisible(false);
|
|
48
49
|
};
|
|
49
50
|
const { loading, run } = useSub({ request, onFinish });
|
|
51
|
+
const node=<HForm
|
|
52
|
+
configData={modalFormData}
|
|
53
|
+
initialValues={initValue}
|
|
54
|
+
onValuesChange={onValuesChange}
|
|
55
|
+
onFinish={async (values, outParams) => {
|
|
56
|
+
const result = await run(values, outParams);
|
|
57
|
+
const close = onOk?.(result, outParams);
|
|
58
|
+
if (close === false) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
cancel();
|
|
62
|
+
}}
|
|
63
|
+
{...props}
|
|
64
|
+
params={formParams}
|
|
65
|
+
form={currentForm}
|
|
66
|
+
infoRequest={infoRequest}
|
|
67
|
+
/>;
|
|
50
68
|
return (
|
|
51
69
|
<Modal
|
|
52
70
|
title={modalTitle}
|
|
@@ -64,23 +82,7 @@ export default ({
|
|
|
64
82
|
destroyOnClose={true}
|
|
65
83
|
>
|
|
66
84
|
<FormConfigProvider {...providerConfig}>
|
|
67
|
-
|
|
68
|
-
configData={modalFormData}
|
|
69
|
-
initialValues={initValue}
|
|
70
|
-
onValuesChange={onValuesChange}
|
|
71
|
-
onFinish={async (values, outParams) => {
|
|
72
|
-
const result = await run(values, outParams);
|
|
73
|
-
const close = onOk?.(result, outParams);
|
|
74
|
-
if (close === false) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
cancel();
|
|
78
|
-
}}
|
|
79
|
-
{...props}
|
|
80
|
-
params={formParams}
|
|
81
|
-
form={currentForm}
|
|
82
|
-
infoRequest={infoRequest}
|
|
83
|
-
/>
|
|
85
|
+
{contentRender?contentRender?.(node, currentForm):node}
|
|
84
86
|
</FormConfigProvider>
|
|
85
87
|
</Modal>
|
|
86
88
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModalProps } from "antd";
|
|
2
2
|
import type { HFormInstance, HItemProps, HFormProps } from "../Form/modal";
|
|
3
3
|
import type { PromiseFnResult } from "../modal";
|
|
4
|
+
import React from "react";
|
|
4
5
|
|
|
5
6
|
type RootProps = HFormProps & ModalProps;
|
|
6
7
|
|
|
@@ -36,4 +37,5 @@ export interface DialogFormProps<P = any, T = any>
|
|
|
36
37
|
onOk?: (data: T, params: P) => boolean | void;
|
|
37
38
|
infoRequest?: (params: P) => Promise<T>;
|
|
38
39
|
autoClear?: boolean;
|
|
40
|
+
contentRender?:(dom:React.ReactNode,form:HDialogFormInstance)=>React.ReactNode;
|
|
39
41
|
}
|
|
@@ -5,23 +5,30 @@ import type { ConnectConfigModal } from "@/components/Form/modal";
|
|
|
5
5
|
import type { addFormatItemModal } from "@/components/Form/modal";
|
|
6
6
|
import type { ConnectResultProps } from "@/components/Form/modal";
|
|
7
7
|
import type { argsFn } from "@/components/Form/modal";
|
|
8
|
-
|
|
8
|
+
interface ResultModal {
|
|
9
|
+
inputValue?: (value: Record<string, any>) => Record<string, any>;
|
|
10
|
+
outputValue?: (value: Record<string, any>) => Record<string, any>;
|
|
11
|
+
}
|
|
9
12
|
const formatMaker = (
|
|
10
13
|
itemProps: HFormItemProps,
|
|
11
14
|
formats?: addFormatItemModal
|
|
12
15
|
) => {
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
const { inputValue, outputValue } = formats || {};
|
|
17
|
+
const { initValueProvider = inputValue, subProvider = outputValue } =
|
|
18
|
+
itemProps;
|
|
19
|
+
const resultObj: ResultModal = {};
|
|
20
|
+
if (initValueProvider) {
|
|
21
|
+
resultObj.inputValue = (value) => {
|
|
22
|
+
return initValueProvider(itemProps, value);
|
|
23
|
+
};
|
|
15
24
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
+
if (subProvider) {
|
|
26
|
+
resultObj.outputValue = (value) => {
|
|
27
|
+
return subProvider(itemProps, value);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const keysLen = Object.keys(resultObj).length;
|
|
31
|
+
return keysLen === 0 ? undefined : resultObj;
|
|
25
32
|
};
|
|
26
33
|
|
|
27
34
|
export default (
|
|
@@ -140,7 +140,7 @@ export default () => {
|
|
|
140
140
|
Reflect.deleteProperty(dispatchSourceData, key);
|
|
141
141
|
},
|
|
142
142
|
outputValues(value) {
|
|
143
|
-
const val=value||form.getFieldsValue()
|
|
143
|
+
const val = value || form.getFieldsValue();
|
|
144
144
|
return this.formatValues(val, "outputValue");
|
|
145
145
|
},
|
|
146
146
|
...form,
|
|
@@ -107,6 +107,8 @@ export interface HFormItemProps extends HItemProps {
|
|
|
107
107
|
value?: any;
|
|
108
108
|
onChange?: (val: any, item: any) => void;
|
|
109
109
|
itemSpan?: ColProps;
|
|
110
|
+
initValueProvider?: AddValueFormat;
|
|
111
|
+
subProvider?: AddValueFormat;
|
|
110
112
|
}
|
|
111
113
|
export type argsFn = (...args: any[]) => void;
|
|
112
114
|
export interface FormContextProps {
|
|
@@ -167,8 +169,8 @@ export interface ConnectConfigModal {
|
|
|
167
169
|
type ValueFormat = (value: Record<string, any>) => Record<string, any>;
|
|
168
170
|
|
|
169
171
|
export interface FormatItemModal {
|
|
170
|
-
inputValue
|
|
171
|
-
outputValue
|
|
172
|
+
inputValue?: ValueFormat;
|
|
173
|
+
outputValue?: ValueFormat;
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
type AddValueFormat = (
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { TimePicker } from "antd";
|
|
2
2
|
import type { HTimePickerProps } from "./modal";
|
|
3
3
|
import { useTimePickerChange, useTimePickerValue } from "./hooks";
|
|
4
|
+
import HFormConnect from "../Form/HFormConnect";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const Index = ({
|
|
6
7
|
value,
|
|
7
8
|
format = "X",
|
|
8
9
|
onChange,
|
|
10
|
+
addFormat,
|
|
9
11
|
disabledDate,
|
|
10
12
|
...props
|
|
11
13
|
}: HTimePickerProps) => {
|
|
14
|
+
addFormat?.({});
|
|
12
15
|
const timeVal = useTimePickerValue({ value, format });
|
|
13
16
|
const change = useTimePickerChange({ value, format, onChange });
|
|
14
17
|
|
|
@@ -23,3 +26,4 @@ export default ({
|
|
|
23
26
|
/>
|
|
24
27
|
);
|
|
25
28
|
};
|
|
29
|
+
export default HFormConnect(Index);
|
|
@@ -2,6 +2,7 @@ import { DatePicker } from "antd";
|
|
|
2
2
|
import type { HDatePickerProps } from "./modal";
|
|
3
3
|
import { useTimeChange, useTimeVal } from "./hooks";
|
|
4
4
|
import React from "react";
|
|
5
|
+
import HFormConnect from "../Form/HFormConnect";
|
|
5
6
|
const Picker = DatePicker as any;
|
|
6
7
|
const Index: React.FC<HDatePickerProps> = ({
|
|
7
8
|
value,
|
|
@@ -9,8 +10,10 @@ const Index: React.FC<HDatePickerProps> = ({
|
|
|
9
10
|
showTime = true,
|
|
10
11
|
format = "X",
|
|
11
12
|
disabledDate,
|
|
13
|
+
addFormat,
|
|
12
14
|
...props
|
|
13
15
|
}) => {
|
|
16
|
+
addFormat?.({});
|
|
14
17
|
const timeVal = useTimeVal({ value, format });
|
|
15
18
|
const change = useTimeChange({ format, onChange });
|
|
16
19
|
return (
|
|
@@ -25,4 +28,4 @@ const Index: React.FC<HDatePickerProps> = ({
|
|
|
25
28
|
/>
|
|
26
29
|
);
|
|
27
30
|
};
|
|
28
|
-
export default Index;
|
|
31
|
+
export default HFormConnect(Index);
|
|
@@ -19,6 +19,7 @@ export interface HDatePickerProps
|
|
|
19
19
|
format?: string;
|
|
20
20
|
showTime?: boolean | SharedTimeProps<Moment>;
|
|
21
21
|
disabledDate?: DisabledDateFnModal;
|
|
22
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
22
23
|
}
|
|
23
24
|
export interface HRangePickerProps
|
|
24
25
|
extends Omit<
|
|
@@ -43,4 +44,5 @@ export interface HTimePickerProps
|
|
|
43
44
|
onChange?: (time?: Moment | string | number) => void;
|
|
44
45
|
format?: DurationInputArg2 | string;
|
|
45
46
|
disabledDate?: DisabledDateFnModal;
|
|
47
|
+
addFormat?: (config: Record<string, addFormatItemModal>) => void;
|
|
46
48
|
}
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -89,6 +89,19 @@ const formData = (options) => {
|
|
|
89
89
|
type: "datePicker",
|
|
90
90
|
hover: "时间选择",
|
|
91
91
|
helper: "帮助我",
|
|
92
|
+
itemProps: {
|
|
93
|
+
subProvider: (item, val) => {
|
|
94
|
+
return {
|
|
95
|
+
datePicker: "fakfjkfjsklfjskljsak",
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
initValueProvider: (item, val) => {
|
|
99
|
+
console.log(val, "vvv");
|
|
100
|
+
return {
|
|
101
|
+
datePicker: 1706510695,
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
},
|
|
92
105
|
rules: [{ required: true }],
|
|
93
106
|
},
|
|
94
107
|
{
|
|
@@ -176,6 +176,12 @@ export default () => {
|
|
|
176
176
|
configData={data}
|
|
177
177
|
labelWidth={88}
|
|
178
178
|
autoClear={false}
|
|
179
|
+
contentRender={(node,form)=>{
|
|
180
|
+
return <div>
|
|
181
|
+
<div>测试一些</div>
|
|
182
|
+
{node}
|
|
183
|
+
</div>
|
|
184
|
+
}}
|
|
179
185
|
request={(val, params) => {
|
|
180
186
|
console.log(val, params);
|
|
181
187
|
}}
|