@univerjs-pro/bases 1.5.2 → 1.6.1

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.
@@ -1,5 +1,6 @@
1
1
  import type { BaseViewType, IMutation, JSONXActions } from '@univerjs/core';
2
2
  import type { BaseEventSource, IBaseHierarchyChange } from '../../models/base-hierarchy';
3
+ import type { IBaseGanttPredecessorAddition } from '../../views/gantt-view';
3
4
  export declare enum BaseHistoryAction {
4
5
  CreateView = "create-view",
5
6
  DeleteView = "delete-view"
@@ -13,5 +14,6 @@ export interface IApplyBaseJson1MutationParams {
13
14
  historyAction?: BaseHistoryAction;
14
15
  viewType?: BaseViewType;
15
16
  source?: BaseEventSource;
17
+ ganttPredecessorAddition?: IBaseGanttPredecessorAddition;
16
18
  }
17
19
  export declare const ApplyBaseJson1Mutation: IMutation<IApplyBaseJson1MutationParams>;
@@ -1 +1,6 @@
1
+ export declare function getBaseProgressRange(config: unknown): {
2
+ start: number;
3
+ end: number;
4
+ };
1
5
  export declare function formatBaseProgressValue(value: number, config: unknown): string;
6
+ export declare function normalizeBaseProgressDecimalPlaces(value: unknown): number;
@@ -1,3 +1,5 @@
1
+ export { AddGanttPredecessorCommand, RemoveGanttPredecessorCommand } from './commands/commands/add-gantt-predecessor.command';
2
+ export type { AddGanttPredecessorResult, IAddGanttPredecessorCommandParams, IGanttPredecessorCommandParams } from './commands/commands/add-gantt-predecessor.command';
1
3
  export { BatchCreateBaseRecordsCommand } from './commands/commands/batch-create-base-records.command';
2
4
  export type { IBatchCreateBaseRecordsCommandParams } from './commands/commands/batch-create-base-records.command';
3
5
  export { BatchDeleteBaseRecordsCommand } from './commands/commands/batch-delete-base-records.command';
@@ -92,7 +94,7 @@ export { getBaseConditionalColorOperators, isBaseConditionalColorDateField, matc
92
94
  export { BASE_FIELD_STAT_TYPES, calculateBaseFieldStat, formatBaseFieldStatValue, getSupportedBaseFieldStatTypes, isBaseFieldStatEmptyValue, isBaseFieldStatSupported, isBaseFieldStatType, normalizeBaseFieldStatsConfig, } from './fields/field-stat';
93
95
  export type { BaseFieldStatType } from './fields/field-stat';
94
96
  export { formatBaseNumberValue, inferBaseSeparatorStyle, } from './fields/number-format';
95
- export { formatBaseProgressValue } from './fields/progress-format';
97
+ export { formatBaseProgressValue, getBaseProgressRange, normalizeBaseProgressDecimalPlaces } from './fields/progress-format';
96
98
  export { uniqueFieldName } from './fields/util';
97
99
  export { ensureBaseTableCellLayout, getBaseCellFormulaValue, getBaseCellValue, } from './models/base-cell-data';
98
100
  export { BASE_HIERARCHY_MAX_LEVELS, BASE_HIERARCHY_PARENT_FIELD_ID, BaseEventSource, BaseHierarchyError, BaseHierarchyErrorCode, buildBaseHierarchyIndex, createBaseHierarchyParentField, getActiveBaseHierarchyFieldIds, getBaseHierarchyDeletePromotions, getBaseHierarchyFieldId, getVisibleBaseHierarchyRows, isBaseHierarchyField, projectBaseHierarchy, resolveBaseHierarchyFieldId, validateBaseHierarchyMove, validateBaseHierarchyRecordCreations, validateBaseHierarchyRecordPatches, } from './models/base-hierarchy';
@@ -119,6 +121,11 @@ export { BASE_UNIT_PERMISSION_ACTIONS, canEditBaseTargets, getBaseDashboardPermi
119
121
  export type { BaseUnitPermissionAction } from './services/base-permission-point';
120
122
  export { IBasePermissionService } from './services/base-permission.service';
121
123
  export type { IBaseFieldPermission, IBasePermissionSnapshot, IBaseRecordPermission, IBaseTablePermission, IBaseViewPermission } from './services/base-permission.service';
124
+ export { getGanttWorkingDayVariance } from './services/base-projection.service';
122
125
  export { IBaseProjectionService } from './services/base-projection.service';
126
+ export { IBaseSyncStatusService } from './services/base-sync-status.service';
127
+ export type { BaseSyncStatus } from './services/base-sync-status.service';
123
128
  export { IBaseViewRegistryService } from './services/base-view-registry.service';
129
+ export { hasGanttPredecessorPath, isGanttPredecessorField } from './views/gantt-view';
130
+ export type { IBaseGanttPredecessorAddition, IBaseGanttProjection, IBaseGanttViewConfig } from './views/gantt-view';
124
131
  export type { IViewCorePlugin } from './views/view-core-plugin';
@@ -98,7 +98,7 @@ export declare function projectBaseHierarchy(index: IBaseHierarchyIndex, rows: r
98
98
  rows: IProjectedRow[];
99
99
  hierarchy: IBaseHierarchyProjection;
100
100
  };
101
- export declare function getVisibleBaseHierarchyRows(projection: IGridProjection, collapsedRecordIds?: ReadonlySet<RecordId>): IProjectedRow[];
101
+ export declare function getVisibleBaseHierarchyRows(projection: Pick<IGridProjection, 'rows' | 'hierarchy'>, collapsedRecordIds?: ReadonlySet<RecordId>): IProjectedRow[];
102
102
  /** Validate a proposed move without mutating the table. */
103
103
  export declare function validateBaseHierarchyMove(index: IBaseHierarchyIndex, recordId: RecordId, parentRecordId: RecordId | null): {
104
104
  valid: true;
@@ -1,4 +1,4 @@
1
- import type { BaseCellValue, IBaseCellData, IBaseSnapshot, IFieldSnapshot, IFilterConfig, IGroupConfig, IRecordSnapshot, ISortConfig, ITableSnapshot, IViewSnapshot, JSONXActions, TableId } from '@univerjs/core';
1
+ import type { BaseCellValue, IBaseCellData, IBaseSnapshot, IFieldSnapshot, IFilterConfig, IGroupConfig, IRecordSnapshot, ISortConfig, ITableSnapshot, IViewFieldSetting, IViewSnapshot, JSONXActions, TableId } from '@univerjs/core';
2
2
  export interface ICreateFieldOpInput {
3
3
  field: IFieldSnapshot;
4
4
  index?: number;
@@ -53,6 +53,10 @@ export declare class BaseJson1OpFactory {
53
53
  setViewGroup(snapshot: IBaseSnapshot, tableId: TableId, viewId: string, group: IGroupConfig[]): JSONXActions;
54
54
  setViewFieldVisible(snapshot: IBaseSnapshot, tableId: TableId, viewId: string, fieldId: string, visible: boolean): JSONXActions;
55
55
  setViewFieldWidth(snapshot: IBaseSnapshot, tableId: TableId, viewId: string, fieldId: string, width: number): JSONXActions;
56
+ getViewFieldSettingHistory(snapshot: IBaseSnapshot, tableId: TableId, viewId: string, fieldId: string, patch: IViewFieldSetting): {
57
+ undo: JSONXActions;
58
+ redo: JSONXActions;
59
+ };
56
60
  setViewFieldOrder(snapshot: IBaseSnapshot, tableId: TableId, viewId: string, fieldId: string, target: {
57
61
  beforeFieldId?: string;
58
62
  afterFieldId?: string;
@@ -64,4 +68,5 @@ export declare class BaseJson1OpFactory {
64
68
  private _setAttachmentResources;
65
69
  private _deleteAttachmentResources;
66
70
  private _replaceOptional;
71
+ private _patchProperties;
67
72
  }
@@ -1,6 +1,6 @@
1
- import type { BaseViewProjection, FieldId, IBaseSnapshot, RecordId, TableId, ViewId } from '@univerjs/core';
2
- import type { IViewCorePlugin, IViewRepairResult } from '../views/view-core-plugin';
1
+ import type { BaseViewProjection, FieldId, IBaseSnapshot, IGanttViewConfig, RecordId, TableId, ViewId } from '@univerjs/core';
3
2
  import { Disposable, toDisposable } from '@univerjs/core';
3
+ import type { IViewCorePlugin, IViewRepairResult } from '../views/view-core-plugin';
4
4
  import { IBaseFieldRegistryService } from './base-field-registry.service';
5
5
  export interface IBaseProjectionService {
6
6
  registerView(plugin: IViewCorePlugin): ReturnType<typeof toDisposable>;
@@ -46,6 +46,7 @@ export declare class BaseProjectionService extends Disposable implements IBasePr
46
46
  private _groupConfigCacheSegment;
47
47
  private _viewRevisionKey;
48
48
  private _buildGrid;
49
+ private _projectHierarchyRows;
49
50
  private _getHierarchyIndex;
50
51
  private _projectHierarchyGroups;
51
52
  private _buildKanban;
@@ -70,6 +71,7 @@ export declare class BaseProjectionService extends Disposable implements IBasePr
70
71
  private _isAllDayCalendarEvent;
71
72
  private _isAllDayGanttDateRange;
72
73
  private _buildGantt;
74
+ private _buildGanttPlan;
73
75
  private _normalizeGanttConfig;
74
76
  private _resolveGanttDateFieldId;
75
77
  private _isGanttDateField;
@@ -96,6 +98,6 @@ export declare class BaseProjectionService extends Disposable implements IBasePr
96
98
  private _projectGroups;
97
99
  private _materializeGroups;
98
100
  private _title;
99
- private _recordIds;
100
101
  private _capabilities;
101
102
  }
103
+ export declare function getGanttWorkingDayVariance(planned: number, current: number, workingDays?: IGanttViewConfig['workingDays']): number;
@@ -0,0 +1,7 @@
1
+ import type { Observable } from 'rxjs';
2
+ export type BaseSyncStatus = 'synced' | 'syncing' | 'offline' | 'conflict' | 'not_collab';
3
+ export interface IBaseSyncStatusService {
4
+ getStatus$(unitId: string): Observable<BaseSyncStatus>;
5
+ reconnect(): void;
6
+ }
7
+ export declare const IBaseSyncStatusService: import("@univerjs/core").IdentifierDecorator<IBaseSyncStatusService>;
@@ -0,0 +1,36 @@
1
+ import type { IBaseHierarchyProjection, IFieldSnapshot, IGanttProjection, IGanttViewConfig } from '@univerjs/core';
2
+ export interface IBaseGanttViewConfig extends IGanttViewConfig {
3
+ showPlanComparison?: boolean;
4
+ planStartDateFieldId?: string;
5
+ planEndDateFieldId?: string;
6
+ planColor?: string;
7
+ remainingColor?: string;
8
+ }
9
+ export interface IBaseGanttProjection extends IGanttProjection {
10
+ config: IBaseGanttViewConfig;
11
+ bars: Array<IGanttProjection['bars'][number] & {
12
+ completion?: number;
13
+ }>;
14
+ progressField?: {
15
+ id: string;
16
+ start: number;
17
+ end: number;
18
+ editable: boolean;
19
+ };
20
+ hierarchy?: IBaseHierarchyProjection;
21
+ plan?: {
22
+ bars: Array<Pick<IGanttProjection['bars'][number], 'recordId' | 'title' | 'start' | 'end'>>;
23
+ needsDateFields: boolean;
24
+ invalidRecordIds: string[];
25
+ };
26
+ }
27
+ export interface IBaseGanttPredecessorAddition {
28
+ tableId: string;
29
+ fieldId: string;
30
+ predecessorId: string;
31
+ successorId: string;
32
+ /** Nonempty link values in this field before the edit. OT advances this graph while rebasing. */
33
+ graph: Array<[recordId: string, predecessors: string]>;
34
+ }
35
+ export declare function hasGanttPredecessorPath(from: string, to: string, getLinks: (recordId: string) => unknown): boolean;
36
+ export declare function isGanttPredecessorField(tableId: string, field?: Pick<IFieldSnapshot, 'type' | 'config' | 'system' | 'readonly'>): boolean;