@teamix/pro 1.4.25-bugfix.2 → 1.4.25-bugfix.3
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 +64943 -84006
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +6 -13
- package/es/actions/base.js +21 -8
- package/es/actions/dialog-component.js +9 -2
- package/es/actions/dialog-form.js +75 -37
- package/es/actions/dialog-info.js +5 -1
- package/es/actions/dialog.js +95 -57
- package/es/actions/index.d.ts +0 -7
- package/es/actions/index.js +153 -93
- package/es/actions/index.scss +1 -6
- package/es/actions/link.js +5 -3
- package/es/actions/request.js +27 -12
- package/es/actions/utils.js +9 -1
- package/es/card/card-container.js +5 -0
- package/es/card/divider.js +5 -0
- package/es/card/index.js +100 -61
- package/es/card/index.scss +0 -15
- package/es/card/selectable.js +13 -4
- package/es/card/tab.js +10 -1
- package/es/card/utils.js +2 -0
- package/es/form/Components/Editable/index.js +55 -16
- package/es/form/Components/FormGroup/index.d.ts +0 -1
- package/es/form/Components/FormGroup/index.js +22 -7
- package/es/form/Components/LightFilter/index.js +35 -15
- package/es/form/Components/ProField/index.js +14 -2
- package/es/form/Components/ProField/mapDateFormat.js +28 -2
- package/es/form/Components/Text/index.d.ts +0 -1
- package/es/form/Components/Text/index.js +11 -2
- package/es/form/Filter/AdvancedFilter.js +26 -11
- package/es/form/Filter/Layout.js +24 -11
- package/es/form/Filter/LightFilter.js +24 -13
- package/es/form/Filter/SimpleFilter.js +21 -7
- package/es/form/Filter/index.js +171 -117
- package/es/form/Filter/index2.js +28 -11
- package/es/form/Filter/layout.scss +1 -1
- package/es/form/Filter/useBindUrl.js +46 -18
- package/es/form/Filter/useSpecialProps.js +13 -8
- package/es/form/ProForm/customComponent.js +5 -0
- package/es/form/ProForm/index.js +38 -30
- package/es/form/ProForm/useAutoLayout.js +42 -21
- package/es/form/ProForm/useAutoSubmit.js +8 -3
- package/es/form/ProForm/useFieldRequest.js +5 -0
- package/es/form/ProForm/useFormDisplayValues.js +28 -12
- package/es/form/ProForm/useInitialRequest.js +5 -0
- package/es/form/SchemaForm/adapterComponent.js +3 -0
- package/es/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/es/form/SchemaForm/adapterDecorator.js +8 -0
- package/es/form/SchemaForm/adapterType.js +2 -0
- package/es/form/SchemaForm/index.js +114 -78
- package/es/form/SchemaForm/initializeArrayCards.js +6 -0
- package/es/form/SchemaForm/initializeArrayCollapse.js +6 -0
- package/es/form/SchemaForm/initializeArrayItems.js +9 -2
- package/es/form/SchemaForm/initializeArrayTable.js +34 -21
- package/es/form/SchemaForm/initializeDataSource.js +6 -2
- package/es/form/SchemaForm/initializeFormButton.js +31 -14
- package/es/form/SchemaForm/initializeFormCollapse.js +18 -8
- package/es/form/SchemaForm/initializeFormGroup.js +20 -10
- package/es/form/SchemaForm/initializeFormStep.js +23 -11
- package/es/form/SchemaForm/initializeFormTab.js +20 -10
- package/es/form/SchemaForm/initializeReactions.js +33 -9
- package/es/form/SchemaForm/initializeRequest.js +16 -2
- package/es/form/SchemaForm/initializeRules.js +22 -4
- package/es/form/SchemaForm/initializeSelectTable.js +33 -7
- package/es/form/SchemaForm/reactions.js +34 -19
- package/es/form/docs/ActionResponse.d.ts +0 -1
- package/es/form/index.d.ts +9 -9
- package/es/form/index.js +9 -0
- package/es/form/typing.d.ts +4 -26
- package/es/form/utils.d.ts +1 -1
- package/es/form/utils.js +49 -4
- package/es/form/warning.js +7 -2
- package/es/global.scss +1 -3
- package/es/index-without-icon.js +3 -4
- package/es/index.d.ts +1 -1
- package/es/index.js +8 -18
- package/es/info/components/InfoGroup/index.js +32 -21
- package/es/info/components/InfoValueItem/index.js +119 -66
- package/es/info/components/ProInfoItem/index.js +21 -13
- package/es/info/components/baseInfo/index.js +27 -17
- package/es/info/components/headerInfo/index.js +20 -8
- package/es/info/components/tableInfo/index.js +50 -20
- package/es/info/index.js +86 -61
- package/es/info/typing.d.ts +0 -2
- package/es/info/utils/index.js +11 -0
- package/es/nocode/configurators/ProTable.js +22 -1
- package/es/nocode/configurators/common.js +6 -5
- package/es/nocode/configurators/index.js +3 -2
- package/es/nocode/index.js +6 -6
- package/es/nocode/pages/editor.js +9 -5
- package/es/nocode/pages/index.js +30 -5
- package/es/nocode/pages/playground.js +35 -18
- package/es/nocode/pages/renderer.js +42 -9
- package/es/nocode/playground.js +23 -10
- package/es/page-header/index.d.ts +2 -2
- package/es/page-header/index.js +76 -40
- package/es/page-header/index.scss +1 -2
- package/es/sidebar/components/sidebar-container/index.js +69 -54
- package/es/sidebar/components/sidebar-container/index.scss +14 -21
- package/es/sidebar/components/tree/index.js +138 -100
- package/es/sidebar/components/tree-node/components/HoverTooltip/index.js +26 -11
- package/es/sidebar/components/tree-node/components/IconAction/index.js +35 -9
- package/es/sidebar/components/tree-node/components/IconSwitch/index.d.ts +2 -2
- package/es/sidebar/components/tree-node/components/IconSwitch/index.js +25 -12
- package/es/sidebar/components/tree-node/components/IconSwitch/index.scss +1 -1
- package/es/sidebar/components/tree-node/index.js +84 -42
- package/es/sidebar/components/tree-node/index.scss +0 -6
- package/es/sidebar/index.d.ts +0 -2
- package/es/sidebar/index.js +95 -72
- package/es/sidebar/typing.d.ts +0 -4
- package/es/sidebar/utils/action-ref.js +7 -2
- package/es/sidebar/utils/index.d.ts +2 -5
- package/es/sidebar/utils/index.js +98 -41
- package/es/table/components/Filter/index.d.ts +3 -6
- package/es/table/components/Filter/index.js +128 -115
- package/es/table/components/Layout/index.js +47 -32
- package/es/table/components/Layout/index.scss +1 -2
- package/es/table/components/Pagination/index.js +58 -25
- package/es/table/components/QuickAction/index.d.ts +0 -1
- package/es/table/components/QuickAction/index.js +11 -3
- package/es/table/components/ToolBar/DensityIcon.js +31 -19
- package/es/table/components/ToolBar/FilterColumnIcon.js +125 -87
- package/es/table/components/ToolBar/FullScreenIcon.js +62 -7
- package/es/table/components/ToolBar/Fullscreen.js +28 -25
- package/es/table/components/ToolBar/RefreshIcon.js +27 -162
- package/es/table/components/ToolBar/index.d.ts +1 -1
- package/es/table/components/ToolBar/index.js +38 -130
- package/es/table/components/ToolBar/index.scss +3 -49
- package/es/table/index.js +423 -455
- package/es/table/index.scss +0 -8
- package/es/table/typing.d.ts +6 -125
- package/es/table/utils/columnRender.d.ts +3 -3
- package/es/table/utils/columnRender.js +79 -39
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +16 -13
- package/es/table/utils/index.js +47 -14
- package/es/table/utils/pureColumnRender.js +53 -21
- package/es/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/es/table/utils/pureGenProColumnToColumn.js +10 -2
- package/es/table/utils/useTableSelection.js +33 -6
- package/es/templates/List/index.js +9 -2
- package/es/timeline/ProTimeLineItem/index.js +65 -25
- package/es/timeline/index.js +22 -8
- package/es/timeline/typing.d.ts +0 -1
- package/es/utils/message.d.ts +2 -2
- package/es/utils/message.js +5 -0
- package/lib/actions/base.js +24 -8
- package/lib/actions/confirm.js +5 -0
- package/lib/actions/danger-confirm.js +5 -0
- package/lib/actions/danger-pop-confirm.js +4 -0
- package/lib/actions/dialog-component.js +15 -2
- package/lib/actions/dialog-form.js +89 -36
- package/lib/actions/dialog-info.js +10 -1
- package/lib/actions/dialog-table.js +5 -0
- package/lib/actions/dialog.js +112 -55
- package/lib/actions/drawer-form.js +3 -0
- package/lib/actions/drawer-info.js +3 -0
- package/lib/actions/drawer-table.js +3 -0
- package/lib/actions/drawer.js +4 -0
- package/lib/actions/error.js +5 -0
- package/lib/actions/index.d.ts +0 -7
- package/lib/actions/index.js +184 -115
- package/lib/actions/index.scss +1 -6
- package/lib/actions/link.js +10 -1
- package/lib/actions/notice.js +5 -0
- package/lib/actions/pop-confirm.js +5 -0
- package/lib/actions/request.js +32 -8
- package/lib/actions/utils.js +9 -1
- package/lib/card/card-container.js +9 -0
- package/lib/card/divider.js +7 -0
- package/lib/card/index.js +127 -61
- package/lib/card/index.scss +0 -15
- package/lib/card/selectable.js +20 -4
- package/lib/card/tab.js +14 -1
- package/lib/card/utils.js +6 -0
- package/lib/field/index.js +6 -0
- package/lib/form/Components/Editable/index.js +65 -15
- package/lib/form/Components/FormGroup/index.d.ts +0 -1
- package/lib/form/Components/FormGroup/index.js +28 -7
- package/lib/form/Components/LightFilter/index.js +47 -15
- package/lib/form/Components/ProField/index.js +21 -2
- package/lib/form/Components/ProField/mapDateFormat.js +32 -2
- package/lib/form/Components/Text/index.d.ts +0 -1
- package/lib/form/Components/Text/index.js +16 -2
- package/lib/form/Filter/AdvancedFilter.js +34 -11
- package/lib/form/Filter/Layout.js +33 -11
- package/lib/form/Filter/LightFilter.js +32 -13
- package/lib/form/Filter/SimpleFilter.js +27 -5
- package/lib/form/Filter/index.js +191 -116
- package/lib/form/Filter/index2.js +38 -11
- package/lib/form/Filter/layout.scss +1 -1
- package/lib/form/Filter/useBindUrl.js +50 -18
- package/lib/form/Filter/useSpecialProps.js +13 -6
- package/lib/form/ProForm/customComponent.js +8 -0
- package/lib/form/ProForm/index.js +60 -30
- package/lib/form/ProForm/useAutoLayout.js +45 -21
- package/lib/form/ProForm/useAutoSubmit.js +10 -1
- package/lib/form/ProForm/useFieldRequest.js +8 -0
- package/lib/form/ProForm/useFormDisplayValues.js +34 -12
- package/lib/form/ProForm/useInitialRequest.js +6 -0
- package/lib/form/SchemaForm/adapterComponent.js +6 -0
- package/lib/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/lib/form/SchemaForm/adapterDecorator.js +12 -0
- package/lib/form/SchemaForm/adapterType.js +5 -0
- package/lib/form/SchemaForm/index.js +144 -78
- package/lib/form/SchemaForm/initializeArrayCards.js +7 -0
- package/lib/form/SchemaForm/initializeArrayCollapse.js +7 -0
- package/lib/form/SchemaForm/initializeArrayItems.js +10 -2
- package/lib/form/SchemaForm/initializeArrayTable.js +34 -21
- package/lib/form/SchemaForm/initializeDataSource.js +8 -2
- package/lib/form/SchemaForm/initializeFormButton.js +32 -14
- package/lib/form/SchemaForm/initializeFormCollapse.js +18 -8
- package/lib/form/SchemaForm/initializeFormGroup.js +20 -10
- package/lib/form/SchemaForm/initializeFormStep.js +23 -11
- package/lib/form/SchemaForm/initializeFormTab.js +20 -10
- package/lib/form/SchemaForm/initializeReactions.js +37 -9
- package/lib/form/SchemaForm/initializeRequest.js +18 -2
- package/lib/form/SchemaForm/initializeRules.js +24 -4
- package/lib/form/SchemaForm/initializeSelectTable.js +36 -7
- package/lib/form/SchemaForm/reactions.js +37 -17
- package/lib/form/docs/ActionResponse.d.ts +0 -1
- package/lib/form/docs/ActionResponse.js +5 -0
- package/lib/form/index.d.ts +9 -9
- package/lib/form/index.js +25 -0
- package/lib/form/typing.d.ts +4 -26
- package/lib/form/utils.d.ts +1 -1
- package/lib/form/utils.js +61 -4
- package/lib/form/warning.js +8 -2
- package/lib/global.scss +1 -3
- package/lib/hooks/index.js +5 -0
- package/lib/index-without-icon.js +36 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +40 -13
- package/lib/info/components/InfoGroup/index.js +42 -21
- package/lib/info/components/InfoValueItem/index.js +134 -66
- package/lib/info/components/ProInfoItem/index.js +29 -13
- package/lib/info/components/baseInfo/index.js +39 -17
- package/lib/info/components/headerInfo/index.js +31 -8
- package/lib/info/components/tableInfo/index.js +62 -20
- package/lib/info/index.js +101 -61
- package/lib/info/typing.d.ts +0 -2
- package/lib/info/utils/index.js +19 -0
- package/lib/info/utils/utils.js +1 -0
- package/lib/nocode/configurators/PageHeader.js +2 -0
- package/lib/nocode/configurators/ProTable.js +24 -1
- package/lib/nocode/configurators/common.js +10 -5
- package/lib/nocode/configurators/index.js +10 -2
- package/lib/nocode/configurators/map.js +5 -0
- package/lib/nocode/index.js +11 -0
- package/lib/nocode/pages/editor.js +19 -5
- package/lib/nocode/pages/index.js +35 -3
- package/lib/nocode/pages/playground.js +52 -18
- package/lib/nocode/pages/renderer.js +53 -9
- package/lib/nocode/playground.js +35 -10
- package/lib/page-container/index.js +6 -0
- package/lib/page-header/index.d.ts +2 -2
- package/lib/page-header/index.js +90 -39
- package/lib/page-header/index.scss +1 -2
- package/lib/sidebar/components/sidebar-container/index.js +81 -54
- package/lib/sidebar/components/sidebar-container/index.scss +14 -21
- package/lib/sidebar/components/tree/index.js +152 -100
- package/lib/sidebar/components/tree-node/components/HoverTooltip/index.js +34 -11
- package/lib/sidebar/components/tree-node/components/IconAction/index.js +46 -9
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.d.ts +2 -2
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +35 -12
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.scss +1 -1
- package/lib/sidebar/components/tree-node/index.js +100 -42
- package/lib/sidebar/components/tree-node/index.scss +0 -6
- package/lib/sidebar/index.d.ts +0 -2
- package/lib/sidebar/index.js +111 -79
- package/lib/sidebar/typing.d.ts +0 -4
- package/lib/sidebar/utils/action-ref.js +8 -2
- package/lib/sidebar/utils/index.d.ts +2 -5
- package/lib/sidebar/utils/index.js +106 -41
- package/lib/skeleton/index.js +6 -0
- package/lib/table/components/EmptyContent/index.js +6 -0
- package/lib/table/components/Filter/index.d.ts +3 -6
- package/lib/table/components/Filter/index.js +137 -114
- package/lib/table/components/Layout/index.js +60 -32
- package/lib/table/components/Layout/index.scss +1 -2
- package/lib/table/components/Pagination/index.js +68 -25
- package/lib/table/components/QuickAction/index.d.ts +0 -1
- package/lib/table/components/QuickAction/index.js +15 -3
- package/lib/table/components/ToolBar/DensityIcon.js +42 -19
- package/lib/table/components/ToolBar/FilterColumnIcon.js +136 -86
- package/lib/table/components/ToolBar/FullScreenIcon.js +74 -10
- package/lib/table/components/ToolBar/Fullscreen.js +35 -25
- package/lib/table/components/ToolBar/RefreshIcon.js +36 -164
- package/lib/table/components/ToolBar/index.d.ts +1 -1
- package/lib/table/components/ToolBar/index.js +47 -133
- package/lib/table/components/ToolBar/index.scss +3 -49
- package/lib/table/index.js +445 -454
- package/lib/table/index.scss +0 -8
- package/lib/table/typing.d.ts +6 -125
- package/lib/table/utils/columnRender.d.ts +3 -3
- package/lib/table/utils/columnRender.js +92 -39
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +21 -13
- package/lib/table/utils/getTableProps.js +2 -0
- package/lib/table/utils/getTableSortIcons.js +5 -0
- package/lib/table/utils/index.js +55 -12
- package/lib/table/utils/pureColumnRender.js +64 -21
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/lib/table/utils/pureGenProColumnToColumn.js +11 -2
- package/lib/table/utils/useTableSelection.js +35 -6
- package/lib/templates/Detail/index.js +5 -0
- package/lib/templates/Form/index.js +5 -0
- package/lib/templates/List/index.js +19 -2
- package/lib/templates/index.js +6 -0
- package/lib/timeline/ProTimeLineItem/index.js +76 -25
- package/lib/timeline/index.js +33 -8
- package/lib/timeline/typing.d.ts +0 -1
- package/lib/utils/index.js +6 -0
- package/lib/utils/message.d.ts +2 -2
- package/lib/utils/message.js +10 -0
- package/package.json +1 -1
- package/dist/pro.all.min.css +0 -1
- package/dist/pro.xconsole.min.css +0 -1
- package/es/actions/quick.d.ts +0 -2
- package/es/actions/quick.js +0 -26
- package/es/card/xconsole.scss +0 -3
- package/es/form/ProForm/addCascadeEffect.d.ts +0 -2
- package/es/form/ProForm/addCascadeEffect.js +0 -203
- package/es/next-xconsole.scss +0 -34
- package/es/page-header/xconsole.scss +0 -5
- package/es/table/components/CardView/index.d.ts +0 -5
- package/es/table/components/CardView/index.js +0 -392
- package/es/table/components/CardView/index.scss +0 -46
- package/es/table/components/LoadMore/index.d.ts +0 -20
- package/es/table/components/LoadMore/index.js +0 -88
- package/es/table/components/LoadMore/index.scss +0 -19
- package/es/table/components/ToolBar/CardSwitch.d.ts +0 -8
- package/es/table/components/ToolBar/CardSwitch.js +0 -52
- package/es/table/utils/util.d.ts +0 -5
- package/es/table/utils/util.js +0 -19
- package/es/xconsole.scss +0 -503
- package/lib/actions/quick.d.ts +0 -2
- package/lib/actions/quick.js +0 -33
- package/lib/card/xconsole.scss +0 -3
- package/lib/form/ProForm/addCascadeEffect.d.ts +0 -2
- package/lib/form/ProForm/addCascadeEffect.js +0 -210
- package/lib/next-xconsole.scss +0 -34
- package/lib/page-header/xconsole.scss +0 -5
- package/lib/table/components/CardView/index.d.ts +0 -5
- package/lib/table/components/CardView/index.js +0 -402
- package/lib/table/components/CardView/index.scss +0 -46
- package/lib/table/components/LoadMore/index.d.ts +0 -20
- package/lib/table/components/LoadMore/index.js +0 -99
- package/lib/table/components/LoadMore/index.scss +0 -19
- package/lib/table/components/ToolBar/CardSwitch.d.ts +0 -8
- package/lib/table/components/ToolBar/CardSwitch.js +0 -60
- package/lib/table/utils/util.d.ts +0 -5
- package/lib/table/utils/util.js +0 -25
- package/lib/xconsole.scss +0 -503
package/es/form/Filter/index2.js
CHANGED
@@ -1,21 +1,34 @@
|
|
1
1
|
var _excluded = ["schema", "triggerType", "onFilter"];
|
2
|
+
|
2
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
4
|
+
|
3
5
|
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."); }
|
6
|
+
|
4
7
|
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); }
|
8
|
+
|
5
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
10
|
+
|
6
11
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
12
|
+
|
7
13
|
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; }
|
14
|
+
|
8
15
|
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; }
|
16
|
+
|
9
17
|
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; }
|
18
|
+
|
10
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
20
|
+
|
11
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
22
|
+
|
12
23
|
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; }
|
24
|
+
|
13
25
|
import React, { memo, useMemo } from 'react';
|
14
26
|
import { usePrefixCls, getMessage, cls } from '@teamix/utils';
|
15
27
|
import { createForm } from '@formily/core';
|
16
28
|
import ProForm from '../ProForm';
|
17
29
|
import { mergeArrayValue } from '../utils';
|
18
30
|
import './index2.scss';
|
31
|
+
|
19
32
|
var getEventProps = function getEventProps(triggerType, onFilter) {
|
20
33
|
var keydownEvent = {
|
21
34
|
onSubmit: onFilter
|
@@ -33,11 +46,14 @@ var getEventProps = function getEventProps(triggerType, onFilter) {
|
|
33
46
|
/**
|
34
47
|
* 简单筛选
|
35
48
|
*/
|
49
|
+
|
50
|
+
|
36
51
|
var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
37
52
|
var schema = props.schema,
|
38
|
-
|
39
|
-
|
40
|
-
|
53
|
+
triggerType = props.triggerType,
|
54
|
+
onFilter = props.onFilter,
|
55
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
56
|
+
|
41
57
|
var prefixCls = usePrefixCls('teamix-pro-form-filter-simple');
|
42
58
|
var simpleSchema = useMemo(function () {
|
43
59
|
return [{
|
@@ -73,19 +89,20 @@ SimpleFilter.defaultProps = {
|
|
73
89
|
/**
|
74
90
|
* 高级筛选
|
75
91
|
*/
|
92
|
+
|
76
93
|
var AdvancedFilter = /*#__PURE__*/memo(function (props) {
|
77
94
|
var form = useMemo(function () {
|
78
95
|
return (props === null || props === void 0 ? void 0 : props.form) || createForm();
|
79
96
|
}, []);
|
80
97
|
var schema = props.schema,
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
98
|
+
triggerType = props.triggerType,
|
99
|
+
onFilter = props.onFilter,
|
100
|
+
onReset = props.onReset,
|
101
|
+
layout = props.layout,
|
102
|
+
labelAlign = props.labelAlign,
|
103
|
+
wrapperAlign = props.wrapperAlign,
|
104
|
+
labelCol = props.labelCol,
|
105
|
+
wrapperCol = props.wrapperCol;
|
89
106
|
var prefixCls = usePrefixCls('teamix-pro-form-filter-advanced');
|
90
107
|
var gridSchema = useMemo(function () {
|
91
108
|
return [{
|
@@ -1,12 +1,21 @@
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
|
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
|
+
|
3
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
|
+
|
4
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
|
+
|
5
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
|
+
|
6
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
12
|
+
|
7
13
|
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; }
|
14
|
+
|
8
15
|
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; }
|
16
|
+
|
9
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; }
|
18
|
+
|
10
19
|
import { useUrlState } from '@teamix/hooks';
|
11
20
|
import { isUsable, isPlainObj } from '@teamix/utils';
|
12
21
|
export default (function (bindUrl, functions, formRef) {
|
@@ -15,19 +24,25 @@ export default (function (bindUrl, functions, formRef) {
|
|
15
24
|
return options ? _objectSpread(_objectSpread({}, options), {}, {
|
16
25
|
beforeStringify: function beforeStringify(values) {
|
17
26
|
var _Object$entries;
|
27
|
+
|
18
28
|
var beforeStringify = options.beforeStringify;
|
29
|
+
|
19
30
|
var newValues = _objectSpread({}, values);
|
31
|
+
|
20
32
|
(_Object$entries = Object.entries(values)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.forEach(function (_ref) {
|
21
33
|
var _form$query;
|
34
|
+
|
22
35
|
var _ref2 = _slicedToArray(_ref, 2),
|
23
|
-
|
24
|
-
|
36
|
+
key = _ref2[0],
|
37
|
+
value = _ref2[1];
|
38
|
+
|
25
39
|
var form = formRef.current;
|
26
40
|
var field = (_form$query = form.query(key)) === null || _form$query === void 0 ? void 0 : _form$query.take();
|
41
|
+
|
27
42
|
if ((field === null || field === void 0 ? void 0 : field.component[0]) === 'SelectGroup') {
|
28
43
|
newValues[key] = value.map(function (_ref3) {
|
29
44
|
var key = _ref3.key,
|
30
|
-
|
45
|
+
value = _ref3.value;
|
31
46
|
return key && value ? "".concat(key, "||").concat(value === null || value === void 0 ? void 0 : value.join('|')) : '';
|
32
47
|
});
|
33
48
|
}
|
@@ -35,55 +50,68 @@ export default (function (bindUrl, functions, formRef) {
|
|
35
50
|
return beforeStringify ? beforeStringify(newValues) : newValues;
|
36
51
|
}
|
37
52
|
}) : options;
|
38
|
-
};
|
39
|
-
|
53
|
+
}; // 通过 useUrlState 获取 url 上的参数和 url 配置方法
|
54
|
+
|
55
|
+
|
40
56
|
var _ref4 = bindUrl ? useUrlState(undefined, initializeBindUrl(isPlainObj(bindUrl) ? bindUrl : {})) : [],
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
57
|
+
_ref5 = _slicedToArray(_ref4, 2),
|
58
|
+
urlState = _ref5[0],
|
59
|
+
setUrlState = _ref5[1]; // 输出配置url参数的函数
|
60
|
+
|
61
|
+
|
45
62
|
var initializedFunctions = Object.entries(functions).reduce(function (prev, _ref6) {
|
46
63
|
var _ref7 = _slicedToArray(_ref6, 2),
|
47
|
-
|
48
|
-
|
64
|
+
key = _ref7[0],
|
65
|
+
fun = _ref7[1];
|
66
|
+
|
49
67
|
prev[key] = function (values) {
|
50
68
|
fun === null || fun === void 0 ? void 0 : fun(values);
|
51
69
|
setUrlState === null || setUrlState === void 0 ? void 0 : setUrlState(values);
|
52
70
|
};
|
71
|
+
|
53
72
|
return prev;
|
54
|
-
}, {});
|
55
|
-
|
73
|
+
}, {}); // 使用 url 参数配置 QueryFilter 默认值(移除非表单值,兼容数组数据,兼容 SelectGroup 组件)
|
74
|
+
|
56
75
|
var setValuesByUrlState = function setValuesByUrlState(form) {
|
57
76
|
if (urlState) {
|
58
77
|
var _Object$entries2;
|
78
|
+
|
59
79
|
(_Object$entries2 = Object.entries(urlState)) === null || _Object$entries2 === void 0 ? void 0 : _Object$entries2.forEach(function (_ref8) {
|
60
80
|
var _form$query2;
|
81
|
+
|
61
82
|
var _ref9 = _slicedToArray(_ref8, 2),
|
62
|
-
|
63
|
-
|
83
|
+
key = _ref9[0],
|
84
|
+
value = _ref9[1];
|
85
|
+
|
64
86
|
var field = (_form$query2 = form.query(key)) === null || _form$query2 === void 0 ? void 0 : _form$query2.take();
|
87
|
+
|
65
88
|
if (field) {
|
66
89
|
var newValue = value;
|
90
|
+
|
67
91
|
if (field.displayName === 'ArrayField') {
|
68
92
|
newValue = [].concat(isUsable(newValue) ? newValue : []);
|
69
93
|
}
|
94
|
+
|
70
95
|
if (field.component[0] === 'SelectGroup') {
|
71
96
|
newValue = newValue.map(function (item) {
|
72
97
|
var _item$split = item === null || item === void 0 ? void 0 : item.split('||'),
|
73
|
-
|
74
|
-
|
75
|
-
|
98
|
+
_item$split2 = _slicedToArray(_item$split, 2),
|
99
|
+
key = _item$split2[0],
|
100
|
+
value = _item$split2[1];
|
101
|
+
|
76
102
|
return {
|
77
103
|
key: key,
|
78
104
|
value: value === null || value === void 0 ? void 0 : value.split('|')
|
79
105
|
};
|
80
106
|
});
|
81
107
|
}
|
108
|
+
|
82
109
|
form.setValuesIn(key, newValue);
|
83
110
|
}
|
84
111
|
});
|
85
112
|
}
|
86
113
|
};
|
114
|
+
|
87
115
|
return _objectSpread({
|
88
116
|
setValuesByUrlState: setValuesByUrlState
|
89
117
|
}, initializedFunctions);
|
@@ -1,27 +1,31 @@
|
|
1
|
-
import { isUsable, isStr, isPlainObj } from '@teamix/utils';
|
2
|
-
|
1
|
+
import { isUsable, isStr, isPlainObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
|
2
|
+
|
3
3
|
var useSpecialProps = function useSpecialProps(props) {
|
4
4
|
var initialValues = props.initialValues,
|
5
|
-
|
5
|
+
initialRequest = props.initialRequest;
|
6
6
|
var hasChangeDefault = !!initialValues || !!initialRequest; // 会触发onChange的默认值
|
7
|
+
|
7
8
|
var hasDefault = hasChangeDefault;
|
8
9
|
var hasRequired = false;
|
10
|
+
|
9
11
|
var hasDefaultOrRule = function hasDefaultOrRule(schema) {
|
10
12
|
schema.forEach(function (item) {
|
11
13
|
var value = item.default,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
required = item.required,
|
15
|
+
rules = item.rules,
|
16
|
+
dataSource = item.dataSource,
|
17
|
+
children = item.children; // 字符串变量配置default值会触发onChange
|
18
|
+
|
17
19
|
hasChangeDefault = hasChangeDefault || !!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
|
18
20
|
hasDefault = hasDefault || isUsable(value);
|
19
21
|
hasRequired = hasRequired || required || !!rules;
|
22
|
+
|
20
23
|
if (children === null || children === void 0 ? void 0 : children.length) {
|
21
24
|
hasDefaultOrRule(children);
|
22
25
|
}
|
23
26
|
});
|
24
27
|
};
|
28
|
+
|
25
29
|
hasDefaultOrRule(props.schema);
|
26
30
|
return {
|
27
31
|
hasDefault: hasDefault,
|
@@ -29,4 +33,5 @@ var useSpecialProps = function useSpecialProps(props) {
|
|
29
33
|
hasRequired: hasRequired
|
30
34
|
};
|
31
35
|
};
|
36
|
+
|
32
37
|
export default useSpecialProps;
|
@@ -1,9 +1,13 @@
|
|
1
1
|
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; }
|
2
|
+
|
2
3
|
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; }
|
4
|
+
|
3
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
|
+
|
4
7
|
import { connect, mapProps } from '@formily/react';
|
5
8
|
import { toJS } from '@formily/reactive';
|
6
9
|
import { mapSize, mapStatus, mapDataSource } from '../utils';
|
10
|
+
|
7
11
|
var customComponent = function customComponent(component) {
|
8
12
|
return connect(component, mapProps(function (props, field) {
|
9
13
|
return _objectSpread(_objectSpread({}, props), {}, {
|
@@ -13,4 +17,5 @@ var customComponent = function customComponent(component) {
|
|
13
17
|
});
|
14
18
|
}, mapSize, mapStatus, mapDataSource));
|
15
19
|
};
|
20
|
+
|
16
21
|
export { customComponent };
|
package/es/form/ProForm/index.js
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "onChange", "onChangeType", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst", "schema", "children"];
|
2
|
+
|
2
3
|
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; }
|
4
|
+
|
3
5
|
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; }
|
6
|
+
|
4
7
|
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; }
|
8
|
+
|
5
9
|
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; }
|
10
|
+
|
6
11
|
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; }
|
12
|
+
|
7
13
|
import React, { memo, useEffect, useMemo, useRef } from 'react';
|
8
14
|
import { usePrefixCls, cls, getLanguage, getGlobalConfig } from '@teamix/utils';
|
9
15
|
import { createForm, onFieldValueChange, onFormValuesChange, registerValidateLocale, setValidateLanguage } from '@formily/core';
|
@@ -11,7 +17,6 @@ import { toJS } from '@formily/reactive';
|
|
11
17
|
import { Form, Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
12
18
|
import { Affix } from '@alicloudfe/components';
|
13
19
|
import ProFieldComponents from '../Components/ProField';
|
14
|
-
import addCascadeEffect from './addCascadeEffect';
|
15
20
|
import { EditableDialog, EditableDrawer, EditablePopover } from '../Components/Editable';
|
16
21
|
import FormGroup from '../Components/FormGroup';
|
17
22
|
import LightFilter from '../Components/LightFilter';
|
@@ -53,39 +58,41 @@ var formilyComponents = {
|
|
53
58
|
};
|
54
59
|
var ProForm = /*#__PURE__*/memo(function (_ref) {
|
55
60
|
var outerForm = _ref.form,
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
// 获取全局配置
|
61
|
+
initialValues = _ref.initialValues,
|
62
|
+
initialRequest = _ref.initialRequest,
|
63
|
+
scope = _ref.scope,
|
64
|
+
context = _ref.context,
|
65
|
+
components = _ref.components,
|
66
|
+
onChange = _ref.onChange,
|
67
|
+
onChangeType = _ref.onChangeType,
|
68
|
+
onSubmit = _ref.onSubmit,
|
69
|
+
onSubmitFailed = _ref.onSubmitFailed,
|
70
|
+
onInitialComplete = _ref.onInitialComplete,
|
71
|
+
className = _ref.className,
|
72
|
+
validateFirst = _ref.validateFirst,
|
73
|
+
schema = _ref.schema,
|
74
|
+
children = _ref.children,
|
75
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
76
|
+
|
77
|
+
var formRef = useRef(); // 获取全局配置
|
78
|
+
|
73
79
|
var _ref2 = getGlobalConfig('ProForm') || {},
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
context: context
|
78
|
-
});
|
80
|
+
globalComponents = _ref2.components,
|
81
|
+
globalScope = _ref2.scope;
|
82
|
+
|
79
83
|
var form = useMemo(function () {
|
80
|
-
|
84
|
+
return outerForm || createForm({
|
81
85
|
validateFirst: validateFirst
|
82
86
|
});
|
83
|
-
addCascadeEffect(nextForm, schema, mergedScope);
|
84
|
-
return nextForm;
|
85
87
|
}, [outerForm]);
|
86
|
-
var prefixCls = usePrefixCls('teamix-pro-form');
|
87
|
-
|
88
|
+
var prefixCls = usePrefixCls('teamix-pro-form'); // 由于Actions需要,解构context供使用。原context键名的上下文继续保留。
|
89
|
+
|
90
|
+
var mergedScope = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context), globalScope), scope), {}, {
|
91
|
+
context: context
|
92
|
+
});
|
93
|
+
|
88
94
|
var mergedComponents = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, globalComponents), components), formilyComponents), ProFieldComponents);
|
95
|
+
|
89
96
|
var onAutoSubmit = useAutoSubmit(onSubmit, context);
|
90
97
|
var autoTeamixLayout = useAutoLayout(_objectSpread(_objectSpread({}, otherProps), {}, {
|
91
98
|
schema: schema
|
@@ -101,8 +108,8 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
101
108
|
onInitialComplete === null || onInitialComplete === void 0 ? void 0 : onInitialComplete(form);
|
102
109
|
});
|
103
110
|
}
|
104
|
-
}, []);
|
105
|
-
|
111
|
+
}, []); // 添加 onChange 事件
|
112
|
+
|
106
113
|
useMemo(function () {
|
107
114
|
if (onChangeType === 'form') {
|
108
115
|
// 使用 onFormValuesChange 无法监听具体变化字段
|
@@ -118,6 +125,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
118
125
|
form.addEffects('onChangeByFieldValueChange', function () {
|
119
126
|
onFieldValueChange('*', function (field, form) {
|
120
127
|
var _field$props;
|
128
|
+
|
121
129
|
onChange === null || onChange === void 0 ? void 0 : onChange(toJS(form.values), toJS(field.value), (_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.name);
|
122
130
|
});
|
123
131
|
});
|
@@ -1,47 +1,61 @@
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
|
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
|
+
|
3
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
|
+
|
4
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
|
+
|
5
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
|
+
|
6
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
12
|
+
|
7
13
|
import { useEffect, useMemo, useState } from 'react';
|
8
14
|
import { isPlainObj, isBool, autoWidthBySpace, getWidthByCharacterMap, isStr } from '@teamix/utils';
|
9
15
|
import { mergeArrayValue } from '../utils';
|
16
|
+
|
10
17
|
var useAutoLayout = function useAutoLayout(_ref, formRef) {
|
11
18
|
var outBreakpoints = _ref.breakpoints,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
layout = _ref.layout,
|
20
|
+
labelAlign = _ref.labelAlign,
|
21
|
+
wrapperAlign = _ref.wrapperAlign,
|
22
|
+
outLabelCol = _ref.labelCol,
|
23
|
+
outWrapperCol = _ref.wrapperCol,
|
24
|
+
autoLayout = _ref.autoLayout,
|
25
|
+
schema = _ref.schema;
|
26
|
+
|
19
27
|
var _ref2 = isPlainObj(autoLayout) ? autoLayout : {
|
20
|
-
|
21
|
-
|
22
|
-
|
28
|
+
autoLabel: autoLayout
|
29
|
+
},
|
30
|
+
autoLabel = _ref2.autoLabel;
|
31
|
+
|
23
32
|
var breakpoints = useMemo(function () {
|
24
33
|
return autoLabel ? false : outBreakpoints;
|
25
34
|
}, []); // 当前断点不支持Col更新
|
35
|
+
|
26
36
|
var _useState = useState({
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
37
|
+
labelCol: outLabelCol,
|
38
|
+
wrapperCol: outWrapperCol
|
39
|
+
}),
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
41
|
+
autoCol = _useState2[0],
|
42
|
+
setAutoCol = _useState2[1];
|
43
|
+
|
33
44
|
var labelCol = autoCol.labelCol,
|
34
|
-
|
45
|
+
wrapperCol = autoCol.wrapperCol;
|
35
46
|
useEffect(function () {
|
36
47
|
/**
|
37
48
|
* autolayout
|
38
49
|
*/
|
39
50
|
if (autoLabel) {
|
40
51
|
var formWidth = formRef.current.getBoundingClientRect().width; // 表单宽度
|
52
|
+
|
41
53
|
var labelArray = schema.map(function (item) {
|
42
54
|
var text = item.title;
|
55
|
+
|
43
56
|
if (isStr(text)) {
|
44
57
|
var _item$decoratorProps;
|
58
|
+
|
45
59
|
if (item.required) {
|
46
60
|
text += '一'; // 必填 + 12
|
47
61
|
}
|
@@ -52,13 +66,19 @@ var useAutoLayout = function useAutoLayout(_ref, formRef) {
|
|
52
66
|
|
53
67
|
return text;
|
54
68
|
}
|
69
|
+
|
55
70
|
return '';
|
56
71
|
}); // 标题内容集合
|
72
|
+
|
57
73
|
var labelWidthArray = getWidthByCharacterMap(labelArray); // 标题宽度集合
|
74
|
+
|
58
75
|
var _autoWidthBySpace = autoWidthBySpace(labelWidthArray),
|
59
|
-
|
60
|
-
|
76
|
+
expectedWidth = _autoWidthBySpace.expectedWidth,
|
77
|
+
consoleArray = _autoWidthBySpace.consoleArray; // 智能计算预期宽度
|
78
|
+
|
79
|
+
|
61
80
|
var expectedCol = Math.ceil(expectedWidth / formWidth * 24); // 预期宽度转换为 Col 值
|
81
|
+
|
62
82
|
setAutoCol({
|
63
83
|
labelCol: expectedCol,
|
64
84
|
wrapperCol: wrapperCol
|
@@ -69,8 +89,8 @@ var useAutoLayout = function useAutoLayout(_ref, formRef) {
|
|
69
89
|
wrapperCol: outWrapperCol
|
70
90
|
});
|
71
91
|
}
|
72
|
-
}, [outLabelCol, outWrapperCol]);
|
73
|
-
|
92
|
+
}, [outLabelCol, outWrapperCol]); // Layout配置By断点(配置断点后,目前不支持 Col 更新)
|
93
|
+
|
74
94
|
var autoTeamixLayout = useMemo(function () {
|
75
95
|
return breakpoints === true ? {
|
76
96
|
breakpoints: [480],
|
@@ -90,4 +110,5 @@ var useAutoLayout = function useAutoLayout(_ref, formRef) {
|
|
90
110
|
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
91
111
|
return autoTeamixLayout;
|
92
112
|
};
|
113
|
+
|
93
114
|
export default useAutoLayout;
|
@@ -1,12 +1,15 @@
|
|
1
1
|
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; }
|
2
|
+
|
2
3
|
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; }
|
4
|
+
|
3
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; }
|
4
|
-
|
5
|
-
import {
|
6
|
+
|
7
|
+
import { useHistory } from 'react-router-dom';
|
6
8
|
import { doCommonRequest, isObj } from '@teamix/utils';
|
9
|
+
|
7
10
|
var useAutoSubmit = function useAutoSubmit(onSubmit, context) {
|
8
11
|
if (isObj(onSubmit)) {
|
9
|
-
var history =
|
12
|
+
var history = useHistory();
|
10
13
|
var submitConfig = onSubmit;
|
11
14
|
return function (values) {
|
12
15
|
return doCommonRequest(_objectSpread(_objectSpread({
|
@@ -18,6 +21,8 @@ var useAutoSubmit = function useAutoSubmit(onSubmit, context) {
|
|
18
21
|
}, context), history);
|
19
22
|
};
|
20
23
|
}
|
24
|
+
|
21
25
|
return onSubmit;
|
22
26
|
};
|
27
|
+
|
23
28
|
export default useAutoSubmit;
|
@@ -1,12 +1,17 @@
|
|
1
1
|
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; }
|
2
|
+
|
2
3
|
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; }
|
4
|
+
|
3
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
|
+
|
4
7
|
import { useField } from '@formily/react';
|
5
8
|
export default (function () {
|
6
9
|
var field = useField();
|
10
|
+
|
7
11
|
var refresh = function refresh() {
|
8
12
|
field.data.refresh = _objectSpread({}, field.data.refresh);
|
9
13
|
};
|
14
|
+
|
10
15
|
return {
|
11
16
|
refresh: refresh,
|
12
17
|
field: field
|