vxe-pc-ui 4.11.33 → 4.11.35

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.
Files changed (62) hide show
  1. package/es/button/src/button-group.js +11 -5
  2. package/es/button/src/button.js +12 -4
  3. package/es/context-menu/index.js +2 -2
  4. package/es/context-menu/src/context-menu.js +287 -14
  5. package/es/context-menu/style.css +2 -8
  6. package/es/context-menu/style.min.css +1 -1
  7. package/es/dynamics/index.js +1 -1
  8. package/es/icon/style.css +1 -1
  9. package/es/style.css +1 -1
  10. package/es/style.min.css +1 -1
  11. package/es/ui/index.js +4 -2
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-context-menu/style.css +2 -8
  14. package/es/vxe-context-menu/style.min.css +1 -1
  15. package/lib/button/src/button-group.js +12 -7
  16. package/lib/button/src/button-group.min.js +1 -1
  17. package/lib/button/src/button.js +11 -4
  18. package/lib/button/src/button.min.js +1 -1
  19. package/lib/context-menu/index.js +2 -2
  20. package/lib/context-menu/index.min.js +1 -1
  21. package/lib/context-menu/src/context-menu.js +299 -13
  22. package/lib/context-menu/src/context-menu.min.js +1 -1
  23. package/lib/context-menu/style/style.css +2 -8
  24. package/lib/context-menu/style/style.min.css +1 -1
  25. package/lib/dynamics/index.js +2 -0
  26. package/lib/dynamics/index.min.js +1 -1
  27. package/lib/icon/style/style.css +1 -1
  28. package/lib/icon/style/style.min.css +1 -1
  29. package/lib/index.umd.js +331 -29
  30. package/lib/index.umd.min.js +1 -1
  31. package/lib/style.css +1 -1
  32. package/lib/style.min.css +1 -1
  33. package/lib/ui/index.js +4 -2
  34. package/lib/ui/index.min.js +1 -1
  35. package/lib/ui/src/log.js +1 -1
  36. package/lib/ui/src/log.min.js +1 -1
  37. package/lib/vxe-context-menu/style/style.css +2 -8
  38. package/lib/vxe-context-menu/style/style.min.css +1 -1
  39. package/package.json +1 -1
  40. package/packages/button/src/button-group.ts +14 -6
  41. package/packages/button/src/button.ts +13 -4
  42. package/packages/context-menu/index.ts +2 -2
  43. package/packages/context-menu/src/context-menu.ts +290 -15
  44. package/packages/dynamics/index.ts +1 -1
  45. package/packages/ui/index.ts +3 -1
  46. package/styles/components/context-menu.scss +2 -12
  47. package/types/components/button-group.d.ts +9 -1
  48. package/types/components/button.d.ts +9 -1
  49. package/types/components/context-menu.d.ts +3 -1
  50. package/types/components/table-module/filter.d.ts +4 -0
  51. /package/es/icon/{iconfont.1767617712062.ttf → iconfont.1767779770584.ttf} +0 -0
  52. /package/es/icon/{iconfont.1767617712062.woff → iconfont.1767779770584.woff} +0 -0
  53. /package/es/icon/{iconfont.1767617712062.woff2 → iconfont.1767779770584.woff2} +0 -0
  54. /package/es/{iconfont.1767617712062.ttf → iconfont.1767779770584.ttf} +0 -0
  55. /package/es/{iconfont.1767617712062.woff → iconfont.1767779770584.woff} +0 -0
  56. /package/es/{iconfont.1767617712062.woff2 → iconfont.1767779770584.woff2} +0 -0
  57. /package/lib/icon/style/{iconfont.1767617712062.ttf → iconfont.1767779770584.ttf} +0 -0
  58. /package/lib/icon/style/{iconfont.1767617712062.woff → iconfont.1767779770584.woff} +0 -0
  59. /package/lib/icon/style/{iconfont.1767617712062.woff2 → iconfont.1767779770584.woff2} +0 -0
  60. /package/lib/{iconfont.1767617712062.ttf → iconfont.1767779770584.ttf} +0 -0
  61. /package/lib/{iconfont.1767617712062.woff → iconfont.1767779770584.woff} +0 -0
  62. /package/lib/{iconfont.1767617712062.woff2 → iconfont.1767779770584.woff2} +0 -0
@@ -25,7 +25,7 @@ function createReactData() {
25
25
  left: '',
26
26
  zIndex: 0
27
27
  },
28
- childPos: ''
28
+ childOffsetX: 0
29
29
  };
30
30
  }
31
31
  var _default = exports.default = (0, _comp.defineVxeComponent)({
@@ -40,6 +40,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
40
40
  options: Array,
41
41
  x: [Number, String],
42
42
  y: [Number, String],
43
+ autoLocate: {
44
+ type: Boolean,
45
+ default: () => (0, _ui.getConfig)().contextMenu.autoLocate
46
+ },
43
47
  zIndex: [Number, String],
44
48
  position: {
45
49
  type: String,
@@ -75,6 +79,20 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
75
79
  } = props;
76
80
  return options || [];
77
81
  });
82
+ const computeAllFirstMenuList = (0, _vue.computed)(() => {
83
+ const menuGroups = computeMenuGroups.value;
84
+ const firstList = [];
85
+ for (let i = 0; i < menuGroups.length; i++) {
86
+ const list = menuGroups[i];
87
+ for (let j = 0; j < list.length; j++) {
88
+ const firstItem = list[j];
89
+ if (hasValidItem(firstItem)) {
90
+ firstList.push(firstItem);
91
+ }
92
+ }
93
+ }
94
+ return firstList;
95
+ });
78
96
  const computeTopAndLeft = (0, _vue.computed)(() => {
79
97
  const {
80
98
  x,
@@ -108,7 +126,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
108
126
  } = reactData;
109
127
  const value = true;
110
128
  reactData.visible = value;
111
- updateLocate();
129
+ handleLocate();
112
130
  updateZindex();
113
131
  if (modelValue !== value) {
114
132
  emitModel(value);
@@ -121,7 +139,9 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
121
139
  visible: value
122
140
  }, null);
123
141
  }
124
- return (0, _vue.nextTick)();
142
+ return (0, _vue.nextTick)().then(() => {
143
+ updateLocate();
144
+ });
125
145
  };
126
146
  const close = () => {
127
147
  const {
@@ -145,7 +165,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
145
165
  }
146
166
  return (0, _vue.nextTick)();
147
167
  };
