@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.
Files changed (75) hide show
  1. package/README.md +43 -7
  2. package/README.zh-CN.md +43 -7
  3. package/dist/infographic.min.js +111 -111
  4. package/dist/infographic.min.js.map +1 -1
  5. package/esm/designs/layouts/Align.js +6 -6
  6. package/esm/designs/layouts/Flex.js +8 -6
  7. package/esm/designs/structures/chart-wordcloud.js +1 -1
  8. package/esm/designs/structures/hierarchy-structure.d.ts +45 -0
  9. package/esm/designs/structures/hierarchy-structure.js +266 -0
  10. package/esm/designs/structures/index.d.ts +2 -0
  11. package/esm/designs/structures/index.js +2 -0
  12. package/esm/designs/structures/list-zigzag.d.ts +11 -0
  13. package/esm/designs/structures/list-zigzag.js +240 -0
  14. package/esm/index.d.ts +1 -1
  15. package/esm/index.js +1 -1
  16. package/esm/renderer/composites/icon.d.ts +2 -5
  17. package/esm/renderer/composites/icon.js +5 -10
  18. package/esm/renderer/composites/illus.d.ts +3 -2
  19. package/esm/renderer/composites/illus.js +6 -2
  20. package/esm/renderer/composites/index.d.ts +2 -2
  21. package/esm/renderer/composites/index.js +2 -2
  22. package/esm/renderer/palettes/registry.d.ts +1 -1
  23. package/esm/renderer/palettes/registry.js +1 -1
  24. package/esm/renderer/renderer.js +6 -3
  25. package/esm/resource/loader.d.ts +2 -1
  26. package/esm/resource/loader.js +55 -23
  27. package/esm/templates/built-in.js +4 -0
  28. package/esm/templates/hierarchy-structure.d.ts +2 -0
  29. package/esm/templates/hierarchy-structure.js +21 -0
  30. package/esm/templates/list-zigzag.d.ts +2 -0
  31. package/esm/templates/list-zigzag.js +68 -0
  32. package/lib/designs/layouts/Align.js +6 -6
  33. package/lib/designs/layouts/Flex.js +8 -6
  34. package/lib/designs/structures/chart-wordcloud.js +1 -1
  35. package/lib/designs/structures/hierarchy-structure.d.ts +45 -0
  36. package/lib/designs/structures/hierarchy-structure.js +270 -0
  37. package/lib/designs/structures/index.d.ts +2 -0
  38. package/lib/designs/structures/index.js +2 -0
  39. package/lib/designs/structures/list-zigzag.d.ts +11 -0
  40. package/lib/designs/structures/list-zigzag.js +246 -0
  41. package/lib/index.d.ts +1 -1
  42. package/lib/index.js +3 -2
  43. package/lib/renderer/composites/icon.d.ts +2 -5
  44. package/lib/renderer/composites/icon.js +5 -11
  45. package/lib/renderer/composites/illus.d.ts +3 -2
  46. package/lib/renderer/composites/illus.js +7 -2
  47. package/lib/renderer/composites/index.d.ts +2 -2
  48. package/lib/renderer/composites/index.js +2 -2
  49. package/lib/renderer/palettes/registry.d.ts +1 -1
  50. package/lib/renderer/palettes/registry.js +1 -1
  51. package/lib/renderer/renderer.js +5 -2
  52. package/lib/resource/loader.d.ts +2 -1
  53. package/lib/resource/loader.js +55 -23
  54. package/lib/templates/built-in.js +4 -0
  55. package/lib/templates/hierarchy-structure.d.ts +2 -0
  56. package/lib/templates/hierarchy-structure.js +24 -0
  57. package/lib/templates/list-zigzag.d.ts +2 -0
  58. package/lib/templates/list-zigzag.js +71 -0
  59. package/package.json +1 -1
  60. package/src/designs/layouts/Align.tsx +6 -6
  61. package/src/designs/layouts/Flex.tsx +8 -6
  62. package/src/designs/structures/chart-wordcloud.tsx +1 -1
  63. package/src/designs/structures/hierarchy-structure.tsx +658 -0
  64. package/src/designs/structures/index.ts +2 -0
  65. package/src/designs/structures/list-zigzag.tsx +492 -0
  66. package/src/index.ts +2 -0
  67. package/src/renderer/composites/icon.ts +6 -16
  68. package/src/renderer/composites/illus.ts +12 -2
  69. package/src/renderer/composites/index.ts +2 -2
  70. package/src/renderer/palettes/registry.ts +2 -2
  71. package/src/renderer/renderer.ts +5 -11
  72. package/src/resource/loader.ts +54 -20
  73. package/src/templates/built-in.ts +4 -0
  74. package/src/templates/hierarchy-structure.ts +23 -0
  75. 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/infographic",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "An Infographic Generation and Rendering Framework, bring words to life!",
5
5
  "keywords": [
6
6
  "antv",
@@ -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 = 0; // 相对容器
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 = 0;
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 });
@@ -274,5 +274,5 @@ export const ChartWordCloud: ComponentType<ChartWordCloudProps> = (props) => {
274
274
 
275
275
  registerStructure('chart-wordcloud', {
276
276
  component: ChartWordCloud,
277
- composites: ['item'],
277
+ composites: [],
278
278
  });