@qq1948037137/adminsmart-ui 0.1.32 → 0.1.33
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 +10 -0
- package/dist/index.cjs +110 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +132 -26
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as antd from 'antd';
|
|
2
|
+
import { Button as Button$1, ButtonProps, TooltipProps, ConfigProvider as ConfigProvider$1, Drawer as Drawer$1, Form as Form$1, Input as Input$1, Modal as Modal$1, Select as Select$1, TableProps as TableProps$1, Table as Table$1, Typography as Typography$1, AutoComplete as AutoComplete$1, Checkbox as Checkbox$1, DatePicker as DatePicker$1, InputNumber as InputNumber$1, Radio as Radio$1, Slider as Slider$1, Switch as Switch$1, TreeSelect as TreeSelect$1, Upload as Upload$1, Alert as Alert$1, App as App$1, Empty as Empty$1, Progress as Progress$1, Result as Result$1, Spin as Spin$1, Statistic as Statistic$1, Tag as Tag$1, Timeline as Timeline$1, Card as Card$1, Descriptions as Descriptions$1, List as List$1, Pagination as Pagination$1, Tree as Tree$1, Avatar as Avatar$1, Col as Col$1, Flex as Flex$1, Layout as Layout$1, Row as Row$1, Space as Space$1, Dropdown as Dropdown$1, Menu as Menu$1, Tabs as Tabs$1, Popover as Popover$1, Tooltip as Tooltip$1, Affix as Affix$1, Anchor as Anchor$1, BackTop as BackTop$1, Badge as Badge$1, BorderBeam as BorderBeam$1, Breadcrumb as Breadcrumb$1, Calendar as Calendar$1, Carousel as Carousel$1, Cascader as Cascader$1, Collapse as Collapse$1, ColorPicker as ColorPicker$1, Divider as Divider$1, FloatButton as FloatButton$1, Grid as Grid$1, Image as Image$1, Listy as Listy$1, Masonry as Masonry$1, Mentions as Mentions$1, Popconfirm as Popconfirm$1, QRCode as QRCode$1, Rate as Rate$1, Segmented as Segmented$1, Skeleton as Skeleton$1, Splitter as Splitter$1, Steps as Steps$1, TimePicker as TimePicker$1, Tour as Tour$1, Transfer as Transfer$1, Watermark as Watermark$1, DrawerProps, FormProps, FormInstance } from 'antd';
|
|
2
3
|
export { theme } from 'antd';
|
|
3
4
|
import * as react from 'react';
|
|
4
|
-
import { RefAttributes,
|
|
5
|
+
import { ReactNode, PropsWithChildren, RefAttributes, ComponentRef, CSSProperties, HTMLAttributes, ReactElement, ComponentProps, Ref } from 'react';
|
|
5
6
|
import { Replayer } from '@rrweb/replay';
|
|
6
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
8
|
|
|
@@ -55,7 +56,31 @@ declare const Modal: typeof Modal$1;
|
|
|
55
56
|
/** Select 的泛型值类型、搜索回调及虚拟列表行为全部沿用 Ant 原生接口。 */
|
|
56
57
|
declare const Select: typeof Select$1;
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
interface TableRowNumberConfig {
|
|
60
|
+
/** 外置分页的当前页,从 1 开始;内置分页会自动传入页码。 */
|
|
61
|
+
current?: number;
|
|
62
|
+
/** 外置分页每页请求条数;内置分页会自动传入实际页大小。 */
|
|
63
|
+
pageSize?: number;
|
|
64
|
+
/** 居中序号列的列头,省略时显示“序号”。 */
|
|
65
|
+
title?: ReactNode;
|
|
66
|
+
/** 序号列宽度,单位为 CSS 像素。 */
|
|
67
|
+
width?: number;
|
|
68
|
+
}
|
|
69
|
+
interface TableProps<RecordType extends object = Record<string, unknown>> extends TableProps$1<RecordType> {
|
|
70
|
+
/** 默认添加首条业务序号列;false 可关闭,外置分页也可传页码和大小。 */
|
|
71
|
+
rowNumber?: boolean | TableRowNumberConfig;
|
|
72
|
+
}
|
|
73
|
+
type TableRef = ComponentRef<typeof Table$1>;
|
|
74
|
+
/**
|
|
75
|
+
* 按页内位置显示普通序号,借助 Ant 的原生列渲染和分页事件保留现有功能。
|
|
76
|
+
* @param props 原生 Table 参数及组件库自动序号设置;ref 直接交给原始 Ant 表格。
|
|
77
|
+
* @returns 使用原始记录、选择和滚动配置的 Ant Table。
|
|
78
|
+
*/
|
|
79
|
+
declare function NumberedTable<RecordType extends object>({ rowNumber, pagination, columns, children, dataSource, expandable, expandIconColumnIndex, onChange, scroll, ...props }: PropsWithChildren<TableProps<RecordType>> & RefAttributes<TableRef>): react.FunctionComponentElement<TableProps$1<RecordType> & {
|
|
80
|
+
children?: ReactNode | undefined;
|
|
81
|
+
} & RefAttributes<antd.TableRef>>;
|
|
82
|
+
type NumberedTableComponent = typeof NumberedTable & typeof Table$1;
|
|
83
|
+
declare const Table: NumberedTableComponent;
|
|
59
84
|
|
|
60
85
|
declare const Typography: typeof Typography$1;
|
|
61
86
|
|
|
@@ -613,4 +638,4 @@ declare function mapSchemaField(field: SchemaField): SchemaFieldMapping;
|
|
|
613
638
|
/** 从字段默认值生成表单初值;调用方的 initialValues 可在渲染层覆盖。 */
|
|
614
639
|
declare function schemaInitialValues(schema: SchemaFormSchema): SchemaFormValues;
|
|
615
640
|
|
|
616
|
-
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, ErrorReportButton, type ErrorReportButtonProps, Flex, FloatButton, Form, Grid, Image, Input, InputNumber, Layout, List, Listy, Masonry, Mentions, Menu, Modal, OperationToolbar, type OperationToolbarProps, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, ReportErrorProvider, type ReportErrorProviderProps, 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 };
|
|
641
|
+
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, ErrorReportButton, type ErrorReportButtonProps, Flex, FloatButton, Form, Grid, Image, Input, InputNumber, Layout, List, Listy, Masonry, Mentions, Menu, Modal, OperationToolbar, type OperationToolbarProps, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, ReportErrorProvider, type ReportErrorProviderProps, 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, type TableProps, type TableRowNumberConfig, 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
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as antd from 'antd';
|
|
2
|
+
import { Button as Button$1, ButtonProps, TooltipProps, ConfigProvider as ConfigProvider$1, Drawer as Drawer$1, Form as Form$1, Input as Input$1, Modal as Modal$1, Select as Select$1, TableProps as TableProps$1, Table as Table$1, Typography as Typography$1, AutoComplete as AutoComplete$1, Checkbox as Checkbox$1, DatePicker as DatePicker$1, InputNumber as InputNumber$1, Radio as Radio$1, Slider as Slider$1, Switch as Switch$1, TreeSelect as TreeSelect$1, Upload as Upload$1, Alert as Alert$1, App as App$1, Empty as Empty$1, Progress as Progress$1, Result as Result$1, Spin as Spin$1, Statistic as Statistic$1, Tag as Tag$1, Timeline as Timeline$1, Card as Card$1, Descriptions as Descriptions$1, List as List$1, Pagination as Pagination$1, Tree as Tree$1, Avatar as Avatar$1, Col as Col$1, Flex as Flex$1, Layout as Layout$1, Row as Row$1, Space as Space$1, Dropdown as Dropdown$1, Menu as Menu$1, Tabs as Tabs$1, Popover as Popover$1, Tooltip as Tooltip$1, Affix as Affix$1, Anchor as Anchor$1, BackTop as BackTop$1, Badge as Badge$1, BorderBeam as BorderBeam$1, Breadcrumb as Breadcrumb$1, Calendar as Calendar$1, Carousel as Carousel$1, Cascader as Cascader$1, Collapse as Collapse$1, ColorPicker as ColorPicker$1, Divider as Divider$1, FloatButton as FloatButton$1, Grid as Grid$1, Image as Image$1, Listy as Listy$1, Masonry as Masonry$1, Mentions as Mentions$1, Popconfirm as Popconfirm$1, QRCode as QRCode$1, Rate as Rate$1, Segmented as Segmented$1, Skeleton as Skeleton$1, Splitter as Splitter$1, Steps as Steps$1, TimePicker as TimePicker$1, Tour as Tour$1, Transfer as Transfer$1, Watermark as Watermark$1, DrawerProps, FormProps, FormInstance } from 'antd';
|
|
2
3
|
export { theme } from 'antd';
|
|
3
4
|
import * as react from 'react';
|
|
4
|
-
import { RefAttributes,
|
|
5
|
+
import { ReactNode, PropsWithChildren, RefAttributes, ComponentRef, CSSProperties, HTMLAttributes, ReactElement, ComponentProps, Ref } from 'react';
|
|
5
6
|
import { Replayer } from '@rrweb/replay';
|
|
6
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
8
|
|
|
@@ -55,7 +56,31 @@ declare const Modal: typeof Modal$1;
|
|
|
55
56
|
/** Select 的泛型值类型、搜索回调及虚拟列表行为全部沿用 Ant 原生接口。 */
|
|
56
57
|
declare const Select: typeof Select$1;
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
interface TableRowNumberConfig {
|
|
60
|
+
/** 外置分页的当前页,从 1 开始;内置分页会自动传入页码。 */
|
|
61
|
+
current?: number;
|
|
62
|
+
/** 外置分页每页请求条数;内置分页会自动传入实际页大小。 */
|
|
63
|
+
pageSize?: number;
|
|
64
|
+
/** 居中序号列的列头,省略时显示“序号”。 */
|
|
65
|
+
title?: ReactNode;
|
|
66
|
+
/** 序号列宽度,单位为 CSS 像素。 */
|
|
67
|
+
width?: number;
|
|
68
|
+
}
|
|
69
|
+
interface TableProps<RecordType extends object = Record<string, unknown>> extends TableProps$1<RecordType> {
|
|
70
|
+
/** 默认添加首条业务序号列;false 可关闭,外置分页也可传页码和大小。 */
|
|
71
|
+
rowNumber?: boolean | TableRowNumberConfig;
|
|
72
|
+
}
|
|
73
|
+
type TableRef = ComponentRef<typeof Table$1>;
|
|
74
|
+
/**
|
|
75
|
+
* 按页内位置显示普通序号,借助 Ant 的原生列渲染和分页事件保留现有功能。
|
|
76
|
+
* @param props 原生 Table 参数及组件库自动序号设置;ref 直接交给原始 Ant 表格。
|
|
77
|
+
* @returns 使用原始记录、选择和滚动配置的 Ant Table。
|
|
78
|
+
*/
|
|
79
|
+
declare function NumberedTable<RecordType extends object>({ rowNumber, pagination, columns, children, dataSource, expandable, expandIconColumnIndex, onChange, scroll, ...props }: PropsWithChildren<TableProps<RecordType>> & RefAttributes<TableRef>): react.FunctionComponentElement<TableProps$1<RecordType> & {
|
|
80
|
+
children?: ReactNode | undefined;
|
|
81
|
+
} & RefAttributes<antd.TableRef>>;
|
|
82
|
+
type NumberedTableComponent = typeof NumberedTable & typeof Table$1;
|
|
83
|
+
declare const Table: NumberedTableComponent;
|
|
59
84
|
|
|
60
85
|
declare const Typography: typeof Typography$1;
|
|
61
86
|
|
|
@@ -613,4 +638,4 @@ declare function mapSchemaField(field: SchemaField): SchemaFieldMapping;
|
|
|
613
638
|
/** 从字段默认值生成表单初值;调用方的 initialValues 可在渲染层覆盖。 */
|
|
614
639
|
declare function schemaInitialValues(schema: SchemaFormSchema): SchemaFormValues;
|
|
615
640
|
|
|
616
|
-
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, ErrorReportButton, type ErrorReportButtonProps, Flex, FloatButton, Form, Grid, Image, Input, InputNumber, Layout, List, Listy, Masonry, Mentions, Menu, Modal, OperationToolbar, type OperationToolbarProps, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, ReportErrorProvider, type ReportErrorProviderProps, 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 };
|
|
641
|
+
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, ErrorReportButton, type ErrorReportButtonProps, Flex, FloatButton, Form, Grid, Image, Input, InputNumber, Layout, List, Listy, Masonry, Mentions, Menu, Modal, OperationToolbar, type OperationToolbarProps, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, ReportErrorProvider, type ReportErrorProviderProps, 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, type TableProps, type TableRowNumberConfig, 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
|
@@ -241,9 +241,10 @@ var Select = Object.assign(wrapAntComponent(AntSelect, "Select"), {
|
|
|
241
241
|
|
|
242
242
|
// src/components/Table.ts
|
|
243
243
|
import { Table as AntTable } from "antd";
|
|
244
|
-
import { createElement as createElement2 } from "react";
|
|
244
|
+
import { Children, createElement as createElement2, isValidElement, useState as useState2 } from "react";
|
|
245
245
|
|
|
246
246
|
// src/internal/paginationTotal.ts
|
|
247
|
+
var DEFAULT_PAGE_SIZE = 10;
|
|
247
248
|
function paginationTotal(total) {
|
|
248
249
|
return `\u5171 ${total} \u6761`;
|
|
249
250
|
}
|
|
@@ -288,19 +289,119 @@ function TableEmpty({ className, description = "\u6682\u65E0\u6570\u636E", image
|
|
|
288
289
|
}
|
|
289
290
|
|
|
290
291
|
// src/components/Table.ts
|
|
292
|
+
var ROW_NUMBER_KEY = "__adminsmart_row_number";
|
|
293
|
+
var DEFAULT_NUMBER_WIDTH = 64;
|
|
291
294
|
function normalizeTableProps(props) {
|
|
292
295
|
const locale = props.locale ?? {};
|
|
293
296
|
const content = locale.emptyText;
|
|
294
297
|
const emptyText = content === void 0 ? createElement2(TableEmpty) : typeof content === "string" || typeof content === "number" ? createElement2(TableEmpty, { description: content }) : content;
|
|
295
298
|
const pagination = props.pagination;
|
|
296
|
-
const tablePagination = pagination === false ? false : { showTotal: paginationTotal, ...pagination };
|
|
299
|
+
const tablePagination = pagination === false ? false : { defaultPageSize: DEFAULT_PAGE_SIZE, showTotal: paginationTotal, ...pagination };
|
|
297
300
|
return { ...props, locale: { ...locale, emptyText }, pagination: tablePagination };
|
|
298
301
|
}
|
|
302
|
+
function isControlColumn(column) {
|
|
303
|
+
return column === AntTable.SELECTION_COLUMN || column === AntTable.EXPAND_COLUMN;
|
|
304
|
+
}
|
|
305
|
+
function NumberedTable({ rowNumber = true, pagination, columns, children, dataSource, expandable, expandIconColumnIndex, onChange, scroll, ...props }) {
|
|
306
|
+
const nativePagination = pagination || void 0;
|
|
307
|
+
const [innerPage, setInnerPage] = useState2(() => ({
|
|
308
|
+
current: nativePagination?.defaultCurrent ?? 1,
|
|
309
|
+
// 未显式控制页码时跟踪 native Table 的切页结果。
|
|
310
|
+
size: nativePagination?.defaultPageSize ?? DEFAULT_PAGE_SIZE
|
|
311
|
+
// 以与 Ant 相同的首次实际页大小为准。
|
|
312
|
+
}));
|
|
313
|
+
const [, refreshTreeNumbers] = useState2(0);
|
|
314
|
+
const passedChildren = Children.toArray(children).filter(isValidElement);
|
|
315
|
+
const numberConfig = typeof rowNumber === "object" ? rowNumber : void 0;
|
|
316
|
+
const firstBusiness = columns?.findIndex((column) => !isControlColumn(column)) ?? 0;
|
|
317
|
+
if (!rowNumber || firstBusiness < 0 || columns == null && passedChildren.length === 0) {
|
|
318
|
+
return createElement2(AntTable, { ...props, pagination, columns, children, dataSource, expandable, expandIconColumnIndex, onChange, scroll });
|
|
319
|
+
}
|
|
320
|
+
const pageSize = numberConfig?.pageSize ?? nativePagination?.pageSize ?? innerPage.size;
|
|
321
|
+
const requestedPage = numberConfig?.current ?? (pagination === false ? 1 : nativePagination?.current ?? innerPage.current);
|
|
322
|
+
const maximumPage = pagination === false || numberConfig?.current != null ? requestedPage : Math.max(1, Math.ceil((nativePagination?.total || dataSource?.length || 0) / pageSize));
|
|
323
|
+
const current = Math.min(requestedPage, maximumPage);
|
|
324
|
+
const offset = (current - 1) * pageSize;
|
|
325
|
+
const width = numberConfig?.width ?? DEFAULT_NUMBER_WIDTH;
|
|
326
|
+
const childField = expandable?.childrenColumnName ?? props.childrenColumnName ?? "children";
|
|
327
|
+
const treeRows = Boolean(dataSource?.some((row) => row[childField]));
|
|
328
|
+
const visibleTreeOrder = treeRows ? /* @__PURE__ */ new WeakMap() : void 0;
|
|
329
|
+
const numberColumn = {
|
|
330
|
+
key: ROW_NUMBER_KEY,
|
|
331
|
+
// 序号列不占用宿主字段、不参与筛选或列显隐设置。
|
|
332
|
+
title: numberConfig?.title ?? "\u5E8F\u53F7",
|
|
333
|
+
// 空列表也显示序号表头。
|
|
334
|
+
width,
|
|
335
|
+
// 保证带选择按钮或横向滚动时列尺寸稳定。
|
|
336
|
+
align: "center",
|
|
337
|
+
// Ant 的新列表头和数据单元格一起居中。
|
|
338
|
+
className: "adminsmart-table-row-number",
|
|
339
|
+
// 可供宿主做视觉或无障碍验收的固定类名。
|
|
340
|
+
onCell: visibleTreeOrder ? (row, index) => {
|
|
341
|
+
if (index != null) visibleTreeOrder.set(row, index);
|
|
342
|
+
return {};
|
|
343
|
+
} : void 0,
|
|
344
|
+
render: (_value, row, index) => offset + (visibleTreeOrder?.get(row) ?? index) + 1
|
|
345
|
+
// 跟随排序、筛选及本页展开顺序。
|
|
346
|
+
};
|
|
347
|
+
const numberedColumns = columns == null ? void 0 : [...columns.slice(0, firstBusiness), numberColumn, ...columns.slice(firstBusiness)];
|
|
348
|
+
const numberedChildren = columns == null ? [createElement2(AntTable.Column, numberColumn), ...passedChildren] : children;
|
|
349
|
+
const nativeExpandIndex = expandable?.expandIconColumnIndex ?? expandIconColumnIndex;
|
|
350
|
+
const originalTreeIndex = nativeExpandIndex == null ? props.rowSelection ? 1 : 0 : props.rowSelection && nativeExpandIndex > 0 ? nativeExpandIndex - 1 : nativeExpandIndex;
|
|
351
|
+
const selectionBefore = props.rowSelection && !columns?.includes(AntTable.SELECTION_COLUMN) ? 1 : 0;
|
|
352
|
+
const actualIntro = firstBusiness + selectionBefore;
|
|
353
|
+
const shiftedTreeIndex = originalTreeIndex >= actualIntro ? originalTreeIndex + 1 : originalTreeIndex;
|
|
354
|
+
const nextExpandIndex = treeRows ? props.rowSelection && shiftedTreeIndex > 0 ? shiftedTreeIndex + 1 : shiftedTreeIndex : nativeExpandIndex != null && nativeExpandIndex > firstBusiness ? nativeExpandIndex + 1 : nativeExpandIndex;
|
|
355
|
+
const numberedExpandable = {
|
|
356
|
+
...expandable,
|
|
357
|
+
...nextExpandIndex == null ? {} : { expandIconColumnIndex: nextExpandIndex },
|
|
358
|
+
// 保留既有展开图标所在的业务列。
|
|
359
|
+
...treeRows ? {
|
|
360
|
+
onExpandedRowsChange: (keys) => {
|
|
361
|
+
refreshTreeNumbers((revision) => revision + 1);
|
|
362
|
+
if (expandable?.onExpandedRowsChange) expandable.onExpandedRowsChange(keys);
|
|
363
|
+
else props.onExpandedRowsChange?.([...keys]);
|
|
364
|
+
}
|
|
365
|
+
} : {}
|
|
366
|
+
// 只跟踪原生展开事件;宿主控制的展开键和回调仍照常执行。
|
|
367
|
+
};
|
|
368
|
+
const handleChange = (next, filters, sorter, extra) => {
|
|
369
|
+
if (pagination !== false) {
|
|
370
|
+
setInnerPage({
|
|
371
|
+
current: next.current ?? 1,
|
|
372
|
+
// Ant 的筛选过程会把当前页重置到 1。
|
|
373
|
+
size: next.pageSize ?? DEFAULT_PAGE_SIZE
|
|
374
|
+
// 原生切换每页条数会同步更新编号偏移。
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
onChange?.(next, filters, sorter, extra);
|
|
378
|
+
};
|
|
379
|
+
return createElement2(AntTable, {
|
|
380
|
+
...props,
|
|
381
|
+
pagination,
|
|
382
|
+
columns: numberedColumns,
|
|
383
|
+
children: numberedChildren,
|
|
384
|
+
dataSource,
|
|
385
|
+
expandable: treeRows || nextExpandIndex != null ? numberedExpandable : expandable,
|
|
386
|
+
onChange: handleChange,
|
|
387
|
+
scroll: typeof scroll?.x === "number" ? { ...scroll, x: scroll.x + width } : scroll
|
|
388
|
+
});
|
|
389
|
+
}
|
|
299
390
|
var Summary = Object.assign(wrapAntComponent(AntTable.Summary, "Table.Summary"), {
|
|
300
391
|
Row: wrapAntComponent(AntTable.Summary.Row, "Table.Summary.Row"),
|
|
301
392
|
Cell: wrapAntComponent(AntTable.Summary.Cell, "Table.Summary.Cell")
|
|
302
393
|
});
|
|
303
|
-
var Table = Object.assign(wrapAntComponent(
|
|
394
|
+
var Table = Object.assign(wrapAntComponent(NumberedTable, "Table", {}, normalizeTableProps), {
|
|
395
|
+
EXPAND_COLUMN: AntTable.EXPAND_COLUMN,
|
|
396
|
+
// 与 Ant 内部引用相同,否则不能识别占位列。
|
|
397
|
+
SELECTION_COLUMN: AntTable.SELECTION_COLUMN,
|
|
398
|
+
// 保留显式勾选列的位置控制。
|
|
399
|
+
SELECTION_ALL: AntTable.SELECTION_ALL,
|
|
400
|
+
// 透传原生全选选项。
|
|
401
|
+
SELECTION_INVERT: AntTable.SELECTION_INVERT,
|
|
402
|
+
// 透传原生反选选项。
|
|
403
|
+
SELECTION_NONE: AntTable.SELECTION_NONE,
|
|
404
|
+
// 透传原生清空选项。
|
|
304
405
|
Column: wrapAntComponent(AntTable.Column, "Table.Column"),
|
|
305
406
|
ColumnGroup: wrapAntComponent(AntTable.ColumnGroup, "Table.ColumnGroup"),
|
|
306
407
|
Summary
|
|
@@ -375,12 +476,17 @@ var ListItem = Object.assign(wrapAntComponent(AntList.Item, "List.Item"), {
|
|
|
375
476
|
});
|
|
376
477
|
function normalizeListProps(props) {
|
|
377
478
|
const pagination = props.pagination;
|
|
378
|
-
return pagination && typeof pagination === "object" ? { ...props, pagination: { showTotal: paginationTotal, ...pagination } } : props;
|
|
479
|
+
return pagination && typeof pagination === "object" ? { ...props, pagination: { defaultPageSize: DEFAULT_PAGE_SIZE, showTotal: paginationTotal, ...pagination } } : props;
|
|
379
480
|
}
|
|
380
481
|
var List = Object.assign(wrapAntComponent(AntList, "List", {}, normalizeListProps), {
|
|
381
482
|
Item: ListItem
|
|
382
483
|
});
|
|
383
|
-
var Pagination = wrapAntComponent(AntPagination, "Pagination", {
|
|
484
|
+
var Pagination = wrapAntComponent(AntPagination, "Pagination", {
|
|
485
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
486
|
+
// 宿主可用 pageSize 或 defaultPageSize 覆盖初始十条。
|
|
487
|
+
showTotal: paginationTotal
|
|
488
|
+
// 默认展示筛选后的完整记录数。
|
|
489
|
+
});
|
|
384
490
|
var Tree = Object.assign(wrapAntComponent(AntTree, "Tree"), {
|
|
385
491
|
DirectoryTree: wrapAntComponent(AntTree.DirectoryTree, "Tree.DirectoryTree"),
|
|
386
492
|
TreeNode: wrapAntComponent(AntTree.TreeNode, "Tree.TreeNode")
|
|
@@ -605,7 +711,7 @@ var BusinessDrawer = forwardRef3(function BusinessDrawer2({ sizeVariant = "stand
|
|
|
605
711
|
});
|
|
606
712
|
|
|
607
713
|
// src/composites/SessionReplay.tsx
|
|
608
|
-
import { forwardRef as forwardRef4, useCallback as useCallback2, useEffect as useEffect3, useImperativeHandle, useRef as useRef3, useState as
|
|
714
|
+
import { forwardRef as forwardRef4, useCallback as useCallback2, useEffect as useEffect3, useImperativeHandle, useRef as useRef3, useState as useState4 } from "react";
|
|
609
715
|
import { FullscreenExitOutlined, FullscreenOutlined, PauseOutlined, PlayCircleOutlined, RedoOutlined, StepBackwardOutlined, StepForwardOutlined } from "@ant-design/icons";
|
|
610
716
|
import { Alert as Alert2, Button as Button2, Empty as Empty2, Select as Select2, Slider as Slider2, Spin as Spin2, Tag as Tag2, Tooltip as Tooltip2, Typography as Typography2, theme } from "antd";
|
|
611
717
|
|
|
@@ -756,7 +862,7 @@ function replayClock(timeMs) {
|
|
|
756
862
|
}
|
|
757
863
|
|
|
758
864
|
// src/composites/useSessionReplay.ts
|
|
759
|
-
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as
|
|
865
|
+
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
760
866
|
|
|
761
867
|
// src/composites/sessionReplayEngine.ts
|
|
762
868
|
async function loadReplayEngine() {
|
|
@@ -780,7 +886,7 @@ function initialState(status) {
|
|
|
780
886
|
};
|
|
781
887
|
}
|
|
782
888
|
function useSessionReplay(options) {
|
|
783
|
-
const [state, setState] =
|
|
889
|
+
const [state, setState] = useState3(() => initialState("idle"));
|
|
784
890
|
const stateRef = useRef2(state);
|
|
785
891
|
const engineRef = useRef2(null);
|
|
786
892
|
const runtimeFailureRef = useRef2(null);
|
|
@@ -1078,8 +1184,8 @@ var SessionReplay = forwardRef4(function SessionReplay2({ events, active = true,
|
|
|
1078
1184
|
const containerRef = useRef3(null);
|
|
1079
1185
|
const stageRef = useRef3(null);
|
|
1080
1186
|
const rootRef = useRef3(null);
|
|
1081
|
-
const [problem, setProblem] =
|
|
1082
|
-
const [fullscreen, setFullscreen] =
|
|
1187
|
+
const [problem, setProblem] = useState4(null);
|
|
1188
|
+
const [fullscreen, setFullscreen] = useState4(false);
|
|
1083
1189
|
const reportError = useCallback2((value) => {
|
|
1084
1190
|
setProblem(value);
|
|
1085
1191
|
onError?.(value);
|
|
@@ -1213,19 +1319,19 @@ var SessionReplay = forwardRef4(function SessionReplay2({ events, active = true,
|
|
|
1213
1319
|
// src/composites/SearchPanel.tsx
|
|
1214
1320
|
import { DownOutlined, UpOutlined } from "@ant-design/icons";
|
|
1215
1321
|
import {
|
|
1216
|
-
Children,
|
|
1322
|
+
Children as Children2,
|
|
1217
1323
|
forwardRef as forwardRef5,
|
|
1218
|
-
isValidElement,
|
|
1324
|
+
isValidElement as isValidElement2,
|
|
1219
1325
|
useEffect as useEffect4,
|
|
1220
1326
|
useRef as useRef5,
|
|
1221
|
-
useState as
|
|
1327
|
+
useState as useState6
|
|
1222
1328
|
} from "react";
|
|
1223
1329
|
|
|
1224
1330
|
// src/composites/OperationToolbar.tsx
|
|
1225
1331
|
import { createContext, useContext } from "react";
|
|
1226
1332
|
|
|
1227
1333
|
// src/composites/ErrorReportButton.tsx
|
|
1228
|
-
import { useRef as useRef4, useState as
|
|
1334
|
+
import { useRef as useRef4, useState as useState5 } from "react";
|
|
1229
1335
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1230
1336
|
function ErrorReportButton({
|
|
1231
1337
|
onReport,
|
|
@@ -1234,7 +1340,7 @@ function ErrorReportButton({
|
|
|
1234
1340
|
description
|
|
1235
1341
|
}) {
|
|
1236
1342
|
const pending = useRef4(false);
|
|
1237
|
-
const [reporting, setReporting] =
|
|
1343
|
+
const [reporting, setReporting] = useState5(false);
|
|
1238
1344
|
async function report() {
|
|
1239
1345
|
if (disabled || pending.current) return;
|
|
1240
1346
|
pending.current = true;
|
|
@@ -1292,9 +1398,9 @@ function collapsedSearchFieldLimit(columns) {
|
|
|
1292
1398
|
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1293
1399
|
var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, trailingTools, searchVisible = true, defaultExpanded = false, role = "search", style, ...props }, ref) {
|
|
1294
1400
|
const rootRef = useRef5(null);
|
|
1295
|
-
const [width, setWidth] =
|
|
1296
|
-
const [expanded, setExpanded] =
|
|
1297
|
-
const items =
|
|
1401
|
+
const [width, setWidth] = useState6(0);
|
|
1402
|
+
const [expanded, setExpanded] = useState6(defaultExpanded);
|
|
1403
|
+
const items = Children2.toArray(fields);
|
|
1298
1404
|
const columns = searchColumnCount(width);
|
|
1299
1405
|
const collapsedLimit = collapsedSearchFieldLimit(columns);
|
|
1300
1406
|
const hasMore = items.length > collapsedLimit;
|
|
@@ -1339,7 +1445,7 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1339
1445
|
style: { minWidth: 0, width: fieldWidth || "min(240px, 100%)", flex: "0 0 auto" },
|
|
1340
1446
|
children: item
|
|
1341
1447
|
},
|
|
1342
|
-
|
|
1448
|
+
isValidElement2(item) ? item.key ?? index : index
|
|
1343
1449
|
)),
|
|
1344
1450
|
/* @__PURE__ */ jsxs3("div", { "data-adminsmart-search-actions": "true", style: { display: "flex", alignItems: "center", gap: 8, minHeight: 32 }, children: [
|
|
1345
1451
|
hasMore ? /* @__PURE__ */ jsx7(
|
|
@@ -1361,7 +1467,7 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1361
1467
|
|
|
1362
1468
|
// src/composites/TableControls.tsx
|
|
1363
1469
|
import { ReloadOutlined, SearchOutlined, SettingOutlined } from "@ant-design/icons";
|
|
1364
|
-
import { useId, useRef as useRef6, useState as
|
|
1470
|
+
import { useId, useRef as useRef6, useState as useState7 } from "react";
|
|
1365
1471
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1366
1472
|
function TableControls({
|
|
1367
1473
|
searchVisible = true,
|
|
@@ -1374,7 +1480,7 @@ function TableControls({
|
|
|
1374
1480
|
className,
|
|
1375
1481
|
style
|
|
1376
1482
|
}) {
|
|
1377
|
-
const [open, setOpen] =
|
|
1483
|
+
const [open, setOpen] = useState7(false);
|
|
1378
1484
|
const triggerRef = useRef6(null);
|
|
1379
1485
|
const panelRef = useRef6(null);
|
|
1380
1486
|
const panelId = useId();
|
|
@@ -1485,7 +1591,7 @@ import {
|
|
|
1485
1591
|
useContext as useContext2,
|
|
1486
1592
|
useLayoutEffect,
|
|
1487
1593
|
useRef as useRef7,
|
|
1488
|
-
useState as
|
|
1594
|
+
useState as useState8
|
|
1489
1595
|
} from "react";
|
|
1490
1596
|
|
|
1491
1597
|
// src/composites/CrudWorkspace.tsx
|
|
@@ -1527,7 +1633,7 @@ function DataTableInner({
|
|
|
1527
1633
|
...tableProps
|
|
1528
1634
|
}, ref) {
|
|
1529
1635
|
const containerRef = useRef7(null);
|
|
1530
|
-
const [bodyHeight, setBodyHeight] =
|
|
1636
|
+
const [bodyHeight, setBodyHeight] = useState8(360);
|
|
1531
1637
|
const inWorkspace = useContext2(CrudTableHeightContext);
|
|
1532
1638
|
const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
|
|
1533
1639
|
const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
|
|
@@ -1703,12 +1809,12 @@ function EllipsisText({
|
|
|
1703
1809
|
|
|
1704
1810
|
// src/composites/RowActions.tsx
|
|
1705
1811
|
import { EllipsisOutlined } from "@ant-design/icons";
|
|
1706
|
-
import { Children as
|
|
1812
|
+
import { Children as Children3, Fragment, isValidElement as isValidElement3 } from "react";
|
|
1707
1813
|
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1708
1814
|
function collectButtons(children) {
|
|
1709
1815
|
const actions = [];
|
|
1710
|
-
|
|
1711
|
-
if (!
|
|
1816
|
+
Children3.forEach(children, (child) => {
|
|
1817
|
+
if (!isValidElement3(child)) return;
|
|
1712
1818
|
if (child.type === Fragment) actions.push(...collectButtons(child.props.children));
|
|
1713
1819
|
else {
|
|
1714
1820
|
if (child.type !== Button && child.type !== "button") throw new TypeError("RowActions \u53EA\u63A5\u53D7\u5DF2\u6309\u6743\u9650\u7B5B\u9009\u7684 Button \u6216 Fragment");
|