vxe-table 3.6.14-beta.2 → 3.6.14-beta.3

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": "vxe-table",
3
- "version": "3.6.14-beta.2",
3
+ "version": "3.6.14-beta.3",
4
4
  "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器等...",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -28,12 +28,14 @@ const VxeFormConfigItem = {
28
28
  render (h) {
29
29
  const { _e, $xeform, itemConfig: item } = this
30
30
  const { rules, data, collapseAll, validOpts, titleAlign: allTitleAlign, titleWidth: allTitleWidth, titleColon: allTitleColon, titleAsterisk: allTitleAsterisk, titleOverflow: allTitleOverflow } = $xeform
31
- const { slots, title, folding, visible, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, children } = item
31
+ const { slots, title, folding, visible, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, children, showTitle, contentClassName, contentStyle, titleClassName, titleStyle } = item
32
32
  const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
33
33
  const itemClassName = compConf ? compConf.itemClassName : ''
34
34
  const itemStyle = compConf ? compConf.itemStyle : null
35
35
  const itemContentClassName = compConf ? compConf.itemContentClassName : ''
36
36
  const itemContentStyle = compConf ? compConf.itemContentStyle : null
37
+ const itemTitleClassName = compConf ? compConf.itemTitleClassName : ''
38
+ const itemTitleStyle = compConf ? compConf.itemTitleStyle : null
37
39
  const span = item.span || $xeform.span
38
40
  const align = item.align || $xeform.align
39
41
  const titleAlign = XEUtils.eqNull(item.titleAlign) ? allTitleAlign : item.titleAlign
@@ -41,10 +43,10 @@ const VxeFormConfigItem = {
41
43
  const titleColon = XEUtils.eqNull(item.titleColon) ? allTitleColon : item.titleColon
42
44
  const titleAsterisk = XEUtils.eqNull(item.titleAsterisk) ? allTitleAsterisk : item.titleAsterisk
43
45
  const itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow
44
- const showEllipsis = itemOverflow === 'ellipsis'
45
- const showTitle = itemOverflow === 'title'
46
- const showTooltip = itemOverflow === true || itemOverflow === 'tooltip'
47
- const hasEllipsis = showTitle || showTooltip || showEllipsis
46
+ const ovEllipsis = itemOverflow === 'ellipsis'
47
+ const ovTitle = itemOverflow === 'title'
48
+ const ovTooltip = itemOverflow === true || itemOverflow === 'tooltip'
49
+ const hasEllipsis = ovTitle || ovTooltip || ovEllipsis
48
50
  const params = { data, field, property: field, item, $form: $xeform, $grid: $xeform.xegrid }
49
51
  let isRequired
50
52
  if (visible === false) {
@@ -81,7 +83,7 @@ const VxeFormConfigItem = {
81
83
  } else if (field) {
82
84
  contentVNs = [XEUtils.toValueString(XEUtils.get(data, field))]
83
85
  }
84
- const ons = showTooltip ? {
86
+ const ons = ovTooltip ? {
85
87
  mouseenter (evnt) {
86
88
  $xeform.triggerTitleTipEvent(evnt, params)
87
89
  },
@@ -109,21 +111,36 @@ const VxeFormConfigItem = {
109
111
  h('div', {
110
112
  class: 'vxe-form--item-inner'
111
113
  }, [
112
- title || (slots && slots.title) ? h('div', {
113
- class: ['vxe-form--item-title', titleAlign ? `align--${titleAlign}` : null, {
114
- 'is--ellipsis': hasEllipsis
115
- }],
116
- style: titleWidth ? {
117
- width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
118
- } : null,
114
+ (showTitle !== false) && (title || (slots && slots.title)) ? h('div', {
115
+ class: [
116
+ 'vxe-form--item-title',
117
+ titleAlign ? `align--${titleAlign}` : '',
118
+ hasEllipsis ? 'is--ellipsis' : '',
119
+ itemTitleClassName ? (XEUtils.isFunction(itemTitleClassName) ? itemTitleClassName(params) : itemTitleClassName) : '',
120
+ titleClassName ? (XEUtils.isFunction(titleClassName) ? titleClassName(params) : titleClassName) : ''
121
+ ],
122
+
123
+ style: Object.assign(
124
+ {},
125
+ XEUtils.isFunction(itemTitleStyle) ? itemTitleStyle(params) : itemTitleStyle,
126
+ XEUtils.isFunction(titleStyle) ? titleStyle(params) : titleStyle,
127
+ titleWidth ? {
128
+ width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
129
+ } : null
130
+ ),
119
131
  attrs: {
120
- title: showTitle ? getFuncText(title) : null
132
+ title: ovTitle ? getFuncText(title) : null
121
133
  },
122
134
  on: ons
123
135
  }, renderTitle(h, $xeform, item)) : null,
124
136
  h('div', {
125
- class: ['vxe-form--item-content', align ? `align--${align}` : '', itemContentClassName ? (XEUtils.isFunction(itemContentClassName) ? itemContentClassName(params) : itemContentClassName) : ''],
126
- style: XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle
137
+ class: [
138
+ 'vxe-form--item-content',
139
+ align ? `align--${align}` : '',
140
+ itemContentClassName ? (XEUtils.isFunction(itemContentClassName) ? itemContentClassName(params) : itemContentClassName) : '',
141
+ contentClassName ? (XEUtils.isFunction(contentClassName) ? contentClassName(params) : contentClassName) : ''
142
+ ],
143
+ style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
127
144
  }, contentVNs.concat(
128
145
  [
129
146
  collapseNode ? h('div', {
@@ -28,7 +28,15 @@ const props = {
28
28
  type: Boolean,
29
29
  default: null
30
30
  },
31
+ showTitle: {
32
+ type: Boolean,
33
+ default: true
34
+ },
31
35
  className: [String, Function],
36
+ contentClassName: [String, Function],
37
+ contentStyle: [Object, Function],
38
+ titleClassName: [String, Function],
39
+ titleStyle: [Object, Function],
32
40
  titleOverflow: {
33
41
  type: [Boolean, String],
34
42
  default: null
@@ -52,12 +60,14 @@ Object.keys(props).forEach(name => {
52
60
 
53
61
  const renderItem = (h, _vm, item, slots) => {
54
62
  const { _e, rules, data, collapseAll, validOpts, titleAlign: allTitleAlign, titleWidth: allTitleWidth, titleColon: allTitleColon, titleAsterisk: allTitleAsterisk, titleOverflow: allTitleOverflow } = _vm
55
- const { title, folding, visible, field, collapseNode, itemRender, showError, errRule, className, titleOverflow } = item
63
+ const { title, folding, visible, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, showTitle, contentClassName, contentStyle, titleClassName, titleStyle } = item
56
64
  const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
57
65
  const itemClassName = compConf ? compConf.itemClassName : ''
58
66
  const itemStyle = compConf ? compConf.itemStyle : null
59
67
  const itemContentClassName = compConf ? compConf.itemContentClassName : ''
60
68
  const itemContentStyle = compConf ? compConf.itemContentStyle : null
69
+ const itemTitleClassName = compConf ? compConf.itemTitleClassName : ''
70
+ const itemTitleStyle = compConf ? compConf.itemTitleStyle : null
61
71
  const span = item.span || _vm.span
62
72
  const align = item.align || _vm.align
63
73
  const titleAlign = XEUtils.eqNull(item.titleAlign) ? allTitleAlign : item.titleAlign
@@ -65,10 +75,10 @@ const renderItem = (h, _vm, item, slots) => {
65
75
  const titleColon = XEUtils.eqNull(item.titleColon) ? allTitleColon : item.titleColon
66
76
  const titleAsterisk = XEUtils.eqNull(item.titleAsterisk) ? allTitleAsterisk : item.titleAsterisk
67
77
  const itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow
68
- const showEllipsis = itemOverflow === 'ellipsis'
69
- const showTitle = itemOverflow === 'title'
70
- const showTooltip = itemOverflow === true || itemOverflow === 'tooltip'
71
- const hasEllipsis = showTitle || showTooltip || showEllipsis
78
+ const ovEllipsis = itemOverflow === 'ellipsis'
79
+ const ovTitle = itemOverflow === 'title'
80
+ const ovTooltip = itemOverflow === true || itemOverflow === 'tooltip'
81
+ const hasEllipsis = ovTitle || ovTooltip || ovEllipsis
72
82
  const params = { data, field, property: field, item, $form: _vm, $grid: _vm.xegrid }
73
83
  let isRequired
74
84
  if (visible === false) {
@@ -90,7 +100,7 @@ const renderItem = (h, _vm, item, slots) => {
90
100
  } else if (field) {
91
101
  contentVNs = [`${XEUtils.get(data, field)}`]
92
102
  }
93
- const ons = showTooltip ? {
103
+ const ons = ovTooltip ? {
94
104
  mouseenter (evnt) {
95
105
  _vm.triggerTitleTipEvent(evnt, params)
96
106
  },
@@ -118,21 +128,35 @@ const renderItem = (h, _vm, item, slots) => {
118
128
  h('div', {
119
129
  class: 'vxe-form--item-inner'
120
130
  }, [
121
- title || (slots && slots.title) ? h('div', {
122
- class: ['vxe-form--item-title', titleAlign ? `align--${titleAlign}` : null, {
123
- 'is--ellipsis': hasEllipsis
124
- }],
125
- style: titleWidth ? {
126
- width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
127
- } : null,
131
+ (showTitle !== false) && (title || (slots && slots.title)) ? h('div', {
132
+ class: [
133
+ 'vxe-form--item-title',
134
+ titleAlign ? `align--${titleAlign}` : '',
135
+ hasEllipsis ? 'is--ellipsis' : '',
136
+ itemTitleClassName ? (XEUtils.isFunction(itemTitleClassName) ? itemTitleClassName(params) : itemTitleClassName) : '',
137
+ titleClassName ? (XEUtils.isFunction(titleClassName) ? titleClassName(params) : titleClassName) : ''
138
+ ],
139
+ style: Object.assign(
140
+ {},
141
+ XEUtils.isFunction(itemTitleStyle) ? itemTitleStyle(params) : itemTitleStyle,
142
+ XEUtils.isFunction(titleStyle) ? titleStyle(params) : titleStyle,
143
+ titleWidth ? {
144
+ width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
145
+ } : null
146
+ ),
128
147
  attrs: {
129
- title: showTitle ? getFuncText(title) : null
148
+ title: ovTitle ? getFuncText(title) : null
130
149
  },
131
150
  on: ons
132
151
  }, renderTitle(h, _vm, item)) : null,
133
152
  h('div', {
134
- class: ['vxe-form--item-content', align ? `align--${align}` : '', itemContentClassName ? (XEUtils.isFunction(itemContentClassName) ? itemContentClassName(params) : itemContentClassName) : ''],
135
- style: XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle
153
+ class: [
154
+ 'vxe-form--item-content',
155
+ align ? `align--${align}` : '',
156
+ itemContentClassName ? (XEUtils.isFunction(itemContentClassName) ? itemContentClassName(params) : itemContentClassName) : '',
157
+ contentClassName ? (XEUtils.isFunction(contentClassName) ? contentClassName(params) : contentClassName) : ''
158
+ ],
159
+ style: Object.assign({}, XEUtils.isFunction(itemContentStyle) ? itemContentStyle(params) : itemContentStyle, XEUtils.isFunction(contentStyle) ? contentStyle(params) : contentStyle)
136
160
  }, contentVNs.concat(
137
161
  [
138
162
  collapseNode ? h('div', {
@@ -18,12 +18,17 @@ class ItemConfig {
18
18
  titlePrefix: item.titlePrefix,
19
19
  titleSuffix: item.titleSuffix,
20
20
  titleOverflow: item.titleOverflow,
21
+ showTitle: item.showTitle,
21
22
  resetValue: item.resetValue,
22
23
  visible: item.visible,
23
24
  visibleMethod: item.visibleMethod,
24
25
  folding: item.folding,
25
26
  collapseNode: item.collapseNode,
26
27
  className: item.className,
28
+ contentClassName: item.className,
29
+ contentStyle: item.contentStyle,
30
+ titleClassName: item.titleClassName,
31
+ titleStyle: item.titleStyle,
27
32
  itemRender: item.itemRender,
28
33
  // 渲染属性
29
34
  showError: false,
package/styles/form.scss CHANGED
@@ -93,14 +93,22 @@
93
93
 
94
94
  .vxe-form {
95
95
  .vxe-form--gather {
96
- display: inline-block;
96
+ display: inline-flex;
97
+ flex-direction: row;
98
+ flex-wrap: wrap;
99
+ align-content: flex-start;
100
+ }
101
+ .vxe-form--wrapper {
102
+ display: flex;
103
+ flex-direction: row;
104
+ flex-wrap: wrap;
97
105
  }
98
106
  .vxe-form--item {
99
107
  display: none;
100
108
  padding: 0.5em 0.8em 0.5em 0;
101
109
  &.is--active {
102
110
  &:not(.is--hidden) {
103
- display: inline-block;
111
+ display: inline-flex;
104
112
  }
105
113
  }
106
114
  }
@@ -169,6 +177,7 @@
169
177
  display: flex;
170
178
  flex-direction: row;
171
179
  align-items: center;
180
+ flex-grow: 1;
172
181
  .vxe-form--item-title {
173
182
  flex-shrink: 0;
174
183
  }
@@ -23,4 +23,7 @@ export interface RowInfo {
23
23
  [key: string]: any;
24
24
  }
25
25
 
26
+ export type VNodeStyle = Record<string, string | number>
27
+ export type VNodeClassName = Record<string, boolean>
28
+
26
29
  export type SlotVNodeType = VNode | string | number
@@ -38,6 +38,7 @@ export class FormItem extends VXETableComponent {
38
38
  * 后缀配置项
39
39
  */
40
40
  titleSuffix?: FormItemTitleOptions;
41
+ showTitle?: boolean
41
42
  /**
42
43
  * 重置时的默认值
43
44
  */
@@ -93,6 +94,7 @@ export interface FormItemOptions {
93
94
  * 后缀配置项
94
95
  */
95
96
  titleSuffix?: FormItemTitleOptions;
97
+ showTitle?: boolean
96
98
  /**
97
99
  * 重置时的默认值
98
100
  */
@@ -1,5 +1,5 @@
1
1
  import { CreateElement } from 'vue'
2
- import { SlotVNodeType, RowInfo, VNodeStyle } from '../component'
2
+ import { SlotVNodeType, RowInfo, VNodeStyle, VNodeClassName } from '../component'
3
3
  import { Table } from '../table'
4
4
  import { Grid } from '../grid'
5
5
  import { ColumnInfo, ColumnCellRenderOptions, ColumnContentRenderOptions } from '../column'
@@ -33,7 +33,7 @@ export interface RendererMapOptions {
33
33
  isFooter?: boolean;
34
34
 
35
35
  // 筛选渲染
36
- filterClassName?: string | ((params: ColumnFilterRenderParams) => string | { [key: string]: boolean })
36
+ filterClassName?: string | ((params: ColumnFilterRenderParams) => string | VNodeClassName)
37
37
  showFilterFooter?: boolean;
38
38
  renderFilter?(h: CreateElement, renderOpts: ColumnFilterRenderOptions, params: ColumnFilterRenderParams): SlotVNodeType | SlotVNodeType[];
39
39
  filterMethod?(params: ColumnFilterMethodParams): boolean;
@@ -42,8 +42,8 @@ export interface RendererMapOptions {
42
42
  defaultFilterMethod?(params: ColumnFilterMethodParams): boolean;
43
43
 
44
44
  // 单元格渲染
45
- cellClassName?: string | ((params: ColumnCellRenderParams | ColumnEditRenderParams) => string | { [key: string]: boolean })
46
- cellStyle?: string | VNodeStyle | ((params: ColumnCellRenderParams | ColumnEditRenderParams) => string | VNodeStyle)
45
+ cellClassName?: string | ((params: ColumnCellRenderParams | ColumnEditRenderParams) => string | VNodeClassName)
46
+ cellStyle?: VNodeStyle | ((params: ColumnCellRenderParams | ColumnEditRenderParams) => VNodeStyle)
47
47
  renderHeader?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnCellRenderParams | ColumnEditRenderParams): SlotVNodeType | SlotVNodeType[];
48
48
  renderDefault?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnCellRenderParams | ColumnEditRenderParams): SlotVNodeType | SlotVNodeType[];
49
49
  renderFooter?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnFooterRenderParams): SlotVNodeType | SlotVNodeType[];
@@ -63,10 +63,12 @@ export interface RendererMapOptions {
63
63
  renderToolbarTool?(h: CreateElement, renderOpts: ToolbarToolRenderOptions, params: ToolbarToolRenderParams): SlotVNodeType | SlotVNodeType[];
64
64
 
65
65
  // 表单-项渲染
66
- itemClassName?: string | ((params: FormItemRenderParams) => string | { [key: string]: boolean })
67
- itemStyle?: string | VNodeStyle | ((params: FormItemRenderParams) => string | VNodeStyle)
68
- itemContentClassName?: string | ((params: FormItemRenderParams) => string | { [key: string]: boolean })
69
- itemContentStyle?: string | VNodeStyle | ((params: FormItemRenderParams) => string | VNodeStyle)
66
+ itemClassName?: string | ((params: FormItemRenderParams) => string | VNodeClassName)
67
+ itemStyle?: VNodeStyle | ((params: FormItemRenderParams) => VNodeStyle)
68
+ itemContentClassName?: string | ((params: FormItemRenderParams) => string | VNodeClassName)
69
+ itemContentStyle?: VNodeStyle | ((params: FormItemRenderParams) => VNodeStyle)
70
+ itemTitleClassName?: string | ((params: FormItemRenderParams) => string | VNodeClassName)
71
+ itemTitleStyle?: VNodeStyle | ((params: FormItemRenderParams) => VNodeStyle)
70
72
  renderItemTitle?(h: CreateElement, renderOpts: FormItemRenderOptions, params: FormItemRenderParams): SlotVNodeType | SlotVNodeType[];
71
73
  renderItemContent?(h: CreateElement, renderOpts: FormItemRenderOptions, params: FormItemRenderParams): SlotVNodeType | SlotVNodeType[];
72
74
  itemVisibleMethod?(params: FormItemVisibleParams): boolean;