@enyxs/wikex-components 0.11.25 → 0.11.27
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/dist/chrome-model.css +16 -0
- package/dist/chrome-model.css.map +1 -0
- package/dist/consultation-model.d.mts +1 -11
- package/dist/consultation-model.d.ts +1 -11
- package/dist/consultation-model.js +0 -8
- package/dist/consultation-model.js.map +1 -1
- package/dist/consultation-model.mjs +0 -7
- package/dist/consultation-model.mjs.map +1 -1
- package/dist/consultations.d.mts +3 -6
- package/dist/consultations.d.ts +3 -6
- package/dist/consultations.js +48 -106
- package/dist/consultations.js.map +1 -1
- package/dist/consultations.mjs +49 -107
- package/dist/consultations.mjs.map +1 -1
- package/dist/fees-model.d.mts +15 -1
- package/dist/fees-model.d.ts +15 -1
- package/dist/fees-model.js +37 -3
- package/dist/fees-model.js.map +1 -1
- package/dist/fees-model.mjs +32 -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 +349 -218
- package/dist/fees.js.map +1 -1
- package/dist/fees.mjs +277 -146
- package/dist/fees.mjs.map +1 -1
- package/dist/index.css +16 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1322 -1166
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1155 -999
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/fees.mjs
CHANGED
|
@@ -1,22 +1,140 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/wikex/fees-manager.tsx
|
|
4
|
-
import { Alert, Box, Button as
|
|
4
|
+
import { Alert, Box as Box2, Button as Button3, Card, Chip, Divider, MenuItem as MenuItem3, Stack as Stack2, TextField as TextField3, ToggleButton, ToggleButtonGroup, Typography as Typography2 } from "@mui/material";
|
|
5
5
|
|
|
6
6
|
// src/wikex/fees-table.tsx
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
8
|
+
import { useId, useLayoutEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
9
9
|
import styled6, { ThemeProvider } from "styled-components";
|
|
10
|
-
import
|
|
10
|
+
import TextField2 from "@mui/material/TextField";
|
|
11
11
|
import Dialog from "@mui/material/Dialog";
|
|
12
12
|
import DialogTitle from "@mui/material/DialogTitle";
|
|
13
13
|
import DialogContent from "@mui/material/DialogContent";
|
|
14
14
|
import DialogContentText from "@mui/material/DialogContentText";
|
|
15
15
|
import DialogActions from "@mui/material/DialogActions";
|
|
16
|
-
import
|
|
16
|
+
import Button2 from "@mui/material/Button";
|
|
17
17
|
import Select from "@mui/material/Select";
|
|
18
|
-
import
|
|
18
|
+
import MenuItem2 from "@mui/material/MenuItem";
|
|
19
19
|
import Checkbox from "@mui/material/Checkbox";
|
|
20
|
+
import Collapse from "@mui/material/Collapse";
|
|
21
|
+
|
|
22
|
+
// src/wikex/fees-typography-controls.tsx
|
|
23
|
+
import { useEffect, useRef, useState } from "react";
|
|
24
|
+
import { Box, Button, MenuItem, Stack, TextField, Typography } from "@mui/material";
|
|
25
|
+
|
|
26
|
+
// src/wikex/fees-table-model.ts
|
|
27
|
+
var FEES_FONT_SIZE_MIN = 8;
|
|
28
|
+
var FEES_FONT_SIZE_MAX = 32;
|
|
29
|
+
var FEES_FONT_WEIGHTS = [400, 500, 600, 700, 800];
|
|
30
|
+
var FEES_PAGE_SIZE = 25;
|
|
31
|
+
function normalizeFeesSearch(value) {
|
|
32
|
+
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/đ/g, "d").replace(/Đ/g, "D").toLowerCase().trim();
|
|
33
|
+
}
|
|
34
|
+
function filterFeesRows(data, search, tag) {
|
|
35
|
+
const query = normalizeFeesSearch(search);
|
|
36
|
+
return data.rows.filter((row) => (!tag || row.tags.includes(tag)) && (!query || Object.values(row.cells).some((cell) => normalizeFeesSearch(cell).includes(query))));
|
|
37
|
+
}
|
|
38
|
+
function paginateFeesRows(rows, requestedPage, pageSize = FEES_PAGE_SIZE) {
|
|
39
|
+
const size = pageSize === -1 ? Math.max(1, rows.length) : Number.isInteger(pageSize) && pageSize > 0 ? pageSize : FEES_PAGE_SIZE;
|
|
40
|
+
const pageCount = Math.max(1, Math.ceil(rows.length / size));
|
|
41
|
+
const page = Math.min(pageCount, Math.max(1, Number.isFinite(requestedPage) ? Math.floor(requestedPage) : 1));
|
|
42
|
+
return { page, pageCount, rows: rows.slice((page - 1) * size, page * size) };
|
|
43
|
+
}
|
|
44
|
+
function moveFeesItem(items, from, to) {
|
|
45
|
+
if (!Number.isInteger(from) || !Number.isInteger(to) || from < 0 || from >= items.length || to < 0 || to >= items.length || from === to) return items;
|
|
46
|
+
const next = [...items];
|
|
47
|
+
const [item] = next.splice(from, 1);
|
|
48
|
+
next.splice(to, 0, item);
|
|
49
|
+
return next;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/wikex/fees-typography-controls.tsx
|
|
53
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
54
|
+
var weightLabels = { 400: "Th\u01B0\u1EDDng", 500: "V\u1EEBa", 600: "H\u01A1i \u0111\u1EADm", 700: "\u0110\u1EADm", 800: "R\u1EA5t \u0111\u1EADm" };
|
|
55
|
+
function FontSizeInput({ label, value, onChange }) {
|
|
56
|
+
const [draft, setDraft] = useState(String(value));
|
|
57
|
+
const [error, setError] = useState(false);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setDraft(String(value));
|
|
60
|
+
setError(false);
|
|
61
|
+
}, [value]);
|
|
62
|
+
const commit = () => {
|
|
63
|
+
const next = Number(draft);
|
|
64
|
+
const invalid = !draft.trim() || !Number.isInteger(next) || next < FEES_FONT_SIZE_MIN || next > FEES_FONT_SIZE_MAX;
|
|
65
|
+
setError(invalid);
|
|
66
|
+
if (!invalid && next !== value) onChange(next);
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
TextField,
|
|
70
|
+
{
|
|
71
|
+
fullWidth: true,
|
|
72
|
+
size: "small",
|
|
73
|
+
type: "number",
|
|
74
|
+
label: "C\u1EE1 ch\u1EEF (px)",
|
|
75
|
+
value: draft,
|
|
76
|
+
error,
|
|
77
|
+
slotProps: { htmlInput: { "aria-label": label, min: FEES_FONT_SIZE_MIN, max: FEES_FONT_SIZE_MAX, step: 1 } },
|
|
78
|
+
helperText: error ? `Nh\u1EADp s\u1ED1 nguy\xEAn t\u1EEB ${FEES_FONT_SIZE_MIN} \u0111\u1EBFn ${FEES_FONT_SIZE_MAX}.` : `${FEES_FONT_SIZE_MIN}\u2013${FEES_FONT_SIZE_MAX}px`,
|
|
79
|
+
onChange: (event) => {
|
|
80
|
+
setDraft(event.target.value);
|
|
81
|
+
setError(false);
|
|
82
|
+
},
|
|
83
|
+
onBlur: commit,
|
|
84
|
+
onKeyDown: (event) => {
|
|
85
|
+
if (event.key === "Enter") {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
commit();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function FeesTypographyControls({ value, onChange }) {
|
|
94
|
+
const root = useRef(null);
|
|
95
|
+
const update = (part, patch) => onChange({ ...value, [part]: { ...value?.[part], ...patch } });
|
|
96
|
+
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
|
+
/* @__PURE__ */ jsxs(Stack, { direction: { xs: "column", sm: "row" }, gap: 1.5, justifyContent: "space-between", alignItems: { sm: "center" }, sx: { mb: 2 }, children: [
|
|
98
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
99
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "\u0110\u1ECBnh d\u1EA1ng ch\u1EEF" }),
|
|
100
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "\xC1p d\u1EE5ng cho to\xE0n b\u1EA3ng, theo ng\xF4n ng\u1EEF \u0111ang ch\u1ECDn. Xem thay \u0111\u1ED5i ngay b\xEAn d\u01B0\u1EDBi." })
|
|
101
|
+
] }),
|
|
102
|
+
/* @__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" }),
|
|
104
|
+
/* @__PURE__ */ jsx(Button, { size: "small", color: "inherit", disabled: !value, onClick: () => onChange(void 0), children: "M\u1EB7c \u0111\u1ECBnh" })
|
|
105
|
+
] })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ jsx(Box, { sx: { display: "grid", gridTemplateColumns: { xs: "minmax(0, 1fr)", md: "repeat(2, minmax(0, 1fr))" }, gap: 2.5 }, children: [
|
|
108
|
+
{ part: "thead", title: "Ti\xEAu \u0111\u1EC1 b\u1EA3ng", fontSize: 10, fontWeight: 600 },
|
|
109
|
+
{ part: "tbody", title: "N\u1ED9i dung b\u1EA3ng", fontSize: 12, fontWeight: 500 }
|
|
110
|
+
].map(({ part, title, fontSize, fontWeight }) => /* @__PURE__ */ jsxs(Stack, { spacing: 1.5, children: [
|
|
111
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { fontWeight: 600 }, children: title }),
|
|
112
|
+
/* @__PURE__ */ jsxs(Stack, { direction: { xs: "column", sm: "row" }, gap: 1.5, children: [
|
|
113
|
+
/* @__PURE__ */ jsx(FontSizeInput, { label: `C\u1EE1 ch\u1EEF ${title.toLocaleLowerCase("vi")}`, value: value?.[part]?.fontSize ?? fontSize, onChange: (fontSize2) => update(part, { fontSize: fontSize2 }) }, `${part}:${value?.[part]?.fontSize ?? "default"}`),
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
TextField,
|
|
116
|
+
{
|
|
117
|
+
select: true,
|
|
118
|
+
fullWidth: true,
|
|
119
|
+
size: "small",
|
|
120
|
+
label: "\u0110\u1ED9 \u0111\u1EADm",
|
|
121
|
+
value: value?.[part]?.fontWeight ?? fontWeight,
|
|
122
|
+
slotProps: { select: { MenuProps: { container: () => root.current?.ownerDocument.body ?? document.body }, inputProps: { "aria-label": `\u0110\u1ED9 \u0111\u1EADm ${title.toLocaleLowerCase("vi")}` } } },
|
|
123
|
+
helperText: "\xC1p d\u1EE5ng cho t\u1EA5t c\u1EA3 \xF4",
|
|
124
|
+
onChange: (event) => update(part, { fontWeight: Number(event.target.value) }),
|
|
125
|
+
children: FEES_FONT_WEIGHTS.map((weight) => /* @__PURE__ */ jsxs(MenuItem, { value: weight, children: [
|
|
126
|
+
weightLabels[weight],
|
|
127
|
+
" (",
|
|
128
|
+
weight,
|
|
129
|
+
")"
|
|
130
|
+
] }, weight))
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] })
|
|
134
|
+
] }, part)) }),
|
|
135
|
+
/* @__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." })
|
|
136
|
+
] });
|
|
137
|
+
}
|
|
20
138
|
|
|
21
139
|
// src/commodity-original/styles/colors.ts
|
|
22
140
|
var lightColors = {
|
|
@@ -233,7 +351,7 @@ function getTableFixedColumnOffset(columns, columnIndex) {
|
|
|
233
351
|
}
|
|
234
352
|
|
|
235
353
|
// src/commodity-original/components/Table/index.tsx
|
|
236
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
354
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
237
355
|
function getCellValue(column, record) {
|
|
238
356
|
return column.dataIndex === void 0 ? void 0 : record[column.dataIndex];
|
|
239
357
|
}
|
|
@@ -306,7 +424,7 @@ function Table({
|
|
|
306
424
|
const nextSelectedRowKeys = event.target.checked ? [...selectedRowKeys, recordKey] : selectedRowKeys.filter((key) => key !== recordKey);
|
|
307
425
|
emitSelectionChange(nextSelectedRowKeys);
|
|
308
426
|
};
|
|
309
|
-
return /* @__PURE__ */
|
|
427
|
+
return /* @__PURE__ */ jsx2(TableScrollContainer, { children: /* @__PURE__ */ jsxs2(
|
|
310
428
|
TableRoot,
|
|
311
429
|
{
|
|
312
430
|
$minWidth: scroll?.x === void 0 ? void 0 : getTableColumnSize(scroll.x),
|
|
@@ -315,8 +433,8 @@ function Table({
|
|
|
315
433
|
className,
|
|
316
434
|
"data-size": size,
|
|
317
435
|
children: [
|
|
318
|
-
/* @__PURE__ */
|
|
319
|
-
rowSelection ? /* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsxs2(TableHeaderRow, { children: [
|
|
437
|
+
rowSelection ? /* @__PURE__ */ jsx2(TableHeaderCell, { scope: "col", children: selectionType === "checkbox" ? /* @__PURE__ */ jsx2(
|
|
320
438
|
TableSelectionInput,
|
|
321
439
|
{
|
|
322
440
|
checked: isAllSelected,
|
|
@@ -325,8 +443,8 @@ function Table({
|
|
|
325
443
|
type: "checkbox"
|
|
326
444
|
}
|
|
327
445
|
) : null }) : null,
|
|
328
|
-
expandable ? /* @__PURE__ */
|
|
329
|
-
columns.map((column, columnIndex) => /* @__PURE__ */
|
|
446
|
+
expandable ? /* @__PURE__ */ jsx2(TableHeaderCell, { scope: "col" }) : null,
|
|
447
|
+
columns.map((column, columnIndex) => /* @__PURE__ */ jsx2(
|
|
330
448
|
TableHeaderCell,
|
|
331
449
|
{
|
|
332
450
|
$fixed: column.fixed,
|
|
@@ -334,7 +452,7 @@ function Table({
|
|
|
334
452
|
$width: column.width === void 0 ? void 0 : getTableColumnSize(column.width),
|
|
335
453
|
"data-column-key": column.key,
|
|
336
454
|
scope: "col",
|
|
337
|
-
children: column.sortable ? /* @__PURE__ */
|
|
455
|
+
children: column.sortable ? /* @__PURE__ */ jsx2(
|
|
338
456
|
TableSortButton,
|
|
339
457
|
{
|
|
340
458
|
"aria-pressed": sort?.field === column.key,
|
|
@@ -347,13 +465,13 @@ function Table({
|
|
|
347
465
|
column.key
|
|
348
466
|
))
|
|
349
467
|
] }) }),
|
|
350
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ jsx2("tbody", { children: loading ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: columnCount, children: loadingContent }) }) : dataSource.length === 0 ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: columnCount, children: empty }) }) : dataSource.map((record, index) => {
|
|
351
469
|
const recordKey = getRowKey(record);
|
|
352
470
|
const selectionProps = rowSelection?.getCheckboxProps?.(record);
|
|
353
471
|
const isExpanded = expandedRowKeySet.has(recordKey);
|
|
354
|
-
return /* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
rowSelection ? /* @__PURE__ */
|
|
472
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
473
|
+
/* @__PURE__ */ jsxs2(TableRow, { "data-row-key": recordKey, children: [
|
|
474
|
+
rowSelection ? /* @__PURE__ */ jsx2(TableCell, { children: /* @__PURE__ */ jsx2(
|
|
357
475
|
TableSelectionInput,
|
|
358
476
|
{
|
|
359
477
|
checked: selectedRowKeySet.has(recordKey),
|
|
@@ -363,7 +481,7 @@ function Table({
|
|
|
363
481
|
type: selectionType
|
|
364
482
|
}
|
|
365
483
|
) }) : null,
|
|
366
|
-
expandable ? /* @__PURE__ */
|
|
484
|
+
expandable ? /* @__PURE__ */ jsx2(TableCell, { children: /* @__PURE__ */ jsx2(
|
|
367
485
|
TableExpandButton,
|
|
368
486
|
{
|
|
369
487
|
"aria-expanded": isExpanded,
|
|
@@ -374,7 +492,7 @@ function Table({
|
|
|
374
492
|
) }) : null,
|
|
375
493
|
columns.map((column, columnIndex) => {
|
|
376
494
|
const value = getCellValue(column, record);
|
|
377
|
-
return /* @__PURE__ */
|
|
495
|
+
return /* @__PURE__ */ jsx2(
|
|
378
496
|
TableCell,
|
|
379
497
|
{
|
|
380
498
|
$fixed: column.fixed,
|
|
@@ -386,7 +504,7 @@ function Table({
|
|
|
386
504
|
);
|
|
387
505
|
})
|
|
388
506
|
] }),
|
|
389
|
-
expandable?.render && isExpanded ? /* @__PURE__ */
|
|
507
|
+
expandable?.render && isExpanded ? /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableExpandedCell, { colSpan: columnCount, children: expandable.render(record) }) }) : null
|
|
390
508
|
] }, recordKey);
|
|
391
509
|
}) })
|
|
392
510
|
]
|
|
@@ -441,7 +559,7 @@ var PaginationArrow = styled2.span.withConfig({
|
|
|
441
559
|
], chevron_right_default, chevron_right_default);
|
|
442
560
|
|
|
443
561
|
// src/commodity-original/components/Pagination/index.tsx
|
|
444
|
-
import { jsx as
|
|
562
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
445
563
|
function getPaginationItems(page, pageCount, siblingCount) {
|
|
446
564
|
const maxVisibleItems = siblingCount * 2 + 5;
|
|
447
565
|
if (pageCount <= maxVisibleItems) {
|
|
@@ -477,13 +595,13 @@ function Pagination({
|
|
|
477
595
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
478
596
|
const hasPreviousPage = currentPage > 1;
|
|
479
597
|
const hasNextPage = currentPage < safePageCount;
|
|
480
|
-
return /* @__PURE__ */
|
|
598
|
+
return /* @__PURE__ */ jsx3(
|
|
481
599
|
PaginationNav,
|
|
482
600
|
{
|
|
483
601
|
"aria-label": ariaLabel ?? t("pagination.navigation"),
|
|
484
602
|
className,
|
|
485
|
-
children: /* @__PURE__ */
|
|
486
|
-
/* @__PURE__ */
|
|
603
|
+
children: /* @__PURE__ */ jsxs3(PaginationList, { children: [
|
|
604
|
+
/* @__PURE__ */ jsx3(PaginationItem, { children: /* @__PURE__ */ jsx3(
|
|
487
605
|
PaginationButton,
|
|
488
606
|
{
|
|
489
607
|
"aria-label": labels?.previous ?? t("pagination.previous"),
|
|
@@ -491,10 +609,10 @@ function Pagination({
|
|
|
491
609
|
disabled: !hasPreviousPage,
|
|
492
610
|
onClick: () => onPageChange(currentPage - 1),
|
|
493
611
|
type: "button",
|
|
494
|
-
children: /* @__PURE__ */
|
|
612
|
+
children: /* @__PURE__ */ jsx3(PaginationArrow, { "data-direction": "previous" })
|
|
495
613
|
}
|
|
496
614
|
) }),
|
|
497
|
-
items.map((item, index) => /* @__PURE__ */
|
|
615
|
+
items.map((item, index) => /* @__PURE__ */ jsx3(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ jsx3(PaginationButton, { "aria-hidden": "true", disabled: true, tabIndex: -1, type: "button", children: "\u2026" }) : /* @__PURE__ */ jsx3(
|
|
498
616
|
PaginationButton,
|
|
499
617
|
{
|
|
500
618
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
@@ -505,7 +623,7 @@ function Pagination({
|
|
|
505
623
|
children: item
|
|
506
624
|
}
|
|
507
625
|
) }, `${item}-${index}`)),
|
|
508
|
-
/* @__PURE__ */
|
|
626
|
+
/* @__PURE__ */ jsx3(PaginationItem, { children: /* @__PURE__ */ jsx3(
|
|
509
627
|
PaginationButton,
|
|
510
628
|
{
|
|
511
629
|
"aria-label": labels?.next ?? t("pagination.next"),
|
|
@@ -513,7 +631,7 @@ function Pagination({
|
|
|
513
631
|
disabled: !hasNextPage,
|
|
514
632
|
onClick: () => onPageChange(currentPage + 1),
|
|
515
633
|
type: "button",
|
|
516
|
-
children: /* @__PURE__ */
|
|
634
|
+
children: /* @__PURE__ */ jsx3(PaginationArrow, { "data-direction": "next" })
|
|
517
635
|
}
|
|
518
636
|
) })
|
|
519
637
|
] })
|
|
@@ -549,7 +667,7 @@ var InputAdornment = styled3.span.withConfig({
|
|
|
549
667
|
], ({ theme }) => theme.colors.text.secondary, InputCommonRoot, InputCommonRoot);
|
|
550
668
|
|
|
551
669
|
// src/commodity-original/components/InputCommon/index.tsx
|
|
552
|
-
import { jsx as
|
|
670
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
553
671
|
function InputCommon({
|
|
554
672
|
leftIcon,
|
|
555
673
|
rightIcon,
|
|
@@ -560,11 +678,11 @@ function InputCommon({
|
|
|
560
678
|
onClear,
|
|
561
679
|
...inputProps
|
|
562
680
|
}) {
|
|
563
|
-
return /* @__PURE__ */
|
|
564
|
-
leftIcon ? /* @__PURE__ */
|
|
565
|
-
/* @__PURE__ */
|
|
566
|
-
clearable && inputProps.value ? /* @__PURE__ */
|
|
567
|
-
errorMessage ? /* @__PURE__ */
|
|
681
|
+
return /* @__PURE__ */ jsxs4(InputCommonRoot, { "data-disabled": inputProps.disabled || void 0, "data-error": error || void 0, "data-size": size, children: [
|
|
682
|
+
leftIcon ? /* @__PURE__ */ jsx4(InputAdornment, { "aria-hidden": "true", children: leftIcon }) : null,
|
|
683
|
+
/* @__PURE__ */ jsx4(InputCommonField, { ...inputProps }),
|
|
684
|
+
clearable && inputProps.value ? /* @__PURE__ */ jsx4("button", { "aria-label": "X\xF3a n\u1ED9i dung", onClick: onClear, type: "button", children: "\xD7" }) : rightIcon ? /* @__PURE__ */ jsx4(InputAdornment, { "aria-hidden": "true", children: rightIcon }) : null,
|
|
685
|
+
errorMessage ? /* @__PURE__ */ jsx4("span", { role: "alert", children: errorMessage }) : null
|
|
568
686
|
] });
|
|
569
687
|
}
|
|
570
688
|
|
|
@@ -596,7 +714,7 @@ var TabLine = styled4.span.withConfig({
|
|
|
596
714
|
], ({ theme }) => theme.colors.accent.primary, TabCommonList, TabCommonList);
|
|
597
715
|
|
|
598
716
|
// src/commodity-original/components/TabCommon/index.tsx
|
|
599
|
-
import { jsx as
|
|
717
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
600
718
|
function TabCommon({
|
|
601
719
|
items,
|
|
602
720
|
value,
|
|
@@ -605,7 +723,7 @@ function TabCommon({
|
|
|
605
723
|
className,
|
|
606
724
|
size = "md"
|
|
607
725
|
}) {
|
|
608
|
-
return /* @__PURE__ */
|
|
726
|
+
return /* @__PURE__ */ jsx5(
|
|
609
727
|
TabCommonList,
|
|
610
728
|
{
|
|
611
729
|
"aria-label": ariaLabel,
|
|
@@ -614,7 +732,7 @@ function TabCommon({
|
|
|
614
732
|
role: "tablist",
|
|
615
733
|
children: items.map((item) => {
|
|
616
734
|
const isActive = item.id === value;
|
|
617
|
-
return /* @__PURE__ */
|
|
735
|
+
return /* @__PURE__ */ jsxs5(
|
|
618
736
|
TabButton,
|
|
619
737
|
{
|
|
620
738
|
"aria-selected": isActive,
|
|
@@ -625,7 +743,7 @@ function TabCommon({
|
|
|
625
743
|
type: "button",
|
|
626
744
|
children: [
|
|
627
745
|
item.label,
|
|
628
|
-
/* @__PURE__ */
|
|
746
|
+
/* @__PURE__ */ jsx5(TabLine, { "aria-hidden": "true" })
|
|
629
747
|
]
|
|
630
748
|
},
|
|
631
749
|
item.id
|
|
@@ -720,29 +838,6 @@ var FeesMonthCode = styled5.span.withConfig({
|
|
|
720
838
|
`;font-family:var(--Font-Main,Manrope);font-size:var(--Size-Title-S,14px);font-style:normal;font-weight:500;line-height:var(--Line-height-Body-S,18px);`
|
|
721
839
|
], ({ theme }) => theme.colors.text.primary);
|
|
722
840
|
|
|
723
|
-
// src/wikex/fees-table-model.ts
|
|
724
|
-
var FEES_PAGE_SIZE = 25;
|
|
725
|
-
function normalizeFeesSearch(value) {
|
|
726
|
-
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/đ/g, "d").replace(/Đ/g, "D").toLowerCase().trim();
|
|
727
|
-
}
|
|
728
|
-
function filterFeesRows(data, search, tag) {
|
|
729
|
-
const query = normalizeFeesSearch(search);
|
|
730
|
-
return data.rows.filter((row) => (!tag || row.tags.includes(tag)) && (!query || Object.values(row.cells).some((cell) => normalizeFeesSearch(cell).includes(query))));
|
|
731
|
-
}
|
|
732
|
-
function paginateFeesRows(rows, requestedPage, pageSize = FEES_PAGE_SIZE) {
|
|
733
|
-
const size = pageSize === -1 ? Math.max(1, rows.length) : Number.isInteger(pageSize) && pageSize > 0 ? pageSize : FEES_PAGE_SIZE;
|
|
734
|
-
const pageCount = Math.max(1, Math.ceil(rows.length / size));
|
|
735
|
-
const page = Math.min(pageCount, Math.max(1, Number.isFinite(requestedPage) ? Math.floor(requestedPage) : 1));
|
|
736
|
-
return { page, pageCount, rows: rows.slice((page - 1) * size, page * size) };
|
|
737
|
-
}
|
|
738
|
-
function moveFeesItem(items, from, to) {
|
|
739
|
-
if (!Number.isInteger(from) || !Number.isInteger(to) || from < 0 || from >= items.length || to < 0 || to >= items.length || from === to) return items;
|
|
740
|
-
const next = [...items];
|
|
741
|
-
const [item] = next.splice(from, 1);
|
|
742
|
-
next.splice(to, 0, item);
|
|
743
|
-
return next;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
841
|
// src/wikex/fees-table.tsx
|
|
747
842
|
var fallbackColors = lightColors;
|
|
748
843
|
var feesTheme = {
|
|
@@ -755,32 +850,32 @@ var feesTheme = {
|
|
|
755
850
|
]))
|
|
756
851
|
};
|
|
757
852
|
var EditorActions = styled6.div.withConfig({
|
|
758
|
-
componentId: "sc-
|
|
853
|
+
componentId: "sc-a5657aea-0"
|
|
759
854
|
})([
|
|
760
855
|
`display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
|
|
761
856
|
]);
|
|
762
857
|
var EditGroup = styled6.div.withConfig({
|
|
763
|
-
componentId: "sc-
|
|
858
|
+
componentId: "sc-a5657aea-1"
|
|
764
859
|
})([
|
|
765
860
|
`display:flex;flex-direction:column;gap:6px;`
|
|
766
861
|
]);
|
|
767
862
|
var HeaderGroup = styled6(EditGroup).withConfig({
|
|
768
|
-
componentId: "sc-
|
|
863
|
+
componentId: "sc-a5657aea-2"
|
|
769
864
|
})([
|
|
770
865
|
`gap:8px;`
|
|
771
866
|
]);
|
|
772
867
|
var HeaderTitle = styled6.div.withConfig({
|
|
773
|
-
componentId: "sc-
|
|
868
|
+
componentId: "sc-a5657aea-3"
|
|
774
869
|
})([
|
|
775
870
|
`display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
|
|
776
871
|
]);
|
|
777
872
|
var HeaderActions = styled6.div.withConfig({
|
|
778
|
-
componentId: "sc-
|
|
873
|
+
componentId: "sc-a5657aea-4"
|
|
779
874
|
})([
|
|
780
875
|
`display:flex;align-items:center;min-height:24px;`
|
|
781
876
|
]);
|
|
782
877
|
var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
783
|
-
componentId: "sc-
|
|
878
|
+
componentId: "sc-a5657aea-5"
|
|
784
879
|
})([
|
|
785
880
|
`&[data-editable] th{vertical-align:top;}--fees-row-background:`,
|
|
786
881
|
`;--fees-stripe-background:`,
|
|
@@ -788,26 +883,36 @@ var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
|
|
|
788
883
|
`;:root[data-theme="dark"] &{--fees-row-background:#39393d;--fees-stripe-background:`,
|
|
789
884
|
`;--fees-text:`,
|
|
790
885
|
`;}&[data-editable] table{table-layout:auto;}table{table-layout:fixed;font-family:var(--font-manrope,Manrope),Arial,Helvetica,sans-serif;}th,td{box-sizing:border-box;overflow-wrap:anywhere;}thead > tr,thead > tr > th{background:`,
|
|
791
|
-
`;}thead > tr > th{height:52px;padding:11.5px 8px;color:`,
|
|
792
|
-
`;font-size
|
|
886
|
+
`;}&&& thead > tr > th{height:52px;padding:11.5px 8px;color:`,
|
|
887
|
+
`;font-size:`,
|
|
888
|
+
`px;font-weight:`,
|
|
889
|
+
`;line-height:`,
|
|
890
|
+
`;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
|
+
`px;font-weight:`,
|
|
892
|
+
`;line-height:`,
|
|
893
|
+
`;}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:`,
|
|
793
894
|
`px;table-layout:fixed;}`,
|
|
794
|
-
` thead > tr > th,tbody > tr > td{padding-left:6px;padding-right:6px;white-space:pre-line;overflow-wrap:anywhere;font-family:var(--font-inter,Inter),Arial,Helvetica,sans-serif;}thead > tr > th{height:40px;padding-top:9.5px;padding-bottom:9.5px;font-size
|
|
895
|
+
` thead > tr > th,tbody > tr > td{padding-left:6px;padding-right:6px;white-space:pre-line;overflow-wrap:anywhere;font-family:var(--font-inter,Inter),Arial,Helvetica,sans-serif;}thead > tr > th{height:40px;padding-top:9.5px;padding-bottom:9.5px;font-size:`,
|
|
896
|
+
`px;line-height:`,
|
|
897
|
+
`;}tbody > tr > td{height:40px;padding-top:5.5px;padding-bottom:5.5px;font-size:`,
|
|
898
|
+
`px;line-height:`,
|
|
899
|
+
`;}thead > tr > th:last-child,tbody > tr > td:last-child{padding-right:12px;}th > span,td > span{text-align:left;}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:`,
|
|
795
900
|
`;}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);}}}`
|
|
796
|
-
], ({ 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, ({ $mobileColumnWidths }) => $mobileColumnWidths.reduce((sum, width) => sum + width, 0), ({ $mobileColumnWidths }) => $mobileColumnWidths.map((width, index) => `
|
|
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) => `
|
|
797
902
|
th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
|
|
798
903
|
width: ${width}px;
|
|
799
904
|
min-width: ${width}px;
|
|
800
905
|
max-width: ${width}px;
|
|
801
906
|
}
|
|
802
|
-
`).join(""), ({ theme }) => theme.colors.accent.primary);
|
|
907
|
+
`).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);
|
|
803
908
|
var FeesCellContent = styled6.span.withConfig({
|
|
804
|
-
componentId: "sc-
|
|
909
|
+
componentId: "sc-a5657aea-6"
|
|
805
910
|
})([
|
|
806
911
|
`display:block;text-align:`,
|
|
807
912
|
`;`
|
|
808
913
|
], ({ $alignRight }) => $alignRight ? "right" : "left");
|
|
809
914
|
var EditorButton = styled6.button.withConfig({
|
|
810
|
-
componentId: "sc-
|
|
915
|
+
componentId: "sc-a5657aea-7"
|
|
811
916
|
})([
|
|
812
917
|
`padding:7px 12px;border:1px solid `,
|
|
813
918
|
`;border-radius:6px;background:`,
|
|
@@ -816,17 +921,17 @@ var EditorButton = styled6.button.withConfig({
|
|
|
816
921
|
`;}&:disabled{cursor:default;opacity:.4;}`
|
|
817
922
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
818
923
|
var OrderActions = styled6.div.withConfig({
|
|
819
|
-
componentId: "sc-
|
|
924
|
+
componentId: "sc-a5657aea-8"
|
|
820
925
|
})([
|
|
821
926
|
`display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
|
|
822
927
|
]);
|
|
823
928
|
var PositionLabel = styled6.label.withConfig({
|
|
824
|
-
componentId: "sc-
|
|
929
|
+
componentId: "sc-a5657aea-9"
|
|
825
930
|
})([
|
|
826
931
|
`display:inline-flex;align-items:center;gap:6px;font-size:12px;`
|
|
827
932
|
]);
|
|
828
933
|
var PositionInput = styled6.input.withConfig({
|
|
829
|
-
componentId: "sc-
|
|
934
|
+
componentId: "sc-a5657aea-10"
|
|
830
935
|
})([
|
|
831
936
|
`width:56px;padding:5px;border:1px solid `,
|
|
832
937
|
`;border-radius:4px;background:`,
|
|
@@ -835,17 +940,17 @@ var PositionInput = styled6.input.withConfig({
|
|
|
835
940
|
`;}`
|
|
836
941
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
837
942
|
var ColumnRow = styled6.div.withConfig({
|
|
838
|
-
componentId: "sc-
|
|
943
|
+
componentId: "sc-a5657aea-11"
|
|
839
944
|
})([
|
|
840
945
|
`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;}`
|
|
841
946
|
]);
|
|
842
947
|
var PaginationControls = styled6(FeesAndMarginPagination).withConfig({
|
|
843
|
-
componentId: "sc-
|
|
948
|
+
componentId: "sc-a5657aea-12"
|
|
844
949
|
})([
|
|
845
950
|
`align-items:center;flex-wrap:wrap;gap:16px 24px;`
|
|
846
951
|
]);
|
|
847
952
|
var PageSizeLabel = styled6.div.withConfig({
|
|
848
|
-
componentId: "sc-
|
|
953
|
+
componentId: "sc-a5657aea-13"
|
|
849
954
|
})([
|
|
850
955
|
`display:inline-flex;align-items:center;gap:8px;color:`,
|
|
851
956
|
`;font:inherit;font-size:13px;`
|
|
@@ -873,19 +978,19 @@ function Position({ value, max, label, onMove }) {
|
|
|
873
978
|
});
|
|
874
979
|
}
|
|
875
980
|
var DeleteButton = styled6(EditorButton).withConfig({
|
|
876
|
-
componentId: "sc-
|
|
981
|
+
componentId: "sc-a5657aea-14"
|
|
877
982
|
})([
|
|
878
983
|
`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;}`
|
|
879
984
|
]);
|
|
880
985
|
var CellEditorInput = styled6.textarea.withConfig({
|
|
881
|
-
componentId: "sc-
|
|
986
|
+
componentId: "sc-a5657aea-15"
|
|
882
987
|
})([
|
|
883
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:`,
|
|
884
989
|
`;}&:focus{outline:1px solid `,
|
|
885
990
|
`;}`
|
|
886
991
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.accent.primary);
|
|
887
992
|
function CellEditor({ onInput, ...props }) {
|
|
888
|
-
const ref =
|
|
993
|
+
const ref = useRef2(null);
|
|
889
994
|
const fit = () => {
|
|
890
995
|
const element = ref.current;
|
|
891
996
|
if (!element) return;
|
|
@@ -894,10 +999,7 @@ function CellEditor({ onInput, ...props }) {
|
|
|
894
999
|
const border = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
|
895
1000
|
element.style.height = `${element.scrollHeight + border}px`;
|
|
896
1001
|
};
|
|
897
|
-
useLayoutEffect(fit
|
|
898
|
-
props.value,
|
|
899
|
-
props.defaultValue
|
|
900
|
-
]);
|
|
1002
|
+
useLayoutEffect(fit);
|
|
901
1003
|
useLayoutEffect(() => {
|
|
902
1004
|
const element = ref.current;
|
|
903
1005
|
if (!element) return;
|
|
@@ -930,7 +1032,7 @@ function CellEditor({ onInput, ...props }) {
|
|
|
930
1032
|
});
|
|
931
1033
|
}
|
|
932
1034
|
function RowTagSelect({ selected, options, onChange }) {
|
|
933
|
-
const selectRoot =
|
|
1035
|
+
const selectRoot = useRef2(null);
|
|
934
1036
|
return /* @__PURE__ */ _jsx(EditGroup, {
|
|
935
1037
|
children: /* @__PURE__ */ _jsx("div", {
|
|
936
1038
|
ref: selectRoot,
|
|
@@ -955,7 +1057,7 @@ function RowTagSelect({ selected, options, onChange }) {
|
|
|
955
1057
|
fontSize: 13
|
|
956
1058
|
},
|
|
957
1059
|
children: [
|
|
958
|
-
options.map((item) => /* @__PURE__ */ _jsxs(
|
|
1060
|
+
options.map((item) => /* @__PURE__ */ _jsxs(MenuItem2, {
|
|
959
1061
|
value: item,
|
|
960
1062
|
children: [
|
|
961
1063
|
/* @__PURE__ */ _jsx(Checkbox, {
|
|
@@ -967,7 +1069,7 @@ function RowTagSelect({ selected, options, onChange }) {
|
|
|
967
1069
|
item
|
|
968
1070
|
]
|
|
969
1071
|
}, item)),
|
|
970
|
-
!options.length && /* @__PURE__ */ _jsx(
|
|
1072
|
+
!options.length && /* @__PURE__ */ _jsx(MenuItem2, {
|
|
971
1073
|
disabled: true,
|
|
972
1074
|
children: "Ch\u01B0a c\xF3 tag \u2014 d\xF9ng n\xFAt Th\xEAm tag ph\xEDa tr\xEAn"
|
|
973
1075
|
})
|
|
@@ -1017,14 +1119,15 @@ var rightAlignedColumns = /* @__PURE__ */ new Set([
|
|
|
1017
1119
|
"unit"
|
|
1018
1120
|
]);
|
|
1019
1121
|
function FeesTable({ value, editable = false, onChange, labels, size = "md", tagOrder = [], language = "vi" }) {
|
|
1020
|
-
const [search, setSearch] =
|
|
1021
|
-
const [tag, setTag] =
|
|
1022
|
-
const [page, setPage] =
|
|
1023
|
-
const [pageSize, setPageSize] =
|
|
1024
|
-
const [columnsOpen, setColumnsOpen] =
|
|
1122
|
+
const [search, setSearch] = useState2("");
|
|
1123
|
+
const [tag, setTag] = useState2("");
|
|
1124
|
+
const [page, setPage] = useState2(1);
|
|
1125
|
+
const [pageSize, setPageSize] = useState2(FEES_PAGE_SIZE);
|
|
1126
|
+
const [columnsOpen, setColumnsOpen] = useState2(false);
|
|
1127
|
+
const [typographyOpen, setTypographyOpen] = useState2(false);
|
|
1025
1128
|
const english = language === "en";
|
|
1026
1129
|
const canEdit = editable && Boolean(onChange);
|
|
1027
|
-
const tableRoot =
|
|
1130
|
+
const tableRoot = useRef2(null);
|
|
1028
1131
|
useLayoutEffect(() => {
|
|
1029
1132
|
const root = tableRoot.current;
|
|
1030
1133
|
if (!root || !canEdit) return;
|
|
@@ -1044,9 +1147,10 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1044
1147
|
value.columns
|
|
1045
1148
|
]);
|
|
1046
1149
|
const dialogId = useId();
|
|
1047
|
-
const
|
|
1048
|
-
const [
|
|
1049
|
-
const [
|
|
1150
|
+
const mobileFontScale = Math.max(1, (value.typography?.thead?.fontSize ?? 8) / 8, (value.typography?.tbody?.fontSize ?? 10) / 10);
|
|
1151
|
+
const [createTagOpen, setCreateTagOpen] = useState2(false);
|
|
1152
|
+
const [tagDraft, setTagDraft] = useState2("");
|
|
1153
|
+
const [deleteTarget, setDeleteTarget] = useState2(null);
|
|
1050
1154
|
const confirmDelete = () => {
|
|
1051
1155
|
if (!deleteTarget || !canEdit) return;
|
|
1052
1156
|
if (deleteTarget.kind === "row") {
|
|
@@ -1338,6 +1442,13 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1338
1442
|
")"
|
|
1339
1443
|
]
|
|
1340
1444
|
}),
|
|
1445
|
+
/* @__PURE__ */ _jsx(EditorButton, {
|
|
1446
|
+
type: "button",
|
|
1447
|
+
"aria-expanded": typographyOpen,
|
|
1448
|
+
"aria-controls": `${dialogId}-typography`,
|
|
1449
|
+
onClick: () => setTypographyOpen((open) => !open),
|
|
1450
|
+
children: "\u0110\u1ECBnh d\u1EA1ng ch\u1EEF"
|
|
1451
|
+
}),
|
|
1341
1452
|
/* @__PURE__ */ _jsx(EditorButton, {
|
|
1342
1453
|
type: "button",
|
|
1343
1454
|
onClick: () => {
|
|
@@ -1348,8 +1459,28 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1348
1459
|
})
|
|
1349
1460
|
]
|
|
1350
1461
|
}),
|
|
1462
|
+
canEdit && /* @__PURE__ */ _jsx(Collapse, {
|
|
1463
|
+
in: typographyOpen,
|
|
1464
|
+
unmountOnExit: true,
|
|
1465
|
+
children: /* @__PURE__ */ _jsx("div", {
|
|
1466
|
+
id: `${dialogId}-typography`,
|
|
1467
|
+
children: /* @__PURE__ */ _jsx(FeesTypographyControls, {
|
|
1468
|
+
value: value.typography,
|
|
1469
|
+
onChange: (typography) => {
|
|
1470
|
+
const { typography: _previous, ...data } = value;
|
|
1471
|
+
onChange?.({
|
|
1472
|
+
...data,
|
|
1473
|
+
...typography ? {
|
|
1474
|
+
typography
|
|
1475
|
+
} : {}
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
})
|
|
1479
|
+
})
|
|
1480
|
+
}),
|
|
1351
1481
|
/* @__PURE__ */ _jsx(AlignedFeesTable, {
|
|
1352
|
-
$
|
|
1482
|
+
$typography: value.typography,
|
|
1483
|
+
$mobileColumnWidths: columns.map((column) => Math.ceil((mobileColumnWidths[column.key] ?? 88) * mobileFontScale)),
|
|
1353
1484
|
"data-editable": canEdit || void 0,
|
|
1354
1485
|
children: /* @__PURE__ */ _jsx(Table, {
|
|
1355
1486
|
ariaLabel: english ? "Fees and margin table" : "B\u1EA3ng ph\xED v\xE0 k\xFD qu\u1EF9",
|
|
@@ -1397,11 +1528,11 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1397
1528
|
25,
|
|
1398
1529
|
50,
|
|
1399
1530
|
100
|
|
1400
|
-
].map((size2) => /* @__PURE__ */ _jsx(
|
|
1531
|
+
].map((size2) => /* @__PURE__ */ _jsx(MenuItem2, {
|
|
1401
1532
|
value: size2,
|
|
1402
1533
|
children: size2
|
|
1403
1534
|
}, size2)),
|
|
1404
|
-
/* @__PURE__ */ _jsx(
|
|
1535
|
+
/* @__PURE__ */ _jsx(MenuItem2, {
|
|
1405
1536
|
value: -1,
|
|
1406
1537
|
children: english ? "All" : "T\u1EA5t c\u1EA3"
|
|
1407
1538
|
})
|
|
@@ -1510,7 +1641,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1510
1641
|
]
|
|
1511
1642
|
}),
|
|
1512
1643
|
/* @__PURE__ */ _jsx(DialogActions, {
|
|
1513
|
-
children: /* @__PURE__ */ _jsx(
|
|
1644
|
+
children: /* @__PURE__ */ _jsx(Button2, {
|
|
1514
1645
|
variant: "contained",
|
|
1515
1646
|
onClick: () => setColumnsOpen(false),
|
|
1516
1647
|
children: "Xong"
|
|
@@ -1531,7 +1662,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1531
1662
|
children: "T\u1EA1o tag m\u1EDBi"
|
|
1532
1663
|
}),
|
|
1533
1664
|
/* @__PURE__ */ _jsx(DialogContent, {
|
|
1534
|
-
children: /* @__PURE__ */ _jsx(
|
|
1665
|
+
children: /* @__PURE__ */ _jsx(TextField2, {
|
|
1535
1666
|
autoFocus: true,
|
|
1536
1667
|
fullWidth: true,
|
|
1537
1668
|
margin: "dense",
|
|
@@ -1550,11 +1681,11 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1550
1681
|
}),
|
|
1551
1682
|
/* @__PURE__ */ _jsxs(DialogActions, {
|
|
1552
1683
|
children: [
|
|
1553
|
-
/* @__PURE__ */ _jsx(
|
|
1684
|
+
/* @__PURE__ */ _jsx(Button2, {
|
|
1554
1685
|
onClick: () => setCreateTagOpen(false),
|
|
1555
1686
|
children: "H\u1EE7y"
|
|
1556
1687
|
}),
|
|
1557
|
-
/* @__PURE__ */ _jsx(
|
|
1688
|
+
/* @__PURE__ */ _jsx(Button2, {
|
|
1558
1689
|
variant: "contained",
|
|
1559
1690
|
disabled: !newTagName || duplicateTag,
|
|
1560
1691
|
onClick: createTag,
|
|
@@ -1589,12 +1720,12 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1589
1720
|
}),
|
|
1590
1721
|
/* @__PURE__ */ _jsxs(DialogActions, {
|
|
1591
1722
|
children: [
|
|
1592
|
-
/* @__PURE__ */ _jsx(
|
|
1723
|
+
/* @__PURE__ */ _jsx(Button2, {
|
|
1593
1724
|
autoFocus: true,
|
|
1594
1725
|
onClick: () => setDeleteTarget(null),
|
|
1595
1726
|
children: "H\u1EE7y"
|
|
1596
1727
|
}),
|
|
1597
|
-
/* @__PURE__ */ _jsxs(
|
|
1728
|
+
/* @__PURE__ */ _jsxs(Button2, {
|
|
1598
1729
|
color: "error",
|
|
1599
1730
|
variant: "contained",
|
|
1600
1731
|
onClick: confirmDelete,
|
|
@@ -1613,7 +1744,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
|
|
|
1613
1744
|
}
|
|
1614
1745
|
|
|
1615
1746
|
// src/wikex/fees-manager.tsx
|
|
1616
|
-
import { Fragment as Fragment2, jsx as
|
|
1747
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1617
1748
|
function FeesManager({
|
|
1618
1749
|
entries,
|
|
1619
1750
|
selectedId,
|
|
@@ -1633,16 +1764,16 @@ function FeesManager({
|
|
|
1633
1764
|
}) {
|
|
1634
1765
|
const entry = entries.find((item) => item.id === selectedId);
|
|
1635
1766
|
const key = `${selectedId}:${language}`;
|
|
1636
|
-
return /* @__PURE__ */
|
|
1637
|
-
/* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1767
|
+
return /* @__PURE__ */ jsxs6(Stack2, { spacing: 3, sx: { minWidth: 0, width: 1 }, children: [
|
|
1768
|
+
/* @__PURE__ */ jsxs6(Stack2, { direction: { xs: "column", md: "row" }, justifyContent: "space-between", alignItems: { md: "center" }, gap: 2.5, children: [
|
|
1769
|
+
/* @__PURE__ */ jsxs6(Stack2, { spacing: 1, sx: { minWidth: 0, maxWidth: 720 }, children: [
|
|
1770
|
+
/* @__PURE__ */ jsx6(Typography2, { variant: "h4", children: "Ph\xED & k\xFD qu\u1EF9" }),
|
|
1771
|
+
/* @__PURE__ */ jsx6(Typography2, { 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." })
|
|
1641
1772
|
] }),
|
|
1642
|
-
/* @__PURE__ */
|
|
1643
|
-
dirtyKeys.includes(key) && /* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
|
|
1773
|
+
/* @__PURE__ */ jsxs6(Stack2, { direction: "row", spacing: 1.5, alignItems: "center", flexShrink: 0, children: [
|
|
1774
|
+
dirtyKeys.includes(key) && /* @__PURE__ */ jsx6(Chip, { size: "small", color: "warning", label: "Ch\u01B0a l\u01B0u" }),
|
|
1775
|
+
/* @__PURE__ */ jsx6(
|
|
1776
|
+
Button3,
|
|
1646
1777
|
{
|
|
1647
1778
|
variant: "contained",
|
|
1648
1779
|
loading: saving,
|
|
@@ -1654,17 +1785,17 @@ function FeesManager({
|
|
|
1654
1785
|
)
|
|
1655
1786
|
] })
|
|
1656
1787
|
] }),
|
|
1657
|
-
!canWrite && /* @__PURE__ */
|
|
1658
|
-
notice && /* @__PURE__ */
|
|
1659
|
-
!entries.length ? /* @__PURE__ */
|
|
1660
|
-
/* @__PURE__ */
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */
|
|
1663
|
-
/* @__PURE__ */
|
|
1788
|
+
!canWrite && /* @__PURE__ */ jsx6(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." }),
|
|
1789
|
+
notice && /* @__PURE__ */ jsx6(Alert, { severity: notice.severity, onClose: onDismissNotice, children: notice.message }),
|
|
1790
|
+
!entries.length ? /* @__PURE__ */ jsx6(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__ */ jsxs6(Fragment2, { children: [
|
|
1791
|
+
/* @__PURE__ */ jsx6(Card, { variant: "outlined", sx: { p: { xs: 2.5, md: 3 }, boxShadow: "none" }, children: /* @__PURE__ */ jsxs6(Stack2, { spacing: 2.5, children: [
|
|
1792
|
+
/* @__PURE__ */ jsxs6(Stack2, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 1.5, flexWrap: "wrap", children: [
|
|
1793
|
+
/* @__PURE__ */ jsx6(Typography2, { variant: "subtitle1", children: "B\u1EA3ng \u0111ang qu\u1EA3n l\xFD" }),
|
|
1794
|
+
/* @__PURE__ */ jsx6(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" })
|
|
1664
1795
|
] }),
|
|
1665
|
-
/* @__PURE__ */
|
|
1666
|
-
/* @__PURE__ */
|
|
1667
|
-
|
|
1796
|
+
/* @__PURE__ */ jsxs6(Stack2, { direction: { xs: "column", md: "row" }, spacing: 2.5, alignItems: { md: "flex-end" }, children: [
|
|
1797
|
+
/* @__PURE__ */ jsx6(
|
|
1798
|
+
TextField3,
|
|
1668
1799
|
{
|
|
1669
1800
|
select: true,
|
|
1670
1801
|
size: "small",
|
|
@@ -1674,7 +1805,7 @@ function FeesManager({
|
|
|
1674
1805
|
fullWidth: true,
|
|
1675
1806
|
sx: { flex: 1, minWidth: 0 },
|
|
1676
1807
|
onChange: (event) => onSelectEntry(event.target.value),
|
|
1677
|
-
children: entries.map((item, index) => /* @__PURE__ */
|
|
1808
|
+
children: entries.map((item, index) => /* @__PURE__ */ jsxs6(MenuItem3, { value: item.id, children: [
|
|
1678
1809
|
item.pageTitle,
|
|
1679
1810
|
" \xB7 /",
|
|
1680
1811
|
item.slug,
|
|
@@ -1684,9 +1815,9 @@ function FeesManager({
|
|
|
1684
1815
|
] }, item.id))
|
|
1685
1816
|
}
|
|
1686
1817
|
),
|
|
1687
|
-
/* @__PURE__ */
|
|
1688
|
-
/* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1818
|
+
/* @__PURE__ */ jsxs6(Stack2, { spacing: 1, sx: { width: { xs: 1, md: 240 }, flexShrink: 0 }, children: [
|
|
1819
|
+
/* @__PURE__ */ jsx6(Typography2, { variant: "caption", color: "text.secondary", children: "Ng\xF4n ng\u1EEF n\u1ED9i dung" }),
|
|
1820
|
+
/* @__PURE__ */ jsxs6(
|
|
1690
1821
|
ToggleButtonGroup,
|
|
1691
1822
|
{
|
|
1692
1823
|
size: "small",
|
|
@@ -1699,11 +1830,11 @@ function FeesManager({
|
|
|
1699
1830
|
if (next === "vi" || next === "en") onSelectLanguage(next);
|
|
1700
1831
|
},
|
|
1701
1832
|
children: [
|
|
1702
|
-
/* @__PURE__ */
|
|
1833
|
+
/* @__PURE__ */ jsxs6(ToggleButton, { value: "vi", children: [
|
|
1703
1834
|
"Ti\u1EBFng Vi\u1EC7t",
|
|
1704
1835
|
dirtyKeys.includes(`${selectedId}:vi`) ? " \u2022" : ""
|
|
1705
1836
|
] }),
|
|
1706
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ jsxs6(ToggleButton, { value: "en", children: [
|
|
1707
1838
|
"English",
|
|
1708
1839
|
dirtyKeys.includes(`${selectedId}:en`) ? " \u2022" : ""
|
|
1709
1840
|
] })
|
|
@@ -1713,22 +1844,22 @@ function FeesManager({
|
|
|
1713
1844
|
] })
|
|
1714
1845
|
] })
|
|
1715
1846
|
] }) }),
|
|
1716
|
-
parseError && /* @__PURE__ */
|
|
1717
|
-
table && /* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1847
|
+
parseError && /* @__PURE__ */ jsx6(Alert, { severity: "error", children: parseError }),
|
|
1848
|
+
table && /* @__PURE__ */ jsxs6(Card, { inert: saving, "aria-busy": saving, sx: { minWidth: 0, opacity: saving ? 0.65 : 1 }, children: [
|
|
1849
|
+
/* @__PURE__ */ jsxs6(Stack2, { direction: { xs: "column", sm: "row" }, spacing: 2, justifyContent: "space-between", alignItems: { sm: "center" }, sx: { px: { xs: 2.5, md: 3 }, py: 2.5 }, children: [
|
|
1850
|
+
/* @__PURE__ */ jsxs6(Stack2, { spacing: 0.5, children: [
|
|
1851
|
+
/* @__PURE__ */ jsx6(Typography2, { variant: "subtitle1", children: "D\u1EEF li\u1EC7u ph\xED & k\xFD qu\u1EF9" }),
|
|
1852
|
+
/* @__PURE__ */ jsx6(Typography2, { 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." })
|
|
1722
1853
|
] }),
|
|
1723
|
-
/* @__PURE__ */
|
|
1724
|
-
/* @__PURE__ */
|
|
1725
|
-
/* @__PURE__ */
|
|
1854
|
+
/* @__PURE__ */ jsxs6(Stack2, { direction: "row", spacing: 1, flexShrink: 0, children: [
|
|
1855
|
+
/* @__PURE__ */ jsx6(Chip, { size: "small", variant: "outlined", label: `${table.rows.length} d\xF2ng` }),
|
|
1856
|
+
/* @__PURE__ */ jsx6(Chip, { size: "small", variant: "outlined", label: `${table.columns.length} c\u1ED9t` })
|
|
1726
1857
|
] })
|
|
1727
1858
|
] }),
|
|
1728
|
-
/* @__PURE__ */
|
|
1729
|
-
/* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
1859
|
+
/* @__PURE__ */ jsx6(Divider, {}),
|
|
1860
|
+
/* @__PURE__ */ jsxs6(Box2, { sx: { p: { xs: 2.5, md: 3 }, minWidth: 0 }, children: [
|
|
1861
|
+
/* @__PURE__ */ jsx6(Typography2, { 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." }),
|
|
1862
|
+
/* @__PURE__ */ jsx6(FeesTable, { value: table, language, editable: canWrite, onChange: canWrite && !saving ? onChange : void 0 }, key)
|
|
1732
1863
|
] })
|
|
1733
1864
|
] })
|
|
1734
1865
|
] })
|