@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.
Files changed (127) hide show
  1. package/README.md +8 -5
  2. package/lib/cjs/facade.js +1 -1
  3. package/lib/cjs/index.js +1 -1
  4. package/lib/cjs/locale/ar-SA.js +1 -1
  5. package/lib/cjs/locale/ca-ES.js +1 -1
  6. package/lib/cjs/locale/de-DE.js +1 -1
  7. package/lib/cjs/locale/en-US.js +1 -1
  8. package/lib/cjs/locale/es-ES.js +1 -1
  9. package/lib/cjs/locale/fa-IR.js +1 -1
  10. package/lib/cjs/locale/fr-FR.js +1 -1
  11. package/lib/cjs/locale/id-ID.js +1 -1
  12. package/lib/cjs/locale/it-IT.js +1 -1
  13. package/lib/cjs/locale/ja-JP.js +1 -1
  14. package/lib/cjs/locale/ko-KR.js +1 -1
  15. package/lib/cjs/locale/pl-PL.js +1 -1
  16. package/lib/cjs/locale/pt-BR.js +1 -1
  17. package/lib/cjs/locale/ru-RU.js +1 -1
  18. package/lib/cjs/locale/sk-SK.js +1 -1
  19. package/lib/cjs/locale/vi-VN.js +1 -1
  20. package/lib/cjs/locale/zh-CN.js +1 -1
  21. package/lib/cjs/locale/zh-HK.js +1 -1
  22. package/lib/cjs/locale/zh-TW.js +1 -1
  23. package/lib/es/facade.js +1 -1
  24. package/lib/es/index.js +1 -1
  25. package/lib/es/locale/ar-SA.js +1 -1
  26. package/lib/es/locale/ca-ES.js +1 -1
  27. package/lib/es/locale/de-DE.js +1 -1
  28. package/lib/es/locale/en-US.js +1 -1
  29. package/lib/es/locale/es-ES.js +1 -1
  30. package/lib/es/locale/fa-IR.js +1 -1
  31. package/lib/es/locale/fr-FR.js +1 -1
  32. package/lib/es/locale/id-ID.js +1 -1
  33. package/lib/es/locale/it-IT.js +1 -1
  34. package/lib/es/locale/ja-JP.js +1 -1
  35. package/lib/es/locale/ko-KR.js +1 -1
  36. package/lib/es/locale/pl-PL.js +1 -1
  37. package/lib/es/locale/pt-BR.js +1 -1
  38. package/lib/es/locale/ru-RU.js +1 -1
  39. package/lib/es/locale/sk-SK.js +1 -1
  40. package/lib/es/locale/vi-VN.js +1 -1
  41. package/lib/es/locale/zh-CN.js +1 -1
  42. package/lib/es/locale/zh-HK.js +1 -1
  43. package/lib/es/locale/zh-TW.js +1 -1
  44. package/lib/facade.js +1 -1
  45. package/lib/index.js +1 -1
  46. package/lib/locale/ar-SA.js +1 -1
  47. package/lib/locale/ca-ES.js +1 -1
  48. package/lib/locale/de-DE.js +1 -1
  49. package/lib/locale/en-US.js +1 -1
  50. package/lib/locale/es-ES.js +1 -1
  51. package/lib/locale/fa-IR.js +1 -1
  52. package/lib/locale/fr-FR.js +1 -1
  53. package/lib/locale/id-ID.js +1 -1
  54. package/lib/locale/it-IT.js +1 -1
  55. package/lib/locale/ja-JP.js +1 -1
  56. package/lib/locale/ko-KR.js +1 -1
  57. package/lib/locale/pl-PL.js +1 -1
  58. package/lib/locale/pt-BR.js +1 -1
  59. package/lib/locale/ru-RU.js +1 -1
  60. package/lib/locale/sk-SK.js +1 -1
  61. package/lib/locale/vi-VN.js +1 -1
  62. package/lib/locale/zh-CN.js +1 -1
  63. package/lib/locale/zh-HK.js +1 -1
  64. package/lib/locale/zh-TW.js +1 -1
  65. package/lib/types/commands/commands/set-base-view-filter.command.d.ts +2 -2
  66. package/lib/types/commands/commands/set-base-view-group.command.d.ts +2 -2
  67. package/lib/types/commands/commands/set-base-view-sort.command.d.ts +2 -2
  68. package/lib/types/commands/utils/base-validation.d.ts +6 -0
  69. package/lib/types/config/config.d.ts +11 -0
  70. package/lib/types/controllers/base-active-dirty.controller.d.ts +5 -6
  71. package/lib/types/controllers/base-formula-calculation.controller.d.ts +8 -14
  72. package/lib/types/embed-host-anchor.d.ts +46 -0
  73. package/lib/types/facade/f-base.d.ts +126 -577
  74. package/lib/types/facade/f-enum.d.ts +117 -89
  75. package/lib/types/facade/f-event.d.ts +255 -132
  76. package/lib/types/facade/f-field.d.ts +137 -313
  77. package/lib/types/facade/f-range.d.ts +86 -326
  78. package/lib/types/facade/f-record.d.ts +93 -216
  79. package/lib/types/facade/f-table.d.ts +473 -1317
  80. package/lib/types/facade/f-types.d.ts +1 -0
  81. package/lib/types/facade/f-univer.d.ts +27 -154
  82. package/lib/types/facade/f-view.d.ts +207 -484
  83. package/lib/types/facade/field-key.d.ts +6 -6
  84. package/lib/types/facade/index.d.ts +11 -14
  85. package/lib/types/fields/field-core-plugin.d.ts +9 -8
  86. package/lib/types/index.d.ts +17 -47
  87. package/lib/types/models/base-cell-data.d.ts +6 -6
  88. package/lib/types/models/default-table.d.ts +13 -0
  89. package/lib/types/ot/json1-adapter.d.ts +3 -3
  90. package/lib/types/ot/json1-invalidation.d.ts +2 -2
  91. package/lib/types/ot/json1-op-applier.d.ts +2 -2
  92. package/lib/types/ot/json1-op-factory.d.ts +9 -8
  93. package/lib/types/plugin.d.ts +6 -4
  94. package/lib/types/search/base-search.d.ts +4 -3
  95. package/lib/types/services/base-active-dirty.service.d.ts +2 -2
  96. package/lib/types/services/base-command.service.d.ts +16 -16
  97. package/lib/types/services/base-compression.service.d.ts +3 -3
  98. package/lib/types/services/base-field-registry.service.d.ts +5 -5
  99. package/lib/types/services/base-formula.service.d.ts +11 -20
  100. package/lib/types/services/base-view-registry.service.d.ts +3 -3
  101. package/lib/types/views/view-core-plugin.d.ts +4 -3
  102. package/lib/umd/facade.js +1 -1
  103. package/lib/umd/index.js +1 -1
  104. package/lib/umd/locale/ar-SA.js +1 -1
  105. package/lib/umd/locale/ca-ES.js +1 -1
  106. package/lib/umd/locale/de-DE.js +1 -1
  107. package/lib/umd/locale/en-US.js +1 -1
  108. package/lib/umd/locale/es-ES.js +1 -1
  109. package/lib/umd/locale/fa-IR.js +1 -1
  110. package/lib/umd/locale/fr-FR.js +1 -1
  111. package/lib/umd/locale/id-ID.js +1 -1
  112. package/lib/umd/locale/it-IT.js +1 -1
  113. package/lib/umd/locale/ja-JP.js +1 -1
  114. package/lib/umd/locale/ko-KR.js +1 -1
  115. package/lib/umd/locale/pl-PL.js +1 -1
  116. package/lib/umd/locale/pt-BR.js +1 -1
  117. package/lib/umd/locale/ru-RU.js +1 -1
  118. package/lib/umd/locale/sk-SK.js +1 -1
  119. package/lib/umd/locale/vi-VN.js +1 -1
  120. package/lib/umd/locale/zh-CN.js +1 -1
  121. package/lib/umd/locale/zh-HK.js +1 -1
  122. package/lib/umd/locale/zh-TW.js +1 -1
  123. package/package.json +7 -8
  124. package/lib/types/controllers/base-remote-formula.controller.d.ts +0 -13
  125. package/lib/types/facade/f-error.d.ts +0 -30
  126. package/lib/types/facade/f-permission.d.ts +0 -749
  127. package/lib/types/facade/transaction.d.ts +0 -19
