aq-fe-framework 0.1.451 → 0.1.453

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.
@@ -6,11 +6,10 @@ import {
6
6
  utils_file_fileToAQDocumentType
7
7
  } from "../chunk-J7PZ4DWS.mjs";
8
8
  import {
9
- baseColumns
10
- } from "../chunk-BEFEWY44.mjs";
11
- import {
12
- U0DateToDDMMYYYString
13
- } from "../chunk-EWDS5IOF.mjs";
9
+ MyButton as MyButton2,
10
+ MyDataTableSelectOne,
11
+ MyTextInput as MyTextInput2
12
+ } from "../chunk-M4NVNBCO.mjs";
14
13
  import {
15
14
  F_authenticate_Logout,
16
15
  MyActionIconDelete,
@@ -21,10 +20,13 @@ import {
21
20
  MyButtonModal,
22
21
  MyButtonViewPDF,
23
22
  MyCenterFull,
23
+ MyDataTable,
24
24
  MyDateInput,
25
25
  MyFieldset,
26
26
  MyFileInput,
27
+ MyFlexColumn,
27
28
  MyFlexEnd,
29
+ MyFlexRow,
28
30
  MyNumberInput,
29
31
  MyPageContent,
30
32
  MySelect,
@@ -33,27 +35,23 @@ import {
33
35
  groupToTwoLevels,
34
36
  useS_authenticate,
35
37
  utils_layout_getItemsWithoutLinks
36
- } from "../chunk-2NIJIQ4L.mjs";
37
- import "../chunk-5U2JSHSJ.mjs";
38
+ } from "../chunk-562G3GRP.mjs";
38
39
  import {
39
40
  createGenericStore
40
41
  } from "../chunk-U62R2QKJ.mjs";
41
- import {
42
- MyButton as MyButton2,
43
- MyDataTableSelectOne,
44
- MyTextInput as MyTextInput2
45
- } from "../chunk-QMN4DRTF.mjs";
46
- import {
47
- MyDataTable,
48
- MyFlexColumn,
49
- MyFlexRow
50
- } from "../chunk-RZBHPPQT.mjs";
42
+ import "../chunk-5U2JSHSJ.mjs";
51
43
  import {
52
44
  const_object_documentTypes
53
45
  } from "../chunk-GFEMKKFH.mjs";
54
46
  import {
55
47
  const_object_colors
56
48
  } from "../chunk-OMJJAHOC.mjs";
49
+ import {
50
+ baseColumns
51
+ } from "../chunk-BEFEWY44.mjs";
52
+ import {
53
+ U0DateToDDMMYYYString
54
+ } from "../chunk-EWDS5IOF.mjs";
57
55
  import {
58
56
  enum_emailConfigModule
59
57
  } from "../chunk-VH4ZAD6M.mjs";
@@ -22,15 +22,15 @@ import {
22
22
  utils_time_getHourMinuteFromString,
23
23
  utils_validator_validateCode
24
24
  } from "../chunk-J7PZ4DWS.mjs";
25
+ import {
26
+ utils_pdf_download
27
+ } from "../chunk-5U2JSHSJ.mjs";
25
28
  import {
26
29
  U0DateToDDMMYYYString,
27
30
  utils_date_dateToDDMMYYYString,
28
31
  utils_date_formatToDateTimeStartEnd,
29
32
  utils_date_getHHmm
30
33
  } from "../chunk-EWDS5IOF.mjs";
31
- import {
32
- utils_pdf_download
33
- } from "../chunk-5U2JSHSJ.mjs";
34
34
  import {
35
35
  utils_notification_show
36
36
  } from "../chunk-7ZCOFATU.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.451",
45
+ "version": "0.1.453",
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
- };