148
- const updateLocate = () => {
168
+ const handleLocate = () => {
149
169
  const {
150
170
  x,
151
171
  y
@@ -155,6 +175,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
155
175
  } = reactData;
156
176
  popupStyle.left = (0, _dom.toCssUnit)(x || 0);
157
177
  popupStyle.top = (0, _dom.toCssUnit)(y || 0);
178
+ updateLocate();
158
179
  };
159
180
  const updateZindex = () => {
160
181
  const {
@@ -173,6 +194,67 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
173
194
  }
174
195
  }
175
196
  };
197
+ const updateLocate = () => {
198
+ const {
199
+ autoLocate,
200
+ position
201
+ } = props;
202
+ const {
203
+ popupStyle
204
+ } = reactData;
205
+ if (autoLocate) {
206
+ const wrapperEl = refElem.value;
207
+ if (wrapperEl) {
208
+ const {
209
+ visibleWidth,
210
+ visibleHeight
211
+ } = (0, _dom.getDomNode)();
212
+ const wrapperStyle = getComputedStyle(wrapperEl);
213
+ const offsetTop = _xeUtils.default.toNumber(wrapperStyle.top);
214
+ const offsetLeft = _xeUtils.default.toNumber(wrapperStyle.left);
215
+ const wrapperWidth = wrapperEl.offsetWidth;
216
+ const wrapperHeight = wrapperEl.offsetHeight;
217
+ if (position === 'absolute') {
218
+ //
219
+ } else {
220
+ if (offsetTop + wrapperHeight > visibleHeight) {
221
+ popupStyle.top = `${Math.max(0, offsetTop - wrapperHeight)}px`;
222
+ }
223
+ if (offsetLeft + wrapperWidth > visibleWidth) {
224
+ popupStyle.left = `${Math.max(0, offsetLeft - wrapperWidth)}px`;
225
+ }
226
+ }
227
+ }
228
+ }
229
+ updateChildLocate();
230
+ };
231
+ const updateChildLocate = () => {
232
+ const wrapperEl = refElem.value;
233
+ if (wrapperEl) {
234
+ const {
235
+ visibleWidth
236
+ } = (0, _dom.getDomNode)();
237
+ const owSize = 2;
238
+ const handleStyle = () => {
239
+ const wrapperStyle = getComputedStyle(wrapperEl);
240
+ const offsetLeft = _xeUtils.default.toNumber(wrapperStyle.left);
241
+ const wrapperWidth = wrapperEl.offsetWidth;
242
+ const childEl = wrapperEl.querySelector('.vxe-context-menu--children-wrapper');
243
+ const childWidth = childEl ? childEl.offsetWidth : wrapperWidth;
244
+ if (offsetLeft + wrapperWidth > visibleWidth - childWidth) {
245
+ // 往左
246
+ reactData.childOffsetX = -childWidth + owSize;
247
+ } else {
248
+ // 往右
249
+ reactData.childOffsetX = wrapperWidth - owSize;
250
+ }
251
+ };
252
+ handleStyle();
253
+ (0, _vue.nextTick)(() => {
254
+ handleStyle();
255
+ });
256
+ }
257
+ };
176
258
  const handleVisible = () => {
177
259
  const {
178
260
  modelValue
@@ -204,12 +286,193 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
204
286
  };
205
287
  const handleItemMouseenterEvent = (evnt, item, parentitem) => {
206
288
  reactData.activeOption = parentitem || item;
207
- reactData.activeChildOption = parentitem ? item : null;
289
+ if (parentitem) {
290
+ reactData.activeOption = parentitem;
291
+ reactData.activeChildOption = item;
292
+ } else {
293
+ reactData.activeOption = item;
294
+ if (hasChildMenu(item)) {
295
+ reactData.activeChildOption = findFirstChildItem(item);
296
+ (0, _vue.nextTick)(() => {
297
+ updateChildLocate();
298
+ });
299
+ } else {
300
+ reactData.activeChildOption = null;
301
+ }
302
+ }
208
303
  };
209
304
  const handleItemMouseleaveEvent = () => {
210
305
  reactData.activeOption = null;
211
306
  reactData.activeChildOption = null;
212
307
  };
308
+ const hasValidItem = item => {
309
+ return !item.loading && !item.disabled && item.visible !== false;
310
+ };
311
+ const findNextFirstItem = (allFirstList, firstItem) => {
312
+ for (let i = 0; i < allFirstList.length; i++) {
313
+ const item = allFirstList[i];
314
+ if (firstItem === item) {
315
+ const nextItem = allFirstList[i + 1];
316
+ if (nextItem) {
317
+ return nextItem;
318
+ }
319
+ }
320
+ }
321
+ return _xeUtils.default.first(allFirstList);
322
+ };
323
+ const findPrevFirstItem = (allFirstList, firstItem) => {
324
+ for (let i = 0; i < allFirstList.length; i++) {
325
+ const item = allFirstList[i];
326
+ if (firstItem === item) {
327
+ if (i > 0) {
328
+ return allFirstList[i - 1];
329
+ }
330
+ }
331
+ }
332
+ return _xeUtils.default.last(allFirstList);
333
+ };
334
+ const findFirstChildItem = firstItem => {
335
+ const {
336
+ children
337
+ } = firstItem;
338
+ if (children) {
339
+ for (let i = 0; i < children.length; i++) {
340
+ const item = children[i];
341
+ if (hasValidItem(item)) {
342
+ return item;
343
+ }
344
+ }
345
+ }
346
+ return null;
347
+ };
348
+ const findPrevChildItem = (firstItem, childItem) => {
349
+ const {
350
+ children
351
+ } = firstItem;
352
+ let prevValidItem = null;
353
+ if (children) {
354
+ for (let i = 0; i < children.length; i++) {
355
+ const item = children[i];
356
+ if (childItem === item) {
357
+ break;
358
+ }
359
+ if (hasValidItem(item)) {
360
+ prevValidItem = item;
361
+ }
362
+ }
363
+ if (!prevValidItem) {
364
+ for (let len = children.length - 1; len >= 0; len--) {
365
+ const item = children[len];
366
+ if (hasValidItem(item)) {
367
+ return item;
368
+ }
369
+ }
370
+ }
371
+ }
372
+ return prevValidItem;
373
+ };
374
+ const findNextChildItem = (firstItem, childItem) => {
375
+ const {
376
+ children
377
+ } = firstItem;
378
+ let firstValidItem = null;
379
+ if (children) {
380
+ let isMetch = false;
381
+ for (let i = 0; i < children.length; i++) {
382
+ const item = children[i];
383
+ if (!firstValidItem) {
384
+ if (hasValidItem(item)) {
385
+ firstValidItem = item;
386
+ }
387
+ }
388
+ if (isMetch) {
389
+ if (hasValidItem(item)) {
390
+ return item;
391
+ }
392
+ } else {
393
+ isMetch = childItem === item;
394
+ }
395
+ }
396
+ }
397
+ return firstValidItem;
398
+ };
399
+ const handleGlobalMousewheelEvent = evnt => {
400
+ const {
401
+ visible
402
+ } = reactData;
403
+ if (visible) {
404
+ const el = refElem.value;
405
+ if (!(0, _dom.getEventTargetNode)(evnt, el, '').flag) {
406
+ close();
407
+ }
408
+ }
409
+ };
410
+ const handleGlobalKeydownEvent = evnt => {
411
+ const {
412
+ visible,
413
+ activeOption,
414
+ activeChildOption
415
+ } = reactData;
416
+ const allFirstMenuList = computeAllFirstMenuList.value;
417
+ if (visible) {
418
+ const isUpArrow = _ui.globalEvents.hasKey(evnt, _ui.GLOBAL_EVENT_KEYS.ARROW_UP);
419
+ const isDwArrow = _ui.globalEvents.hasKey(evnt, _ui.GLOBAL_EVENT_KEYS.ARROW_DOWN);
420
+ const isLeftArrow = _ui.globalEvents.hasKey(evnt, _ui.GLOBAL_EVENT_KEYS.ARROW_LEFT);
421
+ const isRightArrow = _ui.globalEvents.hasKey(evnt, _ui.GLOBAL_EVENT_KEYS.ARROW_RIGHT);
422
+ const isEnter = _ui.globalEvents.hasKey(evnt, _ui.GLOBAL_EVENT_KEYS.ENTER);
423
+ const isEsc = _ui.globalEvents.hasKey(evnt, _ui.GLOBAL_EVENT_KEYS.ESCAPE);
424
+ if (isEsc) {
425
+ close();
426
+ return;
427
+ }
428
+ // 回车选中
429
+ if (isEnter) {
430
+ if (activeOption || activeChildOption) {
431
+ evnt.preventDefault();
432
+ evnt.stopPropagation();
433
+ if (!activeChildOption && hasChildMenu(activeOption)) {
434
+ reactData.activeChildOption = findFirstChildItem(activeOption);
435
+ updateChildLocate();
436
+ return;
437
+ }
438
+ handleItemClickEvent(evnt, activeChildOption || activeOption);
439
+ return;
440
+ }
441
+ }
442
+ // 方向键操作
443
+ if (activeChildOption) {
444
+ if (isUpArrow) {
445
+ evnt.preventDefault();
446
+ reactData.activeChildOption = findPrevChildItem(activeOption, activeChildOption);
447
+ updateChildLocate();
448
+ } else if (isDwArrow) {
449
+ evnt.preventDefault();
450
+ reactData.activeChildOption = findNextChildItem(activeOption, activeChildOption);
451
+ updateChildLocate();
452
+ } else if (isLeftArrow) {
453
+ evnt.preventDefault();
454
+ reactData.activeChildOption = null;
455
+ }
456
+ } else if (activeOption) {
457
+ evnt.preventDefault();
458
+ if (isUpArrow) {
459
+ reactData.activeOption = findPrevFirstItem(allFirstMenuList, activeOption);
460
+ } else if (isDwArrow) {
461
+ reactData.activeOption = findNextFirstItem(allFirstMenuList, activeOption);
462
+ } else {
463
+ if (hasChildMenu(activeOption)) {
464
+ if (isRightArrow) {
465
+ reactData.activeChildOption = findFirstChildItem(activeOption);
466
+ updateChildLocate();
467
+ }
468
+ }
469
+ }
470
+ } else {
471
+ evnt.preventDefault();
472
+ reactData.activeOption = _xeUtils.default.first(allFirstMenuList);
473
+ }
474
+ }
475
+ };
213
476
  const handleGlobalMousedownEvent = evnt => {
214
477
  const {
215
478
  visible
@@ -221,6 +484,14 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
221
484
  }
222
485
  }
223
486
  };
