skandha-facets 0.9.0 → 0.10.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/Addition.d.ts +4 -4
- package/Addition.js +11 -12
- package/AdditionCbs.d.ts +6 -6
- package/AdditionCbs.js +1 -23
- package/Deletion.d.ts +1 -2
- package/Deletion.js +3 -4
- package/DeletionCbs.d.ts +1 -1
- package/DeletionCbs.js +1 -13
- package/DragAndDrop.d.ts +16 -2
- package/DragAndDrop.js +29 -7
- package/DragAndDropCbs.d.ts +5 -5
- package/DragAndDropCbs.js +1 -13
- package/Editing.d.ts +3 -4
- package/Editing.js +6 -10
- package/EditingCbs.d.ts +7 -7
- package/EditingCbs.js +1 -18
- package/Filtering.d.ts +5 -5
- package/Filtering.js +4 -8
- package/FilteringCbs.d.ts +9 -9
- package/FilteringCbs.js +1 -23
- package/Highlight.d.ts +1 -2
- package/Highlight.js +6 -6
- package/HighlightCbs.d.ts +4 -4
- package/HighlightCbs.js +1 -13
- package/Insertion.d.ts +2 -2
- package/Insertion.js +9 -9
- package/InsertionCbs.d.ts +6 -6
- package/InsertionCbs.js +1 -13
- package/Labelling.d.ts +2 -2
- package/Labelling.js +14 -14
- package/LabellingCbs.d.ts +5 -5
- package/LabellingCbs.js +1 -13
- package/Selection.d.ts +2 -2
- package/Selection.js +5 -6
- package/SelectionCbs.d.ts +4 -4
- package/SelectionCbs.js +1 -13
- package/handlers/ClickToSelectItems.d.ts +10 -0
- package/handlers/ClickToSelectItems.js +7 -0
- package/package.json +3 -3
package/Addition.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GenericObjectT } from './AdditionCbs';
|
|
2
2
|
export type { AdditionCbs } from './AdditionCbs';
|
|
3
3
|
export declare class Addition<ValueT = any> {
|
|
4
4
|
static className: () => string;
|
|
5
5
|
item?: ValueT;
|
|
6
6
|
parentId?: string;
|
|
7
|
-
add(values: GenericObjectT):
|
|
8
|
-
confirm():
|
|
9
|
-
cancel():
|
|
7
|
+
add(values: GenericObjectT): Promise<void>;
|
|
8
|
+
confirm(): Promise<void>;
|
|
9
|
+
cancel(): void;
|
|
10
10
|
_reset(): void;
|
|
11
11
|
}
|
package/Addition.js
CHANGED
|
@@ -4,7 +4,7 @@ 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 { host } from 'aspiration';
|
|
7
|
+
import { getCallbacks, host } from 'aspiration';
|
|
8
8
|
import { data, operation } from 'skandha';
|
|
9
9
|
export class Addition {
|
|
10
10
|
constructor() {
|
|
@@ -22,23 +22,22 @@ export class Addition {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
add(values) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const cbs = getCallbacks(this);
|
|
26
|
+
cbs.storeLocation && cbs.storeLocation();
|
|
27
|
+
return Promise.resolve(cbs.createItem()).then((item) => {
|
|
28
|
+
this.item = item;
|
|
28
29
|
cbs.highlightNewItem && cbs.highlightNewItem();
|
|
29
|
-
};
|
|
30
|
+
});
|
|
30
31
|
}
|
|
31
32
|
confirm() {
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const cbs = getCallbacks(this);
|
|
34
|
+
return Promise.resolve(cbs.confirm()).then(() => {
|
|
34
35
|
this._reset();
|
|
35
|
-
};
|
|
36
|
+
});
|
|
36
37
|
}
|
|
37
38
|
cancel() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
cbs.restoreLocation && cbs.restoreLocation();
|
|
41
|
-
};
|
|
39
|
+
const cbs = getCallbacks(this);
|
|
40
|
+
cbs.restoreLocation && cbs.restoreLocation();
|
|
42
41
|
}
|
|
43
42
|
_reset() {
|
|
44
43
|
this.item = undefined;
|
package/AdditionCbs.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Cbs } from
|
|
1
|
+
import { Cbs } from 'aspiration';
|
|
2
2
|
export declare type GenericObjectT = any;
|
|
3
|
-
export
|
|
3
|
+
export interface Addition_add<ValueT> extends Cbs {
|
|
4
4
|
values: GenericObjectT;
|
|
5
5
|
storeLocation(): void;
|
|
6
6
|
createItem(): ValueT;
|
|
7
7
|
highlightNewItem(): void;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export interface Addition_confirm extends Cbs {
|
|
10
10
|
confirm(): void;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export interface Addition_cancel extends Cbs {
|
|
13
13
|
restoreLocation(): void;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export interface AdditionCbs<ValueT = any> {
|
|
16
16
|
add: Addition_add<ValueT>;
|
|
17
17
|
confirm: Addition_confirm;
|
|
18
18
|
cancel: Addition_cancel;
|
|
19
|
-
}
|
|
19
|
+
}
|
package/AdditionCbs.js
CHANGED
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class Addition_add extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "values", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: void 0
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
storeLocation() { }
|
|
13
|
-
createItem() {
|
|
14
|
-
return stub();
|
|
15
|
-
}
|
|
16
|
-
highlightNewItem() { }
|
|
17
|
-
}
|
|
18
|
-
export class Addition_confirm extends Cbs {
|
|
19
|
-
confirm() { }
|
|
20
|
-
}
|
|
21
|
-
export class Addition_cancel extends Cbs {
|
|
22
|
-
restoreLocation() { }
|
|
23
|
-
}
|
|
1
|
+
export {};
|
package/Deletion.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { DeletionCbs } from './DeletionCbs';
|
|
2
1
|
export type { DeletionCbs } from './DeletionCbs';
|
|
3
2
|
export declare class Deletion {
|
|
4
3
|
static className: () => string;
|
|
5
|
-
delete(itemIds: string[]):
|
|
4
|
+
delete(itemIds: string[]): Promise<any>;
|
|
6
5
|
}
|
package/Deletion.js
CHANGED
|
@@ -4,13 +4,12 @@ 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 { host } from 'aspiration';
|
|
7
|
+
import { getCallbacks, host } from 'aspiration';
|
|
8
8
|
import { operation } from 'skandha';
|
|
9
9
|
export class Deletion {
|
|
10
10
|
delete(itemIds) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
11
|
+
const cbs = getCallbacks(this);
|
|
12
|
+
return Promise.resolve(cbs.deleteItems());
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
Object.defineProperty(Deletion, "className", {
|
package/DeletionCbs.d.ts
CHANGED
package/DeletionCbs.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class Deletion_delete extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "itemIds", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: stub()
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
deleteItems() { }
|
|
13
|
-
}
|
|
1
|
+
export {};
|
package/DragAndDrop.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { DragAndDropCbs } from './DragAndDropCbs';
|
|
2
1
|
import { DropPositionT } from './Insertion';
|
|
3
2
|
export type { DragAndDropCbs } from './DragAndDropCbs';
|
|
4
3
|
export declare class DragAndDrop {
|
|
5
4
|
static className: () => string;
|
|
6
5
|
hoverPosition?: DropPositionT;
|
|
7
|
-
drop(dropPosition: DropPositionT):
|
|
6
|
+
drop(dropPosition: DropPositionT): Promise<void>;
|
|
8
7
|
setHoverPosition(x?: DropPositionT): void;
|
|
9
8
|
handle(itemId: string): {
|
|
10
9
|
draggable: boolean;
|
|
@@ -14,3 +13,18 @@ export declare class DragAndDrop {
|
|
|
14
13
|
onDrop: () => void;
|
|
15
14
|
};
|
|
16
15
|
}
|
|
16
|
+
export declare type DragHandlersT = {
|
|
17
|
+
draggable?: boolean;
|
|
18
|
+
onDragStart?: (event: any) => void;
|
|
19
|
+
onDragOver?: (event: any) => void;
|
|
20
|
+
onDragEnd?: (event: any) => void;
|
|
21
|
+
onDrop?: (event: any) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare function dragState(hoverPosition: any, itemId: string): "before" | "after" | "none";
|
|
24
|
+
export declare function dragHandlers<T extends DragHandlersT>(props: T): {
|
|
25
|
+
draggable: boolean | undefined;
|
|
26
|
+
onDragStart: ((event: any) => void) | undefined;
|
|
27
|
+
onDragOver: ((event: any) => void) | undefined;
|
|
28
|
+
onDrop: ((event: any) => void) | undefined;
|
|
29
|
+
onDragEnd: ((event: any) => void) | undefined;
|
|
30
|
+
};
|
package/DragAndDrop.js
CHANGED
|
@@ -4,9 +4,15 @@ 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 { host } from 'aspiration';
|
|
7
|
+
import { getCallbacks, host } from 'aspiration';
|
|
8
8
|
import { data, operation } from 'skandha';
|
|
9
9
|
import { isBefore } from './internal/utils';
|
|
10
|
+
import { selectionIsInsertedOnDragAndDrop } from './policies/selectionIsInsertedOnDragAndDrop';
|
|
11
|
+
const dropDefaultCbs = (dragAndDrop) => ({
|
|
12
|
+
drop: function () {
|
|
13
|
+
selectionIsInsertedOnDragAndDrop(dragAndDrop, this.dropPosition);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
10
16
|
export class DragAndDrop {
|
|
11
17
|
constructor() {
|
|
12
18
|
Object.defineProperty(this, "hoverPosition", {
|
|
@@ -17,9 +23,8 @@ export class DragAndDrop {
|
|
|
17
23
|
});
|
|
18
24
|
}
|
|
19
25
|
drop(dropPosition) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
26
|
+
const cbs = getCallbacks(this);
|
|
27
|
+
return Promise.resolve(cbs.drop());
|
|
23
28
|
}
|
|
24
29
|
setHoverPosition(x) {
|
|
25
30
|
this.hoverPosition = x;
|
|
@@ -40,8 +45,9 @@ export class DragAndDrop {
|
|
|
40
45
|
},
|
|
41
46
|
onDrop: () => {
|
|
42
47
|
if (this.hoverPosition) {
|
|
43
|
-
this.drop(this.hoverPosition)
|
|
44
|
-
|
|
48
|
+
this.drop(this.hoverPosition).then(() => {
|
|
49
|
+
this.setHoverPosition(undefined);
|
|
50
|
+
});
|
|
45
51
|
}
|
|
46
52
|
},
|
|
47
53
|
};
|
|
@@ -58,8 +64,24 @@ __decorate([
|
|
|
58
64
|
], DragAndDrop.prototype, "hoverPosition", void 0);
|
|
59
65
|
__decorate([
|
|
60
66
|
operation,
|
|
61
|
-
host(['dropPosition'])
|
|
67
|
+
host(['dropPosition'], dropDefaultCbs)
|
|
62
68
|
], DragAndDrop.prototype, "drop", null);
|
|
63
69
|
__decorate([
|
|
64
70
|
operation({ log: false })
|
|
65
71
|
], DragAndDrop.prototype, "setHoverPosition", null);
|
|
72
|
+
export function dragState(hoverPosition, itemId) {
|
|
73
|
+
return (hoverPosition === null || hoverPosition === void 0 ? void 0 : hoverPosition.targetItemId) === itemId
|
|
74
|
+
? (hoverPosition === null || hoverPosition === void 0 ? void 0 : hoverPosition.isBefore)
|
|
75
|
+
? 'before'
|
|
76
|
+
: 'after'
|
|
77
|
+
: 'none';
|
|
78
|
+
}
|
|
79
|
+
export function dragHandlers(props) {
|
|
80
|
+
return {
|
|
81
|
+
draggable: props.draggable,
|
|
82
|
+
onDragStart: props.onDragStart,
|
|
83
|
+
onDragOver: props.onDragOver,
|
|
84
|
+
onDrop: props.onDrop,
|
|
85
|
+
onDragEnd: props.onDragEnd,
|
|
86
|
+
};
|
|
87
|
+
}
|
package/DragAndDropCbs.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Cbs } from
|
|
2
|
-
import { DropPositionT } from
|
|
3
|
-
export
|
|
1
|
+
import { Cbs } from 'aspiration';
|
|
2
|
+
import { DropPositionT } from './Insertion';
|
|
3
|
+
export interface DragAndDrop_drop extends Cbs {
|
|
4
4
|
dropPosition: DropPositionT;
|
|
5
5
|
drop(): void;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export interface DragAndDropCbs {
|
|
8
8
|
drop: DragAndDrop_drop;
|
|
9
|
-
}
|
|
9
|
+
}
|
package/DragAndDropCbs.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class DragAndDrop_drop extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "dropPosition", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: stub()
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
drop() { }
|
|
13
|
-
}
|
|
1
|
+
export {};
|
package/Editing.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { EditingCbs } from './EditingCbs';
|
|
2
1
|
export type { EditingCbs } from './EditingCbs';
|
|
3
2
|
export declare class Editing {
|
|
4
3
|
static className: () => string;
|
|
5
4
|
isEditing: boolean;
|
|
6
|
-
save(values: any):
|
|
7
|
-
cancel():
|
|
8
|
-
enable():
|
|
5
|
+
save(values: any): Promise<void>;
|
|
6
|
+
cancel(): void;
|
|
7
|
+
enable(): void;
|
|
9
8
|
}
|
package/Editing.js
CHANGED
|
@@ -4,7 +4,7 @@ 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 { host } from 'aspiration';
|
|
7
|
+
import { getCallbacks, host } from 'aspiration';
|
|
8
8
|
import { data, operation } from 'skandha';
|
|
9
9
|
export class Editing {
|
|
10
10
|
constructor() {
|
|
@@ -16,21 +16,17 @@ export class Editing {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
save(values) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const cbs = getCallbacks(this);
|
|
20
|
+
return Promise.resolve(cbs.saveItem()).then(() => {
|
|
21
21
|
this.isEditing = false;
|
|
22
22
|
cbs.refreshView && cbs.refreshView();
|
|
23
|
-
};
|
|
23
|
+
});
|
|
24
24
|
}
|
|
25
25
|
cancel() {
|
|
26
|
-
|
|
27
|
-
this.isEditing = false;
|
|
28
|
-
};
|
|
26
|
+
this.isEditing = false;
|
|
29
27
|
}
|
|
30
28
|
enable() {
|
|
31
|
-
|
|
32
|
-
this.isEditing = true;
|
|
33
|
-
};
|
|
29
|
+
this.isEditing = true;
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
32
|
Object.defineProperty(Editing, "className", {
|
package/EditingCbs.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Cbs } from
|
|
2
|
-
export
|
|
1
|
+
import type { Cbs } from 'aspiration';
|
|
2
|
+
export interface Editing_save extends Cbs {
|
|
3
3
|
values: any;
|
|
4
|
-
saveItem():
|
|
4
|
+
saveItem(): any;
|
|
5
5
|
refreshView(): void;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export interface Editing_cancel extends Cbs {
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export interface Editing_enable extends Cbs {
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export interface EditingCbs {
|
|
12
12
|
save: Editing_save;
|
|
13
13
|
cancel: Editing_cancel;
|
|
14
14
|
enable: Editing_enable;
|
|
15
|
-
}
|
|
15
|
+
}
|
package/EditingCbs.js
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class Editing_save extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "values", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: void 0
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
saveItem() { }
|
|
13
|
-
refreshView() { }
|
|
14
|
-
}
|
|
15
|
-
export class Editing_cancel extends Cbs {
|
|
16
|
-
}
|
|
17
|
-
export class Editing_enable extends Cbs {
|
|
18
|
-
}
|
|
1
|
+
export {};
|
package/Filtering.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FilterT } from './FilteringCbs';
|
|
2
2
|
export type { FilteringCbs } from './FilteringCbs';
|
|
3
3
|
export declare class Filtering<ValueT = any> {
|
|
4
4
|
static className: () => string;
|
|
5
5
|
isEnabled: boolean;
|
|
6
|
-
filter: FilterT
|
|
6
|
+
filter: FilterT<ValueT>;
|
|
7
7
|
inputItems: Array<ValueT>;
|
|
8
|
-
get filteredItems():
|
|
9
|
-
apply(filter: FilterT):
|
|
10
|
-
setEnabled(flag: boolean):
|
|
8
|
+
get filteredItems(): ValueT[];
|
|
9
|
+
apply(filter: FilterT<ValueT>): void;
|
|
10
|
+
setEnabled(flag: boolean): void;
|
|
11
11
|
}
|
package/Filtering.js
CHANGED
|
@@ -24,22 +24,18 @@ export class Filtering {
|
|
|
24
24
|
enumerable: true,
|
|
25
25
|
configurable: true,
|
|
26
26
|
writable: true,
|
|
27
|
-
value: stub
|
|
27
|
+
value: stub
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
get filteredItems() {
|
|
31
31
|
return this.isEnabled ? this.filter(this.inputItems) : this.inputItems;
|
|
32
32
|
}
|
|
33
33
|
apply(filter) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.setEnabled(true);
|
|
37
|
-
};
|
|
34
|
+
this.filter = filter;
|
|
35
|
+
this.setEnabled(true);
|
|
38
36
|
}
|
|
39
37
|
setEnabled(flag) {
|
|
40
|
-
|
|
41
|
-
this.isEnabled = flag;
|
|
42
|
-
};
|
|
38
|
+
this.isEnabled = flag;
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
41
|
Object.defineProperty(Filtering, "className", {
|
package/FilteringCbs.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Cbs } from
|
|
2
|
-
export declare type FilterT = (x:
|
|
3
|
-
export
|
|
4
|
-
filter: FilterT
|
|
1
|
+
import { Cbs } from 'aspiration';
|
|
2
|
+
export declare type FilterT<ValueT> = (x: ValueT[]) => ValueT[];
|
|
3
|
+
export interface Filtering_apply<ValueT> extends Cbs {
|
|
4
|
+
filter: FilterT<ValueT>;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export interface Filtering_setEnabled<ValueT> extends Cbs {
|
|
7
7
|
flag: boolean;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
10
|
-
apply: Filtering_apply
|
|
11
|
-
setEnabled: Filtering_setEnabled
|
|
12
|
-
}
|
|
9
|
+
export interface FilteringCbs<ValueT = any> {
|
|
10
|
+
apply: Filtering_apply<ValueT>;
|
|
11
|
+
setEnabled: Filtering_setEnabled<ValueT>;
|
|
12
|
+
}
|
package/FilteringCbs.js
CHANGED
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class Filtering_apply extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "filter", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: stub()
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export class Filtering_setEnabled extends Cbs {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
Object.defineProperty(this, "flag", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: stub()
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
export {};
|
package/Highlight.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { HighlightCbs } from './HighlightCbs';
|
|
2
1
|
export type { HighlightCbs } from './HighlightCbs';
|
|
3
2
|
export declare class Highlight<ValueT = any> {
|
|
4
3
|
static className: () => string;
|
|
5
4
|
id: string | undefined;
|
|
6
5
|
item?: ValueT;
|
|
7
|
-
highlightItem(id: string
|
|
6
|
+
highlightItem(id: string | undefined): void;
|
|
8
7
|
}
|
package/Highlight.js
CHANGED
|
@@ -4,8 +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 { host } from 'aspiration';
|
|
7
|
+
import { getCallbacks, host } from 'aspiration';
|
|
8
8
|
import { data, operation, output } from 'skandha';
|
|
9
|
+
const highlightItemDefaultCbs = (highlight) => ({});
|
|
9
10
|
export class Highlight {
|
|
10
11
|
constructor() {
|
|
11
12
|
Object.defineProperty(this, "id", {
|
|
@@ -22,10 +23,9 @@ export class Highlight {
|
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
highlightItem(id) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
26
|
+
const cbs = getCallbacks(this);
|
|
27
|
+
this.id = id;
|
|
28
|
+
cbs.scrollItemIntoView && cbs.scrollItemIntoView();
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
Object.defineProperty(Highlight, "className", {
|
|
@@ -42,5 +42,5 @@ __decorate([
|
|
|
42
42
|
], Highlight.prototype, "item", void 0);
|
|
43
43
|
__decorate([
|
|
44
44
|
operation,
|
|
45
|
-
host(['id'])
|
|
45
|
+
host(['id'], highlightItemDefaultCbs)
|
|
46
46
|
], Highlight.prototype, "highlightItem", null);
|
package/HighlightCbs.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Cbs } from
|
|
2
|
-
export
|
|
1
|
+
import { Cbs } from 'aspiration';
|
|
2
|
+
export interface Highlight_highlightItem extends Cbs {
|
|
3
3
|
id: string;
|
|
4
4
|
scrollItemIntoView(): void;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export interface HighlightCbs {
|
|
7
7
|
highlightItem: Highlight_highlightItem;
|
|
8
|
-
}
|
|
8
|
+
}
|
package/HighlightCbs.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class Highlight_highlightItem extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "id", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: stub()
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
scrollItemIntoView() { }
|
|
13
|
-
}
|
|
1
|
+
export {};
|
package/Insertion.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DragT
|
|
1
|
+
import { DragT } from './InsertionCbs';
|
|
2
2
|
export type { DragT, DropPositionT, InsertionCbs } from './InsertionCbs';
|
|
3
3
|
export declare type DragSourceT = (ctr: any) => DragT | undefined;
|
|
4
4
|
export declare class Insertion<ValueT = any> {
|
|
5
5
|
static className: () => string;
|
|
6
6
|
inputItems: Array<ValueT>;
|
|
7
7
|
preview: Array<ValueT>;
|
|
8
|
-
insertItems(drag: DragT):
|
|
8
|
+
insertItems(drag: DragT): Promise<any>;
|
|
9
9
|
}
|
package/Insertion.js
CHANGED
|
@@ -4,7 +4,7 @@ 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 { host, stub } from 'aspiration';
|
|
7
|
+
import { getCallbacks, host, stub } from 'aspiration';
|
|
8
8
|
import { input, operation, output } from 'skandha';
|
|
9
9
|
import { getPreview } from './lib/getPreview';
|
|
10
10
|
export class Insertion {
|
|
@@ -13,22 +13,22 @@ export class Insertion {
|
|
|
13
13
|
enumerable: true,
|
|
14
14
|
configurable: true,
|
|
15
15
|
writable: true,
|
|
16
|
-
value: stub
|
|
16
|
+
value: stub
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(this, "preview", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
configurable: true,
|
|
21
21
|
writable: true,
|
|
22
|
-
value: stub
|
|
22
|
+
value: stub
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
insertItems(drag) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const cbs = getCallbacks(this);
|
|
27
|
+
if (this.inputItems) {
|
|
28
|
+
const preview = getPreview(this.inputItems, drag.targetItemId, drag.isBefore, drag.payload);
|
|
29
|
+
return Promise.resolve(cbs.insertItems(preview));
|
|
30
|
+
}
|
|
31
|
+
return Promise.resolve();
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
Object.defineProperty(Insertion, "className", {
|
package/InsertionCbs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cbs } from
|
|
1
|
+
import { Cbs } from 'aspiration';
|
|
2
2
|
export declare type DropPositionT = {
|
|
3
3
|
isBefore: boolean;
|
|
4
4
|
targetItemId: string;
|
|
@@ -6,10 +6,10 @@ export declare type DropPositionT = {
|
|
|
6
6
|
export declare type DragT = DropPositionT & {
|
|
7
7
|
payload: any;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export interface Insertion_insertItems<ValueT> extends Cbs {
|
|
10
10
|
drag: DragT;
|
|
11
|
-
insertItems(preview: Array<ValueT>):
|
|
11
|
+
insertItems(preview: Array<ValueT>): any;
|
|
12
|
+
}
|
|
13
|
+
export interface InsertionCbs<ValueT = any> {
|
|
14
|
+
insertItems: Insertion_insertItems<ValueT>;
|
|
12
15
|
}
|
|
13
|
-
export declare type InsertionCbs = {
|
|
14
|
-
insertItems: Insertion_insertItems;
|
|
15
|
-
};
|
package/InsertionCbs.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class Insertion_insertItems extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "drag", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: stub()
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
insertItems(preview) { }
|
|
13
|
-
}
|
|
1
|
+
export {};
|
package/Labelling.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IdsByLabelT, ItemsByLabelT,
|
|
1
|
+
import { IdsByLabelT, ItemsByLabelT, LabelValueT } from './LabellingCbs';
|
|
2
2
|
export type { LabellingCbs } from './LabellingCbs';
|
|
3
3
|
export declare class Labelling {
|
|
4
4
|
static className: () => string;
|
|
5
5
|
idsByLabel: IdsByLabelT;
|
|
6
6
|
ids: (label: string) => any[];
|
|
7
7
|
itemsByLabel: ItemsByLabelT;
|
|
8
|
-
setLabel(labelValue: LabelValueT):
|
|
8
|
+
setLabel(labelValue: LabelValueT): Promise<any>;
|
|
9
9
|
}
|
package/Labelling.js
CHANGED
|
@@ -4,7 +4,7 @@ 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 { host, stub } from 'aspiration';
|
|
7
|
+
import { getCallbacks, host, stub } from 'aspiration';
|
|
8
8
|
import { data, input, operation } from 'skandha';
|
|
9
9
|
export class Labelling {
|
|
10
10
|
constructor() {
|
|
@@ -24,22 +24,22 @@ export class Labelling {
|
|
|
24
24
|
enumerable: true,
|
|
25
25
|
configurable: true,
|
|
26
26
|
writable: true,
|
|
27
|
-
value: stub
|
|
27
|
+
value: stub
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
setLabel(labelValue) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
const cbs = getCallbacks(this);
|
|
32
|
+
const { label, id, flag } = labelValue;
|
|
33
|
+
this.idsByLabel[label] = this.idsByLabel[label] || [];
|
|
34
|
+
if (flag && !this.idsByLabel[label].includes(id)) {
|
|
35
|
+
this.idsByLabel[label].push(id);
|
|
36
|
+
return Promise.resolve(cbs.saveIds(label, this.idsByLabel[label]));
|
|
37
|
+
}
|
|
38
|
+
if (!flag && this.idsByLabel[label].includes(id)) {
|
|
39
|
+
this.idsByLabel[label] = this.idsByLabel[label].filter((x) => x !== id);
|
|
40
|
+
return Promise.resolve(cbs.saveIds(label, this.idsByLabel[label]));
|
|
41
|
+
}
|
|
42
|
+
return Promise.resolve();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
Object.defineProperty(Labelling, "className", {
|
package/LabellingCbs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cbs } from
|
|
1
|
+
import { Cbs } from 'aspiration';
|
|
2
2
|
export declare type LabelValueT = {
|
|
3
3
|
label: string;
|
|
4
4
|
id: string;
|
|
@@ -10,10 +10,10 @@ export declare type IdsByLabelT = {
|
|
|
10
10
|
export declare type ItemsByLabelT = {
|
|
11
11
|
[label: string]: Array<any>;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export interface Labelling_setLabel extends Cbs {
|
|
14
14
|
labelValue: LabelValueT;
|
|
15
|
-
saveIds(label: string, ids: string[]):
|
|
15
|
+
saveIds(label: string, ids: string[]): any;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export interface LabellingCbs {
|
|
18
18
|
setLabel: Labelling_setLabel;
|
|
19
|
-
}
|
|
19
|
+
}
|
package/LabellingCbs.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class Labelling_setLabel extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "labelValue", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: stub()
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
saveIds(label, ids) { }
|
|
13
|
-
}
|
|
1
|
+
export {};
|
package/Selection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SelectionParamsT } from './SelectionCbs';
|
|
2
2
|
export type { SelectionCbs, SelectionParamsT } from './SelectionCbs';
|
|
3
3
|
export declare class Selection<ValueT = any> {
|
|
4
4
|
static className: () => string;
|
|
@@ -6,6 +6,6 @@ export declare class Selection<ValueT = any> {
|
|
|
6
6
|
ids: Array<string>;
|
|
7
7
|
anchorId?: string;
|
|
8
8
|
items: Array<ValueT>;
|
|
9
|
-
selectItem(selectionParams: SelectionParamsT):
|
|
9
|
+
selectItem(selectionParams: SelectionParamsT): void;
|
|
10
10
|
}
|
|
11
11
|
export declare function handleSelectItem(facet: Selection, { itemId, isShift, isCtrl }: SelectionParamsT): void;
|
package/Selection.js
CHANGED
|
@@ -4,7 +4,7 @@ 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 { host, stub } from 'aspiration';
|
|
7
|
+
import { getCallbacks, host, stub } from 'aspiration';
|
|
8
8
|
import { data, input, operation, output } from 'skandha';
|
|
9
9
|
import { range } from './internal/utils';
|
|
10
10
|
const selectItemDefaultCbs = (selection) => ({
|
|
@@ -18,7 +18,7 @@ export class Selection {
|
|
|
18
18
|
enumerable: true,
|
|
19
19
|
configurable: true,
|
|
20
20
|
writable: true,
|
|
21
|
-
value: stub
|
|
21
|
+
value: stub
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(this, "ids", {
|
|
24
24
|
enumerable: true,
|
|
@@ -36,13 +36,12 @@ export class Selection {
|
|
|
36
36
|
enumerable: true,
|
|
37
37
|
configurable: true,
|
|
38
38
|
writable: true,
|
|
39
|
-
value: stub
|
|
39
|
+
value: stub
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
selectItem(selectionParams) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
43
|
+
const cbs = getCallbacks(this);
|
|
44
|
+
cbs.selectItem();
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
Object.defineProperty(Selection, "className", {
|
package/SelectionCbs.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Cbs } from
|
|
1
|
+
import { Cbs } from 'aspiration';
|
|
2
2
|
export declare type SelectionParamsT = {
|
|
3
3
|
itemId: string | undefined;
|
|
4
4
|
isShift?: boolean;
|
|
5
5
|
isCtrl?: boolean;
|
|
6
6
|
context?: any;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export interface Selection_selectItem extends Cbs {
|
|
9
9
|
selectionParams: SelectionParamsT;
|
|
10
10
|
selectItem(): void;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export interface SelectionCbs {
|
|
13
13
|
selectItem: Selection_selectItem;
|
|
14
|
-
}
|
|
14
|
+
}
|
package/SelectionCbs.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class Selection_selectItem extends Cbs {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "selectionParams", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: stub()
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
selectItem() { }
|
|
13
|
-
}
|
|
1
|
+
export {};
|
|
@@ -11,3 +11,13 @@ export declare class ClickToSelectItems {
|
|
|
11
11
|
onMouseUp: (e: any) => void;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
export declare type ClickHandlersT = {
|
|
15
|
+
onClick?: any;
|
|
16
|
+
onMouseDown?: any;
|
|
17
|
+
onMouseUp?: any;
|
|
18
|
+
};
|
|
19
|
+
export declare function clickHandlers<T extends ClickHandlersT>(props: T): {
|
|
20
|
+
onClick: any;
|
|
21
|
+
onMouseDown: any;
|
|
22
|
+
onMouseUp: any;
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skandha-facets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
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.
|
|
12
|
+
"skandha": ">=0.10.1",
|
|
13
|
+
"aspiration": ">=0.4.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "^4.0.3"
|