@easy-editor/materials-dashboard-gauge-chart 0.0.2 → 0.0.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 (46) hide show
  1. package/.vite/echarts-external-plugin.ts +61 -0
  2. package/CHANGELOG.md +21 -7
  3. package/easypack.config.ts +19 -0
  4. package/package.json +4 -8
  5. package/src/component.tsx +88 -41
  6. package/src/configure.ts +140 -285
  7. package/src/index.tsx +7 -7
  8. package/src/meta.ts +3 -3
  9. package/src/snippets.ts +69 -55
  10. package/tsconfig.json +20 -9
  11. package/.vite/plugins/vite-plugin-external-deps.ts +0 -224
  12. package/.vite/plugins/vite-plugin-material-dev.ts +0 -218
  13. package/dist/component.esm.js +0 -28857
  14. package/dist/component.esm.js.map +0 -1
  15. package/dist/component.js +0 -28864
  16. package/dist/component.js.map +0 -1
  17. package/dist/component.min.js +0 -24
  18. package/dist/component.min.js.map +0 -1
  19. package/dist/index.cjs +0 -29174
  20. package/dist/index.cjs.map +0 -1
  21. package/dist/index.esm.js +0 -29171
  22. package/dist/index.esm.js.map +0 -1
  23. package/dist/index.js +0 -29178
  24. package/dist/index.js.map +0 -1
  25. package/dist/index.min.js +0 -24
  26. package/dist/index.min.js.map +0 -1
  27. package/dist/meta.esm.js +0 -319
  28. package/dist/meta.esm.js.map +0 -1
  29. package/dist/meta.js +0 -329
  30. package/dist/meta.js.map +0 -1
  31. package/dist/meta.min.js +0 -2
  32. package/dist/meta.min.js.map +0 -1
  33. package/dist/src/component.d.ts +0 -19
  34. package/dist/src/configure.d.ts +0 -7
  35. package/dist/src/constants.d.ts +0 -28
  36. package/dist/src/index.d.ts +0 -6
  37. package/dist/src/meta.d.ts +0 -3
  38. package/dist/src/snippets.d.ts +0 -3
  39. package/dist/src/types.d.ts +0 -50
  40. package/dist/src/utils.d.ts +0 -28
  41. package/rollup.config.js +0 -212
  42. package/src/types.ts +0 -55
  43. package/src/utils.ts +0 -57
  44. package/tsconfig.build.json +0 -12
  45. package/tsconfig.test.json +0 -7
  46. package/vite.config.ts +0 -54
