@sunggang/ui-lib 0.4.2 → 0.4.4

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.
@@ -22,6 +22,9 @@ require('./_tslib.cjs.js');
22
22
  require('./Modal.cjs.js');
23
23
  require('@radix-ui/react-select');
24
24
  require('@radix-ui/react-icons');
25
+ require('flatpickr');
26
+ require('flatpickr/dist/l10n/zh-tw.js');
27
+ require('flatpickr/dist/flatpickr.min.css');
25
28
 
26
29
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
30
 
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import React__default from 'react';
3
3
  import { p as propTypes } from './index.esm2.js';
4
- import { b as getAugmentedNamespace, c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers.esm.js';
4
+ import { g as getAugmentedNamespace, c as commonjsGlobal, b as getDefaultExportFromCjs } from './_commonjsHelpers.esm.js';
5
5
  import { a as useFormContext, C as Controller } from './index.esm.esm.js';
6
6
  import { F as FieldLabel, v as validateMsg } from './baseSwitch.esm.js';
7
7
  import '@radix-ui/react-switch';
@@ -20,6 +20,9 @@ import './_tslib.esm.js';
20
20
  import './Modal.esm.js';
21
21
  import '@radix-ui/react-select';
22
22
  import '@radix-ui/react-icons';
23
+ import 'flatpickr';
24
+ import 'flatpickr/dist/l10n/zh-tw.js';
25
+ import 'flatpickr/dist/flatpickr.min.css';
23
26
 
24
27
  var dist = {
25
28
  exports: {}
@@ -7910,16 +7910,16 @@ var utc = {
7910
7910
  utc: !1
7911
7911
  });
7912
7912
  };
7913
- var o = u.parse;
7913
+ var r = u.parse;
7914
7914
  u.parse = function(t) {
7915
- t.utc && (this.$u = !0), this.$utils().u(t.$offset) || (this.$offset = t.$offset), o.call(this, t);
7915
+ t.utc && (this.$u = !0), this.$utils().u(t.$offset) || (this.$offset = t.$offset), r.call(this, t);
7916
7916
  };
7917
- var r = u.init;
7917
+ var o = u.init;
7918
7918
  u.init = function() {
7919
7919
  if (this.$u) {
7920
7920
  var t = this.$d;
7921
7921
  this.$y = t.getUTCFullYear(), this.$M = t.getUTCMonth(), this.$D = t.getUTCDate(), this.$W = t.getUTCDay(), this.$H = t.getUTCHours(), this.$m = t.getUTCMinutes(), this.$s = t.getUTCSeconds(), this.$ms = t.getUTCMilliseconds();
7922
- } else r.call(this);
7922
+ } else o.call(this);
7923
7923
  };
7924
7924
  var a = u.utcOffset;
7925
7925
  u.utcOffset = function(s, f) {
@@ -7936,13 +7936,12 @@ var utc = {
7936
7936
  ], _$n = _$f[0], u = 60 * +_$f[1] + +_$f[2];
7937
7937
  return 0 === u ? 0 : "+" === _$n ? u : -u;
7938
7938
  }(s), null === s)) return this;
7939
- var u = Math.abs(s) <= 16 ? 60 * s : s, o = this;
7940
- if (f) return o.$offset = u, o.$u = 0 === s, o;
7941
- if (0 !== s) {
7942
- var r = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
7943
- (o = this.local().add(u + r, t)).$offset = u, o.$x.$localOffset = r;
7944
- } else o = this.utc();
7945
- return o;
7939
+ var u = Math.abs(s) <= 16 ? 60 * s : s;
7940
+ if (0 === u) return this.utc(f);
7941
+ var r = this.clone();
7942
+ if (f) return r.$offset = u, r.$u = !1, r;
7943
+ var o = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
7944
+ return (r = this.local().add(u + o, t)).$offset = u, r.$x.$localOffset = o, r;
7946
7945
  };
7947
7946
  var h = u.format;
7948
7947
  u.format = function(t) {
@@ -7972,6 +7971,22 @@ var utc = {
7972
7971
  });
7973
7972
  }(utc));
7974
7973
 
7974
+ var isLeapYear = {
7975
+ exports: {}
7976
+ };
7977
+
7978
+ (function (module, exports) {
7979
+ !function(e, t) {
7980
+ module.exports = t() ;
7981
+ }(_commonjsHelpers.commonjsGlobal, function() {
7982
+ return function(e, t) {
7983
+ t.prototype.isLeapYear = function() {
7984
+ return this.$y % 4 == 0 && this.$y % 100 != 0 || this.$y % 400 == 0;
7985
+ };
7986
+ };
7987
+ });
7988
+ }(isLeapYear));
7989
+
7975
7990
  function NoopWrapper(props) {
7976
7991
  return props.children;
7977
7992
  }
