@antv/infographic 0.2.11 → 0.2.13

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 (328) hide show
  1. package/dist/infographic.min.js +98 -94
  2. package/dist/infographic.min.js.map +1 -1
  3. package/esm/designs/components/Btn.js +15 -4
  4. package/esm/designs/components/BtnsGroup.js +1 -1
  5. package/esm/designs/components/Illus.js +15 -3
  6. package/esm/designs/components/ItemDesc.js +17 -11
  7. package/esm/designs/components/ItemIcon.js +17 -18
  8. package/esm/designs/components/ItemLabel.js +17 -11
  9. package/esm/designs/components/ItemValue.js +17 -12
  10. package/esm/designs/components/ItemsGroup.js +1 -1
  11. package/esm/designs/components/ShapesGroup.js +1 -1
  12. package/esm/designs/components/Title.js +2 -2
  13. package/esm/designs/decorations/simple-arrow.js +14 -2
  14. package/esm/designs/decorations/triangle.js +14 -2
  15. package/esm/designs/defs/DropShadow.js +13 -2
  16. package/esm/designs/defs/LinearGradient.js +1 -1
  17. package/esm/designs/items/BadgeCard.js +2 -2
  18. package/esm/designs/items/CandyCardLite.js +1 -1
  19. package/esm/designs/items/CapsuleItem.js +3 -3
  20. package/esm/designs/items/CircleNode.js +1 -1
  21. package/esm/designs/items/CircularProgress.js +3 -2
  22. package/esm/designs/items/CompactCard.js +1 -1
  23. package/esm/designs/items/DoneList.js +1 -1
  24. package/esm/designs/items/HorizontalIconArrow.js +2 -2
  25. package/esm/designs/items/HorizontalIconLine.js +2 -2
  26. package/esm/designs/items/IconBadge.js +4 -3
  27. package/esm/designs/items/IndexedCard.js +1 -1
  28. package/esm/designs/items/LCornerCard.js +1 -1
  29. package/esm/designs/items/LetterCard.js +4 -3
  30. package/esm/designs/items/LinedText.js +6 -5
  31. package/esm/designs/items/PillBadge.js +2 -2
  32. package/esm/designs/items/PlainText.js +4 -4
  33. package/esm/designs/items/ProgressCard.js +4 -4
  34. package/esm/designs/items/QuarterCircular.js +1 -1
  35. package/esm/designs/items/QuarterSimpleCard.js +1 -1
  36. package/esm/designs/items/RibbonCard.js +2 -2
  37. package/esm/designs/items/RoundedRectNode.js +2 -2
  38. package/esm/designs/items/SimpleCircleNode.js +1 -1
  39. package/esm/designs/items/SimpleHorizontalArrow.js +2 -2
  40. package/esm/designs/items/SimpleIllusItem.js +1 -1
  41. package/esm/designs/items/SimpleItem.js +3 -3
  42. package/esm/designs/items/SimpleVerticalArrow.js +2 -2
  43. package/esm/designs/items/UnderlineText.js +1 -1
  44. package/esm/designs/items/VerticalIconArrow.js +2 -2
  45. package/esm/designs/layouts/Align.js +22 -15
  46. package/esm/designs/layouts/Flex.js +23 -16
  47. package/esm/designs/structures/chart-bar.js +7 -5
  48. package/esm/designs/structures/chart-column.js +3 -2
  49. package/esm/designs/structures/chart-line.js +7 -5
  50. package/esm/designs/structures/chart-pie.d.ts +25 -0
  51. package/esm/designs/structures/chart-pie.js +186 -26
  52. package/esm/designs/structures/chart-wordcloud.js +5 -14
  53. package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.js +1 -1
  54. package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.js +1 -1
  55. package/esm/designs/structures/compare-binary-horizontal/dividers/types.js +2 -1
  56. package/esm/designs/structures/compare-hierarchy-left-right.js +6 -5
  57. package/esm/designs/structures/compare-hierarchy-row.js +3 -2
  58. package/esm/designs/structures/compare-quadrant.js +2 -3
  59. package/esm/designs/structures/hierarchy-mindmap.js +19 -19
  60. package/esm/designs/structures/hierarchy-structure.js +1 -1
  61. package/esm/designs/structures/hierarchy-tree.js +15 -24
  62. package/esm/designs/structures/list-sector.js +5 -6
  63. package/esm/designs/structures/list-zigzag.js +2 -1
  64. package/esm/designs/structures/relation-dagre-flow.js +30 -35
  65. package/esm/designs/structures/relation-network.js +2 -2
  66. package/esm/designs/structures/sequence-funnel.js +1 -1
  67. package/esm/designs/structures/sequence-mountain.js +4 -4
  68. package/esm/designs/structures/sequence-pyramid.js +1 -1
  69. package/esm/designs/structures/sequence-zigzag-steps.js +2 -1
  70. package/esm/designs/utils/color.js +8 -4
  71. package/esm/designs/utils/index.d.ts +1 -0
  72. package/esm/designs/utils/index.js +1 -0
  73. package/esm/designs/utils/item.js +3 -2
  74. package/esm/designs/utils/normalize-percent.d.ts +19 -0
  75. package/esm/designs/utils/normalize-percent.js +32 -0
  76. package/esm/editor/commands/Batch.js +21 -8
  77. package/esm/editor/commands/UpdateElement.js +25 -22
  78. package/esm/editor/commands/UpdateOptions.js +23 -10
  79. package/esm/editor/commands/UpdateText.js +24 -11
  80. package/esm/editor/interactions/brush-select.js +27 -13
  81. package/esm/editor/interactions/click-select.js +13 -3
  82. package/esm/editor/interactions/dblclick-edit-text.js +36 -20
  83. package/esm/editor/interactions/drag-element.js +23 -9
  84. package/esm/editor/interactions/hotkey-history.js +17 -7
  85. package/esm/editor/interactions/select-highlight.js +5 -9
  86. package/esm/editor/interactions/zoom-wheel.d.ts +3 -0
  87. package/esm/editor/interactions/zoom-wheel.js +46 -22
  88. package/esm/editor/managers/command.js +45 -27
  89. package/esm/editor/managers/interaction.js +46 -33
  90. package/esm/editor/managers/state.js +9 -3
  91. package/esm/editor/plugins/edit-bar/components/color-picker.js +9 -6
  92. package/esm/editor/plugins/edit-bar/components/popover.js +15 -12
  93. package/esm/editor/plugins/edit-bar/components/select.js +10 -8
  94. package/esm/editor/plugins/edit-bar/edit-bar.js +7 -25
  95. package/esm/editor/plugins/edit-bar/edit-items/align-elements.js +5 -3
  96. package/esm/editor/plugins/edit-bar/edit-items/font-align.js +1 -1
  97. package/esm/editor/plugins/edit-bar/edit-items/font-color.js +2 -2
  98. package/esm/editor/plugins/edit-bar/edit-items/icon-color.js +2 -2
  99. package/esm/editor/plugins/resize-element.js +6 -4
  100. package/esm/editor/utils/click-handler.js +6 -3
  101. package/esm/editor/utils/coordinate.js +2 -1
  102. package/esm/editor/utils/element.js +2 -1
  103. package/esm/editor/utils/event.js +2 -1
  104. package/esm/editor/utils/extension.js +1 -1
  105. package/esm/editor/utils/hotkey.js +2 -1
  106. package/esm/exporter/font.js +106 -90
  107. package/esm/exporter/png.js +49 -37
  108. package/esm/exporter/svg.js +55 -38
  109. package/esm/jsx/components/Ellipse.js +5 -4
  110. package/esm/jsx/components/Path.js +2 -4
  111. package/esm/jsx/components/Polygon.js +15 -6
  112. package/esm/jsx/components/Text.js +21 -41
  113. package/esm/jsx/renderer.js +15 -7
  114. package/esm/jsx/utils/bounds.js +18 -16
  115. package/esm/jsx/utils/children.js +2 -1
  116. package/esm/jsx/utils/clone.js +13 -2
  117. package/esm/jsx/utils/element.js +2 -1
  118. package/esm/options/parser.js +45 -46
  119. package/esm/renderer/composites/background.js +3 -2
  120. package/esm/renderer/composites/icon.js +14 -19
  121. package/esm/renderer/composites/illus.js +17 -22
  122. package/esm/renderer/composites/shape.js +4 -2
  123. package/esm/renderer/composites/svg.js +2 -1
  124. package/esm/renderer/composites/text.js +5 -3
  125. package/esm/renderer/fonts/loader.js +4 -3
  126. package/esm/renderer/fonts/registry.js +1 -1
  127. package/esm/renderer/palettes/utils.js +3 -2
  128. package/esm/renderer/renderer.js +7 -5
  129. package/esm/renderer/stylize/gradient.js +3 -2
  130. package/esm/renderer/stylize/pattern.js +15 -8
  131. package/esm/renderer/stylize/rough.js +1 -1
  132. package/esm/resource/load-tracker.js +22 -10
  133. package/esm/resource/loader.js +80 -67
  134. package/esm/resource/loaders/image.js +71 -59
  135. package/esm/resource/loaders/remote.js +26 -15
  136. package/esm/resource/loaders/search.js +38 -25
  137. package/esm/resource/utils/parser.js +2 -1
  138. package/esm/runtime/Infographic.js +26 -13
  139. package/esm/runtime/utils.js +5 -8
  140. package/esm/ssr/renderer.js +42 -35
  141. package/esm/syntax/index.js +19 -6
  142. package/esm/syntax/mapper.js +2 -2
  143. package/esm/templates/built-in.js +91 -269
  144. package/esm/templates/chart-pie.d.ts +2 -0
  145. package/esm/templates/chart-pie.js +87 -0
  146. package/esm/templates/hierarchy-mindmap.js +1 -5
  147. package/esm/templates/hierarchy-tree.js +1 -5
  148. package/esm/templates/relation-dagre-flow.js +4 -28
  149. package/esm/themes/generator.js +8 -14
  150. package/esm/utils/fetch.js +48 -35
  151. package/esm/utils/icon.js +1 -4
  152. package/esm/utils/is-browser.js +2 -2
  153. package/esm/utils/measure-text.js +2 -1
  154. package/esm/utils/padding.js +1 -1
  155. package/esm/utils/recognizer.js +2 -1
  156. package/esm/utils/text.js +14 -3
  157. package/esm/utils/viewbox.d.ts +20 -0
  158. package/esm/utils/viewbox.js +10 -0
  159. package/esm/version.d.ts +1 -1
  160. package/esm/version.js +1 -1
  161. package/lib/designs/components/Btn.js +15 -4
  162. package/lib/designs/components/BtnsGroup.js +1 -1
  163. package/lib/designs/components/Illus.js +15 -3
  164. package/lib/designs/components/ItemDesc.js +17 -11
  165. package/lib/designs/components/ItemIcon.js +17 -18
  166. package/lib/designs/components/ItemLabel.js +17 -11
  167. package/lib/designs/components/ItemValue.js +17 -12
  168. package/lib/designs/components/ItemsGroup.js +1 -1
  169. package/lib/designs/components/ShapesGroup.js +1 -1
  170. package/lib/designs/components/Title.js +2 -2
  171. package/lib/designs/decorations/simple-arrow.js +14 -2
  172. package/lib/designs/decorations/triangle.js +14 -2
  173. package/lib/designs/defs/DropShadow.js +13 -2
  174. package/lib/designs/defs/LinearGradient.js +1 -1
  175. package/lib/designs/items/BadgeCard.js +2 -2
  176. package/lib/designs/items/CandyCardLite.js +1 -1
  177. package/lib/designs/items/CapsuleItem.js +3 -3
  178. package/lib/designs/items/CircleNode.js +1 -1
  179. package/lib/designs/items/CircularProgress.js +3 -2
  180. package/lib/designs/items/CompactCard.js +1 -1
  181. package/lib/designs/items/DoneList.js +1 -1
  182. package/lib/designs/items/HorizontalIconArrow.js +2 -2
  183. package/lib/designs/items/HorizontalIconLine.js +2 -2
  184. package/lib/designs/items/IconBadge.js +4 -3
  185. package/lib/designs/items/IndexedCard.js +1 -1
  186. package/lib/designs/items/LCornerCard.js +1 -1
  187. package/lib/designs/items/LetterCard.js +4 -3
  188. package/lib/designs/items/LinedText.js +6 -5
  189. package/lib/designs/items/PillBadge.js +2 -2
  190. package/lib/designs/items/PlainText.js +4 -4
  191. package/lib/designs/items/ProgressCard.js +4 -4
  192. package/lib/designs/items/QuarterCircular.js +1 -1
  193. package/lib/designs/items/QuarterSimpleCard.js +1 -1
  194. package/lib/designs/items/RibbonCard.js +2 -2
  195. package/lib/designs/items/RoundedRectNode.js +2 -2
  196. package/lib/designs/items/SimpleCircleNode.js +1 -1
  197. package/lib/designs/items/SimpleHorizontalArrow.js +2 -2
  198. package/lib/designs/items/SimpleIllusItem.js +1 -1
  199. package/lib/designs/items/SimpleItem.js +3 -3
  200. package/lib/designs/items/SimpleVerticalArrow.js +2 -2
  201. package/lib/designs/items/UnderlineText.js +1 -1
  202. package/lib/designs/items/VerticalIconArrow.js +2 -2
  203. package/lib/designs/layouts/Align.js +22 -15
  204. package/lib/designs/layouts/Flex.js +23 -16
  205. package/lib/designs/structures/chart-bar.js +7 -5
  206. package/lib/designs/structures/chart-column.js +3 -2
  207. package/lib/designs/structures/chart-line.js +7 -5
  208. package/lib/designs/structures/chart-pie.d.ts +25 -0
  209. package/lib/designs/structures/chart-pie.js +186 -25
  210. package/lib/designs/structures/chart-wordcloud.js +5 -14
  211. package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.js +1 -1
  212. package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.js +1 -1
  213. package/lib/designs/structures/compare-binary-horizontal/dividers/types.js +2 -1
  214. package/lib/designs/structures/compare-hierarchy-left-right.js +6 -5
  215. package/lib/designs/structures/compare-hierarchy-row.js +3 -2
  216. package/lib/designs/structures/compare-quadrant.js +2 -3
  217. package/lib/designs/structures/hierarchy-mindmap.js +19 -19
  218. package/lib/designs/structures/hierarchy-structure.js +1 -1
  219. package/lib/designs/structures/hierarchy-tree.js +15 -24
  220. package/lib/designs/structures/list-sector.js +5 -6
  221. package/lib/designs/structures/list-zigzag.js +2 -1
  222. package/lib/designs/structures/relation-dagre-flow.js +30 -35
  223. package/lib/designs/structures/relation-network.js +2 -2
  224. package/lib/designs/structures/sequence-funnel.js +1 -1
  225. package/lib/designs/structures/sequence-mountain.js +4 -4
  226. package/lib/designs/structures/sequence-pyramid.js +1 -1
  227. package/lib/designs/structures/sequence-zigzag-steps.js +2 -1
  228. package/lib/designs/utils/color.js +8 -4
  229. package/lib/designs/utils/index.d.ts +1 -0
  230. package/lib/designs/utils/index.js +1 -0
  231. package/lib/designs/utils/item.js +3 -2
  232. package/lib/designs/utils/normalize-percent.d.ts +19 -0
  233. package/lib/designs/utils/normalize-percent.js +35 -0
  234. package/lib/editor/commands/Batch.js +21 -8
  235. package/lib/editor/commands/UpdateElement.js +25 -22
  236. package/lib/editor/commands/UpdateOptions.js +23 -10
  237. package/lib/editor/commands/UpdateText.js +24 -11
  238. package/lib/editor/interactions/brush-select.js +27 -13
  239. package/lib/editor/interactions/click-select.js +13 -3
  240. package/lib/editor/interactions/dblclick-edit-text.js +36 -20
  241. package/lib/editor/interactions/drag-element.js +23 -9
  242. package/lib/editor/interactions/hotkey-history.js +17 -7
  243. package/lib/editor/interactions/select-highlight.js +5 -9
  244. package/lib/editor/interactions/zoom-wheel.d.ts +3 -0
  245. package/lib/editor/interactions/zoom-wheel.js +45 -21
  246. package/lib/editor/managers/command.js +43 -25
  247. package/lib/editor/managers/interaction.js +46 -33
  248. package/lib/editor/managers/state.js +9 -3
  249. package/lib/editor/plugins/edit-bar/components/color-picker.js +9 -6
  250. package/lib/editor/plugins/edit-bar/components/popover.js +15 -12
  251. package/lib/editor/plugins/edit-bar/components/select.js +10 -8
  252. package/lib/editor/plugins/edit-bar/edit-bar.js +7 -25
  253. package/lib/editor/plugins/edit-bar/edit-items/align-elements.js +5 -3
  254. package/lib/editor/plugins/edit-bar/edit-items/font-align.js +1 -1
  255. package/lib/editor/plugins/edit-bar/edit-items/font-color.js +2 -2
  256. package/lib/editor/plugins/edit-bar/edit-items/icon-color.js +2 -2
  257. package/lib/editor/plugins/resize-element.js +6 -4
  258. package/lib/editor/utils/click-handler.js +6 -3
  259. package/lib/editor/utils/coordinate.js +2 -1
  260. package/lib/editor/utils/element.js +2 -1
  261. package/lib/editor/utils/event.js +2 -1
  262. package/lib/editor/utils/extension.js +1 -1
  263. package/lib/editor/utils/hotkey.js +2 -1
  264. package/lib/exporter/font.js +106 -90
  265. package/lib/exporter/png.js +49 -37
  266. package/lib/exporter/svg.js +55 -38
  267. package/lib/jsx/components/Ellipse.js +5 -4
  268. package/lib/jsx/components/Path.js +2 -4
  269. package/lib/jsx/components/Polygon.js +15 -6
  270. package/lib/jsx/components/Text.js +21 -41
  271. package/lib/jsx/renderer.js +15 -7
  272. package/lib/jsx/utils/bounds.js +18 -16
  273. package/lib/jsx/utils/children.js +2 -1
  274. package/lib/jsx/utils/clone.js +13 -2
  275. package/lib/jsx/utils/element.js +2 -1
  276. package/lib/options/parser.js +45 -46
  277. package/lib/renderer/composites/background.js +3 -2
  278. package/lib/renderer/composites/icon.js +14 -19
  279. package/lib/renderer/composites/illus.js +17 -22
  280. package/lib/renderer/composites/shape.js +4 -2
  281. package/lib/renderer/composites/svg.js +2 -1
  282. package/lib/renderer/composites/text.js +5 -3
  283. package/lib/renderer/fonts/loader.js +4 -3
  284. package/lib/renderer/fonts/registry.js +1 -1
  285. package/lib/renderer/palettes/utils.js +3 -2
  286. package/lib/renderer/renderer.js +7 -5
  287. package/lib/renderer/stylize/gradient.js +3 -2
  288. package/lib/renderer/stylize/pattern.js +15 -8
  289. package/lib/renderer/stylize/rough.js +1 -1
  290. package/lib/resource/load-tracker.js +22 -10
  291. package/lib/resource/loader.js +80 -67
  292. package/lib/resource/loaders/image.js +71 -59
  293. package/lib/resource/loaders/remote.js +26 -15
  294. package/lib/resource/loaders/search.js +38 -25
  295. package/lib/resource/utils/parser.js +2 -1
  296. package/lib/runtime/Infographic.js +26 -13
  297. package/lib/runtime/utils.js +5 -8
  298. package/lib/ssr/renderer.js +42 -35
  299. package/lib/syntax/index.js +19 -6
  300. package/lib/syntax/mapper.js +2 -2
  301. package/lib/templates/built-in.js +91 -269
  302. package/lib/templates/chart-pie.d.ts +2 -0
  303. package/lib/templates/chart-pie.js +90 -0
  304. package/lib/templates/hierarchy-mindmap.js +1 -5
  305. package/lib/templates/hierarchy-tree.js +1 -5
  306. package/lib/templates/relation-dagre-flow.js +4 -28
  307. package/lib/themes/generator.js +8 -14
  308. package/lib/utils/fetch.js +48 -35
  309. package/lib/utils/icon.js +1 -4
  310. package/lib/utils/is-browser.js +2 -2
  311. package/lib/utils/measure-text.js +2 -1
  312. package/lib/utils/padding.js +1 -1
  313. package/lib/utils/recognizer.js +2 -1
  314. package/lib/utils/text.js +14 -3
  315. package/lib/utils/viewbox.d.ts +20 -0
  316. package/lib/utils/viewbox.js +12 -0
  317. package/lib/version.d.ts +1 -1
  318. package/lib/version.js +1 -1
  319. package/package.json +1 -2
  320. package/src/designs/structures/chart-pie.tsx +259 -26
  321. package/src/designs/utils/index.ts +1 -0
  322. package/src/designs/utils/normalize-percent.ts +33 -0
  323. package/src/editor/interactions/zoom-wheel.ts +64 -22
  324. package/src/editor/managers/state.ts +10 -5
  325. package/src/templates/built-in.ts +2 -81
  326. package/src/templates/chart-pie.ts +89 -0
  327. package/src/utils/viewbox.ts +23 -0
  328. package/src/version.ts +1 -1
