@svar-ui/gantt-store 2.4.1 → 2.4.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.
@@ -1,6 +1,6 @@
1
- import { Store, EventBus } from "@wx/lib-state";
2
- import type { TDataConfig, TWritableCreator, TID } from "@wx/lib-state";
3
- import { HistoryManager } from "./modules/HistoryManager.pro";
1
+ import { Store, EventBus } from "@svar-ui/lib-state";
2
+ import type { TDataConfig, TWritableCreator, TID } from "@svar-ui/lib-state";
3
+ import { HistoryManager } from "./pro/HistoryManager";
4
4
  import type { IData, IDataConfig, ITask, TMethodsConfig, ILink, IVisibleArea, IParsedTask, TScrollTask } from "./types";
5
5
  export default class DataStore extends Store<IData> {
6
6
  in: EventBus<TMethodsConfig, keyof TMethodsConfig>;
@@ -1,4 +1,4 @@
1
- import { DataTree, TID } from "@wx/lib-state";
1
+ import { DataTree, TID } from "@svar-ui/lib-state";
2
2
  import type { ITask, IParsedTask, TSort } from "./types";
3
3
  export default class GanttDataTree extends DataTree<IParsedTask> {
4
4
  private _sort;
@@ -1,4 +1,4 @@
1
- import type { TID } from "@wx/lib-state";
1
+ import type { TID } from "@svar-ui/lib-state";
2
2
  import type { IDataHash } from "../types";
3
3
  import { IOptionConfig } from "./menuOptions";
4
4
  import { IButtonConfig } from "./toolbarButtons";
@@ -1,3 +1,3 @@
1
1
  import type { TEditorItem, IDataConfig } from "../types";
2
- export declare function getEditorItems(config: IDataConfig): TEditorItem[];
2
+ export declare function getEditorItems(config?: IDataConfig): TEditorItem[];
3
3
  export declare const defaultEditorItems: TEditorItem[];
@@ -1,6 +1,6 @@
1
- import type { TID } from "@wx/lib-state";
1
+ import type { TID } from "@svar-ui/lib-state";
2
2
  import type { IParsedTask, IHistory, IData, IDataConfig, IDataHash } from "../types";
3
- export declare function getMenuOptions(config: IDataConfig): IOptionConfig[];
3
+ export declare function getMenuOptions(config?: IDataConfig): IOptionConfig[];
4
4
  export interface IOptionConfig {
5
5
  id?: TID;
6
6
  separator?: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { IData, IDataHash, IParsedTask, IHistory, IDataConfig } from "../types";
2
- import type { TID } from "@wx/lib-state";
3
- export declare function getToolbarButtons(config: IDataConfig): IButtonConfig[];
2
+ import type { TID } from "@svar-ui/lib-state";
3
+ export declare function getToolbarButtons(config?: IDataConfig): IButtonConfig[];
4
4
  export interface IButtonConfig {
5
5
  id?: string;
6
6
  comp: string;
@@ -11,5 +11,5 @@ export { defaultTaskTypes } from "./taskTypes";
11
11
  export { prepareEditTask, parseTaskDates } from "./normalizeDates";
12
12
  export { normalizeZoom } from "./scales";
13
13
  export { isSegmentMoveAllowed, extendDragOptions } from "./tasks";
14
- export { Calendar } from "@wx/lib-schedule";
14
+ export declare const Calendar: any;
15
15
  export type { TID, IApi, ITask, ILink, IConfig, IZoomConfig, IGanttColumn, TMethodsConfig, IGanttTask, IMarker, IScheduleConfig, ICriticalPathConfig, IScaleConfig, } from "./types";
@@ -17,9 +17,9 @@ export declare function placeLink(box: {
17
17
  p: string;
18
18
  };
19
19
  export declare function normalizeLinks(links: ILink[]): {
20
- id: import("@wx/lib-state").TID;
20
+ id: import("@svar-ui/lib-state").TID;
21
21
  type: import("./types").TLinkType;
22
- source: import("@wx/lib-state").TID;
23
- target: import("@wx/lib-state").TID;
22
+ source: import("@svar-ui/lib-state").TID;
23
+ target: import("@svar-ui/lib-state").TID;
24
24
  lag?: number;
25
25
  }[];
@@ -1,9 +1,9 @@
1
1
  import type { IDataMethodsConfig } from "./DataStore";
2
- import type { DataArray, TID, IEventBus, IPublicWritable, IEventConfig } from "@wx/lib-state";
2
+ import type { DataArray, TID, IEventBus, IPublicWritable, IEventConfig } from "@svar-ui/lib-state";
3
3
  import type GanttDataTree from "./GanttDataTree";
4
4
  import { Day } from "date-fns";
5
5
  import type DataStore from "./DataStore";
6
- import type { IApi as ITableApi, IColumn } from "@wx/grid-store";
6
+ import type { IApi as ITableApi, IColumn } from "@svar-ui/grid-store";
7
7
  export type TMethodsConfig = IDataMethodsConfig;
8
8
  export type { GanttDataTree, TID };
9
9
  export interface IActionConfig<T = any> {
@@ -48,7 +48,7 @@ export interface ITask {
48
48
  }
49
49
  export interface IParsedTask extends ITask {
50
50
  id: TID;
51
- parent?: TID;
51
+ parent: TID;
52
52
  data?: IParsedTask[];
53
53
  $level: number;
54
54
  }
@@ -176,6 +176,7 @@ export interface IDataConfig extends IConfig {
176
176
  _sort?: TSort[];
177
177
  _scrollTask?: TScrollTask;
178
178
  _weekStart?: Day;
179
+ _markers?: IMarker[];
179
180
  }
180
181
  export interface IData extends Omit<IDataConfig, "tasks" | "links"> {
181
182
  zoom?: IZoomConfig;
@@ -192,7 +193,6 @@ export interface IData extends Omit<IDataConfig, "tasks" | "links"> {
192
193
  _zoomOffset?: number;
193
194
  _weekStart?: Day;
194
195
  _scrollTask?: TScrollTask;
195
- _markers?: IMarker[];
196
196
  }
197
197
  export interface IDataHash<T = any> {
198
198
  [key: string]: T;
package/package.json CHANGED
@@ -1,27 +1,26 @@
1
1
  {
2
- "name": "@svar-ui/gantt-store",
3
- "version": "2.4.1",
4
- "description": "Internal state management used by SVAR Gantt component",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "module": "dist/index.js",
8
- "types": "dist/types/index.d.ts",
9
- "license": "MIT",
10
- "scripts": {
11
- "build": "vite build",
12
- "watch": "vite build --mode development -w",
13
- "lint": "yarn eslint ./src",
14
- "test": "vitest --run",
15
- "coverage": "vitest --run --coverage"
16
- },
17
- "files": [
18
- "dist",
19
- "licenses",
20
- "license.txt"
21
- ],
22
- "dependencies": {
23
- "date-fns": "3.6.0",
24
- "@svar-ui/lib-state": "1.9.6",
25
- "@svar-ui/lib-schedule": "0.4.3"
26
- }
2
+ "name": "@svar-ui/gantt-store",
3
+ "version": "2.4.3",
4
+ "description": "Internal state management used by SVAR Gantt component",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/types/index.d.ts",
9
+ "license": "MIT",
10
+ "scripts": {
11
+ "build": "vite build",
12
+ "watch": "vite build --mode development -w",
13
+ "lint": "yarn eslint ./src",
14
+ "test": "vitest --run",
15
+ "coverage": "vitest --run --coverage"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "licenses",
20
+ "license.txt"
21
+ ],
22
+ "dependencies": {
23
+ "date-fns": "3.6.0",
24
+ "@svar-ui/lib-state": "1.9.6"
25
+ }
27
26
  }
@@ -1,3 +0,0 @@
1
- import { TID } from "@wx/lib-state";
2
- import { ILink } from "src/types";
3
- export declare function getCircularLinks(links: ILink[]): Set<TID>;
@@ -1,15 +0,0 @@
1
- import { EventTracker } from "./EventTracker.pro";
2
- import type { TID } from "../types";
3
- export declare class AutoSchedulerModule extends EventTracker {
4
- private taskTracker;
5
- private linkTracker;
6
- init(): void;
7
- destroy(): void;
8
- schedule(id?: TID, deleteInvalidLinks?: boolean): void;
9
- protected getDefaultTag(): string;
10
- private setupScheduleHandler;
11
- private setupTaskHandlers;
12
- private setupLinkHandlers;
13
- private deleteInvalidLinks;
14
- private getInvalidLinks;
15
- }
@@ -1,10 +0,0 @@
1
- import type { TID } from "../types";
2
- export declare class ChangeTracker<T extends {
3
- id?: TID;
4
- }> {
5
- private prevState;
6
- track(id: TID, item: Partial<T>, properties: (keyof T)[]): void;
7
- hasChanged(id: TID, item: Partial<T>, properties: (keyof T)[]): boolean;
8
- clear(id?: TID): void;
9
- getSnapshot(id: TID): Partial<T> | undefined;
10
- }
@@ -1,11 +0,0 @@
1
- import { EventTracker } from "./EventTracker.pro";
2
- export declare class CriticalPathModule extends EventTracker {
3
- private taskTracker;
4
- private linkTracker;
5
- init(): void;
6
- destroy(): void;
7
- calculate(): void;
8
- protected getDefaultTag(): string;
9
- private setupTaskHandlers;
10
- private setupLinkHandlers;
11
- }
@@ -1,20 +0,0 @@
1
- import { EventBus } from "@wx/lib-state";
2
- import type { TMethodsConfig, IData } from "../types";
3
- export declare abstract class EventTracker {
4
- protected in: EventBus<TMethodsConfig, keyof TMethodsConfig>;
5
- protected getState: () => Partial<IData>;
6
- protected setState: (state: Partial<IData>) => void;
7
- protected getHistory: () => any;
8
- private _timer;
9
- private _tags;
10
- constructor(eventBus: EventBus<TMethodsConfig, keyof TMethodsConfig>, stateGetter: () => Partial<IData>, stateSetter: (state: Partial<IData>) => void, historyGetter: () => any);
11
- abstract init(): void;
12
- abstract destroy(): void;
13
- protected debounce(code: () => void, delay?: number): void;
14
- protected shouldTrack(ev: any, noTrack?: Record<string, number>): boolean;
15
- protected registerHandler<K extends keyof TMethodsConfig>(type: "on" | "intercept", event: K, handler: (ev: TMethodsConfig[K]) => void, tag?: string): void;
16
- protected on<K extends keyof TMethodsConfig>(event: K, handler: (ev: TMethodsConfig[K]) => void, tag?: string): void;
17
- protected intercept<K extends keyof TMethodsConfig>(event: K, handler: (ev: TMethodsConfig[K]) => void, tag?: string): void;
18
- protected detachHandlers(): void;
19
- protected abstract getDefaultTag(): string;
20
- }
@@ -1,48 +0,0 @@
1
- import { IDataHash, TMethodsConfig } from "../types";
2
- import { EventTracker } from "./EventTracker.pro";
3
- type TActionType = keyof TMethodsConfig;
4
- type TBatchAction = "batch";
5
- type TAllActionTypes = TActionType | TBatchAction;
6
- type TSubActionData = IDataHash & {
7
- action?: TActionType;
8
- };
9
- interface IActionData<T extends TAllActionTypes> {
10
- action: T;
11
- data: T extends TActionType ? TMethodsConfig[T] | TSubActionData : IHistoryEntry[];
12
- }
13
- interface IHistoryEntry extends IActionData<TAllActionTypes> {
14
- source: IActionData<TAllActionTypes>;
15
- }
16
- interface IActionHandlers {
17
- handler: (ev: any) => IHistoryEntry;
18
- getSnapshot?: (ev: any) => IDataHash;
19
- progress?: boolean;
20
- }
21
- export declare class HistoryManager extends EventTracker {
22
- private undo;
23
- private redo;
24
- private progress;
25
- private _dataSnapshot;
26
- private _batch;
27
- private _isBatching;
28
- init(): void;
29
- destroy(): void;
30
- protected getDefaultTag(): string;
31
- getHandlers(): {
32
- [key: string]: IActionHandlers;
33
- };
34
- resetHistory(): void;
35
- private setHandlers;
36
- private setPrevData;
37
- private getPrevData;
38
- private addToHistory;
39
- startBatch(): void;
40
- endBatch(): void;
41
- handleUndo(): void;
42
- handleRedo(): void;
43
- private executeHistoryEntry;
44
- private resetStateHistory;
45
- private setStateHistory;
46
- private getOrder;
47
- }
48
- export {};
@@ -1,11 +0,0 @@
1
- import { ITask, IData, IParsedTask, IDataHash, Calendar } from "./types";
2
- type TSegment = Partial<ITask>;
3
- export declare function calcSplitDates(task: Partial<ITask>, stateOptions: Partial<IData>): void;
4
- export declare function dragSplitTask(task: IParsedTask, ev: IDataHash): boolean;
5
- export declare function updateSplitTask(task: IParsedTask, update: Partial<ITask | TSegment>, stateOptions: Partial<IData>, index?: number, diff?: number): Partial<ITask | Partial<ITask>>;
6
- export declare function splitTask(task: IParsedTask, index: number | undefined, stateOptions: Partial<IData>): Partial<IParsedTask>;
7
- export declare function isIndivisibleType(task: Partial<ITask>): boolean;
8
- export declare function isIndivisible(task: IParsedTask, stateOptions: Partial<IData>, index?: number): boolean;
9
- export declare function getEndAdder(unit: string, calendar: Calendar): (start: number | Date, step: number) => Date;
10
- export declare function shiftNextSegments(segments: Partial<ITask>[], lengthUnit: string, index: number, calendar: Calendar, dir?: number): void;
11
- export {};