var oe = Object.defineProperty;
var ie = (e, t, s) => t in e ? oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var k = (e, t, s) => (ie(e, typeof t != "symbol" ? t + "" : t, s), s);
import { GridFieldColumnController as B, GridRowController as re, WFStepTraceViewController as ne, UploadEditorController as $, WFDynaEditView3Controller as ae } from "@ibiz-template/controller";
import { defineComponent as U, computed as M, h as d, getCurrentInstance as W, ref as p, watch as T, toRefs as O } from "vue";
import { useNamespace as E, useViewController as j, usePropsWatch as q, getUploadProps as le, getEditorEmits as ce, getGridUploadProps as V, getGridEditorEmits as H, useClickOutside as de, useEventListener as ue, useWFStepTraceViewController as me, useEditView3Controller as pe } from "@ibiz-template/vue-util";
import { colorBlend as he, HttpError as J, isImage as fe, uploadFile as be, RuntimeError as ve } from "@ibiz-template/core";
import { getCookie as we } from "qx-util";
import { ViewMode as Y, PluginStaticResource as ye } from "@ibiz-template/runtime";
import { ViewType as ge } from "@ibiz-template/model";
const Fe = U({
  name: "CodeListGridColumn",
  props: {
    controller: {
      type: B,
      required: !0
    },
    row: {
      type: re,
      required: !0
    }
  },
  setup(e) {
    const t = E("grid-field-column"), s = M(() => {
      var l;
      if (e.controller.model.source.cLConvertMode !== "FRONT")
        return [];
      const n = e.row.data[e.controller.model.codeName];
      return (l = e.controller.codeListItems) != null && l.length && n ? n.split(",").map((f) => {
        const w = e.controller.codeListItems.find((h) => h.value === f);
        if (w) {
          const h = w.color || "#515a6e";
          return {
            text: w.text,
            colorStyle: t.cssVarBlock({
              color: h,
              "border-color": h,
              "bg-color": he(h, "#fff")
            })
          };
        }
      }).filter(Boolean) : [];
    }), o = (n) => {
      e.controller.isLinkColumn && e.controller.openLinkView(e.row, n);
    }, r = M(() => {
      let n = "";
      switch (e.controller.model.align) {
        case "LEFT":
          n = "flex-start";
          break;
        case "RIGHT":
          n = "flex-end";
          break;
        default:
          n = "center";
          break;
      }
      return t.cssVarBlock({
        "justify-content": n
      });
    });
    return {
      ns: t,
      alignStyle: r,
      selectedItems: s,
      onCellClick: o
    };
  },
  render() {
    const e = this.controller, t = this.row.data[e.model.codeName];
    return d("div", {
      class: [this.ns.b(), e.isLinkColumn && this.ns.m("link-column")],
      style: this.alignStyle,
      on: {
        click: this.onCellClick
      }
    }, [this.selectedItems.length > 0 ? this.selectedItems.map((s) => d("span", {
      class: this.ns.e("code-list-item"),
      style: s.colorStyle
    }, [s.text])) : d("span", {
      class: this.ns.e("text")
    }, [t])]);
  }
});
class Ce extends ne {
  constructor() {
    super(...arguments);
    /**
     * 流程图url
     *
     * @type {string}
     * @memberof PresetWFChartViewController
     */
    k(this, "imgSrc");
  }
  async getUIData() {
    const s = Object.assign(this.context.clone(), this.params), o = await this.entityService.wf.getWFProcessDiagram(s), r = new Blob([o.data]);
    this.imgSrc = URL.createObjectURL(r);
  }
}
const Ue = U({
  name: "PresetWFChartView",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const t = E("preset-wf-chart-view"), {
      proxy: s
    } = W(), o = j(s, (r, n) => new Ce(e.modelPath, r, n));
    return q(s, "deName", o.setDeName.bind(o)), {
      c: o,
      ns: t
    };
  },
  render() {
    return d("div", {
      class: this.ns.b()
    }, [d("img", {
      attrs: {
        src: this.c.imgSrc
      }
    })]);
  }
});
const Se = U({
  name: "WFToolbar",
  props: {
    wfLinks: {
      type: Array,
      required: !0
    }
  },
  setup(e, {
    emit: t
  }) {
    return {
      ns: E("wf-toolbar"),
      handleClick: async (r, n) => {
        t("wf-link-click", r, n);
      }
    };
  },
  render() {
    const e = this.wfLinks || [];
    return d("div", {
      class: `${this.ns.b()}`
    }, [e.length > 0 && e.map((t) => {
      const s = t.sequenceFlowName == "驳回" || t.sequenceFlowName == "取消";
      return d("div", {
        key: t.sequenceFlowId,
        class: [this.ns.e("item"), s ? this.ns.em("item", "reject") : ""]
      }, [d("i-button", {
        attrs: {
          title: t.sequenceFlowName
        },
        on: {
          click: (o) => this.handleClick(t, o)
        }
      }, [t.sequenceFlowName || ""])]);
    })]);
  }
}), Ee = typeof btoa == "function", A = typeof Buffer == "function";
typeof TextDecoder == "function" && new TextDecoder();
const R = typeof TextEncoder == "function" ? new TextEncoder() : void 0, xe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", I = Array.prototype.slice.call(xe);
((e) => {
  let t = {};
  return e.forEach((s, o) => t[s] = o), t;
})(I);
const S = String.fromCharCode.bind(String);
typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array);
const ke = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), Te = (e) => {
  let t, s, o, r, n = "";
  const l = e.length % 3;
  for (let c = 0; c < e.length; ) {
    if ((s = e.charCodeAt(c++)) > 255 || (o = e.charCodeAt(c++)) > 255 || (r = e.charCodeAt(c++)) > 255)
      throw new TypeError("invalid character found");
    t = s << 16 | o << 8 | r, n += I[t >> 18 & 63] + I[t >> 12 & 63] + I[t >> 6 & 63] + I[t & 63];
  }
  return l ? n.slice(0, l - 3) + "===".substring(l) : n;
}, K = Ee ? (e) => btoa(e) : A ? (e) => Buffer.from(e, "binary").toString("base64") : Te, Pe = A ? (e) => Buffer.from(e).toString("base64") : (e) => {
  let s = [];
  for (let o = 0, r = e.length; o < r; o += 4096)
    s.push(S.apply(null, e.subarray(o, o + 4096)));
  return K(s.join(""));
}, Ie = (e) => {
  if (e.length < 2) {
    var t = e.charCodeAt(0);
    return t < 128 ? e : t < 2048 ? S(192 | t >>> 6) + S(128 | t & 63) : S(224 | t >>> 12 & 15) + S(128 | t >>> 6 & 63) + S(128 | t & 63);
  } else {
    var t = 65536 + (e.charCodeAt(0) - 55296) * 1024 + (e.charCodeAt(1) - 56320);
    return S(240 | t >>> 18 & 7) + S(128 | t >>> 12 & 63) + S(128 | t >>> 6 & 63) + S(128 | t & 63);
  }
}, Le = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, De = (e) => e.replace(Le, Ie), z = A ? (e) => Buffer.from(e, "utf8").toString("base64") : R ? (e) => Pe(R.encode(e)) : (e) => K(De(e)), Q = (e, t = !1) => t ? ke(z(e)) : z(e);
function Ne(e, t, s) {
  var P;
  const o = p([]), r = p({
    Authorization: `Bearer ${we("access_token")}`
  }), n = p(""), l = p(""), c = {
    count: 0,
    cacheFiles: []
    // iview上传过程中不能改default-file-list,所以需要缓存
  }, u = (P = s.editorParams) == null ? void 0 : P.blackList;
  let f = [];
  u && typeof u == "string" && (f = u.split(",")), T(
    () => e.value,
    (i) => {
      o.value = i ? JSON.parse(i) : [];
    },
    { immediate: !0 }
  ), T(
    () => e.data,
    (i) => {
      if (i) {
        const a = s.calcBaseUrl(i);
        n.value = a.uploadUrl, l.value = a.downloadUrl;
      }
    },
    { immediate: !0, deep: !0 }
  ), T(
    o,
    (i) => {
      i != null && i.length && l.value && i.forEach((a) => {
        a.url = a.url || l.value.replace("%fileId%", a.id);
      });
    },
    { immediate: !0 }
  ), T(
    l,
    (i) => {
      i && o.value.length && o.value.forEach((a) => {
        a.url = l.value.replace("%fileId%", a.id);
      });
    },
    { immediate: !0 }
  );
  const w = () => {
    const i = [...o.value, ...c.cacheFiles], a = i.length > 0 ? JSON.stringify(i.map((m) => ({ name: m.name, id: m.id }))) : null;
    c.cacheFiles = [], t(a);
  }, h = (i) => {
    const a = i.name.trim().toLowerCase();
    if (f.some((v) => a.endsWith(`.${v}`)))
      return ibiz.message.error(`不可上传 ${f.join("、")}类型的文件！`), !1;
    c.count += 1;
  }, F = (i) => {
    i && (c.cacheFiles.push({
      name: i.filename,
      id: i.fileid
    }), c.count -= 1, c.count === 0 && w());
  }, C = (i, a) => {
    throw c.count -= 1, new J({
      response: { data: a, status: i.status }
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
    });
  }, x = (i) => {
    if (e.disabled)
      return;
    const a = o.value.findIndex((m) => m.id === i.id);
    a !== -1 && o.value.splice(a, 1), w();
  }, b = (i) => {
    const a = i.url || l.value.replace("%fileId%", i.id);
    s.fileDownload({ url: a, name: i.name });
  }, g = p(!1), y = p(""), L = p("");
  return {
    uploadUrl: n,
    downloadUrl: l,
    headers: r,
    files: o,
    onDownload: b,
    onError: C,
    onRemove: x,
    onSuccess: F,
    beforeUpload: h,
    showModal: g,
    modalTitle: y,
    iframeUrl: L,
    onModalCancel: () => {
      g.value = !1, y.value = "", L.value = "";
    },
    previewFile: (i) => {
      g.value = !0, y.value = i.name;
      const a = window.Environment.previewFileUrl;
      if (a) {
        const m = encodeURIComponent(
          Q(
            `${window.location.origin}${i.url}?fullfilename=${i.name}`
          )
        );
        L.value = `${a}/onlinePreview?url=${m}`;
      }
    }
  };
}
const _e = U({
  name: "SyFileUpload",
  props: le(),
  emits: ce(),
  setup(e, {
    emit: t
  }) {
    const s = E("sy-file-upload"), o = e.controller, {
      uploadUrl: r,
      headers: n,
      files: l,
      onDownload: c,
      onError: u,
      onRemove: f,
      onSuccess: w,
      beforeUpload: h,
      showModal: F,
      modalTitle: C,
      iframeUrl: x,
      onModalCancel: b,
      previewFile: g
    } = Ne(e, (y) => {
      t("change", y);
    }, o);
    return {
      ns: s,
      c: o,
      uploadUrl: r,
      headers: n,
      files: l,
      onDownload: c,
      onError: u,
      onRemove: f,
      onSuccess: w,
      beforeUpload: h,
      showModal: F,
      modalTitle: C,
      iframeUrl: x,
      onModalCancel: b,
      previewFile: g
    };
  },
  render(e) {
    return e("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [e("IUpload", {
      ref: "fileUpload",
      props: {
        action: this.uploadUrl,
        headers: this.headers,
        disabled: this.disabled,
        "default-file-list": this.files,
        multiple: this.c.model.multiple,
        type: this.c.model.isDrag ? "drag" : "select",
        accept: this.c.model.accept,
        "before-upload": this.beforeUpload,
        "on-success": this.onSuccess,
        "on-error": this.onError,
        "on-remove": this.onRemove,
        "on-preview": this.onDownload,
        "show-upload-list": !1
      }
    }, [this.c.model.isDrag ? e("div", {
      class: this.ns.bm("box", "drag")
    }, [e("i-icon", {
      attrs: {
        type: "md-cloud-upload"
      }
    }), e("div", {
      class: this.ns.be("box", "title")
    }, [e("span", ["将文件拖到此处，或"]), e("span", ["点击上传"])])]) : e("i-button", {
      attrs: {
        icon: "ios-cloud-upload-outline"
      },
      class: this.ns.bm("box", "select")
    }, ["上传文件"])]), e("div", {
      class: this.ns.b("file-list")
    }, [this.files.map((t) => e("div", {
      class: this.ns.b("file-item"),
      key: t.id
    }, [e("div", {
      class: this.ns.b("file-item-right")
    }, [e("div", {
      class: this.ns.b("file-item-right-title"),
      on: {
        click: () => this.previewFile(t)
      }
    }, [t.name]), e("div", {
      class: this.ns.b("file-item-right-action")
    }, [e("i-icon", {
      attrs: {
        type: "md-download"
      },
      on: {
        click: () => this.onDownload(t)
      }
    }), e("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(t)
      }
    }), this.disabled || this.readonly ? null : e("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.onRemove(t)
      }
    })])])]))]), e("i-modal", {
      attrs: {
        value: this.showModal,
        title: this.modalTitle,
        "class-name": this.ns.b("modal"),
        width: "70%",
        transfer: !1,
        "footer-hide": !0
      },
      on: {
        "on-cancel": this.onModalCancel
      }
    }, [e("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
});
function _(e, t) {
  if (e.url = t.replace("%fileId%", e.id), e.status || (e.status = "finished"), !e.fileName) {
    const s = e.name.lastIndexOf(".");
    e.fileName = e.name.substring(0, s), e.fileExt = e.name.substring(s), e.isImage = fe(e.name);
  }
  return e;
}
function X(e) {
  const t = p(""), s = p(""), o = p([]);
  return T(
    e.data,
    (r) => {
      if (r) {
        const n = e.controller.value.calcBaseUrl(r);
        t.value = n.uploadUrl, s.value = n.downloadUrl;
      }
    },
    { immediate: !0, deep: !0 }
  ), T(
    e.value,
    (r) => {
      o.value = r ? JSON.parse(r) : [], o.value.length && s.value && o.value.forEach((n) => {
        _(n, s.value);
      });
    },
    { immediate: !0 }
  ), T(
    s,
    (r) => {
      r && o.value.length && o.value.forEach((n) => {
        _(n, r);
      });
    },
    { immediate: !0 }
  ), {
    downloadUrl: s,
    uploadUrl: t,
    valueList: o
  };
}
function Z(e) {
  var G, P;
  const t = p("undo"), s = p([]), { downloadUrl: o, value: r, uploadUrl: n, controller: l } = e, c = (P = (G = l == null ? void 0 : l.value) == null ? void 0 : G.editorParams) == null ? void 0 : P.blackList;
  let u = [];
  c && typeof c == "string" && (u = c.split(",")), T(
    r,
    (i) => {
      i.length > 0 && (s.value = [], i.forEach((a) => {
        s.value.push(_(a, o.value));
      }));
    },
    {
      immediate: !0,
      deep: !0
    }
  );
  const f = (i, a) => {
    const m = [];
    return a.forEach((v, D) => {
      const N = v.name.trim().toLowerCase();
      if (u.some((se) => N.endsWith(`.${se}`))) {
        m.push(D);
        return;
      }
      s.value.push({
        name: v.name,
        status: v.status,
        percentage: v.percentage,
        id: v.uid,
        url: ""
      });
    }), m.length === a.length ? (ibiz.message.error(`不可上传 ${u.join("、")}类型的文件！`), !1) : (m.length && (m.forEach((v) => {
      i.splice(v, 1), a.splice(v, 1);
    }), ibiz.message.error(`不可上传 ${u.join("、")}类型的文件！`)), !0);
  }, w = (i) => {
    i.forEach((a) => {
      s.value.find((m) => m.id === a.uid ? (m.percentage = a.percentage, !0) : !1);
    });
  }, h = (i, a) => {
    i.forEach((m) => {
      s.value.find((v) => v.id === m.uid ? (v.status = m.status, v.id = a.data.fileid, v.name = a.data.filename, _(v, o.value), !0) : !1);
    });
  }, F = (i, a) => {
    var v;
    i.forEach((D) => {
      s.value.find((N) => N.id === D.uid ? (N.status = D.status, !0) : !1);
    });
    const m = new J(a);
    ibiz.notification.error({
      title: (v = m.status) == null ? void 0 : v.toString(),
      desc: m.message,
      duration: 10
    });
  }, C = (i) => {
    s.value = s.value.filter((a) => a.status === "finished"), t.value = "done";
  }, x = () => {
    be({
      multiple: e.multiple,
      accept: e.accept,
      uploadUrl: n.value,
      beforeUpload: f,
      progress: w,
      success: h,
      error: F,
      finish: C
    });
  }, b = p(!1), g = p(""), y = p("");
  return {
    selectFile: x,
    fileList: s,
    uploadState: t,
    showModal: b,
    modalTitle: g,
    iframeUrl: y,
    onModalCancel: () => {
      b.value = !1, g.value = "", y.value = "";
    },
    previewFile: (i) => {
      b.value = !0, g.value = i.name;
      const a = window.Environment.previewFileUrl;
      if (a) {
        const m = encodeURIComponent(
          Q(
            `${window.location.origin}${i.url}?fullfilename=${i.name}`
          )
        );
        y.value = `${a}/onlinePreview?url=${m}`;
      }
    }
  };
}
const We = U({
  name: "SyGridFileUpload",
  props: V(),
  setup(e) {
    const t = E("sy-grid-file-upload"), {
      value: s,
      data: o,
      controller: r
    } = O(e), {
      downloadUrl: n,
      uploadUrl: l,
      valueList: c
    } = X({
      value: s,
      data: o,
      controller: r
    }), {
      fileList: u,
      showModal: f,
      modalTitle: w,
      iframeUrl: h,
      previewFile: F,
      onModalCancel: C
    } = Z({
      downloadUrl: n,
      uploadUrl: l,
      value: c
    });
    return {
      ns: t,
      fileList: u,
      showModal: f,
      modalTitle: w,
      iframeUrl: h,
      downloadFile: (b) => {
        e.controller.fileDownload(b);
      },
      previewFile: F,
      onModalCancel: C
    };
  },
  render() {
    return d("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [d("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => d("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [d("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.previewFile(e)
      }
    }, [e.name]), d("div", {
      class: this.ns.b("file-item-action")
    }, [d("i-icon", {
      attrs: {
        type: "md-download"
      },
      on: {
        click: () => this.downloadFile(e)
      }
    }), d("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(e)
      }
    })])]))]), d("i-modal", {
      attrs: {
        value: this.showModal,
        title: this.modalTitle,
        "class-name": this.ns.b("modal"),
        width: "70%",
        transfer: !1,
        "footer-hide": !0
      },
      on: {
        "on-cancel": this.onModalCancel
      }
    }, [d("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
}), Ge = U({
  name: "SyGridFileUploadContainer",
  props: V(),
  emits: H(),
  render(e) {
    return this.disabled || this.readonly ? e("SyGridFileUpload", {
      props: {
        ...this.$props
      }
    }) : e("SyEditGridFileUpload", {
      props: {
        ...this.$props
      },
      on: {
        change: (t, s) => {
          this.$emit("change", t, s);
        },
        rowSave: () => {
          this.$emit("rowSave");
        }
      }
    });
  }
});
const Oe = U({
  name: "SyEditGridFileUploadPopover",
  props: {
    uploadUrl: {
      type: String,
      required: !0
    },
    downloadUrl: {
      type: String,
      required: !0
    },
    value: {
      type: Array,
      required: !0
    },
    controller: {
      type: $,
      required: !0
    }
  },
  emits: {
    close: (e) => !0
  },
  setup(e, {
    emit: t
  }) {
    const s = E("sy-edit-grid-file-upload-popover"), {
      downloadUrl: o,
      value: r,
      uploadUrl: n,
      controller: l
    } = O(e), {
      fileList: c,
      uploadState: u,
      selectFile: f
    } = Z({
      downloadUrl: o,
      value: r,
      uploadUrl: n,
      controller: l
    }), w = p(), h = p(!1), F = de(w, async (b) => {
      t("close", {
        isModified: h.value,
        resultFiles: c.value
      });
    });
    return T(u, (b) => {
      b === "done" ? (h.value = !0, F.proceed()) : b === "loading" && F.pause();
    }), {
      ns: s,
      componentRef: w,
      fileList: c,
      deleteFile: (b) => {
        const g = c.value.findIndex((y) => y.id === b.id);
        c.value.splice(g, 1), h.value = !0;
      },
      selectFile: f,
      downloadFile: (b) => {
        e.controller.fileDownload(b);
      }
    };
  },
  render() {
    return d("div", {
      ref: "componentRef",
      style: "width:300px",
      class: this.ns.b()
    }, [d("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => d("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [d("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.downloadFile(e)
      }
    }, [e.name]), d("div", {
      class: this.ns.b("file-item-action")
    }, [d("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.deleteFile(e)
      }
    })])]))]), d("div", {
      on: {
        click: () => this.selectFile()
      },
      class: this.ns.e("button")
    }, [d("i-icon", {
      attrs: {
        type: "md-add"
      }
    }), "添加文件"])]);
  }
});
const Ve = U({
  name: "SyEditGridFileUpload",
  props: V(),
  emits: H(),
  setup(e, {
    emit: t
  }) {
    const s = E("sy-edit-grid-file-upload"), {
      value: o,
      data: r,
      controller: n
    } = O(e), {
      downloadUrl: l,
      uploadUrl: c,
      valueList: u
    } = X({
      value: o,
      data: r,
      controller: n
    }), f = p(), w = async () => {
      if (!f.value)
        throw new ve("容器元素不存在");
      const h = f.value.$el, F = h.offsetHeight, C = ibiz.overlay.createPopover((g) => g(Oe, {
        props: {
          value: u.value,
          uploadUrl: c.value,
          downloadUrl: l.value,
          controller: n.value
        },
        on: {
          close: (y) => {
            C.dismiss(y);
          }
        }
      }), void 0, {
        noArrow: !0,
        placement: "bottom-start",
        offsetOpts: {
          mainAxis: -F,
          crossAxis: 0
        }
      });
      await C.present(h);
      const {
        isModified: x,
        resultFiles: b
      } = await C.onWillDismiss();
      if (x) {
        const g = b.length > 0 ? JSON.stringify(b.map((y) => ({
          name: y.name,
          id: y.id
        }))) : null;
        t("change", g), t("rowSave");
      }
    };
    return ue(f, "click", (h) => {
      e.disabled || w();
    }), {
      ns: s,
      valueList: u,
      componentRef: f
    };
  },
  render() {
    return d("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      ref: "componentRef",
      class: this.ns.b()
    }, [d("div", {
      class: this.ns.b("file-list")
    }, [this.valueList.map((e) => d("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [d("div", {
      class: this.ns.b("file-item-title")
    }, [e.name])]))])]);
  }
});
class Ae {
  constructor() {
    k(this, "component", Ue);
  }
}
class Me {
  constructor() {
    k(this, "component", Fe);
  }
  async createController(t, s) {
    const o = new B(t, s);
    return await o.init(), o;
  }
}
class Re {
  constructor() {
    k(this, "component", "IndexView");
  }
}
const ee = U({
  name: "WFStepTraceGrid",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const {
      proxy: t
    } = W(), s = me(t, e.modelPath);
    q(t, "deName", s.setDeName.bind(s));
    const o = E("wf-step-trace-grid"), r = p([]);
    s.nerve.self.evt.on("mounted", () => {
      var l;
      s.data && ((l = s.data.usertasks) == null || l.forEach((c) => {
        c.identitylinks.length > 0 || (c.comments.length > 0 && c.comments.forEach((u) => {
          r.value.push({
            nodeName: c.userTaskName,
            personName: u.authorName,
            time: u.time,
            content: u.type,
            comment: u.fullMessage
          });
        }), r.value.sort((u, f) => Date.parse(f.time) - Date.parse(u.time)));
      }));
    });
    const n = p([{
      title: "处理环节",
      key: "nodeName",
      width: 180,
      resizable: !0
    }, {
      title: "处理人",
      key: "personName",
      width: 180,
      resizable: !0
    }, {
      title: "处理时间",
      key: "time",
      width: 180,
      resizable: !0
    }, {
      title: "处理内容",
      key: "content",
      width: 180,
      resizable: !0
    }, {
      title: "处理意见",
      key: "comment"
    }]);
    return {
      c: s,
      ns: o,
      gridData: r,
      columns: n
    };
  },
  render() {
    return d("div", {
      class: this.ns.b()
    }, [d("div", {
      class: this.ns.e("title")
    }, ["审批信息"]), d("i-table", {
      attrs: {
        "disabled-hover": !0,
        columns: this.columns,
        data: this.gridData
      },
      class: this.ns.e("grid")
    })]);
  }
});
class ze extends ae {
  async calcWfToolbar() {
    await super.calcWfToolbar(), this.isEditable && this.wfLinks.unshift({
      sequenceFlowName: "保存",
      type: "FORM_SAVE"
    });
  }
  async onLinkClick(t) {
    t.type === "FORM_SAVE" ? await this.save() : super.onLinkClick(t);
  }
}
const Be = U({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = W(), s = j(t, (l, c) => new ze(e.modelPath, l, c)), o = E(`view-${ge.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), r = p(["mainForm"]);
    return {
      c: s,
      ns: o,
      onTabClick: (l) => {
        r.value.includes(l) || r.value.push(l);
      },
      lazyList: r
    };
  },
  render(e) {
    const t = [];
    if (this.c.complete) {
      const {
        activeForm: s
      } = this.c;
      s && this.c.providers[s.name] && t.push(e(this.c.providers[s.name].component, {
        props: {
          modelData: s,
          context: this.c.context,
          params: this.c.params
        },
        style: {
          height: "auto"
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit("form")
        }
      }));
    }
    if (this.c.complete && this.c.model.drTab.pages[0]) {
      const s = this.c.model.drTab.pages[0], o = this.c.drPages[s.source.name];
      t.push(e(ee, {
        attrs: {
          context: o.context,
          params: o.params,
          deName: this.c.model.appEntity.source.codeName,
          modal: this.modal,
          modelPath: s.embedView.source.modelPath
        }
      }));
    }
    return e("view-base", {
      attrs: {
        controller: this.c
      },
      scopedSlots: {
        toolbar: () => this.c.complete ? [this.c.wfLinks.length > 0 && e("wf-toolbar", {
          attrs: {
            wfLinks: this.c.wfLinks
          },
          on: {
            "wf-link-click": (s) => {
              this.c.onLinkClick(s);
            }
          }
        })] : null
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [t]), this.c.model.drTab.pages.map((s) => {
      const o = this.c.drPages[s.source.name];
      return e("i-tab-pane", {
        class: this.ns.be("", "tab-item"),
        attrs: {
          tab: this.c.model.drTab.source.name,
          disabled: this.c.isNewData,
          label: s.source.caption,
          name: s.source.name
        }
      }, [!this.c.isNewData && this.lazyList.includes(s.source.name) && e("ViewShell", {
        attrs: {
          context: o.context,
          params: o.params,
          modal: {
            mode: Y.EMBED
          },
          modelPath: s.embedView.source.modelPath,
          // 流程跟踪视图用
          deName: this.c.model.appEntity.source.codeName
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit(s.source.name)
        },
        key: o.key
      })]);
    })])]);
  }
});
class $e {
  constructor() {
    k(this, "component", Be);
  }
}
const je = U({
  name: "SyEditView3",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = W(), s = pe(t, e.modelPath), o = E("view-deeditview3"), r = p(["mainForm"]);
    return {
      c: s,
      ns: o,
      onTabClick: (l) => {
        r.value.includes(l) || r.value.push(l);
      },
      lazyList: r
    };
  },
  render(e) {
    return e("view-base", {
      attrs: {
        controller: this.c
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [e("edit-form-control", {
      attrs: {
        modelData: this.c.model.form,
        context: this.c.context,
        params: this.c.params
      },
      style: {
        height: "auto"
      },
      on: {
        neuronInit: this.c.nerve.onNeuronInit(this.c.model.form.source.name)
      }
    }), e(ee, {
      attrs: {
        context: this.c.drPages[this.c.model.drTab.pages[0].source.name].context,
        params: this.c.drPages[this.c.model.drTab.pages[0].source.name].params,
        deName: this.c.model.appEntity.source.codeName,
        modal: this.modal,
        modelPath: this.c.model.drTab.pages[0].embedView.source.modelPath
      }
    })]), this.c.model.drTab.pages.map((t) => {
      const s = this.c.drPages[t.source.name];
      if (s)
        return e("i-tab-pane", {
          class: this.ns.be("", "tab-item"),
          attrs: {
            tab: this.c.model.drTab.source.name,
            disabled: this.c.isNewData,
            label: t.source.caption,
            name: t.source.name
          }
        }, [!this.c.isNewData && this.lazyList.includes(t.source.name) && e("ViewShell", {
          attrs: {
            context: s.context,
            params: s.params,
            modal: {
              mode: Y.EMBED
            },
            modelPath: t.embedView.source.modelPath,
            // 流程跟踪视图用
            deName: this.c.model.appEntity.source.codeName
          },
          on: {
            neuronInit: this.c.nerve.onNeuronInit(t.source.name)
          },
          key: s.key
        })]);
    })])]);
  }
});
class qe {
  constructor() {
    k(this, "component", je);
  }
}
class He {
  constructor() {
    k(this, "formEditor", "SyFileUpload");
    k(this, "gridEditor", "SyGridFileUploadContainer");
  }
  async createController(t, s) {
    const o = new $(t, s);
    return await o.init(), o;
  }
}
const Je = new ye(import.meta.url), it = {
  mateUrl: import.meta.url,
  install(e) {
    Je.loadStyle(["/style.css"]), ibiz.config.enableDataInfoBar = !1, ibiz.config.gridEditShowMode = "all", e.component("WfToolbar", Se), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWebIndexView",
      new Re()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_PresetWFChartView",
      new Ae()
    ), ibiz.register.gridColumn.register(
      "GRID_COLRENDER_CodeListGridColumn",
      new Me()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWfDynaEditView3",
      new $e()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyEditView3",
      new qe()
    ), e.component("SyFileUpload", _e), e.component("SyGridFileUpload", We), e.component("SyEditGridFileUpload", Ve), e.component("SyGridFileUploadContainer", Ge), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_SyFileUpload",
      new He()
    );
  }
};
export {
  it as default
};
