aq-fe-framework 0.1.452 → 0.1.454

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.
@@ -11,10 +11,10 @@ import { MRT_RowData, MRT_ColumnDef } from 'mantine-react-table';
11
11
  import { RichTextEditorProps, RichTextEditorToolbarProps, RichTextEditorContentProps } from '@mantine/tiptap';
12
12
  import { I as IBaseEntity } from '../IBaseEntity-BprRafT5.mjs';
13
13
 
14
- interface CoreActionIconProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ActionIconProps {
14
+ interface MyActionIconProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ActionIconProps {
15
15
  actionType?: type_action;
16
16
  }
17
- declare function MyActionIcon({ children, actionType, ...rest }: CoreActionIconProps): react_jsx_runtime.JSX.Element;
17
+ declare function MyActionIcon({ children, actionType, ...rest }: MyActionIconProps): react_jsx_runtime.JSX.Element;
18
18
 
19
19
  interface MyButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ButtonProps {
20
20
  actionType?: type_action;
@@ -41,13 +41,29 @@ interface CoreButtonCreateUpdateProps<IReq, IRes> {
41
41
  }
42
42
  declare function MyButtonCreateUpdate<IReq, IRes>({ modalProps, actionIconProps, buttonProps, form, onSubmit, onSuccess, onError, ignoreDefaultOnError, ignoreDefaultOnSuccess, closeModalWhenSubmit, resetFormWhenSubmit, children, disclosure: externalDisclosure, isUpdate, scrollAreaAutosizeProps }: CoreButtonCreateUpdateProps<IReq, IRes>): react_jsx_runtime.JSX.Element;
43
43
 
44
- interface CoreButtonModalProps {
44
+ interface IFieldStructure {
45
+ fieldCode?: string;
46
+ fieldName?: string;
47
+ }
48
+ interface MyButtonExportStructureProps {
49
+ data?: IFieldStructure[];
50
+ fileName?: string;
51
+ buttonProps?: ButtonProps;
52
+ }
53
+
54
+ interface MyButtonModalProps {
45
55
  children?: ReactNode;
46
56
  disclosure: ReturnType<typeof useDisclosure>;
47
- buttonProps?: ButtonProps;
48
- modalProps?: ModalProps;
57
+ buttonProps?: MyButtonProps;
58
+ actionIconProps?: MyActionIconProps;
59
+ modalProps?: Omit<ModalProps, "opened" | "onClose">;
60
+ isActionIcon?: boolean;
61
+ }
62
+ declare function MyButtonModal({ disclosure, children, buttonProps, actionIconProps, modalProps, isActionIcon }: MyButtonModalProps): react_jsx_runtime.JSX.Element;
63
+
64
+ interface MyButtonModalCreateUpdateProps extends Omit<MyButtonModalProps, "disclosure"> {
49
65
  }
50
- declare function MyButtonModal({ disclosure, children, buttonProps, modalProps, }: CoreButtonModalProps): react_jsx_runtime.JSX.Element;
66
+ declare function MyButtonModalCreateUpdate(props?: MyButtonModalCreateUpdateProps): react_jsx_runtime.JSX.Element;
51
67
 
52
68
  declare function MyDataTableSelectOne<TData extends MRT_RowData>({ columns, queryResult, idSelection, setIdSelection }: {
53
69
  columns: MRT_ColumnDef<TData>[];
@@ -151,4 +167,9 @@ interface IMyFlexColumn extends FlexProps {
151
167
  }
152
168
  declare function MyFlexColumn({ children, ...rest }: IMyFlexColumn): react_jsx_runtime.JSX.Element;
153
169
 
154
- export { type IWeeklySession, MyActionIcon, MyButton, MyButtonCreateUpdate, MyButtonModal, MyDataTableSelectOne, MyDayOfWeekPicker, MyFlexColumn, MyInfoBox, type MyInfoBoxItem, type MyInfoBoxProps, MyLabelValueRow, MyRichTextEditor, MySelect, MySelectFromAPI, type MySelectProps, MyStatsCard, MyTextInput, MyWeeklySessionSchedulerPicker, type WeeklySessionSchedulerProps };
170
+ interface MyFlexEndProps extends GroupProps {
171
+ children: ReactNode;
172
+ }
173
+ declare function MyFlexEnd({ children, ...rest }: MyFlexEndProps): react_jsx_runtime.JSX.Element;
174
+
175
+ export { type IWeeklySession, MyActionIcon, type MyActionIconProps, MyButton, MyButtonCreateUpdate, type MyButtonExportStructureProps, MyButtonModal, MyButtonModalCreateUpdate, type MyButtonModalProps, type MyButtonProps, MyDataTableSelectOne, MyDayOfWeekPicker, MyFlexColumn, MyFlexEnd, MyInfoBox, type MyInfoBoxItem, type MyInfoBoxProps, MyLabelValueRow, MyRichTextEditor, MySelect, MySelectFromAPI, type MySelectProps, MyStatsCard, MyTextInput, MyWeeklySessionSchedulerPicker, type WeeklySessionSchedulerProps };
@@ -3,9 +3,11 @@ import {
3
3
  MyButton,
4
4
  MyButtonCreateUpdate,
5
5
  MyButtonModal,
6
+ MyButtonModalCreateUpdate,
6
7
  MyDataTableSelectOne,
7
8
  MyDayOfWeekPicker,
8
9
  MyFlexColumn,
10
+ MyFlexEnd,
9
11
  MyInfoBox,
10
12
  MyLabelValueRow,
11
13
  MyRichTextEditor,
@@ -14,9 +16,11 @@ import {
14
16
  MyStatsCard,
15
17
  MyTextInput,
16
18
  MyWeeklySessionSchedulerPicker
17
- } from "../chunk-M6C567QA.mjs";
19
+ } from "../chunk-F32DBM65.mjs";
20
+ import "../chunk-562G3GRP.mjs";
21
+ import "../chunk-U62R2QKJ.mjs";
22
+ import "../chunk-5U2JSHSJ.mjs";
18
23
  import "../chunk-GFEMKKFH.mjs";
19
- import "../chunk-RZBHPPQT.mjs";
20
24
  import "../chunk-OMJJAHOC.mjs";
21
25
  import "../chunk-K6S7R6LU.mjs";
22
26
  import "../chunk-KFSAV44B.mjs";
@@ -27,9 +31,11 @@ export {
27
31
  MyButton,
28
32
  MyButtonCreateUpdate,
29
33
  MyButtonModal,
34
+ MyButtonModalCreateUpdate,
30
35
  MyDataTableSelectOne,
31
36
  MyDayOfWeekPicker,
32
37
  MyFlexColumn,
38
+ MyFlexEnd,
33
39
  MyInfoBox,
34
40
  MyLabelValueRow,
35
41
  MyRichTextEditor,
@@ -11,6 +11,11 @@ import {
11
11
  import {
12
12
  U0DateToDDMMYYYString
13
13
  } from "../chunk-EWDS5IOF.mjs";
14
+ import {
15
+ MyButton as MyButton2,
16
+ MyDataTableSelectOne,
17
+ MyTextInput as MyTextInput2
18
+ } from "../chunk-F32DBM65.mjs";
14
19
  import {
15
20
  F_authenticate_Logout,
16
21
  MyActionIconDelete,
@@ -21,10 +26,13 @@ import {
21
26
  MyButtonModal,
22
27
  MyButtonViewPDF,
23
28
  MyCenterFull,
29
+ MyDataTable,
24
30
  MyDateInput,
25
31
  MyFieldset,
26
32
  MyFileInput,
33
+ MyFlexColumn,
27
34
  MyFlexEnd,
35
+ MyFlexRow,
28
36
  MyNumberInput,
29
37
  MyPageContent,
30
38
  MySelect,
@@ -33,24 +41,14 @@ import {
33
41
  groupToTwoLevels,
34
42
  useS_authenticate,
35
43
  utils_layout_getItemsWithoutLinks
36
- } from "../chunk-WUXEUR7R.mjs";
44
+ } from "../chunk-562G3GRP.mjs";
37
45
  import {
38
46
  createGenericStore
39
47
  } from "../chunk-U62R2QKJ.mjs";
40
48
  import "../chunk-5U2JSHSJ.mjs";
41
- import {
42
- MyButton as MyButton2,
43
- MyDataTableSelectOne,
44
- MyTextInput as MyTextInput2
45
- } from "../chunk-M6C567QA.mjs";
46
49
  import {
47
50
  const_object_documentTypes
48
51
  } from "../chunk-GFEMKKFH.mjs";
49
- import {
50
- MyDataTable,
51
- MyFlexColumn,
52
- MyFlexRow
53
- } from "../chunk-RZBHPPQT.mjs";
54
52
  import {
55
53
  const_object_colors
56
54
  } from "../chunk-OMJJAHOC.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.452",
45
+ "version": "0.1.454",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"
@@ -1,178 +0,0 @@
1
- import {
2
- __objRest,
3
- __spreadProps,
4
- __spreadValues
5
- } from "./chunk-FWCSY2DS.mjs";
6
-
7
- // src/components/Layouts/FlexColumn/MyFlexColumn.tsx
8
- import { Flex } from "@mantine/core";
9
- import { jsx } from "react/jsx-runtime";
10
- function MyFlexColumn(_a) {
11
- var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
12
- return /* @__PURE__ */ jsx(Flex, __spreadProps(__spreadValues({ direction: "column", gap: "md" }, rest), { children }));
13
- }
14
-
15
- // src/components/DataDisplay/DataTable/MyDataTable.tsx
16
- import { Alert, Button, Center, Group, Portal, Text } from "@mantine/core";
17
- import { IconBug, IconDownload } from "@tabler/icons-react";
18
- import { download, generateCsv, mkConfig } from "export-to-csv";
19
- import {
20
- MantineReactTable,
21
- useMantineReactTable
22
- } from "mantine-react-table";
23
- import { MRT_Localization_VI } from "mantine-react-table/locales/vi/index.cjs";
24
- import { useEffect } from "react";
25
- import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
26
- function formatData(data, formats) {
27
- return data.map((row) => {
28
- const transformedRow = {};
29
- Object.entries(row).forEach(([key, value]) => {
30
- const formatFn = formats[key];
31
- if (value instanceof Date) {
32
- transformedRow[key] = formatFn ? formatFn(value.toISOString()) : value.toISOString();
33
- } else if (value !== null && typeof value === "object") {
34
- transformedRow[key] = formatFn ? formatFn(JSON.stringify(value)) : JSON.stringify(value);
35
- } else {
36
- transformedRow[key] = formatFn ? formatFn(value) : value;
37
- }
38
- });
39
- return transformedRow;
40
- });
41
- }
42
- function MyDataTable(_a) {
43
- var _b = _a, {
44
- formats = {},
45
- exportAble = false,
46
- csvConfigProps,
47
- rowActionSize,
48
- columns,
49
- data,
50
- renderTopToolbarCustomActions,
51
- setSelectedRow,
52
- isError,
53
- isLoading,
54
- pagination,
55
- initialState,
56
- state: state
57
- } = _b, rest = __objRest(_b, [
58
- "formats",
59
- "exportAble",
60
- "csvConfigProps",
61
- "rowActionSize",
62
- "columns",
63
- "data",
64
- "renderTopToolbarCustomActions",
65
- "setSelectedRow",
66
- "isError",
67
- "isLoading",
68
- "pagination",
69
- "initialState",
70
- // setPagination,
71
- "state"
72
- ]);
73
- const { renderRowActions } = __spreadValues({}, rest);
74
- const csvConfig = mkConfig(__spreadValues({
75
- fieldSeparator: ",",
76
- decimalSeparator: ".",
77
- useKeysAsHeaders: (csvConfigProps == null ? void 0 : csvConfigProps.columnHeaders) ? false : true
78
- }, csvConfigProps));
79
- const handleExport = (rows) => {
80
- if (rows.length == 0) {
81
- const transformedData = formatData(data, formats);
82
- const csv2 = generateCsv(csvConfig)(transformedData);
83
- download(csvConfig)(csv2);
84
- return;
85
- }
86
- const rowData = rows.map((row) => row.original);
87
- const transformedRows = formatData(rowData, formats);
88
- const csv = generateCsv(csvConfig)(transformedRows);
89
- download(csvConfig)(csv);
90
- };
91
- const table = useMantineReactTable(__spreadValues({
92
- columns,
93
- data,
94
- renderTopToolbarCustomActions: ({ table: table2 }) => {
95
- return /* @__PURE__ */ jsxs(Group, { children: [
96
- renderTopToolbarCustomActions && renderTopToolbarCustomActions({ table: table2 }),
97
- exportAble && /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(
98
- Button,
99
- {
100
- color: "green.8",
101
- onClick: () => handleExport(table2.getSelectedRowModel().rows),
102
- leftSection: /* @__PURE__ */ jsx2(IconDownload, {}),
103
- variant: "filled",
104
- children: "Export"
105
- }
106
- ) })
107
- ] });
108
- },
109
- manualPagination: pagination ? true : false,
110
- enableRowNumbers: true,
111
- enableRowSelection: exportAble,
112
- enableEditing: renderRowActions ? true : false,
113
- positionActionsColumn: "last",
114
- enableColumnResizing: true,
115
- layoutMode: "semantic",
116
- displayColumnDefOptions: {
117
- "mrt-row-actions": {
118
- header: "Thao t\xE1c",
119
- size: rowActionSize
120
- },
121
- "mrt-row-numbers": {
122
- Header: "STT",
123
- size: 1
124
- }
125
- },
126
- enableColumnPinning: true,
127
- initialState: __spreadValues(__spreadValues({
128
- density: "md",
129
- columnPinning: { right: ["mrt-row-actions"] },
130
- columnVisibility: {
131
- modifiedWhen: false,
132
- modifiedFullName: false
133
- }
134
- }, pagination ? {} : { pagination: { pageIndex: 0, pageSize: 30 } }), initialState),
135
- mantineTableHeadCellProps: {
136
- style: {
137
- verticalAlign: "middle",
138
- paddingTop: "2px",
139
- paddingBottom: "2px"
140
- }
141
- },
142
- mantineTableBodyCellProps: {
143
- style: {
144
- paddingTop: "2px",
145
- paddingBottom: "2px"
146
- }
147
- },
148
- localization: MRT_Localization_VI,
149
- renderEmptyRowsFallback: () => isError ? /* @__PURE__ */ jsx2(Alert, { icon: /* @__PURE__ */ jsx2(IconBug, {}), color: "red", title: "C\xF3 l\u1ED7i x\u1EA3y ra!", m: "md" }) : /* @__PURE__ */ jsxs(Center, { p: "md", children: [
150
- " ",
151
- /* @__PURE__ */ jsx2(Text, { c: "gray", fw: "600", size: "15px", fs: "italic", children: "Kh\xF4ng c\xF3 d\u1EEF li\u1EC7u!" })
152
- ] }),
153
- state: __spreadValues(__spreadValues({
154
- showSkeletons: isLoading
155
- }, pagination ? { pagination } : {}), state),
156
- mantineTableContainerProps: { style: { maxHeight: "65vh" } },
157
- enableStickyHeader: true
158
- }, rest));
159
- useEffect(() => {
160
- setSelectedRow && setSelectedRow(table.getSelectedRowModel().rows.map((row) => row.original));
161
- }, [table.getState().rowSelection]);
162
- if (data == void 0) return;
163
- return /* @__PURE__ */ jsx2("main", { style: { position: "relative", zIndex: 1 }, children: table.getState().isFullScreen ? /* @__PURE__ */ jsx2(Portal, { children: /* @__PURE__ */ jsx2(MantineReactTable, { table }) }) : /* @__PURE__ */ jsx2(MantineReactTable, { table }) });
164
- }
165
-
166
- // src/components/Layouts/FlexRow/MyFlexRow.tsx
167
- import { Flex as Flex2 } from "@mantine/core";
168
- import { jsx as jsx3 } from "react/jsx-runtime";
169
- function MyFlexRow(_a) {
170
- var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
171
- return /* @__PURE__ */ jsx3(Flex2, __spreadProps(__spreadValues({ gap: "md", align: "center" }, rest), { children }));
172
- }
173
-
174
- export {
175
- MyFlexColumn,
176
- MyDataTable,
177
- MyFlexRow
178
- };