trotl-filter 1.0.7 → 1.0.8
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.js +23 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -8
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8821,6 +8821,7 @@ function DateTimeInput({
|
|
|
8821
8821
|
className = "",
|
|
8822
8822
|
style = {},
|
|
8823
8823
|
predefinedRanges = ["today", "yesterday"],
|
|
8824
|
+
startWith = "sunday",
|
|
8824
8825
|
...rest
|
|
8825
8826
|
}) {
|
|
8826
8827
|
const paramKey = pushUrlParamObj || null;
|
|
@@ -9019,8 +9020,12 @@ function DateTimeInput({
|
|
|
9019
9020
|
// Build calendar days (6 weeks grid)
|
|
9020
9021
|
const buildDays = () => {
|
|
9021
9022
|
const startOfMonth = new Date(monthCursor.getFullYear(), monthCursor.getMonth(), 1);
|
|
9022
|
-
|
|
9023
|
-
//
|
|
9023
|
+
let dayOfWeek = startOfMonth.getDay(); // 0 Sun ... 6 Sat
|
|
9024
|
+
// Adjust for Monday start
|
|
9025
|
+
if (startWith === "monday") {
|
|
9026
|
+
dayOfWeek = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
|
|
9027
|
+
}
|
|
9028
|
+
// We start at the first day of the week containing the 1st
|
|
9024
9029
|
const firstGridDate = new Date(startOfMonth);
|
|
9025
9030
|
firstGridDate.setDate(startOfMonth.getDate() - dayOfWeek);
|
|
9026
9031
|
const days = [];
|
|
@@ -9257,7 +9262,7 @@ function DateTimeInput({
|
|
|
9257
9262
|
marginBottom: 4,
|
|
9258
9263
|
opacity: 0.8
|
|
9259
9264
|
}
|
|
9260
|
-
}, ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(d => /*#__PURE__*/React.createElement("div", {
|
|
9265
|
+
}, (startWith === "monday" ? ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']).map(d => /*#__PURE__*/React.createElement("div", {
|
|
9261
9266
|
key: d,
|
|
9262
9267
|
style: {
|
|
9263
9268
|
textAlign: 'center'
|
|
@@ -9369,6 +9374,7 @@ DateTimeInput.propTypes = {
|
|
|
9369
9374
|
* onChange: (startDate, endDate) => void
|
|
9370
9375
|
* time: boolean - if true, show time selectors
|
|
9371
9376
|
* timeStart, timeEnd: default times for start/end
|
|
9377
|
+
* startWith: "sunday" | "monday" - first day of week
|
|
9372
9378
|
*/
|
|
9373
9379
|
function CalendarRangePicker({
|
|
9374
9380
|
startDate,
|
|
@@ -9376,7 +9382,8 @@ function CalendarRangePicker({
|
|
|
9376
9382
|
onChange,
|
|
9377
9383
|
time = false,
|
|
9378
9384
|
timeStart = "00:00",
|
|
9379
|
-
timeEnd = "23:59"
|
|
9385
|
+
timeEnd = "23:59",
|
|
9386
|
+
startWith = "sunday"
|
|
9380
9387
|
}) {
|
|
9381
9388
|
// Current view months (show 2 months)
|
|
9382
9389
|
const [leftMonth, setLeftMonth] = React.useState(() => {
|
|
@@ -9454,7 +9461,11 @@ function CalendarRangePicker({
|
|
|
9454
9461
|
const monthIdx = month.getMonth();
|
|
9455
9462
|
const firstDay = new Date(year, monthIdx, 1);
|
|
9456
9463
|
const lastDay = new Date(year, monthIdx + 1, 0);
|
|
9457
|
-
|
|
9464
|
+
let startWeekday = firstDay.getDay(); // 0 = Sunday
|
|
9465
|
+
// Adjust for Monday start
|
|
9466
|
+
if (startWith === "monday") {
|
|
9467
|
+
startWeekday = startWeekday === 0 ? 6 : startWeekday - 1;
|
|
9468
|
+
}
|
|
9458
9469
|
const daysInMonth = lastDay.getDate();
|
|
9459
9470
|
const days = [];
|
|
9460
9471
|
// Padding days from previous month
|
|
@@ -9501,7 +9512,7 @@ function CalendarRangePicker({
|
|
|
9501
9512
|
gridTemplateColumns: "repeat(7, 1fr)",
|
|
9502
9513
|
gap: 2
|
|
9503
9514
|
}
|
|
9504
|
-
}, ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(day => /*#__PURE__*/React.createElement("div", {
|
|
9515
|
+
}, (startWith === "monday" ? ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"] : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]).map(day => /*#__PURE__*/React.createElement("div", {
|
|
9505
9516
|
key: day,
|
|
9506
9517
|
style: {
|
|
9507
9518
|
textAlign: "center",
|
|
@@ -9605,7 +9616,8 @@ CalendarRangePicker.propTypes = {
|
|
|
9605
9616
|
onChange: PropTypes.func.isRequired,
|
|
9606
9617
|
time: PropTypes.bool,
|
|
9607
9618
|
timeStart: PropTypes.string,
|
|
9608
|
-
timeEnd: PropTypes.string
|
|
9619
|
+
timeEnd: PropTypes.string,
|
|
9620
|
+
startWith: PropTypes.oneOf(["sunday", "monday"])
|
|
9609
9621
|
};
|
|
9610
9622
|
|
|
9611
9623
|
/**
|
|
@@ -9805,6 +9817,7 @@ function RangePicker({
|
|
|
9805
9817
|
min,
|
|
9806
9818
|
max,
|
|
9807
9819
|
predefinedRanges = PREDEFINED_RANGES,
|
|
9820
|
+
startWith = "sunday",
|
|
9808
9821
|
...rest
|
|
9809
9822
|
}) {
|
|
9810
9823
|
const paramKey = pushUrlParamObj || null;
|
|
@@ -10138,7 +10151,8 @@ function RangePicker({
|
|
|
10138
10151
|
},
|
|
10139
10152
|
time: time,
|
|
10140
10153
|
timeStart: timeStart,
|
|
10141
|
-
timeEnd: timeEnd
|
|
10154
|
+
timeEnd: timeEnd,
|
|
10155
|
+
startWith: startWith
|
|
10142
10156
|
}), processedRanges && processedRanges.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
10143
10157
|
style: {
|
|
10144
10158
|
marginTop: 12,
|
|
@@ -10226,6 +10240,7 @@ RangePicker.propTypes = {
|
|
|
10226
10240
|
style: PropTypes.object,
|
|
10227
10241
|
min: PropTypes.string,
|
|
10228
10242
|
max: PropTypes.string,
|
|
10243
|
+
startWith: PropTypes.oneOf(["sunday", "monday"]),
|
|
10229
10244
|
predefinedRanges: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string,
|
|
10230
10245
|
// e.g., "today", "yesterday", "lastweek"
|
|
10231
10246
|
PropTypes.number,
|