aq-fe-framework 0.1.334 → 0.1.336

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.
@@ -415,25 +415,157 @@ function MyDayOfWeekPicker({ value = [], onChange }) {
415
415
  import { Loader, Select } from "@mantine/core";
416
416
  import { jsx as jsx9 } from "react/jsx-runtime";
417
417
  function MySelect(_a) {
418
- var _b = _a, { label, data, isLoading } = _b, rest = __objRest(_b, ["label", "data", "isLoading"]);
418
+ var _b = _a, { label, data } = _b, rest = __objRest(_b, ["label", "data"]);
419
+ const isLoading = data === void 0;
419
420
  return /* @__PURE__ */ jsx9(
420
421
  Select,
421
422
  __spreadValues({
422
423
  label,
423
- placeholder: label ? `Ch\u1ECDn ${label.toLowerCase()}` : "",
424
- data,
424
+ placeholder: isLoading ? "\u0110ang t\u1EA3i..." : label ? `Ch\u1ECDn ${label.toLowerCase()}` : "",
425
+ data: data != null ? data : [],
425
426
  rightSection: isLoading ? /* @__PURE__ */ jsx9(Loader, { size: "xs" }) : void 0,
426
427
  disabled: isLoading
427
428
  }, rest)
428
429
  );
429
430
  }
430
431
 
432
+ // src/core/input/MyTextEditor.tsx
433
+ import { Link, RichTextEditor as MantineRichTextEditor } from "@mantine/tiptap";
434
+ import FileHandler from "@tiptap-pro/extension-file-handler";
435
+ import Highlight from "@tiptap/extension-highlight";
436
+ import Image from "@tiptap/extension-image";
437
+ import SubScript from "@tiptap/extension-subscript";
438
+ import Superscript from "@tiptap/extension-superscript";
439
+ import TextAlign from "@tiptap/extension-text-align";
440
+ import Underline from "@tiptap/extension-underline";
441
+ import { useEditor } from "@tiptap/react";
442
+ import StarterKit from "@tiptap/starter-kit";
443
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
444
+ function MyRichTextEditor({
445
+ value,
446
+ onChange,
447
+ richTextEditorProps,
448
+ richTextEditorToolBarProps,
449
+ richTextEditorContentProps
450
+ }) {
451
+ const editor = useEditor({
452
+ extensions: [
453
+ StarterKit,
454
+ Underline,
455
+ Link,
456
+ Superscript,
457
+ SubScript,
458
+ Highlight,
459
+ Image.extend({
460
+ addAttributes() {
461
+ return {
462
+ src: {
463
+ default: null
464
+ },
465
+ alt: {
466
+ default: null
467
+ }
468
+ };
469
+ },
470
+ parseHTML() {
471
+ return [
472
+ {
473
+ tag: "img[src]"
474
+ }
475
+ ];
476
+ },
477
+ renderHTML({ HTMLAttributes }) {
478
+ return ["img", HTMLAttributes];
479
+ }
480
+ }),
481
+ TextAlign.configure({ types: ["heading", "paragraph"] }),
482
+ FileHandler.configure({
483
+ allowedMimeTypes: ["image/png", "image/jpeg", "image/gif", "image/webp"],
484
+ onDrop: (currentEditor, files, pos) => {
485
+ files.forEach((file) => {
486
+ const fileReader = new FileReader();
487
+ fileReader.readAsDataURL(file);
488
+ fileReader.onload = () => {
489
+ currentEditor.chain().insertContentAt(pos, {
490
+ type: "image",
491
+ attrs: {
492
+ src: fileReader.result
493
+ }
494
+ }).focus().run();
495
+ };
496
+ });
497
+ },
498
+ onPaste: (currentEditor, files, htmlContent) => {
499
+ files.forEach((file) => {
500
+ if (htmlContent) {
501
+ console.log(htmlContent);
502
+ return false;
503
+ }
504
+ const fileReader = new FileReader();
505
+ fileReader.readAsDataURL(file);
506
+ fileReader.onload = () => {
507
+ currentEditor.chain().insertContentAt(currentEditor.state.selection.anchor, {
508
+ type: "image",
509
+ attrs: {
510
+ src: fileReader.result
511
+ }
512
+ }).focus().run();
513
+ };
514
+ });
515
+ }
516
+ })
517
+ ],
518
+ content: value,
519
+ onUpdate: ({ editor: editor2 }) => {
520
+ onChange(editor2.getHTML());
521
+ }
522
+ });
523
+ return /* @__PURE__ */ jsxs5(MantineRichTextEditor, __spreadProps(__spreadValues({ editor }, richTextEditorProps), { children: [
524
+ /* @__PURE__ */ jsxs5(MantineRichTextEditor.Toolbar, __spreadProps(__spreadValues({ sticky: true, stickyOffset: 60 }, richTextEditorToolBarProps), { children: [
525
+ /* @__PURE__ */ jsxs5(MantineRichTextEditor.ControlsGroup, { children: [
526
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Bold, {}),
527
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Italic, {}),
528
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Underline, {}),
529
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Strikethrough, {}),
530
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.ClearFormatting, {}),
531
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Highlight, {}),
532
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Code, {})
533
+ ] }),
534
+ /* @__PURE__ */ jsxs5(MantineRichTextEditor.ControlsGroup, { children: [
535
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.H1, {}),
536
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.H2, {}),
537
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.H3, {}),
538
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.H4, {})
539
+ ] }),
540
+ /* @__PURE__ */ jsxs5(MantineRichTextEditor.ControlsGroup, { children: [
541
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Blockquote, {}),
542
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Hr, {}),
543
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.BulletList, {}),
544
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.OrderedList, {}),
545
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Subscript, {}),
546
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Superscript, {})
547
+ ] }),
548
+ /* @__PURE__ */ jsxs5(MantineRichTextEditor.ControlsGroup, { children: [
549
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Link, {}),
550
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Unlink, {})
551
+ ] }),
552
+ /* @__PURE__ */ jsxs5(MantineRichTextEditor.ControlsGroup, { children: [
553
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.AlignLeft, {}),
554
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.AlignCenter, {}),
555
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.AlignJustify, {}),
556
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.AlignRight, {})
557
+ ] })
558
+ ] })),
559
+ /* @__PURE__ */ jsx10(MantineRichTextEditor.Content, __spreadValues({}, richTextEditorContentProps))
560
+ ] }));
561
+ }
562
+
431
563
  // src/core/input/MyTextInput.tsx
