@teamix/pro 1.5.3 → 1.5.4-beta.1
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/dist/pro.css +1 -1
- package/dist/pro.js +20319 -19813
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +2 -6
- package/es/actions/base.js +8 -21
- package/es/actions/dialog-component.js +2 -9
- package/es/actions/dialog-form.js +37 -75
- package/es/actions/dialog-info.js +1 -5
- package/es/actions/dialog.js +57 -95
- package/es/actions/index.d.ts +2 -0
- package/es/actions/index.js +70 -156
- package/es/actions/link.js +3 -5
- package/es/actions/quick.js +0 -6
- package/es/actions/request.js +12 -27
- package/es/actions/utils.js +1 -9
- package/es/card/card-container.js +0 -5
- package/es/card/divider.js +0 -5
- package/es/card/index.js +56 -95
- package/es/card/selectable.js +4 -13
- package/es/card/tab.js +1 -10
- package/es/card/utils.js +0 -2
- package/es/form/Components/Editable/index.js +16 -55
- package/es/form/Components/FormGroup/index.d.ts +1 -0
- package/es/form/Components/FormGroup/index.js +7 -22
- package/es/form/Components/LightFilter/index.js +15 -35
- package/es/form/Components/ProField/index.js +2 -14
- package/es/form/Components/ProField/mapDateFormat.js +2 -28
- package/es/form/Components/Text/index.d.ts +1 -0
- package/es/form/Components/Text/index.js +2 -11
- package/es/form/Filter/AdvancedFilter.js +11 -26
- package/es/form/Filter/Layout.js +11 -24
- package/es/form/Filter/LightFilter.js +13 -24
- package/es/form/Filter/SimpleFilter.js +7 -21
- package/es/form/Filter/index.js +106 -171
- package/es/form/Filter/index2.js +11 -28
- package/es/form/Filter/useBindUrl.js +18 -46
- package/es/form/Filter/useSpecialProps.js +8 -13
- package/es/form/ProForm/addCascadeEffect.js +10 -32
- package/es/form/ProForm/customComponent.js +0 -5
- package/es/form/ProForm/index.js +23 -34
- package/es/form/ProForm/useAutoLayout.js +21 -42
- package/es/form/ProForm/useAutoSubmit.js +3 -8
- package/es/form/ProForm/useFieldRequest.js +0 -5
- package/es/form/ProForm/useFormDisplayValues.js +12 -28
- package/es/form/ProForm/useInitialRequest.js +0 -5
- package/es/form/SchemaForm/adapterComponent.js +0 -3
- package/es/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/es/form/SchemaForm/adapterDecorator.js +0 -8
- package/es/form/SchemaForm/adapterType.js +0 -2
- package/es/form/SchemaForm/index.js +78 -114
- package/es/form/SchemaForm/initializeArrayCards.js +0 -6
- package/es/form/SchemaForm/initializeArrayCollapse.js +0 -6
- package/es/form/SchemaForm/initializeArrayItems.js +2 -9
- package/es/form/SchemaForm/initializeArrayTable.js +21 -34
- package/es/form/SchemaForm/initializeDataSource.js +2 -6
- package/es/form/SchemaForm/initializeFormButton.js +14 -31
- package/es/form/SchemaForm/initializeFormCollapse.js +8 -18
- package/es/form/SchemaForm/initializeFormGroup.js +10 -20
- package/es/form/SchemaForm/initializeFormStep.js +11 -23
- package/es/form/SchemaForm/initializeFormTab.js +10 -20
- package/es/form/SchemaForm/initializeReactions.js +9 -33
- package/es/form/SchemaForm/initializeRequest.js +2 -16
- package/es/form/SchemaForm/initializeRules.js +4 -22
- package/es/form/SchemaForm/initializeSelectTable.js +7 -33
- package/es/form/SchemaForm/reactions.js +19 -34
- package/es/form/docs/ActionResponse.d.ts +1 -0
- package/es/form/index.d.ts +9 -9
- package/es/form/index.js +0 -9
- package/es/form/typing.d.ts +6 -4
- package/es/form/utils.d.ts +1 -1
- package/es/form/utils.js +4 -49
- package/es/form/warning.js +2 -7
- package/es/index-without-icon.js +4 -3
- package/es/index.d.ts +1 -1
- package/es/index.js +7 -8
- package/es/info/components/InfoGroup/index.js +21 -32
- package/es/info/components/InfoValueItem/index.js +66 -119
- package/es/info/components/ProInfoItem/index.js +13 -21
- package/es/info/components/baseInfo/index.js +14 -26
- package/es/info/components/headerInfo/index.js +8 -20
- package/es/info/components/tableInfo/index.js +20 -50
- package/es/info/index.js +53 -82
- package/es/info/utils/index.js +0 -11
- package/es/nocode/configurators/common.js +5 -6
- package/es/nocode/configurators/index.js +2 -3
- package/es/nocode/index.js +6 -6
- package/es/nocode/pages/editor.js +5 -9
- package/es/nocode/pages/index.js +4 -4
- package/es/nocode/pages/playground.js +18 -35
- package/es/nocode/pages/renderer.js +9 -42
- package/es/nocode/playground.js +10 -23
- package/es/page-header/index.d.ts +2 -2
- package/es/page-header/index.js +39 -75
- package/es/sidebar/components/sidebar-container/index.js +41 -72
- package/es/sidebar/components/tree/index.js +88 -144
- package/es/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -26
- package/es/sidebar/components/tree-node/components/IconAction/index.js +9 -35
- package/es/sidebar/components/tree-node/components/IconSwitch/index.js +12 -25
- package/es/sidebar/components/tree-node/index.js +41 -83
- package/es/sidebar/index.js +69 -94
- package/es/sidebar/utils/action-ref.js +2 -7
- package/es/sidebar/utils/index.d.ts +5 -2
- package/es/sidebar/utils/index.js +41 -98
- package/es/table/components/CardView/index.js +62 -149
- package/es/table/components/Filter/index.js +42 -83
- package/es/table/components/Layout/index.js +25 -45
- package/es/table/components/LoadMore/index.js +15 -34
- package/es/table/components/Pagination/index.js +25 -58
- package/es/table/components/QuickAction/index.js +3 -11
- package/es/table/components/ToolBar/CardSwitch.js +6 -17
- package/es/table/components/ToolBar/DensityIcon.js +18 -31
- package/es/table/components/ToolBar/FilterColumnIcon.js +50 -106
- package/es/table/components/ToolBar/FullScreenIcon.js +2 -6
- package/es/table/components/ToolBar/Fullscreen.js +19 -35
- package/es/table/components/ToolBar/RefreshIcon.js +2 -5
- package/es/table/components/ToolBar/index.js +23 -45
- package/es/table/index.js +226 -399
- package/es/table/utils/columnRender.d.ts +1 -1
- package/es/table/utils/columnRender.js +32 -76
- package/es/table/utils/genProColumnToColumn.js +5 -14
- package/es/table/utils/index.js +14 -47
- package/es/table/utils/pureColumnRender.js +21 -53
- package/es/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/es/table/utils/pureGenProColumnToColumn.js +2 -10
- package/es/table/utils/useTableSelection.js +6 -33
- package/es/templates/List/index.js +2 -9
- package/es/timeline/ProTimeLineItem/index.js +24 -64
- package/es/timeline/index.js +8 -22
- package/es/timeline/typing.d.ts +1 -0
- package/es/utils/message.d.ts +2 -2
- package/es/utils/message.js +0 -5
- package/es/utils/useRealHistory.d.ts +8 -0
- package/es/utils/useRealHistory.js +23 -0
- package/lib/actions/base.js +8 -24
- package/lib/actions/confirm.js +0 -5
- package/lib/actions/danger-confirm.js +0 -5
- package/lib/actions/danger-pop-confirm.js +0 -4
- package/lib/actions/dialog-component.js +2 -15
- package/lib/actions/dialog-form.js +36 -88
- package/lib/actions/dialog-info.js +1 -10
- package/lib/actions/dialog-table.js +0 -5
- package/lib/actions/dialog.js +55 -111
- package/lib/actions/drawer-form.js +0 -3
- package/lib/actions/drawer-info.js +0 -3
- package/lib/actions/drawer-table.js +0 -3
- package/lib/actions/drawer.js +0 -4
- package/lib/actions/error.js +0 -5
- package/lib/actions/index.d.ts +2 -0
- package/lib/actions/index.js +70 -186
- package/lib/actions/link.js +3 -10
- package/lib/actions/notice.js +0 -5
- package/lib/actions/pop-confirm.js +0 -5
- package/lib/actions/quick.js +0 -13
- package/lib/actions/request.js +10 -32
- package/lib/actions/utils.js +1 -9
- package/lib/card/card-container.js +0 -9
- package/lib/card/divider.js +0 -7
- package/lib/card/index.js +56 -122
- package/lib/card/selectable.js +4 -20
- package/lib/card/tab.js +1 -14
- package/lib/card/utils.js +0 -6
- package/lib/field/index.js +0 -6
- package/lib/form/Components/Editable/index.js +15 -65
- package/lib/form/Components/FormGroup/index.d.ts +1 -0
- package/lib/form/Components/FormGroup/index.js +7 -28
- package/lib/form/Components/LightFilter/index.js +15 -47
- package/lib/form/Components/ProField/index.js +2 -21
- package/lib/form/Components/ProField/mapDateFormat.js +2 -32
- package/lib/form/Components/Text/index.d.ts +1 -0
- package/lib/form/Components/Text/index.js +2 -16
- package/lib/form/Filter/AdvancedFilter.js +11 -34
- package/lib/form/Filter/Layout.js +11 -33
- package/lib/form/Filter/LightFilter.js +13 -32
- package/lib/form/Filter/SimpleFilter.js +5 -27
- package/lib/form/Filter/index.js +105 -191
- package/lib/form/Filter/index2.js +11 -38
- package/lib/form/Filter/useBindUrl.js +18 -50
- package/lib/form/Filter/useSpecialProps.js +6 -13
- package/lib/form/ProForm/addCascadeEffect.js +10 -35
- package/lib/form/ProForm/customComponent.js +0 -8
- package/lib/form/ProForm/index.js +23 -57
- package/lib/form/ProForm/useAutoLayout.js +21 -45
- package/lib/form/ProForm/useAutoSubmit.js +3 -10
- package/lib/form/ProForm/useFieldRequest.js +0 -8
- package/lib/form/ProForm/useFormDisplayValues.js +12 -34
- package/lib/form/ProForm/useInitialRequest.js +0 -6
- package/lib/form/SchemaForm/adapterComponent.js +0 -6
- package/lib/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/lib/form/SchemaForm/adapterDecorator.js +0 -12
- package/lib/form/SchemaForm/adapterType.js +0 -5
- package/lib/form/SchemaForm/index.js +78 -144
- package/lib/form/SchemaForm/initializeArrayCards.js +0 -7
- package/lib/form/SchemaForm/initializeArrayCollapse.js +0 -7
- package/lib/form/SchemaForm/initializeArrayItems.js +2 -10
- package/lib/form/SchemaForm/initializeArrayTable.js +21 -34
- package/lib/form/SchemaForm/initializeDataSource.js +2 -8
- package/lib/form/SchemaForm/initializeFormButton.js +14 -32
- package/lib/form/SchemaForm/initializeFormCollapse.js +8 -18
- package/lib/form/SchemaForm/initializeFormGroup.js +10 -20
- package/lib/form/SchemaForm/initializeFormStep.js +11 -23
- package/lib/form/SchemaForm/initializeFormTab.js +10 -20
- package/lib/form/SchemaForm/initializeReactions.js +9 -37
- package/lib/form/SchemaForm/initializeRequest.js +2 -18
- package/lib/form/SchemaForm/initializeRules.js +4 -24
- package/lib/form/SchemaForm/initializeSelectTable.js +7 -36
- package/lib/form/SchemaForm/reactions.js +17 -37
- package/lib/form/docs/ActionResponse.d.ts +1 -0
- package/lib/form/docs/ActionResponse.js +0 -5
- package/lib/form/index.d.ts +9 -9
- package/lib/form/index.js +0 -25
- package/lib/form/typing.d.ts +6 -4
- package/lib/form/utils.d.ts +1 -1
- package/lib/form/utils.js +4 -61
- package/lib/form/warning.js +2 -8
- package/lib/hooks/index.js +0 -5
- package/lib/index-without-icon.js +2 -36
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -39
- package/lib/info/components/InfoGroup/index.js +21 -42
- package/lib/info/components/InfoValueItem/index.js +66 -134
- package/lib/info/components/ProInfoItem/index.js +13 -29
- package/lib/info/components/baseInfo/index.js +14 -38
- package/lib/info/components/headerInfo/index.js +8 -31
- package/lib/info/components/tableInfo/index.js +20 -62
- package/lib/info/index.js +53 -97
- package/lib/info/utils/index.js +0 -19
- package/lib/info/utils/utils.js +0 -1
- package/lib/nocode/configurators/PageHeader.js +0 -2
- package/lib/nocode/configurators/ProTable.js +0 -2
- package/lib/nocode/configurators/common.js +5 -10
- package/lib/nocode/configurators/index.js +2 -10
- package/lib/nocode/configurators/map.js +0 -5
- package/lib/nocode/index.js +0 -11
- package/lib/nocode/pages/editor.js +5 -19
- package/lib/nocode/pages/index.js +2 -9
- package/lib/nocode/pages/playground.js +18 -52
- package/lib/nocode/pages/renderer.js +9 -53
- package/lib/nocode/playground.js +10 -35
- package/lib/page-container/index.js +0 -6
- package/lib/page-header/index.d.ts +2 -2
- package/lib/page-header/index.js +38 -88
- package/lib/sidebar/components/sidebar-container/index.js +41 -84
- package/lib/sidebar/components/tree/index.js +88 -158
- package/lib/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -34
- package/lib/sidebar/components/tree-node/components/IconAction/index.js +9 -46
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +12 -35
- package/lib/sidebar/components/tree-node/index.js +41 -99
- package/lib/sidebar/index.js +69 -112
- package/lib/sidebar/utils/action-ref.js +2 -8
- package/lib/sidebar/utils/index.d.ts +5 -2
- package/lib/sidebar/utils/index.js +41 -106
- package/lib/skeleton/index.js +0 -6
- package/lib/table/components/CardView/index.js +62 -161
- package/lib/table/components/EmptyContent/index.js +0 -6
- package/lib/table/components/Filter/index.js +42 -93
- package/lib/table/components/Layout/index.js +25 -58
- package/lib/table/components/LoadMore/index.js +15 -44
- package/lib/table/components/Pagination/index.js +25 -68
- package/lib/table/components/QuickAction/index.js +3 -15
- package/lib/table/components/ToolBar/CardSwitch.js +6 -28
- package/lib/table/components/ToolBar/DensityIcon.js +18 -42
- package/lib/table/components/ToolBar/FilterColumnIcon.js +50 -118
- package/lib/table/components/ToolBar/FullScreenIcon.js +3 -13
- package/lib/table/components/ToolBar/Fullscreen.js +19 -42
- package/lib/table/components/ToolBar/RefreshIcon.js +3 -12
- package/lib/table/components/ToolBar/index.js +23 -63
- package/lib/table/index.js +226 -423
- package/lib/table/utils/columnRender.d.ts +1 -1
- package/lib/table/utils/columnRender.js +32 -89
- package/lib/table/utils/genProColumnToColumn.js +5 -19
- package/lib/table/utils/getTableProps.js +0 -2
- package/lib/table/utils/getTableSortIcons.js +0 -5
- package/lib/table/utils/index.js +12 -55
- package/lib/table/utils/pureColumnRender.js +21 -64
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/lib/table/utils/pureGenProColumnToColumn.js +2 -11
- package/lib/table/utils/useTableSelection.js +6 -35
- package/lib/templates/Detail/index.js +0 -5
- package/lib/templates/Form/index.js +0 -5
- package/lib/templates/List/index.js +2 -19
- package/lib/templates/index.js +0 -6
- package/lib/timeline/ProTimeLineItem/index.js +24 -75
- package/lib/timeline/index.js +8 -33
- package/lib/timeline/typing.d.ts +1 -0
- package/lib/utils/index.js +0 -6
- package/lib/utils/message.d.ts +2 -2
- package/lib/utils/message.js +0 -10
- package/lib/utils/useRealHistory.d.ts +8 -0
- package/lib/utils/useRealHistory.js +32 -0
- package/package.json +1 -1
@@ -4,37 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _utils = require("@teamix/utils");
|
9
|
-
|
10
8
|
var _pureGenProColumnToColumn = _interopRequireDefault(require("../../table/utils/pureGenProColumnToColumn"));
|
11
|
-
|
12
9
|
var _excluded = ["name", "children", "props"];
|
13
|
-
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
17
|
-
|
18
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
19
|
-
|
20
13
|
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
|
-
|
22
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
23
|
-
|
24
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
25
|
-
|
26
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
27
|
-
|
28
17
|
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."); }
|
29
|
-
|
30
18
|
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); }
|
31
|
-
|
32
19
|
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; }
|
33
|
-
|
34
20
|
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; }
|
35
|
-
|
36
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
37
|
-
|
38
22
|
/**
|
39
23
|
* 将可被 ProForm 识别的上下文转换为仅被 ProTable 识别的上下文
|
40
24
|
* @param value
|
@@ -43,41 +27,33 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
27
|
var adapterContext = function adapterContext(value) {
|
44
28
|
if ((0, _utils.isStr)(value)) {
|
45
29
|
var contextReg = /^\{\{.*?\}\}$/;
|
46
|
-
|
47
30
|
if (contextReg.test(value)) {
|
48
31
|
return "\0".concat(value, "\0");
|
49
32
|
}
|
50
|
-
|
51
33
|
return value;
|
52
34
|
}
|
53
|
-
|
54
35
|
if ((0, _utils.isPlainObj)(value)) {
|
55
36
|
var temp = {};
|
56
37
|
Object.entries(value).forEach(function (_ref) {
|
57
38
|
var _ref2 = _slicedToArray(_ref, 2),
|
58
|
-
|
59
|
-
|
60
|
-
|
39
|
+
key = _ref2[0],
|
40
|
+
val = _ref2[1];
|
61
41
|
temp[key] = adapterContext(val);
|
62
42
|
});
|
63
43
|
return temp;
|
64
44
|
}
|
65
|
-
|
66
45
|
if ((0, _utils.isArr)(value)) {
|
67
46
|
return value.map(function (item) {
|
68
47
|
return adapterContext(item);
|
69
48
|
});
|
70
49
|
}
|
71
|
-
|
72
50
|
return value;
|
73
51
|
};
|
74
|
-
|
75
52
|
var initializeTableColumn = function initializeTableColumn(item) {
|
76
53
|
var name = item.name,
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
54
|
+
children = item.children,
|
55
|
+
props = item.props,
|
56
|
+
otherProps = _objectWithoutProperties(item, _excluded);
|
81
57
|
return {
|
82
58
|
name: name,
|
83
59
|
component: 'SelectTable.Column',
|
@@ -87,23 +63,19 @@ var initializeTableColumn = function initializeTableColumn(item) {
|
|
87
63
|
props: _objectSpread(_objectSpread({}, otherProps), props)
|
88
64
|
};
|
89
65
|
};
|
90
|
-
|
91
66
|
var initialize = function initialize(item) {
|
92
67
|
var _props$columns;
|
93
|
-
|
94
68
|
var _item$children = item.children,
|
95
|
-
|
96
|
-
|
69
|
+
children = _item$children === void 0 ? [] : _item$children,
|
70
|
+
props = item.props;
|
97
71
|
var prefixCls = (0, _utils.usePrefixCls)('teamix-pro-form-select-table-column-tree');
|
98
72
|
var columns = props === null || props === void 0 ? void 0 : (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.map(function (value, index) {
|
99
73
|
var column = adapterContext(value);
|
100
|
-
|
101
74
|
if ((props === null || props === void 0 ? void 0 : props.isTree) && index === 0) {
|
102
75
|
return _objectSpread(_objectSpread({}, column), {}, {
|
103
76
|
className: (0, _utils.cls)(prefixCls(), column.className)
|
104
77
|
});
|
105
78
|
}
|
106
|
-
|
107
79
|
return column;
|
108
80
|
});
|
109
81
|
return _objectSpread(_objectSpread({}, item), {}, {
|
@@ -115,6 +87,5 @@ var initialize = function initialize(item) {
|
|
115
87
|
})
|
116
88
|
});
|
117
89
|
};
|
118
|
-
|
119
90
|
var _default = initialize;
|
120
91
|
exports.default = _default;
|
@@ -4,42 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.$validator = exports.$request = exports.$dataSource = exports.$common = void 0;
|
7
|
-
|
8
7
|
var _utils = require("@teamix/utils");
|
9
|
-
|
10
8
|
var _excluded = ["extraConfig", "onComplete"];
|
11
|
-
|
12
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
13
|
-
|
14
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
|
-
|
16
11
|
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; }
|
17
|
-
|
18
12
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
19
|
-
|
20
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
21
|
-
|
22
14
|
// 配置请求
|
23
15
|
var $request = function $request(field, context, _ref, type) {
|
24
16
|
var _field$data;
|
25
|
-
|
26
17
|
var extraConfig = _ref.extraConfig,
|
27
|
-
|
28
|
-
|
29
|
-
|
18
|
+
onComplete = _ref.onComplete,
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
30
20
|
var requestConfig = rest;
|
31
21
|
var params = requestConfig.params,
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
var beforeRequestResult = (0, _utils.isFn)(beforeRequest) ? beforeRequest(field, context) : {};
|
36
|
-
|
22
|
+
beforeRequest = requestConfig.beforeRequest,
|
23
|
+
formatResult = requestConfig.formatResult,
|
24
|
+
onSuccess = requestConfig.onSuccess;
|
25
|
+
var beforeRequestResult = (0, _utils.isFn)(beforeRequest) ? beforeRequest(field, context) : {};
|
26
|
+
// 通过字段 data 的 refresh 主动触发的请求刷新
|
37
27
|
var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
|
38
|
-
var refreshResult = (0, _utils.isPlainObj)(refresh) ? refresh : {};
|
39
|
-
|
40
|
-
var mergedParams = _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult);
|
41
|
-
|
42
|
-
|
28
|
+
var refreshResult = (0, _utils.isPlainObj)(refresh) ? refresh : {};
|
29
|
+
// 合并请求参数
|
30
|
+
var mergedParams = _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult);
|
31
|
+
// 执行通用数据请求
|
43
32
|
return (0, _utils.doCommonRequest)(_objectSpread(_objectSpread({}, requestConfig), {}, {
|
44
33
|
params: mergedParams,
|
45
34
|
beforeRequest: function beforeRequest() {
|
@@ -55,24 +44,19 @@ var $request = function $request(field, context, _ref, type) {
|
|
55
44
|
field: field,
|
56
45
|
params: mergedParams
|
57
46
|
}));
|
58
|
-
};
|
59
|
-
|
60
|
-
|
47
|
+
};
|
48
|
+
// 通用请求配置上下文
|
61
49
|
exports.$request = $request;
|
62
|
-
|
63
50
|
var $common = function $common(services, context, requestConfig) {
|
64
51
|
return function (field) {
|
65
52
|
return services(field, context, requestConfig, 'request').then(function (res) {
|
66
53
|
var _requestConfig$onComp;
|
67
|
-
|
68
54
|
return requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$onComp = requestConfig.onComplete) === null || _requestConfig$onComp === void 0 ? void 0 : _requestConfig$onComp.call(requestConfig, res, field, context);
|
69
55
|
});
|
70
56
|
};
|
71
|
-
};
|
72
|
-
|
73
|
-
|
57
|
+
};
|
58
|
+
// 配置校验
|
74
59
|
exports.$common = $common;
|
75
|
-
|
76
60
|
var $validator = function $validator(services, context, requestConfig) {
|
77
61
|
return function (value, rules, _ref2) {
|
78
62
|
var field = _ref2.field;
|
@@ -84,11 +68,9 @@ var $validator = function $validator(services, context, requestConfig) {
|
|
84
68
|
}
|
85
69
|
});
|
86
70
|
};
|
87
|
-
};
|
88
|
-
|
89
|
-
|
71
|
+
};
|
72
|
+
// 配置DataSource
|
90
73
|
exports.$validator = $validator;
|
91
|
-
|
92
74
|
var $dataSource = function $dataSource(services, context, requestConfig) {
|
93
75
|
return function (field) {
|
94
76
|
field.setState({
|
@@ -96,7 +78,6 @@ var $dataSource = function $dataSource(services, context, requestConfig) {
|
|
96
78
|
});
|
97
79
|
return services(field, context, requestConfig, 'dataSource').then(function (res) {
|
98
80
|
var _requestConfig$extraC, _requestConfig$onComp2;
|
99
|
-
|
100
81
|
var isValueInDataSource = (0, _utils.getValueByValue)(res, field.value);
|
101
82
|
var clearResult = !isValueInDataSource && (requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$extraC = requestConfig.extraConfig) === null || _requestConfig$extraC === void 0 ? void 0 : _requestConfig$extraC.clearInvalidValue) !== false ? {
|
102
83
|
value: undefined
|
@@ -113,5 +94,4 @@ var $dataSource = function $dataSource(services, context, requestConfig) {
|
|
113
94
|
});
|
114
95
|
};
|
115
96
|
};
|
116
|
-
|
117
97
|
exports.$dataSource = $dataSource;
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.ActionResponse = void 0;
|
7
|
-
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
8
|
require("./ActionResponse.less");
|
11
|
-
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
10
|
var ActionResponse = function ActionResponse(props) {
|
15
11
|
return /*#__PURE__*/_react.default.createElement("div", {
|
16
12
|
className: "as-wrapper"
|
@@ -20,5 +16,4 @@ var ActionResponse = function ActionResponse(props) {
|
|
20
16
|
className: "as-response"
|
21
17
|
}, "Response\uFF1A", props.response));
|
22
18
|
};
|
23
|
-
|
24
19
|
exports.ActionResponse = ActionResponse;
|
package/lib/form/index.d.ts
CHANGED
@@ -38,39 +38,39 @@ declare const formilyReact: {
|
|
38
38
|
<Decorator extends originalFormilyReact.JSXComponent, Component extends originalFormilyReact.JSXComponent>(props: originalFormilyReact.ISchemaFieldProps<Decorator, Component, import("@formily/core").ObjectField<Decorator, Component>>): JSX.Element;
|
39
39
|
displayName: string;
|
40
40
|
Markup: {
|
41
|
-
<Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
41
|
+
<Decorator_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_1 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaMarkupFieldProps<Components, Component_1, Decorator_1>): JSX.Element;
|
42
42
|
displayName: string;
|
43
43
|
};
|
44
44
|
String: {
|
45
|
-
<Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
45
|
+
<Decorator_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_2 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_2, Decorator_2>): JSX.Element;
|
46
46
|
displayName: string;
|
47
47
|
};
|
48
48
|
Object: {
|
49
|
-
<Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
49
|
+
<Decorator_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_3 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_3, Decorator_3>): JSX.Element;
|
50
50
|
displayName: string;
|
51
51
|
};
|
52
52
|
Array: {
|
53
|
-
<Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
53
|
+
<Decorator_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_4 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_4, Decorator_4>): JSX.Element;
|
54
54
|
displayName: string;
|
55
55
|
};
|
56
56
|
Boolean: {
|
57
|
-
<Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
57
|
+
<Decorator_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_5 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_5, Decorator_5>): JSX.Element;
|
58
58
|
displayName: string;
|
59
59
|
};
|
60
60
|
Date: {
|
61
|
-
<Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
61
|
+
<Decorator_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_6 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_6, Decorator_6>): JSX.Element;
|
62
62
|
displayName: string;
|
63
63
|
};
|
64
64
|
DateTime: {
|
65
|
-
<Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
65
|
+
<Decorator_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_7 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_7, Decorator_7>): JSX.Element;
|
66
66
|
displayName: string;
|
67
67
|
};
|
68
68
|
Void: {
|
69
|
-
<Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
69
|
+
<Decorator_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_8 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_8, Decorator_8>): JSX.Element;
|
70
70
|
displayName: string;
|
71
71
|
};
|
72
72
|
Number: {
|
73
|
-
<Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "
|
73
|
+
<Decorator_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>, Component_9 extends originalFormilyReact.ReactComponentPath<Components, Exclude<keyof Components, "displayName" | "propTypes" | "contextTypes" | "defaultProps">>>(props: originalFormilyReact.ISchemaTypeFieldProps<Components, Component_9, Decorator_9>): JSX.Element;
|
74
74
|
displayName: string;
|
75
75
|
};
|
76
76
|
};
|
package/lib/form/index.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
@@ -131,9 +130,7 @@ Object.defineProperty(exports, "useForm", {
|
|
131
130
|
return originalFormilyReact.useForm;
|
132
131
|
}
|
133
132
|
});
|
134
|
-
|
135
133
|
var _typing = require("./typing");
|
136
|
-
|
137
134
|
Object.keys(_typing).forEach(function (key) {
|
138
135
|
if (key === "default" || key === "__esModule") return;
|
139
136
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
@@ -145,52 +142,30 @@ Object.keys(_typing).forEach(function (key) {
|
|
145
142
|
}
|
146
143
|
});
|
147
144
|
});
|
148
|
-
|
149
145
|
var _formilyCore = _interopRequireWildcard(require("@formily/core"));
|
150
|
-
|
151
146
|
exports.formilyCore = _formilyCore;
|
152
|
-
|
153
147
|
var _formilyReactive = _interopRequireWildcard(require("@formily/reactive"));
|
154
|
-
|
155
148
|
exports.formilyReactive = _formilyReactive;
|
156
|
-
|
157
149
|
var _formilyTeamix = _interopRequireWildcard(require("@teamix/formily"));
|
158
|
-
|
159
150
|
exports.formilyTeamix = _formilyTeamix;
|
160
|
-
|
161
151
|
var originalFormilyReact = _interopRequireWildcard(require("@formily/react"));
|
162
|
-
|
163
152
|
var _useFormDisplayValues = require("./ProForm/useFormDisplayValues");
|
164
|
-
|
165
153
|
var _useFieldRequest = _interopRequireDefault(require("./ProForm/useFieldRequest"));
|
166
|
-
|
167
154
|
var _customComponent = require("./ProForm/customComponent");
|
168
|
-
|
169
155
|
var _Filter = require("./Filter");
|
170
|
-
|
171
156
|
var _Layout = require("./Filter/Layout");
|
172
|
-
|
173
157
|
var _index = require("./Filter/index2");
|
174
|
-
|
175
158
|
var _ProForm = _interopRequireDefault(require("./ProForm"));
|
176
|
-
|
177
159
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
178
|
-
|
179
160
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
180
|
-
|
181
161
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
182
|
-
|
183
162
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
184
|
-
|
185
163
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
186
|
-
|
187
164
|
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; }
|
188
|
-
|
189
165
|
var formilyReact = _objectSpread(_objectSpread({}, originalFormilyReact), {}, {
|
190
166
|
useFieldRequest: _useFieldRequest.default,
|
191
167
|
useFormDisplayValues: _useFormDisplayValues.useFormDisplayValues
|
192
168
|
});
|
193
|
-
|
194
169
|
exports.formilyReact = formilyReact;
|
195
170
|
var _default = _ProForm.default;
|
196
171
|
exports.default = _default;
|
package/lib/form/typing.d.ts
CHANGED
@@ -106,6 +106,7 @@ export interface ProFormProps extends Omit<IFormLayoutProps, 'breakpoints'> {
|
|
106
106
|
onInitialComplete?: (form: FormType) => void;
|
107
107
|
breakpoints?: number[] | boolean;
|
108
108
|
autoLayout?: AutoLayout | boolean;
|
109
|
+
component?: any;
|
109
110
|
}
|
110
111
|
export interface FilterProps extends ProFormProps {
|
111
112
|
form: FormType;
|
@@ -118,13 +119,14 @@ export interface FilterProps extends ProFormProps {
|
|
118
119
|
export interface QueryFilterLayoutProps {
|
119
120
|
prefixCls?: string;
|
120
121
|
className?: string;
|
121
|
-
addonBefore?: ReactNode;
|
122
|
-
addonAfter?: ReactNode;
|
122
|
+
addonBefore?: ReactNode | any;
|
123
|
+
addonAfter?: ReactNode | any;
|
123
124
|
inlineContent?: ReactNode;
|
124
125
|
panelContent?: ReactNode;
|
125
126
|
count?: number;
|
126
127
|
expand?: boolean;
|
127
128
|
onExpand?: (expand: boolean) => void;
|
129
|
+
children?: React.ReactNode;
|
128
130
|
}
|
129
131
|
export interface QueryFilterProps extends ProFormProps {
|
130
132
|
/**
|
@@ -141,9 +143,9 @@ export interface QueryFilterProps extends ProFormProps {
|
|
141
143
|
/** 是否强制清除 */
|
142
144
|
forceClear?: boolean;
|
143
145
|
/** 顶部筛选区前缀 */
|
144
|
-
addonBefore?: ReactNode;
|
146
|
+
addonBefore?: ReactNode | any;
|
145
147
|
/** 顶部筛选区后缀 */
|
146
|
-
addonAfter?: ReactNode;
|
148
|
+
addonAfter?: ReactNode | any;
|
147
149
|
/** 顶部筛选区默认筛选项 */
|
148
150
|
defaultFilterValue?: string;
|
149
151
|
/** 顶部筛选区筛选项配置 */
|
package/lib/form/utils.d.ts
CHANGED
@@ -43,7 +43,7 @@ declare const mergeArrayValue: (arr: any[], v?: any) => any[];
|
|
43
43
|
* @param suffix scope名称后缀
|
44
44
|
* @returns 表达式和scope上下文
|
45
45
|
*/
|
46
|
-
declare const initializeRequestExpression: (config?: any, mode?: string
|
46
|
+
declare const initializeRequestExpression: (config?: any, mode?: string, suffix?: string) => {
|
47
47
|
expression: string;
|
48
48
|
scope: {
|
49
49
|
[x: string]: object;
|
package/lib/form/utils.js
CHANGED
@@ -4,43 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.mergeArrayValue = exports.mapStatus = exports.mapSize = exports.mapSchemaName = exports.mapMode = exports.mapDataSource = exports.initializeRequestExpression = exports.getFieldName = void 0;
|
7
|
-
|
8
7
|
var _core = require("@formily/core");
|
9
|
-
|
10
8
|
var _formily = require("@teamix/formily");
|
11
|
-
|
12
9
|
var _utils = require("@teamix/utils");
|
13
|
-
|
14
10
|
var _schemaNameMap = _interopRequireDefault(require("./schemaNameMap"));
|
15
|
-
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
12
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
19
|
-
|
20
13
|
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."); }
|
21
|
-
|
22
14
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
23
|
-
|
24
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
25
|
-
|
26
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
27
|
-
|
28
17
|
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."); }
|
29
|
-
|
30
18
|
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); }
|
31
|
-
|
32
19
|
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; }
|
33
|
-
|
34
20
|
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; }
|
35
|
-
|
36
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
37
|
-
|
38
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
39
|
-
|
40
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
41
|
-
|
42
24
|
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; }
|
43
|
-
|
44
25
|
/**
|
45
26
|
* 映射字段size,主要是default转medium
|
46
27
|
* @param props component的props
|
@@ -49,11 +30,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
49
30
|
*/
|
50
31
|
var mapSize = function mapSize(props, field) {
|
51
32
|
var layout = _objectSpread(_objectSpread({}, (0, _formily.useFormShallowLayout)()), (0, _formily.useFormLayout)());
|
52
|
-
|
53
33
|
var takeSize = function takeSize() {
|
54
34
|
return layout.size === 'default' ? 'medium' : layout.size;
|
55
35
|
};
|
56
|
-
|
57
36
|
return _objectSpread(_objectSpread({}, props), {}, {
|
58
37
|
size: props.size || takeSize()
|
59
38
|
});
|
@@ -64,84 +43,62 @@ var mapSize = function mapSize(props, field) {
|
|
64
43
|
* @param field 当前字段实例
|
65
44
|
* @returns 映射后的字段属性
|
66
45
|
*/
|
67
|
-
|
68
|
-
|
69
46
|
exports.mapSize = mapSize;
|
70
|
-
|
71
47
|
var mapStatus = function mapStatus(props, field) {
|
72
48
|
var _field$data;
|
73
|
-
|
74
49
|
var takeStatus = function takeStatus() {
|
75
50
|
var _field$warnings, _field$decoratorProps, _field$decoratorProps2;
|
76
|
-
|
77
51
|
if (!field) return;
|
78
52
|
if (field['loading'] || field['validating']) return 'loading';
|
79
53
|
if (field['invalid']) return 'error';
|
80
54
|
if ((_field$warnings = field['warnings']) === null || _field$warnings === void 0 ? void 0 : _field$warnings.length) return 'warning';
|
81
55
|
if (((_field$decoratorProps = field.decoratorProps) === null || _field$decoratorProps === void 0 ? void 0 : _field$decoratorProps.feedbackStatus) === 'pending') return 'loading'; // 新增
|
82
|
-
|
83
56
|
return (_field$decoratorProps2 = field.decoratorProps) === null || _field$decoratorProps2 === void 0 ? void 0 : _field$decoratorProps2.feedbackStatus;
|
84
57
|
};
|
85
|
-
|
86
58
|
var takeState = function takeState(state) {
|
87
59
|
if (state === 'validating' || state === 'pending') return 'loading';
|
88
60
|
return state;
|
89
61
|
};
|
90
|
-
|
91
62
|
var state = takeState(props.state) || takeStatus();
|
92
63
|
var result = {
|
93
64
|
state: state
|
94
|
-
};
|
95
|
-
|
65
|
+
};
|
66
|
+
// 当组件处于loading状态时,仅可读不可写。
|
96
67
|
if (state === 'loading' && ((_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.readOnlyOnLoading)) {
|
97
68
|
result.readOnly = true;
|
98
69
|
}
|
99
|
-
|
100
70
|
return _objectSpread(_objectSpread({}, props), result);
|
101
71
|
};
|
102
|
-
|
103
72
|
exports.mapStatus = mapStatus;
|
104
|
-
|
105
73
|
var patchDataSource = function patchDataSource() {
|
106
74
|
var dataSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
107
|
-
|
108
75
|
var removeEmptyChildren = function removeEmptyChildren(data) {
|
109
76
|
var result = _objectSpread({}, data);
|
110
|
-
|
111
77
|
if (!result.children || result.children.length === 0) {
|
112
78
|
delete result.children;
|
113
79
|
} else {
|
114
80
|
result.children = result.children.map(removeEmptyChildren);
|
115
81
|
}
|
116
|
-
|
117
82
|
return result;
|
118
83
|
};
|
119
|
-
|
120
84
|
return (0, _utils.isArr)(dataSource) ? dataSource.map(removeEmptyChildren) : [];
|
121
85
|
};
|
122
|
-
|
123
86
|
var mapDataSource = function mapDataSource(props, field) {
|
124
87
|
var _props$dataSource;
|
125
|
-
|
126
88
|
if ((0, _core.isVoidField)(field)) {
|
127
89
|
return props;
|
128
90
|
}
|
129
|
-
|
130
91
|
return _objectSpread(_objectSpread({}, props), {}, {
|
131
92
|
dataSource: patchDataSource((_props$dataSource = props.dataSource) !== null && _props$dataSource !== void 0 ? _props$dataSource : field === null || field === void 0 ? void 0 : field.dataSource)
|
132
93
|
});
|
133
94
|
};
|
134
|
-
|
135
95
|
exports.mapDataSource = mapDataSource;
|
136
|
-
|
137
96
|
var mapMode = function mapMode(props, field) {
|
138
97
|
return _objectSpread(_objectSpread({}, props), {}, {
|
139
98
|
mode: (field === null || field === void 0 ? void 0 : field.readPretty) ? 'read' : 'edit'
|
140
99
|
});
|
141
100
|
};
|
142
|
-
|
143
101
|
exports.mapMode = mapMode;
|
144
|
-
|
145
102
|
var getFieldName = function getFieldName() {
|
146
103
|
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'FieldName';
|
147
104
|
var suffix = arguments.length > 1 ? arguments[1] : undefined;
|
@@ -152,22 +109,17 @@ var getFieldName = function getFieldName() {
|
|
152
109
|
* @param obj
|
153
110
|
* @returns
|
154
111
|
*/
|
155
|
-
|
156
|
-
|
157
112
|
exports.getFieldName = getFieldName;
|
158
|
-
|
159
113
|
var mapSchemaName = function mapSchemaName(obj) {
|
160
114
|
var temp = {};
|
161
115
|
Object.entries(obj).map(function (_ref) {
|
162
116
|
var _ref2 = _slicedToArray(_ref, 2),
|
163
|
-
|
164
|
-
|
165
|
-
|
117
|
+
key = _ref2[0],
|
118
|
+
value = _ref2[1];
|
166
119
|
var newKey = (0, _utils.getValueByValue)(_schemaNameMap.default, key, {
|
167
120
|
inputKey: 'proForm',
|
168
121
|
outputKey: 'formily'
|
169
122
|
}) || key;
|
170
|
-
|
171
123
|
if (value !== undefined && value !== null) {
|
172
124
|
if ((0, _utils.isArr)(value)) {
|
173
125
|
if (value.length) {
|
@@ -190,15 +142,11 @@ var mapSchemaName = function mapSchemaName(obj) {
|
|
190
142
|
* @param v 数组或其他
|
191
143
|
* @returns 合并数组或合并其他值
|
192
144
|
*/
|
193
|
-
|
194
|
-
|
195
145
|
exports.mapSchemaName = mapSchemaName;
|
196
|
-
|
197
146
|
var mergeArrayValue = function mergeArrayValue(arr, v) {
|
198
147
|
if ((0, _utils.isArr)(v)) {
|
199
148
|
return [].concat(_toConsumableArray(arr), _toConsumableArray(v));
|
200
149
|
}
|
201
|
-
|
202
150
|
return [].concat(_toConsumableArray(arr), [v]);
|
203
151
|
};
|
204
152
|
/**
|
@@ -207,10 +155,7 @@ var mergeArrayValue = function mergeArrayValue(arr, v) {
|
|
207
155
|
* @param suffix scope名称后缀
|
208
156
|
* @returns 表达式和scope上下文
|
209
157
|
*/
|
210
|
-
|
211
|
-
|
212
158
|
exports.mergeArrayValue = mergeArrayValue;
|
213
|
-
|
214
159
|
var initializeRequestExpression = function initializeRequestExpression(config, mode, suffix) {
|
215
160
|
if ((0, _utils.isPlainObj)(config)) {
|
216
161
|
var requestConfigName = "$requestConfig_".concat(suffix);
|
@@ -219,8 +164,6 @@ var initializeRequestExpression = function initializeRequestExpression(config, m
|
|
219
164
|
scope: _defineProperty({}, requestConfigName, config)
|
220
165
|
};
|
221
166
|
}
|
222
|
-
|
223
167
|
return {};
|
224
168
|
};
|
225
|
-
|
226
169
|
exports.initializeRequestExpression = initializeRequestExpression;
|