doway-coms 2.10.55 → 2.10.56

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.56",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -1,10 +1,8 @@
1
1
  <template>
2
- <div class="d-form-items">
2
+ <div :style="computedformStyle">
3
3
  <!-- <div @click="hiddenDetail = !hiddenDetail">展开</div> -->
4
4
  <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)}"
5
+ :style="getFieldStyle(col)"
8
6
  v-for="col in internalComputedHiddenCols"
9
7
  :key="col.field"
10
8
  v-show="hiddenDetail ? colIndex === 0 : true"
@@ -320,14 +318,17 @@
320
318
  "
321
319
  />
322
320
  </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>
321
+ <template v-if="layoutType==='default'">
322
+ <div class="d-form-item-ghost"></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
+ </template>
327
327
  </div>
328
328
  </template>
329
329
 
330
330
  <script>
331
+ import XEUtils from 'xe-utils'
331
332
  import { sysFormState, sysRowState } from '../../utils/enum'
332
333
  import BaseInput from '../../BaseInput/index'
333
334
  import BaseCheckbox from '../../BaseCheckbox/index'
@@ -366,6 +367,13 @@ export default {
366
367
  },
367
368
  name: 'BaseForm',
368
369
  props: {
370
+ layoutType: {
371
+ // 布局方式。默认布局是flex自动换行布局,grid网格固定布局
372
+ type: String,
373
+ default: function () {
374
+ return 'default'
375
+ },
376
+ },
369
377
  updateDatas: {
370
378
  // 更新的数据
371
379
  type: Object,
@@ -422,6 +430,30 @@ export default {
422
430
  },
423
431
  },
424
432
  computed: {
433
+ computedformStyle(){
434
+ let layoutFormStyle = {
435
+ display: 'flex',
436
+ flexFlow: 'row wrap',
437
+ justifyContent: 'flex-start',
438
+ padding: '8px 8px 8px 8px',
439
+ overflowY: 'auto'
440
+ }
441
+
442
+ if(this.layoutType==='grid'){
443
+ // 计算最大的行和列
444
+ let maxRow = XEUtils.max(this.columns,p=>p.row)
445
+ let maxCol = XEUtils.max(this.columns,p=>p.col)
446
+ layoutFormStyle = {
447
+ display: 'grid',
448
+ gridTemplateRows: `repeat(${maxRow}, auto)`,
449
+ gridTemplateColumns: `repeat(${maxCol}, 1fr)`,
450
+ gap: '10px'
451
+ }
452
+ }
453
+ //默认布局
454
+ return layoutFormStyle
455
+
456
+ },
425
457
  internalComputedHiddenCols: function () {
426
458
  let vm = this
427
459
  return this.columns.filter((item) => {
@@ -551,6 +583,29 @@ export default {
551
583
  },
552
584
  activated() {},
553
585
  methods: {
586
+ getFieldStyle(colInfo){
587
+ let fieldStyle ={
588
+ width: colInfo.colSpan ? ('calc('+colInfo.colSpan*280+'px + '+(colInfo.colSpan-1)*16+'px)'): '280px',
589
+ flex: (colInfo.colSpan ? colInfo.colSpan+' 1 auto' : null),
590
+ flexGrow: '1',
591
+ flexShrink: '1',
592
+ flexBasis: 'auto',
593
+ marginTop: '0px',
594
+ marginRight: '8px',
595
+ marginBottom: '0px',
596
+ marginLeft: '8px',
597
+ padding: '6px 8px 6px 8px',
598
+ minWidth: '150px',
599
+ borderRadius: '6px'
600
+ }
601
+ if(this.layoutType==='grid'){
602
+ fieldStyle = {
603
+ gridRow: colInfo.row,
604
+ gridColumn: colInfo.col
605
+ }
606
+ }
607
+ return fieldStyle
608
+ },
554
609
  preSearch(searchInfo, repeatRowInfo) {
555
610
  this.$emit('preSearch', searchInfo, repeatRowInfo)
556
611
  },
@@ -695,6 +750,20 @@ export default {
695
750
  </script>
696
751
 
697
752
  <style lang="less" scoped>
753
+ .d-form-item-ghost{
754
+ visibility: hidden;
755
+ height: 0;
756
+ min-height: 0px !important;
757
+ flex-grow: 1;
758
+ flex-shrink: 1;
759
+ flex-basis: auto;
760
+ border: 1px solid #9ad4dc;
761
+ min-width: 150px;
762
+ width: 280px;
763
+ margin-right: 8px;
764
+ margin-left: 8px;
765
+ border-radius: 6px;
766
+ }
698
767
  .form-head {
699
768
  display: flex;
700
769
  flex-flow: row wrap;
@@ -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) {