skandha-facets 0.12.0 → 0.13.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/facets/Deletion.d.ts +2 -0
- package/facets/Deletion.js +20 -1
- package/facets/DragAndDrop.d.ts +3 -1
- package/facets/DragAndDrop.js +23 -2
- package/facets/DragAndDropUIConnector.d.ts +0 -1
- package/facets/DragAndDropUIConnector.js +0 -6
- package/facets/Edit.d.ts +2 -0
- package/facets/Edit.js +17 -0
- package/facets/Highlight.d.ts +4 -4
- package/facets/Highlight.js +5 -5
- package/facets/HighlightUIConnector.d.ts +0 -1
- package/facets/HighlightUIConnector.js +5 -10
- package/facets/Insertion.d.ts +2 -0
- package/facets/Insertion.js +21 -2
- package/facets/Selection.d.ts +1 -1
- package/facets/Selection.js +9 -9
- package/facets/SelectionUIConnector.js +4 -4
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/package.json +3 -3
- package/policies/cancelNewItemOnHighlightChange.d.ts +1 -1
- package/policies/cancelNewItemOnHighlightChange.js +2 -2
- package/policies/correctHighlight.js +6 -6
- package/policies/highlightFollowsSelection.js +1 -1
- package/policies/highlightNewItem.js +1 -1
- package/policies/newItemsAreAddedBelowTheHighlight.js +1 -1
package/facets/Deletion.d.ts
CHANGED
package/facets/Deletion.js
CHANGED
|
@@ -14,10 +14,23 @@ class Deletion {
|
|
|
14
14
|
writable: true,
|
|
15
15
|
value: undefined
|
|
16
16
|
});
|
|
17
|
+
Object.defineProperty(this, "isDeleting", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: false
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
setIsDeleting(isDeleting) {
|
|
25
|
+
this.isDeleting = isDeleting;
|
|
17
26
|
}
|
|
18
27
|
delete(args) {
|
|
19
28
|
const cbs = getCallbacks(this);
|
|
20
|
-
|
|
29
|
+
this.setIsDeleting(true);
|
|
30
|
+
return Promise.resolve(cbs.deleteItems()).then((response) => {
|
|
31
|
+
this.setIsDeleting(false);
|
|
32
|
+
return response;
|
|
33
|
+
});
|
|
21
34
|
}
|
|
22
35
|
}
|
|
23
36
|
Object.defineProperty(Deletion, "className", {
|
|
@@ -29,6 +42,12 @@ Object.defineProperty(Deletion, "className", {
|
|
|
29
42
|
__decorate([
|
|
30
43
|
data
|
|
31
44
|
], Deletion.prototype, "disabled", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
data
|
|
47
|
+
], Deletion.prototype, "isDeleting", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
operation({ log: false })
|
|
50
|
+
], Deletion.prototype, "setIsDeleting", null);
|
|
32
51
|
__decorate([
|
|
33
52
|
operation,
|
|
34
53
|
withCbs()
|
package/facets/DragAndDrop.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { DefineCbs } from 'aspiration';
|
|
|
2
2
|
import { HoverPositionT } from './Hovering';
|
|
3
3
|
export declare class DragAndDrop {
|
|
4
4
|
static className: () => string;
|
|
5
|
+
isDropping: boolean;
|
|
6
|
+
setIsDropping(isDropping: boolean): void;
|
|
5
7
|
drop(args: {
|
|
6
8
|
hoverPosition: HoverPositionT;
|
|
7
|
-
}): Promise<
|
|
9
|
+
}): Promise<any>;
|
|
8
10
|
}
|
|
9
11
|
type Cbs = {
|
|
10
12
|
drop: {
|
package/facets/DragAndDrop.js
CHANGED
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { getCallbacks, withCbs } from 'aspiration';
|
|
8
|
-
import { operation } from 'skandha';
|
|
8
|
+
import { data, operation } from 'skandha';
|
|
9
9
|
import { selectionIsInsertedOnDragAndDrop } from '../policies/selectionIsInsertedOnDragAndDrop';
|
|
10
10
|
const dropDefaultCbs = (dragAndDrop) => ({
|
|
11
11
|
drop: function () {
|
|
@@ -13,9 +13,24 @@ const dropDefaultCbs = (dragAndDrop) => ({
|
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
class DragAndDrop {
|
|
16
|
+
constructor() {
|
|
17
|
+
Object.defineProperty(this, "isDropping", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: false
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
setIsDropping(isDropping) {
|
|
25
|
+
this.isDropping = isDropping;
|
|
26
|
+
}
|
|
16
27
|
drop(args) {
|
|
17
28
|
const cbs = getCallbacks(this);
|
|
18
|
-
|
|
29
|
+
this.setIsDropping(true);
|
|
30
|
+
return Promise.resolve(cbs.drop()).then((response) => {
|
|
31
|
+
this.setIsDropping(false);
|
|
32
|
+
return response;
|
|
33
|
+
});
|
|
19
34
|
}
|
|
20
35
|
}
|
|
21
36
|
Object.defineProperty(DragAndDrop, "className", {
|
|
@@ -24,6 +39,12 @@ Object.defineProperty(DragAndDrop, "className", {
|
|
|
24
39
|
writable: true,
|
|
25
40
|
value: () => 'DragAndDrop'
|
|
26
41
|
});
|
|
42
|
+
__decorate([
|
|
43
|
+
data
|
|
44
|
+
], DragAndDrop.prototype, "isDropping", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
operation({ log: false })
|
|
47
|
+
], DragAndDrop.prototype, "setIsDropping", null);
|
|
27
48
|
__decorate([
|
|
28
49
|
operation,
|
|
29
50
|
withCbs(dropDefaultCbs)
|
|
@@ -28,4 +28,3 @@ export declare function dragAndDropUIHandlers<T extends DragAndDropUIPropsT>(pro
|
|
|
28
28
|
onDrop: ((event: any) => void) | undefined;
|
|
29
29
|
onDragEnd: ((event: any) => void) | undefined;
|
|
30
30
|
};
|
|
31
|
-
export declare function createDragAndDropUIConnector(dragAndDrop: DragAndDrop, hovering: Hovering): DragAndDropUIConnector;
|
package/facets/Edit.d.ts
CHANGED
package/facets/Edit.js
CHANGED
|
@@ -14,14 +14,25 @@ class Edit {
|
|
|
14
14
|
writable: true,
|
|
15
15
|
value: false
|
|
16
16
|
});
|
|
17
|
+
Object.defineProperty(this, "isSaving", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: false
|
|
22
|
+
});
|
|
17
23
|
}
|
|
18
24
|
reset() {
|
|
19
25
|
this.isEditing = false;
|
|
20
26
|
}
|
|
27
|
+
setIsSaving(isSaving) {
|
|
28
|
+
this.isSaving = isSaving;
|
|
29
|
+
}
|
|
21
30
|
save(args) {
|
|
22
31
|
const cbs = getCallbacks(this);
|
|
32
|
+
this.setIsSaving(true);
|
|
23
33
|
return Promise.resolve(cbs.saveItem()).then((savedObj) => {
|
|
24
34
|
this.reset();
|
|
35
|
+
this.setIsSaving(false);
|
|
25
36
|
return savedObj;
|
|
26
37
|
});
|
|
27
38
|
}
|
|
@@ -49,9 +60,15 @@ Object.defineProperty(Edit, "className", {
|
|
|
49
60
|
__decorate([
|
|
50
61
|
data
|
|
51
62
|
], Edit.prototype, "isEditing", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
data
|
|
65
|
+
], Edit.prototype, "isSaving", void 0);
|
|
52
66
|
__decorate([
|
|
53
67
|
operation
|
|
54
68
|
], Edit.prototype, "reset", null);
|
|
69
|
+
__decorate([
|
|
70
|
+
operation({ log: false })
|
|
71
|
+
], Edit.prototype, "setIsSaving", null);
|
|
55
72
|
__decorate([
|
|
56
73
|
operation,
|
|
57
74
|
withCbs()
|
package/facets/Highlight.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { DefineCbs } from 'aspiration';
|
|
|
2
2
|
export declare class Highlight<T = any> {
|
|
3
3
|
static className: () => string;
|
|
4
4
|
highlightableIds: Array<string>;
|
|
5
|
-
|
|
5
|
+
itemId: string | undefined;
|
|
6
6
|
item?: T;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
set(args: {
|
|
8
|
+
itemId: string | undefined;
|
|
9
9
|
}): void;
|
|
10
10
|
}
|
|
11
11
|
type Cbs<T> = {
|
|
12
|
-
|
|
12
|
+
set: {
|
|
13
13
|
scrollItemIntoView(): void;
|
|
14
14
|
};
|
|
15
15
|
};
|
package/facets/Highlight.js
CHANGED
|
@@ -15,7 +15,7 @@ class Highlight {
|
|
|
15
15
|
writable: true,
|
|
16
16
|
value: stub
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(this, "
|
|
18
|
+
Object.defineProperty(this, "itemId", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
configurable: true,
|
|
21
21
|
writable: true,
|
|
@@ -28,9 +28,9 @@ class Highlight {
|
|
|
28
28
|
value: void 0
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
set(args) {
|
|
32
32
|
const cbs = getCallbacks(this);
|
|
33
|
-
this.
|
|
33
|
+
this.itemId = args.itemId;
|
|
34
34
|
cbs.scrollItemIntoView && cbs.scrollItemIntoView();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -45,12 +45,12 @@ __decorate([
|
|
|
45
45
|
], Highlight.prototype, "highlightableIds", void 0);
|
|
46
46
|
__decorate([
|
|
47
47
|
data
|
|
48
|
-
], Highlight.prototype, "
|
|
48
|
+
], Highlight.prototype, "itemId", void 0);
|
|
49
49
|
__decorate([
|
|
50
50
|
output
|
|
51
51
|
], Highlight.prototype, "item", void 0);
|
|
52
52
|
__decorate([
|
|
53
53
|
operation,
|
|
54
54
|
withCbs(highlightItemDefaultCbs)
|
|
55
|
-
], Highlight.prototype, "
|
|
55
|
+
], Highlight.prototype, "set", null);
|
|
56
56
|
export { Highlight };
|
|
@@ -20,7 +20,6 @@ export type HighlightUIPropsT = {
|
|
|
20
20
|
export declare function highlightUIHandlers<T extends HighlightUIPropsT>(props: T): {
|
|
21
21
|
onMouseDown: any;
|
|
22
22
|
};
|
|
23
|
-
export declare function createHighlightUIConnector(highlight: Highlight): HighlightUIConnector;
|
|
24
23
|
export declare const createHighlightKeyHandlers: (highlight: Highlight, options?: {
|
|
25
24
|
keyDown?: string;
|
|
26
25
|
keyUp?: string;
|
|
@@ -17,11 +17,11 @@ export class HighlightUIConnector {
|
|
|
17
17
|
this._handleMouseDown = this._createMouseDownHandler();
|
|
18
18
|
}
|
|
19
19
|
_highlight(e, itemId) {
|
|
20
|
-
this.props.highlight.
|
|
20
|
+
this.props.highlight.set({ itemId });
|
|
21
21
|
}
|
|
22
22
|
_createMouseDownHandler() {
|
|
23
23
|
return (e, itemId) => {
|
|
24
|
-
const isHighlighted = this.props.highlight.
|
|
24
|
+
const isHighlighted = this.props.highlight.itemId === itemId;
|
|
25
25
|
if (!isHighlighted) {
|
|
26
26
|
this._highlight(e, itemId);
|
|
27
27
|
}
|
|
@@ -31,7 +31,7 @@ export class HighlightUIConnector {
|
|
|
31
31
|
const mouseHandlers = {
|
|
32
32
|
onMouseDown: (e) => this._handleMouseDown(e, itemId),
|
|
33
33
|
};
|
|
34
|
-
return Object.assign({ isHighlighted: this.props.highlight.
|
|
34
|
+
return Object.assign({ isHighlighted: this.props.highlight.itemId === itemId }, mouseHandlers);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
export function highlightUIHandlers(props) {
|
|
@@ -39,16 +39,11 @@ export function highlightUIHandlers(props) {
|
|
|
39
39
|
onMouseDown: props.onMouseDown,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
export function createHighlightUIConnector(highlight) {
|
|
43
|
-
return new HighlightUIConnector({
|
|
44
|
-
highlight,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
42
|
export const createHighlightKeyHandlers = (highlight, options) => {
|
|
48
43
|
var _a, _b;
|
|
49
44
|
const down = (_a = options === null || options === void 0 ? void 0 : options.keyDown) !== null && _a !== void 0 ? _a : 'down';
|
|
50
45
|
const up = (_b = options === null || options === void 0 ? void 0 : options.keyUp) !== null && _b !== void 0 ? _b : 'up';
|
|
51
|
-
const getAnchor = () => highlight.
|
|
46
|
+
const getAnchor = () => highlight.itemId;
|
|
52
47
|
const getHighlightableIds = () => {
|
|
53
48
|
var _a;
|
|
54
49
|
return (options === null || options === void 0 ? void 0 : options.getHighlightableIds)
|
|
@@ -62,7 +57,7 @@ export const createHighlightKeyHandlers = (highlight, options) => {
|
|
|
62
57
|
};
|
|
63
58
|
const highlightNext = (highlight, currentItemId, isDown, highlightableIds) => {
|
|
64
59
|
const highlightItemById = (itemId) => {
|
|
65
|
-
highlight.
|
|
60
|
+
highlight.set({ itemId });
|
|
66
61
|
};
|
|
67
62
|
if (currentItemId !== undefined) {
|
|
68
63
|
pickNeighbour(highlightableIds, currentItemId, isDown, highlightItemById);
|
package/facets/Insertion.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { HoverPositionT } from './Hovering';
|
|
|
3
3
|
export type DragSourceT = (ctr: any) => HoverPositionT | undefined;
|
|
4
4
|
export declare class Insertion<T = any> {
|
|
5
5
|
static className: () => string;
|
|
6
|
+
isInserting: boolean;
|
|
6
7
|
inputItems: Array<T>;
|
|
7
8
|
preview: Array<T>;
|
|
9
|
+
setIsInserting(isInserting: boolean): void;
|
|
8
10
|
insertItems(args: {
|
|
9
11
|
hoverPosition: HoverPositionT;
|
|
10
12
|
}): Promise<any>;
|
package/facets/Insertion.js
CHANGED
|
@@ -5,10 +5,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { getCallbacks, stub, withCbs } from 'aspiration';
|
|
8
|
-
import { input, operation, output } from 'skandha';
|
|
8
|
+
import { data, input, operation, output } from 'skandha';
|
|
9
9
|
import { getPreview } from '../lib/getPreview';
|
|
10
10
|
class Insertion {
|
|
11
11
|
constructor() {
|
|
12
|
+
Object.defineProperty(this, "isInserting", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: false
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(this, "inputItems", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
configurable: true,
|
|
@@ -22,11 +28,18 @@ class Insertion {
|
|
|
22
28
|
value: stub
|
|
23
29
|
});
|
|
24
30
|
}
|
|
31
|
+
setIsInserting(isInserting) {
|
|
32
|
+
this.isInserting = isInserting;
|
|
33
|
+
}
|
|
25
34
|
insertItems(args) {
|
|
26
35
|
const cbs = getCallbacks(this);
|
|
27
36
|
if (this.inputItems) {
|
|
37
|
+
this.setIsInserting(true);
|
|
28
38
|
const preview = getPreview(this.inputItems, args.hoverPosition.targetItemId, args.hoverPosition.isBefore, args.hoverPosition.payload);
|
|
29
|
-
return Promise.resolve(cbs.insertItems(preview))
|
|
39
|
+
return Promise.resolve(cbs.insertItems(preview)).then((response) => {
|
|
40
|
+
this.setIsInserting(false);
|
|
41
|
+
return response;
|
|
42
|
+
});
|
|
30
43
|
}
|
|
31
44
|
return Promise.resolve();
|
|
32
45
|
}
|
|
@@ -37,12 +50,18 @@ Object.defineProperty(Insertion, "className", {
|
|
|
37
50
|
writable: true,
|
|
38
51
|
value: () => 'Insertion'
|
|
39
52
|
});
|
|
53
|
+
__decorate([
|
|
54
|
+
data
|
|
55
|
+
], Insertion.prototype, "isInserting", void 0);
|
|
40
56
|
__decorate([
|
|
41
57
|
input
|
|
42
58
|
], Insertion.prototype, "inputItems", void 0);
|
|
43
59
|
__decorate([
|
|
44
60
|
output
|
|
45
61
|
], Insertion.prototype, "preview", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
operation({ log: false })
|
|
64
|
+
], Insertion.prototype, "setIsInserting", null);
|
|
46
65
|
__decorate([
|
|
47
66
|
operation,
|
|
48
67
|
withCbs()
|
package/facets/Selection.d.ts
CHANGED
package/facets/Selection.js
CHANGED
|
@@ -20,7 +20,7 @@ class Selection {
|
|
|
20
20
|
writable: true,
|
|
21
21
|
value: stub
|
|
22
22
|
});
|
|
23
|
-
Object.defineProperty(this, "
|
|
23
|
+
Object.defineProperty(this, "itemIds", {
|
|
24
24
|
enumerable: true,
|
|
25
25
|
configurable: true,
|
|
26
26
|
writable: true,
|
|
@@ -55,7 +55,7 @@ __decorate([
|
|
|
55
55
|
], Selection.prototype, "selectableIds", void 0);
|
|
56
56
|
__decorate([
|
|
57
57
|
data
|
|
58
|
-
], Selection.prototype, "
|
|
58
|
+
], Selection.prototype, "itemIds", void 0);
|
|
59
59
|
__decorate([
|
|
60
60
|
data
|
|
61
61
|
], Selection.prototype, "anchorId", void 0);
|
|
@@ -69,11 +69,11 @@ __decorate([
|
|
|
69
69
|
export { Selection };
|
|
70
70
|
export function handleSelectItem(facet, args) {
|
|
71
71
|
if (args.itemId === undefined) {
|
|
72
|
-
facet.
|
|
72
|
+
facet.itemIds = [];
|
|
73
73
|
facet.anchorId = undefined;
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
const hasItem = facet.
|
|
76
|
+
const hasItem = facet.itemIds.includes(args.itemId);
|
|
77
77
|
const selectableIds = facet.selectableIds;
|
|
78
78
|
if (!selectableIds) {
|
|
79
79
|
throw Error('logical error');
|
|
@@ -83,15 +83,15 @@ export function handleSelectItem(facet, args) {
|
|
|
83
83
|
const startIdx = selectableIds.indexOf(startItemId);
|
|
84
84
|
const stopIdx = selectableIds.indexOf(args.itemId);
|
|
85
85
|
const idxRange = range(startIdx, stopIdx);
|
|
86
|
-
facet.
|
|
86
|
+
facet.itemIds = idxRange.map((idx) => selectableIds[idx]);
|
|
87
87
|
}
|
|
88
88
|
else if (args.isCtrl) {
|
|
89
|
-
facet.
|
|
90
|
-
? facet.
|
|
91
|
-
: [...facet.
|
|
89
|
+
facet.itemIds = hasItem
|
|
90
|
+
? facet.itemIds.filter((x) => x !== args.itemId)
|
|
91
|
+
: [...facet.itemIds, args.itemId];
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
facet.
|
|
94
|
+
facet.itemIds = [args.itemId];
|
|
95
95
|
}
|
|
96
96
|
// Move the anchor
|
|
97
97
|
if (!facet.anchorId || !(args.isCtrl || args.isShift)) {
|
|
@@ -44,7 +44,7 @@ export class SelectionUIConnector {
|
|
|
44
44
|
}
|
|
45
45
|
_createMouseDownHandler() {
|
|
46
46
|
return (e, itemId) => {
|
|
47
|
-
const isSelected = this.props.selection.
|
|
47
|
+
const isSelected = this.props.selection.itemIds.includes(itemId);
|
|
48
48
|
if (!isSelected) {
|
|
49
49
|
this._selectOnMouseUp = undefined;
|
|
50
50
|
this._select(e, itemId);
|
|
@@ -56,7 +56,7 @@ export class SelectionUIConnector {
|
|
|
56
56
|
}
|
|
57
57
|
_createMouseUpHandler() {
|
|
58
58
|
return (e, itemId) => {
|
|
59
|
-
const isSelected = this.props.selection.
|
|
59
|
+
const isSelected = this.props.selection.itemIds.includes(itemId);
|
|
60
60
|
// If the item was already selected and we left-click it without the ctrl key,
|
|
61
61
|
// then we want to singly select it.
|
|
62
62
|
if (this._selectOnMouseUp === itemId &&
|
|
@@ -71,7 +71,7 @@ export class SelectionUIConnector {
|
|
|
71
71
|
onMouseDown: (e) => this._handleMouseDown(e, itemId),
|
|
72
72
|
onMouseUp: (e) => this._handleMouseUp(e, itemId),
|
|
73
73
|
};
|
|
74
|
-
return Object.assign({ isSelected: this.props.selection.
|
|
74
|
+
return Object.assign({ isSelected: this.props.selection.itemIds.includes(itemId) }, mouseHandlers);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
export function selectionUIHandlers(props) {
|
|
@@ -84,7 +84,7 @@ export const createSelectionKeyHandlers = (selection, options) => {
|
|
|
84
84
|
var _a, _b;
|
|
85
85
|
const down = (_a = options === null || options === void 0 ? void 0 : options.keyDown) !== null && _a !== void 0 ? _a : 'down';
|
|
86
86
|
const up = (_b = options === null || options === void 0 ? void 0 : options.keyUp) !== null && _b !== void 0 ? _b : 'up';
|
|
87
|
-
const getAnchor = () => selection.
|
|
87
|
+
const getAnchor = () => selection.itemIds[selection.itemIds.length - 1];
|
|
88
88
|
const getSelectableIds = () => {
|
|
89
89
|
var _a;
|
|
90
90
|
return (options === null || options === void 0 ? void 0 : options.getSelectableIds)
|
package/index.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ export { Addition, type AdditionCbs } from './facets/Addition';
|
|
|
2
2
|
export { Deletion, type DeletionCbs } from './facets/Deletion';
|
|
3
3
|
export { Display } from './facets/Display';
|
|
4
4
|
export { DragAndDrop, type DragAndDropCbs } from './facets/DragAndDrop';
|
|
5
|
-
export {
|
|
5
|
+
export { DragAndDropUIConnector, dragAndDropUIHandlers, type DragAndDropUIConnectorT, type DragAndDropUIPropsT, } from './facets/DragAndDropUIConnector';
|
|
6
6
|
export { Edit, type EditCbs } from './facets/Edit';
|
|
7
|
+
export { Filtering, type FilteringCbs } from './facets/Filtering';
|
|
7
8
|
export { Highlight, type HighlightCbs } from './facets/Highlight';
|
|
8
|
-
export {
|
|
9
|
+
export { HighlightUIConnector, createHighlightKeyHandlers, highlightUIHandlers, type HighlightUIConnectorT, type HighlightUIPropsT, } from './facets/HighlightUIConnector';
|
|
9
10
|
export { Hovering, type HoverPositionT } from './facets/Hovering';
|
|
10
11
|
export { Insertion, type InsertionCbs } from './facets/Insertion';
|
|
11
12
|
export { Selection, handleSelectItem, type SelectionCbs, } from './facets/Selection';
|
package/index.js
CHANGED
|
@@ -2,10 +2,11 @@ export { Addition } from './facets/Addition';
|
|
|
2
2
|
export { Deletion } from './facets/Deletion';
|
|
3
3
|
export { Display } from './facets/Display';
|
|
4
4
|
export { DragAndDrop } from './facets/DragAndDrop';
|
|
5
|
-
export {
|
|
5
|
+
export { DragAndDropUIConnector, dragAndDropUIHandlers, } from './facets/DragAndDropUIConnector';
|
|
6
6
|
export { Edit } from './facets/Edit';
|
|
7
|
+
export { Filtering } from './facets/Filtering';
|
|
7
8
|
export { Highlight } from './facets/Highlight';
|
|
8
|
-
export {
|
|
9
|
+
export { HighlightUIConnector, createHighlightKeyHandlers, highlightUIHandlers, } from './facets/HighlightUIConnector';
|
|
9
10
|
export { Hovering } from './facets/Hovering';
|
|
10
11
|
export { Insertion } from './facets/Insertion';
|
|
11
12
|
export { Selection, handleSelectItem, } from './facets/Selection';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skandha-facets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Facets for use with the skandha library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/mnieber/skandha-facets.git",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"types": "index.d.ts",
|
|
10
10
|
"prepublish": "tsc",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"skandha": ">=0.
|
|
13
|
-
"aspiration": ">=0.5.
|
|
12
|
+
"skandha": ">=0.13.0",
|
|
13
|
+
"aspiration": ">=0.5.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "^4.0.3"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Highlight } from '../facets/Highlight';
|
|
2
|
-
export declare function cancelNewItemOnHighlightChange(facet: Highlight,
|
|
2
|
+
export declare function cancelNewItemOnHighlightChange(facet: Highlight, itemId: string): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getc, getf } from 'skandha';
|
|
2
2
|
import { Addition } from '../facets/Addition';
|
|
3
|
-
export function cancelNewItemOnHighlightChange(facet,
|
|
3
|
+
export function cancelNewItemOnHighlightChange(facet, itemId) {
|
|
4
4
|
var _a;
|
|
5
5
|
const ctr = getc(facet);
|
|
6
6
|
const addedItemId = (_a = getf(Addition, ctr).item) === null || _a === void 0 ? void 0 : _a.id;
|
|
7
|
-
if (addedItemId && addedItemId !==
|
|
7
|
+
if (addedItemId && addedItemId !== itemId) {
|
|
8
8
|
getf(Addition, ctr).cancel();
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export function correctHighlight(highlight, allItemIds, highlightableIds) {
|
|
2
2
|
highlightableIds = highlightableIds !== null && highlightableIds !== void 0 ? highlightableIds : highlight.highlightableIds;
|
|
3
|
-
if (highlight.
|
|
4
|
-
allItemIds.includes(highlight.
|
|
5
|
-
!highlightableIds.includes(highlight.
|
|
6
|
-
const highlightedItemIdx = allItemIds.indexOf(highlight.
|
|
3
|
+
if (highlight.itemId &&
|
|
4
|
+
allItemIds.includes(highlight.itemId) &&
|
|
5
|
+
!highlightableIds.includes(highlight.itemId)) {
|
|
6
|
+
const highlightedItemIdx = allItemIds.indexOf(highlight.itemId);
|
|
7
7
|
const newIdx = _findNeighbourIdx(highlightableIds, allItemIds, highlightedItemIdx, allItemIds.length, 1) ||
|
|
8
8
|
_findNeighbourIdx(highlightableIds, allItemIds, highlightedItemIdx, -1, -1);
|
|
9
|
-
highlight.
|
|
10
|
-
|
|
9
|
+
highlight.set({
|
|
10
|
+
itemId: newIdx ? allItemIds[newIdx.result] : undefined,
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -3,6 +3,6 @@ import { Highlight } from '../facets/Highlight';
|
|
|
3
3
|
export function highlightFollowsSelection(facet, args) {
|
|
4
4
|
const ctr = getc(facet);
|
|
5
5
|
if (!args.isCtrl && !args.isShift) {
|
|
6
|
-
getf(Highlight, ctr).
|
|
6
|
+
getf(Highlight, ctr).set({ itemId: args.itemId });
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -3,5 +3,5 @@ import { Highlight } from '../facets/Highlight';
|
|
|
3
3
|
import { topOfTheList } from '../lib/getPreview';
|
|
4
4
|
export function newItemsAreAddedBelowTheHighlight(facet) {
|
|
5
5
|
const ctr = getc(facet);
|
|
6
|
-
facet.parentId = getf(Highlight, ctr).
|
|
6
|
+
facet.parentId = getf(Highlight, ctr).itemId || topOfTheList;
|
|
7
7
|
}
|