@vef-framework/starter 2.0.10 → 2.0.11
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/dist/cjs/components/approval-flow-editor/assets/icons.cjs +19 -0
- package/dist/cjs/components/approval-flow-editor/components/base-node/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/components/base-node/styles.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/components/node-form-panel/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/components/node-panel/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/hooks/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/hooks/use-editor-props.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/approval/form-meta.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/approval/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/comment/form-meta.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/comment/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/condition/form-meta.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/condition/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/end/form-meta.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/end/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/handle/form-meta.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/handle/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/start/form-meta.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/start/index.cjs +1 -0
- package/dist/cjs/components/approval-flow-editor/nodes/types.cjs +1 -0
- package/dist/cjs/components/crud/components/main.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/page/index.cjs +1 -1
- package/dist/cjs/components/pro-table/components/column-setting-item.cjs +1 -0
- package/dist/cjs/components/pro-table/components/column-settings-panel.cjs +1 -0
- package/dist/cjs/components/pro-table/components/column-settings.cjs +1 -0
- package/dist/cjs/components/pro-table/components/index.cjs +1 -1
- package/dist/cjs/components/pro-table/components/table.cjs +1 -1
- package/dist/cjs/components/pro-table/components/width-popover.cjs +1 -0
- package/dist/cjs/components/pro-table/context.cjs +1 -1
- package/dist/cjs/components/pro-table/hooks/index.cjs +1 -1
- package/dist/cjs/components/pro-table/hooks/use-column-settings-persistence.cjs +1 -0
- package/dist/cjs/components/pro-table/hooks/use-table-columns.cjs +1 -1
- package/dist/cjs/components/pro-table/index.cjs +1 -1
- package/dist/cjs/components/pro-table/store.cjs +1 -1
- package/dist/cjs/helpers/app.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/es/components/approval-flow-editor/assets/icons.js +35 -0
- package/dist/es/components/approval-flow-editor/components/base-node/index.js +111 -0
- package/dist/es/components/approval-flow-editor/components/base-node/styles.js +55 -0
- package/dist/es/components/approval-flow-editor/components/node-form-panel/index.js +68 -0
- package/dist/es/components/approval-flow-editor/components/node-panel/index.js +110 -0
- package/dist/es/components/approval-flow-editor/hooks/index.js +4 -0
- package/dist/es/components/approval-flow-editor/hooks/use-editor-props.js +104 -0
- package/dist/es/components/approval-flow-editor/index.js +88 -0
- package/dist/es/components/approval-flow-editor/nodes/approval/form-meta.js +139 -0
- package/dist/es/components/approval-flow-editor/nodes/approval/index.js +39 -0
- package/dist/es/components/approval-flow-editor/nodes/comment/form-meta.js +57 -0
- package/dist/es/components/approval-flow-editor/nodes/comment/index.js +36 -0
- package/dist/es/components/approval-flow-editor/nodes/condition/form-meta.js +107 -0
- package/dist/es/components/approval-flow-editor/nodes/condition/index.js +46 -0
- package/dist/es/components/approval-flow-editor/nodes/end/form-meta.js +91 -0
- package/dist/es/components/approval-flow-editor/nodes/end/index.js +29 -0
- package/dist/es/components/approval-flow-editor/nodes/handle/form-meta.js +130 -0
- package/dist/es/components/approval-flow-editor/nodes/handle/index.js +39 -0
- package/dist/es/components/approval-flow-editor/nodes/index.js +18 -0
- package/dist/es/components/approval-flow-editor/nodes/start/form-meta.js +90 -0
- package/dist/es/components/approval-flow-editor/nodes/start/index.js +30 -0
- package/dist/es/components/approval-flow-editor/nodes/types.js +11 -0
- package/dist/es/components/crud/components/main.js +34 -33
- package/dist/es/components/index.js +28 -26
- package/dist/es/components/page/index.js +30 -30
- package/dist/es/components/pro-table/components/column-setting-item.js +114 -0
- package/dist/es/components/pro-table/components/column-settings-panel.js +60 -0
- package/dist/es/components/pro-table/components/column-settings.js +15 -0
- package/dist/es/components/pro-table/components/index.js +17 -9
- package/dist/es/components/pro-table/components/table.js +57 -53
- package/dist/es/components/pro-table/components/width-popover.js +59 -0
- package/dist/es/components/pro-table/context.js +12 -6
- package/dist/es/components/pro-table/hooks/index.js +5 -2
- package/dist/es/components/pro-table/hooks/use-column-settings-persistence.js +64 -0
- package/dist/es/components/pro-table/hooks/use-table-columns.js +91 -31
- package/dist/es/components/pro-table/index.js +46 -33
- package/dist/es/components/pro-table/store.js +84 -17
- package/dist/es/helpers/app.js +1 -1
- package/dist/es/index.js +73 -71
- package/dist/types/components/approval-flow-editor/assets/icons.d.ts +7 -0
- package/dist/types/components/approval-flow-editor/components/base-node/index.d.ts +27 -0
- package/dist/types/components/approval-flow-editor/components/base-node/styles.d.ts +7 -0
- package/dist/types/components/approval-flow-editor/components/index.d.ts +3 -0
- package/dist/types/components/approval-flow-editor/components/node-form-panel/index.d.ts +9 -0
- package/dist/types/components/approval-flow-editor/components/node-panel/index.d.ts +10 -0
- package/dist/types/components/approval-flow-editor/constants/index.d.ts +1 -0
- package/dist/types/components/approval-flow-editor/constants/node.d.ts +6 -0
- package/dist/types/components/approval-flow-editor/hooks/index.d.ts +1 -0
- package/dist/types/components/approval-flow-editor/hooks/use-editor-props.d.ts +8 -0
- package/dist/types/components/approval-flow-editor/index.d.ts +5 -0
- package/dist/types/components/approval-flow-editor/nodes/approval/form-meta.d.ts +4 -0
- package/dist/types/components/approval-flow-editor/nodes/approval/index.d.ts +2 -0
- package/dist/types/components/approval-flow-editor/nodes/comment/form-meta.d.ts +4 -0
- package/dist/types/components/approval-flow-editor/nodes/comment/index.d.ts +2 -0
- package/dist/types/components/approval-flow-editor/nodes/condition/form-meta.d.ts +4 -0
- package/dist/types/components/approval-flow-editor/nodes/condition/index.d.ts +2 -0
- package/dist/types/components/approval-flow-editor/nodes/end/form-meta.d.ts +4 -0
- package/dist/types/components/approval-flow-editor/nodes/end/index.d.ts +2 -0
- package/dist/types/components/approval-flow-editor/nodes/handle/form-meta.d.ts +4 -0
- package/dist/types/components/approval-flow-editor/nodes/handle/index.d.ts +2 -0
- package/dist/types/components/approval-flow-editor/nodes/index.d.ts +9 -0
- package/dist/types/components/approval-flow-editor/nodes/start/form-meta.d.ts +4 -0
- package/dist/types/components/approval-flow-editor/nodes/start/index.d.ts +2 -0
- package/dist/types/components/approval-flow-editor/nodes/types.d.ts +49 -0
- package/dist/types/components/approval-flow-editor/props.d.ts +8 -0
- package/dist/types/components/crud/props.d.ts +12 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/pro-table/components/column-setting-item.d.ts +12 -0
- package/dist/types/components/pro-table/components/column-settings-panel.d.ts +2 -0
- package/dist/types/components/pro-table/components/column-settings.d.ts +6 -0
- package/dist/types/components/pro-table/components/index.d.ts +4 -0
- package/dist/types/components/pro-table/components/table.d.ts +9 -4
- package/dist/types/components/pro-table/components/width-popover.d.ts +9 -0
- package/dist/types/components/pro-table/context.d.ts +2 -0
- package/dist/types/components/pro-table/hooks/index.d.ts +1 -0
- package/dist/types/components/pro-table/hooks/use-column-settings-persistence.d.ts +7 -0
- package/dist/types/components/pro-table/hooks/use-table-columns.d.ts +3 -2
- package/dist/types/components/pro-table/index.d.ts +1 -1
- package/dist/types/components/pro-table/props.d.ts +10 -3
- package/dist/types/components/pro-table/store.d.ts +73 -3
- package/dist/types/components/pro-table/types.d.ts +17 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +20 -10
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FlowNodeEntity, WorkflowNodeJSON as FlowNodeJSONDefault, WorkflowNodeRegistry as FlowNodeRegistryDefault, FreeLayoutPluginContext, WorkflowEdgeJSON, WorkflowNodeMeta } from '@flowgram.ai/free-layout-editor';
|
|
2
|
+
export declare const ApprovalNodeType: {
|
|
3
|
+
readonly Start: "start";
|
|
4
|
+
readonly End: "end";
|
|
5
|
+
readonly Approval: "approval";
|
|
6
|
+
readonly Handle: "handle";
|
|
7
|
+
readonly Condition: "condition";
|
|
8
|
+
readonly Comment: "comment";
|
|
9
|
+
};
|
|
10
|
+
export type ApprovalNodeType = (typeof ApprovalNodeType)[keyof typeof ApprovalNodeType];
|
|
11
|
+
export interface ApprovalNodeData {
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
approvers?: string[];
|
|
15
|
+
approvalType?: "and" | "or";
|
|
16
|
+
handlers?: string[];
|
|
17
|
+
instruction?: string;
|
|
18
|
+
conditions?: ConditionItem[];
|
|
19
|
+
content?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface ConditionItem {
|
|
23
|
+
key: string;
|
|
24
|
+
label: string;
|
|
25
|
+
expression?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ApprovalNodeJSON extends FlowNodeJSONDefault {
|
|
28
|
+
data: ApprovalNodeData;
|
|
29
|
+
}
|
|
30
|
+
export interface ApprovalNodeMeta extends WorkflowNodeMeta {
|
|
31
|
+
sidebarDisabled?: boolean;
|
|
32
|
+
nodePanelHidden?: boolean;
|
|
33
|
+
wrapperStyle?: React.CSSProperties;
|
|
34
|
+
}
|
|
35
|
+
export interface ApprovalNodeRegistry extends FlowNodeRegistryDefault {
|
|
36
|
+
meta: ApprovalNodeMeta;
|
|
37
|
+
info?: {
|
|
38
|
+
icon: string;
|
|
39
|
+
label: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
canAdd?: (ctx: FreeLayoutPluginContext) => boolean;
|
|
43
|
+
canDelete?: (ctx: FreeLayoutPluginContext, from: FlowNodeEntity) => boolean;
|
|
44
|
+
onAdd?: (ctx: FreeLayoutPluginContext) => ApprovalNodeJSON;
|
|
45
|
+
}
|
|
46
|
+
export interface ApprovalFlowDocumentJSON {
|
|
47
|
+
nodes: ApprovalNodeJSON[];
|
|
48
|
+
edges: WorkflowEdgeJSON[];
|
|
49
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ApprovalFlowDocumentJSON } from './nodes/types';
|
|
2
|
+
export interface ApprovalFlowEditorProps {
|
|
3
|
+
initialData?: ApprovalFlowDocumentJSON;
|
|
4
|
+
readonly?: boolean;
|
|
5
|
+
onChange?: (data: ApprovalFlowDocumentJSON) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}
|
|
@@ -2,7 +2,7 @@ import { TableColumn } from '@vef-framework/components';
|
|
|
2
2
|
import { ApiResult, MutationFunction, MutationMeta, PaginationResult, QueryFunction } from '@vef-framework/core';
|
|
3
3
|
import { AnyObject, Awaitable, DeepKeys, EmptyObject, If, IsNever, Key, MaybeUndefined, PartialDeep } from '@vef-framework/shared';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
-
import { OperationColumnConfig, RowSelectionConfig } from '../pro-table';
|
|
5
|
+
import { ColumnSettingsProp, OperationColumnConfig, ProTableProps, RowSelectionConfig } from '../pro-table';
|
|
6
6
|
import { CrudFormMutationFns, CrudFormScene, PaginatedQueryParams, QueryParams } from './types';
|
|
7
7
|
/**
|
|
8
8
|
* Base props for the Crud component.
|
|
@@ -13,10 +13,21 @@ import { CrudFormMutationFns, CrudFormScene, PaginatedQueryParams, QueryParams }
|
|
|
13
13
|
* @template TParams - Additional query parameters type
|
|
14
14
|
*/
|
|
15
15
|
export interface BaseCrudProps<TRow extends AnyObject, TSearchValues extends AnyObject, TSceneFormValues extends AnyObject, TParams extends AnyObject> {
|
|
16
|
+
/**
|
|
17
|
+
* Table size
|
|
18
|
+
*/
|
|
19
|
+
tableSize?: ProTableProps<TRow, TParams>["size"];
|
|
16
20
|
/**
|
|
17
21
|
* Table column definitions
|
|
18
22
|
*/
|
|
19
23
|
tableColumns: Array<TableColumn<NoInfer<TRow>>>;
|
|
24
|
+
/**
|
|
25
|
+
* Column settings configuration.
|
|
26
|
+
* - `false`: Disable column settings feature
|
|
27
|
+
* - `{ storageKey?: string }`: Enable with optional localStorage persistence
|
|
28
|
+
* @default {}
|
|
29
|
+
*/
|
|
30
|
+
columnSettings?: ColumnSettingsProp;
|
|
20
31
|
/**
|
|
21
32
|
* Operation column configuration for per-row actions
|
|
22
33
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AccessDenied } from './access-denied';
|
|
2
2
|
export { App, type AppProps } from './app';
|
|
3
|
+
export { ApprovalFlowEditor } from './approval-flow-editor';
|
|
3
4
|
export { BaseLayout, type BaseLayoutProps } from './base-layout';
|
|
4
5
|
export { createCrudKit, Crud, type CrudActionButtonGroupProps, type CrudBasicFormScene, type CrudBasicSceneFormValues, type CrudFormMutationFns, type CrudFormScene, type CrudOperationButtonGroupProps, type CrudProps, type PaginatedQueryParams, type QueryParams } from './crud';
|
|
5
6
|
export { CrudPage, type CrudPageProps } from './crud-page';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Key } from '@vef-framework/shared';
|
|
2
|
+
import { ReactNode, NamedExoticComponent } from 'react';
|
|
3
|
+
interface ColumnSettingItemProps {
|
|
4
|
+
columnId: Key;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
fixed?: "start" | "end" | false;
|
|
7
|
+
width?: number;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const ColumnSettingItem: NamedExoticComponent<ColumnSettingItemProps>;
|
|
12
|
+
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export { ColumnSettingItem } from './column-setting-item';
|
|
2
|
+
export { ColumnSettings } from './column-settings';
|
|
3
|
+
export { ColumnSettingsPanel } from './column-settings-panel';
|
|
1
4
|
export { OperationButtonGroup, type OperationButtonGroupProps } from './operation-button-group';
|
|
2
5
|
export { ProTableRefHolder } from './ref';
|
|
3
6
|
export { NonPaginatedTable, PaginatedTable } from './table';
|
|
4
7
|
export { TableSubscriber, type TableSubscriberProps } from './table-subscriber';
|
|
8
|
+
export { WidthPopover } from './width-popover';
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { NonPaginatedProTableProps, PaginatedProTableProps } from '../props';
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { ColumnSettingsProp } from '../types';
|
|
3
|
+
type PaginatedTableProps<TRow extends object, TParams extends object> = Pick<PaginatedProTableProps<TRow, TParams>, "className" | "style" | "size" | "queryFn" | "queryEnabled" | "queryParams" | "columns" | "rowKey" | "rowSelection" | "showSequenceColumn" | "operationColumn" | "selectedRowKeys" | "virtual" | "title" | "summary" | "onSelectedRowKeysChange"> & {
|
|
4
|
+
columnSettings: ColumnSettingsProp;
|
|
5
|
+
};
|
|
6
|
+
type NonPaginatedTableProps<TRow extends object, TParams extends object> = Pick<NonPaginatedProTableProps<TRow, TParams>, "className" | "style" | "size" | "queryFn" | "queryEnabled" | "queryParams" | "columns" | "rowKey" | "rowSelection" | "showSequenceColumn" | "operationColumn" | "selectedRowKeys" | "virtual" | "title" | "summary" | "onSelectedRowKeysChange"> & {
|
|
7
|
+
columnSettings: ColumnSettingsProp;
|
|
8
|
+
};
|
|
9
|
+
export declare function PaginatedTable<TRow extends object, TParams extends object>({ className, style, size, queryFn, columns, columnSettings, rowKey, rowSelection, queryEnabled, queryParams, showSequenceColumn, operationColumn, selectedRowKeys, virtual, title, summary, onSelectedRowKeysChange }: PaginatedTableProps<TRow, TParams>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function NonPaginatedTable<TRow extends object, TParams extends object>({ className, style, size, queryFn, columns, columnSettings, rowKey, rowSelection, queryEnabled, queryParams, showSequenceColumn, operationColumn, selectedRowKeys, virtual, title, summary, onSelectedRowKeysChange }: NonPaginatedTableProps<TRow, TParams>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
11
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode, NamedExoticComponent } from 'react';
|
|
2
|
+
interface WidthPopoverProps {
|
|
3
|
+
currentWidth?: number;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
onWidthChange: (width: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const WidthPopover: NamedExoticComponent<WidthPopoverProps>;
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Provider } from 'react';
|
|
2
2
|
export declare const DataProvider: Provider<readonly unknown[]>;
|
|
3
3
|
export declare function useData(): readonly unknown[];
|
|
4
|
+
export declare const ColumnSettingsStorageKeyProvider: Provider<string | undefined>;
|
|
5
|
+
export declare function useColumnSettingsStorageKey(): string | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function clearColumnSettingsStorage(storageKey: string): {
|
|
2
|
+
skipNextSave: () => void;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Hook to handle column settings persistence to localStorage
|
|
6
|
+
*/
|
|
7
|
+
export declare function useColumnSettingsPersistence(storageKey: string | undefined): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TableColumn } from '@vef-framework/components';
|
|
2
|
-
import { OperationColumnConfig } from '../types';
|
|
2
|
+
import { ColumnSettingsProp, OperationColumnConfig } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* The hook to use the table columns.
|
|
5
5
|
*
|
|
6
6
|
* @param tableColumns - The columns of the table.
|
|
7
7
|
* @param operationColumn - The operation column of the table.
|
|
8
8
|
* @param showSequenceColumn - Whether to show the sequence column. Default is true.
|
|
9
|
+
* @param columnSettingsProp - Column settings configuration.
|
|
9
10
|
* @returns The table columns.
|
|
10
11
|
*/
|
|
11
|
-
export declare function useTableColumns<TRow extends object>(tableColumns: Array<TableColumn<TRow>>, operationColumn?: OperationColumnConfig<TRow>, showSequenceColumn?: boolean): Array<TableColumn<TRow>>;
|
|
12
|
+
export declare function useTableColumns<TRow extends object>(tableColumns: Array<TableColumn<TRow>>, operationColumn?: OperationColumnConfig<TRow>, showSequenceColumn?: boolean, columnSettingsProp?: ColumnSettingsProp): Array<TableColumn<TRow>>;
|
|
@@ -8,4 +8,4 @@ export declare const ProTable: (<TRow extends object, TParams extends object>(pr
|
|
|
8
8
|
export { OperationButtonGroup, TableSubscriber as ProTableSubscriber, type OperationButtonGroupProps, type TableSubscriberProps as ProTableSubscriberProps } from './components';
|
|
9
9
|
export type { ProTableProps } from './props';
|
|
10
10
|
export type { ProTableState } from './store';
|
|
11
|
-
export type { OperationColumnConfig, ParamsWithPagination, ParamsWithSort, ProTableRef, RowSelectionConfig } from './types';
|
|
11
|
+
export type { ColumnSettingsConfig, ColumnSettingsProp, OperationColumnConfig, ParamsWithPagination, ParamsWithSort, ProTableRef, RowSelectionConfig } from './types';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { TableColumn } from '@vef-framework/components';
|
|
1
|
+
import { TableColumn, TableProps } from '@vef-framework/components';
|
|
2
2
|
import { PaginationResult, QueryFunction } from '@vef-framework/core';
|
|
3
3
|
import { DeepKeys, Key } from '@vef-framework/shared';
|
|
4
4
|
import { CSSProperties, ReactNode } from 'react';
|
|
5
|
-
import { OperationColumnConfig, ParamsWithPagination, ParamsWithSort, RowSelectionConfig } from './types';
|
|
5
|
+
import { ColumnSettingsProp, OperationColumnConfig, ParamsWithPagination, ParamsWithSort, RowSelectionConfig } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Base props for ProTable component
|
|
8
8
|
*
|
|
9
9
|
* @template TRow - The type of table row data
|
|
10
10
|
* @template TParams - The type of query parameters
|
|
11
11
|
*/
|
|
12
|
-
interface BaseProTableProps<TRow, TParams> {
|
|
12
|
+
interface BaseProTableProps<TRow, TParams> extends Pick<TableProps<TRow>, "size"> {
|
|
13
13
|
/**
|
|
14
14
|
* Class name for the table container
|
|
15
15
|
*/
|
|
@@ -22,6 +22,13 @@ interface BaseProTableProps<TRow, TParams> {
|
|
|
22
22
|
* Table column definitions
|
|
23
23
|
*/
|
|
24
24
|
columns: Array<TableColumn<NoInfer<TRow>>>;
|
|
25
|
+
/**
|
|
26
|
+
* Column settings configuration.
|
|
27
|
+
* - `false`: Disable column settings feature
|
|
28
|
+
* - `{ storageKey?: string }`: Enable with optional localStorage persistence
|
|
29
|
+
* @default {}
|
|
30
|
+
*/
|
|
31
|
+
columnSettings?: ColumnSettingsProp;
|
|
25
32
|
/**
|
|
26
33
|
* Whether to show the sequence (row number) column. Default is true.
|
|
27
34
|
*/
|
|
@@ -1,8 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { TableColumn } from '@vef-framework/components';
|
|
2
|
+
import { DragDropEvents, PaginationParams, StoreProviderProps, UseStore, UnboundStore } from '@vef-framework/core';
|
|
3
|
+
import { EventEmitter, Key } from '@vef-framework/shared';
|
|
4
|
+
import { ReactNode, ComponentType } from 'react';
|
|
3
5
|
import { OrderSpec } from '../../types';
|
|
4
6
|
import { ProTableEvents } from './event';
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Column setting configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface ColumnSetting {
|
|
11
|
+
/**
|
|
12
|
+
* Column unique identifier
|
|
13
|
+
*/
|
|
14
|
+
id: Key;
|
|
15
|
+
/**
|
|
16
|
+
* Column display title
|
|
17
|
+
*/
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Column fixed position
|
|
21
|
+
*/
|
|
22
|
+
fixed?: "start" | "end" | false;
|
|
23
|
+
/**
|
|
24
|
+
* Column width in pixels
|
|
25
|
+
*/
|
|
26
|
+
width?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the column is visible
|
|
29
|
+
*/
|
|
30
|
+
visible: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Original column index for reference
|
|
33
|
+
*/
|
|
34
|
+
originalIndex: number;
|
|
35
|
+
}
|
|
6
36
|
/**
|
|
7
37
|
* State for the ProTable component
|
|
8
38
|
*/
|
|
@@ -31,5 +61,45 @@ export interface ProTableState {
|
|
|
31
61
|
* Refetch data with current query params, current pagination and sort parameters
|
|
32
62
|
*/
|
|
33
63
|
refetch: () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Column settings state for customization
|
|
66
|
+
*/
|
|
67
|
+
columnSettings: ColumnSetting[];
|
|
68
|
+
/**
|
|
69
|
+
* Original column settings for reset functionality
|
|
70
|
+
*/
|
|
71
|
+
originalColumnSettings: ColumnSetting[];
|
|
72
|
+
/**
|
|
73
|
+
* Initialize column settings from columns prop
|
|
74
|
+
*/
|
|
75
|
+
initColumnSettings: (columns: TableColumn[]) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Set column settings directly
|
|
78
|
+
*/
|
|
79
|
+
setColumnSettings: (settings: ColumnSetting[]) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Reorder columns by drag event
|
|
82
|
+
*/
|
|
83
|
+
reorderColumns: (event: Parameters<DragDropEvents["dragend"]>[0]) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Toggle column fixed state
|
|
86
|
+
*/
|
|
87
|
+
setColumnFixed: (id: Key, fixed: "start" | "end" | false) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Update column width
|
|
90
|
+
*/
|
|
91
|
+
setColumnWidth: (id: Key, width: number) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Toggle column visibility
|
|
94
|
+
*/
|
|
95
|
+
setColumnVisible: (id: Key, visible: boolean) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Reset column settings to original state
|
|
98
|
+
*
|
|
99
|
+
* @param clearStorage - Optional callback to clear localStorage
|
|
100
|
+
*/
|
|
101
|
+
resetColumnSettings: (clearStorage?: () => void) => void;
|
|
34
102
|
}
|
|
103
|
+
export declare function getColumnId(column: TableColumn, index: number): string;
|
|
104
|
+
export declare function createColumnSetting(column: TableColumn, index: number): ColumnSetting;
|
|
35
105
|
export declare const ProTableStoreProvider: ComponentType<StoreProviderProps<never>>, useProTableStore: UseStore<ProTableState>, useProTableStoreApi: <TStrictState extends ProTableState = ProTableState>() => UnboundStore<TStrictState>;
|
|
@@ -4,6 +4,23 @@ import { Key } from '@vef-framework/shared';
|
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import { SYMBOL_PAGINATION, SYMBOL_SORT } from '../../constants';
|
|
6
6
|
import { OrderSpec } from '../../types';
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for column settings feature
|
|
9
|
+
*/
|
|
10
|
+
export interface ColumnSettingsConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Storage key for persisting column settings to localStorage.
|
|
13
|
+
* If provided, settings will be saved with key: `__VEF_PRO_TABLE_COLUMN_SETTINGS__${storageKey}`
|
|
14
|
+
* If not provided, settings will not be persisted.
|
|
15
|
+
*/
|
|
16
|
+
storageKey?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Column settings prop type.
|
|
20
|
+
* - `false`: Disable column settings feature, hide settings icon
|
|
21
|
+
* - `ColumnSettingsConfig`: Enable column settings with optional persistence
|
|
22
|
+
*/
|
|
23
|
+
export type ColumnSettingsProp = false | ColumnSettingsConfig;
|
|
7
24
|
/**
|
|
8
25
|
* Imperative handle for ProTable component.
|
|
9
26
|
* Exposed via ref to allow parent components to programmatically control the table.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createCrudKit, Crud, CrudPage, FlexCard, FormDrawer, FormModal, OperationButtonGroup, Page, ProSearch, ProTable, ProTableSubscriber, useViewportHeight, type CrudActionButtonGroupProps, type CrudBasicFormScene, type CrudBasicSceneFormValues, type CrudFormMutationFns, type CrudFormScene, type CrudOperationButtonGroupProps, type CrudPageProps, type CrudProps, type FlexCardProps, type FormDrawerProps, type FormModalProps, type LoginParams, type LoginResult, type OperationButtonGroupProps, type OperationColumnConfig, type PageProps, type PaginatedQueryParams, type ParamsWithPagination, type ParamsWithSort, type ProSearchProps, type ProTableProps, type ProTableRef, type ProTableState, type ProTableSubscriberProps, type QueryParams, type RowSelectionConfig } from './components';
|
|
1
|
+
export { ApprovalFlowEditor, createCrudKit, Crud, CrudPage, FlexCard, FormDrawer, FormModal, OperationButtonGroup, Page, ProSearch, ProTable, ProTableSubscriber, useViewportHeight, type CrudActionButtonGroupProps, type CrudBasicFormScene, type CrudBasicSceneFormValues, type CrudFormMutationFns, type CrudFormScene, type CrudOperationButtonGroupProps, type CrudPageProps, type CrudProps, type FlexCardProps, type FormDrawerProps, type FormModalProps, type LoginParams, type LoginResult, type OperationButtonGroupProps, type OperationColumnConfig, type PageProps, type PaginatedQueryParams, type ParamsWithPagination, type ParamsWithSort, type ProSearchProps, type ProTableProps, type ProTableRef, type ProTableState, type ProTableSubscriberProps, type QueryParams, type RowSelectionConfig } from './components';
|
|
2
2
|
export * from './constants';
|
|
3
3
|
export * from './helpers';
|
|
4
4
|
export * from './routes';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework/starter",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.11",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Starter for VEF framework",
|
|
7
7
|
"author": {
|
|
@@ -54,20 +54,30 @@
|
|
|
54
54
|
"react-dom": ">=19"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
+
"@ant-design/icons": "^6.1.0",
|
|
57
58
|
"@emotion/react": "^11.14.0",
|
|
59
|
+
"@flowgram.ai/free-auto-layout-plugin": "^1.0.3",
|
|
60
|
+
"@flowgram.ai/free-container-plugin": "^1.0.3",
|
|
61
|
+
"@flowgram.ai/free-layout-editor": "^1.0.3",
|
|
62
|
+
"@flowgram.ai/free-lines-plugin": "^1.0.3",
|
|
63
|
+
"@flowgram.ai/free-node-panel-plugin": "^1.0.3",
|
|
64
|
+
"@flowgram.ai/free-snap-plugin": "^1.0.3",
|
|
65
|
+
"@flowgram.ai/free-stack-plugin": "^1.0.3",
|
|
66
|
+
"@flowgram.ai/minimap-plugin": "^1.0.3",
|
|
67
|
+
"@flowgram.ai/panel-manager-plugin": "^1.0.3",
|
|
58
68
|
"@tanem/react-nprogress": "^5.0.56",
|
|
59
|
-
"antd": "^6.0.
|
|
69
|
+
"antd": "^6.0.1",
|
|
60
70
|
"compare-versions": "^6.1.1",
|
|
61
|
-
"lucide-react": "^0.
|
|
71
|
+
"lucide-react": "^0.555.0"
|
|
62
72
|
},
|
|
63
73
|
"devDependencies": {
|
|
64
|
-
"@tanstack/react-router": "^1.139.
|
|
65
|
-
"react": "^19.2.
|
|
66
|
-
"react-dom": "^19.2.
|
|
67
|
-
"@vef-framework/
|
|
68
|
-
"@vef-framework/
|
|
69
|
-
"@vef-framework/
|
|
70
|
-
"@vef-framework/
|
|
74
|
+
"@tanstack/react-router": "^1.139.14",
|
|
75
|
+
"react": "^19.2.1",
|
|
76
|
+
"react-dom": "^19.2.1",
|
|
77
|
+
"@vef-framework/components": "2.0.11",
|
|
78
|
+
"@vef-framework/core": "2.0.11",
|
|
79
|
+
"@vef-framework/hooks": "2.0.11",
|
|
80
|
+
"@vef-framework/shared": "2.0.11"
|
|
71
81
|
},
|
|
72
82
|
"scripts": {
|
|
73
83
|
"clean": "rimraf dist",
|