element-ps 1.0.20 → 1.0.21

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.
Files changed (176) hide show
  1. package/dist/index.full.js +3 -3
  2. package/dist/index.full.min.js +2 -2
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +2 -2
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +3 -3
  7. package/es/index.mjs +12 -12
  8. package/es/packages/components/affix/index.mjs +2 -2
  9. package/es/packages/components/affix/src/affix.mjs +22 -5
  10. package/es/packages/components/affix/src/affix.mjs.map +1 -1
  11. package/es/packages/components/affix/src/affix.vue_vue&type=script&lang.mjs +1 -1
  12. package/es/packages/components/affix/src/affix2.mjs +5 -22
  13. package/es/packages/components/affix/src/affix2.mjs.map +1 -1
  14. package/es/packages/components/backtop/index.mjs +2 -2
  15. package/es/packages/components/backtop/src/backtop.mjs +5 -19
  16. package/es/packages/components/backtop/src/backtop.mjs.map +1 -1
  17. package/es/packages/components/backtop/src/backtop.vue_vue&type=script&lang.mjs +1 -1
  18. package/es/packages/components/backtop/src/backtop2.mjs +19 -5
  19. package/es/packages/components/backtop/src/backtop2.mjs.map +1 -1
  20. package/es/packages/components/badge/index.mjs +2 -2
  21. package/es/packages/components/badge/src/badge.mjs +5 -20
  22. package/es/packages/components/badge/src/badge.mjs.map +1 -1
  23. package/es/packages/components/badge/src/badge.vue_vue&type=script&lang.mjs +1 -1
  24. package/es/packages/components/badge/src/badge2.mjs +20 -5
  25. package/es/packages/components/badge/src/badge2.mjs.map +1 -1
  26. package/es/packages/components/card/index.mjs +2 -2
  27. package/es/packages/components/card/src/card.mjs +5 -17
  28. package/es/packages/components/card/src/card.mjs.map +1 -1
  29. package/es/packages/components/card/src/card.vue_vue&type=script&lang.mjs +1 -1
  30. package/es/packages/components/card/src/card2.mjs +17 -5
  31. package/es/packages/components/card/src/card2.mjs.map +1 -1
  32. package/es/packages/components/divider/index.mjs +2 -2
  33. package/es/packages/components/divider/src/divider.mjs +5 -15
  34. package/es/packages/components/divider/src/divider.mjs.map +1 -1
  35. package/es/packages/components/divider/src/divider.vue_vue&type=script&lang.mjs +1 -1
  36. package/es/packages/components/divider/src/divider2.mjs +15 -5
  37. package/es/packages/components/divider/src/divider2.mjs.map +1 -1
  38. package/es/packages/components/dropdown/index.mjs +1 -1
  39. package/es/packages/components/dropdown/src/dropdown.mjs +5 -0
  40. package/es/packages/components/dropdown/src/dropdown.mjs.map +1 -1
  41. package/es/packages/components/dropdown/src/dropdown2.mjs +0 -5
  42. package/es/packages/components/dropdown/src/dropdown2.mjs.map +1 -1
  43. package/es/packages/components/empty/index.mjs +2 -2
  44. package/es/packages/components/empty/src/empty.mjs +5 -12
  45. package/es/packages/components/empty/src/empty.mjs.map +1 -1
  46. package/es/packages/components/empty/src/empty.vue_vue&type=script&lang.mjs +1 -1
  47. package/es/packages/components/empty/src/empty2.mjs +12 -5
  48. package/es/packages/components/empty/src/empty2.mjs.map +1 -1
  49. package/es/packages/components/form/src/form-item.vue_vue&type=script&lang.mjs.map +1 -1
  50. package/es/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.mjs +2 -2
  51. package/es/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.mjs.map +1 -1
  52. package/es/packages/components/icon/index.mjs +2 -2
  53. package/es/packages/components/icon/src/icon.mjs +5 -11
  54. package/es/packages/components/icon/src/icon.mjs.map +1 -1
  55. package/es/packages/components/icon/src/icon.vue_vue&type=script&lang.mjs +1 -1
  56. package/es/packages/components/icon/src/icon2.mjs +11 -5
  57. package/es/packages/components/icon/src/icon2.mjs.map +1 -1
  58. package/es/packages/components/image-viewer/index.mjs +2 -2
  59. package/es/packages/components/image-viewer/src/image-viewer.mjs +5 -25
  60. package/es/packages/components/image-viewer/src/image-viewer.mjs.map +1 -1
  61. package/es/packages/components/image-viewer/src/image-viewer.vue_vue&type=script&lang.mjs +1 -1
  62. package/es/packages/components/image-viewer/src/image-viewer2.mjs +25 -5
  63. package/es/packages/components/image-viewer/src/image-viewer2.mjs.map +1 -1
  64. package/es/packages/components/index.mjs +12 -12
  65. package/es/packages/components/input/index.mjs +2 -2
  66. package/es/packages/components/input/src/input.mjs +5 -79
  67. package/es/packages/components/input/src/input.mjs.map +1 -1
  68. package/es/packages/components/input/src/input.vue_vue&type=script&lang.mjs +1 -1
  69. package/es/packages/components/input/src/input.vue_vue&type=script&lang.mjs.map +1 -1
  70. package/es/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.mjs +1 -1
  71. package/es/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.mjs.map +1 -1
  72. package/es/packages/components/input/src/input2.mjs +79 -5
  73. package/es/packages/components/input/src/input2.mjs.map +1 -1
  74. package/es/packages/components/link/index.mjs +2 -2
  75. package/es/packages/components/link/src/link.mjs +20 -5
  76. package/es/packages/components/link/src/link.mjs.map +1 -1
  77. package/es/packages/components/link/src/link.vue_vue&type=script&lang.mjs +1 -1
  78. package/es/packages/components/link/src/link2.mjs +5 -20
  79. package/es/packages/components/link/src/link2.mjs.map +1 -1
  80. package/es/packages/components/menu/index.mjs +4 -4
  81. package/es/packages/components/menu/src/menu-item-group.mjs +4 -5
  82. package/es/packages/components/menu/src/menu-item-group.mjs.map +1 -1
  83. package/es/packages/components/menu/src/menu-item-group.vue_vue&type=script&lang.mjs +1 -1
  84. package/es/packages/components/menu/src/menu-item-group2.mjs +5 -4
  85. package/es/packages/components/menu/src/menu-item-group2.mjs.map +1 -1
  86. package/es/packages/components/menu/src/menu-item.mjs +5 -18
  87. package/es/packages/components/menu/src/menu-item.mjs.map +1 -1
  88. package/es/packages/components/menu/src/menu-item.vue_vue&type=script&lang.mjs +1 -1
  89. package/es/packages/components/menu/src/menu-item2.mjs +18 -5
  90. package/es/packages/components/menu/src/menu-item2.mjs.map +1 -1
  91. package/lib/index.js +12 -12
  92. package/lib/packages/components/affix/index.js +2 -2
  93. package/lib/packages/components/affix/src/affix.js +21 -5
  94. package/lib/packages/components/affix/src/affix.js.map +1 -1
  95. package/lib/packages/components/affix/src/affix.vue_vue&type=script&lang.js +1 -1
  96. package/lib/packages/components/affix/src/affix2.js +5 -21
  97. package/lib/packages/components/affix/src/affix2.js.map +1 -1
  98. package/lib/packages/components/backtop/index.js +2 -2
  99. package/lib/packages/components/backtop/src/backtop.js +6 -19
  100. package/lib/packages/components/backtop/src/backtop.js.map +1 -1
  101. package/lib/packages/components/backtop/src/backtop.vue_vue&type=script&lang.js +1 -1
  102. package/lib/packages/components/backtop/src/backtop2.js +19 -6
  103. package/lib/packages/components/backtop/src/backtop2.js.map +1 -1
  104. package/lib/packages/components/badge/index.js +2 -2
  105. package/lib/packages/components/badge/src/badge.js +5 -19
  106. package/lib/packages/components/badge/src/badge.js.map +1 -1
  107. package/lib/packages/components/badge/src/badge.vue_vue&type=script&lang.js +1 -1
  108. package/lib/packages/components/badge/src/badge2.js +19 -5
  109. package/lib/packages/components/badge/src/badge2.js.map +1 -1
  110. package/lib/packages/components/card/index.js +2 -2
  111. package/lib/packages/components/card/src/card.js +5 -16
  112. package/lib/packages/components/card/src/card.js.map +1 -1
  113. package/lib/packages/components/card/src/card.vue_vue&type=script&lang.js +1 -1
  114. package/lib/packages/components/card/src/card2.js +16 -5
  115. package/lib/packages/components/card/src/card2.js.map +1 -1
  116. package/lib/packages/components/divider/index.js +2 -2
  117. package/lib/packages/components/divider/src/divider.js +5 -14
  118. package/lib/packages/components/divider/src/divider.js.map +1 -1
  119. package/lib/packages/components/divider/src/divider.vue_vue&type=script&lang.js +1 -1
  120. package/lib/packages/components/divider/src/divider2.js +14 -5
  121. package/lib/packages/components/divider/src/divider2.js.map +1 -1
  122. package/lib/packages/components/dropdown/index.js +1 -1
  123. package/lib/packages/components/dropdown/src/dropdown.js +9 -0
  124. package/lib/packages/components/dropdown/src/dropdown.js.map +1 -1
  125. package/lib/packages/components/dropdown/src/dropdown2.js +0 -9
  126. package/lib/packages/components/dropdown/src/dropdown2.js.map +1 -1
  127. package/lib/packages/components/empty/index.js +2 -2
  128. package/lib/packages/components/empty/src/empty.js +6 -12
  129. package/lib/packages/components/empty/src/empty.js.map +1 -1
  130. package/lib/packages/components/empty/src/empty.vue_vue&type=script&lang.js +1 -1
  131. package/lib/packages/components/empty/src/empty2.js +12 -6
  132. package/lib/packages/components/empty/src/empty2.js.map +1 -1
  133. package/lib/packages/components/form/src/form-item.vue_vue&type=script&lang.js.map +1 -1
  134. package/lib/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.js +2 -2
  135. package/lib/packages/components/form/src/form-item.vue_vue&type=template&id=24eda48b&lang.js.map +1 -1
  136. package/lib/packages/components/icon/index.js +2 -2
  137. package/lib/packages/components/icon/src/icon.js +5 -10
  138. package/lib/packages/components/icon/src/icon.js.map +1 -1
  139. package/lib/packages/components/icon/src/icon.vue_vue&type=script&lang.js +1 -1
  140. package/lib/packages/components/icon/src/icon2.js +10 -5
  141. package/lib/packages/components/icon/src/icon2.js.map +1 -1
  142. package/lib/packages/components/image-viewer/index.js +2 -2
  143. package/lib/packages/components/image-viewer/src/image-viewer.js +5 -24
  144. package/lib/packages/components/image-viewer/src/image-viewer.js.map +1 -1
  145. package/lib/packages/components/image-viewer/src/image-viewer.vue_vue&type=script&lang.js +1 -1
  146. package/lib/packages/components/image-viewer/src/image-viewer2.js +24 -5
  147. package/lib/packages/components/image-viewer/src/image-viewer2.js.map +1 -1
  148. package/lib/packages/components/index.js +12 -12
  149. package/lib/packages/components/input/index.js +2 -2
  150. package/lib/packages/components/input/src/input.js +5 -78
  151. package/lib/packages/components/input/src/input.js.map +1 -1
  152. package/lib/packages/components/input/src/input.vue_vue&type=script&lang.js +1 -1
  153. package/lib/packages/components/input/src/input.vue_vue&type=script&lang.js.map +1 -1
  154. package/lib/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.js +1 -1
  155. package/lib/packages/components/input/src/input.vue_vue&type=template&id=3290dcb6&lang.js.map +1 -1
  156. package/lib/packages/components/input/src/input2.js +78 -5
  157. package/lib/packages/components/input/src/input2.js.map +1 -1
  158. package/lib/packages/components/link/index.js +2 -2
  159. package/lib/packages/components/link/src/link.js +19 -5
  160. package/lib/packages/components/link/src/link.js.map +1 -1
  161. package/lib/packages/components/link/src/link.vue_vue&type=script&lang.js +1 -1
  162. package/lib/packages/components/link/src/link2.js +5 -19
  163. package/lib/packages/components/link/src/link2.js.map +1 -1
  164. package/lib/packages/components/menu/index.js +4 -4
  165. package/lib/packages/components/menu/src/menu-item-group.js +4 -6
  166. package/lib/packages/components/menu/src/menu-item-group.js.map +1 -1
  167. package/lib/packages/components/menu/src/menu-item-group.vue_vue&type=script&lang.js +1 -1
  168. package/lib/packages/components/menu/src/menu-item-group2.js +6 -4
  169. package/lib/packages/components/menu/src/menu-item-group2.js.map +1 -1
  170. package/lib/packages/components/menu/src/menu-item.js +5 -18
  171. package/lib/packages/components/menu/src/menu-item.js.map +1 -1
  172. package/lib/packages/components/menu/src/menu-item.vue_vue&type=script&lang.js +1 -1
  173. package/lib/packages/components/menu/src/menu-item2.js +18 -5
  174. package/lib/packages/components/menu/src/menu-item2.js.map +1 -1
  175. package/package.json +1 -1
  176. package/web-types.json +1 -1
