@univerjs-pro/bases 1.0.0-alpha.8 → 1.0.0-beta.0
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/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/pl-PL.js +1 -1
- package/lib/cjs/locale/pt-BR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/locale/ar-SA.js +1 -1
- package/lib/es/locale/ca-ES.js +1 -1
- package/lib/es/locale/de-DE.js +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/es-ES.js +1 -1
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/id-ID.js +1 -1
- package/lib/es/locale/it-IT.js +1 -1
- package/lib/es/locale/ja-JP.js +1 -1
- package/lib/es/locale/ko-KR.js +1 -1
- package/lib/es/locale/pl-PL.js +1 -1
- package/lib/es/locale/pt-BR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/sk-SK.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/ar-SA.js +1 -1
- package/lib/locale/ca-ES.js +1 -1
- package/lib/locale/de-DE.js +1 -1
- package/lib/locale/en-US.js +1 -1
- package/lib/locale/es-ES.js +1 -1
- package/lib/locale/fa-IR.js +1 -1
- package/lib/locale/fr-FR.js +1 -1
- package/lib/locale/id-ID.js +1 -1
- package/lib/locale/it-IT.js +1 -1
- package/lib/locale/ja-JP.js +1 -1
- package/lib/locale/ko-KR.js +1 -1
- package/lib/locale/pl-PL.js +1 -1
- package/lib/locale/pt-BR.js +1 -1
- package/lib/locale/ru-RU.js +1 -1
- package/lib/locale/sk-SK.js +1 -1
- package/lib/locale/vi-VN.js +1 -1
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/lib/types/commands/commands/batch-create-base-records.command.d.ts +2 -0
- package/lib/types/commands/commands/batch-delete-base-records.command.d.ts +2 -0
- package/lib/types/commands/commands/create-base-child-record.command.d.ts +15 -0
- package/lib/types/commands/commands/create-base-record.command.d.ts +2 -0
- package/lib/types/commands/commands/delete-base-record.command.d.ts +2 -0
- package/lib/types/commands/commands/duplicate-base-record.command.d.ts +2 -0
- package/lib/types/commands/commands/move-base-hierarchy-record.command.d.ts +17 -0
- package/lib/types/commands/commands/set-base-range-values.command.d.ts +8 -1
- package/lib/types/commands/commands/set-base-record-values.command.d.ts +2 -0
- package/lib/types/commands/commands/set-base-table-hierarchy-field.command.d.ts +9 -0
- package/lib/types/commands/commands/update-base-cell.command.d.ts +2 -0
- package/lib/types/commands/commands/update-base-view-conditional-color-rules.command.d.ts +32 -0
- package/lib/types/commands/mutations/apply-base-json1.mutation.d.ts +4 -0
- package/lib/types/commands/utils/base-record-creation.d.ts +18 -0
- package/lib/types/commands/utils/base-validation.d.ts +6 -1
- package/lib/types/facade/f-base.d.ts +3 -2
- package/lib/types/facade/f-enum.d.ts +206 -2
- package/lib/types/facade/f-event.d.ts +102 -0
- package/lib/types/facade/f-field.d.ts +6 -6
- package/lib/types/facade/f-range.d.ts +4 -1
- package/lib/types/facade/f-record.d.ts +325 -1
- package/lib/types/facade/f-table.d.ts +246 -9
- package/lib/types/facade/f-univer.d.ts +2 -0
- package/lib/types/facade/f-view.d.ts +179 -3
- package/lib/types/facade/field-key.d.ts +3 -1
- package/lib/types/fields/date-format.d.ts +20 -1
- package/lib/types/fields/field-core-plugin.d.ts +7 -4
- package/lib/types/fields/field-stat.d.ts +10 -0
- package/lib/types/fields/progress-format.d.ts +1 -0
- package/lib/types/index.d.ts +19 -2
- package/lib/types/locale/en-US.d.ts +1 -1
- package/lib/types/models/base-hierarchy.d.ts +108 -0
- package/lib/types/models/record-link.d.ts +14 -0
- package/lib/types/ot/json1-op-applier.d.ts +3 -1
- package/lib/types/ot/json1-util.d.ts +2 -2
- package/lib/types/services/base-command.service.d.ts +1 -0
- package/lib/types/services/base-projection.service.d.ts +4 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +7 -7
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IBaseTableSearchRequest, IBaseTableSearchResult } from '@univerjs-pro/bases';
|
|
2
2
|
import type { IHostExternalReference } from '@univerjs-pro/engine-formula';
|
|
3
|
-
import type { BaseCellValue, BaseDataModel, BaseFilterOperator, FieldId, IFieldSnapshot, Injector, IRecordSnapshot, ISortConfig, ITableSnapshot, IViewSnapshot } from '@univerjs/core';
|
|
3
|
+
import type { BaseCellValue, BaseDataModel, BaseFilterOperator, FieldId, IFieldSnapshot, Injector, IRecordLinkFieldConfig, IRecordSnapshot, ISortConfig, ITableSnapshot, IViewSnapshot } from '@univerjs/core';
|
|
4
4
|
import type { FBase } from './f-base';
|
|
5
|
-
import {
|
|
5
|
+
import { IBaseProjectionService } from '@univerjs-pro/bases';
|
|
6
|
+
import { BaseFieldType, BaseFilterConjunction, BaseViewType, ICommandService } from '@univerjs/core';
|
|
6
7
|
import { FBaseTableField } from './f-field';
|
|
7
8
|
import { FBaseTableRange } from './f-range';
|
|
8
9
|
import { FBaseTableRecord } from './f-record';
|
|
@@ -62,6 +63,23 @@ export interface IBaseAddFormulaFieldOptions extends IBaseAddFieldOptions {
|
|
|
62
63
|
*/
|
|
63
64
|
externalReferences: readonly IHostExternalReference[];
|
|
64
65
|
}
|
|
66
|
+
export interface IBaseAddRecordLinkFieldOptions {
|
|
67
|
+
/** Optional insertion index in the source table's field order. */
|
|
68
|
+
index?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Required RecordLink field definition.
|
|
71
|
+
*
|
|
72
|
+
* `config.targetTableId` must identify another table in this Base and
|
|
73
|
+
* `config.multiple` selects single-link or multi-link behavior.
|
|
74
|
+
* `config.displayFieldId` selects the one target field used as the visible label;
|
|
75
|
+
* it defaults to the target table's primary field. `config.pickerFieldIds` adds
|
|
76
|
+
* ordered secondary context to the picker only. All configured field IDs must
|
|
77
|
+
* reference existing, non-system fields in the target table.
|
|
78
|
+
*/
|
|
79
|
+
field: Partial<Omit<IFieldSnapshot, 'id' | 'type' | 'config'>> & {
|
|
80
|
+
config: IRecordLinkFieldConfig;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
65
83
|
/**
|
|
66
84
|
* Facade API object bound to a Base table.
|
|
67
85
|
*
|
|
@@ -154,7 +172,9 @@ export declare class FBaseTable {
|
|
|
154
172
|
private readonly _base;
|
|
155
173
|
private readonly _tableId;
|
|
156
174
|
private readonly _injector;
|
|
157
|
-
|
|
175
|
+
private readonly _commandService;
|
|
176
|
+
private readonly _projectionService;
|
|
177
|
+
constructor(_base: FBase, _tableId: string, _injector: Injector, _commandService: ICommandService, _projectionService: IBaseProjectionService);
|
|
158
178
|
/**
|
|
159
179
|
* Get the table's parent Base data model.
|
|
160
180
|
* @returns {BaseDataModel} The Base data model.
|
|
@@ -188,6 +208,96 @@ export declare class FBaseTable {
|
|
|
188
208
|
* ```
|
|
189
209
|
*/
|
|
190
210
|
getId(): string;
|
|
211
|
+
/**
|
|
212
|
+
* Get the field id used by this table's record hierarchy.
|
|
213
|
+
*
|
|
214
|
+
* Record hierarchy is a table-level capability. Every Grid or Kanban view of
|
|
215
|
+
* the table observes the same Parent relationship; a view does not enable or
|
|
216
|
+
* own hierarchy separately.
|
|
217
|
+
*
|
|
218
|
+
* Before the first hierarchy write, this method returns a deterministic virtual
|
|
219
|
+
* field id. Passing that id to `addRecord()`, `addRecords()`,
|
|
220
|
+
* `FBaseTableRecord.addChild()`, or `FBaseTableRecord.setParent()` creates the
|
|
221
|
+
* same-table, single-value RecordLink field and applies the record change in one
|
|
222
|
+
* command and one Undo entry.
|
|
223
|
+
* Therefore, `getFieldById(getHierarchyFieldId())` may return `null` until the
|
|
224
|
+
* first successful write.
|
|
225
|
+
*
|
|
226
|
+
* @returns {string} The materialized Parent field id, or the deterministic id
|
|
227
|
+
* that the first hierarchy write will materialize.
|
|
228
|
+
* @example Create the first child without creating a field manually
|
|
229
|
+
* ```ts
|
|
230
|
+
* const base = univerAPI.getActiveBase();
|
|
231
|
+
* if (!base) throw new Error('No active Base.');
|
|
232
|
+
*
|
|
233
|
+
* const table = base.getTableById('tasks');
|
|
234
|
+
* if (!table) throw new Error('Tasks table not found.');
|
|
235
|
+
*
|
|
236
|
+
* const parent = table.getRecordById('task-1');
|
|
237
|
+
* if (!parent) throw new Error('Parent record not found.');
|
|
238
|
+
*
|
|
239
|
+
* const parentFieldId = table.getHierarchyFieldId();
|
|
240
|
+
* console.log(table.getFieldById(parentFieldId)); // null before the first write
|
|
241
|
+
*
|
|
242
|
+
* const child = parent.addChild(parentFieldId, {
|
|
243
|
+
* [table.getPrimaryFieldId()]: 'Write integration tests',
|
|
244
|
+
* });
|
|
245
|
+
*
|
|
246
|
+
* console.log(table.getFieldById(parentFieldId)?.getId()); // parentFieldId
|
|
247
|
+
* console.log(child.getParent(parentFieldId)?.getId()); // 'task-1'
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
getHierarchyFieldId(): string;
|
|
251
|
+
/**
|
|
252
|
+
* Select or clear the table's materialized Parent field.
|
|
253
|
+
*
|
|
254
|
+
* The selected field must already exist and must be a RecordLink that targets
|
|
255
|
+
* this table with `multiple: false`. The command assigns the Parent semantic
|
|
256
|
+
* role to that field and removes the role from the previous Parent field.
|
|
257
|
+
* Stored RecordLink values are not rewritten.
|
|
258
|
+
*
|
|
259
|
+
* Passing `null` clears the semantic role and flattens the effective hierarchy.
|
|
260
|
+
* It does not delete the former field or its values. Because hierarchy is a
|
|
261
|
+
* default table capability, `getHierarchyFieldId()` will then return a new
|
|
262
|
+
* deterministic virtual id for a future hierarchy write.
|
|
263
|
+
*
|
|
264
|
+
* Grid and Kanban views consume the table-level relationship automatically;
|
|
265
|
+
* there is no per-view activation API.
|
|
266
|
+
*
|
|
267
|
+
* @param {string | null} fieldId An eligible RecordLink field id, or `null` to
|
|
268
|
+
* clear the currently materialized Parent role.
|
|
269
|
+
* @returns {boolean} `true` when the command succeeds. The change is undoable.
|
|
270
|
+
* @throws {BaseHierarchyError} With
|
|
271
|
+
* `univerAPI.Enum.BaseHierarchyErrorCode.InvalidField` when `fieldId` is not an
|
|
272
|
+
* existing same-table, single-value RecordLink field.
|
|
273
|
+
* @example Use an existing RecordLink field as Parent
|
|
274
|
+
* ```ts
|
|
275
|
+
* import { BaseHierarchyError } from '@univerjs-pro/bases';
|
|
276
|
+
*
|
|
277
|
+
* const base = univerAPI.getActiveBase();
|
|
278
|
+
* if (!base) throw new Error('No active Base.');
|
|
279
|
+
*
|
|
280
|
+
* const table = base.getTableById('tasks');
|
|
281
|
+
* if (!table) throw new Error('Tasks table not found.');
|
|
282
|
+
*
|
|
283
|
+
* try {
|
|
284
|
+
* table.setHierarchyField('parent-record-link');
|
|
285
|
+
* } catch (error) {
|
|
286
|
+
* if (
|
|
287
|
+
* error instanceof BaseHierarchyError &&
|
|
288
|
+
* error.code === univerAPI.Enum.BaseHierarchyErrorCode.InvalidField
|
|
289
|
+
* ) {
|
|
290
|
+
* console.error('The Parent field must link to one record in the same table.');
|
|
291
|
+
* } else {
|
|
292
|
+
* throw error;
|
|
293
|
+
* }
|
|
294
|
+
* }
|
|
295
|
+
*
|
|
296
|
+
* // Later, flatten the table without deleting the RecordLink field or its values.
|
|
297
|
+
* table.setHierarchyField(null);
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
setHierarchyField(fieldId: string | null): boolean;
|
|
191
301
|
/**
|
|
192
302
|
* Get the table name.
|
|
193
303
|
* @returns {string} The table name.
|
|
@@ -298,7 +408,7 @@ export declare class FBaseTable {
|
|
|
298
408
|
/**
|
|
299
409
|
* Add a field to this table.
|
|
300
410
|
* @param {string} name The field display name.
|
|
301
|
-
* @param {BaseFieldType} type The field type, such as `text`, `number`, `singleSelect`, or `formula`.
|
|
411
|
+
* @param {BaseFieldType} type The field type, such as `text`, `number`, `singleSelect`, `recordLink`, or `formula`.
|
|
302
412
|
* @param {object} [options] Optional field parameters.
|
|
303
413
|
* @param {number} [options.index] Optional insertion index in the table field order.
|
|
304
414
|
* @param {Partial<Omit<IFieldSnapshot, 'id'>>} [options.field] Optional partial field snapshot to merge into the new field.
|
|
@@ -335,6 +445,41 @@ export declare class FBaseTable {
|
|
|
335
445
|
* console.log(field);
|
|
336
446
|
* ```
|
|
337
447
|
*
|
|
448
|
+
* @example RecordLink field
|
|
449
|
+
* ```ts
|
|
450
|
+
* const fBase = univerAPI.getActiveBase();
|
|
451
|
+
* const tasks = fBase.getTableById('tasks-table');
|
|
452
|
+
* const projects = fBase.getTableById('projects-table');
|
|
453
|
+
* if (!tasks || !projects) {
|
|
454
|
+
* throw new Error('Expected the Tasks and Projects tables.');
|
|
455
|
+
* }
|
|
456
|
+
* const ownerField = projects.getFieldByName('Owner');
|
|
457
|
+
*
|
|
458
|
+
* const relatedProjects = tasks.addField(
|
|
459
|
+
* 'Related projects',
|
|
460
|
+
* univerAPI.Enum.BaseFieldType.RecordLink,
|
|
461
|
+
* {
|
|
462
|
+
* field: {
|
|
463
|
+
* config: {
|
|
464
|
+
* targetTableId: projects.getId(),
|
|
465
|
+
* multiple: true,
|
|
466
|
+
* // One field supplies the visible chip label. Omit this to use
|
|
467
|
+
* // the target table's primary field.
|
|
468
|
+
* displayFieldId: projects.getPrimaryFieldId(),
|
|
469
|
+
* // These fields appear below the label in the picker only.
|
|
470
|
+
* pickerFieldIds: ownerField ? [ownerField.getId()] : [],
|
|
471
|
+
* },
|
|
472
|
+
* },
|
|
473
|
+
* }
|
|
474
|
+
* );
|
|
475
|
+
*
|
|
476
|
+
* const task = tasks.getRecordById('task-1');
|
|
477
|
+
* const project = projects.getRecordById('project-1');
|
|
478
|
+
* if (task && project) {
|
|
479
|
+
* task.addLinkedRecord(relatedProjects.getId(), project.getId());
|
|
480
|
+
* }
|
|
481
|
+
* ```
|
|
482
|
+
*
|
|
338
483
|
* @example Formula field
|
|
339
484
|
* ```ts
|
|
340
485
|
* const fBase = univerAPI.getActiveBase();
|
|
@@ -416,8 +561,9 @@ export declare class FBaseTable {
|
|
|
416
561
|
* ```
|
|
417
562
|
*/
|
|
418
563
|
addField(name: string, type: BaseFieldType.Formula, options: IBaseAddFormulaFieldOptions): FBaseTableField;
|
|
419
|
-
addField(name: string, type:
|
|
420
|
-
addField(name: string, type: BaseFieldType, options
|
|
564
|
+
addField(name: string, type: BaseFieldType.RecordLink, options: IBaseAddRecordLinkFieldOptions): FBaseTableField;
|
|
565
|
+
addField(name: string, type: Exclude<BaseFieldType, BaseFieldType.Formula | BaseFieldType.RecordLink>, options?: IBaseAddFieldOptions): FBaseTableField;
|
|
566
|
+
addField(name: string, type: BaseFieldType, options: IBaseAddFieldOptions | IBaseAddFormulaFieldOptions | IBaseAddRecordLinkFieldOptions): FBaseTableField;
|
|
421
567
|
/**
|
|
422
568
|
* Get all records in this table, optionally filtered, sorted, and paginated.
|
|
423
569
|
* @returns {FBaseTableRecord[]} An array of record facades ordered by the table record order.
|
|
@@ -470,11 +616,35 @@ export declare class FBaseTable {
|
|
|
470
616
|
*/
|
|
471
617
|
queryRecords(options?: IListRecordOptions): IQueryRecordsResult;
|
|
472
618
|
/**
|
|
473
|
-
* Add a record to this table.
|
|
619
|
+
* Add a record to this table synchronously.
|
|
620
|
+
*
|
|
621
|
+
* This method is also the low-level, data-oriented way to create a child record:
|
|
622
|
+
* use the id returned by `getHierarchyFieldId()` as a value key and use the
|
|
623
|
+
* parent's record id as its value. The call does not require `await`. If the
|
|
624
|
+
* table has not created its canonical Parent field yet, the command creates the
|
|
625
|
+
* same-table, single-value RecordLink field, the record, and the Parent edge as
|
|
626
|
+
* one JSON1 operation and one Undo entry. No observer can see an intermediate
|
|
627
|
+
* field-only or record-only state.
|
|
628
|
+
*
|
|
629
|
+
* Parent values use the same canonical storage format as a single-value
|
|
630
|
+
* RecordLink: pass one record id string. Hierarchy validation rejects a missing
|
|
631
|
+
* parent, self-parent, cycle, or hierarchy deeper than five levels before any
|
|
632
|
+
* mutation is committed. `parent.addChild()` remains available as a semantic
|
|
633
|
+
* convenience when code already has the parent record Facade.
|
|
634
|
+
*
|
|
635
|
+
* The virtual Parent field has no display name until the first write. Therefore,
|
|
636
|
+
* address it by id and keep the default `BaseFieldKeyEnum.Id`; other ordinary
|
|
637
|
+
* fields may still be resolved by name in a separate call.
|
|
638
|
+
*
|
|
474
639
|
* @param {Record<FieldId, BaseCellValue>} values The record field values, keyed by field id or name.
|
|
475
640
|
* @param {BaseFieldKeyEnum} [fieldKey] Optional field key type for the values. Defaults to `id`.
|
|
476
641
|
* @param {Partial<Omit<IRecordSnapshot, 'id'>>} [record] Optional partial record snapshot to merge into the new record.
|
|
477
|
-
* @returns {FBaseTableRecord} The new record
|
|
642
|
+
* @returns {FBaseTableRecord} The new record Facade immediately after the
|
|
643
|
+
* synchronous command succeeds.
|
|
644
|
+
* @throws {BaseHierarchyError} If an initial Parent value is missing, cyclic,
|
|
645
|
+
* self-referential, or would exceed five levels.
|
|
646
|
+
* @throws {Error} If another record or field value is invalid, or the atomic
|
|
647
|
+
* command cannot be applied.
|
|
478
648
|
*
|
|
479
649
|
* @example
|
|
480
650
|
* ```ts
|
|
@@ -522,16 +692,64 @@ export declare class FBaseTable {
|
|
|
522
692
|
* const record = fBaseTable.addRecord(values);
|
|
523
693
|
* console.log(record);
|
|
524
694
|
* ```
|
|
695
|
+
*
|
|
696
|
+
* @example Create the first child with the generic record API (no `await`)
|
|
697
|
+
* ```ts
|
|
698
|
+
* const base = univerAPI.getActiveBase();
|
|
699
|
+
* if (!base) throw new Error('No active Base.');
|
|
700
|
+
*
|
|
701
|
+
* const table = base.getTableById('tasks');
|
|
702
|
+
* if (!table) throw new Error('Tasks table not found.');
|
|
703
|
+
*
|
|
704
|
+
* const parent = table.getRecordById('task-1');
|
|
705
|
+
* if (!parent) throw new Error('Parent record not found.');
|
|
706
|
+
*
|
|
707
|
+
* const parentFieldId = table.getHierarchyFieldId();
|
|
708
|
+
* const child = table.addRecord({
|
|
709
|
+
* [table.getPrimaryFieldId()]: 'Write integration tests',
|
|
710
|
+
* [parentFieldId]: parent.getId(),
|
|
711
|
+
* });
|
|
712
|
+
*
|
|
713
|
+
* console.log(child.getParent(parentFieldId)?.getId()); // 'task-1'
|
|
714
|
+
* console.log(parent.getChildren(parentFieldId).map((item) => item.getId()));
|
|
715
|
+
* ```
|
|
716
|
+
*
|
|
717
|
+
* @example Add a record with a public URL attachment
|
|
718
|
+
* ```ts
|
|
719
|
+
* const fBase = univerAPI.getActiveBase();
|
|
720
|
+
* const fBaseTable = fBase.getTableById('table-1');
|
|
721
|
+
* const imageField = fBaseTable.getFieldByName('Product image');
|
|
722
|
+
* const record = fBaseTable.addRecord({
|
|
723
|
+
* [fBaseTable.getPrimaryFieldId()]: 'Red Nail Polish',
|
|
724
|
+
* [imageField.getId()]: [{
|
|
725
|
+
* id: 'product-image',
|
|
726
|
+
* name: 'product.webp',
|
|
727
|
+
* source: 'https://example.com/product.webp',
|
|
728
|
+
* sourceType: univerAPI.Enum.ImageSourceType.URL,
|
|
729
|
+
* mimeType: 'image/webp'
|
|
730
|
+
* }]
|
|
731
|
+
* });
|
|
732
|
+
* console.log(record);
|
|
733
|
+
* ```
|
|
525
734
|
*/
|
|
526
735
|
addRecord(values: Record<FieldId, BaseCellValue>, fieldKey?: BaseFieldKeyEnum, record?: Partial<Omit<IRecordSnapshot, 'id'>>): FBaseTableRecord;
|
|
527
736
|
/**
|
|
528
737
|
* Add multiple records to this table.
|
|
738
|
+
*
|
|
739
|
+
* Each initial Parent value is validated before the batch is applied. The first
|
|
740
|
+
* batch may use the virtual id returned by `getHierarchyFieldId()`; the Parent
|
|
741
|
+
* field is then materialized once in the same atomic command.
|
|
742
|
+
* Every accepted Parent edge is included in one atomic hierarchy event with
|
|
743
|
+
* `Facade` source, and Undo removes the records and those edges together.
|
|
744
|
+
*
|
|
529
745
|
* @param {Array<{
|
|
530
746
|
* values: Record<FieldId, BaseCellValue>;
|
|
531
747
|
* fieldKey?: BaseFieldKeyEnum;
|
|
532
748
|
* record?: Partial<Omit<IRecordSnapshot, 'id'>>;
|
|
533
749
|
* }>} records An array of record values, optional field key types, and optional partial record snapshots.
|
|
534
|
-
* @returns {FBaseTableRecord[]}
|
|
750
|
+
* @returns {FBaseTableRecord[]} The created record Facades immediately after
|
|
751
|
+
* the synchronous command succeeds.
|
|
752
|
+
* @throws {BaseHierarchyError} If any initial Parent value is invalid.
|
|
535
753
|
* @example
|
|
536
754
|
* ```ts
|
|
537
755
|
* const fBase = univerAPI.getActiveBase();
|
|
@@ -542,6 +760,25 @@ export declare class FBaseTable {
|
|
|
542
760
|
* ]);
|
|
543
761
|
* console.log(records);
|
|
544
762
|
* ```
|
|
763
|
+
* @example Create sibling records below one parent in a single Undo entry
|
|
764
|
+
* ```ts
|
|
765
|
+
* const base = univerAPI.getActiveBase();
|
|
766
|
+
* if (!base) throw new Error('No active Base.');
|
|
767
|
+
*
|
|
768
|
+
* const table = base.getTableById('tasks');
|
|
769
|
+
* if (!table) throw new Error('Tasks table not found.');
|
|
770
|
+
*
|
|
771
|
+
* const parent = table.getRecordById('task-1');
|
|
772
|
+
* if (!parent) throw new Error('Parent record not found.');
|
|
773
|
+
*
|
|
774
|
+
* const parentFieldId = table.getHierarchyFieldId();
|
|
775
|
+
* const children = table.addRecords([
|
|
776
|
+
* { values: { [table.getPrimaryFieldId()]: 'Child A', [parentFieldId]: parent.getId() } },
|
|
777
|
+
* { values: { [table.getPrimaryFieldId()]: 'Child B', [parentFieldId]: parent.getId() } },
|
|
778
|
+
* ]);
|
|
779
|
+
*
|
|
780
|
+
* console.log(children.map((child) => child.getId()));
|
|
781
|
+
* ```
|
|
545
782
|
*/
|
|
546
783
|
addRecords(records: Array<{
|
|
547
784
|
values: Record<FieldId, BaseCellValue>;
|
|
@@ -58,6 +58,8 @@ export declare class FUniverBaseMixin extends FUniver implements IFUniverBaseMix
|
|
|
58
58
|
getBases(): FBase[];
|
|
59
59
|
private _initBaseAfterEvents;
|
|
60
60
|
private _initBaseBeforeEvents;
|
|
61
|
+
private _getHierarchyEventContext;
|
|
62
|
+
private _fireBeforeHierarchyChange;
|
|
61
63
|
}
|
|
62
64
|
declare module '@univerjs/core/facade' {
|
|
63
65
|
interface FUniver extends IFUniverBaseMixin {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { BaseViewProjection, IFilterConfig, IGroupConfig, Injector, ISortConfig, IViewFieldSetting, IViewSnapshot, ViewSpecificConfig } from '@univerjs/core';
|
|
1
|
+
import type { BaseViewProjection, IBaseConditionalColorRule, IFilterConfig, IGroupConfig, Injector, ISortConfig, IViewFieldSetting, IViewSnapshot, ViewSpecificConfig } from '@univerjs/core';
|
|
2
2
|
import type { FBase } from './f-base';
|
|
3
3
|
import type { FBaseTable } from './f-table';
|
|
4
|
-
import {
|
|
4
|
+
import { IBaseProjectionService } from '@univerjs-pro/bases';
|
|
5
|
+
import { BaseViewType, ICommandService } from '@univerjs/core';
|
|
5
6
|
import { FBaseTableField } from './f-field';
|
|
6
7
|
/**
|
|
7
8
|
* Facade API object bound to a Base view.
|
|
@@ -44,7 +45,9 @@ export declare class FBaseTableView {
|
|
|
44
45
|
private readonly _table;
|
|
45
46
|
private readonly _viewId;
|
|
46
47
|
private readonly _injector;
|
|
47
|
-
|
|
48
|
+
private readonly _commandService;
|
|
49
|
+
private readonly _projectionService;
|
|
50
|
+
constructor(_base: FBase, _table: FBaseTable, _viewId: string, _injector: Injector, _commandService: ICommandService, _projectionService: IBaseProjectionService);
|
|
48
51
|
/**
|
|
49
52
|
* Get the view id.
|
|
50
53
|
* @returns {string} The view id.
|
|
@@ -139,6 +142,179 @@ export declare class FBaseTableView {
|
|
|
139
142
|
* ```
|
|
140
143
|
*/
|
|
141
144
|
updateConfig(patch: Partial<ViewSpecificConfig>): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Get this view's conditional coloring rules in priority order.
|
|
147
|
+
*
|
|
148
|
+
* Rules at the beginning of the array have higher priority. The returned
|
|
149
|
+
* array is a deep copy, so changing it does not mutate the Base. Call
|
|
150
|
+
* {@link setConditionalColorRules} to persist edits or reorder rules.
|
|
151
|
+
*
|
|
152
|
+
* @returns {IBaseConditionalColorRule[]} A copy of the persisted rules. Returns `[]` when no rules are configured.
|
|
153
|
+
* @example Read rules created by either the UI or the Facade
|
|
154
|
+
* ```ts
|
|
155
|
+
* const base = univerAPI.getActiveBase();
|
|
156
|
+
* if (!base) throw new Error('Open a Base before running this example.');
|
|
157
|
+
*
|
|
158
|
+
* const table = base.insertTable(`Conditional color read ${Date.now()}`, {
|
|
159
|
+
* primaryFieldName: 'Task'
|
|
160
|
+
* });
|
|
161
|
+
* const title = table.getPrimaryField();
|
|
162
|
+
* const view = table.getViewByName('Grid');
|
|
163
|
+
* if (!view) throw new Error('The default Grid view was not created.');
|
|
164
|
+
* view.setConditionalColorRules([{
|
|
165
|
+
* id: 'blocked-task',
|
|
166
|
+
* color: '#fde9e9',
|
|
167
|
+
* target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
|
|
168
|
+
* fieldId: title.getId(),
|
|
169
|
+
* operator: univerAPI.Enum.BaseConditionalColorOperator.CONTAINS,
|
|
170
|
+
* operand: 'blocked'
|
|
171
|
+
* }]);
|
|
172
|
+
*
|
|
173
|
+
* const rules = view.getConditionalColorRules();
|
|
174
|
+
* console.log(rules.map((rule, priority) => ({ priority, ...rule })));
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
getConditionalColorRules(): IBaseConditionalColorRule[];
|
|
178
|
+
/**
|
|
179
|
+
* Replace all conditional coloring rules for this view.
|
|
180
|
+
*
|
|
181
|
+
* The array order is the rule priority: index `0` is evaluated first.
|
|
182
|
+
* Passing `[]` clears conditional coloring. Every rule id must be unique,
|
|
183
|
+
* and every `fieldId` must reference a public field in this table. Invalid
|
|
184
|
+
* targets, field/operator combinations, date modes, CSS colors, ids, or
|
|
185
|
+
* fields throw an actionable error before any mutation is executed. For a
|
|
186
|
+
* `COLUMN` target, the field's entire column is painted unconditionally;
|
|
187
|
+
* `operator`, `operand`, and `dateMode` are retained but ignored.
|
|
188
|
+
*
|
|
189
|
+
* Prefer this typed method and `univerAPI.Enum.BaseConditional*` values to
|
|
190
|
+
* writing `getConfig().conditionalColoring` through {@link updateConfig};
|
|
191
|
+
* the command validates the complete replacement before persisting it.
|
|
192
|
+
*
|
|
193
|
+
* @param {IBaseConditionalColorRule[]} rules Complete replacement rules in descending priority order.
|
|
194
|
+
* @returns {boolean} `true` when the update command succeeds; otherwise `false`.
|
|
195
|
+
* @example Create a runnable risk table and color high-risk rows
|
|
196
|
+
* ```ts
|
|
197
|
+
* const base = univerAPI.getActiveBase();
|
|
198
|
+
* if (!base) throw new Error('Open a Base before running this example.');
|
|
199
|
+
*
|
|
200
|
+
* const table = base.insertTable(`Risk tracker ${Date.now()}`, {
|
|
201
|
+
* primaryFieldName: 'Risk item'
|
|
202
|
+
* });
|
|
203
|
+
* const level = table.addField(
|
|
204
|
+
* 'Risk level',
|
|
205
|
+
* univerAPI.Enum.BaseFieldType.Number
|
|
206
|
+
* );
|
|
207
|
+
* table.addRecords([
|
|
208
|
+
* { values: { [table.getPrimaryFieldId()]: 'Stock shortage', [level.getId()]: 90 } },
|
|
209
|
+
* { values: { [table.getPrimaryFieldId()]: 'Delivery delay', [level.getId()]: 60 } }
|
|
210
|
+
* ]);
|
|
211
|
+
*
|
|
212
|
+
* const view = table.getViewByName('Grid');
|
|
213
|
+
* if (!view) throw new Error('The default Grid view was not created.');
|
|
214
|
+
* const success = view.setConditionalColorRules([{
|
|
215
|
+
* id: 'high-risk',
|
|
216
|
+
* color: '#fde9e9',
|
|
217
|
+
* target: univerAPI.Enum.BaseConditionalColorTarget.ROW,
|
|
218
|
+
* fieldId: level.getId(),
|
|
219
|
+
* operator: univerAPI.Enum.BaseConditionalColorOperator.GREATER_THAN,
|
|
220
|
+
* operand: 80
|
|
221
|
+
* }]);
|
|
222
|
+
*
|
|
223
|
+
* console.log({ success, rules: view.getConditionalColorRules() });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
setConditionalColorRules(rules: IBaseConditionalColorRule[]): boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Append one conditional coloring rule at the lowest priority.
|
|
229
|
+
*
|
|
230
|
+
* Use {@link setConditionalColorRules} when inserting at a specific priority
|
|
231
|
+
* or replacing an existing rule. Duplicate ids and invalid rule values throw
|
|
232
|
+
* before the Base is mutated.
|
|
233
|
+
*
|
|
234
|
+
* @param {IBaseConditionalColorRule} rule Rule to append after all existing rules.
|
|
235
|
+
* @returns {boolean} `true` when the update command succeeds; otherwise `false`.
|
|
236
|
+
* @example Add a low-priority warning rule
|
|
237
|
+
* ```ts
|
|
238
|
+
* const base = univerAPI.getActiveBase();
|
|
239
|
+
* if (!base) throw new Error('Open a Base before running this example.');
|
|
240
|
+
* const table = base.insertTable(`Conditional color add ${Date.now()}`, {
|
|
241
|
+
* primaryFieldName: 'Risk item'
|
|
242
|
+
* });
|
|
243
|
+
* const level = table.addField('Risk level', univerAPI.Enum.BaseFieldType.Number);
|
|
244
|
+
* const view = table.getViewByName('Grid');
|
|
245
|
+
* if (!view) throw new Error('The default Grid view was not created.');
|
|
246
|
+
*
|
|
247
|
+
* const success = view.addConditionalColorRule({
|
|
248
|
+
* id: 'medium-risk',
|
|
249
|
+
* color: '#fff7df',
|
|
250
|
+
* target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
|
|
251
|
+
* fieldId: level.getId(),
|
|
252
|
+
* operator: univerAPI.Enum.BaseConditionalColorOperator.GREATER_THAN,
|
|
253
|
+
* operand: 50
|
|
254
|
+
* });
|
|
255
|
+
* console.log({ success, rules: view.getConditionalColorRules() });
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
addConditionalColorRule(rule: IBaseConditionalColorRule): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Delete one conditional coloring rule by its stable id.
|
|
261
|
+
*
|
|
262
|
+
* Deleting the last rule clears the persisted conditional coloring config.
|
|
263
|
+
* A missing id is a no-op and returns `false`.
|
|
264
|
+
*
|
|
265
|
+
* @param {string} ruleId Id of the rule to delete.
|
|
266
|
+
* @returns {boolean} `true` when the rule existed and the update command succeeds; otherwise `false`.
|
|
267
|
+
* @example Delete a rule and verify the persisted result
|
|
268
|
+
* ```ts
|
|
269
|
+
* const base = univerAPI.getActiveBase();
|
|
270
|
+
* if (!base) throw new Error('Open a Base before running this example.');
|
|
271
|
+
* const table = base.insertTable(`Conditional color delete ${Date.now()}`, {
|
|
272
|
+
* primaryFieldName: 'Task'
|
|
273
|
+
* });
|
|
274
|
+
* const title = table.getPrimaryField();
|
|
275
|
+
* const view = table.getViewByName('Grid');
|
|
276
|
+
* if (!view) throw new Error('The default Grid view was not created.');
|
|
277
|
+
* view.addConditionalColorRule({
|
|
278
|
+
* id: 'medium-risk',
|
|
279
|
+
* color: '#fff7df',
|
|
280
|
+
* target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
|
|
281
|
+
* fieldId: title.getId(),
|
|
282
|
+
* operator: univerAPI.Enum.BaseConditionalColorOperator.CONTAINS,
|
|
283
|
+
* operand: 'delay'
|
|
284
|
+
* });
|
|
285
|
+
*
|
|
286
|
+
* const deleted = view.deleteConditionalColorRule('medium-risk');
|
|
287
|
+
* console.log({ deleted, rules: view.getConditionalColorRules() });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
deleteConditionalColorRule(ruleId: string): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Clear every conditional coloring rule from this view.
|
|
293
|
+
*
|
|
294
|
+
* @returns {boolean} `true` when rules existed and the clear command succeeds; otherwise `false`.
|
|
295
|
+
* @example Clear conditional coloring without changing filters, sorts, or other view config
|
|
296
|
+
* ```ts
|
|
297
|
+
* const base = univerAPI.getActiveBase();
|
|
298
|
+
* if (!base) throw new Error('Open a Base before running this example.');
|
|
299
|
+
* const table = base.insertTable(`Conditional color clear ${Date.now()}`, {
|
|
300
|
+
* primaryFieldName: 'Task'
|
|
301
|
+
* });
|
|
302
|
+
* const title = table.getPrimaryField();
|
|
303
|
+
* const view = table.getViewByName('Grid');
|
|
304
|
+
* if (!view) throw new Error('The default Grid view was not created.');
|
|
305
|
+
* view.addConditionalColorRule({
|
|
306
|
+
* id: 'temporary-rule',
|
|
307
|
+
* color: '#eef3ff',
|
|
308
|
+
* target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
|
|
309
|
+
* fieldId: title.getId(),
|
|
310
|
+
* operator: univerAPI.Enum.BaseConditionalColorOperator.IS_NOT_EMPTY
|
|
311
|
+
* });
|
|
312
|
+
*
|
|
313
|
+
* const cleared = view.clearConditionalColorRules();
|
|
314
|
+
* console.log({ cleared, rules: view.getConditionalColorRules() });
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
clearConditionalColorRules(): boolean;
|
|
142
318
|
/**
|
|
143
319
|
* Get the view filter.
|
|
144
320
|
* @returns {IFilterConfig | null} The view filter, or `null` if no filter is set.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { BaseCellValue, ITableSnapshot } from '@univerjs/core';
|
|
1
|
+
import type { BaseCellValue, IFieldSnapshot, ITableSnapshot } from '@univerjs/core';
|
|
2
2
|
export declare enum BaseFieldKeyEnum {
|
|
3
3
|
Id = "id",
|
|
4
4
|
Name = "name",
|
|
5
5
|
Auto = "auto"
|
|
6
6
|
}
|
|
7
|
+
export declare function isPublicBaseField(field: IFieldSnapshot | undefined): field is IFieldSnapshot;
|
|
7
8
|
export declare function resolveBaseFieldValues(table: ITableSnapshot, values: Record<string, BaseCellValue> | undefined, fieldKey?: BaseFieldKeyEnum): Record<string, BaseCellValue>;
|
|
9
|
+
export declare function normalizeBaseFieldValueForWrite(field: IFieldSnapshot | undefined, value: BaseCellValue): BaseCellValue;
|
|
8
10
|
export declare function resolveBaseFieldKey(table: ITableSnapshot, key: string, fieldKey: BaseFieldKeyEnum): string;
|
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
import type { FieldConfig } from '@univerjs/core';
|
|
1
|
+
import type { BaseDateHourCycle, FieldConfig, IBaseDateFieldConfig } from '@univerjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical date field display config. Date and time options are intentionally
|
|
4
|
+
* independent so consumers can switch between 12-hour and 24-hour time.
|
|
5
|
+
*/
|
|
6
|
+
export interface IResolvedBaseDateFieldConfig extends IBaseDateFieldConfig {
|
|
7
|
+
pattern: string;
|
|
8
|
+
includeTime: boolean;
|
|
9
|
+
hourCycle: BaseDateHourCycle;
|
|
10
|
+
}
|
|
2
11
|
export declare function dateToExcelSerial(value: number | Date): number;
|
|
3
12
|
export declare function excelSerialToDateMs(value: number): number;
|
|
4
13
|
export declare function normalizeBaseDateSerial(value: unknown): number | null;
|
|
5
14
|
export declare function baseDateSerialToDateMs(value: unknown): number | null;
|
|
15
|
+
/**
|
|
16
|
+
* Reads a date field config without mutating it. Legacy `format`, `dateFormat`,
|
|
17
|
+
* and date patterns ending in `hh:mm` remain supported.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveBaseDateFieldConfig(config?: FieldConfig | Record<string, unknown>): IResolvedBaseDateFieldConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Converts legacy date field config aliases to `pattern`, `includeTime`, and
|
|
22
|
+
* `hourCycle`, while preserving unrelated field settings.
|
|
23
|
+
*/
|
|
24
|
+
export declare function normalizeBaseDateFieldConfig(config?: FieldConfig | Record<string, unknown>): Record<string, unknown>;
|
|
6
25
|
export declare function formatBaseDateValue(value: unknown, config?: FieldConfig | Record<string, unknown>): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseCellValue, BaseFilterOperator, FieldConfig, IFieldCapabilities, IFieldSnapshot, IValidationResult } from '@univerjs/core';
|
|
2
|
-
import { BaseFieldType } from '@univerjs/core';
|
|
1
|
+
import type { BaseCellValue, BaseConditionalDateMode, BaseFilterOperator, FieldConfig, IFieldCapabilities, IFieldSnapshot, IValidationResult } from '@univerjs/core';
|
|
2
|
+
import { BaseConditionalColorOperator, BaseFieldType } from '@univerjs/core';
|
|
3
3
|
export interface IFieldTypePlugin {
|
|
4
4
|
type: BaseFieldType;
|
|
5
5
|
enabled: boolean;
|
|
@@ -17,11 +17,14 @@ export interface IFieldCorePlugin<TValue extends BaseCellValue = BaseCellValue,
|
|
|
17
17
|
fromPlainText(text: string, field: IFieldSnapshot): TValue | null;
|
|
18
18
|
getCapabilities(field: IFieldSnapshot): IFieldCapabilities;
|
|
19
19
|
}
|
|
20
|
-
export type BaseConditionDateMode = 'exact' | 'today' | 'tomorrow' | 'yesterday' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'past7' | 'next7' | 'past30' | 'next30';
|
|
21
20
|
export interface IBaseConditionMatchOptions {
|
|
22
|
-
dateMode?:
|
|
21
|
+
dateMode?: BaseConditionalDateMode;
|
|
23
22
|
now?: number;
|
|
24
23
|
}
|
|
24
|
+
/** Return the conditional coloring operators supported by a Base field type. */
|
|
25
|
+
export declare function getBaseConditionalColorOperators(fieldType: BaseFieldType): readonly BaseConditionalColorOperator[];
|
|
26
|
+
/** Whether a field type supports exact and relative conditional coloring date modes. */
|
|
27
|
+
export declare function isBaseConditionalColorDateField(fieldType: BaseFieldType): boolean;
|
|
25
28
|
export declare function matchesBaseCondition(value: unknown, operator: BaseFilterOperator | string, operand: unknown, field: Pick<IFieldSnapshot, 'type'> & {
|
|
26
29
|
config?: FieldConfig;
|
|
27
30
|
}, options?: IBaseConditionMatchOptions): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IFieldSnapshot } from '@univerjs/core';
|
|
2
|
+
export declare const BASE_FIELD_STAT_TYPES: readonly ["count", "filled", "empty", "unique", "sum", "average", "min", "max"];
|
|
3
|
+
export type BaseFieldStatType = typeof BASE_FIELD_STAT_TYPES[number];
|
|
4
|
+
export declare function isBaseFieldStatType(value: unknown): value is BaseFieldStatType;
|
|
5
|
+
export declare function normalizeBaseFieldStatsConfig(value: unknown): Record<string, BaseFieldStatType>;
|
|
6
|
+
export declare function getSupportedBaseFieldStatTypes(field: IFieldSnapshot): readonly BaseFieldStatType[];
|
|
7
|
+
export declare function isBaseFieldStatSupported(field: IFieldSnapshot, statType: BaseFieldStatType): boolean;
|
|
8
|
+
export declare function calculateBaseFieldStat(field: IFieldSnapshot, values: readonly unknown[], statType: BaseFieldStatType): number | null;
|
|
9
|
+
export declare function formatBaseFieldStatValue(field: IFieldSnapshot, statType: BaseFieldStatType, value: number | null): string;
|
|
10
|
+
export declare function isBaseFieldStatEmptyValue(field: IFieldSnapshot, value: unknown): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatBaseProgressValue(value: number, config: unknown): string;
|