skandha-facets 0.13.0 → 0.15.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/Addition.d.ts +5 -16
- package/facets/Addition.js +27 -19
- package/facets/Deletion.d.ts +4 -9
- package/facets/Deletion.js +6 -16
- package/facets/Display.js +2 -4
- package/facets/DragAndDrop.d.ts +3 -8
- package/facets/DragAndDrop.js +6 -12
- package/facets/Edit.d.ts +5 -13
- package/facets/Edit.js +16 -15
- package/facets/Filtering.d.ts +0 -7
- package/facets/Filtering.js +5 -9
- package/facets/Highlight.d.ts +4 -8
- package/facets/Highlight.js +11 -9
- package/facets/Hovering.js +1 -2
- package/facets/Insertion.d.ts +1 -8
- package/facets/Insertion.js +7 -8
- package/facets/Selection.d.ts +6 -8
- package/facets/Selection.js +7 -13
- package/facets/SelectionUIConnector.d.ts +1 -1
- package/facets/SelectionUIConnector.js +1 -1
- package/facets/Store.js +1 -2
- package/index.d.ts +8 -8
- package/index.js +1 -1
- package/package.json +7 -3
package/facets/Addition.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefineCbs } from 'aspiration';
|
|
2
1
|
export type GenericObjectT = any;
|
|
3
2
|
export declare class Addition<T = any> {
|
|
4
3
|
static className: () => string;
|
|
@@ -12,19 +11,9 @@ export declare class Addition<T = any> {
|
|
|
12
11
|
confirm(): Promise<void>;
|
|
13
12
|
cancel(): void;
|
|
14
13
|
_reset(): void;
|
|
14
|
+
protected stageAdd(): void;
|
|
15
|
+
protected createItem(): T | undefined;
|
|
16
|
+
protected highlightNewItem(newItem: T): void;
|
|
17
|
+
protected unstageAdd(parentId: string | undefined): void;
|
|
18
|
+
protected confirmAdd(): any;
|
|
15
19
|
}
|
|
16
|
-
type Cbs<T> = {
|
|
17
|
-
add: {
|
|
18
|
-
stageAdd(): void;
|
|
19
|
-
createItem(): T;
|
|
20
|
-
highlightNewItem(): void;
|
|
21
|
-
};
|
|
22
|
-
cancel: {
|
|
23
|
-
unstageAdd(parentId: string | undefined): void;
|
|
24
|
-
};
|
|
25
|
-
confirm: {
|
|
26
|
-
confirmAdd(): void;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export type AdditionCbs<T = any> = DefineCbs<Addition<T>, Cbs<T>>;
|
|
30
|
-
export {};
|
package/facets/Addition.js
CHANGED
|
@@ -4,9 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
class Addition {
|
|
7
|
+
import { data, operation } from "skandha";
|
|
8
|
+
export class Addition {
|
|
10
9
|
constructor() {
|
|
11
10
|
Object.defineProperty(this, "item", {
|
|
12
11
|
enumerable: true,
|
|
@@ -29,38 +28,51 @@ class Addition {
|
|
|
29
28
|
}
|
|
30
29
|
add(args) {
|
|
31
30
|
var _a;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const newItem = (_a = args.values) !== null && _a !== void 0 ? _a : cbs.createItem();
|
|
31
|
+
this.stageAdd();
|
|
32
|
+
const newItem = (_a = args.values) !== null && _a !== void 0 ? _a : this.createItem();
|
|
35
33
|
this.setItem(newItem);
|
|
36
|
-
|
|
34
|
+
this.highlightNewItem(newItem);
|
|
37
35
|
return newItem;
|
|
38
36
|
}
|
|
39
37
|
confirm() {
|
|
40
|
-
const
|
|
41
|
-
const result = cbs.confirmAdd ? cbs.confirmAdd() : undefined;
|
|
38
|
+
const result = this.confirmAdd();
|
|
42
39
|
return Promise.resolve(result).then(() => {
|
|
43
40
|
this._reset();
|
|
44
41
|
});
|
|
45
42
|
}
|
|
46
43
|
cancel() {
|
|
47
|
-
const cbs = getCallbacks(this);
|
|
48
44
|
if (this.item) {
|
|
49
45
|
const parentId = this.parentId;
|
|
50
46
|
this._reset();
|
|
51
|
-
|
|
47
|
+
this.unstageAdd(parentId);
|
|
52
48
|
}
|
|
53
49
|
}
|
|
54
50
|
_reset() {
|
|
55
51
|
this.setItem(undefined);
|
|
56
52
|
this.setParentId(undefined);
|
|
57
53
|
}
|
|
54
|
+
stageAdd() {
|
|
55
|
+
// Override this method in child classes if needed
|
|
56
|
+
}
|
|
57
|
+
createItem() {
|
|
58
|
+
// Override this method in child classes if needed
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
highlightNewItem(newItem) {
|
|
62
|
+
// Override this method in child classes if needed
|
|
63
|
+
}
|
|
64
|
+
unstageAdd(parentId) {
|
|
65
|
+
// Override this method in child classes if needed
|
|
66
|
+
}
|
|
67
|
+
confirmAdd() {
|
|
68
|
+
// Override this method in child classes if needed
|
|
69
|
+
}
|
|
58
70
|
}
|
|
59
71
|
Object.defineProperty(Addition, "className", {
|
|
60
72
|
enumerable: true,
|
|
61
73
|
configurable: true,
|
|
62
74
|
writable: true,
|
|
63
|
-
value: () =>
|
|
75
|
+
value: () => "Addition"
|
|
64
76
|
});
|
|
65
77
|
__decorate([
|
|
66
78
|
data
|
|
@@ -75,18 +87,14 @@ __decorate([
|
|
|
75
87
|
operation({ log: false })
|
|
76
88
|
], Addition.prototype, "setItem", null);
|
|
77
89
|
__decorate([
|
|
78
|
-
operation
|
|
79
|
-
withCbs()
|
|
90
|
+
operation
|
|
80
91
|
], Addition.prototype, "add", null);
|
|
81
92
|
__decorate([
|
|
82
|
-
operation
|
|
83
|
-
withCbs()
|
|
93
|
+
operation
|
|
84
94
|
], Addition.prototype, "confirm", null);
|
|
85
95
|
__decorate([
|
|
86
|
-
operation
|
|
87
|
-
withCbs()
|
|
96
|
+
operation
|
|
88
97
|
], Addition.prototype, "cancel", null);
|
|
89
98
|
__decorate([
|
|
90
99
|
operation({ log: false })
|
|
91
100
|
], Addition.prototype, "_reset", null);
|
|
92
|
-
export { Addition };
|
package/facets/Deletion.d.ts
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { DefineCbs } from 'aspiration';
|
|
2
1
|
export declare class Deletion {
|
|
3
2
|
static className: () => string;
|
|
4
|
-
disabled?: boolean;
|
|
5
3
|
isDeleting: boolean;
|
|
6
4
|
setIsDeleting(isDeleting: boolean): void;
|
|
7
5
|
delete(args: {
|
|
8
6
|
itemIds: string[];
|
|
9
7
|
moveToTrash?: boolean;
|
|
10
8
|
}): Promise<any>;
|
|
9
|
+
protected deleteItems(args: {
|
|
10
|
+
itemIds: string[];
|
|
11
|
+
moveToTrash?: boolean;
|
|
12
|
+
}): any;
|
|
11
13
|
}
|
|
12
|
-
type Cbs = {
|
|
13
|
-
delete: {
|
|
14
|
-
deleteItems(): any;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export type DeletionCbs = DefineCbs<Deletion, Cbs>;
|
|
18
|
-
export {};
|
package/facets/Deletion.js
CHANGED
|
@@ -4,16 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { getCallbacks, withCbs } from 'aspiration';
|
|
8
7
|
import { data, operation } from 'skandha';
|
|
9
|
-
class Deletion {
|
|
8
|
+
export class Deletion {
|
|
10
9
|
constructor() {
|
|
11
|
-
Object.defineProperty(this, "disabled", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: undefined
|
|
16
|
-
});
|
|
17
10
|
Object.defineProperty(this, "isDeleting", {
|
|
18
11
|
enumerable: true,
|
|
19
12
|
configurable: true,
|
|
@@ -25,13 +18,15 @@ class Deletion {
|
|
|
25
18
|
this.isDeleting = isDeleting;
|
|
26
19
|
}
|
|
27
20
|
delete(args) {
|
|
28
|
-
const cbs = getCallbacks(this);
|
|
29
21
|
this.setIsDeleting(true);
|
|
30
|
-
return Promise.resolve(
|
|
22
|
+
return Promise.resolve(this.deleteItems(args)).then((response) => {
|
|
31
23
|
this.setIsDeleting(false);
|
|
32
24
|
return response;
|
|
33
25
|
});
|
|
34
26
|
}
|
|
27
|
+
deleteItems(args) {
|
|
28
|
+
// Override this method in child classes
|
|
29
|
+
}
|
|
35
30
|
}
|
|
36
31
|
Object.defineProperty(Deletion, "className", {
|
|
37
32
|
enumerable: true,
|
|
@@ -39,9 +34,6 @@ Object.defineProperty(Deletion, "className", {
|
|
|
39
34
|
writable: true,
|
|
40
35
|
value: () => 'Deletion'
|
|
41
36
|
});
|
|
42
|
-
__decorate([
|
|
43
|
-
data
|
|
44
|
-
], Deletion.prototype, "disabled", void 0);
|
|
45
37
|
__decorate([
|
|
46
38
|
data
|
|
47
39
|
], Deletion.prototype, "isDeleting", void 0);
|
|
@@ -49,7 +41,5 @@ __decorate([
|
|
|
49
41
|
operation({ log: false })
|
|
50
42
|
], Deletion.prototype, "setIsDeleting", null);
|
|
51
43
|
__decorate([
|
|
52
|
-
operation
|
|
53
|
-
withCbs()
|
|
44
|
+
operation
|
|
54
45
|
], Deletion.prototype, "delete", null);
|
|
55
|
-
export { Deletion };
|
package/facets/Display.js
CHANGED
|
@@ -4,10 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { stub } from '
|
|
8
|
-
import { data, output } from 'skandha';
|
|
7
|
+
import { data, output, stub } from 'skandha';
|
|
9
8
|
import { listToItemById } from '../internal/utils';
|
|
10
|
-
class Display {
|
|
9
|
+
export class Display {
|
|
11
10
|
constructor() {
|
|
12
11
|
Object.defineProperty(this, "items", {
|
|
13
12
|
enumerable: true,
|
|
@@ -33,4 +32,3 @@ __decorate([
|
|
|
33
32
|
__decorate([
|
|
34
33
|
output
|
|
35
34
|
], Display.prototype, "itemById", null);
|
|
36
|
-
export { Display };
|
package/facets/DragAndDrop.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefineCbs } from 'aspiration';
|
|
2
1
|
import { HoverPositionT } from './Hovering';
|
|
3
2
|
export declare class DragAndDrop {
|
|
4
3
|
static className: () => string;
|
|
@@ -7,11 +6,7 @@ export declare class DragAndDrop {
|
|
|
7
6
|
drop(args: {
|
|
8
7
|
hoverPosition: HoverPositionT;
|
|
9
8
|
}): Promise<any>;
|
|
9
|
+
protected performDrop(args: {
|
|
10
|
+
hoverPosition: HoverPositionT;
|
|
11
|
+
}): any;
|
|
10
12
|
}
|
|
11
|
-
type Cbs = {
|
|
12
|
-
drop: {
|
|
13
|
-
drop(): void;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export type DragAndDropCbs = DefineCbs<DragAndDrop, Cbs>;
|
|
17
|
-
export {};
|
package/facets/DragAndDrop.js
CHANGED
|
@@ -4,15 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { getCallbacks, withCbs } from 'aspiration';
|
|
8
7
|
import { data, operation } from 'skandha';
|
|
9
8
|
import { selectionIsInsertedOnDragAndDrop } from '../policies/selectionIsInsertedOnDragAndDrop';
|
|
10
|
-
|
|
11
|
-
drop: function () {
|
|
12
|
-
selectionIsInsertedOnDragAndDrop(dragAndDrop, this.args.hoverPosition);
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
class DragAndDrop {
|
|
9
|
+
export class DragAndDrop {
|
|
16
10
|
constructor() {
|
|
17
11
|
Object.defineProperty(this, "isDropping", {
|
|
18
12
|
enumerable: true,
|
|
@@ -25,13 +19,15 @@ class DragAndDrop {
|
|
|
25
19
|
this.isDropping = isDropping;
|
|
26
20
|
}
|
|
27
21
|
drop(args) {
|
|
28
|
-
const cbs = getCallbacks(this);
|
|
29
22
|
this.setIsDropping(true);
|
|
30
|
-
return Promise.resolve(
|
|
23
|
+
return Promise.resolve(this.performDrop(args)).then((response) => {
|
|
31
24
|
this.setIsDropping(false);
|
|
32
25
|
return response;
|
|
33
26
|
});
|
|
34
27
|
}
|
|
28
|
+
performDrop(args) {
|
|
29
|
+
selectionIsInsertedOnDragAndDrop(this, args.hoverPosition);
|
|
30
|
+
}
|
|
35
31
|
}
|
|
36
32
|
Object.defineProperty(DragAndDrop, "className", {
|
|
37
33
|
enumerable: true,
|
|
@@ -46,7 +42,5 @@ __decorate([
|
|
|
46
42
|
operation({ log: false })
|
|
47
43
|
], DragAndDrop.prototype, "setIsDropping", null);
|
|
48
44
|
__decorate([
|
|
49
|
-
operation
|
|
50
|
-
withCbs(dropDefaultCbs)
|
|
45
|
+
operation
|
|
51
46
|
], DragAndDrop.prototype, "drop", null);
|
|
52
|
-
export { DragAndDrop };
|
package/facets/Edit.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefineCbs } from 'aspiration';
|
|
2
1
|
export declare class Edit {
|
|
3
2
|
static className: () => string;
|
|
4
3
|
isEditing: boolean;
|
|
@@ -10,16 +9,9 @@ export declare class Edit {
|
|
|
10
9
|
}): Promise<any>;
|
|
11
10
|
cancel(): void;
|
|
12
11
|
enable(): void;
|
|
12
|
+
protected saveItem(args: {
|
|
13
|
+
values: any;
|
|
14
|
+
}): any;
|
|
15
|
+
protected onCancel(): void;
|
|
16
|
+
protected onEnable(): void;
|
|
13
17
|
}
|
|
14
|
-
export type Cbs = {
|
|
15
|
-
save: {
|
|
16
|
-
saveItem(): any;
|
|
17
|
-
};
|
|
18
|
-
cancel: {
|
|
19
|
-
onCancel(): void;
|
|
20
|
-
};
|
|
21
|
-
enable: {
|
|
22
|
-
onEnable(): void;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export type EditCbs = DefineCbs<Edit, Cbs>;
|
package/facets/Edit.js
CHANGED
|
@@ -4,9 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { getCallbacks, withCbs } from 'aspiration';
|
|
8
7
|
import { data, operation } from 'skandha';
|
|
9
|
-
class Edit {
|
|
8
|
+
export class Edit {
|
|
10
9
|
constructor() {
|
|
11
10
|
Object.defineProperty(this, "isEditing", {
|
|
12
11
|
enumerable: true,
|
|
@@ -28,28 +27,34 @@ class Edit {
|
|
|
28
27
|
this.isSaving = isSaving;
|
|
29
28
|
}
|
|
30
29
|
save(args) {
|
|
31
|
-
const cbs = getCallbacks(this);
|
|
32
30
|
this.setIsSaving(true);
|
|
33
|
-
return Promise.resolve(
|
|
31
|
+
return Promise.resolve(this.saveItem(args)).then((savedObj) => {
|
|
34
32
|
this.reset();
|
|
35
33
|
this.setIsSaving(false);
|
|
36
34
|
return savedObj;
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
37
|
cancel() {
|
|
40
|
-
const cbs = getCallbacks(this);
|
|
41
38
|
if (this.isEditing) {
|
|
42
39
|
this.reset();
|
|
43
|
-
|
|
40
|
+
this.onCancel();
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
enable() {
|
|
47
|
-
const cbs = getCallbacks(this);
|
|
48
44
|
if (!this.isEditing) {
|
|
49
45
|
this.isEditing = true;
|
|
50
|
-
|
|
46
|
+
this.onEnable();
|
|
51
47
|
}
|
|
52
48
|
}
|
|
49
|
+
saveItem(args) {
|
|
50
|
+
// Override this method in child classes
|
|
51
|
+
}
|
|
52
|
+
onCancel() {
|
|
53
|
+
// Override this method in child classes if needed
|
|
54
|
+
}
|
|
55
|
+
onEnable() {
|
|
56
|
+
// Override this method in child classes if needed
|
|
57
|
+
}
|
|
53
58
|
}
|
|
54
59
|
Object.defineProperty(Edit, "className", {
|
|
55
60
|
enumerable: true,
|
|
@@ -70,15 +75,11 @@ __decorate([
|
|
|
70
75
|
operation({ log: false })
|
|
71
76
|
], Edit.prototype, "setIsSaving", null);
|
|
72
77
|
__decorate([
|
|
73
|
-
operation
|
|
74
|
-
withCbs()
|
|
78
|
+
operation
|
|
75
79
|
], Edit.prototype, "save", null);
|
|
76
80
|
__decorate([
|
|
77
|
-
operation
|
|
78
|
-
withCbs()
|
|
81
|
+
operation
|
|
79
82
|
], Edit.prototype, "cancel", null);
|
|
80
83
|
__decorate([
|
|
81
|
-
operation
|
|
82
|
-
withCbs()
|
|
84
|
+
operation
|
|
83
85
|
], Edit.prototype, "enable", null);
|
|
84
|
-
export { Edit };
|
package/facets/Filtering.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefineCbs } from 'aspiration';
|
|
2
1
|
export type FilterT<T> = (x: T[]) => T[];
|
|
3
2
|
export declare class Filtering<T = any> {
|
|
4
3
|
static className: () => string;
|
|
@@ -13,9 +12,3 @@ export declare class Filtering<T = any> {
|
|
|
13
12
|
flag: boolean;
|
|
14
13
|
}): void;
|
|
15
14
|
}
|
|
16
|
-
type Cbs<T> = {
|
|
17
|
-
apply: {};
|
|
18
|
-
setEnabled: {};
|
|
19
|
-
};
|
|
20
|
-
export type FilteringCbs<T = any> = DefineCbs<Filtering<T>, Cbs<T>>;
|
|
21
|
-
export {};
|
package/facets/Filtering.js
CHANGED
|
@@ -4,9 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
class Filtering {
|
|
7
|
+
import { data, operation, stub } from "skandha";
|
|
8
|
+
export class Filtering {
|
|
10
9
|
constructor() {
|
|
11
10
|
Object.defineProperty(this, "isEnabled", {
|
|
12
11
|
enumerable: true,
|
|
@@ -42,7 +41,7 @@ Object.defineProperty(Filtering, "className", {
|
|
|
42
41
|
enumerable: true,
|
|
43
42
|
configurable: true,
|
|
44
43
|
writable: true,
|
|
45
|
-
value: () =>
|
|
44
|
+
value: () => "Filtering"
|
|
46
45
|
});
|
|
47
46
|
__decorate([
|
|
48
47
|
data
|
|
@@ -57,11 +56,8 @@ __decorate([
|
|
|
57
56
|
data
|
|
58
57
|
], Filtering.prototype, "filteredItems", null);
|
|
59
58
|
__decorate([
|
|
60
|
-
operation
|
|
61
|
-
withCbs()
|
|
59
|
+
operation
|
|
62
60
|
], Filtering.prototype, "apply", null);
|
|
63
61
|
__decorate([
|
|
64
|
-
operation
|
|
65
|
-
withCbs()
|
|
62
|
+
operation
|
|
66
63
|
], Filtering.prototype, "setEnabled", null);
|
|
67
|
-
export { Filtering };
|
package/facets/Highlight.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefineCbs } from 'aspiration';
|
|
2
1
|
export declare class Highlight<T = any> {
|
|
3
2
|
static className: () => string;
|
|
4
3
|
highlightableIds: Array<string>;
|
|
@@ -7,11 +6,8 @@ export declare class Highlight<T = any> {
|
|
|
7
6
|
set(args: {
|
|
8
7
|
itemId: string | undefined;
|
|
9
8
|
}): void;
|
|
9
|
+
protected onSet(args: {
|
|
10
|
+
itemId: string | undefined;
|
|
11
|
+
}): void;
|
|
12
|
+
protected scrollItemIntoView(): void;
|
|
10
13
|
}
|
|
11
|
-
type Cbs<T> = {
|
|
12
|
-
set: {
|
|
13
|
-
scrollItemIntoView(): void;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export type HighlightCbs<T = any> = DefineCbs<Highlight<T>, Cbs<T>>;
|
|
17
|
-
export {};
|
package/facets/Highlight.js
CHANGED
|
@@ -4,10 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const highlightItemDefaultCbs = (highlight) => ({});
|
|
10
|
-
class Highlight {
|
|
7
|
+
import { data, input, operation, output, stub } from 'skandha';
|
|
8
|
+
export class Highlight {
|
|
11
9
|
constructor() {
|
|
12
10
|
Object.defineProperty(this, "highlightableIds", {
|
|
13
11
|
enumerable: true,
|
|
@@ -29,9 +27,15 @@ class Highlight {
|
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
29
|
set(args) {
|
|
32
|
-
|
|
30
|
+
this.onSet(args);
|
|
33
31
|
this.itemId = args.itemId;
|
|
34
|
-
|
|
32
|
+
this.scrollItemIntoView();
|
|
33
|
+
}
|
|
34
|
+
onSet(args) {
|
|
35
|
+
// Override this method in child classes if needed
|
|
36
|
+
}
|
|
37
|
+
scrollItemIntoView() {
|
|
38
|
+
// Override this method in child classes if needed
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
Object.defineProperty(Highlight, "className", {
|
|
@@ -50,7 +54,5 @@ __decorate([
|
|
|
50
54
|
output
|
|
51
55
|
], Highlight.prototype, "item", void 0);
|
|
52
56
|
__decorate([
|
|
53
|
-
operation
|
|
54
|
-
withCbs(highlightItemDefaultCbs)
|
|
57
|
+
operation
|
|
55
58
|
], Highlight.prototype, "set", null);
|
|
56
|
-
export { Highlight };
|
package/facets/Hovering.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 { data, operation } from 'skandha';
|
|
8
|
-
class Hovering {
|
|
8
|
+
export class Hovering {
|
|
9
9
|
constructor() {
|
|
10
10
|
Object.defineProperty(this, "hoverPosition", {
|
|
11
11
|
enumerable: true,
|
|
@@ -30,4 +30,3 @@ __decorate([
|
|
|
30
30
|
__decorate([
|
|
31
31
|
operation({ log: false })
|
|
32
32
|
], Hovering.prototype, "setHoverPosition", null);
|
|
33
|
-
export { Hovering };
|
package/facets/Insertion.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefineCbs } from 'aspiration';
|
|
2
1
|
import { HoverPositionT } from './Hovering';
|
|
3
2
|
export type DragSourceT = (ctr: any) => HoverPositionT | undefined;
|
|
4
3
|
export declare class Insertion<T = any> {
|
|
@@ -10,11 +9,5 @@ export declare class Insertion<T = any> {
|
|
|
10
9
|
insertItems(args: {
|
|
11
10
|
hoverPosition: HoverPositionT;
|
|
12
11
|
}): Promise<any>;
|
|
12
|
+
protected performInsertion(preview: Array<T>): any;
|
|
13
13
|
}
|
|
14
|
-
type Cbs<T> = {
|
|
15
|
-
insertItems: {
|
|
16
|
-
insertItems(preview: Array<T>): any;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export type InsertionCbs<T = any> = DefineCbs<Insertion<T>, Cbs<T>>;
|
|
20
|
-
export {};
|
package/facets/Insertion.js
CHANGED
|
@@ -4,10 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
import { data, input, operation, output } from 'skandha';
|
|
7
|
+
import { data, input, operation, output, stub } from 'skandha';
|
|
9
8
|
import { getPreview } from '../lib/getPreview';
|
|
10
|
-
class Insertion {
|
|
9
|
+
export class Insertion {
|
|
11
10
|
constructor() {
|
|
12
11
|
Object.defineProperty(this, "isInserting", {
|
|
13
12
|
enumerable: true,
|
|
@@ -32,17 +31,19 @@ class Insertion {
|
|
|
32
31
|
this.isInserting = isInserting;
|
|
33
32
|
}
|
|
34
33
|
insertItems(args) {
|
|
35
|
-
const cbs = getCallbacks(this);
|
|
36
34
|
if (this.inputItems) {
|
|
37
35
|
this.setIsInserting(true);
|
|
38
36
|
const preview = getPreview(this.inputItems, args.hoverPosition.targetItemId, args.hoverPosition.isBefore, args.hoverPosition.payload);
|
|
39
|
-
return Promise.resolve(
|
|
37
|
+
return Promise.resolve(this.performInsertion(preview)).then((response) => {
|
|
40
38
|
this.setIsInserting(false);
|
|
41
39
|
return response;
|
|
42
40
|
});
|
|
43
41
|
}
|
|
44
42
|
return Promise.resolve();
|
|
45
43
|
}
|
|
44
|
+
performInsertion(preview) {
|
|
45
|
+
// Override this method in child classes
|
|
46
|
+
}
|
|
46
47
|
}
|
|
47
48
|
Object.defineProperty(Insertion, "className", {
|
|
48
49
|
enumerable: true,
|
|
@@ -63,7 +64,5 @@ __decorate([
|
|
|
63
64
|
operation({ log: false })
|
|
64
65
|
], Insertion.prototype, "setIsInserting", null);
|
|
65
66
|
__decorate([
|
|
66
|
-
operation
|
|
67
|
-
withCbs()
|
|
67
|
+
operation
|
|
68
68
|
], Insertion.prototype, "insertItems", null);
|
|
69
|
-
export { Insertion };
|
package/facets/Selection.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefineCbs } from 'aspiration';
|
|
2
1
|
export declare class Selection<T = any> {
|
|
3
2
|
static className: () => string;
|
|
4
3
|
selectableIds: Array<string>;
|
|
@@ -11,16 +10,15 @@ export declare class Selection<T = any> {
|
|
|
11
10
|
isCtrl?: boolean;
|
|
12
11
|
context?: any;
|
|
13
12
|
}): void;
|
|
13
|
+
protected performSelection(args: {
|
|
14
|
+
itemId: string | undefined;
|
|
15
|
+
isShift?: boolean;
|
|
16
|
+
isCtrl?: boolean;
|
|
17
|
+
context?: any;
|
|
18
|
+
}): void;
|
|
14
19
|
}
|
|
15
|
-
type Cbs<T> = {
|
|
16
|
-
selectItem: {
|
|
17
|
-
selectItem(): void;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export type SelectionCbs<T = any> = DefineCbs<Selection<T>, Cbs<T>>;
|
|
21
20
|
export declare function handleSelectItem(facet: Selection, args: {
|
|
22
21
|
itemId: string | undefined;
|
|
23
22
|
isShift?: boolean;
|
|
24
23
|
isCtrl?: boolean;
|
|
25
24
|
}): void;
|
|
26
|
-
export {};
|
package/facets/Selection.js
CHANGED
|
@@ -4,15 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
import { data, input, operation, output } from 'skandha';
|
|
7
|
+
import { data, input, operation, output, stub } from 'skandha';
|
|
9
8
|
import { range } from '../internal/utils';
|
|
10
|
-
|
|
11
|
-
selectItem: function () {
|
|
12
|
-
handleSelectItem(selection, this.args);
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
class Selection {
|
|
9
|
+
export class Selection {
|
|
16
10
|
constructor() {
|
|
17
11
|
Object.defineProperty(this, "selectableIds", {
|
|
18
12
|
enumerable: true,
|
|
@@ -40,8 +34,10 @@ class Selection {
|
|
|
40
34
|
});
|
|
41
35
|
}
|
|
42
36
|
selectItem(args) {
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
this.performSelection(args);
|
|
38
|
+
}
|
|
39
|
+
performSelection(args) {
|
|
40
|
+
handleSelectItem(this, args);
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
43
|
Object.defineProperty(Selection, "className", {
|
|
@@ -63,10 +59,8 @@ __decorate([
|
|
|
63
59
|
output
|
|
64
60
|
], Selection.prototype, "items", void 0);
|
|
65
61
|
__decorate([
|
|
66
|
-
operation
|
|
67
|
-
withCbs(selectItemDefaultCbs)
|
|
62
|
+
operation
|
|
68
63
|
], Selection.prototype, "selectItem", null);
|
|
69
|
-
export { Selection };
|
|
70
64
|
export function handleSelectItem(facet, args) {
|
|
71
65
|
if (args.itemId === undefined) {
|
|
72
66
|
facet.itemIds = [];
|
package/facets/Store.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { data, operation, output } from 'skandha';
|
|
8
8
|
import { listToItemById } from '../internal/utils';
|
|
9
|
-
class Store {
|
|
9
|
+
export class Store {
|
|
10
10
|
constructor() {
|
|
11
11
|
Object.defineProperty(this, "items", {
|
|
12
12
|
enumerable: true,
|
|
@@ -38,4 +38,3 @@ __decorate([
|
|
|
38
38
|
__decorate([
|
|
39
39
|
operation
|
|
40
40
|
], Store.prototype, "setItems", null);
|
|
41
|
-
export { Store };
|
package/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export { Addition
|
|
2
|
-
export { Deletion
|
|
1
|
+
export { Addition } from './facets/Addition';
|
|
2
|
+
export { Deletion } from './facets/Deletion';
|
|
3
3
|
export { Display } from './facets/Display';
|
|
4
|
-
export { DragAndDrop
|
|
4
|
+
export { DragAndDrop } from './facets/DragAndDrop';
|
|
5
5
|
export { DragAndDropUIConnector, dragAndDropUIHandlers, type DragAndDropUIConnectorT, type DragAndDropUIPropsT, } from './facets/DragAndDropUIConnector';
|
|
6
|
-
export { Edit
|
|
7
|
-
export { Filtering
|
|
8
|
-
export { Highlight
|
|
6
|
+
export { Edit } from './facets/Edit';
|
|
7
|
+
export { Filtering } from './facets/Filtering';
|
|
8
|
+
export { Highlight } from './facets/Highlight';
|
|
9
9
|
export { HighlightUIConnector, createHighlightKeyHandlers, highlightUIHandlers, type HighlightUIConnectorT, type HighlightUIPropsT, } from './facets/HighlightUIConnector';
|
|
10
10
|
export { Hovering, type HoverPositionT } from './facets/Hovering';
|
|
11
|
-
export { Insertion
|
|
12
|
-
export { Selection, handleSelectItem
|
|
11
|
+
export { Insertion } from './facets/Insertion';
|
|
12
|
+
export { Selection, handleSelectItem } from './facets/Selection';
|
|
13
13
|
export { SelectionUIConnector, createSelectionKeyHandlers, selectionUIHandlers, type SelectionUIConnectorT, type SelectionUIPropsT, } from './facets/SelectionUIConnector';
|
|
14
14
|
export { Store } from './facets/Store';
|
|
15
15
|
export { topOfTheList } from './lib/getPreview';
|
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { Highlight } from './facets/Highlight';
|
|
|
9
9
|
export { HighlightUIConnector, createHighlightKeyHandlers, highlightUIHandlers, } from './facets/HighlightUIConnector';
|
|
10
10
|
export { Hovering } from './facets/Hovering';
|
|
11
11
|
export { Insertion } from './facets/Insertion';
|
|
12
|
-
export { Selection, handleSelectItem
|
|
12
|
+
export { Selection, handleSelectItem } from './facets/Selection';
|
|
13
13
|
export { SelectionUIConnector, createSelectionKeyHandlers, selectionUIHandlers, } from './facets/SelectionUIConnector';
|
|
14
14
|
export { Store } from './facets/Store';
|
|
15
15
|
export { topOfTheList } from './lib/getPreview';
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skandha-facets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Facets for use with the skandha library",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"default": "./index.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
6
11
|
"repository": "https://github.com/mnieber/skandha-facets.git",
|
|
7
12
|
"author": "Maarten Nieber",
|
|
8
13
|
"license": "MIT",
|
|
9
14
|
"types": "index.d.ts",
|
|
10
15
|
"prepublish": "tsc",
|
|
11
16
|
"peerDependencies": {
|
|
12
|
-
"skandha": ">=0.
|
|
13
|
-
"aspiration": ">=0.5.2"
|
|
17
|
+
"skandha": ">=0.14.0"
|
|
14
18
|
},
|
|
15
19
|
"devDependencies": {
|
|
16
20
|
"typescript": "^4.0.3"
|