@hw-component/form 0.0.4-beta-v6 → 0.0.4-beta-v8
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/Form/hooks/index.js +5 -2
- package/es/Form/hooks/useHForm.js +10 -6
- package/es/Form/hooks/useInitConfigData.js +17 -6
- package/es/Form/modal.d.ts +2 -1
- package/lib/Form/hooks/index.js +5 -2
- package/lib/Form/hooks/useHForm.js +10 -6
- package/lib/Form/hooks/useInitConfigData.js +17 -6
- package/lib/Form/modal.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/Form/hooks/index.ts +3 -2
- package/src/components/Form/hooks/useHForm.ts +9 -5
- package/src/components/Form/hooks/useInitConfigData.tsx +12 -5
- package/src/components/Form/modal.ts +2 -1
- package/src/pages/ModalForm/index.tsx +19 -0
package/es/Form/hooks/index.js
CHANGED
|
@@ -124,14 +124,17 @@ var useValuesChange = function useValuesChange(_ref4) {
|
|
|
124
124
|
if (!!dispatchItem) {
|
|
125
125
|
var dispatchKey = _Object$keys(dispatchItem);
|
|
126
126
|
_forEachInstanceProperty(dispatchKey).call(dispatchKey, function (name) {
|
|
127
|
-
var
|
|
127
|
+
var _dispatchItem$name = dispatchItem[name],
|
|
128
|
+
fnKey = _dispatchItem$name.fnKey,
|
|
129
|
+
reset = _dispatchItem$name.reset;
|
|
128
130
|
form.dispatch({
|
|
129
|
-
key:
|
|
131
|
+
key: fnKey,
|
|
130
132
|
name: name
|
|
131
133
|
}, {
|
|
132
134
|
changedValues: changedValues,
|
|
133
135
|
oldValues: values
|
|
134
136
|
});
|
|
137
|
+
reset && form.resetFields([name]);
|
|
135
138
|
});
|
|
136
139
|
}
|
|
137
140
|
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(changedValues, values);
|
|
@@ -9,8 +9,8 @@ import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray
|
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
10
10
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
11
11
|
import _Promise from '@babel/runtime-corejs3/core-js/promise';
|
|
12
|
-
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
13
12
|
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
13
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
14
14
|
import _Reflect$deleteProperty from '@babel/runtime-corejs3/core-js/reflect/delete-property';
|
|
15
15
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js/instance/concat';
|
|
16
16
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
@@ -26,12 +26,12 @@ var useHForm = (function () {
|
|
|
26
26
|
return useMemo(function () {
|
|
27
27
|
var formatSourceData = {};
|
|
28
28
|
var dispatchSourceData = {};
|
|
29
|
-
var initDispatch =
|
|
29
|
+
var initDispatch = {};
|
|
30
30
|
var cacheValues = {};
|
|
31
31
|
var isLoading = false;
|
|
32
32
|
var norAddItemDispatch = function norAddItemDispatch(name, manual, fn) {
|
|
33
|
-
if (manual === false) {
|
|
34
|
-
initDispatch
|
|
33
|
+
if (manual === false && name) {
|
|
34
|
+
initDispatch[name] = fn;
|
|
35
35
|
}
|
|
36
36
|
if (!name) {
|
|
37
37
|
return {
|
|
@@ -54,8 +54,9 @@ var useHForm = (function () {
|
|
|
54
54
|
newValue = this.formatValues(cacheValues);
|
|
55
55
|
form.setFieldsValue(newValue);
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
var initKeys = _Object$keys(initDispatch);
|
|
58
|
+
_forEachInstanceProperty(initKeys).call(initKeys, function (key) {
|
|
59
|
+
initDispatch[key]({
|
|
59
60
|
changedValues: newValue,
|
|
60
61
|
oldValues: newValue
|
|
61
62
|
});
|
|
@@ -136,6 +137,9 @@ var useHForm = (function () {
|
|
|
136
137
|
} else {
|
|
137
138
|
defaultFn.push(fn);
|
|
138
139
|
}
|
|
140
|
+
if (manual === false && name) {
|
|
141
|
+
initDispatch[name] = fn;
|
|
142
|
+
}
|
|
139
143
|
dispatchSourceData[key] = {
|
|
140
144
|
keysFn: keysFn,
|
|
141
145
|
defaultFn: defaultFn
|
|
@@ -96,12 +96,19 @@ var itemControl = function itemControl(item, form, defaultComponents) {
|
|
|
96
96
|
};
|
|
97
97
|
var itemDispatchProvider = function itemDispatchProvider(name, config, dispatchSourceData) {
|
|
98
98
|
var dependencies = config.dependencies,
|
|
99
|
-
fnKey = config.fnKey
|
|
99
|
+
fnKey = config.fnKey,
|
|
100
|
+
reset = config.reset;
|
|
100
101
|
var itemDispatch = dispatchSourceData[dependencies];
|
|
101
102
|
if (!itemDispatch) {
|
|
102
|
-
return _defineProperty({}, dependencies, _defineProperty({}, name,
|
|
103
|
+
return _defineProperty({}, dependencies, _defineProperty({}, name, {
|
|
104
|
+
fnKey: fnKey,
|
|
105
|
+
reset: reset
|
|
106
|
+
}));
|
|
103
107
|
}
|
|
104
|
-
var itemNameDispatch = _defineProperty({}, name,
|
|
108
|
+
var itemNameDispatch = _defineProperty({}, name, {
|
|
109
|
+
fnKey: fnKey,
|
|
110
|
+
reset: reset
|
|
111
|
+
});
|
|
105
112
|
return _defineProperty({}, dependencies, _objectSpread(_objectSpread({}, itemDispatch), itemNameDispatch));
|
|
106
113
|
};
|
|
107
114
|
var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
@@ -115,7 +122,9 @@ var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
|
115
122
|
_dispatch$dependencie = dispatch.dependencies,
|
|
116
123
|
dispatchDependencies = _dispatch$dependencie === void 0 ? dependencies : _dispatch$dependencie,
|
|
117
124
|
_dispatch$manual = dispatch.manual,
|
|
118
|
-
manual = _dispatch$manual === void 0 ? true : _dispatch$manual
|
|
125
|
+
manual = _dispatch$manual === void 0 ? true : _dispatch$manual,
|
|
126
|
+
_dispatch$reset = dispatch.reset,
|
|
127
|
+
reset = _dispatch$reset === void 0 ? true : _dispatch$reset;
|
|
119
128
|
if (!fnKey) {
|
|
120
129
|
return {};
|
|
121
130
|
}
|
|
@@ -125,7 +134,8 @@ var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
|
125
134
|
var itemDispatch = itemDispatchProvider(name, {
|
|
126
135
|
dependencies: key,
|
|
127
136
|
fnKey: fnKey,
|
|
128
|
-
manual: manual
|
|
137
|
+
manual: manual,
|
|
138
|
+
reset: reset
|
|
129
139
|
}, dispatchSourceData);
|
|
130
140
|
allDispatch = _objectSpread(_objectSpread({}, allDispatch), itemDispatch);
|
|
131
141
|
});
|
|
@@ -134,7 +144,8 @@ var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
|
134
144
|
var itemDispatch = itemDispatchProvider(name, {
|
|
135
145
|
dependencies: dispatchDependencies,
|
|
136
146
|
fnKey: fnKey,
|
|
137
|
-
manual: manual
|
|
147
|
+
manual: manual,
|
|
148
|
+
reset: reset
|
|
138
149
|
}, dispatchSourceData);
|
|
139
150
|
return _objectSpread(_objectSpread({}, dispatchSourceData), itemDispatch);
|
|
140
151
|
};
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -23,11 +23,12 @@ export interface HoverModal {
|
|
|
23
23
|
type HelperModal = (form: HFormInstance) => React.ReactNode | string;
|
|
24
24
|
export type HideModal = (form: HFormInstance) => boolean;
|
|
25
25
|
export type AddDispatchListenerFn = (action: ActionModal, fn: argsFn) => void;
|
|
26
|
-
export type DispatchSourceDataModal = Record<string, Record<string,
|
|
26
|
+
export type DispatchSourceDataModal = Record<string, Record<string, DispatchModal>>;
|
|
27
27
|
export interface DispatchModal<T = string | string[]> {
|
|
28
28
|
fnKey?: string;
|
|
29
29
|
dependencies?: T;
|
|
30
30
|
manual?: boolean;
|
|
31
|
+
reset?: boolean;
|
|
31
32
|
}
|
|
32
33
|
export interface HItemProps extends Omit<FormItemProps, "name"> {
|
|
33
34
|
type?: string;
|
package/lib/Form/hooks/index.js
CHANGED
|
@@ -125,14 +125,17 @@ var useValuesChange = function useValuesChange(_ref4) {
|
|
|
125
125
|
if (!!dispatchItem) {
|
|
126
126
|
var dispatchKey = _Object$keys(dispatchItem);
|
|
127
127
|
_forEachInstanceProperty(dispatchKey).call(dispatchKey, function (name) {
|
|
128
|
-
var
|
|
128
|
+
var _dispatchItem$name = dispatchItem[name],
|
|
129
|
+
fnKey = _dispatchItem$name.fnKey,
|
|
130
|
+
reset = _dispatchItem$name.reset;
|
|
129
131
|
form.dispatch({
|
|
130
|
-
key:
|
|
132
|
+
key: fnKey,
|
|
131
133
|
name: name
|
|
132
134
|
}, {
|
|
133
135
|
changedValues: changedValues,
|
|
134
136
|
oldValues: values
|
|
135
137
|
});
|
|
138
|
+
reset && form.resetFields([name]);
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
141
|
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(changedValues, values);
|
|
@@ -12,8 +12,8 @@ var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArr
|
|
|
12
12
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
13
13
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
14
14
|
var _Promise = require('@babel/runtime-corejs3/core-js/promise');
|
|
15
|
-
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
16
15
|
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
16
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
17
17
|
var _Reflect$deleteProperty = require('@babel/runtime-corejs3/core-js/reflect/delete-property');
|
|
18
18
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/concat');
|
|
19
19
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
@@ -29,12 +29,12 @@ var useHForm = (function () {
|
|
|
29
29
|
return React.useMemo(function () {
|
|
30
30
|
var formatSourceData = {};
|
|
31
31
|
var dispatchSourceData = {};
|
|
32
|
-
var initDispatch =
|
|
32
|
+
var initDispatch = {};
|
|
33
33
|
var cacheValues = {};
|
|
34
34
|
var isLoading = false;
|
|
35
35
|
var norAddItemDispatch = function norAddItemDispatch(name, manual, fn) {
|
|
36
|
-
if (manual === false) {
|
|
37
|
-
initDispatch
|
|
36
|
+
if (manual === false && name) {
|
|
37
|
+
initDispatch[name] = fn;
|
|
38
38
|
}
|
|
39
39
|
if (!name) {
|
|
40
40
|
return {
|
|
@@ -57,8 +57,9 @@ var useHForm = (function () {
|
|
|
57
57
|
newValue = this.formatValues(cacheValues);
|
|
58
58
|
form.setFieldsValue(newValue);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
var initKeys = _Object$keys(initDispatch);
|
|
61
|
+
_forEachInstanceProperty(initKeys).call(initKeys, function (key) {
|
|
62
|
+
initDispatch[key]({
|
|
62
63
|
changedValues: newValue,
|
|
63
64
|
oldValues: newValue
|
|
64
65
|
});
|
|
@@ -139,6 +140,9 @@ var useHForm = (function () {
|
|
|
139
140
|
} else {
|
|
140
141
|
defaultFn.push(fn);
|
|
141
142
|
}
|
|
143
|
+
if (manual === false && name) {
|
|
144
|
+
initDispatch[name] = fn;
|
|
145
|
+
}
|
|
142
146
|
dispatchSourceData[key] = {
|
|
143
147
|
keysFn: keysFn,
|
|
144
148
|
defaultFn: defaultFn
|
|
@@ -99,12 +99,19 @@ var itemControl = function itemControl(item, form, defaultComponents) {
|
|
|
99
99
|
};
|
|
100
100
|
var itemDispatchProvider = function itemDispatchProvider(name, config, dispatchSourceData) {
|
|
101
101
|
var dependencies = config.dependencies,
|
|
102
|
-
fnKey = config.fnKey
|
|
102
|
+
fnKey = config.fnKey,
|
|
103
|
+
reset = config.reset;
|
|
103
104
|
var itemDispatch = dispatchSourceData[dependencies];
|
|
104
105
|
if (!itemDispatch) {
|
|
105
|
-
return _defineProperty({}, dependencies, _defineProperty({}, name,
|
|
106
|
+
return _defineProperty({}, dependencies, _defineProperty({}, name, {
|
|
107
|
+
fnKey: fnKey,
|
|
108
|
+
reset: reset
|
|
109
|
+
}));
|
|
106
110
|
}
|
|
107
|
-
var itemNameDispatch = _defineProperty({}, name,
|
|
111
|
+
var itemNameDispatch = _defineProperty({}, name, {
|
|
112
|
+
fnKey: fnKey,
|
|
113
|
+
reset: reset
|
|
114
|
+
});
|
|
108
115
|
return _defineProperty({}, dependencies, _objectSpread(_objectSpread({}, itemDispatch), itemNameDispatch));
|
|
109
116
|
};
|
|
110
117
|
var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
@@ -118,7 +125,9 @@ var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
|
118
125
|
_dispatch$dependencie = dispatch.dependencies,
|
|
119
126
|
dispatchDependencies = _dispatch$dependencie === void 0 ? dependencies : _dispatch$dependencie,
|
|
120
127
|
_dispatch$manual = dispatch.manual,
|
|
121
|
-
manual = _dispatch$manual === void 0 ? true : _dispatch$manual
|
|
128
|
+
manual = _dispatch$manual === void 0 ? true : _dispatch$manual,
|
|
129
|
+
_dispatch$reset = dispatch.reset,
|
|
130
|
+
reset = _dispatch$reset === void 0 ? true : _dispatch$reset;
|
|
122
131
|
if (!fnKey) {
|
|
123
132
|
return {};
|
|
124
133
|
}
|
|
@@ -128,7 +137,8 @@ var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
|
128
137
|
var itemDispatch = itemDispatchProvider(name, {
|
|
129
138
|
dependencies: key,
|
|
130
139
|
fnKey: fnKey,
|
|
131
|
-
manual: manual
|
|
140
|
+
manual: manual,
|
|
141
|
+
reset: reset
|
|
132
142
|
}, dispatchSourceData);
|
|
133
143
|
allDispatch = _objectSpread(_objectSpread({}, allDispatch), itemDispatch);
|
|
134
144
|
});
|
|
@@ -137,7 +147,8 @@ var dispatchProvider = function dispatchProvider(item, dispatchSourceData) {
|
|
|
137
147
|
var itemDispatch = itemDispatchProvider(name, {
|
|
138
148
|
dependencies: dispatchDependencies,
|
|
139
149
|
fnKey: fnKey,
|
|
140
|
-
manual: manual
|
|
150
|
+
manual: manual,
|
|
151
|
+
reset: reset
|
|
141
152
|
}, dispatchSourceData);
|
|
142
153
|
return _objectSpread(_objectSpread({}, dispatchSourceData), itemDispatch);
|
|
143
154
|
};
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -23,11 +23,12 @@ export interface HoverModal {
|
|
|
23
23
|
type HelperModal = (form: HFormInstance) => React.ReactNode | string;
|
|
24
24
|
export type HideModal = (form: HFormInstance) => boolean;
|
|
25
25
|
export type AddDispatchListenerFn = (action: ActionModal, fn: argsFn) => void;
|
|
26
|
-
export type DispatchSourceDataModal = Record<string, Record<string,
|
|
26
|
+
export type DispatchSourceDataModal = Record<string, Record<string, DispatchModal>>;
|
|
27
27
|
export interface DispatchModal<T = string | string[]> {
|
|
28
28
|
fnKey?: string;
|
|
29
29
|
dependencies?: T;
|
|
30
30
|
manual?: boolean;
|
|
31
|
+
reset?: boolean;
|
|
31
32
|
}
|
|
32
33
|
export interface HItemProps extends Omit<FormItemProps, "name"> {
|
|
33
34
|
type?: string;
|
package/package.json
CHANGED
|
@@ -86,10 +86,10 @@ export const useValuesChange = ({
|
|
|
86
86
|
if (!!dispatchItem) {
|
|
87
87
|
const dispatchKey = Object.keys(dispatchItem);
|
|
88
88
|
dispatchKey.forEach((name) => {
|
|
89
|
-
const
|
|
89
|
+
const {fnKey,reset} = dispatchItem[name];
|
|
90
90
|
form.dispatch(
|
|
91
91
|
{
|
|
92
|
-
key,
|
|
92
|
+
key:fnKey,
|
|
93
93
|
name,
|
|
94
94
|
},
|
|
95
95
|
{
|
|
@@ -97,6 +97,7 @@ export const useValuesChange = ({
|
|
|
97
97
|
oldValues: values,
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
|
+
reset&&form.resetFields([name]);
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
103
|
onValuesChange?.(changedValues, values);
|
|
@@ -13,12 +13,12 @@ export default () => {
|
|
|
13
13
|
return useMemo<HFormInstance>(() => {
|
|
14
14
|
const formatSourceData: Record<string, FormatItemModal> = {};
|
|
15
15
|
let dispatchSourceData: Record<string, DispatchItemData> = {};
|
|
16
|
-
const initDispatch: argsFn
|
|
16
|
+
const initDispatch: Record<string, argsFn> = {};
|
|
17
17
|
let cacheValues: Record<string, any> = {};
|
|
18
18
|
let isLoading = false;
|
|
19
19
|
const norAddItemDispatch = (name, manual, fn) => {
|
|
20
|
-
if (manual === false) {
|
|
21
|
-
initDispatch
|
|
20
|
+
if (manual === false&&name) {
|
|
21
|
+
initDispatch[name]=fn;
|
|
22
22
|
}
|
|
23
23
|
if (!name) {
|
|
24
24
|
return {
|
|
@@ -43,8 +43,9 @@ export default () => {
|
|
|
43
43
|
newValue = this.formatValues(cacheValues);
|
|
44
44
|
form.setFieldsValue(newValue);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const initKeys=Object.keys(initDispatch);
|
|
47
|
+
initKeys.forEach((key) => {
|
|
48
|
+
initDispatch[key]({ changedValues: newValue, oldValues: newValue });
|
|
48
49
|
});
|
|
49
50
|
isLoading = true;
|
|
50
51
|
},
|
|
@@ -110,6 +111,9 @@ export default () => {
|
|
|
110
111
|
} else {
|
|
111
112
|
defaultFn.push(fn);
|
|
112
113
|
}
|
|
114
|
+
if (manual===false&&name){
|
|
115
|
+
initDispatch[name]=fn;
|
|
116
|
+
}
|
|
113
117
|
dispatchSourceData[key] = {
|
|
114
118
|
keysFn,
|
|
115
119
|
defaultFn,
|
|
@@ -105,17 +105,23 @@ const itemDispatchProvider = (
|
|
|
105
105
|
config: Required<DispatchModal<string>>,
|
|
106
106
|
dispatchSourceData: DispatchSourceDataModal
|
|
107
107
|
) => {
|
|
108
|
-
const { dependencies, fnKey } = config;
|
|
108
|
+
const { dependencies, fnKey ,reset} = config;
|
|
109
109
|
const itemDispatch = dispatchSourceData[dependencies as string];
|
|
110
110
|
if (!itemDispatch) {
|
|
111
111
|
return {
|
|
112
112
|
[dependencies]: {
|
|
113
|
-
[name]:
|
|
113
|
+
[name]:{
|
|
114
|
+
fnKey,
|
|
115
|
+
reset
|
|
116
|
+
},
|
|
114
117
|
},
|
|
115
118
|
};
|
|
116
119
|
}
|
|
117
120
|
const itemNameDispatch = {
|
|
118
|
-
[name]:
|
|
121
|
+
[name]:{
|
|
122
|
+
fnKey,
|
|
123
|
+
reset
|
|
124
|
+
},
|
|
119
125
|
};
|
|
120
126
|
return {
|
|
121
127
|
[dependencies]: {
|
|
@@ -133,6 +139,7 @@ const dispatchProvider = (
|
|
|
133
139
|
fnKey,
|
|
134
140
|
dependencies: dispatchDependencies = dependencies as string | string[],
|
|
135
141
|
manual = true,
|
|
142
|
+
reset=true
|
|
136
143
|
} = dispatch;
|
|
137
144
|
if (!fnKey) {
|
|
138
145
|
return {};
|
|
@@ -144,7 +151,7 @@ const dispatchProvider = (
|
|
|
144
151
|
dispatchDependencies.forEach((key) => {
|
|
145
152
|
const itemDispatch = itemDispatchProvider(
|
|
146
153
|
name,
|
|
147
|
-
{ dependencies: key, fnKey, manual },
|
|
154
|
+
{ dependencies: key, fnKey, manual ,reset},
|
|
148
155
|
dispatchSourceData
|
|
149
156
|
);
|
|
150
157
|
allDispatch = {
|
|
@@ -156,7 +163,7 @@ const dispatchProvider = (
|
|
|
156
163
|
}
|
|
157
164
|
const itemDispatch = itemDispatchProvider(
|
|
158
165
|
name,
|
|
159
|
-
{ dependencies: dispatchDependencies, fnKey, manual },
|
|
166
|
+
{ dependencies: dispatchDependencies, fnKey, manual ,reset},
|
|
160
167
|
dispatchSourceData
|
|
161
168
|
);
|
|
162
169
|
return {
|
|
@@ -57,11 +57,12 @@ type HelperModal = (form: HFormInstance) => React.ReactNode | string;
|
|
|
57
57
|
export type HideModal = (form: HFormInstance) => boolean;
|
|
58
58
|
|
|
59
59
|
export type AddDispatchListenerFn = (action: ActionModal, fn: argsFn) => void;
|
|
60
|
-
export type DispatchSourceDataModal = Record<string, Record<string,
|
|
60
|
+
export type DispatchSourceDataModal = Record<string, Record<string, DispatchModal>>;
|
|
61
61
|
export interface DispatchModal<T = string | string[]> {
|
|
62
62
|
fnKey?: string;
|
|
63
63
|
dependencies?: T;
|
|
64
64
|
manual?: boolean;
|
|
65
|
+
reset?:boolean;
|
|
65
66
|
}
|
|
66
67
|
export interface HItemProps extends Omit<FormItemProps, "name"> {
|
|
67
68
|
type?: string;
|
|
@@ -96,6 +96,25 @@ const data = [
|
|
|
96
96
|
type: "urlUpload",
|
|
97
97
|
rules: [{ required: true }],
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
label: "下拉框",
|
|
101
|
+
name: "select",
|
|
102
|
+
type: "select",
|
|
103
|
+
dispatch: {
|
|
104
|
+
fnKey: "reload",
|
|
105
|
+
dependencies: ["selectInput", "sz"],
|
|
106
|
+
manual: false,
|
|
107
|
+
},
|
|
108
|
+
itemProps: {
|
|
109
|
+
request: (params = {}, values) => {
|
|
110
|
+
console.log(values, "paramsparamsparams");
|
|
111
|
+
const { label = "123", value = 1 } = params;
|
|
112
|
+
return Promise.resolve([{ label, value }]);
|
|
113
|
+
},
|
|
114
|
+
showSearch: true,
|
|
115
|
+
},
|
|
116
|
+
rules: [{ required: true }],
|
|
117
|
+
},
|
|
99
118
|
];
|
|
100
119
|
let num = 0;
|
|
101
120
|
export default () => {
|