@aplus-frontend/ui
Version:
89 lines (88 loc) • 2.45 kB
JavaScript
import { defineComponent as s, computed as i, createElementBlock as a, openBlock as n, toDisplayString as l, unref as o, normalizeClass as m, createElementVNode as c } from "vue";
import { isNil as f } from "lodash-unified";
import "../../config-provider/index.mjs";
import y from "../style/index.mjs";
import { languageFormat as g } from "./utils.mjs";
import { useNamespace as B } from "../../config-provider/hooks/use-namespace.mjs";
const h = {
key: 0,
style: {
whiteSpace: "pre-wrap",
wordWrap: "break-word",
wordBreak: "break-all"
}
}, I = /* @__PURE__ */ s({
name: "ApFieldTextAreaRead",
__name: "read",
props: {
mode: { default: "edit" },
class: {},
style: {},
rows: {},
autoSize: { type: [Boolean, Object] },
onResize: {},
onCompositionstart: {},
onCompositionend: {},
valueModifiers: {},
size: {},
value: {},
name: {},
type: { default: "text" },
onFocus: {},
onBlur: {},
onChange: {},
onInput: {},
onKeydown: {},
onKeyup: {},
onMousedown: {},
focused: { type: Boolean },
hidden: { type: Boolean },
disabled: { type: Boolean, default: void 0 },
prefixCls: {},
id: {},
readonly: { type: Boolean },
autofocus: { type: Boolean },
variant: {},
autocomplete: {},
placeholder: {},
lazy: { type: Boolean, default: !0 },
maxlength: {},
loading: { type: Boolean },
bordered: { type: Boolean, default: !0 },
showCount: { type: [Boolean, Object] },
htmlSize: {},
onPressEnter: {},
onMouseUp: {},
onRawInput: {},
"onUpdate:value": {},
status: {},
defaultValue: {},
inputElement: {},
triggerFocus: {},
handleReset: {},
clearIcon: {},
allowClear: { type: Boolean, default: !0 },
emptyText: { default: "--" },
beforeInput: {},
code: { type: [Boolean, Object], default: !1 }
},
setup(r) {
const { m: u } = B("field-textarea"), d = y("field"), t = r, p = i(() => {
if (t.code)
return t.code === !0 ? {
language: "text"
} : {
language: t.code?.language ?? "text"
};
});
return (e, v) => e.code ? (n(), a("pre", {
key: 1,
class: m([o(u)("code"), o(d)])
}, [
c("code", null, l(o(g)(e.value, p.value.language)), 1)
], 2)) : (n(), a("span", h, l(o(f)(e.value) || e.value === "" ? e.emptyText : e.value), 1));
}
});
export {
I as default
};