import { q as z, a0 as e, g as H, M as P, fk as L, bs as w, ba as s, w as i, bv as c, v as I, cn as j, bb as v, fl as U, a as q, fm as d, dR as h, b9 as p, ck as G, cl as T, V as o, bh as x, L as A, dV as J, c1 as F, dX as K, P as R, bt as X, ce as k, fn as _, fo as B, fp as O, fq as $, fr as C, O as Q, d8 as u, ea as Y, fs as Z, di as ee, ft as te, dj as re, aU as oe } from "./684d2f28.js";
import "react";
import { ColumnTypeCompMap as W, ColumnTypeComp as ie } from "./49a8125c.js";
import { TextOverflowControl as le } from "./fcd1d96f.js";
import "react-dom";
import "./7281819e.js";
import "./9869e60a.js";
import "./b1144c16.js";
import "./d404aae1.js";
import "./926d8ea1.js";
import "./d6402597.js";
import "./7a630f06.js";
import "./d883a28b.js";
import "./6be5dc74.js";
import "./1312a48b.js";
import "./00dac55d.js";
import "./622ce240.js";
import "./0c4ef413.js";
import "./b8f8370b.js";
import "./ca17ca0f.js";
import "./d9d1e856.js";
import "./6538ec2e.js";
import "./226f78bd.js";
import "./8e06f4ed.js";
import "./a014bc57.js";
import "./6cf5f7c0.js";
import "./7f2964c3.js";
import "./602ac28f.js";
import "./f9c25fbe.js";
import "./2d5fc5ff.js";
import "./0f3d7a1a.js";
import "./698a4355.js";
import "./cf2c1864.js";
const b = z(ie), ne = [{
  label: e("table.auto"),
  value: "auto"
}, {
  label: e("table.fixed"),
  value: "fixed"
}], ae = [{
  label: /* @__PURE__ */ o(ee, {}),
  value: "left"
}, {
  label: /* @__PURE__ */ o(te, {}),
  value: "close"
}, {
  label: /* @__PURE__ */ o(re, {}),
  value: "right"
}], D = e("table.cellColor"), de = H(new P({
  color: L
}, (l) => l.color).setPropertyViewFn((l) => l.color.propertyView({
  label: D,
  tooltip: e("table.cellColorDesc")
})).build());
class E extends de {
  getPropertyView() {
    return w({
      filterText: D
    }, super.getPropertyView());
  }
}
const pe = {
  // column title
  title: s,
  showTitle: i(c, !0),
  // a custom column or a data column
  isCustom: I(!1),
  // If it is a data column, it must be the name of the column and cannot be duplicated as a react key
  dataIndex: I(""),
  hide: c,
  sortable: c,
  width: j,
  autoWidth: v(ne, "auto"),
  render: b,
  align: U,
  tempHide: q(!1),
  fixed: v(ae, "close"),
  editable: c,
  background: i(d, ""),
  margin: i(h, ""),
  text: i(d, ""),
  border: i(d, ""),
  borderWidth: i(h, ""),
  radius: i(h, ""),
  textSize: i(h, ""),
  textWeight: i(s, "normal"),
  fontFamily: i(s, "sans-serif"),
  fontStyle: i(s, "normal"),
  cellColor: E,
  textOverflow: i(le, "ellipsis"),
  linkColor: i(d, "#3377ff"),
  linkHoverColor: i(d, ""),
  linkActiveColor: i(d, "")
}, se = p(B)` width: 24px; margin: 0 8px 0 -3px; padding: 3px;`, ce = p(_)` width: 24px; margin: 0 8px 0 -3px; padding: 3px;`, he = p(O)` width: 24px; margin: 0 8px 0 -3px; padding: 3px;`, N = p(C)` width: 24px; margin: 0 8px 0 -3px; padding: 3px;`, me = p($)` width: 24px; margin: 0 8px 0 -3px; padding: 3px;`;
p(oe)` width: 24px; margin: 0 0px 0 -12px;`;
const ue = new P(pe, (l, r) => ({
  ...l,
  onWidthResize: (t) => {
    r(G({
      width: T(t, !0),
      autoWidth: T("fixed", !0)
    }));
  }
})).setPropertyViewFn(() => /* @__PURE__ */ o(x, {})).build();
class Je extends ue {
  reduce(r) {
    let t = super.reduce(r);
    if (r.type === A.UPDATE_NODES_V2 && (t = t.setChild("cellColor", t.children.cellColor.reduce(E.changeContextDataAction({
      currentCell: void 0
    })))), r.type === A.CHANGE_VALUE) {
      const n = t.children.title.unevaledValue, a = t.children.dataIndex.getView();
      n || t.children.title.dispatchChangeValueAction(a);
    }
    return t;
  }
  getView() {
    const r = super.getView(), t = this.children.render.getSelectedComp().getComp().children.compType.getView();
    return {
      ...r,
      editable: W[t].canBeEditable() && r.editable
    };
  }
  exposingNode() {
    const r = this.children.dataIndex.exposingNode(), t = J(this.children.render.node(), (n) => ({
      wrap: n.__comp__.wrap,
      map: F.mapValues(n.__map__, (a) => a.comp)
    }));
    return K({
      dataIndex: r,
      render: t
    });
  }
  propertyView(r) {
    var g, y, f;
    const t = this.children.render.getSelectedComp().getComp().children.compType.getView(), n = ((g = this.children.render.getSelectedComp().getParams()) == null ? void 0 : g.initialColumns) || [], a = this.children.render.getSelectedComp().getComp().toJsonValue();
    let m = "{{currentCell}}";
    return (y = a.comp) != null && y.hasOwnProperty("src") ? m = a.comp.src : (f = a.comp) != null && f.hasOwnProperty("text") && (m = a.comp.text), /* @__PURE__ */ R(x, {
      children: [this.children.title.propertyView({
        label: e("table.columnTitle"),
        placeholder: this.children.dataIndex.getView()
      }), /* @__PURE__ */ o(X, {
        showSearch: !0,
        defaultValue: m,
        options: n,
        label: e("table.dataMapping"),
        onChange: (V) => {
          const M = t;
          let S = {
            text: V
          };
          t === "image" && (S = {
            src: V
          }), this.children.render.dispatchChangeValueAction({
            compType: M,
            comp: S
          });
        }
      }), this.children.render.getPropertyView(), this.children.showTitle.propertyView({
        label: e("table.showTitle"),
        tooltip: e("table.showTitleTooltip")
      }), W[t].canBeEditable() && this.children.editable.propertyView({
        label: e("table.editable")
      }), this.children.sortable.propertyView({
        label: e("table.sortable")
      }), this.children.hide.propertyView({
        label: e("prop.hide")
      }), this.children.align.propertyView({
        label: e("table.align"),
        radioButton: !0
      }), this.children.fixed.propertyView({
        label: e("table.fixedColumn"),
        radioButton: !0
      }), this.children.autoWidth.propertyView({
        label: e("table.autoWidth"),
        radioButton: !0
      }), this.children.autoWidth.getView() === "fixed" && this.children.width.propertyView({
        label: e("prop.width")
      }), (t === "link" || t === "links") && /* @__PURE__ */ R(x, {
        children: [/* @__PURE__ */ o(k, {
          style: {
            margin: "12px 0"
          }
        }), w({}, /* @__PURE__ */ o("div", {
          children: /* @__PURE__ */ o("b", {
            children: "Link Style"
          })
        })), this.children.linkColor.propertyView({
          label: e("text")
          // trans('style.background'),
        }), this.children.linkHoverColor.propertyView({
          label: "Hover text"
          // trans('style.background'),
        }), this.children.linkActiveColor.propertyView({
          label: "Active text"
          // trans('style.background'),
        })]
      }), /* @__PURE__ */ o(k, {
        style: {
          margin: "12px 0"
        }
      }), w({}, /* @__PURE__ */ o("div", {
        children: /* @__PURE__ */ o("b", {
          children: "Column Style"
        })
      })), this.children.background.propertyView({
        label: e("style.background")
      }), t !== "link" && this.children.text.propertyView({
        label: e("text")
      }), this.children.border.propertyView({
        label: e("style.border")
      }), this.children.borderWidth.propertyView({
        label: e("style.borderWidth"),
        preInputNode: /* @__PURE__ */ o(ce, {
          as: _,
          title: ""
        }),
        placeholder: "1px"
      }), this.children.radius.propertyView({
        label: e("style.borderRadius"),
        preInputNode: /* @__PURE__ */ o(se, {
          as: B,
          title: ""
        }),
        placeholder: "3px"
      }), this.children.textSize.propertyView({
        label: e("style.textSize"),
        preInputNode: /* @__PURE__ */ o(he, {
          as: O,
          title: ""
        }),
        placeholder: "14px"
      }), this.children.textWeight.propertyView({
        label: e("style.textWeight"),
        preInputNode: /* @__PURE__ */ o(me, {
          as: $,
          title: ""
        }),
        placeholder: "normal"
      }), this.children.fontFamily.propertyView({
        label: e("style.fontFamily"),
        preInputNode: /* @__PURE__ */ o(N, {
          as: C,
          title: ""
        }),
        placeholder: "sans-serif"
      }), this.children.fontStyle.propertyView({
        label: e("style.fontStyle"),
        preInputNode: /* @__PURE__ */ o(N, {
          as: C,
          title: ""
        }),
        placeholder: "normal"
      }), this.children.textOverflow.getPropertyView(), this.children.cellColor.getPropertyView()]
    });
  }
  getChangeSet() {
    const r = this.children.dataIndex.getView(), t = F.mapValues(this.children.render.getMap(), (n) => n.getComp().children.comp.children.changeValue.getView());
    return {
      [r]: t
    };
  }
  dispatchClearChangeSet() {
    this.children.render.dispatch(Q(b.forEachAction(u("comp", u("comp", Y("changeValue", null, !1))))));
  }
  static setSelectionAction(r) {
    return u("render", b.setSelectionAction(r));
  }
}
function Ke() {
  return {
    title: e("table.customColumn"),
    dataIndex: Z(),
    isCustom: !0
  };
}
function Xe(l, r, t, n) {
  return {
    title: t ?? l,
    dataIndex: l,
    isCustom: !1,
    autoWidth: "fixed",
    width: r + "",
    render: {
      compType: n ? "tag" : "text",
      comp: {
        text: "{{currentCell}}"
      }
    }
  };
}
export {
  E as CellColorComp,
  Je as ColumnComp,
  b as RenderComp,
  pe as columnChildrenMap,
  Ke as newCustomColumn,
  Xe as newPrimaryColumn
};
