xmirror-components 1.0.30-alpha.7 → 1.0.30

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.
Files changed (76) hide show
  1. package/README.md +1158 -10
  2. package/build/dist/index.cjs +65 -34
  3. package/build/dist/index.mjs +4342 -2757
  4. package/build/es/components/ConfigProvider/index.js +11 -14
  5. package/build/es/components/ConfigProvider/types.d.ts +2 -0
  6. package/build/es/components/IntlProvider/FormattedMessage/index.d.ts +7 -0
  7. package/build/es/components/IntlProvider/FormattedMessage/index.js +8 -0
  8. package/build/es/components/IntlProvider/index.d.ts +12 -0
  9. package/build/es/components/IntlProvider/index.js +17 -0
  10. package/build/es/components/IntlProvider/types.d.ts +7 -0
  11. package/build/es/components/IntlProvider/types.js +1 -0
  12. package/build/es/components/IntlProvider/useIntl/index.d.ts +14 -0
  13. package/build/es/components/IntlProvider/useIntl/index.js +26 -0
  14. package/build/es/components/SearchArea/ToggleButton/index.js +2 -1
  15. package/build/es/components/SearchArea/index.js +6 -3
  16. package/build/es/components/Table/Footer/index.d.ts +1 -1
  17. package/build/es/components/Table/Footer/index.js +1 -1
  18. package/build/es/components/Table/PopoverSetColumns/index.js +1 -1
  19. package/build/es/components/Table/ResizableColumns/index.d.ts +9 -0
  20. package/build/es/components/Table/ResizableColumns/index.js +76 -0
  21. package/build/es/components/Table/ResizableColumns/styles.d.ts +8 -0
  22. package/build/es/components/Table/ResizableColumns/styles.js +11 -0
  23. package/build/es/components/Table/index.js +3 -2
  24. package/build/es/components/Table/types.d.ts +4 -0
  25. package/build/es/components/Table/utils.d.ts +6 -0
  26. package/build/es/components/Table/utils.js +13 -0
  27. package/build/es/hooks/useTable/index.js +20 -14
  28. package/build/es/hooks/useTable/types.d.ts +8 -29
  29. package/build/es/locale/en-us.d.ts +25 -0
  30. package/build/es/locale/en-us.js +27 -0
  31. package/build/es/locale/index.d.ts +3 -0
  32. package/build/es/locale/index.js +7 -0
  33. package/build/es/locale/types.d.ts +9 -0
  34. package/build/es/locale/types.js +1 -0
  35. package/build/es/locale/zh-cn.d.ts +25 -0
  36. package/build/es/locale/zh-cn.js +28 -0
  37. package/build/lib/components/ConfigProvider/index.js +11 -14
  38. package/build/lib/components/IntlProvider/FormattedMessage/index.js +11 -0
  39. package/build/lib/components/IntlProvider/index.js +25 -0
  40. package/build/lib/components/IntlProvider/types.js +2 -0
  41. package/build/lib/components/IntlProvider/useIntl/index.js +31 -0
  42. package/build/lib/components/SearchArea/ToggleButton/index.js +2 -1
  43. package/build/lib/components/SearchArea/index.js +6 -3
  44. package/build/lib/components/Table/Footer/index.js +2 -2
  45. package/build/lib/components/Table/PopoverSetColumns/index.js +2 -2
  46. package/build/lib/components/Table/ResizableColumns/index.js +114 -0
  47. package/build/lib/components/Table/ResizableColumns/styles.js +17 -0
  48. package/build/lib/components/Table/index.js +3 -2
  49. package/build/lib/components/Table/utils.js +17 -0
  50. package/build/lib/hooks/useTable/index.js +21 -15
  51. package/build/lib/index.d.ts +8 -36
  52. package/build/lib/locale/en-us.d.ts +25 -0
  53. package/build/lib/locale/en-us.js +29 -0
  54. package/build/lib/locale/index.d.ts +3 -0
  55. package/build/lib/locale/index.js +13 -0
  56. package/build/lib/locale/types.d.ts +9 -0
  57. package/build/lib/locale/types.js +2 -0
  58. package/build/lib/locale/zh-cn.d.ts +25 -0
  59. package/build/lib/locale/zh-cn.js +30 -0
  60. package/build/package.json +7 -5
  61. package/build/types/components/ConfigProvider/types.d.ts +2 -0
  62. package/build/types/components/IntlProvider/FormattedMessage/index.d.ts +7 -0
  63. package/build/types/components/IntlProvider/index.d.ts +12 -0
  64. package/build/types/components/IntlProvider/types.d.ts +7 -0
  65. package/build/types/components/IntlProvider/useIntl/index.d.ts +14 -0
  66. package/build/types/components/Table/Footer/index.d.ts +1 -1
  67. package/build/types/components/Table/ResizableColumns/index.d.ts +9 -0
  68. package/build/types/components/Table/ResizableColumns/styles.d.ts +8 -0
  69. package/build/types/components/Table/types.d.ts +4 -0
  70. package/build/types/components/Table/utils.d.ts +6 -0
  71. package/build/types/hooks/useTable/types.d.ts +8 -29
  72. package/build/types/locale/en-us.d.ts +25 -0
  73. package/build/types/locale/index.d.ts +3 -0
  74. package/build/types/locale/types.d.ts +9 -0
  75. package/build/types/locale/zh-cn.d.ts +25 -0
  76. package/package.json +7 -5
