@hanwenbo/x-web-pro-components 0.0.1
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/LICENSE +21 -0
- package/es/blocks/index.d.ts +1 -0
- package/es/blocks/index.js +2 -0
- package/es/blocks/shared.d.ts +24 -0
- package/es/blocks/shared.js +77 -0
- package/es/components/card/index.d.ts +82 -0
- package/es/components/card/index.js +361 -0
- package/es/components/descriptions/index.d.ts +31 -0
- package/es/components/descriptions/index.js +434 -0
- package/es/components/field/index.d.ts +75 -0
- package/es/components/field/index.js +761 -0
- package/es/components/form/captcha.d.ts +19 -0
- package/es/components/form/captcha.js +165 -0
- package/es/components/form/colorPicker.d.ts +7 -0
- package/es/components/form/colorPicker.js +73 -0
- package/es/components/form/fieldControls.d.ts +43 -0
- package/es/components/form/fieldControls.js +282 -0
- package/es/components/form/index.d.ts +285 -0
- package/es/components/form/index.js +2268 -0
- package/es/components/form/loginForm.d.ts +22 -0
- package/es/components/form/loginForm.js +159 -0
- package/es/components/form/schemaForm.d.ts +30 -0
- package/es/components/form/schemaForm.js +644 -0
- package/es/components/form/stepsForm.d.ts +26 -0
- package/es/components/form/stepsForm.js +183 -0
- package/es/components/form/uploadButton.d.ts +20 -0
- package/es/components/form/uploadButton.js +134 -0
- package/es/components/form/uploadDragger.d.ts +13 -0
- package/es/components/form/uploadDragger.js +144 -0
- package/es/components/index.d.ts +9 -0
- package/es/components/index.js +9 -0
- package/es/components/layout/components/Help/index.d.ts +72 -0
- package/es/components/layout/components/Help/index.js +350 -0
- package/es/components/layout/index.d.ts +182 -0
- package/es/components/layout/index.js +892 -0
- package/es/components/list/index.d.ts +80 -0
- package/es/components/list/index.js +431 -0
- package/es/components/provider/context.d.ts +7 -0
- package/es/components/provider/context.js +21 -0
- package/es/components/provider/index.d.ts +28 -0
- package/es/components/provider/index.js +117 -0
- package/es/components/provider/intl.d.ts +38 -0
- package/es/components/provider/intl.js +112 -0
- package/es/components/provider/types.d.ts +37 -0
- package/es/components/provider/types.js +1 -0
- package/es/components/provider/useStyle/index.d.ts +28 -0
- package/es/components/provider/useStyle/index.js +208 -0
- package/es/components/skeleton/index.d.ts +61 -0
- package/es/components/skeleton/index.js +388 -0
- package/es/components/table/dragSortTable.d.ts +8 -0
- package/es/components/table/dragSortTable.js +229 -0
- package/es/components/table/editableTable.d.ts +31 -0
- package/es/components/table/editableTable.js +507 -0
- package/es/components/table/index.d.ts +52 -0
- package/es/components/table/index.js +1554 -0
- package/es/components/table/listToolBar.d.ts +48 -0
- package/es/components/table/listToolBar.js +194 -0
- package/es/components/table/search.d.ts +5 -0
- package/es/components/table/search.js +13 -0
- package/es/index.d.ts +4 -0
- package/es/index.js +4 -0
- package/es/types.d.ts +219 -0
- package/es/types.js +1 -0
- package/es/utils/attachPropertiesToComponent.d.ts +1 -0
- package/es/utils/attachPropertiesToComponent.js +6 -0
- package/es/utils/getRequestParams.d.ts +19 -0
- package/es/utils/getRequestParams.js +57 -0
- package/es/utils/getTableListColumns.d.ts +20 -0
- package/es/utils/getTableListColumns.js +36 -0
- package/es/utils/index.d.ts +4 -0
- package/es/utils/index.js +4 -0
- package/es/utils/loading.d.ts +3 -0
- package/es/utils/loading.js +25 -0
- package/es/version.d.ts +2 -0
- package/es/version.js +2 -0
- package/lib/blocks/index.d.ts +1 -0
- package/lib/blocks/index.js +5 -0
- package/lib/blocks/shared.d.ts +24 -0
- package/lib/blocks/shared.js +83 -0
- package/lib/components/card/index.d.ts +82 -0
- package/lib/components/card/index.js +368 -0
- package/lib/components/descriptions/index.d.ts +31 -0
- package/lib/components/descriptions/index.js +440 -0
- package/lib/components/field/index.d.ts +75 -0
- package/lib/components/field/index.js +767 -0
- package/lib/components/form/captcha.d.ts +19 -0
- package/lib/components/form/captcha.js +172 -0
- package/lib/components/form/colorPicker.d.ts +7 -0
- package/lib/components/form/colorPicker.js +79 -0
- package/lib/components/form/fieldControls.d.ts +43 -0
- package/lib/components/form/fieldControls.js +288 -0
- package/lib/components/form/index.d.ts +285 -0
- package/lib/components/form/index.js +2332 -0
- package/lib/components/form/loginForm.d.ts +22 -0
- package/lib/components/form/loginForm.js +165 -0
- package/lib/components/form/schemaForm.d.ts +30 -0
- package/lib/components/form/schemaForm.js +651 -0
- package/lib/components/form/stepsForm.d.ts +26 -0
- package/lib/components/form/stepsForm.js +189 -0
- package/lib/components/form/uploadButton.d.ts +20 -0
- package/lib/components/form/uploadButton.js +141 -0
- package/lib/components/form/uploadDragger.d.ts +13 -0
- package/lib/components/form/uploadDragger.js +151 -0
- package/lib/components/index.d.ts +9 -0
- package/lib/components/index.js +104 -0
- package/lib/components/layout/components/Help/index.d.ts +72 -0
- package/lib/components/layout/components/Help/index.js +356 -0
- package/lib/components/layout/index.d.ts +182 -0
- package/lib/components/layout/index.js +930 -0
- package/lib/components/list/index.d.ts +80 -0
- package/lib/components/list/index.js +438 -0
- package/lib/components/provider/context.d.ts +7 -0
- package/lib/components/provider/context.js +27 -0
- package/lib/components/provider/index.d.ts +28 -0
- package/lib/components/provider/index.js +174 -0
- package/lib/components/provider/intl.d.ts +38 -0
- package/lib/components/provider/intl.js +118 -0
- package/lib/components/provider/types.d.ts +37 -0
- package/lib/components/provider/types.js +5 -0
- package/lib/components/provider/useStyle/index.d.ts +28 -0
- package/lib/components/provider/useStyle/index.js +217 -0
- package/lib/components/skeleton/index.d.ts +61 -0
- package/lib/components/skeleton/index.js +394 -0
- package/lib/components/table/dragSortTable.d.ts +8 -0
- package/lib/components/table/dragSortTable.js +236 -0
- package/lib/components/table/editableTable.d.ts +31 -0
- package/lib/components/table/editableTable.js +514 -0
- package/lib/components/table/index.d.ts +52 -0
- package/lib/components/table/index.js +1699 -0
- package/lib/components/table/listToolBar.d.ts +48 -0
- package/lib/components/table/listToolBar.js +200 -0
- package/lib/components/table/search.d.ts +5 -0
- package/lib/components/table/search.js +20 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +49 -0
- package/lib/types.d.ts +219 -0
- package/lib/types.js +5 -0
- package/lib/utils/attachPropertiesToComponent.d.ts +1 -0
- package/lib/utils/attachPropertiesToComponent.js +12 -0
- package/lib/utils/getRequestParams.d.ts +19 -0
- package/lib/utils/getRequestParams.js +63 -0
- package/lib/utils/getTableListColumns.d.ts +20 -0
- package/lib/utils/getTableListColumns.js +42 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +49 -0
- package/lib/utils/loading.d.ts +3 -0
- package/lib/utils/loading.js +31 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.js +8 -0
- package/package.json +68 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ListToolBarTabItem {
|
|
3
|
+
key: string;
|
|
4
|
+
tab: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface ListToolBarMenuItem {
|
|
7
|
+
key: string;
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
tab?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface ListToolBarSearchProps {
|
|
12
|
+
value?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
allowClear?: boolean;
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
|
+
onSearch?: (value: string) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface ListToolBarSetting {
|
|
19
|
+
key?: string;
|
|
20
|
+
icon: React.ReactNode;
|
|
21
|
+
tooltip?: React.ReactNode;
|
|
22
|
+
onClick?: (key?: string) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface ListToolBarProps {
|
|
25
|
+
title?: React.ReactNode;
|
|
26
|
+
subTitle?: React.ReactNode;
|
|
27
|
+
tooltip?: React.ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
variant?: 'card' | 'plain';
|
|
31
|
+
actions?: React.ReactNode[];
|
|
32
|
+
settings?: Array<React.ReactNode | ListToolBarSetting>;
|
|
33
|
+
filter?: React.ReactNode;
|
|
34
|
+
search?: React.ReactNode | ListToolBarSearchProps;
|
|
35
|
+
multipleLine?: boolean;
|
|
36
|
+
menu?: {
|
|
37
|
+
activeKey?: string;
|
|
38
|
+
items?: ListToolBarMenuItem[];
|
|
39
|
+
onChange?: (key: string) => void;
|
|
40
|
+
};
|
|
41
|
+
tabs?: {
|
|
42
|
+
activeKey?: string;
|
|
43
|
+
items?: ListToolBarTabItem[];
|
|
44
|
+
onChange?: (key: string) => void;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export declare const ListToolBar: React.FC<ListToolBarProps>;
|
|
48
|
+
export default ListToolBar;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.ListToolBar = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _button = require("@hanwenbo/x-web-ui/button");
|
|
9
|
+
var _inputItem = require("@hanwenbo/x-web-ui/inputItem");
|
|
10
|
+
var _segmented = require("@hanwenbo/x-web-ui/segmented");
|
|
11
|
+
var _tooltip = require("@hanwenbo/x-web-ui/tooltip");
|
|
12
|
+
var _cn = require("@hanwenbo/x-web-ui/utils/cn");
|
|
13
|
+
var _lucideReact = require("lucide-react");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
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); }
|
|
16
|
+
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 && Object.prototype.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; }
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
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."); }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
24
|
+
var isSearchConfig = function isSearchConfig(search) {
|
|
25
|
+
return !!search && ! /*#__PURE__*/_react.default.isValidElement(search) && _typeof(search) === 'object';
|
|
26
|
+
};
|
|
27
|
+
var isTextLikeNode = function isTextLikeNode(value) {
|
|
28
|
+
return typeof value === 'string' || typeof value === 'number';
|
|
29
|
+
};
|
|
30
|
+
var renderSettingItem = function renderSettingItem(settingNode, index) {
|
|
31
|
+
if ( /*#__PURE__*/_react.default.isValidElement(settingNode)) {
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Fragment, {
|
|
33
|
+
children: settingNode
|
|
34
|
+
}, "toolbar-setting-".concat(index));
|
|
35
|
+
}
|
|
36
|
+
var setting = settingNode;
|
|
37
|
+
var button = /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
className: "inline-flex h-8 items-center justify-center rounded-md border border-transparent px-2.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
40
|
+
onClick: function onClick() {
|
|
41
|
+
var _setting$onClick;
|
|
42
|
+
(_setting$onClick = setting.onClick) === null || _setting$onClick === void 0 || _setting$onClick.call(setting, setting.key);
|
|
43
|
+
},
|
|
44
|
+
children: setting.icon
|
|
45
|
+
}, setting.key || "toolbar-setting-".concat(index));
|
|
46
|
+
if (!setting.tooltip) {
|
|
47
|
+
return button;
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.Tooltip, {
|
|
50
|
+
title: setting.tooltip,
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
52
|
+
"data-list-toolbar-setting-tooltip": true,
|
|
53
|
+
className: "inline-flex",
|
|
54
|
+
children: button
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
var ListToolBar = exports.ListToolBar = function ListToolBar(_ref) {
|
|
59
|
+
var _search$value, _tabItems$, _ref2, _tabs$activeKey, _search$allowClear;
|
|
60
|
+
var title = _ref.title,
|
|
61
|
+
subTitle = _ref.subTitle,
|
|
62
|
+
tooltip = _ref.tooltip,
|
|
63
|
+
className = _ref.className,
|
|
64
|
+
style = _ref.style,
|
|
65
|
+
_ref$variant = _ref.variant,
|
|
66
|
+
variant = _ref$variant === void 0 ? 'card' : _ref$variant,
|
|
67
|
+
actions = _ref.actions,
|
|
68
|
+
settings = _ref.settings,
|
|
69
|
+
filter = _ref.filter,
|
|
70
|
+
search = _ref.search,
|
|
71
|
+
_ref$multipleLine = _ref.multipleLine,
|
|
72
|
+
multipleLine = _ref$multipleLine === void 0 ? false : _ref$multipleLine,
|
|
73
|
+
menu = _ref.menu,
|
|
74
|
+
tabs = _ref.tabs;
|
|
75
|
+
var _useState = (0, _react.useState)(isSearchConfig(search) ? search.value || '' : ''),
|
|
76
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
77
|
+
innerSearch = _useState2[0],
|
|
78
|
+
setInnerSearch = _useState2[1];
|
|
79
|
+
var searchValue = isSearchConfig(search) ? (_search$value = search.value) !== null && _search$value !== void 0 ? _search$value : innerSearch : '';
|
|
80
|
+
var menuItems = (menu === null || menu === void 0 ? void 0 : menu.items) || [];
|
|
81
|
+
var tabItems = (tabs === null || tabs === void 0 ? void 0 : tabs.items) || menuItems.map(function (item) {
|
|
82
|
+
return {
|
|
83
|
+
key: item.key,
|
|
84
|
+
tab: item.tab || item.label
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
var _useState3 = (0, _react.useState)((tabs === null || tabs === void 0 ? void 0 : tabs.activeKey) || (menu === null || menu === void 0 ? void 0 : menu.activeKey) || ((_tabItems$ = tabItems[0]) === null || _tabItems$ === void 0 ? void 0 : _tabItems$.key)),
|
|
88
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
89
|
+
innerTab = _useState4[0],
|
|
90
|
+
setInnerTab = _useState4[1];
|
|
91
|
+
var activeTab = (_ref2 = (_tabs$activeKey = tabs === null || tabs === void 0 ? void 0 : tabs.activeKey) !== null && _tabs$activeKey !== void 0 ? _tabs$activeKey : menu === null || menu === void 0 ? void 0 : menu.activeKey) !== null && _ref2 !== void 0 ? _ref2 : innerTab;
|
|
92
|
+
var tabOptions = (0, _react.useMemo)(function () {
|
|
93
|
+
return tabItems.map(function (item) {
|
|
94
|
+
return {
|
|
95
|
+
label: item.tab,
|
|
96
|
+
value: item.key
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
}, [tabItems]);
|
|
100
|
+
var hasHeading = Boolean(title || subTitle);
|
|
101
|
+
var titleNode = title ? isTextLikeNode(title) ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
102
|
+
className: "flex min-w-0 items-center gap-2",
|
|
103
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
104
|
+
className: "truncate text-base font-semibold text-foreground",
|
|
105
|
+
children: title
|
|
106
|
+
}), tooltip ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.Tooltip, {
|
|
107
|
+
title: tooltip,
|
|
108
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
109
|
+
"data-list-toolbar-title-tooltip": true,
|
|
110
|
+
className: "inline-flex shrink-0",
|
|
111
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReact.CircleHelp, {
|
|
112
|
+
className: "h-4 w-4 text-muted-foreground"
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
}) : null]
|
|
116
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
117
|
+
className: "min-w-0",
|
|
118
|
+
children: title
|
|
119
|
+
}) : null;
|
|
120
|
+
var businessActions = actions !== null && actions !== void 0 && actions.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
121
|
+
className: "flex flex-wrap items-center gap-2",
|
|
122
|
+
children: actions
|
|
123
|
+
}) : null;
|
|
124
|
+
var systemActions = settings !== null && settings !== void 0 && settings.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
125
|
+
className: "flex flex-wrap items-center gap-0.5",
|
|
126
|
+
children: settings.map(renderSettingItem)
|
|
127
|
+
}) : null;
|
|
128
|
+
var leftContent = hasHeading ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
129
|
+
className: "min-w-0 flex-1",
|
|
130
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
131
|
+
className: "flex flex-wrap items-center gap-2.5",
|
|
132
|
+
children: [titleNode, businessActions]
|
|
133
|
+
}), subTitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
134
|
+
className: "mt-0.5 text-xs text-muted-foreground",
|
|
135
|
+
children: subTitle
|
|
136
|
+
}) : null]
|
|
137
|
+
}) : businessActions ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
138
|
+
className: "flex min-w-0 flex-1 flex-wrap items-center gap-2",
|
|
139
|
+
children: businessActions
|
|
140
|
+
}) : null;
|
|
141
|
+
var rightContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
142
|
+
children: [multipleLine ? null : filter, isSearchConfig(search) ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
143
|
+
className: "flex flex-wrap items-center gap-2",
|
|
144
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_inputItem.InputItem, {
|
|
145
|
+
value: searchValue,
|
|
146
|
+
placeholder: search.placeholder || '请输入关键词',
|
|
147
|
+
allowClear: (_search$allowClear = search.allowClear) !== null && _search$allowClear !== void 0 ? _search$allowClear : true,
|
|
148
|
+
className: "min-w-[220px]",
|
|
149
|
+
onChange: function onChange(value) {
|
|
150
|
+
var _search$onChange;
|
|
151
|
+
setInnerSearch(value);
|
|
152
|
+
(_search$onChange = search.onChange) === null || _search$onChange === void 0 || _search$onChange.call(search, value);
|
|
153
|
+
},
|
|
154
|
+
onKeyDown: function onKeyDown(event) {
|
|
155
|
+
if (event.key === 'Enter') {
|
|
156
|
+
var _search$onSearch;
|
|
157
|
+
(_search$onSearch = search.onSearch) === null || _search$onSearch === void 0 || _search$onSearch.call(search, searchValue);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
|
|
161
|
+
htmlType: "button",
|
|
162
|
+
onClick: function onClick() {
|
|
163
|
+
var _search$onSearch2;
|
|
164
|
+
(_search$onSearch2 = search.onSearch) === null || _search$onSearch2 === void 0 || _search$onSearch2.call(search, searchValue);
|
|
165
|
+
},
|
|
166
|
+
children: "\u641C\u7D22"
|
|
167
|
+
})]
|
|
168
|
+
}) : search, systemActions]
|
|
169
|
+
});
|
|
170
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
171
|
+
className: (0, _cn.cn)(variant === 'card' ? 'rounded-2xl border border-border bg-card px-4 py-4' : '', className),
|
|
172
|
+
style: style,
|
|
173
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
174
|
+
className: "flex flex-col gap-3",
|
|
175
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
176
|
+
className: (0, _cn.cn)('flex flex-col gap-2 lg:flex-row lg:items-start', hasHeading ? 'lg:gap-3' : 'lg:gap-2.5'),
|
|
177
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
178
|
+
className: "min-w-0 flex-1",
|
|
179
|
+
children: leftContent
|
|
180
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
181
|
+
className: "flex shrink-0 flex-wrap items-center gap-2 lg:ml-auto lg:justify-end lg:self-start",
|
|
182
|
+
children: rightContent
|
|
183
|
+
})]
|
|
184
|
+
}), tabOptions.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_segmented.Segmented, {
|
|
185
|
+
options: tabOptions,
|
|
186
|
+
value: activeTab,
|
|
187
|
+
onChange: function onChange(value) {
|
|
188
|
+
var _tabs$onChange, _menu$onChange;
|
|
189
|
+
var nextKey = String(value);
|
|
190
|
+
setInnerTab(nextKey);
|
|
191
|
+
tabs === null || tabs === void 0 || (_tabs$onChange = tabs.onChange) === null || _tabs$onChange === void 0 || _tabs$onChange.call(tabs, nextKey);
|
|
192
|
+
menu === null || menu === void 0 || (_menu$onChange = menu.onChange) === null || _menu$onChange === void 0 || _menu$onChange.call(menu, nextKey);
|
|
193
|
+
}
|
|
194
|
+
}) : null, multipleLine && filter ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
195
|
+
children: filter
|
|
196
|
+
}) : null]
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
var _default = exports.default = ListToolBar;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QueryLikeFormProps } from '../form';
|
|
3
|
+
export declare type SearchProps<Values = Record<string, any>> = QueryLikeFormProps<Values>;
|
|
4
|
+
export declare const Search: <Values extends Record<string, any> = Record<string, any>>(props: SearchProps<Values>) => React.JSX.Element;
|
|
5
|
+
export default Search;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Search = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _form = require("../form");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
var Search = exports.Search = function Search(props) {
|
|
18
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_form.QueryFilter, _objectSpread({}, props));
|
|
19
|
+
};
|
|
20
|
+
var _default = exports.default = Search;
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _types = require("./types");
|
|
7
|
+
Object.keys(_types).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _types[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _components = require("./components");
|
|
18
|
+
Object.keys(_components).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _components[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _components[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _utils = require("./utils");
|
|
29
|
+
Object.keys(_utils).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _utils[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _version = require("./version");
|
|
40
|
+
Object.keys(_version).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _version[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _version[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { type FormInstance, type FormItemProps, type NamePath } from '@hanwenbo/x-web-ui/form';
|
|
3
|
+
import { type ButtonProps } from '@hanwenbo/x-web-ui/button';
|
|
4
|
+
import { type CardProps } from '@hanwenbo/x-web-ui/card';
|
|
5
|
+
import { type TableColumnType, type TableProps } from '@hanwenbo/x-web-ui/table';
|
|
6
|
+
export declare type ProFieldFCMode = 'read' | 'edit' | 'update';
|
|
7
|
+
export declare type ProSchemaComponentTypes = 'table' | 'form' | 'descriptions' | 'list';
|
|
8
|
+
export declare type ProFieldValueType = 'text' | 'textarea' | 'digit' | 'digitRange' | 'money' | 'percent' | 'date' | 'dateMonth' | 'dateYear' | 'dateTime' | 'time' | 'dateRange' | 'dateMonthRange' | 'dateQuarterRange' | 'dateTimeRange' | 'dateWeekRange' | 'dateYearRange' | 'timeRange' | 'password' | 'fromNow' | 'second' | 'code' | 'jsonCode' | 'color' | 'select' | 'checkbox' | 'radio' | 'cascader' | 'treeSelect' | 'segmented' | 'switch' | 'rate' | 'progress' | 'option' | 'tag' | 'status' | 'image' | 'img' | 'avatar' | 'index' | 'indexBorder' | (string & {});
|
|
9
|
+
export declare type ProFieldEmptyText = React.ReactNode;
|
|
10
|
+
export declare type ProSchemaValueEnumType = {
|
|
11
|
+
text: React.ReactNode;
|
|
12
|
+
status?: 'default' | 'success' | 'processing' | 'warning' | 'error' | 'Default' | 'Success' | 'Processing' | 'Warning' | 'Error';
|
|
13
|
+
color?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare type ProSchemaValueEnumMap = Map<string | number | boolean, ProSchemaValueEnumType | React.ReactNode>;
|
|
17
|
+
export declare type ProSchemaValueEnumObj = Record<string, ProSchemaValueEnumType | React.ReactNode>;
|
|
18
|
+
export declare type ProSchemaValueEnum = ProSchemaValueEnumObj | ProSchemaValueEnumMap;
|
|
19
|
+
export declare type ProRenderFieldPropsType = {
|
|
20
|
+
render?: (text: any, props: Record<string, any>, dom: React.JSX.Element) => React.JSX.Element | null;
|
|
21
|
+
formItemRender?: (text: any, props: Record<string, any>, dom: React.JSX.Element) => React.JSX.Element | null;
|
|
22
|
+
};
|
|
23
|
+
export interface RequestData<T> {
|
|
24
|
+
data?: T[];
|
|
25
|
+
success?: boolean;
|
|
26
|
+
total?: number;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
export declare type ActionType = {
|
|
30
|
+
reload: () => Promise<void>;
|
|
31
|
+
reloadAndRest?: () => Promise<void>;
|
|
32
|
+
reset: () => void;
|
|
33
|
+
fullScreen?: () => void;
|
|
34
|
+
setPageInfo?: (pageInfo: Partial<{
|
|
35
|
+
current: number;
|
|
36
|
+
pageSize: number;
|
|
37
|
+
}>) => void;
|
|
38
|
+
clearSelected?: () => void;
|
|
39
|
+
};
|
|
40
|
+
export interface ProColumnType<RecordType = any, ValueType = 'text'> extends Omit<TableColumnType<RecordType>, 'render'> {
|
|
41
|
+
valueType?: ValueType | ProFieldValueType;
|
|
42
|
+
valueEnum?: ProSchemaValueEnum;
|
|
43
|
+
tooltip?: React.ReactNode | {
|
|
44
|
+
title?: React.ReactNode;
|
|
45
|
+
};
|
|
46
|
+
copyable?: boolean | {
|
|
47
|
+
text?: string;
|
|
48
|
+
onCopy?: (text: string) => void | Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
editable?: boolean | ((text: any, record: RecordType, index: number) => boolean);
|
|
51
|
+
hideInSearch?: boolean;
|
|
52
|
+
hideInTable?: boolean;
|
|
53
|
+
hideInDescriptions?: boolean;
|
|
54
|
+
hideInList?: boolean;
|
|
55
|
+
hideInForm?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 普通 Schema 表单的字段默认值。
|
|
58
|
+
* ProTable、QueryFilter 与 LightFilter 等搜索场景不会读取该值。
|
|
59
|
+
*/
|
|
60
|
+
initialValue?: any;
|
|
61
|
+
/**
|
|
62
|
+
* 搜索字段的显式默认值。
|
|
63
|
+
* 仅在 ProTable、QueryFilter 与 LightFilter 等搜索场景生效,并以组件挂载时的配置
|
|
64
|
+
* 作为首次请求与重置基线。需要切换整组搜索初值时,应使用新的组件 key 明确重建。
|
|
65
|
+
*/
|
|
66
|
+
searchInitialValue?: any;
|
|
67
|
+
order?: number;
|
|
68
|
+
request?: (params?: Record<string, any>) => Promise<any[]>;
|
|
69
|
+
params?: Record<string, any>;
|
|
70
|
+
search?: boolean | {
|
|
71
|
+
transform?: (value: any) => Record<string, any>;
|
|
72
|
+
};
|
|
73
|
+
name?: NamePath;
|
|
74
|
+
dependencies?: NamePath[];
|
|
75
|
+
defaultKeyWords?: string;
|
|
76
|
+
debounceTime?: number;
|
|
77
|
+
formItemProps?: FormItemProps | ((form: FormInstance<RecordType>, schema: ProColumnType<RecordType, ValueType>) => FormItemProps);
|
|
78
|
+
fieldProps?: Record<string, any> | ((form: FormInstance<RecordType>, schema: ProColumnType<RecordType, ValueType>) => Record<string, any>);
|
|
79
|
+
columns?: ProColumnType<RecordType, ValueType | ProFieldValueType>[] | ProColumnType<RecordType, ValueType | ProFieldValueType>[][] | ((values: Record<string, any>) => ProColumnType<RecordType, ValueType | ProFieldValueType>[]);
|
|
80
|
+
readonly?: boolean;
|
|
81
|
+
ignoreFormItem?: boolean;
|
|
82
|
+
convertValue?: (value: any, namePath: NamePath, allValues?: Record<string, any>) => any;
|
|
83
|
+
transform?: (value: any, namePath: NamePath, allValues?: Record<string, any>) => any;
|
|
84
|
+
renderFormItem?: (schema: ProColumnType<RecordType, ValueType>, config: {
|
|
85
|
+
type: ProSchemaComponentTypes;
|
|
86
|
+
}, form: FormInstance<RecordType>) => React.ReactNode;
|
|
87
|
+
formItemRender?: (schema: ProColumnType<RecordType, ValueType>, config: {
|
|
88
|
+
type: ProSchemaComponentTypes;
|
|
89
|
+
}, form: FormInstance<RecordType>) => React.ReactNode;
|
|
90
|
+
listSlot?: 'title' | 'subTitle' | 'avatar' | 'description' | 'content' | 'actions' | 'aside' | 'type' | (string & {});
|
|
91
|
+
renderText?: (value: any, record: RecordType, index: number) => React.ReactNode;
|
|
92
|
+
render?: (value: any, record: RecordType, index: number) => React.ReactNode;
|
|
93
|
+
}
|
|
94
|
+
export declare type ProColumns<RecordType = any, ValueType = 'text'> = ProColumnType<RecordType, ValueType>[];
|
|
95
|
+
export declare type SubmitterProps = {
|
|
96
|
+
submitButtonProps?: Record<string, any>;
|
|
97
|
+
resetButtonProps?: Record<string, any>;
|
|
98
|
+
collapseButtonProps?: Record<string, any>;
|
|
99
|
+
searchConfig?: {
|
|
100
|
+
submitText?: React.ReactNode;
|
|
101
|
+
resetText?: React.ReactNode;
|
|
102
|
+
};
|
|
103
|
+
render?: ((props: SubmitterProps, dom: React.ReactNode[]) => React.ReactNode[] | React.ReactNode | false) | false;
|
|
104
|
+
};
|
|
105
|
+
export interface ProFormFieldItemProps<T = Record<string, any>> extends Omit<FormItemProps, 'children'> {
|
|
106
|
+
fieldProps?: T;
|
|
107
|
+
placeholder?: string | string[];
|
|
108
|
+
valueType?: ProFieldValueType;
|
|
109
|
+
width?: number | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
110
|
+
emptyText?: React.ReactNode;
|
|
111
|
+
secondary?: boolean;
|
|
112
|
+
allowClear?: boolean;
|
|
113
|
+
bordered?: boolean;
|
|
114
|
+
colSize?: number;
|
|
115
|
+
readonly?: boolean;
|
|
116
|
+
cacheForSwr?: boolean;
|
|
117
|
+
convertValue?: (value: any, namePath: NamePath, allValues?: Record<string, any>) => any;
|
|
118
|
+
formItemProps?: FormItemProps;
|
|
119
|
+
fieldConfig?: Record<string, any>;
|
|
120
|
+
fieldRef?: React.Ref<any>;
|
|
121
|
+
footerRender?: ((onConfirm?: (e?: React.MouseEvent) => void, onClear?: (e?: React.MouseEvent) => void) => React.ReactNode | false) | false;
|
|
122
|
+
}
|
|
123
|
+
export interface ProFormInstance<T = any> extends FormInstance<T> {
|
|
124
|
+
}
|
|
125
|
+
export interface ProFormDependencyProps {
|
|
126
|
+
name: NamePath[];
|
|
127
|
+
children: (values: Record<string, any>, form: FormInstance<any>) => React.ReactNode;
|
|
128
|
+
}
|
|
129
|
+
export interface ProTableProps<RecordType = any, Params extends Record<string, any> = Record<string, any>> extends Omit<TableProps<RecordType>, 'columns' | 'dataSource' | 'title'> {
|
|
130
|
+
columns: ProColumns<RecordType>;
|
|
131
|
+
params?: Params;
|
|
132
|
+
request?: (params: Params & {
|
|
133
|
+
current?: number;
|
|
134
|
+
pageSize?: number;
|
|
135
|
+
}, sort: Record<string, any>, filter: Record<string, any>) => Promise<RequestData<RecordType>>;
|
|
136
|
+
dataSource?: RecordType[];
|
|
137
|
+
actionRef?: React.MutableRefObject<ActionType | undefined>;
|
|
138
|
+
formRef?: React.MutableRefObject<FormInstance<any> | undefined>;
|
|
139
|
+
search?: boolean | Record<string, any>;
|
|
140
|
+
beforeSearchSubmit?: (params: Record<string, any>) => Params | Record<string, any>;
|
|
141
|
+
optionsRender?: ((props: Record<string, any>) => React.ReactNode) | false | React.ReactNode | null;
|
|
142
|
+
searchFormRender?: (props: ProTableProps<RecordType, Params>, dom: JSX.Element) => React.ReactNode;
|
|
143
|
+
tableRender?: (props: ProTableProps<RecordType, Params>, dom: JSX.Element, domList: {
|
|
144
|
+
toolbar: React.ReactNode;
|
|
145
|
+
alert: React.ReactNode;
|
|
146
|
+
table: React.ReactNode;
|
|
147
|
+
}) => React.ReactNode;
|
|
148
|
+
tableExtraRender?: (props: ProTableProps<RecordType, Params>, dataSource: RecordType[]) => React.ReactNode;
|
|
149
|
+
tableClassName?: string;
|
|
150
|
+
tableStyle?: React.CSSProperties;
|
|
151
|
+
onLoad?: (dataSource: RecordType[]) => void;
|
|
152
|
+
onLoadingChange?: (loading: boolean | undefined) => void;
|
|
153
|
+
onRequestError?: (error: Error) => void;
|
|
154
|
+
onSizeChange?: (size: 'large' | 'middle' | 'small' | 'mini') => void;
|
|
155
|
+
tableAlertRender?: ((props: {
|
|
156
|
+
selectedRowKeys: React.Key[];
|
|
157
|
+
selectedRows: RecordType[];
|
|
158
|
+
}) => React.ReactNode) | false;
|
|
159
|
+
tableAlertOptionRender?: ((props: {
|
|
160
|
+
selectedRowKeys: React.Key[];
|
|
161
|
+
selectedRows: RecordType[];
|
|
162
|
+
}) => React.ReactNode) | false;
|
|
163
|
+
/**
|
|
164
|
+
* 透传给 ProTable 外层 Card 的参数。
|
|
165
|
+
* 可用于调整边框、内边距、样式等外层样式变量,不修改 Card 默认实现。
|
|
166
|
+
*/
|
|
167
|
+
cardProps?: Omit<CardProps, 'children'>;
|
|
168
|
+
/**
|
|
169
|
+
* 分页布局方式。`outside` 会把底部分页渲染到表格 Card 外部。
|
|
170
|
+
*/
|
|
171
|
+
paginationLayout?: 'inside' | 'outside';
|
|
172
|
+
/**
|
|
173
|
+
* 分页尺寸。未指定时会回退到内部默认策略。
|
|
174
|
+
*/
|
|
175
|
+
paginationSize?: 'mini' | 'small' | 'middle' | 'large';
|
|
176
|
+
options?: boolean | {
|
|
177
|
+
variant?: 'icon' | 'textDropdown';
|
|
178
|
+
dropdownText?: React.ReactNode;
|
|
179
|
+
/**
|
|
180
|
+
* 渲染在 textDropdown 下拉菜单顶部的自定义内容,位于密度设置前。
|
|
181
|
+
* 可用于放置视图切换等轻量工具。
|
|
182
|
+
*/
|
|
183
|
+
dropdownHeader?: React.ReactNode;
|
|
184
|
+
size?: ButtonProps['size'];
|
|
185
|
+
reload?: boolean;
|
|
186
|
+
density?: boolean;
|
|
187
|
+
setting?: boolean;
|
|
188
|
+
fullScreen?: boolean;
|
|
189
|
+
search?: boolean | {
|
|
190
|
+
name?: string;
|
|
191
|
+
placeholder?: string;
|
|
192
|
+
onSearch?: (value: string) => void | false | Promise<void | false>;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
columnsState?: {
|
|
196
|
+
value?: Record<string, {
|
|
197
|
+
fixed?: 'left' | 'right';
|
|
198
|
+
show?: boolean;
|
|
199
|
+
}>;
|
|
200
|
+
defaultValue?: Record<string, {
|
|
201
|
+
fixed?: 'left' | 'right';
|
|
202
|
+
show?: boolean;
|
|
203
|
+
}>;
|
|
204
|
+
onChange?: (value: Record<string, {
|
|
205
|
+
fixed?: 'left' | 'right';
|
|
206
|
+
show?: boolean;
|
|
207
|
+
}>) => void;
|
|
208
|
+
persistenceKey?: string;
|
|
209
|
+
persistenceType?: 'localStorage' | 'sessionStorage';
|
|
210
|
+
};
|
|
211
|
+
headerTitle?: React.ReactNode;
|
|
212
|
+
toolbar?: {
|
|
213
|
+
search?: {
|
|
214
|
+
onSearch?: (value: string) => void | false | Promise<void | false>;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
toolBarRender?: false | ((action: ActionType | undefined, rows?: RecordType[]) => React.ReactNode[] | React.ReactNode);
|
|
218
|
+
onDataSourceChange?: (dataSource: RecordType[]) => void;
|
|
219
|
+
}
|
package/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function attachPropertiesToComponent<ComponentType extends Record<string, any>, Properties extends Record<string, any>>(component: ComponentType, properties: Properties): ComponentType & Properties;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.attachPropertiesToComponent = attachPropertiesToComponent;
|
|
7
|
+
function attachPropertiesToComponent(component, properties) {
|
|
8
|
+
Object.keys(properties).forEach(function (key) {
|
|
9
|
+
component[key] = properties[key];
|
|
10
|
+
});
|
|
11
|
+
return component;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface RequestParams {
|
|
2
|
+
current?: number;
|
|
3
|
+
pageSize?: number;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface SorterParams {
|
|
7
|
+
[key: string]: 'ascend' | 'descend' | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface Payload {
|
|
10
|
+
page: number;
|
|
11
|
+
rows: number;
|
|
12
|
+
sortby?: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare const getRequestParams: ({ params, sorter, filter: _ }: {
|
|
16
|
+
params?: RequestParams | undefined;
|
|
17
|
+
sorter?: SorterParams | undefined;
|
|
18
|
+
filter?: unknown;
|
|
19
|
+
}) => Payload;
|