@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/table/utils/index.js
CHANGED
@@ -1,24 +1,36 @@
|
|
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
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
8
|
+
|
5
9
|
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."); }
|
10
|
+
|
6
11
|
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); }
|
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 _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; }
|
16
|
+
|
9
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
10
|
-
|
11
|
-
// 所有 ProTable 组件公用一套组件内事件转发机制
|
12
|
-
|
13
|
-
// 组件内对全局状态的更改
|
18
|
+
|
19
|
+
import cloneDeepLodash from 'lodash.clonedeep'; // 所有 ProTable 组件公用一套组件内事件转发机制
|
20
|
+
|
21
|
+
var tableCallback = {}; // 组件内对全局状态的更改
|
22
|
+
|
14
23
|
var getMutations = function getMutations(actionRef) {
|
15
24
|
var _actionRef$current2, _actionRef$current2$g, _actionRef$current2$g2;
|
25
|
+
|
16
26
|
return {
|
17
27
|
setFullScreenState: function setFullScreenState(fullScreenState) {
|
18
28
|
var _actionRef$current, _actionRef$current$se;
|
29
|
+
|
19
30
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'fullScreenState', fullScreenState);
|
20
31
|
},
|
21
32
|
filterColumns: (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$g = _actionRef$current2.getState) === null || _actionRef$current2$g === void 0 ? void 0 : (_actionRef$current2$g2 = _actionRef$current2$g.call(_actionRef$current2)) === null || _actionRef$current2$g2 === void 0 ? void 0 : _actionRef$current2$g2.filterColumns,
|
33
|
+
|
22
34
|
/**
|
23
35
|
* 设置筛选列规则
|
24
36
|
* @param rules 规则
|
@@ -26,40 +38,49 @@ var getMutations = function getMutations(actionRef) {
|
|
26
38
|
*/
|
27
39
|
setFilterRules: function setFilterRules(rules) {
|
28
40
|
var _actionRef$current3, _actionRef$current3$s;
|
41
|
+
|
29
42
|
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterRules', rules);
|
30
43
|
},
|
44
|
+
|
31
45
|
/**
|
32
46
|
* 获取筛选规则。为params
|
33
47
|
*/
|
34
48
|
getFilterRules: function getFilterRules() {
|
35
49
|
var _actionRef$current4, _actionRef$current4$g;
|
50
|
+
|
36
51
|
var result = {};
|
37
52
|
var filterRules = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getState) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4).filterRules;
|
53
|
+
|
38
54
|
if (filterRules) {
|
39
55
|
result = Object.entries(filterRules).map(function (_ref) {
|
40
56
|
var _ref2 = _slicedToArray(_ref, 2),
|
41
|
-
|
42
|
-
|
57
|
+
k = _ref2[0],
|
58
|
+
v = _ref2[1];
|
59
|
+
|
43
60
|
return _defineProperty({}, k, v.params);
|
44
61
|
}).reduce(function (acc, cur) {
|
45
62
|
acc = _objectSpread(_objectSpread({}, acc), cur);
|
46
63
|
return acc;
|
47
64
|
}, {});
|
48
65
|
}
|
66
|
+
|
49
67
|
return result;
|
50
68
|
}
|
51
69
|
};
|
52
|
-
};
|
53
|
-
|
70
|
+
}; // 调用绑定的监听函数
|
71
|
+
|
72
|
+
|
54
73
|
export function actionRefUseStateOn(callback, state) {
|
55
74
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
56
75
|
args[_key - 2] = arguments[_key];
|
57
76
|
}
|
77
|
+
|
58
78
|
if (callback[state]) {
|
59
79
|
Object.entries(callback[state]).forEach(function (_ref4) {
|
60
80
|
var _ref5 = _slicedToArray(_ref4, 2),
|
61
|
-
|
62
|
-
|
81
|
+
k = _ref5[0],
|
82
|
+
v = _ref5[1];
|
83
|
+
|
63
84
|
if (v) {
|
64
85
|
v === null || v === void 0 ? void 0 : v.apply(void 0, args);
|
65
86
|
}
|
@@ -67,27 +88,33 @@ export function actionRefUseStateOn(callback, state) {
|
|
67
88
|
}
|
68
89
|
}
|
69
90
|
/** table 组件内监听 不对外暴露 */
|
91
|
+
|
70
92
|
export function on(fun, key) {
|
71
93
|
tableCallback[key] = fun;
|
72
94
|
}
|
73
95
|
/** table 组件内销毁监听 不对外暴露 */
|
96
|
+
|
74
97
|
export function off(key) {
|
75
98
|
if (tableCallback[key]) {
|
76
99
|
delete tableCallback[key];
|
77
100
|
}
|
78
101
|
}
|
79
102
|
/** table 组件内触发事件 不对外暴露 */
|
103
|
+
|
80
104
|
export function emit(key) {
|
81
105
|
var fun = tableCallback[key];
|
106
|
+
|
82
107
|
if (fun) {
|
83
108
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
84
109
|
args[_key2 - 1] = arguments[_key2];
|
85
110
|
}
|
111
|
+
|
86
112
|
fun.apply(void 0, args);
|
87
113
|
}
|
88
114
|
}
|
89
115
|
export function initActionRef(ref, action) {
|
90
116
|
var userAction = _objectSpread(_objectSpread({}, action), getMutations(ref));
|
117
|
+
|
91
118
|
ref.current = userAction;
|
92
119
|
}
|
93
120
|
export function useActionType(ref, action) {
|
@@ -101,24 +128,30 @@ export function cloneDeep(obj) {
|
|
101
128
|
* @param columns
|
102
129
|
* @param ref
|
103
130
|
*/
|
131
|
+
|
104
132
|
export function processDefaultFilter(columns, ref, defaultFilterParams) {
|
105
133
|
columns.forEach(function (column) {
|
106
134
|
var _column$dataIndex$toS, _column$dataIndex;
|
135
|
+
|
107
136
|
var defaultRules = defaultFilterParams === null || defaultFilterParams === void 0 ? void 0 : defaultFilterParams[(_column$dataIndex$toS = column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.toString()) !== null && _column$dataIndex$toS !== void 0 ? _column$dataIndex$toS : ''];
|
137
|
+
|
108
138
|
if (defaultRules) {
|
109
139
|
var _ref$current$getState, _ref$current, _ref$current$getState2, _ref$current$getState3, _ref$current2, _ref$current2$setFilt;
|
140
|
+
|
110
141
|
var params = '';
|
111
142
|
var rules = [];
|
143
|
+
|
112
144
|
if (Array.isArray(defaultRules)) {
|
113
145
|
params = defaultRules.join(',');
|
114
146
|
rules = defaultRules;
|
115
147
|
} else {
|
116
148
|
params = defaultRules;
|
117
149
|
rules = [defaultRules];
|
118
|
-
}
|
119
|
-
|
120
|
-
|
121
|
-
// 再设置所有的列筛选状态
|
150
|
+
} // 需要带上其他所有的信息
|
151
|
+
|
152
|
+
|
153
|
+
var otherRules = (_ref$current$getState = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$getState2 = _ref$current.getState) === null || _ref$current$getState2 === void 0 ? void 0 : (_ref$current$getState3 = _ref$current$getState2.call(_ref$current)) === null || _ref$current$getState3 === void 0 ? void 0 : _ref$current$getState3.filterRules) !== null && _ref$current$getState !== void 0 ? _ref$current$getState : {}; // 再设置所有的列筛选状态
|
154
|
+
|
122
155
|
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$setFilt = _ref$current2.setFilterRules) === null || _ref$current2$setFilt === void 0 ? void 0 : _ref$current2$setFilt.call(_ref$current2, _objectSpread(_objectSpread({}, otherRules), {}, _defineProperty({}, column.dataIndex, {
|
123
156
|
rules: rules,
|
124
157
|
params: params
|
@@ -1,16 +1,29 @@
|
|
1
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
+
|
2
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
|
3
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
6
|
+
|
4
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
8
|
+
|
5
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
10
|
+
|
6
11
|
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."); }
|
12
|
+
|
7
13
|
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); }
|
14
|
+
|
8
15
|
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; }
|
16
|
+
|
9
17
|
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; }
|
18
|
+
|
10
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
20
|
+
|
11
21
|
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; }
|
22
|
+
|
12
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; }
|
24
|
+
|
13
25
|
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; }
|
26
|
+
|
14
27
|
/**
|
15
28
|
* 渲染列的逻辑函数,用于非 ProTable 比如 selectTable
|
16
29
|
*/
|
@@ -20,6 +33,7 @@ import ProField, { LabelIconTip } from '../../field';
|
|
20
33
|
/**
|
21
34
|
* 增加了 icon 的功能 render title
|
22
35
|
*/
|
36
|
+
|
23
37
|
export var renderColumnsTitle = function renderColumnsTitle(item) {
|
24
38
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelIconTip, {
|
25
39
|
label: item.title,
|
@@ -30,17 +44,19 @@ export var renderColumnsTitle = function renderColumnsTitle(item) {
|
|
30
44
|
/**
|
31
45
|
* 负责单元格的具体渲染
|
32
46
|
*/
|
47
|
+
|
33
48
|
export var renderCell = function renderCell(value, item, index, record) {
|
34
49
|
var _item$valueType = item.valueType,
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
50
|
+
valueType = _item$valueType === void 0 ? 'text' : _item$valueType,
|
51
|
+
render = item.render,
|
52
|
+
dataIndex = item.dataIndex,
|
53
|
+
format = item.format; // 如果没传 dataIndex,返回 null
|
54
|
+
|
40
55
|
if (!dataIndex) {
|
41
56
|
value = null;
|
42
|
-
}
|
43
|
-
|
57
|
+
} // 处理 dataIndex 为数组的情况
|
58
|
+
|
59
|
+
|
44
60
|
if (Array.isArray(dataIndex)) {
|
45
61
|
value = dataIndex.map(function (item) {
|
46
62
|
return getTargetValue("{{".concat(item, "}}"), _objectSpread(_objectSpread({}, record), {}, {
|
@@ -48,16 +64,18 @@ export var renderCell = function renderCell(value, item, index, record) {
|
|
48
64
|
}));
|
49
65
|
});
|
50
66
|
}
|
67
|
+
|
51
68
|
var newRender = null;
|
52
69
|
var newDataSource = null;
|
53
|
-
var props = item.props;
|
54
|
-
|
70
|
+
var props = item.props; // 如果 render 直接传函数
|
71
|
+
|
55
72
|
if (typeof render === 'function') {
|
56
73
|
newRender = function newRender() {
|
57
74
|
return render === null || render === void 0 ? void 0 : render(value, index, record);
|
58
75
|
};
|
59
76
|
} else {
|
60
77
|
newRender = processBuriedPoint(processRenderFunction(render, value, index, record), record, value, index);
|
78
|
+
|
61
79
|
if (valueType === 'selectGroup') {
|
62
80
|
newRender = _objectSpread(_objectSpread({
|
63
81
|
maxShowNumber: 'auto',
|
@@ -74,23 +92,28 @@ export var renderCell = function renderCell(value, item, index, record) {
|
|
74
92
|
}
|
75
93
|
}, props);
|
76
94
|
}
|
95
|
+
|
77
96
|
if ((render === null || render === void 0 ? void 0 : render.type) === 'step') {
|
78
97
|
newRender = _objectSpread(_objectSpread({}, newRender), {}, {
|
79
98
|
ellipsis: false
|
80
99
|
});
|
81
100
|
}
|
82
|
-
}
|
83
|
-
|
101
|
+
} // dataSource可传函数
|
102
|
+
|
103
|
+
|
84
104
|
if (typeof item.dataSource === 'function') {
|
85
105
|
var _item$dataSource;
|
106
|
+
|
86
107
|
newDataSource = (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.call(item, value, index, record);
|
87
108
|
} else {
|
88
109
|
var _item$dataSource2;
|
110
|
+
|
89
111
|
newDataSource = ((_item$dataSource2 = item.dataSource) !== null && _item$dataSource2 !== void 0 ? _item$dataSource2 : []).map(function (item) {
|
90
112
|
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
91
113
|
var _ref2 = _slicedToArray(_ref, 2),
|
92
|
-
|
93
|
-
|
114
|
+
k = _ref2[0],
|
115
|
+
v = _ref2[1];
|
116
|
+
|
94
117
|
return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
|
95
118
|
record: record,
|
96
119
|
value: value,
|
@@ -98,8 +121,9 @@ export var renderCell = function renderCell(value, item, index, record) {
|
|
98
121
|
}))];
|
99
122
|
}));
|
100
123
|
});
|
101
|
-
}
|
102
|
-
|
124
|
+
} // 渲染 ProField
|
125
|
+
|
126
|
+
|
103
127
|
return /*#__PURE__*/React.createElement(ProField, _objectSpread({
|
104
128
|
type: valueType || 'text',
|
105
129
|
value: value,
|
@@ -116,6 +140,7 @@ export var renderCell = function renderCell(value, item, index, record) {
|
|
116
140
|
* @param record table cell record
|
117
141
|
* @returns
|
118
142
|
*/
|
143
|
+
|
119
144
|
var processRenderFunction = function processRenderFunction() {
|
120
145
|
var render = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
121
146
|
var value = arguments.length > 1 ? arguments[1] : undefined;
|
@@ -125,20 +150,25 @@ var processRenderFunction = function processRenderFunction() {
|
|
125
150
|
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick', 'extra', 'prefixExtra'];
|
126
151
|
return Object.fromEntries(Object.entries(render).map(function (_ref3) {
|
127
152
|
var _ref4 = _slicedToArray(_ref3, 2),
|
128
|
-
|
129
|
-
|
153
|
+
k = _ref4[0],
|
154
|
+
v = _ref4[1];
|
155
|
+
|
130
156
|
if (typeof v === 'function') {
|
131
157
|
var _v;
|
158
|
+
|
132
159
|
if (external.includes(k)) {
|
133
160
|
return [k, function () {
|
134
161
|
for (var _len = arguments.length, others = new Array(_len), _key = 0; _key < _len; _key++) {
|
135
162
|
others[_key] = arguments[_key];
|
136
163
|
}
|
164
|
+
|
137
165
|
return v === null || v === void 0 ? void 0 : v.apply(void 0, [value, index, record].concat(others));
|
138
166
|
}];
|
139
167
|
}
|
168
|
+
|
140
169
|
return [k, (_v = v === null || v === void 0 ? void 0 : v(value, index, record)) !== null && _v !== void 0 ? _v : ''];
|
141
170
|
}
|
171
|
+
|
142
172
|
return [k, v];
|
143
173
|
}));
|
144
174
|
};
|
@@ -148,18 +178,20 @@ var processRenderFunction = function processRenderFunction() {
|
|
148
178
|
* @param record table cell record
|
149
179
|
* @returns
|
150
180
|
*/
|
181
|
+
|
182
|
+
|
151
183
|
var processBuriedPoint = function processBuriedPoint() {
|
152
184
|
var render = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
153
185
|
var record = arguments.length > 1 ? arguments[1] : undefined;
|
154
186
|
var value = arguments.length > 2 ? arguments[2] : undefined;
|
155
187
|
var index = arguments.length > 3 ? arguments[3] : undefined;
|
156
|
-
return Object.fromEntries([
|
157
|
-
// 默认 ellipsis、descriptionEllipsis 为 true
|
188
|
+
return Object.fromEntries([// 默认 ellipsis、descriptionEllipsis 为 true
|
158
189
|
// emptyText 默认为 '-'
|
159
190
|
['ellipsis', true], ['descriptionEllipsis', true], ['emptyText', '-']].concat(_toConsumableArray(Object.entries(render).map(function (_ref5) {
|
160
191
|
var _ref6 = _slicedToArray(_ref5, 2),
|
161
|
-
|
162
|
-
|
192
|
+
k = _ref6[0],
|
193
|
+
v = _ref6[1];
|
194
|
+
|
163
195
|
return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
|
164
196
|
record: record,
|
165
197
|
value: value,
|
@@ -4,4 +4,4 @@ import { ColumnProps } from '@alicloudfe/components/types/table';
|
|
4
4
|
* ProColumn => Column,去掉操作列,过滤器相关逻辑
|
5
5
|
* 用于非 ProTable 比如 selectTable
|
6
6
|
*/
|
7
|
-
export default function genProColumnToColumn(columns: ProTableColumnProps[]): ColumnProps[]
|
7
|
+
export default function genProColumnToColumn(columns: ProTableColumnProps[]): ColumnProps[];
|
@@ -1,19 +1,27 @@
|
|
1
1
|
var _excluded = ["filters", "dataIndex"];
|
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 { renderColumnsTitle, renderCell } from './pureColumnRender';
|
8
14
|
/**
|
9
15
|
* ProColumn => Column,去掉操作列,过滤器相关逻辑
|
10
16
|
* 用于非 ProTable 比如 selectTable
|
11
17
|
*/
|
18
|
+
|
12
19
|
export default function genProColumnToColumn(columns) {
|
13
20
|
return columns.map(function (columnProps) {
|
14
21
|
var filters = columnProps.filters,
|
15
|
-
|
16
|
-
|
22
|
+
dataIndex = columnProps.dataIndex,
|
23
|
+
others = _objectWithoutProperties(columnProps, _excluded);
|
24
|
+
|
17
25
|
return _objectSpread(_objectSpread({
|
18
26
|
// 金钱样式默认右对齐
|
19
27
|
align: columnProps.valueType === 'money' ? 'right' : 'left'
|
@@ -1,33 +1,50 @@
|
|
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
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
8
|
+
|
5
9
|
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."); }
|
10
|
+
|
6
11
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
12
|
+
|
7
13
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
14
|
+
|
8
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
16
|
+
|
9
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."); }
|
18
|
+
|
10
19
|
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); }
|
20
|
+
|
11
21
|
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; }
|
22
|
+
|
12
23
|
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; }
|
24
|
+
|
13
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
26
|
+
|
14
27
|
/**
|
15
28
|
* 处理表格 rowSelection hooks
|
16
29
|
* 除了基本 rowSelection 之外返回平铺后的 selectedRowKeys、selectedRecords
|
17
30
|
*/
|
18
31
|
import { useState } from 'react';
|
19
32
|
import { getDeepValue } from '@teamix/utils';
|
33
|
+
|
20
34
|
function useTableSelection() {
|
21
35
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
22
36
|
var primaryKey = arguments.length > 1 ? arguments[1] : undefined;
|
37
|
+
|
23
38
|
var _useState = useState([]),
|
24
|
-
|
25
|
-
|
26
|
-
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
40
|
+
selectedRowKeys = _useState2[0],
|
41
|
+
setSelectedRowKeys = _useState2[1];
|
42
|
+
|
27
43
|
var _useState3 = useState([]),
|
28
|
-
|
29
|
-
|
30
|
-
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
45
|
+
selectedRecords = _useState4[0],
|
46
|
+
setSelectedRecords = _useState4[1];
|
47
|
+
|
31
48
|
function onChange(value, records) {
|
32
49
|
if (primaryKey) {
|
33
50
|
var newValue = value.filter(function (v) {
|
@@ -36,17 +53,21 @@ function useTableSelection() {
|
|
36
53
|
var deleteValue = selectedRowKeys.filter(function (v) {
|
37
54
|
return !value.includes(v);
|
38
55
|
});
|
56
|
+
|
39
57
|
var nextSelectedRecords = _toConsumableArray(selectedRecords);
|
58
|
+
|
40
59
|
if (newValue.length > 0) {
|
41
60
|
newValue.forEach(function (v) {
|
42
61
|
var nextRecords = records.find(function (n) {
|
43
62
|
return getDeepValue(primaryKey, n) === v;
|
44
63
|
});
|
64
|
+
|
45
65
|
if (nextRecords) {
|
46
66
|
nextSelectedRecords.push(nextRecords);
|
47
67
|
}
|
48
68
|
});
|
49
69
|
}
|
70
|
+
|
50
71
|
if (deleteValue.length > 0) {
|
51
72
|
deleteValue.forEach(function (v) {
|
52
73
|
nextSelectedRecords = nextSelectedRecords.filter(function (n) {
|
@@ -54,21 +75,26 @@ function useTableSelection() {
|
|
54
75
|
});
|
55
76
|
});
|
56
77
|
}
|
78
|
+
|
57
79
|
setSelectedRecords(nextSelectedRecords);
|
58
80
|
} else {
|
59
81
|
setSelectedRecords(records);
|
60
82
|
}
|
83
|
+
|
61
84
|
setSelectedRowKeys(value);
|
85
|
+
|
62
86
|
if (config.onChange) {
|
63
87
|
config.onChange(value, records);
|
64
88
|
}
|
65
89
|
}
|
90
|
+
|
66
91
|
var rowSelection = _objectSpread(_objectSpread({
|
67
92
|
selectedRowKeys: selectedRowKeys,
|
68
93
|
selectedRecords: selectedRecords
|
69
94
|
}, config), {}, {
|
70
95
|
onChange: onChange
|
71
96
|
});
|
97
|
+
|
72
98
|
return {
|
73
99
|
rowSelection: rowSelection,
|
74
100
|
selectedRowKeys: selectedRowKeys,
|
@@ -77,4 +103,5 @@ function useTableSelection() {
|
|
77
103
|
setSelectedRecords: setSelectedRecords
|
78
104
|
};
|
79
105
|
}
|
106
|
+
|
80
107
|
export default useTableSelection;
|
@@ -1,17 +1,24 @@
|
|
1
1
|
var _excluded = ["loading", "pageProps"];
|
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 from 'react';
|
8
14
|
import PageContainer, { EditableContainer } from '../../page-container';
|
9
15
|
import PageHeader from '../../page-header';
|
10
16
|
import ProTable from '../../table';
|
11
17
|
export var ListPage = function ListPage(props) {
|
12
18
|
var loading = props.loading,
|
13
|
-
|
14
|
-
|
19
|
+
pageProps = props.pageProps,
|
20
|
+
others = _objectWithoutProperties(props, _excluded);
|
21
|
+
|
15
22
|
var headerDefaultProps = {
|
16
23
|
title: '',
|
17
24
|
breadcrumb: []
|