UNPKG

winbox-ui-next

Version:

We Design Vue 2.0: A Vue.js 3 UI Library

95 lines (94 loc) 3.02 kB
"use strict"; var vue = require("vue"); var iconHover = require("../_components/icon-hover.js"); var index = require("../icon/icon-eye/index.js"); var index$1 = require("../icon/icon-eye-invisible/index.js"); var input = require("./input.js"); var pluginVue_exportHelper = require("../_virtual/plugin-vue_export-helper"); const _sfc_main = vue.defineComponent({ name: "InputPassword", components: { IconEye: index, IconEyeInvisible: index$1, AIconHover: iconHover, AInput: input }, props: { invisibleButton: { type: Boolean, default: true } }, setup() { const inputRef = vue.ref(); const invisible = vue.ref(true); const handleInvisible = () => { invisible.value = !invisible.value; }; return { inputRef, invisible, handleInvisible }; }, methods: { focus() { var _a; (_a = this.inputRef) == null ? void 0 : _a.focus(); }, blur() { var _a; (_a = this.inputRef) == null ? void 0 : _a.blur(); } } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_icon_eye = vue.resolveComponent("icon-eye"); const _component_icon_eye_invisible = vue.resolveComponent("icon-eye-invisible"); const _component_a_icon_hover = vue.resolveComponent("a-icon-hover"); const _component_a_input = vue.resolveComponent("a-input"); return vue.openBlock(), vue.createBlock(_component_a_input, { ref: "inputRef", type: _ctx.invisible ? "password" : "text" }, vue.createSlots({ _: 2 }, [ _ctx.$slots.prepend ? { name: "prepend", fn: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "prepend") ]) } : void 0, _ctx.$slots.prefix ? { name: "prefix", fn: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "prefix") ]) } : void 0, _ctx.invisibleButton || _ctx.$slots.suffix ? { name: "suffix", fn: vue.withCtx(() => [ _ctx.invisibleButton ? (vue.openBlock(), vue.createBlock(_component_a_icon_hover, { key: 0, onClick: _ctx.handleInvisible, onMousedown: _cache[0] || (_cache[0] = vue.withModifiers(() => { }, ["prevent"])), onMouseup: _cache[1] || (_cache[1] = vue.withModifiers(() => { }, ["prevent"])) }, { default: vue.withCtx(() => [ !_ctx.invisible ? (vue.openBlock(), vue.createBlock(_component_icon_eye, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_icon_eye_invisible, { key: 1 })) ]), _: 1 }, 8, ["onClick"])) : vue.createCommentVNode("v-if", true), vue.renderSlot(_ctx.$slots, "suffix") ]) } : void 0, _ctx.$slots.append ? { name: "append", fn: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "append") ]) } : void 0 ]), 1032, ["type"]); } var InputPassword = /* @__PURE__ */ pluginVue_exportHelper(_sfc_main, [["render", _sfc_render]]); module.exports = InputPassword;