@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.
Files changed (135) 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/mutations/apply-base-json1.mutation.d.ts +4 -0
  77. package/lib/types/commands/utils/base-record-creation.d.ts +18 -0
  78. package/lib/types/commands/utils/base-validation.d.ts +6 -1
  79. package/lib/types/controllers/base-formula-calculation.controller.d.ts +6 -1
  80. package/lib/types/facade/f-base.d.ts +4 -2
  81. package/lib/types/facade/f-enum.d.ts +277 -6
  82. package/lib/types/facade/f-event.d.ts +102 -0
  83. package/lib/types/facade/f-field.d.ts +40 -7
  84. package/lib/types/facade/f-range.d.ts +4 -1
  85. package/lib/types/facade/f-record.d.ts +377 -2
  86. package/lib/types/facade/f-table.d.ts +287 -16
  87. package/lib/types/facade/f-univer.d.ts +2 -0
  88. package/lib/types/facade/f-view.d.ts +179 -3
  89. package/lib/types/facade/field-key.d.ts +3 -1
  90. package/lib/types/facade/index.d.ts +2 -1
  91. package/lib/types/fields/date-format.d.ts +20 -1
  92. package/lib/types/fields/field-core-plugin.d.ts +7 -5
  93. package/lib/types/fields/field-stat.d.ts +10 -0
  94. package/lib/types/fields/number-format.d.ts +3 -3
  95. package/lib/types/fields/progress-format.d.ts +1 -0
  96. package/lib/types/index.d.ts +21 -4
  97. package/lib/types/locale/en-US.d.ts +1 -1
  98. package/lib/types/models/base-hierarchy.d.ts +108 -0
  99. package/lib/types/models/default-table.d.ts +0 -1
  100. package/lib/types/models/record-link.d.ts +14 -0
  101. package/lib/types/ot/json1-adapter.d.ts +0 -1
  102. package/lib/types/ot/json1-op-applier.d.ts +3 -1
  103. package/lib/types/ot/json1-op-factory.d.ts +0 -3
  104. package/lib/types/ot/json1-util.d.ts +2 -2
  105. package/lib/types/search/base-search.d.ts +0 -3
  106. package/lib/types/services/base-active-dirty.service.d.ts +0 -1
  107. package/lib/types/services/base-command.service.d.ts +1 -1
  108. package/lib/types/services/base-compression.service.d.ts +0 -5
  109. package/lib/types/services/base-formula.service.d.ts +1 -3
  110. package/lib/types/services/base-permission.service.d.ts +0 -4
  111. package/lib/types/services/base-projection.service.d.ts +4 -0
  112. package/lib/types/views/view-core-plugin.d.ts +0 -2
  113. package/lib/umd/facade.js +1 -1
  114. package/lib/umd/index.js +1 -1
  115. package/lib/umd/locale/ar-SA.js +1 -1
  116. package/lib/umd/locale/ca-ES.js +1 -1
  117. package/lib/umd/locale/de-DE.js +1 -1
  118. package/lib/umd/locale/en-US.js +1 -1
  119. package/lib/umd/locale/es-ES.js +1 -1
  120. package/lib/umd/locale/fa-IR.js +1 -1
  121. package/lib/umd/locale/fr-FR.js +1 -1
  122. package/lib/umd/locale/id-ID.js +1 -1
  123. package/lib/umd/locale/it-IT.js +1 -1
  124. package/lib/umd/locale/ja-JP.js +1 -1
  125. package/lib/umd/locale/ko-KR.js +1 -1
  126. package/lib/umd/locale/pl-PL.js +1 -1
  127. package/lib/umd/locale/pt-BR.js +1 -1
  128. package/lib/umd/locale/ru-RU.js +1 -1
  129. package/lib/umd/locale/sk-SK.js +1 -1
  130. package/lib/umd/locale/vi-VN.js +1 -1
  131. package/lib/umd/locale/zh-CN.js +1 -1
  132. package/lib/umd/locale/zh-HK.js +1 -1
  133. package/lib/umd/locale/zh-TW.js +1 -1
  134. package/package.json +7 -6
  135. package/lib/types/facade/f-types.d.ts +0 -1
