@cloudbase/weda-ui 3.11.11 → 3.12.0

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 (27) hide show
  1. package/dist/configs/components/wd-form-arr.d.ts +4 -1
  2. package/dist/configs/components/wd-form-arr.js +11 -140
  3. package/dist/configs/components/wd-form-obj.d.ts +2 -0
  4. package/dist/configs/components/wd-form-obj.js +13 -1
  5. package/dist/configs/index.d.ts +8 -2
  6. package/dist/configs/type-utils/type-form.d.ts +2 -0
  7. package/dist/configs/type-utils/type-form.js +31 -3
  8. package/dist/configs/utils/field.d.ts +4 -0
  9. package/dist/configs/utils/field.js +508 -0
  10. package/dist/style/index.css +41 -3
  11. package/dist/style/index.scss +1 -1
  12. package/dist/style/weda-ui.min.css +2 -2
  13. package/dist/web/components/form/uploader/uploader.pc.d.ts +3 -1
  14. package/dist/web/components/form/uploader/uploader.pc.js +18 -14
  15. package/dist/web/components/wd-form-item/wd-form-item.js +3 -3
  16. package/dist/web/components/wd-form-obj/base-form-obj.js +4 -1
  17. package/dist/web/components/wd-image/ImagePreview.d.ts +1 -0
  18. package/dist/web/components/wd-image/ImagePreview.js +127 -0
  19. package/dist/web/components/wd-image/image.js +45 -155
  20. package/dist/web/components/wd-image/index.js +4 -0
  21. package/dist/web/components/wd-menu-list/CommonMenuList.js +12 -1
  22. package/dist/web/components/wd-rich-text/wd-rich-text.js +1 -1
  23. package/dist/web/components/wd-table/components/FieldRender/ImagePreview.js +8 -1
  24. package/dist/web/components/wd-table/components/FieldRender/index.js +2 -2
  25. package/dist/web/components/wd-upload-file/wd-upload-file.js +1 -1
  26. package/dist/web/components/wd-upload-image/wd-upload-image.js +1 -1
  27. package/package.json +3 -3
