@aplus-frontend/ui
Version:
110 lines (109 loc) • 3.2 kB
JavaScript
import { defineComponent as m, computed as a, createBlock as c, openBlock as v, mergeProps as o, unref as r, withCtx as y, createVNode as h } from "vue";
import { isValid as i } from "@aplus-frontend/utils";
import { omit as n } from "lodash-unified";
import { useInjectForm as b } from "../../ap-form/context.mjs";
import { getModelValue as B } from "../../ap-form/utils/get.mjs";
import "../../ap-form/item/index.vue2.mjs";
import "./index.vue2.mjs";
import g from "../../ap-form/item/index.vue.mjs";
import V from "./index.vue.mjs";
const P = /* @__PURE__ */ m({
name: "ApFormItemBatchInputGroup",
__name: "form-item",
props: {
htmlFor: {},
prefixCls: {},
label: {},
help: {},
extra: {},
labelCol: {},
wrapperCol: {},
hasFeedback: { type: Boolean, default: !1 },
colon: { type: Boolean, default: void 0 },
labelAlign: {},
prop: {},
name: {},
rules: {},
autoLink: { type: Boolean, default: !0 },
required: { type: Boolean, default: void 0 },
validateFirst: { type: Boolean, default: void 0 },
validateStatus: {},
validateTrigger: {},
messageVariables: {},
hidden: { type: Boolean },
noStyle: { type: Boolean },
tooltip: {},
span: {},
order: {},
offset: {},
push: {},
pull: {},
xs: {},
sm: {},
md: {},
lg: {},
xl: {},
xxl: {},
flex: {},
bordered: { type: Boolean, default: !1 },
valuePropName: {},
initialValue: {},
_signal: {},
transform: {},
description: {},
customFilled: {},
disabled: { type: Boolean, default: void 0 },
field: { default: () => ({}) },
placeholer: {},
trim: { type: Boolean, default: !0 },
defaultSelectedAllKey: { type: Boolean }
},
setup(d) {
const e = d, { internalInstance: s } = b(), u = a(() => e?.transform || {
flat: !1,
transformer: (l) => {
if (l)
return !l?.value || l?.value?.length < 1 ? void 0 : e?.field?.options ? {
...l,
value: l?.value?.filter((t) => i(t?.trim()))?.map((t) => e.trim ? t?.trim() : t)
} : l?.value?.filter((t) => i(t?.trim()))?.map((t) => e.trim ? t?.trim() : t);
}
}), f = a(() => e.field?.style || "width:auto"), p = a(() => {
if (e.initialValue)
return e.initialValue;
const l = s?.getInitialValues();
if (!B(l, e.name))
return e.field.hasAll === !1 ? {
key: [e?.field?.options?.[0]?.value]
} : {
key: e?.field?.options?.map((t) => t.value)
};
});
return (l, t) => (v(), c(g, o(
r(n)(e, [
"field",
"initialValue",
"transform",
"placeholder",
"disabled"
]),
{
"initial-value": p.value,
transform: u.value,
bordered: l.field?.options?.length ? !1 : l.bordered
}
), {
default: y(() => [
h(V, o(r(n)(e.field, ["style"]), {
style: f.value,
disabled: l.disabled,
placeholer: l.placeholer
}), null, 16, ["style", "disabled", "placeholer"])
]),
_: 1
}, 16, ["initial-value", "transform", "bordered"]));
}
});
export {
P as default
};