package/dist/meta.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"meta.js","sources":["../../../../shared/src/index.ts","../src/constants.ts","../src/configure.ts","../src/snippets.ts","../src/meta.ts"],"sourcesContent":["/**\n * Shared types, components and utilities for EasyEditor materials\n * @package @easy-editor/materials-shared\n */\n\n// 物料分组常量\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DISPLAY: 'display',\n /** 媒体 */\n MEDIA: 'media',\n /** 交互 */\n INTERACTION: 'interaction',\n /** 地图 */\n MAP: 'map',\n} as const\n\nexport type MaterialGroup = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n\n// 工具函数\nexport { cn } from './lib/utils'\n\nexport * from './types'\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsGaugeChart'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-gauge-chart'\n\n/**\n * 指针类型\n */\nexport const POINTER_TYPES = ['needle', 'triangle', 'rect'] as const\n\n/**\n * 颜色区间类型\n */\nexport interface GaugeRange {\n from: number\n to: number\n color: string\n}\n\n/**\n * 默认颜色区间\n */\nexport const DEFAULT_RANGES: GaugeRange[] = [\n { from: 0, to: 40, color: '#00ff88' },\n { from: 40, to: 70, color: '#ffcc00' },\n { from: 70, to: 100, color: '#ff4444' },\n]\n","/**\n * Gauge Chart Configure\n * 仪表盘组件配置\n */\n\nimport type { Configure } from '@easy-editor/core'\n\nconst configure: Configure = {\n props: [\n {\n type: 'group',\n title: '属性',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'config',\n title: '配置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n // 基础配置\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n extraProps: {\n // @ts-expect-error label is not a valid extra prop\n label: false,\n },\n },\n {\n name: 'title',\n title: '标题',\n setter: 'StringSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('title')\n },\n setValue(target, value) {\n target.setExtraPropValue('title', value)\n },\n },\n },\n {\n type: 'group',\n title: '基础属性',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'rect',\n title: '位置尺寸',\n setter: 'RectSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('$dashboard.rect')\n },\n setValue(target, value) {\n target.setExtraPropValue('$dashboard.rect', value)\n },\n },\n },\n ],\n },\n // 组件配置\n {\n type: 'group',\n title: '数值',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'value',\n title: '当前值',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 0,\n },\n },\n {\n name: 'min',\n title: '最小值',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 0,\n },\n },\n {\n name: 'max',\n title: '最大值',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 100,\n },\n },\n {\n name: 'unit',\n title: '单位',\n setter: 'StringSetter',\n },\n ],\n },\n {\n type: 'group',\n title: '数值格式',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'valuePrefix',\n title: '前缀',\n setter: 'StringSetter',\n },\n {\n name: 'valueSuffix',\n title: '后缀',\n setter: 'StringSetter',\n },\n {\n name: 'valueDecimals',\n title: '小数位数',\n setter: {\n componentName: 'NumberSetter',\n props: {\n suffix: '位',\n },\n },\n extraProps: {\n defaultValue: 0,\n },\n },\n {\n name: 'valueSeparator',\n title: '千分位分隔',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n ],\n },\n {\n type: 'group',\n title: '刻度',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'showScale',\n title: '显示刻度',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n },\n },\n {\n name: 'divisions',\n title: '刻度数量',\n setter: {\n componentName: 'SliderSetter',\n props: {\n min: 2,\n max: 20,\n step: 1,\n },\n },\n extraProps: {\n defaultValue: 10,\n },\n },\n {\n name: 'showLabels',\n title: '显示刻度值',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n },\n },\n ],\n },\n {\n type: 'group',\n title: '样式',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'pointerType',\n title: '指针类型',\n setter: {\n componentName: 'SegmentedSetter',\n props: {\n options: [\n { label: '针形', value: 'needle' },\n { label: '三角形', value: 'triangle' },\n { label: '矩形', value: 'rect' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'needle',\n },\n },\n {\n name: 'pointerColor',\n title: '指针颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: '#ffffff',\n },\n },\n {\n name: 'glowEffect',\n title: '发光效果',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'data',\n title: '数据',\n items: [\n {\n name: 'dataBinding',\n title: '数据绑定',\n setter: 'DataBindingSetter',\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n name: 'condition',\n title: '显隐控制',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n supportVariable: true,\n },\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {},\n}\n\nexport default configure\n","import type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nconst snippets: Snippet[] = [\n {\n title: '仪表盘',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n value: 65,\n min: 0,\n max: 100,\n showScale: true,\n divisions: 10,\n showLabels: true,\n pointerType: 'needle',\n pointerColor: '#ffffff',\n },\n $dashboard: {\n rect: {\n width: 220,\n height: 140,\n },\n },\n },\n },\n {\n title: '发光仪表盘',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n value: 78,\n min: 0,\n max: 100,\n unit: '%',\n showScale: true,\n divisions: 10,\n showLabels: true,\n pointerType: 'needle',\n pointerColor: '#00ffff',\n glowEffect: true,\n },\n $dashboard: {\n rect: {\n width: 220,\n height: 140,\n },\n },\n },\n },\n]\n\nexport default snippets\n","import type { ComponentMetadata } from '@easy-editor/core'\nimport { MaterialGroup } from '@easy-editor/materials-shared'\nimport { COMPONENT_NAME, PACKAGE_NAME } from './constants'\nimport configure from './configure'\nimport snippets from './snippets'\nimport pkg from '../package.json'\n\nconst meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: '仪表盘',\n group: MaterialGroup.CHART,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: pkg.version,\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n"],"names":["MaterialGroup","INNER","CHART","COMPONENT_NAME","PACKAGE_NAME","configure","props","type","title","setter","items","key","componentName","icon","name","extraProps","label","getValue","target","getExtraPropValue","setValue","value","setExtraPropValue","defaultValue","suffix","min","max","step","options","supportVariable","component","supports","advanced","snippets","screenshot","schema","showScale","divisions","showLabels","pointerType","pointerColor","$dashboard","rect","width","height","unit","glowEffect","meta","group","devMode","npm","package","version","pkg","globalName"],"mappings":";;;;;;;EAMO,MAAMA,aAAa,GAAG;EAE3BC,EAIAC,KAAK,EAAE,OAST,CAAU;;ECbH,MAAMC,cAAc,GAAG,+BAA+B;EAKtD,MAAMC,YAAY,GAAG,8CAA8C;;ECN1E,MAAMC,SAAoB,GAAG;EAC3BC,EAAAA,KAAK,EAAE,CACL;EACEC,IAAAA,IAAI,EAAE,OAAO;EACbC,IAAAA,K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&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsGaugeChartMeta={})}(this,function(e){"use strict";const t="EasyEditorMaterialsGaugeChart";const r={componentName:t,title:"仪表盘",group:"chart",devMode:"proCode",npm:{package:"@easy-editor/materials-dashboard-gauge-chart",version:"0.0.1",globalName:t,componentName:t},snippets:[{title:"仪表盘",screenshot:"",schema:{componentName:t,props:{value:65,min:0,max:100,showScale:!0,divisions:10,showLabels:!0,pointerType:"needle",pointerColor:"#ffffff"},$dashboard:{rect:{width:220,height:140}}}},{title:"发光仪表盘",screenshot:"",schema:{componentName:t,props:{value:78,min:0,max:100,unit:"%",showScale:!0,divisions:10,showLabels:!0,pointerType:"needle",pointerColor:"#00ffff",glowEffect:!0},$dashboard:{rect:{width:220,height:140}}}}],configure:{props:[{type:"group",title:"属性",setter:"TabSetter",items:[{type:"group",key:"config",title:"配置",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"id",title:"ID",setter:"NodeIdSetter",extraProps:{label:!1}},{name:"title",title:"标题",setter:"StringSetter",extraProps:{getValue:e=>e.getExtraPropValue("title"),setValue(e,t){e.setExtraPropValue("title",t)}}},{type:"group",title:"基础属性",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"rect",title:"位置尺寸",setter:"RectSetter",extraProps:{getValue:e=>e.getExtraPropValue("$dashboard.rect"),setValue(e,t){e.setExtraPropValue("$dashboard.rect",t)}}}]},{type:"group",title:"数值",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"value",title:"当前值",setter:"NumberSetter",extraProps:{defaultValue:0}},{name:"min",title:"最小值",setter:"NumberSetter",extraProps:{defaultValue:0}},{name:"max",title:"最大值",setter:"NumberSetter",extraProps:{defaultValue:100}},{name:"unit",title:"单位",setter:"StringSetter"}]},{type:"group",title:"数值格式",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"valuePrefix",title:"前缀",setter:"StringSetter"},{name:"valueSuffix",title:"后缀",setter:"StringSetter"},{name:"valueDecimals",title:"小数位数",setter:{componentName:"NumberSetter",props:{suffix:"位"}},extraProps:{defaultValue:0}},{name:"valueSeparator",title:"千分位分隔",setter:"SwitchSetter",extraProps:{defaultValue:!1}}]},{type:"group",title:"刻度",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"showScale",title:"显示刻度",setter:"SwitchSetter",extraProps:{defaultValue:!0}},{name:"divisions",title:"刻度数量",setter:{componentName:"SliderSetter",props:{min:2,max:20,step:1}},extraProps:{defaultValue:10}},{name:"showLabels",title:"显示刻度值",setter:"SwitchSetter",extraProps:{defaultValue:!0}}]},{type:"group",title:"样式",setter:{componentName:"CollapseSetter",props:{icon:!1}},items:[{name:"pointerType",title:"指针类型",setter:{componentName:"SegmentedSetter",props:{options:[{label:"针形",value:"needle"},{label:"三角形",value:"triangle"},{label:"矩形",value:"rect"}]}},extraProps:{defaultValue:"needle"}},{name:"pointerColor",title:"指针颜色",setter:"ColorSetter",extraProps:{defaultValue:"#ffffff"}},{name:"glowEffect",title:"发光效果",setter:"SwitchSetter",extraProps:{defaultValue:!1}}]}]},{type:"group",key:"data",title:"数据",items:[{name:"dataBinding",title:"数据绑定",setter:"DataBindingSetter"}]},{type:"group",key:"advanced",title:"高级",items:[{name:"condition",title:"显隐控制",setter:"SwitchSetter",extraProps:{defaultValue:!0,supportVariable:!0}}]}]}],component:{},supports:{},advanced:{}}};e.default=r,Object.defineProperty(e,"__esModule",{value:!0})});
2
- //# sourceMappingURL=meta.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meta.min.js","sources":["../../../../shared/src/index.ts","../src/constants.ts","../src/meta.ts","../src/snippets.ts","../src/configure.ts"],"sourcesContent":["/**\n * Shared types, components and utilities for EasyEditor materials\n * @package @easy-editor/materials-shared\n */\n\n// 物料分组常量\nexport const MaterialGroup = {\n /** 内置 */\n INNER: 'inner',\n /** 基础 */\n BASIC: 'basic',\n /** 图表 */\n CHART: 'chart',\n /** 数据展示 */\n DISPLAY: 'display',\n /** 媒体 */\n MEDIA: 'media',\n /** 交互 */\n INTERACTION: 'interaction',\n /** 地图 */\n MAP: 'map',\n} as const\n\nexport type MaterialGroup = (typeof MaterialGroup)[keyof typeof MaterialGroup]\n\n// 工具函数\nexport { cn } from './lib/utils'\n\nexport * from './types'\n","/**\n * 物料常量配置\n * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值\n */\n\n/**\n * UMD 全局变量基础名称\n */\nexport const COMPONENT_NAME = 'EasyEditorMaterialsGaugeChart'\n\n/**\n * 包名\n */\nexport const PACKAGE_NAME = '@easy-editor/materials-dashboard-gauge-chart'\n\n/**\n * 指针类型\n */\nexport const POINTER_TYPES = ['needle', 'triangle', 'rect'] as const\n\n/**\n * 颜色区间类型\n */\nexport interface GaugeRange {\n from: number\n to: number\n color: string\n}\n\n/**\n * 默认颜色区间\n */\nexport const DEFAULT_RANGES: GaugeRange[] = [\n { from: 0, to: 40, color: '#00ff88' },\n { from: 40, to: 70, color: '#ffcc00' },\n { from: 70, to: 100, color: '#ff4444' },\n]\n","import type { ComponentMetadata } from '@easy-editor/core'\nimport { MaterialGroup } from '@easy-editor/materials-shared'\nimport { COMPONENT_NAME, PACKAGE_NAME } from './constants'\nimport configure from './configure'\nimport snippets from './snippets'\nimport pkg from '../package.json'\n\nconst meta: ComponentMetadata = {\n componentName: COMPONENT_NAME,\n title: '仪表盘',\n group: MaterialGroup.CHART,\n devMode: 'proCode',\n npm: {\n package: PACKAGE_NAME,\n version: pkg.version,\n globalName: COMPONENT_NAME,\n componentName: COMPONENT_NAME,\n },\n snippets,\n configure,\n}\n\nexport default meta\n","import type { Snippet } from '@easy-editor/core'\nimport { COMPONENT_NAME } from './constants'\n\nconst snippets: Snippet[] = [\n {\n title: '仪表盘',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n value: 65,\n min: 0,\n max: 100,\n showScale: true,\n divisions: 10,\n showLabels: true,\n pointerType: 'needle',\n pointerColor: '#ffffff',\n },\n $dashboard: {\n rect: {\n width: 220,\n height: 140,\n },\n },\n },\n },\n {\n title: '发光仪表盘',\n screenshot: '',\n schema: {\n componentName: COMPONENT_NAME,\n props: {\n value: 78,\n min: 0,\n max: 100,\n unit: '%',\n showScale: true,\n divisions: 10,\n showLabels: true,\n pointerType: 'needle',\n pointerColor: '#00ffff',\n glowEffect: true,\n },\n $dashboard: {\n rect: {\n width: 220,\n height: 140,\n },\n },\n },\n },\n]\n\nexport default snippets\n","/**\n * Gauge Chart Configure\n * 仪表盘组件配置\n */\n\nimport type { Configure } from '@easy-editor/core'\n\nconst configure: Configure = {\n props: [\n {\n type: 'group',\n title: '属性',\n setter: 'TabSetter',\n items: [\n {\n type: 'group',\n key: 'config',\n title: '配置',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n // 基础配置\n {\n name: 'id',\n title: 'ID',\n setter: 'NodeIdSetter',\n extraProps: {\n // @ts-expect-error label is not a valid extra prop\n label: false,\n },\n },\n {\n name: 'title',\n title: '标题',\n setter: 'StringSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('title')\n },\n setValue(target, value) {\n target.setExtraPropValue('title', value)\n },\n },\n },\n {\n type: 'group',\n title: '基础属性',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'rect',\n title: '位置尺寸',\n setter: 'RectSetter',\n extraProps: {\n getValue(target) {\n return target.getExtraPropValue('$dashboard.rect')\n },\n setValue(target, value) {\n target.setExtraPropValue('$dashboard.rect', value)\n },\n },\n },\n ],\n },\n // 组件配置\n {\n type: 'group',\n title: '数值',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'value',\n title: '当前值',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 0,\n },\n },\n {\n name: 'min',\n title: '最小值',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 0,\n },\n },\n {\n name: 'max',\n title: '最大值',\n setter: 'NumberSetter',\n extraProps: {\n defaultValue: 100,\n },\n },\n {\n name: 'unit',\n title: '单位',\n setter: 'StringSetter',\n },\n ],\n },\n {\n type: 'group',\n title: '数值格式',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'valuePrefix',\n title: '前缀',\n setter: 'StringSetter',\n },\n {\n name: 'valueSuffix',\n title: '后缀',\n setter: 'StringSetter',\n },\n {\n name: 'valueDecimals',\n title: '小数位数',\n setter: {\n componentName: 'NumberSetter',\n props: {\n suffix: '位',\n },\n },\n extraProps: {\n defaultValue: 0,\n },\n },\n {\n name: 'valueSeparator',\n title: '千分位分隔',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n ],\n },\n {\n type: 'group',\n title: '刻度',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'showScale',\n title: '显示刻度',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n },\n },\n {\n name: 'divisions',\n title: '刻度数量',\n setter: {\n componentName: 'SliderSetter',\n props: {\n min: 2,\n max: 20,\n step: 1,\n },\n },\n extraProps: {\n defaultValue: 10,\n },\n },\n {\n name: 'showLabels',\n title: '显示刻度值',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n },\n },\n ],\n },\n {\n type: 'group',\n title: '样式',\n setter: {\n componentName: 'CollapseSetter',\n props: {\n icon: false,\n },\n },\n items: [\n {\n name: 'pointerType',\n title: '指针类型',\n setter: {\n componentName: 'SegmentedSetter',\n props: {\n options: [\n { label: '针形', value: 'needle' },\n { label: '三角形', value: 'triangle' },\n { label: '矩形', value: 'rect' },\n ],\n },\n },\n extraProps: {\n defaultValue: 'needle',\n },\n },\n {\n name: 'pointerColor',\n title: '指针颜色',\n setter: 'ColorSetter',\n extraProps: {\n defaultValue: '#ffffff',\n },\n },\n {\n name: 'glowEffect',\n title: '发光效果',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: false,\n },\n },\n ],\n },\n ],\n },\n {\n type: 'group',\n key: 'data',\n title: '数据',\n items: [\n {\n name: 'dataBinding',\n title: '数据绑定',\n setter: 'DataBindingSetter',\n },\n ],\n },\n {\n type: 'group',\n key: 'advanced',\n title: '高级',\n items: [\n {\n name: 'condition',\n title: '显隐控制',\n setter: 'SwitchSetter',\n extraProps: {\n defaultValue: true,\n supportVariable: true,\n },\n },\n ],\n },\n ],\n },\n ],\n component: {},\n supports: {},\n advanced: {},\n}\n\nexport default configure\n"],"names":["COMPONENT_NAME","meta","componentName","title","group","devMode","npm","package","version","globalName","snippets","screenshot","schema","props","value","min","max","showScale","divisions","showLabels","pointerType","pointerColor","$dashboard","rect","width","height","unit","glowEffect","configure","type","setter","items","key","icon","name","extraProps","label","getValue","target","getExtraPropValue","setValue","setExtraPropValue","defaultValue","suffix","step","options","supportVariable","component","supports","advanced"],"mappings":"wQAMO,MCEMA,EAAiB,gCCD9B,MAAMC,EAA0B,CAC9BC,cAAeF,EACfG,MAAO,MACPC,MFEO,QEDPC,QAAS,UACTC,IAAK,CACHC,QDAwB,+CCCxBC,gBACAC,WAAYT,EACZE,cAAeF,GAEjBU,SCf0B,CAC1B,CACEP,MAAO,MACPQ,WAAY,GACZC,OAAQ,CACNV,cAAeF,EACfa,MAAO,CACLC,MAAO,GACPC,IAAK,EACLC,IAAK,IACLC,WAAW,EACXC,UAAW,GACXC,YAAY,EACZC,YAAa,SACbC,aAAc,WAEhBC,WAAY,CACVC,KAAM,CACJC,MAAO,IACPC,OAAQ,QAKhB,CACEtB,MAAO,QACPQ,WAAY,GACZC,OAAQ,CACNV,cAAeF,EACfa,MAAO,CACLC,MAAO,GACPC,IAAK,EACLC,IAAK,IACLU,KAAM,IACNT,WAAW,EACXC,UAAW,GACXC,YAAY,EACZC,YAAa,SACbC,aAAc,UACdM,YAAY,GAEdL,WAAY,CACVC,KAAM,C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,eACRK,WAAY,CACVO,cAAc,EACdI,iBAAiB,SAQ/BC,UAAW,CAAA,EACXC,SAAU,CAAA,EACVC,SAAU,CAAA"}
@@ -1,19 +0,0 @@
1
- import { type CSSProperties, type Ref } from 'react';
2
- import { type GaugeRange } from './constants';
3
- interface GaugeChartProps {
4
- ref?: Ref<HTMLDivElement>;
5
- value?: number;
6
- min?: number;
7
- max?: number;
8
- unit?: string;
9
- showScale?: boolean;
10
- divisions?: number;
11
- showLabels?: boolean;
12
- pointerType?: 'needle' | 'triangle' | 'rect';
13
- pointerColor?: string;
14
- ranges?: GaugeRange[];
15
- glowEffect?: boolean;
16
- style?: CSSProperties;
17
- }
18
- declare const GaugeChartComponent: (props: GaugeChartProps) => import("react/jsx-runtime").JSX.Element;
19
- export default GaugeChartComponent;
@@ -1,7 +0,0 @@
1
- /**
2
- * Gauge Chart Configure
3
- * 仪表盘组件配置
4
- */
5
- import type { Configure } from '@easy-editor/core';
6
- declare const configure: Configure;
7
- export default configure;
@@ -1,28 +0,0 @@
1
- /**
2
- * 物料常量配置
3
- * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值
4
- */
5
- /**
6
- * UMD 全局变量基础名称
7
- */
8
- export declare const COMPONENT_NAME = "EasyEditorMaterialsGaugeChart";
9
- /**
10
- * 包名
11
- */
12
- export declare const PACKAGE_NAME = "@easy-editor/materials-dashboard-gauge-chart";
13
- /**
14
- * 指针类型
15
- */
16
- export declare const POINTER_TYPES: readonly ["needle", "triangle", "rect"];
17
- /**
18
- * 颜色区间类型
19
- */
20
- export interface GaugeRange {
21
- from: number;
22
- to: number;
23
- color: string;
24
- }
25
- /**
26
- * 默认颜色区间
27
- */
28
- export declare const DEFAULT_RANGES: GaugeRange[];
@@ -1,6 +0,0 @@
1
- /**
2
- * GaugeChart Entry
3
- * 仪表盘组件入口
4
- */
5
- export { default as component } from './component';
6
- export { default as meta } from './meta';
@@ -1,3 +0,0 @@
1
- import type { ComponentMetadata } from '@easy-editor/core';
2
- declare const meta: ComponentMetadata;
3
- export default meta;
@@ -1,3 +0,0 @@
1
- import type { Snippet } from '@easy-editor/core';
2
- declare const snippets: Snippet[];
3
- export default snippets;
@@ -1,50 +0,0 @@
1
- /**
2
- * GaugeChart 类型定义
3
- */
4
- import type { CSSProperties, Ref } from 'react';
5
- /**
6
- * 颜色区间定义
7
- */
8
- export interface GaugeRange {
9
- from: number;
10
- to: number;
11
- color: string;
12
- }
13
- /**
14
- * GaugeChart 组件属性
15
- */
16
- export interface GaugeChartProps {
17
- ref?: Ref<HTMLDivElement>;
18
- value?: number;
19
- min?: number;
20
- max?: number;
21
- unit?: string;
22
- showScale?: boolean;
23
- divisions?: number;
24
- showLabels?: boolean;
25
- pointerType?: 'needle' | 'triangle' | 'rect';
26
- pointerColor?: string;
27
- ranges?: GaugeRange[];
28
- glowEffect?: boolean;
29
- style?: CSSProperties;
30
- }
31
- /**
32
- * 仪表盘配置参数
33
- */
34
- export interface GaugeConfig {
35
- size: number;
36
- center: number;
37
- outerRadius: number;
38
- innerRadius: number;
39
- scaleRadius: number;
40
- startAngle: number;
41
- endAngle: number;
42
- angleRange: number;
43
- }
44
- /**
45
- * 点坐标
46
- */
47
- export interface Point {
48
- x: number;
49
- y: number;
50
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * GaugeChart SVG 辅助函数
3
- */
4
- import type { Point } from './types';
5
- /**
6
- * 将角度转换为弧度
7
- */
8
- export declare const degToRad: (deg: number) => number;
9
- /**
10
- * 根据角度计算圆上的点坐标
11
- */
12
- export declare const polarToCartesian: (cx: number, cy: number, radius: number, angleDeg: number) => Point;
13
- /**
14
- * 生成圆弧路径
15
- */
16
- export declare const describeArc: (cx: number, cy: number, radius: number, startAngle: number, endAngle: number) => string;
17
- /**
18
- * 生成唯一 ID
19
- */
20
- export declare const generateUniqueId: (prefix: string) => string;
21
- /**
22
- * 计算归一化值
23
- */
24
- export declare const normalizeValue: (value: number, min: number, max: number) => number;
25
- /**
26
- * 计算值对应的角度
27
- */
28
- export declare const valueToAngle: (value: number, min: number, max: number, startAngle: number, angleRange: number) => number;
package/rollup.config.js DELETED
@@ -1,212 +0,0 @@
1
- import babel from '@rollup/plugin-babel'
2
- import commonjs from '@rollup/plugin-commonjs'
3
- import nodeResolve from '@rollup/plugin-node-resolve'
4
- import json from '@rollup/plugin-json'
5
- import { terser } from 'rollup-plugin-terser'
6
- import cleanup from 'rollup-plugin-cleanup'
7
- import postcss from 'rollup-plugin-postcss'
8
- import pkg from './package.json' with { type: 'json' }
9
-
10
- const GLOBAL_NAME = 'EasyEditorMaterialsGaugeChart'
11
-
12
- // 外部依赖(不打包进组件)
13
- const external = ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core']
14
-
15
- const globals = {
16
- react: 'React',
17
- 'react-dom': 'ReactDOM',
18
- 'react/jsx-runtime': 'jsxRuntime',
19
- '@easy-editor/core': 'EasyEditorCore',
20
- }
21
-
22
- const plugins = [
23
- nodeResolve({
24
- extensions: ['.js', '.ts', '.jsx', '.tsx'],
25
- }),
26
- commonjs(),
27
- json(),
28
- postcss({
29
- modules: {
30
- generateScopedName: '[name]__[local]___[hash:base64:5]',
31
- },
32
- autoModules: true,
33
- minimize: true,
34
- inject: true,
35
- }),
36
- babel({
37
- extensions: ['.js', '.ts', '.jsx', '.tsx'],
38
- exclude: 'node_modules/**',
39
- babelrc: false,
40
- babelHelpers: 'bundled',
41
- presets: [
42
- ['@babel/preset-react', { runtime: 'automatic' }],
43
- [
44
- '@babel/preset-typescript',
45
- {
46
- allowDeclareFields: true,
47
- },
48
- ],
49
- ],
50
- }),
51
- cleanup({
52
- comments: ['some', /PURE/],
53
- extensions: ['.js', '.ts'],
54
- }),
55
- ]
56
-
57
- export default [
58
- /* ---------------------------------- 元数据构建 --------------------------------- */
59
- {
60
- input: 'src/meta.ts',
61
- output: [
62
- {
63
- file: 'dist/meta.esm.js',
64
- format: 'esm',
65
- sourcemap: true,
66
- banner: `/* @easy-editor/materials-dashboard-gauge-chart v${pkg.version} (meta, esm) */`,
67
- exports: 'named',
68
- },
69
- ],
70
- plugins,
71
- external,
72
- },
73
- {
74
- input: 'src/meta.ts',
75
- output: [
76
- {
77
- file: 'dist/meta.js',
78
- format: 'umd',
79
- name: `${GLOBAL_NAME}Meta`,
80
- globals,
81
- sourcemap: true,
82
- banner: `/* @easy-editor/materials-dashboard-gauge-chart v${pkg.version} (meta) */`,
83
- exports: 'named',
84
- },
85
- ],
86
- plugins,
87
- external,
88
- },
89
- {
90
- input: 'src/meta.ts',
91
- output: [
92
- {
93
- file: 'dist/meta.min.js',
94
- format: 'umd',
95
- name: `${GLOBAL_NAME}Meta`,
96
- globals,
97
- sourcemap: true,
98
- banner: `/* @easy-editor/materials-dashboard-gauge-chart v${pkg.version} (meta, minified) */`,
99
- exports: 'named',
100
- },
101
- ],
102
- plugins: [...plugins, terser()],
103
- external,
104
- },
105
-
106
- /* ---------------------------------- 组件构建 ---------------------------------- */
107
- {
108
- input: 'src/component.tsx',
109
- output: [
110
- {
111
- file: 'dist/component.esm.js',
112
- format: 'esm',
113
- sourcemap: true,
114
- banner: `/* @easy-editor/materials-dashboard-gauge-chart v${pkg.version} (component, esm) */`,
115
- exports: 'named',
116
- },
117
- ],
118
- plugins,
119
- external,
120
- },
121
- {
122
- input: 'src/component.tsx',
123
- output: [
124
- {
125
- file: 'dist/component.js',
126
- format: 'umd',
127
- name: `${GLOBAL_NAME}Component`,
128
- globals,
129
- sourcemap: true,
130
- banner: `/* @easy-editor/materials-dashboard-gauge-chart v${pkg.version} (component) */`,
131
- exports: 'named',
132
- },
133
- ],
134
- plugins,
135
- external,
136
- },
137
- {
138
- input: 'src/component.tsx',
139
- output: [
140
- {
141
- file: 'dist/component.min.js',
142
- format: 'umd',
143
- name: `${GLOBAL_NAME}Component`,
144
- globals,
145
- sourcemap: true,
146
- banner: `/* @easy-editor/materials-dashboard-gauge-chart v${pkg.version} (component, minified) */`,
147
- exports: 'named',
148
- },
149
- ],
150
- plugins: [...plugins, terser()],
151
- external,
152
- },
153
-
154
- /* ---------------------------------- 完整构建 ---------------------------------- */
155
- {
156
- input: 'src/index.tsx',
157
- output: [
158
- {
159
- file: 'dist/index.js',
160
- format: 'umd',
161
- name: GLOBAL_NAME,
162
- globals,
163
- sourcemap: true,
164
- banner: `/* @easy-editor/materials-dashboard-gauge-chart v${pkg.version} */`,
165
- exports: 'named',
166
- },
167
- ],
168
- plugins,
169
- external,
170
- },
171
- {
172
- input: 'src/index.tsx',
173
- output: [
174
- {
175
- file: 'dist/index.esm.js',
176
- format: 'esm',
177
- sourcemap: true,
178
- },
179
- ],
180
- plugins,
181
- external,
182
- },
183
- {
184
- input: 'src/index.tsx',
185
- output: [
186
- {
187
- file: 'dist/index.cjs',
188
- format: 'cjs',
189
- sourcemap: true,
190
- exports: 'named',
191
- },
192
- ],
193
- plugins,
194
- external,
195
- },
196
- {
197
- input: 'src/index.tsx',
198
- output: [
199
- {
200
- file: 'dist/index.min.js',
201
- format: 'umd',
202
- name: GLOBAL_NAME,
203
- globals,
204
- sourcemap: true,
205
- banner: `/* @easy-editor/materials-dashboard-gauge-chart v${pkg.version} (minified) */`,
206
- exports: 'named',
207
- },
208
- ],
209
- plugins: [...plugins, terser()],
210
- external,
211
- },
212
- ]
package/src/types.ts DELETED
@@ -1,55 +0,0 @@
1
- /**
2
- * GaugeChart 类型定义
3
- */
4
-
5
- import type { CSSProperties, Ref } from 'react'
6
-
7
- /**
8
- * 颜色区间定义
9
- */
10
- export interface GaugeRange {
11
- from: number
12
- to: number
13
- color: string
14
- }
15
-
16
- /**
17
- * GaugeChart 组件属性
18
- */
19
- export interface GaugeChartProps {
20
- ref?: Ref<HTMLDivElement>
21
- value?: number
22
- min?: number
23
- max?: number
24
- unit?: string
25
- showScale?: boolean
26
- divisions?: number
27
- showLabels?: boolean
28
- pointerType?: 'needle' | 'triangle' | 'rect'
29
- pointerColor?: string
30
- ranges?: GaugeRange[]
31
- glowEffect?: boolean
32
- style?: CSSProperties
33
- }
34
-
35
- /**
36
- * 仪表盘配置参数
37
- */
38
- export interface GaugeConfig {
39
- size: number
40
- center: number
41
- outerRadius: number
42
- innerRadius: number
43
- scaleRadius: number
44
- startAngle: number
45
- endAngle: number
46
- angleRange: number
47
- }
48
-
49
- /**
50
- * 点坐标
51
- */
52
- export interface Point {
53
- x: number
54
- y: number
55
- }
package/src/utils.ts DELETED
@@ -1,57 +0,0 @@
1
- /**
2
- * GaugeChart SVG 辅助函数
3
- */
4
-
5
- import type { Point } from './types'
6
-
7
- /**
8
- * 将角度转换为弧度
9
- */
10
- export const degToRad = (deg: number): number => (deg * Math.PI) / 180
11
-
12
- /**
13
- * 根据角度计算圆上的点坐标
14
- */
15
- export const polarToCartesian = (cx: number, cy: number, radius: number, angleDeg: number): Point => {
16
- const rad = degToRad(angleDeg)
17
- return {
18
- x: cx + radius * Math.cos(rad),
19
- y: cy + radius * Math.sin(rad),
20
- }
21
- }
22
-
23
- /**
24
- * 生成圆弧路径
25
- */
26
- // biome-ignore lint: 参数过多是数学函数需要
27
- export const describeArc = (cx: number, cy: number, radius: number, startAngle: number, endAngle: number): string => {
28
- const start = polarToCartesian(cx, cy, radius, endAngle)
29
- const end = polarToCartesian(cx, cy, radius, startAngle)
30
- const largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1'
31
- return ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 0, end.x, end.y].join(' ')
32
- }
33
-
34
- /**
35
- * 生成唯一 ID
36
- */
37
- export const generateUniqueId = (prefix: string): string => `${prefix}-${Math.random().toString(36).substr(2, 9)}`
38
-
39
- /**
40
- * 计算归一化值
41
- */
42
- export const normalizeValue = (value: number, min: number, max: number): number => Math.min(Math.max(value, min), max)
43
-
44
- /**
45
- * 计算值对应的角度
46
- */
47
- // biome-ignore lint: 参数过多是数学函数需要
48
- export const valueToAngle = (
49
- value: number,
50
- min: number,
51
- max: number,
52
- startAngle: number,
53
- angleRange: number,
54
- ): number => {
55
- const ratio = (value - min) / (max - min)
56
- return startAngle - ratio * angleRange
57
- }
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "../../../../tsconfig.json",
3
- "compilerOptions": {
4
- "jsx": "react-jsx",
5
- "strictPropertyInitialization": false,
6
- "outDir": "./dist",
7
- "skipLibCheck": true,
8
- "esModuleInterop": true,
9
- "allowSyntheticDefaultImports": true
10
- },
11
- "include": ["./src"]
12
- }
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.build.json",
3
- "compilerOptions": {
4
- "noEmit": true
5
- },
6
- "include": ["./src"]
7
- }
package/vite.config.ts DELETED
@@ -1,54 +0,0 @@
1
- /**
2
- * Vite Configuration for Material Development
3
- * 物料开发 Vite 配置
4
- */
5
-
6
- import { defineConfig } from 'vite'
7
- import react from '@vitejs/plugin-react'
8
- import { materialDevPlugin } from './.vite/plugins/vite-plugin-material-dev'
9
- import { externalDeps } from './.vite/plugins/vite-plugin-external-deps'
10
-
11
- export default defineConfig({
12
- plugins: [
13
- react(),
14
- // 外部化 React/ReactDOM,使用父应用提供的实例
15
- externalDeps({
16
- externals: ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core'],
17
- globals: {
18
- react: 'React',
19
- 'react-dom': 'ReactDOM',
20
- 'react/jsx-runtime': 'jsxRuntime',
21
- '@easy-editor/core': 'EasyEditorCore',
22
- },
23
- }),
24
- materialDevPlugin({
25
- entry: '/src/index.tsx',
26
- }),
27
- ],
28
- server: {
29
- port: 5001,
30
- host: 'localhost',
31
- cors: true,
32
- hmr: {
33
- port: 5001,
34
- },
35
- },
36
- build: {
37
- target: 'esnext',
38
- rollupOptions: {
39
- // 确保生产构建也外部化这些依赖
40
- external: ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core'],
41
- output: {
42
- globals: {
43
- react: 'React',
44
- 'react-dom': 'ReactDOM',
45
- 'react/jsx-runtime': 'jsxRuntime',
46
- '@easy-editor/core': 'EasyEditorCore',
47
- },
48
- },
49
- },
50
- },
51
- resolve: {
52
- dedupe: ['react', 'react-dom'],
53
- },
54
- })