@idds/react 1.5.39 → 1.5.41

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.es.js CHANGED
@@ -5895,6 +5895,7 @@ function Spinner({
5895
5895
  function Table({
5896
5896
  columns,
5897
5897
  fetchData,
5898
+ initialPage = 1,
5898
5899
  initialPageSize = 10,
5899
5900
  pageSizeOptions = [10, 20, 50],
5900
5901
  initialSortField = null,
@@ -5921,7 +5922,7 @@ function Table({
5921
5922
  const [loading, setLoading] = useState(false);
5922
5923
  const tableRef = useRef(null);
5923
5924
  const reactId = useId();
5924
- const [page, setPage] = useState(1);
5925
+ const [page, setPage] = useState(initialPage);
5925
5926
  const [pageSize, setPageSize] = useState(initialPageSize);
5926
5927
  const [sortField, setSortField] = useState(initialSortField);
5927
5928
  const [sortOrder, setSortOrder] = useState(
@@ -5966,6 +5967,9 @@ function Table({
5966
5967
  ctl.abort();
5967
5968
  };
5968
5969
  }, [page, pageSize, sortField, sortOrder, searchTerm, fetchData]);
5970
+ useEffect(() => {
5971
+ setPage(initialPage);
5972
+ }, [initialPage]);
5969
5973
  const toggleAll = () => {
5970
5974
  const next = !allSelected;
5971
5975
  const newMap = {};
@@ -6671,23 +6675,23 @@ const TimePicker = forwardRef(
6671
6675
  }
6672
6676
  return hours * 60 + minutes;
6673
6677
  };
6674
- const isTimeDisabled = (hours, minutes, seconds, period) => {
6678
+ const isTimeDisabled = (hours, minutes, seconds, period, options = {}) => {
6675
6679
  const timeStr = formatTime(hours, minutes, seconds, period);
6676
6680
  const timeInMinutes = parseTimeToMinutes(timeStr);
6677
- if (disabledBackTime) {
6681
+ if (disabledBackTime && !options.ignoreBefore) {
6678
6682
  const now = /* @__PURE__ */ new Date();
6679
6683
  const currentTimeInMinutes = now.getHours() * 60 + now.getMinutes();
6680
6684
  if (timeInMinutes < currentTimeInMinutes) {
6681
6685
  return true;
6682
6686
  }
6683
6687
  }
6684
- if (disabledTimeBefore) {
6688
+ if (disabledTimeBefore && !options.ignoreBefore) {
6685
6689
  const beforeTimeInMinutes = parseTimeToMinutes(disabledTimeBefore);
6686
6690
  if (timeInMinutes < beforeTimeInMinutes) {
6687
6691
  return true;
6688
6692
  }
6689
6693
  }
6690
- if (disabledTimeAfter) {
6694
+ if (disabledTimeAfter && !options.ignoreAfter) {
6691
6695
  const afterTimeInMinutes = parseTimeToMinutes(disabledTimeAfter);
6692
6696
  if (timeInMinutes > afterTimeInMinutes) {
6693
6697
  return true;
@@ -6818,12 +6822,22 @@ const TimePicker = forwardRef(
6818
6822
  children: options.map((option) => {
6819
6823
  let isDisabled = false;
6820
6824
  if (type === "hour") {
6821
- isDisabled = isTimeDisabled(
6822
- use12Hours ? option === 12 ? 0 : option : option,
6823
- currentTime.minutes,
6824
- currentTime.seconds,
6825
- use12Hours ? currentTime.period : void 0
6825
+ const hourValue = use12Hours ? option === 12 ? 0 : option : option;
6826
+ const isTooEarly = isTimeDisabled(
6827
+ hourValue,
6828
+ 59,
6829
+ 59,
6830
+ use12Hours ? currentTime.period : void 0,
6831
+ { ignoreAfter: true }
6832
+ );
6833
+ const isTooLate = isTimeDisabled(
6834
+ hourValue,
6835
+ 0,
6836
+ 0,
6837
+ use12Hours ? currentTime.period : void 0,
6838
+ { ignoreBefore: true }
6826
6839
  );
6840
+ isDisabled = isTooEarly || isTooLate;
6827
6841
  } else if (type === "minute") {
6828
6842
  isDisabled = isTimeDisabled(
6829
6843
  currentTime.hours,