@easy-editor/materials-dashboard-progress 0.0.2

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 (44) hide show
  1. package/.vite/plugins/vite-plugin-external-deps.ts +224 -0
  2. package/.vite/plugins/vite-plugin-material-dev.ts +218 -0
  3. package/CHANGELOG.md +7 -0
  4. package/LICENSE +9 -0
  5. package/dist/component.esm.js +257 -0
  6. package/dist/component.esm.js.map +1 -0
  7. package/dist/component.js +265 -0
  8. package/dist/component.js.map +1 -0
  9. package/dist/component.min.js +2 -0
  10. package/dist/component.min.js.map +1 -0
  11. package/dist/index.cjs +560 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.esm.js +557 -0
  14. package/dist/index.esm.js.map +1 -0
  15. package/dist/index.js +564 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/index.min.js +2 -0
  18. package/dist/index.min.js.map +1 -0
  19. package/dist/meta.esm.js +304 -0
  20. package/dist/meta.esm.js.map +1 -0
  21. package/dist/meta.js +315 -0
  22. package/dist/meta.js.map +1 -0
  23. package/dist/meta.min.js +2 -0
  24. package/dist/meta.min.js.map +1 -0
  25. package/dist/src/component.d.ts +36 -0
  26. package/dist/src/configure.d.ts +7 -0
  27. package/dist/src/constants.d.ts +36 -0
  28. package/dist/src/index.d.ts +6 -0
  29. package/dist/src/meta.d.ts +7 -0
  30. package/dist/src/snippets.d.ts +7 -0
  31. package/package.json +66 -0
  32. package/rollup.config.js +212 -0
  33. package/src/component.module.css +89 -0
  34. package/src/component.tsx +262 -0
  35. package/src/configure.ts +265 -0
  36. package/src/constants.ts +43 -0
  37. package/src/index.tsx +7 -0
  38. package/src/meta.ts +28 -0
  39. package/src/snippets.ts +60 -0
  40. package/src/type.d.ts +8 -0
  41. package/tsconfig.build.json +12 -0
  42. package/tsconfig.json +9 -0
  43. package/tsconfig.test.json +7 -0
  44. package/vite.config.ts +54 -0
