@qq1948037137/adminsmart-ui 0.1.28 → 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 CHANGED
@@ -51,7 +51,9 @@ function Example() {
51
51
 
52
52
  `Pagination`、`Table`、`DataTable` 和显式启用分页的 `List` 默认显示 `共 N 条`,数量来自 Ant 的本地数据总数或业务传入的 `total`,不会把当前页行数当作完整数量。原生 `showTotal={(total, range) => ...}` 可自定义总数文案,显式 `showTotal={undefined}` 可隐藏;表格和列表仍可通过 `pagination={false}` 关闭分页。页码、每页条数、回调、ref 和原生公开类型继续保留,列表未配置分页时不会额外开启分页。
53
53
 
54
- 将 `TableControls` 放在 `SearchPanel.trailingTools`,将新增、导出等业务操作放在 `SearchPanel.tools`。右侧始终按搜索显隐、刷新、选择列排列。宿主控制搜索显隐、加载和可见列,并可声明不可切换的列。组件示例展示如何连接搜索状态和表格列。
54
+ 用 `ReportErrorProvider` 在应用入口绑定问题上报行为。`OperationToolbar` 将「问题上报」放在新增、导出等左侧业务操作之后,右侧的 `TableControls` 依次提供搜索显隐、刷新和选择列。`SearchPanel.tools/trailingTools` 和 `CrudWorkspace.actions/controls` 会使用同一个操作栏。没有列表工具栏的页面可使用 `ErrorReportButton`。宿主负责采集范围、脱敏、请求和结果反馈。
55
+
56
+ 在 `WorkspaceLayout contentMode="table"` 的内容区嵌入 `CrudWorkspace`,可使用独立的筛选、操作栏、反馈与页脚插槽,`DataTable` 自动填满剩余区域。结果超出高度时在表体内滚动,分页仍保持可见。文档站的「CrudWorkspace 标准 CRUD 工作区」展示同一布局中的搜索、刷新、显隐列、新建、编辑和删除。
55
57
 
56
58
  主应用的本地 tarball 过渡与 npm Registry 升级都必须锁定精确版本、实际包名和完整性,不能仅改依赖字符串而跳过来源校验。本库通过 `adminsmartUiSource: { sha256, gitCommit }` 提供构建源码标记,消费者使用 Registry 的 `dist.integrity` 与 `dist.tarball` 核对字节。该标记是项目来源契约,不是官方 provenance。
57
59
 
package/dist/index.cjs CHANGED
@@ -53,6 +53,7 @@ __export(src_exports, {
53
53
  ColorPicker: () => ColorPicker,
54
54
  ConfigProvider: () => ConfigProvider,
55
55
  CrudScaffold: () => CrudScaffold,
56
+ CrudWorkspace: () => CrudWorkspace,
56
57
  DataTable: () => DataTable,
57
58
  DatePicker: () => DatePicker,
58
59
  Descriptions: () => Descriptions,
@@ -61,6 +62,7 @@ __export(src_exports, {
61
62
  Dropdown: () => Dropdown,
62
63
  EllipsisText: () => EllipsisText,
63
64
  Empty: () => Empty,
65
+ ErrorReportButton: () => ErrorReportButton,
64
66
  Flex: () => Flex,
65
67
  FloatButton: () => FloatButton,
66
68
  Form: () => Form,
@@ -75,6 +77,7 @@ __export(src_exports, {
75
77
  Mentions: () => Mentions,
76
78
  Menu: () => Menu,
77
79
  Modal: () => Modal,
80
+ OperationToolbar: () => OperationToolbar,
78
81
  Pagination: () => Pagination,
79
82
  Popconfirm: () => Popconfirm,
80
83
  Popover: () => Popover,
@@ -82,6 +85,7 @@ __export(src_exports, {
82
85
  QRCode: () => QRCode,
83
86
  Radio: () => Radio,
84
87
  Rate: () => Rate,
88
+ ReportErrorProvider: () => ReportErrorProvider,
85
89
  Result: () => Result,
86
90
  Row: () => Row,
87
91
  RowActions: () => RowActions,
@@ -1291,8 +1295,68 @@ var SessionReplay = (0, import_react6.forwardRef)(function SessionReplay2({ even
1291
1295
  });
1292
1296
 
1293
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
1294
1305
  var import_icons3 = require("@ant-design/icons");
1295
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
+ }
1296
1360
 
1297
1361
  // src/composites/searchPanelModel.ts
1298
1362
  function searchColumnCount(width) {
@@ -1303,17 +1367,17 @@ function collapsedSearchFieldLimit(columns) {
1303
1367
  }
1304
1368
 
1305
1369
  // src/composites/SearchPanel.tsx
1306
- var import_jsx_runtime5 = require("react/jsx-runtime");
1307
- var SearchPanel = (0, import_react7.forwardRef)(function SearchPanel2({ fields, actions, tools, trailingTools, searchVisible = true, defaultExpanded = false, role = "search", style, ...props }, ref) {
1308
- const rootRef = (0, import_react7.useRef)(null);
1309
- const [width, setWidth] = (0, import_react7.useState)(0);
1310
- const [expanded, setExpanded] = (0, import_react7.useState)(defaultExpanded);
1311
- const items = import_react7.Children.toArray(fields);
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);
1312
1376
  const columns = searchColumnCount(width);
1313
1377
  const collapsedLimit = collapsedSearchFieldLimit(columns);
1314
1378
  const hasMore = items.length > collapsedLimit;
1315
1379
  const fieldWidth = Math.min(240, Math.max(0, width));
1316
- (0, import_react7.useEffect)(() => {
1380
+ (0, import_react9.useEffect)(() => {
1317
1381
  const element = rootRef.current;
1318
1382
  if (!element) return void 0;
1319
1383
  const update = () => {
@@ -1342,10 +1406,10 @@ var SearchPanel = (0, import_react7.forwardRef)(function SearchPanel2({ fields,
1342
1406
  ...style
1343
1407
  };
1344
1408
  const hasToolbar = tools != null || trailingTools != null;
1345
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { ...props, ref: setRootRef, role: hasToolbar ? "toolbar" : role, style: panelStyle, "data-adminsmart-search-panel": "true", children: [
1346
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("style", { children: "[data-adminsmart-search-field] > .ant-form-item { margin-bottom: 0; }" }),
1347
- (items.length > 0 || actions != null) && /* @__PURE__ */ (0, import_jsx_runtime5.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: [
1348
- items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
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)(
1349
1413
  "div",
1350
1414
  {
1351
1415
  hidden: !expanded && index >= collapsedLimit,
@@ -1353,33 +1417,30 @@ var SearchPanel = (0, import_react7.forwardRef)(function SearchPanel2({ fields,
1353
1417
  style: { minWidth: 0, width: fieldWidth || "min(240px, 100%)", flex: "0 0 auto" },
1354
1418
  children: item
1355
1419
  },
1356
- (0, import_react7.isValidElement)(item) ? item.key ?? index : index
1420
+ (0, import_react9.isValidElement)(item) ? item.key ?? index : index
1357
1421
  )),
1358
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-adminsmart-search-actions": "true", style: { display: "flex", alignItems: "center", gap: 8, minHeight: 32 }, children: [
1359
- hasMore ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
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)(
1360
1424
  Button,
1361
1425
  {
1362
1426
  type: "link",
1363
- icon: expanded ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons3.DownOutlined, {}),
1427
+ icon: expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons4.UpOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons4.DownOutlined, {}),
1364
1428
  "aria-expanded": expanded,
1365
1429
  onClick: () => setExpanded((value) => !value),
1366
1430
  children: expanded ? "\u6536\u8D77\u7B5B\u9009" : "\u5C55\u5F00\u7B5B\u9009"
1367
1431
  }
1368
1432
  ) : null,
1369
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: actions })
1433
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: actions })
1370
1434
  ] })
1371
1435
  ] }),
1372
- hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-adminsmart-toolbar-row": "true", style: { display: "flex", width: "100%", minWidth: 0, alignItems: "center", justifyContent: "space-between", flexWrap: "wrap", gap: 12 }, children: [
1373
- /* @__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 }),
1374
- /* @__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 })
1375
- ] })
1436
+ hasToolbar && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(OperationToolbar, { actions: tools, controls: trailingTools })
1376
1437
  ] });
1377
1438
  });
1378
1439
 
1379
1440
  // src/composites/TableControls.tsx
1380
- var import_icons4 = require("@ant-design/icons");
1381
- var import_react8 = require("react");
1382
- var import_jsx_runtime6 = require("react/jsx-runtime");
1441
+ var import_icons5 = require("@ant-design/icons");
1442
+ var import_react10 = require("react");
1443
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1383
1444
  function TableControls({
1384
1445
  searchVisible = true,
1385
1446
  onSearchVisibleChange,
@@ -1391,10 +1452,10 @@ function TableControls({
1391
1452
  className,
1392
1453
  style
1393
1454
  }) {
1394
- const [open, setOpen] = (0, import_react8.useState)(false);
1395
- const triggerRef = (0, import_react8.useRef)(null);
1396
- const panelRef = (0, import_react8.useRef)(null);
1397
- const panelId = (0, import_react8.useId)();
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)();
1398
1459
  const editable = columns.filter((column) => !column.disabled);
1399
1460
  const visible = new Set(visibleColumns ?? columns.map((column) => column.key));
1400
1461
  const checkedCount = editable.filter((column) => visible.has(column.key)).length;
@@ -1422,28 +1483,30 @@ function TableControls({
1422
1483
  maxHeight: "min(380px, 60vh)",
1423
1484
  overflow: "auto"
1424
1485
  };
1425
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className, style: { display: "inline-flex", alignItems: "center", flexShrink: 0, gap: 8, ...style }, children: [
1426
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Tooltip, { title: searchLabel, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
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)(
1427
1488
  Button,
1428
1489
  {
1429
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.SearchOutlined, { "aria-hidden": "true" }),
1490
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.SearchOutlined, { "aria-hidden": "true" }),
1430
1491
  "aria-label": searchLabel,
1431
1492
  "aria-pressed": searchVisible,
1493
+ "data-adminsmart-table-tool": "true",
1432
1494
  disabled: !onSearchVisibleChange,
1433
1495
  onClick: () => onSearchVisibleChange?.(!searchVisible)
1434
1496
  }
1435
1497
  ) }),
1436
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Tooltip, { title: "\u5237\u65B0\u5217\u8868", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1498
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Tooltip, { title: "\u5237\u65B0\u5217\u8868", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1437
1499
  Button,
1438
1500
  {
1439
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.ReloadOutlined, { "aria-hidden": "true" }),
1501
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.ReloadOutlined, { "aria-hidden": "true" }),
1440
1502
  "aria-label": "\u5237\u65B0\u5217\u8868",
1503
+ "data-adminsmart-table-tool": "true",
1441
1504
  loading: refreshing,
1442
1505
  disabled: !onRefresh || refreshing,
1443
1506
  onClick: onRefresh
1444
1507
  }
1445
1508
  ) }),
1446
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1509
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1447
1510
  Popover,
1448
1511
  {
1449
1512
  trigger: "click",
@@ -1454,8 +1517,8 @@ function TableControls({
1454
1517
  afterOpenChange: (opened) => {
1455
1518
  if (opened) panelRef.current?.querySelector("input:not(:disabled)")?.focus();
1456
1519
  },
1457
- content: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: panelRef, id: panelId, role: "dialog", "aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217", onKeyDown: closeOnEscape, style: panelStyle, children: [
1458
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
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)(
1459
1522
  Checkbox,
1460
1523
  {
1461
1524
  checked: checkedCount === editable.length,
@@ -1464,7 +1527,7 @@ function TableControls({
1464
1527
  children: "\u663E\u793A\u5168\u90E8\u53EF\u9009\u5217"
1465
1528
  }
1466
1529
  ),
1467
- columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1530
+ columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1468
1531
  Checkbox,
1469
1532
  {
1470
1533
  checked: visible.has(column.key),
@@ -1475,12 +1538,13 @@ function TableControls({
1475
1538
  column.key
1476
1539
  ))
1477
1540
  ] }),
1478
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1541
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1479
1542
  Button,
1480
1543
  {
1481
1544
  ref: triggerRef,
1482
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.SettingOutlined, { "aria-hidden": "true" }),
1545
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons5.SettingOutlined, { "aria-hidden": "true" }),
1483
1546
  "aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
1547
+ "data-adminsmart-table-tool": "true",
1484
1548
  "aria-haspopup": "dialog",
1485
1549
  "aria-expanded": canSetColumns && open,
1486
1550
  "aria-controls": canSetColumns && open ? panelId : void 0,
@@ -1494,8 +1558,26 @@ function TableControls({
1494
1558
  }
1495
1559
 
1496
1560
  // src/composites/DataTable.tsx
1497
- var import_react9 = require("react");
1498
- var import_jsx_runtime7 = require("react/jsx-runtime");
1561
+ var import_react12 = require("react");
1562
+
1563
+ // src/composites/CrudWorkspace.tsx
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 }) {
1568
+ const classes = ["adminsmart-crud-workspace", className].filter(Boolean).join(" ");
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 })
1576
+ ] });
1577
+ }
1578
+
1579
+ // src/composites/DataTable.tsx
1580
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1499
1581
  function tableBodyHeight(availableHeight, chromeHeight) {
1500
1582
  return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
1501
1583
  }
@@ -1516,13 +1598,22 @@ function DataTableInner({
1516
1598
  scroll,
1517
1599
  ...tableProps
1518
1600
  }, ref) {
1519
- const containerRef = (0, import_react9.useRef)(null);
1520
- const [bodyHeight, setBodyHeight] = (0, import_react9.useState)(360);
1521
- const hasExplicitHeight = containerHeight != null || containerStyle?.height != null;
1522
- (0, import_react9.useLayoutEffect)(() => {
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);
1604
+ const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
1605
+ const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
1606
+ (0, import_react12.useLayoutEffect)(() => {
1523
1607
  const container = containerRef.current;
1524
1608
  if (!container || scroll?.y != null) return void 0;
1525
1609
  const update = () => {
1610
+ if (hasExplicitHeight) {
1611
+ const height = container.getBoundingClientRect().height;
1612
+ const chromeHeight = tableChromeHeight(container);
1613
+ const nextHeight2 = inWorkspace ? Math.max(0, Math.floor(height - chromeHeight)) : tableBodyHeight(height, chromeHeight);
1614
+ setBodyHeight((current) => current === nextHeight2 ? current : nextHeight2);
1615
+ return;
1616
+ }
1526
1617
  const top = container.getBoundingClientRect().top;
1527
1618
  let boundary = container.parentElement;
1528
1619
  while (boundary && ["", "visible", "clip"].includes(getComputedStyle(boundary).overflowY)) {
@@ -1531,13 +1622,16 @@ function DataTableInner({
1531
1622
  const boundaryStyle = boundary ? getComputedStyle(boundary) : null;
1532
1623
  const parentBottom = boundary ? boundary.getBoundingClientRect().bottom - Number.parseFloat(boundaryStyle?.paddingBottom || "0") : Number.POSITIVE_INFINITY;
1533
1624
  const viewportBottom = window.visualViewport?.height ?? window.innerHeight;
1534
- const availableHeight = !hasExplicitHeight ? Math.max(200, Math.min(viewportBottom - 16, parentBottom - 16) - top) : container.getBoundingClientRect().height;
1625
+ const availableHeight = Math.max(200, Math.min(viewportBottom - 16, parentBottom - 16) - top);
1535
1626
  const nextHeight = tableBodyHeight(availableHeight, tableChromeHeight(container));
1536
1627
  setBodyHeight((current) => current === nextHeight ? current : nextHeight);
1537
1628
  };
1538
1629
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
1539
1630
  observer?.observe(container);
1540
1631
  if (container.parentElement) observer?.observe(container.parentElement);
1632
+ if (inWorkspace) {
1633
+ for (const region of container.querySelectorAll(".ant-table-header, .ant-table-pagination, .ant-table-title, .ant-table-footer")) observer?.observe(region);
1634
+ }
1541
1635
  window.addEventListener("resize", update);
1542
1636
  window.visualViewport?.addEventListener("resize", update);
1543
1637
  update();
@@ -1546,21 +1640,22 @@ function DataTableInner({
1546
1640
  window.removeEventListener("resize", update);
1547
1641
  window.visualViewport?.removeEventListener("resize", update);
1548
1642
  };
1549
- }, [hasExplicitHeight, containerHeight, pagination, scroll?.y, tableProps.dataSource?.length]);
1643
+ }, [hasExplicitHeight, inWorkspace, tableHeight, pagination, scroll?.y, tableProps.dataSource?.length]);
1550
1644
  const tableScroll = {
1551
1645
  ...scroll,
1552
1646
  x: scroll?.x ?? "max-content",
1553
1647
  y: scroll?.y ?? bodyHeight
1554
1648
  };
1555
1649
  const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
1556
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1650
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1557
1651
  "div",
1558
1652
  {
1559
1653
  ref: containerRef,
1560
1654
  className: containerClassName,
1561
1655
  "data-adminsmart-data-table": "true",
1562
- style: { width: "100%", minWidth: 0, overflowX: "hidden", ...containerHeight == null ? {} : { height: containerHeight, overflowY: "hidden" }, ...containerStyle },
1563
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1656
+ "data-adminsmart-data-table-fill": inWorkspace || void 0,
1657
+ style: { width: "100%", minWidth: 0, overflowX: "hidden", ...tableHeight == null ? {} : { height: tableHeight, overflowY: "hidden" }, ...containerStyle },
1658
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1564
1659
  Table,
1565
1660
  {
1566
1661
  ...tableProps,
@@ -1572,11 +1667,11 @@ function DataTableInner({
1572
1667
  }
1573
1668
  );
1574
1669
  }
1575
- var DataTable = (0, import_react9.forwardRef)(DataTableInner);
1670
+ var DataTable = (0, import_react12.forwardRef)(DataTableInner);
1576
1671
 
1577
1672
  // src/composites/WorkspaceLayout.tsx
1578
1673
  var import_antd46 = require("antd");
1579
- var import_jsx_runtime8 = require("react/jsx-runtime");
1674
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1580
1675
  var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
1581
1676
  function WorkspaceLayout({
1582
1677
  header,
@@ -1608,10 +1703,10 @@ function WorkspaceLayout({
1608
1703
  "--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
1609
1704
  // 夜间不复用日间固定底色。
1610
1705
  };
1611
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
1612
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("header", { className: "adminsmart-workspace__header", children: header }),
1613
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Layout, { className: "adminsmart-workspace__body", children: [
1614
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
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)(
1615
1710
  Layout.Sider,
1616
1711
  {
1617
1712
  theme: themeMode,
@@ -1623,9 +1718,9 @@ function WorkspaceLayout({
1623
1718
  children: sidebar
1624
1719
  }
1625
1720
  ),
1626
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Layout, { className: "adminsmart-workspace__main", children: [
1721
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Layout, { className: "adminsmart-workspace__main", children: [
1627
1722
  tabs,
1628
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
1723
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
1629
1724
  footer
1630
1725
  ] })
1631
1726
  ] })
@@ -1633,7 +1728,7 @@ function WorkspaceLayout({
1633
1728
  }
1634
1729
 
1635
1730
  // src/composites/CrudScaffold.tsx
1636
- var import_jsx_runtime9 = require("react/jsx-runtime");
1731
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1637
1732
  function CrudScaffold({
1638
1733
  label,
1639
1734
  description,
@@ -1645,16 +1740,16 @@ function CrudScaffold({
1645
1740
  ...props
1646
1741
  }) {
1647
1742
  const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
1648
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
1649
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "adminsmart-crud__filters", children: filters }),
1650
- status ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "adminsmart-crud__status", children: status }) : null,
1651
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "adminsmart-crud__results", children: results }),
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 }),
1652
1747
  drawer
1653
1748
  ] });
1654
1749
  }
1655
1750
 
1656
1751
  // src/composites/EllipsisText.tsx
1657
- var import_jsx_runtime10 = require("react/jsx-runtime");
1752
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1658
1753
  function EllipsisText({
1659
1754
  children,
1660
1755
  maxWidth = 240,
@@ -1666,7 +1761,7 @@ function EllipsisText({
1666
1761
  const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
1667
1762
  const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
1668
1763
  const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
1669
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1764
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1670
1765
  Typography.Text,
1671
1766
  {
1672
1767
  ...props,
@@ -1679,14 +1774,14 @@ function EllipsisText({
1679
1774
  }
1680
1775
 
1681
1776
  // src/composites/RowActions.tsx
1682
- var import_icons5 = require("@ant-design/icons");
1683
- var import_react10 = require("react");
1684
- var import_jsx_runtime11 = require("react/jsx-runtime");
1777
+ var import_icons6 = require("@ant-design/icons");
1778
+ var import_react13 = require("react");
1779
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1685
1780
  function collectButtons(children) {
1686
1781
  const actions = [];
1687
- import_react10.Children.forEach(children, (child) => {
1688
- if (!(0, import_react10.isValidElement)(child)) return;
1689
- if (child.type === import_react10.Fragment) actions.push(...collectButtons(child.props.children));
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));
1690
1785
  else {
1691
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");
1692
1787
  if (!child.props.hidden) actions.push(child);
@@ -1712,9 +1807,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
1712
1807
  // 菜单仍按官方语义标识需要确认的动作。
1713
1808
  }));
1714
1809
  const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
1715
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Space, { ...props, className: classes, size, wrap, children: [
1810
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Space, { ...props, className: classes, size, wrap, children: [
1716
1811
  direct,
1717
- overflow.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1812
+ overflow.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1718
1813
  Dropdown,
1719
1814
  {
1720
1815
  trigger: ["click"],
@@ -1726,12 +1821,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
1726
1821
  action.props.onClick?.(domEvent);
1727
1822
  }
1728
1823
  },
1729
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Tooltip, { title: moreLabel, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1824
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Tooltip, { title: moreLabel, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1730
1825
  Button,
1731
1826
  {
1732
1827
  type: "text",
1733
1828
  size: "small",
1734
- icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons5.EllipsisOutlined, {}),
1829
+ icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons6.EllipsisOutlined, {}),
1735
1830
  "aria-label": moreLabel,
1736
1831
  "aria-haspopup": "menu",
1737
1832
  "data-adminsmart-row-more": "true",
@@ -1745,7 +1840,7 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
1745
1840
 
1746
1841
  // src/schema/SchemaForm.tsx
1747
1842
  var import_dayjs = __toESM(require("dayjs"), 1);
1748
- var import_react11 = require("react");
1843
+ var import_react14 = require("react");
1749
1844
 
1750
1845
  // src/schema/model.ts
1751
1846
  var FIELD_TYPES = /* @__PURE__ */ new Set([
@@ -1928,7 +2023,7 @@ function schemaInitialValues(schema) {
1928
2023
  }
1929
2024
 
1930
2025
  // src/schema/SchemaForm.tsx
1931
- var import_jsx_runtime12 = require("react/jsx-runtime");
2026
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1932
2027
  function fieldRules(field) {
1933
2028
  const rules = [];
1934
2029
  if (field.required) {
@@ -1973,32 +2068,32 @@ function dateItemProps(field) {
1973
2068
  function renderControl(field) {
1974
2069
  switch (field.type) {
1975
2070
  case "input":
1976
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Input, { placeholder: field.placeholder });
2071
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input, { placeholder: field.placeholder });
1977
2072
  case "password":
1978
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Input.Password, { placeholder: field.placeholder });
2073
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input.Password, { placeholder: field.placeholder });
1979
2074
  case "textarea":
1980
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Input.TextArea, { placeholder: field.placeholder });
2075
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Input.TextArea, { placeholder: field.placeholder });
1981
2076
  case "number":
1982
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
2077
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
1983
2078
  case "select":
1984
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Select, { placeholder: field.placeholder, options: field.options });
2079
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Select, { placeholder: field.placeholder, options: field.options });
1985
2080
  case "radio":
1986
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Radio.Group, { options: field.options });
2081
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Radio.Group, { options: field.options });
1987
2082
  case "checkbox":
1988
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Checkbox, {});
2083
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Checkbox, {});
1989
2084
  case "switch":
1990
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Switch, {});
2085
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Switch, {});
1991
2086
  case "date":
1992
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
2087
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
1993
2088
  case "dateRange":
1994
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
2089
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
1995
2090
  }
1996
2091
  }
1997
- var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
2092
+ var SchemaForm = (0, import_react14.forwardRef)(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
1998
2093
  const result = validateSchemaForm(schema);
1999
2094
  if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
2000
2095
  const defaults = schemaInitialValues(schema);
2001
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2096
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2002
2097
  Form,
2003
2098
  {
2004
2099
  ...formProps,
@@ -2016,7 +2111,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
2016
2111
  children: [
2017
2112
  schema.fields.map((field) => {
2018
2113
  const mapped = mapSchemaField(field);
2019
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2114
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2020
2115
  Form.Item,
2021
2116
  {
2022
2117
  name: mapped.name,
@@ -2029,7 +2124,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
2029
2124
  mapped.name
2030
2125
  );
2031
2126
  }),
2032
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
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" }) })
2033
2128
  ]
2034
2129
  }
2035
2130
  );
@@ -2059,6 +2154,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
2059
2154
  ColorPicker,
2060
2155
  ConfigProvider,
2061
2156
  CrudScaffold,
2157
+ CrudWorkspace,
2062
2158
  DataTable,
2063
2159
  DatePicker,
2064
2160
  Descriptions,
@@ -2067,6 +2163,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
2067
2163
  Dropdown,
2068
2164
  EllipsisText,
2069
2165
  Empty,
2166
+ ErrorReportButton,
2070
2167
  Flex,
2071
2168
  FloatButton,
2072
2169
  Form,
@@ -2081,6 +2178,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
2081
2178
  Mentions,
2082
2179
  Menu,
2083
2180
  Modal,
2181
+ OperationToolbar,
2084
2182
  Pagination,
2085
2183
  Popconfirm,
2086
2184
  Popover,
@@ -2088,6 +2186,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
2088
2186
  QRCode,
2089
2187
  Radio,
2090
2188
  Rate,
2189
+ ReportErrorProvider,
2091
2190
  Result,
2092
2191
  Row,
2093
2192
  RowActions,