@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 +3 -1
- package/dist/index.cjs +189 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -4
- package/dist/index.d.ts +72 -4
- package/dist/index.js +174 -78
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/styles/composites.css +49 -0
package/dist/index.js
CHANGED
|
@@ -1205,10 +1205,70 @@ import {
|
|
|
1205
1205
|
forwardRef as forwardRef5,
|
|
1206
1206
|
isValidElement,
|
|
1207
1207
|
useEffect as useEffect4,
|
|
1208
|
-
useRef as
|
|
1209
|
-
useState as
|
|
1208
|
+
useRef as useRef5,
|
|
1209
|
+
useState as useState5
|
|
1210
1210
|
} from "react";
|
|
1211
1211
|
|
|
1212
|
+
// src/composites/OperationToolbar.tsx
|
|
1213
|
+
import { createContext, useContext } from "react";
|
|
1214
|
+
|
|
1215
|
+
// src/composites/ErrorReportButton.tsx
|
|
1216
|
+
import { BugOutlined } from "@ant-design/icons";
|
|
1217
|
+
import { useRef as useRef4, useState as useState4 } from "react";
|
|
1218
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1219
|
+
function ErrorReportButton({
|
|
1220
|
+
onReport,
|
|
1221
|
+
disabled = false,
|
|
1222
|
+
onReportFailure,
|
|
1223
|
+
description = "\u95EE\u9898\u4E0A\u62A5"
|
|
1224
|
+
}) {
|
|
1225
|
+
const pending = useRef4(false);
|
|
1226
|
+
const [reporting, setReporting] = useState4(false);
|
|
1227
|
+
async function report() {
|
|
1228
|
+
if (disabled || pending.current) return;
|
|
1229
|
+
pending.current = true;
|
|
1230
|
+
setReporting(true);
|
|
1231
|
+
try {
|
|
1232
|
+
await onReport();
|
|
1233
|
+
} catch (error) {
|
|
1234
|
+
onReportFailure?.(error);
|
|
1235
|
+
} finally {
|
|
1236
|
+
pending.current = false;
|
|
1237
|
+
setReporting(false);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
return /* @__PURE__ */ jsx5(Tooltip, { title: description, children: /* @__PURE__ */ jsx5(
|
|
1241
|
+
Button,
|
|
1242
|
+
{
|
|
1243
|
+
"data-adminsmart-error-report": "true",
|
|
1244
|
+
icon: /* @__PURE__ */ jsx5(BugOutlined, { "aria-hidden": "true" }),
|
|
1245
|
+
disabled,
|
|
1246
|
+
loading: reporting,
|
|
1247
|
+
onClick: report,
|
|
1248
|
+
children: "\u95EE\u9898\u4E0A\u62A5"
|
|
1249
|
+
}
|
|
1250
|
+
) });
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// src/composites/OperationToolbar.tsx
|
|
1254
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1255
|
+
var ReportErrorContext = createContext(void 0);
|
|
1256
|
+
function ReportErrorProvider({ children, ...config }) {
|
|
1257
|
+
return /* @__PURE__ */ jsx6(ReportErrorContext.Provider, { value: config, children });
|
|
1258
|
+
}
|
|
1259
|
+
function OperationToolbar({ actions, controls, errorReport, style, ...props }) {
|
|
1260
|
+
const providedReport = useContext(ReportErrorContext);
|
|
1261
|
+
const report = errorReport === false ? void 0 : errorReport ?? providedReport;
|
|
1262
|
+
if (actions == null && controls == null && !report) return null;
|
|
1263
|
+
return /* @__PURE__ */ jsxs2(Flex, { ...props, align: "center", wrap: true, gap: 12, "data-adminsmart-toolbar-row": "true", style: { width: "100%", minWidth: 0, ...style }, children: [
|
|
1264
|
+
/* @__PURE__ */ jsxs2(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: [
|
|
1265
|
+
actions,
|
|
1266
|
+
report && /* @__PURE__ */ jsx6(ErrorReportButton, { ...report })
|
|
1267
|
+
] }),
|
|
1268
|
+
controls != null && /* @__PURE__ */ jsx6(Flex, { align: "center", wrap: true, gap: 12, role: "group", "aria-label": "\u8868\u683C\u5DE5\u5177", style: { minWidth: 0, marginInlineStart: "auto", minHeight: 32 }, children: controls })
|
|
1269
|
+
] });
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1212
1272
|
// src/composites/searchPanelModel.ts
|
|
1213
1273
|
function searchColumnCount(width) {
|
|
1214
1274
|
return Math.min(6, Math.max(1, Math.floor((Math.max(0, width) + 16) / 256)));
|
|
@@ -1218,11 +1278,11 @@ function collapsedSearchFieldLimit(columns) {
|
|
|
1218
1278
|
}
|
|
1219
1279
|
|
|
1220
1280
|
// src/composites/SearchPanel.tsx
|
|
1221
|
-
import { jsx as
|
|
1281
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1222
1282
|
var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, trailingTools, searchVisible = true, defaultExpanded = false, role = "search", style, ...props }, ref) {
|
|
1223
|
-
const rootRef =
|
|
1224
|
-
const [width, setWidth] =
|
|
1225
|
-
const [expanded, setExpanded] =
|
|
1283
|
+
const rootRef = useRef5(null);
|
|
1284
|
+
const [width, setWidth] = useState5(0);
|
|
1285
|
+
const [expanded, setExpanded] = useState5(defaultExpanded);
|
|
1226
1286
|
const items = Children.toArray(fields);
|
|
1227
1287
|
const columns = searchColumnCount(width);
|
|
1228
1288
|
const collapsedLimit = collapsedSearchFieldLimit(columns);
|
|
@@ -1257,10 +1317,10 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1257
1317
|
...style
|
|
1258
1318
|
};
|
|
1259
1319
|
const hasToolbar = tools != null || trailingTools != null;
|
|
1260
|
-
return /* @__PURE__ */
|
|
1261
|
-
/* @__PURE__ */
|
|
1262
|
-
(items.length > 0 || actions != null) && /* @__PURE__ */
|
|
1263
|
-
items.map((item, index) => /* @__PURE__ */
|
|
1320
|
+
return /* @__PURE__ */ jsxs3("div", { ...props, ref: setRootRef, role: hasToolbar ? "toolbar" : role, style: panelStyle, "data-adminsmart-search-panel": "true", children: [
|
|
1321
|
+
/* @__PURE__ */ jsx7("style", { children: "[data-adminsmart-search-field] > .ant-form-item { margin-bottom: 0; }" }),
|
|
1322
|
+
(items.length > 0 || actions != null) && /* @__PURE__ */ jsxs3("div", { role: hasToolbar ? role : void 0, "aria-hidden": !searchVisible, style: { display: searchVisible ? "flex" : "none", width: "100%", flexWrap: "wrap", alignItems: "end", gap: "12px 16px" }, children: [
|
|
1323
|
+
items.map((item, index) => /* @__PURE__ */ jsx7(
|
|
1264
1324
|
"div",
|
|
1265
1325
|
{
|
|
1266
1326
|
hidden: !expanded && index >= collapsedLimit,
|
|
@@ -1270,31 +1330,28 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1270
1330
|
},
|
|
1271
1331
|
isValidElement(item) ? item.key ?? index : index
|
|
1272
1332
|
)),
|
|
1273
|
-
/* @__PURE__ */
|
|
1274
|
-
hasMore ? /* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ jsxs3("div", { "data-adminsmart-search-actions": "true", style: { display: "flex", alignItems: "center", gap: 8, minHeight: 32 }, children: [
|
|
1334
|
+
hasMore ? /* @__PURE__ */ jsx7(
|
|
1275
1335
|
Button,
|
|
1276
1336
|
{
|
|
1277
1337
|
type: "link",
|
|
1278
|
-
icon: expanded ? /* @__PURE__ */
|
|
1338
|
+
icon: expanded ? /* @__PURE__ */ jsx7(UpOutlined, {}) : /* @__PURE__ */ jsx7(DownOutlined, {}),
|
|
1279
1339
|
"aria-expanded": expanded,
|
|
1280
1340
|
onClick: () => setExpanded((value) => !value),
|
|
1281
1341
|
children: expanded ? "\u6536\u8D77\u7B5B\u9009" : "\u5C55\u5F00\u7B5B\u9009"
|
|
1282
1342
|
}
|
|
1283
1343
|
) : null,
|
|
1284
|
-
/* @__PURE__ */
|
|
1344
|
+
/* @__PURE__ */ jsx7("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: actions })
|
|
1285
1345
|
] })
|
|
1286
1346
|
] }),
|
|
1287
|
-
hasToolbar && /* @__PURE__ */
|
|
1288
|
-
/* @__PURE__ */ jsx5("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 }),
|
|
1289
|
-
/* @__PURE__ */ jsx5("div", { role: "group", "aria-label": "\u8868\u683C\u5DE5\u5177", style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 12, marginLeft: "auto", minHeight: 32 }, children: trailingTools })
|
|
1290
|
-
] })
|
|
1347
|
+
hasToolbar && /* @__PURE__ */ jsx7(OperationToolbar, { actions: tools, controls: trailingTools })
|
|
1291
1348
|
] });
|
|
1292
1349
|
});
|
|
1293
1350
|
|
|
1294
1351
|
// src/composites/TableControls.tsx
|
|
1295
1352
|
import { ReloadOutlined, SearchOutlined, SettingOutlined } from "@ant-design/icons";
|
|
1296
|
-
import { useId, useRef as
|
|
1297
|
-
import { jsx as
|
|
1353
|
+
import { useId, useRef as useRef6, useState as useState6 } from "react";
|
|
1354
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1298
1355
|
function TableControls({
|
|
1299
1356
|
searchVisible = true,
|
|
1300
1357
|
onSearchVisibleChange,
|
|
@@ -1306,9 +1363,9 @@ function TableControls({
|
|
|
1306
1363
|
className,
|
|
1307
1364
|
style
|
|
1308
1365
|
}) {
|
|
1309
|
-
const [open, setOpen] =
|
|
1310
|
-
const triggerRef =
|
|
1311
|
-
const panelRef =
|
|
1366
|
+
const [open, setOpen] = useState6(false);
|
|
1367
|
+
const triggerRef = useRef6(null);
|
|
1368
|
+
const panelRef = useRef6(null);
|
|
1312
1369
|
const panelId = useId();
|
|
1313
1370
|
const editable = columns.filter((column) => !column.disabled);
|
|
1314
1371
|
const visible = new Set(visibleColumns ?? columns.map((column) => column.key));
|
|
@@ -1337,28 +1394,30 @@ function TableControls({
|
|
|
1337
1394
|
maxHeight: "min(380px, 60vh)",
|
|
1338
1395
|
overflow: "auto"
|
|
1339
1396
|
};
|
|
1340
|
-
return /* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1397
|
+
return /* @__PURE__ */ jsxs4("div", { className, style: { display: "inline-flex", alignItems: "center", flexShrink: 0, gap: 8, ...style }, children: [
|
|
1398
|
+
/* @__PURE__ */ jsx8(Tooltip, { title: searchLabel, children: /* @__PURE__ */ jsx8(
|
|
1342
1399
|
Button,
|
|
1343
1400
|
{
|
|
1344
|
-
icon: /* @__PURE__ */
|
|
1401
|
+
icon: /* @__PURE__ */ jsx8(SearchOutlined, { "aria-hidden": "true" }),
|
|
1345
1402
|
"aria-label": searchLabel,
|
|
1346
1403
|
"aria-pressed": searchVisible,
|
|
1404
|
+
"data-adminsmart-table-tool": "true",
|
|
1347
1405
|
disabled: !onSearchVisibleChange,
|
|
1348
1406
|
onClick: () => onSearchVisibleChange?.(!searchVisible)
|
|
1349
1407
|
}
|
|
1350
1408
|
) }),
|
|
1351
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx8(Tooltip, { title: "\u5237\u65B0\u5217\u8868", children: /* @__PURE__ */ jsx8(
|
|
1352
1410
|
Button,
|
|
1353
1411
|
{
|
|
1354
|
-
icon: /* @__PURE__ */
|
|
1412
|
+
icon: /* @__PURE__ */ jsx8(ReloadOutlined, { "aria-hidden": "true" }),
|
|
1355
1413
|
"aria-label": "\u5237\u65B0\u5217\u8868",
|
|
1414
|
+
"data-adminsmart-table-tool": "true",
|
|
1356
1415
|
loading: refreshing,
|
|
1357
1416
|
disabled: !onRefresh || refreshing,
|
|
1358
1417
|
onClick: onRefresh
|
|
1359
1418
|
}
|
|
1360
1419
|
) }),
|
|
1361
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ jsx8(
|
|
1362
1421
|
Popover,
|
|
1363
1422
|
{
|
|
1364
1423
|
trigger: "click",
|
|
@@ -1369,8 +1428,8 @@ function TableControls({
|
|
|
1369
1428
|
afterOpenChange: (opened) => {
|
|
1370
1429
|
if (opened) panelRef.current?.querySelector("input:not(:disabled)")?.focus();
|
|
1371
1430
|
},
|
|
1372
|
-
content: /* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1431
|
+
content: /* @__PURE__ */ jsxs4("div", { ref: panelRef, id: panelId, role: "dialog", "aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217", onKeyDown: closeOnEscape, style: panelStyle, children: [
|
|
1432
|
+
/* @__PURE__ */ jsx8(
|
|
1374
1433
|
Checkbox,
|
|
1375
1434
|
{
|
|
1376
1435
|
checked: checkedCount === editable.length,
|
|
@@ -1379,7 +1438,7 @@ function TableControls({
|
|
|
1379
1438
|
children: "\u663E\u793A\u5168\u90E8\u53EF\u9009\u5217"
|
|
1380
1439
|
}
|
|
1381
1440
|
),
|
|
1382
|
-
columns.map((column) => /* @__PURE__ */
|
|
1441
|
+
columns.map((column) => /* @__PURE__ */ jsx8(
|
|
1383
1442
|
Checkbox,
|
|
1384
1443
|
{
|
|
1385
1444
|
checked: visible.has(column.key),
|
|
@@ -1390,12 +1449,13 @@ function TableControls({
|
|
|
1390
1449
|
column.key
|
|
1391
1450
|
))
|
|
1392
1451
|
] }),
|
|
1393
|
-
children: /* @__PURE__ */
|
|
1452
|
+
children: /* @__PURE__ */ jsx8(
|
|
1394
1453
|
Button,
|
|
1395
1454
|
{
|
|
1396
1455
|
ref: triggerRef,
|
|
1397
|
-
icon: /* @__PURE__ */
|
|
1456
|
+
icon: /* @__PURE__ */ jsx8(SettingOutlined, { "aria-hidden": "true" }),
|
|
1398
1457
|
"aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
|
|
1458
|
+
"data-adminsmart-table-tool": "true",
|
|
1399
1459
|
"aria-haspopup": "dialog",
|
|
1400
1460
|
"aria-expanded": canSetColumns && open,
|
|
1401
1461
|
"aria-controls": canSetColumns && open ? panelId : void 0,
|
|
@@ -1411,11 +1471,30 @@ function TableControls({
|
|
|
1411
1471
|
// src/composites/DataTable.tsx
|
|
1412
1472
|
import {
|
|
1413
1473
|
forwardRef as forwardRef6,
|
|
1474
|
+
useContext as useContext2,
|
|
1414
1475
|
useLayoutEffect,
|
|
1415
|
-
useRef as
|
|
1416
|
-
useState as
|
|
1476
|
+
useRef as useRef7,
|
|
1477
|
+
useState as useState7
|
|
1417
1478
|
} from "react";
|
|
1418
|
-
|
|
1479
|
+
|
|
1480
|
+
// src/composites/CrudWorkspace.tsx
|
|
1481
|
+
import { createContext as createContext2 } from "react";
|
|
1482
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1483
|
+
var CrudTableHeightContext = createContext2(false);
|
|
1484
|
+
function CrudWorkspace({ label, filters, toolbar, actions, controls, feedback, footer, children, className, ...props }) {
|
|
1485
|
+
const classes = ["adminsmart-crud-workspace", className].filter(Boolean).join(" ");
|
|
1486
|
+
const listToolbar = toolbar ?? (actions != null || controls != null ? /* @__PURE__ */ jsx9(OperationToolbar, { actions, controls }) : null);
|
|
1487
|
+
return /* @__PURE__ */ jsxs5("section", { ...props, className: classes, "aria-label": label, children: [
|
|
1488
|
+
filters != null && /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__filters", children: filters }),
|
|
1489
|
+
listToolbar != null && /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__toolbar", children: listToolbar }),
|
|
1490
|
+
feedback != null && /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__feedback", children: feedback }),
|
|
1491
|
+
/* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__results", children: /* @__PURE__ */ jsx9(CrudTableHeightContext.Provider, { value: true, children }) }),
|
|
1492
|
+
footer != null && /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__footer", children: footer })
|
|
1493
|
+
] });
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
// src/composites/DataTable.tsx
|
|
1497
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1419
1498
|
function tableBodyHeight(availableHeight, chromeHeight) {
|
|
1420
1499
|
return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
|
|
1421
1500
|
}
|
|
@@ -1436,13 +1515,22 @@ function DataTableInner({
|
|
|
1436
1515
|
scroll,
|
|
1437
1516
|
...tableProps
|
|
1438
1517
|
}, ref) {
|
|
1439
|
-
const containerRef =
|
|
1440
|
-
const [bodyHeight, setBodyHeight] =
|
|
1441
|
-
const
|
|
1518
|
+
const containerRef = useRef7(null);
|
|
1519
|
+
const [bodyHeight, setBodyHeight] = useState7(360);
|
|
1520
|
+
const inWorkspace = useContext2(CrudTableHeightContext);
|
|
1521
|
+
const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
|
|
1522
|
+
const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
|
|
1442
1523
|
useLayoutEffect(() => {
|
|
1443
1524
|
const container = containerRef.current;
|
|
1444
1525
|
if (!container || scroll?.y != null) return void 0;
|
|
1445
1526
|
const update = () => {
|
|
1527
|
+
if (hasExplicitHeight) {
|
|
1528
|
+
const height = container.getBoundingClientRect().height;
|
|
1529
|
+
const chromeHeight = tableChromeHeight(container);
|
|
1530
|
+
const nextHeight2 = inWorkspace ? Math.max(0, Math.floor(height - chromeHeight)) : tableBodyHeight(height, chromeHeight);
|
|
1531
|
+
setBodyHeight((current) => current === nextHeight2 ? current : nextHeight2);
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1446
1534
|
const top = container.getBoundingClientRect().top;
|
|
1447
1535
|
let boundary = container.parentElement;
|
|
1448
1536
|
while (boundary && ["", "visible", "clip"].includes(getComputedStyle(boundary).overflowY)) {
|
|
@@ -1451,13 +1539,16 @@ function DataTableInner({
|
|
|
1451
1539
|
const boundaryStyle = boundary ? getComputedStyle(boundary) : null;
|
|
1452
1540
|
const parentBottom = boundary ? boundary.getBoundingClientRect().bottom - Number.parseFloat(boundaryStyle?.paddingBottom || "0") : Number.POSITIVE_INFINITY;
|
|
1453
1541
|
const viewportBottom = window.visualViewport?.height ?? window.innerHeight;
|
|
1454
|
-
const availableHeight =
|
|
1542
|
+
const availableHeight = Math.max(200, Math.min(viewportBottom - 16, parentBottom - 16) - top);
|
|
1455
1543
|
const nextHeight = tableBodyHeight(availableHeight, tableChromeHeight(container));
|
|
1456
1544
|
setBodyHeight((current) => current === nextHeight ? current : nextHeight);
|
|
1457
1545
|
};
|
|
1458
1546
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
|
|
1459
1547
|
observer?.observe(container);
|
|
1460
1548
|
if (container.parentElement) observer?.observe(container.parentElement);
|
|
1549
|
+
if (inWorkspace) {
|
|
1550
|
+
for (const region of container.querySelectorAll(".ant-table-header, .ant-table-pagination, .ant-table-title, .ant-table-footer")) observer?.observe(region);
|
|
1551
|
+
}
|
|
1461
1552
|
window.addEventListener("resize", update);
|
|
1462
1553
|
window.visualViewport?.addEventListener("resize", update);
|
|
1463
1554
|
update();
|
|
@@ -1466,21 +1557,22 @@ function DataTableInner({
|
|
|
1466
1557
|
window.removeEventListener("resize", update);
|
|
1467
1558
|
window.visualViewport?.removeEventListener("resize", update);
|
|
1468
1559
|
};
|
|
1469
|
-
}, [hasExplicitHeight,
|
|
1560
|
+
}, [hasExplicitHeight, inWorkspace, tableHeight, pagination, scroll?.y, tableProps.dataSource?.length]);
|
|
1470
1561
|
const tableScroll = {
|
|
1471
1562
|
...scroll,
|
|
1472
1563
|
x: scroll?.x ?? "max-content",
|
|
1473
1564
|
y: scroll?.y ?? bodyHeight
|
|
1474
1565
|
};
|
|
1475
1566
|
const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
|
|
1476
|
-
return /* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ jsx10(
|
|
1477
1568
|
"div",
|
|
1478
1569
|
{
|
|
1479
1570
|
ref: containerRef,
|
|
1480
1571
|
className: containerClassName,
|
|
1481
1572
|
"data-adminsmart-data-table": "true",
|
|
1482
|
-
|
|
1483
|
-
|
|
1573
|
+
"data-adminsmart-data-table-fill": inWorkspace || void 0,
|
|
1574
|
+
style: { width: "100%", minWidth: 0, overflowX: "hidden", ...tableHeight == null ? {} : { height: tableHeight, overflowY: "hidden" }, ...containerStyle },
|
|
1575
|
+
children: /* @__PURE__ */ jsx10(
|
|
1484
1576
|
Table,
|
|
1485
1577
|
{
|
|
1486
1578
|
...tableProps,
|
|
@@ -1496,7 +1588,7 @@ var DataTable = forwardRef6(DataTableInner);
|
|
|
1496
1588
|
|
|
1497
1589
|
// src/composites/WorkspaceLayout.tsx
|
|
1498
1590
|
import { theme as theme2 } from "antd";
|
|
1499
|
-
import { jsx as
|
|
1591
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1500
1592
|
var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
|
|
1501
1593
|
function WorkspaceLayout({
|
|
1502
1594
|
header,
|
|
@@ -1528,10 +1620,10 @@ function WorkspaceLayout({
|
|
|
1528
1620
|
"--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
|
|
1529
1621
|
// 夜间不复用日间固定底色。
|
|
1530
1622
|
};
|
|
1531
|
-
return /* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1623
|
+
return /* @__PURE__ */ jsxs6(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
|
|
1624
|
+
/* @__PURE__ */ jsx11("header", { className: "adminsmart-workspace__header", children: header }),
|
|
1625
|
+
/* @__PURE__ */ jsxs6(Layout, { className: "adminsmart-workspace__body", children: [
|
|
1626
|
+
/* @__PURE__ */ jsx11(
|
|
1535
1627
|
Layout.Sider,
|
|
1536
1628
|
{
|
|
1537
1629
|
theme: themeMode,
|
|
@@ -1543,9 +1635,9 @@ function WorkspaceLayout({
|
|
|
1543
1635
|
children: sidebar
|
|
1544
1636
|
}
|
|
1545
1637
|
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1638
|
+
/* @__PURE__ */ jsxs6(Layout, { className: "adminsmart-workspace__main", children: [
|
|
1547
1639
|
tabs,
|
|
1548
|
-
/* @__PURE__ */
|
|
1640
|
+
/* @__PURE__ */ jsx11(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
|
|
1549
1641
|
footer
|
|
1550
1642
|
] })
|
|
1551
1643
|
] })
|
|
@@ -1553,7 +1645,7 @@ function WorkspaceLayout({
|
|
|
1553
1645
|
}
|
|
1554
1646
|
|
|
1555
1647
|
// src/composites/CrudScaffold.tsx
|
|
1556
|
-
import { jsx as
|
|
1648
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1557
1649
|
function CrudScaffold({
|
|
1558
1650
|
label,
|
|
1559
1651
|
description,
|
|
@@ -1565,16 +1657,16 @@ function CrudScaffold({
|
|
|
1565
1657
|
...props
|
|
1566
1658
|
}) {
|
|
1567
1659
|
const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
|
|
1568
|
-
return /* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
status ? /* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1660
|
+
return /* @__PURE__ */ jsxs7("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
|
|
1661
|
+
/* @__PURE__ */ jsx12("div", { className: "adminsmart-crud__filters", children: filters }),
|
|
1662
|
+
status ? /* @__PURE__ */ jsx12("div", { className: "adminsmart-crud__status", children: status }) : null,
|
|
1663
|
+
/* @__PURE__ */ jsx12("div", { className: "adminsmart-crud__results", children: results }),
|
|
1572
1664
|
drawer
|
|
1573
1665
|
] });
|
|
1574
1666
|
}
|
|
1575
1667
|
|
|
1576
1668
|
// src/composites/EllipsisText.tsx
|
|
1577
|
-
import { jsx as
|
|
1669
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1578
1670
|
function EllipsisText({
|
|
1579
1671
|
children,
|
|
1580
1672
|
maxWidth = 240,
|
|
@@ -1586,7 +1678,7 @@ function EllipsisText({
|
|
|
1586
1678
|
const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
|
|
1587
1679
|
const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
1588
1680
|
const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
|
|
1589
|
-
return /* @__PURE__ */
|
|
1681
|
+
return /* @__PURE__ */ jsx13(
|
|
1590
1682
|
Typography.Text,
|
|
1591
1683
|
{
|
|
1592
1684
|
...props,
|
|
@@ -1601,7 +1693,7 @@ function EllipsisText({
|
|
|
1601
1693
|
// src/composites/RowActions.tsx
|
|
1602
1694
|
import { EllipsisOutlined } from "@ant-design/icons";
|
|
1603
1695
|
import { Children as Children2, Fragment, isValidElement as isValidElement2 } from "react";
|
|
1604
|
-
import { jsx as
|
|
1696
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1605
1697
|
function collectButtons(children) {
|
|
1606
1698
|
const actions = [];
|
|
1607
1699
|
Children2.forEach(children, (child) => {
|
|
@@ -1632,9 +1724,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1632
1724
|
// 菜单仍按官方语义标识需要确认的动作。
|
|
1633
1725
|
}));
|
|
1634
1726
|
const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
|
|
1635
|
-
return /* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ jsxs8(Space, { ...props, className: classes, size, wrap, children: [
|
|
1636
1728
|
direct,
|
|
1637
|
-
overflow.length > 0 && /* @__PURE__ */
|
|
1729
|
+
overflow.length > 0 && /* @__PURE__ */ jsx14(
|
|
1638
1730
|
Dropdown,
|
|
1639
1731
|
{
|
|
1640
1732
|
trigger: ["click"],
|
|
@@ -1646,12 +1738,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1646
1738
|
action.props.onClick?.(domEvent);
|
|
1647
1739
|
}
|
|
1648
1740
|
},
|
|
1649
|
-
children: /* @__PURE__ */
|
|
1741
|
+
children: /* @__PURE__ */ jsx14(Tooltip, { title: moreLabel, children: /* @__PURE__ */ jsx14(
|
|
1650
1742
|
Button,
|
|
1651
1743
|
{
|
|
1652
1744
|
type: "text",
|
|
1653
1745
|
size: "small",
|
|
1654
|
-
icon: /* @__PURE__ */
|
|
1746
|
+
icon: /* @__PURE__ */ jsx14(EllipsisOutlined, {}),
|
|
1655
1747
|
"aria-label": moreLabel,
|
|
1656
1748
|
"aria-haspopup": "menu",
|
|
1657
1749
|
"data-adminsmart-row-more": "true",
|
|
@@ -1848,7 +1940,7 @@ function schemaInitialValues(schema) {
|
|
|
1848
1940
|
}
|
|
1849
1941
|
|
|
1850
1942
|
// src/schema/SchemaForm.tsx
|
|
1851
|
-
import { jsx as
|
|
1943
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1852
1944
|
function fieldRules(field) {
|
|
1853
1945
|
const rules = [];
|
|
1854
1946
|
if (field.required) {
|
|
@@ -1893,32 +1985,32 @@ function dateItemProps(field) {
|
|
|
1893
1985
|
function renderControl(field) {
|
|
1894
1986
|
switch (field.type) {
|
|
1895
1987
|
case "input":
|
|
1896
|
-
return /* @__PURE__ */
|
|
1988
|
+
return /* @__PURE__ */ jsx15(Input, { placeholder: field.placeholder });
|
|
1897
1989
|
case "password":
|
|
1898
|
-
return /* @__PURE__ */
|
|
1990
|
+
return /* @__PURE__ */ jsx15(Input.Password, { placeholder: field.placeholder });
|
|
1899
1991
|
case "textarea":
|
|
1900
|
-
return /* @__PURE__ */
|
|
1992
|
+
return /* @__PURE__ */ jsx15(Input.TextArea, { placeholder: field.placeholder });
|
|
1901
1993
|
case "number":
|
|
1902
|
-
return /* @__PURE__ */
|
|
1994
|
+
return /* @__PURE__ */ jsx15(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
|
|
1903
1995
|
case "select":
|
|
1904
|
-
return /* @__PURE__ */
|
|
1996
|
+
return /* @__PURE__ */ jsx15(Select, { placeholder: field.placeholder, options: field.options });
|
|
1905
1997
|
case "radio":
|
|
1906
|
-
return /* @__PURE__ */
|
|
1998
|
+
return /* @__PURE__ */ jsx15(Radio.Group, { options: field.options });
|
|
1907
1999
|
case "checkbox":
|
|
1908
|
-
return /* @__PURE__ */
|
|
2000
|
+
return /* @__PURE__ */ jsx15(Checkbox, {});
|
|
1909
2001
|
case "switch":
|
|
1910
|
-
return /* @__PURE__ */
|
|
2002
|
+
return /* @__PURE__ */ jsx15(Switch, {});
|
|
1911
2003
|
case "date":
|
|
1912
|
-
return /* @__PURE__ */
|
|
2004
|
+
return /* @__PURE__ */ jsx15(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
|
|
1913
2005
|
case "dateRange":
|
|
1914
|
-
return /* @__PURE__ */
|
|
2006
|
+
return /* @__PURE__ */ jsx15(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
|
|
1915
2007
|
}
|
|
1916
2008
|
}
|
|
1917
2009
|
var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
|
|
1918
2010
|
const result = validateSchemaForm(schema);
|
|
1919
2011
|
if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
|
|
1920
2012
|
const defaults = schemaInitialValues(schema);
|
|
1921
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ jsxs9(
|
|
1922
2014
|
Form,
|
|
1923
2015
|
{
|
|
1924
2016
|
...formProps,
|
|
@@ -1936,7 +2028,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1936
2028
|
children: [
|
|
1937
2029
|
schema.fields.map((field) => {
|
|
1938
2030
|
const mapped = mapSchemaField(field);
|
|
1939
|
-
return /* @__PURE__ */
|
|
2031
|
+
return /* @__PURE__ */ jsx15(
|
|
1940
2032
|
Form.Item,
|
|
1941
2033
|
{
|
|
1942
2034
|
name: mapped.name,
|
|
@@ -1949,7 +2041,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1949
2041
|
mapped.name
|
|
1950
2042
|
);
|
|
1951
2043
|
}),
|
|
1952
|
-
/* @__PURE__ */
|
|
2044
|
+
/* @__PURE__ */ jsx15(Form.Item, { children: /* @__PURE__ */ jsx15(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
|
|
1953
2045
|
]
|
|
1954
2046
|
}
|
|
1955
2047
|
);
|
|
@@ -1978,6 +2070,7 @@ export {
|
|
|
1978
2070
|
ColorPicker,
|
|
1979
2071
|
ConfigProvider,
|
|
1980
2072
|
CrudScaffold,
|
|
2073
|
+
CrudWorkspace,
|
|
1981
2074
|
DataTable,
|
|
1982
2075
|
DatePicker,
|
|
1983
2076
|
Descriptions,
|
|
@@ -1986,6 +2079,7 @@ export {
|
|
|
1986
2079
|
Dropdown,
|
|
1987
2080
|
EllipsisText,
|
|
1988
2081
|
Empty,
|
|
2082
|
+
ErrorReportButton,
|
|
1989
2083
|
Flex,
|
|
1990
2084
|
FloatButton,
|
|
1991
2085
|
Form,
|
|
@@ -2000,6 +2094,7 @@ export {
|
|
|
2000
2094
|
Mentions,
|
|
2001
2095
|
Menu,
|
|
2002
2096
|
Modal,
|
|
2097
|
+
OperationToolbar,
|
|
2003
2098
|
Pagination,
|
|
2004
2099
|
Popconfirm,
|
|
2005
2100
|
Popover,
|
|
@@ -2007,6 +2102,7 @@ export {
|
|
|
2007
2102
|
QRCode,
|
|
2008
2103
|
Radio,
|
|
2009
2104
|
Rate,
|
|
2105
|
+
ReportErrorProvider,
|
|
2010
2106
|
Result,
|
|
2011
2107
|
Row,
|
|
2012
2108
|
RowActions,
|