aq-fe-framework 0.1.335 → 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.
@@ -429,12 +429,143 @@ function MySelect(_a) {
429
429
  );
430
430
  }
431
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
+
432
563
  // src/core/input/MyTextInput.tsx
433
564
  import { TextInput } from "@mantine/core";
434
- import { jsx as jsx10 } from "react/jsx-runtime";
565
+ import { jsx as jsx11 } from "react/jsx-runtime";
435
566
  function MyTextInput(_a) {
436
567
  var _b = _a, { label, isPhoneNumber } = _b, rest = __objRest(_b, ["label", "isPhoneNumber"]);
437
- return /* @__PURE__ */ jsx10(
568
+ return /* @__PURE__ */ jsx11(
438
569
  TextInput,
439
570
  __spreadValues({
440
571
  onKeyDown: (e) => {
@@ -475,7 +606,7 @@ import {
475
606
  } from "@mantine/core";
476
607
  import { IconPlus as IconPlus4, IconTrash as IconTrash3 } from "@tabler/icons-react";
477
608
  import { useState as useState2 } from "react";
478
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
609
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
479
610
  function MyWeeklySessionSchedulerPicker({
480
611
  value = [],
481
612
  onChange
@@ -506,8 +637,8 @@ function MyWeeklySessionSchedulerPicker({
506
637
  return acc;
507
638
  }, {});
508
639
  const getLabel = (day) => enum_daysOfWeek[day] || `Day ${day}`;
509
- return /* @__PURE__ */ jsx11(Paper, { w: "100%", p: "md", children: /* @__PURE__ */ jsxs5(MyFlexColumn, { children: [
510
- /* @__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(
511
642
  MyDayOfWeekPicker,
512
643
  {
513
644
  value: selectedDays,
@@ -517,41 +648,41 @@ function MyWeeklySessionSchedulerPicker({
517
648
  }
518
649
  }
519
650
  ) }),
520
- /* @__PURE__ */ jsx11(Divider, { my: "xs" }),
521
- /* @__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) => {
522
653
  var _a;
523
- return /* @__PURE__ */ jsxs5(
654
+ return /* @__PURE__ */ jsxs6(
524
655
  Paper,
525
656
  {
526
657
  w: "100%",
527
658
  p: "md",
528
659
  bg: const_object_colors.mantineBackgroundBlueLight,
529
660
  children: [
530
- /* @__PURE__ */ jsxs5(Group3, { gap: "apart", children: [
531
- /* @__PURE__ */ jsx11(Text3, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
532
- /* @__PURE__ */ jsx11(
661
+ /* @__PURE__ */ jsxs6(Group3, { gap: "apart", children: [
662
+ /* @__PURE__ */ jsx12(Text3, { w: "70px", fw: 500, children: getLabel(dayOfWeek) }),
663
+ /* @__PURE__ */ jsx12(
533
664
  Button5,
534
665
  {
535
666
  color: "teal.5",
536
- leftSection: /* @__PURE__ */ jsx11(IconPlus4, { size: 14 }),
667
+ leftSection: /* @__PURE__ */ jsx12(IconPlus4, { size: 14 }),
537
668
  onClick: () => handleAddSession(dayOfWeek),
538
669
  children: "Th\xEAm bu\u1ED5i"
539
670
  }
540
671
  )
541
672
  ] }),
542
- /* @__PURE__ */ jsx11(Divider, { my: "sm" }),
673
+ /* @__PURE__ */ jsx12(Divider, { my: "sm" }),
543
674
  (_a = grouped[dayOfWeek]) == null ? void 0 : _a.map((item, indexInDay) => {
544
675
  const globalIndex = value.findIndex(
545
676
  (v) => v === item
546
677
  );
547
- return /* @__PURE__ */ jsxs5(
678
+ return /* @__PURE__ */ jsxs6(
548
679
  Group3,
549
680
  {
550
681
  mt: "xs",
551
682
  gap: "xs",
552
683
  align: "flex-end",
553
684
  children: [
554
- /* @__PURE__ */ jsx11(
685
+ /* @__PURE__ */ jsx12(
555
686
  NumberInput,
556
687
  {
557
688
  label: "Ti\u1EBFt b\u1EAFt \u0111\u1EA7u",
@@ -563,7 +694,7 @@ function MyWeeklySessionSchedulerPicker({
563
694
  )
564
695
  }
565
696
  ),
566
- /* @__PURE__ */ jsx11(
697
+ /* @__PURE__ */ jsx12(
567
698
  NumberInput,
568
699
  {
569
700
  label: "S\u1ED1 ti\u1EBFt",
@@ -575,7 +706,7 @@ function MyWeeklySessionSchedulerPicker({
575
706
  )
576
707
  }
577
708
  ),
578
- /* @__PURE__ */ jsx11(
709
+ /* @__PURE__ */ jsx12(
579
710
  NumberInput,
580
711
  {
581
712
  label: "S\u1ED1 ph\xFAt ",
@@ -584,13 +715,13 @@ function MyWeeklySessionSchedulerPicker({
584
715
  value: item.durationMinutes
585
716
  }
586
717
  ),
587
- /* @__PURE__ */ jsx11(
718
+ /* @__PURE__ */ jsx12(
588
719
  Button5,
589
720
  {
590
721
  variant: "light",
591
722
  color: "red",
592
723
  onClick: () => handleRemove(globalIndex),
593
- leftSection: /* @__PURE__ */ jsx11(IconTrash3, { size: 14 }),
724
+ leftSection: /* @__PURE__ */ jsx12(IconTrash3, { size: 14 }),
594
725
  children: "X\xF3a bu\u1ED5i"
595
726
  }
596
727
  )
@@ -609,10 +740,10 @@ function MyWeeklySessionSchedulerPicker({
609
740
 
610
741
  // src/core/layout/MyFlexColumn.tsx
611
742
  import { Flex } from "@mantine/core";
612
- import { jsx as jsx12 } from "react/jsx-runtime";
743
+ import { jsx as jsx13 } from "react/jsx-runtime";
613
744
  function MyFlexColumn2(_a) {
614
745
  var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
615
- 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 }));
616
747
  }
617
748
 
618
749
  export {
@@ -625,6 +756,7 @@ export {
625
756
  MyStatsCard,
626
757
  MyDayOfWeekPicker,
627
758
  MySelect,
759
+ MyRichTextEditor,
628
760
  MyTextInput,
629
761
  MyWeeklySessionSchedulerPicker,
630
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 {
@@ -86,6 +87,15 @@ interface MySelectProps extends SelectProps {
86
87
  }
87
88
  declare function MySelect({ label, data, ...rest }: MySelectProps): react_jsx_runtime.JSX.Element;
88
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;
98
+
89
99
  interface CoreTextInputProps extends TextInputProps {
90
100
  label?: string;
91
101
  defaultValue?: string;
@@ -110,4 +120,4 @@ interface IMyFlexColumn extends FlexProps {
110
120
  }
111
121
  declare function MyFlexColumn({ children, ...rest }: IMyFlexColumn): react_jsx_runtime.JSX.Element;
112
122
 
113
- 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-SIHFFLRO.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,
@@ -2,10 +2,6 @@ export { I as IEmailConfig } from '../EmailConfig-Bza2PzTi.mjs';
2
2
  export { I as IAQModule } from '../IAQModule-DfONsRwE.mjs';
3
3
  import { I as IBaseEntity } from '../IBaseEntity-BprRafT5.mjs';
4
4
 
5
- interface IPageContent extends IBaseEntity {
6
- description?: string;
7
- }
8
-
9
5
  interface IFile {
10
6
  fileName?: string | undefined;
11
7
  fileExtension?: string | undefined;
@@ -55,4 +51,8 @@ interface IUser extends IBaseEntity {
55
51
  email?: string;
56
52
  }
57
53
 
54
+ interface IPageContent extends IBaseEntity {
55
+ description?: string;
56
+ }
57
+
58
58
  export { IBaseEntity, type IDocument, type IFile, type IPageContent, type IPagePermission, type IRole, type IUser };
@@ -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,17 +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
- import {
45
- enum_emailConfigModule
46
- } from "../chunk-VH4ZAD6M.mjs";
47
44
  import {
48
45
  MyButton as MyButton2,
49
46
  MyDataTableSelectOne,
50
47
  MyTextInput as MyTextInput2
51
- } from "../chunk-SIHFFLRO.mjs";
48
+ } from "../chunk-6WE24SWN.mjs";
52
49
  import {
53
50
  MyDataTable,
54
51
  MyFlexColumn,
@@ -57,6 +54,9 @@ import {
57
54
  import {
58
55
  const_object_colors
59
56
  } from "../chunk-NWBLJ3W3.mjs";
57
+ import {
58
+ enum_emailConfigModule
59
+ } from "../chunk-VH4ZAD6M.mjs";
60
60
  import "../chunk-K6S7R6LU.mjs";
61
61
  import {
62
62
  baseAxios_default,
@@ -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.335",
45
+ "version": "0.1.336",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"