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