element-ps 1.0.17 → 1.0.20
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 +13 -13
- package/dist/index.full.min.js +4 -4
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +4 -4
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +13 -13
- package/es/components/autocomplete/index.d.ts +4 -4
- package/es/components/autocomplete/src/index.vue.d.ts +2 -2
- package/es/components/cascader/index.d.ts +20 -20
- package/es/components/cascader/src/index.vue.d.ts +10 -10
- package/es/components/checkbox/index.d.ts +3 -3
- package/es/components/checkbox/src/checkbox-button.vue.d.ts +1 -1
- package/es/components/checkbox/src/checkbox.vue.d.ts +1 -1
- package/es/components/color-picker/index.d.ts +2 -2
- package/es/components/color-picker/src/index.vue.d.ts +1 -1
- package/es/components/date-picker/index.d.ts +4 -4
- package/es/components/date-picker/src/date-picker.d.ts +2 -2
- package/es/components/drawer/index.d.ts +2 -2
- package/es/components/drawer/src/index.vue.d.ts +1 -1
- package/es/components/input/index.d.ts +4 -4
- package/es/components/input/src/input.d.ts +1 -1
- package/es/components/input/src/input.vue.d.ts +4 -4
- package/es/components/radio/index.d.ts +2 -2
- package/es/components/radio/src/radio.vue.d.ts +2 -2
- package/es/components/select/index.d.ts +2 -2
- package/es/components/select/src/select.vue.d.ts +2 -2
- package/es/components/select-v2/index.d.ts +2 -2
- package/es/components/select-v2/src/select.vue.d.ts +1 -1
- package/es/components/slider/index.d.ts +4 -4
- package/es/components/slider/src/index.vue.d.ts +2 -2
- package/es/components/time-picker/index.d.ts +4 -4
- package/es/components/time-picker/src/common/picker.vue.d.ts +2 -2
- package/es/components/time-picker/src/time-picker.d.ts +2 -2
- package/es/components/tooltip/index.d.ts +2 -2
- package/es/components/tooltip/src/index.vue.d.ts +1 -1
- package/es/index.mjs +7 -7
- package/es/packages/components/affix/index.mjs +2 -2
- package/es/packages/components/affix/src/affix.mjs +5 -22
- package/es/packages/components/affix/src/affix.mjs.map +1 -1
- package/es/packages/components/affix/src/affix.vue_vue&type=script&lang.mjs +1 -1
- package/es/packages/components/affix/src/affix2.mjs +22 -5
- package/es/packages/components/affix/src/affix2.mjs.map +1 -1
- package/es/packages/components/badge/index.mjs +2 -2
- package/es/packages/components/badge/src/badge.mjs +20 -5
- package/es/packages/components/badge/src/badge.mjs.map +1 -1
- package/es/packages/components/badge/src/badge.vue_vue&type=script&lang.mjs +1 -1
- package/es/packages/components/badge/src/badge2.mjs +5 -20
- package/es/packages/components/badge/src/badge2.mjs.map +1 -1
- package/es/packages/components/breadcrumb/index.mjs +2 -2
- package/es/packages/components/breadcrumb/src/breadcrumb.mjs +13 -5
- package/es/packages/components/breadcrumb/src/breadcrumb.mjs.map +1 -1
- package/es/packages/components/breadcrumb/src/breadcrumb.vue_vue&type=script&lang.mjs +1 -1
- package/es/packages/components/breadcrumb/src/breadcrumb2.mjs +5 -13
- package/es/packages/components/breadcrumb/src/breadcrumb2.mjs.map +1 -1
- package/es/packages/components/cascader-panel/src/config.mjs +1 -1
- package/es/packages/components/cascader-panel/src/index.vue_vue&type=script&lang.mjs +1 -1
- package/es/packages/components/cascader-panel/src/menu.vue_vue&type=script&lang.mjs +1 -1
- package/es/packages/components/cascader-panel/src/node.mjs +5 -72
- package/es/packages/components/cascader-panel/src/node.mjs.map +1 -1
- package/es/packages/components/cascader-panel/src/node2.mjs +72 -5
- package/es/packages/components/cascader-panel/src/node2.mjs.map +1 -1
- package/es/packages/components/cascader-panel/src/store.mjs +1 -1
- package/es/packages/components/dialog/src/dialog.vue_vue&type=script&lang.mjs.map +1 -1
- package/es/packages/components/dialog/src/dialog.vue_vue&type=template&id=02672805&lang.mjs +3 -3
- package/es/packages/components/dialog/src/dialog.vue_vue&type=template&id=02672805&lang.mjs.map +1 -1
- package/es/packages/components/drawer/src/index.vue_vue&type=script&lang.mjs.map +1 -1
- package/es/packages/components/drawer/src/index.vue_vue&type=template&id=052d0d8e&lang.mjs +2 -2
- package/es/packages/components/drawer/src/index.vue_vue&type=template&id=052d0d8e&lang.mjs.map +1 -1
- package/es/packages/components/form/src/form-item.vue_vue&type=script&lang.mjs.map +1 -1
- package/es/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.mjs +2 -2
- package/es/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.mjs.map +1 -1
- package/es/packages/components/index.mjs +7 -7
- package/es/packages/components/input/index.mjs +2 -2
- package/es/packages/components/input/src/input.mjs +79 -5
- package/es/packages/components/input/src/input.mjs.map +1 -1
- package/es/packages/components/input/src/input.vue_vue&type=script&lang.mjs +3 -3
- package/es/packages/components/input/src/input.vue_vue&type=script&lang.mjs.map +1 -1
- package/es/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.mjs +1 -1
- package/es/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.mjs.map +1 -1
- package/es/packages/components/input/src/input2.mjs +5 -79
- package/es/packages/components/input/src/input2.mjs.map +1 -1
- package/es/packages/components/link/index.mjs +2 -2
- package/es/packages/components/link/src/link.mjs +5 -20
- package/es/packages/components/link/src/link.mjs.map +1 -1
- package/es/packages/components/link/src/link.vue_vue&type=script&lang.mjs +1 -1
- package/es/packages/components/link/src/link2.mjs +20 -5
- package/es/packages/components/link/src/link2.mjs.map +1 -1
- package/es/packages/components/menu/index.mjs +2 -2
- package/es/packages/components/menu/src/menu-item-group.mjs +5 -4
- package/es/packages/components/menu/src/menu-item-group.mjs.map +1 -1
- package/es/packages/components/menu/src/menu-item-group.vue_vue&type=script&lang.mjs +1 -1
- package/es/packages/components/menu/src/menu-item-group2.mjs +4 -5
- package/es/packages/components/menu/src/menu-item-group2.mjs.map +1 -1
- package/es/packages/components/table/src/table-body/render-helper.mjs +1 -1
- package/es/packages/components/table/src/table-body/render-helper.mjs.map +1 -1
- package/es/packages/components/table/src/table-header/index.mjs +1 -1
- package/es/packages/components/table/src/table-header/index.mjs.map +1 -1
- package/es/packages/components/tag/index.mjs +2 -2
- package/es/packages/components/tag/src/tag.mjs +26 -5
- package/es/packages/components/tag/src/tag.mjs.map +1 -1
- package/es/packages/components/tag/src/tag.vue_vue&type=script&lang.mjs +1 -1
- package/es/packages/components/tag/src/tag2.mjs +5 -26
- package/es/packages/components/tag/src/tag2.mjs.map +1 -1
- package/lib/components/autocomplete/index.d.ts +4 -4
- package/lib/components/autocomplete/src/index.vue.d.ts +2 -2
- package/lib/components/cascader/index.d.ts +20 -20
- package/lib/components/cascader/src/index.vue.d.ts +10 -10
- package/lib/components/checkbox/index.d.ts +3 -3
- package/lib/components/checkbox/src/checkbox-button.vue.d.ts +1 -1
- package/lib/components/checkbox/src/checkbox.vue.d.ts +1 -1
- package/lib/components/color-picker/index.d.ts +2 -2
- package/lib/components/color-picker/src/index.vue.d.ts +1 -1
- package/lib/components/date-picker/index.d.ts +4 -4
- package/lib/components/date-picker/src/date-picker.d.ts +2 -2
- package/lib/components/drawer/index.d.ts +2 -2
- package/lib/components/drawer/src/index.vue.d.ts +1 -1
- package/lib/components/input/index.d.ts +4 -4
- package/lib/components/input/src/input.d.ts +1 -1
- package/lib/components/input/src/input.vue.d.ts +4 -4
- package/lib/components/radio/index.d.ts +2 -2
- package/lib/components/radio/src/radio.vue.d.ts +2 -2
- package/lib/components/select/index.d.ts +2 -2
- package/lib/components/select/src/select.vue.d.ts +2 -2
- package/lib/components/select-v2/index.d.ts +2 -2
- package/lib/components/select-v2/src/select.vue.d.ts +1 -1
- package/lib/components/slider/index.d.ts +4 -4
- package/lib/components/slider/src/index.vue.d.ts +2 -2
- package/lib/components/time-picker/index.d.ts +4 -4
- package/lib/components/time-picker/src/common/picker.vue.d.ts +2 -2
- package/lib/components/time-picker/src/time-picker.d.ts +2 -2
- package/lib/components/tooltip/index.d.ts +2 -2
- package/lib/components/tooltip/src/index.vue.d.ts +1 -1
- package/lib/index.js +7 -7
- package/lib/packages/components/affix/index.js +2 -2
- package/lib/packages/components/affix/src/affix.js +5 -21
- package/lib/packages/components/affix/src/affix.js.map +1 -1
- package/lib/packages/components/affix/src/affix.vue_vue&type=script&lang.js +1 -1
- package/lib/packages/components/affix/src/affix2.js +21 -5
- package/lib/packages/components/affix/src/affix2.js.map +1 -1
- package/lib/packages/components/badge/index.js +2 -2
- package/lib/packages/components/badge/src/badge.js +19 -5
- package/lib/packages/components/badge/src/badge.js.map +1 -1
- package/lib/packages/components/badge/src/badge.vue_vue&type=script&lang.js +1 -1
- package/lib/packages/components/badge/src/badge2.js +5 -19
- package/lib/packages/components/badge/src/badge2.js.map +1 -1
- package/lib/packages/components/breadcrumb/index.js +2 -2
- package/lib/packages/components/breadcrumb/src/breadcrumb.js +12 -5
- package/lib/packages/components/breadcrumb/src/breadcrumb.js.map +1 -1
- package/lib/packages/components/breadcrumb/src/breadcrumb.vue_vue&type=script&lang.js +1 -1
- package/lib/packages/components/breadcrumb/src/breadcrumb2.js +5 -12
- package/lib/packages/components/breadcrumb/src/breadcrumb2.js.map +1 -1
- package/lib/packages/components/cascader-panel/src/config.js +1 -1
- package/lib/packages/components/cascader-panel/src/index.vue_vue&type=script&lang.js +1 -1
- package/lib/packages/components/cascader-panel/src/menu.vue_vue&type=script&lang.js +1 -1
- package/lib/packages/components/cascader-panel/src/node.js +5 -71
- package/lib/packages/components/cascader-panel/src/node.js.map +1 -1
- package/lib/packages/components/cascader-panel/src/node2.js +71 -5
- package/lib/packages/components/cascader-panel/src/node2.js.map +1 -1
- package/lib/packages/components/cascader-panel/src/store.js +1 -1
- package/lib/packages/components/dialog/src/dialog.vue_vue&type=script&lang.js.map +1 -1
- package/lib/packages/components/dialog/src/dialog.vue_vue&type=template&id=02672805&lang.js +3 -3
- package/lib/packages/components/dialog/src/dialog.vue_vue&type=template&id=02672805&lang.js.map +1 -1
- package/lib/packages/components/drawer/src/index.vue_vue&type=script&lang.js.map +1 -1
- package/lib/packages/components/drawer/src/index.vue_vue&type=template&id=052d0d8e&lang.js +2 -2
- package/lib/packages/components/drawer/src/index.vue_vue&type=template&id=052d0d8e&lang.js.map +1 -1
- package/lib/packages/components/form/src/form-item.vue_vue&type=script&lang.js.map +1 -1
- package/lib/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.js +2 -2
- package/lib/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.js.map +1 -1
- package/lib/packages/components/index.js +7 -7
- package/lib/packages/components/input/index.js +2 -2
- package/lib/packages/components/input/src/input.js +78 -5
- package/lib/packages/components/input/src/input.js.map +1 -1
- package/lib/packages/components/input/src/input.vue_vue&type=script&lang.js +3 -3
- package/lib/packages/components/input/src/input.vue_vue&type=script&lang.js.map +1 -1
- package/lib/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.js +1 -1
- package/lib/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.js.map +1 -1
- package/lib/packages/components/input/src/input2.js +5 -78
- package/lib/packages/components/input/src/input2.js.map +1 -1
- package/lib/packages/components/link/index.js +2 -2
- package/lib/packages/components/link/src/link.js +5 -19
- package/lib/packages/components/link/src/link.js.map +1 -1
- package/lib/packages/components/link/src/link.vue_vue&type=script&lang.js +1 -1
- package/lib/packages/components/link/src/link2.js +19 -5
- package/lib/packages/components/link/src/link2.js.map +1 -1
- package/lib/packages/components/menu/index.js +2 -2
- package/lib/packages/components/menu/src/menu-item-group.js +6 -4
- package/lib/packages/components/menu/src/menu-item-group.js.map +1 -1
- package/lib/packages/components/menu/src/menu-item-group.vue_vue&type=script&lang.js +1 -1
- package/lib/packages/components/menu/src/menu-item-group2.js +4 -6
- package/lib/packages/components/menu/src/menu-item-group2.js.map +1 -1
- package/lib/packages/components/table/src/table-body/render-helper.js +1 -1
- package/lib/packages/components/table/src/table-body/render-helper.js.map +1 -1
- package/lib/packages/components/table/src/table-header/index.js +1 -1
- package/lib/packages/components/table/src/table-header/index.js.map +1 -1
- package/lib/packages/components/tag/index.js +2 -2
- package/lib/packages/components/tag/src/tag.js +25 -5
- package/lib/packages/components/tag/src/tag.js.map +1 -1
- package/lib/packages/components/tag/src/tag.vue_vue&type=script&lang.js +1 -1
- package/lib/packages/components/tag/src/tag2.js +5 -25
- package/lib/packages/components/tag/src/tag2.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue_vue&type=script&lang.js","sources":["../../../../../../../packages/components/drawer/src/index.vue"],"sourcesContent":["<template>\n <teleport to=\"body\" :disabled=\"!appendToBody\">\n <ps-overlay\n v-show=\"visible\"\n :mask=\"modal\"\n :overlay-class=\"(modalClass || '') + (widget ? ` ps--drawer-widget-class` : '')\"\n :z-index=\"zIndex\"\n >\n <div class=\"el-overlay-drawer\">\n <div\n ref=\"drawerRef\"\n aria-modal=\"true\"\n aria-labelledby=\"el-drawer__title\"\n :aria-label=\"title\"\n :class=\"['el-drawer', direction, visible && 'open', customClass]\"\n :style=\"\n isHorizontal ? 'width: ' + drawerSize : 'height: ' + drawerSize\n \"\n role=\"dialog\"\n @click.stop\n :widget=\"widget\"\n >\n <header\n v-if=\"withHeader\"\n id=\"el-drawer__title\"\n class=\"el-drawer__header\"\n :widget=\"
|
|
1
|
+
{"version":3,"file":"index.vue_vue&type=script&lang.js","sources":["../../../../../../../packages/components/drawer/src/index.vue"],"sourcesContent":["<template>\n <teleport to=\"body\" :disabled=\"!appendToBody\">\n <ps-overlay\n v-show=\"visible\"\n :mask=\"modal\"\n :overlay-class=\"(modalClass || '') + (widget ? ` ps--drawer-widget-class` : '')\"\n :z-index=\"zIndex\"\n >\n <div class=\"el-overlay-drawer\">\n <div\n ref=\"drawerRef\"\n aria-modal=\"true\"\n aria-labelledby=\"el-drawer__title\"\n :aria-label=\"title\"\n :class=\"['el-drawer', direction, visible && 'open', customClass]\"\n :style=\"\n isHorizontal ? 'width: ' + drawerSize : 'height: ' + drawerSize\n \"\n role=\"dialog\"\n @click.stop\n :widget=\"widget\"\n >\n <header\n v-if=\"withHeader\"\n id=\"el-drawer__title\"\n class=\"el-drawer__header\"\n :widget=\"`${widget ? 'drawer:title:' + widget.split(':')[1] : ''}`\"\n >\n <slot name=\"title\">\n <span role=\"heading\" :title=\"title\">\n {{ title }}\n </span>\n </slot>\n <button\n v-if=\"showClose\"\n :aria-label=\"'close ' + (title || 'drawer')\"\n class=\"el-drawer__close-btn\"\n type=\"button\"\n >\n <ps-icon class=\"el-drawer__close\"><close /></ps-icon>\n </button>\n </header>\n <template v-if=\"rendered\">\n <section class=\"el-drawer__body\" :widget=\"`${widget ? 'drawer:default:' + widget.split(':')[1] : ''}`\">\n <slot></slot>\n </section>\n </template>\n </div>\n </div>\n </ps-overlay>\n </teleport>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, computed, ref } from 'vue'\nimport { PsOverlay } from '@element-ps/components/overlay'\nimport {\n useDialog,\n dialogProps,\n} from '@element-ps/components/dialog'\nimport type { PropType, SetupContext } from 'vue'\nimport PsIcon from '@element-ps/components/icon'\nimport { Close } from '@element-plus/icons'\n\ntype DrawerDirection = 'ltr' | 'rtl' | 'ttb' | 'btt'\n\nexport default defineComponent({\n name: 'PsDrawer',\n components: {\n PsOverlay,\n PsIcon,\n Close,\n },\n props: {\n ...dialogProps,\n direction: {\n type: String as PropType<DrawerDirection>,\n default: 'rtl',\n validator: (val: DrawerDirection) => {\n return ['ltr', 'rtl', 'ttb', 'btt'].indexOf(val) !== -1\n },\n },\n size: {\n type: [String, Number],\n default: '30%',\n },\n withHeader: {\n type: Boolean,\n default: true,\n },\n modalFade: {\n type: Boolean,\n default: true,\n },\n widget: {\n type: String,\n },\n },\n\n setup(props, ctx) {\n const drawerRef = ref<HTMLElement>(null)\n return {\n ...useDialog(props, ctx as SetupContext, drawerRef),\n drawerRef,\n isHorizontal: computed(\n () => props.direction === 'rtl' || props.direction === 'ltr',\n ),\n drawerSize: computed(() =>\n typeof props.size === 'number' ? `${props.size}px` : props.size,\n ),\n }\n },\n})\n</script>\n"],"names":["defineComponent","PsOverlay","PsIcon","Close","dialogProps","ref","useDialog","computed"],"mappings":";;;;;;;;;;;;AAkEA,aAAeA,oBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,eACVC;AAAA,YACAC;AAAA,WACAC;AAAA;AAAA,EAEF,OAAO;AAAA,OACFC;AAAA,IACH,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAAC,QAAyB;AACnC,eAAO,CAAC,OAAO,OAAO,OAAO,OAAO,QAAQ,SAAS;AAAA;AAAA;AAAA,IAGzD,MAAM;AAAA,MACJ,MAAM,CAAC,QAAQ;AAAA,MACf,SAAS;AAAA;AAAA,IAEX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,QAAQ;AAAA,MACN,MAAM;AAAA;AAAA;AAAA,EAIV,MAAM,OAAO,KAAK;AAChB,UAAM,YAAYC,QAAiB;AACnC,WAAO;AAAA,SACFC,oBAAU,OAAO,KAAqB;AAAA,MACzC;AAAA,MACA,cAAcC,aACZ,MAAM,MAAM,cAAc,SAAS,MAAM,cAAc;AAAA,MAEzD,YAAYA,aAAS,MACnB,OAAO,MAAM,SAAS,WAAW,GAAG,MAAM,WAAW,MAAM;AAAA;AAAA;AAAA;;;;"}
|
|
@@ -41,7 +41,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41
41
|
key: 0,
|
|
42
42
|
id: "el-drawer__title",
|
|
43
43
|
class: "el-drawer__header",
|
|
44
|
-
widget:
|
|
44
|
+
widget: `${_ctx.widget ? "drawer:title:" + _ctx.widget.split(":")[1] : ""}`
|
|
45
45
|
}, [
|
|
46
46
|
vue.renderSlot(_ctx.$slots, "title", {}, () => [
|
|
47
47
|
vue.createElementVNode("span", {
|
|
@@ -66,7 +66,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
66
66
|
_ctx.rendered ? (vue.openBlock(), vue.createElementBlock("section", {
|
|
67
67
|
key: 1,
|
|
68
68
|
class: "el-drawer__body",
|
|
69
|
-
widget:
|
|
69
|
+
widget: `${_ctx.widget ? "drawer:default:" + _ctx.widget.split(":")[1] : ""}`
|
|
70
70
|
}, [
|
|
71
71
|
vue.renderSlot(_ctx.$slots, "default")
|
|
72
72
|
], 8, _hoisted_6)) : vue.createCommentVNode("v-if", true)
|
package/lib/packages/components/drawer/src/index.vue_vue&type=template&id=052d0d8e&lang.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue_vue&type=template&id=052d0d8e&lang.js","sources":["../../../../../../../packages/components/drawer/src/index.vue?vue&type=template&id=052d0d8e&lang.js"],"sourcesContent":["<template>\n <teleport to=\"body\" :disabled=\"!appendToBody\">\n <ps-overlay\n v-show=\"visible\"\n :mask=\"modal\"\n :overlay-class=\"(modalClass || '') + (widget ? ` ps--drawer-widget-class` : '')\"\n :z-index=\"zIndex\"\n >\n <div class=\"el-overlay-drawer\">\n <div\n ref=\"drawerRef\"\n aria-modal=\"true\"\n aria-labelledby=\"el-drawer__title\"\n :aria-label=\"title\"\n :class=\"['el-drawer', direction, visible && 'open', customClass]\"\n :style=\"\n isHorizontal ? 'width: ' + drawerSize : 'height: ' + drawerSize\n \"\n role=\"dialog\"\n @click.stop\n :widget=\"widget\"\n >\n <header\n v-if=\"withHeader\"\n id=\"el-drawer__title\"\n class=\"el-drawer__header\"\n :widget=\"
|
|
1
|
+
{"version":3,"file":"index.vue_vue&type=template&id=052d0d8e&lang.js","sources":["../../../../../../../packages/components/drawer/src/index.vue?vue&type=template&id=052d0d8e&lang.js"],"sourcesContent":["<template>\n <teleport to=\"body\" :disabled=\"!appendToBody\">\n <ps-overlay\n v-show=\"visible\"\n :mask=\"modal\"\n :overlay-class=\"(modalClass || '') + (widget ? ` ps--drawer-widget-class` : '')\"\n :z-index=\"zIndex\"\n >\n <div class=\"el-overlay-drawer\">\n <div\n ref=\"drawerRef\"\n aria-modal=\"true\"\n aria-labelledby=\"el-drawer__title\"\n :aria-label=\"title\"\n :class=\"['el-drawer', direction, visible && 'open', customClass]\"\n :style=\"\n isHorizontal ? 'width: ' + drawerSize : 'height: ' + drawerSize\n \"\n role=\"dialog\"\n @click.stop\n :widget=\"widget\"\n >\n <header\n v-if=\"withHeader\"\n id=\"el-drawer__title\"\n class=\"el-drawer__header\"\n :widget=\"`${widget ? 'drawer:title:' + widget.split(':')[1] : ''}`\"\n >\n <slot name=\"title\">\n <span role=\"heading\" :title=\"title\">\n {{ title }}\n </span>\n </slot>\n <button\n v-if=\"showClose\"\n :aria-label=\"'close ' + (title || 'drawer')\"\n class=\"el-drawer__close-btn\"\n type=\"button\"\n >\n <ps-icon class=\"el-drawer__close\"><close /></ps-icon>\n </button>\n </header>\n <template v-if=\"rendered\">\n <section class=\"el-drawer__body\" :widget=\"`${widget ? 'drawer:default:' + widget.split(':')[1] : ''}`\">\n <slot></slot>\n </section>\n </template>\n </div>\n </div>\n </ps-overlay>\n </teleport>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, computed, ref } from 'vue'\nimport { PsOverlay } from '@element-ps/components/overlay'\nimport {\n useDialog,\n dialogProps,\n} from '@element-ps/components/dialog'\nimport type { PropType, SetupContext } from 'vue'\nimport PsIcon from '@element-ps/components/icon'\nimport { Close } from '@element-plus/icons'\n\ntype DrawerDirection = 'ltr' | 'rtl' | 'ttb' | 'btt'\n\nexport default defineComponent({\n name: 'PsDrawer',\n components: {\n PsOverlay,\n PsIcon,\n Close,\n },\n props: {\n ...dialogProps,\n direction: {\n type: String as PropType<DrawerDirection>,\n default: 'rtl',\n validator: (val: DrawerDirection) => {\n return ['ltr', 'rtl', 'ttb', 'btt'].indexOf(val) !== -1\n },\n },\n size: {\n type: [String, Number],\n default: '30%',\n },\n withHeader: {\n type: Boolean,\n default: true,\n },\n modalFade: {\n type: Boolean,\n default: true,\n },\n widget: {\n type: String,\n },\n },\n\n setup(props, ctx) {\n const drawerRef = ref<HTMLElement>(null)\n return {\n ...useDialog(props, ctx as SetupContext, drawerRef),\n drawerRef,\n isHorizontal: computed(\n () => props.direction === 'rtl' || props.direction === 'ltr',\n ),\n drawerSize: computed(() =>\n typeof props.size === 'number' ? `${props.size}px` : props.size,\n ),\n }\n },\n})\n</script>\n"],"names":["_createBlock","_createVNode","_createElementVNode","_createElementBlock","_renderSlot"],"mappings":";;;;;;qBAQW,OAAM;;;;;;;;;;0BAPfA;IAAU,IAAG;AAAA,IAAQ,WAAW;;uBAC9BC;MAEG,MAAM;MACN,iBAAgB;MAChB,WAAS;;2BAEV;QAAAC,8BAAA;UACEA;YACE,KAAI;AAAA,YACJ,cAAW;AAAA,YACX,mBAAgB;AAAA,YACf,cAAY;YACZ,wCAAqB,gBAAW,wBAAmB;YACnD;YAGD,MAAK;AAAA,YACJ,qDAAD;;YACC,QAAQ;;YAGD,oCADRC;;cAEE,IAAG;AAAA,cACH,OAAM;AAAA,cACL,WAAW,gCAA2B,YAAO;;cAE9CC,yCAAA;gBACEF;kBAAM,MAAK;AAAA,kBAAW,OAAO;uCACxB;;cAIC,mCADRC;;gBAEG;gBACD,OAAM;AAAA,gBACN,MAAK;AAAA;gBAELF,sCAAS,OAAM;uCAAmB;oBAAAA,gBAAS;AAAA;AAAA;;;;YAG/B,kCACdE;;cAAS,OAAM;AAAA,cAAmB,WAAW,kCAA6B,YAAO;;cAC/EC;;;;;;;kBAzCA;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-item.vue_vue&type=script&lang.js","sources":["../../../../../../../packages/components/form/src/form-item.vue"],"sourcesContent":["<template>\n <div ref=\"formItemRef\" class=\"el-form-item\" :class=\"formItemClass\"\n :widget=\"widget\"\n >\n <LabelWrap\n :is-auto-width=\"labelStyle.width === 'auto'\"\n :update-all=\"elForm.labelWidth === 'auto'\"\n >\n <label\n v-if=\"label || $slots.label\"\n :for=\"labelFor\"\n class=\"el-form-item__label\"\n :style=\"labelStyle\"\n :widget=\"`form-item:label:${widget.split(':')[1]}`\"\n >\n <slot name=\"label\" :label=\"label + elForm.labelSuffix\">\n {{ label + elForm.labelSuffix }}\n </slot>\n </label>\n </LabelWrap>\n <div class=\"el-form-item__content\" :style=\"contentStyle\"\n :widget=\"`form-item:default:${widget.split(':')[1]}`\"\n >\n <slot></slot>\n <transition name=\"el-zoom-in-top\">\n <slot v-if=\"shouldShowError\" name=\"error\" :error=\"validateMessage\">\n <div\n class=\"el-form-item__error\"\n :class=\"{\n 'el-form-item__error--inline':\n typeof inlineMessage === 'boolean'\n ? inlineMessage\n : elForm.inlineMessage || false,\n }\"\n >\n {{ validateMessage }}\n </div>\n </slot>\n </transition>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n reactive,\n ref,\n toRefs,\n} from 'vue'\nimport { addUnit, getPropByPath, useGlobalConfig } from '@element-ps/utils/util'\nimport { isValidComponentSize } from '@element-ps/utils/validators'\nimport { elFormItemKey, elFormKey } from '@element-ps/tokens'\nimport LabelWrap from './label-wrap'\n\nimport type { PropType, CSSProperties } from 'vue'\nimport type { ComponentSize } from '@element-ps/utils/types'\nimport type { ElFormContext } from '@element-ps/tokens'\nimport type { FormItemRule } from './form.type'\n\nexport default defineComponent({\n name: 'PsFormItem',\n componentName: 'PsFormItem',\n components: {\n LabelWrap,\n },\n props: {\n label: String,\n labelWidth: {\n type: [String, Number],\n default: '',\n },\n prop: String,\n required: {\n type: Boolean,\n default: undefined,\n },\n rules: [Object, Array] as PropType<FormItemRule | FormItemRule[]>,\n error: String,\n validateStatus: String,\n for: String,\n inlineMessage: {\n type: [String, Boolean],\n default: '',\n },\n showMessage: {\n type: Boolean,\n default: true,\n },\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n widget: {\n type: String,\n },\n },\n setup(props, { slots }) {\n const $ELEMENT = useGlobalConfig()\n\n const elForm = inject(elFormKey, {} as ElFormContext)\n const validateState = ref('')\n const validateMessage = ref('')\n\n const computedLabelWidth = ref('')\n\n const formItemRef = ref<HTMLDivElement>()\n\n const vm = getCurrentInstance()\n const isNested = computed(() => {\n let parent = vm.parent\n while (parent && parent.type.name !== 'PsForm') {\n if (parent.type.name === 'PsFormItem') {\n return true\n }\n parent = parent.parent\n }\n return false\n })\n\n let initialValue = undefined\n\n const labelFor = computed(() => props.for || props.prop)\n const labelStyle = computed(() => {\n const ret: CSSProperties = {}\n if (elForm.labelPosition === 'top') return ret\n const labelWidth = addUnit(props.labelWidth || elForm.labelWidth)\n if (labelWidth) {\n ret.width = labelWidth\n }\n return ret\n })\n const contentStyle = computed(() => {\n const ret: CSSProperties = {}\n if (elForm.labelPosition === 'top' || elForm.inline) {\n return ret\n }\n if (!props.label && !props.labelWidth && isNested.value) {\n return ret\n }\n const labelWidth = addUnit(props.labelWidth || elForm.labelWidth)\n if (!props.label && !slots.label) {\n ret.marginLeft = labelWidth\n }\n return ret\n })\n const fieldValue = computed(() => {\n const model = elForm.model\n if (!model || !props.prop) {\n return\n }\n\n let path = props.prop\n if (path.indexOf(':') !== -1) {\n path = path.replace(/:/, '.')\n }\n\n return getPropByPath(model, path, true).v\n })\n const isRequired = computed(() => {\n const rules = getRules()\n let required = false\n\n if (rules && rules.length) {\n rules.every((rule) => {\n if (rule.required) {\n required = true\n return false\n }\n return true\n })\n }\n return required\n })\n const elFormItemSize = computed(() => props.size || elForm.size)\n const sizeClass = computed<ComponentSize>(() => {\n return elFormItemSize.value || $ELEMENT.size\n })\n\n const getRules = () => {\n const formRules = elForm.rules\n const selfRules = props.rules\n const requiredRule =\n props.required !== undefined ? { required: !!props.required } : []\n\n const prop = getPropByPath(formRules, props.prop || '', false)\n const normalizedRule = formRules ? prop.o[props.prop || ''] || prop.v : []\n\n return [].concat(selfRules || normalizedRule || []).concat(requiredRule)\n }\n\n const updateComputedLabelWidth = (width: string | number) => {\n computedLabelWidth.value = width ? `${width}px` : ''\n }\n\n const elFormItem = reactive({\n ...toRefs(props),\n size: sizeClass,\n $el: formItemRef,\n updateComputedLabelWidth,\n })\n\n onMounted(() => {\n if (props.prop) {\n const value = fieldValue.value\n initialValue = (Array.isArray(value) ? [...value] : value) as any\n }\n })\n\n provide(elFormItemKey, elFormItem as any)\n\n const formItemClass = computed(() => [\n {\n 'el-form-item--feedback': elForm.statusIcon,\n 'is-error': validateState.value === 'error',\n 'is-validating': validateState.value === 'validating',\n 'is-success': validateState.value === 'success',\n 'is-required': isRequired.value || props.required,\n 'is-no-asterisk': elForm.hideRequiredAsterisk,\n },\n sizeClass.value ? `el-form-item--${sizeClass.value}` : '',\n ])\n\n const shouldShowError = computed(() => {\n return (\n validateState.value === 'error' &&\n props.showMessage &&\n elForm.showMessage\n )\n })\n\n return {\n formItemRef,\n formItemClass,\n shouldShowError,\n elForm,\n labelStyle,\n contentStyle,\n validateMessage,\n labelFor,\n }\n },\n})\n</script>\n"],"names":["defineComponent","LabelWrap","isValidComponentSize","useGlobalConfig","inject","elFormKey","ref","getCurrentInstance","computed","addUnit","getPropByPath","reactive","toRefs","elFormItemKey"],"mappings":";;;;;;;;;;;AAkEA,aAAeA,oBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,eAAe;AAAA,EACf,YAAY;AAAA,eACVC;AAAA;AAAA,EAEF,OAAO;AAAA,IACL,OAAO;AAAA,IACP,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ;AAAA,MACf,SAAS;AAAA;AAAA,IAEX,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,OAAO,CAAC,QAAQ;AAAA,IAChB,OAAO;AAAA,IACP,gBAAgB;AAAA,IAChB,KAAK;AAAA,IACL,eAAe;AAAA,MACb,MAAM,CAAC,QAAQ;AAAA,MACf,SAAS;AAAA;AAAA,IAEX,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAE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AAAA,QACpC,iBAAiB,cAAc,UAAU;AAAA,QACzC,cAAc,cAAc,UAAU;AAAA,QACtC,eAAe,WAAW,SAAS,MAAM;AAAA,QACzC,kBAAkB,OAAO;AAAA;AAAA,MAE3B,UAAU,QAAQ,iBAAiB,UAAU,UAAU;AAAA;AAGzD,UAAM,kBAAkBA,aAAS,MAAM;AACrC,aACE,cAAc,UAAU,WACxB,MAAM,eACN,OAAO;AAAA;AAIX,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"form-item.vue_vue&type=script&lang.js","sources":["../../../../../../../packages/components/form/src/form-item.vue"],"sourcesContent":["<template>\n <div ref=\"formItemRef\" class=\"el-form-item\" :class=\"formItemClass\"\n :widget=\"widget\"\n >\n <LabelWrap\n :is-auto-width=\"labelStyle.width === 'auto'\"\n :update-all=\"elForm.labelWidth === 'auto'\"\n >\n <label\n v-if=\"label || $slots.label\"\n :for=\"labelFor\"\n class=\"el-form-item__label\"\n :style=\"labelStyle\"\n :widget=\"`${widget ? 'form-item:label:' + widget.split(':')[1] : ''}`\"\n >\n <slot name=\"label\" :label=\"label + elForm.labelSuffix\">\n {{ label + elForm.labelSuffix }}\n </slot>\n </label>\n </LabelWrap>\n <div class=\"el-form-item__content\" :style=\"contentStyle\"\n :widget=\"`${widget ? 'form-item:default:' + widget.split(':')[1] : ''}`\"\n >\n <slot></slot>\n <transition name=\"el-zoom-in-top\">\n <slot v-if=\"shouldShowError\" name=\"error\" :error=\"validateMessage\">\n <div\n class=\"el-form-item__error\"\n :class=\"{\n 'el-form-item__error--inline':\n typeof inlineMessage === 'boolean'\n ? inlineMessage\n : elForm.inlineMessage || false,\n }\"\n >\n {{ validateMessage }}\n </div>\n </slot>\n </transition>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n reactive,\n ref,\n toRefs,\n} from 'vue'\nimport { addUnit, getPropByPath, useGlobalConfig } from '@element-ps/utils/util'\nimport { isValidComponentSize } from '@element-ps/utils/validators'\nimport { elFormItemKey, elFormKey } from '@element-ps/tokens'\nimport LabelWrap from './label-wrap'\n\nimport type { PropType, CSSProperties } from 'vue'\nimport type { ComponentSize } from '@element-ps/utils/types'\nimport type { ElFormContext } from '@element-ps/tokens'\nimport type { FormItemRule } from './form.type'\n\nexport default defineComponent({\n name: 'PsFormItem',\n componentName: 'PsFormItem',\n components: {\n LabelWrap,\n },\n props: {\n label: String,\n labelWidth: {\n type: [String, Number],\n default: '',\n },\n prop: String,\n required: {\n type: Boolean,\n default: undefined,\n },\n rules: [Object, Array] as PropType<FormItemRule | FormItemRule[]>,\n error: String,\n validateStatus: String,\n for: String,\n inlineMessage: {\n type: [String, Boolean],\n default: '',\n },\n showMessage: {\n type: Boolean,\n default: true,\n },\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n widget: {\n type: String,\n },\n },\n setup(props, { slots }) {\n const $ELEMENT = useGlobalConfig()\n\n const elForm = inject(elFormKey, {} as ElFormContext)\n const validateState = ref('')\n const validateMessage = ref('')\n\n const computedLabelWidth = ref('')\n\n const formItemRef = ref<HTMLDivElement>()\n\n const vm = getCurrentInstance()\n const isNested = computed(() => {\n let parent = vm.parent\n while (parent && parent.type.name !== 'PsForm') {\n if (parent.type.name === 'PsFormItem') {\n return true\n }\n parent = parent.parent\n }\n return false\n })\n\n let initialValue = undefined\n\n const labelFor = computed(() => props.for || props.prop)\n const labelStyle = computed(() => {\n const ret: CSSProperties = {}\n if (elForm.labelPosition === 'top') return ret\n const labelWidth = addUnit(props.labelWidth || elForm.labelWidth)\n if (labelWidth) {\n ret.width = labelWidth\n }\n return ret\n })\n const contentStyle = computed(() => {\n const ret: CSSProperties = {}\n if (elForm.labelPosition === 'top' || elForm.inline) {\n return ret\n }\n if (!props.label && !props.labelWidth && isNested.value) {\n return ret\n }\n const labelWidth = addUnit(props.labelWidth || elForm.labelWidth)\n if (!props.label && !slots.label) {\n ret.marginLeft = labelWidth\n }\n return ret\n })\n const fieldValue = computed(() => {\n const model = elForm.model\n if (!model || !props.prop) {\n return\n }\n\n let path = props.prop\n if (path.indexOf(':') !== -1) {\n path = path.replace(/:/, '.')\n }\n\n return getPropByPath(model, path, true).v\n })\n const isRequired = computed(() => {\n const rules = getRules()\n let required = false\n\n if (rules && rules.length) {\n rules.every((rule) => {\n if (rule.required) {\n required = true\n return false\n }\n return true\n })\n }\n return required\n })\n const elFormItemSize = computed(() => props.size || elForm.size)\n const sizeClass = computed<ComponentSize>(() => {\n return elFormItemSize.value || $ELEMENT.size\n })\n\n const getRules = () => {\n const formRules = elForm.rules\n const selfRules = props.rules\n const requiredRule =\n props.required !== undefined ? { required: !!props.required } : []\n\n const prop = getPropByPath(formRules, props.prop || '', false)\n const normalizedRule = formRules ? prop.o[props.prop || ''] || prop.v : []\n\n return [].concat(selfRules || normalizedRule || []).concat(requiredRule)\n }\n\n const updateComputedLabelWidth = (width: string | number) => {\n computedLabelWidth.value = width ? `${width}px` : ''\n }\n\n const elFormItem = reactive({\n ...toRefs(props),\n size: sizeClass,\n $el: formItemRef,\n updateComputedLabelWidth,\n })\n\n onMounted(() => {\n if (props.prop) {\n const value = fieldValue.value\n initialValue = (Array.isArray(value) ? [...value] : value) as any\n }\n })\n\n provide(elFormItemKey, elFormItem as any)\n\n const formItemClass = computed(() => [\n {\n 'el-form-item--feedback': elForm.statusIcon,\n 'is-error': validateState.value === 'error',\n 'is-validating': validateState.value === 'validating',\n 'is-success': validateState.value === 'success',\n 'is-required': isRequired.value || props.required,\n 'is-no-asterisk': elForm.hideRequiredAsterisk,\n },\n sizeClass.value ? `el-form-item--${sizeClass.value}` : '',\n ])\n\n const shouldShowError = computed(() => {\n return (\n validateState.value === 'error' &&\n props.showMessage &&\n elForm.showMessage\n )\n })\n\n return {\n formItemRef,\n formItemClass,\n shouldShowError,\n elForm,\n labelStyle,\n contentStyle,\n validateMessage,\n labelFor,\n }\n },\n})\n</script>\n"],"names":["defineComponent","LabelWrap","isValidComponentSize","useGlobalConfig","inject","elFormKey","ref","getCurrentInstance","computed","addUnit","getPropByPath","reactive","toRefs","elFormItemKey"],"mappings":";;;;;;;;;;;AAkEA,aAAeA,oBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,eAAe;AAAA,EACf,YAAY;AAAA,eACVC;AAAA;AAAA,EAEF,OAAO;AAAA,IACL,OAAO;AAAA,IACP,YAAY;AAAA,MACV,MAAM,CAAC,QAAQ;AAAA,MACf,SAAS;AAAA;AAAA,IAEX,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,OAAO,CAAC,QAAQ;AAAA,IAChB,OAAO;AAAA,IACP,gBAAgB;AAAA,IAChB,KAAK;AAAA,IACL,eAAe;AAAA,MACb,MAAM,CAAC,QAAQ;AAAA,MACf,SAAS;AAAA;AAAA,IAEX,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA;AAAA,IAEX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,WAAWC;AAAA;AAAA,IAEb,QAAQ;AAAA,MACN,MAAM;AAAA;AAAA;AAAA,EAGV,MAAM,OAAO,EAAE,SAAS;AACtB,UAAM,WAAWC;AAEjB,UAAM,SAASC,WAAOC,gBAAW;AACjC,UAAM,gBAAgBC,QAAI;AAC1B,UAAM,kBAAkBA,QAAI;AAE5B,UAAM,qBAAqBA,QAAI;AAE/B,UAAM,cAAcA;AAEpB,UAAM,KAAKC;AACX,UAAM,WAAWC,aAAS,MAAM;AAC9B,UAAI,SAAS,GAAG;AAChB,aAAO,UAAU,OAAO,KAAK,SAAS,UAAU;AAC9C,YAAI,OAAO,KAAK,SAAS,cAAc;AACrC,iBAAO;AAAA;AAET,iBAAS,OAAO;AAAA;AAElB,aAAO;AAA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AM,YAAY,OAAO;AACzB,YAAM,YAAY,MAAM;AACxB,YAAM,eACJ,MAAM,aAAa,SAAY,EAAE,UAAU,CAAC,CAAC,MAAM,aAAa;AAElE,YAAM,OAAOE,mBAAc,WAAW,MAAM,QAAQ,IAAI;AACxD,YAAM,iBAAiB,YAAY,KAAK,EAAE,MAAM,QAAQ,OAAO,KAAK,IAAI;AAExE,aAAO,GAAG,OAAO,aAAa,kBAAkB,IAAI,OAAO;AAAA;AAG7D,UAAM,2BAA2B,CAAC,UAA2B;AAC3D,yBAAmB,QAAQ,QAAQ,GAAG,YAAY;AAAA;AAGpD,UAAM,aAAaC,aAAS;AAAA,SACvBC,WAAO;AAAA,MACV,MAAM;AAAA,MACN,KAAK;AAAA,MACL;AAAA;AAGF,kBAAU,MAAM;AACd,UAAI,MAAM,MAAM;AACd,cAAM,QAAQ,WAAW;AACzB,uBAAgB,MAAM,QAAQ,SAAS,CAAC,GAAG,SAAS;AAAA;AAAA;AAIxD,gBAAQC,oBAAe;AAEvB,UAAM,gBAAgBL,aAAS,MAAM;AAAA,MACnC;AAAA,QACE,0BAA0B,OAAO;AAAA,QACjC,YAAY,cAAc,UAAU;AAAA,QACpC,iBAAiB,cAAc,UAAU;AAAA,QACzC,cAAc,cAAc,UAAU;AAAA,QACtC,eAAe,WAAW,SAAS,MAAM;AAAA,QACzC,kBAAkB,OAAO;AAAA;AAAA,MAE3B,UAAU,QAAQ,iBAAiB,UAAU,UAAU;AAAA;AAGzD,UAAM,kBAAkBA,aAAS,MAAM;AACrC,aACE,cAAc,UAAU,WACxB,MAAM,eACN,OAAO;AAAA;AAIX,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;;"}
|
package/lib/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.js
CHANGED
|
@@ -24,7 +24,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
24
24
|
for: _ctx.labelFor,
|
|
25
25
|
class: "el-form-item__label",
|
|
26
26
|
style: vue.normalizeStyle(_ctx.labelStyle),
|
|
27
|
-
widget:
|
|
27
|
+
widget: `${_ctx.widget ? "form-item:label:" + _ctx.widget.split(":")[1] : ""}`
|
|
28
28
|
}, [
|
|
29
29
|
vue.renderSlot(_ctx.$slots, "label", {
|
|
30
30
|
label: _ctx.label + _ctx.elForm.labelSuffix
|
|
@@ -38,7 +38,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
38
38
|
vue.createElementVNode("div", {
|
|
39
39
|
class: "el-form-item__content",
|
|
40
40
|
style: vue.normalizeStyle(_ctx.contentStyle),
|
|
41
|
-
widget:
|
|
41
|
+
widget: `${_ctx.widget ? "form-item:default:" + _ctx.widget.split(":")[1] : ""}`
|
|
42
42
|
}, [
|
|
43
43
|
vue.renderSlot(_ctx.$slots, "default"),
|
|
44
44
|
vue.createVNode(vue.Transition, { name: "el-zoom-in-top" }, {
|
package/lib/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-item.vue_vue&type=template&id=24eda48b&lang.js","sources":["../../../../../../../packages/components/form/src/form-item.vue?vue&type=template&id=24eda48b&lang.js"],"sourcesContent":["<template>\n <div ref=\"formItemRef\" class=\"el-form-item\" :class=\"formItemClass\"\n :widget=\"widget\"\n >\n <LabelWrap\n :is-auto-width=\"labelStyle.width === 'auto'\"\n :update-all=\"elForm.labelWidth === 'auto'\"\n >\n <label\n v-if=\"label || $slots.label\"\n :for=\"labelFor\"\n class=\"el-form-item__label\"\n :style=\"labelStyle\"\n :widget=\"
|
|
1
|
+
{"version":3,"file":"form-item.vue_vue&type=template&id=24eda48b&lang.js","sources":["../../../../../../../packages/components/form/src/form-item.vue?vue&type=template&id=24eda48b&lang.js"],"sourcesContent":["<template>\n <div ref=\"formItemRef\" class=\"el-form-item\" :class=\"formItemClass\"\n :widget=\"widget\"\n >\n <LabelWrap\n :is-auto-width=\"labelStyle.width === 'auto'\"\n :update-all=\"elForm.labelWidth === 'auto'\"\n >\n <label\n v-if=\"label || $slots.label\"\n :for=\"labelFor\"\n class=\"el-form-item__label\"\n :style=\"labelStyle\"\n :widget=\"`${widget ? 'form-item:label:' + widget.split(':')[1] : ''}`\"\n >\n <slot name=\"label\" :label=\"label + elForm.labelSuffix\">\n {{ label + elForm.labelSuffix }}\n </slot>\n </label>\n </LabelWrap>\n <div class=\"el-form-item__content\" :style=\"contentStyle\"\n :widget=\"`${widget ? 'form-item:default:' + widget.split(':')[1] : ''}`\"\n >\n <slot></slot>\n <transition name=\"el-zoom-in-top\">\n <slot v-if=\"shouldShowError\" name=\"error\" :error=\"validateMessage\">\n <div\n class=\"el-form-item__error\"\n :class=\"{\n 'el-form-item__error--inline':\n typeof inlineMessage === 'boolean'\n ? inlineMessage\n : elForm.inlineMessage || false,\n }\"\n >\n {{ validateMessage }}\n </div>\n </slot>\n </transition>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n reactive,\n ref,\n toRefs,\n} from 'vue'\nimport { addUnit, getPropByPath, useGlobalConfig } from '@element-ps/utils/util'\nimport { isValidComponentSize } from '@element-ps/utils/validators'\nimport { elFormItemKey, elFormKey } from '@element-ps/tokens'\nimport LabelWrap from './label-wrap'\n\nimport type { PropType, CSSProperties } from 'vue'\nimport type { ComponentSize } from '@element-ps/utils/types'\nimport type { ElFormContext } from '@element-ps/tokens'\nimport type { FormItemRule } from './form.type'\n\nexport default defineComponent({\n name: 'PsFormItem',\n componentName: 'PsFormItem',\n components: {\n LabelWrap,\n },\n props: {\n label: String,\n labelWidth: {\n type: [String, Number],\n default: '',\n },\n prop: String,\n required: {\n type: Boolean,\n default: undefined,\n },\n rules: [Object, Array] as PropType<FormItemRule | FormItemRule[]>,\n error: String,\n validateStatus: String,\n for: String,\n inlineMessage: {\n type: [String, Boolean],\n default: '',\n },\n showMessage: {\n type: Boolean,\n default: true,\n },\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n widget: {\n type: String,\n },\n },\n setup(props, { slots }) {\n const $ELEMENT = useGlobalConfig()\n\n const elForm = inject(elFormKey, {} as ElFormContext)\n const validateState = ref('')\n const validateMessage = ref('')\n\n const computedLabelWidth = ref('')\n\n const formItemRef = ref<HTMLDivElement>()\n\n const vm = getCurrentInstance()\n const isNested = computed(() => {\n let parent = vm.parent\n while (parent && parent.type.name !== 'PsForm') {\n if (parent.type.name === 'PsFormItem') {\n return true\n }\n parent = parent.parent\n }\n return false\n })\n\n let initialValue = undefined\n\n const labelFor = computed(() => props.for || props.prop)\n const labelStyle = computed(() => {\n const ret: CSSProperties = {}\n if (elForm.labelPosition === 'top') return ret\n const labelWidth = addUnit(props.labelWidth || elForm.labelWidth)\n if (labelWidth) {\n ret.width = labelWidth\n }\n return ret\n })\n const contentStyle = computed(() => {\n const ret: CSSProperties = {}\n if (elForm.labelPosition === 'top' || elForm.inline) {\n return ret\n }\n if (!props.label && !props.labelWidth && isNested.value) {\n return ret\n }\n const labelWidth = addUnit(props.labelWidth || elForm.labelWidth)\n if (!props.label && !slots.label) {\n ret.marginLeft = labelWidth\n }\n return ret\n })\n const fieldValue = computed(() => {\n const model = elForm.model\n if (!model || !props.prop) {\n return\n }\n\n let path = props.prop\n if (path.indexOf(':') !== -1) {\n path = path.replace(/:/, '.')\n }\n\n return getPropByPath(model, path, true).v\n })\n const isRequired = computed(() => {\n const rules = getRules()\n let required = false\n\n if (rules && rules.length) {\n rules.every((rule) => {\n if (rule.required) {\n required = true\n return false\n }\n return true\n })\n }\n return required\n })\n const elFormItemSize = computed(() => props.size || elForm.size)\n const sizeClass = computed<ComponentSize>(() => {\n return elFormItemSize.value || $ELEMENT.size\n })\n\n const getRules = () => {\n const formRules = elForm.rules\n const selfRules = props.rules\n const requiredRule =\n props.required !== undefined ? { required: !!props.required } : []\n\n const prop = getPropByPath(formRules, props.prop || '', false)\n const normalizedRule = formRules ? prop.o[props.prop || ''] || prop.v : []\n\n return [].concat(selfRules || normalizedRule || []).concat(requiredRule)\n }\n\n const updateComputedLabelWidth = (width: string | number) => {\n computedLabelWidth.value = width ? `${width}px` : ''\n }\n\n const elFormItem = reactive({\n ...toRefs(props),\n size: sizeClass,\n $el: formItemRef,\n updateComputedLabelWidth,\n })\n\n onMounted(() => {\n if (props.prop) {\n const value = fieldValue.value\n initialValue = (Array.isArray(value) ? [...value] : value) as any\n }\n })\n\n provide(elFormItemKey, elFormItem as any)\n\n const formItemClass = computed(() => [\n {\n 'el-form-item--feedback': elForm.statusIcon,\n 'is-error': validateState.value === 'error',\n 'is-validating': validateState.value === 'validating',\n 'is-success': validateState.value === 'success',\n 'is-required': isRequired.value || props.required,\n 'is-no-asterisk': elForm.hideRequiredAsterisk,\n },\n sizeClass.value ? `el-form-item--${sizeClass.value}` : '',\n ])\n\n const shouldShowError = computed(() => {\n return (\n validateState.value === 'error' &&\n props.showMessage &&\n elForm.showMessage\n )\n })\n\n return {\n formItemRef,\n formItemClass,\n shouldShowError,\n elForm,\n labelStyle,\n contentStyle,\n validateMessage,\n labelFor,\n }\n },\n})\n</script>\n"],"names":["_createElementBlock","_createVNode","_renderSlot","_createElementVNode"],"mappings":";;;;;;;;;;;0BACEA;IAAK,KAAI;AAAA,IAAc,2BAAM,gBAAuB;IAC9C,QAAQ;;IAEZC;MACG,iBAAe,gBAAW;MAC1B,cAAY,YAAO;;2BAEpB;QACQ,cAAS,YAAO,0BADxBD;;UAEG,KAAK;UACN,OAAM;AAAA,UACL,0BAAO;UACP,WAAW,mCAA8B,YAAO;;UAEjDE;YAAoB,OAAO,aAAQ,YAAO;AAAA,aAA1C;oDACK,aAAQ,YAAO;;;;;;IAIxBC;MAAK,OAAM;AAAA,MAAyB,0BAAO;MACrC,WAAW,qCAAgC,YAAO;;MAEtDD;MACAD,kCAAY,MAAK;6BACf;UAAY,uBAAZC;;YAA2C,OAAO;aAAlD;YACEC;cACE,2BAAM;;;mCAQH;;;;;;;;;;;"}
|
|
@@ -70,12 +70,12 @@ var index$11 = require('./upload/index.js');
|
|
|
70
70
|
require('./virtual-list/index.js');
|
|
71
71
|
var index$12 = require('./loading/index.js');
|
|
72
72
|
var index$13 = require('./popover/index.js');
|
|
73
|
-
var affix = require('./affix/src/
|
|
73
|
+
var affix = require('./affix/src/affix2.js');
|
|
74
74
|
var alert = require('./alert/src/alert2.js');
|
|
75
75
|
var avatar = require('./avatar/src/avatar.js');
|
|
76
76
|
var backtop = require('./backtop/src/backtop.js');
|
|
77
|
-
var badge = require('./badge/src/
|
|
78
|
-
var breadcrumb = require('./breadcrumb/src/
|
|
77
|
+
var badge = require('./badge/src/badge.js');
|
|
78
|
+
var breadcrumb = require('./breadcrumb/src/breadcrumb.js');
|
|
79
79
|
var breadcrumbItem = require('./breadcrumb/src/breadcrumb-item.js');
|
|
80
80
|
var button = require('./button/src/button.js');
|
|
81
81
|
var card = require('./card/src/card.js');
|
|
@@ -90,12 +90,12 @@ var empty = require('./empty/src/empty.js');
|
|
|
90
90
|
var icon = require('./icon/src/icon.js');
|
|
91
91
|
var image = require('./image/src/image.js');
|
|
92
92
|
var imageViewer = require('./image-viewer/src/image-viewer.js');
|
|
93
|
-
var input = require('./input/src/
|
|
93
|
+
var input = require('./input/src/input.js');
|
|
94
94
|
var inputNumber = require('./input-number/src/input-number.js');
|
|
95
|
-
var link = require('./link/src/
|
|
95
|
+
var link = require('./link/src/link2.js');
|
|
96
96
|
var menu = require('./menu/src/menu.js');
|
|
97
97
|
var menuItem = require('./menu/src/menu-item.js');
|
|
98
|
-
var menuItemGroup = require('./menu/src/menu-item-
|
|
98
|
+
var menuItemGroup = require('./menu/src/menu-item-group2.js');
|
|
99
99
|
var subMenu = require('./menu/src/sub-menu.js');
|
|
100
100
|
var overlay = require('./overlay/src/overlay.js');
|
|
101
101
|
var pageHeader = require('./page-header/src/page-header.js');
|
|
@@ -112,7 +112,7 @@ var token = require('./select/src/token.js');
|
|
|
112
112
|
var token$1 = require('./select-v2/src/token.js');
|
|
113
113
|
var space = require('./space/src/space.js');
|
|
114
114
|
var useSpace = require('./space/src/use-space.js');
|
|
115
|
-
var tag = require('./tag/src/
|
|
115
|
+
var tag = require('./tag/src/tag.js');
|
|
116
116
|
var dateUtils = require('./time-picker/src/common/date-utils.js');
|
|
117
117
|
var constant = require('./time-picker/src/common/constant.js');
|
|
118
118
|
var props = require('./time-picker/src/common/props.js');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var withInstall = require('../../utils/with-install.js');
|
|
6
|
-
require('./src/
|
|
7
|
-
var input = require('./src/
|
|
6
|
+
require('./src/input2.js');
|
|
7
|
+
var input = require('./src/input.js');
|
|
8
8
|
var input_vue_vue_type_script_lang = require('./src/input.vue_vue&type=script&lang.js');
|
|
9
9
|
|
|
10
10
|
const PsInput = withInstall.withInstall(input_vue_vue_type_script_lang["default"]);
|
|
@@ -2,11 +2,84 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
5
|
+
require('../../../hooks/index.js');
|
|
6
|
+
var props = require('../../../utils/props.js');
|
|
7
|
+
var index = require('../../../hooks/use-form-item/index.js');
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const inputProps = props.buildProps({
|
|
10
|
+
...index.useFormItemProps,
|
|
11
|
+
_modelValue: {
|
|
12
|
+
type: props.definePropType(void 0),
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
type: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "text"
|
|
18
|
+
},
|
|
19
|
+
resize: {
|
|
20
|
+
type: String,
|
|
21
|
+
values: ["none", "both", "horizontal", "vertical"]
|
|
22
|
+
},
|
|
23
|
+
autosize: {
|
|
24
|
+
type: props.definePropType([Boolean, Object]),
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
autocomplete: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "off"
|
|
30
|
+
},
|
|
31
|
+
placeholder: {
|
|
32
|
+
type: String
|
|
33
|
+
},
|
|
34
|
+
form: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
readonly: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
clearable: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
showPassword: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
showWordLimit: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
suffixIcon: {
|
|
55
|
+
type: props.definePropType([String, Object]),
|
|
56
|
+
default: ""
|
|
57
|
+
},
|
|
58
|
+
prefixIcon: {
|
|
59
|
+
type: props.definePropType([String, Object]),
|
|
60
|
+
default: ""
|
|
61
|
+
},
|
|
62
|
+
label: {
|
|
63
|
+
type: String
|
|
64
|
+
},
|
|
65
|
+
tabindex: {
|
|
66
|
+
type: [Number, String]
|
|
67
|
+
},
|
|
68
|
+
validateEvent: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: true
|
|
71
|
+
},
|
|
72
|
+
inputStyle: {
|
|
73
|
+
type: props.definePropType([Object, Array, String]),
|
|
74
|
+
default: () => props.mutable({})
|
|
75
|
+
},
|
|
76
|
+
maxlength: {
|
|
77
|
+
type: [Number, String]
|
|
78
|
+
},
|
|
79
|
+
widget: {
|
|
80
|
+
type: String
|
|
81
|
+
}
|
|
82
|
+
});
|
|
10
83
|
|
|
11
|
-
exports
|
|
84
|
+
exports.inputProps = inputProps;
|
|
12
85
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../../../../../../packages/components/input/src/input.ts"],"sourcesContent":["import { useFormItemProps } from '@element-ps/hooks'\nimport { buildProps, definePropType, mutable } from '@element-ps/utils/props'\nimport type { StyleValue } from '@element-ps/utils/types'\nimport type { ExtractPropTypes, Component } from 'vue'\n\ntype AutoSize = { minRows?: number; maxRows?: number } | boolean\n\nexport const inputProps = buildProps({\n ...useFormItemProps,\n _modelValue: {\n type: definePropType<string | number | null | undefined>(undefined),\n default: '',\n },\n type: {\n type: String,\n default: 'text',\n },\n resize: {\n type: String,\n values: ['none', 'both', 'horizontal', 'vertical'],\n },\n autosize: {\n type: definePropType<AutoSize>([Boolean, Object]),\n default: false,\n },\n autocomplete: {\n type: String,\n default: 'off',\n },\n placeholder: {\n type: String,\n },\n form: {\n type: String,\n default: '',\n },\n readonly: {\n type: Boolean,\n default: false,\n },\n clearable: {\n type: Boolean,\n default: false,\n },\n showPassword: {\n type: Boolean,\n default: false,\n },\n showWordLimit: {\n type: Boolean,\n default: false,\n },\n suffixIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: '',\n },\n prefixIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: '',\n },\n label: {\n type: String,\n },\n tabindex: {\n type: [Number, String],\n },\n validateEvent: {\n type: Boolean,\n default: true,\n },\n inputStyle: {\n type: definePropType<StyleValue>([Object, Array, String]),\n default: () => mutable({} as const),\n },\n maxlength: {\n type: [Number, String],\n },\n widget: {\n type: String,\n },\n} as const)\nexport type InputProps = ExtractPropTypes<typeof inputProps>\n"],"names":["buildProps","useFormItemProps","definePropType","mutable"],"mappings":";;;;;;;;MAOa,aAAaA,iBAAW;AAAA,KAChCC;AAAA,EACH,aAAa;AAAA,IACX,MAAMC,qBAAmD;AAAA,IACzD,SAAS;AAAA;AAAA,EAEX,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,QAAQ,CAAC,QAAQ,QAAQ,cAAc;AAAA;AAAA,EAEzC,UAAU;AAAA,IACR,MAAMA,qBAAyB,CAAC,SAAS;AAAA,IACzC,SAAS;AAAA;AAAA,EAEX,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,aAAa;AAAA,IACX,MAAM;AAAA;AAAA,EAER,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,UAAU;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,WAAW;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,eAAe;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,YAAY;AAAA,IACV,MAAMA,qBAAmC,CAAC,QAAQ;AAAA,IAClD,SAAS;AAAA;AAAA,EAEX,YAAY;AAAA,IACV,MAAMA,qBAAmC,CAAC,QAAQ;AAAA,IAClD,SAAS;AAAA;AAAA,EAEX,OAAO;AAAA,IACL,MAAM;AAAA;AAAA,EAER,UAAU;AAAA,IACR,MAAM,CAAC,QAAQ;AAAA;AAAA,EAEjB,eAAe;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,YAAY;AAAA,IACV,MAAMA,qBAA2B,CAAC,QAAQ,OAAO;AAAA,IACjD,SAAS,MAAMC,cAAQ;AAAA;AAAA,EAEzB,WAAW;AAAA,IACT,MAAM,CAAC,QAAQ;AAAA;AAAA,EAEjB,QAAQ;AAAA,IACN,MAAM;AAAA;AAAA;;;;"}
|
|
@@ -9,7 +9,7 @@ var constants = require('../../../utils/constants.js');
|
|
|
9
9
|
require('../../../utils/util.js');
|
|
10
10
|
var isServer = require('../../../utils/isServer.js');
|
|
11
11
|
var calcTextareaHeight = require('./calc-textarea-height.js');
|
|
12
|
-
var input = require('./
|
|
12
|
+
var input = require('./input.js');
|
|
13
13
|
var index = require('../../icon/index.js');
|
|
14
14
|
var icons = require('@element-plus/icons');
|
|
15
15
|
var index$1 = require('../../../hooks/use-attrs/index.js');
|
|
@@ -51,7 +51,7 @@ var script = vue.defineComponent({
|
|
|
51
51
|
_textareaCalcStyle.value,
|
|
52
52
|
{ resize: props.resize }
|
|
53
53
|
]);
|
|
54
|
-
const nativeInputValue = vue.computed(() => props.
|
|
54
|
+
const nativeInputValue = vue.computed(() => props._modelValue === null || props._modelValue === void 0 ? "" : String(props._modelValue));
|
|
55
55
|
const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
|
|
56
56
|
const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !props.readonly && (!!nativeInputValue.value || focused.value));
|
|
57
57
|
const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
|
|
@@ -99,7 +99,7 @@ var script = vue.defineComponent({
|
|
|
99
99
|
calcIconOffset("suffix");
|
|
100
100
|
};
|
|
101
101
|
const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
|
|
102
|
-
vue.watch(() => props.
|
|
102
|
+
vue.watch(() => props._modelValue, () => {
|
|
103
103
|
var _a;
|
|
104
104
|
vue.nextTick(resizeTextarea);
|
|
105
105
|
if (props.validateEvent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.vue_vue&type=script&lang.js","sources":["../../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n v-show=\"type !== 'hidden'\"\n :class=\"[\n type === 'textarea' ? 'el-textarea' : 'el-input',\n inputSize ? 'el-input--' + inputSize : '',\n {\n 'is-disabled': inputDisabled,\n 'is-exceed': inputExceed,\n 'el-input-group': $slots.prepend || $slots.append,\n 'el-input-group--append': $slots.append,\n 'el-input-group--prepend': $slots.prepend,\n 'el-input--prefix': $slots.prefix || prefixIcon,\n 'el-input--suffix':\n $slots.suffix || suffixIcon || clearable || showPassword,\n 'el-input--suffix--password-clear': clearable && showPassword,\n },\n $attrs.class,\n ]\"\n :style=\"containerStyle\"\n :widget=\"widget\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" class=\"el-input-group__prepend\">\n <slot name=\"prepend\" />\n </div>\n\n <input\n ref=\"input\"\n class=\"el-input__inner\"\n v-bind=\"attrs\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n />\n\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" class=\"el-input__prefix\">\n <span class=\"el-input__prefix-inner\">\n <slot name=\"prefix\"></slot>\n <ps-icon v-if=\"prefixIcon\" class=\"el-input__icon\">\n <component :is=\"prefixIcon\" />\n </ps-icon>\n </span>\n </span>\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" class=\"el-input__suffix\">\n <span class=\"el-input__suffix-inner\">\n <template v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\">\n <slot name=\"suffix\"></slot>\n <ps-icon v-if=\"suffixIcon\" class=\"el-input__icon\">\n <component :is=\"suffixIcon\" />\n </ps-icon>\n </template>\n <ps-icon v-if=\"showClear\" class=\"el-input__icon el-input__clear\">\n <circle-close />\n </ps-icon>\n <ps-icon v-if=\"showPwdVisible\" class=\"el-input__icon el-input__clear\">\n <icon-view />\n </ps-icon>\n <span v-if=\"isWordLimitVisible\" class=\"el-input__count\">\n <span class=\"el-input__count-inner\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </span>\n </span>\n <ps-icon\n v-if=\"validateState && validateIcon\"\n class=\"el-input__icon el-input__validateIcon\"\n >\n <component :is=\"validateIcon\" />\n </ps-icon>\n </span>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" class=\"el-input-group__append\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n ref=\"textarea\"\n class=\"el-textarea__inner\"\n v-bind=\"attrs\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"computedTextareaStyle\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n />\n <span v-if=\"isWordLimitVisible\" class=\"el-input__count\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n defineComponent,\n inject,\n computed,\n watch,\n nextTick,\n getCurrentInstance,\n ref,\n shallowRef,\n onMounted,\n onUpdated,\n} from 'vue'\nimport { elFormKey, elFormItemKey } from '@element-ps/tokens'\nimport { useAttrs, useFormItem } from '@element-ps/hooks'\nimport { VALIDATE_STATE_MAP } from '@element-ps/utils/constants'\nimport { isObject } from '@element-ps/utils/util'\nimport isServer from '@element-ps/utils/isServer'\nimport { calcTextareaHeight } from './calc-textarea-height'\nimport { inputProps } from './input'\nimport type { StyleValue } from '@element-ps/utils/types'\nimport { PsIcon } from '@element-ps/components/icon'\nimport { CircleClose, View as IconView } from '@element-plus/icons'\n\nconst PENDANT_MAP = {\n suffix: 'append',\n prefix: 'prepend',\n} as const\n\nexport default defineComponent({\n name: 'PsInput',\n inheritAttrs: false,\n components: { PsIcon, CircleClose, IconView },\n props: inputProps,\n\n setup(props, { slots, attrs: rawAttrs }) {\n const instance = getCurrentInstance()!\n const attrs = useAttrs()\n\n const elForm = inject(elFormKey, undefined)\n const elFormItem = inject(elFormItemKey, undefined)\n\n const { size: inputSize, disabled: inputDisabled } = useFormItem({})\n\n const input = ref<HTMLInputElement>()\n const textarea = ref<HTMLTextAreaElement>()\n const focused = ref(false)\n const hovering = ref(false)\n const passwordVisible = ref(false)\n const _textareaCalcStyle = shallowRef(props.inputStyle)\n\n const inputOrTextarea = computed(() => input.value || textarea.value)\n const needStatusIcon = computed(() => elForm?.statusIcon ?? false)\n const validateState = computed(() => elFormItem?.validateState || '')\n const validateIcon = computed(() => VALIDATE_STATE_MAP[validateState.value])\n const containerStyle = computed(() => rawAttrs.style as StyleValue)\n const computedTextareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n _textareaCalcStyle.value,\n { resize: props.resize },\n ])\n const nativeInputValue = computed(() =>\n props.modelValue === null || props.modelValue === undefined\n ? ''\n : String(props.modelValue)\n )\n const showClear = computed(\n () =>\n props.clearable &&\n !inputDisabled.value &&\n !props.readonly &&\n !!nativeInputValue.value &&\n (focused.value || hovering.value)\n )\n const showPwdVisible = computed(\n () =>\n props.showPassword &&\n !inputDisabled.value &&\n !props.readonly &&\n (!!nativeInputValue.value || focused.value)\n )\n const isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!attrs.value.maxlength &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n )\n const textLength = computed(() => Array.from(nativeInputValue.value).length)\n const inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value &&\n textLength.value > Number(attrs.value.maxlength)\n )\n\n const resizeTextarea = () => {\n const { type, autosize } = props\n\n if (isServer || type !== 'textarea') return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n _textareaCalcStyle.value = {\n ...calcTextareaHeight(textarea.value!, minRows, maxRows),\n }\n } else {\n _textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value!).minHeight,\n }\n }\n }\n\n const setNativeInputValue = () => {\n const input = inputOrTextarea.value\n if (!input || input.value === nativeInputValue.value) return\n input.value = nativeInputValue.value\n }\n\n const calcIconOffset = (place: 'prefix' | 'suffix') => {\n const { el } = instance.vnode\n if (!el) return\n const elList: HTMLSpanElement[] = Array.from(\n el.querySelectorAll(`.el-input__${place}`)\n )\n const target = elList.find((item) => item.parentNode === el)\n\n if (!target) return\n\n const pendant = PENDANT_MAP[place]\n\n if (slots[pendant]) {\n target.style.transform = `translateX(${place === 'suffix' ? '-' : ''}${\n el.querySelector(`.el-input-group__${pendant}`).offsetWidth\n }px)`\n } else {\n target.removeAttribute('style')\n }\n }\n\n const updateIconOffset = () => {\n calcIconOffset('prefix')\n calcIconOffset('suffix')\n }\n\n const suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n showClear.value ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n )\n\n watch(\n () => props.modelValue,\n () => {\n nextTick(resizeTextarea)\n if (props.validateEvent) {\n elFormItem?.validate?.('change')\n }\n }\n )\n\n // native input value is set explicitly\n // do not use v-model / :value in template\n // see: https://github.com/ElemeFE/element/issues/14521\n watch(nativeInputValue, () => setNativeInputValue())\n\n // when change between <input> and <textarea>,\n // update DOM dependent value and styles\n // https://github.com/ElemeFE/element/issues/14857\n watch(\n () => props.type,\n () => {\n nextTick(() => {\n setNativeInputValue()\n resizeTextarea()\n updateIconOffset()\n })\n }\n )\n\n onMounted(() => {\n setNativeInputValue()\n updateIconOffset()\n nextTick(resizeTextarea)\n })\n\n onUpdated(() => {\n nextTick(updateIconOffset)\n })\n\n return {\n input,\n textarea,\n attrs,\n inputSize,\n validateState,\n validateIcon,\n containerStyle,\n computedTextareaStyle,\n inputDisabled,\n showClear,\n showPwdVisible,\n isWordLimitVisible,\n textLength,\n hovering,\n inputExceed,\n passwordVisible,\n inputOrTextarea,\n suffixVisible,\n }\n },\n})\n</script>\n"],"names":["defineComponent","PsIcon","CircleClose","IconView","inputProps","getCurrentInstance","useAttrs","inject","elFormKey","elFormItemKey","useFormItem","ref","shallowRef","computed","VALIDATE_STATE_MAP","isServer","isObject","calcTextareaHeight"],"mappings":";;;;;;;;;;;;;;;;;;;AAqIA,MAAM,cAAc;AAAA,EAClB,QAAQ;AAAA,EACR,QAAQ;AAAA;AAGV,aAAeA,oBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,YAAY,UAAEC,2BAAQC,6BAAaC;AAAA,EACnC,OAAOC;AAAA,EAEP,MAAM,OAAO,EAAE,OAAO,OAAO,YAAY;AACvC,UAAM,WAAWC;AACjB,UAAM,QAAQC;AAEd,UAAM,SAASC,WAAOC,gBAAW;AACjC,UAAM,aAAaD,WAAOE,oBAAe;AAEzC,UAAM,EAAE,MAAM,WAAW,UAAU,kBAAkBC,oBAAY;AAEjE,UAAM,QAAQC;AACd,UAAM,WAAWA;AACjB,UAAM,UAAUA,QAAI;AACpB,UAAM,WAAWA,QAAI;AACrB,UAAM,kBAAkBA,QAAI;AAC5B,UAAM,qBAAqBC,eAAW,MAAM;AAE5C,UAAM,kBAAkBC,aAAS,MAAM,MAAM,SAAS,SAAS;AAC/D,UAAM,iBAAiBA,aAAS,MAAG;;AAAG,oDAAQ,eAAR,YAAsB;AAAA;AAC5D,UAAM,gBAAgBA,aAAS,MAAM,0CAAY,kBAAiB;AAClE,UAAM,eAAeA,aAAS,MAAMC,6BAAmB,cAAc;AACrE,UAAM,iBAAiBD,aAAS,MAAM,SAAS;AAC/C,UAAM,wBAAwBA,aAAqB,MAAM;AAAA,MACvD,MAAM;AAAA,MACN,mBAAmB;AAAA,MACnB,EAAE,QAAQ,MAAM;AAAA;AAElB,UAAM,mBAAmBA,aAAS,MAChC,MAAM,eAAe,QAAQ,MAAM,eAAe,SAC9C,KACA,OAAO,MAAM;AAEnB,UAAM,YAAYA,aAChB,MACE,MAAM,aACN,CAAC,cAAc,SACf,CAAC,MAAM,YACP,CAAC,CAA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AAc,UAAU,WAAW,MAAM,KAChE,GAAG,cAAc,oBAAoB,WAAW;AAAA,aAE7C;AACL,eAAO,gBAAgB;AAAA;AAAA;AAI3B,UAAM,mBAAmB,MAAM;AAC7B,qBAAe;AACf,qBAAe;AAAA;AAGjB,UAAM,gBAAgBJ,aACpB,MACE,CAAC,CAAC,MAAM,UACR,CAAC,CAAC,MAAM,cACR,UAAU,SACV,MAAM,gBACN,mBAAmB,SAClB,CAAC,CAAC,cAAc,SAAS,eAAe;AAG7C,cACE,MAAM,MAAM,YACZ,MAAM;;AACJ,mBAAS;AACT,UAAI,MAAM,eAAe;AACvB,uDAAY,aAAZ,oCAAuB;AAAA;AAAA;AAQ7B,cAAM,kBAAkB,MAAM;AAK9B,cACE,MAAM,MAAM,MACZ,MAAM;AACJ,mBAAS,MAAM;AACb;AACA;AACA;AAAA;AAAA;AAKN,kBAAU,MAAM;AACd;AACA;AACA,mBAAS;AAAA;AAGX,kBAAU,MAAM;AACd,mBAAS;AAAA;AAGX,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"input.vue_vue&type=script&lang.js","sources":["../../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n v-show=\"type !== 'hidden'\"\n :class=\"[\n type === 'textarea' ? 'el-textarea' : 'el-input',\n inputSize ? 'el-input--' + inputSize : '',\n {\n 'is-disabled': inputDisabled,\n 'is-exceed': inputExceed,\n 'el-input-group': $slots.prepend || $slots.append,\n 'el-input-group--append': $slots.append,\n 'el-input-group--prepend': $slots.prepend,\n 'el-input--prefix': $slots.prefix || prefixIcon,\n 'el-input--suffix':\n $slots.suffix || suffixIcon || clearable || showPassword,\n 'el-input--suffix--password-clear': clearable && showPassword,\n },\n $attrs.class,\n ]\"\n :style=\"containerStyle\"\n :widget=\"widget || undefined\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" class=\"el-input-group__prepend\">\n <slot name=\"prepend\" />\n </div>\n\n <input\n ref=\"input\"\n class=\"el-input__inner\"\n v-bind=\"attrs\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n />\n\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" class=\"el-input__prefix\">\n <span class=\"el-input__prefix-inner\">\n <slot name=\"prefix\"></slot>\n <ps-icon v-if=\"prefixIcon\" class=\"el-input__icon\">\n <component :is=\"prefixIcon\" />\n </ps-icon>\n </span>\n </span>\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" class=\"el-input__suffix\">\n <span class=\"el-input__suffix-inner\">\n <template v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\">\n <slot name=\"suffix\"></slot>\n <ps-icon v-if=\"suffixIcon\" class=\"el-input__icon\">\n <component :is=\"suffixIcon\" />\n </ps-icon>\n </template>\n <ps-icon v-if=\"showClear\" class=\"el-input__icon el-input__clear\">\n <circle-close />\n </ps-icon>\n <ps-icon v-if=\"showPwdVisible\" class=\"el-input__icon el-input__clear\">\n <icon-view />\n </ps-icon>\n <span v-if=\"isWordLimitVisible\" class=\"el-input__count\">\n <span class=\"el-input__count-inner\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </span>\n </span>\n <ps-icon\n v-if=\"validateState && validateIcon\"\n class=\"el-input__icon el-input__validateIcon\"\n >\n <component :is=\"validateIcon\" />\n </ps-icon>\n </span>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" class=\"el-input-group__append\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n ref=\"textarea\"\n class=\"el-textarea__inner\"\n v-bind=\"attrs\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"computedTextareaStyle\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n />\n <span v-if=\"isWordLimitVisible\" class=\"el-input__count\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n defineComponent,\n inject,\n computed,\n watch,\n nextTick,\n getCurrentInstance,\n ref,\n shallowRef,\n onMounted,\n onUpdated,\n} from 'vue'\nimport { elFormKey, elFormItemKey } from '@element-ps/tokens'\nimport { useAttrs, useFormItem } from '@element-ps/hooks'\nimport { VALIDATE_STATE_MAP } from '@element-ps/utils/constants'\nimport { isObject } from '@element-ps/utils/util'\nimport isServer from '@element-ps/utils/isServer'\nimport { calcTextareaHeight } from './calc-textarea-height'\nimport { inputProps } from './input'\nimport type { StyleValue } from '@element-ps/utils/types'\nimport { PsIcon } from '@element-ps/components/icon'\nimport { CircleClose, View as IconView } from '@element-plus/icons'\n\nconst PENDANT_MAP = {\n suffix: 'append',\n prefix: 'prepend',\n} as const\n\nexport default defineComponent({\n name: 'PsInput',\n inheritAttrs: false,\n components: { PsIcon, CircleClose, IconView },\n props: inputProps,\n\n setup(props, { slots, attrs: rawAttrs }) {\n const instance = getCurrentInstance()!\n const attrs = useAttrs()\n\n const elForm = inject(elFormKey, undefined)\n const elFormItem = inject(elFormItemKey, undefined)\n\n const { size: inputSize, disabled: inputDisabled } = useFormItem({})\n\n const input = ref<HTMLInputElement>()\n const textarea = ref<HTMLTextAreaElement>()\n const focused = ref(false)\n const hovering = ref(false)\n const passwordVisible = ref(false)\n const _textareaCalcStyle = shallowRef(props.inputStyle)\n\n const inputOrTextarea = computed(() => input.value || textarea.value)\n const needStatusIcon = computed(() => elForm?.statusIcon ?? false)\n const validateState = computed(() => elFormItem?.validateState || '')\n const validateIcon = computed(() => VALIDATE_STATE_MAP[validateState.value])\n const containerStyle = computed(() => rawAttrs.style as StyleValue)\n const computedTextareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n _textareaCalcStyle.value,\n { resize: props.resize },\n ])\n const nativeInputValue = computed(() =>\n props._modelValue === null || props._modelValue === undefined\n ? ''\n : String(props._modelValue)\n )\n const showClear = computed(\n () =>\n props.clearable &&\n !inputDisabled.value &&\n !props.readonly &&\n !!nativeInputValue.value &&\n (focused.value || hovering.value)\n )\n const showPwdVisible = computed(\n () =>\n props.showPassword &&\n !inputDisabled.value &&\n !props.readonly &&\n (!!nativeInputValue.value || focused.value)\n )\n const isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!attrs.value.maxlength &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n )\n const textLength = computed(() => Array.from(nativeInputValue.value).length)\n const inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value &&\n textLength.value > Number(attrs.value.maxlength)\n )\n\n const resizeTextarea = () => {\n const { type, autosize } = props\n\n if (isServer || type !== 'textarea') return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n _textareaCalcStyle.value = {\n ...calcTextareaHeight(textarea.value!, minRows, maxRows),\n }\n } else {\n _textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value!).minHeight,\n }\n }\n }\n\n const setNativeInputValue = () => {\n const input = inputOrTextarea.value\n if (!input || input.value === nativeInputValue.value) return\n input.value = nativeInputValue.value\n }\n\n const calcIconOffset = (place: 'prefix' | 'suffix') => {\n const { el } = instance.vnode\n if (!el) return\n const elList: HTMLSpanElement[] = Array.from(\n el.querySelectorAll(`.el-input__${place}`)\n )\n const target = elList.find((item) => item.parentNode === el)\n\n if (!target) return\n\n const pendant = PENDANT_MAP[place]\n\n if (slots[pendant]) {\n target.style.transform = `translateX(${place === 'suffix' ? '-' : ''}${\n el.querySelector(`.el-input-group__${pendant}`).offsetWidth\n }px)`\n } else {\n target.removeAttribute('style')\n }\n }\n\n const updateIconOffset = () => {\n calcIconOffset('prefix')\n calcIconOffset('suffix')\n }\n\n const suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n showClear.value ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n )\n\n watch(\n () => props._modelValue,\n () => {\n nextTick(resizeTextarea)\n if (props.validateEvent) {\n elFormItem?.validate?.('change')\n }\n }\n )\n\n // native input value is set explicitly\n // do not use v-model / :value in template\n // see: https://github.com/ElemeFE/element/issues/14521\n watch(nativeInputValue, () => setNativeInputValue())\n\n // when change between <input> and <textarea>,\n // update DOM dependent value and styles\n // https://github.com/ElemeFE/element/issues/14857\n watch(\n () => props.type,\n () => {\n nextTick(() => {\n setNativeInputValue()\n resizeTextarea()\n updateIconOffset()\n })\n }\n )\n\n onMounted(() => {\n setNativeInputValue()\n updateIconOffset()\n nextTick(resizeTextarea)\n })\n\n onUpdated(() => {\n nextTick(updateIconOffset)\n })\n\n return {\n input,\n textarea,\n attrs,\n inputSize,\n validateState,\n validateIcon,\n containerStyle,\n computedTextareaStyle,\n inputDisabled,\n showClear,\n showPwdVisible,\n isWordLimitVisible,\n textLength,\n hovering,\n inputExceed,\n passwordVisible,\n inputOrTextarea,\n suffixVisible,\n }\n },\n})\n</script>\n"],"names":["defineComponent","PsIcon","CircleClose","IconView","inputProps","getCurrentInstance","useAttrs","inject","elFormKey","elFormItemKey","useFormItem","ref","shallowRef","computed","VALIDATE_STATE_MAP","isServer","isObject","calcTextareaHeight"],"mappings":";;;;;;;;;;;;;;;;;;;AAqIA,MAAM,cAAc;AAAA,EAClB,QAAQ;AAAA,EACR,QAAQ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C,CAAC,MAAM,UACR,CAAC,CAAC,MAAM,cACR,UAAU,SACV,MAAM,gBACN,mBAAmB,SAClB,CAAC,CAAC,cAAc,SAAS,eAAe;AAG7C,cACE,MAAM,MAAM,aACZ,MAAM;;AACJ,mBAAS;AACT,UAAI,MAAM,eAAe;AACvB,uDAAY,aAAZ,oCAAuB;AAAA;AAAA;AAQ7B,cAAM,kBAAkB,MAAM;AAK9B,cACE,MAAM,MAAM,MACZ,MAAM;AACJ,mBAAS,MAAM;AACb;AACA;AACA;AAAA;AAAA;AAKN,kBAAU,MAAM;AACd;AACA;AACA,mBAAS;AAAA;AAGX,kBAAU,MAAM;AACd,mBAAS;AAAA;AAGX,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;;"}
|
|
@@ -55,7 +55,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
55
55
|
_ctx.$attrs.class
|
|
56
56
|
]),
|
|
57
57
|
style: vue.normalizeStyle(_ctx.containerStyle),
|
|
58
|
-
widget: _ctx.widget
|
|
58
|
+
widget: _ctx.widget || void 0
|
|
59
59
|
}, [
|
|
60
60
|
vue.createCommentVNode(" input "),
|
|
61
61
|
_ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
package/lib/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.vue_vue&type=template&id=3290dcb6&lang.js","sources":["../../../../../../../packages/components/input/src/input.vue?vue&type=template&id=3290dcb6&lang.js"],"sourcesContent":["<template>\n <div\n v-show=\"type !== 'hidden'\"\n :class=\"[\n type === 'textarea' ? 'el-textarea' : 'el-input',\n inputSize ? 'el-input--' + inputSize : '',\n {\n 'is-disabled': inputDisabled,\n 'is-exceed': inputExceed,\n 'el-input-group': $slots.prepend || $slots.append,\n 'el-input-group--append': $slots.append,\n 'el-input-group--prepend': $slots.prepend,\n 'el-input--prefix': $slots.prefix || prefixIcon,\n 'el-input--suffix':\n $slots.suffix || suffixIcon || clearable || showPassword,\n 'el-input--suffix--password-clear': clearable && showPassword,\n },\n $attrs.class,\n ]\"\n :style=\"containerStyle\"\n :widget=\"widget\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" class=\"el-input-group__prepend\">\n <slot name=\"prepend\" />\n </div>\n\n <input\n ref=\"input\"\n class=\"el-input__inner\"\n v-bind=\"attrs\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n />\n\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" class=\"el-input__prefix\">\n <span class=\"el-input__prefix-inner\">\n <slot name=\"prefix\"></slot>\n <ps-icon v-if=\"prefixIcon\" class=\"el-input__icon\">\n <component :is=\"prefixIcon\" />\n </ps-icon>\n </span>\n </span>\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" class=\"el-input__suffix\">\n <span class=\"el-input__suffix-inner\">\n <template v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\">\n <slot name=\"suffix\"></slot>\n <ps-icon v-if=\"suffixIcon\" class=\"el-input__icon\">\n <component :is=\"suffixIcon\" />\n </ps-icon>\n </template>\n <ps-icon v-if=\"showClear\" class=\"el-input__icon el-input__clear\">\n <circle-close />\n </ps-icon>\n <ps-icon v-if=\"showPwdVisible\" class=\"el-input__icon el-input__clear\">\n <icon-view />\n </ps-icon>\n <span v-if=\"isWordLimitVisible\" class=\"el-input__count\">\n <span class=\"el-input__count-inner\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </span>\n </span>\n <ps-icon\n v-if=\"validateState && validateIcon\"\n class=\"el-input__icon el-input__validateIcon\"\n >\n <component :is=\"validateIcon\" />\n </ps-icon>\n </span>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" class=\"el-input-group__append\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n ref=\"textarea\"\n class=\"el-textarea__inner\"\n v-bind=\"attrs\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"computedTextareaStyle\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n />\n <span v-if=\"isWordLimitVisible\" class=\"el-input__count\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n defineComponent,\n inject,\n computed,\n watch,\n nextTick,\n getCurrentInstance,\n ref,\n shallowRef,\n onMounted,\n onUpdated,\n} from 'vue'\nimport { elFormKey, elFormItemKey } from '@element-ps/tokens'\nimport { useAttrs, useFormItem } from '@element-ps/hooks'\nimport { VALIDATE_STATE_MAP } from '@element-ps/utils/constants'\nimport { isObject } from '@element-ps/utils/util'\nimport isServer from '@element-ps/utils/isServer'\nimport { calcTextareaHeight } from './calc-textarea-height'\nimport { inputProps } from './input'\nimport type { StyleValue } from '@element-ps/utils/types'\nimport { PsIcon } from '@element-ps/components/icon'\nimport { CircleClose, View as IconView } from '@element-plus/icons'\n\nconst PENDANT_MAP = {\n suffix: 'append',\n prefix: 'prepend',\n} as const\n\nexport default defineComponent({\n name: 'PsInput',\n inheritAttrs: false,\n components: { PsIcon, CircleClose, IconView },\n props: inputProps,\n\n setup(props, { slots, attrs: rawAttrs }) {\n const instance = getCurrentInstance()!\n const attrs = useAttrs()\n\n const elForm = inject(elFormKey, undefined)\n const elFormItem = inject(elFormItemKey, undefined)\n\n const { size: inputSize, disabled: inputDisabled } = useFormItem({})\n\n const input = ref<HTMLInputElement>()\n const textarea = ref<HTMLTextAreaElement>()\n const focused = ref(false)\n const hovering = ref(false)\n const passwordVisible = ref(false)\n const _textareaCalcStyle = shallowRef(props.inputStyle)\n\n const inputOrTextarea = computed(() => input.value || textarea.value)\n const needStatusIcon = computed(() => elForm?.statusIcon ?? false)\n const validateState = computed(() => elFormItem?.validateState || '')\n const validateIcon = computed(() => VALIDATE_STATE_MAP[validateState.value])\n const containerStyle = computed(() => rawAttrs.style as StyleValue)\n const computedTextareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n _textareaCalcStyle.value,\n { resize: props.resize },\n ])\n const nativeInputValue = computed(() =>\n props.modelValue === null || props.modelValue === undefined\n ? ''\n : String(props.modelValue)\n )\n const showClear = computed(\n () =>\n props.clearable &&\n !inputDisabled.value &&\n !props.readonly &&\n !!nativeInputValue.value &&\n (focused.value || hovering.value)\n )\n const showPwdVisible = computed(\n () =>\n props.showPassword &&\n !inputDisabled.value &&\n !props.readonly &&\n (!!nativeInputValue.value || focused.value)\n )\n const isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!attrs.value.maxlength &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n )\n const textLength = computed(() => Array.from(nativeInputValue.value).length)\n const inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value &&\n textLength.value > Number(attrs.value.maxlength)\n )\n\n const resizeTextarea = () => {\n const { type, autosize } = props\n\n if (isServer || type !== 'textarea') return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n _textareaCalcStyle.value = {\n ...calcTextareaHeight(textarea.value!, minRows, maxRows),\n }\n } else {\n _textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value!).minHeight,\n }\n }\n }\n\n const setNativeInputValue = () => {\n const input = inputOrTextarea.value\n if (!input || input.value === nativeInputValue.value) return\n input.value = nativeInputValue.value\n }\n\n const calcIconOffset = (place: 'prefix' | 'suffix') => {\n const { el } = instance.vnode\n if (!el) return\n const elList: HTMLSpanElement[] = Array.from(\n el.querySelectorAll(`.el-input__${place}`)\n )\n const target = elList.find((item) => item.parentNode === el)\n\n if (!target) return\n\n const pendant = PENDANT_MAP[place]\n\n if (slots[pendant]) {\n target.style.transform = `translateX(${place === 'suffix' ? '-' : ''}${\n el.querySelector(`.el-input-group__${pendant}`).offsetWidth\n }px)`\n } else {\n target.removeAttribute('style')\n }\n }\n\n const updateIconOffset = () => {\n calcIconOffset('prefix')\n calcIconOffset('suffix')\n }\n\n const suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n showClear.value ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n )\n\n watch(\n () => props.modelValue,\n () => {\n nextTick(resizeTextarea)\n if (props.validateEvent) {\n elFormItem?.validate?.('change')\n }\n }\n )\n\n // native input value is set explicitly\n // do not use v-model / :value in template\n // see: https://github.com/ElemeFE/element/issues/14521\n watch(nativeInputValue, () => setNativeInputValue())\n\n // when change between <input> and <textarea>,\n // update DOM dependent value and styles\n // https://github.com/ElemeFE/element/issues/14857\n watch(\n () => props.type,\n () => {\n nextTick(() => {\n setNativeInputValue()\n resizeTextarea()\n updateIconOffset()\n })\n }\n )\n\n onMounted(() => {\n setNativeInputValue()\n updateIconOffset()\n nextTick(resizeTextarea)\n })\n\n onUpdated(() => {\n nextTick(updateIconOffset)\n })\n\n return {\n input,\n textarea,\n attrs,\n inputSize,\n validateState,\n validateIcon,\n containerStyle,\n computedTextareaStyle,\n inputDisabled,\n showClear,\n showPwdVisible,\n isWordLimitVisible,\n textLength,\n hovering,\n inputExceed,\n passwordVisible,\n inputOrTextarea,\n suffixVisible,\n }\n },\n})\n</script>\n"],"names":["_createElementBlock","_createCommentVNode","_renderSlot","_createElementVNode","_mergeProps","_createBlock","_createVNode"],"mappings":";;;;;;;;;EAyBiC,OAAM;AAAA;;;;EAmBQ,OAAM;AAAA;qBACvC,OAAM;;;EASa,OAAM;AAAA;qBACzB,OAAM;;;EAasB,OAAM;AAAA;qBAC9B,OAAM;;;EAcQ,OAAM;AAAA;;;;EAmBA,OAAM;AAAA;;;;;8CArG1CA;IAEG;;;;;;;;;;;;;;;IAgBA,0BAAO;IACP,QAAQ;;IAETC;IACgB,6CAAhBD;MACEC;MACW,YAAO,4BAAlBD,8BAAA;QACEE;;MAGFC,gCAAAC;QACE,KAAI;AAAA,QACJ,OAAM;AAAA,SACE;QACP,MAAM,oBAAgB,6CAAyC;QAC/D,UAAU;QACV,UAAU;QACV,cAAc;QACd,UAAU;QACV,cAAY;QACZ,aAAa;QACb,OAAO;;MAGVH;MACY,YAAO,UAAU,oCAA7BD,+BAAA;QACEG,+BAAA;UACED;UACe,oCAAfG;;YAA2B,OAAM;AAAA;iCAC/B;gCAAAA,4CAAgB;;;;;;MAKtBJ;MACY,uCAAZD,+BAAA;QACEG,+BAAA;WACmB,mBAAc,wBAAmB,4CAAlDH;YACEE;YACe,oCAAfG;;cAA2B,OAAM;AAAA;mCAC/B;kCAAAA,4CAAgB;;;;;UAGL,mCAAfA;;YAA0B,OAAM;AAAA;iCAC9B;cAAAC;;;;UAEa,wCAAfD;;YAA+B,OAAM;AAAA;iCACnC;cAAAC;;;;UAEU,4CAAZN,+BAAA;YACEG,+BAAA,gCACK,+CAAmB,WAAM;;;QAK1B,sBAAiB,sCADzBE;;UAEE,OAAM;AAAA;+BAEN;8BAAAA,4CAAgB;;;;;MAIpBJ;MACW,YAAO,2BAAlBD,8BAAA;QACEE;;gCAKJF;MADAC;MAEEE,mCAAAC;QACE,KAAI;AAAA,QACJ,OAAM;AAAA,SACE;QACP,UAAU;QACV,UAAU;QACV,UAAU;QACV,cAAc;QACd,OAAO;QACP,cAAY;QACZ,aAAa;;MAEJ,4CAAZJ,+BAAA,iCACK,+CAAmB,WAAM;;;gBArGxB;;;;;;"}
|
|
1
|
+
{"version":3,"file":"input.vue_vue&type=template&id=3290dcb6&lang.js","sources":["../../../../../../../packages/components/input/src/input.vue?vue&type=template&id=3290dcb6&lang.js"],"sourcesContent":["<template>\n <div\n v-show=\"type !== 'hidden'\"\n :class=\"[\n type === 'textarea' ? 'el-textarea' : 'el-input',\n inputSize ? 'el-input--' + inputSize : '',\n {\n 'is-disabled': inputDisabled,\n 'is-exceed': inputExceed,\n 'el-input-group': $slots.prepend || $slots.append,\n 'el-input-group--append': $slots.append,\n 'el-input-group--prepend': $slots.prepend,\n 'el-input--prefix': $slots.prefix || prefixIcon,\n 'el-input--suffix':\n $slots.suffix || suffixIcon || clearable || showPassword,\n 'el-input--suffix--password-clear': clearable && showPassword,\n },\n $attrs.class,\n ]\"\n :style=\"containerStyle\"\n :widget=\"widget || undefined\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" class=\"el-input-group__prepend\">\n <slot name=\"prepend\" />\n </div>\n\n <input\n ref=\"input\"\n class=\"el-input__inner\"\n v-bind=\"attrs\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n />\n\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" class=\"el-input__prefix\">\n <span class=\"el-input__prefix-inner\">\n <slot name=\"prefix\"></slot>\n <ps-icon v-if=\"prefixIcon\" class=\"el-input__icon\">\n <component :is=\"prefixIcon\" />\n </ps-icon>\n </span>\n </span>\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" class=\"el-input__suffix\">\n <span class=\"el-input__suffix-inner\">\n <template v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\">\n <slot name=\"suffix\"></slot>\n <ps-icon v-if=\"suffixIcon\" class=\"el-input__icon\">\n <component :is=\"suffixIcon\" />\n </ps-icon>\n </template>\n <ps-icon v-if=\"showClear\" class=\"el-input__icon el-input__clear\">\n <circle-close />\n </ps-icon>\n <ps-icon v-if=\"showPwdVisible\" class=\"el-input__icon el-input__clear\">\n <icon-view />\n </ps-icon>\n <span v-if=\"isWordLimitVisible\" class=\"el-input__count\">\n <span class=\"el-input__count-inner\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </span>\n </span>\n <ps-icon\n v-if=\"validateState && validateIcon\"\n class=\"el-input__icon el-input__validateIcon\"\n >\n <component :is=\"validateIcon\" />\n </ps-icon>\n </span>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" class=\"el-input-group__append\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n ref=\"textarea\"\n class=\"el-textarea__inner\"\n v-bind=\"attrs\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"computedTextareaStyle\"\n :aria-label=\"label\"\n :placeholder=\"placeholder\"\n />\n <span v-if=\"isWordLimitVisible\" class=\"el-input__count\">\n {{ textLength }} / {{ attrs.maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n defineComponent,\n inject,\n computed,\n watch,\n nextTick,\n getCurrentInstance,\n ref,\n shallowRef,\n onMounted,\n onUpdated,\n} from 'vue'\nimport { elFormKey, elFormItemKey } from '@element-ps/tokens'\nimport { useAttrs, useFormItem } from '@element-ps/hooks'\nimport { VALIDATE_STATE_MAP } from '@element-ps/utils/constants'\nimport { isObject } from '@element-ps/utils/util'\nimport isServer from '@element-ps/utils/isServer'\nimport { calcTextareaHeight } from './calc-textarea-height'\nimport { inputProps } from './input'\nimport type { StyleValue } from '@element-ps/utils/types'\nimport { PsIcon } from '@element-ps/components/icon'\nimport { CircleClose, View as IconView } from '@element-plus/icons'\n\nconst PENDANT_MAP = {\n suffix: 'append',\n prefix: 'prepend',\n} as const\n\nexport default defineComponent({\n name: 'PsInput',\n inheritAttrs: false,\n components: { PsIcon, CircleClose, IconView },\n props: inputProps,\n\n setup(props, { slots, attrs: rawAttrs }) {\n const instance = getCurrentInstance()!\n const attrs = useAttrs()\n\n const elForm = inject(elFormKey, undefined)\n const elFormItem = inject(elFormItemKey, undefined)\n\n const { size: inputSize, disabled: inputDisabled } = useFormItem({})\n\n const input = ref<HTMLInputElement>()\n const textarea = ref<HTMLTextAreaElement>()\n const focused = ref(false)\n const hovering = ref(false)\n const passwordVisible = ref(false)\n const _textareaCalcStyle = shallowRef(props.inputStyle)\n\n const inputOrTextarea = computed(() => input.value || textarea.value)\n const needStatusIcon = computed(() => elForm?.statusIcon ?? false)\n const validateState = computed(() => elFormItem?.validateState || '')\n const validateIcon = computed(() => VALIDATE_STATE_MAP[validateState.value])\n const containerStyle = computed(() => rawAttrs.style as StyleValue)\n const computedTextareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n _textareaCalcStyle.value,\n { resize: props.resize },\n ])\n const nativeInputValue = computed(() =>\n props._modelValue === null || props._modelValue === undefined\n ? ''\n : String(props._modelValue)\n )\n const showClear = computed(\n () =>\n props.clearable &&\n !inputDisabled.value &&\n !props.readonly &&\n !!nativeInputValue.value &&\n (focused.value || hovering.value)\n )\n const showPwdVisible = computed(\n () =>\n props.showPassword &&\n !inputDisabled.value &&\n !props.readonly &&\n (!!nativeInputValue.value || focused.value)\n )\n const isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!attrs.value.maxlength &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n )\n const textLength = computed(() => Array.from(nativeInputValue.value).length)\n const inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value &&\n textLength.value > Number(attrs.value.maxlength)\n )\n\n const resizeTextarea = () => {\n const { type, autosize } = props\n\n if (isServer || type !== 'textarea') return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n _textareaCalcStyle.value = {\n ...calcTextareaHeight(textarea.value!, minRows, maxRows),\n }\n } else {\n _textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value!).minHeight,\n }\n }\n }\n\n const setNativeInputValue = () => {\n const input = inputOrTextarea.value\n if (!input || input.value === nativeInputValue.value) return\n input.value = nativeInputValue.value\n }\n\n const calcIconOffset = (place: 'prefix' | 'suffix') => {\n const { el } = instance.vnode\n if (!el) return\n const elList: HTMLSpanElement[] = Array.from(\n el.querySelectorAll(`.el-input__${place}`)\n )\n const target = elList.find((item) => item.parentNode === el)\n\n if (!target) return\n\n const pendant = PENDANT_MAP[place]\n\n if (slots[pendant]) {\n target.style.transform = `translateX(${place === 'suffix' ? '-' : ''}${\n el.querySelector(`.el-input-group__${pendant}`).offsetWidth\n }px)`\n } else {\n target.removeAttribute('style')\n }\n }\n\n const updateIconOffset = () => {\n calcIconOffset('prefix')\n calcIconOffset('suffix')\n }\n\n const suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n showClear.value ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n )\n\n watch(\n () => props._modelValue,\n () => {\n nextTick(resizeTextarea)\n if (props.validateEvent) {\n elFormItem?.validate?.('change')\n }\n }\n )\n\n // native input value is set explicitly\n // do not use v-model / :value in template\n // see: https://github.com/ElemeFE/element/issues/14521\n watch(nativeInputValue, () => setNativeInputValue())\n\n // when change between <input> and <textarea>,\n // update DOM dependent value and styles\n // https://github.com/ElemeFE/element/issues/14857\n watch(\n () => props.type,\n () => {\n nextTick(() => {\n setNativeInputValue()\n resizeTextarea()\n updateIconOffset()\n })\n }\n )\n\n onMounted(() => {\n setNativeInputValue()\n updateIconOffset()\n nextTick(resizeTextarea)\n })\n\n onUpdated(() => {\n nextTick(updateIconOffset)\n })\n\n return {\n input,\n textarea,\n attrs,\n inputSize,\n validateState,\n validateIcon,\n containerStyle,\n computedTextareaStyle,\n inputDisabled,\n showClear,\n showPwdVisible,\n isWordLimitVisible,\n textLength,\n hovering,\n inputExceed,\n passwordVisible,\n inputOrTextarea,\n suffixVisible,\n }\n },\n})\n</script>\n"],"names":["_createElementBlock","_createCommentVNode","_renderSlot","_createElementVNode","_mergeProps","_createBlock","_createVNode"],"mappings":";;;;;;;;;EAyBiC,OAAM;AAAA;;;;EAmBQ,OAAM;AAAA;qBACvC,OAAM;;;EASa,OAAM;AAAA;qBACzB,OAAM;;;EAasB,OAAM;AAAA;qBAC9B,OAAM;;;EAcQ,OAAM;AAAA;;;;EAmBA,OAAM;AAAA;;;;;8CArG1CA;IAEG;;;;;;;;;;;;;;;IAgBA,0BAAO;IACP,QAAQ,eAAU;AAAA;IAEnBC;IACgB,6CAAhBD;MACEC;MACW,YAAO,4BAAlBD,8BAAA;QACEE;;MAGFC,gCAAAC;QACE,KAAI;AAAA,QACJ,OAAM;AAAA,SACE;QACP,MAAM,oBAAgB,6CAAyC;QAC/D,UAAU;QACV,UAAU;QACV,cAAc;QACd,UAAU;QACV,cAAY;QACZ,aAAa;QACb,OAAO;;MAGVH;MACY,YAAO,UAAU,oCAA7BD,+BAAA;QACEG,+BAAA;UACED;UACe,oCAAfG;;YAA2B,OAAM;AAAA;iCAC/B;gCAAAA,4CAAgB;;;;;;MAKtBJ;MACY,uCAAZD,+BAAA;QACEG,+BAAA;WACmB,mBAAc,wBAAmB,4CAAlDH;YACEE;YACe,oCAAfG;;cAA2B,OAAM;AAAA;mCAC/B;kCAAAA,4CAAgB;;;;;UAGL,mCAAfA;;YAA0B,OAAM;AAAA;iCAC9B;cAAAC;;;;UAEa,wCAAfD;;YAA+B,OAAM;AAAA;iCACnC;cAAAC;;;;UAEU,4CAAZN,+BAAA;YACEG,+BAAA,gCACK,+CAAmB,WAAM;;;QAK1B,sBAAiB,sCADzBE;;UAEE,OAAM;AAAA;+BAEN;8BAAAA,4CAAgB;;;;;MAIpBJ;MACW,YAAO,2BAAlBD,8BAAA;QACEE;;gCAKJF;MADAC;MAEEE,mCAAAC;QACE,KAAI;AAAA,QACJ,OAAM;AAAA,SACE;QACP,UAAU;QACV,UAAU;QACV,UAAU;QACV,cAAc;QACd,OAAO;QACP,cAAY;QACZ,aAAa;;MAEJ,4CAAZJ,+BAAA,iCACK,+CAAmB,WAAM;;;gBArGxB;;;;;;"}
|
|
@@ -2,84 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('
|
|
6
|
-
var
|
|
7
|
-
var index = require('../../../hooks/use-form-item/index.js');
|
|
5
|
+
var input_vue_vue_type_script_lang = require('./input.vue_vue&type=script&lang.js');
|
|
6
|
+
var input_vue_vue_type_template_id_3290dcb6_lang = require('./input.vue_vue&type=template&id=3290dcb6&lang.js');
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
modelValue: {
|
|
12
|
-
type: props.definePropType(void 0),
|
|
13
|
-
default: ""
|
|
14
|
-
},
|
|
15
|
-
type: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: "text"
|
|
18
|
-
},
|
|
19
|
-
resize: {
|
|
20
|
-
type: String,
|
|
21
|
-
values: ["none", "both", "horizontal", "vertical"]
|
|
22
|
-
},
|
|
23
|
-
autosize: {
|
|
24
|
-
type: props.definePropType([Boolean, Object]),
|
|
25
|
-
default: false
|
|
26
|
-
},
|
|
27
|
-
autocomplete: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: "off"
|
|
30
|
-
},
|
|
31
|
-
placeholder: {
|
|
32
|
-
type: String
|
|
33
|
-
},
|
|
34
|
-
form: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: ""
|
|
37
|
-
},
|
|
38
|
-
readonly: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false
|
|
41
|
-
},
|
|
42
|
-
clearable: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false
|
|
45
|
-
},
|
|
46
|
-
showPassword: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: false
|
|
49
|
-
},
|
|
50
|
-
showWordLimit: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false
|
|
53
|
-
},
|
|
54
|
-
suffixIcon: {
|
|
55
|
-
type: props.definePropType([String, Object]),
|
|
56
|
-
default: ""
|
|
57
|
-
},
|
|
58
|
-
prefixIcon: {
|
|
59
|
-
type: props.definePropType([String, Object]),
|
|
60
|
-
default: ""
|
|
61
|
-
},
|
|
62
|
-
label: {
|
|
63
|
-
type: String
|
|
64
|
-
},
|
|
65
|
-
tabindex: {
|
|
66
|
-
type: [Number, String]
|
|
67
|
-
},
|
|
68
|
-
validateEvent: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: true
|
|
71
|
-
},
|
|
72
|
-
inputStyle: {
|
|
73
|
-
type: props.definePropType([Object, Array, String]),
|
|
74
|
-
default: () => props.mutable({})
|
|
75
|
-
},
|
|
76
|
-
maxlength: {
|
|
77
|
-
type: [Number, String]
|
|
78
|
-
},
|
|
79
|
-
widget: {
|
|
80
|
-
type: String
|
|
81
|
-
}
|
|
82
|
-
});
|
|
8
|
+
input_vue_vue_type_script_lang["default"].render = input_vue_vue_type_template_id_3290dcb6_lang.render;
|
|
9
|
+
input_vue_vue_type_script_lang["default"].__file = "packages/components/input/src/input.vue";
|
|
83
10
|
|
|
84
|
-
exports
|
|
11
|
+
exports["default"] = input_vue_vue_type_script_lang["default"];
|
|
85
12
|
//# sourceMappingURL=input2.js.map
|