@teamix/pro 1.4.24 → 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 +76829 -56886
- 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.d.ts +2 -0
- package/es/actions/dialog.js +57 -94
- 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 +18 -27
- 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/index.scss +33 -0
- 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 +12 -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 +74 -116
- 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 +6 -1
- 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 +26 -60
- 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 +467 -422
- package/es/table/index.scss +9 -1
- 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.d.ts +2 -0
- package/lib/actions/dialog.js +55 -111
- package/lib/actions/drawer-form.js +0 -3
- package/lib/actions/drawer-info.js +0 -3
- package/lib/actions/drawer-table.js +0 -3
- package/lib/actions/drawer.js +0 -4
- package/lib/actions/error.js +0 -5
- package/lib/actions/index.d.ts +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 +17 -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/index.scss +33 -0
- 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 +12 -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 +74 -131
- 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 +6 -1
- 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 +26 -70
- 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 +466 -444
- package/lib/table/index.scss +9 -1
- 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 +2 -2
package/es/form/Filter/index.js
CHANGED
@@ -1,39 +1,23 @@
|
|
1
|
+
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); }
|
1
2
|
var _excluded = ["addonAfter", "addonBefore", "mode", "purePanel", "expand", "formRef", "defaultFilterValue", "filterValues", "filterDebounce", "bindUrl", "onFilter", "onInit", "onReset", "onExpand", "onChange", "form"];
|
2
|
-
|
3
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
|
-
|
5
4
|
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
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; }
|
8
|
-
|
9
6
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
10
|
-
|
11
7
|
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."); }
|
12
|
-
|
13
8
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
14
|
-
|
15
9
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
16
|
-
|
10
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
17
11
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
18
|
-
|
19
12
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
20
|
-
|
21
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
22
|
-
|
23
14
|
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."); }
|
24
|
-
|
25
15
|
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); }
|
26
|
-
|
27
16
|
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; }
|
28
|
-
|
29
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; }
|
30
|
-
|
31
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
32
|
-
|
33
19
|
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; }
|
34
|
-
|
35
20
|
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; }
|
36
|
-
|
37
21
|
import React, { memo, useCallback, useMemo, useState, useRef, useEffect } from 'react';
|
38
22
|
import debounce from 'lodash.debounce';
|
39
23
|
import { Tag } from '@alicloudfe/components';
|
@@ -53,39 +37,34 @@ import './index.scss';
|
|
53
37
|
/**
|
54
38
|
* 查询筛选
|
55
39
|
*/
|
56
|
-
|
57
40
|
var QueryFilter = /*#__PURE__*/memo(function (props) {
|
58
41
|
var addonAfter = props.addonAfter,
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
42
|
+
addonBefore = props.addonBefore,
|
43
|
+
mode = props.mode,
|
44
|
+
purePanel = props.purePanel,
|
45
|
+
expand = props.expand,
|
46
|
+
formRef = props.formRef,
|
47
|
+
defaultFilterValue = props.defaultFilterValue,
|
48
|
+
filterValues = props.filterValues,
|
49
|
+
filterDebounce = props.filterDebounce,
|
50
|
+
bindUrl = props.bindUrl,
|
51
|
+
outerFilter = props.onFilter,
|
52
|
+
outerInit = props.onInit,
|
53
|
+
outerReset = props.onReset,
|
54
|
+
onExpand = props.onExpand,
|
55
|
+
onChange = props.onChange,
|
56
|
+
form = props.form,
|
57
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
76
58
|
var _useSpecialProps = useSpecialProps(props),
|
77
|
-
|
78
|
-
|
59
|
+
hasRequired = _useSpecialProps.hasRequired;
|
79
60
|
var _useState = useState(!!expand),
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
62
|
+
panelVisible = _useState2[0],
|
63
|
+
setPanelVisible = _useState2[1];
|
84
64
|
var _useState3 = useState([]),
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
65
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
66
|
+
tagDataSource = _useState4[0],
|
67
|
+
setTagDataSource = _useState4[1];
|
89
68
|
var filterItem = useRef([]);
|
90
69
|
var defaultFormName = mode === 'panel' ? 'advanced' : 'simple';
|
91
70
|
var currentFormName = useRef(defaultFormName);
|
@@ -94,62 +73,52 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
94
73
|
var prefixCls = usePrefixCls('teamix-pro-form-query-filter');
|
95
74
|
var debounceFun = debounce(function (fun, props) {
|
96
75
|
return fun(props);
|
97
|
-
}, filterDebounce);
|
98
|
-
|
76
|
+
}, filterDebounce);
|
77
|
+
// 绑定URL
|
99
78
|
var _useBindUrl = useBindUrl(bindUrl, {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
79
|
+
onInit: outerInit,
|
80
|
+
onFilter: outerFilter,
|
81
|
+
onReset: outerReset
|
82
|
+
}, currentForm),
|
83
|
+
setValuesByUrlState = _useBindUrl.setValuesByUrlState,
|
84
|
+
onInit = _useBindUrl.onInit,
|
85
|
+
onFilter = _useBindUrl.onFilter,
|
86
|
+
onReset = _useBindUrl.onReset;
|
87
|
+
// onInit
|
110
88
|
var initialRequestRef = useRef(!!(props === null || props === void 0 ? void 0 : props.initialRequest));
|
111
89
|
var filterEnable = useRef('waiting');
|
112
|
-
|
113
90
|
var onFormInit = /*#__PURE__*/function () {
|
114
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
91
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(form) {
|
115
92
|
var loadingField;
|
116
|
-
return
|
93
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
117
94
|
while (1) {
|
118
95
|
switch (_context.prev = _context.next) {
|
119
96
|
case 0:
|
120
97
|
form.setState({
|
121
98
|
loading: initialRequestRef.current
|
122
99
|
}); // 借用 form.loading 触发 onFormReact
|
123
|
-
|
124
100
|
loadingField = Object.values(form.fields).filter(function (field) {
|
125
101
|
return !!field.loading;
|
126
102
|
}); // 等待mounted + 字段loading结束 + initialRequest结束 => 表单默认值初始化完成
|
127
|
-
|
128
103
|
if (!(form.mounted && !loadingField.length && !form.loading)) {
|
129
104
|
_context.next = 10;
|
130
105
|
break;
|
131
106
|
}
|
132
|
-
|
133
107
|
onFormInit = undefined; // init后销毁 isFormInit 方法
|
134
|
-
|
135
108
|
setValuesByUrlState(form); // 配置URL参数到表单
|
136
|
-
|
137
109
|
if (!outerInit) {
|
138
110
|
_context.next = 10;
|
139
111
|
break;
|
140
112
|
}
|
141
|
-
|
142
113
|
_context.next = 8;
|
143
114
|
return form.validate();
|
144
|
-
|
145
115
|
case 8:
|
146
|
-
onInit(toJS(form.values));
|
147
|
-
|
116
|
+
onInit(toJS(form.values));
|
117
|
+
// 设置Tag
|
148
118
|
if (mode === 'panel') {
|
149
119
|
configFilterItem(advancedForm);
|
150
120
|
!panelVisible && configTag();
|
151
121
|
}
|
152
|
-
|
153
122
|
case 10:
|
154
123
|
case "end":
|
155
124
|
return _context.stop();
|
@@ -157,49 +126,41 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
157
126
|
}
|
158
127
|
}, _callee);
|
159
128
|
}));
|
160
|
-
|
161
129
|
return function onFormInit(_x) {
|
162
130
|
return _ref.apply(this, arguments);
|
163
131
|
};
|
164
|
-
}();
|
165
|
-
|
166
|
-
|
132
|
+
}();
|
133
|
+
// 配置当前激活的form实例
|
167
134
|
var setCurrentForm = function setCurrentForm(formName) {
|
168
135
|
currentFormName.current = formName;
|
169
136
|
currentForm.current = formMap[formName];
|
170
137
|
var form = currentForm.current;
|
171
|
-
|
172
138
|
if (formRef) {
|
173
|
-
formRef.current = form;
|
174
|
-
|
139
|
+
formRef.current = form;
|
140
|
+
// 自定义updateTags方法
|
175
141
|
if (!formRef.current.updateTags) {
|
176
142
|
formRef.current.updateTags = function () {
|
177
143
|
updateTags(form);
|
178
144
|
};
|
179
|
-
}
|
180
|
-
|
181
|
-
|
145
|
+
}
|
146
|
+
// 自定义setAsyncValues方法
|
182
147
|
if (!formRef.current.setAsyncValues) {
|
183
148
|
formRef.current.setAsyncValues = /*#__PURE__*/function () {
|
184
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
185
|
-
return
|
149
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
|
150
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
186
151
|
while (1) {
|
187
152
|
switch (_context2.prev = _context2.next) {
|
188
153
|
case 0:
|
189
154
|
form.setValues(values);
|
190
|
-
|
191
155
|
if (!(filterEnable.current === 'filter' && formName === 'advanced')) {
|
192
156
|
_context2.next = 6;
|
193
157
|
break;
|
194
158
|
}
|
195
|
-
|
196
159
|
_context2.next = 4;
|
197
160
|
return form.validate();
|
198
|
-
|
199
161
|
case 4:
|
200
162
|
onFilter(toJS(form.values));
|
201
163
|
updateTags(form);
|
202
|
-
|
203
164
|
case 6:
|
204
165
|
case "end":
|
205
166
|
return _context2.stop();
|
@@ -207,30 +168,25 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
207
168
|
}
|
208
169
|
}, _callee2);
|
209
170
|
}));
|
210
|
-
|
211
171
|
return function (_x2) {
|
212
172
|
return _ref2.apply(this, arguments);
|
213
173
|
};
|
214
174
|
}();
|
215
|
-
}
|
216
|
-
|
217
|
-
|
175
|
+
}
|
176
|
+
// 自定义triggerFilter方法
|
218
177
|
if (!formRef.current.triggerFilter) {
|
219
|
-
formRef.current.triggerFilter = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
220
|
-
return
|
178
|
+
formRef.current.triggerFilter = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
179
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
221
180
|
while (1) {
|
222
181
|
switch (_context3.prev = _context3.next) {
|
223
182
|
case 0:
|
224
183
|
_context3.next = 2;
|
225
184
|
return form.validate();
|
226
|
-
|
227
185
|
case 2:
|
228
186
|
onFilter(toJS(form.values));
|
229
|
-
|
230
187
|
if (formName === 'advanced') {
|
231
188
|
updateTags(form);
|
232
189
|
}
|
233
|
-
|
234
190
|
case 4:
|
235
191
|
case "end":
|
236
192
|
return _context3.stop();
|
@@ -238,25 +194,22 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
238
194
|
}
|
239
195
|
}, _callee3);
|
240
196
|
}));
|
241
|
-
}
|
242
|
-
|
243
|
-
|
197
|
+
}
|
198
|
+
// 自定义triggerReset方法
|
244
199
|
if (!formRef.current.triggerReset) {
|
245
200
|
formRef.current.triggerReset = /*#__PURE__*/function () {
|
246
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/
|
247
|
-
return
|
201
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
|
202
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
248
203
|
while (1) {
|
249
204
|
switch (_context4.prev = _context4.next) {
|
250
205
|
case 0:
|
251
206
|
simpleForm.reset('*', config);
|
252
207
|
lightForm.reset('*', config);
|
253
208
|
advancedForm.reset('*', config);
|
254
|
-
|
255
209
|
if (formName === 'advanced') {
|
256
210
|
onReset(toJS(advancedForm.values));
|
257
211
|
updateTags(form);
|
258
212
|
}
|
259
|
-
|
260
213
|
case 4:
|
261
214
|
case "end":
|
262
215
|
return _context4.stop();
|
@@ -264,16 +217,25 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
264
217
|
}
|
265
218
|
}, _callee4);
|
266
219
|
}));
|
267
|
-
|
268
220
|
return function (_x3) {
|
269
221
|
return _ref4.apply(this, arguments);
|
270
222
|
};
|
271
223
|
}();
|
272
224
|
}
|
225
|
+
// 自定义updateDataSource
|
226
|
+
if (!formRef.current.updateDataSource) {
|
227
|
+
formRef.current.updateDataSource = function (query, params) {
|
228
|
+
[simpleForm, lightForm, advancedForm].forEach(function (f) {
|
229
|
+
var $query = f.query(query).take();
|
230
|
+
if ($query) {
|
231
|
+
$query.data.refresh = params;
|
232
|
+
}
|
233
|
+
});
|
234
|
+
};
|
235
|
+
}
|
273
236
|
}
|
274
|
-
};
|
275
|
-
|
276
|
-
|
237
|
+
};
|
238
|
+
// 创建简单筛选表单实例
|
277
239
|
var simpleForm = useMemo(function () {
|
278
240
|
return createForm({
|
279
241
|
validateFirst: true,
|
@@ -281,7 +243,6 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
281
243
|
onFormReact(function (form) {
|
282
244
|
if (mode === 'inline') {
|
283
245
|
var _onFormInit;
|
284
|
-
|
285
246
|
(_onFormInit = onFormInit) === null || _onFormInit === void 0 ? void 0 : _onFormInit(form).finally(function () {
|
286
247
|
return filterEnable.current = 'filter';
|
287
248
|
});
|
@@ -289,8 +250,8 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
289
250
|
});
|
290
251
|
}
|
291
252
|
});
|
292
|
-
}, [form]);
|
293
|
-
|
253
|
+
}, [form]);
|
254
|
+
// 创建轻量筛选表单实例
|
294
255
|
var lightForm = useMemo(function () {
|
295
256
|
return createForm({
|
296
257
|
validateFirst: true,
|
@@ -300,8 +261,8 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
300
261
|
});
|
301
262
|
}
|
302
263
|
});
|
303
|
-
}, [form]);
|
304
|
-
|
264
|
+
}, [form]);
|
265
|
+
// 创建高级筛选表单实例
|
305
266
|
var advancedForm = useMemo(function () {
|
306
267
|
return createForm({
|
307
268
|
validateFirst: true,
|
@@ -309,7 +270,6 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
309
270
|
onFormReact(function (form) {
|
310
271
|
if (mode === 'panel') {
|
311
272
|
var _onFormInit2;
|
312
|
-
|
313
273
|
(_onFormInit2 = onFormInit) === null || _onFormInit2 === void 0 ? void 0 : _onFormInit2(form).finally(function () {
|
314
274
|
return filterEnable.current = 'filter';
|
315
275
|
});
|
@@ -325,25 +285,21 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
325
285
|
simple: simpleForm,
|
326
286
|
light: lightForm,
|
327
287
|
advanced: advancedForm
|
328
|
-
};
|
329
|
-
|
288
|
+
};
|
289
|
+
// 获取筛选数据Label
|
330
290
|
var getFilterDisplayValues = useCallback(function (form) {
|
331
291
|
var displayValues = getFormDisplayValues(form);
|
332
292
|
var originalData = Object.entries(displayValues);
|
333
293
|
var filterData = [];
|
334
294
|
originalData.forEach(function (_ref5) {
|
335
295
|
var _data$displayValue;
|
336
|
-
|
337
296
|
var _ref6 = _slicedToArray(_ref5, 2),
|
338
|
-
|
339
|
-
|
340
|
-
|
297
|
+
key = _ref6[0],
|
298
|
+
data = _ref6[1];
|
341
299
|
var value = (_data$displayValue = data.displayValue) !== null && _data$displayValue !== void 0 ? _data$displayValue : data.value;
|
342
300
|
var component = data.component;
|
343
|
-
|
344
301
|
if (component === 'SelectGroup') {
|
345
302
|
var _data$value;
|
346
|
-
|
347
303
|
(_data$value = data.value) === null || _data$value === void 0 ? void 0 : _data$value.forEach(function (item, index) {
|
348
304
|
filterData.push({
|
349
305
|
key: key,
|
@@ -363,24 +319,23 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
363
319
|
}
|
364
320
|
});
|
365
321
|
return filterData;
|
366
|
-
}, []);
|
367
|
-
|
322
|
+
}, []);
|
323
|
+
// 设置筛选数据
|
368
324
|
var configFilterItem = useCallback(function (form) {
|
369
325
|
filterItem.current = getFilterDisplayValues(form);
|
370
|
-
}, []);
|
371
|
-
|
326
|
+
}, []);
|
327
|
+
// 设置标签数据
|
372
328
|
var configTag = useCallback(function () {
|
373
329
|
setTagDataSource(filterItem.current);
|
374
|
-
}, []);
|
375
|
-
|
330
|
+
}, []);
|
331
|
+
// 更新标签数据
|
376
332
|
var updateTags = useCallback(function (form) {
|
377
333
|
configFilterItem(form);
|
378
334
|
configTag();
|
379
|
-
}, []);
|
380
|
-
|
335
|
+
}, []);
|
336
|
+
// 展开收起高级筛选
|
381
337
|
var toggleAdvancedFilter = useCallback(function () {
|
382
338
|
var result = !panelVisible;
|
383
|
-
|
384
339
|
if (result) {
|
385
340
|
// 展开高级筛选,Light回填Advanced
|
386
341
|
if (currentFormName.current === 'light') {
|
@@ -392,23 +347,20 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
392
347
|
// 收起高级筛选,配置标签数据
|
393
348
|
configTag();
|
394
349
|
}
|
395
|
-
|
396
350
|
setPanelVisible(result);
|
397
351
|
onExpand === null || onExpand === void 0 ? void 0 : onExpand(result);
|
398
|
-
}, [panelVisible, configTag]);
|
399
|
-
|
352
|
+
}, [panelVisible, configTag]);
|
353
|
+
// 简单搜索Filter
|
400
354
|
var onSimpleFilter = useCallback( /*#__PURE__*/function () {
|
401
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/
|
402
|
-
return
|
355
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(values) {
|
356
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
403
357
|
while (1) {
|
404
358
|
switch (_context5.prev = _context5.next) {
|
405
359
|
case 0:
|
406
360
|
_context5.next = 2;
|
407
361
|
return simpleForm.validate();
|
408
|
-
|
409
362
|
case 2:
|
410
363
|
onFilter(values);
|
411
|
-
|
412
364
|
case 3:
|
413
365
|
case "end":
|
414
366
|
return _context5.stop();
|
@@ -416,91 +368,85 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
416
368
|
}
|
417
369
|
}, _callee5);
|
418
370
|
}));
|
419
|
-
|
420
371
|
return function (_x4) {
|
421
372
|
return _ref7.apply(this, arguments);
|
422
373
|
};
|
423
|
-
}(), [onFilter]);
|
424
|
-
|
374
|
+
}(), [onFilter]);
|
375
|
+
// 简单搜索Change
|
425
376
|
var onSimpleChange = useCallback(function (values, fieldValue, fieldName) {
|
426
377
|
if (currentFormName.current === 'simple') {
|
427
378
|
onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
|
428
|
-
|
429
379
|
if (filterEnable.current === 'filter') {
|
430
380
|
debounceFun(onSimpleFilter, values);
|
431
381
|
}
|
432
382
|
}
|
433
|
-
}, [onChange, onSimpleFilter]);
|
434
|
-
|
383
|
+
}, [onChange, onSimpleFilter]);
|
384
|
+
// 轻量搜索Filter
|
435
385
|
var onLightFilter = useCallback(function (values) {
|
436
386
|
var _Object$keys;
|
437
|
-
|
438
|
-
|
439
|
-
|
387
|
+
onFilter(values);
|
388
|
+
// 清空advancedForm的值
|
440
389
|
var clearKeys = {};
|
441
390
|
(_Object$keys = Object.keys(advancedForm.values)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
|
442
391
|
clearKeys[key] = undefined;
|
443
392
|
});
|
444
393
|
advancedForm.setValues(clearKeys);
|
445
394
|
updateTags(advancedForm);
|
446
|
-
}, [onFilter]);
|
447
|
-
|
395
|
+
}, [onFilter]);
|
396
|
+
// 轻量搜索Change
|
448
397
|
var onLightChange = useCallback(function (values, fieldValue, fieldName) {
|
449
398
|
if (currentFormName.current === 'light') {
|
450
399
|
onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
|
451
|
-
|
452
400
|
if (filterEnable.current === 'filter') {
|
453
401
|
debounceFun(onLightFilter, values);
|
454
402
|
}
|
455
403
|
}
|
456
|
-
}, [onChange, onLightFilter]);
|
457
|
-
|
404
|
+
}, [onChange, onLightFilter]);
|
405
|
+
// 高级搜索Filter
|
458
406
|
var onAdvancedFilter = useCallback(function (values) {
|
459
407
|
setCurrentForm('advanced');
|
460
408
|
onFilter(values);
|
461
|
-
configFilterItem(advancedForm);
|
462
|
-
|
409
|
+
configFilterItem(advancedForm);
|
410
|
+
// 清空lightForm的值
|
463
411
|
lightForm.reset('*', {
|
464
412
|
forceClear: true
|
465
413
|
});
|
466
|
-
}, [onFilter]);
|
467
|
-
|
414
|
+
}, [onFilter]);
|
415
|
+
// 高级搜索Reset
|
468
416
|
var onAdvancedReset = useCallback(function () {
|
469
417
|
setCurrentForm('advanced');
|
470
418
|
onReset(toJS(advancedForm.values));
|
471
|
-
configFilterItem(advancedForm);
|
472
|
-
|
419
|
+
configFilterItem(advancedForm);
|
420
|
+
// 清空lightForm的值
|
473
421
|
lightForm.reset('*', {
|
474
422
|
forceClear: true
|
475
423
|
});
|
476
|
-
}, [onReset]);
|
477
|
-
|
424
|
+
}, [onReset]);
|
425
|
+
// 高级搜索Change
|
478
426
|
var onAdvancedChange = useCallback(function (values, fieldValue, fieldName) {
|
479
427
|
if (currentFormName.current === 'advanced') {
|
480
428
|
onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
|
481
429
|
}
|
482
|
-
}, [onChange]);
|
483
|
-
|
430
|
+
}, [onChange]);
|
431
|
+
// 关闭标签清空表单字段值
|
484
432
|
var onTagClose = useCallback(function (key, index) {
|
485
433
|
var newValue = undefined;
|
486
|
-
|
487
434
|
if (isNum(index)) {
|
488
435
|
newValue = _toConsumableArray(advancedForm.getValuesIn(key));
|
489
436
|
newValue.splice(index, 1);
|
490
437
|
}
|
491
|
-
|
492
438
|
advancedForm.setValuesIn(key, newValue);
|
493
439
|
updateTags(advancedForm);
|
494
440
|
onFilter(toJS(advancedForm.values));
|
495
|
-
}, [onFilter]);
|
496
|
-
|
441
|
+
}, [onFilter]);
|
442
|
+
// initialRequest 的回调
|
497
443
|
var onInitialComplete = useCallback(function (form) {
|
498
444
|
initialRequestRef.current = false;
|
499
445
|
form.setState({
|
500
446
|
loading: initialRequestRef.current
|
501
447
|
});
|
502
|
-
}, []);
|
503
|
-
|
448
|
+
}, []);
|
449
|
+
// 组件挂载
|
504
450
|
useEffect(function () {
|
505
451
|
setCurrentForm(currentFormName.current);
|
506
452
|
}, []);
|
@@ -538,10 +484,10 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
538
484
|
})) : null
|
539
485
|
}, mode === 'panel' && !panelVisible ? /*#__PURE__*/React.createElement(Tag.Group, null, tagDataSource.map(function (_ref8) {
|
540
486
|
var key = _ref8.key,
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
487
|
+
label = _ref8.label,
|
488
|
+
value = _ref8.value,
|
489
|
+
type = _ref8.type,
|
490
|
+
index = _ref8.index;
|
545
491
|
return /*#__PURE__*/React.createElement(Tag.Closeable, {
|
546
492
|
key: isNum(index) ? key + label : key,
|
547
493
|
afterClose: function afterClose() {
|