@lumal/charts 0.0.1-beta → 0.0.3-beta

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/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # @lumal/charts
2
+
3
+ ## 0.0.3-beta (2026-10-16)
4
+
5
+ ### Minor Changes
6
+
7
+ - 图表 peer 依赖升级为 ECharts 6 / vue-echarts 8,开发与示例使用 ECharts 6.1.0 / vue-echarts 8.3.2。
8
+ - 不再声明兼容 ECharts 5 / vue-echarts 7;默认主题、图例及标签布局遵循 ECharts 6。
9
+
10
+ ### Patch Changes
11
+
12
+ - 正确转发 VChart 图表事件,动画优先级调整为显式 prop、option、reduced-motion 默认值。
13
+ - 移除重复 resize 监听,接通 chartWidth/tableWidth 布局样式。
14
+ - 增加真实 SVG 引擎的更新、系列删除与销毁回归。
15
+
16
+ ## 0.0.2-beta (2026-08-01)
17
+
18
+ - Version bump only, to stay in lockstep with the other @lumal packages.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Lumal contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lumal contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,21 +1,25 @@
1
- # @lumal/charts
2
-
3
- Lumal 可选图表包,基于 ECharts 与 vue-echarts 封装轻量图表组件。ECharts 作为 peer dependency,不进入 `@lumal/core` 默认依赖。
4
-
5
- ## 安装
6
-
7
- ```bash
8
- pnpm add @lumal/charts echarts vue-echarts vue
9
- ```
10
-
11
- ## 用法
12
-
13
- ```ts
14
- import { LumalChart, LumalChartPanel, useChartResize } from '@lumal/charts'
15
- import '@lumal/charts/style.css'
16
- ```
17
-
18
- ```vue
1
+ # @lumal/charts
2
+
3
+ Lumal 可选图表包,基于 ECharts 与 vue-echarts 封装轻量图表组件。ECharts 作为 peer dependency,不进入 `@lumal/core` 默认依赖。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add @lumal/charts@0.0.3-beta echarts@^6 vue-echarts@^8 vue
9
+ ```
10
+
11
+ 支持 ECharts 6、vue-echarts 8 和 Vue 3.5+。应用仍需按需注册图表、组件和渲染器。
12
+ ECharts 6 调整了默认配色、图例位置和标签布局,本包不会强制恢复旧主题;需要保持原有外观时,
13
+ 请按 [ECharts 6 迁移指南](https://echarts.apache.org/handbook/en/basics/release-note/v6-upgrade-guide/) 在应用侧配置。
14
+
15
+ ## 用法
16
+
17
+ ```ts
18
+ import { LumalChart, LumalChartPanel, useChartResize } from '@lumal/charts'
19
+ import '@lumal/charts/style.css'
20
+ ```
21
+
22
+ ```vue
19
23
  <LumalChartPanel
20
24
  v-model:view="view"
21
25
  title="访问趋势"
@@ -31,11 +35,15 @@ import '@lumal/charts/style.css'
31
35
  <template #query>查询条件</template>
32
36
  <template #table>可访问的数据表格</template>
33
37
  </LumalChartPanel>
34
- ```
35
-
36
- ## 导出
37
-
38
+ ```
39
+
40
+ ## 导出
41
+
38
42
  - `LumalChart`:基础图表组件,透传 ECharts `options`,容器自适应,并默认响应 reduced-motion。
39
43
  - `LumalChartPanel`:支持查询区、图表/表格切换、导出、重试、loading/empty/error 和无障碍摘要的工作流面板。
40
- - `useChartResize`:监听容器尺寸变化并触发图表 resize。
41
- - `resolveChartPanelStyle`:图表区/表格区宽度到 CSS 变量的映射。
44
+ - `useChartResize`:监听容器尺寸变化并触发图表 resize。
45
+ - `resolveChartPanelStyle`:图表区/表格区宽度到 CSS 变量的映射。
46
+
47
+ `LumalChart` 的 class/style 保留在外层,其他 attrs 和事件传给 VChart;`@click` 接收 ECharts 参数,DOM 事件可使用 vue-echarts 的 `native:` 事件前缀。动画优先级为显式 `animation` prop > `options.animation` > reduced-motion 默认值。容器自适应只由 VChart 管理,`autoResize: false` 不安装额外尺寸监听。
48
+
49
+ `LumalChartPanel.chartWidth` / `tableWidth` 分别控制图表与表格视图的实际宽度,数字按 px 处理、字符串保留 CSS 单位,均受父容器 `max-width: 100%` 约束。
package/dist/charts.css CHANGED
@@ -1,2 +1,2 @@
1
- .lumal-chart[data-v-648e0699],.lumal-chart__canvas[data-v-648e0699]{width:100%;height:100%}.lumal-chart-panel[data-v-f90a8d18]{flex-direction:column;gap:12px;display:flex}.lumal-chart-panel__header[data-v-f90a8d18]{justify-content:space-between;align-items:center;gap:16px;display:flex}.lumal-chart-panel__query[data-v-f90a8d18]{border-radius:var(--lumal-radius-base,8px);background:var(--el-fill-color-light,Canvas);padding:12px}.lumal-chart-panel__title[data-v-f90a8d18]{margin:0;font-size:15px;font-weight:600}.lumal-chart-panel__body[data-v-f90a8d18]{width:100%;min-height:160px;position:relative;overflow:hidden}.lumal-chart-panel__body.is-table[data-v-f90a8d18]{overflow:auto}.lumal-chart-panel__status[data-v-f90a8d18]{height:100%;color:var(--el-text-color-secondary,CanvasText);text-align:center;flex-direction:column;justify-content:center;align-items:center;gap:12px;display:flex}.lumal-chart-panel__status button[data-v-f90a8d18],.lumal-chart-panel__actions button[data-v-f90a8d18]{border:1px solid var(--el-border-color,currentColor);border-radius:var(--lumal-radius-base,8px);min-width:44px;min-height:44px;color:var(--el-text-color-primary,CanvasText);background:var(--el-bg-color,Canvas);cursor:pointer;padding:0 14px}.lumal-chart-panel__actions[data-v-f90a8d18]{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;display:flex}.lumal-chart-panel__view-toggle[data-v-f90a8d18]{display:inline-flex}.lumal-chart-panel__view-toggle button[aria-pressed=true][data-v-f90a8d18]{border-color:var(--el-color-primary,Highlight);color:var(--el-color-primary,Highlight);background:var(--el-color-primary-light-9,Canvas)}.lumal-chart-panel__summary[data-v-f90a8d18]{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.lumal-chart-panel button[data-v-f90a8d18]:focus-visible{outline:2px solid var(--el-color-primary,Highlight);outline-offset:2px}@media (width<=640px){.lumal-chart-panel__header[data-v-f90a8d18]{flex-direction:column;align-items:flex-start}.lumal-chart-panel__actions[data-v-f90a8d18]{justify-content:flex-start;width:100%}}
1
+ .lumal-chart[data-v-f9365923],.lumal-chart__canvas[data-v-f9365923]{width:100%;height:100%}.lumal-chart-panel[data-v-d3152c00]{flex-direction:column;gap:12px;display:flex}.lumal-chart-panel__header[data-v-d3152c00]{justify-content:space-between;align-items:center;gap:16px;display:flex}.lumal-chart-panel__query[data-v-d3152c00]{border-radius:var(--lumal-radius-base,8px);background:var(--el-fill-color-light,Canvas);padding:12px}.lumal-chart-panel__title[data-v-d3152c00]{margin:0;font-size:15px;font-weight:600}.lumal-chart-panel__body[data-v-d3152c00]{width:100%;min-height:160px;position:relative;overflow:hidden}.lumal-chart-panel__body.is-table[data-v-d3152c00]{width:var(--lumal-chart-panel-table-width,100%);max-width:100%;overflow:auto}.lumal-chart-panel__body.is-chart[data-v-d3152c00]{width:var(--lumal-chart-panel-chart-width,100%);max-width:100%}.lumal-chart-panel__status[data-v-d3152c00]{height:100%;color:var(--el-text-color-secondary,CanvasText);text-align:center;flex-direction:column;justify-content:center;align-items:center;gap:12px;display:flex}.lumal-chart-panel__status button[data-v-d3152c00],.lumal-chart-panel__actions button[data-v-d3152c00]{border:1px solid var(--el-border-color,currentColor);border-radius:var(--lumal-radius-base,8px);min-width:44px;min-height:44px;color:var(--el-text-color-primary,CanvasText);background:var(--el-bg-color,Canvas);cursor:pointer;padding:0 14px}.lumal-chart-panel__actions[data-v-d3152c00]{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;display:flex}.lumal-chart-panel__view-toggle[data-v-d3152c00]{display:inline-flex}.lumal-chart-panel__view-toggle button[aria-pressed=true][data-v-d3152c00]{border-color:var(--el-color-primary,Highlight);color:var(--el-color-primary,Highlight);background:var(--el-color-primary-light-9,Canvas)}.lumal-chart-panel__summary[data-v-d3152c00]{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.lumal-chart-panel button[data-v-d3152c00]:focus-visible{outline:2px solid var(--el-color-primary,Highlight);outline-offset:2px}@media (width<=640px){.lumal-chart-panel__header[data-v-d3152c00]{flex-direction:column;align-items:flex-start}.lumal-chart-panel__actions[data-v-d3152c00]{justify-content:flex-start;width:100%}}
2
2
  /*$vite$:1*/
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("vue"),l=require("vue-echarts");l=s(l,1);function u(e,t,n={}){if(n.enabled===!1)return;let r;function i(){e.value?.resize()}function a(e){r?.disconnect(),e&&typeof ResizeObserver<`u`&&(r=new ResizeObserver(()=>i()),r.observe(e))}(0,c.onMounted)(()=>{t&&(a(t.value),(0,c.watch)(t,e=>a(e))),typeof window<`u`&&window.addEventListener(`resize`,i)}),(0,c.onBeforeUnmount)(()=>{r?.disconnect(),typeof window<`u`&&window.removeEventListener(`resize`,i)})}var d=[`aria-label`],f=(0,c.defineComponent)({__name:`LumalChart`,props:{options:{},updateOptions:{default:void 0},autoResize:{type:Boolean,default:!0},animation:{type:Boolean,default:void 0},ariaLabel:{default:`数据图表`},width:{default:`100%`},height:{default:`100%`}},setup(e,{expose:t}){let n=e,r=(0,c.shallowRef)(!1),i=(0,c.shallowRef)(!1),a=(0,c.computed)(()=>({...n.options,animation:n.animation??!i.value})),o;function s(e){i.value=e.matches}let f=(0,c.useTemplateRef)(`chartRef`);return(0,c.onMounted)(()=>{typeof window<`u`&&typeof window.matchMedia==`function`&&(o=window.matchMedia(`(prefers-reduced-motion: reduce)`),s(o),o.addEventListener?.(`change`,s)),(0,c.nextTick)(()=>{r.value=!0})}),(0,c.onBeforeUnmount)(()=>{o?.removeEventListener?.(`change`,s)}),u(f),t({resize:()=>f.value?.resize()}),(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{class:`lumal-chart`,role:`img`,"aria-label":e.ariaLabel,style:(0,c.normalizeStyle)({height:e.height,width:e.width})},[r.value?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.default),{key:0,ref_key:`chartRef`,ref:f,class:`lumal-chart__canvas`,option:a.value,"update-options":e.updateOptions,autoresize:e.autoResize},null,8,[`option`,`update-options`,`autoresize`])):(0,c.createCommentVNode)(``,!0)],12,d))}}),p=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},m=p(f,[[`__scopeId`,`data-v-648e0699`]]);function h(e){if(typeof e==`number`)return Number.isFinite(e)?`${e}px`:void 0;if(typeof e==`string`&&e.trim())return e}function g(e){let t=h(e.chartWidth),n=h(e.tableWidth),r={};return t&&(r[`--lumal-chart-panel-chart-width`]=t),n&&(r[`--lumal-chart-panel-table-width`]=n),Object.keys(r).length>0?r:void 0}var _={key:0,class:`lumal-chart-panel__query`},v={key:1,class:`lumal-chart-panel__header`},y={key:0,class:`lumal-chart-panel__title`},b={class:`lumal-chart-panel__actions`},x={key:0,class:`lumal-chart-panel__view-toggle`,"aria-label":`图表展示方式`},S=[`aria-pressed`],C=[`aria-pressed`],w=[`aria-busy`,`aria-describedby`],T={key:0,class:`lumal-chart-panel__status`,role:`status`},E={key:1,class:`lumal-chart-panel__status is-error`,role:`alert`},D={key:2,class:`lumal-chart-panel__status`,role:`status`},O=p((0,c.defineComponent)({__name:`LumalChartPanel`,props:(0,c.mergeModels)({title:{default:``},options:{default:void 0},loading:{type:Boolean,default:!1},noData:{type:Boolean,default:!1},emptyText:{default:`暂无数据`},height:{default:`320px`},chartWidth:{default:void 0},tableWidth:{default:void 0},error:{type:[Boolean,Error,String],default:!1},errorText:{default:`数据加载失败`},retryText:{default:`重新加载`},summary:{default:``},showExport:{type:Boolean,default:!1},showViewToggle:{type:Boolean,default:!1},animation:{type:Boolean,default:void 0}},{view:{default:`chart`},viewModifiers:{}}),emits:(0,c.mergeModels)([`export`,`retry`],[`update:view`]),setup(e,{expose:t,emit:n}){let r=e,i=n,a=(0,c.useModel)(e,`view`),o=(0,c.useTemplateRef)(`chartRef`),s=`lumal-chart-summary-${(0,c.useId)()}`,l=(0,c.computed)(()=>r.error instanceof Error?r.error.message||r.errorText:typeof r.error==`string`?r.error:r.errorText),u=(0,c.computed)(()=>g({chartWidth:r.chartWidth,tableWidth:r.tableWidth}));return t({resize:()=>o.value?.resize()}),(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`section`,{class:`lumal-chart-panel`,style:(0,c.normalizeStyle)(u.value)},[t.$slots.query?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,_,[(0,c.renderSlot)(t.$slots,`query`,{},void 0,!0)])):(0,c.createCommentVNode)(``,!0),e.title||t.$slots.actions||e.showExport||e.showViewToggle?((0,c.openBlock)(),(0,c.createElementBlock)(`header`,v,[e.title?((0,c.openBlock)(),(0,c.createElementBlock)(`h4`,y,(0,c.toDisplayString)(e.title),1)):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,b,[(0,c.renderSlot)(t.$slots,`actions`,{},void 0,!0),e.showViewToggle?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,x,[(0,c.createElementVNode)(`button`,{type:`button`,"aria-pressed":a.value===`chart`,onClick:n[0]||=e=>a.value=`chart`},` 图表 `,8,S),(0,c.createElementVNode)(`button`,{type:`button`,"aria-pressed":a.value===`table`,onClick:n[1]||=e=>a.value=`table`},` 表格 `,8,C)])):(0,c.createCommentVNode)(``,!0),e.showExport?((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:1,type:`button`,onClick:n[2]||=e=>i(`export`,a.value)},` 导出 `)):(0,c.createCommentVNode)(``,!0)])])):(0,c.createCommentVNode)(``,!0),e.summary?((0,c.openBlock)(),(0,c.createElementBlock)(`p`,{key:2,id:s,class:`lumal-chart-panel__summary`},(0,c.toDisplayString)(e.summary),1)):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,{class:(0,c.normalizeClass)([`lumal-chart-panel__body`,`is-${a.value}`]),style:(0,c.normalizeStyle)({height:e.height}),"aria-busy":e.loading,"aria-describedby":e.summary?s:void 0},[e.loading?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,T,[(0,c.renderSlot)(t.$slots,`loading`,{},()=>[n[4]||=(0,c.createTextVNode)(` 加载中… `,-1)],!0)])):e.error?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,E,[(0,c.renderSlot)(t.$slots,`error`,{message:l.value,retry:()=>i(`retry`)},()=>[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(l.value),1),(0,c.createElementVNode)(`button`,{type:`button`,onClick:n[3]||=e=>i(`retry`)},(0,c.toDisplayString)(e.retryText),1)],!0)])):e.noData?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,D,[(0,c.renderSlot)(t.$slots,`empty`,{},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.emptyText),1)],!0)])):a.value===`table`?(0,c.renderSlot)(t.$slots,`table`,{key:3},void 0,!0):e.options?((0,c.openBlock)(),(0,c.createBlock)(m,{key:4,ref_key:`chartRef`,ref:o,options:e.options,height:e.height,animation:e.animation,"aria-label":e.title||`数据图表`},null,8,[`options`,`height`,`animation`,`aria-label`])):(0,c.renderSlot)(t.$slots,`chart`,{key:5},void 0,!0)],14,w)],4))}}),[[`__scopeId`,`data-v-f90a8d18`]]);function k(e,t){let n=e;return n.install=function(n){n.component(t,e)},n}var A=k(m,`LumalChart`),j=k(O,`LumalChartPanel`);exports.LumalChart=A,exports.LumalChartPanel=j,exports.resolveChartPanelStyle=g,exports.useChartResize=u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("vue"),l=require("vue-echarts");l=s(l,1);var u=[`aria-label`],d=(0,c.defineComponent)({inheritAttrs:!1,__name:`LumalChart`,props:{options:{},updateOptions:{default:void 0},autoResize:{type:Boolean,default:!0},animation:{type:Boolean,default:void 0},ariaLabel:{default:`数据图表`},width:{default:`100%`},height:{default:`100%`}},setup(e,{expose:t}){let n=e,r=(0,c.shallowRef)(!1),i=(0,c.shallowRef)(!1),a=(0,c.computed)(()=>({...n.options,animation:n.animation??n.options.animation??!i.value})),o;function s(e){i.value=e.matches}let d=(0,c.useTemplateRef)(`chartRef`);(0,c.onMounted)(()=>{typeof window<`u`&&typeof window.matchMedia==`function`&&(o=window.matchMedia(`(prefers-reduced-motion: reduce)`),s(o),o.addEventListener?.(`change`,s)),(0,c.nextTick)(()=>{r.value=!0})}),(0,c.onBeforeUnmount)(()=>{o?.removeEventListener?.(`change`,s)});let f=(0,c.useAttrs)();function p(){return Object.fromEntries(Object.entries(f).filter(([e])=>e!==`class`&&e!==`style`))}return t({resize:()=>d.value?.resize()}),(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{class:(0,c.normalizeClass)([`lumal-chart`,t.$attrs.class]),role:`img`,"aria-label":e.ariaLabel,style:(0,c.normalizeStyle)([t.$attrs.style,{height:e.height,width:e.width}])},[r.value?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.default),(0,c.mergeProps)({key:0,ref_key:`chartRef`,ref:d},p(),{class:`lumal-chart__canvas`,option:a.value,"update-options":e.updateOptions,autoresize:e.autoResize}),null,16,[`option`,`update-options`,`autoresize`])):(0,c.createCommentVNode)(``,!0)],14,u))}}),f=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},p=f(d,[[`__scopeId`,`data-v-f9365923`]]);function m(e){if(typeof e==`number`)return Number.isFinite(e)?`${e}px`:void 0;if(typeof e==`string`&&e.trim())return e}function h(e){let t=m(e.chartWidth),n=m(e.tableWidth),r={};return t&&(r[`--lumal-chart-panel-chart-width`]=t),n&&(r[`--lumal-chart-panel-table-width`]=n),Object.keys(r).length>0?r:void 0}var g={key:0,class:`lumal-chart-panel__query`},_={key:1,class:`lumal-chart-panel__header`},v={key:0,class:`lumal-chart-panel__title`},y={class:`lumal-chart-panel__actions`},b={key:0,class:`lumal-chart-panel__view-toggle`,"aria-label":`图表展示方式`},x=[`aria-pressed`],S=[`aria-pressed`],C=[`aria-busy`,`aria-describedby`],w={key:0,class:`lumal-chart-panel__status`,role:`status`},T={key:1,class:`lumal-chart-panel__status is-error`,role:`alert`},E={key:2,class:`lumal-chart-panel__status`,role:`status`},D=f((0,c.defineComponent)({__name:`LumalChartPanel`,props:(0,c.mergeModels)({title:{default:``},options:{default:void 0},loading:{type:Boolean,default:!1},noData:{type:Boolean,default:!1},emptyText:{default:`暂无数据`},height:{default:`320px`},chartWidth:{default:void 0},tableWidth:{default:void 0},error:{type:[Boolean,Error,String],default:!1},errorText:{default:`数据加载失败`},retryText:{default:`重新加载`},summary:{default:``},showExport:{type:Boolean,default:!1},showViewToggle:{type:Boolean,default:!1},animation:{type:Boolean,default:void 0}},{view:{default:`chart`},viewModifiers:{}}),emits:(0,c.mergeModels)([`export`,`retry`],[`update:view`]),setup(e,{expose:t,emit:n}){let r=e,i=n,a=(0,c.useModel)(e,`view`),o=(0,c.useTemplateRef)(`chartRef`),s=`lumal-chart-summary-${(0,c.useId)()}`,l=(0,c.computed)(()=>r.error instanceof Error?r.error.message||r.errorText:typeof r.error==`string`?r.error:r.errorText),u=(0,c.computed)(()=>h({chartWidth:r.chartWidth,tableWidth:r.tableWidth}));return t({resize:()=>o.value?.resize()}),(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`section`,{class:`lumal-chart-panel`,style:(0,c.normalizeStyle)(u.value)},[t.$slots.query?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,g,[(0,c.renderSlot)(t.$slots,`query`,{},void 0,!0)])):(0,c.createCommentVNode)(``,!0),e.title||t.$slots.actions||e.showExport||e.showViewToggle?((0,c.openBlock)(),(0,c.createElementBlock)(`header`,_,[e.title?((0,c.openBlock)(),(0,c.createElementBlock)(`h4`,v,(0,c.toDisplayString)(e.title),1)):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,y,[(0,c.renderSlot)(t.$slots,`actions`,{},void 0,!0),e.showViewToggle?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,b,[(0,c.createElementVNode)(`button`,{type:`button`,"aria-pressed":a.value===`chart`,onClick:n[0]||=e=>a.value=`chart`},` 图表 `,8,x),(0,c.createElementVNode)(`button`,{type:`button`,"aria-pressed":a.value===`table`,onClick:n[1]||=e=>a.value=`table`},` 表格 `,8,S)])):(0,c.createCommentVNode)(``,!0),e.showExport?((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:1,type:`button`,onClick:n[2]||=e=>i(`export`,a.value)},` 导出 `)):(0,c.createCommentVNode)(``,!0)])])):(0,c.createCommentVNode)(``,!0),e.summary?((0,c.openBlock)(),(0,c.createElementBlock)(`p`,{key:2,id:s,class:`lumal-chart-panel__summary`},(0,c.toDisplayString)(e.summary),1)):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,{class:(0,c.normalizeClass)([`lumal-chart-panel__body`,`is-${a.value}`]),style:(0,c.normalizeStyle)({height:e.height}),"aria-busy":e.loading,"aria-describedby":e.summary?s:void 0},[e.loading?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,w,[(0,c.renderSlot)(t.$slots,`loading`,{},()=>[n[4]||=(0,c.createTextVNode)(` 加载中… `,-1)],!0)])):e.error?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,T,[(0,c.renderSlot)(t.$slots,`error`,{message:l.value,retry:()=>i(`retry`)},()=>[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(l.value),1),(0,c.createElementVNode)(`button`,{type:`button`,onClick:n[3]||=e=>i(`retry`)},(0,c.toDisplayString)(e.retryText),1)],!0)])):e.noData?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,E,[(0,c.renderSlot)(t.$slots,`empty`,{},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.emptyText),1)],!0)])):a.value===`table`?(0,c.renderSlot)(t.$slots,`table`,{key:3},void 0,!0):e.options?((0,c.openBlock)(),(0,c.createBlock)(p,{key:4,ref_key:`chartRef`,ref:o,options:e.options,height:e.height,animation:e.animation,"aria-label":e.title||`数据图表`},null,8,[`options`,`height`,`animation`,`aria-label`])):(0,c.renderSlot)(t.$slots,`chart`,{key:5},void 0,!0)],14,C)],4))}}),[[`__scopeId`,`data-v-d3152c00`]]);function O(e,t,n={}){if(n.enabled===!1)return;let r,i=0,a=!1;function o(){let e=t?.value;return!e||e.clientWidth>0&&e.clientHeight>0}function s(){i&&=(typeof cancelAnimationFrame==`function`?cancelAnimationFrame(i):clearTimeout(i),0)}function l(){if(!o())return;s();let t=()=>{i=0,o()&&e.value?.resize()};i=typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,16)}function u(e){r?.disconnect(),r=void 0,e&&typeof ResizeObserver<`u`&&(r=new ResizeObserver(l),r.observe(e)),l()}function d(){a||typeof window>`u`||(window.addEventListener(`resize`,l,{passive:!0}),a=!0)}function f(){!a||typeof window>`u`||(window.removeEventListener(`resize`,l),a=!1)}(0,c.watch)(e,l,{flush:`post`}),(0,c.onMounted)(()=>{t&&typeof ResizeObserver<`u`?(u(t.value),(0,c.watch)(t,u)):(d(),l())}),(0,c.onBeforeUnmount)(()=>{s(),r?.disconnect(),f()})}function k(e,t){let n=e;return n.install=function(n){n.component(t,e)},n}var A=k(p,`LumalChart`),j=k(D,`LumalChartPanel`);exports.LumalChart=A,exports.LumalChartPanel=j,exports.resolveChartPanelStyle=h,exports.useChartResize=O;
package/dist/index.js CHANGED
@@ -1,24 +1,8 @@
1
- import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, mergeModels as s, nextTick as c, normalizeClass as l, normalizeStyle as u, onBeforeUnmount as d, onMounted as f, openBlock as p, renderSlot as m, shallowRef as h, toDisplayString as g, unref as _, useId as v, useModel as y, useTemplateRef as b, watch as x } from "vue";
2
- import S from "vue-echarts";
3
- //#region src/useChartResize.ts
4
- function C(e, t, n = {}) {
5
- if (n.enabled === !1) return;
6
- let r;
7
- function i() {
8
- e.value?.resize();
9
- }
10
- function a(e) {
11
- r?.disconnect(), e && typeof ResizeObserver < "u" && (r = new ResizeObserver(() => i()), r.observe(e));
12
- }
13
- f(() => {
14
- t && (a(t.value), x(t, (e) => a(e))), typeof window < "u" && window.addEventListener("resize", i);
15
- }), d(() => {
16
- r?.disconnect(), typeof window < "u" && window.removeEventListener("resize", i);
17
- });
18
- }
19
- //#endregion
1
+ import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, mergeModels as s, mergeProps as c, nextTick as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, openBlock as m, renderSlot as h, shallowRef as g, toDisplayString as _, unref as v, useAttrs as y, useId as b, useModel as x, useTemplateRef as S, watch as C } from "vue";
2
+ import w from "vue-echarts";
20
3
  //#region src/LumalChart.vue?vue&type=script&setup=true&lang.ts
21
- var w = ["aria-label"], T = /*@__PURE__*/ o({
4
+ var T = ["aria-label"], E = /*@__PURE__*/ o({
5
+ inheritAttrs: !1,
22
6
  __name: "LumalChart",
23
7
  props: {
24
8
  options: {},
@@ -36,85 +20,91 @@ var w = ["aria-label"], T = /*@__PURE__*/ o({
36
20
  height: { default: "100%" }
37
21
  },
38
22
  setup(i, { expose: a }) {
39
- let o = i, s = h(!1), l = h(!1), m = e(() => ({
23
+ let o = i, s = g(!1), h = g(!1), _ = e(() => ({
40
24
  ...o.options,
41
- animation: o.animation ?? !l.value
42
- })), g;
43
- function v(e) {
44
- l.value = e.matches;
25
+ animation: o.animation ?? o.options.animation ?? !h.value
26
+ })), b;
27
+ function x(e) {
28
+ h.value = e.matches;
45
29
  }
46
- let y = b("chartRef");
47
- return f(() => {
48
- typeof window < "u" && typeof window.matchMedia == "function" && (g = window.matchMedia("(prefers-reduced-motion: reduce)"), v(g), g.addEventListener?.("change", v)), c(() => {
30
+ let C = S("chartRef");
31
+ p(() => {
32
+ typeof window < "u" && typeof window.matchMedia == "function" && (b = window.matchMedia("(prefers-reduced-motion: reduce)"), x(b), b.addEventListener?.("change", x)), l(() => {
49
33
  s.value = !0;
50
34
  });
51
- }), d(() => {
52
- g?.removeEventListener?.("change", v);
53
- }), C(y), a({ resize: () => y.value?.resize() }), (e, a) => (p(), r("div", {
54
- class: "lumal-chart",
35
+ }), f(() => {
36
+ b?.removeEventListener?.("change", x);
37
+ });
38
+ let E = y();
39
+ function D() {
40
+ return Object.fromEntries(Object.entries(E).filter(([e]) => e !== "class" && e !== "style"));
41
+ }
42
+ return a({ resize: () => C.value?.resize() }), (e, a) => (m(), r("div", {
43
+ class: u(["lumal-chart", e.$attrs.class]),
55
44
  role: "img",
56
45
  "aria-label": i.ariaLabel,
57
- style: u({
46
+ style: d([e.$attrs.style, {
58
47
  height: i.height,
59
48
  width: i.width
60
- })
61
- }, [s.value ? (p(), t(_(S), {
49
+ }])
50
+ }, [s.value ? (m(), t(v(w), c({
62
51
  key: 0,
63
52
  ref_key: "chartRef",
64
- ref: y,
53
+ ref: C
54
+ }, D(), {
65
55
  class: "lumal-chart__canvas",
66
- option: m.value,
56
+ option: _.value,
67
57
  "update-options": i.updateOptions,
68
58
  autoresize: i.autoResize
69
- }, null, 8, [
59
+ }), null, 16, [
70
60
  "option",
71
61
  "update-options",
72
62
  "autoresize"
73
- ])) : n("", !0)], 12, w));
63
+ ])) : n("", !0)], 14, T));
74
64
  }
75
- }), E = (e, t) => {
65
+ }), D = (e, t) => {
76
66
  let n = e.__vccOpts || e;
77
67
  for (let [e, r] of t) n[e] = r;
78
68
  return n;
79
- }, D = /*#__PURE__*/ E(T, [["__scopeId", "data-v-648e0699"]]);
69
+ }, O = /*#__PURE__*/ D(E, [["__scopeId", "data-v-f9365923"]]);
80
70
  //#endregion
81
71
  //#region src/panel-style.ts
82
- function O(e) {
72
+ function k(e) {
83
73
  if (typeof e == "number") return Number.isFinite(e) ? `${e}px` : void 0;
84
74
  if (typeof e == "string" && e.trim()) return e;
85
75
  }
86
- function k(e) {
87
- let t = O(e.chartWidth), n = O(e.tableWidth), r = {};
76
+ function A(e) {
77
+ let t = k(e.chartWidth), n = k(e.tableWidth), r = {};
88
78
  return t && (r["--lumal-chart-panel-chart-width"] = t), n && (r["--lumal-chart-panel-table-width"] = n), Object.keys(r).length > 0 ? r : void 0;
89
79
  }
90
80
  //#endregion
91
81
  //#region src/LumalChartPanel.vue?vue&type=script&setup=true&lang.ts
92
- var A = {
82
+ var j = {
93
83
  key: 0,
94
84
  class: "lumal-chart-panel__query"
95
- }, j = {
85
+ }, M = {
96
86
  key: 1,
97
87
  class: "lumal-chart-panel__header"
98
- }, M = {
88
+ }, N = {
99
89
  key: 0,
100
90
  class: "lumal-chart-panel__title"
101
- }, N = { class: "lumal-chart-panel__actions" }, P = {
91
+ }, P = { class: "lumal-chart-panel__actions" }, F = {
102
92
  key: 0,
103
93
  class: "lumal-chart-panel__view-toggle",
104
94
  "aria-label": "图表展示方式"
105
- }, F = ["aria-pressed"], I = ["aria-pressed"], L = ["aria-busy", "aria-describedby"], R = {
95
+ }, I = ["aria-pressed"], L = ["aria-pressed"], R = ["aria-busy", "aria-describedby"], z = {
106
96
  key: 0,
107
97
  class: "lumal-chart-panel__status",
108
98
  role: "status"
109
- }, z = {
99
+ }, B = {
110
100
  key: 1,
111
101
  class: "lumal-chart-panel__status is-error",
112
102
  role: "alert"
113
- }, B = {
103
+ }, V = {
114
104
  key: 2,
115
105
  class: "lumal-chart-panel__status",
116
106
  role: "status"
117
- }, V = /*#__PURE__*/ E(/* @__PURE__ */ o({
107
+ }, H = /*#__PURE__*/ D(/* @__PURE__ */ o({
118
108
  __name: "LumalChartPanel",
119
109
  props: /*@__PURE__*/ s({
120
110
  title: { default: "" },
@@ -160,52 +150,52 @@ var A = {
160
150
  }),
161
151
  emits: /*@__PURE__*/ s(["export", "retry"], ["update:view"]),
162
152
  setup(o, { expose: s, emit: c }) {
163
- let d = o, f = c, h = y(o, "view"), _ = b("chartRef"), x = `lumal-chart-summary-${v()}`, S = e(() => d.error instanceof Error ? d.error.message || d.errorText : typeof d.error == "string" ? d.error : d.errorText), C = e(() => k({
164
- chartWidth: d.chartWidth,
165
- tableWidth: d.tableWidth
153
+ let l = o, f = c, p = x(o, "view"), g = S("chartRef"), v = `lumal-chart-summary-${b()}`, y = e(() => l.error instanceof Error ? l.error.message || l.errorText : typeof l.error == "string" ? l.error : l.errorText), C = e(() => A({
154
+ chartWidth: l.chartWidth,
155
+ tableWidth: l.tableWidth
166
156
  }));
167
- return s({ resize: () => _.value?.resize() }), (e, s) => (p(), r("section", {
157
+ return s({ resize: () => g.value?.resize() }), (e, s) => (m(), r("section", {
168
158
  class: "lumal-chart-panel",
169
- style: u(C.value)
159
+ style: d(C.value)
170
160
  }, [
171
- e.$slots.query ? (p(), r("div", A, [m(e.$slots, "query", {}, void 0, !0)])) : n("", !0),
172
- o.title || e.$slots.actions || o.showExport || o.showViewToggle ? (p(), r("header", j, [o.title ? (p(), r("h4", M, g(o.title), 1)) : n("", !0), i("div", N, [
173
- m(e.$slots, "actions", {}, void 0, !0),
174
- o.showViewToggle ? (p(), r("div", P, [i("button", {
161
+ e.$slots.query ? (m(), r("div", j, [h(e.$slots, "query", {}, void 0, !0)])) : n("", !0),
162
+ o.title || e.$slots.actions || o.showExport || o.showViewToggle ? (m(), r("header", M, [o.title ? (m(), r("h4", N, _(o.title), 1)) : n("", !0), i("div", P, [
163
+ h(e.$slots, "actions", {}, void 0, !0),
164
+ o.showViewToggle ? (m(), r("div", F, [i("button", {
175
165
  type: "button",
176
- "aria-pressed": h.value === "chart",
177
- onClick: s[0] ||= (e) => h.value = "chart"
178
- }, " 图表 ", 8, F), i("button", {
166
+ "aria-pressed": p.value === "chart",
167
+ onClick: s[0] ||= (e) => p.value = "chart"
168
+ }, " 图表 ", 8, I), i("button", {
179
169
  type: "button",
180
- "aria-pressed": h.value === "table",
181
- onClick: s[1] ||= (e) => h.value = "table"
182
- }, " 表格 ", 8, I)])) : n("", !0),
183
- o.showExport ? (p(), r("button", {
170
+ "aria-pressed": p.value === "table",
171
+ onClick: s[1] ||= (e) => p.value = "table"
172
+ }, " 表格 ", 8, L)])) : n("", !0),
173
+ o.showExport ? (m(), r("button", {
184
174
  key: 1,
185
175
  type: "button",
186
- onClick: s[2] ||= (e) => f("export", h.value)
176
+ onClick: s[2] ||= (e) => f("export", p.value)
187
177
  }, " 导出 ")) : n("", !0)
188
178
  ])])) : n("", !0),
189
- o.summary ? (p(), r("p", {
179
+ o.summary ? (m(), r("p", {
190
180
  key: 2,
191
- id: x,
181
+ id: v,
192
182
  class: "lumal-chart-panel__summary"
193
- }, g(o.summary), 1)) : n("", !0),
183
+ }, _(o.summary), 1)) : n("", !0),
194
184
  i("div", {
195
- class: l(["lumal-chart-panel__body", `is-${h.value}`]),
196
- style: u({ height: o.height }),
185
+ class: u(["lumal-chart-panel__body", `is-${p.value}`]),
186
+ style: d({ height: o.height }),
197
187
  "aria-busy": o.loading,
198
- "aria-describedby": o.summary ? x : void 0
199
- }, [o.loading ? (p(), r("div", R, [m(e.$slots, "loading", {}, () => [s[4] ||= a(" 加载中… ", -1)], !0)])) : o.error ? (p(), r("div", z, [m(e.$slots, "error", {
200
- message: S.value,
188
+ "aria-describedby": o.summary ? v : void 0
189
+ }, [o.loading ? (m(), r("div", z, [h(e.$slots, "loading", {}, () => [s[4] ||= a(" 加载中… ", -1)], !0)])) : o.error ? (m(), r("div", B, [h(e.$slots, "error", {
190
+ message: y.value,
201
191
  retry: () => f("retry")
202
- }, () => [i("span", null, g(S.value), 1), i("button", {
192
+ }, () => [i("span", null, _(y.value), 1), i("button", {
203
193
  type: "button",
204
194
  onClick: s[3] ||= (e) => f("retry")
205
- }, g(o.retryText), 1)], !0)])) : o.noData ? (p(), r("div", B, [m(e.$slots, "empty", {}, () => [a(g(o.emptyText), 1)], !0)])) : h.value === "table" ? m(e.$slots, "table", { key: 3 }, void 0, !0) : o.options ? (p(), t(D, {
195
+ }, _(o.retryText), 1)], !0)])) : o.noData ? (m(), r("div", V, [h(e.$slots, "empty", {}, () => [a(_(o.emptyText), 1)], !0)])) : p.value === "table" ? h(e.$slots, "table", { key: 3 }, void 0, !0) : o.options ? (m(), t(O, {
206
196
  key: 4,
207
197
  ref_key: "chartRef",
208
- ref: _,
198
+ ref: g,
209
199
  options: o.options,
210
200
  height: o.height,
211
201
  animation: o.animation,
@@ -215,18 +205,53 @@ var A = {
215
205
  "height",
216
206
  "animation",
217
207
  "aria-label"
218
- ])) : m(e.$slots, "chart", { key: 5 }, void 0, !0)], 14, L)
208
+ ])) : h(e.$slots, "chart", { key: 5 }, void 0, !0)], 14, R)
219
209
  ], 4));
220
210
  }
221
- }), [["__scopeId", "data-v-f90a8d18"]]);
211
+ }), [["__scopeId", "data-v-d3152c00"]]);
212
+ //#endregion
213
+ //#region src/useChartResize.ts
214
+ function U(e, t, n = {}) {
215
+ if (n.enabled === !1) return;
216
+ let r, i = 0, a = !1;
217
+ function o() {
218
+ let e = t?.value;
219
+ return !e || e.clientWidth > 0 && e.clientHeight > 0;
220
+ }
221
+ function s() {
222
+ i &&= (typeof cancelAnimationFrame == "function" ? cancelAnimationFrame(i) : clearTimeout(i), 0);
223
+ }
224
+ function c() {
225
+ if (!o()) return;
226
+ s();
227
+ let t = () => {
228
+ i = 0, o() && e.value?.resize();
229
+ };
230
+ i = typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : setTimeout(t, 16);
231
+ }
232
+ function l(e) {
233
+ r?.disconnect(), r = void 0, e && typeof ResizeObserver < "u" && (r = new ResizeObserver(c), r.observe(e)), c();
234
+ }
235
+ function u() {
236
+ a || typeof window > "u" || (window.addEventListener("resize", c, { passive: !0 }), a = !0);
237
+ }
238
+ function d() {
239
+ !a || typeof window > "u" || (window.removeEventListener("resize", c), a = !1);
240
+ }
241
+ C(e, c, { flush: "post" }), p(() => {
242
+ t && typeof ResizeObserver < "u" ? (l(t.value), C(t, l)) : (u(), c());
243
+ }), f(() => {
244
+ s(), r?.disconnect(), d();
245
+ });
246
+ }
222
247
  //#endregion
223
248
  //#region src/index.ts
224
- function H(e, t) {
249
+ function W(e, t) {
225
250
  let n = e;
226
251
  return n.install = function(n) {
227
252
  n.component(t, e);
228
253
  }, n;
229
254
  }
230
- var U = H(D, "LumalChart"), W = H(V, "LumalChartPanel");
255
+ var G = W(O, "LumalChart"), K = W(H, "LumalChartPanel");
231
256
  //#endregion
232
- export { U as LumalChart, W as LumalChartPanel, k as resolveChartPanelStyle, C as useChartResize };
257
+ export { G as LumalChart, K as LumalChartPanel, A as resolveChartPanelStyle, U as useChartResize };
@@ -1 +1 @@
1
- {"version":3,"file":"LumalChart.vue.d.ts","sourceRoot":"","sources":["../../src/LumalChart.vue"],"names":[],"mappings":"AA8FA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAM3D,kDAAkD;AAClD,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,aAAa,CAAA;IACtB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAC;AAwHF,QAAA,MAAM,YAAY;;;mBA9HA,aAAa;gBAChB,OAAO;eACR,OAAO;eACP,MAAM;WACV,MAAM;YACL,MAAM;6EA6Hf,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"LumalChart.vue.d.ts","sourceRoot":"","sources":["../../src/LumalChart.vue"],"names":[],"mappings":"AAoGA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAO3D,kDAAkD;AAClD,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,aAAa,CAAA;IACtB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAC;AAgIF,QAAA,MAAM,YAAY;;;mBAtIA,aAAa;gBAChB,OAAO;eACR,OAAO;eACP,MAAM;WACV,MAAM;YACL,MAAM;6EAqIf,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -52,7 +52,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
52
52
  onRetry?: (() => any) | undefined;
53
53
  "onUpdate:view"?: ((value: "chart" | "table") => any) | undefined;
54
54
  }>, {
55
- error: boolean | Error | string;
56
55
  options: EChartsOption;
57
56
  animation: boolean;
58
57
  height: string;
@@ -63,6 +62,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
63
62
  emptyText: string;
64
63
  chartWidth: ChartPanelWidth;
65
64
  tableWidth: ChartPanelWidth;
65
+ error: boolean | Error | string;
66
66
  errorText: string;
67
67
  retryText: string;
68
68
  showExport: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"LumalChartPanel.vue.d.ts","sourceRoot":"","sources":["../../src/LumalChartPanel.vue"],"names":[],"mappings":"AAuPA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAKpD,kDAAkD;AAClD,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAC;AA+CF,KAAK,gBAAgB,GAAG;IACxB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAC1B,CAAC;AAsBF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AA6LxD,QAAA,IAAI,OAAO,IAAU,EAAE,OAAO,IAAU,EAAE,OAAO,IAAU,EAAE,OAAO;;;CAAU,EAAE,OAAO,IAAU,EAAE,QAAQ,IAAW,EAAuB,QAAQ,IAAY,CAAE;AACnK,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GAC3C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAO9C,QAAA,MAAM,UAAU;;;;;;;;;;;WA1RN,OAAO,GAAG,KAAK,GAAG,MAAM;aAPtB,aAAa;eAaX,OAAO;YATV,MAAM;WALP,MAAM;aAEJ,OAAO;aASP,MAAM;YARP,OAAO;eACJ,MAAM;gBAEL,eAAe;gBACf,eAAe;eAEhB,MAAM;eACN,MAAM;gBAEL,OAAO;oBACH,OAAO;6EA0RxB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"LumalChartPanel.vue.d.ts","sourceRoot":"","sources":["../../src/LumalChartPanel.vue"],"names":[],"mappings":"AA8PA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAKpD,kDAAkD;AAClD,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAC;AA+CF,KAAK,gBAAgB,GAAG;IACxB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAC1B,CAAC;AAsBF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AA8LxD,QAAA,IAAI,OAAO,IAAU,EAAE,OAAO,IAAU,EAAE,OAAO,IAAU,EAAE,OAAO;;;CAAU,EAAE,OAAO,IAAU,EAAE,QAAQ,IAAW,EAAuB,QAAQ,IAAY,CAAE;AACnK,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GAC3C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAO9C,QAAA,MAAM,UAAU;;;;;;;;;;;aAlSJ,aAAa;eAaX,OAAO;YATV,MAAM;WALP,MAAM;aAEJ,OAAO;aASP,MAAM;YARP,OAAO;eACJ,MAAM;gBAEL,eAAe;gBACf,eAAe;WACpB,OAAO,GAAG,KAAK,GAAG,MAAM;eACpB,MAAM;eACN,MAAM;gBAEL,OAAO;oBACH,OAAO;6EA2RxB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -9,7 +9,8 @@ export interface UseChartResizeOptions {
9
9
  }
10
10
  /**
11
11
  * 监听容器尺寸变化并触发图表实例 resize。
12
- * 优先使用 ResizeObserver 观察容器元素,回退到 window resize 事件。
12
+ * 优先使用 ResizeObserver 观察容器元素;浏览器不支持或未提供容器时,
13
+ * 回退到 window resize。隐藏 Tab、折叠区域和过渡中的 0×0 容器不会触发 resize。
13
14
  */
14
15
  export declare function useChartResize(chartRef: Ref<ChartResizeTarget | null | undefined>, containerRef?: Ref<HTMLElement | null | undefined>, options?: UseChartResizeOptions): void;
15
16
  //# sourceMappingURL=useChartResize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useChartResize.d.ts","sourceRoot":"","sources":["../../src/useChartResize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,sBAAsB;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,GAAG,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,EACnD,YAAY,CAAC,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,EAClD,OAAO,GAAE,qBAA0B,GAClC,IAAI,CAsCN"}
1
+ {"version":3,"file":"useChartResize.d.ts","sourceRoot":"","sources":["../../src/useChartResize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,sBAAsB;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,GAAG,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,EACnD,YAAY,CAAC,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,EAClD,OAAO,GAAE,qBAA0B,GAClC,IAAI,CAgFN"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lumal/charts",
3
3
  "type": "module",
4
- "version": "0.0.1-beta",
4
+ "version": "0.0.3-beta",
5
5
  "description": "Lumal optional ECharts-based chart components.",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -29,17 +29,18 @@
29
29
  "module": "./dist/index.js",
30
30
  "types": "./dist/src/index.d.ts",
31
31
  "files": [
32
+ "CHANGELOG.md",
32
33
  "README.md",
33
34
  "dist"
34
35
  ],
35
36
  "peerDependencies": {
36
- "echarts": "^5.5.0",
37
+ "echarts": "^6.0.0",
37
38
  "vue": "^3.5.0",
38
- "vue-echarts": "^7.0.0"
39
+ "vue-echarts": "^8.0.0"
39
40
  },
40
41
  "devDependencies": {
41
- "echarts": "^5.5.0",
42
- "vue-echarts": "^7.0.3"
42
+ "echarts": "^6.1.0",
43
+ "vue-echarts": "^8.3.2"
43
44
  },
44
45
  "scripts": {
45
46
  "build": "vite build --config vite.config.ts && vue-tsc -p tsconfig.json --emitDeclarationOnly --outDir dist && node ../../scripts/clean-package-dist.mjs dist",