@univerjs-pro/bases 0.25.0-insiders.20260608-e4336f7

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 (157) hide show
  1. package/README.md +42 -0
  2. package/lib/cjs/facade.js +1 -0
  3. package/lib/cjs/index.js +1 -0
  4. package/lib/cjs/locale/ar-SA.js +1 -0
  5. package/lib/cjs/locale/ca-ES.js +1 -0
  6. package/lib/cjs/locale/de-DE.js +1 -0
  7. package/lib/cjs/locale/en-US.js +1 -0
  8. package/lib/cjs/locale/es-ES.js +1 -0
  9. package/lib/cjs/locale/fa-IR.js +1 -0
  10. package/lib/cjs/locale/fr-FR.js +1 -0
  11. package/lib/cjs/locale/id-ID.js +1 -0
  12. package/lib/cjs/locale/it-IT.js +1 -0
  13. package/lib/cjs/locale/ja-JP.js +1 -0
  14. package/lib/cjs/locale/ko-KR.js +1 -0
  15. package/lib/cjs/locale/pl-PL.js +1 -0
  16. package/lib/cjs/locale/pt-BR.js +1 -0
  17. package/lib/cjs/locale/ru-RU.js +1 -0
  18. package/lib/cjs/locale/sk-SK.js +1 -0
  19. package/lib/cjs/locale/vi-VN.js +1 -0
  20. package/lib/cjs/locale/zh-CN.js +1 -0
  21. package/lib/cjs/locale/zh-HK.js +1 -0
  22. package/lib/cjs/locale/zh-TW.js +1 -0
  23. package/lib/es/facade.js +1 -0
  24. package/lib/es/index.js +1 -0
  25. package/lib/es/locale/ar-SA.js +1 -0
  26. package/lib/es/locale/ca-ES.js +1 -0
  27. package/lib/es/locale/de-DE.js +1 -0
  28. package/lib/es/locale/en-US.js +1 -0
  29. package/lib/es/locale/es-ES.js +1 -0
  30. package/lib/es/locale/fa-IR.js +1 -0
  31. package/lib/es/locale/fr-FR.js +1 -0
  32. package/lib/es/locale/id-ID.js +1 -0
  33. package/lib/es/locale/it-IT.js +1 -0
  34. package/lib/es/locale/ja-JP.js +1 -0
  35. package/lib/es/locale/ko-KR.js +1 -0
  36. package/lib/es/locale/pl-PL.js +1 -0
  37. package/lib/es/locale/pt-BR.js +1 -0
  38. package/lib/es/locale/ru-RU.js +1 -0
  39. package/lib/es/locale/sk-SK.js +1 -0
  40. package/lib/es/locale/vi-VN.js +1 -0
  41. package/lib/es/locale/zh-CN.js +1 -0
  42. package/lib/es/locale/zh-HK.js +1 -0
  43. package/lib/es/locale/zh-TW.js +1 -0
  44. package/lib/facade.js +1 -0
  45. package/lib/index.js +1 -0
  46. package/lib/locale/ar-SA.js +1 -0
  47. package/lib/locale/ca-ES.js +1 -0
  48. package/lib/locale/de-DE.js +1 -0
  49. package/lib/locale/en-US.js +1 -0
  50. package/lib/locale/es-ES.js +1 -0
  51. package/lib/locale/fa-IR.js +1 -0
  52. package/lib/locale/fr-FR.js +1 -0
  53. package/lib/locale/id-ID.js +1 -0
  54. package/lib/locale/it-IT.js +1 -0
  55. package/lib/locale/ja-JP.js +1 -0
  56. package/lib/locale/ko-KR.js +1 -0
  57. package/lib/locale/pl-PL.js +1 -0
  58. package/lib/locale/pt-BR.js +1 -0
  59. package/lib/locale/ru-RU.js +1 -0
  60. package/lib/locale/sk-SK.js +1 -0
  61. package/lib/locale/vi-VN.js +1 -0
  62. package/lib/locale/zh-CN.js +1 -0
  63. package/lib/locale/zh-HK.js +1 -0
  64. package/lib/locale/zh-TW.js +1 -0
  65. package/lib/types/commands/cell.command.d.ts +32 -0
  66. package/lib/types/commands/field.command.d.ts +53 -0
  67. package/lib/types/commands/record.command.d.ts +39 -0
  68. package/lib/types/commands/table.command.d.ts +18 -0
  69. package/lib/types/commands/undo-redo.d.ts +2 -0
  70. package/lib/types/commands/view.command.d.ts +107 -0
  71. package/lib/types/controllers/base-active-dirty.controller.d.ts +16 -0
  72. package/lib/types/controllers/base-formula-calculation.controller.d.ts +23 -0
  73. package/lib/types/controllers/base-formula-optional-identifier.d.ts +1 -0
  74. package/lib/types/controllers/base-remote-formula.controller.d.ts +13 -0
  75. package/lib/types/facade/f-base.d.ts +362 -0
  76. package/lib/types/facade/f-event.d.ts +61 -0
  77. package/lib/types/facade/f-field.d.ts +191 -0
  78. package/lib/types/facade/f-permission.d.ts +299 -0
  79. package/lib/types/facade/f-range.d.ts +179 -0
  80. package/lib/types/facade/f-record.d.ts +137 -0
  81. package/lib/types/facade/f-table.d.ts +769 -0
  82. package/lib/types/facade/f-univer.d.ts +148 -0
  83. package/lib/types/facade/f-view.d.ts +275 -0
  84. package/lib/types/facade/index.d.ts +10 -0
  85. package/lib/types/fields/date-format.d.ts +6 -0
  86. package/lib/types/fields/field-core-plugin.d.ts +21 -0
  87. package/lib/types/fields/number-format.d.ts +15 -0
  88. package/lib/types/index.d.ts +48 -0
  89. package/lib/types/locale/ar-SA.d.ts +3 -0
  90. package/lib/types/locale/ca-ES.d.ts +3 -0
  91. package/lib/types/locale/de-DE.d.ts +3 -0
  92. package/lib/types/locale/en-US.d.ts +59 -0
  93. package/lib/types/locale/es-ES.d.ts +3 -0
  94. package/lib/types/locale/fa-IR.d.ts +3 -0
  95. package/lib/types/locale/fr-FR.d.ts +3 -0
  96. package/lib/types/locale/id-ID.d.ts +3 -0
  97. package/lib/types/locale/it-IT.d.ts +3 -0
  98. package/lib/types/locale/ja-JP.d.ts +3 -0
  99. package/lib/types/locale/ko-KR.d.ts +3 -0
  100. package/lib/types/locale/pl-PL.d.ts +3 -0
  101. package/lib/types/locale/pt-BR.d.ts +3 -0
  102. package/lib/types/locale/ru-RU.d.ts +3 -0
  103. package/lib/types/locale/sk-SK.d.ts +3 -0
  104. package/lib/types/locale/vi-VN.d.ts +3 -0
  105. package/lib/types/locale/zh-CN.d.ts +3 -0
  106. package/lib/types/locale/zh-HK.d.ts +3 -0
  107. package/lib/types/locale/zh-TW.d.ts +3 -0
  108. package/lib/types/models/base-cell-data.d.ts +14 -0
  109. package/lib/types/models/base-snapshot.d.ts +1 -0
  110. package/lib/types/models/default-table.d.ts +12 -0
  111. package/lib/types/models/field-snapshot.d.ts +1 -0
  112. package/lib/types/models/record-snapshot.d.ts +1 -0
  113. package/lib/types/models/table-snapshot.d.ts +1 -0
  114. package/lib/types/models/value.d.ts +1 -0
  115. package/lib/types/models/view-snapshot.d.ts +1 -0
  116. package/lib/types/mutations/json1.mutation.d.ts +7 -0
  117. package/lib/types/mutations/utils.d.ts +2 -0
  118. package/lib/types/ot/json1-adapter.d.ts +103 -0
  119. package/lib/types/ot/json1-invalidation.d.ts +2 -0
  120. package/lib/types/ot/json1-op-applier.d.ts +6 -0
  121. package/lib/types/ot/json1-op-factory.d.ts +64 -0
  122. package/lib/types/ot/json1-path.d.ts +13 -0
  123. package/lib/types/plugin.d.ts +35 -0
  124. package/lib/types/search/base-search.d.ts +24 -0
  125. package/lib/types/services/base-active-dirty.service.d.ts +24 -0
  126. package/lib/types/services/base-command.service.d.ts +122 -0
  127. package/lib/types/services/base-compression.service.d.ts +46 -0
  128. package/lib/types/services/base-field-registry.service.d.ts +17 -0
  129. package/lib/types/services/base-formula.service.d.ts +71 -0
  130. package/lib/types/services/base-performance.service.d.ts +5 -0
  131. package/lib/types/services/base-permission.service.d.ts +76 -0
  132. package/lib/types/services/base-projection.service.d.ts +97 -0
  133. package/lib/types/services/base-resource.service.d.ts +15 -0
  134. package/lib/types/services/base-view-registry.service.d.ts +15 -0
  135. package/lib/types/views/view-core-plugin.d.ts +21 -0
  136. package/lib/umd/facade.js +1 -0
  137. package/lib/umd/index.js +1 -0
  138. package/lib/umd/locale/ar-SA.js +1 -0
  139. package/lib/umd/locale/ca-ES.js +1 -0
  140. package/lib/umd/locale/de-DE.js +1 -0
  141. package/lib/umd/locale/en-US.js +1 -0
  142. package/lib/umd/locale/es-ES.js +1 -0
  143. package/lib/umd/locale/fa-IR.js +1 -0
  144. package/lib/umd/locale/fr-FR.js +1 -0
  145. package/lib/umd/locale/id-ID.js +1 -0
  146. package/lib/umd/locale/it-IT.js +1 -0
  147. package/lib/umd/locale/ja-JP.js +1 -0
  148. package/lib/umd/locale/ko-KR.js +1 -0
  149. package/lib/umd/locale/pl-PL.js +1 -0
  150. package/lib/umd/locale/pt-BR.js +1 -0
  151. package/lib/umd/locale/ru-RU.js +1 -0
  152. package/lib/umd/locale/sk-SK.js +1 -0
  153. package/lib/umd/locale/vi-VN.js +1 -0
  154. package/lib/umd/locale/zh-CN.js +1 -0
  155. package/lib/umd/locale/zh-HK.js +1 -0
  156. package/lib/umd/locale/zh-TW.js +1 -0
  157. package/package.json +86 -0