@@ -9450,6 +9465,7 @@ function sortEvents$2(eventA, eventB, accessors, localizer) {
9450
9465
  evtB: evtB
9451
9466
  });
9452
9467
  }
9468
+ // Modified: Check if a segment spans through this slot (including events that started earlier)
9453
9469
  var isSegmentInSlot$1 = function isSegmentInSlot(seg, slot) {
9454
9470
  return seg.left <= slot && seg.right >= slot;
9455
9471
  };
@@ -9475,10 +9491,23 @@ var EventEndingRow = /*#__PURE__*/ function(_React$Component) {
9475
9491
  var current = 1, lastEnd = 1, row = [];
9476
9492
  while(current <= slots){
9477
9493
  var key = "_lvl_" + current;
9494
+ // Find segment that starts at or spans through current slot
9478
9495
  var _ref = rowSegments.filter(function(seg) {
9479
9496
  return isSegmentInSlot$1(seg, current);
9480
- })[0] || {}, event = _ref.event, left = _ref.left, right = _ref.right, span = _ref.span; //eslint-disable-line
9497
+ })[0] || {}, event = _ref.event, left = _ref.left, right = _ref.right, span = _ref.span;
9481
9498
  if (!event) {
9499
+ // No visible event starts at this slot, but check if we need a "more" button
9500
+ // for hidden events that span this slot
9501
+ var hiddenEvents = this.getHiddenEventsForSlot(segments, current);
9502
+ if (hiddenEvents.length > 0) {
9503
+ var _gap = current - lastEnd;
9504
+ if (_gap) {
9505
+ row.push(EventRowMixin$1.renderSpan(slots, _gap, key + "_gap"));
9506
+ }
9507
+ row.push(EventRowMixin$1.renderSpan(slots, 1, key, this.renderShowMore(segments, current)));
9508
+ lastEnd = current = current + 1;
9509
+ continue;
9510
+ }
9482
9511
  current++;
9483
9512
  continue;
9484
9513
  }
@@ -9503,6 +9532,26 @@ var EventEndingRow = /*#__PURE__*/ function(_React$Component) {
9503
9532
  }, row);
9504
9533
  }
9505
9534
  },
