@qq1948037137/adminsmart-ui 0.1.28 → 0.1.29
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 +2 -0
- package/dist/index.cjs +84 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -2
- package/dist/index.d.ts +23 -2
- package/dist/index.js +75 -40
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/styles/composites.css +49 -0
package/README.md
CHANGED
|
@@ -53,6 +53,8 @@ function Example() {
|
|
|
53
53
|
|
|
54
54
|
将 `TableControls` 放在 `SearchPanel.trailingTools`,将新增、导出等业务操作放在 `SearchPanel.tools`。右侧始终按搜索显隐、刷新、选择列排列。宿主控制搜索显隐、加载和可见列,并可声明不可切换的列。组件示例展示如何连接搜索状态和表格列。
|
|
55
55
|
|
|
56
|
+
在 `WorkspaceLayout contentMode="table"` 的内容区嵌入 `CrudWorkspace`,可使用独立的筛选、操作栏、反馈与页脚插槽,`DataTable` 自动填满剩余区域。结果超出高度时在表体内滚动,分页仍保持可见。文档站的「CrudWorkspace 标准 CRUD 工作区」展示同一布局中的搜索、刷新、显隐列、新建、编辑和删除。
|
|
57
|
+
|
|
56
58
|
主应用的本地 tarball 过渡与 npm Registry 升级都必须锁定精确版本、实际包名和完整性,不能仅改依赖字符串而跳过来源校验。本库通过 `adminsmartUiSource: { sha256, gitCommit }` 提供构建源码标记,消费者使用 Registry 的 `dist.integrity` 与 `dist.tarball` 核对字节。该标记是项目来源契约,不是官方 provenance。
|
|
57
59
|
|
|
58
60
|
`SessionReplay` 接收已授权、已解压的只读对象事件,默认暂停在可见窗口起点。它按需装载 `@rrweb/replay@2.0.1` 的官方 JS/CSS,相关 rrweb、types、utils、rrdom 和 snapshot 协议包也精确锁定为 `2.0.1`;发布验证会检查全新宿主的实际安装树,防止上游范围依赖漂移。组件等待真实容器尺寸和官方快照重建,负责有界跳转、结束重播、倍率、时间标记与全屏;隐藏或切换事件时销毁实例和监听。样式随既有 `@adminsmart/ui/styles/composites.css` 交付。业务宿主仍负责数据请求、权限、解压和录制脱敏;组件不会读取 API、凭据、会话或录制原页面。可操作的 5 秒合成录像见文档站 `SessionReplay 操作回放`,公开输入与引用类型由包类型声明提供。
|
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,
|
|
@@ -1429,6 +1430,7 @@ function TableControls({
|
|
|
1429
1430
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.SearchOutlined, { "aria-hidden": "true" }),
|
|
1430
1431
|
"aria-label": searchLabel,
|
|
1431
1432
|
"aria-pressed": searchVisible,
|
|
1433
|
+
"data-adminsmart-table-tool": "true",
|
|
1432
1434
|
disabled: !onSearchVisibleChange,
|
|
1433
1435
|
onClick: () => onSearchVisibleChange?.(!searchVisible)
|
|
1434
1436
|
}
|
|
@@ -1438,6 +1440,7 @@ function TableControls({
|
|
|
1438
1440
|
{
|
|
1439
1441
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.ReloadOutlined, { "aria-hidden": "true" }),
|
|
1440
1442
|
"aria-label": "\u5237\u65B0\u5217\u8868",
|
|
1443
|
+
"data-adminsmart-table-tool": "true",
|
|
1441
1444
|
loading: refreshing,
|
|
1442
1445
|
disabled: !onRefresh || refreshing,
|
|
1443
1446
|
onClick: onRefresh
|
|
@@ -1481,6 +1484,7 @@ function TableControls({
|
|
|
1481
1484
|
ref: triggerRef,
|
|
1482
1485
|
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons4.SettingOutlined, { "aria-hidden": "true" }),
|
|
1483
1486
|
"aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
|
|
1487
|
+
"data-adminsmart-table-tool": "true",
|
|
1484
1488
|
"aria-haspopup": "dialog",
|
|
1485
1489
|
"aria-expanded": canSetColumns && open,
|
|
1486
1490
|
"aria-controls": canSetColumns && open ? panelId : void 0,
|
|
@@ -1494,8 +1498,25 @@ function TableControls({
|
|
|
1494
1498
|
}
|
|
1495
1499
|
|
|
1496
1500
|
// src/composites/DataTable.tsx
|
|
1501
|
+
var import_react10 = require("react");
|
|
1502
|
+
|
|
1503
|
+
// src/composites/CrudWorkspace.tsx
|
|
1497
1504
|
var import_react9 = require("react");
|
|
1498
1505
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1506
|
+
var CrudTableHeightContext = (0, import_react9.createContext)(false);
|
|
1507
|
+
function CrudWorkspace({ label, filters, toolbar, feedback, footer, children, className, ...props }) {
|
|
1508
|
+
const classes = ["adminsmart-crud-workspace", className].filter(Boolean).join(" ");
|
|
1509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { ...props, className: classes, "aria-label": label, children: [
|
|
1510
|
+
filters != null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "adminsmart-crud-workspace__filters", children: filters }),
|
|
1511
|
+
toolbar != null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "adminsmart-crud-workspace__toolbar", children: toolbar }),
|
|
1512
|
+
feedback != null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "adminsmart-crud-workspace__feedback", children: feedback }),
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "adminsmart-crud-workspace__results", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CrudTableHeightContext.Provider, { value: true, children }) }),
|
|
1514
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "adminsmart-crud-workspace__footer", children: footer })
|
|
1515
|
+
] });
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
// src/composites/DataTable.tsx
|
|
1519
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1499
1520
|
function tableBodyHeight(availableHeight, chromeHeight) {
|
|
1500
1521
|
return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
|
|
1501
1522
|
}
|
|
@@ -1516,13 +1537,22 @@ function DataTableInner({
|
|
|
1516
1537
|
scroll,
|
|
1517
1538
|
...tableProps
|
|
1518
1539
|
}, ref) {
|
|
1519
|
-
const containerRef = (0,
|
|
1520
|
-
const [bodyHeight, setBodyHeight] = (0,
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1540
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
1541
|
+
const [bodyHeight, setBodyHeight] = (0, import_react10.useState)(360);
|
|
1542
|
+
const inWorkspace = (0, import_react10.useContext)(CrudTableHeightContext);
|
|
1543
|
+
const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
|
|
1544
|
+
const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
|
|
1545
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
1523
1546
|
const container = containerRef.current;
|
|
1524
1547
|
if (!container || scroll?.y != null) return void 0;
|
|
1525
1548
|
const update = () => {
|
|
1549
|
+
if (hasExplicitHeight) {
|
|
1550
|
+
const height = container.getBoundingClientRect().height;
|
|
1551
|
+
const chromeHeight = tableChromeHeight(container);
|
|
1552
|
+
const nextHeight2 = inWorkspace ? Math.max(0, Math.floor(height - chromeHeight)) : tableBodyHeight(height, chromeHeight);
|
|
1553
|
+
setBodyHeight((current) => current === nextHeight2 ? current : nextHeight2);
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1526
1556
|
const top = container.getBoundingClientRect().top;
|
|
1527
1557
|
let boundary = container.parentElement;
|
|
1528
1558
|
while (boundary && ["", "visible", "clip"].includes(getComputedStyle(boundary).overflowY)) {
|
|
@@ -1531,13 +1561,16 @@ function DataTableInner({
|
|
|
1531
1561
|
const boundaryStyle = boundary ? getComputedStyle(boundary) : null;
|
|
1532
1562
|
const parentBottom = boundary ? boundary.getBoundingClientRect().bottom - Number.parseFloat(boundaryStyle?.paddingBottom || "0") : Number.POSITIVE_INFINITY;
|
|
1533
1563
|
const viewportBottom = window.visualViewport?.height ?? window.innerHeight;
|
|
1534
|
-
const availableHeight =
|
|
1564
|
+
const availableHeight = Math.max(200, Math.min(viewportBottom - 16, parentBottom - 16) - top);
|
|
1535
1565
|
const nextHeight = tableBodyHeight(availableHeight, tableChromeHeight(container));
|
|
1536
1566
|
setBodyHeight((current) => current === nextHeight ? current : nextHeight);
|
|
1537
1567
|
};
|
|
1538
1568
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
|
|
1539
1569
|
observer?.observe(container);
|
|
1540
1570
|
if (container.parentElement) observer?.observe(container.parentElement);
|
|
1571
|
+
if (inWorkspace) {
|
|
1572
|
+
for (const region of container.querySelectorAll(".ant-table-header, .ant-table-pagination, .ant-table-title, .ant-table-footer")) observer?.observe(region);
|
|
1573
|
+
}
|
|
1541
1574
|
window.addEventListener("resize", update);
|
|
1542
1575
|
window.visualViewport?.addEventListener("resize", update);
|
|
1543
1576
|
update();
|
|
@@ -1546,21 +1579,22 @@ function DataTableInner({
|
|
|
1546
1579
|
window.removeEventListener("resize", update);
|
|
1547
1580
|
window.visualViewport?.removeEventListener("resize", update);
|
|
1548
1581
|
};
|
|
1549
|
-
}, [hasExplicitHeight,
|
|
1582
|
+
}, [hasExplicitHeight, inWorkspace, tableHeight, pagination, scroll?.y, tableProps.dataSource?.length]);
|
|
1550
1583
|
const tableScroll = {
|
|
1551
1584
|
...scroll,
|
|
1552
1585
|
x: scroll?.x ?? "max-content",
|
|
1553
1586
|
y: scroll?.y ?? bodyHeight
|
|
1554
1587
|
};
|
|
1555
1588
|
const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
|
|
1556
|
-
return /* @__PURE__ */ (0,
|
|
1589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1557
1590
|
"div",
|
|
1558
1591
|
{
|
|
1559
1592
|
ref: containerRef,
|
|
1560
1593
|
className: containerClassName,
|
|
1561
1594
|
"data-adminsmart-data-table": "true",
|
|
1562
|
-
|
|
1563
|
-
|
|
1595
|
+
"data-adminsmart-data-table-fill": inWorkspace || void 0,
|
|
1596
|
+
style: { width: "100%", minWidth: 0, overflowX: "hidden", ...tableHeight == null ? {} : { height: tableHeight, overflowY: "hidden" }, ...containerStyle },
|
|
1597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1564
1598
|
Table,
|
|
1565
1599
|
{
|
|
1566
1600
|
...tableProps,
|
|
@@ -1572,11 +1606,11 @@ function DataTableInner({
|
|
|
1572
1606
|
}
|
|
1573
1607
|
);
|
|
1574
1608
|
}
|
|
1575
|
-
var DataTable = (0,
|
|
1609
|
+
var DataTable = (0, import_react10.forwardRef)(DataTableInner);
|
|
1576
1610
|
|
|
1577
1611
|
// src/composites/WorkspaceLayout.tsx
|
|
1578
1612
|
var import_antd46 = require("antd");
|
|
1579
|
-
var
|
|
1613
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1580
1614
|
var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
|
|
1581
1615
|
function WorkspaceLayout({
|
|
1582
1616
|
header,
|
|
@@ -1608,10 +1642,10 @@ function WorkspaceLayout({
|
|
|
1608
1642
|
"--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
|
|
1609
1643
|
// 夜间不复用日间固定底色。
|
|
1610
1644
|
};
|
|
1611
|
-
return /* @__PURE__ */ (0,
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
1613
|
-
/* @__PURE__ */ (0,
|
|
1614
|
-
/* @__PURE__ */ (0,
|
|
1645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("header", { className: "adminsmart-workspace__header", children: header }),
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Layout, { className: "adminsmart-workspace__body", children: [
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1615
1649
|
Layout.Sider,
|
|
1616
1650
|
{
|
|
1617
1651
|
theme: themeMode,
|
|
@@ -1623,9 +1657,9 @@ function WorkspaceLayout({
|
|
|
1623
1657
|
children: sidebar
|
|
1624
1658
|
}
|
|
1625
1659
|
),
|
|
1626
|
-
/* @__PURE__ */ (0,
|
|
1660
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Layout, { className: "adminsmart-workspace__main", children: [
|
|
1627
1661
|
tabs,
|
|
1628
|
-
/* @__PURE__ */ (0,
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
|
|
1629
1663
|
footer
|
|
1630
1664
|
] })
|
|
1631
1665
|
] })
|
|
@@ -1633,7 +1667,7 @@ function WorkspaceLayout({
|
|
|
1633
1667
|
}
|
|
1634
1668
|
|
|
1635
1669
|
// src/composites/CrudScaffold.tsx
|
|
1636
|
-
var
|
|
1670
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1637
1671
|
function CrudScaffold({
|
|
1638
1672
|
label,
|
|
1639
1673
|
description,
|
|
@@ -1645,16 +1679,16 @@ function CrudScaffold({
|
|
|
1645
1679
|
...props
|
|
1646
1680
|
}) {
|
|
1647
1681
|
const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
|
|
1648
|
-
return /* @__PURE__ */ (0,
|
|
1649
|
-
/* @__PURE__ */ (0,
|
|
1650
|
-
status ? /* @__PURE__ */ (0,
|
|
1651
|
-
/* @__PURE__ */ (0,
|
|
1682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "adminsmart-crud__filters", children: filters }),
|
|
1684
|
+
status ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "adminsmart-crud__status", children: status }) : null,
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "adminsmart-crud__results", children: results }),
|
|
1652
1686
|
drawer
|
|
1653
1687
|
] });
|
|
1654
1688
|
}
|
|
1655
1689
|
|
|
1656
1690
|
// src/composites/EllipsisText.tsx
|
|
1657
|
-
var
|
|
1691
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1658
1692
|
function EllipsisText({
|
|
1659
1693
|
children,
|
|
1660
1694
|
maxWidth = 240,
|
|
@@ -1666,7 +1700,7 @@ function EllipsisText({
|
|
|
1666
1700
|
const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
|
|
1667
1701
|
const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
1668
1702
|
const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
|
|
1669
|
-
return /* @__PURE__ */ (0,
|
|
1703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1670
1704
|
Typography.Text,
|
|
1671
1705
|
{
|
|
1672
1706
|
...props,
|
|
@@ -1680,13 +1714,13 @@ function EllipsisText({
|
|
|
1680
1714
|
|
|
1681
1715
|
// src/composites/RowActions.tsx
|
|
1682
1716
|
var import_icons5 = require("@ant-design/icons");
|
|
1683
|
-
var
|
|
1684
|
-
var
|
|
1717
|
+
var import_react11 = require("react");
|
|
1718
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1685
1719
|
function collectButtons(children) {
|
|
1686
1720
|
const actions = [];
|
|
1687
|
-
|
|
1688
|
-
if (!(0,
|
|
1689
|
-
if (child.type ===
|
|
1721
|
+
import_react11.Children.forEach(children, (child) => {
|
|
1722
|
+
if (!(0, import_react11.isValidElement)(child)) return;
|
|
1723
|
+
if (child.type === import_react11.Fragment) actions.push(...collectButtons(child.props.children));
|
|
1690
1724
|
else {
|
|
1691
1725
|
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
1726
|
if (!child.props.hidden) actions.push(child);
|
|
@@ -1712,9 +1746,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1712
1746
|
// 菜单仍按官方语义标识需要确认的动作。
|
|
1713
1747
|
}));
|
|
1714
1748
|
const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
|
|
1715
|
-
return /* @__PURE__ */ (0,
|
|
1749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Space, { ...props, className: classes, size, wrap, children: [
|
|
1716
1750
|
direct,
|
|
1717
|
-
overflow.length > 0 && /* @__PURE__ */ (0,
|
|
1751
|
+
overflow.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1718
1752
|
Dropdown,
|
|
1719
1753
|
{
|
|
1720
1754
|
trigger: ["click"],
|
|
@@ -1726,12 +1760,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1726
1760
|
action.props.onClick?.(domEvent);
|
|
1727
1761
|
}
|
|
1728
1762
|
},
|
|
1729
|
-
children: /* @__PURE__ */ (0,
|
|
1763
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Tooltip, { title: moreLabel, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1730
1764
|
Button,
|
|
1731
1765
|
{
|
|
1732
1766
|
type: "text",
|
|
1733
1767
|
size: "small",
|
|
1734
|
-
icon: /* @__PURE__ */ (0,
|
|
1768
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons5.EllipsisOutlined, {}),
|
|
1735
1769
|
"aria-label": moreLabel,
|
|
1736
1770
|
"aria-haspopup": "menu",
|
|
1737
1771
|
"data-adminsmart-row-more": "true",
|
|
@@ -1745,7 +1779,7 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1745
1779
|
|
|
1746
1780
|
// src/schema/SchemaForm.tsx
|
|
1747
1781
|
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
1748
|
-
var
|
|
1782
|
+
var import_react12 = require("react");
|
|
1749
1783
|
|
|
1750
1784
|
// src/schema/model.ts
|
|
1751
1785
|
var FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -1928,7 +1962,7 @@ function schemaInitialValues(schema) {
|
|
|
1928
1962
|
}
|
|
1929
1963
|
|
|
1930
1964
|
// src/schema/SchemaForm.tsx
|
|
1931
|
-
var
|
|
1965
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1932
1966
|
function fieldRules(field) {
|
|
1933
1967
|
const rules = [];
|
|
1934
1968
|
if (field.required) {
|
|
@@ -1973,32 +2007,32 @@ function dateItemProps(field) {
|
|
|
1973
2007
|
function renderControl(field) {
|
|
1974
2008
|
switch (field.type) {
|
|
1975
2009
|
case "input":
|
|
1976
|
-
return /* @__PURE__ */ (0,
|
|
2010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Input, { placeholder: field.placeholder });
|
|
1977
2011
|
case "password":
|
|
1978
|
-
return /* @__PURE__ */ (0,
|
|
2012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Input.Password, { placeholder: field.placeholder });
|
|
1979
2013
|
case "textarea":
|
|
1980
|
-
return /* @__PURE__ */ (0,
|
|
2014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Input.TextArea, { placeholder: field.placeholder });
|
|
1981
2015
|
case "number":
|
|
1982
|
-
return /* @__PURE__ */ (0,
|
|
2016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
|
|
1983
2017
|
case "select":
|
|
1984
|
-
return /* @__PURE__ */ (0,
|
|
2018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Select, { placeholder: field.placeholder, options: field.options });
|
|
1985
2019
|
case "radio":
|
|
1986
|
-
return /* @__PURE__ */ (0,
|
|
2020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Radio.Group, { options: field.options });
|
|
1987
2021
|
case "checkbox":
|
|
1988
|
-
return /* @__PURE__ */ (0,
|
|
2022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Checkbox, {});
|
|
1989
2023
|
case "switch":
|
|
1990
|
-
return /* @__PURE__ */ (0,
|
|
2024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Switch, {});
|
|
1991
2025
|
case "date":
|
|
1992
|
-
return /* @__PURE__ */ (0,
|
|
2026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
|
|
1993
2027
|
case "dateRange":
|
|
1994
|
-
return /* @__PURE__ */ (0,
|
|
2028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
|
|
1995
2029
|
}
|
|
1996
2030
|
}
|
|
1997
|
-
var SchemaForm = (0,
|
|
2031
|
+
var SchemaForm = (0, import_react12.forwardRef)(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
|
|
1998
2032
|
const result = validateSchemaForm(schema);
|
|
1999
2033
|
if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
|
|
2000
2034
|
const defaults = schemaInitialValues(schema);
|
|
2001
|
-
return /* @__PURE__ */ (0,
|
|
2035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2002
2036
|
Form,
|
|
2003
2037
|
{
|
|
2004
2038
|
...formProps,
|
|
@@ -2016,7 +2050,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
|
|
|
2016
2050
|
children: [
|
|
2017
2051
|
schema.fields.map((field) => {
|
|
2018
2052
|
const mapped = mapSchemaField(field);
|
|
2019
|
-
return /* @__PURE__ */ (0,
|
|
2053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2020
2054
|
Form.Item,
|
|
2021
2055
|
{
|
|
2022
2056
|
name: mapped.name,
|
|
@@ -2029,7 +2063,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
|
|
|
2029
2063
|
mapped.name
|
|
2030
2064
|
);
|
|
2031
2065
|
}),
|
|
2032
|
-
/* @__PURE__ */ (0,
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
|
|
2033
2067
|
]
|
|
2034
2068
|
}
|
|
2035
2069
|
);
|
|
@@ -2059,6 +2093,7 @@ var SchemaForm = (0, import_react11.forwardRef)(function SchemaForm2({ schema, o
|
|
|
2059
2093
|
ColorPicker,
|
|
2060
2094
|
ConfigProvider,
|
|
2061
2095
|
CrudScaffold,
|
|
2096
|
+
CrudWorkspace,
|
|
2062
2097
|
DataTable,
|
|
2063
2098
|
DatePicker,
|
|
2064
2099
|
Descriptions,
|