Skip to content

Commit

Permalink
releases 4.2.53
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Nov 13, 2024
1 parent fd87326 commit 50802a1
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-pc-ui",
"version": "4.2.52",
"version": "4.2.53",
"description": "A vue based PC component library",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down
9 changes: 4 additions & 5 deletions packages/form-design/src/layout-view-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export const ViewItemComponent = defineComponent({
formDesignReactData.sortWidget = null
}

let lastDragTime = Date.now()

const sortDragenterEvent = (evnt: DragEvent) => {
const { widgetObjList, sortWidget } = formDesignReactData
if (lastDragTime > Date.now() - 200) {
const formDesignInternalData = $xeFormDesign.internalData
const { lastDragTime } = formDesignInternalData
if (lastDragTime && lastDragTime > Date.now() - 300) {
evnt.preventDefault()
return
}
Expand All @@ -72,9 +72,8 @@ export const ViewItemComponent = defineComponent({
currRest.items.splice(currRest.index, 1)
}
targetRest.items.splice(targetRest.index, 0, currRest.item)
formDesignInternalData.lastDragTime = Date.now()
$xeFormDesign.dispatchEvent('drag-widget', { widget: currRest.item }, evnt)

lastDragTime = Date.now()
}
}
}
Expand Down
13 changes: 8 additions & 5 deletions packages/form-design/widget-row/row-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const ViewColItemComponent = defineComponent({
const { parentWidget, colItemIndex } = props
const { widgetObjList, sortWidget } = formDesignReactData
const targetWidget = parentWidget.children[colItemIndex]
const formDesignInternalData = $xeFormDesign.internalData
evnt.stopPropagation()
if (sortWidget && parentWidget && sortWidget.id !== parentWidget.id) {
if (hasFormDesignLayoutType(sortWidget)) {
Expand All @@ -76,13 +77,15 @@ const ViewColItemComponent = defineComponent({
parentWidget.children[colItemIndex] = item
parentWidget.children[index] = targetWidget
} else {
parentWidget.children[colItemIndex] = item
if (targetWidget.name) {
items.splice(index, 1, targetWidget)
} else {
items.splice(index, 1)
// 如果已存在控件
if (targetWidget && targetWidget.name) {
return
}
parentWidget.children[colItemIndex] = item
items.splice(index, 1)
}
evnt.preventDefault()
formDesignInternalData.lastDragTime = Date.now()
$xeFormDesign.dispatchEvent('drag-widget', { widget: item }, evnt)
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/form-design/widget-subtable/subtable-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ const ViewSubItemComponent = defineComponent({
formDesignReactData.dragWidget = null
}

let lastDragTime = Date.now()

const sortDragenterSubItemEvent = (evnt: DragEvent) => {
const { parentWidget, childIndex } = props
const { widgetObjList, sortWidget } = formDesignReactData
const targetWidget = parentWidget.children[childIndex]
const formDesignInternalData = $xeFormDesign.internalData
const { lastDragTime } = formDesignInternalData
evnt.stopPropagation()
if (lastDragTime > Date.now() - 300) {
if (lastDragTime && lastDragTime > Date.now() - 300) {
evnt.preventDefault()
return
}
Expand All @@ -83,7 +83,7 @@ const ViewSubItemComponent = defineComponent({
parentWidget.children.splice(childIndex, 0, item)
items.splice(index, 1)
}
lastDragTime = Date.now()
formDesignInternalData.lastDragTime = Date.now()
$xeFormDesign.dispatchEvent('drag-widget', { widget: item }, evnt)
}
}
Expand Down
8 changes: 8 additions & 0 deletions styles/components/form-design.scss
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,12 @@
padding: 0;
}
}
.vxe-form--item-inner {
height: 100%;
}
.vxe-form--item-title-content {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
3 changes: 2 additions & 1 deletion styles/components/widget-form/widget-form-row.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
.vxe-form-design--widget-row-view {
position: relative;
height: 100%;
padding: var(--vxe-ui-layout-padding-default);
}
.vxe-form-design--widget-row-view-item-inner {
position: relative;
height: 100%;
min-height: 78px;
padding: var(--vxe-ui-layout-padding-default);
padding: 0;
border: 1px solid transparent;
cursor: grabbing;
&::before {
Expand Down
11 changes: 9 additions & 2 deletions styles/components/widget-form/widget-form-subtable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
border-radius: var(--vxe-ui-base-border-radius);
overflow-y: hidden;
overflow-x: auto;
padding-top: var(--vxe-ui-layout-padding-default);
}
.vxe-form-design--widget-subtable-view-box {
border: 1px solid var(--vxe-ui-input-border-color);
Expand Down Expand Up @@ -106,6 +105,9 @@
flex-wrap: nowrap;
& > .vxe-form-design--widget-subtable-view-item {
border-right: 1px solid var(--vxe-ui-input-border-color);
.vxe-form-design--preview-item-operate {
top: 0.4em;
}
}
}
.vxe-form-design--widget-subtable-view-list-move {
Expand Down Expand Up @@ -191,7 +193,12 @@
}
.vxe-form-design--preview-item-view {
.vxe-form-design--widget-subtable-form-item {
padding: 0;
& > .vxe-form--item-content {
padding: 0;
}
}
.vxe-form--group-content {
align-items: unset;
}
}
}
1 change: 1 addition & 0 deletions types/components/form-design.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export interface FormDesignReactData<D = VxeFormDesignDefines.DefaultSettingForm
}

export interface FormDesignInternalData {
lastDragTime?: number
}

export interface FormDesignMethods {
Expand Down

0 comments on commit 50802a1

Please sign in to comment.