@pisell/materials 1.0.89 → 1.0.90

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.
@@ -0,0 +1,696 @@
1
+ import { ComponentMetadata, Snippet } from "@alilc/lowcode-types";
2
+ import button from "../button/meta";
3
+
4
+ const DivMeta: ComponentMetadata = {
5
+ componentName: "RecordView",
6
+ title: "RecordView",
7
+ docUrl: "",
8
+ screenshot: "",
9
+ devMode: "proCode",
10
+ npm: {
11
+ package: "@pisell/materials",
12
+ version: "1.0.3",
13
+ exportName: "RecordView",
14
+ main: "src/index.tsx",
15
+ destructuring: true,
16
+ subName: "",
17
+ },
18
+ props: [
19
+ {
20
+ name: "dataSource",
21
+ title: { label: "列表数据源", tip: "列表数据源" },
22
+ propType: { type: "arrayOf", value: "any" },
23
+ setter: ["JsonSetter", "VariableSetter"],
24
+ },
25
+ {
26
+ name: "header",
27
+ title: {
28
+ label: "头部区域",
29
+ tip: "header | 头部区域",
30
+ },
31
+ propType: "node",
32
+ setter: {
33
+ componentName: "SlotSetter",
34
+ initialValue: {
35
+ type: "JSSlot",
36
+ value: [
37
+ {
38
+ componentName: "Typography.Text",
39
+ props: {
40
+ children: "List Title",
41
+ style: {
42
+ color: "var(--gray-900, #101828)",
43
+ fontSize: "20px",
44
+ fontWeight: 600,
45
+ },
46
+ },
47
+ },
48
+ ],
49
+ },
50
+ },
51
+ },
52
+ {
53
+ name: "renderItem",
54
+ title: {
55
+ label: "渲染函数",
56
+ tip: "renderItem | 当使用 dataSource 时,可以用 `renderItem` 自定义渲染列表项",
57
+ },
58
+ propType: "func",
59
+ setter: [
60
+ {
61
+ componentName: "SlotSetter",
62
+ title: "渲染函数插槽",
63
+ initialValue: {
64
+ type: "JSSlot",
65
+ params: ["item"],
66
+ value: [
67
+ {
68
+ componentName: "List.Item",
69
+ props: {},
70
+ children: {
71
+ componentName: "Typography.Text",
72
+ props: {
73
+ children: {
74
+ type: "JSExpression",
75
+ value: "this.item.text",
76
+ },
77
+ },
78
+ },
79
+ },
80
+ ],
81
+ },
82
+ },
83
+ {
84
+ componentName: "FunctionSetter",
85
+ props: {
86
+ template:
87
+ "renderItem(item,${extParams}){\n// 自定义渲染列表项\nreturn `item`;\n}",
88
+ },
89
+ },
90
+ "VariableSetter",
91
+ ],
92
+ },
93
+ {
94
+ name: "leftSpan",
95
+ title: {
96
+ label: "左侧比例",
97
+ tip: "leftSpan | 左侧比例",
98
+ },
99
+ propType: "number",
100
+ setter: {
101
+ componentName: "NumberSetter",
102
+ props: {
103
+ min: 0,
104
+ max: 24,
105
+ },
106
+ },
107
+ },
108
+ {
109
+ name: "rightSpan",
110
+ title: {
111
+ label: "右侧比例",
112
+ tip: "rightSpan | 右侧比例",
113
+ },
114
+ propType: "number",
115
+ setter: {
116
+ componentName: "NumberSetter",
117
+ props: {
118
+ min: 0,
119
+ max: 24,
120
+ },
121
+ },
122
+ },
123
+ {
124
+ name: "h-gutter",
125
+ title: {
126
+ label: "左右间距",
127
+ tip: "栅格水平间隔,单位为像素(px)",
128
+ },
129
+ propType: "number",
130
+ setter: {
131
+ componentName: "NumberSetter",
132
+ props: {
133
+ min: 0,
134
+ },
135
+ },
136
+ defaultValue: 0,
137
+ extraProps: {
138
+ getValue(target) {
139
+ const { node } = target;
140
+ const gutter = node.getPropValue("gutter");
141
+ if (typeof gutter === "number") {
142
+ return gutter;
143
+ } else if (Array.isArray(gutter)) {
144
+ return gutter[0];
145
+ }
146
+ return 0;
147
+ },
148
+ setValue(target, value) {
149
+ const { node } = target;
150
+ const gutter = node.getPropValue("gutter");
151
+ if (Array.isArray(gutter)) {
152
+ gutter[0] = value;
153
+ node.setPropValue("gutter", gutter);
154
+ } else {
155
+ node.setPropValue("gutter", [value, 0]);
156
+ }
157
+ },
158
+ },
159
+ },
160
+ {
161
+ name: "footer",
162
+ title: {
163
+ label: "底部区域",
164
+ tip: "footer | 底部区域",
165
+ },
166
+ propType: "node",
167
+ setter: {
168
+ componentName: "SlotSetter",
169
+ },
170
+ },
171
+ {
172
+ name: "listGap",
173
+ title: {
174
+ label: "列表间距",
175
+ tip: "listGap | 列表间距",
176
+ },
177
+ propType: "number",
178
+ setter: {
179
+ componentName: "NumberSetter",
180
+ },
181
+ defaultValue: 16,
182
+ },
183
+ {
184
+ name: "detail",
185
+ title: {
186
+ label: "详情区域",
187
+ tip: "detail | 详情区域",
188
+ },
189
+ propType: "node",
190
+ setter: {
191
+ componentName: "SlotSetter",
192
+ initialValue: {
193
+ type: "JSSlot",
194
+ value: [
195
+ {
196
+ componentName: "Typography.Text",
197
+ props: {
198
+ children: "我是详情区域",
199
+ style: {
200
+ color: "var(--gray-900, #101828)",
201
+ fontSize: "20px",
202
+ fontWeight: 600,
203
+ },
204
+ },
205
+ },
206
+ ],
207
+ },
208
+ },
209
+ },
210
+ {
211
+ name: "search",
212
+ title: {
213
+ label: "搜索功能",
214
+ tip: "search | 搜索功能",
215
+ },
216
+ propType: "bool",
217
+ },
218
+ {
219
+ name: "pcDetailModalDisplay",
220
+ title: {
221
+ label: "详情弹窗展示(PC端)",
222
+ tip: "detailModalDisplay | 详情弹窗展示",
223
+ },
224
+ propType: "bool",
225
+ },
226
+ {
227
+ name: "padDetailModalDisplay",
228
+ title: {
229
+ label: "详情弹窗展示(Pad端)",
230
+ tip: "detailModalDisplay | 详情弹窗展示",
231
+ },
232
+ propType: "bool",
233
+ },
234
+ {
235
+ name: "mobilePadDetailModalDisplay",
236
+ title: {
237
+ label: "详情弹窗展示(Modal端)",
238
+ tip: "detailModalDisplay | 详情弹窗展示",
239
+ },
240
+ propType: "bool",
241
+ },
242
+ /*{
243
+ name: 'split',
244
+ title: { label: '展示分割线', tip: 'split | 是否展示分割线' },
245
+ propType: 'bool',
246
+ defaultValue: true,
247
+ setter: 'BoolSetter',
248
+ },*/
249
+ {
250
+ title: "分页",
251
+ display: "block",
252
+ type: "group",
253
+ items: [
254
+ {
255
+ name: "paginationType",
256
+ title: {
257
+ label: "分页类型",
258
+ tip: "paginationType | 分页类型 ",
259
+ },
260
+ propType: { type: "oneOf", value: ["default", "scroll"] },
261
+ setter: [
262
+ {
263
+ componentName: "RadioGroupSetter",
264
+ props: {
265
+ options: [
266
+ {
267
+ title: "分页器",
268
+ value: "default",
269
+ },
270
+ {
271
+ title: "滑动加载",
272
+ value: "scroll",
273
+ },
274
+ ],
275
+ },
276
+ },
277
+ "VariableSetter",
278
+ ],
279
+ extraProps: {
280
+ setValue: (target, value) => {
281
+ if (value === "scroll") {
282
+ target.parent.setPropValue("pagination", {
283
+ pageSize: 5,
284
+ current: 1,
285
+ size: "default",
286
+ });
287
+ }
288
+ },
289
+ },
290
+ defaultValue: "default",
291
+ },
292
+ {
293
+ name: "listHeight",
294
+ title: {
295
+ label: "列表高度",
296
+ tip: "listHeight | 列表高度",
297
+ },
298
+ propType: "string",
299
+ setter: "StringSetter",
300
+ condition: {
301
+ type: "JSFunction",
302
+ value:
303
+ 'target => target.getProps().getPropValue("paginationType") === "scroll"',
304
+ },
305
+ defaultValue: 400,
306
+ },
307
+ {
308
+ name: "pagination",
309
+ title: { label: "显示分页", tip: "pagination | 显示分页" },
310
+ propType: "object",
311
+ setter: "BoolSetter",
312
+ extraProps: {
313
+ setValue: (target, value) => {
314
+ if (value) {
315
+ target.parent.setPropValue("pagination", {
316
+ pageSize: 5,
317
+ current: 1,
318
+ size: "default",
319
+ });
320
+ }
321
+ },
322
+ },
323
+ condition: {
324
+ type: "JSFunction",
325
+ value:
326
+ 'target => target.getProps().getPropValue("paginationType") === "default"',
327
+ },
328
+ },
329
+ {
330
+ name: "pagination.pageSize",
331
+ title: { label: "每页条数", tip: "pagination.pageSize | 每页条数" },
332
+ setter: "NumberSetter",
333
+ condition: {
334
+ type: "JSFunction",
335
+ value: 'target => !!target.getProps().getPropValue("pagination")',
336
+ },
337
+ },
338
+ {
339
+ name: "pagination.total",
340
+ title: { label: "数据总数", tip: "pagination.total | 数据总数" },
341
+ setter: "NumberSetter",
342
+ condition: {
343
+ type: "JSFunction",
344
+ value: 'target => !!target.getProps().getPropValue("pagination")',
345
+ },
346
+ },
347
+ // {
348
+ // name: 'pagination.defaultCurrent',
349
+ // title: {
350
+ // label: '默认当前页',
351
+ // tip: 'pagination.defaultCurrent | 默认的当前页数',
352
+ // },
353
+ // setter: [
354
+ // {
355
+ // componentName: 'NumberSetter',
356
+ // props: {
357
+ // initialValue: 1,
358
+ // },
359
+ // },
360
+ // 'VariableSetter',
361
+ // ],
362
+ // condition: {
363
+ // type: 'JSFunction',
364
+ // value: 'target => !!target.getProps().getPropValue("pagination")',
365
+ // },
366
+ // },
367
+ {
368
+ name: "pagination.current",
369
+ title: { label: "当前页数", tip: "pagination.current | 当前页数" },
370
+ setter: "NumberSetter",
371
+ condition: {
372
+ type: "JSFunction",
373
+ value: 'target => !!target.getProps().getPropValue("pagination")',
374
+ },
375
+ },
376
+ /*{
377
+ name: 'pagination.showTotal',
378
+ title: {
379
+ label: '显示总数',
380
+ tip: 'pagination.showTotal | 用于显示数据总量和当前数据顺序',
381
+ },
382
+ propType: 'func',
383
+ setter: [
384
+ {
385
+ componentName: 'FunctionSetter',
386
+ props: {
387
+ template:
388
+ 'showTotal(total,range,${extParams}){\n// 用于格式化显示表格数据总量\nreturn `共 ${total} 条`;\n}',
389
+ },
390
+ },
391
+ 'VariableSetter',
392
+ ],
393
+ condition: {
394
+ type: 'JSFunction',
395
+ value: 'target => !!target.getProps().getPropValue("pagination")',
396
+ },
397
+ },*/
398
+ /*{
399
+ name: 'pagination.showSizeChanger',
400
+ title: {
401
+ label: '页数切换',
402
+ tip: 'pagination.showSizeChanger | 是否展示 pageSize 切换器',
403
+ },
404
+ propType: 'bool',
405
+ setter: 'BoolSetter',
406
+ defaultValue: false,
407
+ condition: {
408
+ type: 'JSFunction',
409
+ value: 'target => !!target.getProps().getPropValue("pagination")',
410
+ },
411
+ },
412
+ {
413
+ name: 'pagination.showQuickJumper',
414
+ title: {
415
+ label: '快速跳转',
416
+ tip: 'pagination.showQuickJumper | 是否可以快速跳转至某页',
417
+ },
418
+ propType: 'bool',
419
+ setter: 'BoolSetter',
420
+ defaultValue: false,
421
+ condition: {
422
+ type: 'JSFunction',
423
+ value: 'target => !!target.getProps().getPropValue("pagination")',
424
+ },
425
+ },
426
+ {
427
+ name: 'pagination.simple',
428
+ title: { label: '简单分页', tip: 'pagination.simple | 简单分页' },
429
+ propType: 'bool',
430
+ setter: 'BoolSetter',
431
+ defaultValue: false,
432
+ condition: {
433
+ type: 'JSFunction',
434
+ value: 'target => !!target.getProps().getPropValue("pagination")',
435
+ },
436
+ },*/
437
+ /*{
438
+ name: 'pagination.size',
439
+ title: { label: '分页尺寸', tip: 'pagination.size | 分页尺寸' },
440
+ propType: {
441
+ type: 'oneOf',
442
+ value: ['default', 'small'],
443
+ },
444
+ setter: [
445
+ {
446
+ componentName: 'RadioGroupSetter',
447
+ props: {
448
+ options: [
449
+ {
450
+ title: '默认',
451
+ value: 'default',
452
+ },
453
+ {
454
+ title: '小',
455
+ value: 'small',
456
+ },
457
+ ],
458
+ },
459
+ },
460
+ 'VariableSetter',
461
+ ],
462
+ defaultValue: 'default',
463
+ condition: {
464
+ type: 'JSFunction',
465
+ value: 'target => !!target.getProps().getPropValue("pagination")',
466
+ },
467
+ },*/
468
+ {
469
+ name: "pagination.onChange",
470
+ title: {
471
+ label: "分页改变事件",
472
+ tip: "pagination.onChange | 分页改变事件",
473
+ },
474
+ setter: {
475
+ componentName: "FunctionSetter",
476
+ props: {
477
+ template:
478
+ 'onPaginationChange(page,pageSize){console.log(page,pageSize,"page,pageSize")}',
479
+ },
480
+ },
481
+ condition: {
482
+ type: "JSFunction",
483
+ value: 'target => !!target.getProps().getPropValue("pagination")',
484
+ },
485
+ },
486
+
487
+ {
488
+ name: "pagination.position",
489
+ title: { label: "分页位置", tip: "pagination.position | 分页位置" },
490
+ setter: {
491
+ componentName: "SelectSetter",
492
+ props: {
493
+ options: [
494
+ {
495
+ title: "上",
496
+ value: "top",
497
+ },
498
+ {
499
+ title: "下",
500
+ value: "bottom",
501
+ },
502
+ {
503
+ title: "上下",
504
+ value: "both",
505
+ },
506
+ ],
507
+ },
508
+ initialValue: "bottomRight",
509
+ },
510
+ condition: {
511
+ type: "JSFunction",
512
+ value: 'target => !!target.getProps().getPropValue("pagination")',
513
+ },
514
+ },
515
+ ],
516
+ },
517
+ {
518
+ title: "数据为空时",
519
+ display: "block",
520
+ type: "group",
521
+ items: [
522
+ {
523
+ name: "locale.emptyText",
524
+ title: {
525
+ label: "提示文本",
526
+ tip: "emptyText | 提示文本",
527
+ },
528
+ setter: "StringSetter",
529
+ defaultValue: "暂无数据",
530
+ },
531
+ {
532
+ name: "emptyButtons",
533
+ title: { label: "按钮项", tip: "右侧按钮项" },
534
+ setter: {
535
+ componentName: "ArraySetter",
536
+ props: {
537
+ itemSetter: {
538
+ componentName: "ObjectSetter",
539
+ props: {
540
+ config: {
541
+ items: [
542
+ {
543
+ name: "title",
544
+ title: { label: "按钮名称", tip: "按钮名称" },
545
+ propType: "string",
546
+ setter: "PisellI18nSetter",
547
+ isRequired: true,
548
+ },
549
+ ...button.configure.props,
550
+ {
551
+ name: "onClick",
552
+ title: { label: "点击事件", tip: "点击事件" },
553
+ propType: "func",
554
+ setter: "FunctionSetter",
555
+ },
556
+ {
557
+ name: "action",
558
+ title: { label: "功能", tip: "按钮的功能" },
559
+ propType: "string",
560
+ setter: [
561
+ {
562
+ componentName: "SelectSetter",
563
+ mode: "single",
564
+ defaultValue: "add",
565
+ props: {
566
+ options: [
567
+ {
568
+ title: "Add",
569
+ value: "add",
570
+ },
571
+ {
572
+ title: "Reset",
573
+ value: "reset",
574
+ },
575
+ ],
576
+ },
577
+ },
578
+ ],
579
+ },
580
+
581
+ {
582
+ name: "other",
583
+ title: {
584
+ label: "其他拓展属性",
585
+ tip: "其他拓展属性",
586
+ },
587
+ propType: "object",
588
+ setter: "JsonSetter",
589
+ },
590
+ ],
591
+ },
592
+ },
593
+ initialValue: { title: "按钮" },
594
+ },
595
+ },
596
+ },
597
+ },
598
+ ],
599
+ },
600
+ ],
601
+ configure: {
602
+ supports: {
603
+ style: true,
604
+ events: [
605
+ {
606
+ name: "onRowClick",
607
+ template:
608
+ "onRowClick(item,${extParams}){\n// 点击行时的回调\nconsole.log('onRowClick', item);}",
609
+ },
610
+ {
611
+ name: "loadMoreData",
612
+ template: "loadMoreData(){\n// \nconsole.log('loadMoreData');}",
613
+ },
614
+ ],
615
+ },
616
+ component: {
617
+ isContainer: true,
618
+ },
619
+ },
620
+ };
621
+ const snippets: Snippet[] = [
622
+ {
623
+ title: "RecordView",
624
+ screenshot: "",
625
+ schema: {
626
+ componentName: "RecordView",
627
+ props: {
628
+ dataSource: [
629
+ {
630
+ id: 1,
631
+ text: "Racing car sprays burning fuel into crowd.",
632
+ },
633
+ {
634
+ id: 2,
635
+ text: "Japanese princess to wed commoner.",
636
+ },
637
+ {
638
+ id: 3,
639
+ text: "Australian walks 100km after outback crash.",
640
+ },
641
+ {
642
+ id: 4,
643
+ text: "Man charged over missing wedding girl.",
644
+ },
645
+ {
646
+ id: 5,
647
+ text: "Los Angeles battles huge wildfires.",
648
+ },
649
+ ],
650
+ renderItem: {
651
+ type: "JSSlot",
652
+ params: ["item"],
653
+ value: [
654
+ {
655
+ componentName: "List.Item",
656
+ props: {
657
+ style: {
658
+ border: "1px solid var(--gray-300, #D0D5DD)",
659
+ borderRadius: "12px",
660
+ padding: "16px 20px",
661
+ fontWeight: 600,
662
+ cursor: "pointer",
663
+ },
664
+ },
665
+ children: {
666
+ componentName: "Typography.Text",
667
+ props: {
668
+ children: {
669
+ type: "JSExpression",
670
+ value: "this.item.text",
671
+ },
672
+ },
673
+ },
674
+ },
675
+ ],
676
+ },
677
+ pagination: {
678
+ position: "bottomRight",
679
+ size: "default",
680
+ showSizeChanger: false,
681
+ },
682
+ leftSpan: 12,
683
+ rightSpan: 12,
684
+ gutter: [40, 0],
685
+ style: {
686
+ padding: 20,
687
+ },
688
+ },
689
+ },
690
+ },
691
+ ];
692
+
693
+ export default {
694
+ ...DivMeta,
695
+ snippets,
696
+ };