@teamix/pro 1.4.25-bugfix → 1.4.25-bugfix.2
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.all.min.css +1 -0
- package/dist/pro.css +1 -1
- package/dist/pro.js +78506 -59443
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +13 -6
- package/dist/pro.xconsole.min.css +1 -0
- package/es/actions/base.js +8 -21
- package/es/actions/dialog-component.js +2 -9
- package/es/actions/dialog-form.js +37 -75
- package/es/actions/dialog-info.js +1 -5
- package/es/actions/dialog.js +57 -95
- package/es/actions/index.d.ts +7 -0
- package/es/actions/index.js +93 -153
- package/es/actions/index.scss +6 -1
- package/es/actions/link.js +3 -5
- package/es/actions/quick.d.ts +2 -0
- package/es/actions/quick.js +26 -0
- package/es/actions/request.js +12 -27
- package/es/actions/utils.js +1 -9
- package/es/card/card-container.js +0 -5
- package/es/card/divider.js +0 -5
- package/es/card/index.js +61 -100
- package/es/card/index.scss +15 -0
- package/es/card/selectable.js +4 -13
- package/es/card/tab.js +1 -10
- package/es/card/utils.js +0 -2
- package/es/card/xconsole.scss +3 -0
- package/es/form/Components/Editable/index.js +16 -55
- package/es/form/Components/FormGroup/index.d.ts +1 -0
- package/es/form/Components/FormGroup/index.js +7 -22
- package/es/form/Components/LightFilter/index.js +15 -35
- package/es/form/Components/ProField/index.js +2 -14
- package/es/form/Components/ProField/mapDateFormat.js +2 -28
- package/es/form/Components/Text/index.d.ts +1 -0
- package/es/form/Components/Text/index.js +2 -11
- package/es/form/Filter/AdvancedFilter.js +11 -26
- package/es/form/Filter/Layout.js +11 -24
- package/es/form/Filter/LightFilter.js +13 -24
- package/es/form/Filter/SimpleFilter.js +7 -21
- package/es/form/Filter/index.js +117 -171
- package/es/form/Filter/index2.js +11 -28
- package/es/form/Filter/layout.scss +1 -1
- package/es/form/Filter/useBindUrl.js +18 -46
- package/es/form/Filter/useSpecialProps.js +8 -13
- package/es/form/ProForm/addCascadeEffect.d.ts +2 -0
- package/es/form/ProForm/addCascadeEffect.js +203 -0
- package/es/form/ProForm/customComponent.js +0 -5
- package/es/form/ProForm/index.js +30 -38
- package/es/form/ProForm/useAutoLayout.js +21 -42
- package/es/form/ProForm/useAutoSubmit.js +3 -8
- package/es/form/ProForm/useFieldRequest.js +0 -5
- package/es/form/ProForm/useFormDisplayValues.js +12 -28
- package/es/form/ProForm/useInitialRequest.js +0 -5
- package/es/form/SchemaForm/adapterComponent.js +0 -3
- package/es/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/es/form/SchemaForm/adapterDecorator.js +0 -8
- package/es/form/SchemaForm/adapterType.js +0 -2
- package/es/form/SchemaForm/index.js +78 -114
- package/es/form/SchemaForm/initializeArrayCards.js +0 -6
- package/es/form/SchemaForm/initializeArrayCollapse.js +0 -6
- package/es/form/SchemaForm/initializeArrayItems.js +2 -9
- package/es/form/SchemaForm/initializeArrayTable.js +21 -34
- package/es/form/SchemaForm/initializeDataSource.js +2 -6
- package/es/form/SchemaForm/initializeFormButton.js +14 -31
- package/es/form/SchemaForm/initializeFormCollapse.js +8 -18
- package/es/form/SchemaForm/initializeFormGroup.js +10 -20
- package/es/form/SchemaForm/initializeFormStep.js +11 -23
- package/es/form/SchemaForm/initializeFormTab.js +10 -20
- package/es/form/SchemaForm/initializeReactions.js +9 -33
- package/es/form/SchemaForm/initializeRequest.js +2 -16
- package/es/form/SchemaForm/initializeRules.js +4 -22
- package/es/form/SchemaForm/initializeSelectTable.js +7 -33
- package/es/form/SchemaForm/reactions.js +19 -34
- package/es/form/docs/ActionResponse.d.ts +1 -0
- package/es/form/index.d.ts +9 -9
- package/es/form/index.js +0 -9
- package/es/form/typing.d.ts +26 -4
- package/es/form/utils.d.ts +1 -1
- package/es/form/utils.js +4 -49
- package/es/form/warning.js +2 -7
- package/es/global.scss +3 -1
- package/es/index-without-icon.js +4 -3
- package/es/index.d.ts +1 -1
- package/es/index.js +18 -8
- package/es/info/components/InfoGroup/index.js +21 -32
- package/es/info/components/InfoValueItem/index.js +66 -119
- package/es/info/components/ProInfoItem/index.js +13 -21
- package/es/info/components/baseInfo/index.js +17 -27
- package/es/info/components/headerInfo/index.js +8 -20
- package/es/info/components/tableInfo/index.js +20 -50
- package/es/info/index.js +61 -86
- package/es/info/typing.d.ts +2 -0
- package/es/info/utils/index.js +0 -11
- package/es/next-xconsole.scss +34 -0
- package/es/nocode/configurators/ProTable.js +1 -22
- package/es/nocode/configurators/common.js +5 -6
- package/es/nocode/configurators/index.js +2 -3
- package/es/nocode/index.js +6 -6
- package/es/nocode/pages/editor.js +5 -9
- package/es/nocode/pages/index.js +5 -30
- package/es/nocode/pages/playground.js +18 -35
- package/es/nocode/pages/renderer.js +9 -42
- package/es/nocode/playground.js +10 -23
- package/es/page-header/index.d.ts +2 -2
- package/es/page-header/index.js +40 -76
- package/es/page-header/index.scss +2 -1
- package/es/page-header/xconsole.scss +5 -0
- package/es/sidebar/components/sidebar-container/index.js +54 -69
- package/es/sidebar/components/sidebar-container/index.scss +21 -14
- package/es/sidebar/components/tree/index.js +100 -138
- package/es/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -26
- package/es/sidebar/components/tree-node/components/IconAction/index.js +9 -35
- package/es/sidebar/components/tree-node/components/IconSwitch/index.d.ts +2 -2
- package/es/sidebar/components/tree-node/components/IconSwitch/index.js +12 -25
- package/es/sidebar/components/tree-node/components/IconSwitch/index.scss +1 -1
- package/es/sidebar/components/tree-node/index.js +42 -84
- package/es/sidebar/components/tree-node/index.scss +6 -0
- package/es/sidebar/index.d.ts +2 -0
- package/es/sidebar/index.js +72 -95
- package/es/sidebar/typing.d.ts +4 -0
- package/es/sidebar/utils/action-ref.js +2 -7
- package/es/sidebar/utils/index.d.ts +5 -2
- package/es/sidebar/utils/index.js +41 -98
- package/es/table/components/CardView/index.d.ts +5 -0
- package/es/table/components/CardView/index.js +392 -0
- package/es/table/components/CardView/index.scss +46 -0
- package/es/table/components/Filter/index.d.ts +6 -3
- package/es/table/components/Filter/index.js +115 -128
- package/es/table/components/Layout/index.js +32 -47
- package/es/table/components/Layout/index.scss +2 -1
- package/es/table/components/LoadMore/index.d.ts +20 -0
- package/es/table/components/LoadMore/index.js +88 -0
- package/es/table/components/LoadMore/index.scss +19 -0
- package/es/table/components/Pagination/index.js +25 -58
- package/es/table/components/QuickAction/index.d.ts +1 -0
- package/es/table/components/QuickAction/index.js +3 -11
- package/es/table/components/ToolBar/CardSwitch.d.ts +8 -0
- package/es/table/components/ToolBar/CardSwitch.js +52 -0
- package/es/table/components/ToolBar/DensityIcon.js +19 -31
- package/es/table/components/ToolBar/FilterColumnIcon.js +87 -125
- package/es/table/components/ToolBar/FullScreenIcon.js +7 -62
- package/es/table/components/ToolBar/Fullscreen.js +25 -28
- package/es/table/components/ToolBar/RefreshIcon.js +162 -27
- package/es/table/components/ToolBar/index.d.ts +1 -1
- package/es/table/components/ToolBar/index.js +130 -38
- package/es/table/components/ToolBar/index.scss +49 -3
- package/es/table/index.js +455 -423
- package/es/table/index.scss +8 -0
- package/es/table/typing.d.ts +125 -6
- package/es/table/utils/columnRender.d.ts +3 -3
- package/es/table/utils/columnRender.js +39 -79
- package/es/table/utils/genProColumnToColumn.d.ts +2 -2
- package/es/table/utils/genProColumnToColumn.js +13 -16
- package/es/table/utils/index.js +14 -47
- package/es/table/utils/pureColumnRender.js +21 -53
- package/es/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/es/table/utils/pureGenProColumnToColumn.js +2 -10
- package/es/table/utils/useTableSelection.js +6 -33
- package/es/table/utils/util.d.ts +5 -0
- package/es/table/utils/util.js +19 -0
- package/es/templates/List/index.js +2 -9
- package/es/timeline/ProTimeLineItem/index.js +25 -65
- package/es/timeline/index.js +8 -22
- package/es/timeline/typing.d.ts +1 -0
- package/es/utils/message.d.ts +2 -2
- package/es/utils/message.js +0 -5
- package/es/xconsole.scss +503 -0
- package/lib/actions/base.js +8 -24
- package/lib/actions/confirm.js +0 -5
- package/lib/actions/danger-confirm.js +0 -5
- package/lib/actions/danger-pop-confirm.js +0 -4
- package/lib/actions/dialog-component.js +2 -15
- package/lib/actions/dialog-form.js +36 -89
- package/lib/actions/dialog-info.js +1 -10
- package/lib/actions/dialog-table.js +0 -5
- package/lib/actions/dialog.js +55 -112
- package/lib/actions/drawer-form.js +0 -3
- package/lib/actions/drawer-info.js +0 -3
- package/lib/actions/drawer-table.js +0 -3
- package/lib/actions/drawer.js +0 -4
- package/lib/actions/error.js +0 -5
- package/lib/actions/index.d.ts +7 -0
- package/lib/actions/index.js +115 -184
- package/lib/actions/index.scss +6 -1
- package/lib/actions/link.js +1 -10
- package/lib/actions/notice.js +0 -5
- package/lib/actions/pop-confirm.js +0 -5
- package/lib/actions/quick.d.ts +2 -0
- package/lib/actions/quick.js +33 -0
- package/lib/actions/request.js +8 -32
- package/lib/actions/utils.js +1 -9
- package/lib/card/card-container.js +0 -9
- package/lib/card/divider.js +0 -7
- package/lib/card/index.js +61 -127
- package/lib/card/index.scss +15 -0
- package/lib/card/selectable.js +4 -20
- package/lib/card/tab.js +1 -14
- package/lib/card/utils.js +0 -6
- package/lib/card/xconsole.scss +3 -0
- package/lib/field/index.js +0 -6
- package/lib/form/Components/Editable/index.js +15 -65
- package/lib/form/Components/FormGroup/index.d.ts +1 -0
- package/lib/form/Components/FormGroup/index.js +7 -28
- package/lib/form/Components/LightFilter/index.js +15 -47
- package/lib/form/Components/ProField/index.js +2 -21
- package/lib/form/Components/ProField/mapDateFormat.js +2 -32
- package/lib/form/Components/Text/index.d.ts +1 -0
- package/lib/form/Components/Text/index.js +2 -16
- package/lib/form/Filter/AdvancedFilter.js +11 -34
- package/lib/form/Filter/Layout.js +11 -33
- package/lib/form/Filter/LightFilter.js +13 -32
- package/lib/form/Filter/SimpleFilter.js +5 -27
- package/lib/form/Filter/index.js +116 -191
- package/lib/form/Filter/index2.js +11 -38
- package/lib/form/Filter/layout.scss +1 -1
- package/lib/form/Filter/useBindUrl.js +18 -50
- package/lib/form/Filter/useSpecialProps.js +6 -13
- package/lib/form/ProForm/addCascadeEffect.d.ts +2 -0
- package/lib/form/ProForm/addCascadeEffect.js +210 -0
- package/lib/form/ProForm/customComponent.js +0 -8
- package/lib/form/ProForm/index.js +30 -60
- package/lib/form/ProForm/useAutoLayout.js +21 -45
- package/lib/form/ProForm/useAutoSubmit.js +1 -10
- package/lib/form/ProForm/useFieldRequest.js +0 -8
- package/lib/form/ProForm/useFormDisplayValues.js +12 -34
- package/lib/form/ProForm/useInitialRequest.js +0 -6
- package/lib/form/SchemaForm/adapterComponent.js +0 -6
- package/lib/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/lib/form/SchemaForm/adapterDecorator.js +0 -12
- package/lib/form/SchemaForm/adapterType.js +0 -5
- package/lib/form/SchemaForm/index.js +78 -144
- package/lib/form/SchemaForm/initializeArrayCards.js +0 -7
- package/lib/form/SchemaForm/initializeArrayCollapse.js +0 -7
- package/lib/form/SchemaForm/initializeArrayItems.js +2 -10
- package/lib/form/SchemaForm/initializeArrayTable.js +21 -34
- package/lib/form/SchemaForm/initializeDataSource.js +2 -8
- package/lib/form/SchemaForm/initializeFormButton.js +14 -32
- package/lib/form/SchemaForm/initializeFormCollapse.js +8 -18
- package/lib/form/SchemaForm/initializeFormGroup.js +10 -20
- package/lib/form/SchemaForm/initializeFormStep.js +11 -23
- package/lib/form/SchemaForm/initializeFormTab.js +10 -20
- package/lib/form/SchemaForm/initializeReactions.js +9 -37
- package/lib/form/SchemaForm/initializeRequest.js +2 -18
- package/lib/form/SchemaForm/initializeRules.js +4 -24
- package/lib/form/SchemaForm/initializeSelectTable.js +7 -36
- package/lib/form/SchemaForm/reactions.js +17 -37
- package/lib/form/docs/ActionResponse.d.ts +1 -0
- package/lib/form/docs/ActionResponse.js +0 -5
- package/lib/form/index.d.ts +9 -9
- package/lib/form/index.js +0 -25
- package/lib/form/typing.d.ts +26 -4
- package/lib/form/utils.d.ts +1 -1
- package/lib/form/utils.js +4 -61
- package/lib/form/warning.js +2 -8
- package/lib/global.scss +3 -1
- package/lib/hooks/index.js +0 -5
- package/lib/index-without-icon.js +2 -36
- package/lib/index.d.ts +1 -1
- package/lib/index.js +13 -40
- package/lib/info/components/InfoGroup/index.js +21 -42
- package/lib/info/components/InfoValueItem/index.js +66 -134
- package/lib/info/components/ProInfoItem/index.js +13 -29
- package/lib/info/components/baseInfo/index.js +17 -39
- package/lib/info/components/headerInfo/index.js +8 -31
- package/lib/info/components/tableInfo/index.js +20 -62
- package/lib/info/index.js +61 -101
- package/lib/info/typing.d.ts +2 -0
- package/lib/info/utils/index.js +0 -19
- package/lib/info/utils/utils.js +0 -1
- package/lib/next-xconsole.scss +34 -0
- package/lib/nocode/configurators/PageHeader.js +0 -2
- package/lib/nocode/configurators/ProTable.js +1 -24
- package/lib/nocode/configurators/common.js +5 -10
- package/lib/nocode/configurators/index.js +2 -10
- package/lib/nocode/configurators/map.js +0 -5
- package/lib/nocode/index.js +0 -11
- package/lib/nocode/pages/editor.js +5 -19
- package/lib/nocode/pages/index.js +3 -35
- package/lib/nocode/pages/playground.js +18 -52
- package/lib/nocode/pages/renderer.js +9 -53
- package/lib/nocode/playground.js +10 -35
- package/lib/page-container/index.js +0 -6
- package/lib/page-header/index.d.ts +2 -2
- package/lib/page-header/index.js +39 -90
- package/lib/page-header/index.scss +2 -1
- package/lib/page-header/xconsole.scss +5 -0
- package/lib/sidebar/components/sidebar-container/index.js +54 -81
- package/lib/sidebar/components/sidebar-container/index.scss +21 -14
- package/lib/sidebar/components/tree/index.js +100 -152
- package/lib/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -34
- package/lib/sidebar/components/tree-node/components/IconAction/index.js +9 -46
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.d.ts +2 -2
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +12 -35
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.scss +1 -1
- package/lib/sidebar/components/tree-node/index.js +42 -100
- package/lib/sidebar/components/tree-node/index.scss +6 -0
- package/lib/sidebar/index.d.ts +2 -0
- package/lib/sidebar/index.js +79 -111
- package/lib/sidebar/typing.d.ts +4 -0
- package/lib/sidebar/utils/action-ref.js +2 -8
- package/lib/sidebar/utils/index.d.ts +5 -2
- package/lib/sidebar/utils/index.js +41 -106
- package/lib/skeleton/index.js +0 -6
- package/lib/table/components/CardView/index.d.ts +5 -0
- package/lib/table/components/CardView/index.js +402 -0
- package/lib/table/components/CardView/index.scss +46 -0
- package/lib/table/components/EmptyContent/index.js +0 -6
- package/lib/table/components/Filter/index.d.ts +6 -3
- package/lib/table/components/Filter/index.js +114 -137
- package/lib/table/components/Layout/index.js +32 -60
- package/lib/table/components/Layout/index.scss +2 -1
- package/lib/table/components/LoadMore/index.d.ts +20 -0
- package/lib/table/components/LoadMore/index.js +99 -0
- package/lib/table/components/LoadMore/index.scss +19 -0
- package/lib/table/components/Pagination/index.js +25 -68
- package/lib/table/components/QuickAction/index.d.ts +1 -0
- package/lib/table/components/QuickAction/index.js +3 -15
- package/lib/table/components/ToolBar/CardSwitch.d.ts +8 -0
- package/lib/table/components/ToolBar/CardSwitch.js +60 -0
- package/lib/table/components/ToolBar/DensityIcon.js +19 -42
- package/lib/table/components/ToolBar/FilterColumnIcon.js +86 -136
- package/lib/table/components/ToolBar/FullScreenIcon.js +10 -74
- package/lib/table/components/ToolBar/Fullscreen.js +25 -35
- package/lib/table/components/ToolBar/RefreshIcon.js +164 -36
- package/lib/table/components/ToolBar/index.d.ts +1 -1
- package/lib/table/components/ToolBar/index.js +133 -47
- package/lib/table/components/ToolBar/index.scss +49 -3
- package/lib/table/index.js +454 -445
- package/lib/table/index.scss +8 -0
- package/lib/table/typing.d.ts +125 -6
- package/lib/table/utils/columnRender.d.ts +3 -3
- package/lib/table/utils/columnRender.js +39 -92
- package/lib/table/utils/genProColumnToColumn.d.ts +2 -2
- package/lib/table/utils/genProColumnToColumn.js +13 -21
- package/lib/table/utils/getTableProps.js +0 -2
- package/lib/table/utils/getTableSortIcons.js +0 -5
- package/lib/table/utils/index.js +12 -55
- package/lib/table/utils/pureColumnRender.js +21 -64
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/lib/table/utils/pureGenProColumnToColumn.js +2 -11
- package/lib/table/utils/useTableSelection.js +6 -35
- package/lib/table/utils/util.d.ts +5 -0
- package/lib/table/utils/util.js +25 -0
- package/lib/templates/Detail/index.js +0 -5
- package/lib/templates/Form/index.js +0 -5
- package/lib/templates/List/index.js +2 -19
- package/lib/templates/index.js +0 -6
- package/lib/timeline/ProTimeLineItem/index.js +25 -76
- package/lib/timeline/index.js +8 -33
- package/lib/timeline/typing.d.ts +1 -0
- package/lib/utils/index.js +0 -6
- package/lib/utils/message.d.ts +2 -2
- package/lib/utils/message.js +0 -10
- package/lib/xconsole.scss +503 -0
- package/package.json +1 -1
@@ -1,78 +1,70 @@
|
|
1
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
-
|
3
2
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
-
|
5
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
6
|
-
|
7
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
8
|
-
|
9
5
|
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; }
|
10
|
-
|
11
6
|
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; }
|
12
|
-
|
13
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; }
|
14
|
-
|
15
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
16
|
-
|
17
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."); }
|
18
|
-
|
19
10
|
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
|
-
|
21
11
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
22
|
-
|
23
12
|
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
|
-
|
25
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
26
|
-
|
27
14
|
// 表格项列筛选
|
28
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
15
|
+
import React, { useEffect, useMemo, useState, memo } from 'react';
|
29
16
|
import TeamixIcon from '@teamix/icon';
|
30
17
|
import { Button, Dropdown, Menu } from '@alicloudfe/components';
|
31
18
|
import { usePrefixCls, getMessage } from '@teamix/utils';
|
32
19
|
import './index.scss';
|
20
|
+
import { useUrlState } from '@teamix/hooks';
|
33
21
|
var CheckboxItem = Menu.CheckboxItem;
|
34
22
|
var cls = usePrefixCls('teamix-pro-table-toolbar-filter');
|
35
23
|
var RadioItem = Menu.RadioItem;
|
36
|
-
|
37
24
|
var Filter = function Filter(props) {
|
25
|
+
var _urlState$split, _urlState, _urlState$split2;
|
38
26
|
var column = props.column,
|
39
|
-
|
27
|
+
actionRef = props.actionRef,
|
28
|
+
switchCardView = props.switchCardView,
|
29
|
+
bindUrlProps = props.bindUrlProps,
|
30
|
+
bindUrl = props.bindUrl;
|
40
31
|
var _column$filtersWidth = column.filtersWidth,
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
32
|
+
filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth;
|
33
|
+
var _ref = bindUrl ? useUrlState() : [],
|
34
|
+
_ref2 = _slicedToArray(_ref, 2),
|
35
|
+
urlState = _ref2[0],
|
36
|
+
setUrlState = _ref2[1];
|
37
|
+
// 选中过滤项
|
38
|
+
var _useState = useState((_urlState$split = urlState === null || urlState === void 0 ? void 0 : (_urlState = urlState["filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex)]) === null || _urlState === void 0 ? void 0 : (_urlState$split2 = _urlState.split) === null || _urlState$split2 === void 0 ? void 0 : _urlState$split2.call(_urlState, ',')) !== null && _urlState$split !== void 0 ? _urlState$split : []),
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
40
|
+
selected = _useState2[0],
|
41
|
+
setSelected = _useState2[1];
|
48
42
|
var _useState3 = useState(false),
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
43
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
44
|
+
visible = _useState4[0],
|
45
|
+
setVisible = _useState4[1];
|
53
46
|
useEffect(function () {
|
54
47
|
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4, _actionRef$current$ge5;
|
55
|
-
|
56
48
|
// 从全局状态中读取上次存储的条件
|
57
49
|
var rules = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : (_actionRef$current$ge3 = _actionRef$current$ge2.call(_actionRef$current)) === null || _actionRef$current$ge3 === void 0 ? void 0 : (_actionRef$current$ge4 = _actionRef$current$ge3.filterRules) === null || _actionRef$current$ge4 === void 0 ? void 0 : (_actionRef$current$ge5 = _actionRef$current$ge4[column.dataIndex]) === null || _actionRef$current$ge5 === void 0 ? void 0 : _actionRef$current$ge5.rules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : [];
|
58
|
-
|
59
|
-
|
60
|
-
|
50
|
+
// 全局状态中需要有值才赋值。优先级:全局状态 > urlState
|
51
|
+
if (rules && rules.length > 0) {
|
52
|
+
setSelected(rules);
|
53
|
+
}
|
54
|
+
}, []);
|
55
|
+
// 获取过滤项
|
61
56
|
var filters = useMemo(function () {
|
62
57
|
if (Array.isArray(column.filters)) {
|
63
58
|
return column.filters;
|
64
59
|
}
|
65
|
-
|
66
|
-
|
67
|
-
|
60
|
+
var filters = column.dataSource;
|
61
|
+
// 转换 valueEnum 为 options
|
68
62
|
if (!Array.isArray(column.dataSource)) {
|
69
|
-
filters = Object.entries(column.dataSource).map(function (
|
63
|
+
filters = Object.entries(column.dataSource).map(function (_ref3) {
|
70
64
|
var _nv$label, _nv$color;
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
v = _ref2[1];
|
75
|
-
|
65
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
66
|
+
k = _ref4[0],
|
67
|
+
v = _ref4[1];
|
76
68
|
var nv = v;
|
77
69
|
return _objectSpread(_objectSpread({
|
78
70
|
value: k
|
@@ -81,18 +73,82 @@ var Filter = function Filter(props) {
|
|
81
73
|
color: (_nv$color = nv.color) !== null && _nv$color !== void 0 ? _nv$color : k
|
82
74
|
});
|
83
75
|
});
|
84
|
-
}
|
85
|
-
|
86
|
-
|
76
|
+
}
|
77
|
+
// console.log(filters);
|
87
78
|
return filters;
|
88
|
-
}, []);
|
89
|
-
|
79
|
+
}, []);
|
80
|
+
// 点击确定回调
|
81
|
+
var onFilterOk = function onFilterOk() {
|
82
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s, _actionRef$current5, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$r, _actionRef$current9, _actionRef$current9$c;
|
83
|
+
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex);
|
84
|
+
// 先获取此列的param
|
85
|
+
var param = '';
|
86
|
+
if (column.beforeFilter) {
|
87
|
+
var _column$beforeFilter;
|
88
|
+
param = (_column$beforeFilter = column.beforeFilter) === null || _column$beforeFilter === void 0 ? void 0 : _column$beforeFilter.call(column, selected);
|
89
|
+
} else {
|
90
|
+
param = selected.join(',');
|
91
|
+
}
|
92
|
+
// 需要带上其他所有的信息
|
93
|
+
var rules = (_actionRef$current$ge6 = (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : (_actionRef$current3$g2 = _actionRef$current3$g.call(_actionRef$current3)) === null || _actionRef$current3$g2 === void 0 ? void 0 : _actionRef$current3$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {};
|
94
|
+
// 再设置所有的列筛选状态
|
95
|
+
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
96
|
+
rules: selected,
|
97
|
+
params: param
|
98
|
+
})));
|
99
|
+
var targetPageKey = 'currentPage';
|
100
|
+
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
101
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
102
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
103
|
+
}
|
104
|
+
if (switchCardView === 'card') {
|
105
|
+
var _actionRef$current6, _actionRef$current6$s;
|
106
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$s = _actionRef$current6.setData) === null || _actionRef$current6$s === void 0 ? void 0 : _actionRef$current6$s.call(_actionRef$current6, []);
|
107
|
+
}
|
108
|
+
// 发送请求
|
109
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.request) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7, _defineProperty({}, targetPageKey, 1));
|
110
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$r = _actionRef$current8.resetPage) === null || _actionRef$current8$r === void 0 ? void 0 : _actionRef$current8$r.call(_actionRef$current8);
|
111
|
+
// 清空表格选择
|
112
|
+
(_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$c = _actionRef$current9.clearRowSelection) === null || _actionRef$current9$c === void 0 ? void 0 : _actionRef$current9$c.call(_actionRef$current9);
|
113
|
+
setVisible(false);
|
114
|
+
// 设置 url
|
115
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false && (urlState === null || urlState === void 0 ? void 0 : urlState["filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex)]) !== selected.join(',')) {
|
116
|
+
setUrlState === null || setUrlState === void 0 ? void 0 : setUrlState(_defineProperty({}, "filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex), selected.join(',')));
|
117
|
+
}
|
118
|
+
};
|
119
|
+
// 重置回调
|
120
|
+
var onFilterReset = function onFilterReset() {
|
121
|
+
var _actionRef$current$ge7, _actionRef$current10, _actionRef$current10$, _actionRef$current10$2, _actionRef$current11, _actionRef$current11$, _actionRef$current12, _actionRef$current12$;
|
122
|
+
setSelected([]);
|
123
|
+
var rules = (_actionRef$current$ge7 = (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.getState) === null || _actionRef$current10$ === void 0 ? void 0 : (_actionRef$current10$2 = _actionRef$current10$.call(_actionRef$current10)) === null || _actionRef$current10$2 === void 0 ? void 0 : _actionRef$current10$2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
|
124
|
+
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.setFilterRules) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
125
|
+
rules: [],
|
126
|
+
params: ''
|
127
|
+
})));
|
128
|
+
(_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : (_actionRef$current12$ = _actionRef$current12.filterDataSource) === null || _actionRef$current12$ === void 0 ? void 0 : _actionRef$current12$.call(_actionRef$current12, column.dataIndex);
|
129
|
+
if (selected.length > 0) {
|
130
|
+
var _actionRef$current13, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$, _actionRef$current16, _actionRef$current16$;
|
131
|
+
var targetPageKey = 'currentPage';
|
132
|
+
var pageInfo = (_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : _actionRef$current13.pageInfo;
|
133
|
+
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
134
|
+
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
135
|
+
}
|
136
|
+
// 发送请求
|
137
|
+
(_actionRef$current14 = actionRef.current) === null || _actionRef$current14 === void 0 ? void 0 : (_actionRef$current14$ = _actionRef$current14.request) === null || _actionRef$current14$ === void 0 ? void 0 : _actionRef$current14$.call(_actionRef$current14, _defineProperty({}, targetPageKey, 1));
|
138
|
+
(_actionRef$current15 = actionRef.current) === null || _actionRef$current15 === void 0 ? void 0 : (_actionRef$current15$ = _actionRef$current15.resetPage) === null || _actionRef$current15$ === void 0 ? void 0 : _actionRef$current15$.call(_actionRef$current15);
|
139
|
+
// 清空表格选择
|
140
|
+
(_actionRef$current16 = actionRef.current) === null || _actionRef$current16 === void 0 ? void 0 : (_actionRef$current16$ = _actionRef$current16.clearRowSelection) === null || _actionRef$current16$ === void 0 ? void 0 : _actionRef$current16$.call(_actionRef$current16);
|
141
|
+
if (bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.headerFilters) !== false) {
|
142
|
+
setUrlState === null || setUrlState === void 0 ? void 0 : setUrlState(_defineProperty({}, "filter".concat(column === null || column === void 0 ? void 0 : column.dataIndex), undefined));
|
143
|
+
}
|
144
|
+
}
|
145
|
+
};
|
146
|
+
// 渲染单选
|
90
147
|
var renderSingle = function renderSingle() {
|
91
|
-
return filters === null || filters === void 0 ? void 0 : filters.map(function (
|
148
|
+
return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref5) {
|
92
149
|
var _value$toString;
|
93
|
-
|
94
|
-
|
95
|
-
value = _ref3.value;
|
150
|
+
var label = _ref5.label,
|
151
|
+
value = _ref5.value;
|
96
152
|
var valueStr = (_value$toString = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString !== void 0 ? _value$toString : '';
|
97
153
|
return /*#__PURE__*/React.createElement(RadioItem, {
|
98
154
|
id: valueStr,
|
@@ -103,15 +159,13 @@ var Filter = function Filter(props) {
|
|
103
159
|
}
|
104
160
|
}, label);
|
105
161
|
});
|
106
|
-
};
|
107
|
-
|
108
|
-
|
162
|
+
};
|
163
|
+
// 渲染多选
|
109
164
|
var renderMultiple = function renderMultiple() {
|
110
|
-
return filters === null || filters === void 0 ? void 0 : filters.map(function (
|
165
|
+
return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref6) {
|
111
166
|
var _value$toString2;
|
112
|
-
|
113
|
-
|
114
|
-
value = _ref4.value;
|
167
|
+
var label = _ref6.label,
|
168
|
+
value = _ref6.value;
|
115
169
|
var valueStr = (_value$toString2 = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString2 !== void 0 ? _value$toString2 : '';
|
116
170
|
return /*#__PURE__*/React.createElement(CheckboxItem, {
|
117
171
|
key: valueStr,
|
@@ -127,17 +181,14 @@ var Filter = function Filter(props) {
|
|
127
181
|
}
|
128
182
|
}, label);
|
129
183
|
});
|
130
|
-
};
|
131
|
-
|
132
|
-
|
184
|
+
};
|
185
|
+
// 渲染选择区域
|
133
186
|
var renderSelect = function renderSelect() {
|
134
187
|
if (column.filterMode === 'multiple') {
|
135
188
|
return renderMultiple();
|
136
189
|
}
|
137
|
-
|
138
190
|
return renderSingle();
|
139
191
|
};
|
140
|
-
|
141
192
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
142
193
|
trigger: /*#__PURE__*/React.createElement(TeamixIcon, {
|
143
194
|
size: "small",
|
@@ -171,78 +222,14 @@ var Filter = function Filter(props) {
|
|
171
222
|
className: cls({
|
172
223
|
btn: true
|
173
224
|
}),
|
174
|
-
onClick:
|
175
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s, _actionRef$current5, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
|
176
|
-
|
177
|
-
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
|
178
|
-
|
179
|
-
var param = '';
|
180
|
-
|
181
|
-
if (column.beforeFilter) {
|
182
|
-
var _column$beforeFilter;
|
183
|
-
|
184
|
-
param = (_column$beforeFilter = column.beforeFilter) === null || _column$beforeFilter === void 0 ? void 0 : _column$beforeFilter.call(column, selected);
|
185
|
-
} else {
|
186
|
-
param = selected.join(',');
|
187
|
-
} // 需要带上其他所有的信息
|
188
|
-
|
189
|
-
|
190
|
-
var rules = (_actionRef$current$ge6 = (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : (_actionRef$current3$g2 = _actionRef$current3$g.call(_actionRef$current3)) === null || _actionRef$current3$g2 === void 0 ? void 0 : _actionRef$current3$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {}; // 再设置所有的列筛选状态
|
191
|
-
|
192
|
-
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
193
|
-
rules: selected,
|
194
|
-
params: param
|
195
|
-
})));
|
196
|
-
var targetPageKey = 'currentPage';
|
197
|
-
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
198
|
-
|
199
|
-
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
200
|
-
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
201
|
-
} // 发送请求
|
202
|
-
|
203
|
-
|
204
|
-
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _defineProperty({}, targetPageKey, 1));
|
205
|
-
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
|
206
|
-
|
207
|
-
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
208
|
-
setVisible(false);
|
209
|
-
}
|
225
|
+
onClick: onFilterOk
|
210
226
|
}, getMessage('ok')), /*#__PURE__*/React.createElement(Button, {
|
211
227
|
type: "normal",
|
212
228
|
size: "small",
|
213
229
|
className: cls({
|
214
230
|
btn: true
|
215
231
|
}),
|
216
|
-
onClick:
|
217
|
-
var _actionRef$current$ge7, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
|
218
|
-
|
219
|
-
setSelected([]);
|
220
|
-
var rules = (_actionRef$current$ge7 = (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$g = _actionRef$current9.getState) === null || _actionRef$current9$g === void 0 ? void 0 : (_actionRef$current9$g2 = _actionRef$current9$g.call(_actionRef$current9)) === null || _actionRef$current9$g2 === void 0 ? void 0 : _actionRef$current9$g2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
|
221
|
-
(_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.setFilterRules) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
222
|
-
rules: [],
|
223
|
-
params: ''
|
224
|
-
})));
|
225
|
-
(_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.filterDataSource) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, column.dataIndex);
|
226
|
-
|
227
|
-
if (selected.length > 0) {
|
228
|
-
var _actionRef$current12, _actionRef$current13, _actionRef$current13$, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$;
|
229
|
-
|
230
|
-
var targetPageKey = 'currentPage';
|
231
|
-
var pageInfo = (_actionRef$current12 = actionRef.current) === null || _actionRef$current12 === void 0 ? void 0 : _actionRef$current12.pageInfo;
|
232
|
-
|
233
|
-
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
234
|
-
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
235
|
-
} // 发送请求
|
236
|
-
|
237
|
-
|
238
|
-
(_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : (_actionRef$current13$ = _actionRef$current13.request) === null || _actionRef$current13$ === void 0 ? void 0 : _actionRef$current13$.call(_actionRef$current13, _defineProperty({}, targetPageKey, 1));
|
239
|
-
(_actionRef$current14 = actionRef.current) === null || _actionRef$current14 === void 0 ? void 0 : (_actionRef$current14$ = _actionRef$current14.resetPage) === null || _actionRef$current14$ === void 0 ? void 0 : _actionRef$current14$.call(_actionRef$current14); // 清空表格选择
|
240
|
-
|
241
|
-
(_actionRef$current15 = actionRef.current) === null || _actionRef$current15 === void 0 ? void 0 : (_actionRef$current15$ = _actionRef$current15.clearRowSelection) === null || _actionRef$current15$ === void 0 ? void 0 : _actionRef$current15$.call(_actionRef$current15);
|
242
|
-
} // setVisible(!visible);
|
243
|
-
|
244
|
-
}
|
232
|
+
onClick: onFilterReset
|
245
233
|
}, getMessage('reset'))))));
|
246
234
|
};
|
247
|
-
|
248
|
-
export default Filter;
|
235
|
+
export default /*#__PURE__*/memo(Filter);
|
@@ -1,17 +1,10 @@
|
|
1
|
-
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar"];
|
2
|
-
|
1
|
+
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar", "dataTeamixSpm", "bindUrl", "bindUrlProps"];
|
3
2
|
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
|
-
|
5
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; }
|
6
|
-
|
7
4
|
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
|
-
|
9
5
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
10
|
-
|
11
6
|
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; }
|
12
|
-
|
13
7
|
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; }
|
14
|
-
|
15
8
|
import React, { isValidElement } from 'react';
|
16
9
|
import { usePrefixCls } from '@teamix/utils';
|
17
10
|
import { Header } from '../../../field';
|
@@ -21,34 +14,32 @@ import ToolBar from '../ToolBar';
|
|
21
14
|
import QuickAction from '../QuickAction';
|
22
15
|
import './index.scss';
|
23
16
|
var cls = usePrefixCls('teamix-pro-table-layout');
|
24
|
-
|
25
17
|
var Layout = function Layout(props) {
|
26
18
|
var header = props.header,
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
19
|
+
mainAction = props.mainAction,
|
20
|
+
extra = props.extra,
|
21
|
+
actionRef = props.actionRef,
|
22
|
+
dataFilter = props.dataFilter,
|
23
|
+
dataFilterFormRef = props.dataFilterFormRef,
|
24
|
+
afterDataFilter = props.afterDataFilter,
|
25
|
+
rowSelection = props.rowSelection,
|
26
|
+
toolBar = props.toolBar,
|
27
|
+
dataTeamixSpm = props.dataTeamixSpm,
|
28
|
+
bindUrl = props.bindUrl,
|
29
|
+
bindUrlProps = props.bindUrlProps,
|
30
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
31
|
+
// 渲染主操作区
|
38
32
|
var renderMainAction = function renderMainAction() {
|
39
33
|
var _mainAction$actions;
|
40
|
-
|
41
34
|
if (_typeof(mainAction) === 'object' && (mainAction === null || mainAction === void 0 ? void 0 : (_mainAction$actions = mainAction.actions) === null || _mainAction$actions === void 0 ? void 0 : _mainAction$actions.length) > 0) {
|
42
35
|
// 判断 actions 是否 visible 都为 false,是的话也不渲染
|
43
36
|
var isEmptyActions = mainAction === null || mainAction === void 0 ? void 0 : mainAction.actions.every(function (action) {
|
44
37
|
return (action === null || action === void 0 ? void 0 : action.visible) === false;
|
45
38
|
});
|
46
|
-
|
47
39
|
if (isEmptyActions) {
|
48
40
|
return;
|
49
|
-
}
|
50
|
-
|
51
|
-
|
41
|
+
}
|
42
|
+
// 默认 context
|
52
43
|
var defaultContext = {
|
53
44
|
action: actionRef.current,
|
54
45
|
rowSelection: rowSelection
|
@@ -56,12 +47,12 @@ var Layout = function Layout(props) {
|
|
56
47
|
return /*#__PURE__*/React.createElement("div", {
|
57
48
|
className: cls('main-action')
|
58
49
|
}, /*#__PURE__*/React.createElement(ProActionGroup, _objectSpread(_objectSpread({}, mainAction), {}, {
|
59
|
-
context: _objectSpread(_objectSpread({}, defaultContext), mainAction.context)
|
50
|
+
context: _objectSpread(_objectSpread({}, defaultContext), mainAction.context),
|
51
|
+
"data-teamix-spm": dataTeamixSpm ? "".concat(dataTeamixSpm, "-mainAction") : undefined
|
60
52
|
})));
|
61
53
|
} else return mainAction;
|
62
|
-
};
|
63
|
-
|
64
|
-
|
54
|
+
};
|
55
|
+
// 渲染 addonAfter
|
65
56
|
var renderAddonAfter = function renderAddonAfter() {
|
66
57
|
return /*#__PURE__*/React.createElement("div", {
|
67
58
|
className: cls('addon-after-wrapper')
|
@@ -73,15 +64,12 @@ var Layout = function Layout(props) {
|
|
73
64
|
actionRef: actionRef,
|
74
65
|
toolBar: toolBar
|
75
66
|
}, otherProps)));
|
76
|
-
};
|
77
|
-
|
78
|
-
|
67
|
+
};
|
68
|
+
// 渲染新版 QueryFilter
|
79
69
|
var renderQueryFilter = function renderQueryFilter() {
|
80
70
|
var _dataFilter$schema;
|
81
|
-
|
82
71
|
if (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) {
|
83
72
|
var _dataFilter$schema2;
|
84
|
-
|
85
73
|
if ( /*#__PURE__*/isValidElement(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content)) {
|
86
74
|
// 自定义渲染内容
|
87
75
|
return /*#__PURE__*/React.createElement(QueryFilterLayout, _objectSpread({
|
@@ -89,11 +77,12 @@ var Layout = function Layout(props) {
|
|
89
77
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
90
78
|
setTimeout(function () {
|
91
79
|
var _actionRef$current, _actionRef$current$re;
|
92
|
-
|
93
80
|
// if (actionRef.current?.getState?.().fullScreenState) {
|
94
81
|
// 偏移量8像素为面板展开后的下margin
|
95
|
-
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.resetTableMaxBodyHeight) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current, expand ? 8 : 0);
|
82
|
+
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.resetTableMaxBodyHeight) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current, expand ? 8 : 0);
|
83
|
+
// }
|
96
84
|
});
|
85
|
+
|
97
86
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
98
87
|
},
|
99
88
|
panelContent: dataFilter.content,
|
@@ -107,15 +96,17 @@ var Layout = function Layout(props) {
|
|
107
96
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
108
97
|
setTimeout(function () {
|
109
98
|
var _actionRef$current2, _actionRef$current2$r;
|
110
|
-
|
111
99
|
// if (actionRef.current?.getState?.().fullScreenState) {
|
112
100
|
// 偏移量8像素为面板展开后的下margin
|
113
|
-
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.resetTableMaxBodyHeight) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2, expand ? 8 : 0);
|
101
|
+
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.resetTableMaxBodyHeight) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2, expand ? 8 : 0);
|
102
|
+
// }
|
114
103
|
});
|
104
|
+
|
115
105
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
116
106
|
},
|
117
107
|
addonBefore: renderMainAction(),
|
118
|
-
addonAfter: renderAddonAfter()
|
108
|
+
addonAfter: renderAddonAfter(),
|
109
|
+
bindUrl: bindUrl && (bindUrlProps === null || bindUrlProps === void 0 ? void 0 : bindUrlProps.filters) !== false
|
119
110
|
}, dataFilter)), afterDataFilter && /*#__PURE__*/React.createElement("div", {
|
120
111
|
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
121
112
|
}, afterDataFilter));
|
@@ -137,9 +128,8 @@ var Layout = function Layout(props) {
|
|
137
128
|
}, afterDataFilter) : null
|
138
129
|
}));
|
139
130
|
}
|
140
|
-
};
|
141
|
-
|
142
|
-
|
131
|
+
};
|
132
|
+
// 区域组合渲染
|
143
133
|
var renderLayout = function renderLayout() {
|
144
134
|
if (header && mainAction) {
|
145
135
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
@@ -155,7 +145,6 @@ var Layout = function Layout(props) {
|
|
155
145
|
}))), renderQueryFilter());
|
156
146
|
} else if (header && !mainAction) {
|
157
147
|
var _dataFilter$schema3, _dataFilter$schema4;
|
158
|
-
|
159
148
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
160
149
|
className: cls('wrapper')
|
161
150
|
}, /*#__PURE__*/React.createElement("div", {
|
@@ -173,18 +162,14 @@ var Layout = function Layout(props) {
|
|
173
162
|
if (!dataFilterFormRef && !extra) {
|
174
163
|
return null;
|
175
164
|
}
|
176
|
-
|
177
165
|
return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter());
|
178
166
|
}
|
179
167
|
};
|
180
|
-
|
181
168
|
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) || mainAction || header || extra || toolBar !== false) {
|
182
169
|
return /*#__PURE__*/React.createElement("div", {
|
183
170
|
className: cls()
|
184
171
|
}, renderLayout());
|
185
172
|
}
|
186
|
-
|
187
173
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
188
174
|
};
|
189
|
-
|
190
175
|
export default /*#__PURE__*/React.memo(Layout);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
$prefix: 'teamix-pro-table-layout';
|
2
2
|
|
3
3
|
.theme-hybridcloud-dark {
|
4
|
-
--panel-filter-bg: #
|
4
|
+
--panel-filter-bg: #141414;
|
5
5
|
}
|
6
6
|
|
7
7
|
.#{$prefix} {
|
@@ -43,5 +43,6 @@ $prefix: 'teamix-pro-table-layout';
|
|
43
43
|
&-addon-after-wrapper {
|
44
44
|
display: flex;
|
45
45
|
align-items: center;
|
46
|
+
margin-bottom: 8px;
|
46
47
|
}
|
47
48
|
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import './index.scss';
|
3
|
+
export declare type LoadMoreProps = {
|
4
|
+
/** 内容 **/
|
5
|
+
children?: React.ReactNode;
|
6
|
+
/** 加载状态 受控 **/
|
7
|
+
loadState?: 'loading' | 'loadMore' | 'noMore' | 'none';
|
8
|
+
/** 滚动条滚动到底部触发事件 **/
|
9
|
+
onScrollBottom?: () => void;
|
10
|
+
/** 加载状态改变回调 **/
|
11
|
+
onChangeLoadState?: (state: LoadMoreProps['loadState']) => void;
|
12
|
+
/** 点击加载更多回调 **/
|
13
|
+
onLoadMore?: () => void;
|
14
|
+
/** 滚动区域高度 **/
|
15
|
+
scrollHeight?: number | string;
|
16
|
+
/** 当前滚动区域位置 **/
|
17
|
+
scrollPosition?: number;
|
18
|
+
};
|
19
|
+
declare const LoadMore: React.FC<LoadMoreProps>;
|
20
|
+
export default LoadMore;
|
@@ -0,0 +1,88 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
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."); }
|
3
|
+
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); }
|
4
|
+
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; }
|
5
|
+
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; }
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
|
+
import React, { useEffect, useRef, useState } from 'react';
|
8
|
+
import { usePrefixCls } from '@teamix/utils';
|
9
|
+
import './index.scss';
|
10
|
+
import TeamixIcon from '@teamix/icon';
|
11
|
+
import debounce from 'lodash.debounce';
|
12
|
+
var cls = usePrefixCls('teamix-pro-load-more');
|
13
|
+
var LoadMore = function LoadMore(props) {
|
14
|
+
var children = props.children,
|
15
|
+
onChangeLoadState = props.onChangeLoadState,
|
16
|
+
onLoadMore = props.onLoadMore,
|
17
|
+
scrollHeight = props.scrollHeight,
|
18
|
+
onScrollBottom = props.onScrollBottom,
|
19
|
+
loadStateProp = props.loadState,
|
20
|
+
scrollPositionProp = props.scrollPosition;
|
21
|
+
var scrollDom = useRef(null);
|
22
|
+
// 加载状态
|
23
|
+
var _useState = useState('loadMore'),
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
25
|
+
loadState = _useState2[0],
|
26
|
+
setLoadState = _useState2[1];
|
27
|
+
useEffect(function () {
|
28
|
+
var _scrollDom$current;
|
29
|
+
scrollDom === null || scrollDom === void 0 ? void 0 : (_scrollDom$current = scrollDom.current) === null || _scrollDom$current === void 0 ? void 0 : _scrollDom$current.addEventListener('scroll', debounce(function (e) {
|
30
|
+
var _e$target, _e$target2, _e$target3;
|
31
|
+
var scrollTop = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.scrollTop;
|
32
|
+
var clientHeight = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.clientHeight;
|
33
|
+
var scrollHeight = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.scrollHeight;
|
34
|
+
if (scrollTop + clientHeight + 5 >= scrollHeight) {
|
35
|
+
onScrollBottom === null || onScrollBottom === void 0 ? void 0 : onScrollBottom();
|
36
|
+
}
|
37
|
+
}, 100));
|
38
|
+
}, []);
|
39
|
+
useEffect(function () {
|
40
|
+
setLoadState(loadStateProp);
|
41
|
+
}, [loadStateProp]);
|
42
|
+
// 更改加载状态
|
43
|
+
var onLoadState = function onLoadState(state) {
|
44
|
+
setLoadState(state);
|
45
|
+
if (state === 'loading') {
|
46
|
+
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
47
|
+
}
|
48
|
+
onChangeLoadState === null || onChangeLoadState === void 0 ? void 0 : onChangeLoadState(state);
|
49
|
+
};
|
50
|
+
// 渲染加载更多和正在加载区域
|
51
|
+
var renderLoadMore = function renderLoadMore() {
|
52
|
+
if (loadState === 'loadMore') {
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
54
|
+
className: cls('bottom-text'),
|
55
|
+
onClick: function onClick() {
|
56
|
+
return onLoadState('loading');
|
57
|
+
}
|
58
|
+
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
59
|
+
type: "down-line",
|
60
|
+
size: "small",
|
61
|
+
className: cls('bottom-text-icon')
|
62
|
+
}), "\u52A0\u8F7D\u66F4\u591A");
|
63
|
+
}
|
64
|
+
if (loadState === 'loading') {
|
65
|
+
return /*#__PURE__*/React.createElement("div", {
|
66
|
+
className: cls('bottom-text')
|
67
|
+
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
68
|
+
type: "loading-line",
|
69
|
+
size: "small",
|
70
|
+
className: cls('bottom-text-icon')
|
71
|
+
}), "\u52A0\u8F7D\u4E2D");
|
72
|
+
}
|
73
|
+
if (loadState === 'noMore') {
|
74
|
+
return /*#__PURE__*/React.createElement("div", {
|
75
|
+
className: cls('bottom-text')
|
76
|
+
}, "\u6CA1\u6709\u66F4\u591A\u4E86");
|
77
|
+
}
|
78
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
79
|
+
};
|
80
|
+
return /*#__PURE__*/React.createElement("div", {
|
81
|
+
className: cls(),
|
82
|
+
style: {
|
83
|
+
height: scrollHeight !== null && scrollHeight !== void 0 ? scrollHeight : 'auto'
|
84
|
+
},
|
85
|
+
ref: scrollDom
|
86
|
+
}, children, renderLoadMore());
|
87
|
+
};
|
88
|
+
export default LoadMore;
|