9535
+ {
9536
+ key: "getHiddenEventsForSlot",
9537
+ value: function getHiddenEventsForSlot(segments, slot) {
9538
+ // Get all events (visible and hidden) for this slot
9539
+ var allEventsInSlot = eventsInSlot(segments, slot);
9540
+ // Get visible events for this slot from the first level
9541
+ var rowSegments = eventLevels$2(segments).levels[0];
9542
+ var visibleEventsInSlot = rowSegments.filter(function(seg) {
9543
+ return isSegmentInSlot$1(seg, slot);
9544
+ }).map(function(seg) {
9545
+ return seg.event;
9546
+ });
9547
+ // Return events that are in allEventsInSlot but not in visibleEventsInSlot
9548
+ return allEventsInSlot.filter(function(event) {
9549
+ return !visibleEventsInSlot.some(function(visEvent) {
9550
+ return visEvent === event;
9551
+ });
9552
+ });
9553
+ }
9554
+ },
9506
9555
  {
9507
9556
  key: "canRenderSlotEvent",
9508
9557
  value: function canRenderSlotEvent(slot, span) {
@@ -9835,7 +9884,7 @@ var MonthView = /*#__PURE__*/ function(_React$Component) {
9835
9884
  _this.readerDateHeading = function(_ref) {
9836
9885
  var date = _ref.date, className = _ref.className, props = memoizeOne_esm._objectWithoutProperties(_ref, _excluded$6);
9837
9886
  var _this$props2 = _this.props, currentDate = _this$props2.date, getDrilldownView = _this$props2.getDrilldownView, localizer = _this$props2.localizer;
9838
- var isOffRange = localizer.neq(date, currentDate, "month");
9887
+ var isOffRange = localizer.neq(currentDate, date, "month");
9839
9888
  var isCurrent = localizer.isSameDate(date, currentDate);
9840
9889
  var drilldownView = getDrilldownView(date);
9841
9890
  var label = localizer.format(date, "dateFormat");
@@ -10603,7 +10652,8 @@ var DayColumnWrapper$1 = /*#__PURE__*/ React__default["default"].forwardRef(func
10603
10652
  var _excluded$5 = [
10604
10653
  "dayProp"
10605
10654
  ], _excluded2$1 = [
10606
- "eventContainerWrapper"
10655
+ "eventContainerWrapper",
10656
+ "timeIndicatorWrapper"
10607
10657
  ];
10608
10658
  var DayColumn = /*#__PURE__*/ function(_React$Component) {
10609
10659
  function DayColumn() {
@@ -10888,7 +10938,7 @@ var DayColumn = /*#__PURE__*/ function(_React$Component) {
10888
10938
  {
10889
10939
  key: "render",
10890
10940
  value: function render() {
10891
- var _this$props5 = this.props, date = _this$props5.date, max = _this$props5.max, rtl = _this$props5.rtl, isNow = _this$props5.isNow, resource = _this$props5.resource, accessors = _this$props5.accessors, localizer = _this$props5.localizer, _this$props5$getters = _this$props5.getters, dayProp = _this$props5$getters.dayProp, getters = memoizeOne_esm._objectWithoutProperties(_this$props5$getters, _excluded$5), _this$props5$componen = _this$props5.components, EventContainer = _this$props5$componen.eventContainerWrapper, components = memoizeOne_esm._objectWithoutProperties(_this$props5$componen, _excluded2$1);
10941
+ var _this$props5 = this.props, date = _this$props5.date, max = _this$props5.max, rtl = _this$props5.rtl, isNow = _this$props5.isNow, resource = _this$props5.resource, accessors = _this$props5.accessors, localizer = _this$props5.localizer, _this$props5$getters = _this$props5.getters, dayProp = _this$props5$getters.dayProp, getters = memoizeOne_esm._objectWithoutProperties(_this$props5$getters, _excluded$5), _this$props5$componen = _this$props5.components, EventContainer = _this$props5$componen.eventContainerWrapper, TimeIndicatorWrapper = _this$props5$componen.timeIndicatorWrapper, components = memoizeOne_esm._objectWithoutProperties(_this$props5$componen, _excluded2$1);
10892
10942
  this.slotMetrics = this.slotMetrics.update(this.props);
10893
10943
  var slotMetrics = this.slotMetrics;
10894
10944
  var _this$state = this.state, selecting = _this$state.selecting, top = _this$state.top, height = _this$state.height, startDate = _this$state.startDate, endDate = _this$state.endDate;
@@ -10897,6 +10947,12 @@ var DayColumn = /*#__PURE__*/ function(_React$Component) {
10897
10947
  end: endDate
10898
10948
  };
10899
10949
  var _dayProp = dayProp(max, resource), className = _dayProp.className, style = _dayProp.style;
10950
+ var timeIndicatorProps = {
10951
+ className: "rbc-current-time-indicator",
10952
+ style: {
10953
+ top: "".concat(this.state.timeIndicatorPosition, "%")
10954
+ }
10955
+ };
10900
10956
  var DayColumnWrapperComponent = components.dayColumnWrapper || DayColumnWrapper$1;
10901
10957
  return /*#__PURE__*/ React__default["default"].createElement(DayColumnWrapperComponent, {
10902
10958
  ref: this.containerRef,
@@ -10934,12 +10990,7 @@ var DayColumn = /*#__PURE__*/ function(_React$Component) {
10934
10990
  top: top,
10935
10991
  height: height
10936
10992
  }
10937
- }, /*#__PURE__*/ React__default["default"].createElement("span", null, localizer.format(selectDates, "selectRangeFormat"))), isNow && this.intervalTriggered && /*#__PURE__*/ React__default["default"].createElement("div", {
10938
- className: "rbc-current-time-indicator",
10939
- style: {
10940
- top: "".concat(this.state.timeIndicatorPosition, "%")
10941
- }
10942
- }));
10993
+ }, /*#__PURE__*/ React__default["default"].createElement("span", null, localizer.format(selectDates, "selectRangeFormat"))), isNow && this.intervalTriggered && /*#__PURE__*/ React__default["default"].createElement(TimeIndicatorWrapper, timeIndicatorProps, /*#__PURE__*/ React__default["default"].createElement("div", timeIndicatorProps)));
10943
10994
  }
10944
10995
  }
10945
10996
  ]);
@@ -12371,7 +12422,8 @@ var Calendar = /*#__PURE__*/ function(_React$Component) {
12371
12422
  dateCellWrapper: NoopWrapper,
12372
12423
  weekWrapper: NoopWrapper,
12373
12424
  timeSlotWrapper: NoopWrapper,
12374
- timeGutterWrapper: NoopWrapper
12425
+ timeGutterWrapper: NoopWrapper,
12426
+ timeIndicatorWrapper: NoopWrapper
12375
12427
  }),
12376
12428
  accessors: {
12377
12429
  start: wrapAccessor(startAccessor),
@@ -18426,7 +18478,7 @@ var esm = /*#__PURE__*/Object.freeze({
18426
18478
  'default': index
18427
18479
  });
18428
18480
 
18429
- var require$$9 = /*@__PURE__*/ _commonjsHelpers.getAugmentedNamespace(esm);
18481
+ var require$$7 = /*@__PURE__*/ _commonjsHelpers.getAugmentedNamespace(esm);
18430
18482
 
18431
18483
  var querySelectorAll = {
18432
18484
  exports: {}
@@ -18995,11 +19047,10 @@ function nest() {
18995
19047
  for(var _len = arguments.length, Components = new Array(_len), _key = 0; _key < _len; _key++){
18996
19048
  Components[_key] = arguments[_key];
18997
19049
  }
18998
- var factories = Components.filter(Boolean).map(_react$6.createFactory);
18999
19050
  var Nest = function Nest(_ref) {
19000
19051
  var children = _ref.children, props = (0, _objectWithoutProperties2$2.default)(_ref, _excluded$2);
19001
- return factories.reduceRight(function(child, factory) {
19002
- return factory(props, child);
19052
+ return Components.filter(Boolean).reduceRight(function(child, Component) {
19053
+ return /*#__PURE__*/ (0, _react$6.createElement)(Component, props, child);
19003
19054
  }, children);
19004
19055
  };
19005
19056
  return Nest;
@@ -19044,10 +19095,10 @@ var _classCallCheck2$4 = _interopRequireDefault$8(classCallCheck.exports);
19044
19095
  var _createClass2$4 = _interopRequireDefault$8(createClass.exports);
19045
19096
  var _callSuper2$4 = _interopRequireDefault$8(callSuper.exports);
19046
19097
  var _inherits2$4 = _interopRequireDefault$8(inherits.exports);
19098
+ var _domHelpers = require$$7;
19099
+ var _querySelectorAll = _interopRequireDefault$8(querySelectorAll.exports);
19047
19100
  var _react$5 = _interopRequireDefault$8(React__default["default"]);
19048
19101
  var _DnDContext$2 = DnDContext;
19049
- var _domHelpers = require$$9;
19050
- var _querySelectorAll = _interopRequireDefault$8(querySelectorAll.exports);
19051
19102
  var _Selection$1 = _interopRequireWildcard$1(Selection$1);
19052
19103
  var _TimeGridEvent = _interopRequireDefault$8(TimeGridEvent$1);
19053
19104
  var _common$2 = common;
@@ -19084,6 +19135,8 @@ var EventContainerWrapper = /*#__PURE__*/ function(_React$Component) {
19084
19135
  allDay: false,
19085
19136
  resource: resource
19086
19137
  });
19138
+ // Cleanup after dropping from outside
19139
+ _this.reset();
19087
19140
  };
19088
19141
  _this.handleDragOverFromOutside = function(point, bounds) {
19089
19142
  var slotMetrics = _this.props.slotMetrics;
@@ -5,7 +5,7 @@ import { c as _getPrototypeOf, d as _possibleConstructorReturn, b as _isNativeRe
5
5
  import clsx from 'clsx';
6
6
  import { _ as _inheritsLoose } from './inheritsLoose.esm.js';
7
7
  import { P as PropTypes, p as propTypes$1 } from './index.esm2.js';
8
- import { c as commonjsGlobal, a as commonjsRequire, b as getAugmentedNamespace } from './_commonjsHelpers.esm.js';
8
+ import { c as commonjsGlobal, a as commonjsRequire, g as getAugmentedNamespace } from './_commonjsHelpers.esm.js';
9
9
  import ReactDOM from 'react-dom';
10
10
 
11
11
  function _callSuper(t, o, e) {
@@ -7900,16 +7900,16 @@ var utc = {
7900
7900
  utc: !1
7901
7901
  });
7902
7902
  };
7903
- var o = u.parse;
7903
+ var r = u.parse;
7904
7904
  u.parse = function(t) {
7905
- t.utc && (this.$u = !0), this.$utils().u(t.$offset) || (this.$offset = t.$offset), o.call(this, t);
7905
+ t.utc && (this.$u = !0), this.$utils().u(t.$offset) || (this.$offset = t.$offset), r.call(this, t);
7906
7906
  };
7907
- var r = u.init;
7907
+ var o = u.init;
7908
7908
  u.init = function() {
7909
7909
  if (this.$u) {
7910
7910
  var t = this.$d;
7911
7911
  this.$y = t.getUTCFullYear(), this.$M = t.getUTCMonth(), this.$D = t.getUTCDate(), this.$W = t.getUTCDay(), this.$H = t.getUTCHours(), this.$m = t.getUTCMinutes(), this.$s = t.getUTCSeconds(), this.$ms = t.getUTCMilliseconds();
7912
- } else r.call(this);
7912
+ } else o.call(this);
7913
7913
  };
7914
7914
  var a = u.utcOffset;
7915
7915
  u.utcOffset = function(s, f) {
@@ -7926,13 +7926,12 @@ var utc = {
7926
7926
  ], _$n = _$f[0], u = 60 * +_$f[1] + +_$f[2];
7927
7927
  return 0 === u ? 0 : "+" === _$n ? u : -u;
7928
7928
  }(s), null === s)) return this;
7929
- var u = Math.abs(s) <= 16 ? 60 * s : s, o = this;
7930
- if (f) return o.$offset = u, o.$u = 0 === s, o;
7931
- if (0 !== s) {
7932
- var r = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
7933
- (o = this.local().add(u + r, t)).$offset = u, o.$x.$localOffset = r;
7934
- } else o = this.utc();
7935
- return o;
7929
+ var u = Math.abs(s) <= 16 ? 60 * s : s;
7930
+ if (0 === u) return this.utc(f);
7931
+ var r = this.clone();
7932
+ if (f) return r.$offset = u, r.$u = !1, r;
7933
+ var o = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
7934
+ return (r = this.local().add(u + o, t)).$offset = u, r.$x.$localOffset = o, r;
7936
7935
  };
7937
7936
  var h = u.format;
7938
7937
  u.format = function(t) {
@@ -7962,6 +7961,22 @@ var utc = {
7962
7961
  });
7963
7962
  }(utc));
