schummar-table 1.0.3 → 1.0.5

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
@@ -2260,7 +2260,7 @@ function DateFilterComponent({ value = null, onChange, close, options: { locale,
2260
2260
  value: value ?? null,
2261
2261
  onChange: (value, source) => {
2262
2262
  onChange(value);
2263
- if (source !== "input") close();
2263
+ if (source === "quickOption" || source !== "input" && !showTime) close();
2264
2264
  },
2265
2265
  locale,
2266
2266
  firstDayOfWeek,
@@ -2273,9 +2273,18 @@ function DateFilterComponent({ value = null, onChange, close, options: { locale,
2273
2273
  })
2274
2274
  });
2275
2275
  }
2276
+ /** Like dateIntersect, but compares the exact times instead of whole days. */
2277
+ function timeIntersect(range, x) {
2278
+ if (!x) return false;
2279
+ const { min, max } = x instanceof Date ? {
2280
+ min: x,
2281
+ max: x
2282
+ } : x;
2283
+ return !(range.max < min || range.min > max);
2284
+ }
2276
2285
  const dateFilter = defineFilter({
2277
2286
  isActive: (value) => !!value,
2278
- test: (value, input) => toSingles(input).some((x) => dateIntersect(value, toDate(x))),
2287
+ test: (value, input, { showTime }) => toSingles(input).some((x) => showTime && value && !(value instanceof Date) ? timeIntersect(value, toDate(x)) : dateIntersect(value, toDate(x))),
2279
2288
  Component: DateFilterComponent
2280
2289
  });
2281
2290
  //#endregion