@@ -1,7 +1,14 @@
1
- import script from './empty.vue_vue&type=script&lang.mjs';
2
- export { default } from './empty.vue_vue&type=script&lang.mjs';
3
- import { render } from './empty.vue_vue&type=template&id=10d211eb&lang.mjs';
1
+ const emptyProps = {
2
+ image: {
3
+ type: String,
4
+ default: ""
5
+ },
6
+ imageSize: Number,
7
+ description: {
8
+ type: String,
9
+ default: ""
10
+ }
11
+ };
4
12
 
5
- script.render = render;
6
- script.__file = "packages/components/empty/src/empty.vue";
13
+ export { emptyProps };
7
14
  //# sourceMappingURL=empty2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"empty2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"empty2.mjs","sources":["../../../../../../../packages/components/empty/src/empty.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n\nexport const emptyProps = {\n image: {\n type: String,\n default: '',\n },\n imageSize: Number,\n description: {\n type: String,\n default: '',\n },\n} as const\nexport type EmptyProps = ExtractPropTypes<typeof emptyProps>\n"],"names":[],"mappings":"MAEa,aAAa;AAAA,EACxB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,WAAW;AAAA,EACX,aAAa;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA;AAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-item.vue_vue&type=script&lang.mjs","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,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AAM,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,aAAa,SAAS;AAAA,SACvB,OAAO;AAAA,MACV,MAAM;AAAA,MACN,KAAK;AAAA,MACL;AAAA;AAGF,cAAU,MAAM;AACd,UAAI,MAAM,MAAM;AACd,cAAM,QAAQ,WAAW;AACzB,uBAAgB,MAAM,QAAQ,SAAS,CAAC,GAAG,SAAS;AAAA;AAAA;AAIxD,YAAQ,eAAe;AAEvB,UAAM,gBAAgB,SAAS,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,kBAAkB,SAAS,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.mjs","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] : undefined}`\"\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] : undefined}`\"\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":[],"mappings":";;;;;;;AAkEA,aAAe,gBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,eAAe;AAAA,EACf,YAAY;AAAA,IACV;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,WAAW;AAAA;AAAA,IAEb,QAAQ;AAAA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C,kBAAkB,OAAO;AAAA;AAAA,MAE3B,UAAU,QAAQ,iBAAiB,UAAU,UAAU;AAAA;AAGzD,UAAM,kBAAkB,SAAS,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;;;;"}
