@enyxs/wikex-components 0.11.39 → 0.11.45

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.
Files changed (55) hide show
  1. package/dist/chrome-model.css +0 -1
  2. package/dist/chrome-model.js +0 -1
  3. package/dist/chrome-model.mjs +0 -1
  4. package/dist/consultation-model.js +0 -1
  5. package/dist/consultation-model.mjs +0 -1
  6. package/dist/consultations.js +0 -1
  7. package/dist/consultations.mjs +0 -1
  8. package/dist/fees-model.d.mts +1 -0
  9. package/dist/fees-model.d.ts +1 -0
  10. package/dist/fees-model.js +7 -5
  11. package/dist/fees-model.mjs +7 -5
  12. package/dist/{fees-table-BxHiMpdc.d.mts → fees-table-BeGo7_0N.d.mts} +1 -1
  13. package/dist/{fees-table-i7g0SHgV.d.ts → fees-table-DdbbVv6r.d.ts} +1 -1
  14. package/dist/fees.d.mts +4 -2
  15. package/dist/fees.d.ts +4 -2
  16. package/dist/fees.js +355 -264
  17. package/dist/fees.mjs +357 -266
  18. package/dist/index.css +0 -1
  19. package/dist/index.d.mts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +315 -205
  22. package/dist/index.mjs +339 -229
  23. package/dist/page-templates.js +0 -1
  24. package/dist/page-templates.mjs +0 -1
  25. package/dist/partner.css +0 -1
  26. package/dist/partner.js +0 -1
  27. package/dist/partner.mjs +0 -1
  28. package/dist/products.js +0 -1
  29. package/dist/products.mjs +0 -1
  30. package/dist/ui.js +0 -1
  31. package/dist/ui.mjs +0 -1
  32. package/package.json +1 -1
  33. package/dist/chrome-model.css.map +0 -1
  34. package/dist/chrome-model.js.map +0 -1
  35. package/dist/chrome-model.mjs.map +0 -1
  36. package/dist/consultation-model.js.map +0 -1
  37. package/dist/consultation-model.mjs.map +0 -1
  38. package/dist/consultations.js.map +0 -1
  39. package/dist/consultations.mjs.map +0 -1
  40. package/dist/fees-model.js.map +0 -1
  41. package/dist/fees-model.mjs.map +0 -1
  42. package/dist/fees.js.map +0 -1
  43. package/dist/fees.mjs.map +0 -1
  44. package/dist/index.css.map +0 -1
  45. package/dist/index.js.map +0 -1
  46. package/dist/index.mjs.map +0 -1
  47. package/dist/page-templates.js.map +0 -1
  48. package/dist/page-templates.mjs.map +0 -1
  49. package/dist/partner.css.map +0 -1
  50. package/dist/partner.js.map +0 -1
  51. package/dist/partner.mjs.map +0 -1
  52. package/dist/products.js.map +0 -1
  53. package/dist/products.mjs.map +0 -1
  54. package/dist/ui.js.map +0 -1
  55. package/dist/ui.mjs.map +0 -1
package/dist/index.js CHANGED
@@ -9850,6 +9850,72 @@ var import_MenuItem2 = __toESM(require("@mui/material/MenuItem"));
9850
9850
  var import_Checkbox2 = __toESM(require("@mui/material/Checkbox"));
9851
9851
  var import_Collapse = __toESM(require("@mui/material/Collapse"));
9852
9852
 
9853
+ // src/wikex/fees-cell-layout.ts
9854
+ var queues = /* @__PURE__ */ new WeakMap();
9855
+ function enqueue(element, queue) {
9856
+ queue.pending.add(element);
9857
+ if (queue.frame) return;
9858
+ const view = element.ownerDocument.defaultView;
9859
+ queue.frame = view.requestAnimationFrame(() => {
9860
+ queue.frame = 0;
9861
+ const cells = [...queue.pending].filter((cell) => cell.isConnected);
9862
+ queue.pending.clear();
9863
+ for (const cell of cells) cell.style.height = "0px";
9864
+ const heights = cells.map((cell) => {
9865
+ const style = view.getComputedStyle(cell);
9866
+ return cell.scrollHeight + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
9867
+ });
9868
+ cells.forEach((cell, index) => {
9869
+ cell.style.height = `${heights[index]}px`;
9870
+ });
9871
+ });
9872
+ }
9873
+ function observeFeesCell(element) {
9874
+ const document2 = element.ownerDocument;
9875
+ const view = document2.defaultView;
9876
+ let queue = queues.get(document2);
9877
+ if (!queue) {
9878
+ const current2 = {
9879
+ elements: /* @__PURE__ */ new Map(),
9880
+ pending: /* @__PURE__ */ new Set(),
9881
+ frame: 0,
9882
+ observer: new view.ResizeObserver((entries) => {
9883
+ for (const { target, contentRect } of entries) {
9884
+ const cell = target;
9885
+ if (current2.elements.get(cell) !== contentRect.width) {
9886
+ current2.elements.set(cell, contentRect.width);
9887
+ enqueue(cell, current2);
9888
+ }
9889
+ }
9890
+ })
9891
+ };
9892
+ queue = current2;
9893
+ queues.set(document2, current2);
9894
+ void document2.fonts.ready.then(() => {
9895
+ for (const cell of current2.elements.keys()) enqueue(cell, current2);
9896
+ });
9897
+ }
9898
+ queue.elements.set(element, -1);
9899
+ queue.observer.observe(element);
9900
+ enqueue(element, queue);
9901
+ const current = queue;
9902
+ return () => {
9903
+ current.observer.unobserve(element);
9904
+ current.elements.delete(element);
9905
+ current.pending.delete(element);
9906
+ if (!current.elements.size) {
9907
+ current.observer.disconnect();
9908
+ if (current.frame) view.cancelAnimationFrame(current.frame);
9909
+ current.frame = 0;
9910
+ queues.delete(document2);
9911
+ }
9912
+ };
9913
+ }
9914
+ function scheduleFeesCell(element) {
9915
+ const queue = queues.get(element.ownerDocument);
9916
+ if (queue) enqueue(element, queue);
9917
+ }
9918
+
9853
9919
  // src/wikex/fees-typography-controls.tsx
