@easy-editor/materials-dashboard-scroll-list 0.0.3 → 0.0.5

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/dist/index.js DELETED
@@ -1,680 +0,0 @@
1
- /* @easy-editor/materials-dashboard-scroll-list v0.0.2 */
2
- (function (global, factory) {
3
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime')) :
4
- typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime'], factory) :
5
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EasyEditorMaterialsScrollList = {}, global.jsxRuntime));
6
- })(this, (function (exports, jsxRuntime) { 'use strict';
7
-
8
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
9
-
10
- function cn(...inputs) {
11
- return clsx(inputs);
12
- }
13
-
14
- const MaterialGroup = {
15
- DISPLAY: 'display'};
16
-
17
- function styleInject(css, ref) {
18
- if (ref === void 0) ref = {};
19
- var insertAt = ref.insertAt;
20
- if (typeof document === 'undefined') {
21
- return;
22
- }
23
- var head = document.head || document.getElementsByTagName('head')[0];
24
- var style = document.createElement('style');
25
- style.type = 'text/css';
26
- if (insertAt === 'top') {
27
- if (head.firstChild) {
28
- head.insertBefore(style, head.firstChild);
29
- } else {
30
- head.appendChild(style);
31
- }
32
- } else {
33
- head.appendChild(style);
34
- }
35
- if (style.styleSheet) {
36
- style.styleSheet.cssText = css;
37
- } else {
38
- style.appendChild(document.createTextNode(css));
39
- }
40
- }
41
-
42
- var css_248z = ".component-module__container___VbZSk{backdrop-filter:blur(10px);background:rgba(10,10,26,.95);border:1px solid rgba(26,26,62,.8);border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,.3);box-sizing:border-box;height:100%;overflow:hidden;padding:16px;width:100%}.component-module__list___ZzqLO{display:flex;flex-direction:column;gap:10px;height:100%}.component-module__item___-0hiq{align-items:center;background:rgba(15,15,42,.9);border:1px solid rgba(26,26,62,.6);border-radius:8px;display:flex;gap:14px;overflow:hidden;padding:12px 16px;position:relative;transition:all .3s ease}.component-module__item___-0hiq:before{background:linear-gradient(180deg,transparent,rgba(0,212,255,.5),transparent);bottom:0;content:\"\";left:0;opacity:0;position:absolute;top:0;transition:opacity .3s ease;width:3px}.component-module__item___-0hiq:hover{background:rgba(20,20,52,.95);border-color:rgba(0,212,255,.3);transform:translateX(4px)}.component-module__item___-0hiq:hover:before{opacity:1}.component-module__rankBadge___qWXYW{align-items:center;border-radius:6px;display:flex;font-weight:700;height:32px;justify-content:center;min-width:32px;transition:transform .3s ease}.component-module__item___-0hiq:hover .component-module__rankBadge___qWXYW{transform:scale(1.1)}.component-module__rankBadgeTopThree___kYqJt{font-size:20px;text-shadow:0 2px 8px rgba(0,0,0,.5)}.component-module__rankBadgeNormal___Fl3nh{background:rgba(26,26,62,.8);border:1px solid rgba(136,146,176,.2);color:#8892b0;font-size:14px}.component-module__rankGold___lLkRo{color:gold;filter:drop-shadow(0 0 6px rgba(255,215,0,.6))}.component-module__rankSilver___QUAyV{color:#e8e8e8;filter:drop-shadow(0 0 6px rgba(192,192,192,.6))}.component-module__rankBronze___Wc-LC{color:#f96;filter:drop-shadow(0 0 6px rgba(205,127,50,.6))}.component-module__name___6zmww{color:#e6e6e6;flex:1;font-size:15px;font-weight:500;overflow:hidden;text-overflow:ellipsis;transition:color .3s ease;white-space:nowrap}.component-module__item___-0hiq:hover .component-module__name___6zmww{color:#fff}.component-module__valueContainer___xBbFD{align-items:flex-end;display:flex;flex-direction:column;gap:6px;min-width:120px}.component-module__value___Fg70k{color:#00d4ff;font-family:Courier New,Courier,monospace;font-size:15px;font-weight:700;text-shadow:0 0 10px rgba(0,212,255,.3);transition:all .3s ease}.component-module__item___-0hiq:hover .component-module__value___Fg70k{text-shadow:0 0 15px rgba(0,212,255,.5);transform:scale(1.05)}.component-module__progressBar___wROZC{background:rgba(26,26,62,.8);border-radius:3px;box-shadow:inset 0 1px 3px rgba(0,0,0,.3);height:5px;overflow:hidden;width:100%}.component-module__progressFill___F8n5d{border-radius:3px;height:100%;position:relative;transition:width .5s cubic-bezier(.4,0,.2,1)}.component-module__progressFill___F8n5d:after{animation:component-module__shimmer___7hQ6G 2s infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.2),transparent);bottom:0;content:\"\";left:0;position:absolute;right:0;top:0}@keyframes component-module__shimmer___7hQ6G{0%{transform:translateX(-100%)}to{transform:translateX(100%)}}";
43
- var styles = {"container":"component-module__container___VbZSk","list":"component-module__list___ZzqLO","item":"component-module__item___-0hiq","rankBadge":"component-module__rankBadge___qWXYW","rankBadgeTopThree":"component-module__rankBadgeTopThree___kYqJt","rankBadgeNormal":"component-module__rankBadgeNormal___Fl3nh","rankGold":"component-module__rankGold___lLkRo","rankSilver":"component-module__rankSilver___QUAyV","rankBronze":"component-module__rankBronze___Wc-LC","name":"component-module__name___6zmww","valueContainer":"component-module__valueContainer___xBbFD","value":"component-module__value___Fg70k","progressBar":"component-module__progressBar___wROZC","progressFill":"component-module__progressFill___F8n5d"};
44
- styleInject(css_248z);
45
-
46
- /**
47
- * Scroll List Component
48
- * 滚动列表组件 - 用于展示排行榜、数据列表等
49
- */
50
-
51
- const DEFAULT_DATA = [{
52
- rank: 1,
53
- name: '北京市',
54
- value: 9800
55
- }, {
56
- rank: 2,
57
- name: '上海市',
58
- value: 8500
59
- }, {
60
- rank: 3,
61
- name: '广州市',
62
- value: 7200
63
- }, {
64
- rank: 4,
65
- name: '深圳市',
66
- value: 6100
67
- }, {
68
- rank: 5,
69
- name: '杭州市',
70
- value: 4800
71
- }];
72
- const MEDAL_EMOJI = {
73
- 1: '🥇',
74
- 2: '🥈',
75
- 3: '🥉'
76
- };
77
- const getRankClass = rank => {
78
- if (rank === 1) {
79
- return styles.rankGold;
80
- }
81
- if (rank === 2) {
82
- return styles.rankSilver;
83
- }
84
- if (rank === 3) {
85
- return styles.rankBronze;
86
- }
87
- return '';
88
- };
89
- const formatDisplayValue = (value, format, prefix, suffix) => {
90
- let formatted;
91
- switch (format) {
92
- case 'currency':
93
- formatted = value.toLocaleString('zh-CN', {
94
- minimumFractionDigits: 2,
95
- maximumFractionDigits: 2
96
- });
97
- break;
98
- case 'percent':
99
- formatted = `${value}%`;
100
- break;
101
- default:
102
- formatted = value.toLocaleString();
103
- }
104
- return `${prefix}${formatted}${suffix}`;
105
- };
106
- const ScrollList = ({
107
- ref,
108
- data = DEFAULT_DATA,
109
- maxItems = 5,
110
- showRank = true,
111
- showMedal = true,
112
- progressBarEnable = true,
113
- progressBarGradient = true,
114
- progressBarColors = ['#00d4ff', '#9b59b6'],
115
- valueFormat = 'number',
116
- valuePrefix = '',
117
- valueSuffix = '',
118
- nameColor = '#e6e6e6',
119
- valueColor = '#00d4ff',
120
- backgroundColor = 'rgba(10, 10, 26, 0.95)',
121
- borderColor = 'rgba(26, 26, 62, 0.8)',
122
- itemBackgroundColor = 'rgba(15, 15, 42, 0.9)',
123
- itemBorderColor = 'rgba(26, 26, 62, 0.6)',
124
- glowEnable = false,
125
- style: externalStyle
126
- }) => {
127
- const displayData = data.slice(0, maxItems);
128
- const maxValue = Math.max(...displayData.map(item => item.value), 1);
129
- const getProgressBarStyle = value => {
130
- const percentage = value / maxValue * 100;
131
- return {
132
- width: `${percentage}%`,
133
- background: progressBarGradient ? `linear-gradient(90deg, ${progressBarColors[0]}, ${progressBarColors[1]})` : progressBarColors[0],
134
- boxShadow: glowEnable ? `0 0 8px ${progressBarColors[0]}60` : undefined
135
- };
136
- };
137
- const containerStyle = {
138
- ...externalStyle,
139
- backgroundColor,
140
- borderColor
141
- };
142
- const itemStyle = {
143
- backgroundColor: itemBackgroundColor,
144
- borderColor: itemBorderColor
145
- };
146
- return /*#__PURE__*/jsxRuntime.jsx("div", {
147
- className: styles.container,
148
- ref: ref,
149
- style: containerStyle,
150
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
151
- className: styles.list,
152
- children: displayData.map(item => {
153
- const isTopThree = item.rank <= 3;
154
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
155
- className: styles.item,
156
- style: itemStyle,
157
- children: [showRank ? /*#__PURE__*/jsxRuntime.jsx("div", {
158
- className: cn(styles.rankBadge, isTopThree ? styles.rankBadgeTopThree : styles.rankBadgeNormal, getRankClass(item.rank)),
159
- children: showMedal && isTopThree ? MEDAL_EMOJI[item.rank] : item.rank
160
- }) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
161
- className: styles.name,
162
- style: {
163
- color: nameColor
164
- },
165
- children: item.name
166
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
167
- className: styles.valueContainer,
168
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
169
- className: styles.value,
170
- style: {
171
- color: valueColor
172
- },
173
- children: formatDisplayValue(item.value, valueFormat, valuePrefix, valueSuffix)
174
- }), progressBarEnable ? /*#__PURE__*/jsxRuntime.jsx("div", {
175
- className: styles.progressBar,
176
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
177
- className: styles.progressFill,
178
- style: getProgressBarStyle(item.value)
179
- })
180
- }) : null]
181
- })]
182
- }, item.rank);
183
- })
184
- })
185
- });
186
- };
187
-
188
- const COMPONENT_NAME = 'EasyEditorMaterialsScrollList';
189
- const PACKAGE_NAME = '@easy-editor/materials-dashboard-scroll-list';
190
-
191
- const configure = {
192
- props: [{
193
- type: 'group',
194
- title: '属性',
195
- setter: 'TabSetter',
196
- items: [{
197
- type: 'group',
198
- key: 'config',
199
- title: '配置',
200
- setter: {
201
- componentName: 'CollapseSetter',
202
- props: {
203
- icon: false
204
- }
205
- },
206
- items: [
207
- {
208
- name: 'id',
209
- title: 'ID',
210
- setter: 'NodeIdSetter',
211
- extraProps: {
212
- label: false
213
- }
214
- }, {
215
- name: 'title',
216
- title: '标题',
217
- setter: 'StringSetter',
218
- extraProps: {
219
- getValue(target) {
220
- return target.getExtraPropValue('title');
221
- },
222
- setValue(target, value) {
223
- target.setExtraPropValue('title', value);
224
- }
225
- }
226
- }, {
227
- type: 'group',
228
- title: '基础属性',
229
- setter: {
230
- componentName: 'CollapseSetter',
231
- props: {
232
- icon: false
233
- }
234
- },
235
- items: [{
236
- name: 'rect',
237
- title: '位置尺寸',
238
- setter: 'RectSetter',
239
- extraProps: {
240
- getValue(target) {
241
- return target.getExtraPropValue('$dashboard.rect');
242
- },
243
- setValue(target, value) {
244
- target.setExtraPropValue('$dashboard.rect', value);
245
- }
246
- }
247
- }]
248
- },
249
- {
250
- type: 'group',
251
- title: '数据',
252
- setter: {
253
- componentName: 'CollapseSetter',
254
- props: {
255
- icon: false
256
- }
257
- },
258
- items: [{
259
- name: 'data',
260
- title: '列表数据',
261
- setter: 'JsonSetter'
262
- }, {
263
- name: 'maxItems',
264
- title: '最大显示数',
265
- setter: {
266
- componentName: 'NumberSetter',
267
- props: {
268
- min: 1,
269
- max: 20
270
- }
271
- },
272
- extraProps: {
273
- defaultValue: 5
274
- }
275
- }]
276
- }, {
277
- type: 'group',
278
- title: '显示',
279
- setter: {
280
- componentName: 'CollapseSetter',
281
- props: {
282
- icon: false
283
- }
284
- },
285
- items: [{
286
- name: 'showRank',
287
- title: '显示排名',
288
- setter: 'SwitchSetter',
289
- extraProps: {
290
- defaultValue: true
291
- }
292
- }, {
293
- name: 'showMedal',
294
- title: '显示奖牌',
295
- setter: 'SwitchSetter',
296
- extraProps: {
297
- defaultValue: true
298
- }
299
- }, {
300
- name: 'progressBarEnable',
301
- title: '显示进度条',
302
- setter: 'SwitchSetter',
303
- extraProps: {
304
- defaultValue: true
305
- }
306
- }, {
307
- name: 'progressBarGradient',
308
- title: '渐变效果',
309
- setter: 'SwitchSetter',
310
- extraProps: {
311
- defaultValue: true
312
- }
313
- }, {
314
- name: 'glowEnable',
315
- title: '发光效果',
316
- setter: 'SwitchSetter',
317
- extraProps: {
318
- defaultValue: false
319
- }
320
- }]
321
- }, {
322
- type: 'group',
323
- title: '数值格式',
324
- setter: {
325
- componentName: 'CollapseSetter',
326
- props: {
327
- icon: false
328
- }
329
- },
330
- items: [{
331
- name: 'valueFormat',
332
- title: '格式类型',
333
- setter: {
334
- componentName: 'SelectSetter',
335
- props: {
336
- options: [{
337
- label: '数字',
338
- value: 'number'
339
- }, {
340
- label: '货币',
341
- value: 'currency'
342
- }, {
343
- label: '百分比',
344
- value: 'percent'
345
- }]
346
- }
347
- },
348
- extraProps: {
349
- defaultValue: 'number'
350
- }
351
- }, {
352
- name: 'valuePrefix',
353
- title: '数值前缀',
354
- setter: 'StringSetter',
355
- extraProps: {
356
- defaultValue: ''
357
- }
358
- }, {
359
- name: 'valueSuffix',
360
- title: '数值后缀',
361
- setter: 'StringSetter',
362
- extraProps: {
363
- defaultValue: ''
364
- }
365
- }]
366
- }, {
367
- type: 'group',
368
- title: '颜色',
369
- setter: {
370
- componentName: 'CollapseSetter',
371
- props: {
372
- icon: false
373
- }
374
- },
375
- items: [{
376
- name: 'progressBarColors',
377
- title: '进度条颜色',
378
- setter: 'ColorSetter',
379
- extraProps: {
380
- defaultValue: ['#00d4ff', '#9b59b6']
381
- }
382
- }, {
383
- name: 'nameColor',
384
- title: '名称颜色',
385
- setter: 'ColorSetter',
386
- extraProps: {
387
- defaultValue: '#e6e6e6'
388
- }
389
- }, {
390
- name: 'valueColor',
391
- title: '数值颜色',
392
- setter: 'ColorSetter',
393
- extraProps: {
394
- defaultValue: '#00d4ff'
395
- }
396
- }, {
397
- name: 'backgroundColor',
398
- title: '背景颜色',
399
- setter: 'ColorSetter',
400
- extraProps: {
401
- defaultValue: 'rgba(10, 10, 26, 0.95)'
402
- }
403
- }, {
404
- name: 'borderColor',
405
- title: '边框颜色',
406
- setter: 'ColorSetter',
407
- extraProps: {
408
- defaultValue: 'rgba(26, 26, 62, 0.8)'
409
- }
410
- }, {
411
- name: 'itemBackgroundColor',
412
- title: '行背景颜色',
413
- setter: 'ColorSetter',
414
- extraProps: {
415
- defaultValue: 'rgba(15, 15, 42, 0.9)'
416
- }
417
- }, {
418
- name: 'itemBorderColor',
419
- title: '行边框颜色',
420
- setter: 'ColorSetter',
421
- extraProps: {
422
- defaultValue: 'rgba(26, 26, 62, 0.6)'
423
- }
424
- }]
425
- }]
426
- }, {
427
- type: 'group',
428
- key: 'data',
429
- title: '数据',
430
- items: [{
431
- name: 'dataBinding',
432
- title: '数据绑定',
433
- setter: 'DataBindingSetter'
434
- }]
435
- }, {
436
- type: 'group',
437
- key: 'advanced',
438
- title: '高级',
439
- items: [{
440
- name: 'condition',
441
- title: '显隐控制',
442
- setter: 'SwitchSetter',
443
- extraProps: {
444
- defaultValue: true,
445
- supportVariable: true
446
- }
447
- }, {
448
- type: 'group',
449
- title: '滚动配置',
450
- setter: {
451
- componentName: 'CollapseSetter',
452
- props: {
453
- icon: false
454
- }
455
- },
456
- items: [{
457
- name: 'scrollEnable',
458
- title: '启用滚动',
459
- setter: 'SwitchSetter',
460
- extraProps: {
461
- defaultValue: true
462
- }
463
- }, {
464
- name: 'scrollDirection',
465
- title: '滚动方向',
466
- setter: {
467
- componentName: 'SegmentedSetter',
468
- props: {
469
- options: [{
470
- label: '向上',
471
- value: 'up'
472
- }, {
473
- label: '向下',
474
- value: 'down'
475
- }]
476
- }
477
- },
478
- extraProps: {
479
- defaultValue: 'up'
480
- }
481
- }, {
482
- name: 'scrollSpeed',
483
- title: '滚动速度',
484
- setter: {
485
- componentName: 'SliderSetter',
486
- props: {
487
- min: 1,
488
- max: 10,
489
- step: 1,
490
- suffix: 'x'
491
- }
492
- },
493
- extraProps: {
494
- defaultValue: 3
495
- }
496
- }, {
497
- name: 'hoverPause',
498
- title: '悬停暂停',
499
- setter: 'SwitchSetter',
500
- extraProps: {
501
- defaultValue: true
502
- }
503
- }, {
504
- name: 'scrollInterval',
505
- title: '滚动间隔',
506
- setter: {
507
- componentName: 'SliderSetter',
508
- props: {
509
- min: 1000,
510
- max: 10_000,
511
- step: 500,
512
- suffix: 'ms'
513
- }
514
- },
515
- extraProps: {
516
- defaultValue: 3000
517
- }
518
- }]
519
- }, {
520
- type: 'group',
521
- title: '动画',
522
- setter: {
523
- componentName: 'CollapseSetter',
524
- props: {
525
- icon: false
526
- }
527
- },
528
- items: [{
529
- name: 'animationEnable',
530
- title: '启用动画',
531
- setter: 'SwitchSetter',
532
- extraProps: {
533
- defaultValue: true
534
- }
535
- }, {
536
- name: 'animationDuration',
537
- title: '动画时长',
538
- setter: {
539
- componentName: 'SliderSetter',
540
- props: {
541
- min: 0,
542
- max: 2000,
543
- step: 100,
544
- suffix: 'ms'
545
- }
546
- },
547
- extraProps: {
548
- defaultValue: 500
549
- }
550
- }, {
551
- name: 'animationEasing',
552
- title: '缓动函数',
553
- setter: {
554
- componentName: 'SelectSetter',
555
- props: {
556
- options: [{
557
- label: '线性',
558
- value: 'linear'
559
- }, {
560
- label: '缓入',
561
- value: 'ease-in'
562
- }, {
563
- label: '缓出',
564
- value: 'ease-out'
565
- }, {
566
- label: '缓入缓出',
567
- value: 'ease-in-out'
568
- }]
569
- }
570
- },
571
- extraProps: {
572
- defaultValue: 'ease-out'
573
- }
574
- }]
575
- }]
576
- }]
577
- }],
578
- component: {},
579
- supports: {},
580
- advanced: {}
581
- };
582
-
583
- const snippets = [{
584
- title: '排行榜',
585
- screenshot: '',
586
- schema: {
587
- componentName: COMPONENT_NAME,
588
- props: {
589
- data: [{
590
- rank: 1,
591
- name: '北京',
592
- value: 9800
593
- }, {
594
- rank: 2,
595
- name: '上海',
596
- value: 8500
597
- }, {
598
- rank: 3,
599
- name: '广州',
600
- value: 7200
601
- }, {
602
- rank: 4,
603
- name: '深圳',
604
- value: 6100
605
- }, {
606
- rank: 5,
607
- name: '杭州',
608
- value: 4800
609
- }],
610
- maxItems: 5,
611
- showMedal: true,
612
- progressBarEnable: true,
613
- progressBarGradient: true,
614
- progressBarColors: ['#00d4ff', '#9b59b6']
615
- },
616
- $dashboard: {
617
- rect: {
618
- width: 320,
619
- height: 280
620
- }
621
- }
622
- }
623
- }, {
624
- title: '简单列表',
625
- screenshot: '',
626
- schema: {
627
- componentName: COMPONENT_NAME,
628
- props: {
629
- data: [{
630
- rank: 1,
631
- name: '产品A',
632
- value: 1250
633
- }, {
634
- rank: 2,
635
- name: '产品B',
636
- value: 980
637
- }, {
638
- rank: 3,
639
- name: '产品C',
640
- value: 750
641
- }],
642
- maxItems: 3,
643
- showMedal: false,
644
- progressBarEnable: true,
645
- progressBarGradient: false,
646
- progressBarColors: ['#00ff88', '#00ff88']
647
- },
648
- $dashboard: {
649
- rect: {
650
- width: 280,
651
- height: 180
652
- }
653
- }
654
- }
655
- }];
656
-
657
- var version = "0.0.2";
658
- var pkg = {
659
- version: version};
660
-
661
- const meta = {
662
- componentName: COMPONENT_NAME,
663
- title: '滚动列表',
664
- group: MaterialGroup.DISPLAY,
665
- devMode: 'proCode',
666
- npm: {
667
- package: PACKAGE_NAME,
668
- version: pkg.version,
669
- globalName: COMPONENT_NAME,
670
- componentName: COMPONENT_NAME
671
- },
672
- snippets,
673
- configure
674
- };
675
-
676
- exports.component = ScrollList;
677
- exports.meta = meta;
678
-
679
- }));
680
- //# sourceMappingURL=index.js.map