@fle-ui/plus-table 1.2.23 → 1.2.25
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/es/index.d.ts +17 -55
- package/es/index.js +49 -31
- package/es/json/columnKeys.js +0 -16
- package/es/json/list.d.ts +1365 -0
- package/es/json/list.js +1388 -0
- package/lib/index.d.ts +17 -55
- package/lib/index.js +48 -30
- package/lib/json/columnKeys.js +0 -16
- package/lib/json/list.d.ts +1365 -0
- package/lib/json/list.js +1394 -0
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import type {
|
|
3
|
-
import type { InputProps } from 'antd';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ProTableProps, ProColumns } from '@ant-design/pro-components';
|
|
4
3
|
import './FormSearch/index.less';
|
|
5
4
|
interface PlusColumns extends ProColumns {
|
|
6
5
|
baseSearch?: boolean;
|
|
@@ -17,49 +16,15 @@ export type settingsColumns = {
|
|
|
17
16
|
sort?: number;
|
|
18
17
|
};
|
|
19
18
|
};
|
|
20
|
-
|
|
21
|
-
type OptionsType = OptionsFunctionType | boolean;
|
|
22
|
-
type SettingOptionType = {
|
|
23
|
-
draggable?: boolean;
|
|
24
|
-
checkable?: boolean;
|
|
25
|
-
showListItemOption?: boolean;
|
|
26
|
-
checkedReset?: boolean;
|
|
27
|
-
listsHeight?: number;
|
|
28
|
-
extra?: React.ReactNode;
|
|
29
|
-
children?: React.ReactNode;
|
|
30
|
-
settingIcon?: React.ReactNode;
|
|
31
|
-
};
|
|
32
|
-
interface SearchProps extends InputProps {
|
|
33
|
-
inputPrefixCls?: string;
|
|
34
|
-
onSearch?: (value: string, event?: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLInputElement>, info?: {
|
|
35
|
-
source?: 'clear' | 'input';
|
|
36
|
-
}) => void;
|
|
37
|
-
enterButton?: React.ReactNode;
|
|
38
|
-
loading?: boolean;
|
|
39
|
-
}
|
|
40
|
-
type OptionSearchProps = Omit<SearchProps, 'onSearch'> & {
|
|
41
|
-
/** 如果 onSearch 返回一个false,直接拦截请求 */
|
|
42
|
-
onSearch?: (keyword: string) => Promise<boolean | undefined> | boolean | undefined;
|
|
43
|
-
};
|
|
44
|
-
export type optionsConfig = {
|
|
45
|
-
density?: boolean;
|
|
46
|
-
fullScreen?: OptionsType;
|
|
47
|
-
reload?: OptionsType;
|
|
48
|
-
setting?: boolean | SettingOptionType;
|
|
49
|
-
search?: (OptionSearchProps & {
|
|
50
|
-
name?: string;
|
|
51
|
-
}) | boolean;
|
|
52
|
-
reloadIcon?: React.ReactNode;
|
|
53
|
-
densityIcon?: React.ReactNode;
|
|
54
|
-
};
|
|
55
|
-
type PlusProps = {
|
|
19
|
+
interface PlusTableProps<DataSource, U, ValueType> extends Omit<ProTableProps<DataSource, U, ValueType>, 'columns'> {
|
|
56
20
|
action?: Array<'advancedFilter' | 'columnSetting' | 'viewInvisibleData'>;
|
|
57
21
|
columns: PlusColumns[];
|
|
58
|
-
request?: any;
|
|
59
22
|
top?: number;
|
|
60
|
-
fetchSetting?: () => Promise<
|
|
61
|
-
updateSetting?: (params:
|
|
62
|
-
resetSetting?: () => Promise<
|
|
23
|
+
fetchSetting?: () => Promise<Record<string, any>>;
|
|
24
|
+
updateSetting?: (params: settingsColumns) => void;
|
|
25
|
+
resetSetting?: () => Promise<{
|
|
26
|
+
success: boolean;
|
|
27
|
+
}>;
|
|
63
28
|
showDefaultSetting?: boolean;
|
|
64
29
|
defaultColumnsState?: {
|
|
65
30
|
[key: string]: {
|
|
@@ -67,16 +32,13 @@ type PlusProps = {
|
|
|
67
32
|
fixed: 'left' | 'right' | undefined;
|
|
68
33
|
};
|
|
69
34
|
};
|
|
70
|
-
headerTitle?: ReactElement;
|
|
71
35
|
hasShowFull?: boolean;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
declare const PlusTable: React.ForwardRefExoticComponent<Omit<PlusProps, "ref"> & React.RefAttributes<unknown>>;
|
|
82
|
-
export default PlusTable;
|
|
36
|
+
getContainer?: string | HTMLElement | (() => HTMLElement) | false;
|
|
37
|
+
}
|
|
38
|
+
interface PlusTableRef {
|
|
39
|
+
getFieldsValue: () => Promise<any>;
|
|
40
|
+
setFiledsValue: (params: any) => Promise<void>;
|
|
41
|
+
setFiledValue: (key: string, value: any) => Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
declare const _default: React.ForwardRefExoticComponent<PlusTableProps<Record<string, any>, Record<string, any>, unknown> & React.RefAttributes<PlusTableRef>>;
|
|
44
|
+
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var _index = _interopRequireDefault(require("./FormSearch/index"));
|
|
|
11
11
|
var _icons = require("@ant-design/icons");
|
|
12
12
|
var _common = require("./utils/common");
|
|
13
13
|
require("./FormSearch/index.less");
|
|
14
|
-
var _excluded = ["
|
|
14
|
+
var _excluded = ["columns", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState", "options", "action", "showDefaultSetting"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -33,16 +33,15 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
33
33
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
34
|
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; }
|
|
35
35
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
36
|
-
|
|
36
|
+
function PlusTable(props, ref) {
|
|
37
37
|
var _otherProps$scroll;
|
|
38
|
-
var
|
|
39
|
-
columns = props.columns,
|
|
38
|
+
var columns = props.columns,
|
|
40
39
|
_props$hasShowFull = props.hasShowFull,
|
|
41
40
|
hasShowFull = _props$hasShowFull === void 0 ? true : _props$hasShowFull,
|
|
42
41
|
request = props.request,
|
|
43
42
|
pagination = props.pagination,
|
|
44
43
|
formRef = props.formRef,
|
|
45
|
-
|
|
44
|
+
propsActionRef = props.actionRef,
|
|
46
45
|
defaultColumnsState = props.defaultColumnsState,
|
|
47
46
|
_props$options = props.options,
|
|
48
47
|
options = _props$options === void 0 ? {} : _props$options,
|
|
@@ -64,6 +63,10 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
64
63
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
65
64
|
columnsStateMap = _useState6[0],
|
|
66
65
|
setColumnsStateMap = _useState6[1];
|
|
66
|
+
var actionRef = (0, _react.useRef)();
|
|
67
|
+
(0, _react.useImperativeHandle)(propsActionRef, function () {
|
|
68
|
+
return actionRef.current;
|
|
69
|
+
});
|
|
67
70
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
68
71
|
return {
|
|
69
72
|
getFieldsValue: function () {
|
|
@@ -181,7 +184,9 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
181
184
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
182
185
|
while (1) switch (_context5.prev = _context5.next) {
|
|
183
186
|
case 0:
|
|
184
|
-
return _context5.abrupt("return", (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props))
|
|
187
|
+
return _context5.abrupt("return", (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props).then(function (res) {
|
|
188
|
+
res.success && init();
|
|
189
|
+
}));
|
|
185
190
|
case 1:
|
|
186
191
|
case "end":
|
|
187
192
|
return _context5.stop();
|
|
@@ -260,7 +265,7 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
260
265
|
onChange: handleOnChangeColumn //列状态的值发生改变之后触发
|
|
261
266
|
};
|
|
262
267
|
var propsRequest = /*#__PURE__*/function () {
|
|
263
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
268
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, sort, filter) {
|
|
264
269
|
var _searchRef$current5, _drawFormRef$current4;
|
|
265
270
|
var res1, res2, res;
|
|
266
271
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
@@ -274,24 +279,34 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
274
279
|
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current4 = drawFormRef.current) === null || _drawFormRef$current4 === void 0 ? void 0 : _drawFormRef$current4.getFieldsValue();
|
|
275
280
|
case 5:
|
|
276
281
|
res2 = _context8.sent;
|
|
277
|
-
|
|
282
|
+
if (!request) {
|
|
283
|
+
_context8.next = 12;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
_context8.next = 9;
|
|
278
287
|
return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
|
|
279
288
|
showFull: showFull
|
|
280
|
-
}));
|
|
281
|
-
case
|
|
282
|
-
|
|
289
|
+
}), sort, filter);
|
|
290
|
+
case 9:
|
|
291
|
+
_context8.t0 = _context8.sent;
|
|
292
|
+
_context8.next = 13;
|
|
293
|
+
break;
|
|
294
|
+
case 12:
|
|
295
|
+
_context8.t0 = {};
|
|
296
|
+
case 13:
|
|
297
|
+
res = _context8.t0;
|
|
283
298
|
return _context8.abrupt("return", res);
|
|
284
|
-
case
|
|
299
|
+
case 15:
|
|
285
300
|
case "end":
|
|
286
301
|
return _context8.stop();
|
|
287
302
|
}
|
|
288
303
|
}, _callee8);
|
|
289
304
|
}));
|
|
290
|
-
return function propsRequest(_x5) {
|
|
305
|
+
return function propsRequest(_x5, _x6, _x7) {
|
|
291
306
|
return _ref5.apply(this, arguments);
|
|
292
307
|
};
|
|
293
308
|
}();
|
|
294
|
-
var optionsSetting = _typeof(options.setting) === 'object' ? options.setting : {};
|
|
309
|
+
var optionsSetting = _typeof(options) === 'object' && _typeof(options.setting) === 'object' ? options.setting : {};
|
|
295
310
|
var __options = (action === null || action === void 0 ? void 0 : action.includes('columnSetting')) && showDefaultSetting !== true ? _objectSpread(_objectSpread({}, options), {}, {
|
|
296
311
|
setting: _objectSpread(_objectSpread({}, optionsSetting), {}, {
|
|
297
312
|
checkedReset: false,
|
|
@@ -318,7 +333,9 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
318
333
|
}
|
|
319
334
|
}, otherProps, {
|
|
320
335
|
// 公共配置 大家都有的
|
|
321
|
-
pagination:
|
|
336
|
+
pagination: _objectSpread({
|
|
337
|
+
size: 'default'
|
|
338
|
+
}, pagination),
|
|
322
339
|
actionRef: actionRef,
|
|
323
340
|
formRef: searchRef
|
|
324
341
|
// 根据用户自定义的配置 如果配置了高级筛选就有这个配置
|
|
@@ -351,16 +368,18 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
351
368
|
key: "2",
|
|
352
369
|
type: "default",
|
|
353
370
|
onClick: function onClick() {
|
|
354
|
-
var _drawFormRef$current5;
|
|
371
|
+
var _drawFormRef$current5, _actionRef$current, _actionRef$current$re, _actionRef$current2, _actionRef$current2$r;
|
|
355
372
|
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.resetFields();
|
|
356
|
-
actionRef.current.reset();
|
|
357
|
-
actionRef.current.reload();
|
|
373
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.reset) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
|
|
374
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.reload) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
|
|
358
375
|
},
|
|
359
376
|
size: "middle"
|
|
360
|
-
}, "\u91CD\u7F6E"),
|
|
361
|
-
return item.search !== false;
|
|
362
|
-
}).length > 3 ? /*#__PURE__*/_react.default.createElement("a", {
|
|
377
|
+
}, "\u91CD\u7F6E"), /*#__PURE__*/_react.default.createElement("a", {
|
|
363
378
|
key: "3",
|
|
379
|
+
style: {
|
|
380
|
+
wordBreak: 'break-word',
|
|
381
|
+
whiteSpace: 'nowrap'
|
|
382
|
+
},
|
|
364
383
|
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
365
384
|
var _drawFormRef$current6, _searchRef$current6;
|
|
366
385
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
@@ -377,7 +396,7 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
377
396
|
}
|
|
378
397
|
}, _callee9);
|
|
379
398
|
}))
|
|
380
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009")
|
|
399
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009")];
|
|
381
400
|
}
|
|
382
401
|
} : props.search
|
|
383
402
|
// 根据用户自定义的配置 如果配置了列设置就有这个配置完全受控
|
|
@@ -408,8 +427,7 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
408
427
|
search: false
|
|
409
428
|
});
|
|
410
429
|
}) : columns,
|
|
411
|
-
toolBarRender: function toolBarRender(searchConfig) {
|
|
412
|
-
var _otherProps$toolBarRe;
|
|
430
|
+
toolBarRender: function toolBarRender(searchConfig, rows) {
|
|
413
431
|
return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/_react.default.createElement(_antd.Checkbox, {
|
|
414
432
|
onChange: function onChange(e) {
|
|
415
433
|
setShowFull(e.target.checked);
|
|
@@ -417,7 +435,7 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
417
435
|
searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.reload();
|
|
418
436
|
}, 100);
|
|
419
437
|
}
|
|
420
|
-
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null,
|
|
438
|
+
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, typeof otherProps.toolBarRender === 'function' && otherProps.toolBarRender(searchConfig, rows)];
|
|
421
439
|
},
|
|
422
440
|
options: __options
|
|
423
441
|
})), /*#__PURE__*/_react.default.createElement(_antd.Drawer, {
|
|
@@ -476,10 +494,10 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
476
494
|
}, "\u67E5\u8BE2"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
477
495
|
type: "default",
|
|
478
496
|
onClick: function onClick() {
|
|
479
|
-
var _drawFormRef$current10;
|
|
497
|
+
var _drawFormRef$current10, _actionRef$current3, _actionRef$current3$r, _actionRef$current4, _actionRef$current4$r;
|
|
480
498
|
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields();
|
|
481
|
-
actionRef.current.reset();
|
|
482
|
-
actionRef.current.reload();
|
|
499
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$r = _actionRef$current3.reset) === null || _actionRef$current3$r === void 0 ? void 0 : _actionRef$current3$r.call(_actionRef$current3);
|
|
500
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$r = _actionRef$current4.reload) === null || _actionRef$current4$r === void 0 ? void 0 : _actionRef$current4$r.call(_actionRef$current4);
|
|
483
501
|
},
|
|
484
502
|
size: "middle"
|
|
485
503
|
}, "\u91CD\u7F6E"))];
|
|
@@ -492,5 +510,5 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
492
510
|
manualRequest: true,
|
|
493
511
|
action: actionRef
|
|
494
512
|
})));
|
|
495
|
-
}
|
|
496
|
-
var _default = exports.default = PlusTable;
|
|
513
|
+
}
|
|
514
|
+
var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(PlusTable);
|
package/lib/json/columnKeys.js
CHANGED
|
@@ -9,14 +9,6 @@ var _default = exports.default = {
|
|
|
9
9
|
code: '2000',
|
|
10
10
|
message: null,
|
|
11
11
|
data: [{
|
|
12
|
-
id: 12966348,
|
|
13
|
-
title: '商品编码',
|
|
14
|
-
field: 'goodsNumber',
|
|
15
|
-
sort: 0,
|
|
16
|
-
hideInTable: 0,
|
|
17
|
-
fixed: 1,
|
|
18
|
-
disabled: 1
|
|
19
|
-
}, {
|
|
20
12
|
id: 12966347,
|
|
21
13
|
title: '商品名称',
|
|
22
14
|
field: 'mainImage,name',
|
|
@@ -192,13 +184,5 @@ var _default = exports.default = {
|
|
|
192
184
|
hideInTable: 1,
|
|
193
185
|
fixed: 0,
|
|
194
186
|
disabled: 0
|
|
195
|
-
}, {
|
|
196
|
-
id: 12966341,
|
|
197
|
-
title: '操作',
|
|
198
|
-
field: 'option',
|
|
199
|
-
sort: 23,
|
|
200
|
-
hideInTable: 0,
|
|
201
|
-
fixed: 2,
|
|
202
|
-
disabled: 1
|
|
203
187
|
}]
|
|
204
188
|
};
|