@enyxs/wikex-components 0.11.31 → 0.11.33
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 +10 -6
- package/dist/fees-model.d.mts +14 -1
- package/dist/fees-model.d.ts +14 -1
- package/dist/fees-model.js +55 -4
- package/dist/fees-model.js.map +1 -1
- package/dist/fees-model.mjs +53 -4
- package/dist/fees-model.mjs.map +1 -1
- package/dist/fees.d.mts +1 -1
- package/dist/fees.d.ts +1 -1
- package/dist/fees.js +345 -234
- package/dist/fees.js.map +1 -1
- package/dist/fees.mjs +258 -147
- package/dist/fees.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1208 -1086
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +974 -852
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/fees.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/wikex/fees-manager.tsx
|
|
4
|
-
import { Alert, Box as Box2, Button 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";
|
|
14
14
|
import DialogContentText from "@mui/material/DialogContentText";
|
|
15
15
|
import DialogActions from "@mui/material/DialogActions";
|
|
16
|
-
import
|
|
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,11 +58,28 @@ function moveFeesItem(items, from, to) {
|
|
|
58
58
|
next.splice(to, 0, item);
|
|
59
59
|
return next;
|
|
60
60
|
}
|
|
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;
|
|
67
|
+
const { textAlign: _previous, ...rest } = column;
|
|
68
|
+
return { ...rest, ...textAlign ? { textAlign } : {} };
|
|
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
|
+
}
|
|
61
79
|
|
|
62
80
|
// src/wikex/fees-typography-controls.tsx
|
|
63
81
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
64
82
|
var weightLabels = { 400: "Th\u01B0\u1EDDng", 500: "V\u1EEBa", 600: "H\u01A1i \u0111\u1EADm", 700: "\u0110\u1EADm", 800: "R\u1EA5t \u0111\u1EADm" };
|
|
65
|
-
var alignLabels = { left: "C\u0103n tr\xE1i", center: "C\u0103n gi\u1EEFa", right: "C\u0103n ph\u1EA3i" };
|
|
66
83
|
function FontSizeInput({ label, value, onChange }) {
|
|
67
84
|
const [draft, setDraft] = useState(String(value));
|
|
68
85
|
const [error, setError] = useState(false);
|
|
@@ -114,7 +131,7 @@ function FeesTypographyControls({ value, onChange }) {
|
|
|
114
131
|
/* @__PURE__ */ jsxs(Stack, { direction: { xs: "column", sm: "row" }, gap: 1.5, justifyContent: "space-between", alignItems: { sm: "center" }, sx: { mb: 2 }, children: [
|
|
115
132
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
116
133
|
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "\u0110\u1ECBnh d\u1EA1ng ch\u1EEF" }),
|
|
117
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "\
|
|
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." })
|
|
118
135
|
] }),
|
|
119
136
|
/* @__PURE__ */ jsxs(Stack, { direction: "row", gap: 1, flexShrink: 0, children: [
|
|
120
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" }),
|
|
@@ -147,29 +164,89 @@ function FeesTypographyControls({ value, onChange }) {
|
|
|
147
164
|
] }, weight))
|
|
148
165
|
}
|
|
149
166
|
)
|
|
150
|
-
] })
|
|
151
|
-
/* @__PURE__ */ jsxs(
|
|
152
|
-
TextField,
|
|
153
|
-
{
|
|
154
|
-
select: true,
|
|
155
|
-
fullWidth: true,
|
|
156
|
-
size: "small",
|
|
157
|
-
label: "C\u0103n l\u1EC1",
|
|
158
|
-
value: value?.[part]?.textAlign ?? "",
|
|
159
|
-
slotProps: { select: { displayEmpty: true, SelectDisplayProps: { "aria-labelledby": void 0 }, MenuProps: { container: () => root.current?.ownerDocument.body ?? document.body }, inputProps: { "aria-label": `C\u0103n l\u1EC1 ${title.toLocaleLowerCase("vi")}` } }, inputLabel: { shrink: true } },
|
|
160
|
-
helperText: "\xC1p d\u1EE5ng cho t\u1EA5t c\u1EA3 \xF4, c\u1EA3 tr\xEAn \u0111i\u1EC7n tho\u1EA1i",
|
|
161
|
-
onChange: (event) => update(part, { textAlign: event.target.value ? event.target.value : void 0 }),
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ jsx(MenuItem, { value: "", children: "Theo m\u1EB7c \u0111\u1ECBnh" }),
|
|
164
|
-
FEES_TEXT_ALIGNS.map((align) => /* @__PURE__ */ jsx(MenuItem, { value: align, children: alignLabels[align] }, align))
|
|
165
|
-
]
|
|
166
|
-
}
|
|
167
|
-
)
|
|
167
|
+
] })
|
|
168
168
|
] }, part)) }),
|
|
169
169
|
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", sx: { display: "block", mt: 1 }, children: "C\u1EE1 ch\u1EEF t\xF9y ch\u1EC9nh \xE1p d\u1EE5ng c\u1EA3 tr\xEAn \u0111i\u1EC7n tho\u1EA1i; b\u1EA3ng c\xF3 th\u1EC3 vu\u1ED1t ngang. \u201CM\u1EB7c \u0111\u1ECBnh\u201D kh\xF4i ph\u1EE5c c\u1EE1 ch\u1EEF t\u1EF1 th\xEDch \u1EE9ng theo m\xE0n h\xECnh." })
|
|
170
170
|
] });
|
|
171
171
|
}
|
|
172
172
|
|
|
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";
|
|
176
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
177
|
+
var labels = { left: "C\u0103n tr\xE1i", center: "C\u0103n gi\u1EEFa", right: "C\u0103n ph\u1EA3i" };
|
|
178
|
+
var englishLabels = { left: "Align left", center: "Align center", right: "Align right" };
|
|
179
|
+
function FeesColumnAlignmentControls({ columns, columnKey, english, onSelectColumn, onChange }) {
|
|
180
|
+
const root = useRef2(null);
|
|
181
|
+
const column = columns.find((item) => item.key === columnKey);
|
|
182
|
+
return /* @__PURE__ */ jsxs2(
|
|
183
|
+
Stack2,
|
|
184
|
+
{
|
|
185
|
+
ref: root,
|
|
186
|
+
role: "group",
|
|
187
|
+
"aria-label": english ? "Column alignment" : "C\u0103n l\u1EC1 theo c\u1ED9t",
|
|
188
|
+
spacing: 1.5,
|
|
189
|
+
sx: { my: 2, p: 1.5, border: "1px solid", borderColor: "divider", borderRadius: 1.5 },
|
|
190
|
+
children: [
|
|
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,
|
|
195
|
+
{
|
|
196
|
+
select: true,
|
|
197
|
+
size: "small",
|
|
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
|
+
]
|
|
216
|
+
}
|
|
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." })
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
173
250
|
// src/commodity-original/styles/colors.ts
|
|
174
251
|
var lightColors = {
|
|
175
252
|
background: {
|
|
@@ -385,7 +462,7 @@ function getTableFixedColumnOffset(columns, columnIndex) {
|
|
|
385
462
|
}
|
|
386
463
|
|
|
387
464
|
// src/commodity-original/components/Table/index.tsx
|
|
388
|
-
import { jsx as
|
|
465
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
389
466
|
function getCellValue(column, record) {
|
|
390
467
|
return column.dataIndex === void 0 ? void 0 : record[column.dataIndex];
|
|
391
468
|
}
|
|
@@ -458,7 +535,7 @@ function Table({
|
|
|
458
535
|
const nextSelectedRowKeys = event.target.checked ? [...selectedRowKeys, recordKey] : selectedRowKeys.filter((key) => key !== recordKey);
|
|
459
536
|
emitSelectionChange(nextSelectedRowKeys);
|
|
460
537
|
};
|
|
461
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ jsx3(TableScrollContainer, { children: /* @__PURE__ */ jsxs3(
|
|
462
539
|
TableRoot,
|
|
463
540
|
{
|
|
464
541
|
$minWidth: scroll?.x === void 0 ? void 0 : getTableColumnSize(scroll.x),
|
|
@@ -467,8 +544,8 @@ function Table({
|
|
|
467
544
|
className,
|
|
468
545
|
"data-size": size,
|
|
469
546
|
children: [
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
rowSelection ? /* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsxs3(TableHeaderRow, { children: [
|
|
548
|
+
rowSelection ? /* @__PURE__ */ jsx3(TableHeaderCell, { scope: "col", children: selectionType === "checkbox" ? /* @__PURE__ */ jsx3(
|
|
472
549
|
TableSelectionInput,
|
|
473
550
|
{
|
|
474
551
|
checked: isAllSelected,
|
|
@@ -477,8 +554,8 @@ function Table({
|
|
|
477
554
|
type: "checkbox"
|
|
478
555
|
}
|
|
479
556
|
) : null }) : null,
|
|
480
|
-
expandable ? /* @__PURE__ */
|
|
481
|
-
columns.map((column, columnIndex) => /* @__PURE__ */
|
|
557
|
+
expandable ? /* @__PURE__ */ jsx3(TableHeaderCell, { scope: "col" }) : null,
|
|
558
|
+
columns.map((column, columnIndex) => /* @__PURE__ */ jsx3(
|
|
482
559
|
TableHeaderCell,
|
|
483
560
|
{
|
|
484
561
|
$fixed: column.fixed,
|
|
@@ -486,7 +563,7 @@ function Table({
|
|
|
486
563
|
$width: column.width === void 0 ? void 0 : getTableColumnSize(column.width),
|
|
487
564
|
"data-column-key": column.key,
|
|
488
565
|
scope: "col",
|
|
489
|
-
children: column.sortable ? /* @__PURE__ */
|
|
566
|
+
children: column.sortable ? /* @__PURE__ */ jsx3(
|
|
490
567
|
TableSortButton,
|
|
491
568
|
{
|
|
492
569
|
"aria-pressed": sort?.field === column.key,
|
|
@@ -499,13 +576,13 @@ function Table({
|
|
|
499
576
|
column.key
|
|
500
577
|
))
|
|
501
578
|
] }) }),
|
|
502
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ jsx3("tbody", { children: loading ? /* @__PURE__ */ jsx3(TableRow, { children: /* @__PURE__ */ jsx3(TableCell, { colSpan: columnCount, children: loadingContent }) }) : dataSource.length === 0 ? /* @__PURE__ */ jsx3(TableRow, { children: /* @__PURE__ */ jsx3(TableCell, { colSpan: columnCount, children: empty }) }) : dataSource.map((record, index) => {
|
|
503
580
|
const recordKey = getRowKey(record);
|
|
504
581
|
const selectionProps = rowSelection?.getCheckboxProps?.(record);
|
|
505
582
|
const isExpanded = expandedRowKeySet.has(recordKey);
|
|
506
|
-
return /* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
rowSelection ? /* @__PURE__ */
|
|
583
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
584
|
+
/* @__PURE__ */ jsxs3(TableRow, { "data-row-key": recordKey, children: [
|
|
585
|
+
rowSelection ? /* @__PURE__ */ jsx3(TableCell, { children: /* @__PURE__ */ jsx3(
|
|
509
586
|
TableSelectionInput,
|
|
510
587
|
{
|
|
511
588
|
checked: selectedRowKeySet.has(recordKey),
|
|
@@ -515,7 +592,7 @@ function Table({
|
|
|
515
592
|
type: selectionType
|
|
516
593
|
}
|
|
517
594
|
) }) : null,
|
|
518
|
-
expandable ? /* @__PURE__ */
|
|
595
|
+
expandable ? /* @__PURE__ */ jsx3(TableCell, { children: /* @__PURE__ */ jsx3(
|
|
519
596
|
TableExpandButton,
|
|
520
597
|
{
|
|
521
598
|
"aria-expanded": isExpanded,
|
|
@@ -526,7 +603,7 @@ function Table({
|
|
|
526
603
|
) }) : null,
|
|
527
604
|
columns.map((column, columnIndex) => {
|
|
528
605
|
const value = getCellValue(column, record);
|
|
529
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ jsx3(
|
|
530
607
|
TableCell,
|
|
531
608
|
{
|
|
532
609
|
$fixed: column.fixed,
|
|
@@ -538,7 +615,7 @@ function Table({
|
|
|
538
615
|
);
|
|
539
616
|
})
|
|
540
617
|
] }),
|
|
541
|
-
expandable?.render && isExpanded ? /* @__PURE__ */
|
|
618
|
+
expandable?.render && isExpanded ? /* @__PURE__ */ jsx3(TableRow, { children: /* @__PURE__ */ jsx3(TableExpandedCell, { colSpan: columnCount, children: expandable.render(record) }) }) : null
|
|
542
619
|
] }, recordKey);
|
|
543
620
|
}) })
|
|
544
621
|
]
|
|
@@ -593,7 +670,7 @@ var PaginationArrow = styled2.span.withConfig({
|
|
|
593
670
|
], chevron_right_default, chevron_right_default);
|
|
594
671
|
|
|
595
672
|
// src/commodity-original/components/Pagination/index.tsx
|
|
596
|
-
import { jsx as
|
|
673
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
597
674
|
function getPaginationItems(page, pageCount, siblingCount) {
|
|
598
675
|
const maxVisibleItems = siblingCount * 2 + 5;
|
|
599
676
|
if (pageCount <= maxVisibleItems) {
|
|
@@ -620,7 +697,7 @@ function Pagination({
|
|
|
620
697
|
onPageChange,
|
|
621
698
|
siblingCount = 1,
|
|
622
699
|
ariaLabel,
|
|
623
|
-
labels,
|
|
700
|
+
labels: labels2,
|
|
624
701
|
className
|
|
625
702
|
}) {
|
|
626
703
|
const { t } = useTranslation();
|
|
@@ -629,43 +706,43 @@ function Pagination({
|
|
|
629
706
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
630
707
|
const hasPreviousPage = currentPage > 1;
|
|
631
708
|
const hasNextPage = currentPage < safePageCount;
|
|
632
|
-
return /* @__PURE__ */
|
|
709
|
+
return /* @__PURE__ */ jsx4(
|
|
633
710
|
PaginationNav,
|
|
634
711
|
{
|
|
635
712
|
"aria-label": ariaLabel ?? t("pagination.navigation"),
|
|
636
713
|
className,
|
|
637
|
-
children: /* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
714
|
+
children: /* @__PURE__ */ jsxs4(PaginationList, { children: [
|
|
715
|
+
/* @__PURE__ */ jsx4(PaginationItem, { children: /* @__PURE__ */ jsx4(
|
|
639
716
|
PaginationButton,
|
|
640
717
|
{
|
|
641
|
-
"aria-label":
|
|
718
|
+
"aria-label": labels2?.previous ?? t("pagination.previous"),
|
|
642
719
|
"data-control": "previous",
|
|
643
720
|
disabled: !hasPreviousPage,
|
|
644
721
|
onClick: () => onPageChange(currentPage - 1),
|
|
645
722
|
type: "button",
|
|
646
|
-
children: /* @__PURE__ */
|
|
723
|
+
children: /* @__PURE__ */ jsx4(PaginationArrow, { "data-direction": "previous" })
|
|
647
724
|
}
|
|
648
725
|
) }),
|
|
649
|
-
items.map((item, index) => /* @__PURE__ */
|
|
726
|
+
items.map((item, index) => /* @__PURE__ */ jsx4(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ jsx4(PaginationButton, { "aria-hidden": "true", disabled: true, tabIndex: -1, type: "button", children: "\u2026" }) : /* @__PURE__ */ jsx4(
|
|
650
727
|
PaginationButton,
|
|
651
728
|
{
|
|
652
729
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
653
|
-
"aria-label": item === currentPage ?
|
|
730
|
+
"aria-label": item === currentPage ? labels2?.current(item) ?? t("pagination.current", { page: item }) : labels2?.page(item) ?? t("pagination.page", { page: item }),
|
|
654
731
|
"data-active": item === currentPage || void 0,
|
|
655
732
|
onClick: () => onPageChange(item),
|
|
656
733
|
type: "button",
|
|
657
734
|
children: item
|
|
658
735
|
}
|
|
659
736
|
) }, `${item}-${index}`)),
|
|
660
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ jsx4(PaginationItem, { children: /* @__PURE__ */ jsx4(
|
|
661
738
|
PaginationButton,
|
|
662
739
|
{
|
|
663
|
-
"aria-label":
|
|
740
|
+
"aria-label": labels2?.next ?? t("pagination.next"),
|
|
664
741
|
"data-control": "next",
|
|
665
742
|
disabled: !hasNextPage,
|
|
666
743
|
onClick: () => onPageChange(currentPage + 1),
|
|
667
744
|
type: "button",
|
|
668
|
-
children: /* @__PURE__ */
|
|
745
|
+
children: /* @__PURE__ */ jsx4(PaginationArrow, { "data-direction": "next" })
|
|
669
746
|
}
|
|
670
747
|
) })
|
|
671
748
|
] })
|
|
@@ -701,7 +778,7 @@ var InputAdornment = styled3.span.withConfig({
|
|
|
701
778
|
], ({ theme }) => theme.colors.text.secondary, InputCommonRoot, InputCommonRoot);
|
|
702
779
|
|
|
703
780
|
// src/commodity-original/components/InputCommon/index.tsx
|
|
704
|
-
import { jsx as
|
|
781
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
705
782
|
function InputCommon({
|
|
706
783
|
leftIcon,
|
|
707
784
|
rightIcon,
|
|
@@ -712,11 +789,11 @@ function InputCommon({
|
|
|
712
789
|
onClear,
|
|
713
790
|
...inputProps
|
|
714
791
|
}) {
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
leftIcon ? /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
clearable && inputProps.value ? /* @__PURE__ */
|
|
719
|
-
errorMessage ? /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ jsxs5(InputCommonRoot, { "data-disabled": inputProps.disabled || void 0, "data-error": error || void 0, "data-size": size, children: [
|
|
793
|
+
leftIcon ? /* @__PURE__ */ jsx5(InputAdornment, { "aria-hidden": "true", children: leftIcon }) : null,
|
|
794
|
+
/* @__PURE__ */ jsx5(InputCommonField, { ...inputProps }),
|
|
795
|
+
clearable && inputProps.value ? /* @__PURE__ */ jsx5("button", { "aria-label": "X\xF3a n\u1ED9i dung", onClick: onClear, type: "button", children: "\xD7" }) : rightIcon ? /* @__PURE__ */ jsx5(InputAdornment, { "aria-hidden": "true", children: rightIcon }) : null,
|
|
796
|
+
errorMessage ? /* @__PURE__ */ jsx5("span", { role: "alert", children: errorMessage }) : null
|
|
720
797
|
] });
|
|
721
798
|
}
|
|
722
799
|
|
|
@@ -748,7 +825,7 @@ var TabLine = styled4.span.withConfig({
|
|
|
748
825
|
], ({ theme }) => theme.colors.accent.primary, TabCommonList, TabCommonList);
|
|
749
826
|
|
|
750
827
|
// src/commodity-original/components/TabCommon/index.tsx
|
|
751
|
-
import { jsx as
|
|
828
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
752
829
|
function TabCommon({
|
|
753
830
|
items,
|
|
754
831
|
value,
|
|
@@ -757,7 +834,7 @@ function TabCommon({
|
|
|
757
834
|
className,
|
|
758
835
|
size = "md"
|
|
759
836
|
}) {
|
|
760
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ jsx6(
|
|
761
838
|
TabCommonList,
|
|
762
839
|
{
|
|
763
840
|
"aria-label": ariaLabel,
|
|
@@ -766,7 +843,7 @@ function TabCommon({
|
|
|
766
843
|
role: "tablist",
|
|
767
844
|
children: items.map((item) => {
|
|
768
845
|
const isActive = item.id === value;
|
|
769
|
-
return /* @__PURE__ */
|
|
846
|
+
return /* @__PURE__ */ jsxs6(
|
|
770
847
|
TabButton,
|
|
771
848
|
{
|
|
772
849
|
"aria-selected": isActive,
|
|
@@ -777,7 +854,7 @@ function TabCommon({
|
|
|
777
854
|
type: "button",
|
|
778
855
|
children: [
|
|
779
856
|
item.label,
|
|
780
|
-
/* @__PURE__ */
|
|
857
|
+
/* @__PURE__ */ jsx6(TabLine, { "aria-hidden": "true" })
|
|
781
858
|
]
|
|
782
859
|
},
|
|
783
860
|
item.id
|
|
@@ -884,32 +961,32 @@ var feesTheme = {
|
|
|
884
961
|
]))
|
|
885
962
|
};
|
|
886
963
|
var EditorActions = styled6.div.withConfig({
|
|
887
|
-
componentId: "sc-
|
|
964
|
+
componentId: "sc-a4d52175-0"
|
|
888
965
|
})([
|
|
889
966
|
`display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
|
|
890
967
|
]);
|
|
891
968
|
var EditGroup = styled6.div.withConfig({
|
|
892
|
-
componentId: "sc-
|
|
969
|
+
componentId: "sc-a4d52175-1"
|
|
893
970
|
})([
|
|
894
971
|
`display:flex;flex-direction:column;gap:6px;`
|
|
895
972
|
]);
|
|
896
973
|
var HeaderGroup = styled6(EditGroup).withConfig({
|
|
897
|
-
componentId: "sc-
|
|
974
|
+
componentId: "sc-a4d52175-2"
|
|
898
975
|
})([
|
|
899
976
|
`gap:8px;`
|
|
900
977
|
]);
|
|
901
978
|
var HeaderTitle = styled6.div.withConfig({
|
|
902
|
-
componentId: "sc-
|
|
979
|
+
componentId: "sc-a4d52175-3"
|
|
903
980
|
})([
|
|
904
981
|
`display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
|
|
905
982
|
]);
|
|
906
983
|
var HeaderActions = styled6.div.withConfig({
|
|
907
|
-
componentId: "sc-
|
|
984
|
+
componentId: "sc-a4d52175-4"
|
|
908
985
|
})([
|
|
909
986
|
`display:flex;align-items:center;min-height:24px;`
|
|
910
987
|
]);
|
|
911
988
|
var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
912
|
-
componentId: "sc-
|
|
989
|
+
componentId: "sc-a4d52175-5"
|
|
913
990
|
})([
|
|
914
991
|
`&[data-editable] th{vertical-align:top;}--fees-row-background:`,
|
|
915
992
|
`;--fees-stripe-background:`,
|
|
@@ -932,9 +1009,7 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
932
1009
|
`px;line-height:`,
|
|
933
1010
|
`;}tbody > tr > td{height:40px;padding-top:5.5px;padding-bottom:5.5px;font-size:`,
|
|
934
1011
|
`px;line-height:`,
|
|
935
|
-
`;}thead > tr > th:last-child,tbody > tr > td:last-child{padding-right:12px;}th >
|
|
936
|
-
`;}td > span{text-align:`,
|
|
937
|
-
`;}thead > tr > th:first-child,tbody > tr > td:first-child{position:sticky;left:0;padding-left:12px;}thead > tr > th:first-child{z-index:3;background:`,
|
|
1012
|
+
`;}thead > tr > th:last-child,tbody > tr > td:last-child{padding-right:12px;}thead > tr > th:first-child,tbody > tr > td:first-child{position:sticky;left:0;padding-left:12px;}thead > tr > th:first-child{z-index:3;background:`,
|
|
938
1013
|
`;}tbody > tr > td:first-child{z-index:2;background:var(--fees-row-background);}tbody > tr:nth-child(even) > td:first-child{background:var(--fees-stripe-background);}}}`
|
|
939
1014
|
], ({ theme }) => theme.colors.background.deep, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.accent.foreground, ({ theme }) => theme.colors.background.card, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.foreground, ({ $typography }) => $typography?.thead?.fontSize ?? 10, ({ $typography }) => $typography?.thead?.fontWeight ?? 600, ({ $typography }) => $typography?.thead?.textAlign ?? "left", ({ $typography }) => $typography?.thead?.fontSize ? 1.4 : "14px", ({ $typography }) => $typography?.tbody?.fontSize ?? 12, ({ $typography }) => $typography?.tbody?.fontWeight ?? 500, ({ $typography }) => $typography?.tbody?.textAlign ?? "left", ({ $typography }) => $typography?.tbody?.fontSize ? 1.4 : "16px", ({ $mobileColumnWidths }) => $mobileColumnWidths.reduce((sum, width) => sum + width, 0), ({ $mobileColumnWidths }) => $mobileColumnWidths.map((width, index) => `
|
|
940
1015
|
th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
|
|
@@ -942,15 +1017,16 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
942
1017
|
min-width: ${width}px;
|
|
943
1018
|
max-width: ${width}px;
|
|
944
1019
|
}
|
|
945
|
-
`).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", ({
|
|
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);
|
|
946
1021
|
var FeesCellContent = styled6.span.withConfig({
|
|
947
|
-
componentId: "sc-
|
|
1022
|
+
componentId: "sc-a4d52175-6"
|
|
948
1023
|
})([
|
|
949
1024
|
`display:block;text-align:`,
|
|
950
|
-
|
|
951
|
-
|
|
1025
|
+
`;@media (max-width:767px){text-align:`,
|
|
1026
|
+
`;}`
|
|
1027
|
+
], ({ $align, $alignRight }) => $align ?? ($alignRight ? "right" : "left"), ({ $align }) => $align ?? "left");
|
|
952
1028
|
var EditorButton = styled6.button.withConfig({
|
|
953
|
-
componentId: "sc-
|
|
1029
|
+
componentId: "sc-a4d52175-7"
|
|
954
1030
|
})([
|
|
955
1031
|
`padding:7px 12px;border:1px solid `,
|
|
956
1032
|
`;border-radius:6px;background:`,
|
|
@@ -959,17 +1035,17 @@ var EditorButton = styled6.button.withConfig({
|
|
|
959
1035
|
`;}&:disabled{cursor:default;opacity:.4;}`
|
|
960
1036
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
961
1037
|
var OrderActions = styled6.div.withConfig({
|
|
962
|
-
componentId: "sc-
|
|
1038
|
+
componentId: "sc-a4d52175-8"
|
|
963
1039
|
})([
|
|
964
1040
|
`display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
|
|
965
1041
|
]);
|
|
966
1042
|
var PositionLabel = styled6.label.withConfig({
|
|
967
|
-
componentId: "sc-
|
|
1043
|
+
componentId: "sc-a4d52175-9"
|
|
968
1044
|
})([
|
|
969
1045
|
`display:inline-flex;align-items:center;gap:6px;font-size:12px;`
|
|
970
1046
|
]);
|
|
971
1047
|
var PositionInput = styled6.input.withConfig({
|
|
972
|
-
componentId: "sc-
|
|
1048
|
+
componentId: "sc-a4d52175-10"
|
|
973
1049
|
})([
|
|
974
1050
|
`width:56px;padding:5px;border:1px solid `,
|
|
975
1051
|
`;border-radius:4px;background:`,
|
|
@@ -978,17 +1054,17 @@ var PositionInput = styled6.input.withConfig({
|
|
|
978
1054
|
`;}`
|
|
979
1055
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
980
1056
|
var ColumnRow = styled6.div.withConfig({
|
|
981
|
-
componentId: "sc-
|
|
1057
|
+
componentId: "sc-a4d52175-11"
|
|
982
1058
|
})([
|
|
983
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;}`
|
|
984
1060
|
]);
|
|
985
1061
|
var PaginationControls = styled6(FeesAndMarginPagination).withConfig({
|
|
986
|
-
componentId: "sc-
|
|
1062
|
+
componentId: "sc-a4d52175-12"
|
|
987
1063
|
})([
|
|
988
1064
|
`align-items:center;flex-wrap:wrap;gap:16px 24px;`
|
|
989
1065
|
]);
|
|
990
1066
|
var PageSizeLabel = styled6.div.withConfig({
|
|
991
|
-
componentId: "sc-
|
|
1067
|
+
componentId: "sc-a4d52175-13"
|
|
992
1068
|
})([
|
|
993
1069
|
`display:inline-flex;align-items:center;gap:8px;color:`,
|
|
994
1070
|
`;font:inherit;font-size:13px;`
|
|
@@ -1016,19 +1092,20 @@ function Position({ value, max, label, onMove }) {
|
|
|
1016
1092
|
});
|
|
1017
1093
|
}
|
|
1018
1094
|
var DeleteButton = styled6(EditorButton).withConfig({
|
|
1019
|
-
componentId: "sc-
|
|
1095
|
+
componentId: "sc-a4d52175-14"
|
|
1020
1096
|
})([
|
|
1021
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;}`
|
|
1022
1098
|
]);
|
|
1023
1099
|
var CellEditorInput = styled6.textarea.withConfig({
|
|
1024
|
-
componentId: "sc-
|
|
1100
|
+
componentId: "sc-a4d52175-15"
|
|
1025
1101
|
})([
|
|
1026
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:`,
|
|
1027
1103
|
`;}&:focus{outline:1px solid `,
|
|
1104
|
+
`;}&[data-fees-column-selected="true"]{border-color:`,
|
|
1028
1105
|
`;}`
|
|
1029
|
-
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.accent.primary);
|
|
1106
|
+
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
1030
1107
|
function CellEditor({ onInput, ...props }) {
|
|
1031
|
-
const ref =
|
|
1108
|
+
const ref = useRef3(null);
|
|
1032
1109
|
const fit = () => {
|
|
1033
1110
|
const element = ref.current;
|
|
1034
1111
|
if (!element) return;
|
|
@@ -1070,7 +1147,7 @@ function CellEditor({ onInput, ...props }) {
|
|
|
1070
1147
|
});
|
|
1071
1148
|
}
|
|
1072
1149
|
function RowTagSelect({ selected, options, onChange }) {
|
|
1073
|
-
const selectRoot =
|
|
1150
|
+
const selectRoot = useRef3(null);
|
|
1074
1151
|
return /* @__PURE__ */ _jsx(EditGroup, {
|
|
1075
1152
|
children: /* @__PURE__ */ _jsx("div", {
|
|
1076
1153
|
ref: selectRoot,
|
|
@@ -1095,7 +1172,7 @@ function RowTagSelect({ selected, options, onChange }) {
|
|
|
1095
1172
|
fontSize: 13
|
|
1096
1173
|
},
|
|
1097
1174
|
children: [
|
|
1098
|
-
options.map((item) => /* @__PURE__ */ _jsxs(
|
|
1175
|
+
options.map((item) => /* @__PURE__ */ _jsxs(MenuItem3, {
|
|
1099
1176
|
value: item,
|
|
1100
1177
|
children: [
|
|
1101
1178
|
/* @__PURE__ */ _jsx(Checkbox, {
|
|
@@ -1107,7 +1184,7 @@ function RowTagSelect({ selected, options, onChange }) {
|
|
|
1107
1184
|
item
|
|
1108
1185
|
]
|
|
1109
1186
|
}, item)),
|
|
1110
|
-
!options.length && /* @__PURE__ */ _jsx(
|
|
1187
|
+
!options.length && /* @__PURE__ */ _jsx(MenuItem3, {
|
|
1111
1188
|
disabled: true,
|
|
1112
1189
|
children: "Ch\u01B0a c\xF3 tag \u2014 d\xF9ng n\xFAt Th\xEAm tag ph\xEDa tr\xEAn"
|
|
1113
1190
|
})
|
|
@@ -1156,16 +1233,17 @@ var rightAlignedColumns = /* @__PURE__ */ new Set([
|
|
|
1156
1233
|
"priceUnit",
|
|
1157
1234
|
"unit"
|
|
1158
1235
|
]);
|
|
1159
|
-
function FeesTable({ value, editable = false, onChange, labels, size = "md", tagOrder = [], language = "vi" }) {
|
|
1236
|
+
function FeesTable({ value, editable = false, onChange, labels: labels2, size = "md", tagOrder = [], language = "vi" }) {
|
|
1160
1237
|
const [search, setSearch] = useState2("");
|
|
1161
1238
|
const [tag, setTag] = useState2("");
|
|
1162
1239
|
const [page, setPage] = useState2(1);
|
|
1163
1240
|
const [pageSize, setPageSize] = useState2(FEES_PAGE_SIZE);
|
|
1164
1241
|
const [columnsOpen, setColumnsOpen] = useState2(false);
|
|
1165
1242
|
const [typographyOpen, setTypographyOpen] = useState2(false);
|
|
1243
|
+
const [selectedColumnKey, setSelectedColumnKey] = useState2("");
|
|
1166
1244
|
const english = language === "en";
|
|
1167
1245
|
const canEdit = editable && Boolean(onChange);
|
|
1168
|
-
const tableRoot =
|
|
1246
|
+
const tableRoot = useRef3(null);
|
|
1169
1247
|
useLayoutEffect(() => {
|
|
1170
1248
|
const root = tableRoot.current;
|
|
1171
1249
|
if (!root || !canEdit) return;
|
|
@@ -1200,10 +1278,17 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1200
1278
|
onChange?.({
|
|
1201
1279
|
...value,
|
|
1202
1280
|
columns: value.columns.filter((column) => column.key !== deleteTarget.id),
|
|
1203
|
-
rows: value.rows.map((row) =>
|
|
1204
|
-
...row
|
|
1205
|
-
|
|
1206
|
-
|
|
1281
|
+
rows: value.rows.map((row) => {
|
|
1282
|
+
const { cellAlignments, ...rest } = row;
|
|
1283
|
+
const alignments = Object.fromEntries(Object.entries(cellAlignments ?? {}).filter(([key]) => key !== deleteTarget.id));
|
|
1284
|
+
return {
|
|
1285
|
+
...rest,
|
|
1286
|
+
cells: Object.fromEntries(Object.entries(row.cells).filter(([key]) => key !== deleteTarget.id)),
|
|
1287
|
+
...Object.keys(alignments).length ? {
|
|
1288
|
+
cellAlignments: alignments
|
|
1289
|
+
} : {}
|
|
1290
|
+
};
|
|
1291
|
+
})
|
|
1207
1292
|
});
|
|
1208
1293
|
}
|
|
1209
1294
|
setDeleteTarget(null);
|
|
@@ -1236,6 +1321,13 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1236
1321
|
const filtered = filterFeesRows(value, search, activeTag);
|
|
1237
1322
|
const displayedRows = canEdit ? filtered : sortFeesRowsByName(filtered, language);
|
|
1238
1323
|
const pagination = paginateFeesRows(displayedRows, page, pageSize);
|
|
1324
|
+
const selectedColumn = value.columns.find((column) => column.key === selectedColumnKey);
|
|
1325
|
+
useLayoutEffect(() => {
|
|
1326
|
+
if (selectedColumnKey && !selectedColumn) setSelectedColumnKey("");
|
|
1327
|
+
}, [
|
|
1328
|
+
selectedColumnKey,
|
|
1329
|
+
selectedColumn
|
|
1330
|
+
]);
|
|
1239
1331
|
const moveColumn = (from, to) => onChange?.({
|
|
1240
1332
|
...value,
|
|
1241
1333
|
columns: moveFeesItem(value.columns, from, to)
|
|
@@ -1288,6 +1380,10 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1288
1380
|
rows: 2,
|
|
1289
1381
|
value: column.title,
|
|
1290
1382
|
"aria-label": `Ti\xEAu \u0111\u1EC1 c\u1ED9t ${index + 1}`,
|
|
1383
|
+
style: {
|
|
1384
|
+
textAlign: column.textAlign ?? value.typography?.thead?.textAlign ?? "left"
|
|
1385
|
+
},
|
|
1386
|
+
"data-fees-column-selected": selectedColumnKey === column.key,
|
|
1291
1387
|
onChange: (event) => onChange?.({
|
|
1292
1388
|
...value,
|
|
1293
1389
|
columns: value.columns.map((item) => item.key === column.key ? {
|
|
@@ -1312,13 +1408,18 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1312
1408
|
})
|
|
1313
1409
|
]
|
|
1314
1410
|
}) : /* @__PURE__ */ _jsx(FeesCellContent, {
|
|
1315
|
-
$align: value.typography?.thead?.textAlign
|
|
1411
|
+
$align: column.textAlign ?? value.typography?.thead?.textAlign,
|
|
1412
|
+
$alignRight: rightAlignedColumns.has(column.key),
|
|
1316
1413
|
children: column.title
|
|
1317
1414
|
}),
|
|
1318
1415
|
render: (_unused, row) => canEdit ? /* @__PURE__ */ _jsx(CellEditor, {
|
|
1319
1416
|
rows: Math.max(2, (row.cells[column.key] ?? "").split("\n").length),
|
|
1320
1417
|
value: row.cells[column.key] ?? "",
|
|
1321
1418
|
"aria-label": `${column.title} \u2014 ${row.cells.name || "H\xE0ng m\u1EDBi"}`,
|
|
1419
|
+
style: {
|
|
1420
|
+
textAlign: column.textAlign ?? row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign ?? "left"
|
|
1421
|
+
},
|
|
1422
|
+
"data-fees-column-selected": selectedColumnKey === column.key,
|
|
1322
1423
|
onChange: (event) => changeRow(row.id, {
|
|
1323
1424
|
cells: {
|
|
1324
1425
|
...row.cells,
|
|
@@ -1326,7 +1427,8 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1326
1427
|
}
|
|
1327
1428
|
})
|
|
1328
1429
|
}) : /* @__PURE__ */ _jsx(FeesCellContent, {
|
|
1329
|
-
$align:
|
|
1430
|
+
$align: column.textAlign ?? row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign,
|
|
1431
|
+
$alignRight: rightAlignedColumns.has(column.key),
|
|
1330
1432
|
children: row.cells[column.key] ?? ""
|
|
1331
1433
|
})
|
|
1332
1434
|
}));
|
|
@@ -1411,7 +1513,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1411
1513
|
items: [
|
|
1412
1514
|
{
|
|
1413
1515
|
id: "",
|
|
1414
|
-
label:
|
|
1516
|
+
label: labels2?.all ?? "T\u1EA5t c\u1EA3"
|
|
1415
1517
|
},
|
|
1416
1518
|
...tags.map((item) => ({
|
|
1417
1519
|
id: item,
|
|
@@ -1429,8 +1531,8 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1429
1531
|
children: /* @__PURE__ */ _jsx(InputCommon, {
|
|
1430
1532
|
leftIcon: /* @__PURE__ */ _jsx(FeesSearchIcon, {}),
|
|
1431
1533
|
size: "sm",
|
|
1432
|
-
"aria-label":
|
|
1433
|
-
placeholder:
|
|
1534
|
+
"aria-label": labels2?.search ?? "T\xECm t\xEAn h\xE0ng h\xF3a ho\u1EB7c m\xE3",
|
|
1535
|
+
placeholder: labels2?.search ?? "T\xECm t\xEAn h\xE0ng h\xF3a ho\u1EB7c m\xE3",
|
|
1434
1536
|
value: search,
|
|
1435
1537
|
onChange: (event) => {
|
|
1436
1538
|
setSearch(event.target.value);
|
|
@@ -1528,6 +1630,15 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1528
1630
|
})
|
|
1529
1631
|
})
|
|
1530
1632
|
}),
|
|
1633
|
+
canEdit && /* @__PURE__ */ _jsx(FeesColumnAlignmentControls, {
|
|
1634
|
+
columns: value.columns,
|
|
1635
|
+
columnKey: selectedColumnKey,
|
|
1636
|
+
english,
|
|
1637
|
+
onSelectColumn: setSelectedColumnKey,
|
|
1638
|
+
onChange: (textAlign) => {
|
|
1639
|
+
if (selectedColumn) onChange?.(setFeesColumnAlignment(value, selectedColumn.key, textAlign));
|
|
1640
|
+
}
|
|
1641
|
+
}),
|
|
1531
1642
|
/* @__PURE__ */ _jsx(AlignedFeesTable, {
|
|
1532
1643
|
$typography: value.typography,
|
|
1533
1644
|
$mobileColumnWidths: columns.map((column) => Math.ceil((mobileColumnWidths[column.key] ?? 88) * mobileFontScale)),
|
|
@@ -1538,7 +1649,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1538
1649
|
dataSource: pagination.rows,
|
|
1539
1650
|
rowKey: "id",
|
|
1540
1651
|
size,
|
|
1541
|
-
empty:
|
|
1652
|
+
empty: labels2?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
|
|
1542
1653
|
scroll: {
|
|
1543
1654
|
x: canEdit ? Math.max(1440, value.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + 300) : value.columns.length * 170 + 8
|
|
1544
1655
|
}
|
|
@@ -1578,11 +1689,11 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1578
1689
|
25,
|
|
1579
1690
|
50,
|
|
1580
1691
|
100
|
|
1581
|
-
].map((size2) => /* @__PURE__ */ _jsx(
|
|
1692
|
+
].map((size2) => /* @__PURE__ */ _jsx(MenuItem3, {
|
|
1582
1693
|
value: size2,
|
|
1583
1694
|
children: size2
|
|
1584
1695
|
}, size2)),
|
|
1585
|
-
/* @__PURE__ */ _jsx(
|
|
1696
|
+
/* @__PURE__ */ _jsx(MenuItem3, {
|
|
1586
1697
|
value: -1,
|
|
1587
1698
|
children: english ? "All" : "T\u1EA5t c\u1EA3"
|
|
1588
1699
|
})
|
|
@@ -1691,7 +1802,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1691
1802
|
]
|
|
1692
1803
|
}),
|
|
1693
1804
|
/* @__PURE__ */ _jsx(DialogActions, {
|
|
1694
|
-
children: /* @__PURE__ */ _jsx(
|
|
1805
|
+
children: /* @__PURE__ */ _jsx(Button3, {
|
|
1695
1806
|
variant: "contained",
|
|
1696
1807
|
onClick: () => setColumnsOpen(false),
|
|
1697
1808
|
children: "Xong"
|
|
@@ -1712,7 +1823,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1712
1823
|
children: "T\u1EA1o tag m\u1EDBi"
|
|
1713
1824
|
}),
|
|
1714
1825
|
/* @__PURE__ */ _jsx(DialogContent, {
|
|
1715
|
-
children: /* @__PURE__ */ _jsx(
|
|
1826
|
+
children: /* @__PURE__ */ _jsx(TextField3, {
|
|
1716
1827
|
autoFocus: true,
|
|
1717
1828
|
fullWidth: true,
|
|
1718
1829
|
margin: "dense",
|
|
@@ -1731,11 +1842,11 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1731
1842
|
}),
|
|
1732
1843
|
/* @__PURE__ */ _jsxs(DialogActions, {
|
|
1733
1844
|
children: [
|
|
1734
|
-
/* @__PURE__ */ _jsx(
|
|
1845
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1735
1846
|
onClick: () => setCreateTagOpen(false),
|
|
1736
1847
|
children: "H\u1EE7y"
|
|
1737
1848
|
}),
|
|
1738
|
-
/* @__PURE__ */ _jsx(
|
|
1849
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1739
1850
|
variant: "contained",
|
|
1740
1851
|
disabled: !newTagName || duplicateTag,
|
|
1741
1852
|
onClick: createTag,
|
|
@@ -1770,12 +1881,12 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1770
1881
|
}),
|
|
1771
1882
|
/* @__PURE__ */ _jsxs(DialogActions, {
|
|
1772
1883
|
children: [
|
|
1773
|
-
/* @__PURE__ */ _jsx(
|
|
1884
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1774
1885
|
autoFocus: true,
|
|
1775
1886
|
onClick: () => setDeleteTarget(null),
|
|
1776
1887
|
children: "H\u1EE7y"
|
|
1777
1888
|
}),
|
|
1778
|
-
/* @__PURE__ */ _jsxs(
|
|
1889
|
+
/* @__PURE__ */ _jsxs(Button3, {
|
|
1779
1890
|
color: "error",
|
|
1780
1891
|
variant: "contained",
|
|
1781
1892
|
onClick: confirmDelete,
|
|
@@ -1794,7 +1905,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1794
1905
|
}
|
|
1795
1906
|
|
|
1796
1907
|
// src/wikex/fees-manager.tsx
|
|
1797
|
-
import { Fragment as Fragment2, jsx as
|
|
1908
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1798
1909
|
function FeesManager({
|
|
1799
1910
|
entries,
|
|
1800
1911
|
selectedId,
|
|
@@ -1814,16 +1925,16 @@ function FeesManager({
|
|
|
1814
1925
|
}) {
|
|
1815
1926
|
const entry = entries.find((item) => item.id === selectedId);
|
|
1816
1927
|
const key = `${selectedId}:${language}`;
|
|
1817
|
-
return /* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
1928
|
+
return /* @__PURE__ */ jsxs7(Stack3, { spacing: 3, sx: { minWidth: 0, width: 1 }, children: [
|
|
1929
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: { xs: "column", md: "row" }, justifyContent: "space-between", alignItems: { md: "center" }, gap: 2.5, children: [
|
|
1930
|
+
/* @__PURE__ */ jsxs7(Stack3, { spacing: 1, sx: { minWidth: 0, maxWidth: 720 }, children: [
|
|
1931
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "h4", children: "Ph\xED & k\xFD qu\u1EF9" }),
|
|
1932
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "body2", color: "text.secondary", children: "Qu\u1EA3n l\xFD d\u1EEF li\u1EC7u, tag v\xE0 th\u1EE9 t\u1EF1 hi\u1EC3n th\u1ECB. B\u1ED1 c\u1EE5c v\xE0 n\u1ED9i dung gi\u1EDBi thi\u1EC7u \u0111\u01B0\u1EE3c ch\u1EC9nh trong Layout trang t\u0129nh." })
|
|
1822
1933
|
] }),
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
dirtyKeys.includes(key) && /* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
1826
|
-
|
|
1934
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: "row", spacing: 1.5, alignItems: "center", flexShrink: 0, children: [
|
|
1935
|
+
dirtyKeys.includes(key) && /* @__PURE__ */ jsx7(Chip, { size: "small", color: "warning", label: "Ch\u01B0a l\u01B0u" }),
|
|
1936
|
+
/* @__PURE__ */ jsx7(
|
|
1937
|
+
Button4,
|
|
1827
1938
|
{
|
|
1828
1939
|
variant: "contained",
|
|
1829
1940
|
loading: saving,
|
|
@@ -1835,17 +1946,17 @@ function FeesManager({
|
|
|
1835
1946
|
)
|
|
1836
1947
|
] })
|
|
1837
1948
|
] }),
|
|
1838
|
-
!canWrite && /* @__PURE__ */
|
|
1839
|
-
notice && /* @__PURE__ */
|
|
1840
|
-
!entries.length ? /* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
1949
|
+
!canWrite && /* @__PURE__ */ jsx7(Alert, { severity: "info", children: "B\u1EA1n c\xF3 quy\u1EC1n xem b\u1EA3ng ph\xED. C\u1EA7n quy\u1EC1n s\u1EEDa n\u1ED9i dung \u0111\u1EC3 thay \u0111\u1ED5i d\u1EEF li\u1EC7u." }),
|
|
1950
|
+
notice && /* @__PURE__ */ jsx7(Alert, { severity: notice.severity, onClose: onDismissNotice, children: notice.message }),
|
|
1951
|
+
!entries.length ? /* @__PURE__ */ jsx7(Alert, { severity: "info", children: "Ch\u01B0a c\xF3 b\u1EA3ng ph\xED. Th\xEAm component B\u1EA3ng ph\xED & K\xFD qu\u1EF9 v\xE0o m\u1ED9t trang trong Layout trang t\u0129nh \u0111\u1EC3 b\u1EAFt \u0111\u1EA7u." }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1952
|
+
/* @__PURE__ */ jsx7(Card, { variant: "outlined", sx: { p: { xs: 2.5, md: 3 }, boxShadow: "none" }, children: /* @__PURE__ */ jsxs7(Stack3, { spacing: 2.5, children: [
|
|
1953
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 1.5, flexWrap: "wrap", children: [
|
|
1954
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "subtitle1", children: "B\u1EA3ng \u0111ang qu\u1EA3n l\xFD" }),
|
|
1955
|
+
/* @__PURE__ */ jsx7(Chip, { size: "small", variant: statusChipVariant, label: entry?.status === "published" ? "Trang \u0111\xE3 xu\u1EA5t b\u1EA3n" : "Trang b\u1EA3n nh\xE1p", color: entry?.status === "published" ? "success" : "default" })
|
|
1845
1956
|
] }),
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
|
|
1957
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: { xs: "column", md: "row" }, spacing: 2.5, alignItems: { md: "flex-end" }, children: [
|
|
1958
|
+
/* @__PURE__ */ jsx7(
|
|
1959
|
+
TextField4,
|
|
1849
1960
|
{
|
|
1850
1961
|
select: true,
|
|
1851
1962
|
size: "small",
|
|
@@ -1855,7 +1966,7 @@ function FeesManager({
|
|
|
1855
1966
|
fullWidth: true,
|
|
1856
1967
|
sx: { flex: 1, minWidth: 0 },
|
|
1857
1968
|
onChange: (event) => onSelectEntry(event.target.value),
|
|
1858
|
-
children: entries.map((item, index) => /* @__PURE__ */
|
|
1969
|
+
children: entries.map((item, index) => /* @__PURE__ */ jsxs7(MenuItem4, { value: item.id, children: [
|
|
1859
1970
|
item.pageTitle,
|
|
1860
1971
|
" \xB7 /",
|
|
1861
1972
|
item.slug,
|
|
@@ -1865,9 +1976,9 @@ function FeesManager({
|
|
|
1865
1976
|
] }, item.id))
|
|
1866
1977
|
}
|
|
1867
1978
|
),
|
|
1868
|
-
/* @__PURE__ */
|
|
1869
|
-
/* @__PURE__ */
|
|
1870
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsxs7(Stack3, { spacing: 1, sx: { width: { xs: 1, md: 240 }, flexShrink: 0 }, children: [
|
|
1980
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "caption", color: "text.secondary", children: "Ng\xF4n ng\u1EEF n\u1ED9i dung" }),
|
|
1981
|
+
/* @__PURE__ */ jsxs7(
|
|
1871
1982
|
ToggleButtonGroup,
|
|
1872
1983
|
{
|
|
1873
1984
|
size: "small",
|
|
@@ -1880,11 +1991,11 @@ function FeesManager({
|
|
|
1880
1991
|
if (next === "vi" || next === "en") onSelectLanguage(next);
|
|
1881
1992
|
},
|
|
1882
1993
|
children: [
|
|
1883
|
-
/* @__PURE__ */
|
|
1994
|
+
/* @__PURE__ */ jsxs7(ToggleButton, { value: "vi", children: [
|
|
1884
1995
|
"Ti\u1EBFng Vi\u1EC7t",
|
|
1885
1996
|
dirtyKeys.includes(`${selectedId}:vi`) ? " \u2022" : ""
|
|
1886
1997
|
] }),
|
|
1887
|
-
/* @__PURE__ */
|
|
1998
|
+
/* @__PURE__ */ jsxs7(ToggleButton, { value: "en", children: [
|
|
1888
1999
|
"English",
|
|
1889
2000
|
dirtyKeys.includes(`${selectedId}:en`) ? " \u2022" : ""
|
|
1890
2001
|
] })
|
|
@@ -1894,22 +2005,22 @@ function FeesManager({
|
|
|
1894
2005
|
] })
|
|
1895
2006
|
] })
|
|
1896
2007
|
] }) }),
|
|
1897
|
-
parseError && /* @__PURE__ */
|
|
1898
|
-
table && /* @__PURE__ */
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
/* @__PURE__ */
|
|
1901
|
-
/* @__PURE__ */
|
|
1902
|
-
/* @__PURE__ */
|
|
2008
|
+
parseError && /* @__PURE__ */ jsx7(Alert, { severity: "error", children: parseError }),
|
|
2009
|
+
table && /* @__PURE__ */ jsxs7(Card, { inert: saving, "aria-busy": saving, sx: { minWidth: 0, opacity: saving ? 0.65 : 1 }, children: [
|
|
2010
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: { xs: "column", sm: "row" }, spacing: 2, justifyContent: "space-between", alignItems: { sm: "center" }, sx: { px: { xs: 2.5, md: 3 }, py: 2.5 }, children: [
|
|
2011
|
+
/* @__PURE__ */ jsxs7(Stack3, { spacing: 0.5, children: [
|
|
2012
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "subtitle1", children: "D\u1EEF li\u1EC7u ph\xED & k\xFD qu\u1EF9" }),
|
|
2013
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "body2", color: "text.secondary", children: canWrite ? "S\u1EEDa tr\u1EF1c ti\u1EBFp trong \xF4. D\xF9ng Qu\u1EA3n l\xFD c\u1ED9t ho\u1EB7c V\u1ECB tr\xED \u0111\u1EC3 \u0111\u1ED5i th\u1EE9 t\u1EF1." : "Tra c\u1EE9u d\u1EEF li\u1EC7u v\xE0 l\u1ECDc theo nh\xF3m h\xE0ng h\xF3a." })
|
|
1903
2014
|
] }),
|
|
1904
|
-
/* @__PURE__ */
|
|
1905
|
-
/* @__PURE__ */
|
|
1906
|
-
/* @__PURE__ */
|
|
2015
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: "row", spacing: 1, flexShrink: 0, children: [
|
|
2016
|
+
/* @__PURE__ */ jsx7(Chip, { size: "small", variant: "outlined", label: `${table.rows.length} d\xF2ng` }),
|
|
2017
|
+
/* @__PURE__ */ jsx7(Chip, { size: "small", variant: "outlined", label: `${table.columns.length} c\u1ED9t` })
|
|
1907
2018
|
] })
|
|
1908
2019
|
] }),
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
1911
|
-
/* @__PURE__ */
|
|
1912
|
-
/* @__PURE__ */
|
|
2020
|
+
/* @__PURE__ */ jsx7(Divider, {}),
|
|
2021
|
+
/* @__PURE__ */ jsxs7(Box2, { sx: { p: { xs: 2.5, md: 3 }, minWidth: 0 }, children: [
|
|
2022
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "caption", color: "text.secondary", sx: { display: { xs: "block", md: "none" }, mb: 2 }, children: "Vu\u1ED1t ngang trong b\u1EA3ng \u0111\u1EC3 xem th\xEAm c\xE1c c\u1ED9t." }),
|
|
2023
|
+
/* @__PURE__ */ jsx7(FeesTable, { value: table, language, editable: canWrite, onChange: canWrite && !saving ? onChange : void 0 }, key)
|
|
1913
2024
|
] })
|
|
1914
2025
|
] })
|
|
1915
2026
|
] })
|