@teamix/pro 1.2.21 → 1.2.26
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 +4849 -2339
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog.js +14 -24
- package/es/actions/index.d.ts +22 -8
- package/es/actions/index.js +69 -29
- package/es/actions/index.scss +12 -1
- package/es/form/Components/SelectTable/index.d.ts +24 -0
- package/es/form/Components/SelectTable/index.js +135 -0
- package/es/form/Components/SelectTable/index.scss +28 -0
- package/es/form/Components/SelectTable/table.d.ts +6 -0
- package/es/form/Components/SelectTable/table.js +64 -0
- package/es/form/Filter/AdvancedFilter.js +1 -0
- package/es/form/ProForm/index.scss +37 -6
- package/es/form/SchemaForm/index.js +8 -6
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.d.ts +1 -1
- package/es/form/SchemaForm/initializeRules.js +3 -3
- package/es/form/global.scss +1 -0
- package/es/form/utils.d.ts +2 -2
- package/es/form/utils.js +2 -2
- package/es/index.d.ts +5 -2
- package/es/index.js +6 -3
- package/es/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/HozStepItem/index.js +235 -0
- package/es/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/es/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/VerStepItem/index.js +295 -0
- package/es/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/es/step/ProStepItem/index.d.ts +4 -0
- package/es/step/ProStepItem/index.js +57 -0
- package/es/step/index.d.ts +9 -0
- package/es/step/index.js +101 -0
- package/es/step/typing.d.ts +96 -0
- package/es/step/typing.js +1 -0
- package/es/table/components/Filter/index.js +2 -17
- package/es/table/components/Layout/index.js +22 -12
- package/es/table/components/Pagination/index.d.ts +5 -1
- package/es/table/components/Pagination/index.js +179 -17
- package/es/table/components/Pagination/index.scss +55 -0
- package/es/table/components/ToolBar/FilterColumnIcon.js +24 -3
- package/es/table/components/ToolBar/index.scss +9 -4
- package/es/table/index.js +84 -27
- package/es/table/index.scss +5 -5
- package/es/table/typing.d.ts +11 -2
- package/es/table/utils/columnRender.js +2 -1
- package/es/table/utils/index.d.ts +14 -0
- package/es/table/utils/index.js +74 -4
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/lib/actions/dialog.js +13 -23
- package/lib/actions/index.d.ts +22 -8
- package/lib/actions/index.js +69 -29
- package/lib/actions/index.scss +12 -1
- package/lib/form/Components/SelectTable/index.d.ts +24 -0
- package/lib/form/Components/SelectTable/index.js +157 -0
- package/lib/form/Components/SelectTable/index.scss +28 -0
- package/lib/form/Components/SelectTable/table.d.ts +6 -0
- package/lib/form/Components/SelectTable/table.js +76 -0
- package/lib/form/Filter/AdvancedFilter.js +1 -0
- package/lib/form/ProForm/index.scss +37 -6
- package/lib/form/SchemaForm/index.js +8 -6
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRequest.js +2 -2
- package/lib/form/SchemaForm/initializeRules.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRules.js +3 -3
- package/lib/form/global.scss +1 -0
- package/lib/form/utils.d.ts +2 -2
- package/lib/form/utils.js +2 -2
- package/lib/index.d.ts +5 -2
- package/lib/index.js +35 -3
- package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.js +258 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.js +315 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/lib/step/ProStepItem/index.d.ts +4 -0
- package/lib/step/ProStepItem/index.js +69 -0
- package/lib/step/index.d.ts +9 -0
- package/lib/step/index.js +124 -0
- package/lib/step/typing.d.ts +96 -0
- package/lib/step/typing.js +5 -0
- package/lib/table/components/Filter/index.js +2 -17
- package/lib/table/components/Layout/index.js +21 -11
- package/lib/table/components/Pagination/index.d.ts +5 -1
- package/lib/table/components/Pagination/index.js +186 -17
- package/lib/table/components/Pagination/index.scss +55 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.js +23 -2
- package/lib/table/components/ToolBar/index.scss +9 -4
- package/lib/table/index.js +84 -25
- package/lib/table/index.scss +5 -5
- package/lib/table/typing.d.ts +11 -2
- package/lib/table/utils/columnRender.js +2 -1
- package/lib/table/utils/index.d.ts +14 -0
- package/lib/table/utils/index.js +84 -4
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/package.json +1 -1
package/es/table/typing.d.ts
CHANGED
@@ -12,7 +12,7 @@ import React from 'react';
|
|
12
12
|
import type { Form as FormType } from '@formily/core';
|
13
13
|
declare type IFieldRenderProps = keyof ProFieldRenderProps;
|
14
14
|
/** 列record函数 */
|
15
|
-
declare type ProTableCellFunProp = (value: any, index: number, record: any) => any;
|
15
|
+
declare type ProTableCellFunProp = (value: any, index: number, record: any, ...others: any) => any;
|
16
16
|
declare type ITableCellRender = {
|
17
17
|
[key in IFieldRenderProps]?: ProFieldRenderProps[key] | ProTableCellFunProp;
|
18
18
|
} | ((...other: any) => React.ReactNode);
|
@@ -22,6 +22,7 @@ declare type TDataService = {
|
|
22
22
|
/** 表格数据 */
|
23
23
|
data?: any;
|
24
24
|
};
|
25
|
+
export declare type responsivePaginationType = 'mini' | 'small' | 'simple' | 'normal';
|
25
26
|
export declare type ProTableColumnProps = {
|
26
27
|
/**
|
27
28
|
* 会在 title 之后展示一个 icon,hover 之后提示一些信息
|
@@ -92,6 +93,8 @@ export declare type ProTableProps = {
|
|
92
93
|
paginationProps?: PaginationProps;
|
93
94
|
/** 是否显示翻页器 */
|
94
95
|
showPagination?: boolean;
|
96
|
+
/** 手动指定响应式翻页器的 type */
|
97
|
+
responsivePaginationType?: responsivePaginationType;
|
95
98
|
/** 是否使用内置的 rowSelection */
|
96
99
|
useRowSelection?: boolean;
|
97
100
|
/** 内置 rowSelection 变化时的回调 */
|
@@ -122,6 +125,10 @@ export declare type ProTableProps = {
|
|
122
125
|
data: any[];
|
123
126
|
total?: number;
|
124
127
|
}>;
|
128
|
+
/** 默认漏斗过滤条件 */
|
129
|
+
defaultFilterParams?: {
|
130
|
+
[key: string]: any[] | any;
|
131
|
+
};
|
125
132
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
126
133
|
export declare type rowSelectionType = {
|
127
134
|
getProps?: (record: any, index: number) => any;
|
@@ -146,7 +153,7 @@ export declare type ProTableActionType = {
|
|
146
153
|
/** 全屏展示 */
|
147
154
|
fullScreen?: () => boolean;
|
148
155
|
/** 设置显示列 */
|
149
|
-
setColumn?: (newColumns: ProColumnProps[]) => void;
|
156
|
+
setColumn?: (newColumns: ProColumnProps[], update?: boolean) => void;
|
150
157
|
/** 设置表格大小 */
|
151
158
|
setSize?: (mode: 'small' | 'medium') => void;
|
152
159
|
/** 刷新表格 */
|
@@ -220,6 +227,8 @@ export declare type ProTableDataFilterProps = {
|
|
220
227
|
searchUndefined?: boolean;
|
221
228
|
/** 搜索时是否传入值为空字符串的参数,默认不传 */
|
222
229
|
searchEmptyString?: boolean;
|
230
|
+
/** 自定义内容 */
|
231
|
+
content?: React.ReactNode;
|
223
232
|
} & IFilterProps;
|
224
233
|
export declare type dataFilterProps = ProTableDataFilterProps;
|
225
234
|
export declare type ProTableTopAreaProps = {
|
@@ -204,7 +204,8 @@ var processRenderFunction = function processRenderFunction() {
|
|
204
204
|
var value = arguments.length > 1 ? arguments[1] : undefined;
|
205
205
|
var index = arguments.length > 2 ? arguments[2] : undefined;
|
206
206
|
var record = arguments.length > 3 ? arguments[3] : undefined;
|
207
|
-
|
207
|
+
// 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
|
208
|
+
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick'];
|
208
209
|
return Object.fromEntries(Object.entries(render).map(function (_ref3) {
|
209
210
|
var _ref4 = _slicedToArray(_ref3, 2),
|
210
211
|
k = _ref4[0],
|
@@ -1,4 +1,18 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ProTableActionType } from '../typing';
|
3
|
+
import { ProTableProps, ProTableColumnProps } from '..';
|
4
|
+
export declare function initActionRef(): void;
|
5
|
+
/** table 组件内监听 不对外暴露 */
|
6
|
+
export declare function on(fun: any, key: string): void;
|
7
|
+
/** table 组件内销毁监听 不对外暴露 */
|
8
|
+
export declare function off(key: string): void;
|
9
|
+
/** table 组件内触发事件 不对外暴露 */
|
10
|
+
export declare function emit(key: string, ...args: any): void;
|
3
11
|
export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
4
12
|
export declare function cloneDeep<T>(obj: T): T;
|
13
|
+
/**
|
14
|
+
* 处理默认过滤参数
|
15
|
+
* @param columns
|
16
|
+
* @param ref
|
17
|
+
*/
|
18
|
+
export declare function processDefaultFilter(columns: ProTableColumnProps[], ref: React.MutableRefObject<ProTableActionType | undefined>, defaultFilterParams: ProTableProps['defaultFilterParams']): void;
|
package/es/table/utils/index.js
CHANGED
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
16
16
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
18
18
|
|
19
|
-
import cloneDeepLodash from 'lodash.clonedeep'; // 组件内全局状态
|
19
|
+
import cloneDeepLodash from 'lodash.clonedeep'; // 组件内全局状态 每次初始化 ActionRef 会重新深拷贝对象
|
20
20
|
|
21
21
|
var state = {
|
22
22
|
fullScreenState: false,
|
@@ -24,12 +24,16 @@ var state = {
|
|
24
24
|
filterColumns: []
|
25
25
|
};
|
26
26
|
|
27
|
-
var _initState = cloneDeepLodash(state); //
|
27
|
+
var _initState = cloneDeepLodash(state); // state监听事件 每次初始化 ActionRef 会重新深拷贝对象
|
28
28
|
|
29
29
|
|
30
30
|
var callback = {
|
31
31
|
fullScreenState: {}
|
32
|
-
};
|
32
|
+
};
|
33
|
+
var initCallback = cloneDeepLodash(callback); // 所有 ProTable 组件公用一套组件内事件转发机制
|
34
|
+
|
35
|
+
var tableCallback = {}; // 组件内监听事件
|
36
|
+
// 组件内对全局状态的更改
|
33
37
|
|
34
38
|
var mutations = {
|
35
39
|
getState: function getState() {
|
@@ -129,8 +133,38 @@ var useOn = function useOn(state) {
|
|
129
133
|
}
|
130
134
|
});
|
131
135
|
}
|
132
|
-
};
|
136
|
+
}; // 初始化 actionRef
|
137
|
+
|
138
|
+
|
139
|
+
export function initActionRef() {
|
140
|
+
state = cloneDeepLodash(_initState);
|
141
|
+
callback = cloneDeepLodash(initCallback);
|
142
|
+
}
|
143
|
+
/** table 组件内监听 不对外暴露 */
|
144
|
+
|
145
|
+
export function on(fun, key) {
|
146
|
+
tableCallback[key] = fun;
|
147
|
+
}
|
148
|
+
/** table 组件内销毁监听 不对外暴露 */
|
149
|
+
|
150
|
+
export function off(key) {
|
151
|
+
if (tableCallback[key]) {
|
152
|
+
delete tableCallback[key];
|
153
|
+
}
|
154
|
+
}
|
155
|
+
/** table 组件内触发事件 不对外暴露 */
|
156
|
+
|
157
|
+
export function emit(key) {
|
158
|
+
var fun = tableCallback[key];
|
159
|
+
|
160
|
+
if (fun) {
|
161
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
162
|
+
args[_key2 - 1] = arguments[_key2];
|
163
|
+
}
|
133
164
|
|
165
|
+
fun.apply(void 0, args);
|
166
|
+
}
|
167
|
+
}
|
134
168
|
export function useActionType(ref, action) {
|
135
169
|
// 合并自定义事件
|
136
170
|
var userAction = _objectSpread(_objectSpread({}, action), mutations);
|
@@ -139,4 +173,40 @@ export function useActionType(ref, action) {
|
|
139
173
|
}
|
140
174
|
export function cloneDeep(obj) {
|
141
175
|
return cloneDeepLodash(obj);
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* 处理默认过滤参数
|
179
|
+
* @param columns
|
180
|
+
* @param ref
|
181
|
+
*/
|
182
|
+
|
183
|
+
export function processDefaultFilter(columns, ref, defaultFilterParams) {
|
184
|
+
columns.forEach(function (column) {
|
185
|
+
var _column$dataIndex$toS, _column$dataIndex;
|
186
|
+
|
187
|
+
var defaultRules = defaultFilterParams === null || defaultFilterParams === void 0 ? void 0 : defaultFilterParams[(_column$dataIndex$toS = column === null || column === void 0 ? void 0 : (_column$dataIndex = column.dataIndex) === null || _column$dataIndex === void 0 ? void 0 : _column$dataIndex.toString()) !== null && _column$dataIndex$toS !== void 0 ? _column$dataIndex$toS : ''];
|
188
|
+
|
189
|
+
if (defaultRules) {
|
190
|
+
var _ref$current$getState, _ref$current, _ref$current$getState2, _ref$current$getState3, _ref$current2, _ref$current2$setFilt;
|
191
|
+
|
192
|
+
var params = '';
|
193
|
+
var rules = [];
|
194
|
+
|
195
|
+
if (Array.isArray(defaultRules)) {
|
196
|
+
params = defaultRules.join(',');
|
197
|
+
rules = defaultRules;
|
198
|
+
} else {
|
199
|
+
params = defaultRules;
|
200
|
+
rules = [defaultRules];
|
201
|
+
} // 需要带上其他所有的信息
|
202
|
+
|
203
|
+
|
204
|
+
var otherRules = (_ref$current$getState = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$getState2 = _ref$current.getState) === null || _ref$current$getState2 === void 0 ? void 0 : (_ref$current$getState3 = _ref$current$getState2.call(_ref$current)) === null || _ref$current$getState3 === void 0 ? void 0 : _ref$current$getState3.filterRules) !== null && _ref$current$getState !== void 0 ? _ref$current$getState : {}; // 再设置所有的列筛选状态
|
205
|
+
|
206
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$setFilt = _ref$current2.setFilterRules) === null || _ref$current2$setFilt === void 0 ? void 0 : _ref$current2$setFilt.call(_ref$current2, _objectSpread(_objectSpread({}, otherRules), {}, _defineProperty({}, column.dataIndex, {
|
207
|
+
rules: rules,
|
208
|
+
params: params
|
209
|
+
})));
|
210
|
+
}
|
211
|
+
});
|
142
212
|
}
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
package/lib/actions/dialog.js
CHANGED
@@ -30,7 +30,7 @@ var _request = require("./request");
|
|
30
30
|
|
31
31
|
var _utils2 = require("./utils");
|
32
32
|
|
33
|
-
var _excluded = ["url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
33
|
+
var _excluded = ["trigger", "url", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError"],
|
34
34
|
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
35
35
|
|
36
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -107,7 +107,8 @@ function useDialogAction(action, actionContext) {
|
|
107
107
|
var onActionStart = function onActionStart(context, e) {
|
108
108
|
var _objectSpread2;
|
109
109
|
|
110
|
-
var
|
110
|
+
var trigger = action.trigger,
|
111
|
+
url = action.url,
|
111
112
|
method = action.method,
|
112
113
|
params = action.params,
|
113
114
|
data = action.data,
|
@@ -187,45 +188,34 @@ function useDialogAction(action, actionContext) {
|
|
187
188
|
while (1) {
|
188
189
|
switch (_context.prev = _context.next) {
|
189
190
|
case 0:
|
190
|
-
if (!link) {
|
191
|
-
_context.next = 5;
|
192
|
-
break;
|
193
|
-
}
|
194
|
-
|
195
|
-
(0, _utils.goToLink)(link, history);
|
196
|
-
onFinish && onFinish();
|
197
|
-
resolve(true);
|
198
|
-
return _context.abrupt("return");
|
199
|
-
|
200
|
-
case 5:
|
201
191
|
setLoading(true);
|
202
192
|
footerDescriptionValues = Object.assign({}, footerDescriptionRef === null || footerDescriptionRef === void 0 ? void 0 : (_footerDescriptionRef = footerDescriptionRef.current) === null || _footerDescriptionRef === void 0 ? void 0 : _footerDescriptionRef.values);
|
203
|
-
_context.prev =
|
193
|
+
_context.prev = 2;
|
204
194
|
requestContext = Object.assign({
|
205
195
|
footer: footerDescriptionValues
|
206
196
|
}, context);
|
207
|
-
_context.next =
|
197
|
+
_context.next = 6;
|
208
198
|
return (0, _request.doRequest)(action, requestContext, history, footerDescriptionValues);
|
209
199
|
|
210
|
-
case
|
200
|
+
case 6:
|
211
201
|
onFinish && onFinish();
|
212
202
|
resolve(true);
|
213
|
-
_context.next =
|
203
|
+
_context.next = 15;
|
214
204
|
break;
|
215
205
|
|
216
|
-
case
|
217
|
-
_context.prev =
|
218
|
-
_context.t0 = _context["catch"](
|
206
|
+
case 10:
|
207
|
+
_context.prev = 10;
|
208
|
+
_context.t0 = _context["catch"](2);
|
219
209
|
setLoading(false);
|
220
210
|
resolve(false);
|
221
211
|
return _context.abrupt("return");
|
222
212
|
|
223
|
-
case
|
213
|
+
case 15:
|
224
214
|
case "end":
|
225
215
|
return _context.stop();
|
226
216
|
}
|
227
217
|
}
|
228
|
-
}, _callee, null, [[
|
218
|
+
}, _callee, null, [[2, 10]]);
|
229
219
|
}));
|
230
220
|
|
231
221
|
return function (_x) {
|
@@ -265,7 +255,7 @@ function useDialogAction(action, actionContext) {
|
|
265
255
|
})), _objectSpread2), containerProps), containerOtherProps);
|
266
256
|
|
267
257
|
var ret = container.show(quickShowProps);
|
268
|
-
store.hide = ret.hide;
|
258
|
+
store.hide = ret ? ret.hide || ret.close : function () {};
|
269
259
|
};
|
270
260
|
|
271
261
|
return _objectSpread({}, (0, _base.eventHandler)(action, actionContext, onActionStart));
|
package/lib/actions/index.d.ts
CHANGED
@@ -26,31 +26,45 @@ export declare type ProActionConfig = ({
|
|
26
26
|
} & LinkAction);
|
27
27
|
export declare function registerActionHandler(id: string, extendActionId: string, defaultConfig: any): void;
|
28
28
|
export declare function useAction(config?: ProActionConfig, context?: any): any;
|
29
|
-
export interface ProActionButtonProps extends ButtonProps {
|
30
|
-
key?: string | number;
|
29
|
+
export interface ProActionButtonProps extends ProActionCommonProps, ButtonProps {
|
31
30
|
config?: ProActionConfig;
|
32
|
-
visible?: any;
|
33
31
|
disabled?: any;
|
34
32
|
icon?: string;
|
35
|
-
context?: any;
|
36
33
|
onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
|
37
34
|
}
|
38
35
|
export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
|
39
|
-
export interface
|
36
|
+
export interface ProActionCommonProps {
|
40
37
|
key?: string | number;
|
41
|
-
actions: ProActionProps[];
|
42
38
|
visible?: any;
|
43
|
-
icon?: string;
|
44
39
|
context?: any;
|
45
40
|
}
|
41
|
+
export interface ProActionMenuButtonProps extends ProActionCommonProps, Omit<MenuButtonProps, 'visible'> {
|
42
|
+
actions: ProActionProps[];
|
43
|
+
icon?: string;
|
44
|
+
}
|
46
45
|
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
47
|
-
export
|
46
|
+
export interface ProActionDividerProps extends ProActionCommonProps {
|
47
|
+
type: 'divider';
|
48
|
+
}
|
49
|
+
export declare type ProActionProps = ProActionButtonProps | ProActionMenuButtonProps | ProActionDividerProps;
|
48
50
|
export declare type ProActionGroupProps = {
|
51
|
+
/** 操作组类型:按钮、文字按钮 */
|
49
52
|
type?: 'button' | 'text';
|
53
|
+
/** 上下文 */
|
50
54
|
context?: any;
|
55
|
+
/** 操作项配置 */
|
51
56
|
actions: ProActionProps[];
|
57
|
+
/** 操作按钮最长数量,超出后折叠,默认为4 */
|
52
58
|
max?: number;
|
59
|
+
/**
|
60
|
+
* @deprecated 建议使用 more 代替
|
61
|
+
*/
|
53
62
|
moreText?: string;
|
63
|
+
/** 更多按钮的配置,只有在actions数量超过max时才有效 */
|
64
|
+
more?: string | (ProActionButtonProps & {
|
65
|
+
noArrow?: boolean;
|
66
|
+
});
|
67
|
+
/** 是否有分割线,只有type="text"时生效,默认有分割线 */
|
54
68
|
divider?: boolean;
|
55
69
|
} & React.HTMLAttributes<HTMLElement>;
|
56
70
|
export declare function ProActionGroup(props: ProActionGroupProps): JSX.Element;
|
package/lib/actions/index.js
CHANGED
@@ -58,9 +58,10 @@ var _excluded = ["type"],
|
|
58
58
|
_excluded3 = ["loading"],
|
59
59
|
_excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type"],
|
60
60
|
_excluded5 = ["context", "text"],
|
61
|
-
_excluded6 = ["
|
62
|
-
_excluded7 = ["key", "
|
63
|
-
_excluded8 = ["
|
61
|
+
_excluded6 = ["noArrow", "className"],
|
62
|
+
_excluded7 = ["key", "actions"],
|
63
|
+
_excluded8 = ["key", "config"],
|
64
|
+
_excluded9 = ["type", "divider", "max", "moreText", "more", "context", "actions", "className"];
|
64
65
|
|
65
66
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
66
67
|
|
@@ -248,6 +249,12 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
|
|
248
249
|
};
|
249
250
|
|
250
251
|
function renderCommonActionButtonMenuItem(action, key, context) {
|
252
|
+
if (action.type === 'divider') {
|
253
|
+
return /*#__PURE__*/_react.default.createElement(_components.Menu.Divider, {
|
254
|
+
key: key
|
255
|
+
});
|
256
|
+
}
|
257
|
+
|
251
258
|
var menuBtn = action;
|
252
259
|
|
253
260
|
if (menuBtn.actions && menuBtn.actions.length && menuBtn.disabled !== true) {
|
@@ -292,27 +299,48 @@ var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
292
299
|
}, others), actions.map(function (action, i) {
|
293
300
|
return renderCommonActionButtonMenuItem(action, action.key || i, context);
|
294
301
|
}));
|
295
|
-
}; //
|
302
|
+
}; // 超出 max,则折叠起来
|
296
303
|
|
297
304
|
|
298
305
|
exports.ProActionMenuButton = ProActionMenuButton;
|
299
306
|
|
300
|
-
function
|
301
|
-
|
302
|
-
|
303
|
-
if (actions.length <= MAX) {
|
307
|
+
function foldExtraActions(actions, max, moreConfig) {
|
308
|
+
if (actions.length <= max) {
|
304
309
|
return actions;
|
305
310
|
}
|
306
311
|
|
307
|
-
return [].concat(_toConsumableArray(actions.slice(0,
|
312
|
+
return [].concat(_toConsumableArray(actions.slice(0, max - 1)), [_objectSpread(_objectSpread({
|
308
313
|
key: '__teamix_pro_action_group_more_btn'
|
309
314
|
}, moreConfig), {}, {
|
310
|
-
actions: actions.slice(
|
315
|
+
actions: actions.slice(max - 1)
|
311
316
|
})]);
|
317
|
+
} // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
|
318
|
+
// divider 不计数
|
319
|
+
|
320
|
+
|
321
|
+
function formatGroupActions(actions, max, moreConfig) {
|
322
|
+
var MAX = max < 1 ? MAX_ACTTIONS : max;
|
323
|
+
var count = 0;
|
324
|
+
var index = 0;
|
325
|
+
|
326
|
+
for (; index < actions.length && count < MAX; index++) {
|
327
|
+
if (actions[index].type !== 'divider') {
|
328
|
+
count += 1;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
return foldExtraActions(actions, Math.max(index, MAX), moreConfig);
|
312
333
|
} // 渲染一个 button 或者 menu button
|
313
334
|
|
314
335
|
|
315
336
|
function renderCommonActionButton(button, context, isTypeText) {
|
337
|
+
if (button.type === 'divider') {
|
338
|
+
return /*#__PURE__*/_react.default.createElement(_components.Divider, {
|
339
|
+
key: button.key,
|
340
|
+
direction: "ver"
|
341
|
+
});
|
342
|
+
}
|
343
|
+
|
316
344
|
var buttonContext = button.context,
|
317
345
|
text = button.text,
|
318
346
|
others = _objectWithoutProperties(button, _excluded5);
|
@@ -329,25 +357,36 @@ function renderCommonActionButton(button, context, isTypeText) {
|
|
329
357
|
return /*#__PURE__*/_react.default.createElement(ProActionMenuButton, _objectSpread({}, buttonProps));
|
330
358
|
}
|
331
359
|
|
332
|
-
function getDefaultMoreButton(type,
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
}
|
338
|
-
|
339
|
-
if (moreText) {
|
340
|
-
return {
|
341
|
-
label: moreText
|
342
|
-
};
|
343
|
-
}
|
344
|
-
|
345
|
-
return {
|
360
|
+
function getDefaultMoreButton(type, more) {
|
361
|
+
var noArrowClassName = 'teamix-pro-actions-text-menu-btn-no-arrow';
|
362
|
+
var defaultConfig = type === 'button' ? {
|
363
|
+
children: (0, _utils.getMessage)('more')
|
364
|
+
} : {
|
346
365
|
icon: 'more-line',
|
347
366
|
// iconSize: 'small',
|
348
367
|
autoWidth: false,
|
349
|
-
className:
|
368
|
+
className: noArrowClassName
|
350
369
|
};
|
370
|
+
|
371
|
+
if (!more) {
|
372
|
+
return defaultConfig;
|
373
|
+
}
|
374
|
+
|
375
|
+
var moreConfig = typeof more === 'string' ? {
|
376
|
+
children: more
|
377
|
+
} : more;
|
378
|
+
|
379
|
+
if (type === 'button') {
|
380
|
+
return Object.assign(defaultConfig, moreConfig);
|
381
|
+
}
|
382
|
+
|
383
|
+
var noArrow = moreConfig.noArrow,
|
384
|
+
className = moreConfig.className,
|
385
|
+
others = _objectWithoutProperties(moreConfig, _excluded6);
|
386
|
+
|
387
|
+
return _objectSpread({
|
388
|
+
className: (0, _classnames.default)(className, _defineProperty({}, "".concat(noArrowClassName), noArrow))
|
389
|
+
}, others);
|
351
390
|
}
|
352
391
|
|
353
392
|
var MAX_ACTTIONS = 4;
|
@@ -364,7 +403,7 @@ function getActionConfig(action, index, context) {
|
|
364
403
|
if (action.actions) {
|
365
404
|
var _key = action.key,
|
366
405
|
actions = action.actions,
|
367
|
-
_others = _objectWithoutProperties(action,
|
406
|
+
_others = _objectWithoutProperties(action, _excluded7);
|
368
407
|
|
369
408
|
return _objectSpread({
|
370
409
|
key: getKey(index, _key),
|
@@ -376,7 +415,7 @@ function getActionConfig(action, index, context) {
|
|
376
415
|
|
377
416
|
var key = action.key,
|
378
417
|
config = action.config,
|
379
|
-
others = _objectWithoutProperties(action,
|
418
|
+
others = _objectWithoutProperties(action, _excluded8);
|
380
419
|
|
381
420
|
return _objectSpread({
|
382
421
|
key: getKey(index, key),
|
@@ -392,11 +431,12 @@ function ProActionGroup(props) {
|
|
392
431
|
_props$max = props.max,
|
393
432
|
max = _props$max === void 0 ? MAX_ACTTIONS : _props$max,
|
394
433
|
moreText = props.moreText,
|
434
|
+
more = props.more,
|
395
435
|
context = props.context,
|
396
436
|
_props$actions = props.actions,
|
397
437
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
398
438
|
className = props.className,
|
399
|
-
containerProps = _objectWithoutProperties(props,
|
439
|
+
containerProps = _objectWithoutProperties(props, _excluded9);
|
400
440
|
|
401
441
|
var isTypeText = type === 'text';
|
402
442
|
var filteredActions = actions.map(function (action, index) {
|
@@ -404,7 +444,7 @@ function ProActionGroup(props) {
|
|
404
444
|
}).filter(function (action) {
|
405
445
|
return action.visible !== false;
|
406
446
|
});
|
407
|
-
var formatedActions = formatGroupActions(filteredActions, max, getDefaultMoreButton(type, moreText));
|
447
|
+
var formatedActions = formatGroupActions(filteredActions, max, getDefaultMoreButton(type, more || moreText));
|
408
448
|
return /*#__PURE__*/_react.default.createElement("div", _objectSpread({
|
409
449
|
className: (0, _classnames.default)('teamix-pro-actions', "teamix-pro-actions-type-".concat(type), className, {
|
410
450
|
'teamix-pro-actions-divider': type === 'button' ? false : divider
|
package/lib/actions/index.scss
CHANGED
@@ -2,12 +2,23 @@
|
|
2
2
|
display: flex;
|
3
3
|
align-items: center;
|
4
4
|
flex-wrap: wrap;
|
5
|
+
|
6
|
+
& > .next-divider {
|
7
|
+
& + .next-divider {
|
8
|
+
display: none;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
5
12
|
&.teamix-pro-actions-type-button {
|
6
13
|
& > button {
|
7
14
|
&:not(:last-child) {
|
8
15
|
margin-right: var(--s-2);
|
9
16
|
}
|
10
17
|
}
|
18
|
+
& > .next-divider {
|
19
|
+
margin-left: 0;
|
20
|
+
margin-right: var(--s-2);
|
21
|
+
}
|
11
22
|
}
|
12
23
|
|
13
24
|
&.teamix-pro-actions-type-text:not(.teamix-pro-actions-divider) {
|
@@ -109,4 +120,4 @@
|
|
109
120
|
}
|
110
121
|
}
|
111
122
|
}
|
112
|
-
}
|
123
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TableProps, ColumnProps } from '@alifd/next/types/table';
|
3
|
+
import './index.scss';
|
4
|
+
declare type ISelectTableFilterOption = boolean | ((optipn: any, kewword: string) => boolean);
|
5
|
+
declare type ISelectTableFilterSort = (optionA: any, optionB: any) => number;
|
6
|
+
export interface ISelectTableColumnProps extends ColumnProps {
|
7
|
+
key: React.ReactText;
|
8
|
+
}
|
9
|
+
export interface ISelectTableProps extends TableProps {
|
10
|
+
mode?: 'multiple' | 'single';
|
11
|
+
dataSource?: any[];
|
12
|
+
optionAsValue?: boolean;
|
13
|
+
showSearch?: boolean;
|
14
|
+
filterOption?: ISelectTableFilterOption;
|
15
|
+
filterSort?: ISelectTableFilterSort;
|
16
|
+
onSearch?: (kekword: string) => void;
|
17
|
+
onChange?: (value: any) => void;
|
18
|
+
value?: any;
|
19
|
+
}
|
20
|
+
declare type ComposedSelectTable = React.FC<ISelectTableProps> & {
|
21
|
+
TableColumn?: React.FC<ISelectTableColumnProps>;
|
22
|
+
};
|
23
|
+
declare const SelectTable: ComposedSelectTable;
|
24
|
+
export default SelectTable;
|