7964
7963
 
7964
+ var isLeapYear = {
7965
+ exports: {}
7966
+ };
7967
+
7968
+ (function (module, exports) {
7969
+ !function(e, t) {
7970
+ module.exports = t() ;
7971
+ }(commonjsGlobal, function() {
7972
+ return function(e, t) {
7973
+ t.prototype.isLeapYear = function() {
7974
+ return this.$y % 4 == 0 && this.$y % 100 != 0 || this.$y % 400 == 0;
7975
+ };
7976
+ };
7977
+ });
7978
+ }(isLeapYear));
7979
+
7965
7980
  function NoopWrapper(props) {
7966
7981
  return props.children;
7967
7982
  }
@@ -9440,6 +9455,7 @@ function sortEvents$2(eventA, eventB, accessors, localizer) {
9440
9455
  evtB: evtB
9441
9456
  });
9442
9457
  }
9458
+ // Modified: Check if a segment spans through this slot (including events that started earlier)
9443
9459
  var isSegmentInSlot$1 = function isSegmentInSlot(seg, slot) {
9444
9460
  return seg.left <= slot && seg.right >= slot;
9445
9461
  };
@@ -9465,10 +9481,23 @@ var EventEndingRow = /*#__PURE__*/ function(_React$Component) {
9465
9481
  var current = 1, lastEnd = 1, row = [];
9466
9482
  while(current <= slots){
9467
9483
  var key = "_lvl_" + current;
9484
+ // Find segment that starts at or spans through current slot
9468
9485
  var _ref = rowSegments.filter(function(seg) {
9469
9486
  return isSegmentInSlot$1(seg, current);
9470
- })[0] || {}, event = _ref.event, left = _ref.left, right = _ref.right, span = _ref.span; //eslint-disable-line
9487
+ })[0] || {}, event = _ref.event, left = _ref.left, right = _ref.right, span = _ref.span;
9471
9488
  if (!event) {
9489
+ // No visible event starts at this slot, but check if we need a "more" button
9490
+ // for hidden events that span this slot
9491
+ var hiddenEvents = this.getHiddenEventsForSlot(segments, current);
9492
+ if (hiddenEvents.length > 0) {
9493
+ var _gap = current - lastEnd;
9494
+ if (_gap) {
9495
+ row.push(EventRowMixin$1.renderSpan(slots, _gap, key + "_gap"));
9496
+ }
9497
+ row.push(EventRowMixin$1.renderSpan(slots, 1, key, this.renderShowMore(segments, current)));
9498
+ lastEnd = current = current + 1;
9499
+ continue;
9500
+ }
9472
9501
  current++;
9473
9502
  continue;
9474
9503
  }
