@univerjs-pro/bases 1.0.0-alpha.2 → 1.0.0-alpha.4

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 (128) 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-name.command.d.ts +6 -0
  66. package/lib/types/commands/commands/set-base-view-filter.command.d.ts +2 -2
  67. package/lib/types/commands/commands/set-base-view-group.command.d.ts +2 -2
  68. package/lib/types/commands/commands/set-base-view-sort.command.d.ts +2 -2
  69. package/lib/types/commands/utils/base-validation.d.ts +6 -0
  70. package/lib/types/config/config.d.ts +1 -0
  71. package/lib/types/controllers/base-active-dirty.controller.d.ts +5 -6
  72. package/lib/types/controllers/base-formula-calculation.controller.d.ts +8 -14
  73. package/lib/types/embed-host-anchor.d.ts +46 -0
  74. package/lib/types/facade/f-base.d.ts +126 -577
  75. package/lib/types/facade/f-enum.d.ts +117 -89
  76. package/lib/types/facade/f-event.d.ts +240 -132
  77. package/lib/types/facade/f-field.d.ts +137 -313
  78. package/lib/types/facade/f-range.d.ts +86 -326
  79. package/lib/types/facade/f-record.d.ts +93 -216
  80. package/lib/types/facade/f-table.d.ts +473 -1317
  81. package/lib/types/facade/f-types.d.ts +1 -0
  82. package/lib/types/facade/f-univer.d.ts +27 -154
  83. package/lib/types/facade/f-view.d.ts +207 -484
  84. package/lib/types/facade/field-key.d.ts +6 -6
  85. package/lib/types/facade/index.d.ts +10 -20
  86. package/lib/types/fields/field-core-plugin.d.ts +9 -8
  87. package/lib/types/index.d.ts +12 -8
  88. package/lib/types/models/base-cell-data.d.ts +6 -6
  89. package/lib/types/models/default-table.d.ts +13 -0
  90. package/lib/types/ot/json1-adapter.d.ts +3 -3
  91. package/lib/types/ot/json1-invalidation.d.ts +2 -2
  92. package/lib/types/ot/json1-op-applier.d.ts +2 -2
  93. package/lib/types/ot/json1-op-factory.d.ts +11 -8
  94. package/lib/types/plugin.d.ts +0 -1
  95. package/lib/types/search/base-search.d.ts +4 -3
  96. package/lib/types/services/base-active-dirty.service.d.ts +2 -2
  97. package/lib/types/services/base-command.service.d.ts +16 -16
  98. package/lib/types/services/base-compression.service.d.ts +3 -3
  99. package/lib/types/services/base-field-registry.service.d.ts +5 -5
  100. package/lib/types/services/base-formula.service.d.ts +11 -23
  101. package/lib/types/services/base-view-registry.service.d.ts +3 -3
  102. package/lib/types/views/view-core-plugin.d.ts +4 -3
  103. package/lib/umd/facade.js +1 -1
  104. package/lib/umd/index.js +1 -1
  105. package/lib/umd/locale/ar-SA.js +1 -1
  106. package/lib/umd/locale/ca-ES.js +1 -1
  107. package/lib/umd/locale/de-DE.js +1 -1
  108. package/lib/umd/locale/en-US.js +1 -1
  109. package/lib/umd/locale/es-ES.js +1 -1
  110. package/lib/umd/locale/fa-IR.js +1 -1
  111. package/lib/umd/locale/fr-FR.js +1 -1
  112. package/lib/umd/locale/id-ID.js +1 -1
  113. package/lib/umd/locale/it-IT.js +1 -1
  114. package/lib/umd/locale/ja-JP.js +1 -1
  115. package/lib/umd/locale/ko-KR.js +1 -1
  116. package/lib/umd/locale/pl-PL.js +1 -1
  117. package/lib/umd/locale/pt-BR.js +1 -1
  118. package/lib/umd/locale/ru-RU.js +1 -1
  119. package/lib/umd/locale/sk-SK.js +1 -1
  120. package/lib/umd/locale/vi-VN.js +1 -1
  121. package/lib/umd/locale/zh-CN.js +1 -1
  122. package/lib/umd/locale/zh-HK.js +1 -1
  123. package/lib/umd/locale/zh-TW.js +1 -1
  124. package/package.json +7 -8
  125. package/lib/types/controllers/base-remote-formula.controller.d.ts +0 -13
  126. package/lib/types/facade/f-error.d.ts +0 -30
  127. package/lib/types/facade/f-permission.d.ts +0 -749
  128. 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,257 @@
