@veltra/desktop 1.1.30 → 1.1.32
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/components/action/action-group.vue.d.ts +2 -2
- package/dist/components/action/action.vue.d.ts +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
- package/dist/components/batch-edit/batch-edit.vue.d.ts +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +1 -1
- package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +1 -1
- package/dist/components/contextmenu/api.d.ts +8 -0
- package/dist/components/{context-menu → contextmenu}/api.js +2 -2
- package/dist/components/contextmenu/api.js.map +1 -0
- package/dist/components/contextmenu/contextmenu-item.js +64 -0
- package/dist/components/contextmenu/contextmenu-item.js.map +1 -0
- package/dist/components/contextmenu/contextmenu-panel.js +33 -0
- package/dist/components/contextmenu/contextmenu-panel.js.map +1 -0
- package/dist/components/contextmenu/contextmenu-sub.js +83 -0
- package/dist/components/contextmenu/contextmenu-sub.js.map +1 -0
- package/dist/components/contextmenu/contextmenu.js +79 -0
- package/dist/components/contextmenu/contextmenu.js.map +1 -0
- package/dist/components/{context-menu/context-menu.vue.d.ts → contextmenu/contextmenu.vue.d.ts} +5 -5
- package/dist/components/contextmenu/di.js +7 -0
- package/dist/components/contextmenu/di.js.map +1 -0
- package/dist/components/contextmenu/helper.js +8 -0
- package/dist/components/contextmenu/helper.js.map +1 -0
- package/dist/components/contextmenu/index.d.ts +2 -0
- package/dist/components/contextmenu/style2.css +154 -0
- package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
- package/dist/components/drawer/drawer.vue.d.ts +2 -2
- package/dist/components/empty/empty.vue.d.ts +1 -1
- package/dist/components/file-viewer/file-viewer.vue.d.ts +1 -1
- package/dist/components/file-viewer/previewers/sheet-previewer.js +33 -93
- package/dist/components/file-viewer/previewers/sheet-previewer.js.map +1 -1
- package/dist/components/file-viewer/sheet-parser.js +46 -0
- package/dist/components/file-viewer/sheet-parser.js.map +1 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +3 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/input/input.vue.d.ts +1 -1
- package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +2 -2
- package/dist/components/number-input/number-input.vue.d.ts +1 -1
- package/dist/components/number-range-input/number-range-input.vue.d.ts +2 -2
- package/dist/components/password-input/password-input.vue.d.ts +1 -1
- package/dist/components/progress-nodes/progress-nodes.vue.d.ts +2 -2
- package/dist/components/radio-group/radio-group.vue.d.ts +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
- package/dist/components/select/select.vue.d.ts +1 -1
- package/dist/components/steps/steps.vue.d.ts +1 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +2 -2
- package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
- package/dist/components/tabs/tabs.vue.d.ts +2 -2
- package/dist/components/textarea/textarea.vue.d.ts +2 -2
- package/dist/components/tree-select/tree-select.vue.d.ts +2 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/style.js +1 -1
- package/dist/types/{context-menu.d.ts → contextmenu.d.ts} +12 -10
- package/dist/types/index.d.ts +2 -2
- package/package.json +6 -6
- package/src/components/{context-menu → contextmenu}/api.ts +4 -4
- package/src/components/contextmenu/contextmenu-item.vue +63 -0
- package/src/components/contextmenu/contextmenu-panel.vue +28 -0
- package/src/components/contextmenu/contextmenu-sub.vue +88 -0
- package/src/components/contextmenu/contextmenu.vue +77 -0
- package/src/components/contextmenu/di.ts +13 -0
- package/src/components/contextmenu/helper.ts +5 -0
- package/src/components/contextmenu/index.ts +3 -0
- package/src/components/contextmenu/style.scss +135 -0
- package/src/components/file-viewer/previewers/sheet-previewer.vue +35 -131
- package/src/components/file-viewer/sheet-parser.ts +52 -0
- package/src/components/index.ts +1 -1
- package/src/style.ts +1 -1
- package/src/types/{context-menu.ts → contextmenu.ts} +9 -7
- package/src/types/index.ts +1 -1
- package/dist/components/context-menu/api.d.ts +0 -8
- package/dist/components/context-menu/api.js.map +0 -1
- package/dist/components/context-menu/context-menu-item.js +0 -60
- package/dist/components/context-menu/context-menu-item.js.map +0 -1
- package/dist/components/context-menu/context-menu.js +0 -95
- package/dist/components/context-menu/context-menu.js.map +0 -1
- package/dist/components/context-menu/di.js +0 -6
- package/dist/components/context-menu/di.js.map +0 -1
- package/dist/components/context-menu/index.d.ts +0 -2
- package/dist/components/context-menu/style2.css +0 -52
- package/src/components/context-menu/context-menu-item.vue +0 -67
- package/src/components/context-menu/context-menu.vue +0 -117
- package/src/components/context-menu/di.ts +0 -5
- package/src/components/context-menu/index.ts +0 -3
- package/src/components/context-menu/style.scss +0 -51
- /package/dist/components/{context-menu → contextmenu}/style.d.ts +0 -0
- /package/dist/components/{context-menu → contextmenu}/style.js +0 -0
- /package/src/components/{context-menu → contextmenu}/style.ts +0 -0
|
@@ -7,10 +7,10 @@ type __VLS_Slots = {
|
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import("vue").DefineComponent<ActionGroupProps, _ActionGroupExposed, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ActionGroupProps> & Readonly<{}>, {
|
|
9
9
|
type: import("@veltra/utils").ColorType;
|
|
10
|
-
size: "small" | "default" | "large";
|
|
11
10
|
text: boolean;
|
|
12
|
-
|
|
11
|
+
size: "small" | "default" | "large";
|
|
13
12
|
max: number;
|
|
13
|
+
circle: boolean;
|
|
14
14
|
loading: boolean;
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -13,8 +13,8 @@ declare const __VLS_base: import("vue").DefineComponent<ActionProps, {}, {}, {},
|
|
|
13
13
|
onRun?: (() => any) | undefined;
|
|
14
14
|
}>, {
|
|
15
15
|
type: ButtonType;
|
|
16
|
-
size: import("@veltra/utils").ComponentSize;
|
|
17
16
|
text: boolean;
|
|
17
|
+
size: import("@veltra/utils").ComponentSize;
|
|
18
18
|
circle: boolean;
|
|
19
19
|
loading: boolean;
|
|
20
20
|
inDropdown: boolean;
|
|
@@ -23,9 +23,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
23
23
|
onSelect?: ((value: string) => any) | undefined;
|
|
24
24
|
}>, {
|
|
25
25
|
disabled: boolean;
|
|
26
|
-
readonly: boolean;
|
|
27
26
|
placeholder: string;
|
|
28
27
|
clearable: boolean;
|
|
28
|
+
readonly: boolean;
|
|
29
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
30
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
31
31
|
declare const _default: typeof __VLS_export;
|
|
@@ -7,11 +7,11 @@ declare const __VLS_export: <Model extends IFormModel>(__VLS_props: NonNullable<
|
|
|
7
7
|
"onUpdate:selected"?: ((value: Record<string, any> | undefined) => any) | undefined;
|
|
8
8
|
"onUpdate:checked"?: ((value: Record<string, any>[]) => any) | undefined;
|
|
9
9
|
"onUpdate:current"?: ((row?: TableRow | undefined) => any) | undefined;
|
|
10
|
-
"onUpdate:data"?: ((value: Record<string, any>[]) => any) | undefined;
|
|
11
10
|
"onUpdate:rows"?: ((rows: TableRow[]) => any) | undefined;
|
|
12
11
|
"onUpdate:forest"?: ((rows?: import("@cat-kit/core").Forest<Record<string, unknown>, any> | undefined) => any) | undefined;
|
|
13
12
|
"onCell-click"?: ((row: TableRow, column: TableColumn, ev: MouseEvent) => any) | undefined;
|
|
14
13
|
"onRow-click"?: ((row: TableRow, ev: MouseEvent) => any) | undefined;
|
|
14
|
+
"onUpdate:data"?: ((value: Record<string, any>[]) => any) | undefined;
|
|
15
15
|
}> & (typeof globalThis extends {
|
|
16
16
|
__VLS_PROPS_FALLBACK: infer P;
|
|
17
17
|
} ? P : {});
|
|
@@ -10,7 +10,6 @@ declare const __VLS_export: import("vue").DefineComponent<CascadeProps, {}, {},
|
|
|
10
10
|
onChange?: ((...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any) | undefined;
|
|
11
11
|
}>, {
|
|
12
12
|
disabled: boolean;
|
|
13
|
-
readonly: boolean;
|
|
14
13
|
labelKey: string;
|
|
15
14
|
valueKey: string;
|
|
16
15
|
childrenKey: string;
|
|
@@ -18,6 +17,7 @@ declare const __VLS_export: import("vue").DefineComponent<CascadeProps, {}, {},
|
|
|
18
17
|
placeholder: string;
|
|
19
18
|
clearable: boolean;
|
|
20
19
|
filterable: boolean;
|
|
20
|
+
readonly: boolean;
|
|
21
21
|
separator: string;
|
|
22
22
|
visibilityLimit: number;
|
|
23
23
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -17,8 +17,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
17
17
|
"onUpdate:modelValue"?: ((checked: boolean) => any) | undefined;
|
|
18
18
|
onChange?: ((checked: boolean) => any) | undefined;
|
|
19
19
|
}>, {
|
|
20
|
-
type: import("@veltra/utils").ColorType;
|
|
21
20
|
disabled: boolean;
|
|
21
|
+
type: import("@veltra/utils").ColorType;
|
|
22
22
|
readonly: boolean;
|
|
23
23
|
round: boolean;
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -13,9 +13,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
13
13
|
"onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
|
|
14
14
|
}>, {
|
|
15
15
|
disabled: boolean;
|
|
16
|
-
readonly: boolean;
|
|
17
16
|
labelKey: string;
|
|
18
17
|
valueKey: string;
|
|
18
|
+
readonly: boolean;
|
|
19
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const _default: typeof __VLS_export;
|
|
21
21
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _sfc_main from "./
|
|
1
|
+
import _sfc_main from "./contextmenu.js";
|
|
2
2
|
import { createVNode, render } from "vue";
|
|
3
|
-
//#region src/components/
|
|
3
|
+
//#region src/components/contextmenu/api.ts
|
|
4
4
|
let node;
|
|
5
5
|
const contextmenu = { pop(options) {
|
|
6
6
|
if (node) render(null, document.body);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","names":["UContextmenu"],"sources":["../../../src/components/contextmenu/api.ts"],"sourcesContent":["import { createVNode, render, type VNode } from 'vue'\n\nimport type { ContextmenuProps } from '../../types'\nimport UContextmenu from './contextmenu.vue'\n\nlet node: VNode\n\nexport const contextmenu = {\n pop(options: ContextmenuProps): void {\n if (node) {\n render(null, document.body)\n }\n\n node = createVNode(UContextmenu, {\n ...options,\n onDestroy() {\n render(null, document.body)\n }\n })\n\n render(node, document.body)\n }\n}\n"],"mappings":";;;AAKA,IAAI;AAEJ,MAAa,cAAc,EACzB,IAAI,SAAiC;CACnC,IAAI,MACF,OAAO,MAAM,SAAS,IAAI;CAG5B,OAAO,YAAYA,WAAc;EAC/B,GAAG;EACH,YAAY;GACV,OAAO,MAAM,SAAS,IAAI;EAC5B;CACF,CAAC;CAED,OAAO,MAAM,SAAS,IAAI;AAC5B,EACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icon/icon.js";
|
|
2
|
+
import { ContextmenuPanelDIKey, ContextmenuRootDIKey } from "./di.js";
|
|
3
|
+
import { getMenuDisabled } from "./helper.js";
|
|
4
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, resolveDynamicComponent, shallowRef, toDisplayString, unref, withCtx, withDirectives } from "vue";
|
|
5
|
+
import { bem } from "@veltra/utils";
|
|
6
|
+
import { Loading } from "@veltra/icons/normal";
|
|
7
|
+
import { vRipple } from "@veltra/directives";
|
|
8
|
+
//#region src/components/contextmenu/contextmenu-item.vue
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
name: "ContextmenuItem",
|
|
11
|
+
__name: "contextmenu-item",
|
|
12
|
+
props: { menu: {} },
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const { cls, onItemClickStart, onItemClickEnd } = inject(ContextmenuRootDIKey);
|
|
15
|
+
const { showIconColumn, showArrowColumn } = inject(ContextmenuPanelDIKey);
|
|
16
|
+
const loading = shallowRef(false);
|
|
17
|
+
const disabled = computed(() => getMenuDisabled(__props.menu));
|
|
18
|
+
function handleClickMenu() {
|
|
19
|
+
if (disabled.value || loading.value) return;
|
|
20
|
+
onItemClickStart();
|
|
21
|
+
loading.value = true;
|
|
22
|
+
const done = () => {
|
|
23
|
+
onItemClickEnd();
|
|
24
|
+
loading.value = false;
|
|
25
|
+
};
|
|
26
|
+
const result = __props.menu.callback?.();
|
|
27
|
+
if (result instanceof Promise) result.finally(done);
|
|
28
|
+
else done();
|
|
29
|
+
}
|
|
30
|
+
return (_ctx, _cache) => {
|
|
31
|
+
return withDirectives((openBlock(), createElementBlock("li", {
|
|
32
|
+
class: normalizeClass([
|
|
33
|
+
unref(cls).e("item"),
|
|
34
|
+
unref(bem).is("disabled", disabled.value),
|
|
35
|
+
unref(bem).is("loading", loading.value)
|
|
36
|
+
]),
|
|
37
|
+
onClick: handleClickMenu
|
|
38
|
+
}, [createElementVNode("div", { class: normalizeClass(unref(cls).e("item-content")) }, [
|
|
39
|
+
unref(showIconColumn) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [loading.value ? (openBlock(), createBlock(unref(_sfc_main$1), {
|
|
40
|
+
key: 0,
|
|
41
|
+
class: normalizeClass(unref(bem).is("loading"))
|
|
42
|
+
}, {
|
|
43
|
+
default: withCtx(() => [createVNode(unref(Loading))]),
|
|
44
|
+
_: 1
|
|
45
|
+
}, 8, ["class"])) : __props.menu.icon ? (openBlock(), createBlock(unref(_sfc_main$1), { key: 1 }, {
|
|
46
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.menu.icon)))]),
|
|
47
|
+
_: 1
|
|
48
|
+
})) : (openBlock(), createElementBlock("i", {
|
|
49
|
+
key: 2,
|
|
50
|
+
class: normalizeClass(unref(cls).e("icon-place"))
|
|
51
|
+
}, null, 2))], 64)) : createCommentVNode("v-if", true),
|
|
52
|
+
createElementVNode("span", { class: normalizeClass(unref(cls).e("label")) }, toDisplayString(__props.menu.label), 3),
|
|
53
|
+
unref(showArrowColumn) ? (openBlock(), createElementBlock("i", {
|
|
54
|
+
key: 1,
|
|
55
|
+
class: normalizeClass(unref(cls).e("arrow-place"))
|
|
56
|
+
}, null, 2)) : createCommentVNode("v-if", true)
|
|
57
|
+
], 2)], 2)), [[unref(vRipple), !disabled.value && !loading.value]]);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
//#endregion
|
|
62
|
+
export { _sfc_main as default };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=contextmenu-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextmenu-item.js","names":[],"sources":["../../../src/components/contextmenu/contextmenu-item.vue"],"sourcesContent":["<template>\n <li\n :class=\"[cls.e('item'), bem.is('disabled', disabled), bem.is('loading', loading)]\"\n v-ripple=\"!disabled && !loading\"\n @click=\"handleClickMenu\"\n >\n <div :class=\"cls.e('item-content')\">\n <template v-if=\"showIconColumn\">\n <u-icon v-if=\"loading\" :class=\"bem.is('loading')\">\n <Loading />\n </u-icon>\n <u-icon v-else-if=\"menu.icon\">\n <component :is=\"menu.icon\" />\n </u-icon>\n <i v-else :class=\"cls.e('icon-place')\"></i>\n </template>\n\n <span :class=\"cls.e('label')\">{{ menu.label }}</span>\n\n <i v-if=\"showArrowColumn\" :class=\"cls.e('arrow-place')\"></i>\n </div>\n </li>\n</template>\n\n<script lang=\"ts\" setup>\nimport { vRipple } from '@veltra/directives'\nimport { Loading } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, inject, shallowRef } from 'vue'\n\nimport type { ContextmenuItem } from '../../types'\nimport { UIcon } from '../icon'\nimport { ContextmenuPanelDIKey, ContextmenuRootDIKey } from './di'\nimport { getMenuDisabled } from './helper'\n\ndefineOptions({ name: 'ContextmenuItem' })\n\nconst { menu } = defineProps<{ menu: ContextmenuItem }>()\n\nconst { cls, onItemClickStart, onItemClickEnd } = inject(ContextmenuRootDIKey)!\nconst { showIconColumn, showArrowColumn } = inject(ContextmenuPanelDIKey)!\n\nconst loading = shallowRef(false)\nconst disabled = computed(() => getMenuDisabled(menu))\n\nfunction handleClickMenu() {\n if (disabled.value || loading.value) return\n onItemClickStart()\n loading.value = true\n\n const done = () => {\n onItemClickEnd()\n loading.value = false\n }\n\n const result = menu.callback?.()\n if (result instanceof Promise) {\n result.finally(done)\n } else {\n done()\n }\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;EAuCA,MAAM,EAAE,KAAK,kBAAkB,mBAAmB,OAAO,oBAAoB;EAC7E,MAAM,EAAE,gBAAgB,oBAAoB,OAAO,qBAAqB;EAExE,MAAM,UAAU,WAAW,KAAK;EAChC,MAAM,WAAW,eAAe,gBAAgB,QAAA,IAAI,CAAC;EAErD,SAAS,kBAAkB;GACzB,IAAI,SAAS,SAAS,QAAQ,OAAO;GACrC,iBAAiB;GACjB,QAAQ,QAAQ;GAEhB,MAAM,aAAa;IACjB,eAAe;IACf,QAAQ,QAAQ;GAClB;GAEA,MAAM,SAAS,QAAA,KAAK,WAAW;GAC/B,IAAI,kBAAkB,SACpB,OAAO,QAAQ,IAAI;QA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js";
|
|
4
|
+
import { Fragment, computed, createBlock, createElementBlock, defineComponent, guardReactiveProps, inject, normalizeProps, openBlock, provide, renderList } from "vue";
|
|
5
|
+
//#region src/components/contextmenu/contextmenu-panel.vue
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
name: "ContextmenuPanel",
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
__name: "contextmenu-panel",
|
|
10
|
+
props: { menus: {} },
|
|
11
|
+
setup(__props) {
|
|
12
|
+
inject(ContextmenuRootDIKey);
|
|
13
|
+
provide(ContextmenuPanelDIKey, {
|
|
14
|
+
showIconColumn: computed(() => __props.menus.some((menu) => !!menu.icon)),
|
|
15
|
+
showArrowColumn: computed(() => __props.menus.some((menu) => !!menu.children?.length))
|
|
16
|
+
});
|
|
17
|
+
return (_ctx, _cache) => {
|
|
18
|
+
return openBlock(), createElementBlock("ul", normalizeProps(guardReactiveProps(_ctx.$attrs)), [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.menus, (menu, index) => {
|
|
19
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [menu.children?.length ? (openBlock(), createBlock(_sfc_main$2, {
|
|
20
|
+
key: 0,
|
|
21
|
+
menu
|
|
22
|
+
}, null, 8, ["menu"])) : (openBlock(), createBlock(_sfc_main$1, {
|
|
23
|
+
key: 1,
|
|
24
|
+
menu
|
|
25
|
+
}, null, 8, ["menu"]))], 64);
|
|
26
|
+
}), 128))], 16);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { _sfc_main as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=contextmenu-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextmenu-panel.js","names":["$attrs"],"sources":["../../../src/components/contextmenu/contextmenu-panel.vue"],"sourcesContent":["<template>\n <ul v-bind=\"$attrs\">\n <template v-for=\"(menu, index) of menus\" :key=\"index\">\n <UContextmenuSub v-if=\"menu.children?.length\" :menu=\"menu\" />\n <UContextmenuItem v-else :menu=\"menu\" />\n </template>\n </ul>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, provide } from 'vue'\n\nimport type { ContextmenuItem } from '../../types'\nimport UContextmenuItem from './contextmenu-item.vue'\nimport UContextmenuSub from './contextmenu-sub.vue'\nimport { ContextmenuPanelDIKey, ContextmenuRootDIKey } from './di'\n\ndefineOptions({ name: 'ContextmenuPanel', inheritAttrs: false })\n\nconst { menus } = defineProps<{ menus: ContextmenuItem[] }>()\n\ninject(ContextmenuRootDIKey)\n\nconst showIconColumn = computed(() => menus.some((menu) => !!menu.icon))\nconst showArrowColumn = computed(() => menus.some((menu) => !!menu.children?.length))\n\nprovide(ContextmenuPanelDIKey, { showIconColumn, showArrowColumn })\n</script>\n"],"mappings":";;;;;;;;;;;EAqBA,OAAO,oBAAoB;EAK3B,QAAQ,uBAAuB;GAAE,gBAHV,eAAe,QAAA,MAAM,MAAM,SAAS,CAAC,CAAC,KAAK,IAAI,CAGrC;GAAgB,iBAFzB,eAAe,QAAA,MAAM,MAAM,SAAS,CAAC,CAAC,KAAK,UAAU,MAAM,CAElC;EAAgB,CAAC;;uBAzBhE,mBAKK,MAAA,eAAA,mBALOA,KAAAA,MAAM,CAAA,GAAA,EAAA,UAAA,IAAA,GAChB,mBAGW,UAAA,MAAA,WAHuB,QAAA,QAAhB,MAAM,UAAK;4DAAkB,MAAK,GAAA,CAC3B,KAAK,UAAU,UAAA,UAAA,GAAtC,YAA6D,aAAA;;KAAR;2CACrD,YAAwC,aAAA;;KAAR"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icon/icon.js";
|
|
2
|
+
import { ContextmenuPanelDIKey, ContextmenuRootDIKey } from "./di.js";
|
|
3
|
+
import { getMenuDisabled } from "./helper.js";
|
|
4
|
+
import _sfc_main$2 from "./contextmenu-panel.js";
|
|
5
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, nextTick, normalizeClass, onBeforeUnmount, openBlock, resolveDynamicComponent, shallowRef, toDisplayString, unref, vShow, withCtx, withDirectives } from "vue";
|
|
6
|
+
import { bem } from "@veltra/utils";
|
|
7
|
+
import { ArrowRight } from "@veltra/icons/normal";
|
|
8
|
+
//#region src/components/contextmenu/contextmenu-sub.vue
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
name: "ContextmenuSub",
|
|
11
|
+
__name: "contextmenu-sub",
|
|
12
|
+
props: { menu: {} },
|
|
13
|
+
setup(__props) {
|
|
14
|
+
const { cls } = inject(ContextmenuRootDIKey);
|
|
15
|
+
const { showIconColumn, showArrowColumn } = inject(ContextmenuPanelDIKey);
|
|
16
|
+
const subVisible = shallowRef(false);
|
|
17
|
+
const flipX = shallowRef(false);
|
|
18
|
+
let closeTimer;
|
|
19
|
+
const disabled = computed(() => getMenuDisabled(__props.menu));
|
|
20
|
+
function cancelClose() {
|
|
21
|
+
if (closeTimer !== void 0) {
|
|
22
|
+
clearTimeout(closeTimer);
|
|
23
|
+
closeTimer = void 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function scheduleClose() {
|
|
27
|
+
cancelClose();
|
|
28
|
+
closeTimer = setTimeout(() => {
|
|
29
|
+
subVisible.value = false;
|
|
30
|
+
}, 250);
|
|
31
|
+
}
|
|
32
|
+
function handleMouseEnter(e) {
|
|
33
|
+
if (disabled.value) return;
|
|
34
|
+
cancelClose();
|
|
35
|
+
subVisible.value = true;
|
|
36
|
+
nextTick(() => {
|
|
37
|
+
const panel = e.currentTarget.querySelector(`.${cls.e("sub")}`);
|
|
38
|
+
if (panel) flipX.value = panel.getBoundingClientRect().right > window.innerWidth;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
onBeforeUnmount(cancelClose);
|
|
42
|
+
return (_ctx, _cache) => {
|
|
43
|
+
return openBlock(), createElementBlock("li", {
|
|
44
|
+
class: normalizeClass([
|
|
45
|
+
unref(cls).e("item"),
|
|
46
|
+
unref(bem).is("disabled", disabled.value),
|
|
47
|
+
unref(bem).is("open", subVisible.value),
|
|
48
|
+
unref(bem).is("flip-x", flipX.value)
|
|
49
|
+
]),
|
|
50
|
+
onMouseenter: handleMouseEnter,
|
|
51
|
+
onMouseleave: scheduleClose
|
|
52
|
+
}, [createElementVNode("div", { class: normalizeClass(unref(cls).e("item-content")) }, [
|
|
53
|
+
unref(showIconColumn) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [__props.menu.icon ? (openBlock(), createBlock(unref(_sfc_main$1), { key: 0 }, {
|
|
54
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.menu.icon)))]),
|
|
55
|
+
_: 1
|
|
56
|
+
})) : (openBlock(), createElementBlock("i", {
|
|
57
|
+
key: 1,
|
|
58
|
+
class: normalizeClass(unref(cls).e("icon-place"))
|
|
59
|
+
}, null, 2))], 64)) : createCommentVNode("v-if", true),
|
|
60
|
+
createElementVNode("span", { class: normalizeClass(unref(cls).e("label")) }, toDisplayString(__props.menu.label), 3),
|
|
61
|
+
unref(showArrowColumn) ? (openBlock(), createBlock(unref(_sfc_main$1), {
|
|
62
|
+
key: 1,
|
|
63
|
+
class: normalizeClass(unref(cls).e("arrow"))
|
|
64
|
+
}, {
|
|
65
|
+
default: withCtx(() => [createVNode(unref(ArrowRight))]),
|
|
66
|
+
_: 1
|
|
67
|
+
}, 8, ["class"])) : (openBlock(), createElementBlock("i", {
|
|
68
|
+
key: 2,
|
|
69
|
+
class: normalizeClass(unref(cls).e("arrow-place"))
|
|
70
|
+
}, null, 2))
|
|
71
|
+
], 2), withDirectives(createVNode(_sfc_main$2, {
|
|
72
|
+
menus: __props.menu.children,
|
|
73
|
+
class: normalizeClass([unref(cls).e("sub"), unref(bem).is("flip-x", flipX.value)]),
|
|
74
|
+
onMouseenter: cancelClose,
|
|
75
|
+
onMouseleave: scheduleClose
|
|
76
|
+
}, null, 8, ["menus", "class"]), [[vShow, subVisible.value]])], 34);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
//#endregion
|
|
81
|
+
export { _sfc_main as default };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=contextmenu-sub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextmenu-sub.js","names":[],"sources":["../../../src/components/contextmenu/contextmenu-sub.vue"],"sourcesContent":["<template>\n <li\n :class=\"[\n cls.e('item'),\n bem.is('disabled', disabled),\n bem.is('open', subVisible),\n bem.is('flip-x', flipX)\n ]\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"scheduleClose\"\n >\n <div :class=\"cls.e('item-content')\">\n <template v-if=\"showIconColumn\">\n <u-icon v-if=\"menu.icon\">\n <component :is=\"menu.icon\" />\n </u-icon>\n <i v-else :class=\"cls.e('icon-place')\"></i>\n </template>\n\n <span :class=\"cls.e('label')\">{{ menu.label }}</span>\n\n <u-icon v-if=\"showArrowColumn\" :class=\"cls.e('arrow')\">\n <ArrowRight />\n </u-icon>\n <i v-else :class=\"cls.e('arrow-place')\"></i>\n </div>\n\n <UContextmenuPanel\n v-show=\"subVisible\"\n :menus=\"menu.children!\"\n :class=\"[cls.e('sub'), bem.is('flip-x', flipX)]\"\n @mouseenter=\"cancelClose\"\n @mouseleave=\"scheduleClose\"\n />\n </li>\n</template>\n\n<script lang=\"ts\" setup>\nimport { ArrowRight } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, inject, nextTick, onBeforeUnmount, shallowRef } from 'vue'\n\nimport type { ContextmenuItem } from '../../types'\nimport { UIcon } from '../icon'\nimport UContextmenuPanel from './contextmenu-panel.vue'\nimport { ContextmenuPanelDIKey, ContextmenuRootDIKey } from './di'\nimport { getMenuDisabled } from './helper'\n\ndefineOptions({ name: 'ContextmenuSub' })\n\nconst { menu } = defineProps<{ menu: ContextmenuItem }>()\n\nconst { cls } = inject(ContextmenuRootDIKey)!\nconst { showIconColumn, showArrowColumn } = inject(ContextmenuPanelDIKey)!\n\nconst subVisible = shallowRef(false)\nconst flipX = shallowRef(false)\n\nlet closeTimer: ReturnType<typeof setTimeout> | undefined\n\nconst disabled = computed(() => getMenuDisabled(menu))\n\nfunction cancelClose() {\n if (closeTimer !== undefined) {\n clearTimeout(closeTimer)\n closeTimer = undefined\n }\n}\n\nfunction scheduleClose() {\n cancelClose()\n closeTimer = setTimeout(() => {\n subVisible.value = false\n }, 250)\n}\n\nfunction handleMouseEnter(e: MouseEvent) {\n if (disabled.value) return\n cancelClose()\n subVisible.value = true\n nextTick(() => {\n const panel = (e.currentTarget as HTMLElement).querySelector<HTMLElement>(`.${cls.e('sub')}`)\n if (panel) flipX.value = panel.getBoundingClientRect().right > window.innerWidth\n })\n}\n\nonBeforeUnmount(cancelClose)\n</script>\n"],"mappings":";;;;;;;;;;;;;EAoDA,MAAM,EAAE,QAAQ,OAAO,oBAAoB;EAC3C,MAAM,EAAE,gBAAgB,oBAAoB,OAAO,qBAAqB;EAExE,MAAM,aAAa,WAAW,KAAK;EACnC,MAAM,QAAQ,WAAW,KAAK;EAE9B,IAAI;EAEJ,MAAM,WAAW,eAAe,gBAAgB,QAAA,IAAI,CAAC;EAErD,SAAS,cAAc;GACrB,IAAI,eAAe,KAAA,GAAW;IAC5B,aAAa,UAAU;IACvB,aAAa,KAAA;GACf;EACF;EAEA,SAAS,gBAAgB;GACvB,YAAY;GACZ,aAAa,iBAAiB;IAC5B,WAAW,QAAQ;GACrB,GAAG,GAAG;EACR;EAEA,SAAS,iBAAiB,GAAe;GACvC,IAAI,SAAS,OAAO;GACpB,YAAY;GACZ,WAAW,QAAQ;GACnB,eAAe;IACb,MAAM,QAAS,EAAE,cAA8B,cAA2B,IAAI,IAAI,EAAE,KAAK,GAAG;IAC5F,IAAI,OAAO,MAAM,QAAQ,MAAM,sBAAsB,EAAE,QAAQ,OAAO;GACxE,CAAC;EACH;EAE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CAJL,WAAA,KAAU,CAAA,CAAA,CAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ContextmenuRootDIKey } from "./di.js";
|
|
2
|
+
import _sfc_main$1 from "./contextmenu-panel.js";
|
|
3
|
+
import { Teleport, Transition, computed, createBlock, createCommentVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, provide, shallowRef, unref, withCtx, withDirectives } from "vue";
|
|
4
|
+
import { useFallbackProps } from "@veltra/compositions";
|
|
5
|
+
import { bem, withUnit, zIndex } from "@veltra/utils";
|
|
6
|
+
import { vClickOutside } from "@veltra/directives";
|
|
7
|
+
//#region src/components/contextmenu/contextmenu.vue
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
name: "Contextmenu",
|
|
10
|
+
__name: "contextmenu",
|
|
11
|
+
props: {
|
|
12
|
+
mousePosition: {},
|
|
13
|
+
width: { default: 150 },
|
|
14
|
+
menus: {},
|
|
15
|
+
size: {}
|
|
16
|
+
},
|
|
17
|
+
emits: ["destroy"],
|
|
18
|
+
setup(__props, { emit: __emit }) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const emit = __emit;
|
|
21
|
+
const { size } = useFallbackProps([props], { size: "default" });
|
|
22
|
+
const cls = bem("contextmenu");
|
|
23
|
+
const visible = shallowRef(true);
|
|
24
|
+
const style = computed(() => {
|
|
25
|
+
const { x, y } = props.mousePosition;
|
|
26
|
+
const flipX = x > window.innerWidth / 2;
|
|
27
|
+
const flipY = y > window.innerHeight / 2;
|
|
28
|
+
return {
|
|
29
|
+
width: withUnit(props.width, "px"),
|
|
30
|
+
zIndex: zIndex(),
|
|
31
|
+
...flipX ? { right: withUnit(window.innerWidth - x - 1, "px") } : { left: withUnit(x + 1, "px") },
|
|
32
|
+
...flipY ? { bottom: withUnit(window.innerHeight - y - 1, "px") } : { top: withUnit(y + 1, "px") },
|
|
33
|
+
transformOrigin: `${flipY ? "bottom" : "top"} ${flipX ? "right" : "left"}`
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
const menus = computed(() => typeof props.menus === "function" ? props.menus() : props.menus);
|
|
37
|
+
function close() {
|
|
38
|
+
visible.value = false;
|
|
39
|
+
}
|
|
40
|
+
let loading = false;
|
|
41
|
+
provide(ContextmenuRootDIKey, {
|
|
42
|
+
cls,
|
|
43
|
+
onItemClickStart: () => {
|
|
44
|
+
loading = true;
|
|
45
|
+
},
|
|
46
|
+
onItemClickEnd: () => {
|
|
47
|
+
loading = false;
|
|
48
|
+
close();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
function handleClickOutside() {
|
|
52
|
+
if (loading) return;
|
|
53
|
+
close();
|
|
54
|
+
}
|
|
55
|
+
return (_ctx, _cache) => {
|
|
56
|
+
return openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(Transition, {
|
|
57
|
+
name: "zoom-in",
|
|
58
|
+
appear: "",
|
|
59
|
+
onAfterLeave: _cache[0] || (_cache[0] = ($event) => emit("destroy"))
|
|
60
|
+
}, {
|
|
61
|
+
default: withCtx(() => [visible.value ? withDirectives((openBlock(), createBlock(_sfc_main$1, {
|
|
62
|
+
key: 0,
|
|
63
|
+
menus: menus.value,
|
|
64
|
+
class: normalizeClass([unref(cls).b, unref(cls).m(unref(size))]),
|
|
65
|
+
style: normalizeStyle(style.value)
|
|
66
|
+
}, null, 8, [
|
|
67
|
+
"menus",
|
|
68
|
+
"class",
|
|
69
|
+
"style"
|
|
70
|
+
])), [[unref(vClickOutside), handleClickOutside]]) : createCommentVNode("v-if", true)]),
|
|
71
|
+
_: 1
|
|
72
|
+
})]);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
//#endregion
|
|
77
|
+
export { _sfc_main as default };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=contextmenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextmenu.js","names":[],"sources":["../../../src/components/contextmenu/contextmenu.vue"],"sourcesContent":["<template>\n <Teleport to=\"body\">\n <transition name=\"zoom-in\" appear @after-leave=\"emit('destroy')\">\n <UContextmenuPanel\n v-if=\"visible\"\n :menus=\"menus\"\n :class=\"[cls.b, cls.m(size)]\"\n :style=\"style\"\n v-click-outside=\"handleClickOutside\"\n />\n </transition>\n </Teleport>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps } from '@veltra/compositions'\nimport { vClickOutside } from '@veltra/directives'\nimport { bem, withUnit, zIndex } from '@veltra/utils'\nimport { computed, provide, shallowRef, type CSSProperties } from 'vue'\n\nimport type { ContextmenuEmits, ContextmenuProps, ComponentSize } from '../../types'\nimport UContextmenuPanel from './contextmenu-panel.vue'\nimport { ContextmenuRootDIKey } from './di'\n\ndefineOptions({ name: 'Contextmenu' })\n\nconst props = withDefaults(defineProps<ContextmenuProps>(), { width: 150 })\n\nconst emit = defineEmits<ContextmenuEmits>()\n\nconst { size } = useFallbackProps([props], { size: 'default' as ComponentSize })\n\nconst cls = bem('contextmenu')\n\nconst visible = shallowRef(true)\n\nconst style = computed<CSSProperties>(() => {\n const { x, y } = props.mousePosition\n const flipX = x > window.innerWidth / 2\n const flipY = y > window.innerHeight / 2\n return {\n width: withUnit(props.width, 'px'),\n zIndex: zIndex(),\n ...(flipX\n ? { right: withUnit(window.innerWidth - x - 1, 'px') }\n : { left: withUnit(x + 1, 'px') }),\n ...(flipY\n ? { bottom: withUnit(window.innerHeight - y - 1, 'px') }\n : { top: withUnit(y + 1, 'px') }),\n transformOrigin: `${flipY ? 'bottom' : 'top'} ${flipX ? 'right' : 'left'}`\n }\n})\n\nconst menus = computed(() => (typeof props.menus === 'function' ? props.menus() : props.menus))\n\nfunction close() {\n visible.value = false\n}\n\nlet loading = false\n\nprovide(ContextmenuRootDIKey, {\n cls,\n onItemClickStart: () => {\n loading = true\n },\n onItemClickEnd: () => {\n loading = false\n close()\n }\n})\n\nfunction handleClickOutside() {\n if (loading) return\n close()\n}\n</script>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AA;;KAJC,OAAO,MAAA;KACP,OAAK,eAAA,CAAG,MAAA,GAAA,EAAI,GAAG,MAAA,GAAA,EAAI,EAAE,MAAA,IAAA,CAAI,CAAA,CAAA;KACzB,OAAK,eAAE,MAAA,KAAK;;;;;iCACI,kBAAkB,CAAA,CAAA,IAAA,mBAAA,QAAA,IAAA,CAAA,CAAA"}
|
package/dist/components/{context-menu/context-menu.vue.d.ts → contextmenu/contextmenu.vue.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/components/
|
|
3
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
1
|
+
import { ContextmenuProps } from "../../types/contextmenu.js";
|
|
2
|
+
//#region src/components/contextmenu/contextmenu.vue.d.ts
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<ContextmenuProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
4
|
destroy: () => any;
|
|
5
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<ContextmenuProps> & Readonly<{
|
|
6
6
|
onDestroy?: (() => any) | undefined;
|
|
7
7
|
}>, {
|
|
8
8
|
width: number | string;
|
|
@@ -10,4 +10,4 @@ declare const __VLS_export: import("vue").DefineComponent<ContextMenuProps, {},
|
|
|
10
10
|
declare const _default: typeof __VLS_export;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { _default };
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=contextmenu.vue.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/components/contextmenu/di.ts
|
|
2
|
+
const ContextmenuRootDIKey = Symbol("ContextmenuRootDIKey");
|
|
3
|
+
const ContextmenuPanelDIKey = Symbol("ContextmenuPanelDIKey");
|
|
4
|
+
//#endregion
|
|
5
|
+
export { ContextmenuPanelDIKey, ContextmenuRootDIKey };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=di.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"di.js","names":[],"sources":["../../../src/components/contextmenu/di.ts"],"sourcesContent":["import type { BEM } from '@veltra/utils'\nimport type { ComputedRef, InjectionKey } from 'vue'\n\nexport const ContextmenuRootDIKey: InjectionKey<{\n cls: BEM<'contextmenu'>\n onItemClickStart: () => void\n onItemClickEnd: () => void\n}> = Symbol('ContextmenuRootDIKey')\n\nexport const ContextmenuPanelDIKey: InjectionKey<{\n showIconColumn: ComputedRef<boolean>\n showArrowColumn: ComputedRef<boolean>\n}> = Symbol('ContextmenuPanelDIKey')\n"],"mappings":";AAGA,MAAa,uBAIR,OAAO,sBAAsB;AAElC,MAAa,wBAGR,OAAO,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","names":[],"sources":["../../../src/components/contextmenu/helper.ts"],"sourcesContent":["import type { ContextmenuItem } from '../../types'\n\nexport function getMenuDisabled(menu: ContextmenuItem): boolean {\n return (typeof menu.disabled === 'function' ? menu.disabled() : menu.disabled) ?? false\n}\n"],"mappings":";AAEA,SAAgB,gBAAgB,MAAgC;CAC9D,QAAQ,OAAO,KAAK,aAAa,aAAa,KAAK,SAAS,IAAI,KAAK,aAAa;AACpF"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/** flex布局 */
|
|
3
|
+
/**
|
|
4
|
+
* 设置css变量
|
|
5
|
+
* 参数1:变量前缀
|
|
6
|
+
* 参数2: 一个由值组成的列表或者由key, value组成的map
|
|
7
|
+
* css-var(height, (
|
|
8
|
+
* large: 40px
|
|
9
|
+
* default: 32px
|
|
10
|
+
* small: 24px
|
|
11
|
+
* ))
|
|
12
|
+
* 生成的css变量:
|
|
13
|
+
* --u-height-large: 40px;
|
|
14
|
+
* --u-height-default: 32px;
|
|
15
|
+
* --u-height-small: 24px;
|
|
16
|
+
*/
|
|
17
|
+
/** 暗色:data-theme 与系统偏好,与 UITheme.injectBuiltInThemes 选择器策略一致 */
|
|
18
|
+
.u-contextmenu {
|
|
19
|
+
position: fixed;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 4px;
|
|
22
|
+
list-style: none;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: 1px;
|
|
26
|
+
user-select: none;
|
|
27
|
+
color: var(--u-text-color-main);
|
|
28
|
+
background-color: var(--u-bg-color-top);
|
|
29
|
+
border: 1px solid var(--u-border-color);
|
|
30
|
+
border-radius: calc(var(--u-radius-default) + 2px);
|
|
31
|
+
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 20px rgba(15, 23, 42, 0.08);
|
|
32
|
+
backdrop-filter: var(--u-bg-filter);
|
|
33
|
+
-webkit-backdrop-filter: var(--u-bg-filter);
|
|
34
|
+
}
|
|
35
|
+
.u-contextmenu__label {
|
|
36
|
+
flex: 1;
|
|
37
|
+
min-width: 0;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
text-overflow: ellipsis;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
}
|
|
42
|
+
.u-contextmenu__item {
|
|
43
|
+
position: relative;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
padding: 0;
|
|
46
|
+
}
|
|
47
|
+
.u-contextmenu__item.is-disabled {
|
|
48
|
+
opacity: 0.55;
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
color: var(--u-text-color-disabled);
|
|
51
|
+
}
|
|
52
|
+
.u-contextmenu__item.is-loading {
|
|
53
|
+
opacity: 0.55;
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
color: var(--u-text-color-disabled);
|
|
56
|
+
}
|
|
57
|
+
.u-contextmenu__item.is-open::after {
|
|
58
|
+
content: "";
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 0;
|
|
61
|
+
left: 100%;
|
|
62
|
+
width: 6px;
|
|
63
|
+
height: 100%;
|
|
64
|
+
}
|
|
65
|
+
.u-contextmenu__item.is-open.is-flip-x::after {
|
|
66
|
+
left: auto;
|
|
67
|
+
right: 100%;
|
|
68
|
+
}
|
|
69
|
+
.u-contextmenu__item-content {
|
|
70
|
+
gap: 8px;
|
|
71
|
+
width: 100%;
|
|
72
|
+
padding: 0 8px;
|
|
73
|
+
min-height: 28px;
|
|
74
|
+
border-radius: calc(var(--u-radius-default) + 1px);
|
|
75
|
+
transition: background-color 0.15s ease, color 0.15s ease;
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: flex-start;
|
|
78
|
+
align-items: center;
|
|
79
|
+
flex-wrap: nowrap;
|
|
80
|
+
}
|
|
81
|
+
.u-contextmenu__item:not(.is-disabled):not(.is-loading) > .u-contextmenu__item-content:hover {
|
|
82
|
+
background-color: var(--u-menu-hover-bg);
|
|
83
|
+
color: var(--u-menu-hover-color);
|
|
84
|
+
}
|
|
85
|
+
.u-contextmenu .u-contextmenu__item.is-open:not(.is-disabled) > .u-contextmenu__item-content {
|
|
86
|
+
background-color: var(--u-menu-hover-bg);
|
|
87
|
+
color: var(--u-menu-hover-color);
|
|
88
|
+
}
|
|
89
|
+
.u-contextmenu__icon-place {
|
|
90
|
+
width: 1em;
|
|
91
|
+
flex-shrink: 0;
|
|
92
|
+
}
|
|
93
|
+
.u-contextmenu__arrow {
|
|
94
|
+
width: 12px;
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
opacity: 0.65;
|
|
98
|
+
}
|
|
99
|
+
.u-contextmenu__arrow-place {
|
|
100
|
+
width: 12px;
|
|
101
|
+
flex-shrink: 0;
|
|
102
|
+
}
|
|
103
|
+
.u-contextmenu__sub {
|
|
104
|
+
position: absolute;
|
|
105
|
+
top: 0;
|
|
106
|
+
left: 100%;
|
|
107
|
+
margin-left: -4px;
|
|
108
|
+
min-width: 120px;
|
|
109
|
+
width: max-content;
|
|
110
|
+
margin: 0;
|
|
111
|
+
padding: 4px;
|
|
112
|
+
list-style: none;
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: column;
|
|
115
|
+
gap: 1px;
|
|
116
|
+
user-select: none;
|
|
117
|
+
color: var(--u-text-color-main);
|
|
118
|
+
background-color: var(--u-bg-color-top);
|
|
119
|
+
border: 1px solid var(--u-border-color);
|
|
120
|
+
border-radius: calc(var(--u-radius-default) + 2px);
|
|
121
|
+
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 20px rgba(15, 23, 42, 0.08);
|
|
122
|
+
backdrop-filter: var(--u-bg-filter);
|
|
123
|
+
-webkit-backdrop-filter: var(--u-bg-filter);
|
|
124
|
+
}
|
|
125
|
+
.u-contextmenu__sub.is-flip-x {
|
|
126
|
+
left: auto;
|
|
127
|
+
right: 100%;
|
|
128
|
+
margin-left: 0;
|
|
129
|
+
margin-right: -4px;
|
|
130
|
+
}
|
|
131
|
+
.u-contextmenu--small {
|
|
132
|
+
font-size: var(--u-font-size-main-small);
|
|
133
|
+
}
|
|
134
|
+
.u-contextmenu--small__item-content {
|
|
135
|
+
padding: 0 var(--u-gap-small);
|
|
136
|
+
min-height: calc(var(--u-menu-height-small) - 8px);
|
|
137
|
+
border-radius: calc(var(--u-radius-small) + 1px);
|
|
138
|
+
}
|
|
139
|
+
.u-contextmenu--default {
|
|
140
|
+
font-size: var(--u-font-size-main-default);
|
|
141
|
+
}
|
|
142
|
+
.u-contextmenu--default__item-content {
|
|
143
|
+
padding: 0 var(--u-gap-default);
|
|
144
|
+
min-height: calc(var(--u-menu-height-default) - 8px);
|
|
145
|
+
border-radius: calc(var(--u-radius-default) + 1px);
|
|
146
|
+
}
|
|
147
|
+
.u-contextmenu--large {
|
|
148
|
+
font-size: var(--u-font-size-main-large);
|
|
149
|
+
}
|
|
150
|
+
.u-contextmenu--large__item-content {
|
|
151
|
+
padding: 0 var(--u-gap-large);
|
|
152
|
+
min-height: calc(var(--u-menu-height-large) - 8px);
|
|
153
|
+
border-radius: calc(var(--u-radius-large) + 1px);
|
|
154
|
+
}
|
|
@@ -5,11 +5,11 @@ declare const __VLS_export: import("vue").DefineComponent<DatePickerProps, {}, {
|
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<DatePickerProps> & Readonly<{
|
|
6
6
|
"onUpdate:modelValue"?: ((value?: string | number | Date | undefined) => any) | undefined;
|
|
7
7
|
}>, {
|
|
8
|
-
type: "date" | "month" | "year";
|
|
9
8
|
disabled: boolean;
|
|
10
|
-
|
|
9
|
+
type: "date" | "month" | "year";
|
|
11
10
|
placeholder: string;
|
|
12
11
|
clearable: boolean;
|
|
12
|
+
readonly: boolean;
|
|
13
13
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
declare const _default: typeof __VLS_export;
|
|
15
15
|
//#endregion
|