@@ -0,0 +1,25 @@
1
+ declare const messages: {
2
+ 'operation.add': string;
3
+ 'operation.delete': string;
4
+ 'operation.batchDelete': string;
5
+ 'operation.edit': string;
6
+ 'operation.download': string;
7
+ 'operation.logout': string;
8
+ 'operation.export': string;
9
+ 'operation.close': string;
10
+ 'operation.details': string;
11
+ 'operation.confirm': string;
12
+ 'operation.save': string;
13
+ 'operation.cancel': string;
14
+ 'component.table.selected': string;
15
+ 'component.table.total': string;
16
+ 'component.table.visibleError': string;
17
+ 'component.searcharea.toggle': string;
18
+ 'component.searcharea.submit': string;
19
+ 'component.searcharea.reset': string;
20
+ 'component.searcharea.close': string;
21
+ 'message.delete': string;
22
+ 'message.success': string;
23
+ 'table.pagination.total': string;
24
+ };
25
+ export default messages;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var messages = {
4
+ 'operation.add': 'Add',
5
+ 'operation.delete': 'Delete',
6
+ 'operation.batchDelete': 'Batch Delete',
7
+ 'operation.edit': 'Edit',
8
+ 'operation.download': 'Download',
9
+ 'operation.logout': 'Logout',
10
+ 'operation.export': 'Export',
11
+ 'operation.close': 'Close',
12
+ 'operation.details': 'Details',
13
+ 'operation.confirm': 'Confirm',
14
+ 'operation.save': 'Save',
15
+ 'operation.cancel': 'Cancel',
16
+ // Components
17
+ 'component.table.selected': '{length} selected',
18
+ 'component.table.total': 'Total {total} items',
19
+ 'component.table.visibleError': 'At least one field must be visible',
20
+ 'component.searcharea.toggle': 'Advanced Search',
21
+ 'component.searcharea.submit': 'Submit',
22
+ 'component.searcharea.reset': 'Reset',
23
+ 'component.searcharea.close': 'Close',
24
+ // Messages
25
+ 'message.delete': 'This action cannot be undone, confirm delete?',
26
+ 'message.success': 'Operation successful',
27
+ 'table.pagination.total': 'Total {total} items',
28
+ };
29
+ exports.default = messages;
@@ -0,0 +1,3 @@
1
+ import { type Messages, type MessagesKeys } from './types';
2
+ declare const messages: Messages;
3
+ export { messages, type MessagesKeys };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.messages = void 0;
7
+ var zh_cn_1 = __importDefault(require("./zh-cn"));
8
+ var en_us_1 = __importDefault(require("./en-us"));
9
+ var messages = {
10
+ zh: zh_cn_1.default,
11
+ en: en_us_1.default
12
+ };
13
+ exports.messages = messages;
@@ -0,0 +1,9 @@
1
+ import type zhCN from './zh-cn';
2
+ type MessageIds = {
3
+ [K in keyof typeof zhCN]: string;
4
+ };
5
+ export type MessagesKeys = 'zh' | 'en';
6
+ export type Messages = {
7
+ [K in MessagesKeys]: MessageIds;
8
+ };
9
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ declare const messages: {
2
+ 'operation.add': string;
3
+ 'operation.delete': string;
4
+ 'operation.batchDelete': string;
5
+ 'operation.edit': string;
6
+ 'operation.download': string;
7
+ 'operation.logout': string;
8
+ 'operation.export': string;
9
+ 'operation.close': string;
10
+ 'operation.details': string;
11
+ 'operation.confirm': string;
12
+ 'operation.save': string;
13
+ 'operation.cancel': string;
14
+ 'component.table.selected': string;
15
+ 'component.table.total': string;
16
+ 'component.table.visibleError': string;
17
+ 'component.searcharea.toggle': string;
18
+ 'component.searcharea.submit': string;
19
+ 'component.searcharea.reset': string;
20
+ 'component.searcharea.close': string;
21
+ 'message.delete': string;
22
+ 'message.success': string;
23
+ 'table.pagination.total': string;
24
+ };
25
+ export default messages;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var messages = {
4
+ // 操作类
5
+ 'operation.add': '添加',
6
+ 'operation.delete': '删除',
7
+ 'operation.batchDelete': '批量删除',
8
+ 'operation.edit': '编辑',
9
+ 'operation.download': '下载',
10
+ 'operation.logout': '退出登录',
11
+ 'operation.export': '导出',
12
+ 'operation.close': '关闭',
13
+ 'operation.details': '详情',
14
+ 'operation.confirm': '确认',
15
+ 'operation.save': '保存',
16
+ 'operation.cancel': '取消',
17
+ // 组件
18
+ 'component.table.selected': '已选{length}条',
19
+ 'component.table.total': '共{total}条',
20
+ 'component.table.visibleError': '列表最少保留一个字段',
21
+ 'component.searcharea.toggle': '高级搜索',
22
+ 'component.searcharea.submit': '筛选',
23
+ 'component.searcharea.reset': '重置',
24
+ 'component.searcharea.close': '收起',
25
+ // 提示类
26
+ 'message.delete': '删除操作无法恢复,确认删除?',
27
+ 'message.success': '操作成功',
28
+ 'table.pagination.total': '共{total}条',
29
+ };
30
+ exports.default = messages;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.30-alpha.7",
3
+ "version": "1.0.30",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",
@@ -23,18 +23,20 @@
23
23
  "publish:dev": "npm publish --access public --tag dev"
