UNPKG

various-ui

Version:

This is a test version of the Vue 3 component library

153 lines (148 loc) 5.89 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var index = require('./index.js'); var composable = require('./src/composable.js'); require('../../../utils/index.js'); var index$2 = require('../../icon/index.js'); var index$1 = require('../../../utils/src/node/index.js'); const _hoisted_1 = ["value"]; const _hoisted_2 = { class: "ui-form-candidate-container" }; const _hoisted_3 = { key: 0, class: "ui-mask ui-loading" }; const __default__ = vue.defineComponent({ name: "UiInput" }); var _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, props: index.UiInputPropsOption, emits: index.UiInputEmits, setup(__props, { expose: __expose, emit: __emit }) { const define = __props; const emits = __emit; const { ons, vars, refs, binds, nodes, methods } = composable.useComposable(define, emits); const { visible } = refs; const { main, body, container } = nodes; const { blur, clear, enter, focus } = methods; vue.onBeforeUnmount(() => { var _a; body.value && index$1.remove(document.body, body.value); (_a = vars.observer) == null ? void 0 : _a.disconnect(); }); ; __expose({ clear, focus, blur }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock( "div", vue.mergeProps({ class: "ui-input", ref_key: "container", ref: container }, vue.unref(binds).container), [ vue.createCommentVNode(" * \u8F93\u5165\u6846\u4E3B\u4F53 "), vue.createElementVNode("input", vue.mergeProps({ ref_key: "main", ref: main, class: "ui-form-control", value: _ctx.modelValue }, vue.unref(binds).main, vue.toHandlers(vue.unref(ons).main, true), { onKeydown: _cache[0] || (_cache[0] = vue.withKeys( //@ts-ignore (...args) => vue.unref(enter) && vue.unref(enter)(...args), ["enter"] )) }), null, 16, _hoisted_1), vue.createCommentVNode(" * \u6E05\u7A7A\u6309\u94AE "), _ctx.clearable && _ctx.modelValue ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.UiIcon), { key: 0, name: "error", class: "ui-form-clearable", onClick: vue.unref(clear) }, null, 8, ["onClick"])) : vue.createCommentVNode("v-if", true), vue.createCommentVNode(" * \u5019\u9009\u9879 "), vue.createVNode( vue.Transition, vue.toHandlers(vue.unref(ons).animation), { default: vue.withCtx(() => [ vue.unref(visible) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock( "div", vue.mergeProps({ key: 0, class: "ui-form-candidates", ref_key: "body", ref: body }, vue.unref(binds).body), [ vue.createCommentVNode(" * \u5019\u9009\u9879\u7684\u5185\u5BB9\u5BB9\u5668 "), vue.createElementVNode("div", _hoisted_2, [ vue.createElementVNode( "div", vue.mergeProps({ class: "ui-form-candidate-content" }, vue.unref(binds).candidates), [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(_ctx.candidates, (value) => { return vue.openBlock(), vue.createElementBlock( "div", vue.mergeProps({ class: ["ui-form-candidate", { "ui-active": define.modelValue == value.value }] }, vue.toHandlers(vue.unref(ons).candidate(value), true)), [ vue.renderSlot(_ctx.$slots, "candidate", { data: value }, () => [ vue.createTextVNode( vue.toDisplayString(value.label), 1 /* TEXT */ ) ]) ], 16 /* FULL_PROPS */ ); }), 256 /* UNKEYED_FRAGMENT */ )) ], 16 /* FULL_PROPS */ ) ]) ], 16 /* FULL_PROPS */ )), [ [vue.vShow, _ctx.candidates.length] ]) : vue.createCommentVNode("v-if", true) ]), _: 3 /* FORWARDED */ }, 16 /* FULL_PROPS */ ), vue.createCommentVNode(" \u906E\u7F69\u5C42 "), vue.createVNode(vue.Transition, null, { default: vue.withCtx(() => [ _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [ vue.createVNode(vue.unref(index$2.UiIcon), { name: "loading", class: "ui-mask-icon" }) ])) : vue.createCommentVNode("v-if", true) ]), _: 1 /* STABLE */ }) ], 16 /* FULL_PROPS */ ); }; } }); exports.default = _sfc_main; //# sourceMappingURL=index.vue2.js.map