@longhongguo/form-create-ant-design-vue 3.3.29 → 3.3.33

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.
@@ -84,6 +84,17 @@ export default {
84
84
  )
85
85
  })
86
86
 
87
+ // 应用 componentStyle 到包裹组件的最顶层父容器(如 .fc-form-col)
88
+ // 这样在 Flex 或 Space 布局中,可以给子元素设置 flex: 1 等样式
89
+ if (ctx.rule.componentStyle && typeof ctx.rule.componentStyle === 'object') {
90
+ // 将 componentStyle 合并到 prop.style,这会应用到包裹组件的容器上
91
+ const existingStyle = ctx.prop.style || {}
92
+ ctx.prop.style = {
93
+ ...existingStyle,
94
+ ...ctx.rule.componentStyle
95
+ }
96
+ }
97
+
87
98
  // 预览模式下:对 upload 组件设置 disabled
88
99
  // wangEditor 组件使用只读模式(readOnly),允许复制和点击链接
89
100
  // textarea 组件使用只读模式(readOnly),允许复制和自适应高度
@@ -104,6 +104,14 @@ export default {
104
104
  ...existingPropsStyle,
105
105
  ...flexStyles
106
106
  }
107
+
108
+ // componentStyle 应用到 prop.style(包裹容器),最后合并确保优先级最高
109
+ if (ctx.rule.componentStyle && typeof ctx.rule.componentStyle === 'object') {
110
+ ctx.prop.style = {
111
+ ...ctx.prop.style,
112
+ ...ctx.rule.componentStyle
113
+ }
114
+ }
107
115
 
108
116
  // 确保 children 存在
