@easy-editor/materials-dashboard-text 0.0.9 → 0.0.11

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 CHANGED
@@ -1,64 +1,165 @@
1
- /* @easy-editor/materials-dashboard-text v0.0.8 */
1
+ /* @easy-editor/materials-dashboard-text v0.0.10 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime'], factory) :
5
5
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EasyEditorMaterialsText = {}, global.jsxRuntime));
6
6
  })(this, (function (exports, jsxRuntime) { 'use strict';
7
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
+
8
14
  const MaterialGroup = {
9
15
  BASIC: 'basic'};
10
16
 
11
- const COMPONENT_NAME = 'EasyEditorMaterialsText';
12
- const PACKAGE_NAME = '@easy-editor/materials-dashboard-text';
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
+ }
13
41
 
14
- const Text = props => {
15
- const {
16
- ref,
17
- text = 'Text',
18
- fontSize = 14,
19
- color = '#ffffff',
20
- fontWeight = 'normal',
21
- textAlign = 'left',
22
- lineHeight = 1.5,
23
- className = '',
24
- style: externalStyle
25
- } = props;
26
- const internalStyle = {
27
- width: '100%',
28
- height: '100%',
29
- fontSize: typeof fontSize === 'number' ? `${fontSize}px` : fontSize,
30
- color,
42
+ var css_248z = ".component-module__container___VbZSk{display:flex;height:100%;width:100%}.component-module__text___nFUOn{display:inline-block;word-break:break-word}.component-module__link___20asF{cursor:pointer;text-decoration:none;transition:opacity .2s ease}.component-module__link___20asF:hover{opacity:.8}.component-module__underline___0oAJz{text-decoration:underline}.component-module__alignLeft___IOvpO{justify-content:flex-start;text-align:left}.component-module__alignCenter___EIwIC{justify-content:center;text-align:center}.component-module__alignRight___p3ReL{justify-content:flex-end;text-align:right}.component-module__valignTop___-5DmK{align-items:flex-start}.component-module__valignMiddle___i0are{align-items:center}.component-module__valignBottom___97zzw{align-items:flex-end}";
43
+ var styles = {"container":"component-module__container___VbZSk","text":"component-module__text___nFUOn","link":"component-module__link___20asF","underline":"component-module__underline___0oAJz","alignLeft":"component-module__alignLeft___IOvpO","alignCenter":"component-module__alignCenter___EIwIC","alignRight":"component-module__alignRight___p3ReL","valignTop":"component-module__valignTop___-5DmK","valignMiddle":"component-module__valignMiddle___i0are","valignBottom":"component-module__valignBottom___97zzw"};
44
+ styleInject(css_248z);
45
+
46
+ /**
47
+ * Text Component
48
+ * 文本组件 - 支持普通文本、链接、标题、发光效果
49
+ */
50
+
51
+ const getAlignClass = align => {
52
+ switch (align) {
53
+ case 'left':
54
+ return styles.alignLeft;
55
+ case 'center':
56
+ return styles.alignCenter;
57
+ case 'right':
58
+ return styles.alignRight;
59
+ default:
60
+ return styles.alignLeft;
61
+ }
62
+ };
63
+ const getValignClass = align => {
64
+ switch (align) {
65
+ case 'top':
66
+ return styles.valignTop;
67
+ case 'middle':
68
+ return styles.valignMiddle;
69
+ case 'bottom':
70
+ return styles.valignBottom;
71
+ default:
72
+ return styles.valignMiddle;
73
+ }
74
+ };
75
+ const Text = ({
76
+ ref,
77
+ content = '文本内容',
78
+ fontSize = 16,
79
+ fontWeight = 'normal',
80
+ fontFamily = 'inherit',
81
+ color = '#ffffff',
82
+ textAlign = 'left',
83
+ verticalAlign = 'middle',
84
+ lineHeight = 1.5,
85
+ letterSpacing = 0,
86
+ isLink = false,
87
+ href = '',
88
+ target = '_blank',
89
+ underline = false,
90
+ glowEnable = false,
91
+ glowColor = '#00d4ff',
92
+ glowIntensity = 1,
93
+ style: externalStyle
94
+ }) => {
95
+ // 计算发光效果
96
+ const textShadow = glowEnable ? `0 0 ${10 * glowIntensity}px ${glowColor}, 0 0 ${20 * glowIntensity}px ${glowColor}, 0 0 ${30 * glowIntensity}px ${glowColor}` : undefined;
97
+ const textStyle = {
98
+ fontSize,
31
99
  fontWeight,
32
- textAlign,
100
+ fontFamily,
101
+ color,
33
102
  lineHeight,
34
- wordBreak: 'break-word',
35
- whiteSpace: 'pre-wrap'
36
- };
37
- const mergedStyle = {
38
- ...internalStyle,
39
- ...externalStyle
103
+ letterSpacing,
104
+ textShadow
40
105
  };
106
+ const containerClass = cn(styles.container, getAlignClass(textAlign), getValignClass(verticalAlign));
107
+ const textClass = cn(styles.text, isLink && styles.link, underline && styles.underline);
108
+
109
+ // 链接模式
110
+ if (isLink && href) {
111
+ const relValue = target === '_blank' ? 'noopener noreferrer' : '';
112
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
113
+ className: containerClass,
114
+ ref: ref,
115
+ style: externalStyle,
116
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
117
+ className: textClass,
118
+ href: href,
119
+ rel: relValue,
120
+ style: textStyle,
121
+ target: target,
122
+ children: content
123
+ })
124
+ });
125
+ }
126
+
127
+ // 普通文本
41
128
  return /*#__PURE__*/jsxRuntime.jsx("div", {
42
- className: className,
129
+ className: containerClass,
43
130
  ref: ref,
44
- style: mergedStyle,
45
- children: text
131
+ style: externalStyle,
132
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
133
+ className: textClass,
134
+ style: textStyle,
135
+ children: content
136
+ })
46
137
  });
