skandha-facets 0.6.0 → 0.8.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 +6 -5
- package/Addition.js +14 -5
- package/Deletion.d.ts +4 -3
- package/Deletion.js +11 -4
- package/DeletionCbs.d.ts +2 -2
- package/DeletionCbs.js +1 -1
- package/DragAndDrop.d.ts +5 -4
- package/DragAndDrop.js +11 -4
- package/Editing.d.ts +6 -5
- package/Editing.js +14 -5
- package/Filtering.d.ts +9 -8
- package/Filtering.js +14 -6
- package/Highlight.d.ts +5 -4
- package/Highlight.js +12 -5
- package/Insertion.d.ts +8 -7
- package/Insertion.js +14 -7
- package/Labelling.d.ts +6 -5
- package/Labelling.js +14 -8
- package/Selection.d.ts +7 -6
- package/Selection.js +17 -10
- package/handlers/ClickToSelectItems.d.ts +1 -1
- package/package.json +3 -3
- package/policies/highlightIsCorrectedOnFilterChange.d.ts +3 -1
- package/policies/highlightIsCorrectedOnFilterChange.js +20 -22
package/Addition.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AdditionCbs, GenericObjectT } from
|
|
2
|
-
export type { AdditionCbs } from
|
|
1
|
+
import { AdditionCbs, GenericObjectT } from './AdditionCbs';
|
|
2
|
+
export type { AdditionCbs } from './AdditionCbs';
|
|
3
3
|
export declare class Addition<ValueT = any> {
|
|
4
|
+
static className: () => string;
|
|
4
5
|
item?: ValueT;
|
|
5
6
|
parentId?: string;
|
|
6
|
-
add(values: GenericObjectT): (cbs: AdditionCbs<ValueT>[
|
|
7
|
-
confirm(): (cbs: AdditionCbs<ValueT>[
|
|
8
|
-
cancel(): (cbs: AdditionCbs<ValueT>[
|
|
7
|
+
add(values: GenericObjectT): (cbs: AdditionCbs<ValueT>['add']) => void;
|
|
8
|
+
confirm(): (cbs: AdditionCbs<ValueT>['confirm']) => void;
|
|
9
|
+
cancel(): (cbs: AdditionCbs<ValueT>['cancel']) => void;
|
|
9
10
|
_reset(): void;
|
|
10
11
|
}
|
package/Addition.js
CHANGED
|
@@ -4,8 +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
|
-
import {
|
|
7
|
+
import { host, maybe } from 'aspiration';
|
|
8
|
+
import { data, operation } from 'skandha';
|
|
9
9
|
export class Addition {
|
|
10
10
|
constructor() {
|
|
11
11
|
Object.defineProperty(this, "item", {
|
|
@@ -45,6 +45,12 @@ export class Addition {
|
|
|
45
45
|
this.parentId = undefined;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
Object.defineProperty(Addition, "className", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: () => 'Addition'
|
|
53
|
+
});
|
|
48
54
|
__decorate([
|
|
49
55
|
data
|
|
50
56
|
], Addition.prototype, "item", void 0);
|
|
@@ -52,11 +58,14 @@ __decorate([
|
|
|
52
58
|
data
|
|
53
59
|
], Addition.prototype, "parentId", void 0);
|
|
54
60
|
__decorate([
|
|
55
|
-
operation,
|
|
61
|
+
operation,
|
|
62
|
+
host(['values'])
|
|
56
63
|
], Addition.prototype, "add", null);
|
|
57
64
|
__decorate([
|
|
58
|
-
operation,
|
|
65
|
+
operation,
|
|
66
|
+
host
|
|
59
67
|
], Addition.prototype, "confirm", null);
|
|
60
68
|
__decorate([
|
|
61
|
-
operation,
|
|
69
|
+
operation,
|
|
70
|
+
host
|
|
62
71
|
], Addition.prototype, "cancel", null);
|
package/Deletion.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DeletionCbs } from
|
|
2
|
-
export type { DeletionCbs } from
|
|
1
|
+
import { DeletionCbs } from './DeletionCbs';
|
|
2
|
+
export type { DeletionCbs } from './DeletionCbs';
|
|
3
3
|
export declare class Deletion {
|
|
4
|
-
|
|
4
|
+
static className: () => string;
|
|
5
|
+
delete(itemIds: string[]): (cbs: DeletionCbs['delete']) => any;
|
|
5
6
|
}
|
package/Deletion.js
CHANGED
|
@@ -4,15 +4,22 @@ 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 {
|
|
7
|
+
import { host } from 'aspiration';
|
|
8
|
+
import { operation } from 'skandha';
|
|
9
9
|
export class Deletion {
|
|
10
10
|
delete(itemIds) {
|
|
11
11
|
return (cbs) => {
|
|
12
|
-
cbs.deleteItems();
|
|
12
|
+
return cbs.deleteItems();
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
Object.defineProperty(Deletion, "className", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: () => 'Deletion'
|
|
21
|
+
});
|
|
16
22
|
__decorate([
|
|
17
|
-
operation,
|
|
23
|
+
operation,
|
|
24
|
+
host(['itemIds'])
|
|
18
25
|
], Deletion.prototype, "delete", null);
|
package/DeletionCbs.d.ts
CHANGED
package/DeletionCbs.js
CHANGED
package/DragAndDrop.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export type { DragAndDropCbs } from
|
|
1
|
+
import { DragAndDropCbs } from './DragAndDropCbs';
|
|
2
|
+
import { DropPositionT } from './Insertion';
|
|
3
|
+
export type { DragAndDropCbs } from './DragAndDropCbs';
|
|
4
4
|
export declare class DragAndDrop {
|
|
5
|
+
static className: () => string;
|
|
5
6
|
hoverPosition?: DropPositionT;
|
|
6
|
-
drop(dropPosition: DropPositionT): (cbs: DragAndDropCbs[
|
|
7
|
+
drop(dropPosition: DropPositionT): (cbs: DragAndDropCbs['drop']) => void;
|
|
7
8
|
setHoverPosition(x?: DropPositionT): void;
|
|
8
9
|
handle(itemId: string): {
|
|
9
10
|
draggable: boolean;
|
package/DragAndDrop.js
CHANGED
|
@@ -4,9 +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 {
|
|
9
|
-
import {
|
|
7
|
+
import { host } from 'aspiration';
|
|
8
|
+
import { data, operation } from 'skandha';
|
|
9
|
+
import { isBefore } from './internal/utils';
|
|
10
10
|
export class DragAndDrop {
|
|
11
11
|
constructor() {
|
|
12
12
|
Object.defineProperty(this, "hoverPosition", {
|
|
@@ -47,11 +47,18 @@ export class DragAndDrop {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
Object.defineProperty(DragAndDrop, "className", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true,
|
|
54
|
+
value: () => 'DragAndDrop'
|
|
55
|
+
});
|
|
50
56
|
__decorate([
|
|
51
57
|
data
|
|
52
58
|
], DragAndDrop.prototype, "hoverPosition", void 0);
|
|
53
59
|
__decorate([
|
|
54
|
-
operation,
|
|
60
|
+
operation,
|
|
61
|
+
host(['dropPosition'])
|
|
55
62
|
], DragAndDrop.prototype, "drop", null);
|
|
56
63
|
__decorate([
|
|
57
64
|
operation({ log: false })
|
package/Editing.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { EditingCbs } from
|
|
2
|
-
export type { EditingCbs } from
|
|
1
|
+
import { EditingCbs } from './EditingCbs';
|
|
2
|
+
export type { EditingCbs } from './EditingCbs';
|
|
3
3
|
export declare class Editing {
|
|
4
|
+
static className: () => string;
|
|
4
5
|
isEditing: boolean;
|
|
5
|
-
save(values: any): (cbs: EditingCbs[
|
|
6
|
-
cancel(): (cbs: EditingCbs[
|
|
7
|
-
enable(): (cbs: EditingCbs[
|
|
6
|
+
save(values: any): (cbs: EditingCbs['save']) => void;
|
|
7
|
+
cancel(): (cbs: EditingCbs['cancel']) => void;
|
|
8
|
+
enable(): (cbs: EditingCbs['enable']) => void;
|
|
8
9
|
}
|
package/Editing.js
CHANGED
|
@@ -4,8 +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
|
-
import {
|
|
7
|
+
import { host, maybe } from 'aspiration';
|
|
8
|
+
import { data, operation } from 'skandha';
|
|
9
9
|
export class Editing {
|
|
10
10
|
constructor() {
|
|
11
11
|
Object.defineProperty(this, "isEditing", {
|
|
@@ -33,15 +33,24 @@ export class Editing {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
Object.defineProperty(Editing, "className", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: () => 'Editing'
|
|
41
|
+
});
|
|
36
42
|
__decorate([
|
|
37
43
|
data
|
|
38
44
|
], Editing.prototype, "isEditing", void 0);
|
|
39
45
|
__decorate([
|
|
40
|
-
operation,
|
|
46
|
+
operation,
|
|
47
|
+
host(['values'])
|
|
41
48
|
], Editing.prototype, "save", null);
|
|
42
49
|
__decorate([
|
|
43
|
-
operation,
|
|
50
|
+
operation,
|
|
51
|
+
host
|
|
44
52
|
], Editing.prototype, "cancel", null);
|
|
45
53
|
__decorate([
|
|
46
|
-
operation,
|
|
54
|
+
operation,
|
|
55
|
+
host
|
|
47
56
|
], Editing.prototype, "enable", null);
|
package/Filtering.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { GetterT } from
|
|
2
|
-
import { FilteringCbs, FilterT } from
|
|
3
|
-
export type { FilteringCbs } from
|
|
1
|
+
import { GetterT } from 'skandha';
|
|
2
|
+
import { FilteringCbs, FilterT } from './FilteringCbs';
|
|
3
|
+
export type { FilteringCbs } from './FilteringCbs';
|
|
4
4
|
export declare class Filtering<ValueT = any> {
|
|
5
|
+
static className: () => string;
|
|
5
6
|
isEnabled: boolean;
|
|
6
7
|
filter: FilterT;
|
|
7
|
-
inputItems
|
|
8
|
-
get filteredItems(): any[]
|
|
9
|
-
apply(filter: FilterT): (cbs: FilteringCbs[
|
|
10
|
-
setEnabled(flag: boolean): (cbs: FilteringCbs[
|
|
8
|
+
inputItems: Array<ValueT>;
|
|
9
|
+
get filteredItems(): any[];
|
|
10
|
+
apply(filter: FilterT): (cbs: FilteringCbs['apply']) => void;
|
|
11
|
+
setEnabled(flag: boolean): (cbs: FilteringCbs['setEnabled']) => void;
|
|
11
12
|
}
|
|
12
|
-
export declare const filteringUsesInputItems: (getItems: GetterT, transform?: Function
|
|
13
|
+
export declare const filteringUsesInputItems: (getItems: GetterT, transform?: Function) => (ctr: any) => void;
|
package/Filtering.js
CHANGED
|
@@ -4,8 +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
|
-
import {
|
|
7
|
+
import { host, stub } from 'aspiration';
|
|
8
|
+
import { data, mapDataToFacet, operation } from 'skandha';
|
|
9
9
|
export class Filtering {
|
|
10
10
|
constructor() {
|
|
11
11
|
Object.defineProperty(this, "isEnabled", {
|
|
@@ -24,7 +24,7 @@ export class Filtering {
|
|
|
24
24
|
enumerable: true,
|
|
25
25
|
configurable: true,
|
|
26
26
|
writable: true,
|
|
27
|
-
value:
|
|
27
|
+
value: stub()
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
get filteredItems() {
|
|
@@ -42,6 +42,12 @@ export class Filtering {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
Object.defineProperty(Filtering, "className", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true,
|
|
49
|
+
value: () => 'Filtering'
|
|
50
|
+
});
|
|
45
51
|
__decorate([
|
|
46
52
|
data
|
|
47
53
|
], Filtering.prototype, "isEnabled", void 0);
|
|
@@ -55,9 +61,11 @@ __decorate([
|
|
|
55
61
|
data
|
|
56
62
|
], Filtering.prototype, "filteredItems", null);
|
|
57
63
|
__decorate([
|
|
58
|
-
operation,
|
|
64
|
+
operation,
|
|
65
|
+
host(['filter'])
|
|
59
66
|
], Filtering.prototype, "apply", null);
|
|
60
67
|
__decorate([
|
|
61
|
-
operation,
|
|
68
|
+
operation,
|
|
69
|
+
host(['flag'])
|
|
62
70
|
], Filtering.prototype, "setEnabled", null);
|
|
63
|
-
export const filteringUsesInputItems = (getItems, transform) => mapDataToFacet([Filtering,
|
|
71
|
+
export const filteringUsesInputItems = (getItems, transform) => mapDataToFacet([Filtering, 'inputItems'], getItems, transform);
|
package/Highlight.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { GetterT } from
|
|
2
|
-
import { HighlightCbs } from
|
|
3
|
-
export type { HighlightCbs } from
|
|
1
|
+
import { GetterT } from 'skandha';
|
|
2
|
+
import { HighlightCbs } from './HighlightCbs';
|
|
3
|
+
export type { HighlightCbs } from './HighlightCbs';
|
|
4
4
|
export declare class Highlight<ValueT = any> {
|
|
5
|
+
static className: () => string;
|
|
5
6
|
id: string | undefined;
|
|
6
7
|
item?: ValueT;
|
|
7
|
-
highlightItem(id: string): (cbs: HighlightCbs[
|
|
8
|
+
highlightItem(id: string): (cbs: HighlightCbs['highlightItem']) => void;
|
|
8
9
|
}
|
|
9
10
|
export declare const highlightUsesItemLookUpTable: (getItemById: GetterT) => (ctr: any) => void;
|
package/Highlight.js
CHANGED
|
@@ -4,8 +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 { host, maybe } from
|
|
8
|
-
import { data, getm, mapDatasToFacet, operation, output, } from
|
|
7
|
+
import { host, maybe } from 'aspiration';
|
|
8
|
+
import { data, getm, mapDatasToFacet, operation, output, } from 'skandha';
|
|
9
9
|
export class Highlight {
|
|
10
10
|
constructor() {
|
|
11
11
|
Object.defineProperty(this, "id", {
|
|
@@ -28,6 +28,12 @@ export class Highlight {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
Object.defineProperty(Highlight, "className", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: () => 'Highlight'
|
|
36
|
+
});
|
|
31
37
|
__decorate([
|
|
32
38
|
data
|
|
33
39
|
], Highlight.prototype, "id", void 0);
|
|
@@ -35,12 +41,13 @@ __decorate([
|
|
|
35
41
|
output
|
|
36
42
|
], Highlight.prototype, "item", void 0);
|
|
37
43
|
__decorate([
|
|
38
|
-
operation,
|
|
44
|
+
operation,
|
|
45
|
+
host(['id'])
|
|
39
46
|
], Highlight.prototype, "highlightItem", null);
|
|
40
|
-
export const highlightUsesItemLookUpTable = (getItemById) => mapDatasToFacet([Highlight,
|
|
47
|
+
export const highlightUsesItemLookUpTable = (getItemById) => mapDatasToFacet([Highlight, 'item'], [
|
|
41
48
|
//
|
|
42
49
|
getItemById,
|
|
43
|
-
getm([Highlight,
|
|
50
|
+
getm([Highlight, 'id']),
|
|
44
51
|
], (itemById, id) => {
|
|
45
52
|
return itemById[id];
|
|
46
53
|
});
|
package/Insertion.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { GetterT } from
|
|
2
|
-
import { DragT, InsertionCbs } from
|
|
3
|
-
export type { DragT, DropPositionT, InsertionCbs } from
|
|
1
|
+
import { GetterT } from 'skandha';
|
|
2
|
+
import { DragT, InsertionCbs } from './InsertionCbs';
|
|
3
|
+
export type { DragT, DropPositionT, InsertionCbs } from './InsertionCbs';
|
|
4
4
|
export declare type DragSourceT = (ctr: any) => DragT | undefined;
|
|
5
5
|
export declare class Insertion<ValueT = any> {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
static className: () => string;
|
|
7
|
+
inputItems: Array<ValueT>;
|
|
8
|
+
preview: Array<ValueT>;
|
|
9
|
+
insertItems(drag: DragT): (cbs: InsertionCbs['insertItems']) => void;
|
|
9
10
|
}
|
|
10
|
-
export declare const insertionUsesInputItems: (getItems: GetterT, transform?: Function
|
|
11
|
+
export declare const insertionUsesInputItems: (getItems: GetterT, transform?: Function) => (ctr: any) => void;
|
package/Insertion.js
CHANGED
|
@@ -4,22 +4,22 @@ 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
|
|
8
|
-
import { input, mapDataToFacet, operation, output } from
|
|
9
|
-
import { getPreview } from
|
|
7
|
+
import { host, stub } from 'aspiration';
|
|
8
|
+
import { input, mapDataToFacet, operation, output } from 'skandha';
|
|
9
|
+
import { getPreview } from './lib/getPreview';
|
|
10
10
|
export class Insertion {
|
|
11
11
|
constructor() {
|
|
12
12
|
Object.defineProperty(this, "inputItems", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
configurable: true,
|
|
15
15
|
writable: true,
|
|
16
|
-
value:
|
|
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:
|
|
22
|
+
value: stub()
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
insertItems(drag) {
|
|
@@ -31,6 +31,12 @@ export class Insertion {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
Object.defineProperty(Insertion, "className", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: () => 'Insertion'
|
|
39
|
+
});
|
|
34
40
|
__decorate([
|
|
35
41
|
input
|
|
36
42
|
], Insertion.prototype, "inputItems", void 0);
|
|
@@ -38,6 +44,7 @@ __decorate([
|
|
|
38
44
|
output
|
|
39
45
|
], Insertion.prototype, "preview", void 0);
|
|
40
46
|
__decorate([
|
|
41
|
-
operation,
|
|
47
|
+
operation,
|
|
48
|
+
host(['drag'])
|
|
42
49
|
], Insertion.prototype, "insertItems", null);
|
|
43
|
-
export const insertionUsesInputItems = (getItems, transform) => mapDataToFacet([Insertion,
|
|
50
|
+
export const insertionUsesInputItems = (getItems, transform) => mapDataToFacet([Insertion, 'inputItems'], getItems, transform);
|
package/Labelling.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { GetterT } from
|
|
2
|
-
import { IdsByLabelT, ItemsByLabelT,
|
|
3
|
-
export type { LabellingCbs } from
|
|
1
|
+
import { GetterT } from 'skandha';
|
|
2
|
+
import { IdsByLabelT, ItemsByLabelT, LabellingCbs, LabelValueT } from './LabellingCbs';
|
|
3
|
+
export type { LabellingCbs } from './LabellingCbs';
|
|
4
4
|
export declare class Labelling {
|
|
5
|
+
static className: () => string;
|
|
5
6
|
idsByLabel: IdsByLabelT;
|
|
6
7
|
ids: (label: string) => any[];
|
|
7
|
-
itemsByLabel
|
|
8
|
-
setLabel(labelValue: LabelValueT): (cbs: LabellingCbs[
|
|
8
|
+
itemsByLabel: ItemsByLabelT;
|
|
9
|
+
setLabel(labelValue: LabelValueT): (cbs: LabellingCbs['setLabel']) => void;
|
|
9
10
|
}
|
|
10
11
|
export declare const labellingActsOnItems: (getItemById: GetterT) => (ctr: any) => void;
|
package/Labelling.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 { getm, mapDatasToFacet } from
|
|
9
|
-
import {
|
|
10
|
-
import { lookUp } from "./internal/utils";
|
|
7
|
+
import { host, stub } from 'aspiration';
|
|
8
|
+
import { data, getm, input, mapDatasToFacet, operation, } from 'skandha';
|
|
9
|
+
import { lookUp } from './internal/utils';
|
|
11
10
|
export class Labelling {
|
|
12
11
|
constructor() {
|
|
13
12
|
Object.defineProperty(this, "idsByLabel", {
|
|
@@ -26,7 +25,7 @@ export class Labelling {
|
|
|
26
25
|
enumerable: true,
|
|
27
26
|
configurable: true,
|
|
28
27
|
writable: true,
|
|
29
|
-
value:
|
|
28
|
+
value: stub()
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
setLabel(labelValue) {
|
|
@@ -44,6 +43,12 @@ export class Labelling {
|
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
}
|
|
46
|
+
Object.defineProperty(Labelling, "className", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: () => 'Labelling'
|
|
51
|
+
});
|
|
47
52
|
__decorate([
|
|
48
53
|
data
|
|
49
54
|
], Labelling.prototype, "idsByLabel", void 0);
|
|
@@ -51,12 +56,13 @@ __decorate([
|
|
|
51
56
|
input
|
|
52
57
|
], Labelling.prototype, "itemsByLabel", void 0);
|
|
53
58
|
__decorate([
|
|
54
|
-
operation,
|
|
59
|
+
operation,
|
|
60
|
+
host(['labelValue'])
|
|
55
61
|
], Labelling.prototype, "setLabel", null);
|
|
56
62
|
export const labellingActsOnItems = (getItemById) => {
|
|
57
|
-
return mapDatasToFacet([Labelling,
|
|
63
|
+
return mapDatasToFacet([Labelling, 'itemsByLabel'], [
|
|
58
64
|
//
|
|
59
65
|
getItemById,
|
|
60
|
-
getm([Labelling,
|
|
66
|
+
getm([Labelling, 'idsByLabel']),
|
|
61
67
|
], (itemById, idsByLabel) => Object.fromEntries(Object.entries(idsByLabel).map(([label, ids]) => lookUp(ids, itemById))));
|
|
62
68
|
};
|
package/Selection.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { GetterT } from
|
|
2
|
-
import {
|
|
3
|
-
export type {
|
|
1
|
+
import { GetterT } from 'skandha';
|
|
2
|
+
import { SelectionCbs, SelectionParamsT } from './SelectionCbs';
|
|
3
|
+
export type { SelectionCbs, SelectionParamsT } from './SelectionCbs';
|
|
4
4
|
export declare class Selection<ValueT = any> {
|
|
5
|
-
|
|
5
|
+
static className: () => string;
|
|
6
|
+
selectableIds: Array<string>;
|
|
6
7
|
ids: Array<string>;
|
|
7
8
|
anchorId?: string;
|
|
8
|
-
items
|
|
9
|
-
selectItem(selectionParams: SelectionParamsT): (cbs: SelectionCbs[
|
|
9
|
+
items: Array<ValueT>;
|
|
10
|
+
selectItem(selectionParams: SelectionParamsT): (cbs: SelectionCbs['selectItem']) => void;
|
|
10
11
|
}
|
|
11
12
|
export declare function handleSelectItem(facet: Selection, { itemId, isShift, isCtrl }: SelectionParamsT): void;
|
|
12
13
|
export declare const selectionUsesItemLookUpTable: (getItemById: GetterT) => (ctr: any) => void;
|
package/Selection.js
CHANGED
|
@@ -4,9 +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
|
|
8
|
-
import {
|
|
9
|
-
import { lookUp, range } from
|
|
7
|
+
import { host, stub } from 'aspiration';
|
|
8
|
+
import { data, getm, input, mapDatasToFacet, mapDataToFacet, operation, output, } from 'skandha';
|
|
9
|
+
import { lookUp, range } from './internal/utils';
|
|
10
10
|
const selectItemDefaultCbs = (selection) => ({
|
|
11
11
|
selectItem: function () {
|
|
12
12
|
handleSelectItem(selection, this.selectionParams);
|
|
@@ -18,7 +18,7 @@ export class Selection {
|
|
|
18
18
|
enumerable: true,
|
|
19
19
|
configurable: true,
|
|
20
20
|
writable: true,
|
|
21
|
-
value:
|
|
21
|
+
value: stub()
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(this, "ids", {
|
|
24
24
|
enumerable: true,
|
|
@@ -36,7 +36,7 @@ export class Selection {
|
|
|
36
36
|
enumerable: true,
|
|
37
37
|
configurable: true,
|
|
38
38
|
writable: true,
|
|
39
|
-
value:
|
|
39
|
+
value: stub()
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
selectItem(selectionParams) {
|
|
@@ -45,6 +45,12 @@ export class Selection {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
Object.defineProperty(Selection, "className", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: () => 'Selection'
|
|
53
|
+
});
|
|
48
54
|
__decorate([
|
|
49
55
|
input
|
|
50
56
|
], Selection.prototype, "selectableIds", void 0);
|
|
@@ -58,7 +64,8 @@ __decorate([
|
|
|
58
64
|
output
|
|
59
65
|
], Selection.prototype, "items", void 0);
|
|
60
66
|
__decorate([
|
|
61
|
-
operation,
|
|
67
|
+
operation,
|
|
68
|
+
host(['selectionParams'], selectItemDefaultCbs)
|
|
62
69
|
], Selection.prototype, "selectItem", null);
|
|
63
70
|
export function handleSelectItem(facet, { itemId, isShift, isCtrl }) {
|
|
64
71
|
if (itemId === undefined) {
|
|
@@ -69,7 +76,7 @@ export function handleSelectItem(facet, { itemId, isShift, isCtrl }) {
|
|
|
69
76
|
const hasItem = facet.ids.includes(itemId);
|
|
70
77
|
const selectableIds = facet.selectableIds;
|
|
71
78
|
if (!selectableIds) {
|
|
72
|
-
throw Error(
|
|
79
|
+
throw Error('logical error');
|
|
73
80
|
}
|
|
74
81
|
if (isShift) {
|
|
75
82
|
const startItemId = facet.anchorId || itemId;
|
|
@@ -91,11 +98,11 @@ export function handleSelectItem(facet, { itemId, isShift, isCtrl }) {
|
|
|
91
98
|
facet.anchorId = itemId;
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
|
-
export const selectionUsesItemLookUpTable = (getItemById) => mapDatasToFacet([Selection,
|
|
101
|
+
export const selectionUsesItemLookUpTable = (getItemById) => mapDatasToFacet([Selection, 'items'], [
|
|
95
102
|
//
|
|
96
103
|
getItemById,
|
|
97
|
-
getm([Selection,
|
|
104
|
+
getm([Selection, 'ids']),
|
|
98
105
|
], (itemById, ids) => {
|
|
99
106
|
return lookUp(ids, itemById);
|
|
100
107
|
});
|
|
101
|
-
export const selectionUsesSelectableIds = (getIds, transform) => mapDataToFacet([Selection,
|
|
108
|
+
export const selectionUsesSelectableIds = (getIds, transform) => mapDataToFacet([Selection, 'selectableIds'], getIds, transform);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skandha-facets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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.7.0",
|
|
13
|
+
"aspiration": ">=0.3.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"typescript": "^4.0.3"
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { Filtering } from
|
|
1
|
+
import { Filtering } from '../Filtering';
|
|
2
|
+
import { Highlight } from '../Highlight';
|
|
2
3
|
export declare function highlightIsCorrectedOnFilterChange(facet: Filtering): void;
|
|
4
|
+
export declare function correctHighlight(highlight: Highlight, inputItemIds: any[], filteredItemIds: any[]): void;
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Highlight } from
|
|
1
|
+
import { getc, getf } from 'skandha';
|
|
2
|
+
import { Highlight } from '../Highlight';
|
|
3
|
+
export function highlightIsCorrectedOnFilterChange(facet) {
|
|
4
|
+
var _a;
|
|
5
|
+
if (facet.isEnabled) {
|
|
6
|
+
correctHighlight(getf(Highlight, getc(facet)), (facet.inputItems || []).map((x) => x.id), ((_a = facet.filteredItems) !== null && _a !== void 0 ? _a : []).map((x) => x.id));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function correctHighlight(highlight, inputItemIds, filteredItemIds) {
|
|
10
|
+
if (highlight.id &&
|
|
11
|
+
inputItemIds.includes(highlight.id) &&
|
|
12
|
+
!filteredItemIds.includes(highlight.id)) {
|
|
13
|
+
const highlightedItemIdx = inputItemIds.indexOf(highlight.id);
|
|
14
|
+
const newIdx = _findNeighbourIdx(filteredItemIds, inputItemIds, highlightedItemIdx, inputItemIds.length, 1) ||
|
|
15
|
+
_findNeighbourIdx(filteredItemIds, inputItemIds, highlightedItemIdx, -1, -1);
|
|
16
|
+
if (newIdx) {
|
|
17
|
+
highlight.highlightItem(inputItemIds[newIdx.result]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
3
21
|
function _findNeighbourIdx(filteredItems, allItems, beginIndex, endIndex, step) {
|
|
4
22
|
for (var idx = beginIndex; idx !== endIndex; idx += step) {
|
|
5
23
|
if (filteredItems.includes(allItems[idx])) {
|
|
@@ -8,23 +26,3 @@ function _findNeighbourIdx(filteredItems, allItems, beginIndex, endIndex, step)
|
|
|
8
26
|
}
|
|
9
27
|
return undefined;
|
|
10
28
|
}
|
|
11
|
-
export function highlightIsCorrectedOnFilterChange(facet) {
|
|
12
|
-
var _a;
|
|
13
|
-
const ctr = getc(facet);
|
|
14
|
-
if (facet.isEnabled) {
|
|
15
|
-
const highlight = getf(Highlight, ctr).id;
|
|
16
|
-
const inputItems = facet.inputItems;
|
|
17
|
-
const filteredItemIds = ((_a = facet.filteredItems) !== null && _a !== void 0 ? _a : []).map((x) => x.id);
|
|
18
|
-
const inputIds = (inputItems || []).map((x) => x.id);
|
|
19
|
-
if (highlight &&
|
|
20
|
-
inputIds.includes(highlight) &&
|
|
21
|
-
!filteredItemIds.includes(highlight)) {
|
|
22
|
-
const highlightedItemIdx = inputIds.indexOf(highlight);
|
|
23
|
-
const newIdx = _findNeighbourIdx(filteredItemIds, inputIds, highlightedItemIdx, inputIds.length, 1) ||
|
|
24
|
-
_findNeighbourIdx(filteredItemIds, inputIds, highlightedItemIdx, -1, -1);
|
|
25
|
-
if (newIdx) {
|
|
26
|
-
getf(Highlight, ctr).highlightItem(inputIds[newIdx.result]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|