@weitutech/by-components 1.1.99 → 1.1.101
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/lib/by-components.common.js +543 -9
- package/lib/by-components.umd.js +543 -9
- package/lib/by-components.umd.min.js +1 -1
- package/lib/index.css +1 -1
- package/package.json +1 -1
|
@@ -60509,6 +60509,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
60509
60509
|
ByDatePickerRange: function() { return /* reexport */ date_picker_range; },
|
|
60510
60510
|
ByDialog: function() { return /* reexport */ ByDialog; },
|
|
60511
60511
|
ByDialogService: function() { return /* reexport */ by_dialog_ByDialogService; },
|
|
60512
|
+
ByFloatingMenu: function() { return /* reexport */ ByFloatingMenu; },
|
|
60512
60513
|
ByFoldSearch: function() { return /* reexport */ fold_search; },
|
|
60513
60514
|
ByForm: function() { return /* reexport */ form_form; },
|
|
60514
60515
|
ByPageSearch: function() { return /* reexport */ page_search; },
|
|
@@ -76933,8 +76934,8 @@ var ByTreeSearch_component = normalizeComponent(
|
|
|
76933
76934
|
)
|
|
76934
76935
|
|
|
76935
76936
|
/* harmony default export */ var ByTreeSearch = (ByTreeSearch_component.exports);
|
|
76936
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/by-dialog/ByDialog.vue?vue&type=template&id=
|
|
76937
|
-
var
|
|
76937
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/by-dialog/ByDialog.vue?vue&type=template&id=3da494cf
|
|
76938
|
+
var ByDialogvue_type_template_id_3da494cf_render = function render() {
|
|
76938
76939
|
var _vm = this,
|
|
76939
76940
|
_c = _vm._self._c;
|
|
76940
76941
|
return _c('el-dialog', _vm._g(_vm._b({
|
|
@@ -76957,9 +76958,11 @@ var ByDialogvue_type_template_id_75a24552_render = function render() {
|
|
|
76957
76958
|
staticClass: "by-dialog__footer"
|
|
76958
76959
|
}, [_c('div', {
|
|
76959
76960
|
staticClass: "by-dialog__buttons"
|
|
76960
|
-
}, [_vm.
|
|
76961
|
+
}, [_vm.leftButtons.length > 0 ? _c('div', {
|
|
76962
|
+
staticClass: "by-dialog__buttons--left"
|
|
76963
|
+
}, [_vm._l(_vm.leftButtons, function (button, index) {
|
|
76961
76964
|
return [_c('el-button', {
|
|
76962
|
-
key: index
|
|
76965
|
+
key: `left-${index}`,
|
|
76963
76966
|
class: button.class,
|
|
76964
76967
|
style: button.style,
|
|
76965
76968
|
attrs: {
|
|
@@ -76975,11 +76978,33 @@ var ByDialogvue_type_template_id_75a24552_render = function render() {
|
|
|
76975
76978
|
}
|
|
76976
76979
|
}
|
|
76977
76980
|
}, [_vm._v(" " + _vm._s(button.text) + " ")])];
|
|
76978
|
-
})], 2)
|
|
76981
|
+
})], 2) : _vm._e(), _vm.rightButtons.length > 0 ? _c('div', {
|
|
76982
|
+
staticClass: "by-dialog__buttons--right"
|
|
76983
|
+
}, [_vm._l(_vm.rightButtons, function (button, index) {
|
|
76984
|
+
return [_c('el-button', {
|
|
76985
|
+
key: `right-${index}`,
|
|
76986
|
+
class: button.class,
|
|
76987
|
+
style: button.style,
|
|
76988
|
+
attrs: {
|
|
76989
|
+
"type": button.type || 'default',
|
|
76990
|
+
"size": button.size || 'mini',
|
|
76991
|
+
"loading": button.loading,
|
|
76992
|
+
"disabled": button.disabled,
|
|
76993
|
+
"icon": button.icon
|
|
76994
|
+
},
|
|
76995
|
+
on: {
|
|
76996
|
+
"click": function ($event) {
|
|
76997
|
+
return _vm.handleButtonClick(button, index);
|
|
76998
|
+
}
|
|
76999
|
+
}
|
|
77000
|
+
}, [_vm._v(" " + _vm._s(button.text) + " ")])];
|
|
77001
|
+
})], 2) : _vm._e()]), _vm._t("footer")], 2) : _vm._e()]);
|
|
76979
77002
|
};
|
|
76980
|
-
var
|
|
77003
|
+
var ByDialogvue_type_template_id_3da494cf_staticRenderFns = [];
|
|
76981
77004
|
|
|
76982
77005
|
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/by-dialog/ByDialog.vue?vue&type=script&lang=js
|
|
77006
|
+
|
|
77007
|
+
|
|
76983
77008
|
/* harmony default export */ var ByDialogvue_type_script_lang_js = ({
|
|
76984
77009
|
name: 'ByDialog',
|
|
76985
77010
|
inheritAttrs: false,
|
|
@@ -77066,6 +77091,14 @@ var ByDialogvue_type_template_id_75a24552_staticRenderFns = [];
|
|
|
77066
77091
|
closeOnClickModal: this.closeOnClickModal,
|
|
77067
77092
|
...attrs
|
|
77068
77093
|
};
|
|
77094
|
+
},
|
|
77095
|
+
// 左侧按钮
|
|
77096
|
+
leftButtons() {
|
|
77097
|
+
return this.buttons.filter(button => button.position === 'left');
|
|
77098
|
+
},
|
|
77099
|
+
// 右侧按钮(默认位置,包括未设置position的按钮)
|
|
77100
|
+
rightButtons() {
|
|
77101
|
+
return this.buttons.filter(button => !button.position || button.position === 'right');
|
|
77069
77102
|
}
|
|
77070
77103
|
},
|
|
77071
77104
|
watch: {
|
|
@@ -77116,8 +77149,8 @@ var ByDialogvue_type_template_id_75a24552_staticRenderFns = [];
|
|
|
77116
77149
|
;
|
|
77117
77150
|
var ByDialog_component = normalizeComponent(
|
|
77118
77151
|
by_dialog_ByDialogvue_type_script_lang_js,
|
|
77119
|
-
|
|
77120
|
-
|
|
77152
|
+
ByDialogvue_type_template_id_3da494cf_render,
|
|
77153
|
+
ByDialogvue_type_template_id_3da494cf_staticRenderFns,
|
|
77121
77154
|
false,
|
|
77122
77155
|
null,
|
|
77123
77156
|
null,
|
|
@@ -78989,6 +79022,505 @@ var ByCascaderPanel_component = normalizeComponent(
|
|
|
78989
79022
|
)
|
|
78990
79023
|
|
|
78991
79024
|
/* harmony default export */ var ByCascaderPanel = (ByCascaderPanel_component.exports);
|
|
79025
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/floating-menu/ByFloatingMenu.vue?vue&type=template&id=4d9e17ff
|
|
79026
|
+
var ByFloatingMenuvue_type_template_id_4d9e17ff_render = function render() {
|
|
79027
|
+
var _vm = this,
|
|
79028
|
+
_c = _vm._self._c;
|
|
79029
|
+
return _c('div', {
|
|
79030
|
+
staticClass: "by-floating-menu",
|
|
79031
|
+
class: {
|
|
79032
|
+
'is-hidden': _vm.isHidden
|
|
79033
|
+
},
|
|
79034
|
+
style: _vm.menuStyle,
|
|
79035
|
+
on: {
|
|
79036
|
+
"mousedown": _vm.startDrag
|
|
79037
|
+
}
|
|
79038
|
+
}, [_c('div', {
|
|
79039
|
+
staticClass: "floating-main-btn",
|
|
79040
|
+
class: {
|
|
79041
|
+
'is-expanded': _vm.isExpanded
|
|
79042
|
+
},
|
|
79043
|
+
style: {
|
|
79044
|
+
width: _vm.mainButtonSize + 'px',
|
|
79045
|
+
height: _vm.mainButtonSize + 'px'
|
|
79046
|
+
},
|
|
79047
|
+
on: {
|
|
79048
|
+
"click": _vm.toggleMenu
|
|
79049
|
+
}
|
|
79050
|
+
}, [_vm.mainButtonIcon ? _c('i', {
|
|
79051
|
+
class: _vm.mainButtonIcon,
|
|
79052
|
+
style: {
|
|
79053
|
+
transform: 'none !important',
|
|
79054
|
+
display: 'block !important',
|
|
79055
|
+
textAlign: 'center !important',
|
|
79056
|
+
lineHeight: _vm.mainButtonSize + 'px !important',
|
|
79057
|
+
width: '100% !important',
|
|
79058
|
+
height: '100% !important',
|
|
79059
|
+
fontStyle: 'normal !important'
|
|
79060
|
+
}
|
|
79061
|
+
}) : _c('span', {
|
|
79062
|
+
style: {
|
|
79063
|
+
transform: 'none !important',
|
|
79064
|
+
display: 'block !important',
|
|
79065
|
+
textAlign: 'center !important',
|
|
79066
|
+
lineHeight: _vm.mainButtonSize + 'px !important',
|
|
79067
|
+
width: '100% !important',
|
|
79068
|
+
height: '100% !important'
|
|
79069
|
+
}
|
|
79070
|
+
}, [_vm._v(_vm._s(_vm.mainButtonText))])]), !_vm.isHidden ? _c('div', {
|
|
79071
|
+
staticClass: "hide-btn",
|
|
79072
|
+
style: {
|
|
79073
|
+
width: _vm.mainButtonSize * 0.33 + 'px',
|
|
79074
|
+
height: _vm.mainButtonSize * 0.33 + 'px',
|
|
79075
|
+
top: -_vm.mainButtonSize * 0.08 + 'px',
|
|
79076
|
+
right: -_vm.mainButtonSize * 0.08 + 'px'
|
|
79077
|
+
},
|
|
79078
|
+
on: {
|
|
79079
|
+
"click": _vm.toggleHide
|
|
79080
|
+
}
|
|
79081
|
+
}, [_c('i', {
|
|
79082
|
+
staticClass: "icon-close",
|
|
79083
|
+
style: {
|
|
79084
|
+
transform: 'none !important',
|
|
79085
|
+
display: 'block !important',
|
|
79086
|
+
textAlign: 'center !important',
|
|
79087
|
+
lineHeight: _vm.mainButtonSize * 0.33 + 'px !important',
|
|
79088
|
+
width: '100% !important',
|
|
79089
|
+
height: '100% !important',
|
|
79090
|
+
fontStyle: 'normal !important'
|
|
79091
|
+
}
|
|
79092
|
+
})]) : _vm._e(), _c('transition', {
|
|
79093
|
+
attrs: {
|
|
79094
|
+
"name": "menu-fade"
|
|
79095
|
+
}
|
|
79096
|
+
}, [_c('div', {
|
|
79097
|
+
directives: [{
|
|
79098
|
+
name: "show",
|
|
79099
|
+
rawName: "v-show",
|
|
79100
|
+
value: _vm.isExpanded && !_vm.isHidden,
|
|
79101
|
+
expression: "isExpanded && !isHidden"
|
|
79102
|
+
}],
|
|
79103
|
+
staticClass: "menu-items"
|
|
79104
|
+
}, _vm._l(_vm.menuItems, function (item, index) {
|
|
79105
|
+
return _c('div', {
|
|
79106
|
+
key: index,
|
|
79107
|
+
staticClass: "menu-item",
|
|
79108
|
+
class: {
|
|
79109
|
+
'is-disabled': item.disabled
|
|
79110
|
+
},
|
|
79111
|
+
style: {
|
|
79112
|
+
width: _vm.mainButtonSize * 0.83 + 'px',
|
|
79113
|
+
height: _vm.mainButtonSize * 0.83 + 'px'
|
|
79114
|
+
},
|
|
79115
|
+
attrs: {
|
|
79116
|
+
"data-tooltip": item.title
|
|
79117
|
+
},
|
|
79118
|
+
on: {
|
|
79119
|
+
"mousedown": function ($event) {
|
|
79120
|
+
return _vm.startMenuItemDrag($event, item, index);
|
|
79121
|
+
},
|
|
79122
|
+
"click": function ($event) {
|
|
79123
|
+
return _vm.handleMenuClick(item, index);
|
|
79124
|
+
}
|
|
79125
|
+
}
|
|
79126
|
+
}, [item.title ? _c('div', {
|
|
79127
|
+
staticClass: "menu-tooltip"
|
|
79128
|
+
}, [_vm._v(_vm._s(item.title))]) : _vm._e(), item.icon ? _c('i', {
|
|
79129
|
+
class: item.icon,
|
|
79130
|
+
style: {
|
|
79131
|
+
transform: 'none !important',
|
|
79132
|
+
display: 'block !important',
|
|
79133
|
+
textAlign: 'center !important',
|
|
79134
|
+
lineHeight: _vm.mainButtonSize * 0.83 + 'px !important',
|
|
79135
|
+
width: '100% !important',
|
|
79136
|
+
height: '100% !important',
|
|
79137
|
+
fontStyle: 'normal !important'
|
|
79138
|
+
}
|
|
79139
|
+
}) : _c('span', {
|
|
79140
|
+
style: {
|
|
79141
|
+
transform: 'none !important',
|
|
79142
|
+
display: 'block !important',
|
|
79143
|
+
textAlign: 'center !important',
|
|
79144
|
+
lineHeight: _vm.mainButtonSize * 0.83 + 'px !important',
|
|
79145
|
+
width: '100% !important',
|
|
79146
|
+
height: '100% !important'
|
|
79147
|
+
}
|
|
79148
|
+
}, [_vm._v(_vm._s(item.text))])]);
|
|
79149
|
+
}), 0)])], 1);
|
|
79150
|
+
};
|
|
79151
|
+
var ByFloatingMenuvue_type_template_id_4d9e17ff_staticRenderFns = [];
|
|
79152
|
+
|
|
79153
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/floating-menu/ByFloatingMenu.vue?vue&type=script&lang=js
|
|
79154
|
+
/* harmony default export */ var ByFloatingMenuvue_type_script_lang_js = ({
|
|
79155
|
+
name: 'ByFloatingMenu',
|
|
79156
|
+
props: {
|
|
79157
|
+
// 主按钮图标
|
|
79158
|
+
mainButtonIcon: {
|
|
79159
|
+
type: String,
|
|
79160
|
+
default: 'el-icon-s-operation'
|
|
79161
|
+
},
|
|
79162
|
+
// 主按钮文字(如果没图标,会显示文字)
|
|
79163
|
+
mainButtonText: {
|
|
79164
|
+
type: String,
|
|
79165
|
+
default: ''
|
|
79166
|
+
},
|
|
79167
|
+
// 菜单项配置
|
|
79168
|
+
menuItems: {
|
|
79169
|
+
type: Array,
|
|
79170
|
+
default: () => []
|
|
79171
|
+
},
|
|
79172
|
+
// 初始位置
|
|
79173
|
+
position: {
|
|
79174
|
+
type: Object,
|
|
79175
|
+
default: () => ({
|
|
79176
|
+
right: '20px',
|
|
79177
|
+
bottom: '60px'
|
|
79178
|
+
})
|
|
79179
|
+
},
|
|
79180
|
+
// 按钮大小
|
|
79181
|
+
size: {
|
|
79182
|
+
type: String,
|
|
79183
|
+
default: 'small',
|
|
79184
|
+
validator: value => ['mini', 'small', 'medium'].includes(value)
|
|
79185
|
+
}
|
|
79186
|
+
},
|
|
79187
|
+
data() {
|
|
79188
|
+
return {
|
|
79189
|
+
isExpanded: false,
|
|
79190
|
+
isHidden: false,
|
|
79191
|
+
isDragging: false,
|
|
79192
|
+
hasDragged: false,
|
|
79193
|
+
dragStart: {
|
|
79194
|
+
x: 0,
|
|
79195
|
+
y: 0
|
|
79196
|
+
},
|
|
79197
|
+
currentPosition: {
|
|
79198
|
+
x: 0,
|
|
79199
|
+
y: 0
|
|
79200
|
+
},
|
|
79201
|
+
menuStyle: {},
|
|
79202
|
+
// 菜单项拖动相关
|
|
79203
|
+
menuItemDragStart: {
|
|
79204
|
+
x: 0,
|
|
79205
|
+
y: 0
|
|
79206
|
+
},
|
|
79207
|
+
menuItemHasDragged: false,
|
|
79208
|
+
currentMenuItem: null
|
|
79209
|
+
};
|
|
79210
|
+
},
|
|
79211
|
+
computed: {
|
|
79212
|
+
// 根据size属性计算实际大小
|
|
79213
|
+
mainButtonSize() {
|
|
79214
|
+
const sizeMap = {
|
|
79215
|
+
mini: 40,
|
|
79216
|
+
small: 50,
|
|
79217
|
+
medium: 60
|
|
79218
|
+
};
|
|
79219
|
+
return sizeMap[this.size] || 50;
|
|
79220
|
+
}
|
|
79221
|
+
},
|
|
79222
|
+
mounted() {
|
|
79223
|
+
this.initPosition();
|
|
79224
|
+
this.bindEvents();
|
|
79225
|
+
},
|
|
79226
|
+
beforeDestroy() {
|
|
79227
|
+
this.unbindEvents();
|
|
79228
|
+
this.removeShowButton();
|
|
79229
|
+
// 清理菜单项拖动事件监听器
|
|
79230
|
+
document.removeEventListener('mousemove', this.onMenuItemDrag);
|
|
79231
|
+
document.removeEventListener('mouseup', this.endMenuItemDrag);
|
|
79232
|
+
},
|
|
79233
|
+
methods: {
|
|
79234
|
+
// 初始化位置
|
|
79235
|
+
initPosition() {
|
|
79236
|
+
const {
|
|
79237
|
+
right,
|
|
79238
|
+
bottom
|
|
79239
|
+
} = this.position;
|
|
79240
|
+
this.menuStyle = {
|
|
79241
|
+
right: right,
|
|
79242
|
+
bottom: bottom
|
|
79243
|
+
};
|
|
79244
|
+
|
|
79245
|
+
// 初始化当前位置
|
|
79246
|
+
const windowHeight = window.innerHeight;
|
|
79247
|
+
const bottomValue = parseInt(bottom) || 20;
|
|
79248
|
+
this.currentPosition = {
|
|
79249
|
+
x: 0,
|
|
79250
|
+
y: windowHeight - bottomValue - this.mainButtonSize // 使用动态主按钮大小
|
|
79251
|
+
};
|
|
79252
|
+
},
|
|
79253
|
+
// 切换菜单展开状态
|
|
79254
|
+
toggleMenu() {
|
|
79255
|
+
// 如果刚刚拖动了,则不切换菜单状态
|
|
79256
|
+
if (this.hasDragged) {
|
|
79257
|
+
this.hasDragged = false;
|
|
79258
|
+
return;
|
|
79259
|
+
}
|
|
79260
|
+
this.isExpanded = !this.isExpanded;
|
|
79261
|
+
},
|
|
79262
|
+
// 切换隐藏状态
|
|
79263
|
+
toggleHide() {
|
|
79264
|
+
this.isHidden = !this.isHidden;
|
|
79265
|
+
this.isExpanded = false;
|
|
79266
|
+
if (this.isHidden) {
|
|
79267
|
+
// 保持当前纵向位置,只隐藏横向
|
|
79268
|
+
this.menuStyle = {
|
|
79269
|
+
...this.menuStyle,
|
|
79270
|
+
right: '-100px',
|
|
79271
|
+
transition: 'right 0.3s ease',
|
|
79272
|
+
opacity: '0'
|
|
79273
|
+
};
|
|
79274
|
+
// 创建显示按钮,使用当前纵向位置
|
|
79275
|
+
this.createShowButton();
|
|
79276
|
+
} else {
|
|
79277
|
+
// 显示主菜单,保持当前位置
|
|
79278
|
+
this.menuStyle = {
|
|
79279
|
+
...this.menuStyle,
|
|
79280
|
+
right: '20px',
|
|
79281
|
+
transition: 'right 0.3s ease, opacity 0.3s ease',
|
|
79282
|
+
opacity: '1'
|
|
79283
|
+
};
|
|
79284
|
+
// 移除显示按钮
|
|
79285
|
+
this.removeShowButton();
|
|
79286
|
+
}
|
|
79287
|
+
},
|
|
79288
|
+
// 处理菜单点击
|
|
79289
|
+
handleMenuClick(item, index) {
|
|
79290
|
+
if (item.disabled) return;
|
|
79291
|
+
|
|
79292
|
+
// 如果刚刚拖动了菜单项,则不触发点击
|
|
79293
|
+
if (this.menuItemHasDragged && this.currentMenuItem && this.currentMenuItem.index === index) {
|
|
79294
|
+
this.menuItemHasDragged = false;
|
|
79295
|
+
this.currentMenuItem = null;
|
|
79296
|
+
return;
|
|
79297
|
+
}
|
|
79298
|
+
this.$emit('menu-click', {
|
|
79299
|
+
item,
|
|
79300
|
+
index
|
|
79301
|
+
});
|
|
79302
|
+
this.isExpanded = false;
|
|
79303
|
+
},
|
|
79304
|
+
// 开始菜单项拖动
|
|
79305
|
+
startMenuItemDrag(e, item, index) {
|
|
79306
|
+
this.menuItemHasDragged = false;
|
|
79307
|
+
this.currentMenuItem = {
|
|
79308
|
+
item,
|
|
79309
|
+
index
|
|
79310
|
+
};
|
|
79311
|
+
this.menuItemDragStart = {
|
|
79312
|
+
x: e.clientX,
|
|
79313
|
+
y: e.clientY
|
|
79314
|
+
};
|
|
79315
|
+
|
|
79316
|
+
// 绑定菜单项拖动事件
|
|
79317
|
+
document.addEventListener('mousemove', this.onMenuItemDrag);
|
|
79318
|
+
document.addEventListener('mouseup', this.endMenuItemDrag);
|
|
79319
|
+
|
|
79320
|
+
// 阻止默认行为
|
|
79321
|
+
e.preventDefault();
|
|
79322
|
+
},
|
|
79323
|
+
// 菜单项拖动中
|
|
79324
|
+
onMenuItemDrag(e) {
|
|
79325
|
+
const deltaX = e.clientX - this.menuItemDragStart.x;
|
|
79326
|
+
const deltaY = e.clientY - this.menuItemDragStart.y;
|
|
79327
|
+
|
|
79328
|
+
// 如果移动距离超过阈值,标记为真正拖动
|
|
79329
|
+
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
|
|
79330
|
+
this.menuItemHasDragged = true;
|
|
79331
|
+
}
|
|
79332
|
+
},
|
|
79333
|
+
// 结束菜单项拖动
|
|
79334
|
+
endMenuItemDrag() {
|
|
79335
|
+
// 解绑菜单项拖动事件
|
|
79336
|
+
document.removeEventListener('mousemove', this.onMenuItemDrag);
|
|
79337
|
+
document.removeEventListener('mouseup', this.endMenuItemDrag);
|
|
79338
|
+
},
|
|
79339
|
+
// 开始拖拽
|
|
79340
|
+
startDrag(e) {
|
|
79341
|
+
if (this.isHidden) return;
|
|
79342
|
+
this.isDragging = true;
|
|
79343
|
+
this.hasDragged = false; // 标记是否真正拖动了
|
|
79344
|
+
|
|
79345
|
+
// 如果当前位置未初始化,则从当前DOM位置计算
|
|
79346
|
+
if (this.currentPosition.y === 0) {
|
|
79347
|
+
const windowHeight = window.innerHeight;
|
|
79348
|
+
const bottomValue = parseInt(this.menuStyle.bottom) || 20;
|
|
79349
|
+
this.currentPosition.y = windowHeight - bottomValue - this.mainButtonSize;
|
|
79350
|
+
}
|
|
79351
|
+
this.dragStart = {
|
|
79352
|
+
x: e.clientX,
|
|
79353
|
+
y: e.clientY
|
|
79354
|
+
};
|
|
79355
|
+
|
|
79356
|
+
// 阻止默认行为和事件传播
|
|
79357
|
+
e.preventDefault();
|
|
79358
|
+
e.stopPropagation();
|
|
79359
|
+
},
|
|
79360
|
+
// 拖拽中
|
|
79361
|
+
onDrag(e) {
|
|
79362
|
+
if (!this.isDragging || this.isHidden) return;
|
|
79363
|
+
const deltaX = e.clientX - this.dragStart.x;
|
|
79364
|
+
const deltaY = e.clientY - this.dragStart.y;
|
|
79365
|
+
|
|
79366
|
+
// 如果移动距离超过阈值,标记为真正拖动
|
|
79367
|
+
if (Math.abs(deltaY) > 5) {
|
|
79368
|
+
this.hasDragged = true;
|
|
79369
|
+
}
|
|
79370
|
+
|
|
79371
|
+
// 只允许垂直拖拽
|
|
79372
|
+
const newY = this.currentPosition.y + deltaY;
|
|
79373
|
+
const windowHeight = window.innerHeight;
|
|
79374
|
+
const menuHeight = this.mainButtonSize; // 使用动态主按钮大小
|
|
79375
|
+
|
|
79376
|
+
// 限制在屏幕范围内
|
|
79377
|
+
const clampedY = Math.max(0, Math.min(newY, windowHeight - menuHeight));
|
|
79378
|
+
this.currentPosition = {
|
|
79379
|
+
x: this.currentPosition.x,
|
|
79380
|
+
y: clampedY
|
|
79381
|
+
};
|
|
79382
|
+
this.menuStyle = {
|
|
79383
|
+
right: this.menuStyle.right || '20px',
|
|
79384
|
+
bottom: 'auto',
|
|
79385
|
+
top: `${clampedY}px`,
|
|
79386
|
+
transition: 'none'
|
|
79387
|
+
};
|
|
79388
|
+
this.dragStart = {
|
|
79389
|
+
x: e.clientX,
|
|
79390
|
+
y: e.clientY
|
|
79391
|
+
};
|
|
79392
|
+
},
|
|
79393
|
+
// 结束拖拽
|
|
79394
|
+
endDrag() {
|
|
79395
|
+
this.isDragging = false;
|
|
79396
|
+
|
|
79397
|
+
// 更新currentPosition以匹配当前DOM位置
|
|
79398
|
+
if (this.menuStyle.top) {
|
|
79399
|
+
this.currentPosition.y = parseInt(this.menuStyle.top);
|
|
79400
|
+
}
|
|
79401
|
+
|
|
79402
|
+
// 保持当前位置,恢复过渡动画
|
|
79403
|
+
this.menuStyle = {
|
|
79404
|
+
...this.menuStyle,
|
|
79405
|
+
transition: 'right 0.3s ease, opacity 0.3s ease'
|
|
79406
|
+
};
|
|
79407
|
+
},
|
|
79408
|
+
// 绑定事件
|
|
79409
|
+
bindEvents() {
|
|
79410
|
+
document.addEventListener('mousemove', this.onDrag);
|
|
79411
|
+
document.addEventListener('mouseup', this.endDrag);
|
|
79412
|
+
},
|
|
79413
|
+
// 解绑事件
|
|
79414
|
+
unbindEvents() {
|
|
79415
|
+
document.removeEventListener('mousemove', this.onDrag);
|
|
79416
|
+
document.removeEventListener('mouseup', this.endDrag);
|
|
79417
|
+
},
|
|
79418
|
+
// 创建显示按钮
|
|
79419
|
+
createShowButton() {
|
|
79420
|
+
// 先移除可能存在的显示按钮
|
|
79421
|
+
this.removeShowButton();
|
|
79422
|
+
|
|
79423
|
+
// 计算当前主按钮的纵向位置
|
|
79424
|
+
let topPosition = '50%';
|
|
79425
|
+
if (this.menuStyle.top) {
|
|
79426
|
+
// 如果使用top定位,直接使用
|
|
79427
|
+
topPosition = this.menuStyle.top;
|
|
79428
|
+
} else if (this.menuStyle.bottom) {
|
|
79429
|
+
// 如果使用bottom定位,转换为top
|
|
79430
|
+
const windowHeight = window.innerHeight;
|
|
79431
|
+
const bottomValue = parseInt(this.menuStyle.bottom) || 20;
|
|
79432
|
+
const menuHeight = this.mainButtonSize; // 主按钮高度
|
|
79433
|
+
const showBtnHeight = this.mainButtonSize * 1.33; // 吸附按钮高度(主按钮的1.33倍)
|
|
79434
|
+
// 计算主按钮顶部位置,然后让吸附按钮中心对齐主按钮中心
|
|
79435
|
+
const mainBtnTop = windowHeight - bottomValue - menuHeight;
|
|
79436
|
+
const showBtnTop = mainBtnTop + (menuHeight - showBtnHeight) / 2;
|
|
79437
|
+
topPosition = `${showBtnTop}px`;
|
|
79438
|
+
}
|
|
79439
|
+
|
|
79440
|
+
// 创建显示按钮元素
|
|
79441
|
+
const showBtn = document.createElement('div');
|
|
79442
|
+
showBtn.id = 'floating-show-btn-' + this._uid;
|
|
79443
|
+
showBtn.innerHTML = '<span>◀</span>';
|
|
79444
|
+
|
|
79445
|
+
// 设置样式
|
|
79446
|
+
showBtn.style.position = 'fixed';
|
|
79447
|
+
showBtn.style.right = '0';
|
|
79448
|
+
showBtn.style.top = topPosition;
|
|
79449
|
+
showBtn.style.transform = topPosition.includes('%') ? 'translateY(-30%)' : 'none';
|
|
79450
|
+
showBtn.style.width = this.mainButtonSize * 0.4 + 'px';
|
|
79451
|
+
showBtn.style.height = this.mainButtonSize * 1.33 + 'px';
|
|
79452
|
+
showBtn.style.background = '#409eff';
|
|
79453
|
+
showBtn.style.color = 'white';
|
|
79454
|
+
showBtn.style.display = 'flex';
|
|
79455
|
+
showBtn.style.alignItems = 'center';
|
|
79456
|
+
showBtn.style.justifyContent = 'center';
|
|
79457
|
+
showBtn.style.cursor = 'pointer';
|
|
79458
|
+
showBtn.style.borderRadius = '10px 0 0 10px';
|
|
79459
|
+
showBtn.style.boxShadow = '-2px 0 8px rgba(64, 158, 255, 0.3)';
|
|
79460
|
+
showBtn.style.zIndex = '10001';
|
|
79461
|
+
showBtn.style.transition = 'all 0.3s ease';
|
|
79462
|
+
showBtn.style.fontSize = '15px';
|
|
79463
|
+
showBtn.style.fontWeight = 'bold';
|
|
79464
|
+
|
|
79465
|
+
// 设置span样式
|
|
79466
|
+
const span = showBtn.querySelector('span');
|
|
79467
|
+
if (span) {
|
|
79468
|
+
span.style.fontSize = '15px';
|
|
79469
|
+
span.style.fontWeight = 'bold';
|
|
79470
|
+
span.style.transform = 'none';
|
|
79471
|
+
span.style.display = 'block';
|
|
79472
|
+
}
|
|
79473
|
+
|
|
79474
|
+
// 添加点击事件
|
|
79475
|
+
showBtn.addEventListener('click', this.toggleHide);
|
|
79476
|
+
|
|
79477
|
+
// 添加悬停效果
|
|
79478
|
+
const originalTransform = topPosition.includes('%') ? 'translateY(-30%)' : 'none';
|
|
79479
|
+
showBtn.addEventListener('mouseenter', () => {
|
|
79480
|
+
showBtn.style.background = '#66b1ff';
|
|
79481
|
+
showBtn.style.transform = topPosition.includes('%') ? 'translateY(-50%) translateX(-4px)' : 'translateX(-4px)';
|
|
79482
|
+
showBtn.style.boxShadow = '-4px 0 12px rgba(64, 158, 255, 0.4)';
|
|
79483
|
+
});
|
|
79484
|
+
showBtn.addEventListener('mouseleave', () => {
|
|
79485
|
+
showBtn.style.background = '#409eff';
|
|
79486
|
+
showBtn.style.transform = originalTransform;
|
|
79487
|
+
showBtn.style.boxShadow = '-2px 0 8px rgba(64, 158, 255, 0.3)';
|
|
79488
|
+
});
|
|
79489
|
+
|
|
79490
|
+
// 添加到body
|
|
79491
|
+
document.body.appendChild(showBtn);
|
|
79492
|
+
},
|
|
79493
|
+
// 移除显示按钮
|
|
79494
|
+
removeShowButton() {
|
|
79495
|
+
const showBtn = document.getElementById('floating-show-btn-' + this._uid);
|
|
79496
|
+
if (showBtn) {
|
|
79497
|
+
showBtn.remove();
|
|
79498
|
+
}
|
|
79499
|
+
}
|
|
79500
|
+
}
|
|
79501
|
+
});
|
|
79502
|
+
;// ./src/components/floating-menu/ByFloatingMenu.vue?vue&type=script&lang=js
|
|
79503
|
+
/* harmony default export */ var floating_menu_ByFloatingMenuvue_type_script_lang_js = (ByFloatingMenuvue_type_script_lang_js);
|
|
79504
|
+
;// ./src/components/floating-menu/ByFloatingMenu.vue
|
|
79505
|
+
|
|
79506
|
+
|
|
79507
|
+
|
|
79508
|
+
|
|
79509
|
+
|
|
79510
|
+
/* normalize component */
|
|
79511
|
+
;
|
|
79512
|
+
var ByFloatingMenu_component = normalizeComponent(
|
|
79513
|
+
floating_menu_ByFloatingMenuvue_type_script_lang_js,
|
|
79514
|
+
ByFloatingMenuvue_type_template_id_4d9e17ff_render,
|
|
79515
|
+
ByFloatingMenuvue_type_template_id_4d9e17ff_staticRenderFns,
|
|
79516
|
+
false,
|
|
79517
|
+
null,
|
|
79518
|
+
null,
|
|
79519
|
+
null
|
|
79520
|
+
|
|
79521
|
+
)
|
|
79522
|
+
|
|
79523
|
+
/* harmony default export */ var ByFloatingMenu = (ByFloatingMenu_component.exports);
|
|
78992
79524
|
;// ./src/index.js
|
|
78993
79525
|
|
|
78994
79526
|
|
|
@@ -79009,6 +79541,7 @@ var ByCascaderPanel_component = normalizeComponent(
|
|
|
79009
79541
|
|
|
79010
79542
|
|
|
79011
79543
|
|
|
79544
|
+
|
|
79012
79545
|
const components = {
|
|
79013
79546
|
ByPager: pager,
|
|
79014
79547
|
ByTable: table,
|
|
@@ -79023,7 +79556,8 @@ const components = {
|
|
|
79023
79556
|
ByBatchQuerySelector: BatchQuerySelector,
|
|
79024
79557
|
ByTreeSearch: ByTreeSearch,
|
|
79025
79558
|
ByDialog: ByDialog,
|
|
79026
|
-
ByCascaderPanel: ByCascaderPanel
|
|
79559
|
+
ByCascaderPanel: ByCascaderPanel,
|
|
79560
|
+
ByFloatingMenu: ByFloatingMenu
|
|
79027
79561
|
};
|
|
79028
79562
|
|
|
79029
79563
|
// 设置当前 z-index 起始值
|