@aplus-frontend/ui
Version:
45 lines (44 loc) • 1.24 kB
JavaScript
import { isArray as p, isObject as a, isFunction as d } from "lodash-unified";
import { computed as F } from "vue";
import { useInjectForm as g } from "../../context.mjs";
import { getModelValue as h } from "../../utils/get.mjs";
import "../../../config-provider/index.mjs";
import { useGlobalConfig as y } from "../../../config-provider/hooks/use-global-config.mjs";
function i(t) {
if (t == null)
return !1;
if (typeof t == "string")
return t.trim() !== "";
if (p(t))
return t.some((e) => i(e));
if (a(t)) {
const o = Object.keys(t);
if (o.length === 0)
return !1;
for (const e of o)
if (i(t[e]))
return !0;
return !1;
}
return !0;
}
function C(t) {
return d(t.type) ? t.type() : t;
}
const x = (t) => {
const { model: o } = g(), e = y("searchForm");
return {
count: F(() => {
let n = 0;
return t.value.forEach((u) => {
const r = C(u.node), m = [r.props.name].flat(1), l = h(o?.value, m), s = r.props.customFilled || r.props["custom-filled"], c = e.value?.customFilled;
!s && c ? c?.(r, l) && (n += 1) : (s || i)(l) && (n += 1);
}), n;
})
};
};
export {
i as defaultFilled,
C as getTargetNode,
x as useCollapseInputCount
};