@knotx/plugins-selection 0.0.8 → 0.0.9
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/dist/index.cjs +8 -7
- package/dist/index.d.cts +6 -5
- package/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +8 -7
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -79,13 +79,11 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
79
79
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
80
80
|
var _destroy_dec, _init_dec, _canInteract_dec, _endInteraction_dec, _startInteraction_dec, _registerPluginData_dec, _a, _init;
|
|
81
81
|
class Selection extends (_a = core.BasePlugin, _registerPluginData_dec = [decorators.inject.registerPluginData()], _startInteraction_dec = [decorators.inject.startInteraction()], _endInteraction_dec = [decorators.inject.endInteraction()], _canInteract_dec = [decorators.inject.canInteract()], _init_dec = [decorators.OnInit], _destroy_dec = [decorators.OnDestroy], _a) {
|
|
82
|
-
constructor(
|
|
83
|
-
|
|
84
|
-
}) {
|
|
85
|
-
super();
|
|
86
|
-
this.options = options;
|
|
82
|
+
constructor() {
|
|
83
|
+
super(...arguments);
|
|
87
84
|
__runInitializers(_init, 5, this);
|
|
88
85
|
__publicField(this, "name", "selection");
|
|
86
|
+
__publicField(this, "config");
|
|
89
87
|
__publicField(this, "selection");
|
|
90
88
|
__publicField(this, "selectedNodeIds$", new rxjs.BehaviorSubject([]));
|
|
91
89
|
__publicField(this, "registerPluginData", __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
|
|
@@ -93,7 +91,10 @@ class Selection extends (_a = core.BasePlugin, _registerPluginData_dec = [decora
|
|
|
93
91
|
__publicField(this, "endInteraction", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
|
|
94
92
|
__publicField(this, "canInteract", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
|
|
95
93
|
}
|
|
96
|
-
init() {
|
|
94
|
+
init(config) {
|
|
95
|
+
this.config = __spreadValues({
|
|
96
|
+
boundaries: [`.${core.bem("canvas", "wrapper")}`]
|
|
97
|
+
}, config);
|
|
97
98
|
this.registerPluginData("selection", "selectedNodeIds", this.selectedNodeIds$);
|
|
98
99
|
this.createSelection();
|
|
99
100
|
}
|
|
@@ -105,7 +106,7 @@ class Selection extends (_a = core.BasePlugin, _registerPluginData_dec = [decora
|
|
|
105
106
|
const endSelect = () => {
|
|
106
107
|
this.endInteraction(this.pluginId, "select");
|
|
107
108
|
};
|
|
108
|
-
this.selection = new SelectionArea__default(__spreadProps(__spreadValues({}, this.
|
|
109
|
+
this.selection = new SelectionArea__default(__spreadProps(__spreadValues({}, this.config), { selectionAreaClass, selectables })).on("start", ({ store, event, selection }) => {
|
|
109
110
|
if (!(event == null ? void 0 : event.ctrlKey) && !(event == null ? void 0 : event.metaKey)) {
|
|
110
111
|
store.stored.forEach((el) => {
|
|
111
112
|
if (el.className.includes(nodeWrapperClassName)) {
|
package/dist/index.d.cts
CHANGED
|
@@ -8,17 +8,18 @@ declare module '@knotx/core' {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
interface SelectionConfig extends PartialSelectionOptions {
|
|
12
|
+
}
|
|
13
|
+
declare class Selection extends BasePlugin<'selection', SelectionConfig> {
|
|
13
14
|
name: "selection";
|
|
15
|
+
private config;
|
|
14
16
|
private selection;
|
|
15
17
|
private selectedNodeIds$;
|
|
16
18
|
private registerPluginData;
|
|
17
19
|
private startInteraction;
|
|
18
20
|
private endInteraction;
|
|
19
21
|
private canInteract;
|
|
20
|
-
|
|
21
|
-
protected init(): void;
|
|
22
|
+
protected init(config: SelectionConfig): void;
|
|
22
23
|
private createSelection;
|
|
23
24
|
private updateSelection;
|
|
24
25
|
getSelectedNodeIds(): string[];
|
|
@@ -27,4 +28,4 @@ declare class Selection extends BasePlugin<'selection'> {
|
|
|
27
28
|
destroy(): void;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export { Selection };
|
|
31
|
+
export { Selection, type SelectionConfig };
|
package/dist/index.d.mts
CHANGED
|
@@ -8,17 +8,18 @@ declare module '@knotx/core' {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
interface SelectionConfig extends PartialSelectionOptions {
|
|
12
|
+
}
|
|
13
|
+
declare class Selection extends BasePlugin<'selection', SelectionConfig> {
|
|
13
14
|
name: "selection";
|
|
15
|
+
private config;
|
|
14
16
|
private selection;
|
|
15
17
|
private selectedNodeIds$;
|
|
16
18
|
private registerPluginData;
|
|
17
19
|
private startInteraction;
|
|
18
20
|
private endInteraction;
|
|
19
21
|
private canInteract;
|
|
20
|
-
|
|
21
|
-
protected init(): void;
|
|
22
|
+
protected init(config: SelectionConfig): void;
|
|
22
23
|
private createSelection;
|
|
23
24
|
private updateSelection;
|
|
24
25
|
getSelectedNodeIds(): string[];
|
|
@@ -27,4 +28,4 @@ declare class Selection extends BasePlugin<'selection'> {
|
|
|
27
28
|
destroy(): void;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export { Selection };
|
|
31
|
+
export { Selection, type SelectionConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,17 +8,18 @@ declare module '@knotx/core' {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
interface SelectionConfig extends PartialSelectionOptions {
|
|
12
|
+
}
|
|
13
|
+
declare class Selection extends BasePlugin<'selection', SelectionConfig> {
|
|
13
14
|
name: "selection";
|
|
15
|
+
private config;
|
|
14
16
|
private selection;
|
|
15
17
|
private selectedNodeIds$;
|
|
16
18
|
private registerPluginData;
|
|
17
19
|
private startInteraction;
|
|
18
20
|
private endInteraction;
|
|
19
21
|
private canInteract;
|
|
20
|
-
|
|
21
|
-
protected init(): void;
|
|
22
|
+
protected init(config: SelectionConfig): void;
|
|
22
23
|
private createSelection;
|
|
23
24
|
private updateSelection;
|
|
24
25
|
getSelectedNodeIds(): string[];
|
|
@@ -27,4 +28,4 @@ declare class Selection extends BasePlugin<'selection'> {
|
|
|
27
28
|
destroy(): void;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export { Selection };
|
|
31
|
+
export { Selection, type SelectionConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -73,13 +73,11 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
73
73
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
74
74
|
var _destroy_dec, _init_dec, _canInteract_dec, _endInteraction_dec, _startInteraction_dec, _registerPluginData_dec, _a, _init;
|
|
75
75
|
class Selection extends (_a = BasePlugin, _registerPluginData_dec = [inject.registerPluginData()], _startInteraction_dec = [inject.startInteraction()], _endInteraction_dec = [inject.endInteraction()], _canInteract_dec = [inject.canInteract()], _init_dec = [OnInit], _destroy_dec = [OnDestroy], _a) {
|
|
76
|
-
constructor(
|
|
77
|
-
|
|
78
|
-
}) {
|
|
79
|
-
super();
|
|
80
|
-
this.options = options;
|
|
76
|
+
constructor() {
|
|
77
|
+
super(...arguments);
|
|
81
78
|
__runInitializers(_init, 5, this);
|
|
82
79
|
__publicField(this, "name", "selection");
|
|
80
|
+
__publicField(this, "config");
|
|
83
81
|
__publicField(this, "selection");
|
|
84
82
|
__publicField(this, "selectedNodeIds$", new BehaviorSubject([]));
|
|
85
83
|
__publicField(this, "registerPluginData", __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
|
|
@@ -87,7 +85,10 @@ class Selection extends (_a = BasePlugin, _registerPluginData_dec = [inject.regi
|
|
|
87
85
|
__publicField(this, "endInteraction", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
|
|
88
86
|
__publicField(this, "canInteract", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
|
|
89
87
|
}
|
|
90
|
-
init() {
|
|
88
|
+
init(config) {
|
|
89
|
+
this.config = __spreadValues({
|
|
90
|
+
boundaries: [`.${bem("canvas", "wrapper")}`]
|
|
91
|
+
}, config);
|
|
91
92
|
this.registerPluginData("selection", "selectedNodeIds", this.selectedNodeIds$);
|
|
92
93
|
this.createSelection();
|
|
93
94
|
}
|
|
@@ -99,7 +100,7 @@ class Selection extends (_a = BasePlugin, _registerPluginData_dec = [inject.regi
|
|
|
99
100
|
const endSelect = () => {
|
|
100
101
|
this.endInteraction(this.pluginId, "select");
|
|
101
102
|
};
|
|
102
|
-
this.selection = new SelectionArea(__spreadProps(__spreadValues({}, this.
|
|
103
|
+
this.selection = new SelectionArea(__spreadProps(__spreadValues({}, this.config), { selectionAreaClass, selectables })).on("start", ({ store, event, selection }) => {
|
|
103
104
|
if (!(event == null ? void 0 : event.ctrlKey) && !(event == null ? void 0 : event.metaKey)) {
|
|
104
105
|
store.stored.forEach((el) => {
|
|
105
106
|
if (el.className.includes(nodeWrapperClassName)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/plugins-selection",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"description": "Selection Plugin for Knotx",
|
|
6
6
|
"author": "boenfu",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@viselect/vanilla": "^3.9.0",
|
|
33
33
|
"rxjs": "^7.8.1",
|
|
34
|
-
"@knotx/core": "0.0.
|
|
35
|
-
"@knotx/decorators": "0.0.
|
|
34
|
+
"@knotx/core": "0.0.7",
|
|
35
|
+
"@knotx/decorators": "0.0.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@knotx/eslint-config": "0.0.
|
|
39
|
-
"@knotx/typescript-config": "0.0.
|
|
38
|
+
"@knotx/eslint-config": "0.0.7",
|
|
39
|
+
"@knotx/typescript-config": "0.0.7"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "unbuild --failOnWarn=false",
|