9854
9920
  var import_react22 = require("react");
9855
9921
  var import_material = require("@mui/material");
@@ -9898,12 +9964,14 @@ var FEES_DEFAULT_API_FIELDS = {
9898
9964
  function feesColumnApiField(column) {
9899
9965
  return column.apiField ?? FEES_DEFAULT_API_FIELDS[column.key] ?? "";
9900
9966
  }
9967
+ var feesNumberFormats = { vi: new Intl.NumberFormat("vi-VN", { maximumFractionDigits: 8 }), en: new Intl.NumberFormat("en-US", { maximumFractionDigits: 8 }) };
9968
+ var numericFeeFields = new Set(FEES_COMMODITY_FIELDS.filter((field) => field.numeric).map((field) => field.key));
9901
9969
  function formatFeesApiValue(value4, field, language) {
9902
9970
  if (value4 === null || value4 === void 0 || typeof value4 === "string" && !value4.trim()) return " - - ";
9903
- if (FEES_COMMODITY_FIELDS.find((item) => item.key === field)?.numeric) {
9971
+ if (numericFeeFields.has(field)) {
9904
9972
  const number = typeof value4 === "number" ? value4 : Number(value4);
9905
9973
  if (!Number.isFinite(number)) return " - - ";
9906
- return number === 0 ? "0" : new Intl.NumberFormat(language === "vi" ? "vi-VN" : "en-US", { maximumFractionDigits: 8 }).format(number);
9974
+ return number === 0 ? "0" : feesNumberFormats[language].format(number);
9907
9975
  }
9908
9976
  return String(value4);
9909
9977
  }
@@ -10046,10 +10114,11 @@ function validateFeesTableValue(value4, allowBackup) {
10046
10114
  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.");
10047
10115
  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.");
10048
10116
  if (value4.apiColumnsInitialized !== void 0 && typeof value4.apiColumnsInitialized !== "boolean") throw invalid();
10049
- if (!allowBackup && (value4.manualTable !== void 0 || value4.dataSource !== void 0 || value4.lastSyncedAt !== void 0 || value4.apiColumnsInitialized !== void 0)) throw invalid();
10117
+ if (!allowBackup && (value4.manualTable !== void 0 || value4.apiTable !== void 0 || value4.dataSource !== void 0 || value4.lastSyncedAt !== void 0 || value4.apiColumnsInitialized !== void 0)) throw invalid();
10050
10118
  const manualTable = value4.manualTable !== void 0 ? validateFeesTableValue(value4.manualTable, false) : void 0;
10119
+ const apiTable = value4.apiTable !== void 0 ? validateFeesTableValue(value4.apiTable, false) : void 0;
10051
10120
  const typography = validateFeesTypography(value4.typography);
10052
- 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 } : {} };
10121
+ 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 } : {} };
10053
10122
  }
10054
10123
  function parseFeesTable(value4, fallback) {
10055
10124
  if (typeof value4 !== "string") return fallback;
@@ -11083,34 +11152,31 @@ var feesTheme = {
11083
11152
  ]))
11084
11153
  };
11085
11154
  var EditorActions = import_styled_components14.default.div.withConfig({
11086
- componentId: "sc-20fe3bfd-0"
11155
+ componentId: "sc-508961e9-0"
11087
11156
  })([
11088
- `display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
11157
+ `display:flex;flex-wrap:wrap;gap:6px;margin-top:12px;`
11089
11158
  ]);
11090
11159
  var EditGroup = import_styled_components14.default.div.withConfig({
11091
- componentId: "sc-20fe3bfd-1"
11160
+ componentId: "sc-508961e9-1"
11092
11161
  })([
11093
11162
  `display:flex;flex-direction:column;gap:6px;`
11094
11163
  ]);
11095
11164
  var HeaderGroup = (0, import_styled_components14.default)(EditGroup).withConfig({
11096
- componentId: "sc-20fe3bfd-2"
11165
+ componentId: "sc-508961e9-2"
11097
11166
  })([
11098
11167
  `gap:8px;`
11099
11168
  ]);
11100
11169
  var HeaderTitle = import_styled_components14.default.div.withConfig({
11101
- componentId: "sc-20fe3bfd-3"
11170
+ componentId: "sc-508961e9-3"
11102
11171
  })([
11103
11172
  `display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
11104
11173
  ]);
