trotl-filter 1.0.6 → 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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # trotl-table
1
+ # trotl-filter
2
2
 
3
3
  A simple, flexible **Filters UI** for React.
4
4
 
package/dist/index.cjs.js CHANGED
@@ -7329,8 +7329,21 @@ const DebounceSelect = ({
7329
7329
  isMulti = false,
7330
7330
  pushUrlParamObj = false,
7331
7331
  addItem = undefined,
7332
- fetchAll = true
7332
+ fetchAll = true,
7333
+ t
7333
7334
  }) => {
7335
+ let translate;
7336
+ if (t) {
7337
+ translate = t;
7338
+ } else {
7339
+ translate = key => {
7340
+ const translations = {
7341
+ add: "Add",
7342
+ cancel: "Cancel"
7343
+ };
7344
+ return translations[key] || key;
7345
+ };
7346
+ }
7334
7347
  const [input, setInput] = React.useState("");
7335
7348
  const [options, setOptions] = React.useState([]);
7336
7349
  const [loading, setLoading] = React.useState(false);
@@ -7557,21 +7570,21 @@ const DebounceSelect = ({
7557
7570
  key: value,
7558
7571
  className: "basic-input-dropdown-item",
7559
7572
  onMouseDown: () => handleSelect(value, label)
7560
- }, label)), input.trim() && !inputExists && typeof addItem === 'function' && /*#__PURE__*/React.createElement("div", {
7573
+ }, translate(label))), input.trim() && !inputExists && typeof addItem === 'function' && /*#__PURE__*/React.createElement("div", {
7561
7574
  className: "basic-input-dropdown-item",
7562
7575
  style: {
7563
7576
  color: '#1677ff',
7564
7577
  fontWeight: 500
7565
7578
  },
7566
7579
  onMouseDown: handleAddNew
7567
- }, "+ Add \"", input.trim(), "\"")) : input.trim() && !loading && typeof addItem === 'function' ? /*#__PURE__*/React.createElement("div", {
7580
+ }, "+ ", translate("add"), " \"", input.trim(), "\"")) : input.trim() && !loading && typeof addItem === 'function' ? /*#__PURE__*/React.createElement("div", {
7568
7581
  className: "basic-input-dropdown-item",
7569
7582
  style: {
7570
7583
  color: '#1677ff',
7571
7584
  fontWeight: 500
7572
7585
  },
7573
7586
  onMouseDown: handleAddNew
7574
- }, "+ Add \"", input.trim(), "\"") : /*#__PURE__*/React.createElement("div", {
7587
+ }, "+ ", translate("add"), " \"", input.trim(), "\"") : /*#__PURE__*/React.createElement("div", {
7575
7588
  className: "no-results-dropdown-item"
7576
7589
  }, "No results")));
7577
7590
  };
