@eox/chart 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@eox/chart",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git@github.com:EOX-A/EOxElements.git"
8
8
  },
9
9
  "devDependencies": {
10
- "vite": "^8.0.10"
10
+ "vite": "^8.2.2"
11
11
  },
12
12
  "engines": {
13
13
  "npm": ">=8.0.0",
@@ -37,12 +37,12 @@
37
37
  "watch": "vite build --watch"
38
38
  },
39
39
  "dependencies": {
40
- "@eox/elements-utils": "^1.1.0",
40
+ "@eox/elements-utils": "^1.2.0",
41
41
  "@eox/ui": "^1.1.0",
42
42
  "deepmerge-ts": "^7.1.3",
43
- "lit": "^3.2.0",
44
- "vega": "^6.2.0",
45
- "vega-embed": "^7.1.0",
43
+ "lit": "^3.3.3",
44
+ "vega": "^6.4.0",
45
+ "vega-embed": "^7.2.0",
46
46
  "vega-lite": "^6.4.3"
47
47
  }
48
48
  }
package/src/main.js CHANGED
@@ -75,6 +75,22 @@ export class EOxChart extends LitElement {
75
75
  * @type {Boolean}
76
76
  */
77
77
  this.unstyled = false;
78
+
79
+ /**
80
+ * ResizeObserver instance to handle auto-resizing
81
+ *
82
+ * @type {ResizeObserver | null}
83
+ * @private
84
+ */
85
+ this._resizeObserver = null;
86
+
87
+ /**
88
+ * Vega view instance
89
+ *
90
+ * @type {any}
91
+ * @private
92
+ */
93
+ this._vegaView = null;
78
94
  }
79
95
 
80
96
  /**
@@ -120,10 +136,30 @@ export class EOxChart extends LitElement {
120
136
  }
121
137
  }
122
138
 
139
+ disconnectedCallback() {
140
+ super.disconnectedCallback();
141
+ if (this._resizeObserver) {
142
+ this._resizeObserver.disconnect();
143
+ }
144
+ }
145
+
123
146
  /**
124
147
  * Append custom styling for vega tooltip
125
148
  */
126
149
  firstUpdated() {
150
+ if (typeof ResizeObserver !== "undefined" && !this._resizeObserver) {
151
+ this._resizeObserver = new ResizeObserver(() => {
152
+ if (this._vegaView) {
153
+ window.dispatchEvent(new Event("resize"));
154
+ this._vegaView.resize().runAsync();
155
+ }
156
+ });
157
+ this._resizeObserver.observe(this);
158
+ if (this.parentElement) {
159
+ this._resizeObserver.observe(this.parentElement);
160
+ }
161
+ }
162
+
127
163
  if (!this.unstyled) {
128
164
  const style = document.createElement("style");
129
165
  style.innerHTML = `
@@ -34,6 +34,8 @@ const renderChartMethod = (EOxChart, spec, opt, dataValues) => {
34
34
  // @ts-expect-error using private method defined on EOxChart
35
35
  EOxChart._dispatchItemClickEvent({ event, item });
36
36
  });
37
+ // @ts-expect-error using private method defined on EOxChart
38
+ EOxChart._vegaView = res.view;
37
39
  });
38
40
  };
39
41
 
package/types/main.d.ts CHANGED
@@ -73,6 +73,20 @@ export class EOxChart extends LitElement {
73
73
  * @type {Boolean}
74
74
  */
75
75
  unstyled: boolean;
76
+ /**
77
+ * ResizeObserver instance to handle auto-resizing
78
+ *
79
+ * @type {ResizeObserver | null}
80
+ * @private
81
+ */
82
+ private _resizeObserver;
83
+ /**
84
+ * Vega view instance
85
+ *
86
+ * @type {any}
87
+ * @private
88
+ */
89
+ private _vegaView;
76
90
  /**
77
91
  * @private
78
92
  */
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACE;;;;;;;;;;;;;;;;;MAME;IAKA;;;;OAIG;IACH,MAFU,OAAO,YAAY,EAAE,iBAAiB,GAAG,MAAM,CAEpC;IAErB;;;;OAIG;IACH,KAFU,OAAO,YAAY,EAAE,YAAY,CAEvB;IAEpB;;;;OAIG;IACH,YAFU;QAAC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,kCAAkC,EAAE,UAAU,CAAA;KAAC,GAAG,MAAM,CAEzE;IAE3B;;;;OAIG;IACH,kBAAqB;IAErB;;;;OAIG;IACH,kBAAqB;IAGvB;;OAEG;IACH,sCAUC;IAED;;OAEG;IACH,gCAUC;IAED;;;;OAIG;IACH,2BAFW,OAAO,KAAK,EAAE,cAAc,iBAQtC;IAED;;OAEG;IACH,qBA6BC;IASD;;OAEG;IACH,+CAQC;CACF;2BA/KgC,KAAK;iCAKL,kBAAkB;0BADzB,kBAAkB"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACE;;;;;;;;;;;;;;;;;MAME;IAKA;;;;OAIG;IACH,MAFU,OAAO,YAAY,EAAE,iBAAiB,GAAG,MAAM,CAEpC;IAErB;;;;OAIG;IACH,KAFU,OAAO,YAAY,EAAE,YAAY,CAEvB;IAEpB;;;;OAIG;IACH,YAFU;QAAC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,kCAAkC,EAAE,UAAU,CAAA;KAAC,GAAG,MAAM,CAEzE;IAE3B;;;;OAIG;IACH,kBAAqB;IAErB;;;;OAIG;IACH,kBAAqB;IAErB;;;;;OAKG;IACH,wBAA2B;IAE3B;;;;;OAKG;IACH,kBAAqB;IAGvB;;OAEG;IACH,sCAUC;IAED;;OAEG;IACH,gCAUC;IAED;;;;OAIG;IACH,2BAFW,OAAO,KAAK,EAAE,cAAc,iBAQtC;IASD;;OAEG;IACH,qBA0CC;IASD;;OAEG;IACH,+CAQC;CACF;2BAnNgC,KAAK;iCAKL,kBAAkB;0BADzB,kBAAkB"}
@@ -1 +1 @@
1
- {"version":3,"file":"render-chart.d.ts","sourceRoot":"","sources":["../../../src/methods/render/render-chart.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH,6CALW,OAAO,YAAY,EAAE,QAAQ,QAC7B,OAAO,YAAY,EAAE,iBAAiB,yBACtC,eAAO,QA4BjB"}
1
+ {"version":3,"file":"render-chart.d.ts","sourceRoot":"","sources":["../../../src/methods/render/render-chart.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH,6CALW,OAAO,YAAY,EAAE,QAAQ,QAC7B,OAAO,YAAY,EAAE,iBAAiB,yBACtC,eAAO,QA8BjB"}