ep-craft 0.1.19 → 0.1.21
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/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/components/affix/affix.d.ts +55 -0
- package/dist/components/affix/affix.js +199 -0
- package/dist/components/affix/index.d.ts +2 -2
- package/dist/components/affix/index.js +3 -4
- package/dist/components/alert/alert.d.ts +39 -0
- package/dist/components/alert/alert.js +94 -0
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +3 -4
- package/dist/components/anchor/anchor.d.ts +54 -0
- package/dist/components/anchor/anchor.js +153 -0
- package/dist/components/anchor/index.d.ts +2 -2
- package/dist/components/anchor/index.js +3 -4
- package/dist/components/anchor-link/anchor-link.d.ts +17 -0
- package/dist/components/anchor-link/anchor-link.js +51 -0
- package/dist/components/anchor-link/index.d.ts +2 -2
- package/dist/components/anchor-link/index.js +6 -4
- package/dist/components/button/EpButton.vue.d.ts +11 -11
- package/dist/components/button/EpButton.vue.js +122 -0
- package/dist/components/button/EpButton2.vue.js +4 -0
- package/dist/components/button/button.d.ts +3 -3
- package/dist/components/button/button.js +95 -0
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +3 -4
- package/dist/components/button/use-button-custom.js +66 -0
- package/dist/components/check-tag/EpCheckTag.vue.d.ts +1 -1
- package/dist/components/check-tag/EpCheckTag.vue.js +29 -0
- package/dist/components/check-tag/EpCheckTag2.vue.js +4 -0
- package/dist/components/check-tag/check-tag.js +20 -0
- package/dist/components/check-tag/index.d.ts +2 -2
- package/dist/components/check-tag/index.js +3 -4
- package/dist/components/collapse-transition/index.d.ts +20 -3
- package/dist/components/collapse-transition/index.js +6 -4
- package/dist/components/collapse-transition/src/collapse-transition.vue.d.ts +12 -0
- package/dist/components/collapse-transition/src/collapse-transition.vue.js +55 -0
- package/dist/components/collapse-transition/src/collapse-transition2.vue.js +4 -0
- package/dist/components/config-provider/src/constants.d.ts +14 -0
- package/dist/components/config-provider/src/hooks/use-global-config.d.ts +32 -0
- package/dist/components/focus-trap/index.d.ts +81 -0
- package/dist/components/focus-trap/index.js +19 -0
- package/dist/components/focus-trap/src/focus-trap.vue.d.ts +32 -0
- package/dist/components/focus-trap/src/focus-trap.vue.js +10 -0
- package/dist/components/focus-trap/src/focus-trap2.vue.js +164 -0
- package/dist/components/focus-trap/src/tokens.d.ts +13 -0
- package/dist/components/focus-trap/src/tokens.js +17 -0
- package/dist/components/focus-trap/src/utils.d.ts +29 -0
- package/dist/components/focus-trap/src/utils.js +83 -0
- package/dist/components/form/index.d.ts +3 -0
- package/dist/components/form/index.js +4 -2
- package/dist/components/form/src/constants.d.ts +4 -0
- package/dist/components/form/src/constants.js +4 -0
- package/dist/components/form/src/hooks/use-form-common-props.d.ts +6 -0
- package/dist/components/form/src/hooks/use-form-item.d.ts +19 -0
- package/dist/components/form/src/types.d.ts +24 -0
- package/dist/components/icon/index.d.ts +21 -3
- package/dist/components/icon/index.js +7 -4
- package/dist/components/icon/src/icon.d.ts +34 -0
- package/dist/components/icon/src/icon.js +16 -0
- package/dist/components/icon/src/icon.vue.d.ts +13 -0
- package/dist/components/icon/src/icon.vue.js +36 -0
- package/dist/components/icon/src/icon2.vue.js +4 -0
- package/dist/components/menu/menu.d.ts +8 -8
- package/dist/components/popper/index.d.ts +54 -3
- package/dist/components/popper/index.js +30 -5
- package/dist/components/popper/src/arrow.d.ts +30 -0
- package/dist/components/popper/src/arrow.js +14 -0
- package/dist/components/popper/src/arrow.vue.d.ts +7 -0
- package/dist/components/popper/src/arrow.vue.js +4 -0
- package/dist/components/popper/src/arrow2.vue.js +37 -0
- package/dist/components/popper/src/composables/index.d.ts +4 -0
- package/dist/components/popper/src/composables/use-content-dom.d.ts +40 -0
- package/dist/components/popper/src/composables/use-content-dom.js +45 -0
- package/dist/components/popper/src/composables/use-content.d.ts +77 -0
- package/dist/components/popper/src/composables/use-content.js +76 -0
- package/dist/components/popper/src/composables/use-focus-trap.d.ts +12 -0
- package/dist/components/popper/src/composables/use-focus-trap.js +29 -0
- package/dist/components/popper/src/constants.d.ts +23 -0
- package/dist/components/popper/src/constants.js +5 -0
- package/dist/components/popper/src/content.d.ts +234 -0
- package/dist/components/popper/src/content.js +129 -0
- package/dist/components/popper/src/content.vue.d.ts +61 -0
- package/dist/components/popper/src/content.vue.js +4 -0
- package/dist/components/popper/src/content2.vue.js +151 -0
- package/dist/components/popper/src/popper.d.ts +35 -0
- package/dist/components/popper/src/popper.js +22 -0
- package/dist/components/popper/src/popper.vue.d.ts +22 -0
- package/dist/components/popper/src/popper.vue.js +38 -0
- package/dist/components/popper/src/popper2.vue.js +4 -0
- package/dist/components/popper/src/trigger.d.ts +130 -0
- package/dist/components/popper/src/trigger.js +36 -0
- package/dist/components/popper/src/trigger.vue.d.ts +18 -0
- package/dist/components/popper/src/trigger.vue.js +4 -0
- package/dist/components/popper/src/trigger2.vue.js +134 -0
- package/dist/components/popper/src/utils.d.ts +48 -0
- package/dist/components/popper/src/utils.js +57 -0
- package/dist/components/radio/radio.d.ts +2 -2
- package/dist/components/radio-button/radio-button.d.ts +2 -2
- package/dist/components/radio-group/radio-group.d.ts +2 -2
- package/dist/components/slot/index.d.ts +3 -0
- package/dist/components/slot/src/only-child.d.ts +7 -0
- package/dist/components/slot/src/only-child.js +55 -0
- package/dist/components/tab-pane/tab-pane.d.ts +2 -2
- package/dist/components/tabs/tabs.d.ts +2 -2
- package/dist/components/tag/EpTag.vue.d.ts +4 -4
- package/dist/components/tag/EpTag.vue.js +96 -0
- package/dist/components/tag/EpTag2.vue.js +4 -0
- package/dist/components/tag/index.d.ts +2 -2
- package/dist/components/tag/index.js +2 -3
- package/dist/components/tag/tag.js +38 -0
- package/dist/components/tooltip/index.d.ts +174 -3
- package/dist/components/tooltip/index.js +18 -5
- package/dist/components/tooltip/src/constants.d.ts +18 -0
- package/dist/components/tooltip/src/constants.js +4 -0
- package/dist/components/tooltip/src/content.d.ts +327 -0
- package/dist/components/tooltip/src/content.js +72 -0
- package/dist/components/tooltip/src/content.vue.d.ts +47 -0
- package/dist/components/tooltip/src/content.vue.js +188 -0
- package/dist/components/tooltip/src/content2.vue.js +4 -0
- package/dist/components/tooltip/src/tooltip.d.ts +346 -0
- package/dist/components/tooltip/src/tooltip.js +47 -0
- package/dist/components/tooltip/src/tooltip.vue.d.ts +90 -0
- package/dist/components/tooltip/src/tooltip.vue.js +236 -0
- package/dist/components/tooltip/src/tooltip2.vue.js +4 -0
- package/dist/components/tooltip/src/trigger.d.ts +94 -0
- package/dist/components/tooltip/src/trigger.js +41 -0
- package/dist/components/tooltip/src/trigger.vue.d.ts +26 -0
- package/dist/components/tooltip/src/trigger.vue.js +104 -0
- package/dist/components/tooltip/src/trigger2.vue.js +4 -0
- package/dist/components/tooltip/src/utils.d.ts +5 -0
- package/dist/components/tooltip/src/utils.js +9 -0
- package/dist/constants/aria.d.ts +17 -0
- package/dist/constants/aria.js +24 -0
- package/dist/constants/column-alignment.d.ts +2 -0
- package/dist/constants/date.d.ts +3 -0
- package/dist/constants/event.d.ts +3 -0
- package/dist/constants/form.d.ts +2 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/key.d.ts +1 -0
- package/dist/constants/size.d.ts +7 -0
- package/dist/constants/size.js +4 -0
- package/dist/directives/click-outside/index.d.ts +3 -0
- package/dist/directives/index.d.ts +5 -0
- package/dist/directives/mousewheel/index.d.ts +11 -0
- package/dist/directives/repeat-click/index.d.ts +17 -0
- package/dist/directives/trap-focus/index.d.ts +9 -0
- package/dist/hooks/index.d.ts +17 -0
- package/dist/hooks/use-aria/index.d.ts +37 -0
- package/dist/hooks/use-aria/index.js +24 -0
- package/dist/hooks/use-delayed-toggle/index.d.ts +36 -0
- package/dist/hooks/use-delayed-toggle/index.js +63 -0
- package/dist/hooks/use-deprecated/index.d.ts +11 -0
- package/dist/hooks/use-empty-values/index.d.ts +29 -0
- package/dist/hooks/use-empty-values/index.js +23 -0
- package/dist/hooks/use-escape-keydown/index.d.ts +1 -0
- package/dist/hooks/use-escape-keydown/index.js +21 -0
- package/dist/hooks/use-forward-ref/index.d.ts +9 -0
- package/dist/hooks/use-forward-ref/index.js +23 -0
- package/dist/hooks/use-id/index.d.ts +8 -0
- package/dist/hooks/use-id/index.js +27 -0
- package/dist/hooks/use-locale/index.d.ts +17 -0
- package/dist/hooks/use-model-toggle/index.d.ts +46 -0
- package/dist/hooks/use-model-toggle/index.js +67 -0
- package/dist/hooks/use-namespace/index.d.ts +23 -0
- package/dist/hooks/use-namespace/index.js +45 -0
- package/dist/hooks/use-ordered-children/index.d.ts +14 -0
- package/dist/hooks/use-popper/index.d.ts +78 -0
- package/dist/hooks/use-popper/index.js +97 -0
- package/dist/hooks/use-popper-container/index.d.ts +8 -0
- package/dist/hooks/use-popper-container/index.js +26 -0
- package/dist/hooks/use-prop/index.d.ts +2 -0
- package/dist/hooks/use-size/index.d.ts +21 -0
- package/dist/hooks/use-size/index.js +8 -0
- package/dist/hooks/use-timeout/index.d.ts +4 -0
- package/dist/hooks/use-timeout/index.js +16 -0
- package/dist/hooks/use-z-index/index.d.ts +13 -0
- package/dist/hooks/use-z-index/index.js +27 -0
- package/dist/node_modules/.pnpm/element-plus@2.14.3_vue@3.5.40_typescript@5.9.3_/node_modules/element-plus/es/components/anchor/src/anchor.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/node_modules/.pnpm/element-plus@2.14.3_vue@3.5.40_typescript@5.9.3_/node_modules/element-plus/es/components/button/index.js +2 -2
- package/dist/resolver.js +13 -12
- package/dist/utils/arrays.d.ts +6 -0
- package/dist/utils/arrays.js +5 -0
- package/dist/utils/browser.d.ts +4 -0
- package/dist/utils/browser.js +6 -0
- package/dist/utils/dom/aria.d.ts +26 -0
- package/dist/utils/dom/aria.js +26 -0
- package/dist/utils/dom/element.d.ts +3 -0
- package/dist/utils/dom/event.d.ts +8 -0
- package/dist/utils/dom/event.js +32 -0
- package/dist/utils/dom/index.d.ts +7 -0
- package/dist/utils/dom/position.d.ts +7 -0
- package/dist/utils/dom/scroll.d.ts +11 -0
- package/dist/utils/dom/style.d.ts +9 -0
- package/dist/utils/dom/style.js +15 -0
- package/dist/utils/easings.d.ts +1 -0
- package/dist/utils/error.d.ts +3 -0
- package/dist/utils/error.js +15 -0
- package/dist/utils/functions.d.ts +2 -0
- package/dist/utils/i18n.d.ts +4 -0
- package/dist/utils/index.d.ts +31 -0
- package/dist/utils/numbers.d.ts +6 -0
- package/dist/utils/objects.d.ts +7 -0
- package/dist/utils/raf.d.ts +2 -0
- package/dist/utils/rand.d.ts +12 -0
- package/dist/utils/strings.d.ts +8 -0
- package/dist/utils/throttleByRaf.d.ts +4 -0
- package/dist/utils/types.d.ts +9 -0
- package/dist/utils/types.js +16 -0
- package/dist/utils/typescript.d.ts +93 -0
- package/dist/utils/vue/global-node.d.ts +3 -0
- package/dist/utils/vue/icon.d.ts +27 -0
- package/dist/utils/vue/index.d.ts +9 -0
- package/dist/utils/vue/install.d.ts +7 -0
- package/dist/utils/vue/install.js +34 -0
- package/dist/utils/vue/props/index.d.ts +2 -0
- package/dist/utils/vue/props/runtime.d.ts +29 -0
- package/dist/utils/vue/props/runtime.js +36 -0
- package/dist/utils/vue/props/types.d.ts +85 -0
- package/dist/utils/vue/props/util.d.ts +7 -0
- package/dist/utils/vue/refs.d.ts +2 -0
- package/dist/utils/vue/size.d.ts +2 -0
- package/dist/utils/vue/typescript.d.ts +25 -0
- package/dist/utils/vue/validator.d.ts +3 -0
- package/dist/utils/vue/vnode.d.ts +48 -0
- package/dist/vendored-components.d.ts +13 -0
- package/dist/vendored-components.js +22 -0
- package/package.json +11 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineComponent as d, openBlock as s, createBlock as i, Transition as n, mergeProps as r, unref as p, toHandlers as l, withCtx as g, renderSlot as m } from "vue";
|
|
2
|
+
import { useNamespace as f } from "../../../hooks/use-namespace/index.js";
|
|
3
|
+
import "../../../hooks/use-size/index.js";
|
|
4
|
+
import "../../../hooks/use-z-index/index.js";
|
|
5
|
+
import "../../../hooks/use-delayed-toggle/index.js";
|
|
6
|
+
import "../../../hooks/use-aria/index.js";
|
|
7
|
+
import "../../../hooks/use-model-toggle/index.js";
|
|
8
|
+
import "../../../hooks/use-empty-values/index.js";
|
|
9
|
+
const P = /* @__PURE__ */ d({
|
|
10
|
+
name: "ElCollapseTransition",
|
|
11
|
+
__name: "collapse-transition",
|
|
12
|
+
setup(y) {
|
|
13
|
+
const a = f("collapse-transition"), o = (t) => {
|
|
14
|
+
t.style.maxHeight = "", t.style.overflow = t.dataset.oldOverflow, t.style.paddingTop = t.dataset.oldPaddingTop, t.style.paddingBottom = t.dataset.oldPaddingBottom;
|
|
15
|
+
}, e = {
|
|
16
|
+
beforeEnter(t) {
|
|
17
|
+
t.dataset || (t.dataset = {}), t.dataset.oldPaddingTop = t.style.paddingTop, t.dataset.oldPaddingBottom = t.style.paddingBottom, t.style.height && (t.dataset.elExistsHeight = t.style.height), t.style.maxHeight = 0, t.style.paddingTop = 0, t.style.paddingBottom = 0;
|
|
18
|
+
},
|
|
19
|
+
enter(t) {
|
|
20
|
+
requestAnimationFrame(() => {
|
|
21
|
+
t.dataset.oldOverflow = t.style.overflow, t.dataset.elExistsHeight ? t.style.maxHeight = t.dataset.elExistsHeight : t.scrollHeight !== 0 ? t.style.maxHeight = `${t.scrollHeight}px` : t.style.maxHeight = 0, t.style.paddingTop = t.dataset.oldPaddingTop, t.style.paddingBottom = t.dataset.oldPaddingBottom, t.style.overflow = "hidden";
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
afterEnter(t) {
|
|
25
|
+
t.style.maxHeight = "", t.style.overflow = t.dataset.oldOverflow;
|
|
26
|
+
},
|
|
27
|
+
enterCancelled(t) {
|
|
28
|
+
o(t);
|
|
29
|
+
},
|
|
30
|
+
beforeLeave(t) {
|
|
31
|
+
t.dataset || (t.dataset = {}), t.dataset.oldPaddingTop = t.style.paddingTop, t.dataset.oldPaddingBottom = t.style.paddingBottom, t.dataset.oldOverflow = t.style.overflow, t.style.maxHeight = `${t.scrollHeight}px`, t.style.overflow = "hidden";
|
|
32
|
+
},
|
|
33
|
+
leave(t) {
|
|
34
|
+
t.scrollHeight !== 0 && (t.style.maxHeight = 0, t.style.paddingTop = 0, t.style.paddingBottom = 0);
|
|
35
|
+
},
|
|
36
|
+
afterLeave(t) {
|
|
37
|
+
o(t);
|
|
38
|
+
},
|
|
39
|
+
leaveCancelled(t) {
|
|
40
|
+
o(t);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (t, h) => (s(), i(n, r({
|
|
44
|
+
name: p(a).b()
|
|
45
|
+
}, l(e)), {
|
|
46
|
+
default: g(() => [
|
|
47
|
+
m(t.$slots, "default")
|
|
48
|
+
]),
|
|
49
|
+
_: 3
|
|
50
|
+
}, 16, ["name"]));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
P as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import type { Language } from '@element-plus/locale';
|
|
3
|
+
import type { ComponentSize } from '@element-plus/constants';
|
|
4
|
+
import type { UseEmptyValuesProps } from '@element-plus/hooks';
|
|
5
|
+
export type ConfigProviderContext = {
|
|
6
|
+
namespace?: string;
|
|
7
|
+
locale?: Language;
|
|
8
|
+
size?: ComponentSize;
|
|
9
|
+
zIndex?: number;
|
|
10
|
+
emptyValues?: UseEmptyValuesProps['emptyValues'];
|
|
11
|
+
valueOnClear?: UseEmptyValuesProps['valueOnClear'];
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
export declare const configProviderContextKey: InjectionKey<Ref<ConfigProviderContext>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { App, MaybeRef, Ref } from 'vue';
|
|
2
|
+
import type { ConfigProviderContext } from '../constants';
|
|
3
|
+
export declare function useGlobalConfig<K extends keyof ConfigProviderContext, D extends ConfigProviderContext[K]>(key: K, defaultValue?: D): Ref<Exclude<ConfigProviderContext[K], undefined> | D>;
|
|
4
|
+
export declare function useGlobalConfig(): Ref<ConfigProviderContext>;
|
|
5
|
+
export declare function useGlobalComponentSettings(block: string, sizeFallback?: MaybeRef<ConfigProviderContext['size']>): {
|
|
6
|
+
ns: {
|
|
7
|
+
namespace: import("vue").ComputedRef<string>;
|
|
8
|
+
b: (blockSuffix?: string) => string;
|
|
9
|
+
e: (element?: string) => string;
|
|
10
|
+
m: (modifier?: string) => string;
|
|
11
|
+
be: (blockSuffix?: string, element?: string) => string;
|
|
12
|
+
em: (element?: string, modifier?: string) => string;
|
|
13
|
+
bm: (blockSuffix?: string, modifier?: string) => string;
|
|
14
|
+
bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
|
|
15
|
+
is: {
|
|
16
|
+
(name: string, state: boolean | undefined): string;
|
|
17
|
+
(name: string): string;
|
|
18
|
+
};
|
|
19
|
+
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
20
|
+
cssVarName: (name: string) => string;
|
|
21
|
+
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
22
|
+
cssVarBlockName: (name: string) => string;
|
|
23
|
+
};
|
|
24
|
+
locale: import("@element-plus/hooks").LocaleContext;
|
|
25
|
+
zIndex: {
|
|
26
|
+
initialZIndex: import("vue").ComputedRef<number>;
|
|
27
|
+
currentZIndex: import("vue").ComputedRef<number>;
|
|
28
|
+
nextZIndex: () => number;
|
|
29
|
+
};
|
|
30
|
+
size: import("vue").ComputedRef<"" | "default" | "small" | "large">;
|
|
31
|
+
};
|
|
32
|
+
export declare const provideGlobalConfig: (config: MaybeRef<ConfigProviderContext>, app?: App, global?: boolean) => import("vue").ComputedRef<ConfigProviderContext> | undefined;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import ElFocusTrap from './src/focus-trap.vue';
|
|
2
|
+
export { ElFocusTrap };
|
|
3
|
+
export declare const EpFocusTrap: {
|
|
4
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
5
|
+
loop: BooleanConstructor;
|
|
6
|
+
trapped: BooleanConstructor;
|
|
7
|
+
focusTrapEl: import("vue").PropType<HTMLElement>;
|
|
8
|
+
focusStartEl: {
|
|
9
|
+
type: import("vue").PropType<"container" | "first" | HTMLElement>;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
}>> & Readonly<{
|
|
13
|
+
onFocusin?: ((...args: any[]) => any) | undefined;
|
|
14
|
+
onFocusout?: ((...args: any[]) => any) | undefined;
|
|
15
|
+
onFocusAfterTrapped?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
onFocusAfterReleased?: ((...args: any[]) => any) | undefined;
|
|
17
|
+
"onFocusout-prevented"?: ((...args: any[]) => any) | undefined;
|
|
18
|
+
"onRelease-requested"?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
onKeydown: (e: KeyboardEvent) => void;
|
|
21
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focusin" | "focusout" | "focusAfterTrapped" | "focusAfterReleased" | "focusout-prevented" | "release-requested")[], import("vue").PublicProps, {
|
|
22
|
+
loop: boolean;
|
|
23
|
+
trapped: boolean;
|
|
24
|
+
focusStartEl: HTMLElement | "first" | "container";
|
|
25
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
26
|
+
P: {};
|
|
27
|
+
B: {};
|
|
28
|
+
D: {};
|
|
29
|
+
C: {};
|
|
30
|
+
M: {};
|
|
31
|
+
Defaults: {};
|
|
32
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
33
|
+
loop: BooleanConstructor;
|
|
34
|
+
trapped: BooleanConstructor;
|
|
35
|
+
focusTrapEl: import("vue").PropType<HTMLElement>;
|
|
36
|
+
focusStartEl: {
|
|
37
|
+
type: import("vue").PropType<"container" | "first" | HTMLElement>;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
}>> & Readonly<{
|
|
41
|
+
onFocusin?: ((...args: any[]) => any) | undefined;
|
|
42
|
+
onFocusout?: ((...args: any[]) => any) | undefined;
|
|
43
|
+
onFocusAfterTrapped?: ((...args: any[]) => any) | undefined;
|
|
44
|
+
onFocusAfterReleased?: ((...args: any[]) => any) | undefined;
|
|
45
|
+
"onFocusout-prevented"?: ((...args: any[]) => any) | undefined;
|
|
46
|
+
"onRelease-requested"?: ((...args: any[]) => any) | undefined;
|
|
47
|
+
}>, {
|
|
48
|
+
onKeydown: (e: KeyboardEvent) => void;
|
|
49
|
+
}, {}, {}, {}, {
|
|
50
|
+
loop: boolean;
|
|
51
|
+
trapped: boolean;
|
|
52
|
+
focusStartEl: HTMLElement | "first" | "container";
|
|
53
|
+
}>;
|
|
54
|
+
__isFragment?: never;
|
|
55
|
+
__isTeleport?: never;
|
|
56
|
+
__isSuspense?: never;
|
|
57
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
58
|
+
loop: BooleanConstructor;
|
|
59
|
+
trapped: BooleanConstructor;
|
|
60
|
+
focusTrapEl: import("vue").PropType<HTMLElement>;
|
|
61
|
+
focusStartEl: {
|
|
62
|
+
type: import("vue").PropType<"container" | "first" | HTMLElement>;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
}>> & Readonly<{
|
|
66
|
+
onFocusin?: ((...args: any[]) => any) | undefined;
|
|
67
|
+
onFocusout?: ((...args: any[]) => any) | undefined;
|
|
68
|
+
onFocusAfterTrapped?: ((...args: any[]) => any) | undefined;
|
|
69
|
+
onFocusAfterReleased?: ((...args: any[]) => any) | undefined;
|
|
70
|
+
"onFocusout-prevented"?: ((...args: any[]) => any) | undefined;
|
|
71
|
+
"onRelease-requested"?: ((...args: any[]) => any) | undefined;
|
|
72
|
+
}>, {
|
|
73
|
+
onKeydown: (e: KeyboardEvent) => void;
|
|
74
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focusin" | "focusout" | "focusAfterTrapped" | "focusAfterReleased" | "focusout-prevented" | "release-requested")[], "focusin" | "focusout" | "focusAfterTrapped" | "focusAfterReleased" | "focusout-prevented" | "release-requested", {
|
|
75
|
+
loop: boolean;
|
|
76
|
+
trapped: boolean;
|
|
77
|
+
focusStartEl: HTMLElement | "first" | "container";
|
|
78
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin;
|
|
79
|
+
export default EpFocusTrap;
|
|
80
|
+
export * from './src/tokens';
|
|
81
|
+
export * from './src/utils';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { withInstall as e } from "../../utils/with-install.js";
|
|
2
|
+
import s from "./src/focus-trap.vue.js";
|
|
3
|
+
import { createFocusOutPreventedEvent as u, focusFirstDescendant as n, focusableStack as l, getEdges as i, getVisibleElement as p, isFocusCausedByUserEvent as F, isHidden as d, obtainAllFocusableElements as f, tryFocus as m, useFocusReason as E } from "./src/utils.js";
|
|
4
|
+
const r = e(s, "ep-focus-trap");
|
|
5
|
+
export {
|
|
6
|
+
s as ElFocusTrap,
|
|
7
|
+
r as EpFocusTrap,
|
|
8
|
+
u as createFocusOutPreventedEvent,
|
|
9
|
+
r as default,
|
|
10
|
+
n as focusFirstDescendant,
|
|
11
|
+
l as focusableStack,
|
|
12
|
+
i as getEdges,
|
|
13
|
+
p as getVisibleElement,
|
|
14
|
+
F as isFocusCausedByUserEvent,
|
|
15
|
+
d as isHidden,
|
|
16
|
+
f as obtainAllFocusableElements,
|
|
17
|
+
m as tryFocus,
|
|
18
|
+
E as useFocusReason
|
|
19
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
loop: BooleanConstructor;
|
|
4
|
+
trapped: BooleanConstructor;
|
|
5
|
+
focusTrapEl: PropType<HTMLElement>;
|
|
6
|
+
focusStartEl: {
|
|
7
|
+
type: PropType<"container" | "first" | HTMLElement>;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
}>, {
|
|
11
|
+
onKeydown: (e: KeyboardEvent) => void;
|
|
12
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focusin" | "focusout" | "focusAfterTrapped" | "focusAfterReleased" | "focusout-prevented" | "release-requested")[], "focusin" | "focusout" | "focusAfterTrapped" | "focusAfterReleased" | "focusout-prevented" | "release-requested", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
loop: BooleanConstructor;
|
|
14
|
+
trapped: BooleanConstructor;
|
|
15
|
+
focusTrapEl: PropType<HTMLElement>;
|
|
16
|
+
focusStartEl: {
|
|
17
|
+
type: PropType<"container" | "first" | HTMLElement>;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{
|
|
21
|
+
onFocusin?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
onFocusout?: ((...args: any[]) => any) | undefined;
|
|
23
|
+
onFocusAfterTrapped?: ((...args: any[]) => any) | undefined;
|
|
24
|
+
onFocusAfterReleased?: ((...args: any[]) => any) | undefined;
|
|
25
|
+
"onFocusout-prevented"?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
"onRelease-requested"?: ((...args: any[]) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
loop: boolean;
|
|
29
|
+
trapped: boolean;
|
|
30
|
+
focusStartEl: HTMLElement | "first" | "container";
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import r from "./focus-trap2.vue.js";
|
|
2
|
+
import { renderSlot as e } from "vue";
|
|
3
|
+
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
function n(o, s, p, a, d, f) {
|
|
5
|
+
return e(o.$slots, "default", { handleKeydown: o.onKeydown });
|
|
6
|
+
}
|
|
7
|
+
const l = /* @__PURE__ */ t(r, [["render", n]]);
|
|
8
|
+
export {
|
|
9
|
+
l as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { defineComponent as w, ref as V, provide as j, watch as g, unref as m, onMounted as q, onBeforeUnmount as x, nextTick as I } from "vue";
|
|
2
|
+
import { EVENT_CODE as J } from "../../../constants/aria.js";
|
|
3
|
+
import { isString as M } from "../../../node_modules/.pnpm/@vue_shared@3.5.40/node_modules/@vue/shared/dist/shared.esm-bundler.js";
|
|
4
|
+
import { getEventCode as Y } from "../../../utils/dom/event.js";
|
|
5
|
+
import "../../../hooks/use-size/index.js";
|
|
6
|
+
import "../../../hooks/use-z-index/index.js";
|
|
7
|
+
import "../../../hooks/use-delayed-toggle/index.js";
|
|
8
|
+
import "../../../hooks/use-aria/index.js";
|
|
9
|
+
import "../../../hooks/use-model-toggle/index.js";
|
|
10
|
+
import "../../../hooks/use-empty-values/index.js";
|
|
11
|
+
import { useEscapeKeydown as z } from "../../../hooks/use-escape-keydown/index.js";
|
|
12
|
+
import { useFocusReason as G, tryFocus as f, createFocusOutPreventedEvent as T, getEdges as H, focusableStack as U, focusFirstDescendant as Q, obtainAllFocusableElements as W, isFocusCausedByUserEvent as X } from "./utils.js";
|
|
13
|
+
import { ON_TRAP_FOCUS_EVT as K, ON_RELEASE_FOCUS_EVT as k, FOCUS_TRAP_INJECTION_KEY as Z, FOCUS_AFTER_TRAPPED as y, FOCUS_AFTER_TRAPPED_OPTS as N, FOCUS_AFTER_RELEASED as L } from "./tokens.js";
|
|
14
|
+
import $ from "../../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isNil.js";
|
|
15
|
+
const me = w({
|
|
16
|
+
name: "ElFocusTrap",
|
|
17
|
+
inheritAttrs: !1,
|
|
18
|
+
props: {
|
|
19
|
+
loop: Boolean,
|
|
20
|
+
trapped: Boolean,
|
|
21
|
+
focusTrapEl: Object,
|
|
22
|
+
focusStartEl: {
|
|
23
|
+
type: [Object, String],
|
|
24
|
+
default: "first"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
emits: [
|
|
28
|
+
K,
|
|
29
|
+
k,
|
|
30
|
+
"focusin",
|
|
31
|
+
"focusout",
|
|
32
|
+
"focusout-prevented",
|
|
33
|
+
"release-requested"
|
|
34
|
+
],
|
|
35
|
+
setup(n, { emit: u }) {
|
|
36
|
+
const o = V();
|
|
37
|
+
let d, v;
|
|
38
|
+
const { focusReason: l } = G();
|
|
39
|
+
z((e) => {
|
|
40
|
+
n.trapped && !i.paused && u("release-requested", e);
|
|
41
|
+
});
|
|
42
|
+
const i = {
|
|
43
|
+
paused: !1,
|
|
44
|
+
pause() {
|
|
45
|
+
this.paused = !0;
|
|
46
|
+
},
|
|
47
|
+
resume() {
|
|
48
|
+
this.paused = !1;
|
|
49
|
+
}
|
|
50
|
+
}, p = (e) => {
|
|
51
|
+
if (!n.loop && !n.trapped || i.paused) return;
|
|
52
|
+
const { altKey: t, ctrlKey: s, metaKey: r, currentTarget: a, shiftKey: _ } = e, { loop: D } = n, B = Y(e) === J.tab && !t && !s && !r, E = document.activeElement;
|
|
53
|
+
if (B && E) {
|
|
54
|
+
const C = a, [O, b] = H(C);
|
|
55
|
+
if (O && b) {
|
|
56
|
+
if (!_ && E === b) {
|
|
57
|
+
const c = T({
|
|
58
|
+
focusReason: l.value
|
|
59
|
+
});
|
|
60
|
+
u("focusout-prevented", c), c.defaultPrevented || (e.preventDefault(), D && f(O, !0));
|
|
61
|
+
} else if (_ && [O, C].includes(E)) {
|
|
62
|
+
const c = T({
|
|
63
|
+
focusReason: l.value
|
|
64
|
+
});
|
|
65
|
+
u("focusout-prevented", c), c.defaultPrevented || (e.preventDefault(), D && f(b, !0));
|
|
66
|
+
}
|
|
67
|
+
} else if (E === C) {
|
|
68
|
+
const c = T({
|
|
69
|
+
focusReason: l.value
|
|
70
|
+
});
|
|
71
|
+
u("focusout-prevented", c), c.defaultPrevented || e.preventDefault();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
j(Z, {
|
|
76
|
+
focusTrapRef: o,
|
|
77
|
+
onKeydown: p
|
|
78
|
+
}), g(
|
|
79
|
+
() => n.focusTrapEl,
|
|
80
|
+
(e) => {
|
|
81
|
+
e && (o.value = e);
|
|
82
|
+
},
|
|
83
|
+
{ immediate: !0 }
|
|
84
|
+
), g([o], ([e], [t]) => {
|
|
85
|
+
e && (e.addEventListener("keydown", p), e.addEventListener("focusin", F), e.addEventListener("focusout", P)), t && (t.removeEventListener("keydown", p), t.removeEventListener("focusin", F), t.removeEventListener("focusout", P));
|
|
86
|
+
});
|
|
87
|
+
const S = (e) => {
|
|
88
|
+
u(K, e);
|
|
89
|
+
}, A = (e) => u(k, e), F = (e) => {
|
|
90
|
+
const t = m(o);
|
|
91
|
+
if (!t) return;
|
|
92
|
+
const s = e.target, r = e.relatedTarget, a = s && t.contains(s);
|
|
93
|
+
n.trapped || r && t.contains(r) || (d = r), a && u("focusin", e), !i.paused && n.trapped && (a ? v = s : f(v, !0));
|
|
94
|
+
}, P = (e) => {
|
|
95
|
+
const t = m(o);
|
|
96
|
+
if (!(i.paused || !t))
|
|
97
|
+
if (n.trapped) {
|
|
98
|
+
const s = e.relatedTarget;
|
|
99
|
+
!$(s) && !t.contains(s) && setTimeout(() => {
|
|
100
|
+
if (!i.paused && n.trapped) {
|
|
101
|
+
const r = T({
|
|
102
|
+
focusReason: l.value
|
|
103
|
+
});
|
|
104
|
+
u("focusout-prevented", r), r.defaultPrevented || f(v, !0);
|
|
105
|
+
}
|
|
106
|
+
}, 0);
|
|
107
|
+
} else {
|
|
108
|
+
const s = e.target;
|
|
109
|
+
s && t.contains(s) || u("focusout", e);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
async function R() {
|
|
113
|
+
await I();
|
|
114
|
+
const e = m(o);
|
|
115
|
+
if (e) {
|
|
116
|
+
U.push(i);
|
|
117
|
+
const t = e.contains(
|
|
118
|
+
document.activeElement
|
|
119
|
+
) ? d : document.activeElement;
|
|
120
|
+
if (d = t, !e.contains(t)) {
|
|
121
|
+
const r = new Event(
|
|
122
|
+
y,
|
|
123
|
+
N
|
|
124
|
+
);
|
|
125
|
+
e.addEventListener(y, S), e.dispatchEvent(r), r.defaultPrevented || I(() => {
|
|
126
|
+
let a = n.focusStartEl;
|
|
127
|
+
M(a) || (f(a), document.activeElement !== a && (a = "first")), a === "first" && Q(
|
|
128
|
+
W(e),
|
|
129
|
+
!0
|
|
130
|
+
), (document.activeElement === t || a === "container") && f(e);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function h() {
|
|
136
|
+
const e = m(o);
|
|
137
|
+
if (e) {
|
|
138
|
+
e.removeEventListener(y, S);
|
|
139
|
+
const t = new CustomEvent(L, {
|
|
140
|
+
...N,
|
|
141
|
+
detail: {
|
|
142
|
+
focusReason: l.value
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
e.addEventListener(L, A), e.dispatchEvent(t), !t.defaultPrevented && (l.value == "keyboard" || !X() || e.contains(document.activeElement)) && f(d ?? document.body), e.removeEventListener(L, A), U.remove(i), d = null, v = null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return q(() => {
|
|
149
|
+
n.trapped && R(), g(
|
|
150
|
+
() => n.trapped,
|
|
151
|
+
(e) => {
|
|
152
|
+
e ? R() : h();
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}), x(() => {
|
|
156
|
+
n.trapped && h(), o.value && (o.value.removeEventListener("keydown", p), o.value.removeEventListener("focusin", F), o.value.removeEventListener("focusout", P), o.value = void 0), d = null, v = null;
|
|
157
|
+
}), {
|
|
158
|
+
onKeydown: p
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
export {
|
|
163
|
+
me as default
|
|
164
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from 'vue';
|
|
2
|
+
export declare const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
|
|
3
|
+
export declare const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
|
|
4
|
+
export declare const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
|
|
5
|
+
export declare const FOCUS_AFTER_TRAPPED_OPTS: EventInit;
|
|
6
|
+
export declare const FOCUSOUT_PREVENTED_OPTS: EventInit;
|
|
7
|
+
export declare const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
|
|
8
|
+
export declare const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
|
|
9
|
+
export type FocusTrapInjectionContext = {
|
|
10
|
+
focusTrapRef: Ref<HTMLElement | undefined>;
|
|
11
|
+
onKeydown: (e: KeyboardEvent) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const FOCUS_TRAP_INJECTION_KEY: InjectionKey<FocusTrapInjectionContext>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const e = "focus-trap.focus-after-trapped", s = "focus-trap.focus-after-released", c = "focus-trap.focusout-prevented", t = {
|
|
2
|
+
cancelable: !0,
|
|
3
|
+
bubbles: !1
|
|
4
|
+
}, E = {
|
|
5
|
+
cancelable: !0,
|
|
6
|
+
bubbles: !1
|
|
7
|
+
}, o = "focusAfterTrapped", _ = "focusAfterReleased", T = Symbol("elFocusTrap");
|
|
8
|
+
export {
|
|
9
|
+
c as FOCUSOUT_PREVENTED,
|
|
10
|
+
E as FOCUSOUT_PREVENTED_OPTS,
|
|
11
|
+
s as FOCUS_AFTER_RELEASED,
|
|
12
|
+
e as FOCUS_AFTER_TRAPPED,
|
|
13
|
+
t as FOCUS_AFTER_TRAPPED_OPTS,
|
|
14
|
+
T as FOCUS_TRAP_INJECTION_KEY,
|
|
15
|
+
_ as ON_RELEASE_FOCUS_EVT,
|
|
16
|
+
o as ON_TRAP_FOCUS_EVT
|
|
17
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const focusReason: import("vue").Ref<"pointer" | "keyboard" | undefined, "pointer" | "keyboard" | undefined>;
|
|
2
|
+
declare const lastUserFocusTimestamp: import("vue").Ref<number, number>;
|
|
3
|
+
declare const lastAutomatedFocusTimestamp: import("vue").Ref<number, number>;
|
|
4
|
+
export type FocusLayer = {
|
|
5
|
+
paused: boolean;
|
|
6
|
+
pause: () => void;
|
|
7
|
+
resume: () => void;
|
|
8
|
+
};
|
|
9
|
+
export type FocusStack = FocusLayer[];
|
|
10
|
+
export declare const obtainAllFocusableElements: (element: HTMLElement) => HTMLElement[];
|
|
11
|
+
export declare const getVisibleElement: (elements: HTMLElement[], container: HTMLElement) => HTMLElement | undefined;
|
|
12
|
+
export declare const isHidden: (element: HTMLElement, container: HTMLElement) => boolean;
|
|
13
|
+
export declare const getEdges: (container: HTMLElement) => (HTMLElement | undefined)[];
|
|
14
|
+
export declare const tryFocus: (element?: HTMLElement | {
|
|
15
|
+
focus: () => void;
|
|
16
|
+
} | null, shouldSelect?: boolean) => void;
|
|
17
|
+
export declare const focusFirstDescendant: (elements: HTMLElement[], shouldSelect?: boolean) => void;
|
|
18
|
+
export declare const focusableStack: {
|
|
19
|
+
push: (layer: FocusLayer) => void;
|
|
20
|
+
remove: (layer: FocusLayer) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare const isFocusCausedByUserEvent: () => boolean;
|
|
23
|
+
export declare const useFocusReason: () => {
|
|
24
|
+
focusReason: typeof focusReason;
|
|
25
|
+
lastUserFocusTimestamp: typeof lastUserFocusTimestamp;
|
|
26
|
+
lastAutomatedFocusTimestamp: typeof lastAutomatedFocusTimestamp;
|
|
27
|
+
};
|
|
28
|
+
export declare const createFocusOutPreventedEvent: (detail: CustomEventInit["detail"]) => CustomEvent<any>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ref as i, onMounted as v, onBeforeUnmount as p } from "vue";
|
|
2
|
+
import { focusElement as F } from "../../../utils/dom/aria.js";
|
|
3
|
+
import { FOCUSOUT_PREVENTED as w, FOCUSOUT_PREVENTED_OPTS as T } from "./tokens.js";
|
|
4
|
+
const a = i(), u = i(0), d = i(0);
|
|
5
|
+
let r = 0;
|
|
6
|
+
const N = (e) => {
|
|
7
|
+
const n = [], o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
8
|
+
acceptNode: (t) => {
|
|
9
|
+
const s = t.tagName === "INPUT" && t.type === "hidden";
|
|
10
|
+
return t.disabled || t.hidden || s ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 || t === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
for (; o.nextNode(); ) n.push(o.currentNode);
|
|
14
|
+
return n;
|
|
15
|
+
}, m = (e, n) => {
|
|
16
|
+
for (const o of e)
|
|
17
|
+
if (!y(o, n)) return o;
|
|
18
|
+
}, y = (e, n) => {
|
|
19
|
+
if (process.env.NODE_ENV === "test") return !1;
|
|
20
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
21
|
+
for (; e; ) {
|
|
22
|
+
if (n && e === n) return !1;
|
|
23
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
24
|
+
e = e.parentElement;
|
|
25
|
+
}
|
|
26
|
+
return !1;
|
|
27
|
+
}, C = (e) => {
|
|
28
|
+
const n = N(e), o = m(n, e), t = m(n.reverse(), e);
|
|
29
|
+
return [o, t];
|
|
30
|
+
}, S = (e) => e instanceof HTMLInputElement && "select" in e, L = (e, n) => {
|
|
31
|
+
if (e) {
|
|
32
|
+
const o = document.activeElement;
|
|
33
|
+
F(e, { preventScroll: !0 }), d.value = window.performance.now(), e !== o && S(e) && n && e.select();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
function f(e, n) {
|
|
37
|
+
const o = [...e], t = e.indexOf(n);
|
|
38
|
+
return t !== -1 && o.splice(t, 1), o;
|
|
39
|
+
}
|
|
40
|
+
const b = () => {
|
|
41
|
+
let e = [];
|
|
42
|
+
return {
|
|
43
|
+
push: (t) => {
|
|
44
|
+
const s = e[0];
|
|
45
|
+
s && t !== s && s.pause(), e = f(e, t), e.unshift(t);
|
|
46
|
+
},
|
|
47
|
+
remove: (t) => {
|
|
48
|
+
var s, l;
|
|
49
|
+
e = f(e, t), (l = (s = e[0]) == null ? void 0 : s.resume) == null || l.call(s);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}, I = (e, n = !1) => {
|
|
53
|
+
const o = document.activeElement;
|
|
54
|
+
for (const t of e)
|
|
55
|
+
if (L(t, n), document.activeElement !== o) return;
|
|
56
|
+
}, O = b(), P = () => u.value > d.value, c = () => {
|
|
57
|
+
a.value = "pointer", u.value = window.performance.now();
|
|
58
|
+
}, E = () => {
|
|
59
|
+
a.value = "keyboard", u.value = window.performance.now();
|
|
60
|
+
}, U = () => (v(() => {
|
|
61
|
+
r === 0 && (document.addEventListener("mousedown", c), document.addEventListener("touchstart", c), document.addEventListener("keydown", E)), r++;
|
|
62
|
+
}), p(() => {
|
|
63
|
+
r--, r <= 0 && (document.removeEventListener("mousedown", c), document.removeEventListener("touchstart", c), document.removeEventListener("keydown", E));
|
|
64
|
+
}), {
|
|
65
|
+
focusReason: a,
|
|
66
|
+
lastUserFocusTimestamp: u,
|
|
67
|
+
lastAutomatedFocusTimestamp: d
|
|
68
|
+
}), _ = (e) => new CustomEvent(w, {
|
|
69
|
+
...T,
|
|
70
|
+
detail: e
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
_ as createFocusOutPreventedEvent,
|
|
74
|
+
I as focusFirstDescendant,
|
|
75
|
+
O as focusableStack,
|
|
76
|
+
C as getEdges,
|
|
77
|
+
m as getVisibleElement,
|
|
78
|
+
P as isFocusCausedByUserEvent,
|
|
79
|
+
y as isHidden,
|
|
80
|
+
N as obtainAllFocusableElements,
|
|
81
|
+
L as tryFocus,
|
|
82
|
+
U as useFocusReason
|
|
83
|
+
};
|
|
@@ -2,3 +2,6 @@ import type { Plugin } from 'vue';
|
|
|
2
2
|
import { ElForm } from 'element-plus';
|
|
3
3
|
export declare const EpForm: typeof ElForm & Plugin;
|
|
4
4
|
export default EpForm;
|
|
5
|
+
export * from './src/constants';
|
|
6
|
+
export * from './src/hooks/use-form-common-props';
|
|
7
|
+
export * from './src/hooks/use-form-item';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import "../../node_modules/.pnpm/element-plus@2.14.3_vue@3.5.40_typescript@5.9.3_/node_modules/element-plus/es/index.js";
|
|
2
2
|
import { withInstall as o } from "../../utils/with-install.js";
|
|
3
|
+
import "vue";
|
|
4
|
+
import "../../hooks/use-size/index.js";
|
|
3
5
|
import { ElForm as m } from "../../node_modules/.pnpm/element-plus@2.14.3_vue@3.5.40_typescript@5.9.3_/node_modules/element-plus/es/components/form/index.js";
|
|
4
|
-
const r = Object.assign({}, m, { name: "EpForm" }),
|
|
6
|
+
const r = Object.assign({}, m, { name: "EpForm" }), e = o(r, "ep-form");
|
|
5
7
|
export {
|
|
6
|
-
|
|
8
|
+
e as EpForm
|
|
7
9
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentSize } from '@element-plus/constants';
|
|
2
|
+
import type { MaybeRef } from 'vue';
|
|
3
|
+
export declare const useFormSize: (fallback?: MaybeRef<ComponentSize | undefined>, ignore?: Partial<Record<"prop" | "form" | "formItem" | "global", boolean>>) => import("vue").ComputedRef<"" | "default" | "small" | "large">;
|
|
4
|
+
export declare const useFormDisabled: (fallback?: MaybeRef<boolean | undefined>) => import("vue").ComputedRef<boolean>;
|
|
5
|
+
export declare const useSize: (fallback?: MaybeRef<ComponentSize | undefined>, ignore?: Partial<Record<"prop" | "form" | "formItem" | "global", boolean>>) => import("vue").ComputedRef<"" | "default" | "small" | "large">;
|
|
6
|
+
export declare const useDisabled: (fallback?: MaybeRef<boolean | undefined>) => import("vue").ComputedRef<boolean>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import type { FormItemContext } from '../types';
|
|
3
|
+
export declare const useFormItem: () => {
|
|
4
|
+
form: import("../types").FormContext | undefined;
|
|
5
|
+
formItem: FormItemContext | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type IUseFormItemInputCommonProps = {
|
|
8
|
+
id?: string;
|
|
9
|
+
label?: string | number | boolean | Record<string, any>;
|
|
10
|
+
ariaLabel?: string | number | boolean | Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
export declare const useFormItemInputId: (props: Partial<IUseFormItemInputCommonProps>, { formItemContext, disableIdGeneration, disableIdManagement, }: {
|
|
13
|
+
formItemContext?: FormItemContext;
|
|
14
|
+
disableIdGeneration?: ComputedRef<boolean> | Ref<boolean>;
|
|
15
|
+
disableIdManagement?: ComputedRef<boolean> | Ref<boolean>;
|
|
16
|
+
}) => {
|
|
17
|
+
isLabeledByFormItem: ComputedRef<boolean>;
|
|
18
|
+
inputId: Ref<string | undefined, string | undefined>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComponentSize } from '@element-plus/constants';
|
|
2
|
+
export interface FormContext {
|
|
3
|
+
size?: ComponentSize;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface FormItemContext {
|
|
8
|
+
size?: ComponentSize;
|
|
9
|
+
$el?: HTMLDivElement | undefined;
|
|
10
|
+
validateMessage?: string;
|
|
11
|
+
validateState?: string;
|
|
12
|
+
isGroup?: boolean;
|
|
13
|
+
labelId?: string;
|
|
14
|
+
inputIds?: string[];
|
|
15
|
+
hasLabel?: boolean;
|
|
16
|
+
fieldValue?: any;
|
|
17
|
+
propString?: string;
|
|
18
|
+
addInputId: (id: string) => void;
|
|
19
|
+
removeInputId: (id: string) => void;
|
|
20
|
+
validate?: (...args: any[]) => any;
|
|
21
|
+
resetField?: () => void;
|
|
22
|
+
clearValidate?: () => void;
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|