@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 +1 @@
1
- const _0x564dec=_0x3e86;function _0x4939(){const _0x288876=['創建人','484VWJIQa','記錄\x20ID','577460FBNLPF','日曆需要日期字段','雙向關聯','甘特視圖需要開始和結束日期字段','18zyUOqu','創建時間','1881003ixENKL','輸入內容','修改人','2406985VQhfgJ','更新時間','173105WWUABD','電話號碼','看板需要可分組字段','164916JnVIph','刪除記錄','1927944jSQktR','8xdPepI','更新視圖設置','32361yUjZFR','9EQFbxd','40oEgteH','創建字段','刪除字段','創建記錄','複選框','字段類型無效','輸入\x20URL(例如\x20univer.ai\x20或\x20https://univer.ai/skills)。'];_0x4939=function(){return _0x288876;};return _0x4939();}function _0x3e86(_0x2fb346,_0x1d0c63){_0x2fb346=_0x2fb346-0xf9;const _0x4939bb=_0x4939();let _0x3e86b5=_0x4939bb[_0x2fb346];return _0x3e86b5;}(function(_0x474408,_0x491b15){const _0x271ec7=_0x3e86,_0xa62d46=_0x474408();while(!![]){try{const _0x2ea46e=parseInt(_0x271ec7(0x108))/0x1*(parseInt(_0x271ec7(0x10a))/0x2)+parseInt(_0x271ec7(0xfb))/0x3+-parseInt(_0x271ec7(0x105))/0x4+parseInt(_0x271ec7(0x100))/0x5*(-parseInt(_0x271ec7(0xf9))/0x6)+parseInt(_0x271ec7(0xfe))/0x7*(parseInt(_0x271ec7(0x106))/0x8)+parseInt(_0x271ec7(0x109))/0x9*(-parseInt(_0x271ec7(0x114))/0xa)+parseInt(_0x271ec7(0x112))/0xb*(-parseInt(_0x271ec7(0x103))/0xc);if(_0x2ea46e===_0x491b15)break;else _0xa62d46['push'](_0xa62d46['shift']());}catch(_0x4153a9){_0xa62d46['push'](_0xa62d46['shift']());}}}(_0x4939,0x5a47d));const e={'bases':{'fieldType':{'text':'文本','singleSelect':'單選','multiSelect':'多選','person':'人員','group':'分組','date':'日期','attachment':'附件','number':'數字','checkbox':_0x564dec(0x10e),'link':'鏈接','formula':'公式','lookup':'查找','flow':'流程','button':'按鈕','numbering':'編號','phone':_0x564dec(0x101),'email':'郵箱','location':'位置','barcode':'條碼','progress':'進度','currency':'貨幣','rating':'評分','twoWayLink':_0x564dec(0x116),'recordId':_0x564dec(0x113),'createdBy':_0x564dec(0x111),'updatedBy':_0x564dec(0xfd),'createdAt':_0x564dec(0xfa),'updatedAt':_0x564dec(0xff),'summary':'彙總'},'fieldConfig':{'textPlaceholder':_0x564dec(0xfc),'linkPlaceholder':_0x564dec(0x110)},'viewType':{'grid':'表格','kanban':'看板','calendar':'日曆','gantt':'甘特','gallery':'畫廊'},'error':{'fieldNameRequired':'字段標題不能為空','invalidFieldType':_0x564dec(0x10f),'invalidCellValue':'單元格值無效','invalidKanbanGroupField':_0x564dec(0x102),'invalidCalendarDateField':_0x564dec(0x115),'invalidGanttDateField':_0x564dec(0x117)},'command':{'updateCell':'更新單元格','createField':_0x564dec(0x10b),'deleteField':_0x564dec(0x10c),'createRecord':_0x564dec(0x10d),'deleteRecord':_0x564dec(0x104),'updateViewConfig':_0x564dec(0x107)}}};export{e as default};
1
+ const _0x368c49=_0x5aef;function _0x5aef(_0x584f55,_0x2e1109){_0x584f55=_0x584f55-0xb7;const _0x3f8928=_0x3f89();let _0x5aef11=_0x3f8928[_0x584f55];return _0x5aef11;}(function(_0x132d5e,_0x11d62d){const _0x4bb536=_0x5aef,_0x27f0ec=_0x132d5e();while(!![]){try{const _0xa7dd58=-parseInt(_0x4bb536(0xd1))/0x1*(parseInt(_0x4bb536(0xca))/0x2)+parseInt(_0x4bb536(0xd2))/0x3+-parseInt(_0x4bb536(0xd3))/0x4*(-parseInt(_0x4bb536(0xcd))/0x5)+-parseInt(_0x4bb536(0xc1))/0x6*(-parseInt(_0x4bb536(0xb8))/0x7)+parseInt(_0x4bb536(0xd4))/0x8+-parseInt(_0x4bb536(0xb7))/0x9+-parseInt(_0x4bb536(0xbb))/0xa*(-parseInt(_0x4bb536(0xbe))/0xb);if(_0xa7dd58===_0x11d62d)break;else _0x27f0ec['push'](_0x27f0ec['shift']());}catch(_0x33d630){_0x27f0ec['push'](_0x27f0ec['shift']());}}}(_0x3f89,0xc4771));const e={'bases':{'fieldType':{'text':'文字','singleSelect':'單選','multiSelect':'多選','person':'人員','group':'分組','date':'日期','attachment':'附件','number':'數字','checkbox':_0x368c49(0xd5),'link':'連結','formula':'公式','lookup':'查詢','flow':'流程','button':'按鈕','numbering':'編號','phone':'電話號碼','email':_0x368c49(0xc9),'location':'位置','barcode':'條碼','progress':'進度','currency':'貨幣','rating':'評分','recordLink':_0x368c49(0xc7),'recordId':_0x368c49(0xce),'createdBy':_0x368c49(0xc5),'updatedBy':_0x368c49(0xbf),'createdAt':_0x368c49(0xc4),'updatedAt':_0x368c49(0xc6),'summary':'彙總'},'fieldConfig':{'textPlaceholder':_0x368c49(0xcb),'linkPlaceholder':_0x368c49(0xcf)},'viewType':{'grid':'表格','kanban':'看板','calendar':_0x368c49(0xc2),'gantt':_0x368c49(0xc3),'gallery':'圖庫'},'error':{'fieldNameRequired':'欄位標題不能為空','invalidFieldType':_0x368c49(0xba),'invalidCellValue':_0x368c49(0xbd),'invalidKanbanGroupField':'看板需要可分組欄位','invalidCalendarDateField':_0x368c49(0xcc),'invalidGanttDateField':_0x368c49(0xd0)},'command':{'updateCell':_0x368c49(0xc0),'createField':_0x368c49(0xbc),'deleteField':_0x368c49(0xb9),'createRecord':'建立記錄','deleteRecord':_0x368c49(0xc8),'updateViewConfig':'更新檢視設定'}}};export{e as default};function _0x3f89(){const _0x43c650=['4ZtSGcx','輸入內容','行事曆需要日期欄位','3010xQRwyl','記錄\x20ID','輸入\x20URL(例如\x20univer.ai\x20或\x20https://univer.ai/skills)。','甘特圖檢視需要開始和結束日期欄位','725749bHuMtU','1137783yvNzPS','5540yedxmw','4050736Ynmiqh','核取方塊','12519792DZKqNG','28srzYWN','刪除欄位','欄位類型無效','1476620nMXipb','建立欄位','儲存格值無效','121LMmJKq','更新人','更新儲存格','455478uGStwU','行事曆','甘特圖','建立時間','建立人','更新時間','關聯記錄','刪除記錄','電子郵件'];_0x3f89=function(){return _0x43c650;};return _0x3f89();}
@@ -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 {};
@@ -0,0 +1,8 @@
1
+ import type { ICommand } from '@univerjs/core';
2
+ import type { IBaseFormulaValidationResult } from '../../services/base-formula.service';
3
+ export interface IValidateBaseFormulaCommandParams {
4
+ unitId: string;
5
+ tableId: string;
6
+ formula: string;
7
+ }
8
+ export declare const ValidateBaseFormulaCommand: ICommand<IValidateBaseFormulaCommandParams, IBaseFormulaValidationResult>;
@@ -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;
@@ -17,6 +17,7 @@ export declare class BaseFormulaCalculationController extends Disposable {
17
17
  private _scheduleSuperTableSync;
18
18
  private _syncSuperTables;
19
19
  private _removeSuperTables;
20
+ private _executeSuperTableMutationWhileActive;
20
21
  private _enqueueFormulaSync;
21
22
  private _applyFormulaResult;
22
23
  }