432
564
  import { TextInput } from "@mantine/core";
433
- import { jsx as jsx10 } from "react/jsx-runtime";
565
+ import { jsx as jsx11 } from "react/jsx-runtime";
434
566
  function MyTextInput(_a) {
435
567
  var _b = _a, { label, isPhoneNumber } = _b, rest = __objRest(_b, ["label", "isPhoneNumber"]);
436
- return /* @__PURE__ */ jsx10(
568
+ return /* @__PURE__ */ jsx11(
437
569
  TextInput,
438
570
  __spreadValues({
439
571
  onKeyDown: (e) => {
@@ -474,7 +606,7 @@ import {
474
606
  } from "@mantine/core";
475
607
  import { IconPlus as IconPlus4, IconTrash as IconTrash3 } from "@tabler/icons-react";
476
608
  import { useState as useState2 } from "react";
477
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
609
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
478
610
  function MyWeeklySessionSchedulerPicker({
479
611
  value = [],
480
612
  onChange
@@ -505,8 +637,8 @@ function MyWeeklySessionSchedulerPicker({
505
637
  return acc;
506
638
  }, {});
507
639
  const getLabel = (day) => enum_daysOfWeek[day] || `Day ${day}`;
508
- return /* @__PURE__ */ jsx11(Paper, { w: "100%", p: "md", children: /* @__PURE__ */ jsxs5(MyFlexColumn, { children: [
509
- /* @__PURE__ */ jsx11(Center, { children: /* @__PURE__ */ jsx11(
640
+ return /* @__PURE__ */ jsx12(Paper, { w: "100%", p: "md", children: /* @__PURE__ */ jsxs6(MyFlexColumn, { children: [
641
+ /* @__PURE__ */ jsx12(Center, { children: /* @__PURE__ */ jsx12(
510
642
  MyDayOfWeekPicker,
511
643
  {
512
644
  value: selectedDays,
@@ -516,41 +648,41 @@ function MyWeeklySessionSchedulerPicker({
516
648
  }
517
649
  }
518
650
  ) }),
519
- /* @__PURE__ */ jsx11(Divider, { my: "xs" }),
520
- /* @__PURE__ */ jsx11(Center, { children: /* @__PURE__ */ jsx11(ScrollArea.Autosize, { h: "40vh", children: /* @__PURE__ */ jsx11(MyFlexColumn, { w: { base: "100%", sm: "70%" }, children: selectedDays.map((dayOfWeek) => {
651
+ /* @__PURE__ */ jsx12(Divider, { my: "xs" }),
652
+ /* @__PURE__ */ jsx12(Center, { children: /* @__PURE__ */ jsx12(ScrollArea.Autosize, { h: "40vh", children: /* @__PURE__ */ jsx12(MyFlexColumn, { w: { base: "100%", sm: "70%" }, children: selectedDays.map((dayOfWeek) => {
521
653
  var _a;
522
- return /* @__PURE__ */ jsxs5(
654
+ return /* @__PURE__ */ jsxs6(
523
655
  Paper,
524
656
  {
525
657
  w: "100%",
526
658
  p: "md",
527
659
  bg: const_object_colors.mantineBackgroundBlueLight,
528
660
  children: [
529
- /* @__PURE__ */ jsxs5(Group3, { gap: "apart", children: [
530
- /* @__PURE__ */ jsx11(Text3, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
531
- /* @__PURE__ */ jsx11(
661
+ /* @__PURE__ */ jsxs6(Group3, { gap: "apart", children: [
662
+ /* @__PURE__ */ jsx12(Text3, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
663
+ /* @__PURE__ */ jsx12(
532
664
  Button5,
533
665
  {
534
666
  color: "teal.5",
535
- leftSection: /* @__PURE__ */ jsx11(IconPlus4, { size: 14 }),
667
+ leftSection: /* @__PURE__ */ jsx12(IconPlus4, { size: 14 }),
536
668
  onClick: () => handleAddSession(dayOfWeek),
537
669
  children: "Th\xEAm bu\u1ED5i"
538
670
  }
539
671
  )
540
672
  ] }),
541
- /* @__PURE__ */ jsx11(Divider, { my: "sm" }),
673
+ /* @__PURE__ */ jsx12(Divider, { my: "sm" }),
542
674
  (_a = grouped[dayOfWeek]) == null ? void 0 : _a.map((item, indexInDay) => {
543
675
  const globalIndex = value.findIndex(
544
676
  (v) => v === item
545
677
  );
546
- return /* @__PURE__ */ jsxs5(
678
+ return /* @__PURE__ */ jsxs6(
547
679
  Group3,
548
680
  {
549
681
  mt: "xs",
550
682
  gap: "xs",
551
683
  align: "flex-end",
552
684
  children: [
553
- /* @__PURE__ */ jsx11(
685
+ /* @__PURE__ */ jsx12(
554
686
  NumberInput,
555
687
  {
556
688
  label: "Ti\u1EBFt b\u1EAFt \u0111\u1EA7u",
@@ -562,7 +694,7 @@ function MyWeeklySessionSchedulerPicker({
562
694
  )
563
695
  }
564
696
  ),
565
- /* @__PURE__ */ jsx11(
697
+ /* @__PURE__ */ jsx12(
566
698
  NumberInput,
567
699
  {
568
700
  label: "S\u1ED1 ti\u1EBFt",
@@ -574,7 +706,7 @@ function MyWeeklySessionSchedulerPicker({
574
706
  )
575
707
  }
576
708
  ),
577
- /* @__PURE__ */ jsx11(
709
+ /* @__PURE__ */ jsx12(
578
710
  NumberInput,
579
711
  {
580
712
  label: "S\u1ED1 ph\xFAt ",
@@ -583,13 +715,13 @@ function MyWeeklySessionSchedulerPicker({
583
715
  value: item.durationMinutes
584
716
  }
585
717
  ),
586
- /* @__PURE__ */ jsx11(
718
+ /* @__PURE__ */ jsx12(
587
719
  Button5,
588
720
  {
589
721
  variant: "light",
590
722
  color: "red",
591
723
  onClick: () => handleRemove(globalIndex),
592
- leftSection: /* @__PURE__ */ jsx11(IconTrash3, { size: 14 }),
724
+ leftSection: /* @__PURE__ */ jsx12(IconTrash3, { size: 14 }),
593
725
  children: "X\xF3a bu\u1ED5i"
594
726
  }
595
727
  )
@@ -608,10 +740,10 @@ function MyWeeklySessionSchedulerPicker({
608
740
 
609
741
  // src/core/layout/MyFlexColumn.tsx
610
742
  import { Flex } from "@mantine/core";
611
- import { jsx as jsx12 } from "react/jsx-runtime";
743
+ import { jsx as jsx13 } from "react/jsx-runtime";
612
744
  function MyFlexColumn2(_a) {
613
745
  var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
614
- return /* @__PURE__ */ jsx12(Flex, __spreadProps(__spreadValues({ direction: "column", gap: "md" }, rest), { children }));
746
+ return /* @__PURE__ */ jsx13(Flex, __spreadProps(__spreadValues({ direction: "column", gap: "md" }, rest), { children }));
615
747
  }
616
748
 
617
749
  export {
@@ -624,6 +756,7 @@ export {
624
756
  MyStatsCard,
625
757
  MyDayOfWeekPicker,
626
758
  MySelect,
759
+ MyRichTextEditor,
627
760
  MyTextInput,
628
761
  MyWeeklySessionSchedulerPicker,
629
762
  MyFlexColumn2 as MyFlexColumn
@@ -8,6 +8,7 @@ import { UseFormReturnType } from '@mantine/form';
8
8
  import { useDisclosure } from '@mantine/hooks';
9
9
  import { UseQueryResult } from '@tanstack/react-query';
10
10
  import { MRT_RowData, MRT_ColumnDef } from 'mantine-react-table';
11
+ import { RichTextEditorProps, RichTextEditorToolbarProps, RichTextEditorContentProps } from '@mantine/tiptap';
11
12
  import '../IBaseEntity-BprRafT5.mjs';
12
13
 
13
14
  interface CoreActionIconProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ActionIconProps {
@@ -79,13 +80,21 @@ declare function MyDayOfWeekPicker({ value, onChange }: CoreDayOfWeekPickerProps
79
80
 
80
81
  interface MySelectProps extends SelectProps {
81
82
  label?: string;
82
- data: Array<string | {
83
+ data?: Array<string | {
83
84
  value: string;
84
85
  label: string;
85
86
  }>;
86
- isLoading?: boolean;
87
87
  }
88
- declare function MySelect({ label, data, isLoading, ...rest }: MySelectProps): react_jsx_runtime.JSX.Element;
88
+ declare function MySelect({ label, data, ...rest }: MySelectProps): react_jsx_runtime.JSX.Element;
89
+
90
+ interface MyRichTextEditorProps {
91
+ value: string;
92
+ onChange: (value: string) => void;
93
+ richTextEditorProps?: RichTextEditorProps;
94
+ richTextEditorToolBarProps?: RichTextEditorToolbarProps;
95
+ richTextEditorContentProps?: RichTextEditorContentProps;
96
+ }
97
+ declare function MyRichTextEditor({ value, onChange, richTextEditorProps, richTextEditorToolBarProps, richTextEditorContentProps }: MyRichTextEditorProps): react_jsx_runtime.JSX.Element;
89
98
 
90
99
  interface CoreTextInputProps extends TextInputProps {
91
100
  label?: string;
@@ -111,4 +120,4 @@ interface IMyFlexColumn extends FlexProps {
111
120
  }
112
121
  declare function MyFlexColumn({ children, ...rest }: IMyFlexColumn): react_jsx_runtime.JSX.Element;
113
122
 
114
- export { type IWeeklySession, MyActionIcon, MyButton, MyButtonCreateUpdate, MyButtonModal, MyDataTableSelectOne, MyDayOfWeekPicker, MyFlexColumn, MyLabelValueRow, MySelect, MyStatsCard, MyTextInput, MyWeeklySessionSchedulerPicker, type WeeklySessionSchedulerProps };
123
+ export { type IWeeklySession, MyActionIcon, MyButton, MyButtonCreateUpdate, MyButtonModal, MyDataTableSelectOne, MyDayOfWeekPicker, MyFlexColumn, MyLabelValueRow, MyRichTextEditor, MySelect, MyStatsCard, MyTextInput, MyWeeklySessionSchedulerPicker, type WeeklySessionSchedulerProps };
@@ -7,11 +7,12 @@ import {
7
7
  MyDayOfWeekPicker,
8
8
  MyFlexColumn,
9
9
  MyLabelValueRow,
10
+ MyRichTextEditor,
10
11
  MySelect,
11
12
  MyStatsCard,
12
13
  MyTextInput,
13
14
  MyWeeklySessionSchedulerPicker
14
- } from "../chunk-W73H7SCD.mjs";
15
+ } from "../chunk-6WE24SWN.mjs";
15
16
  import "../chunk-GEYCGM75.mjs";
16
17
  import "../chunk-NWBLJ3W3.mjs";
17
18
  import "../chunk-K6S7R6LU.mjs";
@@ -27,6 +28,7 @@ export {
27
28
  MyDayOfWeekPicker,
28
29
  MyFlexColumn,
29
30
  MyLabelValueRow,
31
+ MyRichTextEditor,
30
32
  MySelect,
31
33
  MyStatsCard,
32
34
  MyTextInput,
@@ -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,
@@ -38,14 +41,11 @@ import {
38
41
  createGenericStore
39
42
  } from "../chunk-Y3YGC5IH.mjs";
40
43
  import "../chunk-5U2JSHSJ.mjs";
41
- import {
42
- const_object_documentTypes
43
- } from "../chunk-BZMQOGL6.mjs";
44
44
  import {
45
45
  MyButton as MyButton2,
46
46
  MyDataTableSelectOne,
47
47
  MyTextInput as MyTextInput2
48
- } from "../chunk-W73H7SCD.mjs";
48
+ } from "../chunk-6WE24SWN.mjs";
49
49
  import {
50
50
  MyDataTable,
51
51
  MyFlexColumn,
@@ -1023,6 +1023,7 @@ function F_accountManagement_Create() {
1023
1023
  });
1024
1024
  async function handleSubmit() {
1025
1025
  return await baseAxios_default.post(ENDPOINT, __spreadProps(__spreadValues({}, form.getValues()), {
1026
+ code: form.getValues().userName,
1026
1027
  passwordHash: "",
1027
1028
  id: 0,
1028
1029
  address: "",
@@ -1039,7 +1040,6 @@ function F_accountManagement_Create() {
1039
1040
  }));
1040
1041
  }
1041
1042
  return /* @__PURE__ */ jsxs6(MyButtonCreate, { form, onSubmit: handleSubmit, objectName: "ng\u01B0\u1EDDi d\xF9ng", children: [
1042
- /* @__PURE__ */ jsx10(MyTextInput, __spreadValues({ label: "M\xE3 t\xE0i kho\u1EA3n" }, form.getInputProps("code"))),
1043
1043
  /* @__PURE__ */ jsx10(MyTextInput, __spreadValues({ label: "T\xEAn t\xE0i kho\u1EA3n" }, form.getInputProps("userName"))),
1044
1044
  /* @__PURE__ */ jsx10(MyTextInput, __spreadValues({ label: "M\u1EADt kh\u1EA9u" }, form.getInputProps("password"))),
1045
1045
  /* @__PURE__ */ jsx10(MyTextInput, __spreadValues({ label: "H\u1ECD v\xE0 t\xEAn" }, form.getInputProps("fullName"))),
@@ -1123,7 +1123,6 @@ function F_accountManagement_Update({ user }) {
1123
1123
  })
1124
1124
  );
1125
1125
  }, children: /* @__PURE__ */ jsxs7(MyFlexColumn, { children: [
1126
- /* @__PURE__ */ jsx12(MyTextInput, __spreadValues({ disabled: true, label: "M\xE3 t\xE0i kho\u1EA3n" }, form.getInputProps("code"))),
1127
1126
  /* @__PURE__ */ jsx12(MyTextInput, __spreadValues({ disabled: true, label: "T\xEAn t\xE0i kho\u1EA3n" }, form.getInputProps("userName"))),
1128
1127
  /* @__PURE__ */ jsx12(MyTextInput, __spreadValues({ label: "H\u1ECD v\xE0 t\xEAn" }, form.getInputProps("fullName"))),
1129
1128
  /* @__PURE__ */ jsx12(MyTextInput, __spreadValues({ label: "Email" }, form.getInputProps("email"))),
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/columns/index.d.mts"
43
43
  }
44
44
  },
45
- "version": "0.1.334",
45
+ "version": "0.1.336",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"