@fle-ui/plus-table 1.2.24 → 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 +46 -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 +45 -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 () {
|
|
@@ -182,7 +185,6 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
182
185
|
while (1) switch (_context5.prev = _context5.next) {
|
|
183
186
|
case 0:
|
|
184
187
|
return _context5.abrupt("return", (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props).then(function (res) {
|
|
185
|
-
console.log(res);
|
|
186
188
|
res.success && init();
|
|
187
189
|
}));
|
|
188
190
|
case 1:
|
|
@@ -263,7 +265,7 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
263
265
|
onChange: handleOnChangeColumn //列状态的值发生改变之后触发
|
|
264
266
|
};
|
|
265
267
|
var propsRequest = /*#__PURE__*/function () {
|
|
266
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
268
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, sort, filter) {
|
|
267
269
|
var _searchRef$current5, _drawFormRef$current4;
|
|
268
270
|
var res1, res2, res;
|
|
269
271
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
@@ -277,24 +279,34 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
277
279
|
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current4 = drawFormRef.current) === null || _drawFormRef$current4 === void 0 ? void 0 : _drawFormRef$current4.getFieldsValue();
|
|
278
280
|
case 5:
|
|
279
281
|
res2 = _context8.sent;
|
|
280
|
-
|
|
282
|
+
if (!request) {
|
|
283
|
+
_context8.next = 12;
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
_context8.next = 9;
|
|
281
287
|
return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
|
|
282
288
|
showFull: showFull
|
|
283
|
-
}));
|
|
284
|
-
case
|
|
285
|
-
|
|
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;
|
|
286
298
|
return _context8.abrupt("return", res);
|
|
287
|
-
case
|
|
299
|
+
case 15:
|
|
288
300
|
case "end":
|
|
289
301
|
return _context8.stop();
|
|
290
302
|
}
|
|
291
303
|
}, _callee8);
|
|
292
304
|
}));
|
|
293
|
-
return function propsRequest(_x5) {
|
|
305
|
+
return function propsRequest(_x5, _x6, _x7) {
|
|
294
306
|
return _ref5.apply(this, arguments);
|
|
295
307
|
};
|
|
296
308
|
}();
|
|
297
|
-
var optionsSetting = _typeof(options.setting) === 'object' ? options.setting : {};
|
|
309
|
+
var optionsSetting = _typeof(options) === 'object' && _typeof(options.setting) === 'object' ? options.setting : {};
|
|
298
310
|
var __options = (action === null || action === void 0 ? void 0 : action.includes('columnSetting')) && showDefaultSetting !== true ? _objectSpread(_objectSpread({}, options), {}, {
|
|
299
311
|
setting: _objectSpread(_objectSpread({}, optionsSetting), {}, {
|
|
300
312
|
checkedReset: false,
|
|
@@ -321,7 +333,9 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
321
333
|
}
|
|
322
334
|
}, otherProps, {
|
|
323
335
|
// 公共配置 大家都有的
|
|
324
|
-
pagination:
|
|
336
|
+
pagination: _objectSpread({
|
|
337
|
+
size: 'default'
|
|
338
|
+
}, pagination),
|
|
325
339
|
actionRef: actionRef,
|
|
326
340
|
formRef: searchRef
|
|
327
341
|
// 根据用户自定义的配置 如果配置了高级筛选就有这个配置
|
|
@@ -354,16 +368,18 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
354
368
|
key: "2",
|
|
355
369
|
type: "default",
|
|
356
370
|
onClick: function onClick() {
|
|
357
|
-
var _drawFormRef$current5;
|
|
371
|
+
var _drawFormRef$current5, _actionRef$current, _actionRef$current$re, _actionRef$current2, _actionRef$current2$r;
|
|
358
372
|
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.resetFields();
|
|
359
|
-
actionRef.current.reset();
|
|
360
|
-
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);
|
|
361
375
|
},
|
|
362
376
|
size: "middle"
|
|
363
|
-
}, "\u91CD\u7F6E"),
|
|
364
|
-
return item.search !== false;
|
|
365
|
-
}).length > 3 ? /*#__PURE__*/_react.default.createElement("a", {
|
|
377
|
+
}, "\u91CD\u7F6E"), /*#__PURE__*/_react.default.createElement("a", {
|
|
366
378
|
key: "3",
|
|
379
|
+
style: {
|
|
380
|
+
wordBreak: 'break-word',
|
|
381
|
+
whiteSpace: 'nowrap'
|
|
382
|
+
},
|
|
367
383
|
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
368
384
|
var _drawFormRef$current6, _searchRef$current6;
|
|
369
385
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
@@ -380,7 +396,7 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
380
396
|
}
|
|
381
397
|
}, _callee9);
|
|
382
398
|
}))
|
|
383
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009")
|
|
399
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009")];
|
|
384
400
|
}
|
|
385
401
|
} : props.search
|
|
386
402
|
// 根据用户自定义的配置 如果配置了列设置就有这个配置完全受控
|
|
@@ -411,8 +427,7 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
411
427
|
search: false
|
|
412
428
|
});
|
|
413
429
|
}) : columns,
|
|
414
|
-
toolBarRender: function toolBarRender(searchConfig) {
|
|
415
|
-
var _otherProps$toolBarRe;
|
|
430
|
+
toolBarRender: function toolBarRender(searchConfig, rows) {
|
|
416
431
|
return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/_react.default.createElement(_antd.Checkbox, {
|
|
417
432
|
onChange: function onChange(e) {
|
|
418
433
|
setShowFull(e.target.checked);
|
|
@@ -420,7 +435,7 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
420
435
|
searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.reload();
|
|
421
436
|
}, 100);
|
|
422
437
|
}
|
|
423
|
-
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null,
|
|
438
|
+
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, typeof otherProps.toolBarRender === 'function' && otherProps.toolBarRender(searchConfig, rows)];
|
|
424
439
|
},
|
|
425
440
|
options: __options
|
|
426
441
|
})), /*#__PURE__*/_react.default.createElement(_antd.Drawer, {
|
|
@@ -479,10 +494,10 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
479
494
|
}, "\u67E5\u8BE2"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
480
495
|
type: "default",
|
|
481
496
|
onClick: function onClick() {
|
|
482
|
-
var _drawFormRef$current10;
|
|
497
|
+
var _drawFormRef$current10, _actionRef$current3, _actionRef$current3$r, _actionRef$current4, _actionRef$current4$r;
|
|
483
498
|
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields();
|
|
484
|
-
actionRef.current.reset();
|
|
485
|
-
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);
|
|
486
501
|
},
|
|
487
502
|
size: "middle"
|
|
488
503
|
}, "\u91CD\u7F6E"))];
|
|
@@ -495,5 +510,5 @@ var PlusTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
495
510
|
manualRequest: true,
|
|
496
511
|
action: actionRef
|
|
497
512
|
})));
|
|
498
|
-
}
|
|
499
|
-
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
|
};
|