47
138
  };
48
139
 
49
140
  const configure = {
50
141
  props: [{
51
142
  type: 'group',
52
- title: '功能',
143
+ title: '属性',
53
144
  setter: 'TabSetter',
54
145
  items: [{
55
146
  type: 'group',
56
- key: 'basic',
57
- title: '基本',
58
- items: [{
147
+ key: 'config',
148
+ title: '配置',
149
+ setter: {
150
+ componentName: 'CollapseSetter',
151
+ props: {
152
+ icon: false
153
+ }
154
+ },
155
+ items: [
156
+ {
59
157
  name: 'id',
60
158
  title: 'ID',
61
- setter: 'NodeIdSetter'
159
+ setter: 'NodeIdSetter',
160
+ extraProps: {
161
+ label: false
162
+ }
62
163
  }, {
63
164
  name: 'title',
64
165
  title: '标题',
@@ -93,13 +194,56 @@
93
194
  }
94
195
  }
95
196
  }]
96
- }, {
97
- name: 'text',
98
- title: '文本内容',
99
- setter: 'StringSetter'
197
+ },
198
+ {
199
+ type: 'group',
200
+ title: '内容',
201
+ setter: {
202
+ componentName: 'CollapseSetter',
203
+ props: {
204
+ icon: false
205
+ }
206
+ },
207
+ items: [{
208
+ name: 'content',
209
+ title: '文本内容',
210
+ setter: 'TextAreaSetter',
211
+ extraProps: {
212
+ defaultValue: '文本内容'
213
+ }
214
+ }, {
215
+ name: 'isLink',
216
+ title: '作为链接',
217
+ setter: 'SwitchSetter',
218
+ extraProps: {
219
+ defaultValue: false
220
+ }
221
+ }, {
222
+ name: 'href',
223
+ title: '链接地址',
224
+ setter: 'StringSetter'
225
+ }, {
226
+ name: 'target',
227
+ title: '打开方式',
228
+ setter: {
229
+ componentName: 'SelectSetter',
230
+ props: {
231
+ options: [{
232
+ label: '新窗口',
233
+ value: '_blank'
234
+ }, {
235
+ label: '当前窗口',
236
+ value: '_self'
237
+ }]
238
+ }
239
+ },
240
+ extraProps: {
241
+ defaultValue: '_blank'
242
+ }
243
+ }]
100
244
  }, {
101
245
  type: 'group',
102
- title: '字体样式',
246
+ title: '字体',
103
247
  setter: {
104
248
  componentName: 'CollapseSetter',
105
249
  props: {
@@ -111,14 +255,7 @@
111
255
  title: '字体大小',
112
256
  setter: 'NumberSetter',
113
257
  extraProps: {
114
- defaultValue: 14
115
- }
116
- }, {
117
- name: 'color',
118
- title: '文字颜色',
119
- setter: 'ColorSetter',
120
- extraProps: {
121
- defaultValue: '#000000'
258
+ defaultValue: 16
122
259
  }
123
260
  }, {
124
261
  name: 'fontWeight',
@@ -132,39 +269,19 @@
132
269
  }, {
133
270
  label: '粗体',
134
271
  value: 'bold'
135
- }, {
136
- label: '100',
137
- value: '100'
138
- }, {
139
- label: '200',
140
- value: '200'
141
- }, {
142
- label: '300',
143
- value: '300'
144
- }, {
145
- label: '400',
146
- value: '400'
147
- }, {
148
- label: '500',
149
- value: '500'
150
- }, {
151
- label: '600',
152
- value: '600'
153
- }, {
154
- label: '700',
155
- value: '700'
156
- }, {
157
- label: '800',
158
- value: '800'
159
- }, {
160
- label: '900',
161
- value: '900'
162
272
  }]
163
273
  }
164
274
  },
165
275
  extraProps: {
166
276
  defaultValue: 'normal'
167
277
  }
278
+ }, {
279
+ name: 'color',
280
+ title: '颜色',
281
+ setter: 'ColorSetter',
282
+ extraProps: {
283
+ defaultValue: '#ffffff'
284
+ }
168
285
  }, {
169
286
  name: 'lineHeight',
170
287
  title: '行高',
@@ -172,39 +289,62 @@
172
289
  extraProps: {
173
290
  defaultValue: 1.5
174
291
  }
175
- }, {
292
+ }]
293
+ }, {
294
+ type: 'group',
295
+ title: '对齐',
296
+ setter: {
297
+ componentName: 'CollapseSetter',
298
+ props: {
299
+ icon: false
300
+ }
301
+ },
302
+ items: [{
176
303
  name: 'textAlign',
177
- title: '文本对齐',
304
+ title: '水平对齐',
178
305
  setter: {
179
- componentName: 'RadioGroupSetter',
306
+ componentName: 'SegmentedSetter',
180
307
  props: {
181
308
  options: [{
182
- label: '左对齐',
309
+ label: '',
183
310
  value: 'left'
184
311
  }, {
185
- label: '居中',
312
+ label: '',
186
313
  value: 'center'
187
314
  }, {
188
- label: '右对齐',
315
+ label: '',
189
316
  value: 'right'
190
- }, {
191
- label: '两端对齐',
192
- value: 'justify'
193
317
  }]
194
318
  }
195
319
  },
196
320
  extraProps: {
197
321
  defaultValue: 'left'
198
322
  }
323
+ }, {
324
+ name: 'verticalAlign',
325
+ title: '垂直对齐',
326
+ setter: {
327
+ componentName: 'SegmentedSetter',
328
+ props: {
329
+ options: [{
330
+ label: '上',
331
+ value: 'top'
332
+ }, {
333
+ label: '中',
334
+ value: 'middle'
335
+ }, {
336
+ label: '下',
337
+ value: 'bottom'
338
+ }]
339
+ }
340
+ },
341
+ extraProps: {
342
+ defaultValue: 'middle'
343
+ }
199
344
  }]
200
- }]
201
- }, {
202
- type: 'group',
203
- key: 'advanced',
204
- title: '高级',
205
- items: [{
345
+ }, {
206
346
  type: 'group',
207
- title: '高级设置',
347
+ title: '效果',
208
348
  setter: {
209
349
  componentName: 'CollapseSetter',
210
350
  props: {
@@ -212,38 +352,69 @@
212
352
  }
213
353
  },
214
354
  items: [{
215
- title: '显隐',
355
+ name: 'underline',
356
+ title: '下划线',
216
357
  setter: 'SwitchSetter',
217
358
  extraProps: {
218
- supportVariable: true,
219
- getValue(target) {
220
- return target.getExtraPropValue('condition');
221
- },
222
- setValue(target, value) {
223
- target.setExtraPropValue('condition', value);
224
- }
359
+ defaultValue: false
360
+ }
361
+ }, {
362
+ name: 'glowEnable',
363
+ title: '发光效果',
364
+ setter: 'SwitchSetter',
365
+ extraProps: {
366
+ defaultValue: false
367
+ }
368
+ }, {
369
+ name: 'glowColor',
370
+ title: '发光颜色',
371
+ setter: 'ColorSetter',
372
+ extraProps: {
373
+ defaultValue: '#00d4ff'
225
374
  }
226
375
  }]
227
376
  }]
377
+ }, {
378
+ type: 'group',
379
+ key: 'data',
380
+ title: '数据',
381
+ items: [{
382
+ name: 'dataBinding',
383
+ title: '数据绑定',
384
+ setter: 'DataBindingSetter'
385
+ }]
386
+ }, {
387
+ type: 'group',
388
+ key: 'advanced',
389
+ title: '高级',
390
+ items: [{
391
+ name: 'condition',
392
+ title: '显隐控制',
393
+ setter: 'SwitchSetter',
394
+ extraProps: {
395
+ defaultValue: true,
396
+ supportVariable: true
397
+ }
398
+ }]
228
399
  }]
