/*! @ecan-bi/pivot-table@1.0.61 */
import { createVNode as I, defineComponent as ue, inject as Z, ref as v, reactive as fe, computed as me, unref as r, watch as pe, resolveComponent as $, openBlock as P, createBlock as A, withCtx as B, createElementVNode as x, toDisplayString as ee, normalizeClass as H, createElementBlock as he, normalizeStyle as ge, mergeProps as ve, createCommentVNode as be, nextTick as te } from "vue";
import { A as U, _ as we, E as Oe, n as ne, d as ye } from "./index-50bba2e6.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 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) {
      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 = le({}, t, n.attrs);
  return I(U, le({}, 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 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) {
      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 = oe({}, t, n.attrs);
  return I(U, oe({}, 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 ie(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 = ie({}, t, n.attrs);
  return I(U, ie({}, 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, T = 0.9, b = `dmodal_${ne(6)}`, j = () => document.querySelector("#ProviderConfig > #container") || document.body, S = Z("theme", "light"), w = v({}), _ = v([]), ae = Z("indicatorUrl", ""), Q = v([]), O = v(!1), y = v({}), M = fe({
      keyName: "",
      visible: !1,
      columns: [],
      title: ""
    }), G = v([]), W = v(), re = me(() => {
      let i = `drill-modal ${b}`;
      return O.value && (i += " full"), r(S) && (i += ` ${r(S)}`), i;
    }), D = (i) => {
      const a = document.querySelector(`.${b} .ant-modal-header`);
      if (a)
        if (i)
          a.addEventListener("mousedown", J);
        else {
          const f = a.parentElement;
          f && (f.style.left = "", f.style.top = ""), a.removeEventListener("mousedown", J);
        }
    }, K = (i) => {
      const a = document.querySelector(`.${b} .ant-modal-header`);
      a && (i ? a.addEventListener("dblclick", V) : a.removeEventListener("dblclick", V));
    }, J = (i) => {
      ye(i, `.${b} .ant-modal-header`);
    }, V = () => {
      O.value = !O.value, te(() => {
        O.value ? (r(y).width = parseFloat(r(w).width) * R + "px", r(y).height = (e.isIframeMode ? parseFloat(r(w).height) : window.screen.height) * T + "px", D(!1)) : (r(y).width = parseFloat(r(w).width) * l + "px", r(y).height = (e.isIframeMode ? parseFloat(r(w).height) : window.screen.height) * o + "px", D(!0));
      });
    }, se = () => {
      O.value = !1, K(!1), D(!1);
    }, ce = ({ drillDimension: i, drillFieldData: a, usedDimensionFields: f, tableProps: p, splitSymbol: c }) => {
      const N = Ce(p), { graphicConfig: m, allDimensions: E, pageConfig: d } = N, C = ne(6), s = [];
      G.value = [...f, i.label], E.value = E, d.value = d;
      const u = m.indicators.filter((g) => g.show).map((g) => g.label);
      u != null && u.length && (M.title = `下钻：${u.join("、")}`);
      for (const g of a) {
        const h = E.find((Y) => [Y.title, Y.label].includes(g.dimensionKey)), L = g.value.split(c);
        let X = g.value;
        L != null && L.length && (X = L[L.length - 1]), s.push({
          conditionKey: h.label,
          conditionLabel: h.title || h.label,
          conditionName: h.name,
          conditionValueType: h.genericType,
          indexCode: h.indexCode,
          typeGuid: h.typeGuid,
          indexCodeNum: h.indexCodeNum,
          rule: "EQUAL",
          dataType: "",
          customValue: X
        });
      }
      m.queryColumnList = [i], s != null && s.length && (m.controlList || (m.controlList = []), m.controlList.push(...s), m.controlList = [
        {
          join: "&&",
          conditions: m.controlList
        }
      ]), y.value = {
        ...N,
        id: C,
        keyName: `透视表_${C}`,
        position: "relative",
        top: 0,
        left: 0,
        width: parseFloat(r(d).width) * l + "px",
        height: (e.isIframeMode ? parseFloat(r(d).height) : window.screen.height) * o + "px",
        graphicConfig: m
      }, M.visible = !0, te(() => {
        r(W).refreshData(), K(!0), D(!0);
      });
    }, de = ({ type: i, data: a }) => {
      if (i === "11" && a) {
        const {
          indicatorList: f = [],
          queryColumns: p = []
        } = a, N = f.concat(p).filter((d) => d.conditions || d.filter), m = F(N, "conditions", !0), E = F(a.sqlConditions, "sqlConditions", !1);
        Q.value = m.concat(E).map((d) => {
          const C = r(_).find((u) => u.label === d.label);
          let s = d.fieldValue;
          if (s && typeof s == "string") {
            const u = s.split(",");
            (u == null ? void 0 : u.length) > 3 && (s = u.slice(0, 3).join(",") + "等");
          } else
            s || (s = '""');
          return `${(C == null ? void 0 : C.title) || d.label} ${n[d.rule]} ${s}`;
        }) || [];
      }
    };
    function F(i, a, f) {
      const p = [];
      for (const c of i)
        c[a] ? p.push(...F(c[a], a, f)) : c.filter ? p.push({
          ...c.filter,
          label: c.label
        }) : (!f || c.dataType !== "component" && !(c.fieldValue.startsWith("${") && c.fieldValue.endsWith("}"))) && p.push(c);
      return p;
    }
    return pe(M.visible, (i) => {
      window.modalShow && window.modalShow(i);
    }), t({
      showModal: ce
    }), {
      theme: S,
      wrapClassName: re,
      conditionInfo: Q,
      drillInfo: M,
      pivotTableConfig: y,
      indicatorUrl: ae,
      isIndFullScreen: O,
      usedDimensionFields: G,
      pivotTableRef: W,
      toggleFullScreen: V,
      onDetailCancel: se,
      onPivotTableChange: de,
      getContainer: j
    };
  }
}), Fe = ["title"];
function Ae(e, t, n, l, o, R) {
  const T = $("close-outlined"), b = $("switcher-outlined"), j = $("border-outlined"), S = $("ecan-pivot-table"), w = $("a-modal");
  return P(), A(w, {
    "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: B(() => [
      x("div", {
        class: "modal-title",
        title: e.conditionInfo.join("、")
      }, ee(e.drillInfo.title) + " " + ee(e.conditionInfo.join("、")), 9, Fe)
    ]),
    closeIcon: B(() => [
      I(T, {
        class: H(["modal-icon", e.theme])
      }, null, 8, ["class"])
    ]),
    default: B(() => [
      x("div", {
        class: "zoom-btn",
        onClick: t[0] || (t[0] = (..._) => e.toggleFullScreen && e.toggleFullScreen(..._))
      }, [
        e.isIndFullScreen ? (P(), A(b, {
          key: 0,
          class: H(["modal-icon", e.theme])
        }, null, 8, ["class"])) : (P(), A(j, {
          key: 1,
          class: H(["modal-icon", e.theme])
        }, null, 8, ["class"]))
      ]),
      e.drillInfo.visible ? (P(), 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,
          showClear: !1,
          isAllowSaveConfig: !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__ */ we(Ve, [["render", Ae], ["__scopeId", "data-v-412e66d4"]]);
export {
  Ke as default
};
//# sourceMappingURL=DrillModal-39f3cfc0.mjs.map
