@xiaou66/u-web-ui 0.98.0 → 0.99.0
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/dist/index.d.ts +16 -0
- package/dist/index.es.js +9 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -167,6 +167,16 @@ export declare interface ContextMenuItemProps {
|
|
|
167
167
|
icon?: string;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
/**
|
|
171
|
+
* 菜单位置偏移量配置
|
|
172
|
+
*/
|
|
173
|
+
export declare interface ContextMenuOffset {
|
|
174
|
+
/** X轴偏移量,正数向右,负数向左 */
|
|
175
|
+
x?: number;
|
|
176
|
+
/** Y轴偏移量,正数向下,负数向上 */
|
|
177
|
+
y?: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
170
180
|
/**
|
|
171
181
|
* `ContextMenu` 组件的 Props
|
|
172
182
|
*/
|
|
@@ -189,6 +199,12 @@ export declare interface ContextMenuProps {
|
|
|
189
199
|
* - 可选 default: 默认大小 | small: 小尺寸 | mini: 迷你尺寸
|
|
190
200
|
*/
|
|
191
201
|
size?: ContextMenuSize;
|
|
202
|
+
/**
|
|
203
|
+
* 菜单位置偏移量
|
|
204
|
+
* - 默认:{ x: 0, y: 0 }
|
|
205
|
+
* - 用于手动调整菜单位置
|
|
206
|
+
*/
|
|
207
|
+
offset?: ContextMenuOffset;
|
|
192
208
|
}
|
|
193
209
|
|
|
194
210
|
export declare type ContextMenuSize = 'default' | 'small' | 'mini';
|
package/dist/index.es.js
CHANGED
|
@@ -421,7 +421,11 @@ var LeftMenu_default = /* @__PURE__ */ defineComponent({
|
|
|
421
421
|
default: !0
|
|
422
422
|
},
|
|
423
423
|
trigger: { default: "context-menu" },
|
|
424
|
-
size: { default: "default" }
|
|
424
|
+
size: { default: "default" },
|
|
425
|
+
offset: { default: () => ({
|
|
426
|
+
x: 0,
|
|
427
|
+
y: 0
|
|
428
|
+
}) }
|
|
425
429
|
},
|
|
426
430
|
emits: [
|
|
427
431
|
"select",
|
|
@@ -438,8 +442,10 @@ var LeftMenu_default = /* @__PURE__ */ defineComponent({
|
|
|
438
442
|
return e.includes("click") && (t.onClick = O), e.includes("context-menu") && (t.onContextmenu = O), t;
|
|
439
443
|
}
|
|
440
444
|
let O = (e) => {
|
|
441
|
-
e.preventDefault(), e.stopPropagation()
|
|
442
|
-
|
|
445
|
+
e.preventDefault(), e.stopPropagation();
|
|
446
|
+
let t = d.offset?.x || 0, n = d.offset?.y || 0, r = e.clientX + t, i = e.clientY + n;
|
|
447
|
+
E.left = r + "px", E.top = i + "px", T.value = !0, nextTick(() => {
|
|
448
|
+
k(r, i);
|
|
443
449
|
}), f("open");
|
|
444
450
|
}, k = (e, t) => {
|
|
445
451
|
if (!w.value) return;
|