| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import { useSlots as k, ref as T, computed as _, resolveComponent as u, openBlock as $, createElementBlock as w, createVNode as f, createSlots as c, withCtx as l, renderSlot as s, mergeProps as F, renderList as R, normalizeProps as M, guardReactiveProps as N } from "vue";
- import { n as P } from "./index2.js";
- const j = { class: "s-filter-table-toolbar" }, A = /* @__PURE__ */ Object.assign({ name: "SFilterTableToolbar", inheritAttrs: !1 }, {
- __name: "SFilterTableToolbar",
- props: {
- // 列配置,透传给 s-table
- columns: {
- type: Array,
- default: () => []
- },
- // 数据加载函数,透传给 s-table(返回 { list, total })
- data: {
- type: Function,
- required: !0
- },
- rowKey: {
- type: [String, Function],
- default: "id"
- },
- pageSize: {
- type: Number,
- default: 10
- },
- size: {
- type: String,
- default: "middle"
- },
- scrollX: {
- type: [String, Number],
- default: "100%"
- },
- tableHeight: {
- type: Number,
- default: 300
- }
- },
- emits: ["reset"],
- setup(t, { expose: d, emit: b }) {
- const m = b, n = k(), r = T(null), p = _(() => {
- const e = {};
- return Object.keys(n).forEach((o) => {
- o === "filter" || o === "filterMore" || o === "default" || (e[o] = n[o]);
- }), e;
- });
- function y() {
- m("reset");
- }
- function a(e = !0) {
- return r.value && r.value.refresh(e);
- }
- function g() {
- return a(!0);
- }
- function h() {
- return r.value && r.value.resize();
- }
- return d({ refresh: a, reload: g, resize: h, tableRef: r }), (e, o) => {
- const S = u("s-filter-toolbar"), z = u("s-table-toolbar");
- return $(), w("div", j, [
- f(S, { onReset: y }, c({ _: 2 }, [
- e.$slots.filter ? {
- name: "filter",
- fn: l(() => [
- s(e.$slots, "filter", {}, void 0, !0)
- ]),
- key: "0"
- } : void 0,
- e.$slots.filterMore ? {
- name: "filterMore",
- fn: l(() => [
- s(e.$slots, "filterMore", {}, void 0, !0)
- ]),
- key: "1"
- } : void 0
- ]), 1024),
- f(z, F({
- ref_key: "tableRef",
- ref: r,
- "row-key": t.rowKey,
- columns: t.columns,
- data: t.data,
- "page-size": t.pageSize,
- size: t.size,
- "scroll-x": t.scrollX,
- "table-height": t.tableHeight
- }, e.$attrs), c({ _: 2 }, [
- R(p.value, (B, i) => ({
- name: i,
- fn: l((v) => [
- s(e.$slots, i, M(N(v || {})), void 0, !0)
- ])
- }))
- ]), 1040, ["row-key", "columns", "data", "page-size", "size", "scroll-x", "table-height"])
- ]);
- };
- }
- }), H = /* @__PURE__ */ P(A, [["__scopeId", "data-v-9078a0c4"]]);
- export {
- H as default
- };
|