@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.js CHANGED
@@ -10451,13 +10451,13 @@ var DAYS = [{
10451
10451
  }];
10452
10452
  var INTERVAL_UNITS = [{
10453
10453
  value: "seconds",
10454
- displayName: "Seconds"
10454
+ label: "Seconds"
10455
10455
  }, {
10456
10456
  value: "minutes",
10457
- displayName: "Minutes"
10457
+ label: "Minutes"
10458
10458
  }, {
10459
10459
  value: "hours",
10460
- displayName: "Hours"
10460
+ label: "Hours"
10461
10461
  }];
10462
10462
  function intervalToMs(value, unit) {
10463
10463
  var num = parseInt(value, 10);
@@ -10672,8 +10672,8 @@ function TaskScheduleEditor(_ref) {
10672
10672
  label: "Every",
10673
10673
  type: "number",
10674
10674
  value: String(intervalValue),
10675
- onChange: function onChange(e) {
10676
- return handleIntervalChange(e.target.value, intervalUnit);
10675
+ onChange: function onChange(val) {
10676
+ return handleIntervalChange(val, intervalUnit);
10677
10677
  },
10678
10678
  className: "w-24",
10679
10679
  min: "1"
@@ -10715,8 +10715,8 @@ function TaskScheduleEditor(_ref) {
10715
10715
  label: "Time",
10716
10716
  type: "time",
10717
10717
  value: time,
10718
- onChange: function onChange(e) {
10719
- return handleTimeChange(e.target.value);
10718
+ onChange: function onChange(val) {
10719
+ return handleTimeChange(val);
10720
10720
  },
10721
10721
  className: "w-36"
10722
10722
  })]
@@ -10743,9 +10743,14 @@ var PanelEditItemSchedule = function PanelEditItemSchedule(_ref2) {
10743
10743
  _useState12 = _slicedToArray(_useState11, 2),
10744
10744
  taskStates = _useState12[0],
10745
10745
  setTaskStates = _useState12[1];
10746
+ var _useState13 = React.useState(true),
10747
+ _useState14 = _slicedToArray(_useState13, 2),
10748
+ isLoading = _useState14[0],
10749
+ setIsLoading = _useState14[1];
10746
10750
  React.useEffect(function () {
10747
10751
  var _window$mainApi4;
10748
10752
  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) {
10753
+ setIsLoading(true);
10749
10754
  window.mainApi.scheduler.getTasks(widgetUuid).then(function (tasks) {
10750
10755
  var stateMap = {};
10751
10756
  var _iterator = _createForOfIteratorHelper$b(tasks || []),
@@ -10761,10 +10766,25 @@ var PanelEditItemSchedule = function PanelEditItemSchedule(_ref2) {
10761
10766
  _iterator.f();
10762
10767
  }
10763
10768
  setTaskStates(stateMap);
10769
+ setIsLoading(false);
10764
10770
  });
10771
+ } else {
10772
+ setIsLoading(false);
10765
10773
  }
10766
10774
  }, [widgetUuid, scheduledTaskDefs.length]);
10767
10775
  if (!item || scheduledTaskDefs.length === 0) return null;
10776
+ if (isLoading) {
10777
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10778
+ className: "flex flex-col flex-1 min-h-0 p-6",
10779
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SubHeading3, {
10780
+ title: "Schedule",
10781
+ padding: false
10782
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
10783
+ className: "text-sm opacity-50 mt-4",
10784
+ children: "Loading schedules..."
10785
+ })]
10786
+ });
10787
+ }
10768
10788
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
10769
10789
  className: "flex flex-col flex-1 min-h-0 overflow-y-auto p-6 space-y-4",
10770
10790
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SubHeading3, {
@@ -26039,6 +26059,7 @@ var ComponentManager = {
26039
26059
  eventHandlers: "eventHandlers" in c ? c["eventHandlers"] : [],
26040
26060
  providers: "providers" in c ? c["providers"] : [],
26041
26061
  notifications: "notifications" in c ? c["notifications"] : [],
26062
+ scheduledTasks: "scheduledTasks" in c ? c["scheduledTasks"] : [],
26042
26063
  icon: "icon" in c ? c["icon"] : null
26043
26064
  };
26044
26065
  }