1
- import type { BaseCellValue, IBaseSnapshot, ICommandInfo } from '@univerjs/core';
1
+ import type { BaseCellValue, IFieldSnapshot, IRecordSnapshot, ITableSnapshot, IViewSnapshot } from '@univerjs/core';
2
2
  import type { IEventBase } from '@univerjs/core/facade';
3
3
  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>;
4
+ import type { FBaseTableField } from './f-field';
5
+ import type { FBaseTableRecord } from './f-record';
6
+ import type { FBaseTable } from './f-table';
7
+ import { FEventName } from '@univerjs/core/facade';
8
+ /**
9
+ * Interface for base table creation event parameters
10
+ */
11
+ export interface IBaseTableCreatedEventParams extends IEventBase {
12
+ base: FBase;
13
+ table?: ITableSnapshot;
14
+ index?: number;
34
15
  }
35
- export interface IBaseTableChangedEvent extends IEventBase {
36
- type: 'created' | 'renamed' | 'deleted';
37
- table: FTable | null;
38
- tableId: string;
39
- payload: Readonly<ICommandInfo>;
16
+ export interface IBeforeBaseTableCreateEventParams extends IBaseTableCreatedEventParams, IEventBase {
40
17
  }
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>;
18
+ /**
19
+ * Interface for base table field creation event parameters
20
+ */
21
+ export interface IBaseTableFieldCreatedEventParams extends IEventBase {
22
+ base: FBase;
23
+ table: FBaseTable;
24
+ field: IFieldSnapshot;
25
+ index?: number;
26
+ viewIndexes?: Record<string, number>;
48
27
  }
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>;
28
+ export interface IBeforeBaseTableFieldCreateEventParams extends IBaseTableFieldCreatedEventParams, IEventBase {
56
29
  }
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>;
30
+ /**
31
+ * Interface for base table record creation event parameters
32
+ */
33
+ export interface IBaseTableRecordCreatedEventParams extends IEventBase {
34
+ base: FBase;
35
+ table: FBaseTable;
36
+ records: IRecordSnapshot[];
66
37
  }
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>;
38
+ export interface IBeforeBaseTableRecordCreateEventParams extends IBaseTableRecordCreatedEventParams, IEventBase {
74
39
  }
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;
40
+ /**
41
+ * Interface for base table view creation event parameters
42
+ */
43
+ export interface IBaseTableViewCreatedEventParams extends IEventBase {
44
+ base: FBase;
45
+ table: FBaseTable;
46
+ view: IViewSnapshot;
47
+ index?: number;
95
48
  }
96
- export type BaseEventMap = IBaseEventMap;
97
- export interface IFBaseEventNameMixin {
98
- readonly BaseCreating: 'BaseCreating';
99
- readonly BaseCreated: 'BaseCreated';
100
- readonly BaseReady: 'BaseReady';
49
+ export interface IBeforeBaseTableViewCreateEventParams extends IBaseTableViewCreatedEventParams, IEventBase {
50
+ }
51
+ /**
52
+ * Interface for base table cell value change event parameters
53
+ */
54
+ export interface IBaseTableCellValueChangedEventParams extends IEventBase {
55
+ base: FBase;
56
+ table: FBaseTable;
57
+ field: FBaseTableField;
58
+ record: FBaseTableRecord;
59
+ value: BaseCellValue;
60
+ }
61
+ export interface IBeforeBaseTableCellValueChangeEventParams extends IBaseTableCellValueChangedEventParams, IEventBase {
62
+ }
63
+ /**
64
+ * Interface for base-related events
65
+ * @ignore
66
+ */
67
+ export interface IFBasesEventNameMixin {
68
+ /**
69
+ * Event fired after a base table is created
70
+ * @see {@link IBaseTableCreatedEventParams}
71
+ * @example
72
+ * ```ts
73
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableCreated, (params) => {
74
+ * const { base, table } = params;
75
+ * console.log('base table created', params);
76
+ * });
77
+ *
78
+ * // Remove the event listener, use `disposable.dispose()`
79
+ * ```
80
+ */
81
+ readonly BaseTableCreated: 'BaseTableCreated';
82
+ /**
83
+ * Event fired before a base table is created
84
+ * @see {@link IBeforeBaseTableCreateEventParams}
85
+ * @example
86
+ * ```ts
87
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableCreate, (params) => {
88
+ * const { base, table } = params;
89
+ * console.log('before base create', params);
90
+ *
91
+ * // Cancel the base creation operation
92
+ * params.cancel = true;
93
+ * });
94
+ *
95
+ * // Remove the event listener, use `disposable.dispose()`
96
+ * ```
97
+ */
101
98
  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';
99
+ /**
100
+ * Event fired after a base table field is created
101
+ * @see {@link IBaseTableFieldCreatedEventParams}
102
+ * @example
103
+ * ```ts
104
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableFieldCreated, (params) => {
105
+ * const { base, table, field } = params;
106
+ * console.log('base table field created', params);
107
+ * });
108
+ *
109
+ * // Remove the event listener, use `disposable.dispose()`
110
+ * ```
111
+ */
112
+ readonly BaseTableFieldCreated: 'BaseTableFieldCreated';
113
+ /**
114
+ * Event fired before a base table field is created
115
+ * @see {@link IBeforeBaseTableFieldCreateEventParams}
116
+ * @example
117
+ * ```ts
118
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableFieldCreate, (params) => {
119
+ * const { base, table, field } = params;
120
+ * console.log('before base table field create', params);
121
+ *
122
+ * // Cancel the base table field creation operation
123
+ * params.cancel = true;
124
+ * });
125
+ *
126
+ * // Remove the event listener, use `disposable.dispose()`
127
+ * ```
128
+ */
129
+ readonly BeforeBaseTableFieldCreate: 'BeforeBaseTableFieldCreate';
130
+ /**
131
+ * Event fired after a base table record is created
132
+ * @see {@link IBaseTableRecordCreatedEventParams}
133
+ * @example
134
+ * ```ts
135
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableRecordCreated, (params) => {
136
+ * const { base, table, records } = params;
137
+ * console.log('base table record created', params);
138
+ * });
139
+ *
140
+ * // Remove the event listener, use `disposable.dispose()`
141
+ * ```
142
+ */
143
+ readonly BaseTableRecordCreated: 'BaseTableRecordCreated';
144
+ /**
145
+ * Event fired before a base table record is created
146
+ * @see {@link IBeforeBaseTableRecordCreateEventParams}
147
+ * @example
148
+ * ```ts
149
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableRecordCreate, (params) => {
150
+ * const { base, table, records } = params;
151
+ * console.log('before base table record create', params);
152
+ *
153
+ * // Cancel the base table record creation operation
154
+ * params.cancel = true;
155
+ * });
156
+ *
157
+ * // Remove the event listener, use `disposable.dispose()`
158
+ * ```
159
+ */
160
+ readonly BeforeBaseTableRecordCreate: 'BeforeBaseTableRecordCreate';
161
+ /**
162
+ * Event fired after a base table view is created
163
+ * @see {@link IBaseTableViewCreatedEventParams}
164
+ * @example
165
+ * ```ts
166
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableViewCreated, (params) => {
167
+ * const { base, table, view } = params;
168
+ * console.log('base table view created', params);
169
+ * });
170
+ *
171
+ * // Remove the event listener, use `disposable.dispose()`
172
+ * ```
173
+ */
174
+ readonly BaseTableViewCreated: 'BaseTableViewCreated';
175
+ /**
176
+ * Event fired before a base table view is created
177
+ * @see {@link IBeforeBaseTableViewCreateEventParams}
178
+ * @example
179
+ * ```ts
180
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableViewCreate, (params) => {
181
+ * const { base, table, view } = params;
182
+ * console.log('before base table view create', params);
183
+ *
184
+ * // Cancel the base table view creation operation
185
+ * params.cancel = true;
186
+ * });
187
+ *
188
+ * // Remove the event listener, use `disposable.dispose()`
189
+ * ```
190
+ */
191
+ readonly BeforeBaseTableViewCreate: 'BeforeBaseTableViewCreate';
192
+ /**
193
+ * Event fired after a base table cell value is changed
194
+ * @see {@link IBaseTableCellValueChangedEventParams}
195
+ * @example
196
+ * ```ts
197
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BaseTableCellValueChanged, (params) => {
198
+ * const { base, table, field, record, value } = params;
199
+ * console.log('base table cell value changed', params);
200
+ * });
201
+ *
202
+ * // Remove the event listener, use `disposable.dispose()`
203
+ * ```
204
+ */
205
+ readonly BaseTableCellValueChanged: 'BaseTableCellValueChanged';
206
+ /**
207
+ * Event fired before a base table cell value is changed
208
+ * @see {@link IBeforeBaseTableCellValueChangeEventParams}
209
+ * @example
210
+ * ```ts
211
+ * const disposable = univerAPI.addEvent(univerAPI.Event.BeforeBaseTableCellValueChange, (params) => {
212
+ * const { base, table, field, record, value } = params;
213
+ * console.log('before base table cell value change', params);
214
+ *
215
+ * // Cancel the base table cell value change operation
216
+ * params.cancel = true;
217
+ * });
218
+ *
219
+ * // Remove the event listener, use `disposable.dispose()`
220
+ * ```
221
+ */
222
+ readonly BeforeBaseTableCellValueChange: 'BeforeBaseTableCellValueChange';
117
223
  }
118
- export interface IBaseBatchChangedEvent extends IEventBase {
119
- base: FBase | null;
120
- baseId: string;
121
- payload: Readonly<ICommandInfo>;
224
+ /**
225
+ * Configuration interface for base-related events
226
+ * @ignore
227
+ */
228
+ export interface IBasesEventParamConfig {
229
+ BaseTableCreated: IBaseTableCreatedEventParams;
230
+ BeforeBaseTableCreate: IBeforeBaseTableCreateEventParams;
231
+ BaseTableFieldCreated: IBaseTableFieldCreatedEventParams;
232
+ BeforeBaseTableFieldCreate: IBeforeBaseTableFieldCreateEventParams;
233
+ BaseTableRecordCreated: IBaseTableRecordCreatedEventParams;
234
+ BeforeBaseTableRecordCreate: IBeforeBaseTableRecordCreateEventParams;
235
+ BaseTableViewCreated: IBaseTableViewCreatedEventParams;
236
+ BeforeBaseTableViewCreate: IBeforeBaseTableViewCreateEventParams;
237
+ BaseTableCellValueChanged: IBaseTableCellValueChangedEventParams;
238
+ BeforeBaseTableCellValueChange: IBeforeBaseTableCellValueChangeEventParams;
122
239
  }
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;
240
+ export declare class FBasesEventNameMixin extends FEventName implements IFBasesEventNameMixin {
241
+ get BaseTableCreated(): 'BaseTableCreated';
242
+ get BeforeBaseTableCreate(): 'BeforeBaseTableCreate';
243
+ get BaseTableFieldCreated(): 'BaseTableFieldCreated';
244
+ get BeforeBaseTableFieldCreate(): 'BeforeBaseTableFieldCreate';
245
+ get BaseTableRecordCreated(): 'BaseTableRecordCreated';
246
+ get BeforeBaseTableRecordCreate(): 'BeforeBaseTableRecordCreate';
247
+ get BaseTableViewCreated(): 'BaseTableViewCreated';
248
+ get BeforeBaseTableViewCreate(): 'BeforeBaseTableViewCreate';
249
+ get BaseTableCellValueChanged(): 'BaseTableCellValueChanged';
250
+ get BeforeBaseTableCellValueChange(): 'BeforeBaseTableCellValueChange';
143
251
  }
144
252
  declare module '@univerjs/core/facade' {
145
- interface FEventName extends IFBaseEventNameMixin {
253
+ interface FEventName extends IFBasesEventNameMixin {
146
254
  }
147
- interface IEventParamConfig extends IBaseFacadeEventParamConfig {
255
+ interface IEventParamConfig extends IBasesEventParamConfig {
148
256
  }
149
257
  }