@qq1948037137/adminsmart-ui 0.1.27 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/index.cjs +166 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +158 -40
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -288,6 +288,41 @@ interface SearchPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childre
|
|
|
288
288
|
*/
|
|
289
289
|
declare const SearchPanel: react.ForwardRefExoticComponent<SearchPanelProps & react.RefAttributes<HTMLDivElement>>;
|
|
290
290
|
|
|
291
|
+
interface TableControlColumn {
|
|
292
|
+
/** 宿主表格的稳定列标识,在同一表格中必须唯一。 */
|
|
293
|
+
key: string;
|
|
294
|
+
/** 列选择面板中供用户识别的列标题。 */
|
|
295
|
+
label: ReactNode;
|
|
296
|
+
/** 为真时保留宿主原有显隐值,不允许用户切换。 */
|
|
297
|
+
disabled?: boolean;
|
|
298
|
+
}
|
|
299
|
+
interface TableControlsProps {
|
|
300
|
+
/** 筛选区当前可见。由宿主将该状态传给同页的 SearchPanel。 */
|
|
301
|
+
searchVisible?: boolean;
|
|
302
|
+
/** 请求宿主改变筛选区可见状态。省略时保持搜索按钮位置且禁用。 */
|
|
303
|
+
onSearchVisibleChange?: (visible: boolean) => void;
|
|
304
|
+
/** 重新加载当前页。省略时保持刷新按钮位置且禁用。 */
|
|
305
|
+
onRefresh?: () => void;
|
|
306
|
+
/** 当前正在重新加载。为真时刷新按钮显示进度并阻止重复操作。 */
|
|
307
|
+
refreshing?: boolean;
|
|
308
|
+
/** 可显示在列选择面板中的业务列。省略时列选择不可用。 */
|
|
309
|
+
columns?: readonly TableControlColumn[];
|
|
310
|
+
/** 当前可见的列标识。省略时将提供的所有列视为可见。 */
|
|
311
|
+
visibleColumns?: readonly string[];
|
|
312
|
+
/** 以 columns 原有顺序返回新的可见列标识,由宿主应用及按需持久化。 */
|
|
313
|
+
onVisibleColumnsChange?: (keys: string[]) => void;
|
|
314
|
+
/** 宿主用于定位工具组的可选类名。 */
|
|
315
|
+
className?: string;
|
|
316
|
+
/** 宿主可选的工具组样式覆写。 */
|
|
317
|
+
style?: CSSProperties;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* 为列表右侧提供顺序固定的筛选显隐、刷新和显示列控件。
|
|
321
|
+
* @param props 搜索、刷新和列显隐由宿主管理,控件只管理面板的打开与键盘焦点。
|
|
322
|
+
* @returns 可放入 SearchPanel.trailingTools 的一组紧凑工具。
|
|
323
|
+
*/
|
|
324
|
+
declare function TableControls({ searchVisible, onSearchVisibleChange, onRefresh, refreshing, columns, visibleColumns, onVisibleColumnsChange, className, style, }: TableControlsProps): react_jsx_runtime.JSX.Element;
|
|
325
|
+
|
|
291
326
|
interface DataTableProps<RecordType extends object> extends TableProps<RecordType> {
|
|
292
327
|
/** 设置表格整体容器的固定高度;省略时按屏幕剩余高度计算。 */
|
|
293
328
|
containerHeight?: CSSProperties['height'];
|
|
@@ -508,4 +543,4 @@ declare function mapSchemaField(field: SchemaField): SchemaFieldMapping;
|
|
|
508
543
|
/** 从字段默认值生成表单初值;调用方的 initialValues 可在渲染层覆盖。 */
|
|
509
544
|
declare function schemaInitialValues(schema: SchemaFormSchema): SchemaFormValues;
|
|
510
545
|
|
|
511
|
-
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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -288,6 +288,41 @@ interface SearchPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childre
|
|
|
288
288
|
*/
|
|
289
289
|
declare const SearchPanel: react.ForwardRefExoticComponent<SearchPanelProps & react.RefAttributes<HTMLDivElement>>;
|
|
290
290
|
|
|
291
|
+
interface TableControlColumn {
|
|
292
|
+
/** 宿主表格的稳定列标识,在同一表格中必须唯一。 */
|
|
293
|
+
key: string;
|
|
294
|
+
/** 列选择面板中供用户识别的列标题。 */
|
|
295
|
+
label: ReactNode;
|
|
296
|
+
/** 为真时保留宿主原有显隐值,不允许用户切换。 */
|
|
297
|
+
disabled?: boolean;
|
|
298
|
+
}
|
|
299
|
+
interface TableControlsProps {
|
|
300
|
+
/** 筛选区当前可见。由宿主将该状态传给同页的 SearchPanel。 */
|
|
301
|
+
searchVisible?: boolean;
|
|
302
|
+
/** 请求宿主改变筛选区可见状态。省略时保持搜索按钮位置且禁用。 */
|
|
303
|
+
onSearchVisibleChange?: (visible: boolean) => void;
|
|
304
|
+
/** 重新加载当前页。省略时保持刷新按钮位置且禁用。 */
|
|
305
|
+
onRefresh?: () => void;
|
|
306
|
+
/** 当前正在重新加载。为真时刷新按钮显示进度并阻止重复操作。 */
|
|
307
|
+
refreshing?: boolean;
|
|
308
|
+
/** 可显示在列选择面板中的业务列。省略时列选择不可用。 */
|
|
309
|
+
columns?: readonly TableControlColumn[];
|
|
310
|
+
/** 当前可见的列标识。省略时将提供的所有列视为可见。 */
|
|
311
|
+
visibleColumns?: readonly string[];
|
|
312
|
+
/** 以 columns 原有顺序返回新的可见列标识,由宿主应用及按需持久化。 */
|
|
313
|
+
onVisibleColumnsChange?: (keys: string[]) => void;
|
|
314
|
+
/** 宿主用于定位工具组的可选类名。 */
|
|
315
|
+
className?: string;
|
|
316
|
+
/** 宿主可选的工具组样式覆写。 */
|
|
317
|
+
style?: CSSProperties;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* 为列表右侧提供顺序固定的筛选显隐、刷新和显示列控件。
|
|
321
|
+
* @param props 搜索、刷新和列显隐由宿主管理,控件只管理面板的打开与键盘焦点。
|
|
322
|
+
* @returns 可放入 SearchPanel.trailingTools 的一组紧凑工具。
|
|
323
|
+
*/
|
|
324
|
+
declare function TableControls({ searchVisible, onSearchVisibleChange, onRefresh, refreshing, columns, visibleColumns, onVisibleColumnsChange, className, style, }: TableControlsProps): react_jsx_runtime.JSX.Element;
|
|
325
|
+
|
|
291
326
|
interface DataTableProps<RecordType extends object> extends TableProps<RecordType> {
|
|
292
327
|
/** 设置表格整体容器的固定高度;省略时按屏幕剩余高度计算。 */
|
|
293
328
|
containerHeight?: CSSProperties['height'];
|
|
@@ -508,4 +543,4 @@ declare function mapSchemaField(field: SchemaField): SchemaFieldMapping;
|
|
|
508
543
|
/** 从字段默认值生成表单初值;调用方的 initialValues 可在渲染层覆盖。 */
|
|
509
544
|
declare function schemaInitialValues(schema: SchemaFormSchema): SchemaFormValues;
|
|
510
545
|
|
|
511
|
-
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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1291,14 +1291,131 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1291
1291
|
] });
|
|
1292
1292
|
});
|
|
1293
1293
|
|
|
1294
|
+
// src/composites/TableControls.tsx
|
|
1295
|
+
import { ReloadOutlined, SearchOutlined, SettingOutlined } from "@ant-design/icons";
|
|
1296
|
+
import { useId, useRef as useRef5, useState as useState5 } from "react";
|
|
1297
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1298
|
+
function TableControls({
|
|
1299
|
+
searchVisible = true,
|
|
1300
|
+
onSearchVisibleChange,
|
|
1301
|
+
onRefresh,
|
|
1302
|
+
refreshing = false,
|
|
1303
|
+
columns = [],
|
|
1304
|
+
visibleColumns,
|
|
1305
|
+
onVisibleColumnsChange,
|
|
1306
|
+
className,
|
|
1307
|
+
style
|
|
1308
|
+
}) {
|
|
1309
|
+
const [open, setOpen] = useState5(false);
|
|
1310
|
+
const triggerRef = useRef5(null);
|
|
1311
|
+
const panelRef = useRef5(null);
|
|
1312
|
+
const panelId = useId();
|
|
1313
|
+
const editable = columns.filter((column) => !column.disabled);
|
|
1314
|
+
const visible = new Set(visibleColumns ?? columns.map((column) => column.key));
|
|
1315
|
+
const checkedCount = editable.filter((column) => visible.has(column.key)).length;
|
|
1316
|
+
const canSetColumns = editable.length > 0 && Boolean(onVisibleColumnsChange);
|
|
1317
|
+
const searchLabel = searchVisible ? "\u9690\u85CF\u641C\u7D22" : "\u663E\u793A\u641C\u7D22";
|
|
1318
|
+
const setVisible = (keys, checked) => {
|
|
1319
|
+
const next = new Set(visible);
|
|
1320
|
+
for (const key of keys) {
|
|
1321
|
+
if (checked) next.add(key);
|
|
1322
|
+
else next.delete(key);
|
|
1323
|
+
}
|
|
1324
|
+
onVisibleColumnsChange?.(columns.filter((column) => next.has(column.key)).map((column) => column.key));
|
|
1325
|
+
};
|
|
1326
|
+
const closeOnEscape = (event) => {
|
|
1327
|
+
if (event.key !== "Escape") return;
|
|
1328
|
+
event.stopPropagation();
|
|
1329
|
+
setOpen(false);
|
|
1330
|
+
triggerRef.current?.focus();
|
|
1331
|
+
};
|
|
1332
|
+
const panelStyle = {
|
|
1333
|
+
display: "grid",
|
|
1334
|
+
gap: 8,
|
|
1335
|
+
minWidth: 120,
|
|
1336
|
+
maxWidth: "min(320px, calc(100vw - 32px))",
|
|
1337
|
+
maxHeight: "min(380px, 60vh)",
|
|
1338
|
+
overflow: "auto"
|
|
1339
|
+
};
|
|
1340
|
+
return /* @__PURE__ */ jsxs3("div", { className, style: { display: "inline-flex", alignItems: "center", flexShrink: 0, gap: 8, ...style }, children: [
|
|
1341
|
+
/* @__PURE__ */ jsx6(Tooltip, { title: searchLabel, children: /* @__PURE__ */ jsx6(
|
|
1342
|
+
Button,
|
|
1343
|
+
{
|
|
1344
|
+
icon: /* @__PURE__ */ jsx6(SearchOutlined, { "aria-hidden": "true" }),
|
|
1345
|
+
"aria-label": searchLabel,
|
|
1346
|
+
"aria-pressed": searchVisible,
|
|
1347
|
+
disabled: !onSearchVisibleChange,
|
|
1348
|
+
onClick: () => onSearchVisibleChange?.(!searchVisible)
|
|
1349
|
+
}
|
|
1350
|
+
) }),
|
|
1351
|
+
/* @__PURE__ */ jsx6(Tooltip, { title: "\u5237\u65B0\u5217\u8868", children: /* @__PURE__ */ jsx6(
|
|
1352
|
+
Button,
|
|
1353
|
+
{
|
|
1354
|
+
icon: /* @__PURE__ */ jsx6(ReloadOutlined, { "aria-hidden": "true" }),
|
|
1355
|
+
"aria-label": "\u5237\u65B0\u5217\u8868",
|
|
1356
|
+
loading: refreshing,
|
|
1357
|
+
disabled: !onRefresh || refreshing,
|
|
1358
|
+
onClick: onRefresh
|
|
1359
|
+
}
|
|
1360
|
+
) }),
|
|
1361
|
+
/* @__PURE__ */ jsx6(
|
|
1362
|
+
Popover,
|
|
1363
|
+
{
|
|
1364
|
+
trigger: "click",
|
|
1365
|
+
placement: "bottomRight",
|
|
1366
|
+
title: "\u8BBE\u7F6E\u663E\u793A\u5217",
|
|
1367
|
+
open: canSetColumns && open,
|
|
1368
|
+
onOpenChange: (next) => setOpen(canSetColumns && next),
|
|
1369
|
+
afterOpenChange: (opened) => {
|
|
1370
|
+
if (opened) panelRef.current?.querySelector("input:not(:disabled)")?.focus();
|
|
1371
|
+
},
|
|
1372
|
+
content: /* @__PURE__ */ jsxs3("div", { ref: panelRef, id: panelId, role: "dialog", "aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217", onKeyDown: closeOnEscape, style: panelStyle, children: [
|
|
1373
|
+
/* @__PURE__ */ jsx6(
|
|
1374
|
+
Checkbox,
|
|
1375
|
+
{
|
|
1376
|
+
checked: checkedCount === editable.length,
|
|
1377
|
+
indeterminate: checkedCount > 0 && checkedCount < editable.length,
|
|
1378
|
+
onChange: (event) => setVisible(editable.map((column) => column.key), event.target.checked),
|
|
1379
|
+
children: "\u663E\u793A\u5168\u90E8\u53EF\u9009\u5217"
|
|
1380
|
+
}
|
|
1381
|
+
),
|
|
1382
|
+
columns.map((column) => /* @__PURE__ */ jsx6(
|
|
1383
|
+
Checkbox,
|
|
1384
|
+
{
|
|
1385
|
+
checked: visible.has(column.key),
|
|
1386
|
+
disabled: column.disabled,
|
|
1387
|
+
onChange: (event) => setVisible([column.key], event.target.checked),
|
|
1388
|
+
children: column.label
|
|
1389
|
+
},
|
|
1390
|
+
column.key
|
|
1391
|
+
))
|
|
1392
|
+
] }),
|
|
1393
|
+
children: /* @__PURE__ */ jsx6(
|
|
1394
|
+
Button,
|
|
1395
|
+
{
|
|
1396
|
+
ref: triggerRef,
|
|
1397
|
+
icon: /* @__PURE__ */ jsx6(SettingOutlined, { "aria-hidden": "true" }),
|
|
1398
|
+
"aria-label": "\u8BBE\u7F6E\u663E\u793A\u5217",
|
|
1399
|
+
"aria-haspopup": "dialog",
|
|
1400
|
+
"aria-expanded": canSetColumns && open,
|
|
1401
|
+
"aria-controls": canSetColumns && open ? panelId : void 0,
|
|
1402
|
+
disabled: !canSetColumns,
|
|
1403
|
+
onKeyDown: open ? closeOnEscape : void 0
|
|
1404
|
+
}
|
|
1405
|
+
)
|
|
1406
|
+
}
|
|
1407
|
+
)
|
|
1408
|
+
] });
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1294
1411
|
// src/composites/DataTable.tsx
|
|
1295
1412
|
import {
|
|
1296
1413
|
forwardRef as forwardRef6,
|
|
1297
1414
|
useLayoutEffect,
|
|
1298
|
-
useRef as
|
|
1299
|
-
useState as
|
|
1415
|
+
useRef as useRef6,
|
|
1416
|
+
useState as useState6
|
|
1300
1417
|
} from "react";
|
|
1301
|
-
import { jsx as
|
|
1418
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1302
1419
|
function tableBodyHeight(availableHeight, chromeHeight) {
|
|
1303
1420
|
return Math.max(0, Math.floor(availableHeight - chromeHeight - 16));
|
|
1304
1421
|
}
|
|
@@ -1319,8 +1436,8 @@ function DataTableInner({
|
|
|
1319
1436
|
scroll,
|
|
1320
1437
|
...tableProps
|
|
1321
1438
|
}, ref) {
|
|
1322
|
-
const containerRef =
|
|
1323
|
-
const [bodyHeight, setBodyHeight] =
|
|
1439
|
+
const containerRef = useRef6(null);
|
|
1440
|
+
const [bodyHeight, setBodyHeight] = useState6(360);
|
|
1324
1441
|
const hasExplicitHeight = containerHeight != null || containerStyle?.height != null;
|
|
1325
1442
|
useLayoutEffect(() => {
|
|
1326
1443
|
const container = containerRef.current;
|
|
@@ -1356,14 +1473,14 @@ function DataTableInner({
|
|
|
1356
1473
|
y: scroll?.y ?? bodyHeight
|
|
1357
1474
|
};
|
|
1358
1475
|
const tablePagination = pagination === false ? false : pagination?.placement || pagination?.position ? pagination : { placement: ["bottomEnd"], ...pagination };
|
|
1359
|
-
return /* @__PURE__ */
|
|
1476
|
+
return /* @__PURE__ */ jsx7(
|
|
1360
1477
|
"div",
|
|
1361
1478
|
{
|
|
1362
1479
|
ref: containerRef,
|
|
1363
1480
|
className: containerClassName,
|
|
1364
1481
|
"data-adminsmart-data-table": "true",
|
|
1365
1482
|
style: { width: "100%", minWidth: 0, overflowX: "hidden", ...containerHeight == null ? {} : { height: containerHeight, overflowY: "hidden" }, ...containerStyle },
|
|
1366
|
-
children: /* @__PURE__ */
|
|
1483
|
+
children: /* @__PURE__ */ jsx7(
|
|
1367
1484
|
Table,
|
|
1368
1485
|
{
|
|
1369
1486
|
...tableProps,
|
|
@@ -1379,7 +1496,7 @@ var DataTable = forwardRef6(DataTableInner);
|
|
|
1379
1496
|
|
|
1380
1497
|
// src/composites/WorkspaceLayout.tsx
|
|
1381
1498
|
import { theme as theme2 } from "antd";
|
|
1382
|
-
import { jsx as
|
|
1499
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1383
1500
|
var LIGHT_WORKSPACE_BACKGROUND = "#f6f9fe";
|
|
1384
1501
|
function WorkspaceLayout({
|
|
1385
1502
|
header,
|
|
@@ -1411,10 +1528,10 @@ function WorkspaceLayout({
|
|
|
1411
1528
|
"--adminsmart-workspace-bg": themeMode === "dark" ? token.colorBgLayout : LIGHT_WORKSPACE_BACKGROUND
|
|
1412
1529
|
// 夜间不复用日间固定底色。
|
|
1413
1530
|
};
|
|
1414
|
-
return /* @__PURE__ */
|
|
1415
|
-
/* @__PURE__ */
|
|
1416
|
-
/* @__PURE__ */
|
|
1417
|
-
/* @__PURE__ */
|
|
1531
|
+
return /* @__PURE__ */ jsxs4(Layout, { className: rootClassName, style: workspaceStyle, "data-theme-mode": themeMode, children: [
|
|
1532
|
+
/* @__PURE__ */ jsx8("header", { className: "adminsmart-workspace__header", children: header }),
|
|
1533
|
+
/* @__PURE__ */ jsxs4(Layout, { className: "adminsmart-workspace__body", children: [
|
|
1534
|
+
/* @__PURE__ */ jsx8(
|
|
1418
1535
|
Layout.Sider,
|
|
1419
1536
|
{
|
|
1420
1537
|
theme: themeMode,
|
|
@@ -1426,9 +1543,9 @@ function WorkspaceLayout({
|
|
|
1426
1543
|
children: sidebar
|
|
1427
1544
|
}
|
|
1428
1545
|
),
|
|
1429
|
-
/* @__PURE__ */
|
|
1546
|
+
/* @__PURE__ */ jsxs4(Layout, { className: "adminsmart-workspace__main", children: [
|
|
1430
1547
|
tabs,
|
|
1431
|
-
/* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ jsx8(Layout.Content, { className: contentClasses, "data-content-mode": contentMode, children }),
|
|
1432
1549
|
footer
|
|
1433
1550
|
] })
|
|
1434
1551
|
] })
|
|
@@ -1436,7 +1553,7 @@ function WorkspaceLayout({
|
|
|
1436
1553
|
}
|
|
1437
1554
|
|
|
1438
1555
|
// src/composites/CrudScaffold.tsx
|
|
1439
|
-
import { jsx as
|
|
1556
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1440
1557
|
function CrudScaffold({
|
|
1441
1558
|
label,
|
|
1442
1559
|
description,
|
|
@@ -1448,16 +1565,16 @@ function CrudScaffold({
|
|
|
1448
1565
|
...props
|
|
1449
1566
|
}) {
|
|
1450
1567
|
const classes = ["adminsmart-crud", className].filter(Boolean).join(" ");
|
|
1451
|
-
return /* @__PURE__ */
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
status ? /* @__PURE__ */
|
|
1454
|
-
/* @__PURE__ */
|
|
1568
|
+
return /* @__PURE__ */ jsxs5("main", { ...props, className: classes, "aria-label": label, "aria-description": description, children: [
|
|
1569
|
+
/* @__PURE__ */ jsx9("div", { className: "adminsmart-crud__filters", children: filters }),
|
|
1570
|
+
status ? /* @__PURE__ */ jsx9("div", { className: "adminsmart-crud__status", children: status }) : null,
|
|
1571
|
+
/* @__PURE__ */ jsx9("div", { className: "adminsmart-crud__results", children: results }),
|
|
1455
1572
|
drawer
|
|
1456
1573
|
] });
|
|
1457
1574
|
}
|
|
1458
1575
|
|
|
1459
1576
|
// src/composites/EllipsisText.tsx
|
|
1460
|
-
import { jsx as
|
|
1577
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1461
1578
|
function EllipsisText({
|
|
1462
1579
|
children,
|
|
1463
1580
|
maxWidth = 240,
|
|
@@ -1469,7 +1586,7 @@ function EllipsisText({
|
|
|
1469
1586
|
const classes = ["adminsmart-ellipsis-text", className].filter(Boolean).join(" ");
|
|
1470
1587
|
const widthValue = typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
|
|
1471
1588
|
const textStyle = { "--adminsmart-ellipsis-width": widthValue, ...style };
|
|
1472
|
-
return /* @__PURE__ */
|
|
1589
|
+
return /* @__PURE__ */ jsx10(
|
|
1473
1590
|
Typography.Text,
|
|
1474
1591
|
{
|
|
1475
1592
|
...props,
|
|
@@ -1484,7 +1601,7 @@ function EllipsisText({
|
|
|
1484
1601
|
// src/composites/RowActions.tsx
|
|
1485
1602
|
import { EllipsisOutlined } from "@ant-design/icons";
|
|
1486
1603
|
import { Children as Children2, Fragment, isValidElement as isValidElement2 } from "react";
|
|
1487
|
-
import { jsx as
|
|
1604
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1488
1605
|
function collectButtons(children) {
|
|
1489
1606
|
const actions = [];
|
|
1490
1607
|
Children2.forEach(children, (child) => {
|
|
@@ -1515,9 +1632,9 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1515
1632
|
// 菜单仍按官方语义标识需要确认的动作。
|
|
1516
1633
|
}));
|
|
1517
1634
|
const classes = ["adminsmart-row-action-group", className].filter(Boolean).join(" ");
|
|
1518
|
-
return /* @__PURE__ */
|
|
1635
|
+
return /* @__PURE__ */ jsxs6(Space, { ...props, className: classes, size, wrap, children: [
|
|
1519
1636
|
direct,
|
|
1520
|
-
overflow.length > 0 && /* @__PURE__ */
|
|
1637
|
+
overflow.length > 0 && /* @__PURE__ */ jsx11(
|
|
1521
1638
|
Dropdown,
|
|
1522
1639
|
{
|
|
1523
1640
|
trigger: ["click"],
|
|
@@ -1529,12 +1646,12 @@ function RowActions({ children, maxVisible = 2, moreLabel = "\u66F4\u591A\u64CD\
|
|
|
1529
1646
|
action.props.onClick?.(domEvent);
|
|
1530
1647
|
}
|
|
1531
1648
|
},
|
|
1532
|
-
children: /* @__PURE__ */
|
|
1649
|
+
children: /* @__PURE__ */ jsx11(Tooltip, { title: moreLabel, children: /* @__PURE__ */ jsx11(
|
|
1533
1650
|
Button,
|
|
1534
1651
|
{
|
|
1535
1652
|
type: "text",
|
|
1536
1653
|
size: "small",
|
|
1537
|
-
icon: /* @__PURE__ */
|
|
1654
|
+
icon: /* @__PURE__ */ jsx11(EllipsisOutlined, {}),
|
|
1538
1655
|
"aria-label": moreLabel,
|
|
1539
1656
|
"aria-haspopup": "menu",
|
|
1540
1657
|
"data-adminsmart-row-more": "true",
|
|
@@ -1731,7 +1848,7 @@ function schemaInitialValues(schema) {
|
|
|
1731
1848
|
}
|
|
1732
1849
|
|
|
1733
1850
|
// src/schema/SchemaForm.tsx
|
|
1734
|
-
import { jsx as
|
|
1851
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1735
1852
|
function fieldRules(field) {
|
|
1736
1853
|
const rules = [];
|
|
1737
1854
|
if (field.required) {
|
|
@@ -1776,32 +1893,32 @@ function dateItemProps(field) {
|
|
|
1776
1893
|
function renderControl(field) {
|
|
1777
1894
|
switch (field.type) {
|
|
1778
1895
|
case "input":
|
|
1779
|
-
return /* @__PURE__ */
|
|
1896
|
+
return /* @__PURE__ */ jsx12(Input, { placeholder: field.placeholder });
|
|
1780
1897
|
case "password":
|
|
1781
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ jsx12(Input.Password, { placeholder: field.placeholder });
|
|
1782
1899
|
case "textarea":
|
|
1783
|
-
return /* @__PURE__ */
|
|
1900
|
+
return /* @__PURE__ */ jsx12(Input.TextArea, { placeholder: field.placeholder });
|
|
1784
1901
|
case "number":
|
|
1785
|
-
return /* @__PURE__ */
|
|
1902
|
+
return /* @__PURE__ */ jsx12(InputNumber, { placeholder: field.placeholder, min: field.validation?.min, max: field.validation?.max, style: { width: "100%" } });
|
|
1786
1903
|
case "select":
|
|
1787
|
-
return /* @__PURE__ */
|
|
1904
|
+
return /* @__PURE__ */ jsx12(Select, { placeholder: field.placeholder, options: field.options });
|
|
1788
1905
|
case "radio":
|
|
1789
|
-
return /* @__PURE__ */
|
|
1906
|
+
return /* @__PURE__ */ jsx12(Radio.Group, { options: field.options });
|
|
1790
1907
|
case "checkbox":
|
|
1791
|
-
return /* @__PURE__ */
|
|
1908
|
+
return /* @__PURE__ */ jsx12(Checkbox, {});
|
|
1792
1909
|
case "switch":
|
|
1793
|
-
return /* @__PURE__ */
|
|
1910
|
+
return /* @__PURE__ */ jsx12(Switch, {});
|
|
1794
1911
|
case "date":
|
|
1795
|
-
return /* @__PURE__ */
|
|
1912
|
+
return /* @__PURE__ */ jsx12(DatePicker, { placeholder: field.placeholder, style: { width: "100%" } });
|
|
1796
1913
|
case "dateRange":
|
|
1797
|
-
return /* @__PURE__ */
|
|
1914
|
+
return /* @__PURE__ */ jsx12(DatePicker.RangePicker, { placeholder: field.placeholder ? [field.placeholder, field.placeholder] : void 0, style: { width: "100%" } });
|
|
1798
1915
|
}
|
|
1799
1916
|
}
|
|
1800
1917
|
var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange, onFinish, onValuesChange, initialValues, layout = "vertical", ...formProps }, ref) {
|
|
1801
1918
|
const result = validateSchemaForm(schema);
|
|
1802
1919
|
if (!result.valid) throw new Error(`SchemaForm \u914D\u7F6E\u65E0\u6548\uFF1A${result.errors.map((issue) => `${issue.path} ${issue.message}`).join("\uFF1B")}`);
|
|
1803
1920
|
const defaults = schemaInitialValues(schema);
|
|
1804
|
-
return /* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ jsxs7(
|
|
1805
1922
|
Form,
|
|
1806
1923
|
{
|
|
1807
1924
|
...formProps,
|
|
@@ -1819,7 +1936,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1819
1936
|
children: [
|
|
1820
1937
|
schema.fields.map((field) => {
|
|
1821
1938
|
const mapped = mapSchemaField(field);
|
|
1822
|
-
return /* @__PURE__ */
|
|
1939
|
+
return /* @__PURE__ */ jsx12(
|
|
1823
1940
|
Form.Item,
|
|
1824
1941
|
{
|
|
1825
1942
|
name: mapped.name,
|
|
@@ -1832,7 +1949,7 @@ var SchemaForm = forwardRef7(function SchemaForm2({ schema, onSubmit, onChange,
|
|
|
1832
1949
|
mapped.name
|
|
1833
1950
|
);
|
|
1834
1951
|
}),
|
|
1835
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ jsx12(Form.Item, { children: /* @__PURE__ */ jsx12(Button, { type: "primary", htmlType: "submit", children: schema.submitText ?? "\u63D0\u4EA4" }) })
|
|
1836
1953
|
]
|
|
1837
1954
|
}
|
|
1838
1955
|
);
|
|
@@ -1907,6 +2024,7 @@ export {
|
|
|
1907
2024
|
Steps,
|
|
1908
2025
|
Switch,
|
|
1909
2026
|
Table,
|
|
2027
|
+
TableControls,
|
|
1910
2028
|
TableEmpty,
|
|
1911
2029
|
Tabs,
|
|
1912
2030
|
Tag,
|