@univerjs-pro/bases 1.0.0-alpha.7 → 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/controllers/base-formula-calculation.controller.d.ts +6 -1
- package/lib/types/facade/f-base.d.ts +4 -2
- package/lib/types/facade/f-enum.d.ts +277 -6
- package/lib/types/facade/f-event.d.ts +102 -0
- package/lib/types/facade/f-field.d.ts +40 -7
- package/lib/types/facade/f-range.d.ts +4 -1
- package/lib/types/facade/f-record.d.ts +377 -2
- package/lib/types/facade/f-table.d.ts +287 -16
- 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/facade/index.d.ts +2 -1
- package/lib/types/fields/date-format.d.ts +20 -1
- package/lib/types/fields/field-core-plugin.d.ts +7 -5
- package/lib/types/fields/field-stat.d.ts +10 -0
- package/lib/types/fields/number-format.d.ts +3 -3
- package/lib/types/fields/progress-format.d.ts +1 -0
- package/lib/types/index.d.ts +21 -4
- package/lib/types/locale/en-US.d.ts +1 -1
- package/lib/types/models/base-hierarchy.d.ts +108 -0
- package/lib/types/models/default-table.d.ts +0 -1
- package/lib/types/models/record-link.d.ts +14 -0
- package/lib/types/ot/json1-adapter.d.ts +0 -1
- package/lib/types/ot/json1-op-applier.d.ts +3 -1
- package/lib/types/ot/json1-op-factory.d.ts +0 -3
- package/lib/types/ot/json1-util.d.ts +2 -2
- package/lib/types/search/base-search.d.ts +0 -3
- package/lib/types/services/base-active-dirty.service.d.ts +0 -1
- package/lib/types/services/base-command.service.d.ts +1 -1
- package/lib/types/services/base-compression.service.d.ts +0 -5
- package/lib/types/services/base-formula.service.d.ts +1 -3
- package/lib/types/services/base-permission.service.d.ts +0 -4
- package/lib/types/services/base-projection.service.d.ts +4 -0
- package/lib/types/views/view-core-plugin.d.ts +0 -2
- 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 -6
- package/lib/types/facade/f-types.d.ts +0 -1
|
@@ -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,14 +17,16 @@ 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;
|
|
28
31
|
export declare function createCoreFieldPlugins(): IFieldCorePlugin[];
|
|
29
|
-
export type FieldTypePlugin = IFieldTypePlugin;
|
|
30
32
|
export type FieldCorePlugin<TValue extends BaseCellValue = BaseCellValue, TConfig = FieldConfig> = IFieldCorePlugin<TValue, TConfig>;
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type BaseSeparatorStyle = 'local' | 'commaPeriod' | 'periodComma' | 'spaceComma' | 'spacePeriod';
|
|
2
|
+
type BaseNumberAbbreviation = 'none' | 'K' | 'M' | 'B';
|
|
3
3
|
export interface IBaseNumberFormatConfig {
|
|
4
4
|
decimalPlaces?: number;
|
|
5
5
|
separatorStyle?: BaseSeparatorStyle | string;
|
|
@@ -12,4 +12,4 @@ export interface IBaseNumberFormatConfig {
|
|
|
12
12
|
export declare function buildBaseNumberFormatPattern(config: IBaseNumberFormatConfig): string;
|
|
13
13
|
export declare function formatBaseNumberValue(value: number, config: IBaseNumberFormatConfig): string;
|
|
14
14
|
export declare function inferBaseSeparatorStyle(locale?: string): Exclude<BaseSeparatorStyle, 'local'>;
|
|
15
|
-
export
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatBaseProgressValue(value: number, config: unknown): string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export { BatchDeleteBaseRecordsCommand } from './commands/commands/batch-delete-
|
|
|
4
4
|
export type { IBatchDeleteBaseRecordsCommandParams } from './commands/commands/batch-delete-base-records.command';
|
|
5
5
|
export { ChangeBaseFieldTypeCommand } from './commands/commands/change-base-field-type.command';
|
|
6
6
|
export type { IChangeBaseFieldTypeCommandParams } from './commands/commands/change-base-field-type.command';
|
|
7
|
+
export { CreateBaseChildRecordCommand } from './commands/commands/create-base-child-record.command';
|
|
8
|
+
export type { ICreateBaseChildRecordCommandParams } from './commands/commands/create-base-child-record.command';
|
|
7
9
|
export { CreateBaseFieldCommand } from './commands/commands/create-base-field.command';
|
|
8
10
|
export type { ICreateBaseFieldCommandParams } from './commands/commands/create-base-field.command';
|
|
9
11
|
export { CreateBaseRecordCommand } from './commands/commands/create-base-record.command';
|
|
@@ -28,6 +30,8 @@ export { EnsureBaseTemporalViewDateFieldsCommand } from './commands/commands/ens
|
|
|
28
30
|
export type { IEnsureBaseTemporalViewDateFieldsCommandParams } from './commands/commands/ensure-base-temporal-view-date-fields.command';
|
|
29
31
|
export { MoveBaseFieldCommand } from './commands/commands/move-base-field.command';
|
|
30
32
|
export type { IMoveBaseFieldCommandParams } from './commands/commands/move-base-field.command';
|
|
33
|
+
export { MoveBaseHierarchyRecordCommand } from './commands/commands/move-base-hierarchy-record.command';
|
|
34
|
+
export type { IMoveBaseHierarchyRecordCommandParams } from './commands/commands/move-base-hierarchy-record.command';
|
|
31
35
|
export { MoveBaseViewCommand } from './commands/commands/move-base-view.command';
|
|
32
36
|
export type { IMoveBaseViewCommandParams } from './commands/commands/move-base-view.command';
|
|
33
37
|
export { RenameBaseTableCommand } from './commands/commands/rename-base-table.command';
|
|
@@ -39,9 +43,12 @@ export type { ISetBaseKanbanGroupFieldCommandParams } from './commands/commands/
|
|
|
39
43
|
export { SetBaseNameCommand } from './commands/commands/set-base-name.command';
|
|
40
44
|
export type { ISetBaseNameCommandParams } from './commands/commands/set-base-name.command';
|
|
41
45
|
export { SetBaseRangeValuesCommand } from './commands/commands/set-base-range-values.command';
|
|
46
|
+
export { resolveBaseRangeHierarchyPatches } from './commands/commands/set-base-range-values.command';
|
|
42
47
|
export type { ISetBaseRangeValuesCommandParams } from './commands/commands/set-base-range-values.command';
|
|
43
48
|
export { SetBaseRecordValuesCommand } from './commands/commands/set-base-record-values.command';
|
|
44
49
|
export type { ISetBaseRecordValuesCommandParams } from './commands/commands/set-base-record-values.command';
|
|
50
|
+
export { SetBaseTableHierarchyFieldCommand } from './commands/commands/set-base-table-hierarchy-field.command';
|
|
51
|
+
export type { ISetBaseTableHierarchyFieldCommandParams } from './commands/commands/set-base-table-hierarchy-field.command';
|
|
45
52
|
export { SetBaseViewFieldOrderCommand } from './commands/commands/set-base-view-field-order.command';
|
|
46
53
|
export type { ISetBaseViewFieldOrderCommandParams } from './commands/commands/set-base-view-field-order.command';
|
|
47
54
|
export { SetBaseViewFieldVisibleCommand } from './commands/commands/set-base-view-field-visible.command';
|
|
@@ -64,27 +71,37 @@ export { UpdateBaseKanbanConfigCommand } from './commands/commands/update-base-k
|
|
|
64
71
|
export type { IUpdateBaseKanbanConfigCommandParams } from './commands/commands/update-base-kanban-config.command';
|
|
65
72
|
export { UpdateBaseRecordOrderCommand } from './commands/commands/update-base-record-order.command';
|
|
66
73
|
export type { IUpdateBaseRecordOrderCommandParams } from './commands/commands/update-base-record-order.command';
|
|
74
|
+
export { BaseConditionalColorRuleUpdateType, UpdateBaseViewConditionalColorRulesCommand } from './commands/commands/update-base-view-conditional-color-rules.command';
|
|
75
|
+
export type { IUpdateBaseViewConditionalColorRulesCommandParams } from './commands/commands/update-base-view-conditional-color-rules.command';
|
|
67
76
|
export { UpdateBaseViewConfigCommand } from './commands/commands/update-base-view-config.command';
|
|
68
77
|
export type { IUpdateBaseViewConfigCommandParams } from './commands/commands/update-base-view-config.command';
|
|
69
78
|
export { ApplyBaseJson1Mutation } from './commands/mutations/apply-base-json1.mutation';
|
|
70
79
|
export type { IApplyBaseJson1MutationParams } from './commands/mutations/apply-base-json1.mutation';
|
|
71
80
|
export { createEmbedBasesTable, createEmbedBasesTableAddMutation, createEmbedBasesTableRemoveMutation, EMBED_BASES_TABLE_RESOURCE_KEY, } from './embed-host-anchor';
|
|
72
|
-
export { baseDateSerialToDateMs, dateToExcelSerial, formatBaseDateValue, normalizeBaseDateSerial, } from './fields/date-format';
|
|
73
|
-
export {
|
|
81
|
+
export { baseDateSerialToDateMs, dateToExcelSerial, formatBaseDateValue, normalizeBaseDateFieldConfig, normalizeBaseDateSerial, resolveBaseDateFieldConfig, } from './fields/date-format';
|
|
82
|
+
export type { IResolvedBaseDateFieldConfig, } from './fields/date-format';
|
|
83
|
+
export { getBaseConditionalColorOperators, isBaseConditionalColorDateField, matchesBaseCondition } from './fields/field-core-plugin';
|
|
84
|
+
export { BASE_FIELD_STAT_TYPES, calculateBaseFieldStat, formatBaseFieldStatValue, getSupportedBaseFieldStatTypes, isBaseFieldStatEmptyValue, isBaseFieldStatSupported, isBaseFieldStatType, normalizeBaseFieldStatsConfig, } from './fields/field-stat';
|
|
85
|
+
export type { BaseFieldStatType } from './fields/field-stat';
|
|
74
86
|
export { formatBaseNumberValue, inferBaseSeparatorStyle, } from './fields/number-format';
|
|
87
|
+
export { formatBaseProgressValue } from './fields/progress-format';
|
|
75
88
|
export { uniqueFieldName } from './fields/util';
|
|
76
89
|
export { ensureBaseTableCellLayout, getBaseCellFormulaValue, getBaseCellValue, } from './models/base-cell-data';
|
|
90
|
+
export { BASE_HIERARCHY_MAX_LEVELS, BASE_HIERARCHY_PARENT_FIELD_ID, BaseEventSource, BaseHierarchyError, BaseHierarchyErrorCode, buildBaseHierarchyIndex, createBaseHierarchyParentField, getActiveBaseHierarchyFieldIds, getBaseHierarchyDeletePromotions, getBaseHierarchyFieldId, getVisibleBaseHierarchyRows, isBaseHierarchyField, projectBaseHierarchy, resolveBaseHierarchyFieldId, validateBaseHierarchyMove, validateBaseHierarchyRecordCreations, validateBaseHierarchyRecordPatches, } from './models/base-hierarchy';
|
|
91
|
+
export type { IBaseHierarchyChange, IBaseHierarchyIndex, IBaseHierarchyRecordPatch, } from './models/base-hierarchy';
|
|
77
92
|
export { copyBaseTableSnapshot } from './models/base-table-copy';
|
|
78
93
|
export { createDefaultBaseTableSnapshot } from './models/default-table';
|
|
94
|
+
export { findRecordLinkReferences, getRecordLinkFieldConfig, parseRecordLinkIds, serializeRecordLinkIds, validateCanonicalRecordLinkValue, validateRecordLinkField, validateRecordLinkValue, } from './models/record-link';
|
|
95
|
+
export type { IRecordLinkReference } from './models/record-link';
|
|
79
96
|
export { BaseJson1OpApplier } from './ot/json1-op-applier';
|
|
80
97
|
export { BaseJson1OpFactory } from './ot/json1-op-factory';
|
|
81
98
|
export { UniverBasesPlugin, UniverRemoteBasesPlugin, } from './plugin';
|
|
82
99
|
export { searchBaseTable } from './search/base-search';
|
|
83
100
|
export type { IBaseTableSearchRequest } from './search/base-search';
|
|
84
|
-
export type {
|
|
101
|
+
export type { IBaseTableSearchMatch, IBaseTableSearchResult, } from './search/base-search';
|
|
85
102
|
export { IBaseCommandService } from './services/base-command.service';
|
|
86
103
|
export { traceBasePerformance } from './services/base-performance.service';
|
|
87
104
|
export { IBasePermissionService } from './services/base-permission.service';
|
|
88
|
-
export type {
|
|
105
|
+
export type { IBaseFieldPermission, IBasePermissionSnapshot, IBaseRecordPermission, IBaseTablePermission, } from './services/base-permission.service';
|
|
89
106
|
export { IBaseProjectionService } from './services/base-projection.service';
|
|
90
107
|
export { IBaseViewRegistryService } from './services/base-view-registry.service';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { BaseCellValue, FieldId, IBaseHierarchyProjection, IFieldSnapshot, IGridProjection, IProjectedRow, IRecordSnapshot, ITableSnapshot, RecordId } from '@univerjs/core';
|
|
2
|
+
import { BaseHierarchyInvalidReason } from '@univerjs/core';
|
|
3
|
+
/** Root plus four descendant levels. */
|
|
4
|
+
export declare const BASE_HIERARCHY_MAX_LEVELS = 5;
|
|
5
|
+
/** Virtual id used before a table creates its Parent RecordLink for the first time. */
|
|
6
|
+
export declare const BASE_HIERARCHY_PARENT_FIELD_ID = "__base_hierarchy_parent__";
|
|
7
|
+
/** Stable SDK-facing error codes. UI messages resolve these codes through i18n. */
|
|
8
|
+
export declare enum BaseHierarchyErrorCode {
|
|
9
|
+
/** The Parent field is absent, targets another table, or allows multiple records. */
|
|
10
|
+
InvalidField = "invalidField",
|
|
11
|
+
/** The record being changed or its requested parent does not exist. */
|
|
12
|
+
MissingRecord = "missingRecord",
|
|
13
|
+
/** A record was assigned as its own parent. */
|
|
14
|
+
SelfParent = "selfParent",
|
|
15
|
+
/** The requested Parent edge would create a cycle. */
|
|
16
|
+
Cycle = "cycle",
|
|
17
|
+
/** Moving the record's subtree would exceed {@link BASE_HIERARCHY_MAX_LEVELS}. */
|
|
18
|
+
MaxDepth = "maxDepth",
|
|
19
|
+
/** Manual record reordering was requested while the active view has Sort rules. */
|
|
20
|
+
SortedView = "sortedView"
|
|
21
|
+
}
|
|
22
|
+
/** Error thrown when a semantic hierarchy command rejects its complete operation. */
|
|
23
|
+
export declare class BaseHierarchyError extends Error {
|
|
24
|
+
readonly code: BaseHierarchyErrorCode;
|
|
25
|
+
constructor(code: BaseHierarchyErrorCode, message?: string);
|
|
26
|
+
}
|
|
27
|
+
/** Origin of an applied Base hierarchy change exposed through the Facade event API. */
|
|
28
|
+
export declare enum BaseEventSource {
|
|
29
|
+
/** A built-in Base UI interaction initiated the command. */
|
|
30
|
+
UI = "ui",
|
|
31
|
+
/** A Facade API method initiated the command. */
|
|
32
|
+
Facade = "facade",
|
|
33
|
+
/** The mutation arrived through collaboration. */
|
|
34
|
+
Remote = "remote",
|
|
35
|
+
/** The local Undo stack replayed the inverse mutation. */
|
|
36
|
+
Undo = "undo",
|
|
37
|
+
/** The local Redo stack replayed the mutation. */
|
|
38
|
+
Redo = "redo",
|
|
39
|
+
/** An import pipeline applied a mutation carrying hierarchy metadata. */
|
|
40
|
+
Import = "import"
|
|
41
|
+
}
|
|
42
|
+
/** Serializable semantic description carried with one atomic JSON1 mutation. */
|
|
43
|
+
export interface IBaseHierarchyChange {
|
|
44
|
+
/** Table containing both the changed record and its Parent field. */
|
|
45
|
+
tableId: string;
|
|
46
|
+
/** Canonical same-table, single-value RecordLink field id. */
|
|
47
|
+
fieldId: string;
|
|
48
|
+
/** Record whose effective direct parent changed. */
|
|
49
|
+
recordId: string;
|
|
50
|
+
/** Effective parent before the atomic mutation, or `null` for a root. */
|
|
51
|
+
oldParentRecordId: string | null;
|
|
52
|
+
/** Effective parent after the atomic mutation, or `null` for a root. */
|
|
53
|
+
parentRecordId: string | null;
|
|
54
|
+
}
|
|
55
|
+
export interface IBaseHierarchyRecordPatch {
|
|
56
|
+
recordId: RecordId;
|
|
57
|
+
values: Record<FieldId, BaseCellValue>;
|
|
58
|
+
}
|
|
59
|
+
/** Internal reusable relation index. It contains every record, before view filtering. */
|
|
60
|
+
export interface IBaseHierarchyIndex {
|
|
61
|
+
fieldId: FieldId;
|
|
62
|
+
parentByRecordId: Map<RecordId, RecordId | null>;
|
|
63
|
+
childrenByParentId: Map<RecordId | null, RecordId[]>;
|
|
64
|
+
depthByRecordId: Map<RecordId, number>;
|
|
65
|
+
subtreeHeightByRecordId: Map<RecordId, number>;
|
|
66
|
+
invalidReasonByRecordId: Map<RecordId, BaseHierarchyInvalidReason>;
|
|
67
|
+
rootRecordIds: RecordId[];
|
|
68
|
+
orderedRecordIds: RecordId[];
|
|
69
|
+
}
|
|
70
|
+
export declare function isBaseHierarchyField(table: ITableSnapshot, fieldId: FieldId | null | undefined): fieldId is FieldId;
|
|
71
|
+
export declare function getBaseHierarchyFieldId(table: ITableSnapshot): FieldId | null;
|
|
72
|
+
/** Resolve the actual Parent field or the deterministic virtual field used before first write. */
|
|
73
|
+
export declare function resolveBaseHierarchyFieldId(table: ITableSnapshot): FieldId;
|
|
74
|
+
/** Create the canonical Parent RecordLink materialized by the first hierarchy write. */
|
|
75
|
+
export declare function createBaseHierarchyParentField(table: ITableSnapshot, fieldId?: string, name?: string): IFieldSnapshot;
|
|
76
|
+
/** The one table-level Parent field participating in hierarchy validation. */
|
|
77
|
+
export declare function getActiveBaseHierarchyFieldIds(table: ITableSnapshot): FieldId[];
|
|
78
|
+
/**
|
|
79
|
+
* Validate a multi-cell write against every active Grid or Kanban hierarchy.
|
|
80
|
+
* The proposed table is evaluated as a whole, so a batch can detach an edge and
|
|
81
|
+
* attach another edge atomically without being rejected because of patch order.
|
|
82
|
+
*/
|
|
83
|
+
export declare function validateBaseHierarchyRecordPatches(table: ITableSnapshot, patches: readonly IBaseHierarchyRecordPatch[]): IBaseHierarchyChange[];
|
|
84
|
+
/** Validate Parent values on records that will be inserted by one atomic command. */
|
|
85
|
+
export declare function validateBaseHierarchyRecordCreations(table: ITableSnapshot, records: readonly IRecordSnapshot[]): IBaseHierarchyChange[];
|
|
86
|
+
/** Parent edges that will be cleared when the supplied records are deleted. */
|
|
87
|
+
export declare function getBaseHierarchyDeletePromotions(table: ITableSnapshot, recordIds: readonly RecordId[]): IBaseHierarchyChange[];
|
|
88
|
+
/**
|
|
89
|
+
* Build a deterministic forest from the stored Parent links.
|
|
90
|
+
*
|
|
91
|
+
* Invalid links remain untouched in record data. The effective forest cuts only
|
|
92
|
+
* the invalid edge, so every client renders the same safe result without a
|
|
93
|
+
* collaboration repair mutation.
|
|
94
|
+
*/
|
|
95
|
+
export declare function buildBaseHierarchyIndex(table: ITableSnapshot, fieldId: FieldId, orderedRecordIds?: readonly RecordId[]): IBaseHierarchyIndex;
|
|
96
|
+
/** Add context ancestors to filtered/search matches and emit a depth-first projection. */
|
|
97
|
+
export declare function projectBaseHierarchy(index: IBaseHierarchyIndex, rows: readonly IProjectedRow[], includedRecordIds?: ReadonlySet<RecordId>): {
|
|
98
|
+
rows: IProjectedRow[];
|
|
99
|
+
hierarchy: IBaseHierarchyProjection;
|
|
100
|
+
};
|
|
101
|
+
export declare function getVisibleBaseHierarchyRows(projection: IGridProjection, collapsedRecordIds?: ReadonlySet<RecordId>): IProjectedRow[];
|
|
102
|
+
/** Validate a proposed move without mutating the table. */
|
|
103
|
+
export declare function validateBaseHierarchyMove(index: IBaseHierarchyIndex, recordId: RecordId, parentRecordId: RecordId | null): {
|
|
104
|
+
valid: true;
|
|
105
|
+
} | {
|
|
106
|
+
valid: false;
|
|
107
|
+
reason: BaseHierarchyInvalidReason;
|
|
108
|
+
};
|
|
@@ -10,4 +10,3 @@ export interface ICreateDefaultBaseTableSnapshotOptions {
|
|
|
10
10
|
now?: number;
|
|
11
11
|
}
|
|
12
12
|
export declare function createDefaultBaseTableSnapshot(options: ICreateDefaultBaseTableSnapshotOptions): ITableSnapshot;
|
|
13
|
-
export type CreateDefaultBaseTableSnapshotOptions = ICreateDefaultBaseTableSnapshotOptions;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IBaseSnapshot, IFieldSnapshot, IRecordLinkFieldConfig, IValidationResult } from '@univerjs/core';
|
|
2
|
+
export interface IRecordLinkReference {
|
|
3
|
+
tableId: string;
|
|
4
|
+
fieldId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getRecordLinkFieldConfig(field: IFieldSnapshot): IRecordLinkFieldConfig | null;
|
|
7
|
+
export declare function parseRecordLinkIds(value: unknown): string[];
|
|
8
|
+
export declare function serializeRecordLinkIds(recordIds: readonly string[]): string;
|
|
9
|
+
export declare function validateCanonicalRecordLinkValue(value: unknown, multiple: boolean): IValidationResult;
|
|
10
|
+
export declare function validateRecordLinkField(snapshot: IBaseSnapshot, field: IFieldSnapshot): IValidationResult;
|
|
11
|
+
export declare function validateRecordLinkValue(snapshot: IBaseSnapshot, field: IFieldSnapshot, value: unknown, options?: {
|
|
12
|
+
allowDangling?: boolean;
|
|
13
|
+
}): IValidationResult;
|
|
14
|
+
export declare function findRecordLinkReferences(snapshot: IBaseSnapshot, targetTableId: string): IRecordLinkReference[];
|
|
@@ -100,4 +100,3 @@ export declare class BaseJson1Adapter implements IBaseJson1Adapter {
|
|
|
100
100
|
invertOp(snapshot: IBaseSnapshot, op: JSONXActions): JSONXActions;
|
|
101
101
|
getAffectedRanges(op: JSONXActions): IBaseInvalidation[];
|
|
102
102
|
}
|
|
103
|
-
export type BaseCollaborativeOp = IBaseCollaborativeOp;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { IBaseInvalidation, IBaseSnapshot, JSONXActions } from '@univerjs/core';
|
|
1
|
+
import type { IBaseInvalidation, IBaseSnapshot, IMutationInfo, JSONXActions } from '@univerjs/core';
|
|
2
|
+
export declare const APPLY_BASE_JSON1_MUTATION_ID = "base.mutation.apply-base-json1";
|
|
2
3
|
export declare class BaseJson1OpApplier {
|
|
4
|
+
static tryMaterializeSnapshot(snapshot: IBaseSnapshot, mutations: readonly IMutationInfo[]): IBaseSnapshot | null;
|
|
3
5
|
applyOp(snapshot: IBaseSnapshot, op: JSONXActions): IBaseSnapshot;
|
|
4
6
|
invertOp(snapshot: IBaseSnapshot, op: JSONXActions): JSONXActions;
|
|
5
7
|
getAffectedRanges(op: JSONXActions): IBaseInvalidation[];
|
|
@@ -63,6 +63,3 @@ export declare class BaseJson1OpFactory {
|
|
|
63
63
|
private _replaceOptional;
|
|
64
64
|
}
|
|
65
65
|
export declare function renameBaseFormulaTableReferences(formula: string, oldName: string, newName: string): string;
|
|
66
|
-
export type CreateFieldOpInput = ICreateFieldOpInput;
|
|
67
|
-
export type SetRecordValuesPatch = ISetRecordValuesPatch;
|
|
68
|
-
export type SetRangeValuesPatch = ISetRangeValuesPatch;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function composeJson1Ops(ops:
|
|
1
|
+
import { JSON1 } from '@univerjs/core';
|
|
2
|
+
export declare function composeJson1Ops(ops: readonly Parameters<typeof JSON1.type.compose>[0][]): ReturnType<typeof JSON1.type.compose>;
|
|
@@ -20,6 +20,3 @@ export interface IBaseTableSearchResult {
|
|
|
20
20
|
matches: IBaseTableSearchMatch[];
|
|
21
21
|
}
|
|
22
22
|
export declare function searchBaseTable(request: IBaseTableSearchRequest): IBaseTableSearchResult;
|
|
23
|
-
export type BaseTableSearchRequest = IBaseTableSearchRequest;
|
|
24
|
-
export type BaseTableSearchMatch = IBaseTableSearchMatch;
|
|
25
|
-
export type BaseTableSearchResult = IBaseTableSearchResult;
|
|
@@ -21,4 +21,3 @@ export interface IBaseFormulaDirtyRange {
|
|
|
21
21
|
export type BaseFormulaDirtySuperTableMap = Record<string, Record<string, string>>;
|
|
22
22
|
export declare function setBaseRangeValuesToDirtyRanges(params: IBaseRangeValueDirtyParams): IBaseFormulaDirtyRange[];
|
|
23
23
|
export declare function createBaseStructureDirtySuperTableMap(unitId: string, tableIds: string[]): BaseFormulaDirtySuperTableMap;
|
|
24
|
-
export type BaseFormulaDirtyRange = IBaseFormulaDirtyRange;
|
|
@@ -122,5 +122,5 @@ export declare class BaseCommandService implements IBaseCommandService {
|
|
|
122
122
|
private _isNonEmptyCellValue;
|
|
123
123
|
private _getCurrentUserId;
|
|
124
124
|
private _normalizeCellValue;
|
|
125
|
+
private _assertFieldDefinition;
|
|
125
126
|
}
|
|
126
|
-
export type BaseCommandRuntimeContext = IBaseCommandRuntimeContext;
|
|
@@ -39,8 +39,3 @@ export declare function isCompressedBaseRangeValuesPayload(payload: unknown): pa
|
|
|
39
39
|
export declare function compressBaseSnapshot(snapshot: IBaseSnapshot): ICompressedBaseSnapshot;
|
|
40
40
|
export declare function decompressBaseSnapshot(snapshot: IBaseSnapshot | ICompressedBaseSnapshot): IBaseSnapshot;
|
|
41
41
|
export declare function isCompressedBaseSnapshot(snapshot: unknown): snapshot is ICompressedBaseSnapshot;
|
|
42
|
-
export type BaseRangeValuesPayload = IBaseRangeValuesPayload;
|
|
43
|
-
export type CompressedBaseRangeValuesPayload = ICompressedBaseRangeValuesPayload;
|
|
44
|
-
export type CompressedBaseCellData = ICompressedBaseCellData;
|
|
45
|
-
export type CompressedBaseTableSnapshot = ICompressedBaseTableSnapshot;
|
|
46
|
-
export type CompressedBaseSnapshot = ICompressedBaseSnapshot;
|
|
@@ -27,7 +27,6 @@ export interface IBaseFormulaCalculationDataset {
|
|
|
27
27
|
unitStylesData: Record<string, Record<string, unknown>>;
|
|
28
28
|
unitSheetNameMap: Record<string, Record<string, string>>;
|
|
29
29
|
}
|
|
30
|
-
export type IBaseFormulaCalculationResult = ISetFormulaCalculationResultMutation;
|
|
31
30
|
export interface IBaseSuperTableRegistration {
|
|
32
31
|
tableId: string;
|
|
33
32
|
tableName: string;
|
|
@@ -55,5 +54,4 @@ export declare class BaseFormulaService {
|
|
|
55
54
|
getStructuredDependencies(formula: string, table: ITableSnapshot, context?: IBaseFormulaContext): IBaseFormulaDependency[];
|
|
56
55
|
}
|
|
57
56
|
export declare function createBaseFormulaCalculationDataset(snapshot: IBaseSnapshot): IBaseFormulaCalculationDataset;
|
|
58
|
-
export declare function createBaseFormulaResultPatches(snapshot: IBaseSnapshot, result:
|
|
59
|
-
export type BaseFormulaValidationResult = IBaseFormulaValidationResult;
|
|
57
|
+
export declare function createBaseFormulaResultPatches(snapshot: IBaseSnapshot, result: ISetFormulaCalculationResultMutation): IBaseFormulaResultPatchGroup[];
|
|
@@ -70,7 +70,3 @@ export declare class BasePermissionService implements IBasePermissionService {
|
|
|
70
70
|
clearRecordPermission(tableId: string, recordId: string): void;
|
|
71
71
|
getSnapshot(): IBasePermissionSnapshot;
|
|
72
72
|
}
|
|
73
|
-
export type BaseTablePermission = IBaseTablePermission;
|
|
74
|
-
export type BaseFieldPermission = IBaseFieldPermission;
|
|
75
|
-
export type BaseRecordPermission = IBaseRecordPermission;
|
|
76
|
-
export type BasePermissionSnapshot = IBasePermissionSnapshot;
|
|
@@ -19,6 +19,7 @@ export declare class BaseProjectionService extends Disposable implements IBasePr
|
|
|
19
19
|
private readonly _projectedRowsCache;
|
|
20
20
|
private readonly _projectedViewRowsCache;
|
|
21
21
|
private readonly _projectedGroupsCache;
|
|
22
|
+
private readonly _hierarchyIndexCache;
|
|
22
23
|
private _globalRevision;
|
|
23
24
|
private readonly _tableRevisions;
|
|
24
25
|
private readonly _cellRevisions;
|
|
@@ -45,6 +46,8 @@ export declare class BaseProjectionService extends Disposable implements IBasePr
|
|
|
45
46
|
private _groupConfigCacheSegment;
|
|
46
47
|
private _viewRevisionKey;
|
|
47
48
|
private _buildGrid;
|
|
49
|
+
private _getHierarchyIndex;
|
|
50
|
+
private _projectHierarchyGroups;
|
|
48
51
|
private _buildKanban;
|
|
49
52
|
private _resolveKanbanGroupFieldId;
|
|
50
53
|
private _findKanbanGroupField;
|
|
@@ -75,6 +78,7 @@ export declare class BaseProjectionService extends Disposable implements IBasePr
|
|
|
75
78
|
private _matchesGanttColorRule;
|
|
76
79
|
private _buildGallery;
|
|
77
80
|
private _normalizeGalleryConfig;
|
|
81
|
+
private _resolveCardTitleFieldId;
|
|
78
82
|
private _resolveGalleryCoverFieldId;
|
|
79
83
|
private _resolveGalleryCardFieldIds;
|
|
80
84
|
private _projectFields;
|
|
@@ -18,6 +18,4 @@ export interface IViewCorePlugin<TConfig extends ViewSpecificConfig = ViewSpecif
|
|
|
18
18
|
export declare function resolveDefaultBaseCardTitleFieldId(table: ITableSnapshot): string;
|
|
19
19
|
export declare function resolveDefaultBaseCardFieldIds(table: ITableSnapshot, excludedFieldIds?: Array<string | null | undefined>, limit?: number): string[];
|
|
20
20
|
export declare function createCoreViewPlugins(): IViewCorePlugin[];
|
|
21
|
-
export type ProjectionContext = IProjectionContext;
|
|
22
|
-
export type ViewRepairResult = IViewRepairResult;
|
|
23
21
|
export type ViewCorePlugin<TConfig extends ViewSpecificConfig = ViewSpecificConfig> = IViewCorePlugin<TConfig>;
|