@element-plus/nightly 0.0.20220114 → 0.0.20220115
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 +2330 -981
- package/dist/index.full.min.js +11 -9
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +12 -10
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +2330 -982
- package/es/components/button/index.d.ts +31 -2
- package/es/components/button/src/button-group.vue.d.ts +11 -1
- package/es/components/button/src/button-group.vue_vue_type_script_lang.mjs +6 -0
- package/es/components/button/src/button-group.vue_vue_type_script_lang.mjs.map +1 -1
- package/es/components/button/src/button-group.vue_vue_type_template_id_1bab7d77_lang.mjs +5 -4
- package/es/components/button/src/button-group.vue_vue_type_template_id_1bab7d77_lang.mjs.map +1 -1
- package/es/components/button/src/button.vue.d.ts +9 -0
- package/es/components/button/src/button.vue_vue_type_script_lang.mjs +4 -1
- package/es/components/button/src/button.vue_vue_type_script_lang.mjs.map +1 -1
- package/es/components/button/src/button.vue_vue_type_template_id_802c5c76_lang.mjs +4 -4
- package/es/components/button/src/button.vue_vue_type_template_id_802c5c76_lang.mjs.map +1 -1
- package/es/components/config-provider/index.d.ts +6 -1
- package/es/components/config-provider/src/config-provider.d.ts +7 -1
- package/es/components/config-provider/src/config-provider.mjs +4 -0
- package/es/components/config-provider/src/config-provider.mjs.map +1 -1
- package/es/defaults.d.ts +4 -1
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.mjs +1 -0
- package/es/hooks/index.mjs.map +1 -1
- package/es/hooks/use-global-config/index.d.ts +4 -1
- package/es/hooks/use-namespace/index.d.ts +9 -0
- package/es/hooks/use-namespace/index.mjs +38 -0
- package/es/hooks/use-namespace/index.mjs.map +1 -0
- package/es/index.d.ts +4 -1
- package/es/index.mjs +1 -0
- package/es/index.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/button/index.d.ts +31 -2
- package/lib/components/button/src/button-group.vue.d.ts +11 -1
- package/lib/components/button/src/button-group.vue_vue_type_script_lang.js +6 -0
- package/lib/components/button/src/button-group.vue_vue_type_script_lang.js.map +1 -1
- package/lib/components/button/src/button-group.vue_vue_type_template_id_1bab7d77_lang.js +4 -3
- package/lib/components/button/src/button-group.vue_vue_type_template_id_1bab7d77_lang.js.map +1 -1
- package/lib/components/button/src/button.vue.d.ts +9 -0
- package/lib/components/button/src/button.vue_vue_type_script_lang.js +9 -6
- package/lib/components/button/src/button.vue_vue_type_script_lang.js.map +1 -1
- package/lib/components/button/src/button.vue_vue_type_template_id_802c5c76_lang.js +4 -4
- package/lib/components/button/src/button.vue_vue_type_template_id_802c5c76_lang.js.map +1 -1
- package/lib/components/config-provider/index.d.ts +6 -1
- package/lib/components/config-provider/src/config-provider.d.ts +7 -1
- package/lib/components/config-provider/src/config-provider.js +4 -0
- package/lib/components/config-provider/src/config-provider.js.map +1 -1
- package/lib/defaults.d.ts +4 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-global-config/index.d.ts +4 -1
- package/lib/hooks/use-namespace/index.d.ts +9 -0
- package/lib/hooks/use-namespace/index.js +46 -0
- package/lib/hooks/use-namespace/index.js.map +1 -0
- package/lib/index.d.ts +4 -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
|
@@ -19,6 +19,15 @@ export declare const ElButton: import("../../utils/types").SFCWithInstall<import
|
|
|
19
19
|
buttonDisabled: import("vue").ComputedRef<boolean>;
|
|
20
20
|
shouldAddSpace: import("vue").ComputedRef<boolean>;
|
|
21
21
|
handleClick: (evt: MouseEvent) => void;
|
|
22
|
+
ns: {
|
|
23
|
+
namespace: import("vue").ComputedRef<string>;
|
|
24
|
+
b: (blockSuffix?: string) => string;
|
|
25
|
+
e: (element?: string | undefined) => string;
|
|
26
|
+
m: (modifier?: string | undefined) => string;
|
|
27
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
28
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
29
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
30
|
+
};
|
|
22
31
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
32
|
click: (evt: MouseEvent) => boolean;
|
|
24
33
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -66,7 +75,17 @@ export declare const ElButton: import("../../utils/types").SFCWithInstall<import
|
|
|
66
75
|
ButtonGroup: import("vue").DefineComponent<{
|
|
67
76
|
readonly size: import("../../utils/props").BuildPropReturn<StringConstructor, "", false, "" | "small" | "default" | "large", never>;
|
|
68
77
|
readonly type: import("../../utils/props").BuildPropReturn<StringConstructor, "", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
69
|
-
},
|
|
78
|
+
}, {
|
|
79
|
+
ns: {
|
|
80
|
+
namespace: import("vue").ComputedRef<string>;
|
|
81
|
+
b: (blockSuffix?: string) => string;
|
|
82
|
+
e: (element?: string | undefined) => string;
|
|
83
|
+
m: (modifier?: string | undefined) => string;
|
|
84
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
85
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
86
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
87
|
+
};
|
|
88
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
70
89
|
readonly size?: unknown;
|
|
71
90
|
readonly type?: unknown;
|
|
72
91
|
} & {
|
|
@@ -80,7 +99,17 @@ export declare const ElButton: import("../../utils/types").SFCWithInstall<import
|
|
|
80
99
|
export declare const ElButtonGroup: import("../../utils/types").SFCWithInstall<import("vue").DefineComponent<{
|
|
81
100
|
readonly size: import("../../utils/props").BuildPropReturn<StringConstructor, "", false, "" | "small" | "default" | "large", never>;
|
|
82
101
|
readonly type: import("../../utils/props").BuildPropReturn<StringConstructor, "", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
83
|
-
},
|
|
102
|
+
}, {
|
|
103
|
+
ns: {
|
|
104
|
+
namespace: import("vue").ComputedRef<string>;
|
|
105
|
+
b: (blockSuffix?: string) => string;
|
|
106
|
+
e: (element?: string | undefined) => string;
|
|
107
|
+
m: (modifier?: string | undefined) => string;
|
|
108
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
109
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
110
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
111
|
+
};
|
|
112
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
84
113
|
readonly size?: unknown;
|
|
85
114
|
readonly type?: unknown;
|
|
86
115
|
} & {
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{
|
|
2
2
|
readonly size: import("../../../utils/props").BuildPropReturn<StringConstructor, "", false, "" | "small" | "default" | "large", never>;
|
|
3
3
|
readonly type: import("../../../utils/props").BuildPropReturn<StringConstructor, "", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
4
|
-
},
|
|
4
|
+
}, {
|
|
5
|
+
ns: {
|
|
6
|
+
namespace: import("vue").ComputedRef<string>;
|
|
7
|
+
b: (blockSuffix?: string) => string;
|
|
8
|
+
e: (element?: string | undefined) => string;
|
|
9
|
+
m: (modifier?: string | undefined) => string;
|
|
10
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
11
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
12
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
13
|
+
};
|
|
14
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
5
15
|
readonly size?: unknown;
|
|
6
16
|
readonly type?: unknown;
|
|
7
17
|
} & {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { defineComponent, provide, reactive, toRef } from 'vue';
|
|
2
2
|
import '../../../tokens/index.mjs';
|
|
3
|
+
import '../../../hooks/index.mjs';
|
|
3
4
|
import { buttonGroupProps } from './button-group.mjs';
|
|
4
5
|
import { buttonGroupContextKey } from '../../../tokens/button.mjs';
|
|
6
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
5
7
|
|
|
6
8
|
var script = defineComponent({
|
|
7
9
|
name: "ElButtonGroup",
|
|
@@ -11,6 +13,10 @@ var script = defineComponent({
|
|
|
11
13
|
size: toRef(props, "size"),
|
|
12
14
|
type: toRef(props, "type")
|
|
13
15
|
}));
|
|
16
|
+
const ns = useNamespace("button");
|
|
17
|
+
return {
|
|
18
|
+
ns
|
|
19
|
+
};
|
|
14
20
|
}
|
|
15
21
|
});
|
|
16
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.vue_vue_type_script_lang.mjs","sources":["../../../../../../packages/components/button/src/button-group.vue"],"sourcesContent":["<template>\n <div class=\"
|
|
1
|
+
{"version":3,"file":"button-group.vue_vue_type_script_lang.mjs","sources":["../../../../../../packages/components/button/src/button-group.vue"],"sourcesContent":["<template>\n <div :class=\"`${ns.b('group')}`\">\n <slot></slot>\n </div>\n</template>\n<script lang=\"ts\">\nimport { defineComponent, provide, reactive, toRef } from 'vue'\nimport { buttonGroupContextKey } from '@element-plus/tokens'\nimport { useNamespace } from '@element-plus/hooks'\nimport { buttonGroupProps } from './button-group'\n\nexport default defineComponent({\n name: 'ElButtonGroup',\n props: buttonGroupProps,\n\n setup(props) {\n provide(\n buttonGroupContextKey,\n reactive({\n size: toRef(props, 'size'),\n type: toRef(props, 'type'),\n })\n )\n const ns = useNamespace('button')\n return {\n ns,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;AASA,aAAe,eAAe,CAAC;;AAE/B,EAAE,KAAK,EAAE,gBAAgB;EACvB,MAAM,KAAK,EAAE;IACX,OAAO,CAAC;;MAEN,IAAI,EAAE;KACP,CAAC,CAAC,CAAC;UACE,EAAE,GAAG,YAAY;WAChB;QACH;;;;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { openBlock, createElementBlock, renderSlot } from 'vue';
|
|
1
|
+
import { openBlock, createElementBlock, normalizeClass, renderSlot } from 'vue';
|
|
2
2
|
|
|
3
|
-
const _hoisted_1 = { class: "el-button-group" };
|
|
4
3
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5
|
-
return openBlock(), createElementBlock("div",
|
|
4
|
+
return openBlock(), createElementBlock("div", {
|
|
5
|
+
class: normalizeClass(`${_ctx.ns.b("group")}`)
|
|
6
|
+
}, [
|
|
6
7
|
renderSlot(_ctx.$slots, "default")
|
|
7
|
-
]);
|
|
8
|
+
], 2);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export { render };
|
package/es/components/button/src/button-group.vue_vue_type_template_id_1bab7d77_lang.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.vue_vue_type_template_id_1bab7d77_lang.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"button-group.vue_vue_type_template_id_1bab7d77_lang.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -19,6 +19,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
19
19
|
buttonDisabled: import("vue").ComputedRef<boolean>;
|
|
20
20
|
shouldAddSpace: import("vue").ComputedRef<boolean>;
|
|
21
21
|
handleClick: (evt: MouseEvent) => void;
|
|
22
|
+
ns: {
|
|
23
|
+
namespace: import("vue").ComputedRef<string>;
|
|
24
|
+
b: (blockSuffix?: string) => string;
|
|
25
|
+
e: (element?: string | undefined) => string;
|
|
26
|
+
m: (modifier?: string | undefined) => string;
|
|
27
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
28
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
29
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
30
|
+
};
|
|
22
31
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
32
|
click: (evt: MouseEvent) => boolean;
|
|
24
33
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -8,6 +8,7 @@ import { Loading } from '@element-plus/icons-vue';
|
|
|
8
8
|
import { buttonProps, buttonEmits } from './button.mjs';
|
|
9
9
|
import { buttonGroupContextKey } from '../../../tokens/button.mjs';
|
|
10
10
|
import { useGlobalConfig } from '../../../hooks/use-global-config/index.mjs';
|
|
11
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
11
12
|
import { useFormItem } from '../../../hooks/use-form-item/index.mjs';
|
|
12
13
|
import { useSize, useDisabled } from '../../../hooks/use-common-props/index.mjs';
|
|
13
14
|
|
|
@@ -23,6 +24,7 @@ var script = defineComponent({
|
|
|
23
24
|
const buttonRef = ref();
|
|
24
25
|
const buttonGroupContext = inject(buttonGroupContextKey, void 0);
|
|
25
26
|
const globalConfig = useGlobalConfig("button");
|
|
27
|
+
const ns = useNamespace("button");
|
|
26
28
|
const autoInsertSpace = computed(() => {
|
|
27
29
|
var _a, _b, _c;
|
|
28
30
|
return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
|
|
@@ -92,7 +94,8 @@ var script = defineComponent({
|
|
|
92
94
|
buttonType,
|
|
93
95
|
buttonDisabled,
|
|
94
96
|
shouldAddSpace,
|
|
95
|
-
handleClick
|
|
97
|
+
handleClick,
|
|
98
|
+
ns
|
|
96
99
|
};
|
|
97
100
|
}
|
|
98
101
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.vue_vue_type_script_lang.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n <button\n ref=\"buttonRef\"\n :class=\"[\n
|
|
1
|
+
{"version":3,"file":"button.vue_vue_type_script_lang.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n <button\n ref=\"buttonRef\"\n :class=\"[\n `${ns.b()}`,\n `${ns.m(buttonType)}`,\n `${ns.m(buttonSize)}`,\n {\n 'is-disabled': buttonDisabled,\n 'is-loading': loading,\n 'is-plain': plain,\n 'is-round': round,\n 'is-circle': circle,\n },\n ]\"\n :disabled=\"buttonDisabled || loading\"\n :autofocus=\"autofocus\"\n :type=\"nativeType\"\n :style=\"buttonStyle\"\n @click=\"handleClick\"\n >\n <el-icon v-if=\"loading\" class=\"is-loading\">\n <loading />\n </el-icon>\n <el-icon v-else-if=\"icon\">\n <component :is=\"icon\" />\n </el-icon>\n <span\n v-if=\"$slots.default\"\n :class=\"[shouldAddSpace ? `${ns.em('text', 'expand')}` : '']\"\n >\n <slot></slot>\n </span>\n </button>\n</template>\n\n<script lang=\"ts\">\nimport { computed, inject, defineComponent, Text, ref } from 'vue'\nimport { useCssVar } from '@vueuse/core'\nimport { TinyColor } from '@ctrl/tinycolor'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n useDisabled,\n useFormItem,\n useGlobalConfig,\n useNamespace,\n useSize,\n} from '@element-plus/hooks'\nimport { buttonGroupContextKey } from '@element-plus/tokens'\nimport { Loading } from '@element-plus/icons-vue'\n\nimport { buttonEmits, buttonProps } from './button'\n\nexport default defineComponent({\n name: 'ElButton',\n\n components: {\n ElIcon,\n Loading,\n },\n\n props: buttonProps,\n emits: buttonEmits,\n\n setup(props, { emit, slots }) {\n const buttonRef = ref()\n const buttonGroupContext = inject(buttonGroupContextKey, undefined)\n const globalConfig = useGlobalConfig('button')\n const ns = useNamespace('button')\n const autoInsertSpace = computed(\n () =>\n props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false\n )\n\n // add space between two characters in Chinese\n const shouldAddSpace = computed(() => {\n const defaultSlot = slots.default?.()\n if (autoInsertSpace.value && defaultSlot?.length === 1) {\n const slot = defaultSlot[0]\n if (slot?.type === Text) {\n const text = slot.children\n return /^\\p{Unified_Ideograph}{2}$/u.test(text as string)\n }\n }\n return false\n })\n\n const { form } = useFormItem()\n const buttonSize = useSize(computed(() => buttonGroupContext?.size))\n const buttonDisabled = useDisabled()\n const buttonType = computed(\n () => props.type || buttonGroupContext?.type || ''\n )\n\n // calculate hover & active color by color\n const typeColor = computed(\n () => useCssVar(`--el-color-${props.type}`).value\n )\n const buttonStyle = computed(() => {\n let styles = {}\n\n const buttonColor = props.color || typeColor.value\n\n if (buttonColor) {\n const shadeBgColor = new TinyColor(buttonColor).shade(10).toString()\n if (props.plain) {\n styles = {\n '--el-button-bg-color': new TinyColor(buttonColor)\n .tint(90)\n .toString(),\n '--el-button-text-color': buttonColor,\n '--el-button-hover-text-color': 'var(--el-color-white)',\n '--el-button-hover-bg-color': buttonColor,\n '--el-button-hover-border-color': buttonColor,\n '--el-button-active-bg-color': shadeBgColor,\n '--el-button-active-text-color': 'var(--el-color-white)',\n '--el-button-active-border-color': shadeBgColor,\n }\n } else {\n const tintBgColor = new TinyColor(buttonColor).tint(20).toString()\n styles = {\n '--el-button-bg-color': buttonColor,\n '--el-button-border-color': buttonColor,\n '--el-button-hover-bg-color': tintBgColor,\n '--el-button-hover-border-color': tintBgColor,\n '--el-button-active-bg-color': shadeBgColor,\n '--el-button-active-border-color': shadeBgColor,\n }\n }\n\n if (buttonDisabled.value) {\n const disabledButtonColor = new TinyColor(buttonColor)\n .tint(50)\n .toString()\n styles['--el-button-disabled-bg-color'] = disabledButtonColor\n styles['--el-button-disabled-border-color'] = disabledButtonColor\n }\n }\n\n return styles\n })\n\n const handleClick = (evt: MouseEvent) => {\n if (props.nativeType === 'reset') {\n form?.resetFields()\n }\n emit('click', evt)\n }\n\n return {\n buttonRef,\n buttonStyle,\n\n buttonSize,\n buttonType,\n buttonDisabled,\n\n shouldAddSpace,\n\n handleClick,\n\n ns,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAmDA,EAAE,gBAAgB;;AAElB,IAAI,MAAM;IACN,OAAO;;EAET,KAAK,EAAE;OACF,EAAE;OACF,CAAC;;;IAGJ,MAAM;IACN,MAAM,EAAE,GAAG;;MAET,IAAI,EAAE,MAAM,EAAE,CAAC;MACf,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG;KACpB,CAAC,CAAC;IACH,MAAM,iBAAiB,QAAQ,CAAC,MAAM;MACpC,IAAI,GAAG;MACP,MAAM,WAAW,GAAG,GAAG,GAAG;MAC1B,IAAI;QACF,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC;;;iBAGnB,6BAA6B,CAAC;;OAExC;MACD,OAAO,KAAK,CAAC;;YAEP,IAAI,EAAE,GAAG;UACX,aAAa,OAAO,CAAC;UACrB,cAAc,GAAG,WAAW,EAAE,CAAC;;;UAG/B;;;MAGJ,IAAI,WAAW,EAAE;QACf,MAAM,YAAY,GAAG,IAAI,UAAU,WAAW,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1D,IAAI,KAAK,CAAC,KAAK,EAAE;UACf,MAAM,GAAG;YACP,sBAAsB,EAAE,IAAI,SAAS;;;YAGrC,8BAA8B;YAC9B;YACA,6BAA6B,EAAE;;YAE/B;WACD,CAAC;;UAEF,MAAM,WAAW,GAAG,IAAI,SAAS,CAAC,WAAW;;YAE3C;YACA,0BAA0B,EAAE,WAAW;YACvC;YACA;YACA,6BAA6B,EAAE,YAAY;;;;YAI3C,cAAc,CAAC,KAAK,EAAE;gBAClB,mBAAmB,GAAG,IAAI,SAAS,CAAC;gBACpC,CAAC,+BAA+B,CAAC,GAAG;gBACpC,CAAC,mCAAmC,CAAC;;;;;UAK3C,WAAW,GAAG,CAAC,GAAG;UAClB,KAAK;YACH,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC;;kBAEnB,EAAE,GAAG,CAAC,CAAC;;;eAGV;;;;oBAIK;oBACA;iBACH;;;;;;;;"}
|
|
@@ -7,9 +7,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
7
7
|
return openBlock(), createElementBlock("button", {
|
|
8
8
|
ref: "buttonRef",
|
|
9
9
|
class: normalizeClass([
|
|
10
|
-
|
|
11
|
-
_ctx.
|
|
12
|
-
_ctx.
|
|
10
|
+
`${_ctx.ns.b()}`,
|
|
11
|
+
`${_ctx.ns.m(_ctx.buttonType)}`,
|
|
12
|
+
`${_ctx.ns.m(_ctx.buttonSize)}`,
|
|
13
13
|
{
|
|
14
14
|
"is-disabled": _ctx.buttonDisabled,
|
|
15
15
|
"is-loading": _ctx.loading,
|
|
@@ -40,7 +40,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
40
40
|
})) : createCommentVNode("v-if", true),
|
|
41
41
|
_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
|
|
42
42
|
key: 2,
|
|
43
|
-
class: normalizeClass({ "
|
|
43
|
+
class: normalizeClass([_ctx.shouldAddSpace ? `${_ctx.ns.em("text", "expand")}` : ""])
|
|
44
44
|
}, [
|
|
45
45
|
renderSlot(_ctx.$slots, "default")
|
|
46
46
|
], 2)) : createCommentVNode("v-if", true)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.vue_vue_type_template_id_802c5c76_lang.mjs","sources":["../../../../../../packages/components/button/src/button.vue?vue&type=template&id=802c5c76&lang.js"],"sourcesContent":["<template>\n <button\n ref=\"buttonRef\"\n :class=\"[\n
|
|
1
|
+
{"version":3,"file":"button.vue_vue_type_template_id_802c5c76_lang.mjs","sources":["../../../../../../packages/components/button/src/button.vue?vue&type=template&id=802c5c76&lang.js"],"sourcesContent":["<template>\n <button\n ref=\"buttonRef\"\n :class=\"[\n `${ns.b()}`,\n `${ns.m(buttonType)}`,\n `${ns.m(buttonSize)}`,\n {\n 'is-disabled': buttonDisabled,\n 'is-loading': loading,\n 'is-plain': plain,\n 'is-round': round,\n 'is-circle': circle,\n },\n ]\"\n :disabled=\"buttonDisabled || loading\"\n :autofocus=\"autofocus\"\n :type=\"nativeType\"\n :style=\"buttonStyle\"\n @click=\"handleClick\"\n >\n <el-icon v-if=\"loading\" class=\"is-loading\">\n <loading />\n </el-icon>\n <el-icon v-else-if=\"icon\">\n <component :is=\"icon\" />\n </el-icon>\n <span\n v-if=\"$slots.default\"\n :class=\"[shouldAddSpace ? `${ns.em('text', 'expand')}` : '']\"\n >\n <slot></slot>\n </span>\n </button>\n</template>\n\n<script lang=\"ts\">\nimport { computed, inject, defineComponent, Text, ref } from 'vue'\nimport { useCssVar } from '@vueuse/core'\nimport { TinyColor } from '@ctrl/tinycolor'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n useDisabled,\n useFormItem,\n useGlobalConfig,\n useNamespace,\n useSize,\n} from '@element-plus/hooks'\nimport { buttonGroupContextKey } from '@element-plus/tokens'\nimport { Loading } from '@element-plus/icons-vue'\n\nimport { buttonEmits, buttonProps } from './button'\n\nexport default defineComponent({\n name: 'ElButton',\n\n components: {\n ElIcon,\n Loading,\n },\n\n props: buttonProps,\n emits: buttonEmits,\n\n setup(props, { emit, slots }) {\n const buttonRef = ref()\n const buttonGroupContext = inject(buttonGroupContextKey, undefined)\n const globalConfig = useGlobalConfig('button')\n const ns = useNamespace('button')\n const autoInsertSpace = computed(\n () =>\n props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false\n )\n\n // add space between two characters in Chinese\n const shouldAddSpace = computed(() => {\n const defaultSlot = slots.default?.()\n if (autoInsertSpace.value && defaultSlot?.length === 1) {\n const slot = defaultSlot[0]\n if (slot?.type === Text) {\n const text = slot.children\n return /^\\p{Unified_Ideograph}{2}$/u.test(text as string)\n }\n }\n return false\n })\n\n const { form } = useFormItem()\n const buttonSize = useSize(computed(() => buttonGroupContext?.size))\n const buttonDisabled = useDisabled()\n const buttonType = computed(\n () => props.type || buttonGroupContext?.type || ''\n )\n\n // calculate hover & active color by color\n const typeColor = computed(\n () => useCssVar(`--el-color-${props.type}`).value\n )\n const buttonStyle = computed(() => {\n let styles = {}\n\n const buttonColor = props.color || typeColor.value\n\n if (buttonColor) {\n const shadeBgColor = new TinyColor(buttonColor).shade(10).toString()\n if (props.plain) {\n styles = {\n '--el-button-bg-color': new TinyColor(buttonColor)\n .tint(90)\n .toString(),\n '--el-button-text-color': buttonColor,\n '--el-button-hover-text-color': 'var(--el-color-white)',\n '--el-button-hover-bg-color': buttonColor,\n '--el-button-hover-border-color': buttonColor,\n '--el-button-active-bg-color': shadeBgColor,\n '--el-button-active-text-color': 'var(--el-color-white)',\n '--el-button-active-border-color': shadeBgColor,\n }\n } else {\n const tintBgColor = new TinyColor(buttonColor).tint(20).toString()\n styles = {\n '--el-button-bg-color': buttonColor,\n '--el-button-border-color': buttonColor,\n '--el-button-hover-bg-color': tintBgColor,\n '--el-button-hover-border-color': tintBgColor,\n '--el-button-active-bg-color': shadeBgColor,\n '--el-button-active-border-color': shadeBgColor,\n }\n }\n\n if (buttonDisabled.value) {\n const disabledButtonColor = new TinyColor(buttonColor)\n .tint(50)\n .toString()\n styles['--el-button-disabled-bg-color'] = disabledButtonColor\n styles['--el-button-disabled-border-color'] = disabledButtonColor\n }\n }\n\n return styles\n })\n\n const handleClick = (evt: MouseEvent) => {\n if (props.nativeType === 'reset') {\n form?.resetFields()\n }\n emit('click', evt)\n }\n\n return {\n buttonRef,\n buttonStyle,\n\n buttonSize,\n buttonType,\n buttonDisabled,\n\n shouldAddSpace,\n\n handleClick,\n\n ns,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;OAEO,EAAC;SACE;;;;;;;;;;;;IAYL;IACA,SAAS;;IAET,KAAK;WACA;;KAES;sBAAf;;;;;;;;;;;;4BAIE;;;;;;;;;"}
|
|
@@ -4,6 +4,7 @@ export declare const ElConfigProvider: import("../../utils/types").SFCWithInstal
|
|
|
4
4
|
readonly button: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<import("..").ButtonConfigContext>, unknown, unknown, unknown, unknown>;
|
|
5
5
|
readonly message: import("../../utils/props").BuildPropReturn<import("../../utils/props").PropWrapper<import("..").MessageConfigContext>, unknown, unknown, unknown, unknown>;
|
|
6
6
|
readonly zIndex: import("../../utils/props").BuildPropReturn<NumberConstructor, unknown, unknown, unknown, unknown>;
|
|
7
|
+
readonly namespace: import("../../utils/props").BuildPropReturn<StringConstructor, "el", unknown, unknown, unknown>;
|
|
7
8
|
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
8
9
|
[key: string]: any;
|
|
9
10
|
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -12,7 +13,10 @@ export declare const ElConfigProvider: import("../../utils/types").SFCWithInstal
|
|
|
12
13
|
readonly button?: unknown;
|
|
13
14
|
readonly message?: unknown;
|
|
14
15
|
readonly zIndex?: unknown;
|
|
15
|
-
|
|
16
|
+
readonly namespace?: unknown;
|
|
17
|
+
} & {
|
|
18
|
+
namespace: string;
|
|
19
|
+
} & {
|
|
16
20
|
button?: import("..").ButtonConfigContext | undefined;
|
|
17
21
|
size?: import("../../utils/props").BuildPropType<StringConstructor, "small" | "default" | "large", unknown> | undefined;
|
|
18
22
|
locale?: import("../../locale").Language | undefined;
|
|
@@ -24,6 +28,7 @@ export declare const ElConfigProvider: import("../../utils/types").SFCWithInstal
|
|
|
24
28
|
locale: import("../../locale").Language;
|
|
25
29
|
message: import("..").MessageConfigContext;
|
|
26
30
|
zIndex: number;
|
|
31
|
+
namespace: string;
|
|
27
32
|
}>> & Record<string, any>;
|
|
28
33
|
export default ElConfigProvider;
|
|
29
34
|
export * from './src/config-provider';
|
|
@@ -8,6 +8,7 @@ export declare const configProviderProps: {
|
|
|
8
8
|
readonly button: import("element-plus/es/utils/props").BuildPropReturn<import("element-plus/es/utils/props").PropWrapper<ButtonConfigContext>, unknown, unknown, unknown, unknown>;
|
|
9
9
|
readonly message: import("element-plus/es/utils/props").BuildPropReturn<import("element-plus/es/utils/props").PropWrapper<MessageConfigContext>, unknown, unknown, unknown, unknown>;
|
|
10
10
|
readonly zIndex: import("element-plus/es/utils/props").BuildPropReturn<NumberConstructor, unknown, unknown, unknown, unknown>;
|
|
11
|
+
readonly namespace: import("element-plus/es/utils/props").BuildPropReturn<StringConstructor, "el", unknown, unknown, unknown>;
|
|
11
12
|
};
|
|
12
13
|
declare const _default: import("vue").DefineComponent<{
|
|
13
14
|
readonly locale: import("element-plus/es/utils/props").BuildPropReturn<import("element-plus/es/utils/props").PropWrapper<Language>, unknown, unknown, unknown, unknown>;
|
|
@@ -15,6 +16,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
15
16
|
readonly button: import("element-plus/es/utils/props").BuildPropReturn<import("element-plus/es/utils/props").PropWrapper<ButtonConfigContext>, unknown, unknown, unknown, unknown>;
|
|
16
17
|
readonly message: import("element-plus/es/utils/props").BuildPropReturn<import("element-plus/es/utils/props").PropWrapper<MessageConfigContext>, unknown, unknown, unknown, unknown>;
|
|
17
18
|
readonly zIndex: import("element-plus/es/utils/props").BuildPropReturn<NumberConstructor, unknown, unknown, unknown, unknown>;
|
|
19
|
+
readonly namespace: import("element-plus/es/utils/props").BuildPropReturn<StringConstructor, "el", unknown, unknown, unknown>;
|
|
18
20
|
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
19
21
|
[key: string]: any;
|
|
20
22
|
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -23,7 +25,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
23
25
|
readonly button?: unknown;
|
|
24
26
|
readonly message?: unknown;
|
|
25
27
|
readonly zIndex?: unknown;
|
|
26
|
-
|
|
28
|
+
readonly namespace?: unknown;
|
|
29
|
+
} & {
|
|
30
|
+
namespace: string;
|
|
31
|
+
} & {
|
|
27
32
|
button?: ButtonConfigContext | undefined;
|
|
28
33
|
size?: import("element-plus/es/utils/props").BuildPropType<StringConstructor, "small" | "default" | "large", unknown> | undefined;
|
|
29
34
|
locale?: Language | undefined;
|
|
@@ -35,5 +40,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
35
40
|
locale: Language;
|
|
36
41
|
message: MessageConfigContext;
|
|
37
42
|
zIndex: number;
|
|
43
|
+
namespace: string;
|
|
38
44
|
}>;
|
|
39
45
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-provider.mjs","sources":["../../../../../../packages/components/config-provider/src/config-provider.ts"],"sourcesContent":["import { defineComponent, renderSlot, watch } from 'vue'\nimport { buildProps, definePropType } from '@element-plus/utils/props'\nimport { provideGlobalConfig } from '@element-plus/hooks'\nimport type { Language } from '@element-plus/locale'\nimport type { ButtonConfigContext } from '@element-plus/components/button'\nimport type { MessageConfigContext } from '@element-plus/components/message'\n\nexport const messageConfig: MessageConfigContext = {}\n\nexport const configProviderProps = buildProps({\n locale: {\n type: definePropType<Language>(Object),\n },\n\n size: {\n type: String,\n values: ['large', 'default', 'small'],\n },\n\n button: {\n type: definePropType<ButtonConfigContext>(Object),\n },\n\n message: {\n type: definePropType<MessageConfigContext>(Object),\n },\n\n zIndex: {\n type: Number,\n },\n} as const)\n\nexport default defineComponent({\n name: 'ElConfigProvider',\n props: configProviderProps,\n\n setup(props, { slots }) {\n watch(\n () => props.message,\n (val) => {\n Object.assign(messageConfig, val ?? {})\n },\n { immediate: true, deep: true }\n )\n const config = provideGlobalConfig(props)\n return () => renderSlot(slots, 'default', { config: config?.value })\n },\n})\n"],"names":[],"mappings":";;;;;AAGY,MAAC,aAAa,GAAG,GAAG;AACpB,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC;AACzC,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,CAAC,EAAE;AACH,qBAAe,eAAe,CAAC;AAC/B,EAAE,IAAI,EAAE,kBAAkB;AAC1B,EAAE,KAAK,EAAE,mBAAmB;AAC5B,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE;AAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK;AACxC,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC;AAC3D,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACxC,IAAI,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAC9C,IAAI,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAClG,GAAG;AACH,CAAC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"config-provider.mjs","sources":["../../../../../../packages/components/config-provider/src/config-provider.ts"],"sourcesContent":["import { defineComponent, renderSlot, watch } from 'vue'\nimport { buildProps, definePropType } from '@element-plus/utils/props'\nimport { provideGlobalConfig } from '@element-plus/hooks'\nimport type { Language } from '@element-plus/locale'\nimport type { ButtonConfigContext } from '@element-plus/components/button'\nimport type { MessageConfigContext } from '@element-plus/components/message'\n\nexport const messageConfig: MessageConfigContext = {}\n\nexport const configProviderProps = buildProps({\n locale: {\n type: definePropType<Language>(Object),\n },\n\n size: {\n type: String,\n values: ['large', 'default', 'small'],\n },\n\n button: {\n type: definePropType<ButtonConfigContext>(Object),\n },\n\n message: {\n type: definePropType<MessageConfigContext>(Object),\n },\n\n zIndex: {\n type: Number,\n },\n\n namespace: {\n type: String,\n default: 'el',\n },\n} as const)\n\nexport default defineComponent({\n name: 'ElConfigProvider',\n props: configProviderProps,\n\n setup(props, { slots }) {\n watch(\n () => props.message,\n (val) => {\n Object.assign(messageConfig, val ?? {})\n },\n { immediate: true, deep: true }\n )\n const config = provideGlobalConfig(props)\n return () => renderSlot(slots, 'default', { config: config?.value })\n },\n})\n"],"names":[],"mappings":";;;;;AAGY,MAAC,aAAa,GAAG,GAAG;AACpB,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC;AACzC,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACH,qBAAe,eAAe,CAAC;AAC/B,EAAE,IAAI,EAAE,kBAAkB;AAC1B,EAAE,KAAK,EAAE,mBAAmB;AAC5B,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE;AAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK;AACxC,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,IAAI,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC;AAC3D,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACxC,IAAI,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAC9C,IAAI,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAClG,GAAG;AACH,CAAC,CAAC;;;;"}
|
package/es/defaults.d.ts
CHANGED
|
@@ -6,7 +6,10 @@ declare const _default: {
|
|
|
6
6
|
readonly button?: unknown;
|
|
7
7
|
readonly message?: unknown;
|
|
8
8
|
readonly zIndex?: unknown;
|
|
9
|
-
|
|
9
|
+
readonly namespace?: unknown;
|
|
10
|
+
} & {
|
|
11
|
+
namespace: string;
|
|
12
|
+
} & {
|
|
10
13
|
button?: import("./components").ButtonConfigContext | undefined;
|
|
11
14
|
size?: import("./utils/props").BuildPropType<StringConstructor, "small" | "default" | "large", unknown> | undefined;
|
|
12
15
|
locale?: import("./locale").Language | undefined;
|
package/es/hooks/index.d.ts
CHANGED
package/es/hooks/index.mjs
CHANGED
|
@@ -21,4 +21,5 @@ export { POPPER_CONTAINER_ID, POPPER_CONTAINER_SELECTOR, usePopperContainer } fr
|
|
|
21
21
|
export { useDelayedRender } from './use-intermediate-render/index.mjs';
|
|
22
22
|
export { useDelayedToggle, useDelayedToggleProps } from './use-delayed-toggle/index.mjs';
|
|
23
23
|
export { FORWARD_REF_INJECTION_KEY, useForwardRef, useForwardRefDirective } from './use-forward-ref/index.mjs';
|
|
24
|
+
export { useNamespace } from './use-namespace/index.mjs';
|
|
24
25
|
//# sourceMappingURL=index.mjs.map
|
package/es/hooks/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -9,7 +9,10 @@ export declare const provideGlobalConfig: (config: MaybeRef<ConfigProviderContex
|
|
|
9
9
|
readonly button?: unknown;
|
|
10
10
|
readonly message?: unknown;
|
|
11
11
|
readonly zIndex?: unknown;
|
|
12
|
-
|
|
12
|
+
readonly namespace?: unknown;
|
|
13
|
+
} & {
|
|
14
|
+
namespace: string;
|
|
15
|
+
} & {
|
|
13
16
|
button?: import("../..").ButtonConfigContext | undefined;
|
|
14
17
|
size?: import("../../utils/props").BuildPropType<StringConstructor, "small" | "default" | "large", unknown> | undefined;
|
|
15
18
|
locale?: import("../../locale").Language | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const useNamespace: (block: string) => {
|
|
2
|
+
namespace: import("vue").ComputedRef<string>;
|
|
3
|
+
b: (blockSuffix?: string) => string;
|
|
4
|
+
e: (element?: string | undefined) => string;
|
|
5
|
+
m: (modifier?: string | undefined) => string;
|
|
6
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
7
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
8
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { computed, unref } from 'vue';
|
|
2
|
+
import curry from 'lodash/curry';
|
|
3
|
+
import { useGlobalConfig } from '../use-global-config/index.mjs';
|
|
4
|
+
|
|
5
|
+
const curryBem = curry((namespace, block, blockSuffix, element, modifier) => {
|
|
6
|
+
let cls = `${namespace}-${block}`;
|
|
7
|
+
if (blockSuffix) {
|
|
8
|
+
cls += `-${blockSuffix}`;
|
|
9
|
+
}
|
|
10
|
+
if (element) {
|
|
11
|
+
cls += `__${element}`;
|
|
12
|
+
}
|
|
13
|
+
if (modifier) {
|
|
14
|
+
cls += `--${modifier}`;
|
|
15
|
+
}
|
|
16
|
+
return cls;
|
|
17
|
+
});
|
|
18
|
+
const useNamespace = (block) => {
|
|
19
|
+
const namespace = computed(() => useGlobalConfig("namespace").value || "el");
|
|
20
|
+
const b = (blockSuffix = "") => curryBem(unref(namespace), block, blockSuffix, "", "");
|
|
21
|
+
const e = (element) => element ? curryBem(unref(namespace), block, "", element, "") : "";
|
|
22
|
+
const m = (modifier) => modifier ? curryBem(unref(namespace), block, "", "")(modifier) : "";
|
|
23
|
+
const be = (blockSuffix, element) => blockSuffix && element ? curryBem(unref(namespace), block, blockSuffix, element, "") : "";
|
|
24
|
+
const em = (element, modifier) => element && modifier ? curryBem(unref(namespace), block, "")(element, modifier) : "";
|
|
25
|
+
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? curryBem(unref(namespace), block)(blockSuffix, element, modifier) : "";
|
|
26
|
+
return {
|
|
27
|
+
namespace,
|
|
28
|
+
b,
|
|
29
|
+
e,
|
|
30
|
+
m,
|
|
31
|
+
be,
|
|
32
|
+
em,
|
|
33
|
+
bem
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { useNamespace };
|
|
38
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-namespace/index.ts"],"sourcesContent":["import { unref, computed } from 'vue'\nimport curry from 'lodash/curry'\nimport { useGlobalConfig } from '../use-global-config'\n\nconst curryBem = curry(\n (\n namespace: string,\n block: string,\n blockSuffix: string,\n element: string,\n modifier: string\n ) => {\n let cls = `${namespace}-${block}`\n if (blockSuffix) {\n cls += `-${blockSuffix}`\n }\n if (element) {\n cls += `__${element}`\n }\n if (modifier) {\n cls += `--${modifier}`\n }\n return cls\n }\n)\n\nexport const useNamespace = (block: string) => {\n const namespace = computed(() => useGlobalConfig('namespace').value || 'el')\n const b = (blockSuffix = '') =>\n curryBem(unref(namespace), block, blockSuffix, '', '')\n const e = (element?: string) =>\n element ? curryBem(unref(namespace), block, '', element, '') : ''\n const m = (modifier?: string) =>\n modifier ? curryBem(unref(namespace), block, '', '')(modifier) : ''\n const be = (blockSuffix?: string, element?: string) =>\n blockSuffix && element\n ? curryBem(unref(namespace), block, blockSuffix, element, '')\n : ''\n const em = (element?: string, modifier?: string) =>\n element && modifier\n ? curryBem(unref(namespace), block, '')(element, modifier)\n : ''\n const bem = (blockSuffix?: string, element?: string, modifier?: string) =>\n blockSuffix && element && modifier\n ? curryBem(unref(namespace), block)(blockSuffix, element, modifier)\n : ''\n return {\n namespace,\n b,\n e,\n m,\n be,\n em,\n bem,\n }\n}\n"],"names":[],"mappings":";;;;AAGA,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,KAAK;AAC7E,EAAE,IAAI,GAAG,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACpC,EAAE,IAAI,WAAW,EAAE;AACnB,IAAI,GAAG,IAAI,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;AAC7B,GAAG;AACH,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1B,GAAG;AACH,EAAE,IAAI,QAAQ,EAAE;AAChB,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC3B,GAAG;AACH,EAAE,OAAO,GAAG,CAAC;AACb,CAAC,CAAC,CAAC;AACS,MAAC,YAAY,GAAG,CAAC,KAAK,KAAK;AACvC,EAAE,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;AAC/E,EAAE,MAAM,CAAC,GAAG,CAAC,WAAW,GAAG,EAAE,KAAK,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACzF,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,KAAK,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;AAC3F,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;AAC9F,EAAE,MAAM,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,KAAK,WAAW,IAAI,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;AACjI,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,IAAI,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;AACxH,EAAE,MAAM,GAAG,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,KAAK,WAAW,IAAI,OAAO,IAAI,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;AAC9J,EAAE,OAAO;AACT,IAAI,SAAS;AACb,IAAI,CAAC;AACL,IAAI,CAAC;AACL,IAAI,CAAC;AACL,IAAI,EAAE;AACN,IAAI,EAAE;AACN,IAAI,GAAG;AACP,GAAG,CAAC;AACJ;;;;"}
|
package/es/index.d.ts
CHANGED
|
@@ -11,7 +11,10 @@ export declare const install: (app: import("vue").App<any>, options?: {
|
|
|
11
11
|
readonly button?: unknown;
|
|
12
12
|
readonly message?: unknown;
|
|
13
13
|
readonly zIndex?: unknown;
|
|
14
|
-
|
|
14
|
+
readonly namespace?: unknown;
|
|
15
|
+
} & {
|
|
16
|
+
namespace: string;
|
|
17
|
+
} & {
|
|
15
18
|
button?: import("element-plus/es/components").ButtonConfigContext | undefined;
|
|
16
19
|
size?: import("./utils/props").BuildPropType<StringConstructor, "small" | "default" | "large", unknown> | undefined;
|
|
17
20
|
locale?: import("./locale").Language | undefined;
|
package/es/index.mjs
CHANGED
|
@@ -180,6 +180,7 @@ export { POPPER_CONTAINER_ID, POPPER_CONTAINER_SELECTOR, usePopperContainer } fr
|
|
|
180
180
|
export { useDelayedRender } from './hooks/use-intermediate-render/index.mjs';
|
|
181
181
|
export { useDelayedToggle, useDelayedToggleProps } from './hooks/use-delayed-toggle/index.mjs';
|
|
182
182
|
export { FORWARD_REF_INJECTION_KEY, useForwardRef, useForwardRefDirective } from './hooks/use-forward-ref/index.mjs';
|
|
183
|
+
export { useNamespace } from './hooks/use-namespace/index.mjs';
|
|
183
184
|
export { elFormItemKey, elFormKey } from './tokens/form.mjs';
|
|
184
185
|
export { buttonGroupContextKey } from './tokens/button.mjs';
|
|
185
186
|
export { elBreadcrumbKey } from './tokens/breadcrumb.mjs';
|
package/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../packages/element-plus/index.ts"],"sourcesContent":["import installer from './defaults'\nexport * from '@element-plus/components'\nexport * from '@element-plus/directives'\nexport * from '@element-plus/hooks'\nexport * from '@element-plus/tokens'\nexport * from '@element-plus/utils/popup-manager'\nexport { makeInstaller } from './make-installer'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../packages/element-plus/index.ts"],"sourcesContent":["import installer from './defaults'\nexport * from '@element-plus/components'\nexport * from '@element-plus/directives'\nexport * from '@element-plus/hooks'\nexport * from '@element-plus/tokens'\nexport * from '@element-plus/utils/popup-manager'\nexport { makeInstaller } from './make-installer'\n\nexport const install = installer.install\nexport const version = installer.version\nexport default installer\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOY,MAAC,OAAO,GAAG,SAAS,CAAC,QAAQ;AAC7B,MAAC,OAAO,GAAG,SAAS,CAAC;;;;"}
|
package/es/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.20220115";
|
package/es/version.mjs
CHANGED
package/es/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20220115'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
|
|
@@ -19,6 +19,15 @@ export declare const ElButton: import("../../utils/types").SFCWithInstall<import
|
|
|
19
19
|
buttonDisabled: import("vue").ComputedRef<boolean>;
|
|
20
20
|
shouldAddSpace: import("vue").ComputedRef<boolean>;
|
|
21
21
|
handleClick: (evt: MouseEvent) => void;
|
|
22
|
+
ns: {
|
|
23
|
+
namespace: import("vue").ComputedRef<string>;
|
|
24
|
+
b: (blockSuffix?: string) => string;
|
|
25
|
+
e: (element?: string | undefined) => string;
|
|
26
|
+
m: (modifier?: string | undefined) => string;
|
|
27
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
28
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
29
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
30
|
+
};
|
|
22
31
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
32
|
click: (evt: MouseEvent) => boolean;
|
|
24
33
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -66,7 +75,17 @@ export declare const ElButton: import("../../utils/types").SFCWithInstall<import
|
|
|
66
75
|
ButtonGroup: import("vue").DefineComponent<{
|
|
67
76
|
readonly size: import("../../utils/props").BuildPropReturn<StringConstructor, "", false, "" | "small" | "default" | "large", never>;
|
|
68
77
|
readonly type: import("../../utils/props").BuildPropReturn<StringConstructor, "", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
69
|
-
},
|
|
78
|
+
}, {
|
|
79
|
+
ns: {
|
|
80
|
+
namespace: import("vue").ComputedRef<string>;
|
|
81
|
+
b: (blockSuffix?: string) => string;
|
|
82
|
+
e: (element?: string | undefined) => string;
|
|
83
|
+
m: (modifier?: string | undefined) => string;
|
|
84
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
85
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
86
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
87
|
+
};
|
|
88
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
70
89
|
readonly size?: unknown;
|
|
71
90
|
readonly type?: unknown;
|
|
72
91
|
} & {
|
|
@@ -80,7 +99,17 @@ export declare const ElButton: import("../../utils/types").SFCWithInstall<import
|
|
|
80
99
|
export declare const ElButtonGroup: import("../../utils/types").SFCWithInstall<import("vue").DefineComponent<{
|
|
81
100
|
readonly size: import("../../utils/props").BuildPropReturn<StringConstructor, "", false, "" | "small" | "default" | "large", never>;
|
|
82
101
|
readonly type: import("../../utils/props").BuildPropReturn<StringConstructor, "", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
83
|
-
},
|
|
102
|
+
}, {
|
|
103
|
+
ns: {
|
|
104
|
+
namespace: import("vue").ComputedRef<string>;
|
|
105
|
+
b: (blockSuffix?: string) => string;
|
|
106
|
+
e: (element?: string | undefined) => string;
|
|
107
|
+
m: (modifier?: string | undefined) => string;
|
|
108
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
109
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
110
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
111
|
+
};
|
|
112
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
84
113
|
readonly size?: unknown;
|
|
85
114
|
readonly type?: unknown;
|
|
86
115
|
} & {
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{
|
|
2
2
|
readonly size: import("../../../utils/props").BuildPropReturn<StringConstructor, "", false, "" | "small" | "default" | "large", never>;
|
|
3
3
|
readonly type: import("../../../utils/props").BuildPropReturn<StringConstructor, "", unknown, "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text", unknown>;
|
|
4
|
-
},
|
|
4
|
+
}, {
|
|
5
|
+
ns: {
|
|
6
|
+
namespace: import("vue").ComputedRef<string>;
|
|
7
|
+
b: (blockSuffix?: string) => string;
|
|
8
|
+
e: (element?: string | undefined) => string;
|
|
9
|
+
m: (modifier?: string | undefined) => string;
|
|
10
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
11
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
12
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
13
|
+
};
|
|
14
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
5
15
|
readonly size?: unknown;
|
|
6
16
|
readonly type?: unknown;
|
|
7
17
|
} & {
|
|
@@ -4,8 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var vue = require('vue');
|
|
6
6
|
require('../../../tokens/index.js');
|
|
7
|
+
require('../../../hooks/index.js');
|
|
7
8
|
var buttonGroup = require('./button-group.js');
|
|
8
9
|
var button = require('../../../tokens/button.js');
|
|
10
|
+
var index = require('../../../hooks/use-namespace/index.js');
|
|
9
11
|
|
|
10
12
|
var script = vue.defineComponent({
|
|
11
13
|
name: "ElButtonGroup",
|
|
@@ -15,6 +17,10 @@ var script = vue.defineComponent({
|
|
|
15
17
|
size: vue.toRef(props, "size"),
|
|
16
18
|
type: vue.toRef(props, "type")
|
|
17
19
|
}));
|
|
20
|
+
const ns = index.useNamespace("button");
|
|
21
|
+
return {
|
|
22
|
+
ns
|
|
23
|
+
};
|
|
18
24
|
}
|
|
19
25
|
});
|
|
20
26
|
|