11105
- var HeaderActions = import_styled_components14.default.div.withConfig({
11106
- componentId: "sc-20fe3bfd-4"
11107
- })([
11108
- `display:flex;align-items:center;min-height:24px;`
11109
- ]);
11110
11174
  var AlignedFeesTable = (0, import_styled_components14.default)(FeesAndMarginTable).withConfig({
11111
- componentId: "sc-20fe3bfd-5"
11175
+ componentId: "sc-508961e9-4"
11112
11176
  })([
11113
- `&[data-editable] th{vertical-align:top;}--fees-row-background:`,
11177
+ `&[data-editable] th{vertical-align:top;}&&&[data-editable] thead > tr > th{font-size:`,
11178
+ `px;line-height:1.4;}&&&[data-editable] tbody > tr > td{font-size:`,
11179
+ `px;line-height:1.4;}--fees-row-background:`,
11114
11180
  `;--fees-stripe-background:`,
11115
11181
  `;--fees-text:`,
11116
11182
  `;:root[data-theme="dark"] &{--fees-row-background:#39393d;--fees-stripe-background:`,
@@ -11133,7 +11199,7 @@ var AlignedFeesTable = (0, import_styled_components14.default)(FeesAndMarginTabl
11133
11199
  `px;line-height:`,
11134
11200
  `;}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:`,
11135
11201
  `;}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);}}}`
11136
- ], ({ 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) => `
11202
+ ], ({ $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) => `
11137
11203
  th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
11138
11204
  width: ${width}px;
11139
11205
  min-width: ${width}px;
@@ -11141,14 +11207,14 @@ var AlignedFeesTable = (0, import_styled_components14.default)(FeesAndMarginTabl
11141
11207
  }
11142
11208
  `).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);
11143
11209
  var FeesCellContent = import_styled_components14.default.span.withConfig({
11144
- componentId: "sc-20fe3bfd-6"
11210
+ componentId: "sc-508961e9-5"
11145
11211
  })([
11146
11212
  `display:block;text-align:`,
11147
11213
  `;@media (max-width:767px){text-align:`,
11148
11214
  `;}`
11149
11215
  ], ({ $align, $alignRight }) => $align ?? ($alignRight ? "right" : "left"), ({ $align }) => $align ?? "left");
11150
11216
  var EditorButton = import_styled_components14.default.button.withConfig({
11151
- componentId: "sc-20fe3bfd-7"
11217
+ componentId: "sc-508961e9-6"
11152
11218
  })([
11153
11219
  `padding:7px 12px;border:1px solid `,
11154
11220
  `;border-radius:6px;background:`,
@@ -11157,17 +11223,17 @@ var EditorButton = import_styled_components14.default.button.withConfig({
11157
11223
  `;}&:disabled{cursor:default;opacity:.4;}`
11158
11224
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
11159
11225
  var OrderActions = import_styled_components14.default.div.withConfig({
11160
- componentId: "sc-20fe3bfd-8"
11226
+ componentId: "sc-508961e9-7"
11161
11227
  })([
11162
11228
  `display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
11163
11229
  ]);
11164
11230
  var PositionLabel = import_styled_components14.default.label.withConfig({
11165
- componentId: "sc-20fe3bfd-9"
11231
+ componentId: "sc-508961e9-8"
11166
11232
  })([
11167
11233
  `display:inline-flex;align-items:center;gap:6px;font-size:12px;`
11168
11234
  ]);
