@teamix/pro 1.2.4 → 1.2.8
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/212.js +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +1182 -512
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-component.js +2 -1
- package/es/actions/dialog-form.js +2 -1
- package/es/actions/dialog.js +2 -1
- package/es/actions/index.js +3 -2
- package/es/actions/index.scss +3 -0
- package/es/actions/utils.d.ts +1 -0
- package/es/actions/utils.js +27 -0
- package/es/card/card-container.d.ts +18 -0
- package/es/card/card-container.js +24 -0
- package/es/card/divider.d.ts +6 -0
- package/es/card/divider.js +16 -0
- package/es/card/index.d.ts +68 -32
- package/es/card/index.js +194 -107
- package/es/card/index.scss +174 -9
- package/es/card/selectable.d.ts +13 -0
- package/es/card/selectable.js +45 -0
- package/es/card/utils.d.ts +9 -0
- package/es/card/utils.js +30 -0
- package/es/form/Components/ProField/index.js +2 -7
- package/es/form/Filter/index.js +5 -5
- package/es/form/ProForm/index.js +43 -17
- package/es/form/ProForm/index.scss +0 -1
- package/es/form/ProForm/useAutoSubmit.d.ts +1 -1
- package/es/form/ProForm/useAutoSubmit.js +3 -3
- package/es/form/ProForm/useInitialRequest.d.ts +1 -1
- package/es/form/ProForm/useInitialRequest.js +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +1 -1
- package/es/form/SchemaForm/initializeFormButton.js +3 -2
- package/es/form/SchemaForm/initializeRequest.js +6 -3
- package/es/form/SchemaForm/initializeRules.js +1 -1
- package/es/form/SchemaForm/reactions.d.ts +5 -4
- package/es/form/SchemaForm/reactions.js +20 -11
- package/es/form/locales/validate.d.ts +159 -0
- package/es/form/locales/validate.js +158 -0
- package/es/form/typing.d.ts +4 -3
- package/es/index.d.ts +1 -1
- package/es/index.js +7 -4
- package/es/info/components/InfoGroup/index.js +5 -2
- package/es/info/components/InfoValueItem/index.js +4 -6
- package/es/info/components/baseInfo/index.js +4 -2
- package/es/info/components/tableInfo/index.js +10 -6
- package/es/info/index.js +25 -11
- package/es/info/typing.d.ts +6 -0
- package/es/nocode/configurators/Card.js +39 -12
- package/es/sidebar/components/sidebar-container/index.d.ts +5 -0
- package/es/sidebar/components/sidebar-container/index.js +77 -0
- package/es/sidebar/components/sidebar-container/index.scss +18 -0
- package/es/sidebar/components/tree/index.d.ts +4 -0
- package/es/sidebar/components/tree/index.js +95 -0
- package/es/sidebar/index.d.ts +5 -0
- package/es/sidebar/index.js +66 -0
- package/es/sidebar/index.scss +3 -0
- package/es/sidebar/typing.d.ts +51 -0
- package/es/sidebar/typing.js +1 -0
- package/es/table/components/Layout/index.js +1 -1
- package/es/table/components/ToolBar/FilterColumnIcon.js +2 -24
- package/es/table/components/ToolBar/index.scss +0 -3
- package/es/table/index.js +26 -9
- package/es/table/index.scss +1 -0
- package/es/table/typing.d.ts +6 -4
- package/lib/actions/dialog-component.js +3 -1
- package/lib/actions/dialog-form.js +3 -1
- package/lib/actions/dialog.js +3 -1
- package/lib/actions/index.js +3 -2
- package/lib/actions/index.scss +3 -0
- package/lib/actions/utils.d.ts +1 -0
- package/lib/actions/utils.js +33 -0
- package/lib/card/card-container.d.ts +18 -0
- package/lib/card/card-container.js +37 -0
- package/lib/card/divider.d.ts +6 -0
- package/lib/card/divider.js +26 -0
- package/lib/card/index.d.ts +68 -32
- package/lib/card/index.js +215 -110
- package/lib/card/index.scss +174 -9
- package/lib/card/selectable.d.ts +13 -0
- package/lib/card/selectable.js +60 -0
- package/lib/card/utils.d.ts +9 -0
- package/lib/card/utils.js +41 -0
- package/lib/form/Components/ProField/index.js +1 -6
- package/lib/form/Filter/index.js +5 -6
- package/lib/form/ProForm/index.js +41 -14
- package/lib/form/ProForm/index.scss +0 -1
- package/lib/form/ProForm/useAutoSubmit.d.ts +1 -1
- package/lib/form/ProForm/useAutoSubmit.js +3 -3
- package/lib/form/ProForm/useInitialRequest.d.ts +1 -1
- package/lib/form/ProForm/useInitialRequest.js +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +1 -1
- package/lib/form/SchemaForm/initializeFormButton.js +5 -2
- package/lib/form/SchemaForm/initializeRequest.js +5 -2
- package/lib/form/SchemaForm/initializeRules.js +1 -1
- package/lib/form/SchemaForm/reactions.d.ts +5 -4
- package/lib/form/SchemaForm/reactions.js +23 -12
- package/lib/form/locales/validate.d.ts +159 -0
- package/lib/form/locales/validate.js +165 -0
- package/lib/form/typing.d.ts +4 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -1
- package/lib/info/components/InfoGroup/index.js +5 -2
- package/lib/info/components/InfoValueItem/index.js +4 -6
- package/lib/info/components/baseInfo/index.js +4 -2
- package/lib/info/components/tableInfo/index.js +10 -6
- package/lib/info/index.js +24 -10
- package/lib/info/typing.d.ts +6 -0
- package/lib/nocode/configurators/Card.js +39 -12
- package/lib/sidebar/components/sidebar-container/index.d.ts +5 -0
- package/lib/sidebar/components/sidebar-container/index.js +93 -0
- package/lib/sidebar/components/sidebar-container/index.scss +18 -0
- package/lib/sidebar/components/tree/index.d.ts +4 -0
- package/lib/sidebar/components/tree/index.js +112 -0
- package/lib/sidebar/index.d.ts +5 -0
- package/lib/sidebar/index.js +87 -0
- package/lib/sidebar/index.scss +3 -0
- package/lib/sidebar/typing.d.ts +51 -0
- package/lib/sidebar/typing.js +5 -0
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/components/ToolBar/FilterColumnIcon.js +2 -24
- package/lib/table/components/ToolBar/index.scss +0 -3
- package/lib/table/index.js +27 -9
- package/lib/table/index.scss +1 -0
- package/lib/table/typing.d.ts +6 -4
- package/package.json +4 -4
@@ -0,0 +1,95 @@
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
+
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
6
|
+
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
8
|
+
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
10
|
+
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
12
|
+
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
14
|
+
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
16
|
+
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
18
|
+
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
20
|
+
|
21
|
+
import { Tree } from '@alicloudfe/components';
|
22
|
+
import { baseClass } from '@teamix/utils';
|
23
|
+
import React, { useEffect, useState } from 'react';
|
24
|
+
var cls = baseClass('teamix-pro-sidebar-tree');
|
25
|
+
|
26
|
+
var ProSidebarTree = function ProSidebarTree(props) {
|
27
|
+
var dataSourceProp = props.dataSource,
|
28
|
+
searchKey = props.searchKey; // 自动展开父节点。过滤时用
|
29
|
+
|
30
|
+
var _useState = useState(),
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
32
|
+
matchedKeys = _useState2[0],
|
33
|
+
setMatchedKeys = _useState2[1];
|
34
|
+
|
35
|
+
var _useState3 = useState(),
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
37
|
+
expandedKeys = _useState4[0],
|
38
|
+
setExpandedKeys = _useState4[1];
|
39
|
+
|
40
|
+
var _useState5 = useState(dataSourceProp !== null && dataSourceProp !== void 0 ? dataSourceProp : []),
|
41
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
42
|
+
dataSource = _useState6[0],
|
43
|
+
setDataSource = _useState6[1];
|
44
|
+
|
45
|
+
useEffect(function () {
|
46
|
+
filterDataSource(searchKey !== null && searchKey !== void 0 ? searchKey : '');
|
47
|
+
}, [searchKey]); // 过滤
|
48
|
+
|
49
|
+
var filterDataSource = function filterDataSource(value) {
|
50
|
+
value = value.trim();
|
51
|
+
var matchedKeys = [];
|
52
|
+
|
53
|
+
if (!value) {
|
54
|
+
matchedKeys = [];
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
|
58
|
+
var loop = function loop(data) {
|
59
|
+
return data.forEach(function (item) {
|
60
|
+
if (item.label.indexOf(value) > -1) {
|
61
|
+
matchedKeys.push(item.key);
|
62
|
+
}
|
63
|
+
|
64
|
+
if (item.children && item.children.length) {
|
65
|
+
loop(item.children);
|
66
|
+
}
|
67
|
+
});
|
68
|
+
};
|
69
|
+
|
70
|
+
loop(dataSource);
|
71
|
+
setExpandedKeys(_toConsumableArray(matchedKeys));
|
72
|
+
setMatchedKeys(matchedKeys);
|
73
|
+
};
|
74
|
+
|
75
|
+
var filterTreeNode = function filterTreeNode(node) {
|
76
|
+
return matchedKeys && matchedKeys.indexOf(node.props.eventKey) > -1;
|
77
|
+
};
|
78
|
+
|
79
|
+
return /*#__PURE__*/React.createElement("div", {
|
80
|
+
className: cls()
|
81
|
+
}, /*#__PURE__*/React.createElement(Tree, {
|
82
|
+
draggable: true,
|
83
|
+
defaultExpandAll: true,
|
84
|
+
isLabelBlock: true,
|
85
|
+
isNodeBlock: {
|
86
|
+
defaultPaddingLeft: 8,
|
87
|
+
indent: 16
|
88
|
+
},
|
89
|
+
dataSource: dataSource,
|
90
|
+
filterTreeNode: filterTreeNode,
|
91
|
+
expandedKeys: expandedKeys
|
92
|
+
}));
|
93
|
+
};
|
94
|
+
|
95
|
+
export default ProSidebarTree;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
var _excluded = ["dataSource", "className", "style", "searchOnChange", "showSearch"];
|
2
|
+
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
4
|
+
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6
|
+
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
8
|
+
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
10
|
+
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
12
|
+
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
14
|
+
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
16
|
+
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
18
|
+
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
20
|
+
|
21
|
+
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; }
|
22
|
+
|
23
|
+
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; }
|
24
|
+
|
25
|
+
import React, { useState } from 'react';
|
26
|
+
import './index.scss';
|
27
|
+
import { baseClass } from '@teamix/utils';
|
28
|
+
import ProSidebarContainer from './components/sidebar-container';
|
29
|
+
import ProSidebarTree from './components/tree';
|
30
|
+
var cls = baseClass('teamix-pro-sidebar');
|
31
|
+
|
32
|
+
var ProSidebar = function ProSidebar(props) {
|
33
|
+
var dataSource = props.dataSource,
|
34
|
+
className = props.className,
|
35
|
+
style = props.style,
|
36
|
+
_searchOnChange = props.searchOnChange,
|
37
|
+
_props$showSearch = props.showSearch,
|
38
|
+
showSearch = _props$showSearch === void 0 ? true : _props$showSearch,
|
39
|
+
others = _objectWithoutProperties(props, _excluded); // 搜索的关键词
|
40
|
+
|
41
|
+
|
42
|
+
var _useState = useState(),
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
44
|
+
searchKey = _useState2[0],
|
45
|
+
setSearchKey = _useState2[1];
|
46
|
+
|
47
|
+
return /*#__PURE__*/React.createElement("div", {
|
48
|
+
className: cls(_defineProperty({
|
49
|
+
'': true
|
50
|
+
}, className, true)),
|
51
|
+
style: style
|
52
|
+
}, /*#__PURE__*/React.createElement(ProSidebarContainer, _objectSpread({
|
53
|
+
searchOnChange: function searchOnChange(value) {
|
54
|
+
if (showSearch) {
|
55
|
+
_searchOnChange === null || _searchOnChange === void 0 ? void 0 : _searchOnChange(value);
|
56
|
+
setSearchKey(value);
|
57
|
+
}
|
58
|
+
},
|
59
|
+
showSearch: showSearch
|
60
|
+
}, others), /*#__PURE__*/React.createElement(ProSidebarTree, {
|
61
|
+
dataSource: dataSource,
|
62
|
+
searchKey: searchKey
|
63
|
+
})));
|
64
|
+
};
|
65
|
+
|
66
|
+
export default ProSidebar;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { MessageProps } from '@alifd/next/types/message';
|
3
|
+
import { TreeProps } from '@alifd/next/types/tree';
|
4
|
+
import { ProCardProps, ProFieldProps } from '..';
|
5
|
+
/** ProSidebar 定义 */
|
6
|
+
export declare type ProSidebarProps = {
|
7
|
+
/** 数据源 */
|
8
|
+
dataSource?: ProSidebarDataSource;
|
9
|
+
} & React.HTMLAttributes<HTMLElement> & ProSidebarContainerProps;
|
10
|
+
/** 数据源定义 */
|
11
|
+
export declare type ProSidebarDataSource = ProSidebarDataSourceItem[];
|
12
|
+
export declare type ProSidebarDataSourceItem = {
|
13
|
+
/** 展示值 */
|
14
|
+
label?: React.ReactNode;
|
15
|
+
/** 绑定值 */
|
16
|
+
value?: any;
|
17
|
+
/** icon */
|
18
|
+
icon?: React.ReactNode;
|
19
|
+
/** 标签 */
|
20
|
+
tag?: React.ReactNode;
|
21
|
+
/** 右侧操作、状态区 */
|
22
|
+
extra?: React.ReactNode;
|
23
|
+
/** 子项 */
|
24
|
+
children?: ProSidebarDataSourceItem[];
|
25
|
+
};
|
26
|
+
/** sidebar 容器定义 */
|
27
|
+
export declare type ProSidebarContainerProps = {
|
28
|
+
children?: React.ReactNode;
|
29
|
+
/** 搜索输入提示 */
|
30
|
+
searchPlaceholder?: string;
|
31
|
+
/** 搜索输入其他参数 ProField 参数 */
|
32
|
+
searchProps?: ProFieldProps;
|
33
|
+
/** 是否展示搜索框 */
|
34
|
+
showSearch?: boolean;
|
35
|
+
/** 自定义搜索 */
|
36
|
+
customSearch?: React.ReactNode;
|
37
|
+
/** 搜索框变化的回调函数 */
|
38
|
+
searchOnChange?: (value: any) => void;
|
39
|
+
/** 通知提示消息区域 */
|
40
|
+
message?: React.ReactNode;
|
41
|
+
/** 自定义消息通知区域 */
|
42
|
+
customMessage?: React.ReactNode;
|
43
|
+
/** 消息通知区域的其他参数 */
|
44
|
+
messageProps?: MessageProps;
|
45
|
+
} & ProCardProps;
|
46
|
+
/** ProSidebarTree 内容定义 */
|
47
|
+
export declare type ProSidebarTreeProps = {
|
48
|
+
dataSource?: ProSidebarDataSource;
|
49
|
+
/** 搜索过滤关键词 */
|
50
|
+
searchKey?: string;
|
51
|
+
} & TreeProps;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -100,7 +100,7 @@ var Layout = function Layout(props) {
|
|
100
100
|
var renderPanelFilter = function renderPanelFilter() {
|
101
101
|
var _dataFilter$schema2;
|
102
102
|
|
103
|
-
if (dataFilter && (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length)
|
103
|
+
if (dataFilter && (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
|
104
104
|
return /*#__PURE__*/React.createElement("div", {
|
105
105
|
className: cls('panel-filter'),
|
106
106
|
style: {
|
@@ -78,27 +78,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
78
78
|
|
79
79
|
useEffect(function () {
|
80
80
|
setNewColumns(processColumns(columns));
|
81
|
-
}, [columns]); //
|
82
|
-
// console.log("这个函数被触发");
|
83
|
-
// setTimeout(() => {
|
84
|
-
// setFullscreen(actionRef?.current?.getState?.().fullScreenState ?? false);
|
85
|
-
// }, 0)
|
86
|
-
// }, [])
|
87
|
-
// // 销毁监听函数
|
88
|
-
// useEffect(() => {
|
89
|
-
// return () => {
|
90
|
-
// actionRef.current?.off?.('filterColumnIcon');
|
91
|
-
// };
|
92
|
-
// }, []);
|
93
|
-
// // 监听全屏变化
|
94
|
-
// actionRef.current?.on?.(
|
95
|
-
// (state: boolean) => {
|
96
|
-
// setFullscreen(state);
|
97
|
-
// },
|
98
|
-
// 'fullScreenState',
|
99
|
-
// 'filterColumnIcon',
|
100
|
-
// );
|
101
|
-
// 全选
|
81
|
+
}, [columns]); // 全选
|
102
82
|
|
103
83
|
var onChangeAllColumns = function onChangeAllColumns(check) {
|
104
84
|
setAllVisible(check);
|
@@ -297,9 +277,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
297
277
|
onOk: onChangeColumnsForDialog,
|
298
278
|
onCancel: dialogOnClose,
|
299
279
|
onClose: dialogOnClose,
|
300
|
-
|
301
|
-
width: '440px'
|
302
|
-
}
|
280
|
+
width: 480
|
303
281
|
}, /*#__PURE__*/React.createElement(Row, {
|
304
282
|
gutter: 20,
|
305
283
|
wrap: true,
|
package/es/table/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest"];
|
1
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest"];
|
2
2
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
4
|
|
@@ -49,6 +49,7 @@ import { createForm, formilyReactive } from '../form';
|
|
49
49
|
import { ProActionGroup } from '../actions';
|
50
50
|
import debounce from 'lodash.debounce';
|
51
51
|
import classNames from 'classnames';
|
52
|
+
import ProPageContainer from '../page-container';
|
52
53
|
export * from './typing';
|
53
54
|
var cls = baseClass('teamix-pro-table');
|
54
55
|
var toJS = formilyReactive.toJS;
|
@@ -96,6 +97,7 @@ var ProTable = function ProTable(props) {
|
|
96
97
|
getRowSelection = props.getRowSelection,
|
97
98
|
primaryKey = props.primaryKey,
|
98
99
|
footerAction = props.footerAction,
|
100
|
+
footer = props.footer,
|
99
101
|
url = props.url,
|
100
102
|
pageKey = props.pageKey,
|
101
103
|
pageSizeKey = props.pageSizeKey,
|
@@ -236,10 +238,10 @@ var ProTable = function ProTable(props) {
|
|
236
238
|
|
237
239
|
var dataFilterForm = useMemo(function () {
|
238
240
|
return createForm();
|
239
|
-
}, []); //
|
241
|
+
}, []); // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
240
242
|
|
241
243
|
var getFooterSuctionState = function getFooterSuctionState() {
|
242
|
-
var containerDom = document.querySelector('.teamix-pro-page-container');
|
244
|
+
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
243
245
|
|
244
246
|
if (containerDom) {
|
245
247
|
var offsetHeight = containerDom.offsetHeight;
|
@@ -250,6 +252,11 @@ var ProTable = function ProTable(props) {
|
|
250
252
|
} else {
|
251
253
|
setFooterSuctionState(false);
|
252
254
|
}
|
255
|
+
} else {
|
256
|
+
// 非全家桶用户暂时不判断滚动条逻辑
|
257
|
+
if (footerSuction) {
|
258
|
+
setFooterSuctionState(true);
|
259
|
+
}
|
253
260
|
}
|
254
261
|
}; // rowSelection 相关
|
255
262
|
|
@@ -365,7 +372,9 @@ var ProTable = function ProTable(props) {
|
|
365
372
|
return _request(params);
|
366
373
|
},
|
367
374
|
request: function request(params) {
|
368
|
-
|
375
|
+
if (dataFilterForm.validate()) {
|
376
|
+
_request(params);
|
377
|
+
}
|
369
378
|
},
|
370
379
|
reset: function reset() {
|
371
380
|
var _actionRef$current, _actionRef$current$se;
|
@@ -652,7 +661,7 @@ var ProTable = function ProTable(props) {
|
|
652
661
|
var renderFooterAction = function renderFooterAction() {
|
653
662
|
var _footerAction$actions;
|
654
663
|
|
655
|
-
if (_typeof(footerAction) === 'object' && (footerAction === null || footerAction === void 0 ? void 0 : (_footerAction$actions = footerAction.actions) === null || _footerAction$actions === void 0 ? void 0 : _footerAction$actions.length)
|
664
|
+
if (_typeof(footerAction) === 'object' && (footerAction === null || footerAction === void 0 ? void 0 : (_footerAction$actions = footerAction.actions) === null || _footerAction$actions === void 0 ? void 0 : _footerAction$actions.length) >= 0) {
|
656
665
|
// 默认 context
|
657
666
|
var defaultContext = {
|
658
667
|
action: actionRef.current,
|
@@ -714,7 +723,7 @@ var ProTable = function ProTable(props) {
|
|
714
723
|
}
|
715
724
|
}
|
716
725
|
|
717
|
-
if (showPagination
|
726
|
+
if (showPagination) {
|
718
727
|
return /*#__PURE__*/React.createElement("div", {
|
719
728
|
className: cls('footer', {
|
720
729
|
'footer-has-rowSelection': rowSelection
|
@@ -743,6 +752,14 @@ var ProTable = function ProTable(props) {
|
|
743
752
|
return onChangePaginationSize(number);
|
744
753
|
}
|
745
754
|
}, props.paginationProps))));
|
755
|
+
} else if (!showPagination) {
|
756
|
+
return /*#__PURE__*/React.createElement("div", {
|
757
|
+
className: cls('footer', {
|
758
|
+
'footer-has-rowSelection': rowSelection
|
759
|
+
})
|
760
|
+
}, renderRowSelection(), /*#__PURE__*/React.createElement("div", {
|
761
|
+
className: cls('footer-right-wrapper')
|
762
|
+
}, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : footer));
|
746
763
|
}
|
747
764
|
};
|
748
765
|
|
@@ -752,11 +769,11 @@ var ProTable = function ProTable(props) {
|
|
752
769
|
}, /*#__PURE__*/React.createElement("div", {
|
753
770
|
className: cls({
|
754
771
|
'': true,
|
755
|
-
fullscreen: fullscreenState,
|
756
|
-
|
772
|
+
fullscreen: fullscreenState // 'footer-suction': footerSuctionState && footerSuction,
|
773
|
+
|
757
774
|
}),
|
758
775
|
ref: tableRef
|
759
|
-
}, renderTable(), renderFooter()));
|
776
|
+
}, renderTable(), footerSuctionState && footerSuction && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && renderFooter()));
|
760
777
|
};
|
761
778
|
|
762
779
|
export default ProTable;
|
package/es/table/index.scss
CHANGED
package/es/table/typing.d.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
import { ColumnProps, TableProps } from '@alicloudfe/components/types/table';
|
5
5
|
import { ProFieldType, ProFieldRenderProps, ProFieldDataSourceItem } from '../field';
|
6
6
|
import { IFilterProps } from '../form';
|
7
|
-
import {
|
7
|
+
import { ProActionGroupProps, ProActionButtonProps } from '../actions';
|
8
8
|
import { PaginationProps } from '@alicloudfe/components/types/pagination';
|
9
9
|
import { HeaderProps as ProTableHeaderProps } from '@teamix/utils';
|
10
10
|
import { Method } from 'axios';
|
@@ -50,7 +50,7 @@ export declare type ProTableColumnProps = {
|
|
50
50
|
/** 表头的过滤菜单宽度 */
|
51
51
|
filtersWidth?: string | number;
|
52
52
|
/** 操作组配置 */
|
53
|
-
actionSchema?:
|
53
|
+
actionSchema?: ProActionGroupProps;
|
54
54
|
/** 指定列对应的字段,支持`a.b`形式的快速取值 和 数组取值 */
|
55
55
|
dataIndex?: string | string[];
|
56
56
|
/** 指定 valueType 为日期时间格式时,可以格式化日期时间 */
|
@@ -99,7 +99,9 @@ export declare type ProTableProps = {
|
|
99
99
|
/** 获取内置 rowSelection */
|
100
100
|
getRowSelection?: (rowSelection: rowSelectionType) => void;
|
101
101
|
/** 表格底部(左侧)配置 */
|
102
|
-
footerAction?:
|
102
|
+
footerAction?: ProActionGroupProps | React.ReactNode;
|
103
|
+
/** 表格底部(右层)配置 */
|
104
|
+
footer?: React.ReactNode;
|
103
105
|
/** 筛选区自动搜索的防抖时间(毫秒) */
|
104
106
|
filterDebounce?: number;
|
105
107
|
/** ProTable action 的引用,便于手动触发一些方法 */
|
@@ -211,7 +213,7 @@ export declare type ProTableTopAreaProps = {
|
|
211
213
|
/** 标题区 */
|
212
214
|
header?: ProTableHeaderProps;
|
213
215
|
/** 主操作区 */
|
214
|
-
mainAction?:
|
216
|
+
mainAction?: ProActionGroupProps | React.ReactNode;
|
215
217
|
/** 工具栏区 */
|
216
218
|
toolBar?: boolean | ProTableToolBarItem[];
|
217
219
|
/** 快捷操作区 */
|
@@ -10,6 +10,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
|
11
11
|
var _dialog = _interopRequireDefault(require("./dialog"));
|
12
12
|
|
13
|
+
var _utils = require("./utils");
|
14
|
+
|
13
15
|
var _excluded = ["schema", "component"];
|
14
16
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -30,7 +32,7 @@ function useDialogComponentAction(action, context) {
|
|
30
32
|
others = _objectWithoutProperties(action, _excluded);
|
31
33
|
|
32
34
|
return (0, _dialog.default)(Object.assign({
|
33
|
-
content: /*#__PURE__*/_react.default.createElement(Component, _objectSpread({}, schema)),
|
35
|
+
content: /*#__PURE__*/_react.default.createElement(Component, _objectSpread({}, (0, _utils.addContext)(schema, context))),
|
34
36
|
closeable: true
|
35
37
|
}, others), context);
|
36
38
|
}
|
@@ -22,6 +22,8 @@ var _request = require("./request");
|
|
22
22
|
|
23
23
|
var _dialog = _interopRequireDefault(require("./dialog"));
|
24
24
|
|
25
|
+
var _utils2 = require("./utils");
|
26
|
+
|
25
27
|
var _excluded = ["schema"],
|
26
28
|
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish"];
|
27
29
|
|
@@ -141,7 +143,7 @@ var DialogForm = function DialogForm(props) {
|
|
141
143
|
}, /*#__PURE__*/_react.default.createElement(_form.default, _objectSpread(_objectSpread({
|
142
144
|
form: form,
|
143
145
|
schema: (0, _utils.getTargetValue)(formSchema, context)
|
144
|
-
}, getDefaultFormPropsByDialogSize(size)), (0, _utils.getTargetValue)(others, context))));
|
146
|
+
}, getDefaultFormPropsByDialogSize(size)), (0, _utils2.addContext)((0, _utils.getTargetValue)(others, context), context))));
|
145
147
|
};
|
146
148
|
|
147
149
|
function useDialogFormAction(action, context) {
|
package/lib/actions/dialog.js
CHANGED
@@ -26,6 +26,8 @@ var _base = require("./base");
|
|
26
26
|
|
27
27
|
var _request = require("./request");
|
28
28
|
|
29
|
+
var _utils2 = require("./utils");
|
30
|
+
|
29
31
|
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
30
32
|
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "overlayProps"],
|
31
33
|
_excluded3 = ["className"];
|
@@ -247,7 +249,7 @@ function useDialogAction(action, context) {
|
|
247
249
|
});
|
248
250
|
var dialogContent = Component ? /*#__PURE__*/_react.default.createElement(Component, _objectSpread({
|
249
251
|
key: (0, _utils.uuid)()
|
250
|
-
}, componentProps)) : addContextForReactNode(content, dialogContext);
|
252
|
+
}, (0, _utils2.addContext)(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
|
251
253
|
|
252
254
|
var quickShowProps = _objectSpread(_objectSpread({
|
253
255
|
// @ts-ignore
|
package/lib/actions/index.js
CHANGED
@@ -259,13 +259,14 @@ var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
259
259
|
others = _objectWithoutProperties(props, _excluded4);
|
260
260
|
|
261
261
|
return /*#__PURE__*/_react.default.createElement(_components.MenuButton, _objectSpread({
|
262
|
-
popupTriggerType: "
|
262
|
+
popupTriggerType: "click",
|
263
|
+
autoWidth: false,
|
263
264
|
menuProps: {
|
264
265
|
mode: 'popup',
|
265
266
|
triggerType: 'hover'
|
266
267
|
},
|
267
268
|
popupProps: {
|
268
|
-
|
269
|
+
v2: true
|
269
270
|
},
|
270
271
|
type: type,
|
271
272
|
label: buttonContent(label || children, icon, iconSize, context)
|
package/lib/actions/index.scss
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export declare function addContext(props?: any, context?: any): any;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.addContext = addContext;
|
7
|
+
var _excluded = ["context"];
|
8
|
+
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
10
|
+
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
12
|
+
|
13
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
14
|
+
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
16
|
+
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
18
|
+
|
19
|
+
function addContext(props, context) {
|
20
|
+
if (!props) {
|
21
|
+
return {
|
22
|
+
context: context
|
23
|
+
};
|
24
|
+
}
|
25
|
+
|
26
|
+
var propsContext = props.context,
|
27
|
+
others = _objectWithoutProperties(props, _excluded);
|
28
|
+
|
29
|
+
var mergedContext = Object.assign({}, propsContext, context);
|
30
|
+
return _objectSpread({
|
31
|
+
context: mergedContext
|
32
|
+
}, others);
|
33
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ProCardProps } from './index';
|
3
|
+
/**
|
4
|
+
* @deprecated 建议使用 ProCardProps 代替
|
5
|
+
*/
|
6
|
+
export declare type ProCardContainerProps = ProCardProps;
|
7
|
+
/**
|
8
|
+
* @deprecated 建议使用 ProCard 代替
|
9
|
+
*/
|
10
|
+
export declare const ProCardContainer: React.FC<ProCardContainerProps>;
|
11
|
+
/**
|
12
|
+
* @deprecated 建议使用 ProCardContainer 代替
|
13
|
+
*/
|
14
|
+
export declare const CardContainer: React.FC<ProCardProps>;
|
15
|
+
/**
|
16
|
+
* @deprecated 建议使用 ProCardContainerProps 代替
|
17
|
+
*/
|
18
|
+
export declare type CardContainerProps = ProCardContainerProps;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.ProCardContainer = exports.CardContainer = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
var _index = require("./index");
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
15
|
+
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
17
|
+
|
18
|
+
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; }
|
19
|
+
|
20
|
+
/**
|
21
|
+
* @deprecated 建议使用 ProCard 代替
|
22
|
+
*/
|
23
|
+
var ProCardContainer = function ProCardContainer(props) {
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_index.ProCard, _objectSpread({}, props));
|
25
|
+
};
|
26
|
+
|
27
|
+
exports.ProCardContainer = ProCardContainer;
|
28
|
+
ProCardContainer.defaultProps = {
|
29
|
+
compacted: true,
|
30
|
+
direction: 'column'
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* @deprecated 建议使用 ProCardContainer 代替
|
34
|
+
*/
|
35
|
+
|
36
|
+
var CardContainer = ProCardContainer;
|
37
|
+
exports.CardContainer = CardContainer;
|