@@ -1,94 +1,122 @@
1
- export declare const BaseFieldTypeEnum: {
2
- readonly Text: "text";
3
- readonly SingleSelect: "singleSelect";
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
- BaseFieldTypeEnum: typeof BaseFieldTypeEnum;
85
- BaseViewTypeEnum: typeof BaseViewTypeEnum;
86
- BaseFilterOperatorEnum: typeof BaseFilterOperatorEnum;
87
- BaseSortDirectionEnum: typeof BaseSortDirectionEnum;
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
- BaseBatchEventModeEnum: typeof BaseBatchEventModeEnum;
90
- BaseBatchUndoModeEnum: typeof BaseBatchUndoModeEnum;
91
- BaseErrorCodeEnum: typeof BaseErrorCodeEnum;
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
- import type { BaseCellValue, IBaseSnapshot, ICommandInfo } from '@univerjs/core';
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 { FField } from './f-field';
5
- import type { FRecord } from './f-record';
6
- import type { FTable } from './f-table';
7
- import type { FView } from './f-view';
8
- export declare const BaseEventName: {
9
- readonly BaseCreating: "BaseCreating";
10
- readonly BaseCreated: "BaseCreated";
11
- readonly BaseReady: "BaseReady";
12
- readonly BeforeBaseTableCreate: "BeforeBaseTableCreate";
13
- readonly BeforeBaseFieldCreate: "BeforeBaseFieldCreate";
14
- readonly BeforeBaseRecordCreate: "BeforeBaseRecordCreate";
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 IBaseTableChangedEvent extends IEventBase {
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
- export interface IBaseFieldChangedEvent extends IEventBase {
42
- type: 'created' | 'updated' | 'typeChanged' | 'deleted' | 'moved';
43
- table: FTable;
44
- field: FField | null;
45
- tableId: string;
46
- fieldId: string;
47
- payload: Readonly<ICommandInfo>;
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 IBaseRecordChangedEvent extends IEventBase {
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
- export interface IBaseCellValueChangedEvent extends IEventBase {
58
- table: FTable;
59
- tableId: string;
60
- changes: Array<{
61
- recordId: string;
62
- fieldId: string;
63
- value: BaseCellValue;
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 IBaseViewChangedEvent extends IEventBase {
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
- export interface IBaseEventMap {
76
- [BaseEventName.BaseCreating]: IBaseLifecycleEvent;
77
- [BaseEventName.BaseCreated]: IBaseLifecycleEvent;
78
- [BaseEventName.BaseReady]: IBaseLifecycleEvent;
79
- [BaseEventName.BeforeBaseTableCreate]: IBaseTableChangedEvent;
80
- [BaseEventName.BeforeBaseFieldCreate]: IBaseFieldChangedEvent;
81
- [BaseEventName.BeforeBaseRecordCreate]: IBaseRecordChangedEvent;
82
- [BaseEventName.BeforeBaseCellValueChange]: IBaseCellValueChangedEvent;
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 type BaseEventMap = IBaseEventMap;
97
- export interface IFBaseEventNameMixin {
98
- readonly BaseCreating: 'BaseCreating';
99
- readonly BaseCreated: 'BaseCreated';
100
- readonly BaseReady: 'BaseReady';
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
- readonly BeforeBaseFieldCreate: 'BeforeBaseFieldCreate';
103
- readonly BeforeBaseRecordCreate: 'BeforeBaseRecordCreate';
104
- readonly BeforeBaseCellValueChange: 'BeforeBaseCellValueChange';
105
- readonly BeforeBaseViewCreate: 'BeforeBaseViewCreate';
106
- readonly BaseTableChanged: 'BaseTableChanged';
107
- readonly BaseFieldChanged: 'BaseFieldChanged';
108
- readonly BaseRecordChanged: 'BaseRecordChanged';
109
- readonly BaseCellValueChanged: 'BaseCellValueChanged';
110
- readonly BaseViewChanged: 'BaseViewChanged';
111
- readonly BaseBatchChanged: 'BaseBatchChanged';
112
- readonly TableChanged: 'TableChanged';
113
- readonly FieldChanged: 'FieldChanged';
114
- readonly RecordChanged: 'RecordChanged';
115
- readonly CellValueChanged: 'CellValueChanged';
116
- readonly ViewChanged: 'ViewChanged';
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
- export interface IBaseBatchChangedEvent extends IEventBase {
119
- base: FBase | null;
120
- baseId: string;
121
- payload: Readonly<ICommandInfo>;
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 interface IBaseFacadeEventParamConfig {
124
- BaseCreating: IBaseLifecycleEvent;
125
- BaseCreated: IBaseLifecycleEvent;
126
- BaseReady: IBaseLifecycleEvent;
127
- BeforeBaseTableCreate: IBaseTableChangedEvent;
128
- BeforeBaseFieldCreate: IBaseFieldChangedEvent;
129
- BeforeBaseRecordCreate: IBaseRecordChangedEvent;
130
- BeforeBaseCellValueChange: IBaseCellValueChangedEvent;
131
- BeforeBaseViewCreate: IBaseViewChangedEvent;
132
- BaseTableChanged: IBaseTableChangedEvent;
133
- BaseFieldChanged: IBaseFieldChangedEvent;
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 IFBaseEventNameMixin {
268
+ interface FEventName extends IFBasesEventNameMixin {
146
269
  }
147
- interface IEventParamConfig extends IBaseFacadeEventParamConfig {
270
+ interface IEventParamConfig extends IBasesEventParamConfig {
148
271
  }
149
272
  }