11169
11235
  var PositionInput = import_styled_components14.default.input.withConfig({
11170
- componentId: "sc-20fe3bfd-10"
11236
+ componentId: "sc-508961e9-9"
11171
11237
  })([
11172
11238
  `width:56px;padding:5px;border:1px solid `,
11173
11239
  `;border-radius:4px;background:`,
@@ -11176,18 +11242,18 @@ var PositionInput = import_styled_components14.default.input.withConfig({
11176
11242
  `;}`
11177
11243
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
11178
11244
  var ColumnRow = import_styled_components14.default.div.withConfig({
11179
- componentId: "sc-20fe3bfd-11"
11245
+ componentId: "sc-508961e9-10"
11180
11246
  })([
11181
11247
  `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;}`
11182
11248
  ]);
11183
11249
  var PaginationControls = (0, import_styled_components14.default)(FeesAndMarginPagination).withConfig({
11184
- componentId: "sc-20fe3bfd-12"
11250
+ componentId: "sc-508961e9-11"
11185
11251
  })([
11186
11252
  `align-items:center;flex-wrap:wrap;gap:16px 24px;color:`,
11187
11253
  `;`
11188
11254
  ], ({ theme }) => theme.colors.text.primary);
11189
11255
  var PageSizeLabel = import_styled_components14.default.div.withConfig({
11190
- componentId: "sc-20fe3bfd-13"
11256
+ componentId: "sc-508961e9-12"
11191
11257
  })([
11192
11258
  `display:inline-flex;align-items:center;gap:8px;color:`,
11193
11259
  `;font:inherit;font-size:13px;`
@@ -11215,60 +11281,58 @@ function Position({ value: value4, max, label, onMove }) {
11215
11281
  });
11216
11282
  }
11217
11283
  var DeleteButton = (0, import_styled_components14.default)(EditorButton).withConfig({
11218
- componentId: "sc-20fe3bfd-14"
11284
+ componentId: "sc-508961e9-13"
11219
11285
  })([
11220
11286
  `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;}`
11221
11287
  ]);
11222
11288
  var CellEditorInput = import_styled_components14.default.textarea.withConfig({
11223
- componentId: "sc-20fe3bfd-15"
11289
+ componentId: "sc-508961e9-14"
11224
11290
  })([
11225
11291
  `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:`,
11226
11292
  `;}&:focus{outline:1px solid `,
11227
11293
  `;}&[data-fees-column-selected="true"]{border-color:`,
11228
11294
  `;}`
11229
11295
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
11230
- function CellEditor({ onInput, ...props }) {
11296
+ function CellEditor({ onInput, layoutKey, ...props }) {
11231
11297
  const ref = (0, import_react25.useRef)(null);
11232
- const fit = () => {
11233
- const element = ref.current;
11234
- if (!element) return;
11235
- element.style.height = "0px";
11236
- const style = element.ownerDocument.defaultView.getComputedStyle(element);
11237
- const border = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
11238
- element.style.height = `${element.scrollHeight + border}px`;
11239
- };
11240
- (0, import_react25.useLayoutEffect)(fit);
11298
+ (0, import_react25.useLayoutEffect)(() => ref.current ? observeFeesCell(ref.current) : void 0, []);
11241
11299
  (0, import_react25.useLayoutEffect)(() => {
11242
- const element = ref.current;
11243
- if (!element) return;
11244
- let width = element.getBoundingClientRect().width;
11245
- const observer = new ResizeObserver(() => {
11246
- const nextWidth = element.getBoundingClientRect().width;
11247
- if (nextWidth !== width) {
11248
- width = nextWidth;
11249
- fit();
11250
- }
11251
- });
11252
- observer.observe(element);
11253
- let active = true;
11254
- void element.ownerDocument.fonts.ready.then(() => {
11255
- if (active) fit();
11256
- });
11257
- return () => {
11258
- active = false;
11259
- observer.disconnect();
11260
- };
11261
- }, []);
11300
+ if (ref.current) scheduleFeesCell(ref.current);
11301
+ }, [
11302
+ props.value,
11303
+ layoutKey
11304
+ ]);
11262
11305
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CellEditorInput, {
11263
11306
  ...props,
11264
11307
  ref,
11265
11308
  rows: 1,
11266
11309
  onInput: (event) => {
11267
- fit();
11310
+ scheduleFeesCell(event.currentTarget);
11268
11311
  onInput?.(event);
11269
11312
  }
11270
11313
  });
11271
11314
  }
11315
+ var ManualCell = /* @__PURE__ */ (0, import_react25.memo)(function ManualCell2({ rowId, columnKey, text: text2, label, align, selected, layoutKey, onEdit }) {
11316
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CellEditor, {
11317
+ value: text2,
11318
+ "aria-label": label,
11319
+ style: {
11320
+ textAlign: align ?? "left"
11321
+ },
11322
+ layoutKey,
11323
+ "data-fees-column-selected": selected,
11324
+ onChange: (event) => onEdit(rowId, columnKey, event.target.value)
11325
+ });
11326
+ });
11327
+ var ReadOnlyCell = /* @__PURE__ */ (0, import_react25.memo)(function ReadOnlyCell2({ text: text2, label, align, alignRight, selected }) {
11328
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FeesCellContent, {
11329
+ "aria-label": label,
11330
+ $align: align,
11331
+ $alignRight: alignRight,
11332
+ "data-fees-column-selected": selected || void 0,
11333
+ children: text2
11334
+ });
11335
+ });
11272
11336
  function RowTagSelect({ selected, options, onChange, disabled = false }) {
11273
11337
  const selectRoot = (0, import_react25.useRef)(null);
11274
11338
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditGroup, {
@@ -11282,9 +11346,9 @@ function RowTagSelect({ selected, options, onChange, disabled = false }) {
11282
11346
  value: selected,
11283
11347
  disabled,
11284
11348
  inputProps: {
11285
- "aria-label": "Ch\u1ECDn tag"
11349
+ "aria-label": "Ch\u1ECDn nh\xF3m"
11286
11350
  },
11287
- renderValue: (value4) => value4.length ? `\u0110\xE3 ch\u1ECDn ${value4.length} tag` : "Ch\u1ECDn tag\u2026",
11351
+ renderValue: (value4) => value4.length ? `\u0110\xE3 ch\u1ECDn ${value4.length} nh\xF3m` : "Ch\u1ECDn nh\xF3m\u2026",
11288
11352
  MenuProps: {
11289
11353
  container: () => selectRoot.current?.ownerDocument.body ?? document.body
11290
11354
  },
@@ -11310,13 +11374,53 @@ function RowTagSelect({ selected, options, onChange, disabled = false }) {
11310
11374
  }, item)),
11311
11375
  !options.length && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_MenuItem2.default, {
11312
11376
  disabled: true,
11313
- children: "Ch\u01B0a c\xF3 tag \u2014 d\xF9ng n\xFAt Th\xEAm tag ph\xEDa tr\xEAn"
11377
+ children: "Ch\u01B0a c\xF3 nh\xF3m \u2014 d\xF9ng n\xFAt Th\xEAm nh\xF3m ph\xEDa tr\xEAn"
11314
11378
  })
11315
11379
  ]
11316
11380
  })
11317
11381
  })
11318
11382
  });
11319
11383
  }
