doway-coms 2.10.55 → 2.10.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doway-coms",
3
- "version": "2.10.55",
3
+ "version": "2.10.57",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -1,11 +1,16 @@
1
1
  <template>
2
- <div class="d-form-items">
3
- <!-- <div @click="hiddenDetail = !hiddenDetail">展开</div> -->
2
+ <div :style="computedformStyle" class="form-container">
3
+ <a-button
4
+ class="collapse-btn"
5
+ type="link"
6
+ @click="hiddenDetail = !hiddenDetail"
7
+ >
8
+ <a-icon :type="hiddenDetail ? 'down' : 'up'" class="collapse-icon" />
9
+ <!-- {{ hiddenDetail ? '展开' : '收起' }} -->
10
+ </a-button>
4
11
  <div
5
- class="d-form-item"
6
- :style="{'width': col.colSpan ? 'calc('+col.colSpan*280+'px + '+(col.colSpan-1)*16+'px)': null,
7
- 'flex': (col.colSpan ? col.colSpan+' 1 auto' : null)}"
8
- v-for="col in internalComputedHiddenCols"
12
+ :style="getFieldStyle(col)"
13
+ v-for="(col,colIndex) in internalComputedHiddenCols"
9
14
  :key="col.field"
10
15
  v-show="hiddenDetail ? colIndex === 0 : true"
11
16
  >
@@ -320,14 +325,17 @@
320
325
  "
321
326
  />
322
327
  </div>
323
- <div class="d-form-item-ghost"></div>
324
- <div class="d-form-item-ghost"></div>
325
- <div class="d-form-item-ghost"></div>
326
- <div class="d-form-item-ghost"></div>
328
+ <template v-if="layoutType==='default'">
329
+ <div class="d-form-item-ghost"></div>
330
+ <div class="d-form-item-ghost"></div>
331
+ <div class="d-form-item-ghost"></div>
332
+ <div class="d-form-item-ghost"></div>
333
+ </template>
327
334
  </div>
328
335
  </template>
329
336
 
330
337
  <script>
338
+ import XEUtils from 'xe-utils'
331
339
  import { sysFormState, sysRowState } from '../../utils/enum'
332
340
  import BaseInput from '../../BaseInput/index'
333
341
  import BaseCheckbox from '../../BaseCheckbox/index'
@@ -366,6 +374,13 @@ export default {
366
374
  },
367
375
  name: 'BaseForm',
