@antv/infographic 0.2.2 → 0.2.4
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/README.md +43 -7
- package/README.zh-CN.md +43 -7
- package/dist/infographic.min.js +111 -111
- package/dist/infographic.min.js.map +1 -1
- package/esm/designs/layouts/Align.js +6 -6
- package/esm/designs/layouts/Flex.js +8 -6
- package/esm/designs/structures/chart-wordcloud.js +1 -1
- package/esm/designs/structures/hierarchy-structure.d.ts +45 -0
- package/esm/designs/structures/hierarchy-structure.js +266 -0
- package/esm/designs/structures/index.d.ts +2 -0
- package/esm/designs/structures/index.js +2 -0
- package/esm/designs/structures/list-zigzag.d.ts +11 -0
- package/esm/designs/structures/list-zigzag.js +240 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/renderer/composites/icon.d.ts +2 -5
- package/esm/renderer/composites/icon.js +5 -10
- package/esm/renderer/composites/illus.d.ts +3 -2
- package/esm/renderer/composites/illus.js +6 -2
- package/esm/renderer/composites/index.d.ts +2 -2
- package/esm/renderer/composites/index.js +2 -2
- package/esm/renderer/palettes/registry.d.ts +1 -1
- package/esm/renderer/palettes/registry.js +1 -1
- package/esm/renderer/renderer.js +6 -3
- package/esm/resource/loader.d.ts +2 -1
- package/esm/resource/loader.js +55 -23
- package/esm/templates/built-in.js +4 -0
- package/esm/templates/hierarchy-structure.d.ts +2 -0
- package/esm/templates/hierarchy-structure.js +21 -0
- package/esm/templates/list-zigzag.d.ts +2 -0
- package/esm/templates/list-zigzag.js +68 -0
- package/lib/designs/layouts/Align.js +6 -6
- package/lib/designs/layouts/Flex.js +8 -6
- package/lib/designs/structures/chart-wordcloud.js +1 -1
- package/lib/designs/structures/hierarchy-structure.d.ts +45 -0
- package/lib/designs/structures/hierarchy-structure.js +270 -0
- package/lib/designs/structures/index.d.ts +2 -0
- package/lib/designs/structures/index.js +2 -0
- package/lib/designs/structures/list-zigzag.d.ts +11 -0
- package/lib/designs/structures/list-zigzag.js +246 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -2
- package/lib/renderer/composites/icon.d.ts +2 -5
- package/lib/renderer/composites/icon.js +5 -11
- package/lib/renderer/composites/illus.d.ts +3 -2
- package/lib/renderer/composites/illus.js +7 -2
- package/lib/renderer/composites/index.d.ts +2 -2
- package/lib/renderer/composites/index.js +2 -2
- package/lib/renderer/palettes/registry.d.ts +1 -1
- package/lib/renderer/palettes/registry.js +1 -1
- package/lib/renderer/renderer.js +5 -2
- package/lib/resource/loader.d.ts +2 -1
- package/lib/resource/loader.js +55 -23
- package/lib/templates/built-in.js +4 -0
- package/lib/templates/hierarchy-structure.d.ts +2 -0
- package/lib/templates/hierarchy-structure.js +24 -0
- package/lib/templates/list-zigzag.d.ts +2 -0
- package/lib/templates/list-zigzag.js +71 -0
- package/package.json +1 -1
- package/src/designs/layouts/Align.tsx +6 -6
- package/src/designs/layouts/Flex.tsx +8 -6
- package/src/designs/structures/chart-wordcloud.tsx +1 -1
- package/src/designs/structures/hierarchy-structure.tsx +658 -0
- package/src/designs/structures/index.ts +2 -0
- package/src/designs/structures/list-zigzag.tsx +492 -0
- package/src/index.ts +2 -0
- package/src/renderer/composites/icon.ts +6 -16
- package/src/renderer/composites/illus.ts +12 -2
- package/src/renderer/composites/index.ts +2 -2
- package/src/renderer/palettes/registry.ts +2 -2
- package/src/renderer/renderer.ts +5 -11
- package/src/resource/loader.ts +54 -20
- package/src/templates/built-in.ts +4 -0
- package/src/templates/hierarchy-structure.ts +23 -0
- package/src/templates/list-zigzag.ts +70 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listZigzagTemplates = void 0;
|
|
4
|
+
exports.listZigzagTemplates = {
|
|
5
|
+
'list-zigzag-up-compact-card': {
|
|
6
|
+
design: {
|
|
7
|
+
title: 'default',
|
|
8
|
+
structure: {
|
|
9
|
+
type: 'list-zigzag-up',
|
|
10
|
+
},
|
|
11
|
+
items: [
|
|
12
|
+
{
|
|
13
|
+
type: 'compact-card',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
themeConfig: {
|
|
18
|
+
colorPrimary: '#17CA2C',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
'list-zigzag-up-simple': {
|
|
22
|
+
design: {
|
|
23
|
+
title: 'default',
|
|
24
|
+
structure: {
|
|
25
|
+
type: 'list-zigzag-up',
|
|
26
|
+
},
|
|
27
|
+
items: [
|
|
28
|
+
{
|
|
29
|
+
type: 'simple',
|
|
30
|
+
usePaletteColor: true,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
themeConfig: {
|
|
35
|
+
colorPrimary: '#17CA2C',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
'list-zigzag-down-compact-card': {
|
|
39
|
+
design: {
|
|
40
|
+
title: 'default',
|
|
41
|
+
structure: {
|
|
42
|
+
type: 'list-zigzag-down',
|
|
43
|
+
},
|
|
44
|
+
items: [
|
|
45
|
+
{
|
|
46
|
+
type: 'compact-card',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
themeConfig: {
|
|
51
|
+
colorPrimary: '#17CA2C',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
'list-zigzag-down-simple': {
|
|
55
|
+
design: {
|
|
56
|
+
title: 'default',
|
|
57
|
+
structure: {
|
|
58
|
+
type: 'list-zigzag-down',
|
|
59
|
+
},
|
|
60
|
+
items: [
|
|
61
|
+
{
|
|
62
|
+
type: 'simple',
|
|
63
|
+
usePaletteColor: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
themeConfig: {
|
|
68
|
+
colorPrimary: '#17CA2C',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
package/package.json
CHANGED
|
@@ -38,13 +38,13 @@ export const AlignLayout = createLayout<AlignLayoutProps>(
|
|
|
38
38
|
if (horizontal !== undefined) {
|
|
39
39
|
switch (horizontal) {
|
|
40
40
|
case 'left':
|
|
41
|
-
childProps.x =
|
|
41
|
+
childProps.x = -bounds.x; // 相对容器边界
|
|
42
42
|
break;
|
|
43
43
|
case 'center':
|
|
44
|
-
childProps.x = (containerWidth - bounds.width) / 2;
|
|
44
|
+
childProps.x = (containerWidth - bounds.width) / 2 - bounds.x;
|
|
45
45
|
break;
|
|
46
46
|
case 'right':
|
|
47
|
-
childProps.x = containerWidth - bounds.width;
|
|
47
|
+
childProps.x = containerWidth - bounds.width - bounds.x;
|
|
48
48
|
break;
|
|
49
49
|
}
|
|
50
50
|
} else if (childProps.x === undefined) {
|
|
@@ -56,13 +56,13 @@ export const AlignLayout = createLayout<AlignLayoutProps>(
|
|
|
56
56
|
if (vertical !== undefined) {
|
|
57
57
|
switch (vertical) {
|
|
58
58
|
case 'top':
|
|
59
|
-
childProps.y =
|
|
59
|
+
childProps.y = -bounds.y;
|
|
60
60
|
break;
|
|
61
61
|
case 'middle':
|
|
62
|
-
childProps.y = (containerHeight - bounds.height) / 2;
|
|
62
|
+
childProps.y = (containerHeight - bounds.height) / 2 - bounds.y;
|
|
63
63
|
break;
|
|
64
64
|
case 'bottom':
|
|
65
|
-
childProps.y = containerHeight - bounds.height;
|
|
65
|
+
childProps.y = containerHeight - bounds.height - bounds.y;
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
} else if (childProps.y === undefined) {
|
|
@@ -136,6 +136,8 @@ export const FlexLayout = createLayout<FlexLayoutProps>(
|
|
|
136
136
|
const bounds = lineBounds[childIndex];
|
|
137
137
|
const childMainSize = isRow ? bounds.width : bounds.height;
|
|
138
138
|
const childCrossSize = isRow ? bounds.height : bounds.width;
|
|
139
|
+
const mainOffset = isRow ? bounds.x : bounds.y;
|
|
140
|
+
const crossOffset = isRow ? bounds.y : bounds.x;
|
|
139
141
|
|
|
140
142
|
let crossPos = currentCrossPos;
|
|
141
143
|
if (hasContainerSize) {
|
|
@@ -155,14 +157,14 @@ export const FlexLayout = createLayout<FlexLayoutProps>(
|
|
|
155
157
|
let x: number, y: number;
|
|
156
158
|
if (isRow) {
|
|
157
159
|
x = isReverse
|
|
158
|
-
? containerWidth - currentMainPos - childMainSize
|
|
159
|
-
: currentMainPos;
|
|
160
|
-
y = crossPos;
|
|
160
|
+
? containerWidth - currentMainPos - childMainSize - mainOffset
|
|
161
|
+
: currentMainPos - mainOffset;
|
|
162
|
+
y = crossPos - crossOffset;
|
|
161
163
|
} else {
|
|
162
|
-
x = crossPos;
|
|
164
|
+
x = crossPos - crossOffset;
|
|
163
165
|
y = isReverse
|
|
164
|
-
? containerHeight - currentMainPos - childMainSize
|
|
165
|
-
: currentMainPos;
|
|
166
|
+
? containerHeight - currentMainPos - childMainSize - mainOffset
|
|
167
|
+
: currentMainPos - mainOffset;
|
|
166
168
|
}
|
|
167
169
|
|
|
168
170
|
const clonedChild = cloneElement(child, { x, y });
|