@element-plus/nightly 0.0.20240815 → 0.0.20240816
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 +6 -2
- package/dist/index.full.min.js +3 -3
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +3 -3
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +6 -2
- 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-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.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/my.js +1 -1
- package/dist/locale/my.min.js +1 -1
- package/dist/locale/my.min.mjs +1 -1
- package/dist/locale/my.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/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.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/button/src/use-button.mjs +4 -0
- package/es/components/button/src/use-button.mjs.map +1 -1
- package/es/components/col/index.mjs +2 -2
- package/es/components/col/src/col.mjs +66 -43
- package/es/components/col/src/col.mjs.map +1 -1
- package/es/components/col/src/col2.mjs +43 -66
- package/es/components/col/src/col2.mjs.map +1 -1
- package/es/components/index.mjs +5 -5
- package/es/components/input/src/input.d.ts +0 -2
- package/es/components/input/src/input.mjs.map +1 -1
- package/es/components/pagination/src/components/total.mjs +7 -27
- package/es/components/pagination/src/components/total.mjs.map +1 -1
- package/es/components/pagination/src/components/total2.mjs +27 -7
- package/es/components/pagination/src/components/total2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/components/steps/index.mjs +2 -2
- package/es/components/steps/src/item.mjs +19 -191
- package/es/components/steps/src/item.mjs.map +1 -1
- package/es/components/steps/src/item2.mjs +191 -19
- package/es/components/steps/src/item2.mjs.map +1 -1
- package/es/components/tabs/index.mjs +3 -3
- package/es/components/tabs/src/tab-bar.mjs +7 -73
- package/es/components/tabs/src/tab-bar.mjs.map +1 -1
- package/es/components/tabs/src/tab-bar2.mjs +73 -7
- package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
- package/es/components/tabs/src/tab-nav.mjs +1 -1
- package/es/components/tabs/src/tab-pane.mjs +72 -13
- package/es/components/tabs/src/tab-pane.mjs.map +1 -1
- package/es/components/tabs/src/tab-pane2.mjs +13 -72
- package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
- package/es/components/time-select/index.mjs +2 -2
- package/es/components/time-select/src/time-select.mjs +51 -124
- package/es/components/time-select/src/time-select.mjs.map +1 -1
- package/es/components/time-select/src/time-select2.mjs +124 -51
- package/es/components/time-select/src/time-select2.mjs.map +1 -1
- package/es/index.mjs +5 -5
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/button/src/use-button.js +4 -0
- package/lib/components/button/src/use-button.js.map +1 -1
- package/lib/components/col/index.js +2 -2
- package/lib/components/col/src/col.js +66 -43
- package/lib/components/col/src/col.js.map +1 -1
- package/lib/components/col/src/col2.js +43 -66
- package/lib/components/col/src/col2.js.map +1 -1
- package/lib/components/index.js +5 -5
- package/lib/components/input/src/input.d.ts +0 -2
- package/lib/components/input/src/input.js.map +1 -1
- package/lib/components/pagination/src/components/total.js +7 -27
- package/lib/components/pagination/src/components/total.js.map +1 -1
- package/lib/components/pagination/src/components/total2.js +27 -7
- package/lib/components/pagination/src/components/total2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/components/steps/index.js +2 -2
- package/lib/components/steps/src/item.js +19 -191
- package/lib/components/steps/src/item.js.map +1 -1
- package/lib/components/steps/src/item2.js +191 -19
- package/lib/components/steps/src/item2.js.map +1 -1
- package/lib/components/tabs/index.js +3 -3
- package/lib/components/tabs/src/tab-bar.js +7 -73
- package/lib/components/tabs/src/tab-bar.js.map +1 -1
- package/lib/components/tabs/src/tab-bar2.js +73 -7
- package/lib/components/tabs/src/tab-bar2.js.map +1 -1
- package/lib/components/tabs/src/tab-nav.js +1 -1
- package/lib/components/tabs/src/tab-pane.js +72 -13
- package/lib/components/tabs/src/tab-pane.js.map +1 -1
- package/lib/components/tabs/src/tab-pane2.js +13 -72
- package/lib/components/tabs/src/tab-pane2.js.map +1 -1
- package/lib/components/time-select/index.js +2 -2
- package/lib/components/time-select/src/time-select.js +51 -129
- package/lib/components/time-select/src/time-select.js.map +1 -1
- package/lib/components/time-select/src/time-select2.js +129 -51
- package/lib/components/time-select/src/time-select2.js.map +1 -1
- package/lib/index.js +5 -5
- 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
|
@@ -1,79 +1,13 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, inject, ref, watch, nextTick, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle } from 'vue';
|
|
2
|
-
import { useResizeObserver } from '@vueuse/core';
|
|
3
1
|
import '../../../utils/index.mjs';
|
|
4
|
-
import '../../../
|
|
5
|
-
import {
|
|
6
|
-
import { tabBarProps } from './tab-bar2.mjs';
|
|
7
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
-
import { throwError } from '../../../utils/error.mjs';
|
|
9
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
10
|
-
import { capitalize } from '../../../utils/strings.mjs';
|
|
2
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
3
|
+
import { mutable } from '../../../utils/typescript.mjs';
|
|
11
4
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
-
...__default__,
|
|
18
|
-
props: tabBarProps,
|
|
19
|
-
setup(__props, { expose }) {
|
|
20
|
-
const props = __props;
|
|
21
|
-
const instance = getCurrentInstance();
|
|
22
|
-
const rootTabs = inject(tabsRootContextKey);
|
|
23
|
-
if (!rootTabs)
|
|
24
|
-
throwError(COMPONENT_NAME, "<el-tabs><el-tab-bar /></el-tabs>");
|
|
25
|
-
const ns = useNamespace("tabs");
|
|
26
|
-
const barRef = ref();
|
|
27
|
-
const barStyle = ref();
|
|
28
|
-
const getBarStyle = () => {
|
|
29
|
-
let offset = 0;
|
|
30
|
-
let tabSize = 0;
|
|
31
|
-
const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
|
|
32
|
-
const sizeDir = sizeName === "width" ? "x" : "y";
|
|
33
|
-
const position = sizeDir === "x" ? "left" : "top";
|
|
34
|
-
props.tabs.every((tab) => {
|
|
35
|
-
var _a, _b;
|
|
36
|
-
const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
|
|
37
|
-
if (!$el)
|
|
38
|
-
return false;
|
|
39
|
-
if (!tab.active) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
offset = $el[`offset${capitalize(position)}`];
|
|
43
|
-
tabSize = $el[`client${capitalize(sizeName)}`];
|
|
44
|
-
const tabStyles = window.getComputedStyle($el);
|
|
45
|
-
if (sizeName === "width") {
|
|
46
|
-
tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
|
|
47
|
-
offset += Number.parseFloat(tabStyles.paddingLeft);
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
[sizeName]: `${tabSize}px`,
|
|
53
|
-
transform: `translate${capitalize(sizeDir)}(${offset}px)`
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
const update = () => barStyle.value = getBarStyle();
|
|
57
|
-
watch(() => props.tabs, async () => {
|
|
58
|
-
await nextTick();
|
|
59
|
-
update();
|
|
60
|
-
}, { immediate: true });
|
|
61
|
-
useResizeObserver(barRef, () => update());
|
|
62
|
-
expose({
|
|
63
|
-
ref: barRef,
|
|
64
|
-
update
|
|
65
|
-
});
|
|
66
|
-
return (_ctx, _cache) => {
|
|
67
|
-
return openBlock(), createElementBlock("div", {
|
|
68
|
-
ref_key: "barRef",
|
|
69
|
-
ref: barRef,
|
|
70
|
-
class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
|
|
71
|
-
style: normalizeStyle(barStyle.value)
|
|
72
|
-
}, null, 6);
|
|
73
|
-
};
|
|
5
|
+
const tabBarProps = buildProps({
|
|
6
|
+
tabs: {
|
|
7
|
+
type: definePropType(Array),
|
|
8
|
+
default: () => mutable([])
|
|
74
9
|
}
|
|
75
10
|
});
|
|
76
|
-
var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "tab-bar.vue"]]);
|
|
77
11
|
|
|
78
|
-
export {
|
|
12
|
+
export { tabBarProps };
|
|
79
13
|
//# sourceMappingURL=tab-bar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-bar.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.
|
|
1
|
+
{"version":3,"file":"tab-bar.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.ts"],"sourcesContent":["import { buildProps, definePropType, mutable } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { TabsPaneContext } from './constants'\nimport type TabBar from './tab-bar.vue'\n\nexport const tabBarProps = buildProps({\n tabs: {\n type: definePropType<TabsPaneContext[]>(Array),\n default: () => mutable([] as const),\n },\n} as const)\n\nexport type TabBarProps = ExtractPropTypes<typeof tabBarProps>\nexport type TabBarInstance = InstanceType<typeof TabBar>\n"],"names":[],"mappings":";;;;AACY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,CAAC;;;;"}
|
|
@@ -1,13 +1,79 @@
|
|
|
1
|
+
import { defineComponent, getCurrentInstance, inject, ref, watch, nextTick, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle } from 'vue';
|
|
2
|
+
import { useResizeObserver } from '@vueuse/core';
|
|
1
3
|
import '../../../utils/index.mjs';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
+
import '../../../hooks/index.mjs';
|
|
5
|
+
import { tabsRootContextKey } from './constants.mjs';
|
|
6
|
+
import { tabBarProps } from './tab-bar.mjs';
|
|
7
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
+
import { throwError } from '../../../utils/error.mjs';
|
|
9
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
10
|
+
import { capitalize } from '../../../utils/strings.mjs';
|
|
4
11
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
const COMPONENT_NAME = "ElTabBar";
|
|
13
|
+
const __default__ = defineComponent({
|
|
14
|
+
name: COMPONENT_NAME
|
|
15
|
+
});
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...__default__,
|
|
18
|
+
props: tabBarProps,
|
|
19
|
+
setup(__props, { expose }) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const instance = getCurrentInstance();
|
|
22
|
+
const rootTabs = inject(tabsRootContextKey);
|
|
23
|
+
if (!rootTabs)
|
|
24
|
+
throwError(COMPONENT_NAME, "<el-tabs><el-tab-bar /></el-tabs>");
|
|
25
|
+
const ns = useNamespace("tabs");
|
|
26
|
+
const barRef = ref();
|
|
27
|
+
const barStyle = ref();
|
|
28
|
+
const getBarStyle = () => {
|
|
29
|
+
let offset = 0;
|
|
30
|
+
let tabSize = 0;
|
|
31
|
+
const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
|
|
32
|
+
const sizeDir = sizeName === "width" ? "x" : "y";
|
|
33
|
+
const position = sizeDir === "x" ? "left" : "top";
|
|
34
|
+
props.tabs.every((tab) => {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
|
|
37
|
+
if (!$el)
|
|
38
|
+
return false;
|
|
39
|
+
if (!tab.active) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
offset = $el[`offset${capitalize(position)}`];
|
|
43
|
+
tabSize = $el[`client${capitalize(sizeName)}`];
|
|
44
|
+
const tabStyles = window.getComputedStyle($el);
|
|
45
|
+
if (sizeName === "width") {
|
|
46
|
+
tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
|
|
47
|
+
offset += Number.parseFloat(tabStyles.paddingLeft);
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
[sizeName]: `${tabSize}px`,
|
|
53
|
+
transform: `translate${capitalize(sizeDir)}(${offset}px)`
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const update = () => barStyle.value = getBarStyle();
|
|
57
|
+
watch(() => props.tabs, async () => {
|
|
58
|
+
await nextTick();
|
|
59
|
+
update();
|
|
60
|
+
}, { immediate: true });
|
|
61
|
+
useResizeObserver(barRef, () => update());
|
|
62
|
+
expose({
|
|
63
|
+
ref: barRef,
|
|
64
|
+
update
|
|
65
|
+
});
|
|
66
|
+
return (_ctx, _cache) => {
|
|
67
|
+
return openBlock(), createElementBlock("div", {
|
|
68
|
+
ref_key: "barRef",
|
|
69
|
+
ref: barRef,
|
|
70
|
+
class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
|
|
71
|
+
style: normalizeStyle(barStyle.value)
|
|
72
|
+
}, null, 6);
|
|
73
|
+
};
|
|
9
74
|
}
|
|
10
75
|
});
|
|
76
|
+
var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "tab-bar.vue"]]);
|
|
11
77
|
|
|
12
|
-
export {
|
|
78
|
+
export { TabBar as default };
|
|
13
79
|
//# sourceMappingURL=tab-bar2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-bar2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.
|
|
1
|
+
{"version":3,"file":"tab-bar2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.vue"],"sourcesContent":["<template>\n <div\n ref=\"barRef\"\n :class=\"[ns.e('active-bar'), ns.is(rootTabs.props.tabPosition)]\"\n :style=\"barStyle\"\n />\n</template>\n\n<script lang=\"ts\" setup>\nimport { getCurrentInstance, inject, nextTick, ref, watch } from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { capitalize, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { tabsRootContextKey } from './constants'\nimport { tabBarProps } from './tab-bar'\n\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'ElTabBar'\ndefineOptions({\n name: COMPONENT_NAME,\n})\nconst props = defineProps(tabBarProps)\n\nconst instance = getCurrentInstance()!\nconst rootTabs = inject(tabsRootContextKey)\nif (!rootTabs) throwError(COMPONENT_NAME, '<el-tabs><el-tab-bar /></el-tabs>')\n\nconst ns = useNamespace('tabs')\n\nconst barRef = ref<HTMLDivElement>()\nconst barStyle = ref<CSSProperties>()\n\nconst getBarStyle = (): CSSProperties => {\n let offset = 0\n let tabSize = 0\n\n const sizeName = ['top', 'bottom'].includes(rootTabs.props.tabPosition)\n ? 'width'\n : 'height'\n const sizeDir = sizeName === 'width' ? 'x' : 'y'\n const position = sizeDir === 'x' ? 'left' : 'top'\n\n props.tabs.every((tab) => {\n const $el = instance.parent?.refs?.[`tab-${tab.uid}`] as HTMLElement\n if (!$el) return false\n\n if (!tab.active) {\n return true\n }\n\n offset = $el[`offset${capitalize(position)}`]\n tabSize = $el[`client${capitalize(sizeName)}`]\n\n const tabStyles = window.getComputedStyle($el)\n\n if (sizeName === 'width') {\n tabSize -=\n Number.parseFloat(tabStyles.paddingLeft) +\n Number.parseFloat(tabStyles.paddingRight)\n offset += Number.parseFloat(tabStyles.paddingLeft)\n }\n return false\n })\n\n return {\n [sizeName]: `${tabSize}px`,\n transform: `translate${capitalize(sizeDir)}(${offset}px)`,\n }\n}\n\nconst update = () => (barStyle.value = getBarStyle())\n\nwatch(\n () => props.tabs,\n async () => {\n await nextTick()\n update()\n },\n { immediate: true }\n)\nuseResizeObserver(barRef, () => update())\n\ndefineExpose({\n /** @description tab root html element */\n ref: barRef,\n /** @description method to manually update tab bar style */\n update,\n})\n</script>\n"],"names":[],"mappings":"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"}
|
|
@@ -5,7 +5,7 @@ import '../../../constants/index.mjs';
|
|
|
5
5
|
import { ElIcon } from '../../icon/index.mjs';
|
|
6
6
|
import { ArrowLeft, ArrowRight, Close } from '@element-plus/icons-vue';
|
|
7
7
|
import '../../../hooks/index.mjs';
|
|
8
|
-
import TabBar from './tab-
|
|
8
|
+
import TabBar from './tab-bar2.mjs';
|
|
9
9
|
import { tabsRootContextKey } from './constants.mjs';
|
|
10
10
|
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
11
11
|
import { mutable } from '../../../utils/typescript.mjs';
|
|
@@ -1,18 +1,77 @@
|
|
|
1
|
+
import { defineComponent, getCurrentInstance, useSlots, inject, ref, computed, watch, reactive, onMounted, onUnmounted, unref, withDirectives, openBlock, createElementBlock, normalizeClass, renderSlot, vShow, createCommentVNode } from 'vue';
|
|
2
|
+
import { eagerComputed } from '@vueuse/core';
|
|
1
3
|
import '../../../utils/index.mjs';
|
|
2
|
-
import
|
|
4
|
+
import '../../../hooks/index.mjs';
|
|
5
|
+
import { tabsRootContextKey } from './constants.mjs';
|
|
6
|
+
import { tabPaneProps } from './tab-pane2.mjs';
|
|
7
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
+
import { throwError } from '../../../utils/error.mjs';
|
|
9
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
3
10
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
default: ""
|
|
8
|
-
},
|
|
9
|
-
name: {
|
|
10
|
-
type: [String, Number]
|
|
11
|
-
},
|
|
12
|
-
closable: Boolean,
|
|
13
|
-
disabled: Boolean,
|
|
14
|
-
lazy: Boolean
|
|
11
|
+
const COMPONENT_NAME = "ElTabPane";
|
|
12
|
+
const __default__ = defineComponent({
|
|
13
|
+
name: COMPONENT_NAME
|
|
15
14
|
});
|
|
15
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
+
...__default__,
|
|
17
|
+
props: tabPaneProps,
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const instance = getCurrentInstance();
|
|
21
|
+
const slots = useSlots();
|
|
22
|
+
const tabsRoot = inject(tabsRootContextKey);
|
|
23
|
+
if (!tabsRoot)
|
|
24
|
+
throwError(COMPONENT_NAME, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
|
|
25
|
+
const ns = useNamespace("tab-pane");
|
|
26
|
+
const index = ref();
|
|
27
|
+
const isClosable = computed(() => props.closable || tabsRoot.props.closable);
|
|
28
|
+
const active = eagerComputed(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
|
|
31
|
+
});
|
|
32
|
+
const loaded = ref(active.value);
|
|
33
|
+
const paneName = computed(() => {
|
|
34
|
+
var _a;
|
|
35
|
+
return (_a = props.name) != null ? _a : index.value;
|
|
36
|
+
});
|
|
37
|
+
const shouldBeRender = eagerComputed(() => !props.lazy || loaded.value || active.value);
|
|
38
|
+
watch(active, (val) => {
|
|
39
|
+
if (val)
|
|
40
|
+
loaded.value = true;
|
|
41
|
+
});
|
|
42
|
+
const pane = reactive({
|
|
43
|
+
uid: instance.uid,
|
|
44
|
+
slots,
|
|
45
|
+
props,
|
|
46
|
+
paneName,
|
|
47
|
+
active,
|
|
48
|
+
index,
|
|
49
|
+
isClosable
|
|
50
|
+
});
|
|
51
|
+
tabsRoot.registerPane(pane);
|
|
52
|
+
onMounted(() => {
|
|
53
|
+
tabsRoot.sortPane(pane);
|
|
54
|
+
});
|
|
55
|
+
onUnmounted(() => {
|
|
56
|
+
tabsRoot.unregisterPane(pane.uid);
|
|
57
|
+
});
|
|
58
|
+
return (_ctx, _cache) => {
|
|
59
|
+
return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
|
|
60
|
+
key: 0,
|
|
61
|
+
id: `pane-${unref(paneName)}`,
|
|
62
|
+
class: normalizeClass(unref(ns).b()),
|
|
63
|
+
role: "tabpanel",
|
|
64
|
+
"aria-hidden": !unref(active),
|
|
65
|
+
"aria-labelledby": `tab-${unref(paneName)}`
|
|
66
|
+
}, [
|
|
67
|
+
renderSlot(_ctx.$slots, "default")
|
|
68
|
+
], 10, ["id", "aria-hidden", "aria-labelledby"])), [
|
|
69
|
+
[vShow, unref(active)]
|
|
70
|
+
]) : createCommentVNode("v-if", true);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "tab-pane.vue"]]);
|
|
16
75
|
|
|
17
|
-
export {
|
|
76
|
+
export { TabPane as default };
|
|
18
77
|
//# sourceMappingURL=tab-pane.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-pane.mjs","sources":["../../../../../../packages/components/tabs/src/tab-pane.
|
|
1
|
+
{"version":3,"file":"tab-pane.mjs","sources":["../../../../../../packages/components/tabs/src/tab-pane.vue"],"sourcesContent":["<template>\n <div\n v-if=\"shouldBeRender\"\n v-show=\"active\"\n :id=\"`pane-${paneName}`\"\n :class=\"ns.b()\"\n role=\"tabpanel\"\n :aria-hidden=\"!active\"\n :aria-labelledby=\"`tab-${paneName}`\"\n >\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n getCurrentInstance,\n inject,\n onMounted,\n onUnmounted,\n reactive,\n ref,\n useSlots,\n watch,\n} from 'vue'\nimport { eagerComputed } from '@vueuse/core'\nimport { throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { tabsRootContextKey } from './constants'\nimport { tabPaneProps } from './tab-pane'\n\nconst COMPONENT_NAME = 'ElTabPane'\ndefineOptions({\n name: COMPONENT_NAME,\n})\nconst props = defineProps(tabPaneProps)\n\nconst instance = getCurrentInstance()!\nconst slots = useSlots()\n\nconst tabsRoot = inject(tabsRootContextKey)\nif (!tabsRoot)\n throwError(COMPONENT_NAME, 'usage: <el-tabs><el-tab-pane /></el-tabs/>')\n\nconst ns = useNamespace('tab-pane')\n\nconst index = ref<string>()\nconst isClosable = computed(() => props.closable || tabsRoot.props.closable)\nconst active = eagerComputed(\n () => tabsRoot.currentName.value === (props.name ?? index.value)\n)\nconst loaded = ref(active.value)\nconst paneName = computed(() => props.name ?? index.value)\nconst shouldBeRender = eagerComputed(\n () => !props.lazy || loaded.value || active.value\n)\n\nwatch(active, (val) => {\n if (val) loaded.value = true\n})\n\nconst pane = reactive({\n uid: instance.uid,\n slots,\n props,\n paneName,\n active,\n index,\n isClosable,\n})\n\ntabsRoot.registerPane(pane)\nonMounted(() => {\n tabsRoot.sortPane(pane)\n})\n\nonUnmounted(() => {\n tabsRoot.unregisterPane(pane.uid)\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;mCAiCc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;AAGA,IAAA,MAAM,WAAW,kBAAmB,EAAA,CAAA;AACpC,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,IAAM,MAAA,QAAA,GAAW,OAAO,kBAAkB,CAAA,CAAA;AAC1C,IAAA,IAAI,CAAC,QAAA;AACH,MAAA,UAAA,CAAW,gBAAgB,4CAA4C,CAAA,CAAA;AAEzE,IAAM,MAAA,EAAA,GAAK,aAAa,UAAU,CAAA,CAAA;AAElC,IAAA,MAAM,QAAQ,GAAY,EAAA,CAAA;AAC1B,IAAA,MAAM,aAAa,QAAS,CAAA,MAAM,MAAM,QAAY,IAAA,QAAA,CAAS,MAAM,QAAQ,CAAA,CAAA;AAC3E,IAAM,MAAA,MAAA,GAAS,cACb,MAAM;AAER,MAAM,IAAA,EAAA,CAAA;AACN,MAAA,eAAiB,CAAS,WAAA,CAAA,KAAY,MAAA,CAAA,EAAA,QAAc,CAAK,IAAA,KAAA,IAAA,GAAA,EAAA,GAAA,KAAA,CAAA,KAAA,CAAA,CAAA;AACzD,KAAM,CAAA,CAAA;AAIN,IAAM,MAAA,MAAA,GAAS,GAAQ,CAAA,MAAA,CAAA,KAAA,CAAA,CAAA;AACrB,IAAI,MAAA,QAAA,GAAA,QAAA,CAAA,MAAA;AAAK,MAAA,IAAA,EAAA,CAAA;AAAe,MACzB,OAAA,CAAA,EAAA,GAAA,KAAA,CAAA,IAAA,KAAA,IAAA,GAAA,EAAA,GAAA,KAAA,CAAA,KAAA,CAAA;AAED,KAAA,CAAA,CAAA;AAAsB,IAAA,oBACN,GAAA,aAAA,CAAA,MAAA,CAAA,KAAA,CAAA,IAAA,IAAA,MAAA,CAAA,KAAA,IAAA,MAAA,CAAA,KAAA,CAAA,CAAA;AAAA,IACd,KAAA,CAAA,MAAA,EAAA,CAAA,GAAA,KAAA;AAAA,MACA,IAAA,GAAA;AAAA,QACA,MAAA,CAAA,KAAA,GAAA,IAAA,CAAA;AAAA,KACA,CAAA,CAAA;AAAA,IACA,MAAA,IAAA,GAAA,QAAA,CAAA;AAAA,MACA,GAAA,EAAA,QAAA,CAAA,GAAA;AAAA,MACD,KAAA;AAED,MAAA,KAAA;AACA,MAAA,QAAU;AACR,MAAA,MAAA;AAAsB,MACvB,KAAA;AAED,MAAA,UAAY;AACV,KAAS,CAAA,CAAA;AAAuB,IAClC,QAAC,CAAA,YAAA,CAAA,IAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,77 +1,18 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, useSlots, inject, ref, computed, watch, reactive, onMounted, onUnmounted, unref, withDirectives, openBlock, createElementBlock, normalizeClass, renderSlot, vShow, createCommentVNode } from 'vue';
|
|
2
|
-
import { eagerComputed } from '@vueuse/core';
|
|
3
1
|
import '../../../utils/index.mjs';
|
|
4
|
-
import '../../../
|
|
5
|
-
import { tabsRootContextKey } from './constants.mjs';
|
|
6
|
-
import { tabPaneProps } from './tab-pane.mjs';
|
|
7
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
-
import { throwError } from '../../../utils/error.mjs';
|
|
9
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
2
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
|
10
3
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
const tabPaneProps = buildProps({
|
|
5
|
+
label: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: ""
|
|
8
|
+
},
|
|
9
|
+
name: {
|
|
10
|
+
type: [String, Number]
|
|
11
|
+
},
|
|
12
|
+
closable: Boolean,
|
|
13
|
+
disabled: Boolean,
|
|
14
|
+
lazy: Boolean
|
|
14
15
|
});
|
|
15
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
-
...__default__,
|
|
17
|
-
props: tabPaneProps,
|
|
18
|
-
setup(__props) {
|
|
19
|
-
const props = __props;
|
|
20
|
-
const instance = getCurrentInstance();
|
|
21
|
-
const slots = useSlots();
|
|
22
|
-
const tabsRoot = inject(tabsRootContextKey);
|
|
23
|
-
if (!tabsRoot)
|
|
24
|
-
throwError(COMPONENT_NAME, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
|
|
25
|
-
const ns = useNamespace("tab-pane");
|
|
26
|
-
const index = ref();
|
|
27
|
-
const isClosable = computed(() => props.closable || tabsRoot.props.closable);
|
|
28
|
-
const active = eagerComputed(() => {
|
|
29
|
-
var _a;
|
|
30
|
-
return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
|
|
31
|
-
});
|
|
32
|
-
const loaded = ref(active.value);
|
|
33
|
-
const paneName = computed(() => {
|
|
34
|
-
var _a;
|
|
35
|
-
return (_a = props.name) != null ? _a : index.value;
|
|
36
|
-
});
|
|
37
|
-
const shouldBeRender = eagerComputed(() => !props.lazy || loaded.value || active.value);
|
|
38
|
-
watch(active, (val) => {
|
|
39
|
-
if (val)
|
|
40
|
-
loaded.value = true;
|
|
41
|
-
});
|
|
42
|
-
const pane = reactive({
|
|
43
|
-
uid: instance.uid,
|
|
44
|
-
slots,
|
|
45
|
-
props,
|
|
46
|
-
paneName,
|
|
47
|
-
active,
|
|
48
|
-
index,
|
|
49
|
-
isClosable
|
|
50
|
-
});
|
|
51
|
-
tabsRoot.registerPane(pane);
|
|
52
|
-
onMounted(() => {
|
|
53
|
-
tabsRoot.sortPane(pane);
|
|
54
|
-
});
|
|
55
|
-
onUnmounted(() => {
|
|
56
|
-
tabsRoot.unregisterPane(pane.uid);
|
|
57
|
-
});
|
|
58
|
-
return (_ctx, _cache) => {
|
|
59
|
-
return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
|
|
60
|
-
key: 0,
|
|
61
|
-
id: `pane-${unref(paneName)}`,
|
|
62
|
-
class: normalizeClass(unref(ns).b()),
|
|
63
|
-
role: "tabpanel",
|
|
64
|
-
"aria-hidden": !unref(active),
|
|
65
|
-
"aria-labelledby": `tab-${unref(paneName)}`
|
|
66
|
-
}, [
|
|
67
|
-
renderSlot(_ctx.$slots, "default")
|
|
68
|
-
], 10, ["id", "aria-hidden", "aria-labelledby"])), [
|
|
69
|
-
[vShow, unref(active)]
|
|
70
|
-
]) : createCommentVNode("v-if", true);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "tab-pane.vue"]]);
|
|
75
16
|
|
|
76
|
-
export {
|
|
17
|
+
export { tabPaneProps };
|
|
77
18
|
//# sourceMappingURL=tab-pane2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-pane2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-pane.
|
|
1
|
+
{"version":3,"file":"tab-pane2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-pane.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type TabPane from './tab-pane.vue'\n\nexport const tabPaneProps = buildProps({\n /**\n * @description title of the tab\n */\n label: {\n type: String,\n default: '',\n },\n /**\n * @description identifier corresponding to the name of Tabs, representing the alias of the tab-pane, the default is ordinal number of the tab-pane in the sequence, e.g. the first tab-pane is '0'\n */\n name: {\n type: [String, Number],\n },\n /**\n * @description whether Tab is closable\n */\n closable: Boolean,\n /**\n * @description whether Tab is disabled\n */\n disabled: Boolean,\n /**\n * @description whether Tab is lazily rendered\n */\n lazy: Boolean,\n} as const)\n\nexport type TabPaneProps = ExtractPropTypes<typeof tabPaneProps>\n\nexport type TabPaneInstance = InstanceType<typeof TabPane>\n"],"names":[],"mappings":";;;AACY,MAAC,YAAY,GAAG,UAAU,CAAC;AACvC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE,OAAO;AACf,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import TimeSelect from './src/time-
|
|
3
|
-
export { timeSelectProps } from './src/time-
|
|
2
|
+
import TimeSelect from './src/time-select2.mjs';
|
|
3
|
+
export { timeSelectProps } from './src/time-select.mjs';
|
|
4
4
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
5
|
|
|
6
6
|
const ElTimeSelect = withInstall(TimeSelect);
|
|
@@ -1,129 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
4
|
-
import { ElSelect } from '../../select/index.mjs';
|
|
5
|
-
import '../../form/index.mjs';
|
|
6
|
-
import { ElIcon } from '../../icon/index.mjs';
|
|
1
|
+
import '../../../utils/index.mjs';
|
|
2
|
+
import { Clock, CircleClose } from '@element-plus/icons-vue';
|
|
7
3
|
import '../../../hooks/index.mjs';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
12
|
-
import { useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
|
|
13
|
-
import { useLocale } from '../../../hooks/use-locale/index.mjs';
|
|
4
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
5
|
+
import { useSizeProp } from '../../../hooks/use-size/index.mjs';
|
|
6
|
+
import { useEmptyValuesProps } from '../../../hooks/use-empty-values/index.mjs';
|
|
14
7
|
|
|
15
|
-
const
|
|
16
|
-
|
|
8
|
+
const timeSelectProps = buildProps({
|
|
9
|
+
format: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "HH:mm"
|
|
12
|
+
},
|
|
13
|
+
modelValue: String,
|
|
14
|
+
disabled: Boolean,
|
|
15
|
+
editable: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true
|
|
18
|
+
},
|
|
19
|
+
effect: {
|
|
20
|
+
type: definePropType(String),
|
|
21
|
+
default: "light"
|
|
22
|
+
},
|
|
23
|
+
clearable: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true
|
|
26
|
+
},
|
|
27
|
+
size: useSizeProp,
|
|
28
|
+
placeholder: String,
|
|
29
|
+
start: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "09:00"
|
|
32
|
+
},
|
|
33
|
+
end: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "18:00"
|
|
36
|
+
},
|
|
37
|
+
step: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "00:30"
|
|
40
|
+
},
|
|
41
|
+
minTime: String,
|
|
42
|
+
maxTime: String,
|
|
43
|
+
name: String,
|
|
44
|
+
prefixIcon: {
|
|
45
|
+
type: definePropType([String, Object]),
|
|
46
|
+
default: () => Clock
|
|
47
|
+
},
|
|
48
|
+
clearIcon: {
|
|
49
|
+
type: definePropType([String, Object]),
|
|
50
|
+
default: () => CircleClose
|
|
51
|
+
},
|
|
52
|
+
...useEmptyValuesProps
|
|
17
53
|
});
|
|
18
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
|
-
...__default__,
|
|
20
|
-
props: timeSelectProps,
|
|
21
|
-
emits: ["change", "blur", "focus", "clear", "update:modelValue"],
|
|
22
|
-
setup(__props, { expose }) {
|
|
23
|
-
const props = __props;
|
|
24
|
-
dayjs.extend(customParseFormat);
|
|
25
|
-
const { Option: ElOption } = ElSelect;
|
|
26
|
-
const nsInput = useNamespace("input");
|
|
27
|
-
const select = ref();
|
|
28
|
-
const _disabled = useFormDisabled();
|
|
29
|
-
const { lang } = useLocale();
|
|
30
|
-
const value = computed(() => props.modelValue);
|
|
31
|
-
const start = computed(() => {
|
|
32
|
-
const time = parseTime(props.start);
|
|
33
|
-
return time ? formatTime(time) : null;
|
|
34
|
-
});
|
|
35
|
-
const end = computed(() => {
|
|
36
|
-
const time = parseTime(props.end);
|
|
37
|
-
return time ? formatTime(time) : null;
|
|
38
|
-
});
|
|
39
|
-
const step = computed(() => {
|
|
40
|
-
const time = parseTime(props.step);
|
|
41
|
-
return time ? formatTime(time) : null;
|
|
42
|
-
});
|
|
43
|
-
const minTime = computed(() => {
|
|
44
|
-
const time = parseTime(props.minTime || "");
|
|
45
|
-
return time ? formatTime(time) : null;
|
|
46
|
-
});
|
|
47
|
-
const maxTime = computed(() => {
|
|
48
|
-
const time = parseTime(props.maxTime || "");
|
|
49
|
-
return time ? formatTime(time) : null;
|
|
50
|
-
});
|
|
51
|
-
const items = computed(() => {
|
|
52
|
-
const result = [];
|
|
53
|
-
if (props.start && props.end && props.step) {
|
|
54
|
-
let current = start.value;
|
|
55
|
-
let currentTime;
|
|
56
|
-
while (current && end.value && compareTime(current, end.value) <= 0) {
|
|
57
|
-
currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
|
|
58
|
-
result.push({
|
|
59
|
-
value: currentTime,
|
|
60
|
-
disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
|
|
61
|
-
});
|
|
62
|
-
current = nextTime(current, step.value);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return result;
|
|
66
|
-
});
|
|
67
|
-
const blur = () => {
|
|
68
|
-
var _a, _b;
|
|
69
|
-
(_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
|
|
70
|
-
};
|
|
71
|
-
const focus = () => {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
(_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
|
|
74
|
-
};
|
|
75
|
-
expose({
|
|
76
|
-
blur,
|
|
77
|
-
focus
|
|
78
|
-
});
|
|
79
|
-
return (_ctx, _cache) => {
|
|
80
|
-
return openBlock(), createBlock(unref(ElSelect), {
|
|
81
|
-
ref_key: "select",
|
|
82
|
-
ref: select,
|
|
83
|
-
"model-value": unref(value),
|
|
84
|
-
disabled: unref(_disabled),
|
|
85
|
-
clearable: _ctx.clearable,
|
|
86
|
-
"clear-icon": _ctx.clearIcon,
|
|
87
|
-
size: _ctx.size,
|
|
88
|
-
effect: _ctx.effect,
|
|
89
|
-
placeholder: _ctx.placeholder,
|
|
90
|
-
"default-first-option": "",
|
|
91
|
-
filterable: _ctx.editable,
|
|
92
|
-
"empty-values": _ctx.emptyValues,
|
|
93
|
-
"value-on-clear": _ctx.valueOnClear,
|
|
94
|
-
"onUpdate:modelValue": (event) => _ctx.$emit("update:modelValue", event),
|
|
95
|
-
onChange: (event) => _ctx.$emit("change", event),
|
|
96
|
-
onBlur: (event) => _ctx.$emit("blur", event),
|
|
97
|
-
onFocus: (event) => _ctx.$emit("focus", event),
|
|
98
|
-
onClear: () => _ctx.$emit("clear")
|
|
99
|
-
}, {
|
|
100
|
-
prefix: withCtx(() => [
|
|
101
|
-
_ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
|
|
102
|
-
key: 0,
|
|
103
|
-
class: normalizeClass(unref(nsInput).e("prefix-icon"))
|
|
104
|
-
}, {
|
|
105
|
-
default: withCtx(() => [
|
|
106
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
|
|
107
|
-
]),
|
|
108
|
-
_: 1
|
|
109
|
-
}, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
110
|
-
]),
|
|
111
|
-
default: withCtx(() => [
|
|
112
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
|
|
113
|
-
return openBlock(), createBlock(unref(ElOption), {
|
|
114
|
-
key: item.value,
|
|
115
|
-
label: item.value,
|
|
116
|
-
value: item.value,
|
|
117
|
-
disabled: item.disabled
|
|
118
|
-
}, null, 8, ["label", "value", "disabled"]);
|
|
119
|
-
}), 128))
|
|
120
|
-
]),
|
|
121
|
-
_: 1
|
|
122
|
-
}, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear", "onUpdate:modelValue", "onChange", "onBlur", "onFocus", "onClear"]);
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "time-select.vue"]]);
|
|
127
54
|
|
|
128
|
-
export {
|
|
55
|
+
export { timeSelectProps };
|
|
129
56
|
//# sourceMappingURL=time-select.mjs.map
|