368
376
  props: {
377
+ layoutType: {
378
+ // 布局方式。默认布局是flex自动换行布局,grid网格固定布局
379
+ type: String,
380
+ default: function () {
381
+ return 'default'
382
+ },
383
+ },
369
384
  updateDatas: {
370
385
  // 更新的数据
371
386
  type: Object,
@@ -422,6 +437,30 @@ export default {
422
437
  },
423
438
  },
424
439
  computed: {
440
+ computedformStyle(){
441
+ let layoutFormStyle = {
442
+ display: 'flex',
443
+ flexFlow: 'row wrap',
444
+ justifyContent: 'flex-start',
445
+ padding: '5px 5px 0px 5px',
446
+ overflowY: 'auto'
447
+ }
448
+
449
+ if(this.layoutType==='grid'){
450
+ // 计算最大的行和列
451
+ let maxRow = XEUtils.max(this.columns,p=>p.row)
452
+ let maxCol = XEUtils.max(this.columns,p=>p.col)
453
+ layoutFormStyle = {
454
+ display: 'grid',
455
+ gridTemplateRows: `repeat(${maxRow}, auto)`,
456
+ gridTemplateColumns: `repeat(${maxCol}, 1fr)`,
457
+ gap: '10px'
458
+ }
459
+ }
460
+ //默认布局
461
+ return layoutFormStyle
462
+
463
+ },
425
464
  internalComputedHiddenCols: function () {
426
465
  let vm = this
427
466
  return this.columns.filter((item) => {
@@ -551,6 +590,29 @@ export default {
551
590
  },
552
591
  activated() {},
553
592
  methods: {
593
+ getFieldStyle(colInfo){
594
+ let fieldStyle ={
595
+ width: colInfo.colSpan ? ('calc('+colInfo.colSpan*250+'px + '+(colInfo.colSpan-1)*16+'px)'): '250px',
596
+ flex: (colInfo.colSpan ? colInfo.colSpan+' 1 auto' : null),
597
+ flexGrow: '1',
598
+ flexShrink: '1',
599
+ flexBasis: 'auto',
600
+ marginTop: '0px',
601
+ marginRight: '8px',
602
+ marginBottom: '0px',
603
+ marginLeft: '8px',
604
+ padding: '2px 8px 2px 8px',
605
+ minWidth: '150px',
606
+ borderRadius: '6px'
607
+ }
608
+ if(this.layoutType==='grid'){
609
+ fieldStyle = {
610
+ gridRow: colInfo.row,
611
+ gridColumn: colInfo.col
612
+ }
613
+ }
614
+ return fieldStyle
615
+ },
554
616
  preSearch(searchInfo, repeatRowInfo) {
555
617
  this.$emit('preSearch', searchInfo, repeatRowInfo)
556
618
  },
@@ -695,6 +757,23 @@ export default {
695
757
  </script>
696
758
 
697
759
  <style lang="less" scoped>
760
+ .form-container{
761
+ position: relative
762
+ }
763
+ .d-form-item-ghost{
764
+ visibility: hidden;
765
+ height: 0;
766
+ min-height: 0px !important;
767
+ flex-grow: 1;
768
+ flex-shrink: 1;
769
+ flex-basis: auto;
770
+ border: 1px solid #9ad4dc;
771
+ min-width: 150px;
772
+ width: 280px;
773
+ margin-right: 8px;
774
+ margin-left: 8px;
775
+ border-radius: 6px;
776
+ }
698
777
  .form-head {
699
778
  display: flex;
700
779
  flex-flow: row wrap;
@@ -751,6 +830,25 @@ export default {
751
830
  .form {
752
831
  margin-left: 30px;
753
832
  }
833
+
834
+ .collapse-btn {
835
+ position: absolute;
836
+ top: 0px;
837
+ right: 0px;
838
+ padding: 4px 8px;
839
+ z-index: 1000;
840
+ background-color: #fff; // 添加背景色使按钮更突出
841
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); // 添加阴影效果
842
+ border-radius: 4px;
843
+ .collapse-icon {
844
+ transition: transform 0.3s;
845
+ }
846
+ &:hover {
847
+ background-color: #f0f0f0;
848
+ }
849
+ }
850
+
851
+
754
852
  </style>
755
853
  <style lang="less">
756
854
  @import '../../styles/default.less';
@@ -76,6 +76,7 @@
76
76
  :row-class-name="rowClassName"
77
77
  :row-style="rowStyle"
78
78
  :cell-style="cellStyle"
79
+ :header-cell-style="headerCellStyleFunc"
79
80
  :size="'mini'"
80
81
  :data="rows"
81
82
  :columns="internalColumns"
@@ -1076,6 +1077,15 @@ export default {
1076
1077
  cellStyle: {
1077
1078
  type: Function,
1078
1079
  },
1080
+ headerCellStyle: {
1081
+ type: Object,
1082
+ },
1083
+ cellStyle: {
1084
+ type: Object,
1085
+ },
1086
+ rowStyle: {
1087
+ type: Object,
1088
+ },
1079
1089
  height: {
1080
1090
  default: null,
1081
1091
  },
@@ -1918,6 +1928,9 @@ export default {
1918
1928
  if(originCol.editExp){
1919
1929
  colParams['editExp'] = originCol.editExp
1920
1930
  }
1931
+ if(originCol.cellStyle){
1932
+ colParams['cellStyle'] =originCol.cellStyle
1933
+ }
1921
1934
 
1922
1935
  if (originCol.footerSum === true) {
1923
1936
  this.showFooter = true
@@ -3109,6 +3122,33 @@ export default {
3109
3122
  return 'row--pending'
3110
3123
  }
3111
3124
  },
3125
+ headerCellStyleFunc(scope){
3126
+ let customStyle = {}
3127
+ if(this.headerCellStyle){
3128
+ customStyle = this.headerCellStyle
3129
+ }
3130
+ this.$emit('headerCellStyleCallback',scope,customStyle)
3131
+ return customStyle
3132
+ },
3133
+ rowStyleFunc(scope){
3134
+ let customStyle = {}
3135
+ if(this.rowStyle){
3136
+ customStyle = this.rowStyle
3137
+ }
3138
+ this.$emit('rowStyleCallback',scope,customStyle)
3139
+ return customStyle
3140
+ },
3141
+ cellStyleFunc(scope){
3142
+ let customStyle = {}
3143
+ if(this.cellStyle){
3144
+ customStyle = this.cellStyle
3145
+ }
3146
+ if(scope.column?.params.cellStyle){
3147
+ customStyle =scope.column.params.cellStyle
3148
+ }
3149
+ this.$emit('cellStyleCallback',scope,customStyle)
3150
+ return customStyle
3151
+ },
3112
3152
  bodyScroll(scrollInfo) {
3113
3153
  this.$emit('scroll', scrollInfo)
3114
3154
  // if (scrollInfo.isX === true) {