@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
package/lib/locale/zh-TW.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x4e93b4=_0x6599;(function(_0x57e720,_0x3213d8){const _0x4db50c=_0x6599,_0x419f6c=_0x57e720();while(!![]){try{const _0x340d4e=-parseInt(_0x4db50c(0xc4))/0x1*(-parseInt(_0x4db50c(0xc5))/0x2)+parseInt(_0x4db50c(0xb4))/0x3*(parseInt(_0x4db50c(0xd0))/0x4)+parseInt(_0x4db50c(0xc8))/0x5+-parseInt(_0x4db50c(0xbf))/0x6*(parseInt(_0x4db50c(0xb3))/0x7)+-parseInt(_0x4db50c(0xc1))/0x8*(-parseInt(_0x4db50c(0xc9))/0x9)+-parseInt(_0x4db50c(0xb9))/0xa*(parseInt(_0x4db50c(0xc6))/0xb)+-parseInt(_0x4db50c(0xbb))/0xc*(parseInt(_0x4db50c(0xb2))/0xd);if(_0x340d4e===_0x3213d8)break;else _0x419f6c['push'](_0x419f6c['shift']());}catch(_0x5e81bd){_0x419f6c['push'](_0x419f6c['shift']());}}}(_0x45d7,0xcf8a6));function _0x45d7(){const _0x2fa813=['甘特圖','更新儲存格','欄位類型無效','建立時間','13894470cUoHUi','建立人','92580HYkFHT','刪除欄位','電子郵件','更新人','4434ymqwdI','輸入\x20URL(例如\x20univer.ai\x20或\x20https://univer.ai/skills)。','271448vWoNCt','看板需要可分組欄位','儲存格值無效','1FZDZWC','2021978ZqkUhV','11nPmoAb','甘特圖檢視需要開始和結束日期欄位','1878020fWRpYO','369mmtDiC','建立欄位','行事曆需要日期欄位','欄位標題不能為空','更新檢視設定','記錄\x20ID','更新時間','2016628pGCXFR','關聯記錄','刪除記錄','377dnKcaV','12530EFmDTU','6waZueI'];_0x45d7=function(){return _0x2fa813;};return _0x45d7();}function _0x6599(_0x4f97bd,_0x490219){_0x4f97bd=_0x4f97bd-0xb0;const _0x45d766=_0x45d7();let _0x6599dd=_0x45d766[_0x4f97bd];return _0x6599dd;}const e={'bases':{'fieldType':{'text':'文字','singleSelect':'單選','multiSelect':'多選','person':'人員','group':'分組','date':'日期','attachment':'附件','number':'數字','checkbox':'核取方塊','link':'連結','formula':'公式','lookup':'查詢','flow':'流程','button':'按鈕','numbering':'編號','phone':'電話號碼','email':_0x4e93b4(0xbd),'location':'位置','barcode':'條碼','progress':'進度','currency':'貨幣','rating':'評分','recordLink':_0x4e93b4(0xb0),'recordId':_0x4e93b4(0xce),'createdBy':_0x4e93b4(0xba),'updatedBy':_0x4e93b4(0xbe),'createdAt':_0x4e93b4(0xb8),'updatedAt':_0x4e93b4(0xcf),'summary':'彙總'},'fieldConfig':{'textPlaceholder':'輸入內容','linkPlaceholder':_0x4e93b4(0xc0)},'viewType':{'grid':'表格','kanban':'看板','calendar':'行事曆','gantt':_0x4e93b4(0xb5),'gallery':'圖庫'},'error':{'fieldNameRequired':_0x4e93b4(0xcc),'invalidFieldType':_0x4e93b4(0xb7),'invalidCellValue':_0x4e93b4(0xc3),'invalidKanbanGroupField':_0x4e93b4(0xc2),'invalidCalendarDateField':_0x4e93b4(0xcb),'invalidGanttDateField':_0x4e93b4(0xc7)},'command':{'updateCell':_0x4e93b4(0xb6),'createField':_0x4e93b4(0xca),'deleteField':_0x4e93b4(0xbc),'createRecord':'建立記錄','deleteRecord':_0x4e93b4(0xb1),'updateViewConfig':_0x4e93b4(0xcd)}}};export{e as default};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ICommand, IRecordSnapshot } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
2
3
|
export interface IBatchCreateBaseRecordsCommandParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
tableId: string;
|
|
5
6
|
records: IRecordSnapshot[];
|
|
7
|
+
source?: BaseEventSource;
|
|
6
8
|
}
|
|
7
9
|
export declare const BatchCreateBaseRecordsCommand: ICommand<IBatchCreateBaseRecordsCommandParams>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ICommand } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
2
3
|
export interface IBatchDeleteBaseRecordsCommandParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
tableId: string;
|
|
5
6
|
recordIds: string[];
|
|
7
|
+
source?: BaseEventSource;
|
|
6
8
|
}
|
|
7
9
|
export declare const BatchDeleteBaseRecordsCommand: ICommand<IBatchDeleteBaseRecordsCommandParams>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ICommand, IRecordSnapshot } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
3
|
+
export interface ICreateBaseChildRecordCommandParams {
|
|
4
|
+
unitId: string;
|
|
5
|
+
tableId: string;
|
|
6
|
+
/** Optional compatibility hint. The table-level Parent field is resolved automatically. */
|
|
7
|
+
fieldId?: string;
|
|
8
|
+
/** Localized name used only when this first child materializes the Parent field. */
|
|
9
|
+
parentFieldName?: string;
|
|
10
|
+
parentRecordId: string;
|
|
11
|
+
record: IRecordSnapshot;
|
|
12
|
+
source?: BaseEventSource;
|
|
13
|
+
}
|
|
14
|
+
/** Create a direct child with the Parent value embedded in the initial record snapshot. */
|
|
15
|
+
export declare const CreateBaseChildRecordCommand: ICommand<ICreateBaseChildRecordCommandParams>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ICommand, IRecordSnapshot } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
2
3
|
export interface ICreateBaseRecordCommandParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
tableId: string;
|
|
5
6
|
record: IRecordSnapshot;
|
|
7
|
+
source?: BaseEventSource;
|
|
6
8
|
}
|
|
7
9
|
export declare const CreateBaseRecordCommand: ICommand<ICreateBaseRecordCommandParams>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ICommand } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
2
3
|
export interface IDeleteBaseRecordCommandParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
tableId: string;
|
|
5
6
|
recordId: string;
|
|
7
|
+
source?: BaseEventSource;
|
|
6
8
|
}
|
|
7
9
|
export declare const DeleteBaseRecordCommand: ICommand<IDeleteBaseRecordCommandParams>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ICommand, IRecordSnapshot } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
2
3
|
export interface IDuplicateBaseRecordCommandParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
tableId: string;
|
|
5
6
|
sourceRecordId: string;
|
|
6
7
|
record: IRecordSnapshot;
|
|
8
|
+
source?: BaseEventSource;
|
|
7
9
|
}
|
|
8
10
|
export declare const DuplicateBaseRecordCommand: ICommand<IDuplicateBaseRecordCommandParams>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ICommand } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
3
|
+
export interface IMoveBaseHierarchyRecordCommandParams {
|
|
4
|
+
unitId: string;
|
|
5
|
+
tableId: string;
|
|
6
|
+
/** Optional compatibility hint. The table-level Parent field is resolved automatically. */
|
|
7
|
+
fieldId?: string;
|
|
8
|
+
/** Localized name used only when this move materializes the Parent field. */
|
|
9
|
+
parentFieldName?: string;
|
|
10
|
+
recordId: string;
|
|
11
|
+
parentRecordId: string | null;
|
|
12
|
+
/** Optional table-level manual order used when the view has no explicit Sort. */
|
|
13
|
+
orderKey?: string;
|
|
14
|
+
source?: BaseEventSource;
|
|
15
|
+
}
|
|
16
|
+
/** Move a record and its implicit subtree as one JSON1 operation and one Undo entry. */
|
|
17
|
+
export declare const MoveBaseHierarchyRecordCommand: ICommand<IMoveBaseHierarchyRecordCommandParams>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { BaseCellValue, IBaseCellData, ICommand } from '@univerjs/core';
|
|
1
|
+
import type { BaseCellValue, IBaseCellData, ICommand, ITableSnapshot } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
2
3
|
export interface ISetBaseRangeValuesCommandParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
tableId: string;
|
|
@@ -11,5 +12,11 @@ export interface ISetBaseRangeValuesCommandParams {
|
|
|
11
12
|
fieldId: string;
|
|
12
13
|
value: BaseCellValue | IBaseCellData | null;
|
|
13
14
|
}>;
|
|
15
|
+
source?: BaseEventSource;
|
|
14
16
|
}
|
|
17
|
+
/** Resolve public row/column or record/field patches to their final record values. */
|
|
18
|
+
export declare function resolveBaseRangeHierarchyPatches(sourceTable: ITableSnapshot, patches: ISetBaseRangeValuesCommandParams['patches']): Array<{
|
|
19
|
+
recordId: string;
|
|
20
|
+
values: Record<string, BaseCellValue>;
|
|
21
|
+
}>;
|
|
15
22
|
export declare const SetBaseRangeValuesCommand: ICommand<ISetBaseRangeValuesCommandParams>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseCellValue, ICommand } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
2
3
|
export interface ISetBaseRecordValuesCommandParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
tableId: string;
|
|
@@ -6,5 +7,6 @@ export interface ISetBaseRecordValuesCommandParams {
|
|
|
6
7
|
recordId: string;
|
|
7
8
|
values: Record<string, BaseCellValue>;
|
|
8
9
|
}>;
|
|
10
|
+
source?: BaseEventSource;
|
|
9
11
|
}
|
|
10
12
|
export declare const SetBaseRecordValuesCommand: ICommand<ISetBaseRecordValuesCommandParams>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ICommand } from '@univerjs/core';
|
|
2
|
+
export interface ISetBaseTableHierarchyFieldCommandParams {
|
|
3
|
+
unitId: string;
|
|
4
|
+
tableId: string;
|
|
5
|
+
/** Select the table's canonical Parent RecordLink, or clear its semantic role. */
|
|
6
|
+
fieldId: string | null;
|
|
7
|
+
}
|
|
8
|
+
/** Set the table's one canonical Parent field as an atomic undoable operation. */
|
|
9
|
+
export declare const SetBaseTableHierarchyFieldCommand: ICommand<ISetBaseTableHierarchyFieldCommandParams>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { BaseCellValue, ICommand } from '@univerjs/core';
|
|
2
|
+
import { BaseEventSource } from '../../models/base-hierarchy';
|
|
2
3
|
export interface IUpdateBaseCellCommandParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
tableId: string;
|
|
5
6
|
recordId: string;
|
|
6
7
|
fieldId: string;
|
|
7
8
|
value: BaseCellValue;
|
|
9
|
+
source?: BaseEventSource;
|
|
8
10
|
}
|
|
9
11
|
export declare const UpdateBaseCellCommand: ICommand<IUpdateBaseCellCommandParams>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IBaseConditionalColorRule, ICommand } from '@univerjs/core';
|
|
2
|
+
/** Operations supported by {@link UpdateBaseViewConditionalColorRulesCommand}. */
|
|
3
|
+
export declare enum BaseConditionalColorRuleUpdateType {
|
|
4
|
+
Set = "set",
|
|
5
|
+
Add = "add",
|
|
6
|
+
Delete = "delete",
|
|
7
|
+
Clear = "clear"
|
|
8
|
+
}
|
|
9
|
+
interface IBaseConditionalColorRuleCommandTarget {
|
|
10
|
+
unitId: string;
|
|
11
|
+
tableId: string;
|
|
12
|
+
viewId: string;
|
|
13
|
+
}
|
|
14
|
+
/** Parameters for updating one view's ordered conditional coloring rules. */
|
|
15
|
+
export type IUpdateBaseViewConditionalColorRulesCommandParams = IBaseConditionalColorRuleCommandTarget & ({
|
|
16
|
+
type: BaseConditionalColorRuleUpdateType.Set;
|
|
17
|
+
rules: IBaseConditionalColorRule[];
|
|
18
|
+
} | {
|
|
19
|
+
type: BaseConditionalColorRuleUpdateType.Add;
|
|
20
|
+
rule: IBaseConditionalColorRule;
|
|
21
|
+
} | {
|
|
22
|
+
type: BaseConditionalColorRuleUpdateType.Delete;
|
|
23
|
+
ruleId: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: BaseConditionalColorRuleUpdateType.Clear;
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Update Base conditional coloring through a JSON1 mutation with undo/redo.
|
|
29
|
+
* Invalid rules are rejected before the mutation is executed.
|
|
30
|
+
*/
|
|
31
|
+
export declare const UpdateBaseViewConditionalColorRulesCommand: ICommand<IUpdateBaseViewConditionalColorRulesCommandParams>;
|
|
32
|
+
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { IMutation, JSONXActions } from '@univerjs/core';
|
|
2
|
+
import type { BaseEventSource, IBaseHierarchyChange } from '../../models/base-hierarchy';
|
|
2
3
|
export interface IApplyBaseJson1MutationParams {
|
|
3
4
|
unitId: string;
|
|
4
5
|
op: JSONXActions;
|
|
5
6
|
trigger?: string;
|
|
7
|
+
/** Semantic metadata consumed by optional SDK events; JSON1 remains the source of truth. */
|
|
8
|
+
hierarchyChanges?: IBaseHierarchyChange[];
|
|
9
|
+
source?: BaseEventSource;
|
|
6
10
|
}
|
|
7
11
|
export declare const ApplyBaseJson1Mutation: IMutation<IApplyBaseJson1MutationParams>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BaseDataModel, IFieldSnapshot, IRecordSnapshot } from '@univerjs/core';
|
|
2
|
+
import { validateBaseHierarchyRecordCreations } from '../../models/base-hierarchy';
|
|
3
|
+
interface IPreparedBaseRecordCreations {
|
|
4
|
+
records: IRecordSnapshot[];
|
|
5
|
+
hierarchyFieldToMaterialize: IFieldSnapshot | null;
|
|
6
|
+
hierarchyChanges: ReturnType<typeof validateBaseHierarchyRecordCreations>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Validate and normalize records before a create command builds its single JSON1 operation.
|
|
10
|
+
*
|
|
11
|
+
* The canonical Parent field is special only on its first write: the Facade may use the
|
|
12
|
+
* deterministic id returned by `getHierarchyFieldId()` before the field exists. This
|
|
13
|
+
* helper validates that virtual value with the same single-link rules as a materialized
|
|
14
|
+
* Parent field, then returns the field definition that must be composed with the record
|
|
15
|
+
* creation. Callers still own mutation execution and Undo/Redo registration.
|
|
16
|
+
*/
|
|
17
|
+
export declare function prepareBaseRecordCreations(base: BaseDataModel, tableId: string, records: readonly IRecordSnapshot[], parentFieldName?: string): IPreparedBaseRecordCreations | null;
|
|
18
|
+
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type { BaseDataModel } from '@univerjs/core';
|
|
1
|
+
import type { BaseCellValue, BaseDataModel, IBaseCellData, IFieldSnapshot, IRecordSnapshot } from '@univerjs/core';
|
|
2
2
|
export declare function validateBaseIds(base: BaseDataModel, tableId: string, checkIds?: {
|
|
3
3
|
viewIds?: string[];
|
|
4
4
|
fieldIds?: string[];
|
|
5
5
|
recordIds?: string[];
|
|
6
6
|
}): boolean;
|
|
7
|
+
export declare function validateBaseFieldDefinition(base: BaseDataModel, tableId: string, field: IFieldSnapshot): boolean;
|
|
8
|
+
export declare function validateBaseFieldValue(base: BaseDataModel, tableId: string, fieldId: string, value: BaseCellValue | IBaseCellData): boolean;
|
|
9
|
+
export declare function validateBaseRecordInput(base: BaseDataModel, tableId: string, record: IRecordSnapshot): boolean;
|
|
10
|
+
export declare function materializeBaseRecordIdentity(record: IRecordSnapshot): IRecordSnapshot;
|
|
11
|
+
export declare function getBaseWritePrimitive(value: BaseCellValue | IBaseCellData): unknown;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseDataModel, IBaseSnapshot, ITableSnapshot } from '@univerjs/core';
|
|
2
2
|
import type { IBaseTableSchemaSnapshot } from './f-table';
|
|
3
|
-
import { Injector, IResourceLoaderService } from '@univerjs/core';
|
|
3
|
+
import { ICommandService, Injector, IResourceLoaderService } from '@univerjs/core';
|
|
4
4
|
import { FBaseTable } from './f-table';
|
|
5
5
|
export interface IBaseSchemaSnapshot {
|
|
6
6
|
id: string;
|
|
@@ -14,7 +14,8 @@ export declare class FBase {
|
|
|
14
14
|
private readonly _base;
|
|
15
15
|
protected readonly _injector: Injector;
|
|
16
16
|
private readonly _resourceLoaderService;
|
|
17
|
-
|
|
17
|
+
private readonly _commandService;
|
|
18
|
+
constructor(_base: BaseDataModel, _injector: Injector, _resourceLoaderService: IResourceLoaderService, _commandService: ICommandService);
|
|
18
19
|
/**
|
|
19
20
|
* Get the underlying Base data model.
|
|
20
21
|
* @returns {BaseDataModel} The underlying Base data model.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseEventSource, BaseHierarchyErrorCode } from '@univerjs-pro/bases';
|
|
2
|
+
import { BaseConditionalColorOperator, BaseConditionalColorTarget, BaseConditionalDateMode, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseHierarchyInvalidReason, BaseRecordLinkRole, BaseSortDirection, BaseViewType } from '@univerjs/core';
|
|
2
3
|
import { FEnum } from '@univerjs/core/facade';
|
|
3
4
|
import { BaseFieldKeyEnum } from './field-key';
|
|
4
5
|
export interface IFBaseEnumMixin {
|
|
@@ -21,7 +22,9 @@ export interface IFBaseEnumMixin {
|
|
|
21
22
|
* });
|
|
22
23
|
* table.addField('Owner', univerAPI.Enum.BaseFieldType.Person, { field: { config: { allowMultiple: false, provider: 'person' } } });
|
|
23
24
|
* table.addField('Teams', univerAPI.Enum.BaseFieldType.Group, { field: { config: { allowMultiple: true, provider: 'group' } } });
|
|
24
|
-
* table.addField('Due Date', univerAPI.Enum.BaseFieldType.Date, {
|
|
25
|
+
* table.addField('Due Date', univerAPI.Enum.BaseFieldType.Date, {
|
|
26
|
+
* field: { config: { pattern: 'yyyy/mm/dd', includeTime: true, hourCycle: 'h24' } }
|
|
27
|
+
* });
|
|
25
28
|
* const attachments = table.addField('Attachments', univerAPI.Enum.BaseFieldType.Attachment);
|
|
26
29
|
* table.addField('Amount', univerAPI.Enum.BaseFieldType.Number, { field: { config: { pattern: '#,##0.00', decimalPlaces: 2 } } });
|
|
27
30
|
* table.addField('Approved', univerAPI.Enum.BaseFieldType.Checkbox);
|
|
@@ -159,6 +162,99 @@ export interface IFBaseEnumMixin {
|
|
|
159
162
|
* ```
|
|
160
163
|
*/
|
|
161
164
|
BaseViewType: typeof BaseViewType;
|
|
165
|
+
/**
|
|
166
|
+
* Paint targets supported by Base conditional coloring.
|
|
167
|
+
*
|
|
168
|
+
* `CELL` colors only the evaluated field cell, `ROW` colors the complete
|
|
169
|
+
* matching record row, and `COLUMN` colors the selected field column
|
|
170
|
+
* unconditionally (its operator, operand, and date mode are ignored).
|
|
171
|
+
*
|
|
172
|
+
* @example Color an entire row when a Number field is greater than 80
|
|
173
|
+
* ```ts
|
|
174
|
+
* const base = univerAPI.getActiveBase();
|
|
175
|
+
* if (!base) throw new Error('Open a Base before running this example.');
|
|
176
|
+
* const table = base.insertTable(`Conditional target ${Date.now()}`, {
|
|
177
|
+
* primaryFieldName: 'Risk item'
|
|
178
|
+
* });
|
|
179
|
+
* const level = table.addField('Risk level', univerAPI.Enum.BaseFieldType.Number);
|
|
180
|
+
* const view = table.getViewByName('Grid');
|
|
181
|
+
* if (!view) throw new Error('The default Grid view was not created.');
|
|
182
|
+
*
|
|
183
|
+
* view.addConditionalColorRule({
|
|
184
|
+
* id: 'high-risk',
|
|
185
|
+
* color: '#fde9e9',
|
|
186
|
+
* target: univerAPI.Enum.BaseConditionalColorTarget.ROW,
|
|
187
|
+
* fieldId: level.getId(),
|
|
188
|
+
* operator: univerAPI.Enum.BaseConditionalColorOperator.GREATER_THAN,
|
|
189
|
+
* operand: 80
|
|
190
|
+
* });
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
BaseConditionalColorTarget: typeof BaseConditionalColorTarget;
|
|
194
|
+
/**
|
|
195
|
+
* Comparison operators supported by Base conditional coloring.
|
|
196
|
+
*
|
|
197
|
+
* Text-like fields support equality, containment, and empty checks. Numeric
|
|
198
|
+
* fields support equality, `GREATER_THAN`, `LESS_THAN`, and empty checks.
|
|
199
|
+
* Date-like fields support equality, `BEFORE`, `AFTER`, and empty checks,
|
|
200
|
+
* optionally with `BaseConditionalDateMode`. Checkbox fields support
|
|
201
|
+
* equality and inequality.
|
|
202
|
+
*
|
|
203
|
+
* @example Add a text containment rule
|
|
204
|
+
* ```ts
|
|
205
|
+
* const base = univerAPI.getActiveBase();
|
|
206
|
+
* if (!base) throw new Error('Open a Base before running this example.');
|
|
207
|
+
* const table = base.insertTable(`Conditional operator ${Date.now()}`, {
|
|
208
|
+
* primaryFieldName: 'Risk item'
|
|
209
|
+
* });
|
|
210
|
+
* const title = table.getPrimaryField();
|
|
211
|
+
* const view = table.getViewByName('Grid');
|
|
212
|
+
* if (!view) throw new Error('The default Grid view was not created.');
|
|
213
|
+
*
|
|
214
|
+
* view.addConditionalColorRule({
|
|
215
|
+
* id: 'delay-risk',
|
|
216
|
+
* color: '#fff7df',
|
|
217
|
+
* target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
|
|
218
|
+
* fieldId: title.getId(),
|
|
219
|
+
* operator: univerAPI.Enum.BaseConditionalColorOperator.CONTAINS,
|
|
220
|
+
* operand: 'delay'
|
|
221
|
+
* });
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
BaseConditionalColorOperator: typeof BaseConditionalColorOperator;
|
|
225
|
+
/**
|
|
226
|
+
* Exact and relative windows supported by Date-like conditional color rules.
|
|
227
|
+
*
|
|
228
|
+
* Relative modes such as `TODAY`, `THIS_WEEK`, and `PAST_7_DAYS` do not
|
|
229
|
+
* require an operand. Use `EXACT` with an explicit date operand. `IS`
|
|
230
|
+
* matches dates inside the window, `IS_NOT` outside it, `BEFORE` before its
|
|
231
|
+
* start, and `AFTER` after its end.
|
|
232
|
+
*
|
|
233
|
+
* @example Highlight records due in the next seven days
|
|
234
|
+
* ```ts
|
|
235
|
+
* const base = univerAPI.getActiveBase();
|
|
236
|
+
* if (!base) throw new Error('Open a Base before running this example.');
|
|
237
|
+
* const table = base.insertTable(`Conditional date ${Date.now()}`, {
|
|
238
|
+
* primaryFieldName: 'Risk item'
|
|
239
|
+
* });
|
|
240
|
+
* const dueDate = table.addField(
|
|
241
|
+
* 'Due date',
|
|
242
|
+
* univerAPI.Enum.BaseFieldType.Date
|
|
243
|
+
* );
|
|
244
|
+
* const view = table.getViewByName('Grid');
|
|
245
|
+
* if (!view) throw new Error('The default Grid view was not created.');
|
|
246
|
+
*
|
|
247
|
+
* view.addConditionalColorRule({
|
|
248
|
+
* id: 'due-soon',
|
|
249
|
+
* color: '#eef3ff',
|
|
250
|
+
* target: univerAPI.Enum.BaseConditionalColorTarget.ROW,
|
|
251
|
+
* fieldId: dueDate.getId(),
|
|
252
|
+
* operator: univerAPI.Enum.BaseConditionalColorOperator.IS,
|
|
253
|
+
* dateMode: univerAPI.Enum.BaseConditionalDateMode.NEXT_7_DAYS
|
|
254
|
+
* });
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
BaseConditionalDateMode: typeof BaseConditionalDateMode;
|
|
162
258
|
/**
|
|
163
259
|
* Base sort directions.
|
|
164
260
|
* @example
|
|
@@ -176,6 +272,107 @@ export interface IFBaseEnumMixin {
|
|
|
176
272
|
* ```
|
|
177
273
|
*/
|
|
178
274
|
BaseSortDirection: typeof BaseSortDirection;
|
|
275
|
+
/**
|
|
276
|
+
* Sources reported by `BaseHierarchyChanged` and
|
|
277
|
+
* `BeforeBaseHierarchyChange`.
|
|
278
|
+
*
|
|
279
|
+
* Use this enum instead of comparing source strings. `Facade` identifies a
|
|
280
|
+
* write initiated through the Facade API; `Remote` identifies a collaboration
|
|
281
|
+
* mutation; `Undo` and `Redo` identify history replay; and `Import` is reserved
|
|
282
|
+
* for import pipelines that attach hierarchy metadata to their mutation.
|
|
283
|
+
*
|
|
284
|
+
* @example Ignore collaboration echoes while reacting to local SDK writes
|
|
285
|
+
* ```ts
|
|
286
|
+
* const disposable = univerAPI.addEvent(
|
|
287
|
+
* univerAPI.Event.BaseHierarchyChanged,
|
|
288
|
+
* ({ changes, source }) => {
|
|
289
|
+
* if (source === univerAPI.Enum.BaseEventSource.Remote) return;
|
|
290
|
+
*
|
|
291
|
+
* for (const change of changes) {
|
|
292
|
+
* console.log(change.recordId, change.parentRecordId, source);
|
|
293
|
+
* }
|
|
294
|
+
* }
|
|
295
|
+
* );
|
|
296
|
+
*
|
|
297
|
+
* // Call disposable.dispose() when the integration is torn down.
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
BaseEventSource: typeof BaseEventSource;
|
|
301
|
+
/**
|
|
302
|
+
* Stable error codes thrown by hierarchy commands.
|
|
303
|
+
*
|
|
304
|
+
* SDK integrations should branch on `BaseHierarchyError.code`, not on a
|
|
305
|
+
* localized UI notification or the human-readable error message. The current
|
|
306
|
+
* codes cover an ineligible Parent field, a missing record, self-parent, cycle,
|
|
307
|
+
* five-level depth overflow, and manual drag while the view is sorted.
|
|
308
|
+
*
|
|
309
|
+
* @example Handle a hierarchy error without hard-coded strings
|
|
310
|
+
* ```ts
|
|
311
|
+
* import { BaseHierarchyError } from '@univerjs-pro/bases';
|
|
312
|
+
*
|
|
313
|
+
* try {
|
|
314
|
+
* record.setParent(table.getHierarchyFieldId(), targetRecordId);
|
|
315
|
+
* } catch (error) {
|
|
316
|
+
* if (!(error instanceof BaseHierarchyError)) throw error;
|
|
317
|
+
*
|
|
318
|
+
* switch (error.code) {
|
|
319
|
+
* case univerAPI.Enum.BaseHierarchyErrorCode.Cycle:
|
|
320
|
+
* console.error('The move would create a cycle.');
|
|
321
|
+
* break;
|
|
322
|
+
* case univerAPI.Enum.BaseHierarchyErrorCode.MaxDepth:
|
|
323
|
+
* console.error('The hierarchy supports at most five levels.');
|
|
324
|
+
* break;
|
|
325
|
+
* default:
|
|
326
|
+
* console.error('The hierarchy change was rejected.', error.code);
|
|
327
|
+
* }
|
|
328
|
+
* }
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
BaseHierarchyErrorCode: typeof BaseHierarchyErrorCode;
|
|
332
|
+
/**
|
|
333
|
+
* Reasons why a stored Parent edge is excluded from the effective tree.
|
|
334
|
+
*
|
|
335
|
+
* Collaboration data is not repaired by an extra client mutation. Instead,
|
|
336
|
+
* every client deterministically cuts an invalid edge and renders that record as
|
|
337
|
+
* a root. Model projections expose this enum so renderers and diagnostics can
|
|
338
|
+
* describe the same decision without hard-coded values.
|
|
339
|
+
*
|
|
340
|
+
* @example Inspect projection diagnostics
|
|
341
|
+
* ```ts
|
|
342
|
+
* const projection = table.getViewByName('Grid')?.getProjection();
|
|
343
|
+
* if (
|
|
344
|
+
* projection?.type === univerAPI.Enum.BaseViewType.Grid &&
|
|
345
|
+
* projection.hierarchy
|
|
346
|
+
* ) {
|
|
347
|
+
* for (const node of Object.values(projection.hierarchy.nodes)) {
|
|
348
|
+
* if (node.invalidReason === univerAPI.Enum.BaseHierarchyInvalidReason.Cycle) {
|
|
349
|
+
* console.warn(`Record ${node.recordId} has a cyclic Parent edge.`);
|
|
350
|
+
* }
|
|
351
|
+
* }
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
BaseHierarchyInvalidReason: typeof BaseHierarchyInvalidReason;
|
|
356
|
+
/**
|
|
357
|
+
* Semantic roles supported by Base RecordLink fields.
|
|
358
|
+
*
|
|
359
|
+
* `Parent` marks the table's canonical same-table, single-value RecordLink.
|
|
360
|
+
* Prefer `table.getHierarchyFieldId()` and `table.setHierarchyField()` over
|
|
361
|
+
* editing `field.config.relationRole` directly, because the Facade write runs
|
|
362
|
+
* through the validated, undoable command path.
|
|
363
|
+
*
|
|
364
|
+
* @example Verify that the first child materialized the Parent field
|
|
365
|
+
* ```ts
|
|
366
|
+
* const fieldId = table.getHierarchyFieldId();
|
|
367
|
+
* const field = table.getFieldById(fieldId);
|
|
368
|
+
* const config = field?.getField().config;
|
|
369
|
+
*
|
|
370
|
+
* if (config?.relationRole === univerAPI.Enum.BaseRecordLinkRole.Parent) {
|
|
371
|
+
* console.log('Hierarchy field is materialized.');
|
|
372
|
+
* }
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
BaseRecordLinkRole: typeof BaseRecordLinkRole;
|
|
179
376
|
}
|
|
180
377
|
export declare class FBaseEnumMixin extends FEnum implements IFBaseEnumMixin {
|
|
181
378
|
get BaseFieldType(): typeof BaseFieldType;
|
|
@@ -183,7 +380,14 @@ export declare class FBaseEnumMixin extends FEnum implements IFBaseEnumMixin {
|
|
|
183
380
|
get BaseFilterOperator(): typeof BaseFilterOperator;
|
|
184
381
|
get BaseFieldKeyEnum(): typeof BaseFieldKeyEnum;
|
|
185
382
|
get BaseViewType(): typeof BaseViewType;
|
|
383
|
+
get BaseConditionalColorTarget(): typeof BaseConditionalColorTarget;
|
|
384
|
+
get BaseConditionalColorOperator(): typeof BaseConditionalColorOperator;
|
|
385
|
+
get BaseConditionalDateMode(): typeof BaseConditionalDateMode;
|
|
186
386
|
get BaseSortDirection(): typeof BaseSortDirection;
|
|
387
|
+
get BaseEventSource(): typeof BaseEventSource;
|
|
388
|
+
get BaseHierarchyErrorCode(): typeof BaseHierarchyErrorCode;
|
|
389
|
+
get BaseHierarchyInvalidReason(): typeof BaseHierarchyInvalidReason;
|
|
390
|
+
get BaseRecordLinkRole(): typeof BaseRecordLinkRole;
|
|
187
391
|
}
|
|
188
392
|
declare module '@univerjs/core/facade' {
|
|
189
393
|
interface FEnum extends IFBaseEnumMixin {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BaseEventSource, IBaseHierarchyChange } from '@univerjs-pro/bases';
|
|
1
2
|
import type { BaseCellValue, IFieldSnapshot, IRecordSnapshot, ITableSnapshot, IViewSnapshot } from '@univerjs/core';
|
|
2
3
|
import type { IEventBase } from '@univerjs/core/facade';
|
|
3
4
|
import type { FBase } from './f-base';
|
|
@@ -60,6 +61,31 @@ export interface IBaseTableCellValueChangedEventParams extends IEventBase {
|
|
|
60
61
|
}
|
|
61
62
|
export interface IBeforeBaseTableCellValueChangeEventParams extends IBaseTableCellValueChangedEventParams, IEventBase {
|
|
62
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Parameters emitted after one atomic hierarchy mutation is applied.
|
|
66
|
+
*
|
|
67
|
+
* `changes` contains semantic Parent-edge changes from the same JSON1 mutation.
|
|
68
|
+
* A single record move normally contributes one item; a range write or deletion
|
|
69
|
+
* that promotes several children can contribute multiple items. Consumers should
|
|
70
|
+
* process the array as one transaction rather than assuming one event per record.
|
|
71
|
+
*/
|
|
72
|
+
export interface IBaseHierarchyChangedEventParams extends IEventBase {
|
|
73
|
+
/** Facade object for the Base containing the changed table. */
|
|
74
|
+
base: FBase;
|
|
75
|
+
/** Facade object for the table whose effective hierarchy changed. */
|
|
76
|
+
table: FBaseTable;
|
|
77
|
+
/** Ordered semantic edge changes committed by the atomic mutation. */
|
|
78
|
+
changes: readonly IBaseHierarchyChange[];
|
|
79
|
+
/** Origin of the applied mutation. Compare with `univerAPI.Enum.BaseEventSource`. */
|
|
80
|
+
source: BaseEventSource;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Parameters emitted before a local semantic hierarchy command is validated and
|
|
84
|
+
* applied. Set the inherited `cancel` property to `true` to reject the entire
|
|
85
|
+
* command. Remote collaboration mutations and Undo/Redo replay are not cancellable.
|
|
86
|
+
*/
|
|
87
|
+
export interface IBeforeBaseHierarchyChangeEventParams extends IBaseHierarchyChangedEventParams, IEventBase {
|
|
88
|
+
}
|
|
63
89
|
/**
|
|
64
90
|
* Interface for base-related events
|
|
65
91
|
* @ignore
|
|
@@ -220,6 +246,78 @@ export interface IFBasesEventNameMixin {
|
|
|
220
246
|
* ```
|
|
221
247
|
*/
|
|
222
248
|
readonly BeforeBaseTableCellValueChange: 'BeforeBaseTableCellValueChange';
|
|
249
|
+
/**
|
|
250
|
+
* Fired after an atomic hierarchy mutation is applied.
|
|
251
|
+
*
|
|
252
|
+
* The event covers Facade and UI writes, remote collaboration mutations,
|
|
253
|
+
* Undo/Redo replay, and import mutations that carry hierarchy metadata. One
|
|
254
|
+
* event represents one committed mutation and may contain several Parent-edge
|
|
255
|
+
* changes. It is suitable for notifications, analytics, or SDK-side automation;
|
|
256
|
+
* do not write the same Parent edge again from the handler or an event loop may
|
|
257
|
+
* be created.
|
|
258
|
+
*
|
|
259
|
+
* Use `source` to distinguish local SDK work from remote or history replay. The
|
|
260
|
+
* source values are exposed through `univerAPI.Enum.BaseEventSource`; integrations
|
|
261
|
+
* do not need to hard-code strings.
|
|
262
|
+
*
|
|
263
|
+
* @see {@link IBaseHierarchyChangedEventParams}
|
|
264
|
+
* @example Trigger automation only for Facade writes
|
|
265
|
+
* ```ts
|
|
266
|
+
* const disposable = univerAPI.addEvent(
|
|
267
|
+
* univerAPI.Event.BaseHierarchyChanged,
|
|
268
|
+
* ({ table, changes, source }) => {
|
|
269
|
+
* if (source !== univerAPI.Enum.BaseEventSource.Facade) return;
|
|
270
|
+
*
|
|
271
|
+
* for (const { recordId, oldParentRecordId, parentRecordId } of changes) {
|
|
272
|
+
* console.log({
|
|
273
|
+
* tableId: table.getId(),
|
|
274
|
+
* recordId,
|
|
275
|
+
* oldParentRecordId,
|
|
276
|
+
* parentRecordId,
|
|
277
|
+
* });
|
|
278
|
+
* }
|
|
279
|
+
* }
|
|
280
|
+
* );
|
|
281
|
+
*
|
|
282
|
+
* // Call disposable.dispose() when the integration is torn down.
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
readonly BaseHierarchyChanged: 'BaseHierarchyChanged';
|
|
286
|
+
/**
|
|
287
|
+
* Fired before a local semantic hierarchy command is applied.
|
|
288
|
+
*
|
|
289
|
+
* Covered writes include `addChild()`, `setParent()`, standard record creation
|
|
290
|
+
* or duplication with an initial Parent value, deleting a parent whose surviving
|
|
291
|
+
* children would be promoted, a direct Parent-cell update, and multi-record or
|
|
292
|
+
* range writes touching the canonical Parent field.
|
|
293
|
+
* Setting `cancel = true` rejects the complete command, including every Parent
|
|
294
|
+
* edge, order update, and first-write field materialization in that command. No
|
|
295
|
+
* partial mutation or Undo entry is produced.
|
|
296
|
+
*
|
|
297
|
+
* The event is intentionally local: remote collaboration mutations and
|
|
298
|
+
* Undo/Redo replay have already been accepted and cannot be cancelled here.
|
|
299
|
+
* Use `BaseHierarchyChanged` to observe those sources.
|
|
300
|
+
*
|
|
301
|
+
* @see {@link IBeforeBaseHierarchyChangeEventParams}
|
|
302
|
+
* @example Prevent records from moving below a protected parent
|
|
303
|
+
* ```ts
|
|
304
|
+
* const disposable = univerAPI.addEvent(
|
|
305
|
+
* univerAPI.Event.BeforeBaseHierarchyChange,
|
|
306
|
+
* (event) => {
|
|
307
|
+
* const movesBelowProtectedParent = event.changes.some(
|
|
308
|
+
* ({ parentRecordId }) => parentRecordId === 'protected-task'
|
|
309
|
+
* );
|
|
310
|
+
*
|
|
311
|
+
* if (movesBelowProtectedParent) {
|
|
312
|
+
* event.cancel = true;
|
|
313
|
+
* }
|
|
314
|
+
* }
|
|
315
|
+
* );
|
|
316
|
+
*
|
|
317
|
+
* // Call disposable.dispose() when the integration is torn down.
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
readonly BeforeBaseHierarchyChange: 'BeforeBaseHierarchyChange';
|
|
223
321
|
}
|
|
224
322
|
/**
|
|
225
323
|
* Configuration interface for base-related events
|
|
@@ -236,6 +334,8 @@ export interface IBasesEventParamConfig {
|
|
|
236
334
|
BeforeBaseTableViewCreate: IBeforeBaseTableViewCreateEventParams;
|
|
237
335
|
BaseTableCellValueChanged: IBaseTableCellValueChangedEventParams;
|
|
238
336
|
BeforeBaseTableCellValueChange: IBeforeBaseTableCellValueChangeEventParams;
|
|
337
|
+
BaseHierarchyChanged: IBaseHierarchyChangedEventParams;
|
|
338
|
+
BeforeBaseHierarchyChange: IBeforeBaseHierarchyChangeEventParams;
|
|
239
339
|
}
|
|
240
340
|
export declare class FBasesEventNameMixin extends FEventName implements IFBasesEventNameMixin {
|
|
241
341
|
get BaseTableCreated(): 'BaseTableCreated';
|
|
@@ -248,6 +348,8 @@ export declare class FBasesEventNameMixin extends FEventName implements IFBasesE
|
|
|
248
348
|
get BeforeBaseTableViewCreate(): 'BeforeBaseTableViewCreate';
|
|
249
349
|
get BaseTableCellValueChanged(): 'BaseTableCellValueChanged';
|
|
250
350
|
get BeforeBaseTableCellValueChange(): 'BeforeBaseTableCellValueChange';
|
|
351
|
+
get BaseHierarchyChanged(): 'BaseHierarchyChanged';
|
|
352
|
+
get BeforeBaseHierarchyChange(): 'BeforeBaseHierarchyChange';
|
|
251
353
|
}
|
|
252
354
|
declare module '@univerjs/core/facade' {
|
|
253
355
|
interface FEventName extends IFBasesEventNameMixin {
|