@univerjs-pro/bases 1.0.0-alpha.8 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/locale/ar-SA.js +1 -1
  4. package/lib/cjs/locale/ca-ES.js +1 -1
  5. package/lib/cjs/locale/de-DE.js +1 -1
  6. package/lib/cjs/locale/en-US.js +1 -1
  7. package/lib/cjs/locale/es-ES.js +1 -1
  8. package/lib/cjs/locale/fa-IR.js +1 -1
  9. package/lib/cjs/locale/fr-FR.js +1 -1
  10. package/lib/cjs/locale/id-ID.js +1 -1
  11. package/lib/cjs/locale/it-IT.js +1 -1
  12. package/lib/cjs/locale/ja-JP.js +1 -1
  13. package/lib/cjs/locale/ko-KR.js +1 -1
  14. package/lib/cjs/locale/pl-PL.js +1 -1
  15. package/lib/cjs/locale/pt-BR.js +1 -1
  16. package/lib/cjs/locale/ru-RU.js +1 -1
  17. package/lib/cjs/locale/sk-SK.js +1 -1
  18. package/lib/cjs/locale/vi-VN.js +1 -1
  19. package/lib/cjs/locale/zh-CN.js +1 -1
  20. package/lib/cjs/locale/zh-HK.js +1 -1
  21. package/lib/cjs/locale/zh-TW.js +1 -1
  22. package/lib/es/facade.js +1 -1
  23. package/lib/es/index.js +1 -1
  24. package/lib/es/locale/ar-SA.js +1 -1
  25. package/lib/es/locale/ca-ES.js +1 -1
  26. package/lib/es/locale/de-DE.js +1 -1
  27. package/lib/es/locale/en-US.js +1 -1
  28. package/lib/es/locale/es-ES.js +1 -1
  29. package/lib/es/locale/fa-IR.js +1 -1
  30. package/lib/es/locale/fr-FR.js +1 -1
  31. package/lib/es/locale/id-ID.js +1 -1
  32. package/lib/es/locale/it-IT.js +1 -1
  33. package/lib/es/locale/ja-JP.js +1 -1
  34. package/lib/es/locale/ko-KR.js +1 -1
  35. package/lib/es/locale/pl-PL.js +1 -1
  36. package/lib/es/locale/pt-BR.js +1 -1
  37. package/lib/es/locale/ru-RU.js +1 -1
  38. package/lib/es/locale/sk-SK.js +1 -1
  39. package/lib/es/locale/vi-VN.js +1 -1
  40. package/lib/es/locale/zh-CN.js +1 -1
  41. package/lib/es/locale/zh-HK.js +1 -1
  42. package/lib/es/locale/zh-TW.js +1 -1
  43. package/lib/facade.js +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/locale/ar-SA.js +1 -1
  46. package/lib/locale/ca-ES.js +1 -1
  47. package/lib/locale/de-DE.js +1 -1
  48. package/lib/locale/en-US.js +1 -1
  49. package/lib/locale/es-ES.js +1 -1
  50. package/lib/locale/fa-IR.js +1 -1
  51. package/lib/locale/fr-FR.js +1 -1
  52. package/lib/locale/id-ID.js +1 -1
  53. package/lib/locale/it-IT.js +1 -1
  54. package/lib/locale/ja-JP.js +1 -1
  55. package/lib/locale/ko-KR.js +1 -1
  56. package/lib/locale/pl-PL.js +1 -1
  57. package/lib/locale/pt-BR.js +1 -1
  58. package/lib/locale/ru-RU.js +1 -1
  59. package/lib/locale/sk-SK.js +1 -1
  60. package/lib/locale/vi-VN.js +1 -1
  61. package/lib/locale/zh-CN.js +1 -1
  62. package/lib/locale/zh-HK.js +1 -1
  63. package/lib/locale/zh-TW.js +1 -1
  64. package/lib/types/commands/commands/batch-create-base-records.command.d.ts +2 -0
  65. package/lib/types/commands/commands/batch-delete-base-records.command.d.ts +2 -0
  66. package/lib/types/commands/commands/create-base-child-record.command.d.ts +15 -0
  67. package/lib/types/commands/commands/create-base-record.command.d.ts +2 -0
  68. package/lib/types/commands/commands/delete-base-record.command.d.ts +2 -0
  69. package/lib/types/commands/commands/duplicate-base-record.command.d.ts +2 -0
  70. package/lib/types/commands/commands/move-base-hierarchy-record.command.d.ts +17 -0
  71. package/lib/types/commands/commands/set-base-range-values.command.d.ts +8 -1
  72. package/lib/types/commands/commands/set-base-record-values.command.d.ts +2 -0
  73. package/lib/types/commands/commands/set-base-table-hierarchy-field.command.d.ts +9 -0
  74. package/lib/types/commands/commands/update-base-cell.command.d.ts +2 -0
  75. package/lib/types/commands/commands/update-base-view-conditional-color-rules.command.d.ts +32 -0
  76. package/lib/types/commands/commands/validate-base-formula.command.d.ts +8 -0
  77. package/lib/types/commands/mutations/apply-base-json1.mutation.d.ts +4 -0
  78. package/lib/types/commands/utils/base-record-creation.d.ts +18 -0
  79. package/lib/types/commands/utils/base-validation.d.ts +6 -1
  80. package/lib/types/controllers/base-formula-calculation.controller.d.ts +1 -0
  81. package/lib/types/facade/f-base.d.ts +24 -9
  82. package/lib/types/facade/f-enum.d.ts +208 -3
  83. package/lib/types/facade/f-event.d.ts +102 -0
  84. package/lib/types/facade/f-field.d.ts +6 -6
  85. package/lib/types/facade/f-range.d.ts +4 -1
  86. package/lib/types/facade/f-record.d.ts +325 -1
  87. package/lib/types/facade/f-table.d.ts +293 -16
  88. package/lib/types/facade/f-univer.d.ts +2 -0
  89. package/lib/types/facade/f-view.d.ts +179 -3
  90. package/lib/types/facade/field-key.d.ts +3 -1
  91. package/lib/types/fields/date-format.d.ts +20 -1
  92. package/lib/types/fields/field-core-plugin.d.ts +7 -4
  93. package/lib/types/fields/field-stat.d.ts +10 -0
  94. package/lib/types/fields/progress-format.d.ts +1 -0
  95. package/lib/types/index.d.ts +25 -2
  96. package/lib/types/locale/en-US.d.ts +1 -1
  97. package/lib/types/models/base-hierarchy.d.ts +108 -0
  98. package/lib/types/models/base-table-name.d.ts +8 -0
  99. package/lib/types/models/record-link.d.ts +14 -0
  100. package/lib/types/ot/json1-op-applier.d.ts +3 -1
  101. package/lib/types/ot/json1-op-factory.d.ts +1 -1
  102. package/lib/types/ot/json1-util.d.ts +2 -2
  103. package/lib/types/services/base-command.service.d.ts +1 -0
  104. package/lib/types/services/base-formula.service.d.ts +2 -23
  105. package/lib/types/services/base-projection.service.d.ts +4 -0
  106. package/lib/umd/facade.js +1 -1
  107. package/lib/umd/index.js +1 -1
  108. package/lib/umd/locale/ar-SA.js +1 -1
  109. package/lib/umd/locale/ca-ES.js +1 -1
  110. package/lib/umd/locale/de-DE.js +1 -1
  111. package/lib/umd/locale/en-US.js +1 -1
  112. package/lib/umd/locale/es-ES.js +1 -1
  113. package/lib/umd/locale/fa-IR.js +1 -1
  114. package/lib/umd/locale/fr-FR.js +1 -1
  115. package/lib/umd/locale/id-ID.js +1 -1
  116. package/lib/umd/locale/it-IT.js +1 -1
  117. package/lib/umd/locale/ja-JP.js +1 -1
  118. package/lib/umd/locale/ko-KR.js +1 -1
  119. package/lib/umd/locale/pl-PL.js +1 -1
  120. package/lib/umd/locale/pt-BR.js +1 -1
  121. package/lib/umd/locale/ru-RU.js +1 -1
  122. package/lib/umd/locale/sk-SK.js +1 -1
  123. package/lib/umd/locale/vi-VN.js +1 -1
  124. package/lib/umd/locale/zh-CN.js +1 -1
  125. package/lib/umd/locale/zh-HK.js +1 -1
  126. package/lib/umd/locale/zh-TW.js +1 -1
  127. package/package.json +7 -7
