@enyxs/wikex-components 0.11.30 → 0.11.32
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 +15 -0
- package/dist/fees-model.d.mts +16 -1
- package/dist/fees-model.d.ts +16 -1
- package/dist/fees-model.js +51 -2
- package/dist/fees-model.js.map +1 -1
- package/dist/fees-model.mjs +48 -2
- 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 +344 -196
- package/dist/fees.js.map +1 -1
- package/dist/fees.mjs +264 -116
- 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 +1103 -940
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +957 -794
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/fees.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 MenuItem3, Stack as Stack3, TextField as TextField3, 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";
|
|
@@ -13,7 +13,7 @@ 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
18
|
import MenuItem2 from "@mui/material/MenuItem";
|
|
19
19
|
import Checkbox from "@mui/material/Checkbox";
|
|
@@ -27,6 +27,7 @@ import { Box, Button, MenuItem, Stack, TextField, Typography } from "@mui/materi
|
|
|
27
27
|
var FEES_FONT_SIZE_MIN = 8;
|
|
28
28
|
var FEES_FONT_SIZE_MAX = 32;
|
|
29
29
|
var FEES_FONT_WEIGHTS = [400, 500, 600, 700, 800];
|
|
30
|
+
var FEES_TEXT_ALIGNS = ["left", "center", "right"];
|
|
30
31
|
var FEES_PAGE_SIZE = 25;
|
|
31
32
|
function normalizeFeesSearch(value) {
|
|
32
33
|
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/đ/g, "d").replace(/Đ/g, "D").toLowerCase().trim();
|
|
@@ -35,6 +36,15 @@ function filterFeesRows(data, search, tag) {
|
|
|
35
36
|
const query = normalizeFeesSearch(search);
|
|
36
37
|
return data.rows.filter((row) => (!tag || row.tags.includes(tag)) && (!query || Object.values(row.cells).some((cell) => normalizeFeesSearch(cell).includes(query))));
|
|
37
38
|
}
|
|
39
|
+
function sortFeesRowsByName(rows, language = "vi") {
|
|
40
|
+
const collator = new Intl.Collator(language, { sensitivity: "base", numeric: true });
|
|
41
|
+
return [...rows].sort((a, b) => {
|
|
42
|
+
const left = (a.cells.name ?? "").trim();
|
|
43
|
+
const right = (b.cells.name ?? "").trim();
|
|
44
|
+
if (!left || !right) return left ? -1 : right ? 1 : 0;
|
|
45
|
+
return collator.compare(left, right);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
38
48
|
function paginateFeesRows(rows, requestedPage, pageSize = FEES_PAGE_SIZE) {
|
|
39
49
|
const size = pageSize === -1 ? Math.max(1, rows.length) : Number.isInteger(pageSize) && pageSize > 0 ? pageSize : FEES_PAGE_SIZE;
|
|
40
50
|
const pageCount = Math.max(1, Math.ceil(rows.length / size));
|
|
@@ -48,6 +58,24 @@ function moveFeesItem(items, from, to) {
|
|
|
48
58
|
next.splice(to, 0, item);
|
|
49
59
|
return next;
|
|
50
60
|
}
|
|
61
|
+
function setFeesCellAlignment(table, target, textAlign) {
|
|
62
|
+
if (!table.columns.some((column) => column.key === target.columnKey)) return table;
|
|
63
|
+
if (target.part === "thead") {
|
|
64
|
+
return { ...table, columns: table.columns.map((column) => {
|
|
65
|
+
if (column.key !== target.columnKey) return column;
|
|
66
|
+
const { textAlign: _previous, ...rest } = column;
|
|
67
|
+
return { ...rest, ...textAlign ? { textAlign } : {} };
|
|
68
|
+
}) };
|
|
69
|
+
}
|
|
70
|
+
if (!table.rows.some((row) => row.id === target.rowId)) return table;
|
|
71
|
+
return { ...table, rows: table.rows.map((row) => {
|
|
72
|
+
if (row.id !== target.rowId) return row;
|
|
73
|
+
const { cellAlignments: _previous, ...rest } = row;
|
|
74
|
+
const alignments = { ...row.cellAlignments, ...textAlign ? { [target.columnKey]: textAlign } : {} };
|
|
75
|
+
if (!textAlign) delete alignments[target.columnKey];
|
|
76
|
+
return { ...rest, ...Object.keys(alignments).length ? { cellAlignments: alignments } : {} };
|
|
77
|
+
}) };
|
|
78
|
+
}
|
|
51
79
|
|
|
52
80
|
// src/wikex/fees-typography-controls.tsx
|
|
53
81
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -92,15 +120,21 @@ function FontSizeInput({ label, value, onChange }) {
|
|
|
92
120
|
}
|
|
93
121
|
function FeesTypographyControls({ value, onChange }) {
|
|
94
122
|
const root = useRef(null);
|
|
95
|
-
const update = (part, patch) =>
|
|
123
|
+
const update = (part, patch) => {
|
|
124
|
+
const style = Object.fromEntries(Object.entries({ ...value?.[part], ...patch }).filter(([, setting]) => setting !== void 0));
|
|
125
|
+
const next = { ...value };
|
|
126
|
+
if (Object.keys(style).length) next[part] = style;
|
|
127
|
+
else delete next[part];
|
|
128
|
+
onChange(Object.keys(next).length ? next : void 0);
|
|
129
|
+
};
|
|
96
130
|
return /* @__PURE__ */ jsxs(Box, { ref: root, role: "group", "aria-label": "\u0110\u1ECBnh d\u1EA1ng ch\u1EEF b\u1EA3ng ph\xED", sx: { mt: 2, p: { xs: 2, sm: 2.5 }, border: "1px solid", borderColor: "divider", borderRadius: 1.5 }, children: [
|
|
97
131
|
/* @__PURE__ */ jsxs(Stack, { direction: { xs: "column", sm: "row" }, gap: 1.5, justifyContent: "space-between", alignItems: { sm: "center" }, sx: { mb: 2 }, children: [
|
|
98
132
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
99
133
|
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "\u0110\u1ECBnh d\u1EA1ng ch\u1EEF" }),
|
|
100
|
-
/* @__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. C\u0103n l\u1EC1 \u0111\u01B0\u1EE3c ch\u1EC9nh ri\xEAng b\u1EB1ng c\xE1ch ch\u1ECDn t\u1EEBng \xF4." })
|
|
101
135
|
] }),
|
|
102
136
|
/* @__PURE__ */ jsxs(Stack, { direction: "row", gap: 1, flexShrink: 0, children: [
|
|
103
|
-
/* @__PURE__ */ jsx(Button, { size: "small", variant: "outlined", onClick: () => onChange({ thead: { fontSize: 14, fontWeight: 700 }, tbody: { fontSize: 14, fontWeight: 500 } }), children: "D\u1EC5 \u0111\u1ECDc" }),
|
|
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" }),
|
|
104
138
|
/* @__PURE__ */ jsx(Button, { size: "small", color: "inherit", disabled: !value, onClick: () => onChange(void 0), children: "M\u1EB7c \u0111\u1ECBnh" })
|
|
105
139
|
] })
|
|
106
140
|
] }),
|
|
@@ -136,6 +170,58 @@ function FeesTypographyControls({ value, onChange }) {
|
|
|
136
170
|
] });
|
|
137
171
|
}
|
|
138
172
|
|
|
173
|
+
// src/wikex/fees-cell-alignment-controls.tsx
|
|
174
|
+
import { Button as Button2, Stack as Stack2, Typography as Typography2 } from "@mui/material";
|
|
175
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
176
|
+
var labels = { left: "C\u0103n tr\xE1i", center: "C\u0103n gi\u1EEFa", right: "C\u0103n ph\u1EA3i" };
|
|
177
|
+
var englishLabels = { left: "Align left", center: "Align center", right: "Align right" };
|
|
178
|
+
function FeesCellAlignmentControls({ label, value, english, onChange }) {
|
|
179
|
+
return /* @__PURE__ */ jsxs2(
|
|
180
|
+
Stack2,
|
|
181
|
+
{
|
|
182
|
+
role: "group",
|
|
183
|
+
"aria-label": english ? "Selected cell alignment" : "C\u0103n l\u1EC1 \xF4 \u0111ang ch\u1ECDn",
|
|
184
|
+
direction: { xs: "column", sm: "row" },
|
|
185
|
+
spacing: 1.5,
|
|
186
|
+
alignItems: { sm: "center" },
|
|
187
|
+
sx: { my: 2, p: 1.5, border: "1px solid", borderColor: "divider", borderRadius: 1.5 },
|
|
188
|
+
children: [
|
|
189
|
+
/* @__PURE__ */ jsxs2(Stack2, { spacing: 0.5, sx: { flex: 1, minWidth: 0 }, children: [
|
|
190
|
+
/* @__PURE__ */ jsx2(Typography2, { variant: "subtitle2", children: english ? "Selected cell alignment" : "C\u0103n l\u1EC1 \xF4 \u0111ang ch\u1ECDn" }),
|
|
191
|
+
/* @__PURE__ */ jsx2(Typography2, { variant: "caption", color: "text.secondary", title: label, noWrap: true, "aria-live": "polite", children: label ?? (english ? "Select a header or value cell to align it." : "B\u1EA5m v\xE0o \xF4 ti\xEAu \u0111\u1EC1 ho\u1EB7c \xF4 gi\xE1 tr\u1ECB c\u1EA7n c\u0103n l\u1EC1.") })
|
|
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,
|
|
209
|
+
{
|
|
210
|
+
size: "small",
|
|
211
|
+
color: "inherit",
|
|
212
|
+
disabled: !label || value === void 0,
|
|
213
|
+
"aria-label": english ? "Reset selected cell alignment" : "C\u0103n l\u1EC1 m\u1EB7c \u0111\u1ECBnh cho \xF4 \u0111ang ch\u1ECDn",
|
|
214
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
215
|
+
onClick: () => onChange(void 0),
|
|
216
|
+
children: english ? "Default" : "M\u1EB7c \u0111\u1ECBnh"
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
] })
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
139
225
|
// src/commodity-original/styles/colors.ts
|
|
140
226
|
var lightColors = {
|
|
141
227
|
background: {
|
|
@@ -351,7 +437,7 @@ function getTableFixedColumnOffset(columns, columnIndex) {
|
|
|
351
437
|
}
|
|
352
438
|
|
|
353
439
|
// src/commodity-original/components/Table/index.tsx
|
|
354
|
-
import { jsx as
|
|
440
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
355
441
|
function getCellValue(column, record) {
|
|
356
442
|
return column.dataIndex === void 0 ? void 0 : record[column.dataIndex];
|
|
357
443
|
}
|
|
@@ -424,7 +510,7 @@ function Table({
|
|
|
424
510
|
const nextSelectedRowKeys = event.target.checked ? [...selectedRowKeys, recordKey] : selectedRowKeys.filter((key) => key !== recordKey);
|
|
425
511
|
emitSelectionChange(nextSelectedRowKeys);
|
|
426
512
|
};
|
|
427
|
-
return /* @__PURE__ */
|
|
513
|
+
return /* @__PURE__ */ jsx3(TableScrollContainer, { children: /* @__PURE__ */ jsxs3(
|
|
428
514
|
TableRoot,
|
|
429
515
|
{
|
|
430
516
|
$minWidth: scroll?.x === void 0 ? void 0 : getTableColumnSize(scroll.x),
|
|
@@ -433,8 +519,8 @@ function Table({
|
|
|
433
519
|
className,
|
|
434
520
|
"data-size": size,
|
|
435
521
|
children: [
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
rowSelection ? /* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsxs3(TableHeaderRow, { children: [
|
|
523
|
+
rowSelection ? /* @__PURE__ */ jsx3(TableHeaderCell, { scope: "col", children: selectionType === "checkbox" ? /* @__PURE__ */ jsx3(
|
|
438
524
|
TableSelectionInput,
|
|
439
525
|
{
|
|
440
526
|
checked: isAllSelected,
|
|
@@ -443,8 +529,8 @@ function Table({
|
|
|
443
529
|
type: "checkbox"
|
|
444
530
|
}
|
|
445
531
|
) : null }) : null,
|
|
446
|
-
expandable ? /* @__PURE__ */
|
|
447
|
-
columns.map((column, columnIndex) => /* @__PURE__ */
|
|
532
|
+
expandable ? /* @__PURE__ */ jsx3(TableHeaderCell, { scope: "col" }) : null,
|
|
533
|
+
columns.map((column, columnIndex) => /* @__PURE__ */ jsx3(
|
|
448
534
|
TableHeaderCell,
|
|
449
535
|
{
|
|
450
536
|
$fixed: column.fixed,
|
|
@@ -452,7 +538,7 @@ function Table({
|
|
|
452
538
|
$width: column.width === void 0 ? void 0 : getTableColumnSize(column.width),
|
|
453
539
|
"data-column-key": column.key,
|
|
454
540
|
scope: "col",
|
|
455
|
-
children: column.sortable ? /* @__PURE__ */
|
|
541
|
+
children: column.sortable ? /* @__PURE__ */ jsx3(
|
|
456
542
|
TableSortButton,
|
|
457
543
|
{
|
|
458
544
|
"aria-pressed": sort?.field === column.key,
|
|
@@ -465,13 +551,13 @@ function Table({
|
|
|
465
551
|
column.key
|
|
466
552
|
))
|
|
467
553
|
] }) }),
|
|
468
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__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) => {
|
|
469
555
|
const recordKey = getRowKey(record);
|
|
470
556
|
const selectionProps = rowSelection?.getCheckboxProps?.(record);
|
|
471
557
|
const isExpanded = expandedRowKeySet.has(recordKey);
|
|
472
|
-
return /* @__PURE__ */
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
rowSelection ? /* @__PURE__ */
|
|
558
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
559
|
+
/* @__PURE__ */ jsxs3(TableRow, { "data-row-key": recordKey, children: [
|
|
560
|
+
rowSelection ? /* @__PURE__ */ jsx3(TableCell, { children: /* @__PURE__ */ jsx3(
|
|
475
561
|
TableSelectionInput,
|
|
476
562
|
{
|
|
477
563
|
checked: selectedRowKeySet.has(recordKey),
|
|
@@ -481,7 +567,7 @@ function Table({
|
|
|
481
567
|
type: selectionType
|
|
482
568
|
}
|
|
483
569
|
) }) : null,
|
|
484
|
-
expandable ? /* @__PURE__ */
|
|
570
|
+
expandable ? /* @__PURE__ */ jsx3(TableCell, { children: /* @__PURE__ */ jsx3(
|
|
485
571
|
TableExpandButton,
|
|
486
572
|
{
|
|
487
573
|
"aria-expanded": isExpanded,
|
|
@@ -492,7 +578,7 @@ function Table({
|
|
|
492
578
|
) }) : null,
|
|
493
579
|
columns.map((column, columnIndex) => {
|
|
494
580
|
const value = getCellValue(column, record);
|
|
495
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ jsx3(
|
|
496
582
|
TableCell,
|
|
497
583
|
{
|
|
498
584
|
$fixed: column.fixed,
|
|
@@ -504,7 +590,7 @@ function Table({
|
|
|
504
590
|
);
|
|
505
591
|
})
|
|
506
592
|
] }),
|
|
507
|
-
expandable?.render && isExpanded ? /* @__PURE__ */
|
|
593
|
+
expandable?.render && isExpanded ? /* @__PURE__ */ jsx3(TableRow, { children: /* @__PURE__ */ jsx3(TableExpandedCell, { colSpan: columnCount, children: expandable.render(record) }) }) : null
|
|
508
594
|
] }, recordKey);
|
|
509
595
|
}) })
|
|
510
596
|
]
|
|
@@ -559,7 +645,7 @@ var PaginationArrow = styled2.span.withConfig({
|
|
|
559
645
|
], chevron_right_default, chevron_right_default);
|
|
560
646
|
|
|
561
647
|
// src/commodity-original/components/Pagination/index.tsx
|
|
562
|
-
import { jsx as
|
|
648
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
563
649
|
function getPaginationItems(page, pageCount, siblingCount) {
|
|
564
650
|
const maxVisibleItems = siblingCount * 2 + 5;
|
|
565
651
|
if (pageCount <= maxVisibleItems) {
|
|
@@ -586,7 +672,7 @@ function Pagination({
|
|
|
586
672
|
onPageChange,
|
|
587
673
|
siblingCount = 1,
|
|
588
674
|
ariaLabel,
|
|
589
|
-
labels,
|
|
675
|
+
labels: labels2,
|
|
590
676
|
className
|
|
591
677
|
}) {
|
|
592
678
|
const { t } = useTranslation();
|
|
@@ -595,43 +681,43 @@ function Pagination({
|
|
|
595
681
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
596
682
|
const hasPreviousPage = currentPage > 1;
|
|
597
683
|
const hasNextPage = currentPage < safePageCount;
|
|
598
|
-
return /* @__PURE__ */
|
|
684
|
+
return /* @__PURE__ */ jsx4(
|
|
599
685
|
PaginationNav,
|
|
600
686
|
{
|
|
601
687
|
"aria-label": ariaLabel ?? t("pagination.navigation"),
|
|
602
688
|
className,
|
|
603
|
-
children: /* @__PURE__ */
|
|
604
|
-
/* @__PURE__ */
|
|
689
|
+
children: /* @__PURE__ */ jsxs4(PaginationList, { children: [
|
|
690
|
+
/* @__PURE__ */ jsx4(PaginationItem, { children: /* @__PURE__ */ jsx4(
|
|
605
691
|
PaginationButton,
|
|
606
692
|
{
|
|
607
|
-
"aria-label":
|
|
693
|
+
"aria-label": labels2?.previous ?? t("pagination.previous"),
|
|
608
694
|
"data-control": "previous",
|
|
609
695
|
disabled: !hasPreviousPage,
|
|
610
696
|
onClick: () => onPageChange(currentPage - 1),
|
|
611
697
|
type: "button",
|
|
612
|
-
children: /* @__PURE__ */
|
|
698
|
+
children: /* @__PURE__ */ jsx4(PaginationArrow, { "data-direction": "previous" })
|
|
613
699
|
}
|
|
614
700
|
) }),
|
|
615
|
-
items.map((item, index) => /* @__PURE__ */
|
|
701
|
+
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(
|
|
616
702
|
PaginationButton,
|
|
617
703
|
{
|
|
618
704
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
619
|
-
"aria-label": item === currentPage ?
|
|
705
|
+
"aria-label": item === currentPage ? labels2?.current(item) ?? t("pagination.current", { page: item }) : labels2?.page(item) ?? t("pagination.page", { page: item }),
|
|
620
706
|
"data-active": item === currentPage || void 0,
|
|
621
707
|
onClick: () => onPageChange(item),
|
|
622
708
|
type: "button",
|
|
623
709
|
children: item
|
|
624
710
|
}
|
|
625
711
|
) }, `${item}-${index}`)),
|
|
626
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ jsx4(PaginationItem, { children: /* @__PURE__ */ jsx4(
|
|
627
713
|
PaginationButton,
|
|
628
714
|
{
|
|
629
|
-
"aria-label":
|
|
715
|
+
"aria-label": labels2?.next ?? t("pagination.next"),
|
|
630
716
|
"data-control": "next",
|
|
631
717
|
disabled: !hasNextPage,
|
|
632
718
|
onClick: () => onPageChange(currentPage + 1),
|
|
633
719
|
type: "button",
|
|
634
|
-
children: /* @__PURE__ */
|
|
720
|
+
children: /* @__PURE__ */ jsx4(PaginationArrow, { "data-direction": "next" })
|
|
635
721
|
}
|
|
636
722
|
) })
|
|
637
723
|
] })
|
|
@@ -667,7 +753,7 @@ var InputAdornment = styled3.span.withConfig({
|
|
|
667
753
|
], ({ theme }) => theme.colors.text.secondary, InputCommonRoot, InputCommonRoot);
|
|
668
754
|
|
|
669
755
|
// src/commodity-original/components/InputCommon/index.tsx
|
|
670
|
-
import { jsx as
|
|
756
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
671
757
|
function InputCommon({
|
|
672
758
|
leftIcon,
|
|
673
759
|
rightIcon,
|
|
@@ -678,11 +764,11 @@ function InputCommon({
|
|
|
678
764
|
onClear,
|
|
679
765
|
...inputProps
|
|
680
766
|
}) {
|
|
681
|
-
return /* @__PURE__ */
|
|
682
|
-
leftIcon ? /* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
clearable && inputProps.value ? /* @__PURE__ */
|
|
685
|
-
errorMessage ? /* @__PURE__ */
|
|
767
|
+
return /* @__PURE__ */ jsxs5(InputCommonRoot, { "data-disabled": inputProps.disabled || void 0, "data-error": error || void 0, "data-size": size, children: [
|
|
768
|
+
leftIcon ? /* @__PURE__ */ jsx5(InputAdornment, { "aria-hidden": "true", children: leftIcon }) : null,
|
|
769
|
+
/* @__PURE__ */ jsx5(InputCommonField, { ...inputProps }),
|
|
770
|
+
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,
|
|
771
|
+
errorMessage ? /* @__PURE__ */ jsx5("span", { role: "alert", children: errorMessage }) : null
|
|
686
772
|
] });
|
|
687
773
|
}
|
|
688
774
|
|
|
@@ -714,7 +800,7 @@ var TabLine = styled4.span.withConfig({
|
|
|
714
800
|
], ({ theme }) => theme.colors.accent.primary, TabCommonList, TabCommonList);
|
|
715
801
|
|
|
716
802
|
// src/commodity-original/components/TabCommon/index.tsx
|
|
717
|
-
import { jsx as
|
|
803
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
718
804
|
function TabCommon({
|
|
719
805
|
items,
|
|
720
806
|
value,
|
|
@@ -723,7 +809,7 @@ function TabCommon({
|
|
|
723
809
|
className,
|
|
724
810
|
size = "md"
|
|
725
811
|
}) {
|
|
726
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsx6(
|
|
727
813
|
TabCommonList,
|
|
728
814
|
{
|
|
729
815
|
"aria-label": ariaLabel,
|
|
@@ -732,7 +818,7 @@ function TabCommon({
|
|
|
732
818
|
role: "tablist",
|
|
733
819
|
children: items.map((item) => {
|
|
734
820
|
const isActive = item.id === value;
|
|
735
|
-
return /* @__PURE__ */
|
|
821
|
+
return /* @__PURE__ */ jsxs6(
|
|
736
822
|
TabButton,
|
|
737
823
|
{
|
|
738
824
|
"aria-selected": isActive,
|
|
@@ -743,7 +829,7 @@ function TabCommon({
|
|
|
743
829
|
type: "button",
|
|
744
830
|
children: [
|
|
745
831
|
item.label,
|
|
746
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ jsx6(TabLine, { "aria-hidden": "true" })
|
|
747
833
|
]
|
|
748
834
|
},
|
|
749
835
|
item.id
|
|
@@ -850,32 +936,32 @@ var feesTheme = {
|
|
|
850
936
|
]))
|
|
851
937
|
};
|
|
852
938
|
var EditorActions = styled6.div.withConfig({
|
|
853
|
-
componentId: "sc-
|
|
939
|
+
componentId: "sc-3c959c0c-0"
|
|
854
940
|
})([
|
|
855
941
|
`display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
|
|
856
942
|
]);
|
|
857
943
|
var EditGroup = styled6.div.withConfig({
|
|
858
|
-
componentId: "sc-
|
|
944
|
+
componentId: "sc-3c959c0c-1"
|
|
859
945
|
})([
|
|
860
946
|
`display:flex;flex-direction:column;gap:6px;`
|
|
861
947
|
]);
|
|
862
948
|
var HeaderGroup = styled6(EditGroup).withConfig({
|
|
863
|
-
componentId: "sc-
|
|
949
|
+
componentId: "sc-3c959c0c-2"
|
|
864
950
|
})([
|
|
865
951
|
`gap:8px;`
|
|
866
952
|
]);
|
|
867
953
|
var HeaderTitle = styled6.div.withConfig({
|
|
868
|
-
componentId: "sc-
|
|
954
|
+
componentId: "sc-3c959c0c-3"
|
|
869
955
|
})([
|
|
870
956
|
`display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
|
|
871
957
|
]);
|
|
872
958
|
var HeaderActions = styled6.div.withConfig({
|
|
873
|
-
componentId: "sc-
|
|
959
|
+
componentId: "sc-3c959c0c-4"
|
|
874
960
|
})([
|
|
875
961
|
`display:flex;align-items:center;min-height:24px;`
|
|
876
962
|
]);
|
|
877
963
|
var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
878
|
-
componentId: "sc-
|
|
964
|
+
componentId: "sc-3c959c0c-5"
|
|
879
965
|
})([
|
|
880
966
|
`&[data-editable] th{vertical-align:top;}--fees-row-background:`,
|
|
881
967
|
`;--fees-stripe-background:`,
|
|
@@ -886,9 +972,11 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
886
972
|
`;}&&& thead > tr > th{height:52px;padding:11.5px 8px;color:`,
|
|
887
973
|
`;font-size:`,
|
|
888
974
|
`px;font-weight:`,
|
|
975
|
+
`;text-align:`,
|
|
889
976
|
`;line-height:`,
|
|
890
977
|
`;white-space:pre-line;}tbody > tr{background:var(--fees-row-background);}tbody > tr:nth-child(even){background:var(--fees-stripe-background);}&&& tbody > tr > td{height:32px;padding:7.5px 8px;background:inherit;color:var(--fees-text);font-size:`,
|
|
891
978
|
`px;font-weight:`,
|
|
979
|
+
`;text-align:`,
|
|
892
980
|
`;line-height:`,
|
|
893
981
|
`;}thead > tr > th:first-child,tbody > tr > td:first-child{padding-left:16px;}@media (max-width:767px){&&:not([data-editable]){table{min-width:100%;width:`,
|
|
894
982
|
`px;table-layout:fixed;}`,
|
|
@@ -896,9 +984,9 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
896
984
|
`px;line-height:`,
|
|
897
985
|
`;}tbody > tr > td{height:40px;padding-top:5.5px;padding-bottom:5.5px;font-size:`,
|
|
898
986
|
`px;line-height:`,
|
|
899
|
-
`;}thead > tr > th:last-child,tbody > tr > td:last-child{padding-right:12px;}
|
|
987
|
+
`;}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:`,
|
|
900
988
|
`;}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);}}}`
|
|
901
|
-
], ({ 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?.fontSize ? 1.4 : "14px", ({ $typography }) => $typography?.tbody?.fontSize ?? 12, ({ $typography }) => $typography?.tbody?.fontWeight ?? 500, ({ $typography }) => $typography?.tbody?.fontSize ? 1.4 : "16px", ({ $mobileColumnWidths }) => $mobileColumnWidths.reduce((sum, width) => sum + width, 0), ({ $mobileColumnWidths }) => $mobileColumnWidths.map((width, index) => `
|
|
989
|
+
], ({ 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) => `
|
|
902
990
|
th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
|
|
903
991
|
width: ${width}px;
|
|
904
992
|
min-width: ${width}px;
|
|
@@ -906,13 +994,14 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
906
994
|
}
|
|
907
995
|
`).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);
|
|
908
996
|
var FeesCellContent = styled6.span.withConfig({
|
|
909
|
-
componentId: "sc-
|
|
997
|
+
componentId: "sc-3c959c0c-6"
|
|
910
998
|
})([
|
|
911
999
|
`display:block;text-align:`,
|
|
912
|
-
|
|
913
|
-
|
|
1000
|
+
`;@media (max-width:767px){text-align:`,
|
|
1001
|
+
`;}`
|
|
1002
|
+
], ({ $align, $alignRight }) => $align ?? ($alignRight ? "right" : "left"), ({ $align }) => $align ?? "left");
|
|
914
1003
|
var EditorButton = styled6.button.withConfig({
|
|
915
|
-
componentId: "sc-
|
|
1004
|
+
componentId: "sc-3c959c0c-7"
|
|
916
1005
|
})([
|
|
917
1006
|
`padding:7px 12px;border:1px solid `,
|
|
918
1007
|
`;border-radius:6px;background:`,
|
|
@@ -921,17 +1010,17 @@ var EditorButton = styled6.button.withConfig({
|
|
|
921
1010
|
`;}&:disabled{cursor:default;opacity:.4;}`
|
|
922
1011
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
923
1012
|
var OrderActions = styled6.div.withConfig({
|
|
924
|
-
componentId: "sc-
|
|
1013
|
+
componentId: "sc-3c959c0c-8"
|
|
925
1014
|
})([
|
|
926
1015
|
`display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
|
|
927
1016
|
]);
|
|
928
1017
|
var PositionLabel = styled6.label.withConfig({
|
|
929
|
-
componentId: "sc-
|
|
1018
|
+
componentId: "sc-3c959c0c-9"
|
|
930
1019
|
})([
|
|
931
1020
|
`display:inline-flex;align-items:center;gap:6px;font-size:12px;`
|
|
932
1021
|
]);
|
|
933
1022
|
var PositionInput = styled6.input.withConfig({
|
|
934
|
-
componentId: "sc-
|
|
1023
|
+
componentId: "sc-3c959c0c-10"
|
|
935
1024
|
})([
|
|
936
1025
|
`width:56px;padding:5px;border:1px solid `,
|
|
937
1026
|
`;border-radius:4px;background:`,
|
|
@@ -940,17 +1029,17 @@ var PositionInput = styled6.input.withConfig({
|
|
|
940
1029
|
`;}`
|
|
941
1030
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
942
1031
|
var ColumnRow = styled6.div.withConfig({
|
|
943
|
-
componentId: "sc-
|
|
1032
|
+
componentId: "sc-3c959c0c-11"
|
|
944
1033
|
})([
|
|
945
1034
|
`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;}`
|
|
946
1035
|
]);
|
|
947
1036
|
var PaginationControls = styled6(FeesAndMarginPagination).withConfig({
|
|
948
|
-
componentId: "sc-
|
|
1037
|
+
componentId: "sc-3c959c0c-12"
|
|
949
1038
|
})([
|
|
950
1039
|
`align-items:center;flex-wrap:wrap;gap:16px 24px;`
|
|
951
1040
|
]);
|
|
952
1041
|
var PageSizeLabel = styled6.div.withConfig({
|
|
953
|
-
componentId: "sc-
|
|
1042
|
+
componentId: "sc-3c959c0c-13"
|
|
954
1043
|
})([
|
|
955
1044
|
`display:inline-flex;align-items:center;gap:8px;color:`,
|
|
956
1045
|
`;font:inherit;font-size:13px;`
|
|
@@ -978,17 +1067,18 @@ function Position({ value, max, label, onMove }) {
|
|
|
978
1067
|
});
|
|
979
1068
|
}
|
|
980
1069
|
var DeleteButton = styled6(EditorButton).withConfig({
|
|
981
|
-
componentId: "sc-
|
|
1070
|
+
componentId: "sc-3c959c0c-14"
|
|
982
1071
|
})([
|
|
983
1072
|
`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;}`
|
|
984
1073
|
]);
|
|
985
1074
|
var CellEditorInput = styled6.textarea.withConfig({
|
|
986
|
-
componentId: "sc-
|
|
1075
|
+
componentId: "sc-3c959c0c-15"
|
|
987
1076
|
})([
|
|
988
|
-
`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;resize:none;overflow:hidden;&:hover{border-color:`,
|
|
1077
|
+
`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:`,
|
|
989
1078
|
`;}&:focus{outline:1px solid `,
|
|
1079
|
+
`;}&[data-fees-cell-selected="true"]{border-color:`,
|
|
990
1080
|
`;}`
|
|
991
|
-
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.accent.primary);
|
|
1081
|
+
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
992
1082
|
function CellEditor({ onInput, ...props }) {
|
|
993
1083
|
const ref = useRef2(null);
|
|
994
1084
|
const fit = () => {
|
|
@@ -1118,13 +1208,14 @@ var rightAlignedColumns = /* @__PURE__ */ new Set([
|
|
|
1118
1208
|
"priceUnit",
|
|
1119
1209
|
"unit"
|
|
1120
1210
|
]);
|
|
1121
|
-
function FeesTable({ value, editable = false, onChange, labels, size = "md", tagOrder = [], language = "vi" }) {
|
|
1211
|
+
function FeesTable({ value, editable = false, onChange, labels: labels2, size = "md", tagOrder = [], language = "vi" }) {
|
|
1122
1212
|
const [search, setSearch] = useState2("");
|
|
1123
1213
|
const [tag, setTag] = useState2("");
|
|
1124
1214
|
const [page, setPage] = useState2(1);
|
|
1125
1215
|
const [pageSize, setPageSize] = useState2(FEES_PAGE_SIZE);
|
|
1126
1216
|
const [columnsOpen, setColumnsOpen] = useState2(false);
|
|
1127
1217
|
const [typographyOpen, setTypographyOpen] = useState2(false);
|
|
1218
|
+
const [selectedCell, setSelectedCell] = useState2(null);
|
|
1128
1219
|
const english = language === "en";
|
|
1129
1220
|
const canEdit = editable && Boolean(onChange);
|
|
1130
1221
|
const tableRoot = useRef2(null);
|
|
@@ -1162,10 +1253,17 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1162
1253
|
onChange?.({
|
|
1163
1254
|
...value,
|
|
1164
1255
|
columns: value.columns.filter((column) => column.key !== deleteTarget.id),
|
|
1165
|
-
rows: value.rows.map((row) =>
|
|
1166
|
-
...row
|
|
1167
|
-
|
|
1168
|
-
|
|
1256
|
+
rows: value.rows.map((row) => {
|
|
1257
|
+
const { cellAlignments, ...rest } = row;
|
|
1258
|
+
const alignments = Object.fromEntries(Object.entries(cellAlignments ?? {}).filter(([key]) => key !== deleteTarget.id));
|
|
1259
|
+
return {
|
|
1260
|
+
...rest,
|
|
1261
|
+
cells: Object.fromEntries(Object.entries(row.cells).filter(([key]) => key !== deleteTarget.id)),
|
|
1262
|
+
...Object.keys(alignments).length ? {
|
|
1263
|
+
cellAlignments: alignments
|
|
1264
|
+
} : {}
|
|
1265
|
+
};
|
|
1266
|
+
})
|
|
1169
1267
|
});
|
|
1170
1268
|
}
|
|
1171
1269
|
setDeleteTarget(null);
|
|
@@ -1196,7 +1294,19 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1196
1294
|
};
|
|
1197
1295
|
const activeTag = tags.includes(tag) ? tag : "";
|
|
1198
1296
|
const filtered = filterFeesRows(value, search, activeTag);
|
|
1199
|
-
const
|
|
1297
|
+
const displayedRows = canEdit ? filtered : sortFeesRowsByName(filtered, language);
|
|
1298
|
+
const pagination = paginateFeesRows(displayedRows, page, pageSize);
|
|
1299
|
+
const selectedColumn = selectedCell && value.columns.find((column) => column.key === selectedCell.columnKey);
|
|
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;
|
|
1304
|
+
useLayoutEffect(() => {
|
|
1305
|
+
if (selectedCell && !selectedTarget) setSelectedCell(null);
|
|
1306
|
+
}, [
|
|
1307
|
+
selectedCell,
|
|
1308
|
+
selectedTarget
|
|
1309
|
+
]);
|
|
1200
1310
|
const moveColumn = (from, to) => onChange?.({
|
|
1201
1311
|
...value,
|
|
1202
1312
|
columns: moveFeesItem(value.columns, from, to)
|
|
@@ -1249,6 +1359,14 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1249
1359
|
rows: 2,
|
|
1250
1360
|
value: column.title,
|
|
1251
1361
|
"aria-label": `Ti\xEAu \u0111\u1EC1 c\u1ED9t ${index + 1}`,
|
|
1362
|
+
style: {
|
|
1363
|
+
textAlign: column.textAlign ?? value.typography?.thead?.textAlign ?? "left"
|
|
1364
|
+
},
|
|
1365
|
+
"data-fees-cell-selected": selectedTarget?.part === "thead" && selectedTarget.columnKey === column.key,
|
|
1366
|
+
onFocus: () => setSelectedCell({
|
|
1367
|
+
part: "thead",
|
|
1368
|
+
columnKey: column.key
|
|
1369
|
+
}),
|
|
1252
1370
|
onChange: (event) => onChange?.({
|
|
1253
1371
|
...value,
|
|
1254
1372
|
columns: value.columns.map((item) => item.key === column.key ? {
|
|
@@ -1273,6 +1391,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1273
1391
|
})
|
|
1274
1392
|
]
|
|
1275
1393
|
}) : /* @__PURE__ */ _jsx(FeesCellContent, {
|
|
1394
|
+
$align: column.textAlign ?? value.typography?.thead?.textAlign,
|
|
1276
1395
|
$alignRight: rightAlignedColumns.has(column.key),
|
|
1277
1396
|
children: column.title
|
|
1278
1397
|
}),
|
|
@@ -1280,6 +1399,15 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1280
1399
|
rows: Math.max(2, (row.cells[column.key] ?? "").split("\n").length),
|
|
1281
1400
|
value: row.cells[column.key] ?? "",
|
|
1282
1401
|
"aria-label": `${column.title} \u2014 ${row.cells.name || "H\xE0ng m\u1EDBi"}`,
|
|
1402
|
+
style: {
|
|
1403
|
+
textAlign: row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign ?? "left"
|
|
1404
|
+
},
|
|
1405
|
+
"data-fees-cell-selected": selectedTarget?.part === "tbody" && selectedTarget.rowId === row.id && selectedTarget.columnKey === column.key,
|
|
1406
|
+
onFocus: () => setSelectedCell({
|
|
1407
|
+
part: "tbody",
|
|
1408
|
+
rowId: row.id,
|
|
1409
|
+
columnKey: column.key
|
|
1410
|
+
}),
|
|
1283
1411
|
onChange: (event) => changeRow(row.id, {
|
|
1284
1412
|
cells: {
|
|
1285
1413
|
...row.cells,
|
|
@@ -1287,6 +1415,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1287
1415
|
}
|
|
1288
1416
|
})
|
|
1289
1417
|
}) : /* @__PURE__ */ _jsx(FeesCellContent, {
|
|
1418
|
+
$align: row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign,
|
|
1290
1419
|
$alignRight: rightAlignedColumns.has(column.key),
|
|
1291
1420
|
children: row.cells[column.key] ?? ""
|
|
1292
1421
|
})
|
|
@@ -1372,7 +1501,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1372
1501
|
items: [
|
|
1373
1502
|
{
|
|
1374
1503
|
id: "",
|
|
1375
|
-
label:
|
|
1504
|
+
label: labels2?.all ?? "T\u1EA5t c\u1EA3"
|
|
1376
1505
|
},
|
|
1377
1506
|
...tags.map((item) => ({
|
|
1378
1507
|
id: item,
|
|
@@ -1390,8 +1519,8 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1390
1519
|
children: /* @__PURE__ */ _jsx(InputCommon, {
|
|
1391
1520
|
leftIcon: /* @__PURE__ */ _jsx(FeesSearchIcon, {}),
|
|
1392
1521
|
size: "sm",
|
|
1393
|
-
"aria-label":
|
|
1394
|
-
placeholder:
|
|
1522
|
+
"aria-label": labels2?.search ?? "T\xECm t\xEAn h\xE0ng h\xF3a ho\u1EB7c m\xE3",
|
|
1523
|
+
placeholder: labels2?.search ?? "T\xECm t\xEAn h\xE0ng h\xF3a ho\u1EB7c m\xE3",
|
|
1395
1524
|
value: search,
|
|
1396
1525
|
onChange: (event) => {
|
|
1397
1526
|
setSearch(event.target.value);
|
|
@@ -1404,6 +1533,17 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1404
1533
|
}),
|
|
1405
1534
|
canEdit && /* @__PURE__ */ _jsxs(EditorActions, {
|
|
1406
1535
|
children: [
|
|
1536
|
+
/* @__PURE__ */ _jsx(EditorButton, {
|
|
1537
|
+
type: "button",
|
|
1538
|
+
onClick: () => {
|
|
1539
|
+
onChange?.({
|
|
1540
|
+
...value,
|
|
1541
|
+
rows: sortFeesRowsByName(value.rows, language)
|
|
1542
|
+
});
|
|
1543
|
+
setPage(1);
|
|
1544
|
+
},
|
|
1545
|
+
children: english ? "Sort names A\u2013Z" : "S\u1EAFp x\u1EBFp t\xEAn A\u2013Z"
|
|
1546
|
+
}),
|
|
1407
1547
|
/* @__PURE__ */ _jsx(EditorButton, {
|
|
1408
1548
|
type: "button",
|
|
1409
1549
|
onClick: () => {
|
|
@@ -1478,6 +1618,14 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1478
1618
|
})
|
|
1479
1619
|
})
|
|
1480
1620
|
}),
|
|
1621
|
+
canEdit && /* @__PURE__ */ _jsx(FeesCellAlignmentControls, {
|
|
1622
|
+
label: selectedLabel,
|
|
1623
|
+
value: selectedAlign,
|
|
1624
|
+
english,
|
|
1625
|
+
onChange: (textAlign) => {
|
|
1626
|
+
if (selectedTarget) onChange?.(setFeesCellAlignment(value, selectedTarget, textAlign));
|
|
1627
|
+
}
|
|
1628
|
+
}),
|
|
1481
1629
|
/* @__PURE__ */ _jsx(AlignedFeesTable, {
|
|
1482
1630
|
$typography: value.typography,
|
|
1483
1631
|
$mobileColumnWidths: columns.map((column) => Math.ceil((mobileColumnWidths[column.key] ?? 88) * mobileFontScale)),
|
|
@@ -1488,7 +1636,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1488
1636
|
dataSource: pagination.rows,
|
|
1489
1637
|
rowKey: "id",
|
|
1490
1638
|
size,
|
|
1491
|
-
empty:
|
|
1639
|
+
empty: labels2?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
|
|
1492
1640
|
scroll: {
|
|
1493
1641
|
x: canEdit ? Math.max(1440, value.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + 300) : value.columns.length * 170 + 8
|
|
1494
1642
|
}
|
|
@@ -1641,7 +1789,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1641
1789
|
]
|
|
1642
1790
|
}),
|
|
1643
1791
|
/* @__PURE__ */ _jsx(DialogActions, {
|
|
1644
|
-
children: /* @__PURE__ */ _jsx(
|
|
1792
|
+
children: /* @__PURE__ */ _jsx(Button3, {
|
|
1645
1793
|
variant: "contained",
|
|
1646
1794
|
onClick: () => setColumnsOpen(false),
|
|
1647
1795
|
children: "Xong"
|
|
@@ -1681,11 +1829,11 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1681
1829
|
}),
|
|
1682
1830
|
/* @__PURE__ */ _jsxs(DialogActions, {
|
|
1683
1831
|
children: [
|
|
1684
|
-
/* @__PURE__ */ _jsx(
|
|
1832
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1685
1833
|
onClick: () => setCreateTagOpen(false),
|
|
1686
1834
|
children: "H\u1EE7y"
|
|
1687
1835
|
}),
|
|
1688
|
-
/* @__PURE__ */ _jsx(
|
|
1836
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1689
1837
|
variant: "contained",
|
|
1690
1838
|
disabled: !newTagName || duplicateTag,
|
|
1691
1839
|
onClick: createTag,
|
|
@@ -1720,12 +1868,12 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1720
1868
|
}),
|
|
1721
1869
|
/* @__PURE__ */ _jsxs(DialogActions, {
|
|
1722
1870
|
children: [
|
|
1723
|
-
/* @__PURE__ */ _jsx(
|
|
1871
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1724
1872
|
autoFocus: true,
|
|
1725
1873
|
onClick: () => setDeleteTarget(null),
|
|
1726
1874
|
children: "H\u1EE7y"
|
|
1727
1875
|
}),
|
|
1728
|
-
/* @__PURE__ */ _jsxs(
|
|
1876
|
+
/* @__PURE__ */ _jsxs(Button3, {
|
|
1729
1877
|
color: "error",
|
|
1730
1878
|
variant: "contained",
|
|
1731
1879
|
onClick: confirmDelete,
|
|
@@ -1744,7 +1892,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1744
1892
|
}
|
|
1745
1893
|
|
|
1746
1894
|
// src/wikex/fees-manager.tsx
|
|
1747
|
-
import { Fragment as Fragment2, jsx as
|
|
1895
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1748
1896
|
function FeesManager({
|
|
1749
1897
|
entries,
|
|
1750
1898
|
selectedId,
|
|
@@ -1764,16 +1912,16 @@ function FeesManager({
|
|
|
1764
1912
|
}) {
|
|
1765
1913
|
const entry = entries.find((item) => item.id === selectedId);
|
|
1766
1914
|
const key = `${selectedId}:${language}`;
|
|
1767
|
-
return /* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
1915
|
+
return /* @__PURE__ */ jsxs7(Stack3, { spacing: 3, sx: { minWidth: 0, width: 1 }, children: [
|
|
1916
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: { xs: "column", md: "row" }, justifyContent: "space-between", alignItems: { md: "center" }, gap: 2.5, children: [
|
|
1917
|
+
/* @__PURE__ */ jsxs7(Stack3, { spacing: 1, sx: { minWidth: 0, maxWidth: 720 }, children: [
|
|
1918
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "h4", children: "Ph\xED & k\xFD qu\u1EF9" }),
|
|
1919
|
+
/* @__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." })
|
|
1772
1920
|
] }),
|
|
1773
|
-
/* @__PURE__ */
|
|
1774
|
-
dirtyKeys.includes(key) && /* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
|
|
1921
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: "row", spacing: 1.5, alignItems: "center", flexShrink: 0, children: [
|
|
1922
|
+
dirtyKeys.includes(key) && /* @__PURE__ */ jsx7(Chip, { size: "small", color: "warning", label: "Ch\u01B0a l\u01B0u" }),
|
|
1923
|
+
/* @__PURE__ */ jsx7(
|
|
1924
|
+
Button4,
|
|
1777
1925
|
{
|
|
1778
1926
|
variant: "contained",
|
|
1779
1927
|
loading: saving,
|
|
@@ -1785,16 +1933,16 @@ function FeesManager({
|
|
|
1785
1933
|
)
|
|
1786
1934
|
] })
|
|
1787
1935
|
] }),
|
|
1788
|
-
!canWrite && /* @__PURE__ */
|
|
1789
|
-
notice && /* @__PURE__ */
|
|
1790
|
-
!entries.length ? /* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1936
|
+
!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." }),
|
|
1937
|
+
notice && /* @__PURE__ */ jsx7(Alert, { severity: notice.severity, onClose: onDismissNotice, children: notice.message }),
|
|
1938
|
+
!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: [
|
|
1939
|
+
/* @__PURE__ */ jsx7(Card, { variant: "outlined", sx: { p: { xs: 2.5, md: 3 }, boxShadow: "none" }, children: /* @__PURE__ */ jsxs7(Stack3, { spacing: 2.5, children: [
|
|
1940
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 1.5, flexWrap: "wrap", children: [
|
|
1941
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "subtitle1", children: "B\u1EA3ng \u0111ang qu\u1EA3n l\xFD" }),
|
|
1942
|
+
/* @__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" })
|
|
1795
1943
|
] }),
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
/* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: { xs: "column", md: "row" }, spacing: 2.5, alignItems: { md: "flex-end" }, children: [
|
|
1945
|
+
/* @__PURE__ */ jsx7(
|
|
1798
1946
|
TextField3,
|
|
1799
1947
|
{
|
|
1800
1948
|
select: true,
|
|
@@ -1805,7 +1953,7 @@ function FeesManager({
|
|
|
1805
1953
|
fullWidth: true,
|
|
1806
1954
|
sx: { flex: 1, minWidth: 0 },
|
|
1807
1955
|
onChange: (event) => onSelectEntry(event.target.value),
|
|
1808
|
-
children: entries.map((item, index) => /* @__PURE__ */
|
|
1956
|
+
children: entries.map((item, index) => /* @__PURE__ */ jsxs7(MenuItem3, { value: item.id, children: [
|
|
1809
1957
|
item.pageTitle,
|
|
1810
1958
|
" \xB7 /",
|
|
1811
1959
|
item.slug,
|
|
@@ -1815,9 +1963,9 @@ function FeesManager({
|
|
|
1815
1963
|
] }, item.id))
|
|
1816
1964
|
}
|
|
1817
1965
|
),
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1966
|
+
/* @__PURE__ */ jsxs7(Stack3, { spacing: 1, sx: { width: { xs: 1, md: 240 }, flexShrink: 0 }, children: [
|
|
1967
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "caption", color: "text.secondary", children: "Ng\xF4n ng\u1EEF n\u1ED9i dung" }),
|
|
1968
|
+
/* @__PURE__ */ jsxs7(
|
|
1821
1969
|
ToggleButtonGroup,
|
|
1822
1970
|
{
|
|
1823
1971
|
size: "small",
|
|
@@ -1830,11 +1978,11 @@ function FeesManager({
|
|
|
1830
1978
|
if (next === "vi" || next === "en") onSelectLanguage(next);
|
|
1831
1979
|
},
|
|
1832
1980
|
children: [
|
|
1833
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ jsxs7(ToggleButton, { value: "vi", children: [
|
|
1834
1982
|
"Ti\u1EBFng Vi\u1EC7t",
|
|
1835
1983
|
dirtyKeys.includes(`${selectedId}:vi`) ? " \u2022" : ""
|
|
1836
1984
|
] }),
|
|
1837
|
-
/* @__PURE__ */
|
|
1985
|
+
/* @__PURE__ */ jsxs7(ToggleButton, { value: "en", children: [
|
|
1838
1986
|
"English",
|
|
1839
1987
|
dirtyKeys.includes(`${selectedId}:en`) ? " \u2022" : ""
|
|
1840
1988
|
] })
|
|
@@ -1844,22 +1992,22 @@ function FeesManager({
|
|
|
1844
1992
|
] })
|
|
1845
1993
|
] })
|
|
1846
1994
|
] }) }),
|
|
1847
|
-
parseError && /* @__PURE__ */
|
|
1848
|
-
table && /* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
1851
|
-
/* @__PURE__ */
|
|
1852
|
-
/* @__PURE__ */
|
|
1995
|
+
parseError && /* @__PURE__ */ jsx7(Alert, { severity: "error", children: parseError }),
|
|
1996
|
+
table && /* @__PURE__ */ jsxs7(Card, { inert: saving, "aria-busy": saving, sx: { minWidth: 0, opacity: saving ? 0.65 : 1 }, children: [
|
|
1997
|
+
/* @__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: [
|
|
1998
|
+
/* @__PURE__ */ jsxs7(Stack3, { spacing: 0.5, children: [
|
|
1999
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "subtitle1", children: "D\u1EEF li\u1EC7u ph\xED & k\xFD qu\u1EF9" }),
|
|
2000
|
+
/* @__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." })
|
|
1853
2001
|
] }),
|
|
1854
|
-
/* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
2002
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: "row", spacing: 1, flexShrink: 0, children: [
|
|
2003
|
+
/* @__PURE__ */ jsx7(Chip, { size: "small", variant: "outlined", label: `${table.rows.length} d\xF2ng` }),
|
|
2004
|
+
/* @__PURE__ */ jsx7(Chip, { size: "small", variant: "outlined", label: `${table.columns.length} c\u1ED9t` })
|
|
1857
2005
|
] })
|
|
1858
2006
|
] }),
|
|
1859
|
-
/* @__PURE__ */
|
|
1860
|
-
/* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
1862
|
-
/* @__PURE__ */
|
|
2007
|
+
/* @__PURE__ */ jsx7(Divider, {}),
|
|
2008
|
+
/* @__PURE__ */ jsxs7(Box2, { sx: { p: { xs: 2.5, md: 3 }, minWidth: 0 }, children: [
|
|
2009
|
+
/* @__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." }),
|
|
2010
|
+
/* @__PURE__ */ jsx7(FeesTable, { value: table, language, editable: canWrite, onChange: canWrite && !saving ? onChange : void 0 }, key)
|
|
1863
2011
|
] })
|
|
1864
2012
|
] })
|
|
1865
2013
|
] })
|