@@ -1 +1 @@
1
- function _0x45f3(){const _0x5bebe2=['更新視圖設置','5889QlVTFn','看板需要可分組字段','輸入內容','創建字段','11KqcuUg','創建記錄','3114PcVJfW','刪除記錄','刪除字段','15CGPuMj','雙向關聯','882WawXHn','甘特視圖需要開始和結束日期字段','創建時間','電話號碼','創建人','複選框','記錄\x20ID','輸入\x20URL(例如\x20univer.ai\x20或\x20https://univer.ai/skills)。','139799lPGaTI','更新時間','10697328bDEGtx','14890ZiPPzv','158WcsHYV','日曆需要日期字段','修改人','173260YuoWIl','更新單元格','19398MwxBaA','字段類型無效','3607072zrShvW'];_0x45f3=function(){return _0x5bebe2;};return _0x45f3();}const _0x4f5cd6=_0x3a92;function _0x3a92(_0x4194b4,_0x429a1f){_0x4194b4=_0x4194b4-0xc6;const _0x45f383=_0x45f3();let _0x3a9237=_0x45f383[_0x4194b4];return _0x3a9237;}(function(_0x219701,_0x4c591e){const _0x4d2529=_0x3a92,_0x3be6ae=_0x219701();while(!![]){try{const _0x1be38f=parseInt(_0x4d2529(0xc8))/0x1+-parseInt(_0x4d2529(0xcc))/0x2*(-parseInt(_0x4d2529(0xd5))/0x3)+-parseInt(_0x4d2529(0xcf))/0x4*(parseInt(_0x4d2529(0xde))/0x5)+-parseInt(_0x4d2529(0xd1))/0x6*(-parseInt(_0x4d2529(0xe0))/0x7)+-parseInt(_0x4d2529(0xd3))/0x8+parseInt(_0x4d2529(0xdb))/0x9*(-parseInt(_0x4d2529(0xcb))/0xa)+-parseInt(_0x4d2529(0xd9))/0xb*(-parseInt(_0x4d2529(0xca))/0xc);if(_0x1be38f===_0x4c591e)break;else _0x3be6ae['push'](_0x3be6ae['shift']());}catch(_0x662b69){_0x3be6ae['push'](_0x3be6ae['shift']());}}}(_0x45f3,0x797f7));const e={'bases':{'fieldType':{'text':'文本','singleSelect':'單選','multiSelect':'多選','person':'人員','group':'分組','date':'日期','attachment':'附件','number':'數字','checkbox':_0x4f5cd6(0xe5),'link':'鏈接','formula':'公式','lookup':'查找','flow':'流程','button':'按鈕','numbering':'編號','phone':_0x4f5cd6(0xe3),'email':'郵箱','location':'位置','barcode':'條碼','progress':'進度','currency':'貨幣','rating':'評分','twoWayLink':_0x4f5cd6(0xdf),'recordId':_0x4f5cd6(0xc6),'createdBy':_0x4f5cd6(0xe4),'updatedBy':_0x4f5cd6(0xce),'createdAt':_0x4f5cd6(0xe2),'updatedAt':_0x4f5cd6(0xc9),'summary':'彙總'},'fieldConfig':{'textPlaceholder':_0x4f5cd6(0xd7),'linkPlaceholder':_0x4f5cd6(0xc7)},'viewType':{'grid':'表格','kanban':'看板','calendar':'日曆','gantt':'甘特','gallery':'畫廊'},'error':{'fieldNameRequired':'字段標題不能為空','invalidFieldType':_0x4f5cd6(0xd2),'invalidCellValue':'單元格值無效','invalidKanbanGroupField':_0x4f5cd6(0xd6),'invalidCalendarDateField':_0x4f5cd6(0xcd),'invalidGanttDateField':_0x4f5cd6(0xe1)},'command':{'updateCell':_0x4f5cd6(0xd0),'createField':_0x4f5cd6(0xd8),'deleteField':_0x4f5cd6(0xdd),'createRecord':_0x4f5cd6(0xda),'deleteRecord':_0x4f5cd6(0xdc),'updateViewConfig':_0x4f5cd6(0xd4)}}};export{e as default};
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,15 +1,20 @@
1
1
  import { FormulaCalculationTriggerService } from '@univerjs-pro/engine-formula';
