first commit
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
import { SFCWithInstall } from "../../utils/vue/typescript.js";
|
||||
import "../../utils/index.js";
|
||||
import { TextProps, TextPropsPublic, textProps } from "./src/text.js";
|
||||
import { _default } from "./src/text.vue.js";
|
||||
|
||||
//#region ../../packages/components/text/index.d.ts
|
||||
declare const ElText: SFCWithInstall<typeof _default>;
|
||||
//#endregion
|
||||
export { ElText, ElText as default, TextProps, TextPropsPublic, textProps };
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
||||
const require_install = require('../../utils/vue/install.js');
|
||||
const require_text = require('./src/text.js');
|
||||
const require_text$1 = require('./src/text2.js');
|
||||
|
||||
//#region ../../packages/components/text/index.ts
|
||||
const ElText = require_install.withInstall(require_text$1.default);
|
||||
|
||||
//#endregion
|
||||
exports.ElText = ElText;
|
||||
exports.default = ElText;
|
||||
exports.textProps = require_text.textProps;
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["withInstall","Text"],"sources":["../../../../../packages/components/text/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Text from './src/text.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElText: SFCWithInstall<typeof Text> = withInstall(Text)\nexport default ElText\n\nexport * from './src/text'\n"],"mappings":";;;;;;AAKA,MAAa,SAAsCA,4BAAYC,uBAAK"}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
|
||||
import { ComponentSize } from "../../../constants/size.js";
|
||||
import "../../../utils/index.js";
|
||||
import * as vue from "vue";
|
||||
import { ExtractPublicPropTypes } from "vue";
|
||||
|
||||
//#region ../../packages/components/text/src/text.d.ts
|
||||
interface TextProps {
|
||||
/**
|
||||
* @description text type
|
||||
*/
|
||||
type?: 'primary' | 'success' | 'info' | 'warning' | 'danger' | '';
|
||||
/**
|
||||
* @description text size
|
||||
*/
|
||||
size?: ComponentSize;
|
||||
/**
|
||||
* @description render ellipsis
|
||||
*/
|
||||
truncated?: boolean;
|
||||
/**
|
||||
* @description maximum lines
|
||||
*/
|
||||
lineClamp?: number | string;
|
||||
/**
|
||||
* @description custom element tag
|
||||
*/
|
||||
tag?: string;
|
||||
}
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `TextProps` instead.
|
||||
*/
|
||||
declare const textProps: {
|
||||
readonly type: EpPropFinalized<StringConstructor, "" | "info" | "primary" | "success" | "warning" | "danger", unknown, "", boolean>;
|
||||
readonly size: EpPropFinalized<StringConstructor, "" | "default" | "large" | "small", unknown, "", boolean>;
|
||||
readonly truncated: BooleanConstructor;
|
||||
readonly lineClamp: {
|
||||
readonly type: vue.PropType<EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
||||
readonly required: false;
|
||||
readonly validator: ((val: unknown) => boolean) | undefined;
|
||||
__epPropKey: true;
|
||||
};
|
||||
readonly tag: EpPropFinalized<StringConstructor, unknown, unknown, "span", boolean>;
|
||||
};
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `TextProps` instead.
|
||||
*/
|
||||
type TextPropsPublic = ExtractPublicPropTypes<typeof textProps>;
|
||||
//#endregion
|
||||
export { TextProps, TextPropsPublic, textProps };
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
const require_size = require('../../../constants/size.js');
|
||||
const require_runtime = require('../../../utils/vue/props/runtime.js');
|
||||
|
||||
//#region ../../packages/components/text/src/text.ts
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `TextProps` instead.
|
||||
*/
|
||||
const textProps = require_runtime.buildProps({
|
||||
type: {
|
||||
type: String,
|
||||
values: [
|
||||
"primary",
|
||||
"success",
|
||||
"info",
|
||||
"warning",
|
||||
"danger",
|
||||
""
|
||||
],
|
||||
default: ""
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
values: require_size.componentSizes,
|
||||
default: ""
|
||||
},
|
||||
truncated: Boolean,
|
||||
lineClamp: { type: [String, Number] },
|
||||
tag: {
|
||||
type: String,
|
||||
default: "span"
|
||||
}
|
||||
});
|
||||
|
||||
//#endregion
|
||||
exports.textProps = textProps;
|
||||
//# sourceMappingURL=text.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"text.js","names":["buildProps","componentSizes"],"sources":["../../../../../../packages/components/text/src/text.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\n\nexport interface TextProps {\n /**\n * @description text type\n */\n type?: 'primary' | 'success' | 'info' | 'warning' | 'danger' | ''\n /**\n * @description text size\n */\n size?: ComponentSize\n /**\n * @description render ellipsis\n */\n truncated?: boolean\n /**\n * @description maximum lines\n */\n lineClamp?: number | string\n /**\n * @description custom element tag\n */\n tag?: string\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `TextProps` instead.\n */\nexport const textProps = buildProps({\n /**\n * @description text type\n */\n type: {\n type: String,\n values: ['primary', 'success', 'info', 'warning', 'danger', ''],\n default: '',\n },\n /**\n * @description text size\n */\n size: {\n type: String,\n values: componentSizes,\n default: '',\n },\n /**\n * @description render ellipsis\n */\n truncated: Boolean,\n /**\n * @description maximum lines\n */\n lineClamp: {\n type: [String, Number],\n },\n /**\n * @description custom element tag\n */\n tag: {\n type: String,\n default: 'span',\n },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `TextProps` instead.\n */\nexport type TextPropsPublic = ExtractPublicPropTypes<typeof textProps>\n"],"mappings":";;;;;;;;AAgCA,MAAa,YAAYA,2BAAW;CAIlC,MAAM;EACJ,MAAM;EACN,QAAQ;GAAC;GAAW;GAAW;GAAQ;GAAW;GAAU;GAAG;EAC/D,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,QAAQC;EACR,SAAS;EACV;CAID,WAAW;CAIX,WAAW,EACT,MAAM,CAAC,QAAQ,OAAO,EACvB;CAID,KAAK;EACH,MAAM;EACN,SAAS;EACV;CACF,CAAU"}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { ComponentSize } from "../../../constants/size.js";
|
||||
import { TextProps } from "./text.js";
|
||||
import "../../../index.js";
|
||||
import * as vue from "vue";
|
||||
|
||||
//#region ../../packages/components/text/src/text.vue.d.ts
|
||||
declare var __VLS_9: {};
|
||||
type __VLS_Slots = {} & {
|
||||
default?: (props: typeof __VLS_9) => any;
|
||||
};
|
||||
declare const __VLS_base: vue.DefineComponent<TextProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<TextProps> & Readonly<{}>, {
|
||||
type: "primary" | "success" | "info" | "warning" | "danger" | "";
|
||||
size: ComponentSize;
|
||||
tag: string;
|
||||
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
||||
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
||||
declare const _default: typeof __VLS_export;
|
||||
type __VLS_WithSlots<T, S> = T & {
|
||||
new (): {
|
||||
$slots: S;
|
||||
};
|
||||
};
|
||||
//#endregion
|
||||
export { _default };
|
||||
Generated
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
||||
const require_types = require('../../../utils/types.js');
|
||||
const require_index = require('../../../hooks/use-namespace/index.js');
|
||||
const require_use_form_common_props = require('../../form/src/hooks/use-form-common-props.js');
|
||||
const require_text = require('./text.js');
|
||||
let vue = require("vue");
|
||||
|
||||
//#region ../../packages/components/text/src/text.vue?vue&type=script&setup=true&lang.ts
|
||||
var text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
||||
name: "ElText",
|
||||
__name: "text",
|
||||
props: require_text.textProps,
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const textRef = (0, vue.ref)();
|
||||
const textSize = require_use_form_common_props.useFormSize();
|
||||
const ns = require_index.useNamespace("text");
|
||||
const textKls = (0, vue.computed)(() => [
|
||||
ns.b(),
|
||||
ns.m(props.type),
|
||||
ns.m(textSize.value),
|
||||
ns.is("truncated", props.truncated),
|
||||
ns.is("line-clamp", !require_types.isUndefined(props.lineClamp))
|
||||
]);
|
||||
const bindTitle = () => {
|
||||
if ((0, vue.useAttrs)().title) return;
|
||||
let shouldAddTitle = false;
|
||||
const text = textRef.value?.textContent || "";
|
||||
if (props.truncated) {
|
||||
const width = textRef.value?.offsetWidth;
|
||||
const scrollWidth = textRef.value?.scrollWidth;
|
||||
if (width && scrollWidth && scrollWidth > width) shouldAddTitle = true;
|
||||
} else if (!require_types.isUndefined(props.lineClamp)) {
|
||||
const height = textRef.value?.offsetHeight;
|
||||
const scrollHeight = textRef.value?.scrollHeight;
|
||||
if (height && scrollHeight && scrollHeight > height) shouldAddTitle = true;
|
||||
}
|
||||
if (shouldAddTitle) textRef.value?.setAttribute("title", text);
|
||||
else textRef.value?.removeAttribute("title");
|
||||
};
|
||||
(0, vue.onMounted)(bindTitle);
|
||||
(0, vue.onUpdated)(bindTitle);
|
||||
return (_ctx, _cache) => {
|
||||
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.tag), {
|
||||
ref_key: "textRef",
|
||||
ref: textRef,
|
||||
class: (0, vue.normalizeClass)(textKls.value),
|
||||
style: (0, vue.normalizeStyle)({ "-webkit-line-clamp": __props.lineClamp })
|
||||
}, {
|
||||
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
||||
_: 3
|
||||
}, 8, ["class", "style"]);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
//#endregion
|
||||
exports.default = text_vue_vue_type_script_setup_true_lang_default;
|
||||
//# sourceMappingURL=text.vue_vue_type_script_setup_true_lang.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"text.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/text/src/text.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n ref=\"textRef\"\n :class=\"textKls\"\n :style=\"{ '-webkit-line-clamp': lineClamp }\"\n >\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onMounted, onUpdated, ref, useAttrs } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useFormSize } from '@element-plus/components/form'\nimport { isUndefined } from '@element-plus/utils'\n\nimport type { TextProps } from './text'\n\ndefineOptions({\n name: 'ElText',\n})\n\nconst props = withDefaults(defineProps<TextProps>(), {\n type: '',\n size: '',\n tag: 'span',\n})\nconst textRef = ref<HTMLElement>()\n\nconst textSize = useFormSize()\nconst ns = useNamespace('text')\n\nconst textKls = computed(() => [\n ns.b(),\n ns.m(props.type),\n ns.m(textSize.value),\n ns.is('truncated', props.truncated),\n ns.is('line-clamp', !isUndefined(props.lineClamp)),\n])\n\nconst bindTitle = () => {\n const inheritTitle = useAttrs().title\n\n if (inheritTitle) return\n let shouldAddTitle = false\n const text = textRef.value?.textContent || ''\n\n if (props.truncated) {\n const width = textRef.value?.offsetWidth\n const scrollWidth = textRef.value?.scrollWidth\n if (width && scrollWidth && scrollWidth > width) {\n shouldAddTitle = true\n }\n } else if (!isUndefined(props.lineClamp)) {\n const height = textRef.value?.offsetHeight\n const scrollHeight = textRef.value?.scrollHeight\n if (height && scrollHeight && scrollHeight > height) {\n shouldAddTitle = true\n }\n }\n\n if (shouldAddTitle) {\n textRef.value?.setAttribute('title', text)\n } else {\n textRef.value?.removeAttribute('title')\n }\n}\n\nonMounted(bindTitle)\nonUpdated(bindTitle)\n</script>\n"],"mappings":";;;;;;;;;;;;;EAuBA,MAAM,QAAQ;EAKd,MAAM,wBAA2B;EAEjC,MAAM,WAAW,2CAAY;EAC7B,MAAM,KAAK,2BAAa,OAAM;EAE9B,MAAM,kCAAyB;GAC7B,GAAG,GAAG;GACN,GAAG,EAAE,MAAM,KAAK;GAChB,GAAG,EAAE,SAAS,MAAM;GACpB,GAAG,GAAG,aAAa,MAAM,UAAU;GACnC,GAAG,GAAG,cAAc,CAAC,0BAAY,MAAM,UAAU,CAAC;GACnD,CAAA;EAED,MAAM,kBAAkB;AAGtB,0BAF+B,CAAC,MAEd;GAClB,IAAI,iBAAiB;GACrB,MAAM,OAAO,QAAQ,OAAO,eAAe;AAE3C,OAAI,MAAM,WAAW;IACnB,MAAM,QAAQ,QAAQ,OAAO;IAC7B,MAAM,cAAc,QAAQ,OAAO;AACnC,QAAI,SAAS,eAAe,cAAc,MACxC,kBAAiB;cAEV,CAAC,0BAAY,MAAM,UAAU,EAAE;IACxC,MAAM,SAAS,QAAQ,OAAO;IAC9B,MAAM,eAAe,QAAQ,OAAO;AACpC,QAAI,UAAU,gBAAgB,eAAe,OAC3C,kBAAiB;;AAIrB,OAAI,eACF,SAAQ,OAAO,aAAa,SAAS,KAAI;OAEzC,SAAQ,OAAO,gBAAgB,QAAO;;AAI1C,qBAAU,UAAS;AACnB,qBAAU,UAAS;;sFApEV,QAAA,IAAG,EAAA;aACJ;IAAJ,KAAI;IACH,+BAAO,QAAA,MAAO;IACd,+BAAK,EAAA,sBAA0B,QAAA,WAAS,CAAA;;oCAEjC,qBAAA,KAAA,QAAA,UAAA"}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
||||
const require_text_vue_vue_type_script_setup_true_lang = require('./text.vue_vue_type_script_setup_true_lang.js');
|
||||
|
||||
//#region ../../packages/components/text/src/text.vue
|
||||
var text_default = require_text_vue_vue_type_script_setup_true_lang.default;
|
||||
|
||||
//#endregion
|
||||
exports.default = text_default;
|
||||
//# sourceMappingURL=text2.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"text2.js","names":[],"sources":["../../../../../../packages/components/text/src/text.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n ref=\"textRef\"\n :class=\"textKls\"\n :style=\"{ '-webkit-line-clamp': lineClamp }\"\n >\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onMounted, onUpdated, ref, useAttrs } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { useFormSize } from '@element-plus/components/form'\nimport { isUndefined } from '@element-plus/utils'\n\nimport type { TextProps } from './text'\n\ndefineOptions({\n name: 'ElText',\n})\n\nconst props = withDefaults(defineProps<TextProps>(), {\n type: '',\n size: '',\n tag: 'span',\n})\nconst textRef = ref<HTMLElement>()\n\nconst textSize = useFormSize()\nconst ns = useNamespace('text')\n\nconst textKls = computed(() => [\n ns.b(),\n ns.m(props.type),\n ns.m(textSize.value),\n ns.is('truncated', props.truncated),\n ns.is('line-clamp', !isUndefined(props.lineClamp)),\n])\n\nconst bindTitle = () => {\n const inheritTitle = useAttrs().title\n\n if (inheritTitle) return\n let shouldAddTitle = false\n const text = textRef.value?.textContent || ''\n\n if (props.truncated) {\n const width = textRef.value?.offsetWidth\n const scrollWidth = textRef.value?.scrollWidth\n if (width && scrollWidth && scrollWidth > width) {\n shouldAddTitle = true\n }\n } else if (!isUndefined(props.lineClamp)) {\n const height = textRef.value?.offsetHeight\n const scrollHeight = textRef.value?.scrollHeight\n if (height && scrollHeight && scrollHeight > height) {\n shouldAddTitle = true\n }\n }\n\n if (shouldAddTitle) {\n textRef.value?.setAttribute('title', text)\n } else {\n textRef.value?.removeAttribute('title')\n }\n}\n\nonMounted(bindTitle)\nonUpdated(bindTitle)\n</script>\n"],"mappings":""}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
require('../../base/style/css.js');
|
||||
require("element-plus/theme-chalk/el-text.css");
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
require('../../base/style/index.js');
|
||||
require("element-plus/theme-chalk/src/text.scss");
|
||||
Reference in New Issue
Block a user