element-plus 2.2.33 → 2.2.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.full.js +65 -29
- package/dist/index.full.min.js +19 -19
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +19 -19
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +64 -30
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/config-provider/index.mjs +1 -1
- package/es/components/config-provider/src/hooks/use-global-config.d.ts +26 -0
- package/es/components/config-provider/src/hooks/use-global-config.mjs +24 -4
- package/es/components/config-provider/src/hooks/use-global-config.mjs.map +1 -1
- package/es/components/index.mjs +1 -1
- package/es/components/loading/src/loading.mjs +13 -6
- package/es/components/loading/src/loading.mjs.map +1 -1
- package/es/components/loading/src/service.mjs +2 -5
- package/es/components/loading/src/service.mjs.map +1 -1
- package/es/components/message/src/message.vue.d.ts +5 -0
- package/es/components/message/src/message2.mjs +4 -5
- package/es/components/message/src/message2.mjs.map +1 -1
- package/es/components/message-box/src/index.mjs +5 -6
- package/es/components/message-box/src/index.mjs.map +1 -1
- package/es/components/message-box/src/index.vue.d.ts +2 -1852
- package/es/components/notification/src/notification.vue.d.ts +7 -0
- package/es/components/notification/src/notification2.mjs +6 -4
- package/es/components/notification/src/notification2.mjs.map +1 -1
- package/es/components/notification/src/notify.mjs +0 -4
- package/es/components/notification/src/notify.mjs.map +1 -1
- package/es/components/table-v2/src/renderers/cell.mjs +1 -1
- package/es/components/table-v2/src/renderers/cell.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip.vue.d.ts +9 -12
- package/es/components/tree-select/src/cache-options.mjs +6 -2
- package/es/components/tree-select/src/cache-options.mjs.map +1 -1
- package/es/hooks/index.mjs +1 -1
- package/es/hooks/use-locale/index.d.ts +1 -1
- package/es/hooks/use-locale/index.mjs +2 -2
- package/es/hooks/use-locale/index.mjs.map +1 -1
- package/es/hooks/use-namespace/index.d.ts +2 -2
- package/es/hooks/use-namespace/index.mjs +4 -4
- package/es/hooks/use-namespace/index.mjs.map +1 -1
- package/es/hooks/use-popper-container/index.d.ts +4 -1
- package/es/hooks/use-popper-container/index.mjs +5 -1
- package/es/hooks/use-popper-container/index.mjs.map +1 -1
- package/es/hooks/use-z-index/index.d.ts +3 -1
- package/es/hooks/use-z-index/index.mjs +3 -3
- package/es/hooks/use-z-index/index.mjs.map +1 -1
- package/es/index.mjs +2 -2
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/config-provider/index.js +1 -0
- package/lib/components/config-provider/index.js.map +1 -1
- package/lib/components/config-provider/src/hooks/use-global-config.d.ts +26 -0
- package/lib/components/config-provider/src/hooks/use-global-config.js +26 -5
- package/lib/components/config-provider/src/hooks/use-global-config.js.map +1 -1
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/loading/src/loading.js +12 -5
- package/lib/components/loading/src/loading.js.map +1 -1
- package/lib/components/loading/src/service.js +2 -5
- package/lib/components/loading/src/service.js.map +1 -1
- package/lib/components/message/src/message.vue.d.ts +5 -0
- package/lib/components/message/src/message2.js +9 -10
- package/lib/components/message/src/message2.js.map +1 -1
- package/lib/components/message-box/src/index.js +16 -17
- package/lib/components/message-box/src/index.js.map +1 -1
- package/lib/components/message-box/src/index.vue.d.ts +2 -1852
- package/lib/components/notification/src/notification.vue.d.ts +7 -0
- package/lib/components/notification/src/notification2.js +9 -7
- package/lib/components/notification/src/notification2.js.map +1 -1
- package/lib/components/notification/src/notify.js +0 -4
- package/lib/components/notification/src/notify.js.map +1 -1
- package/lib/components/table-v2/src/renderers/cell.js +1 -1
- package/lib/components/table-v2/src/renderers/cell.js.map +1 -1
- package/lib/components/tooltip/src/tooltip.vue.d.ts +9 -12
- package/lib/components/tree-select/src/cache-options.js +6 -2
- package/lib/components/tree-select/src/cache-options.js.map +1 -1
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-locale/index.d.ts +1 -1
- package/lib/hooks/use-locale/index.js +2 -2
- package/lib/hooks/use-locale/index.js.map +1 -1
- package/lib/hooks/use-namespace/index.d.ts +2 -2
- package/lib/hooks/use-namespace/index.js +4 -4
- package/lib/hooks/use-namespace/index.js.map +1 -1
- package/lib/hooks/use-popper-container/index.d.ts +4 -1
- package/lib/hooks/use-popper-container/index.js +5 -1
- package/lib/hooks/use-popper-container/index.js.map +1 -1
- package/lib/hooks/use-z-index/index.d.ts +3 -1
- package/lib/hooks/use-z-index/index.js +3 -2
- package/lib/hooks/use-z-index/index.js.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
|
@@ -103,6 +103,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
103
103
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
104
104
|
cssVarBlockName: (name: string) => string;
|
|
105
105
|
};
|
|
106
|
+
zIndex: {
|
|
107
|
+
initialZIndex: import("vue").ComputedRef<number>;
|
|
108
|
+
currentZIndex: import("vue").ComputedRef<number>;
|
|
109
|
+
nextZIndex: () => number;
|
|
110
|
+
};
|
|
111
|
+
nextZIndex: () => number;
|
|
112
|
+
currentZIndex: import("vue").ComputedRef<number>;
|
|
106
113
|
Close: import("vue").DefineComponent<{}, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
107
114
|
visible: import("vue").Ref<boolean>;
|
|
108
115
|
timer: undefined;
|
|
@@ -6,11 +6,11 @@ var vue = require('vue');
|
|
|
6
6
|
var core = require('@vueuse/core');
|
|
7
7
|
require('../../../utils/index.js');
|
|
8
8
|
require('../../../constants/index.js');
|
|
9
|
-
var index
|
|
10
|
-
require('
|
|
9
|
+
var index = require('../../icon/index.js');
|
|
10
|
+
require('../../config-provider/index.js');
|
|
11
11
|
var notification = require('./notification.js');
|
|
12
12
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
13
|
-
var
|
|
13
|
+
var useGlobalConfig = require('../../config-provider/src/hooks/use-global-config.js');
|
|
14
14
|
var icon = require('../../../utils/vue/icon.js');
|
|
15
15
|
var aria = require('../../../constants/aria.js');
|
|
16
16
|
|
|
@@ -27,7 +27,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
27
27
|
emits: notification.notificationEmits,
|
|
28
28
|
setup(__props, { expose }) {
|
|
29
29
|
const props = __props;
|
|
30
|
-
const ns =
|
|
30
|
+
const { ns, zIndex } = useGlobalConfig.useGlobalComponentSettings("notification");
|
|
31
|
+
const { nextZIndex, currentZIndex } = zIndex;
|
|
31
32
|
const { Close } = icon.CloseComponents;
|
|
32
33
|
const visible = vue.ref(false);
|
|
33
34
|
let timer = void 0;
|
|
@@ -45,7 +46,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
45
46
|
const positionStyle = vue.computed(() => {
|
|
46
47
|
return {
|
|
47
48
|
[verticalProperty.value]: `${props.offset}px`,
|
|
48
|
-
zIndex:
|
|
49
|
+
zIndex: currentZIndex.value
|
|
49
50
|
};
|
|
50
51
|
});
|
|
51
52
|
function startTimer() {
|
|
@@ -76,6 +77,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
76
77
|
}
|
|
77
78
|
vue.onMounted(() => {
|
|
78
79
|
startTimer();
|
|
80
|
+
nextZIndex();
|
|
79
81
|
visible.value = true;
|
|
80
82
|
});
|
|
81
83
|
core.useEventListener(document, "keydown", onKeydown);
|
|
@@ -100,7 +102,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
100
102
|
onMouseleave: startTimer,
|
|
101
103
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
102
104
|
}, [
|
|
103
|
-
vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(index
|
|
105
|
+
vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(index.ElIcon), {
|
|
104
106
|
key: 0,
|
|
105
107
|
class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
|
|
106
108
|
}, {
|
|
@@ -129,7 +131,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
129
131
|
], 6), [
|
|
130
132
|
[vue.vShow, _ctx.message]
|
|
131
133
|
]),
|
|
132
|
-
_ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(index
|
|
134
|
+
_ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(index.ElIcon), {
|
|
133
135
|
key: 0,
|
|
134
136
|
class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
|
|
135
137
|
onClick: vue.withModifiers(close, ["stop"])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification2.js","sources":["../../../../../../packages/components/notification/src/notification.vue"],"sourcesContent":["<template>\n <transition\n :name=\"ns.b('fade')\"\n @before-leave=\"onClose\"\n @after-leave=\"$emit('destroy')\"\n >\n <div\n v-show=\"visible\"\n :id=\"id\"\n :class=\"[ns.b(), customClass, horizontalClass]\"\n :style=\"positionStyle\"\n role=\"alert\"\n @mouseenter=\"clearTimer\"\n @mouseleave=\"startTimer\"\n @click=\"onClick\"\n >\n <el-icon v-if=\"iconComponent\" :class=\"[ns.e('icon'), typeClass]\">\n <component :is=\"iconComponent\" />\n </el-icon>\n <div :class=\"ns.e('group')\">\n <h2 :class=\"ns.e('title')\" v-text=\"title\" />\n <div\n v-show=\"message\"\n :class=\"ns.e('content')\"\n :style=\"!!title ? undefined : { margin: 0 }\"\n >\n <slot>\n <p v-if=\"!dangerouslyUseHTMLString\">{{ message }}</p>\n <!-- Caution here, message could've been compromised, never use user's input as message -->\n <p v-else v-html=\"message\" />\n </slot>\n </div>\n <el-icon v-if=\"showClose\" :class=\"ns.e('closeBtn')\" @click.stop=\"close\">\n <Close />\n </el-icon>\n </div>\n </div>\n </transition>\n</template>\n<script lang=\"ts\" setup>\nimport { computed, onMounted, ref } from 'vue'\nimport { useEventListener, useTimeoutFn } from '@vueuse/core'\nimport { CloseComponents, TypeComponentsMap } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {
|
|
1
|
+
{"version":3,"file":"notification2.js","sources":["../../../../../../packages/components/notification/src/notification.vue"],"sourcesContent":["<template>\n <transition\n :name=\"ns.b('fade')\"\n @before-leave=\"onClose\"\n @after-leave=\"$emit('destroy')\"\n >\n <div\n v-show=\"visible\"\n :id=\"id\"\n :class=\"[ns.b(), customClass, horizontalClass]\"\n :style=\"positionStyle\"\n role=\"alert\"\n @mouseenter=\"clearTimer\"\n @mouseleave=\"startTimer\"\n @click=\"onClick\"\n >\n <el-icon v-if=\"iconComponent\" :class=\"[ns.e('icon'), typeClass]\">\n <component :is=\"iconComponent\" />\n </el-icon>\n <div :class=\"ns.e('group')\">\n <h2 :class=\"ns.e('title')\" v-text=\"title\" />\n <div\n v-show=\"message\"\n :class=\"ns.e('content')\"\n :style=\"!!title ? undefined : { margin: 0 }\"\n >\n <slot>\n <p v-if=\"!dangerouslyUseHTMLString\">{{ message }}</p>\n <!-- Caution here, message could've been compromised, never use user's input as message -->\n <p v-else v-html=\"message\" />\n </slot>\n </div>\n <el-icon v-if=\"showClose\" :class=\"ns.e('closeBtn')\" @click.stop=\"close\">\n <Close />\n </el-icon>\n </div>\n </div>\n </transition>\n</template>\n<script lang=\"ts\" setup>\nimport { computed, onMounted, ref } from 'vue'\nimport { useEventListener, useTimeoutFn } from '@vueuse/core'\nimport { CloseComponents, TypeComponentsMap } from '@element-plus/utils'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useGlobalComponentSettings } from '@element-plus/components/config-provider'\nimport { notificationEmits, notificationProps } from './notification'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElNotification',\n})\n\nconst props = defineProps(notificationProps)\ndefineEmits(notificationEmits)\n\nconst { ns, zIndex } = useGlobalComponentSettings('notification')\nconst { nextZIndex, currentZIndex } = zIndex\n\nconst { Close } = CloseComponents\n\nconst visible = ref(false)\nlet timer: (() => void) | undefined = undefined\n\nconst typeClass = computed(() => {\n const type = props.type\n return type && TypeComponentsMap[props.type] ? ns.m(type) : ''\n})\n\nconst iconComponent = computed(() => {\n if (!props.type) return props.icon\n return TypeComponentsMap[props.type] || props.icon\n})\n\nconst horizontalClass = computed(() =>\n props.position.endsWith('right') ? 'right' : 'left'\n)\n\nconst verticalProperty = computed(() =>\n props.position.startsWith('top') ? 'top' : 'bottom'\n)\n\nconst positionStyle = computed<CSSProperties>(() => {\n return {\n [verticalProperty.value]: `${props.offset}px`,\n zIndex: currentZIndex.value,\n }\n})\n\nfunction startTimer() {\n if (props.duration > 0) {\n ;({ stop: timer } = useTimeoutFn(() => {\n if (visible.value) close()\n }, props.duration))\n }\n}\n\nfunction clearTimer() {\n timer?.()\n}\n\nfunction close() {\n visible.value = false\n}\n\nfunction onKeydown({ code }: KeyboardEvent) {\n if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {\n clearTimer() // press delete/backspace clear timer\n } else if (code === EVENT_CODE.esc) {\n // press esc to close the notification\n if (visible.value) {\n close()\n }\n } else {\n startTimer() // resume timer\n }\n}\n\n// lifecycle\nonMounted(() => {\n startTimer()\n nextZIndex()\n visible.value = true\n})\n\nuseEventListener(document, 'keydown', onKeydown)\n\ndefineExpose({\n visible,\n /** @description close notification */\n close,\n})\n</script>\n"],"names":["useGlobalComponentSettings","CloseComponents","ref","computed","TypeComponentsMap","useTimeoutFn","EVENT_CODE","onMounted","useEventListener"],"mappings":";;;;;;;;;;;;;;;;;;;;uCAkDc,CAAA;AAAA,EACZ,IAAM,EAAA,gBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,EAAE,EAAA,EAAI,MAAW,EAAA,GAAAA,0CAAA,CAA2B,cAAc,CAAA,CAAA;AAChE,IAAM,MAAA,EAAE,YAAY,aAAkB,EAAA,GAAA,MAAA,CAAA;AAEtC,IAAA,MAAM,EAAE,KAAU,EAAA,GAAAC,oBAAA,CAAA;AAElB,IAAM,MAAA,OAAA,GAAUC,QAAI,KAAK,CAAA,CAAA;AACzB,IAAA,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A,SAC3B,EAAG,MAAM,QAAQ,CAAA,EAAA;AAAA,OACnB;AAAA,KACF;AAEA,IAAsB,SAAA,UAAA,GAAA;AACpB,MAAQ,KAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,EAAA,CAAA;AAAA,KACV;AAEA,IAAiB,SAAA,KAAA,GAAA;AACf,MAAA,OAAA,CAAQ,KAAQ,GAAA,KAAA,CAAA;AAAA,KAClB;AAEA,IAAA,SAAA,SAAA,CAAmB,EAAE,IAAuB,EAAA,EAAA;AAC1C,MAAA,IAAI,IAAS,KAAAC,eAAA,CAAW,MAAU,IAAA,IAAA,KAASA,gBAAW,SAAW,EAAA;AAC/D,QAAW,UAAA,EAAA,CAAA;AAAA,OACb,MAAA,IAAW,IAAS,KAAAA,eAAA,CAAW,GAAK,EAAA;AAElC,QAAA,IAAI,QAAQ,KAAO,EAAA;AACjB,UAAM,KAAA,EAAA,CAAA;AAAA,SACR;AAAA,OACK,MAAA;AACL,QAAW,UAAA,EAAA,CAAA;AAAA,OACb;AAAA,KACF;AAGA,IAAAC,aAAA,CAAU,MAAM;AACd,MAAW,UAAA,EAAA,CAAA;AACX,MAAW,UAAA,EAAA,CAAA;AACX,MAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA,CAAA;AAAA,KACjB,CAAA,CAAA;AAED,IAAiBC,qBAAA,CAAA,QAAA,EAAU,WAAW,SAAS,CAAA,CAAA;AAE/C,IAAa,MAAA,CAAA;AAAA,MACX,OAAA;AAAA,MAEA,KAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,11 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var vue = require('vue');
|
|
6
6
|
var core = require('@vueuse/core');
|
|
7
|
-
require('../../../hooks/index.js');
|
|
8
7
|
require('../../../utils/index.js');
|
|
9
8
|
var notification = require('./notification2.js');
|
|
10
9
|
var notification$1 = require('./notification.js');
|
|
11
|
-
var index = require('../../../hooks/use-z-index/index.js');
|
|
12
10
|
var types = require('../../../utils/types.js');
|
|
13
11
|
var shared = require('@vue/shared');
|
|
14
12
|
var error = require('../../../utils/error.js');
|
|
@@ -34,11 +32,9 @@ const notify = function(options = {}, context = null) {
|
|
|
34
32
|
verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
|
|
35
33
|
});
|
|
36
34
|
verticalOffset += GAP_SIZE;
|
|
37
|
-
const { nextZIndex } = index.useZIndex();
|
|
38
35
|
const id = `notification_${seed++}`;
|
|
39
36
|
const userOnClose = options.onClose;
|
|
40
37
|
const props = {
|
|
41
|
-
zIndex: nextZIndex(),
|
|
42
38
|
...options,
|
|
43
39
|
offset: verticalOffset,
|
|
44
40
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sources":["../../../../../../packages/components/notification/src/notify.ts"],"sourcesContent":["import { createVNode, render } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { useZIndex } from '@element-plus/hooks'\nimport { debugWarn, isElement, isString, isVNode } from '@element-plus/utils'\nimport NotificationConstructor from './notification.vue'\nimport { notificationTypes } from './notification'\n\nimport type { AppContext, Ref, VNode } from 'vue'\nimport type {\n NotificationOptions,\n NotificationProps,\n NotificationQueue,\n Notify,\n NotifyFn,\n} from './notification'\n\n// This should be a queue but considering there were `non-autoclosable` notifications.\nconst notifications: Record<\n NotificationOptions['position'],\n NotificationQueue\n> = {\n 'top-left': [],\n 'top-right': [],\n 'bottom-left': [],\n 'bottom-right': [],\n}\n\n// the gap size between each notification\nconst GAP_SIZE = 16\nlet seed = 1\n\nconst notify: NotifyFn & Partial<Notify> & { _context: AppContext | null } =\n function (options = {}, context: AppContext | null = null) {\n if (!isClient) return { close: () => undefined }\n\n if (typeof options === 'string' || isVNode(options)) {\n options = { message: options }\n }\n\n const position = options.position || 'top-right'\n\n let verticalOffset = options.offset || 0\n notifications[position].forEach(({ vm }) => {\n verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE\n })\n verticalOffset += GAP_SIZE\n\n const { nextZIndex } = useZIndex()\n\n const id = `notification_${seed++}`\n const userOnClose = options.onClose\n const props: Partial<NotificationProps> = {\n zIndex: nextZIndex(),\n ...options,\n offset: verticalOffset,\n id,\n onClose: () => {\n close(id, position, userOnClose)\n },\n }\n\n let appendTo: HTMLElement | null = document.body\n if (isElement(options.appendTo)) {\n appendTo = options.appendTo\n } else if (isString(options.appendTo)) {\n appendTo = document.querySelector(options.appendTo)\n }\n\n // should fallback to default value with a warning\n if (!isElement(appendTo)) {\n debugWarn(\n 'ElNotification',\n 'the appendTo option is not an HTMLElement. Falling back to document.body.'\n )\n appendTo = document.body\n }\n\n const container = document.createElement('div')\n\n const vm = createVNode(\n NotificationConstructor,\n props,\n isVNode(props.message)\n ? {\n default: () => props.message,\n }\n : null\n )\n vm.appContext = context ?? notify._context\n\n // clean notification element preventing mem leak\n vm.props!.onDestroy = () => {\n render(null, container)\n }\n\n // instances will remove this item when close function gets called. So we do not need to worry about it.\n render(vm, container)\n notifications[position].push({ vm })\n appendTo.appendChild(container.firstElementChild!)\n\n return {\n // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle\n // for out component, so that all closing steps will not be skipped.\n close: () => {\n ;(vm.component!.exposed as { visible: Ref<boolean> }).visible.value =\n false\n },\n }\n }\nnotificationTypes.forEach((type) => {\n notify[type] = (options = {}) => {\n if (typeof options === 'string' || isVNode(options)) {\n options = {\n message: options,\n }\n }\n return notify({\n ...options,\n type,\n })\n }\n})\n\n/**\n * This function gets called when user click `x` button or press `esc` or the time reached its limitation.\n * Emitted by transition@before-leave event so that we can fetch the current notification.offsetHeight, if this was called\n * by @after-leave the DOM element will be removed from the page thus we can no longer fetch the offsetHeight.\n * @param {String} id notification id to be closed\n * @param {Position} position the positioning strategy\n * @param {Function} userOnClose the callback called when close passed by user\n */\nexport function close(\n id: string,\n position: NotificationOptions['position'],\n userOnClose?: (vm: VNode) => void\n): void {\n // maybe we can store the index when inserting the vm to notification list.\n const orientedNotifications = notifications[position]\n const idx = orientedNotifications.findIndex(\n ({ vm }) => vm.component?.props.id === id\n )\n if (idx === -1) return\n const { vm } = orientedNotifications[idx]\n if (!vm) return\n // calling user's on close function before notification gets removed from DOM.\n userOnClose?.(vm)\n\n // note that this is called @before-leave, that's why we were able to fetch this property.\n const removedHeight = vm.el!.offsetHeight\n const verticalPos = position.split('-')[0]\n orientedNotifications.splice(idx, 1)\n const len = orientedNotifications.length\n if (len < 1) return\n // starting from the removing item.\n for (let i = idx; i < len; i++) {\n // new position equals the current offsetTop minus removed height plus 16px(the gap size between each item)\n const { el, component } = orientedNotifications[i].vm\n const pos =\n Number.parseInt(el!.style[verticalPos], 10) - removedHeight - GAP_SIZE\n component!.props.offset = pos\n }\n}\n\nexport function closeAll(): void {\n // loop through all directions, close them at once.\n for (const orientedNotifications of Object.values(notifications)) {\n orientedNotifications.forEach(({ vm }) => {\n // same as the previous close method, we'd like to make sure lifecycle gets handle properly.\n ;(vm.component!.exposed as { visible: Ref<boolean> }).visible.value =\n false\n })\n }\n}\n\nnotify.closeAll = closeAll\nnotify._context = null\n\nexport default notify as Notify\n"],"names":["isClient","isVNode","useZIndex","isElement","isString","debugWarn","createVNode","NotificationConstructor","render","notificationTypes"],"mappings":";;;;;;;;;;;;;;;AAMA,MAAM,aAAa,GAAG;AACtB,EAAE,UAAU,EAAE,EAAE;AAChB,EAAE,WAAW,EAAE,EAAE;AACjB,EAAE,aAAa,EAAE,EAAE;AACnB,EAAE,cAAc,EAAE,EAAE;AACpB,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,IAAI,IAAI,GAAG,CAAC,CAAC;AACR,MAAC,MAAM,GAAG,SAAS,OAAO,GAAG,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE;AACtD,EAAE,IAAI,CAACA,a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, render } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { debugWarn, isElement, isString, isVNode } from '@element-plus/utils'\nimport NotificationConstructor from './notification.vue'\nimport { notificationTypes } from './notification'\n\nimport type { AppContext, Ref, VNode } from 'vue'\nimport type {\n NotificationOptions,\n NotificationProps,\n NotificationQueue,\n Notify,\n NotifyFn,\n} from './notification'\n\n// This should be a queue but considering there were `non-autoclosable` notifications.\nconst notifications: Record<\n NotificationOptions['position'],\n NotificationQueue\n> = {\n 'top-left': [],\n 'top-right': [],\n 'bottom-left': [],\n 'bottom-right': [],\n}\n\n// the gap size between each notification\nconst GAP_SIZE = 16\nlet seed = 1\n\nconst notify: NotifyFn & Partial<Notify> & { _context: AppContext | null } =\n function (options = {}, context: AppContext | null = null) {\n if (!isClient) return { close: () => undefined }\n\n if (typeof options === 'string' || isVNode(options)) {\n options = { message: options }\n }\n\n const position = options.position || 'top-right'\n\n let verticalOffset = options.offset || 0\n notifications[position].forEach(({ vm }) => {\n verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE\n })\n verticalOffset += GAP_SIZE\n\n const id = `notification_${seed++}`\n const userOnClose = options.onClose\n const props: Partial<NotificationProps> = {\n ...options,\n offset: verticalOffset,\n id,\n onClose: () => {\n close(id, position, userOnClose)\n },\n }\n\n let appendTo: HTMLElement | null = document.body\n if (isElement(options.appendTo)) {\n appendTo = options.appendTo\n } else if (isString(options.appendTo)) {\n appendTo = document.querySelector(options.appendTo)\n }\n\n // should fallback to default value with a warning\n if (!isElement(appendTo)) {\n debugWarn(\n 'ElNotification',\n 'the appendTo option is not an HTMLElement. Falling back to document.body.'\n )\n appendTo = document.body\n }\n\n const container = document.createElement('div')\n\n const vm = createVNode(\n NotificationConstructor,\n props,\n isVNode(props.message)\n ? {\n default: () => props.message,\n }\n : null\n )\n vm.appContext = context ?? notify._context\n\n // clean notification element preventing mem leak\n vm.props!.onDestroy = () => {\n render(null, container)\n }\n\n // instances will remove this item when close function gets called. So we do not need to worry about it.\n render(vm, container)\n notifications[position].push({ vm })\n appendTo.appendChild(container.firstElementChild!)\n\n return {\n // instead of calling the onClose function directly, setting this value so that we can have the full lifecycle\n // for out component, so that all closing steps will not be skipped.\n close: () => {\n ;(vm.component!.exposed as { visible: Ref<boolean> }).visible.value =\n false\n },\n }\n }\nnotificationTypes.forEach((type) => {\n notify[type] = (options = {}) => {\n if (typeof options === 'string' || isVNode(options)) {\n options = {\n message: options,\n }\n }\n return notify({\n ...options,\n type,\n })\n }\n})\n\n/**\n * This function gets called when user click `x` button or press `esc` or the time reached its limitation.\n * Emitted by transition@before-leave event so that we can fetch the current notification.offsetHeight, if this was called\n * by @after-leave the DOM element will be removed from the page thus we can no longer fetch the offsetHeight.\n * @param {String} id notification id to be closed\n * @param {Position} position the positioning strategy\n * @param {Function} userOnClose the callback called when close passed by user\n */\nexport function close(\n id: string,\n position: NotificationOptions['position'],\n userOnClose?: (vm: VNode) => void\n): void {\n // maybe we can store the index when inserting the vm to notification list.\n const orientedNotifications = notifications[position]\n const idx = orientedNotifications.findIndex(\n ({ vm }) => vm.component?.props.id === id\n )\n if (idx === -1) return\n const { vm } = orientedNotifications[idx]\n if (!vm) return\n // calling user's on close function before notification gets removed from DOM.\n userOnClose?.(vm)\n\n // note that this is called @before-leave, that's why we were able to fetch this property.\n const removedHeight = vm.el!.offsetHeight\n const verticalPos = position.split('-')[0]\n orientedNotifications.splice(idx, 1)\n const len = orientedNotifications.length\n if (len < 1) return\n // starting from the removing item.\n for (let i = idx; i < len; i++) {\n // new position equals the current offsetTop minus removed height plus 16px(the gap size between each item)\n const { el, component } = orientedNotifications[i].vm\n const pos =\n Number.parseInt(el!.style[verticalPos], 10) - removedHeight - GAP_SIZE\n component!.props.offset = pos\n }\n}\n\nexport function closeAll(): void {\n // loop through all directions, close them at once.\n for (const orientedNotifications of Object.values(notifications)) {\n orientedNotifications.forEach(({ vm }) => {\n // same as the previous close method, we'd like to make sure lifecycle gets handle properly.\n ;(vm.component!.exposed as { visible: Ref<boolean> }).visible.value =\n false\n })\n }\n}\n\nnotify.closeAll = closeAll\nnotify._context = null\n\nexport default notify as Notify\n"],"names":["isClient","isVNode","isElement","isString","debugWarn","createVNode","NotificationConstructor","render","notificationTypes"],"mappings":";;;;;;;;;;;;;AAKA,MAAM,aAAa,GAAG;AACtB,EAAE,UAAU,EAAE,EAAE;AAChB,EAAE,WAAW,EAAE,EAAE;AACjB,EAAE,aAAa,EAAE,EAAE;AACnB,EAAE,cAAc,EAAE,EAAE;AACpB,CAAC,CAAC;AACF,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,IAAI,IAAI,GAAG,CAAC,CAAC;AACR,MAAC,MAAM,GAAG,SAAS,OAAO,GAAG,EAAE,EAAE,OAAO,GAAG,IAAI,EAAE;AACtD,EAAE,IAAI,CAACA,aAAQ;AACf,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;AACnC,EAAE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAIC,WAAO,CAAC,OAAO,CAAC,EAAE;AACvD,IAAI,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACnC,GAAG;AACH,EAAE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,WAAW,CAAC;AACnD,EAAE,IAAI,cAAc,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;AAC3C,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK;AACnD,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,cAAc,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,KAAK,CAAC,IAAI,QAAQ,CAAC;AAC3F,GAAG,CAAC,CAAC;AACL,EAAE,cAAc,IAAI,QAAQ,CAAC;AAC7B,EAAE,MAAM,EAAE,GAAG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CAAC,EAAE;AACpE,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK;AAC9C,MAAM,CAAC;AACP,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AACjD,KAAK,CAAC,CAAC;AACP,GAAG;AACH,CAAC;AACD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,MAAM,CAAC,QAAQ,GAAG,IAAI;;;;;;"}
|
|
@@ -73,7 +73,7 @@ const CellRenderer = ({
|
|
|
73
73
|
rowIndex
|
|
74
74
|
};
|
|
75
75
|
const Cell = CellComponent(cellProps);
|
|
76
|
-
const kls = [ns.e("row-cell"), column.align === constants.Alignment.CENTER && ns.is("align-center"), column.align === constants.Alignment.RIGHT && ns.is("align-right")];
|
|
76
|
+
const kls = [ns.e("row-cell"), column.class, column.align === constants.Alignment.CENTER && ns.is("align-center"), column.align === constants.Alignment.RIGHT && ns.is("align-right")];
|
|
77
77
|
const expandable = rowIndex >= 0 && column.key === expandColumnKey;
|
|
78
78
|
const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
|
|
79
79
|
let IconOrPlaceholder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","sources":["../../../../../../../packages/components/table-v2/src/renderers/cell.tsx"],"sourcesContent":["import { get } from 'lodash-unified'\nimport { isFunction, isObject } from '@element-plus/utils'\nimport { ExpandIcon, TableCell } from '../components'\nimport { Alignment } from '../constants'\nimport { placeholderSign } from '../private'\nimport { componentToSlot, enforceUnit, tryCall } from '../utils'\n\nimport type { FunctionalComponent, UnwrapNestedRefs, VNode } from 'vue'\nimport type { CellRendererParams } from '../types'\nimport type { TableV2RowCellRenderParam } from '../components'\nimport type { UseNamespaceReturn } from '@element-plus/hooks'\nimport type { UseTableReturn } from '../use-table'\nimport type { TableV2Props } from '../table'\n\ntype CellRendererProps = TableV2RowCellRenderParam &\n Pick<\n TableV2Props,\n 'cellProps' | 'expandColumnKey' | 'indentSize' | 'iconSize' | 'rowKey'\n > &\n UnwrapNestedRefs<Pick<UseTableReturn, 'expandedRowKeys'>> & {\n ns: UseNamespaceReturn\n }\n\nconst CellRenderer: FunctionalComponent<CellRendererProps> = (\n {\n // renderer props\n columns,\n column,\n columnIndex,\n depth,\n expandIconProps,\n isScrolling,\n rowData,\n rowIndex,\n // from use-table\n style,\n expandedRowKeys,\n ns,\n // derived props\n cellProps: _cellProps,\n expandColumnKey,\n indentSize,\n iconSize,\n rowKey,\n },\n { slots }\n) => {\n const cellStyle = enforceUnit(style)\n\n if (column.placeholderSign === placeholderSign) {\n return <div class={ns.em('row-cell', 'placeholder')} style={cellStyle} />\n }\n const { cellRenderer, dataKey, dataGetter } = column\n\n const columnCellRenderer = componentToSlot(cellRenderer)\n\n const CellComponent =\n columnCellRenderer ||\n slots.default ||\n ((props: CellRendererParams<any>) => <TableCell {...props} />)\n\n const cellData = isFunction(dataGetter)\n ? dataGetter({ columns, column, columnIndex, rowData, rowIndex })\n : get(rowData, dataKey ?? '')\n\n const extraCellProps = tryCall(_cellProps, {\n cellData,\n columns,\n column,\n columnIndex,\n rowIndex,\n rowData,\n })\n\n const cellProps = {\n class: ns.e('cell-text'),\n columns,\n column,\n columnIndex,\n cellData,\n isScrolling,\n rowData,\n rowIndex,\n }\n\n const Cell = CellComponent(cellProps)\n\n const kls = [\n ns.e('row-cell'),\n column.align === Alignment.CENTER && ns.is('align-center'),\n column.align === Alignment.RIGHT && ns.is('align-right'),\n ]\n\n const expandable = rowIndex >= 0 && column.key === expandColumnKey\n const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey])\n\n let IconOrPlaceholder: VNode | undefined\n const iconStyle = `margin-inline-start: ${depth * indentSize}px;`\n if (expandable) {\n if (isObject(expandIconProps)) {\n IconOrPlaceholder = (\n <ExpandIcon\n {...expandIconProps}\n class={[ns.e('expand-icon'), ns.is('expanded', expanded)]}\n size={iconSize}\n expanded={expanded}\n style={iconStyle}\n expandable\n />\n )\n } else {\n IconOrPlaceholder = (\n <div\n style={[\n iconStyle,\n `width: ${iconSize}px; height: ${iconSize}px;`,\n ].join(' ')}\n />\n )\n }\n }\n\n return (\n <div class={kls} style={cellStyle} {...extraCellProps}>\n {IconOrPlaceholder}\n {Cell}\n </div>\n )\n}\n\nCellRenderer.inheritAttrs = false\n\nexport default CellRenderer\n"],"names":["CellRenderer","columns","column","columnIndex","depth","expandIconProps","isScrolling","rowData","rowIndex","style","expandedRowKeys","ns","cellProps","indentSize","rowKey","placeholderSign","slots","cellStyle","_createVNode","TableCell","isFunction","dataKey","dataGetter","get","default","cellData","extraCellProps","class","Alignment","isObject","ExpandIcon","_mergeProps","kls","e","
|
|
1
|
+
{"version":3,"file":"cell.js","sources":["../../../../../../../packages/components/table-v2/src/renderers/cell.tsx"],"sourcesContent":["import { get } from 'lodash-unified'\nimport { isFunction, isObject } from '@element-plus/utils'\nimport { ExpandIcon, TableCell } from '../components'\nimport { Alignment } from '../constants'\nimport { placeholderSign } from '../private'\nimport { componentToSlot, enforceUnit, tryCall } from '../utils'\n\nimport type { FunctionalComponent, UnwrapNestedRefs, VNode } from 'vue'\nimport type { CellRendererParams } from '../types'\nimport type { TableV2RowCellRenderParam } from '../components'\nimport type { UseNamespaceReturn } from '@element-plus/hooks'\nimport type { UseTableReturn } from '../use-table'\nimport type { TableV2Props } from '../table'\n\ntype CellRendererProps = TableV2RowCellRenderParam &\n Pick<\n TableV2Props,\n 'cellProps' | 'expandColumnKey' | 'indentSize' | 'iconSize' | 'rowKey'\n > &\n UnwrapNestedRefs<Pick<UseTableReturn, 'expandedRowKeys'>> & {\n ns: UseNamespaceReturn\n }\n\nconst CellRenderer: FunctionalComponent<CellRendererProps> = (\n {\n // renderer props\n columns,\n column,\n columnIndex,\n depth,\n expandIconProps,\n isScrolling,\n rowData,\n rowIndex,\n // from use-table\n style,\n expandedRowKeys,\n ns,\n // derived props\n cellProps: _cellProps,\n expandColumnKey,\n indentSize,\n iconSize,\n rowKey,\n },\n { slots }\n) => {\n const cellStyle = enforceUnit(style)\n\n if (column.placeholderSign === placeholderSign) {\n return <div class={ns.em('row-cell', 'placeholder')} style={cellStyle} />\n }\n const { cellRenderer, dataKey, dataGetter } = column\n\n const columnCellRenderer = componentToSlot(cellRenderer)\n\n const CellComponent =\n columnCellRenderer ||\n slots.default ||\n ((props: CellRendererParams<any>) => <TableCell {...props} />)\n\n const cellData = isFunction(dataGetter)\n ? dataGetter({ columns, column, columnIndex, rowData, rowIndex })\n : get(rowData, dataKey ?? '')\n\n const extraCellProps = tryCall(_cellProps, {\n cellData,\n columns,\n column,\n columnIndex,\n rowIndex,\n rowData,\n })\n\n const cellProps = {\n class: ns.e('cell-text'),\n columns,\n column,\n columnIndex,\n cellData,\n isScrolling,\n rowData,\n rowIndex,\n }\n\n const Cell = CellComponent(cellProps)\n\n const kls = [\n ns.e('row-cell'),\n column.class,\n column.align === Alignment.CENTER && ns.is('align-center'),\n column.align === Alignment.RIGHT && ns.is('align-right'),\n ]\n\n const expandable = rowIndex >= 0 && column.key === expandColumnKey\n const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey])\n\n let IconOrPlaceholder: VNode | undefined\n const iconStyle = `margin-inline-start: ${depth * indentSize}px;`\n if (expandable) {\n if (isObject(expandIconProps)) {\n IconOrPlaceholder = (\n <ExpandIcon\n {...expandIconProps}\n class={[ns.e('expand-icon'), ns.is('expanded', expanded)]}\n size={iconSize}\n expanded={expanded}\n style={iconStyle}\n expandable\n />\n )\n } else {\n IconOrPlaceholder = (\n <div\n style={[\n iconStyle,\n `width: ${iconSize}px; height: ${iconSize}px;`,\n ].join(' ')}\n />\n )\n }\n }\n\n return (\n <div class={kls} style={cellStyle} {...extraCellProps}>\n {IconOrPlaceholder}\n {Cell}\n </div>\n )\n}\n\nCellRenderer.inheritAttrs = false\n\nexport default CellRenderer\n"],"names":["CellRenderer","columns","column","columnIndex","depth","expandIconProps","isScrolling","rowData","rowIndex","style","expandedRowKeys","ns","cellProps","indentSize","rowKey","placeholderSign","slots","cellStyle","_createVNode","TableCell","isFunction","dataKey","dataGetter","get","default","cellData","extraCellProps","class","Alignment","isObject","ExpandIcon","_mergeProps","kls","e","expandable","expanded","iconStyle","IconOrPlaceholder","iconSize"],"mappings":";;;;;;;;;;;;;;;;AAuBA,EAAMA,OAAAA;AAEF,EAAA,MAAA;EACAC,WAFF;EAGEC,KAHF;EAIEC,eAJF;EAKEC,WALF;EAMEC,OANF;EAOEC,QAPF;EAQEC,KARF;EASEC,eATF;AAUE,EAAA,EAAA;EACAC,SAXF,EAAA,UAAA;EAYEC,eAZF;EAaEC,UAbF;AAcE,EAAA,QAAA;AACAC,EAAAA,MAAAA;GAfF;EAiBEC,KAjBF;MAAA;AAmBEC,EAAAA,MAAAA,SAAAA,GAAAA,iBAAAA,CAAAA,KAAAA,CAAAA,CAAAA;AAnBF,EAqBA,IAAA,MAAA,CAAA,eAAA,KAAAC,wBAAA,EAAA;AAAEC,IAAAA,OAAAA,eAAAA,CAAAA,KAAAA,EAAAA;AAAF,MACG,OAAA,EAAA,EAAA,CAAA,EAAA,CAAA,UAAA,EAAA,aAAA,CAAA;AACH,MAAA,OAAe,EAAA,SAAc;;AAE7B,GAAA;AACE,EAAA,MAAA;AAAA,IAAA;WAA4DC;AAA5D,IAAA,UAAA;AACD,GAAA,GAAA,MAAA,CAAA;;EACD,MAAM,aAAA,GAAA,kBAAA,IAAA,KAAA,CAAA,OAAA,KAAA,CAAA,KAAA,KAAAC,eAAA,CAAAC,eAAA,EAAA,KAAA,EAAA,IAAA,CAAA,CAAA,CAAA;QAAA,QAAA,GAAAC,iBAAA,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;IAAgBC,OAAhB;AAAyBC,IAAAA,MAAAA;AAAzB,IAAA,WAAN;AAEA,IAAA,OAAwB;;AAExB,GAAA,CAAA,GAAAC,iBAAmB,CAAA,OAAA,EAAA,OACC,IAAA,I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EAAA;QAIIC,MAAAA,EAAAA,QAAa1B;AACnB,QAAM2B,UAAQ,EAAW,QAAA;AAEzB,QAAA,OAAA,EAAA,SAAA;AACA,QAAMC,YAAa,EAAA,IAAA;;AACnB,KAAA;AACE,MAAA,iBAAY,GAAAlB,eAAmB,CAAA,KAAA,EAAA;AAC7BmB,QAAAA,OAAAA,EAAAA,CAAAA,oDAAiB,CAAA,GAAA,CAAA,CAAA,CAAA,IAAA,CAAA,GAAA,CAAA;AAAA,OAAA,EAAA,IAAA,CAAA,CAAA;AAAA,KAAA;AAAA,GAAA;AAAA,EAAA,OAAAnB,eAAA,CAAA,KAAA,EAAAa,cAAA,CAAA;AAAA,IAAA,OAAA,EAAA,GAAA;WAAjB,EAAA,SAAA;AAUD,GAAA,EAXD,cAWO,CAAA,EAAA,CAAA,iBAAA,EAAA,IAAA,CAAA,CAAA,CAAA;;YAGM,CAAA,YAAA,GAAA,KAEKO;;;;"}
|
|
@@ -690,9 +690,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
690
690
|
b: (blockSuffix?: string) => string;
|
|
691
691
|
e: (element?: string | undefined) => string;
|
|
692
692
|
m: (modifier?: string | undefined) => string;
|
|
693
|
-
/**
|
|
694
|
-
* @description update el-popper component instance
|
|
695
|
-
*/
|
|
696
693
|
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
697
694
|
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
698
695
|
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
@@ -701,7 +698,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
701
698
|
(name: string, state: boolean | undefined): string;
|
|
702
699
|
(name: string): string;
|
|
703
700
|
};
|
|
704
|
-
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
701
|
+
cssVar: (object: Record<string, string>) => Record<string, string>; /**
|
|
702
|
+
* @description expose onOpen function to mange el-tooltip open state
|
|
703
|
+
*/
|
|
705
704
|
cssVarName: (name: string) => string;
|
|
706
705
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
707
706
|
cssVarBlockName: (name: string) => string;
|
|
@@ -833,9 +832,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
833
832
|
b: (blockSuffix?: string) => string;
|
|
834
833
|
e: (element?: string | undefined) => string;
|
|
835
834
|
m: (modifier?: string | undefined) => string;
|
|
836
|
-
/**
|
|
837
|
-
* @description update el-popper component instance
|
|
838
|
-
*/
|
|
839
835
|
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
840
836
|
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
841
837
|
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
@@ -844,7 +840,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
844
840
|
(name: string, state: boolean | undefined): string;
|
|
845
841
|
(name: string): string;
|
|
846
842
|
};
|
|
847
|
-
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
843
|
+
cssVar: (object: Record<string, string>) => Record<string, string>; /**
|
|
844
|
+
* @description expose onOpen function to mange el-tooltip open state
|
|
845
|
+
*/
|
|
848
846
|
cssVarName: (name: string) => string;
|
|
849
847
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
850
848
|
cssVarBlockName: (name: string) => string;
|
|
@@ -1645,9 +1643,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1645
1643
|
b: (blockSuffix?: string) => string;
|
|
1646
1644
|
e: (element?: string | undefined) => string;
|
|
1647
1645
|
m: (modifier?: string | undefined) => string;
|
|
1648
|
-
/**
|
|
1649
|
-
* @description update el-popper component instance
|
|
1650
|
-
*/
|
|
1651
1646
|
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
1652
1647
|
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
1653
1648
|
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
@@ -1656,7 +1651,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1656
1651
|
(name: string, state: boolean | undefined): string;
|
|
1657
1652
|
(name: string): string;
|
|
1658
1653
|
};
|
|
1659
|
-
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
1654
|
+
cssVar: (object: Record<string, string>) => Record<string, string>; /**
|
|
1655
|
+
* @description expose onOpen function to mange el-tooltip open state
|
|
1656
|
+
*/
|
|
1660
1657
|
cssVarName: (name: string) => string;
|
|
1661
1658
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
1662
1659
|
cssVarBlockName: (name: string) => string;
|
|
@@ -16,13 +16,17 @@ var CacheOptions = vue.defineComponent({
|
|
|
16
16
|
setup(props) {
|
|
17
17
|
const select = vue.inject(token.selectKey);
|
|
18
18
|
vue.watch(() => props.data, () => {
|
|
19
|
+
var _a;
|
|
19
20
|
props.data.forEach((item) => {
|
|
20
21
|
if (!select.cachedOptions.has(item.value)) {
|
|
21
22
|
select.cachedOptions.set(item.value, item);
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
|
-
select.
|
|
25
|
-
|
|
25
|
+
const inputs = ((_a = select.selectWrapper) == null ? void 0 : _a.querySelectorAll("input")) || [];
|
|
26
|
+
if (!Array.from(inputs).includes(document.activeElement)) {
|
|
27
|
+
select.setSelected();
|
|
28
|
+
}
|
|
29
|
+
}, { flush: "post", immediate: true });
|
|
26
30
|
return () => void 0;
|
|
27
31
|
}
|
|
28
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-options.js","sources":["../../../../../../packages/components/tree-select/src/cache-options.ts"],"sourcesContent":["import { defineComponent, inject, watch } from 'vue'\nimport { selectKey } from '@element-plus/components/select'\nimport type { SelectContext } from '@element-plus/components/select'\nimport type { PropType } from 'vue'\n\n// same as el-option instance,\n// these are required for `cachedOptions`\nexport type CacheOption = {\n value: string | number | boolean | object\n currentLabel: string | number\n isDisabled: boolean\n}\n\nexport default defineComponent({\n props: {\n data: {\n type: Array as PropType<CacheOption[]>,\n default: () => [],\n },\n },\n setup(props) {\n const select = inject(selectKey) as NonNullable<SelectContext>\n\n watch(\n () => props.data,\n () => {\n props.data.forEach((item) => {\n if (!select.cachedOptions.has(item.value)) {\n select.cachedOptions.set(item.value, item)\n }\n })\n select.setSelected()\n },\n {
|
|
1
|
+
{"version":3,"file":"cache-options.js","sources":["../../../../../../packages/components/tree-select/src/cache-options.ts"],"sourcesContent":["import { defineComponent, inject, watch } from 'vue'\nimport { selectKey } from '@element-plus/components/select'\nimport type { SelectContext } from '@element-plus/components/select'\nimport type { PropType } from 'vue'\n\n// same as el-option instance,\n// these are required for `cachedOptions`\nexport type CacheOption = {\n value: string | number | boolean | object\n currentLabel: string | number\n isDisabled: boolean\n}\n\nexport default defineComponent({\n props: {\n data: {\n type: Array as PropType<CacheOption[]>,\n default: () => [],\n },\n },\n setup(props) {\n const select = inject(selectKey) as NonNullable<SelectContext>\n\n watch(\n () => props.data,\n () => {\n props.data.forEach((item) => {\n if (!select.cachedOptions.has(item.value)) {\n select.cachedOptions.set(item.value, item)\n }\n })\n\n // fork from packages/select/src/useSelect.ts#330\n const inputs = select.selectWrapper?.querySelectorAll('input') || []\n if (\n !Array.from(inputs).includes(\n document.activeElement as HTMLInputElement\n )\n ) {\n select.setSelected()\n }\n },\n { flush: 'post', immediate: true }\n )\n\n return () => undefined\n },\n})\n"],"names":["defineComponent","inject","selectKey","watch"],"mappings":";;;;;;;;AAEA,mBAAeA,mBAAe,CAAC;AAC/B,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE;AACV,MAAM,IAAI,EAAE,KAAK;AACjB,MAAM,OAAO,EAAE,MAAM,EAAE;AACvB,KAAK;AACL,GAAG;AACH,EAAE,KAAK,CAAC,KAAK,EAAE;AACf,IAAI,MAAM,MAAM,GAAGC,UAAM,CAACC,eAAS,CAAC,CAAC;AACrC,IAAIC,SAAK,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,MAAM;AAClC,MAAM,IAAI,EAAE,CAAC;AACb,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK;AACnC,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AACnD,UAAU,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACrD,SAAS;AACT,OAAO,CAAC,CAAC;AACT,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;AACzG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAChE,QAAQ,MAAM,CAAC,WAAW,EAAE,CAAC;AAC7B,OAAO;AACP,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3C,IAAI,OAAO,MAAM,KAAK,CAAC,CAAC;AACxB,GAAG;AACH,CAAC,CAAC;;;;"}
|
package/lib/hooks/index.js
CHANGED
|
@@ -75,6 +75,7 @@ exports.defaultNamespace = index$n.defaultNamespace;
|
|
|
75
75
|
exports.namespaceContextKey = index$n.namespaceContextKey;
|
|
76
76
|
exports.useGetDerivedNamespace = index$n.useGetDerivedNamespace;
|
|
77
77
|
exports.useNamespace = index$n.useNamespace;
|
|
78
|
+
exports.defaultInitialZIndex = index$o.defaultInitialZIndex;
|
|
78
79
|
exports.useZIndex = index$o.useZIndex;
|
|
79
80
|
exports.zIndexContextKey = index$o.zIndexContextKey;
|
|
80
81
|
exports.arrowMiddleware = index$p.arrowMiddleware;
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -12,4 +12,4 @@ export declare const buildTranslator: (locale: MaybeRef<Language>) => Translator
|
|
|
12
12
|
export declare const translate: (path: string, option: undefined | TranslatorOption, locale: Language) => string;
|
|
13
13
|
export declare const buildLocaleContext: (locale: MaybeRef<Language>) => LocaleContext;
|
|
14
14
|
export declare const localeContextKey: InjectionKey<Ref<Language | undefined>>;
|
|
15
|
-
export declare const useLocale: () => LocaleContext;
|
|
15
|
+
export declare const useLocale: (localeOverrides?: Ref<Language | undefined> | undefined) => LocaleContext;
|
|
@@ -21,8 +21,8 @@ const buildLocaleContext = (locale) => {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
const localeContextKey = Symbol("localeContextKey");
|
|
24
|
-
const useLocale = () => {
|
|
25
|
-
const locale = vue.inject(localeContextKey, vue.ref());
|
|
24
|
+
const useLocale = (localeOverrides) => {
|
|
25
|
+
const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
|
|
26
26
|
return buildLocaleContext(vue.computed(() => locale.value || en["default"]));
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -1 +1 @@
|
|
|
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 { Language } from '@element-plus/locale'\n\nexport type TranslatorOption = Record<string, string | number>\nexport type Translator = (path: string, 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: string,\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 = () => {\n const locale = 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,
|
|
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 { Language } from '@element-plus/locale'\n\nexport type TranslatorOption = Record<string, string | number>\nexport type Translator = (path: string, 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: string,\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"],"m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K,IAAII,aAAO,CAAC,CAAC,CAAC;AACrE;;;;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { InjectionKey, Ref } from 'vue';
|
|
2
2
|
export declare const defaultNamespace = "el";
|
|
3
3
|
export declare const namespaceContextKey: InjectionKey<Ref<string | undefined>>;
|
|
4
|
-
export declare const useGetDerivedNamespace: () => import("vue").ComputedRef<string>;
|
|
5
|
-
export declare const useNamespace: (block: string) => {
|
|
4
|
+
export declare const useGetDerivedNamespace: (namespaceOverrides?: Ref<string> | undefined) => import("vue").ComputedRef<string>;
|
|
5
|
+
export declare const useNamespace: (block: string, namespaceOverrides?: Ref<string> | undefined) => {
|
|
6
6
|
namespace: import("vue").ComputedRef<string>;
|
|
7
7
|
b: (blockSuffix?: string) => string;
|
|
8
8
|
e: (element?: string | undefined) => string;
|
|
@@ -20,15 +20,15 @@ const _bem = (namespace, block, blockSuffix, element, modifier) => {
|
|
|
20
20
|
return cls;
|
|
21
21
|
};
|
|
22
22
|
const namespaceContextKey = Symbol("localeContextKey");
|
|
23
|
-
const useGetDerivedNamespace = () => {
|
|
24
|
-
const derivedNamespace = vue.inject(namespaceContextKey, vue.ref(defaultNamespace));
|
|
23
|
+
const useGetDerivedNamespace = (namespaceOverrides) => {
|
|
24
|
+
const derivedNamespace = namespaceOverrides || vue.inject(namespaceContextKey, vue.ref(defaultNamespace));
|
|
25
25
|
const namespace = vue.computed(() => {
|
|
26
26
|
return vue.unref(derivedNamespace) || defaultNamespace;
|
|
27
27
|
});
|
|
28
28
|
return namespace;
|
|
29
29
|
};
|
|
30
|
-
const useNamespace = (block) => {
|
|
31
|
-
const namespace = useGetDerivedNamespace();
|
|
30
|
+
const useNamespace = (block, namespaceOverrides) => {
|
|
31
|
+
const namespace = useGetDerivedNamespace(namespaceOverrides);
|
|
32
32
|
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
|
|
33
33
|
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
|
|
34
34
|
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-namespace/index.ts"],"sourcesContent":["import { computed, inject, ref, unref } from 'vue'\n\nimport type { InjectionKey, Ref } from 'vue'\n\nexport const defaultNamespace = 'el'\nconst statePrefix = 'is-'\n\nconst _bem = (\n namespace: string,\n block: string,\n blockSuffix: string,\n element: string,\n modifier: string\n) => {\n let cls = `${namespace}-${block}`\n if (blockSuffix) {\n cls += `-${blockSuffix}`\n }\n if (element) {\n cls += `__${element}`\n }\n if (modifier) {\n cls += `--${modifier}`\n }\n return cls\n}\n\nexport const namespaceContextKey: InjectionKey<Ref<string | undefined>> =\n Symbol('localeContextKey')\n\nexport const useGetDerivedNamespace = () => {\n const derivedNamespace
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-namespace/index.ts"],"sourcesContent":["import { computed, inject, ref, unref } from 'vue'\n\nimport type { InjectionKey, Ref } from 'vue'\n\nexport const defaultNamespace = 'el'\nconst statePrefix = 'is-'\n\nconst _bem = (\n namespace: string,\n block: string,\n blockSuffix: string,\n element: string,\n modifier: string\n) => {\n let cls = `${namespace}-${block}`\n if (blockSuffix) {\n cls += `-${blockSuffix}`\n }\n if (element) {\n cls += `__${element}`\n }\n if (modifier) {\n cls += `--${modifier}`\n }\n return cls\n}\n\nexport const namespaceContextKey: InjectionKey<Ref<string | undefined>> =\n Symbol('localeContextKey')\n\nexport const useGetDerivedNamespace = (namespaceOverrides?: Ref<string>) => {\n const derivedNamespace =\n namespaceOverrides || inject(namespaceContextKey, ref(defaultNamespace))\n const namespace = computed(() => {\n return unref(derivedNamespace) || defaultNamespace\n })\n return namespace\n}\n\nexport const useNamespace = (\n block: string,\n namespaceOverrides?: Ref<string>\n) => {\n const namespace = useGetDerivedNamespace(namespaceOverrides)\n const b = (blockSuffix = '') =>\n _bem(namespace.value, block, blockSuffix, '', '')\n const e = (element?: string) =>\n element ? _bem(namespace.value, block, '', element, '') : ''\n const m = (modifier?: string) =>\n modifier ? _bem(namespace.value, block, '', '', modifier) : ''\n const be = (blockSuffix?: string, element?: string) =>\n blockSuffix && element\n ? _bem(namespace.value, block, blockSuffix, element, '')\n : ''\n const em = (element?: string, modifier?: string) =>\n element && modifier\n ? _bem(namespace.value, block, '', element, modifier)\n : ''\n const bm = (blockSuffix?: string, modifier?: string) =>\n blockSuffix && modifier\n ? _bem(namespace.value, block, blockSuffix, '', modifier)\n : ''\n const bem = (blockSuffix?: string, element?: string, modifier?: string) =>\n blockSuffix && element && modifier\n ? _bem(namespace.value, block, blockSuffix, element, modifier)\n : ''\n const is: {\n (name: string, state: boolean | undefined): string\n (name: string): string\n } = (name: string, ...args: [boolean | undefined] | []) => {\n const state = args.length >= 1 ? args[0]! : true\n return name && state ? `${statePrefix}${name}` : ''\n }\n\n // for css var\n // --el-xxx: value;\n const cssVar = (object: Record<string, string>) => {\n const styles: Record<string, string> = {}\n for (const key in object) {\n if (object[key]) {\n styles[`--${namespace.value}-${key}`] = object[key]\n }\n }\n return styles\n }\n // with block\n const cssVarBlock = (object: Record<string, string>) => {\n const styles: Record<string, string> = {}\n for (const key in object) {\n if (object[key]) {\n styles[`--${namespace.value}-${block}-${key}`] = object[key]\n }\n }\n return styles\n }\n\n const cssVarName = (name: string) => `--${namespace.value}-${name}`\n const cssVarBlockName = (name: string) =>\n `--${namespace.value}-${block}-${name}`\n\n return {\n namespace,\n b,\n e,\n m,\n be,\n em,\n bm,\n bem,\n is,\n // css\n cssVar,\n cssVarName,\n cssVarBlock,\n cssVarBlockName,\n }\n}\n\nexport type UseNamespaceReturn = ReturnType<typeof useNamespace>\n"],"names":["inject","ref","computed","unref"],"mappings":";;;;;;AACY,MAAC,gBAAgB,GAAG,KAAK;AACrC,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,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AAO;AACT,IAAI,SAAS;AACb,IAAI,CAAC;AACL,IAAI,CAAC;AACL,IAAI,CAAC;AACL,IAAI,EAAE;AACN,IAAI,EAAE;AACN,IAAI,EAAE;AACN,IAAI,GAAG;AACP,IAAI,EAAE;AACN,IAAI,MAAM;AACV,IAAI,UAAU;AACd,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,GAAG,CAAC;AACJ;;;;;;;"}
|
|
@@ -2,4 +2,7 @@ export declare const usePopperContainerId: () => {
|
|
|
2
2
|
id: import("vue").ComputedRef<string>;
|
|
3
3
|
selector: import("vue").ComputedRef<string>;
|
|
4
4
|
};
|
|
5
|
-
export declare const usePopperContainer: () =>
|
|
5
|
+
export declare const usePopperContainer: () => {
|
|
6
|
+
id: import("vue").ComputedRef<string>;
|
|
7
|
+
selector: import("vue").ComputedRef<string>;
|
|
8
|
+
};
|
|
@@ -27,14 +27,18 @@ const createContainer = (id) => {
|
|
|
27
27
|
return container;
|
|
28
28
|
};
|
|
29
29
|
const usePopperContainer = () => {
|
|
30
|
+
const { id, selector } = usePopperContainerId();
|
|
30
31
|
vue.onBeforeMount(() => {
|
|
31
32
|
if (!core.isClient)
|
|
32
33
|
return;
|
|
33
|
-
const { id, selector } = usePopperContainerId();
|
|
34
34
|
if (process.env.NODE_ENV === "test" || !cachedContainer && !document.body.querySelector(selector.value)) {
|
|
35
35
|
cachedContainer = createContainer(id.value);
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
return {
|
|
39
|
+
id,
|
|
40
|
+
selector
|
|
41
|
+
};
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
exports.usePopperContainer = usePopperContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-popper-container/index.ts"],"sourcesContent":["import { computed, onBeforeMount } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { useGetDerivedNamespace } from '../use-namespace'\nimport { useIdInjection } from '../use-id'\n\nlet cachedContainer: HTMLElement\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 onBeforeMount(() => {\n if (!isClient) return\n\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-popper-container/index.ts"],"sourcesContent":["import { computed, onBeforeMount } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { useGetDerivedNamespace } from '../use-namespace'\nimport { useIdInjection } from '../use-id'\n\nlet cachedContainer: HTMLElement\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 (!cachedContainer && !document.body.querySelector(selector.value))\n ) {\n cachedContainer = createContainer(id.value)\n }\n })\n\n return {\n id,\n selector,\n }\n}\n"],"names":["useGetDerivedNamespace","useIdInjection","computed","onBeforeMount","isClient"],"mappings":";;;;;;;;;AAIA,IAAI,eAAe,CAAC;AACR,MAAC,oBAAoB,GAAG,MAAM;AAC1C,EAAE,MAAM,SAAS,GAAGA,4BAAsB,EAAE,CAAC;AAC7C,EAAE,MAAM,WAAW,GAAGC,sBAAc,EAAE,CAAC;AAC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ey, Ref } from 'vue';
|
|
2
|
+
export declare const defaultInitialZIndex = 2000;
|
|
2
3
|
export declare const zIndexContextKey: InjectionKey<Ref<number | undefined>>;
|
|
3
|
-
export declare const useZIndex: () => {
|
|
4
|
+
export declare const useZIndex: (zIndexOverrides?: Ref<number> | undefined) => {
|
|
4
5
|
initialZIndex: import("vue").ComputedRef<number>;
|
|
5
6
|
currentZIndex: import("vue").ComputedRef<number>;
|
|
6
7
|
nextZIndex: () => number;
|
|
7
8
|
};
|
|
9
|
+
export declare type UseZIndexReturn = ReturnType<typeof useZIndex>;
|
|
@@ -9,8 +9,8 @@ var core = require('@vueuse/core');
|
|
|
9
9
|
const zIndex = vue.ref(0);
|
|
10
10
|
const defaultInitialZIndex = 2e3;
|
|
11
11
|
const zIndexContextKey = Symbol("zIndexContextKey");
|
|
12
|
-
const useZIndex = () => {
|
|
13
|
-
const zIndexInjection = vue.inject(zIndexContextKey, void 0);
|
|
12
|
+
const useZIndex = (zIndexOverrides) => {
|
|
13
|
+
const zIndexInjection = zIndexOverrides || vue.inject(zIndexContextKey, void 0);
|
|
14
14
|
const initialZIndex = vue.computed(() => {
|
|
15
15
|
const zIndexFromInjection = vue.unref(zIndexInjection);
|
|
16
16
|
return core.isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
|
|
@@ -27,6 +27,7 @@ const useZIndex = () => {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
exports.defaultInitialZIndex = defaultInitialZIndex;
|
|
30
31
|
exports.useZIndex = useZIndex;
|
|
31
32
|
exports.zIndexContextKey = zIndexContextKey;
|
|
32
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-z-index/index.ts"],"sourcesContent":["import { computed, inject, ref, unref } from 'vue'\nimport { isNumber } from '@element-plus/utils'\n\nimport type { InjectionKey, Ref } from 'vue'\n\nconst zIndex = ref(0)\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-z-index/index.ts"],"sourcesContent":["import { computed, inject, ref, unref } from 'vue'\nimport { isNumber } from '@element-plus/utils'\n\nimport type { InjectionKey, Ref } from 'vue'\n\nconst zIndex = ref(0)\nexport const defaultInitialZIndex = 2000\n\nexport const zIndexContextKey: InjectionKey<Ref<number | undefined>> =\n Symbol('zIndexContextKey')\n\nexport const useZIndex = (zIndexOverrides?: Ref<number>) => {\n const zIndexInjection = zIndexOverrides || inject(zIndexContextKey, undefined)\n const initialZIndex = computed(() => {\n const zIndexFromInjection = unref(zIndexInjection)\n return isNumber(zIndexFromInjection)\n ? zIndexFromInjection\n : defaultInitialZIndex\n })\n const currentZIndex = computed(() => initialZIndex.value + zIndex.value)\n\n const nextZIndex = () => {\n zIndex.value++\n return currentZIndex.value\n }\n\n return {\n initialZIndex,\n currentZIndex,\n nextZIndex,\n }\n}\n\nexport type UseZIndexReturn = ReturnType<typeof useZIndex>\n"],"names":["ref","inject","computed","unref","isNumber"],"mappings":";;;;;;;;AAEA,MAAM,MAAM,GAAGA,OAAG,CAAC,CAAC,CAAC,CAAC;AACV,MAAC,oBAAoB,GAAG,IAAI;AAC5B,MAAC,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,EAAE;AAC/C,MAAC,SAAS,GAAG,CAAC,eAAe,KAAK;AAC9C,EAAE,MAAM,eAAe,GAAG,eAAe,IAAIC,UAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9E,EAAE,MAAM,aAAa,GAAGC,YAAQ,CAAC,MAAM;AACvC,IAAI,MAAM,mBAAmB,GAAGC,SAAK,CAAC,eAAe,CAAC,CAAC;AACvD,IAAI,OAAOC,aAAQ,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AACtF,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,aAAa,GAAGF,YAAQ,CAAC,MAAM,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3E,EAAE,MAAM,UAAU,GAAG,MAAM;AAC3B,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;AACnB,IAAI,OAAO,aAAa,CAAC,KAAK,CAAC;AAC/B,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,aAAa;AACjB,IAAI,aAAa;AACjB,IAAI,UAAU;AACd,GAAG,CAAC;AACJ;;;;;;"}
|
package/lib/index.js
CHANGED
|
@@ -348,6 +348,7 @@ exports.messageConfig = configProvider.messageConfig;
|
|
|
348
348
|
exports.configProviderProps = configProviderProps.configProviderProps;
|
|
349
349
|
exports.configProviderContextKey = constants$5.configProviderContextKey;
|
|
350
350
|
exports.provideGlobalConfig = useGlobalConfig.provideGlobalConfig;
|
|
351
|
+
exports.useGlobalComponentSettings = useGlobalConfig.useGlobalComponentSettings;
|
|
351
352
|
exports.useGlobalConfig = useGlobalConfig.useGlobalConfig;
|
|
352
353
|
exports.ElConfigProvider = index$j.ElConfigProvider;
|
|
353
354
|
exports.ElAside = index$k.ElAside;
|
|
@@ -677,6 +678,7 @@ exports.defaultNamespace = index$1C.defaultNamespace;
|
|
|
677
678
|
exports.namespaceContextKey = index$1C.namespaceContextKey;
|
|
678
679
|
exports.useGetDerivedNamespace = index$1C.useGetDerivedNamespace;
|
|
679
680
|
exports.useNamespace = index$1C.useNamespace;
|
|
681
|
+
exports.defaultInitialZIndex = index$1D.defaultInitialZIndex;
|
|
680
682
|
exports.useZIndex = index$1D.useZIndex;
|
|
681
683
|
exports.zIndexContextKey = index$1D.zIndexContextKey;
|
|
682
684
|
exports.arrowMiddleware = index$1E.arrowMiddleware;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/element-plus/index.ts"],"sourcesContent":["import installer from './defaults'\nexport * from '@element-plus/components'\nexport * from '@element-plus/constants'\nexport * from '@element-plus/directives'\nexport * from '@element-plus/hooks'\nexport * from './make-installer'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n\nexport { default as dayjs } from 'dayjs'\n"],"names":["installer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMY,MAAC,OAAO,GAAGA,mBAAS,CAAC,QAAQ;AAC7B,MAAC,OAAO,GAAGA,mBAAS,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/element-plus/index.ts"],"sourcesContent":["import installer from './defaults'\nexport * from '@element-plus/components'\nexport * from '@element-plus/constants'\nexport * from '@element-plus/directives'\nexport * from '@element-plus/hooks'\nexport * from './make-installer'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n\nexport { default as dayjs } from 'dayjs'\n"],"names":["installer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMY,MAAC,OAAO,GAAGA,mBAAS,CAAC,QAAQ;AAC7B,MAAC,OAAO,GAAGA,mBAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.2.
|
|
1
|
+
export declare const version = "2.2.34";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '2.2.
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '2.2.34'\n"],"names":[],"mappings":";;;;AAAY,MAAC,OAAO,GAAG;;;;"}
|