@visactor/vtable 0.13.4-alpha.4 → 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 (67) hide show
  1. package/cjs/components/axis/get-axis-attributes.d.ts +0 -7
  2. package/cjs/components/axis/get-axis-attributes.js +17 -13
  3. package/cjs/components/axis/get-axis-attributes.js.map +1 -1
  4. package/cjs/components/legend/continue-legend/continue-legend.js +0 -1
  5. package/cjs/components/legend/continue-legend/continue-legend.js.map +1 -1
  6. package/cjs/components/legend/discrete-legend/discrete-legend.js +0 -1
  7. package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  8. package/cjs/components/title/title.js +6 -7
  9. package/cjs/components/title/title.js.map +1 -1
  10. package/cjs/core/BaseTable.js +1 -2
  11. package/cjs/core/BaseTable.js.map +1 -1
  12. package/cjs/dataset/dataset.d.ts +1 -0
  13. package/cjs/dataset/dataset.js +43 -3
  14. package/cjs/dataset/dataset.js.map +1 -1
  15. package/cjs/dataset/util/zero-align.js.map +1 -0
  16. package/cjs/index.d.ts +1 -1
  17. package/cjs/index.js +1 -1
  18. package/cjs/index.js.map +1 -1
  19. package/cjs/layout/chart-helper/get-axis-config.js +35 -71
  20. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  21. package/cjs/layout/chart-helper/get-axis-domain.d.ts +1 -1
  22. package/cjs/layout/chart-helper/get-axis-domain.js +8 -18
  23. package/cjs/layout/chart-helper/get-axis-domain.js.map +1 -1
  24. package/cjs/layout/chart-helper/get-chart-spec.js +17 -33
  25. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  26. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -2
  27. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  28. package/cjs/scenegraph/layout/update-height.js +4 -2
  29. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  30. package/dist/vtable.js +341 -387
  31. package/dist/vtable.min.js +2 -2
  32. package/es/components/axis/get-axis-attributes.d.ts +0 -7
  33. package/es/components/axis/get-axis-attributes.js +1 -1
  34. package/es/components/axis/get-axis-attributes.js.map +1 -1
  35. package/es/components/legend/continue-legend/continue-legend.js +0 -1
  36. package/es/components/legend/continue-legend/continue-legend.js.map +1 -1
  37. package/es/components/legend/discrete-legend/discrete-legend.js +0 -1
  38. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  39. package/es/components/title/title.js +6 -6
  40. package/es/components/title/title.js.map +1 -1
  41. package/es/core/BaseTable.js +1 -2
  42. package/es/core/BaseTable.js.map +1 -1
  43. package/es/dataset/dataset.d.ts +1 -0
  44. package/es/dataset/dataset.js +46 -2
  45. package/es/dataset/dataset.js.map +1 -1
  46. package/es/dataset/util/zero-align.js.map +1 -0
  47. package/es/index.d.ts +1 -1
  48. package/es/index.js +1 -1
  49. package/es/index.js.map +1 -1
  50. package/es/layout/chart-helper/get-axis-config.js +33 -72
  51. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  52. package/es/layout/chart-helper/get-axis-domain.d.ts +1 -1
  53. package/es/layout/chart-helper/get-axis-domain.js +8 -20
  54. package/es/layout/chart-helper/get-axis-domain.js.map +1 -1
  55. package/es/layout/chart-helper/get-chart-spec.js +12 -33
  56. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  57. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -2
  58. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  59. package/es/scenegraph/layout/update-height.js +4 -2
  60. package/es/scenegraph/layout/update-height.js.map +1 -1
  61. package/package.json +3 -3
  62. package/cjs/layout/chart-helper/zero-align.js.map +0 -1
  63. package/es/layout/chart-helper/zero-align.js.map +0 -1
  64. /package/cjs/{layout/chart-helper → dataset/util}/zero-align.d.ts +0 -0
  65. /package/cjs/{layout/chart-helper → dataset/util}/zero-align.js +0 -0
  66. /package/es/{layout/chart-helper → dataset/util}/zero-align.d.ts +0 -0
  67. /package/es/{layout/chart-helper → dataset/util}/zero-align.js +0 -0
@@ -1,13 +1,6 @@
1
1
  import type { ICellAxisOption } from '../../ts-types/component/axis';
2
2
  export declare const DEFAULT_TEXT_FONT_FAMILY = "PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";
3
3
  export declare const DEFAULT_TEXT_FONT_SIZE = 14;
4
- export declare const THEME_CONSTANTS: {
5
- FONT_FAMILY: string;
6
- LABEL_FONT_SIZE: number;
7
- MAP_LABEL_FONT_SIZE: number;
8
- TITLE_FONT_SIZE: number;
9
- AXIS_TICK_SIZE: number;
10
- };
11
4
  export declare const commonAxis: {
12
5
  domainLine: {
13
6
  visible: boolean;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.getAxisAttributes = exports.commonAxis = exports.THEME_CONSTANTS = exports.DEFAULT_TEXT_FONT_SIZE = exports.DEFAULT_TEXT_FONT_FAMILY = void 0;
5
+ }), exports.getAxisAttributes = exports.commonAxis = exports.DEFAULT_TEXT_FONT_SIZE = exports.DEFAULT_TEXT_FONT_FAMILY = void 0;
6
6
 
