@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,350 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { createContext, useContext, useMemo, useState } from 'react';
|
|
14
|
+
import { Button } from '@hanwenbo/x-web-ui/button';
|
|
15
|
+
import { InputItem } from '@hanwenbo/x-web-ui/inputItem';
|
|
16
|
+
import { Modal } from '@hanwenbo/x-web-ui/modal';
|
|
17
|
+
import { Popup } from '@hanwenbo/x-web-ui/popup';
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
export var ProHelpProvide = /*#__PURE__*/createContext({
|
|
22
|
+
dataSource: [],
|
|
23
|
+
valueTypeMap: new Map()
|
|
24
|
+
});
|
|
25
|
+
var flattenHelpItems = function flattenHelpItems(items) {
|
|
26
|
+
var bucket = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
27
|
+
items.forEach(function (item) {
|
|
28
|
+
var _item$children;
|
|
29
|
+
bucket.push(item);
|
|
30
|
+
if ((_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
|
|
31
|
+
flattenHelpItems(item.children, bucket);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return bucket;
|
|
35
|
+
};
|
|
36
|
+
var renderHelpNode = function renderHelpNode(item, valueTypeMap, index) {
|
|
37
|
+
var _item$children2;
|
|
38
|
+
var customRender = item.valueType ? valueTypeMap.get(item.valueType) : undefined;
|
|
39
|
+
if (customRender) {
|
|
40
|
+
return customRender(item, index);
|
|
41
|
+
}
|
|
42
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
43
|
+
className: "space-y-2",
|
|
44
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
45
|
+
className: "text-sm font-medium text-foreground",
|
|
46
|
+
children: item.title
|
|
47
|
+
}), item.value ? /*#__PURE__*/_jsx("div", {
|
|
48
|
+
className: "text-sm leading-6 text-muted-foreground",
|
|
49
|
+
children: item.value
|
|
50
|
+
}) : null, (_item$children2 = item.children) !== null && _item$children2 !== void 0 && _item$children2.length ? /*#__PURE__*/_jsx("div", {
|
|
51
|
+
className: "space-y-3 border-l border-border pl-4",
|
|
52
|
+
children: item.children.map(function (child, childIndex) {
|
|
53
|
+
return /*#__PURE__*/_jsx("div", {
|
|
54
|
+
children: renderHelpNode(child, valueTypeMap, childIndex)
|
|
55
|
+
}, String(child.key));
|
|
56
|
+
})
|
|
57
|
+
}) : null]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export var ProHelpContentPanel = function ProHelpContentPanel(_ref) {
|
|
61
|
+
var selectedKey = _ref.selectedKey,
|
|
62
|
+
className = _ref.className;
|
|
63
|
+
var _useContext = useContext(ProHelpProvide),
|
|
64
|
+
dataSource = _useContext.dataSource,
|
|
65
|
+
valueTypeMap = _useContext.valueTypeMap,
|
|
66
|
+
onLoadContext = _useContext.onLoadContext;
|
|
67
|
+
var _useState = useState(null),
|
|
68
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
69
|
+
loadedChildren = _useState2[0],
|
|
70
|
+
setLoadedChildren = _useState2[1];
|
|
71
|
+
var item = flattenHelpItems(dataSource.flatMap(function (group) {
|
|
72
|
+
return group.children;
|
|
73
|
+
})).find(function (current) {
|
|
74
|
+
return String(current.key) === String(selectedKey);
|
|
75
|
+
});
|
|
76
|
+
React.useEffect(function () {
|
|
77
|
+
setLoadedChildren(null);
|
|
78
|
+
}, [selectedKey]);
|
|
79
|
+
React.useEffect(function () {
|
|
80
|
+
var _item$children3;
|
|
81
|
+
var active = true;
|
|
82
|
+
if (!item || (_item$children3 = item.children) !== null && _item$children3 !== void 0 && _item$children3.length || !onLoadContext) {
|
|
83
|
+
return function () {
|
|
84
|
+
active = false;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
Promise.resolve(onLoadContext(item.key, item)).then(function (children) {
|
|
88
|
+
if (active) {
|
|
89
|
+
setLoadedChildren(children || []);
|
|
90
|
+
}
|
|
91
|
+
}).catch(function () {
|
|
92
|
+
if (active) {
|
|
93
|
+
setLoadedChildren([]);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return function () {
|
|
97
|
+
active = false;
|
|
98
|
+
};
|
|
99
|
+
}, [item, onLoadContext]);
|
|
100
|
+
if (!item) {
|
|
101
|
+
return /*#__PURE__*/_jsx("div", {
|
|
102
|
+
className: className,
|
|
103
|
+
children: "\u6682\u65E0\u5E2E\u52A9\u5185\u5BB9"
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
var mergedItem = loadedChildren ? _objectSpread(_objectSpread({}, item), {}, {
|
|
107
|
+
children: loadedChildren
|
|
108
|
+
}) : item;
|
|
109
|
+
return /*#__PURE__*/_jsx("div", {
|
|
110
|
+
className: className,
|
|
111
|
+
children: renderHelpNode(mergedItem, valueTypeMap, 0)
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
export var RenderContentPanel = ProHelpContentPanel;
|
|
115
|
+
export var ProHelpSelect = function ProHelpSelect(_ref2) {
|
|
116
|
+
var value = _ref2.value,
|
|
117
|
+
onChange = _ref2.onChange;
|
|
118
|
+
var _useContext2 = useContext(ProHelpProvide),
|
|
119
|
+
dataSource = _useContext2.dataSource;
|
|
120
|
+
var _useState3 = useState(''),
|
|
121
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
122
|
+
keyword = _useState4[0],
|
|
123
|
+
setKeyword = _useState4[1];
|
|
124
|
+
var options = useMemo(function () {
|
|
125
|
+
return flattenHelpItems(dataSource.flatMap(function (group) {
|
|
126
|
+
return group.children;
|
|
127
|
+
})).filter(function (item) {
|
|
128
|
+
return String(item.title).toLowerCase().includes(keyword.toLowerCase());
|
|
129
|
+
});
|
|
130
|
+
}, [dataSource, keyword]);
|
|
131
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
132
|
+
className: "space-y-3",
|
|
133
|
+
children: [/*#__PURE__*/_jsx(InputItem, {
|
|
134
|
+
value: keyword,
|
|
135
|
+
onChange: setKeyword,
|
|
136
|
+
placeholder: "\u641C\u7D22\u5E2E\u52A9\u5185\u5BB9",
|
|
137
|
+
allowClear: true
|
|
138
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
139
|
+
className: "space-y-2",
|
|
140
|
+
children: options.map(function (item) {
|
|
141
|
+
return /*#__PURE__*/_jsx("button", {
|
|
142
|
+
type: "button",
|
|
143
|
+
className: "hover:bg-muted/30 flex w-full items-start rounded-xl border border-border px-3 py-2 text-left text-sm text-foreground",
|
|
144
|
+
onClick: function onClick() {
|
|
145
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(item.key);
|
|
146
|
+
},
|
|
147
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
148
|
+
className: String(value) === String(item.key) ? 'font-medium text-primary' : '',
|
|
149
|
+
children: item.title
|
|
150
|
+
})
|
|
151
|
+
}, String(item.key));
|
|
152
|
+
})
|
|
153
|
+
})]
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
export var ProHelpPanel = function ProHelpPanel(_ref3) {
|
|
157
|
+
var _dataSource$;
|
|
158
|
+
var defaultSelectedKey = _ref3.defaultSelectedKey;
|
|
159
|
+
var _useContext3 = useContext(ProHelpProvide),
|
|
160
|
+
dataSource = _useContext3.dataSource;
|
|
161
|
+
var fallbackKey = defaultSelectedKey !== null && defaultSelectedKey !== void 0 ? defaultSelectedKey : (_dataSource$ = dataSource[0]) === null || _dataSource$ === void 0 || (_dataSource$ = _dataSource$.children) === null || _dataSource$ === void 0 || (_dataSource$ = _dataSource$[0]) === null || _dataSource$ === void 0 ? void 0 : _dataSource$.key;
|
|
162
|
+
var _useState5 = useState(fallbackKey),
|
|
163
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
164
|
+
selectedKey = _useState6[0],
|
|
165
|
+
setSelectedKey = _useState6[1];
|
|
166
|
+
React.useEffect(function () {
|
|
167
|
+
setSelectedKey(fallbackKey);
|
|
168
|
+
}, [fallbackKey]);
|
|
169
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
170
|
+
className: "grid gap-4 md:grid-cols-[280px_minmax(0,1fr)]",
|
|
171
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
172
|
+
className: "rounded-2xl border border-border bg-card p-4",
|
|
173
|
+
children: /*#__PURE__*/_jsx(ProHelpSelect, {
|
|
174
|
+
value: selectedKey,
|
|
175
|
+
onChange: setSelectedKey
|
|
176
|
+
})
|
|
177
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
178
|
+
className: "rounded-2xl border border-border bg-card p-5",
|
|
179
|
+
children: selectedKey ? /*#__PURE__*/_jsx(ProHelpContentPanel, {
|
|
180
|
+
selectedKey: selectedKey
|
|
181
|
+
}) : '暂无帮助内容'
|
|
182
|
+
})]
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
export var ProHelpPopover = function ProHelpPopover(_ref4) {
|
|
186
|
+
var open = _ref4.open,
|
|
187
|
+
onOpenChange = _ref4.onOpenChange,
|
|
188
|
+
trigger = _ref4.trigger,
|
|
189
|
+
dataSource = _ref4.dataSource,
|
|
190
|
+
valueTypeMap = _ref4.valueTypeMap,
|
|
191
|
+
onLoadContext = _ref4.onLoadContext,
|
|
192
|
+
defaultSelectedKey = _ref4.defaultSelectedKey;
|
|
193
|
+
var _useState7 = useState(false),
|
|
194
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
195
|
+
innerOpen = _useState8[0],
|
|
196
|
+
setInnerOpen = _useState8[1];
|
|
197
|
+
var mergedOpen = open !== null && open !== void 0 ? open : innerOpen;
|
|
198
|
+
var updateOpen = function updateOpen(nextOpen) {
|
|
199
|
+
if (open === undefined) {
|
|
200
|
+
setInnerOpen(nextOpen);
|
|
201
|
+
}
|
|
202
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(nextOpen);
|
|
203
|
+
};
|
|
204
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
205
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
206
|
+
onClick: function onClick() {
|
|
207
|
+
return updateOpen(true);
|
|
208
|
+
},
|
|
209
|
+
children: trigger || /*#__PURE__*/_jsx(Button, {
|
|
210
|
+
size: "small",
|
|
211
|
+
children: "\u6253\u5F00\u5E2E\u52A9"
|
|
212
|
+
})
|
|
213
|
+
}), /*#__PURE__*/_jsx(Popup, {
|
|
214
|
+
visible: mergedOpen,
|
|
215
|
+
onMaskPress: function onMaskPress() {
|
|
216
|
+
return updateOpen(false);
|
|
217
|
+
},
|
|
218
|
+
position: "center",
|
|
219
|
+
bodyStyle: {
|
|
220
|
+
minWidth: 720
|
|
221
|
+
},
|
|
222
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
223
|
+
className: "max-h-[80vh] overflow-auto p-5",
|
|
224
|
+
children: /*#__PURE__*/_jsx(ProHelp, {
|
|
225
|
+
dataSource: dataSource || [],
|
|
226
|
+
valueTypeMap: valueTypeMap,
|
|
227
|
+
onLoadContext: onLoadContext,
|
|
228
|
+
children: /*#__PURE__*/_jsx(ProHelpPanel, {
|
|
229
|
+
defaultSelectedKey: defaultSelectedKey
|
|
230
|
+
})
|
|
231
|
+
})
|
|
232
|
+
})
|
|
233
|
+
})]
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
export var ProHelpDrawer = function ProHelpDrawer(_ref5) {
|
|
237
|
+
var open = _ref5.open,
|
|
238
|
+
onOpenChange = _ref5.onOpenChange,
|
|
239
|
+
trigger = _ref5.trigger,
|
|
240
|
+
dataSource = _ref5.dataSource,
|
|
241
|
+
valueTypeMap = _ref5.valueTypeMap,
|
|
242
|
+
onLoadContext = _ref5.onLoadContext,
|
|
243
|
+
defaultSelectedKey = _ref5.defaultSelectedKey;
|
|
244
|
+
var _useState9 = useState(false),
|
|
245
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
246
|
+
innerOpen = _useState10[0],
|
|
247
|
+
setInnerOpen = _useState10[1];
|
|
248
|
+
var mergedOpen = open !== null && open !== void 0 ? open : innerOpen;
|
|
249
|
+
var updateOpen = function updateOpen(nextOpen) {
|
|
250
|
+
if (open === undefined) {
|
|
251
|
+
setInnerOpen(nextOpen);
|
|
252
|
+
}
|
|
253
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(nextOpen);
|
|
254
|
+
};
|
|
255
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
256
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
257
|
+
onClick: function onClick() {
|
|
258
|
+
return updateOpen(true);
|
|
259
|
+
},
|
|
260
|
+
children: trigger || /*#__PURE__*/_jsx(Button, {
|
|
261
|
+
size: "small",
|
|
262
|
+
children: "\u6253\u5F00\u5E2E\u52A9"
|
|
263
|
+
})
|
|
264
|
+
}), /*#__PURE__*/_jsx(Popup, {
|
|
265
|
+
visible: mergedOpen,
|
|
266
|
+
onMaskPress: function onMaskPress() {
|
|
267
|
+
return updateOpen(false);
|
|
268
|
+
},
|
|
269
|
+
position: "right",
|
|
270
|
+
bodyStyle: {
|
|
271
|
+
width: 860,
|
|
272
|
+
maxWidth: '100vw'
|
|
273
|
+
},
|
|
274
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
275
|
+
className: "h-full overflow-auto p-5",
|
|
276
|
+
children: /*#__PURE__*/_jsx(ProHelp, {
|
|
277
|
+
dataSource: dataSource || [],
|
|
278
|
+
valueTypeMap: valueTypeMap,
|
|
279
|
+
onLoadContext: onLoadContext,
|
|
280
|
+
children: /*#__PURE__*/_jsx(ProHelpPanel, {
|
|
281
|
+
defaultSelectedKey: defaultSelectedKey
|
|
282
|
+
})
|
|
283
|
+
})
|
|
284
|
+
})
|
|
285
|
+
})]
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
export var ProHelpModal = function ProHelpModal(_ref6) {
|
|
289
|
+
var open = _ref6.open,
|
|
290
|
+
onOpenChange = _ref6.onOpenChange,
|
|
291
|
+
trigger = _ref6.trigger,
|
|
292
|
+
dataSource = _ref6.dataSource,
|
|
293
|
+
valueTypeMap = _ref6.valueTypeMap,
|
|
294
|
+
onLoadContext = _ref6.onLoadContext,
|
|
295
|
+
defaultSelectedKey = _ref6.defaultSelectedKey;
|
|
296
|
+
var _useState11 = useState(false),
|
|
297
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
298
|
+
innerOpen = _useState12[0],
|
|
299
|
+
setInnerOpen = _useState12[1];
|
|
300
|
+
var mergedOpen = open !== null && open !== void 0 ? open : innerOpen;
|
|
301
|
+
var updateOpen = function updateOpen(nextOpen) {
|
|
302
|
+
if (open === undefined) {
|
|
303
|
+
setInnerOpen(nextOpen);
|
|
304
|
+
}
|
|
305
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(nextOpen);
|
|
306
|
+
};
|
|
307
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
308
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
309
|
+
onClick: function onClick() {
|
|
310
|
+
return updateOpen(true);
|
|
311
|
+
},
|
|
312
|
+
children: trigger || /*#__PURE__*/_jsx(Button, {
|
|
313
|
+
size: "small",
|
|
314
|
+
children: "\u6253\u5F00\u5E2E\u52A9"
|
|
315
|
+
})
|
|
316
|
+
}), /*#__PURE__*/_jsx(Modal, {
|
|
317
|
+
visible: mergedOpen,
|
|
318
|
+
title: "\u5E2E\u52A9\u4E2D\u5FC3",
|
|
319
|
+
onClose: function onClose() {
|
|
320
|
+
return updateOpen(false);
|
|
321
|
+
},
|
|
322
|
+
body: /*#__PURE__*/_jsx("div", {
|
|
323
|
+
className: "max-h-[70vh] overflow-auto",
|
|
324
|
+
children: /*#__PURE__*/_jsx(ProHelp, {
|
|
325
|
+
dataSource: dataSource || [],
|
|
326
|
+
valueTypeMap: valueTypeMap,
|
|
327
|
+
onLoadContext: onLoadContext,
|
|
328
|
+
children: /*#__PURE__*/_jsx(ProHelpPanel, {
|
|
329
|
+
defaultSelectedKey: defaultSelectedKey
|
|
330
|
+
})
|
|
331
|
+
})
|
|
332
|
+
})
|
|
333
|
+
})]
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
export var ProHelp = function ProHelp(_ref7) {
|
|
337
|
+
var dataSource = _ref7.dataSource,
|
|
338
|
+
_ref7$valueTypeMap = _ref7.valueTypeMap,
|
|
339
|
+
valueTypeMap = _ref7$valueTypeMap === void 0 ? new Map() : _ref7$valueTypeMap,
|
|
340
|
+
onLoadContext = _ref7.onLoadContext,
|
|
341
|
+
children = _ref7.children;
|
|
342
|
+
return /*#__PURE__*/_jsx(ProHelpProvide.Provider, {
|
|
343
|
+
value: {
|
|
344
|
+
dataSource: dataSource,
|
|
345
|
+
valueTypeMap: valueTypeMap,
|
|
346
|
+
onLoadContext: onLoadContext
|
|
347
|
+
},
|
|
348
|
+
children: children
|
|
349
|
+
});
|
|
350
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export * from './components/Help';
|
|
3
|
+
export interface BreadcrumbItem {
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
href?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface MenuDataItem {
|
|
8
|
+
children?: MenuDataItem[];
|
|
9
|
+
hideInMenu?: boolean;
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
key?: React.Key;
|
|
12
|
+
name?: React.ReactNode;
|
|
13
|
+
path?: string;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export interface RouteContextType {
|
|
17
|
+
breadcrumb?: BreadcrumbItem[];
|
|
18
|
+
collapsed?: boolean;
|
|
19
|
+
currentMenu?: MenuDataItem;
|
|
20
|
+
isMobile?: boolean;
|
|
21
|
+
title?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare const RouteContext: React.Context<RouteContextType>;
|
|
24
|
+
export interface PageContainerProps {
|
|
25
|
+
title?: React.ReactNode;
|
|
26
|
+
subTitle?: React.ReactNode;
|
|
27
|
+
extra?: React.ReactNode;
|
|
28
|
+
content?: React.ReactNode;
|
|
29
|
+
footer?: React.ReactNode;
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
breadcrumb?: BreadcrumbItem[];
|
|
32
|
+
ghost?: boolean;
|
|
33
|
+
loading?: boolean;
|
|
34
|
+
tabList?: Array<{
|
|
35
|
+
key: string;
|
|
36
|
+
tab: React.ReactNode;
|
|
37
|
+
}>;
|
|
38
|
+
tabActiveKey?: string;
|
|
39
|
+
onTabChange?: (key: string) => void;
|
|
40
|
+
className?: string;
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
bodyClassName?: string;
|
|
43
|
+
bodyStyle?: React.CSSProperties;
|
|
44
|
+
}
|
|
45
|
+
export interface FooterToolbarProps {
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
extra?: React.ReactNode;
|
|
48
|
+
className?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface DefaultFooterLink {
|
|
51
|
+
key?: React.Key;
|
|
52
|
+
title: React.ReactNode;
|
|
53
|
+
href?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DefaultFooterProps {
|
|
56
|
+
links?: DefaultFooterLink[];
|
|
57
|
+
copyright?: React.ReactNode;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface AppItemProps {
|
|
61
|
+
desc?: React.ReactNode;
|
|
62
|
+
icon?: React.ReactNode;
|
|
63
|
+
title: React.ReactNode;
|
|
64
|
+
url?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface AppListProps {
|
|
67
|
+
apps?: AppItemProps[];
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface TopNavHeaderProps {
|
|
71
|
+
title?: React.ReactNode;
|
|
72
|
+
subTitle?: React.ReactNode;
|
|
73
|
+
logo?: React.ReactNode;
|
|
74
|
+
content?: React.ReactNode;
|
|
75
|
+
actions?: React.ReactNode;
|
|
76
|
+
fixed?: boolean;
|
|
77
|
+
navTheme?: 'light' | 'dark';
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface SettingDrawerState {
|
|
81
|
+
colorPrimary?: string;
|
|
82
|
+
colorWeak?: boolean;
|
|
83
|
+
contentWidth?: 'Fluid' | 'Fixed';
|
|
84
|
+
fixedHeader?: boolean;
|
|
85
|
+
fixSiderbar?: boolean;
|
|
86
|
+
layout?: 'side' | 'top' | 'mix';
|
|
87
|
+
navTheme?: 'light' | 'dark';
|
|
88
|
+
splitMenus?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface SettingDrawerProps {
|
|
91
|
+
children?: React.ReactNode;
|
|
92
|
+
className?: string;
|
|
93
|
+
collapse?: boolean;
|
|
94
|
+
onCollapseChange?: (collapse: boolean) => void;
|
|
95
|
+
onOpenChange?: (open: boolean) => void;
|
|
96
|
+
onSettingChange?: (settings: SettingDrawerState) => void;
|
|
97
|
+
open?: boolean;
|
|
98
|
+
settings?: SettingDrawerState;
|
|
99
|
+
}
|
|
100
|
+
export declare type FooterProps = DefaultFooterProps;
|
|
101
|
+
export declare type HeaderProps = TopNavHeaderProps;
|
|
102
|
+
export declare type PageHeaderProps = PageContainerProps;
|
|
103
|
+
export declare type ProSettings = SettingDrawerState;
|
|
104
|
+
export declare type Settings = SettingDrawerState;
|
|
105
|
+
export declare const LayoutSettingsContext: React.Context<SettingDrawerState | undefined>;
|
|
106
|
+
export interface GetPageTitleProps {
|
|
107
|
+
appList?: Array<{
|
|
108
|
+
title?: React.ReactNode;
|
|
109
|
+
}>;
|
|
110
|
+
breadcrumb?: Record<string, MenuDataItem>;
|
|
111
|
+
breadcrumbMap?: Map<string, MenuDataItem>;
|
|
112
|
+
formatMessage?: (data: {
|
|
113
|
+
id: any;
|
|
114
|
+
defaultMessage?: string;
|
|
115
|
+
}) => string;
|
|
116
|
+
menu?: {
|
|
117
|
+
locale?: boolean;
|
|
118
|
+
};
|
|
119
|
+
pageName?: React.ReactNode;
|
|
120
|
+
pathname?: string;
|
|
121
|
+
title?: React.ReactNode;
|
|
122
|
+
}
|
|
123
|
+
export interface GetMenuDataResult {
|
|
124
|
+
breadcrumb: Record<string, MenuDataItem>;
|
|
125
|
+
menuData: MenuDataItem[];
|
|
126
|
+
}
|
|
127
|
+
export interface ProLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
128
|
+
title?: React.ReactNode;
|
|
129
|
+
logo?: React.ReactNode;
|
|
130
|
+
content?: React.ReactNode;
|
|
131
|
+
actions?: React.ReactNode;
|
|
132
|
+
breadcrumb?: BreadcrumbItem[];
|
|
133
|
+
collapsed?: boolean;
|
|
134
|
+
collapsedButtonRender?: React.ReactNode | ((collapsed?: boolean) => React.ReactNode);
|
|
135
|
+
contentStyle?: React.CSSProperties;
|
|
136
|
+
currentMenu?: MenuDataItem;
|
|
137
|
+
contentWidth?: 'Fluid' | 'Fixed';
|
|
138
|
+
fixedHeader?: boolean;
|
|
139
|
+
fixSiderbar?: boolean;
|
|
140
|
+
layout?: 'side' | 'top' | 'mix';
|
|
141
|
+
location?: {
|
|
142
|
+
pathname?: string;
|
|
143
|
+
[key: string]: any;
|
|
144
|
+
};
|
|
145
|
+
menuData?: MenuDataItem[];
|
|
146
|
+
menuDataRender?: (menuData: MenuDataItem[]) => MenuDataItem[];
|
|
147
|
+
menuFooterRender?: (props: ProLayoutProps) => React.ReactNode;
|
|
148
|
+
menuItemRender?: (item: MenuDataItem, defaultDom: React.ReactNode) => React.ReactNode;
|
|
149
|
+
menuRender?: (props: ProLayoutProps, defaultDom: React.ReactNode) => React.ReactNode;
|
|
150
|
+
navTheme?: 'light' | 'dark';
|
|
151
|
+
onMenuHeaderClick?: () => void;
|
|
152
|
+
siderWidth?: number;
|
|
153
|
+
splitMenus?: boolean;
|
|
154
|
+
headerRender?: (props: ProLayoutProps, defaultDom: React.ReactNode) => React.ReactNode;
|
|
155
|
+
token?: Record<string, any>;
|
|
156
|
+
}
|
|
157
|
+
export declare const getMenuData: (routes?: MenuDataItem[], menuDataRender?: ((menuData: MenuDataItem[]) => MenuDataItem[]) | undefined) => GetMenuDataResult;
|
|
158
|
+
export declare const getPageTitle: ({ title, pageName, appList, breadcrumb, breadcrumbMap, formatMessage, menu, pathname }: GetPageTitleProps, ignoreTitle?: boolean) => string;
|
|
159
|
+
export declare const getPageTitleInfo: ({ title, pageName, appList, breadcrumb, breadcrumbMap, formatMessage, menu, pathname }: GetPageTitleProps, ignoreTitle?: boolean) => {
|
|
160
|
+
id: string;
|
|
161
|
+
pageName: string;
|
|
162
|
+
title: string;
|
|
163
|
+
};
|
|
164
|
+
export declare const ProBreadcrumb: React.FC<{
|
|
165
|
+
items?: BreadcrumbItem[];
|
|
166
|
+
}>;
|
|
167
|
+
export declare const PageLoading: React.FC<{
|
|
168
|
+
tip?: React.ReactNode;
|
|
169
|
+
}>;
|
|
170
|
+
export declare const GridContent: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
171
|
+
export declare const WrapContent: React.FC<React.HTMLAttributes<HTMLDivElement>>;
|
|
172
|
+
export declare const AppList: React.FC<AppListProps>;
|
|
173
|
+
export declare const FooterToolbar: React.FC<FooterToolbarProps>;
|
|
174
|
+
export declare const DefaultFooter: React.FC<DefaultFooterProps>;
|
|
175
|
+
export declare const TopNavHeader: React.FC<TopNavHeaderProps>;
|
|
176
|
+
export declare const DefaultHeader: React.FC<TopNavHeaderProps>;
|
|
177
|
+
export declare const SettingDrawer: React.FC<SettingDrawerProps>;
|
|
178
|
+
export declare const PageContainer: React.FC<PageContainerProps>;
|
|
179
|
+
export declare const ProPageHeader: React.FC<PageContainerProps>;
|
|
180
|
+
export declare const PageHeader: React.FC<PageContainerProps>;
|
|
181
|
+
export declare const ProLayout: React.FC<ProLayoutProps>;
|
|
182
|
+
export default ProLayout;
|