@trops/dash-core 0.1.149 → 0.1.151

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/dist/index.esm.js CHANGED
@@ -10433,13 +10433,13 @@ var DAYS = [{
10433
10433
  }];
10434
10434
  var INTERVAL_UNITS = [{
10435
10435
  value: "seconds",
10436
- displayName: "Seconds"
10436
+ label: "Seconds"
10437
10437
  }, {
10438
10438
  value: "minutes",
10439
- displayName: "Minutes"
10439
+ label: "Minutes"
10440
10440
  }, {
10441
10441
  value: "hours",
10442
- displayName: "Hours"
10442
+ label: "Hours"
10443
10443
  }];
10444
10444
  function intervalToMs(value, unit) {
10445
10445
  var num = parseInt(value, 10);
@@ -10654,8 +10654,8 @@ function TaskScheduleEditor(_ref) {
10654
10654
  label: "Every",
10655
10655
  type: "number",
10656
10656
  value: String(intervalValue),
10657
- onChange: function onChange(e) {
10658
- return handleIntervalChange(e.target.value, intervalUnit);
10657
+ onChange: function onChange(val) {
10658
+ return handleIntervalChange(val, intervalUnit);
10659
10659
  },
10660
10660
  className: "w-24",
10661
10661
  min: "1"
@@ -10697,8 +10697,8 @@ function TaskScheduleEditor(_ref) {
10697
10697
  label: "Time",
10698
10698
  type: "time",
10699
10699
  value: time,
10700
- onChange: function onChange(e) {
10701
- return handleTimeChange(e.target.value);
10700
+ onChange: function onChange(val) {
10701
+ return handleTimeChange(val);
10702
10702
  },
10703
10703
  className: "w-36"
10704
10704
  })]
@@ -10725,9 +10725,14 @@ var PanelEditItemSchedule = function PanelEditItemSchedule(_ref2) {
10725
10725
  _useState12 = _slicedToArray(_useState11, 2),
10726
10726
  taskStates = _useState12[0],
10727
10727
  setTaskStates = _useState12[1];
10728
+ var _useState13 = useState(true),
10729
+ _useState14 = _slicedToArray(_useState13, 2),
10730
+ isLoading = _useState14[0],
10731
+ setIsLoading = _useState14[1];
10728
10732
  useEffect(function () {
10729
10733
  var _window$mainApi4;
10730
10734
  if (scheduledTaskDefs.length > 0 && widgetUuid && (_window$mainApi4 = window.mainApi) !== null && _window$mainApi4 !== void 0 && (_window$mainApi4 = _window$mainApi4.scheduler) !== null && _window$mainApi4 !== void 0 && _window$mainApi4.getTasks) {
10735
+ setIsLoading(true);
10731
10736
  window.mainApi.scheduler.getTasks(widgetUuid).then(function (tasks) {
10732
10737
  var stateMap = {};
10733
10738
  var _iterator = _createForOfIteratorHelper$b(tasks || []),
@@ -10743,10 +10748,25 @@ var PanelEditItemSchedule = function PanelEditItemSchedule(_ref2) {
10743
10748
  _iterator.f();
10744
10749
  }
10745
10750
  setTaskStates(stateMap);
10751
+ setIsLoading(false);
10746
10752
  });
10753
+ } else {
10754
+ setIsLoading(false);
10747
10755
  }
10748
10756
  }, [widgetUuid, scheduledTaskDefs.length]);
10749
10757
  if (!item || scheduledTaskDefs.length === 0) return null;
10758
+ if (isLoading) {
10759
+ return /*#__PURE__*/jsxs("div", {
10760
+ className: "flex flex-col flex-1 min-h-0 p-6",
10761
+ children: [/*#__PURE__*/jsx(SubHeading3, {
10762
+ title: "Schedule",
10763
+ padding: false
10764
+ }), /*#__PURE__*/jsx("div", {
10765
+ className: "text-sm opacity-50 mt-4",
10766
+ children: "Loading schedules..."
10767
+ })]
10768
+ });
10769
+ }
10750
10770
  return /*#__PURE__*/jsxs("div", {
10751
10771
  className: "flex flex-col flex-1 min-h-0 overflow-y-auto p-6 space-y-4",
10752
10772
  children: [/*#__PURE__*/jsx(SubHeading3, {
@@ -26021,6 +26041,7 @@ var ComponentManager = {
26021
26041
  eventHandlers: "eventHandlers" in c ? c["eventHandlers"] : [],
26022
26042
  providers: "providers" in c ? c["providers"] : [],
26023
26043
  notifications: "notifications" in c ? c["notifications"] : [],
26044
+ scheduledTasks: "scheduledTasks" in c ? c["scheduledTasks"] : [],
26024
26045
  icon: "icon" in c ? c["icon"] : null
26025
26046
  };
26026
26047
  }