@hi-ui/schema-editable-table 4.0.0-experimental.1
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 +11 -0
- package/lib/cjs/body/index.js +110 -0
- package/lib/cjs/body/wrapper.js +132 -0
- package/lib/cjs/cell/aggregated.js +76 -0
- package/lib/cjs/cell/dependency.js +97 -0
- package/lib/cjs/cell/editing.js +89 -0
- package/lib/cjs/cell/footer.js +64 -0
- package/lib/cjs/cell/header.js +76 -0
- package/lib/cjs/cell/index.js +204 -0
- package/lib/cjs/const.js +35 -0
- package/lib/cjs/container/base.js +39 -0
- package/lib/cjs/container/bottom.js +86 -0
- package/lib/cjs/container/col-group.js +98 -0
- package/lib/cjs/container/column-virtual.js +53 -0
- package/lib/cjs/container/ctx.js +32 -0
- package/lib/cjs/container/full-virtual.js +61 -0
- package/lib/cjs/container/hooks.js +102 -0
- package/lib/cjs/container/index.js +69 -0
- package/lib/cjs/container/row-virtual.js +50 -0
- package/lib/cjs/container/wrapper.js +97 -0
- package/lib/cjs/ctx.js +32 -0
- package/lib/cjs/features/_overrides/aggregated.js +44 -0
- package/lib/cjs/features/_overrides/getter.js +61 -0
- package/lib/cjs/features/_overrides/grouping.js +40 -0
- package/lib/cjs/features/_overrides/overrides.js +43 -0
- package/lib/cjs/features/_overrides/row-selection.js +140 -0
- package/lib/cjs/features/async-data/getter.js +150 -0
- package/lib/cjs/features/async-data/normal.js +145 -0
- package/lib/cjs/features/async-data/use-data-fetcher.js +40 -0
- package/lib/cjs/features/async-data/use-reset-data.js +91 -0
- package/lib/cjs/features/column-grouping/get-grouping-config.js +27 -0
- package/lib/cjs/features/column-grouping/use-opts.js +42 -0
- package/lib/cjs/features/column-state.js +57 -0
- package/lib/cjs/features/filter/bridge.js +114 -0
- package/lib/cjs/features/filter/filter-fns/date.js +34 -0
- package/lib/cjs/features/filter/filter-fns/index.js +23 -0
- package/lib/cjs/features/filter/get-filter-config.js +61 -0
- package/lib/cjs/features/filter/index.js +29 -0
- package/lib/cjs/features/filter/use-opts.js +88 -0
- package/lib/cjs/features/header-actions/components/column-collapsing.js +74 -0
- package/lib/cjs/features/header-actions/get-actions.js +77 -0
- package/lib/cjs/features/pagination/component.js +89 -0
- package/lib/cjs/features/pagination/use-opts.js +98 -0
- package/lib/cjs/features/pagination/use-state.js +44 -0
- package/lib/cjs/features/row-controller.js +265 -0
- package/lib/cjs/features/row-edit/actions.js +65 -0
- package/lib/cjs/features/row-edit/hooks.js +29 -0
- package/lib/cjs/features/row-expanding/use-opts.js +39 -0
- package/lib/cjs/features/row-expanding/wrapper.js +74 -0
- package/lib/cjs/features/row-operation/buttons.js +91 -0
- package/lib/cjs/features/row-operation/cell.js +43 -0
- package/lib/cjs/features/row-operation/index.js +21 -0
- package/lib/cjs/features/row-operation/wrapper.js +114 -0
- package/lib/cjs/features/row-selection/cell.js +114 -0
- package/lib/cjs/features/row-selection/const.js +16 -0
- package/lib/cjs/features/row-selection/hooks/index.js +29 -0
- package/lib/cjs/features/row-selection/hooks/use-click-select.js +70 -0
- package/lib/cjs/features/row-selection/hooks/use-opts.js +120 -0
- package/lib/cjs/features/row-selection/hooks/use-set-selected-row-keys.js +48 -0
- package/lib/cjs/features/row-selection/hooks/use-sync-hover-style.js +86 -0
- package/lib/cjs/features/row-selection/indicator.js +173 -0
- package/lib/cjs/features/row-selection/wrapper.js +119 -0
- package/lib/cjs/features/setting-bridge.js +56 -0
- package/lib/cjs/features/sorter/bridge.js +65 -0
- package/lib/cjs/features/sorter/get-sorter-config.js +46 -0
- package/lib/cjs/features/sorter/index.js +29 -0
- package/lib/cjs/features/sorter/use-opts.js +81 -0
- package/lib/cjs/field-bridge/bridge.js +104 -0
- package/lib/cjs/field-bridge/index.js +58 -0
- package/lib/cjs/field-bridge/toolbar.js +53 -0
- package/lib/cjs/footer/index.js +99 -0
- package/lib/cjs/footer/use-first-cell-patch.js +42 -0
- package/lib/cjs/header/index.js +134 -0
- package/lib/cjs/header/validate.js +69 -0
- package/lib/cjs/hooks/use-get-fields-value.js +62 -0
- package/lib/cjs/hooks/use-global-actions.js +65 -0
- package/lib/cjs/hooks/use-global-static.js +158 -0
- package/lib/cjs/hooks/use-initial-render.js +30 -0
- package/lib/cjs/hooks/use-inner-ctx.js +105 -0
- package/lib/cjs/hooks/use-props.js +108 -0
- package/lib/cjs/hooks/use-table-columns.js +76 -0
- package/lib/cjs/hooks/use-table-meta.js +57 -0
- package/lib/cjs/hooks/use-update.js +57 -0
- package/lib/cjs/index.js +66 -0
- package/lib/cjs/index.scss.js +18 -0
- package/lib/cjs/table.js +263 -0
- package/lib/cjs/utils/cls.js +19 -0
- package/lib/cjs/utils/fixed.js +53 -0
- package/lib/cjs/utils/grouping.js +42 -0
- package/lib/cjs/utils/state-merge.js +43 -0
- package/lib/esm/body/index.js +98 -0
- package/lib/esm/body/wrapper.js +120 -0
- package/lib/esm/cell/aggregated.js +64 -0
- package/lib/esm/cell/dependency.js +90 -0
- package/lib/esm/cell/editing.js +76 -0
- package/lib/esm/cell/footer.js +52 -0
- package/lib/esm/cell/header.js +63 -0
- package/lib/esm/cell/index.js +192 -0
- package/lib/esm/const.js +24 -0
- package/lib/esm/container/base.js +27 -0
- package/lib/esm/container/bottom.js +74 -0
- package/lib/esm/container/col-group.js +85 -0
- package/lib/esm/container/column-virtual.js +41 -0
- package/lib/esm/container/ctx.js +19 -0
- package/lib/esm/container/full-virtual.js +49 -0
- package/lib/esm/container/hooks.js +95 -0
- package/lib/esm/container/index.js +57 -0
- package/lib/esm/container/row-virtual.js +38 -0
- package/lib/esm/container/wrapper.js +83 -0
- package/lib/esm/ctx.js +17 -0
- package/lib/esm/features/_overrides/aggregated.js +39 -0
- package/lib/esm/features/_overrides/getter.js +56 -0
- package/lib/esm/features/_overrides/grouping.js +35 -0
- package/lib/esm/features/_overrides/overrides.js +38 -0
- package/lib/esm/features/_overrides/row-selection.js +135 -0
- package/lib/esm/features/async-data/getter.js +143 -0
- package/lib/esm/features/async-data/normal.js +133 -0
- package/lib/esm/features/async-data/use-data-fetcher.js +34 -0
- package/lib/esm/features/async-data/use-reset-data.js +79 -0
- package/lib/esm/features/column-grouping/get-grouping-config.js +22 -0
- package/lib/esm/features/column-grouping/use-opts.js +36 -0
- package/lib/esm/features/column-state.js +51 -0
- package/lib/esm/features/filter/bridge.js +102 -0
- package/lib/esm/features/filter/filter-fns/date.js +28 -0
- package/lib/esm/features/filter/filter-fns/index.js +18 -0
- package/lib/esm/features/filter/get-filter-config.js +56 -0
- package/lib/esm/features/filter/index.js +24 -0
- package/lib/esm/features/filter/use-opts.js +82 -0
- package/lib/esm/features/header-actions/components/column-collapsing.js +62 -0
- package/lib/esm/features/header-actions/get-actions.js +65 -0
- package/lib/esm/features/pagination/component.js +77 -0
- package/lib/esm/features/pagination/use-opts.js +91 -0
- package/lib/esm/features/pagination/use-state.js +39 -0
- package/lib/esm/features/row-controller.js +253 -0
- package/lib/esm/features/row-edit/actions.js +53 -0
- package/lib/esm/features/row-edit/hooks.js +24 -0
- package/lib/esm/features/row-expanding/use-opts.js +33 -0
- package/lib/esm/features/row-expanding/wrapper.js +62 -0
- package/lib/esm/features/row-operation/buttons.js +79 -0
- package/lib/esm/features/row-operation/cell.js +31 -0
- package/lib/esm/features/row-operation/index.js +16 -0
- package/lib/esm/features/row-operation/wrapper.js +100 -0
- package/lib/esm/features/row-selection/cell.js +101 -0
- package/lib/esm/features/row-selection/const.js +11 -0
- package/lib/esm/features/row-selection/hooks/index.js +24 -0
- package/lib/esm/features/row-selection/hooks/use-click-select.js +65 -0
- package/lib/esm/features/row-selection/hooks/use-opts.js +114 -0
- package/lib/esm/features/row-selection/hooks/use-set-selected-row-keys.js +43 -0
- package/lib/esm/features/row-selection/hooks/use-sync-hover-style.js +81 -0
- package/lib/esm/features/row-selection/indicator.js +159 -0
- package/lib/esm/features/row-selection/wrapper.js +107 -0
- package/lib/esm/features/setting-bridge.js +50 -0
- package/lib/esm/features/sorter/bridge.js +53 -0
- package/lib/esm/features/sorter/get-sorter-config.js +41 -0
- package/lib/esm/features/sorter/index.js +24 -0
- package/lib/esm/features/sorter/use-opts.js +75 -0
- package/lib/esm/field-bridge/bridge.js +92 -0
- package/lib/esm/field-bridge/index.js +44 -0
- package/lib/esm/field-bridge/toolbar.js +41 -0
- package/lib/esm/footer/index.js +87 -0
- package/lib/esm/footer/use-first-cell-patch.js +37 -0
- package/lib/esm/header/index.js +121 -0
- package/lib/esm/header/validate.js +64 -0
- package/lib/esm/hooks/use-get-fields-value.js +56 -0
- package/lib/esm/hooks/use-global-actions.js +60 -0
- package/lib/esm/hooks/use-global-static.js +152 -0
- package/lib/esm/hooks/use-initial-render.js +18 -0
- package/lib/esm/hooks/use-inner-ctx.js +100 -0
- package/lib/esm/hooks/use-props.js +102 -0
- package/lib/esm/hooks/use-table-columns.js +70 -0
- package/lib/esm/hooks/use-table-meta.js +51 -0
- package/lib/esm/hooks/use-update.js +52 -0
- package/lib/esm/index.js +38 -0
- package/lib/esm/index.scss.js +13 -0
- package/lib/esm/table.js +251 -0
- package/lib/esm/utils/cls.js +13 -0
- package/lib/esm/utils/fixed.js +48 -0
- package/lib/esm/utils/grouping.js +36 -0
- package/lib/esm/utils/state-merge.js +37 -0
- package/lib/types/body/index.d.ts +14 -0
- package/lib/types/body/wrapper.d.ts +18 -0
- package/lib/types/cell/aggregated.d.ts +35 -0
- package/lib/types/cell/custom.d.ts +19 -0
- package/lib/types/cell/dependency.d.ts +47 -0
- package/lib/types/cell/editing.d.ts +8 -0
- package/lib/types/cell/footer.d.ts +5 -0
- package/lib/types/cell/header.d.ts +5 -0
- package/lib/types/cell/index.d.ts +6 -0
- package/lib/types/const.d.ts +11 -0
- package/lib/types/container/base.d.ts +2 -0
- package/lib/types/container/bottom.d.ts +20 -0
- package/lib/types/container/col-group.d.ts +11 -0
- package/lib/types/container/column-virtual.d.ts +7 -0
- package/lib/types/container/ctx.d.ts +23 -0
- package/lib/types/container/full-virtual.d.ts +8 -0
- package/lib/types/container/hooks.d.ts +13 -0
- package/lib/types/container/index.d.ts +17 -0
- package/lib/types/container/row-virtual.d.ts +7 -0
- package/lib/types/container/type.d.ts +17 -0
- package/lib/types/container/wrapper.d.ts +12 -0
- package/lib/types/ctx.d.ts +41 -0
- package/lib/types/features/_overrides/aggregated.d.ts +2 -0
- package/lib/types/features/_overrides/getter.d.ts +2 -0
- package/lib/types/features/_overrides/grouping.d.ts +7 -0
- package/lib/types/features/_overrides/index.d.ts +5 -0
- package/lib/types/features/_overrides/overrides.d.ts +2 -0
- package/lib/types/features/_overrides/row-selection.d.ts +2 -0
- package/lib/types/features/async-data/getter.d.ts +9 -0
- package/lib/types/features/async-data/group.d.ts +1 -0
- package/lib/types/features/async-data/index.d.ts +6 -0
- package/lib/types/features/async-data/normal.d.ts +48 -0
- package/lib/types/features/async-data/type.d.ts +22 -0
- package/lib/types/features/async-data/use-data-fetcher.d.ts +22 -0
- package/lib/types/features/async-data/use-reset-data.d.ts +14 -0
- package/lib/types/features/column-grouping/get-grouping-config.d.ts +2 -0
- package/lib/types/features/column-grouping/index.d.ts +3 -0
- package/lib/types/features/column-grouping/use-opts.d.ts +12 -0
- package/lib/types/features/column-state.d.ts +15 -0
- package/lib/types/features/filter/bridge.d.ts +9 -0
- package/lib/types/features/filter/filter-fns/date.d.ts +6 -0
- package/lib/types/features/filter/filter-fns/index.d.ts +6 -0
- package/lib/types/features/filter/get-filter-config.d.ts +4 -0
- package/lib/types/features/filter/index.d.ts +8 -0
- package/lib/types/features/filter/use-opts.d.ts +62 -0
- package/lib/types/features/header-actions/components/column-collapsing.d.ts +4 -0
- package/lib/types/features/header-actions/get-actions.d.ts +13 -0
- package/lib/types/features/header-actions/index.d.ts +3 -0
- package/lib/types/features/header-actions/type.d.ts +20 -0
- package/lib/types/features/pagination/component.d.ts +15 -0
- package/lib/types/features/pagination/index.d.ts +4 -0
- package/lib/types/features/pagination/use-opts.d.ts +14 -0
- package/lib/types/features/pagination/use-state.d.ts +11 -0
- package/lib/types/features/row-controller.d.ts +101 -0
- package/lib/types/features/row-edit/actions.d.ts +12 -0
- package/lib/types/features/row-edit/hooks.d.ts +1 -0
- package/lib/types/features/row-edit/index.d.ts +2 -0
- package/lib/types/features/row-expanding/index.d.ts +3 -0
- package/lib/types/features/row-expanding/use-opts.d.ts +12 -0
- package/lib/types/features/row-expanding/wrapper.d.ts +11 -0
- package/lib/types/features/row-operation/buttons.d.ts +41 -0
- package/lib/types/features/row-operation/cell.d.ts +6 -0
- package/lib/types/features/row-operation/index.d.ts +18 -0
- package/lib/types/features/row-operation/wrapper.d.ts +3 -0
- package/lib/types/features/row-selection/cell.d.ts +62 -0
- package/lib/types/features/row-selection/const.d.ts +1 -0
- package/lib/types/features/row-selection/hooks/index.d.ts +6 -0
- package/lib/types/features/row-selection/hooks/use-click-select.d.ts +1 -0
- package/lib/types/features/row-selection/hooks/use-opts.d.ts +15 -0
- package/lib/types/features/row-selection/hooks/use-set-selected-row-keys.d.ts +9 -0
- package/lib/types/features/row-selection/hooks/use-sync-hover-style.d.ts +5 -0
- package/lib/types/features/row-selection/index.d.ts +7 -0
- package/lib/types/features/row-selection/indicator.d.ts +8 -0
- package/lib/types/features/row-selection/wrapper.d.ts +9 -0
- package/lib/types/features/setting-bridge.d.ts +14 -0
- package/lib/types/features/sorter/bridge.d.ts +8 -0
- package/lib/types/features/sorter/get-sorter-config.d.ts +7 -0
- package/lib/types/features/sorter/index.d.ts +8 -0
- package/lib/types/features/sorter/use-opts.d.ts +71 -0
- package/lib/types/field-bridge/bridge.d.ts +18 -0
- package/lib/types/field-bridge/index.d.ts +11 -0
- package/lib/types/field-bridge/toolbar.d.ts +9 -0
- package/lib/types/footer/index.d.ts +6 -0
- package/lib/types/footer/use-first-cell-patch.d.ts +1 -0
- package/lib/types/header/index.d.ts +17 -0
- package/lib/types/header/validate.d.ts +10 -0
- package/lib/types/hooks/use-get-fields-value.d.ts +14 -0
- package/lib/types/hooks/use-global-actions.d.ts +24 -0
- package/lib/types/hooks/use-global-static.d.ts +83 -0
- package/lib/types/hooks/use-initial-render.d.ts +1 -0
- package/lib/types/hooks/use-inner-ctx.d.ts +12 -0
- package/lib/types/hooks/use-props.d.ts +109 -0
- package/lib/types/hooks/use-table-columns.d.ts +11 -0
- package/lib/types/hooks/use-table-meta.d.ts +15 -0
- package/lib/types/hooks/use-update.d.ts +11 -0
- package/lib/types/index.d.ts +32 -0
- package/lib/types/table.d.ts +152 -0
- package/lib/types/utils/cls.d.ts +4 -0
- package/lib/types/utils/fixed.d.ts +11 -0
- package/lib/types/utils/grouping.d.ts +6 -0
- package/lib/types/utils/index.d.ts +5 -0
- package/lib/types/utils/meta.d.ts +8 -0
- package/lib/types/utils/state-merge.d.ts +14 -0
- package/package.json +90 -0
- package/type.d.ts +143 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useRuntimeRowEditable(rowIndex: number): boolean | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExpandedOptions } from '@tanstack/react-table';
|
|
2
|
+
import { StaticOptsRefType } from '../../hooks/use-global-static';
|
|
3
|
+
export type ExpandedOpts = {};
|
|
4
|
+
type UseExpandedOptsCtxType = {
|
|
5
|
+
staticOptsRef: StaticOptsRefType;
|
|
6
|
+
};
|
|
7
|
+
export declare function useRowExpandedOpts<TData extends AnyObject>(ctx: UseExpandedOptsCtxType): ExpandedOptions<TData>;
|
|
8
|
+
/**
|
|
9
|
+
* 获取行展开配置选项
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRowExpandedOptions<TData extends AnyObject>(ctx: UseExpandedOptsCtxType): ExpandedOptions<TData>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Cell } from '@tanstack/react-table';
|
|
3
|
+
import type { FieldControlType } from '@hi-ui/schema-core';
|
|
4
|
+
import type { BodyCellRenderCaseType } from '../../body/wrapper';
|
|
5
|
+
type RowExpandingWrapperProps = {
|
|
6
|
+
cell: Cell<AnyType, unknown>;
|
|
7
|
+
textAlign?: FieldControlType['align'];
|
|
8
|
+
renderCase: BodyCellRenderCaseType;
|
|
9
|
+
};
|
|
10
|
+
export declare function RowExpandingWrapper(props: React.PropsWithChildren<RowExpandingWrapperProps>): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Row } from '@tanstack/react-table';
|
|
3
|
+
import type { ActionFnParams, ActionConfigType } from '@hi-ui/schema-core';
|
|
4
|
+
import type { ActionsProps } from '@hi-ui/schema-action-trigger';
|
|
5
|
+
import { createEditButtons } from '../row-edit/actions';
|
|
6
|
+
import type { TableCtxRefType } from '../../table';
|
|
7
|
+
/** 按钮相关函数的参数类型 */
|
|
8
|
+
type OpFnParams<TData extends AnyObject> = ActionFnParams<TData, OpButtonRenderCtx<TData>>;
|
|
9
|
+
/** 配置式按钮的配置选项类型 */
|
|
10
|
+
export type OpButtonConfigType<TData extends AnyObject = AnyObject> = ActionConfigType<TData, OpButtonRenderCtx<TData>>;
|
|
11
|
+
/** 自定义渲染按钮函数的上下文类型 */
|
|
12
|
+
export type OpButtonRenderCtx<TData extends AnyObject> = TableCtxRefType<TData> & {
|
|
13
|
+
row: Row<TData>;
|
|
14
|
+
rowIndex: number;
|
|
15
|
+
/**
|
|
16
|
+
* 行编辑相关
|
|
17
|
+
* @desc 未开启行编辑时会有默认的空值
|
|
18
|
+
*/
|
|
19
|
+
rowEdit: {
|
|
20
|
+
/** 是否处于编辑状态 */
|
|
21
|
+
isEditing: boolean;
|
|
22
|
+
/** 编辑按钮对象 */
|
|
23
|
+
buttons: ReturnType<typeof createEditButtons>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/** 【操作按钮组】组件的配置选项类型 */
|
|
27
|
+
export type OpButtonsProps<TData extends AnyObject = AnyObject> = {
|
|
28
|
+
/** 行实例 */
|
|
29
|
+
row: Row<TData>;
|
|
30
|
+
/** 操作按钮配置 */
|
|
31
|
+
buttons?: ActionsProps<TData, OpButtonRenderCtx<TData>>['actions'];
|
|
32
|
+
/** 自定义渲染函数 */
|
|
33
|
+
render?: (...args: OpFnParams<TData>) => React.ReactElement[];
|
|
34
|
+
/** 是否启用行编辑 */
|
|
35
|
+
rowEdit?: boolean;
|
|
36
|
+
/** 最大显示数量,超出后显示更多按钮 */
|
|
37
|
+
maxCount?: ActionsProps['maxCount'];
|
|
38
|
+
};
|
|
39
|
+
/** 【操作按钮组】组件 */
|
|
40
|
+
export declare function OpButtons<TData extends AnyObject = AnyObject>(props: OpButtonsProps<TData>): JSX.Element | null;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Row } from '@tanstack/react-table';
|
|
2
|
+
type OperationBodyCellProps<TData extends AnyObject> = {
|
|
3
|
+
row: Row<TData>;
|
|
4
|
+
};
|
|
5
|
+
export declare function OperationBodyCell<TData extends AnyObject>(props: OperationBodyCellProps<TData>): JSX.Element | null;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OperationHeader, OperationBody, OperationFooter } from './wrapper';
|
|
2
|
+
import type { OpButtonsProps } from './buttons';
|
|
3
|
+
export type { OpButtonConfigType } from './buttons';
|
|
4
|
+
export type RowOperationOptsType<TData extends AnyObject = AnyObject> = Omit<OpButtonsProps<TData>, 'row'> & {
|
|
5
|
+
/** 列宽 */
|
|
6
|
+
width?: number;
|
|
7
|
+
/**
|
|
8
|
+
* 表头文本
|
|
9
|
+
* - 默认值为中文【操作】
|
|
10
|
+
*/
|
|
11
|
+
headerText?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const dftOpButtonCount = 3;
|
|
14
|
+
export declare const RowOperation: {
|
|
15
|
+
Header: typeof OperationHeader;
|
|
16
|
+
Body: typeof OperationBody;
|
|
17
|
+
Footer: typeof OperationFooter;
|
|
18
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Row } from '@tanstack/react-table';
|
|
2
|
+
import type { BoolConfig } from '@hi-ui/schema-utils';
|
|
3
|
+
import type { RowSelectionIndicatorOpts } from './indicator';
|
|
4
|
+
type RowSelectionOnCheckAllChangeCtxType = {
|
|
5
|
+
checked: boolean;
|
|
6
|
+
indeterminate: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type RowSelectionOptsType<TData extends AnyObject = AnyObject> = {
|
|
9
|
+
type?: 'checkbox' | 'radio';
|
|
10
|
+
onChange?: (selected: {
|
|
11
|
+
keys: string[];
|
|
12
|
+
rows: TData[];
|
|
13
|
+
}) => void;
|
|
14
|
+
onCheckAllChange?: (ctx: RowSelectionOnCheckAllChangeCtxType) => void;
|
|
15
|
+
/**
|
|
16
|
+
* 是否在数据被删除时,仍保留已选择的数据
|
|
17
|
+
* - 建议在启用后端分页时打开该选项
|
|
18
|
+
*/
|
|
19
|
+
preserveSelectedRows?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 根据行数据决定是否启用行选择
|
|
22
|
+
* @desc 会在行选择状态变化时重新调用
|
|
23
|
+
* @desc 默认全部可以选中
|
|
24
|
+
*/
|
|
25
|
+
enableRowSelection?: (rowData: TData, ctx: {
|
|
26
|
+
row: Row<TData>;
|
|
27
|
+
}) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 根据行数据决定是否启用子行选择
|
|
30
|
+
* @desc 会在行选择状态变化时重新调用
|
|
31
|
+
* @desc 默认全部可以选中子行
|
|
32
|
+
*/
|
|
33
|
+
enableSubRowSelection?: (rowData: TData, ctx: {
|
|
34
|
+
row: Row<TData>;
|
|
35
|
+
}) => boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 是否启用动态行可选状态支持
|
|
38
|
+
* @deprecated 经过性能优化,已无需通过此处配置来控制是否订阅
|
|
39
|
+
* @desc 启用后 SelectionCell 会在任意行选择状态发生变化时触发重渲染
|
|
40
|
+
* @desc 会有性能下降,避免在大数据量的表格使用
|
|
41
|
+
*/
|
|
42
|
+
enableDynamicRowSelection?: boolean;
|
|
43
|
+
/** 初次加载时默认选中的行 */
|
|
44
|
+
dftSelectedRowKeys?: (string | number)[];
|
|
45
|
+
/**
|
|
46
|
+
* 是否启用点击行选择
|
|
47
|
+
* @desc 启用后,点击行的任意只读单元格均会触发选中
|
|
48
|
+
* @desc 若与分页同时启用,则必须传入 rowKey 配置,否则无法正确选中
|
|
49
|
+
*/
|
|
50
|
+
enableClickSelect?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 是否启用行选择指示器
|
|
53
|
+
* @desc 启用后,会在表格底部显示一个行选择指示器,展示当前选中的行的数量
|
|
54
|
+
*/
|
|
55
|
+
enableIndicator?: BoolConfig<RowSelectionIndicatorOpts>;
|
|
56
|
+
};
|
|
57
|
+
export declare function SelectionHeaderCell(): JSX.Element | null;
|
|
58
|
+
type SelectionBodyCellProps<TData extends AnyObject> = {
|
|
59
|
+
row: Row<TData>;
|
|
60
|
+
};
|
|
61
|
+
export declare function SelectionBodyCell<TData extends AnyObject>(props: SelectionBodyCellProps<TData>): JSX.Element | null;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dftSelectionType: "checkbox";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RowSelectionState } from '@tanstack/react-table';
|
|
2
|
+
export declare function useRowSelectionState(): {
|
|
3
|
+
rowSelectionState: import("@hi-ui/use-subscription").SubscriptionType<RowSelectionState>;
|
|
4
|
+
};
|
|
5
|
+
export { useRowSelectionOpts } from './use-opts';
|
|
6
|
+
export { useSyncHoverStyle } from './use-sync-hover-style';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useClickSelect: () => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PaginationState, TableOptions } from '@tanstack/react-table';
|
|
2
|
+
import type { InnerRefType } from '../../../ctx';
|
|
3
|
+
import type { RowSelectionOptsType } from '../index';
|
|
4
|
+
type UseRowSelectionOptsCtxType<TData extends AnyObject> = {
|
|
5
|
+
rowSelection: RowSelectionOptsType<TData> | undefined;
|
|
6
|
+
innerRef: InnerRefType<TData>;
|
|
7
|
+
};
|
|
8
|
+
export declare function useRowSelectionOpts<TData extends AnyObject>(ctx: UseRowSelectionOptsCtxType<TData>): Pick<TableOptions<TData>, "enableRowSelection" | "enableMultiRowSelection" | "onRowSelectionChange" | "enableSubRowSelection">;
|
|
9
|
+
/** 如果开启了后端分页,并且没有配置 preserveSelectedRows,则需要在分页变化时清空选中状态 */
|
|
10
|
+
export declare function resetRowSelectionAfterPaginationChange<TData extends AnyObject>(ctx: {
|
|
11
|
+
innerRef: InnerRefType<TData>;
|
|
12
|
+
state: PaginationState;
|
|
13
|
+
newState: PaginationState;
|
|
14
|
+
}): void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InnerRefType } from '../../../ctx';
|
|
2
|
+
type SetSelectedRowKeysCtxType<TData extends AnyObject> = {
|
|
3
|
+
innerRef: InnerRefType<TData>;
|
|
4
|
+
};
|
|
5
|
+
type RowKeyType = string | number;
|
|
6
|
+
type GetRowKeysType = (keys: RowKeyType[]) => RowKeyType[] | null;
|
|
7
|
+
export type InnerSetSelectedRowKeys = (keys: RowKeyType[] | GetRowKeysType | null) => void;
|
|
8
|
+
export declare function useSetSelectedRowKeys<TData extends AnyObject>(ctx: SetSelectedRowKeysCtxType<TData>): InnerSetSelectedRowKeys;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { RowSelection } from './wrapper';
|
|
2
|
+
export { SelectionHeaderCell, SelectionBodyCell } from './cell';
|
|
3
|
+
export { useRowSelectionState } from './hooks';
|
|
4
|
+
export { RowSelectionIndicator } from './indicator';
|
|
5
|
+
export type { RowSelectionOptsType } from './cell';
|
|
6
|
+
export { useSetSelectedRowKeys } from './hooks/use-set-selected-row-keys';
|
|
7
|
+
export type { InnerSetSelectedRowKeys } from './hooks/use-set-selected-row-keys';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type RowSelectionIndicatorOpts = {
|
|
3
|
+
/** 开启仅显示已选功能 */
|
|
4
|
+
enableOnlyShowSelected?: boolean;
|
|
5
|
+
/** 格式化已选数量 */
|
|
6
|
+
formatter?: (selectedCount: number) => React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare function RowSelectionIndicator(): JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function SelectionHeader(): JSX.Element;
|
|
2
|
+
declare function SelectionBody(): JSX.Element;
|
|
3
|
+
declare function SelectionFooter(): JSX.Element;
|
|
4
|
+
export declare const RowSelection: {
|
|
5
|
+
Header: typeof SelectionHeader;
|
|
6
|
+
Body: typeof SelectionBody;
|
|
7
|
+
Footer: typeof SelectionFooter;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FieldConfigType } from '@hi-ui/schema-core';
|
|
2
|
+
import type { TableColumn, TableSettingProps } from '@hi-ui/schema-table-extensions';
|
|
3
|
+
import type { TableCtxRefType } from '../table';
|
|
4
|
+
/**
|
|
5
|
+
* 将字段配置转换为列设置需要的格式
|
|
6
|
+
*/
|
|
7
|
+
export declare function mapFieldsToColumns(fields: FieldConfigType[]): TableColumn[];
|
|
8
|
+
export type UseTableSettingProps = {
|
|
9
|
+
fields: FieldConfigType[];
|
|
10
|
+
tableRef: React.RefObject<TableCtxRefType>;
|
|
11
|
+
storageKey?: string;
|
|
12
|
+
onChange?: TableSettingProps['onChange'];
|
|
13
|
+
};
|
|
14
|
+
export declare function useTableSetting(props: UseTableSettingProps): TableSettingProps;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HeaderContext } from '@tanstack/react-table';
|
|
2
|
+
import type { FieldConfigType, FieldSorterConfigType } from '@hi-ui/schema-core';
|
|
3
|
+
export type TableSorterBridgeProps<TData extends AnyObject> = {
|
|
4
|
+
column: HeaderContext<TData, unknown>['column'];
|
|
5
|
+
field: FieldConfigType;
|
|
6
|
+
sorter?: FieldSorterConfigType;
|
|
7
|
+
};
|
|
8
|
+
export declare function TableSorterBridge<TData extends AnyObject>(props: TableSorterBridgeProps<TData>): JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BuiltInSortingFn as TanStackBuiltInSortingFn } from '@tanstack/react-table';
|
|
2
|
+
import type { FieldConfigType, FieldSorterConfigType } from '@hi-ui/schema-core';
|
|
3
|
+
import { PropsRefType } from '../../ctx';
|
|
4
|
+
export type BuiltInSortingFn = TanStackBuiltInSortingFn | 'textLocalCompare';
|
|
5
|
+
export declare function getSorterConfig(field: FieldConfigType, ctx: {
|
|
6
|
+
propsRef: PropsRefType<AnyObject>;
|
|
7
|
+
}): FieldSorterConfigType | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SortingState } from '@tanstack/react-table';
|
|
2
|
+
export { useSorterOpts, getSorterOptions } from './use-opts';
|
|
3
|
+
export { getSorterConfig } from './get-sorter-config';
|
|
4
|
+
export { TableSorterBridge } from './bridge';
|
|
5
|
+
export type { SorterOpts } from './use-opts';
|
|
6
|
+
export declare function useSorterState(): {
|
|
7
|
+
sorterState: import("@hi-ui/use-subscription").SubscriptionType<SortingState>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { SortingState, TableOptions, SortingColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import type { TableSorterProps } from '@hi-ui/schema-table-extensions';
|
|
3
|
+
import { type OnChangeFnCtxType } from '../../utils';
|
|
4
|
+
import type { InnerRefType, PropsRefType } from '../../ctx';
|
|
5
|
+
import type { StaticOptsRefType } from '../../hooks/use-global-static';
|
|
6
|
+
export type SorterOpts = {
|
|
7
|
+
remote?: boolean;
|
|
8
|
+
tooltip?: TableSorterProps['tooltip'];
|
|
9
|
+
onChange?: (state: SortingState, ctx: OnChangeFnCtxType<SortingState>) => void;
|
|
10
|
+
/**
|
|
11
|
+
* 是否开启多排序
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
enableMultiSort?: TableOptions<AnyObject>['enableMultiSort'];
|
|
15
|
+
/**
|
|
16
|
+
* 最大多排序列数
|
|
17
|
+
*/
|
|
18
|
+
maxMultiSortColCount?: TableOptions<AnyObject>['maxMultiSortColCount'];
|
|
19
|
+
/**
|
|
20
|
+
* 如何排序 undefined 值
|
|
21
|
+
* @default 'last' 也就是默认全部排在最后
|
|
22
|
+
*/
|
|
23
|
+
sortUndefined?: SortingColumnDef<AnyObject>['sortUndefined'];
|
|
24
|
+
};
|
|
25
|
+
type UseSorterOptsCtxType<TData extends AnyObject> = {
|
|
26
|
+
innerRef: InnerRefType<TData>;
|
|
27
|
+
propsRef: PropsRefType<TData>;
|
|
28
|
+
staticOptsRef: StaticOptsRefType;
|
|
29
|
+
};
|
|
30
|
+
export declare function useSorterOpts<TData extends AnyObject>(ctx: UseSorterOptsCtxType<TData>): {
|
|
31
|
+
manualSorting?: undefined;
|
|
32
|
+
enableMultiSort?: undefined;
|
|
33
|
+
maxMultiSortColCount?: undefined;
|
|
34
|
+
onSortingChange?: undefined;
|
|
35
|
+
getSortedRowModel?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
manualSorting: boolean;
|
|
38
|
+
enableMultiSort: boolean | undefined;
|
|
39
|
+
maxMultiSortColCount: number | undefined;
|
|
40
|
+
onSortingChange: import("@tanstack/react-table").OnChangeFn<SortingState>;
|
|
41
|
+
getSortedRowModel?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
manualSorting: boolean;
|
|
44
|
+
enableMultiSort: boolean | undefined;
|
|
45
|
+
maxMultiSortColCount: number | undefined;
|
|
46
|
+
getSortedRowModel: (table: import("@tanstack/react-table").Table<unknown>) => () => import("@tanstack/react-table").RowModel<unknown>;
|
|
47
|
+
onSortingChange: import("@tanstack/react-table").OnChangeFn<SortingState>;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* 获取表格排序配置选项
|
|
51
|
+
*/
|
|
52
|
+
export declare function getSorterOptions<TData extends AnyObject>(ctx: UseSorterOptsCtxType<TData>): {
|
|
53
|
+
manualSorting?: undefined;
|
|
54
|
+
enableMultiSort?: undefined;
|
|
55
|
+
maxMultiSortColCount?: undefined;
|
|
56
|
+
onSortingChange?: undefined;
|
|
57
|
+
getSortedRowModel?: undefined;
|
|
58
|
+
} | {
|
|
59
|
+
manualSorting: boolean;
|
|
60
|
+
enableMultiSort: boolean | undefined;
|
|
61
|
+
maxMultiSortColCount: number | undefined;
|
|
62
|
+
onSortingChange: import("@tanstack/react-table").OnChangeFn<SortingState>;
|
|
63
|
+
getSortedRowModel?: undefined;
|
|
64
|
+
} | {
|
|
65
|
+
manualSorting: boolean;
|
|
66
|
+
enableMultiSort: boolean | undefined;
|
|
67
|
+
maxMultiSortColCount: number | undefined;
|
|
68
|
+
getSortedRowModel: (table: import("@tanstack/react-table").Table<unknown>) => () => import("@tanstack/react-table").RowModel<unknown>;
|
|
69
|
+
onSortingChange: import("@tanstack/react-table").OnChangeFn<SortingState>;
|
|
70
|
+
};
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ToolbarConfigType } from '@hi-ui/schema-action-trigger';
|
|
2
|
+
import type { EditTableProps, TableCtxRefType } from '../index';
|
|
3
|
+
export type EditTableBridgeInnerCtxType = {
|
|
4
|
+
tableCtx: TableCtxRefType | null;
|
|
5
|
+
};
|
|
6
|
+
export type EditTableBridgeProps = EditTableProps & {
|
|
7
|
+
toolbar?: false | ToolbarConfigType;
|
|
8
|
+
actions?: ToolbarConfigType['right'];
|
|
9
|
+
/** 捕获 innerCtxRef 引用 */
|
|
10
|
+
catchInnerCtx?: (ctx: EditTableBridgeInnerCtxType) => void;
|
|
11
|
+
/**
|
|
12
|
+
* 不要触发完全重渲染
|
|
13
|
+
* - 默认情况时,表单绑定的数据变化时,会触发完全重渲染
|
|
14
|
+
* - 本质是给 subscription.setValue 传入 complete: false
|
|
15
|
+
*/
|
|
16
|
+
doNotCompleteRerender?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function EditTableBridge(props: EditTableBridgeProps): JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ProField } from '@hi-ui/schema-fields';
|
|
2
|
+
import type { ProFieldRenderCtx, ProFieldRenderFormItemCtx } from '@hi-ui/schema-fields';
|
|
3
|
+
import { EditTableBridge, type EditTableBridgeProps } from './bridge';
|
|
4
|
+
export { EditTableBridge, EditTableBridgeProps };
|
|
5
|
+
export type { FormEditTableToolbarCtxType } from './toolbar';
|
|
6
|
+
export type ProEditTableProps = EditTableBridgeProps & {};
|
|
7
|
+
export declare class ProEditTable extends ProField {
|
|
8
|
+
render(data: AnyObject[] | undefined, ctx: ProFieldRenderCtx<EditTableBridgeProps>): JSX.Element;
|
|
9
|
+
renderCell(): JSX.Element;
|
|
10
|
+
renderFormItem(_: null, ctx: ProFieldRenderFormItemCtx<EditTableBridgeProps>): JSX.Element;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TableToolbarCtxType, TableToolbarProps } from '@hi-ui/schema-action-trigger';
|
|
2
|
+
export type FormEditTableToolbarCtxType = TableToolbarCtxType & {
|
|
3
|
+
readonly?: boolean;
|
|
4
|
+
};
|
|
5
|
+
type ToolbarProps = Omit<TableToolbarProps, 'className'> & {
|
|
6
|
+
ctx: FormEditTableToolbarCtxType;
|
|
7
|
+
};
|
|
8
|
+
export declare function Toolbar(props: ToolbarProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useFirstCellPatch(): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Header, Table } from '@tanstack/react-table';
|
|
3
|
+
export type EditTableHeaderProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
type HeaderCellWrapperDynamicAttrsCtxType = {
|
|
7
|
+
header: Header<AnyType, unknown>;
|
|
8
|
+
};
|
|
9
|
+
type HeaderCellWrapperDynamicAttrsType = React.ThHTMLAttributes<HTMLTableCellElement>;
|
|
10
|
+
export type GetHeaderCellWrapperDynamicAttrsFnType = (ctx: HeaderCellWrapperDynamicAttrsCtxType) => HeaderCellWrapperDynamicAttrsType;
|
|
11
|
+
declare const _default: React.NamedExoticComponent<EditTableHeaderProps>;
|
|
12
|
+
export default _default;
|
|
13
|
+
export declare function groupHeaders(headers: Header<AnyType, unknown>[], table: Table<AnyType>): {
|
|
14
|
+
left: typeof headers;
|
|
15
|
+
center: typeof headers;
|
|
16
|
+
right: typeof headers;
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Header } from '@tanstack/react-table';
|
|
2
|
+
type HeaderValidationResult = {
|
|
3
|
+
isValid: false;
|
|
4
|
+
} | {
|
|
5
|
+
isValid: true;
|
|
6
|
+
rowSpan: number;
|
|
7
|
+
type: 'PLACEHOLDER-NO-PARENT' | 'PLACEHOLDER-WITH-PARENT' | 'NORMAL-NO-PARENT' | 'NORMAL-WITH-PARENT';
|
|
8
|
+
};
|
|
9
|
+
export declare function validateHeaderCell(header: Header<AnyObject, unknown>, totalHeaderRows: number): HeaderValidationResult;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EditableSchemaTableCtxType } from '../ctx';
|
|
2
|
+
type UseGetFieldsValueCtxType<TData extends AnyObject> = {
|
|
3
|
+
innerRef: React.MutableRefObject<EditableSchemaTableCtxType<TData>>;
|
|
4
|
+
};
|
|
5
|
+
type GetFieldsValueExtraOptsType = {
|
|
6
|
+
/** 额外需要获取的 fields */
|
|
7
|
+
extraFields?: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function useGetFieldsValue<TData extends AnyObject = AnyObject>(ctx: UseGetFieldsValueCtxType<TData>): <DataType extends AnyObject = Partial<TData>>(opts?: GetFieldsValueExtraOptsType) => DataType[];
|
|
10
|
+
export declare function useGetGroupedValues<TData extends AnyObject = AnyObject>(ctx: UseGetFieldsValueCtxType<TData>): () => {
|
|
11
|
+
editable: Pick<TData, string>;
|
|
12
|
+
readonly: Omit<TData, string>;
|
|
13
|
+
}[];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReadonlyRefObject } from '@hi-ui/schema-hooks';
|
|
2
|
+
import type { InnerRefType } from '../ctx';
|
|
3
|
+
import type { InnerGetDataSourceType, InnerUpdateDataSourceType, InnerResetDataSourceType } from '../features/async-data';
|
|
4
|
+
import type { InnerSetSelectedRowKeys } from '../features/row-selection';
|
|
5
|
+
export type GlobalStaticActionsType<TData extends AnyObject> = {
|
|
6
|
+
/** 获取异步数据源(仅获取数据) */
|
|
7
|
+
getDataSource: InnerGetDataSourceType<TData>;
|
|
8
|
+
/** 更新异步数据源(获取数据并更新表格) */
|
|
9
|
+
updateDataSource: InnerUpdateDataSourceType;
|
|
10
|
+
/** 重置分页、筛选状态 */
|
|
11
|
+
resetDataSource: InnerResetDataSourceType;
|
|
12
|
+
/** 设置表格数据源 */
|
|
13
|
+
setDataSource: (newValue: TData[] | ((prev: TData[]) => TData[])) => void;
|
|
14
|
+
/** 设置行选择状态 */
|
|
15
|
+
setSelectedRowKeys: InnerSetSelectedRowKeys;
|
|
16
|
+
};
|
|
17
|
+
type UseGlobalStaticActionsCtxType<TData extends AnyObject> = {
|
|
18
|
+
innerRef: InnerRefType<TData>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 全局静态函数
|
|
22
|
+
*/
|
|
23
|
+
export declare function useGlobalStaticActions<TData extends AnyObject>(ctx: UseGlobalStaticActionsCtxType<TData>): ReadonlyRefObject<GlobalStaticActionsType<TData>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ReadonlyRefObject } from '@hi-ui/schema-hooks';
|
|
2
|
+
import type { EditableSchemaTableCtxType, PropsRefType } from '../ctx';
|
|
3
|
+
export type GlobalStaticConfigType = {
|
|
4
|
+
/** 是否启用异步数据 */
|
|
5
|
+
enableAsyncData: boolean;
|
|
6
|
+
/** 是否为空 */
|
|
7
|
+
isEmpty: boolean;
|
|
8
|
+
/** 是否展示表尾 */
|
|
9
|
+
showFooter: boolean;
|
|
10
|
+
/** 是否存在粘性 Footer */
|
|
11
|
+
hasStickyFooter: true | undefined;
|
|
12
|
+
/** 是否存在嵌套表头 */
|
|
13
|
+
hasNestHeader: boolean;
|
|
14
|
+
/** 是否存在左固定列(不包括选择列) */
|
|
15
|
+
hasLeftFixed: boolean;
|
|
16
|
+
/** 是否存在右固定列(不包括操作列) */
|
|
17
|
+
hasRightFixed: boolean;
|
|
18
|
+
/** 启用行选择偏移 */
|
|
19
|
+
enableRowSelection: boolean;
|
|
20
|
+
/** 启用行操作偏移 */
|
|
21
|
+
enableRowOperation: boolean;
|
|
22
|
+
/** 启用行编辑 */
|
|
23
|
+
enableRowEdit: boolean;
|
|
24
|
+
/** 操作列列宽 */
|
|
25
|
+
operationColWidth: number;
|
|
26
|
+
/** 所有可编辑字段的 key */
|
|
27
|
+
editableFieldKeys: string[];
|
|
28
|
+
/** 是否启用分页 */
|
|
29
|
+
enablePagination: boolean;
|
|
30
|
+
/** 是否仅在 hover 时显示表头操作 */
|
|
31
|
+
enableHeaderActionHoverOnly: boolean;
|
|
32
|
+
/** 是否启用表头过滤 */
|
|
33
|
+
enableFilter: boolean;
|
|
34
|
+
/** 表头过滤是否启用远程数据 */
|
|
35
|
+
enableRemoteFilter: boolean;
|
|
36
|
+
/** 是否启用表头排序 */
|
|
37
|
+
enableSorter: boolean;
|
|
38
|
+
/** 表头排序是否启用远程数据 */
|
|
39
|
+
enableRemoteSorter: boolean;
|
|
40
|
+
/** 是否启用行展开 */
|
|
41
|
+
enableRowExpanding: boolean;
|
|
42
|
+
/** 是否启用列分组 */
|
|
43
|
+
enableRowGrouping: boolean;
|
|
44
|
+
/** 底部容器是否为空 */
|
|
45
|
+
isBottomEmpty: boolean;
|
|
46
|
+
};
|
|
47
|
+
type UseGlobalStaticCtxType = Pick<EditableSchemaTableCtxType<AnyType>, 'table' | 'propsRef' | 'subscription'> & {
|
|
48
|
+
staticOptsRef: StaticOptsRefType;
|
|
49
|
+
};
|
|
50
|
+
export type PropsStaticOptsType = ReturnType<typeof genStaticOptsFromPropsRef>;
|
|
51
|
+
/**
|
|
52
|
+
* 从 propsRef 中生成的静态配置的引用
|
|
53
|
+
* @desc 仅用于 globalStaticRef 生成前,生成后则应统一使用 globalStaticRef
|
|
54
|
+
*/
|
|
55
|
+
export type StaticOptsRefType = ReadonlyRefObject<PropsStaticOptsType>;
|
|
56
|
+
/**
|
|
57
|
+
* 从 propsRef 中生成静态配置
|
|
58
|
+
* @desc 是 useGlobalStatic 返回值的子集
|
|
59
|
+
* @desc 也就是仅包含能直接从 propsRef 中获取的选项配置
|
|
60
|
+
*/
|
|
61
|
+
export declare function genStaticOptsFromPropsRef(propsRef: PropsRefType<AnyType>): {
|
|
62
|
+
enableAsyncData: boolean;
|
|
63
|
+
hasNestHeader: boolean;
|
|
64
|
+
enableRowSelection: boolean;
|
|
65
|
+
enableRowOperation: boolean;
|
|
66
|
+
enableRowEdit: boolean;
|
|
67
|
+
operationColWidth: number;
|
|
68
|
+
enablePagination: boolean;
|
|
69
|
+
enableHeaderActionHoverOnly: boolean;
|
|
70
|
+
enableFilter: boolean;
|
|
71
|
+
enableRemoteFilter: boolean;
|
|
72
|
+
enableSorter: boolean;
|
|
73
|
+
enableRemoteSorter: boolean;
|
|
74
|
+
enableRowExpanding: boolean;
|
|
75
|
+
enableRowGrouping: boolean;
|
|
76
|
+
isBottomEmpty: boolean;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* 全局静态配置
|
|
80
|
+
* @desc 实际上并不是完全静态,而是指由配置生成后,禁止主动变化
|
|
81
|
+
*/
|
|
82
|
+
export declare function useGlobalStatic(ctx: UseGlobalStaticCtxType): ReadonlyRefObject<GlobalStaticConfigType>;
|
|
83
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useInitialRender(): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EditableSchemaTableCtxType } from '../ctx';
|
|
2
|
+
import type { TableCtxRefType } from '../table';
|
|
3
|
+
type InnerCtxType<TData extends AnyObject = AnyObject> = Omit<EditableSchemaTableCtxType<TData>, 'exposeCtxValueRef'> & Omit<TableCtxRefType<TData>, 'innerRef' | 'scrollIntoView' | 'getDataSource' | 'updateDataSource' | 'resetDataSource' | 'setDataSource' | 'getCellValue' | 'setCellValue' | 'setSelectedRowKeys'>;
|
|
4
|
+
/**
|
|
5
|
+
* 组装内部上下文
|
|
6
|
+
* @desc 没啥特殊逻辑,完全是Table里代码太多了,精简拆分一下
|
|
7
|
+
*/
|
|
8
|
+
export declare function useTableInnerCtx<TData extends AnyObject = AnyObject>(ctx: InnerCtxType<TData>): {
|
|
9
|
+
ctxValue: EditableSchemaTableCtxType<TData>;
|
|
10
|
+
exposeCtxValue: () => TableCtxRefType<TData>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|