layplux 0.0.1
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/cjs/components/center-view/index.cjs +41 -0
- package/dist/cjs/components/corner-glow/index.cjs +31 -0
- package/dist/cjs/components/dropdown/index.cjs +162 -0
- package/dist/cjs/components/icon/index.cjs +59 -0
- package/dist/cjs/components/index.cjs +25 -0
- package/dist/cjs/components/panel-view/index.cjs +166 -0
- package/dist/cjs/components/popup/index.cjs +280 -0
- package/dist/cjs/components/title/index.cjs +76 -0
- package/dist/cjs/components/tooltip/index.cjs +68 -0
- package/dist/cjs/components/widget/index.cjs +104 -0
- package/dist/cjs/index.cjs +40 -0
- package/dist/cjs/layout/glass-overlay.cjs +31 -0
- package/dist/cjs/layout/layered-manager.cjs +35 -0
- package/dist/cjs/layout/layplux.cjs +41 -0
- package/dist/cjs/layout/root-pane.cjs +46 -0
- package/dist/cjs/layout/skeleton/bottom-area.cjs +64 -0
- package/dist/cjs/layout/skeleton/bottom-left-area.cjs +42 -0
- package/dist/cjs/layout/skeleton/bottom-right-area.cjs +38 -0
- package/dist/cjs/layout/skeleton/center-area.cjs +467 -0
- package/dist/cjs/layout/skeleton/index.cjs +24 -0
- package/dist/cjs/layout/skeleton/left-bottom-area.cjs +42 -0
- package/dist/cjs/layout/skeleton/left-top-area.cjs +42 -0
- package/dist/cjs/layout/skeleton/right-bottom-area.cjs +38 -0
- package/dist/cjs/layout/skeleton/right-top-area.cjs +38 -0
- package/dist/cjs/layout/skeleton/skeleton.cjs +66 -0
- package/dist/cjs/layout/skeleton/top-area.cjs +64 -0
- package/dist/cjs/locales/en-US.cjs +34 -0
- package/dist/cjs/locales/index.cjs +39 -0
- package/dist/cjs/locales/zh-CN.cjs +34 -0
- package/dist/cjs/managers/area.cjs +32 -0
- package/dist/cjs/managers/index.cjs +20 -0
- package/dist/cjs/managers/pane.cjs +34 -0
- package/dist/cjs/managers/skeleton.cjs +208 -0
- package/dist/cjs/managers/theme.cjs +37 -0
- package/dist/cjs/managers/widget-container.cjs +96 -0
- package/dist/cjs/managers/widget.cjs +103 -0
- package/dist/cjs/types/config.cjs +16 -0
- package/dist/cjs/types/index.cjs +18 -0
- package/dist/cjs/types/locale.cjs +16 -0
- package/dist/cjs/utils/event-bus.cjs +154 -0
- package/dist/cjs/utils/focus-tracker.cjs +154 -0
- package/dist/cjs/utils/index.cjs +31 -0
- package/dist/cjs/utils/unique-id.cjs +27 -0
- package/dist/cjs/utils/vue.cjs +37 -0
- package/dist/esm/components/center-view/index.mjs +21 -0
- package/dist/esm/components/corner-glow/index.mjs +11 -0
- package/dist/esm/components/dropdown/index.mjs +146 -0
- package/dist/esm/components/icon/index.mjs +39 -0
- package/dist/esm/components/index.mjs +8 -0
- package/dist/esm/components/panel-view/index.mjs +152 -0
- package/dist/esm/components/popup/index.mjs +268 -0
- package/dist/esm/components/title/index.mjs +56 -0
- package/dist/esm/components/tooltip/index.mjs +48 -0
- package/dist/esm/components/widget/index.mjs +84 -0
- package/dist/esm/index.mjs +10 -0
- package/dist/esm/layout/glass-overlay.mjs +11 -0
- package/dist/esm/layout/layered-manager.mjs +15 -0
- package/dist/esm/layout/layplux.mjs +21 -0
- package/dist/esm/layout/root-pane.mjs +26 -0
- package/dist/esm/layout/skeleton/bottom-area.mjs +44 -0
- package/dist/esm/layout/skeleton/bottom-left-area.mjs +22 -0
- package/dist/esm/layout/skeleton/bottom-right-area.mjs +18 -0
- package/dist/esm/layout/skeleton/center-area.mjs +454 -0
- package/dist/esm/layout/skeleton/index.mjs +4 -0
- package/dist/esm/layout/skeleton/left-bottom-area.mjs +22 -0
- package/dist/esm/layout/skeleton/left-top-area.mjs +22 -0
- package/dist/esm/layout/skeleton/right-bottom-area.mjs +18 -0
- package/dist/esm/layout/skeleton/right-top-area.mjs +18 -0
- package/dist/esm/layout/skeleton/skeleton.mjs +46 -0
- package/dist/esm/layout/skeleton/top-area.mjs +44 -0
- package/dist/esm/locales/en-US.mjs +14 -0
- package/dist/esm/locales/index.mjs +19 -0
- package/dist/esm/locales/zh-CN.mjs +14 -0
- package/dist/esm/managers/area.mjs +12 -0
- package/dist/esm/managers/index.mjs +3 -0
- package/dist/esm/managers/pane.mjs +14 -0
- package/dist/esm/managers/skeleton.mjs +192 -0
- package/dist/esm/managers/theme.mjs +17 -0
- package/dist/esm/managers/widget-container.mjs +76 -0
- package/dist/esm/managers/widget.mjs +83 -0
- package/dist/esm/types/config.mjs +0 -0
- package/dist/esm/types/index.mjs +1 -0
- package/dist/esm/types/locale.mjs +0 -0
- package/dist/esm/utils/event-bus.mjs +124 -0
- package/dist/esm/utils/focus-tracker.mjs +135 -0
- package/dist/esm/utils/index.mjs +10 -0
- package/dist/esm/utils/unique-id.mjs +7 -0
- package/dist/esm/utils/vue.mjs +17 -0
- package/dist/style/base/_tokens-dark.scss +51 -0
- package/dist/style/base/_tokens.scss +56 -0
- package/dist/style/components/_bottom-area.scss +30 -0
- package/dist/style/components/_bottom-left-area.scss +8 -0
- package/dist/style/components/_bottom-right-area.scss +8 -0
- package/dist/style/components/_center-area.scss +162 -0
- package/dist/style/components/_corner-glow.scss +17 -0
- package/dist/style/components/_dropdown.scss +91 -0
- package/dist/style/components/_glass-pane.scss +6 -0
- package/dist/style/components/_layered-manager.scss +6 -0
- package/dist/style/components/_left-bottom-area.scss +8 -0
- package/dist/style/components/_left-top-area.scss +9 -0
- package/dist/style/components/_pane-view.scss +79 -0
- package/dist/style/components/_popup.scss +19 -0
- package/dist/style/components/_right-bottom-area.scss +8 -0
- package/dist/style/components/_right-top-area.scss +8 -0
- package/dist/style/components/_root-pane.scss +17 -0
- package/dist/style/components/_skeleton.scss +38 -0
- package/dist/style/components/_title-view.scss +176 -0
- package/dist/style/components/_tooltip.scss +65 -0
- package/dist/style/components/_top-area.scss +25 -0
- package/dist/style/index.css +768 -0
- package/dist/style/layplux.scss +21 -0
- package/dist/types/components/center-view/index.d.ts +16 -0
- package/dist/types/components/center-view/index.d.ts.map +1 -0
- package/dist/types/components/corner-glow/index.d.ts +2 -0
- package/dist/types/components/corner-glow/index.d.ts.map +1 -0
- package/dist/types/components/dropdown/index.d.ts +116 -0
- package/dist/types/components/dropdown/index.d.ts.map +1 -0
- package/dist/types/components/icon/index.d.ts +22 -0
- package/dist/types/components/icon/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +9 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components/panel-view/index.d.ts +22 -0
- package/dist/types/components/panel-view/index.d.ts.map +1 -0
- package/dist/types/components/popup/index.d.ts +99 -0
- package/dist/types/components/popup/index.d.ts.map +1 -0
- package/dist/types/components/title/index.d.ts +57 -0
- package/dist/types/components/title/index.d.ts.map +1 -0
- package/dist/types/components/tooltip/index.d.ts +69 -0
- package/dist/types/components/tooltip/index.d.ts.map +1 -0
- package/dist/types/components/widget/index.d.ts +15 -0
- package/dist/types/components/widget/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/layout/glass-overlay.d.ts +2 -0
- package/dist/types/layout/glass-overlay.d.ts.map +1 -0
- package/dist/types/layout/layered-manager.d.ts +8 -0
- package/dist/types/layout/layered-manager.d.ts.map +1 -0
- package/dist/types/layout/layplux.d.ts +25 -0
- package/dist/types/layout/layplux.d.ts.map +1 -0
- package/dist/types/layout/root-pane.d.ts +8 -0
- package/dist/types/layout/root-pane.d.ts.map +1 -0
- package/dist/types/layout/skeleton/bottom-area.d.ts +9 -0
- package/dist/types/layout/skeleton/bottom-area.d.ts.map +1 -0
- package/dist/types/layout/skeleton/bottom-left-area.d.ts +9 -0
- package/dist/types/layout/skeleton/bottom-left-area.d.ts.map +1 -0
- package/dist/types/layout/skeleton/bottom-right-area.d.ts +9 -0
- package/dist/types/layout/skeleton/bottom-right-area.d.ts.map +1 -0
- package/dist/types/layout/skeleton/center-area.d.ts +11 -0
- package/dist/types/layout/skeleton/center-area.d.ts.map +1 -0
- package/dist/types/layout/skeleton/index.d.ts +2 -0
- package/dist/types/layout/skeleton/index.d.ts.map +1 -0
- package/dist/types/layout/skeleton/left-bottom-area.d.ts +9 -0
- package/dist/types/layout/skeleton/left-bottom-area.d.ts.map +1 -0
- package/dist/types/layout/skeleton/left-top-area.d.ts +9 -0
- package/dist/types/layout/skeleton/left-top-area.d.ts.map +1 -0
- package/dist/types/layout/skeleton/right-bottom-area.d.ts +9 -0
- package/dist/types/layout/skeleton/right-bottom-area.d.ts.map +1 -0
- package/dist/types/layout/skeleton/right-top-area.d.ts +9 -0
- package/dist/types/layout/skeleton/right-top-area.d.ts.map +1 -0
- package/dist/types/layout/skeleton/skeleton.d.ts +8 -0
- package/dist/types/layout/skeleton/skeleton.d.ts.map +1 -0
- package/dist/types/layout/skeleton/top-area.d.ts +9 -0
- package/dist/types/layout/skeleton/top-area.d.ts.map +1 -0
- package/dist/types/locales/en-US.d.ts +3 -0
- package/dist/types/locales/en-US.d.ts.map +1 -0
- package/dist/types/locales/index.d.ts +7 -0
- package/dist/types/locales/index.d.ts.map +1 -0
- package/dist/types/locales/zh-CN.d.ts +3 -0
- package/dist/types/locales/zh-CN.d.ts.map +1 -0
- package/dist/types/managers/area.d.ts +10 -0
- package/dist/types/managers/area.d.ts.map +1 -0
- package/dist/types/managers/index.d.ts +5 -0
- package/dist/types/managers/index.d.ts.map +1 -0
- package/dist/types/managers/pane.d.ts +8 -0
- package/dist/types/managers/pane.d.ts.map +1 -0
- package/dist/types/managers/skeleton.d.ts +38 -0
- package/dist/types/managers/skeleton.d.ts.map +1 -0
- package/dist/types/managers/theme.d.ts +2 -0
- package/dist/types/managers/theme.d.ts.map +1 -0
- package/dist/types/managers/widget-container.d.ts +21 -0
- package/dist/types/managers/widget-container.d.ts.map +1 -0
- package/dist/types/managers/widget.d.ts +26 -0
- package/dist/types/managers/widget.d.ts.map +1 -0
- package/dist/types/types/config.d.ts +54 -0
- package/dist/types/types/config.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/locale.d.ts +12 -0
- package/dist/types/types/locale.d.ts.map +1 -0
- package/dist/types/utils/event-bus.d.ts +18 -0
- package/dist/types/utils/event-bus.d.ts.map +1 -0
- package/dist/types/utils/focus-tracker.d.ts +37 -0
- package/dist/types/utils/focus-tracker.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/unique-id.d.ts +2 -0
- package/dist/types/utils/unique-id.d.ts.map +1 -0
- package/dist/types/utils/vue.d.ts +5 -0
- package/dist/types/utils/vue.d.ts.map +1 -0
- package/dist/umd/index.js +4000 -0
- package/package.json +46 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
+
var focus_tracker_exports = {};
|
|
22
|
+
__export(focus_tracker_exports, {
|
|
23
|
+
FocusTracker: () => FocusTracker,
|
|
24
|
+
Focusable: () => Focusable
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(focus_tracker_exports);
|
|
27
|
+
class FocusTracker {
|
|
28
|
+
constructor() {
|
|
29
|
+
/** 焦点栈,栈顶为当前聚焦项 */
|
|
30
|
+
__publicField(this, "actives", []);
|
|
31
|
+
/** modal 弹层注册表,用于检查是否有 modal 正在打开 */
|
|
32
|
+
__publicField(this, "modals", []);
|
|
33
|
+
}
|
|
34
|
+
/** 当前焦点栈顶 */
|
|
35
|
+
get first() {
|
|
36
|
+
return this.actives[0];
|
|
37
|
+
}
|
|
38
|
+
/** 注册一个 modal 弹层,用于 execSave 等时判断是否跳过 */
|
|
39
|
+
addModal(checkDown, checkOpen) {
|
|
40
|
+
this.modals.push({ checkDown, checkOpen });
|
|
41
|
+
}
|
|
42
|
+
/** 是否有 modal 弹层正在打开 */
|
|
43
|
+
checkModalOpen() {
|
|
44
|
+
return this.modals.some((item) => item.checkOpen());
|
|
45
|
+
}
|
|
46
|
+
/** 触发保存操作,有 modal 时跳过 */
|
|
47
|
+
execSave() {
|
|
48
|
+
if (this.checkModalOpen()) return;
|
|
49
|
+
if (this.first) this.first.internalTriggerSave();
|
|
50
|
+
}
|
|
51
|
+
/** 触发 ESC — 挂起栈顶并调用其 onEsc */
|
|
52
|
+
execEsc() {
|
|
53
|
+
const { first } = this;
|
|
54
|
+
if (first) {
|
|
55
|
+
this.internalSuspenseItem(first);
|
|
56
|
+
first.internalTriggerEsc();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 挂载全局点击监听
|
|
61
|
+
* 点击 document 时,如果点击目标不在 first 的 range 内,则挂起 first 并触发 blur
|
|
62
|
+
* @returns 卸载函数
|
|
63
|
+
*/
|
|
64
|
+
mount(win) {
|
|
65
|
+
const checkDown = (e) => {
|
|
66
|
+
const { first } = this;
|
|
67
|
+
if (first && !first.internalCheckInRange(e)) {
|
|
68
|
+
this.internalSuspenseItem(first);
|
|
69
|
+
first.internalTriggerBlur();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
win.document.addEventListener("click", checkDown, true);
|
|
73
|
+
return () => win.document.removeEventListener("click", checkDown, true);
|
|
74
|
+
}
|
|
75
|
+
/** 创建一个 Focusable 实例并绑定到当前 tracker */
|
|
76
|
+
create(config) {
|
|
77
|
+
return new Focusable(this, config);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 激活一个 Focusable — 将其推到栈顶
|
|
81
|
+
* 如果栈顶已有其他 Focusable 且新项不是 modal,则先触发旧栈顶的 blur
|
|
82
|
+
*/
|
|
83
|
+
internalActiveItem(item) {
|
|
84
|
+
const first = this.actives[0];
|
|
85
|
+
if (first === item) return;
|
|
86
|
+
const i = this.actives.indexOf(item);
|
|
87
|
+
if (i > -1) this.actives.splice(i, 1);
|
|
88
|
+
this.actives.unshift(item);
|
|
89
|
+
if (!item.isModal && first) first.internalTriggerBlur();
|
|
90
|
+
item.internalTriggerActive();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 挂起一个 Focusable — 将其从栈中移除
|
|
94
|
+
* 移除后如果还有剩余项,激活新的栈顶
|
|
95
|
+
*/
|
|
96
|
+
internalSuspenseItem(item) {
|
|
97
|
+
const i = this.actives.indexOf(item);
|
|
98
|
+
if (i > -1) {
|
|
99
|
+
this.actives.splice(i, 1);
|
|
100
|
+
this.first?.internalTriggerActive();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
class Focusable {
|
|
105
|
+
constructor(tracker, config) {
|
|
106
|
+
this.tracker = tracker;
|
|
107
|
+
this.config = config;
|
|
108
|
+
__publicField(this, "isModal");
|
|
109
|
+
this.isModal = config.modal ?? false;
|
|
110
|
+
}
|
|
111
|
+
/** 激活当前 Focusable,推入焦点栈顶 */
|
|
112
|
+
active() {
|
|
113
|
+
this.tracker.internalActiveItem(this);
|
|
114
|
+
}
|
|
115
|
+
/** 挂起当前 Focusable,从焦点栈移除 */
|
|
116
|
+
suspense() {
|
|
117
|
+
this.tracker.internalSuspenseItem(this);
|
|
118
|
+
}
|
|
119
|
+
/** 销毁当前 Focusable(同 suspense,语义化别名) */
|
|
120
|
+
purge() {
|
|
121
|
+
this.tracker.internalSuspenseItem(this);
|
|
122
|
+
}
|
|
123
|
+
/** 挂载后把真实 DOM 注入,使 range 的 contains 判断生效 */
|
|
124
|
+
setRange(range) {
|
|
125
|
+
this.config.range = range;
|
|
126
|
+
}
|
|
127
|
+
/** 检查点击事件是否在 range 范围内 */
|
|
128
|
+
internalCheckInRange(e) {
|
|
129
|
+
const { range } = this.config;
|
|
130
|
+
if (!range) return false;
|
|
131
|
+
if (typeof range === "function") return range(e);
|
|
132
|
+
return range.contains(e.target);
|
|
133
|
+
}
|
|
134
|
+
/** 触发失焦回调 */
|
|
135
|
+
internalTriggerBlur() {
|
|
136
|
+
this.config.onBlur?.();
|
|
137
|
+
}
|
|
138
|
+
/** 触发保存回调,返回 true 表示已处理 */
|
|
139
|
+
internalTriggerSave() {
|
|
140
|
+
if (this.config.onSave) {
|
|
141
|
+
this.config.onSave();
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
/** 触发 ESC 回调 */
|
|
147
|
+
internalTriggerEsc() {
|
|
148
|
+
this.config.onEsc?.();
|
|
149
|
+
}
|
|
150
|
+
/** 触发激活回调 */
|
|
151
|
+
internalTriggerActive() {
|
|
152
|
+
this.config.onActive?.();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
enUS: () => import_locales.enUS,
|
|
23
|
+
getBuiltInLocale: () => import_locales.getBuiltInLocale,
|
|
24
|
+
zhCN: () => import_locales.zhCN
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
__reExport(utils_exports, require("./vue"), module.exports);
|
|
28
|
+
__reExport(utils_exports, require("./unique-id"), module.exports);
|
|
29
|
+
__reExport(utils_exports, require("./focus-tracker"), module.exports);
|
|
30
|
+
__reExport(utils_exports, require("./event-bus"), module.exports);
|
|
31
|
+
var import_locales = require("../locales");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var unique_id_exports = {};
|
|
20
|
+
__export(unique_id_exports, {
|
|
21
|
+
uniqueId: () => uniqueId
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(unique_id_exports);
|
|
24
|
+
let guid = Date.now();
|
|
25
|
+
function uniqueId(prefix = "") {
|
|
26
|
+
return `${prefix}${(guid++).toString(36).toLowerCase()}`;
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var vue_exports = {};
|
|
20
|
+
__export(vue_exports, {
|
|
21
|
+
createContent: () => createContent
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(vue_exports);
|
|
24
|
+
var import_vue = require("vue");
|
|
25
|
+
function createContent(content, extraProps = {}) {
|
|
26
|
+
if (!content) return null;
|
|
27
|
+
if ((0, import_vue.isVNode)(content)) {
|
|
28
|
+
return (0, import_vue.cloneVNode)(content, extraProps);
|
|
29
|
+
}
|
|
30
|
+
if (typeof content === "string") {
|
|
31
|
+
if (Object.keys(extraProps).length > 0) {
|
|
32
|
+
return (0, import_vue.h)(content, extraProps, content);
|
|
33
|
+
}
|
|
34
|
+
return (0, import_vue.h)(import_vue.Text, null, content);
|
|
35
|
+
}
|
|
36
|
+
return (0, import_vue.h)(content, extraProps);
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "vue/jsx-runtime";
|
|
2
|
+
import { defineComponent, Teleport } from "vue";
|
|
3
|
+
const CenterView = defineComponent({
|
|
4
|
+
name: "CenterView",
|
|
5
|
+
props: {
|
|
6
|
+
widget: Object,
|
|
7
|
+
anchor: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
setup(props) {
|
|
13
|
+
return () => {
|
|
14
|
+
if (!props.widget) return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(Teleport, { defer: true, to: props.anchor, children: props.widget.renderContent() });
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
CenterView
|
|
21
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "vue/jsx-runtime";
|
|
2
|
+
import { defineComponent } from "vue";
|
|
3
|
+
const CornerGlow = defineComponent({
|
|
4
|
+
name: "CornerGlow",
|
|
5
|
+
setup() {
|
|
6
|
+
return () => /* @__PURE__ */ jsx("div", { class: "corner-glow" });
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
CornerGlow
|
|
11
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsx, jsxs } from "vue/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
provide,
|
|
5
|
+
inject
|
|
6
|
+
} from "vue";
|
|
7
|
+
import { Popup } from "../popup";
|
|
8
|
+
import { ChevronRightIcon } from "../icon";
|
|
9
|
+
const DROPDOWN_CLOSE = Symbol("dropdown-close");
|
|
10
|
+
const DROPDOWN_ON_CLICK = Symbol("dropdown-on-click");
|
|
11
|
+
const Dropdown = defineComponent({
|
|
12
|
+
name: "LaypluxDropdown",
|
|
13
|
+
props: {
|
|
14
|
+
visible: Boolean,
|
|
15
|
+
trigger: { type: String, default: "click" },
|
|
16
|
+
placement: { type: String, default: "bottom-start" },
|
|
17
|
+
disabled: { type: Boolean, default: false },
|
|
18
|
+
destroyOnClose: { type: Boolean, default: true },
|
|
19
|
+
onClick: Function,
|
|
20
|
+
getContainer: { type: Function }
|
|
21
|
+
},
|
|
22
|
+
emits: ["update:visible"],
|
|
23
|
+
setup(props, { emit, slots }) {
|
|
24
|
+
const closeDropdown = () => {
|
|
25
|
+
emit("update:visible", false);
|
|
26
|
+
};
|
|
27
|
+
provide(DROPDOWN_CLOSE, closeDropdown);
|
|
28
|
+
provide(DROPDOWN_ON_CLICK, props.onClick);
|
|
29
|
+
return () => /* @__PURE__ */ jsx(
|
|
30
|
+
Popup,
|
|
31
|
+
{
|
|
32
|
+
visible: props.visible,
|
|
33
|
+
trigger: props.trigger,
|
|
34
|
+
placement: props.placement,
|
|
35
|
+
disabled: props.disabled,
|
|
36
|
+
destroyOnClose: props.destroyOnClose,
|
|
37
|
+
getContainer: props.getContainer,
|
|
38
|
+
"onUpdate:visible": (v) => emit("update:visible", v),
|
|
39
|
+
children: {
|
|
40
|
+
default: () => slots.default?.(),
|
|
41
|
+
content: () => /* @__PURE__ */ jsx("div", { class: "layplux-dropdown", children: slots.overlay?.() })
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const DropdownMenu = defineComponent({
|
|
48
|
+
name: "LaypluxDropdownMenu",
|
|
49
|
+
setup(_props, { slots }) {
|
|
50
|
+
return () => /* @__PURE__ */ jsx("div", { class: "layplux-dropdown-menu", children: slots.default?.() });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const DropdownItem = defineComponent({
|
|
54
|
+
name: "LaypluxDropdownItem",
|
|
55
|
+
props: {
|
|
56
|
+
eventKey: { type: String, required: true },
|
|
57
|
+
disabled: { type: Boolean, default: false },
|
|
58
|
+
danger: { type: Boolean, default: false }
|
|
59
|
+
},
|
|
60
|
+
setup(props, { slots }) {
|
|
61
|
+
const closeDropdown = inject(DROPDOWN_CLOSE);
|
|
62
|
+
const onItemClick = inject(DROPDOWN_ON_CLICK);
|
|
63
|
+
const handleClick = () => {
|
|
64
|
+
if (props.disabled) return;
|
|
65
|
+
onItemClick?.(props.eventKey);
|
|
66
|
+
closeDropdown?.();
|
|
67
|
+
};
|
|
68
|
+
return () => /* @__PURE__ */ jsx(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
class: [
|
|
72
|
+
"layplux-dropdown-menu__item",
|
|
73
|
+
props.disabled && "layplux-dropdown-menu__item--disabled",
|
|
74
|
+
props.danger && "layplux-dropdown-menu__item--danger"
|
|
75
|
+
],
|
|
76
|
+
onClick: handleClick,
|
|
77
|
+
children: slots.default?.()
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const DropdownDivider = defineComponent({
|
|
83
|
+
name: "LaypluxDropdownDivider",
|
|
84
|
+
setup() {
|
|
85
|
+
return () => /* @__PURE__ */ jsx("div", { class: "layplux-dropdown-menu__divider" });
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const DropdownSubmenu = defineComponent({
|
|
89
|
+
name: "LaypluxDropdownSubmenu",
|
|
90
|
+
props: {
|
|
91
|
+
title: { type: String },
|
|
92
|
+
icon: Object,
|
|
93
|
+
disabled: { type: Boolean, default: false },
|
|
94
|
+
getContainer: { type: Function }
|
|
95
|
+
},
|
|
96
|
+
setup(props, { slots }) {
|
|
97
|
+
const closeParent = inject(DROPDOWN_CLOSE);
|
|
98
|
+
const onParentClick = inject(DROPDOWN_ON_CLICK);
|
|
99
|
+
if (closeParent) {
|
|
100
|
+
provide(DROPDOWN_CLOSE, closeParent);
|
|
101
|
+
}
|
|
102
|
+
const handleClick = (key) => {
|
|
103
|
+
onParentClick?.(key);
|
|
104
|
+
closeParent?.();
|
|
105
|
+
};
|
|
106
|
+
provide(DROPDOWN_ON_CLICK, handleClick);
|
|
107
|
+
return () => /* @__PURE__ */ jsx(
|
|
108
|
+
Popup,
|
|
109
|
+
{
|
|
110
|
+
trigger: "hover",
|
|
111
|
+
placement: "right-start",
|
|
112
|
+
offset: { x: 4, y: 0 },
|
|
113
|
+
mouseEnterDelay: 150,
|
|
114
|
+
mouseLeaveDelay: 100,
|
|
115
|
+
destroyOnClose: true,
|
|
116
|
+
disabled: props.disabled,
|
|
117
|
+
getContainer: props.getContainer,
|
|
118
|
+
children: {
|
|
119
|
+
default: () => /* @__PURE__ */ jsxs(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
class: [
|
|
123
|
+
"layplux-dropdown-menu__item",
|
|
124
|
+
"layplux-dropdown-menu__item--submenu",
|
|
125
|
+
props.disabled && "layplux-dropdown-menu__item--disabled"
|
|
126
|
+
],
|
|
127
|
+
children: [
|
|
128
|
+
props.icon,
|
|
129
|
+
/* @__PURE__ */ jsx("span", { children: props.title }),
|
|
130
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, { size: 12, class: "layplux-dropdown-menu__submenu-arrow" })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
content: () => /* @__PURE__ */ jsx("div", { class: "layplux-dropdown", children: slots.default?.() })
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
export {
|
|
141
|
+
Dropdown,
|
|
142
|
+
DropdownDivider,
|
|
143
|
+
DropdownItem,
|
|
144
|
+
DropdownMenu,
|
|
145
|
+
DropdownSubmenu
|
|
146
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx } from "vue/jsx-runtime";
|
|
2
|
+
import { defineComponent } from "vue";
|
|
3
|
+
const iconProps = {
|
|
4
|
+
size: { type: [Number, String], default: 16 }
|
|
5
|
+
};
|
|
6
|
+
function createIcon(d, viewBox = "0 0 16 16") {
|
|
7
|
+
return defineComponent({
|
|
8
|
+
name: "LaypluxIcon",
|
|
9
|
+
props: iconProps,
|
|
10
|
+
setup(props) {
|
|
11
|
+
return () => /* @__PURE__ */ jsx(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
viewBox,
|
|
16
|
+
width: props.size,
|
|
17
|
+
height: props.size,
|
|
18
|
+
fill: "currentColor",
|
|
19
|
+
style: { flexShrink: 0 },
|
|
20
|
+
children: /* @__PURE__ */ jsx("path", { d })
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const MoreIcon = createIcon(
|
|
27
|
+
"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2",
|
|
28
|
+
"0 0 24 24"
|
|
29
|
+
);
|
|
30
|
+
const MinimizeIcon = createIcon("M19 13H5v-2h14z", "0 0 24 24");
|
|
31
|
+
const ChevronRightIcon = createIcon(
|
|
32
|
+
"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z",
|
|
33
|
+
"0 0 24 24"
|
|
34
|
+
);
|
|
35
|
+
export {
|
|
36
|
+
ChevronRightIcon,
|
|
37
|
+
MinimizeIcon,
|
|
38
|
+
MoreIcon
|
|
39
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { jsx, jsxs } from "vue/jsx-runtime";
|
|
2
|
+
import { defineComponent, ref, inject } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
Dropdown,
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
DropdownItem,
|
|
7
|
+
DropdownDivider,
|
|
8
|
+
DropdownSubmenu
|
|
9
|
+
} from "../dropdown";
|
|
10
|
+
import { MoreIcon, MinimizeIcon } from "../icon";
|
|
11
|
+
import { createContent } from "../../utils";
|
|
12
|
+
import { getBuiltInLocale } from "../../locales";
|
|
13
|
+
const viewModeKeys = /* @__PURE__ */ new Set(["DockPinned", "DockUnpinned", "Undock"]);
|
|
14
|
+
function findItem(items, key) {
|
|
15
|
+
if (!items) return;
|
|
16
|
+
for (const item of items) {
|
|
17
|
+
if (item.key === key) return item;
|
|
18
|
+
if (item.children?.length) {
|
|
19
|
+
const found = findItem(item.children, key);
|
|
20
|
+
if (found) return found;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const PanelView = defineComponent({
|
|
25
|
+
name: "PanelView",
|
|
26
|
+
props: {
|
|
27
|
+
anchor: String,
|
|
28
|
+
title: String,
|
|
29
|
+
widget: Object,
|
|
30
|
+
menuItems: Array
|
|
31
|
+
},
|
|
32
|
+
setup(props, { slots }) {
|
|
33
|
+
const panelRef = ref();
|
|
34
|
+
const defaultLocale = ref(getBuiltInLocale("zh-CN"));
|
|
35
|
+
const locale = inject("layplux-locale", defaultLocale);
|
|
36
|
+
const handleClick = (key) => {
|
|
37
|
+
const widget = props.widget;
|
|
38
|
+
widget?.event?.emitGlobal(`panel:${widget.name}:menu-click`, { widget, key });
|
|
39
|
+
const widgetProps = widget?.config.props;
|
|
40
|
+
const panelItems = widgetProps?.panelMenuItems;
|
|
41
|
+
const panelItem = findItem(panelItems, key);
|
|
42
|
+
if (panelItem?.onClick) {
|
|
43
|
+
panelItem.onClick(key, widget);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (viewModeKeys.has(key)) {
|
|
47
|
+
widget?.pane.setViewMode(key);
|
|
48
|
+
} else if (key === "help") {
|
|
49
|
+
widgetProps?.onHelpClick?.();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function handlePanelClick() {
|
|
53
|
+
props.widget?.focusable.active();
|
|
54
|
+
}
|
|
55
|
+
function renderItems(items, currentMode) {
|
|
56
|
+
return items.map((item) => {
|
|
57
|
+
if (item.type === "divider") {
|
|
58
|
+
return /* @__PURE__ */ jsx(DropdownDivider, {}, item.key ?? "divider");
|
|
59
|
+
}
|
|
60
|
+
const k = item.key ?? "";
|
|
61
|
+
if (item.children?.length) {
|
|
62
|
+
return /* @__PURE__ */ jsx(
|
|
63
|
+
DropdownSubmenu,
|
|
64
|
+
{
|
|
65
|
+
title: item.label,
|
|
66
|
+
icon: item.icon,
|
|
67
|
+
getContainer: () => panelRef.value,
|
|
68
|
+
children: renderItems(item.children, currentMode)
|
|
69
|
+
},
|
|
70
|
+
k
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const disabled = currentMode !== void 0 && viewModeKeys.has(k) && currentMode === k;
|
|
74
|
+
return /* @__PURE__ */ jsxs(DropdownItem, { eventKey: k, disabled, children: [
|
|
75
|
+
item.icon,
|
|
76
|
+
" ",
|
|
77
|
+
item.label
|
|
78
|
+
] }, k);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return () => {
|
|
82
|
+
const widget = props.widget;
|
|
83
|
+
const currentMode = widget?.pane.viewMode.value;
|
|
84
|
+
const widgetProps = widget?.config.props;
|
|
85
|
+
const hasCustomItems = props.menuItems && props.menuItems.length > 0;
|
|
86
|
+
const panelMenuItems = widgetProps?.panelMenuItems;
|
|
87
|
+
const hasPanelMenuItems = panelMenuItems && panelMenuItems.length > 0;
|
|
88
|
+
const showHelp = widgetProps?.showHelp !== false;
|
|
89
|
+
const loc = locale.value.panel;
|
|
90
|
+
const finalInnerItems = [
|
|
91
|
+
{
|
|
92
|
+
key: "viewMode",
|
|
93
|
+
label: loc.viewMode,
|
|
94
|
+
children: [
|
|
95
|
+
{ key: "DockPinned", label: loc.dockPinned },
|
|
96
|
+
{ key: "DockUnpinned", label: loc.dockUnpinned },
|
|
97
|
+
{ key: "Undock", label: loc.undock }
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{ type: "divider" },
|
|
101
|
+
...showHelp ? [{ key: "help", label: loc.help }] : []
|
|
102
|
+
];
|
|
103
|
+
const panelTitleExtra = widgetProps?.panelTitleExtra;
|
|
104
|
+
const panelActionsExtra = widgetProps?.panelActionsExtra;
|
|
105
|
+
return /* @__PURE__ */ jsxs("div", { ref: panelRef, id: widget?.id, class: "layplux-panel", onClick: handlePanelClick, children: [
|
|
106
|
+
/* @__PURE__ */ jsxs("div", { class: "layplux-panel__header", children: [
|
|
107
|
+
/* @__PURE__ */ jsx("span", { class: "layplux-panel__title", children: props.title ?? widget?.name }),
|
|
108
|
+
panelTitleExtra && createContent(panelTitleExtra),
|
|
109
|
+
/* @__PURE__ */ jsxs("div", { class: "layplux-panel__actions", children: [
|
|
110
|
+
panelActionsExtra && createContent(panelActionsExtra),
|
|
111
|
+
slots.actionsExtra?.(),
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
Dropdown,
|
|
114
|
+
{
|
|
115
|
+
trigger: "click",
|
|
116
|
+
placement: "bottom-start",
|
|
117
|
+
onClick: handleClick,
|
|
118
|
+
getContainer: () => panelRef.value,
|
|
119
|
+
children: {
|
|
120
|
+
default: () => /* @__PURE__ */ jsx("button", { class: "layplux-panel__action-btn", title: loc.more, children: /* @__PURE__ */ jsx(MoreIcon, { size: 16 }) }),
|
|
121
|
+
overlay: () => /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
122
|
+
hasPanelMenuItems && renderItems(panelMenuItems),
|
|
123
|
+
hasPanelMenuItems && hasCustomItems && /* @__PURE__ */ jsx(DropdownDivider, {}),
|
|
124
|
+
hasCustomItems && renderItems(props.menuItems),
|
|
125
|
+
(hasPanelMenuItems || hasCustomItems) && /* @__PURE__ */ jsx(DropdownDivider, {}),
|
|
126
|
+
renderItems(finalInnerItems, currentMode)
|
|
127
|
+
] })
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
class: "layplux-panel__action-btn",
|
|
135
|
+
title: loc.minimize,
|
|
136
|
+
onClick: () => {
|
|
137
|
+
widget?.event?.emitGlobal(`panel:${widget.name}:minimize`, { widget });
|
|
138
|
+
widget?.container?.deactivate();
|
|
139
|
+
},
|
|
140
|
+
children: /* @__PURE__ */ jsx(MinimizeIcon, { size: 16 })
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] })
|
|
144
|
+
] }),
|
|
145
|
+
/* @__PURE__ */ jsx("div", { id: props.anchor, class: "layplux-panel__body" })
|
|
146
|
+
] });
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
export {
|
|
151
|
+
PanelView
|
|
152
|
+
};
|