@teamix/pro 1.1.39 → 1.1.40
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/README.md +14 -10
- package/dist/pro.css +1 -1
- package/dist/pro.js +2214 -4073
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +5 -5
- package/es/actions/dialog-form.js +1 -5
- package/es/actions/dialog.d.ts +6 -3
- package/es/actions/dialog.js +12 -5
- package/es/actions/index.d.ts +54 -47
- package/es/actions/index.js +28 -22
- package/es/actions/index.scss +17 -2
- package/es/card/index.d.ts +17 -5
- package/es/card/index.js +16 -11
- package/es/form/Components/ProField/index.d.ts +1 -78
- package/es/form/Components/ProField/index.js +34 -40
- package/es/form/Filter/index.js +2 -2
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +1 -6
- package/es/form/ProForm/index.scss +19 -1
- package/es/form/ProForm/useFieldRequest.d.ts +5 -0
- package/es/form/ProForm/useFieldRequest.js +26 -0
- package/es/form/SchemaForm/adapterDecorator.js +2 -2
- package/es/form/SchemaForm/index.d.ts +2 -2
- package/es/form/SchemaForm/index.js +12 -21
- package/es/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/es/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/es/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.js +44 -16
- package/es/form/SchemaForm/reactions.d.ts +5 -5
- package/es/form/SchemaForm/reactions.js +20 -18
- package/es/form/fieldTypeMap.d.ts +4 -0
- package/es/form/fieldTypeMap.js +41 -0
- package/es/form/index.d.ts +92 -4
- package/es/form/index.js +18 -5
- package/es/form/schemaNameMap.js +3 -0
- package/es/form/typing.d.ts +44 -21
- package/es/form/utils.d.ts +3 -1
- package/es/form/utils.js +38 -1
- package/es/form/warning.d.ts +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoGroup/index.js +73 -15
- package/es/info/components/InfoGroup/index.scss +45 -3
- package/es/info/components/InfoValueItem/index.js +6 -4
- package/es/info/components/InfoValueItem/index.scss +5 -1
- package/es/info/components/ProInfoItem/index.js +3 -3
- package/es/info/components/ProInfoItem/index.scss +1 -0
- package/es/info/components/baseInfo/index.d.ts +2 -3
- package/es/info/components/headerInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.d.ts +2 -3
- package/es/info/components/tableInfo/index.js +2 -2
- package/es/info/index.js +52 -49
- package/es/info/typing.d.ts +52 -36
- package/es/info/utils/index.d.ts +2 -2
- package/es/info/utils/utils.d.ts +1 -1
- package/es/nocode/pages/renderer.js +2 -2
- package/es/page-header/index.d.ts +34 -21
- package/es/page-header/index.js +39 -30
- package/es/page-header/index.scss +2 -1
- package/es/table/components/EmptyContent/index.d.ts +2 -0
- package/es/table/components/EmptyContent/index.js +11 -0
- package/es/table/components/Filter/index.d.ts +2 -2
- package/es/table/components/Filter/index.js +16 -8
- package/es/table/components/Layout/index.js +2 -2
- package/es/table/components/QuickAction/index.d.ts +2 -2
- package/es/table/components/QuickAction/index.js +3 -3
- package/es/table/components/ToolBar/Fullscreen.js +1 -0
- package/es/table/index.js +76 -14
- package/es/table/index.scss +4 -0
- package/es/table/typing.d.ts +27 -14
- package/es/table/utils/columnRender.d.ts +3 -3
- package/es/table/utils/columnRender.js +2 -2
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +1 -1
- package/es/table/utils/index.js +33 -11
- package/es/templates/List/index.d.ts +2 -2
- package/es/utils/message.d.ts +3 -0
- package/es/utils/message.js +19 -0
- package/lib/actions/dialog-form.d.ts +5 -5
- package/lib/actions/dialog-form.js +1 -5
- package/lib/actions/dialog.d.ts +6 -3
- package/lib/actions/dialog.js +13 -5
- package/lib/actions/index.d.ts +54 -47
- package/lib/actions/index.js +37 -30
- package/lib/actions/index.scss +17 -2
- package/lib/card/index.d.ts +17 -5
- package/lib/card/index.js +18 -12
- package/lib/form/Components/ProField/index.d.ts +1 -78
- package/lib/form/Components/ProField/index.js +32 -38
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +1 -7
- package/lib/form/ProForm/index.scss +19 -1
- package/lib/form/ProForm/useFieldRequest.d.ts +5 -0
- package/lib/form/ProForm/useFieldRequest.js +37 -0
- package/lib/form/SchemaForm/adapterDecorator.js +4 -2
- package/lib/form/SchemaForm/index.d.ts +2 -2
- package/lib/form/SchemaForm/index.js +11 -22
- package/lib/form/SchemaForm/initializeArrayCards.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayItems.d.ts +2 -2
- package/lib/form/SchemaForm/initializeArrayTable.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeFormButton.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormCollapse.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
- package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -3
- package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +1 -1
- package/lib/form/SchemaForm/initializeRules.js +41 -13
- package/lib/form/SchemaForm/reactions.d.ts +5 -5
- package/lib/form/SchemaForm/reactions.js +22 -20
- package/lib/form/fieldTypeMap.d.ts +4 -0
- package/lib/form/fieldTypeMap.js +48 -0
- package/lib/form/index.d.ts +92 -4
- package/lib/form/index.js +17 -31
- package/lib/form/schemaNameMap.js +3 -0
- package/lib/form/typing.d.ts +44 -21
- package/lib/form/utils.d.ts +3 -1
- package/lib/form/utils.js +43 -1
- package/lib/form/warning.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoGroup/index.js +76 -14
- package/lib/info/components/InfoGroup/index.scss +45 -3
- package/lib/info/components/InfoValueItem/index.js +5 -3
- package/lib/info/components/InfoValueItem/index.scss +5 -1
- package/lib/info/components/ProInfoItem/index.js +2 -2
- package/lib/info/components/ProInfoItem/index.scss +1 -0
- package/lib/info/components/baseInfo/index.d.ts +2 -3
- package/lib/info/components/headerInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.d.ts +2 -3
- package/lib/info/components/tableInfo/index.js +1 -1
- package/lib/info/index.js +51 -48
- package/lib/info/typing.d.ts +52 -36
- package/lib/info/utils/index.d.ts +2 -2
- package/lib/info/utils/utils.d.ts +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/page-header/index.d.ts +34 -21
- package/lib/page-header/index.js +37 -28
- package/lib/page-header/index.scss +2 -1
- package/lib/table/components/EmptyContent/index.d.ts +2 -0
- package/lib/table/components/EmptyContent/index.js +25 -0
- package/lib/table/components/Filter/index.d.ts +2 -2
- package/lib/table/components/Filter/index.js +16 -8
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/components/QuickAction/index.d.ts +2 -2
- package/lib/table/components/QuickAction/index.js +1 -1
- package/lib/table/components/ToolBar/Fullscreen.js +1 -0
- package/lib/table/index.js +77 -14
- package/lib/table/index.scss +4 -0
- package/lib/table/typing.d.ts +27 -14
- package/lib/table/utils/columnRender.d.ts +3 -3
- package/lib/table/utils/columnRender.js +1 -1
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +2 -2
- package/lib/table/utils/index.js +33 -11
- package/lib/templates/List/index.d.ts +2 -2
- package/lib/utils/message.d.ts +3 -0
- package/lib/utils/message.js +32 -0
- package/package.json +4 -4
- package/es/form/Components/Search/index.d.ts +0 -11
- package/es/form/Components/Search/index.js +0 -89
- package/es/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/es/form/SchemaForm/initializeArrayIcon.js +0 -62
- package/es/form/SchemaForm/initializeProField.d.ts +0 -5
- package/es/form/SchemaForm/initializeProField.js +0 -70
- package/es/info/utils/useInfoRequest.d.ts +0 -14
- package/es/info/utils/useInfoRequest.js +0 -76
- package/lib/form/Components/Search/index.d.ts +0 -11
- package/lib/form/Components/Search/index.js +0 -103
- package/lib/form/SchemaForm/initializeArrayIcon.d.ts +0 -3
- package/lib/form/SchemaForm/initializeArrayIcon.js +0 -73
- package/lib/form/SchemaForm/initializeProField.d.ts +0 -5
- package/lib/form/SchemaForm/initializeProField.js +0 -77
- package/lib/info/utils/useInfoRequest.d.ts +0 -14
- package/lib/info/utils/useInfoRequest.js +0 -85
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type {
|
3
|
-
declare const _default: React.MemoExoticComponent<({ schema, scope, components }:
|
2
|
+
import type { ProFormProps } from '../typing';
|
3
|
+
declare const _default: React.MemoExoticComponent<({ schema, scope, components }: ProFormProps) => JSX.Element>;
|
4
4
|
export default _default;
|
@@ -19,8 +19,6 @@ var _ProField = _interopRequireDefault(require("../Components/ProField"));
|
|
19
19
|
|
20
20
|
var _Editable = require("../Components/Editable");
|
21
21
|
|
22
|
-
var _Search = _interopRequireDefault(require("../Components/Search"));
|
23
|
-
|
24
22
|
var _FormGroup = _interopRequireDefault(require("../Components/FormGroup"));
|
25
23
|
|
26
24
|
var _QueryFilter = _interopRequireDefault(require("../Components/QueryFilter"));
|
@@ -41,8 +39,6 @@ var _initializeDataSource2 = _interopRequireDefault(require("./initializeDataSou
|
|
41
39
|
|
42
40
|
var _initializeRules2 = _interopRequireDefault(require("./initializeRules"));
|
43
41
|
|
44
|
-
var _initializeProField = _interopRequireWildcard(require("./initializeProField"));
|
45
|
-
|
46
42
|
var _initializeArrayCards = _interopRequireDefault(require("./initializeArrayCards"));
|
47
43
|
|
48
44
|
var _initializeArrayCollapse = _interopRequireDefault(require("./initializeArrayCollapse"));
|
@@ -61,13 +57,13 @@ var _initializeFormTab = _interopRequireDefault(require("./initializeFormTab"));
|
|
61
57
|
|
62
58
|
var _initializeFormCollapse = _interopRequireDefault(require("./initializeFormCollapse"));
|
63
59
|
|
64
|
-
var
|
60
|
+
var _fieldTypeMap = _interopRequireDefault(require("../fieldTypeMap"));
|
65
61
|
|
66
62
|
var _utils = require("../utils");
|
67
63
|
|
68
64
|
var _warning = _interopRequireDefault(require("../warning"));
|
69
65
|
|
70
|
-
var _excluded = ["component", "type", "name", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request"];
|
66
|
+
var _excluded = ["component", "type", "name", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request", "data"];
|
71
67
|
|
72
68
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
73
69
|
|
@@ -111,8 +107,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
111
107
|
components = _ref.components;
|
112
108
|
var SchemaField = (0, _react.useMemo)(function () {
|
113
109
|
return (0, _react2.createSchemaField)({
|
114
|
-
components: {
|
115
|
-
ProField: _ProField.default,
|
110
|
+
components: _objectSpread(_objectSpread({}, _ProField.default), {}, {
|
116
111
|
FormLayout: _formily.FormLayout,
|
117
112
|
FormItem: _formily.FormItem,
|
118
113
|
ArrayCollapse: _formily.ArrayCollapse,
|
@@ -134,12 +129,11 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
134
129
|
EditableDrawer: _Editable.EditableDrawer,
|
135
130
|
EditablePopover: _Editable.EditablePopover,
|
136
131
|
FormGroup: _FormGroup.default,
|
137
|
-
Search: _Search.default,
|
138
132
|
QueryFilter: _QueryFilter.default,
|
139
133
|
Upload: _formily.Upload,
|
140
134
|
Affix: _components.Affix,
|
141
135
|
Text: _index.default
|
142
|
-
}
|
136
|
+
})
|
143
137
|
});
|
144
138
|
}, []); // 合并schema中request的scope
|
145
139
|
|
@@ -155,9 +149,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
155
149
|
originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
|
156
150
|
|
157
151
|
if (originalComponent) {
|
158
|
-
if (Object.keys(
|
159
|
-
// ProField接管组件
|
160
|
-
newItem = (0, _initializeProField.default)(newItem);
|
152
|
+
if (Object.keys(_fieldTypeMap.default).includes(originalComponent)) {// ProField接管组件
|
161
153
|
} else {
|
162
154
|
// 未接管组件,判断是否为Formily组件别名
|
163
155
|
newItem = _objectSpread(_objectSpread({}, newItem), {}, {
|
@@ -208,11 +200,6 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
208
200
|
|
209
201
|
if (['FormCollapse'].includes(originalComponent)) {
|
210
202
|
newItem = (0, _initializeFormCollapse.default)(newItem);
|
211
|
-
} // Array组件的Icon替换
|
212
|
-
|
213
|
-
|
214
|
-
if (/\.(Addition|Remove|MoveUp|MoveDown|SortHandle){1}$/g.test(originalComponent)) {
|
215
|
-
newItem = (0, _initializeArrayIcon.default)(newItem);
|
216
203
|
}
|
217
204
|
}
|
218
205
|
|
@@ -230,6 +217,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
230
217
|
items = _newItem2.items,
|
231
218
|
tooltip = _newItem2.tooltip,
|
232
219
|
request = _newItem2.request,
|
220
|
+
data = _newItem2.data,
|
233
221
|
otherProps = _objectWithoutProperties(_newItem2, _excluded); // 默认类型
|
234
222
|
|
235
223
|
|
@@ -276,7 +264,8 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
276
264
|
decoratorProps: defaultDecoratorProps,
|
277
265
|
rules: defaultRules,
|
278
266
|
reactions: defaultReactions,
|
279
|
-
dataSource: defaultDataSource
|
267
|
+
dataSource: defaultDataSource,
|
268
|
+
data: data
|
280
269
|
})); // 递归子组件
|
281
270
|
|
282
271
|
var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
|
@@ -295,13 +284,13 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
295
284
|
type: 'object',
|
296
285
|
properties: formatSchema(schema)
|
297
286
|
};
|
298
|
-
}, [
|
287
|
+
}, []); // console.log(schemaPro);
|
299
288
|
|
300
|
-
return /*#__PURE__*/_react.default.createElement(
|
289
|
+
return /*#__PURE__*/_react.default.createElement(SchemaField, {
|
301
290
|
schema: schemaPro,
|
302
291
|
components: components,
|
303
292
|
scope: mergedScope
|
304
|
-
})
|
293
|
+
});
|
305
294
|
});
|
306
295
|
|
307
296
|
exports.default = _default;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize:
|
1
|
+
import type { ProFormInitializeItem } from '../typing';
|
2
|
+
declare const initialize: ProFormInitializeItem;
|
3
3
|
export default initialize;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize:
|
1
|
+
import type { ProFormInitializeItem } from '../typing';
|
2
|
+
declare const initialize: ProFormInitializeItem;
|
3
3
|
export default initialize;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize:
|
1
|
+
import type { ProFormInitializeItem } from '../typing';
|
2
|
+
declare const initialize: ProFormInitializeItem;
|
3
3
|
export default initialize;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize:
|
1
|
+
import type { ProFormInitializeItem } from '../typing';
|
2
|
+
declare const initialize: ProFormInitializeItem;
|
3
3
|
export default initialize;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type {
|
1
|
+
import type { ProFormRequestConfig } from '../';
|
2
2
|
interface IInitializeDataSource {
|
3
|
-
(requestConfig?:
|
3
|
+
(requestConfig?: ProFormRequestConfig | any): {
|
4
4
|
dataSource?: any[];
|
5
5
|
reactions: any[];
|
6
6
|
scope: {
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _utils = require("@teamix/utils");
|
9
9
|
|
10
|
-
var _reactions = require("
|
10
|
+
var _reactions = require("./reactions");
|
11
11
|
|
12
12
|
var _utils2 = require("../utils");
|
13
13
|
|
@@ -22,7 +22,7 @@ var initializeDataSource = function initializeDataSource(dataSource) {
|
|
22
22
|
var dataSourceScopeName = (0, _utils2.getRandomName)('$dataSource');
|
23
23
|
return {
|
24
24
|
reactions: ["{{".concat(dataSourceScopeName, "(").concat(requestScopeName, ",").concat(requestConfig.onComplete, ")}}")],
|
25
|
-
scope: (_scope = {}, _defineProperty(_scope, requestScopeName, (0, _reactions
|
25
|
+
scope: (_scope = {}, _defineProperty(_scope, requestScopeName, (0, _reactions.$request)(requestConfig)), _defineProperty(_scope, dataSourceScopeName, _reactions.$dataSource), _scope)
|
26
26
|
};
|
27
27
|
}
|
28
28
|
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize:
|
1
|
+
import type { ProFormInitializeItem } from '../typing';
|
2
|
+
declare const initialize: ProFormInitializeItem;
|
3
3
|
export default initialize;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize:
|
1
|
+
import type { ProFormInitializeItem } from '../typing';
|
2
|
+
declare const initialize: ProFormInitializeItem;
|
3
3
|
export default initialize;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize: (item:
|
1
|
+
import type { ProFormSchemaItem } from '../typing';
|
2
|
+
declare const initialize: (item: ProFormSchemaItem) => ProFormSchemaItem;
|
3
3
|
export default initialize;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize: (item:
|
1
|
+
import type { ProFormSchemaItem } from '../typing';
|
2
|
+
declare const initialize: (item: ProFormSchemaItem & {
|
3
3
|
col?: number;
|
4
|
-
}) =>
|
4
|
+
}) => ProFormSchemaItem;
|
5
5
|
export default initialize;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
declare const initialize: (item:
|
1
|
+
import type { ProFormSchemaItem } from '../typing';
|
2
|
+
declare const initialize: (item: ProFormSchemaItem) => ProFormSchemaItem;
|
3
3
|
export default initialize;
|
@@ -16,7 +16,7 @@ var initializeRequest = function initializeRequest(requestConfig) {
|
|
16
16
|
var requestScopeName = (0, _utils.getRandomName)('$request');
|
17
17
|
return {
|
18
18
|
reactions: ["{{".concat(requestScopeName, "}}")],
|
19
|
-
scope: _defineProperty({}, requestScopeName, (0, _reactions
|
19
|
+
scope: _defineProperty({}, requestScopeName, (0, _reactions.$request)(requestConfig))
|
20
20
|
};
|
21
21
|
}
|
22
22
|
|
@@ -13,6 +13,18 @@ var _utils2 = require("../utils");
|
|
13
13
|
|
14
14
|
var _reactions2 = require("./reactions");
|
15
15
|
|
16
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
17
|
+
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
19
|
+
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
21
|
+
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
23
|
+
|
24
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
25
|
+
|
26
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
27
|
+
|
16
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
17
29
|
|
18
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
@@ -20,24 +32,40 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
20
32
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
21
33
|
|
22
34
|
var initializeRules = function initializeRules(rules) {
|
23
|
-
|
24
|
-
|
35
|
+
var initializeValidator = function initializeValidator(rule) {
|
36
|
+
if ((0, _utils.isPlainObj)(rule === null || rule === void 0 ? void 0 : rule.validator)) {
|
37
|
+
var _scope;
|
38
|
+
|
39
|
+
var validator = rule.validator;
|
40
|
+
var requestScopeName = (0, _utils2.getRandomName)('$request');
|
41
|
+
var validatorScopeName = (0, _utils2.getRandomName)('$validator');
|
42
|
+
return {
|
43
|
+
rules: _objectSpread(_objectSpread({}, rule), {}, {
|
44
|
+
validator: "{{".concat(validatorScopeName, "(").concat(requestScopeName, ",").concat(validator.onComplete, ")}}")
|
45
|
+
}),
|
46
|
+
scope: (_scope = {}, _defineProperty(_scope, requestScopeName, (0, _reactions.$request)(validator)), _defineProperty(_scope, validatorScopeName, _reactions2.$validator), _scope)
|
47
|
+
};
|
48
|
+
}
|
25
49
|
|
26
|
-
var validator = rules.validator;
|
27
|
-
var requestScopeName = (0, _utils2.getRandomName)('$request');
|
28
|
-
var validatorScopeName = (0, _utils2.getRandomName)('$validator');
|
29
50
|
return {
|
30
|
-
rules:
|
31
|
-
|
32
|
-
}),
|
33
|
-
scope: (_scope = {}, _defineProperty(_scope, requestScopeName, (0, _reactions.useRequest)(validator)), _defineProperty(_scope, validatorScopeName, _reactions2.useValidator), _scope)
|
51
|
+
rules: rule,
|
52
|
+
scope: {}
|
34
53
|
};
|
54
|
+
};
|
55
|
+
|
56
|
+
if ((0, _utils.isArr)(rules)) {
|
57
|
+
return rules.reduce(function (prev, current) {
|
58
|
+
var result = initializeValidator(current);
|
59
|
+
prev.rules = [].concat(_toConsumableArray(prev.rules), [result.rules]);
|
60
|
+
prev.scope = _objectSpread(_objectSpread({}, prev.scope), result.scope);
|
61
|
+
return prev;
|
62
|
+
}, {
|
63
|
+
rules: [],
|
64
|
+
scope: {}
|
65
|
+
});
|
35
66
|
}
|
36
67
|
|
37
|
-
return
|
38
|
-
rules: rules,
|
39
|
-
scope: []
|
40
|
-
};
|
68
|
+
return initializeValidator(rules);
|
41
69
|
};
|
42
70
|
|
43
71
|
var _default = initializeRules;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
declare const
|
3
|
-
declare const
|
4
|
-
declare const
|
5
|
-
export {
|
1
|
+
import type { ProFormRequestConfig } from '../typing';
|
2
|
+
declare const $request: (requestConfig: ProFormRequestConfig) => (field: any) => Promise<unknown>;
|
3
|
+
declare const $validator: (services: any, onComplete?: any) => (value: any, rules: any, { field }: any) => any;
|
4
|
+
declare const $dataSource: (services: any, onComplete?: any) => (field: any) => any;
|
5
|
+
export { $request, $dataSource, $validator };
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports
|
6
|
+
exports.$validator = exports.$request = exports.$dataSource = void 0;
|
7
7
|
|
8
8
|
var _utils = require("@teamix/utils");
|
9
9
|
|
@@ -14,47 +14,47 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
14
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
15
15
|
|
16
16
|
// 配置请求
|
17
|
-
var
|
17
|
+
var $request = function $request(requestConfig) {
|
18
18
|
return function (field) {
|
19
|
-
var _field$
|
19
|
+
var _field$data;
|
20
20
|
|
21
|
+
var refresh = field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
|
21
22
|
var beforeRequest = requestConfig.beforeRequest,
|
22
23
|
onSuccess = requestConfig.onSuccess;
|
24
|
+
var refreshResult = (0, _utils.isPlainObj)(refresh) ? refresh : {};
|
23
25
|
var beforeRequestResult = (0, _utils.isFn)(beforeRequest) ? beforeRequest(field) : {};
|
24
26
|
return (0, _utils.doCommonRequest)(_objectSpread(_objectSpread({}, requestConfig), {}, {
|
25
|
-
params: _objectSpread(_objectSpread({}, requestConfig.params), beforeRequestResult),
|
27
|
+
params: _objectSpread(_objectSpread(_objectSpread({}, requestConfig.params), beforeRequestResult), refreshResult),
|
26
28
|
beforeRequest: function beforeRequest() {
|
27
29
|
return beforeRequestResult;
|
28
30
|
},
|
29
31
|
onSuccess: (0, _utils.isFn)(onSuccess) ? function (res) {
|
30
32
|
return onSuccess(res, field);
|
31
33
|
} : onSuccess
|
32
|
-
}),
|
33
|
-
$self: field,
|
34
|
-
$form: field === null || field === void 0 ? void 0 : field.form,
|
35
|
-
$values: field === null || field === void 0 ? void 0 : (_field$form = field.form) === null || _field$form === void 0 ? void 0 : _field$form.values
|
36
|
-
});
|
34
|
+
}), field);
|
37
35
|
};
|
38
36
|
}; // 配置校验
|
39
37
|
|
40
38
|
|
41
|
-
exports
|
39
|
+
exports.$request = $request;
|
42
40
|
|
43
|
-
var
|
44
|
-
return function (value) {
|
45
|
-
|
46
|
-
|
41
|
+
var $validator = function $validator(services, onComplete) {
|
42
|
+
return function (value, rules, _ref) {
|
43
|
+
var field = _ref.field;
|
44
|
+
return services(field).then(function (res) {
|
45
|
+
return onComplete && onComplete(res, field);
|
47
46
|
});
|
48
47
|
};
|
49
48
|
}; // 配置DataSource
|
50
49
|
|
51
50
|
|
52
|
-
exports
|
51
|
+
exports.$validator = $validator;
|
53
52
|
|
54
|
-
var
|
53
|
+
var $dataSource = function $dataSource(services, onComplete) {
|
55
54
|
return function (field) {
|
56
55
|
field.setState({
|
57
|
-
loading: true
|
56
|
+
loading: true,
|
57
|
+
readOnly: true
|
58
58
|
});
|
59
59
|
return services(field).then(function (res) {
|
60
60
|
var _res$map;
|
@@ -67,15 +67,17 @@ var useAsyncDataSource = function useAsyncDataSource(services, onComplete) {
|
|
67
67
|
};
|
68
68
|
field.setState(_objectSpread({
|
69
69
|
dataSource: res,
|
70
|
-
loading: false
|
70
|
+
loading: false,
|
71
|
+
readOnly: false
|
71
72
|
}, clearValue));
|
72
73
|
return onComplete && onComplete(res, field);
|
73
74
|
}).catch(function () {
|
74
75
|
field.setState({
|
75
|
-
loading: false
|
76
|
+
loading: false,
|
77
|
+
readOnly: false
|
76
78
|
});
|
77
79
|
});
|
78
80
|
};
|
79
81
|
};
|
80
82
|
|
81
|
-
exports
|
83
|
+
exports.$dataSource = $dataSource;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var fieldTypeMap = {
|
8
|
+
Input: 'text',
|
9
|
+
Password: 'password',
|
10
|
+
TextArea: 'textArea',
|
11
|
+
NumberPicker: 'number',
|
12
|
+
Percent: 'percent',
|
13
|
+
Money: 'money',
|
14
|
+
Select: 'select',
|
15
|
+
MultipleSelect: 'multipleSelect',
|
16
|
+
TreeSelect: 'treeSelect',
|
17
|
+
Cascader: 'cascader',
|
18
|
+
MultipleCascader: 'multipleCascader',
|
19
|
+
ArbitraryCascader: 'arbitraryCascader',
|
20
|
+
Radio: 'radio',
|
21
|
+
Checkbox: 'checkbox',
|
22
|
+
Switch: 'switch',
|
23
|
+
DatePicker: 'date',
|
24
|
+
TimePicker: 'time',
|
25
|
+
DateTimePicker: 'dateTime',
|
26
|
+
WeekPicker: 'dateWeek',
|
27
|
+
MonthPicker: 'dateMonth',
|
28
|
+
YearPicker: 'dateYear',
|
29
|
+
QuarterPicker: 'dateQuarter',
|
30
|
+
DateRangePicker: 'dateRange',
|
31
|
+
TimeRangePicker: 'timeRange',
|
32
|
+
DateTimeRangePicker: 'dateTimeRange',
|
33
|
+
WeekRangePicker: 'dateWeekRange',
|
34
|
+
MonthRangePicker: 'dateMonthRange',
|
35
|
+
YearRangePicker: 'dateYearRange',
|
36
|
+
QuarterRangePicker: 'dateQuarterRange',
|
37
|
+
Transfer: 'transfer',
|
38
|
+
ColorPicker: 'color',
|
39
|
+
ColorRadio: 'colorRadio',
|
40
|
+
IconPicker: 'icon',
|
41
|
+
JsonInput: 'json',
|
42
|
+
TagPicker: 'tagPicker',
|
43
|
+
MultipleTagPicker: 'multipleTagPicker',
|
44
|
+
Range: 'range',
|
45
|
+
Search: 'search'
|
46
|
+
};
|
47
|
+
var _default = fieldTypeMap;
|
48
|
+
exports.default = _default;
|
package/lib/form/index.d.ts
CHANGED
@@ -6,17 +6,105 @@ export * from './typing';
|
|
6
6
|
* 使用别名导出formily相关内容
|
7
7
|
*/
|
8
8
|
export * as formilyCore from '@formily/core';
|
9
|
-
export * as formilyReact from '@formily/react';
|
10
9
|
export * as formilyReactive from '@formily/reactive';
|
11
10
|
export * as formilyTeamix from '@teamix/formily';
|
11
|
+
import * as originalFormilyReact from '@formily/react';
|
12
|
+
declare const formilyReact: {
|
13
|
+
useFieldRequest: () => {
|
14
|
+
refresh: () => void;
|
15
|
+
field: any;
|
16
|
+
};
|
17
|
+
useFormDisplayValues: () => any;
|
18
|
+
Schema: typeof originalFormilyReact.Schema;
|
19
|
+
FormProvider: import("react").FC<originalFormilyReact.IProviderProps>;
|
20
|
+
FormConsumer: import("react").FC<originalFormilyReact.IFormSpyProps>;
|
21
|
+
ArrayField: {
|
22
|
+
<D extends originalFormilyReact.JSXComponent, C extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.IFieldProps<D, C, import("@formily/core").ArrayField<any, any>>): JSX.Element;
|
23
|
+
displayName: string;
|
24
|
+
};
|
25
|
+
ObjectField: {
|
26
|
+
<D_1 extends originalFormilyReact.JSXComponent, C_1 extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.IFieldProps<D_1, C_1, import("@formily/core").ObjectField<any, any>>): JSX.Element;
|
27
|
+
displayName: string;
|
28
|
+
};
|
29
|
+
VoidField: {
|
30
|
+
<D_2 extends originalFormilyReact.JSXComponent, C_2 extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.IVoidFieldProps<D_2, C_2, import("@formily/core").VoidField<any, any, any>>): JSX.Element;
|
31
|
+
displayName: string;
|
32
|
+
};
|
33
|
+
RecursionField: import("react").FC<originalFormilyReact.IRecursionFieldProps>;
|
34
|
+
createSchemaField<Components extends originalFormilyReact.SchemaReactComponents>(options?: originalFormilyReact.ISchemaFieldReactFactoryOptions<Components> | undefined): {
|
35
|
+
<Decorator extends originalFormilyReact.JSXComponent, Component extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.ISchemaFieldProps<Decorator, Component, import("@formily/core").ObjectField<Decorator, Component>>): JSX.Element;
|
36
|
+
displayName: string;
|
37
|
+
Markup: {
|
38
|
+
<Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaMarkupFieldProps<Components, Component_1, Decorator_1>): JSX.Element;
|
39
|
+
displayName: string;
|
40
|
+
};
|
41
|
+
String: {
|
42
|
+
<Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_2, Decorator_2>): JSX.Element;
|
43
|
+
displayName: string;
|
44
|
+
};
|
45
|
+
Object: {
|
46
|
+
<Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_3, Decorator_3>): JSX.Element;
|
47
|
+
displayName: string;
|
48
|
+
};
|
49
|
+
Array: {
|
50
|
+
<Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_4, Decorator_4>): JSX.Element;
|
51
|
+
displayName: string;
|
52
|
+
};
|
53
|
+
Boolean: {
|
54
|
+
<Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_5, Decorator_5>): JSX.Element;
|
55
|
+
displayName: string;
|
56
|
+
};
|
57
|
+
Date: {
|
58
|
+
<Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_6, Decorator_6>): JSX.Element;
|
59
|
+
displayName: string;
|
60
|
+
};
|
61
|
+
DateTime: {
|
62
|
+
<Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_7, Decorator_7>): JSX.Element;
|
63
|
+
displayName: string;
|
64
|
+
};
|
65
|
+
Void: {
|
66
|
+
<Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_8, Decorator_8>): JSX.Element;
|
67
|
+
displayName: string;
|
68
|
+
};
|
69
|
+
Number: {
|
70
|
+
<Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>, Component_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "defaultProps" | "propTypes" | "contextTypes">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_9, Decorator_9>): JSX.Element;
|
71
|
+
displayName: string;
|
72
|
+
};
|
73
|
+
};
|
74
|
+
Field: {
|
75
|
+
<D_3 extends originalFormilyReact.JSXComponent, C_3 extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.IFieldProps<D_3, C_3, import("@formily/core").Field<any, any, any, any>>): JSX.Element;
|
76
|
+
displayName: string;
|
77
|
+
};
|
78
|
+
FormContext: import("react").Context<import("@formily/core").Form<any>>;
|
79
|
+
FieldContext: import("react").Context<import("@formily/core").GeneralField>;
|
80
|
+
SchemaMarkupContext: import("react").Context<originalFormilyReact.Schema<any, any, any, any, any, any, any, any, any>>;
|
81
|
+
SchemaContext: import("react").Context<originalFormilyReact.Schema<any, any, any, any, any, any, any, any, any>>;
|
82
|
+
SchemaExpressionScopeContext: import("react").Context<any>;
|
83
|
+
SchemaOptionsContext: import("react").Context<originalFormilyReact.ISchemaFieldReactFactoryOptions<any>>;
|
84
|
+
ContextCleaner: ({ children }: {
|
85
|
+
children: any;
|
86
|
+
}) => any;
|
87
|
+
mapProps<T extends originalFormilyReact.JSXComponent>(...args: originalFormilyReact.IStateMapper<import("react").ComponentProps<T>>[]): (target: T) => import("react").MemoExoticComponent<import("react").FunctionComponent<any>>;
|
88
|
+
mapReadPretty<T_1 extends originalFormilyReact.JSXComponent, C_4 extends originalFormilyReact.JSXComponent>(component: C_4, readPrettyProps?: import("react").ComponentProps<C_4> | undefined): (target: T_1) => import("react").MemoExoticComponent<import("react").FunctionComponent<{
|
89
|
+
ref?: import("react").RefAttributes<any> | undefined;
|
90
|
+
}>>;
|
91
|
+
connect<T_2 extends originalFormilyReact.JSXComponent>(target: T_2, ...args: originalFormilyReact.IComponentMapper<T_2>[]): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<Partial<import("react").ComponentProps<T_2>>> & import("react").RefAttributes<unknown>>;
|
92
|
+
observer: typeof originalFormilyReact.observer;
|
93
|
+
Observer: import("react").MemoExoticComponent<import("react").FunctionComponent<import("@formily/reactive-react").IObserverProps>>;
|
94
|
+
useForm: <T_3 extends object = any>() => import("@formily/core").Form<T_3>;
|
95
|
+
useField: <T_4 = import("@formily/core").GeneralField>() => T_4;
|
96
|
+
useParentForm: () => import("@formily/core").Form<any> | import("@formily/core").ObjectField<any, any>;
|
97
|
+
useFieldSchema: () => originalFormilyReact.Schema<any, any, any, any, any, any, any, any, any>;
|
98
|
+
useFormEffects: (effects?: ((form: import("@formily/core").Form<any>) => void) | undefined) => void;
|
99
|
+
};
|
100
|
+
export { formilyReact };
|
12
101
|
/**
|
13
|
-
* 导出常用formily
|
102
|
+
* 导出常用formily内容
|
14
103
|
*/
|
15
104
|
import { createForm, registerValidateRules as registerRules, registerValidateFormats as registerFormats, registerValidateLocale, setValidateLanguage } from '@formily/core';
|
16
105
|
import { FormConsumer, useForm } from '@formily/react';
|
17
106
|
import { FormDialog, FormDrawer, FormStep, FormTab, FormCollapse } from '@teamix/formily';
|
18
|
-
|
19
|
-
export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, useForm, useFormDisplayValues, };
|
107
|
+
export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, useForm, };
|
20
108
|
/**
|
21
109
|
* 导出 Filter 组件
|
22
110
|
*/
|