@qq1948037137/adminsmart-ui 0.1.32 → 0.1.34
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 +12 -0
- package/dist/index.cjs +122 -5
- 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 +144 -27
- 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
|
@@ -220,10 +220,21 @@ var Form = Object.assign(wrapAntComponent(AntForm, "Form"), {
|
|
|
220
220
|
|
|
221
221
|
// src/components/Input.ts
|
|
222
222
|
import { Input as AntInput } from "antd";
|
|
223
|
+
var DEFAULT_TEXT_AREA_ROWS = 5;
|
|
224
|
+
function normalizeTextArea(props) {
|
|
225
|
+
if (props.rows !== void 0 || Object.hasOwn(props, "autoSize")) return props;
|
|
226
|
+
return {
|
|
227
|
+
...props,
|
|
228
|
+
rows: DEFAULT_TEXT_AREA_ROWS,
|
|
229
|
+
// 自动测量前也保持五行,避免初次显示时跳动。
|
|
230
|
+
autoSize: { minRows: DEFAULT_TEXT_AREA_ROWS }
|
|
231
|
+
// 由 Ant 随输入内容增减,不设行数上限。
|
|
232
|
+
};
|
|
233
|
+
}
|
|
223
234
|
var Input = Object.assign(wrapAntComponent(AntInput, "Input"), {
|
|
224
235
|
Group: wrapAntComponent(AntInput.Group, "Input.Group"),
|
|
225
236
|
Search: wrapAntComponent(AntInput.Search, "Input.Search"),
|
|
226
|
-
TextArea: wrapAntComponent(AntInput.TextArea, "Input.TextArea"),
|
|
237
|
+
TextArea: wrapAntComponent(AntInput.TextArea, "Input.TextArea", {}, normalizeTextArea),
|
|
227
238
|
Password: wrapAntComponent(AntInput.Password, "Input.Password"),
|
|
228
239
|
OTP: wrapAntComponent(AntInput.OTP, "Input.OTP")
|
|
229
240
|
});
|
|
@@ -241,9 +252,10 @@ var Select = Object.assign(wrapAntComponent(AntSelect, "Select"), {
|
|
|
241
252
|
|
|
242
253
|
// src/components/Table.ts
|
|
243
254
|
import { Table as AntTable } from "antd";
|
|
244
|
-
import { createElement as createElement2 } from "react";
|
|
255
|
+
import { Children, createElement as createElement2, isValidElement, useState as useState2 } from "react";
|
|
245
256
|
|
|
246
257
|
// src/internal/paginationTotal.ts
|
|
258
|
+
var DEFAULT_PAGE_SIZE = 10;
|
|
247
259
|
function paginationTotal(total) {
|
|
248
260
|
return `\u5171 ${total} \u6761`;
|
|
249
261
|
}
|
|
@@ -288,19 +300,119 @@ function TableEmpty({ className, description = "\u6682\u65E0\u6570\u636E", image
|
|
|
288
300
|
}
|
|
289
301
|
|
|
290
302
|
// src/components/Table.ts
|
|
303
|
+
var ROW_NUMBER_KEY = "__adminsmart_row_number";
|
|
304
|
+
var DEFAULT_NUMBER_WIDTH = 64;
|
|
291
305
|
function normalizeTableProps(props) {
|
|
292
306
|
const locale = props.locale ?? {};
|
|
293
307
|
const content = locale.emptyText;
|
|
294
308
|
const emptyText = content === void 0 ? createElement2(TableEmpty) : typeof content === "string" || typeof content === "number" ? createElement2(TableEmpty, { description: content }) : content;
|
|
295
309
|
const pagination = props.pagination;
|
|
296
|
-
const tablePagination = pagination === false ? false : { showTotal: paginationTotal, ...pagination };
|
|
310
|
+
const tablePagination = pagination === false ? false : { defaultPageSize: DEFAULT_PAGE_SIZE, showTotal: paginationTotal, ...pagination };
|
|
297
311
|
return { ...props, locale: { ...locale, emptyText }, pagination: tablePagination };
|
|
298
312
|
}
|
|
313
|
+
function isControlColumn(column) {
|
|
314
|
+
return column === AntTable.SELECTION_COLUMN || column === AntTable.EXPAND_COLUMN;
|
|
315
|
+
}
|
|
316
|
+
function NumberedTable({ rowNumber = true, pagination, columns, children, dataSource, expandable, expandIconColumnIndex, onChange, scroll, ...props }) {
|
|
317
|
+
const nativePagination = pagination || void 0;
|
|
318
|
+
const [innerPage, setInnerPage] = useState2(() => ({
|
|
319
|
+
current: nativePagination?.defaultCurrent ?? 1,
|
|
320
|
+
// 未显式控制页码时跟踪 native Table 的切页结果。
|
|
321
|
+
size: nativePagination?.defaultPageSize ?? DEFAULT_PAGE_SIZE
|
|
322
|
+
// 以与 Ant 相同的首次实际页大小为准。
|
|
323
|
+
}));
|
|
324
|
+
const [, refreshTreeNumbers] = useState2(0);
|
|
325
|
+
const passedChildren = Children.toArray(children).filter(isValidElement);
|
|
326
|
+
const numberConfig = typeof rowNumber === "object" ? rowNumber : void 0;
|
|
327
|
+
const firstBusiness = columns?.findIndex((column) => !isControlColumn(column)) ?? 0;
|
|
328
|
+
if (!rowNumber || firstBusiness < 0 || columns == null && passedChildren.length === 0) {
|
|
329
|
+
return createElement2(AntTable, { ...props, pagination, columns, children, dataSource, expandable, expandIconColumnIndex, onChange, scroll });
|
|
330
|
+
}
|
|
331
|
+
const pageSize = numberConfig?.pageSize ?? nativePagination?.pageSize ?? innerPage.size;
|
|
332
|
+
const requestedPage = numberConfig?.current ?? (pagination === false ? 1 : nativePagination?.current ?? innerPage.current);
|
|
333
|
+
const maximumPage = pagination === false || numberConfig?.current != null ? requestedPage : Math.max(1, Math.ceil((nativePagination?.total || dataSource?.length || 0) / pageSize));
|
|
334
|
+
const current = Math.min(requestedPage, maximumPage);
|
|
335
|
+
const offset = (current - 1) * pageSize;
|
|
336
|
+
const width = numberConfig?.width ?? DEFAULT_NUMBER_WIDTH;
|
|
337
|
+
const childField = expandable?.childrenColumnName ?? props.childrenColumnName ?? "children";
|
|
338
|
+
const treeRows = Boolean(dataSource?.some((row) => row[childField]));
|
|
339
|
+
const visibleTreeOrder = treeRows ? /* @__PURE__ */ new WeakMap() : void 0;
|
|
340
|
+
const numberColumn = {
|
|
341
|
+
key: ROW_NUMBER_KEY,
|
|
342
|
+
// 序号列不占用宿主字段、不参与筛选或列显隐设置。
|
|
343
|
+
title: numberConfig?.title ?? "\u5E8F\u53F7",
|
|
344
|
+
// 空列表也显示序号表头。
|
|
345
|
+
width,
|
|
346
|
+
// 保证带选择按钮或横向滚动时列尺寸稳定。
|
|
347
|
+
align: "center",
|
|
348
|
+
// Ant 的新列表头和数据单元格一起居中。
|
|
349
|
+
className: "adminsmart-table-row-number",
|
|
350
|
+
// 可供宿主做视觉或无障碍验收的固定类名。
|
|
351
|
+
onCell: visibleTreeOrder ? (row, index) => {
|
|
352
|
+
if (index != null) visibleTreeOrder.set(row, index);
|
|
353
|
+
return {};
|
|
354
|
+
} : void 0,
|
|
355
|
+
render: (_value, row, index) => offset + (visibleTreeOrder?.get(row) ?? index) + 1
|
|
356
|
+
// 跟随排序、筛选及本页展开顺序。
|
|
357
|
+
};
|
|
358
|
+
const numberedColumns = columns == null ? void 0 : [...columns.slice(0, firstBusiness), numberColumn, ...columns.slice(firstBusiness)];
|
|
359
|
+
const numberedChildren = columns == null ? [createElement2(AntTable.Column, numberColumn), ...passedChildren] : children;
|
|
360
|
+
const nativeExpandIndex = expandable?.expandIconColumnIndex ?? expandIconColumnIndex;
|
|
361
|
+
const originalTreeIndex = nativeExpandIndex == null ? props.rowSelection ? 1 : 0 : props.rowSelection && nativeExpandIndex > 0 ? nativeExpandIndex - 1 : nativeExpandIndex;
|
|
362
|
+
const selectionBefore = props.rowSelection && !columns?.includes(AntTable.SELECTION_COLUMN) ? 1 : 0;
|
|
363
|
+
const actualIntro = firstBusiness + selectionBefore;
|
|
364
|
+
const shiftedTreeIndex = originalTreeIndex >= actualIntro ? originalTreeIndex + 1 : originalTreeIndex;
|
|
365
|
+
const nextExpandIndex = treeRows ? props.rowSelection && shiftedTreeIndex > 0 ? shiftedTreeIndex + 1 : shiftedTreeIndex : nativeExpandIndex != null && nativeExpandIndex > firstBusiness ? nativeExpandIndex + 1 : nativeExpandIndex;
|
|
366
|
+
const numberedExpandable = {
|
|
367
|
+
...expandable,
|
|
368
|
+
...nextExpandIndex == null ? {} : { expandIconColumnIndex: nextExpandIndex },
|
|
369
|
+
// 保留既有展开图标所在的业务列。
|
|
370
|
+
...treeRows ? {
|
|
371
|
+
onExpandedRowsChange: (keys) => {
|
|
372
|
+
refreshTreeNumbers((revision) => revision + 1);
|
|
373
|
+
if (expandable?.onExpandedRowsChange) expandable.onExpandedRowsChange(keys);
|
|
374
|
+
else props.onExpandedRowsChange?.([...keys]);
|
|
375
|
+
}
|
|
376
|
+
} : {}
|
|
377
|
+
// 只跟踪原生展开事件;宿主控制的展开键和回调仍照常执行。
|
|
378
|
+
};
|
|
379
|
+
const handleChange = (next, filters, sorter, extra) => {
|
|
380
|
+
if (pagination !== false) {
|
|
381
|
+
setInnerPage({
|
|
382
|
+
current: next.current ?? 1,
|
|
383
|
+
// Ant 的筛选过程会把当前页重置到 1。
|
|
384
|
+
size: next.pageSize ?? DEFAULT_PAGE_SIZE
|
|
385
|
+
// 原生切换每页条数会同步更新编号偏移。
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
onChange?.(next, filters, sorter, extra);
|
|
389
|
+
};
|
|
390
|
+
return createElement2(AntTable, {
|
|
391
|
+
...props,
|
|
392
|
+
pagination,
|
|
393
|
+
columns: numberedColumns,
|
|
394
|
+
children: numberedChildren,
|
|
395
|
+
dataSource,
|
|
396
|
+
expandable: treeRows || nextExpandIndex != null ? numberedExpandable : expandable,
|
|
397
|
+
onChange: handleChange,
|
|
398
|
+
scroll: typeof scroll?.x === "number" ? { ...scroll, x: scroll.x + width } : scroll
|
|
399
|
+
});
|
|
400
|
+
}
|
|
299
401
|
var Summary = Object.assign(wrapAntComponent(AntTable.Summary, "Table.Summary"), {
|
|
300
402
|
Row: wrapAntComponent(AntTable.Summary.Row, "Table.Summary.Row"),
|
|
301
403
|
Cell: wrapAntComponent(AntTable.Summary.Cell, "Table.Summary.Cell")
|
|
302
404
|
});
|
|
303
|
-
var Table = Object.assign(wrapAntComponent(
|
|
405
|
+
var Table = Object.assign(wrapAntComponent(NumberedTable, "Table", {}, normalizeTableProps), {
|
|
406
|
+
EXPAND_COLUMN: AntTable.EXPAND_COLUMN,
|
|
407
|
+
// 与 Ant 内部引用相同,否则不能识别占位列。
|
|
408
|
+
SELECTION_COLUMN: AntTable.SELECTION_COLUMN,
|
|
409
|
+
// 保留显式勾选列的位置控制。
|
|
410
|
+
SELECTION_ALL: AntTable.SELECTION_ALL,
|
|
411
|
+
// 透传原生全选选项。
|
|
412
|
+
SELECTION_INVERT: AntTable.SELECTION_INVERT,
|
|
413
|
+
// 透传原生反选选项。
|
|
414
|
+
SELECTION_NONE: AntTable.SELECTION_NONE,
|
|
415
|
+
// 透传原生清空选项。
|
|
304
416
|
Column: wrapAntComponent(AntTable.Column, "Table.Column"),
|
|
305
417
|
ColumnGroup: wrapAntComponent(AntTable.ColumnGroup, "Table.ColumnGroup"),
|
|
306
418
|
Summary
|
|
@@ -375,12 +487,17 @@ var ListItem = Object.assign(wrapAntComponent(AntList.Item, "List.Item"), {
|
|
|
375
487
|
});
|
|
376
488
|
function normalizeListProps(props) {
|
|
377
489
|
const pagination = props.pagination;
|
|
378
|
-
return pagination && typeof pagination === "object" ? { ...props, pagination: { showTotal: paginationTotal, ...pagination } } : props;
|
|
490
|
+
return pagination && typeof pagination === "object" ? { ...props, pagination: { defaultPageSize: DEFAULT_PAGE_SIZE, showTotal: paginationTotal, ...pagination } } : props;
|
|
379
491
|
}
|
|
380
492
|
var List = Object.assign(wrapAntComponent(AntList, "List", {}, normalizeListProps), {
|
|
381
493
|
Item: ListItem
|
|
382
494
|
});
|
|
383
|
-
var Pagination = wrapAntComponent(AntPagination, "Pagination", {
|
|
495
|
+
var Pagination = wrapAntComponent(AntPagination, "Pagination", {
|
|
496
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
497
|
+
// 宿主可用 pageSize 或 defaultPageSize 覆盖初始十条。
|
|
498
|
+
showTotal: paginationTotal
|
|
499
|
+
// 默认展示筛选后的完整记录数。
|
|
500
|
+
});
|
|
384
501
|
var Tree = Object.assign(wrapAntComponent(AntTree, "Tree"), {
|
|
385
502
|
DirectoryTree: wrapAntComponent(AntTree.DirectoryTree, "Tree.DirectoryTree"),
|
|
386
503
|
TreeNode: wrapAntComponent(AntTree.TreeNode, "Tree.TreeNode")
|
|
@@ -605,7 +722,7 @@ var BusinessDrawer = forwardRef3(function BusinessDrawer2({ sizeVariant = "stand
|
|
|
605
722
|
});
|
|
606
723
|
|
|
607
724
|
// src/composites/SessionReplay.tsx
|
|
608
|
-
import { forwardRef as forwardRef4, useCallback as useCallback2, useEffect as useEffect3, useImperativeHandle, useRef as useRef3, useState as
|
|
725
|
+
import { forwardRef as forwardRef4, useCallback as useCallback2, useEffect as useEffect3, useImperativeHandle, useRef as useRef3, useState as useState4 } from "react";
|
|
609
726
|
import { FullscreenExitOutlined, FullscreenOutlined, PauseOutlined, PlayCircleOutlined, RedoOutlined, StepBackwardOutlined, StepForwardOutlined } from "@ant-design/icons";
|
|
610
727
|
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
728
|
|
|
@@ -756,7 +873,7 @@ function replayClock(timeMs) {
|
|
|
756
873
|
}
|
|
757
874
|
|
|
758
875
|
// src/composites/useSessionReplay.ts
|
|
759
|
-
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as
|
|
876
|
+
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
760
877
|
|
|
761
878
|
// src/composites/sessionReplayEngine.ts
|
|
762
879
|
async function loadReplayEngine() {
|
|
@@ -780,7 +897,7 @@ function initialState(status) {
|
|
|
780
897
|
};
|
|
781
898
|
}
|
|
782
899
|
function useSessionReplay(options) {
|
|
783
|
-
const [state, setState] =
|
|
900
|
+
const [state, setState] = useState3(() => initialState("idle"));
|
|
784
901
|
const stateRef = useRef2(state);
|
|
785
902
|
const engineRef = useRef2(null);
|
|
786
903
|
const runtimeFailureRef = useRef2(null);
|
|
@@ -1078,8 +1195,8 @@ var SessionReplay = forwardRef4(function SessionReplay2({ events, active = true,
|
|
|
1078
1195
|
const containerRef = useRef3(null);
|
|
1079
1196
|
const stageRef = useRef3(null);
|
|
1080
1197
|
const rootRef = useRef3(null);
|
|
1081
|
-
const [problem, setProblem] =
|
|
1082
|
-
const [fullscreen, setFullscreen] =
|
|
1198
|
+
const [problem, setProblem] = useState4(null);
|
|
1199
|
+
const [fullscreen, setFullscreen] = useState4(false);
|
|
1083
1200
|
const reportError = useCallback2((value) => {
|
|
1084
1201
|
setProblem(value);
|
|
1085
1202
|
onError?.(value);
|
|
@@ -1213,19 +1330,19 @@ var SessionReplay = forwardRef4(function SessionReplay2({ events, active = true,
|
|
|
1213
1330
|
// src/composites/SearchPanel.tsx
|
|
1214
1331
|
import { DownOutlined, UpOutlined } from "@ant-design/icons";
|
|
1215
1332
|
import {
|
|
1216
|
-
Children,
|
|
1333
|
+
Children as Children2,
|
|
1217
1334
|
forwardRef as forwardRef5,
|
|
1218
|
-
isValidElement,
|
|
1335
|
+
isValidElement as isValidElement2,
|
|
1219
1336
|
useEffect as useEffect4,
|
|
1220
1337
|
useRef as useRef5,
|
|
1221
|
-
useState as
|
|
1338
|
+
useState as useState6
|
|
1222
1339
|
} from "react";
|
|
1223
1340
|
|
|
1224
1341
|
// src/composites/OperationToolbar.tsx
|
|
1225
1342
|
import { createContext, useContext } from "react";
|
|
1226
1343
|
|
|
1227
1344
|
// src/composites/ErrorReportButton.tsx
|
|
1228
|
-
import { useRef as useRef4, useState as
|
|
1345
|
+
import { useRef as useRef4, useState as useState5 } from "react";
|
|
1229
1346
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1230
1347
|
function ErrorReportButton({
|
|
1231
1348
|
onReport,
|
|
@@ -1234,7 +1351,7 @@ function ErrorReportButton({
|
|
|
1234
1351
|
description
|
|
1235
1352
|
}) {
|
|
1236
1353
|
const pending = useRef4(false);
|
|
1237
|
-
const [reporting, setReporting] =
|
|
1354
|
+
const [reporting, setReporting] = useState5(false);
|
|
1238
1355
|
async function report() {
|
|
1239
1356
|
if (disabled || pending.current) return;
|
|
1240
1357
|
pending.current = true;
|
|
@@ -1292,9 +1409,9 @@ function collapsedSearchFieldLimit(columns) {
|
|
|
1292
1409
|
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1293
1410
|
var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, trailingTools, searchVisible = true, defaultExpanded = false, role = "search", style, ...props }, ref) {
|
|
1294
1411
|
const rootRef = useRef5(null);
|
|
1295
|
-
const [width, setWidth] =
|
|
1296
|
-
const [expanded, setExpanded] =
|
|
1297
|
-
const items =
|
|
1412
|
+
const [width, setWidth] = useState6(0);
|
|
1413
|
+
const [expanded, setExpanded] = useState6(defaultExpanded);
|
|
1414
|
+
const items = Children2.toArray(fields);
|
|
1298
1415
|
const columns = searchColumnCount(width);
|
|
1299
1416
|
const collapsedLimit = collapsedSearchFieldLimit(columns);
|
|
1300
1417
|
const hasMore = items.length > collapsedLimit;
|
|
@@ -1339,7 +1456,7 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1339
1456
|
style: { minWidth: 0, width: fieldWidth || "min(240px, 100%)", flex: "0 0 auto" },
|
|
1340
1457
|
children: item
|
|
1341
1458
|
},
|
|
1342
|
-
|
|
1459
|
+
isValidElement2(item) ? item.key ?? index : index
|
|
1343
1460
|
)),
|
|
1344
1461
|
/* @__PURE__ */ jsxs3("div", { "data-adminsmart-search-actions": "true", style: { display: "flex", alignItems: "center", gap: 8, minHeight: 32 }, children: [
|
|
1345
1462
|
hasMore ? /* @__PURE__ */ jsx7(
|
|
@@ -1361,7 +1478,7 @@ var SearchPanel = forwardRef5(function SearchPanel2({ fields, actions, tools, tr
|
|
|
1361
1478
|
|
|
1362
1479
|
// src/composites/TableControls.tsx
|
|
1363
1480
|
import { ReloadOutlined, SearchOutlined, SettingOutlined } from "@ant-design/icons";
|
|
1364
|
-
import { useId, useRef as useRef6, useState as
|
|
1481
|
+
import { useId, useRef as useRef6, useState as useState7 } from "react";
|
|
1365
1482
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1366
1483
|
function TableControls({
|
|
1367
1484
|
searchVisible = true,
|
|
@@ -1374,7 +1491,7 @@ function TableControls({
|
|
|
1374
1491
|
className,
|
|
1375
1492
|
style
|
|
1376
1493
|
}) {
|
|
1377
|
-
const [open, setOpen] =
|
|
1494
|
+
const [open, setOpen] = useState7(false);
|
|
1378
1495
|
const triggerRef = useRef6(null);
|
|
1379
1496
|
const panelRef = useRef6(null);
|
|
1380
1497
|
const panelId = useId();
|
|
@@ -1485,7 +1602,7 @@ import {
|
|
|
1485
1602
|
useContext as useContext2,
|
|
1486
1603
|
useLayoutEffect,
|
|
1487
1604
|
useRef as useRef7,
|
|
1488
|
-
useState as
|
|
1605
|
+
useState as useState8
|
|
1489
1606
|
} from "react";
|
|
1490
1607
|
|
|
1491
1608
|
// src/composites/CrudWorkspace.tsx
|
|
@@ -1527,7 +1644,7 @@ function DataTableInner({
|
|
|
1527
1644
|
...tableProps
|
|
1528
1645
|
}, ref) {
|
|
1529
1646
|
const containerRef = useRef7(null);
|
|
1530
|
-
const [bodyHeight, setBodyHeight] =
|
|
1647
|
+
const [bodyHeight, setBodyHeight] = useState8(360);
|
|
1531
1648
|
const inWorkspace = useContext2(CrudTableHeightContext);
|
|
1532
1649
|
const tableHeight = containerHeight ?? (inWorkspace && containerStyle?.height == null ? "100%" : void 0);
|
|
1533
1650
|
const hasExplicitHeight = tableHeight != null || containerStyle?.height != null;
|
|
@@ -1703,12 +1820,12 @@ function EllipsisText({
|
|
|
1703
1820
|
|
|
1704
1821
|
// src/composites/RowActions.tsx
|
|
1705
1822
|
import { EllipsisOutlined } from "@ant-design/icons";
|
|
1706
|
-
import { Children as
|
|
1823
|
+
import { Children as Children3, Fragment, isValidElement as isValidElement3 } from "react";
|
|
1707
1824
|
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1708
1825
|
function collectButtons(children) {
|
|
1709
1826
|
const actions = [];
|
|
1710
|
-
|
|
1711
|
-
if (!
|
|
1827
|
+
Children3.forEach(children, (child) => {
|
|
1828
|
+
if (!isValidElement3(child)) return;
|
|
1712
1829
|
if (child.type === Fragment) actions.push(...collectButtons(child.props.children));
|
|
1713
1830
|
else {
|
|
1714
1831
|
if (child.type !== Button && child.type !== "button") throw new TypeError("RowActions \u53EA\u63A5\u53D7\u5DF2\u6309\u6743\u9650\u7B5B\u9009\u7684 Button \u6216 Fragment");
|