import { j as B } from "./158dca8d.js";
import { X as g, fz as L, av as G, fA as A, Y as t, a6 as d, G as y, F as i, a7 as n, bN as H, a8 as S, a9 as N, bK as $, fB as W, fC as j, fD as J, bO as T, fE as X, fF as Y, dm as q, fG as Q, fH as U, fI as Z, fJ as _, d3 as P, fK as K, ez as ee, fL as te, e3 as I, cz as z, fM as ie } from "./603b75d9.js";
import { useState as x, useMemo as le } from "react";
import { t as re } from "./2effcf20.js";
import { getSelectedRowKeys as oe } from "./2d0ef255.js";
import { ColumnTypeCompMap as ne } from "./18a95abc.js";
import "./be662667.js";
import "./62f393ec.js";
import "./4963ac97.js";
import "./ffcffc16.js";
import "./26dac75c.js";
import "react-dom";
import "./8064caf1.js";
import "./d8fd0c14.js";
import "./c2be1293.js";
import "./11b05d65.js";
import "./56edae87.js";
import "./0cc240d3.js";
import "./00d44232.js";
import "./f9847c56.js";
import "./a4d0e31e.js";
import "./41aba172.js";
import "./e735e391.js";
import "./140b48ce.js";
import "./f5fb28b1.js";
import "./930af84f.js";
import "./9c5ea6de.js";
import "./7f1b43fa.js";
import "./cee178c0.js";
import "./43b58a96.js";
import "./19a46fb5.js";
import "./98f17e53.js";
import "./794d827a.js";
import "./0cdeb449.js";
import "./d50792b8.js";
import "./f64a8554.js";
import "./cf72e8e5.js";
import "./84cede66.js";
import "./3dfed0b7.js";
import "./57f24d28.js";
const ae = g.div`
  display: flex;
  justify-content: end;
  width: 100%;
  gap: 8px;
  align-items: center;
`, de = g.span`
  ${L};
  color: #8b8fa3;
`, se = g(W)`
  width: 16px;
  height: 16px;
  cursor: pointer;

  &:hover {
    g g {
      stroke: #4965f2;
    }
  }
`, M = G`
  height: 16px;
  width: 16px;
  display: inline-block;

  &:hover {
    cursor: pointer;
  }

  &:hover path {
    fill: #315efb;
  }
`, ce = g(j)`
  ${M}
`, he = g(J)`
  ${M}
`, pe = g(T)`
  width: 100px;

  &,
  > div {
    height: 22px;
  }

  .ant-segmented-item-label {
    height: 18px;
    min-height: 18px;
    line-height: 18px;
    padding: 0;
  }
`, ue = g.div`
  display: flex;
  align-items: center;
  color: ${A}
  line-height: 16px;
  font-size: 13px;
`, me = [{
  label: "Row 1",
  value: 0
}, {
  label: "Row 2",
  value: 1
}, {
  label: "Row 3",
  value: 2
}], be = [{
  label: "Normal",
  value: "normal"
}, {
  label: "Summary",
  value: "summary"
}], we = [{
  label: t("table.allColumn"),
  value: "all"
}, {
  label: t("table.visibleColumn"),
  value: "visible"
}], ye = [{
  label: t("prop.hide"),
  value: "hide"
}, {
  label: t("table.editable"),
  value: "editable"
}, {
  label: t("table.autoWidth"),
  value: "autoWidth"
}, {
  label: t("table.sortable"),
  value: "sortable"
}, {
  label: t("table.align"),
  value: "align"
}];
function ge(e) {
  const {
    hide: l,
    setHide: h
  } = e;
  return /* @__PURE__ */ i(l ? ce : he, {
    onClick: (a) => {
      h(!l);
    }
  });
}
function R(e, l) {
  const h = (a) => e === "autoWidth" ? a.children.autoWidth.getView() === "auto" : a.children[e].getView(), p = l ?? ((a) => a);
  return (a) => {
    const r = Array.isArray(a), f = r ? a : [a], u = f.map((c) => {
      if (e !== "editable")
        return !1;
      const w = c.children.render.getOriginalComp().children.comp.children.compType.getView();
      return !ne[w].canBeEditable();
    });
    let m = !0, b = !0;
    f.forEach((c, w) => {
      if (u[w]) {
        r || (m = !1);
        return;
      }
      h(c) ? b = !1 : m = !1;
    });
    const V = (c) => {
      f.forEach((w, C) => !u[C] && w.children[e].dispatch(I(z(p(c), !0))));
    };
    return e === "hide" ? /* @__PURE__ */ i(ge, {
      hide: m,
      setHide: (c) => V(c)
    }) : /* @__PURE__ */ i(ie, {
      indeterminate: !m && !b,
      disabled: !r && u[0],
      checked: m,
      onChange: (c) => {
        V(c.target.checked);
      }
    });
  };
}
const k = {
  hide: R("hide"),
  editable: R("editable"),
  sortable: R("sortable"),
  autoWidth: R("autoWidth", (e) => e ? "auto" : "fixed"),
  align: (e) => {
    const l = Array.isArray(e) ? e : [e], h = Array.isArray(e) ? void 0 : e.children.align.getView();
    return /* @__PURE__ */ i(pe, {
      options: te,
      value: h,
      radioButton: !0,
      onChange: (p) => {
        l.forEach((a) => a.children.align.dispatch(I(z(p, !0))));
      }
    });
  }
};
function fe(e) {
  const [l, h] = x("normal"), [p, a] = x(0), {
    comp: r
  } = e, f = oe(r.children.selection)[0] ?? "0", [u, m] = x("all"), b = r.children.columns.getView(), V = r.children.dataRowExample.getView(), c = r.children.dynamicColumn.getView(), w = r.children.data.getView(), [C, E] = x("hide"), O = le(() => b.filter((o) => u === "all" || !o.children.hide.getView()), [u, b]), D = parseInt(r.children.summaryRows.getView()), F = /* @__PURE__ */ d(ae, {
    children: [/* @__PURE__ */ d("div", {
      style: {
        display: "flex",
        alignItems: "center",
        marginRight: "auto"
      },
      children: [/* @__PURE__ */ i(X, {
        label: e.columnLabel
      }), /* @__PURE__ */ i(de, {
        children: " (" + b.length + ")"
      })]
    }), V && /* @__PURE__ */ i(Y, {
      title: t("table.refreshButtonTooltip"),
      children: /* @__PURE__ */ i(se, {
        onClick: () => {
          r.dispatch(q("columns", r.children.columns.dataChangedAction({
            rowExample: V,
            doGeneColumn: !0,
            dynamicColumn: c,
            data: w
          })));
        }
      })
    }), /* @__PURE__ */ i(Q, {
      icon: /* @__PURE__ */ i(U, {}),
      text: t("addItem"),
      onClick: () => {
        r.children.columns.dispatch(r.children.columns.pushAction(B()));
      }
    })]
  });
  return /* @__PURE__ */ i(y, {
    children: /* @__PURE__ */ i(Z, {
      headerItem: /* @__PURE__ */ i(_, {
        title: /* @__PURE__ */ i(T, {
          border: !0,
          style: {
            width: "auto",
            marginLeft: "8px"
          },
          value: u,
          options: we,
          label: "",
          onChange: (o) => {
            m(o);
          }
        }),
        config: {
          dataIndex: "header"
        },
        draggable: !1,
        optionExtra: /* @__PURE__ */ d(ue, {
          children: [/* @__PURE__ */ i(T, {
            border: !0,
            style: {
              width: "auto"
            },
            value: C,
            options: ye,
            label: "",
            onChange: (o) => {
              E(o);
            }
          }), k[C](b)]
        })
      }),
      itemExtra: (o) => /* @__PURE__ */ i("div", {
        style: {
          display: "flex",
          alignItems: "center",
          height: "100%"
        },
        onClick: (s) => s.stopPropagation(),
        children: k[C](o)
      }),
      items: O,
      optionToolbar: F,
      itemTitle: (o) => {
        const s = o.getView();
        return s.hide ? /* @__PURE__ */ i("span", {
          style: {
            color: A
          },
          children: s.title
        }) : s.title;
      },
      popoverTitle: (o) => {
        const s = o.getView();
        return s.isCustom ? t("table.customColumn") : s.dataIndex;
      },
      content: (o, s) => /* @__PURE__ */ d(y, {
        children: [/* @__PURE__ */ i(P, {
          block: !0,
          options: be,
          value: l,
          onChange: (v) => h(v)
        }), l === "summary" && /* @__PURE__ */ i(P, {
          block: !0,
          options: me.slice(0, D),
          value: p,
          onChange: (v) => a(v)
        }), o.propertyView(f, l, p), o.getView().isCustom && /* @__PURE__ */ i(K, {
          onClick: () => {
            ee.confirm({
              title: t("table.deleteColumn"),
              content: t("table.confirmDeleteColumn") + `${o.getView().title}?`,
              onConfirm: () => r.children.columns.dispatch(r.children.columns.deleteAction(s)),
              confirmBtnType: "delete",
              okText: t("delete")
            });
          },
          children: t("delete")
        })]
      }),
      onAdd: () => {
        r.children.columns.dispatch(r.children.columns.pushAction(B()));
      },
      onMove: (o, s) => {
        const v = r.children.columns.arrayMoveAction(o, s);
        r.children.columns.dispatch(v);
      },
      dataIndex: (o) => o.getView().dataIndex,
      scrollable: !0
    })
  });
}
function Ve(e) {
  const l = t("table.columnNum");
  return [
    H({
      filterText: l
    }, /* @__PURE__ */ i(fe, {
      comp: e,
      columnLabel: l
    }))
    /* comp.children.dynamicColumn.propertyView({ label: trans("table.dynamicColumn") }),
    dynamicColumn &&
      comp.children.dynamicColumnConfig.propertyView({
        label: trans("table.dynamicColumnConfig"),
        tooltip: trans("table.dynamicColumnConfigDesc"),
      }), */
  ];
}
function at(e) {
  const l = e.editorModeStatus, h = t("data");
  return /* @__PURE__ */ d(y, {
    children: [["logic", "both"].includes(l) && /* @__PURE__ */ i(n, {
      name: t("table.dataDesc"),
      children: H({
        filterText: h
      }, /* @__PURE__ */ i("div", {
        className: re,
        children: e.children.data.propertyView({
          label: h
        })
      }))
    }), ["layout", "both"].includes(l) && /* @__PURE__ */ i(n, {
      name: t("prop.columns"),
      children: Ve(e)
    }), ["logic", "both"].includes(l) && /* @__PURE__ */ d(y, {
      children: [/* @__PURE__ */ d(n, {
        name: S.interaction,
        children: [e.children.onEvent.getPropertyView(), N(e.children), $(e.children), e.children.showDataLoadSpinner.propertyView({
          label: t("table.showDataLoadSpinner")
        }), e.children.selection.getPropertyView(), e.children.editModeClicks.propertyView({
          label: t("table.editMode"),
          radioButton: !0
        }), e.children.searchText.propertyView({
          label: t("table.searchText"),
          tooltip: t("table.searchTextTooltip"),
          placeholder: "{{input1.value}}"
        })]
      }), /* @__PURE__ */ d(n, {
        name: "Summary",
        children: [e.children.showSummary.propertyView({
          label: t("table.showSummary")
        }), e.children.showSummary.getView() && e.children.summaryRows.propertyView({
          label: t("table.totalSummaryRows"),
          radioButton: !0
        })]
      }), /* @__PURE__ */ i(n, {
        name: "Insert Rows",
        children: e.children.inlineAddNewRow.propertyView({
          label: t("table.inlineAddNewRow")
        })
      }), /* @__PURE__ */ i(n, {
        name: t("prop.toolbar"),
        children: e.children.toolbar.getPropertyView()
      })]
    }), ["layout", "both"].includes(l) && /* @__PURE__ */ d(y, {
      children: [/* @__PURE__ */ d(n, {
        name: S.layout,
        children: [e.children.size.propertyView({
          label: t("table.tableSize"),
          radioButton: !0
        }), e.children.autoHeight.getPropertyView(), e.children.showHorizontalScrollbar.propertyView({
          label: t("prop.showHorizontalScrollbar")
        }), !e.children.autoHeight.getView() && e.children.showVerticalScrollbar.propertyView({
          label: t("prop.showVerticalScrollbar")
        }), e.children.fixedHeader.propertyView({
          label: t("table.fixedHeader"),
          tooltip: t("table.fixedHeaderTooltip")
        }), e.children.hideHeader.propertyView({
          label: t("table.hideHeader")
        }), e.children.viewModeResizable.propertyView({
          label: t("table.viewModeResizable"),
          tooltip: t("table.viewModeResizableTooltip")
        }), e.children.visibleResizables.propertyView({
          label: t("table.visibleResizables"),
          tooltip: t("table.visibleResizablesTooltip")
        })]
      }), /* @__PURE__ */ i(n, {
        name: t("prop.pagination"),
        children: e.children.pagination.getPropertyView()
      })]
    }), ["logic", "both"].includes(l) && /* @__PURE__ */ i(y, {
      children: /* @__PURE__ */ d(n, {
        name: S.advanced,
        children: [e.children.expansion.getPropertyView(), e.children.dynamicColumn.propertyView({
          label: t("table.dynamicColumn")
        }), e.children.dynamicColumn.getView() && e.children.dynamicColumnConfig.propertyView({
          label: t("table.dynamicColumnConfig"),
          tooltip: t("table.dynamicColumnConfigDesc")
        })]
      })
    }), ["layout", "both"].includes(l) && /* @__PURE__ */ d(y, {
      children: [/* @__PURE__ */ i(n, {
        name: "Table Style",
        children: e.children.style.getPropertyView()
      }), /* @__PURE__ */ i(n, {
        name: "Header Style",
        children: e.children.headerStyle.getPropertyView()
      }), /* @__PURE__ */ i(n, {
        name: "Toolbar Style",
        children: e.children.toolbarStyle.getPropertyView()
      }), /* @__PURE__ */ d(n, {
        name: "Row Style",
        children: [e.children.showRowGridBorder.propertyView({
          label: t("table.showVerticalRowGridBorder")
        }), e.children.showHRowGridBorder.propertyView({
          label: t("table.showHorizontalRowGridBorder")
        }), e.children.rowStyle.getPropertyView(), e.children.rowAutoHeight.getPropertyView(), e.children.rowHeight.getPropertyView(), e.children.rowColor.getPropertyView()]
      }), /* @__PURE__ */ i(n, {
        name: "Column Style",
        children: e.children.columnsStyle.getPropertyView()
      }), /* @__PURE__ */ i(n, {
        name: "Summary Row Style",
        children: e.children.summaryRowStyle.getPropertyView()
      })]
    })]
  });
}
export {
  at as compTablePropertyView
};
