var $ = Object.defineProperty;
var H = (e, i, n) => i in e ? $(e, i, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[i] = n;
var y = (e, i, n) => (H(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 D, watch as A, computed as b, getCurrentInstance as G, h as m, toRef as W, onUnmounted as Y } from "vue";
import { getCheckboxProps as X, getEditorEmits as J, useNamespace as R, useControlController as _, 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 L 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 = D([]);
    A(() => e.data, (d) => {
      t.loadCodeList(d).then((h) => {
        r.value = h;
      });
    }, {
      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 d = [], h = typeof e.value == "string" ? parseInt(e.value, 10) : e.value;
            return r.value.forEach((p) => {
              (h & p.value) === p.value && d.push(p.value);
            }), d;
          }
          if (Object.is(a.value, "str")) {
            const d = e.value;
            if (d !== "") {
              if (o) {
                const h = d.split(l);
                if (o.codeItemValueNumber)
                  for (let p = 0, v = h.length; p < v; p++)
                    h[p] = Number(h[p]);
                return h;
              }
              return d.split(",");
            }
          }
        }
        return [];
      },
      set(d) {
        let h = null;
        if (Object.is(a.value, "num")) {
          let p = 0;
          d.forEach((v) => {
            const S = typeof v == "string" ? parseInt(v, 10) : v;
            p |= S;
          }), h = p;
        } else if (Object.is(a.value, "str")) {
          const p = [];
          r.value.length > 0 && (r.value.forEach((v) => {
            d.findIndex((w) => Object.is(v.value, w)) !== -1 && p.push(v.value);
          }), h = p.join(l));
        }
        i("change", h);
      }
    }), u = (d) => {
      c.value = d;
    }, k = b(() => {
      const d = Array.isArray(c.value) ? c.value : [c.value];
      return r.value.filter((h) => d.includes(h.value)).map((h) => h.text).join("、");
    });
    return {
      ns: n,
      items: r,
      selectArray: c,
      valueText: k,
      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
     */
    y(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
     */
    y(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
    } = G(), n = _(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 m("div", {
        class: [this.ns.b(), this.ns.m(this.btntype).toLowerCase()]
      }, [m("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 : m("div", {
        class: this.ns.b("buttons")
      }, [m("i-button", {
        class: this.ns.be("buttons", "search"),
        on: {
          click: () => this.c.onSearchButtonClick()
        }
      }, ["查询"]), m("i-button", {
        class: this.ns.be("buttons", "reset"),
        on: {
          click: () => this.c.reset()
        }
      }, ["重置"])])]);
  }
});
class ve {
  constructor() {
    y(this, "formEditor", "CustomCheckboxList");
    y(this, "gridEditor", "CustomCheckboxList");
  }
  async createController(i, n) {
    const t = new ge(i, n);
    return await t.init(), t;
  }
}
class we {
  constructor() {
    y(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
    } = G(), n = Q(i, e.modelPath), t = D(""), s = D([]), 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 = m(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 m("div", {
      class: this.ns.b()
    }, [m("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 ? m("router-view", {
              key: this.routeViewKey
            }) : null : m("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() {
    y(this, "component", "DataViewExpView");
  }
}
function j(e, i) {
  var s, o;
  const n = [];
  e.source.columnType === "GROUPGRIDCOLUMN" && e.children.forEach((r) => {
    n.push(j(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) => j(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 = D([]);
  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
     */
    y(this, "weekDays", ["日", "一", "二", "三", "四", "五", "六"]);
    /**
     * @description 自定义列
     * @type {IData[]}
     * @memberof CheckinGridController
     */
    y(this, "customColumns", []);
    /**
     * @description 是否加载完成
     * @type {boolean}
     * @memberof CheckinGridController
     */
    y(this, "loaded", !1);
    /**
     * @description 排班数据
     * @type {IData[]}
     * @memberof CheckInGridController
     */
    y(this, "checkinData", []);
  }
  async onInit() {
    await super.onInit(), await this.initMonthColumns();
  }
  async initMonthColumns() {
    const n = L().daysInMonth(), t = L();
    for (let s = 1; s <= n; s++) {
      const o = L(`${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 _(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 V;
    const {
      proxy: i
    } = G(), n = R("grid"), t = Re(i, e.modelData, e.context, e.params), s = t.model.source.getPSControlParam(), o = ((V = s == null ? void 0 : s.ctrlParams) == null ? void 0 : V.IS_NOT_FLEX) === "true", r = D(), [a] = Se(t), l = b(() => [...a.value, ...t.customColumns]), {
      onRowClick: c,
      onDbRowClick: u,
      onSelectionChange: k,
      onSortChange: d
    } = xe(t), {
      onPageChange: h,
      onPageReset: p,
      onPageSizeChange: v
    } = Ee(t), S = 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 B = (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);
    }, P = D(0), x = D(null), N = D(null);
    let O = null, T = 0;
    const M = () => {
      var f;
      if (x.value && ((f = e.modal) == null ? void 0 : f.mode) !== "EMBED")
        if (t.model.source.enablePagingBar && N.value) {
          const g = N.value.$el, C = g.offsetHeight + parseFloat(window.getComputedStyle(g).paddingTop);
          P.value = x.value.offsetHeight - C;
        } else
          P.value = x.value.offsetHeight;
      t.model.source.height > 0 && (P.value = t.model.source.height);
    };
    A(x, (f, g) => {
      f && f !== g && (M(), window.ResizeObserver && x.value && (O = new ResizeObserver((C) => {
        const E = C[0].contentRect.height;
        E !== T && (M(), T = E);
      }), O.observe(x.value)));
    }), Y(() => {
      O && O.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: B,
      onUIDbRowClick: F,
      onSelectionChange: k,
      onSortChange: d,
      onPageChange: h,
      onPageSizeChange: v,
      onPageReset: p,
      tableHeight: P,
      gridRef: x,
      girdPaginationRef: N,
      highlight: S,
      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 m("span", {
            style: "word-break: break-word;white-space: pre-wrap;"
          }, ["隐藏行的列"]);
        if (r)
          return m(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 m("CheckInGridColumn", {
            props: {
              controller: this.c,
              data: s,
              value: a
            },
            key: s.srfkey + t
          });
      };
    }), m("control-layout", {
      attrs: {
        modelData: this.c.model
      }
    }, [m("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
    }, [m("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 && m("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 = D(""), t = b(() => {
      const {
        shifts: a = [],
        work_time: l = []
      } = e.value || {}, {
        start_base_time: c,
        end_base_time: u
      } = l[0] || {}, k = c, d = u, h = {
        title: `休息 (${k} - ${d})`,
        value: "rest",
        name: "休息"
      }, p = {
        title: `白班 (${k} - ${d})`,
        value: "work",
        name: "白班"
      };
      return a.length ? [...a.map((S) => {
        const {
          name: w
        } = S;
        return {
          title: `${w} (${k} - ${d})`,
          value: S.id,
          name: w,
          origin: S
        };
      }), h] : [p, h];
    }), 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((k) => k.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 m("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"
      }
    }, [m("div", {
      class: this.ns.e("caption")
    }, [e.replace(/\(.*\)/g, "")]), m("i-dropdownMenu", {
      slot: "list"
    }, [this.items.map((i) => m("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() {
    y(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
};