24
24
  },
25
25
  "peerDependencies": {
26
- "antd": ">=5.0.0",
27
- "react": ">=18.0.0",
28
- "react-dom": ">=18.0.0",
29
26
  "@ant-design/icons": ">=5.0.0",
30
27
  "ahooks": ">=3.0.0",
28
+ "antd": ">=5.0.0",
31
29
  "lodash-es": ">=4.17.0",
30
+ "react": ">=18.0.0",
31
+ "react-dom": ">=18.0.0",
32
32
  "react-intl": ">=7.0.0",
33
33
  "react-transition-group": ">=4.4.0"
34
34
  },
35
35
  "dependencies": {
36
36
  "@emotion/react": "^11.14.0",
37
- "@emotion/styled": "^11.14.1"
37
+ "@emotion/styled": "^11.14.1",
38
+ "@types/react-resizable": "^3.0.8",
39
+ "react-resizable": "^3.0.5"
38
40
  },
39
41
  "devDependencies": {
40
42
  "@types/lodash-es": "^4.17.12",
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { IconButtonProps } from "../IconButton";
3
3
  import { IconFontProps } from "../IconFont";
4
+ import { type MessagesKeys } from "../../locale";
4
5
  type IconButtonConfig = Pick<IconButtonProps, 'size' | 'className' | 'style'> & {
5
6
  render: (props: IconButtonProps & {
6
7
  children: React.ReactNode;
@@ -10,6 +11,7 @@ type IconFontConfig = Pick<IconFontProps, 'className' | 'style'>;
10
11
  export interface ConfigContextProps {
11
12
  iconButton: IconButtonConfig;
12
13
  iconFont: IconFontConfig;
14
+ locale: MessagesKeys;
13
15
  }
14
16
  export type ConfigProviderConfigProps = Partial<ConfigContextProps>;
15
17
  export {};
@@ -0,0 +1,7 @@
1
+ interface FormattedMessageProps {
2
+ id: string;
3
+ defaultMessage?: string;
4
+ values?: Record<string, any>;
5
+ }
6
+ export default function FormattedMessage({ id, defaultMessage, values }: FormattedMessageProps): any;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { IntlContextProps, IntlProviderConfigProps } from './types';
3
+ export type { IntlProviderConfigProps, IntlContextProps } from './types';
4
+ import FormattedMessage from './FormattedMessage';
5
+ import useIntl from './useIntl';
6
+ export declare const IntlContext: React.Context<IntlContextProps>;
7
+ interface IntlProviderProps {
8
+ children: React.ReactNode;
9
+ config: IntlProviderConfigProps;
10
+ }
11
+ export default function IntlProvider({ children, config }: IntlProviderProps): React.JSX.Element;
12
+ export { FormattedMessage, useIntl };
@@ -0,0 +1,7 @@
1
+ import { type MessagesKeys } from "../../locale";
2
+ import { Messages } from "../../locale/types";
3
+ export interface IntlContextProps {
4
+ locale: MessagesKeys;
5
+ messages: Messages;
6
+ }
7
+ export type IntlProviderConfigProps = Partial<IntlContextProps>;
@@ -0,0 +1,14 @@
1
+ interface FormattedMessageProps {
2
+ id: string;
3
+ defaultMessage?: string;
4
+ values?: Record<string, any>;
5
+ }
6
+ export declare const formatMessageFn: ({ messages, locale }: {
7
+ messages: any;
8
+ locale: string;
9
+ }) => ({ id, defaultMessage, values }: FormattedMessageProps) => any;
10
+ export default function useIntl(): {
11
+ $t: ({ id, defaultMessage }: FormattedMessageProps, values?: Record<string, any>) => any;
12
+ formatMessage: ({ id, defaultMessage, values }: FormattedMessageProps) => any;
13
+ };
14
+ export {};
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type { TableComponentProps } from '../types.ts';
2
+ import type { TableComponentProps } from '../types';
3
3
  declare function Index(props: TableComponentProps): React.JSX.Element;
4
4
  export default Index;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ResizeCallbackData } from 'react-resizable';
3
+ interface TitlePropsType {
4
+ width: number;
5
+ onResize: (e: React.SyntheticEvent<Element>, data: ResizeCallbackData) => void;
6
+ }
7
+ export declare const ResizableTitle: React.FC<Readonly<React.HTMLAttributes<any> & TitlePropsType>>;
8
+ export declare const resizableColumns: (columns: any[], tableId: string) => any[];
9
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 可调整大小的列拖拽手柄样式组件
3
+ * 用于表格列宽调整功能
4
+ */
5
+ export declare const ResizableHandle: import("@emotion/styled").StyledComponent<{
6
+ theme?: import("@emotion/react").Theme;
7
+ as?: React.ElementType;
8
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -60,4 +60,8 @@ export interface TableComponentProps<RecordType = AnyObject> extends Omit<TableP
60
60
  * 中间的批量操作弹出层
61
61
  */
62
62
  selectionPopover?: React.ReactNode;
63
+ /**
64
+ * 是否开启列宽调整功能
65
+ */
66
+ columnsResizable?: boolean;
63
67
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 将 dataIndex 转换为字符串
3
+ * @param dataIndex - 数据索引,可能是字符串或数组
4
+ * @returns 转换后的字符串
5
+ */
6
+ export declare const dataIndexToString: (dataIndex: string | string[] | undefined) => string;
@@ -1,4 +1,4 @@
1
- import type { RowSelectMethod } from 'antd/es/table/interface';
1
+ import type { TableComponentProps } from '../../components/Table/types';
2
2
  export type BaseRecord = Record<string, unknown>;
3
3
  /**
4
4
  * json 格式响应
@@ -23,16 +23,14 @@ export interface RequestParams {
23
23
  [key: string]: unknown;
24
24
  }
25
25
  export interface TableChangeParams {
26
- current: number;
27
- pageSize: number;
26
+ current?: number;
27
+ pageSize?: number;
28
28
  }
29
- export type FilterParams = Record<string, string[] | string | null>;
29
+ export type FilterParams = Record<string, any>;
30
30
  export interface SortParams {
31
- field: string;
32
- order: 'ascend' | 'descend' | null;
33
- column?: {
34
- sort?: string;
35
- };
31
+ field?: any;
32
+ order?: 'ascend' | 'descend' | null;
33
+ column?: any;
36
34
  }
37
35
  export interface OptionsProps<T = BaseRecord> {
38
36
  /**
@@ -81,26 +79,7 @@ export interface ReturnData<T = BaseRecord> {
81
79
  /**
82
80
  * 列表 props,拓展到 table 上
83
81
  */
84
- tableProps: {
85
- rowKey: string;
86
- loading: boolean;
87
- dataSource: T[];
88
- rowSelection?: {
89
- selectedRowKeys: Array<string | number>;
90
- onChange?: (selectedRowKeys: Array<string | number>, selectedRows: T[], info: {
91
- type: RowSelectMethod;
92
- }) => void;
93
- };
94
- onChange: (pagination: TableChangeParams, filter: FilterParams, order: SortParams) => void;
95
- pagination: {
96
- showQuickJumper: boolean;
97
- showSizeChanger: boolean;
98
- showTotal: (total: number) => string;
99
- total: number;
100
- current: number;
101
- pageSize: number;
102
- };
103
- };
82
+ tableProps: TableComponentProps;
104
83
  /**
105
84
  * 列表搜索
106
85
  */
@@ -0,0 +1,25 @@
1
+ declare const messages: {
2
+ 'operation.add': string;
3
+ 'operation.delete': string;
4
+ 'operation.batchDelete': string;
5
+ 'operation.edit': string;
6
+ 'operation.download': string;
7
+ 'operation.logout': string;
8
+ 'operation.export': string;
9
+ 'operation.close': string;
10
+ 'operation.details': string;
11
+ 'operation.confirm': string;
12
+ 'operation.save': string;
13
+ 'operation.cancel': string;
14
+ 'component.table.selected': string;
15
+ 'component.table.total': string;
16
+ 'component.table.visibleError': string;
17
+ 'component.searcharea.toggle': string;
18
+ 'component.searcharea.submit': string;
19
+ 'component.searcharea.reset': string;
20
+ 'component.searcharea.close': string;
21
+ 'message.delete': string;
22
+ 'message.success': string;
23
+ 'table.pagination.total': string;
24
+ };
25
+ export default messages;
@@ -0,0 +1,3 @@
1
+ import { type Messages, type MessagesKeys } from './types';
2
+ declare const messages: Messages;
3
+ export { messages, type MessagesKeys };
@@ -0,0 +1,9 @@
1
+ import type zhCN from './zh-cn';
2
+ type MessageIds = {
3
+ [K in keyof typeof zhCN]: string;
4
+ };
5
+ export type MessagesKeys = 'zh' | 'en';
6
+ export type Messages = {
7
+ [K in MessagesKeys]: MessageIds;
8
+ };
9
+ export {};
@@ -0,0 +1,25 @@
1
+ declare const messages: {
2
+ 'operation.add': string;
3
+ 'operation.delete': string;
4
+ 'operation.batchDelete': string;
5
+ 'operation.edit': string;
6
+ 'operation.download': string;
7
+ 'operation.logout': string;
8
+ 'operation.export': string;
9
+ 'operation.close': string;
10
+ 'operation.details': string;
11
+ 'operation.confirm': string;
12
+ 'operation.save': string;
13
+ 'operation.cancel': string;
14
+ 'component.table.selected': string;
15
+ 'component.table.total': string;
16
+ 'component.table.visibleError': string;
17
+ 'component.searcharea.toggle': string;
18
+ 'component.searcharea.submit': string;
19
+ 'component.searcharea.reset': string;
20
+ 'component.searcharea.close': string;
21
+ 'message.delete': string;
22
+ 'message.success': string;
23
+ 'table.pagination.total': string;
24
+ };
25
+ export default messages;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.30-alpha.7",
3
+ "version": "1.0.30",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",
@@ -23,18 +23,20 @@
23
23
  "publish:dev": "npm publish --access public --tag dev"
24
24
  },
25
25
  "peerDependencies": {
26
- "antd": ">=5.0.0",
27
- "react": ">=18.0.0",
28
- "react-dom": ">=18.0.0",
29
26
  "@ant-design/icons": ">=5.0.0",
30
27
  "ahooks": ">=3.0.0",
28
+ "antd": ">=5.0.0",
31
29
  "lodash-es": ">=4.17.0",
30
+ "react": ">=18.0.0",
31
+ "react-dom": ">=18.0.0",
32
32
  "react-intl": ">=7.0.0",
33
33
  "react-transition-group": ">=4.4.0"
34
34
  },
35
35
  "dependencies": {
36
36
  "@emotion/react": "^11.14.0",
37
- "@emotion/styled": "^11.14.1"
37
+ "@emotion/styled": "^11.14.1",
38
+ "@types/react-resizable": "^3.0.8",
39
+ "react-resizable": "^3.0.5"
38
40
  },
39
41
  "devDependencies": {
40
42
  "@types/lodash-es": "^4.17.12",