@@ -10,6 +10,7 @@ import { registerItem } from './registry.js';
10
10
  * 支持渐变背景、斜纹和底部阴影效果
11
11
  */
12
12
  export const LetterCard = (props) => {
13
+ var _a, _b;
13
14
  const [{ datum, indexes, width = 280, height = 160, showStripe = true, showGradient = true, showBottomShade = true, themeColors, }, restProps,] = getItemProps(props, [
14
15
  'width',
15
16
  'height',
@@ -17,8 +18,8 @@ export const LetterCard = (props) => {
17
18
  'showGradient',
18
19
  'showBottomShade',
19
20
  ]);
20
- const displayLetter = datum.label?.[0].toUpperCase();
21
- const displayTitle = datum.label?.toUpperCase();
21
+ const displayLetter = (_a = datum.label) === null || _a === void 0 ? void 0 : _a[0].toUpperCase();
22
+ const displayTitle = (_b = datum.label) === null || _b === void 0 ? void 0 : _b.toUpperCase();
22
23
  const baseColor = themeColors.colorPrimary;
23
24
  const base = tinycolor(baseColor);
24
25
  const stripeWidth = 4;
@@ -45,7 +46,7 @@ export const LetterCard = (props) => {
45
46
  const textTotalHeight = letterHeight + textGap + titleHeight;
46
47
  const letterY = (height - textTotalHeight) / 2;
47
48
  const titleY = letterY + letterHeight + textGap;
48
- return (_jsxs(Group, { ...restProps, width: width, height: height, children: [_jsxs(Defs, { children: [showGradient && (_jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [_jsx("stop", { offset: "0%", stopColor: gradStart }), _jsx("stop", { offset: "100%", stopColor: gradEnd })] })), showStripe && (_jsxs("pattern", { id: patternId, patternUnits: "userSpaceOnUse", width: tile, height: tile, patternTransform: `rotate(${rotationDeg})`, children: [_jsx("rect", { x: "0", y: "0", width: tile, height: tile, fill: lightStripe }), _jsx("rect", { x: "0", y: "0", width: stripeWidth, height: tile, fill: darkStripe })] })), showBottomShade && (_jsxs("linearGradient", { id: shadeId, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [_jsx("stop", { offset: "0%", stopColor: "rgba(0,0,0,0)" }), _jsx("stop", { offset: "100%", stopColor: "rgba(0,0,0,0.16)" })] }))] }), _jsx(Rect, { x: 0, y: 0, width: width, height: height, fill: showGradient ? `url(#${gradientId})` : baseColor, rx: 0, ry: 0, "data-element-type": "shape" }), showStripe && (_jsx(Rect, { x: 0, y: 0, width: width, height: height, fill: `url(#${patternId})`, rx: 0, ry: 0 })), showBottomShade && (_jsx(Rect, { x: 0, y: height - bottomShadeHeight, width: width, height: bottomShadeHeight, fill: `url(#${shadeId})`, rx: 0, ry: 0 })), displayLetter && (_jsx(ItemLabel, { indexes: indexes, x: 0, y: letterY, width: width, fontSize: letterFontSize, fontWeight: "bold", fill: "#FFFFFF", alignHorizontal: "center", alignVertical: "top", lineHeight: 1, children: displayLetter })), _jsx(ItemLabel, { indexes: indexes, x: 0, y: titleY, width: width, fontSize: titleFontSize, fontWeight: "bold", fill: "#FFFFFF", alignHorizontal: "center", alignVertical: "middle", lineHeight: 1, children: displayTitle })] }));
49
+ return (_jsxs(Group, Object.assign({}, restProps, { width: width, height: height, children: [_jsxs(Defs, { children: [showGradient && (_jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [_jsx("stop", { offset: "0%", stopColor: gradStart }), _jsx("stop", { offset: "100%", stopColor: gradEnd })] })), showStripe && (_jsxs("pattern", { id: patternId, patternUnits: "userSpaceOnUse", width: tile, height: tile, patternTransform: `rotate(${rotationDeg})`, children: [_jsx("rect", { x: "0", y: "0", width: tile, height: tile, fill: lightStripe }), _jsx("rect", { x: "0", y: "0", width: stripeWidth, height: tile, fill: darkStripe })] })), showBottomShade && (_jsxs("linearGradient", { id: shadeId, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [_jsx("stop", { offset: "0%", stopColor: "rgba(0,0,0,0)" }), _jsx("stop", { offset: "100%", stopColor: "rgba(0,0,0,0.16)" })] }))] }), _jsx(Rect, { x: 0, y: 0, width: width, height: height, fill: showGradient ? `url(#${gradientId})` : baseColor, rx: 0, ry: 0, "data-element-type": "shape" }), showStripe && (_jsx(Rect, { x: 0, y: 0, width: width, height: height, fill: `url(#${patternId})`, rx: 0, ry: 0 })), showBottomShade && (_jsx(Rect, { x: 0, y: height - bottomShadeHeight, width: width, height: bottomShadeHeight, fill: `url(#${shadeId})`, rx: 0, ry: 0 })), displayLetter && (_jsx(ItemLabel, { indexes: indexes, x: 0, y: letterY, width: width, fontSize: letterFontSize, fontWeight: "bold", fill: "#FFFFFF", alignHorizontal: "center", alignVertical: "top", lineHeight: 1, children: displayLetter })), _jsx(ItemLabel, { indexes: indexes, x: 0, y: titleY, width: width, fontSize: titleFontSize, fontWeight: "bold", fill: "#FFFFFF", alignHorizontal: "center", alignVertical: "middle", lineHeight: 1, children: displayTitle })] })));
49
50
  };
