skandha-facets 0.12.0 → 0.12.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.
- 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/HighlightUIConnector.d.ts +0 -1
- package/facets/HighlightUIConnector.js +0 -5
- package/facets/Insertion.d.ts +2 -0
- package/facets/Insertion.js +21 -2
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/package.json +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()
|
|
@@ -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;
|
|
@@ -39,11 +39,6 @@ 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';
|
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/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';
|