74 lines
2.7 KiB
JavaScript
74 lines
2.7 KiB
JavaScript
import { defineComponent, computed, ref, mergeProps, unref, withCtx, renderSlot, useSSRContext } from 'vue';
|
|
import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent, ssrRenderSlot } from 'vue/server-renderer';
|
|
import { a as useConfigStore } from './server.mjs';
|
|
import { _ as __nuxt_component_1 } from './FormItem-DY7uTw8_.mjs';
|
|
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "InstaInput",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
value: {},
|
|
rules: {},
|
|
name: {},
|
|
label: {},
|
|
height: {},
|
|
customLabel: {},
|
|
contentHeight: { type: Boolean, default: false }
|
|
},
|
|
emits: ["update:value", "onchange"],
|
|
setup(__props, { emit: __emit }) {
|
|
const checkField = computed(() => {
|
|
var _a;
|
|
return ((_a = localValue.value) == null ? void 0 : _a.length) > 0 || typeof localValue.value === "number" && localValue.value !== 0;
|
|
});
|
|
const props = __props;
|
|
const emits = __emit;
|
|
const config = useConfigStore();
|
|
const localValue = computed({
|
|
get() {
|
|
return props.value;
|
|
},
|
|
set(value) {
|
|
emits("update:value", value);
|
|
}
|
|
});
|
|
const formItemRef = ref(null);
|
|
const hasError = ref(false);
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_a_form_item = __nuxt_component_1;
|
|
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
class: ["border-1 border-solid rounded-xl px-2 mt-2 inputUser instaInputStyle", [{ "border-red-500": hasError.value, "h-3.6rem": !_ctx.contentHeight }]],
|
|
style: [_ctx.height ? `height: ${_ctx.height};` : ""]
|
|
}, _attrs))}><div class="relative"><div class="ms-2 h-5 -mb-1 text-gray-4 mt-4px text-13px">${ssrInterpolate(checkField.value ? _ctx.customLabel ? _ctx.customLabel : unref(config).useString(_ctx.label) : "")}</div>`);
|
|
_push(ssrRenderComponent(_component_a_form_item, {
|
|
ref_key: "formItemRef",
|
|
ref: formItemRef,
|
|
class: ["inputTransition", checkField.value ? "" : "absolute w-full top-2px inputTransition"],
|
|
rules: _ctx.rules,
|
|
name: _ctx.name
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
|
|
} else {
|
|
return [
|
|
renderSlot(_ctx.$slots, "default")
|
|
];
|
|
}
|
|
}),
|
|
_: 3
|
|
}, _parent));
|
|
_push(`</div></div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/InstaInput.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as _ };
|
|
//# sourceMappingURL=InstaInput-DqKUdtw2.mjs.map
|