11384
+ var ManualRowControls = /* @__PURE__ */ (0, import_react25.memo)(function ManualRowControls2({ id, name, tags, options, index, count, onTags, onMove, onDelete }) {
11385
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(EditGroup, {
11386
+ children: [
11387
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RowTagSelect, {
11388
+ selected: tags,
11389
+ options,
11390
+ onChange: (next) => onTags(id, next)
11391
+ }),
11392
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(OrderActions, {
11393
+ children: [
11394
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Position, {
11395
+ value: index,
11396
+ max: count,
11397
+ label: `V\u1ECB tr\xED d\xF2ng ${name}`,
11398
+ onMove: (to) => onMove(id, to)
11399
+ }),
11400
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorButton, {
11401
+ type: "button",
11402
+ "aria-label": `\u0110\u01B0a d\xF2ng ${name} l\xEAn`,
11403
+ disabled: index === 0,
11404
+ onClick: () => onMove(id, index - 1),
11405
+ children: "\u2191"
11406
+ }),
11407
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorButton, {
11408
+ type: "button",
11409
+ "aria-label": `\u0110\u01B0a d\xF2ng ${name} xu\u1ED1ng`,
11410
+ disabled: index === count - 1,
11411
+ onClick: () => onMove(id, index + 1),
11412
+ children: "\u2193"
11413
+ })
11414
+ ]
11415
+ }),
11416
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DeleteButton, {
11417
+ type: "button",
11418
+ onClick: () => onDelete(id, name || "H\xE0ng m\u1EDBi"),
11419
+ children: "X\xF3a h\xE0ng"
11420
+ })
11421
+ ]
11422
+ });
11423
+ });
11320
11424
  var columnWidths = {
11321
11425
  name: 100,
11322
11426
  code: 96,
@@ -11357,8 +11461,9 @@ var rightAlignedColumns = /* @__PURE__ */ new Set([
11357
11461
  "priceUnit",
11358
11462
  "unit"
11359
11463
  ]);
11360
- function FeesTable({ value: value4, editable = false, onChange, labels: labels2, size = "md", tagOrder = [], language = "vi" }) {
11464
+ var FeesTable = /* @__PURE__ */ (0, import_react25.memo)(function FeesTable2({ value: value4, editable = false, onChange, labels: labels2, size = "md", tagOrder = [], language = "vi" }) {
11361
11465
  const [search, setSearch] = (0, import_react25.useState)("");
11466
+ const deferredSearch = (0, import_react25.useDeferredValue)(search);
11362
11467
  const [tag, setTag] = (0, import_react25.useState)("");
11363
11468
  const [page, setPage] = (0, import_react25.useState)(1);
11364
11469
  const [pageSize, setPageSize] = (0, import_react25.useState)(FEES_PAGE_SIZE);
@@ -11367,11 +11472,38 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11367
11472
  const [columnTitle, setColumnTitle] = (0, import_react25.useState)("");
11368
11473
  const [columnField, setColumnField] = (0, import_react25.useState)("");
11369
11474
  const [typographyOpen, setTypographyOpen] = (0, import_react25.useState)(false);
11475
+ const [alignmentOpen, setAlignmentOpen] = (0, import_react25.useState)(false);
11370
11476
  const [selectedColumnKey, setSelectedColumnKey] = (0, import_react25.useState)("");
11371
11477
  const english = language === "en";
11372
11478
  const canEdit = editable && Boolean(onChange);
11373
11479
  const apiManaged = value4.dataSource === "wikex-api";
11374
- const visibleColumns = value4.columns.filter((column) => !column.hidden);
11480
+ const visibleColumns = (0, import_react25.useMemo)(() => value4.columns.filter((column) => !column.hidden), [
11481
+ value4.columns
11482
+ ]);
11483
+ const latest = (0, import_react25.useRef)({
11484
+ value: value4,
11485
+ onChange
11486
+ });
11487
+ latest.current = {
11488
+ value: value4,
11489
+ onChange
11490
+ };
11491
+ const editCell = (0, import_react25.useCallback)((rowId, key, text2) => {
11492
+ const { value: value5, onChange: onChange2 } = latest.current;
11493
+ if (value5.dataSource === "wikex-api") return;
11494
+ onChange2?.({
11495
+ ...value5,
11496
+ rows: value5.rows.map((row) => row.id === rowId ? {
11497
+ ...row,
11498
+ cells: {
11499
+ ...row.cells,
11500
+ [key]: text2
11501
+ }
11502
+ } : row)
11503
+ });
11504
+ }, []);
11505
+ const headerLayout = JSON.stringify(value4.typography?.thead ?? {});
11506
+ const bodyLayout = JSON.stringify(value4.typography?.tbody ?? {});
11375
11507
  const tableRoot = (0, import_react25.useRef)(null);
11376
11508
  (0, import_react25.useLayoutEffect)(() => {
11377
11509
  const root = tableRoot.current;
@@ -11428,10 +11560,19 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11428
11560
  ...value4.rows.flatMap((row) => row.tags)
11429
11561
  ])
11430
11562
  ].filter(Boolean);
11431
- const tags = [
11563
+ const orderedTags = [
11432
11564
  ...tagOrder.filter((item) => rowTags.includes(item)),
11433
11565
  ...rowTags.filter((item) => !tagOrder.includes(item))
11434
11566
  ];
11567
+ const stableTags = (0, import_react25.useRef)([]);
11568
+ if (orderedTags.length !== stableTags.current.length || orderedTags.some((tag2, index) => tag2 !== stableTags.current[index])) stableTags.current = orderedTags;
11569
+ const tags = stableTags.current;
11570
+ const rowPositions = (0, import_react25.useMemo)(() => new Map(value4.rows.map((row, index) => [
11571
+ row.id,
11572
+ index
11573
+ ])), [
11574
+ value4.rows
11575
+ ]);
11435
11576
  const newTagName = tagDraft.trim().replace(/\s+/g, " ");
11436
11577
  const duplicateTag = tags.some((item) => item.toLocaleLowerCase("vi") === newTagName.toLocaleLowerCase("vi"));
11437
11578
  const createTag = () => {
@@ -11447,9 +11588,21 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11447
11588
  setTagDraft("");
11448
11589
  };
11449
11590
  const activeTag = tags.includes(tag) ? tag : "";
11450
- const filtered = filterFeesRows(value4, search, activeTag);
11451
- const displayedRows = canEdit ? filtered : sortFeesRowsByName(filtered, language);
11452
- const pagination = paginateFeesRows(displayedRows, page, pageSize);
11591
+ const filtered = (0, import_react25.useMemo)(() => filterFeesRows(value4, deferredSearch, activeTag), [
11592
+ value4,
11593
+ deferredSearch,
11594
+ activeTag
11595
+ ]);
11596
+ const displayedRows = (0, import_react25.useMemo)(() => canEdit ? filtered : sortFeesRowsByName(filtered, language), [
11597
+ canEdit,
11598
+ filtered,
11599
+ language
11600
+ ]);
11601
+ const pagination = (0, import_react25.useMemo)(() => paginateFeesRows(displayedRows, page, pageSize), [
11602
+ displayedRows,
11603
+ page,
11604
+ pageSize
11605
+ ]);
11453
11606
  const selectedColumn = value4.columns.find((column) => column.key === selectedColumnKey);
11454
11607
  (0, import_react25.useLayoutEffect)(() => {
11455
11608
  if (selectedColumnKey && !selectedColumn) setSelectedColumnKey("");
@@ -11471,6 +11624,25 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11471
11624
  const index = rows.filter((row) => filteredIds.has(row.id)).findIndex((row) => row.id === id);
11472
11625
  setPage(pageSize === -1 ? 1 : Math.floor(Math.max(0, index) / pageSize) + 1);
11473
11626
  };
11627
+ const moveRowRef = (0, import_react25.useRef)(moveRow);
11628
+ moveRowRef.current = moveRow;
11629
+ const moveManualRow = (0, import_react25.useCallback)((id, position2) => moveRowRef.current(id, position2), []);
11630
+ const deleteManualRow = (0, import_react25.useCallback)((id, name) => setDeleteTarget({
11631
+ kind: "row",
11632
+ id,
11633
+ label: name
11634
+ }), []);
11635
+ const tagManualRow = (0, import_react25.useCallback)((id, tags2) => {
11636
+ const { value: value5, onChange: onChange2 } = latest.current;
11637
+ if (value5.dataSource === "wikex-api") return;
11638
+ onChange2?.({
11639
+ ...value5,
11640
+ rows: value5.rows.map((row) => row.id === id ? {
11641
+ ...row,
11642
+ tags: tags2
11643
+ } : row)
11644
+ });
11645
+ }, []);
11474
11646
  const addColumn = () => {
11475
11647
  if (apiManaged) {
11476
11648
  setColumnTitle("");
@@ -11514,140 +11686,70 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11514
11686
  onChange?.(setFeesColumnApiField(next, key, columnField, language));
11515
11687
  setAddColumnOpen(false);
11516
11688
  };
11517
- const changeRow = (id, patch) => {
11518
- if (apiManaged) return;
11519
- onChange?.({
11520
- ...value4,
11521
- rows: value4.rows.map((row) => row.id === id ? {
11522
- ...row,
11523
- ...patch
11524
- } : row)
11525
- });
11526
- };
11527
11689
  const columns = visibleColumns.map((column, index) => ({
11528
11690
  key: column.key,
11529
11691
  width: canEdit ? columnWidths[column.key] ?? 140 : index === 0 ? 178 : 170,
11530
11692
  fixed: index === 0 ? "left" : void 0,
11531
- title: canEdit ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(HeaderGroup, {
11532
- children: [
11533
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HeaderTitle, {
11534
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CellEditor, {
11535
- rows: 2,
11536
- value: column.title,
11537
- "aria-label": `Ti\xEAu \u0111\u1EC1 c\u1ED9t ${index + 1}`,
11538
- style: {
11539
- textAlign: column.textAlign ?? value4.typography?.thead?.textAlign ?? "left"
11540
- },
11541
- "data-fees-column-selected": selectedColumnKey === column.key,
11542
- onChange: (event) => onChange?.({
11543
- ...value4,
11544
- columns: value4.columns.map((item) => item.key === column.key ? {
11545
- ...item,
11546
- title: event.target.value
11547
- } : item)
11548
- })
11549
- })
11550
- }),
11551
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HeaderActions, {
11552
- children: column.key !== "name" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DeleteButton, {
11553
- type: "button",
11554
- onClick: () => {
11555
- setDeleteTarget({
11556
- kind: "column",
11557
- id: column.key,
11558
- label: column.title
11559
- });
11560
- },
11561
- children: "X\xF3a c\u1ED9t"
11693
+ title: canEdit ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HeaderGroup, {
11694
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HeaderTitle, {
11695
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CellEditor, {
11696
+ rows: 2,
11697
+ layoutKey: headerLayout,
11698
+ value: column.title,
11699
+ "aria-label": `Ti\xEAu \u0111\u1EC1 c\u1ED9t ${index + 1}`,
11700
+ style: {
11701
+ textAlign: column.textAlign ?? value4.typography?.thead?.textAlign ?? "left"
11702
+ },
11703
+ "data-fees-column-selected": selectedColumnKey === column.key,
11704
+ onChange: (event) => onChange?.({
11705
+ ...value4,
11706
+ columns: value4.columns.map((item) => item.key === column.key ? {
11707
+ ...item,
11708
+ title: event.target.value
11709
+ } : item)
11562
11710
  })
11563
11711
  })
11564
- ]
11712
+ })
11565
11713
  }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FeesCellContent, {
11566
11714
  $align: column.textAlign ?? value4.typography?.thead?.textAlign,
11567
11715
  $alignRight: rightAlignedColumns.has(column.key),
11568
11716
  children: column.title
11569
11717
  }),
11570
- render: (_unused, row) => canEdit ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CellEditor, {
11571
- rows: Math.max(2, (row.cells[column.key] ?? "").split("\n").length),
11572
- value: row.cells[column.key] || (apiManaged ? " - - " : ""),
11573
- "aria-label": `${column.title} \u2014 ${row.cells.name || "H\xE0ng m\u1EDBi"}`,
11574
- readOnly: apiManaged,
11575
- style: {
11576
- textAlign: column.textAlign ?? row.cellAlignments?.[column.key] ?? value4.typography?.tbody?.textAlign ?? "left"
11577
- },
11578
- "data-fees-column-selected": selectedColumnKey === column.key,
11579
- onChange: (event) => {
11580
- if (!apiManaged) changeRow(row.id, {
11581
- cells: {
11582
- ...row.cells,
11583
- [column.key]: event.target.value
11584
- }
11585
- });
11586
- }
11587
- }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FeesCellContent, {
11588
- $align: column.textAlign ?? row.cellAlignments?.[column.key] ?? value4.typography?.tbody?.textAlign,
11589
- $alignRight: rightAlignedColumns.has(column.key),
11590
- children: row.cells[column.key] || (apiManaged ? " - - " : "")
11718
+ render: (_unused, row) => canEdit && !apiManaged ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ManualCell, {
11719
+ rowId: row.id,
11720
+ columnKey: column.key,
11721
+ text: row.cells[column.key] ?? "",
11722
+ label: `${column.title} \u2014 ${row.cells.name || "H\xE0ng m\u1EDBi"}`,
11723
+ align: column.textAlign ?? row.cellAlignments?.[column.key] ?? value4.typography?.tbody?.textAlign,
11724
+ selected: selectedColumnKey === column.key,
11725
+ layoutKey: bodyLayout,
11726
+ onEdit: editCell
11727
+ }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ReadOnlyCell, {
11728
+ text: row.cells[column.key] || (apiManaged ? " - - " : ""),
11729
+ label: canEdit ? `${column.title} \u2014 ${row.cells.name || "H\xE0ng m\u1EDBi"}` : void 0,
11730
+ align: column.textAlign ?? row.cellAlignments?.[column.key] ?? value4.typography?.tbody?.textAlign,
11731
+ alignRight: rightAlignedColumns.has(column.key),
11732
+ selected: canEdit && selectedColumnKey === column.key
11591
11733
  })
11592
11734
  }));
11593
- if (canEdit) columns.push({
11735
+ if (canEdit && !apiManaged) columns.push({
11594
11736
  key: "__tags",
11595
- title: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(HeaderGroup, {
11596
- children: [
11597
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HeaderTitle, {
11598
- children: "Tag & th\u1EE9 t\u1EF1 d\xF2ng"
11599
- }),
11600
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HeaderActions, {})
11601
- ]
11737
+ title: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HeaderGroup, {
11738
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(HeaderTitle, {
11739
+ children: "Nh\xF3m & th\u1EE9 t\u1EF1 d\xF2ng"
11740
+ })
11602
11741
  }),
11603
11742
  width: 300,
11604
- render: (_unused, row) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(EditGroup, {
11605
- children: [
11606
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RowTagSelect, {
11607
- disabled: apiManaged,
11608
- selected: row.tags,
11609
- options: tags,
11610
- onChange: (next) => changeRow(row.id, {
11611
- tags: next
11612
- })
11613
- }),
11614
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(OrderActions, {
11615
- children: [
11616
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Position, {
11617
- value: value4.rows.findIndex((item) => item.id === row.id),
11618
- max: value4.rows.length,
11619
- label: `V\u1ECB tr\xED d\xF2ng ${row.cells.name}`,
11620
- onMove: (to) => moveRow(row.id, to)
11621
- }),
11622
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorButton, {
11623
- type: "button",
11624
- "aria-label": `\u0110\u01B0a d\xF2ng ${row.cells.name} l\xEAn`,
11625
- disabled: value4.rows[0]?.id === row.id,
11626
- onClick: () => moveRow(row.id, value4.rows.findIndex((item) => item.id === row.id) - 1),
11627
- children: "\u2191"
11628
- }),
11629
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorButton, {
11630
- type: "button",
11631
- "aria-label": `\u0110\u01B0a d\xF2ng ${row.cells.name} xu\u1ED1ng`,
11632
- disabled: value4.rows[value4.rows.length - 1]?.id === row.id,
11633
- onClick: () => moveRow(row.id, value4.rows.findIndex((item) => item.id === row.id) + 1),
11634
- children: "\u2193"
11635
- })
11636
- ]
11637
- }),
11638
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DeleteButton, {
11639
- type: "button",
11640
- disabled: apiManaged,
11641
- onClick: () => {
11642
- setDeleteTarget({
11643
- kind: "row",
11644
- id: row.id,
11645
- label: row.cells.name || "H\xE0ng m\u1EDBi"
11646
- });
11647
- },
11648
- children: "X\xF3a h\xE0ng"
11649
- })
11650
- ]
11743
+ render: (_unused, row) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ManualRowControls, {
11744
+ id: row.id,
11745
+ name: row.cells.name || "",
11746
+ tags: row.tags,
11747
+ options: tags,
11748
+ index: rowPositions.get(row.id) ?? 0,
11749
+ count: value4.rows.length,
11750
+ onTags: tagManualRow,
11751
+ onMove: moveManualRow,
11752
+ onDelete: deleteManualRow
11651
11753
  })
11652
11754
  });
11653
11755
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_styled_components14.ThemeProvider, {
@@ -11655,6 +11757,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11655
11757
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", {
11656
11758
  ref: tableRoot,
11657
11759
  "data-cms-table-editor": true,
11760
+ "data-editable": canEdit || void 0,
11658
11761
  onClick: (event) => {
11659
11762
  if (canEdit) event.stopPropagation();
11660
11763
  },
@@ -11668,7 +11771,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11668
11771
  minWidth: 0
11669
11772
  },
11670
11773
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TabCommon, {
11671
- ariaLabel: "L\u1ECDc theo tag",
11774
+ ariaLabel: "L\u1ECDc theo nh\xF3m",
11672
11775
  size,
11673
11776
  items: [
11674
11777
  {
@@ -11716,9 +11819,8 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11716
11819
  },
11717
11820
  children: english ? "Sort names A\u2013Z" : "S\u1EAFp x\u1EBFp t\xEAn A\u2013Z"
11718
11821
  }),
11719
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorButton, {
11822
+ !apiManaged && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorButton, {
11720
11823
  type: "button",
11721
- disabled: apiManaged,
11722
11824
  onClick: () => {
11723
11825
  const row = {
11724
11826
  id: crypto.randomUUID(),
@@ -11764,12 +11866,17 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11764
11866
  }),
11765
11867
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorButton, {
11766
11868
  type: "button",
11767
- disabled: apiManaged,
11869
+ "aria-expanded": alignmentOpen,
11870
+ onClick: () => setAlignmentOpen((open) => !open),
11871
+ children: english ? "Alignment" : "C\u0103n l\u1EC1"
11872
+ }),
11873
+ !apiManaged && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EditorButton, {
11874
+ type: "button",
11768
11875
  onClick: () => {
11769
11876
  setTagDraft("");
11770
11877
  setCreateTagOpen(true);
11771
11878
  },
11772
- children: "+ Th\xEAm tag"
11879
+ children: "+ Th\xEAm nh\xF3m"
11773
11880
  })
11774
11881
  ]
11775
11882
  }),
