@univerjs/core 1.0.0-alpha.8 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,5 +15,6 @@
15
15
  */
16
16
  export { BaseDataModel } from './base-data-model';
17
17
  export { createDefaultBaseTableSnapshot, getEmptySnapshot as getBasesEmptySnapshot, type ICreateDefaultBaseTableSnapshotOptions, } from './empty-snapshot';
18
- export { BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseSortDirection, BaseViewType } from './typedef';
19
- export type { BaseCellMatrix, BaseCellPrimitiveValue, CellValue as BaseCellValue, BaseCellValueType, BaseHitTestResult, BaseId, PrimitiveCellValue as BasePrimitiveCellValue, BaseSelection, BaseSnapshot, BaseViewProjection, FieldConfig, FieldId, FieldSnapshot, IBaseAttachment, IBaseCellData, IBaseInvalidation, IBaseRect, IBaseResources, IBaseSnapshot, IBaseViewColorCondition, IBaseViewport, ICalendarEventResizeSelection, ICalendarEventSelection, ICalendarProjection, ICalendarViewConfig, ICardLayoutConfig, IFieldCapabilities, IFieldSnapshot, IFilterCondition, IFilterConfig, IGalleryCardSelection, IGalleryProjection, IGalleryViewConfig, IGanttBarSelection, IGanttCellSelection, IGanttProjection, IGanttTimeColumn, IGanttViewConfig, IGridCellSelection, IGridFieldSelection, IGridGroupSelection, IGridProjection, IGridRecordSelection, IGridViewConfig, IGroupConfig, IInvalidViewProjection, IKanbanCardSelection, IKanbanColumnSetting, IKanbanFieldCardSetting, IKanbanProjection, IKanbanViewConfig, IProjectedField, IProjectedGroup, IProjectedRow, IRecordSnapshot, ISortConfig, ITableSnapshot, IValidationResult, IViewFieldSetting, IViewProjection, IViewSnapshot, KanbanCardLayoutMode, RecordId, RecordSnapshot, TableId, TableSnapshot, ViewId, ViewSnapshot, ViewSpecificConfig, } from './typedef';
18
+ export { assertBaseTableRecordIdentity, BASE_RECORD_ID_FIELD_ID, BASE_RECORD_ID_FIELD_NAME, createBaseRecordIdField, isBaseRecordIdFieldName, isValidBaseRecordId, } from './record-identity';
19
+ export { BaseConditionalColorOperator, BaseConditionalColorTarget, BaseConditionalDateMode, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseHierarchyInvalidReason, BaseRecordLinkRole, BaseSortDirection, BaseViewType, } from './typedef';
20
+ export type { BaseCellMatrix, BaseCellPrimitiveValue, CellValue as BaseCellValue, BaseCellValueType, BaseDateHourCycle, BaseHitTestResult, BaseId, PrimitiveCellValue as BasePrimitiveCellValue, BaseSelection, BaseSnapshot, BaseViewProjection, FieldConfig, FieldId, FieldSnapshot, IBaseAttachment, IBaseCellData, IBaseConditionalColoringConfig, IBaseConditionalColorRule, IBaseDateFieldConfig, IBaseHierarchyNodeProjection, IBaseHierarchyProjection, IBaseInvalidation, IBaseRect, IBaseResources, IBaseSnapshot, IBaseViewColorCondition, IBaseViewCommonConfig, IBaseViewport, ICalendarEventResizeSelection, ICalendarEventSelection, ICalendarProjection, ICalendarViewConfig, ICardLayoutConfig, IFieldCapabilities, IFieldSnapshot, IFilterCondition, IFilterConfig, IGalleryCardSelection, IGalleryProjection, IGalleryViewConfig, IGanttBarSelection, IGanttCellSelection, IGanttProjection, IGanttTimeColumn, IGanttViewConfig, IGridCellSelection, IGridFieldSelection, IGridGroupSelection, IGridProjection, IGridRecordSelection, IGridViewConfig, IGroupConfig, IInvalidViewProjection, IKanbanCardSelection, IKanbanColumnSetting, IKanbanFieldCardSetting, IKanbanProjection, IKanbanViewConfig, IProjectedField, IProjectedGroup, IProjectedRow, IRecordLinkFieldConfig, IRecordSnapshot, ISortConfig, ITableSnapshot, IValidationResult, IViewFieldSetting, IViewProjection, IViewSnapshot, KanbanCardLayoutMode, RecordId, RecordSnapshot, TableId, TableSnapshot, ViewId, ViewSnapshot, ViewSpecificConfig, } from './typedef';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IFieldSnapshot, ITableSnapshot } from './typedef';
17
+ export declare const BASE_RECORD_ID_FIELD_ID = "__record_id";
18
+ export declare const BASE_RECORD_ID_FIELD_NAME = "record-id";
19
+ export declare function createBaseRecordIdField(): IFieldSnapshot;
20
+ export declare function isValidBaseRecordId(recordId: string): boolean;
21
+ export declare function isBaseRecordIdFieldName(name: string): boolean;
22
+ export declare function assertBaseTableRecordIdentity(table: ITableSnapshot): void;
@@ -41,23 +41,41 @@ export interface IBaseResources {
41
41
  attachments?: Record<string, Record<string, unknown>>;
42
42
  }
