gzkx-package 0.1.48 → 0.1.49
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 +47 -2
- package/dist/components/customComponents/CustomTable.d.ts +7 -1
- package/dist/components/customComponents/commonPage/index.d.ts +4 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +30 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,6 +155,9 @@ import type {
|
|
|
155
155
|
AddItemConfig, // 新增/编辑表单配置类型
|
|
156
156
|
ValidateConfig, // 验证配置类型
|
|
157
157
|
CommonPageHandle, // CommonPage Ref 类型
|
|
158
|
+
CustomTableHandle, // CustomTable Ref 类型
|
|
159
|
+
CustomColumnType, // 自定义表格列类型
|
|
160
|
+
CustomColumnsType, // 自定义表格列数组类型
|
|
158
161
|
} from 'gzkx-package';
|
|
159
162
|
```
|
|
160
163
|
|
|
@@ -252,6 +255,10 @@ interface CommonPageHandle {
|
|
|
252
255
|
reload: () => void; // 重新加载列表
|
|
253
256
|
getSearchFieldsValue: () => any; // 获取搜索表单值
|
|
254
257
|
setSearchFieldsValue: (values: any) => void; // 设置搜索表单值
|
|
258
|
+
/** 打开表格配置弹窗 */
|
|
259
|
+
openSettingModal: () => void; // 打开表格配置弹窗
|
|
260
|
+
/** 关闭表格配置弹窗 */
|
|
261
|
+
closeSettingModal: () => void; // 关闭表格配置弹窗
|
|
255
262
|
}
|
|
256
263
|
```
|
|
257
264
|
|
|
@@ -428,7 +435,45 @@ export default DemoPage;
|
|
|
428
435
|
3. **树形数据支持**:支持展开/收起树形数据。
|
|
429
436
|
4. **Tooltip 支持**:单元格内容过长时自动显示 Tooltip。
|
|
430
437
|
|
|
431
|
-
### 2.4
|
|
438
|
+
### 2.4 Ref 暴露的方法
|
|
439
|
+
|
|
440
|
+
使用 `ref` 可以调用组件内部方法:
|
|
441
|
+
|
|
442
|
+
```typescript
|
|
443
|
+
interface CustomTableHandle {
|
|
444
|
+
openSettingModal: () => void; // 打开表格配置弹窗
|
|
445
|
+
closeSettingModal: () => void; // 关闭表格配置弹窗
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
**使用示例:**
|
|
450
|
+
|
|
451
|
+
```tsx
|
|
452
|
+
import { useRef } from 'react';
|
|
453
|
+
import CustomTable, { CustomTableHandle } from '@/components/customComponents/CustomTable';
|
|
454
|
+
|
|
455
|
+
const Demo = () => {
|
|
456
|
+
const tableRef = useRef<CustomTableHandle>(null);
|
|
457
|
+
|
|
458
|
+
const handleOpenConfig = () => {
|
|
459
|
+
tableRef.current?.openSettingModal();
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
return (
|
|
463
|
+
<>
|
|
464
|
+
<Button onClick={handleOpenConfig}>打开表格配置</Button>
|
|
465
|
+
<CustomTable
|
|
466
|
+
ref={tableRef}
|
|
467
|
+
columns={columns}
|
|
468
|
+
dataSource={dataSource}
|
|
469
|
+
tableId="my-table"
|
|
470
|
+
/>
|
|
471
|
+
</>
|
|
472
|
+
);
|
|
473
|
+
};
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### 2.5 使用示例
|
|
432
477
|
|
|
433
478
|
```tsx
|
|
434
479
|
import CustomTable from '@/components/customComponents/CustomTable';
|
|
@@ -483,7 +528,7 @@ const DemoTable = () => {
|
|
|
483
528
|
};
|
|
484
529
|
```
|
|
485
530
|
|
|
486
|
-
### 2.
|
|
531
|
+
### 2.6 列配置弹窗说明
|
|
487
532
|
|
|
488
533
|
当 `showTableConfig={true}` 时,序号列旁边会显示设置图标,点击后打开配置弹窗,可以配置:
|
|
489
534
|
|
|
@@ -11,6 +11,12 @@ interface CustomColumnType<T = any> extends ColumnType<T> {
|
|
|
11
11
|
contentAlignment?: 'left' | 'center' | 'right';
|
|
12
12
|
}
|
|
13
13
|
type CustomColumnsType<T = any> = CustomColumnType<T>[];
|
|
14
|
+
export interface CustomTableHandle {
|
|
15
|
+
/** 打开表格配置弹窗 */
|
|
16
|
+
openSettingModal: () => void;
|
|
17
|
+
/** 关闭表格配置弹窗 */
|
|
18
|
+
closeSettingModal: () => void;
|
|
19
|
+
}
|
|
14
20
|
interface CustomTableProps {
|
|
15
21
|
columns: CustomColumnsType;
|
|
16
22
|
dataSource: any[];
|
|
@@ -24,6 +30,6 @@ interface CustomTableProps {
|
|
|
24
30
|
showTableConfig?: boolean;
|
|
25
31
|
[key: string]: any;
|
|
26
32
|
}
|
|
27
|
-
declare const CustomTable: React.
|
|
33
|
+
declare const CustomTable: React.ForwardRefExoticComponent<Omit<CustomTableProps, "ref"> & React.RefAttributes<CustomTableHandle>>;
|
|
28
34
|
export default CustomTable;
|
|
29
35
|
export type { CustomColumnType, CustomColumnsType };
|
|
@@ -9,6 +9,10 @@ export interface CommonPageHandle {
|
|
|
9
9
|
reload: () => void;
|
|
10
10
|
getSearchFieldsValue: () => any;
|
|
11
11
|
setSearchFieldsValue: (values: any) => void;
|
|
12
|
+
/** 打开表格配置弹窗 */
|
|
13
|
+
openSettingModal: () => void;
|
|
14
|
+
/** 关闭表格配置弹窗 */
|
|
15
|
+
closeSettingModal: () => void;
|
|
12
16
|
}
|
|
13
17
|
interface CommonPageProps {
|
|
14
18
|
onSearchFormChange?: (name: string, value: any) => void;
|