@@ -11792,14 +11899,18 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11792
11899
  })
11793
11900
  })
11794
11901
  }),
11795
- canEdit && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FeesColumnAlignmentControls, {
11796
- columns: value4.columns,
11797
- columnKey: selectedColumnKey,
11798
- english,
11799
- onSelectColumn: setSelectedColumnKey,
11800
- onChange: (textAlign) => {
11801
- if (selectedColumn) onChange?.(setFeesColumnAlignment(value4, selectedColumn.key, textAlign));
11802
- }
11902
+ canEdit && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_Collapse.default, {
11903
+ in: alignmentOpen,
11904
+ unmountOnExit: true,
11905
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FeesColumnAlignmentControls, {
11906
+ columns: value4.columns,
11907
+ columnKey: selectedColumnKey,
11908
+ english,
11909
+ onSelectColumn: setSelectedColumnKey,
11910
+ onChange: (textAlign) => {
11911
+ if (selectedColumn) onChange?.(setFeesColumnAlignment(value4, selectedColumn.key, textAlign));
11912
+ }
11913
+ })
11803
11914
  }),
11804
11915
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AlignedFeesTable, {
11805
11916
  $typography: value4.typography,
@@ -11813,7 +11924,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
11813
11924
  size,
11814
11925
  empty: labels2?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
11815
11926
  scroll: {
11816
- x: canEdit ? Math.max(1440, value4.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + 300) : visibleColumns.length * 170 + 8
11927
+ x: canEdit ? Math.max(apiManaged ? 900 : 1100, columns.reduce((sum, column) => sum + (typeof column.width === "number" ? column.width : 140), 0)) : visibleColumns.length * 170 + 8
11817
11928
  }
11818
11929
  })