@@ -8808,6 +8821,7 @@ function DateTimeInput({
8808
8821
  className = "",
8809
8822
  style = {},
8810
8823
  predefinedRanges = ["today", "yesterday"],
8824
+ startWith = "sunday",
8811
8825
  ...rest
8812
8826
  }) {
8813
8827
  const paramKey = pushUrlParamObj || null;
@@ -9006,8 +9020,12 @@ function DateTimeInput({
9006
9020
  // Build calendar days (6 weeks grid)
9007
9021
  const buildDays = () => {
9008
9022
  const startOfMonth = new Date(monthCursor.getFullYear(), monthCursor.getMonth(), 1);
9009
- const dayOfWeek = startOfMonth.getDay(); // 0 Sun ... 6 Sat
9010
- // We start at Sunday of the week containing the 1st
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
9011
9029
  const firstGridDate = new Date(startOfMonth);
9012
9030
  firstGridDate.setDate(startOfMonth.getDate() - dayOfWeek);
9013
9031
  const days = [];
@@ -9244,7 +9262,7 @@ function DateTimeInput({
9244
9262
  marginBottom: 4,
9245
9263
  opacity: 0.8
9246
9264
  }
9247
- }, ['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", {
9248
9266
  key: d,
9249
9267
  style: {
9250
9268
  textAlign: 'center'
@@ -9356,6 +9374,7 @@ DateTimeInput.propTypes = {
9356
9374
  * onChange: (startDate, endDate) => void
9357
9375
  * time: boolean - if true, show time selectors
9358
9376
  * timeStart, timeEnd: default times for start/end
9377
+ * startWith: "sunday" | "monday" - first day of week
9359
9378
  */
9360
9379
  function CalendarRangePicker({
9361
9380
  startDate,
@@ -9363,7 +9382,8 @@ function CalendarRangePicker({
9363
9382
  onChange,
9364
9383
  time = false,
9365
9384
  timeStart = "00:00",
9366
- timeEnd = "23:59"
9385
+ timeEnd = "23:59",
9386
+ startWith = "sunday"
9367
9387
  }) {
9368
9388
  // Current view months (show 2 months)
9369
9389
  const [leftMonth, setLeftMonth] = React.useState(() => {
@@ -9441,7 +9461,11 @@ function CalendarRangePicker({
9441
9461
  const monthIdx = month.getMonth();
9442
9462
  const firstDay = new Date(year, monthIdx, 1);
9443
9463
  const lastDay = new Date(year, monthIdx + 1, 0);
9444
- const startWeekday = firstDay.getDay(); // 0 = Sunday
9464
+ let startWeekday = firstDay.getDay(); // 0 = Sunday
9465
+ // Adjust for Monday start
9466
+ if (startWith === "monday") {
9467
+ startWeekday = startWeekday === 0 ? 6 : startWeekday - 1;
9468
+ }
9445
9469
  const daysInMonth = lastDay.getDate();
9446
9470
  const days = [];
9447
9471
  // Padding days from previous month
@@ -9488,7 +9512,7 @@ function CalendarRangePicker({
9488
9512
  gridTemplateColumns: "repeat(7, 1fr)",
9489
9513
  gap: 2
9490
9514
  }
9491
- }, ["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", {
9492
9516
  key: day,
9493
9517
  style: {
9494
9518
  textAlign: "center",
@@ -9592,7 +9616,8 @@ CalendarRangePicker.propTypes = {
9592
9616
  onChange: PropTypes.func.isRequired,
9593
9617
  time: PropTypes.bool,
9594
9618
  timeStart: PropTypes.string,
9595
- timeEnd: PropTypes.string
9619
+ timeEnd: PropTypes.string,
9620
+ startWith: PropTypes.oneOf(["sunday", "monday"])
9596
9621
  };
9597
9622
 
9598
9623
  /**
@@ -9792,6 +9817,7 @@ function RangePicker({
9792
9817
  min,
9793
9818
  max,
9794
9819
  predefinedRanges = PREDEFINED_RANGES,
9820
+ startWith = "sunday",
9795
9821
  ...rest
9796
9822
  }) {
9797
9823
  const paramKey = pushUrlParamObj || null;
@@ -10125,7 +10151,8 @@ function RangePicker({
10125
10151
  },
10126
10152
  time: time,
10127
10153
  timeStart: timeStart,
10128
- timeEnd: timeEnd
10154
+ timeEnd: timeEnd,
10155
+ startWith: startWith
10129
10156
  }), processedRanges && processedRanges.length > 0 && /*#__PURE__*/React.createElement("div", {
10130
10157
  style: {
10131
10158
  marginTop: 12,
@@ -10213,6 +10240,7 @@ RangePicker.propTypes = {
10213
10240
  style: PropTypes.object,
10214
10241
  min: PropTypes.string,
10215
10242
  max: PropTypes.string,
10243
+ startWith: PropTypes.oneOf(["sunday", "monday"]),
10216
10244
  predefinedRanges: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string,
10217
10245
  // e.g., "today", "yesterday", "lastweek"
10218
10246
  PropTypes.number,