@qq1948037137/adminsmart-ui 0.1.29 → 0.1.31
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 +158 -95
- 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 +146 -86
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1205,10 +1205,69 @@ 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 { useRef as useRef4, useState as useState4 } from "react";
|
|
1217
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1218
|
+
function ErrorReportButton({
|
|
1219
|
+
onReport,
|
|
1220
|
+
disabled = false,
|
|
1221
|
+
onReportFailure,
|
|
1222
|
+
description
|
|
1223
|
+
}) {
|
|
1224
|
+
const pending = useRef4(false);
|
|
1225
|
+
const [reporting, setReporting] = useState4(false);
|
|
1226
|
+
async function report() {
|
|
1227
|
+
if (disabled || pending.current) return;
|
|
1228
|
+
pending.current = true;
|
|
1229
|
+
setReporting(true);
|
|
1230
|
+
try {
|
|
1231
|
+
await onReport();
|
|
1232
|
+
} catch (error) {
|
|
1233
|
+
onReportFailure?.(error);
|
|
1234
|
+
} finally {
|
|
1235
|
+
pending.current = false;
|
|
1236
|
+
setReporting(false);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
return /* @__PURE__ */ jsx5(
|
|
1240
|
+
Button,
|
|
1241
|
+
{
|
|
1242
|
+
"data-adminsmart-error-report": "true",
|
|
1243
|
+
"aria-description": description,
|
|
1244
|
+
"aria-busy": reporting || void 0,
|
|
1245
|
+
disabled: disabled || reporting,
|
|
1246
|
+
onClick: report,
|
|
1247
|
+
children: reporting ? "\u4E0A\u62A5\u4E2D\u2026" : "\u95EE\u9898\u4E0A\u62A5"
|
|
1248
|
+
}
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
// src/composites/OperationToolbar.tsx
|
|
1253
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1254
|
+
var ReportErrorContext = createContext(void 0);
|
|
1255
|
+
function ReportErrorProvider({ children, ...config }) {
|
|
1256
|
+
return /* @__PURE__ */ jsx6(ReportErrorContext.Provider, { value: config, children });
|
|
1257
|
+
}
|
|
1258
|
+
function OperationToolbar({ actions, controls, errorReport, style, ...props }) {
|
|
1259
|
+
const providedReport = useContext(ReportErrorContext);
|
|
1260
|
+
const report = errorReport === false ? void 0 : errorReport ?? providedReport;
|
|
1261
|
+
if (actions == null && controls == null && !report) return null;
|
|
1262
|
+
return /* @__PURE__ */ jsxs2(Flex, { ...props, align: "center", wrap: true, gap: 12, "data-adminsmart-toolbar-row": "true", style: { width: "100%", minWidth: 0, ...style }, children: [
|
|
1263
|
+
/* @__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: [
|
|
1264
|
+
actions,
|
|
1265
|
+
report && /* @__PURE__ */ jsx6(ErrorReportButton, { ...report })
|
|
1266
|
+
] }),
|
|
1267
|
+
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 })
|
|
1268
|
+
] });
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1212
1271
|
// src/composites/searchPanelModel.ts
|
|
1213
1272
|
function searchColumnCount(width) {
|
|
1214
1273
|
return Math.min(6, Math.max(1, Math.floor((Math.max(0, width) + 16) / 256)));
|
|
@@ -1218,11 +1277,11 @@ function collapsedSearchFieldLimit(columns) {
|
|
|
1218
1277
|
}
|
|
1219
1278
|
|
|
1220
1279
|
// src/composites/SearchPanel.tsx
|
|
1221
|
-
import { jsx as
|
|
1280
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1222
1281
|
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] =
|
|
1282
|
+
const rootRef = useRef5(null);
|
|
1283
|
+
const [width, setWidth] = useState5(0);
|
|
1284
|
+
const [expanded, setExpanded] = useState5(defaultExpanded);
|
|
1226
1285
|
const items = Children.toArray(fields);
|
|
1227
1286
|
const columns = searchColumnCount(width);
|
|
1228
1287
|
const collapsedLimit = collapsedSearchFieldLimit(columns);
|
|
@@ -1257,10 +1316,10 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1257
1316
|
...style
|
|
1258
1317
|
};
|
|
1259
1318
|
const hasToolbar = tools != null || trailingTools != null;
|
|
1260
|
-
return /* @__PURE__ */
|
|
1261
|
-
/* @__PURE__ */
|
|
1262
|
-
(items.length > 0 || actions != null) && /* @__PURE__ */
|
|
1263
|
-
items.map((item, index) => /* @__PURE__ */
|
|
1319
|
+
return /* @__PURE__ */ jsxs3("div", { ...props, ref: setRootRef, role: hasToolbar ? "toolbar" : role, style: panelStyle, "data-adminsmart-search-panel": "true", children: [
|
|
1320
|
+
/* @__PURE__ */ jsx7("style", { children: "[data-adminsmart-search-field] > .ant-form-item { margin-bottom: 0; }" }),
|
|
1321
|
+
(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: [
|
|
1322
|
+
items.map((item, index) => /* @__PURE__ */ jsx7(
|
|
1264
1323
|
"div",
|
|
1265
1324
|
{
|
|
1266
1325
|
hidden: !expanded && index >= collapsedLimit,
|
|
@@ -1270,31 +1329,28 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1270
1329
|
},
|
|
1271
1330
|
isValidElement(item) ? item.key ?? index : index
|
|
1272
1331
|
)),
|
|
1273
|
-
/* @__PURE__ */
|
|
1274
|
-
hasMore ? /* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ jsxs3("div", { "data-adminsmart-search-actions": "true", style: { display: "flex", alignItems: "center", gap: 8, minHeight: 32 }, children: [
|
|
1333
|
+
hasMore ? /* @__PURE__ */ jsx7(
|
|
1275
1334
|
Button,
|
|
1276
1335
|
{
|
|
1277
1336
|
type: "link",
|
|
1278
|
-
icon: expanded ? /* @__PURE__ */
|
|
1337
|
+
icon: expanded ? /* @__PURE__ */ jsx7(UpOutlined, {}) : /* @__PURE__ */ jsx7(DownOutlined, {}),
|
|
1279
1338
|
"aria-expanded": expanded,
|
|
1280
1339
|
onClick: () => setExpanded((value) => !value),
|
|
1281
1340
|
children: expanded ? "\u6536\u8D77\u7B5B\u9009" : "\u5C55\u5F00\u7B5B\u9009"
|
|
1282
1341
|
}
|
|
1283
1342
|
) : null,
|
|
1284
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ jsx7("span", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: actions })
|
|
1285
1344
|
] })
|
|
1286
1345
|
] }),
|
|
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
|
-
] })
|
|
1346
|
+
hasToolbar && /* @__PURE__ */ jsx7(OperationToolbar, { actions: tools, controls: trailingTools })
|
|
1291
1347
|
] });
|
|
1292
1348
|
});
|
|
1293
1349
|
|
|
1294
1350
|
// src/composites/TableControls.tsx
|
|
1295
1351
|
import { ReloadOutlined, SearchOutlined, SettingOutlined } from "@ant-design/icons";
|
|
1296
|
-
import { useId, useRef as
|
|
1297
|
-
import { jsx as
|
|
1352
|
+
import { useId, useRef as useRef6, useState as useState6 } from "react";
|
|
1353
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1298
1354
|
function TableControls({
|
|
1299
1355
|
searchVisible = true,
|
|
1300
1356
|
onSearchVisibleChange,
|
|
@@ -1306,9 +1362,9 @@ function TableControls({
|
|
|
1306
1362
|
className,
|
|
1307
1363
|
style
|
|
1308
1364
|
}) {
|
|
1309
|
-
const [open, setOpen] =
|
|
1310
|
-
const triggerRef =
|
|
1311
|
-
const panelRef =
|
|
1365
|
+
const [open, setOpen] = useState6(false);
|
|
1366
|
+
const triggerRef = useRef6(null);
|
|
1367
|
+
const panelRef = useRef6(null);
|
|
1312
1368
|
const panelId = useId();
|
|
1313
1369
|
const editable = columns.filter((column) => !column.disabled);
|
|
1314
1370
|
const visible = new Set(visibleColumns ?? columns.map((column) => column.key));
|
|
@@ -1337,11 +1393,11 @@ function TableControls({
|
|
|
1337
1393
|
maxHeight: "min(380px, 60vh)",
|
|
1338
1394
|
overflow: "auto"
|
|
1339
1395
|
};
|
|
1340
|
-
return /* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1396
|
+
return /* @__PURE__ */ jsxs4("div", { className, style: { display: "inline-flex", alignItems: "center", flexShrink: 0, gap: 8, ...style }, children: [
|
|
1397
|
+
/* @__PURE__ */ jsx8(Tooltip, { title: searchLabel, children: /* @__PURE__ */ jsx8(
|
|
1342
1398
|
Button,
|
|
1343
1399
|
{
|
|
1344
|
-
icon: /* @__PURE__ */
|
|
1400
|
+
icon: /* @__PURE__ */ jsx8(SearchOutlined, { "aria-hidden": "true" }),
|
|
1345
1401
|
"aria-label": searchLabel,
|
|
1346
1402
|
"aria-pressed": searchVisible,
|
|
1347
1403
|
"data-adminsmart-table-tool": "true",
|
|
@@ -1349,10 +1405,10 @@ function TableControls({
|
|
|
1349
1405
|
onClick: () => onSearchVisibleChange?.(!searchVisible)
|
|
1350
1406
|
}
|
|
1351
1407
|
) }),
|
|
1352
|
-
/* @__PURE__ */
|
|
1408
|
+
/* @__PURE__ */ jsx8(Tooltip, { title: "\u5237\u65B0\u5217\u8868", children: /* @__PURE__ */ jsx8(
|
|
1353
1409
|
Button,
|
|
1354
1410
|
{
|
|
1355
|
-
icon: /* @__PURE__ */
|
|
1411
|
+
icon: /* @__PURE__ */ jsx8(ReloadOutlined, { "aria-hidden": "true" }),
|
|
1356
1412
|
"aria-label": "\u5237\u65B0\u5217\u8868",
|
|
1357
1413
|
"data-adminsmart-table-tool": "true",
|
|
1358
1414
|
loading: refreshing,
|
|
@@ -1360,7 +1416,7 @@ function TableControls({
|
|
|
1360
1416
|
onClick: onRefresh
|
|
1361
1417
|
}
|
|
1362
1418
|
) }),
|
|
1363
|
-
/* @__PURE__ */
|
|
1419
|
+
/* @__PURE__ */ jsx8(
|
|
1364
1420
|
Popover,
|
|
1365
1421
|
{
|
|
1366
1422
|
trigger: "click",
|
|
@@ -1371,8 +1427,8 @@ function TableControls({
|
|
|
1371
1427
|
afterOpenChange: (opened) => {
|
|
1372
1428
|
if (opened) panelRef.current?.querySelector("input:not(:disabled)")?.focus();
|
|
1373
1429
|
},
|
|
1374
|
-
content: /* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1430
|
+
content: /* @__PURE__ */ jsxs4("div", { ref: panelRef, id: panelId, role: "dialog", "aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217", onKeyDown: closeOnEscape, style: panelStyle, children: [
|
|
1431
|
+
/* @__PURE__ */ jsx8(
|
|
1376
1432
|
Checkbox,
|
|
1377
1433
|
{
|
|
1378
1434
|
checked: checkedCount === editable.length,
|
|
@@ -1381,7 +1437,7 @@ function TableControls({
|
|
|
1381
1437
|
children: "\u663E\u793A\u5168\u90E8\u53EF\u9009\u5217"
|
|
1382
1438
|
}
|
|
1383
1439
|
),
|
|
1384
|
-
columns.map((column) => /* @__PURE__ */
|
|
1440
|
+
columns.map((column) => /* @__PURE__ */ jsx8(
|
|
1385
1441
|
Checkbox,
|
|
1386
1442
|
{
|
|
1387
1443
|
checked: visible.has(column.key),
|
|
@@ -1392,11 +1448,11 @@ function TableControls({
|
|
|
1392
1448
|
column.key
|
|
1393
1449
|
))
|
|
1394
1450
|
] }),
|
|
1395
|
-
children: /* @__PURE__ */
|
|
1451
|
+
children: /* @__PURE__ */ jsx8(
|
|
1396
1452
|
Button,
|
|
1397
1453
|
{
|
|
1398
1454
|
ref: triggerRef,
|
|
1399
|
-
icon: /* @__PURE__ */
|
|
1455
|
+
icon: /* @__PURE__ */ jsx8(SettingOutlined, { "aria-hidden": "true" }),
|
|
1400
1456
|
"aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
|
|
1401
1457
|
"data-adminsmart-table-tool": "true",
|
|
1402
1458
|
"aria-haspopup": "dialog",
|
|
@@ -1414,29 +1470,30 @@ function TableControls({
|
|
|
1414
1470
|
// src/composites/DataTable.tsx
|
|
1415
1471
|
import {
|
|
1416
1472
|
forwardRef as forwardRef6,
|
|
1417
|
-
useContext,
|
|
1473
|
+
useContext as useContext2,
|
|
1418
1474
|
useLayoutEffect,
|
|
1419
|
-
useRef as
|
|
1420
|
-
useState as
|
|
1475
|
+
useRef as useRef7,
|
|
1476
|
+
useState as useState7
|
|
1421
1477
|
} from "react";
|
|
1422
1478
|
|
|
1423
1479
|
// src/composites/CrudWorkspace.tsx
|
|
1424
|
-
import { createContext } from "react";
|
|
1425
|
-
import { jsx as
|
|
1426
|
-
var CrudTableHeightContext =
|
|
1427
|
-
function CrudWorkspace({ label, filters, toolbar, feedback, footer, children, className, ...props }) {
|
|
1480
|
+
import { createContext as createContext2 } from "react";
|
|
1481
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1482
|
+
var CrudTableHeightContext = createContext2(false);
|
|
1483
|
+
function CrudWorkspace({ label, filters, toolbar, actions, controls, feedback, footer, children, className, ...props }) {
|
|
1428
1484
|
const classes = ["adminsmart-crud-workspace", className].filter(Boolean).join(" ");
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
|
|
1485
|
+
const listToolbar = toolbar ?? (actions != null || controls != null ? /* @__PURE__ */ jsx9(OperationToolbar, { actions, controls }) : null);
|
|
1486
|
+
return /* @__PURE__ */ jsxs5("section", { ...props, className: classes, "aria-label": label, children: [
|
|
1487
|
+
filters != null && /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__filters", children: filters }),
|
|
1488
|
+
listToolbar != null && /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__toolbar", children: listToolbar }),
|
|
1489
|
+
feedback != null && /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__feedback", children: feedback }),
|
|
1490
|
+
/* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__results", children: /* @__PURE__ */ jsx9(CrudTableHeightContext.Provider, { value: true, children }) }),
|
|
1491
|
+
footer != null && /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud-workspace__footer", children: footer })
|
|
1435
1492
|
] });
|
|
1436
1493
|
}
|
|
1437
1494
|
|
|
1438
1495
|
// src/composites/DataTable.tsx
|
|
1439
|
-
import { jsx as
|
|
1496
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1440
1497
|
function tableBodyHeight(availableHeight, chromeHeight) {
|
|
1441
1498
|
return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
|
|
1442
1499
|
}
|
|
@@ -1457,9 +1514,9 @@ function DataTableInner({
|
|
|
1457
1514
|
scroll,
|
|
1458
1515
|
...tableProps
|
|
1459
1516
|
}, ref) {
|
|
1460
|
-
const containerRef =
|
|
1461
|
-
const [bodyHeight, setBodyHeight] =
|
|
1462
|
-
const inWorkspace =
|
|
1517
|
+
const containerRef = useRef7(null);
|
|
1518
|
+
const [bodyHeight, setBodyHeight] = useState7(360);
|
|
1519
|
+
const inWorkspace = useContext2(CrudTableHeightContext);
|
|
1463
1520
|
const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
|
|
1464
1521
|
const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
|
|
1465
1522
|
useLayoutEffect(() => {
|
|
@@ -1506,7 +1563,7 @@ function DataTableInner({
|
|
|
1506
1563
|
y: scroll?.y ?? bodyHeight
|
|
1507
1564
|
};
|
|
1508
1565
|
const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
|
|
1509
|
-
return /* @__PURE__ */
|
|
1566
|
+
return /* @__PURE__ */ jsx10(
|
|
1510
1567
|
"div",
|
|
1511
1568
|
{
|
|
1512
1569
|
ref: containerRef,
|
|
@@ -1514,7 +1571,7 @@ function DataTableInner({
|
|
|
1514
1571
|
"data-adminsmart-data-table": "true",
|
|
1515
1572
|
"data-adminsmart-data-table-fill": inWorkspace || void 0,
|
|
1516
1573
|
style: { width: "100%", minWidth: 0, overflowX: "hidden", ...tableHeight == null ? {} : { height: tableHeight, overflowY: "hidden" }, ...containerStyle },
|
|
1517
|
-
children: /* @__PURE__ */
|
|
1574
|
+
children: /* @__PURE__ */ jsx10(
|
|
1518
1575
|
Table,
|
|
1519
1576
|
{
|
|
1520
1577
|
...tableProps,
|
|
@@ -1530,7 +1587,7 @@ var DataTable = forwardRef6(DataTableInner);
|
|
|
1530
1587
|
|
|
1531
1588
|
// src/composites/WorkspaceLayout.tsx
|
|
1532
1589
|
import { theme as theme2 } from "antd";
|
|
1533
|
-
import { jsx as
|
|
1590
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1534
1591
|
var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
|
|
1535
1592
|
function WorkspaceLayout({
|
|
1536
1593
|
header,
|
|
@@ -1562,10 +1619,10 @@ function WorkspaceLayout({
|
|
|
1562
1619
|
"--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
|
|
1563
1620
|
// 夜间不复用日间固定底色。
|
|
1564
1621
|
};
|
|
1565
|
-
return /* @__PURE__ */
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1622
|
+
return /* @__PURE__ */ jsxs6(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
|
|
1623
|
+
/* @__PURE__ */ jsx11("header", { className: "adminsmart-workspace__header", children: header }),
|
|
1624
|
+
/* @__PURE__ */ jsxs6(Layout, { className: "adminsmart-workspace__body", children: [
|
|
1625
|
+
/* @__PURE__ */ jsx11(
|
|
1569
1626
|
Layout.Sider,
|
|
1570
1627
|
{
|
|
1571
1628
|
theme: themeMode,
|
|
@@ -1577,9 +1634,9 @@ function WorkspaceLayout({
|
|
|
1577
1634
|
children: sidebar
|
|
1578
1635
|
}
|
|
1579
1636
|
),
|
|
1580
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ jsxs6(Layout, { className: "adminsmart-workspace__main", children: [
|
|
1581
1638
|
tabs,
|
|
1582
|
-
/* @__PURE__ */
|
|
1639
|
+
/* @__PURE__ */ jsx11(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
|
|
1583
1640
|
footer
|
|
1584
1641
|
] })
|
|
1585
1642
|
] })
|
|
@@ -1587,7 +1644,7 @@ function WorkspaceLayout({
|
|
|
1587
1644
|
}
|
|
1588
1645
|
|
|
1589
1646
|
// src/composites/CrudScaffold.tsx
|
|
1590
|
-
import { jsx as
|
|
1647
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1591
1648
|
function CrudScaffold({
|
|
1592
1649
|
label,
|
|
1593
1650
|
description,
|
|
@@ -1599,16 +1656,16 @@ function CrudScaffold({
|
|
|
1599
1656
|
...props
|
|
1600
1657
|
}) {
|
|
1601
1658
|
const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
|
|
1602
|
-
return /* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
status ? /* @__PURE__ */
|
|
1605
|
-
/* @__PURE__ */
|
|
1659
|
+
return /* @__PURE__ */ jsxs7("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
|
|
1660
|
+
/* @__PURE__ */ jsx12("div", { className: "adminsmart-crud__filters", children: filters }),
|
|
1661
|
+
status ? /* @__PURE__ */ jsx12("div", { className: "adminsmart-crud__status", children: status }) : null,
|
|
1662
|
+
/* @__PURE__ */ jsx12("div", { className: "adminsmart-crud__results", children: results }),
|
|
1606
1663
|
drawer
|
|
1607
1664
|
] });
|
|
1608
1665
|
}
|
|
1609
1666
|
|
|
1610
1667
|
// src/composites/EllipsisText.tsx
|
|
1611
|
-
import { jsx as
|
|
1668
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1612
1669
|
function EllipsisText({
|
|
1613
1670
|
children,
|
|
1614
1671
|
maxWidth = 240,
|
|
@@ -1620,7 +1677,7 @@ function EllipsisText({
|
|
|
1620
1677
|
const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
|
|
1621
1678
|
const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
1622
1679
|
const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
|
|
1623
|
-
return /* @__PURE__ */
|
|
1680
|
+
return /* @__PURE__ */ jsx13(
|
|
1624
1681
|
Typography.Text,
|
|
1625
1682
|
{
|
|
1626
1683
|
...props,
|
|
@@ -1635,7 +1692,7 @@ function EllipsisText({
|
|
|
1635
1692
|
// src/composites/RowActions.tsx
|
|
1636
1693
|
import { EllipsisOutlined } from "@ant-design/icons";
|
|
1637
1694
|
import { Children as Children2, Fragment, isValidElement as isValidElement2 } from "react";
|
|
1638
|
-
import { jsx as
|
|
1695
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1639
1696
|
function collectButtons(children) {
|
|
1640
1697
|
const actions = [];
|
|
1641
1698
|
Children2.forEach(children, (child) => {
|
|
@@ -1666,9 +1723,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1666
1723
|
// 菜单仍按官方语义标识需要确认的动作。
|
|
1667
1724
|
}));
|
|
1668
1725
|
const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
|
|
1669
|
-
return /* @__PURE__ */
|
|
1726
|
+
return /* @__PURE__ */ jsxs8(Space, { ...props, className: classes, size, wrap, children: [
|
|
1670
1727
|
direct,
|
|
1671
|
-
overflow.length > 0 && /* @__PURE__ */
|
|
1728
|
+
overflow.length > 0 && /* @__PURE__ */ jsx14(
|
|
1672
1729
|
Dropdown,
|
|
1673
1730
|
{
|
|
1674
1731
|
trigger: ["click"],
|
|
@@ -1680,12 +1737,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1680
1737
|
action.props.onClick?.(domEvent);
|
|
1681
1738
|
}
|
|
1682
1739
|
},
|
|
1683
|
-
children: /* @__PURE__ */
|
|
1740
|
+
children: /* @__PURE__ */ jsx14(Tooltip, { title: moreLabel, children: /* @__PURE__ */ jsx14(
|
|
1684
1741
|
Button,
|
|
1685
1742
|
{
|
|
1686
1743
|
type: "text",
|
|
1687
1744
|
size: "small",
|
|
1688
|
-
icon: /* @__PURE__ */
|
|
1745
|
+
icon: /* @__PURE__ */ jsx14(EllipsisOutlined, {}),
|
|
1689
1746
|
"aria-label": moreLabel,
|
|
1690
1747
|
"aria-haspopup": "menu",
|
|
1691
1748
|
"data-adminsmart-row-more": "true",
|
|
@@ -1882,7 +1939,7 @@ function schemaInitialValues(schema) {
|
|
|
1882
1939
|
}
|
|
1883
1940
|
|
|
1884
1941
|
// src/schema/SchemaForm.tsx
|
|
1885
|
-
import { jsx as
|
|
1942
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1886
1943
|
function fieldRules(field) {
|
|
1887
1944
|
const rules = [];
|
|
1888
1945
|
if (field.required) {
|
|
@@ -1927,32 +1984,32 @@ function dateItemProps(field) {
|
|
|
1927
1984
|
function renderControl(field) {
|
|
1928
1985
|
switch (field.type) {
|
|
1929
1986
|
case "input":
|
|
1930
|
-
return /* @__PURE__ */
|
|
1987
|
+
return /* @__PURE__ */ jsx15(Input, { placeholder: field.placeholder });
|
|
1931
1988
|
case "password":
|
|
1932
|
-
return /* @__PURE__ */
|
|
1989
|
+
return /* @__PURE__ */ jsx15(Input.Password, { placeholder: field.placeholder });
|
|
1933
1990
|
case "textarea":
|
|
1934
|
-
return /* @__PURE__ */
|
|
1991
|
+
return /* @__PURE__ */ jsx15(Input.TextArea, { placeholder: field.placeholder });
|
|
1935
1992
|
case "number":
|
|
1936
|
-
return /* @__PURE__ */
|
|
1993
|
+
return /* @__PURE__ */ jsx15(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
|
|
1937
1994
|
case "select":
|
|
1938
|
-
return /* @__PURE__ */
|
|
1995
|
+
return /* @__PURE__ */ jsx15(Select, { placeholder: field.placeholder, options: field.options });
|
|
1939
1996
|
case "radio":
|
|
1940
|
-
return /* @__PURE__ */
|
|
1997
|
+
return /* @__PURE__ */ jsx15(Radio.Group, { options: field.options });
|
|
1941
1998
|
case "checkbox":
|
|
1942
|
-
return /* @__PURE__ */
|
|
1999
|
+
return /* @__PURE__ */ jsx15(Checkbox, {});
|
|
1943
2000
|
case "switch":
|
|
1944
|
-
return /* @__PURE__ */
|
|
2001
|
+
return /* @__PURE__ */ jsx15(Switch, {});
|
|
1945
2002
|
case "date":
|
|
1946
|
-
return /* @__PURE__ */
|
|
2003
|
+
return /* @__PURE__ */ jsx15(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
|
|
1947
2004
|
case "dateRange":
|
|
1948
|
-
return /* @__PURE__ */
|
|
2005
|
+
return /* @__PURE__ */ jsx15(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
|
|
1949
2006
|
}
|
|
1950
2007
|
}
|
|
1951
2008
|
var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
|
|
1952
2009
|
const result = validateSchemaForm(schema);
|
|
1953
2010
|
if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
|
|
1954
2011
|
const defaults = schemaInitialValues(schema);
|
|
1955
|
-
return /* @__PURE__ */
|
|
2012
|
+
return /* @__PURE__ */ jsxs9(
|
|
1956
2013
|
Form,
|
|
1957
2014
|
{
|
|
1958
2015
|
...formProps,
|
|
@@ -1970,7 +2027,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1970
2027
|
children: [
|
|
1971
2028
|
schema.fields.map((field) => {
|
|
1972
2029
|
const mapped = mapSchemaField(field);
|
|
1973
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsx15(
|
|
1974
2031
|
Form.Item,
|
|
1975
2032
|
{
|
|
1976
2033
|
name: mapped.name,
|
|
@@ -1983,7 +2040,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1983
2040
|
mapped.name
|
|
1984
2041
|
);
|
|
1985
2042
|
}),
|
|
1986
|
-
/* @__PURE__ */
|
|
2043
|
+
/* @__PURE__ */ jsx15(Form.Item, { children: /* @__PURE__ */ jsx15(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
|
|
1987
2044
|
]
|
|
1988
2045
|
}
|
|
1989
2046
|
);
|
|
@@ -2021,6 +2078,7 @@ export {
|
|
|
2021
2078
|
Dropdown,
|
|
2022
2079
|
EllipsisText,
|
|
2023
2080
|
Empty,
|
|
2081
|
+
ErrorReportButton,
|
|
2024
2082
|
Flex,
|
|
2025
2083
|
FloatButton,
|
|
2026
2084
|
Form,
|
|
@@ -2035,6 +2093,7 @@ export {
|
|
|
2035
2093
|
Mentions,
|
|
2036
2094
|
Menu,
|
|
2037
2095
|
Modal,
|
|
2096
|
+
OperationToolbar,
|
|
2038
2097
|
Pagination,
|
|
2039
2098
|
Popconfirm,
|
|
2040
2099
|
Popover,
|
|
@@ -2042,6 +2101,7 @@ export {
|
|
|
2042
2101
|
QRCode,
|
|
2043
2102
|
Radio,
|
|
2044
2103
|
Rate,
|
|
2104
|
+
ReportErrorProvider,
|
|
2045
2105
|
Result,
|
|
2046
2106
|
Row,
|
|
2047
2107
|
RowActions,
|