229
400
  }],
230
401
  component: {},
231
402
  supports: {},
232
- advanced: {
233
- view: Text
234
- }
403
+ advanced: {}
235
404
  };
236
405
 
406
+ const COMPONENT_NAME = 'EasyEditorMaterialsText';
407
+ const PACKAGE_NAME = '@easy-editor/materials-dashboard-text';
408
+
237
409
  const snippets = [{
238
- title: 'Text',
239
- screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',
410
+ title: '普通文本',
411
+ screenshot: '',
240
412
  schema: {
241
413
  componentName: COMPONENT_NAME,
242
414
  props: {
243
- text: 'Text Text Text',
244
- fontSize: 14,
245
- color: '#ffffff',
246
- textAlign: 'left'
415
+ content: '这是一段普通文本',
416
+ fontSize: 16,
417
+ color: '#ffffff'
247
418
  },
248
419
  $dashboard: {
249
420
  rect: {
@@ -253,39 +424,87 @@
253
424
  }
254
425
  }
255
426
  }, {
256
- title: 'Heading',
257
- screenshot: 'https://img.alicdn.com/imgextra/i3/O1CN01n5wpxc1bi862KuXFz_!!6000000003498-55-tps-50-50.svg',
427
+ title: '标题文本',
428
+ screenshot: '',
258
429
  schema: {
259
430
  componentName: COMPONENT_NAME,
260
431
  props: {
261
- text: 'Heading',
262
- fontSize: 24,
263
- color: '#ffffff',
432
+ content: '标题文本',
433
+ fontSize: 32,
264
434
  fontWeight: 'bold',
435
+ color: '#ffffff',
265
436
  textAlign: 'center'
266
437
  },
267
438
  $dashboard: {
268
439
  rect: {
269
440
  width: 200,
270
- height: 50
441
+ height: 60
442
+ }
443
+ }
444
+ }
445
+ }, {
446
+ title: '发光标题',
447
+ screenshot: '',
448
+ schema: {
449
+ componentName: COMPONENT_NAME,
450
+ props: {
451
+ content: '发光标题',
452
+ fontSize: 36,
453
+ fontWeight: 'bold',
454
+ color: '#00d4ff',
455
+ textAlign: 'center',
456
+ glowEnable: true,
457
+ glowColor: '#00d4ff',
458
+ glowIntensity: 1.5
459
+ },
460
+ $dashboard: {
461
+ rect: {
462
+ width: 240,
463
+ height: 80
464
+ }
465
+ }
466
+ }
467
+ }, {
468
+ title: '链接文本',
469
+ screenshot: '',
470
+ schema: {
471
+ componentName: COMPONENT_NAME,
472
+ props: {
473
+ content: '点击跳转',
474
+ fontSize: 16,
475
+ color: '#00d4ff',
476
+ isLink: true,
477
+ href: 'https://easy-editor-docs.vercel.app/',
478
+ target: '_blank',
479
+ underline: true
480
+ },
481
+ $dashboard: {
482
+ rect: {
483
+ width: 120,
484
+ height: 40
271
485
  }
272
486
  }
273
487
  }
274
488
  }];
275
489
 
490
+ var version = "0.0.10";
491
+ var pkg = {
492
+ version: version};
493
+
276
494
  const meta = {
277
495
  componentName: COMPONENT_NAME,
278
- title: 'Text',
496
+ title: '文本',
497
+ category: 'dashboard',
279
498
  group: MaterialGroup.BASIC,
280
499
  devMode: 'proCode',
281
500
  npm: {
282
501
  package: PACKAGE_NAME,
283
- version: 'latest',
502
+ version: pkg.version,
284
503
  globalName: COMPONENT_NAME,
285
504
  componentName: COMPONENT_NAME
286
505
  },
287
- snippets,
288
- configure
506
+ configure,
507
+ snippets
289
508
  };
290
509
 
291
510
  exports.component = Text;