@enyxs/wikex-components 0.11.31 → 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 +8 -6
- package/dist/fees-model.d.mts +12 -1
- package/dist/fees-model.d.ts +12 -1
- package/dist/fees-model.js +35 -4
- package/dist/fees-model.js.map +1 -1
- package/dist/fees-model.mjs +34 -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 +314 -216
- package/dist/fees.js.map +1 -1
- package/dist/fees.mjs +233 -135
- 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 +1061 -952
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +914 -805
- 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";
|
|
@@ -58,11 +58,28 @@ function moveFeesItem(items, from, to) {
|
|
|
58
58
|
next.splice(to, 0, item);
|
|
59
59
|
return next;
|
|
60
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
|
+
}
|
|
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. C\u0103n l\u1EC1 \u0111\u01B0\u1EE3c ch\u1EC9nh ri\xEAng b\u1EB1ng c\xE1ch ch\u1ECDn t\u1EEBng \xF4." })
|
|
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,64 @@ 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-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
|
+
|
|
173
225
|
// src/commodity-original/styles/colors.ts
|
|
174
226
|
var lightColors = {
|
|
175
227
|
background: {
|
|
@@ -385,7 +437,7 @@ function getTableFixedColumnOffset(columns, columnIndex) {
|
|
|
385
437
|
}
|
|
386
438
|
|
|
387
439
|
// src/commodity-original/components/Table/index.tsx
|
|
388
|
-
import { jsx as
|
|
440
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
389
441
|
function getCellValue(column, record) {
|
|
390
442
|
return column.dataIndex === void 0 ? void 0 : record[column.dataIndex];
|
|
391
443
|
}
|
|
@@ -458,7 +510,7 @@ function Table({
|
|
|
458
510
|
const nextSelectedRowKeys = event.target.checked ? [...selectedRowKeys, recordKey] : selectedRowKeys.filter((key) => key !== recordKey);
|
|
459
511
|
emitSelectionChange(nextSelectedRowKeys);
|
|
460
512
|
};
|
|
461
|
-
return /* @__PURE__ */
|
|
513
|
+
return /* @__PURE__ */ jsx3(TableScrollContainer, { children: /* @__PURE__ */ jsxs3(
|
|
462
514
|
TableRoot,
|
|
463
515
|
{
|
|
464
516
|
$minWidth: scroll?.x === void 0 ? void 0 : getTableColumnSize(scroll.x),
|
|
@@ -467,8 +519,8 @@ function Table({
|
|
|
467
519
|
className,
|
|
468
520
|
"data-size": size,
|
|
469
521
|
children: [
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
rowSelection ? /* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsxs3(TableHeaderRow, { children: [
|
|
523
|
+
rowSelection ? /* @__PURE__ */ jsx3(TableHeaderCell, { scope: "col", children: selectionType === "checkbox" ? /* @__PURE__ */ jsx3(
|
|
472
524
|
TableSelectionInput,
|
|
473
525
|
{
|
|
474
526
|
checked: isAllSelected,
|
|
@@ -477,8 +529,8 @@ function Table({
|
|
|
477
529
|
type: "checkbox"
|
|
478
530
|
}
|
|
479
531
|
) : null }) : null,
|
|
480
|
-
expandable ? /* @__PURE__ */
|
|
481
|
-
columns.map((column, columnIndex) => /* @__PURE__ */
|
|
532
|
+
expandable ? /* @__PURE__ */ jsx3(TableHeaderCell, { scope: "col" }) : null,
|
|
533
|
+
columns.map((column, columnIndex) => /* @__PURE__ */ jsx3(
|
|
482
534
|
TableHeaderCell,
|
|
483
535
|
{
|
|
484
536
|
$fixed: column.fixed,
|
|
@@ -486,7 +538,7 @@ function Table({
|
|
|
486
538
|
$width: column.width === void 0 ? void 0 : getTableColumnSize(column.width),
|
|
487
539
|
"data-column-key": column.key,
|
|
488
540
|
scope: "col",
|
|
489
|
-
children: column.sortable ? /* @__PURE__ */
|
|
541
|
+
children: column.sortable ? /* @__PURE__ */ jsx3(
|
|
490
542
|
TableSortButton,
|
|
491
543
|
{
|
|
492
544
|
"aria-pressed": sort?.field === column.key,
|
|
@@ -499,13 +551,13 @@ function Table({
|
|
|
499
551
|
column.key
|
|
500
552
|
))
|
|
501
553
|
] }) }),
|
|
502
|
-
/* @__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) => {
|
|
503
555
|
const recordKey = getRowKey(record);
|
|
504
556
|
const selectionProps = rowSelection?.getCheckboxProps?.(record);
|
|
505
557
|
const isExpanded = expandedRowKeySet.has(recordKey);
|
|
506
|
-
return /* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
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(
|
|
509
561
|
TableSelectionInput,
|
|
510
562
|
{
|
|
511
563
|
checked: selectedRowKeySet.has(recordKey),
|
|
@@ -515,7 +567,7 @@ function Table({
|
|
|
515
567
|
type: selectionType
|
|
516
568
|
}
|
|
517
569
|
) }) : null,
|
|
518
|
-
expandable ? /* @__PURE__ */
|
|
570
|
+
expandable ? /* @__PURE__ */ jsx3(TableCell, { children: /* @__PURE__ */ jsx3(
|
|
519
571
|
TableExpandButton,
|
|
520
572
|
{
|
|
521
573
|
"aria-expanded": isExpanded,
|
|
@@ -526,7 +578,7 @@ function Table({
|
|
|
526
578
|
) }) : null,
|
|
527
579
|
columns.map((column, columnIndex) => {
|
|
528
580
|
const value = getCellValue(column, record);
|
|
529
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ jsx3(
|
|
530
582
|
TableCell,
|
|
531
583
|
{
|
|
532
584
|
$fixed: column.fixed,
|
|
@@ -538,7 +590,7 @@ function Table({
|
|
|
538
590
|
);
|
|
539
591
|
})
|
|
540
592
|
] }),
|
|
541
|
-
expandable?.render && isExpanded ? /* @__PURE__ */
|
|
593
|
+
expandable?.render && isExpanded ? /* @__PURE__ */ jsx3(TableRow, { children: /* @__PURE__ */ jsx3(TableExpandedCell, { colSpan: columnCount, children: expandable.render(record) }) }) : null
|
|
542
594
|
] }, recordKey);
|
|
543
595
|
}) })
|
|
544
596
|
]
|
|
@@ -593,7 +645,7 @@ var PaginationArrow = styled2.span.withConfig({
|
|
|
593
645
|
], chevron_right_default, chevron_right_default);
|
|
594
646
|
|
|
595
647
|
// src/commodity-original/components/Pagination/index.tsx
|
|
596
|
-
import { jsx as
|
|
648
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
597
649
|
function getPaginationItems(page, pageCount, siblingCount) {
|
|
598
650
|
const maxVisibleItems = siblingCount * 2 + 5;
|
|
599
651
|
if (pageCount <= maxVisibleItems) {
|
|
@@ -620,7 +672,7 @@ function Pagination({
|
|
|
620
672
|
onPageChange,
|
|
621
673
|
siblingCount = 1,
|
|
622
674
|
ariaLabel,
|
|
623
|
-
labels,
|
|
675
|
+
labels: labels2,
|
|
624
676
|
className
|
|
625
677
|
}) {
|
|
626
678
|
const { t } = useTranslation();
|
|
@@ -629,43 +681,43 @@ function Pagination({
|
|
|
629
681
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
630
682
|
const hasPreviousPage = currentPage > 1;
|
|
631
683
|
const hasNextPage = currentPage < safePageCount;
|
|
632
|
-
return /* @__PURE__ */
|
|
684
|
+
return /* @__PURE__ */ jsx4(
|
|
633
685
|
PaginationNav,
|
|
634
686
|
{
|
|
635
687
|
"aria-label": ariaLabel ?? t("pagination.navigation"),
|
|
636
688
|
className,
|
|
637
|
-
children: /* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
689
|
+
children: /* @__PURE__ */ jsxs4(PaginationList, { children: [
|
|
690
|
+
/* @__PURE__ */ jsx4(PaginationItem, { children: /* @__PURE__ */ jsx4(
|
|
639
691
|
PaginationButton,
|
|
640
692
|
{
|
|
641
|
-
"aria-label":
|
|
693
|
+
"aria-label": labels2?.previous ?? t("pagination.previous"),
|
|
642
694
|
"data-control": "previous",
|
|
643
695
|
disabled: !hasPreviousPage,
|
|
644
696
|
onClick: () => onPageChange(currentPage - 1),
|
|
645
697
|
type: "button",
|
|
646
|
-
children: /* @__PURE__ */
|
|
698
|
+
children: /* @__PURE__ */ jsx4(PaginationArrow, { "data-direction": "previous" })
|
|
647
699
|
}
|
|
648
700
|
) }),
|
|
649
|
-
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(
|
|
650
702
|
PaginationButton,
|
|
651
703
|
{
|
|
652
704
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
653
|
-
"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 }),
|
|
654
706
|
"data-active": item === currentPage || void 0,
|
|
655
707
|
onClick: () => onPageChange(item),
|
|
656
708
|
type: "button",
|
|
657
709
|
children: item
|
|
658
710
|
}
|
|
659
711
|
) }, `${item}-${index}`)),
|
|
660
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ jsx4(PaginationItem, { children: /* @__PURE__ */ jsx4(
|
|
661
713
|
PaginationButton,
|
|
662
714
|
{
|
|
663
|
-
"aria-label":
|
|
715
|
+
"aria-label": labels2?.next ?? t("pagination.next"),
|
|
664
716
|
"data-control": "next",
|
|
665
717
|
disabled: !hasNextPage,
|
|
666
718
|
onClick: () => onPageChange(currentPage + 1),
|
|
667
719
|
type: "button",
|
|
668
|
-
children: /* @__PURE__ */
|
|
720
|
+
children: /* @__PURE__ */ jsx4(PaginationArrow, { "data-direction": "next" })
|
|
669
721
|
}
|
|
670
722
|
) })
|
|
671
723
|
] })
|
|
@@ -701,7 +753,7 @@ var InputAdornment = styled3.span.withConfig({
|
|
|
701
753
|
], ({ theme }) => theme.colors.text.secondary, InputCommonRoot, InputCommonRoot);
|
|
702
754
|
|
|
703
755
|
// src/commodity-original/components/InputCommon/index.tsx
|
|
704
|
-
import { jsx as
|
|
756
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
705
757
|
function InputCommon({
|
|
706
758
|
leftIcon,
|
|
707
759
|
rightIcon,
|
|
@@ -712,11 +764,11 @@ function InputCommon({
|
|
|
712
764
|
onClear,
|
|
713
765
|
...inputProps
|
|
714
766
|
}) {
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
leftIcon ? /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
clearable && inputProps.value ? /* @__PURE__ */
|
|
719
|
-
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
|
|
720
772
|
] });
|
|
721
773
|
}
|
|
722
774
|
|
|
@@ -748,7 +800,7 @@ var TabLine = styled4.span.withConfig({
|
|
|
748
800
|
], ({ theme }) => theme.colors.accent.primary, TabCommonList, TabCommonList);
|
|
749
801
|
|
|
750
802
|
// src/commodity-original/components/TabCommon/index.tsx
|
|
751
|
-
import { jsx as
|
|
803
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
752
804
|
function TabCommon({
|
|
753
805
|
items,
|
|
754
806
|
value,
|
|
@@ -757,7 +809,7 @@ function TabCommon({
|
|
|
757
809
|
className,
|
|
758
810
|
size = "md"
|
|
759
811
|
}) {
|
|
760
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsx6(
|
|
761
813
|
TabCommonList,
|
|
762
814
|
{
|
|
763
815
|
"aria-label": ariaLabel,
|
|
@@ -766,7 +818,7 @@ function TabCommon({
|
|
|
766
818
|
role: "tablist",
|
|
767
819
|
children: items.map((item) => {
|
|
768
820
|
const isActive = item.id === value;
|
|
769
|
-
return /* @__PURE__ */
|
|
821
|
+
return /* @__PURE__ */ jsxs6(
|
|
770
822
|
TabButton,
|
|
771
823
|
{
|
|
772
824
|
"aria-selected": isActive,
|
|
@@ -777,7 +829,7 @@ function TabCommon({
|
|
|
777
829
|
type: "button",
|
|
778
830
|
children: [
|
|
779
831
|
item.label,
|
|
780
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ jsx6(TabLine, { "aria-hidden": "true" })
|
|
781
833
|
]
|
|
782
834
|
},
|
|
783
835
|
item.id
|
|
@@ -884,32 +936,32 @@ var feesTheme = {
|
|
|
884
936
|
]))
|
|
885
937
|
};
|
|
886
938
|
var EditorActions = styled6.div.withConfig({
|
|
887
|
-
componentId: "sc-
|
|
939
|
+
componentId: "sc-3c959c0c-0"
|
|
888
940
|
})([
|
|
889
941
|
`display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
|
|
890
942
|
]);
|
|
891
943
|
var EditGroup = styled6.div.withConfig({
|
|
892
|
-
componentId: "sc-
|
|
944
|
+
componentId: "sc-3c959c0c-1"
|
|
893
945
|
})([
|
|
894
946
|
`display:flex;flex-direction:column;gap:6px;`
|
|
895
947
|
]);
|
|
896
948
|
var HeaderGroup = styled6(EditGroup).withConfig({
|
|
897
|
-
componentId: "sc-
|
|
949
|
+
componentId: "sc-3c959c0c-2"
|
|
898
950
|
})([
|
|
899
951
|
`gap:8px;`
|
|
900
952
|
]);
|
|
901
953
|
var HeaderTitle = styled6.div.withConfig({
|
|
902
|
-
componentId: "sc-
|
|
954
|
+
componentId: "sc-3c959c0c-3"
|
|
903
955
|
})([
|
|
904
956
|
`display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
|
|
905
957
|
]);
|
|
906
958
|
var HeaderActions = styled6.div.withConfig({
|
|
907
|
-
componentId: "sc-
|
|
959
|
+
componentId: "sc-3c959c0c-4"
|
|
908
960
|
})([
|
|
909
961
|
`display:flex;align-items:center;min-height:24px;`
|
|
910
962
|
]);
|
|
911
963
|
var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
912
|
-
componentId: "sc-
|
|
964
|
+
componentId: "sc-3c959c0c-5"
|
|
913
965
|
})([
|
|
914
966
|
`&[data-editable] th{vertical-align:top;}--fees-row-background:`,
|
|
915
967
|
`;--fees-stripe-background:`,
|
|
@@ -932,9 +984,7 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
932
984
|
`px;line-height:`,
|
|
933
985
|
`;}tbody > tr > td{height:40px;padding-top:5.5px;padding-bottom:5.5px;font-size:`,
|
|
934
986
|
`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:`,
|
|
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:`,
|
|
938
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);}}}`
|
|
939
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) => `
|
|
940
990
|
th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
|
|
@@ -942,15 +992,16 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
942
992
|
min-width: ${width}px;
|
|
943
993
|
max-width: ${width}px;
|
|
944
994
|
}
|
|
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", ({
|
|
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);
|
|
946
996
|
var FeesCellContent = styled6.span.withConfig({
|
|
947
|
-
componentId: "sc-
|
|
997
|
+
componentId: "sc-3c959c0c-6"
|
|
948
998
|
})([
|
|
949
999
|
`display:block;text-align:`,
|
|
950
|
-
|
|
951
|
-
|
|
1000
|
+
`;@media (max-width:767px){text-align:`,
|
|
1001
|
+
`;}`
|
|
1002
|
+
], ({ $align, $alignRight }) => $align ?? ($alignRight ? "right" : "left"), ({ $align }) => $align ?? "left");
|
|
952
1003
|
var EditorButton = styled6.button.withConfig({
|
|
953
|
-
componentId: "sc-
|
|
1004
|
+
componentId: "sc-3c959c0c-7"
|
|
954
1005
|
})([
|
|
955
1006
|
`padding:7px 12px;border:1px solid `,
|
|
956
1007
|
`;border-radius:6px;background:`,
|
|
@@ -959,17 +1010,17 @@ var EditorButton = styled6.button.withConfig({
|
|
|
959
1010
|
`;}&:disabled{cursor:default;opacity:.4;}`
|
|
960
1011
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
961
1012
|
var OrderActions = styled6.div.withConfig({
|
|
962
|
-
componentId: "sc-
|
|
1013
|
+
componentId: "sc-3c959c0c-8"
|
|
963
1014
|
})([
|
|
964
1015
|
`display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
|
|
965
1016
|
]);
|
|
966
1017
|
var PositionLabel = styled6.label.withConfig({
|
|
967
|
-
componentId: "sc-
|
|
1018
|
+
componentId: "sc-3c959c0c-9"
|
|
968
1019
|
})([
|
|
969
1020
|
`display:inline-flex;align-items:center;gap:6px;font-size:12px;`
|
|
970
1021
|
]);
|
|
971
1022
|
var PositionInput = styled6.input.withConfig({
|
|
972
|
-
componentId: "sc-
|
|
1023
|
+
componentId: "sc-3c959c0c-10"
|
|
973
1024
|
})([
|
|
974
1025
|
`width:56px;padding:5px;border:1px solid `,
|
|
975
1026
|
`;border-radius:4px;background:`,
|
|
@@ -978,17 +1029,17 @@ var PositionInput = styled6.input.withConfig({
|
|
|
978
1029
|
`;}`
|
|
979
1030
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
980
1031
|
var ColumnRow = styled6.div.withConfig({
|
|
981
|
-
componentId: "sc-
|
|
1032
|
+
componentId: "sc-3c959c0c-11"
|
|
982
1033
|
})([
|
|
983
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;}`
|
|
984
1035
|
]);
|
|
985
1036
|
var PaginationControls = styled6(FeesAndMarginPagination).withConfig({
|
|
986
|
-
componentId: "sc-
|
|
1037
|
+
componentId: "sc-3c959c0c-12"
|
|
987
1038
|
})([
|
|
988
1039
|
`align-items:center;flex-wrap:wrap;gap:16px 24px;`
|
|
989
1040
|
]);
|
|
990
1041
|
var PageSizeLabel = styled6.div.withConfig({
|
|
991
|
-
componentId: "sc-
|
|
1042
|
+
componentId: "sc-3c959c0c-13"
|
|
992
1043
|
})([
|
|
993
1044
|
`display:inline-flex;align-items:center;gap:8px;color:`,
|
|
994
1045
|
`;font:inherit;font-size:13px;`
|
|
@@ -1016,17 +1067,18 @@ function Position({ value, max, label, onMove }) {
|
|
|
1016
1067
|
});
|
|
1017
1068
|
}
|
|
1018
1069
|
var DeleteButton = styled6(EditorButton).withConfig({
|
|
1019
|
-
componentId: "sc-
|
|
1070
|
+
componentId: "sc-3c959c0c-14"
|
|
1020
1071
|
})([
|
|
1021
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;}`
|
|
1022
1073
|
]);
|
|
1023
1074
|
var CellEditorInput = styled6.textarea.withConfig({
|
|
1024
|
-
componentId: "sc-
|
|
1075
|
+
componentId: "sc-3c959c0c-15"
|
|
1025
1076
|
})([
|
|
1026
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:`,
|
|
1027
1078
|
`;}&:focus{outline:1px solid `,
|
|
1079
|
+
`;}&[data-fees-cell-selected="true"]{border-color:`,
|
|
1028
1080
|
`;}`
|
|
1029
|
-
], ({ 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);
|
|
1030
1082
|
function CellEditor({ onInput, ...props }) {
|
|
1031
1083
|
const ref = useRef2(null);
|
|
1032
1084
|
const fit = () => {
|
|
@@ -1156,13 +1208,14 @@ var rightAlignedColumns = /* @__PURE__ */ new Set([
|
|
|
1156
1208
|
"priceUnit",
|
|
1157
1209
|
"unit"
|
|
1158
1210
|
]);
|
|
1159
|
-
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" }) {
|
|
1160
1212
|
const [search, setSearch] = useState2("");
|
|
1161
1213
|
const [tag, setTag] = useState2("");
|
|
1162
1214
|
const [page, setPage] = useState2(1);
|
|
1163
1215
|
const [pageSize, setPageSize] = useState2(FEES_PAGE_SIZE);
|
|
1164
1216
|
const [columnsOpen, setColumnsOpen] = useState2(false);
|
|
1165
1217
|
const [typographyOpen, setTypographyOpen] = useState2(false);
|
|
1218
|
+
const [selectedCell, setSelectedCell] = useState2(null);
|
|
1166
1219
|
const english = language === "en";
|
|
1167
1220
|
const canEdit = editable && Boolean(onChange);
|
|
1168
1221
|
const tableRoot = useRef2(null);
|
|
@@ -1200,10 +1253,17 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1200
1253
|
onChange?.({
|
|
1201
1254
|
...value,
|
|
1202
1255
|
columns: value.columns.filter((column) => column.key !== deleteTarget.id),
|
|
1203
|
-
rows: value.rows.map((row) =>
|
|
1204
|
-
...row
|
|
1205
|
-
|
|
1206
|
-
|
|
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
|
+
})
|
|
1207
1267
|
});
|
|
1208
1268
|
}
|
|
1209
1269
|
setDeleteTarget(null);
|
|
@@ -1236,6 +1296,17 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1236
1296
|
const filtered = filterFeesRows(value, search, activeTag);
|
|
1237
1297
|
const displayedRows = canEdit ? filtered : sortFeesRowsByName(filtered, language);
|
|
1238
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
|
+
]);
|
|
1239
1310
|
const moveColumn = (from, to) => onChange?.({
|
|
1240
1311
|
...value,
|
|
1241
1312
|
columns: moveFeesItem(value.columns, from, to)
|
|
@@ -1288,6 +1359,14 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1288
1359
|
rows: 2,
|
|
1289
1360
|
value: column.title,
|
|
1290
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
|
+
}),
|
|
1291
1370
|
onChange: (event) => onChange?.({
|
|
1292
1371
|
...value,
|
|
1293
1372
|
columns: value.columns.map((item) => item.key === column.key ? {
|
|
@@ -1312,13 +1391,23 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1312
1391
|
})
|
|
1313
1392
|
]
|
|
1314
1393
|
}) : /* @__PURE__ */ _jsx(FeesCellContent, {
|
|
1315
|
-
$align: value.typography?.thead?.textAlign
|
|
1394
|
+
$align: column.textAlign ?? value.typography?.thead?.textAlign,
|
|
1395
|
+
$alignRight: rightAlignedColumns.has(column.key),
|
|
1316
1396
|
children: column.title
|
|
1317
1397
|
}),
|
|
1318
1398
|
render: (_unused, row) => canEdit ? /* @__PURE__ */ _jsx(CellEditor, {
|
|
1319
1399
|
rows: Math.max(2, (row.cells[column.key] ?? "").split("\n").length),
|
|
1320
1400
|
value: row.cells[column.key] ?? "",
|
|
1321
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
|
+
}),
|
|
1322
1411
|
onChange: (event) => changeRow(row.id, {
|
|
1323
1412
|
cells: {
|
|
1324
1413
|
...row.cells,
|
|
@@ -1326,7 +1415,8 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1326
1415
|
}
|
|
1327
1416
|
})
|
|
1328
1417
|
}) : /* @__PURE__ */ _jsx(FeesCellContent, {
|
|
1329
|
-
$align: value.typography?.tbody?.textAlign
|
|
1418
|
+
$align: row.cellAlignments?.[column.key] ?? value.typography?.tbody?.textAlign,
|
|
1419
|
+
$alignRight: rightAlignedColumns.has(column.key),
|
|
1330
1420
|
children: row.cells[column.key] ?? ""
|
|
1331
1421
|
})
|
|
1332
1422
|
}));
|
|
@@ -1411,7 +1501,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1411
1501
|
items: [
|
|
1412
1502
|
{
|
|
1413
1503
|
id: "",
|
|
1414
|
-
label:
|
|
1504
|
+
label: labels2?.all ?? "T\u1EA5t c\u1EA3"
|
|
1415
1505
|
},
|
|
1416
1506
|
...tags.map((item) => ({
|
|
1417
1507
|
id: item,
|
|
@@ -1429,8 +1519,8 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1429
1519
|
children: /* @__PURE__ */ _jsx(InputCommon, {
|
|
1430
1520
|
leftIcon: /* @__PURE__ */ _jsx(FeesSearchIcon, {}),
|
|
1431
1521
|
size: "sm",
|
|
1432
|
-
"aria-label":
|
|
1433
|
-
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",
|
|
1434
1524
|
value: search,
|
|
1435
1525
|
onChange: (event) => {
|
|
1436
1526
|
setSearch(event.target.value);
|
|
@@ -1528,6 +1618,14 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1528
1618
|
})
|
|
1529
1619
|
})
|
|
1530
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
|
+
}),
|
|
1531
1629
|
/* @__PURE__ */ _jsx(AlignedFeesTable, {
|
|
1532
1630
|
$typography: value.typography,
|
|
1533
1631
|
$mobileColumnWidths: columns.map((column) => Math.ceil((mobileColumnWidths[column.key] ?? 88) * mobileFontScale)),
|
|
@@ -1538,7 +1636,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1538
1636
|
dataSource: pagination.rows,
|
|
1539
1637
|
rowKey: "id",
|
|
1540
1638
|
size,
|
|
1541
|
-
empty:
|
|
1639
|
+
empty: labels2?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
|
|
1542
1640
|
scroll: {
|
|
1543
1641
|
x: canEdit ? Math.max(1440, value.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + 300) : value.columns.length * 170 + 8
|
|
1544
1642
|
}
|
|
@@ -1691,7 +1789,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1691
1789
|
]
|
|
1692
1790
|
}),
|
|
1693
1791
|
/* @__PURE__ */ _jsx(DialogActions, {
|
|
1694
|
-
children: /* @__PURE__ */ _jsx(
|
|
1792
|
+
children: /* @__PURE__ */ _jsx(Button3, {
|
|
1695
1793
|
variant: "contained",
|
|
1696
1794
|
onClick: () => setColumnsOpen(false),
|
|
1697
1795
|
children: "Xong"
|
|
@@ -1731,11 +1829,11 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1731
1829
|
}),
|
|
1732
1830
|
/* @__PURE__ */ _jsxs(DialogActions, {
|
|
1733
1831
|
children: [
|
|
1734
|
-
/* @__PURE__ */ _jsx(
|
|
1832
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1735
1833
|
onClick: () => setCreateTagOpen(false),
|
|
1736
1834
|
children: "H\u1EE7y"
|
|
1737
1835
|
}),
|
|
1738
|
-
/* @__PURE__ */ _jsx(
|
|
1836
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1739
1837
|
variant: "contained",
|
|
1740
1838
|
disabled: !newTagName || duplicateTag,
|
|
1741
1839
|
onClick: createTag,
|
|
@@ -1770,12 +1868,12 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1770
1868
|
}),
|
|
1771
1869
|
/* @__PURE__ */ _jsxs(DialogActions, {
|
|
1772
1870
|
children: [
|
|
1773
|
-
/* @__PURE__ */ _jsx(
|
|
1871
|
+
/* @__PURE__ */ _jsx(Button3, {
|
|
1774
1872
|
autoFocus: true,
|
|
1775
1873
|
onClick: () => setDeleteTarget(null),
|
|
1776
1874
|
children: "H\u1EE7y"
|
|
1777
1875
|
}),
|
|
1778
|
-
/* @__PURE__ */ _jsxs(
|
|
1876
|
+
/* @__PURE__ */ _jsxs(Button3, {
|
|
1779
1877
|
color: "error",
|
|
1780
1878
|
variant: "contained",
|
|
1781
1879
|
onClick: confirmDelete,
|
|
@@ -1794,7 +1892,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1794
1892
|
}
|
|
1795
1893
|
|
|
1796
1894
|
// src/wikex/fees-manager.tsx
|
|
1797
|
-
import { Fragment as Fragment2, jsx as
|
|
1895
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1798
1896
|
function FeesManager({
|
|
1799
1897
|
entries,
|
|
1800
1898
|
selectedId,
|
|
@@ -1814,16 +1912,16 @@ function FeesManager({
|
|
|
1814
1912
|
}) {
|
|
1815
1913
|
const entry = entries.find((item) => item.id === selectedId);
|
|
1816
1914
|
const key = `${selectedId}:${language}`;
|
|
1817
|
-
return /* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__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." })
|
|
1822
1920
|
] }),
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
dirtyKeys.includes(key) && /* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
1826
|
-
|
|
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,
|
|
1827
1925
|
{
|
|
1828
1926
|
variant: "contained",
|
|
1829
1927
|
loading: saving,
|
|
@@ -1835,16 +1933,16 @@ function FeesManager({
|
|
|
1835
1933
|
)
|
|
1836
1934
|
] })
|
|
1837
1935
|
] }),
|
|
1838
|
-
!canWrite && /* @__PURE__ */
|
|
1839
|
-
notice && /* @__PURE__ */
|
|
1840
|
-
!entries.length ? /* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__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" })
|
|
1845
1943
|
] }),
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
/* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ jsxs7(Stack3, { direction: { xs: "column", md: "row" }, spacing: 2.5, alignItems: { md: "flex-end" }, children: [
|
|
1945
|
+
/* @__PURE__ */ jsx7(
|
|
1848
1946
|
TextField3,
|
|
1849
1947
|
{
|
|
1850
1948
|
select: true,
|
|
@@ -1855,7 +1953,7 @@ function FeesManager({
|
|
|
1855
1953
|
fullWidth: true,
|
|
1856
1954
|
sx: { flex: 1, minWidth: 0 },
|
|
1857
1955
|
onChange: (event) => onSelectEntry(event.target.value),
|
|
1858
|
-
children: entries.map((item, index) => /* @__PURE__ */
|
|
1956
|
+
children: entries.map((item, index) => /* @__PURE__ */ jsxs7(MenuItem3, { value: item.id, children: [
|
|
1859
1957
|
item.pageTitle,
|
|
1860
1958
|
" \xB7 /",
|
|
1861
1959
|
item.slug,
|
|
@@ -1865,9 +1963,9 @@ function FeesManager({
|
|
|
1865
1963
|
] }, item.id))
|
|
1866
1964
|
}
|
|
1867
1965
|
),
|
|
1868
|
-
/* @__PURE__ */
|
|
1869
|
-
/* @__PURE__ */
|
|
1870
|
-
/* @__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(
|
|
1871
1969
|
ToggleButtonGroup,
|
|
1872
1970
|
{
|
|
1873
1971
|
size: "small",
|
|
@@ -1880,11 +1978,11 @@ function FeesManager({
|
|
|
1880
1978
|
if (next === "vi" || next === "en") onSelectLanguage(next);
|
|
1881
1979
|
},
|
|
1882
1980
|
children: [
|
|
1883
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ jsxs7(ToggleButton, { value: "vi", children: [
|
|
1884
1982
|
"Ti\u1EBFng Vi\u1EC7t",
|
|
1885
1983
|
dirtyKeys.includes(`${selectedId}:vi`) ? " \u2022" : ""
|
|
1886
1984
|
] }),
|
|
1887
|
-
/* @__PURE__ */
|
|
1985
|
+
/* @__PURE__ */ jsxs7(ToggleButton, { value: "en", children: [
|
|
1888
1986
|
"English",
|
|
1889
1987
|
dirtyKeys.includes(`${selectedId}:en`) ? " \u2022" : ""
|
|
1890
1988
|
] })
|
|
@@ -1894,22 +1992,22 @@ function FeesManager({
|
|
|
1894
1992
|
] })
|
|
1895
1993
|
] })
|
|
1896
1994
|
] }) }),
|
|
1897
|
-
parseError && /* @__PURE__ */
|
|
1898
|
-
table && /* @__PURE__ */
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
/* @__PURE__ */
|
|
1901
|
-
/* @__PURE__ */
|
|
1902
|
-
/* @__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." })
|
|
1903
2001
|
] }),
|
|
1904
|
-
/* @__PURE__ */
|
|
1905
|
-
/* @__PURE__ */
|
|
1906
|
-
/* @__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` })
|
|
1907
2005
|
] })
|
|
1908
2006
|
] }),
|
|
1909
|
-
/* @__PURE__ */
|
|
1910
|
-
/* @__PURE__ */
|
|
1911
|
-
/* @__PURE__ */
|
|
1912
|
-
/* @__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)
|
|
1913
2011
|
] })
|
|
1914
2012
|
] })
|
|
1915
2013
|
] })
|