@opensig/opendesign
Version:
62 lines (61 loc) • 2.17 kB
JavaScript
import { defineComponent, computed, createBlock, openBlock, unref, withCtx, createVNode } from "vue";
import { OSelect } from "../select/index.mjs";
import _sfc_main$1 from "./OCascaderPanel.vue.mjs";
import { cascaderProps } from "./types.mjs";
import { isTouchDevice } from "../_utils/is.mjs";
import { mergeClass } from "../_utils/vue-utils.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "OCascader",
props: cascaderProps,
emits: ["change", "update:modelValue"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const handleChange = (val) => {
emits("change", val);
emits("update:modelValue", val);
};
const innerTrigger = computed(() => {
if (!isTouchDevice) {
return props.trigger;
}
if (props.trigger === "hover") {
return "click";
}
if (props.trigger === "hover-outclick") {
return "click-outclick";
}
return props.trigger;
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(OSelect), {
"model-value": props.modelValue,
round: props.round,
variant: props.variant,
placeholder: props.placeholder,
trigger: innerTrigger.value,
"option-position": props.optionPosition,
"option-width-mode": "auto",
"unmount-on-hide": props.unmountOnHide,
transition: props.transition,
"option-wrap-class": unref(mergeClass)("o-cascader", props.optionWrapClass),
size: props.size
}, {
default: withCtx(() => [
createVNode(_sfc_main$1, {
options: props.options,
"model-value": props.modelValue,
"path-mode": props.pathMode,
"expand-trigger": props.expandTrigger,
onChange: handleChange
}, null, 8, ["options", "model-value", "path-mode", "expand-trigger"])
]),
_: 1
/* STABLE */
}, 8, ["model-value", "round", "variant", "placeholder", "trigger", "option-position", "unmount-on-hide", "transition", "option-wrap-class", "size"]);
};
}
});
export {
_sfc_main as default
};