schummar-table 0.40.5 → 0.41.0

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.cjs CHANGED
@@ -1807,8 +1807,8 @@ function AutoFocusTextField(props) {
1807
1807
 
1808
1808
  // src/hooks/useFilter.ts
1809
1809
  var import_immer3 = require("immer");
1810
- var import_react16 = require("react");
1811
1810
  var import_nanoid = require("nanoid");
1811
+ var import_react16 = require("react");
1812
1812
 
1813
1813
  // src/misc/debounce.ts
1814
1814
  function debounce(function_, ms) {
@@ -1872,7 +1872,9 @@ function useFilter(impl) {
1872
1872
  });
1873
1873
  };
1874
1874
  }, [table, columnId, impl]);
1875
- const value = table.useState((state) => state.filterValues.get(columnId));
1875
+ const value = table.useState(
1876
+ (state) => state.filterValues.get(columnId)
1877
+ );
1876
1878
  const [dirtyValue, setDirtyValue] = (0, import_react16.useState)();
1877
1879
  const implRef = (0, import_react16.useRef)(impl);
1878
1880
  (0, import_react16.useLayoutEffect)(() => {
@@ -2185,7 +2187,7 @@ function DatePicker(props) {
2185
2187
  showCalendarWeek,
2186
2188
  blockedRanges = []
2187
2189
  } = defaults(props, context);
2188
- function onChange(value2) {
2190
+ function onChange(value2, source) {
2189
2191
  if (value2 instanceof Date) {
2190
2192
  value2 = dateClamp(value2, minDate, maxDate);
2191
2193
  } else if (value2) {
@@ -2194,7 +2196,7 @@ function DatePicker(props) {
2194
2196
  max: dateClamp(value2.max, minDate, maxDate)
2195
2197
  };
2196
2198
  }
2197
- props.onChange(value2);
2199
+ props.onChange(value2, source);
2198
2200
  }
2199
2201
  const Button2 = useTheme((t2) => t2.components.Button);
2200
2202
  const IconButton2 = useTheme((t2) => t2.components.IconButton);
@@ -2268,7 +2270,7 @@ function DatePicker(props) {
2268
2270
  if (option instanceof Function) {
2269
2271
  return option((value3) => {
2270
2272
  setDirty(void 0);
2271
- onChange(value3);
2273
+ onChange(value3, "quickOption");
2272
2274
  });
2273
2275
  }
2274
2276
  const { label, value: value2 } = typeof option === "string" ? commonQuickOptions[option] : option;
@@ -2283,9 +2285,9 @@ function DatePicker(props) {
2283
2285
  onClick: () => {
2284
2286
  setDirty(void 0);
2285
2287
  if (value2 instanceof Function) {
2286
- onChange(value2(props));
2288
+ onChange(value2(props), "quickOption");
2287
2289
  } else {
2288
- onChange(value2);
2290
+ onChange(value2, "quickOption");
2289
2291
  }
2290
2292
  },
2291
2293
  children: label
@@ -2320,9 +2322,9 @@ function DatePicker(props) {
2320
2322
  setDirty(void 0);
2321
2323
  }
2322
2324
  }, [rangeSelect]);
2323
- function set(min2, max2, edit) {
2325
+ function set(source, min2, max2, edit) {
2324
2326
  if (!rangeSelect) {
2325
- onChange(min2 != null ? min2 : null);
2327
+ onChange(min2 != null ? min2 : null, source);
2326
2328
  return;
2327
2329
  }
2328
2330
  if (min2 && max2 && min2 > max2) {
@@ -2336,7 +2338,7 @@ function DatePicker(props) {
2336
2338
  }
2337
2339
  if (!min2 === !max2) {
2338
2340
  setDirty(void 0);
2339
- onChange(min2 && max2 ? { min: min2, max: endOfDay(max2) } : null);
2341
+ onChange(min2 && max2 ? { min: min2, max: endOfDay(max2) } : null, source);
2340
2342
  } else {
2341
2343
  setDirty({ min: min2, max: max2 });
2342
2344
  }
@@ -2374,7 +2376,7 @@ function DatePicker(props) {
2374
2376
  DateInput,
2375
2377
  {
2376
2378
  value: min != null ? min : null,
2377
- onChange: (date) => set(date != null ? date : void 0, max, "min"),
2379
+ onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
2378
2380
  locale
2379
2381
  }
2380
2382
  ),
@@ -2384,7 +2386,7 @@ function DatePicker(props) {
2384
2386
  DateInput,
2385
2387
  {
2386
2388
  value: max != null ? max : null,
2387
- onChange: (date) => set(min, date != null ? date : void 0, "max"),
2389
+ onChange: (date) => set("input", min, date != null ? date : void 0, "max"),
2388
2390
  locale
2389
2391
  }
2390
2392
  )
@@ -2469,7 +2471,7 @@ function DatePicker(props) {
2469
2471
  }
2470
2472
  const min2 = minDate && weekStart.date < minDate ? minDate : weekStart.date;
2471
2473
  const max2 = maxDate && weekEnd.date > maxDate ? maxDate : weekEnd.date;
2472
- set(min2, max2);
2474
+ set("calendarWeek", min2, max2);
2473
2475
  },
2474
2476
  onPointerOver: () => !weekDisabled && setHovered({ min: weekStart.date, max: weekEnd.date }),
2475
2477
  onPointerOut: () => !weekDisabled && setHovered(void 0),
@@ -2505,10 +2507,10 @@ function DatePicker(props) {
2505
2507
  }, getDateProps({ dateObj: dateObject })), {
2506
2508
  onClick: () => {
2507
2509
  if (dirty) {
2508
- if (min) set(min, date);
2509
- else set(date, max);
2510
+ if (min) set("calendar", min, date);
2511
+ else set("calendar", date, max);
2510
2512
  } else {
2511
- set(date);
2513
+ set("calendar", date);
2512
2514
  }
2513
2515
  },
2514
2516
  onPointerOver: () => setHovered({ min: date, max: date }),