@tmagic/editor 1.5.10 → 1.5.12
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/tmagic-editor.js +26 -15
- package/dist/tmagic-editor.umd.cjs +25 -14
- package/package.json +7 -7
- package/src/initService.ts +33 -11
- package/src/services/dep.ts +3 -3
- package/src/services/events.ts +1 -1
- package/types/index.d.ts +1 -1
package/dist/tmagic-editor.js
CHANGED
|
@@ -13,7 +13,7 @@ import { throttle, isEmpty, isObject, cloneDeep, mergeWith, uniq, get, map, has,
|
|
|
13
13
|
import serialize from 'serialize-javascript';
|
|
14
14
|
import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
|
|
15
15
|
import * as monaco from 'monaco-editor';
|
|
16
|
-
import { HookCodeType, HookType, NODE_CONDS_KEY, Target, Watcher, NodeType, ActionType, DepTargetType, createCodeBlockTarget, createDataSourceTarget,
|
|
16
|
+
import { HookCodeType, HookType, NODE_CONDS_KEY, Target, Watcher, NodeType, ActionType, DepTargetType, createCodeBlockTarget, createDataSourceTarget, createDataSourceCondTarget, createDataSourceMethodTarget } from '@tmagic/core';
|
|
17
17
|
export { DepTargetType } from '@tmagic/core';
|
|
18
18
|
import { isPage, isPageFragment, isPop, getNodePath, isNumber, getElById, calcValueByFontsize, isValueIncludeDataSource, toLine, guid, getValueByKeyPath, setValueByKeyPath, getNodeInfo, dataSourceTemplateRegExp, getKeysArray, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, convertToNumber, getIdFromEl, traverseNode, getDefaultValueFromFields, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, removeClassName, addClassName, removeClassNameByClassName, getNodes } from '@tmagic/utils';
|
|
19
19
|
export * from '@tmagic/utils';
|
|
@@ -13930,7 +13930,7 @@ class Dep extends BaseService {
|
|
|
13930
13930
|
const targets = this.watcher.getTargets(type);
|
|
13931
13931
|
if (!targets) return;
|
|
13932
13932
|
for (const target of Object.values(targets)) {
|
|
13933
|
-
this.emit("remove-target", target.id);
|
|
13933
|
+
this.emit("remove-target", target.id, type);
|
|
13934
13934
|
}
|
|
13935
13935
|
}
|
|
13936
13936
|
getTargets(type = DepTargetType.DEFAULT) {
|
|
@@ -13945,7 +13945,7 @@ class Dep extends BaseService {
|
|
|
13945
13945
|
}
|
|
13946
13946
|
removeTarget(id, type = DepTargetType.DEFAULT) {
|
|
13947
13947
|
this.watcher.removeTarget(id, type);
|
|
13948
|
-
this.emit("remove-target", id);
|
|
13948
|
+
this.emit("remove-target", id, type);
|
|
13949
13949
|
}
|
|
13950
13950
|
clearTargets() {
|
|
13951
13951
|
this.watcher.clearTargets();
|
|
@@ -14080,7 +14080,7 @@ class Events extends BaseService {
|
|
|
14080
14080
|
methodMap[toLine(type)] = [...method];
|
|
14081
14081
|
}
|
|
14082
14082
|
getMethod(type) {
|
|
14083
|
-
return cloneDeep(methodMap[toLine(type)]);
|
|
14083
|
+
return cloneDeep(methodMap[toLine(type)]) || [];
|
|
14084
14084
|
}
|
|
14085
14085
|
resetState() {
|
|
14086
14086
|
eventMap = reactive({});
|
|
@@ -14823,7 +14823,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
14823
14823
|
if (!changeRecord.propPath) {
|
|
14824
14824
|
continue;
|
|
14825
14825
|
}
|
|
14826
|
-
isModifyField = changeRecord.propPath === "fields" || /fields.(\d)+.name/.test(changeRecord.propPath) || /fields.(\d)+$/.test(changeRecord.propPath);
|
|
14826
|
+
isModifyField = changeRecord.propPath === "fields" || /fields.(\d)+.name/.test(changeRecord.propPath) || /fields.(\d)+.defaultValue/.test(changeRecord.propPath) || /fields.(\d)+$/.test(changeRecord.propPath);
|
|
14827
14827
|
isModifyMock = changeRecord.propPath === "mocks";
|
|
14828
14828
|
isModifyMethod = changeRecord.propPath === "methods" || /methods.(\d)+.name/.test(changeRecord.propPath) || /methods.(\d)+$/.test(changeRecord.propPath);
|
|
14829
14829
|
needRecollectDep = isModifyField || isModifyMock || isModifyMethod;
|
|
@@ -14835,24 +14835,26 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
14835
14835
|
if (needRecollectDep) {
|
|
14836
14836
|
if (Array.isArray(root?.items)) {
|
|
14837
14837
|
depService.clearIdleTasks();
|
|
14838
|
-
removeDataSourceTarget(config.id);
|
|
14839
|
-
initDataSourceDepTarget(config);
|
|
14840
14838
|
let collectIdlePromises = [];
|
|
14841
14839
|
if (isModifyField) {
|
|
14840
|
+
depService.removeTarget(config.id, DepTargetType.DATA_SOURCE);
|
|
14841
|
+
depService.removeTarget(config.id, DepTargetType.DATA_SOURCE_COND);
|
|
14842
|
+
depService.addTarget(createDataSourceTarget(config, reactive({})));
|
|
14843
|
+
depService.addTarget(createDataSourceCondTarget(config, reactive({})));
|
|
14842
14844
|
collectIdlePromises = [
|
|
14843
14845
|
collectIdle(root.items, true, DepTargetType.DATA_SOURCE),
|
|
14844
14846
|
collectIdle(root.items, true, DepTargetType.DATA_SOURCE_COND)
|
|
14845
14847
|
];
|
|
14846
14848
|
} else if (isModifyMock) {
|
|
14849
|
+
depService.removeTarget(config.id, DepTargetType.DATA_SOURCE);
|
|
14850
|
+
depService.addTarget(createDataSourceTarget(config, reactive({})));
|
|
14847
14851
|
collectIdlePromises = [collectIdle(root.items, true, DepTargetType.DATA_SOURCE)];
|
|
14848
14852
|
} else if (isModifyMethod) {
|
|
14853
|
+
depService.removeTarget(config.id, DepTargetType.DATA_SOURCE_METHOD);
|
|
14854
|
+
depService.addTarget(createDataSourceMethodTarget(config, reactive({})));
|
|
14849
14855
|
collectIdlePromises = [collectIdle(root.items, true, DepTargetType.DATA_SOURCE_METHOD)];
|
|
14850
14856
|
}
|
|
14851
|
-
Promise.all(collectIdlePromises).then(() =>
|
|
14852
|
-
updateDataSourceSchema();
|
|
14853
|
-
updateDsData();
|
|
14854
|
-
updateStageNodes(root.items);
|
|
14855
|
-
});
|
|
14857
|
+
Promise.all(collectIdlePromises).then(() => updateDataSourceSchema()).then(() => updateDsData()).then(() => updateStageNodes(root.items));
|
|
14856
14858
|
}
|
|
14857
14859
|
} else if (root?.dataSources) {
|
|
14858
14860
|
updateDsData();
|
|
@@ -14911,16 +14913,25 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
14911
14913
|
}
|
|
14912
14914
|
root.dataSourceCondDeps[target.id] = target.deps;
|
|
14913
14915
|
}
|
|
14916
|
+
if (target.type === DepTargetType.DATA_SOURCE_METHOD) {
|
|
14917
|
+
if (!root.dataSourceMethodDeps) {
|
|
14918
|
+
root.dataSourceMethodDeps = {};
|
|
14919
|
+
}
|
|
14920
|
+
root.dataSourceMethodDeps[target.id] = target.deps;
|
|
14921
|
+
}
|
|
14914
14922
|
};
|
|
14915
|
-
const targetRemoveHandler = (id) => {
|
|
14923
|
+
const targetRemoveHandler = (id, type) => {
|
|
14916
14924
|
const root = editorService.get("root");
|
|
14917
14925
|
if (!root) return;
|
|
14918
|
-
if (root.dataSourceDeps) {
|
|
14926
|
+
if (root.dataSourceDeps && type === DepTargetType.DATA_SOURCE) {
|
|
14919
14927
|
delete root.dataSourceDeps[id];
|
|
14920
14928
|
}
|
|
14921
|
-
if (root.dataSourceCondDeps) {
|
|
14929
|
+
if (root.dataSourceCondDeps && type === DepTargetType.DATA_SOURCE_COND) {
|
|
14922
14930
|
delete root.dataSourceCondDeps[id];
|
|
14923
14931
|
}
|
|
14932
|
+
if (root.dataSourceMethodDeps && type === DepTargetType.DATA_SOURCE_METHOD) {
|
|
14933
|
+
delete root.dataSourceMethodDeps[id];
|
|
14934
|
+
}
|
|
14924
14935
|
};
|
|
14925
14936
|
depService.on("add-target", targetAddHandler);
|
|
14926
14937
|
depService.on("remove-target", targetRemoveHandler);
|
|
@@ -18817,7 +18817,7 @@
|
|
|
18817
18817
|
const targets = this.watcher.getTargets(type);
|
|
18818
18818
|
if (!targets) return;
|
|
18819
18819
|
for (const target of Object.values(targets)) {
|
|
18820
|
-
this.emit("remove-target", target.id);
|
|
18820
|
+
this.emit("remove-target", target.id, type);
|
|
18821
18821
|
}
|
|
18822
18822
|
}
|
|
18823
18823
|
getTargets(type = core.DepTargetType.DEFAULT) {
|
|
@@ -18832,7 +18832,7 @@
|
|
|
18832
18832
|
}
|
|
18833
18833
|
removeTarget(id, type = core.DepTargetType.DEFAULT) {
|
|
18834
18834
|
this.watcher.removeTarget(id, type);
|
|
18835
|
-
this.emit("remove-target", id);
|
|
18835
|
+
this.emit("remove-target", id, type);
|
|
18836
18836
|
}
|
|
18837
18837
|
clearTargets() {
|
|
18838
18838
|
this.watcher.clearTargets();
|
|
@@ -18967,7 +18967,7 @@
|
|
|
18967
18967
|
methodMap[utils.toLine(type)] = [...method];
|
|
18968
18968
|
}
|
|
18969
18969
|
getMethod(type) {
|
|
18970
|
-
return cloneDeep(methodMap[utils.toLine(type)]);
|
|
18970
|
+
return cloneDeep(methodMap[utils.toLine(type)]) || [];
|
|
18971
18971
|
}
|
|
18972
18972
|
resetState() {
|
|
18973
18973
|
eventMap = vue.reactive({});
|
|
@@ -19710,7 +19710,7 @@
|
|
|
19710
19710
|
if (!changeRecord.propPath) {
|
|
19711
19711
|
continue;
|
|
19712
19712
|
}
|
|
19713
|
-
isModifyField = changeRecord.propPath === "fields" || /fields.(\d)+.name/.test(changeRecord.propPath) || /fields.(\d)+$/.test(changeRecord.propPath);
|
|
19713
|
+
isModifyField = changeRecord.propPath === "fields" || /fields.(\d)+.name/.test(changeRecord.propPath) || /fields.(\d)+.defaultValue/.test(changeRecord.propPath) || /fields.(\d)+$/.test(changeRecord.propPath);
|
|
19714
19714
|
isModifyMock = changeRecord.propPath === "mocks";
|
|
19715
19715
|
isModifyMethod = changeRecord.propPath === "methods" || /methods.(\d)+.name/.test(changeRecord.propPath) || /methods.(\d)+$/.test(changeRecord.propPath);
|
|
19716
19716
|
needRecollectDep = isModifyField || isModifyMock || isModifyMethod;
|
|
@@ -19722,24 +19722,26 @@
|
|
|
19722
19722
|
if (needRecollectDep) {
|
|
19723
19723
|
if (Array.isArray(root?.items)) {
|
|
19724
19724
|
depService.clearIdleTasks();
|
|
19725
|
-
removeDataSourceTarget(config.id);
|
|
19726
|
-
initDataSourceDepTarget(config);
|
|
19727
19725
|
let collectIdlePromises = [];
|
|
19728
19726
|
if (isModifyField) {
|
|
19727
|
+
depService.removeTarget(config.id, core.DepTargetType.DATA_SOURCE);
|
|
19728
|
+
depService.removeTarget(config.id, core.DepTargetType.DATA_SOURCE_COND);
|
|
19729
|
+
depService.addTarget(core.createDataSourceTarget(config, vue.reactive({})));
|
|
19730
|
+
depService.addTarget(core.createDataSourceCondTarget(config, vue.reactive({})));
|
|
19729
19731
|
collectIdlePromises = [
|
|
19730
19732
|
collectIdle(root.items, true, core.DepTargetType.DATA_SOURCE),
|
|
19731
19733
|
collectIdle(root.items, true, core.DepTargetType.DATA_SOURCE_COND)
|
|
19732
19734
|
];
|
|
19733
19735
|
} else if (isModifyMock) {
|
|
19736
|
+
depService.removeTarget(config.id, core.DepTargetType.DATA_SOURCE);
|
|
19737
|
+
depService.addTarget(core.createDataSourceTarget(config, vue.reactive({})));
|
|
19734
19738
|
collectIdlePromises = [collectIdle(root.items, true, core.DepTargetType.DATA_SOURCE)];
|
|
19735
19739
|
} else if (isModifyMethod) {
|
|
19740
|
+
depService.removeTarget(config.id, core.DepTargetType.DATA_SOURCE_METHOD);
|
|
19741
|
+
depService.addTarget(core.createDataSourceMethodTarget(config, vue.reactive({})));
|
|
19736
19742
|
collectIdlePromises = [collectIdle(root.items, true, core.DepTargetType.DATA_SOURCE_METHOD)];
|
|
19737
19743
|
}
|
|
19738
|
-
Promise.all(collectIdlePromises).then(() =>
|
|
19739
|
-
updateDataSourceSchema();
|
|
19740
|
-
updateDsData();
|
|
19741
|
-
updateStageNodes(root.items);
|
|
19742
|
-
});
|
|
19744
|
+
Promise.all(collectIdlePromises).then(() => updateDataSourceSchema()).then(() => updateDsData()).then(() => updateStageNodes(root.items));
|
|
19743
19745
|
}
|
|
19744
19746
|
} else if (root?.dataSources) {
|
|
19745
19747
|
updateDsData();
|
|
@@ -19798,16 +19800,25 @@
|
|
|
19798
19800
|
}
|
|
19799
19801
|
root.dataSourceCondDeps[target.id] = target.deps;
|
|
19800
19802
|
}
|
|
19803
|
+
if (target.type === core.DepTargetType.DATA_SOURCE_METHOD) {
|
|
19804
|
+
if (!root.dataSourceMethodDeps) {
|
|
19805
|
+
root.dataSourceMethodDeps = {};
|
|
19806
|
+
}
|
|
19807
|
+
root.dataSourceMethodDeps[target.id] = target.deps;
|
|
19808
|
+
}
|
|
19801
19809
|
};
|
|
19802
|
-
const targetRemoveHandler = (id) => {
|
|
19810
|
+
const targetRemoveHandler = (id, type) => {
|
|
19803
19811
|
const root = editorService.get("root");
|
|
19804
19812
|
if (!root) return;
|
|
19805
|
-
if (root.dataSourceDeps) {
|
|
19813
|
+
if (root.dataSourceDeps && type === core.DepTargetType.DATA_SOURCE) {
|
|
19806
19814
|
delete root.dataSourceDeps[id];
|
|
19807
19815
|
}
|
|
19808
|
-
if (root.dataSourceCondDeps) {
|
|
19816
|
+
if (root.dataSourceCondDeps && type === core.DepTargetType.DATA_SOURCE_COND) {
|
|
19809
19817
|
delete root.dataSourceCondDeps[id];
|
|
19810
19818
|
}
|
|
19819
|
+
if (root.dataSourceMethodDeps && type === core.DepTargetType.DATA_SOURCE_METHOD) {
|
|
19820
|
+
delete root.dataSourceMethodDeps[id];
|
|
19821
|
+
}
|
|
19811
19822
|
};
|
|
19812
19823
|
depService.on("add-target", targetAddHandler);
|
|
19813
19824
|
depService.on("remove-target", targetRemoveHandler);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.5.
|
|
2
|
+
"version": "1.5.12",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"moveable": "^0.53.0",
|
|
59
59
|
"serialize-javascript": "^6.0.0",
|
|
60
60
|
"sortablejs": "^1.15.2",
|
|
61
|
-
"@tmagic/design": "1.5.
|
|
62
|
-
"@tmagic/form": "1.5.
|
|
63
|
-
"@tmagic/
|
|
64
|
-
"@tmagic/
|
|
65
|
-
"@tmagic/
|
|
61
|
+
"@tmagic/design": "1.5.12",
|
|
62
|
+
"@tmagic/form": "1.5.12",
|
|
63
|
+
"@tmagic/stage": "1.5.12",
|
|
64
|
+
"@tmagic/table": "1.5.12",
|
|
65
|
+
"@tmagic/utils": "1.5.12"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/events": "^3.0.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"monaco-editor": "^0.48.0",
|
|
77
77
|
"typescript": "*",
|
|
78
78
|
"vue": ">=3.5.0",
|
|
79
|
-
"@tmagic/core": "1.5.
|
|
79
|
+
"@tmagic/core": "1.5.12"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"typescript": {
|
package/src/initService.ts
CHANGED
|
@@ -502,6 +502,7 @@ export const initServiceEvents = (
|
|
|
502
502
|
isModifyField =
|
|
503
503
|
changeRecord.propPath === 'fields' ||
|
|
504
504
|
/fields.(\d)+.name/.test(changeRecord.propPath) ||
|
|
505
|
+
/fields.(\d)+.defaultValue/.test(changeRecord.propPath) ||
|
|
505
506
|
/fields.(\d)+$/.test(changeRecord.propPath);
|
|
506
507
|
|
|
507
508
|
isModifyMock = changeRecord.propPath === 'mocks';
|
|
@@ -523,25 +524,35 @@ export const initServiceEvents = (
|
|
|
523
524
|
if (Array.isArray(root?.items)) {
|
|
524
525
|
depService.clearIdleTasks();
|
|
525
526
|
|
|
526
|
-
removeDataSourceTarget(config.id);
|
|
527
|
-
initDataSourceDepTarget(config);
|
|
528
|
-
|
|
529
527
|
let collectIdlePromises: Promise<void[]>[] = [];
|
|
530
528
|
if (isModifyField) {
|
|
529
|
+
depService.removeTarget(config.id, DepTargetType.DATA_SOURCE);
|
|
530
|
+
depService.removeTarget(config.id, DepTargetType.DATA_SOURCE_COND);
|
|
531
|
+
|
|
532
|
+
depService.addTarget(createDataSourceTarget(config, reactive({})));
|
|
533
|
+
depService.addTarget(createDataSourceCondTarget(config, reactive({})));
|
|
534
|
+
|
|
531
535
|
collectIdlePromises = [
|
|
532
536
|
collectIdle(root.items, true, DepTargetType.DATA_SOURCE),
|
|
533
537
|
collectIdle(root.items, true, DepTargetType.DATA_SOURCE_COND),
|
|
534
538
|
];
|
|
535
539
|
} else if (isModifyMock) {
|
|
540
|
+
depService.removeTarget(config.id, DepTargetType.DATA_SOURCE);
|
|
541
|
+
|
|
542
|
+
depService.addTarget(createDataSourceTarget(config, reactive({})));
|
|
543
|
+
|
|
536
544
|
collectIdlePromises = [collectIdle(root.items, true, DepTargetType.DATA_SOURCE)];
|
|
537
545
|
} else if (isModifyMethod) {
|
|
546
|
+
depService.removeTarget(config.id, DepTargetType.DATA_SOURCE_METHOD);
|
|
547
|
+
|
|
548
|
+
depService.addTarget(createDataSourceMethodTarget(config, reactive({})));
|
|
549
|
+
|
|
538
550
|
collectIdlePromises = [collectIdle(root.items, true, DepTargetType.DATA_SOURCE_METHOD)];
|
|
539
551
|
}
|
|
540
|
-
Promise.all(collectIdlePromises)
|
|
541
|
-
updateDataSourceSchema()
|
|
542
|
-
updateDsData()
|
|
543
|
-
updateStageNodes(root.items);
|
|
544
|
-
});
|
|
552
|
+
Promise.all(collectIdlePromises)
|
|
553
|
+
.then(() => updateDataSourceSchema())
|
|
554
|
+
.then(() => updateDsData())
|
|
555
|
+
.then(() => updateStageNodes(root.items));
|
|
545
556
|
}
|
|
546
557
|
} else if (root?.dataSources) {
|
|
547
558
|
updateDsData();
|
|
@@ -616,20 +627,31 @@ export const initServiceEvents = (
|
|
|
616
627
|
}
|
|
617
628
|
root.dataSourceCondDeps[target.id] = target.deps;
|
|
618
629
|
}
|
|
630
|
+
|
|
631
|
+
if (target.type === DepTargetType.DATA_SOURCE_METHOD) {
|
|
632
|
+
if (!root.dataSourceMethodDeps) {
|
|
633
|
+
root.dataSourceMethodDeps = {};
|
|
634
|
+
}
|
|
635
|
+
root.dataSourceMethodDeps[target.id] = target.deps;
|
|
636
|
+
}
|
|
619
637
|
};
|
|
620
638
|
|
|
621
|
-
const targetRemoveHandler = (id: string | number) => {
|
|
639
|
+
const targetRemoveHandler = (id: string | number, type: DepTargetType) => {
|
|
622
640
|
const root = editorService.get('root');
|
|
623
641
|
|
|
624
642
|
if (!root) return;
|
|
625
643
|
|
|
626
|
-
if (root.dataSourceDeps) {
|
|
644
|
+
if (root.dataSourceDeps && type === DepTargetType.DATA_SOURCE) {
|
|
627
645
|
delete root.dataSourceDeps[id];
|
|
628
646
|
}
|
|
629
647
|
|
|
630
|
-
if (root.dataSourceCondDeps) {
|
|
648
|
+
if (root.dataSourceCondDeps && type === DepTargetType.DATA_SOURCE_COND) {
|
|
631
649
|
delete root.dataSourceCondDeps[id];
|
|
632
650
|
}
|
|
651
|
+
|
|
652
|
+
if (root.dataSourceMethodDeps && type === DepTargetType.DATA_SOURCE_METHOD) {
|
|
653
|
+
delete root.dataSourceMethodDeps[id];
|
|
654
|
+
}
|
|
633
655
|
};
|
|
634
656
|
|
|
635
657
|
depService.on('add-target', targetAddHandler);
|
package/src/services/dep.ts
CHANGED
|
@@ -28,7 +28,7 @@ import BaseService from './BaseService';
|
|
|
28
28
|
|
|
29
29
|
export interface DepEvents {
|
|
30
30
|
'add-target': [target: Target];
|
|
31
|
-
'remove-target': [id: string | number];
|
|
31
|
+
'remove-target': [id: string | number, type: string | DepTargetType];
|
|
32
32
|
collected: [nodes: MNode[], deep: boolean];
|
|
33
33
|
'ds-collected': [nodes: MNode[], deep: boolean];
|
|
34
34
|
}
|
|
@@ -77,7 +77,7 @@ class Dep extends BaseService {
|
|
|
77
77
|
if (!targets) return;
|
|
78
78
|
|
|
79
79
|
for (const target of Object.values(targets)) {
|
|
80
|
-
this.emit('remove-target', target.id);
|
|
80
|
+
this.emit('remove-target', target.id, type);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -96,7 +96,7 @@ class Dep extends BaseService {
|
|
|
96
96
|
|
|
97
97
|
public removeTarget(id: Id, type: string = DepTargetType.DEFAULT) {
|
|
98
98
|
this.watcher.removeTarget(id, type);
|
|
99
|
-
this.emit('remove-target', id);
|
|
99
|
+
this.emit('remove-target', id, type);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
public clearTargets() {
|
package/src/services/events.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -295,7 +295,7 @@ declare const _default$G: DataSource;
|
|
|
295
295
|
|
|
296
296
|
interface DepEvents {
|
|
297
297
|
'add-target': [target: Target];
|
|
298
|
-
'remove-target': [id: string | number];
|
|
298
|
+
'remove-target': [id: string | number, type: string | DepTargetType];
|
|
299
299
|
collected: [nodes: MNode[], deep: boolean];
|
|
300
300
|
'ds-collected': [nodes: MNode[], deep: boolean];
|
|
301
301
|
}
|