@@ -0,0 +1,265 @@
1
+ /**
2
+ * Progress Configure
3
+ * 进度条组件配置
4
+ */
5
+
6
+ import type { Configure } from '@easy-editor/core'
7
+
8
+ export const configure: Configure = {
9
+ props: [
10
+ {
11
+ type: 'group',
12
+ title: '属性',
13
+ setter: 'TabSetter',
14
+ items: [
15
+ {
16
+ type: 'group',
17
+ key: 'config',
18
+ title: '配置',
19
+ setter: {
20
+ componentName: 'CollapseSetter',
21
+ props: {
22
+ icon: false,
23
+ },
24
+ },
25
+ items: [
26
+ // 基础配置
27
+ {
28
+ name: 'id',
29
+ title: 'ID',
30
+ setter: 'NodeIdSetter',
31
+ extraProps: {
32
+ // @ts-expect-error label is not a valid extra prop
33
+ label: false,
34
+ },
35
+ },
36
+ {
37
+ name: 'title',
38
+ title: '标题',
39
+ setter: 'StringSetter',
40
+ extraProps: {
41
+ getValue(target) {
42
+ return target.getExtraPropValue('title')
43
+ },
44
+ setValue(target, value) {
45
+ target.setExtraPropValue('title', value)
46
+ },
47
+ },
48
+ },
49
+ {
50
+ type: 'group',
51
+ title: '基础属性',
52
+ setter: {
53
+ componentName: 'CollapseSetter',
54
+ props: {
55
+ icon: false,
56
+ },
57
+ },
58
+ items: [
59
+ {
60
+ name: 'rect',
61
+ title: '位置尺寸',
62
+ setter: 'RectSetter',
63
+ extraProps: {
64
+ getValue(target) {
65
+ return target.getExtraPropValue('$dashboard.rect')
66
+ },
67
+ setValue(target, value) {
68
+ target.setExtraPropValue('$dashboard.rect', value)
69
+ },
70
+ },
71
+ },
72
+ ],
73
+ },
74
+ // 组件配置
75
+ {
76
+ type: 'group',
77
+ title: '数值',
78
+ setter: {
79
+ componentName: 'CollapseSetter',
80
+ props: {
81
+ icon: false,
82
+ },
83
+ },
84
+ items: [
85
+ {
86
+ name: 'value',
87
+ title: '当前值',
88
+ setter: 'NumberSetter',
89
+ extraProps: {
90
+ defaultValue: 0,
91
+ },
92
+ },
93
+ {
94
+ name: 'maxValue',
95
+ title: '最大值',
96
+ setter: 'NumberSetter',
97
+ extraProps: {
98
+ defaultValue: 100,
99
+ },
100
+ },
101
+ {
102
+ name: 'valueFormat',
103
+ title: '值格式',
104
+ setter: {
105
+ componentName: 'SelectSetter',
106
+ props: {
107
+ options: [
108
+ { label: '百分比', value: 'percent' },
109
+ { label: '数值', value: 'number' },
110
+ ],
111
+ },
112
+ },
113
+ extraProps: {
114
+ defaultValue: 'percent',
115
+ },
116
+ },
117
+ ],
118
+ },
119
+ {
120
+ type: 'group',
121
+ title: '显示',
122
+ setter: {
123
+ componentName: 'CollapseSetter',
124
+ props: {
125
+ icon: false,
126
+ },
127
+ },
128
+ items: [
129
+ {
130
+ name: 'type',
131
+ title: '进度条类型',
132
+ setter: {
133
+ componentName: 'SelectSetter',
134
+ props: {
135
+ options: [
136
+ { label: '环形', value: 'ring' },
137
+ { label: '线性', value: 'bar' },
138
+ ],
139
+ },
140
+ },
141
+ extraProps: {
142
+ defaultValue: 'ring',
143
+ },
144
+ },
145
+ {
146
+ name: 'showValue',
147
+ title: '显示数值',
148
+ setter: 'SwitchSetter',
149
+ extraProps: {
150
+ defaultValue: true,
151
+ },
152
+ },
153
+ {
154
+ name: 'showLabel',
155
+ title: '显示标签',
156
+ setter: 'SwitchSetter',
157
+ extraProps: {
158
+ defaultValue: false,
159
+ },
160
+ },
161
+ {
162
+ name: 'label',
163
+ title: '标签文本',
164
+ setter: 'StringSetter',
165
+ },
166
+ ],
167
+ },
168
+ {
169
+ type: 'group',
170
+ title: '样式',
171
+ setter: {
172
+ componentName: 'CollapseSetter',
173
+ props: {
174
+ icon: false,
175
+ },
176
+ },
177
+ items: [
178
+ {
179
+ name: 'strokeWidthRatio',
180
+ title: '线条粗细',
181
+ setter: {
182
+ componentName: 'SliderSetter',
183
+ props: {
184
+ min: 0.02,
185
+ max: 0.2,
186
+ step: 0.01,
187
+ },
188
+ },
189
+ extraProps: {
190
+ defaultValue: 0.07,
191
+ },
192
+ },
193
+ {
194
+ name: 'trackColor',
195
+ title: '轨道颜色',
196
+ setter: 'ColorSetter',
197
+ extraProps: {
198
+ defaultValue: 'rgba(255, 255, 255, 0.1)',
199
+ },
200
+ },
201
+ {
202
+ name: 'progressColor',
203
+ title: '进度颜色',
204
+ setter: 'ColorSetter',
205
+ extraProps: {
206
+ defaultValue: '#00ffff',
207
+ },
208
+ },
209
+ {
210
+ name: 'gradientEnable',
211
+ title: '启用渐变',
212
+ setter: 'SwitchSetter',
213
+ extraProps: {
214
+ defaultValue: false,
215
+ },
216
+ },
217
+ {
218
+ name: 'gradientColors',
219
+ title: '渐变颜色',
220
+ setter: 'ColorSetter',
221
+ extraProps: {
222
+ defaultValue: ['#00d4ff', '#9b59b6'],
223
+ },
224
+ },
225
+ ],
226
+ },
227
+ ],
228
+ },
229
+ {
230
+ type: 'group',
231
+ key: 'data',
232
+ title: '数据',
233
+ items: [
234
+ {
235
+ name: 'dataBinding',
236
+ title: '数据绑定',
237
+ setter: 'DataBindingSetter',
238
+ },
239
+ ],
240
+ },
241
+ {
242
+ type: 'group',
243
+ key: 'advanced',
244
+ title: '高级',
245
+ items: [
246
+ {
247
+ name: 'condition',
248
+ title: '显隐控制',
249
+ setter: 'SwitchSetter',
250
+ extraProps: {
251
+ defaultValue: true,
252
+ supportVariable: true,
253
+ },
254
+ },
255
+ ],
256
+ },
257
+ ],
258
+ },
259
+ ],
260
+ component: {},
261
+ supports: {},
262
+ advanced: {},
263
+ }
264
+
265
+ export default configure
@@ -0,0 +1,43 @@
1
+ /**
2
+ * 物料常量配置
3
+ * 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值
4
+ */
5
+
6
+ /**
7
+ * UMD 全局变量基础名称
8
+ * 用于构建:
9
+ * - 元数据:${GLOBAL_NAME}Meta (例如: EasyEditorMaterialsProgressMeta)
10
+ * - 组件:${GLOBAL_NAME}Component (例如: EasyEditorMaterialsProgressComponent)
11
+ * - 完整构建:${GLOBAL_NAME} (例如: EasyEditorMaterialsProgress)
12
+ */
13
+ export const COMPONENT_NAME = 'EasyEditorMaterialsProgress'
14
+
15
+ /**
16
+ * 包名
17
+ */
18
+ export const PACKAGE_NAME = '@easy-editor/materials-dashboard-progress'
19
+
20
+ /**
21
+ * 值格式类型
22
+ */
23
+ export const VALUE_FORMATS = ['percent', 'number'] as const
24
+
25
+ /**
26
+ * 默认轨道颜色
27
+ */
28
+ export const DEFAULT_TRACK_COLOR = 'rgba(255, 255, 255, 0.1)'
29
+
30
+ /**
31
+ * 默认进度颜色
32
+ */
33
+ export const DEFAULT_PROGRESS_COLOR = '#00ffff'
34
+
35
+ /**
36
+ * 默认渐变颜色
37
+ */
38
+ export const DEFAULT_GRADIENT_COLORS: [string, string] = ['#00ffff', '#ff00ff']
39
+
40
+ /**
41
+ * 默认发光颜色
42
+ */
43
+ export const DEFAULT_GLOW_COLOR = '#00ffff'
package/src/index.tsx ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Progress Entry
3
+ * 进度条组件入口
4
+ */
5
+
6
+ export { Progress as component } from './component'
7
+ export { default as meta } from './meta'
package/src/meta.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Progress Meta
3
+ * 进度条组件元数据
4
+ */
5
+
6
+ import type { ComponentMetadata } from '@easy-editor/core'
7
+ import { MaterialGroup } from '@easy-editor/materials-shared'
8
+ import { COMPONENT_NAME, PACKAGE_NAME } from './constants'
9
+ import configure from './configure'
10
+ import snippets from './snippets'
11
+ import pkg from '../package.json'
12
+
13
+ export const meta: ComponentMetadata = {
14
+ componentName: COMPONENT_NAME,
15
+ title: '进度条',
16
+ group: MaterialGroup.DISPLAY,
17
+ devMode: 'proCode',
18
+ npm: {
19
+ package: PACKAGE_NAME,
20
+ version: pkg.version,
21
+ globalName: COMPONENT_NAME,
22
+ componentName: COMPONENT_NAME,
23
+ },
24
+ snippets,
25
+ configure,
26
+ }
27
+
28
+ export default meta
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Progress Snippets
3
+ * 进度条组件代码片段
4
+ */
5
+
6
+ import type { Snippet } from '@easy-editor/core'
7
+ import { COMPONENT_NAME } from './constants'
8
+
9
+ export const snippets: Snippet[] = [
10
+ {
11
+ title: '进度环',
12
+ screenshot: '',
13
+ schema: {
14
+ componentName: COMPONENT_NAME,
15
+ props: {
16
+ value: 75,
17
+ maxValue: 100,
18
+ type: 'ring',
19
+ showValue: true,
20
+ showLabel: false,
21
+ valueFormat: 'percent',
22
+ strokeWidthRatio: 0.07,
23
+ progressColor: '#00ffff',
24
+ },
25
+ $dashboard: {
26
+ rect: {
27
+ width: 140,
28
+ height: 140,
29
+ },
30
+ },
31
+ },
32
+ },
33
+ {
34
+ title: '线性进度条',
35
+ screenshot: '',
36
+ schema: {
37
+ componentName: COMPONENT_NAME,
38
+ props: {
39
+ value: 85,
40
+ maxValue: 100,
41
+ type: 'bar',
42
+ showValue: true,
43
+ showLabel: true,
44
+ label: '完成率',
45
+ valueFormat: 'percent',
46
+ progressColor: '#00ff88',
47
+ gradientEnable: true,
48
+ gradientColors: ['#00ff88', '#00d4ff'],
49
+ },
50
+ $dashboard: {
51
+ rect: {
52
+ width: 300,
53
+ height: 50,
54
+ },
55
+ },
56
+ },
57
+ },
58
+ ]
59
+
60
+ export default snippets
package/src/type.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CSS Modules Type Declarations
3
+ */
4
+
5
+ declare module '*.module.css' {
6
+ const classes: { readonly [key: string]: string }
7
+ export default classes
8
+ }
@@ -0,0 +1,12 @@
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
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react-jsx",
4
+ "esModuleInterop": true,
5
+ "allowSyntheticDefaultImports": true
6
+ },
7
+ "extends": "./tsconfig.build.json",
8
+ "include": ["./src", "./test"]
9
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "noEmit": true
5
+ },
6
+ "include": ["./src"]
7
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,54 @@
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
+ })