@univerjs-pro/bases 1.0.0-beta.0 → 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 (94) 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/validate-base-formula.command.d.ts +8 -0
  65. package/lib/types/controllers/base-formula-calculation.controller.d.ts +1 -0
  66. package/lib/types/facade/f-base.d.ts +21 -7
  67. package/lib/types/facade/f-enum.d.ts +2 -1
  68. package/lib/types/facade/f-table.d.ts +47 -7
  69. package/lib/types/index.d.ts +6 -0
  70. package/lib/types/models/base-table-name.d.ts +8 -0
  71. package/lib/types/ot/json1-op-factory.d.ts +1 -1
  72. package/lib/types/services/base-formula.service.d.ts +2 -23
  73. package/lib/umd/facade.js +1 -1
  74. package/lib/umd/index.js +1 -1
  75. package/lib/umd/locale/ar-SA.js +1 -1
  76. package/lib/umd/locale/ca-ES.js +1 -1
  77. package/lib/umd/locale/de-DE.js +1 -1
  78. package/lib/umd/locale/en-US.js +1 -1
  79. package/lib/umd/locale/es-ES.js +1 -1
  80. package/lib/umd/locale/fa-IR.js +1 -1
  81. package/lib/umd/locale/fr-FR.js +1 -1
  82. package/lib/umd/locale/id-ID.js +1 -1
  83. package/lib/umd/locale/it-IT.js +1 -1
  84. package/lib/umd/locale/ja-JP.js +1 -1
  85. package/lib/umd/locale/ko-KR.js +1 -1
  86. package/lib/umd/locale/pl-PL.js +1 -1
  87. package/lib/umd/locale/pt-BR.js +1 -1
  88. package/lib/umd/locale/ru-RU.js +1 -1
  89. package/lib/umd/locale/sk-SK.js +1 -1
  90. package/lib/umd/locale/vi-VN.js +1 -1
  91. package/lib/umd/locale/zh-CN.js +1 -1
  92. package/lib/umd/locale/zh-HK.js +1 -1
  93. package/lib/umd/locale/zh-TW.js +1 -1
  94. package/package.json +7 -7
@@ -1 +1 @@
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
+ 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();}
@@ -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>;
@@ -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
  }
@@ -4,6 +4,7 @@ import { ICommandService, Injector, IResourceLoaderService } from '@univerjs/cor
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
  }
