@ys-knife-crud/core 0.0.14 → 0.0.15

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/index.d.cts CHANGED
@@ -204,6 +204,40 @@ interface ExportExcelProps {
204
204
  readonly exportorFunc?: ExportApiFunc;
205
205
  readonly exportPageSize?: number;
206
206
  }
207
+ /**
208
+ * 收集完成的附加信息(CollectorFunc 的第二个参数):
209
+ * 除收集到的行之外,告知实际范围与是否因上限被截断。
210
+ */
211
+ interface CollectInfo {
212
+ /** 实际收集的数据范围 */
213
+ readonly scope: ExportScope;
214
+ /** 是否因达到 maxCollectCount 上限被截断(true 时 rows 仅为前 maxCollectCount 条) */
215
+ readonly truncated: boolean;
216
+ /** 本次生效的条数上限(= maxCollectCount) */
217
+ readonly maxCount: number;
218
+ }
219
+ /**
220
+ * 收集数据回调:第一个参数是原始行对象数组(完整字段,不按可见列投影),
221
+ * 第二个参数带上范围与截断信息。返回 Promise 时组件会等待其完成。
222
+ */
223
+ type CollectorFunc = (rows: Record<string, unknown>[], info: CollectInfo) => void | Promise<void>;
224
+ /**
225
+ * 收集数据相关 props:外部传入 collectorFunc 后,
226
+ * 可经 TableApi.openCollectDialog() 打开「收集数据」对话框。
227
+ */
228
+ interface CollectProps {
229
+ /** 可选。收集数据回调;未传时该能力不可用(openCollectDialog 为空操作) */
230
+ readonly collectorFunc?: CollectorFunc;
231
+ /**
232
+ * 收集数据对话框标题,默认「收集数据」。
233
+ * 该能力是通用的「取数」通道,可按业务语义自定义,如「打印出库」「批量下载」。
234
+ */
235
+ readonly collectorTitle?: string;
236
+ /** 收集「所有数据」时每次分页拉取的条数,默认 1000(独立于界面分页大小) */
237
+ readonly collectPageSize?: number;
238
+ /** 单次收集的条数上限,达到即截断并回调,默认 10000 */
239
+ readonly maxCollectCount?: number;
240
+ }
207
241
  interface DefaultProps {
208
242
  readonly metaFun: MetaFunc;
209
243
  readonly dataFun: PageFunc<unknown>;
@@ -211,7 +245,7 @@ interface DefaultProps {
211
245
  readonly pageSizes: number[];
212
246
  }
213
247
  /** TableProps 是组件的「输入契约」:父组件通过 props 传入 */
214
- interface TableProps extends RowActionsProps, SelectionProps, ColumnResizeProps, StickyHeaderProps, ViewProps, CustomConfigProps, ExportExcelProps, DefaultProps {
248
+ interface TableProps extends RowActionsProps, SelectionProps, ColumnResizeProps, StickyHeaderProps, ViewProps, CustomConfigProps, ExportExcelProps, CollectProps, DefaultProps {
215
249
  }
216
250
  /**
217
251
  * TableApi 是组件的「输出契约」:组件通过 defineExpose 暴露、
@@ -291,6 +325,11 @@ interface TableApi {
291
325
  * 打开内置导出 Excel 对话框。Table 不渲染入口按钮——由外部自实现按钮经此入口打开对话框。
292
326
  */
293
327
  openExportDialog(): void;
328
+ /**
329
+ * 打开内置「收集数据」对话框(选择范围 → 分页收集 → 回调 collectorFunc)。
330
+ * Table 不渲染入口按钮——由外部自实现按钮经此入口打开对话框。
331
+ */
332
+ openCollectDialog(): void;
294
333
  }
295
334
  /**
296
335
  * 列设置面板里单个可编辑列的草稿(运行时结构):
@@ -696,4 +735,4 @@ interface ImportProcessSummary {
696
735
  stopped: boolean;
697
736
  }
698
737
 
699
- export { type Action, type ActionType, type AdvancedCombinator, type AdvancedCondition, type AdvancedConditionGroup, type AdvancedConditionNode, type AdvancedFieldType, type AdvancedOperator, type Column, type ColumnResizeProps, type CustomColumnConfig, type CustomConfig, type CustomConfigProps, type DataColumn, type DefaultProps, type DraftColumn, type EnumOption, type EnumOptionsSource, type ExportApi, type ExportApiFunc, type ExportExcelProps, type ExportOption, type ExportScope, FIELD_TYPE_OPERATORS, type FilterItemApi, type FilterPanelApi, type FilterPanelProps, type FunctionNode, type FunctionNodesFunc, type ImportParser, type ImportProcessSummary, type ImportProcessor, type ImportRow, type ImportRowProcessor, type ImportRowResult, type ImportRowStatus, type ImportSheet, type ImportSheetRow, type ListFunc, type MainPanelComponentMap, type MainPanelProps, type Meta, type MetaFunc, OPERATOR_LABELS, type RowActionsFunc, type RowActionsProps, type SelectionProps, type StickyHeaderProps, type TableAction, type TableApi, type TableProps, type ViewMode, type ViewProps, batchProcessor, constActions, constConfig, constData, constMetaFunc, createConsoleExportApiFunc, defaultOperatorForType, emptyActions, emptyConfig, emptyData, fromArray, fromBool, fromObjectItems, fromOptions, inferColumnFieldType, inferFieldType, isConditionGroup, isMultiValueOperator, isNullOperator, isRangeOperator, listData, type loadCustomConfigFunc, loadLocalStorageConfig, mergeConfigs, type saveCustomConfigFunc, saveLocalStorageConfig, singleRowProcessor };
738
+ export { type Action, type ActionType, type AdvancedCombinator, type AdvancedCondition, type AdvancedConditionGroup, type AdvancedConditionNode, type AdvancedFieldType, type AdvancedOperator, type CollectInfo, type CollectProps, type CollectorFunc, type Column, type ColumnResizeProps, type CustomColumnConfig, type CustomConfig, type CustomConfigProps, type DataColumn, type DefaultProps, type DraftColumn, type EnumOption, type EnumOptionsSource, type ExportApi, type ExportApiFunc, type ExportExcelProps, type ExportOption, type ExportScope, FIELD_TYPE_OPERATORS, type FilterItemApi, type FilterPanelApi, type FilterPanelProps, type FunctionNode, type FunctionNodesFunc, type ImportParser, type ImportProcessSummary, type ImportProcessor, type ImportRow, type ImportRowProcessor, type ImportRowResult, type ImportRowStatus, type ImportSheet, type ImportSheetRow, type ListFunc, type MainPanelComponentMap, type MainPanelProps, type Meta, type MetaFunc, OPERATOR_LABELS, type RowActionsFunc, type RowActionsProps, type SelectionProps, type StickyHeaderProps, type TableAction, type TableApi, type TableProps, type ViewMode, type ViewProps, batchProcessor, constActions, constConfig, constData, constMetaFunc, createConsoleExportApiFunc, defaultOperatorForType, emptyActions, emptyConfig, emptyData, fromArray, fromBool, fromObjectItems, fromOptions, inferColumnFieldType, inferFieldType, isConditionGroup, isMultiValueOperator, isNullOperator, isRangeOperator, listData, type loadCustomConfigFunc, loadLocalStorageConfig, mergeConfigs, type saveCustomConfigFunc, saveLocalStorageConfig, singleRowProcessor };
package/dist/index.d.ts CHANGED
@@ -204,6 +204,40 @@ interface ExportExcelProps {
204
204
  readonly exportorFunc?: ExportApiFunc;
205
205
  readonly exportPageSize?: number;
206
206
  }
207
+ /**
208
+ * 收集完成的附加信息(CollectorFunc 的第二个参数):
209
+ * 除收集到的行之外,告知实际范围与是否因上限被截断。
210
+ */
211
+ interface CollectInfo {
212
+ /** 实际收集的数据范围 */
213
+ readonly scope: ExportScope;
214
+ /** 是否因达到 maxCollectCount 上限被截断(true 时 rows 仅为前 maxCollectCount 条) */
215
+ readonly truncated: boolean;
216
+ /** 本次生效的条数上限(= maxCollectCount) */
217
+ readonly maxCount: number;
218
+ }
219
+ /**
220
+ * 收集数据回调:第一个参数是原始行对象数组(完整字段,不按可见列投影),
221
+ * 第二个参数带上范围与截断信息。返回 Promise 时组件会等待其完成。
222
+ */
223
+ type CollectorFunc = (rows: Record<string, unknown>[], info: CollectInfo) => void | Promise<void>;
224
+ /**
225
+ * 收集数据相关 props:外部传入 collectorFunc 后,
226
+ * 可经 TableApi.openCollectDialog() 打开「收集数据」对话框。
227
+ */
228
+ interface CollectProps {
229
+ /** 可选。收集数据回调;未传时该能力不可用(openCollectDialog 为空操作) */
230
+ readonly collectorFunc?: CollectorFunc;
231
+ /**
232
+ * 收集数据对话框标题,默认「收集数据」。
233
+ * 该能力是通用的「取数」通道,可按业务语义自定义,如「打印出库」「批量下载」。
234
+ */
235
+ readonly collectorTitle?: string;
236
+ /** 收集「所有数据」时每次分页拉取的条数,默认 1000(独立于界面分页大小) */
237
+ readonly collectPageSize?: number;
238
+ /** 单次收集的条数上限,达到即截断并回调,默认 10000 */
239
+ readonly maxCollectCount?: number;
240
+ }
207
241
  interface DefaultProps {
208
242
  readonly metaFun: MetaFunc;
209
243
  readonly dataFun: PageFunc<unknown>;
@@ -211,7 +245,7 @@ interface DefaultProps {
211
245
  readonly pageSizes: number[];
212
246
  }
213
247
  /** TableProps 是组件的「输入契约」:父组件通过 props 传入 */
214
- interface TableProps extends RowActionsProps, SelectionProps, ColumnResizeProps, StickyHeaderProps, ViewProps, CustomConfigProps, ExportExcelProps, DefaultProps {
248
+ interface TableProps extends RowActionsProps, SelectionProps, ColumnResizeProps, StickyHeaderProps, ViewProps, CustomConfigProps, ExportExcelProps, CollectProps, DefaultProps {
215
249
  }
216
250
  /**
217
251
  * TableApi 是组件的「输出契约」:组件通过 defineExpose 暴露、
@@ -291,6 +325,11 @@ interface TableApi {
291
325
  * 打开内置导出 Excel 对话框。Table 不渲染入口按钮——由外部自实现按钮经此入口打开对话框。
292
326
  */
293
327
  openExportDialog(): void;
328
+ /**
329
+ * 打开内置「收集数据」对话框(选择范围 → 分页收集 → 回调 collectorFunc)。
330
+ * Table 不渲染入口按钮——由外部自实现按钮经此入口打开对话框。
331
+ */
332
+ openCollectDialog(): void;
294
333
  }
295
334
  /**
296
335
  * 列设置面板里单个可编辑列的草稿(运行时结构):
@@ -696,4 +735,4 @@ interface ImportProcessSummary {
696
735
  stopped: boolean;
697
736
  }
698
737
 
699
- export { type Action, type ActionType, type AdvancedCombinator, type AdvancedCondition, type AdvancedConditionGroup, type AdvancedConditionNode, type AdvancedFieldType, type AdvancedOperator, type Column, type ColumnResizeProps, type CustomColumnConfig, type CustomConfig, type CustomConfigProps, type DataColumn, type DefaultProps, type DraftColumn, type EnumOption, type EnumOptionsSource, type ExportApi, type ExportApiFunc, type ExportExcelProps, type ExportOption, type ExportScope, FIELD_TYPE_OPERATORS, type FilterItemApi, type FilterPanelApi, type FilterPanelProps, type FunctionNode, type FunctionNodesFunc, type ImportParser, type ImportProcessSummary, type ImportProcessor, type ImportRow, type ImportRowProcessor, type ImportRowResult, type ImportRowStatus, type ImportSheet, type ImportSheetRow, type ListFunc, type MainPanelComponentMap, type MainPanelProps, type Meta, type MetaFunc, OPERATOR_LABELS, type RowActionsFunc, type RowActionsProps, type SelectionProps, type StickyHeaderProps, type TableAction, type TableApi, type TableProps, type ViewMode, type ViewProps, batchProcessor, constActions, constConfig, constData, constMetaFunc, createConsoleExportApiFunc, defaultOperatorForType, emptyActions, emptyConfig, emptyData, fromArray, fromBool, fromObjectItems, fromOptions, inferColumnFieldType, inferFieldType, isConditionGroup, isMultiValueOperator, isNullOperator, isRangeOperator, listData, type loadCustomConfigFunc, loadLocalStorageConfig, mergeConfigs, type saveCustomConfigFunc, saveLocalStorageConfig, singleRowProcessor };
738
+ export { type Action, type ActionType, type AdvancedCombinator, type AdvancedCondition, type AdvancedConditionGroup, type AdvancedConditionNode, type AdvancedFieldType, type AdvancedOperator, type CollectInfo, type CollectProps, type CollectorFunc, type Column, type ColumnResizeProps, type CustomColumnConfig, type CustomConfig, type CustomConfigProps, type DataColumn, type DefaultProps, type DraftColumn, type EnumOption, type EnumOptionsSource, type ExportApi, type ExportApiFunc, type ExportExcelProps, type ExportOption, type ExportScope, FIELD_TYPE_OPERATORS, type FilterItemApi, type FilterPanelApi, type FilterPanelProps, type FunctionNode, type FunctionNodesFunc, type ImportParser, type ImportProcessSummary, type ImportProcessor, type ImportRow, type ImportRowProcessor, type ImportRowResult, type ImportRowStatus, type ImportSheet, type ImportSheetRow, type ListFunc, type MainPanelComponentMap, type MainPanelProps, type Meta, type MetaFunc, OPERATOR_LABELS, type RowActionsFunc, type RowActionsProps, type SelectionProps, type StickyHeaderProps, type TableAction, type TableApi, type TableProps, type ViewMode, type ViewProps, batchProcessor, constActions, constConfig, constData, constMetaFunc, createConsoleExportApiFunc, defaultOperatorForType, emptyActions, emptyConfig, emptyData, fromArray, fromBool, fromObjectItems, fromOptions, inferColumnFieldType, inferFieldType, isConditionGroup, isMultiValueOperator, isNullOperator, isRangeOperator, listData, type loadCustomConfigFunc, loadLocalStorageConfig, mergeConfigs, type saveCustomConfigFunc, saveLocalStorageConfig, singleRowProcessor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ys-knife-crud/core",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Framework-agnostic CRUD core: data source contract, in-memory implementation and queryable CRUD manager",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",