various-ui
Version:
This is a test version of the Vue 3 component library
159 lines (154 loc) • 5.91 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var index$2 = require('../../icon/index.js');
var index = require('./index.js');
var composable = require('./src/composable.js');
require('../../../utils/index.js');
var index$1 = require('../../../utils/src/node/index.js');
const _hoisted_1 = { class: "ui-form-candidate-container" };
const _hoisted_2 = {
key: 0,
class: "ui-mask ui-loading"
};
const __default__ = vue.defineComponent({ name: "UiSelect" });
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
props: index.UiSelectPropsOption,
emits: index.UiSelectEmits,
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 { container, body } = nodes;
const { show, clear, hidden } = methods;
vue.onBeforeUnmount(() => {
var _a;
body.value && index$1.remove(document.body, body.value);
(_a = vars.observer) == null ? void 0 : _a.disconnect();
});
;
__expose({ show, clear, hidden });
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(
"div",
vue.mergeProps({
class: "ui-select",
ref_key: "container",
ref: container
}, vue.unref(binds).container),
[
vue.createCommentVNode(" * \u4E3B\u4F53 "),
vue.createElementVNode(
"input",
vue.mergeProps({
class: "ui-form-control",
type: "text"
}, vue.unref(binds).main, {
onClick: _cache[0] || (_cache[0] = //@ts-ignore
(...args) => vue.unref(show) && vue.unref(show)(...args)),
readonly: ""
}),
null,
16
/* FULL_PROPS */
),
vue.createCommentVNode(" * \u7BAD\u5934 "),
vue.createVNode(vue.unref(index$2.UiIcon), {
name: "arrow",
class: "ui-select-arrow",
onClick: vue.unref(show)
}, null, 8, ["onClick"]),
vue.createCommentVNode(" * \u6E05\u7A7A "),
_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.createElementVNode("div", _hoisted_1, [
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": _ctx.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_2, [
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