Skip to content

Commit

Permalink
releases 3.10.7
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Nov 8, 2024
1 parent b525b99 commit 60b6f80
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 49 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-table",
"version": "3.10.6",
"version": "3.10.7",
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down Expand Up @@ -28,7 +28,7 @@
"style": "lib/style.css",
"typings": "types/index.d.ts",
"dependencies": {
"vxe-pc-ui": "^3.2.14"
"vxe-pc-ui": "^3.2.15"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.25.7",
Expand Down
35 changes: 29 additions & 6 deletions packages/table/module/custom/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
const renderPopupPanel = (h: CreateElement, _vm: any) => {
const VxeUIModalComponent = VxeUI.getComponent<VxeModalComponent>('VxeModal')
const VxeUIButtonComponent = VxeUI.getComponent<VxeButtonComponent>('VxeButton')
const VxeUIInputComponent = VxeUI.getComponent<VxeInputComponent>('VxeInput')
const VxeUINumberInputComponent = VxeUI.getComponent<VxeInputComponent>('VxeInput')
const VxeUITooltipComponent = VxeUI.getComponent<VxeTooltipComponent>('VxeTooltip')
const $xeTableCustomPanel = _vm

Expand All @@ -328,6 +328,8 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
const { customOpts, customColumnList, columnOpts, isMaxFixedColumn } = $xeTable
const { modalOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts
const { maxFixedSize } = columnOpts
const resizableOpts = $xeTable.computeResizableOpts
const { minWidth: reMinWidth, maxWidth: reMaxWidth } = resizableOpts
const modalOpts = Object.assign({}, modalOptions)
const slots = customOpts.slots || {}
const headerSlot = slots.header
Expand All @@ -348,6 +350,25 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
const isVisible = visibleMethod ? visibleMethod({ column }) : true
if (isVisible) {
// 默认继承调整宽度
let customMinWidth = 0
let customMaxWidth = 0
if (allowResizable) {
const resizeParams = {
$table: $xeTable,
column,
columnIndex: index,
$columnIndex: index,
$rowIndex: -1
}
if (reMinWidth) {
customMinWidth = XEUtils.toNumber(XEUtils.isFunction(reMinWidth) ? reMinWidth(resizeParams) : reMinWidth)
}
if (reMaxWidth) {
customMaxWidth = XEUtils.toNumber(XEUtils.isFunction(reMaxWidth) ? reMaxWidth(resizeParams) : reMaxWidth)
}
}

const isChecked = column.renderVisible
const isIndeterminate = column.halfVisible
const colTitle = formatText(column.getTitle(), 1)
Expand Down Expand Up @@ -447,12 +468,14 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
}, [
column.children && column.children.length
? h('span', '-')
: (VxeUIInputComponent
? h(VxeUIInputComponent, {
: (VxeUINumberInputComponent
? h(VxeUINumberInputComponent, {
props: {
type: 'integer',
disabled: isDisabled || isHidden,
value: column.renderResizeWidth
value: column.renderResizeWidth,
min: customMinWidth || undefined,
max: customMaxWidth || undefined
},
on: {
modelValue (value: any) {
Expand Down Expand Up @@ -712,7 +735,7 @@ export default {
const VxeUIModalComponent = VxeUI.getComponent<VxeModalComponent>('VxeModal')
const VxeUIDrawerComponent = VxeUI.getComponent<VxeDrawerComponent>('VxeDrawer')
const VxeUIButtonComponent = VxeUI.getComponent<VxeButtonComponent>('VxeButton')
const VxeUIInputComponent = VxeUI.getComponent<VxeInputComponent>('VxeInput')
const VxeUINumberInputComponent = VxeUI.getComponent<VxeInputComponent>('VxeNumberInput')
const VxeUITooltipComponent = VxeUI.getComponent<VxeTooltipComponent>('VxeTooltip')
const VxeUIRadioGroupComponent = VxeUI.getComponent<VxeRadioGroupComponent>('VxeRadioGroup')

Expand All @@ -729,7 +752,7 @@ export default {
if (!VxeUIButtonComponent) {
errLog('vxe.error.reqComp', ['vxe-button'])
}
if (!VxeUIInputComponent) {
if (!VxeUINumberInputComponent) {
errLog('vxe.error.reqComp', ['vxe-input'])
}
if (!VxeUITooltipComponent) {
Expand Down
7 changes: 6 additions & 1 deletion packages/table/module/validator/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ export default {
const { validOpts } = this
if (validOpts.msgMode === 'single') {
const keys = Object.keys(validErrMaps)
const resMaps = validErrMaps
const resMaps: Record<string, {
row: any;
column: any;
rule: any;
content: any;
}> = {}
if (keys.length) {
const firstKey = keys[0]
resMaps[firstKey] = validErrMaps[firstKey]
Expand Down
22 changes: 14 additions & 8 deletions packages/table/src/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,19 +252,25 @@ function renderColumn (h: any, _vm: any, $xetable: any, seq: any, rowid: any, fi
const validParams = { ...params, ...errorValidItem }
tdVNs.push(
h('div', {
class: ['vxe-cell--valid-error-hint', getClass(validOpts.className, errorValidItem)],
class: ['vxe-cell--valid-error-tip', getClass(validOpts.className, errorValidItem)],
style: errRule && errRule.maxWidth
? {
width: `${errRule.maxWidth}px`
}
: null
}, validSlot
? $xetable.callSlot(validSlot, validParams, h)
: [
h('span', {
class: 'vxe-cell--valid-error-msg'
}, errorValidItem.content)
])
}, [
h('div', {
class: `vxe-cell--valid-error-wrapper vxe-cell--valid-error-theme-${validOpts.theme || 'normal'}`
}, [
validSlot
? $xetable.callSlot(validSlot, validParams, h)
: [
h('span', {
class: 'vxe-cell--valid-error-msg'
}, errorValidItem.content)
]
])
])
)
}
}
Expand Down
13 changes: 12 additions & 1 deletion packages/table/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,18 @@ const hideRowDropTip = ($xeTable: any) => {
const updateRowDropTipContent = ($xeTable: any, tdEl: HTMLElement) => {
const reactData = $xeTable

reactData.dragTipText = tdEl.textContent || ''
const { dragRow } = reactData
const dragOpts = $xeTable.computeDragOpts
const { rowTooltipMethod } = dragOpts
let tipContent = ''
if (rowTooltipMethod) {
tipContent = `${rowTooltipMethod({
row: dragRow
}) || ''}`
} else {
tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || ''])
}
reactData.dragTipText = tipContent
}

const Methods = {
Expand Down
13 changes: 10 additions & 3 deletions packages/table/src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ export default {
const VxeUITooltipComponent = VxeUI.getComponent<VxeTooltipComponent>('VxeTooltip')

const $xeTable = this
const reactData = $xeTable

const {
_e,
Expand Down Expand Up @@ -1089,10 +1090,14 @@ export default {
loadingOpts,
editRules
} = $xeTable
const { dragRow, dragTipText } = reactData
const { leftList, rightList } = columnStore
const currLoading = this._isLoading || loading
const vSize = computeSize
const dragOpts = $xeTable.computeDragOpts
const virtualScrollBars = $xeTable.computeVirtualScrollBars
const dragSlots = dragOpts.slots || {}
const rowTipSlot = dragSlots.rowTip
return h('div', {
class: ['vxe-table', 'vxe-table--render-default', `tid_${tId}`, vSize ? `size--${vSize}` : '', `border--${tableBorder}`, {
[`valid-msg--${validOpts.msgMode}`]: !!editRules,
Expand Down Expand Up @@ -1339,11 +1344,13 @@ export default {
/**
* 拖拽提示
*/
rowOpts.drag
rowOpts.drag && (dragRow || dragTipText)
? h('div', {
ref: 'refRowDragTipElem',
class: 'vxe-table--row-drag-hint'
}, getI18n('vxe.table.dragTip', [this.dragTipText]))
class: 'vxe-table--row-drag-tip'
}, rowTipSlot
? (dragRow ? this.callSlot(rowTipSlot, { row: dragRow }, h) : [renderEmptyElement($xeTable)])
: (dragTipText ? [h('span', dragTipText)] : [renderEmptyElement($xeTable)]))
: _e(),
h('div', {}, [
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ VxeUI.setConfig({
autoClear: true,
autoPos: true,
message: 'inline',
msgMode: 'single'
msgMode: 'single',
theme: 'normal'
},
columnConfig: {
maxFixedSize: 4
Expand Down
3 changes: 2 additions & 1 deletion styles/components/table-module/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@
text-align: center;
}
&.col--resizable {
& > .vxe-input {
& > .vxe-input,
& > .vxe-number-input {
width: 100%;
}
}
Expand Down
62 changes: 36 additions & 26 deletions styles/components/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@
.vxe-body--row-list-move {
transition: transform 0.35s;
}
.vxe-table--row-drag-hint {
.vxe-table--row-drag-tip {
display: none;
position: absolute;
top: 0;
Expand Down Expand Up @@ -1427,30 +1427,40 @@

/*校验不通过*/
.vxe-body--column {
.vxe-cell--valid-error-tip {
width: 100%;
position: absolute;
left: 50%;
font-size: 12px;
line-height: 1.2em;
transform: translateX(-50%);
text-align: left;
z-index: 4;
padding-left: var(--vxe-ui-table-cell-padding-left);
padding-right: var(--vxe-ui-table-cell-padding-right);
}
.vxe-cell--valid-error-wrapper {
display: inline-block;
border-radius: var(--vxe-ui-border-radius);
pointer-events: auto;
}
.vxe-cell--valid-error-theme-beautify {
padding: 0.4em 0.8em;
color: #fff;
background-color: #f56c6c;
.vxe-cell--valid-error-msg {
background: transparent;
}
}
.vxe-cell--valid-error-theme-normal {
color: var(--vxe-ui-table-validate-error-color);
background-color: var(--vxe-ui-table-validate-error-background-color);
}
&.col--active,
&.col--selected {
position: relative;
}
&.col--valid-error {
.vxe-cell--valid-error-hint {
width: 100%;
position: absolute;
left: 50%;
font-size: 12px;
line-height: 1.2em;
transform: translateX(-50%);
text-align: left;
z-index: 4;
padding-left: var(--vxe-ui-table-cell-padding-left);
padding-right: var(--vxe-ui-table-cell-padding-right);
.vxe-cell--valid-error-msg {
display: inline-block;
border-radius: var(--vxe-ui-border-radius);
color: var(--vxe-ui-table-validate-error-color);
background-color: var(--vxe-ui-table-validate-error-background-color);
pointer-events: auto;
}
}
.vxe-default-input,
.vxe-default-textarea,
.vxe-default-select {
Expand All @@ -1465,11 +1475,11 @@
&.valid-msg--single {
.vxe-body--row {
&:last-child {
.vxe-cell--valid-error-hint {
.vxe-cell--valid-error-tip {
bottom: calc(100%);
}
&:first-child {
.vxe-cell--valid-error-hint {
.vxe-cell--valid-error-tip {
bottom: auto;
}
}
Expand All @@ -1479,7 +1489,7 @@
&.valid-msg--full {
.vxe-body--row {
&:last-child {
.vxe-cell--valid-error-hint {
.vxe-cell--valid-error-tip {
top: calc(100% - 1.3em);
}
}
Expand All @@ -1489,7 +1499,7 @@
&.old-cell-valid {
.vxe-body--column {
&.col--valid-error {
.vxe-cell--valid-error-hint {
.vxe-cell--valid-error-tip {
width: 320px;
position: absolute;
bottom: calc(100% + 4px);
Expand All @@ -1511,15 +1521,15 @@
}
.vxe-body--row {
&:first-child {
.vxe-cell--valid-error-hint {
.vxe-cell--valid-error-tip {
bottom: auto;
top: calc(100% + 4px);
}
}
}
.vxe-body--column {
&:first-child {
.vxe-cell--valid-error-hint {
.vxe-cell--valid-error-tip {
left: 10px;
transform: translateX(0);
text-align: left;
Expand Down

0 comments on commit 60b6f80

Please sign in to comment.