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>
45 lines (44 loc) • 1.41 kB
JavaScript
import "../utils/index.mjs";
import { ref as s, watch as h } from "vue";
import { getCheckData as d } from "../utils/getCheckedData.mjs";
import { getIsReturnToolBar as _ } from "../utils/getIsReturnToolBar.mjs";
function D(o, i) {
const l = s(u(o.sortTableCols));
h(
() => o.formatTableCols,
() => {
o.formatTableCols.filter((e) => e.__uid && !e.fixed).map((e) => e.__uid).forEach((e) => {
l.value.includes(e) || l.value.push(e);
});
},
{ deep: !0 }
);
function u(a) {
return d(o.toolBar, a).filter((e) => !e.fixed).map((e) => e.__uid);
}
return {
checkedTableCols: l,
handleReset: () => {
const a = o.originFormatTableCols.filter(
(e) => _(e, o.toolBar)
);
l.value = u(a), i("table-cols-change", a), i("columns-change", d(o.toolBar, o.originFormatTableCols));
},
handleDataChange: (a, e) => {
const r = [], f = e.filter(
(n) => !a.map((t) => t.__uid).includes(n.__uid)
);
e && e.length > 0 && (a.forEach((n) => {
const t = e.find((c) => c.__uid === n.__uid);
t && t.__uid && r.push(t);
}), f.forEach((n) => {
const t = e.findIndex((c) => n.__uid === c.__uid);
t > -1 && r.splice(t, 0, n);
})), i("table-cols-change", a), i("columns-change", r);
}
};
}
export {
D as useToolBarTableCols
};
//# sourceMappingURL=useToolBarTableCols.mjs.map