@kumori/aurora-wui-components 0.0.295 → 0.0.296

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.
@@ -8,6 +8,7 @@ export declare class TableChart extends LitElement {
8
8
  chartOptions: ChartOptions;
9
9
  height: string;
10
10
  private chartInstance;
11
+ private _resizeObserver;
11
12
  static styles: import('lit').CSSResult[];
12
13
  private createChart;
13
14
  protected firstUpdated(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"table-chart.d.ts","sourceRoot":"","sources":["../../../src/components/table-chart/table-chart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAwB,MAAM,KAAK,CAAC;AAIvD,qBACa,UAAW,SAAQ,UAAU;IACZ,SAAS,EAAE,MAAM,iBAAiB,CAAU;IAC5C,OAAO,SAAM;IACd,WAAW,EAAE,MAAM,EAAE,CAAM;IACtB,aAAa,EAAE,YAAY,EAAE,CAAM;IACnC,YAAY,EAAE,YAAY,CAAM;IACpC,MAAM,SAAU;IAE5C,OAAO,CAAC,aAAa,CAAsB;IAE3C,MAAM,CAAC,MAAM,4BAQX;IAEF,OAAO,CAAC,WAAW;IA0BnB,SAAS,CAAC,YAAY;IAItB,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IA4BzD,oBAAoB;IAQpB,MAAM;CASP"}
1
+ {"version":3,"file":"table-chart.d.ts","sourceRoot":"","sources":["../../../src/components/table-chart/table-chart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAwB,MAAM,KAAK,CAAC;AAIvD,qBACa,UAAW,SAAQ,UAAU;IACZ,SAAS,EAAE,MAAM,iBAAiB,CAAU;IAC5C,OAAO,SAAM;IACd,WAAW,EAAE,MAAM,EAAE,CAAM;IACtB,aAAa,EAAE,YAAY,EAAE,CAAM;IACnC,YAAY,EAAE,YAAY,CAAM;IACpC,MAAM,SAAU;IAE5C,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,eAAe,CAA+B;IAEtD,MAAM,CAAC,MAAM,4BAaX;IAEF,OAAO,CAAC,WAAW;IA6BnB,SAAS,CAAC,YAAY;IAUtB,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IA4BzD,oBAAoB;IAUpB,MAAM;CASP"}
package/dist/index.js CHANGED
@@ -8922,9 +8922,15 @@ var TableChart = class TableChart extends LitElement {
8922
8922
  this.chartOptions = {};
8923
8923
  this.height = "4rem";
8924
8924
  this.chartInstance = null;
8925
+ this._resizeObserver = null;
8925
8926
  }
8926
8927
  static {
8927
8928
  this.styles = [unsafeCSS(tailwind_default), css`
8929
+ :host {
8930
+ display: block;
8931
+ width: 100%;
8932
+ height: 100%;
8933
+ }
8928
8934
  canvas {
8929
8935
  width: 100% !important;
8930
8936
  height: 100% !important;
@@ -8943,6 +8949,7 @@ var TableChart = class TableChart extends LitElement {
8943
8949
  return;
8944
8950
  }
8945
8951
  if (this.chartInstance) return;
8952
+ if (this.offsetWidth === 0 || this.offsetHeight === 0) return;
8946
8953
  this.chartInstance = new Chart(ctx, {
8947
8954
  type: this.chartType,
8948
8955
  data: {
@@ -8954,6 +8961,10 @@ var TableChart = class TableChart extends LitElement {
8954
8961
  }
8955
8962
  firstUpdated() {
8956
8963
  this.createChart();
8964
+ this._resizeObserver = new ResizeObserver(() => {
8965
+ if (!this.chartInstance) this.createChart();
8966
+ });
8967
+ this._resizeObserver.observe(this);
8957
8968
  }
8958
8969
  updated(changedProperties) {
8959
8970
  super.updated(changedProperties);
@@ -8976,6 +8987,8 @@ var TableChart = class TableChart extends LitElement {
8976
8987
  }
8977
8988
  disconnectedCallback() {
8978
8989
  super.disconnectedCallback();
8990
+ this._resizeObserver?.disconnect();
8991
+ this._resizeObserver = null;
8979
8992
  if (this.chartInstance) {
8980
8993
  this.chartInstance.destroy();
8981
8994
  this.chartInstance = null;