109
117
  if (!ctx.rule.children) {
@@ -1,45 +1,45 @@
1
- import checkbox from './checkbox'
2
- import { hasProperty } from '@form-create/utils/lib/type'
3
-
4
- export default {
5
- ...checkbox,
6
- name: 'select',
7
- mergeProp(ctx) {
8
- const props = ctx.prop.props
9
- if (!hasProperty(props, 'options')) props.options = ctx.prop.options || []
10
-
11
- // 检测 loading 状态:从 effectData('fetch') 中获取 loading 状态
12
- const fetchData = ctx.effectData('fetch')
13
- const isLoading = fetchData && fetchData.loading === true
14
-
15
- // 如果正在加载,设置 disabled 和 loading
16
- if (isLoading) {
17
- props.disabled = true
18
- props.loading = true
19
- }
20
-
21
- // readOnly 属性的处理:如果设置了 readOnly,强制设置 disabled = true
22
- // 从 rule.props 或 ctx.prop.props 中读取 readOnly
23
- const isReadOnly =
24
- ctx.rule.props?.readOnly === true || props.readOnly === true
25
- if (isReadOnly) {
26
- props.disabled = true
27
- }
28
- },
29
- render(children, ctx) {
30
- // 检测 loading 状态(与 mergeProp 中的逻辑保持一致)
31
- const fetchData = ctx.effectData('fetch')
32
- const isLoading = fetchData && fetchData.loading === true
33
-
34
- // 如果有 loading 插槽且正在加载,将 loading 插槽传递给组件的 notFoundContent 插槽
35
- if (isLoading && children.loading) {
36
- // 将 loading 插槽合并到 children 中,作为 notFoundContent
37
- const newChildren = { ...children }
38
- newChildren.notFoundContent = children.loading
39
- return ctx.$render.defaultRender(ctx, newChildren)
40
- }
41
-
42
- // 调用默认渲染
43
- return ctx.$render.defaultRender(ctx, children)
44
- }
45
- }
1
+ import checkbox from './checkbox'
2
+ import { hasProperty } from '@form-create/utils/lib/type'
3
+
4
+ export default {
5
+ ...checkbox,
6
+ name: 'select',
7
+ mergeProp(ctx) {
8
+ const props = ctx.prop.props
9
+ if (!hasProperty(props, 'options')) props.options = ctx.prop.options || []
10
+
11
+ // 检测 loading 状态:从 effectData('fetch') 中获取 loading 状态
12
+ const fetchData = ctx.effectData('fetch')
13
+ const isLoading = fetchData && fetchData.loading === true
14
+
15
+ // 如果正在加载,设置 disabled 和 loading
16
+ if (isLoading) {
17
+ props.disabled = true
18
+ props.loading = true
19
+ }
20
+
21
+ // readOnly 属性的处理:如果设置了 readOnly,强制设置 disabled = true
22
+ // 从 rule.props 或 ctx.prop.props 中读取 readOnly
23
+ const isReadOnly =
24
+ ctx.rule.props?.readOnly === true || props.readOnly === true
25
+ if (isReadOnly) {
26
+ props.disabled = true
27
+ }
28
+ },
29
+ render(children, ctx) {
30
+ // 检测 loading 状态(与 mergeProp 中的逻辑保持一致)
31
+ const fetchData = ctx.effectData('fetch')
32
+ const isLoading = fetchData && fetchData.loading === true
33
+
34
+ // 如果有 loading 插槽且正在加载,将 loading 插槽传递给组件的 notFoundContent 插槽
35
+ if (isLoading && children.loading) {
36
+ // 将 loading 插槽合并到 children 中,作为 notFoundContent
37
+ const newChildren = { ...children }
38
+ newChildren.notFoundContent = children.loading
39
+ return ctx.$render.defaultRender(ctx, newChildren)
40
+ }
41
+
42
+ // 调用默认渲染
43
+ return ctx.$render.defaultRender(ctx, children)
44
+ }
45
+ }
@@ -38,6 +38,14 @@ export default {
38
38
  ctx.prop.props.style = {}
39
39
  }
40
40
  ctx.prop.props.style = { ...ctx.prop.props.style, ...spaceStyles }
41
+
42
+ // componentStyle 应用到 prop.style(包裹容器),最后合并确保优先级最高
43
+ if (ctx.rule.componentStyle && typeof ctx.rule.componentStyle === 'object') {
44
+ ctx.prop.style = {
45
+ ...ctx.prop.style,
46
+ ...ctx.rule.componentStyle
47
+ }
48
+ }
41
49
 
42
50
  // 确保 children 存在
43
51
  if (!ctx.rule.children) {
@@ -165,16 +165,96 @@ textarea[readonly].ant-input {
165
165
  pointer-events: none !important;
166
166
  }
167
167
 
168
- /* 预览模式:允许 textarea 交互(用于复制文本) */
169
- .form-create.is-preview textarea.ant-input {
170
- pointer-events: auto !important;
168
+ /* 预览模式:允许所有文本选择和复制 */
169
+ .form-create.is-preview * {
171
170
  user-select: text !important;
172
171
  -webkit-user-select: text !important;
173
172
  -moz-user-select: text !important;
174
173
  -ms-user-select: text !important;
174
+ }
175
+
176
+ /* 预览模式:允许滚动容器滚动 */
177
+ .form-create.is-preview [style*="overflow"],
178
+ .form-create.is-preview .ant-table-body,
179
+ .form-create.is-preview .ant-table-tbody,
180
+ .form-create.is-preview .w-e-text-container,
181
+ .form-create.is-preview .w-e-text,
182
+ .form-create.is-preview [class*="scroll"],
183
+ .form-create.is-preview [class*="overflow"] {
184
+ pointer-events: auto !important;
185
+ overflow: auto !important;
186
+ overflow-x: auto !important;
187
+ overflow-y: auto !important;
188
+ }
189
+
190
+ /* 预览模式:允许 textarea 交互(用于复制文本) */
191
+ .form-create.is-preview textarea.ant-input {
192
+ pointer-events: auto !important;
193
+ cursor: text !important;
194
+ }
195
+
196
+ /* 预览模式:允许 input 文本选择和复制 */
197
+ .form-create.is-preview .ant-input,
198
+ .form-create.is-preview input.ant-input {
199
+ pointer-events: auto !important;
200
+ cursor: text !important;
201
+ }
202
+
203
+ /* 预览模式:允许 select 组件文本选择和复制 */
204
+ .form-create.is-preview .ant-select-selector,
205
+ .form-create.is-preview .ant-select-selection,
206
+ .form-create.is-preview .ant-select-selection-item,
207
+ .form-create.is-preview .ant-select-selection-placeholder,
208
+ .form-create.is-preview .ant-select-selection-item-content,
209
+ .form-create.is-preview .ant-select-selection-overflow,
210
+ .form-create.is-preview .ant-select-selection-overflow-item {
211
+ pointer-events: auto !important;
212
+ cursor: text !important;
213
+ }
214
+
215
+ /* 预览模式:允许自定义 select 组件文本选择和复制 */
216
+ .form-create.is-preview .fc-cus-select-selector,
217
+ .form-create.is-preview .fc-cus-select-selection-item,
218
+ .form-create.is-preview .fc-cus-select-selection-placeholder,
219
+ .form-create.is-preview .fc-cus-select-selection-item-content {
220
+ pointer-events: auto !important;
175
221
  cursor: text !important;
176
222
  }
177
223
 
224
+ /* 预览模式:允许 tableForm 组件文本选择和复制 */
225
+ .form-create.is-preview ._fc-table-form,
226
+ .form-create.is-preview ._fc-table-form * {
227
+ pointer-events: auto !important;
228
+ }
229
+
230
+ /* 预览模式:tableForm 中的选择列 checkbox 和操作列按钮保持不可交互 */
231
+ .form-create.is-preview ._fc-table-form ._fc-tf-select,
232
+ .form-create.is-preview ._fc-table-form ._fc-tf-select *,
233
+ .form-create.is-preview ._fc-table-form ._fc-tf-btn,
234
+ .form-create.is-preview ._fc-table-form ._fc-tf-btn *,
235
+ .form-create.is-preview ._fc-table-form ._fc-tf-head-select,
236
+ .form-create.is-preview ._fc-table-form ._fc-tf-head-select * {
237
+ pointer-events: none !important;
238
+ user-select: none !important;
239
+ -webkit-user-select: none !important;
240
+ -moz-user-select: none !important;
241
+ -ms-user-select: none !important;
242
+ cursor: default !important;
243
+ }
244
+
245
+ /* 预览模式:允许按钮点击 */
246
+ .form-create.is-preview .ant-btn {
247
+ pointer-events: auto !important;
248
+ cursor: pointer !important;
249
+ }
250
+
251
+ /* 预览模式:允许滚动条滚动(针对有滚动条的容器) */
252
+ .form-create.is-preview .ant-table-body,
253
+ .form-create.is-preview .ant-table-tbody,
254
+ .form-create.is-preview [style*="overflow"] {
255
+ pointer-events: auto !important;
256
+ }
257
+
178
258
  /* 预览模式:允许富文本编辑器容器滚动 */
179
259
  .form-create.is-preview .w-e-text-container {
180
260
  pointer-events: auto !important;
@@ -271,23 +351,46 @@ textarea[readonly].ant-input {
271
351
  .form-create.is-preview .ant-switch,
272
352
  .form-create.is-preview .ant-slider,
273
353
  .form-create.is-preview .ant-rate,
274
- .form-create.is-preview .ant-upload,
275
- .form-create.is-preview .ant-btn {
354
+ .form-create.is-preview .ant-upload {
276
355
  opacity: 1 !important;
277
356
  color: inherit !important;
278
357
  background-color: transparent !important;
279
358
  }
280
359
 
360
+ /* 预览模式:按钮保持原有颜色,不覆盖 */
361
+ .form-create.is-preview .ant-btn {
362
+ opacity: 1 !important;
363
+ /* 不设置 color,保持按钮的原始颜色 */
364
+ /* 不设置 background-color,保持按钮的原始背景色 */
365
+ }
366
+
367
+ /* 预览模式和只读模式:设置按钮链接的颜色 */
368
+ .form-create.is-preview .ant-btn-link,
369
+ .ant-btn-link[readonly],
370
+ .ant-btn-link[readonly="true"] {
371
+ color: #1677ff !important;
372
+ }
373
+
281
374
  /* 预览模式:CusSelect 组件保持正常外观,不置灰 */
282
375
  .form-create.is-preview .fc-cus-select,
283
376
  .form-create.is-preview .fc-cus-select-selector,
284
- .form-create.is-preview .fc-cus-select-selection-item,
285
- .form-create.is-preview .fc-cus-select-selection-placeholder {
377
+ .form-create.is-preview .fc-cus-select-selection-item {
286
378
  opacity: 1 !important;
287
379
  color: inherit !important;
288
380
  background-color: transparent !important;
289
381
  }
290
382
 
383
+ /* 预览模式:隐藏 CusSelect 的占位符 */
384
+ .form-create.is-preview .fc-cus-select-selection-placeholder {
385
+ display: none !important;
386
+ }
387
+
388
+ /* 只读模式:隐藏 CusSelect 的占位符 */
389
+ .fc-cus-select[readonly] .fc-cus-select-selection-placeholder,
390
+ .fc-cus-select[readonly="true"] .fc-cus-select-selection-placeholder {
391
+ display: none !important;
392
+ }
393
+
291
394
  /* 预览模式:移除 CusSelect 选择器的边框 */
292
395
  .form-create.is-preview .fc-cus-select-selector {
293
396
  border: none !important;
@@ -377,14 +480,62 @@ textarea[readonly].ant-input {
377
480
 
378
481
  /* 预览模式:防止选择器显示为禁用状态 */
379
482
  .form-create.is-preview .ant-select-disabled .ant-select-selector,
380
- /* 只读模式:防止选择器显示为禁用状态 */
483
+ /* 只读模式:防止选择器显示为禁用状态,并允许文本选择 */
381
484
  .ant-select-disabled .ant-select-selector {
382
485
  opacity: 1 !important;
383
486
  color: inherit !important;
384
487
  background-color: transparent !important;
385
- cursor: default !important;
488
+ cursor: text !important;
386
489
  border: none !important;
387
490
  box-shadow: none !important;
491
+ user-select: text !important;
492
+ -webkit-user-select: text !important;
493
+ -moz-user-select: text !important;
494
+ -ms-user-select: text !important;
495
+ }
496
+
497
+ /* 只读模式:允许所有文本选择和复制 */
498
+ .ant-input[readonly],
499
+ .ant-input[readonly] *,
500
+ .ant-textarea[readonly],
501
+ .ant-textarea[readonly] *,
502
+ .ant-select-disabled .ant-select-selector *,
503
+ .ant-select-disabled .ant-select-selection-item,
504
+ .ant-select-disabled .ant-select-selection-item-content {
505
+ user-select: text !important;
506
+ -webkit-user-select: text !important;
507
+ -moz-user-select: text !important;
508
+ -ms-user-select: text !important;
509
+ }
510
+
511
+ /* 只读模式:允许 disabled select 的多选选项选择和复制(需要 pointer-events) */
512
+ .ant-select-disabled .ant-select-selector,
513
+ .ant-select-disabled .ant-select-selection,
514
+ .ant-select-disabled .ant-select-selection-item,
515
+ .ant-select-disabled .ant-select-selection-item-content,
516
+ .ant-select-disabled .ant-select-selection-overflow,
517
+ .ant-select-disabled .ant-select-selection-overflow-item {
518
+ pointer-events: auto !important;
519
+ cursor: text !important;
520
+ }
521
+
522
+ /* 只读模式:防止 disabled select 的多选选项显示为灰色 */
523
+ .ant-select-disabled.ant-select-multiple .ant-select-selection-item {
524
+ opacity: 1 !important;
525
+ color: inherit !important;
526
+ background-color: #f0f0f0 !important;
527
+ border-color: #d9d9d9 !important;
528
+ cursor: text !important;
529
+ }
530
+
531
+ /* 预览模式:防止 disabled select 的多选选项显示为灰色,并允许文本选择 */
532
+ .form-create.is-preview .ant-select-disabled.ant-select-multiple .ant-select-selection-item {
533
+ opacity: 1 !important;
534
+ color: inherit !important;
535
+ background-color: #f0f0f0 !important;
536
+ border-color: #d9d9d9 !important;
537
+ cursor: text !important;
538
+ pointer-events: auto !important;
388
539
  }
389
540
 
390
541
  /* 预览模式:防止日期选择器显示为禁用状态 */
@@ -503,110 +654,6 @@ textarea[readonly].ant-input {
503
654
  cursor: pointer !important;
504
655
  }
505
656
 
506
- /* 预览模式:允许 tableForm 组件选择和复制文本 */
507
- .form-create.is-preview ._fc-table-form {
508
- pointer-events: auto !important;
509
- }
510
-
511
- .form-create.is-preview ._fc-table-form table,
512
- .form-create.is-preview ._fc-table-form ._fc-tf-table {
513
- pointer-events: auto !important;
514
- }
515
-
516
- .form-create.is-preview ._fc-table-form table *,
517
- .form-create.is-preview ._fc-table-form ._fc-tf-table * {
518
- pointer-events: auto !important;
519
- user-select: text !important;
520
- -webkit-user-select: text !important;
521
- -moz-user-select: text !important;
522
- -ms-user-select: text !important;
523
- }
524
-
525
- /* 预览模式:tableForm 中的选择列 checkbox 和操作列按钮保持不可交互 */
526
- .form-create.is-preview ._fc-table-form ._fc-tf-select,
527
- .form-create.is-preview ._fc-table-form ._fc-tf-select *,
528
- .form-create.is-preview ._fc-table-form ._fc-tf-btn,
529
- .form-create.is-preview ._fc-table-form ._fc-tf-btn * {
530
- pointer-events: none !important;
531
- user-select: none !important;
532
- -webkit-user-select: none !important;
533
- -moz-user-select: none !important;
534
- -ms-user-select: none !important;
535
- cursor: default !important;
536
- }
537
-
538
- /* 预览模式:允许 select 组件选择和复制文本 */
539
- /* 整个容器禁用 pointer-events,但文本内容区域启用以支持选择 */
540
- .form-create.is-preview .ant-select {
541
- pointer-events: none !important;
542
- }
543
-
544
- .form-create.is-preview .ant-select-selector {
545
- pointer-events: auto !important;
546
- user-select: text !important;
547
- -webkit-user-select: text !important;
548
- -moz-user-select: text !important;
549
- -ms-user-select: text !important;
550
- cursor: text !important;
551
- }
552
-
553
- .form-create.is-preview .ant-select-selection,
554
- .form-create.is-preview .ant-select-selection-item,
555
- .form-create.is-preview .ant-select-selection-placeholder {
556
- pointer-events: auto !important;
557
- user-select: text !important;
558
- -webkit-user-select: text !important;
559
- -moz-user-select: text !important;
560
- -ms-user-select: text !important;
561
- }
562
-
563
- /* 禁用 select 的下拉箭头和清除按钮 */
564
- .form-create.is-preview .ant-select .ant-select-arrow,
565
- .form-create.is-preview .ant-select .ant-select-suffix,
566
- .form-create.is-preview .ant-select .ant-select-clear {
567
- pointer-events: none !important;
568
- user-select: none !important;
569
- -webkit-user-select: none !important;
570
- -moz-user-select: none !important;
571
- -ms-user-select: none !important;
572
- }
573
-
574
- /* 预览模式:允许自定义 select 组件(fc-cus-select)选择和复制文本 */
575
- /* CusStoreSelect 和 CusUserSelect 都使用 CusSelect */
576
- .form-create.is-preview .fc-cus-select {
577
- pointer-events: none !important;
578
- }
579
-
580
- .form-create.is-preview .fc-cus-select-selector {
581
- pointer-events: auto !important;
582
- user-select: text !important;
583
- -webkit-user-select: text !important;
584
- -moz-user-select: text !important;
585
- -ms-user-select: text !important;
586
- cursor: text !important;
587
- }
588
-
589
- .form-create.is-preview .fc-cus-select-selection-item,
590
- .form-create.is-preview .fc-cus-select-selection-placeholder,
591
- .form-create.is-preview .fc-cus-select-selection-item-content {
592
- pointer-events: auto !important;
593
- user-select: text !important;
594
- -webkit-user-select: text !important;
595
- -moz-user-select: text !important;
596
- -ms-user-select: text !important;
597
- }
598
-
599
- /* 禁用自定义 select 的下拉箭头、清除按钮和移除按钮 */
600
- .form-create.is-preview .fc-cus-select .fc-cus-select-arrow,
601
- .form-create.is-preview .fc-cus-select .fc-cus-select-clear,
602
- .form-create.is-preview .fc-cus-select-selection-item-remove {
603
- pointer-events: none !important;
604
- user-select: none !important;
605
- -webkit-user-select: none !important;
606
- -moz-user-select: none !important;
607
- -ms-user-select: none !important;
608
- }
609
-
610
657
  /* 禁止编辑:通过 contenteditable 属性控制 */
611
658
  .form-create.is-preview .w-e-text {
612
659
  user-select: text !important;
@@ -615,11 +662,6 @@ textarea[readonly].ant-input {
615
662
  -ms-user-select: text !important;
616
663
  }
617
664
 
618
- /* 预览模式:允许按钮点击 */
619
- .form-create.is-preview .ant-btn {
620
- pointer-events: auto !important;
621
- cursor: pointer !important;
622
- }
623
665
 
624
666
  /* 预览模式:禁用选择器下拉 */
625
667
  .form-create.is-preview .ant-select-dropdown,