element-plus 2.2.33 → 2.2.35
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 +124 -45
- 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 +123 -46
- 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 +27 -0
- package/es/components/config-provider/src/hooks/use-global-config.mjs +30 -5
- package/es/components/config-provider/src/hooks/use-global-config.mjs.map +1 -1
- package/es/components/dialog/index.d.ts +12 -0
- package/es/components/dialog/src/dialog.vue.d.ts +12 -0
- 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 +14 -12
- 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/overlay/index.d.ts +12 -0
- package/es/components/overlay/src/overlay.d.ts +18 -0
- package/es/components/overlay/src/overlay.mjs +7 -1
- package/es/components/overlay/src/overlay.mjs.map +1 -1
- package/es/components/pagination/src/components/sizes.vue.d.ts +1 -0
- package/es/components/select/index.d.ts +1 -0
- package/es/components/select/src/options.d.ts +7 -0
- package/es/components/select/src/options.mjs +29 -0
- package/es/components/select/src/options.mjs.map +1 -0
- package/es/components/select/src/select.mjs +14 -1
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/select/src/select.vue.d.ts +1 -0
- package/es/components/select/src/useSelect.d.ts +1 -0
- package/es/components/select/src/useSelect.mjs +2 -10
- package/es/components/select/src/useSelect.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/time-select/index.d.ts +4 -0
- package/es/components/time-select/src/time-select.vue.d.ts +2 -0
- 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-lockscreen/index.d.ts +5 -1
- package/es/hooks/use-lockscreen/index.mjs +2 -2
- package/es/hooks/use-lockscreen/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 +27 -0
- package/lib/components/config-provider/src/hooks/use-global-config.js +31 -5
- package/lib/components/config-provider/src/hooks/use-global-config.js.map +1 -1
- package/lib/components/dialog/index.d.ts +12 -0
- package/lib/components/dialog/src/dialog.vue.d.ts +12 -0
- 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 +23 -21
- 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/overlay/index.d.ts +12 -0
- package/lib/components/overlay/src/overlay.d.ts +18 -0
- package/lib/components/overlay/src/overlay.js +7 -1
- package/lib/components/overlay/src/overlay.js.map +1 -1
- package/lib/components/pagination/src/components/sizes.vue.d.ts +1 -0
- package/lib/components/select/index.d.ts +1 -0
- package/lib/components/select/src/options.d.ts +7 -0
- package/lib/components/select/src/options.js +33 -0
- package/lib/components/select/src/options.js.map +1 -0
- package/lib/components/select/src/select.js +14 -1
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/select/src/select.vue.d.ts +1 -0
- package/lib/components/select/src/useSelect.d.ts +1 -0
- package/lib/components/select/src/useSelect.js +1 -9
- package/lib/components/select/src/useSelect.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/time-select/index.d.ts +4 -0
- package/lib/components/time-select/src/time-select.vue.d.ts +2 -0
- 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-lockscreen/index.d.ts +5 -1
- package/lib/hooks/use-lockscreen/index.js +2 -2
- package/lib/hooks/use-lockscreen/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,GAA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ule', { 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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AQ,CAAC;AAC3B,MAAM,CAAC,QAAQ,GAAG,IAAI;;;;;;"}
|
|
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 { 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,E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AAM,GAAG,GAAG,CAAC;AACjC,GAAG;AACH,CAAC;AACM,SAAS,QAAQ,GAAG;AAC3B,EAAE,KAAK,MAAM,qBAAqB,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,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;;;;;;"}
|
|
@@ -13,6 +13,12 @@ export declare const ElOverlay: import("vue").DefineComponent<{
|
|
|
13
13
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
14
14
|
__epPropKey: true;
|
|
15
15
|
};
|
|
16
|
+
readonly isGlobal: {
|
|
17
|
+
readonly type: import("vue").PropType<import("../../utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
18
|
+
readonly required: false;
|
|
19
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
20
|
+
__epPropKey: true;
|
|
21
|
+
};
|
|
16
22
|
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
23
|
[key: string]: any;
|
|
18
24
|
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -32,6 +38,12 @@ export declare const ElOverlay: import("vue").DefineComponent<{
|
|
|
32
38
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
33
39
|
__epPropKey: true;
|
|
34
40
|
};
|
|
41
|
+
readonly isGlobal: {
|
|
42
|
+
readonly type: import("vue").PropType<import("../../utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
43
|
+
readonly required: false;
|
|
44
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
45
|
+
__epPropKey: true;
|
|
46
|
+
};
|
|
35
47
|
}>> & {
|
|
36
48
|
onClick?: ((evt: MouseEvent) => any) | undefined;
|
|
37
49
|
}, {
|
|
@@ -15,6 +15,12 @@ export declare const overlayProps: {
|
|
|
15
15
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
16
16
|
__epPropKey: true;
|
|
17
17
|
};
|
|
18
|
+
readonly isGlobal: {
|
|
19
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
20
|
+
readonly required: false;
|
|
21
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
22
|
+
__epPropKey: true;
|
|
23
|
+
};
|
|
18
24
|
};
|
|
19
25
|
export declare type OverlayProps = ExtractPropTypes<typeof overlayProps>;
|
|
20
26
|
export declare const overlayEmits: {
|
|
@@ -36,6 +42,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
36
42
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
37
43
|
__epPropKey: true;
|
|
38
44
|
};
|
|
45
|
+
readonly isGlobal: {
|
|
46
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
47
|
+
readonly required: false;
|
|
48
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
49
|
+
__epPropKey: true;
|
|
50
|
+
};
|
|
39
51
|
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
40
52
|
[key: string]: any;
|
|
41
53
|
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -55,6 +67,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
55
67
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
56
68
|
__epPropKey: true;
|
|
57
69
|
};
|
|
70
|
+
readonly isGlobal: {
|
|
71
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
72
|
+
readonly required: false;
|
|
73
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
74
|
+
__epPropKey: true;
|
|
75
|
+
};
|
|
58
76
|
}>> & {
|
|
59
77
|
onClick?: ((evt: MouseEvent) => any) | undefined;
|
|
60
78
|
}, {
|
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var vue = require('vue');
|
|
6
6
|
require('../../../utils/index.js');
|
|
7
7
|
require('../../../hooks/index.js');
|
|
8
|
+
require('../../config-provider/index.js');
|
|
8
9
|
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
10
|
+
var useGlobalConfig = require('../../config-provider/src/hooks/use-global-config.js');
|
|
9
11
|
var index = require('../../../hooks/use-namespace/index.js');
|
|
10
12
|
var index$1 = require('../../../hooks/use-same-target/index.js');
|
|
11
13
|
var vnode = require('../../../utils/vue/vnode.js');
|
|
@@ -28,17 +30,21 @@ const overlayProps = runtime.buildProps({
|
|
|
28
30
|
},
|
|
29
31
|
zIndex: {
|
|
30
32
|
type: runtime.definePropType([String, Number])
|
|
33
|
+
},
|
|
34
|
+
isGlobal: {
|
|
35
|
+
type: Boolean
|
|
31
36
|
}
|
|
32
37
|
});
|
|
33
38
|
const overlayEmits = {
|
|
34
39
|
click: (evt) => evt instanceof MouseEvent
|
|
35
40
|
};
|
|
41
|
+
const BLOCK = "overlay";
|
|
36
42
|
var Overlay = vue.defineComponent({
|
|
37
43
|
name: "ElOverlay",
|
|
38
44
|
props: overlayProps,
|
|
39
45
|
emits: overlayEmits,
|
|
40
46
|
setup(props, { slots, emit }) {
|
|
41
|
-
const ns = index.useNamespace(
|
|
47
|
+
const ns = props.isGlobal ? useGlobalConfig.useGlobalComponentSettings(BLOCK).ns : index.useNamespace(BLOCK);
|
|
42
48
|
const onMaskClick = (e) => {
|
|
43
49
|
emit("click", e);
|
|
44
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.js","sources":["../../../../../../packages/components/overlay/src/overlay.ts"],"sourcesContent":["import { createVNode, defineComponent, h, renderSlot } from 'vue'\nimport { PatchFlags, buildProps, definePropType } from '@element-plus/utils'\nimport { useNamespace, useSameTarget } from '@element-plus/hooks'\n\nimport type { CSSProperties, ExtractPropTypes } from 'vue'\nimport type { ZIndexProperty } from 'csstype'\n\nexport const overlayProps = buildProps({\n mask: {\n type: Boolean,\n default: true,\n },\n customMaskEvent: {\n type: Boolean,\n default: false,\n },\n overlayClass: {\n type: definePropType<string | string[] | Record<string, boolean>>([\n String,\n Array,\n Object,\n ]),\n },\n zIndex: {\n type: definePropType<ZIndexProperty>([String, Number]),\n },\n} as const)\nexport type OverlayProps = ExtractPropTypes<typeof overlayProps>\n\nexport const overlayEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type OverlayEmits = typeof overlayEmits\n\nexport default defineComponent({\n name: 'ElOverlay',\n\n props: overlayProps,\n emits: overlayEmits,\n\n setup(props, { slots, emit }) {\n const ns = useNamespace(
|
|
1
|
+
{"version":3,"file":"overlay.js","sources":["../../../../../../packages/components/overlay/src/overlay.ts"],"sourcesContent":["import { createVNode, defineComponent, h, renderSlot } from 'vue'\nimport { PatchFlags, buildProps, definePropType } from '@element-plus/utils'\nimport { useNamespace, useSameTarget } from '@element-plus/hooks'\nimport { useGlobalComponentSettings } from '@element-plus/components/config-provider'\n\nimport type { CSSProperties, ExtractPropTypes } from 'vue'\nimport type { ZIndexProperty } from 'csstype'\n\nexport const overlayProps = buildProps({\n mask: {\n type: Boolean,\n default: true,\n },\n customMaskEvent: {\n type: Boolean,\n default: false,\n },\n overlayClass: {\n type: definePropType<string | string[] | Record<string, boolean>>([\n String,\n Array,\n Object,\n ]),\n },\n zIndex: {\n type: definePropType<ZIndexProperty>([String, Number]),\n },\n isGlobal: {\n type: Boolean,\n },\n} as const)\nexport type OverlayProps = ExtractPropTypes<typeof overlayProps>\n\nexport const overlayEmits = {\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type OverlayEmits = typeof overlayEmits\n\nconst BLOCK = 'overlay'\n\nexport default defineComponent({\n name: 'ElOverlay',\n\n props: overlayProps,\n emits: overlayEmits,\n\n setup(props, { slots, emit }) {\n // No reactivity on this prop because when its rendering with a global\n // component, this will be a constant flag.\n const ns = props.isGlobal\n ? useGlobalComponentSettings(BLOCK).ns\n : useNamespace(BLOCK)\n\n const onMaskClick = (e: MouseEvent) => {\n emit('click', e)\n }\n\n const { onClick, onMousedown, onMouseup } = useSameTarget(\n props.customMaskEvent ? undefined : onMaskClick\n )\n\n // init here\n return () => {\n // when the vnode meets the same structure but with different change trigger\n // it will not automatically update, thus we simply use h function to manage updating\n return props.mask\n ? createVNode(\n 'div',\n {\n class: [ns.b(), props.overlayClass],\n style: {\n zIndex: props.zIndex,\n },\n onClick,\n onMousedown,\n onMouseup,\n },\n [renderSlot(slots, 'default')],\n PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS,\n ['onClick', 'onMouseup', 'onMousedown']\n )\n : h(\n 'div',\n {\n class: props.overlayClass,\n style: {\n zIndex: props.zIndex,\n position: 'fixed',\n top: '0px',\n right: '0px',\n bottom: '0px',\n left: '0px',\n } as CSSProperties,\n },\n [renderSlot(slots, 'default')]\n )\n }\n },\n})\n"],"names":["buildProps","definePropType","defineComponent","useGlobalComponentSettings","useNamespace","useSameTarget","createVNode","renderSlot","PatchFlags","h"],"mappings":";;;;;;;;;;;;;;AAIY,MAAC,YAAY,GAAGA,kBAAU,CAAC;AACvC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAEC,sBAAc,CA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AAC,MAAM;AAC9B,SAAS;AACT,QAAQ,OAAO;AACf,QAAQ,WAAW;AACnB,QAAQ,SAAS;AACjB,OAAO,EAAE,CAACC,cAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,EAAEC,gBAAU,CAAC,KAAK,GAAGA,gBAAU,CAAC,KAAK,GAAGA,gBAAU,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,GAAGC,KAAC,CAAC,KAAK,EAAE;AACrJ,QAAQ,KAAK,EAAE,KAAK,CAAC,YAAY;AACjC,QAAQ,KAAK,EAAE;AACf,UAAU,MAAM,EAAE,KAAK,CAAC,MAAM;AAC9B,UAAU,QAAQ,EAAE,OAAO;AAC3B,UAAU,GAAG,EAAE,KAAK;AACpB,UAAU,KAAK,EAAE,KAAK;AACtB,UAAU,MAAM,EAAE,KAAK;AACvB,UAAU,IAAI,EAAE,KAAK;AACrB,SAAS;AACT,OAAO,EAAE,CAACF,cAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AACzC,KAAK,CAAC;AACN,GAAG;AACH,CAAC,CAAC;;;;;;"}
|
|
@@ -231,6 +231,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
231
231
|
default: string;
|
|
232
232
|
};
|
|
233
233
|
}, {
|
|
234
|
+
onOptionsRendered: (v: any) => void;
|
|
234
235
|
tagInMultiLine: import("vue").Ref<boolean>;
|
|
235
236
|
prefixWidth: import("vue").Ref<number>;
|
|
236
237
|
selectSize: import("vue").ComputedRef<"" | "default" | "small" | "large">;
|
|
@@ -101,6 +101,7 @@ export declare const ElSelect: import("element-plus/es/utils").SFCWithInstall<im
|
|
|
101
101
|
default: string;
|
|
102
102
|
};
|
|
103
103
|
}, {
|
|
104
|
+
onOptionsRendered: (v: any) => void;
|
|
104
105
|
tagInMultiLine: import("vue").Ref<boolean>;
|
|
105
106
|
prefixWidth: import("vue").Ref<number>;
|
|
106
107
|
selectSize: import("vue").ComputedRef<"" | "default" | "small" | "large">;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update-options"[], "update-options", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
|
|
5
|
+
"onUpdate-options"?: ((...args: any[]) => any) | undefined;
|
|
6
|
+
}, {}>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
|
|
7
|
+
var ElOptions = vue.defineComponent({
|
|
8
|
+
name: "ElOptions",
|
|
9
|
+
emits: ["update-options"],
|
|
10
|
+
setup(_, { slots, emit }) {
|
|
11
|
+
return () => {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
14
|
+
if (children.length) {
|
|
15
|
+
const options = ((_d = (_c = (_b = children[0]) == null ? void 0 : _b.children) == null ? void 0 : _c[0]) == null ? void 0 : _d.children) || [];
|
|
16
|
+
if (options && options.length) {
|
|
17
|
+
const filteredOptions = options.filter((item) => {
|
|
18
|
+
var _a2;
|
|
19
|
+
return ((_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name) === "ElOption";
|
|
20
|
+
}).map((item) => {
|
|
21
|
+
var _a2;
|
|
22
|
+
return (_a2 = item.props) == null ? void 0 : _a2.label;
|
|
23
|
+
});
|
|
24
|
+
emit("update-options", filteredOptions);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return children;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
exports["default"] = ElOptions;
|
|
33
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sources":["../../../../../../packages/components/select/src/options.ts"],"sourcesContent":["import { defineComponent } from 'vue'\n\nimport type { Component, VNode } from 'vue'\n\nexport default defineComponent({\n name: 'ElOptions',\n emits: ['update-options'],\n setup(_, { slots, emit }) {\n return () => {\n const children = slots.default?.()!\n\n if (children.length) {\n const options = (children![0]?.children as VNode[])?.[0]?.children || []\n if (options && options.length) {\n const filteredOptions = (options as VNode[])\n .filter(\n (item: VNode) =>\n ((item?.type || {}) as Component)?.name === 'ElOption'\n )\n .map((item: VNode) => item.props?.label)\n\n emit('update-options', filteredOptions)\n }\n }\n\n return children\n }\n },\n})\n"],"names":["defineComponent"],"mappings":";;;;;;AACA,gBAAeA,mBAAe,CAAC;AAC/B,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,KAAK,EAAE,CAAC,gBAAgB,CAAC;AAC3B,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;AAC5B,IAAI,OAAO,MAAM;AACjB,MAAM,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AACzB,MAAM,MAAM,QAAQ,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC9E,MAAM,IAAI,QAAQ,CAAC,MAAM,EAAE;AAC3B,QAAQ,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,KAAK,EAAE,CAAC;AACxJ,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;AACvC,UAAU,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK;AAC3D,YAAY,IAAI,GAAG,CAAC;AACpB,YAAY,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,EAAE,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,IAAI,MAAM,UAAU,CAAC;AAClH,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK;AAC3B,YAAY,IAAI,GAAG,CAAC;AACpB,YAAY,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;AACnE,WAAW,CAAC,CAAC;AACb,UAAU,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;AAClD,SAAS;AACT,OAAO;AACP,MAAM,OAAO,QAAQ,CAAC;AACtB,KAAK,CAAC;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
|
|
@@ -19,6 +19,7 @@ var option = require('./option.js');
|
|
|
19
19
|
var selectDropdown = require('./select-dropdown.js');
|
|
20
20
|
var useSelect = require('./useSelect.js');
|
|
21
21
|
var token = require('./token.js');
|
|
22
|
+
var options = require('./options.js');
|
|
22
23
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
23
24
|
var index$5 = require('../../../directives/click-outside/index.js');
|
|
24
25
|
var validator = require('../../../utils/vue/validator.js');
|
|
@@ -38,6 +39,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
38
39
|
ElInput: index.ElInput,
|
|
39
40
|
ElSelectMenu: selectDropdown["default"],
|
|
40
41
|
ElOption: option["default"],
|
|
42
|
+
ElOptions: options["default"],
|
|
41
43
|
ElTag: index$1.ElTag,
|
|
42
44
|
ElScrollbar: index$2.ElScrollbar,
|
|
43
45
|
ElTooltip: index$3.ElTooltip,
|
|
@@ -156,6 +158,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
156
158
|
const { t } = index$7.useLocale();
|
|
157
159
|
const states = useSelect.useSelectStates(props);
|
|
158
160
|
const {
|
|
161
|
+
optionList,
|
|
159
162
|
optionsArray,
|
|
160
163
|
selectSize,
|
|
161
164
|
readonly,
|
|
@@ -294,7 +297,11 @@ const _sfc_main = vue.defineComponent({
|
|
|
294
297
|
var _a, _b;
|
|
295
298
|
return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
|
|
296
299
|
});
|
|
300
|
+
const onOptionsRendered = (v) => {
|
|
301
|
+
optionList.value = v;
|
|
302
|
+
};
|
|
297
303
|
return {
|
|
304
|
+
onOptionsRendered,
|
|
298
305
|
tagInMultiLine,
|
|
299
306
|
prefixWidth,
|
|
300
307
|
selectSize,
|
|
@@ -371,6 +378,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
371
378
|
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
372
379
|
const _component_el_input = vue.resolveComponent("el-input");
|
|
373
380
|
const _component_el_option = vue.resolveComponent("el-option");
|
|
381
|
+
const _component_el_options = vue.resolveComponent("el-options");
|
|
374
382
|
const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
|
|
375
383
|
const _component_el_select_menu = vue.resolveComponent("el-select-menu");
|
|
376
384
|
const _directive_click_outside = vue.resolveDirective("click-outside");
|
|
@@ -649,7 +657,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
649
657
|
value: _ctx.query,
|
|
650
658
|
created: true
|
|
651
659
|
}, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
|
|
652
|
-
vue.
|
|
660
|
+
vue.createVNode(_component_el_options, { onUpdateOptions: _ctx.onOptionsRendered }, {
|
|
661
|
+
default: vue.withCtx(() => [
|
|
662
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
663
|
+
]),
|
|
664
|
+
_: 3
|
|
665
|
+
}, 8, ["onUpdateOptions"])
|
|
653
666
|
]),
|
|
654
667
|
_: 3
|
|
655
668
|
}, 8, ["wrap-class", "view-class", "class"]), [
|