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.
@@ -2,6 +2,8 @@ import { DefineCbs } from 'aspiration';
2
2
  export declare class Deletion {
3
3
  static className: () => string;
4
4
  disabled?: boolean;
5
+ isDeleting: boolean;
6
+ setIsDeleting(isDeleting: boolean): void;
5
7
  delete(args: {
6
8
  itemIds: string[];
7
9
  moveToTrash?: boolean;
@@ -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
- return Promise.resolve(cbs.deleteItems());
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()
@@ -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<void>;
9
+ }): Promise<any>;
8
10
  }
9
11
  type Cbs = {
10
12
  drop: {
@@ -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
- return Promise.resolve(cbs.drop());
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;
@@ -53,9 +53,3 @@ export function dragAndDropUIHandlers(props) {
53
53
  onDragEnd: props.onDragEnd,
54
54
  };
55
55
  }
56
- export function createDragAndDropUIConnector(dragAndDrop, hovering) {
57
- return new DragAndDropUIConnector({
58
- dragAndDrop,
59
- hovering,
60
- });
61
- }
package/facets/Edit.d.ts CHANGED
@@ -2,7 +2,9 @@ import { DefineCbs } from 'aspiration';
2
2
  export declare class Edit {
3
3
  static className: () => string;
4
4
  isEditing: boolean;
5
+ isSaving: boolean;
5
6
  reset(): void;
7
+ setIsSaving(isSaving: boolean): void;
6
8
  save(args: {
7
9
  values: any;
8
10
  }): Promise<any>;
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';
@@ -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>;
@@ -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 { createDragAndDropUIConnector, dragAndDropUIHandlers, type DragAndDropUIConnectorT, type DragAndDropUIPropsT, } from './facets/DragAndDropUIConnector';
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 { createHighlightKeyHandlers, createHighlightUIConnector, highlightUIHandlers, type HighlightUIConnectorT, type HighlightUIPropsT, } from './facets/HighlightUIConnector';
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 { createDragAndDropUIConnector, dragAndDropUIHandlers, } from './facets/DragAndDropUIConnector';
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 { createHighlightKeyHandlers, createHighlightUIConnector, highlightUIHandlers, } from './facets/HighlightUIConnector';
9
+ export { HighlightUIConnector, createHighlightKeyHandlers, highlightUIHandlers, } from './facets/HighlightUIConnector';
9
10
  export { Hovering } from './facets/Hovering';
10
11
  export { Insertion } from './facets/Insertion';
11
12
  export { Selection, handleSelectItem, } from './facets/Selection';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skandha-facets",
3
- "version": "0.12.0",
3
+ "version": "0.12.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",