@univerjs/core 1.0.0-alpha.7 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +7 -139
- package/lib/cjs/index.js +832 -929
- package/lib/es/facade.js +9 -135
- package/lib/es/index.js +826 -932
- package/lib/facade.js +9 -135
- package/lib/index.js +826 -932
- package/lib/types/bases/index.d.ts +3 -2
- package/lib/types/bases/record-identity.d.ts +22 -0
- package/lib/types/bases/typedef.d.ts +255 -23
- package/lib/types/docs/data-model/index.d.ts +1 -1
- package/lib/types/docs/data-model/paragraph-style.d.ts +7 -1
- package/lib/types/docs/data-model/rich-text-builder.d.ts +28 -9
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/utils.d.ts +1 -0
- package/lib/types/docs/data-model/types.d.ts +0 -2
- package/lib/types/facade/f-event.d.ts +9 -9
- package/lib/types/facade/f-univer.d.ts +1 -22
- package/lib/types/facade/index.d.ts +0 -1
- package/lib/types/services/context/context.d.ts +0 -2
- package/lib/types/services/instance/instance.service.d.ts +0 -8
- package/lib/types/shared/cache/image-cache.d.ts +1 -1
- package/lib/types/shared/common.d.ts +0 -5
- package/lib/types/shared/object-matrix.d.ts +0 -14
- package/lib/types/shared/rectangle.d.ts +0 -15
- package/lib/types/shared/tools.d.ts +0 -2
- package/lib/types/sheets/sheet-skeleton.d.ts +3 -7
- package/lib/types/sheets/typedef.d.ts +0 -14
- package/lib/types/sheets/workbook.d.ts +0 -2
- package/lib/types/sheets/worksheet.d.ts +0 -6
- package/lib/types/types/const/page-size.d.ts +2 -0
- package/lib/types/types/enum/text-style.d.ts +3 -1
- package/lib/types/types/enum/theme-color-type.d.ts +0 -4
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +0 -2
- package/lib/types/types/interfaces/i-document-data.d.ts +113 -12
- package/lib/types/types/interfaces/i-need-check-disposable.d.ts +1 -1
- package/lib/types/types/interfaces/i-style-data.d.ts +43 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +22 -21
- package/package.json +4 -4
- package/lib/types/facade/f-hooks.d.ts +0 -74
|
@@ -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 {
|
|
19
|
-
export
|
|
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;
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import type { ImageSourceType } from '../services/image-io/image-io.service';
|
|
17
|
+
import type { IResources } from '../services/resource-manager/type';
|
|
16
18
|
import type { CellValueType, LocaleType } from '../types/enum';
|
|
17
19
|
import type { IDocumentData } from '../types/interfaces';
|
|
18
20
|
export type BaseId = string;
|
|
@@ -38,6 +40,44 @@ export interface IBaseResources {
|
|
|
38
40
|
attachmentSets?: Record<string, string[]>;
|
|
39
41
|
attachments?: Record<string, Record<string, unknown>>;
|
|
40
42
|
}
|
|
43
|
+
export interface IBaseAttachment {
|
|
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
|
+
*/
|
|
50
|
+
id: string;
|
|
51
|
+
/** User-visible file name. Include the extension so clients can classify the file when `mimeType` is absent. */
|
|
52
|
+
name: string;
|
|
53
|
+
/** MIME type used to classify and preview the attachment, for example `image/webp` or `application/pdf`. */
|
|
54
|
+
mimeType?: string;
|
|
55
|
+
/** File size in bytes. This is descriptive metadata and does not affect source loading. */
|
|
56
|
+
size?: number;
|
|
57
|
+
/** Image width in pixels when known. This is descriptive metadata used to reserve preview space. */
|
|
58
|
+
width?: number;
|
|
59
|
+
/** Image height in pixels when known. This is descriptive metadata used to reserve preview space. */
|
|
60
|
+
height?: number;
|
|
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
|
+
*/
|
|
67
|
+
sourceType?: ImageSourceType;
|
|
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
|
+
*/
|
|
73
|
+
source?: string;
|
|
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
|
+
*/
|
|
79
|
+
thumbnail?: string;
|
|
80
|
+
}
|
|
41
81
|
export declare enum BaseFieldType {
|
|
42
82
|
Text = "text",
|
|
43
83
|
SingleSelect = "singleSelect",
|
|
@@ -50,24 +90,50 @@ export declare enum BaseFieldType {
|
|
|
50
90
|
Checkbox = "checkbox",
|
|
51
91
|
Link = "link",
|
|
52
92
|
Formula = "formula",
|
|
53
|
-
Lookup = "lookup",
|
|
54
|
-
Flow = "flow",
|
|
55
|
-
Button = "button",
|
|
56
93
|
Numbering = "numbering",
|
|
57
94
|
Phone = "phone",
|
|
58
95
|
Email = "email",
|
|
59
|
-
Location = "location",
|
|
60
|
-
Barcode = "barcode",
|
|
61
96
|
Progress = "progress",
|
|
62
97
|
Currency = "currency",
|
|
63
98
|
Rating = "rating",
|
|
64
|
-
|
|
99
|
+
RecordLink = "recordLink",
|
|
65
100
|
RecordId = "recordId",
|
|
66
101
|
CreatedBy = "createdBy",
|
|
67
102
|
UpdatedBy = "updatedBy",
|
|
68
103
|
CreatedAt = "createdAt",
|
|
69
|
-
UpdatedAt = "updatedAt"
|
|
70
|
-
|
|
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;
|
|
71
137
|
}
|
|
72
138
|
export declare enum BaseViewType {
|
|
73
139
|
Grid = "grid",
|
|
@@ -77,7 +143,123 @@ export declare enum BaseViewType {
|
|
|
77
143
|
Gallery = "gallery"
|
|
78
144
|
}
|
|
79
145
|
export type FieldConfig = Record<string, unknown>;
|
|
80
|
-
export type
|
|
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>);
|
|
81
263
|
export interface IBaseSnapshot {
|
|
82
264
|
id: BaseId;
|
|
83
265
|
name: string;
|
|
@@ -90,6 +272,7 @@ export interface IBaseSnapshot {
|
|
|
90
272
|
createdAt: number;
|
|
91
273
|
updatedAt: number;
|
|
92
274
|
createdBy?: string;
|
|
275
|
+
resources?: IResources;
|
|
93
276
|
}
|
|
94
277
|
export interface ITableSnapshot {
|
|
95
278
|
id: TableId;
|
|
@@ -209,7 +392,7 @@ export interface IGroupConfig {
|
|
|
209
392
|
direction?: BaseSortDirection;
|
|
210
393
|
hideEmptyGroup?: boolean;
|
|
211
394
|
}
|
|
212
|
-
export interface IGridViewConfig {
|
|
395
|
+
export interface IGridViewConfig extends IBaseViewCommonConfig {
|
|
213
396
|
frozenFieldCount?: number;
|
|
214
397
|
showRecordIndex?: boolean;
|
|
215
398
|
rowHeight?: 'short' | 'medium' | 'tall' | 'extraTall';
|
|
@@ -229,7 +412,7 @@ export interface IKanbanColumnSetting {
|
|
|
229
412
|
color?: string;
|
|
230
413
|
collapsed?: boolean;
|
|
231
414
|
}
|
|
232
|
-
export interface IKanbanViewConfig {
|
|
415
|
+
export interface IKanbanViewConfig extends IBaseViewCommonConfig {
|
|
233
416
|
groupFieldId: FieldId;
|
|
234
417
|
coverFieldId?: FieldId | null;
|
|
235
418
|
cardLayout?: KanbanCardLayoutMode;
|
|
@@ -238,7 +421,7 @@ export interface IKanbanViewConfig {
|
|
|
238
421
|
columnSettings?: Record<string, IKanbanColumnSetting>;
|
|
239
422
|
card?: ICardLayoutConfig;
|
|
240
423
|
}
|
|
241
|
-
export interface ICalendarViewConfig {
|
|
424
|
+
export interface ICalendarViewConfig extends IBaseViewCommonConfig {
|
|
242
425
|
startDateFieldId: FieldId;
|
|
243
426
|
endDateFieldId?: FieldId;
|
|
244
427
|
titleFieldId?: FieldId;
|
|
@@ -258,16 +441,7 @@ export interface ICalendarViewConfig {
|
|
|
258
441
|
order?: number;
|
|
259
442
|
}>;
|
|
260
443
|
}
|
|
261
|
-
export interface
|
|
262
|
-
id: string;
|
|
263
|
-
color: string;
|
|
264
|
-
target?: 'cell' | 'row' | 'column';
|
|
265
|
-
fieldId: FieldId;
|
|
266
|
-
operator: 'is' | 'isNot' | 'contains' | 'notContains' | 'isEmpty' | 'isNotEmpty' | 'greaterThan' | 'lessThan' | 'before' | 'after';
|
|
267
|
-
operand?: unknown;
|
|
268
|
-
dateMode?: 'exact' | 'today' | 'tomorrow' | 'yesterday' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'past7' | 'next7' | 'past30' | 'next30';
|
|
269
|
-
}
|
|
270
|
-
export interface IGanttViewConfig {
|
|
444
|
+
export interface IGanttViewConfig extends IBaseViewCommonConfig {
|
|
271
445
|
startDateFieldId: FieldId;
|
|
272
446
|
endDateFieldId: FieldId;
|
|
273
447
|
titleFieldId?: FieldId;
|
|
@@ -303,7 +477,7 @@ export interface IGanttViewConfig {
|
|
|
303
477
|
}>;
|
|
304
478
|
};
|
|
305
479
|
}
|
|
306
|
-
export interface IGalleryViewConfig {
|
|
480
|
+
export interface IGalleryViewConfig extends IBaseViewCommonConfig {
|
|
307
481
|
card: ICardLayoutConfig;
|
|
308
482
|
coverFieldId?: FieldId | null;
|
|
309
483
|
cardLayout?: KanbanCardLayoutMode;
|
|
@@ -339,13 +513,37 @@ export interface IProjectedGroup {
|
|
|
339
513
|
level?: number;
|
|
340
514
|
children?: IProjectedGroup[];
|
|
341
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
|
+
}
|
|
342
538
|
export interface IGridProjection extends IViewProjection {
|
|
343
539
|
type: BaseViewType.Grid;
|
|
344
540
|
frozenFieldCount?: number;
|
|
541
|
+
hierarchy?: IBaseHierarchyProjection;
|
|
345
542
|
}
|
|
346
543
|
export interface IKanbanProjection extends IViewProjection {
|
|
347
544
|
type: BaseViewType.Kanban;
|
|
348
545
|
groupFieldId: FieldId;
|
|
546
|
+
titleFieldId?: FieldId;
|
|
349
547
|
coverFieldId?: FieldId | null;
|
|
350
548
|
cardLayout: KanbanCardLayoutMode;
|
|
351
549
|
showFieldNames: boolean;
|
|
@@ -410,6 +608,7 @@ export interface IGanttProjection extends IViewProjection {
|
|
|
410
608
|
}
|
|
411
609
|
export interface IGalleryProjection extends IViewProjection {
|
|
412
610
|
type: BaseViewType.Gallery;
|
|
611
|
+
titleFieldId?: FieldId;
|
|
413
612
|
coverFieldId?: FieldId | null;
|
|
414
613
|
cardLayout: KanbanCardLayoutMode;
|
|
415
614
|
showFieldNames: boolean;
|
|
@@ -549,6 +748,39 @@ export type BaseHitTestResult = {
|
|
|
549
748
|
tableId: TableId;
|
|
550
749
|
viewId: ViewId;
|
|
551
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;
|
|
552
784
|
} | {
|
|
553
785
|
type: 'kanban-add-record';
|
|
554
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';
|
|
@@ -14,9 +14,15 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { Nullable } from '../../shared';
|
|
17
|
-
import type { IDocumentStyle, IParagraphStyle } from '../../types/interfaces';
|
|
17
|
+
import type { IDocStyles, IDocumentStyle, IParagraphStyle } from '../../types/interfaces';
|
|
18
18
|
export interface IResolveDocumentParagraphStyleOptions {
|
|
19
|
+
/** Exclude document-level outer spacing while retaining all other defaults. */
|
|
19
20
|
excludeDocumentOuterSpacing?: boolean;
|
|
21
|
+
/** Preserve the legacy Modern Doc spacing defaults when no explicit flavor is available. */
|
|
20
22
|
useLegacyModernDefaults?: boolean;
|
|
23
|
+
/** Named document styles keyed by stable style id. */
|
|
24
|
+
styles?: IDocStyles;
|
|
25
|
+
/** Named paragraph style referenced by the paragraph. */
|
|
26
|
+
paragraphStyleId?: string;
|
|
21
27
|
}
|
|
22
28
|
export declare function resolveDocumentParagraphStyle(documentStyle: Nullable<IDocumentStyle>, paragraphStyle: Nullable<IParagraphStyle>, options?: IResolveDocumentParagraphStyleOptions): IParagraphStyle;
|
|
@@ -32,7 +32,9 @@ export declare function normalizeData(data: IDocumentData): IDocumentData;
|
|
|
32
32
|
* Agent-friendly text style aliases accepted by `RichTextBuilder.span()`.
|
|
33
33
|
*
|
|
34
34
|
* The readable aliases can be combined in one object and apply only to the appended span. Native `ITextStyle` fields
|
|
35
|
-
* remain available for advanced document integrations.
|
|
35
|
+
* remain available for advanced document integrations. Drawing effects such as `glow` and `outerShadow` are
|
|
36
|
+
* especially useful when the resulting rich text is attached to a Shape; standalone document products may not expose
|
|
37
|
+
* dedicated controls for them.
|
|
36
38
|
*
|
|
37
39
|
* @example
|
|
38
40
|
* ```ts
|
|
@@ -43,6 +45,14 @@ export declare function normalizeData(data: IDocumentData): IDocumentData;
|
|
|
43
45
|
* italic: true,
|
|
44
46
|
* color: '#dc2626',
|
|
45
47
|
* background: '#fee2e2',
|
|
48
|
+
* glow: { color: '#f97316', radius: 6 },
|
|
49
|
+
* outerShadow: {
|
|
50
|
+
* color: '#000000',
|
|
51
|
+
* opacity: 0.35,
|
|
52
|
+
* blurRadius: 4,
|
|
53
|
+
* distance: 3,
|
|
54
|
+
* direction: 45,
|
|
55
|
+
* },
|
|
46
56
|
* });
|
|
47
57
|
* ```
|
|
48
58
|
*/
|
|
@@ -1375,12 +1385,15 @@ export declare class RichTextBuilder extends RichTextValue {
|
|
|
1375
1385
|
static create(data?: IDocumentData): RichTextBuilder;
|
|
1376
1386
|
private _doc;
|
|
1377
1387
|
private readonly _trackedRanges;
|
|
1388
|
+
private _childHandleRevision;
|
|
1378
1389
|
constructor(data: IDocumentData);
|
|
1379
1390
|
/**
|
|
1380
1391
|
* Returns editable paragraph handles backed by this detached rich-text builder.
|
|
1381
1392
|
*
|
|
1382
|
-
* Paragraph boundaries come from the document model rather than splitting plain text.
|
|
1383
|
-
*
|
|
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()`.
|
|
1384
1397
|
*
|
|
1385
1398
|
* @returns Editable paragraphs in document order.
|
|
1386
1399
|
* @example
|
|
@@ -1416,6 +1429,7 @@ export declare class RichTextBuilder extends RichTextValue {
|
|
|
1416
1429
|
private _createParagraphBuilder;
|
|
1417
1430
|
private _trackRange;
|
|
1418
1431
|
private _rebaseTrackedRanges;
|
|
1432
|
+
private _invalidateChildHandles;
|
|
1419
1433
|
/**
|
|
1420
1434
|
* Appends plain text to the rich text.
|
|
1421
1435
|
*
|
|
@@ -1487,14 +1501,15 @@ export declare class RichTextBuilder extends RichTextValue {
|
|
|
1487
1501
|
*/
|
|
1488
1502
|
columns(options: IRichTextColumnsOptions): RichTextBuilder;
|
|
1489
1503
|
/**
|
|
1490
|
-
* Appends one text span with
|
|
1504
|
+
* Appends one text span with an optional style.
|
|
1491
1505
|
*
|
|
1492
1506
|
* Prefer this method when combining multiple styles, because the style object is local to the inserted text and does
|
|
1493
1507
|
* not leak into following calls.
|
|
1494
1508
|
*
|
|
1495
1509
|
* @param text Text to append.
|
|
1496
|
-
* @param style
|
|
1497
|
-
* `color`, and `background` are supported alongside native
|
|
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.
|
|
1498
1513
|
* @returns The current builder for chaining.
|
|
1499
1514
|
* @example
|
|
1500
1515
|
* ```ts
|
|
@@ -1503,7 +1518,7 @@ export declare class RichTextBuilder extends RichTextValue {
|
|
|
1503
1518
|
* .span('Important', { bold: true, italic: true, color: '#d92d20' });
|
|
1504
1519
|
* ```
|
|
1505
1520
|
*/
|
|
1506
|
-
span(text: string, style
|
|
1521
|
+
span(text: string, style?: IRichTextSpanStyle): RichTextBuilder;
|
|
1507
1522
|
/**
|
|
1508
1523
|
* Appends bold text.
|
|
1509
1524
|
*
|
|
@@ -1773,8 +1788,9 @@ export declare class RichTextParagraphBuilder extends RichTextValue {
|
|
|
1773
1788
|
private readonly _owner;
|
|
1774
1789
|
private readonly _paragraphId;
|
|
1775
1790
|
private readonly _range;
|
|
1791
|
+
private readonly _revision;
|
|
1776
1792
|
/** @hideconstructor */
|
|
1777
|
-
constructor(_owner: RichTextBuilder, _paragraphId: string, _range: IMutableRichTextRange);
|
|
1793
|
+
constructor(_owner: RichTextBuilder, _paragraphId: string, _range: IMutableRichTextRange, _revision: number);
|
|
1778
1794
|
/** Returns the persisted paragraph id. */
|
|
1779
1795
|
getId(): string;
|
|
1780
1796
|
/** Returns the current paragraph range without its trailing paragraph marker. */
|
|
@@ -1803,6 +1819,7 @@ export declare class RichTextParagraphBuilder extends RichTextValue {
|
|
|
1803
1819
|
getData(): IDocumentData;
|
|
1804
1820
|
copy(): RichTextBuilder;
|
|
1805
1821
|
private _getParagraph;
|
|
1822
|
+
private _assertActive;
|
|
1806
1823
|
}
|
|
1807
1824
|
/**
|
|
1808
1825
|
* An editable text-run handle owned by a detached {@link RichTextBuilder}.
|
|
@@ -1816,9 +1833,10 @@ export declare class RichTextRunBuilder {
|
|
|
1816
1833
|
private readonly _textStyle;
|
|
1817
1834
|
private readonly _styleId;
|
|
1818
1835
|
private readonly _hasExplicitTextStyle;
|
|
1836
|
+
private readonly _revision;
|
|
1819
1837
|
private _active;
|
|
1820
1838
|
/** @hideconstructor */
|
|
1821
|
-
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);
|
|
1822
1840
|
/** Inclusive start offset, kept for compatibility with existing `getTextRuns()` callers. */
|
|
1823
1841
|
get st(): number;
|
|
1824
1842
|
/** Exclusive end offset, automatically updated after text replacement. */
|
|
@@ -1860,5 +1878,6 @@ export declare class RichTextRunBuilder {
|
|
|
1860
1878
|
* ```
|
|
1861
1879
|
*/
|
|
1862
1880
|
setText(text: string): this;
|
|
1881
|
+
private _assertActive;
|
|
1863
1882
|
}
|
|
1864
1883
|
export {};
|
|
@@ -70,7 +70,7 @@ export declare class BuildTextUtils {
|
|
|
70
70
|
export { getSingleDataStreamChange } from './data-stream-change';
|
|
71
71
|
export type { IDataStreamChange } from './data-stream-change';
|
|
72
72
|
export { getCustomBlockIdsInSelections } from './drawings';
|
|
73
|
-
export { getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset } from './paragraph';
|
|
73
|
+
export { getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, } from './paragraph';
|
|
74
74
|
export { containsInteriorInsertionOffset, containsStreamIndex, getBlockRangeInterval, getColumnGroupRangeInterval, getCustomBlockInterval, getCustomRangeInterval, getExclusiveRangeInterval, getInclusiveRangeInterval, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, intersectsOperationalIntervals, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, } from './range-interval';
|
|
75
75
|
export type { IDocOperationalInterval } from './range-interval';
|
|
76
76
|
export type { IAddCustomRangeTextXParam, IDeleteCustomRangeParam, IReplaceSelectionTextXParams } from './text-x-utils';
|
|
@@ -37,6 +37,7 @@ export declare function getColumnGroupSlice(body: IDocumentBody, startOffset: nu
|
|
|
37
37
|
export declare function getParagraphsSlice(body: IDocumentBody, startOffset: number, endOffset: number, type?: SliceBodyType): {
|
|
38
38
|
startIndex: number;
|
|
39
39
|
paragraphId: string;
|
|
40
|
+
styleId?: string;
|
|
40
41
|
paragraphStyle?: import("../../..").IParagraphStyle;
|
|
41
42
|
bullet?: import("../../..").IBullet;
|
|
42
43
|
}[] | undefined;
|
|
@@ -103,7 +103,7 @@ export declare class FEventName {
|
|
|
103
103
|
* // Remove the event listener, use `disposable.dispose()`
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
|
-
get 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():
|
|
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():
|
|
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():
|
|
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():
|
|
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():
|
|
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():
|
|
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():
|
|
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():
|
|
227
|
+
get BeforeCommandExecute(): 'BeforeCommandExecute';
|
|
228
228
|
}
|
|
229
229
|
export interface IEventParamConfig {
|
|
230
230
|
LifeCycleChanged: ILifeCycleChangedEvent;
|