This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

33
node_modules/element-plus/lib/hooks/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
export * from './use-attrs';
export * from './use-calc-input-width';
export * from './use-deprecated';
export * from './use-draggable';
export * from './use-focus';
export * from './use-locale';
export * from './use-lockscreen';
export * from './use-modal';
export * from './use-model-toggle';
export * from './use-prevent-global';
export * from './use-prop';
export * from './use-popper';
export * from './use-same-target';
export * from './use-teleport';
export * from './use-throttle-render';
export * from './use-timeout';
export * from './use-transition-fallthrough';
export * from './use-id';
export * from './use-escape-keydown';
export * from './use-popper-container';
export * from './use-intermediate-render';
export * from './use-delayed-toggle';
export * from './use-forward-ref';
export * from './use-namespace';
export * from './use-z-index';
export * from './use-floating';
export * from './use-cursor';
export * from './use-ordered-children';
export * from './use-size';
export * from './use-focus-controller';
export * from './use-composition';
export * from './use-empty-values';
export * from './use-aria';

106
node_modules/element-plus/lib/hooks/index.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var index = require('./use-attrs/index.js');
var index$1 = require('./use-calc-input-width/index.js');
var index$2 = require('./use-deprecated/index.js');
var index$3 = require('./use-draggable/index.js');
var index$4 = require('./use-focus/index.js');
var index$5 = require('./use-locale/index.js');
var index$6 = require('./use-lockscreen/index.js');
var index$7 = require('./use-modal/index.js');
var index$8 = require('./use-model-toggle/index.js');
var index$9 = require('./use-prevent-global/index.js');
var index$a = require('./use-prop/index.js');
var index$b = require('./use-popper/index.js');
var index$c = require('./use-same-target/index.js');
var index$d = require('./use-teleport/index.js');
var index$e = require('./use-throttle-render/index.js');
var index$f = require('./use-timeout/index.js');
var index$g = require('./use-transition-fallthrough/index.js');
var index$h = require('./use-id/index.js');
var index$i = require('./use-escape-keydown/index.js');
var index$j = require('./use-popper-container/index.js');
var index$k = require('./use-intermediate-render/index.js');
var index$l = require('./use-delayed-toggle/index.js');
var index$m = require('./use-forward-ref/index.js');
var index$n = require('./use-namespace/index.js');
var index$o = require('./use-z-index/index.js');
var index$p = require('./use-floating/index.js');
var index$q = require('./use-cursor/index.js');
var index$r = require('./use-ordered-children/index.js');
var index$s = require('./use-size/index.js');
var index$t = require('./use-focus-controller/index.js');
var index$u = require('./use-composition/index.js');
var index$v = require('./use-empty-values/index.js');
var index$w = require('./use-aria/index.js');
exports.useAttrs = index.useAttrs;
exports.useCalcInputWidth = index$1.useCalcInputWidth;
exports.useDeprecated = index$2.useDeprecated;
exports.useDraggable = index$3.useDraggable;
exports.useFocus = index$4.useFocus;
exports.buildLocaleContext = index$5.buildLocaleContext;
exports.buildTranslator = index$5.buildTranslator;
exports.localeContextKey = index$5.localeContextKey;
exports.translate = index$5.translate;
exports.useLocale = index$5.useLocale;
exports.useLockscreen = index$6.useLockscreen;
exports.useModal = index$7.useModal;
exports.createModelToggleComposable = index$8.createModelToggleComposable;
exports.useModelToggle = index$8.useModelToggle;
exports.useModelToggleEmits = index$8.useModelToggleEmits;
exports.useModelToggleProps = index$8.useModelToggleProps;
exports.usePreventGlobal = index$9.usePreventGlobal;
exports.useProp = index$a.useProp;
exports.usePopper = index$b.usePopper;
exports.useSameTarget = index$c.useSameTarget;
exports.useTeleport = index$d.useTeleport;
exports.useThrottleRender = index$e.useThrottleRender;
exports.useTimeout = index$f.useTimeout;
exports.useTransitionFallthrough = index$g.useTransitionFallthrough;
exports.useTransitionFallthroughEmits = index$g.useTransitionFallthroughEmits;
exports.ID_INJECTION_KEY = index$h.ID_INJECTION_KEY;
exports.useId = index$h.useId;
exports.useIdInjection = index$h.useIdInjection;
exports.useEscapeKeydown = index$i.useEscapeKeydown;
exports.usePopperContainer = index$j.usePopperContainer;
exports.usePopperContainerId = index$j.usePopperContainerId;
exports.useDelayedRender = index$k.useDelayedRender;
exports.useDelayedToggle = index$l.useDelayedToggle;
exports.useDelayedToggleProps = index$l.useDelayedToggleProps;
exports.FORWARD_REF_INJECTION_KEY = index$m.FORWARD_REF_INJECTION_KEY;
exports.useForwardRef = index$m.useForwardRef;
exports.useForwardRefDirective = index$m.useForwardRefDirective;
exports.defaultNamespace = index$n.defaultNamespace;
exports.namespaceContextKey = index$n.namespaceContextKey;
exports.useGetDerivedNamespace = index$n.useGetDerivedNamespace;
exports.useNamespace = index$n.useNamespace;
exports.ZINDEX_INJECTION_KEY = index$o.ZINDEX_INJECTION_KEY;
exports.defaultInitialZIndex = index$o.defaultInitialZIndex;
exports.useZIndex = index$o.useZIndex;
exports.zIndexContextKey = index$o.zIndexContextKey;
exports.arrowMiddleware = index$p.arrowMiddleware;
exports.getPositionDataWithUnit = index$p.getPositionDataWithUnit;
exports.useFloating = index$p.useFloating;
exports.useFloatingProps = index$p.useFloatingProps;
exports.useCursor = index$q.useCursor;
exports.useOrderedChildren = index$r.useOrderedChildren;
exports.SIZE_INJECTION_KEY = index$s.SIZE_INJECTION_KEY;
exports.useGlobalSize = index$s.useGlobalSize;
exports.useSizeProp = index$s.useSizeProp;
exports.useSizeProps = index$s.useSizeProps;
exports.useFocusController = index$t.useFocusController;
exports.useComposition = index$u.useComposition;
exports.DEFAULT_EMPTY_VALUES = index$v.DEFAULT_EMPTY_VALUES;
exports.DEFAULT_VALUE_ON_CLEAR = index$v.DEFAULT_VALUE_ON_CLEAR;
exports.SCOPE = index$v.SCOPE;
exports.emptyValuesContextKey = index$v.emptyValuesContextKey;
exports.useEmptyValues = index$v.useEmptyValues;
exports.useEmptyValuesProps = index$v.useEmptyValuesProps;
exports.ariaProps = index$w.ariaProps;
exports.useAriaProps = index$w.useAriaProps;
//# sourceMappingURL=index.js.map