@@ -0,0 +1,76 @@
1
+ export interface IBaseTablePermission {
2
+ createField?: boolean;
3
+ createRecord?: boolean;
4
+ delete?: boolean;
5
+ manageView?: boolean;
6
+ }
7
+ export interface IBaseFieldPermission {
8
+ edit?: boolean;
9
+ delete?: boolean;
10
+ editCell?: boolean;
11
+ }
12
+ export interface IBaseRecordPermission {
13
+ delete?: boolean;
14
+ editCell?: boolean;
15
+ }
16
+ export interface IBasePermissionService {
17
+ canCreateTable(baseId: string): boolean;
18
+ canDeleteTable(tableId: string): boolean;
19
+ canCreateField(tableId: string): boolean;
20
+ canEditField(tableId: string, fieldId: string): boolean;
21
+ canDeleteField(tableId: string, fieldId: string): boolean;
22
+ canCreateRecord(tableId: string): boolean;
23
+ canDeleteRecord(tableId: string, recordId: string): boolean;
24
+ canEditCell(tableId: string, recordId: string, fieldId: string): boolean;
25
+ canManageView(tableId: string, viewId: string): boolean;
26
+ setBasePermission(baseId: string, permission: {
27
+ createTable?: boolean;
28
+ }): void;
29
+ setTablePermission(tableId: string, permission: IBaseTablePermission): void;
30
+ setFieldPermission(tableId: string, fieldId: string, permission: IBaseFieldPermission): void;
31
+ setRecordPermission(tableId: string, recordId: string, permission: IBaseRecordPermission): void;
32
+ clearBasePermission(baseId: string): void;
33
+ clearTablePermission(tableId: string): void;
34
+ clearFieldPermission(tableId: string, fieldId: string): void;
35
+ clearRecordPermission(tableId: string, recordId: string): void;
36
+ getSnapshot(): IBasePermissionSnapshot;
37
+ }
38
+ export declare const IBasePermissionService: import("@wendellhu/redi").IdentifierDecorator<IBasePermissionService>;
39
+ export interface IBasePermissionSnapshot {
40
+ bases: Record<string, {
41
+ createTable?: boolean;
42
+ }>;
43
+ tables: Record<string, IBaseTablePermission>;
44
+ fields: Record<string, IBaseFieldPermission>;
45
+ records: Record<string, IBaseRecordPermission>;
46
+ }
47
+ export declare class BasePermissionService implements IBasePermissionService {
48
+ private readonly _basePermissions;
49
+ private readonly _tablePermissions;
50
+ private readonly _fieldPermissions;
51
+ private readonly _recordPermissions;
52
+ canCreateTable(baseId: string): boolean;
53
+ canDeleteTable(tableId: string): boolean;
54
+ canCreateField(tableId: string): boolean;
55
+ canEditField(tableId: string, fieldId: string): boolean;
56
+ canDeleteField(tableId: string, fieldId: string): boolean;
57
+ canCreateRecord(tableId: string): boolean;
58
+ canDeleteRecord(tableId: string, recordId: string): boolean;
59
+ canEditCell(tableId: string, recordId: string, fieldId: string): boolean;
60
+ canManageView(tableId: string): boolean;
61
+ setBasePermission(baseId: string, permission: {
62
+ createTable?: boolean;
63
+ }): void;
64
+ setTablePermission(tableId: string, permission: IBaseTablePermission): void;
65
+ setFieldPermission(tableId: string, fieldId: string, permission: IBaseFieldPermission): void;
66
+ setRecordPermission(tableId: string, recordId: string, permission: IBaseRecordPermission): void;
67
+ clearBasePermission(baseId: string): void;
68
+ clearTablePermission(tableId: string): void;
69
+ clearFieldPermission(tableId: string, fieldId: string): void;
70
+ clearRecordPermission(tableId: string, recordId: string): void;
71
+ getSnapshot(): IBasePermissionSnapshot;
72
+ }
73
+ export type BaseTablePermission = IBaseTablePermission;
74
+ export type BaseFieldPermission = IBaseFieldPermission;
75
+ export type BaseRecordPermission = IBaseRecordPermission;
76
+ export type BasePermissionSnapshot = IBasePermissionSnapshot;
@@ -0,0 +1,97 @@
1
+ import type { BaseViewProjection, FieldId, IBaseSnapshot, RecordId, TableId, ViewId } from '@univerjs/core';
2
+ import type { IViewCorePlugin, IViewRepairResult } from '../views/view-core-plugin';
3
+ import { Disposable, toDisposable } from '@univerjs/core';
4
+ import { BaseFieldRegistryService } from './base-field-registry.service';
5
+ export interface IBaseProjectionService {
6
+ registerView(plugin: IViewCorePlugin): ReturnType<typeof toDisposable>;
7
+ getProjection(snapshot: IBaseSnapshot, tableId: TableId, viewId: ViewId): BaseViewProjection;
8
+ repairViewConfig(snapshot: IBaseSnapshot, tableId: TableId, viewId: ViewId): IViewRepairResult;
9
+ invalidateByOp(): void;
10
+ invalidateByCell(tableId: TableId, recordId: RecordId, fieldId: FieldId): void;
11
+ invalidateByField(tableId: TableId, fieldId: FieldId): void;
12
+ invalidateByView(tableId: TableId, viewId: ViewId): void;
13
+ }
14
+ export declare const IBaseProjectionService: import("@wendellhu/redi").IdentifierDecorator<IBaseProjectionService>;
15
+ export declare class BaseProjectionService extends Disposable implements IBaseProjectionService {
16
+ private readonly _fieldRegistry;
17
+ private readonly _views;
18
+ private readonly _projectionCache;
19
+ private readonly _projectedRowsCache;
20
+ private readonly _projectedViewRowsCache;
21
+ private readonly _projectedGroupsCache;
22
+ private _globalRevision;
23
+ private readonly _tableRevisions;
24
+ private readonly _cellRevisions;
25
+ private readonly _cellInvalidations;
26
+ private readonly _viewRevisions;
27
+ constructor(_fieldRegistry?: BaseFieldRegistryService);
28
+ registerView(plugin: IViewCorePlugin): import("@wendellhu/redi").IDisposable;
29
+ getProjection(snapshot: IBaseSnapshot, tableId: TableId, viewId: ViewId): BaseViewProjection;
30
+ repairViewConfig(snapshot: IBaseSnapshot, tableId: TableId, viewId: ViewId): IViewRepairResult;
31
+ invalidateByOp(): void;
32
+ invalidateByCell(tableId: TableId, recordId: RecordId, fieldId: FieldId): void;
33
+ invalidateByField(tableId: TableId, fieldId: FieldId): void;
34
+ invalidateByView(tableId: TableId, viewId: ViewId): void;
35
+ private _getCachedProjection;
36
+ private _setCachedProjection;
37
+ private _bumpTableRevision;
38
+ private _getTableRevision;
39
+ private _getCellRevision;
40
+ private _getViewRevision;
41
+ private _cacheKey;
42
+ private _viewRowsCacheKey;
43
+ private _groupsCacheKey;
44
+ private _rowTransformCacheSegment;
45
+ private _groupConfigCacheSegment;
46
+ private _viewRevisionKey;
47
+ private _buildGrid;
48
+ private _buildKanban;
49
+ private _resolveKanbanGroupFieldId;
50
+ private _findKanbanGroupField;
51
+ private _isKanbanGroupField;
52
+ private _isAllowedKanbanGroupField;
53
+ private _isColorfulKanbanGroupField;
54
+ private _resolveKanbanCoverFieldId;
55
+ private _resolveKanbanCardFieldIds;
56
+ private _getKanbanConfiguredLanes;
57
+ private _kanbanGroupKeys;
58
+ private _kanbanLaneTitle;
59
+ private _kanbanLaneColor;
60
+ private _buildCalendar;
61
+ private _normalizeCalendarConfig;
62
+ private _resolveCalendarDateFieldId;
63
+ private _findCalendarDateFieldId;
64
+ private _isCalendarDateField;
65
+ private _normalizeCalendarDisplayColor;
66
+ private _calendarEventColor;
67
+ private _isAllDayCalendarEvent;
68
+ private _isAllDayGanttDateRange;
69
+ private _buildGantt;
70
+ private _normalizeGanttConfig;
71
+ private _resolveGanttDateFieldId;
72
+ private _isGanttDateField;
73
+ private _normalizeGanttDisplayColor;
74
+ private _ganttBarColor;
75
+ private _matchesGanttColorRule;
76
+ private _buildGallery;
77
+ private _normalizeGalleryConfig;
78
+ private _resolveGalleryCoverFieldId;
79
+ private _resolveGalleryCardFieldIds;
80
+ private _projectFields;
81
+ private _projectRows;
82
+ private _projectTableRows;
83
+ private _patchProjectedRowsForCellInvalidations;
84
+ private _patchCachedProjectedRows;
85
+ private _cellInvalidationsTouchFields;
86
+ private _filterSortFieldIds;
87
+ private _groupProjectionFieldIds;
88
+ private _filterRows;
89
+ private _sortRows;
90
+ private _canUseFastSort;
91
+ private _fastSortRows;
92
+ private _projectGroups;
93
+ private _materializeGroups;
94
+ private _title;
95
+ private _recordIds;
96
+ private _capabilities;
97
+ }
@@ -0,0 +1,15 @@
1
+ import type { BaseDataModel, IBaseSnapshot } from '@univerjs/core';
2
+ import { IUniverInstanceService } from '@univerjs/core';
3
+ export interface IBaseResourceService {
4
+ getBase(baseId: string): BaseDataModel | null;
5
+ getAllBases(): BaseDataModel[];
6
+ createBase(snapshot: Partial<IBaseSnapshot>): BaseDataModel;
7
+ }
8
+ export declare const IBaseResourceService: import("@wendellhu/redi").IdentifierDecorator<IBaseResourceService>;
9
+ export declare class BaseResourceService implements IBaseResourceService {
10
+ private readonly _univerInstanceService;
11
+ constructor(_univerInstanceService: IUniverInstanceService);
12
+ getBase(baseId: string): BaseDataModel | null;
13
+ getAllBases(): BaseDataModel[];
14
+ createBase(snapshot: Partial<IBaseSnapshot>): BaseDataModel;
15
+ }
@@ -0,0 +1,15 @@
1
+ import type { ViewType } from '@univerjs/core';
2
+ import type { IViewCorePlugin } from '../views/view-core-plugin';
3
+ import { Disposable, toDisposable } from '@univerjs/core';
4
+ export interface IBaseViewRegistryService {
5
+ register(plugin: IViewCorePlugin): ReturnType<typeof toDisposable>;
6
+ get(type: ViewType): IViewCorePlugin;
7
+ getAll(): IViewCorePlugin[];
8
+ }
9
+ export declare const IBaseViewRegistryService: import("@wendellhu/redi").IdentifierDecorator<IBaseViewRegistryService>;
10
+ export declare class BaseViewRegistryService extends Disposable implements IBaseViewRegistryService {
11
+ private readonly _plugins;
12
+ register(plugin: IViewCorePlugin): import("@wendellhu/redi").IDisposable;
13
+ get(type: ViewType): IViewCorePlugin;
14
+ getAll(): IViewCorePlugin[];
15
+ }
@@ -0,0 +1,21 @@
1
+ import type { BaseViewProjection, ITableSnapshot, IViewSnapshot, ValidationResult, ViewSpecificConfig, ViewType } from '@univerjs/core';
2
+ export interface IProjectionContext {
3
+ now: number;
4
+ }
5
+ export interface IViewRepairResult {
6
+ repaired: boolean;
7
+ view: IViewSnapshot;
8
+ }
9
+ export interface IViewCorePlugin<TConfig extends ViewSpecificConfig = ViewSpecificConfig> {
10
+ type: ViewType;
11
+ i18nKey: string;
12
+ createDefaultConfig(table: ITableSnapshot): TConfig;
13
+ validateConfig(table: ITableSnapshot, view: IViewSnapshot<TConfig>): ValidationResult;
14
+ buildProjection(table: ITableSnapshot, view: IViewSnapshot<TConfig>, context: IProjectionContext): BaseViewProjection;
15
+ repairConfig?(table: ITableSnapshot, view: IViewSnapshot<TConfig>): IViewRepairResult;
16
+ }
17
+ export declare function resolveDefaultBaseCardFieldIds(table: ITableSnapshot, excludedFieldIds?: Array<string | null | undefined>, limit?: number): string[];
18
+ export declare function createCoreViewPlugins(): IViewCorePlugin[];
19
+ export type ProjectionContext = IProjectionContext;
20
+ export type ViewRepairResult = IViewRepairResult;
21
+ export type ViewCorePlugin<TConfig extends ViewSpecificConfig = ViewSpecificConfig> = IViewCorePlugin<TConfig>;