2
2
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
3
+ import { FormulaCalculationSessionService } from '@univerjs/engine-formula';
3
4
  export declare class BaseFormulaCalculationController extends Disposable {
4
5
  private readonly _commandService;
5
6
  private readonly _univerInstanceService;
7
+ protected readonly _formulaCalculationTriggerService: FormulaCalculationTriggerService;
8
+ private readonly _formulaCalculationSessionService;
6
9
  private readonly _formulaService;
7
10
  private readonly _registeredSuperTableNames;
11
+ private readonly _scheduledSuperTableSyncs;
8
12
  private _formulaSyncQueue;
9
13
  private _applyingFormulaResults;
10
- constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, formulaCalculationTriggerService: FormulaCalculationTriggerService);
14
+ constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _formulaCalculationTriggerService: FormulaCalculationTriggerService, _formulaCalculationSessionService: FormulaCalculationSessionService);
11
15
  private _initialize;
12
16
  private _onCommandExecuted;
17
+ private _scheduleSuperTableSync;
13
18
  private _syncSuperTables;
14
19
  private _removeSuperTables;
15
20
  private _enqueueFormulaSync;
@@ -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 } 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;
@@ -13,7 +13,9 @@ export interface IBaseSchemaSnapshot {
13
13
  export declare class FBase {
14
14
  private readonly _base;
15
15
  protected readonly _injector: Injector;
16
- constructor(_base: BaseDataModel, _injector: Injector);
16
+ private readonly _resourceLoaderService;
17
+ private readonly _commandService;
18
+ constructor(_base: BaseDataModel, _injector: Injector, _resourceLoaderService: IResourceLoaderService, _commandService: ICommandService);
17
19
  /**
18
20
  * Get the underlying Base data model.
19
21
  * @returns {BaseDataModel} The underlying Base data model.
@@ -1,15 +1,85 @@
1
- import { BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseSortDirection, BaseViewType } from '@univerjs/core';
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 {
5
6
  /**
6
- * Base field types.
7
- * @example
7
+ * Base field types. The Base plugin currently exposes the 21 field types demonstrated below.
8
+ * Other enum members are reserved for field plugins that are not enabled by default.
9
+ * @example Create and populate every field type exposed by the Base UI
8
10
  * ```ts
9
11
  * const fBase = univerAPI.getActiveBase();
10
- * const fBaseTable = fBase.getTableById('table-1');
11
- * const field = fBaseTable.addField('Name', univerAPI.Enum.BaseFieldType.Text);
12
- * console.log(field);
12
+ * if (!fBase) throw new Error('No active Base.');
13
+ * const table = fBase.insertTable(`Field examples ${Date.now()}`, { primaryFieldName: 'Title' });
14
+ * const title = table.getPrimaryField(); // Primary fields are Text fields.
15
+ * if (title.getType() !== univerAPI.Enum.BaseFieldType.Text) throw new Error('Expected a Text primary field.');
16
+ *
17
+ * table.addField('Status', univerAPI.Enum.BaseFieldType.SingleSelect, {
18
+ * field: { config: { options: [{ id: 'todo', name: 'Todo', color: 'blue' }, { id: 'done', name: 'Done', color: 'green' }] } }
19
+ * });
20
+ * table.addField('Tags', univerAPI.Enum.BaseFieldType.MultiSelect, {
21
+ * field: { config: { options: [{ id: 'api', name: 'API', color: 'purple' }, { id: 'docs', name: 'Docs', color: 'orange' }] } }
22
+ * });
23
+ * table.addField('Owner', univerAPI.Enum.BaseFieldType.Person, { field: { config: { allowMultiple: false, provider: 'person' } } });
24
+ * table.addField('Teams', univerAPI.Enum.BaseFieldType.Group, { field: { config: { allowMultiple: true, provider: 'group' } } });
25
+ * table.addField('Due Date', univerAPI.Enum.BaseFieldType.Date, {
26
+ * field: { config: { pattern: 'yyyy/mm/dd', includeTime: true, hourCycle: 'h24' } }
27
+ * });
28
+ * const attachments = table.addField('Attachments', univerAPI.Enum.BaseFieldType.Attachment);
29
+ * table.addField('Amount', univerAPI.Enum.BaseFieldType.Number, { field: { config: { pattern: '#,##0.00', decimalPlaces: 2 } } });
30
+ * table.addField('Approved', univerAPI.Enum.BaseFieldType.Checkbox);
31
+ * table.addField('Website', univerAPI.Enum.BaseFieldType.Link);
32
+ * table.addField('Phone', univerAPI.Enum.BaseFieldType.Phone);
33
+ * table.addField('Email', univerAPI.Enum.BaseFieldType.Email);
34
+ * table.addField('Progress', univerAPI.Enum.BaseFieldType.Progress, { field: { config: { start: 0, end: 100 } } });
35
+ * table.addField('Budget', univerAPI.Enum.BaseFieldType.Currency, { field: { config: { currencySymbol: '$', decimalPlaces: 2 } } });
36
+ * table.addField('Rating', univerAPI.Enum.BaseFieldType.Rating, { field: { config: { min: 1, max: 5 } } });
37
+ * const formula = table.addField('Total', univerAPI.Enum.BaseFieldType.Formula, {
38
+ * field: { config: { formula: '=SUM([Amount],[Budget])' } },
39
+ * externalReferences: [], // Required; this formula only uses fields in the Host Base.
40
+ * });
41
+ * const numbering = table.addField('Sequence', univerAPI.Enum.BaseFieldType.Numbering);
42
+ * const createdBy = table.addField('Created By', univerAPI.Enum.BaseFieldType.CreatedBy);
43
+ * const updatedBy = table.addField('Updated By', univerAPI.Enum.BaseFieldType.UpdatedBy);
44
+ * const createdAt = table.addField('Created At', univerAPI.Enum.BaseFieldType.CreatedAt);
45
+ * const updatedAt = table.addField('Updated At', univerAPI.Enum.BaseFieldType.UpdatedAt);
46
+ *
47
+ * const record = table.addRecord({
48
+ * Title: 'Document every field type',
49
+ * Status: 'todo',
50
+ * Tags: ['api', 'docs'],
51
+ * Owner: 'user-1',
52
+ * Teams: ['group-1'],
53
+ * 'Due Date': 45839, // Excel serial for 2025-07-01.
54
+ * Attachments: [], // Populate with record.setAttachments(...) after creating the record.
55
+ * Amount: 1250.5,
56
+ * Approved: true,
57
+ * Website: { text: 'Univer', url: 'https://univer.ai' },
58
+ * Phone: '+1 555 0100',
59
+ * Email: 'agent@example.com',
60
+ * Progress: 75,
61
+ * Budget: 5000,
62
+ * Rating: 4,
63
+ * }, univerAPI.Enum.BaseFieldKeyEnum.Name, { createdBy: 'user-1', updatedBy: 'user-1' });
64
+ *
65
+ * const previewDataUrl = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
66
+ * record.setAttachments(attachments.getId(), [{
67
+ * id: 'local-preview',
68
+ * name: 'preview.gif',
69
+ * mimeType: 'image/gif',
70
+ * sourceType: univerAPI.Enum.ImageSourceType.BASE64,
71
+ * source: previewDataUrl
72
+ * }]);
73
+ *
74
+ * // Formula, numbering, and audit fields are generated and cannot be written directly.
75
+ * console.log({
76
+ * formula: record.getValue(formula.getId()),
77
+ * numbering: record.getValue(numbering.getId()),
78
+ * createdBy: record.getValue(createdBy.getId()),
79
+ * updatedBy: record.getValue(updatedBy.getId()),
80
+ * createdAt: record.getValue(createdAt.getId()),
81
+ * updatedAt: record.getValue(updatedAt.getId()),
82
+ * });
13
83
  * ```
14
84
  */
15
85
  BaseFieldType: typeof BaseFieldType;
@@ -92,6 +162,99 @@ export interface IFBaseEnumMixin {
92
162
  * ```
93
163
  */
94
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;
95
258
  /**
96
259
  * Base sort directions.
97
260
  * @example
@@ -109,6 +272,107 @@ export interface IFBaseEnumMixin {
109
272
  * ```
110
273
  */
111
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;
112
376
  }
113
377
  export declare class FBaseEnumMixin extends FEnum implements IFBaseEnumMixin {
114
378
  get BaseFieldType(): typeof BaseFieldType;
@@ -116,7 +380,14 @@ export declare class FBaseEnumMixin extends FEnum implements IFBaseEnumMixin {
116
380
  get BaseFilterOperator(): typeof BaseFilterOperator;
117
381
  get BaseFieldKeyEnum(): typeof BaseFieldKeyEnum;
118
382
  get BaseViewType(): typeof BaseViewType;
383
+ get BaseConditionalColorTarget(): typeof BaseConditionalColorTarget;
384
+ get BaseConditionalColorOperator(): typeof BaseConditionalColorOperator;
385
+ get BaseConditionalDateMode(): typeof BaseConditionalDateMode;
119
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;
120
391
  }
121
392
  declare module '@univerjs/core/facade' {
122
393
  interface FEnum extends IFBaseEnumMixin {