@univerjs/core 1.0.0-alpha.2 → 1.0.0-alpha.3
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 +85 -27
- package/lib/cjs/index.js +9898 -8248
- package/lib/es/facade.js +86 -28
- package/lib/es/index.js +9864 -8253
- package/lib/facade.js +86 -28
- package/lib/index.js +9864 -8253
- package/lib/types/bases/base-data-model.d.ts +4 -0
- package/lib/types/bases/empty-snapshot.d.ts +2 -1
- package/lib/types/bases/index.d.ts +3 -2
- package/lib/types/bases/typedef.d.ts +80 -67
- package/lib/types/common/regexp/charset.d.ts +63 -0
- package/lib/types/common/regexp/escape.d.ts +30 -0
- package/lib/types/common/regexp/factory.d.ts +16 -0
- package/lib/types/common/regexp/index.d.ts +37 -0
- package/lib/types/common/regexp/or.d.ts +57 -0
- package/lib/types/docs/data-model/empty-snapshot.d.ts +2 -1
- package/lib/types/docs/data-model/index.d.ts +20 -0
- package/lib/types/docs/data-model/paragraph-style.d.ts +22 -0
- package/lib/types/docs/data-model/preset-list-type.d.ts +19 -6
- package/lib/types/docs/data-model/rich-text-builder.d.ts +269 -1
- package/lib/types/docs/data-model/text-x/action-types.d.ts +1 -0
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +4 -1
- package/lib/types/docs/data-model/text-x/build-utils/data-stream-change.d.ts +28 -0
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +5 -0
- package/lib/types/docs/data-model/text-x/build-utils/paragraph.d.ts +4 -1
- package/lib/types/docs/data-model/text-x/build-utils/range-interval.d.ts +74 -0
- package/lib/types/docs/data-model/text-x/structure-validator.d.ts +31 -0
- package/lib/types/docs/data-model/text-x/utils.d.ts +12 -4
- package/lib/types/docs/index.d.ts +5 -0
- package/lib/types/docs/section-break-id.d.ts +19 -0
- package/lib/types/docs/section-header-footer.d.ts +32 -0
- package/lib/types/facade/f-enum.d.ts +40 -1
- package/lib/types/facade/f-hooks.d.ts +8 -0
- package/lib/types/facade/f-univer.d.ts +28 -27
- package/lib/types/index.d.ts +3 -32
- package/lib/types/services/authz-io/authz-io-local.service.d.ts +1 -1
- package/lib/types/services/instance/instance.service.d.ts +26 -0
- package/lib/types/services/resource-manager/type.d.ts +1 -1
- package/lib/types/shared/date-kit.d.ts +1 -0
- package/lib/types/shared/tools.d.ts +0 -11
- package/lib/types/sheets/index.d.ts +26 -0
- package/lib/types/sheets/typedef.d.ts +2 -0
- package/lib/types/types/const/const.d.ts +0 -1
- package/lib/types/types/enum/locale-type.d.ts +9 -0
- package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +1 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +35 -2
- package/lib/types/types/interfaces/i-drawing.d.ts +25 -1
- package/lib/types/types/interfaces/i-style-data.d.ts +1 -5
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +19 -11
- package/package.json +5 -5
|
@@ -25,6 +25,10 @@ export declare class BaseDataModel extends UnitModel<IBaseSnapshot, UniverInstan
|
|
|
25
25
|
getUnitId(): string;
|
|
26
26
|
setName(name: string): void;
|
|
27
27
|
getSnapshot(): IBaseSnapshot;
|
|
28
|
+
/** Check if a table name already exists, ignoring case. */
|
|
29
|
+
checkTableName(name: string): boolean;
|
|
30
|
+
/** Generate a table name that does not conflict with existing tables. */
|
|
31
|
+
uniqueTableName(name: string): string;
|
|
28
32
|
setSnapshot(snapshot: IBaseSnapshot): void;
|
|
29
33
|
getRev(): number;
|
|
30
34
|
incrementRev(): void;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IBaseSnapshot, ITableSnapshot } from './typedef';
|
|
17
|
+
import { LocaleType } from '../types/enum';
|
|
17
18
|
export interface ICreateDefaultBaseTableSnapshotOptions {
|
|
18
19
|
id: string;
|
|
19
20
|
name: string;
|
|
@@ -24,4 +25,4 @@ export interface ICreateDefaultBaseTableSnapshotOptions {
|
|
|
24
25
|
now?: number;
|
|
25
26
|
}
|
|
26
27
|
export declare function createDefaultBaseTableSnapshot(options: ICreateDefaultBaseTableSnapshotOptions): ITableSnapshot;
|
|
27
|
-
export declare function
|
|
28
|
+
export declare function getEmptySnapshot(unitId?: string, name?: string, locale?: LocaleType): IBaseSnapshot;
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export { BaseDataModel } from './base-data-model';
|
|
17
|
-
export { createDefaultBaseTableSnapshot,
|
|
18
|
-
export
|
|
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, 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';
|
|
@@ -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 { CellValueType } from '../types/enum';
|
|
16
|
+
import type { CellValueType, LocaleType } from '../types/enum';
|
|
17
17
|
import type { IDocumentData } from '../types/interfaces';
|
|
18
18
|
export type BaseId = string;
|
|
19
19
|
export type TableId = string;
|
|
@@ -38,20 +38,58 @@ export interface IBaseResources {
|
|
|
38
38
|
attachmentSets?: Record<string, string[]>;
|
|
39
39
|
attachments?: Record<string, Record<string, unknown>>;
|
|
40
40
|
}
|
|
41
|
-
export
|
|
42
|
-
|
|
41
|
+
export declare enum BaseFieldType {
|
|
42
|
+
Text = "text",
|
|
43
|
+
SingleSelect = "singleSelect",
|
|
44
|
+
MultiSelect = "multiSelect",
|
|
45
|
+
Person = "person",
|
|
46
|
+
Group = "group",
|
|
47
|
+
Date = "date",
|
|
48
|
+
Attachment = "attachment",
|
|
49
|
+
Number = "number",
|
|
50
|
+
Checkbox = "checkbox",
|
|
51
|
+
Link = "link",
|
|
52
|
+
Formula = "formula",
|
|
53
|
+
Lookup = "lookup",
|
|
54
|
+
Flow = "flow",
|
|
55
|
+
Button = "button",
|
|
56
|
+
Numbering = "numbering",
|
|
57
|
+
Phone = "phone",
|
|
58
|
+
Email = "email",
|
|
59
|
+
Location = "location",
|
|
60
|
+
Barcode = "barcode",
|
|
61
|
+
Progress = "progress",
|
|
62
|
+
Currency = "currency",
|
|
63
|
+
Rating = "rating",
|
|
64
|
+
TwoWayLink = "twoWayLink",
|
|
65
|
+
RecordId = "recordId",
|
|
66
|
+
CreatedBy = "createdBy",
|
|
67
|
+
UpdatedBy = "updatedBy",
|
|
68
|
+
CreatedAt = "createdAt",
|
|
69
|
+
UpdatedAt = "updatedAt",
|
|
70
|
+
Summary = "summary"
|
|
71
|
+
}
|
|
72
|
+
export declare enum BaseViewType {
|
|
73
|
+
Grid = "grid",
|
|
74
|
+
Kanban = "kanban",
|
|
75
|
+
Calendar = "calendar",
|
|
76
|
+
Gantt = "gantt",
|
|
77
|
+
Gallery = "gallery"
|
|
78
|
+
}
|
|
43
79
|
export type FieldConfig = Record<string, unknown>;
|
|
44
80
|
export type ViewSpecificConfig = IGridViewConfig | IKanbanViewConfig | ICalendarViewConfig | IGanttViewConfig | IGalleryViewConfig | Record<string, unknown>;
|
|
45
81
|
export interface IBaseSnapshot {
|
|
46
82
|
id: BaseId;
|
|
47
83
|
name: string;
|
|
84
|
+
rev?: number;
|
|
85
|
+
appVersion?: string;
|
|
86
|
+
locale?: LocaleType;
|
|
48
87
|
schemaVersion: number;
|
|
49
88
|
tables: Record<TableId, ITableSnapshot>;
|
|
50
89
|
tableOrder: TableId[];
|
|
51
90
|
createdAt: number;
|
|
52
91
|
updatedAt: number;
|
|
53
92
|
createdBy?: string;
|
|
54
|
-
rev?: number;
|
|
55
93
|
}
|
|
56
94
|
export interface ITableSnapshot {
|
|
57
95
|
id: TableId;
|
|
@@ -69,7 +107,6 @@ export interface ITableSnapshot {
|
|
|
69
107
|
views: Record<ViewId, IViewSnapshot>;
|
|
70
108
|
viewOrder: ViewId[];
|
|
71
109
|
primaryFieldId: FieldId;
|
|
72
|
-
deleted?: boolean;
|
|
73
110
|
}
|
|
74
111
|
export interface IRecordSnapshot {
|
|
75
112
|
id: RecordId;
|
|
@@ -79,31 +116,28 @@ export interface IRecordSnapshot {
|
|
|
79
116
|
updatedAt: number;
|
|
80
117
|
createdBy?: string;
|
|
81
118
|
updatedBy?: string;
|
|
82
|
-
deleted?: boolean;
|
|
83
119
|
}
|
|
84
120
|
export interface IFieldSnapshot {
|
|
85
121
|
id: FieldId;
|
|
86
122
|
name: string;
|
|
87
123
|
description?: string;
|
|
88
|
-
type:
|
|
124
|
+
type: BaseFieldType;
|
|
89
125
|
config: FieldConfig;
|
|
90
126
|
defaultValue?: CellValue;
|
|
91
127
|
system?: boolean;
|
|
92
128
|
readonly?: boolean;
|
|
93
|
-
deleted?: boolean;
|
|
94
129
|
}
|
|
95
130
|
export interface IViewSnapshot<TConfig extends ViewSpecificConfig = ViewSpecificConfig> {
|
|
96
131
|
id: ViewId;
|
|
97
132
|
tableId: TableId;
|
|
98
133
|
name: string;
|
|
99
|
-
type:
|
|
134
|
+
type: BaseViewType;
|
|
100
135
|
fieldOrder?: FieldId[];
|
|
101
136
|
fieldSettings?: Record<FieldId, IViewFieldSetting>;
|
|
102
137
|
filter?: IFilterConfig | null;
|
|
103
138
|
sort?: ISortConfig[];
|
|
104
139
|
group?: IGroupConfig[];
|
|
105
140
|
config: TConfig;
|
|
106
|
-
deleted?: boolean;
|
|
107
141
|
}
|
|
108
142
|
export type BaseSnapshot = IBaseSnapshot;
|
|
109
143
|
export type TableSnapshot = ITableSnapshot;
|
|
@@ -135,23 +169,44 @@ export interface IValidationResult {
|
|
|
135
169
|
valid: boolean;
|
|
136
170
|
reason?: string;
|
|
137
171
|
}
|
|
138
|
-
export
|
|
172
|
+
export declare enum BaseFilterOperator {
|
|
173
|
+
IS = "is",
|
|
174
|
+
IS_NOT = "isNot",
|
|
175
|
+
CONTAINS = "contains",
|
|
176
|
+
NOT_CONTAINS = "notContains",
|
|
177
|
+
IS_EMPTY = "isEmpty",
|
|
178
|
+
IS_NOT_EMPTY = "isNotEmpty",
|
|
179
|
+
GREATER_THAN = "greaterThan",
|
|
180
|
+
GREATER_THAN_OR_EQUAL = "greaterThanOrEqual",
|
|
181
|
+
LESS_THAN = "lessThan",
|
|
182
|
+
LESS_THAN_OR_EQUAL = "lessThanOrEqual",
|
|
183
|
+
BEFORE = "before",
|
|
184
|
+
AFTER = "after"
|
|
185
|
+
}
|
|
186
|
+
export declare enum BaseFilterConjunction {
|
|
187
|
+
AND = "and",
|
|
188
|
+
OR = "or"
|
|
189
|
+
}
|
|
139
190
|
export interface IFilterConfig {
|
|
140
|
-
conjunction:
|
|
191
|
+
conjunction: BaseFilterConjunction;
|
|
141
192
|
conditions: IFilterCondition[];
|
|
142
193
|
}
|
|
143
194
|
export interface IFilterCondition {
|
|
144
195
|
fieldId: FieldId;
|
|
145
|
-
operator:
|
|
196
|
+
operator: BaseFilterOperator;
|
|
146
197
|
operand?: unknown;
|
|
147
198
|
}
|
|
199
|
+
export declare enum BaseSortDirection {
|
|
200
|
+
ASC = "asc",
|
|
201
|
+
DESC = "desc"
|
|
202
|
+
}
|
|
148
203
|
export interface ISortConfig {
|
|
149
204
|
fieldId: FieldId;
|
|
150
|
-
direction:
|
|
205
|
+
direction: BaseSortDirection;
|
|
151
206
|
}
|
|
152
207
|
export interface IGroupConfig {
|
|
153
208
|
fieldId: FieldId;
|
|
154
|
-
direction?:
|
|
209
|
+
direction?: BaseSortDirection;
|
|
155
210
|
hideEmptyGroup?: boolean;
|
|
156
211
|
}
|
|
157
212
|
export interface IGridViewConfig {
|
|
@@ -260,13 +315,13 @@ export interface IProjectedField {
|
|
|
260
315
|
id: FieldId;
|
|
261
316
|
name: string;
|
|
262
317
|
description?: string;
|
|
263
|
-
type:
|
|
318
|
+
type: BaseFieldType;
|
|
264
319
|
config?: FieldConfig;
|
|
265
320
|
width?: number;
|
|
266
321
|
setting: IViewFieldSetting;
|
|
267
322
|
}
|
|
268
323
|
export interface IViewProjection {
|
|
269
|
-
type:
|
|
324
|
+
type: BaseViewType;
|
|
270
325
|
fields: IProjectedField[];
|
|
271
326
|
rows: IProjectedRow[];
|
|
272
327
|
groups?: IProjectedGroup[];
|
|
@@ -285,11 +340,11 @@ export interface IProjectedGroup {
|
|
|
285
340
|
children?: IProjectedGroup[];
|
|
286
341
|
}
|
|
287
342
|
export interface IGridProjection extends IViewProjection {
|
|
288
|
-
type:
|
|
343
|
+
type: BaseViewType.Grid;
|
|
289
344
|
frozenFieldCount?: number;
|
|
290
345
|
}
|
|
291
346
|
export interface IKanbanProjection extends IViewProjection {
|
|
292
|
-
type:
|
|
347
|
+
type: BaseViewType.Kanban;
|
|
293
348
|
groupFieldId: FieldId;
|
|
294
349
|
coverFieldId?: FieldId | null;
|
|
295
350
|
cardLayout: KanbanCardLayoutMode;
|
|
@@ -303,7 +358,7 @@ export interface IKanbanProjection extends IViewProjection {
|
|
|
303
358
|
}>;
|
|
304
359
|
}
|
|
305
360
|
export interface ICalendarProjection extends IViewProjection {
|
|
306
|
-
type:
|
|
361
|
+
type: BaseViewType.Calendar;
|
|
307
362
|
config: ICalendarViewConfig;
|
|
308
363
|
events: Array<{
|
|
309
364
|
recordId: RecordId;
|
|
@@ -326,7 +381,7 @@ export interface IGanttTimeColumn {
|
|
|
326
381
|
nonWorking?: boolean;
|
|
327
382
|
}
|
|
328
383
|
export interface IGanttProjection extends IViewProjection {
|
|
329
|
-
type:
|
|
384
|
+
type: BaseViewType.Gantt;
|
|
330
385
|
config: IGanttViewConfig;
|
|
331
386
|
dateRangeAllDay?: boolean;
|
|
332
387
|
timeline: {
|
|
@@ -354,7 +409,7 @@ export interface IGanttProjection extends IViewProjection {
|
|
|
354
409
|
}>;
|
|
355
410
|
}
|
|
356
411
|
export interface IGalleryProjection extends IViewProjection {
|
|
357
|
-
type:
|
|
412
|
+
type: BaseViewType.Gallery;
|
|
358
413
|
coverFieldId?: FieldId | null;
|
|
359
414
|
cardLayout: KanbanCardLayoutMode;
|
|
360
415
|
showFieldNames: boolean;
|
|
@@ -368,18 +423,18 @@ export interface IGalleryProjection extends IViewProjection {
|
|
|
368
423
|
}
|
|
369
424
|
export interface IInvalidViewProjection {
|
|
370
425
|
type: 'invalid';
|
|
371
|
-
viewType:
|
|
426
|
+
viewType: BaseViewType;
|
|
372
427
|
reason: 'missingField' | 'invalidGroupField' | 'invalidDateField' | 'invalidGanttStartField' | 'invalidGanttEndField';
|
|
373
428
|
fieldId?: FieldId;
|
|
374
429
|
}
|
|
375
430
|
export type BaseViewProjection = IGridProjection | IKanbanProjection | ICalendarProjection | IGanttProjection | IGalleryProjection | IInvalidViewProjection;
|
|
376
|
-
export interface
|
|
431
|
+
export interface IBaseViewport {
|
|
377
432
|
x: number;
|
|
378
433
|
y: number;
|
|
379
434
|
width: number;
|
|
380
435
|
height: number;
|
|
381
436
|
}
|
|
382
|
-
export interface
|
|
437
|
+
export interface IBaseRect extends IBaseViewport {
|
|
383
438
|
}
|
|
384
439
|
export type BaseSelection = IGridCellSelection | IGridGroupSelection | IGridRecordSelection | IGridFieldSelection | IKanbanCardSelection | ICalendarEventSelection | IGanttCellSelection | IGanttBarSelection | IGalleryCardSelection;
|
|
385
440
|
export interface IGridCellSelection {
|
|
@@ -598,45 +653,3 @@ export interface IBaseInvalidation {
|
|
|
598
653
|
column?: number;
|
|
599
654
|
reason: 'cell' | 'field' | 'record' | 'view' | 'table' | 'unknown';
|
|
600
655
|
}
|
|
601
|
-
export type BaseCellData = IBaseCellData;
|
|
602
|
-
export type BaseResources = IBaseResources;
|
|
603
|
-
export type ViewFieldSetting = IViewFieldSetting;
|
|
604
|
-
export type FieldCapabilities = IFieldCapabilities;
|
|
605
|
-
export type ValidationResult = IValidationResult;
|
|
606
|
-
export type FilterConfig = IFilterConfig;
|
|
607
|
-
export type FilterCondition = IFilterCondition;
|
|
608
|
-
export type SortConfig = ISortConfig;
|
|
609
|
-
export type GroupConfig = IGroupConfig;
|
|
610
|
-
export type GridViewConfig = IGridViewConfig;
|
|
611
|
-
export type CardLayoutConfig = ICardLayoutConfig;
|
|
612
|
-
export type KanbanFieldCardSetting = IKanbanFieldCardSetting;
|
|
613
|
-
export type KanbanColumnSetting = IKanbanColumnSetting;
|
|
614
|
-
export type KanbanViewConfig = IKanbanViewConfig;
|
|
615
|
-
export type CalendarViewConfig = ICalendarViewConfig;
|
|
616
|
-
export type BaseViewColorCondition = IBaseViewColorCondition;
|
|
617
|
-
export type GanttViewConfig = IGanttViewConfig;
|
|
618
|
-
export type GalleryViewConfig = IGalleryViewConfig;
|
|
619
|
-
export type ProjectedField = IProjectedField;
|
|
620
|
-
export type ViewProjection = IViewProjection;
|
|
621
|
-
export type ProjectedRow = IProjectedRow;
|
|
622
|
-
export type ProjectedGroup = IProjectedGroup;
|
|
623
|
-
export type GridProjection = IGridProjection;
|
|
624
|
-
export type KanbanProjection = IKanbanProjection;
|
|
625
|
-
export type CalendarProjection = ICalendarProjection;
|
|
626
|
-
export type GanttTimeColumn = IGanttTimeColumn;
|
|
627
|
-
export type GanttProjection = IGanttProjection;
|
|
628
|
-
export type GalleryProjection = IGalleryProjection;
|
|
629
|
-
export type InvalidViewProjection = IInvalidViewProjection;
|
|
630
|
-
export type Viewport = IViewport;
|
|
631
|
-
export type Rect = IRect;
|
|
632
|
-
export type GridCellSelection = IGridCellSelection;
|
|
633
|
-
export type GridGroupSelection = IGridGroupSelection;
|
|
634
|
-
export type GridRecordSelection = IGridRecordSelection;
|
|
635
|
-
export type GridFieldSelection = IGridFieldSelection;
|
|
636
|
-
export type KanbanCardSelection = IKanbanCardSelection;
|
|
637
|
-
export type CalendarEventSelection = ICalendarEventSelection;
|
|
638
|
-
export type CalendarEventResizeSelection = ICalendarEventResizeSelection;
|
|
639
|
-
export type GanttCellSelection = IGanttCellSelection;
|
|
640
|
-
export type GanttBarSelection = IGanttBarSelection;
|
|
641
|
-
export type GalleryCardSelection = IGalleryCardSelection;
|
|
642
|
-
export type BaseInvalidation = IBaseInvalidation;
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
export type CharsetDataUnit = [number, number];
|
|
17
|
+
/**
|
|
18
|
+
* A single character, code point, or inclusive range used to build a character class.
|
|
19
|
+
*
|
|
20
|
+
* String inputs must contain exactly one Unicode code point. Use `or()` for multi-character
|
|
21
|
+
* alternatives such as keywords or table names.
|
|
22
|
+
*/
|
|
23
|
+
export type CharsetRawInput = string | number | [string, string] | [number, number];
|
|
24
|
+
export type CharsetInput = Charset | CharsetRawInput;
|
|
25
|
+
/**
|
|
26
|
+
* Builds a normalized regular-expression character class.
|
|
27
|
+
*
|
|
28
|
+
* `Charset` is intended for dynamic character sets, especially when callers need set
|
|
29
|
+
* operations that are hard to read or easy to get wrong with handwritten `[...]` strings.
|
|
30
|
+
* Ranges are stored as inclusive Unicode code-point pairs and merged during construction.
|
|
31
|
+
*/
|
|
32
|
+
export declare class Charset {
|
|
33
|
+
readonly data: CharsetDataUnit[];
|
|
34
|
+
constructor(...inputs: CharsetInput[]);
|
|
35
|
+
/**
|
|
36
|
+
* Returns a new charset containing this charset and all provided characters or ranges.
|
|
37
|
+
*/
|
|
38
|
+
union(...inputs: CharsetInput[]): Charset;
|
|
39
|
+
/**
|
|
40
|
+
* Returns a new charset with the provided characters or ranges removed.
|
|
41
|
+
*/
|
|
42
|
+
subtract(...inputs: CharsetInput[]): Charset;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a new charset containing only characters shared with the provided inputs.
|
|
45
|
+
*/
|
|
46
|
+
intersect(...inputs: CharsetInput[]): Charset;
|
|
47
|
+
/**
|
|
48
|
+
* Returns whether this charset would match no characters.
|
|
49
|
+
*/
|
|
50
|
+
isEmpty(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Serializes to a regex fragment, not a full anchored pattern.
|
|
53
|
+
*/
|
|
54
|
+
toString(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a `RegExp` from this charset fragment with optional flags.
|
|
57
|
+
*/
|
|
58
|
+
toRegExp(flags?: string): RegExp;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Convenience factory for `new Charset(...)`.
|
|
62
|
+
*/
|
|
63
|
+
export declare const charset: (...inputs: CharsetInput[]) => Charset;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Escapes text so it can be embedded in a regular-expression pattern as a literal.
|
|
18
|
+
*/
|
|
19
|
+
export declare function escapeRegExp(value: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a `RegExp` that matches literal text rather than regular-expression syntax.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createLiteralRegExp(value: string, flags?: string): RegExp;
|
|
24
|
+
/**
|
|
25
|
+
* Converts a spreadsheet-style wildcard pattern to an anchored regular expression.
|
|
26
|
+
*
|
|
27
|
+
* `*` matches any number of characters and `?` matches one character. All other
|
|
28
|
+
* regular-expression syntax is treated as literal text. Matching is case-insensitive.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createFromWildcard(pattern: string): RegExp;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export declare function createRegExpFromSafeFragment(fragment: string, flags?: string): RegExp;
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { Charset } from './charset';
|
|
17
|
+
import { createFromWildcard, createLiteralRegExp, escapeRegExp } from './escape';
|
|
18
|
+
import { createRegExpFromSafeFragment } from './factory';
|
|
19
|
+
import { Or } from './or';
|
|
20
|
+
/**
|
|
21
|
+
* Namespace-style public API for regex helpers.
|
|
22
|
+
*
|
|
23
|
+
* Import this as `regexp` and call methods through the namespace, for example
|
|
24
|
+
* `regexp.escapeRegExp(value)` or `regexp.or(...names)`. Do not export these
|
|
25
|
+
* helpers individually from the package root; keeping one namespace avoids
|
|
26
|
+
* scattered regex APIs and accidental name collisions.
|
|
27
|
+
*/
|
|
28
|
+
export declare const regexp: {
|
|
29
|
+
Charset: typeof Charset;
|
|
30
|
+
Or: typeof Or;
|
|
31
|
+
charset: (...inputs: import("./charset").CharsetInput[]) => Charset;
|
|
32
|
+
or: (...inputs: import("./or").OrInput[]) => Or;
|
|
33
|
+
createRegExpFromSafeFragment: typeof createRegExpFromSafeFragment;
|
|
34
|
+
escapeRegExp: typeof escapeRegExp;
|
|
35
|
+
createLiteralRegExp: typeof createLiteralRegExp;
|
|
36
|
+
createFromWildcard: typeof createFromWildcard;
|
|
37
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { CharsetInput } from './charset';
|
|
17
|
+
import { Charset } from './charset';
|
|
18
|
+
/**
|
|
19
|
+
* A literal string, existing `Or`, or character-set input used to build alternatives.
|
|
20
|
+
*/
|
|
21
|
+
export type OrInput = string | Or | CharsetInput;
|
|
22
|
+
/**
|
|
23
|
+
* Builds a regex alternation from literal strings and character sets.
|
|
24
|
+
*
|
|
25
|
+
* Literal strings are escaped automatically. Character-set inputs are folded into one
|
|
26
|
+
* `Charset`, so `or('SUM', charset('A', 'B'))` serializes to an alternation containing
|
|
27
|
+
* both the string branch and the character-class branch.
|
|
28
|
+
*/
|
|
29
|
+
export declare class Or {
|
|
30
|
+
readonly charset: Charset;
|
|
31
|
+
readonly strings: string[];
|
|
32
|
+
constructor(...inputs: OrInput[]);
|
|
33
|
+
/**
|
|
34
|
+
* Returns a new alternation containing this instance and all provided inputs.
|
|
35
|
+
*/
|
|
36
|
+
union(...inputs: OrInput[]): Or;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a new alternation with matching string and charset inputs removed.
|
|
39
|
+
*/
|
|
40
|
+
subtract(...inputs: OrInput[]): Or;
|
|
41
|
+
/**
|
|
42
|
+
* Returns whether this alternation would match no branches.
|
|
43
|
+
*/
|
|
44
|
+
isEmpty(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Serializes to a regex fragment, not a full anchored pattern.
|
|
47
|
+
*/
|
|
48
|
+
toString(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a `RegExp` from this alternation fragment with optional flags.
|
|
51
|
+
*/
|
|
52
|
+
toRegExp(flags?: string): RegExp;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Convenience factory for `new Or(...)`.
|
|
56
|
+
*/
|
|
57
|
+
export declare const or: (...inputs: OrInput[]) => Or;
|
|
@@ -15,4 +15,5 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { IDocumentData } from '../../types/interfaces';
|
|
17
17
|
import { LocaleType } from '../../types/enum/locale-type';
|
|
18
|
-
|
|
18
|
+
import { DocumentFlavor } from '../../types/interfaces';
|
|
19
|
+
export declare function getEmptySnapshot(unitID?: string, locale?: LocaleType, title?: string, documentFlavor?: DocumentFlavor): IDocumentData;
|
|
@@ -14,6 +14,26 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export * from './document-data-model';
|
|
17
|
+
export { getEmptySnapshot as getDocsEmptySnapshot } from './empty-snapshot';
|
|
18
|
+
export { JSON1, JSONX } from './json-x/json-x';
|
|
19
|
+
export type { JSONXActions, JSONXPath } from './json-x/json-x';
|
|
20
|
+
export { resolveDocumentParagraphStyle } from './paragraph-style';
|
|
21
|
+
export type { IResolveDocumentParagraphStyleOptions } from './paragraph-style';
|
|
17
22
|
export * from './preset-list-type';
|
|
23
|
+
export { replaceInDocumentBody } from './replacement';
|
|
24
|
+
export { ParagraphStyleBuilder, ParagraphStyleValue, RichTextBuilder, RichTextValue, TextDecorationBuilder, TextStyleBuilder, TextStyleValue, } from './rich-text-builder';
|
|
25
|
+
export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './subdocument';
|
|
26
|
+
export { ActionIterator } from './text-x/action-iterator';
|
|
27
|
+
export { PRESERVE_INSERTED_PARAGRAPH_IDS, TextXActionType } from './text-x/action-types';
|
|
28
|
+
export type { IDeleteAction, IInsertAction, IRetainAction, TextXAction } from './text-x/action-types';
|
|
29
|
+
export { normalizeInsertedSectionIdsForDocument, normalizeTextRuns, RESTORE_INSERTED_PARAGRAPH_IDS } from './text-x/apply-utils/common';
|
|
30
|
+
export { updateAttributeByDelete } from './text-x/apply-utils/delete-apply';
|
|
31
|
+
export { updateAttributeByInsert } from './text-x/apply-utils/insert-apply';
|
|
18
32
|
export * from './text-x/build-utils';
|
|
33
|
+
export { getPlainText } from './text-x/build-utils/parse';
|
|
34
|
+
export { validateDocBodyStructure, validateDocumentStructure } from './text-x/structure-validator';
|
|
35
|
+
export type { DocStructureIssueCode, IDocStructureIssue } from './text-x/structure-validator';
|
|
36
|
+
export { TextX } from './text-x/text-x';
|
|
37
|
+
export type { TPriority } from './text-x/text-x';
|
|
38
|
+
export { composeBody, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getParagraphsSlice, getRichTextEditPath, getSectionBreakSlice, getTableSlice, getTextRunSlice, normalizeBody, SliceBodyType, } from './text-x/utils';
|
|
19
39
|
export * from './types';
|
|
@@ -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 { Nullable } from '../../shared';
|
|
17
|
+
import type { IDocumentStyle, IParagraphStyle } from '../../types/interfaces';
|
|
18
|
+
export interface IResolveDocumentParagraphStyleOptions {
|
|
19
|
+
excludeDocumentOuterSpacing?: boolean;
|
|
20
|
+
useLegacyModernDefaults?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function resolveDocumentParagraphStyle(documentStyle: Nullable<IDocumentStyle>, paragraphStyle: Nullable<IParagraphStyle>, options?: IResolveDocumentParagraphStyleOptions): IParagraphStyle;
|
|
@@ -25,42 +25,55 @@ export declare enum QuickListType {
|
|
|
25
25
|
BULLET_LIST = "*"
|
|
26
26
|
}
|
|
27
27
|
export declare enum PresetListType {
|
|
28
|
+
/** Standard filled-circle bullet list. */
|
|
28
29
|
BULLET_LIST = "BULLET_LIST",
|
|
30
|
+
/** Decorative diamond and arrow bullet list. */
|
|
29
31
|
BULLET_LIST_1 = "BULLET_LIST_1",
|
|
32
|
+
/** Checkmark-led bullet list for completed-item style content. */
|
|
30
33
|
BULLET_LIST_2 = "BULLET_LIST_2",
|
|
34
|
+
/** Square and diamond bullet list. */
|
|
31
35
|
BULLET_LIST_3 = "BULLET_LIST_3",
|
|
36
|
+
/** Star-like decorative bullet list. */
|
|
32
37
|
BULLET_LIST_4 = "BULLET_LIST_4",
|
|
38
|
+
/** Arrow-led bullet list. */
|
|
33
39
|
BULLET_LIST_5 = "BULLET_LIST_5",
|
|
34
40
|
/**
|
|
35
|
-
* 1 a i
|
|
41
|
+
* Hierarchical ordered list using `1`, `a`, and `i` markers.
|
|
36
42
|
*/
|
|
37
43
|
ORDER_LIST = "ORDER_LIST",
|
|
38
44
|
/**
|
|
39
|
-
* 1) a) i)
|
|
45
|
+
* Hierarchical ordered list using `1)`, `a)`, and `i)` markers.
|
|
40
46
|
*/
|
|
41
47
|
ORDER_LIST_1 = "ORDER_LIST_1",
|
|
42
48
|
/**
|
|
43
|
-
* 1
|
|
49
|
+
* Outline list using compound markers such as `1.`, `1.1.`, and `1.1.1.`.
|
|
44
50
|
*/
|
|
45
51
|
ORDER_LIST_2 = "ORDER_LIST_2",
|
|
46
52
|
/**
|
|
47
|
-
* A a i
|
|
53
|
+
* Hierarchical ordered list using `A`, `a`, and `i` markers.
|
|
48
54
|
*/
|
|
49
55
|
ORDER_LIST_3 = "ORDER_LIST_3",
|
|
50
56
|
/**
|
|
51
|
-
* A 1 i
|
|
57
|
+
* Hierarchical ordered list using `A`, `1`, and `i` markers.
|
|
52
58
|
*/
|
|
53
59
|
ORDER_LIST_4 = "ORDER_LIST_4",
|
|
54
60
|
/**
|
|
55
|
-
* 01 a i
|
|
61
|
+
* Zero-padded ordered list using `01`, `a`, and `i` markers.
|
|
56
62
|
*/
|
|
57
63
|
ORDER_LIST_5 = "ORDER_LIST_5",
|
|
64
|
+
/** Quick ordered list using closing-parenthesis markers. */
|
|
58
65
|
ORDER_LIST_QUICK_2 = "ORDER_LIST_QUICK_2",
|
|
66
|
+
/** Quick ordered list using lowercase letter and period markers. */
|
|
59
67
|
ORDER_LIST_QUICK_3 = "ORDER_LIST_QUICK_3",
|
|
68
|
+
/** Quick ordered list using lowercase Roman numeral markers. */
|
|
60
69
|
ORDER_LIST_QUICK_4 = "ORDER_LIST_QUICK_4",
|
|
70
|
+
/** Quick ordered list using uppercase letter markers. */
|
|
61
71
|
ORDER_LIST_QUICK_5 = "ORDER_LIST_QUICK_5",
|
|
72
|
+
/** Quick ordered list using uppercase Roman numeral markers. */
|
|
62
73
|
ORDER_LIST_QUICK_6 = "ORDER_LIST_QUICK_6",
|
|
74
|
+
/** Unchecked task-list item. */
|
|
63
75
|
CHECK_LIST = "CHECK_LIST",
|
|
76
|
+
/** Checked task-list item. */
|
|
64
77
|
CHECK_LIST_CHECKED = "CHECK_LIST_CHECKED"
|
|
65
78
|
}
|
|
66
79
|
export declare const PRESET_LIST_TYPE: Record<string, IListData>;
|