aq-fe-framework 0.1.370 → 0.1.372

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.
@@ -10,7 +10,9 @@ import {
10
10
  enum_daysOfWeek
11
11
  } from "./chunk-K6S7R6LU.mjs";
12
12
  import {
13
- useMyReactMutation
13
+ baseAxios_default,
14
+ useMyReactMutation,
15
+ useMyReactQuery
14
16
  } from "./chunk-YQPDRFRL.mjs";
15
17
  import {
16
18
  utils_notification_show
@@ -585,26 +587,60 @@ function MyRichTextEditor(props) {
585
587
  import { Loader, Select } from "@mantine/core";
586
588
  import { jsx as jsx10 } from "react/jsx-runtime";
587
589
  function MySelect(_a) {
588
- var _b = _a, { label, data } = _b, rest = __objRest(_b, ["label", "data"]);
589
- const isLoading = data === void 0;
590
+ var _b = _a, { label, data, isLoading, isError } = _b, rest = __objRest(_b, ["label", "data", "isLoading", "isError"]);
591
+ let placeholder = "";
592
+ if (isError) {
593
+ placeholder = "\u0110\xE3 x\u1EA3y ra l\u1ED7i!";
594
+ } else if (isLoading) {
595
+ placeholder = "\u0110ang t\u1EA3i...";
596
+ } else if (label) {
597
+ placeholder = `Ch\u1ECDn ${label.toLowerCase()}`;
598
+ }
590
599
  return /* @__PURE__ */ jsx10(
591
600
  Select,
592
601
  __spreadValues({
593
602
  label,
594
- placeholder: isLoading ? "\u0110ang t\u1EA3i..." : label ? `Ch\u1ECDn ${label.toLowerCase()}` : "",
603
+ placeholder,
595
604
  data: data != null ? data : [],
605
+ error: isError ? true : void 0,
596
606
  rightSection: isLoading ? /* @__PURE__ */ jsx10(Loader, { size: "xs" }) : void 0,
597
- disabled: isLoading
607
+ disabled: isLoading || isError
598
608
  }, rest)
599
609
  );
600
610
  }
601
611
 
612
+ // src/core/input/MySelectAPI.tsx
613
+ import { jsx as jsx11 } from "react/jsx-runtime";
614
+ function MySelectAPI(props) {
615
+ var _a;
616
+ const query = useMyReactQuery({
617
+ queryKey: [props.controllerName + "/GetAll"],
618
+ axiosFn: () => {
619
+ return baseAxios_default.get(props.controllerName + "/GetAll");
620
+ }
621
+ });
622
+ return /* @__PURE__ */ jsx11(
623
+ MySelect,
624
+ {
625
+ isLoading: query.isLoading,
626
+ isError: query.isError,
627
+ data: (_a = query.data) == null ? void 0 : _a.map((item) => {
628
+ var _a2;
629
+ return {
630
+ value: (_a2 = item.id) == null ? void 0 : _a2.toString(),
631
+ label: item.name
632
+ };
633
+ })
634
+ }
635
+ );
636
+ }
637
+
602
638
  // src/core/input/MyTextInput.tsx
603
639
  import { TextInput } from "@mantine/core";
604
- import { jsx as jsx11 } from "react/jsx-runtime";
640
+ import { jsx as jsx12 } from "react/jsx-runtime";
605
641
  function MyTextInput(_a) {
606
642
  var _b = _a, { label, isPhoneNumber } = _b, rest = __objRest(_b, ["label", "isPhoneNumber"]);
607
- return /* @__PURE__ */ jsx11(
643
+ return /* @__PURE__ */ jsx12(
608
644
  TextInput,
609
645
  __spreadValues({
610
646
  onKeyDown: (e) => {
@@ -645,7 +681,7 @@ import {
645
681
  } from "@mantine/core";
646
682
  import { IconPlus as IconPlus4, IconTrash as IconTrash3 } from "@tabler/icons-react";
647
683
  import { useState } from "react";
648
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
684
+ import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
649
685
  function MyWeeklySessionSchedulerPicker({
650
686
  value = [],
651
687
  onChange
@@ -676,8 +712,8 @@ function MyWeeklySessionSchedulerPicker({
676
712
  return acc;
677
713
  }, {});
678
714
  const getLabel = (day) => enum_daysOfWeek[day] || `Day ${day}`;
679
- return /* @__PURE__ */ jsx12(Paper, { w: "100%", p: "md", children: /* @__PURE__ */ jsxs6(MyFlexColumn, { children: [
680
- /* @__PURE__ */ jsx12(Center, { children: /* @__PURE__ */ jsx12(
715
+ return /* @__PURE__ */ jsx13(Paper, { w: "100%", p: "md", children: /* @__PURE__ */ jsxs6(MyFlexColumn, { children: [
716
+ /* @__PURE__ */ jsx13(Center, { children: /* @__PURE__ */ jsx13(
681
717
  MyDayOfWeekPicker,
682
718
  {
683
719
  value: selectedDays,
@@ -687,8 +723,8 @@ function MyWeeklySessionSchedulerPicker({
687
723
  }
688
724
  }
689
725
  ) }),
690
- /* @__PURE__ */ jsx12(Divider, { my: "xs" }),
691
- /* @__PURE__ */ jsx12(Center, { children: /* @__PURE__ */ jsx12(ScrollArea3.Autosize, { h: "40vh", children: /* @__PURE__ */ jsx12(MyFlexColumn, { w: { base: "100%", sm: "70%" }, children: selectedDays.map((dayOfWeek) => {
726
+ /* @__PURE__ */ jsx13(Divider, { my: "xs" }),
727
+ /* @__PURE__ */ jsx13(Center, { children: /* @__PURE__ */ jsx13(ScrollArea3.Autosize, { h: "40vh", children: /* @__PURE__ */ jsx13(MyFlexColumn, { w: { base: "100%", sm: "70%" }, children: selectedDays.map((dayOfWeek) => {
692
728
  var _a;
693
729
  return /* @__PURE__ */ jsxs6(
694
730
  Paper,
@@ -698,18 +734,18 @@ function MyWeeklySessionSchedulerPicker({
698
734
  bg: const_object_colors.mantineBackgroundBlueLight,
699
735
  children: [
700
736
  /* @__PURE__ */ jsxs6(Group3, { gap: "apart", children: [
701
- /* @__PURE__ */ jsx12(Text3, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
702
- /* @__PURE__ */ jsx12(
737
+ /* @__PURE__ */ jsx13(Text3, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
738
+ /* @__PURE__ */ jsx13(
703
739
  Button5,
704
740
  {
705
741
  color: "teal.5",
706
- leftSection: /* @__PURE__ */ jsx12(IconPlus4, { size: 14 }),
742
+ leftSection: /* @__PURE__ */ jsx13(IconPlus4, { size: 14 }),
707
743
  onClick: () => handleAddSession(dayOfWeek),
708
744
  children: "Th\xEAm bu\u1ED5i"
709
745
  }
710
746
  )
711
747
  ] }),
712
- /* @__PURE__ */ jsx12(Divider, { my: "sm" }),
748
+ /* @__PURE__ */ jsx13(Divider, { my: "sm" }),
713
749
  (_a = grouped[dayOfWeek]) == null ? void 0 : _a.map((item, indexInDay) => {
714
750
  const globalIndex = value.findIndex(
715
751
  (v) => v === item
@@ -721,7 +757,7 @@ function MyWeeklySessionSchedulerPicker({
721
757
  gap: "xs",
722
758
  align: "flex-end",
723
759
  children: [
724
- /* @__PURE__ */ jsx12(
760
+ /* @__PURE__ */ jsx13(
725
761
  NumberInput,
726
762
  {
727
763
  label: "Ti\u1EBFt b\u1EAFt \u0111\u1EA7u",
@@ -733,7 +769,7 @@ function MyWeeklySessionSchedulerPicker({
733
769
  )
734
770
  }
735
771
  ),
736
- /* @__PURE__ */ jsx12(
772
+ /* @__PURE__ */ jsx13(
737
773
  NumberInput,
738
774
  {
739
775
  label: "S\u1ED1 ti\u1EBFt",
@@ -745,7 +781,7 @@ function MyWeeklySessionSchedulerPicker({
745
781
  )
746
782
  }
747
783
  ),
748
- /* @__PURE__ */ jsx12(
784
+ /* @__PURE__ */ jsx13(
749
785
  NumberInput,
750
786
  {
751
787
  label: "S\u1ED1 ph\xFAt ",
@@ -754,13 +790,13 @@ function MyWeeklySessionSchedulerPicker({
754
790
  value: item.durationMinutes
755
791
  }
756
792
  ),
757
- /* @__PURE__ */ jsx12(
793
+ /* @__PURE__ */ jsx13(
758
794
  Button5,
759
795
  {
760
796
  variant: "light",
761
797
  color: "red",
762
798
  onClick: () => handleRemove(globalIndex),
763
- leftSection: /* @__PURE__ */ jsx12(IconTrash3, { size: 14 }),
799
+ leftSection: /* @__PURE__ */ jsx13(IconTrash3, { size: 14 }),
764
800
  children: "X\xF3a bu\u1ED5i"
765
801
  }
766
802
  )
@@ -779,10 +815,10 @@ function MyWeeklySessionSchedulerPicker({
779
815
 
780
816
  // src/core/layout/MyFlexColumn.tsx
781
817
  import { Flex } from "@mantine/core";
782
- import { jsx as jsx13 } from "react/jsx-runtime";
818
+ import { jsx as jsx14 } from "react/jsx-runtime";
783
819
  function MyFlexColumn2(_a) {
784
820
  var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
785
- return /* @__PURE__ */ jsx13(Flex, __spreadProps(__spreadValues({ direction: "column", gap: "md" }, rest), { children }));
821
+ return /* @__PURE__ */ jsx14(Flex, __spreadProps(__spreadValues({ direction: "column", gap: "md" }, rest), { children }));
786
822
  }
787
823
 
788
824
  export {
@@ -796,6 +832,7 @@ export {
796
832
  MyDayOfWeekPicker,
797
833
  MyRichTextEditor,
798
834
  MySelect,
835
+ MySelectAPI,
799
836
  MyTextInput,
800
837
  MyWeeklySessionSchedulerPicker,
801
838
  MyFlexColumn2 as MyFlexColumn
@@ -98,8 +98,15 @@ interface MySelectProps extends SelectProps {
98
98
  value: string;
99
99
  label: string;
100
100
  }>;
101
+ isLoading?: boolean;
102
+ isError?: boolean;
101
103
  }
102
- declare function MySelect({ label, data, ...rest }: MySelectProps): react_jsx_runtime.JSX.Element;
104
+ declare function MySelect({ label, data, isLoading, isError, ...rest }: MySelectProps): react_jsx_runtime.JSX.Element;
105
+
106
+ interface MySelectAPIProps extends MySelectProps {
107
+ controllerName?: string;
108
+ }
109
+ declare function MySelectAPI(props: MySelectAPIProps): react_jsx_runtime.JSX.Element;
103
110
 
104
111
  interface CoreTextInputProps extends TextInputProps {
105
112
  label?: string;
@@ -125,4 +132,4 @@ interface IMyFlexColumn extends FlexProps {
125
132
  }
126
133
  declare function MyFlexColumn({ children, ...rest }: IMyFlexColumn): react_jsx_runtime.JSX.Element;
127
134
 
128
- export { type IWeeklySession, MyActionIcon, MyButton, MyButtonCreateUpdate, MyButtonModal, MyDataTableSelectOne, MyDayOfWeekPicker, MyFlexColumn, MyLabelValueRow, MyRichTextEditor, MySelect, MyStatsCard, MyTextInput, MyWeeklySessionSchedulerPicker, type WeeklySessionSchedulerProps };
135
+ export { type IWeeklySession, MyActionIcon, MyButton, MyButtonCreateUpdate, MyButtonModal, MyDataTableSelectOne, MyDayOfWeekPicker, MyFlexColumn, MyLabelValueRow, MyRichTextEditor, MySelect, MySelectAPI, type MySelectProps, MyStatsCard, MyTextInput, MyWeeklySessionSchedulerPicker, type WeeklySessionSchedulerProps };
@@ -9,10 +9,11 @@ import {
9
9
  MyLabelValueRow,
10
10
  MyRichTextEditor,
11
11
  MySelect,
12
+ MySelectAPI,
12
13
  MyStatsCard,
13
14
  MyTextInput,
14
15
  MyWeeklySessionSchedulerPicker
15
- } from "../chunk-YSSHMYFL.mjs";
16
+ } from "../chunk-KAIPXOLV.mjs";
16
17
  import "../chunk-GEYCGM75.mjs";
17
18
  import "../chunk-7ORPZMGL.mjs";
18
19
  import "../chunk-K6S7R6LU.mjs";
@@ -30,6 +31,7 @@ export {
30
31
  MyLabelValueRow,
31
32
  MyRichTextEditor,
32
33
  MySelect,
34
+ MySelectAPI,
33
35
  MyStatsCard,
34
36
  MyTextInput,
35
37
  MyWeeklySessionSchedulerPicker
@@ -11,6 +11,9 @@ import {
11
11
  import {
12
12
  U0DateToDDMMYYYString
13
13
  } from "../chunk-I2XIN2R3.mjs";
14
+ import {
15
+ const_object_documentTypes
16
+ } from "../chunk-BZMQOGL6.mjs";
14
17
  import {
15
18
  F_authenticate_Logout,
16
19
  MyActionIconDelete,
@@ -42,15 +45,12 @@ import {
42
45
  MyButton as MyButton2,
43
46
  MyDataTableSelectOne,
44
47
  MyTextInput as MyTextInput2
45
- } from "../chunk-YSSHMYFL.mjs";
48
+ } from "../chunk-KAIPXOLV.mjs";
46
49
  import {
47
50
  MyDataTable,
48
51
  MyFlexColumn,
49
52
  MyFlexRow
50
53
  } from "../chunk-GEYCGM75.mjs";
51
- import {
52
- const_object_documentTypes
53
- } from "../chunk-BZMQOGL6.mjs";
54
54
  import {
55
55
  const_object_colors
56
56
  } from "../chunk-7ORPZMGL.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.370",
45
+ "version": "0.1.372",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"