50
51
  registerItem('letter-card', {
51
52
  component: LetterCard,
@@ -4,6 +4,7 @@ import { ItemLabel } from '../components/index.js';
4
4
  import { getItemProps } from '../utils/index.js';
5
5
  import { registerItem } from './registry.js';
6
6
  export const LinedText = (props) => {
7
+ var _a, _b, _c;
7
8
  const [{ datum, indexes, width, themeColors, positionH = 'normal', positionV = 'center', formatter = (text) => text || '', usePaletteColor = false, showUnderline = false, underlineGap = 6, underlineExtend = 8, underlineThickness = 2, }, restProps,] = getItemProps(props, [
8
9
  'width',
9
10
  'formatter',
@@ -13,21 +14,21 @@ export const LinedText = (props) => {
13
14
  'underlineExtend',
14
15
  'underlineThickness',
15
16
  ]);
16
- const content = formatter(datum.label ?? datum.desc ?? '');
17
+ const content = formatter((_b = (_a = datum.label) !== null && _a !== void 0 ? _a : datum.desc) !== null && _b !== void 0 ? _b : '');
17
18
  const alignH = positionH === 'flipped'
18
19
  ? 'right'
19
20
  : positionH === 'center'
20
21
  ? 'center'
21
22
  : 'left';
22
23
  const measuredLabel = getElementBounds(_jsx(ItemLabel, { indexes: indexes, width: width, children: content }));
23
- const contentWidth = width ?? measuredLabel.width;
24
+ const contentWidth = width !== null && width !== void 0 ? width : measuredLabel.width;
24
25
  const labelHeight = measuredLabel.height;
25
26
  const underlineWidth = showUnderline ? contentWidth + underlineExtend * 2 : 0;
26
27
  const totalHeight = labelHeight + (showUnderline ? underlineGap + underlineThickness : 0);
27
28
  const finalWidth = showUnderline
28
29
  ? Math.max(contentWidth, underlineWidth)
29
30
  : contentWidth;
30
- const finalHeight = restProps.height ?? totalHeight;
31
+ const finalHeight = (_c = restProps.height) !== null && _c !== void 0 ? _c : totalHeight;
31
32
  const offsetY = positionV === 'middle'
32
33
  ? (finalHeight - totalHeight) / 2
33
34
  : positionV === 'flipped'
@@ -45,11 +46,11 @@ export const LinedText = (props) => {
45
46
  ? (finalWidth - underlineWidth) / 2
46
47
  : 0;
47
48
  const underlineY = finalHeight;
48
- return (_jsxs(Group, { ...restProps, width: finalWidth, height: finalHeight, children: [_jsx(ItemLabel, { indexes: indexes, x: labelX, y: labelY, width: contentWidth, height: labelHeight, alignHorizontal: alignH, alignVertical: positionV === 'flipped'
49
+ return (_jsxs(Group, Object.assign({}, restProps, { width: finalWidth, height: finalHeight, children: [_jsx(ItemLabel, { indexes: indexes, x: labelX, y: labelY, width: contentWidth, height: labelHeight, alignHorizontal: alignH, alignVertical: positionV === 'flipped'
49
50
  ? 'bottom'
50
51
  : positionV === 'center'
51
52
  ? 'middle'
52
- : 'top', fill: usePaletteColor ? themeColors.colorPrimary : themeColors.colorText, children: content }), showUnderline && (_jsx(Path, { d: `M 0 ${underlineThickness / 2} L ${underlineWidth} ${underlineThickness / 2}`, x: underlineX, y: underlineY - underlineThickness / 2, width: underlineWidth, height: underlineThickness, stroke: themeColors.colorPrimary, strokeWidth: underlineThickness, fill: "none", strokeLinecap: "round", "data-element-type": "shape" }))] }));
53
+ : 'top', fill: usePaletteColor ? themeColors.colorPrimary : themeColors.colorText, children: content }), showUnderline && (_jsx(Path, { d: `M 0 ${underlineThickness / 2} L ${underlineWidth} ${underlineThickness / 2}`, x: underlineX, y: underlineY - underlineThickness / 2, width: underlineWidth, height: underlineThickness, stroke: themeColors.colorPrimary, strokeWidth: underlineThickness, fill: "none", strokeLinecap: "round", "data-element-type": "shape" }))] })));
53
54
  };
54
55
  registerItem('lined-text', {
55
56
  component: LinedText,
@@ -30,11 +30,11 @@ export const PillBadge = (props) => {
30
30
  const contentWidth = componentWidth;
31
31
  const dropShadowId = `drop-shadow-${themeColors.colorPrimary}`;
32
32
  const linearGradientId = `linear-gradient-white-top-bottom`;
33
- return (_jsxs(Group, { ...restProps, children: [_jsxs(Defs, { children: [_jsx(DropShadow, { id: dropShadowId, color: themeColors.colorPrimary }), _jsx(LinearGradient, { id: linearGradientId, startColor: "#fff", stopColor: "#ffffff33", direction: "top-bottom" })] }), _jsx(Rect, { x: pillX, y: pillY, width: pillWidth, height: pillHeight, fill: themeColors.colorPrimaryBg, stroke: themeColors.colorPrimary, rx: pillHeight / 2, ry: pillHeight / 2, filter: `url(#${dropShadowId})`, "data-element-type": "shape" }), _jsx(Rect, { x: pillX, y: pillY, width: pillWidth, height: pillHeight, fill: `url(#${linearGradientId})`, opacity: themeColors.isDarkMode ? 0.4 : 0.7, rx: pillHeight / 2, ry: pillHeight / 2 }), _jsx(ItemLabel, { indexes: indexes, x: pillX, y: pillY, width: pillWidth, height: pillHeight, alignHorizontal: "center", alignVertical: "middle", fontSize: 14, fontWeight: "500", fill: themeColors.colorText, children: datum.label }), datum.desc && (_jsx(ItemDesc, { indexes: indexes, x: contentX, y: contentY, width: contentWidth, alignHorizontal: positionH === 'center'
33
+ return (_jsxs(Group, Object.assign({}, restProps, { children: [_jsxs(Defs, { children: [_jsx(DropShadow, { id: dropShadowId, color: themeColors.colorPrimary }), _jsx(LinearGradient, { id: linearGradientId, startColor: "#fff", stopColor: "#ffffff33", direction: "top-bottom" })] }), _jsx(Rect, { x: pillX, y: pillY, width: pillWidth, height: pillHeight, fill: themeColors.colorPrimaryBg, stroke: themeColors.colorPrimary, rx: pillHeight / 2, ry: pillHeight / 2, filter: `url(#${dropShadowId})`, "data-element-type": "shape" }), _jsx(Rect, { x: pillX, y: pillY, width: pillWidth, height: pillHeight, fill: `url(#${linearGradientId})`, opacity: themeColors.isDarkMode ? 0.4 : 0.7, rx: pillHeight / 2, ry: pillHeight / 2 }), _jsx(ItemLabel, { indexes: indexes, x: pillX, y: pillY, width: pillWidth, height: pillHeight, alignHorizontal: "center", alignVertical: "middle", fontSize: 14, fontWeight: "500", fill: themeColors.colorText, children: datum.label }), datum.desc && (_jsx(ItemDesc, { indexes: indexes, x: contentX, y: contentY, width: contentWidth, alignHorizontal: positionH === 'center'
34
34
  ? 'center'
35
35
  : positionH === 'flipped'
36
36
  ? 'right'
37
- : 'left', fontSize: 12, fill: themeColors.colorTextSecondary, lineNumber: 2, wordWrap: true, children: datum.desc }))] }));
37
+ : 'left', fontSize: 12, fill: themeColors.colorTextSecondary, lineNumber: 2, wordWrap: true, children: datum.desc }))] })));
38
38
  };
39
39
  registerItem('pill-badge', {
40
40
  component: PillBadge,
@@ -3,6 +3,7 @@ import { ItemLabel } from '../components/index.js';
3
3
  import { getItemProps } from '../utils/index.js';
4
4
  import { registerItem } from './registry.js';
5
5
  export const LabelText = (props) => {
6
+ var _a;
6
7
  const [{ indexes, datum, width = 120, themeColors, positionH = 'normal', positionV = 'center', formatter = (text) => text || '', usePaletteColor = false, lineNumber = 1, }, restProps,] = getItemProps(props, [
7
8
  'width',
8
9
  'formatter',
@@ -11,9 +12,8 @@ export const LabelText = (props) => {
11
12
  ]);
12
13
  const fontSize = 14;
13
14
  const lineHeight = 1.4;
14
- const height = restProps.height ??
15
- Math.ceil(lineNumber * lineHeight * fontSize);
16
- return (_jsx(ItemLabel, { ...restProps, indexes: indexes, width: width, height: height, lineHeight: lineHeight, fill: usePaletteColor ? themeColors.colorPrimary : themeColors.colorText, fontSize: fontSize, fontWeight: "regular", alignHorizontal: positionH === 'flipped'
15
+ const height = (_a = restProps.height) !== null && _a !== void 0 ? _a : Math.ceil(lineNumber * lineHeight * fontSize);
16
+ return (_jsx(ItemLabel, Object.assign({}, restProps, { indexes: indexes, width: width, height: height, lineHeight: lineHeight, fill: usePaletteColor ? themeColors.colorPrimary : themeColors.colorText, fontSize: fontSize, fontWeight: "regular", alignHorizontal: positionH === 'flipped'
17
17
  ? 'right'
18
18
  : positionH === 'center'
19
19
  ? 'center'
@@ -21,7 +21,7 @@ export const LabelText = (props) => {
21
21
  ? 'bottom'
22
22
  : positionV === 'center'
23
23
  ? 'middle'
24
- : 'top', children: formatter(datum.label || datum.desc) }));
24
+ : 'top', children: formatter(datum.label || datum.desc) })));
25
25
  };
26
26
  registerItem('plain-text', {
27
27
  component: LabelText,
@@ -15,8 +15,8 @@ export const ProgressCard = (props) => {
15
15
  'borderRadius',
16
16
  ]);
17
17
  const value = datum.value;
18
- const displayValue = value ?? 0;
19
- const maxValue = Math.max(...data.items.map((item) => item.value ?? 0), 100);
18
+ const displayValue = value !== null && value !== void 0 ? value : 0;
19
+ const maxValue = Math.max(...data.items.map((item) => { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : 0; }), 100);
20
20
  const progressWidth = width - 2 * gap;
21
21
  // 计算进度条的填充宽度
22
22
  const progressScale = scaleLinear()
@@ -37,9 +37,9 @@ export const ProgressCard = (props) => {
37
37
  const textY = iconY;
38
38
  const progressY = height - gap - progressHeight;
39
39
  const hasValue = value !== undefined;
40
- return (_jsxs(Group, { ...restProps, children: [_jsxs(Defs, { children: [_jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [_jsx("stop", { offset: "0%", stopColor: themeColors.colorPrimary }), _jsx("stop", { offset: "100%", stopColor: tinycolor
40
+ return (_jsxs(Group, Object.assign({}, restProps, { children: [_jsxs(Defs, { children: [_jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [_jsx("stop", { offset: "0%", stopColor: themeColors.colorPrimary }), _jsx("stop", { offset: "100%", stopColor: tinycolor
41
41
  .mix(themeColors.colorPrimary, '#fff', 20)
42
- .toHexString() })] }), _jsxs("linearGradient", { id: progressBgId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [_jsx("stop", { offset: "0%", stopColor: themeColors.colorPrimaryBg }), _jsx("stop", { offset: "100%", stopColor: themeColors.colorBg })] })] }), _jsx(Rect, { x: 0, y: 0, width: width, height: height, fill: themeColors.colorBgElevated, stroke: themeColors.colorPrimaryBg, strokeWidth: 1, rx: borderRadius, ry: borderRadius, "data-element-type": "shape" }), _jsx(ItemIcon, { indexes: indexes, x: iconX, y: iconY, size: iconSize, fill: themeColors.colorPrimary }), _jsx(ItemLabel, { indexes: indexes, x: textStartX, y: textY, width: textWidth, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', alignVertical: "top", fontSize: 16, fontWeight: "medium", fill: themeColors.colorText, children: datum.label }), hasValue && (_jsx(ItemValue, { indexes: indexes, x: textStartX, y: textY + labelBounds.height, width: textWidth, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', alignVertical: "top", lineHeight: 1, fontSize: 24, fontWeight: "bold", fill: themeColors.colorPrimary, value: displayValue, formatter: valueFormatter })), _jsx(ItemDesc, { indexes: indexes, x: textStartX, y: textY + labelBounds.height + (hasValue ? 27 : 4), width: textWidth, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', alignVertical: "top", fontSize: 11, fill: themeColors.colorTextSecondary, lineNumber: hasValue ? 2 : 3, wordWrap: true, children: datum.desc }), _jsx(Rect, { x: gap, y: progressY, width: progressWidth, height: progressHeight, fill: `url(#${progressBgId})`, rx: progressHeight / 2, ry: progressHeight / 2, "data-element-type": "shape" }), _jsx(Rect, { x: gap, y: progressY, width: progressFillWidth, height: progressHeight, fill: `url(#${gradientId})`, rx: progressHeight / 2, ry: progressHeight / 2, "data-element-type": "shape" })] }));
42
+ .toHexString() })] }), _jsxs("linearGradient", { id: progressBgId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [_jsx("stop", { offset: "0%", stopColor: themeColors.colorPrimaryBg }), _jsx("stop", { offset: "100%", stopColor: themeColors.colorBg })] })] }), _jsx(Rect, { x: 0, y: 0, width: width, height: height, fill: themeColors.colorBgElevated, stroke: themeColors.colorPrimaryBg, strokeWidth: 1, rx: borderRadius, ry: borderRadius, "data-element-type": "shape" }), _jsx(ItemIcon, { indexes: indexes, x: iconX, y: iconY, size: iconSize, fill: themeColors.colorPrimary }), _jsx(ItemLabel, { indexes: indexes, x: textStartX, y: textY, width: textWidth, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', alignVertical: "top", fontSize: 16, fontWeight: "medium", fill: themeColors.colorText, children: datum.label }), hasValue && (_jsx(ItemValue, { indexes: indexes, x: textStartX, y: textY + labelBounds.height, width: textWidth, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', alignVertical: "top", lineHeight: 1, fontSize: 24, fontWeight: "bold", fill: themeColors.colorPrimary, value: displayValue, formatter: valueFormatter })), _jsx(ItemDesc, { indexes: indexes, x: textStartX, y: textY + labelBounds.height + (hasValue ? 27 : 4), width: textWidth, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', alignVertical: "top", fontSize: 11, fill: themeColors.colorTextSecondary, lineNumber: hasValue ? 2 : 3, wordWrap: true, children: datum.desc }), _jsx(Rect, { x: gap, y: progressY, width: progressWidth, height: progressHeight, fill: `url(#${progressBgId})`, rx: progressHeight / 2, ry: progressHeight / 2, "data-element-type": "shape" }), _jsx(Rect, { x: gap, y: progressY, width: progressFillWidth, height: progressHeight, fill: `url(#${gradientId})`, rx: progressHeight / 2, ry: progressHeight / 2, "data-element-type": "shape" })] })));
43
43
  };
44
44
  registerItem('progress-card', {
45
45
  component: ProgressCard,
@@ -106,7 +106,7 @@ export const QuarterCircular = (props) => {
106
106
  : `M ${circleX} ${circleY} L ${circleX} ${circleY - circleRadius} A ${circleRadius} ${circleRadius} 0 0 0 ${circleX - circleRadius} ${circleY} Z`;
107
107
  }
108
108
  };
109
- return (_jsxs(Group, { ...restProps, width: width, height: height, children: [_jsxs(ShapesGroup, { children: [_jsx(Path, { d: `M ${decorationCoords.diagonalStartX} ${decorationCoords.diagonalStartY} L ${decorationCoords.diagonalEndX} ${decorationCoords.diagonalEndY}`, stroke: themeColors.colorPrimary, strokeWidth: LINE_WIDTH, fill: "none" }), _jsx(Path, { d: `M ${decorationCoords.topLineStartX} ${decorationCoords.topLineY} L ${decorationCoords.topLineEndX} ${decorationCoords.topLineY}`, stroke: themeColors.colorPrimary, strokeWidth: LINE_WIDTH, fill: "none" }), _jsx(Ellipse, { x: decorationCoords.diagonalStartX - DOT_RADIUS, y: decorationCoords.diagonalStartY - DOT_RADIUS, width: DOT_RADIUS * 2, height: DOT_RADIUS * 2, fill: themeColors.colorPrimary }), _jsx(Ellipse, { x: decorationCoords.topLineEndX - DOT_RADIUS, y: decorationCoords.topLineY - DOT_RADIUS, width: DOT_RADIUS * 2, height: DOT_RADIUS * 2, fill: themeColors.colorPrimary })] }), _jsxs(Group, { children: [_jsx(Text, { x: contentCoords.valueX, y: CARD_CONTENT_Y, fontSize: VALUE_SIZE, fontWeight: "bold", fill: themeColors.colorPrimary, children: indexStr }), _jsx(Path, { d: getQuarterCirclePath(), fill: themeColors.colorPrimary, "data-element-type": "shape" }), datum.icon && (_jsx(ItemIcon, { indexes: indexes, x: contentCoords.iconX, y: iconY, size: iconSize, fill: themeColors.colorWhite })), datum.label && (_jsx(ItemLabel, { indexes: indexes, x: contentCoords.contentX, y: LABEL_Y, width: contentCoords.contentWidth, fontWeight: "bold", fill: themeColors.colorText, alignHorizontal: isFlipped ? 'right' : 'left', children: datum.label })), datum.desc && (_jsx(ItemDesc, { indexes: indexes, x: contentCoords.contentX, y: descY, width: contentCoords.contentWidth, fill: themeColors.colorTextSecondary, alignHorizontal: isFlipped ? 'right' : 'left', children: datum.desc }))] })] }));
109
+ return (_jsxs(Group, Object.assign({}, restProps, { width: width, height: height, children: [_jsxs(ShapesGroup, { children: [_jsx(Path, { d: `M ${decorationCoords.diagonalStartX} ${decorationCoords.diagonalStartY} L ${decorationCoords.diagonalEndX} ${decorationCoords.diagonalEndY}`, stroke: themeColors.colorPrimary, strokeWidth: LINE_WIDTH, fill: "none" }), _jsx(Path, { d: `M ${decorationCoords.topLineStartX} ${decorationCoords.topLineY} L ${decorationCoords.topLineEndX} ${decorationCoords.topLineY}`, stroke: themeColors.colorPrimary, strokeWidth: LINE_WIDTH, fill: "none" }), _jsx(Ellipse, { x: decorationCoords.diagonalStartX - DOT_RADIUS, y: decorationCoords.diagonalStartY - DOT_RADIUS, width: DOT_RADIUS * 2, height: DOT_RADIUS * 2, fill: themeColors.colorPrimary }), _jsx(Ellipse, { x: decorationCoords.topLineEndX - DOT_RADIUS, y: decorationCoords.topLineY - DOT_RADIUS, width: DOT_RADIUS * 2, height: DOT_RADIUS * 2, fill: themeColors.colorPrimary })] }), _jsxs(Group, { children: [_jsx(Text, { x: contentCoords.valueX, y: CARD_CONTENT_Y, fontSize: VALUE_SIZE, fontWeight: "bold", fill: themeColors.colorPrimary, children: indexStr }), _jsx(Path, { d: getQuarterCirclePath(), fill: themeColors.colorPrimary, "data-element-type": "shape" }), datum.icon && (_jsx(ItemIcon, { indexes: indexes, x: contentCoords.iconX, y: iconY, size: iconSize, fill: themeColors.colorWhite })), datum.label && (_jsx(ItemLabel, { indexes: indexes, x: contentCoords.contentX, y: LABEL_Y, width: contentCoords.contentWidth, fontWeight: "bold", fill: themeColors.colorText, alignHorizontal: isFlipped ? 'right' : 'left', children: datum.label })), datum.desc && (_jsx(ItemDesc, { indexes: indexes, x: contentCoords.contentX, y: descY, width: contentCoords.contentWidth, fill: themeColors.colorTextSecondary, alignHorizontal: isFlipped ? 'right' : 'left', children: datum.desc }))] })] })));
110
110
  };
111
111
  registerItem('quarter-circular', {
112
112
  component: QuarterCircular,
@@ -108,7 +108,7 @@ export const QuarterSimpleCard = (props) => {
108
108
  Z
109
109
  `;
110
110
  }
111
- return (_jsxs(Group, { ...restProps, children: [_jsx(Path, { d: cardPath, x: 0, y: 0, width: width, height: height, fill: themeColors.colorPrimary, "data-element-type": "shape" }), _jsx(ItemIcon, { indexes: indexes, x: iconX, y: iconY, size: iconSize, fill: themeColors.colorBg }), _jsx(ItemLabel, { indexes: indexes, x: labelX, y: labelY, width: contentWidth, fontSize: 14, fontWeight: "bold", fill: themeColors.colorBg, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', children: datum.label }), datum.desc && (_jsx(ItemDesc, { indexes: indexes, x: descX, y: descY, width: contentWidth, fontSize: 11, wordWrap: true, fill: themeColors.colorBg, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', children: datum.desc }))] }));
111
+ return (_jsxs(Group, Object.assign({}, restProps, { children: [_jsx(Path, { d: cardPath, x: 0, y: 0, width: width, height: height, fill: themeColors.colorPrimary, "data-element-type": "shape" }), _jsx(ItemIcon, { indexes: indexes, x: iconX, y: iconY, size: iconSize, fill: themeColors.colorBg }), _jsx(ItemLabel, { indexes: indexes, x: labelX, y: labelY, width: contentWidth, fontSize: 14, fontWeight: "bold", fill: themeColors.colorBg, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', children: datum.label }), datum.desc && (_jsx(ItemDesc, { indexes: indexes, x: descX, y: descY, width: contentWidth, fontSize: 11, wordWrap: true, fill: themeColors.colorBg, alignHorizontal: positionH === 'flipped' ? 'right' : 'left', children: datum.desc }))] })));
112
112
  };
113
113
  registerItem('quarter-simple-card', {
114
114
  component: QuarterSimpleCard,
@@ -13,9 +13,9 @@ export const RibbonCard = (props) => {
13
13
  'ribbonHeight',
14
14
  ]);
15
15
  const gradientId = `${themeColors.colorPrimary}-ribbon`;
16
- return (_jsxs(Group, { ...restProps, children: [_jsx(Defs, { children: _jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [_jsx("stop", { offset: "0%", stopColor: themeColors.colorPrimary }), _jsx("stop", { offset: "100%", stopColor: tinycolor(themeColors.colorPrimary)
16
+ return (_jsxs(Group, Object.assign({}, restProps, { children: [_jsx(Defs, { children: _jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [_jsx("stop", { offset: "0%", stopColor: themeColors.colorPrimary }), _jsx("stop", { offset: "100%", stopColor: tinycolor(themeColors.colorPrimary)
17
17
  .darken(15)
18
- .toHexString() })] }) }), _jsxs(ShapesGroup, { children: [_jsx(Rect, { x: 0, y: 0, width: width, height: height, fill: themeColors.colorBgElevated, stroke: themeColors.colorPrimaryBg, strokeWidth: 1, rx: 8, ry: 8 }), _jsx(Rect, { x: 0, y: 0, width: width, height: ribbonHeight, fill: `url(#${gradientId})`, rx: 8, ry: 8 }), _jsx(Rect, { x: 0, y: 8, width: width, height: ribbonHeight - 8, fill: `url(#${gradientId})` }), _jsx(Path, { x: width - 20, y: ribbonHeight, width: 20, height: 8, fill: tinycolor(themeColors.colorPrimary).darken(25).toHexString(), d: "M0,0 L20,0 L15,8 L5,8 Z" })] }), _jsx(ItemIcon, { indexes: indexes, x: gap, y: ribbonHeight + gap, size: iconSize, fill: themeColors.colorPrimary }), _jsx(ItemLabel, { indexes: indexes, x: iconSize + 2 * gap, y: ribbonHeight + gap, width: width - iconSize - 3 * gap, height: iconSize, alignHorizontal: "left", alignVertical: "middle", lineHeight: 1, fontWeight: "bold", fill: themeColors.colorText, children: datum.label }), _jsx(ItemDesc, { indexes: indexes, x: gap, y: ribbonHeight + iconSize + gap + 5, width: width - 2 * gap, alignHorizontal: "left", fill: themeColors.colorTextSecondary, lineNumber: 3, wordWrap: true, children: datum.desc }), _jsx(ItemIcon, { indexes: indexes, x: width - gap - 8, y: gap / 2, size: 16, fill: themeColors.colorWhite })] }));
18
+ .toHexString() })] }) }), _jsxs(ShapesGroup, { children: [_jsx(Rect, { x: 0, y: 0, width: width, height: height, fill: themeColors.colorBgElevated, stroke: themeColors.colorPrimaryBg, strokeWidth: 1, rx: 8, ry: 8 }), _jsx(Rect, { x: 0, y: 0, width: width, height: ribbonHeight, fill: `url(#${gradientId})`, rx: 8, ry: 8 }), _jsx(Rect, { x: 0, y: 8, width: width, height: ribbonHeight - 8, fill: `url(#${gradientId})` }), _jsx(Path, { x: width - 20, y: ribbonHeight, width: 20, height: 8, fill: tinycolor(themeColors.colorPrimary).darken(25).toHexString(), d: "M0,0 L20,0 L15,8 L5,8 Z" })] }), _jsx(ItemIcon, { indexes: indexes, x: gap, y: ribbonHeight + gap, size: iconSize, fill: themeColors.colorPrimary }), _jsx(ItemLabel, { indexes: indexes, x: iconSize + 2 * gap, y: ribbonHeight + gap, width: width - iconSize - 3 * gap, height: iconSize, alignHorizontal: "left", alignVertical: "middle", lineHeight: 1, fontWeight: "bold", fill: themeColors.colorText, children: datum.label }), _jsx(ItemDesc, { indexes: indexes, x: gap, y: ribbonHeight + iconSize + gap + 5, width: width - 2 * gap, alignHorizontal: "left", fill: themeColors.colorTextSecondary, lineNumber: 3, wordWrap: true, children: datum.desc }), _jsx(ItemIcon, { indexes: indexes, x: width - gap - 8, y: gap / 2, size: 16, fill: themeColors.colorWhite })] })));
19
19
  };
20
20
  registerItem('ribbon-card', {
21
21
  component: RibbonCard,
@@ -11,11 +11,11 @@ export const RoundedRectNode = (props) => {
11
11
  const textY = padding;
12
12
  const textWidth = width - borderRadius * 2;
13
13
  const textHeight = height - padding * 2;
14
- return (_jsxs(Group, { ...restProps, children: [_jsx(Rect, { "data-element-type": "shape", width: width, height: height, rx: borderRadius, ry: borderRadius, fill: themeColors.colorPrimaryBg, stroke: themeColors.colorPrimary, strokeWidth: 1, opacity: 0.8 }), _jsx(ItemLabel, { indexes: indexes, x: textX, y: textY, width: textWidth, height: textHeight, alignHorizontal: positionH === 'flipped'
14
+ return (_jsxs(Group, Object.assign({}, restProps, { children: [_jsx(Rect, { "data-element-type": "shape", width: width, height: height, rx: borderRadius, ry: borderRadius, fill: themeColors.colorPrimaryBg, stroke: themeColors.colorPrimary, strokeWidth: 1, opacity: 0.8 }), _jsx(ItemLabel, { indexes: indexes, x: textX, y: textY, width: textWidth, height: textHeight, alignHorizontal: positionH === 'flipped'
15
15
  ? 'right'
16
16
  : positionH === 'center'
17
17
  ? 'center'
18
- : 'left', alignVertical: "middle", fontSize: 14, fontWeight: "500", fill: themeColors.colorText, children: datum.label })] }));
18
+ : 'left', alignVertical: "middle", fontSize: 14, fontWeight: "500", fill: themeColors.colorText, children: datum.label })] })));
19
19
  };
20
20
  registerItem('rounded-rect-node', {
21
21
  component: RoundedRectNode,
@@ -6,7 +6,7 @@ export const SimpleCircleNode = (props) => {
6
6
  const [{ width = 24, height = width, strokeWidth = 2, themeColors, datum }, restProps,] = getItemProps(props, ['width', 'height']);
7
7
  const size = Math.min(width, height) - strokeWidth;
8
8
  const offset = strokeWidth / 2;
9
- return (_jsxs(Group, { ...restProps, width: width, height: height, children: [_jsx(Rect, { width: width, height: height, fill: "none", visibility: "hidden" }), _jsx(Ellipse, { x: offset, y: offset, width: size, height: size, fill: themeColors.colorPrimary, stroke: themeColors.isDarkMode ? '#FFF' : '#000', strokeWidth: strokeWidth, "data-element-type": "shape", children: _jsx("title", { children: datum.label || datum.desc }) })] }));
9
+ return (_jsxs(Group, Object.assign({}, restProps, { width: width, height: height, children: [_jsx(Rect, { width: width, height: height, fill: "none", visibility: "hidden" }), _jsx(Ellipse, { x: offset, y: offset, width: size, height: size, fill: themeColors.colorPrimary, stroke: themeColors.isDarkMode ? '#FFF' : '#000', strokeWidth: strokeWidth, "data-element-type": "shape", children: _jsx("title", { children: datum.label || datum.desc }) })] })));
10
10
  };
11
11
  registerItem('simple-circle-node', {
12
12
  component: SimpleCircleNode,
@@ -17,11 +17,11 @@ export const SimpleHorizontalArrow = (props) => {
17
17
  const descBounds = getElementBounds(desc);
18
18
  const textHeight = labelBounds.height + descBounds.height;
19
19
  const totalHeight = textHeight + labelGap + arrowHeight + labelGap + textHeight;
20
- return (_jsx(Group, { width: width, height: totalHeight, ...restProps, children: _jsxs(FlexLayout, { flexDirection: "column", alignItems: "center", children: [isVNormal ? (_jsxs(_Fragment, { children: [desc, label, _jsx(Gap, { height: labelGap })] })) : (_jsx(_Fragment, { children: _jsx(Gap, { height: textHeight + labelGap }) })), _jsxs(AlignLayout, { horizontal: "center", vertical: "middle", children: [_jsx(HorizontalArrow, { width: width, height: arrowHeight, fill: themeColors.colorPrimary }), _jsx(Text, { width: width, height: arrowHeight, alignHorizontal: "center", alignVertical: "middle", fill: themeColors.colorWhite, fontWeight: "bold", fontSize: 16, children: datum.time
20
+ return (_jsx(Group, Object.assign({ width: width, height: totalHeight }, restProps, { children: _jsxs(FlexLayout, { flexDirection: "column", alignItems: "center", children: [isVNormal ? (_jsxs(_Fragment, { children: [desc, label, _jsx(Gap, { height: labelGap })] })) : (_jsx(_Fragment, { children: _jsx(Gap, { height: textHeight + labelGap }) })), _jsxs(AlignLayout, { horizontal: "center", vertical: "middle", children: [_jsx(HorizontalArrow, { width: width, height: arrowHeight, fill: themeColors.colorPrimary }), _jsx(Text, { width: width, height: arrowHeight, alignHorizontal: "center", alignVertical: "middle", fill: themeColors.colorWhite, fontWeight: "bold", fontSize: 16, children: datum.time
21
21
  ? datum.time
22
22
  : String(indexes[0] + 1)
23
23
  .padStart(2, '0')
24
- .slice(-2) })] }), !isVNormal ? (_jsxs(_Fragment, { children: [_jsx(Gap, { height: labelGap }), label, desc] })) : (_jsx(_Fragment, { children: _jsx(Gap, { height: textHeight + labelGap }) }))] }) }));
24
+ .slice(-2) })] }), !isVNormal ? (_jsxs(_Fragment, { children: [_jsx(Gap, { height: labelGap }), label, desc] })) : (_jsx(_Fragment, { children: _jsx(Gap, { height: textHeight + labelGap }) }))] }) })));
25
25
  };
26
26
  const HorizontalArrow = (props) => {
27
27
  const { x = 0, y = 0, width = 100, height = 40, fill = '#FF356A', size = 10, } = props;
@@ -12,7 +12,7 @@ export const SimpleIllusItem = (props) => {
12
12
  : themeColors.colorText;
13
13
  const labelContent = (_jsx(ItemLabel, { indexes: indexes, width: width, alignHorizontal: "center", alignVertical: "middle", fill: labelColor, children: label }));
14
14
  const labelBounds = getElementBounds(labelContent);
15
- return (_jsxs(FlexLayout, { ...restProps, width: width, height: illusSize + gap + labelBounds.height + gap + 48, flexDirection: "column", alignItems: "center", justifyContent: "center", gap: gap, children: [_jsx(Illus, { indexes: indexes, width: illusSize, height: illusSize }), labelContent, _jsx(ItemDesc, { indexes: indexes, width: width, alignHorizontal: "center", alignVertical: "top", fill: themeColors.colorTextSecondary, lineNumber: 3, children: desc })] }));
15
+ return (_jsxs(FlexLayout, Object.assign({}, restProps, { width: width, height: illusSize + gap + labelBounds.height + gap + 48, flexDirection: "column", alignItems: "center", justifyContent: "center", gap: gap, children: [_jsx(Illus, { indexes: indexes, width: illusSize, height: illusSize }), labelContent, _jsx(ItemDesc, { indexes: indexes, width: width, alignHorizontal: "center", alignVertical: "top", fill: themeColors.colorTextSecondary, lineNumber: 3, children: desc })] })));
16
16
  };
17
17
  registerItem('simple-illus', {
18
18
  component: SimpleIllusItem,
@@ -49,7 +49,7 @@ export const SimpleItem = (props) => {
49
49
  ? height - labelBounds.height - (descHeight || 0) - gap
50
50
  : 0
51
51
  : 0;
52
- return (_jsxs(Group, { ...restProps, children: [_jsx(ItemLabel, { indexes: indexes, width: width, y: labelY, alignHorizontal: textAlign, alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: width, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: textAlign, alignVertical: getDescVerticalAlign(positionV, false), lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] }));
52
+ return (_jsxs(Group, Object.assign({}, restProps, { children: [_jsx(ItemLabel, { indexes: indexes, width: width, y: labelY, alignHorizontal: textAlign, alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: width, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: textAlign, alignVertical: getDescVerticalAlign(positionV, false), lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] })));
53
53
  }
54
54
  if (positionH === 'center') {
55
55
  // 计算 desc 的可用高度和行数
@@ -70,7 +70,7 @@ export const SimpleItem = (props) => {
70
70
  ? height - contentHeight - iconHeight - gap
71
71
  : 0
72
72
  : 0;
73
- return (_jsx(FlexLayout, { ...restProps, flexDirection: "column", gap: gap, alignItems: "center", children: positionV === 'flipped' ? (_jsxs(_Fragment, { children: [_jsxs(Group, { children: [_jsx(ItemLabel, { indexes: indexes, width: width, y: labelY, alignHorizontal: "center", alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: width, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: "center", alignVertical: "bottom", lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] }), iconContent] })) : (_jsxs(_Fragment, { children: [iconContent, _jsxs(Group, { children: [_jsx(ItemLabel, { indexes: indexes, width: width, y: labelY, alignHorizontal: "center", alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: width, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: "center", alignVertical: "top", lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] })] })) }));
73
+ return (_jsx(FlexLayout, Object.assign({}, restProps, { flexDirection: "column", gap: gap, alignItems: "center", children: positionV === 'flipped' ? (_jsxs(_Fragment, { children: [_jsxs(Group, { children: [_jsx(ItemLabel, { indexes: indexes, width: width, y: labelY, alignHorizontal: "center", alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: width, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: "center", alignVertical: "bottom", lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] }), iconContent] })) : (_jsxs(_Fragment, { children: [iconContent, _jsxs(Group, { children: [_jsx(ItemLabel, { indexes: indexes, width: width, y: labelY, alignHorizontal: "center", alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: width, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: "center", alignVertical: "top", lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] })] })) })));
74
74
  }
75
75
  const iconBounds = getElementBounds(iconContent);
76
76
  const textWidth = Math.max(width - iconBounds.width - gap, 0);
@@ -90,7 +90,7 @@ export const SimpleItem = (props) => {
90
90
  ? height - labelBounds.height - (descHeight || 0) - gap
91
91
  : 0
92
92
  : 0;
93
- return (_jsx(FlexLayout, { ...restProps, flexDirection: "row", gap: gap, alignItems: getIconVerticalAlign(positionV), children: positionH === 'flipped' ? (_jsxs(_Fragment, { children: [_jsxs(Group, { children: [_jsx(ItemLabel, { indexes: indexes, width: textWidth, y: labelY, alignHorizontal: "right", alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: textWidth, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: "right", alignVertical: getDescVerticalAlign(positionV, true), lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] }), iconContent] })) : (_jsxs(_Fragment, { children: [iconContent, _jsxs(Group, { children: [_jsx(ItemLabel, { indexes: indexes, width: textWidth, y: labelY, alignHorizontal: "left", alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: textWidth, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: "left", alignVertical: getDescVerticalAlign(positionV, true), lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] })] })) }));
93
+ return (_jsx(FlexLayout, Object.assign({}, restProps, { flexDirection: "row", gap: gap, alignItems: getIconVerticalAlign(positionV), children: positionH === 'flipped' ? (_jsxs(_Fragment, { children: [_jsxs(Group, { children: [_jsx(ItemLabel, { indexes: indexes, width: textWidth, y: labelY, alignHorizontal: "right", alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: textWidth, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: "right", alignVertical: getDescVerticalAlign(positionV, true), lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] }), iconContent] })) : (_jsxs(_Fragment, { children: [iconContent, _jsxs(Group, { children: [_jsx(ItemLabel, { indexes: indexes, width: textWidth, y: labelY, alignHorizontal: "left", alignVertical: "middle", fill: labelColor, children: label }), _jsx(ItemDesc, { indexes: indexes, width: textWidth, height: descHeight, y: labelY + labelBounds.height + gap, alignHorizontal: "left", alignVertical: getDescVerticalAlign(positionV, true), lineNumber: descLineNumber, fill: themeColors.colorTextSecondary, children: desc })] })] })) })));
94
94
  function getDescVerticalAlign(positionV, hasIcon) {
95
95
  return 'top';
96
96
  // if (positionV === 'normal') return 'top';
@@ -15,9 +15,9 @@ export const SimpleVerticalArrow = (props) => {
15
15
  const arrowWidth = 30;
16
16
  const textWidth = 120;
17
17
  const totalWidth = textWidth + labelGap + arrowWidth + labelGap + textWidth;
18
- return (_jsx(Group, { width: totalWidth, height: height, ...restProps, children: _jsxs(FlexLayout, { flexDirection: "row", alignItems: "center", children: [isNormal ? (_jsxs(_Fragment, { children: [_jsxs(FlexLayout, { flexDirection: "column", alignItems: "flex-end", children: [label, desc] }), _jsx(Gap, { width: labelGap })] })) : (_jsx(_Fragment, { children: _jsx(Gap, { width: textWidth + labelGap }) })), _jsxs(AlignLayout, { horizontal: "center", vertical: "middle", children: [_jsx(VerticalArrow, { width: arrowWidth, height: height, fill: themeColors.colorPrimary }), _jsx(Text, { width: arrowWidth, height: height, alignHorizontal: "center", alignVertical: "middle", fill: themeColors.colorWhite, fontWeight: "bold", fontSize: 16, children: String(indexes[0] + 1)
18
+ return (_jsx(Group, Object.assign({ width: totalWidth, height: height }, restProps, { children: _jsxs(FlexLayout, { flexDirection: "row", alignItems: "center", children: [isNormal ? (_jsxs(_Fragment, { children: [_jsxs(FlexLayout, { flexDirection: "column", alignItems: "flex-end", children: [label, desc] }), _jsx(Gap, { width: labelGap })] })) : (_jsx(_Fragment, { children: _jsx(Gap, { width: textWidth + labelGap }) })), _jsxs(AlignLayout, { horizontal: "center", vertical: "middle", children: [_jsx(VerticalArrow, { width: arrowWidth, height: height, fill: themeColors.colorPrimary }), _jsx(Text, { width: arrowWidth, height: height, alignHorizontal: "center", alignVertical: "middle", fill: themeColors.colorWhite, fontWeight: "bold", fontSize: 16, children: String(indexes[0] + 1)
19
19
  .padStart(2, '0')
20
- .slice(-2) })] }), !isNormal ? (_jsxs(_Fragment, { children: [_jsx(Gap, { width: labelGap }), _jsxs(FlexLayout, { flexDirection: "column", alignItems: "flex-start", children: [label, desc] })] })) : (_jsx(_Fragment, { children: _jsx(Gap, { width: textWidth + labelGap }) }))] }) }));
20
+ .slice(-2) })] }), !isNormal ? (_jsxs(_Fragment, { children: [_jsx(Gap, { width: labelGap }), _jsxs(FlexLayout, { flexDirection: "column", alignItems: "flex-start", children: [label, desc] })] })) : (_jsx(_Fragment, { children: _jsx(Gap, { width: textWidth + labelGap }) }))] }) })));
21
21
  };
22
22
  const VerticalArrow = (props) => {
23
23
  const { x = 0, y = 0, width = 30, height = 100, fill = '#FF356A', size = 10, } = props;
@@ -36,7 +36,7 @@ export const UnderlineText = (props) => {
36
36
  // 描述文本位置
37
37
  const descX = 0; // 使用 alignHorizontal 控制对齐
38
38
  const descY = underlineY + underlineHeight + gap * 2;
39
- return (_jsxs(Group, { width: width, height: contentHeight, ...restProps, children: [datum.label && (_jsx(ItemLabel, { indexes: indexes, x: titleX, y: titleY, width: width, alignHorizontal: alignHorizontal, fill: themeColors.colorPrimary, fontSize: 18, fontWeight: "bold", children: datum.label })), datum.label && (_jsx(Rect, { x: underlineX, y: underlineY, width: underlineWidth, height: underlineHeight, fill: themeColors.colorPrimary, "data-element-type": "shape" })), datum.desc && (_jsx(ItemDesc, { indexes: indexes, width: width, x: descX, y: descY, alignHorizontal: alignHorizontal, wordWrap: true, fill: themeColors.colorText, children: datum.desc }))] }));
39
+ return (_jsxs(Group, Object.assign({ width: width, height: contentHeight }, restProps, { children: [datum.label && (_jsx(ItemLabel, { indexes: indexes, x: titleX, y: titleY, width: width, alignHorizontal: alignHorizontal, fill: themeColors.colorPrimary, fontSize: 18, fontWeight: "bold", children: datum.label })), datum.label && (_jsx(Rect, { x: underlineX, y: underlineY, width: underlineWidth, height: underlineHeight, fill: themeColors.colorPrimary, "data-element-type": "shape" })), datum.desc && (_jsx(ItemDesc, { indexes: indexes, width: width, x: descX, y: descY, alignHorizontal: alignHorizontal, wordWrap: true, fill: themeColors.colorText, children: datum.desc }))] })));
40
40
  };
41
41
  registerItem('underline-text', {
42
42
  component: UnderlineText,
@@ -28,9 +28,9 @@ export const VerticalIconArrow = (props) => {
28
28
  const totalWidth = Math.max(labelBounds.width + dotLineGap + dotLineBounds.width, iconGap + iconBounds.width) *
29
29
  2 +
30
30
  arrowWidth;
31
- return (_jsx(Group, { width: totalWidth, height: height, ...restProps, children: _jsxs(FlexLayout, { flexDirection: "row", alignItems: "center", children: [isNormal ? (_jsxs(_Fragment, { children: [_jsxs(FlexLayout, { flexDirection: "column", alignItems: "flex-end", children: [label, desc] }), _jsx(Gap, { width: dotLineGap }), dotLine] })) : (_jsxs(_Fragment, { children: [_jsx(Gap, { width: fixedGap }), icon, _jsx(Gap, { width: iconGap })] })), _jsxs(AlignLayout, { horizontal: "center", vertical: "middle", children: [_jsx(VerticalArrow, { width: arrowWidth, height: height, fill: themeColors.colorPrimary }), _jsx(Text, { width: arrowWidth, height: height, alignHorizontal: "center", alignVertical: "middle", fill: themeColors.colorWhite, fontWeight: "bold", fontSize: 16, children: String(indexes[0] + 1)
31
+ return (_jsx(Group, Object.assign({ width: totalWidth, height: height }, restProps, { children: _jsxs(FlexLayout, { flexDirection: "row", alignItems: "center", children: [isNormal ? (_jsxs(_Fragment, { children: [_jsxs(FlexLayout, { flexDirection: "column", alignItems: "flex-end", children: [label, desc] }), _jsx(Gap, { width: dotLineGap }), dotLine] })) : (_jsxs(_Fragment, { children: [_jsx(Gap, { width: fixedGap }), icon, _jsx(Gap, { width: iconGap })] })), _jsxs(AlignLayout, { horizontal: "center", vertical: "middle", children: [_jsx(VerticalArrow, { width: arrowWidth, height: height, fill: themeColors.colorPrimary }), _jsx(Text, { width: arrowWidth, height: height, alignHorizontal: "center", alignVertical: "middle", fill: themeColors.colorWhite, fontWeight: "bold", fontSize: 16, children: String(indexes[0] + 1)
32
32
  .padStart(2, '0')
33
- .slice(-2) })] }), !isNormal ? (_jsxs(_Fragment, { children: [dotLine, _jsx(Gap, { width: dotLineGap }), _jsxs(FlexLayout, { flexDirection: "column", alignItems: "flex-start", children: [label, desc] })] })) : (_jsxs(_Fragment, { children: [_jsx(Gap, { width: iconGap }), icon] }))] }) }));
33
+ .slice(-2) })] }), !isNormal ? (_jsxs(_Fragment, { children: [dotLine, _jsx(Gap, { width: dotLineGap }), _jsxs(FlexLayout, { flexDirection: "column", alignItems: "flex-start", children: [label, desc] })] })) : (_jsxs(_Fragment, { children: [_jsx(Gap, { width: iconGap }), icon] }))] }) })));
34
34
  };
35
35
  const VerticalArrow = (props) => {
36
36
  const { x = 0, y = 0, width = 30, height = 100, fill = '#FF356A', size = 10, } = props;
@@ -1,20 +1,33 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx } from "../../jsx-runtime.js";
2
13
  import { cloneElement, createLayout, getElementBounds, getElementsBounds, Group, } from '../../jsx/index.js';
3
- export const AlignLayout = createLayout((children, { horizontal, vertical, ...props }) => {
14
+ export const AlignLayout = createLayout((children, _a) => {
15
+ var _b, _c, _d, _e;
16
+ var { horizontal, vertical } = _a, props = __rest(_a, ["horizontal", "vertical"]);
4
17
  if (!children || children.length === 0) {
5
- return _jsx(Group, { ...props });
18
+ return _jsx(Group, Object.assign({}, props));
6
19
  }
7
20
  const childBounds = children.map((child) => getElementBounds(child));
8
21
  const childrenBounds = getElementsBounds(children);
9
22
  // 容器尺寸和位置
10
- const containerX = props.x ?? childrenBounds.x;
11
- const containerY = props.y ?? childrenBounds.y;
12
- const containerWidth = props.width ?? childrenBounds.width;
13
- const containerHeight = props.height ?? childrenBounds.height;
23
+ const containerX = (_b = props.x) !== null && _b !== void 0 ? _b : childrenBounds.x;
24
+ const containerY = (_c = props.y) !== null && _c !== void 0 ? _c : childrenBounds.y;
25
+ const containerWidth = (_d = props.width) !== null && _d !== void 0 ? _d : childrenBounds.width;
26
+ const containerHeight = (_e = props.height) !== null && _e !== void 0 ? _e : childrenBounds.height;
14
27
  // 对齐子元素(使用相对于容器的坐标)
15
28
  const positionedChildren = children.map((child, index) => {
16
29
  const bounds = childBounds[index];
17
- const childProps = { ...child.props };
30
+ const childProps = Object.assign({}, child.props);
18
31
  // 水平对齐(相对于容器左边界)
19
32
  if (horizontal !== undefined) {
20
33
  switch (horizontal) {
@@ -53,12 +66,6 @@ export const AlignLayout = createLayout((children, { horizontal, vertical, ...pr
53
66
  }
54
67
  return cloneElement(child, childProps);
55
68
  });
56
- const containerProps = {
57
- ...props,
58
- x: containerX,
59
- y: containerY,
60
- width: containerWidth,
61
- height: containerHeight,
62
- };
63
- return _jsx(Group, { ...containerProps, children: positionedChildren });
69
+ const containerProps = Object.assign(Object.assign({}, props), { x: containerX, y: containerY, width: containerWidth, height: containerHeight });
70
+ return _jsx(Group, Object.assign({}, containerProps, { children: positionedChildren }));
64
71
  });
@@ -1,15 +1,28 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx } from "../../jsx-runtime.js";
2
13
  import { cloneElement, createLayout, getElementBounds, getElementsBounds, Group, } from '../../jsx/index.js';
3
- export const FlexLayout = createLayout((children, { flexDirection = 'row', justifyContent = 'flex-start', alignItems = 'flex-start', alignContent = 'flex-start', flexWrap = 'nowrap', gap = 0, ...props }) => {
14
+ export const FlexLayout = createLayout((children, _a) => {
15
+ var _b, _c, _d, _e, _f, _g;
16
+ var { flexDirection = 'row', justifyContent = 'flex-start', alignItems = 'flex-start', alignContent = 'flex-start', flexWrap = 'nowrap', gap = 0 } = _a, props = __rest(_a, ["flexDirection", "justifyContent", "alignItems", "alignContent", "flexWrap", "gap"]);
4
17
  if (!children || children.length === 0) {
5
- return _jsx(Group, { ...props });
18
+ return _jsx(Group, Object.assign({}, props));
6
19
  }
7
20
  const isRow = flexDirection === 'row' || flexDirection === 'row-reverse';
8
21
  const isReverse = flexDirection === 'row-reverse' || flexDirection === 'column-reverse';
9
22
  const childBounds = children.map((child) => getElementBounds(child));
10
23
  const childrenBounds = getElementsBounds(children);
11
- const containerWidth = props.width ?? childrenBounds.width;
12
- const containerHeight = props.height ?? childrenBounds.height;
24
+ const containerWidth = (_b = props.width) !== null && _b !== void 0 ? _b : childrenBounds.width;
25
+ const containerHeight = (_c = props.height) !== null && _c !== void 0 ? _c : childrenBounds.height;
13
26
  const hasContainerSize = props.width !== undefined && props.height !== undefined;
14
27
  const lines = [];
15
28
  if (flexWrap === 'wrap' && hasContainerSize) {
@@ -139,7 +152,7 @@ export const FlexLayout = createLayout((children, { flexDirection = 'row', justi
139
152
  const lineEndIndex = lineStartIndex + line.children.length;
140
153
  for (let i = lineStartIndex; i < lineEndIndex; i++) {
141
154
  const child = layoutChildren[i];
142
- const newProps = { ...child.props };
155
+ const newProps = Object.assign({}, child.props);
143
156
  if (isRow) {
144
157
  newProps.y = (newProps.y || 0) + currentOffset;
145
158
  }
@@ -162,7 +175,7 @@ export const FlexLayout = createLayout((children, { flexDirection = 'row', justi
162
175
  }
163
176
  if (crossOffset !== 0 && alignContent !== 'space-between') {
164
177
  layoutChildren.forEach((child, index) => {
165
- const newProps = { ...child.props };
178
+ const newProps = Object.assign({}, child.props);
166
179
  if (isRow) {
167
180
  newProps.y = (newProps.y || 0) + crossOffset;
168
181
  }
@@ -180,7 +193,7 @@ export const FlexLayout = createLayout((children, { flexDirection = 'row', justi
180
193
  layoutChildren.forEach((child, index) => {
181
194
  const bounds = childBounds[index];
182
195
  const centerOffset = (maxHeight - bounds.height) / 2;
183
- const newProps = { ...child.props };
196
+ const newProps = Object.assign({}, child.props);
184
197
  newProps.y = (newProps.y || 0) + centerOffset;
185
198
  layoutChildren[index] = cloneElement(child, newProps);
186
199
  });
@@ -190,7 +203,7 @@ export const FlexLayout = createLayout((children, { flexDirection = 'row', justi
190
203
  layoutChildren.forEach((child, index) => {
191
204
  const bounds = childBounds[index];
192
205
  const centerOffset = (maxWidth - bounds.width) / 2;
193
- const newProps = { ...child.props };
206
+ const newProps = Object.assign({}, child.props);
194
207
  newProps.x = (newProps.x || 0) + centerOffset;
195
208
  layoutChildren[index] = cloneElement(child, newProps);
196
209
  });
@@ -198,12 +211,6 @@ export const FlexLayout = createLayout((children, { flexDirection = 'row', justi
198
211
  }
199
212
  }
200
213
  const finalBounds = getElementsBounds(layoutChildren);
201
- const containerProps = {
202
- ...props,
203
- x: props.x ?? childrenBounds.x,
204
- y: props.y ?? childrenBounds.y,
205
- width: props.width ?? finalBounds.width,
206
- height: props.height ?? finalBounds.height,
207
- };
208
- return _jsx(Group, { ...containerProps, children: layoutChildren });
214
+ const containerProps = Object.assign(Object.assign({}, props), { x: (_d = props.x) !== null && _d !== void 0 ? _d : childrenBounds.x, y: (_e = props.y) !== null && _e !== void 0 ? _e : childrenBounds.y, width: (_f = props.width) !== null && _f !== void 0 ? _f : finalBounds.width, height: (_g = props.height) !== null && _g !== void 0 ? _g : finalBounds.height });
215
+ return _jsx(Group, Object.assign({}, containerProps, { children: layoutChildren }));
209
216
  });
@@ -7,22 +7,23 @@ import { FlexLayout } from '../layouts/index.js';
7
7
  import { getColorPrimary, getPaletteColor, getThemeColors } from '../utils/index.js';
8
8
  import { registerStructure } from './registry.js';
9
9
  export const ChartBar = (props) => {
10
+ var _a, _b, _c;
10
11
  const { Title, Item, data, width, gap, barGap, barHeight = 28, barAreaWidth, labelGap = 16, padding = 24, showValue = true, options, valueFormatter = (value) => value.toString(), } = props;
11
- const resolvedBarAreaWidth = barAreaWidth ?? width ?? 480;
12
+ const resolvedBarAreaWidth = (_a = barAreaWidth !== null && barAreaWidth !== void 0 ? barAreaWidth : width) !== null && _a !== void 0 ? _a : 480;
12
13
  const { title, desc, items = [], xTitle, yTitle } = data;
13
14
  const titleContent = Title ? _jsx(Title, { title: title, desc: desc }) : null;
14
15
  if (items.length === 0) {
15
16
  return (_jsx(FlexLayout, { id: "infographic-container", flexDirection: "column", justifyContent: "center", alignItems: "center", children: titleContent }));
16
17
  }
17
18
  const [paddingTop, paddingRight, paddingBottom, paddingLeft] = parsePadding(padding);
18
- const sampleDatum = items[0] ?? { label: '', value: 0 };
19
+ const sampleDatum = (_b = items[0]) !== null && _b !== void 0 ? _b : { label: '', value: 0 };
19
20
  const itemBounds = getElementBounds(_jsx(Item, { indexes: [0], datum: sampleDatum, data: data }));
20
21
  const labelWidth = itemBounds.width || 140;
21
22
  const labelHeight = itemBounds.height || barHeight;
22
23
  const rowHeight = Math.max(barHeight, labelHeight);
23
24
  const gapByHeight = Math.max(12, rowHeight * 0.35);
24
- const resolvedGap = barGap ?? gap ?? gapByHeight;
25
- const values = items.map((item) => item.value ?? 0);
25
+ const resolvedGap = (_c = barGap !== null && barGap !== void 0 ? barGap : gap) !== null && _c !== void 0 ? _c : gapByHeight;
26
+ const values = items.map((item) => { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : 0; });
26
27
  const maxValue = Math.max(...values, 0);
27
28
  const minValue = Math.min(...values, 0);
28
29
  const domainMin = minValue < 0 ? minValue * 1.1 : 0;
@@ -58,8 +59,9 @@ export const ChartBar = (props) => {
58
59
  const axisY = yStart + chartHeight + axisGap;
59
60
  const formatTick = (value) => Number.isInteger(value) ? value.toString() : value.toFixed(1);
60
61
  items.forEach((item, index) => {
62
+ var _a;
61
63
  const indexes = [index];
62
- const value = item.value ?? 0;
64
+ const value = (_a = item.value) !== null && _a !== void 0 ? _a : 0;
63
65
  const rowY = yStart + index * (rowHeight + resolvedGap);
64
66
  const barY = rowY + (rowHeight - barHeight) / 2;
65
67
  const barX = value >= 0 ? barStartX + zeroX : barStartX + scale(value);
@@ -15,7 +15,7 @@ export const ChartColumn = (props) => {
15
15
  return (_jsx(FlexLayout, { id: "infographic-container", flexDirection: "column", justifyContent: "center", alignItems: "center", children: titleContent }));
16
16
  }
17
17
  const themeColors = getThemeColors(options.themeConfig);
18
- const values = items.map((item) => item.value ?? 0);
18
+ const values = items.map((item) => { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : 0; });
19
19
  const sortedValues = [...values, 0].sort((a, b) => a - b);
20
20
  const hasNegative = sortedValues[0] < 0;
21
21
  const chartWidth = items.length * columnWidth + (items.length - 1) * columnGap;
@@ -36,8 +36,9 @@ export const ChartColumn = (props) => {
36
36
  const itemElements = [];
37
37
  const gradientDefs = [];
38
38
  items.forEach((item, index) => {
39
+ var _a;
39
40
  const indexes = [index];
40
- const value = item.value ?? 0;
41
+ const value = (_a = item.value) !== null && _a !== void 0 ? _a : 0;
41
42
  const columnX = paddingLeft + index * (columnWidth + columnGap);
42
43
  const columnY = value >= 0 ? yScale(value) : zeroY;
43
44
  const columnHeight = Math.abs(yScale(value) - zeroY);
@@ -21,7 +21,7 @@ export const ChartLine = (props) => {
21
21
  positionH: 'center',
22
22
  positionV: 'normal',
23
23
  };
24
- const sampleBounds = getElementBounds(_jsx(Item, { ...itemProps }));
24
+ const sampleBounds = getElementBounds(_jsx(Item, Object.assign({}, itemProps)));
25
25
  const labelWidth = sampleBounds.width;
26
26
  const labelHeight = sampleBounds.height;
27
27
  const xTickSpace = Math.max(28, labelHeight + 14);
@@ -41,7 +41,7 @@ export const ChartLine = (props) => {
41
41
  const chartOriginY = paddingTop + yTitleSpace;
42
42
  const totalWidth = chartOriginX + derivedChartWidth + paddingRight;
43
43
  const totalHeight = chartOriginY + height + xTickSpace + xTitleSpace + paddingBottom;
44
- const values = items.map((item) => item.value ?? 0);
44
+ const values = items.map((item) => { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : 0; });
45
45
  const maxValue = Math.max(...values, 0);
46
46
  const minValue = Math.min(...values, 0);
47
47
  const domainPadding = Math.max(Math.abs(maxValue), Math.abs(minValue)) * 0.1;
@@ -98,10 +98,11 @@ export const ChartLine = (props) => {
98
98
  return segments.join(' ');
99
99
  };
100
100
  items.forEach((item, index) => {
101
+ var _a;
101
102
  const x = chartOriginX + index * spacing + labelWidth / 2;
102
- const y = chartOriginY + scaleY(item.value ?? 0);
103
+ const y = chartOriginY + scaleY((_a = item.value) !== null && _a !== void 0 ? _a : 0);
103
104
  pointPositions.push({ x, y, datum: item });
104
- xLabels.push(_jsx(Item, { ...itemProps, indexes: [index], datum: item, x: x - labelWidth / 2, y: chartOriginY + height + 4 }));
105
+ xLabels.push(_jsx(Item, Object.assign({}, itemProps, { indexes: [index], datum: item, x: x - labelWidth / 2, y: chartOriginY + height + 4 })));
105
106
  const stopColor = getPaletteColor(options, [index]) || themeColors.colorPrimary;
106
107
  colorStopsData.push({ x, color: stopColor });
107
108
  });
@@ -142,10 +143,11 @@ export const ChartLine = (props) => {
142
143
  ].join(' ');
143
144
  lineElements.push(_jsx(Path, { d: areaPath, width: derivedChartWidth, height: height, fill: `url(#${gradientAreaId})`, stroke: "none", "data-element-type": "shape" }));
144
145
  pointPositions.forEach((pos, index) => {
146
+ var _a;
145
147
  const paletteColor = getPaletteColor(options, [index]) || themeColors.colorPrimary;
146
148
  pointElements.push(_jsx(Ellipse, { x: pos.x - 6, y: pos.y - 6, width: 12, height: 12, fill: paletteColor, "data-element-type": "shape" }));
147
149
  if (showValue) {
148
- valueElements.push(_jsx(Text, { x: pos.x, y: pos.y - 12, alignHorizontal: "center", alignVertical: "bottom", fontSize: 12, fontWeight: "bold", fill: paletteColor, children: valueFormatter(pos.datum.value ?? 0, pos.datum) }));
150
+ valueElements.push(_jsx(Text, { x: pos.x, y: pos.y - 12, alignHorizontal: "center", alignVertical: "bottom", fontSize: 12, fontWeight: "bold", fill: paletteColor, children: valueFormatter((_a = pos.datum.value) !== null && _a !== void 0 ? _a : 0, pos.datum) }));
149
151
  }
150
152
  });
151
153
  axisElements.push(_jsx(Path, { d: `M ${chartOriginX} ${chartOriginY + axisBaseY} L ${chartOriginX + derivedChartWidth} ${chartOriginY + axisBaseY}`, width: derivedChartWidth, height: 1, stroke: axisColor, strokeWidth: 1, "data-element-type": "shape" }));