@visactor/vtable 0.13.4-alpha.3 → 0.13.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 (173) hide show
  1. package/cjs/PivotChart.d.ts +3 -0
  2. package/cjs/PivotChart.js +44 -40
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/components/menu/dom/logic/MenuElementStyle.js +1 -1
  5. package/cjs/components/menu/dom/logic/MenuElementStyle.js.map +1 -1
  6. package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
  7. package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
  8. package/cjs/core/BaseTable.d.ts +14 -0
  9. package/cjs/core/BaseTable.js +28 -3
  10. package/cjs/core/BaseTable.js.map +1 -1
  11. package/cjs/core/style.js +1 -1
  12. package/cjs/core/style.js.map +1 -1
  13. package/cjs/event/event.d.ts +1 -1
  14. package/cjs/event/event.js +5 -4
  15. package/cjs/event/event.js.map +1 -1
  16. package/cjs/event/listener/table-group.js +9 -6
  17. package/cjs/event/listener/table-group.js.map +1 -1
  18. package/cjs/event/listener/touch.js +1 -1
  19. package/cjs/event/listener/touch.js.map +1 -1
  20. package/cjs/event/scroll.js +1 -1
  21. package/cjs/event/scroll.js.map +1 -1
  22. package/cjs/index.d.ts +1 -1
  23. package/cjs/index.js +1 -1
  24. package/cjs/index.js.map +1 -1
  25. package/cjs/render/layout/arc.d.ts +21 -10
  26. package/cjs/render/layout/arc.js +9 -7
  27. package/cjs/render/layout/arc.js.map +1 -1
  28. package/cjs/render/layout/circle.d.ts +17 -10
  29. package/cjs/render/layout/circle.js +6 -5
  30. package/cjs/render/layout/circle.js.map +1 -1
  31. package/cjs/render/layout/container.d.ts +48 -10
  32. package/cjs/render/layout/container.js +100 -15
  33. package/cjs/render/layout/container.js.map +1 -1
  34. package/cjs/render/layout/group-element.d.ts +24 -4
  35. package/cjs/render/layout/group-element.js +40 -4
  36. package/cjs/render/layout/group-element.js.map +1 -1
  37. package/cjs/render/layout/icon.d.ts +10 -10
  38. package/cjs/render/layout/icon.js +9 -11
  39. package/cjs/render/layout/icon.js.map +1 -1
  40. package/cjs/render/layout/image.d.ts +17 -10
  41. package/cjs/render/layout/image.js +7 -6
  42. package/cjs/render/layout/image.js.map +1 -1
  43. package/cjs/render/layout/index.d.ts +0 -2
  44. package/cjs/render/layout/index.js +1 -2
  45. package/cjs/render/layout/index.js.map +1 -1
  46. package/cjs/render/layout/percent-calc.d.ts +4 -1
  47. package/cjs/render/layout/percent-calc.js.map +1 -1
  48. package/cjs/render/layout/rect.d.ts +20 -10
  49. package/cjs/render/layout/rect.js +6 -5
  50. package/cjs/render/layout/rect.js.map +1 -1
  51. package/cjs/render/layout/text.d.ts +46 -9
  52. package/cjs/render/layout/text.js +18 -7
  53. package/cjs/render/layout/text.js.map +1 -1
  54. package/cjs/scenegraph/component/custom.d.ts +2 -2
  55. package/cjs/scenegraph/component/custom.js +6 -14
  56. package/cjs/scenegraph/component/custom.js.map +1 -1
  57. package/cjs/scenegraph/group-creater/init-scenegraph.js +3 -3
  58. package/cjs/scenegraph/group-creater/init-scenegraph.js.map +1 -1
  59. package/cjs/scenegraph/layout/compute-col-width.js +8 -5
  60. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  61. package/cjs/scenegraph/scenegraph.d.ts +5 -4
  62. package/cjs/scenegraph/scenegraph.js +4 -2
  63. package/cjs/scenegraph/scenegraph.js.map +1 -1
  64. package/cjs/scenegraph/select/create-select-border.d.ts +2 -2
  65. package/cjs/scenegraph/select/create-select-border.js +6 -15
  66. package/cjs/scenegraph/select/create-select-border.js.map +1 -1
  67. package/cjs/scenegraph/select/delete-select-border.js.map +1 -1
  68. package/cjs/scenegraph/select/update-select-border.js +84 -31
  69. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  70. package/cjs/tools/LimitPromiseQueue.js +1 -1
  71. package/cjs/tools/NumberMap.js +1 -1
  72. package/cjs/tools/Rect.js +1 -1
  73. package/cjs/ts-types/base-table.d.ts +16 -0
  74. package/cjs/ts-types/base-table.js +1 -1
  75. package/cjs/ts-types/base-table.js.map +1 -1
  76. package/cjs/ts-types/common.js +1 -1
  77. package/cjs/ts-types/customElement.js +1 -1
  78. package/cjs/ts-types/table-engine.d.ts +2 -1
  79. package/cjs/ts-types/table-engine.js.map +1 -1
  80. package/dist/vtable.js +1000 -446
  81. package/dist/vtable.min.js +2 -2
  82. package/es/PivotChart.d.ts +3 -0
  83. package/es/PivotChart.js +44 -40
  84. package/es/PivotChart.js.map +1 -1
  85. package/es/components/menu/dom/logic/MenuElementStyle.js +1 -1
  86. package/es/components/menu/dom/logic/MenuElementStyle.js.map +1 -1
  87. package/es/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
  88. package/es/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
  89. package/es/core/BaseTable.d.ts +14 -0
  90. package/es/core/BaseTable.js +36 -12
  91. package/es/core/BaseTable.js.map +1 -1
  92. package/es/core/style.js +1 -1
  93. package/es/core/style.js.map +1 -1
  94. package/es/event/event.d.ts +1 -1
  95. package/es/event/event.js +5 -4
  96. package/es/event/event.js.map +1 -1
  97. package/es/event/listener/table-group.js +9 -6
  98. package/es/event/listener/table-group.js.map +1 -1
  99. package/es/event/listener/touch.js +1 -1
  100. package/es/event/listener/touch.js.map +1 -1
  101. package/es/event/scroll.js +1 -1
  102. package/es/event/scroll.js.map +1 -1
  103. package/es/index.d.ts +1 -1
  104. package/es/index.js +1 -1
  105. package/es/index.js.map +1 -1
  106. package/es/render/layout/arc.d.ts +21 -10
  107. package/es/render/layout/arc.js +7 -7
  108. package/es/render/layout/arc.js.map +1 -1
  109. package/es/render/layout/circle.d.ts +17 -10
  110. package/es/render/layout/circle.js +6 -7
  111. package/es/render/layout/circle.js.map +1 -1
  112. package/es/render/layout/container.d.ts +48 -10
  113. package/es/render/layout/container.js +107 -16
  114. package/es/render/layout/container.js.map +1 -1
  115. package/es/render/layout/group-element.d.ts +24 -4
  116. package/es/render/layout/group-element.js +42 -4
  117. package/es/render/layout/group-element.js.map +1 -1
  118. package/es/render/layout/icon.d.ts +10 -10
  119. package/es/render/layout/icon.js +10 -12
  120. package/es/render/layout/icon.js.map +1 -1
  121. package/es/render/layout/image.d.ts +17 -10
  122. package/es/render/layout/image.js +7 -8
  123. package/es/render/layout/image.js.map +1 -1
  124. package/es/render/layout/index.d.ts +0 -2
  125. package/es/render/layout/index.js +0 -4
  126. package/es/render/layout/index.js.map +1 -1
  127. package/es/render/layout/percent-calc.d.ts +4 -1
  128. package/es/render/layout/percent-calc.js.map +1 -1
  129. package/es/render/layout/rect.d.ts +20 -10
  130. package/es/render/layout/rect.js +6 -7
  131. package/es/render/layout/rect.js.map +1 -1
  132. package/es/render/layout/text.d.ts +46 -9
  133. package/es/render/layout/text.js +18 -9
  134. package/es/render/layout/text.js.map +1 -1
  135. package/es/scenegraph/component/custom.d.ts +2 -2
  136. package/es/scenegraph/component/custom.js +7 -15
  137. package/es/scenegraph/component/custom.js.map +1 -1
  138. package/es/scenegraph/group-creater/init-scenegraph.js +3 -3
  139. package/es/scenegraph/group-creater/init-scenegraph.js.map +1 -1
  140. package/es/scenegraph/layout/compute-col-width.js +8 -5
  141. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  142. package/es/scenegraph/scenegraph.d.ts +5 -4
  143. package/es/scenegraph/scenegraph.js +3 -2
  144. package/es/scenegraph/scenegraph.js.map +1 -1
  145. package/es/scenegraph/select/create-select-border.d.ts +2 -2
  146. package/es/scenegraph/select/create-select-border.js +6 -15
  147. package/es/scenegraph/select/create-select-border.js.map +1 -1
  148. package/es/scenegraph/select/delete-select-border.js.map +1 -1
  149. package/es/scenegraph/select/update-select-border.js +84 -31
  150. package/es/scenegraph/select/update-select-border.js.map +1 -1
  151. package/es/tools/LimitPromiseQueue.js +1 -1
  152. package/es/tools/NumberMap.js +1 -1
  153. package/es/tools/Rect.js +1 -1
  154. package/es/ts-types/base-table.d.ts +16 -0
  155. package/es/ts-types/base-table.js +1 -1
  156. package/es/ts-types/base-table.js.map +1 -1
  157. package/es/ts-types/common.js +1 -1
  158. package/es/ts-types/customElement.js +1 -1
  159. package/es/ts-types/table-engine.d.ts +2 -1
  160. package/es/ts-types/table-engine.js.map +1 -1
  161. package/package.json +4 -4
  162. package/cjs/render/layout/group.d.ts +0 -12
  163. package/cjs/render/layout/group.js +0 -18
  164. package/cjs/render/layout/group.js.map +0 -1
  165. package/cjs/render/layout/tag.d.ts +0 -14
  166. package/cjs/render/layout/tag.js +0 -21
  167. package/cjs/render/layout/tag.js.map +0 -1
  168. package/es/render/layout/group.d.ts +0 -12
  169. package/es/render/layout/group.js +0 -12
  170. package/es/render/layout/group.js.map +0 -1
  171. package/es/render/layout/tag.d.ts +0 -14
  172. package/es/render/layout/tag.js +0 -15
  173. package/es/render/layout/tag.js.map +0 -1
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAC;AAmB3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,cAAc,cAAc,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAIxC,OAAO,EAKL,KAAK,EACL,IAAI,EACJ,SAAS,EAET,UAAU,EAGV,UAAU,EAcV,MAAM,EACN,IAAI,EAEJ,QAAQ,EACR,WAAW,EAEX,QAAQ,EAIR,cAAc,EACd,YAAY,EACb,CAAC;AAGF,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAED,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AACD,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTable } from './ListTable';\nimport { PivotTable } from './PivotTable';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\n// import { container, loadCanvasPicker } from '@visactor/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\n\nexport const version = \"0.13.4-alpha.3\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n IHeaderTreeDefine,\n IDimension,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAC;AAmB3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,cAAc,cAAc,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAIhC,OAAO,EAKL,KAAK,EACL,IAAI,EACJ,SAAS,EAET,UAAU,EAGV,UAAU,EAcV,MAAM,EACN,IAAI,EAEJ,QAAQ,EACR,WAAW,EAEX,QAAQ,EAIR,cAAc,EACd,YAAY,EACb,CAAC;AAGF,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAED,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AACD,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTable } from './ListTable';\nimport { PivotTable } from './PivotTable';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\n// import { container, loadCanvasPicker } from '@visactor/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\n\nexport const version = \"0.13.4\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n IHeaderTreeDefine,\n IDimension,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n"]}
@@ -1,12 +1,23 @@
1
- import type { IArcGraphicAttribute } from '@visactor/vrender';
2
- import { Arc as VArc } from '@visactor/vrender';
3
- type IArcOption = {
4
- marginTop?: number;
5
- marginRight?: number;
6
- marginBottom?: number;
7
- marginLeft?: number;
8
- } & IArcGraphicAttribute;
9
- export declare class Arc extends VArc {
10
- constructor(options: IArcOption);
1
+ import type { ElementOptions } from './element';
2
+ import { BaseElement } from './element';
3
+ type SectorOptions = {
4
+ radius: number;
5
+ startDegree?: number;
6
+ endDegree?: number;
7
+ clockWise?: boolean;
8
+ lineWidth?: number;
9
+ fill?: string | boolean;
10
+ stroke?: string | boolean;
11
+ } & ElementOptions;
12
+ export declare class Sector extends BaseElement {
13
+ type: 'arc';
14
+ radius: number;
15
+ startDegree: number;
16
+ endDegree: number;
17
+ clockWise: boolean;
18
+ lineWidth: number;
19
+ fill: string | boolean;
20
+ stroke: string | boolean;
21
+ constructor(options: SectorOptions);
11
22
  }
12
23
  export {};
@@ -1,12 +1,12 @@
1
- import { Arc as VArc } from "@visactor/vrender";
1
+ import { BaseElement } from "./element";
2
2
 
3
- import { isArray } from "@visactor/vutils";
4
-
5
- export class Arc extends VArc {
3
+ export class Sector extends BaseElement {
6
4
  constructor(options) {
7
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
8
- const isPaddingNumber = isArray(options.boundsPadding), padding = [ null !== (_b = null !== (_a = options.marginTop) && void 0 !== _a ? _a : isPaddingNumber ? options.boundsPadding[0] : options.boundsPadding) && void 0 !== _b ? _b : 0, null !== (_d = null !== (_c = options.marginRight) && void 0 !== _c ? _c : isPaddingNumber ? options.boundsPadding[1] : options.boundsPadding) && void 0 !== _d ? _d : 0, null !== (_g = null !== (_e = options.marginBottom) && void 0 !== _e ? _e : isPaddingNumber ? null !== (_f = options.boundsPadding[2]) && void 0 !== _f ? _f : options.boundsPadding[0] : options.boundsPadding) && void 0 !== _g ? _g : 0, null !== (_k = null !== (_h = options.marginLeft) && void 0 !== _h ? _h : isPaddingNumber ? null !== (_j = options.boundsPadding[3]) && void 0 !== _j ? _j : options.boundsPadding[1] : options.boundsPadding) && void 0 !== _k ? _k : 0 ];
9
- options.boundsPadding = padding, super(options);
5
+ super(options), this.type = "arc", this.startDegree = 0, this.endDegree = 360, this.clockWise = !0,
6
+ this.radius = options.radius, this.startDegree = options.startDegree, this.endDegree = options.endDegree,
7
+ this.clockWise = options.clockWise, this.lineWidth = options.lineWidth, this.fill = options.fill,
8
+ this.stroke = options.stroke, this.width = 2 * this.radius, this.height = 2 * this.radius,
9
+ this.initLayoutSize(), this.dx += this.radius, this.dy += this.radius;
10
10
  }
11
11
  }
12
12
  //# sourceMappingURL=arc.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["render/layout/arc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS3C,MAAM,OAAO,GAAI,SAAQ,IAAI;IAC3B,YAAY,OAAmB;;QAC7B,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG;YACd,MAAA,MAAA,OAAO,CAAC,SAAS,mCAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAAI,CAAC;YAC9F,MAAA,MAAA,OAAO,CAAC,WAAW,mCAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAAI,CAAC;YAChG,MAAA,MAAA,OAAO,CAAC,YAAY,mCAClB,CAAC,eAAe,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAChG,CAAC;YACH,MAAA,MAAA,OAAO,CAAC,UAAU,mCAChB,CAAC,eAAe,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAChG,CAAC;SACJ,CAAC;QACF,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF","file":"arc.js","sourcesContent":["import type { IArcGraphicAttribute } from '@visactor/vrender';\nimport { Arc as VArc } from '@visactor/vrender';\nimport { isArray } from '@visactor/vutils';\n\ntype IArcOption = {\n marginTop?: number;\n marginRight?: number;\n marginBottom?: number;\n marginLeft?: number;\n} & IArcGraphicAttribute;\n\nexport class Arc extends VArc {\n constructor(options: IArcOption) {\n const isPaddingNumber = isArray(options.boundsPadding);\n const padding = [\n options.marginTop ?? (isPaddingNumber ? options.boundsPadding[0] : options.boundsPadding) ?? 0,\n options.marginRight ?? (isPaddingNumber ? options.boundsPadding[1] : options.boundsPadding) ?? 0,\n options.marginBottom ??\n (isPaddingNumber ? options.boundsPadding[2] ?? options.boundsPadding[0] : options.boundsPadding) ??\n 0,\n options.marginLeft ??\n (isPaddingNumber ? options.boundsPadding[3] ?? options.boundsPadding[1] : options.boundsPadding) ??\n 0\n ];\n options.boundsPadding = padding;\n\n super(options);\n }\n}\n"]}
1
+ {"version":3,"sources":["render/layout/arc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAYxC,MAAM,OAAO,MAAO,SAAQ,WAAW;IAUrC,YAAY,OAAsB;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QAVjB,SAAI,GAAU,KAAK,CAAC;QAEpB,gBAAW,GAAG,CAAC,CAAC;QAChB,cAAS,GAAG,GAAG,CAAC;QAChB,cAAS,GAAG,IAAI,CAAC;QAOf,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAE9B,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC;IACzB,CAAC;CACF","file":"arc.js","sourcesContent":["import type { ElementOptions } from './element';\nimport { BaseElement } from './element';\n\ntype SectorOptions = {\n radius: number;\n startDegree?: number;\n endDegree?: number;\n clockWise?: boolean;\n lineWidth?: number;\n fill?: string | boolean;\n stroke?: string | boolean;\n} & ElementOptions;\n\nexport class Sector extends BaseElement {\n type: 'arc' = 'arc';\n radius: number;\n startDegree = 0;\n endDegree = 360;\n clockWise = true;\n lineWidth: number;\n fill: string | boolean;\n stroke: string | boolean;\n\n constructor(options: SectorOptions) {\n super(options);\n this.radius = options.radius;\n this.startDegree = options.startDegree;\n this.endDegree = options.endDegree;\n this.clockWise = options.clockWise;\n this.lineWidth = options.lineWidth;\n this.fill = options.fill;\n this.stroke = options.stroke;\n\n this.width = this.radius * 2;\n this.height = this.radius * 2;\n\n this.initLayoutSize();\n\n this.dx += this.radius;\n this.dy += this.radius;\n }\n}\n"]}
@@ -1,12 +1,19 @@
1
- import type { ICircleGraphicAttribute } from '@visactor/vrender';
2
- import { Circle as VCircle } from '@visactor/vrender';
3
- type ICircleOption = {
4
- marginTop?: number;
5
- marginRight?: number;
6
- marginBottom?: number;
7
- marginLeft?: number;
8
- } & ICircleGraphicAttribute;
9
- export declare class Circle extends VCircle {
10
- constructor(options: ICircleOption);
1
+ import type { ElementOptions } from './element';
2
+ import { BaseElement } from './element';
3
+ type CircleOptions = {
4
+ radius: number;
5
+ radian?: number;
6
+ lineWidth?: number;
7
+ fill?: string | boolean;
8
+ stroke?: string | boolean;
9
+ } & ElementOptions;
10
+ export declare class Circle extends BaseElement {
11
+ type: 'circle';
12
+ radius: number;
13
+ radian: number;
14
+ lineWidth: number;
15
+ fill: string | boolean;
16
+ stroke: string | boolean;
17
+ constructor(options: CircleOptions);
11
18
  }
12
19
  export {};
@@ -1,12 +1,11 @@
1
- import { Circle as VCircle } from "@visactor/vrender";
1
+ import { BaseElement } from "./element";
2
2
 
3
- import { isArray } from "@visactor/vutils";
4
-
5
- export class Circle extends VCircle {
3
+ export class Circle extends BaseElement {
6
4
  constructor(options) {
7
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
8
- const isPaddingNumber = isArray(options.boundsPadding), padding = [ null !== (_b = null !== (_a = options.marginTop) && void 0 !== _a ? _a : isPaddingNumber ? options.boundsPadding[0] : options.boundsPadding) && void 0 !== _b ? _b : 0, null !== (_d = null !== (_c = options.marginRight) && void 0 !== _c ? _c : isPaddingNumber ? options.boundsPadding[1] : options.boundsPadding) && void 0 !== _d ? _d : 0, null !== (_g = null !== (_e = options.marginBottom) && void 0 !== _e ? _e : isPaddingNumber ? null !== (_f = options.boundsPadding[2]) && void 0 !== _f ? _f : options.boundsPadding[0] : options.boundsPadding) && void 0 !== _g ? _g : 0, null !== (_k = null !== (_h = options.marginLeft) && void 0 !== _h ? _h : isPaddingNumber ? null !== (_j = options.boundsPadding[3]) && void 0 !== _j ? _j : options.boundsPadding[1] : options.boundsPadding) && void 0 !== _k ? _k : 0 ];
9
- options.boundsPadding = padding, super(options);
5
+ super(options), this.type = "circle", this.radius = options.radius, this.radian = options.radian,
6
+ this.lineWidth = options.lineWidth, this.fill = options.fill, this.stroke = options.stroke,
7
+ this.width = 2 * this.radius, this.height = 2 * this.radius, this.initLayoutSize(),
8
+ this.dx += this.radius, this.dy += this.radius;
10
9
  }
11
10
  }
12
11
  //# sourceMappingURL=circle.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["render/layout/circle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS3C,MAAM,OAAO,MAAO,SAAQ,OAAO;IACjC,YAAY,OAAsB;;QAChC,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG;YACd,MAAA,MAAA,OAAO,CAAC,SAAS,mCAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAAI,CAAC;YAC9F,MAAA,MAAA,OAAO,CAAC,WAAW,mCAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAAI,CAAC;YAChG,MAAA,MAAA,OAAO,CAAC,YAAY,mCAClB,CAAC,eAAe,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAChG,CAAC;YACH,MAAA,MAAA,OAAO,CAAC,UAAU,mCAChB,CAAC,eAAe,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAChG,CAAC;SACJ,CAAC;QACF,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF","file":"circle.js","sourcesContent":["import type { ICircleGraphicAttribute } from '@visactor/vrender';\nimport { Circle as VCircle } from '@visactor/vrender';\nimport { isArray } from '@visactor/vutils';\n\ntype ICircleOption = {\n marginTop?: number;\n marginRight?: number;\n marginBottom?: number;\n marginLeft?: number;\n} & ICircleGraphicAttribute;\n\nexport class Circle extends VCircle {\n constructor(options: ICircleOption) {\n const isPaddingNumber = isArray(options.boundsPadding);\n const padding = [\n options.marginTop ?? (isPaddingNumber ? options.boundsPadding[0] : options.boundsPadding) ?? 0,\n options.marginRight ?? (isPaddingNumber ? options.boundsPadding[1] : options.boundsPadding) ?? 0,\n options.marginBottom ??\n (isPaddingNumber ? options.boundsPadding[2] ?? options.boundsPadding[0] : options.boundsPadding) ??\n 0,\n options.marginLeft ??\n (isPaddingNumber ? options.boundsPadding[3] ?? options.boundsPadding[1] : options.boundsPadding) ??\n 0\n ];\n options.boundsPadding = padding;\n\n super(options);\n }\n}\n"]}
1
+ {"version":3,"sources":["render/layout/circle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAUxC,MAAM,OAAO,MAAO,SAAQ,WAAW;IAQrC,YAAY,OAAsB;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QARjB,SAAI,GAAa,QAAQ,CAAC;QASxB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAE9B,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC;IACzB,CAAC;CACF","file":"circle.js","sourcesContent":["import type { ElementOptions } from './element';\nimport { BaseElement } from './element';\n\ntype CircleOptions = {\n radius: number;\n radian?: number;\n lineWidth?: number;\n fill?: string | boolean;\n stroke?: string | boolean;\n} & ElementOptions;\n\nexport class Circle extends BaseElement {\n type: 'circle' = 'circle';\n radius: number;\n radian: number;\n lineWidth: number;\n fill: string | boolean;\n stroke: string | boolean;\n\n constructor(options: CircleOptions) {\n super(options);\n this.radius = options.radius;\n this.radian = options.radian;\n this.lineWidth = options.lineWidth;\n this.fill = options.fill;\n this.stroke = options.stroke;\n\n this.width = this.radius * 2;\n this.height = this.radius * 2;\n\n this.initLayoutSize();\n\n this.dx += this.radius;\n this.dy += this.radius;\n }\n}\n"]}
@@ -1,14 +1,52 @@
1
- import type { IGroupGraphicAttribute } from '@visactor/vrender';
2
- import { Group } from '@visactor/vrender';
1
+ import type { BaseTableAPI } from '../../ts-types/base-table';
2
+ import type { DirectionKey } from './direction';
3
+ import type { ElementOptions } from './element';
4
+ import { BaseElement } from './element';
5
+ import { Line } from './line';
3
6
  import type { percentCalcObj } from './percent-calc';
4
- export type IContainerOptions = {
7
+ type containerOptions = {
5
8
  width?: number | percentCalcObj;
6
9
  height?: number | percentCalcObj;
7
- marginTop?: number;
8
- marginRight?: number;
9
- marginBottom?: number;
10
- marginLeft?: number;
11
- } & IGroupGraphicAttribute;
12
- export declare class Container extends Group {
13
- constructor(containerOptions: IContainerOptions);
10
+ direction?: 'row' | 'column';
11
+ justifyContent?: 'start' | 'end' | 'center';
12
+ alignItems?: 'start' | 'end' | 'center';
13
+ alignContent?: 'start' | 'end' | 'center';
14
+ showBounds?: boolean;
15
+ } & ElementOptions;
16
+ export declare class Container extends BaseElement {
17
+ type: 'container';
18
+ width: number;
19
+ _widthObj: percentCalcObj;
20
+ height: number;
21
+ _heightObj: percentCalcObj;
22
+ needCalcSize: boolean;
23
+ direction: 'row' | 'column';
24
+ justifyContent: 'start' | 'end' | 'center';
25
+ alignItems: 'start' | 'end' | 'center';
26
+ alignContent: 'start' | 'end' | 'center';
27
+ lines: Line[];
28
+ currentLine?: Line;
29
+ currentLineY: number;
30
+ table: BaseTableAPI;
31
+ directionKey: DirectionKey;
32
+ showBounds: boolean;
33
+ offsetY: number;
34
+ isRoot?: boolean;
35
+ constructor(options: containerOptions);
36
+ add(element: BaseElement): void;
37
+ updateYAlign(): void;
38
+ getSize(): {
39
+ width: number;
40
+ height: number;
41
+ };
42
+ getContentSize(): {
43
+ width: number;
44
+ height: number;
45
+ };
46
+ calcSize(parentWidth: number, parentHeight: number): void;
47
+ getElements(parentPos?: {
48
+ parentX: number;
49
+ parentY: number;
50
+ }, isHover?: boolean, isSelect?: boolean): any[];
14
51
  }
52
+ export {};
@@ -1,21 +1,112 @@
1
- import { isArray } from "@visactor/vutils";
1
+ import { isNumber } from "@visactor/vutils";
2
2
 
3
- import { Group } from "@visactor/vrender";
3
+ import { DIRECTION_KEY } from "./direction";
4
4
 
5
- export class Container extends Group {
6
- constructor(containerOptions) {
7
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
8
- containerOptions.direction && (containerOptions.flexDirection = containerOptions.direction),
9
- !containerOptions.justifyContent || "start" !== containerOptions.justifyContent && "end" !== containerOptions.justifyContent || (containerOptions.justifyContent = "flex-" + containerOptions.justifyContent),
10
- !containerOptions.alignItems || "start" !== containerOptions.alignItems && "end" !== containerOptions.alignItems || (containerOptions.alignItems = "flex-" + containerOptions.alignItems),
11
- !containerOptions.alignContent || "start" !== containerOptions.alignContent && "end" !== containerOptions.alignContent || (containerOptions.alignContent = "flex-" + containerOptions.alignContent),
12
- containerOptions.display = "flex", containerOptions.flexDirection || (containerOptions.flexDirection = "row"),
13
- containerOptions.clip = !0, containerOptions.fill = null === (_a = null == containerOptions ? void 0 : containerOptions.background) || void 0 === _a ? void 0 : _a.fill,
14
- containerOptions.stroke = null === (_b = null == containerOptions ? void 0 : containerOptions.background) || void 0 === _b ? void 0 : _b.stroke,
15
- containerOptions.lineWidth = null === (_c = null == containerOptions ? void 0 : containerOptions.background) || void 0 === _c ? void 0 : _c.lineWidth,
16
- containerOptions.cornerRadius = null === (_d = null == containerOptions ? void 0 : containerOptions.background) || void 0 === _d ? void 0 : _d.cornerRadius;
17
- const isPaddingNumber = isArray(containerOptions.boundsPadding), padding = [ null !== (_f = null !== (_e = containerOptions.marginTop) && void 0 !== _e ? _e : isPaddingNumber ? containerOptions.boundsPadding[0] : containerOptions.boundsPadding) && void 0 !== _f ? _f : 0, null !== (_h = null !== (_g = containerOptions.marginRight) && void 0 !== _g ? _g : isPaddingNumber ? containerOptions.boundsPadding[1] : containerOptions.boundsPadding) && void 0 !== _h ? _h : 0, null !== (_l = null !== (_j = containerOptions.marginBottom) && void 0 !== _j ? _j : isPaddingNumber ? null !== (_k = containerOptions.boundsPadding[2]) && void 0 !== _k ? _k : containerOptions.boundsPadding[0] : containerOptions.boundsPadding) && void 0 !== _l ? _l : 0, null !== (_p = null !== (_m = containerOptions.marginLeft) && void 0 !== _m ? _m : isPaddingNumber ? null !== (_o = containerOptions.boundsPadding[3]) && void 0 !== _o ? _o : containerOptions.boundsPadding[1] : containerOptions.boundsPadding) && void 0 !== _p ? _p : 0 ];
18
- containerOptions.boundsPadding = padding, super(containerOptions);
5
+ import { BaseElement } from "./element";
6
+
7
+ import { Line } from "./line";
8
+
9
+ import { Rect } from "./rect";
10
+
11
+ export class Container extends BaseElement {
12
+ constructor(options) {
13
+ super(options), this.type = "container", this.needCalcSize = !1, this.lines = [],
14
+ this.currentLineY = 0, this.offsetY = 0, this.direction = options.direction || "row",
15
+ this.justifyContent = options.justifyContent || "start", this.alignItems = options.alignItems || "start",
16
+ this.alignContent = options.alignContent || "start", isNumber(options.width) ? this.width = options.width : (this._widthObj = options.width,
17
+ this.needCalcSize = !0), isNumber(options.height) ? this.height = options.height : (this._heightObj = options.height,
18
+ this.needCalcSize = !0), this.directionKey = DIRECTION_KEY[this.direction], this.showBounds = options.showBounds || !1,
19
+ this.initLayoutSize();
20
+ }
21
+ add(element) {
22
+ if (this.needCalcSize) throw new Error("Need to specify a parent element before adding a child element when use percent size!");
23
+ "container" === element.type && element.calcSize(this.width, this.height), this.currentLine && this.currentLine.canAdd(element) ? this.currentLine.add(element) : (this.currentLine && (this.currentLine.addAble = !1,
24
+ this.currentLineY += this.currentLine[this.directionKey.height], this.currentLine.lineFinish()),
25
+ this.currentLine = new Line(this[this.directionKey.width], this.direction, this.justifyContent, this.alignItems),
26
+ this.currentLine[this.directionKey.y] = this.currentLineY, this.currentLine.add(element),
27
+ this.lines.push(this.currentLine));
28
+ }
29
+ updateYAlign() {
30
+ const offsetY = this[this.directionKey.height] - this.currentLineY;
31
+ "center" === this.alignContent ? this.offsetY = offsetY / 2 : "start" === this.alignContent ? this.offsetY = 0 : this.offsetY = offsetY;
32
+ }
33
+ getSize() {
34
+ const result = {
35
+ width: 0,
36
+ height: 0
37
+ };
38
+ this.currentLine && this.currentLine.addAble ? result[this.directionKey.height] = this.currentLineY + this.currentLine[this.directionKey.height] : result[this.directionKey.height] = this.currentLineY;
39
+ for (let i = 0; i < this.lines.length; i++) {
40
+ const line = this.lines[i];
41
+ result[this.directionKey.width] < line[this.directionKey.width] && (result[this.directionKey.width] = line[this.directionKey.width]);
42
+ }
43
+ return result;
44
+ }
45
+ getContentSize() {
46
+ const result = {
47
+ width: 0,
48
+ height: 0
49
+ }, calcFlag = {
50
+ width: !0,
51
+ height: !0
52
+ };
53
+ this.isRoot || this._heightObj || (calcFlag.height = !1, result.height = this.height),
54
+ this.isRoot || this._widthObj || (calcFlag.width = !1, result.width = this.width);
55
+ for (let i = 0; i < this.lines.length; i++) {
56
+ const size = this.lines[i].getContentSize();
57
+ calcFlag[this.directionKey.width] && result[this.directionKey.width] < size[this.directionKey.width] && (result[this.directionKey.width] = size[this.directionKey.width]),
58
+ calcFlag[this.directionKey.height] && (result[this.directionKey.height] += size[this.directionKey.height]);
59
+ }
60
+ return result;
61
+ }
62
+ calcSize(parentWidth, parentHeight) {
63
+ this._heightObj && (this.height = parentHeight * this._heightObj.percent / 100 + this._heightObj.delta,
64
+ this.needCalcSize = !1, this.initLayoutSize()), this._widthObj && (this.width = parentWidth * this._widthObj.percent / 100 + this._widthObj.delta,
65
+ this.needCalcSize = !1, this.initLayoutSize());
66
+ }
67
+ getElements(parentPos = {
68
+ parentX: 0,
69
+ parentY: 0
70
+ }, isHover = !1, isSelect = !1) {
71
+ var _a, _b, _c;
72
+ this.currentLine && this.currentLine.addAble && (this.currentLine.addAble = !1,
73
+ this.currentLineY += this.currentLine[this.directionKey.height], this.currentLine.lineFinish()),
74
+ this.updateYAlign();
75
+ const elements = [];
76
+ if (this.background && this.background.fill) {
77
+ const backgroundRect = new Rect({
78
+ width: this.width,
79
+ height: this.height,
80
+ stroke: null !== (_a = this.background.stroke) && void 0 !== _a && _a,
81
+ fill: this.background.fill,
82
+ cornerRadius: null !== (_b = this.background.cornerRadius) && void 0 !== _b ? _b : 0,
83
+ lineWidth: null !== (_c = this.background.lineWidth) && void 0 !== _c ? _c : 1
84
+ });
85
+ backgroundRect.x += this.x + parentPos.parentX, backgroundRect.y += this.y + parentPos.parentY,
86
+ elements.push(backgroundRect);
87
+ }
88
+ if (this.showBounds) {
89
+ const boundsRect = new Rect({
90
+ width: this.width,
91
+ height: this.height,
92
+ cornerRadius: 0,
93
+ stroke: "red",
94
+ fill: "rgba(255, 0, 0, 0.2)",
95
+ lineWidth: 4
96
+ });
97
+ boundsRect.x += this.x + parentPos.parentX, boundsRect.y += this.y + parentPos.parentY,
98
+ elements.push(boundsRect);
99
+ }
100
+ for (let i = 0; i < this.lines.length; i++) {
101
+ const line = this.lines[i];
102
+ line[this.directionKey.y] += this.offsetY;
103
+ const linesElements = line.getElements({
104
+ [this.directionKey.parentX]: this.x + parentPos.parentX,
105
+ [this.directionKey.parentY]: this.y + parentPos.parentY
106
+ }, isHover, isSelect);
107
+ elements.push(...linesElements);
108
+ }
109
+ return elements;
19
110
  }
20
111
  }
21
112
  //# sourceMappingURL=container.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["render/layout/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAY1C,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,YAAY,gBAAmC;;QAC7C,IAAK,gBAAwB,CAAC,SAAS,EAAE;YACvC,gBAAgB,CAAC,aAAa,GAAI,gBAAwB,CAAC,SAAS,CAAC;SACtE;QACD,IACE,gBAAgB,CAAC,cAAc;YAC/B,CAAE,gBAAgB,CAAC,cAAsB,KAAK,OAAO,IAAK,gBAAgB,CAAC,cAAsB,KAAK,KAAK,CAAC,EAC5G;YACA,gBAAgB,CAAC,cAAc,GAAG,CAAC,OAAO,GAAG,gBAAgB,CAAC,cAAc,CAAQ,CAAC;SACtF;QAED,IAC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AAgB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,mCACtF,CAAC;YACH,MAAA,MAAA,gBAAgB,CAAC,WAAW,mCAC1B,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,mCACtF,CAAC;YACH,MAAA,MAAA,gBAAgB,CAAC,YAAY,mCAC3B,CAAC,eAAe;gBACd,CAAC,CAAC,MAAA,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAI,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC;gBACxE,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,mCACnC,CAAC;YACH,MAAA,MAAA,gBAAgB,CAAC,UAAU,mCACzB,CAAC,eAAe;gBACd,CAAC,CAAC,MAAA,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAI,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC;gBACxE,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,mCACnC,CAAC;SACJ,CAAC;QACF,gBAAgB,CAAC,aAAa,GAAG,OAAO,CAAC;QAEzC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC1B,CAAC;CACF","file":"container.js","sourcesContent":["import { isArray } from '@visactor/vutils';\nimport type { IGroupGraphicAttribute } from '@visactor/vrender';\nimport { Group } from '@visactor/vrender';\nimport type { percentCalcObj } from './percent-calc';\n\nexport type IContainerOptions = {\n width?: number | percentCalcObj;\n height?: number | percentCalcObj;\n marginTop?: number;\n marginRight?: number;\n marginBottom?: number;\n marginLeft?: number;\n} & IGroupGraphicAttribute;\n\nexport class Container extends Group {\n constructor(containerOptions: IContainerOptions) {\n if ((containerOptions as any).direction) {\n containerOptions.flexDirection = (containerOptions as any).direction;\n }\n if (\n containerOptions.justifyContent &&\n ((containerOptions.justifyContent as any) === 'start' || (containerOptions.justifyContent as any) === 'end')\n ) {\n containerOptions.justifyContent = ('flex-' + containerOptions.justifyContent) as any;\n }\n\n if (\n containerOptions.alignItems &&\n ((containerOptions.alignItems as any) === 'start' || (containerOptions.alignItems as any) === 'end')\n ) {\n containerOptions.alignItems = ('flex-' + containerOptions.alignItems) as any;\n }\n\n if (\n containerOptions.alignContent &&\n ((containerOptions.alignContent as any) === 'start' || (containerOptions.alignContent as any) === 'end')\n ) {\n containerOptions.alignContent = ('flex-' + containerOptions.alignContent) as any;\n }\n containerOptions.display = 'flex';\n if (!containerOptions.flexDirection) {\n containerOptions.flexDirection = 'row';\n }\n\n containerOptions.clip = true;\n containerOptions.fill = (containerOptions?.background as any)?.fill;\n containerOptions.stroke = (containerOptions?.background as any)?.stroke;\n containerOptions.lineWidth = (containerOptions?.background as any)?.lineWidth;\n containerOptions.cornerRadius = (containerOptions?.background as any)?.cornerRadius;\n // containerOptions.flexWrap = 'nowrap';\n\n const isPaddingNumber = isArray(containerOptions.boundsPadding);\n const padding = [\n containerOptions.marginTop ??\n (isPaddingNumber ? containerOptions.boundsPadding[0] : containerOptions.boundsPadding) ??\n 0,\n containerOptions.marginRight ??\n (isPaddingNumber ? containerOptions.boundsPadding[1] : containerOptions.boundsPadding) ??\n 0,\n containerOptions.marginBottom ??\n (isPaddingNumber\n ? containerOptions.boundsPadding[2] ?? containerOptions.boundsPadding[0]\n : containerOptions.boundsPadding) ??\n 0,\n containerOptions.marginLeft ??\n (isPaddingNumber\n ? containerOptions.boundsPadding[3] ?? containerOptions.boundsPadding[1]\n : containerOptions.boundsPadding) ??\n 0\n ];\n containerOptions.boundsPadding = padding;\n\n super(containerOptions);\n }\n}\n"]}
1
+ {"version":3,"sources":["render/layout/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW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a,GAAG,IAAI,CAAC,WAAW,CACpC;gBACE,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO;gBACvD,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO;aACjD,EACR,OAAO,EACP,QAAQ,CACT,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;SACjC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","file":"container.js","sourcesContent":["import { isNumber } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { DirectionKey } from './direction';\nimport { DIRECTION_KEY } from './direction';\nimport type { ElementOptions } from './element';\nimport { BaseElement } from './element';\nimport { Line } from './line';\nimport type { percentCalcObj } from './percent-calc';\nimport { Rect } from './rect';\n\ntype containerOptions = {\n width?: number | percentCalcObj;\n height?: number | percentCalcObj;\n direction?: 'row' | 'column'; // 布局主方向\n justifyContent?: 'start' | 'end' | 'center'; // 布局方向上的对齐方式\n alignItems?: 'start' | 'end' | 'center'; // 布局交叉方向上的对齐方式\n alignContent?: 'start' | 'end' | 'center'; // 布局交叉方向上多根轴线的对齐方式\n showBounds?: boolean; // 是否显示bounds\n} & ElementOptions;\n\nexport class Container extends BaseElement {\n type: 'container' = 'container';\n declare width: number;\n _widthObj: percentCalcObj;\n declare height: number;\n _heightObj: percentCalcObj;\n needCalcSize = false;\n direction: 'row' | 'column'; // 布局主方向\n justifyContent: 'start' | 'end' | 'center'; // 布局方向上的对齐方式\n alignItems: 'start' | 'end' | 'center'; // 布局交叉方向上的对齐方式\n alignContent: 'start' | 'end' | 'center'; // 布局交叉方向上多根轴线的对齐方式\n lines: Line[] = [];\n currentLine?: Line;\n currentLineY = 0;\n table: BaseTableAPI;\n directionKey: DirectionKey;\n showBounds: boolean;\n offsetY = 0;\n isRoot?: boolean;\n\n constructor(options: containerOptions) {\n super(options);\n this.direction = options.direction || 'row';\n this.justifyContent = options.justifyContent || 'start';\n this.alignItems = options.alignItems || 'start';\n this.alignContent = options.alignContent || 'start';\n\n if (isNumber(options.width)) {\n this.width = options.width as number;\n } else {\n this._widthObj = options.width as percentCalcObj;\n this.needCalcSize = true;\n }\n if (isNumber(options.height)) {\n this.height = options.height as number;\n } else {\n this._heightObj = options.height as percentCalcObj;\n this.needCalcSize = true;\n }\n\n this.directionKey = DIRECTION_KEY[this.direction];\n\n this.showBounds = options.showBounds || false;\n\n this.initLayoutSize();\n }\n\n add(element: BaseElement) {\n if (this.needCalcSize) {\n throw new Error('Need to specify a parent element before adding a child element when use percent size!');\n }\n\n if (element.type === 'container') {\n (element as Container).calcSize(this.width, this.height);\n }\n\n if (this.currentLine && this.currentLine.canAdd(element)) {\n this.currentLine.add(element);\n } else {\n if (this.currentLine) {\n this.currentLine.addAble = false; // 关闭当前行\n this.currentLineY += this.currentLine[this.directionKey.height]; // 更新目前line y位置\n this.currentLine.lineFinish();\n }\n // this.currentLine = new Line(this.width);\n this.currentLine = new Line(this[this.directionKey.width], this.direction, this.justifyContent, this.alignItems);\n this.currentLine[this.directionKey.y] = this.currentLineY;\n this.currentLine.add(element);\n this.lines.push(this.currentLine);\n }\n }\n\n // 交叉方向上多根轴线的对齐方式\n updateYAlign() {\n const offsetY = this[this.directionKey.height] - this.currentLineY;\n if (this.alignContent === 'center') {\n this.offsetY = offsetY / 2;\n } else if (this.alignContent === 'start') {\n this.offsetY = 0;\n } else {\n this.offsetY = offsetY;\n }\n }\n\n getSize() {\n const result = {\n width: 0,\n height: 0\n };\n if (this.currentLine && this.currentLine.addAble) {\n result[this.directionKey.height] = this.currentLineY + this.currentLine[this.directionKey.height];\n } else {\n result[this.directionKey.height] = this.currentLineY;\n }\n\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n if (result[this.directionKey.width] < line[this.directionKey.width]) {\n result[this.directionKey.width] = line[this.directionKey.width];\n }\n }\n return result;\n }\n\n getContentSize() {\n const result = {\n width: 0,\n height: 0\n };\n\n const calcFlag = {\n width: true,\n height: true\n };\n\n if (!this.isRoot && !this._heightObj) {\n calcFlag.height = false;\n result.height = this.height;\n }\n if (!this.isRoot && !this._widthObj) {\n calcFlag.width = false;\n result.width = this.width;\n }\n\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n const size = line.getContentSize();\n if (calcFlag[this.directionKey.width] && result[this.directionKey.width] < size[this.directionKey.width]) {\n result[this.directionKey.width] = size[this.directionKey.width];\n }\n\n if (calcFlag[this.directionKey.height]) {\n result[this.directionKey.height] += size[this.directionKey.height];\n }\n }\n\n return result;\n }\n\n calcSize(parentWidth: number, parentHeight: number) {\n if (this._heightObj) {\n this.height = (parentHeight * this._heightObj.percent) / 100 + this._heightObj.delta;\n this.needCalcSize = false;\n this.initLayoutSize();\n }\n if (this._widthObj) {\n this.width = (parentWidth * this._widthObj.percent) / 100 + this._widthObj.delta;\n this.needCalcSize = false;\n this.initLayoutSize();\n }\n }\n\n // 获取平坦后的全部子图元,更新子图元xy位置信息\n getElements(\n parentPos: { parentX: number; parentY: number } = { parentX: 0, parentY: 0 },\n isHover = false,\n isSelect = false\n ) {\n // 关闭最后一行\n if (this.currentLine && this.currentLine.addAble) {\n this.currentLine.addAble = false; // 关闭当前行\n this.currentLineY += this.currentLine[this.directionKey.height]; // 更新目前line y位置\n this.currentLine.lineFinish();\n }\n\n // 处理alignContent\n this.updateYAlign();\n\n const elements = [];\n if (this.background && this.background.fill) {\n const backgroundRect = new Rect({\n width: this.width,\n height: this.height,\n stroke: this.background.stroke ?? false,\n fill: this.background.fill,\n cornerRadius: this.background.cornerRadius ?? 0,\n lineWidth: this.background.lineWidth ?? 1\n });\n backgroundRect.x += this.x + parentPos.parentX;\n backgroundRect.y += this.y + parentPos.parentY;\n elements.push(backgroundRect);\n }\n if (this.showBounds) {\n const boundsRect = new Rect({\n width: this.width,\n height: this.height,\n cornerRadius: 0,\n stroke: 'red',\n fill: 'rgba(255, 0, 0, 0.2)',\n lineWidth: 4\n });\n boundsRect.x += this.x + parentPos.parentX;\n boundsRect.y += this.y + parentPos.parentY;\n elements.push(boundsRect);\n }\n // const parentPos = { parentX, parentY };\n for (let i = 0; i < this.lines.length; i++) {\n const line = this.lines[i];\n line[this.directionKey.y] += this.offsetY;\n // const linesElements = line.getElements(table, this.x + parentX, this.y + parentY);\n const linesElements = line.getElements(\n {\n [this.directionKey.parentX]: this.x + parentPos.parentX,\n [this.directionKey.parentY]: this.y + parentPos.parentY\n } as any,\n isHover,\n isSelect\n );\n elements.push(...linesElements);\n }\n\n return elements;\n }\n}\n"]}
@@ -1,5 +1,25 @@
1
- import type { IContainerOptions } from './container';
2
- import { Container } from './container';
3
- export declare class GroupElement extends Container {
4
- constructor(option: IContainerOptions);
1
+ import type { AlignItems, DirectionKey } from './direction';
2
+ import type { ElementOptions } from './element';
3
+ import { BaseElement } from './element';
4
+ type GroupElementOptions = {
5
+ direction?: 'row' | 'column';
6
+ alignItems?: AlignItems;
7
+ } & ElementOptions;
8
+ export declare class GroupElement extends BaseElement {
9
+ type: 'group-element';
10
+ direction: 'row' | 'column';
11
+ alignItems?: AlignItems;
12
+ width: number;
13
+ height: number;
14
+ children: BaseElement[];
15
+ directionKey: DirectionKey;
16
+ constructor(options: GroupElementOptions);
17
+ add(element: BaseElement): void;
18
+ updateHeight(element: BaseElement): void;
19
+ getOffsetY(element: BaseElement): number;
20
+ getElements(parentPos?: {
21
+ parentX: number;
22
+ parentY: number;
23
+ }, isHover?: boolean, isSelect?: boolean): BaseElement[];
5
24
  }
25
+ export {};
@@ -1,8 +1,46 @@
1
- import { Container } from "./container";
1
+ import { DIRECTION_KEY } from "./direction";
2
2
 
3
- export class GroupElement extends Container {
4
- constructor(option) {
5
- option.flexWrap = "nowrap", super(option);
3
+ import { BaseElement } from "./element";
4
+
5
+ export class GroupElement extends BaseElement {
6
+ constructor(options) {
7
+ super(options), this.type = "group-element", this.width = 0, this.height = 0, this.children = [],
8
+ this.direction = options.direction || "row", this.alignItems = options.alignItems || "start",
9
+ this.directionKey = DIRECTION_KEY[this.direction];
10
+ }
11
+ add(element) {
12
+ element.x = this.width, this.width += element.layoutWidth, this.children.push(element),
13
+ this.updateHeight(element), this.initLayoutSize();
14
+ }
15
+ updateHeight(element) {
16
+ element.layoutHeight > this.height && (this.height = element.layoutHeight);
17
+ }
18
+ getOffsetY(element) {
19
+ switch (this.alignItems) {
20
+ case "start":
21
+ default:
22
+ return 0;
23
+
24
+ case "center":
25
+ return (this[this.directionKey.height] - element[this.directionKey.layoutHeight]) / 2;
26
+
27
+ case "end":
28
+ return this[this.directionKey.height] - element[this.directionKey.layoutHeight];
29
+ }
30
+ }
31
+ getElements(parentPos = {
32
+ parentX: 0,
33
+ parentY: 0
34
+ }, isHover = !1, isSelect = !1) {
35
+ var _a, _b;
36
+ const elements = [];
37
+ for (let i = 0; i < this.children.length; i++) {
38
+ const element = this.children[i];
39
+ "icon" === element.type && ("mouseenter_cell" === (null === (_a = element.cache) || void 0 === _a ? void 0 : _a.visibleTime) && !isHover || "click_cell" === (null === (_b = element.cache) || void 0 === _b ? void 0 : _b.visibleTime) && !isSelect) || (element[this.directionKey.x] += this[this.directionKey.dx] + this[this.directionKey.x] + parentPos.parentX,
40
+ element[this.directionKey.y] += this.getOffsetY(element) + this[this.directionKey.dy] + this[this.directionKey.y] + parentPos.parentY,
41
+ elements.push(element));
42
+ }
43
+ return elements;
6
44
  }
7
45
  }
8
46
  //# sourceMappingURL=group-element.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["render/layout/group-element.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC,YAAY,MAAyB;QACnC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;CACF","file":"group-element.js","sourcesContent":["import type { IContainerOptions } from './container';\nimport { Container } from './container';\n\nexport class GroupElement extends Container {\n constructor(option: IContainerOptions) {\n option.flexWrap = 'nowrap';\n super(option);\n }\n}\n"]}
1
+ {"version":3,"sources":["render/layout/group-element.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQxC,MAAM,OAAO,YAAa,SAAQ,WAAW;IAS3C,YAAY,OAA4B;QACtC,KAAK,CAAC,OAAO,CAAC,CAAC;QATjB,SAAI,GAAoB,eAAe,CAAC;QAGxC,UAAK,GAAG,CAAC,CAAC;QACV,WAAM,GAAG,CAAC,CAAC;QACX,aAAQ,GAAkB,EAAE,CAAC;QAK3B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC;QAEhD,IAAI,CAAC,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAED,GAAG,CAAC,OAAoB;QACtB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,OAAoB;QAC/B,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE;YACtC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;SACpC;IACH,CAAC;IAED,UAAU,CAAC,OAAoB;QAC7B,QAAQ,IAAI,CAAC,UAAU,EAAE;YACvB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,CAAC,CAAC;gBAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC;YACxG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACxB;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","file":"group-element.js","sourcesContent":["import type { AlignItems, DirectionKey } from './direction';\nimport { DIRECTION_KEY } from './direction';\nimport type { ElementOptions } from './element';\nimport { BaseElement } from './element';\nimport type { Icon } from './icon';\n\ntype GroupElementOptions = {\n direction?: 'row' | 'column';\n alignItems?: AlignItems;\n} & ElementOptions;\n\nexport class GroupElement extends BaseElement {\n type: 'group-element' = 'group-element';\n direction: 'row' | 'column';\n alignItems?: AlignItems;\n width = 0;\n height = 0;\n children: BaseElement[] = [];\n directionKey: DirectionKey;\n\n constructor(options: GroupElementOptions) {\n super(options);\n this.direction = options.direction || 'row';\n this.alignItems = options.alignItems || 'start';\n\n this.directionKey = DIRECTION_KEY[this.direction];\n }\n\n add(element: BaseElement) {\n element.x = this.width;\n this.width += element.layoutWidth;\n this.children.push(element);\n this.updateHeight(element);\n this.initLayoutSize();\n }\n\n updateHeight(element: BaseElement) {\n if (element.layoutHeight > this.height) {\n this.height = element.layoutHeight;\n }\n }\n\n getOffsetY(element: BaseElement): number {\n switch (this.alignItems) {\n case 'start':\n return 0;\n case 'center':\n return (this[this.directionKey.height] - element[this.directionKey.layoutHeight]) / 2;\n case 'end':\n return this[this.directionKey.height] - element[this.directionKey.layoutHeight];\n default:\n return 0;\n }\n }\n\n // 获取平坦后的全部子图元,更新子图元xy位置信息\n getElements(\n parentPos: { parentX: number; parentY: number } = { parentX: 0, parentY: 0 },\n isHover = false,\n isSelect = false\n ) {\n const elements = [];\n for (let i = 0; i < this.children.length; i++) {\n const element = this.children[i];\n // element.getSize(table);\n // element.x = this.width;\n // this.width += element.layoutWidth;\n // this.updateHeight(element);\n\n if (\n element.type === 'icon' &&\n (((element as Icon).cache?.visibleTime === 'mouseenter_cell' && !isHover) ||\n ((element as Icon).cache?.visibleTime === 'click_cell' && !isSelect))\n ) {\n continue;\n }\n\n element[this.directionKey.x] += this[this.directionKey.dx] + this[this.directionKey.x] + parentPos.parentX;\n element[this.directionKey.y] +=\n this.getOffsetY(element) + this[this.directionKey.dy] + this[this.directionKey.y] + parentPos.parentY;\n elements.push(element);\n }\n\n return elements;\n }\n}\n"]}
@@ -1,21 +1,21 @@
1
- import type { IImageGraphicAttribute } from '@visactor/vrender';
2
- import { Image } from '@visactor/vrender';
1
+ import type { ElementOptions } from './element';
2
+ import { BaseElement } from './element';
3
3
  import type { ColumnIconOption } from '../../ts-types';
4
- type IIconOptions = {
4
+ type IconOptions = {
5
5
  width: number;
6
6
  height: number;
7
7
  svg?: string;
8
8
  iconName?: string;
9
- marginTop?: number;
10
- marginRight?: number;
11
- marginBottom?: number;
12
- marginLeft?: number;
13
- } & IImageGraphicAttribute;
14
- export declare class Icon extends Image {
9
+ } & ElementOptions;
10
+ export declare class Icon extends BaseElement {
15
11
  id: string;
12
+ type: 'icon';
13
+ width: number;
14
+ height: number;
16
15
  svg: string;
17
16
  iconName: string;
17
+ cursor?: string;
18
18
  cache?: ColumnIconOption;
19
- constructor(options: IIconOptions);
19
+ constructor(options: IconOptions);
20
20
  }
21
21
  export {};
@@ -1,21 +1,19 @@
1
- import { Image } from "@visactor/vrender";
1
+ import { isString } from "@visactor/vutils";
2
2
 
3
- import { isArray, isString } from "@visactor/vutils";
3
+ import { BaseElement } from "./element";
4
4
 
5
5
  import * as registerIcons from "../../icons";
6
6
 
7
- export class Icon extends Image {
7
+ export class Icon extends BaseElement {
8
8
  constructor(options) {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
10
- let cache;
11
- if (isString(options.iconName)) {
12
- cache = registerIcons.get()[options.iconName], cache && (options.width = null !== (_a = options.width) && void 0 !== _a ? _a : cache.width,
13
- options.height = null !== (_b = options.height) && void 0 !== _b ? _b : cache.height,
14
- options.svg = cache.svg, options.cursor = cache.cursor);
9
+ var _a, _b, _c;
10
+ if (super(options), this.type = "icon", this.iconName = options.iconName, isString(this.iconName)) {
11
+ const cache = registerIcons.get()[this.iconName];
12
+ cache && (this.cache = cache, this.width = cache.width, this.height = cache.height,
13
+ this.svg = cache.svg, this.cursor = cache.cursor);
15
14
  }
16
- options.svg && (options.image = options.svg);
17
- const isPaddingNumber = isArray(options.boundsPadding), padding = [ null !== (_d = null !== (_c = options.marginTop) && void 0 !== _c ? _c : isPaddingNumber ? options.boundsPadding[0] : options.boundsPadding) && void 0 !== _d ? _d : 0, null !== (_f = null !== (_e = options.marginRight) && void 0 !== _e ? _e : isPaddingNumber ? options.boundsPadding[1] : options.boundsPadding) && void 0 !== _f ? _f : 0, null !== (_j = null !== (_g = options.marginBottom) && void 0 !== _g ? _g : isPaddingNumber ? null !== (_h = options.boundsPadding[2]) && void 0 !== _h ? _h : options.boundsPadding[0] : options.boundsPadding) && void 0 !== _j ? _j : 0, null !== (_m = null !== (_k = options.marginLeft) && void 0 !== _k ? _k : isPaddingNumber ? null !== (_l = options.boundsPadding[3]) && void 0 !== _l ? _l : options.boundsPadding[1] : options.boundsPadding) && void 0 !== _m ? _m : 0 ];
18
- options.boundsPadding = padding, super(options), this.cache = cache;
15
+ this.width = null !== (_a = options.width) && void 0 !== _a ? _a : this.width, this.height = null !== (_b = options.height) && void 0 !== _b ? _b : this.height,
16
+ this.svg = null !== (_c = options.svg) && void 0 !== _c ? _c : this.svg, this.initLayoutSize();
19
17
  }
20
18
  }
21
19
  //# sourceMappingURL=icon.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["render/layout/icon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,QAAQ,E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AAA,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAChG,CAAC;YACH,MAAA,MAAA,OAAO,CAAC,UAAU,mCAChB,CAAC,eAAe,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,mCAAI,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,mCAChG,CAAC;SACJ,CAAC;QACF,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF","file":"icon.js","sourcesContent":["import type { IImageGraphicAttribute } from '@visactor/vrender';\nimport { Image } from '@visactor/vrender';\nimport { isArray, isString } from '@visactor/vutils';\nimport * as registerIcons from '../../icons';\nimport type { ColumnIconOption } from '../../ts-types';\n\ntype IIconOptions = {\n width: number;\n height: number;\n svg?: string;\n iconName?: string;\n marginTop?: number;\n marginRight?: number;\n marginBottom?: number;\n marginLeft?: number;\n} & IImageGraphicAttribute;\n\nexport class Icon extends Image {\n declare id: string;\n svg: string;\n iconName: string;\n cache?: ColumnIconOption;\n\n constructor(options: IIconOptions) {\n let cache;\n if (isString(options.iconName)) {\n const regedIcons = registerIcons.get();\n cache = regedIcons[options.iconName];\n if (cache) {\n options.width = options.width ?? cache.width;\n options.height = options.height ?? cache.height;\n options.svg = (cache as any).svg;\n options.cursor = (cache as any).cursor;\n }\n }\n if (options.svg) {\n options.image = options.svg;\n }\n\n const isPaddingNumber = isArray(options.boundsPadding);\n const padding = [\n options.marginTop ?? (isPaddingNumber ? options.boundsPadding[0] : options.boundsPadding) ?? 0,\n options.marginRight ?? (isPaddingNumber ? options.boundsPadding[1] : options.boundsPadding) ?? 0,\n options.marginBottom ??\n (isPaddingNumber ? options.boundsPadding[2] ?? options.boundsPadding[0] : options.boundsPadding) ??\n 0,\n options.marginLeft ??\n (isPaddingNumber ? options.boundsPadding[3] ?? options.boundsPadding[1] : options.boundsPadding) ??\n 0\n ];\n options.boundsPadding = padding;\n\n super(options);\n this.cache = cache;\n }\n}\n"]}
1
+ {"version":3,"sources":["render/layout/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,aAAa,MAAM,aAAa,CAAC;AAU7C,MAAM,OAAO,IAAK,SAAQ,WAAW;IAUnC,YAAY,OAAoB;;QAC9B,KAAK,CAAC,OAAO,CAAC,CAAC;QATjB,SAAI,GAAW,MAAM,CAAC;QAUpB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC3B,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxC,IAAI,KAAK,EAAE;gBACT,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;gBACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;gBACzB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;gBAC3B,IAAI,CAAC,GAAG,GAAI,KAAa,CAAC,GAAG,CAAC;gBAC9B,IAAI,CAAC,MAAM,GAAI,KAAa,CAAC,MAAM,CAAC;aACrC;SACF;QAGD,IAAI,CAAC,KAAK,GAAG,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI,CAAC,KAAK,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,CAAC,MAAM,CAAC;QAC5C,IAAI,CAAC,GAAG,GAAG,MAAA,OAAO,CAAC,GAAG,mCAAI,IAAI,CAAC,GAAG,CAAC;QAEnC,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;CACF","file":"icon.js","sourcesContent":["import { isString } from '@visactor/vutils';\nimport type { ElementOptions } from './element';\nimport { BaseElement } from './element';\nimport * as registerIcons from '../../icons';\nimport type { ColumnIconOption } from '../../ts-types';\n\ntype IconOptions = {\n width: number;\n height: number;\n svg?: string;\n iconName?: string;\n} & ElementOptions;\n\nexport class Icon extends BaseElement {\n declare id: string;\n type: 'icon' = 'icon';\n declare width: number;\n declare height: number;\n svg: string;\n iconName: string;\n cursor?: string;\n cache?: ColumnIconOption;\n\n constructor(options: IconOptions) {\n super(options);\n this.iconName = options.iconName;\n if (isString(this.iconName)) {\n const regedIcons = registerIcons.get();\n const cache = regedIcons[this.iconName];\n if (cache) {\n this.cache = cache;\n this.width = cache.width;\n this.height = cache.height;\n this.svg = (cache as any).svg;\n this.cursor = (cache as any).cursor;\n }\n }\n\n // options中的配置可以覆盖cache\n this.width = options.width ?? this.width;\n this.height = options.height ?? this.height;\n this.svg = options.svg ?? this.svg;\n\n this.initLayoutSize();\n }\n}\n"]}