487
+ const handleGlobalBlurEvent = () => {
488
+ const {
489
+ visible
490
+ } = reactData;
491
+ if (visible) {
492
+ close();
493
+ }
494
+ };
224
495
  const tagPrivateMethods = {};
225
496
  Object.assign($xeContextMenu, tagMethods, tagPrivateMethods);
226
497
  const renderMenuItem = (item, parentItem, hasChildMenus) => {
@@ -284,7 +555,8 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
284
555
  const renderMenus = () => {
285
556
  const {
286
557
  activeOption,
287
- activeChildOption
558
+ activeChildOption,
559
+ childOffsetX
288
560
  } = reactData;
289
561
  const menuGroups = computeMenuGroups.value;
290
562
  const mgVNs = [];
@@ -295,13 +567,19 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
295
567
  children
296
568
  } = firstItem;
297
569
  const hasChildMenus = children && children.some(child => child.visible !== false);
570
+ const isActiveFirst = activeOption === firstItem;
571
+ const showChild = isActiveFirst && !!activeChildOption;
298
572
  moVNs.push((0, _vue.h)('div', {
299
573
  key: `${gIndex}_${i}`,
300
574
  class: ['vxe-context-menu--item-wrapper vxe-context-menu--first-item', firstItem.className || '', {
301
- 'is--active': activeOption === firstItem
575
+ 'is--active': isActiveFirst,
576
+ 'is--subactive': isActiveFirst && !!activeChildOption
302
577
  }]
303
- }, [hasChildMenus ? (0, _vue.h)('div', {
304
- class: 'vxe-context-menu--children-wrapper'
578
+ }, [hasChildMenus && showChild ? (0, _vue.h)('div', {
579
+ class: 'vxe-context-menu--children-wrapper',
580
+ style: {
581
+ transform: `translate(${childOffsetX}px, -5px)`
582
+ }
305
583
  }, children.map(twoItem => {
306
584
  return (0, _vue.h)('div', {
307
585
  class: ['vxe-context-menu--item-wrapper vxe-context-menu--child-item', twoItem.className || '', {
@@ -325,13 +603,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
325
603
  } = props;
326
604
  const {
327
605
  visible,
328
- popupStyle,
329
- childPos
606
+ popupStyle
330
607
  } = reactData;
331
608
  const vSize = computeSize.value;
332
609
  return (0, _vue.h)('div', {
333
610
  ref: refElem,
334
- class: ['vxe-context-menu vxe-context-menu--wrapper', position === 'absolute' ? 'is--' + position : 'is--fixed', `cp--${childPos === 'left' ? childPos : 'right'}`, className || '', {
611
+ class: ['vxe-context-menu vxe-context-menu--wrapper', position === 'absolute' ? 'is--' + position : 'is--fixed', className || '', {
335
612
  [`size--${vSize}`]: vSize,
336
613
  'is--visible': visible
337
614
  }],
@@ -339,17 +616,26 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
339
616
  }, (destroyOnClose ? visible : true) ? renderMenus() : []);
340
617
  };
341
618
  (0, _vue.watch)(computeTopAndLeft, () => {
342
- updateLocate();
619
+ handleLocate();
620
+ (0, _vue.nextTick)(() => {
621
+ updateLocate();
622
+ });
343
623
  });
344
624
  (0, _vue.watch)(() => props.modelValue, () => {
345
625
  handleVisible();
346
626
  });
347
627
  handleVisible();
348
628
  (0, _vue.onMounted)(() => {
629
+ _ui.globalEvents.on($xeContextMenu, 'mousewheel', handleGlobalMousewheelEvent);
630
+ _ui.globalEvents.on($xeContextMenu, 'keydown', handleGlobalKeydownEvent);
349
631
  _ui.globalEvents.on($xeContextMenu, 'mousedown', handleGlobalMousedownEvent);
632
+ _ui.globalEvents.on($xeContextMenu, 'blur', handleGlobalBlurEvent);
350
633
  });
351
634
  (0, _vue.onBeforeUnmount)(() => {
635
+ _ui.globalEvents.off($xeContextMenu, 'mousewheel');
636
+ _ui.globalEvents.off($xeContextMenu, 'keydown');
352
637
  _ui.globalEvents.off($xeContextMenu, 'mousedown');
638
+ _ui.globalEvents.off($xeContextMenu, 'blur');
353
639
  _xeUtils.default.assign(reactData, createReactData());
354
640
  _xeUtils.default.assign(internalData, createInternalData());
355
641
  });
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_utils=require("../../ui/src/utils"),_dom=require("../../ui/src/dom"),_vn=require("../../ui/src/vn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function createInternalData(){return{}}function createReactData(){return{visible:!1,activeOption:null,activeChildOption:null,popupStyle:{top:"",left:"",zIndex:0},childPos:""}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeContextMenu",props:{modelValue:Boolean,className:String,size:{type:String,default:()=>(0,_ui.getConfig)().contextMenu.size||(0,_ui.getConfig)().size},options:Array,x:[Number,String],y:[Number,String],zIndex:[Number,String],position:{type:String,default:()=>(0,_ui.getConfig)().contextMenu.position},destroyOnClose:{type:Boolean,default:()=>(0,_ui.getConfig)().contextMenu.destroyOnClose},transfer:{type:Boolean,default:()=>(0,_ui.getConfig)().contextMenu.transfer}},emits:["update:modelValue","option-click","change","show","hide"],setup(a,e){const i=e["emit"];var t=_xeUtils.default.uniqueId();const l=(0,_vue.ref)(),r=(0,_ui.useSize)(a)["computeSize"],n=createInternalData(),c=(0,_vue.reactive)(createReactData()),u={refElem:l},v=(0,_vue.computed)(()=>{var e=a["options"];return e||[]});var s=(0,_vue.computed)(()=>{var{x:e,y:t}=a;return""+e+t});const o={},d={xID:t,props:a,context:e,reactData:c,getRefMaps:()=>u,getComputeMaps:()=>o},p=(e,t,n)=>{i(e,(0,_ui.createEvent)(n,{$contextMenu:d},t))},_=e=>{i("update:modelValue",e)},m=()=>{var e=a["modelValue"],t=c["visible"],n=!0;c.visible=n,f();{var{zIndex:i,transfer:u}=a,s=c.popupStyle,o=s.zIndex;i?s.zIndex=_xeUtils.default.toNumber(i):o<(0,_utils.getLastZIndex)()&&(s.zIndex=(u?(0,_utils.nextSubZIndex):(0,_utils.nextZIndex))())}return e!==n&&(_(n),p("change",{value:n},null)),t!==n&&p("show",{visible:n},null),(0,_vue.nextTick)()},x=()=>{var e=a["modelValue"],t=c["visible"],n=!1;return e!==(c.visible=n)&&(_(n),p("change",{value:n},null)),t!==n&&p("hide",{visible:n},null),(0,_vue.nextTick)()},f=()=>{var{x:e,y:t}=a,n=c["popupStyle"];n.left=(0,_dom.toCssUnit)(e||0),n.top=(0,_dom.toCssUnit)(t||0)},h=()=>{var e=a["modelValue"];(e?m:x)()};t={dispatchEvent:p,open:m,close:x};const g=()=>{c.activeOption=null,c.activeChildOption=null},y=e=>{var t=c["visible"];t&&(t=l.value,(0,_dom.getEventTargetNode)(e,t,"").flag||x())};Object.assign(d,t,{});const b=(i,u,e)=>{var t,n,s,o,{visible:a,disabled:l,loading:r}=i;return!1===a?(0,_ui.renderEmptyElement)(d):(t=(a=Object.assign({},i.prefixConfig)).icon||i.prefixIcon,s=(n=Object.assign({},i.suffixConfig)).icon||i.suffixIcon,o=r?(0,_ui.getI18n)("vxe.contextMenu.loadingText"):(0,_utils.getFuncText)(i.name),(0,_vue.h)("div",{class:["vxe-context-menu--item-inner",{"is--disabled":l,"is--loading":r}],onClick(e){var t;e=e,(e=>{e=e.children;return e&&e.some(e=>!1!==e.visible)})(t=i)||(p("option-click",{option:t},e),x())},onMouseenter(e){var t,n;t=i,n=u,c.activeOption=n||t,c.activeChildOption=n?t:null},onMouseleave:g},[(0,_vue.h)("div",{class:["vxe-context-menu--item-prefix",a.className||""]},r?[(0,_vue.h)("span",{key:"1"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().CONTEXT_MENU_OPTION_LOADING})])]:[t&&_xeUtils.default.isFunction(t)?(0,_vue.h)("span",{key:"2"},(0,_vn.getSlotVNs)(t({}))):(0,_vue.h)("span",{key:"3"},[(0,_vue.h)("i",{class:t})]),a.content?(0,_vue.h)("span",{key:"4"},""+(a.content||"")):(0,_ui.renderEmptyElement)(d)]),(0,_vue.h)("div",{class:"vxe-context-menu--item-label"},o),r||!s&&!n.content?(0,_ui.renderEmptyElement)(d):(0,_vue.h)("div",{class:["vxe-context-menu--item-suffix",n.className||""]},[s&&_xeUtils.default.isFunction(s)?(0,_vue.h)("span",{key:"2"},(0,_vn.getSlotVNs)(s({}))):(0,_vue.h)("span",{key:"3"},[(0,_vue.h)("i",{class:s})]),n.content?(0,_vue.h)("span",{key:"4"},""+(n.content||"")):(0,_ui.renderEmptyElement)(d)]),e?(0,_vue.h)("div",{class:"vxe-context-menu--item-subicon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().CONTEXT_MENU_CHILDREN})]):(0,_ui.renderEmptyElement)(d)]))};return(0,_vue.watch)(s,()=>{f()}),(0,_vue.watch)(()=>a.modelValue,()=>{h()}),h(),(0,_vue.onMounted)(()=>{_ui.globalEvents.on(d,"mousedown",y)}),(0,_vue.onBeforeUnmount)(()=>{_ui.globalEvents.off(d,"mousedown"),_xeUtils.default.assign(c,createReactData()),_xeUtils.default.assign(n,createInternalData())}),d.renderVN=()=>{var{className:e,position:t,destroyOnClose:n}=a,{visible:i,popupStyle:u,childPos:s}=c,o=r.value;return(0,_vue.h)("div",{ref:l,class:["vxe-context-menu vxe-context-menu--wrapper","absolute"===t?"is--"+t:"is--fixed","cp--"+("left"===s?s:"right"),e||"",{["size--"+o]:o,"is--visible":i}],style:u},!n||i?(()=>{const{activeOption:o,activeChildOption:a}=c;var e=v.value;const t=[];return e.forEach((e,u)=>{const s=[];e.forEach((t,e)=>{var n=t["children"],i=n&&n.some(e=>!1!==e.visible);s.push((0,_vue.h)("div",{key:u+"_"+e,class:["vxe-context-menu--item-wrapper vxe-context-menu--first-item",t.className||"",{"is--active":o===t}]},[i?(0,_vue.h)("div",{class:"vxe-context-menu--children-wrapper"},n.map(e=>(0,_vue.h)("div",{class:["vxe-context-menu--item-wrapper vxe-context-menu--child-item",e.className||"",{"is--active":a===e}]},[b(e,t)]))):(0,_ui.renderEmptyElement)(d),b(t,null,i)]))}),t.push((0,_vue.h)("div",{key:u,class:"vxe-context-menu--group-wrapper"},s))}),t})():[])},d},render(){return this.renderVN()}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_utils=require("../../ui/src/utils"),_dom=require("../../ui/src/dom"),_vn=require("../../ui/src/vn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function createInternalData(){return{}}function createReactData(){return{visible:!1,activeOption:null,activeChildOption:null,popupStyle:{top:"",left:"",zIndex:0},childOffsetX:0}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeContextMenu",props:{modelValue:Boolean,className:String,size:{type:String,default:()=>(0,_ui.getConfig)().contextMenu.size||(0,_ui.getConfig)().size},options:Array,x:[Number,String],y:[Number,String],autoLocate:{type:Boolean,default:()=>(0,_ui.getConfig)().contextMenu.autoLocate},zIndex:[Number,String],position:{type:String,default:()=>(0,_ui.getConfig)().contextMenu.position},destroyOnClose:{type:Boolean,default:()=>(0,_ui.getConfig)().contextMenu.destroyOnClose},transfer:{type:Boolean,default:()=>(0,_ui.getConfig)().contextMenu.transfer}},emits:["update:modelValue","option-click","change","show","hide"],setup(r,e){const n=e["emit"];var t=_xeUtils.default.uniqueId();const s=(0,_vue.ref)(),a=(0,_ui.useSize)(r)["computeSize"],i=createInternalData(),c=(0,_vue.reactive)(createReactData()),l={refElem:s},o=(0,_vue.computed)(()=>{var e=r["options"];return e||[]}),v=(0,_vue.computed)(()=>{var t=o.value,i=[];for(let e=0;e<t.length;e++){var n=t[e];for(let e=0;e<n.length;e++){var l=n[e];C(l)&&i.push(l)}}return i});var u=(0,_vue.computed)(()=>{var{x:e,y:t}=r;return""+e+t});const d={},_={xID:t,props:r,context:e,reactData:c,getRefMaps:()=>l,getComputeMaps:()=>d},p=(e,t,i)=>{n(e,(0,_ui.createEvent)(i,{$contextMenu:_},t))},f=e=>{n("update:modelValue",e)},m=()=>{var e=r["modelValue"],t=c["visible"];c.visible=!0,h();{var{zIndex:i,transfer:n}=r,l=c.popupStyle,u=l.zIndex;i?l.zIndex=_xeUtils.default.toNumber(i):u<(0,_utils.getLastZIndex)()&&(l.zIndex=(n?(0,_utils.nextSubZIndex):(0,_utils.nextZIndex))())}return!0!==e&&(f(!0),p("change",{value:!0},null)),!0!==t&&p("show",{visible:!0},null),(0,_vue.nextTick)().then(()=>{g()})},x=()=>{var e=r["modelValue"],t=c["visible"];return(c.visible=!1)!==e&&(f(!1),p("change",{value:!1},null)),!1!==t&&p("hide",{visible:!1},null),(0,_vue.nextTick)()},h=()=>{var{x:e,y:t}=r,i=c["popupStyle"];i.left=(0,_dom.toCssUnit)(e||0),i.top=(0,_dom.toCssUnit)(t||0),g()},g=()=>{var e,t,i,n,l,{autoLocate:u,position:a}=r,o=c["popupStyle"];u&&(u=s.value)&&({visibleWidth:e,visibleHeight:t}=(0,_dom.getDomNode)(),n=getComputedStyle(u),i=_xeUtils.default.toNumber(n.top),n=_xeUtils.default.toNumber(n.left),l=u.offsetWidth,u=u.offsetHeight,"absolute"!==a)&&(t<i+u&&(o.top=Math.max(0,i-u)+"px"),e<n+l)&&(o.left=Math.max(0,n-l)+"px"),E()},E=()=>{const n=s.value;if(n){const l=(0,_dom.getDomNode)()["visibleWidth"],e=()=>{var e=getComputedStyle(n),e=_xeUtils.default.toNumber(e.left),t=n.offsetWidth,i=n.querySelector(".vxe-context-menu--children-wrapper"),i=i?i.offsetWidth:t;e+t>l-i?c.childOffsetX=2-i:c.childOffsetX=t-2};e(),(0,_vue.nextTick)(()=>{e()})}},b=()=>{var e=r["modelValue"];(e?m:x)()};t={dispatchEvent:p,open:m,close:x};const O=e=>{e=e.children;return e&&e.some(e=>!1!==e.visible)},y=(e,t)=>{O(t)||(p("option-click",{option:t},e),x())},N=()=>{c.activeOption=null,c.activeChildOption=null},C=e=>!e.loading&&!e.disabled&&!1!==e.visible,S=e=>{var t=e["children"];if(t)for(let e=0;e<t.length;e++){var i=t[e];if(C(i))return i}return null},I=e=>{var t=c["visible"];t&&(t=s.value,(0,_dom.getEventTargetNode)(e,t,"").flag||x())},T=e=>{var{visible:t,activeOption:i,activeChildOption:n}=c,l=v.value;if(t){var t=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),u=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN),a=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_LEFT),o=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_RIGHT),r=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ENTER);if(!_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ESCAPE))return r&&(i||n)?(e.preventDefault(),e.stopPropagation(),!n&&O(i)?(c.activeChildOption=S(i),void E()):void y(e,n||i)):void(n?t?(e.preventDefault(),c.activeChildOption=((e,t)=>{var i=e["children"];let n=null;if(i){for(let e=0;e<i.length;e++){var l=i[e];if(t===l)break;C(l)&&(n=l)}if(!n)for(let e=i.length-1;0<=e;e--){var u=i[e];if(C(u))return u}}return n})(i,n),E()):u?(e.preventDefault(),c.activeChildOption=((e,i)=>{var n=e["children"];let l=null;if(n){let t=!1;for(let e=0;e<n.length;e++){var u=n[e];if(l||C(u)&&(l=u),t){if(C(u))return u}else t=i===u}}return l})(i,n),E()):a&&(e.preventDefault(),c.activeChildOption=null):i?(e.preventDefault(),t?c.activeOption=((t,i)=>{for(let e=0;e<t.length;e++){var n=t[e];if(i===n&&0<e)return t[e-1]}return _xeUtils.default.last(t)})(l,i):u?c.activeOption=((t,i)=>{for(let e=0;e<t.length;e++)if(i===t[e]){var n=t[e+1];if(n)return n}return _xeUtils.default.first(t)})(l,i):O(i)&&o&&(c.activeChildOption=S(i),E())):(e.preventDefault(),c.activeOption=_xeUtils.default.first(l)));x()}},D=e=>{var t=c["visible"];t&&(t=s.value,(0,_dom.getEventTargetNode)(e,t,"").flag||x())},k=()=>{var e=c["visible"];e&&x()};Object.assign(_,t,{});const L=(n,l,e)=>{var t,i,u,a,{visible:o,disabled:r,loading:s}=n;return!1===o?(0,_ui.renderEmptyElement)(_):(t=(o=Object.assign({},n.prefixConfig)).icon||n.prefixIcon,u=(i=Object.assign({},n.suffixConfig)).icon||n.suffixIcon,a=s?(0,_ui.getI18n)("vxe.contextMenu.loadingText"):(0,_utils.getFuncText)(n.name),(0,_vue.h)("div",{class:["vxe-context-menu--item-inner",{"is--disabled":r,"is--loading":s}],onClick(e){y(e,n)},onMouseenter(e){var t,i;t=n,i=l,c.activeOption=i||t,i?(c.activeOption=i,c.activeChildOption=t):(c.activeOption=t,O(t)?(c.activeChildOption=S(t),(0,_vue.nextTick)(()=>{E()})):c.activeChildOption=null)},onMouseleave:N},[(0,_vue.h)("div",{class:["vxe-context-menu--item-prefix",o.className||""]},s?[(0,_vue.h)("span",{key:"1"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().CONTEXT_MENU_OPTION_LOADING})])]:[t&&_xeUtils.default.isFunction(t)?(0,_vue.h)("span",{key:"2"},(0,_vn.getSlotVNs)(t({}))):(0,_vue.h)("span",{key:"3"},[(0,_vue.h)("i",{class:t})]),o.content?(0,_vue.h)("span",{key:"4"},""+(o.content||"")):(0,_ui.renderEmptyElement)(_)]),(0,_vue.h)("div",{class:"vxe-context-menu--item-label"},a),s||!u&&!i.content?(0,_ui.renderEmptyElement)(_):(0,_vue.h)("div",{class:["vxe-context-menu--item-suffix",i.className||""]},[u&&_xeUtils.default.isFunction(u)?(0,_vue.h)("span",{key:"2"},(0,_vn.getSlotVNs)(u({}))):(0,_vue.h)("span",{key:"3"},[(0,_vue.h)("i",{class:u})]),i.content?(0,_vue.h)("span",{key:"4"},""+(i.content||"")):(0,_ui.renderEmptyElement)(_)]),e?(0,_vue.h)("div",{class:"vxe-context-menu--item-subicon"},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().CONTEXT_MENU_CHILDREN})]):(0,_ui.renderEmptyElement)(_)]))};return(0,_vue.watch)(u,()=>{h(),(0,_vue.nextTick)(()=>{g()})}),(0,_vue.watch)(()=>r.modelValue,()=>{b()}),b(),(0,_vue.onMounted)(()=>{_ui.globalEvents.on(_,"mousewheel",I),_ui.globalEvents.on(_,"keydown",T),_ui.globalEvents.on(_,"mousedown",D),_ui.globalEvents.on(_,"blur",k)}),(0,_vue.onBeforeUnmount)(()=>{_ui.globalEvents.off(_,"mousewheel"),_ui.globalEvents.off(_,"keydown"),_ui.globalEvents.off(_,"mousedown"),_ui.globalEvents.off(_,"blur"),_xeUtils.default.assign(c,createReactData()),_xeUtils.default.assign(i,createInternalData())}),_.renderVN=()=>{var{className:e,position:t,destroyOnClose:i}=r,{visible:n,popupStyle:l}=c,u=a.value;return(0,_vue.h)("div",{ref:s,class:["vxe-context-menu vxe-context-menu--wrapper","absolute"===t?"is--"+t:"is--fixed",e||"",{["size--"+u]:u,"is--visible":n}],style:l},!i||n?(()=>{const{activeOption:r,activeChildOption:s,childOffsetX:v}=c;var e=o.value;const t=[];return e.forEach((e,a)=>{const o=[];e.forEach((t,e)=>{var i=t["children"],n=i&&i.some(e=>!1!==e.visible),l=r===t,u=l&&!!s;o.push((0,_vue.h)("div",{key:a+"_"+e,class:["vxe-context-menu--item-wrapper vxe-context-menu--first-item",t.className||"",{"is--active":l,"is--subactive":l&&!!s}]},[n&&u?(0,_vue.h)("div",{class:"vxe-context-menu--children-wrapper",style:{transform:`translate(${v}px, -5px)`}},i.map(e=>(0,_vue.h)("div",{class:["vxe-context-menu--item-wrapper vxe-context-menu--child-item",e.className||"",{"is--active":s===e}]},[L(e,t)]))):(0,_ui.renderEmptyElement)(_),L(t,null,n)]))}),t.push((0,_vue.h)("div",{key:a,class:"vxe-context-menu--group-wrapper"},o))}),t})():[])},_},render(){return this.renderVN()}});
@@ -15,12 +15,6 @@
15
15
  .vxe-context-menu.is--absolute {
16
16
  position: absolute;
17
17
  }
18
- .vxe-context-menu.cp--left .vxe-context-menu--children-wrapper {
19
- left: calc(-100% + 2px);
20
- }
21
- .vxe-context-menu.cp--right .vxe-context-menu--children-wrapper {
22
- left: calc(100% - 2px);
23
- }
24
18
 
25
19
  .vxe-context-menu--group-wrapper {
26
20
  border-top: 1px solid var(--vxe-ui-base-popup-border-color);
@@ -43,7 +37,7 @@
43
37
  .vxe-context-menu--children-wrapper {
44
38
  display: none;
45
39
  position: absolute;
46
- transform: translateY(-5px);
40
+ transform: translate(0, -5px);
47
41
  }
48
42
 
49
43
  .vxe-context-menu--item-wrapper {
@@ -58,7 +52,7 @@
58
52
  background-color: rgba(0, 0, 0, 0.1);
59
53
  }
60
54
 
61
- .vxe-context-menu--first-item.is--active .vxe-context-menu--children-wrapper {
55
+ .vxe-context-menu--first-item.is--subactive .vxe-context-menu--children-wrapper {
62
56
  display: block;
63
57
  }
64
58
 
@@ -1 +1 @@
1
- .vxe-context-menu{display:none;top:0;left:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.vxe-context-menu.is--visible{display:block}.vxe-context-menu.is--fixed{position:fixed}.vxe-context-menu.is--absolute{position:absolute}.vxe-context-menu.cp--left .vxe-context-menu--children-wrapper{left:calc(-100% + 2px)}.vxe-context-menu.cp--right .vxe-context-menu--children-wrapper{left:calc(100% - 2px)}.vxe-context-menu--group-wrapper{border-top:1px solid var(--vxe-ui-base-popup-border-color)}.vxe-context-menu--group-wrapper:first-child{border:0}.vxe-context-menu--children-wrapper,.vxe-context-menu--wrapper{padding:0;color:var(--vxe-ui-font-color);font-family:var(--vxe-ui-font-family);border:1px solid var(--vxe-ui-base-popup-border-color);background-color:var(--vxe-ui-layout-background-color);border-radius:var(--vxe-ui-base-border-radius);box-shadow:0 0 12px 0 rgba(0,0,0,.3)}.vxe-context-menu--children-wrapper{display:none;position:absolute;transform:translateY(-5px)}.vxe-context-menu--item-wrapper{position:relative;min-width:12em;max-width:20em;-webkit-user-select:none;-moz-user-select:none;user-select:none}.vxe-context-menu--item-wrapper.is--active{background-color:rgba(0,0,0,.1)}.vxe-context-menu--first-item.is--active .vxe-context-menu--children-wrapper{display:block}.vxe-context-menu--item-inner{height:var(--vxe-ui-context-menu-option-height);display:flex;align-items:center;padding:0 .8em;cursor:pointer}.vxe-context-menu--item-inner.is--loading{opacity:.5;cursor:progress}.vxe-context-menu--item-inner.is--disabled{color:var(--vxe-ui-font-disabled-color);cursor:no-drop}.vxe-context-menu--item-prefix{min-width:1em;text-align:center}.vxe-context-menu--item-prefix,.vxe-context-menu--item-suffix{flex-shrink:0;font-size:.9em}.vxe-context-menu--item-label{font-size:.9em;padding:0 .5em;flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vxe-context-menu{font-size:var(--vxe-ui-font-size-default)}.vxe-context-menu.size--medium{font-size:var(--vxe-ui-font-size-medium)}.vxe-context-menu.size--small{font-size:var(--vxe-ui-font-size-small)}.vxe-context-menu.size--mini{font-size:var(--vxe-ui-font-size-mini)}
1
+ .vxe-context-menu{display:none;top:0;left:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.vxe-context-menu.is--visible{display:block}.vxe-context-menu.is--fixed{position:fixed}.vxe-context-menu.is--absolute{position:absolute}.vxe-context-menu--group-wrapper{border-top:1px solid var(--vxe-ui-base-popup-border-color)}.vxe-context-menu--group-wrapper:first-child{border:0}.vxe-context-menu--children-wrapper,.vxe-context-menu--wrapper{padding:0;color:var(--vxe-ui-font-color);font-family:var(--vxe-ui-font-family);border:1px solid var(--vxe-ui-base-popup-border-color);background-color:var(--vxe-ui-layout-background-color);border-radius:var(--vxe-ui-base-border-radius);box-shadow:0 0 12px 0 rgba(0,0,0,.3)}.vxe-context-menu--children-wrapper{display:none;position:absolute;transform:translate(0,-5px)}.vxe-context-menu--item-wrapper{position:relative;min-width:12em;max-width:20em;-webkit-user-select:none;-moz-user-select:none;user-select:none}.vxe-context-menu--item-wrapper.is--active{background-color:rgba(0,0,0,.1)}.vxe-context-menu--first-item.is--subactive .vxe-context-menu--children-wrapper{display:block}.vxe-context-menu--item-inner{height:var(--vxe-ui-context-menu-option-height);display:flex;align-items:center;padding:0 .8em;cursor:pointer}.vxe-context-menu--item-inner.is--loading{opacity:.5;cursor:progress}.vxe-context-menu--item-inner.is--disabled{color:var(--vxe-ui-font-disabled-color);cursor:no-drop}.vxe-context-menu--item-prefix{min-width:1em;text-align:center}.vxe-context-menu--item-prefix,.vxe-context-menu--item-suffix{flex-shrink:0;font-size:.9em}.vxe-context-menu--item-label{font-size:.9em;padding:0 .5em;flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vxe-context-menu{font-size:var(--vxe-ui-font-size-default)}.vxe-context-menu.size--medium{font-size:var(--vxe-ui-font-size-medium)}.vxe-context-menu.size--small{font-size:var(--vxe-ui-font-size-small)}.vxe-context-menu.size--mini{font-size:var(--vxe-ui-font-size-mini)}
@@ -59,6 +59,8 @@ const VxeDynamics = (0, _comp.defineVxeComponent)({
59
59
  optionClick(params);
60
60
  }
61
61
  }
62
+ }, {
63
+ events: undefined
62
64
  });
63
65
  }
64
66
  return [modals.length ? (0, _vue.h)('div', {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkDynamic=checkDynamic,exports.dynamicStore=exports.dynamicApp=void 0;var _vue=require("vue"),_comp=require("../ui/src/comp"),_core=require("@vxe-ui/core");let dynamicContainerElem;const dynamicStore=exports.dynamicStore=(0,_vue.reactive)({modals:[],drawers:[],globalLoading:null,globalWatermark:null,globalContextMenu:null}),VxeDynamics=(0,_comp.defineVxeComponent)({setup(){const d=_core.VxeUI.getComponent("vxe-modal"),l=_core.VxeUI.getComponent("vxe-drawer"),u=_core.VxeUI.getComponent("vxe-loading"),v=_core.VxeUI.getComponent("vxe-watermark"),p=_core.VxeUI.getComponent("vxe-context-menu");return()=>{var{modals:e,drawers:n,globalWatermark:o,globalLoading:t,globalContextMenu:a}=dynamicStore;let c=a;if(a){const{optionClick:m,show:r,hide:i}=a.events||{};c=Object.assign({},a,{onShow(e){r&&r(e)},onHide(e){i&&i(e),dynamicStore.globalContextMenu=null},onOptionClick(e){m&&m(e)}})}return[e.length?(0,_vue.h)("div",{key:1,class:"vxe-dynamics--modal"},e.map(e=>(0,_vue.h)(d,e))):(0,_vue.createCommentVNode)(),n.length?(0,_vue.h)("div",{key:2,class:"vxe-dynamics--drawer"},n.map(e=>(0,_vue.h)(l,e))):(0,_vue.createCommentVNode)(),o?(0,_vue.h)(v,o):(0,_vue.createCommentVNode)(),t?(0,_vue.h)(u,t):(0,_vue.createCommentVNode)(),a?(0,_vue.h)(p,c):(0,_vue.createCommentVNode)()]}}}),dynamicApp=exports.dynamicApp=(0,_vue.createApp)(VxeDynamics);function checkDynamic(){dynamicContainerElem||((dynamicContainerElem=document.createElement("div")).className="vxe-dynamics",document.body.appendChild(dynamicContainerElem),dynamicApp.mount(dynamicContainerElem))}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkDynamic=checkDynamic,exports.dynamicStore=exports.dynamicApp=void 0;var _vue=require("vue"),_comp=require("../ui/src/comp"),_core=require("@vxe-ui/core");let dynamicContainerElem;const dynamicStore=exports.dynamicStore=(0,_vue.reactive)({modals:[],drawers:[],globalLoading:null,globalWatermark:null,globalContextMenu:null}),VxeDynamics=(0,_comp.defineVxeComponent)({setup(){const d=_core.VxeUI.getComponent("vxe-modal"),l=_core.VxeUI.getComponent("vxe-drawer"),u=_core.VxeUI.getComponent("vxe-loading"),v=_core.VxeUI.getComponent("vxe-watermark"),s=_core.VxeUI.getComponent("vxe-context-menu");return()=>{var{modals:e,drawers:n,globalWatermark:o,globalLoading:t,globalContextMenu:a}=dynamicStore;let c=a;if(a){const{optionClick:m,show:r,hide:i}=a.events||{};c=Object.assign({},a,{onShow(e){r&&r(e)},onHide(e){i&&i(e),dynamicStore.globalContextMenu=null},onOptionClick(e){m&&m(e)}},{events:void 0})}return[e.length?(0,_vue.h)("div",{key:1,class:"vxe-dynamics--modal"},e.map(e=>(0,_vue.h)(d,e))):(0,_vue.createCommentVNode)(),n.length?(0,_vue.h)("div",{key:2,class:"vxe-dynamics--drawer"},n.map(e=>(0,_vue.h)(l,e))):(0,_vue.createCommentVNode)(),o?(0,_vue.h)(v,o):(0,_vue.createCommentVNode)(),t?(0,_vue.h)(u,t):(0,_vue.createCommentVNode)(),a?(0,_vue.h)(s,c):(0,_vue.createCommentVNode)()]}}}),dynamicApp=exports.dynamicApp=(0,_vue.createApp)(VxeDynamics);function checkDynamic(){dynamicContainerElem||((dynamicContainerElem=document.createElement("div")).className="vxe-dynamics",document.body.appendChild(dynamicContainerElem),dynamicApp.mount(dynamicContainerElem))}