schummar-table 0.40.6 → 0.42.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 +42 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +42 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2182,12 +2182,13 @@ function DatePicker(props) {
|
|
|
2182
2182
|
firstDayOfWeek = 1,
|
|
2183
2183
|
defaultDateInView,
|
|
2184
2184
|
quickOptions = ["today", "thisWeek"],
|
|
2185
|
+
noReset,
|
|
2185
2186
|
minDate,
|
|
2186
2187
|
maxDate,
|
|
2187
2188
|
showCalendarWeek,
|
|
2188
2189
|
blockedRanges = []
|
|
2189
2190
|
} = defaults(props, context);
|
|
2190
|
-
function onChange(value2) {
|
|
2191
|
+
function onChange(value2, source) {
|
|
2191
2192
|
if (value2 instanceof Date) {
|
|
2192
2193
|
value2 = dateClamp(value2, minDate, maxDate);
|
|
2193
2194
|
} else if (value2) {
|
|
@@ -2196,7 +2197,7 @@ function DatePicker(props) {
|
|
|
2196
2197
|
max: dateClamp(value2.max, minDate, maxDate)
|
|
2197
2198
|
};
|
|
2198
2199
|
}
|
|
2199
|
-
props.onChange(value2);
|
|
2200
|
+
props.onChange(value2, source);
|
|
2200
2201
|
}
|
|
2201
2202
|
const Button2 = useTheme((t2) => t2.components.Button);
|
|
2202
2203
|
const IconButton2 = useTheme((t2) => t2.components.IconButton);
|
|
@@ -2265,37 +2266,38 @@ function DatePicker(props) {
|
|
|
2265
2266
|
}
|
|
2266
2267
|
const min = dirty ? dirty.min : value instanceof Date ? value : value == null ? void 0 : value.min;
|
|
2267
2268
|
const max = dirty ? dirty.max : value instanceof Date ? value : value == null ? void 0 : value.max;
|
|
2268
|
-
const resolvedQuickOptions = [
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2269
|
+
const resolvedQuickOptions = [
|
|
2270
|
+
...quickOptions,
|
|
2271
|
+
...noReset ? [] : [{ label: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { id: "reset" }), value: null }]
|
|
2272
|
+
].map((option, index) => {
|
|
2273
|
+
if (option instanceof Function) {
|
|
2274
|
+
return option((value3) => {
|
|
2275
|
+
setDirty(void 0);
|
|
2276
|
+
onChange(value3, "quickOption");
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
const { label, value: value2 } = typeof option === "string" ? commonQuickOptions[option] : option;
|
|
2280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2281
|
+
Button2,
|
|
2282
|
+
{
|
|
2283
|
+
variant: "text",
|
|
2284
|
+
type: "button",
|
|
2285
|
+
css: {
|
|
2286
|
+
color: "inherit"
|
|
2287
|
+
},
|
|
2288
|
+
onClick: () => {
|
|
2272
2289
|
setDirty(void 0);
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
Button2,
|
|
2279
|
-
{
|
|
2280
|
-
variant: "text",
|
|
2281
|
-
type: "button",
|
|
2282
|
-
css: {
|
|
2283
|
-
color: "inherit"
|
|
2284
|
-
},
|
|
2285
|
-
onClick: () => {
|
|
2286
|
-
setDirty(void 0);
|
|
2287
|
-
if (value2 instanceof Function) {
|
|
2288
|
-
onChange(value2(props));
|
|
2289
|
-
} else {
|
|
2290
|
-
onChange(value2);
|
|
2291
|
-
}
|
|
2292
|
-
},
|
|
2293
|
-
children: label
|
|
2290
|
+
if (value2 instanceof Function) {
|
|
2291
|
+
onChange(value2(props), "quickOption");
|
|
2292
|
+
} else {
|
|
2293
|
+
onChange(value2, "quickOption");
|
|
2294
|
+
}
|
|
2294
2295
|
},
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2296
|
+
children: label
|
|
2297
|
+
},
|
|
2298
|
+
index
|
|
2299
|
+
);
|
|
2300
|
+
});
|
|
2299
2301
|
const { calendars, getBackProps, getForwardProps, getDateProps } = (0, import_dayzed.useDayzed)({
|
|
2300
2302
|
onDateSelected: () => void 0,
|
|
2301
2303
|
firstDayOfWeek,
|
|
@@ -2322,9 +2324,9 @@ function DatePicker(props) {
|
|
|
2322
2324
|
setDirty(void 0);
|
|
2323
2325
|
}
|
|
2324
2326
|
}, [rangeSelect]);
|
|
2325
|
-
function set(min2, max2, edit) {
|
|
2327
|
+
function set(source, min2, max2, edit) {
|
|
2326
2328
|
if (!rangeSelect) {
|
|
2327
|
-
onChange(min2 != null ? min2 : null);
|
|
2329
|
+
onChange(min2 != null ? min2 : null, source);
|
|
2328
2330
|
return;
|
|
2329
2331
|
}
|
|
2330
2332
|
if (min2 && max2 && min2 > max2) {
|
|
@@ -2338,7 +2340,7 @@ function DatePicker(props) {
|
|
|
2338
2340
|
}
|
|
2339
2341
|
if (!min2 === !max2) {
|
|
2340
2342
|
setDirty(void 0);
|
|
2341
|
-
onChange(min2 && max2 ? { min: min2, max: endOfDay(max2) } : null);
|
|
2343
|
+
onChange(min2 && max2 ? { min: min2, max: endOfDay(max2) } : null, source);
|
|
2342
2344
|
} else {
|
|
2343
2345
|
setDirty({ min: min2, max: max2 });
|
|
2344
2346
|
}
|
|
@@ -2376,7 +2378,7 @@ function DatePicker(props) {
|
|
|
2376
2378
|
DateInput,
|
|
2377
2379
|
{
|
|
2378
2380
|
value: min != null ? min : null,
|
|
2379
|
-
onChange: (date) => set(date != null ? date : void 0, max, "min"),
|
|
2381
|
+
onChange: (date) => set("input", date != null ? date : void 0, max, "min"),
|
|
2380
2382
|
locale
|
|
2381
2383
|
}
|
|
2382
2384
|
),
|
|
@@ -2386,7 +2388,7 @@ function DatePicker(props) {
|
|
|
2386
2388
|
DateInput,
|
|
2387
2389
|
{
|
|
2388
2390
|
value: max != null ? max : null,
|
|
2389
|
-
onChange: (date) => set(min, date != null ? date : void 0, "max"),
|
|
2391
|
+
onChange: (date) => set("input", min, date != null ? date : void 0, "max"),
|
|
2390
2392
|
locale
|
|
2391
2393
|
}
|
|
2392
2394
|
)
|
|
@@ -2471,7 +2473,7 @@ function DatePicker(props) {
|
|
|
2471
2473
|
}
|
|
2472
2474
|
const min2 = minDate && weekStart.date < minDate ? minDate : weekStart.date;
|
|
2473
2475
|
const max2 = maxDate && weekEnd.date > maxDate ? maxDate : weekEnd.date;
|
|
2474
|
-
set(min2, max2);
|
|
2476
|
+
set("calendarWeek", min2, max2);
|
|
2475
2477
|
},
|
|
2476
2478
|
onPointerOver: () => !weekDisabled && setHovered({ min: weekStart.date, max: weekEnd.date }),
|
|
2477
2479
|
onPointerOut: () => !weekDisabled && setHovered(void 0),
|
|
@@ -2507,10 +2509,10 @@ function DatePicker(props) {
|
|
|
2507
2509
|
}, getDateProps({ dateObj: dateObject })), {
|
|
2508
2510
|
onClick: () => {
|
|
2509
2511
|
if (dirty) {
|
|
2510
|
-
if (min) set(min, date);
|
|
2511
|
-
else set(date, max);
|
|
2512
|
+
if (min) set("calendar", min, date);
|
|
2513
|
+
else set("calendar", date, max);
|
|
2512
2514
|
} else {
|
|
2513
|
-
set(date);
|
|
2515
|
+
set("calendar", date);
|
|
2514
2516
|
}
|
|
2515
2517
|
},
|
|
2516
2518
|
onPointerOver: () => setHovered({ min: date, max: date }),
|