@@ -0,0 +1,508 @@
1
+ const $index_container_template = `
2
+
3
+ [[template.items.items.items]]
4
+ component = "Container"
5
+ label= "序号"
6
+ scopedStyle = """
7
+ .wd-pc-form-obj-root .table-option-box{
8
+ position: sticky;
9
+ right: 0;
10
+ width: 50px;
11
+ flex-shrink: 0;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ flex-direction: column;
16
+ background-color: #fff;
17
+ }
18
+ .wd-h5-form-obj-root .table-option-box{
19
+ background-color: #f1f2f5;
20
+ padding: 10px;
21
+ }
22
+ .wd-mp-form-obj-root .table-option-box{
23
+ background-color: #f1f2f5;
24
+ padding: 10px;
25
+ }"""
26
+ [template.items.items.items.attributes]
27
+ class = "table-option-box"
28
+
29
+
30
+ [[template.items.items.items.items]]
31
+ component = "Container"
32
+ scopedStyle = """
33
+ .wd-pc-form-obj-root .table-option-wrap{
34
+ width: 100%;
35
+ height: 52px;
36
+ background-color: #f3f3f3;
37
+ align-items: center;
38
+ justify-content: center;
39
+ }"""
40
+
41
+ [template.items.items.items.items.attributes]
42
+ class = "table-option-wrap"
43
+
44
+ [[template.items.items.items.items.items]]
45
+ component = "WdText"
46
+
47
+ [template.items.items.items.items.items.attributes]
48
+ inheritColor = true
49
+ maxLines = "1"
50
+ text = "序号"
51
+
52
+ [template.items.items.items.items.items.directives]
53
+ ":if" = true
54
+
55
+ [template.items.items.items.items.items.extra]
56
+
57
+ [template.items.items.items.items.directives]
58
+ ":if" = "$w.wedaContext.platforms.includes('PCWEB')"
59
+
60
+ [template.items.items.items.items.extra]
61
+
62
+ [[template.items.items.items.items]]
63
+ component = "Container"
64
+
65
+ [template.items.items.items.items.attributes]
66
+ data = { }
67
+
68
+ [template.items.items.items.items.attributes.style]
69
+ flex = 1
70
+ display = "flex"
71
+ alignItems = "center"
72
+
73
+ [[template.items.items.items.items.items]]
74
+ id = "text4"
75
+ component = "WdText"
76
+
77
+ [template.items.items.items.items.items.attributes]
78
+ inheritColor = true
79
+ maxLines = "1"
80
+ ":text" = "$w.index_{{$self.id}}+1"
81
+ `;
82
+ const $delete_button_template = `
83
+ [[template.items.items.items]]
84
+ component = "Container"
85
+ label= "操作列"
86
+ scopedStyle = """
87
+ .wd-pc-form-obj-root .table-option-box{
88
+ position: sticky;
89
+ right: 0;
90
+ width: 50px;
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: center;
94
+ flex-direction: column;
95
+ background-color: #fff;
96
+ border-top: 1px solid #dcdcdc;
97
+ }
98
+ .wd-pc-form-obj-root .table-option-box::before{
99
+ content: '';
100
+ position: absolute;
101
+ top: 0;
102
+ bottom: 0;
103
+ left: -25px;
104
+ width: 25px;
105
+ box-shadow: inset -8px 0 4px -7px rgb(0 0 0 / 10%)
106
+ }
107
+ .wd-mp-form-obj-root .delete-option{
108
+ position: absolute;
109
+ right: 0px;
110
+ top: 0px;
111
+ }
112
+ .wd-h5-form-obj-root .delete-option{
113
+ position: absolute;
114
+ right: 0px;
115
+ top: 0px;
116
+ }"""
117
+ [template.items.items.items.attributes]
118
+ class = "table-option-box delete-option"
119
+ [[template.items.items.items.items]]
120
+ component = "Container"
121
+ scopedStyle = """
122
+ .wd-pc-form-obj-root .table-option-wrap{
123
+ width: 100%;
124
+ height: 52px;
125
+ background-color: #f3f3f3;
126
+ align-items: center;
127
+ justify-content: center;
128
+ }"""
129
+
130
+ [template.items.items.items.items.attributes]
131
+ class = "table-option-wrap"
132
+
133
+ [[template.items.items.items.items.items]]
134
+ component = "WdText"
135
+
136
+ [template.items.items.items.items.items.attributes]
137
+ inheritColor = true
138
+ maxLines = "1"
139
+ text = "操作"
140
+
141
+
142
+ [template.items.items.items.items.directives]
143
+ ":if" = "$w.wedaContext.platforms.includes('PCWEB')"
144
+
145
+
146
+ [[template.items.items.items.items]]
147
+ component = "Container"
148
+
149
+ [template.items.items.items.items.attributes]
150
+
151
+ [template.items.items.items.items.attributes.style]
152
+ flex = 1
153
+ display = "flex"
154
+ alignItems = "center"
155
+
156
+ [[template.items.items.items.items.items]]
157
+ component = "WdIcon"
158
+ scopedStyle = """
159
+ :scope {
160
+ right: var(--wd-card-heder-pd-bordered);
161
+ top: var(--wd-card-heder-pd-bordered);
162
+ color: var(--wd-color-brand);
163
+ }
164
+
165
+ :scope.wd-mp-icon {
166
+ top: var(--wd-card-heder-pd-bordered);
167
+ }"""
168
+
169
+ [template.items.items.items.items.items.attributes]
170
+ name = "td:delete"
171
+ size = "sm"
172
+
173
+ [[template.items.items.items.items.items.listeners]]
174
+ eventName = "tap"
175
+ type = "platform"
176
+ isCapturePhase = false
177
+ noPropagation = false
178
+
179
+ [template.items.items.items.items.items.listeners.handler]
180
+ name = "invoke"
181
+ module = "platform"
182
+
183
+ [template.items.items.items.items.items.listeners.handler.params]
184
+ component = "{{$self.id}}"
185
+ method = "remove"
186
+
187
+ [template.items.items.items.items.items.listeners.handler.params.params]
188
+ ":index" = "$w.index_{{$self.id}}"
189
+ `;
190
+ const $add_button_template = `
191
+ [[template]]
192
+ component = 'Container'
193
+ label= "新增按钮"
194
+ scopedStyle = """
195
+ :scope {
196
+ display: flex;
197
+ align-items: center;
198
+ width: 100%;
199
+ height: 50px;
200
+ color: var(--wd-color-brand);
201
+ margin-top: 5px;
202
+ padding:0 10px;
203
+ }"""
204
+ [[template.listeners]]
205
+ eventName = "tap"
206
+ type = "platform"
207
+ [template.listeners.handler]
208
+ module = "platform"
209
+ name = "invoke"
210
+ [template.listeners.handler.params]
211
+ component = "{{$self.id}}"
212
+ method = "add"
213
+ [[template.items]]
214
+ component = 'WdIcon'
215
+ scopedStyle = ":scope{\n margin-right: 5px;\n}"
216
+ [template.items.attributes]
217
+ name = "td:add-circle"
218
+ [[template.items]]
219
+ component = 'WdText'
220
+ scopedStyle = ":scope{\n color: var(--wd-color-brand);\n}"
221
+ [template.items.attributes]
222
+ text = "新增"
223
+ `;
224
+ // 表格模板
225
+ export const $table_template = `
226
+ [attributes]
227
+ value = [{}]
228
+ ":addDefaultValue"="{}"
229
+ [[template]]
230
+ component = "Container"
231
+ label= "表格模板"
232
+ scopedStyle = """
233
+ .wd-pc-form-obj-root .table-wrap{
234
+ width: 900px;
235
+ overflow: auto;
236
+ border: 1px solid #dcdcdc;
237
+ border-radius: 3px;
238
+ position: relative;
239
+ }
240
+ .wd-pc-form-obj-root .table-wrap .table-container .table .wd-form-item-wrap__label {
241
+ display: none;
242
+ }
243
+ .wd-pc-form-obj-root .table-wrap .table-container:first-child .table .wd-form-item-wrap__label {
244
+ display: flex;
245
+ height: 52px;
246
+ }
247
+ .wd-pc-form-obj-root .table-wrap .table-container .table-option-wrap {
248
+ display: none;
249
+ }
250
+ .wd-pc-form-obj-root .table-wrap .table-container:first-child .table-option-wrap {
251
+ display: flex;
252
+ }
253
+
254
+ .wd-pc-form-obj-root .table-wrap .table-container .table .wd-form-item{
255
+ margin-top: 0 !important;
256
+ }
257
+ .wd-pc-form-obj-root .table-wrap .table-container:first-child .table-field-box{
258
+ border-top: 0 !important;
259
+ }
260
+ .wd-pc-form-obj-root .table-wrap .table-container:first-child .table-option-box{
261
+ border-top: 0 !important;
262
+ }
263
+
264
+ .wd-h5-form-obj-root .table-wrap{
265
+ border: 1px solid #dcdcdc;
266
+ }
267
+ .wd-mp-form-obj-root .table-wrap{
268
+ border: 1px solid #dcdcdc;
269
+ }"""
270
+
271
+ [template.attributes]
272
+ class = "table-wrap"
273
+
274
+ [[template.items]]
275
+ component = "Repeater"
276
+
277
+ [template.items.attributes]
278
+ ":data" = "($w.{{$self.id}}.value || [])"
279
+ suffix = '{{$self.id}}'
280
+ forItem = 'item_{{$self.id}}'
281
+ forIndex = 'index_{{$self.id}}'
282
+
283
+ [[template.items.items]]
284
+ component = "Container"
285
+ scopedStyle = """
286
+ .wd-pc-form-obj-root .table-container{
287
+ display: flex;
288
+ }
289
+ .wd-pc-form-obj-root .table-container .wd-form-obj-item{
290
+ padding: 0;
291
+ }
292
+
293
+ .wd-h5-form-obj-root .table-container {
294
+ position: relative;
295
+ }
296
+ .wd-mp-form-obj-root .table-container {
297
+ position: relative;
298
+ }"""
299
+
300
+ [template.items.items.attributes]
301
+ class = "table-container"
302
+
303
+ ${$index_container_template}
304
+
305
+ [[template.items.items.items]]
306
+ component = "Container"
307
+ label= "表单子项"
308
+ scopedStyle = """
309
+ .wd-pc-form-obj-root .table-field-box{
310
+ flex: 1;
311
+ border-top: 1px solid #dcdcdc;
312
+ }"""
313
+ [template.items.items.items.attributes]
314
+ class = "table-field-box"
315
+
316
+ [[template.items.items.items.items]]
317
+ component = "WdFormObj"
318
+
319
+ [template.items.items.items.items.attributes]
320
+ isRoot = false
321
+ mode = "custom"
322
+ ":label" = "\`\${$w.{{$self.id}}.label}[\${$w.index_{{$self.id}} + 1}]\`"
323
+ ":name" = "$w.index_{{$self.id}}"
324
+ status = "edit"
325
+
326
+
327
+ [[template.items.items.items.items.items]]
328
+ component = "Container"
329
+ scopedStyle = """
330
+ .wd-pc-form-obj-root .table{
331
+ display: flex;
332
+ }
333
+ .wd-pc-form-obj-root .table .wd-form-item-wrap{
334
+ flex-direction: column !important;
335
+ }
336
+ .wd-pc-form-obj-root .table .wd-form-item-wrap .wd-form-item-wrap__label{
337
+ background-color: #f3f3f3;
338
+ margin: 0;
339
+ padding: 10px;
340
+ width: 100%;
341
+ }
342
+ .wd-pc-form-obj-root .table .wd-form-item-wrap .wd-form-item-wrap__control{
343
+ padding: 10px;
344
+ }
345
+ /* .table .wd-form-item-wrap .wd-form-item-wrap__control{
346
+ min-width:320px;
347
+ } */
348
+ .wd-pc-form-obj-root .table .wd-form-item-wrap {
349
+ min-width:300px;
350
+ }
351
+
352
+ .wd-h5-form-obj-root .table{
353
+ padding: 0 10px;
354
+ }
355
+
356
+ .wd-mp-form-obj-root .table{
357
+ padding: 0 10px;
358
+ }"""
359
+
360
+ [template.items.items.items.items.items.attributes]
361
+ class = "table"
362
+ templateContainer=true
363
+
364
+
365
+
366
+ ${$delete_button_template}
367
+
368
+ ${$add_button_template}
369
+ `;
370
+ // 默认卡片模板
371
+ export const $attached_template = `
372
+ [attributes]
373
+ value = [{}]
374
+ ":addDefaultValue"="{}"
375
+ [[template]]
376
+ component = "Repeater"
377
+ [template.attributes]
378
+ ":data" = "($w.{{$self.id}}.value || [])"
379
+ suffix = '{{$self.id}}'
380
+ forItem = 'item_{{$self.id}}'
381
+ forIndex = 'index_{{$self.id}}'
382
+ [[template.items]]
383
+ component = "Container"
384
+ label= "表单子项"
385
+ scopedStyle = ":scope {\n position: relative;\n width: 100%;\n}"
386
+ [[template.items.items]]
387
+ component = 'WdFormObj'
388
+ [template.items.items.attributes]
389
+ ":label" = "\`\${$w.{{$self.id}}.label}[\${$w.index_{{$self.id}} + 1}]\`"
390
+ ":name" = "$w.index_{{$self.id}}"
391
+ isRoot = false
392
+ value = {}
393
+
394
+ templateContainer=true
395
+
396
+ [[template.items.items]]
397
+ component = 'WdIcon'
398
+ label= "删除按钮"
399
+ scopedStyle = ":scope {\n position: absolute;\n right: var(--wd-card-heder-pd-bordered);\n top: var(--wd-card-heder-pd-bordered);\n color: var(--wd-color-brand);\n}\n\n:scope.wd-mp-icon {\n top: var(--wd-card-heder-pd-bordered);\n}"
400
+ [template.items.items.attributes]
401
+ name = "td:delete"
402
+ size = "sm"
403
+ [[template.items.items.listeners]]
404
+ eventName = "tap"
405
+ type = "platform"
406
+ [template.items.items.listeners.handler]
407
+ module = "platform"
408
+ name = "invoke"
409
+ [template.items.items.listeners.handler.params]
410
+ component = "{{$self.id}}"
411
+ method = "remove"
412
+ [template.items.items.listeners.handler.params.params]
413
+ ":index" = "$w.index_{{$self.id}}"
414
+
415
+ ${$add_button_template}
416
+ `;
417
+ // 自定义模板
418
+ export const $custom_template = `
419
+ [attributes]
420
+ value = [{}]
421
+ ":addDefaultValue"="{}"
422
+ [[template]]
423
+ component = "Repeater"
424
+ [template.attributes]
425
+ ":data" = "($w.{{$self.id}}.value || [])"
426
+ suffix = '{{$self.id}}'
427
+ forItem = 'item_{{$self.id}}'
428
+ forIndex = 'index_{{$self.id}}'
429
+ [[template.items]]
430
+ component = "Container"
431
+ label= "表单子项"
432
+ [template.items.attributes.style]
433
+ display = "flex"
434
+ alignItems = "center"
435
+
436
+ [[template.items.items]]
437
+ component = 'WdFormObj'
438
+ [template.items.items.attributes]
439
+ ":label" = "\`\${$w.{{$self.id}}.label}[\${$w.index_{{$self.id}} + 1}]\`"
440
+ ":name" = "$w.index_{{$self.id}}"
441
+ isRoot = false
442
+ value = {}
443
+ mode = "custom"
444
+ templateContainer=true
445
+
446
+ [[template.items.items]]
447
+ component = 'WdIcon'
448
+ label= "删除按钮"
449
+ scopedStyle = ":scope {\n color: var(--wd-color-brand);\n}"
450
+ [template.items.items.attributes]
451
+ name = "td:delete"
452
+ size = "sm"
453
+ [[template.items.items.listeners]]
454
+ eventName = "tap"
455
+ type = "platform"
456
+ [template.items.items.listeners.handler]
457
+ module = "platform"
458
+ name = "invoke"
459
+ [template.items.items.listeners.handler.params]
460
+ component = "{{$self.id}}"
461
+ method = "remove"
462
+ [template.items.items.listeners.handler.params.params]
463
+ ":index" = "$w.index_{{$self.id}}"
464
+
465
+ ${$add_button_template}
466
+ `;
467
+ // 值数组模版
468
+ export const $field_template = `
469
+ [attributes]
470
+ value = ['']
471
+ ":addDefaultValue"="undefined"
472
+ [[template]]
473
+ component = "Repeater"
474
+ [template.attributes]
475
+ ":data" = "($w.{{$self.id}}.value || [])"
476
+ suffix = '{{$self.id}}'
477
+ forItem = 'item_{{$self.id}}'
478
+ forIndex = 'index_{{$self.id}}'
479
+ [[template.items]]
480
+ component = "Container"
481
+ scopedStyle = ":scope {\n display: flex;\n align-items: center;\n width: 100%;\n}"
482
+ [[template.items.items]]
483
+ component = 'WdInput'
484
+ [template.items.items.attributes]
485
+ ":name" = "$w.index_{{$self.id}}"
486
+ labelVisible = false
487
+ value = {}
488
+ [[template.items.items]]
489
+ label= "删除按钮"
490
+ component = 'WdIcon'
491
+ scopedStyle = ":scope {\n color: var(--wd-color-brand);\n margin-left: 10px;\n}"
492
+ [template.items.items.attributes]
493
+ name = "td:delete"
494
+ size = "sm"
495
+ [[template.items.items.listeners]]
496
+ eventName = "tap"
497
+ type = "platform"
498
+ [template.items.items.listeners.handler]
499
+ module = "platform"
500
+ name = "invoke"
501
+ [template.items.items.listeners.handler.params]
502
+ component = "{{$self.id}}"
503
+ method = "remove"
504
+ [template.items.items.listeners.handler.params.params]
505
+ ":index" = "$w.index_{{$self.id}}"
506
+
507
+ ${$add_button_template}
508
+ `;
@@ -353,7 +353,7 @@ page[theme-mode=light],
353
353
  --wd-color-success-focus: var(--wd-color-success-2);
