@ai-table/state 0.2.4 → 0.3.0
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.
- package/action/field.d.ts +1 -3
- package/action/field.d.ts.map +1 -1
- package/action/index.d.ts +2 -1
- package/action/index.d.ts.map +1 -1
- package/action/position.d.ts +4 -0
- package/action/position.d.ts.map +1 -1
- package/action/record.d.ts.map +1 -1
- package/constants/context-menu-item.d.ts.map +1 -1
- package/fesm2022/ai-table-state.mjs +680 -560
- package/fesm2022/ai-table-state.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/field/add-fields.d.ts.map +1 -1
- package/utils/field/move-fields.d.ts.map +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.d.ts.map +1 -1
- package/utils/position-in-view.d.ts +30 -0
- package/utils/position-in-view.d.ts.map +1 -0
- package/utils/position-precision.d.ts +18 -0
- package/utils/position-precision.d.ts.map +1 -0
- package/utils/record/common.d.ts +1 -15
- package/utils/record/common.d.ts.map +1 -1
- package/utils/record/move-records.d.ts +2 -2
- package/utils/record/move-records.d.ts.map +1 -1
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"add-fields.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/field/add-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"add-fields.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/field/add-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,QA6BvE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"move-fields.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/field/move-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,
|
1
|
+
{"version":3,"file":"move-fields.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/field/move-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAuD,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,QA4CzE"}
|
package/utils/index.d.ts
CHANGED
package/utils/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/state/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/state/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { AITableRecord, AITableViewField, AITableViewRecord, Positions } from '@ai-table/utils';
|
2
|
+
import { AIViewTable } from '../types/ai-table';
|
3
|
+
export type ViewPositionOptions = {
|
4
|
+
afterItemId?: string;
|
5
|
+
beforeItemId?: string;
|
6
|
+
count?: number;
|
7
|
+
};
|
8
|
+
export declare function findNextItemByPosition<T extends AITableViewRecord | AITableViewField>(aiTable: AIViewTable, targetId: string, items: T[], itemsMap: {
|
9
|
+
[key: string]: T extends AITableViewRecord ? AITableRecord : AITableViewField;
|
10
|
+
}): T | null;
|
11
|
+
export declare function findMaxItemByPosition<T extends AITableViewRecord | AITableViewField>(aiTable: AIViewTable, items: T[]): T;
|
12
|
+
export declare function findPrevItemByPosition<T extends AITableViewRecord | AITableViewField>(aiTable: AIViewTable, targetId: string, items: T[], itemsMap: {
|
13
|
+
[key: string]: T extends AITableViewRecord ? AITableRecord : AITableViewField;
|
14
|
+
}): T | null;
|
15
|
+
export declare function getPreviousAndNextPosition<T extends AITableViewRecord | AITableViewField>(aiTable: AIViewTable, options: {
|
16
|
+
afterItemId?: string;
|
17
|
+
beforeItemId?: string;
|
18
|
+
}, items: T[], itemsMap: {
|
19
|
+
[key: string]: T extends AITableViewRecord ? AITableRecord : AITableViewField;
|
20
|
+
}): {
|
21
|
+
nextPosition: number | null;
|
22
|
+
previousPosition: number | null;
|
23
|
+
};
|
24
|
+
export declare function getCurrentViewPositions<T extends AITableViewRecord | AITableViewField>(aiTable: AIViewTable, options: ViewPositionOptions, items: T[], itemsMap: {
|
25
|
+
[key: string]: T extends AITableViewRecord ? AITableRecord : AITableViewField;
|
26
|
+
}): number[];
|
27
|
+
export declare function getNewItemsPosition<T extends AITableViewRecord | AITableViewField>(aiTable: AIViewTable, options: ViewPositionOptions, items: T[], itemsMap: {
|
28
|
+
[key: string]: T extends AITableViewRecord ? AITableRecord : AITableViewField;
|
29
|
+
}): Positions[];
|
30
|
+
//# sourceMappingURL=position-in-view.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3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AAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACxD,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,SAAS,iBAAiB,GAAG,aAAa,GAAG,gBAAgB,CAAA;CAAE,GAC5F;IAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAmClE;AAED,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,iBAAiB,GAAG,gBAAgB,EAClF,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,SAAS,iBAAiB,GAAG,aAAa,GAAG,gBAAgB,CAAA;CAAE,YAmB9F;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,iBAAiB,GAAG,gBAAgB,EAC9E,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,SAAS,iBAAiB,GAAG,aAAa,GAAG,gBAAgB,CAAA;CAAE,eA2B9F"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
interface PositionInsertResult {
|
2
|
+
success: boolean;
|
3
|
+
positions: number[];
|
4
|
+
needsReorganization: boolean;
|
5
|
+
reason?: string;
|
6
|
+
context?: {
|
7
|
+
prevPosition: number;
|
8
|
+
nextPosition: number;
|
9
|
+
availableGap: number;
|
10
|
+
subGap: number;
|
11
|
+
requestedCount: number;
|
12
|
+
};
|
13
|
+
}
|
14
|
+
export declare function insertAtStart(firstPosition: number, count?: number, initialGap?: number): number[];
|
15
|
+
export declare function insertAtEnd(lastPosition: number, count?: number, initialGap?: number): number[];
|
16
|
+
export declare function insertBetween(prevPosition: number, nextPosition: number, count?: number, precisionThreshold?: number): PositionInsertResult;
|
17
|
+
export {};
|
18
|
+
//# sourceMappingURL=position-precision.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"position-precision.d.ts","sourceRoot":"","sources":["../../../packages/state/src/utils/position-precision.ts"],"names":[],"mappings":"AAAA,UAAU,oBAAoB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,cAAc,EAAE,MAAM,CAAC;KAC1B,CAAC;CACL;AAKD,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,EAAE,UAAU,GAAE,MAA4B,GAAG,MAAM,EAAE,CAM1H;AAED,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,EAAE,UAAU,GAAE,MAA4B,GAAG,MAAM,EAAE,CAMvH;AAED,wBAAgB,aAAa,CACzB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,MAAU,EACjB,kBAAkB,GAAE,MAAoC,GACzD,oBAAoB,CAwCtB"}
|
package/utils/record/common.d.ts
CHANGED
@@ -1,19 +1,5 @@
|
|
1
|
-
import { AITableRecord, AITableViewRecord
|
1
|
+
import { AITableRecord, AITableViewRecord } from '@ai-table/utils';
|
2
2
|
import { AIViewTable } from '../../types';
|
3
|
-
export declare function findNextRecordForTargetInOriginalRecords(aiTable: AIViewTable, targetRecordId: string): AITableViewRecord | null;
|
4
|
-
export declare function findPrevRecordForTargetInOriginalRecords(aiTable: AIViewTable, targetRecordId: string): AITableViewRecord | null;
|
5
|
-
export declare function getPositionByAfterOrBeforeRecordId(aiTable: AIViewTable, options: {
|
6
|
-
afterRecordId?: string;
|
7
|
-
beforeRecordId?: string;
|
8
|
-
}): {
|
9
|
-
targetPosition: number;
|
10
|
-
prevPosition: number;
|
11
|
-
};
|
12
|
-
export declare function getNewRecordsPosition(aiTable: AIViewTable, options?: {
|
13
|
-
afterRecordId?: string;
|
14
|
-
beforeRecordId?: string;
|
15
|
-
count?: number;
|
16
|
-
}): Positions[];
|
17
3
|
export declare function getParentGroupValuesByGroupId(aiTable: AIViewTable, groupId: string): Record<string, any> | null;
|
18
4
|
export declare function getPrevRecordIdByAddGroupId(aiTable: AIViewTable, groupId: string): string | null;
|
19
5
|
export declare function buildRecordsWithWillMoveRecords(records: AITableRecord[], willMoveRecordsMap: Map<string, AITableRecord>): AITableViewRecord[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/record/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/record/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAS/G;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAkBhF;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,uBAIvH"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { MoveRecordOptions } from '@ai-table/utils';
|
2
2
|
import { AIViewTable } from '../../types';
|
3
|
-
export declare function moveRecords(aiTable: AIViewTable, options: MoveRecordOptions
|
3
|
+
export declare function moveRecords(aiTable: AIViewTable, options: MoveRecordOptions): void;
|
4
4
|
//# sourceMappingURL=move-records.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"move-records.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/record/move-records.ts"],"names":[],"mappings":"AACA,OAAO,
|
1
|
+
{"version":3,"file":"move-records.d.ts","sourceRoot":"","sources":["../../../../packages/state/src/utils/record/move-records.ts"],"names":[],"mappings":"AACA,OAAO,EAIH,iBAAiB,EAGpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1C,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,QAgD3E"}
|