@@ -9493,6 +9522,26 @@ var EventEndingRow = /*#__PURE__*/ function(_React$Component) {
9493
9522
  }, row);
9494
9523
  }
9495
9524
  },
9525
+ {
9526
+ key: "getHiddenEventsForSlot",
9527
+ value: function getHiddenEventsForSlot(segments, slot) {
9528
+ // Get all events (visible and hidden) for this slot
9529
+ var allEventsInSlot = eventsInSlot(segments, slot);
9530
+ // Get visible events for this slot from the first level
9531
+ var rowSegments = eventLevels$2(segments).levels[0];
9532
+ var visibleEventsInSlot = rowSegments.filter(function(seg) {
9533
+ return isSegmentInSlot$1(seg, slot);
9534
+ }).map(function(seg) {
9535
+ return seg.event;
9536
+ });
9537
+ // Return events that are in allEventsInSlot but not in visibleEventsInSlot
9538
+ return allEventsInSlot.filter(function(event) {
9539
+ return !visibleEventsInSlot.some(function(visEvent) {
9540
+ return visEvent === event;
9541
+ });
9542
+ });
9543
+ }
9544
+ },
9496
9545
  {
9497
9546
  key: "canRenderSlotEvent",
9498
9547
  value: function canRenderSlotEvent(slot, span) {
@@ -9825,7 +9874,7 @@ var MonthView = /*#__PURE__*/ function(_React$Component) {
9825
9874
  _this.readerDateHeading = function(_ref) {
9826
9875
  var date = _ref.date, className = _ref.className, props = _objectWithoutProperties(_ref, _excluded$6);
9827
9876
  var _this$props2 = _this.props, currentDate = _this$props2.date, getDrilldownView = _this$props2.getDrilldownView, localizer = _this$props2.localizer;
9828
- var isOffRange = localizer.neq(date, currentDate, "month");
9877
+ var isOffRange = localizer.neq(currentDate, date, "month");
9829
9878
  var isCurrent = localizer.isSameDate(date, currentDate);
9830
9879
  var drilldownView = getDrilldownView(date);
9831
9880
  var label = localizer.format(date, "dateFormat");
@@ -10593,7 +10642,8 @@ var DayColumnWrapper$1 = /*#__PURE__*/ React__default.forwardRef(function(props,
10593
10642
  var _excluded$5 = [
10594
10643
  "dayProp"
10595
10644
  ], _excluded2$1 = [
10596
- "eventContainerWrapper"
10645
+ "eventContainerWrapper",
10646
+ "timeIndicatorWrapper"
10597
10647
  ];
10598
10648
  var DayColumn = /*#__PURE__*/ function(_React$Component) {
10599
10649
  function DayColumn() {
@@ -10878,7 +10928,7 @@ var DayColumn = /*#__PURE__*/ function(_React$Component) {
10878
10928
  {
10879
10929
  key: "render",
10880
10930
  value: function render() {
10881
- var _this$props5 = this.props, date = _this$props5.date, max = _this$props5.max, rtl = _this$props5.rtl, isNow = _this$props5.isNow, resource = _this$props5.resource, accessors = _this$props5.accessors, localizer = _this$props5.localizer, _this$props5$getters = _this$props5.getters, dayProp = _this$props5$getters.dayProp, getters = _objectWithoutProperties(_this$props5$getters, _excluded$5), _this$props5$componen = _this$props5.components, EventContainer = _this$props5$componen.eventContainerWrapper, components = _objectWithoutProperties(_this$props5$componen, _excluded2$1);
10931
+ var _this$props5 = this.props, date = _this$props5.date, max = _this$props5.max, rtl = _this$props5.rtl, isNow = _this$props5.isNow, resource = _this$props5.resource, accessors = _this$props5.accessors, localizer = _this$props5.localizer, _this$props5$getters = _this$props5.getters, dayProp = _this$props5$getters.dayProp, getters = _objectWithoutProperties(_this$props5$getters, _excluded$5), _this$props5$componen = _this$props5.components, EventContainer = _this$props5$componen.eventContainerWrapper, TimeIndicatorWrapper = _this$props5$componen.timeIndicatorWrapper, components = _objectWithoutProperties(_this$props5$componen, _excluded2$1);
10882
10932
  this.slotMetrics = this.slotMetrics.update(this.props);
10883
10933
  var slotMetrics = this.slotMetrics;
10884
10934
  var _this$state = this.state, selecting = _this$state.selecting, top = _this$state.top, height = _this$state.height, startDate = _this$state.startDate, endDate = _this$state.endDate;
@@ -10887,6 +10937,12 @@ var DayColumn = /*#__PURE__*/ function(_React$Component) {
10887
10937
  end: endDate
10888
10938
  };
10889
10939
  var _dayProp = dayProp(max, resource), className = _dayProp.className, style = _dayProp.style;
10940
+ var timeIndicatorProps = {
10941
+ className: "rbc-current-time-indicator",
10942
+ style: {
10943
+ top: "".concat(this.state.timeIndicatorPosition, "%")
10944
+ }
10945
+ };
10890
10946
  var DayColumnWrapperComponent = components.dayColumnWrapper || DayColumnWrapper$1;
10891
10947
  return /*#__PURE__*/ React__default.createElement(DayColumnWrapperComponent, {
10892
10948
  ref: this.containerRef,
@@ -10924,12 +10980,7 @@ var DayColumn = /*#__PURE__*/ function(_React$Component) {
10924
10980
  top: top,
10925
10981
  height: height
10926
10982
  }
10927
- }, /*#__PURE__*/ React__default.createElement("span", null, localizer.format(selectDates, "selectRangeFormat"))), isNow && this.intervalTriggered && /*#__PURE__*/ React__default.createElement("div", {
10928
- className: "rbc-current-time-indicator",
10929
- style: {
10930
- top: "".concat(this.state.timeIndicatorPosition, "%")
10931
- }
10932
- }));
10983
+ }, /*#__PURE__*/ React__default.createElement("span", null, localizer.format(selectDates, "selectRangeFormat"))), isNow && this.intervalTriggered && /*#__PURE__*/ React__default.createElement(TimeIndicatorWrapper, timeIndicatorProps, /*#__PURE__*/ React__default.createElement("div", timeIndicatorProps)));
10933
10984
  }
10934
10985
  }
10935
10986
  ]);
@@ -12361,7 +12412,8 @@ var Calendar = /*#__PURE__*/ function(_React$Component) {
12361
12412
  dateCellWrapper: NoopWrapper,
12362
12413
  weekWrapper: NoopWrapper,
12363
12414
  timeSlotWrapper: NoopWrapper,
12364
- timeGutterWrapper: NoopWrapper
12415
+ timeGutterWrapper: NoopWrapper,
12416
+ timeIndicatorWrapper: NoopWrapper
12365
12417
  }),
12366
12418
  accessors: {
12367
12419
  start: wrapAccessor(startAccessor),
@@ -18416,7 +18468,7 @@ var esm = /*#__PURE__*/Object.freeze({
18416
18468
  'default': index
18417
18469
  });
18418
18470
 
18419
- var require$$9 = /*@__PURE__*/ getAugmentedNamespace(esm);
18471
+ var require$$7 = /*@__PURE__*/ getAugmentedNamespace(esm);
18420
18472
 
18421
18473
  var querySelectorAll = {
18422
18474
  exports: {}
@@ -18985,11 +19037,10 @@ function nest() {
18985
19037
  for(var _len = arguments.length, Components = new Array(_len), _key = 0; _key < _len; _key++){
18986
19038
  Components[_key] = arguments[_key];
18987
19039
  }
18988
- var factories = Components.filter(Boolean).map(_react$6.createFactory);
18989
19040
  var Nest = function Nest(_ref) {
18990
19041
  var children = _ref.children, props = (0, _objectWithoutProperties2$2.default)(_ref, _excluded$2);
18991
- return factories.reduceRight(function(child, factory) {
18992
- return factory(props, child);
19042
+ return Components.filter(Boolean).reduceRight(function(child, Component) {
19043
+ return /*#__PURE__*/ (0, _react$6.createElement)(Component, props, child);
18993
19044
  }, children);
18994
19045
  };
18995
19046
  return Nest;
@@ -19034,10 +19085,10 @@ var _classCallCheck2$4 = _interopRequireDefault$8(classCallCheck.exports);
19034
19085
  var _createClass2$4 = _interopRequireDefault$8(createClass.exports);
19035
19086
  var _callSuper2$4 = _interopRequireDefault$8(callSuper.exports);
19036
19087
  var _inherits2$4 = _interopRequireDefault$8(inherits.exports);
19088
+ var _domHelpers = require$$7;
19089
+ var _querySelectorAll = _interopRequireDefault$8(querySelectorAll.exports);
19037
19090
  var _react$5 = _interopRequireDefault$8(React__default);
19038
19091
  var _DnDContext$2 = DnDContext;
19039
- var _domHelpers = require$$9;
19040
- var _querySelectorAll = _interopRequireDefault$8(querySelectorAll.exports);
19041
19092
  var _Selection$1 = _interopRequireWildcard$1(Selection$1);
19042
19093
  var _TimeGridEvent = _interopRequireDefault$8(TimeGridEvent$1);
19043
19094
  var _common$2 = common;
@@ -19074,6 +19125,8 @@ var EventContainerWrapper = /*#__PURE__*/ function(_React$Component) {
19074
19125
  allDay: false,
19075
19126
  resource: resource
19076
19127
  });
19128
+ // Cleanup after dropping from outside
19129
+ _this.reset();
19077
19130
  };
19078
19131
  _this.handleDragOverFromOutside = function(point, bounds) {
19079
19132
  var slotMetrics = _this.props.slotMetrics;
package/CkEditor.cjs.js CHANGED
@@ -25,6 +25,9 @@ require('./_tslib.cjs.js');
25
25
  require('./Modal.cjs.js');
26
26
  require('@radix-ui/react-select');
27
27
  require('@radix-ui/react-icons');
28
+ require('flatpickr');
29
+ require('flatpickr/dist/l10n/zh-tw.js');
30
+ require('flatpickr/dist/flatpickr.min.css');
28
31
 
29
32
 
30
33
 
package/CkEditor.esm.js CHANGED
@@ -21,3 +21,6 @@ import './_tslib.esm.js';
21
21
  import './Modal.esm.js';
22
22
  import '@radix-ui/react-select';
23
23
  import '@radix-ui/react-icons';
24
+ import 'flatpickr';
25
+ import 'flatpickr/dist/l10n/zh-tw.js';
26
+ import 'flatpickr/dist/flatpickr.min.css';
@@ -0,0 +1,124 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('@iconify/react');
5
+ var React = require('react');
6
+
7
+ function _array_like_to_array(arr, len) {
8
+ if (len == null || len > arr.length) len = arr.length;
9
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
10
+ return arr2;
11
+ }
12
+ function _array_with_holes(arr) {
13
+ if (Array.isArray(arr)) return arr;
14
+ }
15
+ function _iterable_to_array_limit(arr, i) {
16
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
17
+ if (_i == null) return;
18
+ var _arr = [];
19
+ var _n = true;
20
+ var _d = false;
21
+ var _s, _e;
22
+ try {
23
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
24
+ _arr.push(_s.value);
25
+ if (i && _arr.length === i) break;
26
+ }
27
+ } catch (err) {
28
+ _d = true;
29
+ _e = err;
30
+ } finally{
31
+ try {
32
+ if (!_n && _i["return"] != null) _i["return"]();
33
+ } finally{
34
+ if (_d) throw _e;
35
+ }
36
+ }
37
+ return _arr;
38
+ }
39
+ function _non_iterable_rest() {
40
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
41
+ }
42
+ function _sliced_to_array(arr, i) {
43
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
44
+ }
45
+ function _unsupported_iterable_to_array(o, minLen) {
46
+ if (!o) return;
47
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
48
+ var n = Object.prototype.toString.call(o).slice(8, -1);
49
+ if (n === "Object" && o.constructor) n = o.constructor.name;
50
+ if (n === "Map" || n === "Set") return Array.from(n);
51
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
52
+ }
53
+ var CustomSelect = function(param) {
54
+ var items = param.items, currentID = param.currentID, setCurrentID = param.setCurrentID, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, _param_hasEmptyOption = param.hasEmptyOption, hasEmptyOption = _param_hasEmptyOption === void 0 ? true : _param_hasEmptyOption;
55
+ var _useState = _sliced_to_array(React.useState(false), 2), isDropdownOpen = _useState[0], setIsDropdownOpen = _useState[1];
56
+ var selectRef = React.useRef(null);
57
+ React.useEffect(function() {
58
+ var handleClickOutside = function(event) {
59
+ if (selectRef.current && !selectRef.current.contains(event.target)) {
60
+ setIsDropdownOpen(false);
61
+ }
62
+ };
63
+ document.addEventListener("mousedown", handleClickOutside);
64
+ return function() {
65
+ document.removeEventListener("mousedown", handleClickOutside);
66
+ };
67
+ }, []);
68
+ var getSelectedItemName = function() {
69
+ if (currentID === undefined || currentID === null) return "請選擇";
70
+ var selectedItem = items.find(function(item) {
71
+ return String(item.value) === String(currentID);
72
+ });
73
+ return (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.name) || "請選擇";
74
+ };
75
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
76
+ ref: selectRef,
77
+ className: "relative w-full border border-gray-300 rounded-lg ".concat(className),
78
+ children: [
79
+ /*#__PURE__*/ jsxRuntime.jsxs("button", {
80
+ type: "button",
81
+ className: "w-full h-10 px-4 flex items-center justify-between cursor-pointer rounded-lg",
82
+ onClick: function() {
83
+ return setIsDropdownOpen(function(prev) {
84
+ return !prev;
85
+ });
86
+ },
87
+ children: [
88
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
89
+ children: getSelectedItemName()
90
+ }),
91
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
92
+ width: 28,
93
+ icon: isDropdownOpen ? "iconamoon:arrow-down-2" : "iconamoon:arrow-right-2"
94
+ })
95
+ ]
96
+ }),
97
+ isDropdownOpen && /*#__PURE__*/ jsxRuntime.jsxs("ul", {
98
+ className: "absolute z-10 mt-0 w-full bg-white border border-gray-300 rounded-lg shadow-lg",
99
+ children: [
100
+ hasEmptyOption && /*#__PURE__*/ jsxRuntime.jsx("li", {
101
+ className: "px-4 py-2 cursor-pointer hover:bg-gray-100",
102
+ onClick: function() {
103
+ setCurrentID(null);
104
+ setIsDropdownOpen(false);
105
+ },
106
+ children: "請選擇"
107
+ }),
108
+ items.map(function(item) {
109
+ return /*#__PURE__*/ jsxRuntime.jsx("li", {
110
+ className: "px-4 py-2 cursor-pointer hover:bg-gray-100",
111
+ onClick: function() {
112
+ setCurrentID(item.value);
113
+ setIsDropdownOpen(false);
114
+ },
115
+ children: item.name
116
+ }, item.value);
117
+ })
118
+ ]
119
+ })
120
+ ]
121
+ });
122
+ };
123
+
124
+ exports.CustomSelect = CustomSelect;