/*! @ecan-bi/pivot-table@1.0.54 */
import { createVNode as I, defineComponent as ue, inject as F, ref as v, reactive as fe, computed as me, unref as s, watch as pe, resolveComponent as $, openBlock as N, createBlock as B, withCtx as H, createElementVNode as Z, toDisplayString as x, normalizeClass as A, createElementBlock as he, normalizeStyle as ge, mergeProps as ve, createCommentVNode as be, nextTick as ee } from "vue";
import { A as U, _ as ye, E as Oe, n as te, d as we } from "./index-1eaea0ed.mjs";
import { cloneDeep as Ce } from "lodash-es";
import "dayjs";
import "axios";
import "ant-design-vue";
import "ant-design-vue/es/input-number/style";
import "ant-design-vue/es/form/style";
import "echarts";
import "vuedraggable";
var Se = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, name: "border", theme: "outlined" };
const _e = Se;
function ne(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t] != null ? Object(arguments[t]) : {}, l = Object.keys(n);
    typeof Object.getOwnPropertySymbols == "function" && (l = l.concat(Object.getOwnPropertySymbols(n).filter(function(o) {
      return Object.getOwnPropertyDescriptor(n, o).enumerable;
    }))), l.forEach(function(o) {
      Ee(e, o, n[o]);
    });
  }
  return e;
}
function Ee(e, t, n) {
  return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
}
var z = function(t, n) {
  var l = ne({}, t, n.attrs);
  return I(U, ne({}, l, {
    icon: _e
  }), null);
};
z.displayName = "BorderOutlined";
z.inheritAttrs = !1;
const Le = z;
var $e = { icon: { tag: "svg", attrs: { "fill-rule": "evenodd", viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, name: "close", theme: "outlined" };
const Ie = $e;
function le(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t] != null ? Object(arguments[t]) : {}, l = Object.keys(n);
    typeof Object.getOwnPropertySymbols == "function" && (l = l.concat(Object.getOwnPropertySymbols(n).filter(function(o) {
      return Object.getOwnPropertyDescriptor(n, o).enumerable;
    }))), l.forEach(function(o) {
      Me(e, o, n[o]);
    });
  }
  return e;
}
function Me(e, t, n) {
  return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
}
var k = function(t, n) {
  var l = le({}, t, n.attrs);
  return I(U, le({}, l, {
    icon: Ie
  }), null);
};
k.displayName = "CloseOutlined";
k.inheritAttrs = !1;
const De = k;
var Ne = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M752 240H144c-17.7 0-32 14.3-32 32v608c0 17.7 14.3 32 32 32h608c17.7 0 32-14.3 32-32V272c0-17.7-14.3-32-32-32zm-40 600H184V312h528v528zm168-728H264c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h576v576c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32zM300 550h296v64H300z" } }] }, name: "switcher", theme: "outlined" };
const Pe = Ne;
function oe(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t] != null ? Object(arguments[t]) : {}, l = Object.keys(n);
    typeof Object.getOwnPropertySymbols == "function" && (l = l.concat(Object.getOwnPropertySymbols(n).filter(function(o) {
      return Object.getOwnPropertyDescriptor(n, o).enumerable;
    }))), l.forEach(function(o) {
      Te(e, o, n[o]);
    });
  }
  return e;
}
function Te(e, t, n) {
  return t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
}
var q = function(t, n) {
  var l = oe({}, t, n.attrs);
  return I(U, oe({}, l, {
    icon: Pe
  }), null);
};
q.displayName = "SwitcherOutlined";
q.inheritAttrs = !1;
const je = q;
const Ve = ue({
  name: "DrillModal",
  props: {
    scaleValue: {
      type: Object,
      default: () => ({
        widthScale: 1,
        heightScale: 1
      })
    },
    isIframeMode: {
      type: Boolean,
      default: !1
    }
  },
  components: {
    BorderOutlined: Le,
    SwitcherOutlined: je,
    CloseOutlined: De,
    EcanPivotTable: Oe
  },
  setup(e, { expose: t }) {
    const n = {
      IN: "属于",
      NOT_IN: "不属于",
      LIKE: "包含",
      NOT_LIKE: "不包含",
      "LIKE%": "开头是",
      "%LIKE": "结尾是",
      EQUAL: "等于",
      LESS: "小于",
      LESS_EQUAL: "小于等于",
      GREATER: "大于",
      GREATER_EQUAL: "大于等于",
      NOT_EQUAL: "不等于"
    }, l = 0.37, o = 0.6, R = 0.97, P = 0.9, b = `dmodal_${te(6)}`, T = () => document.querySelector("#ProviderConfig > #container") || document.body, S = F("theme", "light"), y = v({}), _ = v([]), ie = F("indicatorUrl", ""), re = F("splitSymbol", ""), Q = v([]), O = v(!1), w = v({}), M = fe({
      keyName: "",
      visible: !1,
      columns: [],
      title: ""
    }), G = v([]), W = v(), ae = me(() => {
      let i = `drill-modal ${b}`;
      return O.value && (i += " full"), s(S) && (i += ` ${s(S)}`), i;
    }), D = (i) => {
      const r = document.querySelector(`.${b} .ant-modal-header`);
      if (r)
        if (i)
          r.addEventListener("mousedown", J);
        else {
          const u = r.parentElement;
          u && (u.style.left = "", u.style.top = ""), r.removeEventListener("mousedown", J);
        }
    }, K = (i) => {
      const r = document.querySelector(`.${b} .ant-modal-header`);
      r && (i ? r.addEventListener("dblclick", j) : r.removeEventListener("dblclick", j));
    }, J = (i) => {
      we(i, `.${b} .ant-modal-header`);
    }, j = () => {
      O.value = !O.value, ee(() => {
        O.value ? (s(w).width = parseFloat(s(y).width) * R + "px", s(w).height = (props.isIframeMode ? parseFloat(s(y).height) : document.body.clientHeight) * P + "px", D(!1)) : (s(w).width = parseFloat(s(y).width) * l + "px", s(w).height = (props.isIframeMode ? parseFloat(s(y).height) : document.body.clientHeight) * o + "px", D(!0));
      });
    }, se = () => {
      O.value = !1, K(!1), D(!1);
    }, ce = ({ drillDimension: i, drillFieldData: r, usedDimensionFields: u, tableProps: h }) => {
      const c = Ce(h), { graphicConfig: f, allDimensions: E, pageConfig: C } = c, m = te(6), p = [];
      G.value = [...u, i.label], E.value = E, C.value = C;
      const d = f.indicators.filter((a) => a.show).map((a) => a.label);
      d != null && d.length && (M.title = `下钻：${d.join("、")}`);
      for (const a of r) {
        const g = E.find((Y) => [Y.title, Y.label].includes(a.dimensionKey)), L = a.value.split(re);
        let X = a.value;
        L != null && L.length && (X = L[L.length - 1]), p.push({
          conditionKey: g.label,
          conditionLabel: g.title || g.label,
          conditionName: g.name,
          conditionValueType: g.genericType,
          indexCode: g.indexCode,
          typeGuid: g.typeGuid,
          indexCodeNum: g.indexCodeNum,
          rule: "EQUAL",
          dataType: "",
          customValue: X
        });
      }
      f.queryColumnList = [i], p != null && p.length && (f.controlList || (f.controlList = []), f.controlList.push(...p), f.controlList = [
        {
          join: "&&",
          conditions: f.controlList
        }
      ]), w.value = {
        ...c,
        id: m,
        keyName: `透视表_${m}`,
        position: "relative",
        top: 0,
        left: 0,
        width: parseFloat(s(C).width) * l + "px",
        height: (props.isIframeMode ? parseFloat(s(C).height) : document.body.clientHeight) * o + "px",
        graphicConfig: f
      }, M.visible = !0, ee(() => {
        s(W).refreshData(), K(!0), D(!0);
      });
    }, de = ({ type: i, data: r }) => {
      if (i === "11" && r) {
        const {
          indicatorList: u = [],
          queryColumns: h = []
        } = r, f = u.concat(h).filter((m) => m.conditions || m.filter), E = V(f, "conditions", !0), C = V(r.sqlConditions, "sqlConditions", !1);
        Q.value = E.concat(C).map((m) => {
          const p = s(_).find((a) => a.label === m.label);
          let d = m.fieldValue;
          if (d && typeof d == "string") {
            const a = d.split(",");
            (a == null ? void 0 : a.length) > 3 && (d = a.slice(0, 3).join(",") + "等");
          } else
            d || (d = '""');
          return `${(p == null ? void 0 : p.title) || m.label} ${n[m.rule]} ${d}`;
        }) || [];
      }
    };
    function V(i, r, u) {
      const h = [];
      for (const c of i)
        c[r] ? h.push(...V(c[r], r, u)) : c.filter ? h.push({
          ...c.filter,
          label: c.label
        }) : (!u || c.dataType !== "component" && !(c.fieldValue.startsWith("${") && c.fieldValue.endsWith("}"))) && h.push(c);
      return h;
    }
    return pe(M.visible, (i) => {
      window.modalShow && window.modalShow(i);
    }), t({
      showModal: ce
    }), {
      theme: S,
      wrapClassName: ae,
      conditionInfo: Q,
      drillInfo: M,
      pivotTableConfig: w,
      indicatorUrl: ie,
      isIndFullScreen: O,
      usedDimensionFields: G,
      pivotTableRef: W,
      toggleFullScreen: j,
      onDetailCancel: se,
      onPivotTableChange: de,
      getContainer: T
    };
  }
}), Fe = ["title"];
function Be(e, t, n, l, o, R) {
  const P = $("close-outlined"), b = $("switcher-outlined"), T = $("border-outlined"), S = $("ecan-pivot-table"), y = $("a-modal");
  return N(), B(y, {
    "wrap-class-name": e.wrapClassName,
    visible: e.drillInfo.visible,
    "onUpdate:visible": t[1] || (t[1] = (_) => e.drillInfo.visible = _),
    width: "60%",
    footer: null,
    maskClosable: !1,
    destroyOnClose: !0,
    getContainer: e.getContainer,
    onCancel: e.onDetailCancel
  }, {
    title: H(() => [
      Z("div", {
        class: "modal-title",
        title: e.conditionInfo.join("、")
      }, x(e.drillInfo.title) + " " + x(e.conditionInfo.join("、")), 9, Fe)
    ]),
    closeIcon: H(() => [
      I(P, {
        class: A(["modal-icon", e.theme])
      }, null, 8, ["class"])
    ]),
    default: H(() => [
      Z("div", {
        class: "zoom-btn",
        onClick: t[0] || (t[0] = (..._) => e.toggleFullScreen && e.toggleFullScreen(..._))
      }, [
        e.isIndFullScreen ? (N(), B(b, {
          key: 0,
          class: A(["modal-icon", e.theme])
        }, null, 8, ["class"])) : (N(), B(T, {
          key: 1,
          class: A(["modal-icon", e.theme])
        }, null, 8, ["class"]))
      ]),
      e.drillInfo.visible ? (N(), he("div", {
        key: 0,
        style: ge({
          position: "relative",
          width: e.pivotTableConfig.width,
          height: e.pivotTableConfig.height
        })
      }, [
        I(S, ve({ ref: "pivotTableRef" }, e.pivotTableConfig, {
          theme: e.theme,
          fullMode: !1,
          allowDrill: !0,
          showFullScreen: !1,
          indicatorUrl: e.indicatorUrl,
          relateKeyName: e.drillInfo.keyName,
          usedDimensionFields: e.usedDimensionFields,
          scaleValue: e.scaleValue,
          onTableChange: e.onPivotTableChange
        }), null, 16, ["theme", "indicatorUrl", "relateKeyName", "usedDimensionFields", "scaleValue", "onTableChange"])
      ], 4)) : be("", !0)
    ]),
    _: 1
  }, 8, ["wrap-class-name", "visible", "getContainer", "onCancel"]);
}
const Ke = /* @__PURE__ */ ye(Ve, [["render", Be], ["__scopeId", "data-v-d4771623"]]);
export {
  Ke as default
};
//# sourceMappingURL=DrillModal-b69055dd.mjs.map
