@enyxs/wikex-components 0.11.32 → 0.11.34
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.
- package/README.md +9 -7
- package/dist/fees-model.d.mts +3 -1
- package/dist/fees-model.d.ts +3 -1
- package/dist/fees-model.js +20 -0
- package/dist/fees-model.js.map +1 -1
- package/dist/fees-model.mjs +19 -0
- package/dist/fees-model.mjs.map +1 -1
- package/dist/fees.js +125 -112
- package/dist/fees.js.map +1 -1
- package/dist/fees.mjs +120 -107
- package/dist/fees.mjs.map +1 -1
- package/dist/index.js +278 -265
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -181
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/fees.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/wikex/fees-manager.tsx
|
|
4
|
-
import { Alert, Box as Box2, Button as Button4, Card, Chip, Divider, MenuItem as
|
|
4
|
+
import { Alert, Box as Box2, Button as Button4, Card, Chip, Divider, MenuItem as MenuItem4, Stack as Stack3, TextField as TextField4, ToggleButton, ToggleButtonGroup, Typography as Typography3 } from "@mui/material";
|
|
5
5
|
|
|
6
6
|
// src/wikex/fees-table.tsx
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { useId, useLayoutEffect, useRef as
|
|
8
|
+
import { useId, useLayoutEffect, useRef as useRef3, useState as useState2 } from "react";
|
|
9
9
|
import styled6, { ThemeProvider } from "styled-components";
|
|
10
|
-
import
|
|
10
|
+
import TextField3 from "@mui/material/TextField";
|
|
11
11
|
import Dialog from "@mui/material/Dialog";
|
|
12
12
|
import DialogTitle from "@mui/material/DialogTitle";
|
|
13
13
|
import DialogContent from "@mui/material/DialogContent";
|
|
@@ -15,7 +15,7 @@ import DialogContentText from "@mui/material/DialogContentText";
|
|
|
15
15
|
import DialogActions from "@mui/material/DialogActions";
|
|
16
16
|
import Button3 from "@mui/material/Button";
|
|
17
17
|
import Select from "@mui/material/Select";
|
|
18
|
-
import
|
|
18
|
+
import MenuItem3 from "@mui/material/MenuItem";
|
|
19
19
|
import Checkbox from "@mui/material/Checkbox";
|
|
20
20
|
import Collapse from "@mui/material/Collapse";
|
|
21
21
|
|
|
@@ -58,23 +58,23 @@ function moveFeesItem(items, from, to) {
|
|
|
58
58
|
next.splice(to, 0, item);
|
|
59
59
|
return next;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
if (!table.columns.some((column) => column.key ===
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
function setFeesColumnAlignment(table, columnKey, textAlign) {
|
|
62
|
+
if (!table.columns.some((column) => column.key === columnKey)) return table;
|
|
63
|
+
return {
|
|
64
|
+
...table,
|
|
65
|
+
columns: table.columns.map((column) => {
|
|
66
|
+
if (column.key !== columnKey) return column;
|
|
66
67
|
const { textAlign: _previous, ...rest } = column;
|
|
67
68
|
return { ...rest, ...textAlign ? { textAlign } : {} };
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}) };
|
|
69
|
+
}),
|
|
70
|
+
rows: table.rows.map((row) => {
|
|
71
|
+
if (!row.cellAlignments || !Object.prototype.hasOwnProperty.call(row.cellAlignments, columnKey)) return row;
|
|
72
|
+
const { cellAlignments, ...rest } = row;
|
|
73
|
+
const alignments = { ...cellAlignments };
|
|
74
|
+
delete alignments[columnKey];
|
|
75
|
+
return { ...rest, ...Object.keys(alignments).length ? { cellAlignments: alignments } : {} };
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// src/wikex/fees-typography-controls.tsx
|
|
@@ -131,7 +131,7 @@ function FeesTypographyControls({ value, onChange }) {
|
|
|
131
131
|
/* @__PURE__ */ jsxs(Stack, { direction: { xs: "column", sm: "row" }, gap: 1.5, justifyContent: "space-between", alignItems: { sm: "center" }, sx: { mb: 2 }, children: [
|
|
132
132
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
133
133
|
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "\u0110\u1ECBnh d\u1EA1ng ch\u1EEF" }),
|
|
134
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "C\u1EE1 ch\u1EEF v\xE0 \u0111\u1ED9 \u0111\u1EADm \xE1p d\u1EE5ng cho to\xE0n b\u1EA3ng, theo ng\xF4n ng\u1EEF \u0111ang ch\u1ECDn. C\u0103n l\u1EC1 \u0111\
|
|
134
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "C\u1EE1 ch\u1EEF v\xE0 \u0111\u1ED9 \u0111\u1EADm \xE1p d\u1EE5ng cho to\xE0n b\u1EA3ng, theo ng\xF4n ng\u1EEF \u0111ang ch\u1ECDn. Ch\u1ECDn c\u1ED9t trong m\u1EE5c C\u0103n l\u1EC1 theo c\u1ED9t \u0111\u1EC3 ch\u1EC9nh ti\xEAu \u0111\u1EC1 v\xE0 to\xE0n b\u1ED9 gi\xE1 tr\u1ECB c\u1EE7a c\u1ED9t." })
|
|
135
135
|
] }),
|
|
136
136
|
/* @__PURE__ */ jsxs(Stack, { direction: "row", gap: 1, flexShrink: 0, children: [
|
|
137
137
|
/* @__PURE__ */ jsx(Button, { size: "small", variant: "outlined", onClick: () => onChange({ thead: { ...value?.thead, fontSize: 14, fontWeight: 700 }, tbody: { ...value?.tbody, fontSize: 14, fontWeight: 500 } }), children: "D\u1EC5 \u0111\u1ECDc" }),
|
|
@@ -170,53 +170,78 @@ function FeesTypographyControls({ value, onChange }) {
|
|
|
170
170
|
] });
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
// src/wikex/fees-
|
|
174
|
-
import {
|
|
173
|
+
// src/wikex/fees-column-alignment-controls.tsx
|
|
174
|
+
import { useRef as useRef2 } from "react";
|
|
175
|
+
import { Button as Button2, MenuItem as MenuItem2, Stack as Stack2, TextField as TextField2, Typography as Typography2 } from "@mui/material";
|
|
175
176
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
176
177
|
var labels = { left: "C\u0103n tr\xE1i", center: "C\u0103n gi\u1EEFa", right: "C\u0103n ph\u1EA3i" };
|
|
177
178
|
var englishLabels = { left: "Align left", center: "Align center", right: "Align right" };
|
|
178
|
-
function
|
|
179
|
+
function FeesColumnAlignmentControls({ columns, columnKey, english, onSelectColumn, onChange }) {
|
|
180
|
+
const root = useRef2(null);
|
|
181
|
+
const column = columns.find((item) => item.key === columnKey);
|
|
179
182
|
return /* @__PURE__ */ jsxs2(
|
|
180
183
|
Stack2,
|
|
181
184
|
{
|
|
185
|
+
ref: root,
|
|
182
186
|
role: "group",
|
|
183
|
-
"aria-label": english ? "
|
|
184
|
-
direction: { xs: "column", sm: "row" },
|
|
187
|
+
"aria-label": english ? "Column alignment" : "C\u0103n l\u1EC1 theo c\u1ED9t",
|
|
185
188
|
spacing: 1.5,
|
|
186
|
-
alignItems: { sm: "center" },
|
|
187
189
|
sx: { my: 2, p: 1.5, border: "1px solid", borderColor: "divider", borderRadius: 1.5 },
|
|
188
190
|
children: [
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
|
|
193
|
-
/* @__PURE__ */ jsxs2(Stack2, { direction: "row", spacing: 0.5, flexWrap: "wrap", useFlexGap: true, children: [
|
|
194
|
-
FEES_TEXT_ALIGNS.map((align) => /* @__PURE__ */ jsx2(
|
|
195
|
-
Button2,
|
|
196
|
-
{
|
|
197
|
-
size: "small",
|
|
198
|
-
disabled: !label,
|
|
199
|
-
variant: value === align ? "contained" : "outlined",
|
|
200
|
-
"aria-pressed": value === align,
|
|
201
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
202
|
-
onClick: () => onChange(align),
|
|
203
|
-
children: (english ? englishLabels : labels)[align]
|
|
204
|
-
},
|
|
205
|
-
align
|
|
206
|
-
)),
|
|
207
|
-
/* @__PURE__ */ jsx2(
|
|
208
|
-
Button2,
|
|
191
|
+
/* @__PURE__ */ jsx2(Typography2, { variant: "subtitle2", children: english ? "Column alignment" : "C\u0103n l\u1EC1 theo c\u1ED9t" }),
|
|
192
|
+
/* @__PURE__ */ jsxs2(Stack2, { direction: { xs: "column", sm: "row" }, spacing: 1.5, alignItems: { sm: "center" }, children: [
|
|
193
|
+
/* @__PURE__ */ jsxs2(
|
|
194
|
+
TextField2,
|
|
209
195
|
{
|
|
196
|
+
select: true,
|
|
210
197
|
size: "small",
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
198
|
+
label: english ? "Column to align" : "C\u1ED9t c\u1EA7n c\u0103n l\u1EC1",
|
|
199
|
+
value: column?.key ?? "",
|
|
200
|
+
sx: { flex: 1, minWidth: 0 },
|
|
201
|
+
slotProps: { inputLabel: { shrink: true }, select: {
|
|
202
|
+
displayEmpty: true,
|
|
203
|
+
SelectDisplayProps: { "aria-labelledby": void 0 },
|
|
204
|
+
inputProps: { "aria-label": english ? "Column to align" : "C\u1ED9t c\u1EA7n c\u0103n l\u1EC1" },
|
|
205
|
+
MenuProps: { container: () => root.current?.ownerDocument.body ?? document.body }
|
|
206
|
+
} },
|
|
207
|
+
onChange: (event) => onSelectColumn(event.target.value),
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsx2(MenuItem2, { value: "", disabled: true, children: english ? "Select a column" : "Ch\u1ECDn c\u1ED9t" }),
|
|
210
|
+
columns.map((item, index) => /* @__PURE__ */ jsxs2(MenuItem2, { value: item.key, children: [
|
|
211
|
+
index + 1,
|
|
212
|
+
". ",
|
|
213
|
+
item.title || (english ? "Untitled column" : "C\u1ED9t ch\u01B0a c\xF3 ti\xEAu \u0111\u1EC1")
|
|
214
|
+
] }, item.key))
|
|
215
|
+
]
|
|
217
216
|
}
|
|
218
|
-
)
|
|
219
|
-
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ jsxs2(Stack2, { direction: "row", spacing: 0.5, flexWrap: "wrap", useFlexGap: true, children: [
|
|
219
|
+
FEES_TEXT_ALIGNS.map((align) => /* @__PURE__ */ jsx2(
|
|
220
|
+
Button2,
|
|
221
|
+
{
|
|
222
|
+
size: "small",
|
|
223
|
+
disabled: !column,
|
|
224
|
+
variant: column?.textAlign === align ? "contained" : "outlined",
|
|
225
|
+
"aria-pressed": column?.textAlign === align,
|
|
226
|
+
onClick: () => onChange(align),
|
|
227
|
+
children: (english ? englishLabels : labels)[align]
|
|
228
|
+
},
|
|
229
|
+
align
|
|
230
|
+
)),
|
|
231
|
+
/* @__PURE__ */ jsx2(
|
|
232
|
+
Button2,
|
|
233
|
+
{
|
|
234
|
+
size: "small",
|
|
235
|
+
color: "inherit",
|
|
236
|
+
disabled: !column,
|
|
237
|
+
"aria-label": english ? "Reset selected column alignment" : "C\u0103n l\u1EC1 m\u1EB7c \u0111\u1ECBnh cho c\u1ED9t \u0111ang ch\u1ECDn",
|
|
238
|
+
onClick: () => onChange(void 0),
|
|
239
|
+
children: english ? "Default" : "M\u1EB7c \u0111\u1ECBnh"
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
] })
|
|
243
|
+
] }),
|
|
244
|
+
/* @__PURE__ */ jsx2(Typography2, { variant: "caption", color: "text.secondary", children: english ? "Applies to the header and all values in the selected column, including filtered rows and other pages." : "\xC1p d\u1EE5ng cho ti\xEAu \u0111\u1EC1 v\xE0 to\xE0n b\u1ED9 gi\xE1 tr\u1ECB c\u1EE7a c\u1ED9t \u0111\xE3 ch\u1ECDn, k\u1EC3 c\u1EA3 c\xE1c d\xF2ng \u0111ang l\u1ECDc v\xE0 \u1EDF trang kh\xE1c." })
|
|
220
245
|
]
|
|
221
246
|
}
|
|
222
247
|
);
|
|
@@ -936,32 +961,32 @@ var feesTheme = {
|
|
|
936
961
|
]))
|
|
937
962
|
};
|
|
938
963
|
var EditorActions = styled6.div.withConfig({
|
|
939
|
-
componentId: "sc-
|
|
964
|
+
componentId: "sc-a4d52175-0"
|
|
940
965
|
})([
|
|
941
966
|
`display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
|
|
942
967
|
]);
|
|
943
968
|
var EditGroup = styled6.div.withConfig({
|
|
944
|
-
componentId: "sc-
|
|
969
|
+
componentId: "sc-a4d52175-1"
|
|
945
970
|
})([
|
|
946
971
|
`display:flex;flex-direction:column;gap:6px;`
|
|
947
972
|
]);
|
|
948
973
|
var HeaderGroup = styled6(EditGroup).withConfig({
|
|
949
|
-
componentId: "sc-
|
|
974
|
+
componentId: "sc-a4d52175-2"
|
|
950
975
|
})([
|
|
951
976
|
`gap:8px;`
|
|
952
977
|
]);
|
|
953
978
|
var HeaderTitle = styled6.div.withConfig({
|
|
954
|
-
componentId: "sc-
|
|
979
|
+
componentId: "sc-a4d52175-3"
|
|
955
980
|
})([
|
|
956
981
|
`display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
|
|
957
982
|
]);
|
|
958
983
|
var HeaderActions = styled6.div.withConfig({
|
|
959
|
-
componentId: "sc-
|
|
984
|
+
componentId: "sc-a4d52175-4"
|
|
960
985
|
})([
|
|
961
986
|
`display:flex;align-items:center;min-height:24px;`
|
|
962
987
|
]);
|
|
963
988
|
var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
964
|
-
componentId: "sc-
|
|
989
|
+
componentId: "sc-a4d52175-5"
|
|
965
990
|
})([
|
|
966
991
|
`&[data-editable] th{vertical-align:top;}--fees-row-background:`,
|
|
967
992
|
`;--fees-stripe-background:`,
|
|
@@ -994,14 +1019,14 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
994
1019
|
}
|
|
995
1020
|
`).join(""), ({ $typography }) => $typography?.thead?.fontSize ?? 8, ({ $typography }) => $typography?.thead?.fontSize ? 1.4 : "10px", ({ $typography }) => $typography?.tbody?.fontSize ?? 10, ({ $typography }) => $typography?.tbody?.fontSize ? 1.4 : "14px", ({ theme }) => theme.colors.accent.primary);
|
|
996
1021
|
var FeesCellContent = styled6.span.withConfig({
|
|
997
|
-
componentId: "sc-
|
|
1022
|
+
componentId: "sc-a4d52175-6"
|
|
998
1023
|
})([
|
|
999
1024
|
`display:block;text-align:`,
|
|
1000
1025
|
`;@media (max-width:767px){text-align:`,
|
|
1001
1026
|
`;}`
|
|
1002
1027
|
], ({ $align, $alignRight }) => $align ?? ($alignRight ? "right" : "left"), ({ $align }) => $align ?? "left");
|
|
1003
1028
|
var EditorButton = styled6.button.withConfig({
|
|
1004
|
-
componentId: "sc-
|
|
1029
|
+
componentId: "sc-a4d52175-7"
|
|
1005
1030
|
})([
|
|
1006
1031
|
`padding:7px 12px;border:1px solid `,
|
|
1007
1032
|
`;border-radius:6px;background:`,
|
|
@@ -1010,17 +1035,17 @@ var EditorButton = styled6.button.withConfig({
|
|
|
1010
1035
|
`;}&:disabled{cursor:default;opacity:.4;}`
|
|
1011
1036
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
1012
1037
|
var OrderActions = styled6.div.withConfig({
|
|
1013
|
-
componentId: "sc-
|
|
1038
|
+
componentId: "sc-a4d52175-8"
|
|
1014
1039
|
})([
|
|
1015
1040
|
`display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
|
|
1016
1041
|
]);
|
|
1017
1042
|
var PositionLabel = styled6.label.withConfig({
|
|
1018
|
-
componentId: "sc-
|
|
1043
|
+
componentId: "sc-a4d52175-9"
|
|
1019
1044
|
})([
|
|
1020
1045
|
`display:inline-flex;align-items:center;gap:6px;font-size:12px;`
|
|
1021
1046
|
]);
|
|
1022
1047
|
var PositionInput = styled6.input.withConfig({
|
|
1023
|
-
componentId: "sc-
|
|
1048
|
+
componentId: "sc-a4d52175-10"
|
|
1024
1049
|
})([
|
|
1025
1050
|
`width:56px;padding:5px;border:1px solid `,
|
|
1026
1051
|
`;border-radius:4px;background:`,
|
|
@@ -1029,17 +1054,17 @@ var PositionInput = styled6.input.withConfig({
|
|
|
1029
1054
|
`;}`
|
|
1030
1055
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
1031
1056
|
var ColumnRow = styled6.div.withConfig({
|
|
1032
|
-
componentId: "sc-
|
|
1057
|
+
componentId: "sc-a4d52175-11"
|
|
1033
1058
|
})([
|
|
1034
1059
|
`display:flex;gap:12px;align-items:center;margin:16px 0;> textarea{flex:1;min-width:120px;}@media (max-width:600px){align-items:stretch;flex-direction:column;}`
|
|
1035
1060
|
]);
|
|
1036
1061
|
var PaginationControls = styled6(FeesAndMarginPagination).withConfig({
|
|
1037
|
-
componentId: "sc-
|
|
1062
|
+
componentId: "sc-a4d52175-12"
|
|
1038
1063
|
})([
|
|
1039
1064
|
`align-items:center;flex-wrap:wrap;gap:16px 24px;`
|
|
1040
1065
|
]);
|
|
1041
1066
|
var PageSizeLabel = styled6.div.withConfig({
|
|
1042
|
-
componentId: "sc-
|
|
1067
|
+
componentId: "sc-a4d52175-13"
|
|
1043
1068
|
})([
|
|
1044
1069
|
`display:inline-flex;align-items:center;gap:8px;color:`,
|
|
1045
1070
|
`;font:inherit;font-size:13px;`
|
|
@@ -1067,20 +1092,20 @@ function Position({ value, max, label, onMove }) {
|
|
|
1067
1092
|
});
|
|
1068
1093
|
}
|
|
1069
1094
|
var DeleteButton = styled6(EditorButton).withConfig({
|
|
1070
|
-
componentId: "sc-
|
|
1095
|
+
componentId: "sc-a4d52175-14"
|
|
1071
1096
|
})([
|
|
1072
1097
|
`align-self:flex-start;padding:4px 8px;border:0;border-radius:4px;background:#d32f2f;color:#fff;font-size:11px;font-weight:600;line-height:16px;white-space:nowrap;text-decoration:none;&:hover{background:#b71c1c;}&:focus-visible{outline:2px solid #d32f2f;outline-offset:2px;}`
|
|
1073
1098
|
]);
|
|
1074
1099
|
var CellEditorInput = styled6.textarea.withConfig({
|
|
1075
|
-
componentId: "sc-
|
|
1100
|
+
componentId: "sc-a4d52175-15"
|
|
1076
1101
|
})([
|
|
1077
1102
|
`display:block;box-sizing:border-box;width:100%;min-width:0;padding:3px;border:1px solid transparent;border-radius:3px;color:inherit;background:transparent;font:inherit;line-height:inherit;text-align:inherit;resize:none;overflow:hidden;&:hover{border-color:`,
|
|
1078
1103
|
`;}&:focus{outline:1px solid `,
|
|
1079
|
-
`;}&[data-fees-
|
|
1104
|
+
`;}&[data-fees-column-selected="true"]{border-color:`,
|
|
1080
1105
|
`;}`
|
|
1081
1106
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
1082
1107
|
function CellEditor({ onInput, ...props }) {
|
|
1083
|
-
const ref =
|
|
1108
|
+
const ref = useRef3(null);
|
|
1084
1109
|
const fit = () => {
|
|
1085
1110
|
const element = ref.current;
|
|
1086
1111
|
if (!element) return;
|
|
@@ -1122,7 +1147,7 @@ function CellEditor({ onInput, ...props }) {
|
|
|
1122
1147
|
});
|
|
1123
1148
|
}
|
|
1124
1149
|
function RowTagSelect({ selected, options, onChange }) {
|
|
1125
|
-
const selectRoot =
|
|
1150
|
+
const selectRoot = useRef3(null);
|
|
1126
1151
|
return /* @__PURE__ */ _jsx(EditGroup, {
|
|
1127
1152
|
children: /* @__PURE__ */ _jsx("div", {
|
|
1128
1153
|
ref: selectRoot,
|
|
@@ -1147,7 +1172,7 @@ function RowTagSelect({ selected, options, onChange }) {
|
|
|
1147
1172
|
fontSize: 13
|
|
1148
1173
|
},
|
|
1149
1174
|
children: [
|
|
1150
|
-
options.map((item) => /* @__PURE__ */ _jsxs(
|
|
1175
|
+
options.map((item) => /* @__PURE__ */ _jsxs(MenuItem3, {
|
|
1151
1176
|
value: item,
|
|
1152
1177
|
children: [
|
|
1153
1178
|
/* @__PURE__ */ _jsx(Checkbox, {
|
|
@@ -1159,7 +1184,7 @@ function RowTagSelect({ selected, options, onChange }) {
|
|
|
1159
1184
|
item
|
|
1160
1185
|
]
|
|
1161
1186
|
}, item)),
|
|
1162
|
-
!options.length && /* @__PURE__ */ _jsx(
|
|
1187
|
+
!options.length && /* @__PURE__ */ _jsx(MenuItem3, {
|
|
1163
1188
|
disabled: true,
|
|
1164
1189
|
children: "Ch\u01B0a c\xF3 tag \u2014 d\xF9ng n\xFAt Th\xEAm tag ph\xEDa tr\xEAn"
|
|
1165
1190
|
})
|
|
@@ -1215,10 +1240,10 @@ function FeesTable({ value, editable = false, onChange, labels: labels2, size =
|
|
|
1215
1240
|
const [pageSize, setPageSize] = useState2(FEES_PAGE_SIZE);
|
|
1216
1241
|
const [columnsOpen, setColumnsOpen] = useState2(false);
|
|
1217
1242
|
const [typographyOpen, setTypographyOpen] = useState2(false);
|
|
1218
|
-
const [
|
|
1243
|
+
const [selectedColumnKey, setSelectedColumnKey] = useState2("");
|
|
1219
1244
|
const english = language === "en";
|
|
1220
1245
|
const canEdit = editable && Boolean(onChange);
|
|
1221
|
-
const tableRoot =
|
|
1246
|
+
const tableRoot = useRef3(null);
|
|
1222
1247
|
useLayoutEffect(() => {
|
|
1223
1248
|
const root = tableRoot.current;
|
|
1224
1249
|
if (!root || !canEdit) return;
|
|
@@ -1296,16 +1321,12 @@ function FeesTable({ value, editable = false, onChange, labels: labels2, size =
|
|
|
1296
1321
|
const filtered = filterFeesRows(value, search, activeTag);
|
|
1297
1322
|
const displayedRows = canEdit ? filtered : sortFeesRowsByName(filtered, language);
|
|
1298
1323
|
const pagination = paginateFeesRows(displayedRows, page, pageSize);
|
|
1299
|
-
const selectedColumn =
|
|
1300
|
-
const selectedRow = selectedCell?.part === "tbody" ? pagination.rows.find((row) => row.id === selectedCell.rowId) : void 0;
|
|
1301
|
-
const selectedTarget = canEdit && selectedColumn && (selectedCell?.part === "thead" || selectedRow) ? selectedCell : null;
|
|
1302
|
-
const selectedAlign = selectedTarget?.part === "thead" ? selectedColumn?.textAlign : selectedRow?.cellAlignments?.[selectedTarget?.columnKey ?? ""];
|
|
1303
|
-
const selectedLabel = selectedTarget ? selectedTarget.part === "thead" ? `${english ? "Header" : "Ti\xEAu \u0111\u1EC1"}: ${selectedColumn?.title}` : `${selectedColumn?.title} \u2014 ${selectedRow?.cells.name || (english ? "New row" : "H\xE0ng m\u1EDBi")}` : void 0;
|
|
1324
|
+
const selectedColumn = value.columns.find((column) => column.key === selectedColumnKey);
|
|
1304
1325
|
useLayoutEffect(() => {
|
|
1305
|
-
if (
|
|
1326
|
+
if (selectedColumnKey && !selectedColumn) setSelectedColumnKey("");
|
|
1306
1327
|
}, [
|
|
1307
|
-
|
|
1308
|
-
|
|
1328
|
+
selectedColumnKey,
|
|
1329
|
+
selectedColumn
|
|
1309
1330
|
]);
|
|
1310
1331
|
const moveColumn = (from, to) => onChange?.({
|
|
1311
1332
|
...value,
|
|
@@ -1362,11 +1383,7 @@ function FeesTable({ value, editable = false, onChange, labels: labels2, size =
|
|
|
1362
1383
|
style: {
|
|
1363
1384
|
textAlign: column.textAlign ?? value.typography?.thead?.textAlign ?? "left"
|
|
1364
1385
|
},
|
|
1365
|
-
"data-fees-
|
|
1366
|
-
onFocus: () => setSelectedCell({
|
|
1367
|
-
part: "thead",
|
|
1368
|
-
columnKey: column.key
|
|
1369
|
-
}),
|
|
1386
|
+
"data-fees-column-selected": selectedColumnKey === column.key,
|
|
1370
1387
|
onChange: (event) => onChange?.({
|
|
1371
1388
|
...value,
|
|
1372
1389
|
columns: value.columns.map((item) => item.key === column.key ? {
|
|
@@ -1400,14 +1417,9 @@ function FeesTable({ value, editable = false, onChange, labels: labels2, size =
|
|
|
1400
1417
|
value: row.cells[column.key] ?? "",
|
|
1401
1418
|
"aria-label": `${column.title} \u2014 ${row.cells.name || "H\xE0ng m\u1EDBi"}`,
|
|
1402
1419
|
style: {
|
|
1403
|
-
textAlign: row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign ?? "left"
|
|
1420
|
+
textAlign: column.textAlign ?? row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign ?? "left"
|
|
1404
1421
|
},
|
|
1405
|
-
"data-fees-
|
|
1406
|
-
onFocus: () => setSelectedCell({
|
|
1407
|
-
part: "tbody",
|
|
1408
|
-
rowId: row.id,
|
|
1409
|
-
columnKey: column.key
|
|
1410
|
-
}),
|
|
1422
|
+
"data-fees-column-selected": selectedColumnKey === column.key,
|
|
1411
1423
|
onChange: (event) => changeRow(row.id, {
|
|
1412
1424
|
cells: {
|
|
1413
1425
|
...row.cells,
|
|
@@ -1415,7 +1427,7 @@ function FeesTable({ value, editable = false, onChange, labels: labels2, size =
|
|
|
1415
1427
|
}
|
|
1416
1428
|
})
|
|
1417
1429
|
}) : /* @__PURE__ */ _jsx(FeesCellContent, {
|
|
1418
|
-
$align: row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign,
|
|
1430
|
+
$align: column.textAlign ?? row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign,
|
|
1419
1431
|
$alignRight: rightAlignedColumns.has(column.key),
|
|
1420
1432
|
children: row.cells[column.key] ?? ""
|
|
1421
1433
|
})
|
|
@@ -1618,12 +1630,13 @@ function FeesTable({ value, editable = false, onChange, labels: labels2, size =
|
|
|
1618
1630
|
})
|
|
1619
1631
|
})
|
|
1620
1632
|
}),
|
|
1621
|
-
canEdit && /* @__PURE__ */ _jsx(
|
|
1622
|
-
|
|
1623
|
-
|
|
1633
|
+
canEdit && /* @__PURE__ */ _jsx(FeesColumnAlignmentControls, {
|
|
1634
|
+
columns: value.columns,
|
|
1635
|
+
columnKey: selectedColumnKey,
|
|
1624
1636
|
english,
|
|
1637
|
+
onSelectColumn: setSelectedColumnKey,
|
|
1625
1638
|
onChange: (textAlign) => {
|
|
1626
|
-
if (
|
|
1639
|
+
if (selectedColumn) onChange?.(setFeesColumnAlignment(value, selectedColumn.key, textAlign));
|
|
1627
1640
|
}
|
|
1628
1641
|
}),
|
|
1629
1642
|
/* @__PURE__ */ _jsx(AlignedFeesTable, {
|
|
@@ -1676,11 +1689,11 @@ function FeesTable({ value, editable = false, onChange, labels: labels2, size =
|
|
|
1676
1689
|
25,
|
|
1677
1690
|
50,
|
|
1678
1691
|
100
|
|
1679
|
-
].map((size2) => /* @__PURE__ */ _jsx(
|
|
1692
|
+
].map((size2) => /* @__PURE__ */ _jsx(MenuItem3, {
|
|
1680
1693
|
value: size2,
|
|
1681
1694
|
children: size2
|
|
1682
1695
|
}, size2)),
|
|
1683
|
-
/* @__PURE__ */ _jsx(
|
|
1696
|
+
/* @__PURE__ */ _jsx(MenuItem3, {
|
|
1684
1697
|
value: -1,
|
|
1685
1698
|
children: english ? "All" : "T\u1EA5t c\u1EA3"
|
|
1686
1699
|
})
|
|
@@ -1810,7 +1823,7 @@ function FeesTable({ value, editable = false, onChange, labels: labels2, size =
|
|
|
1810
1823
|
children: "T\u1EA1o tag m\u1EDBi"
|
|
1811
1824
|
}),
|
|
1812
1825
|
/* @__PURE__ */ _jsx(DialogContent, {
|
|
1813
|
-
children: /* @__PURE__ */ _jsx(
|
|
1826
|
+
children: /* @__PURE__ */ _jsx(TextField3, {
|
|
1814
1827
|
autoFocus: true,
|
|
1815
1828
|
fullWidth: true,
|
|
1816
1829
|
margin: "dense",
|
|
@@ -1943,7 +1956,7 @@ function FeesManager({
|
|
|
1943
1956
|
] }),
|
|
1944
1957
|
/* @__PURE__ */ jsxs7(Stack3, { direction: { xs: "column", md: "row" }, spacing: 2.5, alignItems: { md: "flex-end" }, children: [
|
|
1945
1958
|
/* @__PURE__ */ jsx7(
|
|
1946
|
-
|
|
1959
|
+
TextField4,
|
|
1947
1960
|
{
|
|
1948
1961
|
select: true,
|
|
1949
1962
|
size: "small",
|
|
@@ -1953,7 +1966,7 @@ function FeesManager({
|
|
|
1953
1966
|
fullWidth: true,
|
|
1954
1967
|
sx: { flex: 1, minWidth: 0 },
|
|
1955
1968
|
onChange: (event) => onSelectEntry(event.target.value),
|
|
1956
|
-
children: entries.map((item, index) => /* @__PURE__ */ jsxs7(
|
|
1969
|
+
children: entries.map((item, index) => /* @__PURE__ */ jsxs7(MenuItem4, { value: item.id, children: [
|
|
1957
1970
|
item.pageTitle,
|
|
1958
1971
|
" \xB7 /",
|
|
1959
1972
|
item.slug,
|