var H = Object.defineProperty;
var $ = (e, i, n) => i in e ? H(e, i, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[i] = n;
var v = (e, i, n) => ($(e, typeof i != "symbol" ? i + "" : i, n), n);
import { PluginStaticResource as K, ViewMode as q } from "@ibiz-template/runtime";
import { defineComponent as I, ref as k, watch as _, computed as b, getCurrentInstance as T, h, toRef as W, onUnmounted as Y } from "vue";
import { getCheckboxProps as X, getEditorEmits as J, useNamespace as R, useControlController as j, useListExpViewController as Q, useRoute as Z, useRouteKey as ee, usePropsWatch as te } from "@ibiz-template/vue-util";
import { isNil as se, clone as ne } from "ramda";
import { CheckBoxListEditorController as ie, SearchFormController as oe, FormNotifyState as re, GridController as ae, GridRowController as ce, GridNotifyState as le } from "@ibiz-template/controller";
import { SearchFormModel as ue, GridModel as de } from "@ibiz-template/model";
import he from "qs";
import { promiseAllSettled as me } from "@ibiz-template/core";
import G from "dayjs";
const fe = new K(import.meta.url);
const pe = I({
  name: "CustomCheckboxList",
  props: X(),
  emits: J(),
  setup(e, {
    emit: i
  }) {
    const n = R("checkbox"), t = e.controller, o = t.model.codeList, r = k([]);
    _(() => e.data, (m) => {
      t.loadCodeList(m).then((d) => {
        r.value = d;
      });
    }, {
      immediate: !0,
      deep: !0
    });
    const a = b(() => o && o.orMode ? o.orMode.toLowerCase() : "str");
    let l = ",";
    o && o.valueSeparator && (l = o.valueSeparator);
    const c = b({
      get() {
        if (!se(e.value)) {
          if (Object.is(a.value, "num") && r) {
            const m = [], d = typeof e.value == "string" ? parseInt(e.value, 10) : e.value;
            return r.value.forEach((p) => {
              (d & p.value) === p.value && m.push(p.value);
            }), m;
          }
          if (Object.is(a.value, "str")) {
            const m = e.value;
            if (m !== "") {
              if (o) {
                const d = m.split(l);
                if (o.codeItemValueNumber)
                  for (let p = 0, y = d.length; p < y; p++)
                    d[p] = Number(d[p]);
                return d;
              }
              return m.split(",");
            }
          }
        }
        return [];
      },
      set(m) {
        let d = null;
        if (Object.is(a.value, "num")) {
          let p = 0;
          m.forEach((y) => {
            const x = typeof y == "string" ? parseInt(y, 10) : y;
            p |= x;
          }), d = p;
        } else if (Object.is(a.value, "str")) {
          const p = [];
          r.value.length > 0 && (r.value.forEach((y) => {
            m.findIndex((w) => Object.is(y.value, w)) !== -1 && p.push(y.value);
          }), d = p.join(l));
        }
        i("change", d);
      }
    }), u = (m) => {
      c.value = m;
    }, D = b(() => {
      const m = Array.isArray(c.value) ? c.value : [c.value];
      return r.value.filter((d) => m.includes(d.value)).map((d) => d.text).join("、");
    });
    return {
      ns: n,
      items: r,
      selectArray: c,
      valueText: D,
      onSelectArrayChange: u,
      c: t
    };
  },
  render(e) {
    return e("div", {
      class: [this.ns.b(), this.disabled ? this.ns.m("disabled") : "", this.readonly ? this.ns.m("readonly") : ""]
    }, [[this.readonly && this.valueText, !this.readonly && e("ICheckboxGroup", {
      props: {
        ...this.c.customProps,
        value: this.selectArray
      },
      on: {
        "on-change": this.onSelectArrayChange
      }
    }, [this.items.map((i, n) => e("i-checkbox", {
      key: n,
      attrs: {
        label: i.value,
        disabled: this.disabled || this.c.disabledList.includes(i.value)
      }
    }, [e("span", {
      class: this.ns.e("text")
    }, [i.text])]))])]]);
  }
});
class ge extends ie {
  constructor() {
    super(...arguments);
    /**
     * 默认禁用项
     *
     * @type {string[]}
     * @memberof CustomCheckboxListController
     */
    v(this, "disabledList", []);
  }
  async onInit() {
    var n, t;
    if (await super.onInit(), (n = this.editorParams) != null && n.DEFAULTDISABLEDLIST)
      try {
        this.disabledList = JSON.parse((t = this.editorParams) == null ? void 0 : t.DEFAULTDISABLEDLIST);
      } catch (s) {
        this.disabledList = [];
      }
  }
}
class Ce extends oe {
  constructor() {
    super(...arguments);
    /**
     * 指定过滤参数
     *
     * @type {IData}
     * @memberof SearchFormDynamicController
     */
    v(this, "filterParams", []);
  }
  async onInit() {
    await super.onInit();
    const { FILTERPARAMS: n } = this.controlParams;
    if (n)
      try {
        this.filterParams = JSON.parse(n);
      } catch (t) {
        this.filterParams = [];
      }
  }
  /**
   * 获取搜索参数
   *
   * @return {*}  {IParams}
   * @memberof SearchFormDynamicController
   */
  getParams() {
    const n = { ...this.data.getRequestData() };
    if (this.filterParams) {
      const t = {};
      return this.filterParams.forEach((s) => {
        Object.assign(t, { [s]: n[s] });
      }), t;
    }
    return n;
  }
  /**
   * 重置搜索表单
   *
   * @author lxm
   * @date 2022-09-22 19:09:07
   */
  async reset() {
    const n = await this.service.getDraft(this.context, this.params);
    this.filterParams.forEach((t) => {
      Object.assign(this.data, { [t]: n.data[t] });
    }), this.isLoaded = !0, Object.values(this.details).forEach((t) => {
      this.filterParams.includes(t.model.codeName) && t.formStateNotify(re.DRAFT);
    }), this.force(), await this.nerve.self.evt.asyncEmit("search");
  }
}
const ye = I({
  name: "SearchFormDynamic",
  props: {
    controller: {
      type: Object,
      required: !0
    },
    modelData: {
      type: ue,
      required: !0
    },
    context: {
      type: Object,
      required: !0
    },
    params: {
      type: Object,
      default: () => ({})
    }
  },
  setup(e) {
    const {
      proxy: i
    } = T(), n = j(i, () => new Ce(e.modelData, e.context, e.params)), t = R("search-form"), s = e.modelData.source.searchButtonStyle;
    return {
      c: n,
      ns: t,
      btntype: s
    };
  },
  render() {
    if (this.c.complete)
      return h("div", {
        class: [this.ns.b(), this.ns.m(this.btntype).toLowerCase()]
      }, [h("form-control", {
        attrs: {
          "model-data": this.modelData,
          context: this.context,
          controller: this.c
        },
        nativeOn: {
          keyup: (e) => this.c.onKeyUp(e)
        }
      }), this.c.model.source.searchButtonStyle === "NONE" ? null : h("div", {
        class: this.ns.b("buttons")
      }, [h("i-button", {
        class: this.ns.be("buttons", "search"),
        on: {
          click: () => this.c.onSearchButtonClick()
        }
      }, ["查询"]), h("i-button", {
        class: this.ns.be("buttons", "reset"),
        on: {
          click: () => this.c.reset()
        }
      }, ["重置"])])]);
  }
});
class ve {
  constructor() {
    v(this, "formEditor", "CustomCheckboxList");
    v(this, "gridEditor", "CustomCheckboxList");
  }
  async createController(i, n) {
    const t = new ge(i, n);
    return await t.init(), t;
  }
}
class we {
  constructor() {
    v(this, "component", "SearchFormDynamic");
  }
}
const be = I({
  name: "DataViewExpView",
  props: {
    context: Object,
    params: {
      type: Object
    },
    srfnav: String,
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    noLoadDefault: {
      type: Boolean,
      required: !1
    }
  },
  setup(e) {
    const {
      proxy: i
    } = T(), n = Q(i, e.modelPath), t = k(""), s = k([]), o = R("dataview-exp");
    if (n.context.isRouter === !0) {
      const r = Z(i);
      n.nerve.self.evt.on("created", () => {
        if (r.params.params1) {
          const a = r.params.params1, c = he.parse(a, {
            delimiter: ";"
          })[n.model.appEntity.deName];
          c && (n.navItem.key = c, s.value = [c]);
        }
        ee(W(n.navItem, "key"), i, t);
      });
    }
    return {
      c: n,
      ns: o,
      defaultSelectKeys: s,
      routeViewKey: t
    };
  },
  render() {
    const e = this.c.context.isRouter === !0;
    let i = null, n = null;
    if (this.c.complete) {
      const {
        listExpBar: t
      } = this.c.model, {
        list: s
      } = t;
      n = t, this.c.providers[s.name] && (i = h(this.c.providers[s.name].component, {
        props: {
          modelData: s,
          context: this.c.context,
          params: this.c.params,
          isExpView: !0,
          isSelectFirstDefault: !0,
          mdCtrlActiveMode: 1,
          defaultSelectKeys: this.defaultSelectKeys
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit(s.name)
        }
      })), n.width = 0;
    }
    return h("div", {
      class: this.ns.b()
    }, [h("exp-view-base", {
      attrs: {
        controller: this.c,
        expBarModel: n
      },
      scopedSlots: {
        expView: () => {
          if (this.c.complete) {
            const {
              listExpBar: t
            } = this.c.model, {
              list: s
            } = t;
            return s.navView ? e ? this.routeViewKey ? h("router-view", {
              key: this.routeViewKey
            }) : null : h("ViewShell", {
              attrs: {
                context: this.c.navItem.context,
                params: this.c.navItem.params,
                modal: {
                  mode: q.EMBED
                },
                modelPath: s.navView.source.modelPath
              },
              key: this.c.navItem.key
            }) : null;
          }
        }
      }
    }), i]);
  }
});
class ke {
  constructor() {
    v(this, "component", "DataViewExpView");
  }
}
function B(e, i) {
  var s, o;
  const n = [];
  e.source.columnType === "GROUPGRIDCOLUMN" && e.children.forEach((r) => {
    n.push(B(r, i));
  });
  const t = {
    title: e.title,
    width: e.source.widthUnit === "STAR" ? void 0 : e.width,
    minWidth: e.width,
    align: ((s = e.source.align) == null ? void 0 : s.toLowerCase()) || "center",
    slot: e.codeName,
    key: e.codeName,
    fieldName: e.deFieldName,
    ellipsis: !0,
    tooltip: !1,
    // todo 表格提示用title
    resizable: !0,
    sortable: !i.noSort && e.source.enableSort ? "custom" : !1,
    columnType: e.source.columnType,
    userParams: e.source.userParams,
    className: (o = e.source.getCellPSSysCss()) == null ? void 0 : o.cssName
  };
  return n.length > 0 && Object.assign(t, { children: n }), t;
}
function De(e) {
  const i = e.model, n = [], t = i.columns.map((s) => B(s, e));
  return i.children.forEach((s) => {
    const o = t.find((r) => r.key === s.codeName);
    o && n.push(o);
  }), e.singleSelect || n.splice(0, 0, { type: "selection", width: 60 }), n;
}
function Se(e) {
  const i = k([]);
  e.nerve.self.evt.on("created", () => {
    i.value = De(e);
  });
  const n = (s) => s.filter((o) => e.hiddenColumnKeys.includes(o.key) ? !1 : (o.children && o.children.length && (o.children = n(o.children)), !0));
  return [b(() => {
    var c;
    let s = ne(i.value);
    s = n(s);
    const o = s.find((u) => !u.width), r = (c = e.model.source.getPSControlParam()) == null ? void 0 : c.ctrlParams, a = (r == null ? void 0 : r.IS_NOT_FLEX) === "true";
    if (!o && !a) {
      let u = s.length - 1;
      s[u].key === "rowEdit" && (u -= 1), s[u] = {
        ...s[u],
        width: void 0
      };
    }
    const l = s.find((u) => u.columnType === "UAGRIDCOLUMN");
    if (l) {
      const u = l.userParams;
      u && u.fixed === "true" && (l.fixed = "right");
    }
    return s.forEach((u) => {
      u.fixed = "left", (ibiz.env.enableGridRowBreak === "TRUE" || ibiz.env.enableGridRowBreak === !0) && (u.ellipsis = !1), e.controlParams.ENABLEGRIDROWBREAK && (u.ellipsis = e.controlParams.ENABLEGRIDROWBREAK !== "TRUE");
    }), s;
  }), i];
}
function xe(e) {
  const i = (r) => e.items.find((a) => a.srfkey === r.srfkey);
  function n(r) {
    const a = i(r);
    if (e.singleSelect) {
      const l = e.selectedData.find(
        (c) => c.srfkey === r.srfkey
      );
      e.onSelectionChange(l ? [] : [a]);
    }
    e.onRowClick(a);
  }
  function t(r) {
    e.onDbRowClick(i(r));
  }
  function s(r) {
    if (!e.singleSelect) {
      const a = [];
      r.forEach((l) => {
        const c = i(l);
        c && a.push(c);
      }), e.onSelectionChange(a);
    }
  }
  function o(r) {
    const { column: a, order: l } = r, c = l === "asc" || l === "desc" ? l : void 0;
    e.setSort(a.fieldName, c), e.load();
  }
  return { onRowClick: n, onDbRowClick: t, onSelectionChange: s, onSortChange: o };
}
function Ee(e) {
  function i(s) {
    !s || s === e.curPage || (e.curPage = s, e.load());
  }
  function n(s) {
    !s || s === e.size || (e.size = s, e.curPage === 1 && e.load());
  }
  function t() {
    e.curPage = 1, e.load();
  }
  return { onPageChange: i, onPageSizeChange: n, onPageReset: t };
}
class Ie extends ae {
  constructor() {
    super(...arguments);
    /**
     * @description 星期数组
     * @type {string[]}
     * @memberof CheckInGridController
     */
    v(this, "weekDays", ["日", "一", "二", "三", "四", "五", "六"]);
    /**
     * @description 自定义列
     * @type {IData[]}
     * @memberof CheckinGridController
     */
    v(this, "customColumns", []);
    /**
     * @description 是否加载完成
     * @type {boolean}
     * @memberof CheckinGridController
     */
    v(this, "loaded", !1);
    /**
     * @description 排班数据
     * @type {IData[]}
     * @memberof CheckInGridController
     */
    v(this, "checkinData", []);
  }
  async onInit() {
    await super.onInit(), await this.initMonthColumns();
  }
  async initMonthColumns() {
    const n = G().daysInMonth(), t = G();
    for (let s = 1; s <= n; s++) {
      const o = G(`${t.year()}-${t.month() + 1}-${s}`), r = o.day(), a = o.format("YYYY-MM-DD"), l = {
        align: "center",
        className: void 0,
        columnType: "DEFGRIDCOLUMN",
        ellipsis: !0,
        fieldName: `${a}`,
        key: `${a}`,
        minWidth: 100,
        resizable: !0,
        slot: `${a}`,
        sortable: "custom",
        title: `${s}
${this.weekDays[r]}`,
        tooltip: !1,
        width: 100,
        userParam: { columnType: "date" }
      };
      this.customColumns.push(l);
    }
  }
  /**
   * @description 数据加载之后
   * @param {ControlVO[]} items
   * @returns {*}  {Promise<ControlVO[]>}
   * @memberof CheckinGridController
   */
  async afterLoad(n) {
    return await me(
      Object.values(this.fieldColumns).map(async (t) => {
        await t.loadCodeList();
      })
    ), await this.initGroup(), this.items = this.calcDayData(n), this.items.forEach((t, s) => {
      t.srfserialnum = s + 1;
    }), this.rows = this.items.map((t) => {
      const s = new ce(t, this);
      return this.gridStateNotify(s, le.LOAD), s;
    }), this.loaded = !0, n;
  }
  /**
   * @description 计算日期数据
   * @protected
   * @param {ControlVO[]} items
   * @returns {*}  {IData[]}
   * @memberof CheckInGridController
   */
  calcDayData(n) {
    const t = [];
    return n.forEach((s) => {
      const o = t.findIndex(
        (r) => r.member_id === s.member_id
      );
      o === -1 ? (s.children = {
        [s.checkin_date]: { ...s }
      }, t.push(s)) : t[o].children[s.checkin_date] = s;
    }), t;
  }
  setCheckInData(n, t) {
    const s = this.checkinData.findIndex((o) => o.id === n);
    s === -1 ? this.checkinData.push(t) : this.checkinData[s] = t;
  }
  removeCheckInData(n) {
    const t = this.checkinData.findIndex((s) => s.id === n);
    t !== -1 && this.checkinData.splice(t, 1);
  }
  async saveCheckInData() {
    (await ibiz.net.post("/schedules/manual", this.checkinData)).ok && (this.loaded = !1, this.checkinData = [], this.load());
  }
}
function Re(e, i, n, t = {}) {
  return j(e, () => {
    const s = new Ie(i, n, t);
    return te(e, "gridRowActiveMode", s.setGridRowActiveMode.bind(s)), s;
  });
}
const Pe = I({
  props: {
    controller: {
      type: Object,
      required: !0
    },
    modelData: de,
    context: {
      type: Object,
      required: !0
    },
    params: {
      type: Object,
      default: () => ({})
    },
    /**
     * 表格行数据默认激活模式
     * - 0 不激活
     * - 1 单击激活
     * - 2 双击激活(默认值)
     *
     * @type {(number | 0 | 1 | 2)}
     */
    gridRowActiveMode: {
      type: Number,
      default: 2
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    var A;
    const {
      proxy: i
    } = T(), n = R("grid"), t = Re(i, e.modelData, e.context, e.params), s = t.model.source.getPSControlParam(), o = ((A = s == null ? void 0 : s.ctrlParams) == null ? void 0 : A.IS_NOT_FLEX) === "true", r = k(), [a] = Se(t), l = b(() => [...a.value, ...t.customColumns]), {
      onRowClick: c,
      onDbRowClick: u,
      onSelectionChange: D,
      onSortChange: m
    } = xe(t), {
      onPageChange: d,
      onPageReset: p,
      onPageSizeChange: y
    } = Ee(t), x = b(() => {
      var g, C;
      const f = (C = (g = e.modelData) == null ? void 0 : g.source.getPSControlParam()) == null ? void 0 : C.ctrlParams;
      return (f == null ? void 0 : f.HIGHLIGHT) !== "false";
    });
    let w = null;
    const P = (f, g) => {
      w != null && window.clearTimeout(w), w = window.setTimeout(() => {
        const C = i.$refs.grid;
        C && (t.selectedData.find((z) => z.srfkey === f.srfkey) && C.clearCurrentRow(), C.toggleSelect && C.toggleSelect(g)), c(f);
      }, 300);
    }, F = (f) => {
      w != null && window.clearTimeout(w);
      const g = i.$refs.grid;
      g && (t.selectedData.find((E) => E.srfkey === f.srfkey) || g.clearCurrentRow()), u(f);
    }, O = k(0), S = k(null), L = k(null);
    let N = null, M = 0;
    const V = () => {
      var f;
      if (S.value && ((f = e.modal) == null ? void 0 : f.mode) !== "EMBED")
        if (t.model.source.enablePagingBar && L.value) {
          const g = L.value.$el, C = g.offsetHeight + parseFloat(window.getComputedStyle(g).paddingTop);
          O.value = S.value.offsetHeight - C;
        } else
          O.value = S.value.offsetHeight;
      t.model.source.height > 0 && (O.value = t.model.source.height);
    };
    _(S, (f, g) => {
      f && f !== g && (V(), window.ResizeObserver && S.value && (N = new ResizeObserver((C) => {
        const E = C[0].contentRect.height;
        E !== M && (V(), M = E);
      }), N.observe(S.value)));
    }), Y(() => {
      N && N.disconnect();
    });
    const U = b(() => {
      const f = t.items.map((g) => (g._checked = t.selectedData.some((C) => C.srfkey === g.srfkey), g));
      return f.length && f.unshift({
        hiddenRow: !0,
        _checked: t.items.every((g) => g._checked)
      }), f;
    });
    return {
      c: t,
      ns: n,
      columns: a,
      curColumns: l,
      tableData: U,
      onDbRowClick: u,
      onUIRowClick: P,
      onUIDbRowClick: F,
      onSelectionChange: D,
      onSortChange: m,
      onPageChange: d,
      onPageSizeChange: y,
      onPageReset: p,
      tableHeight: O,
      gridRef: S,
      girdPaginationRef: L,
      highlight: x,
      isNotFlex: o,
      grid: r
    };
  },
  render() {
    var i;
    if (!this.c.complete || !this.c.loaded)
      return;
    const e = {};
    return this.c.model.columns.forEach((n) => {
      if (n.source.columnType === "GROUPGRIDCOLUMN")
        return;
      const t = n.codeName;
      e[t] = ({
        row: s,
        index: o
      }) => {
        const r = this.c.rows[o - 1];
        if (s.hiddenRow)
          return h("span", {
            style: "word-break: break-word;white-space: pre-wrap;"
          }, ["隐藏行的列"]);
        if (r)
          return h(this.c.providers[t].component, {
            props: {
              controller: this.c.columns[t],
              row: r
            },
            key: s.srfkey + t
          });
      };
    }), this.c.customColumns.forEach((n) => {
      const t = n.fieldName;
      e[t] = ({
        row: s,
        index: o
      }) => {
        const r = this.c.rows[o - 1], a = s.children[t];
        if (r && a)
          return h("CheckInGridColumn", {
            props: {
              controller: this.c,
              data: s,
              value: a
            },
            key: s.srfkey + t
          });
      };
    }), h("control-layout", {
      attrs: {
        modelData: this.c.model
      }
    }, [h("div", {
      ref: "gridRef",
      class: [this.ns.b(), this.ns.is("show-header", !this.c.model.source.hideHeader), this.ns.is("enable-page", this.c.model.source.enablePagingBar)],
      style: this.isNotFlex ? (i = this.grid) == null ? void 0 : i.tableStyle : void 0
    }, [h("i-table", {
      ref: "grid",
      attrs: {
        height: this.tableHeight,
        "show-header": !this.c.model.source.hideHeader,
        "highlight-row": this.c.singleSelect && this.highlight,
        data: this.tableData,
        columns: this.curColumns,
        "row-class-name": (n) => n.hiddenRow ? "hidden-row" : "",
        "span-method": this.c.spanMethod.bind(this.c)
      },
      class: this.ns.b("content"),
      on: {
        "on-row-click": this.onUIRowClick,
        "on-row-dblclick": this.onUIDbRowClick,
        "on-selection-change": this.onSelectionChange,
        "on-sort-change": this.onSortChange
      },
      scopedSlots: e
    }), this.c.model.source.enablePagingBar && h("appGridPagination", {
      ref: "girdPaginationRef",
      attrs: {
        total: this.c.total,
        curPage: this.c.curPage,
        size: this.c.size
      },
      on: {
        change: this.onPageChange,
        "page-size-change": this.onPageSizeChange,
        "page-reset": this.onPageReset
      }
    })])]);
  }
});
const Oe = I({
  name: "IBizCheckInGridColumn",
  props: {
    value: {
      type: Object,
      required: !0
    },
    data: {
      type: Object,
      required: !0
    },
    controller: {
      type: Object,
      required: !0
    }
  },
  setup(e) {
    const i = R("checkin-column"), n = k(""), t = b(() => {
      const {
        shifts: a = [],
        work_time: l = []
      } = e.value || {}, {
        start_base_time: c,
        end_base_time: u
      } = l[0] || {}, D = c, m = u;
      let d = "";
      D && m && (d = `(${D} - ${m})`);
      const p = {
        title: `休息${d}`,
        value: "rest",
        name: "休息"
      }, y = {
        title: `白班${d}`,
        value: "work",
        name: "白班"
      };
      return a.length ? [...a.map((w) => {
        const {
          name: P
        } = w;
        return {
          title: `${P}${d}`,
          value: w.id,
          name: P,
          origin: w
        };
      }), p] : [y, p];
    }), s = b(() => {
      const {
        workday: a,
        shift_data: l
      } = e.value || {};
      if (!a) {
        const c = t.value.find((u) => u.value === "rest");
        return c ? c.title : "休息";
      }
      if (l) {
        const c = l.name, u = t.value.find((D) => D.name === c);
        return u ? u.title : c;
      }
      return "";
    }), o = b(() => {
      if (n.value) {
        const a = t.value.find((l) => l.value === n.value);
        if (a)
          return a.title;
      }
      return "";
    });
    return {
      ns: i,
      curValue: s,
      selectValue: o,
      items: t,
      selected: n,
      handleClick: async (a) => {
        if (!e.value)
          return;
        const l = e.controller, c = t.value.find((u) => u.value === a);
        c.title === s.value ? (n.value = "", l.removeCheckInData(e.value.id)) : (n.value = a, l.setCheckInData(e.value.id, {
          id: e.value.id,
          workday: a !== "rest" ? 1 : 0,
          choose_shift: c.origin
        }));
      }
    };
  },
  render() {
    if (!this.value)
      return;
    const e = this.selectValue || this.curValue;
    return h("i-dropdown", {
      on: {
        "on-click": (i) => this.handleClick(i)
      },
      class: [this.ns.b(), this.ns.m("dropdown"), this.ns.is("active", !!this.selected), this.ns.is("manual", this.value.manual)],
      attrs: {
        "transfer-class-name": this.ns.b("popper"),
        transfer: !0,
        trigger: "click"
      }
    }, [h("div", {
      class: this.ns.e("caption")
    }, [e.replace(/\(.*\)/g, "")]), h("i-dropdownMenu", {
      slot: "list"
    }, [this.items.map((i) => h("i-dropdown-item", {
      class: [this.ns.e("item")],
      attrs: {
        title: i.title,
        name: i.value,
        disabled: i.title === (this.selectValue || this.curValue)
      }
    }, [i.title]))])]);
  }
});
class Ne {
  constructor() {
    v(this, "component", "CheckinGridControl");
  }
}
const Ue = {
  mateUrl: import.meta.url,
  install(e) {
    fe.loadStyle(["/style.css"]), e.component("CustomCheckboxList", pe), ibiz.register.editor.register(
      "EDITOR_CUSTOMSTYLE_CUSTOM_CHECKBOX_LIST",
      new ve()
    ), e.component("SearchFormDynamic", ye), ibiz.register.control.register(
      "SEARCHFORM_RENDER_DYNAMIC",
      new we()
    ), e.component("DataViewExpView", be), ibiz.register.view.register(
      "DELISTEXPVIEW_CARD",
      new ke()
    ), e.component("CheckinGridControl", Pe), e.component("CheckInGridColumn", Oe), ibiz.register.control.register(
      "GRID_RENDER_CHECKIN",
      new Ne()
    );
  }
};
export {
  Ue as default
};
