@qq1948037137/adminsmart-ui 0.1.29 → 0.1.30
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/README.md +1 -1
- package/dist/index.cjs +161 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -4
- package/dist/index.d.ts +51 -4
- package/dist/index.js +147 -86
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ function Example() {
|
|
|
51
51
|
|
|
52
52
|
`Pagination`、`Table`、`DataTable` 和显式启用分页的 `List` 默认显示 `共 N 条`,数量来自 Ant 的本地数据总数或业务传入的 `total`,不会把当前页行数当作完整数量。原生 `showTotal={(total, range) => ...}` 可自定义总数文案,显式 `showTotal={undefined}` 可隐藏;表格和列表仍可通过 `pagination={false}` 关闭分页。页码、每页条数、回调、ref 和原生公开类型继续保留,列表未配置分页时不会额外开启分页。
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
用 `ReportErrorProvider` 在应用入口绑定问题上报行为。`OperationToolbar` 将「问题上报」放在新增、导出等左侧业务操作之后,右侧的 `TableControls` 依次提供搜索显隐、刷新和选择列。`SearchPanel.tools/trailingTools` 和 `CrudWorkspace.actions/controls` 会使用同一个操作栏。没有列表工具栏的页面可使用 `ErrorReportButton`。宿主负责采集范围、脱敏、请求和结果反馈。
|
|
55
55
|
|
|
56
56
|
在 `WorkspaceLayout contentMode="table"` 的内容区嵌入 `CrudWorkspace`,可使用独立的筛选、操作栏、反馈与页脚插槽,`DataTable` 自动填满剩余区域。结果超出高度时在表体内滚动,分页仍保持可见。文档站的「CrudWorkspace 标准 CRUD 工作区」展示同一布局中的搜索、刷新、显隐列、新建、编辑和删除。
|
|
57
57
|
|
package/dist/index.cjs
CHANGED
|
@@ -62,6 +62,7 @@ __export(src_exports, {
|
|
|
62
62
|
Dropdown: () => Dropdown,
|
|
63
63
|
EllipsisText: () => EllipsisText,
|
|
64
64
|
Empty: () => Empty,
|
|
65
|
+
ErrorReportButton: () => ErrorReportButton,
|
|
65
66
|
Flex: () => Flex,
|
|
66
67
|
FloatButton: () => FloatButton,
|
|
67
68
|
Form: () => Form,
|
|
@@ -76,6 +77,7 @@ __export(src_exports, {
|
|
|
76
77
|
Mentions: () => Mentions,
|
|
77
78
|
Menu: () => Menu,
|
|
78
79
|
Modal: () => Modal,
|
|
80
|
+
OperationToolbar: () => OperationToolbar,
|
|
79
81
|
Pagination: () => Pagination,
|
|
80
82
|
Popconfirm: () => Popconfirm,
|
|
81
83
|
Popover: () => Popover,
|
|
@@ -83,6 +85,7 @@ __export(src_exports, {
|
|
|
83
85
|
QRCode: () => QRCode,
|
|
84
86
|
Radio: () => Radio,
|
|
85
87
|
Rate: () => Rate,
|
|
88
|
+
ReportErrorProvider: () => ReportErrorProvider,
|
|
86
89
|
Result: () => Result,
|
|
87
90
|
Row: () => Row,
|
|
88
91
|
RowActions: () => RowActions,
|
|
@@ -1292,8 +1295,68 @@ var SessionReplay = (0, import_react6.forwardRef)(function SessionReplay2({ even
|
|
|
1292
1295
|
});
|
|
1293
1296
|
|
|
1294
1297
|
// src/composites/SearchPanel.tsx
|
|
1298
|
+
var import_icons4 = require("@ant-design/icons");
|
|
1299
|
+
var import_react9 = require("react");
|
|
1300
|
+
|
|
1301
|
+
// src/composites/OperationToolbar.tsx
|
|
1302
|
+
var import_react8 = require("react");
|
|
1303
|
+
|
|
1304
|
+
// src/composites/ErrorReportButton.tsx
|
|
1295
1305
|
var import_icons3 = require("@ant-design/icons");
|
|
1296
1306
|
var import_react7 = require("react");
|
|
1307
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1308
|
+
function ErrorReportButton({
|
|
1309
|
+
onReport,
|
|
1310
|
+
disabled = false,
|
|
1311
|
+
onReportFailure,
|
|
1312
|
+
description = "\u95EE\u9898\u4E0A\u62A5"
|
|
1313
|
+
}) {
|
|
1314
|
+
const pending = (0, import_react7.useRef)(false);
|
|
1315
|
+
const [reporting, setReporting] = (0, import_react7.useState)(false);
|
|
1316
|
+
async function report() {
|
|
1317
|
+
if (disabled || pending.current) return;
|
|
1318
|
+
pending.current = true;
|
|
1319
|
+
setReporting(true);
|
|
1320
|
+
try {
|
|
1321
|
+
await onReport();
|
|
1322
|
+
} catch (error) {
|
|
1323
|
+
onReportFailure?.(error);
|
|
1324
|
+
} finally {
|
|
1325
|
+
pending.current = false;
|
|
1326
|
+
setReporting(false);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tooltip, { title: description, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1330
|
+
Button,
|
|
1331
|
+
{
|
|
1332
|
+
"data-adminsmart-error-report": "true",
|
|
1333
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.BugOutlined, { "aria-hidden": "true" }),
|
|
1334
|
+
disabled,
|
|
1335
|
+
loading: reporting,
|
|
1336
|
+
onClick: report,
|
|
1337
|
+
children: "\u95EE\u9898\u4E0A\u62A5"
|
|
1338
|
+
}
|
|
1339
|
+
) });
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
// src/composites/OperationToolbar.tsx
|
|
1343
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1344
|
+
var ReportErrorContext = (0, import_react8.createContext)(void 0);
|
|
1345
|
+
function ReportErrorProvider({ children, ...config }) {
|
|
1346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ReportErrorContext.Provider, { value: config, children });
|
|
1347
|
+
}
|
|
1348
|
+
function OperationToolbar({ actions, controls, errorReport, style, ...props }) {
|
|
1349
|
+
const providedReport = (0, import_react8.useContext)(ReportErrorContext);
|
|
1350
|
+
const report = errorReport === false ? void 0 : errorReport ?? providedReport;
|
|
1351
|
+
if (actions == null && controls == null && !report) return null;
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Flex, { ...props, align: "center", wrap: true, gap: 12, "data-adminsmart-toolbar-row": "true", style: { width: "100%", minWidth: 0, ...style }, children: [
|
|
1353
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Flex, { align: "center", wrap: true, gap: 12, role: "group", "aria-label": "\u529F\u80FD\u64CD\u4F5C", "data-adminsmart-toolbar-actions": "true", style: { minWidth: 0, minHeight: 32 }, children: [
|
|
1354
|
+
actions,
|
|
1355
|
+
report && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorReportButton, { ...report })
|
|
1356
|
+
] }),
|
|
1357
|
+
controls != null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Flex, { align: "center", wrap: true, gap: 12, role: "group", "aria-label": "\u8868\u683C\u5DE5\u5177", style: { minWidth: 0, marginInlineStart: "auto", minHeight: 32 }, children: controls })
|
|
1358
|
+
] });
|
|
1359
|
+
}
|
|
1297
1360
|
|
|
1298
1361
|
// src/composites/searchPanelModel.ts
|
|
1299
1362
|
function searchColumnCount(width) {
|
|
@@ -1304,17 +1367,17 @@ function collapsedSearchFieldLimit(columns) {
|
|
|
1304
1367
|
}
|
|
1305
1368
|
|
|
1306
1369
|
// src/composites/SearchPanel.tsx
|
|
1307
|
-
var
|
|
1308
|
-
var SearchPanel = (0,
|
|
1309
|
-
const rootRef = (0,
|
|
1310
|
-
const [width, setWidth] = (0,
|
|
1311
|
-
const [expanded, setExpanded] = (0,
|
|
1312
|
-
const items =
|
|
1370
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1371
|
+
var SearchPanel = (0, import_react9.forwardRef)(function SearchPanel2({ fields, actions, tools, trailingTools, searchVisible = true, defaultExpanded = false, role = "search", style, ...props }, ref) {
|
|
1372
|
+
const rootRef = (0, import_react9.useRef)(null);
|
|
1373
|
+
const [width, setWidth] = (0, import_react9.useState)(0);
|
|
1374
|
+
const [expanded, setExpanded] = (0, import_react9.useState)(defaultExpanded);
|
|
1375
|
+
const items = import_react9.Children.toArray(fields);
|
|
1313
1376
|
const columns = searchColumnCount(width);
|
|
1314
1377
|
const collapsedLimit = collapsedSearchFieldLimit(columns);
|
|
1315
1378
|
const hasMore = items.length > collapsedLimit;
|
|
1316
1379
|
const fieldWidth = Math.min(240, Math.max(0, width));
|
|
1317
|
-
(0,
|
|
1380
|
+
(0, import_react9.useEffect)(() => {
|
|
1318
1381
|
const element = rootRef.current;
|
|
1319
1382
|
if (!element) return void 0;
|
|
1320
1383
|
const update = () => {
|
|
@@ -1343,10 +1406,10 @@ var SearchPanel = (0, import_react7.forwardRef)(function SearchPanel2({ fields,
|
|
|
1343
1406
|
...style
|
|
1344
1407
|
};
|
|
1345
1408
|
const hasToolbar = tools != null || trailingTools != null;
|
|
1346
|
-
return /* @__PURE__ */ (0,
|
|
1347
|
-
/* @__PURE__ */ (0,
|
|
1348
|
-
(items.length > 0 || actions != null) && /* @__PURE__ */ (0,
|
|
1349
|
-
items.map((item, index) => /* @__PURE__ */ (0,
|
|
1409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ...props, ref: setRootRef, role: hasToolbar ? "toolbar" : role, style: panelStyle, "data-adminsmart-search-panel": "true", children: [
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: "[data-adminsmart-search-field] > .ant-form-item { margin-bottom: 0; }" }),
|
|
1411
|
+
(items.length > 0 || actions != null) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { role: hasToolbar ? role : void 0, "aria-hidden": !searchVisible, style: { display: searchVisible ? "flex" : "none", width: "100%", flexWrap: "wrap", alignItems: "end", gap: "12px 16px" }, children: [
|
|
1412
|
+
items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1350
1413
|
"div",
|
|
1351
1414
|
{
|
|
1352
1415
|
hidden: !expanded && index >= collapsedLimit,
|
|
@@ -1354,33 +1417,30 @@ var SearchPanel = (0, import_react7.forwardRef)(function SearchPanel2({ fields,
|
|
|
1354
1417
|
style: { minWidth: 0, width: fieldWidth || "min(240px, 100%)", flex: "0 0 auto" },
|
|
1355
1418
|
children: item
|
|
1356
1419
|
},
|
|
1357
|
-
(0,
|
|
1420
|
+
(0, import_react9.isValidElement)(item) ? item.key ?? index : index
|
|
1358
1421
|
)),
|
|
1359
|
-
/* @__PURE__ */ (0,
|
|
1360
|
-
hasMore ? /* @__PURE__ */ (0,
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { "data-adminsmart-search-actions": "true", style: { display: "flex", alignItems: "center", gap: 8, minHeight: 32 }, children: [
|
|
1423
|
+
hasMore ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1361
1424
|
Button,
|
|
1362
1425
|
{
|
|
1363
1426
|
type: "link",
|
|
1364
|
-
icon: expanded ? /* @__PURE__ */ (0,
|
|
1427
|
+
icon: expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons4.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons4.DownOutlined, {}),
|
|
1365
1428
|
"aria-expanded": expanded,
|
|
1366
1429
|
onClick: () => setExpanded((value) => !value),
|
|
1367
1430
|
children: expanded ? "\u6536\u8D77\u7B5B\u9009" : "\u5C55\u5F00\u7B5B\u9009"
|
|
1368
1431
|
}
|
|
1369
1432
|
) : null,
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: actions })
|
|
1371
1434
|
] })
|
|
1372
1435
|
] }),
|
|
1373
|
-
hasToolbar && /* @__PURE__ */ (0,
|
|
1374
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { role: "group", "aria-label": "\u529F\u80FD\u64CD\u4F5C", "data-adminsmart-toolbar-actions": "true", style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 12, minHeight: 32 }, children: tools }),
|
|
1375
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { role: "group", "aria-label": "\u8868\u683C\u5DE5\u5177", style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 12, marginLeft: "auto", minHeight: 32 }, children: trailingTools })
|
|
1376
|
-
] })
|
|
1436
|
+
hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OperationToolbar, { actions: tools, controls: trailingTools })
|
|
1377
1437
|
] });
|
|
1378
1438
|
});
|
|
1379
1439
|
|
|
1380
1440
|
// src/composites/TableControls.tsx
|
|
1381
|
-
var
|
|
1382
|
-
var
|
|
1383
|
-
var
|
|
1441
|
+
var import_icons5 = require("@ant-design/icons");
|
|
1442
|
+
var import_react10 = require("react");
|
|
1443
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1384
1444
|
function TableControls({
|
|
1385
1445
|
searchVisible = true,
|
|
1386
1446
|
onSearchVisibleChange,
|
|
@@ -1392,10 +1452,10 @@ function TableControls({
|
|
|
1392
1452
|
className,
|
|
1393
1453
|
style
|
|
1394
1454
|
}) {
|
|
1395
|
-
const [open, setOpen] = (0,
|
|
1396
|
-
const triggerRef = (0,
|
|
1397
|
-
const panelRef = (0,
|
|
1398
|
-
const panelId = (0,
|
|
1455
|
+
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
1456
|
+
const triggerRef = (0, import_react10.useRef)(null);
|
|
1457
|
+
const panelRef = (0, import_react10.useRef)(null);
|
|
1458
|
+
const panelId = (0, import_react10.useId)();
|
|
1399
1459
|
const editable = columns.filter((column) => !column.disabled);
|
|
1400
1460
|
const visible = new Set(visibleColumns ?? columns.map((column) => column.key));
|
|
1401
1461
|
const checkedCount = editable.filter((column) => visible.has(column.key)).length;
|
|
@@ -1423,11 +1483,11 @@ function TableControls({
|
|
|
1423
1483
|
maxHeight: "min(380px, 60vh)",
|
|
1424
1484
|
overflow: "auto"
|
|
1425
1485
|
};
|
|
1426
|
-
return /* @__PURE__ */ (0,
|
|
1427
|
-
/* @__PURE__ */ (0,
|
|
1486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className, style: { display: "inline-flex", alignItems: "center", flexShrink: 0, gap: 8, ...style }, children: [
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Tooltip, { title: searchLabel, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1428
1488
|
Button,
|
|
1429
1489
|
{
|
|
1430
|
-
icon: /* @__PURE__ */ (0,
|
|
1490
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.SearchOutlined, { "aria-hidden": "true" }),
|
|
1431
1491
|
"aria-label": searchLabel,
|
|
1432
1492
|
"aria-pressed": searchVisible,
|
|
1433
1493
|
"data-adminsmart-table-tool": "true",
|
|
@@ -1435,10 +1495,10 @@ function TableControls({
|
|
|
1435
1495
|
onClick: () => onSearchVisibleChange?.(!searchVisible)
|
|
1436
1496
|
}
|
|
1437
1497
|
) }),
|
|
1438
|
-
/* @__PURE__ */ (0,
|
|
1498
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Tooltip, { title: "\u5237\u65B0\u5217\u8868", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1439
1499
|
Button,
|
|
1440
1500
|
{
|
|
1441
|
-
icon: /* @__PURE__ */ (0,
|
|
1501
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.ReloadOutlined, { "aria-hidden": "true" }),
|
|
1442
1502
|
"aria-label": "\u5237\u65B0\u5217\u8868",
|
|
1443
1503
|
"data-adminsmart-table-tool": "true",
|
|
1444
1504
|
loading: refreshing,
|
|
@@ -1446,7 +1506,7 @@ function TableControls({
|
|
|
1446
1506
|
onClick: onRefresh
|
|
1447
1507
|
}
|
|
1448
1508
|
) }),
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1450
1510
|
Popover,
|
|
1451
1511
|
{
|
|
1452
1512
|
trigger: "click",
|
|
@@ -1457,8 +1517,8 @@ function TableControls({
|
|
|
1457
1517
|
afterOpenChange: (opened) => {
|
|
1458
1518
|
if (opened) panelRef.current?.querySelector("input:not(:disabled)")?.focus();
|
|
1459
1519
|
},
|
|
1460
|
-
content: /* @__PURE__ */ (0,
|
|
1461
|
-
/* @__PURE__ */ (0,
|
|
1520
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref: panelRef, id: panelId, role: "dialog", "aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217", onKeyDown: closeOnEscape, style: panelStyle, children: [
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1462
1522
|
Checkbox,
|
|
1463
1523
|
{
|
|
1464
1524
|
checked: checkedCount === editable.length,
|
|
@@ -1467,7 +1527,7 @@ function TableControls({
|
|
|
1467
1527
|
children: "\u663E\u793A\u5168\u90E8\u53EF\u9009\u5217"
|
|
1468
1528
|
}
|
|
1469
1529
|
),
|
|
1470
|
-
columns.map((column) => /* @__PURE__ */ (0,
|
|
1530
|
+
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1471
1531
|
Checkbox,
|
|
1472
1532
|
{
|
|
1473
1533
|
checked: visible.has(column.key),
|
|
@@ -1478,11 +1538,11 @@ function TableControls({
|
|
|
1478
1538
|
column.key
|
|
1479
1539
|
))
|
|
1480
1540
|
] }),
|
|
1481
|
-
children: /* @__PURE__ */ (0,
|
|
1541
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1482
1542
|
Button,
|
|
1483
1543
|
{
|
|
1484
1544
|
ref: triggerRef,
|
|
1485
|
-
icon: /* @__PURE__ */ (0,
|
|
1545
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.SettingOutlined, { "aria-hidden": "true" }),
|
|
1486
1546
|
"aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
|
|
1487
1547
|
"data-adminsmart-table-tool": "true",
|
|
1488
1548
|
"aria-haspopup": "dialog",
|
|
@@ -1498,25 +1558,26 @@ function TableControls({
|
|
|
1498
1558
|
}
|
|
1499
1559
|
|
|
1500
1560
|
// src/composites/DataTable.tsx
|
|
1501
|
-
var
|
|
1561
|
+
var import_react12 = require("react");
|
|
1502
1562
|
|
|
1503
1563
|
// src/composites/CrudWorkspace.tsx
|
|
1504
|
-
var
|
|
1505
|
-
var
|
|
1506
|
-
var CrudTableHeightContext = (0,
|
|
1507
|
-
function CrudWorkspace({ label, filters, toolbar, feedback, footer, children, className, ...props }) {
|
|
1564
|
+
var import_react11 = require("react");
|
|
1565
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1566
|
+
var CrudTableHeightContext = (0, import_react11.createContext)(false);
|
|
1567
|
+
function CrudWorkspace({ label, filters, toolbar, actions, controls, feedback, footer, children, className, ...props }) {
|
|
1508
1568
|
const classes = ["adminsmart-crud-workspace", className].filter(Boolean).join(" ");
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
/* @__PURE__ */ (0,
|
|
1514
|
-
|
|
1569
|
+
const listToolbar = toolbar ?? (actions != null || controls != null ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(OperationToolbar, { actions, controls }) : null);
|
|
1570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { ...props, className: classes, "aria-label": label, children: [
|
|
1571
|
+
filters != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "adminsmart-crud-workspace__filters", children: filters }),
|
|
1572
|
+
listToolbar != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "adminsmart-crud-workspace__toolbar", children: listToolbar }),
|
|
1573
|
+
feedback != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "adminsmart-crud-workspace__feedback", children: feedback }),
|
|
1574
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "adminsmart-crud-workspace__results", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CrudTableHeightContext.Provider, { value: true, children }) }),
|
|
1575
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "adminsmart-crud-workspace__footer", children: footer })
|
|
1515
1576
|
] });
|
|
1516
1577
|
}
|
|
1517
1578
|
|
|
1518
1579
|
// src/composites/DataTable.tsx
|
|
1519
|
-
var
|
|
1580
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1520
1581
|
function tableBodyHeight(availableHeight, chromeHeight) {
|
|
1521
1582
|
return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
|
|
1522
1583
|
}
|
|
@@ -1537,12 +1598,12 @@ function DataTableInner({
|
|
|
1537
1598
|
scroll,
|
|
1538
1599
|
...tableProps
|
|
1539
1600
|
}, ref) {
|
|
1540
|
-
const containerRef = (0,
|
|
1541
|
-
const [bodyHeight, setBodyHeight] = (0,
|
|
1542
|
-
const inWorkspace = (0,
|
|
1601
|
+
const containerRef = (0, import_react12.useRef)(null);
|
|
1602
|
+
const [bodyHeight, setBodyHeight] = (0, import_react12.useState)(360);
|
|
1603
|
+
const inWorkspace = (0, import_react12.useContext)(CrudTableHeightContext);
|
|
1543
1604
|
const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
|
|
1544
1605
|
const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
|
|
1545
|
-
(0,
|
|
1606
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
1546
1607
|
const container = containerRef.current;
|
|
1547
1608
|
if (!container || scroll?.y != null) return void 0;
|
|
1548
1609
|
const update = () => {
|
|
@@ -1586,7 +1647,7 @@ function DataTableInner({
|
|
|
1586
1647
|
y: scroll?.y ?? bodyHeight
|
|
1587
1648
|
};
|
|
1588
1649
|
const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
|
|
1589
|
-
return /* @__PURE__ */ (0,
|
|
1650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1590
1651
|
"div",
|
|
1591
1652
|
{
|
|
1592
1653
|
ref: containerRef,
|
|
@@ -1594,7 +1655,7 @@ function DataTableInner({
|
|
|
1594
1655
|
"data-adminsmart-data-table": "true",
|
|
1595
1656
|
"data-adminsmart-data-table-fill": inWorkspace || void 0,
|
|
1596
1657
|
style: { width: "100%", minWidth: 0, overflowX: "hidden", ...tableHeight == null ? {} : { height: tableHeight, overflowY: "hidden" }, ...containerStyle },
|
|
1597
|
-
children: /* @__PURE__ */ (0,
|
|
1658
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1598
1659
|
Table,
|
|
1599
1660
|
{
|
|
1600
1661
|
...tableProps,
|
|
@@ -1606,11 +1667,11 @@ function DataTableInner({
|
|
|
1606
1667
|
}
|
|
1607
1668
|
);
|
|
1608
1669
|
}
|
|
1609
|
-
var DataTable = (0,
|
|
1670
|
+
var DataTable = (0, import_react12.forwardRef)(DataTableInner);
|
|
1610
1671
|
|
|
1611
1672
|
// src/composites/WorkspaceLayout.tsx
|
|
1612
1673
|
var import_antd46 = require("antd");
|
|
1613
|
-
var
|
|
1674
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1614
1675
|
var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
|
|
1615
1676
|
function WorkspaceLayout({
|
|
1616
1677
|
header,
|
|
@@ -1642,10 +1703,10 @@ function WorkspaceLayout({
|
|
|
1642
1703
|
"--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
|
|
1643
1704
|
// 夜间不复用日间固定底色。
|
|
1644
1705
|
};
|
|
1645
|
-
return /* @__PURE__ */ (0,
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
1706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("header", { className: "adminsmart-workspace__header", children: header }),
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Layout, { className: "adminsmart-workspace__body", children: [
|
|
1709
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1649
1710
|
Layout.Sider,
|
|
1650
1711
|
{
|
|
1651
1712
|
theme: themeMode,
|
|
@@ -1657,9 +1718,9 @@ function WorkspaceLayout({
|
|
|
1657
1718
|
children: sidebar
|
|
1658
1719
|
}
|
|
1659
1720
|
),
|
|
1660
|
-
/* @__PURE__ */ (0,
|
|
1721
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Layout, { className: "adminsmart-workspace__main", children: [
|
|
1661
1722
|
tabs,
|
|
1662
|
-
/* @__PURE__ */ (0,
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
|
|
1663
1724
|
footer
|
|
1664
1725
|
] })
|
|
1665
1726
|
] })
|
|
@@ -1667,7 +1728,7 @@ function WorkspaceLayout({
|
|
|
1667
1728
|
}
|
|
1668
1729
|
|
|
1669
1730
|
// src/composites/CrudScaffold.tsx
|
|
1670
|
-
var
|
|
1731
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1671
1732
|
function CrudScaffold({
|
|
1672
1733
|
label,
|
|
1673
1734
|
description,
|
|
@@ -1679,16 +1740,16 @@ function CrudScaffold({
|
|
|
1679
1740
|
...props
|
|
1680
1741
|
}) {
|
|
1681
1742
|
const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
|
|
1682
|
-
return /* @__PURE__ */ (0,
|
|
1683
|
-
/* @__PURE__ */ (0,
|
|
1684
|
-
status ? /* @__PURE__ */ (0,
|
|
1685
|
-
/* @__PURE__ */ (0,
|
|
1743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
|
|
1744
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "adminsmart-crud__filters", children: filters }),
|
|
1745
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "adminsmart-crud__status", children: status }) : null,
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "adminsmart-crud__results", children: results }),
|
|
1686
1747
|
drawer
|
|
1687
1748
|
] });
|
|
1688
1749
|
}
|
|
1689
1750
|
|
|
1690
1751
|
// src/composites/EllipsisText.tsx
|
|
1691
|
-
var
|
|
1752
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1692
1753
|
function EllipsisText({
|
|
1693
1754
|
children,
|
|
1694
1755
|
maxWidth = 240,
|
|
@@ -1700,7 +1761,7 @@ function EllipsisText({
|
|
|
1700
1761
|
const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
|
|
1701
1762
|
const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
1702
1763
|
const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
|
|
1703
|
-
return /* @__PURE__ */ (0,
|
|
1764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1704
1765
|
Typography.Text,
|
|
1705
1766
|
{
|
|
1706
1767
|
...props,
|
|
@@ -1713,14 +1774,14 @@ function EllipsisText({
|
|
|
1713
1774
|
}
|
|
1714
1775
|
|
|
1715
1776
|
// src/composites/RowActions.tsx
|
|
1716
|
-
var
|
|
1717
|
-
var
|
|
1718
|
-
var
|
|
1777
|
+
var import_icons6 = require("@ant-design/icons");
|
|
1778
|
+
var import_react13 = require("react");
|
|
1779
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1719
1780
|
function collectButtons(children) {
|
|
1720
1781
|
const actions = [];
|
|
1721
|
-
|
|
1722
|
-
if (!(0,
|
|
1723
|
-
if (child.type ===
|
|
1782
|
+
import_react13.Children.forEach(children, (child) => {
|
|
1783
|
+
if (!(0, import_react13.isValidElement)(child)) return;
|
|
1784
|
+
if (child.type === import_react13.Fragment) actions.push(...collectButtons(child.props.children));
|
|
1724
1785
|
else {
|
|
1725
1786
|
if (child.type !== Button && child.type !== "button") throw new TypeError("RowActions \u53EA\u63A5\u53D7\u5DF2\u6309\u6743\u9650\u7B5B\u9009\u7684 Button \u6216 Fragment");
|
|
1726
1787
|
if (!child.props.hidden) actions.push(child);
|
|
@@ -1746,9 +1807,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1746
1807
|
// 菜单仍按官方语义标识需要确认的动作。
|
|
1747
1808
|
}));
|
|
1748
1809
|
const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
|
|
1749
|
-
return /* @__PURE__ */ (0,
|
|
1810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Space, { ...props, className: classes, size, wrap, children: [
|
|
1750
1811
|
direct,
|
|
1751
|
-
overflow.length > 0 && /* @__PURE__ */ (0,
|
|
1812
|
+
overflow.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1752
1813
|
Dropdown,
|
|
1753
1814
|
{
|
|
1754
1815
|
trigger: ["click"],
|
|
@@ -1760,12 +1821,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1760
1821
|
action.props.onClick?.(domEvent);
|
|
1761
1822
|
}
|
|
1762
1823
|
},
|
|
1763
|
-
children: /* @__PURE__ */ (0,
|
|
1824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Tooltip, { title: moreLabel, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1764
1825
|
Button,
|
|
1765
1826
|
{
|
|
1766
1827
|
type: "text",
|
|
1767
1828
|
size: "small",
|
|
1768
|
-
icon: /* @__PURE__ */ (0,
|
|
1829
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons6.EllipsisOutlined, {}),
|
|
1769
1830
|
"aria-label": moreLabel,
|
|
1770
1831
|
"aria-haspopup": "menu",
|
|
1771
1832
|
"data-adminsmart-row-more": "true",
|
|
@@ -1779,7 +1840,7 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1779
1840
|
|
|
1780
1841
|
// src/schema/SchemaForm.tsx
|
|
1781
1842
|
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
1782
|
-
var
|
|
1843
|
+
var import_react14 = require("react");
|
|
1783
1844
|
|
|
1784
1845
|
// src/schema/model.ts
|
|
1785
1846
|
var FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -1962,7 +2023,7 @@ function schemaInitialValues(schema) {
|
|
|
1962
2023
|
}
|
|
1963
2024
|
|
|
1964
2025
|
// src/schema/SchemaForm.tsx
|
|
1965
|
-
var
|
|
2026
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1966
2027
|
function fieldRules(field) {
|
|
1967
2028
|
const rules = [];
|
|
1968
2029
|
if (field.required) {
|
|
@@ -2007,32 +2068,32 @@ function dateItemProps(field) {
|
|
|
2007
2068
|
function renderControl(field) {
|
|
2008
2069
|
switch (field.type) {
|
|
2009
2070
|
case "input":
|
|
2010
|
-
return /* @__PURE__ */ (0,
|
|
2071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input, { placeholder: field.placeholder });
|
|
2011
2072
|
case "password":
|
|
2012
|
-
return /* @__PURE__ */ (0,
|
|
2073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input.Password, { placeholder: field.placeholder });
|
|
2013
2074
|
case "textarea":
|
|
2014
|
-
return /* @__PURE__ */ (0,
|
|
2075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input.TextArea, { placeholder: field.placeholder });
|
|
2015
2076
|
case "number":
|
|
2016
|
-
return /* @__PURE__ */ (0,
|
|
2077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
|
|
2017
2078
|
case "select":
|
|
2018
|
-
return /* @__PURE__ */ (0,
|
|
2079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Select, { placeholder: field.placeholder, options: field.options });
|
|
2019
2080
|
case "radio":
|
|
2020
|
-
return /* @__PURE__ */ (0,
|
|
2081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Radio.Group, { options: field.options });
|
|
2021
2082
|
case "checkbox":
|
|
2022
|
-
return /* @__PURE__ */ (0,
|
|
2083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Checkbox, {});
|
|
2023
2084
|
case "switch":
|
|
2024
|
-
return /* @__PURE__ */ (0,
|
|
2085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Switch, {});
|
|
2025
2086
|
case "date":
|
|
2026
|
-
return /* @__PURE__ */ (0,
|
|
2087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
|
|
2027
2088
|
case "dateRange":
|
|
2028
|
-
return /* @__PURE__ */ (0,
|
|
2089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
|
|
2029
2090
|
}
|
|
2030
2091
|
}
|
|
2031
|
-
var SchemaForm = (0,
|
|
2092
|
+
var SchemaForm = (0, import_react14.forwardRef)(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
|
|
2032
2093
|
const result = validateSchemaForm(schema);
|
|
2033
2094
|
if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
|
|
2034
2095
|
const defaults = schemaInitialValues(schema);
|
|
2035
|
-
return /* @__PURE__ */ (0,
|
|
2096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2036
2097
|
Form,
|
|
2037
2098
|
{
|
|
2038
2099
|
...formProps,
|
|
@@ -2050,7 +2111,7 @@ var SchemaForm = (0, import_react12.forwardRef)(function SchemaForm2({ schema, o
|
|
|
2050
2111
|
children: [
|
|
2051
2112
|
schema.fields.map((field) => {
|
|
2052
2113
|
const mapped = mapSchemaField(field);
|
|
2053
|
-
return /* @__PURE__ */ (0,
|
|
2114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2054
2115
|
Form.Item,
|
|
2055
2116
|
{
|
|
2056
2117
|
name: mapped.name,
|
|
@@ -2063,7 +2124,7 @@ var SchemaForm = (0, import_react12.forwardRef)(function SchemaForm2({ schema, o
|
|
|
2063
2124
|
mapped.name
|
|
2064
2125
|
);
|
|
2065
2126
|
}),
|
|
2066
|
-
/* @__PURE__ */ (0,
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
|
|
2067
2128
|
]
|
|
2068
2129
|
}
|
|
2069
2130
|
);
|
|
@@ -2102,6 +2163,7 @@ var SchemaForm = (0, import_react12.forwardRef)(function SchemaForm2({ schema, o
|
|
|
2102
2163
|
Dropdown,
|
|
2103
2164
|
EllipsisText,
|
|
2104
2165
|
Empty,
|
|
2166
|
+
ErrorReportButton,
|
|
2105
2167
|
Flex,
|
|
2106
2168
|
FloatButton,
|
|
2107
2169
|
Form,
|
|
@@ -2116,6 +2178,7 @@ var SchemaForm = (0, import_react12.forwardRef)(function SchemaForm2({ schema, o
|
|
|
2116
2178
|
Mentions,
|
|
2117
2179
|
Menu,
|
|
2118
2180
|
Modal,
|
|
2181
|
+
OperationToolbar,
|
|
2119
2182
|
Pagination,
|
|
2120
2183
|
Popconfirm,
|
|
2121
2184
|
Popover,
|
|
@@ -2123,6 +2186,7 @@ var SchemaForm = (0, import_react12.forwardRef)(function SchemaForm2({ schema, o
|
|
|
2123
2186
|
QRCode,
|
|
2124
2187
|
Radio,
|
|
2125
2188
|
Rate,
|
|
2189
|
+
ReportErrorProvider,
|
|
2126
2190
|
Result,
|
|
2127
2191
|
Row,
|
|
2128
2192
|
RowActions,
|