@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,3 +1,15 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
|
5
|
+
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); }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
10
|
+
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
12
|
+
|
1
13
|
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; }
|
2
14
|
|
3
15
|
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; }
|
@@ -5,49 +17,31 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
5
17
|
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; }
|
6
18
|
|
7
19
|
import React from 'react';
|
8
|
-
import { isVoidField } from '@formily/core';
|
9
20
|
import { connect, mapProps, mapReadPretty } from '@formily/react';
|
21
|
+
import { mapSize, mapStatus, mapDataSource, mapMode } from '../../utils';
|
10
22
|
import ProField from '../../../field';
|
11
|
-
import
|
12
|
-
|
13
|
-
var
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
|
23
|
-
}
|
24
|
-
|
25
|
-
return result;
|
26
|
-
};
|
27
|
-
|
28
|
-
return dataSource.map(removeEmptyChildren);
|
23
|
+
import fieldTypeMap from '../../fieldTypeMap';
|
24
|
+
|
25
|
+
var componentBuilder = function componentBuilder(type) {
|
26
|
+
return connect(function (props) {
|
27
|
+
return /*#__PURE__*/React.createElement(ProField, _objectSpread(_objectSpread({}, props), {}, {
|
28
|
+
type: type
|
29
|
+
}));
|
30
|
+
}, mapProps(mapSize, mapStatus, mapDataSource, mapMode), mapReadPretty(function (props) {
|
31
|
+
return /*#__PURE__*/React.createElement(ProField, _objectSpread(_objectSpread({}, props), {}, {
|
32
|
+
mode: "read"
|
33
|
+
}));
|
34
|
+
}));
|
29
35
|
};
|
30
36
|
|
31
|
-
|
32
|
-
var
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
export default (function () {
|
38
|
+
var components = {};
|
39
|
+
Object.entries(fieldTypeMap).forEach(function (_ref) {
|
40
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
41
|
+
name = _ref2[0],
|
42
|
+
type = _ref2[1];
|
37
43
|
|
38
|
-
|
39
|
-
dataSource: patchDataSource((_props$dataSource = props.dataSource) !== null && _props$dataSource !== void 0 ? _props$dataSource : field === null || field === void 0 ? void 0 : field.dataSource)
|
44
|
+
components[name] = componentBuilder(type);
|
40
45
|
});
|
41
|
-
|
42
|
-
|
43
|
-
var mapMode = function mapMode(props, field) {
|
44
|
-
return _objectSpread(_objectSpread({}, props), {}, {
|
45
|
-
mode: (field === null || field === void 0 ? void 0 : field.readPretty) ? 'read' : 'edit'
|
46
|
-
});
|
47
|
-
};
|
48
|
-
|
49
|
-
export default connect(ProField, mapProps(mapSize, mapStatus, mapDataSource, mapMode), mapReadPretty(function (props) {
|
50
|
-
return /*#__PURE__*/React.createElement(ProField, _objectSpread(_objectSpread({}, props), {}, {
|
51
|
-
mode: "read"
|
52
|
-
}));
|
53
|
-
}));
|
46
|
+
return components;
|
47
|
+
})();
|
package/es/form/Filter/index.js
CHANGED
@@ -79,7 +79,7 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
|
79
79
|
}, []);
|
80
80
|
var eventProps = getEventProps(triggerType, onFilter);
|
81
81
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread({
|
82
|
-
feedbackLayout: "
|
82
|
+
feedbackLayout: "popover",
|
83
83
|
breakpoints: [],
|
84
84
|
inset: true
|
85
85
|
}, otherProps), eventProps), {}, {
|
@@ -206,7 +206,7 @@ var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
|
206
206
|
}, [layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
207
207
|
var eventProps = getEventProps(triggerType, onFilter);
|
208
208
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
209
|
-
feedbackLayout: "
|
209
|
+
feedbackLayout: "popover"
|
210
210
|
}, props), eventProps), getTeamixLayout), {}, {
|
211
211
|
form: form,
|
212
212
|
className: cls(prefixCls, props.className),
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type {
|
2
|
+
import type { ProFormProps } from '../typing';
|
3
3
|
import './index.scss';
|
4
|
-
declare const ProForm: React.FC<
|
4
|
+
declare const ProForm: React.FC<ProFormProps>;
|
5
5
|
export default ProForm;
|
package/es/form/ProForm/index.js
CHANGED
@@ -15,7 +15,6 @@ import cls from 'classnames';
|
|
15
15
|
import { createForm, onFormValuesChange } from '@formily/core';
|
16
16
|
import { toJS } from '@formily/reactive';
|
17
17
|
import { Form, FormLayout } from '@teamix/formily';
|
18
|
-
import TeamixIcon from '@teamix/icon';
|
19
18
|
import { usePrefixCls } from '@teamix/utils';
|
20
19
|
import SchemaForm from '../SchemaForm';
|
21
20
|
import { mergeArrayValue } from '../utils';
|
@@ -109,10 +108,6 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
109
108
|
});
|
110
109
|
ProForm.defaultProps = {
|
111
110
|
colon: false,
|
112
|
-
labelAlign: 'left'
|
113
|
-
tooltipIcon: /*#__PURE__*/React.createElement(TeamixIcon, {
|
114
|
-
type: "info-circle-line",
|
115
|
-
size: "small"
|
116
|
-
})
|
111
|
+
labelAlign: 'left'
|
117
112
|
};
|
118
113
|
export default ProForm;
|
@@ -109,6 +109,11 @@
|
|
109
109
|
}
|
110
110
|
}
|
111
111
|
|
112
|
+
// Icon
|
113
|
+
.#{$css-prefix}formily-icon {
|
114
|
+
transform: translate(0, -1px);
|
115
|
+
}
|
116
|
+
|
112
117
|
// 撑满模式
|
113
118
|
.#{$form-item-cls}-fullness {
|
114
119
|
> .#{$form-item-cls}-control {
|
@@ -179,10 +184,20 @@
|
|
179
184
|
|
180
185
|
// 数组类组件添加按钮
|
181
186
|
.#{$css-prefix}formily-array-base-addition {
|
182
|
-
|
187
|
+
.#{$css-prefix}formily-icon {
|
183
188
|
margin-right: 4px;
|
184
189
|
}
|
185
190
|
}
|
191
|
+
// 数组类ArrayItem Icon 居中
|
192
|
+
.#{$css-prefix}formily-array-items-item-inner {
|
193
|
+
> .#{$css-prefix}box {
|
194
|
+
> .#{$css-prefix}space-item {
|
195
|
+
> .#{$css-prefix}formily-icon {
|
196
|
+
margin-top: 9px;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
186
201
|
|
187
202
|
// Editable预览态行高
|
188
203
|
.#{$css-prefix}formily-editable-content {
|
@@ -248,6 +263,9 @@
|
|
248
263
|
// 高级筛选
|
249
264
|
.#{$teamix-pro-form}-filter-advanced,
|
250
265
|
.#{$teamix-pro-form}-filter-simple {
|
266
|
+
.#{$form-item-cls}-feedback-layout-popover {
|
267
|
+
margin-bottom: 0;
|
268
|
+
}
|
251
269
|
.#{$css-prefix}date-picker2-input {
|
252
270
|
.#{$css-prefix}input {
|
253
271
|
width: inherit;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
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; }
|
2
|
+
|
3
|
+
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; }
|
4
|
+
|
5
|
+
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; }
|
6
|
+
|
7
|
+
import { useField } from '@formily/react';
|
8
|
+
import { isPlainObj } from '@teamix/utils';
|
9
|
+
export default (function () {
|
10
|
+
var field = useField();
|
11
|
+
|
12
|
+
var refresh = function refresh() {
|
13
|
+
if (!isPlainObj(field.data)) {
|
14
|
+
field.data = {
|
15
|
+
refresh: {}
|
16
|
+
};
|
17
|
+
} else {
|
18
|
+
field.data.refresh = _objectSpread({}, field.data.refresh);
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
return {
|
23
|
+
refresh: refresh,
|
24
|
+
field: field
|
25
|
+
};
|
26
|
+
});
|
@@ -14,13 +14,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
14
14
|
* 优先使用配置,即非 undefined
|
15
15
|
* 未配置则按默认规则为基础组件和某些聚合组件添加FormItem
|
16
16
|
*/
|
17
|
-
import
|
17
|
+
import fieldTypeMap from '../fieldTypeMap';
|
18
18
|
export default (function (decorator, component) {
|
19
19
|
if (decorator !== undefined) {
|
20
20
|
return decorator;
|
21
21
|
}
|
22
22
|
|
23
|
-
if ([].concat(_toConsumableArray(Object.keys(
|
23
|
+
if ([].concat(_toConsumableArray(Object.keys(fieldTypeMap)), ['Upload', 'ArrayCards', 'ArrayCollapse', 'ArrayTable', 'ArrayItems']).includes(component)) {
|
24
24
|
return 'FormItem';
|
25
25
|
}
|
26
26
|
|
@@ -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;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["component", "type", "name", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request"];
|
1
|
+
var _excluded = ["component", "type", "name", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request", "data"];
|
2
2
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
4
|
|
@@ -34,9 +34,8 @@ import React, { memo, useCallback, useMemo } from 'react';
|
|
34
34
|
import { createSchemaField } from '@formily/react';
|
35
35
|
import { Affix } from '@alicloudfe/components';
|
36
36
|
import { Upload, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
37
|
-
import
|
37
|
+
import ProFieldComponents from '../Components/ProField';
|
38
38
|
import { EditableDialog, EditableDrawer, EditablePopover } from '../Components/Editable';
|
39
|
-
import Search from '../Components/Search';
|
40
39
|
import FormGroup from '../Components/FormGroup';
|
41
40
|
import QueryFilter from '../Components/QueryFilter';
|
42
41
|
import Text from '../Components/Text/index';
|
@@ -47,7 +46,6 @@ import initializeRequest from './initializeRequest';
|
|
47
46
|
import initializeReactions from './initializeReactions';
|
48
47
|
import initializeDataSource from './initializeDataSource';
|
49
48
|
import initializeRules from './initializeRules';
|
50
|
-
import initializeProField, { proFieldTypeMap } from './initializeProField';
|
51
49
|
import initializeArrayCards from './initializeArrayCards';
|
52
50
|
import initializeArrayCollapse from './initializeArrayCollapse';
|
53
51
|
import initializeArrayTable from './initializeArrayTable';
|
@@ -57,7 +55,7 @@ import initializeFormGroup from './initializeFormGroup';
|
|
57
55
|
import initializeFormStep from './initializeFormStep';
|
58
56
|
import initializeFormTab from './initializeFormTab';
|
59
57
|
import initializeFormCollapse from './initializeFormCollapse';
|
60
|
-
import
|
58
|
+
import fieldTypeMap from '../fieldTypeMap';
|
61
59
|
import { getRandomName, mapSchemaName } from '../utils';
|
62
60
|
import warning from '../warning';
|
63
61
|
export default /*#__PURE__*/memo(function (_ref) {
|
@@ -66,8 +64,7 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
66
64
|
components = _ref.components;
|
67
65
|
var SchemaField = useMemo(function () {
|
68
66
|
return createSchemaField({
|
69
|
-
components: {
|
70
|
-
ProField: ProField,
|
67
|
+
components: _objectSpread(_objectSpread({}, ProFieldComponents), {}, {
|
71
68
|
FormLayout: FormLayout,
|
72
69
|
FormItem: FormItem,
|
73
70
|
ArrayCollapse: ArrayCollapse,
|
@@ -89,12 +86,11 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
89
86
|
EditableDrawer: EditableDrawer,
|
90
87
|
EditablePopover: EditablePopover,
|
91
88
|
FormGroup: FormGroup,
|
92
|
-
Search: Search,
|
93
89
|
QueryFilter: QueryFilter,
|
94
90
|
Upload: Upload,
|
95
91
|
Affix: Affix,
|
96
92
|
Text: Text
|
97
|
-
}
|
93
|
+
})
|
98
94
|
});
|
99
95
|
}, []); // 合并schema中request的scope
|
100
96
|
|
@@ -110,9 +106,7 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
110
106
|
originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
|
111
107
|
|
112
108
|
if (originalComponent) {
|
113
|
-
if (Object.keys(
|
114
|
-
// ProField接管组件
|
115
|
-
newItem = initializeProField(newItem);
|
109
|
+
if (Object.keys(fieldTypeMap).includes(originalComponent)) {// ProField接管组件
|
116
110
|
} else {
|
117
111
|
// 未接管组件,判断是否为Formily组件别名
|
118
112
|
newItem = _objectSpread(_objectSpread({}, newItem), {}, {
|
@@ -163,11 +157,6 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
163
157
|
|
164
158
|
if (['FormCollapse'].includes(originalComponent)) {
|
165
159
|
newItem = initializeFormCollapse(newItem);
|
166
|
-
} // Array组件的Icon替换
|
167
|
-
|
168
|
-
|
169
|
-
if (/\.(Addition|Remove|MoveUp|MoveDown|SortHandle){1}$/g.test(originalComponent)) {
|
170
|
-
newItem = initializeArrayIcon(newItem);
|
171
160
|
}
|
172
161
|
}
|
173
162
|
|
@@ -185,6 +174,7 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
185
174
|
items = _newItem2.items,
|
186
175
|
tooltip = _newItem2.tooltip,
|
187
176
|
request = _newItem2.request,
|
177
|
+
data = _newItem2.data,
|
188
178
|
otherProps = _objectWithoutProperties(_newItem2, _excluded); // 默认类型
|
189
179
|
|
190
180
|
|
@@ -231,7 +221,8 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
231
221
|
decoratorProps: defaultDecoratorProps,
|
232
222
|
rules: defaultRules,
|
233
223
|
reactions: defaultReactions,
|
234
|
-
dataSource: defaultDataSource
|
224
|
+
dataSource: defaultDataSource,
|
225
|
+
data: data
|
235
226
|
})); // 递归子组件
|
236
227
|
|
237
228
|
var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
|
@@ -250,11 +241,11 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
250
241
|
type: 'object',
|
251
242
|
properties: formatSchema(schema)
|
252
243
|
};
|
253
|
-
}, [
|
244
|
+
}, []); // console.log(schemaPro);
|
254
245
|
|
255
|
-
return /*#__PURE__*/React.createElement(
|
246
|
+
return /*#__PURE__*/React.createElement(SchemaField, {
|
256
247
|
schema: schemaPro,
|
257
248
|
components: components,
|
258
249
|
scope: mergedScope
|
259
|
-
})
|
250
|
+
});
|
260
251
|
});
|
@@ -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: {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
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; }
|
2
2
|
|
3
3
|
import { isPlainObj } from '@teamix/utils';
|
4
|
-
import {
|
4
|
+
import { $request, $dataSource } from './reactions';
|
5
5
|
import { getRandomName } from '../utils';
|
6
6
|
|
7
7
|
var initializeDataSource = function initializeDataSource(dataSource) {
|
@@ -13,7 +13,7 @@ var initializeDataSource = function initializeDataSource(dataSource) {
|
|
13
13
|
var dataSourceScopeName = getRandomName('$dataSource');
|
14
14
|
return {
|
15
15
|
reactions: ["{{".concat(dataSourceScopeName, "(").concat(requestScopeName, ",").concat(requestConfig.onComplete, ")}}")],
|
16
|
-
scope: (_scope = {}, _defineProperty(_scope, requestScopeName,
|
16
|
+
scope: (_scope = {}, _defineProperty(_scope, requestScopeName, $request(requestConfig)), _defineProperty(_scope, dataSourceScopeName, $dataSource), _scope)
|
17
17
|
};
|
18
18
|
}
|
19
19
|
|
@@ -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;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
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; }
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { $request } from '../SchemaForm/reactions';
|
4
4
|
import { getRandomName } from '../utils';
|
5
5
|
|
6
6
|
var initializeRequest = function initializeRequest(requestConfig) {
|
@@ -8,7 +8,7 @@ var initializeRequest = function initializeRequest(requestConfig) {
|
|
8
8
|
var requestScopeName = getRandomName('$request');
|
9
9
|
return {
|
10
10
|
reactions: ["{{".concat(requestScopeName, "}}")],
|
11
|
-
scope: _defineProperty({}, requestScopeName,
|
11
|
+
scope: _defineProperty({}, requestScopeName, $request(requestConfig))
|
12
12
|
};
|
13
13
|
}
|
14
14
|
|
@@ -1,33 +1,61 @@
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
+
|
3
|
+
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."); }
|
4
|
+
|
5
|
+
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); }
|
6
|
+
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
8
|
+
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
10
|
+
|
11
|
+
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; }
|
12
|
+
|
1
13
|
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; }
|
2
14
|
|
3
15
|
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; }
|
4
16
|
|
5
17
|
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; }
|
6
18
|
|
7
|
-
import { isPlainObj } from '@teamix/utils';
|
8
|
-
import {
|
19
|
+
import { isArr, isPlainObj } from '@teamix/utils';
|
20
|
+
import { $request } from '../SchemaForm/reactions';
|
9
21
|
import { getRandomName } from '../utils';
|
10
|
-
import {
|
22
|
+
import { $validator } from './reactions';
|
11
23
|
|
12
24
|
var initializeRules = function initializeRules(rules) {
|
13
|
-
|
14
|
-
|
25
|
+
var initializeValidator = function initializeValidator(rule) {
|
26
|
+
if (isPlainObj(rule === null || rule === void 0 ? void 0 : rule.validator)) {
|
27
|
+
var _scope;
|
28
|
+
|
29
|
+
var validator = rule.validator;
|
30
|
+
var requestScopeName = getRandomName('$request');
|
31
|
+
var validatorScopeName = getRandomName('$validator');
|
32
|
+
return {
|
33
|
+
rules: _objectSpread(_objectSpread({}, rule), {}, {
|
34
|
+
validator: "{{".concat(validatorScopeName, "(").concat(requestScopeName, ",").concat(validator.onComplete, ")}}")
|
35
|
+
}),
|
36
|
+
scope: (_scope = {}, _defineProperty(_scope, requestScopeName, $request(validator)), _defineProperty(_scope, validatorScopeName, $validator), _scope)
|
37
|
+
};
|
38
|
+
}
|
15
39
|
|
16
|
-
var validator = rules.validator;
|
17
|
-
var requestScopeName = getRandomName('$request');
|
18
|
-
var validatorScopeName = getRandomName('$validator');
|
19
40
|
return {
|
20
|
-
rules:
|
21
|
-
|
22
|
-
}),
|
23
|
-
scope: (_scope = {}, _defineProperty(_scope, requestScopeName, useRequest(validator)), _defineProperty(_scope, validatorScopeName, useValidator), _scope)
|
41
|
+
rules: rule,
|
42
|
+
scope: {}
|
24
43
|
};
|
44
|
+
};
|
45
|
+
|
46
|
+
if (isArr(rules)) {
|
47
|
+
return rules.reduce(function (prev, current) {
|
48
|
+
var result = initializeValidator(current);
|
49
|
+
prev.rules = [].concat(_toConsumableArray(prev.rules), [result.rules]);
|
50
|
+
prev.scope = _objectSpread(_objectSpread({}, prev.scope), result.scope);
|
51
|
+
return prev;
|
52
|
+
}, {
|
53
|
+
rules: [],
|
54
|
+
scope: {}
|
55
|
+
});
|
25
56
|
}
|
26
57
|
|
27
|
-
return
|
28
|
-
rules: rules,
|
29
|
-
scope: []
|
30
|
-
};
|
58
|
+
return initializeValidator(rules);
|
31
59
|
};
|
32
60
|
|
33
61
|
export 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 };
|