@ys-knife-crud/vue 0.0.14 → 0.0.16
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 +1 -0
- package/dist/index.cjs +249 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -6
- package/dist/index.d.ts +60 -6
- package/dist/index.js +226 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { FilterInfo, Operator } from 'ys.knife.query.js';
|
|
|
3
3
|
import * as vue from 'vue';
|
|
4
4
|
import { Ref, Component, InjectionKey, ComponentPublicInstance, AppContext } from 'vue';
|
|
5
5
|
import * as _ys_knife_crud_core from '@ys-knife-crud/core';
|
|
6
|
-
import { DefaultProps, Meta, PagedList, Action, RowActionsProps, CustomConfigProps, CustomColumnConfig, CustomConfig, DraftColumn, PageFunc, ExportApiFunc, Column, ExportOption, ExportScope, DataColumn, ImportProcessor, ImportParser, ImportRow, ImportProcessSummary, FunctionNode, MainPanelProps, FilterItemApi, EnumOptionsSource, AdvancedCombinator, AdvancedOperator, AdvancedConditionGroup, AdvancedFieldType, AdvancedCondition, isConditionGroup, ActionType } from '@ys-knife-crud/core';
|
|
6
|
+
import { DefaultProps, Meta, PagedList, Action, RowActionsProps, CustomConfigProps, CustomColumnConfig, CustomConfig, DraftColumn, PageFunc, ExportApiFunc, Column, ExportOption, ExportScope, CollectorFunc, CollectOpenOptions, DataColumn, ImportProcessor, ImportParser, ImportRow, ImportProcessSummary, FunctionNode, MainPanelProps, FilterItemApi, EnumOptionsSource, AdvancedCombinator, AdvancedOperator, AdvancedConditionGroup, AdvancedFieldType, AdvancedCondition, isConditionGroup, ActionType } from '@ys-knife-crud/core';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 表格的默认状态与数据加载逻辑:列元数据、分页数据、当前页行数据、
|
|
@@ -34,7 +34,8 @@ declare function useDefault(props: DefaultProps): {
|
|
|
34
34
|
displayOrder?: number | undefined;
|
|
35
35
|
dataSource?: unknown | null;
|
|
36
36
|
queryFilter?: unknown | null;
|
|
37
|
-
render?:
|
|
37
|
+
render?: _ys_knife_crud_core.CellRenderer | undefined;
|
|
38
|
+
formatter?: _ys_knife_crud_core.CellFormatter | undefined;
|
|
38
39
|
width?: string | undefined;
|
|
39
40
|
}[];
|
|
40
41
|
} | null, Meta | {
|
|
@@ -51,7 +52,8 @@ declare function useDefault(props: DefaultProps): {
|
|
|
51
52
|
displayOrder?: number | undefined;
|
|
52
53
|
dataSource?: unknown | null;
|
|
53
54
|
queryFilter?: unknown | null;
|
|
54
|
-
render?:
|
|
55
|
+
render?: _ys_knife_crud_core.CellRenderer | undefined;
|
|
56
|
+
formatter?: _ys_knife_crud_core.CellFormatter | undefined;
|
|
55
57
|
width?: string | undefined;
|
|
56
58
|
}[];
|
|
57
59
|
} | null>;
|
|
@@ -195,7 +197,8 @@ declare function useCustomConfig(props: Pick<CustomConfigProps, "loadCustomConfi
|
|
|
195
197
|
displayOrder?: number;
|
|
196
198
|
dataSource?: unknown | null;
|
|
197
199
|
queryFilter?: unknown | null;
|
|
198
|
-
render?:
|
|
200
|
+
render?: _ys_knife_crud_core.CellRenderer;
|
|
201
|
+
formatter?: _ys_knife_crud_core.CellFormatter;
|
|
199
202
|
}[]>;
|
|
200
203
|
loadCustomConfigs: (signal?: AbortSignal) => Promise<void>;
|
|
201
204
|
updateDefaultPageSize: (size: number) => void;
|
|
@@ -225,6 +228,8 @@ interface UseExportExcelOptions {
|
|
|
225
228
|
selectedRows: Ref<unknown[]>;
|
|
226
229
|
/** 数据总条数 */
|
|
227
230
|
total: Ref<number>;
|
|
231
|
+
/** 总条数是否已知(dataFun 返回了 totalCount);已知时「导出所有」选项带「共 N 条」 */
|
|
232
|
+
totalKnown: Ref<boolean>;
|
|
228
233
|
/** 导出所有时分页拉取的步长(独立于界面分页大小,避免用大页尺寸拖慢导出) */
|
|
229
234
|
exportPageSize: Ref<number>;
|
|
230
235
|
/** 是否还有下一页(决定「导出所有」选项是否出现) */
|
|
@@ -244,7 +249,7 @@ interface UseExportExcelOptions {
|
|
|
244
249
|
* (createConsoleExportApiFunc,只在控制台打日志、不产出文件),
|
|
245
250
|
* 真实导出由消费方注入(如 @ys-knife-crud/export-exceljs)。
|
|
246
251
|
*/
|
|
247
|
-
declare function useExportExcel({ props, tableName, columns, currentRows, selectedRows, total, exportPageSize, hasMorePage, pageScopeLabel, }: UseExportExcelOptions): {
|
|
252
|
+
declare function useExportExcel({ props, tableName, columns, currentRows, selectedRows, total, totalKnown, exportPageSize, hasMorePage, pageScopeLabel, }: UseExportExcelOptions): {
|
|
248
253
|
exportOptions: vue.ComputedRef<ExportOption[]>;
|
|
249
254
|
exportDialogVisible: Ref<boolean, boolean>;
|
|
250
255
|
exporting: Ref<boolean, boolean>;
|
|
@@ -262,6 +267,55 @@ declare function useExportExcel({ props, tableName, columns, currentRows, select
|
|
|
262
267
|
discardPartialExport: () => Promise<void>;
|
|
263
268
|
};
|
|
264
269
|
|
|
270
|
+
/** useCollectData 需要从组件 props 中访问的成员 */
|
|
271
|
+
interface CollectProps {
|
|
272
|
+
readonly dataFun: PageFunc<unknown>;
|
|
273
|
+
readonly collectorFunc?: CollectorFunc;
|
|
274
|
+
readonly maxCollectCount: number;
|
|
275
|
+
}
|
|
276
|
+
/** useCollectData 的入参:组件内已有的响应式状态与工具函数 */
|
|
277
|
+
interface UseCollectDataOptions {
|
|
278
|
+
props: CollectProps;
|
|
279
|
+
/** 界面是否显示勾选列——决定「选中」范围是否出现 */
|
|
280
|
+
selectable: Ref<boolean>;
|
|
281
|
+
/** 当前页行数据 */
|
|
282
|
+
currentRows: Ref<Record<string, unknown>[]>;
|
|
283
|
+
/** checkbox 列当前选中的行(跨页累计) */
|
|
284
|
+
selectedRows: Ref<unknown[]>;
|
|
285
|
+
/** 数据总条数(驱动进度条初始分母;响应带回 totalCount 时会被修正) */
|
|
286
|
+
total: Ref<number>;
|
|
287
|
+
/** 总条数是否已知(dataFun 返回了 totalCount);已知时「所有数据」选项带「共 N 条」 */
|
|
288
|
+
totalKnown: Ref<boolean>;
|
|
289
|
+
/** 收集所有时分页拉取的步长(独立于界面分页大小) */
|
|
290
|
+
collectPageSize: Ref<number>;
|
|
291
|
+
/** 是否还有下一页(决定「所有数据」选项是否出现) */
|
|
292
|
+
hasMorePage: Ref<boolean>;
|
|
293
|
+
/** 界面列定义:format=true 时据此对声明了 formatter 的列做值转换 */
|
|
294
|
+
columns: Ref<Column[]>;
|
|
295
|
+
/** 「page」范围的文案前缀;缺省「当前页的数据」 */
|
|
296
|
+
pageScopeLabel?: Ref<string | undefined>;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* 收集数据逻辑:范围选择对话框、逐页拉取并累积、进度与取消。
|
|
300
|
+
*
|
|
301
|
+
* 与 useExportExcel 同构,区别在于不写文件——全部分页拉取完成后,
|
|
302
|
+
* 把原始行对象数组一次性交给 collectorFunc(附范围与截断信息)。
|
|
303
|
+
* 单次收集受 maxCollectCount 上限保护:达到上限即停止并标记 truncated。
|
|
304
|
+
*/
|
|
305
|
+
declare function useCollectData({ props, selectable, currentRows, selectedRows, total, totalKnown, collectPageSize, hasMorePage, columns, pageScopeLabel, }: UseCollectDataOptions): {
|
|
306
|
+
collectOptions: vue.ComputedRef<ExportOption[]>;
|
|
307
|
+
collectDialogVisible: Ref<boolean, boolean>;
|
|
308
|
+
collecting: Ref<boolean, boolean>;
|
|
309
|
+
collectFetched: Ref<number, number>;
|
|
310
|
+
collectTotal: Ref<number, number>;
|
|
311
|
+
collectTotalKnown: Ref<boolean, boolean>;
|
|
312
|
+
collectEtaSeconds: vue.ComputedRef<number | null>;
|
|
313
|
+
collectPercent: vue.ComputedRef<number>;
|
|
314
|
+
onCollectClick: (options?: CollectOpenOptions) => void;
|
|
315
|
+
doCollect: (scope: ExportScope) => Promise<void>;
|
|
316
|
+
cancelCollect: () => void;
|
|
317
|
+
};
|
|
318
|
+
|
|
265
319
|
/** useImportExcel 入参(组件把 props 的相关字段以 Ref 形式传入,保持响应式追踪) */
|
|
266
320
|
interface UseImportExcelOptions {
|
|
267
321
|
/** 列定义(position → name → alias 定位) */
|
|
@@ -779,4 +833,4 @@ interface DialogOptions<P extends Record<string, unknown> = Record<string, unkno
|
|
|
779
833
|
onConfirm?: (handle: ModalHandle, instance: ExtractComponentInstance<C>) => unknown | Promise<unknown>;
|
|
780
834
|
}
|
|
781
835
|
|
|
782
|
-
export { type AdvancedFilterProps, type AdvancedRangeValue, type DateFilterItemProps, type DateRangeFilterItemProps, type DateRangeValue, type DialogOptions, type EnumFilterItemProps, type EnumMultiValue, type EnumSingleValue, type ExtractComponentInstance, type FilterItemRegisterFn, FilterPanelKey, type MainPanelTab, type ModalAction, type ModalHandle, type ModalOptions, type RowRecord, type SelectionTableLike, type TextFilterItemProps, type UseImportExcelOptions, collectGroupKeys, filterNodesByKeyword, findNode, getDefaultModalAppContext, isEnabled, isGroupNode, setDefaultModalAppContext, useAdvancedFilter, useCustomConfig, useDateFilterItem, useDateRangeFilterItem, useDefault, useEnumFilterItem, useExportExcel, useFilterPanel, useImportExcel, useMainPanelNodes, useMainPanelTabs, useRowActions, useSelection, useTextFilterItem, visibleActions };
|
|
836
|
+
export { type AdvancedFilterProps, type AdvancedRangeValue, type DateFilterItemProps, type DateRangeFilterItemProps, type DateRangeValue, type DialogOptions, type EnumFilterItemProps, type EnumMultiValue, type EnumSingleValue, type ExtractComponentInstance, type FilterItemRegisterFn, FilterPanelKey, type MainPanelTab, type ModalAction, type ModalHandle, type ModalOptions, type RowRecord, type SelectionTableLike, type TextFilterItemProps, type UseImportExcelOptions, collectGroupKeys, filterNodesByKeyword, findNode, getDefaultModalAppContext, isEnabled, isGroupNode, setDefaultModalAppContext, useAdvancedFilter, useCollectData, useCustomConfig, useDateFilterItem, useDateRangeFilterItem, useDefault, useEnumFilterItem, useExportExcel, useFilterPanel, useImportExcel, useMainPanelNodes, useMainPanelTabs, useRowActions, useSelection, useTextFilterItem, visibleActions };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { FilterInfo, Operator } from 'ys.knife.query.js';
|
|
|
3
3
|
import * as vue from 'vue';
|
|
4
4
|
import { Ref, Component, InjectionKey, ComponentPublicInstance, AppContext } from 'vue';
|
|
5
5
|
import * as _ys_knife_crud_core from '@ys-knife-crud/core';
|
|
6
|
-
import { DefaultProps, Meta, PagedList, Action, RowActionsProps, CustomConfigProps, CustomColumnConfig, CustomConfig, DraftColumn, PageFunc, ExportApiFunc, Column, ExportOption, ExportScope, DataColumn, ImportProcessor, ImportParser, ImportRow, ImportProcessSummary, FunctionNode, MainPanelProps, FilterItemApi, EnumOptionsSource, AdvancedCombinator, AdvancedOperator, AdvancedConditionGroup, AdvancedFieldType, AdvancedCondition, isConditionGroup, ActionType } from '@ys-knife-crud/core';
|
|
6
|
+
import { DefaultProps, Meta, PagedList, Action, RowActionsProps, CustomConfigProps, CustomColumnConfig, CustomConfig, DraftColumn, PageFunc, ExportApiFunc, Column, ExportOption, ExportScope, CollectorFunc, CollectOpenOptions, DataColumn, ImportProcessor, ImportParser, ImportRow, ImportProcessSummary, FunctionNode, MainPanelProps, FilterItemApi, EnumOptionsSource, AdvancedCombinator, AdvancedOperator, AdvancedConditionGroup, AdvancedFieldType, AdvancedCondition, isConditionGroup, ActionType } from '@ys-knife-crud/core';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 表格的默认状态与数据加载逻辑:列元数据、分页数据、当前页行数据、
|
|
@@ -34,7 +34,8 @@ declare function useDefault(props: DefaultProps): {
|
|
|
34
34
|
displayOrder?: number | undefined;
|
|
35
35
|
dataSource?: unknown | null;
|
|
36
36
|
queryFilter?: unknown | null;
|
|
37
|
-
render?:
|
|
37
|
+
render?: _ys_knife_crud_core.CellRenderer | undefined;
|
|
38
|
+
formatter?: _ys_knife_crud_core.CellFormatter | undefined;
|
|
38
39
|
width?: string | undefined;
|
|
39
40
|
}[];
|
|
40
41
|
} | null, Meta | {
|
|
@@ -51,7 +52,8 @@ declare function useDefault(props: DefaultProps): {
|
|
|
51
52
|
displayOrder?: number | undefined;
|
|
52
53
|
dataSource?: unknown | null;
|
|
53
54
|
queryFilter?: unknown | null;
|
|
54
|
-
render?:
|
|
55
|
+
render?: _ys_knife_crud_core.CellRenderer | undefined;
|
|
56
|
+
formatter?: _ys_knife_crud_core.CellFormatter | undefined;
|
|
55
57
|
width?: string | undefined;
|
|
56
58
|
}[];
|
|
57
59
|
} | null>;
|
|
@@ -195,7 +197,8 @@ declare function useCustomConfig(props: Pick<CustomConfigProps, "loadCustomConfi
|
|
|
195
197
|
displayOrder?: number;
|
|
196
198
|
dataSource?: unknown | null;
|
|
197
199
|
queryFilter?: unknown | null;
|
|
198
|
-
render?:
|
|
200
|
+
render?: _ys_knife_crud_core.CellRenderer;
|
|
201
|
+
formatter?: _ys_knife_crud_core.CellFormatter;
|
|
199
202
|
}[]>;
|
|
200
203
|
loadCustomConfigs: (signal?: AbortSignal) => Promise<void>;
|
|
201
204
|
updateDefaultPageSize: (size: number) => void;
|
|
@@ -225,6 +228,8 @@ interface UseExportExcelOptions {
|
|
|
225
228
|
selectedRows: Ref<unknown[]>;
|
|
226
229
|
/** 数据总条数 */
|
|
227
230
|
total: Ref<number>;
|
|
231
|
+
/** 总条数是否已知(dataFun 返回了 totalCount);已知时「导出所有」选项带「共 N 条」 */
|
|
232
|
+
totalKnown: Ref<boolean>;
|
|
228
233
|
/** 导出所有时分页拉取的步长(独立于界面分页大小,避免用大页尺寸拖慢导出) */
|
|
229
234
|
exportPageSize: Ref<number>;
|
|
230
235
|
/** 是否还有下一页(决定「导出所有」选项是否出现) */
|
|
@@ -244,7 +249,7 @@ interface UseExportExcelOptions {
|
|
|
244
249
|
* (createConsoleExportApiFunc,只在控制台打日志、不产出文件),
|
|
245
250
|
* 真实导出由消费方注入(如 @ys-knife-crud/export-exceljs)。
|
|
246
251
|
*/
|
|
247
|
-
declare function useExportExcel({ props, tableName, columns, currentRows, selectedRows, total, exportPageSize, hasMorePage, pageScopeLabel, }: UseExportExcelOptions): {
|
|
252
|
+
declare function useExportExcel({ props, tableName, columns, currentRows, selectedRows, total, totalKnown, exportPageSize, hasMorePage, pageScopeLabel, }: UseExportExcelOptions): {
|
|
248
253
|
exportOptions: vue.ComputedRef<ExportOption[]>;
|
|
249
254
|
exportDialogVisible: Ref<boolean, boolean>;
|
|
250
255
|
exporting: Ref<boolean, boolean>;
|
|
@@ -262,6 +267,55 @@ declare function useExportExcel({ props, tableName, columns, currentRows, select
|
|
|
262
267
|
discardPartialExport: () => Promise<void>;
|
|
263
268
|
};
|
|
264
269
|
|
|
270
|
+
/** useCollectData 需要从组件 props 中访问的成员 */
|
|
271
|
+
interface CollectProps {
|
|
272
|
+
readonly dataFun: PageFunc<unknown>;
|
|
273
|
+
readonly collectorFunc?: CollectorFunc;
|
|
274
|
+
readonly maxCollectCount: number;
|
|
275
|
+
}
|
|
276
|
+
/** useCollectData 的入参:组件内已有的响应式状态与工具函数 */
|
|
277
|
+
interface UseCollectDataOptions {
|
|
278
|
+
props: CollectProps;
|
|
279
|
+
/** 界面是否显示勾选列——决定「选中」范围是否出现 */
|
|
280
|
+
selectable: Ref<boolean>;
|
|
281
|
+
/** 当前页行数据 */
|
|
282
|
+
currentRows: Ref<Record<string, unknown>[]>;
|
|
283
|
+
/** checkbox 列当前选中的行(跨页累计) */
|
|
284
|
+
selectedRows: Ref<unknown[]>;
|
|
285
|
+
/** 数据总条数(驱动进度条初始分母;响应带回 totalCount 时会被修正) */
|
|
286
|
+
total: Ref<number>;
|
|
287
|
+
/** 总条数是否已知(dataFun 返回了 totalCount);已知时「所有数据」选项带「共 N 条」 */
|
|
288
|
+
totalKnown: Ref<boolean>;
|
|
289
|
+
/** 收集所有时分页拉取的步长(独立于界面分页大小) */
|
|
290
|
+
collectPageSize: Ref<number>;
|
|
291
|
+
/** 是否还有下一页(决定「所有数据」选项是否出现) */
|
|
292
|
+
hasMorePage: Ref<boolean>;
|
|
293
|
+
/** 界面列定义:format=true 时据此对声明了 formatter 的列做值转换 */
|
|
294
|
+
columns: Ref<Column[]>;
|
|
295
|
+
/** 「page」范围的文案前缀;缺省「当前页的数据」 */
|
|
296
|
+
pageScopeLabel?: Ref<string | undefined>;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* 收集数据逻辑:范围选择对话框、逐页拉取并累积、进度与取消。
|
|
300
|
+
*
|
|
301
|
+
* 与 useExportExcel 同构,区别在于不写文件——全部分页拉取完成后,
|
|
302
|
+
* 把原始行对象数组一次性交给 collectorFunc(附范围与截断信息)。
|
|
303
|
+
* 单次收集受 maxCollectCount 上限保护:达到上限即停止并标记 truncated。
|
|
304
|
+
*/
|
|
305
|
+
declare function useCollectData({ props, selectable, currentRows, selectedRows, total, totalKnown, collectPageSize, hasMorePage, columns, pageScopeLabel, }: UseCollectDataOptions): {
|
|
306
|
+
collectOptions: vue.ComputedRef<ExportOption[]>;
|
|
307
|
+
collectDialogVisible: Ref<boolean, boolean>;
|
|
308
|
+
collecting: Ref<boolean, boolean>;
|
|
309
|
+
collectFetched: Ref<number, number>;
|
|
310
|
+
collectTotal: Ref<number, number>;
|
|
311
|
+
collectTotalKnown: Ref<boolean, boolean>;
|
|
312
|
+
collectEtaSeconds: vue.ComputedRef<number | null>;
|
|
313
|
+
collectPercent: vue.ComputedRef<number>;
|
|
314
|
+
onCollectClick: (options?: CollectOpenOptions) => void;
|
|
315
|
+
doCollect: (scope: ExportScope) => Promise<void>;
|
|
316
|
+
cancelCollect: () => void;
|
|
317
|
+
};
|
|
318
|
+
|
|
265
319
|
/** useImportExcel 入参(组件把 props 的相关字段以 Ref 形式传入,保持响应式追踪) */
|
|
266
320
|
interface UseImportExcelOptions {
|
|
267
321
|
/** 列定义(position → name → alias 定位) */
|
|
@@ -779,4 +833,4 @@ interface DialogOptions<P extends Record<string, unknown> = Record<string, unkno
|
|
|
779
833
|
onConfirm?: (handle: ModalHandle, instance: ExtractComponentInstance<C>) => unknown | Promise<unknown>;
|
|
780
834
|
}
|
|
781
835
|
|
|
782
|
-
export { type AdvancedFilterProps, type AdvancedRangeValue, type DateFilterItemProps, type DateRangeFilterItemProps, type DateRangeValue, type DialogOptions, type EnumFilterItemProps, type EnumMultiValue, type EnumSingleValue, type ExtractComponentInstance, type FilterItemRegisterFn, FilterPanelKey, type MainPanelTab, type ModalAction, type ModalHandle, type ModalOptions, type RowRecord, type SelectionTableLike, type TextFilterItemProps, type UseImportExcelOptions, collectGroupKeys, filterNodesByKeyword, findNode, getDefaultModalAppContext, isEnabled, isGroupNode, setDefaultModalAppContext, useAdvancedFilter, useCustomConfig, useDateFilterItem, useDateRangeFilterItem, useDefault, useEnumFilterItem, useExportExcel, useFilterPanel, useImportExcel, useMainPanelNodes, useMainPanelTabs, useRowActions, useSelection, useTextFilterItem, visibleActions };
|
|
836
|
+
export { type AdvancedFilterProps, type AdvancedRangeValue, type DateFilterItemProps, type DateRangeFilterItemProps, type DateRangeValue, type DialogOptions, type EnumFilterItemProps, type EnumMultiValue, type EnumSingleValue, type ExtractComponentInstance, type FilterItemRegisterFn, FilterPanelKey, type MainPanelTab, type ModalAction, type ModalHandle, type ModalOptions, type RowRecord, type SelectionTableLike, type TextFilterItemProps, type UseImportExcelOptions, collectGroupKeys, filterNodesByKeyword, findNode, getDefaultModalAppContext, isEnabled, isGroupNode, setDefaultModalAppContext, useAdvancedFilter, useCollectData, useCustomConfig, useDateFilterItem, useDateRangeFilterItem, useDefault, useEnumFilterItem, useExportExcel, useFilterPanel, useImportExcel, useMainPanelNodes, useMainPanelTabs, useRowActions, useSelection, useTextFilterItem, visibleActions };
|