@teamix/pro 1.5.3 → 1.5.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pro.css +1 -1
- package/dist/pro.js +20239 -19807
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/dist/pro.min.js.LICENSE.txt +2 -6
- package/es/actions/base.js +8 -21
- package/es/actions/dialog-component.js +2 -9
- package/es/actions/dialog-form.js +37 -75
- package/es/actions/dialog-info.js +1 -5
- package/es/actions/dialog.js +57 -95
- package/es/actions/index.d.ts +2 -0
- package/es/actions/index.js +70 -156
- package/es/actions/link.js +3 -5
- package/es/actions/quick.js +0 -6
- package/es/actions/request.js +12 -27
- package/es/actions/utils.js +1 -9
- package/es/card/card-container.js +0 -5
- package/es/card/divider.js +0 -5
- package/es/card/index.js +56 -95
- package/es/card/selectable.js +4 -13
- package/es/card/tab.js +1 -10
- package/es/card/utils.js +0 -2
- package/es/form/Components/Editable/index.js +16 -55
- package/es/form/Components/FormGroup/index.d.ts +1 -0
- package/es/form/Components/FormGroup/index.js +7 -22
- package/es/form/Components/LightFilter/index.js +15 -35
- package/es/form/Components/ProField/index.js +2 -14
- package/es/form/Components/ProField/mapDateFormat.js +2 -28
- package/es/form/Components/Text/index.d.ts +1 -0
- package/es/form/Components/Text/index.js +2 -11
- package/es/form/Filter/AdvancedFilter.js +11 -26
- package/es/form/Filter/Layout.js +11 -24
- package/es/form/Filter/LightFilter.js +13 -24
- package/es/form/Filter/SimpleFilter.js +7 -21
- package/es/form/Filter/index.js +106 -171
- package/es/form/Filter/index2.js +11 -28
- package/es/form/Filter/useBindUrl.js +18 -46
- package/es/form/Filter/useSpecialProps.js +8 -13
- package/es/form/ProForm/addCascadeEffect.js +10 -32
- package/es/form/ProForm/customComponent.js +0 -5
- package/es/form/ProForm/index.js +23 -34
- package/es/form/ProForm/useAutoLayout.js +21 -42
- package/es/form/ProForm/useAutoSubmit.js +3 -8
- package/es/form/ProForm/useFieldRequest.js +0 -5
- package/es/form/ProForm/useFormDisplayValues.js +12 -28
- package/es/form/ProForm/useInitialRequest.js +0 -5
- package/es/form/SchemaForm/adapterComponent.js +0 -3
- package/es/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/es/form/SchemaForm/adapterDecorator.js +0 -8
- package/es/form/SchemaForm/adapterType.js +0 -2
- package/es/form/SchemaForm/index.js +78 -114
- package/es/form/SchemaForm/initializeArrayCards.js +0 -6
- package/es/form/SchemaForm/initializeArrayCollapse.js +0 -6
- package/es/form/SchemaForm/initializeArrayItems.js +2 -9
- package/es/form/SchemaForm/initializeArrayTable.js +21 -34
- package/es/form/SchemaForm/initializeDataSource.js +2 -6
- package/es/form/SchemaForm/initializeFormButton.js +14 -31
- package/es/form/SchemaForm/initializeFormCollapse.js +8 -18
- package/es/form/SchemaForm/initializeFormGroup.js +10 -20
- package/es/form/SchemaForm/initializeFormStep.js +11 -23
- package/es/form/SchemaForm/initializeFormTab.js +10 -20
- package/es/form/SchemaForm/initializeReactions.js +9 -33
- package/es/form/SchemaForm/initializeRequest.js +2 -16
- package/es/form/SchemaForm/initializeRules.js +4 -22
- package/es/form/SchemaForm/initializeSelectTable.js +7 -33
- package/es/form/SchemaForm/reactions.js +19 -34
- package/es/form/docs/ActionResponse.d.ts +1 -0
- package/es/form/index.d.ts +9 -9
- package/es/form/index.js +0 -9
- package/es/form/typing.d.ts +6 -4
- package/es/form/utils.d.ts +1 -1
- package/es/form/utils.js +4 -49
- package/es/form/warning.js +2 -7
- package/es/index-without-icon.js +4 -3
- package/es/index.d.ts +1 -1
- package/es/index.js +7 -8
- package/es/info/components/InfoGroup/index.js +21 -32
- package/es/info/components/InfoValueItem/index.js +66 -119
- package/es/info/components/ProInfoItem/index.js +13 -21
- package/es/info/components/baseInfo/index.js +14 -26
- package/es/info/components/headerInfo/index.js +8 -20
- package/es/info/components/tableInfo/index.js +20 -50
- package/es/info/index.js +53 -82
- package/es/info/utils/index.js +0 -11
- package/es/nocode/configurators/common.js +5 -6
- package/es/nocode/configurators/index.js +2 -3
- package/es/nocode/index.js +6 -6
- package/es/nocode/pages/editor.js +5 -9
- package/es/nocode/pages/index.js +4 -4
- package/es/nocode/pages/playground.js +18 -35
- package/es/nocode/pages/renderer.js +9 -42
- package/es/nocode/playground.js +10 -23
- package/es/page-header/index.d.ts +2 -2
- package/es/page-header/index.js +39 -75
- package/es/sidebar/components/sidebar-container/index.js +41 -72
- package/es/sidebar/components/tree/index.js +88 -144
- package/es/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -26
- package/es/sidebar/components/tree-node/components/IconAction/index.js +9 -35
- package/es/sidebar/components/tree-node/components/IconSwitch/index.js +12 -25
- package/es/sidebar/components/tree-node/index.js +41 -83
- package/es/sidebar/index.js +69 -94
- package/es/sidebar/utils/action-ref.js +2 -7
- package/es/sidebar/utils/index.d.ts +5 -2
- package/es/sidebar/utils/index.js +41 -98
- package/es/table/components/CardView/index.js +62 -149
- package/es/table/components/Filter/index.js +42 -83
- package/es/table/components/Layout/index.js +25 -45
- package/es/table/components/LoadMore/index.js +15 -34
- package/es/table/components/Pagination/index.js +25 -58
- package/es/table/components/QuickAction/index.js +3 -11
- package/es/table/components/ToolBar/CardSwitch.js +6 -17
- package/es/table/components/ToolBar/DensityIcon.js +18 -31
- package/es/table/components/ToolBar/FilterColumnIcon.js +50 -106
- package/es/table/components/ToolBar/FullScreenIcon.js +2 -6
- package/es/table/components/ToolBar/Fullscreen.js +19 -35
- package/es/table/components/ToolBar/RefreshIcon.js +2 -5
- package/es/table/components/ToolBar/index.js +23 -45
- package/es/table/index.js +226 -399
- package/es/table/utils/columnRender.d.ts +1 -1
- package/es/table/utils/columnRender.js +32 -76
- package/es/table/utils/genProColumnToColumn.js +5 -14
- package/es/table/utils/index.js +14 -47
- package/es/table/utils/pureColumnRender.js +21 -53
- package/es/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/es/table/utils/pureGenProColumnToColumn.js +2 -10
- package/es/table/utils/useTableSelection.js +6 -33
- package/es/templates/List/index.js +2 -9
- package/es/timeline/ProTimeLineItem/index.js +24 -64
- package/es/timeline/index.js +8 -22
- package/es/timeline/typing.d.ts +1 -0
- package/es/utils/message.d.ts +2 -2
- package/es/utils/message.js +0 -5
- package/es/utils/useRealHistory.d.ts +8 -0
- package/es/utils/useRealHistory.js +23 -0
- package/lib/actions/base.js +8 -24
- package/lib/actions/confirm.js +0 -5
- package/lib/actions/danger-confirm.js +0 -5
- package/lib/actions/danger-pop-confirm.js +0 -4
- package/lib/actions/dialog-component.js +2 -15
- package/lib/actions/dialog-form.js +36 -88
- package/lib/actions/dialog-info.js +1 -10
- package/lib/actions/dialog-table.js +0 -5
- package/lib/actions/dialog.js +55 -111
- package/lib/actions/drawer-form.js +0 -3
- package/lib/actions/drawer-info.js +0 -3
- package/lib/actions/drawer-table.js +0 -3
- package/lib/actions/drawer.js +0 -4
- package/lib/actions/error.js +0 -5
- package/lib/actions/index.d.ts +2 -0
- package/lib/actions/index.js +70 -186
- package/lib/actions/link.js +3 -10
- package/lib/actions/notice.js +0 -5
- package/lib/actions/pop-confirm.js +0 -5
- package/lib/actions/quick.js +0 -13
- package/lib/actions/request.js +10 -32
- package/lib/actions/utils.js +1 -9
- package/lib/card/card-container.js +0 -9
- package/lib/card/divider.js +0 -7
- package/lib/card/index.js +56 -122
- package/lib/card/selectable.js +4 -20
- package/lib/card/tab.js +1 -14
- package/lib/card/utils.js +0 -6
- package/lib/field/index.js +0 -6
- package/lib/form/Components/Editable/index.js +15 -65
- package/lib/form/Components/FormGroup/index.d.ts +1 -0
- package/lib/form/Components/FormGroup/index.js +7 -28
- package/lib/form/Components/LightFilter/index.js +15 -47
- package/lib/form/Components/ProField/index.js +2 -21
- package/lib/form/Components/ProField/mapDateFormat.js +2 -32
- package/lib/form/Components/Text/index.d.ts +1 -0
- package/lib/form/Components/Text/index.js +2 -16
- package/lib/form/Filter/AdvancedFilter.js +11 -34
- package/lib/form/Filter/Layout.js +11 -33
- package/lib/form/Filter/LightFilter.js +13 -32
- package/lib/form/Filter/SimpleFilter.js +5 -27
- package/lib/form/Filter/index.js +105 -191
- package/lib/form/Filter/index2.js +11 -38
- package/lib/form/Filter/useBindUrl.js +18 -50
- package/lib/form/Filter/useSpecialProps.js +6 -13
- package/lib/form/ProForm/addCascadeEffect.js +10 -35
- package/lib/form/ProForm/customComponent.js +0 -8
- package/lib/form/ProForm/index.js +23 -57
- package/lib/form/ProForm/useAutoLayout.js +21 -45
- package/lib/form/ProForm/useAutoSubmit.js +3 -10
- package/lib/form/ProForm/useFieldRequest.js +0 -8
- package/lib/form/ProForm/useFormDisplayValues.js +12 -34
- package/lib/form/ProForm/useInitialRequest.js +0 -6
- package/lib/form/SchemaForm/adapterComponent.js +0 -6
- package/lib/form/SchemaForm/adapterDecorator.d.ts +1 -1
- package/lib/form/SchemaForm/adapterDecorator.js +0 -12
- package/lib/form/SchemaForm/adapterType.js +0 -5
- package/lib/form/SchemaForm/index.js +78 -144
- package/lib/form/SchemaForm/initializeArrayCards.js +0 -7
- package/lib/form/SchemaForm/initializeArrayCollapse.js +0 -7
- package/lib/form/SchemaForm/initializeArrayItems.js +2 -10
- package/lib/form/SchemaForm/initializeArrayTable.js +21 -34
- package/lib/form/SchemaForm/initializeDataSource.js +2 -8
- package/lib/form/SchemaForm/initializeFormButton.js +14 -32
- package/lib/form/SchemaForm/initializeFormCollapse.js +8 -18
- package/lib/form/SchemaForm/initializeFormGroup.js +10 -20
- package/lib/form/SchemaForm/initializeFormStep.js +11 -23
- package/lib/form/SchemaForm/initializeFormTab.js +10 -20
- package/lib/form/SchemaForm/initializeReactions.js +9 -37
- package/lib/form/SchemaForm/initializeRequest.js +2 -18
- package/lib/form/SchemaForm/initializeRules.js +4 -24
- package/lib/form/SchemaForm/initializeSelectTable.js +7 -36
- package/lib/form/SchemaForm/reactions.js +17 -37
- package/lib/form/docs/ActionResponse.d.ts +1 -0
- package/lib/form/docs/ActionResponse.js +0 -5
- package/lib/form/index.d.ts +9 -9
- package/lib/form/index.js +0 -25
- package/lib/form/typing.d.ts +6 -4
- package/lib/form/utils.d.ts +1 -1
- package/lib/form/utils.js +4 -61
- package/lib/form/warning.js +2 -8
- package/lib/hooks/index.js +0 -5
- package/lib/index-without-icon.js +2 -36
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -39
- package/lib/info/components/InfoGroup/index.js +21 -42
- package/lib/info/components/InfoValueItem/index.js +66 -134
- package/lib/info/components/ProInfoItem/index.js +13 -29
- package/lib/info/components/baseInfo/index.js +14 -38
- package/lib/info/components/headerInfo/index.js +8 -31
- package/lib/info/components/tableInfo/index.js +20 -62
- package/lib/info/index.js +53 -97
- package/lib/info/utils/index.js +0 -19
- package/lib/info/utils/utils.js +0 -1
- package/lib/nocode/configurators/PageHeader.js +0 -2
- package/lib/nocode/configurators/ProTable.js +0 -2
- package/lib/nocode/configurators/common.js +5 -10
- package/lib/nocode/configurators/index.js +2 -10
- package/lib/nocode/configurators/map.js +0 -5
- package/lib/nocode/index.js +0 -11
- package/lib/nocode/pages/editor.js +5 -19
- package/lib/nocode/pages/index.js +2 -9
- package/lib/nocode/pages/playground.js +18 -52
- package/lib/nocode/pages/renderer.js +9 -53
- package/lib/nocode/playground.js +10 -35
- package/lib/page-container/index.js +0 -6
- package/lib/page-header/index.d.ts +2 -2
- package/lib/page-header/index.js +38 -88
- package/lib/sidebar/components/sidebar-container/index.js +41 -84
- package/lib/sidebar/components/tree/index.js +88 -158
- package/lib/sidebar/components/tree-node/components/HoverTooltip/index.js +11 -34
- package/lib/sidebar/components/tree-node/components/IconAction/index.js +9 -46
- package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +12 -35
- package/lib/sidebar/components/tree-node/index.js +41 -99
- package/lib/sidebar/index.js +69 -112
- package/lib/sidebar/utils/action-ref.js +2 -8
- package/lib/sidebar/utils/index.d.ts +5 -2
- package/lib/sidebar/utils/index.js +41 -106
- package/lib/skeleton/index.js +0 -6
- package/lib/table/components/CardView/index.js +62 -161
- package/lib/table/components/EmptyContent/index.js +0 -6
- package/lib/table/components/Filter/index.js +42 -93
- package/lib/table/components/Layout/index.js +25 -58
- package/lib/table/components/LoadMore/index.js +15 -44
- package/lib/table/components/Pagination/index.js +25 -68
- package/lib/table/components/QuickAction/index.js +3 -15
- package/lib/table/components/ToolBar/CardSwitch.js +6 -28
- package/lib/table/components/ToolBar/DensityIcon.js +18 -42
- package/lib/table/components/ToolBar/FilterColumnIcon.js +50 -118
- package/lib/table/components/ToolBar/FullScreenIcon.js +3 -13
- package/lib/table/components/ToolBar/Fullscreen.js +19 -42
- package/lib/table/components/ToolBar/RefreshIcon.js +3 -12
- package/lib/table/components/ToolBar/index.js +23 -63
- package/lib/table/index.js +226 -423
- package/lib/table/utils/columnRender.d.ts +1 -1
- package/lib/table/utils/columnRender.js +32 -89
- package/lib/table/utils/genProColumnToColumn.js +5 -19
- package/lib/table/utils/getTableProps.js +0 -2
- package/lib/table/utils/getTableSortIcons.js +0 -5
- package/lib/table/utils/index.js +12 -55
- package/lib/table/utils/pureColumnRender.js +21 -64
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +1 -1
- package/lib/table/utils/pureGenProColumnToColumn.js +2 -11
- package/lib/table/utils/useTableSelection.js +6 -35
- package/lib/templates/Detail/index.js +0 -5
- package/lib/templates/Form/index.js +0 -5
- package/lib/templates/List/index.js +2 -19
- package/lib/templates/index.js +0 -6
- package/lib/timeline/ProTimeLineItem/index.js +24 -75
- package/lib/timeline/index.js +8 -33
- package/lib/timeline/typing.d.ts +1 -0
- package/lib/utils/index.js +0 -6
- package/lib/utils/message.d.ts +2 -2
- package/lib/utils/message.js +0 -10
- package/lib/utils/useRealHistory.d.ts +8 -0
- package/lib/utils/useRealHistory.js +32 -0
- package/package.json +1 -1
@@ -1,98 +1,68 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.default = void 0;
|
9
|
-
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
11
|
-
|
12
9
|
var _icon = _interopRequireDefault(require("@teamix/icon"));
|
13
|
-
|
14
10
|
var _components = require("@alicloudfe/components");
|
15
|
-
|
16
11
|
var _utils = require("@teamix/utils");
|
17
|
-
|
18
12
|
require("./index.scss");
|
19
|
-
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
-
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
23
|
-
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
-
|
26
16
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
27
|
-
|
28
17
|
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."); }
|
29
|
-
|
30
18
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
31
|
-
|
32
19
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
33
|
-
|
34
20
|
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; }
|
35
|
-
|
36
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
37
|
-
|
38
22
|
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; }
|
39
|
-
|
40
23
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
41
|
-
|
42
24
|
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."); }
|
43
|
-
|
44
25
|
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); }
|
45
|
-
|
46
26
|
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; }
|
47
|
-
|
48
27
|
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; }
|
49
|
-
|
50
28
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
51
|
-
|
52
29
|
var CheckboxItem = _components.Menu.CheckboxItem;
|
53
30
|
var cls = (0, _utils.usePrefixCls)('teamix-pro-table-toolbar-filter');
|
54
31
|
var RadioItem = _components.Menu.RadioItem;
|
55
|
-
|
56
32
|
var Filter = function Filter(props) {
|
57
33
|
var column = props.column,
|
58
|
-
|
59
|
-
|
34
|
+
actionRef = props.actionRef,
|
35
|
+
switchCardView = props.switchCardView;
|
60
36
|
var _column$filtersWidth = column.filtersWidth,
|
61
|
-
|
62
|
-
|
37
|
+
filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth;
|
38
|
+
// 选中过滤项
|
63
39
|
var _useState = (0, _react.useState)([]),
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
41
|
+
selected = _useState2[0],
|
42
|
+
setSelected = _useState2[1];
|
68
43
|
var _useState3 = (0, _react.useState)(false),
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
45
|
+
visible = _useState4[0],
|
46
|
+
setVisible = _useState4[1];
|
73
47
|
(0, _react.useEffect)(function () {
|
74
48
|
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4, _actionRef$current$ge5;
|
75
|
-
|
76
49
|
// 从全局状态中读取上次存储的条件
|
77
50
|
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 : [];
|
78
51
|
setSelected(rules);
|
79
|
-
}, []);
|
80
|
-
|
52
|
+
}, []);
|
53
|
+
// 获取过滤项
|
81
54
|
var filters = (0, _react.useMemo)(function () {
|
82
55
|
if (Array.isArray(column.filters)) {
|
83
56
|
return column.filters;
|
84
57
|
}
|
85
|
-
|
86
|
-
|
87
|
-
|
58
|
+
var filters = column.dataSource;
|
59
|
+
// 转换 valueEnum 为 options
|
88
60
|
if (!Array.isArray(column.dataSource)) {
|
89
61
|
filters = Object.entries(column.dataSource).map(function (_ref) {
|
90
62
|
var _nv$label, _nv$color;
|
91
|
-
|
92
63
|
var _ref2 = _slicedToArray(_ref, 2),
|
93
|
-
|
94
|
-
|
95
|
-
|
64
|
+
k = _ref2[0],
|
65
|
+
v = _ref2[1];
|
96
66
|
var nv = v;
|
97
67
|
return _objectSpread(_objectSpread({
|
98
68
|
value: k
|
@@ -101,18 +71,16 @@ var Filter = function Filter(props) {
|
|
101
71
|
color: (_nv$color = nv.color) !== null && _nv$color !== void 0 ? _nv$color : k
|
102
72
|
});
|
103
73
|
});
|
104
|
-
}
|
105
|
-
|
106
|
-
|
74
|
+
}
|
75
|
+
// console.log(filters);
|
107
76
|
return filters;
|
108
|
-
}, []);
|
109
|
-
|
77
|
+
}, []);
|
78
|
+
// 渲染单选
|
110
79
|
var renderSingle = function renderSingle() {
|
111
80
|
return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref3) {
|
112
81
|
var _value$toString;
|
113
|
-
|
114
82
|
var label = _ref3.label,
|
115
|
-
|
83
|
+
value = _ref3.value;
|
116
84
|
var valueStr = (_value$toString = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString !== void 0 ? _value$toString : '';
|
117
85
|
return /*#__PURE__*/_react.default.createElement(RadioItem, {
|
118
86
|
id: valueStr,
|
@@ -123,15 +91,13 @@ var Filter = function Filter(props) {
|
|
123
91
|
}
|
124
92
|
}, label);
|
125
93
|
});
|
126
|
-
};
|
127
|
-
|
128
|
-
|
94
|
+
};
|
95
|
+
// 渲染多选
|
129
96
|
var renderMultiple = function renderMultiple() {
|
130
97
|
return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref4) {
|
131
98
|
var _value$toString2;
|
132
|
-
|
133
99
|
var label = _ref4.label,
|
134
|
-
|
100
|
+
value = _ref4.value;
|
135
101
|
var valueStr = (_value$toString2 = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString2 !== void 0 ? _value$toString2 : '';
|
136
102
|
return /*#__PURE__*/_react.default.createElement(CheckboxItem, {
|
137
103
|
key: valueStr,
|
@@ -147,17 +113,14 @@ var Filter = function Filter(props) {
|
|
147
113
|
}
|
148
114
|
}, label);
|
149
115
|
});
|
150
|
-
};
|
151
|
-
|
152
|
-
|
116
|
+
};
|
117
|
+
// 渲染选择区域
|
153
118
|
var renderSelect = function renderSelect() {
|
154
119
|
if (column.filterMode === 'multiple') {
|
155
120
|
return renderMultiple();
|
156
121
|
}
|
157
|
-
|
158
122
|
return renderSingle();
|
159
123
|
};
|
160
|
-
|
161
124
|
return /*#__PURE__*/_react.default.createElement(_components.Dropdown, {
|
162
125
|
trigger: /*#__PURE__*/_react.default.createElement(_icon.default, {
|
163
126
|
size: "small",
|
@@ -193,43 +156,35 @@ var Filter = function Filter(props) {
|
|
193
156
|
}),
|
194
157
|
onClick: function onClick() {
|
195
158
|
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;
|
196
|
-
|
197
|
-
|
198
|
-
|
159
|
+
(_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);
|
160
|
+
// 先获取此列的param
|
199
161
|
var param = '';
|
200
|
-
|
201
162
|
if (column.beforeFilter) {
|
202
163
|
var _column$beforeFilter;
|
203
|
-
|
204
164
|
param = (_column$beforeFilter = column.beforeFilter) === null || _column$beforeFilter === void 0 ? void 0 : _column$beforeFilter.call(column, selected);
|
205
165
|
} else {
|
206
166
|
param = selected.join(',');
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
167
|
+
}
|
168
|
+
// 需要带上其他所有的信息
|
169
|
+
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 : {};
|
170
|
+
// 再设置所有的列筛选状态
|
212
171
|
(_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, {
|
213
172
|
rules: selected,
|
214
173
|
params: param
|
215
174
|
})));
|
216
175
|
var targetPageKey = 'currentPage';
|
217
176
|
var pageInfo = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : _actionRef$current5.pageInfo;
|
218
|
-
|
219
177
|
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
220
178
|
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
221
179
|
}
|
222
|
-
|
223
180
|
if (switchCardView === 'card') {
|
224
181
|
var _actionRef$current6, _actionRef$current6$s;
|
225
|
-
|
226
182
|
(_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, []);
|
227
|
-
}
|
228
|
-
|
229
|
-
|
183
|
+
}
|
184
|
+
// 发送请求
|
230
185
|
(_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));
|
231
|
-
(_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);
|
232
|
-
|
186
|
+
(_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);
|
187
|
+
// 清空表格选择
|
233
188
|
(_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);
|
234
189
|
setVisible(false);
|
235
190
|
}
|
@@ -241,7 +196,6 @@ var Filter = function Filter(props) {
|
|
241
196
|
}),
|
242
197
|
onClick: function onClick() {
|
243
198
|
var _actionRef$current$ge7, _actionRef$current10, _actionRef$current10$, _actionRef$current10$2, _actionRef$current11, _actionRef$current11$, _actionRef$current12, _actionRef$current12$;
|
244
|
-
|
245
199
|
setSelected([]);
|
246
200
|
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 : {};
|
247
201
|
(_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, {
|
@@ -249,27 +203,22 @@ var Filter = function Filter(props) {
|
|
249
203
|
params: ''
|
250
204
|
})));
|
251
205
|
(_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);
|
252
|
-
|
253
206
|
if (selected.length > 0) {
|
254
207
|
var _actionRef$current13, _actionRef$current14, _actionRef$current14$, _actionRef$current15, _actionRef$current15$, _actionRef$current16, _actionRef$current16$;
|
255
|
-
|
256
208
|
var targetPageKey = 'currentPage';
|
257
209
|
var pageInfo = (_actionRef$current13 = actionRef.current) === null || _actionRef$current13 === void 0 ? void 0 : _actionRef$current13.pageInfo;
|
258
|
-
|
259
210
|
if (pageInfo && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey)) {
|
260
211
|
targetPageKey = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.targetPageKey;
|
261
|
-
}
|
262
|
-
|
263
|
-
|
212
|
+
}
|
213
|
+
// 发送请求
|
264
214
|
(_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));
|
265
|
-
(_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);
|
266
|
-
|
215
|
+
(_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);
|
216
|
+
// 清空表格选择
|
267
217
|
(_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);
|
268
|
-
}
|
269
|
-
|
218
|
+
}
|
219
|
+
// setVisible(!visible);
|
270
220
|
}
|
271
221
|
}, (0, _utils.getMessage)('reset'))))));
|
272
222
|
};
|
273
|
-
|
274
223
|
var _default = Filter;
|
275
224
|
exports.default = _default;
|
@@ -4,73 +4,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
|
10
8
|
var _utils = require("@teamix/utils");
|
11
|
-
|
12
9
|
var _field = require("../../../field");
|
13
|
-
|
14
10
|
var _actions = require("../../../actions");
|
15
|
-
|
16
11
|
var _form = require("../../../form");
|
17
|
-
|
18
12
|
var _ToolBar = _interopRequireDefault(require("../ToolBar"));
|
19
|
-
|
20
13
|
var _QuickAction = _interopRequireDefault(require("../QuickAction"));
|
21
|
-
|
22
14
|
require("./index.scss");
|
23
|
-
|
24
15
|
var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar", "dataTeamixSpm"];
|
25
|
-
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
27
|
-
|
28
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
29
|
-
|
30
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
31
|
-
|
32
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
33
|
-
|
34
20
|
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; }
|
35
|
-
|
36
21
|
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; }
|
37
|
-
|
38
22
|
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); }
|
39
|
-
|
40
23
|
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; }
|
41
|
-
|
42
24
|
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; }
|
43
|
-
|
44
25
|
var cls = (0, _utils.usePrefixCls)('teamix-pro-table-layout');
|
45
|
-
|
46
26
|
var Layout = function Layout(props) {
|
47
27
|
var header = props.header,
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
28
|
+
mainAction = props.mainAction,
|
29
|
+
extra = props.extra,
|
30
|
+
actionRef = props.actionRef,
|
31
|
+
dataFilter = props.dataFilter,
|
32
|
+
dataFilterFormRef = props.dataFilterFormRef,
|
33
|
+
afterDataFilter = props.afterDataFilter,
|
34
|
+
rowSelection = props.rowSelection,
|
35
|
+
toolBar = props.toolBar,
|
36
|
+
dataTeamixSpm = props.dataTeamixSpm,
|
37
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
38
|
+
// 渲染主操作区
|
60
39
|
var renderMainAction = function renderMainAction() {
|
61
40
|
var _mainAction$actions;
|
62
|
-
|
63
41
|
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) {
|
64
42
|
// 判断 actions 是否 visible 都为 false,是的话也不渲染
|
65
43
|
var isEmptyActions = mainAction === null || mainAction === void 0 ? void 0 : mainAction.actions.every(function (action) {
|
66
44
|
return (action === null || action === void 0 ? void 0 : action.visible) === false;
|
67
45
|
});
|
68
|
-
|
69
46
|
if (isEmptyActions) {
|
70
47
|
return;
|
71
|
-
}
|
72
|
-
|
73
|
-
|
48
|
+
}
|
49
|
+
// 默认 context
|
74
50
|
var defaultContext = {
|
75
51
|
action: actionRef.current,
|
76
52
|
rowSelection: rowSelection
|
@@ -82,9 +58,8 @@ var Layout = function Layout(props) {
|
|
82
58
|
"data-teamix-spm": dataTeamixSpm ? "".concat(dataTeamixSpm, "-mainAction") : undefined
|
83
59
|
})));
|
84
60
|
} else return mainAction;
|
85
|
-
};
|
86
|
-
|
87
|
-
|
61
|
+
};
|
62
|
+
// 渲染 addonAfter
|
88
63
|
var renderAddonAfter = function renderAddonAfter() {
|
89
64
|
return /*#__PURE__*/_react.default.createElement("div", {
|
90
65
|
className: cls('addon-after-wrapper')
|
@@ -96,15 +71,12 @@ var Layout = function Layout(props) {
|
|
96
71
|
actionRef: actionRef,
|
97
72
|
toolBar: toolBar
|
98
73
|
}, otherProps)));
|
99
|
-
};
|
100
|
-
|
101
|
-
|
74
|
+
};
|
75
|
+
// 渲染新版 QueryFilter
|
102
76
|
var renderQueryFilter = function renderQueryFilter() {
|
103
77
|
var _dataFilter$schema;
|
104
|
-
|
105
78
|
if (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) {
|
106
79
|
var _dataFilter$schema2;
|
107
|
-
|
108
80
|
if ( /*#__PURE__*/(0, _react.isValidElement)(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content)) {
|
109
81
|
// 自定义渲染内容
|
110
82
|
return /*#__PURE__*/_react.default.createElement(_form.QueryFilterLayout, _objectSpread({
|
@@ -112,11 +84,12 @@ var Layout = function Layout(props) {
|
|
112
84
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
113
85
|
setTimeout(function () {
|
114
86
|
var _actionRef$current, _actionRef$current$re;
|
115
|
-
|
116
87
|
// if (actionRef.current?.getState?.().fullScreenState) {
|
117
88
|
// 偏移量8像素为面板展开后的下margin
|
118
|
-
(_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);
|
89
|
+
(_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);
|
90
|
+
// }
|
119
91
|
});
|
92
|
+
|
120
93
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
121
94
|
},
|
122
95
|
panelContent: dataFilter.content,
|
@@ -130,11 +103,12 @@ var Layout = function Layout(props) {
|
|
130
103
|
// 全屏模式下展开收起过滤器需要重新计算tableMaxHeight
|
131
104
|
setTimeout(function () {
|
132
105
|
var _actionRef$current2, _actionRef$current2$r;
|
133
|
-
|
134
106
|
// if (actionRef.current?.getState?.().fullScreenState) {
|
135
107
|
// 偏移量8像素为面板展开后的下margin
|
136
|
-
(_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);
|
108
|
+
(_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);
|
109
|
+
// }
|
137
110
|
});
|
111
|
+
|
138
112
|
(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand) && (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.onExpand(expand));
|
139
113
|
},
|
140
114
|
addonBefore: renderMainAction(),
|
@@ -160,9 +134,8 @@ var Layout = function Layout(props) {
|
|
160
134
|
}, afterDataFilter) : null
|
161
135
|
}));
|
162
136
|
}
|
163
|
-
};
|
164
|
-
|
165
|
-
|
137
|
+
};
|
138
|
+
// 区域组合渲染
|
166
139
|
var renderLayout = function renderLayout() {
|
167
140
|
if (header && mainAction) {
|
168
141
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
@@ -178,7 +151,6 @@ var Layout = function Layout(props) {
|
|
178
151
|
}))), renderQueryFilter());
|
179
152
|
} else if (header && !mainAction) {
|
180
153
|
var _dataFilter$schema3, _dataFilter$schema4;
|
181
|
-
|
182
154
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
183
155
|
className: cls('wrapper')
|
184
156
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
@@ -196,20 +168,15 @@ var Layout = function Layout(props) {
|
|
196
168
|
if (!dataFilterFormRef && !extra) {
|
197
169
|
return null;
|
198
170
|
}
|
199
|
-
|
200
171
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderQueryFilter());
|
201
172
|
}
|
202
173
|
};
|
203
|
-
|
204
174
|
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) || mainAction || header || extra || toolBar !== false) {
|
205
175
|
return /*#__PURE__*/_react.default.createElement("div", {
|
206
176
|
className: cls()
|
207
177
|
}, renderLayout());
|
208
178
|
}
|
209
|
-
|
210
179
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
211
180
|
};
|
212
|
-
|
213
181
|
var _default = /*#__PURE__*/_react.default.memo(Layout);
|
214
|
-
|
215
182
|
exports.default = _default;
|
@@ -1,67 +1,46 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.default = void 0;
|
9
|
-
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
11
|
-
|
12
9
|
var _utils = require("@teamix/utils");
|
13
|
-
|
14
10
|
require("./index.scss");
|
15
|
-
|
16
11
|
var _icon = _interopRequireDefault(require("@teamix/icon"));
|
17
|
-
|
18
12
|
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
19
|
-
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
-
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
23
|
-
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
-
|
26
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
27
|
-
|
28
17
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
29
|
-
|
30
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
31
|
-
|
32
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
33
|
-
|
34
20
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
35
|
-
|
36
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
37
|
-
|
38
22
|
var cls = (0, _utils.usePrefixCls)('teamix-pro-load-more');
|
39
|
-
|
40
23
|
var LoadMore = function LoadMore(props) {
|
41
24
|
var children = props.children,
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
var scrollDom = (0, _react.useRef)(null);
|
49
|
-
|
25
|
+
onChangeLoadState = props.onChangeLoadState,
|
26
|
+
onLoadMore = props.onLoadMore,
|
27
|
+
scrollHeight = props.scrollHeight,
|
28
|
+
onScrollBottom = props.onScrollBottom,
|
29
|
+
loadStateProp = props.loadState,
|
30
|
+
scrollPositionProp = props.scrollPosition;
|
31
|
+
var scrollDom = (0, _react.useRef)(null);
|
32
|
+
// 加载状态
|
50
33
|
var _useState = (0, _react.useState)('loadMore'),
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
35
|
+
loadState = _useState2[0],
|
36
|
+
setLoadState = _useState2[1];
|
55
37
|
(0, _react.useEffect)(function () {
|
56
38
|
var _scrollDom$current;
|
57
|
-
|
58
39
|
scrollDom === null || scrollDom === void 0 ? void 0 : (_scrollDom$current = scrollDom.current) === null || _scrollDom$current === void 0 ? void 0 : _scrollDom$current.addEventListener('scroll', (0, _lodash.default)(function (e) {
|
59
40
|
var _e$target, _e$target2, _e$target3;
|
60
|
-
|
61
41
|
var scrollTop = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.scrollTop;
|
62
42
|
var clientHeight = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.clientHeight;
|
63
43
|
var scrollHeight = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.scrollHeight;
|
64
|
-
|
65
44
|
if (scrollTop + clientHeight + 5 >= scrollHeight) {
|
66
45
|
onScrollBottom === null || onScrollBottom === void 0 ? void 0 : onScrollBottom();
|
67
46
|
}
|
@@ -69,19 +48,16 @@ var LoadMore = function LoadMore(props) {
|
|
69
48
|
}, []);
|
70
49
|
(0, _react.useEffect)(function () {
|
71
50
|
setLoadState(loadStateProp);
|
72
|
-
}, [loadStateProp]);
|
73
|
-
|
51
|
+
}, [loadStateProp]);
|
52
|
+
// 更改加载状态
|
74
53
|
var onLoadState = function onLoadState(state) {
|
75
54
|
setLoadState(state);
|
76
|
-
|
77
55
|
if (state === 'loading') {
|
78
56
|
onLoadMore === null || onLoadMore === void 0 ? void 0 : onLoadMore();
|
79
57
|
}
|
80
|
-
|
81
58
|
onChangeLoadState === null || onChangeLoadState === void 0 ? void 0 : onChangeLoadState(state);
|
82
|
-
};
|
83
|
-
|
84
|
-
|
59
|
+
};
|
60
|
+
// 渲染加载更多和正在加载区域
|
85
61
|
var renderLoadMore = function renderLoadMore() {
|
86
62
|
if (loadState === 'loadMore') {
|
87
63
|
return /*#__PURE__*/_react.default.createElement("div", {
|
@@ -95,7 +71,6 @@ var LoadMore = function LoadMore(props) {
|
|
95
71
|
className: cls('bottom-text-icon')
|
96
72
|
}), "\u52A0\u8F7D\u66F4\u591A");
|
97
73
|
}
|
98
|
-
|
99
74
|
if (loadState === 'loading') {
|
100
75
|
return /*#__PURE__*/_react.default.createElement("div", {
|
101
76
|
className: cls('bottom-text')
|
@@ -105,16 +80,13 @@ var LoadMore = function LoadMore(props) {
|
|
105
80
|
className: cls('bottom-text-icon')
|
106
81
|
}), "\u52A0\u8F7D\u4E2D");
|
107
82
|
}
|
108
|
-
|
109
83
|
if (loadState === 'noMore') {
|
110
84
|
return /*#__PURE__*/_react.default.createElement("div", {
|
111
85
|
className: cls('bottom-text')
|
112
86
|
}, "\u6CA1\u6709\u66F4\u591A\u4E86");
|
113
87
|
}
|
114
|
-
|
115
88
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
116
89
|
};
|
117
|
-
|
118
90
|
return /*#__PURE__*/_react.default.createElement("div", {
|
119
91
|
className: cls(),
|
120
92
|
style: {
|
@@ -123,6 +95,5 @@ var LoadMore = function LoadMore(props) {
|
|
123
95
|
ref: scrollDom
|
124
96
|
}, children, renderLoadMore());
|
125
97
|
};
|
126
|
-
|
127
98
|
var _default = LoadMore;
|
128
99
|
exports.default = _default;
|