7
7
  const vutils_1 = require("@visactor/vutils"), transform_1 = require("../util/transform"), DEFAULT_TITLE_STYLE = {
8
8
  left: {
@@ -17,6 +17,17 @@ const vutils_1 = require("@visactor/vutils"), transform_1 = require("../util/tra
17
17
  angle: {}
18
18
  };
19
19
 
20
+ exports.DEFAULT_TEXT_FONT_FAMILY = "PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",
21
+ exports.DEFAULT_TEXT_FONT_SIZE = 14;
22
+
23
+ const THEME_CONSTANTS = {
24
+ FONT_FAMILY: exports.DEFAULT_TEXT_FONT_FAMILY,
25
+ LABEL_FONT_SIZE: exports.DEFAULT_TEXT_FONT_SIZE,
26
+ MAP_LABEL_FONT_SIZE: 10,
27
+ TITLE_FONT_SIZE: 18,
28
+ AXIS_TICK_SIZE: 4
29
+ };
30
+
20
31
  function getAxisAttributes(option) {
21
32
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
22
33
  const spec = (0, vutils_1.merge)({}, option);
@@ -96,14 +107,7 @@ function getAxisAttributes(option) {
96
107
  };
97
108
  }
98
109
 
99
- exports.DEFAULT_TEXT_FONT_FAMILY = "PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",
100
- exports.DEFAULT_TEXT_FONT_SIZE = 14, exports.THEME_CONSTANTS = {
101
- FONT_FAMILY: exports.DEFAULT_TEXT_FONT_FAMILY,
102
- LABEL_FONT_SIZE: exports.DEFAULT_TEXT_FONT_SIZE,
103
- MAP_LABEL_FONT_SIZE: 10,
104
- TITLE_FONT_SIZE: 18,
105
- AXIS_TICK_SIZE: 4
106
- }, exports.commonAxis = {
110
+ exports.commonAxis = {
107
111
  domainLine: {
108
112
  visible: !0,
109
113
  style: {
@@ -132,7 +136,7 @@ exports.DEFAULT_TEXT_FONT_SIZE = 14, exports.THEME_CONSTANTS = {
132
136
  },
133
137
  tick: {
134
138
  visible: !0,
135
- tickSize: exports.THEME_CONSTANTS.AXIS_TICK_SIZE,
139
+ tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE,
136
140
  style: {
137
141
  lineWidth: 1,
138
142
  stroke: "#D9DDE4",
@@ -141,7 +145,7 @@ exports.DEFAULT_TEXT_FONT_SIZE = 14, exports.THEME_CONSTANTS = {
141
145
  },
142
146
  subTick: {
143
147
  visible: !1,
144
- tickSize: exports.THEME_CONSTANTS.AXIS_TICK_SIZE / 2,
148
+ tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE / 2,
145
149
  style: {
146
150
  lineWidth: 1,
147
151
  stroke: "#D9DDE4",
@@ -152,7 +156,7 @@ exports.DEFAULT_TEXT_FONT_SIZE = 14, exports.THEME_CONSTANTS = {
152
156
  visible: !0,
153
157
  space: 1,
154
158
  style: {
155
- fontSize: exports.THEME_CONSTANTS.LABEL_FONT_SIZE,
159
+ fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,
156
160
  fill: "#89909D",
157
161
  fontWeight: "normal",
158
162
  fillOpacity: 1
@@ -161,7 +165,7 @@ exports.DEFAULT_TEXT_FONT_SIZE = 14, exports.THEME_CONSTANTS = {
161
165
  title: {
162
166
  space: 10,
163
167
  style: {
164
- fontSize: exports.THEME_CONSTANTS.LABEL_FONT_SIZE,
168
+ fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,
165
169
  fill: "#333333",
166
170
  fontWeight: "normal",
167
171
  fillOpacity: 1
@@ -1 +1 @@
1
- {"version":3,"sources":["components/axis/get-axis-attributes.ts"],"names":[],"mappings":";;;AAAA,6CAA6E;AAC7E,iDAAoG;AAGpG,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE;QACJ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACV,CAAC;AAEW,QAAA,wBAAwB,GAEnC,kJAAkJ,CAAC;AAExI,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAE5B,QAAA,eAAe,GAAG;IAC7B,WAAW,EAAE,gCAAwB;IACrC,eAAe,EAAE,8BAAsB;IACvC,mBAAmB,EAAE,EAAE;IACvB,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,CAAC;CAClB,CAAC;AAEW,QAAA,UAAU,GAAG;IACxB,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE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AE,MAAA,IAAI,CAAC,UAAU,0CAAE,OAAO;YACjC,KAAK,EAAE,IAAA,8BAAkB,EAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;YACjD,KAAK,EAAE,IAAA,+BAAmB,EAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;SACnD;KACF,CAAC;AACJ,CAAC;AAjHD,8CAiHC","file":"get-axis-attributes.js","sourcesContent":["import { degreeToRadian, isNil, merge, pickWithout } from '@visactor/vutils';\nimport { transformAxisLineStyle, transformStateStyle, transformToGraphic } from '../util/transform';\nimport type { ICellAxisOption } from '../../ts-types/component/axis';\n\nconst DEFAULT_TITLE_STYLE = {\n left: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n right: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n radius: {},\n angle: {}\n};\n\nexport const DEFAULT_TEXT_FONT_FAMILY =\n // eslint-disable-next-line max-len\n 'PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol';\n\nexport const DEFAULT_TEXT_FONT_SIZE = 14;\n\nexport const THEME_CONSTANTS = {\n FONT_FAMILY: DEFAULT_TEXT_FONT_FAMILY,\n LABEL_FONT_SIZE: DEFAULT_TEXT_FONT_SIZE,\n MAP_LABEL_FONT_SIZE: 10,\n TITLE_FONT_SIZE: 18,\n AXIS_TICK_SIZE: 4\n};\n\nexport const commonAxis = {\n domainLine: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n grid: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#EBEDF2',\n strokeOpacity: 1,\n lineDash: [] as any[]\n }\n },\n subGrid: {\n visible: false,\n style: {\n lineWidth: 1,\n stroke: '#EBEDF2',\n strokeOpacity: 1,\n lineDash: [4, 4]\n }\n },\n tick: {\n visible: true,\n tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE / 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n label: {\n visible: true,\n space: 1, // hack: VChart中为0,为了方便fs调试暂时改为1\n style: {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,\n fill: '#89909D',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n title: {\n space: 10,\n style: {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n }\n};\n\nexport function getAxisAttributes(option: ICellAxisOption) {\n const spec = merge({}, option);\n // const spec = option;\n let titleAngle = spec.title?.angle ?? 0;\n let titleTextStyle;\n if (spec.orient === 'left' || spec.orient === 'right') {\n // 处理纵轴的标题样式\n if (spec.title?.autoRotate && isNil(spec.title.angle)) {\n titleAngle = spec.orient === 'left' ? -90 : 90;\n titleTextStyle = DEFAULT_TITLE_STYLE[spec.orient];\n }\n }\n\n const labelSpec = pickWithout(spec.label, ['style', 'formatMethod', 'state']);\n\n return {\n orient: spec.orient,\n select: spec.select,\n hover: spec.hover,\n line: transformAxisLineStyle(spec.domainLine),\n label: {\n style:\n // isFunction(spec.label.style)\n // ? (datum: Datum, index: number) => {\n // const style = this._preprocessSpec(spec.label.style(datum.rawValue, index, datum));\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.label?.style, style)));\n // }\n // :\n transformToGraphic(spec.label.style),\n formatMethod: spec.label.formatMethod\n ? (value: any, datum: any, index: number) => {\n return spec.label.formatMethod(datum.rawValue, datum);\n }\n : null,\n state: transformStateStyle(spec.label.state),\n ...labelSpec\n },\n tick: {\n visible: spec.tick.visible,\n length: spec.tick.tickSize,\n inside: spec.tick.inside,\n alignWithLabel: spec.tick.alignWithLabel,\n style:\n // isFunction(spec.tick.style)\n // ? (datum: Datum, index: number) => {\n // const style = this._preprocessSpec(spec.tick.style(datum.rawValue, index, datum));\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.tick?.style, style)));\n // }\n // :\n transformToGraphic(spec.tick.style),\n state: transformStateStyle(spec.tick.state),\n dataFilter: spec.tick.dataFilter\n },\n subTick: {\n visible: spec.subTick.visible,\n length: spec.subTick.tickSize,\n inside: spec.subTick.inside,\n count: spec.subTick.tickCount,\n style: transformToGraphic(spec.subTick.style),\n state: transformStateStyle(spec.subTick.state)\n },\n grid: {\n type: 'line',\n visible: spec.grid.visible,\n alternateColor: spec.grid.alternateColor,\n alignWithLabel: spec.grid.alignWithLabel,\n style:\n // isFunction(spec.grid.style)\n // ? (datum: Datum, index: number) => {\n // const style = spec.grid.style(datum.datum?.rawValue, index, datum.datum);\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.grid?.style, style)));\n // }\n // :\n transformToGraphic(spec.grid.style)\n },\n subGrid: {\n type: 'line',\n visible: spec.subGrid.visible,\n alternateColor: spec.subGrid.alternateColor,\n style: transformToGraphic(spec.subGrid.style)\n },\n title: {\n visible: spec.title.visible,\n position: spec.title.position,\n space: spec.title.space,\n autoRotate: false, // 默认不对外提供该配置\n angle: titleAngle ? degreeToRadian(titleAngle) : null,\n textStyle: merge({}, titleTextStyle, transformToGraphic(spec.title.style)),\n padding: spec.title.padding,\n shape: {\n visible: spec.title.shape?.visible,\n space: spec.title.shape?.space,\n style: transformToGraphic(spec.title.shape?.style)\n },\n background: {\n visible: spec.title.background?.visible,\n style: transformToGraphic(spec.title.background?.style)\n },\n state: {\n text: transformStateStyle(spec.title.state),\n shape: transformStateStyle(spec.title.shape?.state),\n background: transformStateStyle(spec.title.background?.state)\n }\n },\n panel: {\n visible: spec.background?.visible,\n style: transformToGraphic(spec.background?.style),\n state: transformStateStyle(spec.background?.state)\n }\n };\n}\n"]}
1
+ {"version":3,"sources":["components/axis/get-axis-attributes.ts"],"names":[],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CAAE,OAAO;gBAClC,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,KAAK;gBAC9B,KAAK,EAAE,IAAA,8BAAkB,EAAC,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,KAAK,CAAC;aACnD;YACD,UAAU,EAAE;gBACV,OAAO,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,UAAU,0CAAE,OAAO;gBACvC,KAAK,EAAE,IAAA,8BAAkB,EAAC,MAAA,IAAI,CAAC,KAAK,CAAC,UAAU,0CAAE,KAAK,CAAC;aACxD;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,IAAA,+BAAmB,EAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;gBAC3C,KAAK,EAAE,IAAA,+BAAmB,EAAC,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,KAAK,CAAC;gBACnD,UAAU,EAAE,IAAA,+BAAmB,EAAC,MAAA,IAAI,CAAC,KAAK,CAAC,UAAU,0CAAE,KAAK,CAAC;aAC9D;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,OAAO;YACjC,KAAK,EAAE,IAAA,8BAAkB,EAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;YACjD,KAAK,EAAE,IAAA,+BAAmB,EAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;SACnD;KACF,CAAC;AACJ,CAAC;AAjHD,8CAiHC","file":"get-axis-attributes.js","sourcesContent":["import { degreeToRadian, isNil, merge, pickWithout } from '@visactor/vutils';\nimport { transformAxisLineStyle, transformStateStyle, transformToGraphic } from '../util/transform';\nimport type { ICellAxisOption } from '../../ts-types/component/axis';\n\nconst DEFAULT_TITLE_STYLE = {\n left: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n right: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n radius: {},\n angle: {}\n};\n\nexport const DEFAULT_TEXT_FONT_FAMILY =\n // eslint-disable-next-line max-len\n 'PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol';\n\nexport const DEFAULT_TEXT_FONT_SIZE = 14;\n\nconst THEME_CONSTANTS = {\n FONT_FAMILY: DEFAULT_TEXT_FONT_FAMILY,\n LABEL_FONT_SIZE: DEFAULT_TEXT_FONT_SIZE,\n MAP_LABEL_FONT_SIZE: 10,\n TITLE_FONT_SIZE: 18,\n AXIS_TICK_SIZE: 4\n};\n\nexport const commonAxis = {\n domainLine: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n grid: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#EBEDF2',\n strokeOpacity: 1,\n lineDash: [] as any[]\n }\n },\n subGrid: {\n visible: false,\n style: {\n lineWidth: 1,\n stroke: '#EBEDF2',\n strokeOpacity: 1,\n lineDash: [4, 4]\n }\n },\n tick: {\n visible: true,\n tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE / 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n label: {\n visible: true,\n space: 1, // hack: VChart中为0,为了方便fs调试暂时改为1\n style: {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,\n fill: '#89909D',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n title: {\n space: 10,\n style: {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n }\n};\n\nexport function getAxisAttributes(option: ICellAxisOption) {\n const spec = merge({}, option);\n // const spec = option;\n let titleAngle = spec.title?.angle ?? 0;\n let titleTextStyle;\n if (spec.orient === 'left' || spec.orient === 'right') {\n // 处理纵轴的标题样式\n if (spec.title?.autoRotate && isNil(spec.title.angle)) {\n titleAngle = spec.orient === 'left' ? -90 : 90;\n titleTextStyle = DEFAULT_TITLE_STYLE[spec.orient];\n }\n }\n\n const labelSpec = pickWithout(spec.label, ['style', 'formatMethod', 'state']);\n\n return {\n orient: spec.orient,\n select: spec.select,\n hover: spec.hover,\n line: transformAxisLineStyle(spec.domainLine),\n label: {\n style:\n // isFunction(spec.label.style)\n // ? (datum: Datum, index: number) => {\n // const style = this._preprocessSpec(spec.label.style(datum.rawValue, index, datum));\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.label?.style, style)));\n // }\n // :\n transformToGraphic(spec.label.style),\n formatMethod: spec.label.formatMethod\n ? (value: any, datum: any, index: number) => {\n return spec.label.formatMethod(datum.rawValue, datum);\n }\n : null,\n state: transformStateStyle(spec.label.state),\n ...labelSpec\n },\n tick: {\n visible: spec.tick.visible,\n length: spec.tick.tickSize,\n inside: spec.tick.inside,\n alignWithLabel: spec.tick.alignWithLabel,\n style:\n // isFunction(spec.tick.style)\n // ? (datum: Datum, index: number) => {\n // const style = this._preprocessSpec(spec.tick.style(datum.rawValue, index, datum));\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.tick?.style, style)));\n // }\n // :\n transformToGraphic(spec.tick.style),\n state: transformStateStyle(spec.tick.state),\n dataFilter: spec.tick.dataFilter\n },\n subTick: {\n visible: spec.subTick.visible,\n length: spec.subTick.tickSize,\n inside: spec.subTick.inside,\n count: spec.subTick.tickCount,\n style: transformToGraphic(spec.subTick.style),\n state: transformStateStyle(spec.subTick.state)\n },\n grid: {\n type: 'line',\n visible: spec.grid.visible,\n alternateColor: spec.grid.alternateColor,\n alignWithLabel: spec.grid.alignWithLabel,\n style:\n // isFunction(spec.grid.style)\n // ? (datum: Datum, index: number) => {\n // const style = spec.grid.style(datum.datum?.rawValue, index, datum.datum);\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.grid?.style, style)));\n // }\n // :\n transformToGraphic(spec.grid.style)\n },\n subGrid: {\n type: 'line',\n visible: spec.subGrid.visible,\n alternateColor: spec.subGrid.alternateColor,\n style: transformToGraphic(spec.subGrid.style)\n },\n title: {\n visible: spec.title.visible,\n position: spec.title.position,\n space: spec.title.space,\n autoRotate: false, // 默认不对外提供该配置\n angle: titleAngle ? degreeToRadian(titleAngle) : null,\n textStyle: merge({}, titleTextStyle, transformToGraphic(spec.title.style)),\n padding: spec.title.padding,\n shape: {\n visible: spec.title.shape?.visible,\n space: spec.title.shape?.space,\n style: transformToGraphic(spec.title.shape?.style)\n },\n background: {\n visible: spec.title.background?.visible,\n style: transformToGraphic(spec.title.background?.style)\n },\n state: {\n text: transformStateStyle(spec.title.state),\n shape: transformStateStyle(spec.title.shape?.state),\n background: transformStateStyle(spec.title.background?.state)\n }\n },\n panel: {\n visible: spec.background?.visible,\n style: transformToGraphic(spec.background?.style),\n state: transformStateStyle(spec.background?.state)\n }\n };\n}\n"]}
@@ -37,7 +37,6 @@ class ContinueTableLegend {
37
37
  adjustTableSize(attrs) {
38
38
  var _a, _b;
39
39
  let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0, height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;
40
- if (width <= 0 || height <= 0) return;
41
40
  const rectWidth = this.table.tableNoFrameWidth, rectHeight = this.table.tableNoFrameHeight, padding = (0,
42
41
  padding_1.getQuadProps)(null !== (_b = null !== (_a = attrs.padding) && void 0 !== _a ? _a : this.option.padding) && void 0 !== _b ? _b : 10);
43
42
  let x = 0, y = 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/legend/continue-legend/continue-legend.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAGzD,qEAAwG;AACxG,qFAAiF;AACjF,qEAAkE;AAClE,+DAAiE;AAGjE,MAAa,mBAAmB;IAS9B,YAAY,MAA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AAC,QAAQ,EAAE,CAAC,CAAM,EAAE,EAAE;gBACzD,MAAM,YAAY,GAAG,IAAA,YAAG,EAAC,CAAC,EAAE,cAAc,CAAC,CAAC;gBAC5C,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,mCAAgB,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;gBACzG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;YAC1C,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,eAAe;QACb,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9G,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjH,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;SACf,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AArLD,kDAqLC","file":"continue-legend.js","sourcesContent":["import { cloneDeep, get, merge } from '@visactor/vutils';\nimport type { IColorTableLegendOption, ISizeTableLegendOption } from '../../../ts-types/component/legend';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { ColorContinuousLegend, SizeContinuousLegend, LegendEvent } from '@visactor/vrender-components';\nimport { getContinuousLegendAttributes } from './get-continue-legend-attributes';\nimport { TABLE_EVENT_TYPE } from '../../../core/TABLE_EVENT_TYPE';\nimport { getQuadProps } from '../../../scenegraph/utils/padding';\nimport type { IOrientType } from '../../../ts-types/component/util';\n\nexport class ContinueTableLegend {\n table: BaseTableAPI;\n option: IColorTableLegendOption | ISizeTableLegendOption;\n orient: IOrientType;\n visible: boolean;\n position: 'start' | 'middle' | 'end';\n selectedData: (string | number)[];\n legendComponent: ColorContinuousLegend | SizeContinuousLegend;\n\n constructor(option: IColorTableLegendOption | ISizeTableLegendOption, table: BaseTableAPI) {\n this.table = table;\n this.option = cloneDeep(option);\n this.orient = option.orient ?? 'left';\n this.visible = option.visible ?? true;\n this.position = option.position ?? 'middle';\n this.selectedData = option.defaultSelected ?? [];\n\n this.createComponent();\n this.initEvent();\n }\n\n createComponent() {\n const attrs = this.getLegendAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n let legend;\n if (this.option.type === 'color') {\n legend = new ColorContinuousLegend(\n merge({}, attrs, {\n slidable: true\n // defaultSelected: this.selectedData\n })\n );\n } else {\n legend = new SizeContinuousLegend(\n merge({}, attrs, {\n slidable: true\n // defaultSelected: this.selectedData\n })\n );\n }\n legend.name = 'legend';\n this.legendComponent = legend;\n this.table.scenegraph.stage.defaultLayer.appendChild(legend);\n\n this.adjustTableSize(attrs);\n }\n\n resize() {\n if (!this.legendComponent) {\n return;\n }\n\n this.legendComponent.setAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n this.adjustTableSize(this.legendComponent.attribute);\n }\n\n adjustTableSize(attrs: any) {\n // 调整位置\n let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n if (width <= 0 || height <= 0) {\n return;\n }\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this.orient === 'left') {\n x = padding[3];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'top') {\n x = 0;\n y = padding[0];\n height += padding[0] + padding[2];\n } else if (this.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n height += padding[0] + padding[2];\n }\n\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const position = this.position;\n // const { width: rectWidth, height: rectHeight } = fullSpace;\n let offsetX = 0;\n let offsetY = 0;\n if (layout === 'horizontal') {\n if (position === 'middle') {\n offsetX = (rectWidth - width) / 2;\n } else if (position === 'end') {\n offsetX = rectWidth - width - padding[1];\n } else {\n offsetX = padding[3];\n }\n } else {\n if (position === 'middle') {\n offsetY = (rectHeight - height) / 2;\n } else if (position === 'end') {\n offsetY = rectHeight - height - padding[2];\n } else {\n offsetY = padding[0];\n }\n }\n\n this.legendComponent.setAttributes({\n dx: offsetX,\n dy: offsetY,\n x,\n y\n });\n\n // update table size\n if (this.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n }\n\n getLegendAttributes(rect: any) {\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const align = layout === 'horizontal' ? 'bottom' : this.orient;\n\n const attrs = {\n ...getContinuousLegendAttributes(this.option, rect),\n layout,\n align,\n // zIndex: this.layoutZIndex,\n min: this.option.min,\n max: this.option.max,\n value: this.option.value,\n [this.option.type === 'color' ? 'colors' : 'sizeRange']:\n this.option.type === 'color'\n ? (this.option as IColorTableLegendOption).colors\n : (this.option as ISizeTableLegendOption).sizeRange\n };\n return attrs;\n }\n\n initEvent() {\n if (this.legendComponent) {\n this.legendComponent.addEventListener('change', (e: any) => {\n const selectedData = get(e, 'detail.value');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_CHANGE, { model: this, value: selectedData, event: e });\n this.table.scenegraph.updateNextFrame();\n });\n }\n }\n\n getLegendBounds() {\n const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n\n return {\n width: width,\n height: height\n };\n }\n release() {\n this.legendComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);\n this.legendComponent = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["components/legend/continue-legend/continue-legend.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAGzD,qEAAwG;AACxG,qFAAiF;AACjF,qEAAkE;AAClE,+DAAiE;AAGjE,MAAa,mBAAmB;IAS9B,YAAY,MAAwD,EAAE,KAAmB;;QACvF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAA,kBAAS,EAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAI,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAA,MAAM,CAAC,QAAQ,mCAAI,QAAQ,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,MAAA,MAAM,CAAC,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AC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9G,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjH,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;SACf,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AAlLD,kDAkLC","file":"continue-legend.js","sourcesContent":["import { cloneDeep, get, merge } from '@visactor/vutils';\nimport type { IColorTableLegendOption, ISizeTableLegendOption } from '../../../ts-types/component/legend';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { ColorContinuousLegend, SizeContinuousLegend, LegendEvent } from '@visactor/vrender-components';\nimport { getContinuousLegendAttributes } from './get-continue-legend-attributes';\nimport { TABLE_EVENT_TYPE } from '../../../core/TABLE_EVENT_TYPE';\nimport { getQuadProps } from '../../../scenegraph/utils/padding';\nimport type { IOrientType } from '../../../ts-types/component/util';\n\nexport class ContinueTableLegend {\n table: BaseTableAPI;\n option: IColorTableLegendOption | ISizeTableLegendOption;\n orient: IOrientType;\n visible: boolean;\n position: 'start' | 'middle' | 'end';\n selectedData: (string | number)[];\n legendComponent: ColorContinuousLegend | SizeContinuousLegend;\n\n constructor(option: IColorTableLegendOption | ISizeTableLegendOption, table: BaseTableAPI) {\n this.table = table;\n this.option = cloneDeep(option);\n this.orient = option.orient ?? 'left';\n this.visible = option.visible ?? true;\n this.position = option.position ?? 'middle';\n this.selectedData = option.defaultSelected ?? [];\n\n this.createComponent();\n this.initEvent();\n }\n\n createComponent() {\n const attrs = this.getLegendAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n let legend;\n if (this.option.type === 'color') {\n legend = new ColorContinuousLegend(\n merge({}, attrs, {\n slidable: true\n // defaultSelected: this.selectedData\n })\n );\n } else {\n legend = new SizeContinuousLegend(\n merge({}, attrs, {\n slidable: true\n // defaultSelected: this.selectedData\n })\n );\n }\n legend.name = 'legend';\n this.legendComponent = legend;\n this.table.scenegraph.stage.defaultLayer.appendChild(legend);\n\n this.adjustTableSize(attrs);\n }\n\n resize() {\n if (!this.legendComponent) {\n return;\n }\n\n this.legendComponent.setAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n this.adjustTableSize(this.legendComponent.attribute);\n }\n\n adjustTableSize(attrs: any) {\n // 调整位置\n let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this.orient === 'left') {\n x = padding[3];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'top') {\n x = 0;\n y = padding[0];\n height += padding[0] + padding[2];\n } else if (this.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n height += padding[0] + padding[2];\n }\n\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const position = this.position;\n // const { width: rectWidth, height: rectHeight } = fullSpace;\n let offsetX = 0;\n let offsetY = 0;\n if (layout === 'horizontal') {\n if (position === 'middle') {\n offsetX = (rectWidth - width) / 2;\n } else if (position === 'end') {\n offsetX = rectWidth - width - padding[1];\n } else {\n offsetX = padding[3];\n }\n } else {\n if (position === 'middle') {\n offsetY = (rectHeight - height) / 2;\n } else if (position === 'end') {\n offsetY = rectHeight - height - padding[2];\n } else {\n offsetY = padding[0];\n }\n }\n\n this.legendComponent.setAttributes({\n dx: offsetX,\n dy: offsetY,\n x,\n y\n });\n\n // update table size\n if (this.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n }\n\n getLegendAttributes(rect: any) {\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const align = layout === 'horizontal' ? 'bottom' : this.orient;\n\n const attrs = {\n ...getContinuousLegendAttributes(this.option, rect),\n layout,\n align,\n // zIndex: this.layoutZIndex,\n min: this.option.min,\n max: this.option.max,\n value: this.option.value,\n [this.option.type === 'color' ? 'colors' : 'sizeRange']:\n this.option.type === 'color'\n ? (this.option as IColorTableLegendOption).colors\n : (this.option as ISizeTableLegendOption).sizeRange\n };\n return attrs;\n }\n\n initEvent() {\n if (this.legendComponent) {\n this.legendComponent.addEventListener('change', (e: any) => {\n const selectedData = get(e, 'detail.value');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_CHANGE, { model: this, value: selectedData, event: e });\n this.table.scenegraph.updateNextFrame();\n });\n }\n }\n\n getLegendBounds() {\n const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n\n return {\n width: width,\n height: height\n };\n }\n release() {\n this.legendComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);\n this.legendComponent = null;\n }\n}\n"]}
@@ -33,7 +33,6 @@ class DiscreteTableLegend {
33
33
  adjustTableSize(attrs) {
34
34
  var _a, _b;
35
35
  let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0, height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;
36
- if (width <= 0 || height <= 0) return;
37
36
  const rectWidth = this.table.tableNoFrameWidth, rectHeight = this.table.tableNoFrameHeight, padding = (0,
38
37
  padding_1.getQuadProps)(null !== (_b = null !== (_a = attrs.padding) && void 0 !== _a ? _a : this.option.padding) && void 0 !== _b ? _b : 10);
39
38
  let x = 0, y = 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["components/legend/discrete-legend/discrete-legend.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAGzD,qEAA2E;AAC3E,qFAAuE;AACvE,qEAAkE;AAClE,+DAAiE;AAGjE,MAAa,mBAAmB;IAS9B,YAAY,MAAkC,EAAE,KAAmB;;QACjE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAA,kBAAS,EAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAI,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAA,MAAM,CAAC,QAAQ,mCAAI,QAAQ,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,EAAE,CAAC;QAEjD,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,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GH,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,2BAA2B,EAAE,CAAC,CAAM,EAAE,EAAE;gBAC5E,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;YAC1C,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,eAAe;QACb,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9G,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjH,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;SACf,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AApLD,kDAoLC","file":"discrete-legend.js","sourcesContent":["import { cloneDeep, get, merge } from '@visactor/vutils';\nimport type { IDiscreteTableLegendOption } from '../../../ts-types/component/legend';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { DiscreteLegend, LegendEvent } from '@visactor/vrender-components';\nimport { getLegendAttributes } from './get-discrete-legend-attributes';\nimport { TABLE_EVENT_TYPE } from '../../../core/TABLE_EVENT_TYPE';\nimport { getQuadProps } from '../../../scenegraph/utils/padding';\nimport type { IOrientType } from '../../../ts-types/component/util';\n\nexport class DiscreteTableLegend {\n table: BaseTableAPI;\n option: IDiscreteTableLegendOption;\n orient: IOrientType;\n visible: boolean;\n position: 'start' | 'middle' | 'end';\n selectedData: (string | number)[];\n legendComponent: DiscreteLegend;\n\n constructor(option: IDiscreteTableLegendOption, table: BaseTableAPI) {\n this.table = table;\n this.option = cloneDeep(option);\n this.orient = option.orient ?? 'left';\n this.visible = option.visible ?? true;\n this.position = option.position ?? 'middle';\n this.selectedData = option.defaultSelected ?? [];\n\n this.createComponent();\n this.initEvent();\n }\n\n createComponent() {\n const attrs = this.getLegendAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n const legend = new DiscreteLegend(\n merge({}, attrs, {\n defaultSelected: this.selectedData\n })\n );\n legend.name = 'legend';\n this.legendComponent = legend;\n this.table.scenegraph.stage.defaultLayer.appendChild(legend);\n\n this.adjustTableSize(attrs);\n }\n\n resize() {\n if (!this.legendComponent) {\n return;\n }\n\n this.legendComponent.setAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n this.adjustTableSize(this.legendComponent.attribute);\n }\n\n adjustTableSize(attrs: any) {\n // 调整位置\n let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n if (width <= 0 || height <= 0) {\n return;\n }\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this.orient === 'left') {\n x = padding[3];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'top') {\n x = 0;\n y = padding[0];\n height += padding[0] + padding[2];\n } else if (this.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n height += padding[0] + padding[2];\n }\n\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const position = this.position;\n // const { width: rectWidth, height: rectHeight } = fullSpace;\n let offsetX = 0;\n let offsetY = 0;\n if (layout === 'horizontal') {\n if (position === 'middle') {\n offsetX = (rectWidth - width) / 2;\n } else if (position === 'end') {\n offsetX = rectWidth - width - padding[1];\n } else {\n offsetX = padding[3];\n }\n } else {\n if (position === 'middle') {\n offsetY = (rectHeight - height) / 2;\n } else if (position === 'end') {\n offsetY = rectHeight - height - padding[2];\n } else {\n offsetY = padding[0];\n }\n }\n\n this.legendComponent.setAttributes({\n dx: offsetX,\n dy: offsetY,\n x,\n y\n });\n\n // update table size\n if (this.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n }\n\n getLegendAttributes(rect: any) {\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const attrs = {\n layout,\n items: this.getLegendItems(),\n // zIndex: this.layoutZIndex,\n maxWidth: rect.width,\n maxHeight: rect.height,\n ...getLegendAttributes(this.option, rect)\n };\n return attrs;\n }\n\n getLegendItems() {\n return this.option.data;\n }\n\n initEvent() {\n if (this.legendComponent) {\n this.legendComponent.addEventListener(LegendEvent.legendItemClick, (e: any) => {\n const selectedData = get(e, 'detail.currentSelected');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_CLICK, { model: this, value: selectedData, event: e });\n });\n\n this.legendComponent.addEventListener(LegendEvent.legendItemHover, (e: any) => {\n const detail = get(e, 'detail');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_HOVER, { model: this, value: detail, event: e });\n });\n\n this.legendComponent.addEventListener(LegendEvent.legendItemUnHover, (e: any) => {\n const detail = get(e, 'detail');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_UNHOVER, { model: this, value: detail, event: e });\n });\n\n // wait for vrender-vcomponent version update\n this.legendComponent.addEventListener('legendItemAttributeUpdate', (e: any) => {\n this.table.scenegraph.updateNextFrame();\n });\n }\n }\n\n getLegendBounds() {\n const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n\n return {\n width: width,\n height: height\n };\n }\n release() {\n this.legendComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);\n this.legendComponent = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["components/legend/discrete-legend/discrete-legend.ts"],"names":[],"mappings":";;;AAAA,6CAAyD;AAGzD,qEAA2E;AAC3E,qFAAuE;AACvE,qEAAkE;AAClE,+DAAiE;AAGjE,MAAa,mBAAmB;IAS9B,YAAY,MAAkC,EAAE,KAAmB;;QACjE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,IAAA,kBAAS,EAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAI,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAA,MAAM,CAAC,QAAQ,mCAAI,QAAQ,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,MAAA,MAAM,CAAC,eAAe,mCAAI,EAAE,CAAC;QAEjD,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED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K,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;YAC1C,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,eAAe;QACb,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9G,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjH,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;SACf,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AAjLD,kDAiLC","file":"discrete-legend.js","sourcesContent":["import { cloneDeep, get, merge } from '@visactor/vutils';\nimport type { IDiscreteTableLegendOption } from '../../../ts-types/component/legend';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { DiscreteLegend, LegendEvent } from '@visactor/vrender-components';\nimport { getLegendAttributes } from './get-discrete-legend-attributes';\nimport { TABLE_EVENT_TYPE } from '../../../core/TABLE_EVENT_TYPE';\nimport { getQuadProps } from '../../../scenegraph/utils/padding';\nimport type { IOrientType } from '../../../ts-types/component/util';\n\nexport class DiscreteTableLegend {\n table: BaseTableAPI;\n option: IDiscreteTableLegendOption;\n orient: IOrientType;\n visible: boolean;\n position: 'start' | 'middle' | 'end';\n selectedData: (string | number)[];\n legendComponent: DiscreteLegend;\n\n constructor(option: IDiscreteTableLegendOption, table: BaseTableAPI) {\n this.table = table;\n this.option = cloneDeep(option);\n this.orient = option.orient ?? 'left';\n this.visible = option.visible ?? true;\n this.position = option.position ?? 'middle';\n this.selectedData = option.defaultSelected ?? [];\n\n this.createComponent();\n this.initEvent();\n }\n\n createComponent() {\n const attrs = this.getLegendAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n const legend = new DiscreteLegend(\n merge({}, attrs, {\n defaultSelected: this.selectedData\n })\n );\n legend.name = 'legend';\n this.legendComponent = legend;\n this.table.scenegraph.stage.defaultLayer.appendChild(legend);\n\n this.adjustTableSize(attrs);\n }\n\n resize() {\n if (!this.legendComponent) {\n return;\n }\n\n this.legendComponent.setAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n this.adjustTableSize(this.legendComponent.attribute);\n }\n\n adjustTableSize(attrs: any) {\n // 调整位置\n let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this.orient === 'left') {\n x = padding[3];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'top') {\n x = 0;\n y = padding[0];\n height += padding[0] + padding[2];\n } else if (this.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n height += padding[0] + padding[2];\n }\n\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const position = this.position;\n // const { width: rectWidth, height: rectHeight } = fullSpace;\n let offsetX = 0;\n let offsetY = 0;\n if (layout === 'horizontal') {\n if (position === 'middle') {\n offsetX = (rectWidth - width) / 2;\n } else if (position === 'end') {\n offsetX = rectWidth - width - padding[1];\n } else {\n offsetX = padding[3];\n }\n } else {\n if (position === 'middle') {\n offsetY = (rectHeight - height) / 2;\n } else if (position === 'end') {\n offsetY = rectHeight - height - padding[2];\n } else {\n offsetY = padding[0];\n }\n }\n\n this.legendComponent.setAttributes({\n dx: offsetX,\n dy: offsetY,\n x,\n y\n });\n\n // update table size\n if (this.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n }\n\n getLegendAttributes(rect: any) {\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const attrs = {\n layout,\n items: this.getLegendItems(),\n // zIndex: this.layoutZIndex,\n maxWidth: rect.width,\n maxHeight: rect.height,\n ...getLegendAttributes(this.option, rect)\n };\n return attrs;\n }\n\n getLegendItems() {\n return this.option.data;\n }\n\n initEvent() {\n if (this.legendComponent) {\n this.legendComponent.addEventListener(LegendEvent.legendItemClick, (e: any) => {\n const selectedData = get(e, 'detail.currentSelected');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_CLICK, { model: this, value: selectedData, event: e });\n });\n\n this.legendComponent.addEventListener(LegendEvent.legendItemHover, (e: any) => {\n const detail = get(e, 'detail');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_HOVER, { model: this, value: detail, event: e });\n });\n\n this.legendComponent.addEventListener(LegendEvent.legendItemUnHover, (e: any) => {\n const detail = get(e, 'detail');\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_UNHOVER, { model: this, value: detail, event: e });\n });\n\n // wait for vrender-vcomponent version update\n this.legendComponent.addEventListener('legendItemAttributeUpdate', (e: any) => {\n this.table.scenegraph.updateNextFrame();\n });\n }\n }\n\n getLegendBounds() {\n const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n\n return {\n width: width,\n height: height\n };\n }\n release() {\n this.legendComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);\n this.legendComponent = null;\n }\n}\n"]}
@@ -8,7 +8,7 @@ const vrender_components_1 = require("@visactor/vrender-components"), padding_1
8
8
 
9
9
  class Title {
10
10
  constructor(titleOption, table) {
11
- this.isReleased = !1, this.table = table, this._titleOption = titleOption, !1 !== titleOption.visible && (this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs()));
11
+ this.isReleased = !1, this.table = table, this._titleOption = titleOption, this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());
12
12
  }
13
13
  _createOrUpdateTitleComponent(attrs) {
14
14
  if (this._titleComponent) (0, vutils_1.isEqual)(attrs, this._cacheAttrs) || this._titleComponent.setAttributes(attrs); else {
@@ -36,14 +36,14 @@ class Title {
36
36
  }), this._adjustTableSize(this._titleComponent.attribute);
37
37
  }
38
38
  _adjustTableSize(attrs) {
39
- var _a, _b, _c, _d;
40
- const width = isFinite(null === (_a = this._titleComponent) || void 0 === _a ? void 0 : _a.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0, height = isFinite(null === (_b = this._titleComponent) || void 0 === _b ? void 0 : _b.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;
39
+ var _a, _b;
40
+ const width = isFinite(this._titleComponent.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0, height = isFinite(this._titleComponent.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;
41
41
  "left" === this._titleOption.orient ? (this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width),
42
42
  this.table.tableX += Math.ceil(width)) : "top" === this._titleOption.orient ? (this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height),
43
43
  this.table.tableY += Math.ceil(height)) : "right" === this._titleOption.orient ? this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width) : "bottom" === this._titleOption.orient && (this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height)),
44
44
  this._cacheAttrs = attrs, "right" !== this._titleOption.orient && "bottom" !== this._titleOption.orient || this._titleComponent.setAttributes({
45
- x: (null !== (_c = this._titleOption.x) && void 0 !== _c ? _c : "right" === this._titleOption.orient) ? this.table.tableX + this.table.tableNoFrameWidth : this.table.tableX,
46
- y: (null !== (_d = this._titleOption.y) && void 0 !== _d ? _d : "bottom" === this._titleOption.orient) ? this.table.tableY + this.table.tableNoFrameHeight : this.table.tableY
45
+ x: (null !== (_a = this._titleOption.x) && void 0 !== _a ? _a : "right" === this._titleOption.orient) ? this.table.tableX + this.table.tableNoFrameWidth : this.table.tableX,
46
+ y: (null !== (_b = this._titleOption.y) && void 0 !== _b ? _b : "bottom" === this._titleOption.orient) ? this.table.tableY + this.table.tableNoFrameHeight : this.table.tableY
47
47
  });
48
48
  }
49
49
  release() {
@@ -52,8 +52,7 @@ class Title {
52
52
  }
53
53
  _getTitleAttrs() {
54
54
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
55
- const defaultPadding = this._titleOption.text || this._titleOption.subtext ? 10 : 0, padding = (0,
56
- padding_1.getQuadProps)(null !== (_a = this._titleOption.padding) && void 0 !== _a ? _a : defaultPadding), realWidth = null !== (_b = this._titleOption.width) && void 0 !== _b ? _b : Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3], realHeight = null !== (_c = this._titleOption.height) && void 0 !== _c ? _c : Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];
55
+ const padding = (0, padding_1.getQuadProps)(null !== (_a = this._titleOption.padding) && void 0 !== _a ? _a : 10), realWidth = null !== (_b = this._titleOption.width) && void 0 !== _b ? _b : Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3], realHeight = null !== (_c = this._titleOption.height) && void 0 !== _c ? _c : Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];
57
56
  return {
58
57
  text: null !== (_d = this._titleOption.text) && void 0 !== _d ? _d : "",
59
58
  subtext: null !== (_e = this._titleOption.subtext) && void 0 !== _e ? _e : "",
@@ -1 +1 @@
1
- {"version":3,"sources":["components/title/title.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAIxE,4DAA8D;AAE9D,6CAA2C;AAC3C,MAAa,KAAK;IAMhB,YAAY,WAAmB,EAAE,KAAmB;QAHpD,eAAU,GAAY,KAAK,CAAC;QAI1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,EAAE;YACjC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;SAClF;IACH,CAAC;IAEO,6BAA6B,CAAC,KAAiB;QACrD,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,IAAI,CAAC,IAAA,gBAAO,EAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE;gBACrC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aAC3C;SACF;aAAM;YACL,MAAM,KAAK,GAAG,IAAI,0BAAe,CAAC,KAAK,CAAC,CAAC;YACzC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW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K,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,OAAO;gBACzE,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM;YAC9B,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YAClC,KAAK,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,KAAK,mCAAI,MAAM;YACxC,aAAa,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,aAAa,mCAAI,KAAK;YACvD,SAAS,kBACP,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,SAAS,CAC/B;YACD,YAAY,kBACV,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,YAAY,CAClC;SACY,CAAC;IAClB,CAAC;CACF;AAhLD,sBAgLC","file":"title.js","sourcesContent":["import { Title as TitleComponents } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TitleAttrs } from '@visactor/vrender-components';\nimport type { ITitle } from '../../ts-types/component/title';\nimport { getQuadProps } from '../../scenegraph/utils/padding';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isEqual } from '@visactor/vutils';\nexport class Title {\n table: BaseTableAPI;\n _titleOption: ITitle;\n isReleased: boolean = false;\n private _titleComponent: TitleComponents;\n private _cacheAttrs: TitleAttrs;\n constructor(titleOption: ITitle, table: BaseTableAPI) {\n this.table = table;\n this._titleOption = titleOption;\n if (titleOption.visible !== false) {\n this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());\n }\n }\n\n private _createOrUpdateTitleComponent(attrs: TitleAttrs): TitleComponents {\n if (this._titleComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._titleComponent.setAttributes(attrs);\n }\n } else {\n const title = new TitleComponents(attrs);\n title.name = 'title';\n this.table.scenegraph.stage.defaultLayer.appendChild(title);\n this._titleComponent = title;\n // 代理 title 组件上的事件\n // title.on('*', (event: any, type: string) => this._delegateEvent(title as unknown as INode, event, type));\n }\n // update table size\n this._adjustTableSize(this._titleComponent.attribute);\n return this._titleComponent;\n }\n\n resize() {\n if (!this._titleComponent) {\n return;\n }\n const padding = getQuadProps(this._titleOption.padding ?? 10);\n const realWidth =\n this._titleOption.width ??\n Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];\n const realHeight =\n this._titleOption.height ??\n Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n // width: realWidth,\n width:\n this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'\n ? realWidth\n : this._titleOption.width,\n height:\n this._titleOption.orient === 'left' || this._titleOption.orient === 'right'\n ? realHeight\n : this._titleOption.height,\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n });\n this._adjustTableSize(this._titleComponent.attribute);\n }\n\n _adjustTableSize(attrs: TitleAttrs) {\n // 调整位置\n const width = isFinite(this._titleComponent?.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0;\n const height = isFinite(this._titleComponent?.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;\n // const rectWidth = this.table.tableNoFrameWidth;\n // const rectHeight = this.table.tableNoFrameHeight;\n // const padding = getQuadProps((attrs.padding as number | number[]) ?? this._titleOption.padding ?? 10);\n\n // let x = 0;\n // let y = 0;\n // if (this._titleOption.orient === 'left') {\n // x = padding[3];\n // y = 0;\n // // width += padding[1] + padding[3];\n // } else if (this._titleOption.orient === 'top') {\n // x = 0;\n // y = padding[0];\n // // height += padding[0] + padding[2];\n // } else if (this._titleOption.orient === 'right') {\n // x = rectWidth - width - padding[1];\n // y = 0;\n // width += padding[1] + padding[3];\n // } else if (this._titleOption.orient === 'bottom') {\n // x = 0;\n // y = rectHeight - height - padding[2];\n // // height += padding[0] + padding[2];\n // }\n if (this._titleOption.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this._titleOption.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this._titleOption.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this._titleOption.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n this._cacheAttrs = attrs;\n if (this._titleOption.orient === 'right' || this._titleOption.orient === 'bottom') {\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY\n });\n }\n }\n\n release(): void {\n this._titleComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);\n this._titleComponent = null;\n this.isReleased = true;\n }\n private _getTitleAttrs() {\n const defaultPadding = this._titleOption.text || this._titleOption.subtext ? 10 : 0;\n const padding = getQuadProps(this._titleOption.padding ?? defaultPadding);\n const realWidth =\n this._titleOption.width ??\n Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];\n const realHeight =\n this._titleOption.height ??\n Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];\n return {\n text: this._titleOption.text ?? '',\n subtext: this._titleOption.subtext ?? '',\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n width:\n this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'\n ? realWidth\n : this._titleOption.width,\n height:\n this._titleOption.orient === 'left' || this._titleOption.orient === 'right'\n ? realHeight\n : this._titleOption.height,\n minWidth: this._titleOption.minWidth,\n maxWidth: this._titleOption.maxWidth,\n minHeight: this._titleOption.minHeight,\n maxHeight: this._titleOption.maxHeight,\n padding: this._titleOption.padding,\n align: this._titleOption.align ?? 'left',\n verticalAlign: this._titleOption.verticalAlign ?? 'top',\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n } as TitleAttrs;\n }\n}\n"]}
1
+ {"version":3,"sources":["components/title/title.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAIxE,4DAA8D;AAE9D,6CAA2C;AAC3C,MAAa,KAAK;IAMhB,YAAY,WAAmB,EAAE,KAAmB;QAHpD,eAAU,GAAY,KAAK,CAAC;QAI1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACnF,CAAC;IAEO,6BAA6B,CAAC,KAAiB;QACrD,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,IAAI,CAAC,IAAA,gBAAO,EAAC,KAAK,EAAE,IAAI,CA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C,CAAC,SAAS;gBACX,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK;YAC7B,MAAM,EACJ,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,OAAO;gBACzE,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM;YAC9B,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YAClC,KAAK,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,KAAK,mCAAI,MAAM;YACxC,aAAa,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,aAAa,mCAAI,KAAK;YACvD,SAAS,kBACP,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,SAAS,CAC/B;YACD,YAAY,kBACV,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,YAAY,CAClC;SACY,CAAC;IAClB,CAAC;CACF;AA7KD,sBA6KC","file":"title.js","sourcesContent":["import { Title as TitleComponents } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TitleAttrs } from '@visactor/vrender-components';\nimport type { ITitle } from '../../ts-types/component/title';\nimport { getQuadProps } from '../../scenegraph/utils/padding';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isEqual } from '@visactor/vutils';\nexport class Title {\n table: BaseTableAPI;\n _titleOption: ITitle;\n isReleased: boolean = false;\n private _titleComponent: TitleComponents;\n private _cacheAttrs: TitleAttrs;\n constructor(titleOption: ITitle, table: BaseTableAPI) {\n this.table = table;\n this._titleOption = titleOption;\n this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());\n }\n\n private _createOrUpdateTitleComponent(attrs: TitleAttrs): TitleComponents {\n if (this._titleComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._titleComponent.setAttributes(attrs);\n }\n } else {\n const title = new TitleComponents(attrs);\n title.name = 'title';\n this.table.scenegraph.stage.defaultLayer.appendChild(title);\n this._titleComponent = title;\n // 代理 title 组件上的事件\n // title.on('*', (event: any, type: string) => this._delegateEvent(title as unknown as INode, event, type));\n }\n // update table size\n this._adjustTableSize(this._titleComponent.attribute);\n return this._titleComponent;\n }\n\n resize() {\n if (!this._titleComponent) {\n return;\n }\n const padding = getQuadProps(this._titleOption.padding ?? 10);\n const realWidth =\n this._titleOption.width ??\n Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];\n const realHeight =\n this._titleOption.height ??\n Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n // width: realWidth,\n width:\n this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'\n ? realWidth\n : this._titleOption.width,\n height:\n this._titleOption.orient === 'left' || this._titleOption.orient === 'right'\n ? realHeight\n : this._titleOption.height,\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n });\n this._adjustTableSize(this._titleComponent.attribute);\n }\n\n _adjustTableSize(attrs: TitleAttrs) {\n // 调整位置\n const width = isFinite(this._titleComponent.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0;\n const height = isFinite(this._titleComponent.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;\n // const rectWidth = this.table.tableNoFrameWidth;\n // const rectHeight = this.table.tableNoFrameHeight;\n // const padding = getQuadProps((attrs.padding as number | number[]) ?? this._titleOption.padding ?? 10);\n\n // let x = 0;\n // let y = 0;\n // if (this._titleOption.orient === 'left') {\n // x = padding[3];\n // y = 0;\n // // width += padding[1] + padding[3];\n // } else if (this._titleOption.orient === 'top') {\n // x = 0;\n // y = padding[0];\n // // height += padding[0] + padding[2];\n // } else if (this._titleOption.orient === 'right') {\n // x = rectWidth - width - padding[1];\n // y = 0;\n // width += padding[1] + padding[3];\n // } else if (this._titleOption.orient === 'bottom') {\n // x = 0;\n // y = rectHeight - height - padding[2];\n // // height += padding[0] + padding[2];\n // }\n if (this._titleOption.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this._titleOption.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this._titleOption.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this._titleOption.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n this._cacheAttrs = attrs;\n if (this._titleOption.orient === 'right' || this._titleOption.orient === 'bottom') {\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY\n });\n }\n }\n\n release(): void {\n this._titleComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);\n this._titleComponent = null;\n this.isReleased = true;\n }\n private _getTitleAttrs() {\n const padding = getQuadProps(this._titleOption.padding ?? 10);\n const realWidth =\n this._titleOption.width ??\n Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width) - padding[1] - padding[3];\n const realHeight =\n this._titleOption.height ??\n Math.min(this.table.tableNoFrameHeight, this.table.getDrawRange().height) - padding[0] - padding[2];\n return {\n text: this._titleOption.text ?? '',\n subtext: this._titleOption.subtext ?? '',\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + Math.min(this.table.tableNoFrameWidth, this.table.getDrawRange().width)\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n width:\n this._titleOption.orient === 'top' || this._titleOption.orient === 'bottom'\n ? realWidth\n : this._titleOption.width,\n height:\n this._titleOption.orient === 'left' || this._titleOption.orient === 'right'\n ? realHeight\n : this._titleOption.height,\n minWidth: this._titleOption.minWidth,\n maxWidth: this._titleOption.maxWidth,\n minHeight: this._titleOption.minHeight,\n maxHeight: this._titleOption.maxHeight,\n padding: this._titleOption.padding,\n align: this._titleOption.align ?? 'left',\n verticalAlign: this._titleOption.verticalAlign ?? 'top',\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n } as TitleAttrs;\n }\n}\n"]}
@@ -45,7 +45,7 @@ class BaseTable extends EventTarget_1.EventTarget {
45
45
  }
46
46
  constructor(container, options = {}) {
47
47
  var _a, _b, _c, _d, _e, _f, _g;
48
- if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.version = "0.13.4-alpha.4",
48
+ if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.version = "0.13.4",
49
49
  this.id = `VTable${Date.now()}`, this.isReleased = !1, this.throttleInvalidate = (0,
50
50
  util_1.throttle2)(this.render.bind(this), 200), !container && "node" !== options.mode) throw new Error("vtable's container is undefined");
51
51
  const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, keyboardOptions: keyboardOptions, columnResizeMode: columnResizeMode, dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = pixel_ratio_1.defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior} = options;
@@ -1451,7 +1451,6 @@ class BaseTable extends EventTarget_1.EventTarget {
1451
1451
  }
1452
1452
  getImageBuffer(type = "image/png") {
1453
1453
  if ("node" !== this.options.mode) return;
1454
- this.render();
1455
1454
  const stage = this.scenegraph.stage;
1456
1455
  if (stage) {
1457
1456
  const contentWidth = this.tableX + this.getAllColsWidth(), contentHeight = this.tableY + this.getAllRowsHeight();