@@ -98,8 +99,11 @@ export declare class FBase {
98
99
  */
99
100
  getTableById(tableId: string): FBaseTable | null;
100
101
  /**
101
- * Get a table by name.
102
- * @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.
103
107
  * @returns {FBaseTable | null} The table facade, or null if the table does not exist.
104
108
  * @example
105
109
  * ```ts
@@ -108,21 +112,31 @@ export declare class FBase {
108
112
  * console.log(fBaseTable);
109
113
  * ```
110
114
  */
111
- getTableByName(tableName: string): FBaseTable | null;
115
+ getTableByName(displayName: string): FBaseTable | null;
112
116
  /**
113
117
  * Insert a new table into the Base.
114
- * @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.
115
124
  * @param {object} [options] Optional parameters for table creation.
116
125
  * @param {number} [options.index] Optional insertion index in the Base table order.
117
126
  * @param {string} [options.primaryFieldName] Optional name for the primary field of the new table.
118
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`.
119
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.
120
133
  *
121
134
  * @example
122
135
  * ```ts
123
136
  * const fBase = univerAPI.getActiveBase();
124
- * const fBaseTable = fBase.insertTable('Tasks');
125
- * 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"
126
140
  * ```
127
141
  *
128
142
  * @example Full table creation flow
@@ -164,7 +178,7 @@ export declare class FBase {
164
178
  * console.log(fBaseTable.getTable());
165
179
  * ```
166
180
  */
167
- insertTable(name: string, options?: {
181
+ insertTable(displayName: string, options?: {
168
182
  index?: number;
169
183
  table?: Partial<Omit<ITableSnapshot, 'id'>>;
170
184
  primaryFieldName?: string;
@@ -34,8 +34,9 @@ export interface IFBaseEnumMixin {
34
34
  * table.addField('Progress', univerAPI.Enum.BaseFieldType.Progress, { field: { config: { start: 0, end: 100 } } });
35
35
  * table.addField('Budget', univerAPI.Enum.BaseFieldType.Currency, { field: { config: { currencySymbol: '$', decimalPlaces: 2 } } });
36
36
  * table.addField('Rating', univerAPI.Enum.BaseFieldType.Rating, { field: { config: { min: 1, max: 5 } } });
37
+ * const formulaTableName = table.getFormulaName();
37
38
  * const formula = table.addField('Total', univerAPI.Enum.BaseFieldType.Formula, {
38
- * field: { config: { formula: '=SUM([Amount],[Budget])' } },
39
+ * field: { config: { formula: `=SUM(${formulaTableName}[[#This Row],[Amount]],${formulaTableName}[[#This Row],[Budget]])` } },
39
40
  * externalReferences: [], // Required; this formula only uses fields in the Host Base.
40
41
  * });
41
42
  * const numbering = table.addField('Sequence', univerAPI.Enum.BaseFieldType.Numbering);
@@ -40,7 +40,10 @@ export interface IQueryRecordsResult {
40
40
  }
41
41
  export interface IBaseTableSchemaSnapshot {
42
42
  id: string;
43
+ /** Worksheet-compatible display name. Do not use it as a structured-reference identifier. */
43
44
  name: string;
45
+ /** Stable table identifier for Excel structured references. */
46
+ formulaName: string;
44
47
  primaryFieldId: string;
45
48
  fieldIds: string[];
46
49
  viewIds: string[];
@@ -299,8 +302,10 @@ export declare class FBaseTable {
299
302
  */
300
303
  setHierarchyField(fieldId: string | null): boolean;
301
304
  /**
302
- * Get the table name.
303
- * @returns {string} The table name.
305
+ * Get the human-readable table display name.
306
+ *
307
+ * Do not use this value in formulas. Use `getFormulaName()` for structured references.
308
+ * @returns {string} The human-readable table display name.
304
309
  * @example
305
310
  * ```ts
306
311
  * const fBase = univerAPI.getActiveBase();
@@ -310,8 +315,40 @@ export declare class FBaseTable {
310
315
  */
311
316
  getName(): string;
312
317
  /**
313
- * Rename this table.
314
- * @param {string} name The new table name.
318
+ * Get the stable canonical OOXML-compatible table name used in structured formula references.
319
+ * The name is allocated when the table is created or a historical snapshot is migrated;
320
+ * later display-name changes do not change formula identity. Always use the returned name; `table` is not
321
+ * a reserved alias unless it is the actual identifier returned by this method.
322
+ *
323
+ * Base Formula fields use Excel structured-reference scopes. Use
324
+ * `Table[[#This Row],[Column]]` (or `Table[@[Column]]`) for one value from the
325
+ * formula record's row. Use `Table[[#Data],[Column]]` (or `Table[Column]`) only
326
+ * when the formula intentionally consumes the complete data column. For another
327
+ * Base table, call that table's `getFormulaName()` instead of typing its display
328
+ * name or relying on a placeholder.
329
+ * @returns {string} The canonical normalized formula table name.
330
+ * @example
331
+ * ```ts
332
+ * const fBase = univerAPI.getActiveBase();
333
+ * const table = fBase.getTableById('table-1');
334
+ * const tableName = table.getFormulaName();
335
+ * const currentAmount = `=${tableName}[[#This Row],[Amount]]`;
336
+ * const allAmounts = `=SUM(${tableName}[[#Data],[Amount]])`;
337
+ * ```
338
+ */
339
+ getFormulaName(): string;
340
+ /**
341
+ * Rename this table's human-readable display label. The name becomes an Excel
342
+ * worksheet name during export, so it must contain 1-31 characters, not start or
343
+ * end with an apostrophe, not contain `: \\ / ? * [ ]`, and be unique within the
344
+ * Base (case-insensitive).
345
+ *
346
+ * Its stable formula name does not change. Existing and new structured references
347
+ * must continue to use the value returned by `getFormulaName()`.
348
+ * @param {string} displayName The new human-readable table display name.
349
+ * @returns {boolean} Whether the rename command succeeded.
350
+ * @throws {Error} If `displayName` violates the Excel worksheet-name rules. The error includes
351
+ * both the complete contract and the specific reason, so callers and agents can correct it.
315
352
  * @example
316
353
  * ```ts
317
354
  * const fBase = univerAPI.getActiveBase();
@@ -320,7 +357,7 @@ export declare class FBaseTable {
320
357
  * console.log(success);
321
358
  * ```
322
359
  */
323
- setName(name: string): boolean;
360
+ setName(displayName: string): boolean;
324
361
  /**
325
362
  * Search records in this table.
326
363
  *
@@ -506,13 +543,14 @@ export declare class FBaseTable {
506
543
  * }
507
544
  * }
508
545
  * );
546
+ * const formulaTableName = fBaseTable.getFormulaName();
509
547
  * const total = fBaseTable.addField(
510
548
  * 'Total',
511
549
  * univerAPI.Enum.BaseFieldType.Formula,
512
550
  * {
513
551
  * field: {
514
552
  * config: {
515
- * formula: '=SUM([Amount],[Tax])'
553
+ * formula: `=SUM(${formulaTableName}[[#This Row],[Amount]],${formulaTableName}[[#This Row],[Tax]])`
516
554
  * }
517
555
  * },
518
556
  * externalReferences: [], // Required; this formula only uses fields in the Host Base.
@@ -528,6 +566,7 @@ export declare class FBaseTable {
528
566
  * unitId: 'pricing-base',
529
567
  * formulaQualifier: 'Pricing',
530
568
  * };
569
+ * const formulaTableName = fBaseTable.getFormulaName();
531
570
  * const taxAmount = univerAPI.getFormula().buildReference({
532
571
  * hostUnitId: fBase.getId(),
533
572
  * unit: pricingBase,
@@ -543,7 +582,7 @@ export declare class FBaseTable {
543
582
  * {
544
583
  * field: {
545
584
  * config: {
546
- * formula: `=SUM([Amount])+SUM(${taxAmount})`,
585
+ * formula: `=SUM(${formulaTableName}[[#This Row],[Amount]])+SUM(${taxAmount})`,
547
586
  * numberFormat: {
548
587
  * type: 'currency',
549
588
  * pattern: '"$"#,##0.00'
@@ -564,6 +603,7 @@ export declare class FBaseTable {
564
603
  addField(name: string, type: BaseFieldType.RecordLink, options: IBaseAddRecordLinkFieldOptions): FBaseTableField;
565
604
  addField(name: string, type: Exclude<BaseFieldType, BaseFieldType.Formula | BaseFieldType.RecordLink>, options?: IBaseAddFieldOptions): FBaseTableField;
566
605
  addField(name: string, type: BaseFieldType, options: IBaseAddFieldOptions | IBaseAddFormulaFieldOptions | IBaseAddRecordLinkFieldOptions): FBaseTableField;
606
+ private _prepareFormulaFieldReferences;
567
607
  /**
568
608
  * Get all records in this table, optionally filtered, sorted, and paginated.
569
609
  * @returns {FBaseTableRecord[]} An array of record facades ordered by the table record order.
@@ -75,6 +75,8 @@ export { BaseConditionalColorRuleUpdateType, UpdateBaseViewConditionalColorRules
75
75
  export type { IUpdateBaseViewConditionalColorRulesCommandParams } from './commands/commands/update-base-view-conditional-color-rules.command';
76
76
  export { UpdateBaseViewConfigCommand } from './commands/commands/update-base-view-config.command';
77
77
  export type { IUpdateBaseViewConfigCommandParams } from './commands/commands/update-base-view-config.command';
78
+ export { ValidateBaseFormulaCommand } from './commands/commands/validate-base-formula.command';
79
+ export type { IValidateBaseFormulaCommandParams } from './commands/commands/validate-base-formula.command';
78
80
  export { ApplyBaseJson1Mutation } from './commands/mutations/apply-base-json1.mutation';
79
81
  export type { IApplyBaseJson1MutationParams } from './commands/mutations/apply-base-json1.mutation';
80
82
  export { createEmbedBasesTable, createEmbedBasesTableAddMutation, createEmbedBasesTableRemoveMutation, EMBED_BASES_TABLE_RESOURCE_KEY, } from './embed-host-anchor';
@@ -90,6 +92,8 @@ export { ensureBaseTableCellLayout, getBaseCellFormulaValue, getBaseCellValue, }
90
92
  export { BASE_HIERARCHY_MAX_LEVELS, BASE_HIERARCHY_PARENT_FIELD_ID, BaseEventSource, BaseHierarchyError, BaseHierarchyErrorCode, buildBaseHierarchyIndex, createBaseHierarchyParentField, getActiveBaseHierarchyFieldIds, getBaseHierarchyDeletePromotions, getBaseHierarchyFieldId, getVisibleBaseHierarchyRows, isBaseHierarchyField, projectBaseHierarchy, resolveBaseHierarchyFieldId, validateBaseHierarchyMove, validateBaseHierarchyRecordCreations, validateBaseHierarchyRecordPatches, } from './models/base-hierarchy';
91
93
  export type { IBaseHierarchyChange, IBaseHierarchyIndex, IBaseHierarchyRecordPatch, } from './models/base-hierarchy';
92
94
  export { copyBaseTableSnapshot } from './models/base-table-copy';
95
+ export { BASE_TABLE_NAME_REQUIREMENTS, createUniqueBaseTableName, validateBaseTableName } from './models/base-table-name';
96
+ export type { BaseTableNameValidationError, IBaseTableNameValidationResult } from './models/base-table-name';
93
97
  export { createDefaultBaseTableSnapshot } from './models/default-table';
94
98
  export { findRecordLinkReferences, getRecordLinkFieldConfig, parseRecordLinkIds, serializeRecordLinkIds, validateCanonicalRecordLinkValue, validateRecordLinkField, validateRecordLinkValue, } from './models/record-link';
95
99
  export type { IRecordLinkReference } from './models/record-link';
@@ -100,6 +104,8 @@ export { searchBaseTable } from './search/base-search';
100
104
  export type { IBaseTableSearchRequest } from './search/base-search';
101
105
  export type { IBaseTableSearchMatch, IBaseTableSearchResult, } from './search/base-search';
102
106
  export { IBaseCommandService } from './services/base-command.service';
107
+ export { BaseFormulaService, getBaseFormulaTableName } from './services/base-formula.service';
108
+ export type { IBaseFormulaValidationResult } from './services/base-formula.service';
103
109
  export { traceBasePerformance } from './services/base-performance.service';
104
110
  export { IBasePermissionService } from './services/base-permission.service';
105
111
  export type { IBaseFieldPermission, IBasePermissionSnapshot, IBaseRecordPermission, IBaseTablePermission, } from './services/base-permission.service';
@@ -0,0 +1,8 @@
1
+ import type { IBaseSnapshot, IValidationResult } from '@univerjs/core';
2
+ export declare const BASE_TABLE_NAME_REQUIREMENTS = "Base table names are exported as Excel worksheet names and must contain 1-31 characters, not start or end with an apostrophe, not contain : \\ / ? * [ ], and be unique (case-insensitive).";
3
+ export type BaseTableNameValidationError = 'required' | 'too-long' | 'apostrophe' | 'invalid-characters' | 'duplicate' | 'invalid';
4
+ export interface IBaseTableNameValidationResult extends IValidationResult {
5
+ error?: BaseTableNameValidationError;
6
+ }
7
+ export declare function validateBaseTableName(snapshot: IBaseSnapshot, name: string, currentTableId?: string): IBaseTableNameValidationResult;
8
+ export declare function createUniqueBaseTableName(snapshot: IBaseSnapshot, baseName: string): string;
@@ -57,9 +57,9 @@ export declare class BaseJson1OpFactory {
57
57
  }): JSONXActions;
58
58
  private _setViewFieldSetting;
59
59
  private _createRecordOrderOp;
60
+ private _materializeFormulaTableNames;
60
61
  private _setFormulaFieldCells;
61
62
  private _setAttachmentResources;
62
63
  private _deleteAttachmentResources;
63
64
  private _replaceOptional;
64
65
  }
65
- export declare function renameBaseFormulaTableReferences(formula: string, oldName: string, newName: string): string;
@@ -1,6 +1,6 @@
1
- import type { ISetFormulaCalculationResultMutation, ISuperTable, ISuperTableService } from '@univerjs-pro/engine-formula';
1
+ import type { ISetFormulaCalculationResultMutation, ISuperTable } from '@univerjs-pro/engine-formula';
2
2
  import type { IBaseCellData, IBaseSnapshot, ITableSnapshot } from '@univerjs/core';
3
- import { ObjectMatrix } from '@univerjs/core';
3
+ export { getBaseFormulaTableName } from '@univerjs/core';
4
4
  export interface IBaseFormulaValidationResult {
5
5
  valid: boolean;
6
6
  reason?: string;
@@ -12,21 +12,6 @@ export interface IBaseFormulaDependency {
12
12
  export interface IBaseFormulaContext {
13
13
  snapshot?: IBaseSnapshot;
14
14
  }
15
- export interface IBaseFormulaCalculationDataset {
16
- formulaData: Record<string, Record<string, Record<number, Record<number, {
17
- f: string;
18
- si?: string;
19
- }>>>>;
20
- allUnitData: Record<string, Record<string, {
21
- cellData: ObjectMatrix<IBaseCellData | null>;
22
- rowCount: number;
23
- columnCount: number;
24
- rowData: Record<number, unknown>;
25
- columnData: Record<number, unknown>;
26
- }>>;
27
- unitStylesData: Record<string, Record<string, unknown>>;
28
- unitSheetNameMap: Record<string, Record<string, string>>;
29
- }
30
15
  export interface IBaseSuperTableRegistration {
31
16
  tableId: string;
32
17
  tableName: string;
@@ -43,15 +28,9 @@ export interface IBaseFormulaResultPatchGroup {
43
28
  }
44
29
  export declare class BaseFormulaService {
45
30
  createSuperTableReference(table: ITableSnapshot, sheetId?: string): ISuperTable;
46
- registerSuperTable(superTableService: ISuperTableService, unitId: string, table: ITableSnapshot, options?: {
47
- tableName?: string;
48
- sheetId?: string;
49
- }): ISuperTable;
50
- registerSuperTables(superTableService: ISuperTableService, snapshot: IBaseSnapshot): ISuperTable[];
51
31
  getSuperTableRegistrations(snapshot: IBaseSnapshot, tableIds?: Iterable<string>): IBaseSuperTableRegistration[];
52
32
  validateFormula(formula: string, table: ITableSnapshot, context?: IBaseFormulaContext): IBaseFormulaValidationResult;
53
33
  getDependencies(formula: string, table: ITableSnapshot, context?: IBaseFormulaContext): string[];
54
34
  getStructuredDependencies(formula: string, table: ITableSnapshot, context?: IBaseFormulaContext): IBaseFormulaDependency[];
55
35
  }
56
- export declare function createBaseFormulaCalculationDataset(snapshot: IBaseSnapshot): IBaseFormulaCalculationDataset;
57
36
  export declare function createBaseFormulaResultPatches(snapshot: IBaseSnapshot, result: ISetFormulaCalculationResultMutation): IBaseFormulaResultPatchGroup[];