acdr-ui/dist/dev/mp-weixin/node-modules/wot-design-uni/components/wd-input/wd-input.js.map

1 line
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"wd-input.js","sources":["../../../../../../../node_modules/wot-design-uni/components/wd-input/wd-input.vue","../../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL25vZGVfbW9kdWxlcy93b3QtZGVzaWduLXVuaS9jb21wb25lbnRzL3dkLWlucHV0L3dkLWlucHV0LnZ1ZQ"],"sourcesContent":["<template>\n <view :class=\"rootClass\" :style=\"customStyle\" @click=\"handleClick\">\n <view v-if=\"label || useLabelSlot\" :class=\"labelClass\" :style=\"labelStyle\">\n <view v-if=\"prefixIcon || usePrefixSlot\" class=\"wd-input__prefix\">\n <wd-icon v-if=\"prefixIcon && !usePrefixSlot\" custom-class=\"wd-input__icon\" :name=\"prefixIcon\" @click=\"onClickPrefixIcon\" />\n <slot v-else name=\"prefix\"></slot>\n </view>\n <view class=\"wd-input__label-inner\">\n <template v-if=\"label\">{{ label }}</template>\n <slot v-else name=\"label\"></slot>\n </view>\n </view>\n <!-- 输入域 -->\n <view class=\"wd-input__body\">\n <view class=\"wd-input__value\">\n <view v-if=\"(prefixIcon || usePrefixSlot) && !label\" class=\"wd-input__prefix\">\n <wd-icon v-if=\"prefixIcon\" custom-class=\"wd-input__icon\" :name=\"prefixIcon\" @click=\"onClickPrefixIcon\" />\n <slot name=\"prefix\"></slot>\n </view>\n <input\n :class=\"[\n 'wd-input__inner',\n prefixIcon ? 'wd-input__inner--prefix' : '',\n showWordCount ? 'wd-input__inner--count' : '',\n alignRight ? 'is-align-right' : '',\n customInputClass\n ]\"\n :type=\"type\"\n :password=\"showPassword && !isPwdVisible\"\n v-model=\"inputValue\"\n :placeholder=\"placeholder || translate('placeholder')\"\n :disabled=\"disabled\"\n :maxlength=\"maxlength\"\n :focus=\"isFocus\"\n :confirm-type=\"confirmType\"\n :confirm-hold=\"confirmHold\"\n :cursor=\"cursor\"\n :cursor-spacing=\"cursorSpacing\"\n :placeholder-style=\"placeholderStyle\"\n :selection-start=\"selectionStart\"\n :selection-end=\"selectionEnd\"\n :adjust-position=\"adjustPosition\"\n :hold-keyboard=\"holdKeyboard\"\n :always-embed=\"alwaysEmbed\"\n :placeholder-class=\"inputPlaceholderClass\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @confirm=\"handleConfirm\"\n @keyboardheightchange=\"handleKeyboardheightchange\"\n />\n <view v-if=\"readonly\" class=\"wd-input__readonly-mask\" />\n <view v-if=\"showClear || showPassword || suffixIcon || showWordCount || useSuffixSlot\" class=\"wd-input__suffix\">\n <wd-icon v-if=\"showClear\" custom-class=\"wd-input__clear\" name=\"error-fill\" @click=\"clear\" />\n <wd-icon v-if=\"showPassword\" custom-class=\"wd-input__icon\" :name=\"isPwdVisible ? 'view' : 'eye-close'\" @click=\"togglePwdVisible\" />\n <view v-if=\"showWordCount\" class=\"wd-input__count\">\n <text\n :class=\"[\n inputValue && String(inputValue).length > 0 ? 'wd-input__count-current' : '',\n String(inputValue).length > maxlength! ? 'is-error' : ''\n ]\"\n >\n {{ String(inputValue).length }}\n </text>\n /{{ maxlength }}\n </view>\n <wd-icon v-if=\"suffixIcon\" custom-class=\"wd-input__icon\" :name=\"suffixIcon\" @click=\"onClickSuffixIcon\" />\n <slot name=\"suffix\"></slot>\n </view>\n </view>\n <view v-if=\"errorMessage\" class=\"wd-input__error-message\">{{ errorMessage }}</view>\n </view>\n </view>\n</template>\n\n<script lang=\"ts\">\nexport default {\n name: 'wd-input',\n options: {\n virtualHost: true,\n addGlobalClass: true,\n styleIsolation: 'shared'\n }\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { computed, onBeforeMount, ref, watch } from 'vue'\nimport { objToStyle, requestAnimationFrame } from '../common/util'\nimport { useCell } from '../composables/useCell'\nimport { FORM_KEY, type FormItemRule } from '../wd-form/types'\nimport { useParent } from '../composables/useParent'\nimport { useTranslate } from '../composables/useTranslate'\nimport { inputProps } from './types'\n\nconst props = defineProps(inputProps)\nconst emit = defineEmits([\n 'update:modelValue',\n 'clear',\n 'change',\n 'blur',\n 'focus',\n 'input',\n 'keyboardheightchange',\n 'confirm',\n 'linechange',\n 'clicksuffixicon',\n 'clickprefixicon',\n 'click'\n])\nconst { translate } = useTranslate('input')\n\nconst showClear = ref<boolean>(false)\nconst showWordCount = ref<boolean>(false)\nconst isPwdVisible = ref<boolean>(false)\nconst clearing = ref<boolean>(false)\nconst isFocus = ref<boolean>(false) // 是否聚焦\nconst inputValue = ref<string | number>('') // 输入框的值\nconst cell = useCell()\n\nwatch(\n () => props.focus,\n (newValue) => {\n isFocus.value = newValue\n },\n { immediate: true, deep: true }\n)\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n const { disabled, readonly, clearable } = props\n if (newValue === undefined) {\n newValue = ''\n console.warn('[wot-design] warning(wd-input): value can not be undefined.')\n }\n inputValue.value = newValue\n showClear.value = Boolean(clearable && !disabled && !readonly && newValue)\n },\n { immediate: true, deep: true }\n)\n\nconst { parent: form } = useParent(FORM_KEY)\n\nconst errorMessage = computed(() => {\n if (form && props.prop && form.errorMessages && form.errorMessages[props.prop]) {\n return form.errorMessages[props.prop]\n } else {\n return ''\n }\n})\n\n// 是否展示必填\nconst isRequired = computed(() => {\n let formRequired = false\n if (form && form.props.rules) {\n const rules = form.props.rules\n for (const key in rules) {\n if (Object.prototype.hasOwnProperty.call(rules, key) && key === props.prop && Array.isArray(rules[key])) {\n formRequired = rules[key].some((rule: FormItemRule) => rule.required)\n }\n }\n }\n return props.required || props.rules.some((rule) => rule.required) || formRequired\n})\n\nconst rootClass = computed(() => {\n return `wd-input ${props.label || props.useLabelSlot ? 'is-cell' : ''} ${props.center ? 'is-center' : ''} ${\n cell.border.value ? 'is-border' : ''\n } ${props.size ? 'is-' + props.size : ''} ${props.error ? 'is-error' : ''} ${props.disabled ? 'is-disabled' : ''} ${\n inputValue.value && String(inputValue.value).length > 0 ? 'is-not-empty' : ''\n } ${props.noBorder ? 'is-no-border' : ''} ${props.customClass}`\n})\n\nconst labelClass = computed(() => {\n return `wd-input__label ${props.customLabelClass} ${isRequired.value ? 'is-required' : ''}`\n})\n\nconst inputPlaceholderClass = computed(() => {\n return `wd-input__placeholder ${props.placeholderClass}`\n})\n\nconst labelStyle = computed(() => {\n return props.labelWidth\n ? objToStyle({\n 'min-width': props.labelWidth,\n 'max-width': props.labelWidth\n })\n : ''\n})\n\nonBeforeMount(() => {\n initState()\n})\n\n// 状态初始化\nfunction initState() {\n const { disabled, readonly, clearable, maxlength, showWordLimit } = props\n let newVal = ''\n if (showWordLimit && maxlength && inputValue.value.toString().length > maxlength) {\n newVal = inputValue.value.toString().substring(0, maxlength)\n }\n showClear.value = Boolean(!disabled && !readonly && clearable && inputValue.value)\n showWordCount.value = Boolean(!disabled && !readonly && maxlength && showWordLimit)\n inputValue.value = newVal || inputValue.value\n emit('update:modelValue', inputValue.value)\n}\nfunction togglePwdVisible() {\n // password属性设置false不生效置空生效\n isPwdVisible.value = !isPwdVisible.value\n}\nfunction clear() {\n inputValue.value = ''\n requestAnimationFrame()\n .then(() => requestAnimationFrame())\n .then(() => requestAnimationFrame())\n .then(() => {\n isFocus.value = true\n emit('change', {\n value: ''\n })\n emit('update:modelValue', inputValue.value)\n emit('clear')\n })\n}\n// 失去焦点时会先后触发change、blur未输入内容但失焦不触发 change 只触发 blur\nfunction handleBlur() {\n isFocus.value = false\n emit('change', {\n value: inputValue.value\n })\n emit('update:modelValue', inputValue.value)\n emit('blur', {\n value: inputValue.value\n })\n}\nfunction handleFocus({ detail }: any) {\n if (clearing.value) {\n clearing.value = false\n return\n }\n isFocus.value = true\n emit('focus', detail)\n}\n// input事件需要传入\nfunction handleInput() {\n emit('update:modelValue', inputValue.value)\n emit('input', inputValue.value)\n}\nfunction handleKeyboardheightchange(event: any) {\n emit('keyboardheightchange', event.detail)\n}\nfunction handleConfirm({ detail }: any) {\n emit('confirm', detail)\n}\nfunction onClickSuffixIcon() {\n emit('clicksuffixicon')\n}\nfunction onClickPrefixIcon() {\n emit('clickprefixicon')\n}\nfunction handleClick(event: MouseEvent) {\n emit('click', event)\n}\n</script>\n\n<style lang=\"scss\" scoped>\n@import './index.scss';\n</style>\n","import Component from 'D:/App/Work/addr/acdr-ui/node_modules/wot-design-uni/components/wd-input/wd-input.vue'\nwx.createComponent(Component)"],"names":["useTranslate","ref","useCell","watch","useParent","FORM_KEY","computed","objToStyle","onBeforeMount","requestAnimationFrame"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,MAAA,cAAe;AAAA,EACb,MAAM;AAAA,EACN,SAAS;AAAA,IACP,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,EAClB;AACF;;;;;;;;;;;;;;;;;;AAYA,UAAM,QAAQ;AACd,UAAM,OAAO;AAcb,UAAM,EAAE,UAAA,IAAcA,cAAA,aAAa,OAAO;AAEpC,UAAA,YAAYC,kBAAa,KAAK;AAC9B,UAAA,gBAAgBA,kBAAa,KAAK;AAClC,UAAA,eAAeA,kBAAa,KAAK;AACjC,UAAA,WAAWA,kBAAa,KAAK;AAC7B,UAAA,UAAUA,kBAAa,KAAK;AAC5B,UAAA,aAAaA,kBAAqB,EAAE;AAC1C,UAAM,OAAOC,cAAAA;AAEbC,kBAAA;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,aAAa;AACZ,gBAAQ,QAAQ;AAAA,MAClB;AAAA,MACA,EAAE,WAAW,MAAM,MAAM,KAAK;AAAA,IAAA;AAGhCA,kBAAA;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,aAAa;AACZ,cAAM,EAAE,UAAU,UAAU,UAAA,IAAc;AAC1C,YAAI,aAAa,QAAW;AACf,qBAAA;AACX,kBAAQ,KAAK,6DAA6D;AAAA,QAC5E;AACA,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