| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- var K = Object.defineProperty, G = Object.defineProperties;
- var J = Object.getOwnPropertyDescriptors;
- var v = Object.getOwnPropertySymbols;
- var I = Object.prototype.hasOwnProperty, $ = Object.prototype.propertyIsEnumerable;
- var F = (n, t, s) => t in n ? K(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s, b = (n, t) => {
- for (var s in t || (t = {}))
- I.call(t, s) && F(n, s, t[s]);
- if (v)
- for (var s of v(t))
- $.call(t, s) && F(n, s, t[s]);
- return n;
- }, C = (n, t) => G(n, J(t));
- var N = (n, t) => {
- var s = {};
- for (var a in n)
- I.call(n, a) && t.indexOf(a) < 0 && (s[a] = n[a]);
- if (n != null && v)
- for (var a of v(n))
- t.indexOf(a) < 0 && $.call(n, a) && (s[a] = n[a]);
- return s;
- };
- import { ref as B, watch as L, resolveComponent as D, openBlock as P, createBlock as Q, withCtx as f, createElementVNode as i, toDisplayString as u, createVNode as r, unref as X, createTextVNode as g } from "vue";
- import { d as Y } from "./vuedraggable.js";
- import { n as Z, dm as ee, B as ne } from "./index2.js";
- import { _ as te } from "./index8.js";
- import { _ as se } from "./index10.js";
- const oe = { class: "drawer-wrap" }, ie = { class: "content-wrap" }, ae = { class: "table-wrap" }, de = { class: "title" }, le = { class: "columns-wrap" }, ce = { class: "item" }, re = { class: "td-item flex-start" }, ue = { class: "drag-icon" }, he = { class: "checkbox" }, fe = { class: "checkbox" }, _e = { class: "name" }, pe = { class: "td-item" }, me = { style: { "margin-right": "8px" } }, ve = { class: "drawer-footer" }, ge = /* @__PURE__ */ Object.assign({ name: "SettingColumns" }, {
- __name: "SettingColumns",
- props: {
- pageCode: {
- type: String,
- required: !0
- },
- // 源列配置(SSuperListLayout 的 renderColumns);抽屉内改的是副本,点「确定」才回写
- columns: {
- type: Array,
- default: () => []
- }
- },
- emits: ["save", "reset"],
- setup(n, { expose: t, emit: s }) {
- const a = n, k = s, h = B(!1), p = B([]), w = /* @__PURE__ */ new Map();
- function x(e) {
- if (e == null || e === "") return;
- if (typeof e == "string") {
- const c = e.trim();
- if (!c || c.includes("%")) return;
- const d = parseInt(c, 10);
- return Number.isNaN(d) ? void 0 : d;
- }
- const o = Number(e);
- return Number.isFinite(o) ? Math.round(o) : void 0;
- }
- function O(e) {
- return e.fixed && !w.has(e.dataIndex) && w.set(e.dataIndex, e.fixed === "right" ? "right" : "left"), C(b({}, e), {
- // 像素宽度:百分比列留空,等用户自己填
- width: x(e.width),
- // 原始列宽声明(例如 "20%"),用户没填像素值时原样恢复,避免把百分比列写坏
- widthRaw: e.width,
- // 是否显示:默认显示,只有显式 false 才隐藏
- show: e.show !== !1,
- // 是否冻结:fixed 有值即冻结;操作列强制冻结且不可取消
- isFixed: !!e.fixed,
- disabledFixed: e.dataIndex === "action" || !!e.disabledFixed
- });
- }
- function S() {
- p.value = (a.columns || []).map(O);
- }
- function R() {
- return p.value.map((c) => {
- var d = c, { widthRaw: e } = d, o = N(d, ["widthRaw"]);
- const m = x(o.width);
- return C(b({}, o), {
- // 没填像素宽度就回到原始声明(百分比列保持原样)
- width: m === void 0 ? e : m,
- fixed: o.isFixed ? w.get(o.dataIndex) || "left" : !1
- });
- });
- }
- function U() {
- S(), h.value = !0;
- }
- function E() {
- k("reset");
- }
- function V() {
- k("save", R()), h.value = !1;
- }
- function z() {
- h.value = !1;
- }
- function H(e) {
- e.show = !e.show;
- }
- function M(e) {
- e.isFixed = !e.isFixed;
- }
- function T({ target: { value: e } }, o) {
- var d;
- const c = x(e);
- o.width = c, c === void 0 && !String((d = o.widthRaw) != null ? d : "").includes("%") && (o.widthRaw = void 0);
- }
- function W() {
- }
- function j() {
- }
- return L(
- () => a.columns,
- () => {
- h.value && S();
- },
- { deep: !0 }
- ), t({
- show: U,
- columns: p,
- visible: h
- }), (e, o) => {
- const c = D("HolderOutlined"), d = ee, m = se, q = D("UndoOutlined"), y = ne, A = te;
- return P(), Q(A, {
- rootClassName: "filter-columns-wrap",
- title: `${e.$l("高级表格")}`,
- placement: "right",
- width: 700,
- visible: h.value,
- onClose: z
- }, {
- default: f(() => [
- i("div", oe, [
- i("div", ie, [
- i("div", ae, [
- i("div", de, u(e.$l("勾选要显示的列,拖动排序")), 1),
- i("div", le, [
- r(X(Y), {
- list: p.value,
- itemKey: "dataIndex",
- handle: ".mover",
- animation: "300",
- "ghost-class": "ghost",
- "chosen-class": "chosenClass",
- touchStartThreshold: 20,
- onStart: W,
- onEnd: j
- }, {
- item: f(({ element: l }) => [
- i("div", ce, [
- i("div", re, [
- i("div", ue, [
- r(c),
- o[0] || (o[0] = i("div", { class: "mask mover" }, null, -1))
- ]),
- i("div", he, [
- r(d, {
- checked: l.show,
- onChange: (_) => H(l)
- }, {
- default: f(() => [
- g(u(e.$l("显示")), 1)
- ]),
- _: 1
- }, 8, ["checked", "onChange"])
- ]),
- i("div", fe, [
- r(d, {
- checked: l.isFixed,
- disabled: l.disabledFixed,
- onChange: (_) => M(l)
- }, {
- default: f(() => [
- g(u(e.$l("冻结")), 1)
- ]),
- _: 1
- }, 8, ["checked", "disabled", "onChange"])
- ]),
- i("div", _e, u(l.title || l.name), 1)
- ]),
- i("div", pe, [
- i("span", me, u(e.$l("宽度")), 1),
- r(m, {
- style: { width: "80px" },
- size: "small",
- min: 1,
- precision: 0,
- value: l.width,
- "onUpdate:value": (_) => l.width = _,
- onBlur: (_) => T(_, l)
- }, null, 8, ["value", "onUpdate:value", "onBlur"]),
- o[1] || (o[1] = i("span", { style: { "margin-left": "8px" } }, "px", -1))
- ])
- ])
- ]),
- _: 1
- }, 8, ["list"])
- ])
- ])
- ]),
- i("div", ve, [
- r(y, {
- class: "reset",
- onClick: E
- }, {
- default: f(() => [
- r(q),
- g(u(e.$l("重置")), 1)
- ]),
- _: 1
- }),
- r(y, {
- class: "submit",
- type: "primary",
- onClick: V
- }, {
- default: f(() => [
- g(u(e.$l("确定")), 1)
- ]),
- _: 1
- })
- ])
- ])
- ]),
- _: 1
- }, 8, ["title", "visible"]);
- };
- }
- }), ye = /* @__PURE__ */ Z(ge, [["__scopeId", "data-v-51f1ab42"]]);
- export {
- ye as default
- };
|