@qq1948037137/adminsmart-ui 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +161 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -4
- package/dist/index.d.ts +51 -4
- package/dist/index.js +147 -86
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/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,11 +1394,11 @@ 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,
|
|
1347
1404
|
"data-adminsmart-table-tool": "true",
|
|
@@ -1349,10 +1406,10 @@ function TableControls({
|
|
|
1349
1406
|
onClick: () => onSearchVisibleChange?.(!searchVisible)
|
|
1350
1407
|
}
|
|
1351
1408
|
) }),
|
|
1352
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx8(Tooltip, { title: "\u5237\u65B0\u5217\u8868", children: /* @__PURE__ */ jsx8(
|
|
1353
1410
|
Button,
|
|
1354
1411
|
{
|
|
1355
|
-
icon: /* @__PURE__ */
|
|
1412
|
+
icon: /* @__PURE__ */ jsx8(ReloadOutlined, { "aria-hidden": "true" }),
|
|
1356
1413
|
"aria-label": "\u5237\u65B0\u5217\u8868",
|
|
1357
1414
|
"data-adminsmart-table-tool": "true",
|
|
1358
1415
|
loading: refreshing,
|
|
@@ -1360,7 +1417,7 @@ function TableControls({
|
|
|
1360
1417
|
onClick: onRefresh
|
|
1361
1418
|
}
|
|
1362
1419
|
) }),
|
|
1363
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ jsx8(
|
|
1364
1421
|
Popover,
|
|
1365
1422
|
{
|
|
1366
1423
|
trigger: "click",
|
|
@@ -1371,8 +1428,8 @@ function TableControls({
|
|
|
1371
1428
|
afterOpenChange: (opened) => {
|
|
1372
1429
|
if (opened) panelRef.current?.querySelector("input:not(:disabled)")?.focus();
|
|
1373
1430
|
},
|
|
1374
|
-
content: /* @__PURE__ */
|
|
1375
|
-
/* @__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(
|
|
1376
1433
|
Checkbox,
|
|
1377
1434
|
{
|
|
1378
1435
|
checked: checkedCount === editable.length,
|
|
@@ -1381,7 +1438,7 @@ function TableControls({
|
|
|
1381
1438
|
children: "\u663E\u793A\u5168\u90E8\u53EF\u9009\u5217"
|
|
1382
1439
|
}
|
|
1383
1440
|
),
|
|
1384
|
-
columns.map((column) => /* @__PURE__ */
|
|
1441
|
+
columns.map((column) => /* @__PURE__ */ jsx8(
|
|
1385
1442
|
Checkbox,
|
|
1386
1443
|
{
|
|
1387
1444
|
checked: visible.has(column.key),
|
|
@@ -1392,11 +1449,11 @@ function TableControls({
|
|
|
1392
1449
|
column.key
|
|
1393
1450
|
))
|
|
1394
1451
|
] }),
|
|
1395
|
-
children: /* @__PURE__ */
|
|
1452
|
+
children: /* @__PURE__ */ jsx8(
|
|
1396
1453
|
Button,
|
|
1397
1454
|
{
|
|
1398
1455
|
ref: triggerRef,
|
|
1399
|
-
icon: /* @__PURE__ */
|
|
1456
|
+
icon: /* @__PURE__ */ jsx8(SettingOutlined, { "aria-hidden": "true" }),
|
|
1400
1457
|
"aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
|
|
1401
1458
|
"data-adminsmart-table-tool": "true",
|
|
1402
1459
|
"aria-haspopup": "dialog",
|
|
@@ -1414,29 +1471,30 @@ function TableControls({
|
|
|
1414
1471
|
// src/composites/DataTable.tsx
|
|
1415
1472
|
import {
|
|
1416
1473
|
forwardRef as forwardRef6,
|
|
1417
|
-
useContext,
|
|
1474
|
+
useContext as useContext2,
|
|
1418
1475
|
useLayoutEffect,
|
|
1419
|
-
useRef as
|
|
1420
|
-
useState as
|
|
1476
|
+
useRef as useRef7,
|
|
1477
|
+
useState as useState7
|
|
1421
1478
|
} from "react";
|
|
1422
1479
|
|
|
1423
1480
|
// 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 }) {
|
|
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 }) {
|
|
1428
1485
|
const classes = ["adminsmart-crud-workspace", className].filter(Boolean).join(" ");
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
|
|
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 })
|
|
1435
1493
|
] });
|
|
1436
1494
|
}
|
|
1437
1495
|
|
|
1438
1496
|
// src/composites/DataTable.tsx
|
|
1439
|
-
import { jsx as
|
|
1497
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1440
1498
|
function tableBodyHeight(availableHeight, chromeHeight) {
|
|
1441
1499
|
return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
|
|
1442
1500
|
}
|
|
@@ -1457,9 +1515,9 @@ function DataTableInner({
|
|
|
1457
1515
|
scroll,
|
|
1458
1516
|
...tableProps
|
|
1459
1517
|
}, ref) {
|
|
1460
|
-
const containerRef =
|
|
1461
|
-
const [bodyHeight, setBodyHeight] =
|
|
1462
|
-
const inWorkspace =
|
|
1518
|
+
const containerRef = useRef7(null);
|
|
1519
|
+
const [bodyHeight, setBodyHeight] = useState7(360);
|
|
1520
|
+
const inWorkspace = useContext2(CrudTableHeightContext);
|
|
1463
1521
|
const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
|
|
1464
1522
|
const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
|
|
1465
1523
|
useLayoutEffect(() => {
|
|
@@ -1506,7 +1564,7 @@ function DataTableInner({
|
|
|
1506
1564
|
y: scroll?.y ?? bodyHeight
|
|
1507
1565
|
};
|
|
1508
1566
|
const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
|
|
1509
|
-
return /* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ jsx10(
|
|
1510
1568
|
"div",
|
|
1511
1569
|
{
|
|
1512
1570
|
ref: containerRef,
|
|
@@ -1514,7 +1572,7 @@ function DataTableInner({
|
|
|
1514
1572
|
"data-adminsmart-data-table": "true",
|
|
1515
1573
|
"data-adminsmart-data-table-fill": inWorkspace || void 0,
|
|
1516
1574
|
style: { width: "100%", minWidth: 0, overflowX: "hidden", ...tableHeight == null ? {} : { height: tableHeight, overflowY: "hidden" }, ...containerStyle },
|
|
1517
|
-
children: /* @__PURE__ */
|
|
1575
|
+
children: /* @__PURE__ */ jsx10(
|
|
1518
1576
|
Table,
|
|
1519
1577
|
{
|
|
1520
1578
|
...tableProps,
|
|
@@ -1530,7 +1588,7 @@ var DataTable = forwardRef6(DataTableInner);
|
|
|
1530
1588
|
|
|
1531
1589
|
// src/composites/WorkspaceLayout.tsx
|
|
1532
1590
|
import { theme as theme2 } from "antd";
|
|
1533
|
-
import { jsx as
|
|
1591
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1534
1592
|
var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
|
|
1535
1593
|
function WorkspaceLayout({
|
|
1536
1594
|
header,
|
|
@@ -1562,10 +1620,10 @@ function WorkspaceLayout({
|
|
|
1562
1620
|
"--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
|
|
1563
1621
|
// 夜间不复用日间固定底色。
|
|
1564
1622
|
};
|
|
1565
|
-
return /* @__PURE__ */
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__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(
|
|
1569
1627
|
Layout.Sider,
|
|
1570
1628
|
{
|
|
1571
1629
|
theme: themeMode,
|
|
@@ -1577,9 +1635,9 @@ function WorkspaceLayout({
|
|
|
1577
1635
|
children: sidebar
|
|
1578
1636
|
}
|
|
1579
1637
|
),
|
|
1580
|
-
/* @__PURE__ */
|
|
1638
|
+
/* @__PURE__ */ jsxs6(Layout, { className: "adminsmart-workspace__main", children: [
|
|
1581
1639
|
tabs,
|
|
1582
|
-
/* @__PURE__ */
|
|
1640
|
+
/* @__PURE__ */ jsx11(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
|
|
1583
1641
|
footer
|
|
1584
1642
|
] })
|
|
1585
1643
|
] })
|
|
@@ -1587,7 +1645,7 @@ function WorkspaceLayout({
|
|
|
1587
1645
|
}
|
|
1588
1646
|
|
|
1589
1647
|
// src/composites/CrudScaffold.tsx
|
|
1590
|
-
import { jsx as
|
|
1648
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1591
1649
|
function CrudScaffold({
|
|
1592
1650
|
label,
|
|
1593
1651
|
description,
|
|
@@ -1599,16 +1657,16 @@ function CrudScaffold({
|
|
|
1599
1657
|
...props
|
|
1600
1658
|
}) {
|
|
1601
1659
|
const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
|
|
1602
|
-
return /* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
status ? /* @__PURE__ */
|
|
1605
|
-
/* @__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 }),
|
|
1606
1664
|
drawer
|
|
1607
1665
|
] });
|
|
1608
1666
|
}
|
|
1609
1667
|
|
|
1610
1668
|
// src/composites/EllipsisText.tsx
|
|
1611
|
-
import { jsx as
|
|
1669
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1612
1670
|
function EllipsisText({
|
|
1613
1671
|
children,
|
|
1614
1672
|
maxWidth = 240,
|
|
@@ -1620,7 +1678,7 @@ function EllipsisText({
|
|
|
1620
1678
|
const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
|
|
1621
1679
|
const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
1622
1680
|
const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
|
|
1623
|
-
return /* @__PURE__ */
|
|
1681
|
+
return /* @__PURE__ */ jsx13(
|
|
1624
1682
|
Typography.Text,
|
|
1625
1683
|
{
|
|
1626
1684
|
...props,
|
|
@@ -1635,7 +1693,7 @@ function EllipsisText({
|
|
|
1635
1693
|
// src/composites/RowActions.tsx
|
|
1636
1694
|
import { EllipsisOutlined } from "@ant-design/icons";
|
|
1637
1695
|
import { Children as Children2, Fragment, isValidElement as isValidElement2 } from "react";
|
|
1638
|
-
import { jsx as
|
|
1696
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1639
1697
|
function collectButtons(children) {
|
|
1640
1698
|
const actions = [];
|
|
1641
1699
|
Children2.forEach(children, (child) => {
|
|
@@ -1666,9 +1724,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1666
1724
|
// 菜单仍按官方语义标识需要确认的动作。
|
|
1667
1725
|
}));
|
|
1668
1726
|
const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
|
|
1669
|
-
return /* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ jsxs8(Space, { ...props, className: classes, size, wrap, children: [
|
|
1670
1728
|
direct,
|
|
1671
|
-
overflow.length > 0 && /* @__PURE__ */
|
|
1729
|
+
overflow.length > 0 && /* @__PURE__ */ jsx14(
|
|
1672
1730
|
Dropdown,
|
|
1673
1731
|
{
|
|
1674
1732
|
trigger: ["click"],
|
|
@@ -1680,12 +1738,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1680
1738
|
action.props.onClick?.(domEvent);
|
|
1681
1739
|
}
|
|
1682
1740
|
},
|
|
1683
|
-
children: /* @__PURE__ */
|
|
1741
|
+
children: /* @__PURE__ */ jsx14(Tooltip, { title: moreLabel, children: /* @__PURE__ */ jsx14(
|
|
1684
1742
|
Button,
|
|
1685
1743
|
{
|
|
1686
1744
|
type: "text",
|
|
1687
1745
|
size: "small",
|
|
1688
|
-
icon: /* @__PURE__ */
|
|
1746
|
+
icon: /* @__PURE__ */ jsx14(EllipsisOutlined, {}),
|
|
1689
1747
|
"aria-label": moreLabel,
|
|
1690
1748
|
"aria-haspopup": "menu",
|
|
1691
1749
|
"data-adminsmart-row-more": "true",
|
|
@@ -1882,7 +1940,7 @@ function schemaInitialValues(schema) {
|
|
|
1882
1940
|
}
|
|
1883
1941
|
|
|
1884
1942
|
// src/schema/SchemaForm.tsx
|
|
1885
|
-
import { jsx as
|
|
1943
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1886
1944
|
function fieldRules(field) {
|
|
1887
1945
|
const rules = [];
|
|
1888
1946
|
if (field.required) {
|
|
@@ -1927,32 +1985,32 @@ function dateItemProps(field) {
|
|
|
1927
1985
|
function renderControl(field) {
|
|
1928
1986
|
switch (field.type) {
|
|
1929
1987
|
case "input":
|
|
1930
|
-
return /* @__PURE__ */
|
|
1988
|
+
return /* @__PURE__ */ jsx15(Input, { placeholder: field.placeholder });
|
|
1931
1989
|
case "password":
|
|
1932
|
-
return /* @__PURE__ */
|
|
1990
|
+
return /* @__PURE__ */ jsx15(Input.Password, { placeholder: field.placeholder });
|
|
1933
1991
|
case "textarea":
|
|
1934
|
-
return /* @__PURE__ */
|
|
1992
|
+
return /* @__PURE__ */ jsx15(Input.TextArea, { placeholder: field.placeholder });
|
|
1935
1993
|
case "number":
|
|
1936
|
-
return /* @__PURE__ */
|
|
1994
|
+
return /* @__PURE__ */ jsx15(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
|
|
1937
1995
|
case "select":
|
|
1938
|
-
return /* @__PURE__ */
|
|
1996
|
+
return /* @__PURE__ */ jsx15(Select, { placeholder: field.placeholder, options: field.options });
|
|
1939
1997
|
case "radio":
|
|
1940
|
-
return /* @__PURE__ */
|
|
1998
|
+
return /* @__PURE__ */ jsx15(Radio.Group, { options: field.options });
|
|
1941
1999
|
case "checkbox":
|
|
1942
|
-
return /* @__PURE__ */
|
|
2000
|
+
return /* @__PURE__ */ jsx15(Checkbox, {});
|
|
1943
2001
|
case "switch":
|
|
1944
|
-
return /* @__PURE__ */
|
|
2002
|
+
return /* @__PURE__ */ jsx15(Switch, {});
|
|
1945
2003
|
case "date":
|
|
1946
|
-
return /* @__PURE__ */
|
|
2004
|
+
return /* @__PURE__ */ jsx15(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
|
|
1947
2005
|
case "dateRange":
|
|
1948
|
-
return /* @__PURE__ */
|
|
2006
|
+
return /* @__PURE__ */ jsx15(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
|
|
1949
2007
|
}
|
|
1950
2008
|
}
|
|
1951
2009
|
var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
|
|
1952
2010
|
const result = validateSchemaForm(schema);
|
|
1953
2011
|
if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
|
|
1954
2012
|
const defaults = schemaInitialValues(schema);
|
|
1955
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ jsxs9(
|
|
1956
2014
|
Form,
|
|
1957
2015
|
{
|
|
1958
2016
|
...formProps,
|
|
@@ -1970,7 +2028,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1970
2028
|
children: [
|
|
1971
2029
|
schema.fields.map((field) => {
|
|
1972
2030
|
const mapped = mapSchemaField(field);
|
|
1973
|
-
return /* @__PURE__ */
|
|
2031
|
+
return /* @__PURE__ */ jsx15(
|
|
1974
2032
|
Form.Item,
|
|
1975
2033
|
{
|
|
1976
2034
|
name: mapped.name,
|
|
@@ -1983,7 +2041,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1983
2041
|
mapped.name
|
|
1984
2042
|
);
|
|
1985
2043
|
}),
|
|
1986
|
-
/* @__PURE__ */
|
|
2044
|
+
/* @__PURE__ */ jsx15(Form.Item, { children: /* @__PURE__ */ jsx15(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
|
|
1987
2045
|
]
|
|
1988
2046
|
}
|
|
1989
2047
|
);
|
|
@@ -2021,6 +2079,7 @@ export {
|
|
|
2021
2079
|
Dropdown,
|
|
2022
2080
|
EllipsisText,
|
|
2023
2081
|
Empty,
|
|
2082
|
+
ErrorReportButton,
|
|
2024
2083
|
Flex,
|
|
2025
2084
|
FloatButton,
|
|
2026
2085
|
Form,
|
|
@@ -2035,6 +2094,7 @@ export {
|
|
|
2035
2094
|
Mentions,
|
|
2036
2095
|
Menu,
|
|
2037
2096
|
Modal,
|
|
2097
|
+
OperationToolbar,
|
|
2038
2098
|
Pagination,
|
|
2039
2099
|
Popconfirm,
|
|
2040
2100
|
Popover,
|
|
@@ -2042,6 +2102,7 @@ export {
|
|
|
2042
2102
|
QRCode,
|
|
2043
2103
|
Radio,
|
|
2044
2104
|
Rate,
|
|
2105
|
+
ReportErrorProvider,
|
|
2045
2106
|
Result,
|
|
2046
2107
|
Row,
|
|
2047
2108
|
RowActions,
|