@antv/layout 0.3.18 → 0.3.20
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/layout.min.js +1 -1
- package/dist/layout.min.js.map +1 -1
- package/es/layout/dagre.d.ts +4 -4
- package/es/layout/dagre.js +58 -44
- package/es/layout/dagre.js.map +1 -1
- package/es/registy/index.js +4 -3
- package/es/registy/index.js.map +1 -1
- package/lib/layout/dagre.d.ts +4 -4
- package/lib/layout/dagre.js +56 -42
- package/lib/layout/dagre.js.map +1 -1
- package/lib/registy/index.js +4 -2
- package/lib/registy/index.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/dagre.ts +55 -42
- package/src/registy/index.ts +10 -4
package/src/registy/index.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Base } from
|
|
2
|
-
import { isObject } from
|
|
1
|
+
import { Base } from '../layout/base';
|
|
2
|
+
import { isObject } from '../util';
|
|
3
3
|
|
|
4
4
|
const map: Map<string, any> = new Map();
|
|
5
5
|
|
|
6
6
|
export const registerLayout = (name: string, layoutOverride: any) => {
|
|
7
7
|
if (map.get(name)) {
|
|
8
|
-
console.warn(
|
|
8
|
+
console.warn(
|
|
9
|
+
`The layout with the name ${name} exists already, it will be overridden`
|
|
10
|
+
);
|
|
9
11
|
}
|
|
10
12
|
if (isObject(layoutOverride)) {
|
|
11
13
|
// tslint:disable-next-line: max-classes-per-file
|
|
@@ -14,7 +16,11 @@ export const registerLayout = (name: string, layoutOverride: any) => {
|
|
|
14
16
|
super();
|
|
15
17
|
const self = this as any;
|
|
16
18
|
const props: any = {};
|
|
17
|
-
const defaultCfg =
|
|
19
|
+
const defaultCfg = Object.assign(
|
|
20
|
+
{},
|
|
21
|
+
self.getDefaultCfg(),
|
|
22
|
+
layoutOverride.getDefaultCfg?.() || {}
|
|
23
|
+
);
|
|
18
24
|
Object.assign(props, defaultCfg, layoutOverride, cfg as unknown);
|
|
19
25
|
Object.keys(props).forEach((key: string) => {
|
|
20
26
|
const value = props[key];
|