@enyxs/wikex-components 0.11.39 → 0.11.44
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/fees-model.d.mts +1 -0
- package/dist/fees-model.d.ts +1 -0
- package/dist/fees-model.js +7 -4
- package/dist/fees-model.js.map +1 -1
- package/dist/fees-model.mjs +7 -4
- package/dist/fees-model.mjs.map +1 -1
- package/dist/{fees-table-BxHiMpdc.d.mts → fees-table-BeGo7_0N.d.mts} +1 -1
- package/dist/{fees-table-i7g0SHgV.d.ts → fees-table-DdbbVv6r.d.ts} +1 -1
- package/dist/fees.d.mts +4 -2
- package/dist/fees.d.ts +4 -2
- package/dist/fees.js +346 -254
- package/dist/fees.js.map +1 -1
- package/dist/fees.mjs +348 -256
- 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 +306 -195
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +330 -219
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5860,7 +5860,7 @@ function PartnerPage({ content = {}, ...props }) {
|
|
|
5860
5860
|
}
|
|
5861
5861
|
|
|
5862
5862
|
// src/wikex/original-commodity-blocks.tsx
|
|
5863
|
-
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect4, useMemo as
|
|
5863
|
+
import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect4, useMemo as useMemo10, useRef as useRef13 } from "react";
|
|
5864
5864
|
import { usePathname as usePathname3 } from "next/navigation.js";
|
|
5865
5865
|
import { createInstance } from "i18next";
|
|
5866
5866
|
import { I18nextProvider, initReactI18next } from "react-i18next";
|
|
@@ -9784,7 +9784,7 @@ import { useTranslation as useTranslation4 } from "react-i18next";
|
|
|
9784
9784
|
|
|
9785
9785
|
// src/wikex/fees-table.tsx
|
|
9786
9786
|
import { jsx as _jsx3, jsxs as _jsxs3 } from "react/jsx-runtime";
|
|
9787
|
-
import { useId, useLayoutEffect as useLayoutEffect2, useRef as useRef7, useState as useState9 } from "react";
|
|
9787
|
+
import { memo, useCallback, useDeferredValue, useId, useLayoutEffect as useLayoutEffect2, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
|
|
9788
9788
|
import styled14, { ThemeProvider } from "styled-components";
|
|
9789
9789
|
import TextField4 from "@mui/material/TextField";
|
|
9790
9790
|
import Dialog2 from "@mui/material/Dialog";
|
|
@@ -9798,6 +9798,72 @@ import MenuItem4 from "@mui/material/MenuItem";
|
|
|
9798
9798
|
import Checkbox2 from "@mui/material/Checkbox";
|
|
9799
9799
|
import Collapse from "@mui/material/Collapse";
|
|
9800
9800
|
|
|
9801
|
+
// src/wikex/fees-cell-layout.ts
|
|
9802
|
+
var queues = /* @__PURE__ */ new WeakMap();
|
|
9803
|
+
function enqueue(element, queue) {
|
|
9804
|
+
queue.pending.add(element);
|
|
9805
|
+
if (queue.frame) return;
|
|
9806
|
+
const view = element.ownerDocument.defaultView;
|
|
9807
|
+
queue.frame = view.requestAnimationFrame(() => {
|
|
9808
|
+
queue.frame = 0;
|
|
9809
|
+
const cells = [...queue.pending].filter((cell) => cell.isConnected);
|
|
9810
|
+
queue.pending.clear();
|
|
9811
|
+
for (const cell of cells) cell.style.height = "0px";
|
|
9812
|
+
const heights = cells.map((cell) => {
|
|
9813
|
+
const style = view.getComputedStyle(cell);
|
|
9814
|
+
return cell.scrollHeight + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
|
9815
|
+
});
|
|
9816
|
+
cells.forEach((cell, index) => {
|
|
9817
|
+
cell.style.height = `${heights[index]}px`;
|
|
9818
|
+
});
|
|
9819
|
+
});
|
|
9820
|
+
}
|
|
9821
|
+
function observeFeesCell(element) {
|
|
9822
|
+
const document2 = element.ownerDocument;
|
|
9823
|
+
const view = document2.defaultView;
|
|
9824
|
+
let queue = queues.get(document2);
|
|
9825
|
+
if (!queue) {
|
|
9826
|
+
const current2 = {
|
|
9827
|
+
elements: /* @__PURE__ */ new Map(),
|
|
9828
|
+
pending: /* @__PURE__ */ new Set(),
|
|
9829
|
+
frame: 0,
|
|
9830
|
+
observer: new view.ResizeObserver((entries) => {
|
|
9831
|
+
for (const { target, contentRect } of entries) {
|
|
9832
|
+
const cell = target;
|
|
9833
|
+
if (current2.elements.get(cell) !== contentRect.width) {
|
|
9834
|
+
current2.elements.set(cell, contentRect.width);
|
|
9835
|
+
enqueue(cell, current2);
|
|
9836
|
+
}
|
|
9837
|
+
}
|
|
9838
|
+
})
|
|
9839
|
+
};
|
|
9840
|
+
queue = current2;
|
|
9841
|
+
queues.set(document2, current2);
|
|
9842
|
+
void document2.fonts.ready.then(() => {
|
|
9843
|
+
for (const cell of current2.elements.keys()) enqueue(cell, current2);
|
|
9844
|
+
});
|
|
9845
|
+
}
|
|
9846
|
+
queue.elements.set(element, -1);
|
|
9847
|
+
queue.observer.observe(element);
|
|
9848
|
+
enqueue(element, queue);
|
|
9849
|
+
const current = queue;
|
|
9850
|
+
return () => {
|
|
9851
|
+
current.observer.unobserve(element);
|
|
9852
|
+
current.elements.delete(element);
|
|
9853
|
+
current.pending.delete(element);
|
|
9854
|
+
if (!current.elements.size) {
|
|
9855
|
+
current.observer.disconnect();
|
|
9856
|
+
if (current.frame) view.cancelAnimationFrame(current.frame);
|
|
9857
|
+
current.frame = 0;
|
|
9858
|
+
queues.delete(document2);
|
|
9859
|
+
}
|
|
9860
|
+
};
|
|
9861
|
+
}
|
|
9862
|
+
function scheduleFeesCell(element) {
|
|
9863
|
+
const queue = queues.get(element.ownerDocument);
|
|
9864
|
+
if (queue) enqueue(element, queue);
|
|
9865
|
+
}
|
|
9866
|
+
|
|
9801
9867
|
// src/wikex/fees-typography-controls.tsx
|
|
9802
9868
|
import { useEffect as useEffect8, useRef as useRef5, useState as useState8 } from "react";
|
|
9803
9869
|
import { Box as Box6, Button as Button7, MenuItem as MenuItem2, Stack as Stack4, TextField as TextField2, Typography as Typography4 } from "@mui/material";
|
|
@@ -9846,12 +9912,14 @@ var FEES_DEFAULT_API_FIELDS = {
|
|
|
9846
9912
|
function feesColumnApiField(column) {
|
|
9847
9913
|
return column.apiField ?? FEES_DEFAULT_API_FIELDS[column.key] ?? "";
|
|
9848
9914
|
}
|
|
9915
|
+
var feesNumberFormats = { vi: new Intl.NumberFormat("vi-VN", { maximumFractionDigits: 8 }), en: new Intl.NumberFormat("en-US", { maximumFractionDigits: 8 }) };
|
|
9916
|
+
var numericFeeFields = new Set(FEES_COMMODITY_FIELDS.filter((field) => field.numeric).map((field) => field.key));
|
|
9849
9917
|
function formatFeesApiValue(value4, field, language) {
|
|
9850
9918
|
if (value4 === null || value4 === void 0 || typeof value4 === "string" && !value4.trim()) return " - - ";
|
|
9851
|
-
if (
|
|
9919
|
+
if (numericFeeFields.has(field)) {
|
|
9852
9920
|
const number = typeof value4 === "number" ? value4 : Number(value4);
|
|
9853
9921
|
if (!Number.isFinite(number)) return " - - ";
|
|
9854
|
-
return number === 0 ? "0" :
|
|
9922
|
+
return number === 0 ? "0" : feesNumberFormats[language].format(number);
|
|
9855
9923
|
}
|
|
9856
9924
|
return String(value4);
|
|
9857
9925
|
}
|
|
@@ -9994,10 +10062,11 @@ function validateFeesTableValue(value4, allowBackup) {
|
|
|
9994
10062
|
if (value4.dataSource !== void 0 && value4.dataSource !== "manual" && value4.dataSource !== "wikex-api") throw new Error("Ngu\u1ED3n d\u1EEF li\u1EC7u b\u1EA3ng ph\xED kh\xF4ng h\u1EE3p l\u1EC7.");
|
|
9995
10063
|
if (value4.lastSyncedAt !== void 0 && (typeof value4.lastSyncedAt !== "string" || !/^\d{4}-\d{2}-\d{2}T/.test(value4.lastSyncedAt) || !Number.isFinite(Date.parse(value4.lastSyncedAt)))) throw new Error("Th\u1EDDi \u0111i\u1EC3m \u0111\u1ED3ng b\u1ED9 b\u1EA3ng ph\xED kh\xF4ng h\u1EE3p l\u1EC7.");
|
|
9996
10064
|
if (value4.apiColumnsInitialized !== void 0 && typeof value4.apiColumnsInitialized !== "boolean") throw invalid();
|
|
9997
|
-
if (!allowBackup && (value4.manualTable !== void 0 || value4.dataSource !== void 0 || value4.lastSyncedAt !== void 0 || value4.apiColumnsInitialized !== void 0)) throw invalid();
|
|
10065
|
+
if (!allowBackup && (value4.manualTable !== void 0 || value4.apiTable !== void 0 || value4.dataSource !== void 0 || value4.lastSyncedAt !== void 0 || value4.apiColumnsInitialized !== void 0)) throw invalid();
|
|
9998
10066
|
const manualTable = value4.manualTable !== void 0 ? validateFeesTableValue(value4.manualTable, false) : void 0;
|
|
10067
|
+
const apiTable = value4.apiTable !== void 0 ? validateFeesTableValue(value4.apiTable, false) : void 0;
|
|
9999
10068
|
const typography = validateFeesTypography(value4.typography);
|
|
10000
|
-
return { columns, rows, ...manualTable ? { manualTable } : {}, ...value4.apiColumnsInitialized !== void 0 ? { apiColumnsInitialized: value4.apiColumnsInitialized } : {}, ...value4.dataSource !== void 0 ? { dataSource: value4.dataSource } : {}, ...value4.lastSyncedAt !== void 0 ? { lastSyncedAt: value4.lastSyncedAt } : {}, ...value4.tags !== void 0 ? { tags: [...value4.tags] } : {}, ...typography ? { typography } : {} };
|
|
10069
|
+
return { columns, rows, ...apiTable ? { apiTable } : {}, ...manualTable ? { manualTable } : {}, ...value4.apiColumnsInitialized !== void 0 ? { apiColumnsInitialized: value4.apiColumnsInitialized } : {}, ...value4.dataSource !== void 0 ? { dataSource: value4.dataSource } : {}, ...value4.lastSyncedAt !== void 0 ? { lastSyncedAt: value4.lastSyncedAt } : {}, ...value4.tags !== void 0 ? { tags: [...value4.tags] } : {}, ...typography ? { typography } : {} };
|
|
10001
10070
|
}
|
|
10002
10071
|
function parseFeesTable(value4, fallback) {
|
|
10003
10072
|
if (typeof value4 !== "string") return fallback;
|
|
@@ -11031,34 +11100,31 @@ var feesTheme = {
|
|
|
11031
11100
|
]))
|
|
11032
11101
|
};
|
|
11033
11102
|
var EditorActions = styled14.div.withConfig({
|
|
11034
|
-
componentId: "sc-
|
|
11103
|
+
componentId: "sc-98eefcb2-0"
|
|
11035
11104
|
})([
|
|
11036
|
-
`display:flex;flex-wrap:wrap;gap:
|
|
11105
|
+
`display:flex;flex-wrap:wrap;gap:6px;margin-top:12px;`
|
|
11037
11106
|
]);
|
|
11038
11107
|
var EditGroup = styled14.div.withConfig({
|
|
11039
|
-
componentId: "sc-
|
|
11108
|
+
componentId: "sc-98eefcb2-1"
|
|
11040
11109
|
})([
|
|
11041
11110
|
`display:flex;flex-direction:column;gap:6px;`
|
|
11042
11111
|
]);
|
|
11043
11112
|
var HeaderGroup = styled14(EditGroup).withConfig({
|
|
11044
|
-
componentId: "sc-
|
|
11113
|
+
componentId: "sc-98eefcb2-2"
|
|
11045
11114
|
})([
|
|
11046
11115
|
`gap:8px;`
|
|
11047
11116
|
]);
|
|
11048
11117
|
var HeaderTitle = styled14.div.withConfig({
|
|
11049
|
-
componentId: "sc-
|
|
11118
|
+
componentId: "sc-98eefcb2-3"
|
|
11050
11119
|
})([
|
|
11051
11120
|
`display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
|
|
11052
11121
|
]);
|
|
11053
|
-
var HeaderActions = styled14.div.withConfig({
|
|
11054
|
-
componentId: "sc-20fe3bfd-4"
|
|
11055
|
-
})([
|
|
11056
|
-
`display:flex;align-items:center;min-height:24px;`
|
|
11057
|
-
]);
|
|
11058
11122
|
var AlignedFeesTable = styled14(FeesAndMarginTable).withConfig({
|
|
11059
|
-
componentId: "sc-
|
|
11123
|
+
componentId: "sc-98eefcb2-4"
|
|
11060
11124
|
})([
|
|
11061
|
-
`&[data-editable] th{vertical-align:top;}
|
|
11125
|
+
`&[data-editable] th{vertical-align:top;}&&&[data-editable] thead > tr > th{font-size:`,
|
|
11126
|
+
`px;line-height:1.4;}&&&[data-editable] tbody > tr > td{font-size:`,
|
|
11127
|
+
`px;line-height:1.4;}--fees-row-background:`,
|
|
11062
11128
|
`;--fees-stripe-background:`,
|
|
11063
11129
|
`;--fees-text:`,
|
|
11064
11130
|
`;:root[data-theme="dark"] &{--fees-row-background:#39393d;--fees-stripe-background:`,
|
|
@@ -11081,7 +11147,7 @@ var AlignedFeesTable = styled14(FeesAndMarginTable).withConfig({
|
|
|
11081
11147
|
`px;line-height:`,
|
|
11082
11148
|
`;}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:`,
|
|
11083
11149
|
`;}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);}}}`
|
|
11084
|
-
], ({ 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) => `
|
|
11150
|
+
], ({ $typography }) => $typography?.thead?.fontSize ?? 12, ({ $typography }) => $typography?.tbody?.fontSize ?? 13, ({ 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) => `
|
|
11085
11151
|
th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
|
|
11086
11152
|
width: ${width}px;
|
|
11087
11153
|
min-width: ${width}px;
|
|
@@ -11089,14 +11155,14 @@ var AlignedFeesTable = styled14(FeesAndMarginTable).withConfig({
|
|
|
11089
11155
|
}
|
|
11090
11156
|
`).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);
|
|
11091
11157
|
var FeesCellContent = styled14.span.withConfig({
|
|
11092
|
-
componentId: "sc-
|
|
11158
|
+
componentId: "sc-98eefcb2-5"
|
|
11093
11159
|
})([
|
|
11094
11160
|
`display:block;text-align:`,
|
|
11095
11161
|
`;@media (max-width:767px){text-align:`,
|
|
11096
11162
|
`;}`
|
|
11097
11163
|
], ({ $align, $alignRight }) => $align ?? ($alignRight ? "right" : "left"), ({ $align }) => $align ?? "left");
|
|
11098
11164
|
var EditorButton = styled14.button.withConfig({
|
|
11099
|
-
componentId: "sc-
|
|
11165
|
+
componentId: "sc-98eefcb2-6"
|
|
11100
11166
|
})([
|
|
11101
11167
|
`padding:7px 12px;border:1px solid `,
|
|
11102
11168
|
`;border-radius:6px;background:`,
|
|
@@ -11105,17 +11171,17 @@ var EditorButton = styled14.button.withConfig({
|
|
|
11105
11171
|
`;}&:disabled{cursor:default;opacity:.4;}`
|
|
11106
11172
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
11107
11173
|
var OrderActions = styled14.div.withConfig({
|
|
11108
|
-
componentId: "sc-
|
|
11174
|
+
componentId: "sc-98eefcb2-7"
|
|
11109
11175
|
})([
|
|
11110
11176
|
`display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
|
|
11111
11177
|
]);
|
|
11112
11178
|
var PositionLabel = styled14.label.withConfig({
|
|
11113
|
-
componentId: "sc-
|
|
11179
|
+
componentId: "sc-98eefcb2-8"
|
|
11114
11180
|
})([
|
|
11115
11181
|
`display:inline-flex;align-items:center;gap:6px;font-size:12px;`
|
|
11116
11182
|
]);
|
|
11117
11183
|
var PositionInput = styled14.input.withConfig({
|
|
11118
|
-
componentId: "sc-
|
|
11184
|
+
componentId: "sc-98eefcb2-9"
|
|
11119
11185
|
})([
|
|
11120
11186
|
`width:56px;padding:5px;border:1px solid `,
|
|
11121
11187
|
`;border-radius:4px;background:`,
|
|
@@ -11124,18 +11190,18 @@ var PositionInput = styled14.input.withConfig({
|
|
|
11124
11190
|
`;}`
|
|
11125
11191
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
|
|
11126
11192
|
var ColumnRow = styled14.div.withConfig({
|
|
11127
|
-
componentId: "sc-
|
|
11193
|
+
componentId: "sc-98eefcb2-10"
|
|
11128
11194
|
})([
|
|
11129
11195
|
`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;}`
|
|
11130
11196
|
]);
|
|
11131
11197
|
var PaginationControls = styled14(FeesAndMarginPagination).withConfig({
|
|
11132
|
-
componentId: "sc-
|
|
11198
|
+
componentId: "sc-98eefcb2-11"
|
|
11133
11199
|
})([
|
|
11134
11200
|
`align-items:center;flex-wrap:wrap;gap:16px 24px;color:`,
|
|
11135
11201
|
`;`
|
|
11136
11202
|
], ({ theme }) => theme.colors.text.primary);
|
|
11137
11203
|
var PageSizeLabel = styled14.div.withConfig({
|
|
11138
|
-
componentId: "sc-
|
|
11204
|
+
componentId: "sc-98eefcb2-12"
|
|
11139
11205
|
})([
|
|
11140
11206
|
`display:inline-flex;align-items:center;gap:8px;color:`,
|
|
11141
11207
|
`;font:inherit;font-size:13px;`
|
|
@@ -11163,60 +11229,58 @@ function Position({ value: value4, max, label, onMove }) {
|
|
|
11163
11229
|
});
|
|
11164
11230
|
}
|
|
11165
11231
|
var DeleteButton = styled14(EditorButton).withConfig({
|
|
11166
|
-
componentId: "sc-
|
|
11232
|
+
componentId: "sc-98eefcb2-13"
|
|
11167
11233
|
})([
|
|
11168
11234
|
`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;}`
|
|
11169
11235
|
]);
|
|
11170
11236
|
var CellEditorInput = styled14.textarea.withConfig({
|
|
11171
|
-
componentId: "sc-
|
|
11237
|
+
componentId: "sc-98eefcb2-14"
|
|
11172
11238
|
})([
|
|
11173
11239
|
`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:`,
|
|
11174
11240
|
`;}&:focus{outline:1px solid `,
|
|
11175
11241
|
`;}&[data-fees-column-selected="true"]{border-color:`,
|
|
11176
11242
|
`;}`
|
|
11177
11243
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
11178
|
-
function CellEditor({ onInput, ...props }) {
|
|
11244
|
+
function CellEditor({ onInput, layoutKey, ...props }) {
|
|
11179
11245
|
const ref = useRef7(null);
|
|
11180
|
-
|
|
11181
|
-
const element = ref.current;
|
|
11182
|
-
if (!element) return;
|
|
11183
|
-
element.style.height = "0px";
|
|
11184
|
-
const style = element.ownerDocument.defaultView.getComputedStyle(element);
|
|
11185
|
-
const border = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
|
11186
|
-
element.style.height = `${element.scrollHeight + border}px`;
|
|
11187
|
-
};
|
|
11188
|
-
useLayoutEffect2(fit);
|
|
11246
|
+
useLayoutEffect2(() => ref.current ? observeFeesCell(ref.current) : void 0, []);
|
|
11189
11247
|
useLayoutEffect2(() => {
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
if (nextWidth !== width) {
|
|
11196
|
-
width = nextWidth;
|
|
11197
|
-
fit();
|
|
11198
|
-
}
|
|
11199
|
-
});
|
|
11200
|
-
observer.observe(element);
|
|
11201
|
-
let active = true;
|
|
11202
|
-
void element.ownerDocument.fonts.ready.then(() => {
|
|
11203
|
-
if (active) fit();
|
|
11204
|
-
});
|
|
11205
|
-
return () => {
|
|
11206
|
-
active = false;
|
|
11207
|
-
observer.disconnect();
|
|
11208
|
-
};
|
|
11209
|
-
}, []);
|
|
11248
|
+
if (ref.current) scheduleFeesCell(ref.current);
|
|
11249
|
+
}, [
|
|
11250
|
+
props.value,
|
|
11251
|
+
layoutKey
|
|
11252
|
+
]);
|
|
11210
11253
|
return /* @__PURE__ */ _jsx3(CellEditorInput, {
|
|
11211
11254
|
...props,
|
|
11212
11255
|
ref,
|
|
11213
11256
|
rows: 1,
|
|
11214
11257
|
onInput: (event) => {
|
|
11215
|
-
|
|
11258
|
+
scheduleFeesCell(event.currentTarget);
|
|
11216
11259
|
onInput?.(event);
|
|
11217
11260
|
}
|
|
11218
11261
|
});
|
|
11219
11262
|
}
|
|
11263
|
+
var ManualCell = /* @__PURE__ */ memo(function ManualCell2({ rowId, columnKey, text: text2, label, align, selected, layoutKey, onEdit }) {
|
|
11264
|
+
return /* @__PURE__ */ _jsx3(CellEditor, {
|
|
11265
|
+
value: text2,
|
|
11266
|
+
"aria-label": label,
|
|
11267
|
+
style: {
|
|
11268
|
+
textAlign: align ?? "left"
|
|
11269
|
+
},
|
|
11270
|
+
layoutKey,
|
|
11271
|
+
"data-fees-column-selected": selected,
|
|
11272
|
+
onChange: (event) => onEdit(rowId, columnKey, event.target.value)
|
|
11273
|
+
});
|
|
11274
|
+
});
|
|
11275
|
+
var ReadOnlyCell = /* @__PURE__ */ memo(function ReadOnlyCell2({ text: text2, label, align, alignRight, selected }) {
|
|
11276
|
+
return /* @__PURE__ */ _jsx3(FeesCellContent, {
|
|
11277
|
+
"aria-label": label,
|
|
11278
|
+
$align: align,
|
|
11279
|
+
$alignRight: alignRight,
|
|
11280
|
+
"data-fees-column-selected": selected || void 0,
|
|
11281
|
+
children: text2
|
|
11282
|
+
});
|
|
11283
|
+
});
|
|
11220
11284
|
function RowTagSelect({ selected, options, onChange, disabled = false }) {
|
|
11221
11285
|
const selectRoot = useRef7(null);
|
|
11222
11286
|
return /* @__PURE__ */ _jsx3(EditGroup, {
|
|
@@ -11265,6 +11329,46 @@ function RowTagSelect({ selected, options, onChange, disabled = false }) {
|
|
|
11265
11329
|
})
|
|
11266
11330
|
});
|
|
11267
11331
|
}
|
|
11332
|
+
var ManualRowControls = /* @__PURE__ */ memo(function ManualRowControls2({ id, name, tags, options, index, count, onTags, onMove, onDelete }) {
|
|
11333
|
+
return /* @__PURE__ */ _jsxs3(EditGroup, {
|
|
11334
|
+
children: [
|
|
11335
|
+
/* @__PURE__ */ _jsx3(RowTagSelect, {
|
|
11336
|
+
selected: tags,
|
|
11337
|
+
options,
|
|
11338
|
+
onChange: (next) => onTags(id, next)
|
|
11339
|
+
}),
|
|
11340
|
+
/* @__PURE__ */ _jsxs3(OrderActions, {
|
|
11341
|
+
children: [
|
|
11342
|
+
/* @__PURE__ */ _jsx3(Position, {
|
|
11343
|
+
value: index,
|
|
11344
|
+
max: count,
|
|
11345
|
+
label: `V\u1ECB tr\xED d\xF2ng ${name}`,
|
|
11346
|
+
onMove: (to) => onMove(id, to)
|
|
11347
|
+
}),
|
|
11348
|
+
/* @__PURE__ */ _jsx3(EditorButton, {
|
|
11349
|
+
type: "button",
|
|
11350
|
+
"aria-label": `\u0110\u01B0a d\xF2ng ${name} l\xEAn`,
|
|
11351
|
+
disabled: index === 0,
|
|
11352
|
+
onClick: () => onMove(id, index - 1),
|
|
11353
|
+
children: "\u2191"
|
|
11354
|
+
}),
|
|
11355
|
+
/* @__PURE__ */ _jsx3(EditorButton, {
|
|
11356
|
+
type: "button",
|
|
11357
|
+
"aria-label": `\u0110\u01B0a d\xF2ng ${name} xu\u1ED1ng`,
|
|
11358
|
+
disabled: index === count - 1,
|
|
11359
|
+
onClick: () => onMove(id, index + 1),
|
|
11360
|
+
children: "\u2193"
|
|
11361
|
+
})
|
|
11362
|
+
]
|
|
11363
|
+
}),
|
|
11364
|
+
/* @__PURE__ */ _jsx3(DeleteButton, {
|
|
11365
|
+
type: "button",
|
|
11366
|
+
onClick: () => onDelete(id, name || "H\xE0ng m\u1EDBi"),
|
|
11367
|
+
children: "X\xF3a h\xE0ng"
|
|
11368
|
+
})
|
|
11369
|
+
]
|
|
11370
|
+
});
|
|
11371
|
+
});
|
|
11268
11372
|
var columnWidths = {
|
|
11269
11373
|
name: 100,
|
|
11270
11374
|
code: 96,
|
|
@@ -11305,8 +11409,9 @@ var rightAlignedColumns = /* @__PURE__ */ new Set([
|
|
|
11305
11409
|
"priceUnit",
|
|
11306
11410
|
"unit"
|
|
11307
11411
|
]);
|
|
11308
|
-
|
|
11412
|
+
var FeesTable = /* @__PURE__ */ memo(function FeesTable2({ value: value4, editable = false, onChange, labels: labels2, size = "md", tagOrder = [], language = "vi" }) {
|
|
11309
11413
|
const [search, setSearch] = useState9("");
|
|
11414
|
+
const deferredSearch = useDeferredValue(search);
|
|
11310
11415
|
const [tag, setTag] = useState9("");
|
|
11311
11416
|
const [page, setPage] = useState9(1);
|
|
11312
11417
|
const [pageSize, setPageSize] = useState9(FEES_PAGE_SIZE);
|
|
@@ -11315,11 +11420,38 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11315
11420
|
const [columnTitle, setColumnTitle] = useState9("");
|
|
11316
11421
|
const [columnField, setColumnField] = useState9("");
|
|
11317
11422
|
const [typographyOpen, setTypographyOpen] = useState9(false);
|
|
11423
|
+
const [alignmentOpen, setAlignmentOpen] = useState9(false);
|
|
11318
11424
|
const [selectedColumnKey, setSelectedColumnKey] = useState9("");
|
|
11319
11425
|
const english = language === "en";
|
|
11320
11426
|
const canEdit = editable && Boolean(onChange);
|
|
11321
11427
|
const apiManaged = value4.dataSource === "wikex-api";
|
|
11322
|
-
const visibleColumns = value4.columns.filter((column) => !column.hidden)
|
|
11428
|
+
const visibleColumns = useMemo6(() => value4.columns.filter((column) => !column.hidden), [
|
|
11429
|
+
value4.columns
|
|
11430
|
+
]);
|
|
11431
|
+
const latest = useRef7({
|
|
11432
|
+
value: value4,
|
|
11433
|
+
onChange
|
|
11434
|
+
});
|
|
11435
|
+
latest.current = {
|
|
11436
|
+
value: value4,
|
|
11437
|
+
onChange
|
|
11438
|
+
};
|
|
11439
|
+
const editCell = useCallback((rowId, key, text2) => {
|
|
11440
|
+
const { value: value5, onChange: onChange2 } = latest.current;
|
|
11441
|
+
if (value5.dataSource === "wikex-api") return;
|
|
11442
|
+
onChange2?.({
|
|
11443
|
+
...value5,
|
|
11444
|
+
rows: value5.rows.map((row) => row.id === rowId ? {
|
|
11445
|
+
...row,
|
|
11446
|
+
cells: {
|
|
11447
|
+
...row.cells,
|
|
11448
|
+
[key]: text2
|
|
11449
|
+
}
|
|
11450
|
+
} : row)
|
|
11451
|
+
});
|
|
11452
|
+
}, []);
|
|
11453
|
+
const headerLayout = JSON.stringify(value4.typography?.thead ?? {});
|
|
11454
|
+
const bodyLayout = JSON.stringify(value4.typography?.tbody ?? {});
|
|
11323
11455
|
const tableRoot = useRef7(null);
|
|
11324
11456
|
useLayoutEffect2(() => {
|
|
11325
11457
|
const root = tableRoot.current;
|
|
@@ -11376,10 +11508,19 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11376
11508
|
...value4.rows.flatMap((row) => row.tags)
|
|
11377
11509
|
])
|
|
11378
11510
|
].filter(Boolean);
|
|
11379
|
-
const
|
|
11511
|
+
const orderedTags = [
|
|
11380
11512
|
...tagOrder.filter((item) => rowTags.includes(item)),
|
|
11381
11513
|
...rowTags.filter((item) => !tagOrder.includes(item))
|
|
11382
11514
|
];
|
|
11515
|
+
const stableTags = useRef7([]);
|
|
11516
|
+
if (orderedTags.length !== stableTags.current.length || orderedTags.some((tag2, index) => tag2 !== stableTags.current[index])) stableTags.current = orderedTags;
|
|
11517
|
+
const tags = stableTags.current;
|
|
11518
|
+
const rowPositions = useMemo6(() => new Map(value4.rows.map((row, index) => [
|
|
11519
|
+
row.id,
|
|
11520
|
+
index
|
|
11521
|
+
])), [
|
|
11522
|
+
value4.rows
|
|
11523
|
+
]);
|
|
11383
11524
|
const newTagName = tagDraft.trim().replace(/\s+/g, " ");
|
|
11384
11525
|
const duplicateTag = tags.some((item) => item.toLocaleLowerCase("vi") === newTagName.toLocaleLowerCase("vi"));
|
|
11385
11526
|
const createTag = () => {
|
|
@@ -11395,9 +11536,21 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11395
11536
|
setTagDraft("");
|
|
11396
11537
|
};
|
|
11397
11538
|
const activeTag = tags.includes(tag) ? tag : "";
|
|
11398
|
-
const filtered = filterFeesRows(value4,
|
|
11399
|
-
|
|
11400
|
-
|
|
11539
|
+
const filtered = useMemo6(() => filterFeesRows(value4, deferredSearch, activeTag), [
|
|
11540
|
+
value4,
|
|
11541
|
+
deferredSearch,
|
|
11542
|
+
activeTag
|
|
11543
|
+
]);
|
|
11544
|
+
const displayedRows = useMemo6(() => canEdit ? filtered : sortFeesRowsByName(filtered, language), [
|
|
11545
|
+
canEdit,
|
|
11546
|
+
filtered,
|
|
11547
|
+
language
|
|
11548
|
+
]);
|
|
11549
|
+
const pagination = useMemo6(() => paginateFeesRows(displayedRows, page, pageSize), [
|
|
11550
|
+
displayedRows,
|
|
11551
|
+
page,
|
|
11552
|
+
pageSize
|
|
11553
|
+
]);
|
|
11401
11554
|
const selectedColumn = value4.columns.find((column) => column.key === selectedColumnKey);
|
|
11402
11555
|
useLayoutEffect2(() => {
|
|
11403
11556
|
if (selectedColumnKey && !selectedColumn) setSelectedColumnKey("");
|
|
@@ -11419,6 +11572,25 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11419
11572
|
const index = rows.filter((row) => filteredIds.has(row.id)).findIndex((row) => row.id === id);
|
|
11420
11573
|
setPage(pageSize === -1 ? 1 : Math.floor(Math.max(0, index) / pageSize) + 1);
|
|
11421
11574
|
};
|
|
11575
|
+
const moveRowRef = useRef7(moveRow);
|
|
11576
|
+
moveRowRef.current = moveRow;
|
|
11577
|
+
const moveManualRow = useCallback((id, position2) => moveRowRef.current(id, position2), []);
|
|
11578
|
+
const deleteManualRow = useCallback((id, name) => setDeleteTarget({
|
|
11579
|
+
kind: "row",
|
|
11580
|
+
id,
|
|
11581
|
+
label: name
|
|
11582
|
+
}), []);
|
|
11583
|
+
const tagManualRow = useCallback((id, tags2) => {
|
|
11584
|
+
const { value: value5, onChange: onChange2 } = latest.current;
|
|
11585
|
+
if (value5.dataSource === "wikex-api") return;
|
|
11586
|
+
onChange2?.({
|
|
11587
|
+
...value5,
|
|
11588
|
+
rows: value5.rows.map((row) => row.id === id ? {
|
|
11589
|
+
...row,
|
|
11590
|
+
tags: tags2
|
|
11591
|
+
} : row)
|
|
11592
|
+
});
|
|
11593
|
+
}, []);
|
|
11422
11594
|
const addColumn = () => {
|
|
11423
11595
|
if (apiManaged) {
|
|
11424
11596
|
setColumnTitle("");
|
|
@@ -11462,140 +11634,70 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11462
11634
|
onChange?.(setFeesColumnApiField(next, key, columnField, language));
|
|
11463
11635
|
setAddColumnOpen(false);
|
|
11464
11636
|
};
|
|
11465
|
-
const changeRow = (id, patch) => {
|
|
11466
|
-
if (apiManaged) return;
|
|
11467
|
-
onChange?.({
|
|
11468
|
-
...value4,
|
|
11469
|
-
rows: value4.rows.map((row) => row.id === id ? {
|
|
11470
|
-
...row,
|
|
11471
|
-
...patch
|
|
11472
|
-
} : row)
|
|
11473
|
-
});
|
|
11474
|
-
};
|
|
11475
11637
|
const columns = visibleColumns.map((column, index) => ({
|
|
11476
11638
|
key: column.key,
|
|
11477
11639
|
width: canEdit ? columnWidths[column.key] ?? 140 : index === 0 ? 178 : 170,
|
|
11478
11640
|
fixed: index === 0 ? "left" : void 0,
|
|
11479
|
-
title: canEdit ? /* @__PURE__ */
|
|
11480
|
-
children:
|
|
11481
|
-
/* @__PURE__ */ _jsx3(
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
})
|
|
11497
|
-
})
|
|
11498
|
-
}),
|
|
11499
|
-
/* @__PURE__ */ _jsx3(HeaderActions, {
|
|
11500
|
-
children: column.key !== "name" && /* @__PURE__ */ _jsx3(DeleteButton, {
|
|
11501
|
-
type: "button",
|
|
11502
|
-
onClick: () => {
|
|
11503
|
-
setDeleteTarget({
|
|
11504
|
-
kind: "column",
|
|
11505
|
-
id: column.key,
|
|
11506
|
-
label: column.title
|
|
11507
|
-
});
|
|
11508
|
-
},
|
|
11509
|
-
children: "X\xF3a c\u1ED9t"
|
|
11641
|
+
title: canEdit ? /* @__PURE__ */ _jsx3(HeaderGroup, {
|
|
11642
|
+
children: /* @__PURE__ */ _jsx3(HeaderTitle, {
|
|
11643
|
+
children: /* @__PURE__ */ _jsx3(CellEditor, {
|
|
11644
|
+
rows: 2,
|
|
11645
|
+
layoutKey: headerLayout,
|
|
11646
|
+
value: column.title,
|
|
11647
|
+
"aria-label": `Ti\xEAu \u0111\u1EC1 c\u1ED9t ${index + 1}`,
|
|
11648
|
+
style: {
|
|
11649
|
+
textAlign: column.textAlign ?? value4.typography?.thead?.textAlign ?? "left"
|
|
11650
|
+
},
|
|
11651
|
+
"data-fees-column-selected": selectedColumnKey === column.key,
|
|
11652
|
+
onChange: (event) => onChange?.({
|
|
11653
|
+
...value4,
|
|
11654
|
+
columns: value4.columns.map((item) => item.key === column.key ? {
|
|
11655
|
+
...item,
|
|
11656
|
+
title: event.target.value
|
|
11657
|
+
} : item)
|
|
11510
11658
|
})
|
|
11511
11659
|
})
|
|
11512
|
-
|
|
11660
|
+
})
|
|
11513
11661
|
}) : /* @__PURE__ */ _jsx3(FeesCellContent, {
|
|
11514
11662
|
$align: column.textAlign ?? value4.typography?.thead?.textAlign,
|
|
11515
11663
|
$alignRight: rightAlignedColumns.has(column.key),
|
|
11516
11664
|
children: column.title
|
|
11517
11665
|
}),
|
|
11518
|
-
render: (_unused, row) => canEdit ? /* @__PURE__ */ _jsx3(
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
});
|
|
11534
|
-
}
|
|
11535
|
-
}) : /* @__PURE__ */ _jsx3(FeesCellContent, {
|
|
11536
|
-
$align: column.textAlign ?? row.cellAlignments?.[column.key] ?? value4.typography?.tbody?.textAlign,
|
|
11537
|
-
$alignRight: rightAlignedColumns.has(column.key),
|
|
11538
|
-
children: row.cells[column.key] || (apiManaged ? " - - " : "")
|
|
11666
|
+
render: (_unused, row) => canEdit && !apiManaged ? /* @__PURE__ */ _jsx3(ManualCell, {
|
|
11667
|
+
rowId: row.id,
|
|
11668
|
+
columnKey: column.key,
|
|
11669
|
+
text: row.cells[column.key] ?? "",
|
|
11670
|
+
label: `${column.title} \u2014 ${row.cells.name || "H\xE0ng m\u1EDBi"}`,
|
|
11671
|
+
align: column.textAlign ?? row.cellAlignments?.[column.key] ?? value4.typography?.tbody?.textAlign,
|
|
11672
|
+
selected: selectedColumnKey === column.key,
|
|
11673
|
+
layoutKey: bodyLayout,
|
|
11674
|
+
onEdit: editCell
|
|
11675
|
+
}) : /* @__PURE__ */ _jsx3(ReadOnlyCell, {
|
|
11676
|
+
text: row.cells[column.key] || (apiManaged ? " - - " : ""),
|
|
11677
|
+
label: canEdit ? `${column.title} \u2014 ${row.cells.name || "H\xE0ng m\u1EDBi"}` : void 0,
|
|
11678
|
+
align: column.textAlign ?? row.cellAlignments?.[column.key] ?? value4.typography?.tbody?.textAlign,
|
|
11679
|
+
alignRight: rightAlignedColumns.has(column.key),
|
|
11680
|
+
selected: canEdit && selectedColumnKey === column.key
|
|
11539
11681
|
})
|
|
11540
11682
|
}));
|
|
11541
|
-
if (canEdit) columns.push({
|
|
11683
|
+
if (canEdit && !apiManaged) columns.push({
|
|
11542
11684
|
key: "__tags",
|
|
11543
|
-
title: /* @__PURE__ */
|
|
11544
|
-
children:
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
}),
|
|
11548
|
-
/* @__PURE__ */ _jsx3(HeaderActions, {})
|
|
11549
|
-
]
|
|
11685
|
+
title: /* @__PURE__ */ _jsx3(HeaderGroup, {
|
|
11686
|
+
children: /* @__PURE__ */ _jsx3(HeaderTitle, {
|
|
11687
|
+
children: "Tag & th\u1EE9 t\u1EF1 d\xF2ng"
|
|
11688
|
+
})
|
|
11550
11689
|
}),
|
|
11551
11690
|
width: 300,
|
|
11552
|
-
render: (_unused, row) => /* @__PURE__ */
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
/* @__PURE__ */ _jsxs3(OrderActions, {
|
|
11563
|
-
children: [
|
|
11564
|
-
/* @__PURE__ */ _jsx3(Position, {
|
|
11565
|
-
value: value4.rows.findIndex((item) => item.id === row.id),
|
|
11566
|
-
max: value4.rows.length,
|
|
11567
|
-
label: `V\u1ECB tr\xED d\xF2ng ${row.cells.name}`,
|
|
11568
|
-
onMove: (to) => moveRow(row.id, to)
|
|
11569
|
-
}),
|
|
11570
|
-
/* @__PURE__ */ _jsx3(EditorButton, {
|
|
11571
|
-
type: "button",
|
|
11572
|
-
"aria-label": `\u0110\u01B0a d\xF2ng ${row.cells.name} l\xEAn`,
|
|
11573
|
-
disabled: value4.rows[0]?.id === row.id,
|
|
11574
|
-
onClick: () => moveRow(row.id, value4.rows.findIndex((item) => item.id === row.id) - 1),
|
|
11575
|
-
children: "\u2191"
|
|
11576
|
-
}),
|
|
11577
|
-
/* @__PURE__ */ _jsx3(EditorButton, {
|
|
11578
|
-
type: "button",
|
|
11579
|
-
"aria-label": `\u0110\u01B0a d\xF2ng ${row.cells.name} xu\u1ED1ng`,
|
|
11580
|
-
disabled: value4.rows[value4.rows.length - 1]?.id === row.id,
|
|
11581
|
-
onClick: () => moveRow(row.id, value4.rows.findIndex((item) => item.id === row.id) + 1),
|
|
11582
|
-
children: "\u2193"
|
|
11583
|
-
})
|
|
11584
|
-
]
|
|
11585
|
-
}),
|
|
11586
|
-
/* @__PURE__ */ _jsx3(DeleteButton, {
|
|
11587
|
-
type: "button",
|
|
11588
|
-
disabled: apiManaged,
|
|
11589
|
-
onClick: () => {
|
|
11590
|
-
setDeleteTarget({
|
|
11591
|
-
kind: "row",
|
|
11592
|
-
id: row.id,
|
|
11593
|
-
label: row.cells.name || "H\xE0ng m\u1EDBi"
|
|
11594
|
-
});
|
|
11595
|
-
},
|
|
11596
|
-
children: "X\xF3a h\xE0ng"
|
|
11597
|
-
})
|
|
11598
|
-
]
|
|
11691
|
+
render: (_unused, row) => /* @__PURE__ */ _jsx3(ManualRowControls, {
|
|
11692
|
+
id: row.id,
|
|
11693
|
+
name: row.cells.name || "",
|
|
11694
|
+
tags: row.tags,
|
|
11695
|
+
options: tags,
|
|
11696
|
+
index: rowPositions.get(row.id) ?? 0,
|
|
11697
|
+
count: value4.rows.length,
|
|
11698
|
+
onTags: tagManualRow,
|
|
11699
|
+
onMove: moveManualRow,
|
|
11700
|
+
onDelete: deleteManualRow
|
|
11599
11701
|
})
|
|
11600
11702
|
});
|
|
11601
11703
|
return /* @__PURE__ */ _jsx3(ThemeProvider, {
|
|
@@ -11603,6 +11705,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11603
11705
|
children: /* @__PURE__ */ _jsxs3("div", {
|
|
11604
11706
|
ref: tableRoot,
|
|
11605
11707
|
"data-cms-table-editor": true,
|
|
11708
|
+
"data-editable": canEdit || void 0,
|
|
11606
11709
|
onClick: (event) => {
|
|
11607
11710
|
if (canEdit) event.stopPropagation();
|
|
11608
11711
|
},
|
|
@@ -11664,9 +11767,8 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11664
11767
|
},
|
|
11665
11768
|
children: english ? "Sort names A\u2013Z" : "S\u1EAFp x\u1EBFp t\xEAn A\u2013Z"
|
|
11666
11769
|
}),
|
|
11667
|
-
/* @__PURE__ */ _jsx3(EditorButton, {
|
|
11770
|
+
!apiManaged && /* @__PURE__ */ _jsx3(EditorButton, {
|
|
11668
11771
|
type: "button",
|
|
11669
|
-
disabled: apiManaged,
|
|
11670
11772
|
onClick: () => {
|
|
11671
11773
|
const row = {
|
|
11672
11774
|
id: crypto.randomUUID(),
|
|
@@ -11712,7 +11814,12 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11712
11814
|
}),
|
|
11713
11815
|
/* @__PURE__ */ _jsx3(EditorButton, {
|
|
11714
11816
|
type: "button",
|
|
11715
|
-
|
|
11817
|
+
"aria-expanded": alignmentOpen,
|
|
11818
|
+
onClick: () => setAlignmentOpen((open) => !open),
|
|
11819
|
+
children: english ? "Alignment" : "C\u0103n l\u1EC1"
|
|
11820
|
+
}),
|
|
11821
|
+
!apiManaged && /* @__PURE__ */ _jsx3(EditorButton, {
|
|
11822
|
+
type: "button",
|
|
11716
11823
|
onClick: () => {
|
|
11717
11824
|
setTagDraft("");
|
|
11718
11825
|
setCreateTagOpen(true);
|
|
@@ -11740,14 +11847,18 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11740
11847
|
})
|
|
11741
11848
|
})
|
|
11742
11849
|
}),
|
|
11743
|
-
canEdit && /* @__PURE__ */ _jsx3(
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11850
|
+
canEdit && /* @__PURE__ */ _jsx3(Collapse, {
|
|
11851
|
+
in: alignmentOpen,
|
|
11852
|
+
unmountOnExit: true,
|
|
11853
|
+
children: /* @__PURE__ */ _jsx3(FeesColumnAlignmentControls, {
|
|
11854
|
+
columns: value4.columns,
|
|
11855
|
+
columnKey: selectedColumnKey,
|
|
11856
|
+
english,
|
|
11857
|
+
onSelectColumn: setSelectedColumnKey,
|
|
11858
|
+
onChange: (textAlign) => {
|
|
11859
|
+
if (selectedColumn) onChange?.(setFeesColumnAlignment(value4, selectedColumn.key, textAlign));
|
|
11860
|
+
}
|
|
11861
|
+
})
|
|
11751
11862
|
}),
|
|
11752
11863
|
/* @__PURE__ */ _jsx3(AlignedFeesTable, {
|
|
11753
11864
|
$typography: value4.typography,
|
|
@@ -11761,7 +11872,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
11761
11872
|
size,
|
|
11762
11873
|
empty: labels2?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
|
|
11763
11874
|
scroll: {
|
|
11764
|
-
x: canEdit ? Math.max(
|
|
11875
|
+
x: canEdit ? Math.max(apiManaged ? 900 : 1100, columns.reduce((sum, column) => sum + (typeof column.width === "number" ? column.width : 140), 0)) : visibleColumns.length * 170 + 8
|
|
11765
11876
|
}
|
|
11766
11877
|
})
|
|
11767
11878
|
}),
|
|
@@ -12174,7 +12285,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
|
|
|
12174
12285
|
]
|
|
12175
12286
|
})
|
|
12176
12287
|
});
|
|
12177
|
-
}
|
|
12288
|
+
});
|
|
12178
12289
|
|
|
12179
12290
|
// src/commodity-original/app/bang-phi-ky-quy/FeesAndMarginContent.tsx
|
|
12180
12291
|
import { jsx as jsx38, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
@@ -12950,7 +13061,7 @@ function InformationHeroSection({
|
|
|
12950
13061
|
import styled21 from "styled-components";
|
|
12951
13062
|
|
|
12952
13063
|
// src/commodity-original/components/DateRangePicker/index.tsx
|
|
12953
|
-
import { useEffect as useEffect9, useMemo as
|
|
13064
|
+
import { useEffect as useEffect9, useMemo as useMemo7, useRef as useRef8, useState as useState11 } from "react";
|
|
12954
13065
|
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
12955
13066
|
import { Dialog as Dialog4 } from "radix-ui";
|
|
12956
13067
|
|
|
@@ -13202,7 +13313,7 @@ function DateRangePicker({
|
|
|
13202
13313
|
}).format(toDate(date)) : "";
|
|
13203
13314
|
const from = fromLabel ?? t("dateRangePicker.fromLabel");
|
|
13204
13315
|
const to = toLabel ?? t("dateRangePicker.toLabel");
|
|
13205
|
-
const calendarDays =
|
|
13316
|
+
const calendarDays = useMemo7(() => getMonthDays(month), [month]);
|
|
13206
13317
|
const duration = getDays(draft);
|
|
13207
13318
|
const weekdays = [
|
|
13208
13319
|
"monday",
|
|
@@ -14885,7 +14996,7 @@ function FeaturedArticles() {
|
|
|
14885
14996
|
|
|
14886
14997
|
// src/commodity-original/app/thong-tin-wikex/WikexInformationSections.tsx
|
|
14887
14998
|
import { jsx as _jsx5, jsxs as _jsxs5 } from "react/jsx-runtime";
|
|
14888
|
-
import { useMemo as
|
|
14999
|
+
import { useMemo as useMemo8, useState as useState15 } from "react";
|
|
14889
15000
|
import { useTranslation as useTranslation13 } from "react-i18next";
|
|
14890
15001
|
import styled28 from "styled-components";
|
|
14891
15002
|
|
|
@@ -14989,7 +15100,7 @@ function WikexInformationArticlesSection() {
|
|
|
14989
15100
|
id: category,
|
|
14990
15101
|
label: t(`wikexInformation.tabs.${category}`)
|
|
14991
15102
|
}));
|
|
14992
|
-
const filteredArticles =
|
|
15103
|
+
const filteredArticles = useMemo8(() => {
|
|
14993
15104
|
const normalizedSearch = search.trim().toLocaleLowerCase();
|
|
14994
15105
|
return articles.filter((article) => {
|
|
14995
15106
|
const matchesCategory = activeCategory === "latest" || article.category === activeCategory;
|
|
@@ -15147,7 +15258,7 @@ import { useTranslation as useTranslation14 } from "react-i18next";
|
|
|
15147
15258
|
|
|
15148
15259
|
// src/commodity-original/lib/app-theme-provider.tsx
|
|
15149
15260
|
import { jsx as _jsx6, jsxs as _jsxs6 } from "react/jsx-runtime";
|
|
15150
|
-
import { createContext as createContext9, useCallback, useContext as useContext9, useLayoutEffect as useLayoutEffect3, useMemo as
|
|
15261
|
+
import { createContext as createContext9, useCallback as useCallback2, useContext as useContext9, useLayoutEffect as useLayoutEffect3, useMemo as useMemo9, useRef as useRef9, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
15151
15262
|
import { ThemeProvider as ThemeProvider2 } from "styled-components";
|
|
15152
15263
|
|
|
15153
15264
|
// src/commodity-original/app/global-styles.tsx
|
|
@@ -15287,14 +15398,14 @@ function subscribeToTheme(onStoreChange) {
|
|
|
15287
15398
|
}
|
|
15288
15399
|
function AppThemeProvider({ children }) {
|
|
15289
15400
|
const rootRef = useRef9(null);
|
|
15290
|
-
const getTargetDocument =
|
|
15291
|
-
const getSnapshot =
|
|
15401
|
+
const getTargetDocument = useCallback2(() => rootRef.current?.ownerDocument ?? document, []);
|
|
15402
|
+
const getSnapshot = useCallback2(() => {
|
|
15292
15403
|
const targetDocument = getTargetDocument();
|
|
15293
15404
|
return targetDocument === document ? getThemeSnapshot() : getPreviewThemeStore(targetDocument).themeName;
|
|
15294
15405
|
}, [
|
|
15295
15406
|
getTargetDocument
|
|
15296
15407
|
]);
|
|
15297
|
-
const subscribe =
|
|
15408
|
+
const subscribe = useCallback2((onStoreChange) => {
|
|
15298
15409
|
const targetDocument = getTargetDocument();
|
|
15299
15410
|
if (targetDocument === document) return subscribeToTheme(onStoreChange);
|
|
15300
15411
|
const store = getPreviewThemeStore(targetDocument);
|
|
@@ -15313,7 +15424,7 @@ function AppThemeProvider({ children }) {
|
|
|
15313
15424
|
getSnapshot,
|
|
15314
15425
|
getTargetDocument
|
|
15315
15426
|
]);
|
|
15316
|
-
const setTheme =
|
|
15427
|
+
const setTheme = useCallback2((nextTheme) => {
|
|
15317
15428
|
const targetDocument = getTargetDocument();
|
|
15318
15429
|
if (targetDocument !== document) {
|
|
15319
15430
|
const store = getPreviewThemeStore(targetDocument);
|
|
@@ -15332,13 +15443,13 @@ function AppThemeProvider({ children }) {
|
|
|
15332
15443
|
}, [
|
|
15333
15444
|
getTargetDocument
|
|
15334
15445
|
]);
|
|
15335
|
-
const toggleTheme =
|
|
15446
|
+
const toggleTheme = useCallback2(() => {
|
|
15336
15447
|
setTheme(themeName === "light" ? "dark" : "light");
|
|
15337
15448
|
}, [
|
|
15338
15449
|
setTheme,
|
|
15339
15450
|
themeName
|
|
15340
15451
|
]);
|
|
15341
|
-
const contextValue =
|
|
15452
|
+
const contextValue = useMemo9(() => ({
|
|
15342
15453
|
themeName,
|
|
15343
15454
|
setTheme,
|
|
15344
15455
|
toggleTheme
|
|
@@ -15533,7 +15644,7 @@ function Footer() {
|
|
|
15533
15644
|
}
|
|
15534
15645
|
|
|
15535
15646
|
// src/commodity-original/components/Header/index.tsx
|
|
15536
|
-
import { useCallback as
|
|
15647
|
+
import { useCallback as useCallback3, useEffect as useEffect10, useRef as useRef10, useState as useState16 } from "react";
|
|
15537
15648
|
import Image9 from "next/image.js";
|
|
15538
15649
|
import Link9 from "next/link.js";
|
|
15539
15650
|
import { usePathname as usePathname2, useSearchParams } from "next/navigation.js";
|
|
@@ -15692,7 +15803,7 @@ function Header() {
|
|
|
15692
15803
|
return pathname === route || pathname.startsWith(`${route}/`);
|
|
15693
15804
|
};
|
|
15694
15805
|
const [portalContainer, setPortalContainer] = useState16(null);
|
|
15695
|
-
const setHeaderRef =
|
|
15806
|
+
const setHeaderRef = useCallback3((element) => {
|
|
15696
15807
|
setPortalContainer(element);
|
|
15697
15808
|
}, []);
|
|
15698
15809
|
const [isMenuOpen, setIsMenuOpen] = useState16(false);
|
|
@@ -17215,7 +17326,7 @@ import { useTranslation as useTranslation23 } from "react-i18next";
|
|
|
17215
17326
|
|
|
17216
17327
|
// src/commodity-original/components/Background/index.tsx
|
|
17217
17328
|
import { jsx as _jsx8, jsxs as _jsxs7 } from "react/jsx-runtime";
|
|
17218
|
-
import { memo, useEffect as useEffect11, useId as useId3, useRef as useRef11 } from "react";
|
|
17329
|
+
import { memo as memo2, useEffect as useEffect11, useId as useId3, useRef as useRef11 } from "react";
|
|
17219
17330
|
import { styled as styled32 } from "styled-components";
|
|
17220
17331
|
var TWO_PI = Math.PI * 2;
|
|
17221
17332
|
var DotContainer = styled32.div.withConfig({
|
|
@@ -17223,7 +17334,7 @@ var DotContainer = styled32.div.withConfig({
|
|
|
17223
17334
|
})([
|
|
17224
17335
|
`position:absolute;top:-130px;left:-200px;width:50%;height:100%;border-radius:20%;overflow:hidden;pointer-events:none;`
|
|
17225
17336
|
]);
|
|
17226
|
-
var DotField = /* @__PURE__ */
|
|
17337
|
+
var DotField = /* @__PURE__ */ memo2(({ dotRadius = 1.5, dotSpacing = 14, cursorRadius = 500, cursorForce = 0.1, bulgeOnly = true, bulgeStrength = 67, glowRadius = 160, sparkle = false, waveAmplitude = 0, gradientFrom = "rgba(168, 85, 247, 0.35)", gradientTo = "rgba(180, 151, 207, 0.25)", glowColor = "#120F17", ...rest }) => {
|
|
17227
17338
|
const canvasRef = useRef11(null);
|
|
17228
17339
|
const svgRef = useRef11(null);
|
|
17229
17340
|
const glowRef = useRef11(null);
|
|
@@ -18810,7 +18921,7 @@ function ExactProviders({ content, children }) {
|
|
|
18810
18921
|
else if (field.startsWith("en.")) en[field.slice(3)] = value4;
|
|
18811
18922
|
else if (field in vi) vi[field] = value4;
|
|
18812
18923
|
}
|
|
18813
|
-
const instance =
|
|
18924
|
+
const instance = useMemo10(() => {
|
|
18814
18925
|
const created = createInstance();
|
|
18815
18926
|
void created.use(initReactI18next).init({
|
|
18816
18927
|
resources: {
|
|
@@ -18919,10 +19030,10 @@ function exactBlock(options, Component, wrapSection = false) {
|
|
|
18919
19030
|
)
|
|
18920
19031
|
};
|
|
18921
19032
|
const Renderer3 = (input) => {
|
|
18922
|
-
const props = { ...input, content:
|
|
19033
|
+
const props = { ...input, content: useMemo10(() => migrateWikexChromeContent(options.type, input.content), [input.content]) };
|
|
18923
19034
|
const language = supportedLanguage(props.content.__cmsLanguage) ?? "vi";
|
|
18924
|
-
const chrome2 =
|
|
18925
|
-
const listStates =
|
|
19035
|
+
const chrome2 = useMemo10(() => flattenChromeLists(options.type, props.content, language), [props.content, language]);
|
|
19036
|
+
const listStates = useMemo10(() => lists.map((list) => {
|
|
18926
19037
|
const field = exactListFieldKey(language, list);
|
|
18927
19038
|
const templates = exactListDefaults(list, language);
|
|
18928
19039
|
return {
|
|
@@ -18932,10 +19043,10 @@ function exactBlock(options, Component, wrapSection = false) {
|
|
|
18932
19043
|
templates
|
|
18933
19044
|
};
|
|
18934
19045
|
}), [language, props.content]);
|
|
18935
|
-
const listCounts =
|
|
19046
|
+
const listCounts = useMemo10(() => Object.fromEntries(
|
|
18936
19047
|
listStates.map(({ items, list }) => [list.countKey, items.length])
|
|
18937
19048
|
), [listStates]);
|
|
18938
|
-
const renderedContent =
|
|
19049
|
+
const renderedContent = useMemo10(() => {
|
|
18939
19050
|
const renderedContent2 = { ...props.content, ...chrome2.values };
|
|
18940
19051
|
listStates.forEach(({ items, list }) => {
|
|
18941
19052
|
renderedContent2[`${language}.${list.countKey}`] = String(items.length);
|
|
@@ -19005,7 +19116,7 @@ function exactBlock(options, Component, wrapSection = false) {
|
|
|
19005
19116
|
)
|
|
19006
19117
|
);
|
|
19007
19118
|
};
|
|
19008
|
-
const fieldKeys =
|
|
19119
|
+
const fieldKeys = useMemo10(() => [
|
|
19009
19120
|
...Object.keys(chrome2.values),
|
|
19010
19121
|
...translationEntries(options.prefixes).map(([key]) => `${language}.${key}`),
|
|
19011
19122
|
...listStates.flatMap(
|