@@ -20,7 +20,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
20
20
  for: _ctx.labelFor,
21
21
  class: "el-form-item__label",
22
22
  style: normalizeStyle(_ctx.labelStyle),
23
- widget: `${_ctx.widget ? "form-item:label:" + _ctx.widget.split(":")[1] : ""}`
23
+ widget: `${_ctx.widget ? "form-item:label:" + _ctx.widget.split(":")[1] : void 0}`
24
24
  }, [
25
25
  renderSlot(_ctx.$slots, "label", {
26
26
  label: _ctx.label + _ctx.elForm.labelSuffix
@@ -34,7 +34,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
34
34
  createElementVNode("div", {
35
35
  class: "el-form-item__content",
36
36
  style: normalizeStyle(_ctx.contentStyle),
37
- widget: `${_ctx.widget ? "form-item:default:" + _ctx.widget.split(":")[1] : ""}`
37
+ widget: `${_ctx.widget ? "form-item:default:" + _ctx.widget.split(":")[1] : void 0}`
38
38
  }, [
39
39
  renderSlot(_ctx.$slots, "default"),
40
40
  createVNode(Transition, { name: "el-zoom-in-top" }, {
@@ -1 +1 @@
1
- {"version":3,"file":"form-item.vue_vue&type=template&id=24eda48b&lang.mjs","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":";;;;;;;sBACEA;IAAK,KAAI;AAAA,IAAc,uBAAM,gBAAuB;IAC9C,QAAQ;;IAEZC;MACG,iBAAe,gBAAW;MAC1B,cAAY,YAAO;;uBAEpB;QACQ,cAAS,YAAO,sBADxBD;;UAEG,KAAK;UACN,OAAM;AAAA,UACL,sBAAO;UACP,WAAW,mCAA8B,YAAO;;UAEjDE;YAAoB,OAAO,aAAQ,YAAO;AAAA,aAA1C;4CACK,aAAQ,YAAO;;;;;;IAIxBC;MAAK,OAAM;AAAA,MAAyB,sBAAO;MACrC,WAAW,qCAAgC,YAAO;;MAEtDD;MACAD,0BAAY,MAAK;yBACf;UAAY,uBAAZC;;YAA2C,OAAO;aAAlD;YACEC;cACE,uBAAM;;;+BAQH;;;;;;;;;;;"}
1
+ {"version":3,"file":"form-item.vue_vue&type=template&id=24eda48b&lang.mjs","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] : undefined}`\"\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] : undefined}`\"\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":";;;;;;;sBACEA;IAAK,KAAI;AAAA,IAAc,uBAAM,gBAAuB;IAC9C,QAAQ;;IAEZC;MACG,iBAAe,gBAAW;MAC1B,cAAY,YAAO;;uBAEpB;QACQ,cAAS,YAAO,sBADxBD;;UAEG,KAAK;UACN,OAAM;AAAA,UACL,sBAAO;UACP,WAAW,mCAA8B,YAAO,gBAAgB;AAAA;UAEjEE;YAAoB,OAAO,aAAQ,YAAO;AAAA,aAA1C;4CACK,aAAQ,YAAO;;;;;;IAIxBC;MAAK,OAAM;AAAA,MAAyB,sBAAO;MACrC,WAAW,qCAAgC,YAAO,gBAAgB;AAAA;MAEtED;MACAD,0BAAY,MAAK;yBACf;UAAY,uBAAZC;;YAA2C,OAAO;aAAlD;YACEC;cACE,uBAAM;;;+BAQH;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { withInstall } from '../../utils/with-install.mjs';
2
- import './src/icon2.mjs';
3
- export { iconProps } from './src/icon.mjs';
2
+ import './src/icon.mjs';
3
+ export { iconProps } from './src/icon2.mjs';
4
4
  import script from './src/icon.vue_vue&type=script&lang.mjs';
5
5
 
6
6
  const PsIcon = withInstall(script);
@@ -1,13 +1,7 @@
1
- import { buildProps, definePropType } from '../../../utils/props.mjs';
1
+ import script from './icon.vue_vue&type=script&lang.mjs';
2
+ export { default } from './icon.vue_vue&type=script&lang.mjs';
3
+ import { render } from './icon.vue_vue&type=template&id=89b755b6&lang.mjs';
2
4
 
3
- const iconProps = buildProps({
4
- size: {
5
- type: definePropType([Number, String])
6
- },
7
- color: {
8
- type: String
9
- }
10
- });
11
-
12
- export { iconProps };
5
+ script.render = render;
6
+ script.__file = "packages/components/icon/src/icon.vue";
13
7
  //# sourceMappingURL=icon.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon.mjs","sources":["../../../../../../../packages/components/icon/src/icon.ts"],"sourcesContent":["import { definePropType, buildProps } from '@element-ps/utils/props'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const iconProps = buildProps({\n size: {\n type: definePropType<number | string>([Number, String]),\n },\n color: {\n type: String,\n },\n} as const)\nexport type IconProps = ExtractPropTypes<typeof iconProps>\n"],"names":[],"mappings":";;MAGa,YAAY,WAAW;AAAA,EAClC,MAAM;AAAA,IACJ,MAAM,eAAgC,CAAC,QAAQ;AAAA;AAAA,EAEjD,OAAO;AAAA,IACL,MAAM;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"icon.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed } from 'vue';
2
2
  import { isNumber } from '../../../utils/util.mjs';
3
- import { iconProps } from './icon.mjs';
3
+ import { iconProps } from './icon2.mjs';
4
4
  import { isString } from '@vue/shared';
5
5
 
6
6
  var script = defineComponent({
@@ -1,7 +1,13 @@
1
- import script from './icon.vue_vue&type=script&lang.mjs';
2
- export { default } from './icon.vue_vue&type=script&lang.mjs';
3
- import { render } from './icon.vue_vue&type=template&id=89b755b6&lang.mjs';
1
+ import { buildProps, definePropType } from '../../../utils/props.mjs';
4
2
 
5
- script.render = render;
6
- script.__file = "packages/components/icon/src/icon.vue";
3
+ const iconProps = buildProps({
4
+ size: {
5
+ type: definePropType([Number, String])
6
+ },
7
+ color: {
8
+ type: String
9
+ }
10
+ });
11
+
12
+ export { iconProps };
7
13
  //# sourceMappingURL=icon2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"icon2.mjs","sources":["../../../../../../../packages/components/icon/src/icon.ts"],"sourcesContent":["import { definePropType, buildProps } from '@element-ps/utils/props'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const iconProps = buildProps({\n size: {\n type: definePropType<number | string>([Number, String]),\n },\n color: {\n type: String,\n },\n} as const)\nexport type IconProps = ExtractPropTypes<typeof iconProps>\n"],"names":[],"mappings":";;MAGa,YAAY,WAAW;AAAA,EAClC,MAAM;AAAA,IACJ,MAAM,eAAgC,CAAC,QAAQ;AAAA;AAAA,EAEjD,OAAO;AAAA,IACL,MAAM;AAAA;AAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { withInstall } from '../../utils/with-install.mjs';
2
- import './src/image-viewer2.mjs';
3
- export { imageViewerProps } from './src/image-viewer.mjs';
2
+ import './src/image-viewer.mjs';
3
+ export { imageViewerProps } from './src/image-viewer2.mjs';
4
4
  import script from './src/image-viewer.vue_vue&type=script&lang.mjs';
5
5
 
6
6
  const PsImageViewer = withInstall(script);
@@ -1,27 +1,7 @@
1
- import { buildProps, definePropType, mutable } from '../../../utils/props.mjs';
1
+ import script from './image-viewer.vue_vue&type=script&lang.mjs';
2
+ export { default } from './image-viewer.vue_vue&type=script&lang.mjs';
3
+ import { render } from './image-viewer.vue_vue&type=template&id=4b22ad85&lang.mjs';
2
4
 
3
- const imageViewerProps = buildProps({
4
- urlList: {
5
- type: definePropType(Array),
6
- default: () => mutable([])
7
- },
8
- zIndex: {
9
- type: Number,
10
- default: 2e3
11
- },
12
- initialIndex: {
13
- type: Number,
14
- default: 0
15
- },
16
- infinite: {
17
- type: Boolean,
18
- default: true
19
- },
20
- hideOnClickModal: {
21
- type: Boolean,
22
- default: false
23
- }
24
- });
25
-
26
- export { imageViewerProps };
5
+ script.render = render;
6
+ script.__file = "packages/components/image-viewer/src/image-viewer.vue";
27
7
  //# sourceMappingURL=image-viewer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-viewer.mjs","sources":["../../../../../../../packages/components/image-viewer/src/image-viewer.ts"],"sourcesContent":["import { buildProps, definePropType, mutable } from '@element-ps/utils/props'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const imageViewerProps = buildProps({\n urlList: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n zIndex: {\n type: Number,\n default: 2000,\n },\n initialIndex: {\n type: Number,\n default: 0,\n },\n infinite: {\n type: Boolean,\n default: true,\n },\n hideOnClickModal: {\n type: Boolean,\n default: false,\n },\n} as const)\nexport type ImageViewerProps = ExtractPropTypes<typeof imageViewerProps>\n"],"names":[],"mappings":";;MAGa,mBAAmB,WAAW;AAAA,EACzC,SAAS;AAAA,IACP,MAAM,eAAyB;AAAA,IAC/B,SAAS,MAAM,QAAQ;AAAA;AAAA,EAEzB,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,UAAU;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,kBAAkB;AAAA,IAChB,MAAM;AAAA,IACN,SAAS;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"image-viewer.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, computed, onMounted } from 'vue';
2
- import { imageViewerProps } from './image-viewer.mjs';
2
+ import { imageViewerProps } from './image-viewer2.mjs';
3
3
  import { PsIcon } from '../../icon/index.mjs';
4
4
  import { FullScreen, ScaleToOriginal, Close, ArrowLeft, ArrowRight, ZoomOut, ZoomIn, RefreshLeft, RefreshRight } from '@element-plus/icons';
5
5
 
@@ -1,7 +1,27 @@
1
- import script from './image-viewer.vue_vue&type=script&lang.mjs';
2
- export { default } from './image-viewer.vue_vue&type=script&lang.mjs';
3
- import { render } from './image-viewer.vue_vue&type=template&id=4b22ad85&lang.mjs';
1
+ import { buildProps, definePropType, mutable } from '../../../utils/props.mjs';
4
2
 
5
- script.render = render;
6
- script.__file = "packages/components/image-viewer/src/image-viewer.vue";
3
+ const imageViewerProps = buildProps({
4
+ urlList: {
5
+ type: definePropType(Array),
6
+ default: () => mutable([])
7
+ },
8
+ zIndex: {
9
+ type: Number,
10
+ default: 2e3
11
+ },
12
+ initialIndex: {
13
+ type: Number,
14
+ default: 0
15
+ },
16
+ infinite: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ hideOnClickModal: {
21
+ type: Boolean,
22
+ default: false
23
+ }
24
+ });
25
+
26
+ export { imageViewerProps };
7
27
  //# sourceMappingURL=image-viewer2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-viewer2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"image-viewer2.mjs","sources":["../../../../../../../packages/components/image-viewer/src/image-viewer.ts"],"sourcesContent":["import { buildProps, definePropType, mutable } from '@element-ps/utils/props'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const imageViewerProps = buildProps({\n urlList: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n zIndex: {\n type: Number,\n default: 2000,\n },\n initialIndex: {\n type: Number,\n default: 0,\n },\n infinite: {\n type: Boolean,\n default: true,\n },\n hideOnClickModal: {\n type: Boolean,\n default: false,\n },\n} as const)\nexport type ImageViewerProps = ExtractPropTypes<typeof imageViewerProps>\n"],"names":[],"mappings":";;MAGa,mBAAmB,WAAW;AAAA,EACzC,SAAS;AAAA,IACP,MAAM,eAAyB;AAAA,IAC/B,SAAS,MAAM,QAAQ;AAAA;AAAA,EAEzB,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,UAAU;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,EAEX,kBAAkB;AAAA,IAChB,MAAM;AAAA,IACN,SAAS;AAAA;AAAA;;;;"}
@@ -66,32 +66,32 @@ export { PsUpload } from './upload/index.mjs';
66
66
  import './virtual-list/index.mjs';
67
67
  export { default as PsLoading, PsLoadingDirective, PsLoadingService } from './loading/index.mjs';
68
68
  export { PsPopover, PsPopoverDirective } from './popover/index.mjs';
69
- export { affixProps } from './affix/src/affix2.mjs';
69
+ export { affixProps } from './affix/src/affix.mjs';
70
70
  export { alertProps } from './alert/src/alert2.mjs';
71
71
  export { avatarProps } from './avatar/src/avatar.mjs';
72
- export { backtopProps } from './backtop/src/backtop.mjs';
73
- export { badgeProps } from './badge/src/badge.mjs';
72
+ export { backtopProps } from './backtop/src/backtop2.mjs';
73
+ export { badgeProps } from './badge/src/badge2.mjs';
74
74
  export { breadcrumbProps } from './breadcrumb/src/breadcrumb.mjs';
75
75
  export { breadcrumbItemProps } from './breadcrumb/src/breadcrumb-item.mjs';
76
76
  export { buttonEmits, buttonNativeType, buttonProps, buttonSize, buttonType } from './button/src/button.mjs';
77
- export { cardProps } from './card/src/card.mjs';
77
+ export { cardProps } from './card/src/card2.mjs';
78
78
  export { CASCADER_PANEL_INJECTION_KEY, ExpandTrigger } from './cascader-panel/src/types.mjs';
79
79
  export { CommonProps, DefaultProps, useCascaderConfig } from './cascader-panel/src/config.mjs';
80
80
  export { colProps } from './col/src/col.mjs';
81
81
  export { configProviderProps } from './config-provider/src/config-provider.mjs';
82
82
  export { useDialog } from './dialog/src/use-dialog.mjs';
83
83
  export { dialogProps } from './dialog/src/dialog.mjs';
84
- export { dividerProps } from './divider/src/divider.mjs';
85
- export { emptyProps } from './empty/src/empty.mjs';
86
- export { iconProps } from './icon/src/icon.mjs';
84
+ export { dividerProps } from './divider/src/divider2.mjs';
85
+ export { emptyProps } from './empty/src/empty2.mjs';
86
+ export { iconProps } from './icon/src/icon2.mjs';
87
87
  export { imageEmits, imageProps } from './image/src/image.mjs';
88
- export { imageViewerProps } from './image-viewer/src/image-viewer.mjs';
89
- export { inputProps } from './input/src/input.mjs';
88
+ export { imageViewerProps } from './image-viewer/src/image-viewer2.mjs';
89
+ export { inputProps } from './input/src/input2.mjs';
90
90
  export { inputNumberProps } from './input-number/src/input-number.mjs';
91
- export { linkProps } from './link/src/link2.mjs';
91
+ export { linkProps } from './link/src/link.mjs';
92
92
  export { menuEmits, menuProps } from './menu/src/menu.mjs';
93
- export { menuItemEmits, menuItemProps } from './menu/src/menu-item.mjs';
94
- export { menuItemGroupProps } from './menu/src/menu-item-group2.mjs';
93
+ export { menuItemEmits, menuItemProps } from './menu/src/menu-item2.mjs';
94
+ export { menuItemGroupProps } from './menu/src/menu-item-group.mjs';
95
95
  export { subMenuProps } from './menu/src/sub-menu.mjs';
96
96
  export { overlayEmits, overlayProps } from './overlay/src/overlay.mjs';
97
97
  export { pageHeaderProps } from './page-header/src/page-header.mjs';
@@ -1,6 +1,6 @@
1
1
  import { withInstall } from '../../utils/with-install.mjs';
2
- import './src/input2.mjs';
3
- export { inputProps } from './src/input.mjs';
2
+ import './src/input.mjs';
3
+ export { inputProps } from './src/input2.mjs';
4
4
  import script from './src/input.vue_vue&type=script&lang.mjs';
5
5
 
6
6
  const PsInput = withInstall(script);
@@ -1,81 +1,7 @@
1
- import '../../../hooks/index.mjs';
2
- import { buildProps, definePropType, mutable } from '../../../utils/props.mjs';
3
- import { useFormItemProps } from '../../../hooks/use-form-item/index.mjs';
1
+ import script from './input.vue_vue&type=script&lang.mjs';
2
+ export { default } from './input.vue_vue&type=script&lang.mjs';
3
+ import { render } from './input.vue_vue&type=template&id=3290dcb6&lang.mjs';
4
4
 
5
- const inputProps = buildProps({
6
- ...useFormItemProps,
7
- _modelValue: {
8
- type: definePropType(void 0),
9
- default: ""
10
- },
11
- type: {
12
- type: String,
13
- default: "text"
14
- },
15
- resize: {
16
- type: String,
17
- values: ["none", "both", "horizontal", "vertical"]
18
- },
19
- autosize: {
20
- type: definePropType([Boolean, Object]),
21
- default: false
22
- },
23
- autocomplete: {
24
- type: String,
25
- default: "off"
26
- },
27
- placeholder: {
28
- type: String
29
- },
30
- form: {
31
- type: String,
32
- default: ""
33
- },
34
- readonly: {
35
- type: Boolean,
36
- default: false
37
- },
38
- clearable: {
39
- type: Boolean,
40
- default: false
41
- },
42
- showPassword: {
43
- type: Boolean,
44
- default: false
45
- },
46
- showWordLimit: {
47
- type: Boolean,
48
- default: false
49
- },
50
- suffixIcon: {
51
- type: definePropType([String, Object]),
52
- default: ""
53
- },
54
- prefixIcon: {
55
- type: definePropType([String, Object]),
56
- default: ""
57
- },
58
- label: {
59
- type: String
60
- },
61
- tabindex: {
62
- type: [Number, String]
63
- },
64
- validateEvent: {
65
- type: Boolean,
66
- default: true
67
- },
68
- inputStyle: {
69
- type: definePropType([Object, Array, String]),
70
- default: () => mutable({})
71
- },
72
- maxlength: {
73
- type: [Number, String]
74
- },
75
- widget: {
76
- type: String
77
- }
78
- });
79
-
80
- export { inputProps };
5
+ script.render = render;
6
+ script.__file = "packages/components/input/src/input.vue";
81
7
  //# sourceMappingURL=input.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"input.mjs","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":[],"mappings":";;;;MAOa,aAAa,WAAW;AAAA,KAChC;AAAA,EACH,aAAa;AAAA,IACX,MAAM,eAAmD;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,MAAM,eAAyB,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,MAAM,eAAmC,CAAC,QAAQ;AAAA,IAClD,SAAS;AAAA;AAAA,EAEX,YAAY;AAAA,IACV,MAAM,eAAmC,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,MAAM,eAA2B,CAAC,QAAQ,OAAO;AAAA,IACjD,SAAS,MAAM,QAAQ;AAAA;AAAA,EAEzB,WAAW;AAAA,IACT,MAAM,CAAC,QAAQ;AAAA;AAAA,EAEjB,QAAQ;AAAA,IACN,MAAM;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"input.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -5,7 +5,7 @@ import { VALIDATE_STATE_MAP } from '../../../utils/constants.mjs';
5
5
  import '../../../utils/util.mjs';
6
6
  import isServer from '../../../utils/isServer.mjs';
7
7
  import { calcTextareaHeight } from './calc-textarea-height.mjs';
8
- import { inputProps } from './input.mjs';
8
+ import { inputProps } from './input2.mjs';
9
9
  import { PsIcon } from '../../icon/index.mjs';
10
10
  import { CircleClose, View } from '@element-plus/icons';
11
11
  import useAttrs from '../../../hooks/use-attrs/index.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"input.vue_vue&type=script&lang.mjs","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":["IconView"],"mappings":";;;;;;;;;;;;;;;AAqIA,MAAM,cAAc;AAAA,EAClB,QAAQ;AAAA,EACR,QAAQ;AAAA;AAGV,aAAe,gBAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,YAAY,EAAE,QAAQ,uBAAaA;AAAA,EACnC,OAAO;AAAA,EAEP,MAAM,OAAO,EAAE,OAAO,OAAO,YAAY;AACvC,UAAM,WAAW;AACjB,UAAM,QAAQ;AAEd,UAAM,SAAS,OAAO,WAAW;AACjC,UAAM,aAAa,OAAO,eAAe;AAEzC,UAAM,EAAE,MAAM,WAAW,UAAU,kBAAkB,YAAY;AAEjE,UAAM,QAAQ;AACd,UAAM,WAAW;AACjB,UAAM,UAAU,IAAI;AACpB,UAAM,WAAW,IAAI;AACrB,UAAM,kBAAkB,IAAI;AAC5B,UAAM,qBAAqB,WAAW,MAAM;AAE5C,UAAM,kBAAkB,SAAS,MAAM,MAAM,SAAS,SAAS;AAC/D,UAAM,iBAAiB,SAAS,MAAG;;AAAG,oDAAQ,eAAR,YAAsB;AAAA;AAC5D,UAAM,gBAAgB,SAAS,MAAM,0CAAY,kBAAiB;AAClE,UAAM,eAAe,SAAS,MAAM,mBAAmB,cAAc;AACrE,UAAM,iBAAiB,SAAS,MAAM,SAAS;AAC/C,UAAM,wBAAwB,SAAqB,MAAM;AAAA,MACvD,MAAM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CAAC;AAAI;AACT,YAAM,SAA4B,MAAM,KACtC,GAAG,iBAAiB,cAAc;AAEpC,YAAM,SAAS,OAAO,KAAK,CAAC,SAAS,KAAK,eAAe;AAEzD,UAAI,CAAC;AAAQ;AAEb,YAAM,UAAU,YAAY;AAE5B,UAAI,MAAM,UAAU;AAClB,eAAO,MAAM,YAAY,cAAc,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,gBAAgB,SACpB,MACE,CAAC,CAAC,MAAM,UACR,CAAC,CAAC,MAAM,cACR,UAAU,SACV,MAAM,gBACN,mBAAmB,SAClB,CAAC,CAAC,cAAc,SAAS,eAAe;AAG7C,UACE,MAAM,MAAM,aACZ,MAAM;;AACJ,eAAS;AACT,UAAI,MAAM,eAAe;AACvB,uDAAY,aAAZ,oCAAuB;AAAA;AAAA;AAQ7B,UAAM,kBAAkB,MAAM;AAK9B,UACE,MAAM,MAAM,MACZ,MAAM;AACJ,eAAS,MAAM;AACb;AACA;AACA;AAAA;AAAA;AAKN,cAAU,MAAM;AACd;AACA;AACA,eAAS;AAAA;AAGX,cAAU,MAAM;AACd,eAAS;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.mjs","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":["IconView"],"mappings":";;;;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AgB,SACpB,MACE,CAAC,CAAC,MAAM,UACR,CAAC,CAAC,MAAM,cACR,UAAU,SACV,MAAM,gBACN,mBAAmB,SAClB,CAAC,CAAC,cAAc,SAAS,eAAe;AAG7C,UACE,MAAM,MAAM,aACZ,MAAM;;AACJ,eAAS;AACT,UAAI,MAAM,eAAe;AACvB,uDAAY,aAAZ,oCAAuB;AAAA;AAAA;AAQ7B,UAAM,kBAAkB,MAAM;AAK9B,UACE,MAAM,MAAM,MACZ,MAAM;AACJ,eAAS,MAAM;AACb;AACA;AACA;AAAA;AAAA;AAKN,cAAU,MAAM;AACd;AACA;AACA,eAAS;AAAA;AAGX,cAAU,MAAM;AACd,eAAS;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;;;;"}
@@ -51,7 +51,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
51
51
  _ctx.$attrs.class
52
52
  ]),
53
53
  style: normalizeStyle(_ctx.containerStyle),
54
- widget: _ctx.widget || void 0
54
+ widget: _ctx.widget
55
55
  }, [
56
56
  createCommentVNode(" input "),
57
57
  _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [