@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/dist/index.d.cts
CHANGED
|
@@ -324,7 +324,7 @@ interface TableControlsProps {
|
|
|
324
324
|
declare function TableControls({ searchVisible, onSearchVisibleChange, onRefresh, refreshing, columns, visibleColumns, onVisibleColumnsChange, className, style, }: TableControlsProps): react_jsx_runtime.JSX.Element;
|
|
325
325
|
|
|
326
326
|
interface DataTableProps<RecordType extends object> extends TableProps<RecordType> {
|
|
327
|
-
/**
|
|
327
|
+
/** 设置表格整体容器高度;CrudWorkspace 内默认 100%,其它容器沿用视口剩余高度。 */
|
|
328
328
|
containerHeight?: CSSProperties['height'];
|
|
329
329
|
/** 仅作用于外层滚动边界,不覆盖 Ant Table 自身的 style。 */
|
|
330
330
|
containerStyle?: CSSProperties;
|
|
@@ -415,6 +415,27 @@ interface CrudScaffoldProps extends Omit<HTMLAttributes<HTMLElement>, 'children'
|
|
|
415
415
|
*/
|
|
416
416
|
declare function CrudScaffold({ label, description, filters, status, results, drawer, className, ...props }: CrudScaffoldProps): react_jsx_runtime.JSX.Element;
|
|
417
417
|
|
|
418
|
+
interface CrudWorkspaceProps extends HTMLAttributes<HTMLElement> {
|
|
419
|
+
/** 工作区的可访问名称。 */
|
|
420
|
+
label: string;
|
|
421
|
+
/** 第一排查询条件及相关表单操作。 */
|
|
422
|
+
filters?: ReactNode;
|
|
423
|
+
/** 业务操作及表格控制栏,独立于筛选区。 */
|
|
424
|
+
toolbar?: ReactNode;
|
|
425
|
+
/** 查询状态、警告或其它占用自然高度的结果反馈。 */
|
|
426
|
+
feedback?: ReactNode;
|
|
427
|
+
/** 可选的业务页脚,放在结果区域下方。 */
|
|
428
|
+
footer?: ReactNode;
|
|
429
|
+
/** 占满可用高度的表格、列表或其它页面结果。 */
|
|
430
|
+
children: ReactNode;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* 在有明确高度的工作区内组织 CRUD 页面,结果独占剩余高度。
|
|
434
|
+
* @param props 宿主提供内容、状态及原生区块属性;业务请求和分页由宿主控制。
|
|
435
|
+
* @returns 可嵌入 WorkspaceLayout 表格模式的无状态页面骨架。
|
|
436
|
+
*/
|
|
437
|
+
declare function CrudWorkspace({ label, filters, toolbar, feedback, footer, children, className, ...props }: CrudWorkspaceProps): react_jsx_runtime.JSX.Element;
|
|
438
|
+
|
|
418
439
|
interface EllipsisTextProps extends ComponentProps<typeof Typography.Text> {
|
|
419
440
|
/** 单行文本最多占用的宽度;业务表格可按列宽覆盖。 */
|
|
420
441
|
maxWidth?: number | string;
|
|
@@ -543,4 +564,4 @@ declare function mapSchemaField(field: SchemaField): SchemaFieldMapping;
|
|
|
543
564
|
/** 从字段默认值生成表单初值;调用方的 initialValues 可在渲染层覆盖。 */
|
|
544
565
|
declare function schemaInitialValues(schema: SchemaFormSchema): SchemaFormValues;
|
|
545
566
|
|
|
546
|
-
export { Affix, Alert, Anchor, App, AutoComplete, Avatar, BUSINESS_DRAWER_WIDTH, BackTop, Badge, BorderBeam, Breadcrumb, BusinessDrawer, type BusinessDrawerProps, type BusinessDrawerSize, Button, Calendar, Card, Carousel, Cascader, Checkbox, Col, Collapse, ColorPicker, ConfigProvider, CrudScaffold, type CrudScaffoldProps, DataTable, type DataTableProps, DatePicker, Descriptions, Divider, Drawer, Dropdown, EllipsisText, type EllipsisTextProps, Empty, Flex, FloatButton, Form, Grid, Image, Input, InputNumber, Layout, List, Listy, Masonry, Mentions, Menu, Modal, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, Result, Row, RowActions, type RowActionsProps, type SchemaBooleanField, type SchemaChoiceField, type SchemaDateField, type SchemaDateRangeField, type SchemaField, type SchemaFieldMapping, type SchemaFieldName, SchemaForm, type SchemaFormProps, type SchemaFormSchema, type SchemaFormValues, type SchemaIssue, type SchemaNumberField, type SchemaNumberValidation, type SchemaOption, type SchemaTextField, type SchemaTextValidation, type SchemaValidationResult, SearchPanel, type SearchPanelProps, Segmented, Select, SessionReplay, type SessionReplayError, type SessionReplayEvent, type SessionReplayHandle, type SessionReplayMarker, type SessionReplayProps, type SessionReplayState, Skeleton, Slider, Space, Spin, Splitter, Statistic, Steps, Switch, Table, type TableControlColumn, TableControls, type TableControlsProps, TableEmpty, type TableEmptyProps, Tabs, Tag, type ThemeMode, ThemeModeButton, type ThemeModeButtonProps, TimePicker, Timeline, Tooltip, Tour, Transfer, Tree, TreeSelect, Typography, Upload, Watermark, WorkspaceLayout, type WorkspaceLayoutProps, mapSchemaField, schemaInitialValues, tableBodyHeight, validateSchemaForm };
|
|
567
|
+
export { Affix, Alert, Anchor, App, AutoComplete, Avatar, BUSINESS_DRAWER_WIDTH, BackTop, Badge, BorderBeam, Breadcrumb, BusinessDrawer, type BusinessDrawerProps, type BusinessDrawerSize, Button, Calendar, Card, Carousel, Cascader, Checkbox, Col, Collapse, ColorPicker, ConfigProvider, CrudScaffold, type CrudScaffoldProps, CrudWorkspace, type CrudWorkspaceProps, DataTable, type DataTableProps, DatePicker, Descriptions, Divider, Drawer, Dropdown, EllipsisText, type EllipsisTextProps, Empty, Flex, FloatButton, Form, Grid, Image, Input, InputNumber, Layout, List, Listy, Masonry, Mentions, Menu, Modal, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, Result, Row, RowActions, type RowActionsProps, type SchemaBooleanField, type SchemaChoiceField, type SchemaDateField, type SchemaDateRangeField, type SchemaField, type SchemaFieldMapping, type SchemaFieldName, SchemaForm, type SchemaFormProps, type SchemaFormSchema, type SchemaFormValues, type SchemaIssue, type SchemaNumberField, type SchemaNumberValidation, type SchemaOption, type SchemaTextField, type SchemaTextValidation, type SchemaValidationResult, SearchPanel, type SearchPanelProps, Segmented, Select, SessionReplay, type SessionReplayError, type SessionReplayEvent, type SessionReplayHandle, type SessionReplayMarker, type SessionReplayProps, type SessionReplayState, Skeleton, Slider, Space, Spin, Splitter, Statistic, Steps, Switch, Table, type TableControlColumn, TableControls, type TableControlsProps, TableEmpty, type TableEmptyProps, Tabs, Tag, type ThemeMode, ThemeModeButton, type ThemeModeButtonProps, TimePicker, Timeline, Tooltip, Tour, Transfer, Tree, TreeSelect, Typography, Upload, Watermark, WorkspaceLayout, type WorkspaceLayoutProps, mapSchemaField, schemaInitialValues, tableBodyHeight, validateSchemaForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -324,7 +324,7 @@ interface TableControlsProps {
|
|
|
324
324
|
declare function TableControls({ searchVisible, onSearchVisibleChange, onRefresh, refreshing, columns, visibleColumns, onVisibleColumnsChange, className, style, }: TableControlsProps): react_jsx_runtime.JSX.Element;
|
|
325
325
|
|
|
326
326
|
interface DataTableProps<RecordType extends object> extends TableProps<RecordType> {
|
|
327
|
-
/**
|
|
327
|
+
/** 设置表格整体容器高度;CrudWorkspace 内默认 100%,其它容器沿用视口剩余高度。 */
|
|
328
328
|
containerHeight?: CSSProperties['height'];
|
|
329
329
|
/** 仅作用于外层滚动边界,不覆盖 Ant Table 自身的 style。 */
|
|
330
330
|
containerStyle?: CSSProperties;
|
|
@@ -415,6 +415,27 @@ interface CrudScaffoldProps extends Omit<HTMLAttributes<HTMLElement>, 'children'
|
|
|
415
415
|
*/
|
|
416
416
|
declare function CrudScaffold({ label, description, filters, status, results, drawer, className, ...props }: CrudScaffoldProps): react_jsx_runtime.JSX.Element;
|
|
417
417
|
|
|
418
|
+
interface CrudWorkspaceProps extends HTMLAttributes<HTMLElement> {
|
|
419
|
+
/** 工作区的可访问名称。 */
|
|
420
|
+
label: string;
|
|
421
|
+
/** 第一排查询条件及相关表单操作。 */
|
|
422
|
+
filters?: ReactNode;
|
|
423
|
+
/** 业务操作及表格控制栏,独立于筛选区。 */
|
|
424
|
+
toolbar?: ReactNode;
|
|
425
|
+
/** 查询状态、警告或其它占用自然高度的结果反馈。 */
|
|
426
|
+
feedback?: ReactNode;
|
|
427
|
+
/** 可选的业务页脚,放在结果区域下方。 */
|
|
428
|
+
footer?: ReactNode;
|
|
429
|
+
/** 占满可用高度的表格、列表或其它页面结果。 */
|
|
430
|
+
children: ReactNode;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* 在有明确高度的工作区内组织 CRUD 页面,结果独占剩余高度。
|
|
434
|
+
* @param props 宿主提供内容、状态及原生区块属性;业务请求和分页由宿主控制。
|
|
435
|
+
* @returns 可嵌入 WorkspaceLayout 表格模式的无状态页面骨架。
|
|
436
|
+
*/
|
|
437
|
+
declare function CrudWorkspace({ label, filters, toolbar, feedback, footer, children, className, ...props }: CrudWorkspaceProps): react_jsx_runtime.JSX.Element;
|
|
438
|
+
|
|
418
439
|
interface EllipsisTextProps extends ComponentProps<typeof Typography.Text> {
|
|
419
440
|
/** 单行文本最多占用的宽度;业务表格可按列宽覆盖。 */
|
|
420
441
|
maxWidth?: number | string;
|
|
@@ -543,4 +564,4 @@ declare function mapSchemaField(field: SchemaField): SchemaFieldMapping;
|
|
|
543
564
|
/** 从字段默认值生成表单初值;调用方的 initialValues 可在渲染层覆盖。 */
|
|
544
565
|
declare function schemaInitialValues(schema: SchemaFormSchema): SchemaFormValues;
|
|
545
566
|
|
|
546
|
-
export { Affix, Alert, Anchor, App, AutoComplete, Avatar, BUSINESS_DRAWER_WIDTH, BackTop, Badge, BorderBeam, Breadcrumb, BusinessDrawer, type BusinessDrawerProps, type BusinessDrawerSize, Button, Calendar, Card, Carousel, Cascader, Checkbox, Col, Collapse, ColorPicker, ConfigProvider, CrudScaffold, type CrudScaffoldProps, DataTable, type DataTableProps, DatePicker, Descriptions, Divider, Drawer, Dropdown, EllipsisText, type EllipsisTextProps, Empty, Flex, FloatButton, Form, Grid, Image, Input, InputNumber, Layout, List, Listy, Masonry, Mentions, Menu, Modal, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, Result, Row, RowActions, type RowActionsProps, type SchemaBooleanField, type SchemaChoiceField, type SchemaDateField, type SchemaDateRangeField, type SchemaField, type SchemaFieldMapping, type SchemaFieldName, SchemaForm, type SchemaFormProps, type SchemaFormSchema, type SchemaFormValues, type SchemaIssue, type SchemaNumberField, type SchemaNumberValidation, type SchemaOption, type SchemaTextField, type SchemaTextValidation, type SchemaValidationResult, SearchPanel, type SearchPanelProps, Segmented, Select, SessionReplay, type SessionReplayError, type SessionReplayEvent, type SessionReplayHandle, type SessionReplayMarker, type SessionReplayProps, type SessionReplayState, Skeleton, Slider, Space, Spin, Splitter, Statistic, Steps, Switch, Table, type TableControlColumn, TableControls, type TableControlsProps, TableEmpty, type TableEmptyProps, Tabs, Tag, type ThemeMode, ThemeModeButton, type ThemeModeButtonProps, TimePicker, Timeline, Tooltip, Tour, Transfer, Tree, TreeSelect, Typography, Upload, Watermark, WorkspaceLayout, type WorkspaceLayoutProps, mapSchemaField, schemaInitialValues, tableBodyHeight, validateSchemaForm };
|
|
567
|
+
export { Affix, Alert, Anchor, App, AutoComplete, Avatar, BUSINESS_DRAWER_WIDTH, BackTop, Badge, BorderBeam, Breadcrumb, BusinessDrawer, type BusinessDrawerProps, type BusinessDrawerSize, Button, Calendar, Card, Carousel, Cascader, Checkbox, Col, Collapse, ColorPicker, ConfigProvider, CrudScaffold, type CrudScaffoldProps, CrudWorkspace, type CrudWorkspaceProps, DataTable, type DataTableProps, DatePicker, Descriptions, Divider, Drawer, Dropdown, EllipsisText, type EllipsisTextProps, Empty, Flex, FloatButton, Form, Grid, Image, Input, InputNumber, Layout, List, Listy, Masonry, Mentions, Menu, Modal, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, Result, Row, RowActions, type RowActionsProps, type SchemaBooleanField, type SchemaChoiceField, type SchemaDateField, type SchemaDateRangeField, type SchemaField, type SchemaFieldMapping, type SchemaFieldName, SchemaForm, type SchemaFormProps, type SchemaFormSchema, type SchemaFormValues, type SchemaIssue, type SchemaNumberField, type SchemaNumberValidation, type SchemaOption, type SchemaTextField, type SchemaTextValidation, type SchemaValidationResult, SearchPanel, type SearchPanelProps, Segmented, Select, SessionReplay, type SessionReplayError, type SessionReplayEvent, type SessionReplayHandle, type SessionReplayMarker, type SessionReplayProps, type SessionReplayState, Skeleton, Slider, Space, Spin, Splitter, Statistic, Steps, Switch, Table, type TableControlColumn, TableControls, type TableControlsProps, TableEmpty, type TableEmptyProps, Tabs, Tag, type ThemeMode, ThemeModeButton, type ThemeModeButtonProps, TimePicker, Timeline, Tooltip, Tour, Transfer, Tree, TreeSelect, Typography, Upload, Watermark, WorkspaceLayout, type WorkspaceLayoutProps, mapSchemaField, schemaInitialValues, tableBodyHeight, validateSchemaForm };
|
package/dist/index.js
CHANGED
|
@@ -1344,6 +1344,7 @@ function TableControls({
|
|
|
1344
1344
|
icon: /* @__PURE__ */ jsx6(SearchOutlined, { "aria-hidden": "true" }),
|
|
1345
1345
|
"aria-label": searchLabel,
|
|
1346
1346
|
"aria-pressed": searchVisible,
|
|
1347
|
+
"data-adminsmart-table-tool": "true",
|
|
1347
1348
|
disabled: !onSearchVisibleChange,
|
|
1348
1349
|
onClick: () => onSearchVisibleChange?.(!searchVisible)
|
|
1349
1350
|
}
|
|
@@ -1353,6 +1354,7 @@ function TableControls({
|
|
|
1353
1354
|
{
|
|
1354
1355
|
icon: /* @__PURE__ */ jsx6(ReloadOutlined, { "aria-hidden": "true" }),
|
|
1355
1356
|
"aria-label": "\u5237\u65B0\u5217\u8868",
|
|
1357
|
+
"data-adminsmart-table-tool": "true",
|
|
1356
1358
|
loading: refreshing,
|
|
1357
1359
|
disabled: !onRefresh || refreshing,
|
|
1358
1360
|
onClick: onRefresh
|
|
@@ -1396,6 +1398,7 @@ function TableControls({
|
|
|
1396
1398
|
ref: triggerRef,
|
|
1397
1399
|
icon: /* @__PURE__ */ jsx6(SettingOutlined, { "aria-hidden": "true" }),
|
|
1398
1400
|
"aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
|
|
1401
|
+
"data-adminsmart-table-tool": "true",
|
|
1399
1402
|
"aria-haspopup": "dialog",
|
|
1400
1403
|
"aria-expanded": canSetColumns && open,
|
|
1401
1404
|
"aria-controls": canSetColumns && open ? panelId : void 0,
|
|
@@ -1411,11 +1414,29 @@ function TableControls({
|
|
|
1411
1414
|
// src/composites/DataTable.tsx
|
|
1412
1415
|
import {
|
|
1413
1416
|
forwardRef as forwardRef6,
|
|
1417
|
+
useContext,
|
|
1414
1418
|
useLayoutEffect,
|
|
1415
1419
|
useRef as useRef6,
|
|
1416
1420
|
useState as useState6
|
|
1417
1421
|
} from "react";
|
|
1418
|
-
|
|
1422
|
+
|
|
1423
|
+
// src/composites/CrudWorkspace.tsx
|
|
1424
|
+
import { createContext } from "react";
|
|
1425
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1426
|
+
var CrudTableHeightContext = createContext(false);
|
|
1427
|
+
function CrudWorkspace({ label, filters, toolbar, feedback, footer, children, className, ...props }) {
|
|
1428
|
+
const classes = ["adminsmart-crud-workspace", className].filter(Boolean).join(" ");
|
|
1429
|
+
return /* @__PURE__ */ jsxs4("section", { ...props, className: classes, "aria-label": label, children: [
|
|
1430
|
+
filters != null && /* @__PURE__ */ jsx7("div", { className: "adminsmart-crud-workspace__filters", children: filters }),
|
|
1431
|
+
toolbar != null && /* @__PURE__ */ jsx7("div", { className: "adminsmart-crud-workspace__toolbar", children: toolbar }),
|
|
1432
|
+
feedback != null && /* @__PURE__ */ jsx7("div", { className: "adminsmart-crud-workspace__feedback", children: feedback }),
|
|
1433
|
+
/* @__PURE__ */ jsx7("div", { className: "adminsmart-crud-workspace__results", children: /* @__PURE__ */ jsx7(CrudTableHeightContext.Provider, { value: true, children }) }),
|
|
1434
|
+
footer != null && /* @__PURE__ */ jsx7("div", { className: "adminsmart-crud-workspace__footer", children: footer })
|
|
1435
|
+
] });
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
// src/composites/DataTable.tsx
|
|
1439
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1419
1440
|
function tableBodyHeight(availableHeight, chromeHeight) {
|
|
1420
1441
|
return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
|
|
1421
1442
|
}
|
|
@@ -1438,11 +1459,20 @@ function DataTableInner({
|
|
|
1438
1459
|
}, ref) {
|
|
1439
1460
|
const containerRef = useRef6(null);
|
|
1440
1461
|
const [bodyHeight, setBodyHeight] = useState6(360);
|
|
1441
|
-
const
|
|
1462
|
+
const inWorkspace = useContext(CrudTableHeightContext);
|
|
1463
|
+
const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
|
|
1464
|
+
const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
|
|
1442
1465
|
useLayoutEffect(() => {
|
|
1443
1466
|
const container = containerRef.current;
|
|
1444
1467
|
if (!container || scroll?.y != null) return void 0;
|
|
1445
1468
|
const update = () => {
|
|
1469
|
+
if (hasExplicitHeight) {
|
|
1470
|
+
const height = container.getBoundingClientRect().height;
|
|
1471
|
+
const chromeHeight = tableChromeHeight(container);
|
|
1472
|
+
const nextHeight2 = inWorkspace ? Math.max(0, Math.floor(height - chromeHeight)) : tableBodyHeight(height, chromeHeight);
|
|
1473
|
+
setBodyHeight((current) => current === nextHeight2 ? current : nextHeight2);
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1446
1476
|
const top = container.getBoundingClientRect().top;
|
|
1447
1477
|
let boundary = container.parentElement;
|
|
1448
1478
|
while (boundary && ["", "visible", "clip"].includes(getComputedStyle(boundary).overflowY)) {
|
|
@@ -1451,13 +1481,16 @@ function DataTableInner({
|
|
|
1451
1481
|
const boundaryStyle = boundary ? getComputedStyle(boundary) : null;
|
|
1452
1482
|
const parentBottom = boundary ? boundary.getBoundingClientRect().bottom - Number.parseFloat(boundaryStyle?.paddingBottom || "0") : Number.POSITIVE_INFINITY;
|
|
1453
1483
|
const viewportBottom = window.visualViewport?.height ?? window.innerHeight;
|
|
1454
|
-
const availableHeight =
|
|
1484
|
+
const availableHeight = Math.max(200, Math.min(viewportBottom - 16, parentBottom - 16) - top);
|
|
1455
1485
|
const nextHeight = tableBodyHeight(availableHeight, tableChromeHeight(container));
|
|
1456
1486
|
setBodyHeight((current) => current === nextHeight ? current : nextHeight);
|
|
1457
1487
|
};
|
|
1458
1488
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
|
|
1459
1489
|
observer?.observe(container);
|
|
1460
1490
|
if (container.parentElement) observer?.observe(container.parentElement);
|
|
1491
|
+
if (inWorkspace) {
|
|
1492
|
+
for (const region of container.querySelectorAll(".ant-table-header, .ant-table-pagination, .ant-table-title, .ant-table-footer")) observer?.observe(region);
|
|
1493
|
+
}
|
|
1461
1494
|
window.addEventListener("resize", update);
|
|
1462
1495
|
window.visualViewport?.addEventListener("resize", update);
|
|
1463
1496
|
update();
|
|
@@ -1466,21 +1499,22 @@ function DataTableInner({
|
|
|
1466
1499
|
window.removeEventListener("resize", update);
|
|
1467
1500
|
window.visualViewport?.removeEventListener("resize", update);
|
|
1468
1501
|
};
|
|
1469
|
-
}, [hasExplicitHeight,
|
|
1502
|
+
}, [hasExplicitHeight, inWorkspace, tableHeight, pagination, scroll?.y, tableProps.dataSource?.length]);
|
|
1470
1503
|
const tableScroll = {
|
|
1471
1504
|
...scroll,
|
|
1472
1505
|
x: scroll?.x ?? "max-content",
|
|
1473
1506
|
y: scroll?.y ?? bodyHeight
|
|
1474
1507
|
};
|
|
1475
1508
|
const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
|
|
1476
|
-
return /* @__PURE__ */
|
|
1509
|
+
return /* @__PURE__ */ jsx8(
|
|
1477
1510
|
"div",
|
|
1478
1511
|
{
|
|
1479
1512
|
ref: containerRef,
|
|
1480
1513
|
className: containerClassName,
|
|
1481
1514
|
"data-adminsmart-data-table": "true",
|
|
1482
|
-
|
|
1483
|
-
|
|
1515
|
+
"data-adminsmart-data-table-fill": inWorkspace || void 0,
|
|
1516
|
+
style: { width: "100%", minWidth: 0, overflowX: "hidden", ...tableHeight == null ? {} : { height: tableHeight, overflowY: "hidden" }, ...containerStyle },
|
|
1517
|
+
children: /* @__PURE__ */ jsx8(
|
|
1484
1518
|
Table,
|
|
1485
1519
|
{
|
|
1486
1520
|
...tableProps,
|
|
@@ -1496,7 +1530,7 @@ var DataTable = forwardRef6(DataTableInner);
|
|
|
1496
1530
|
|
|
1497
1531
|
// src/composites/WorkspaceLayout.tsx
|
|
1498
1532
|
import { theme as theme2 } from "antd";
|
|
1499
|
-
import { jsx as
|
|
1533
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1500
1534
|
var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
|
|
1501
1535
|
function WorkspaceLayout({
|
|
1502
1536
|
header,
|
|
@@ -1528,10 +1562,10 @@ function WorkspaceLayout({
|
|
|
1528
1562
|
"--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
|
|
1529
1563
|
// 夜间不复用日间固定底色。
|
|
1530
1564
|
};
|
|
1531
|
-
return /* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1565
|
+
return /* @__PURE__ */ jsxs5(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
|
|
1566
|
+
/* @__PURE__ */ jsx9("header", { className: "adminsmart-workspace__header", children: header }),
|
|
1567
|
+
/* @__PURE__ */ jsxs5(Layout, { className: "adminsmart-workspace__body", children: [
|
|
1568
|
+
/* @__PURE__ */ jsx9(
|
|
1535
1569
|
Layout.Sider,
|
|
1536
1570
|
{
|
|
1537
1571
|
theme: themeMode,
|
|
@@ -1543,9 +1577,9 @@ function WorkspaceLayout({
|
|
|
1543
1577
|
children: sidebar
|
|
1544
1578
|
}
|
|
1545
1579
|
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ jsxs5(Layout, { className: "adminsmart-workspace__main", children: [
|
|
1547
1581
|
tabs,
|
|
1548
|
-
/* @__PURE__ */
|
|
1582
|
+
/* @__PURE__ */ jsx9(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
|
|
1549
1583
|
footer
|
|
1550
1584
|
] })
|
|
1551
1585
|
] })
|
|
@@ -1553,7 +1587,7 @@ function WorkspaceLayout({
|
|
|
1553
1587
|
}
|
|
1554
1588
|
|
|
1555
1589
|
// src/composites/CrudScaffold.tsx
|
|
1556
|
-
import { jsx as
|
|
1590
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1557
1591
|
function CrudScaffold({
|
|
1558
1592
|
label,
|
|
1559
1593
|
description,
|
|
@@ -1565,16 +1599,16 @@ function CrudScaffold({
|
|
|
1565
1599
|
...props
|
|
1566
1600
|
}) {
|
|
1567
1601
|
const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
|
|
1568
|
-
return /* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
status ? /* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1602
|
+
return /* @__PURE__ */ jsxs6("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
|
|
1603
|
+
/* @__PURE__ */ jsx10("div", { className: "adminsmart-crud__filters", children: filters }),
|
|
1604
|
+
status ? /* @__PURE__ */ jsx10("div", { className: "adminsmart-crud__status", children: status }) : null,
|
|
1605
|
+
/* @__PURE__ */ jsx10("div", { className: "adminsmart-crud__results", children: results }),
|
|
1572
1606
|
drawer
|
|
1573
1607
|
] });
|
|
1574
1608
|
}
|
|
1575
1609
|
|
|
1576
1610
|
// src/composites/EllipsisText.tsx
|
|
1577
|
-
import { jsx as
|
|
1611
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1578
1612
|
function EllipsisText({
|
|
1579
1613
|
children,
|
|
1580
1614
|
maxWidth = 240,
|
|
@@ -1586,7 +1620,7 @@ function EllipsisText({
|
|
|
1586
1620
|
const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
|
|
1587
1621
|
const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
1588
1622
|
const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
|
|
1589
|
-
return /* @__PURE__ */
|
|
1623
|
+
return /* @__PURE__ */ jsx11(
|
|
1590
1624
|
Typography.Text,
|
|
1591
1625
|
{
|
|
1592
1626
|
...props,
|
|
@@ -1601,7 +1635,7 @@ function EllipsisText({
|
|
|
1601
1635
|
// src/composites/RowActions.tsx
|
|
1602
1636
|
import { EllipsisOutlined } from "@ant-design/icons";
|
|
1603
1637
|
import { Children as Children2, Fragment, isValidElement as isValidElement2 } from "react";
|
|
1604
|
-
import { jsx as
|
|
1638
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1605
1639
|
function collectButtons(children) {
|
|
1606
1640
|
const actions = [];
|
|
1607
1641
|
Children2.forEach(children, (child) => {
|
|
@@ -1632,9 +1666,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1632
1666
|
// 菜单仍按官方语义标识需要确认的动作。
|
|
1633
1667
|
}));
|
|
1634
1668
|
const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
|
|
1635
|
-
return /* @__PURE__ */
|
|
1669
|
+
return /* @__PURE__ */ jsxs7(Space, { ...props, className: classes, size, wrap, children: [
|
|
1636
1670
|
direct,
|
|
1637
|
-
overflow.length > 0 && /* @__PURE__ */
|
|
1671
|
+
overflow.length > 0 && /* @__PURE__ */ jsx12(
|
|
1638
1672
|
Dropdown,
|
|
1639
1673
|
{
|
|
1640
1674
|
trigger: ["click"],
|
|
@@ -1646,12 +1680,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1646
1680
|
action.props.onClick?.(domEvent);
|
|
1647
1681
|
}
|
|
1648
1682
|
},
|
|
1649
|
-
children: /* @__PURE__ */
|
|
1683
|
+
children: /* @__PURE__ */ jsx12(Tooltip, { title: moreLabel, children: /* @__PURE__ */ jsx12(
|
|
1650
1684
|
Button,
|
|
1651
1685
|
{
|
|
1652
1686
|
type: "text",
|
|
1653
1687
|
size: "small",
|
|
1654
|
-
icon: /* @__PURE__ */
|
|
1688
|
+
icon: /* @__PURE__ */ jsx12(EllipsisOutlined, {}),
|
|
1655
1689
|
"aria-label": moreLabel,
|
|
1656
1690
|
"aria-haspopup": "menu",
|
|
1657
1691
|
"data-adminsmart-row-more": "true",
|
|
@@ -1848,7 +1882,7 @@ function schemaInitialValues(schema) {
|
|
|
1848
1882
|
}
|
|
1849
1883
|
|
|
1850
1884
|
// src/schema/SchemaForm.tsx
|
|
1851
|
-
import { jsx as
|
|
1885
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1852
1886
|
function fieldRules(field) {
|
|
1853
1887
|
const rules = [];
|
|
1854
1888
|
if (field.required) {
|
|
@@ -1893,32 +1927,32 @@ function dateItemProps(field) {
|
|
|
1893
1927
|
function renderControl(field) {
|
|
1894
1928
|
switch (field.type) {
|
|
1895
1929
|
case "input":
|
|
1896
|
-
return /* @__PURE__ */
|
|
1930
|
+
return /* @__PURE__ */ jsx13(Input, { placeholder: field.placeholder });
|
|
1897
1931
|
case "password":
|
|
1898
|
-
return /* @__PURE__ */
|
|
1932
|
+
return /* @__PURE__ */ jsx13(Input.Password, { placeholder: field.placeholder });
|
|
1899
1933
|
case "textarea":
|
|
1900
|
-
return /* @__PURE__ */
|
|
1934
|
+
return /* @__PURE__ */ jsx13(Input.TextArea, { placeholder: field.placeholder });
|
|
1901
1935
|
case "number":
|
|
1902
|
-
return /* @__PURE__ */
|
|
1936
|
+
return /* @__PURE__ */ jsx13(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
|
|
1903
1937
|
case "select":
|
|
1904
|
-
return /* @__PURE__ */
|
|
1938
|
+
return /* @__PURE__ */ jsx13(Select, { placeholder: field.placeholder, options: field.options });
|
|
1905
1939
|
case "radio":
|
|
1906
|
-
return /* @__PURE__ */
|
|
1940
|
+
return /* @__PURE__ */ jsx13(Radio.Group, { options: field.options });
|
|
1907
1941
|
case "checkbox":
|
|
1908
|
-
return /* @__PURE__ */
|
|
1942
|
+
return /* @__PURE__ */ jsx13(Checkbox, {});
|
|
1909
1943
|
case "switch":
|
|
1910
|
-
return /* @__PURE__ */
|
|
1944
|
+
return /* @__PURE__ */ jsx13(Switch, {});
|
|
1911
1945
|
case "date":
|
|
1912
|
-
return /* @__PURE__ */
|
|
1946
|
+
return /* @__PURE__ */ jsx13(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
|
|
1913
1947
|
case "dateRange":
|
|
1914
|
-
return /* @__PURE__ */
|
|
1948
|
+
return /* @__PURE__ */ jsx13(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
|
|
1915
1949
|
}
|
|
1916
1950
|
}
|
|
1917
1951
|
var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
|
|
1918
1952
|
const result = validateSchemaForm(schema);
|
|
1919
1953
|
if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
|
|
1920
1954
|
const defaults = schemaInitialValues(schema);
|
|
1921
|
-
return /* @__PURE__ */
|
|
1955
|
+
return /* @__PURE__ */ jsxs8(
|
|
1922
1956
|
Form,
|
|
1923
1957
|
{
|
|
1924
1958
|
...formProps,
|
|
@@ -1936,7 +1970,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1936
1970
|
children: [
|
|
1937
1971
|
schema.fields.map((field) => {
|
|
1938
1972
|
const mapped = mapSchemaField(field);
|
|
1939
|
-
return /* @__PURE__ */
|
|
1973
|
+
return /* @__PURE__ */ jsx13(
|
|
1940
1974
|
Form.Item,
|
|
1941
1975
|
{
|
|
1942
1976
|
name: mapped.name,
|
|
@@ -1949,7 +1983,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1949
1983
|
mapped.name
|
|
1950
1984
|
);
|
|
1951
1985
|
}),
|
|
1952
|
-
/* @__PURE__ */
|
|
1986
|
+
/* @__PURE__ */ jsx13(Form.Item, { children: /* @__PURE__ */ jsx13(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
|
|
1953
1987
|
]
|
|
1954
1988
|
}
|
|
1955
1989
|
);
|
|
@@ -1978,6 +2012,7 @@ export {
|
|
|
1978
2012
|
ColorPicker,
|
|
1979
2013
|
ConfigProvider,
|
|
1980
2014
|
CrudScaffold,
|
|
2015
|
+
CrudWorkspace,
|
|
1981
2016
|
DataTable,
|
|
1982
2017
|
DatePicker,
|
|
1983
2018
|
Descriptions,
|