@xiaou66/u-web-ui 0.95.0 → 0.97.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 +22 -0
- package/dist/index.es.js +48 -41
- package/dist/resolver.d.ts +26 -0
- package/dist/resolver.es.js +39 -0
- package/package.json +6 -99
package/dist/index.d.ts
CHANGED
|
@@ -96,6 +96,16 @@ export declare interface ContextMenuEmits {
|
|
|
96
96
|
* @param event 触发该选择的原生事件对象
|
|
97
97
|
*/
|
|
98
98
|
(e: 'select', value: any, event: Event): void;
|
|
99
|
+
/**
|
|
100
|
+
* 打开面板事件
|
|
101
|
+
* @param e
|
|
102
|
+
*/
|
|
103
|
+
(e: 'open'): void;
|
|
104
|
+
/**
|
|
105
|
+
* 关闭面板事件
|
|
106
|
+
* @param e
|
|
107
|
+
*/
|
|
108
|
+
(e: 'close'): void;
|
|
99
109
|
}
|
|
100
110
|
|
|
101
111
|
export { ContextMenuGroup }
|
|
@@ -108,6 +118,18 @@ export declare interface ContextMenuGroupProps {
|
|
|
108
118
|
title?: string;
|
|
109
119
|
}
|
|
110
120
|
|
|
121
|
+
export declare interface ContextMenuInstance {
|
|
122
|
+
/**
|
|
123
|
+
* 关闭右键菜单
|
|
124
|
+
*/
|
|
125
|
+
close: () => void;
|
|
126
|
+
/**
|
|
127
|
+
* 打开右键菜单
|
|
128
|
+
* @param event 鼠标事件用于计算菜单位置
|
|
129
|
+
*/
|
|
130
|
+
openContextMenu: (event: MouseEvent) => void;
|
|
131
|
+
}
|
|
132
|
+
|
|
111
133
|
export { ContextMenuItem }
|
|
112
134
|
|
|
113
135
|
/**
|
package/dist/index.es.js
CHANGED
|
@@ -423,67 +423,74 @@ var LeftMenu_default = /* @__PURE__ */ defineComponent({
|
|
|
423
423
|
trigger: { default: "context-menu" },
|
|
424
424
|
size: { default: "default" }
|
|
425
425
|
},
|
|
426
|
-
emits: [
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
emits: [
|
|
427
|
+
"select",
|
|
428
|
+
"open",
|
|
429
|
+
"close"
|
|
430
|
+
],
|
|
431
|
+
setup(r, { expose: c, emit: u }) {
|
|
432
|
+
let d = r, f = u, p = getBuildCurrentClassPrefix("context-menu"), S = ref(), w = ref(), T = ref(!1), E = reactive({
|
|
429
433
|
left: "0px",
|
|
430
434
|
top: "0px"
|
|
431
435
|
});
|
|
432
|
-
function
|
|
433
|
-
let e = Array.isArray(
|
|
434
|
-
return e.includes("click") && (t.onClick =
|
|
436
|
+
function D() {
|
|
437
|
+
let e = Array.isArray(d.trigger) ? d.trigger : [d.trigger], t = {};
|
|
438
|
+
return e.includes("click") && (t.onClick = O), e.includes("context-menu") && (t.onContextmenu = O), t;
|
|
435
439
|
}
|
|
436
|
-
let
|
|
437
|
-
e.preventDefault(), e.stopPropagation(),
|
|
438
|
-
|
|
439
|
-
});
|
|
440
|
-
},
|
|
441
|
-
if (!S.value) return;
|
|
442
|
-
let n = S.value.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = e, o = t;
|
|
443
|
-
e + n.width > r && (a = r - n.width - 4), t + n.height > i && (o = i - n.height - 4), a = Math.max(4, a), o = Math.max(4, o), T.left = a + "px", T.top = o + "px";
|
|
444
|
-
}, k = () => {
|
|
445
|
-
w.value = !1;
|
|
446
|
-
}, A = (e, t) => {
|
|
447
|
-
d("select", e, t), u.hideOnSelect && (w.value = !1);
|
|
448
|
-
}, j = (e) => {
|
|
440
|
+
let O = (e) => {
|
|
441
|
+
e.preventDefault(), e.stopPropagation(), E.left = e.clientX + "px", E.top = e.clientY + "px", T.value = !0, nextTick(() => {
|
|
442
|
+
k(e.clientX, e.clientY);
|
|
443
|
+
}), f("open");
|
|
444
|
+
}, k = (e, t) => {
|
|
449
445
|
if (!w.value) return;
|
|
450
|
-
let
|
|
446
|
+
let n = w.value.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = e, o = t;
|
|
447
|
+
e + n.width > r && (a = r - n.width - 4), t + n.height > i && (o = i - n.height - 4), a = Math.max(4, a), o = Math.max(4, o), E.left = a + "px", E.top = o + "px";
|
|
448
|
+
}, A = () => {
|
|
449
|
+
T.value = !1;
|
|
450
|
+
}, j = (e, t) => {
|
|
451
|
+
f("select", e, t), d.hideOnSelect && (T.value = !1);
|
|
452
|
+
}, M = (e) => {
|
|
453
|
+
if (!T.value) return;
|
|
454
|
+
let t = e.target, n = w.value, r = S.value;
|
|
451
455
|
if (e.button === 2 || e.which === 3) return;
|
|
452
456
|
let i = n && n.contains(t), a = r && r.contains(t);
|
|
453
|
-
!i && !a && (
|
|
454
|
-
}, M = (e) => {
|
|
455
|
-
e.key === "Escape" && w.value && (w.value = !1);
|
|
457
|
+
!i && !a && (T.value = !1);
|
|
456
458
|
}, F = (e) => {
|
|
457
|
-
|
|
459
|
+
e.key === "Escape" && T.value && (T.value = !1);
|
|
460
|
+
}, I = (e) => {
|
|
461
|
+
T.value && (e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation());
|
|
462
|
+
}, L = () => {
|
|
463
|
+
T.value = !1, f("close");
|
|
458
464
|
};
|
|
459
|
-
return provide("handleSelect",
|
|
460
|
-
|
|
461
|
-
}), onMounted(() => {
|
|
462
|
-
document.addEventListener("click", j), document.addEventListener("mousedown", j), document.addEventListener("keydown", M), document.addEventListener("contextmenu", F);
|
|
465
|
+
return provide("handleSelect", j), provide("closeMenu", L), onMounted(() => {
|
|
466
|
+
document.addEventListener("click", M), document.addEventListener("mousedown", M), document.addEventListener("keydown", F), document.addEventListener("contextmenu", I);
|
|
463
467
|
}), onUnmounted(() => {
|
|
464
|
-
document.removeEventListener("click",
|
|
468
|
+
document.removeEventListener("click", M), document.removeEventListener("mousedown", M), document.removeEventListener("keydown", F), document.removeEventListener("contextmenu", I);
|
|
469
|
+
}), c({
|
|
470
|
+
close: L,
|
|
471
|
+
openContextMenu: O
|
|
465
472
|
}), (r, c) => (openBlock(), createElementBlock(Fragment, null, [
|
|
466
473
|
createElementVNode("div", mergeProps({
|
|
467
474
|
ref_key: "triggerRef",
|
|
468
|
-
ref:
|
|
469
|
-
class: unref(
|
|
470
|
-
}, { ...
|
|
471
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(Transition, { name: unref(
|
|
472
|
-
default: withCtx(() => [
|
|
475
|
+
ref: S,
|
|
476
|
+
class: unref(p)("trigger")
|
|
477
|
+
}, { ...D() }), [renderSlot(r.$slots, "default")], 16),
|
|
478
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(Transition, { name: unref(p)("menu-transition") }, {
|
|
479
|
+
default: withCtx(() => [T.value ? (openBlock(), createElementBlock("div", {
|
|
473
480
|
key: 0,
|
|
474
481
|
ref_key: "menuRef",
|
|
475
|
-
ref:
|
|
476
|
-
class: normalizeClass([unref(
|
|
477
|
-
style: normalizeStyle(
|
|
482
|
+
ref: w,
|
|
483
|
+
class: normalizeClass([unref(p)("menu"), unref(p)(`menu-${d.size}`)]),
|
|
484
|
+
style: normalizeStyle(E),
|
|
478
485
|
onContextmenu: c[0] ||= withModifiers(() => {}, ["prevent"])
|
|
479
486
|
}, [renderSlot(r.$slots, "content")], 38)) : createCommentVNode("", !0)]),
|
|
480
487
|
_: 3
|
|
481
488
|
}, 8, ["name"])])),
|
|
482
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
489
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [T.value ? (openBlock(), createElementBlock("div", {
|
|
483
490
|
key: 0,
|
|
484
|
-
class: normalizeClass(unref(
|
|
485
|
-
onClick:
|
|
486
|
-
onContextmenu: withModifiers(
|
|
491
|
+
class: normalizeClass(unref(p)("mask")),
|
|
492
|
+
onClick: A,
|
|
493
|
+
onContextmenu: withModifiers(A, ["prevent"])
|
|
487
494
|
}, null, 34)) : createCommentVNode("", !0)]))
|
|
488
495
|
], 64));
|
|
489
496
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentResolver } from 'unplugin-vue-components';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Xiaou 组件库解析器
|
|
5
|
+
*/
|
|
6
|
+
export declare function XiaouResolver(options?: XiaouResolverOptions): ComponentResolver;
|
|
7
|
+
|
|
8
|
+
export declare interface XiaouResolverOptions {
|
|
9
|
+
/**
|
|
10
|
+
* 组件前缀
|
|
11
|
+
* @default 'X'
|
|
12
|
+
*/
|
|
13
|
+
prefix?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 包名称
|
|
16
|
+
* @default '@xiaou66/u-web-ui'
|
|
17
|
+
*/
|
|
18
|
+
packageName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* 组件目录
|
|
21
|
+
* @default 'components'
|
|
22
|
+
*/
|
|
23
|
+
componentsDir?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var COMPONENT_MAP = {
|
|
2
|
+
BackTop: { path: "components/BackTop" },
|
|
3
|
+
PageHeader: { path: "components/PageHeader" },
|
|
4
|
+
Result: { path: "components/Result" },
|
|
5
|
+
Scrollbar: { path: "components/Scrollbar" },
|
|
6
|
+
TimeSelect: { path: "components/TimeSelect" },
|
|
7
|
+
WebLayout: { path: "components/layout/WebLayout" },
|
|
8
|
+
WebBaseLayout: { path: "components/layout/WebLayout" },
|
|
9
|
+
UtoolsLayout: { path: "components/layout/UtoolsLayout" },
|
|
10
|
+
UtoolsBaseLayout: { path: "components/layout/UtoolsLayout" },
|
|
11
|
+
SplitPanel: { path: "components/layout/SplitPanel" },
|
|
12
|
+
LeftMenu: { path: "components/menu/LeftMenu" },
|
|
13
|
+
ContextMenu: { path: "components/menu/ContextMenu" },
|
|
14
|
+
ContextMenuItem: { path: "components/menu/ContextMenu" },
|
|
15
|
+
ContextMenuGroup: { path: "components/menu/ContextMenu" },
|
|
16
|
+
ContextMenuDivider: { path: "components/menu/ContextMenu" },
|
|
17
|
+
ContextMenuSubmenu: { path: "components/menu/ContextMenu" },
|
|
18
|
+
Setting: { path: "components/Setting" },
|
|
19
|
+
SettingItem: { path: "components/Setting/SettingItem" },
|
|
20
|
+
SettingGroup: { path: "components/Setting/SettingGroup" },
|
|
21
|
+
SettingDivision: { path: "components/Setting/SettingDivision" },
|
|
22
|
+
SwitchPlus: { path: "components/switch/SwitchPlus" },
|
|
23
|
+
SwitchPlusEnable: { path: "components/switch/SwitchPlus" },
|
|
24
|
+
LazyLoader: { path: "components/container/LazyLoader" }
|
|
25
|
+
};
|
|
26
|
+
function XiaouResolver(t = {}) {
|
|
27
|
+
let { prefix: n = "", packageName: r = "@xiaou66/u-web-ui", componentsDir: i = "components" } = t;
|
|
28
|
+
return {
|
|
29
|
+
type: "component",
|
|
30
|
+
resolve: (t) => {
|
|
31
|
+
let i = n && t.startsWith(n) ? t.slice(n.length) : t;
|
|
32
|
+
if (COMPONENT_MAP[i]) return {
|
|
33
|
+
name: n && t.startsWith(n) ? i.charAt(0).toUpperCase() + i.slice(1) : i,
|
|
34
|
+
from: r
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export { XiaouResolver };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaou66/u-web-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"description": "web-ui",
|
|
5
5
|
"main": "./dist/index.es.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -54,104 +54,11 @@
|
|
|
54
54
|
"require": "./dist/index.cjs.js",
|
|
55
55
|
"default": "./dist/index.es.js"
|
|
56
56
|
},
|
|
57
|
-
"./
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"import": "./dist/components/BackTop/index.es.js",
|
|
62
|
-
"default": "./dist/components/BackTop/index.es.js"
|
|
57
|
+
"./resolver": {
|
|
58
|
+
"types": "./dist/resolver.d.ts",
|
|
59
|
+
"import": "./dist/resolver.es.js",
|
|
60
|
+
"default": "./dist/resolver.es.js"
|
|
63
61
|
},
|
|
64
|
-
"./
|
|
65
|
-
"types": "./dist/components/PageHeader/index.d.ts",
|
|
66
|
-
"import": "./dist/components/PageHeader/index.es.js",
|
|
67
|
-
"default": "./dist/components/PageHeader/index.es.js"
|
|
68
|
-
},
|
|
69
|
-
"./components/Result": {
|
|
70
|
-
"types": "./dist/components/Result/index.d.ts",
|
|
71
|
-
"import": "./dist/components/Result/index.es.js",
|
|
72
|
-
"default": "./dist/components/Result/index.es.js"
|
|
73
|
-
},
|
|
74
|
-
"./components/Scrollbar": {
|
|
75
|
-
"types": "./dist/components/Scrollbar/index.d.ts",
|
|
76
|
-
"import": "./dist/components/Scrollbar/index.es.js",
|
|
77
|
-
"default": "./dist/components/Scrollbar/index.es.js"
|
|
78
|
-
},
|
|
79
|
-
"./components/TimeSelect": {
|
|
80
|
-
"types": "./dist/components/TimeSelect/index.d.ts",
|
|
81
|
-
"import": "./dist/components/TimeSelect/index.es.js",
|
|
82
|
-
"default": "./dist/components/TimeSelect/index.es.js"
|
|
83
|
-
},
|
|
84
|
-
"./components/layout/WebLayout": {
|
|
85
|
-
"types": "./dist/components/layout/WebLayout/index.d.ts",
|
|
86
|
-
"import": "./dist/components/layout/WebLayout/index.es.js",
|
|
87
|
-
"default": "./dist/components/layout/WebLayout/index.es.js"
|
|
88
|
-
},
|
|
89
|
-
"./components/layout/UtoolsLayout": {
|
|
90
|
-
"types": "./dist/components/layout/UtoolsLayout/index.d.ts",
|
|
91
|
-
"import": "./dist/components/layout/UtoolsLayout/index.es.js",
|
|
92
|
-
"default": "./dist/components/layout/UtoolsLayout/index.es.js"
|
|
93
|
-
},
|
|
94
|
-
"./components/layout/SplitPanel": {
|
|
95
|
-
"types": "./dist/components/layout/SplitPanel/index.d.ts",
|
|
96
|
-
"import": "./dist/components/layout/SplitPanel/index.es.js",
|
|
97
|
-
"default": "./dist/components/layout/SplitPanel/index.es.js"
|
|
98
|
-
},
|
|
99
|
-
"./components/menu/LeftMenu": {
|
|
100
|
-
"types": "./dist/components/menu/LeftMenu/index.d.ts",
|
|
101
|
-
"import": "./dist/components/menu/LeftMenu/index.es.js",
|
|
102
|
-
"default": "./dist/components/menu/LeftMenu/index.es.js"
|
|
103
|
-
},
|
|
104
|
-
"./components/menu/ContextMenu": {
|
|
105
|
-
"types": "./dist/components/menu/ContextMenu/index.d.ts",
|
|
106
|
-
"import": "./dist/components/menu/ContextMenu/index.es.js",
|
|
107
|
-
"default": "./dist/components/menu/ContextMenu/index.es.js"
|
|
108
|
-
},
|
|
109
|
-
"./components/Setting": {
|
|
110
|
-
"types": "./dist/components/Setting/index.d.ts",
|
|
111
|
-
"import": "./dist/components/Setting/index.es.js",
|
|
112
|
-
"default": "./dist/components/Setting/index.es.js"
|
|
113
|
-
},
|
|
114
|
-
"./components/Setting/SettingItem": {
|
|
115
|
-
"types": "./dist/components/Setting/SettingItem/index.d.ts",
|
|
116
|
-
"import": "./dist/components/Setting/SettingItem/index.es.js",
|
|
117
|
-
"default": "./dist/components/Setting/SettingItem/index.es.js"
|
|
118
|
-
},
|
|
119
|
-
"./components/Setting/SettingGroup": {
|
|
120
|
-
"types": "./dist/components/Setting/SettingGroup/index.d.ts",
|
|
121
|
-
"import": "./dist/components/Setting/SettingGroup/index.es.js",
|
|
122
|
-
"default": "./dist/components/Setting/SettingGroup/index.es.js"
|
|
123
|
-
},
|
|
124
|
-
"./components/Setting/SettingDivision": {
|
|
125
|
-
"types": "./dist/components/Setting/SettingDivision/index.d.ts",
|
|
126
|
-
"import": "./dist/components/Setting/SettingDivision/index.es.js",
|
|
127
|
-
"default": "./dist/components/Setting/SettingDivision/index.es.js"
|
|
128
|
-
},
|
|
129
|
-
"./components/switch/SwitchPlus": {
|
|
130
|
-
"types": "./dist/components/switch/SwitchPlus/index.d.ts",
|
|
131
|
-
"import": "./dist/components/switch/SwitchPlus/index.es.js",
|
|
132
|
-
"default": "./dist/components/switch/SwitchPlus/index.es.js"
|
|
133
|
-
},
|
|
134
|
-
"./components/container/LazyLoader": {
|
|
135
|
-
"types": "./dist/components/container/LazyLoader/index.d.ts",
|
|
136
|
-
"import": "./dist/components/container/LazyLoader/index.es.js",
|
|
137
|
-
"default": "./dist/components/container/LazyLoader/index.es.js"
|
|
138
|
-
},
|
|
139
|
-
"./components/BackTop/styles": "./dist/components/BackTop/styles.css",
|
|
140
|
-
"./components/PageHeader/styles": "./dist/components/PageHeader/styles.css",
|
|
141
|
-
"./components/Result/styles": "./dist/components/Result/styles.css",
|
|
142
|
-
"./components/Scrollbar/styles": "./dist/components/Scrollbar/styles.css",
|
|
143
|
-
"./components/TimeSelect/styles": "./dist/components/TimeSelect/styles.css",
|
|
144
|
-
"./components/layout/WebLayout/styles": "./dist/components/layout/WebLayout/styles.css",
|
|
145
|
-
"./components/layout/UtoolsLayout/styles": "./dist/components/layout/UtoolsLayout/styles.css",
|
|
146
|
-
"./components/layout/SplitPanel/styles": "./dist/components/layout/SplitPanel/styles.css",
|
|
147
|
-
"./components/menu/ContextMenu/styles": "./dist/components/menu/ContextMenu/styles.css",
|
|
148
|
-
"./components/Setting/SettingItem/styles": "./dist/components/Setting/SettingItem/styles.css",
|
|
149
|
-
"./components/Setting/SettingGroup/styles": "./dist/components/Setting/SettingGroup/styles.css",
|
|
150
|
-
"./components/Setting/SettingDivision/styles": "./dist/components/Setting/SettingDivision/styles.css",
|
|
151
|
-
"./components/switch/SwitchPlus/styles": "./dist/components/switch/SwitchPlus/styles.css",
|
|
152
|
-
"./components/container/LazyLoader/styles": "./dist/components/container/LazyLoader/styles.css",
|
|
153
|
-
"./dist/style.css": "./dist/style.css",
|
|
154
|
-
"./dist/u-web-ui.css": "./dist/u-web-ui.css",
|
|
155
|
-
"./package.json": "./package.json"
|
|
62
|
+
"./dist/u-web-ui.css": "./dist/u-web-ui.css"
|
|
156
63
|
}
|
|
157
64
|
}
|