43
43
  export interface IBaseAttachment {
44
- /** Stable attachment identifier. Use the uploaded file id for remote attachments. */
44
+ /**
45
+ * Stable attachment identifier.
46
+ *
47
+ * Keep this value unique within one attachment cell. For an uploaded attachment, use the
48
+ * identifier returned by the attachment service.
49
+ */
45
50
  id: string;
46
- /** Display name, including the file extension when available. */
51
+ /** User-visible file name. Include the extension so clients can classify the file when `mimeType` is absent. */
47
52
  name: string;
48
- /** MIME type used to classify and preview the attachment. */
53
+ /** MIME type used to classify and preview the attachment, for example `image/webp` or `application/pdf`. */
49
54
  mimeType?: string;
50
- /** File size in bytes. */
55
+ /** File size in bytes. This is descriptive metadata and does not affect source loading. */
51
56
  size?: number;
52
- /** Image width in pixels when known. */
57
+ /** Image width in pixels when known. This is descriptive metadata used to reserve preview space. */
53
58
  width?: number;
54
- /** Image height in pixels when known. */
59
+ /** Image height in pixels when known. This is descriptive metadata used to reserve preview space. */
55
60
  height?: number;
56
- /** How to interpret `source`, for example UUID, URL, or Base64 data. */
61
+ /**
62
+ * How clients should resolve `source`.
63
+ *
64
+ * Facade write APIs infer `BASE64` for data URLs and otherwise default to `URL`. Set this
65
+ * explicitly to `UUID` for identifiers managed by an attachment service.
66
+ */
57
67
  sourceType?: ImageSourceType;
58
- /** Canonical attachment source: an uploaded file id, URL, or Base64 data URL. */
68
+ /**
69
+ * Canonical attachment source: an uploaded file id, URL, or Base64 data.
70
+ *
71
+ * Facade write APIs require a non-empty source for every non-empty attachment entry.
72
+ */
59
73
  source?: string;
60
- /** Optional preview source when it is distinct from the canonical attachment source. */
74
+ /**
75
+ * Optional preview source when it differs from `source`.
76
+ *
77
+ * A data URL is treated as Base64; every other value is treated as a URL.
78
+ */
61
79
  thumbnail?: string;
62
80
  }
