@univerjs-pro/bases 1.0.0-alpha.1 → 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/README.md +8 -5
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/pl-PL.js +1 -1
- package/lib/cjs/locale/pt-BR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/locale/ar-SA.js +1 -1
- package/lib/es/locale/ca-ES.js +1 -1
- package/lib/es/locale/de-DE.js +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/es-ES.js +1 -1
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/id-ID.js +1 -1
- package/lib/es/locale/it-IT.js +1 -1
- package/lib/es/locale/ja-JP.js +1 -1
- package/lib/es/locale/ko-KR.js +1 -1
- package/lib/es/locale/pl-PL.js +1 -1
- package/lib/es/locale/pt-BR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/sk-SK.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/ar-SA.js +1 -1
- package/lib/locale/ca-ES.js +1 -1
- package/lib/locale/de-DE.js +1 -1
- package/lib/locale/en-US.js +1 -1
- package/lib/locale/es-ES.js +1 -1
- package/lib/locale/fa-IR.js +1 -1
- package/lib/locale/fr-FR.js +1 -1
- package/lib/locale/id-ID.js +1 -1
- package/lib/locale/it-IT.js +1 -1
- package/lib/locale/ja-JP.js +1 -1
- package/lib/locale/ko-KR.js +1 -1
- package/lib/locale/pl-PL.js +1 -1
- package/lib/locale/pt-BR.js +1 -1
- package/lib/locale/ru-RU.js +1 -1
- package/lib/locale/sk-SK.js +1 -1
- package/lib/locale/vi-VN.js +1 -1
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/lib/types/commands/commands/set-base-view-filter.command.d.ts +2 -2
- package/lib/types/commands/commands/set-base-view-group.command.d.ts +2 -2
- package/lib/types/commands/commands/set-base-view-sort.command.d.ts +2 -2
- package/lib/types/commands/utils/base-validation.d.ts +6 -0
- package/lib/types/config/config.d.ts +11 -0
- package/lib/types/controllers/base-active-dirty.controller.d.ts +5 -6
- package/lib/types/controllers/base-formula-calculation.controller.d.ts +8 -14
- package/lib/types/embed-host-anchor.d.ts +46 -0
- package/lib/types/facade/f-base.d.ts +126 -577
- package/lib/types/facade/f-enum.d.ts +117 -89
- package/lib/types/facade/f-event.d.ts +255 -132
- package/lib/types/facade/f-field.d.ts +137 -313
- package/lib/types/facade/f-range.d.ts +86 -326
- package/lib/types/facade/f-record.d.ts +93 -216
- package/lib/types/facade/f-table.d.ts +473 -1317
- package/lib/types/facade/f-types.d.ts +1 -0
- package/lib/types/facade/f-univer.d.ts +27 -154
- package/lib/types/facade/f-view.d.ts +207 -484
- package/lib/types/facade/field-key.d.ts +6 -6
- package/lib/types/facade/index.d.ts +11 -14
- package/lib/types/fields/field-core-plugin.d.ts +9 -8
- package/lib/types/index.d.ts +17 -47
- package/lib/types/models/base-cell-data.d.ts +6 -6
- package/lib/types/models/default-table.d.ts +13 -0
- package/lib/types/ot/json1-adapter.d.ts +3 -3
- package/lib/types/ot/json1-invalidation.d.ts +2 -2
- package/lib/types/ot/json1-op-applier.d.ts +2 -2
- package/lib/types/ot/json1-op-factory.d.ts +9 -8
- package/lib/types/plugin.d.ts +6 -4
- package/lib/types/search/base-search.d.ts +4 -3
- package/lib/types/services/base-active-dirty.service.d.ts +2 -2
- package/lib/types/services/base-command.service.d.ts +16 -16
- package/lib/types/services/base-compression.service.d.ts +3 -3
- package/lib/types/services/base-field-registry.service.d.ts +5 -5
- package/lib/types/services/base-formula.service.d.ts +11 -20
- package/lib/types/services/base-view-registry.service.d.ts +3 -3
- package/lib/types/views/view-core-plugin.d.ts +4 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +7 -8
- package/lib/types/controllers/base-remote-formula.controller.d.ts +0 -13
- package/lib/types/facade/f-error.d.ts +0 -30
- package/lib/types/facade/f-permission.d.ts +0 -749
- package/lib/types/facade/transaction.d.ts +0 -19
|
@@ -1,94 +1,122 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
readonly MultiSelect: "multiSelect";
|
|
5
|
-
readonly Person: "person";
|
|
6
|
-
readonly Group: "group";
|
|
7
|
-
readonly Date: "date";
|
|
8
|
-
readonly Attachment: "attachment";
|
|
9
|
-
readonly Number: "number";
|
|
10
|
-
readonly Checkbox: "checkbox";
|
|
11
|
-
readonly Link: "link";
|
|
12
|
-
readonly Formula: "formula";
|
|
13
|
-
readonly Lookup: "lookup";
|
|
14
|
-
readonly Flow: "flow";
|
|
15
|
-
readonly Button: "button";
|
|
16
|
-
readonly Numbering: "numbering";
|
|
17
|
-
readonly Phone: "phone";
|
|
18
|
-
readonly Email: "email";
|
|
19
|
-
readonly Location: "location";
|
|
20
|
-
readonly Barcode: "barcode";
|
|
21
|
-
readonly Progress: "progress";
|
|
22
|
-
readonly Currency: "currency";
|
|
23
|
-
readonly Rating: "rating";
|
|
24
|
-
readonly TwoWayLink: "twoWayLink";
|
|
25
|
-
readonly RecordId: "recordId";
|
|
26
|
-
readonly CreatedBy: "createdBy";
|
|
27
|
-
readonly UpdatedBy: "updatedBy";
|
|
28
|
-
readonly CreatedAt: "createdAt";
|
|
29
|
-
readonly UpdatedAt: "updatedAt";
|
|
30
|
-
readonly Summary: "summary";
|
|
31
|
-
};
|
|
32
|
-
export declare const BaseViewTypeEnum: {
|
|
33
|
-
readonly Grid: "grid";
|
|
34
|
-
readonly Kanban: "kanban";
|
|
35
|
-
readonly Calendar: "calendar";
|
|
36
|
-
readonly Gantt: "gantt";
|
|
37
|
-
readonly Gallery: "gallery";
|
|
38
|
-
};
|
|
39
|
-
export declare const BaseFilterOperatorEnum: {
|
|
40
|
-
readonly Is: "is";
|
|
41
|
-
readonly IsNot: "isNot";
|
|
42
|
-
readonly Contains: "contains";
|
|
43
|
-
readonly DoesNotContain: "doesNotContain";
|
|
44
|
-
readonly IsEmpty: "isEmpty";
|
|
45
|
-
readonly IsNotEmpty: "isNotEmpty";
|
|
46
|
-
readonly GreaterThan: "greaterThan";
|
|
47
|
-
readonly GreaterThanOrEqual: "greaterThanOrEqual";
|
|
48
|
-
readonly LessThan: "lessThan";
|
|
49
|
-
readonly LessThanOrEqual: "lessThanOrEqual";
|
|
50
|
-
readonly Matches: "matches";
|
|
51
|
-
readonly NotMatches: "notMatches";
|
|
52
|
-
};
|
|
53
|
-
export declare const BaseSortDirectionEnum: {
|
|
54
|
-
readonly Asc: "asc";
|
|
55
|
-
readonly Desc: "desc";
|
|
56
|
-
};
|
|
57
|
-
export declare const BaseFieldKeyEnum: {
|
|
58
|
-
readonly Id: "id";
|
|
59
|
-
readonly Name: "name";
|
|
60
|
-
readonly Auto: "auto";
|
|
61
|
-
};
|
|
62
|
-
export declare const BaseBatchEventModeEnum: {
|
|
63
|
-
readonly Immediate: "immediate";
|
|
64
|
-
readonly Coalesce: "coalesce";
|
|
65
|
-
readonly Silent: "silent";
|
|
66
|
-
};
|
|
67
|
-
export declare const BaseBatchUndoModeEnum: {
|
|
68
|
-
readonly Single: "single";
|
|
69
|
-
readonly None: "none";
|
|
70
|
-
};
|
|
71
|
-
export declare const BaseErrorCodeEnum: {
|
|
72
|
-
readonly CommandFailed: "CommandFailed";
|
|
73
|
-
readonly FieldNotFound: "FieldNotFound";
|
|
74
|
-
readonly DuplicateFieldName: "DuplicateFieldName";
|
|
75
|
-
readonly TableNotFound: "TableNotFound";
|
|
76
|
-
readonly ViewNotFound: "ViewNotFound";
|
|
77
|
-
readonly RecordNotFound: "RecordNotFound";
|
|
78
|
-
readonly InvalidFilter: "InvalidFilter";
|
|
79
|
-
readonly InvalidOperation: "InvalidOperation";
|
|
80
|
-
readonly BatchAlreadyRunning: "BatchAlreadyRunning";
|
|
81
|
-
readonly BatchFailed: "BatchFailed";
|
|
82
|
-
};
|
|
1
|
+
import { BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseSortDirection, BaseViewType } from '@univerjs/core';
|
|
2
|
+
import { FEnum } from '@univerjs/core/facade';
|
|
3
|
+
import { BaseFieldKeyEnum } from './field-key';
|
|
83
4
|
export interface IFBaseEnumMixin {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Base field types.
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const fBase = univerAPI.getActiveBase();
|
|
10
|
+
* const fBaseTable = fBase.getTableById('table-1');
|
|
11
|
+
* const field = fBaseTable.addField('Name', univerAPI.Enum.BaseFieldType.Text);
|
|
12
|
+
* console.log(field);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
BaseFieldType: typeof BaseFieldType;
|
|
16
|
+
/**
|
|
17
|
+
* Base filter conjunctions.
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const fBase = univerAPI.getActiveBase();
|
|
21
|
+
* const fBaseTable = fBase.getTableById('table-1');
|
|
22
|
+
* const view = fBaseTable.getViewByName('Grid');
|
|
23
|
+
* view.setFilter({
|
|
24
|
+
* conjunction: univerAPI.Enum.BaseFilterConjunction.AND,
|
|
25
|
+
* filters: [
|
|
26
|
+
* {
|
|
27
|
+
* fieldId: 'fld-1',
|
|
28
|
+
* operator: univerAPI.Enum.BaseFilterOperator.Equals,
|
|
29
|
+
* value: 'John Doe',
|
|
30
|
+
* },
|
|
31
|
+
* ],
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
BaseFilterConjunction: typeof BaseFilterConjunction;
|
|
36
|
+
/**
|
|
37
|
+
* Base filter operators.
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const fBase = univerAPI.getActiveBase();
|
|
41
|
+
* const fBaseTable = fBase.getTableById('table-1');
|
|
42
|
+
* const view = fBaseTable.getViewByName('Grid');
|
|
43
|
+
* view.setFilter({
|
|
44
|
+
* conjunction: univerAPI.Enum.BaseFilterConjunction.AND,
|
|
45
|
+
* filters: [
|
|
46
|
+
* {
|
|
47
|
+
* fieldId: 'fld-1',
|
|
48
|
+
* operator: univerAPI.Enum.BaseFilterOperator.Equals,
|
|
49
|
+
* value: 'John Doe',
|
|
50
|
+
* },
|
|
51
|
+
* ],
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
BaseFilterOperator: typeof BaseFilterOperator;
|
|
56
|
+
/**
|
|
57
|
+
* Base field key enumeration.
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const fBase = univerAPI.getActiveBase();
|
|
61
|
+
* const fBaseTable = fBase.getTableById('table-1');
|
|
62
|
+
* const record = fBaseTable.addRecord(
|
|
63
|
+
* {
|
|
64
|
+
* Title: 'Ship beta',
|
|
65
|
+
* Status: 'todo'
|
|
66
|
+
* },
|
|
67
|
+
* univerAPI.Enum.BaseFieldKeyEnum.Name
|
|
68
|
+
* );
|
|
69
|
+
* console.log(record);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
88
72
|
BaseFieldKeyEnum: typeof BaseFieldKeyEnum;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Base view types.
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const fBase = univerAPI.getActiveBase();
|
|
78
|
+
* const fBaseTable = fBase.getTableById('table-1');
|
|
79
|
+
* const view = fBaseTable.createView(
|
|
80
|
+
* 'API Grid',
|
|
81
|
+
* univerAPI.Enum.BaseViewType.Grid,
|
|
82
|
+
* {
|
|
83
|
+
* view: {
|
|
84
|
+
* id: 'grid-api',
|
|
85
|
+
* config: {
|
|
86
|
+
* frozenFieldCount: 1
|
|
87
|
+
* },
|
|
88
|
+
* },
|
|
89
|
+
* }
|
|
90
|
+
* );
|
|
91
|
+
* console.log(view);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
BaseViewType: typeof BaseViewType;
|
|
95
|
+
/**
|
|
96
|
+
* Base sort directions.
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const fBase = univerAPI.getActiveBase();
|
|
100
|
+
* const fBaseTable = fBase.getTableById('table-1');
|
|
101
|
+
* const view = fBaseTable.getViewByName('Grid');
|
|
102
|
+
* const success = view.setSort([
|
|
103
|
+
* {
|
|
104
|
+
* fieldId: 'priority',
|
|
105
|
+
* direction: univerAPI.Enum.BaseSortDirection.ASC
|
|
106
|
+
* }
|
|
107
|
+
* ]);
|
|
108
|
+
* console.log(success ? 'Sort set' : 'Set sort failed');
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
BaseSortDirection: typeof BaseSortDirection;
|
|
112
|
+
}
|
|
113
|
+
export declare class FBaseEnumMixin extends FEnum implements IFBaseEnumMixin {
|
|
114
|
+
get BaseFieldType(): typeof BaseFieldType;
|
|
115
|
+
get BaseFilterConjunction(): typeof BaseFilterConjunction;
|
|
116
|
+
get BaseFilterOperator(): typeof BaseFilterOperator;
|
|
117
|
+
get BaseFieldKeyEnum(): typeof BaseFieldKeyEnum;
|
|
118
|
+
get BaseViewType(): typeof BaseViewType;
|
|
119
|
+
get BaseSortDirection(): typeof BaseSortDirection;
|
|
92
120
|
}
|
|
93
121
|
declare module '@univerjs/core/facade' {
|
|
94
122
|
interface FEnum extends IFBaseEnumMixin {
|
|
@@ -1,149 +1,272 @@
|
|
|
1
|
-
|
|
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 { BaseCellValue, IFieldSnapshot, IRecordSnapshot, ITableSnapshot, IViewSnapshot } from '@univerjs/core';
|
|
2
17
|
import type { IEventBase } from '@univerjs/core/facade';
|
|
3
18
|
import type { FBase } from './f-base';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly BeforeBaseCellValueChange: "BeforeBaseCellValueChange";
|
|
16
|
-
readonly BeforeBaseViewCreate: "BeforeBaseViewCreate";
|
|
17
|
-
readonly BaseTableChanged: "BaseTableChanged";
|
|
18
|
-
readonly BaseFieldChanged: "BaseFieldChanged";
|
|
19
|
-
readonly BaseRecordChanged: "BaseRecordChanged";
|
|
20
|
-
readonly BaseCellValueChanged: "BaseCellValueChanged";
|
|
21
|
-
readonly BaseViewChanged: "BaseViewChanged";
|
|
22
|
-
readonly BaseBatchChanged: "BaseBatchChanged";
|
|
23
|
-
readonly TableChanged: "TableChanged";
|
|
24
|
-
readonly FieldChanged: "FieldChanged";
|
|
25
|
-
readonly RecordChanged: "RecordChanged";
|
|
26
|
-
readonly CellValueChanged: "CellValueChanged";
|
|
27
|
-
readonly ViewChanged: "ViewChanged";
|
|
28
|
-
};
|
|
29
|
-
export type BaseEventName = typeof BaseEventName[keyof typeof BaseEventName];
|
|
30
|
-
export interface IBaseLifecycleEvent extends IEventBase {
|
|
31
|
-
base: FBase | null;
|
|
32
|
-
baseId: string;
|
|
33
|
-
snapshot?: Partial<IBaseSnapshot>;
|
|
19
|
+
import type { FBaseTableField } from './f-field';
|
|
20
|
+
import type { FBaseTableRecord } from './f-record';
|
|
21
|
+
import type { FBaseTable } from './f-table';
|
|
22
|
+
import { FEventName } from '@univerjs/core/facade';
|
|
23
|
+
/**
|
|
24
|
+
* Interface for base table creation event parameters
|
|
25
|
+
*/
|
|
26
|
+
export interface IBaseTableCreatedEventParams extends IEventBase {
|
|
27
|
+
base: FBase;
|
|
28
|
+
table?: ITableSnapshot;
|
|
29
|
+
index?: number;
|
|
34
30
|
}
|
|
35
|
-
export interface
|
|
36
|
-
type: 'created' | 'renamed' | 'deleted';
|
|
37
|
-
table: FTable | null;
|
|
38
|
-
tableId: string;
|
|
39
|
-
payload: Readonly<ICommandInfo>;
|
|
31
|
+
export interface IBeforeBaseTableCreateEventParams extends IBaseTableCreatedEventParams, IEventBase {
|
|
40
32
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Interface for base table field creation event parameters
|
|
35
|
+
*/
|
|
36
|
+
export interface IBaseTableFieldCreatedEventParams extends IEventBase {
|
|
37
|
+
base: FBase;
|
|
38
|
+
table: FBaseTable;
|
|
39
|
+
field: IFieldSnapshot;
|
|
40
|
+
index?: number;
|
|
41
|
+
viewIndexes?: Record<string, number>;
|
|
48
42
|
}
|
|
49
|
-
export interface
|
|
50
|
-
type: 'created' | 'updated' | 'deleted' | 'duplicated' | 'moved';
|
|
51
|
-
table: FTable;
|
|
52
|
-
records: FRecord[];
|
|
53
|
-
tableId: string;
|
|
54
|
-
recordIds: string[];
|
|
55
|
-
payload: Readonly<ICommandInfo>;
|
|
43
|
+
export interface IBeforeBaseTableFieldCreateEventParams extends IBaseTableFieldCreatedEventParams, IEventBase {
|
|
56
44
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}>;
|
|
65
|
-
payload: Readonly<ICommandInfo>;
|
|
45
|
+
/**
|
|
46
|
+
* Interface for base table record creation event parameters
|
|
47
|
+
*/
|
|
48
|
+
export interface IBaseTableRecordCreatedEventParams extends IEventBase {
|
|
49
|
+
base: FBase;
|
|
50
|
+
table: FBaseTable;
|
|
51
|
+
records: IRecordSnapshot[];
|
|
66
52
|
}
|
|
67
|
-
export interface
|
|
68
|
-
type: 'created' | 'updated' | 'renamed' | 'deleted' | 'moved';
|
|
69
|
-
table: FTable;
|
|
70
|
-
view: FView | null;
|
|
71
|
-
tableId: string;
|
|
72
|
-
viewId: string;
|
|
73
|
-
payload: Readonly<ICommandInfo>;
|
|
53
|
+
export interface IBeforeBaseTableRecordCreateEventParams extends IBaseTableRecordCreatedEventParams, IEventBase {
|
|
74
54
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
[BaseEventName.BeforeBaseViewCreate]: IBaseViewChangedEvent;
|
|
84
|
-
[BaseEventName.BaseTableChanged]: IBaseTableChangedEvent;
|
|
85
|
-
[BaseEventName.BaseFieldChanged]: IBaseFieldChangedEvent;
|
|
86
|
-
[BaseEventName.BaseRecordChanged]: IBaseRecordChangedEvent;
|
|
87
|
-
[BaseEventName.BaseCellValueChanged]: IBaseCellValueChangedEvent;
|
|
88
|
-
[BaseEventName.BaseViewChanged]: IBaseViewChangedEvent;
|
|
89
|
-
[BaseEventName.BaseBatchChanged]: IBaseBatchChangedEvent;
|
|
90
|
-
[BaseEventName.TableChanged]: IBaseTableChangedEvent;
|
|
91
|
-
[BaseEventName.FieldChanged]: IBaseFieldChangedEvent;
|
|
92
|
-
[BaseEventName.RecordChanged]: IBaseRecordChangedEvent;
|
|
93
|
-
[BaseEventName.CellValueChanged]: IBaseCellValueChangedEvent;
|
|
94
|
-
[BaseEventName.ViewChanged]: IBaseViewChangedEvent;
|
|
55
|
+
/**
|
|
56
|
+
* Interface for base table view creation event parameters
|
|
57
|
+
*/
|
|
58
|
+
export interface IBaseTableViewCreatedEventParams extends IEventBase {
|
|
59
|
+
base: FBase;
|
|
60
|
+
table: FBaseTable;
|
|
61
|
+
view: IViewSnapshot;
|
|
62
|
+
index?: number;
|
|
95
63
|
}
|
|
96
|
-
export
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
64
|
+
export interface IBeforeBaseTableViewCreateEventParams extends IBaseTableViewCreatedEventParams, IEventBase {
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Interface for base table cell value change event parameters
|
|
68
|
+
*/
|
|
69
|
+
export interface IBaseTableCellValueChangedEventParams extends IEventBase {
|
|
70
|
+
base: FBase;
|
|
71
|
+
table: FBaseTable;
|
|
72
|
+
field: FBaseTableField;
|
|
73
|
+
record: FBaseTableRecord;
|
|
74
|
+
value: BaseCellValue;
|
|
75
|
+
}
|
|
76
|
+
export interface IBeforeBaseTableCellValueChangeEventParams extends IBaseTableCellValueChangedEventParams, IEventBase {
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Interface for base-related events
|
|
80
|
+
* @ignore
|
|
81
|
+
*/
|
|
82
|
+
export interface IFBasesEventNameMixin {
|
|
83
|
+
/**
|
|
84
|
+
* Event fired after a base table is created
|
|
85
|
+
* @see {@link IBaseTableCreatedEventParams}
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableCreated, (params) => {
|
|
89
|
+
* const { base, table } = params;
|
|
90
|
+
* console.log('base table created', params);
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
readonly BaseTableCreated: 'BaseTableCreated';
|
|
97
|
+
/**
|
|
98
|
+
* Event fired before a base table is created
|
|
99
|
+
* @see {@link IBeforeBaseTableCreateEventParams}
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableCreate, (params) => {
|
|
103
|
+
* const { base, table } = params;
|
|
104
|
+
* console.log('before base create', params);
|
|
105
|
+
*
|
|
106
|
+
* // Cancel the base creation operation
|
|
107
|
+
* params.cancel = true;
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
101
113
|
readonly BeforeBaseTableCreate: 'BeforeBaseTableCreate';
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
readonly
|
|
116
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Event fired after a base table field is created
|
|
116
|
+
* @see {@link IBaseTableFieldCreatedEventParams}
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableFieldCreated, (params) => {
|
|
120
|
+
* const { base, table, field } = params;
|
|
121
|
+
* console.log('base table field created', params);
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
readonly BaseTableFieldCreated: 'BaseTableFieldCreated';
|
|
128
|
+
/**
|
|
129
|
+
* Event fired before a base table field is created
|
|
130
|
+
* @see {@link IBeforeBaseTableFieldCreateEventParams}
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableFieldCreate, (params) => {
|
|
134
|
+
* const { base, table, field } = params;
|
|
135
|
+
* console.log('before base table field create', params);
|
|
136
|
+
*
|
|
137
|
+
* // Cancel the base table field creation operation
|
|
138
|
+
* params.cancel = true;
|
|
139
|
+
* });
|
|
140
|
+
*
|
|
141
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
readonly BeforeBaseTableFieldCreate: 'BeforeBaseTableFieldCreate';
|
|
145
|
+
/**
|
|
146
|
+
* Event fired after a base table record is created
|
|
147
|
+
* @see {@link IBaseTableRecordCreatedEventParams}
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableRecordCreated, (params) => {
|
|
151
|
+
* const { base, table, records } = params;
|
|
152
|
+
* console.log('base table record created', params);
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
readonly BaseTableRecordCreated: 'BaseTableRecordCreated';
|
|
159
|
+
/**
|
|
160
|
+
* Event fired before a base table record is created
|
|
161
|
+
* @see {@link IBeforeBaseTableRecordCreateEventParams}
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableRecordCreate, (params) => {
|
|
165
|
+
* const { base, table, records } = params;
|
|
166
|
+
* console.log('before base table record create', params);
|
|
167
|
+
*
|
|
168
|
+
* // Cancel the base table record creation operation
|
|
169
|
+
* params.cancel = true;
|
|
170
|
+
* });
|
|
171
|
+
*
|
|
172
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
readonly BeforeBaseTableRecordCreate: 'BeforeBaseTableRecordCreate';
|
|
176
|
+
/**
|
|
177
|
+
* Event fired after a base table view is created
|
|
178
|
+
* @see {@link IBaseTableViewCreatedEventParams}
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableViewCreated, (params) => {
|
|
182
|
+
* const { base, table, view } = params;
|
|
183
|
+
* console.log('base table view created', params);
|
|
184
|
+
* });
|
|
185
|
+
*
|
|
186
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
readonly BaseTableViewCreated: 'BaseTableViewCreated';
|
|
190
|
+
/**
|
|
191
|
+
* Event fired before a base table view is created
|
|
192
|
+
* @see {@link IBeforeBaseTableViewCreateEventParams}
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableViewCreate, (params) => {
|
|
196
|
+
* const { base, table, view } = params;
|
|
197
|
+
* console.log('before base table view create', params);
|
|
198
|
+
*
|
|
199
|
+
* // Cancel the base table view creation operation
|
|
200
|
+
* params.cancel = true;
|
|
201
|
+
* });
|
|
202
|
+
*
|
|
203
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
readonly BeforeBaseTableViewCreate: 'BeforeBaseTableViewCreate';
|
|
207
|
+
/**
|
|
208
|
+
* Event fired after a base table cell value is changed
|
|
209
|
+
* @see {@link IBaseTableCellValueChangedEventParams}
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableCellValueChanged, (params) => {
|
|
213
|
+
* const { base, table, field, record, value } = params;
|
|
214
|
+
* console.log('base table cell value changed', params);
|
|
215
|
+
* });
|
|
216
|
+
*
|
|
217
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
readonly BaseTableCellValueChanged: 'BaseTableCellValueChanged';
|
|
221
|
+
/**
|
|
222
|
+
* Event fired before a base table cell value is changed
|
|
223
|
+
* @see {@link IBeforeBaseTableCellValueChangeEventParams}
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableCellValueChange, (params) => {
|
|
227
|
+
* const { base, table, field, record, value } = params;
|
|
228
|
+
* console.log('before base table cell value change', params);
|
|
229
|
+
*
|
|
230
|
+
* // Cancel the base table cell value change operation
|
|
231
|
+
* params.cancel = true;
|
|
232
|
+
* });
|
|
233
|
+
*
|
|
234
|
+
* // Remove the event listener, use `disposable.dispose()`
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
readonly BeforeBaseTableCellValueChange: 'BeforeBaseTableCellValueChange';
|
|
117
238
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Configuration interface for base-related events
|
|
241
|
+
* @ignore
|
|
242
|
+
*/
|
|
243
|
+
export interface IBasesEventParamConfig {
|
|
244
|
+
BaseTableCreated: IBaseTableCreatedEventParams;
|
|
245
|
+
BeforeBaseTableCreate: IBeforeBaseTableCreateEventParams;
|
|
246
|
+
BaseTableFieldCreated: IBaseTableFieldCreatedEventParams;
|
|
247
|
+
BeforeBaseTableFieldCreate: IBeforeBaseTableFieldCreateEventParams;
|
|
248
|
+
BaseTableRecordCreated: IBaseTableRecordCreatedEventParams;
|
|
249
|
+
BeforeBaseTableRecordCreate: IBeforeBaseTableRecordCreateEventParams;
|
|
250
|
+
BaseTableViewCreated: IBaseTableViewCreatedEventParams;
|
|
251
|
+
BeforeBaseTableViewCreate: IBeforeBaseTableViewCreateEventParams;
|
|
252
|
+
BaseTableCellValueChanged: IBaseTableCellValueChangedEventParams;
|
|
253
|
+
BeforeBaseTableCellValueChange: IBeforeBaseTableCellValueChangeEventParams;
|
|
122
254
|
}
|
|
123
|
-
export
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
BaseRecordChanged: IBaseRecordChangedEvent;
|
|
135
|
-
BaseCellValueChanged: IBaseCellValueChangedEvent;
|
|
136
|
-
BaseViewChanged: IBaseViewChangedEvent;
|
|
137
|
-
BaseBatchChanged: IBaseBatchChangedEvent;
|
|
138
|
-
TableChanged: IBaseTableChangedEvent;
|
|
139
|
-
FieldChanged: IBaseFieldChangedEvent;
|
|
140
|
-
RecordChanged: IBaseRecordChangedEvent;
|
|
141
|
-
CellValueChanged: IBaseCellValueChangedEvent;
|
|
142
|
-
ViewChanged: IBaseViewChangedEvent;
|
|
255
|
+
export declare class FBasesEventNameMixin extends FEventName implements IFBasesEventNameMixin {
|
|
256
|
+
get BaseTableCreated(): 'BaseTableCreated';
|
|
257
|
+
get BeforeBaseTableCreate(): 'BeforeBaseTableCreate';
|
|
258
|
+
get BaseTableFieldCreated(): 'BaseTableFieldCreated';
|
|
259
|
+
get BeforeBaseTableFieldCreate(): 'BeforeBaseTableFieldCreate';
|
|
260
|
+
get BaseTableRecordCreated(): 'BaseTableRecordCreated';
|
|
261
|
+
get BeforeBaseTableRecordCreate(): 'BeforeBaseTableRecordCreate';
|
|
262
|
+
get BaseTableViewCreated(): 'BaseTableViewCreated';
|
|
263
|
+
get BeforeBaseTableViewCreate(): 'BeforeBaseTableViewCreate';
|
|
264
|
+
get BaseTableCellValueChanged(): 'BaseTableCellValueChanged';
|
|
265
|
+
get BeforeBaseTableCellValueChange(): 'BeforeBaseTableCellValueChange';
|
|
143
266
|
}
|
|
144
267
|
declare module '@univerjs/core/facade' {
|
|
145
|
-
interface FEventName extends
|
|
268
|
+
interface FEventName extends IFBasesEventNameMixin {
|
|
146
269
|
}
|
|
147
|
-
interface IEventParamConfig extends
|
|
270
|
+
interface IEventParamConfig extends IBasesEventParamConfig {
|
|
148
271
|
}
|
|
149
272
|
}
|