@@ -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?: BaseConditionDateMode;
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;
@@ -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,18 +71,32 @@ 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';
78
+ export { ValidateBaseFormulaCommand } from './commands/commands/validate-base-formula.command';
79
+ export type { IValidateBaseFormulaCommandParams } from './commands/commands/validate-base-formula.command';
69
80
  export { ApplyBaseJson1Mutation } from './commands/mutations/apply-base-json1.mutation';
70
81
  export type { IApplyBaseJson1MutationParams } from './commands/mutations/apply-base-json1.mutation';
71
82
  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 { matchesBaseCondition } from './fields/field-core-plugin';
83
+ export { baseDateSerialToDateMs, dateToExcelSerial, formatBaseDateValue, normalizeBaseDateFieldConfig, normalizeBaseDateSerial, resolveBaseDateFieldConfig, } from './fields/date-format';
84
+ export type { IResolvedBaseDateFieldConfig, } from './fields/date-format';
85
+ export { getBaseConditionalColorOperators, isBaseConditionalColorDateField, matchesBaseCondition } from './fields/field-core-plugin';
86
+ export { BASE_FIELD_STAT_TYPES, calculateBaseFieldStat, formatBaseFieldStatValue, getSupportedBaseFieldStatTypes, isBaseFieldStatEmptyValue, isBaseFieldStatSupported, isBaseFieldStatType, normalizeBaseFieldStatsConfig, } from './fields/field-stat';
87
+ export type { BaseFieldStatType } from './fields/field-stat';
74
88
  export { formatBaseNumberValue, inferBaseSeparatorStyle, } from './fields/number-format';