354
354
  --wd-color-success-active: var(--wd-color-success-6);
355
355
  --wd-color-success-disabled: var(--wd-color-success-3);
356
- --wd-bg-mask: rgba(var(--wd-black-rgb), 80%);
356
+ --wd-bg-mask: rgba(var(--wd-black-rgb), 50%);
357
357
  --wd-bg-mask-inverse: rgba(var(--wd-white-rgb), 60%);
358
358
  --wd-color-bg-page: var(--wd-color-gray-1);
359
359
  --wd-color-bg-container: var(--wd-white);
@@ -1497,6 +1497,8 @@ body .wd-h5-root {
1497
1497
  right: 0;
1498
1498
  top: 0;
1499
1499
  bottom: 0;
1500
+ width: 80%;
1501
+ margin: 0 auto;
1500
1502
  }
1501
1503
 
1502
1504
  .wd-image-mask {
@@ -1551,6 +1553,33 @@ body .wd-h5-root {
1551
1553
  height: 100%;
1552
1554
  }
1553
1555
 
1556
+ .wd-image__zoom-in {
1557
+ cursor: zoom-in;
1558
+ }
1559
+
1560
+ .wd-image-preview-toolbar {
1561
+ position: absolute;
1562
+ bottom: 40px;
1563
+ left: 50%;
1564
+ transform: translateX(-50%);
1565
+ z-index: 1002;
1566
+ display: flex;
1567
+ align-items: center;
1568
+ justify-content: space-around;
1569
+ width: 150px;
1570
+ color: #fff;
1571
+ }
1572
+ .wd-image-preview-toolbar .wd-icon-wrap {
1573
+ height: 30px;
1574
+ width: 30px;
1575
+ border-radius: 50%;
1576
+ display: flex;
1577
+ align-items: center;
1578
+ justify-content: center;
1579
+ background: var(--wd-font-gray-2);
1580
+ cursor: pointer;
1581
+ }
1582
+
1554
1583
  .wd-table-wrap {
1555
1584
  --wd-table-font-size: var(--wd-font-size-default);
1556
1585
  --wd-table-shadow: var(--wd-shadow-sm);
@@ -7155,7 +7184,7 @@ page[theme-mode=light],
7155
7184
  --wd-color-success-focus: var(--wd-color-success-2);
7156
7185
  --wd-color-success-active: var(--wd-color-success-6);
7157
7186
  --wd-color-success-disabled: var(--wd-color-success-3);
7158
- --wd-bg-mask: rgba(var(--wd-black-rgb), 80%);
7187
+ --wd-bg-mask: rgba(var(--wd-black-rgb), 50%);
7159
7188
  --wd-bg-mask-inverse: rgba(var(--wd-white-rgb), 60%);
7160
7189
  --wd-color-bg-page: var(--wd-color-gray-1);
7161
7190
  --wd-color-bg-container: var(--wd-white);
@@ -10318,6 +10347,15 @@ page,
10318
10347
  width: fit-content;
10319
10348
  width: 100%;
10320
10349
  }
10350
+ .wd-form-obj-root .wd-form-obj .wd-form-item.size-width-sm {
10351
+ width: 100%;
10352
+ }
10353
+ .wd-form-obj-root .wd-form-obj .wd-form-item.size-width-md {
10354
+ width: 100%;
10355
+ }
10356
+ .wd-form-obj-root .wd-form-obj .wd-form-item.size-width-lg {
10357
+ width: 100%;
10358
+ }
10321
10359
  .wd-form-obj-root.size-width-sm {
10322
10360
  width: 100%;
10323
10361
  }
@@ -10331,7 +10369,7 @@ page,
10331
10369
  width: 100%;
10332
10370
  }
10333
10371
  .wd-form-obj-root .wd-form-item-wrap .wd-form-item-wrap__control {
10334
- overflow: hidden;
10372
+ overflow: unset;
10335
10373
  }
10336
10374
  .wd-form-obj-root .wd-form-item-wrap .wd-card-root {
10337
10375
  width: 100%;