ideaz-element
Version:
<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>
41 lines (40 loc) • 1.69 kB
JavaScript
import "../../../../node_modules/.pnpm/lodash-unified@1.0.3_@types_lodash-es@4.17.12_lodash-es@4.17.21_lodash@4.17.21/node_modules/lodash-unified/import.mjs";
import "../../../../utils/index.mjs";
import { useLocale as h } from "../../../../hooks/useLocale.mjs";
import { computed as g } from "vue";
import f from "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/set.mjs";
import I from "../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.mjs";
import { findDifferentItems as x } from "../../../../utils/array.mjs";
function k(i, n) {
const { t: p } = h(), s = g(() => {
const { alias: e, all: r, options: o, multiple: u } = i, t = {};
return f(t, (e == null ? void 0 : e.label) || "label", p("select.all")), f(t, (e == null ? void 0 : e.value) || "value", "all"), r && u ? [t].concat(o) : o;
});
return { options: s, handleSelectInput: (e) => {
const { all: r, multiple: o, alias: u } = i, t = s.value.map((l) => I(l, (u == null ? void 0 : u.value) || "value", ""));
if (r && o) {
const l = i.modelValue, c = e.length > l.length ? "add" : "minus", m = x(e, l)[0];
if (m === "all" && c === "add") {
n.value = t;
return;
}
if (m === "all" && c === "minus") {
n.value = [];
return;
}
if (e.length === t.length - 1 && !l.includes("all")) {
n.value = t;
return;
}
if (m !== "all" && l.includes("all") && c === "minus") {
const a = e.findIndex((d) => d === "all");
a > -1 && (n.value = e.splice(a, 1));
}
}
n.value = e;
} };
}
export {
k as useOptions
};
//# sourceMappingURL=useOptions.mjs.map