89
+ export { formatBaseProgressValue } from './fields/progress-format';
75
90
  export { uniqueFieldName } from './fields/util';
76
91
  export { ensureBaseTableCellLayout, getBaseCellFormulaValue, getBaseCellValue, } from './models/base-cell-data';
92
+ 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';
93
+ export type { IBaseHierarchyChange, IBaseHierarchyIndex, IBaseHierarchyRecordPatch, } from './models/base-hierarchy';
77
94
  export { copyBaseTableSnapshot } from './models/base-table-copy';
95
+ export { BASE_TABLE_NAME_REQUIREMENTS, createUniqueBaseTableName, validateBaseTableName } from './models/base-table-name';
96
+ export type { BaseTableNameValidationError, IBaseTableNameValidationResult } from './models/base-table-name';
78
97
  export { createDefaultBaseTableSnapshot } from './models/default-table';
98
+ export { findRecordLinkReferences, getRecordLinkFieldConfig, parseRecordLinkIds, serializeRecordLinkIds, validateCanonicalRecordLinkValue, validateRecordLinkField, validateRecordLinkValue, } from './models/record-link';
99
+ export type { IRecordLinkReference } from './models/record-link';
79
100
  export { BaseJson1OpApplier } from './ot/json1-op-applier';
80
101
  export { BaseJson1OpFactory } from './ot/json1-op-factory';
81
102
  export { UniverBasesPlugin, UniverRemoteBasesPlugin, } from './plugin';
@@ -83,6 +104,8 @@ export { searchBaseTable } from './search/base-search';
83
104
  export type { IBaseTableSearchRequest } from './search/base-search';
84
105
  export type { IBaseTableSearchMatch, IBaseTableSearchResult, } from './search/base-search';
85
106
  export { IBaseCommandService } from './services/base-command.service';
107
+ export { BaseFormulaService, getBaseFormulaTableName } from './services/base-formula.service';
108
+ export type { IBaseFormulaValidationResult } from './services/base-formula.service';
86
109
  export { traceBasePerformance } from './services/base-performance.service';
87
110
  export { IBasePermissionService } from './services/base-permission.service';
88
111
  export type { IBaseFieldPermission, IBasePermissionSnapshot, IBaseRecordPermission, IBaseTablePermission, } from './services/base-permission.service';
@@ -23,7 +23,7 @@ declare const locale: {
23
23
  progress: string;
24
24
  currency: string;
25
25
  rating: string;
26
- twoWayLink: string;
26
+ recordLink: string;
27
27
  recordId: string;
28
28
  createdBy: string;
29
29
  updatedBy: string;
@@ -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
+ };
@@ -0,0 +1,8 @@
1
+ import type { IBaseSnapshot, IValidationResult } from '@univerjs/core';
2
+ export declare const BASE_TABLE_NAME_REQUIREMENTS = "Base table names are exported as Excel worksheet names and must contain 1-31 characters, not start or end with an apostrophe, not contain : \\ / ? * [ ], and be unique (case-insensitive).";
3
+ export type BaseTableNameValidationError = 'required' | 'too-long' | 'apostrophe' | 'invalid-characters' | 'duplicate' | 'invalid';
4
+ export interface IBaseTableNameValidationResult extends IValidationResult {
5
+ error?: BaseTableNameValidationError;
6
+ }
7
+ export declare function validateBaseTableName(snapshot: IBaseSnapshot, name: string, currentTableId?: string): IBaseTableNameValidationResult;
8
+ export declare function createUniqueBaseTableName(snapshot: IBaseSnapshot, baseName: string): string;
@@ -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[];
@@ -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[];
@@ -57,9 +57,9 @@ export declare class BaseJson1OpFactory {
57
57
  }): JSONXActions;