11819
11930
  }),
@@ -12144,18 +12255,18 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
12144
12255
  children: [
12145
12256
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_DialogTitle.default, {
12146
12257
  id: `${dialogId}-create-tag-title`,
12147
- children: "T\u1EA1o tag m\u1EDBi"
12258
+ children: "T\u1EA1o nh\xF3m m\u1EDBi"
12148
12259
  }),
12149
12260
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_DialogContent.default, {
12150
12261
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_TextField2.default, {
12151
12262
  autoFocus: true,
12152
12263
  fullWidth: true,
12153
12264
  margin: "dense",
12154
- label: "T\xEAn tag",
12265
+ label: "T\xEAn nh\xF3m",
12155
12266
  value: tagDraft,
12156
12267
  onChange: (event) => setTagDraft(event.target.value),
12157
12268
  error: duplicateTag,
12158
- helperText: duplicateTag ? "Tag n\xE0y \u0111\xE3 t\u1ED3n t\u1EA1i." : "Tag m\u1EDBi s\u1EBD c\xF3 trong danh s\xE1ch ch\u1ECDn c\u1EE7a t\u1EA5t c\u1EA3 h\xE0ng.",
12269
+ helperText: duplicateTag ? "Nh\xF3m n\xE0y \u0111\xE3 t\u1ED3n t\u1EA1i." : "Nh\xF3m m\u1EDBi s\u1EBD c\xF3 trong danh s\xE1ch ch\u1ECDn c\u1EE7a t\u1EA5t c\u1EA3 h\xE0ng.",
12159
12270
  onKeyDown: (event) => {
12160
12271
  if (event.key === "Enter") {
12161
12272
  event.preventDefault();
@@ -12174,7 +12285,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
12174
12285
  variant: "contained",
12175
12286
  disabled: !newTagName || duplicateTag,
12176
12287
  onClick: createTag,
12177
- children: "T\u1EA1o tag"
12288
+ children: "T\u1EA1o nh\xF3m"
12178
12289
  })
12179
12290
  ]
12180
12291
  })
@@ -12226,7 +12337,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels: labels2,
12226
12337
  ]
12227
12338
  })
12228
12339
  });
12229
- }
12340
+ });
12230
12341
 
12231
12342
  // src/commodity-original/app/bang-phi-ky-quy/FeesAndMarginContent.tsx
12232
12343
  var import_jsx_runtime41 = require("react/jsx-runtime");
@@ -20171,4 +20282,3 @@ var wikexCmsBlocks = sourceCmsBlocks.map((block) => {
20171
20282
  wikexComponents,
20172
20283
  wikexPartnerBlocks
20173
20284
  });
20174
- //# sourceMappingURL=index.js.map