var X = Object.defineProperty;
var Z = (e, t, s) => t in e ? X(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var k = (e, t, s) => (Z(e, typeof t != "symbol" ? t + "" : t, s), s);
import { GridFieldColumnController as V, GridRowController as ee, WFStepTraceViewController as te, UploadEditorController as j } from "@ibiz-template/controller";
import { defineComponent as x, computed as W, h as c, getCurrentInstance as N, ref as m, watch as T, toRefs as _ } from "vue";
import { useNamespace as E, useViewController as se, usePropsWatch as z, getUploadProps as oe, getEditorEmits as ie, getGridUploadProps as G, getGridEditorEmits as B, useClickOutside as re, useEventListener as ne, useWFStepTraceViewController as ae, useWFDynaEditView3Controller as le, useEditView3Controller as ce } from "@ibiz-template/vue-util";
import { colorBlend as de, HttpError as R, isImage as ue, uploadFile as me, RuntimeError as pe } from "@ibiz-template/core";
import { getCookie as he } from "qx-util";
import { ViewMode as $, PluginStaticResource as fe } from "@ibiz-template/runtime";
import { ViewType as be } from "@ibiz-template/model";
const ve = x({
  name: "CodeListGridColumn",
  props: {
    controller: {
      type: V,
      required: !0
    },
    row: {
      type: ee,
      required: !0
    }
  },
  setup(e) {
    const t = E("grid-field-column"), s = W(() => {
      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((v) => {
        const y = e.controller.codeListItems.find((h) => h.value === v);
        if (y) {
          const h = y.color || "#515a6e";
          return {
            text: y.text,
            colorStyle: t.cssVarBlock({
              color: h,
              "border-color": h,
              "bg-color": de(h, "#fff")
            })
          };
        }
      }).filter(Boolean) : [];
    }), o = (n) => {
      e.controller.isLinkColumn && e.controller.openLinkView(e.row, n);
    }, r = W(() => {
      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 c("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) => c("span", {
      class: this.ns.e("code-list-item"),
      style: s.colorStyle
    }, [s.text])) : c("span", {
      class: this.ns.e("text")
    }, [t])]);
  }
});
class we extends te {
  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 ye = x({
  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
    } = N(), o = se(s, (r, n) => new we(e.modelPath, r, n));
    return z(s, "deName", o.setDeName.bind(o)), {
      c: o,
      ns: t
    };
  },
  render() {
    return c("div", {
      class: this.ns.b()
    }, [c("img", {
      attrs: {
        src: this.c.imgSrc
      }
    })]);
  }
});
const ge = x({
  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 c("div", {
      class: `${this.ns.b()}`
    }, [e.length > 0 && e.map((t) => {
      const s = t.sequenceFlowName == "驳回" || t.sequenceFlowName == "取消";
      return c("div", {
        key: t.sequenceFlowId,
        class: [this.ns.e("item"), s ? this.ns.em("item", "reject") : ""]
      }, [c("i-button", {
        attrs: {
          title: t.sequenceFlowName
        },
        on: {
          click: (o) => this.handleClick(t, o)
        }
      }, [t.sequenceFlowName || ""])]);
    })]);
  }
}), Fe = typeof btoa == "function", O = typeof Buffer == "function";
typeof TextDecoder == "function" && new TextDecoder();
const A = typeof TextEncoder == "function" ? new TextEncoder() : void 0, Ce = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", P = Array.prototype.slice.call(Ce);
((e) => {
  let t = {};
  return e.forEach((s, o) => t[s] = o), t;
})(P);
const S = String.fromCharCode.bind(String);
typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array);
const Ue = (e) => e.replace(/=/g, "").replace(/[+\/]/g, (t) => t == "+" ? "-" : "_"), xe = (e) => {
  let t, s, o, r, n = "";
  const l = e.length % 3;
  for (let d = 0; d < e.length; ) {
    if ((s = e.charCodeAt(d++)) > 255 || (o = e.charCodeAt(d++)) > 255 || (r = e.charCodeAt(d++)) > 255)
      throw new TypeError("invalid character found");
    t = s << 16 | o << 8 | r, n += P[t >> 18 & 63] + P[t >> 12 & 63] + P[t >> 6 & 63] + P[t & 63];
  }
  return l ? n.slice(0, l - 3) + "===".substring(l) : n;
}, q = Fe ? (e) => btoa(e) : O ? (e) => Buffer.from(e, "binary").toString("base64") : xe, Se = O ? (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 q(s.join(""));
}, Ee = (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);
  }
}, ke = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, Te = (e) => e.replace(ke, Ee), M = O ? (e) => Buffer.from(e, "utf8").toString("base64") : A ? (e) => Se(A.encode(e)) : (e) => q(Te(e)), H = (e, t = !1) => t ? Ue(M(e)) : M(e);
function Ie(e, t, s) {
  const o = m([]), r = m({
    Authorization: `Bearer ${he("access_token")}`
  }), n = m(""), l = m(""), d = {
    count: 0,
    cacheFiles: []
    // iview上传过程中不能改default-file-list,所以需要缓存
  };
  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 p = () => {
    const i = [...o.value, ...d.cacheFiles], a = i.length > 0 ? JSON.stringify(i.map((b) => ({ name: b.name, id: b.id }))) : null;
    d.cacheFiles = [], t(a);
  }, v = (i) => {
    const a = ["html", "js", "exe", "sh"], b = i.name.trim().toLowerCase();
    if (a.some((L) => b.endsWith(`.${L}`)))
      return ibiz.message.error("不可上传 html、js、 exe、sh类型的文件！"), !1;
    d.count += 1;
  }, y = (i) => {
    i && (d.cacheFiles.push({
      name: i.filename,
      id: i.fileid
    }), d.count -= 1, d.count === 0 && p());
  }, h = (i, a) => {
    throw d.count -= 1, new R({
      response: { data: a, status: i.status }
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
    });
  }, C = (i) => {
    if (e.disabled)
      return;
    const a = o.value.findIndex((b) => b.id === i.id);
    a !== -1 && o.value.splice(a, 1), p();
  }, g = (i) => {
    const a = i.url || l.value.replace("%fileId%", i.id);
    s.fileDownload({ url: a, name: i.name });
  }, f = m(!1), F = m(""), U = m("");
  return {
    uploadUrl: n,
    downloadUrl: l,
    headers: r,
    files: o,
    onDownload: g,
    onError: h,
    onRemove: C,
    onSuccess: y,
    beforeUpload: v,
    showModal: f,
    modalTitle: F,
    iframeUrl: U,
    onModalCancel: () => {
      f.value = !1, F.value = "", U.value = "";
    },
    previewFile: (i) => {
      f.value = !0, F.value = i.name;
      const a = window.Environment.previewFileUrl;
      if (a) {
        const b = encodeURIComponent(
          H(
            `${window.location.origin}${i.url}?fullfilename=${i.name}`
          )
        );
        U.value = `${a}/onlinePreview?url=${b}`;
      }
    }
  };
}
const Pe = x({
  name: "SyFileUpload",
  props: oe(),
  emits: ie(),
  setup(e, {
    emit: t
  }) {
    const s = E("sy-file-upload"), o = e.controller, {
      uploadUrl: r,
      headers: n,
      files: l,
      onDownload: d,
      onError: p,
      onRemove: v,
      onSuccess: y,
      beforeUpload: h,
      showModal: C,
      modalTitle: g,
      iframeUrl: f,
      onModalCancel: F,
      previewFile: U
    } = Ie(e, (u) => {
      t("change", u);
    }, o);
    return {
      ns: s,
      c: o,
      uploadUrl: r,
      headers: n,
      files: l,
      onDownload: d,
      onError: p,
      onRemove: v,
      onSuccess: y,
      beforeUpload: h,
      showModal: C,
      modalTitle: g,
      iframeUrl: f,
      onModalCancel: F,
      previewFile: U
    };
  },
  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-left")
    }, [e("i-icon", {
      attrs: {
        type: "md-document"
      }
    })]), 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 D(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 = ue(e.name);
  }
  return e;
}
function J(e) {
  const t = m(""), s = m(""), o = m([]);
  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) => {
        D(n, s.value);
      });
    },
    { immediate: !0 }
  ), T(
    s,
    (r) => {
      r && o.value.length && o.value.forEach((n) => {
        D(n, r);
      });
    },
    { immediate: !0 }
  ), {
    downloadUrl: s,
    uploadUrl: t,
    valueList: o
  };
}
function Y(e) {
  const t = m("undo"), s = m([]), { downloadUrl: o, value: r, uploadUrl: n } = e;
  T(
    r,
    (u) => {
      u.length > 0 && (s.value = [], u.forEach((w) => {
        s.value.push(D(w, o.value));
      }));
    },
    {
      immediate: !0,
      deep: !0
    }
  );
  const l = (u, w) => {
    const i = ["html", "js", "exe", "sh"], a = [];
    return w.forEach((b, I) => {
      const L = b.name.trim().toLowerCase();
      if (i.some((Q) => L.endsWith(`.${Q}`))) {
        a.push(I);
        return;
      }
      s.value.push({
        name: b.name,
        status: b.status,
        percentage: b.percentage,
        id: b.uid,
        url: ""
      });
    }), a.length === w.length ? (ibiz.message.error("不可上传 html、js、 exe、sh类型的文件！"), !1) : (a.length && (a.forEach((b) => {
      u.splice(b, 1), w.splice(b, 1);
    }), ibiz.message.error("不可上传 html、js、 exe、sh类型的文件！")), !0);
  }, d = (u) => {
    u.forEach((w) => {
      s.value.find((i) => i.id === w.uid ? (i.percentage = w.percentage, !0) : !1);
    });
  }, p = (u, w) => {
    u.forEach((i) => {
      s.value.find((a) => a.id === i.uid ? (a.status = i.status, a.id = w.data.fileid, a.name = w.data.filename, D(a, o.value), !0) : !1);
    });
  }, v = (u, w) => {
    var a;
    u.forEach((b) => {
      s.value.find((I) => I.id === b.uid ? (I.status = b.status, !0) : !1);
    });
    const i = new R(w);
    ibiz.notification.error({
      title: (a = i.status) == null ? void 0 : a.toString(),
      desc: i.message,
      duration: 10
    });
  }, y = (u) => {
    s.value = s.value.filter((w) => w.status === "finished"), t.value = "done";
  }, h = () => {
    me({
      multiple: e.multiple,
      accept: e.accept,
      uploadUrl: n.value,
      beforeUpload: l,
      progress: d,
      success: p,
      error: v,
      finish: y
    });
  }, C = m(!1), g = m(""), f = m("");
  return {
    selectFile: h,
    fileList: s,
    uploadState: t,
    showModal: C,
    modalTitle: g,
    iframeUrl: f,
    onModalCancel: () => {
      C.value = !1, g.value = "", f.value = "";
    },
    previewFile: (u) => {
      C.value = !0, g.value = u.name;
      const w = window.Environment.previewFileUrl;
      if (w) {
        const i = encodeURIComponent(
          H(
            `${window.location.origin}${u.url}?fullfilename=${u.name}`
          )
        );
        f.value = `${w}/onlinePreview?url=${i}`;
      }
    }
  };
}
const De = x({
  name: "SyGridFileUpload",
  props: G(),
  setup(e) {
    const t = E("sy-grid-file-upload"), {
      value: s,
      data: o,
      controller: r
    } = _(e), {
      downloadUrl: n,
      uploadUrl: l,
      valueList: d
    } = J({
      value: s,
      data: o,
      controller: r
    }), {
      fileList: p,
      showModal: v,
      modalTitle: y,
      iframeUrl: h,
      previewFile: C,
      onModalCancel: g
    } = Y({
      downloadUrl: n,
      uploadUrl: l,
      value: d
    });
    return {
      ns: t,
      fileList: p,
      showModal: v,
      modalTitle: y,
      iframeUrl: h,
      downloadFile: (F) => {
        e.controller.fileDownload(F);
      },
      previewFile: C,
      onModalCancel: g
    };
  },
  render() {
    return c("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") : ""]
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.previewFile(e)
      }
    }, [e.name]), c("div", {
      class: this.ns.b("file-item-action")
    }, [c("i-icon", {
      attrs: {
        type: "md-download"
      },
      on: {
        click: () => this.downloadFile(e)
      }
    }), c("i-icon", {
      attrs: {
        type: "md-eye"
      },
      on: {
        click: () => this.previewFile(e)
      }
    })])]))]), c("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
      }
    }, [c("iframe", {
      class: this.ns.b("iframe"),
      attrs: {
        src: this.iframeUrl
      }
    })])]);
  }
}), Ne = x({
  name: "SyGridFileUploadContainer",
  props: G(),
  emits: B(),
  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 Le = x({
  name: "SyEditGridFileUploadPopover",
  props: {
    uploadUrl: {
      type: String,
      required: !0
    },
    downloadUrl: {
      type: String,
      required: !0
    },
    value: {
      type: Array,
      required: !0
    },
    controller: {
      type: j,
      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
    } = _(e), {
      fileList: l,
      uploadState: d,
      selectFile: p
    } = Y({
      downloadUrl: o,
      value: r,
      uploadUrl: n
    }), v = m(), y = m(!1), h = re(v, async (f) => {
      t("close", {
        isModified: y.value,
        resultFiles: l.value
      });
    });
    return T(d, (f) => {
      f === "done" ? (y.value = !0, h.proceed()) : f === "loading" && h.pause();
    }), {
      ns: s,
      componentRef: v,
      fileList: l,
      deleteFile: (f) => {
        const F = l.value.findIndex((U) => U.id === f.id);
        l.value.splice(F, 1), y.value = !0;
      },
      selectFile: p,
      downloadFile: (f) => {
        e.controller.fileDownload(f);
      }
    };
  },
  render() {
    return c("div", {
      ref: "componentRef",
      style: "width:300px",
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.fileList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title"),
      on: {
        click: () => this.downloadFile(e)
      }
    }, [e.name]), c("div", {
      class: this.ns.b("file-item-action")
    }, [c("i-icon", {
      attrs: {
        type: "md-close"
      },
      on: {
        click: () => this.deleteFile(e)
      }
    })])]))]), c("div", {
      on: {
        click: () => this.selectFile()
      },
      class: this.ns.e("button")
    }, [c("i-icon", {
      attrs: {
        type: "md-add"
      }
    }), "添加文件"])]);
  }
});
const _e = x({
  name: "SyEditGridFileUpload",
  props: G(),
  emits: B(),
  setup(e, {
    emit: t
  }) {
    const s = E("sy-edit-grid-file-upload"), {
      value: o,
      data: r,
      controller: n
    } = _(e), {
      downloadUrl: l,
      uploadUrl: d,
      valueList: p
    } = J({
      value: o,
      data: r,
      controller: n
    }), v = m(), y = async () => {
      if (!v.value)
        throw new pe("容器元素不存在");
      const h = v.value.$el, C = h.offsetHeight, g = ibiz.overlay.createPopover((U) => U(Le, {
        props: {
          value: p.value,
          uploadUrl: d.value,
          downloadUrl: l.value,
          controller: n.value
        },
        on: {
          close: (u) => {
            g.dismiss(u);
          }
        }
      }), void 0, {
        noArrow: !0,
        placement: "bottom-start",
        offsetOpts: {
          mainAxis: -C,
          crossAxis: 0
        }
      });
      await g.present(h);
      const {
        isModified: f,
        resultFiles: F
      } = await g.onWillDismiss();
      if (f) {
        const U = F.length > 0 ? JSON.stringify(F.map((u) => ({
          name: u.name,
          id: u.id
        }))) : null;
        t("change", U), t("rowSave");
      }
    };
    return ne(v, "click", (h) => {
      e.disabled || y();
    }), {
      ns: s,
      valueList: p,
      componentRef: v
    };
  },
  render() {
    return c("grid-editor", {
      attrs: {
        disabled: this.disabled,
        readonly: this.readonly
      },
      ref: "componentRef",
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.b("file-list")
    }, [this.valueList.map((e) => c("div", {
      class: this.ns.b("file-item"),
      key: e.id
    }, [c("div", {
      class: this.ns.b("file-item-title")
    }, [e.name])]))])]);
  }
});
class Ge {
  constructor() {
    k(this, "component", ye);
  }
}
class Oe {
  constructor() {
    k(this, "component", ve);
  }
  async createController(t, s) {
    const o = new V(t, s);
    return await o.init(), o;
  }
}
class We {
  constructor() {
    k(this, "component", "IndexView");
  }
}
const K = x({
  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
    } = N(), s = ae(t, e.modelPath);
    z(t, "deName", s.setDeName.bind(s));
    const o = E("wf-step-trace-grid"), r = m([]);
    s.nerve.self.evt.on("mounted", () => {
      var l;
      s.data && ((l = s.data.usertasks) == null || l.forEach((d) => {
        d.identitylinks.length > 0 || (d.comments.length > 0 && d.comments.forEach((p) => {
          r.value.push({
            nodeName: d.userTaskName,
            personName: p.authorName,
            time: p.time,
            content: p.type,
            comment: p.fullMessage
          });
        }), r.value.sort((p, v) => Date.parse(v.time) - Date.parse(p.time)));
      }));
    });
    const n = m([{
      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 c("div", {
      class: this.ns.b()
    }, [c("div", {
      class: this.ns.e("title")
    }, ["审批信息"]), c("i-table", {
      attrs: {
        "disabled-hover": !0,
        columns: this.columns,
        data: this.gridData
      },
      class: this.ns.e("grid")
    })]);
  }
}), Ae = x({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = N(), s = le(t, e.modelPath), o = E(`view-${be.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), r = m(["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(K, {
        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: $.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 Me {
  constructor() {
    k(this, "component", Ae);
  }
}
const Ve = x({
  name: "SyEditView3",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: t
    } = N(), s = ce(t, e.modelPath), o = E("view-deeditview3"), r = m(["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(K, {
      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: $.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 je {
  constructor() {
    k(this, "component", Ve);
  }
}
class ze {
  constructor() {
    k(this, "formEditor", "SyFileUpload");
    k(this, "gridEditor", "SyGridFileUploadContainer");
  }
  async createController(t, s) {
    const o = new j(t, s);
    return await o.init(), o;
  }
}
const Be = new fe(import.meta.url), Ze = {
  mateUrl: import.meta.url,
  install(e) {
    Be.loadStyle(["/style.css"]), ibiz.config.enableDataInfoBar = !1, ibiz.config.gridEditShowMode = "all", e.component("WfToolbar", ge), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWebIndexView",
      new We()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_PresetWFChartView",
      new Ge()
    ), ibiz.register.gridColumn.register(
      "GRID_COLRENDER_CodeListGridColumn",
      new Oe()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWfDynaEditView3",
      new Me()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyEditView3",
      new je()
    ), e.component("SyFileUpload", Pe), e.component("SyGridFileUpload", De), e.component("SyEditGridFileUpload", _e), e.component("SyGridFileUploadContainer", Ne), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_SyFileUpload",
      new ze()
    );
  }
};
export {
  Ze as default
};