63
81
  export declare enum BaseFieldType {
@@ -72,24 +90,50 @@ export declare enum BaseFieldType {
72
90
  Checkbox = "checkbox",
73
91
  Link = "link",
74
92
  Formula = "formula",
75
- Lookup = "lookup",
76
- Flow = "flow",
77
- Button = "button",
78
93
  Numbering = "numbering",
79
94
  Phone = "phone",
80
95
  Email = "email",
81
- Location = "location",
82
- Barcode = "barcode",
83
96
  Progress = "progress",
84
97
  Currency = "currency",
85
98
  Rating = "rating",
86
- TwoWayLink = "twoWayLink",
99
+ RecordLink = "recordLink",
87
100
  RecordId = "recordId",
88
101
  CreatedBy = "createdBy",
89
102
  UpdatedBy = "updatedBy",
90
103
  CreatedAt = "createdAt",
91
- UpdatedAt = "updatedAt",
92
- Summary = "summary"
104
+ UpdatedAt = "updatedAt"
105
+ }
106
+ /** Semantic roles supported by Base RecordLink fields. */
107
+ export declare enum BaseRecordLinkRole {
108
+ Parent = "parent"
109
+ }
110
+ /**
111
+ * Configuration for a RecordLink field.
112
+ *
113
+ * A RecordLink points to records in another table in the same Base. The cell
114
+ * stores target record IDs, while the UI resolves those IDs to the configured
115
+ * display field. Prefer the dedicated RecordLink Facade methods instead of
116
+ * reading or writing the canonical cell string directly.
117
+ */
118
+ export interface IRecordLinkFieldConfig extends Record<string, unknown> {
119
+ /** ID of the target table. The table must belong to the same Base. */
120
+ targetTableId: TableId;
121
+ /** `false` allows one linked record; `true` allows an ordered list of linked records. */
122
+ multiple: boolean;
123
+ /**
124
+ * Target-table field used as the visible label in cells, cards, and record details.
125
+ * Defaults to the target table's primary field. The field must exist and must not
126
+ * be a system field such as `record-id`.
127
+ */
128
+ displayFieldId?: FieldId;
129
+ /**
130
+ * Ordered target-table fields shown as secondary context in the record picker.
131
+ * These fields help users distinguish records; they do not change the stored link
132
+ * or add more labels to the cell. IDs must be unique, existing, non-system fields.
133
+ */
134
+ pickerFieldIds?: FieldId[];
135
+ /** Optional table-level semantic role of this link. */
136
+ relationRole?: BaseRecordLinkRole;
93
137
  }
94
138
  export declare enum BaseViewType {
95
139
  Grid = "grid",
@@ -99,7 +143,123 @@ export declare enum BaseViewType {
99
143
  Gallery = "gallery"
100
144
  }
101
145
  export type FieldConfig = Record<string, unknown>;
102
- export type ViewSpecificConfig = IGridViewConfig | IKanbanViewConfig | ICalendarViewConfig | IGanttViewConfig | IGalleryViewConfig | Record<string, unknown>;
146
+ export type BaseDateHourCycle = 'h12' | 'h24';
147
+ /** Where a Base conditional color is painted when its condition matches. */
148
+ export declare const BaseConditionalColorTarget: {
149
+ /** Paint only the cell in the rule's field. */
150
+ readonly CELL: "cell";
151
+ /** Paint the complete record row. */
152
+ readonly ROW: "row";
153
+ /** Paint the rule's field column unconditionally; operator, operand, and date mode are ignored. */
154
+ readonly COLUMN: "column";
155
+ };
156
+ export type BaseConditionalColorTarget = typeof BaseConditionalColorTarget[keyof typeof BaseConditionalColorTarget];
157
+ /**
158
+ * Operators supported by Base conditional coloring rules.
159
+ *
160
+ * Text, select, person, and similar fields support equality, containment, and
161
+ * empty checks. Number, currency, progress, and rating fields support equality,
162
+ * numeric comparison, and empty checks. Date-like fields support equality,
163
+ * before/after, and empty checks. Checkbox fields support equality only.
164
+ */
165
+ export declare const BaseConditionalColorOperator: {
166
+ readonly IS: "is";
167
+ readonly IS_NOT: "isNot";
168
+ readonly CONTAINS: "contains";
169
+ readonly NOT_CONTAINS: "notContains";
170
+ readonly IS_EMPTY: "isEmpty";
171
+ readonly IS_NOT_EMPTY: "isNotEmpty";
172
+ readonly GREATER_THAN: "greaterThan";
173
+ readonly LESS_THAN: "lessThan";
174
+ readonly BEFORE: "before";
175
+ readonly AFTER: "after";
176
+ };
177
+ export type BaseConditionalColorOperator = typeof BaseConditionalColorOperator[keyof typeof BaseConditionalColorOperator];
178
+ /**
179
+ * Relative or exact date windows supported by date conditional coloring rules.
180
+ *
181
+ * With `IS`, dates inside the selected window match. `IS_NOT` matches dates
182
+ * outside it, `BEFORE` matches dates before its start, and `AFTER` matches
183
+ * dates after its end. Relative windows do not use an operand; `EXACT` does.
184
+ */
185
+ export declare const BaseConditionalDateMode: {
186
+ readonly EXACT: "exact";
187
+ readonly TODAY: "today";
188
+ readonly TOMORROW: "tomorrow";
189
+ readonly YESTERDAY: "yesterday";
190
+ readonly THIS_WEEK: "thisWeek";
191
+ readonly LAST_WEEK: "lastWeek";
192
+ readonly THIS_MONTH: "thisMonth";
193
+ readonly LAST_MONTH: "lastMonth";
194
+ readonly PAST_7_DAYS: "past7";
195
+ readonly NEXT_7_DAYS: "next7";
196
+ readonly PAST_30_DAYS: "past30";
197
+ readonly NEXT_30_DAYS: "next30";
198
+ };
199
+ export type BaseConditionalDateMode = typeof BaseConditionalDateMode[keyof typeof BaseConditionalDateMode];
200
+ /**
201
+ * A color condition stored by a Base view.
202
+ *
203
+ * Rules are evaluated in array order. Earlier matching rules are painted last
204
+ * and therefore have higher visual priority than later matching rules.
205
+ */
206
+ export interface IBaseViewColorCondition {
207
+ /** Stable id unique within the view. */
208
+ id: string;
209
+ /** Valid CSS color rendered for a match, for example `#fde9e9` or `rgba(255, 0, 0, 0.2)`. */
210
+ color: string;
211
+ /** Paint target. Gantt color conditions may omit it for legacy snapshots. */
212
+ target?: BaseConditionalColorTarget;
213
+ /** Field whose value is evaluated for cell/row targets, or whose column is painted for a column target. */
214
+ fieldId: FieldId;
215
+ /** Comparison performed against the field value. Ignored for a column target. */
216
+ operator: BaseConditionalColorOperator;
217
+ /**
218
+ * Comparison value in the field's normal value shape: number for numeric
219
+ * fields, boolean for checkbox fields, text/option ids for text and select
220
+ * fields, or a date-compatible value for an exact date comparison. Ignored
221
+ * by empty checks, relative date modes, and column targets.
222
+ */
223
+ operand?: unknown;
224
+ /**
225
+ * Exact or relative date window for Date, CreatedAt, and UpdatedAt fields.
226
+ * Defaults to `EXACT` when omitted. Ignored for a column target.
227
+ */
228
+ dateMode?: BaseConditionalDateMode;
229
+ }
230
+ /** A complete Base conditional coloring rule used by Grid and other Base views. */
231
+ export interface IBaseConditionalColorRule extends IBaseViewColorCondition {
232
+ /** Paint target for the matching rule. */
233
+ target: BaseConditionalColorTarget;
234
+ }
235
+ /** Persisted conditional coloring configuration for one Base view. */
236
+ export interface IBaseConditionalColoringConfig {
237
+ /** Rules in descending visual-priority order. */
238
+ rules: IBaseConditionalColorRule[];
239
+ }
240
+ /** Configuration shared by every Base view type. */
241
+ export interface IBaseViewCommonConfig {
242
+ /** Conditional coloring rules, or `null` when the feature is cleared. */
243
+ conditionalColoring?: IBaseConditionalColoringConfig | null;
244
+ }
245
+ /**
246
+ * Display options for Date, CreatedAt, and UpdatedAt fields.
247
+ */
248
+ export interface IBaseDateFieldConfig extends FieldConfig {
249
+ /**
250
+ * Date-only display pattern, such as `yyyy/mm/dd`.
251
+ */
252
+ pattern?: string;
253
+ /**
254
+ * Whether to append a time to the formatted date.
255
+ */
256
+ includeTime?: boolean;
257
+ /**
258
+ * Explicit 12-hour or 24-hour time format.
259
+ */
260
+ hourCycle?: BaseDateHourCycle;
261
+ }
262
+ export type ViewSpecificConfig = IGridViewConfig | IKanbanViewConfig | ICalendarViewConfig | IGanttViewConfig | IGalleryViewConfig | (IBaseViewCommonConfig & Record<string, unknown>);
103
263
  export interface IBaseSnapshot {
104
264
  id: BaseId;
105
265
  name: string;
@@ -232,7 +392,7 @@ export interface IGroupConfig {
232
392
  direction?: BaseSortDirection;
233
393
  hideEmptyGroup?: boolean;
234
394
  }
235
- export interface IGridViewConfig {
395
+ export interface IGridViewConfig extends IBaseViewCommonConfig {
236
396
  frozenFieldCount?: number;
237
397
  showRecordIndex?: boolean;
238
398
  rowHeight?: 'short' | 'medium' | 'tall' | 'extraTall';
@@ -252,7 +412,7 @@ export interface IKanbanColumnSetting {
252
412
  color?: string;
253
413
  collapsed?: boolean;
254
414
  }
255
- export interface IKanbanViewConfig {
415
+ export interface IKanbanViewConfig extends IBaseViewCommonConfig {
256
416
  groupFieldId: FieldId;
257
417
  coverFieldId?: FieldId | null;
258
418
  cardLayout?: KanbanCardLayoutMode;
@@ -261,7 +421,7 @@ export interface IKanbanViewConfig {
261
421
  columnSettings?: Record<string, IKanbanColumnSetting>;
262
422
  card?: ICardLayoutConfig;
263
423
  }
264
- export interface ICalendarViewConfig {
424
+ export interface ICalendarViewConfig extends IBaseViewCommonConfig {
265
425
  startDateFieldId: FieldId;
266
426
  endDateFieldId?: FieldId;
267
427
  titleFieldId?: FieldId;
@@ -281,16 +441,7 @@ export interface ICalendarViewConfig {
281
441
  order?: number;
282
442
  }>;
283
443
  }
284
- export interface IBaseViewColorCondition {
285
- id: string;
286
- color: string;
287
- target?: 'cell' | 'row' | 'column';
288
- fieldId: FieldId;
289
- operator: 'is' | 'isNot' | 'contains' | 'notContains' | 'isEmpty' | 'isNotEmpty' | 'greaterThan' | 'lessThan' | 'before' | 'after';
290
- operand?: unknown;
291
- dateMode?: 'exact' | 'today' | 'tomorrow' | 'yesterday' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'past7' | 'next7' | 'past30' | 'next30';
292
- }
293
- export interface IGanttViewConfig {
444
+ export interface IGanttViewConfig extends IBaseViewCommonConfig {
294
445
  startDateFieldId: FieldId;
295
446
  endDateFieldId: FieldId;
296
447
  titleFieldId?: FieldId;
@@ -326,7 +477,7 @@ export interface IGanttViewConfig {
326
477
  }>;
327
478
  };
328
479
  }
329
- export interface IGalleryViewConfig {
480
+ export interface IGalleryViewConfig extends IBaseViewCommonConfig {
330
481
  card: ICardLayoutConfig;
331
482
  coverFieldId?: FieldId | null;
332
483
  cardLayout?: KanbanCardLayoutMode;
@@ -362,13 +513,37 @@ export interface IProjectedGroup {
362
513
  level?: number;
363
514
  children?: IProjectedGroup[];
364
515
  }
516
+ /** Why a stored Parent link cannot participate in the effective hierarchy. */
517
+ export declare enum BaseHierarchyInvalidReason {
518
+ MissingParent = "missingParent",
519
+ SelfParent = "selfParent",
520
+ Cycle = "cycle",
521
+ MaxDepth = "maxDepth"
522
+ }
523
+ export interface IBaseHierarchyNodeProjection {
524
+ recordId: RecordId;
525
+ parentRecordId: RecordId | null;
526
+ depth: number;
527
+ directChildCount: number;
528
+ subtreeHeight: number;
529
+ subtreeEndIndex: number;
530
+ invalidReason?: BaseHierarchyInvalidReason;
531
+ }
532
+ export interface IBaseHierarchyProjection {
533
+ fieldId: FieldId;
534
+ rootRecordIds: RecordId[];
535
+ orderedRecordIds: RecordId[];
536
+ nodes: Record<RecordId, IBaseHierarchyNodeProjection>;
537
+ }
365
538
  export interface IGridProjection extends IViewProjection {
366
539
  type: BaseViewType.Grid;
367
540
  frozenFieldCount?: number;
541
+ hierarchy?: IBaseHierarchyProjection;
368
542
  }
369
543
  export interface IKanbanProjection extends IViewProjection {
370
544
  type: BaseViewType.Kanban;
371
545
  groupFieldId: FieldId;
546
+ titleFieldId?: FieldId;
372
547
  coverFieldId?: FieldId | null;
373
548
  cardLayout: KanbanCardLayoutMode;
374
549
  showFieldNames: boolean;
@@ -433,6 +608,7 @@ export interface IGanttProjection extends IViewProjection {
433
608
  }
434
609
  export interface IGalleryProjection extends IViewProjection {
435
610
  type: BaseViewType.Gallery;
611
+ titleFieldId?: FieldId;
436
612
  coverFieldId?: FieldId | null;
437
613
  cardLayout: KanbanCardLayoutMode;
438
614
  showFieldNames: boolean;
@@ -572,6 +748,39 @@ export type BaseHitTestResult = {
572
748
  tableId: TableId;
573
749
  viewId: ViewId;
574
750
  recordId: RecordId;
751
+ } | {
752
+ type: 'grid-hierarchy-toggle' | 'grid-hierarchy-add-child';
753
+ tableId: TableId;
754
+ viewId: ViewId;
755
+ recordId: RecordId;
756
+ } | {
757
+ type: 'grid-cell-checkbox';
758
+ tableId: TableId;
759
+ viewId: ViewId;
760
+ recordId: RecordId;
761
+ fieldId: FieldId;
762
+ } | {
763
+ type: 'grid-rating-icon';
764
+ tableId: TableId;
765
+ viewId: ViewId;
766
+ recordId: RecordId;
767
+ fieldId: FieldId;
768
+ value: number;
769
+ } | {
770
+ type: 'grid-row-header' | 'grid-row-checkbox';
771
+ tableId: TableId;
772
+ viewId: ViewId;
773
+ recordId: RecordId;
774
+ } | {
775
+ type: 'grid-row-header-select-all';
776
+ tableId: TableId;
777
+ viewId: ViewId;
778
+ } | {
779
+ type: 'grid-row-drag-handle';
780
+ tableId: TableId;
781
+ viewId: ViewId;
782
+ recordId: RecordId;
783
+ disabled: boolean;
575
784
  } | {
576
785
  type: 'kanban-add-record';
577
786
  tableId: TableId;
@@ -27,7 +27,7 @@ export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './subdocument';
27
27
  export { ActionIterator } from './text-x/action-iterator';
28
28
  export { PRESERVE_INSERTED_PARAGRAPH_IDS, TextXActionType } from './text-x/action-types';
29
29
  export type { IDeleteAction, IInsertAction, IRetainAction, TextXAction } from './text-x/action-types';
30
- export { normalizeInsertedSectionIdsForDocument, normalizeTextRuns, RESTORE_INSERTED_PARAGRAPH_IDS } from './text-x/apply-utils/common';
30
+ export { normalizeInsertedSectionIdsForDocument, normalizeTextRuns, RESTORE_INSERTED_PARAGRAPH_IDS, } from './text-x/apply-utils/common';
31
31
  export { updateAttributeByDelete } from './text-x/apply-utils/delete-apply';
32
32
  export { updateAttributeByInsert } from './text-x/apply-utils/insert-apply';
33
33
  export * from './text-x/build-utils';
@@ -1385,12 +1385,15 @@ export declare class RichTextBuilder extends RichTextValue {
1385
1385
  static create(data?: IDocumentData): RichTextBuilder;
1386
1386
  private _doc;
1387
1387
  private readonly _trackedRanges;
1388
+ private _childHandleRevision;
1388
1389
  constructor(data: IDocumentData);
1389
1390
  /**
1390
1391
  * Returns editable paragraph handles backed by this detached rich-text builder.
1391
1392
  *
1392
- * Paragraph boundaries come from the document model rather than splitting plain text. Each handle stays aligned
1393
- * when text in this builder grows or shrinks, so callers can safely iterate from the first paragraph to the last.
1393
+ * Paragraph boundaries come from the document model rather than splitting plain text. Handles stay aligned across
1394
+ * edits made through their child run handles, so callers can safely iterate from the first paragraph to the last.
1395
+ * Direct builder edits that change text or run boundaries invalidate previously returned paragraph and run handles;
1396
+ * query them again after calling methods such as `insertText()`, `setStyle()`, `setLink()`, or `delete()`.
1394
1397
  *
1395
1398
  * @returns Editable paragraphs in document order.
1396
1399
  * @example
@@ -1426,6 +1429,7 @@ export declare class RichTextBuilder extends RichTextValue {
1426
1429
  private _createParagraphBuilder;
1427
1430
  private _trackRange;
1428
1431
  private _rebaseTrackedRanges;
1432
+ private _invalidateChildHandles;
1429
1433
  /**
1430
1434
  * Appends plain text to the rich text.
1431
1435
  *
@@ -1497,14 +1501,15 @@ export declare class RichTextBuilder extends RichTextValue {
1497
1501
  */
1498
1502
  columns(options: IRichTextColumnsOptions): RichTextBuilder;
1499
1503
  /**
1500
- * Appends one text span with explicit style.
1504
+ * Appends one text span with an optional style.
1501
1505
  *
1502
1506
  * Prefer this method when combining multiple styles, because the style object is local to the inserted text and does
1503
1507
  * not leak into following calls.
1504
1508
  *
1505
1509
  * @param text Text to append.
1506
- * @param style Text style for this span. Agent-friendly aliases such as `bold`, `italic`, `fontFamily`, `fontSize`,
1507
- * `color`, and `background` are supported alongside native document text style fields.
1510
+ * @param style Optional text style for this span. When omitted, the span is appended as unstyled text. Agent-friendly
1511
+ * aliases such as `bold`, `italic`, `fontFamily`, `fontSize`, `color`, and `background` are supported alongside native
1512
+ * document text style fields.
1508
1513
  * @returns The current builder for chaining.
1509
1514
  * @example
1510
1515
  * ```ts
@@ -1513,7 +1518,7 @@ export declare class RichTextBuilder extends RichTextValue {
1513
1518
  * .span('Important', { bold: true, italic: true, color: '#d92d20' });
1514
1519
  * ```
1515
1520
  */
1516
- span(text: string, style: IRichTextSpanStyle): RichTextBuilder;
1521
+ span(text: string, style?: IRichTextSpanStyle): RichTextBuilder;
1517
1522
  /**
1518
1523
  * Appends bold text.
1519
1524
  *
@@ -1783,8 +1788,9 @@ export declare class RichTextParagraphBuilder extends RichTextValue {
1783
1788
  private readonly _owner;
1784
1789
  private readonly _paragraphId;
1785
1790
  private readonly _range;
1791
+ private readonly _revision;
1786
1792
  /** @hideconstructor */
1787
- constructor(_owner: RichTextBuilder, _paragraphId: string, _range: IMutableRichTextRange);
1793
+ constructor(_owner: RichTextBuilder, _paragraphId: string, _range: IMutableRichTextRange, _revision: number);
1788
1794
  /** Returns the persisted paragraph id. */
1789
1795
  getId(): string;
1790
1796
  /** Returns the current paragraph range without its trailing paragraph marker. */
@@ -1813,6 +1819,7 @@ export declare class RichTextParagraphBuilder extends RichTextValue {
1813
1819
  getData(): IDocumentData;
1814
1820
  copy(): RichTextBuilder;
1815
1821
  private _getParagraph;
1822
+ private _assertActive;
1816
1823
  }
1817
1824
  /**
1818
1825
  * An editable text-run handle owned by a detached {@link RichTextBuilder}.
@@ -1826,9 +1833,10 @@ export declare class RichTextRunBuilder {
1826
1833
  private readonly _textStyle;
1827
1834
  private readonly _styleId;
1828
1835
  private readonly _hasExplicitTextStyle;
1836
+ private readonly _revision;
1829
1837
  private _active;
1830
1838
  /** @hideconstructor */
1831
- constructor(_owner: RichTextBuilder, _range: IMutableRichTextRange, _textStyle: ITextStyle | undefined, _styleId: string | undefined, _hasExplicitTextStyle: boolean);
1839
+ constructor(_owner: RichTextBuilder, _range: IMutableRichTextRange, _textStyle: ITextStyle | undefined, _styleId: string | undefined, _hasExplicitTextStyle: boolean, _revision: number);
1832
1840
  /** Inclusive start offset, kept for compatibility with existing `getTextRuns()` callers. */
1833
1841
  get st(): number;
1834
1842
  /** Exclusive end offset, automatically updated after text replacement. */
@@ -1870,5 +1878,6 @@ export declare class RichTextRunBuilder {
1870
1878
  * ```
1871
1879
  */
1872
1880
  setText(text: string): this;
1881
+ private _assertActive;
1873
1882
  }
1874
1883
  export {};
@@ -103,7 +103,7 @@ export declare class FEventName {
103
103
  * // Remove the event listener, use `disposable.dispose()`
104
104
  * ```
105
105
  */
106
- get DocCreated(): "DocCreated";
106
+ get DocCreated(): 'DocCreated';
107
107
  /**
108
108
  * Event fired when a document is disposed
109
109
  * @see {@link IDocDisposedEvent}
@@ -117,7 +117,7 @@ export declare class FEventName {
117
117
  * // Remove the event listener, use `disposable.dispose()`
118
118
  * ```
119
119
  */
120
- get DocDisposed(): "DocDisposed";
120
+ get DocDisposed(): 'DocDisposed';
121
121
  /**
122
122
  * Event fired when life cycle is changed
123
123
  * @see {@link ILifeCycleChangedEvent}
@@ -131,7 +131,7 @@ export declare class FEventName {
131
131
  * // Remove the event listener, use `disposable.dispose()`
132
132
  * ```
133
133
  */
134
- get LifeCycleChanged(): "LifeCycleChanged";
134
+ get LifeCycleChanged(): 'LifeCycleChanged';
135
135
  /**
136
136
  * Event fired when a redo command is executed
137
137
  * @see {@link ICommandEvent}
@@ -145,7 +145,7 @@ export declare class FEventName {
145
145
  * // Remove the event listener, use `disposable.dispose()`
146
146
  * ```
147
147
  */
148
- get Redo(): "Redo";
148
+ get Redo(): 'Redo';
149
149
  /**
150
150
  * Event fired when an undo command is executed
151
151
  * @see {@link ICommandEvent}
@@ -159,7 +159,7 @@ export declare class FEventName {
159
159
  * // Remove the event listener, use `disposable.dispose()`
160
160
  * ```
161
161
  */
162
- get Undo(): "Undo";
162
+ get Undo(): 'Undo';
163
163
  /**
164
164
  * Event fired before a redo command is executed
165
165
  * @see {@link ICommandEvent}
@@ -176,7 +176,7 @@ export declare class FEventName {
176
176
  * // Remove the event listener, use `disposable.dispose()`
177
177
  * ```
178
178
  */
179
- get BeforeRedo(): "BeforeRedo";
179
+ get BeforeRedo(): 'BeforeRedo';
180
180
  /**
181
181
  * Event fired before an undo command is executed
182
182
  * @see {@link ICommandEvent}
@@ -193,7 +193,7 @@ export declare class FEventName {
193
193
  * // Remove the event listener, use `disposable.dispose()`
194
194
  * ```
195
195
  */
196
- get BeforeUndo(): "BeforeUndo";
196
+ get BeforeUndo(): 'BeforeUndo';
197
197
  /**
198
198
  * Event fired when a command is executed
199
199
  * @see {@link ICommandEvent}
@@ -207,7 +207,7 @@ export declare class FEventName {
207
207
  * // Remove the event listener, use `disposable.dispose()`
208
208
  * ```
209
209
  */
210
- get CommandExecuted(): "CommandExecuted";
210
+ get CommandExecuted(): 'CommandExecuted';
211
211
  /**
212
212
  * Event fired before a command is executed
213
213
  * @see {@link ICommandEvent}
@@ -224,7 +224,7 @@ export declare class FEventName {
224
224
  * // Remove the event listener, use `disposable.dispose()`
225
225
  * ```
226
226
  */
227
- get BeforeCommandExecute(): "BeforeCommandExecute";
227
+ get BeforeCommandExecute(): 'BeforeCommandExecute';
228
228
  }
229
229
  export interface IEventParamConfig {
230
230
  LifeCycleChanged: ILifeCycleChangedEvent;
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { Injector } from '@wendellhu/redi';
16
+ import type { Injector } from '../../common/di';
17
17
  import { ImageSourceType } from '../../services/image-io/image-io.service';
18
18
  export declare class ImageCacheMap {
19
19
  private _injector;
@@ -18,7 +18,7 @@ import type { IDocumentData, IDocumentRenderConfig, IPaddingData } from '../type
18
18
  import type { Styles } from './styles';
19
19
  import type { ICellData, ICellInfo, ICellWithCoord, IPosition, IRange, ISelectionCell, IWorksheetData } from './typedef';
20
20
  import type { Worksheet } from './worksheet';
21
- import { Injector } from '@wendellhu/redi';
21
+ import { Injector } from '../common/di';
22
22
  import { DocumentDataModel } from '../docs/data-model/document-data-model';
23
23
  import { IConfigService } from '../services/config/config.service';
24
24
  import { IContextService } from '../services/context/context.service';
@@ -42,7 +42,9 @@ export declare enum TextDecoration {
42
42
  WAVE = 14,
43
43
  WAVY_DOUBLE = 15,
44
44
  WAVY_HEAVY = 16,
45
- WORDS = 17
45
+ WORDS = 17,
46
+ SINGLE_ACCOUNTING = 18,
47
+ DOUBLE_ACCOUNTING = 19
46
48
  }
47
49
  /**
48
50
  * An enum that specifies the horizontal alignment of text.
@@ -543,6 +543,10 @@ export interface IBullet {
543
543
  listType: string;
544
544
  listId: string;
545
545
  nestingLevel: number;
546
+ startNumber?: number;
547
+ image?: {
548
+ source: string;
549
+ };
546
550
  textStyle?: ITextStyle;
547
551
  }
548
552
  /**
@@ -658,11 +662,16 @@ export interface IDocTextFill {
658
662
  offsetY?: number;
659
663
  };
660
664
  }
665
+ export interface IDocTextOutline {
666
+ color?: string;
667
+ width?: number;
668
+ }
661
669
  export interface ITextStyle extends IStyleBase {
662
670
  sc?: number;
663
671
  pos?: number;
664
672
  sa?: number;
665
673
  textFill?: IDocTextFill;
674
+ textOutline?: IDocTextOutline;
666
675
  /**
667
676
  * DrawingML-style glow around the rendered glyphs.
668
677
  *
@@ -685,6 +694,11 @@ export interface IIndentStart {
685
694
  tabStops?: ITabStop[];
686
695
  indentEnd?: INumberUnit;
687
696
  }
697
+ /**
698
+ * Vertical alignment of text runs inside a paragraph line box.
699
+ * This is the normalized form of DrawingML `fontAlgn`.
700
+ */
701
+ export type ParagraphFontAlign = 'auto' | 'top' | 'center' | 'baseline' | 'bottom';
688
702
  /**
689
703
  * Properties of paragraph style
690
704
  */
@@ -699,6 +713,12 @@ export type IDocumentDefaultParagraphStyle = Omit<IParagraphStyle, 'headingId' |
699
713
  export interface IParagraphProperties extends IIndentStart {
700
714
  headingId?: string;
701
715
  namedStyleType?: NamedStyleType;
716
+ defaultTabStop?: number;
717
+ /** Whether East Asian kinsoku line-breaking rules apply to this paragraph. */
718
+ eastAsianLineBreak?: BooleanNumber;
719
+ /** Whether punctuation may hang outside the paragraph text bounds. */
720
+ hangingPunctuation?: BooleanNumber;
721
+ fontAlign?: ParagraphFontAlign;
702
722
  horizontalAlign?: HorizontalAlign;
703
723
  lineSpacing?: number;
704
724
  direction?: TextDirection;