1
node_modules/element-plus/lib/hooks/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,20 @@
export declare const ariaProps: {
ariaLabel: StringConstructor;
ariaOrientation: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
ariaControls: StringConstructor;
};
export declare const useAriaProps: <T extends keyof typeof ariaProps>(arias: Array<T>) => Pick<{
ariaLabel: StringConstructor;
ariaOrientation: {
readonly type: import("vue").PropType<string>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
ariaControls: StringConstructor;
}, T>;

22
node_modules/element-plus/lib/hooks/use-aria/index.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var lodashUnified = require('lodash-unified');
var runtime = require('../../utils/vue/props/runtime.js');
const ariaProps = runtime.buildProps({
ariaLabel: String,
ariaOrientation: {
type: String,
values: ["horizontal", "vertical", "undefined"]
},
ariaControls: String
});
const useAriaProps = (arias) => {
return lodashUnified.pick(ariaProps, arias);
};
exports.ariaProps = ariaProps;
exports.useAriaProps = useAriaProps;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-aria/index.ts"],"sourcesContent":["import { pick } from 'lodash-unified'\nimport { buildProps } from '@element-plus/utils'\n\nexport const ariaProps = buildProps({\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel: String,\n /**\n * @description native `aria-orientation` attribute\n */\n ariaOrientation: {\n type: String,\n values: ['horizontal', 'vertical', 'undefined'],\n },\n /**\n * @description native `aria-controls` attribute\n */\n ariaControls: String,\n})\n\nexport const useAriaProps = <T extends keyof typeof ariaProps>(\n arias: Array<T>\n) => {\n return pick<typeof ariaProps, T>(ariaProps, arias)\n}\n"],"names":["buildProps","pick"],"mappings":";;;;;;;AAEY,MAAC,SAAS,GAAGA,kBAAU,CAAC;AACpC,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,WAAW,CAAC;AACnD,GAAG;AACH,EAAE,YAAY,EAAE,MAAM;AACtB,CAAC,EAAE;AACS,MAAC,YAAY,GAAG,CAAC,KAAK,KAAK;AACvC,EAAE,OAAOC,kBAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAChC;;;;;"}

View File

@@ -0,0 +1,7 @@
import type { ComputedRef } from 'vue';
interface Params {
excludeListeners?: boolean;
excludeKeys?: ComputedRef<string[]>;
}
export declare const useAttrs: (params?: Params) => ComputedRef<Record<string, unknown>>;
export {};

26
node_modules/element-plus/lib/hooks/use-attrs/index.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var lodashUnified = require('lodash-unified');
const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
const LISTENER_PREFIX = /^on[A-Z]/;
const useAttrs = (params = {}) => {
const { excludeListeners = false, excludeKeys } = params;
const allExcludeKeys = vue.computed(() => {
return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
});
const instance = vue.getCurrentInstance();
if (!instance) {
return vue.computed(() => ({}));
}
return vue.computed(() => {
var _a;
return lodashUnified.fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
});
};
exports.useAttrs = useAttrs;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-attrs/index.ts"],"sourcesContent":["import { computed, getCurrentInstance } from 'vue'\nimport { fromPairs } from 'lodash-unified'\nimport { debugWarn } from '@element-plus/utils'\n\nimport type { ComputedRef } from 'vue'\n\ninterface Params {\n excludeListeners?: boolean\n excludeKeys?: ComputedRef<string[]>\n}\n\nconst DEFAULT_EXCLUDE_KEYS = ['class', 'style']\nconst LISTENER_PREFIX = /^on[A-Z]/\n\nexport const useAttrs = (\n params: Params = {}\n): ComputedRef<Record<string, unknown>> => {\n const { excludeListeners = false, excludeKeys } = params\n const allExcludeKeys = computed<string[]>(() => {\n return (excludeKeys?.value || []).concat(DEFAULT_EXCLUDE_KEYS)\n })\n\n const instance = getCurrentInstance()\n if (!instance) {\n debugWarn(\n 'use-attrs',\n 'getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function'\n )\n return computed(() => ({}))\n }\n\n return computed(() =>\n fromPairs(\n Object.entries(instance.proxy?.$attrs!).filter(\n ([key]) =>\n !allExcludeKeys.value.includes(key) &&\n !(excludeListeners && LISTENER_PREFIX.test(key))\n )\n )\n )\n}\n"],"names":["computed","getCurrentInstance","fromPairs"],"mappings":";;;;;;;AAGA,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAChD,MAAM,eAAe,GAAG,UAAU,CAAC;AACvB,MAAC,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,KAAK;AACzC,EAAE,MAAM,EAAE,gBAAgB,GAAG,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;AAC3D,EAAE,MAAM,cAAc,GAAGA,YAAQ,CAAC,MAAM;AACxC,IAAI,OAAO,CAAC,CAAC,WAAW,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,KAAK,EAAE,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACnG,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,QAAQ,GAAGC,sBAAkB,EAAE,CAAC;AACxC,EAAE,IAAI,CAAC,QAAQ,EAAE;AAEjB,IAAI,OAAOD,YAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAChC,GAAG;AACH,EAAE,OAAOA,YAAQ,CAAC,MAAM;AACxB,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,OAAOE,uBAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpM,GAAG,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,7 @@
export declare function useCalcInputWidth(): {
calculatorRef: import("vue").ShallowRef<HTMLElement | undefined>;
calculatorWidth: import("vue").Ref<number>;
inputStyle: import("vue").ComputedRef<{
minWidth: string;
}>;
};

View File

@@ -0,0 +1,28 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@vueuse/core');
var form = require('../../constants/form.js');
function useCalcInputWidth() {
const calculatorRef = vue.shallowRef();
const calculatorWidth = vue.ref(0);
const inputStyle = vue.computed(() => ({
minWidth: `${Math.max(calculatorWidth.value, form.MINIMUM_INPUT_WIDTH)}px`
}));
const resetCalculatorWidth = () => {
var _a, _b;
calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
};
core.useResizeObserver(calculatorRef, resetCalculatorWidth);
return {
calculatorRef,
calculatorWidth,
inputStyle
};
}
exports.useCalcInputWidth = useCalcInputWidth;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-calc-input-width/index.ts"],"sourcesContent":["import { computed, ref, shallowRef } from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { MINIMUM_INPUT_WIDTH } from '@element-plus/constants'\n\nexport function useCalcInputWidth() {\n const calculatorRef = shallowRef<HTMLElement>()\n const calculatorWidth = ref(0)\n\n const inputStyle = computed(() => ({\n minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`,\n }))\n\n const resetCalculatorWidth = () => {\n calculatorWidth.value =\n calculatorRef.value?.getBoundingClientRect().width ?? 0\n }\n\n useResizeObserver(calculatorRef, resetCalculatorWidth)\n\n return {\n calculatorRef,\n calculatorWidth,\n inputStyle,\n }\n}\n"],"names":["shallowRef","ref","computed","MINIMUM_INPUT_WIDTH","useResizeObserver"],"mappings":";;;;;;;;AAGO,SAAS,iBAAiB,GAAG;AACpC,EAAE,MAAM,aAAa,GAAGA,cAAU,EAAE,CAAC;AACrC,EAAE,MAAM,eAAe,GAAGC,OAAG,CAAC,CAAC,CAAC,CAAC;AACjC,EAAE,MAAM,UAAU,GAAGC,YAAQ,CAAC,OAAO;AACrC,IAAI,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,EAAEC,wBAAmB,CAAC,CAAC,EAAE,CAAC;AACzE,GAAG,CAAC,CAAC,CAAC;AACN,EAAE,MAAM,oBAAoB,GAAG,MAAM;AACrC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC;AACf,IAAI,eAAe,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,aAAa,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,CAAC,KAAK,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;AACnI,GAAG,CAAC;AACJ,EAAEC,sBAAiB,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;AACzD,EAAE,OAAO;AACT,IAAI,aAAa;AACjB,IAAI,eAAe;AACnB,IAAI,UAAU;AACd,GAAG,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,12 @@
interface UseCompositionOptions {
afterComposition: (event: CompositionEvent) => void;
emit?: ((event: 'compositionstart', evt: CompositionEvent) => void) & ((event: 'compositionupdate', evt: CompositionEvent) => void) & ((event: 'compositionend', evt: CompositionEvent) => void);
}
export declare function useComposition({ afterComposition, emit, }: UseCompositionOptions): {
isComposing: import("vue").Ref<boolean>;
handleComposition: (event: CompositionEvent) => void;
handleCompositionStart: (event: CompositionEvent) => void;
handleCompositionUpdate: (event: CompositionEvent) => void;
handleCompositionEnd: (event: CompositionEvent) => void;
};
export {};

View File

@@ -0,0 +1,44 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var i18n = require('../../utils/i18n.js');
function useComposition({
afterComposition,
emit
}) {
const isComposing = vue.ref(false);
const handleCompositionStart = (event) => {
emit == null ? void 0 : emit("compositionstart", event);
isComposing.value = true;
};
const handleCompositionUpdate = (event) => {
var _a;
emit == null ? void 0 : emit("compositionupdate", event);
const text = (_a = event.target) == null ? void 0 : _a.value;
const lastCharacter = text[text.length - 1] || "";
isComposing.value = !i18n.isKorean(lastCharacter);
};
const handleCompositionEnd = (event) => {
emit == null ? void 0 : emit("compositionend", event);
if (isComposing.value) {
isComposing.value = false;
vue.nextTick(() => afterComposition(event));
}
};
const handleComposition = (event) => {
event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
};
return {
isComposing,
handleComposition,
handleCompositionStart,
handleCompositionUpdate,
handleCompositionEnd
};
}
exports.useComposition = useComposition;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-composition/index.ts"],"sourcesContent":["import { nextTick, ref } from 'vue'\nimport { isKorean } from '@element-plus/utils'\n\ninterface UseCompositionOptions {\n afterComposition: (event: CompositionEvent) => void\n emit?: ((event: 'compositionstart', evt: CompositionEvent) => void) &\n ((event: 'compositionupdate', evt: CompositionEvent) => void) &\n ((event: 'compositionend', evt: CompositionEvent) => void)\n}\n\nexport function useComposition({\n afterComposition,\n emit,\n}: UseCompositionOptions) {\n const isComposing = ref(false)\n\n const handleCompositionStart = (event: CompositionEvent) => {\n emit?.('compositionstart', event)\n isComposing.value = true\n }\n\n const handleCompositionUpdate = (event: CompositionEvent) => {\n emit?.('compositionupdate', event)\n const text = (event.target as HTMLInputElement)?.value\n const lastCharacter = text[text.length - 1] || ''\n isComposing.value = !isKorean(lastCharacter)\n }\n\n const handleCompositionEnd = (event: CompositionEvent) => {\n emit?.('compositionend', event)\n if (isComposing.value) {\n isComposing.value = false\n nextTick(() => afterComposition(event))\n }\n }\n\n const handleComposition = (event: CompositionEvent) => {\n event.type === 'compositionend'\n ? handleCompositionEnd(event)\n : handleCompositionUpdate(event)\n }\n\n return {\n isComposing,\n handleComposition,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n }\n}\n"],"names":["ref","isKorean","nextTick"],"mappings":";;;;;;;AAEO,SAAS,cAAc,CAAC;AAC/B,EAAE,gBAAgB;AAClB,EAAE,IAAI;AACN,CAAC,EAAE;AACH,EAAE,MAAM,WAAW,GAAGA,OAAG,CAAC,KAAK,CAAC,CAAC;AACjC,EAAE,MAAM,sBAAsB,GAAG,CAAC,KAAK,KAAK;AAC5C,IAAI,IAAI,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;AAC5D,IAAI,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;AAC7B,GAAG,CAAC;AACJ,EAAE,MAAM,uBAAuB,GAAG,CAAC,KAAK,KAAK;AAC7C,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AAC7D,IAAI,MAAM,IAAI,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;AACjE,IAAI,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACtD,IAAI,WAAW,CAAC,KAAK,GAAG,CAACC,aAAQ,CAAC,aAAa,CAAC,CAAC;AACjD,GAAG,CAAC;AACJ,EAAE,MAAM,oBAAoB,GAAG,CAAC,KAAK,KAAK;AAC1C,IAAI,IAAI,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAC1D,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE;AAC3B,MAAM,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;AAChC,MAAMC,YAAQ,CAAC,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9C,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,MAAM,iBAAiB,GAAG,CAAC,KAAK,KAAK;AACvC,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;AACnG,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,WAAW;AACf,IAAI,iBAAiB;AACrB,IAAI,sBAAsB;AAC1B,IAAI,uBAAuB;AAC3B,IAAI,oBAAoB;AACxB,GAAG,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,2 @@
import type { ShallowRef } from 'vue';
export declare function useCursor(input: ShallowRef<HTMLInputElement | undefined>): [() => void, () => void];

View File

@@ -0,0 +1,48 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function useCursor(input) {
let selectionInfo;
function recordCursor() {
if (input.value == void 0)
return;
const { selectionStart, selectionEnd, value } = input.value;
if (selectionStart == null || selectionEnd == null)
return;
const beforeTxt = value.slice(0, Math.max(0, selectionStart));
const afterTxt = value.slice(Math.max(0, selectionEnd));
selectionInfo = {
selectionStart,
selectionEnd,
value,
beforeTxt,
afterTxt
};
}
function setCursor() {
if (input.value == void 0 || selectionInfo == void 0)
return;
const { value } = input.value;
const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
return;
let startPos = value.length;
if (value.endsWith(afterTxt)) {
startPos = value.length - afterTxt.length;
} else if (value.startsWith(beforeTxt)) {
startPos = beforeTxt.length;
} else {
const beforeLastChar = beforeTxt[selectionStart - 1];
const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
if (newIndex !== -1) {
startPos = newIndex + 1;
}
}
input.value.setSelectionRange(startPos, startPos);
}
return [recordCursor, setCursor];
}
exports.useCursor = useCursor;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-cursor/index.ts"],"sourcesContent":["import type { ShallowRef } from 'vue'\n\ninterface SelectionInfo {\n selectionStart?: number\n selectionEnd?: number\n value?: string\n beforeTxt?: string\n afterTxt?: string\n}\n\n// Keep input cursor in the correct position when we use formatter.\nexport function useCursor(\n input: ShallowRef<HTMLInputElement | undefined>\n): [() => void, () => void] {\n let selectionInfo: SelectionInfo\n function recordCursor() {\n if (input.value == undefined) return\n\n const { selectionStart, selectionEnd, value } = input.value\n\n if (selectionStart == null || selectionEnd == null) return\n\n const beforeTxt = value.slice(0, Math.max(0, selectionStart))\n const afterTxt = value.slice(Math.max(0, selectionEnd))\n\n selectionInfo = {\n selectionStart,\n selectionEnd,\n value,\n beforeTxt,\n afterTxt,\n }\n }\n function setCursor() {\n if (input.value == undefined || selectionInfo == undefined) return\n\n const { value } = input.value\n const { beforeTxt, afterTxt, selectionStart } = selectionInfo\n\n if (\n beforeTxt == undefined ||\n afterTxt == undefined ||\n selectionStart == undefined\n )\n return\n\n let startPos = value.length\n\n if (value.endsWith(afterTxt)) {\n startPos = value.length - afterTxt.length\n } else if (value.startsWith(beforeTxt)) {\n startPos = beforeTxt.length\n } else {\n const beforeLastChar = beforeTxt[selectionStart - 1]\n const newIndex = value.indexOf(beforeLastChar, selectionStart - 1)\n if (newIndex !== -1) {\n startPos = newIndex + 1\n }\n }\n\n input.value.setSelectionRange(startPos, startPos)\n }\n\n return [recordCursor, setCursor]\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,SAAS,CAAC,KAAK,EAAE;AACjC,EAAE,IAAI,aAAa,CAAC;AACpB,EAAE,SAAS,YAAY,GAAG;AAC1B,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;AAC7B,MAAM,OAAO;AACb,IAAI,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC;AAChE,IAAI,IAAI,cAAc,IAAI,IAAI,IAAI,YAAY,IAAI,IAAI;AACtD,MAAM,OAAO;AACb,IAAI,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC;AAClE,IAAI,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;AAC5D,IAAI,aAAa,GAAG;AACpB,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,KAAK;AACX,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,KAAK,CAAC;AACN,GAAG;AACH,EAAE,SAAS,SAAS,GAAG;AACvB,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,aAAa,IAAI,KAAK,CAAC;AACxD,MAAM,OAAO;AACb,IAAI,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC;AAClC,IAAI,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC;AAClE,IAAI,IAAI,SAAS,IAAI,KAAK,CAAC,IAAI,QAAQ,IAAI,KAAK,CAAC,IAAI,cAAc,IAAI,KAAK,CAAC;AAC7E,MAAM,OAAO;AACb,IAAI,IAAI,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;AAChC,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;AAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;AAChD,KAAK,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;AAC5C,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC;AAClC,KAAK,MAAM;AACX,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;AAC3D,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,GAAG,CAAC,CAAC,CAAC;AACzE,MAAM,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE;AAC3B,QAAQ,QAAQ,GAAG,QAAQ,GAAG,CAAC,CAAC;AAChC,OAAO;AACP,KAAK;AACL,IAAI,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACtD,GAAG;AACH,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AACnC;;;;"}

View File

@@ -0,0 +1,14 @@
import type { ExtractPropTypes, ToRefs } from 'vue';
export declare const useDelayedToggleProps: {
readonly showAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly autoClose: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
};
export type UseDelayedToggleProps = {
open: (event?: Event) => void;
close: (event?: Event) => void;
} & ToRefs<ExtractPropTypes<typeof useDelayedToggleProps>>;
export declare const useDelayedToggle: ({ showAfter, hideAfter, autoClose, open, close, }: UseDelayedToggleProps) => {
onOpen: (event?: Event, delay?: number) => void;
onClose: (event?: Event, delay?: number) => void;
};

View File

@@ -0,0 +1,61 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var index = require('../use-timeout/index.js');
var runtime = require('../../utils/vue/props/runtime.js');
var types = require('../../utils/types.js');
const useDelayedToggleProps = runtime.buildProps({
showAfter: {
type: Number,
default: 0
},
hideAfter: {
type: Number,
default: 200
},
autoClose: {
type: Number,
default: 0
}
});
const useDelayedToggle = ({
showAfter,
hideAfter,
autoClose,
open,
close
}) => {
const { registerTimeout } = index.useTimeout();
const {
registerTimeout: registerTimeoutForAutoClose,
cancelTimeout: cancelTimeoutForAutoClose
} = index.useTimeout();
const onOpen = (event, delay = vue.unref(showAfter)) => {
registerTimeout(() => {
open(event);
const _autoClose = vue.unref(autoClose);
if (types.isNumber(_autoClose) && _autoClose > 0) {
registerTimeoutForAutoClose(() => {
close(event);
}, _autoClose);
}
}, delay);
};
const onClose = (event, delay = vue.unref(hideAfter)) => {
cancelTimeoutForAutoClose();
registerTimeout(() => {
close(event);
}, delay);
};
return {
onOpen,
onClose
};
};
exports.useDelayedToggle = useDelayedToggle;
exports.useDelayedToggleProps = useDelayedToggleProps;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-delayed-toggle/index.ts"],"sourcesContent":["import { unref } from 'vue'\nimport { buildProps, isNumber } from '@element-plus/utils'\nimport { useTimeout } from '../use-timeout'\n\nimport type { ExtractPropTypes, ToRefs } from 'vue'\n\nexport const useDelayedToggleProps = buildProps({\n /**\n * @description delay of appearance, in millisecond\n */\n showAfter: {\n type: Number,\n default: 0,\n },\n /**\n * @description delay of disappear, in millisecond\n */\n hideAfter: {\n type: Number,\n default: 200,\n },\n /**\n * @description disappear automatically, in millisecond\n */\n autoClose: {\n type: Number,\n default: 0,\n },\n} as const)\n\nexport type UseDelayedToggleProps = {\n open: (event?: Event) => void\n close: (event?: Event) => void\n} & ToRefs<ExtractPropTypes<typeof useDelayedToggleProps>>\n\nexport const useDelayedToggle = ({\n showAfter,\n hideAfter,\n autoClose,\n open,\n close,\n}: UseDelayedToggleProps) => {\n const { registerTimeout } = useTimeout()\n const {\n registerTimeout: registerTimeoutForAutoClose,\n cancelTimeout: cancelTimeoutForAutoClose,\n } = useTimeout()\n\n const onOpen = (event?: Event, delay = unref(showAfter)) => {\n registerTimeout(() => {\n open(event)\n\n const _autoClose = unref(autoClose)\n if (isNumber(_autoClose) && _autoClose > 0) {\n registerTimeoutForAutoClose(() => {\n close(event)\n }, _autoClose)\n }\n }, delay)\n }\n\n const onClose = (event?: Event, delay = unref(hideAfter)) => {\n cancelTimeoutForAutoClose()\n registerTimeout(() => {\n close(event)\n }, delay)\n }\n\n return {\n onOpen,\n onClose,\n }\n}\n"],"names":["buildProps","useTimeout","unref","isNumber"],"mappings":";;;;;;;;;AAGY,MAAC,qBAAqB,GAAGA,kBAAU,CAAC;AAChD,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG,CAAC;AACjC,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,IAAI;AACN,EAAE,KAAK;AACP,CAAC,KAAK;AACN,EAAE,MAAM,EAAE,eAAe,EAAE,GAAGC,gBAAU,EAAE,CAAC;AAC3C,EAAE,MAAM;AACR,IAAI,eAAe,EAAE,2BAA2B;AAChD,IAAI,aAAa,EAAE,yBAAyB;AAC5C,GAAG,GAAGA,gBAAU,EAAE,CAAC;AACnB,EAAE,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,GAAGC,SAAK,CAAC,SAAS,CAAC,KAAK;AACtD,IAAI,eAAe,CAAC,MAAM;AAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;AAClB,MAAM,MAAM,UAAU,GAAGA,SAAK,CAAC,SAAS,CAAC,CAAC;AAC1C,MAAM,IAAIC,cAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE;AAClD,QAAQ,2BAA2B,CAAC,MAAM;AAC1C,UAAU,KAAK,CAAC,KAAK,CAAC,CAAC;AACvB,SAAS,EAAE,UAAU,CAAC,CAAC;AACvB,OAAO;AACP,KAAK,EAAE,KAAK,CAAC,CAAC;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,KAAK,GAAGD,SAAK,CAAC,SAAS,CAAC,KAAK;AACvD,IAAI,yBAAyB,EAAE,CAAC;AAChC,IAAI,eAAe,CAAC,MAAM;AAC1B,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;AACnB,KAAK,EAAE,KAAK,CAAC,CAAC;AACd,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,MAAM;AACV,IAAI,OAAO;AACX,GAAG,CAAC;AACJ;;;;;"}

View File

@@ -0,0 +1,11 @@
import type { MaybeRef } from '@vueuse/core';
type DeprecationParam = {
from: string;
replacement: string;
scope: string;
version: string;
ref: string;
type?: 'API' | 'Attribute' | 'Event' | 'Slot';
};
export declare const useDeprecated: ({ from, replacement, scope, version, ref, type }: DeprecationParam, condition: MaybeRef<boolean>) => void;
export {};

View File

@@ -0,0 +1,15 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
vue.watch(() => vue.unref(condition), (val) => {
}, {
immediate: true
});
};
exports.useDeprecated = useDeprecated;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-deprecated/index.ts"],"sourcesContent":["import { unref, watch } from 'vue'\nimport { debugWarn } from '@element-plus/utils'\n\nimport type { MaybeRef } from '@vueuse/core'\n\ntype DeprecationParam = {\n from: string\n replacement: string\n scope: string\n version: string\n ref: string\n type?: 'API' | 'Attribute' | 'Event' | 'Slot'\n}\n\nexport const useDeprecated = (\n { from, replacement, scope, version, ref, type = 'API' }: DeprecationParam,\n condition: MaybeRef<boolean>\n) => {\n watch(\n () => unref(condition),\n (val) => {\n if (val) {\n debugWarn(\n scope,\n `[${type}] ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.\nFor more detail, please visit: ${ref}\n`\n )\n }\n },\n {\n immediate: true,\n }\n )\n}\n"],"names":["watch","unref"],"mappings":";;;;;;AAEY,MAAC,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,GAAG,KAAK,EAAE,EAAE,SAAS,KAAK;AACtG,EAAEA,SAAK,CAAC,MAAMC,SAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK;AAMzC,GAAG,EAAE;AACL,IAAI,SAAS,EAAE,IAAI;AACnB,GAAG,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,6 @@
import type { ComputedRef, Ref } from 'vue';
export declare const useDraggable: (targetRef: Ref<HTMLElement | undefined>, dragRef: Ref<HTMLElement | undefined>, draggable: ComputedRef<boolean>, overflow?: ComputedRef<boolean>) => {
isDragging: Ref<boolean>;
resetPosition: () => void;
updatePosition: () => void;
};

View File

@@ -0,0 +1,100 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var style = require('../../utils/dom/style.js');
const useDraggable = (targetRef, dragRef, draggable, overflow) => {
const transform = {
offsetX: 0,
offsetY: 0
};
const isDragging = vue.ref(false);
const adjustPosition = (moveX, moveY) => {
if (targetRef.value) {
const { offsetX, offsetY } = transform;
const targetRect = targetRef.value.getBoundingClientRect();
const targetLeft = targetRect.left;
const targetTop = targetRect.top;
const targetWidth = targetRect.width;
const targetHeight = targetRect.height;
const clientWidth = document.documentElement.clientWidth;
const clientHeight = document.documentElement.clientHeight;
const minLeft = -targetLeft + offsetX;
const minTop = -targetTop + offsetY;
const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
const maxTop = clientHeight - targetTop - (targetHeight < clientHeight ? targetHeight : 0) + offsetY;
if (!(overflow == null ? void 0 : overflow.value)) {
moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
moveY = Math.min(Math.max(moveY, minTop), maxTop);
}
transform.offsetX = moveX;
transform.offsetY = moveY;
targetRef.value.style.transform = `translate(${style.addUnit(moveX)}, ${style.addUnit(moveY)})`;
}
};
const onMousedown = (e) => {
const downX = e.clientX;
const downY = e.clientY;
const { offsetX, offsetY } = transform;
const onMousemove = (e2) => {
if (!isDragging.value) {
isDragging.value = true;
}
const moveX = offsetX + e2.clientX - downX;
const moveY = offsetY + e2.clientY - downY;
adjustPosition(moveX, moveY);
};
const onMouseup = () => {
isDragging.value = false;
document.removeEventListener("mousemove", onMousemove);
document.removeEventListener("mouseup", onMouseup);
};
document.addEventListener("mousemove", onMousemove);
document.addEventListener("mouseup", onMouseup);
};
const onDraggable = () => {
if (dragRef.value && targetRef.value) {
dragRef.value.addEventListener("mousedown", onMousedown);
window.addEventListener("resize", updatePosition);
}
};
const offDraggable = () => {
if (dragRef.value && targetRef.value) {
dragRef.value.removeEventListener("mousedown", onMousedown);
window.removeEventListener("resize", updatePosition);
}
};
const resetPosition = () => {
transform.offsetX = 0;
transform.offsetY = 0;
if (targetRef.value) {
targetRef.value.style.transform = "";
}
};
const updatePosition = () => {
const { offsetX, offsetY } = transform;
adjustPosition(offsetX, offsetY);
};
vue.onMounted(() => {
vue.watchEffect(() => {
if (draggable.value) {
onDraggable();
} else {
offDraggable();
}
});
});
vue.onBeforeUnmount(() => {
offDraggable();
});
return {
isDragging,
resetPosition,
updatePosition
};
};
exports.useDraggable = useDraggable;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
import type { ExtractPropTypes, InjectionKey, Ref } from 'vue';
type EmptyValuesContext = ExtractPropTypes<typeof useEmptyValuesProps>;
export declare const emptyValuesContextKey: InjectionKey<Ref<EmptyValuesContext>>;
export declare const SCOPE = "use-empty-values";
export declare const DEFAULT_EMPTY_VALUES: (string | null | undefined)[];
export declare const DEFAULT_VALUE_ON_CLEAR: undefined;
export declare const useEmptyValuesProps: {
readonly emptyValues: ArrayConstructor;
readonly valueOnClear: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown, undefined, boolean>;
};
export declare const useEmptyValues: (props: EmptyValuesContext, defaultValue?: null | undefined) => {
emptyValues: import("vue").ComputedRef<unknown[]>;
valueOnClear: import("vue").ComputedRef<any>;
isEmptyValue: (value: unknown) => boolean;
};
export {};

View File

@@ -0,0 +1,73 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var lodashUnified = require('lodash-unified');
var runtime = require('../../utils/vue/props/runtime.js');
var shared = require('@vue/shared');
const emptyValuesContextKey = Symbol("emptyValuesContextKey");
const SCOPE = "use-empty-values";
const DEFAULT_EMPTY_VALUES = ["", void 0, null];
const DEFAULT_VALUE_ON_CLEAR = void 0;
const useEmptyValuesProps = runtime.buildProps({
emptyValues: Array,
valueOnClear: {
type: runtime.definePropType([
String,
Number,
Boolean,
Function
]),
default: void 0,
validator: (val) => {
val = shared.isFunction(val) ? val() : val;
if (shared.isArray(val)) {
return val.every((item) => !item);
}
return !val;
}
}
});
const useEmptyValues = (props, defaultValue) => {
const config = vue.getCurrentInstance() ? vue.inject(emptyValuesContextKey, vue.ref({})) : vue.ref({});
const emptyValues = vue.computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
const valueOnClear = vue.computed(() => {
if (shared.isFunction(props.valueOnClear)) {
return props.valueOnClear();
} else if (props.valueOnClear !== void 0) {
return props.valueOnClear;
} else if (shared.isFunction(config.value.valueOnClear)) {
return config.value.valueOnClear();
} else if (config.value.valueOnClear !== void 0) {
return config.value.valueOnClear;
}
return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
});
const isEmptyValue = (value) => {
let result = true;
if (shared.isArray(value)) {
result = emptyValues.value.some((emptyValue) => {
return lodashUnified.isEqual(value, emptyValue);
});
} else {
result = emptyValues.value.includes(value);
}
return result;
};
if (!isEmptyValue(valueOnClear.value)) ;
return {
emptyValues,
valueOnClear,
isEmptyValue
};
};
exports.DEFAULT_EMPTY_VALUES = DEFAULT_EMPTY_VALUES;
exports.DEFAULT_VALUE_ON_CLEAR = DEFAULT_VALUE_ON_CLEAR;
exports.SCOPE = SCOPE;
exports.emptyValuesContextKey = emptyValuesContextKey;
exports.useEmptyValues = useEmptyValues;
exports.useEmptyValuesProps = useEmptyValuesProps;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export declare const useEscapeKeydown: (handler: (e: KeyboardEvent) => void) => void;

View File

@@ -0,0 +1,33 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@vueuse/core');
var aria = require('../../constants/aria.js');
let registeredEscapeHandlers = [];
const cachedHandler = (event) => {
if (event.code === aria.EVENT_CODE.esc) {
registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
}
};
const useEscapeKeydown = (handler) => {
vue.onMounted(() => {
if (registeredEscapeHandlers.length === 0) {
document.addEventListener("keydown", cachedHandler);
}
if (core.isClient)
registeredEscapeHandlers.push(handler);
});
vue.onBeforeUnmount(() => {
registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
if (registeredEscapeHandlers.length === 0) {
if (core.isClient)
document.removeEventListener("keydown", cachedHandler);
}
});
};
exports.useEscapeKeydown = useEscapeKeydown;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-escape-keydown/index.ts"],"sourcesContent":["import { onBeforeUnmount, onMounted } from 'vue'\nimport { isClient } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\n\nlet registeredEscapeHandlers: ((e: KeyboardEvent) => void)[] = []\n\nconst cachedHandler = (event: KeyboardEvent) => {\n if (event.code === EVENT_CODE.esc) {\n registeredEscapeHandlers.forEach((registeredHandler) =>\n registeredHandler(event)\n )\n }\n}\n\nexport const useEscapeKeydown = (handler: (e: KeyboardEvent) => void) => {\n onMounted(() => {\n if (registeredEscapeHandlers.length === 0) {\n document.addEventListener('keydown', cachedHandler)\n }\n if (isClient) registeredEscapeHandlers.push(handler)\n })\n\n onBeforeUnmount(() => {\n registeredEscapeHandlers = registeredEscapeHandlers.filter(\n (registeredHandler) => registeredHandler !== handler\n )\n if (registeredEscapeHandlers.length === 0) {\n if (isClient) document.removeEventListener('keydown', cachedHandler)\n }\n })\n}\n"],"names":["EVENT_CODE","onMounted","isClient","onBeforeUnmount"],"mappings":";;;;;;;;AAGA,IAAI,wBAAwB,GAAG,EAAE,CAAC;AAClC,MAAM,aAAa,GAAG,CAAC,KAAK,KAAK;AACjC,EAAE,IAAI,KAAK,CAAC,IAAI,KAAKA,eAAU,CAAC,GAAG,EAAE;AACrC,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAC,iBAAiB,KAAK,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;AACtF,GAAG;AACH,CAAC,CAAC;AACU,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,EAAEC,aAAS,CAAC,MAAM;AAClB,IAAI,IAAI,wBAAwB,CAAC,MAAM,KAAK,CAAC,EAAE;AAC/C,MAAM,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AAC1D,KAAK;AACL,IAAI,IAAIC,aAAQ;AAChB,MAAM,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7C,GAAG,CAAC,CAAC;AACL,EAAEC,mBAAe,CAAC,MAAM;AACxB,IAAI,wBAAwB,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC,iBAAiB,KAAK,iBAAiB,KAAK,OAAO,CAAC,CAAC;AACrH,IAAI,IAAI,wBAAwB,CAAC,MAAM,KAAK,CAAC,EAAE;AAC/C,MAAM,IAAID,aAAQ;AAClB,QAAQ,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AAC/D,KAAK;AACL,GAAG,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,69 @@
import type { Ref, ToRefs } from 'vue';
import type { Middleware, Placement, SideObject, Strategy, VirtualElement } from '@floating-ui/dom';
export declare const useFloatingProps: {};
export type UseFloatingProps = ToRefs<{
middleware: Array<Middleware>;
placement: Placement;
strategy: Strategy;
}>;
export declare const getPositionDataWithUnit: <T extends Record<string, number>>(record: T | undefined, key: keyof T) => string;
export declare const useFloating: ({ middleware, placement, strategy, }: UseFloatingProps) => {
update: () => Promise<void>;
referenceRef: Ref<HTMLElement | VirtualElement | undefined>;
contentRef: Ref<HTMLElement | undefined>;
x: Ref<number | undefined>;
y: Ref<number | undefined>;
placement: Ref<Placement>;
strategy: Ref<Strategy>;
middlewareData: Ref<{
[x: string]: any;
arrow?: {
x?: number | undefined;
y?: number | undefined;
centerOffset: number;
} | undefined;
autoPlacement?: {
index?: number | undefined;
overflows: {
placement: Placement;
overflows: Array<number>;
}[];
} | undefined;
flip?: {
index?: number | undefined;
overflows: {
placement: Placement;
overflows: Array<number>;
}[];
} | undefined;
hide?: {
referenceHidden?: boolean | undefined;
escaped?: boolean | undefined;
referenceHiddenOffsets?: {
top: number;
bottom: number;
left: number;
right: number;
} | undefined;
escapedOffsets?: {
top: number;
bottom: number;
left: number;
right: number;
} | undefined;
} | undefined;
offset?: {
x: number;
y: number;
} | undefined;
shift?: {
x: number;
y: number;
} | undefined;
}>;
};
export type ArrowMiddlewareProps = {
arrowRef: Ref<HTMLElement | null | undefined>;
padding?: number | SideObject;
};
export declare const arrowMiddleware: ({ arrowRef, padding, }: ArrowMiddlewareProps) => Middleware;

View File

@@ -0,0 +1,98 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@vueuse/core');
var lodashUnified = require('lodash-unified');
var dom = require('@floating-ui/dom');
var objects = require('../../utils/objects.js');
var runtime = require('../../utils/vue/props/runtime.js');
const useFloatingProps = runtime.buildProps({});
const unrefReference = (elRef) => {
if (!core.isClient)
return;
if (!elRef)
return elRef;
const unrefEl = core.unrefElement(elRef);
if (unrefEl)
return unrefEl;
return vue.isRef(elRef) ? unrefEl : elRef;
};
const getPositionDataWithUnit = (record, key) => {
const value = record == null ? void 0 : record[key];
return lodashUnified.isNil(value) ? "" : `${value}px`;
};
const useFloating = ({
middleware,
placement,
strategy
}) => {
const referenceRef = vue.ref();
const contentRef = vue.ref();
const x = vue.ref();
const y = vue.ref();
const middlewareData = vue.ref({});
const states = {
x,
y,
placement,
strategy,
middlewareData
};
const update = async () => {
if (!core.isClient)
return;
const referenceEl = unrefReference(referenceRef);
const contentEl = core.unrefElement(contentRef);
if (!referenceEl || !contentEl)
return;
const data = await dom.computePosition(referenceEl, contentEl, {
placement: vue.unref(placement),
strategy: vue.unref(strategy),
middleware: vue.unref(middleware)
});
objects.keysOf(states).forEach((key) => {
states[key].value = data[key];
});
};
vue.onMounted(() => {
vue.watchEffect(() => {
update();
});
});
return {
...states,
update,
referenceRef,
contentRef
};
};
const arrowMiddleware = ({
arrowRef,
padding
}) => {
return {
name: "arrow",
options: {
element: arrowRef,
padding
},
fn(args) {
const arrowEl = vue.unref(arrowRef);
if (!arrowEl)
return {};
return dom.arrow({
element: arrowEl,
padding
}).fn(args);
}
};
};
exports.arrowMiddleware = arrowMiddleware;
exports.getPositionDataWithUnit = getPositionDataWithUnit;
exports.useFloating = useFloating;
exports.useFloatingProps = useFloatingProps;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
import type { ShallowRef } from 'vue';
import type { MaybeRef } from '@vueuse/core';
interface UseFocusControllerOptions {
disabled?: MaybeRef<boolean>;
/**
* return true to cancel focus
* @param event FocusEvent
*/
beforeFocus?: (event: FocusEvent) => boolean | undefined;
afterFocus?: () => void;
/**
* return true to cancel blur
* @param event FocusEvent
*/
beforeBlur?: (event: FocusEvent) => boolean | undefined;
afterBlur?: () => void;
}
export declare function useFocusController<T extends {
focus: () => void;
}>(target: ShallowRef<T | undefined>, { disabled, beforeFocus, afterFocus, beforeBlur, afterBlur, }?: UseFocusControllerOptions): {
isFocused: import("vue").Ref<boolean>;
/** Avoid using wrapperRef and handleFocus/handleBlur together */
wrapperRef: ShallowRef<HTMLElement | undefined>;
handleFocus: (event: FocusEvent) => void;
handleBlur: (event: FocusEvent) => void;
};
export {};

View File

@@ -0,0 +1,65 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@vueuse/core');
var aria = require('../../utils/dom/aria.js');
var shared = require('@vue/shared');
function useFocusController(target, {
disabled,
beforeFocus,
afterFocus,
beforeBlur,
afterBlur
} = {}) {
const instance = vue.getCurrentInstance();
const { emit } = instance;
const wrapperRef = vue.shallowRef();
const isFocused = vue.ref(false);
const handleFocus = (event) => {
const cancelFocus = shared.isFunction(beforeFocus) ? beforeFocus(event) : false;
if (vue.unref(disabled) || isFocused.value || cancelFocus)
return;
isFocused.value = true;
emit("focus", event);
afterFocus == null ? void 0 : afterFocus();
};
const handleBlur = (event) => {
var _a;
const cancelBlur = shared.isFunction(beforeBlur) ? beforeBlur(event) : false;
if (vue.unref(disabled) || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)) || cancelBlur)
return;
isFocused.value = false;
emit("blur", event);
afterBlur == null ? void 0 : afterBlur();
};
const handleClick = (event) => {
var _a, _b;
if (vue.unref(disabled) || aria.isFocusable(event.target) || ((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
return;
(_b = target.value) == null ? void 0 : _b.focus();
};
vue.watch([wrapperRef, () => vue.unref(disabled)], ([el, disabled2]) => {
if (!el)
return;
if (disabled2) {
el.removeAttribute("tabindex");
} else {
el.setAttribute("tabindex", "-1");
}
});
core.useEventListener(wrapperRef, "focus", handleFocus, true);
core.useEventListener(wrapperRef, "blur", handleBlur, true);
core.useEventListener(wrapperRef, "click", handleClick, true);
return {
isFocused,
wrapperRef,
handleFocus,
handleBlur
};
}
exports.useFocusController = useFocusController;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import type { Ref } from 'vue';
export declare const useFocus: (el: Ref<{
focus: () => void;
} | null>) => {
focus: () => void;
};

15
node_modules/element-plus/lib/hooks/use-focus/index.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const useFocus = (el) => {
return {
focus: () => {
var _a, _b;
(_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
}
};
};
exports.useFocus = useFocus;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-focus/index.ts"],"sourcesContent":["import type { Ref } from 'vue'\n\nexport const useFocus = (\n el: Ref<{\n focus: () => void\n } | null>\n) => {\n return {\n focus: () => {\n el.value?.focus?.()\n },\n }\n}\n"],"names":[],"mappings":";;;;AAAY,MAAC,QAAQ,GAAG,CAAC,EAAE,KAAK;AAChC,EAAE,OAAO;AACT,IAAI,KAAK,EAAE,MAAM;AACjB,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;AACjB,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxF,KAAK;AACL,GAAG,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,9 @@
import type { InjectionKey, ObjectDirective, Ref } from 'vue';
type ForwardRefSetter = <T>(el: T) => void;
export type ForwardRefInjectionContext = {
setForwardRef: ForwardRefSetter;
};
export declare const FORWARD_REF_INJECTION_KEY: InjectionKey<ForwardRefInjectionContext>;
export declare const useForwardRef: <T>(forwardRef: Ref<T | null>) => void;
export declare const useForwardRefDirective: (setForwardRef: ForwardRefSetter) => ObjectDirective;
export {};

View File

@@ -0,0 +1,33 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
const useForwardRef = (forwardRef) => {
const setForwardRef = (el) => {
forwardRef.value = el;
};
vue.provide(FORWARD_REF_INJECTION_KEY, {
setForwardRef
});
};
const useForwardRefDirective = (setForwardRef) => {
return {
mounted(el) {
setForwardRef(el);
},
updated(el) {
setForwardRef(el);
},
unmounted() {
setForwardRef(null);
}
};
};
exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
exports.useForwardRef = useForwardRef;
exports.useForwardRefDirective = useForwardRefDirective;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-forward-ref/index.ts"],"sourcesContent":["import { provide } from 'vue'\n\nimport type { InjectionKey, ObjectDirective, Ref } from 'vue'\n\ntype ForwardRefSetter = <T>(el: T) => void\n\nexport type ForwardRefInjectionContext = {\n setForwardRef: ForwardRefSetter\n}\n\nexport const FORWARD_REF_INJECTION_KEY: InjectionKey<ForwardRefInjectionContext> =\n Symbol('elForwardRef')\n\nexport const useForwardRef = <T>(forwardRef: Ref<T | null>) => {\n const setForwardRef = (el: T) => {\n forwardRef.value = el\n }\n\n provide(FORWARD_REF_INJECTION_KEY, {\n setForwardRef,\n })\n}\n\nexport const useForwardRefDirective = (\n setForwardRef: ForwardRefSetter\n): ObjectDirective => {\n return {\n mounted(el) {\n setForwardRef(el)\n },\n updated(el) {\n setForwardRef(el)\n },\n unmounted() {\n setForwardRef(null)\n },\n }\n}\n"],"names":["provide"],"mappings":";;;;;;AACY,MAAC,yBAAyB,GAAG,MAAM,CAAC,cAAc,EAAE;AACpD,MAAC,aAAa,GAAG,CAAC,UAAU,KAAK;AAC7C,EAAE,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK;AAChC,IAAI,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC;AAC1B,GAAG,CAAC;AACJ,EAAEA,WAAO,CAAC,yBAAyB,EAAE;AACrC,IAAI,aAAa;AACjB,GAAG,CAAC,CAAC;AACL,EAAE;AACU,MAAC,sBAAsB,GAAG,CAAC,aAAa,KAAK;AACzD,EAAE,OAAO;AACT,IAAI,OAAO,CAAC,EAAE,EAAE;AAChB,MAAM,aAAa,CAAC,EAAE,CAAC,CAAC;AACxB,KAAK;AACL,IAAI,OAAO,CAAC,EAAE,EAAE;AAChB,MAAM,aAAa,CAAC,EAAE,CAAC,CAAC;AACxB,KAAK;AACL,IAAI,SAAS,GAAG;AAChB,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;AAC1B,KAAK;AACL,GAAG,CAAC;AACJ;;;;;;"}

View File

@@ -0,0 +1,9 @@
import type { MaybeRef } from '@vueuse/core';
import type { InjectionKey, Ref } from 'vue';
export type ElIdInjectionContext = {
prefix: number;
current: number;
};
export declare const ID_INJECTION_KEY: InjectionKey<ElIdInjectionContext>;
export declare const useIdInjection: () => ElIdInjectionContext;
export declare const useId: (deterministicId?: MaybeRef<string>) => Ref<string>;

27
node_modules/element-plus/lib/hooks/use-id/index.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@vueuse/core');
var index = require('../use-namespace/index.js');
const defaultIdInjection = {
prefix: Math.floor(Math.random() * 1e4),
current: 0
};
const ID_INJECTION_KEY = Symbol("elIdInjection");
const useIdInjection = () => {
return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
};
const useId = (deterministicId) => {
const idInjection = useIdInjection();
const namespace = index.useGetDerivedNamespace();
const idRef = core.computedEager(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
return idRef;
};
exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
exports.useId = useId;
exports.useIdInjection = useIdInjection;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-id/index.ts"],"sourcesContent":["import { getCurrentInstance, inject, unref } from 'vue'\nimport { computedEager } from '@vueuse/core'\nimport { debugWarn, isClient } from '@element-plus/utils'\nimport { useGetDerivedNamespace } from '../use-namespace'\n\nimport type { MaybeRef } from '@vueuse/core'\nimport type { InjectionKey, Ref } from 'vue'\n\nexport type ElIdInjectionContext = {\n prefix: number\n current: number\n}\n\nconst defaultIdInjection = {\n prefix: Math.floor(Math.random() * 10000),\n current: 0,\n}\n\nexport const ID_INJECTION_KEY: InjectionKey<ElIdInjectionContext> =\n Symbol('elIdInjection')\n\nexport const useIdInjection = (): ElIdInjectionContext => {\n return getCurrentInstance()\n ? inject(ID_INJECTION_KEY, defaultIdInjection)\n : defaultIdInjection\n}\n\nexport const useId = (deterministicId?: MaybeRef<string>): Ref<string> => {\n const idInjection = useIdInjection()\n if (!isClient && idInjection === defaultIdInjection) {\n debugWarn(\n 'IdInjection',\n `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed\nusage: app.provide(ID_INJECTION_KEY, {\n prefix: number,\n current: number,\n})`\n )\n }\n\n const namespace = useGetDerivedNamespace()\n\n // NOTE: Here we use `computedEager` to calculate the id value immediately, avoiding inconsistent id generation due to the lazy feature of `computed` when server rendering.\n const idRef = computedEager(\n () =>\n unref(deterministicId) ||\n `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`\n )\n\n return idRef\n}\n"],"names":["getCurrentInstance","inject","useGetDerivedNamespace","computedEager","unref"],"mappings":";;;;;;;;AAIA,MAAM,kBAAkB,GAAG;AAC3B,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;AACzC,EAAE,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AACU,MAAC,gBAAgB,GAAG,MAAM,CAAC,eAAe,EAAE;AAC5C,MAAC,cAAc,GAAG,MAAM;AACpC,EAAE,OAAOA,sBAAkB,EAAE,GAAGC,UAAM,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AAClG,EAAE;AACU,MAAC,KAAK,GAAG,CAAC,eAAe,KAAK;AAC1C,EAAE,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;AAQvC,EAAE,MAAM,SAAS,GAAGC,4BAAsB,EAAE,CAAC;AAC7C,EAAE,MAAM,KAAK,GAAGC,kBAAa,CAAC,MAAMC,SAAK,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;AACtI,EAAE,OAAO,KAAK,CAAC;AACf;;;;;;"}

View File

@@ -0,0 +1,11 @@
import type { Ref } from 'vue';
export type UseDelayedRenderProps = {
indicator: Ref<boolean>;
intermediateIndicator: Ref<boolean>;
shouldSetIntermediate?: (step: 'show' | 'hide') => boolean;
beforeShow?: () => void;
beforeHide?: () => void;
afterShow?: () => void;
afterHide?: () => void;
};
export declare const useDelayedRender: ({ indicator, intermediateIndicator, shouldSetIntermediate, beforeShow, afterShow, afterHide, beforeHide, }: UseDelayedRenderProps) => void;

View File

@@ -0,0 +1,47 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
const useDelayedRender = ({
indicator,
intermediateIndicator,
shouldSetIntermediate = () => true,
beforeShow,
afterShow,
afterHide,
beforeHide
}) => {
vue.watch(() => vue.unref(indicator), (val) => {
if (val) {
beforeShow == null ? void 0 : beforeShow();
vue.nextTick(() => {
if (!vue.unref(indicator))
return;
if (shouldSetIntermediate("show")) {
intermediateIndicator.value = true;
}
});
} else {
beforeHide == null ? void 0 : beforeHide();
vue.nextTick(() => {
if (vue.unref(indicator))
return;
if (shouldSetIntermediate("hide")) {
intermediateIndicator.value = false;
}
});
}
});
vue.watch(() => intermediateIndicator.value, (val) => {
if (val) {
afterShow == null ? void 0 : afterShow();
} else {
afterHide == null ? void 0 : afterHide();
}
});
};
exports.useDelayedRender = useDelayedRender;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-intermediate-render/index.ts"],"sourcesContent":["import { nextTick, unref, watch } from 'vue'\n\nimport type { Ref } from 'vue'\n\nexport type UseDelayedRenderProps = {\n indicator: Ref<boolean>\n intermediateIndicator: Ref<boolean>\n shouldSetIntermediate?: (step: 'show' | 'hide') => boolean\n beforeShow?: () => void\n beforeHide?: () => void\n afterShow?: () => void\n afterHide?: () => void\n}\n\nexport const useDelayedRender = ({\n indicator,\n intermediateIndicator,\n shouldSetIntermediate = () => true,\n beforeShow,\n afterShow,\n afterHide,\n beforeHide,\n}: UseDelayedRenderProps) => {\n watch(\n () => unref(indicator),\n (val) => {\n if (val) {\n beforeShow?.()\n nextTick(() => {\n if (!unref(indicator)) return\n if (shouldSetIntermediate('show')) {\n intermediateIndicator.value = true\n }\n })\n } else {\n beforeHide?.()\n nextTick(() => {\n if (unref(indicator)) return\n\n if (shouldSetIntermediate('hide')) {\n intermediateIndicator.value = false\n }\n })\n }\n }\n )\n\n // because we don't always set the value ourselves, so that we\n // simply watch the value's state, then invoke the corresponding hook.\n watch(\n () => intermediateIndicator.value,\n (val) => {\n if (val) {\n afterShow?.()\n } else {\n afterHide?.()\n }\n }\n )\n}\n"],"names":["watch","unref","nextTick"],"mappings":";;;;;;AACY,MAAC,gBAAgB,GAAG,CAAC;AACjC,EAAE,SAAS;AACX,EAAE,qBAAqB;AACvB,EAAE,qBAAqB,GAAG,MAAM,IAAI;AACpC,EAAE,UAAU;AACZ,EAAE,SAAS;AACX,EAAE,SAAS;AACX,EAAE,UAAU;AACZ,CAAC,KAAK;AACN,EAAEA,SAAK,CAAC,MAAMC,SAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK;AACzC,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,UAAU,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,UAAU,EAAE,CAAC;AACjD,MAAMC,YAAQ,CAAC,MAAM;AACrB,QAAQ,IAAI,CAACD,SAAK,CAAC,SAAS,CAAC;AAC7B,UAAU,OAAO;AACjB,QAAQ,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE;AAC3C,UAAU,qBAAqB,CAAC,KAAK,GAAG,IAAI,CAAC;AAC7C,SAAS;AACT,OAAO,CAAC,CAAC;AACT,KAAK,MAAM;AACX,MAAM,UAAU,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,UAAU,EAAE,CAAC;AACjD,MAAMC,YAAQ,CAAC,MAAM;AACrB,QAAQ,IAAID,SAAK,CAAC,SAAS,CAAC;AAC5B,UAAU,OAAO;AACjB,QAAQ,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE;AAC3C,UAAU,qBAAqB,CAAC,KAAK,GAAG,KAAK,CAAC;AAC9C,SAAS;AACT,OAAO,CAAC,CAAC;AACT,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAED,SAAK,CAAC,MAAM,qBAAqB,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK;AACpD,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,SAAS,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,SAAS,EAAE,CAAC;AAC/C,KAAK,MAAM;AACX,MAAM,SAAS,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,SAAS,EAAE,CAAC;AAC/C,KAAK;AACL,GAAG,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,18 @@
import English from 'element-plus/es/locale/lang/en';
import type { MaybeRef } from '@vueuse/core';
import type { InjectionKey, Ref } from 'vue';
import type { FieldPath } from 'element-plus/es/utils';
import type { Language } from 'element-plus/es/locale';
export type LocaleKeys = Exclude<FieldPath<typeof English>, 'name' | 'el'> | (string & NonNullable<unknown>);
export type TranslatorOption = Record<string, string | number>;
export type Translator = (path: LocaleKeys, option?: TranslatorOption) => string;
export type LocaleContext = {
locale: Ref<Language>;
lang: Ref<string>;
t: Translator;
};
export declare const buildTranslator: (locale: MaybeRef<Language>) => Translator;
export declare const translate: (path: LocaleKeys, option: undefined | TranslatorOption, locale: Language) => string;
export declare const buildLocaleContext: (locale: MaybeRef<Language>) => LocaleContext;
export declare const localeContextKey: InjectionKey<Ref<Language | undefined>>;
export declare const useLocale: (localeOverrides?: Ref<Language | undefined>) => LocaleContext;

View File

@@ -0,0 +1,34 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var lodashUnified = require('lodash-unified');
var en = require('../../locale/lang/en.js');
const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
const translate = (path, option, locale) => lodashUnified.get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
var _a;
return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
});
const buildLocaleContext = (locale) => {
const lang = vue.computed(() => vue.unref(locale).name);
const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
return {
lang,
locale: localeRef,
t: buildTranslator(locale)
};
};
const localeContextKey = Symbol("localeContextKey");
const useLocale = (localeOverrides) => {
const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
return buildLocaleContext(vue.computed(() => locale.value || en["default"]));
};
exports.buildLocaleContext = buildLocaleContext;
exports.buildTranslator = buildTranslator;
exports.localeContextKey = localeContextKey;
exports.translate = translate;
exports.useLocale = useLocale;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-locale/index.ts"],"sourcesContent":["import { computed, inject, isRef, ref, unref } from 'vue'\nimport { get } from 'lodash-unified'\nimport English from '@element-plus/locale/lang/en'\n\nimport type { MaybeRef } from '@vueuse/core'\nimport type { InjectionKey, Ref } from 'vue'\nimport type { FieldPath } from '@element-plus/utils'\nimport type { Language } from '@element-plus/locale'\n\nexport type LocaleKeys =\n | Exclude<FieldPath<typeof English>, 'name' | 'el'>\n | (string & NonNullable<unknown>)\n\nexport type TranslatorOption = Record<string, string | number>\nexport type Translator = (path: LocaleKeys, option?: TranslatorOption) => string\nexport type LocaleContext = {\n locale: Ref<Language>\n lang: Ref<string>\n t: Translator\n}\n\nexport const buildTranslator =\n (locale: MaybeRef<Language>): Translator =>\n (path, option) =>\n translate(path, option, unref(locale))\n\nexport const translate = (\n path: LocaleKeys,\n option: undefined | TranslatorOption,\n locale: Language\n): string =>\n (get(locale, path, path) as string).replace(\n /\\{(\\w+)\\}/g,\n (_, key) => `${option?.[key] ?? `{${key}}`}`\n )\n\nexport const buildLocaleContext = (\n locale: MaybeRef<Language>\n): LocaleContext => {\n const lang = computed(() => unref(locale).name)\n const localeRef = isRef(locale) ? locale : ref(locale)\n return {\n lang,\n locale: localeRef,\n t: buildTranslator(locale),\n }\n}\n\nexport const localeContextKey: InjectionKey<Ref<Language | undefined>> =\n Symbol('localeContextKey')\n\nexport const useLocale = (localeOverrides?: Ref<Language | undefined>) => {\n const locale = localeOverrides || inject(localeContextKey, ref())!\n return buildLocaleContext(computed(() => locale.value || English))\n}\n"],"names":["unref","get","computed","isRef","ref","inject","English"],"mappings":";;;;;;;;AAGY,MAAC,eAAe,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC,IAAI,EAAE,MAAM,EAAEA,SAAK,CAAC,MAAM,CAAC,EAAE;AACxF,MAAC,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,KAAKC,iBAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK;AAC7G,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC,EAAE;AACS,MAAC,kBAAkB,GAAG,CAAC,MAAM,KAAK;AAC9C,EAAE,MAAM,IAAI,GAAGC,YAAQ,CAAC,MAAMF,SAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAClD,EAAE,MAAM,SAAS,GAAGG,SAAK,CAAC,MAAM,CAAC,GAAG,MAAM,GAAGC,OAAG,CAAC,MAAM,CAAC,CAAC;AACzD,EAAE,OAAO;AACT,IAAI,IAAI;AACR,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC;AAC9B,GAAG,CAAC;AACJ,EAAE;AACU,MAAC,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,EAAE;AAC/C,MAAC,SAAS,GAAG,CAAC,eAAe,KAAK;AAC9C,EAAE,MAAM,MAAM,GAAG,eAAe,IAAIC,UAAM,CAAC,gBAAgB,EAAED,OAAG,EAAE,CAAC,CAAC;AACpE,EAAE,OAAO,kBAAkB,CAACF,YAAQ,CAAC,MAAM,MAAM,CAAC,KAAK,IAAII,aAAO,CAAC,CAAC,CAAC;AACrE;;;;;;;;"}

View File

@@ -0,0 +1,11 @@
import type { Ref } from 'vue';
import type { UseNamespaceReturn } from '../use-namespace';
export type UseLockScreenOptions = {
ns?: UseNamespaceReturn;
};
/**
* Hook that monitoring the ref value to lock or unlock the screen.
* When the trigger became true, it assumes modal is now opened and vice versa.
* @param trigger {Ref<boolean>}
*/
export declare const useLockscreen: (trigger: Ref<boolean>, options?: UseLockScreenOptions) => void;

View File

@@ -0,0 +1,55 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var index = require('../use-namespace/index.js');
var error = require('../../utils/error.js');
var style = require('../../utils/dom/style.js');
var scroll = require('../../utils/dom/scroll.js');
var core = require('@vueuse/core');
const useLockscreen = (trigger, options = {}) => {
if (!vue.isRef(trigger)) {
error.throwError("[useLockscreen]", "You need to pass a ref param to this function");
}
const ns = options.ns || index.useNamespace("popup");
const hiddenCls = vue.computed(() => ns.bm("parent", "hidden"));
if (!core.isClient || style.hasClass(document.body, hiddenCls.value)) {
return;
}
let scrollBarWidth = 0;
let withoutHiddenClass = false;
let bodyWidth = "0";
const cleanup = () => {
setTimeout(() => {
if (typeof document === "undefined")
return;
if (withoutHiddenClass && document) {
document.body.style.width = bodyWidth;
style.removeClass(document.body, hiddenCls.value);
}
}, 200);
};
vue.watch(trigger, (val) => {
if (!val) {
cleanup();
return;
}
withoutHiddenClass = !style.hasClass(document.body, hiddenCls.value);
if (withoutHiddenClass) {
bodyWidth = document.body.style.width;
style.addClass(document.body, hiddenCls.value);
}
scrollBarWidth = scroll.getScrollBarWidth(ns.namespace.value);
const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
const bodyOverflowY = style.getStyle(document.body, "overflowY");
if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
}
});
vue.onScopeDispose(() => cleanup());
};
exports.useLockscreen = useLockscreen;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-lockscreen/index.ts"],"sourcesContent":["import { computed, isRef, onScopeDispose, watch } from 'vue'\nimport {\n addClass,\n getScrollBarWidth,\n getStyle,\n hasClass,\n isClient,\n removeClass,\n throwError,\n} from '@element-plus/utils'\nimport { useNamespace } from '../use-namespace'\n\nimport type { Ref } from 'vue'\nimport type { UseNamespaceReturn } from '../use-namespace'\n\nexport type UseLockScreenOptions = {\n ns?: UseNamespaceReturn\n // shouldLock?: MaybeRef<boolean>\n}\n\n/**\n * Hook that monitoring the ref value to lock or unlock the screen.\n * When the trigger became true, it assumes modal is now opened and vice versa.\n * @param trigger {Ref<boolean>}\n */\nexport const useLockscreen = (\n trigger: Ref<boolean>,\n options: UseLockScreenOptions = {}\n) => {\n if (!isRef(trigger)) {\n throwError(\n '[useLockscreen]',\n 'You need to pass a ref param to this function'\n )\n }\n\n const ns = options.ns || useNamespace('popup')\n\n const hiddenCls = computed(() => ns.bm('parent', 'hidden'))\n\n if (!isClient || hasClass(document.body, hiddenCls.value)) {\n return\n }\n\n let scrollBarWidth = 0\n let withoutHiddenClass = false\n let bodyWidth = '0'\n\n const cleanup = () => {\n setTimeout(() => {\n // When the test case is running, the context environment simulated by jsdom may have been destroyed,\n // and the document does not exist at this time.\n if (typeof document === 'undefined') return\n if (withoutHiddenClass && document) {\n document.body.style.width = bodyWidth\n removeClass(document.body, hiddenCls.value)\n }\n }, 200)\n }\n watch(trigger, (val) => {\n if (!val) {\n cleanup()\n return\n }\n\n withoutHiddenClass = !hasClass(document.body, hiddenCls.value)\n if (withoutHiddenClass) {\n bodyWidth = document.body.style.width\n addClass(document.body, hiddenCls.value)\n }\n scrollBarWidth = getScrollBarWidth(ns.namespace.value)\n const bodyHasOverflow =\n document.documentElement.clientHeight < document.body.scrollHeight\n const bodyOverflowY = getStyle(document.body, 'overflowY')\n if (\n scrollBarWidth > 0 &&\n (bodyHasOverflow || bodyOverflowY === 'scroll') &&\n withoutHiddenClass\n ) {\n document.body.style.width = `calc(100% - ${scrollBarWidth}px)`\n }\n })\n onScopeDispose(() => cleanup())\n}\n"],"names":["isRef","throwError","useNamespace","computed","isClient","hasClass","removeClass","watch","addClass","getScrollBarWidth","getStyle","onScopeDispose"],"mappings":";;;;;;;;;;;AAWY,MAAC,aAAa,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,EAAE,KAAK;AACxD,EAAE,IAAI,CAACA,SAAK,CAAC,OAAO,CAAC,EAAE;AACvB,IAAIC,gBAAU,CAAC,iBAAiB,EAAE,+CAA+C,CAAC,CAAC;AACnF,GAAG;AACH,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,IAAIC,kBAAY,CAAC,OAAO,CAAC,CAAC;AACjD,EAAE,MAAM,SAAS,GAAGC,YAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC9D,EAAE,IAAI,CAACC,aAAQ,IAAIC,cAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE;AAC7D,IAAI,OAAO;AACX,GAAG;AACH,EAAE,IAAI,cAAc,GAAG,CAAC,CAAC;AACzB,EAAE,IAAI,kBAAkB,GAAG,KAAK,CAAC;AACjC,EAAE,IAAI,SAAS,GAAG,GAAG,CAAC;AACtB,EAAE,MAAM,OAAO,GAAG,MAAM;AACxB,IAAI,UAAU,CAAC,MAAM;AACrB,MAAM,IAAI,OAAO,QAAQ,KAAK,WAAW;AACzC,QAAQ,OAAO;AACf,MAAM,IAAI,kBAAkB,IAAI,QAAQ,EAAE;AAC1C,QAAQ,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;AAC9C,QAAQC,iBAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AACpD,OAAO;AACP,KAAK,EAAE,GAAG,CAAC,CAAC;AACZ,GAAG,CAAC;AACJ,EAAEC,SAAK,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK;AAC1B,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,MAAM,OAAO,EAAE,CAAC;AAChB,MAAM,OAAO;AACb,KAAK;AACL,IAAI,kBAAkB,GAAG,CAACF,cAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,IAAI,IAAI,kBAAkB,EAAE;AAC5B,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;AAC5C,MAAMG,cAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/C,KAAK;AACL,IAAI,cAAc,GAAGC,wBAAiB,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC3D,IAAI,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;AAC/F,IAAI,MAAM,aAAa,GAAGC,cAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAC/D,IAAI,IAAI,cAAc,GAAG,CAAC,KAAK,eAAe,IAAI,aAAa,KAAK,QAAQ,CAAC,IAAI,kBAAkB,EAAE;AACrG,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;AACrE,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAEC,kBAAc,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC;AAClC;;;;"}

View File

@@ -0,0 +1,6 @@
import type { Ref } from 'vue';
type ModalInstance = {
handleClose: () => void;
};
export declare const useModal: (instance: ModalInstance, visibleRef: Ref<boolean>) => void;
export {};

32
node_modules/element-plus/lib/hooks/use-modal/index.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@vueuse/core');
var aria = require('../../constants/aria.js');
const modalStack = [];
const closeModal = (e) => {
if (modalStack.length === 0)
return;
if (e.code === aria.EVENT_CODE.esc) {
e.stopPropagation();
const topModal = modalStack[modalStack.length - 1];
topModal.handleClose();
}
};
const useModal = (instance, visibleRef) => {
vue.watch(visibleRef, (val) => {
if (val) {
modalStack.push(instance);
} else {
modalStack.splice(modalStack.indexOf(instance), 1);
}
});
};
if (core.isClient)
core.useEventListener(document, "keydown", closeModal);
exports.useModal = useModal;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-modal/index.ts"],"sourcesContent":["import { watch } from 'vue'\nimport { isClient, useEventListener } from '@vueuse/core'\nimport { EVENT_CODE } from '@element-plus/constants'\n\nimport type { Ref } from 'vue'\n\ntype ModalInstance = {\n handleClose: () => void\n}\n\nconst modalStack: ModalInstance[] = []\n\nconst closeModal = (e: KeyboardEvent) => {\n if (modalStack.length === 0) return\n if (e.code === EVENT_CODE.esc) {\n e.stopPropagation()\n const topModal = modalStack[modalStack.length - 1]\n topModal.handleClose()\n }\n}\n\nexport const useModal = (instance: ModalInstance, visibleRef: Ref<boolean>) => {\n watch(visibleRef, (val) => {\n if (val) {\n modalStack.push(instance)\n } else {\n modalStack.splice(modalStack.indexOf(instance), 1)\n }\n })\n}\n\nif (isClient) useEventListener(document, 'keydown', closeModal)\n"],"names":["EVENT_CODE","watch","isClient","useEventListener"],"mappings":";;;;;;;;AAGA,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK;AAC1B,EAAE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;AAC7B,IAAI,OAAO;AACX,EAAE,IAAI,CAAC,CAAC,IAAI,KAAKA,eAAU,CAAC,GAAG,EAAE;AACjC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACxB,IAAI,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvD,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;AAC3B,GAAG;AACH,CAAC,CAAC;AACU,MAAC,QAAQ,GAAG,CAAC,QAAQ,EAAE,UAAU,KAAK;AAClD,EAAEC,SAAK,CAAC,UAAU,EAAE,CAAC,GAAG,KAAK;AAC7B,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAChC,KAAK,MAAM;AACX,MAAM,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AACzD,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE;AACF,IAAIC,aAAQ;AACZ,EAAEC,qBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;;;;"}

View File

@@ -0,0 +1,46 @@
import type { ExtractPropType } from 'element-plus/es/utils';
import type { ExtractPropTypes, Ref, __ExtractPublicPropTypes } from 'vue';
declare const _prop: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => boolean) | (() => boolean | null) | ((new (...args: any[]) => boolean) | (() => boolean | null))[], never, never, null, false>;
declare const _event: {
readonly type: import("vue").PropType<(val: boolean) => void>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
export type UseModelTogglePropsRaw<T extends string> = {
[K in T]: typeof _prop;
} & {
[K in `onUpdate:${T}`]: typeof _event;
};
export type UseModelTogglePropsGeneric<T extends string> = {
[K in T]: ExtractPropType<typeof _prop>;
} & {
[K in `onUpdate:${T}`]: ExtractPropType<typeof _event>;
};
export declare const createModelToggleComposable: <T extends string>(name: T) => {
useModelToggle: ({ indicator, toggleReason, shouldHideWhenRouteChanges, shouldProceed, onShow, onHide, }: ModelToggleParams) => {
hide: (event?: Event) => void;
show: (event?: Event) => void;
toggle: () => void;
hasUpdateHandler: import("vue").ComputedRef<boolean>;
};
useModelToggleProps: UseModelTogglePropsRaw<T>;
useModelToggleEmits: `update:${T}`[];
};
declare const useModelToggle: ({ indicator, toggleReason, shouldHideWhenRouteChanges, shouldProceed, onShow, onHide, }: ModelToggleParams) => {
hide: (event?: Event) => void;
show: (event?: Event) => void;
toggle: () => void;
hasUpdateHandler: import("vue").ComputedRef<boolean>;
}, useModelToggleProps: UseModelTogglePropsRaw<"modelValue">, useModelToggleEmits: "update:modelValue"[];
export { useModelToggle, useModelToggleEmits, useModelToggleProps };
export type UseModelToggleProps = ExtractPropTypes<typeof useModelToggleProps>;
export type UseModelTogglePropsPublic = __ExtractPublicPropTypes<typeof useModelToggleProps>;
export type ModelToggleParams = {
indicator: Ref<boolean>;
toggleReason?: Ref<Event | undefined>;
shouldHideWhenRouteChanges?: Ref<boolean>;
shouldProceed?: () => boolean;
onShow?: (event?: Event) => void;
onHide?: (event?: Event) => void;
};

View File

@@ -0,0 +1,139 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var runtime = require('../../utils/vue/props/runtime.js');
var types = require('../../utils/types.js');
var shared = require('@vue/shared');
var core = require('@vueuse/core');
const _prop = runtime.buildProp({
type: runtime.definePropType(Boolean),
default: null
});
const _event = runtime.buildProp({
type: runtime.definePropType(Function)
});
const createModelToggleComposable = (name) => {
const updateEventKey = `update:${name}`;
const updateEventKeyRaw = `onUpdate:${name}`;
const useModelToggleEmits2 = [updateEventKey];
const useModelToggleProps2 = {
[name]: _prop,
[updateEventKeyRaw]: _event
};
const useModelToggle2 = ({
indicator,
toggleReason,
shouldHideWhenRouteChanges,
shouldProceed,
onShow,
onHide
}) => {
const instance = vue.getCurrentInstance();
const { emit } = instance;
const props = instance.props;
const hasUpdateHandler = vue.computed(() => shared.isFunction(props[updateEventKeyRaw]));
const isModelBindingAbsent = vue.computed(() => props[name] === null);
const doShow = (event) => {
if (indicator.value === true) {
return;
}
indicator.value = true;
if (toggleReason) {
toggleReason.value = event;
}
if (shared.isFunction(onShow)) {
onShow(event);
}
};
const doHide = (event) => {
if (indicator.value === false) {
return;
}
indicator.value = false;
if (toggleReason) {
toggleReason.value = event;
}
if (shared.isFunction(onHide)) {
onHide(event);
}
};
const show = (event) => {
if (props.disabled === true || shared.isFunction(shouldProceed) && !shouldProceed())
return;
const shouldEmit = hasUpdateHandler.value && core.isClient;
if (shouldEmit) {
emit(updateEventKey, true);
}
if (isModelBindingAbsent.value || !shouldEmit) {
doShow(event);
}
};
const hide = (event) => {
if (props.disabled === true || !core.isClient)
return;
const shouldEmit = hasUpdateHandler.value && core.isClient;
if (shouldEmit) {
emit(updateEventKey, false);
}
if (isModelBindingAbsent.value || !shouldEmit) {
doHide(event);
}
};
const onChange = (val) => {
if (!types.isBoolean(val))
return;
if (props.disabled && val) {
if (hasUpdateHandler.value) {
emit(updateEventKey, false);
}
} else if (indicator.value !== val) {
if (val) {
doShow();
} else {
doHide();
}
}
};
const toggle = () => {
if (indicator.value) {
hide();
} else {
show();
}
};
vue.watch(() => props[name], onChange);
if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
vue.watch(() => ({
...instance.proxy.$route
}), () => {
if (shouldHideWhenRouteChanges.value && indicator.value) {
hide();
}
});
}
vue.onMounted(() => {
onChange(props[name]);
});
return {
hide,
show,
toggle,
hasUpdateHandler
};
};
return {
useModelToggle: useModelToggle2,
useModelToggleProps: useModelToggleProps2,
useModelToggleEmits: useModelToggleEmits2
};
};
const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
exports.createModelToggleComposable = createModelToggleComposable;
exports.useModelToggle = useModelToggle;
exports.useModelToggleEmits = useModelToggleEmits;
exports.useModelToggleProps = useModelToggleProps;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
import type { InjectionKey, Ref } from 'vue';
export declare const defaultNamespace = "el";
export declare const namespaceContextKey: InjectionKey<Ref<string | undefined>>;
export declare const useGetDerivedNamespace: (namespaceOverrides?: Ref<string | undefined>) => import("vue").ComputedRef<string>;
export declare const useNamespace: (block: string, namespaceOverrides?: Ref<string | undefined>) => {
namespace: import("vue").ComputedRef<string>;
b: (blockSuffix?: string) => string;
e: (element?: string) => string;
m: (modifier?: string) => string;
be: (blockSuffix?: string, element?: string) => string;
em: (element?: string, modifier?: string) => string;
bm: (blockSuffix?: string, modifier?: string) => string;
bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
is: {
(name: string, state: boolean | undefined): string;
(name: string): string;
};
cssVar: (object: Record<string, string>) => Record<string, string>;
cssVarName: (name: string) => string;
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
cssVarBlockName: (name: string) => string;
};
export type UseNamespaceReturn = ReturnType<typeof useNamespace>;

View File

@@ -0,0 +1,84 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
const defaultNamespace = "el";
const statePrefix = "is-";
const _bem = (namespace, block, blockSuffix, element, modifier) => {
let cls = `${namespace}-${block}`;
if (blockSuffix) {
cls += `-${blockSuffix}`;
}
if (element) {
cls += `__${element}`;
}
if (modifier) {
cls += `--${modifier}`;
}
return cls;
};
const namespaceContextKey = Symbol("namespaceContextKey");
const useGetDerivedNamespace = (namespaceOverrides) => {
const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace));
const namespace = vue.computed(() => {
return vue.unref(derivedNamespace) || defaultNamespace;
});
return namespace;
};
const useNamespace = (block, namespaceOverrides) => {
const namespace = useGetDerivedNamespace(namespaceOverrides);
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
const is = (name, ...args) => {
const state = args.length >= 1 ? args[0] : true;
return name && state ? `${statePrefix}${name}` : "";
};
const cssVar = (object) => {
const styles = {};
for (const key in object) {
if (object[key]) {
styles[`--${namespace.value}-${key}`] = object[key];
}
}
return styles;
};
const cssVarBlock = (object) => {
const styles = {};
for (const key in object) {
if (object[key]) {
styles[`--${namespace.value}-${block}-${key}`] = object[key];
}
}
return styles;
};
const cssVarName = (name) => `--${namespace.value}-${name}`;
const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
return {
namespace,
b,
e,
m,
be,
em,
bm,
bem,
is,
cssVar,
cssVarName,
cssVarBlock,
cssVarBlockName
};
};
exports.defaultNamespace = defaultNamespace;
exports.namespaceContextKey = namespaceContextKey;
exports.useGetDerivedNamespace = useGetDerivedNamespace;
exports.useNamespace = useNamespace;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
import type { ComponentInternalInstance, VNode } from 'vue';
type ChildEssential = {
uid: number;
getVnode: () => VNode;
};
export declare const useOrderedChildren: <T extends ChildEssential>(vm: ComponentInternalInstance, childComponentName: string) => {
children: import("vue").ShallowRef<T[]>;
addChild: (child: T) => void;
removeChild: (child: T) => void;
ChildrenSorter: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
};
export {};

View File

@@ -0,0 +1,73 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var vnode = require('../../utils/vue/vnode.js');
const getOrderedChildren = (vm, childComponentName, children) => {
const nodes = vnode.flattedChildren(vm.subTree).filter((n) => {
var _a;
return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
});
const uids = nodes.map((n) => n.component.uid);
return uids.map((uid) => children[uid]).filter((p) => !!p);
};
const useOrderedChildren = (vm, childComponentName) => {
const children = vue.shallowRef({});
const orderedChildren = vue.shallowRef([]);
const nodesMap = /* @__PURE__ */ new WeakMap();
const addChild = (child) => {
children.value[child.uid] = child;
vue.triggerRef(children);
vue.onMounted(() => {
const childNode = child.getVnode().el;
const parentNode = childNode.parentNode;
if (!nodesMap.has(parentNode)) {
nodesMap.set(parentNode, []);
const originalFn = parentNode.insertBefore.bind(parentNode);
parentNode.insertBefore = (node, anchor) => {
const shouldSortChildren = nodesMap.get(parentNode).some((el) => node === el || anchor === el);
if (shouldSortChildren)
vue.triggerRef(children);
return originalFn(node, anchor);
};
}
nodesMap.get(parentNode).push(childNode);
});
};
const removeChild = (child) => {
delete children.value[child.uid];
vue.triggerRef(children);
const childNode = child.getVnode().el;
const parentNode = childNode.parentNode;
const childNodes = nodesMap.get(parentNode);
const index = childNodes.indexOf(childNode);
childNodes.splice(index, 1);
};
const sortChildren = () => {
orderedChildren.value = getOrderedChildren(vm, childComponentName, children.value);
};
const IsolatedRenderer = (props) => {
return props.render();
};
const ChildrenSorter = vue.defineComponent({
setup(_, { slots }) {
return () => {
sortChildren();
return slots.default ? vue.h(IsolatedRenderer, {
render: slots.default
}) : null;
};
}
});
return {
children: orderedChildren,
addChild,
removeChild,
ChildrenSorter
};
};
exports.useOrderedChildren = useOrderedChildren;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
export declare const usePopperContainerId: () => {
id: import("vue").ComputedRef<string>;
selector: import("vue").ComputedRef<string>;
};
export declare const usePopperContainer: () => {
id: import("vue").ComputedRef<string>;
selector: import("vue").ComputedRef<string>;
};

View File

@@ -0,0 +1,45 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var index = require('../use-namespace/index.js');
var index$1 = require('../use-id/index.js');
var core = require('@vueuse/core');
const usePopperContainerId = () => {
const namespace = index.useGetDerivedNamespace();
const idInjection = index$1.useIdInjection();
const id = vue.computed(() => {
return `${namespace.value}-popper-container-${idInjection.prefix}`;
});
const selector = vue.computed(() => `#${id.value}`);
return {
id,
selector
};
};
const createContainer = (id) => {
const container = document.createElement("div");
container.id = id;
document.body.appendChild(container);
return container;
};
const usePopperContainer = () => {
const { id, selector } = usePopperContainerId();
vue.onBeforeMount(() => {
if (!core.isClient)
return;
if (!document.body.querySelector(selector.value)) {
createContainer(id.value);
}
});
return {
id,
selector
};
};
exports.usePopperContainer = usePopperContainer;
exports.usePopperContainerId = usePopperContainerId;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-popper-container/index.ts"],"sourcesContent":["import { computed, onBeforeMount } from 'vue'\nimport { isClient } from '@element-plus/utils'\nimport { useGetDerivedNamespace } from '../use-namespace'\nimport { useIdInjection } from '../use-id'\n\nexport const usePopperContainerId = () => {\n const namespace = useGetDerivedNamespace()\n const idInjection = useIdInjection()\n\n const id = computed(() => {\n return `${namespace.value}-popper-container-${idInjection.prefix}`\n })\n const selector = computed(() => `#${id.value}`)\n\n return {\n id,\n selector,\n }\n}\n\nconst createContainer = (id: string) => {\n const container = document.createElement('div')\n container.id = id\n document.body.appendChild(container)\n return container\n}\n\nexport const usePopperContainer = () => {\n const { id, selector } = usePopperContainerId()\n onBeforeMount(() => {\n if (!isClient) return\n\n // This is for bypassing the error that when under testing env, we often encounter\n // document.body.innerHTML = '' situation\n // for this we need to disable the caching since it's not really needed\n if (\n process.env.NODE_ENV === 'test' ||\n !document.body.querySelector(selector.value)\n ) {\n createContainer(id.value)\n }\n })\n\n return {\n id,\n selector,\n }\n}\n"],"names":["useGetDerivedNamespace","useIdInjection","computed","onBeforeMount","isClient"],"mappings":";;;;;;;;;AAIY,MAAC,oBAAoB,GAAG,MAAM;AAC1C,EAAE,MAAM,SAAS,GAAGA,4BAAsB,EAAE,CAAC;AAC7C,EAAE,MAAM,WAAW,GAAGC,sBAAc,EAAE,CAAC;AACvC,EAAE,MAAM,EAAE,GAAGC,YAAQ,CAAC,MAAM;AAC5B,IAAI,OAAO,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACvE,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,QAAQ,GAAGA,YAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClD,EAAE,OAAO;AACT,IAAI,EAAE;AACN,IAAI,QAAQ;AACZ,GAAG,CAAC;AACJ,EAAE;AACF,MAAM,eAAe,GAAG,CAAC,EAAE,KAAK;AAChC,EAAE,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAClD,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;AACpB,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;AACvC,EAAE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AACU,MAAC,kBAAkB,GAAG,MAAM;AACxC,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;AAClD,EAAEC,iBAAa,CAAC,MAAM;AACtB,IAAI,IAAI,CAACC,aAAQ;AACjB,MAAM,OAAO;AACb,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACtD,MAAM,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAChC,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,EAAE;AACN,IAAI,QAAQ;AACZ,GAAG,CAAC;AACJ;;;;;"}

View File

@@ -0,0 +1,78 @@
import type { Ref } from 'vue';
import type { Instance, Modifier, Options, State, VirtualElement } from '@popperjs/core';
type ElementType = HTMLElement | undefined;
type ReferenceElement = ElementType | VirtualElement;
export type PartialOptions = Partial<Options>;
export declare const usePopper: (referenceElementRef: Ref<ReferenceElement>, popperElementRef: Ref<ElementType>, opts?: Ref<PartialOptions> | PartialOptions) => {
state: import("vue").ComputedRef<{
elements?: {
reference: Element | VirtualElement;
popper: HTMLElement;
arrow?: HTMLElement;
} | undefined;
options?: import("@popperjs/core").OptionsGeneric<any> | undefined;
placement?: import("@popperjs/core").Placement | undefined;
strategy?: import("@popperjs/core").PositioningStrategy | undefined;
orderedModifiers?: Modifier<any, any>[] | undefined;
rects?: import("@popperjs/core").StateRects | undefined;
scrollParents?: {
reference: Array<Element | import("@popperjs/core").Window | import("@popperjs/core").VisualViewport>;
popper: Array<Element | import("@popperjs/core").Window | import("@popperjs/core").VisualViewport>;
} | undefined;
styles?: {
[key: string]: Partial<CSSStyleDeclaration>;
} | undefined;
attributes?: {
[key: string]: {
[key: string]: string | boolean;
};
} | undefined;
modifiersData?: {
[key: string]: any;
arrow?: {
x?: number;
y?: number;
centerOffset: number;
};
hide?: {
isReferenceHidden: boolean;
hasPopperEscaped: boolean;
referenceClippingOffsets: import("@popperjs/core").SideObject;
popperEscapeOffsets: import("@popperjs/core").SideObject;
};
offset?: {
top?: import("@popperjs/core").Offsets | undefined;
bottom?: import("@popperjs/core").Offsets | undefined;
left?: import("@popperjs/core").Offsets | undefined;
right?: import("@popperjs/core").Offsets | undefined;
auto?: import("@popperjs/core").Offsets | undefined;
"auto-start"?: import("@popperjs/core").Offsets | undefined;
"auto-end"?: import("@popperjs/core").Offsets | undefined;
"top-start"?: import("@popperjs/core").Offsets | undefined;
"top-end"?: import("@popperjs/core").Offsets | undefined;
"bottom-start"?: import("@popperjs/core").Offsets | undefined;
"bottom-end"?: import("@popperjs/core").Offsets | undefined;
"right-start"?: import("@popperjs/core").Offsets | undefined;
"right-end"?: import("@popperjs/core").Offsets | undefined;
"left-start"?: import("@popperjs/core").Offsets | undefined;
"left-end"?: import("@popperjs/core").Offsets | undefined;
};
preventOverflow?: import("@popperjs/core").Offsets;
popperOffsets?: import("@popperjs/core").Offsets;
} | undefined;
reset?: boolean | undefined;
}>;
styles: import("vue").ComputedRef<{
[key: string]: Partial<CSSStyleDeclaration>;
}>;
attributes: import("vue").ComputedRef<{
[key: string]: {
[key: string]: string | boolean;
};
}>;
update: () => Promise<Partial<State>> | undefined;
forceUpdate: () => void | undefined;
instanceRef: import("vue").ComputedRef<Instance | undefined>;
};
export type UsePopperReturn = ReturnType<typeof usePopper>;
export {};

View File

@@ -0,0 +1,99 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@popperjs/core');
var lodashUnified = require('lodash-unified');
const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
const stateUpdater = {
name: "updateState",
enabled: true,
phase: "write",
fn: ({ state }) => {
const derivedState = deriveState(state);
Object.assign(states.value, derivedState);
},
requires: ["computeStyles"]
};
const options = vue.computed(() => {
const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts);
return {
onFirstUpdate,
placement: placement || "bottom",
strategy: strategy || "absolute",
modifiers: [
...modifiers || [],
stateUpdater,
{ name: "applyStyles", enabled: false }
]
};
});
const instanceRef = vue.shallowRef();
const states = vue.ref({
styles: {
popper: {
position: vue.unref(options).strategy,
left: "0",
top: "0"
},
arrow: {
position: "absolute"
}
},
attributes: {}
});
const destroy = () => {
if (!instanceRef.value)
return;
instanceRef.value.destroy();
instanceRef.value = void 0;
};
vue.watch(options, (newOptions) => {
const instance = vue.unref(instanceRef);
if (instance) {
instance.setOptions(newOptions);
}
}, {
deep: true
});
vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
destroy();
if (!referenceElement || !popperElement)
return;
instanceRef.value = core.createPopper(referenceElement, popperElement, vue.unref(options));
});
vue.onBeforeUnmount(() => {
destroy();
});
return {
state: vue.computed(() => {
var _a;
return { ...((_a = vue.unref(instanceRef)) == null ? void 0 : _a.state) || {} };
}),
styles: vue.computed(() => vue.unref(states).styles),
attributes: vue.computed(() => vue.unref(states).attributes),
update: () => {
var _a;
return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.update();
},
forceUpdate: () => {
var _a;
return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
},
instanceRef: vue.computed(() => vue.unref(instanceRef))
};
};
function deriveState(state) {
const elements = Object.keys(state.elements);
const styles = lodashUnified.fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
const attributes = lodashUnified.fromPairs(elements.map((element) => [element, state.attributes[element]]));
return {
styles,
attributes
};
}
exports.usePopper = usePopper;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import type { Ref } from 'vue';
export declare const usePreventGlobal: <E extends keyof DocumentEventMap>(indicator: Ref<boolean>, evt: E, cb: (e: DocumentEventMap[E]) => boolean) => void;

View File

@@ -0,0 +1,24 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var core = require('@vueuse/core');
const usePreventGlobal = (indicator, evt, cb) => {
const prevent = (e) => {
if (cb(e))
e.stopImmediatePropagation();
};
let stop = void 0;
vue.watch(() => indicator.value, (val) => {
if (val) {
stop = core.useEventListener(document, evt, prevent, true);
} else {
stop == null ? void 0 : stop();
}
}, { immediate: true });
};
exports.usePreventGlobal = usePreventGlobal;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-prevent-global/index.ts"],"sourcesContent":["import { watch } from 'vue'\nimport { useEventListener } from '@vueuse/core'\n\nimport type { Ref } from 'vue'\n\nexport const usePreventGlobal = <E extends keyof DocumentEventMap>(\n indicator: Ref<boolean>,\n evt: E,\n cb: (e: DocumentEventMap[E]) => boolean\n) => {\n const prevent = (e: DocumentEventMap[E]) => {\n if (cb(e)) e.stopImmediatePropagation()\n }\n let stop: (() => void) | undefined = undefined\n watch(\n () => indicator.value,\n (val) => {\n if (val) {\n stop = useEventListener(document, evt, prevent, true)\n } else {\n stop?.()\n }\n },\n { immediate: true }\n )\n}\n"],"names":["watch","useEventListener"],"mappings":";;;;;;;AAEY,MAAC,gBAAgB,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,KAAK;AACxD,EAAE,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK;AACzB,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;AACb,MAAM,CAAC,CAAC,wBAAwB,EAAE,CAAC;AACnC,GAAG,CAAC;AACJ,EAAE,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC;AACpB,EAAEA,SAAK,CAAC,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK;AACxC,IAAI,IAAI,GAAG,EAAE;AACb,MAAM,IAAI,GAAGC,qBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAC5D,KAAK,MAAM;AACX,MAAM,IAAI,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC;AACrC,KAAK;AACL,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1B;;;;"}

View File

@@ -0,0 +1,2 @@
import type { ComputedRef } from 'vue';
export declare const useProp: <T>(name: string) => ComputedRef<T | undefined>;

16
node_modules/element-plus/lib/hooks/use-prop/index.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
const useProp = (name) => {
const vm = vue.getCurrentInstance();
return vue.computed(() => {
var _a, _b;
return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
});
};
exports.useProp = useProp;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-prop/index.ts"],"sourcesContent":["import { computed, getCurrentInstance } from 'vue'\n\nimport type { ComputedRef } from 'vue'\n\nexport const useProp = <T>(name: string): ComputedRef<T | undefined> => {\n const vm = getCurrentInstance()\n return computed(() => (vm?.proxy?.$props as any)?.[name])\n}\n"],"names":["getCurrentInstance","computed"],"mappings":";;;;;;AACY,MAAC,OAAO,GAAG,CAAC,IAAI,KAAK;AACjC,EAAE,MAAM,EAAE,GAAGA,sBAAkB,EAAE,CAAC;AAClC,EAAE,OAAOC,YAAQ,CAAC,MAAM;AACxB,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC;AACf,IAAI,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACjH,GAAG,CAAC,CAAC;AACL;;;;"}

View File

@@ -0,0 +1,5 @@
export declare const useSameTarget: (handleClick?: (e: MouseEvent) => void) => {
onClick: (e: MouseEvent) => void;
onMousedown: (e: MouseEvent) => void;
onMouseup: (e: MouseEvent) => void;
};

View File

@@ -0,0 +1,29 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var shared = require('@vue/shared');
const useSameTarget = (handleClick) => {
if (!handleClick) {
return { onClick: shared.NOOP, onMousedown: shared.NOOP, onMouseup: shared.NOOP };
}
let mousedownTarget = false;
let mouseupTarget = false;
const onClick = (e) => {
if (mousedownTarget && mouseupTarget) {
handleClick(e);
}
mousedownTarget = mouseupTarget = false;
};
const onMousedown = (e) => {
mousedownTarget = e.target === e.currentTarget;
};
const onMouseup = (e) => {
mouseupTarget = e.target === e.currentTarget;
};
return { onClick, onMousedown, onMouseup };
};
exports.useSameTarget = useSameTarget;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-same-target/index.ts"],"sourcesContent":["import { NOOP } from '@element-plus/utils'\n\nexport const useSameTarget = (handleClick?: (e: MouseEvent) => void) => {\n if (!handleClick) {\n return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP }\n }\n\n let mousedownTarget = false\n let mouseupTarget = false\n // refer to this https://javascript.info/mouse-events-basics\n // events fired in the order: mousedown -> mouseup -> click\n // we need to set the mousedown handle to false after click fired.\n const onClick = (e: MouseEvent) => {\n // if and only if\n if (mousedownTarget && mouseupTarget) {\n handleClick(e)\n }\n mousedownTarget = mouseupTarget = false\n }\n\n const onMousedown = (e: MouseEvent) => {\n // marking current mousedown target.\n mousedownTarget = e.target === e.currentTarget\n }\n const onMouseup = (e: MouseEvent) => {\n // marking current mouseup target.\n mouseupTarget = e.target === e.currentTarget\n }\n\n return { onClick, onMousedown, onMouseup }\n}\n"],"names":["NOOP"],"mappings":";;;;;;AACY,MAAC,aAAa,GAAG,CAAC,WAAW,KAAK;AAC9C,EAAE,IAAI,CAAC,WAAW,EAAE;AACpB,IAAI,OAAO,EAAE,OAAO,EAAEA,WAAI,EAAE,WAAW,EAAEA,WAAI,EAAE,SAAS,EAAEA,WAAI,EAAE,CAAC;AACjE,GAAG;AACH,EAAE,IAAI,eAAe,GAAG,KAAK,CAAC;AAC9B,EAAE,IAAI,aAAa,GAAG,KAAK,CAAC;AAC5B,EAAE,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK;AACzB,IAAI,IAAI,eAAe,IAAI,aAAa,EAAE;AAC1C,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC;AACrB,KAAK;AACL,IAAI,eAAe,GAAG,aAAa,GAAG,KAAK,CAAC;AAC5C,GAAG,CAAC;AACJ,EAAE,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK;AAC7B,IAAI,eAAe,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,aAAa,CAAC;AACnD,GAAG,CAAC;AACJ,EAAE,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK;AAC3B,IAAI,aAAa,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,aAAa,CAAC;AACjD,GAAG,CAAC;AACJ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAC7C;;;;"}

View File

@@ -0,0 +1,21 @@
import type { InjectionKey, Ref } from 'vue';
import type { ComponentSize } from 'element-plus/es/constants';
export declare const useSizeProp: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
export declare const useSizeProps: {
size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
};
export interface SizeContext {
size: Ref<ComponentSize>;
}
export declare const SIZE_INJECTION_KEY: InjectionKey<SizeContext>;
export declare const useGlobalSize: () => import("vue").ComputedRef<"" | "small" | "default" | "large">;

29
node_modules/element-plus/lib/hooks/use-size/index.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var runtime = require('../../utils/vue/props/runtime.js');
var size = require('../../constants/size.js');
const useSizeProp = runtime.buildProp({
type: String,
values: size.componentSizes,
required: false
});
const useSizeProps = {
size: useSizeProp
};
const SIZE_INJECTION_KEY = Symbol("size");
const useGlobalSize = () => {
const injectedSize = vue.inject(SIZE_INJECTION_KEY, {});
return vue.computed(() => {
return vue.unref(injectedSize.size) || "";
});
};
exports.SIZE_INJECTION_KEY = SIZE_INJECTION_KEY;
exports.useGlobalSize = useGlobalSize;
exports.useSizeProp = useSizeProp;
exports.useSizeProps = useSizeProps;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-size/index.ts"],"sourcesContent":["import { computed, inject, unref } from 'vue'\nimport { buildProp } from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\n\nimport type { InjectionKey, Ref } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\n\nexport const useSizeProp = buildProp({\n type: String,\n values: componentSizes,\n required: false,\n} as const)\n\nexport const useSizeProps = {\n size: useSizeProp,\n}\n\nexport interface SizeContext {\n size: Ref<ComponentSize>\n}\n\nexport const SIZE_INJECTION_KEY: InjectionKey<SizeContext> = Symbol('size')\n\nexport const useGlobalSize = () => {\n const injectedSize = inject(SIZE_INJECTION_KEY, {} as SizeContext)\n\n return computed<ComponentSize>(() => {\n return unref(injectedSize.size) || ''\n })\n}\n"],"names":["buildProp","componentSizes","inject","computed","unref"],"mappings":";;;;;;;;AAGY,MAAC,WAAW,GAAGA,iBAAS,CAAC;AACrC,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,MAAM,EAAEC,mBAAc;AACxB,EAAE,QAAQ,EAAE,KAAK;AACjB,CAAC,EAAE;AACS,MAAC,YAAY,GAAG;AAC5B,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE;AACU,MAAC,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE;AACrC,MAAC,aAAa,GAAG,MAAM;AACnC,EAAE,MAAM,YAAY,GAAGC,UAAM,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AACtD,EAAE,OAAOC,YAAQ,CAAC,MAAM;AACxB,IAAI,OAAOC,SAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AAC1C,GAAG,CAAC,CAAC;AACL;;;;;;;"}

View File

@@ -0,0 +1,7 @@
import type { Ref, VNode } from 'vue';
export declare const useTeleport: (contentRenderer: () => VNode, appendToBody: Ref<boolean>) => {
isTeleportVisible: Ref<boolean>;
showTeleport: () => void;
hideTeleport: () => void;
renderTeleport: () => void;
};

View File

@@ -0,0 +1,47 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var globalNode = require('../../utils/vue/global-node.js');
var core = require('@vueuse/core');
var shared = require('@vue/shared');
const useTeleport = (contentRenderer, appendToBody) => {
const isTeleportVisible = vue.ref(false);
if (!core.isClient) {
return {
isTeleportVisible,
showTeleport: shared.NOOP,
hideTeleport: shared.NOOP,
renderTeleport: shared.NOOP
};
}
let $el = null;
const showTeleport = () => {
isTeleportVisible.value = true;
if ($el !== null)
return;
$el = globalNode.createGlobalNode();
};
const hideTeleport = () => {
isTeleportVisible.value = false;
if ($el !== null) {
globalNode.removeGlobalNode($el);
$el = null;
}
};
const renderTeleport = () => {
return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
};
vue.onUnmounted(hideTeleport);
return {
isTeleportVisible,
showTeleport,
hideTeleport,
renderTeleport
};
};
exports.useTeleport = useTeleport;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-teleport/index.ts"],"sourcesContent":["import { Teleport, h, onUnmounted, ref } from 'vue'\nimport {\n NOOP,\n createGlobalNode,\n isClient,\n removeGlobalNode,\n} from '@element-plus/utils'\n\nimport type { Ref, VNode } from 'vue'\n\nexport const useTeleport = (\n contentRenderer: () => VNode,\n appendToBody: Ref<boolean>\n) => {\n const isTeleportVisible = ref(false)\n\n if (!isClient) {\n return {\n isTeleportVisible,\n showTeleport: NOOP,\n hideTeleport: NOOP,\n renderTeleport: NOOP,\n }\n }\n\n let $el: HTMLElement | null = null\n\n const showTeleport = () => {\n isTeleportVisible.value = true\n // this allows the delayed showing strategy since the the content itself could be enterable\n // e.g. el-popper\n if ($el !== null) return\n\n $el = createGlobalNode()\n }\n\n const hideTeleport = () => {\n isTeleportVisible.value = false\n if ($el !== null) {\n removeGlobalNode($el)\n $el = null\n }\n }\n\n const renderTeleport = () => {\n return appendToBody.value !== true\n ? contentRenderer()\n : isTeleportVisible.value\n ? [h(Teleport, { to: $el }, contentRenderer())]\n : undefined\n }\n\n onUnmounted(hideTeleport)\n\n return {\n isTeleportVisible,\n showTeleport,\n hideTeleport,\n renderTeleport,\n }\n}\n"],"names":["ref","isClient","NOOP","createGlobalNode","removeGlobalNode","h","Teleport","onUnmounted"],"mappings":";;;;;;;;;AAOY,MAAC,WAAW,GAAG,CAAC,eAAe,EAAE,YAAY,KAAK;AAC9D,EAAE,MAAM,iBAAiB,GAAGA,OAAG,CAAC,KAAK,CAAC,CAAC;AACvC,EAAE,IAAI,CAACC,aAAQ,EAAE;AACjB,IAAI,OAAO;AACX,MAAM,iBAAiB;AACvB,MAAM,YAAY,EAAEC,WAAI;AACxB,MAAM,YAAY,EAAEA,WAAI;AACxB,MAAM,cAAc,EAAEA,WAAI;AAC1B,KAAK,CAAC;AACN,GAAG;AACH,EAAE,IAAI,GAAG,GAAG,IAAI,CAAC;AACjB,EAAE,MAAM,YAAY,GAAG,MAAM;AAC7B,IAAI,iBAAiB,CAAC,KAAK,GAAG,IAAI,CAAC;AACnC,IAAI,IAAI,GAAG,KAAK,IAAI;AACpB,MAAM,OAAO;AACb,IAAI,GAAG,GAAGC,2BAAgB,EAAE,CAAC;AAC7B,GAAG,CAAC;AACJ,EAAE,MAAM,YAAY,GAAG,MAAM;AAC7B,IAAI,iBAAiB,CAAC,KAAK,GAAG,KAAK,CAAC;AACpC,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE;AACtB,MAAMC,2BAAgB,CAAC,GAAG,CAAC,CAAC;AAC5B,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,MAAM,cAAc,GAAG,MAAM;AAC/B,IAAI,OAAO,YAAY,CAAC,KAAK,KAAK,IAAI,GAAG,eAAe,EAAE,GAAG,iBAAiB,CAAC,KAAK,GAAG,CAACC,KAAC,CAACC,YAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AAC9I,GAAG,CAAC;AACJ,EAAEC,eAAW,CAAC,YAAY,CAAC,CAAC;AAC5B,EAAE,OAAO;AACT,IAAI,iBAAiB;AACrB,IAAI,YAAY;AAChB,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,GAAG,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,7 @@
import type { Ref } from 'vue';
export type ThrottleType = {
leading?: number;
trailing?: number;
initVal?: boolean;
} | number;
export declare const useThrottleRender: (loading: Ref<boolean>, throttle?: ThrottleType) => Ref<boolean>;

View File

@@ -0,0 +1,50 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var types = require('../../utils/types.js');
var shared = require('@vue/shared');
const useThrottleRender = (loading, throttle = 0) => {
if (throttle === 0)
return loading;
const initVal = shared.isObject(throttle) && Boolean(throttle.initVal);
const throttled = vue.ref(initVal);
let timeoutHandle = null;
const dispatchThrottling = (timer) => {
if (types.isUndefined(timer)) {
throttled.value = loading.value;
return;
}
if (timeoutHandle) {
clearTimeout(timeoutHandle);
}
timeoutHandle = setTimeout(() => {
throttled.value = loading.value;
}, timer);
};
const dispatcher = (type) => {
if (type === "leading") {
if (types.isNumber(throttle)) {
dispatchThrottling(throttle);
} else {
dispatchThrottling(throttle.leading);
}
} else {
if (shared.isObject(throttle)) {
dispatchThrottling(throttle.trailing);
} else {
throttled.value = false;
}
}
};
vue.onMounted(() => dispatcher("leading"));
vue.watch(() => loading.value, (val) => {
dispatcher(val ? "leading" : "trailing");
});
return throttled;
};
exports.useThrottleRender = useThrottleRender;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-throttle-render/index.ts"],"sourcesContent":["import { onMounted, ref, watch } from 'vue'\nimport { isNumber, isObject, isUndefined } from '@element-plus/utils'\n\nimport type { Ref } from 'vue'\n\nexport type ThrottleType =\n | { leading?: number; trailing?: number; initVal?: boolean }\n | number\n\nexport const useThrottleRender = (\n loading: Ref<boolean>,\n throttle: ThrottleType = 0\n) => {\n if (throttle === 0) return loading\n const initVal = isObject(throttle) && Boolean(throttle.initVal)\n const throttled = ref(initVal)\n let timeoutHandle: ReturnType<typeof setTimeout> | null = null\n\n const dispatchThrottling = (timer: number | undefined) => {\n if (isUndefined(timer)) {\n throttled.value = loading.value\n return\n }\n if (timeoutHandle) {\n clearTimeout(timeoutHandle)\n }\n timeoutHandle = setTimeout(() => {\n throttled.value = loading.value\n }, timer)\n }\n\n const dispatcher = (type: 'leading' | 'trailing') => {\n if (type === 'leading') {\n if (isNumber(throttle)) {\n dispatchThrottling(throttle)\n } else {\n dispatchThrottling(throttle.leading)\n }\n } else {\n if (isObject(throttle)) {\n dispatchThrottling(throttle.trailing)\n } else {\n throttled.value = false\n }\n }\n }\n\n onMounted(() => dispatcher('leading'))\n\n watch(\n () => loading.value,\n (val) => {\n dispatcher(val ? 'leading' : 'trailing')\n }\n )\n\n return throttled\n}\n"],"names":["isObject","ref","isUndefined","isNumber","onMounted","watch"],"mappings":";;;;;;;;AAEY,MAAC,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,GAAG,CAAC,KAAK;AAC5D,EAAE,IAAI,QAAQ,KAAK,CAAC;AACpB,IAAI,OAAO,OAAO,CAAC;AACnB,EAAE,MAAM,OAAO,GAAGA,eAAQ,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClE,EAAE,MAAM,SAAS,GAAGC,OAAG,CAAC,OAAO,CAAC,CAAC;AACjC,EAAE,IAAI,aAAa,GAAG,IAAI,CAAC;AAC3B,EAAE,MAAM,kBAAkB,GAAG,CAAC,KAAK,KAAK;AACxC,IAAI,IAAIC,iBAAW,CAAC,KAAK,CAAC,EAAE;AAC5B,MAAM,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AACtC,MAAM,OAAO;AACb,KAAK;AACL,IAAI,IAAI,aAAa,EAAE;AACvB,MAAM,YAAY,CAAC,aAAa,CAAC,CAAC;AAClC,KAAK;AACL,IAAI,aAAa,GAAG,UAAU,CAAC,MAAM;AACrC,MAAM,SAAS,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AACtC,KAAK,EAAE,KAAK,CAAC,CAAC;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,UAAU,GAAG,CAAC,IAAI,KAAK;AAC/B,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;AAC5B,MAAM,IAAIC,cAAQ,CAAC,QAAQ,CAAC,EAAE;AAC9B,QAAQ,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACrC,OAAO,MAAM;AACb,QAAQ,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC7C,OAAO;AACP,KAAK,MAAM;AACX,MAAM,IAAIH,eAAQ,CAAC,QAAQ,CAAC,EAAE;AAC9B,QAAQ,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC9C,OAAO,MAAM;AACb,QAAQ,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;AAChC,OAAO;AACP,KAAK;AACL,GAAG,CAAC;AACJ,EAAEI,aAAS,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AACzC,EAAEC,SAAK,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK;AACtC,IAAI,UAAU,CAAC,GAAG,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;AAC7C,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,SAAS,CAAC;AACnB;;;;"}

View File

@@ -0,0 +1,4 @@
export declare function useTimeout(): {
registerTimeout: (fn: (...args: any[]) => any, delay: number) => void;
cancelTimeout: () => void;
};

View File

@@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var core = require('@vueuse/core');
function useTimeout() {
let timeoutHandle;
const registerTimeout = (fn, delay) => {
cancelTimeout();
timeoutHandle = window.setTimeout(fn, delay);
};
const cancelTimeout = () => window.clearTimeout(timeoutHandle);
core.tryOnScopeDispose(() => cancelTimeout());
return {
registerTimeout,
cancelTimeout
};
}
exports.useTimeout = useTimeout;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-timeout/index.ts"],"sourcesContent":["import { tryOnScopeDispose } from '@vueuse/core'\n\nexport function useTimeout() {\n let timeoutHandle: number\n\n const registerTimeout = (fn: (...args: any[]) => any, delay: number) => {\n cancelTimeout()\n timeoutHandle = window.setTimeout(fn, delay)\n }\n const cancelTimeout = () => window.clearTimeout(timeoutHandle)\n\n tryOnScopeDispose(() => cancelTimeout())\n\n return {\n registerTimeout,\n cancelTimeout,\n }\n}\n"],"names":["tryOnScopeDispose"],"mappings":";;;;;;AACO,SAAS,UAAU,GAAG;AAC7B,EAAE,IAAI,aAAa,CAAC;AACpB,EAAE,MAAM,eAAe,GAAG,CAAC,EAAE,EAAE,KAAK,KAAK;AACzC,IAAI,aAAa,EAAE,CAAC;AACpB,IAAI,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,GAAG,CAAC;AACJ,EAAE,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;AACjE,EAAEA,sBAAiB,CAAC,MAAM,aAAa,EAAE,CAAC,CAAC;AAC3C,EAAE,OAAO;AACT,IAAI,eAAe;AACnB,IAAI,aAAa;AACjB,GAAG,CAAC;AACJ;;;;"}

View File

@@ -0,0 +1,37 @@
export declare const useTransitionFallthroughEmits: readonly ["after-appear", "after-enter", "after-leave", "appear", "appear-cancelled", "before-enter", "before-leave", "enter", "enter-cancelled", "leave", "leave-cancelled"];
/**
* NOTE:
* This is only a delegator for delegating transition callbacks.
* Use this at your need.
*/
/**
* Simple usage
*
* In your setups:
*
* setup() {
* const fallthroughMethods = useTransitionFallthrough()
* return fallthrough
* }
*
* In your template:
*
* <template>
* <transition name="whatever" v-bind="fallthrough">
* <slot />
* </transition>
* </template>
*
*/
export declare const useTransitionFallthrough: () => {
onAfterAppear: () => void;
onAfterEnter: () => void;
onAfterLeave: () => void;
onAppearCancelled: () => void;
onBeforeEnter: () => void;
onBeforeLeave: () => void;
onEnter: () => void;
onEnterCancelled: () => void;
onLeave: () => void;
onLeaveCancelled: () => void;
};

View File

@@ -0,0 +1,69 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
const AFTER_APPEAR = "after-appear";
const AFTER_ENTER = "after-enter";
const AFTER_LEAVE = "after-leave";
const APPEAR = "appear";
const APPEAR_CANCELLED = "appear-cancelled";
const BEFORE_ENTER = "before-enter";
const BEFORE_LEAVE = "before-leave";
const ENTER = "enter";
const ENTER_CANCELLED = "enter-cancelled";
const LEAVE = "leave";
const LEAVE_CANCELLED = "leave-cancelled";
const useTransitionFallthroughEmits = [
AFTER_APPEAR,
AFTER_ENTER,
AFTER_LEAVE,
APPEAR,
APPEAR_CANCELLED,
BEFORE_ENTER,
BEFORE_LEAVE,
ENTER,
ENTER_CANCELLED,
LEAVE,
LEAVE_CANCELLED
];
const useTransitionFallthrough = () => {
const { emit } = vue.getCurrentInstance();
return {
onAfterAppear: () => {
emit(AFTER_APPEAR);
},
onAfterEnter: () => {
emit(AFTER_ENTER);
},
onAfterLeave: () => {
emit(AFTER_LEAVE);
},
onAppearCancelled: () => {
emit(APPEAR_CANCELLED);
},
onBeforeEnter: () => {
emit(BEFORE_ENTER);
},
onBeforeLeave: () => {
emit(BEFORE_LEAVE);
},
onEnter: () => {
emit(ENTER);
},
onEnterCancelled: () => {
emit(ENTER_CANCELLED);
},
onLeave: () => {
emit(LEAVE);
},
onLeaveCancelled: () => {
emit(LEAVE_CANCELLED);
}
};
};
exports.useTransitionFallthrough = useTransitionFallthrough;
exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-transition-fallthrough/index.ts"],"sourcesContent":["/* istanbul ignore file */\nimport { getCurrentInstance } from 'vue'\n\nconst AFTER_APPEAR = 'after-appear'\nconst AFTER_ENTER = 'after-enter'\nconst AFTER_LEAVE = 'after-leave'\nconst APPEAR = 'appear'\nconst APPEAR_CANCELLED = 'appear-cancelled'\nconst BEFORE_ENTER = 'before-enter'\nconst BEFORE_LEAVE = 'before-leave'\nconst ENTER = 'enter'\nconst ENTER_CANCELLED = 'enter-cancelled'\nconst LEAVE = 'leave'\nconst LEAVE_CANCELLED = 'leave-cancelled'\n\nexport const useTransitionFallthroughEmits = [\n AFTER_APPEAR,\n AFTER_ENTER,\n AFTER_LEAVE,\n APPEAR,\n APPEAR_CANCELLED,\n BEFORE_ENTER,\n BEFORE_LEAVE,\n ENTER,\n ENTER_CANCELLED,\n LEAVE,\n LEAVE_CANCELLED,\n] as const\n\n// Sometimes we want to delegate the transition emitted event\n// we have to right the function locally, which is not a good\n// approach to this, so we created this hook for the event\n// fallthrough\n\n/**\n * NOTE:\n * This is only a delegator for delegating transition callbacks.\n * Use this at your need.\n */\n\n/**\n * Simple usage\n *\n * In your setups:\n *\n * setup() {\n * const fallthroughMethods = useTransitionFallthrough()\n * return fallthrough\n * }\n *\n * In your template:\n *\n * <template>\n * <transition name=\"whatever\" v-bind=\"fallthrough\">\n * <slot />\n * </transition>\n * </template>\n *\n */\n\nexport const useTransitionFallthrough = () => {\n const { emit } = getCurrentInstance()!\n\n return {\n onAfterAppear: () => {\n emit(AFTER_APPEAR)\n },\n onAfterEnter: () => {\n emit(AFTER_ENTER)\n },\n onAfterLeave: () => {\n emit(AFTER_LEAVE)\n },\n onAppearCancelled: () => {\n emit(APPEAR_CANCELLED)\n },\n onBeforeEnter: () => {\n emit(BEFORE_ENTER)\n },\n onBeforeLeave: () => {\n emit(BEFORE_LEAVE)\n },\n onEnter: () => {\n emit(ENTER)\n },\n onEnterCancelled: () => {\n emit(ENTER_CANCELLED)\n },\n onLeave: () => {\n emit(LEAVE)\n },\n onLeaveCancelled: () => {\n emit(LEAVE_CANCELLED)\n },\n }\n}\n"],"names":["getCurrentInstance"],"mappings":";;;;;;AACA,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAC5C,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC9B,MAAC,6BAA6B,GAAG;AAC7C,EAAE,YAAY;AACd,EAAE,WAAW;AACb,EAAE,WAAW;AACb,EAAE,MAAM;AACR,EAAE,gBAAgB;AAClB,EAAE,YAAY;AACd,EAAE,YAAY;AACd,EAAE,KAAK;AACP,EAAE,eAAe;AACjB,EAAE,KAAK;AACP,EAAE,eAAe;AACjB,EAAE;AACU,MAAC,wBAAwB,GAAG,MAAM;AAC9C,EAAE,MAAM,EAAE,IAAI,EAAE,GAAGA,sBAAkB,EAAE,CAAC;AACxC,EAAE,OAAO;AACT,IAAI,aAAa,EAAE,MAAM;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC;AACzB,KAAK;AACL,IAAI,YAAY,EAAE,MAAM;AACxB,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC;AACxB,KAAK;AACL,IAAI,YAAY,EAAE,MAAM;AACxB,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC;AACxB,KAAK;AACL,IAAI,iBAAiB,EAAE,MAAM;AAC7B,MAAM,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAC7B,KAAK;AACL,IAAI,aAAa,EAAE,MAAM;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC;AACzB,KAAK;AACL,IAAI,aAAa,EAAE,MAAM;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC;AACzB,KAAK;AACL,IAAI,OAAO,EAAE,MAAM;AACnB,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;AAClB,KAAK;AACL,IAAI,gBAAgB,EAAE,MAAM;AAC5B,MAAM,IAAI,CAAC,eAAe,CAAC,CAAC;AAC5B,KAAK;AACL,IAAI,OAAO,EAAE,MAAM;AACnB,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;AAClB,KAAK;AACL,IAAI,gBAAgB,EAAE,MAAM;AAC5B,MAAM,IAAI,CAAC,eAAe,CAAC,CAAC;AAC5B,KAAK;AACL,GAAG,CAAC;AACJ;;;;;"}

View File

@@ -0,0 +1,13 @@
import type { InjectionKey, Ref } from 'vue';
export interface ElZIndexInjectionContext {
current: number;
}
export declare const defaultInitialZIndex = 2000;
export declare const ZINDEX_INJECTION_KEY: InjectionKey<ElZIndexInjectionContext>;
export declare const zIndexContextKey: InjectionKey<Ref<number | undefined>>;
export declare const useZIndex: (zIndexOverrides?: Ref<number>) => {
initialZIndex: import("vue").ComputedRef<number>;
currentZIndex: import("vue").ComputedRef<number>;
nextZIndex: () => number;
};
export type UseZIndexReturn = ReturnType<typeof useZIndex>;

Some files were not shown because too many files have changed in this diff Show More