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