UNPKG

various-ui

Version:

This is a test version of the Vue 3 component library

177 lines (172 loc) 6.8 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var index$2 = require('../icon/index.js'); var index = require('./src/index.js'); var composable = require('./src/composable.js'); require('../../utils/index.js'); var index$1 = require('../../utils/src/node/index.js'); const _hoisted_1 = ["disabled"]; const _hoisted_2 = { class: "ui-region-selector-content" }; const _hoisted_3 = ["onClick"]; const _hoisted_4 = { class: "ui-form-candidate-container" }; const _hoisted_5 = ["onClick"]; const _hoisted_6 = { key: 0, class: "ui-mask ui-loading" }; const __default__ = vue.defineComponent({ name: "UiRegionSelector" }); var _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, props: index.UiRegionSelectorPropsOption, emits: index.UiRegionSelectorEmits, setup(__props, { expose: __expose, emit: __emit }) { const emits = __emit; const define = __props; const { ons, vars, refs, nodes, binds, methods, computeds } = composable.useComposable(define, emits); const { regions, disabled } = computeds; const { show, hidden } = methods; const { container, body } = nodes; const { visible, data } = refs; vue.onBeforeUnmount(() => { var _a; body.value && index$1.remove(document.body, body.value); (_a = vars.observer) == null ? void 0 : _a.disconnect(); }); ; __expose({ show, hidden }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock( "div", vue.mergeProps({ class: "ui-region-selector", ref_key: "container", ref: container }, vue.unref(binds).container), [ vue.createElementVNode("div", { class: "ui-form-control", onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(show)()) }, [ vue.createCommentVNode(" * \u4E3B\u4F53 "), vue.createElementVNode("input", { type: "text", autocomplete: "off", disabled: vue.unref(disabled), readonly: "" }, null, 8, _hoisted_1), vue.createCommentVNode(" * \u5185\u5BB9 "), vue.createElementVNode("div", _hoisted_2, [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(vue.unref(regions), (value, key) => { return vue.openBlock(), vue.createElementBlock("span", { class: vue.normalizeClass(["ui-region-selector-context", { "ui-active": value.children }]), onClick: vue.withModifiers(($event) => vue.unref(show)(value.name), ["stop"]) }, [ key != 0 ? (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 0 }, [ vue.createTextVNode(" -") ], 64 /* STABLE_FRAGMENT */ )) : vue.createCommentVNode("v-if", true), vue.createTextVNode( " " + vue.toDisplayString(value.name), 1 /* TEXT */ ) ], 10, _hoisted_3); }), 256 /* UNKEYED_FRAGMENT */ )) ]) ]), vue.createCommentVNode(" * \u7BAD\u5934 "), vue.createVNode(vue.unref(index$2.UiIcon), { name: "arrow", class: "ui-region-selector-arrow", onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(show)()) }), vue.createCommentVNode(" * \u5019\u9009\u9879 "), vue.createVNode( vue.Transition, vue.toHandlers(vue.unref(ons).animation), { default: vue.withCtx(() => [ vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock( "div", vue.mergeProps({ key: 0, class: "ui-form-candidates", ref_key: "body", ref: body }, vue.unref(binds).body), [ vue.createElementVNode("div", _hoisted_4, [ vue.createElementVNode( "div", vue.mergeProps({ class: "ui-form-candidate-content" }, vue.unref(binds).candidates), [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(vue.unref(data), (value) => { return vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass(["ui-form-candidate", { "ui-active": _ctx.modelValue.includes(value.name) }]), onClick: ($event) => vue.unref(methods).select(value) }, [ vue.renderSlot(_ctx.$slots, "candidate", { data: value }, () => [ vue.createTextVNode( vue.toDisplayString(value.name), 1 /* TEXT */ ) ]) ], 10, _hoisted_5); }), 256 /* UNKEYED_FRAGMENT */ )) ], 16 /* FULL_PROPS */ ) ]) ], 16 /* FULL_PROPS */ )) : 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_6, [ vue.createVNode(vue.unref(index$2.UiIcon), { class: "ui-mask-icon", name: "loading" }) ])) : vue.createCommentVNode("v-if", true) ]), _: 1 /* STABLE */ }) ], 16 /* FULL_PROPS */ ); }; } }); exports.default = _sfc_main; //# sourceMappingURL=index.vue2.js.map