@pisell/materials 6.11.36 → 6.11.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +26 -56
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +26 -56
- package/es/components/PisellLayouts/index.d.ts +1 -1
- package/es/components/colorPicker/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +6 -6
- package/es/components/filter/components/items/index.d.ts +0 -1
- package/es/components/filter/components/items/text/Editor/index.d.ts +0 -1
- package/es/components/filter/components/items/text/Preview/index.d.ts +0 -1
- package/es/components/filter/components/items/text/index.d.ts +0 -1
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.d.ts +2 -1
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +47 -3
- package/es/components/pisellFloorMapLayout/types.d.ts +7 -7
- package/es/components/pisellFloorMapLayout/types.js +2 -2
- package/es/components/pisellRecordBoard/index.d.ts +1 -1
- package/es/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendar.d.ts +5 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendar.js +1039 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendar.less +323 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/PisellRecordBoardCalendarView.d.ts +5 -1
- package/es/components/pisellRecordBoard/shellFrame/Calendar/PisellRecordBoardCalendarView.js +10 -10
- package/es/components/pisellRecordBoard/shellFrame/Calendar/bookingCalendarViewShared.d.ts +23 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/bookingCalendarViewShared.js +287 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/calendarI18n.d.ts +4 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/calendarI18n.js +28 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/calendarPersistGuard.d.ts +1 -1
- package/es/components/pisellRecordBoard/shellFrame/Calendar/const/bookingCalendarConstants.d.ts +36 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/const/bookingCalendarConstants.js +38 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/index.d.ts +3 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/index.js +3 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/modal/MoveConfirmModal.d.ts +17 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/modal/MoveConfirmModal.js +197 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowListModal.d.ts +17 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowListModal.js +65 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowPopover.d.ts +9 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowPopover.js +52 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/utils/BookingCalendarStyle.d.ts +10 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/utils/BookingCalendarStyle.js +58 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/utils/bookingCalendarDateUtils.d.ts +232 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/utils/bookingCalendarDateUtils.js +735 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarDaySelectionBar.d.ts +13 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarDaySelectionBar.js +37 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarDayView.d.ts +56 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarDayView.js +682 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarMonthView.d.ts +18 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarMonthView.js +155 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarWeekView.d.ts +27 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarWeekView.js +259 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/bookingCalendarDayViewContext.d.ts +12 -0
- package/es/components/pisellRecordBoard/shellFrame/Calendar/view/bookingCalendarDayViewContext.js +19 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/NoteTicker.d.ts +2 -1
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/NoteTicker.js +44 -14
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/PisellRecordBoardResourceWallView.d.ts +4 -2
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/PisellRecordBoardResourceWallView.js +117 -125
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanel.d.ts +3 -5
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanel.js +71 -352
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelColorTab.d.ts +17 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelColorTab.js +143 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelLayoutTab.d.ts +28 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelLayoutTab.js +128 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallViewport.less +8 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallViewportToolbar.d.ts +18 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallViewportToolbar.js +115 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/VenueWallCard.d.ts +6 -4
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/VenueWallCard.js +63 -120
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/resourceWallConstants.d.ts +2 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/resourceWallConstants.js +2 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/venueWallCardPresentation.d.ts +42 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/venueWallCardPresentation.js +114 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/venueWallUtils.d.ts +26 -0
- package/es/components/pisellRecordBoard/shellFrame/ResourceWall/venueWallUtils.js +54 -1
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +67 -12
- package/es/components/pisellRecordBoard/shellFrame/index.js +34 -7
- package/es/components/pisellRecordBoard/types.d.ts +97 -4
- package/es/components/pisellRecordBoard/types.js +18 -2
- package/es/components/pisellReservationScheduleBand/PisellReservationScheduleBand.less +34 -2
- package/es/components/pisellShellFrame/PisellShellFrame.less +5 -2
- package/es/components/table/Table/SelectField/index.d.ts +0 -1
- package/es/components/table/Table/tableConfig/summary/index.d.ts +0 -1
- package/es/hooks/useResponsive.d.ts +1 -1
- package/es/index.d.ts +1 -1
- package/es/locales/en-US.d.ts +74 -0
- package/es/locales/en-US.js +76 -1
- package/es/locales/ja.d.ts +74 -0
- package/es/locales/ja.js +75 -0
- package/es/locales/pt.d.ts +74 -0
- package/es/locales/pt.js +75 -0
- package/es/locales/zh-CN.d.ts +74 -0
- package/es/locales/zh-CN.js +76 -1
- package/es/locales/zh-TW.d.ts +74 -0
- package/es/locales/zh-TW.js +76 -1
- package/es/pisell-materials.tw.css +1 -1
- package/lib/components/PisellLayouts/index.d.ts +1 -1
- package/lib/components/colorPicker/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +6 -6
- package/lib/components/filter/components/items/index.d.ts +0 -1
- package/lib/components/filter/components/items/text/Editor/index.d.ts +0 -1
- package/lib/components/filter/components/items/text/Preview/index.d.ts +0 -1
- package/lib/components/filter/components/items/text/index.d.ts +0 -1
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.d.ts +2 -1
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +1 -1
- package/lib/components/pisellFloorMapLayout/types.d.ts +7 -7
- package/lib/components/pisellRecordBoard/index.d.ts +1 -1
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendar.d.ts +5 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendar.js +892 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendar.less +323 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/PisellRecordBoardCalendarView.d.ts +5 -1
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/PisellRecordBoardCalendarView.js +7 -6
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/bookingCalendarViewShared.d.ts +23 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/bookingCalendarViewShared.js +268 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/calendarI18n.d.ts +4 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/calendarI18n.js +53 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/calendarPersistGuard.d.ts +1 -1
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/const/bookingCalendarConstants.d.ts +36 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/const/bookingCalendarConstants.js +98 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/index.d.ts +3 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/modal/MoveConfirmModal.d.ts +17 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/modal/MoveConfirmModal.js +306 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowListModal.d.ts +17 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowListModal.js +111 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowPopover.d.ts +9 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/modal/OverflowPopover.js +96 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/utils/BookingCalendarStyle.d.ts +10 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/utils/BookingCalendarStyle.js +92 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/utils/bookingCalendarDateUtils.d.ts +232 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/utils/bookingCalendarDateUtils.js +666 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarDaySelectionBar.d.ts +13 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarDaySelectionBar.js +90 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarDayView.d.ts +56 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarDayView.js +812 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarMonthView.d.ts +18 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarMonthView.js +219 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarWeekView.d.ts +27 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/BookingCalendarWeekView.js +352 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/bookingCalendarDayViewContext.d.ts +12 -0
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/view/bookingCalendarDayViewContext.js +57 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/NoteTicker.d.ts +2 -1
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/NoteTicker.js +44 -9
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/PisellRecordBoardResourceWallView.d.ts +4 -2
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/PisellRecordBoardResourceWallView.js +60 -142
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanel.d.ts +3 -5
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanel.js +40 -269
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelColorTab.d.ts +17 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelColorTab.js +163 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelLayoutTab.d.ts +28 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallControlPanelLayoutTab.js +136 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallViewport.less +8 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallViewportToolbar.d.ts +18 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/ResourceWallViewportToolbar.js +175 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/VenueWallCard.d.ts +6 -4
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/VenueWallCard.js +61 -88
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/resourceWallConstants.d.ts +2 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/resourceWallConstants.js +29 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/venueWallCardPresentation.d.ts +42 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/venueWallCardPresentation.js +139 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/venueWallUtils.d.ts +26 -0
- package/lib/components/pisellRecordBoard/shellFrame/ResourceWall/venueWallUtils.js +31 -3
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +50 -5
- package/lib/components/pisellRecordBoard/shellFrame/index.js +29 -13
- package/lib/components/pisellRecordBoard/types.d.ts +97 -4
- package/lib/components/pisellReservationScheduleBand/PisellReservationScheduleBand.less +34 -2
- package/lib/components/pisellShellFrame/PisellShellFrame.less +5 -2
- package/lib/components/table/Table/SelectField/index.d.ts +0 -1
- package/lib/components/table/Table/tableConfig/summary/index.d.ts +0 -1
- package/lib/hooks/useResponsive.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/locales/en-US.d.ts +74 -0
- package/lib/locales/en-US.js +76 -1
- package/lib/locales/ja.d.ts +74 -0
- package/lib/locales/ja.js +75 -0
- package/lib/locales/pt.d.ts +74 -0
- package/lib/locales/pt.js +75 -0
- package/lib/locales/zh-CN.d.ts +74 -0
- package/lib/locales/zh-CN.js +76 -1
- package/lib/locales/zh-TW.d.ts +74 -0
- package/lib/locales/zh-TW.js +76 -1
- package/lib/pisell-materials.tw.css +1 -1
- package/package.json +3 -4
- package/es/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendarDemo.d.ts +0 -3
- package/es/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendarDemo.js +0 -6233
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendarDemo.d.ts +0 -3
- package/lib/components/pisellRecordBoard/shellFrame/Calendar/BookingCalendarDemo.js +0 -7079
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
/**
|
|
22
|
+
* RecordBoard 预约日历:月 / 周 / 日三视图,资源分组与折叠、锁台、拖拽改期、日视图多 lane overlay。
|
|
23
|
+
* 受控:`calendarView`、`anchorDate`、`bookings` 等见 {@link RecordBoardCalendarProps};未传时由内部 state 驱动(便于 Story)。
|
|
24
|
+
*/
|
|
25
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
26
|
+
import { DatePicker, message, Spin } from 'antd';
|
|
27
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
28
|
+
import { buildCalendarTimelineSlotStartsFromRange } from "../../../pisellTimeNavigator/utils";
|
|
29
|
+
import { useCalendarPersist } from "./calendarPersistGuard";
|
|
30
|
+
import { DAY_OVERLAY_INNER_BOTTOM, DAY_OVERLAY_INNER_TOP, DAY_OVERLAY_LANE_GAP, DAY_OVERLAY_LANE_MIN_PX, DAY_OVERLAY_VISIBLE_BOOKING_CAP, dayColWidth, dayHeaderHeight, dayRowHeight, DEFAULT_CALENDAR_TIMELINE, groupRowHeight } from "./const/bookingCalendarConstants";
|
|
31
|
+
import { addDays, buildDayRowTopMap, buildOverlayBookings, clusterDayCourtOverlaysByOverlap, dayAndHourToDayjs, dayOccupancy, dayOverlayHiddenKey, effectiveDayOverlayDisplayLaneCount, fmtDate, getBookingSegmentForDate, groupSelectedSlots, isFreeSelectionContiguousSameResource, isHourInTimelineSlots, maxConcurrentBookingsOnCourt, monthGrid, rangeDays, sameSlot, startOfWeek } from "./utils/bookingCalendarDateUtils";
|
|
32
|
+
import { MoveConfirmModal } from "./modal/MoveConfirmModal";
|
|
33
|
+
import { OverflowListModalVirtualList } from "./modal/OverflowListModal";
|
|
34
|
+
import { buildGroupedCourtRows } from "./bookingCalendarViewShared";
|
|
35
|
+
import { tCal } from "./calendarI18n";
|
|
36
|
+
import { BookingCalendarMonthView } from "./view/BookingCalendarMonthView";
|
|
37
|
+
import { BookingCalendarWeekView } from "./view/BookingCalendarWeekView";
|
|
38
|
+
import { BookingCalendarDayView } from "./view/BookingCalendarDayView";
|
|
39
|
+
import "./BookingCalendar.less";
|
|
40
|
+
var RangePicker = DatePicker.RangePicker;
|
|
41
|
+
|
|
42
|
+
/** 顶栏粒度切换 */
|
|
43
|
+
|
|
44
|
+
/** 看板日历根组件:内含主题 CSS 与 Spin,按 `view` 挂载月 / 周 / 日子组件 */
|
|
45
|
+
export default function BookingCalendar() {
|
|
46
|
+
var _hourSlots$;
|
|
47
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
48
|
+
var allowPersist = useCalendarPersist();
|
|
49
|
+
/** 将 `resources` 规范为 `{ id, name, type }`,供分组与三视图共用 */
|
|
50
|
+
var courts = useMemo(function () {
|
|
51
|
+
var r = props.resources;
|
|
52
|
+
if (Array.isArray(r) && r.length > 0) {
|
|
53
|
+
var mapped = r.filter(function (x) {
|
|
54
|
+
return x && x.id !== undefined && x.id !== null && String(x.id).trim() !== '';
|
|
55
|
+
}).map(function (x) {
|
|
56
|
+
return {
|
|
57
|
+
id: String(x.id),
|
|
58
|
+
name: x.name != null && String(x.name).trim() !== '' ? String(x.name) : String(x.id),
|
|
59
|
+
type: x.groupType && String(x.groupType).trim() !== '' ? String(x.groupType) : tCal('pisell2.recordBoard.calendar.common.resourceFallback')
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
if (mapped.length > 0) return mapped;
|
|
63
|
+
}
|
|
64
|
+
return [];
|
|
65
|
+
}, [props.resources]);
|
|
66
|
+
|
|
67
|
+
/** 顶栏受控:有 props 用 props,无则回退本地 state(便于 Story 单测) */
|
|
68
|
+
var isLight = props.appearance === 'light';
|
|
69
|
+
var _useState = useState('month'),
|
|
70
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
+
internalView = _useState2[0],
|
|
72
|
+
setInternalView = _useState2[1];
|
|
73
|
+
var _useState3 = useState(function () {
|
|
74
|
+
return new Date();
|
|
75
|
+
}),
|
|
76
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
77
|
+
internalAnchor = _useState4[0],
|
|
78
|
+
setInternalAnchor = _useState4[1];
|
|
79
|
+
var view = props.calendarView != null ? props.calendarView : internalView;
|
|
80
|
+
var linkedAnchorMs = props.anchorDate != null ? props.anchorDate.getTime() : null;
|
|
81
|
+
var anchorDate = useMemo(function () {
|
|
82
|
+
if (props.anchorDate != null) {
|
|
83
|
+
return new Date(props.anchorDate);
|
|
84
|
+
}
|
|
85
|
+
return internalAnchor;
|
|
86
|
+
}, [linkedAnchorMs, internalAnchor]);
|
|
87
|
+
var resolvedSlotMinutes = useMemo(function () {
|
|
88
|
+
var _props$slotStepMinute;
|
|
89
|
+
var raw = (_props$slotStepMinute = props.slotStepMinutes) !== null && _props$slotStepMinute !== void 0 ? _props$slotStepMinute : 60;
|
|
90
|
+
var n = Math.round(Number(raw));
|
|
91
|
+
if (!Number.isFinite(n) || n < 1) return 60;
|
|
92
|
+
return Math.min(24 * 60, n);
|
|
93
|
+
}, [props.slotStepMinutes]);
|
|
94
|
+
var slotStepHours = resolvedSlotMinutes / 60;
|
|
95
|
+
/** 每槽一列固定为「原整点列」宽度,细粒度仅增加列数,由容器横向滚动承载 */
|
|
96
|
+
var slotColWidth = dayColWidth;
|
|
97
|
+
var timelinePxPerHour = dayColWidth / slotStepHours;
|
|
98
|
+
|
|
99
|
+
/** 切换月/周/日:先 `onCalendarViewChange`,无受控回调时再 `setInternalView` */
|
|
100
|
+
var commitView = function commitView(v) {
|
|
101
|
+
var _props$onCalendarView;
|
|
102
|
+
(_props$onCalendarView = props.onCalendarViewChange) === null || _props$onCalendarView === void 0 || _props$onCalendarView.call(props, v);
|
|
103
|
+
if (!props.onCalendarViewChange) {
|
|
104
|
+
setInternalView(v);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
/** 切换锚定日:先 `onAnchorDateChange`,无受控时再 `setInternalAnchor` */
|
|
108
|
+
var commitAnchor = function commitAnchor(d) {
|
|
109
|
+
var _props$onAnchorDateCh;
|
|
110
|
+
(_props$onAnchorDateCh = props.onAnchorDateChange) === null || _props$onAnchorDateCh === void 0 || _props$onAnchorDateCh.call(props, d);
|
|
111
|
+
if (!props.onAnchorDateChange) {
|
|
112
|
+
setInternalAnchor(d);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
var _useState5 = useState([]),
|
|
116
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
117
|
+
internalBookings = _useState6[0],
|
|
118
|
+
setBookings = _useState6[1];
|
|
119
|
+
var isControlledBookings = props.bookings != null;
|
|
120
|
+
/** 预约与锁台片段列表;受控时用 props,否则用本地演示数据 */
|
|
121
|
+
var bookings = isControlledBookings ? props.bookings : internalBookings;
|
|
122
|
+
|
|
123
|
+
/** 锚定日或视图变化时上报当前可视区间,供业务按范围拉数 */
|
|
124
|
+
useEffect(function () {
|
|
125
|
+
if (!props.onViewportChange) return;
|
|
126
|
+
var a = new Date(anchorDate);
|
|
127
|
+
var rangeStart;
|
|
128
|
+
var rangeEnd;
|
|
129
|
+
if (view === 'month') {
|
|
130
|
+
rangeStart = new Date(a.getFullYear(), a.getMonth(), 1);
|
|
131
|
+
rangeEnd = new Date(a.getFullYear(), a.getMonth() + 1, 0);
|
|
132
|
+
} else if (view === 'week') {
|
|
133
|
+
rangeStart = startOfWeek(a);
|
|
134
|
+
rangeEnd = addDays(rangeStart, 6);
|
|
135
|
+
} else {
|
|
136
|
+
rangeStart = new Date(a);
|
|
137
|
+
rangeEnd = new Date(a);
|
|
138
|
+
}
|
|
139
|
+
props.onViewportChange({
|
|
140
|
+
view: view,
|
|
141
|
+
anchorDate: a,
|
|
142
|
+
rangeStart: rangeStart,
|
|
143
|
+
rangeEnd: rangeEnd
|
|
144
|
+
});
|
|
145
|
+
}, [view, anchorDate, props.onViewportChange]);
|
|
146
|
+
var _useState7 = useState([]),
|
|
147
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
148
|
+
selectedFreeSlots = _useState8[0],
|
|
149
|
+
setSelectedFreeSlots = _useState8[1];
|
|
150
|
+
var _useState9 = useState([]),
|
|
151
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
152
|
+
selectedBlockSlots = _useState10[0],
|
|
153
|
+
setSelectedBlockSlots = _useState10[1];
|
|
154
|
+
var _useState11 = useState(null),
|
|
155
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
156
|
+
focusedCourtId = _useState12[0],
|
|
157
|
+
setFocusedCourtId = _useState12[1];
|
|
158
|
+
var _useState13 = useState(false),
|
|
159
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
160
|
+
showBlockPanel = _useState14[0],
|
|
161
|
+
setShowBlockPanel = _useState14[1];
|
|
162
|
+
var _useState15 = useState(function () {
|
|
163
|
+
return tCal('pisell2.recordBoard.calendar.block.defaultTitle');
|
|
164
|
+
}),
|
|
165
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
166
|
+
blockFormName = _useState16[0],
|
|
167
|
+
setBlockFormName = _useState16[1];
|
|
168
|
+
var _useState17 = useState(''),
|
|
169
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
170
|
+
blockModalNote = _useState18[0],
|
|
171
|
+
setBlockModalNote = _useState18[1];
|
|
172
|
+
var _useState19 = useState(''),
|
|
173
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
174
|
+
blockResourceId = _useState20[0],
|
|
175
|
+
setBlockResourceId = _useState20[1];
|
|
176
|
+
var _useState21 = useState(null),
|
|
177
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
178
|
+
blockTimeRange = _useState22[0],
|
|
179
|
+
setBlockTimeRange = _useState22[1];
|
|
180
|
+
var _useState23 = useState(false),
|
|
181
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
182
|
+
blockSaving = _useState24[0],
|
|
183
|
+
setBlockSaving = _useState24[1];
|
|
184
|
+
var _useState25 = useState(null),
|
|
185
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
186
|
+
transitioningToDay = _useState26[0],
|
|
187
|
+
setTransitioningToDay = _useState26[1];
|
|
188
|
+
var _useState27 = useState(0),
|
|
189
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
190
|
+
navDirection = _useState28[0],
|
|
191
|
+
setNavDirection = _useState28[1];
|
|
192
|
+
var _useState29 = useState(null),
|
|
193
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
194
|
+
overflowPopover = _useState30[0],
|
|
195
|
+
setOverflowPopover = _useState30[1];
|
|
196
|
+
var _useState31 = useState(null),
|
|
197
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
|
198
|
+
overflowListModal = _useState32[0],
|
|
199
|
+
setOverflowListModal = _useState32[1];
|
|
200
|
+
var _useState33 = useState(null),
|
|
201
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
|
202
|
+
draggingItem = _useState34[0],
|
|
203
|
+
setDraggingItem = _useState34[1];
|
|
204
|
+
var _useState35 = useState(null),
|
|
205
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
|
206
|
+
moveConfirm = _useState36[0],
|
|
207
|
+
setMoveConfirm = _useState36[1];
|
|
208
|
+
var _useState37 = useState(null),
|
|
209
|
+
_useState38 = _slicedToArray(_useState37, 2),
|
|
210
|
+
moveDraft = _useState38[0],
|
|
211
|
+
setMoveDraft = _useState38[1];
|
|
212
|
+
var _useState39 = useState({
|
|
213
|
+
VIP: false,
|
|
214
|
+
Standard: false
|
|
215
|
+
}),
|
|
216
|
+
_useState40 = _slicedToArray(_useState39, 2),
|
|
217
|
+
collapsedGroups = _useState40[0],
|
|
218
|
+
setCollapsedGroups = _useState40[1];
|
|
219
|
+
var blockPanelRef = useRef(null);
|
|
220
|
+
var overflowPanelRef = useRef(null);
|
|
221
|
+
var moveConfirmRef = useRef(null);
|
|
222
|
+
|
|
223
|
+
/** 与 `courts` 相同别名,便于子视图语义(可见资源列表) */
|
|
224
|
+
var visibleCourts = useMemo(function () {
|
|
225
|
+
return courts;
|
|
226
|
+
}, [courts]);
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 日/周/月左侧行模型:VIP/Standard 与按 `type` 分组,可折叠。
|
|
230
|
+
* 全部分组折叠时保留仅 group 头行(与周视图一致,不自动平铺 court)。
|
|
231
|
+
*/
|
|
232
|
+
var visibleCourtRows = useMemo(function () {
|
|
233
|
+
return buildGroupedCourtRows(visibleCourts, collapsedGroups);
|
|
234
|
+
}, [visibleCourts, collapsedGroups]);
|
|
235
|
+
/** 当前锚定日的 `YYYY-MM-DD`(日视图主键) */
|
|
236
|
+
var dayKey = fmtDate(anchorDate);
|
|
237
|
+
/** 时间轴上的槽位起始小时(含 `slotStepMinutes` 细粒度) */
|
|
238
|
+
var hourSlots = useMemo(function () {
|
|
239
|
+
var _props$timelineRange;
|
|
240
|
+
return buildCalendarTimelineSlotStartsFromRange((_props$timelineRange = props.timelineRange) !== null && _props$timelineRange !== void 0 ? _props$timelineRange : DEFAULT_CALENDAR_TIMELINE, anchorDate, resolvedSlotMinutes);
|
|
241
|
+
}, [props.timelineRange, anchorDate, resolvedSlotMinutes]);
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 日视图专用:根据预约条重叠算每行高度、overlay 列表、隐藏 id、`+N` 溢出气泡数据。
|
|
245
|
+
* 周/月不读其中大部分字段,但为单 hook 依赖仍随 `visibleCourtRows` 重算。
|
|
246
|
+
*/
|
|
247
|
+
var _useMemo = useMemo(function () {
|
|
248
|
+
var defaultHeights = visibleCourtRows.map(function (row) {
|
|
249
|
+
return row.kind === 'group' ? groupRowHeight : dayRowHeight;
|
|
250
|
+
});
|
|
251
|
+
var tops = buildDayRowTopMap(visibleCourtRows, defaultHeights);
|
|
252
|
+
var overlays = buildOverlayBookings(visibleCourtRows, dayKey, bookings, tops, hourSlots, defaultHeights, slotStepHours);
|
|
253
|
+
var expandedHeights = visibleCourtRows.map(function (row, i) {
|
|
254
|
+
if (row.kind !== 'court') return defaultHeights[i];
|
|
255
|
+
var lc = maxConcurrentBookingsOnCourt(overlays, row.id);
|
|
256
|
+
var displayLc = effectiveDayOverlayDisplayLaneCount(lc);
|
|
257
|
+
if (displayLc <= 1) return dayRowHeight;
|
|
258
|
+
var need = DAY_OVERLAY_INNER_TOP + DAY_OVERLAY_INNER_BOTTOM + displayLc * DAY_OVERLAY_LANE_MIN_PX + (displayLc - 1) * DAY_OVERLAY_LANE_GAP;
|
|
259
|
+
return Math.max(dayRowHeight, need);
|
|
260
|
+
});
|
|
261
|
+
var tops2 = buildDayRowTopMap(visibleCourtRows, expandedHeights);
|
|
262
|
+
overlays = buildOverlayBookings(visibleCourtRows, dayKey, bookings, tops2, hourSlots, expandedHeights, slotStepHours);
|
|
263
|
+
var courtDayDisplayLaneCount = {};
|
|
264
|
+
var hiddenDayOverlayIdSet = new Set();
|
|
265
|
+
var dayOverlayOverflowPluses = [];
|
|
266
|
+
var _iterator = _createForOfIteratorHelper(visibleCourtRows),
|
|
267
|
+
_step;
|
|
268
|
+
try {
|
|
269
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
270
|
+
var row = _step.value;
|
|
271
|
+
if (row.kind !== 'court') continue;
|
|
272
|
+
var cid = row.id;
|
|
273
|
+
var rawLc = maxConcurrentBookingsOnCourt(overlays, cid);
|
|
274
|
+
courtDayDisplayLaneCount[cid] = effectiveDayOverlayDisplayLaneCount(rawLc);
|
|
275
|
+
var clusters = clusterDayCourtOverlaysByOverlap(overlays, cid);
|
|
276
|
+
var _iterator2 = _createForOfIteratorHelper(clusters),
|
|
277
|
+
_step2;
|
|
278
|
+
try {
|
|
279
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
280
|
+
var cluster = _step2.value;
|
|
281
|
+
if (cluster.length <= DAY_OVERLAY_VISIBLE_BOOKING_CAP) continue;
|
|
282
|
+
var sortedByLane = _toConsumableArray(cluster).sort(function (a, b) {
|
|
283
|
+
var _a$lane, _b$lane;
|
|
284
|
+
return ((_a$lane = a.lane) !== null && _a$lane !== void 0 ? _a$lane : 0) - ((_b$lane = b.lane) !== null && _b$lane !== void 0 ? _b$lane : 0) || a.start - b.start;
|
|
285
|
+
});
|
|
286
|
+
for (var i = DAY_OVERLAY_VISIBLE_BOOKING_CAP; i < sortedByLane.length; i++) {
|
|
287
|
+
var o = sortedByLane[i];
|
|
288
|
+
hiddenDayOverlayIdSet.add(dayOverlayHiddenKey(o.item, dayKey, o.courtId));
|
|
289
|
+
}
|
|
290
|
+
var hidden = sortedByLane.slice(DAY_OVERLAY_VISIBLE_BOOKING_CAP);
|
|
291
|
+
var minS = Infinity;
|
|
292
|
+
var maxE = -Infinity;
|
|
293
|
+
var _iterator3 = _createForOfIteratorHelper(cluster),
|
|
294
|
+
_step3;
|
|
295
|
+
try {
|
|
296
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
297
|
+
var _o = _step3.value;
|
|
298
|
+
minS = Math.min(minS, _o.start);
|
|
299
|
+
maxE = Math.max(maxE, _o.start + _o.span);
|
|
300
|
+
}
|
|
301
|
+
} catch (err) {
|
|
302
|
+
_iterator3.e(err);
|
|
303
|
+
} finally {
|
|
304
|
+
_iterator3.f();
|
|
305
|
+
}
|
|
306
|
+
var anchor = hidden[0];
|
|
307
|
+
dayOverlayOverflowPluses.push({
|
|
308
|
+
key: "".concat(cid, "-").concat(minS, "-").concat(maxE, "-").concat(dayKey),
|
|
309
|
+
courtId: cid,
|
|
310
|
+
rowTop: anchor.rowTop,
|
|
311
|
+
rowHeight: anchor.rowHeight,
|
|
312
|
+
start: minS,
|
|
313
|
+
span: maxE - minS,
|
|
314
|
+
plusCount: hidden.length,
|
|
315
|
+
overflowItems: hidden.map(function (o) {
|
|
316
|
+
return o.item;
|
|
317
|
+
})
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
} catch (err) {
|
|
321
|
+
_iterator2.e(err);
|
|
322
|
+
} finally {
|
|
323
|
+
_iterator2.f();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
} catch (err) {
|
|
327
|
+
_iterator.e(err);
|
|
328
|
+
} finally {
|
|
329
|
+
_iterator.f();
|
|
330
|
+
}
|
|
331
|
+
return {
|
|
332
|
+
dayRowHeights: expandedHeights,
|
|
333
|
+
dayRowTopMap: tops2,
|
|
334
|
+
overlayBookings: overlays,
|
|
335
|
+
courtDayDisplayLaneCount: courtDayDisplayLaneCount,
|
|
336
|
+
hiddenDayOverlayIdSet: hiddenDayOverlayIdSet,
|
|
337
|
+
dayOverlayOverflowPluses: dayOverlayOverflowPluses
|
|
338
|
+
};
|
|
339
|
+
}, [visibleCourtRows, dayKey, bookings, hourSlots, slotStepHours]),
|
|
340
|
+
dayRowHeights = _useMemo.dayRowHeights,
|
|
341
|
+
dayRowTopMap = _useMemo.dayRowTopMap,
|
|
342
|
+
overlayBookings = _useMemo.overlayBookings,
|
|
343
|
+
courtDayDisplayLaneCount = _useMemo.courtDayDisplayLaneCount,
|
|
344
|
+
hiddenDayOverlayIdSet = _useMemo.hiddenDayOverlayIdSet,
|
|
345
|
+
dayOverlayOverflowPluses = _useMemo.dayOverlayOverflowPluses;
|
|
346
|
+
|
|
347
|
+
/** 周视图表头对应的 7 个自然日 */
|
|
348
|
+
var weekDays = useMemo(function () {
|
|
349
|
+
return rangeDays(anchorDate);
|
|
350
|
+
}, [anchorDate]);
|
|
351
|
+
/** 周视图内判断「是否落在当前展示周」的 dateKey 集合 */
|
|
352
|
+
var selectedWeekKeys = useMemo(function () {
|
|
353
|
+
return new Set(weekDays.map(function (d) {
|
|
354
|
+
return fmtDate(d);
|
|
355
|
+
}));
|
|
356
|
+
}, [weekDays]);
|
|
357
|
+
var firstTimelineHour = (_hourSlots$ = hourSlots[0]) !== null && _hourSlots$ !== void 0 ? _hourSlots$ : 0;
|
|
358
|
+
var endTimelineExclusive = hourSlots.length ? hourSlots[hourSlots.length - 1] + slotStepHours : 24;
|
|
359
|
+
/** 槽位起始小时是否落在当前营业/时间轴配置内 */
|
|
360
|
+
var isBusinessHour = function isBusinessHour(h) {
|
|
361
|
+
return isHourInTimelineSlots(h, hourSlots);
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/** 月历每格摘要(占用点、锁台等),供月视图渲染 */
|
|
365
|
+
var monthDays = useMemo(function () {
|
|
366
|
+
return monthGrid(anchorDate, bookings, courts, hourSlots, slotStepHours);
|
|
367
|
+
}, [anchorDate, bookings, courts, hourSlots, slotStepHours]);
|
|
368
|
+
/** 日视图左侧:各资源当日剩余可约槽占比(用于热力/文案) */
|
|
369
|
+
var dayRowRemainingByCourt = useMemo(function () {
|
|
370
|
+
var total = hourSlots.length;
|
|
371
|
+
return Object.fromEntries(visibleCourtRows.filter(function (row) {
|
|
372
|
+
return row.kind === 'court';
|
|
373
|
+
}).map(function (court) {
|
|
374
|
+
var occupied = hourSlots.filter(function (hour) {
|
|
375
|
+
return isBusinessHour(hour) && dayOccupancy(court.id, dayKey, bookings, hourSlots, slotStepHours)[hour];
|
|
376
|
+
}).length;
|
|
377
|
+
var remaining = Math.max(0, total - occupied);
|
|
378
|
+
var ratio = total > 0 ? remaining / total : 0;
|
|
379
|
+
return [court.id, {
|
|
380
|
+
remaining: remaining,
|
|
381
|
+
total: total,
|
|
382
|
+
ratio: ratio
|
|
383
|
+
}];
|
|
384
|
+
}));
|
|
385
|
+
}, [visibleCourtRows, dayKey, bookings, hourSlots, slotStepHours]);
|
|
386
|
+
/** 日视图表头:每个整点列上仍有空的资源数占比(按全部可见资源计,与分组折叠无关) */
|
|
387
|
+
var dayHourRemaining = useMemo(function () {
|
|
388
|
+
var total = visibleCourts.length;
|
|
389
|
+
return Object.fromEntries(hourSlots.map(function (hour) {
|
|
390
|
+
if (!isBusinessHour(hour)) return [hour, {
|
|
391
|
+
remaining: 0,
|
|
392
|
+
total: total,
|
|
393
|
+
ratio: 0
|
|
394
|
+
}];
|
|
395
|
+
var remaining = visibleCourts.filter(function (court) {
|
|
396
|
+
return !dayOccupancy(court.id, dayKey, bookings, hourSlots, slotStepHours)[hour];
|
|
397
|
+
}).length;
|
|
398
|
+
var ratio = total > 0 ? remaining / total : 0;
|
|
399
|
+
return [hour, {
|
|
400
|
+
remaining: remaining,
|
|
401
|
+
total: total,
|
|
402
|
+
ratio: ratio
|
|
403
|
+
}];
|
|
404
|
+
}));
|
|
405
|
+
}, [visibleCourts, dayKey, bookings, hourSlots, slotStepHours]);
|
|
406
|
+
/** 日视图内容区总高度(表头 + 各资源行叠加以 overlay 抬高后的高度) */
|
|
407
|
+
var dayContentHeight = dayHeaderHeight + dayRowHeights.reduce(function (sum, h) {
|
|
408
|
+
return sum + h;
|
|
409
|
+
}, 0);
|
|
410
|
+
|
|
411
|
+
/** 点击文档空白处关闭锁台面版、溢出浮层、改期确认等面板 */
|
|
412
|
+
useEffect(function () {
|
|
413
|
+
function handleOutside(e) {
|
|
414
|
+
var target = e.target;
|
|
415
|
+
if (!(target instanceof Node)) return;
|
|
416
|
+
if (showBlockPanel && blockPanelRef.current && !blockPanelRef.current.contains(target)) setShowBlockPanel(false);
|
|
417
|
+
if (overflowPopover && overflowPanelRef.current && !overflowPanelRef.current.contains(target)) setOverflowPopover(null);
|
|
418
|
+
if (overflowListModal && overflowPanelRef.current && !overflowPanelRef.current.contains(target)) setOverflowListModal(null);
|
|
419
|
+
if (moveConfirm && moveConfirmRef.current && !moveConfirmRef.current.contains(target)) setMoveConfirm(null);
|
|
420
|
+
}
|
|
421
|
+
document.addEventListener('mousedown', handleOutside);
|
|
422
|
+
return function () {
|
|
423
|
+
return document.removeEventListener('mousedown', handleOutside);
|
|
424
|
+
};
|
|
425
|
+
}, [showBlockPanel, overflowPopover, overflowListModal, moveConfirm]);
|
|
426
|
+
|
|
427
|
+
/** 锁台面版打开时若选区不再连续同资源则自动收起(避免与表单状态不一致) */
|
|
428
|
+
useEffect(function () {
|
|
429
|
+
if (!showBlockPanel) return;
|
|
430
|
+
if (!isFreeSelectionContiguousSameResource(selectedFreeSlots, slotStepHours)) {
|
|
431
|
+
setShowBlockPanel(false);
|
|
432
|
+
}
|
|
433
|
+
}, [showBlockPanel, selectedFreeSlots, slotStepHours]);
|
|
434
|
+
|
|
435
|
+
/** 打开锁台面版时用当前选中的空闲连续段预填资源与时间范围(仅内置锁台面版) */
|
|
436
|
+
useEffect(function () {
|
|
437
|
+
if (props.onBlockedTimePanelRequest) return;
|
|
438
|
+
if (!showBlockPanel || selectedFreeSlots.length === 0) return;
|
|
439
|
+
var groups = groupSelectedSlots(selectedFreeSlots, slotStepHours);
|
|
440
|
+
var g = groups[0];
|
|
441
|
+
if (!g) return;
|
|
442
|
+
setBlockResourceId(String(g.courtId));
|
|
443
|
+
setBlockTimeRange([dayAndHourToDayjs(g.date, g.startHour), dayAndHourToDayjs(g.date, g.endHour)]);
|
|
444
|
+
setBlockFormName(tCal('pisell2.recordBoard.calendar.block.defaultTitle'));
|
|
445
|
+
setBlockModalNote('');
|
|
446
|
+
}, [showBlockPanel, selectedFreeSlots, slotStepHours]);
|
|
447
|
+
|
|
448
|
+
/** 周/月跳入日视图时的短动画标记,超时清除 */
|
|
449
|
+
useEffect(function () {
|
|
450
|
+
if (!transitioningToDay) return;
|
|
451
|
+
var timer = setTimeout(function () {
|
|
452
|
+
return setTransitioningToDay(null);
|
|
453
|
+
}, 280);
|
|
454
|
+
return function () {
|
|
455
|
+
return clearTimeout(timer);
|
|
456
|
+
};
|
|
457
|
+
}, [transitioningToDay]);
|
|
458
|
+
|
|
459
|
+
/** 当前日锚定下,该资源该槽是否在「空闲多选」集合中 */
|
|
460
|
+
function isFreeSelected(courtId, hour) {
|
|
461
|
+
return selectedFreeSlots.some(function (slot) {
|
|
462
|
+
return slot.courtId === courtId && slot.date === dayKey && slot.hour === hour;
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/** 当前日锚定下,该资源该槽是否在「锁台多选」集合中 */
|
|
467
|
+
function isBlockSelected(courtId, hour) {
|
|
468
|
+
return selectedBlockSlots.some(function (slot) {
|
|
469
|
+
return slot.courtId === courtId && slot.date === dayKey && slot.hour === hour;
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** 从周/月单元格调起日视图:更新锚定日、可选聚焦资源、记录过渡动画方向 */
|
|
474
|
+
function goToDayFromCell(day, courtId, source) {
|
|
475
|
+
setNavDirection(day > anchorDate ? 1 : -1);
|
|
476
|
+
setTransitioningToDay({
|
|
477
|
+
source: source
|
|
478
|
+
});
|
|
479
|
+
commitAnchor(day);
|
|
480
|
+
setFocusedCourtId(courtId || null);
|
|
481
|
+
commitView('day');
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** 卡片详情:业务若 `onBookingClick` 返回 true 则视为已消费;否则关闭溢出气泡 */
|
|
485
|
+
function openBookingDetail(item) {
|
|
486
|
+
var _props$onBookingClick;
|
|
487
|
+
if (((_props$onBookingClick = props.onBookingClick) === null || _props$onBookingClick === void 0 ? void 0 : _props$onBookingClick.call(props, item)) === true) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
setOverflowPopover(null);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** 日视图格子点击:空闲槽进多选;锁台槽进锁台多选;已约不动 */
|
|
494
|
+
function toggleSlot(courtId, hour) {
|
|
495
|
+
var existing = dayOccupancy(courtId, dayKey, bookings, hourSlots, slotStepHours)[hour];
|
|
496
|
+
var court = courts.find(function (c) {
|
|
497
|
+
return c.id === courtId;
|
|
498
|
+
});
|
|
499
|
+
var slot = {
|
|
500
|
+
courtId: courtId,
|
|
501
|
+
court: court === null || court === void 0 ? void 0 : court.name,
|
|
502
|
+
date: dayKey,
|
|
503
|
+
hour: hour
|
|
504
|
+
};
|
|
505
|
+
if (!existing) {
|
|
506
|
+
setSelectedFreeSlots(function (prev) {
|
|
507
|
+
return prev.some(function (s) {
|
|
508
|
+
return sameSlot(s, slot);
|
|
509
|
+
}) ? prev.filter(function (s) {
|
|
510
|
+
return !sameSlot(s, slot);
|
|
511
|
+
}) : [].concat(_toConsumableArray(prev), [slot]);
|
|
512
|
+
});
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
if (existing.kind === 'block') {
|
|
516
|
+
setSelectedBlockSlots(function (prev) {
|
|
517
|
+
return prev.some(function (s) {
|
|
518
|
+
return sameSlot(s, slot);
|
|
519
|
+
}) ? prev.filter(function (s) {
|
|
520
|
+
return !sameSlot(s, slot);
|
|
521
|
+
}) : [].concat(_toConsumableArray(prev), [slot]);
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** 清空空闲与锁台多选 */
|
|
527
|
+
function deselectAll() {
|
|
528
|
+
setSelectedFreeSlots([]);
|
|
529
|
+
setSelectedBlockSlots([]);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** 将连续空闲选区合并为一条或多条本地预约(演示/未接写接口时) */
|
|
533
|
+
function createBookingFromSelection() {
|
|
534
|
+
if (!allowPersist('createBooking')) return;
|
|
535
|
+
if (selectedFreeSlots.length === 0) return;
|
|
536
|
+
var groups = groupSelectedSlots(selectedFreeSlots, slotStepHours);
|
|
537
|
+
var newBookings = groups.map(function (slot, idx) {
|
|
538
|
+
return {
|
|
539
|
+
id: "new-".concat(slot.courtId, "-").concat(slot.date, "-").concat(slot.startHour, "-").concat(idx),
|
|
540
|
+
courtId: slot.courtId,
|
|
541
|
+
date: slot.date,
|
|
542
|
+
startHour: slot.startHour,
|
|
543
|
+
endHour: slot.endHour,
|
|
544
|
+
name: tCal('pisell2.recordBoard.calendar.common.newBookingName'),
|
|
545
|
+
kind: 'booking'
|
|
546
|
+
};
|
|
547
|
+
});
|
|
548
|
+
setBookings(function (prev) {
|
|
549
|
+
return [].concat(_toConsumableArray(newBookings), _toConsumableArray(prev));
|
|
550
|
+
});
|
|
551
|
+
setSelectedFreeSlots([]);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/** 按多选锁台槽从本地 bookings 中移除对应 block 片段 */
|
|
555
|
+
function openSelectedBlocks() {
|
|
556
|
+
if (!allowPersist('removeBlocks')) return;
|
|
557
|
+
if (selectedBlockSlots.length === 0) return;
|
|
558
|
+
var selectedSet = new Set(selectedBlockSlots.map(function (s) {
|
|
559
|
+
return "".concat(s.courtId, "-").concat(s.date, "-").concat(s.hour);
|
|
560
|
+
}));
|
|
561
|
+
setBookings(function (prev) {
|
|
562
|
+
return prev.filter(function (item) {
|
|
563
|
+
if (item.kind !== 'block') return true;
|
|
564
|
+
var seg = getBookingSegmentForDate(item, item.date);
|
|
565
|
+
var hoursInItem = hourSlots.filter(function (slotStart) {
|
|
566
|
+
return slotStart >= item.startHour - 1e-9 && slotStart < item.endHour - 1e-9;
|
|
567
|
+
});
|
|
568
|
+
return !hoursInItem.some(function (h) {
|
|
569
|
+
return selectedSet.has("".concat(item.courtId, "-").concat(item.date, "-").concat(h));
|
|
570
|
+
});
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
setSelectedBlockSlots([]);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/** 屏蔽:宿主 lock 弹窗,或内置锁台面版 */
|
|
577
|
+
var handleOpenBlockPanelFromSelection = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
578
|
+
var groups, g, slotsPayload, payload, ok;
|
|
579
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
580
|
+
while (1) switch (_context.prev = _context.next) {
|
|
581
|
+
case 0:
|
|
582
|
+
if (isFreeSelectionContiguousSameResource(selectedFreeSlots, slotStepHours)) {
|
|
583
|
+
_context.next = 2;
|
|
584
|
+
break;
|
|
585
|
+
}
|
|
586
|
+
return _context.abrupt("return");
|
|
587
|
+
case 2:
|
|
588
|
+
groups = groupSelectedSlots(selectedFreeSlots, slotStepHours);
|
|
589
|
+
g = groups[0];
|
|
590
|
+
if (g) {
|
|
591
|
+
_context.next = 6;
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
return _context.abrupt("return");
|
|
595
|
+
case 6:
|
|
596
|
+
if (!props.onBlockedTimePanelRequest) {
|
|
597
|
+
_context.next = 19;
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
_context.prev = 7;
|
|
601
|
+
slotsPayload = selectedFreeSlots.map(function (s) {
|
|
602
|
+
var slot = {
|
|
603
|
+
courtId: s.courtId,
|
|
604
|
+
date: s.date,
|
|
605
|
+
hour: s.hour
|
|
606
|
+
};
|
|
607
|
+
var extra = s;
|
|
608
|
+
if (extra.court !== undefined && extra.court !== '') {
|
|
609
|
+
slot.court = extra.court;
|
|
610
|
+
}
|
|
611
|
+
return slot;
|
|
612
|
+
});
|
|
613
|
+
payload = {
|
|
614
|
+
slotStepHours: slotStepHours,
|
|
615
|
+
slotStepMinutes: resolvedSlotMinutes,
|
|
616
|
+
dayKey: dayKey,
|
|
617
|
+
selectedFreeSlots: slotsPayload,
|
|
618
|
+
mergedRange: {
|
|
619
|
+
courtId: g.courtId,
|
|
620
|
+
date: g.date,
|
|
621
|
+
startHour: g.startHour,
|
|
622
|
+
endHour: g.endHour
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
_context.next = 12;
|
|
626
|
+
return props.onBlockedTimePanelRequest(payload);
|
|
627
|
+
case 12:
|
|
628
|
+
ok = _context.sent;
|
|
629
|
+
if (ok !== false) {
|
|
630
|
+
setSelectedFreeSlots([]);
|
|
631
|
+
}
|
|
632
|
+
_context.next = 18;
|
|
633
|
+
break;
|
|
634
|
+
case 16:
|
|
635
|
+
_context.prev = 16;
|
|
636
|
+
_context.t0 = _context["catch"](7);
|
|
637
|
+
case 18:
|
|
638
|
+
return _context.abrupt("return");
|
|
639
|
+
case 19:
|
|
640
|
+
setShowBlockPanel(true);
|
|
641
|
+
case 20:
|
|
642
|
+
case "end":
|
|
643
|
+
return _context.stop();
|
|
644
|
+
}
|
|
645
|
+
}, _callee, null, [[7, 16]]);
|
|
646
|
+
})), [selectedFreeSlots, slotStepHours, resolvedSlotMinutes, dayKey, props.onBlockedTimePanelRequest]);
|
|
647
|
+
|
|
648
|
+
/** 提交锁台:优先走 `onBlockedTimeSave`;否则写入本地 block 片段 */
|
|
649
|
+
function saveBlockedTime() {
|
|
650
|
+
return _saveBlockedTime.apply(this, arguments);
|
|
651
|
+
}
|
|
652
|
+
/** 拖拽改期松手:宿主接管改约,或弹出内置确认框 */
|
|
653
|
+
function _saveBlockedTime() {
|
|
654
|
+
_saveBlockedTime = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
655
|
+
var _props$blockedTimeSal;
|
|
656
|
+
var _blockTimeRange, start, end, rid, channels, payload, ok, courtId, date, endDate, startHour, endHour, nextBlock;
|
|
657
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
658
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
659
|
+
case 0:
|
|
660
|
+
if (!(!(blockTimeRange !== null && blockTimeRange !== void 0 && blockTimeRange[0]) || !(blockTimeRange !== null && blockTimeRange !== void 0 && blockTimeRange[1]))) {
|
|
661
|
+
_context2.next = 3;
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
message.warning(tCal('pisell2.recordBoard.calendar.block.warnSelectTime'));
|
|
665
|
+
return _context2.abrupt("return");
|
|
666
|
+
case 3:
|
|
667
|
+
_blockTimeRange = _slicedToArray(blockTimeRange, 2), start = _blockTimeRange[0], end = _blockTimeRange[1];
|
|
668
|
+
if (end.isAfter(start)) {
|
|
669
|
+
_context2.next = 7;
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
message.warning(tCal('pisell2.recordBoard.calendar.block.warnEndAfterStart'));
|
|
673
|
+
return _context2.abrupt("return");
|
|
674
|
+
case 7:
|
|
675
|
+
rid = Number(blockResourceId);
|
|
676
|
+
if (!(!Number.isFinite(rid) || rid <= 0)) {
|
|
677
|
+
_context2.next = 11;
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
message.warning(tCal('pisell2.recordBoard.calendar.block.warnSelectResource'));
|
|
681
|
+
return _context2.abrupt("return");
|
|
682
|
+
case 11:
|
|
683
|
+
channels = (_props$blockedTimeSal = props.blockedTimeSalesChannels) !== null && _props$blockedTimeSal !== void 0 ? _props$blockedTimeSal : ['online_store'];
|
|
684
|
+
payload = {
|
|
685
|
+
name: (blockFormName || '').trim() || tCal('pisell2.recordBoard.calendar.block.defaultTitle'),
|
|
686
|
+
note: (blockModalNote || '').trim(),
|
|
687
|
+
resource_ids: [rid],
|
|
688
|
+
blocked_sales_channels: channels,
|
|
689
|
+
start_time: start.format('YYYY-MM-DD HH:mm'),
|
|
690
|
+
end_time: end.format('YYYY-MM-DD HH:mm')
|
|
691
|
+
};
|
|
692
|
+
if (!props.onBlockedTimeSave) {
|
|
693
|
+
_context2.next = 28;
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
setBlockSaving(true);
|
|
697
|
+
_context2.prev = 15;
|
|
698
|
+
_context2.next = 18;
|
|
699
|
+
return props.onBlockedTimeSave(payload);
|
|
700
|
+
case 18:
|
|
701
|
+
ok = _context2.sent;
|
|
702
|
+
if (!(ok === false)) {
|
|
703
|
+
_context2.next = 21;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
return _context2.abrupt("return");
|
|
707
|
+
case 21:
|
|
708
|
+
setShowBlockPanel(false);
|
|
709
|
+
setSelectedFreeSlots([]);
|
|
710
|
+
setBlockModalNote('');
|
|
711
|
+
case 24:
|
|
712
|
+
_context2.prev = 24;
|
|
713
|
+
setBlockSaving(false);
|
|
714
|
+
return _context2.finish(24);
|
|
715
|
+
case 27:
|
|
716
|
+
return _context2.abrupt("return");
|
|
717
|
+
case 28:
|
|
718
|
+
courtId = String(blockResourceId);
|
|
719
|
+
date = start.format('YYYY-MM-DD');
|
|
720
|
+
endDate = end.format('YYYY-MM-DD');
|
|
721
|
+
startHour = start.hour() + start.minute() / 60;
|
|
722
|
+
endHour = end.hour() + end.minute() / 60;
|
|
723
|
+
nextBlock = {
|
|
724
|
+
id: "block-local-".concat(courtId, "-").concat(date, "-").concat(startHour, "-").concat(Date.now()),
|
|
725
|
+
courtId: courtId,
|
|
726
|
+
date: date,
|
|
727
|
+
endDate: endDate !== date ? endDate : undefined,
|
|
728
|
+
startHour: startHour,
|
|
729
|
+
endHour: endHour,
|
|
730
|
+
name: payload.name,
|
|
731
|
+
note: payload.note,
|
|
732
|
+
blockedAt: date,
|
|
733
|
+
kind: 'block'
|
|
734
|
+
};
|
|
735
|
+
if (allowPersist('createBlock')) {
|
|
736
|
+
_context2.next = 36;
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
return _context2.abrupt("return");
|
|
740
|
+
case 36:
|
|
741
|
+
setBookings(function (prev) {
|
|
742
|
+
return [nextBlock].concat(_toConsumableArray(prev));
|
|
743
|
+
});
|
|
744
|
+
setSelectedFreeSlots([]);
|
|
745
|
+
setShowBlockPanel(false);
|
|
746
|
+
setBlockModalNote('');
|
|
747
|
+
case 40:
|
|
748
|
+
case "end":
|
|
749
|
+
return _context2.stop();
|
|
750
|
+
}
|
|
751
|
+
}, _callee2, null, [[15,, 24, 27]]);
|
|
752
|
+
}));
|
|
753
|
+
return _saveBlockedTime.apply(this, arguments);
|
|
754
|
+
}
|
|
755
|
+
function handleDropMove(targetCourtId, targetDate, targetHour) {
|
|
756
|
+
if (!draggingItem) return;
|
|
757
|
+
var duration = draggingItem.endHour - draggingItem.startHour;
|
|
758
|
+
var nextStart = targetHour;
|
|
759
|
+
var nextEnd = targetHour + duration;
|
|
760
|
+
if (!isBusinessHour(nextStart) || nextEnd > endTimelineExclusive) return;
|
|
761
|
+
var targetCourt = targetCourtId !== null && targetCourtId !== void 0 ? targetCourtId : draggingItem.courtId;
|
|
762
|
+
var itemSnapshot = draggingItem;
|
|
763
|
+
var draft = {
|
|
764
|
+
targetCourtId: targetCourt,
|
|
765
|
+
targetDate: targetDate,
|
|
766
|
+
targetHour: targetHour
|
|
767
|
+
};
|
|
768
|
+
setDraggingItem(null);
|
|
769
|
+
if (props.onBookingMoveRequest) {
|
|
770
|
+
void Promise.resolve(props.onBookingMoveRequest({
|
|
771
|
+
item: itemSnapshot,
|
|
772
|
+
draft: draft
|
|
773
|
+
})).catch(function () {});
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
setMoveConfirm({
|
|
777
|
+
item: itemSnapshot,
|
|
778
|
+
targetCourtId: targetCourt,
|
|
779
|
+
targetDate: targetDate,
|
|
780
|
+
targetHour: targetHour
|
|
781
|
+
});
|
|
782
|
+
setMoveDraft(draft);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/** 周/月格 drop:保持原开始小时,仅换日或资源 */
|
|
786
|
+
function handleGridDropMove(targetDate) {
|
|
787
|
+
var targetCourtId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
788
|
+
if (!draggingItem || draggingItem.kind === 'block') return;
|
|
789
|
+
handleDropMove(targetCourtId !== null && targetCourtId !== void 0 ? targetCourtId : draggingItem.courtId, targetDate, draggingItem.startHour);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/** 确认改期:在 bookings 中平移该条的起止小时与 court/date */
|
|
793
|
+
function confirmMove() {
|
|
794
|
+
if (!moveConfirm || !moveDraft) return;
|
|
795
|
+
if (!allowPersist('moveBooking')) return;
|
|
796
|
+
var item = moveConfirm.item;
|
|
797
|
+
var targetCourtId = moveDraft.targetCourtId,
|
|
798
|
+
targetDate = moveDraft.targetDate,
|
|
799
|
+
targetHour = moveDraft.targetHour;
|
|
800
|
+
var duration = item.endHour - item.startHour;
|
|
801
|
+
setBookings(function (prev) {
|
|
802
|
+
return prev.map(function (b) {
|
|
803
|
+
return b.id === item.id ? _objectSpread(_objectSpread({}, b), {}, {
|
|
804
|
+
courtId: targetCourtId,
|
|
805
|
+
date: targetDate,
|
|
806
|
+
startHour: targetHour,
|
|
807
|
+
endHour: targetHour + duration
|
|
808
|
+
}) : b;
|
|
809
|
+
});
|
|
810
|
+
});
|
|
811
|
+
setMoveConfirm(null);
|
|
812
|
+
setMoveDraft(null);
|
|
813
|
+
}
|
|
814
|
+
return /*#__PURE__*/React.createElement(Spin, {
|
|
815
|
+
spinning: Boolean(props.loading),
|
|
816
|
+
wrapperClassName: "pisell-rb-cal-spin-wrap flex min-h-0 flex-1 flex-col"
|
|
817
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
818
|
+
className: "theme-root theme-app flex h-full min-h-0 flex-col p-2 md:p-3 ".concat(isLight ? 'theme-light' : 'theme-dark')
|
|
819
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
820
|
+
className: "theme-shell soft-shadow mx-0 flex h-full min-h-0 w-full max-w-none flex-1 flex-col rounded-[28px] border overflow-hidden transition-[padding-right] duration-200",
|
|
821
|
+
style: {
|
|
822
|
+
paddingRight: 0
|
|
823
|
+
}
|
|
824
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
825
|
+
className: "flex min-h-0 flex-1 flex-col"
|
|
826
|
+
}, view === 'month' && /*#__PURE__*/React.createElement(BookingCalendarMonthView, {
|
|
827
|
+
isLight: isLight,
|
|
828
|
+
anchorDate: anchorDate,
|
|
829
|
+
monthDays: monthDays,
|
|
830
|
+
bookings: bookings,
|
|
831
|
+
goToDayFromCell: goToDayFromCell,
|
|
832
|
+
handleGridDropMove: handleGridDropMove,
|
|
833
|
+
setDraggingItem: setDraggingItem,
|
|
834
|
+
openBookingDetail: openBookingDetail,
|
|
835
|
+
overflowPopover: overflowPopover,
|
|
836
|
+
setOverflowPopover: setOverflowPopover,
|
|
837
|
+
overflowListModal: overflowListModal,
|
|
838
|
+
setOverflowListModal: setOverflowListModal,
|
|
839
|
+
overflowPanelRef: overflowPanelRef,
|
|
840
|
+
renderMonthWeekBooking: props.renderMonthWeekBooking
|
|
841
|
+
}), view === 'week' && /*#__PURE__*/React.createElement(BookingCalendarWeekView, {
|
|
842
|
+
calendarProps: props,
|
|
843
|
+
isLight: isLight,
|
|
844
|
+
weekDays: weekDays,
|
|
845
|
+
bookings: bookings,
|
|
846
|
+
courts: courts,
|
|
847
|
+
hourSlots: hourSlots,
|
|
848
|
+
slotStepHours: slotStepHours,
|
|
849
|
+
visibleCourts: visibleCourts,
|
|
850
|
+
visibleCourtRows: visibleCourtRows,
|
|
851
|
+
isBusinessHour: isBusinessHour,
|
|
852
|
+
goToDayFromCell: goToDayFromCell,
|
|
853
|
+
handleGridDropMove: handleGridDropMove,
|
|
854
|
+
openBookingDetail: openBookingDetail,
|
|
855
|
+
setDraggingItem: setDraggingItem,
|
|
856
|
+
setCollapsedGroups: setCollapsedGroups,
|
|
857
|
+
overflowPopover: overflowPopover,
|
|
858
|
+
setOverflowPopover: setOverflowPopover,
|
|
859
|
+
overflowListModal: overflowListModal,
|
|
860
|
+
setOverflowListModal: setOverflowListModal,
|
|
861
|
+
overflowPanelRef: overflowPanelRef
|
|
862
|
+
}), view === 'day' && /*#__PURE__*/React.createElement(BookingCalendarDayView, {
|
|
863
|
+
calendarProps: props,
|
|
864
|
+
isLight: isLight,
|
|
865
|
+
view: view,
|
|
866
|
+
anchorDate: anchorDate,
|
|
867
|
+
dayKey: dayKey,
|
|
868
|
+
hourSlots: hourSlots,
|
|
869
|
+
resolvedSlotMinutes: resolvedSlotMinutes,
|
|
870
|
+
slotColWidth: slotColWidth,
|
|
871
|
+
firstTimelineHour: firstTimelineHour,
|
|
872
|
+
endTimelineExclusive: endTimelineExclusive,
|
|
873
|
+
isBusinessHour: isBusinessHour,
|
|
874
|
+
dayHourRemaining: dayHourRemaining,
|
|
875
|
+
timelinePxPerHour: timelinePxPerHour,
|
|
876
|
+
dayContentHeight: dayContentHeight,
|
|
877
|
+
dayRowHeights: dayRowHeights,
|
|
878
|
+
visibleCourtRows: visibleCourtRows,
|
|
879
|
+
overlayBookings: overlayBookings,
|
|
880
|
+
dayOverlayOverflowPluses: dayOverlayOverflowPluses,
|
|
881
|
+
setCollapsedGroups: setCollapsedGroups,
|
|
882
|
+
visibleCourts: visibleCourts,
|
|
883
|
+
bookings: bookings,
|
|
884
|
+
slotStepHours: slotStepHours,
|
|
885
|
+
isFreeSelected: isFreeSelected,
|
|
886
|
+
isBlockSelected: isBlockSelected,
|
|
887
|
+
toggleSlot: toggleSlot,
|
|
888
|
+
handleDropMove: handleDropMove,
|
|
889
|
+
hiddenDayOverlayIdSet: hiddenDayOverlayIdSet,
|
|
890
|
+
courtDayDisplayLaneCount: courtDayDisplayLaneCount,
|
|
891
|
+
openBookingDetail: openBookingDetail,
|
|
892
|
+
setDraggingItem: setDraggingItem,
|
|
893
|
+
setNavDirection: setNavDirection,
|
|
894
|
+
commitAnchor: commitAnchor,
|
|
895
|
+
setFocusedCourtId: setFocusedCourtId,
|
|
896
|
+
setOverflowListModal: setOverflowListModal,
|
|
897
|
+
selectedFreeSlots: selectedFreeSlots,
|
|
898
|
+
selectedBlockSlots: selectedBlockSlots,
|
|
899
|
+
deselectAll: deselectAll,
|
|
900
|
+
openSelectedBlocks: openSelectedBlocks,
|
|
901
|
+
onOpenBlockPanel: handleOpenBlockPanelFromSelection,
|
|
902
|
+
createBookingFromSelection: createBookingFromSelection,
|
|
903
|
+
focusedCourtId: focusedCourtId,
|
|
904
|
+
dayRowRemainingByCourt: dayRowRemainingByCourt
|
|
905
|
+
}))), showBlockPanel && !props.onBlockedTimePanelRequest && selectedFreeSlots.length > 0 && isFreeSelectionContiguousSameResource(selectedFreeSlots, slotStepHours) && /*#__PURE__*/React.createElement("div", {
|
|
906
|
+
className: "fixed inset-0 z-50 bg-black/55 backdrop-blur-sm flex items-end md:items-center justify-center p-2 md:p-4"
|
|
907
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
908
|
+
ref: blockPanelRef,
|
|
909
|
+
className: "w-full max-w-[720px] max-h-[92vh] overflow-y-auto rounded-t-3xl md:rounded-3xl border p-4 md:p-6 shadow-2xl ".concat(isLight ? 'theme-panel theme-border soft-shadow' : 'border-zinc-700 bg-[#121217]')
|
|
910
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
911
|
+
className: "mb-4 flex items-center justify-between gap-3"
|
|
912
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
913
|
+
className: "text-xl font-semibold"
|
|
914
|
+
}, tCal('pisell2.recordBoard.calendar.block.panelTitle')), /*#__PURE__*/React.createElement("button", {
|
|
915
|
+
type: "button",
|
|
916
|
+
"aria-label": tCal('pisell2.recordBoard.calendar.block.closeAria'),
|
|
917
|
+
onClick: function onClick() {
|
|
918
|
+
return setShowBlockPanel(false);
|
|
919
|
+
},
|
|
920
|
+
className: "rounded-xl p-2 ".concat(isLight ? 'btn-neutral' : 'border border-zinc-700 text-zinc-300 hover:bg-zinc-800')
|
|
921
|
+
}, /*#__PURE__*/React.createElement(CloseOutlined, {
|
|
922
|
+
style: {
|
|
923
|
+
fontSize: 20
|
|
924
|
+
}
|
|
925
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
926
|
+
className: "space-y-4 rounded-2xl border p-4 ".concat(isLight ? 'theme-panel-alt theme-border' : 'border-zinc-700 bg-[#171820]')
|
|
927
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
928
|
+
className: "mb-2 block text-sm ".concat(isLight ? 'theme-text-muted' : 'text-zinc-400')
|
|
929
|
+
}, tCal('pisell2.recordBoard.calendar.block.fieldTitle')), /*#__PURE__*/React.createElement("input", {
|
|
930
|
+
value: blockFormName,
|
|
931
|
+
onChange: function onChange(e) {
|
|
932
|
+
return setBlockFormName(e.target.value);
|
|
933
|
+
},
|
|
934
|
+
placeholder: tCal('pisell2.recordBoard.calendar.block.placeholderTitle'),
|
|
935
|
+
className: "w-full rounded-xl px-3 py-2 outline-none ".concat(isLight ? 'theme-input theme-text' : 'border border-zinc-700 bg-[#111218] text-white')
|
|
936
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
937
|
+
className: "mb-2 block text-sm ".concat(isLight ? 'theme-text-muted' : 'text-zinc-400')
|
|
938
|
+
}, "\u5907\u6CE8"), /*#__PURE__*/React.createElement("input", {
|
|
939
|
+
value: blockModalNote,
|
|
940
|
+
onChange: function onChange(e) {
|
|
941
|
+
return setBlockModalNote(e.target.value);
|
|
942
|
+
},
|
|
943
|
+
placeholder: "\u9009\u586B",
|
|
944
|
+
className: "w-full rounded-xl px-3 py-2 outline-none ".concat(isLight ? 'theme-input theme-text' : 'border border-zinc-700 bg-[#111218] text-white')
|
|
945
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
946
|
+
className: "mb-2 block text-sm ".concat(isLight ? 'theme-text-muted' : 'text-zinc-400')
|
|
947
|
+
}, tCal('pisell2.recordBoard.calendar.block.fieldResource')), /*#__PURE__*/React.createElement("select", {
|
|
948
|
+
value: blockResourceId,
|
|
949
|
+
onChange: function onChange(e) {
|
|
950
|
+
return setBlockResourceId(e.target.value);
|
|
951
|
+
},
|
|
952
|
+
className: "w-full rounded-xl px-3 py-2 outline-none ".concat(isLight ? 'theme-input theme-text' : 'border border-zinc-700 bg-[#111218] text-white')
|
|
953
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
954
|
+
value: ""
|
|
955
|
+
}, tCal('pisell2.recordBoard.calendar.block.noResource')), visibleCourts.map(function (c) {
|
|
956
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
957
|
+
key: c.id,
|
|
958
|
+
value: String(c.id)
|
|
959
|
+
}, c.name);
|
|
960
|
+
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
961
|
+
className: "mb-2 block text-sm ".concat(isLight ? 'theme-text-muted' : 'text-zinc-400')
|
|
962
|
+
}, tCal('pisell2.recordBoard.calendar.block.fieldTimeRange')), /*#__PURE__*/React.createElement(RangePicker, {
|
|
963
|
+
style: {
|
|
964
|
+
width: '100%'
|
|
965
|
+
},
|
|
966
|
+
showTime: {
|
|
967
|
+
format: 'HH:mm',
|
|
968
|
+
minuteStep: resolvedSlotMinutes >= 60 ? 60 : Math.max(1, resolvedSlotMinutes)
|
|
969
|
+
},
|
|
970
|
+
format: 'YYYY-MM-DD HH:mm',
|
|
971
|
+
value: blockTimeRange !== null && blockTimeRange !== void 0 ? blockTimeRange : undefined,
|
|
972
|
+
onChange: function onChange(v) {
|
|
973
|
+
var _ref2;
|
|
974
|
+
return setBlockTimeRange((_ref2 = v) !== null && _ref2 !== void 0 ? _ref2 : null);
|
|
975
|
+
}
|
|
976
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
977
|
+
className: "mt-6 flex flex-col-reverse sm:flex-row items-stretch sm:items-center justify-end gap-3"
|
|
978
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
979
|
+
type: "button",
|
|
980
|
+
disabled: blockSaving,
|
|
981
|
+
onClick: function onClick() {
|
|
982
|
+
return setShowBlockPanel(false);
|
|
983
|
+
},
|
|
984
|
+
className: "rounded-xl px-4 py-2 ".concat(isLight ? 'btn-neutral' : 'border border-zinc-700 text-zinc-300 hover:bg-zinc-800')
|
|
985
|
+
}, tCal('pisell2.recordBoard.calendar.common.cancel')), /*#__PURE__*/React.createElement("button", {
|
|
986
|
+
type: "button",
|
|
987
|
+
disabled: blockSaving,
|
|
988
|
+
onClick: function onClick() {
|
|
989
|
+
return void saveBlockedTime();
|
|
990
|
+
},
|
|
991
|
+
className: "rounded-xl px-5 py-3 text-sm font-semibold disabled:opacity-50 ".concat(isLight ? 'btn-brand' : 'bg-violet-600 text-white hover:bg-violet-500')
|
|
992
|
+
}, blockSaving ? tCal('pisell2.recordBoard.calendar.common.saving') : tCal('pisell2.recordBoard.calendar.common.save'))))), overflowListModal && /*#__PURE__*/React.createElement("div", {
|
|
993
|
+
className: "fixed inset-0 z-[69] bg-black/45 backdrop-blur-sm flex items-center justify-center p-4"
|
|
994
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
995
|
+
ref: overflowPanelRef,
|
|
996
|
+
className: "flex w-full max-w-[520px] max-h-[72vh] flex-col overflow-hidden rounded-3xl border p-5 shadow-2xl ".concat(isLight ? 'theme-panel theme-border soft-shadow' : 'border-zinc-700 bg-[#121217]')
|
|
997
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
998
|
+
className: "mb-4 flex shrink-0 items-start justify-between"
|
|
999
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
1000
|
+
className: "text-xl font-semibold"
|
|
1001
|
+
}, tCal('pisell2.recordBoard.calendar.overflow.bookingsForDay')), /*#__PURE__*/React.createElement("div", {
|
|
1002
|
+
className: "mt-1 text-sm text-zinc-400"
|
|
1003
|
+
}, overflowListModal.title)), /*#__PURE__*/React.createElement("button", {
|
|
1004
|
+
onClick: function onClick() {
|
|
1005
|
+
return setOverflowListModal(null);
|
|
1006
|
+
},
|
|
1007
|
+
className: "rounded-xl border border-zinc-700 px-3 py-2 text-zinc-300 hover:bg-zinc-800"
|
|
1008
|
+
}, tCal('pisell2.recordBoard.calendar.common.close'))), /*#__PURE__*/React.createElement("div", {
|
|
1009
|
+
className: "min-h-0 flex-1 overflow-hidden px-0.5"
|
|
1010
|
+
}, /*#__PURE__*/React.createElement(OverflowListModalVirtualList, {
|
|
1011
|
+
items: overflowListModal.items,
|
|
1012
|
+
dateKey: overflowListModal.date,
|
|
1013
|
+
listWidth: 468,
|
|
1014
|
+
onPickItem: openBookingDetail,
|
|
1015
|
+
onClose: function onClose() {
|
|
1016
|
+
return setOverflowListModal(null);
|
|
1017
|
+
},
|
|
1018
|
+
showStatusUi: Boolean(overflowListModal.scope && String(overflowListModal.scope).startsWith('day-lane-overflow-'))
|
|
1019
|
+
})))), moveConfirm && /*#__PURE__*/React.createElement(MoveConfirmModal, {
|
|
1020
|
+
moveConfirm: moveConfirm,
|
|
1021
|
+
moveDraft: moveDraft,
|
|
1022
|
+
setMoveDraft: setMoveDraft,
|
|
1023
|
+
panelRef: moveConfirmRef,
|
|
1024
|
+
isLight: isLight,
|
|
1025
|
+
courts: courts,
|
|
1026
|
+
visibleCourts: visibleCourts,
|
|
1027
|
+
hourSlots: hourSlots,
|
|
1028
|
+
isBusinessHour: isBusinessHour,
|
|
1029
|
+
firstTimelineHour: firstTimelineHour,
|
|
1030
|
+
endTimelineExclusive: endTimelineExclusive,
|
|
1031
|
+
onConfirm: confirmMove,
|
|
1032
|
+
onClose: function onClose() {
|
|
1033
|
+
setMoveConfirm(null);
|
|
1034
|
+
setMoveDraft(null);
|
|
1035
|
+
}
|
|
1036
|
+
}), transitioningToDay && /*#__PURE__*/React.createElement("div", {
|
|
1037
|
+
className: "fixed inset-6 z-[60] rounded-[28px] border border-violet-400/20 bg-[#151220] pointer-events-none"
|
|
1038
|
+
})));
|
|
1039
|
+
}
|