@weitutech/by-components 1.1.100 → 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.
@@ -60519,6 +60519,7 @@ __webpack_require__.d(__webpack_exports__, {
60519
60519
  ByDatePickerRange: function() { return /* reexport */ date_picker_range; },
60520
60520
  ByDialog: function() { return /* reexport */ ByDialog; },
60521
60521
  ByDialogService: function() { return /* reexport */ by_dialog_ByDialogService; },
60522
+ ByFloatingMenu: function() { return /* reexport */ ByFloatingMenu; },
60522
60523
  ByFoldSearch: function() { return /* reexport */ fold_search; },
60523
60524
  ByForm: function() { return /* reexport */ form_form; },
60524
60525
  ByPageSearch: function() { return /* reexport */ page_search; },
@@ -79031,6 +79032,505 @@ var ByCascaderPanel_component = normalizeComponent(
79031
79032
  )
79032
79033
 
79033
79034
  /* harmony default export */ var ByCascaderPanel = (ByCascaderPanel_component.exports);
79035
+ ;// ./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-82.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
79036
+ var ByFloatingMenuvue_type_template_id_4d9e17ff_render = function render() {
79037
+ var _vm = this,
79038
+ _c = _vm._self._c;
79039
+ return _c('div', {
79040
+ staticClass: "by-floating-menu",
79041
+ class: {
79042
+ 'is-hidden': _vm.isHidden
79043
+ },
79044
+ style: _vm.menuStyle,
79045
+ on: {
79046
+ "mousedown": _vm.startDrag
79047
+ }
79048
+ }, [_c('div', {
79049
+ staticClass: "floating-main-btn",
79050
+ class: {
79051
+ 'is-expanded': _vm.isExpanded
79052
+ },
79053
+ style: {
79054
+ width: _vm.mainButtonSize + 'px',
79055
+ height: _vm.mainButtonSize + 'px'
79056
+ },
79057
+ on: {
79058
+ "click": _vm.toggleMenu
79059
+ }
79060
+ }, [_vm.mainButtonIcon ? _c('i', {
79061
+ class: _vm.mainButtonIcon,
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
+ fontStyle: 'normal !important'
79070
+ }
79071
+ }) : _c('span', {
79072
+ style: {
79073
+ transform: 'none !important',
79074
+ display: 'block !important',
79075
+ textAlign: 'center !important',
79076
+ lineHeight: _vm.mainButtonSize + 'px !important',
79077
+ width: '100% !important',
79078
+ height: '100% !important'
79079
+ }
79080
+ }, [_vm._v(_vm._s(_vm.mainButtonText))])]), !_vm.isHidden ? _c('div', {
79081
+ staticClass: "hide-btn",
79082
+ style: {
79083
+ width: _vm.mainButtonSize * 0.33 + 'px',
79084
+ height: _vm.mainButtonSize * 0.33 + 'px',
79085
+ top: -_vm.mainButtonSize * 0.08 + 'px',
79086
+ right: -_vm.mainButtonSize * 0.08 + 'px'
79087
+ },
79088
+ on: {
79089
+ "click": _vm.toggleHide
79090
+ }
79091
+ }, [_c('i', {
79092
+ staticClass: "icon-close",
79093
+ style: {
79094
+ transform: 'none !important',
79095
+ display: 'block !important',
79096
+ textAlign: 'center !important',
79097
+ lineHeight: _vm.mainButtonSize * 0.33 + 'px !important',
79098
+ width: '100% !important',
79099
+ height: '100% !important',
79100
+ fontStyle: 'normal !important'
79101
+ }
79102
+ })]) : _vm._e(), _c('transition', {
79103
+ attrs: {
79104
+ "name": "menu-fade"
79105
+ }
79106
+ }, [_c('div', {
79107
+ directives: [{
79108
+ name: "show",
79109
+ rawName: "v-show",
79110
+ value: _vm.isExpanded && !_vm.isHidden,
79111
+ expression: "isExpanded && !isHidden"
79112
+ }],
79113
+ staticClass: "menu-items"
79114
+ }, _vm._l(_vm.menuItems, function (item, index) {
79115
+ return _c('div', {
79116
+ key: index,
79117
+ staticClass: "menu-item",
79118
+ class: {
79119
+ 'is-disabled': item.disabled
79120
+ },
79121
+ style: {
79122
+ width: _vm.mainButtonSize * 0.83 + 'px',
79123
+ height: _vm.mainButtonSize * 0.83 + 'px'
79124
+ },
79125
+ attrs: {
79126
+ "data-tooltip": item.title
79127
+ },
79128
+ on: {
79129
+ "mousedown": function ($event) {
79130
+ return _vm.startMenuItemDrag($event, item, index);
79131
+ },
79132
+ "click": function ($event) {
79133
+ return _vm.handleMenuClick(item, index);
79134
+ }
79135
+ }
79136
+ }, [item.title ? _c('div', {
79137
+ staticClass: "menu-tooltip"
79138
+ }, [_vm._v(_vm._s(item.title))]) : _vm._e(), item.icon ? _c('i', {
79139
+ class: item.icon,
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
+ fontStyle: 'normal !important'
79148
+ }
79149
+ }) : _c('span', {
79150
+ style: {
79151
+ transform: 'none !important',
79152
+ display: 'block !important',
79153
+ textAlign: 'center !important',
79154
+ lineHeight: _vm.mainButtonSize * 0.83 + 'px !important',
79155
+ width: '100% !important',
79156
+ height: '100% !important'
79157
+ }
79158
+ }, [_vm._v(_vm._s(item.text))])]);
79159
+ }), 0)])], 1);
79160
+ };
79161
+ var ByFloatingMenuvue_type_template_id_4d9e17ff_staticRenderFns = [];
79162
+
79163
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
79164
+ /* harmony default export */ var ByFloatingMenuvue_type_script_lang_js = ({
79165
+ name: 'ByFloatingMenu',
79166
+ props: {
79167
+ // 主按钮图标
79168
+ mainButtonIcon: {
79169
+ type: String,
79170
+ default: 'el-icon-s-operation'
79171
+ },
79172
+ // 主按钮文字(如果没图标,会显示文字)
79173
+ mainButtonText: {
79174
+ type: String,
79175
+ default: ''
79176
+ },
79177
+ // 菜单项配置
79178
+ menuItems: {
79179
+ type: Array,
79180
+ default: () => []
79181
+ },
79182
+ // 初始位置
79183
+ position: {
79184
+ type: Object,
79185
+ default: () => ({
79186
+ right: '20px',
79187
+ bottom: '60px'
79188
+ })
79189
+ },
79190
+ // 按钮大小
79191
+ size: {
79192
+ type: String,
79193
+ default: 'small',
79194
+ validator: value => ['mini', 'small', 'medium'].includes(value)
79195
+ }
79196
+ },
79197
+ data() {
79198
+ return {
79199
+ isExpanded: false,
79200
+ isHidden: false,
79201
+ isDragging: false,
79202
+ hasDragged: false,
79203
+ dragStart: {
79204
+ x: 0,
79205
+ y: 0
79206
+ },
79207
+ currentPosition: {
79208
+ x: 0,
79209
+ y: 0
79210
+ },
79211
+ menuStyle: {},
79212
+ // 菜单项拖动相关
79213
+ menuItemDragStart: {
79214
+ x: 0,
79215
+ y: 0
79216
+ },
79217
+ menuItemHasDragged: false,
79218
+ currentMenuItem: null
79219
+ };
79220
+ },
79221
+ computed: {
79222
+ // 根据size属性计算实际大小
79223
+ mainButtonSize() {
79224
+ const sizeMap = {
79225
+ mini: 40,
79226
+ small: 50,
79227
+ medium: 60
79228
+ };
79229
+ return sizeMap[this.size] || 50;
79230
+ }
79231
+ },
79232
+ mounted() {
79233
+ this.initPosition();
79234
+ this.bindEvents();
79235
+ },
79236
+ beforeDestroy() {
79237
+ this.unbindEvents();
79238
+ this.removeShowButton();
79239
+ // 清理菜单项拖动事件监听器
79240
+ document.removeEventListener('mousemove', this.onMenuItemDrag);
79241
+ document.removeEventListener('mouseup', this.endMenuItemDrag);
79242
+ },
79243
+ methods: {
79244
+ // 初始化位置
79245
+ initPosition() {
79246
+ const {
79247
+ right,
79248
+ bottom
79249
+ } = this.position;
79250
+ this.menuStyle = {
79251
+ right: right,
79252
+ bottom: bottom
79253
+ };
79254
+
79255
+ // 初始化当前位置
79256
+ const windowHeight = window.innerHeight;
79257
+ const bottomValue = parseInt(bottom) || 20;
79258
+ this.currentPosition = {
79259
+ x: 0,
79260
+ y: windowHeight - bottomValue - this.mainButtonSize // 使用动态主按钮大小
79261
+ };
79262
+ },
79263
+ // 切换菜单展开状态
79264
+ toggleMenu() {
79265
+ // 如果刚刚拖动了,则不切换菜单状态
79266
+ if (this.hasDragged) {
79267
+ this.hasDragged = false;
79268
+ return;
79269
+ }
79270
+ this.isExpanded = !this.isExpanded;
79271
+ },
79272
+ // 切换隐藏状态
79273
+ toggleHide() {
79274
+ this.isHidden = !this.isHidden;
79275
+ this.isExpanded = false;
79276
+ if (this.isHidden) {
79277
+ // 保持当前纵向位置,只隐藏横向
79278
+ this.menuStyle = {
79279
+ ...this.menuStyle,
79280
+ right: '-100px',
79281
+ transition: 'right 0.3s ease',
79282
+ opacity: '0'
79283
+ };
79284
+ // 创建显示按钮,使用当前纵向位置
79285
+ this.createShowButton();
79286
+ } else {
79287
+ // 显示主菜单,保持当前位置
79288
+ this.menuStyle = {
79289
+ ...this.menuStyle,
79290
+ right: '20px',
79291
+ transition: 'right 0.3s ease, opacity 0.3s ease',
79292
+ opacity: '1'
79293
+ };
79294
+ // 移除显示按钮
79295
+ this.removeShowButton();
79296
+ }
79297
+ },
79298
+ // 处理菜单点击
79299
+ handleMenuClick(item, index) {
79300
+ if (item.disabled) return;
79301
+
79302
+ // 如果刚刚拖动了菜单项,则不触发点击
79303
+ if (this.menuItemHasDragged && this.currentMenuItem && this.currentMenuItem.index === index) {
79304
+ this.menuItemHasDragged = false;
79305
+ this.currentMenuItem = null;
79306
+ return;
79307
+ }
79308
+ this.$emit('menu-click', {
79309
+ item,
79310
+ index
79311
+ });
79312
+ this.isExpanded = false;
79313
+ },
79314
+ // 开始菜单项拖动
79315
+ startMenuItemDrag(e, item, index) {
79316
+ this.menuItemHasDragged = false;
79317
+ this.currentMenuItem = {
79318
+ item,
79319
+ index
79320
+ };
79321
+ this.menuItemDragStart = {
79322
+ x: e.clientX,
79323
+ y: e.clientY
79324
+ };
79325
+
79326
+ // 绑定菜单项拖动事件
79327
+ document.addEventListener('mousemove', this.onMenuItemDrag);
79328
+ document.addEventListener('mouseup', this.endMenuItemDrag);
79329
+
79330
+ // 阻止默认行为
79331
+ e.preventDefault();
79332
+ },
79333
+ // 菜单项拖动中
79334
+ onMenuItemDrag(e) {
79335
+ const deltaX = e.clientX - this.menuItemDragStart.x;
79336
+ const deltaY = e.clientY - this.menuItemDragStart.y;
79337
+
79338
+ // 如果移动距离超过阈值,标记为真正拖动
79339
+ if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
79340
+ this.menuItemHasDragged = true;
79341
+ }
79342
+ },
79343
+ // 结束菜单项拖动
79344
+ endMenuItemDrag() {
79345
+ // 解绑菜单项拖动事件
79346
+ document.removeEventListener('mousemove', this.onMenuItemDrag);
79347
+ document.removeEventListener('mouseup', this.endMenuItemDrag);
79348
+ },
79349
+ // 开始拖拽
79350
+ startDrag(e) {
79351
+ if (this.isHidden) return;
79352
+ this.isDragging = true;
79353
+ this.hasDragged = false; // 标记是否真正拖动了
79354
+
79355
+ // 如果当前位置未初始化,则从当前DOM位置计算
79356
+ if (this.currentPosition.y === 0) {
79357
+ const windowHeight = window.innerHeight;
79358
+ const bottomValue = parseInt(this.menuStyle.bottom) || 20;
79359
+ this.currentPosition.y = windowHeight - bottomValue - this.mainButtonSize;
79360
+ }
79361
+ this.dragStart = {
79362
+ x: e.clientX,
79363
+ y: e.clientY
79364
+ };
79365
+
79366
+ // 阻止默认行为和事件传播
79367
+ e.preventDefault();
79368
+ e.stopPropagation();
79369
+ },
79370
+ // 拖拽中
79371
+ onDrag(e) {
79372
+ if (!this.isDragging || this.isHidden) return;
79373
+ const deltaX = e.clientX - this.dragStart.x;
79374
+ const deltaY = e.clientY - this.dragStart.y;
79375
+
79376
+ // 如果移动距离超过阈值,标记为真正拖动
79377
+ if (Math.abs(deltaY) > 5) {
79378
+ this.hasDragged = true;
79379
+ }
79380
+
79381
+ // 只允许垂直拖拽
79382
+ const newY = this.currentPosition.y + deltaY;
79383
+ const windowHeight = window.innerHeight;
79384
+ const menuHeight = this.mainButtonSize; // 使用动态主按钮大小
79385
+
79386
+ // 限制在屏幕范围内
79387
+ const clampedY = Math.max(0, Math.min(newY, windowHeight - menuHeight));
79388
+ this.currentPosition = {
79389
+ x: this.currentPosition.x,
79390
+ y: clampedY
79391
+ };
79392
+ this.menuStyle = {
79393
+ right: this.menuStyle.right || '20px',
79394
+ bottom: 'auto',
79395
+ top: `${clampedY}px`,
79396
+ transition: 'none'
79397
+ };
79398
+ this.dragStart = {
79399
+ x: e.clientX,
79400
+ y: e.clientY
79401
+ };
79402
+ },
79403
+ // 结束拖拽
79404
+ endDrag() {
79405
+ this.isDragging = false;
79406
+
79407
+ // 更新currentPosition以匹配当前DOM位置
79408
+ if (this.menuStyle.top) {
79409
+ this.currentPosition.y = parseInt(this.menuStyle.top);
79410
+ }
79411
+
79412
+ // 保持当前位置,恢复过渡动画
79413
+ this.menuStyle = {
79414
+ ...this.menuStyle,
79415
+ transition: 'right 0.3s ease, opacity 0.3s ease'
79416
+ };
79417
+ },
79418
+ // 绑定事件
79419
+ bindEvents() {
79420
+ document.addEventListener('mousemove', this.onDrag);
79421
+ document.addEventListener('mouseup', this.endDrag);
79422
+ },
79423
+ // 解绑事件
79424
+ unbindEvents() {
79425
+ document.removeEventListener('mousemove', this.onDrag);
79426
+ document.removeEventListener('mouseup', this.endDrag);
79427
+ },
79428
+ // 创建显示按钮
79429
+ createShowButton() {
79430
+ // 先移除可能存在的显示按钮
79431
+ this.removeShowButton();
79432
+
79433
+ // 计算当前主按钮的纵向位置
79434
+ let topPosition = '50%';
79435
+ if (this.menuStyle.top) {
79436
+ // 如果使用top定位,直接使用
79437
+ topPosition = this.menuStyle.top;
79438
+ } else if (this.menuStyle.bottom) {
79439
+ // 如果使用bottom定位,转换为top
79440
+ const windowHeight = window.innerHeight;
79441
+ const bottomValue = parseInt(this.menuStyle.bottom) || 20;
79442
+ const menuHeight = this.mainButtonSize; // 主按钮高度
79443
+ const showBtnHeight = this.mainButtonSize * 1.33; // 吸附按钮高度(主按钮的1.33倍)
79444
+ // 计算主按钮顶部位置,然后让吸附按钮中心对齐主按钮中心
79445
+ const mainBtnTop = windowHeight - bottomValue - menuHeight;
79446
+ const showBtnTop = mainBtnTop + (menuHeight - showBtnHeight) / 2;
79447
+ topPosition = `${showBtnTop}px`;
79448
+ }
79449
+
79450
+ // 创建显示按钮元素
79451
+ const showBtn = document.createElement('div');
79452
+ showBtn.id = 'floating-show-btn-' + this._uid;
79453
+ showBtn.innerHTML = '<span>◀</span>';
79454
+
79455
+ // 设置样式
79456
+ showBtn.style.position = 'fixed';
79457
+ showBtn.style.right = '0';
79458
+ showBtn.style.top = topPosition;
79459
+ showBtn.style.transform = topPosition.includes('%') ? 'translateY(-30%)' : 'none';
79460
+ showBtn.style.width = this.mainButtonSize * 0.4 + 'px';
79461
+ showBtn.style.height = this.mainButtonSize * 1.33 + 'px';
79462
+ showBtn.style.background = '#409eff';
79463
+ showBtn.style.color = 'white';
79464
+ showBtn.style.display = 'flex';
79465
+ showBtn.style.alignItems = 'center';
79466
+ showBtn.style.justifyContent = 'center';
79467
+ showBtn.style.cursor = 'pointer';
79468
+ showBtn.style.borderRadius = '10px 0 0 10px';
79469
+ showBtn.style.boxShadow = '-2px 0 8px rgba(64, 158, 255, 0.3)';
79470
+ showBtn.style.zIndex = '10001';
79471
+ showBtn.style.transition = 'all 0.3s ease';
79472
+ showBtn.style.fontSize = '15px';
79473
+ showBtn.style.fontWeight = 'bold';
79474
+
79475
+ // 设置span样式
79476
+ const span = showBtn.querySelector('span');
79477
+ if (span) {
79478
+ span.style.fontSize = '15px';
79479
+ span.style.fontWeight = 'bold';
79480
+ span.style.transform = 'none';
79481
+ span.style.display = 'block';
79482
+ }
79483
+
79484
+ // 添加点击事件
79485
+ showBtn.addEventListener('click', this.toggleHide);
79486
+
79487
+ // 添加悬停效果
79488
+ const originalTransform = topPosition.includes('%') ? 'translateY(-30%)' : 'none';
79489
+ showBtn.addEventListener('mouseenter', () => {
79490
+ showBtn.style.background = '#66b1ff';
79491
+ showBtn.style.transform = topPosition.includes('%') ? 'translateY(-50%) translateX(-4px)' : 'translateX(-4px)';
79492
+ showBtn.style.boxShadow = '-4px 0 12px rgba(64, 158, 255, 0.4)';
79493
+ });
79494
+ showBtn.addEventListener('mouseleave', () => {
79495
+ showBtn.style.background = '#409eff';
79496
+ showBtn.style.transform = originalTransform;
79497
+ showBtn.style.boxShadow = '-2px 0 8px rgba(64, 158, 255, 0.3)';
79498
+ });
79499
+
79500
+ // 添加到body
79501
+ document.body.appendChild(showBtn);
79502
+ },
79503
+ // 移除显示按钮
79504
+ removeShowButton() {
79505
+ const showBtn = document.getElementById('floating-show-btn-' + this._uid);
79506
+ if (showBtn) {
79507
+ showBtn.remove();
79508
+ }
79509
+ }
79510
+ }
79511
+ });
79512
+ ;// ./src/components/floating-menu/ByFloatingMenu.vue?vue&type=script&lang=js
79513
+ /* harmony default export */ var floating_menu_ByFloatingMenuvue_type_script_lang_js = (ByFloatingMenuvue_type_script_lang_js);
79514
+ ;// ./src/components/floating-menu/ByFloatingMenu.vue
79515
+
79516
+
79517
+
79518
+
79519
+
79520
+ /* normalize component */
79521
+ ;
79522
+ var ByFloatingMenu_component = normalizeComponent(
79523
+ floating_menu_ByFloatingMenuvue_type_script_lang_js,
79524
+ ByFloatingMenuvue_type_template_id_4d9e17ff_render,
79525
+ ByFloatingMenuvue_type_template_id_4d9e17ff_staticRenderFns,
79526
+ false,
79527
+ null,
79528
+ null,
79529
+ null
79530
+
79531
+ )
79532
+
79533
+ /* harmony default export */ var ByFloatingMenu = (ByFloatingMenu_component.exports);
79034
79534
  ;// ./src/index.js
79035
79535
 
79036
79536
 
@@ -79051,6 +79551,7 @@ var ByCascaderPanel_component = normalizeComponent(
79051
79551
 
79052
79552
 
79053
79553
 
79554
+
79054
79555
  const components = {
79055
79556
  ByPager: pager,
79056
79557
  ByTable: table,
@@ -79065,7 +79566,8 @@ const components = {
79065
79566
  ByBatchQuerySelector: BatchQuerySelector,
79066
79567
  ByTreeSearch: ByTreeSearch,
79067
79568
  ByDialog: ByDialog,
79068
- ByCascaderPanel: ByCascaderPanel
79569
+ ByCascaderPanel: ByCascaderPanel,
79570
+ ByFloatingMenu: ByFloatingMenu
79069
79571
  };
79070
79572
 
79071
79573
  // 设置当前 z-index 起始值