58
58
  private _setViewFieldSetting;
59
59
  private _createRecordOrderOp;
60
+ private _materializeFormulaTableNames;
60
61
  private _setFormulaFieldCells;
61
62
  private _setAttachmentResources;
62
63
  private _deleteAttachmentResources;
63
64
  private _replaceOptional;
64
65
  }
65
- export declare function renameBaseFormulaTableReferences(formula: string, oldName: string, newName: string): string;
@@ -1,2 +1,2 @@
1
- import type { JSONXActions } from '@univerjs/core';
2
- export declare function composeJson1Ops(ops: JSONXActions[]): JSONXActions;
1
+ import { JSON1 } from '@univerjs/core';
2
+ export declare function composeJson1Ops(ops: readonly Parameters<typeof JSON1.type.compose>[0][]): ReturnType<typeof JSON1.type.compose>;
@@ -122,4 +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
  }
@@ -1,6 +1,6 @@
1
- import type { ISetFormulaCalculationResultMutation, ISuperTable, ISuperTableService } from '@univerjs-pro/engine-formula';
1
+ import type { ISetFormulaCalculationResultMutation, ISuperTable } from '@univerjs-pro/engine-formula';
2
2
  import type { IBaseCellData, IBaseSnapshot, ITableSnapshot } from '@univerjs/core';
3
- import { ObjectMatrix } from '@univerjs/core';
3
+ export { getBaseFormulaTableName } from '@univerjs/core';
4
4
  export interface IBaseFormulaValidationResult {
5
5
  valid: boolean;
6
6
  reason?: string;
@@ -12,21 +12,6 @@ export interface IBaseFormulaDependency {
12
12
  export interface IBaseFormulaContext {
13
13
  snapshot?: IBaseSnapshot;
14
14
  }
15
- export interface IBaseFormulaCalculationDataset {
16
- formulaData: Record<string, Record<string, Record<number, Record<number, {
17
- f: string;
18
- si?: string;
19
- }>>>>;
20
- allUnitData: Record<string, Record<string, {
21
- cellData: ObjectMatrix<IBaseCellData | null>;
22
- rowCount: number;
23
- columnCount: number;
24
- rowData: Record<number, unknown>;
25
- columnData: Record<number, unknown>;
26
- }>>;
27
- unitStylesData: Record<string, Record<string, unknown>>;
28
- unitSheetNameMap: Record<string, Record<string, string>>;
29
- }
30
15
  export interface IBaseSuperTableRegistration {
31
16
  tableId: string;
32
17
  tableName: string;
@@ -43,15 +28,9 @@ export interface IBaseFormulaResultPatchGroup {
43
28
  }
44
29
  export declare class BaseFormulaService {
45
30
  createSuperTableReference(table: ITableSnapshot, sheetId?: string): ISuperTable;
46
- registerSuperTable(superTableService: ISuperTableService, unitId: string, table: ITableSnapshot, options?: {
47
- tableName?: string;
48
- sheetId?: string;
49
- }): ISuperTable;
50
- registerSuperTables(superTableService: ISuperTableService, snapshot: IBaseSnapshot): ISuperTable[];
51
31
  getSuperTableRegistrations(snapshot: IBaseSnapshot, tableIds?: Iterable<string>): IBaseSuperTableRegistration[];
52
32
  validateFormula(formula: string, table: ITableSnapshot, context?: IBaseFormulaContext): IBaseFormulaValidationResult;
53
33
  getDependencies(formula: string, table: ITableSnapshot, context?: IBaseFormulaContext): string[];
54
34
  getStructuredDependencies(formula: string, table: ITableSnapshot, context?: IBaseFormulaContext): IBaseFormulaDependency[];
55
35
  }
56
- export declare function createBaseFormulaCalculationDataset(snapshot: IBaseSnapshot): IBaseFormulaCalculationDataset;
57
36
  export declare function createBaseFormulaResultPatches(snapshot: IBaseSnapshot, result: ISetFormulaCalculationResultMutation): IBaseFormulaResultPatchGroup[];
@@ -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;