@@ -1,9 +1,10 @@
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;
7
+ /** Human-readable Base display name. */
7
8
  name: string;
8
9
  tables: IBaseTableSchemaSnapshot[];
9
10
  }
@@ -14,7 +15,8 @@ export declare class FBase {
14
15
  private readonly _base;
15
16
  protected readonly _injector: Injector;
16
17
  private readonly _resourceLoaderService;
17
- constructor(_base: BaseDataModel, _injector: Injector, _resourceLoaderService: IResourceLoaderService);
18
+ private readonly _commandService;
19
+ constructor(_base: BaseDataModel, _injector: Injector, _resourceLoaderService: IResourceLoaderService, _commandService: ICommandService);
18
20
  /**
19
21
  * Get the underlying Base data model.
20
22
  * @returns {BaseDataModel} The underlying Base data model.
@@ -97,8 +99,11 @@ export declare class FBase {
97
99
  */
98
100
  getTableById(tableId: string): FBaseTable | null;
99
101
  /**
100
- * Get a table by name.
101
- * @param {string} tableName The table name.
102
+ * Get a table by its human-readable display name.
103
+ *
104
+ * This method does not look up the stable identifier used in formulas. To author a
105
+ * structured reference, get the table first and call `FBaseTable.getFormulaName()`.
106
+ * @param {string} displayName The table display name.
102
107
  * @returns {FBaseTable | null} The table facade, or null if the table does not exist.
103
108
  * @example
104
109
  * ```ts
@@ -107,21 +112,31 @@ export declare class FBase {
107
112
  * console.log(fBaseTable);
108
113
  * ```
109
114
  */
110
- getTableByName(tableName: string): FBaseTable | null;
115
+ getTableByName(displayName: string): FBaseTable | null;
111
116
  /**
112
117
  * Insert a new table into the Base.
113
- * @param {string} name The table name.
118
+ *
119
+ * The display name becomes an Excel worksheet name during export. It must contain
120
+ * 1-31 characters, not start or end with an apostrophe, not contain `: \\ / ? * [ ]`,
121
+ * and be unique within the Base (case-insensitive). It may differ from the stable formula name.
122
+ * Use the returned table's `getFormulaName()` when authoring structured references.
123
+ * @param {string} displayName The human-readable table display name.
114
124
  * @param {object} [options] Optional parameters for table creation.
115
125
  * @param {number} [options.index] Optional insertion index in the Base table order.
116
126
  * @param {string} [options.primaryFieldName] Optional name for the primary field of the new table.
117
127
  * @param {Partial<ITableSnapshot>} [options.table] Optional partial table snapshot to override default values.
128
+ * If it includes `name`, that value is validated and used instead of `displayName`.
118
129
  * @returns {FBaseTable} The newly created table facade.
130
+ * @throws {Error} If the effective display name violates the Excel worksheet-name rules.
131
+ * The error includes both the complete contract and the specific reason, so callers and agents
132
+ * can correct the input before retrying.
119
133
  *
120
134
  * @example
121
135
  * ```ts
122
136
  * const fBase = univerAPI.getActiveBase();
123
- * const fBaseTable = fBase.insertTable('Tasks');
124
- * console.log(fBaseTable);
137
+ * const fBaseTable = fBase.insertTable('Risk tracker');
138
+ * console.log(fBaseTable.getName()); // Human-readable display name: "Risk tracker"
139
+ * console.log(fBaseTable.getFormulaName()); // Stable name for formulas: "Risk_tracker"
125
140
  * ```
126
141
  *
127
142
  * @example Full table creation flow
@@ -163,7 +178,7 @@ export declare class FBase {
163
178
  * console.log(fBaseTable.getTable());
164
179
  * ```
165
180
  */
166
- insertTable(name: string, options?: {
181
+ insertTable(displayName: string, options?: {
167
182
  index?: number;
168
183
  table?: Partial<Omit<ITableSnapshot, 'id'>>;
169
184
  primaryFieldName?: string;
@@ -1,4 +1,5 @@
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 {
@@ -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, { field: { config: { pattern: 'yyyy/mm/dd', includeTime: false } } });
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);
@@ -31,8 +34,9 @@ export interface IFBaseEnumMixin {
31
34
  * table.addField('Progress', univerAPI.Enum.BaseFieldType.Progress, { field: { config: { start: 0, end: 100 } } });
32
35
  * table.addField('Budget', univerAPI.Enum.BaseFieldType.Currency, { field: { config: { currencySymbol: '$', decimalPlaces: 2 } } });
33
36
  * table.addField('Rating', univerAPI.Enum.BaseFieldType.Rating, { field: { config: { min: 1, max: 5 } } });
37
+ * const formulaTableName = table.getFormulaName();
34
38
  * const formula = table.addField('Total', univerAPI.Enum.BaseFieldType.Formula, {
35
- * field: { config: { formula: '=SUM([Amount],[Budget])' } },
39
+ * field: { config: { formula: `=SUM(${formulaTableName}[[#This Row],[Amount]],${formulaTableName}[[#This Row],[Budget]])` } },
36
40
  * externalReferences: [], // Required; this formula only uses fields in the Host Base.
37
41
  * });
38
42
  * const numbering = table.addField('Sequence', univerAPI.Enum.BaseFieldType.Numbering);
@@ -159,6 +163,99 @@ export interface IFBaseEnumMixin {
159
163
  * ```
160
164
  */
161
165
  BaseViewType: typeof BaseViewType;
166
+ /**
167
+ * Paint targets supported by Base conditional coloring.
168
+ *
169
+ * `CELL` colors only the evaluated field cell, `ROW` colors the complete
170
+ * matching record row, and `COLUMN` colors the selected field column
171
+ * unconditionally (its operator, operand, and date mode are ignored).
172
+ *
173
+ * @example Color an entire row when a Number field is greater than 80
174
+ * ```ts
175
+ * const base = univerAPI.getActiveBase();
176
+ * if (!base) throw new Error('Open a Base before running this example.');
177
+ * const table = base.insertTable(`Conditional target ${Date.now()}`, {
178
+ * primaryFieldName: 'Risk item'
179
+ * });
180
+ * const level = table.addField('Risk level', univerAPI.Enum.BaseFieldType.Number);
181
+ * const view = table.getViewByName('Grid');
182
+ * if (!view) throw new Error('The default Grid view was not created.');
183
+ *
184
+ * view.addConditionalColorRule({
185
+ * id: 'high-risk',
186
+ * color: '#fde9e9',
187
+ * target: univerAPI.Enum.BaseConditionalColorTarget.ROW,
188
+ * fieldId: level.getId(),
189
+ * operator: univerAPI.Enum.BaseConditionalColorOperator.GREATER_THAN,
190
+ * operand: 80
191
+ * });
192
+ * ```
193
+ */
194
+ BaseConditionalColorTarget: typeof BaseConditionalColorTarget;
195
+ /**
196
+ * Comparison operators supported by Base conditional coloring.
197
+ *
198
+ * Text-like fields support equality, containment, and empty checks. Numeric
199
+ * fields support equality, `GREATER_THAN`, `LESS_THAN`, and empty checks.
200
+ * Date-like fields support equality, `BEFORE`, `AFTER`, and empty checks,
201
+ * optionally with `BaseConditionalDateMode`. Checkbox fields support
202
+ * equality and inequality.
203
+ *
204
+ * @example Add a text containment rule
205
+ * ```ts
206
+ * const base = univerAPI.getActiveBase();
207
+ * if (!base) throw new Error('Open a Base before running this example.');
208
+ * const table = base.insertTable(`Conditional operator ${Date.now()}`, {
209
+ * primaryFieldName: 'Risk item'
210
+ * });
211
+ * const title = table.getPrimaryField();
212
+ * const view = table.getViewByName('Grid');
213
+ * if (!view) throw new Error('The default Grid view was not created.');
214
+ *
215
+ * view.addConditionalColorRule({
216
+ * id: 'delay-risk',
217
+ * color: '#fff7df',
218
+ * target: univerAPI.Enum.BaseConditionalColorTarget.CELL,
219
+ * fieldId: title.getId(),
220
+ * operator: univerAPI.Enum.BaseConditionalColorOperator.CONTAINS,
221
+ * operand: 'delay'
222
+ * });
223
+ * ```
224
+ */
225
+ BaseConditionalColorOperator: typeof BaseConditionalColorOperator;
226
+ /**
227
+ * Exact and relative windows supported by Date-like conditional color rules.
228
+ *
229
+ * Relative modes such as `TODAY`, `THIS_WEEK`, and `PAST_7_DAYS` do not
230
+ * require an operand. Use `EXACT` with an explicit date operand. `IS`
231
+ * matches dates inside the window, `IS_NOT` outside it, `BEFORE` before its
232
+ * start, and `AFTER` after its end.
233
+ *
234
+ * @example Highlight records due in the next seven days
235
+ * ```ts
236
+ * const base = univerAPI.getActiveBase();
237
+ * if (!base) throw new Error('Open a Base before running this example.');
238
+ * const table = base.insertTable(`Conditional date ${Date.now()}`, {
239
+ * primaryFieldName: 'Risk item'
240
+ * });
241
+ * const dueDate = table.addField(
242
+ * 'Due date',
243
+ * univerAPI.Enum.BaseFieldType.Date
244
+ * );
245
+ * const view = table.getViewByName('Grid');
246
+ * if (!view) throw new Error('The default Grid view was not created.');
247
+ *
248
+ * view.addConditionalColorRule({
249
+ * id: 'due-soon',
250
+ * color: '#eef3ff',
251
+ * target: univerAPI.Enum.BaseConditionalColorTarget.ROW,
252
+ * fieldId: dueDate.getId(),
253
+ * operator: univerAPI.Enum.BaseConditionalColorOperator.IS,
254
+ * dateMode: univerAPI.Enum.BaseConditionalDateMode.NEXT_7_DAYS
255
+ * });
256
+ * ```
257
+ */
258
+ BaseConditionalDateMode: typeof BaseConditionalDateMode;
162
259
  /**
163
260
  * Base sort directions.
164
261
  * @example
@@ -176,6 +273,107 @@ export interface IFBaseEnumMixin {
176
273
  * ```
177
274
  */
178
275
  BaseSortDirection: typeof BaseSortDirection;
276
+ /**
277
+ * Sources reported by `BaseHierarchyChanged` and
278
+ * `BeforeBaseHierarchyChange`.
279
+ *
280
+ * Use this enum instead of comparing source strings. `Facade` identifies a
281
+ * write initiated through the Facade API; `Remote` identifies a collaboration
282
+ * mutation; `Undo` and `Redo` identify history replay; and `Import` is reserved
283
+ * for import pipelines that attach hierarchy metadata to their mutation.
284
+ *
285
+ * @example Ignore collaboration echoes while reacting to local SDK writes
286
+ * ```ts
287
+ * const disposable = univerAPI.addEvent(
288
+ * univerAPI.Event.BaseHierarchyChanged,
289
+ * ({ changes, source }) => {
290
+ * if (source === univerAPI.Enum.BaseEventSource.Remote) return;
291
+ *
292
+ * for (const change of changes) {
293
+ * console.log(change.recordId, change.parentRecordId, source);
294
+ * }
295
+ * }
296
+ * );
297
+ *
298
+ * // Call disposable.dispose() when the integration is torn down.
299
+ * ```
300
+ */
301
+ BaseEventSource: typeof BaseEventSource;
302
+ /**
303
+ * Stable error codes thrown by hierarchy commands.
304
+ *
305
+ * SDK integrations should branch on `BaseHierarchyError.code`, not on a
306
+ * localized UI notification or the human-readable error message. The current
307
+ * codes cover an ineligible Parent field, a missing record, self-parent, cycle,
308
+ * five-level depth overflow, and manual drag while the view is sorted.
309
+ *
310
+ * @example Handle a hierarchy error without hard-coded strings
311
+ * ```ts
312
+ * import { BaseHierarchyError } from '@univerjs-pro/bases';
313
+ *
314
+ * try {
315
+ * record.setParent(table.getHierarchyFieldId(), targetRecordId);
316
+ * } catch (error) {
317
+ * if (!(error instanceof BaseHierarchyError)) throw error;
318
+ *
319
+ * switch (error.code) {
320
+ * case univerAPI.Enum.BaseHierarchyErrorCode.Cycle:
321
+ * console.error('The move would create a cycle.');
322
+ * break;
323
+ * case univerAPI.Enum.BaseHierarchyErrorCode.MaxDepth:
324
+ * console.error('The hierarchy supports at most five levels.');
325
+ * break;
326
+ * default:
327
+ * console.error('The hierarchy change was rejected.', error.code);
328
+ * }
329
+ * }
330
+ * ```
331
+ */
332
+ BaseHierarchyErrorCode: typeof BaseHierarchyErrorCode;
333
+ /**
334
+ * Reasons why a stored Parent edge is excluded from the effective tree.
335
+ *
336
+ * Collaboration data is not repaired by an extra client mutation. Instead,
337
+ * every client deterministically cuts an invalid edge and renders that record as
338
+ * a root. Model projections expose this enum so renderers and diagnostics can
339
+ * describe the same decision without hard-coded values.
340
+ *
341
+ * @example Inspect projection diagnostics
342
+ * ```ts
343
+ * const projection = table.getViewByName('Grid')?.getProjection();
344
+ * if (
345
+ * projection?.type === univerAPI.Enum.BaseViewType.Grid &&
346
+ * projection.hierarchy
347
+ * ) {
348
+ * for (const node of Object.values(projection.hierarchy.nodes)) {
349
+ * if (node.invalidReason === univerAPI.Enum.BaseHierarchyInvalidReason.Cycle) {
350
+ * console.warn(`Record ${node.recordId} has a cyclic Parent edge.`);
351
+ * }
352
+ * }
353
+ * }
354
+ * ```
355
+ */
356
+ BaseHierarchyInvalidReason: typeof BaseHierarchyInvalidReason;
357
+ /**
358
+ * Semantic roles supported by Base RecordLink fields.
359
+ *
360
+ * `Parent` marks the table's canonical same-table, single-value RecordLink.
361
+ * Prefer `table.getHierarchyFieldId()` and `table.setHierarchyField()` over
362
+ * editing `field.config.relationRole` directly, because the Facade write runs
363
+ * through the validated, undoable command path.
364
+ *
365
+ * @example Verify that the first child materialized the Parent field
366
+ * ```ts
367
+ * const fieldId = table.getHierarchyFieldId();
368
+ * const field = table.getFieldById(fieldId);
369
+ * const config = field?.getField().config;
370
+ *
371
+ * if (config?.relationRole === univerAPI.Enum.BaseRecordLinkRole.Parent) {
372
+ * console.log('Hierarchy field is materialized.');
373
+ * }
374
+ * ```
375
+ */
376
+ BaseRecordLinkRole: typeof BaseRecordLinkRole;
179
377
  }
180
378
  export declare class FBaseEnumMixin extends FEnum implements IFBaseEnumMixin {
181
379
  get BaseFieldType(): typeof BaseFieldType;
@@ -183,7 +381,14 @@ export declare class FBaseEnumMixin extends FEnum implements IFBaseEnumMixin {
183
381
  get BaseFilterOperator(): typeof BaseFilterOperator;
184
382
  get BaseFieldKeyEnum(): typeof BaseFieldKeyEnum;
185
383
  get BaseViewType(): typeof BaseViewType;
384
+ get BaseConditionalColorTarget(): typeof BaseConditionalColorTarget;
385
+ get BaseConditionalColorOperator(): typeof BaseConditionalColorOperator;
386
+ get BaseConditionalDateMode(): typeof BaseConditionalDateMode;
186
387
  get BaseSortDirection(): typeof BaseSortDirection;
388
+ get BaseEventSource(): typeof BaseEventSource;
389
+ get BaseHierarchyErrorCode(): typeof BaseHierarchyErrorCode;
390
+ get BaseHierarchyInvalidReason(): typeof BaseHierarchyInvalidReason;
391
+ get BaseRecordLinkRole(): typeof BaseRecordLinkRole;
187
392
  }
188
393
  declare module '@univerjs/core/facade' {
189
394
  interface FEnum extends IFBaseEnumMixin {