aq-fe-framework 0.1.425 → 0.1.427

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.
@@ -124,14 +124,14 @@ function MyDataTable(_a) {
124
124
  }
125
125
  },
126
126
  enableColumnPinning: true,
127
- initialState: __spreadValues({
127
+ initialState: __spreadValues(__spreadValues({
128
128
  density: "md",
129
129
  columnPinning: { right: ["mrt-row-actions"] },
130
130
  columnVisibility: {
131
131
  modifiedWhen: false,
132
132
  modifiedFullName: false
133
133
  }
134
- }, initialState),
134
+ }, pagination ? {} : { pagination: { pageIndex: 0, pageSize: 30 } }), initialState),
135
135
  mantineTableHeadCellProps: {
136
136
  style: {
137
137
  verticalAlign: "middle",
@@ -2,7 +2,7 @@ import {
2
2
  MyDataTable,
3
3
  MyFlexColumn,
4
4
  MyFlexRow
5
- } from "./chunk-GEYCGM75.mjs";
5
+ } from "./chunk-4D56CCJQ.mjs";
6
6
  import {
7
7
  const_object_colors
8
8
  } from "./chunk-OMJJAHOC.mjs";
@@ -625,7 +625,7 @@ function MySelect(_a) {
625
625
  }
626
626
 
627
627
  // src/core/input/MySelectFromAPI.tsx
628
- import { useEffect as useEffect3, useMemo as useMemo2 } from "react";
628
+ import { useEffect as useEffect3, useMemo as useMemo2, useRef } from "react";
629
629
  import { jsx as jsx12 } from "react/jsx-runtime";
630
630
  function MySelectFromAPI(_a) {
631
631
  var _b = _a, {
@@ -660,9 +660,10 @@ function MySelectFromAPI(_a) {
660
660
  };
661
661
  })) != null ? _a2 : [];
662
662
  }, [query.data]);
663
- const handleChange = (value2, options2) => {
663
+ const hasAutoSelected = useRef(false);
664
+ const handleChange = (value2, option) => {
664
665
  var _a2;
665
- onChange == null ? void 0 : onChange(value2, options2);
666
+ onChange == null ? void 0 : onChange(value2, option);
666
667
  if (setObjectData) {
667
668
  const selected = (_a2 = query.data) == null ? void 0 : _a2.find((item) => {
668
669
  var _a3;
@@ -673,30 +674,22 @@ function MySelectFromAPI(_a) {
673
674
  };
674
675
  useEffect3(() => {
675
676
  var _a2, _b2, _c;
676
- if (autoSelectFirstItem && query.data && query.data.length > 0) {
677
+ if (autoSelectFirstItem && !hasAutoSelected.current && query.data && query.data.length > 0 && (value === void 0 || value === null || value === "")) {
677
678
  const firstItem = query.data[0];
678
- const value2 = (_b2 = (_a2 = firstItem.id) == null ? void 0 : _a2.toString()) != null ? _b2 : "";
679
+ const val = (_b2 = (_a2 = firstItem.id) == null ? void 0 : _a2.toString()) != null ? _b2 : "";
679
680
  const label = labelWithCode ? `${firstItem.code} - ${firstItem.name}` : (_c = firstItem.name) != null ? _c : "";
680
- onChange == null ? void 0 : onChange(value2, { value: value2, label });
681
+ onChange == null ? void 0 : onChange(val, { value: val, label });
681
682
  setObjectData == null ? void 0 : setObjectData(firstItem);
683
+ hasAutoSelected.current = true;
682
684
  }
683
- }, [query.data, autoSelectFirstItem]);
684
- useEffect3(() => {
685
- if (value && setObjectData && query.data) {
686
- const selected = query.data.find((item) => {
687
- var _a2;
688
- return ((_a2 = item.id) == null ? void 0 : _a2.toString()) === value;
689
- });
690
- setObjectData(selected);
691
- }
692
- }, [value, query.data]);
685
+ }, [autoSelectFirstItem, query.data, labelWithCode, onChange, setObjectData, value]);
693
686
  return /* @__PURE__ */ jsx12(
694
687
  MySelect,
695
688
  __spreadValues({
696
689
  isLoading: query.isLoading,
697
690
  isError: query.isError,
698
691
  data: options,
699
- onChange: (value2, options2) => handleChange == null ? void 0 : handleChange(value2, options2),
692
+ onChange: (value2, option) => handleChange(value2, option),
700
693
  value
701
694
  }, rest)
702
695
  );
@@ -8,7 +8,7 @@ import {
8
8
  MyDataTable,
9
9
  MyFlexColumn,
10
10
  MyFlexRow
11
- } from "./chunk-GEYCGM75.mjs";
11
+ } from "./chunk-4D56CCJQ.mjs";
12
12
  import {
13
13
  const_object_colors
14
14
  } from "./chunk-OMJJAHOC.mjs";
@@ -62,14 +62,14 @@ import {
62
62
  useS_BasicAppShell,
63
63
  useS_ButtonImport,
64
64
  utils_layout_getItemsWithoutLinks
65
- } from "../chunk-DZXMICDD.mjs";
65
+ } from "../chunk-QTCQC4KB.mjs";
66
66
  import "../chunk-Y3YGC5IH.mjs";
67
67
  import "../chunk-5U2JSHSJ.mjs";
68
68
  import {
69
69
  MyDataTable,
70
70
  MyFlexColumn,
71
71
  MyFlexRow
72
- } from "../chunk-GEYCGM75.mjs";
72
+ } from "../chunk-4D56CCJQ.mjs";
73
73
  import "../chunk-OMJJAHOC.mjs";
74
74
  import "../chunk-PRN7KYPD.mjs";
75
75
  import "../chunk-7ZCOFATU.mjs";
@@ -13,8 +13,8 @@ import {
13
13
  MyStatsCard,
14
14
  MyTextInput,
15
15
  MyWeeklySessionSchedulerPicker
16
- } from "../chunk-MAFELZRY.mjs";
17
- import "../chunk-GEYCGM75.mjs";
16
+ } from "../chunk-DLXRXSZH.mjs";
17
+ import "../chunk-4D56CCJQ.mjs";
18
18
  import "../chunk-GFEMKKFH.mjs";
19
19
  import "../chunk-OMJJAHOC.mjs";
20
20
  import "../chunk-K6S7R6LU.mjs";
@@ -33,7 +33,7 @@ import {
33
33
  groupToTwoLevels,
34
34
  useS_authenticate,
35
35
  utils_layout_getItemsWithoutLinks
36
- } from "../chunk-DZXMICDD.mjs";
36
+ } from "../chunk-QTCQC4KB.mjs";
37
37
  import {
38
38
  createGenericStore
39
39
  } from "../chunk-Y3YGC5IH.mjs";
@@ -42,12 +42,12 @@ import {
42
42
  MyButton as MyButton2,
43
43
  MyDataTableSelectOne,
44
44
  MyTextInput as MyTextInput2
45
- } from "../chunk-MAFELZRY.mjs";
45
+ } from "../chunk-DLXRXSZH.mjs";
46
46
  import {
47
47
  MyDataTable,
48
48
  MyFlexColumn,
49
49
  MyFlexRow
50
- } from "../chunk-GEYCGM75.mjs";
50
+ } from "../chunk-4D56CCJQ.mjs";
51
51
  import {
52
52
  const_object_documentTypes
53
53
  } from "../chunk-GFEMKKFH.mjs";
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/columns/index.d.mts"
43
43
  }
44
44
  },
45
- "version": "0.1.425",
45
+ "version": "0.1.427",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"