@atomsolution/sdk-merchant 1.6.11 → 1.6.12
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/batch-product-creation/components/merchant-batch-create-form/merge-and-check-data.d.ts +1 -1
- package/dist/batch-product-creation.cjs +45 -21
- package/dist/batch-product-creation.cjs.map +1 -1
- package/dist/batch-product-creation.esm.js +45 -21
- package/dist/batch-product-creation.esm.js.map +1 -1
- package/dist/batch-product-creation.js +45 -21
- package/dist/batch-product-creation.js.map +1 -1
- package/dist/style.css +3 -15
- package/package.json +1 -1
|
@@ -26830,16 +26830,8 @@ function MergeAndCheckData({ taxDeductionMethod }) {
|
|
|
26830
26830
|
} = useUploadStore();
|
|
26831
26831
|
const normalize = (str) => str.replace(/\r?\n|\r|\t/g, "").trim();
|
|
26832
26832
|
let sheetHeaders = sheetData[0] || [];
|
|
26833
|
-
sheetHeaders = sheetHeaders.map(
|
|
26834
|
-
|
|
26835
|
-
);
|
|
26836
|
-
const {
|
|
26837
|
-
mappings,
|
|
26838
|
-
setMappings,
|
|
26839
|
-
defaultMappings,
|
|
26840
|
-
setDefaultMappings,
|
|
26841
|
-
resetMappings
|
|
26842
|
-
} = useMappingStore();
|
|
26833
|
+
sheetHeaders = sheetHeaders.map((h) => typeof h === "string" ? normalize(h) : h);
|
|
26834
|
+
const { mappings, setMappings, defaultMappings, setDefaultMappings, resetMappings } = useMappingStore();
|
|
26843
26835
|
const isMappableField = (field) => !EXCLUDED_SYSTEM_FIELDS.includes(field);
|
|
26844
26836
|
React.useEffect(() => {
|
|
26845
26837
|
if (sheetHeaders.length > 0 && Object.keys(defaultMappings).length === 0) {
|
|
@@ -26874,9 +26866,7 @@ function MergeAndCheckData({ taxDeductionMethod }) {
|
|
|
26874
26866
|
if (taxNumber === 0) {
|
|
26875
26867
|
priceBeforeTax = Math.round(priceAfterTaxNumber);
|
|
26876
26868
|
} else {
|
|
26877
|
-
priceBeforeTax = Math.round(
|
|
26878
|
-
priceAfterTaxNumber / (1 + taxNumber / 100)
|
|
26879
|
-
);
|
|
26869
|
+
priceBeforeTax = Math.round(priceAfterTaxNumber / (1 + taxNumber / 100));
|
|
26880
26870
|
}
|
|
26881
26871
|
}
|
|
26882
26872
|
return {
|
|
@@ -27008,17 +26998,51 @@ function MergeAndCheckData({ taxDeductionMethod }) {
|
|
|
27008
26998
|
] })
|
|
27009
26999
|
] }),
|
|
27010
27000
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "w-full px-4 py-4 max-h-[540px] overflow-auto rounded bg-[#F9FAFB]", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("div", { className: "rounded-xl p-4 bg-white", children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("table", { className: "min-w-full text-xs border-separate border-spacing-0", children: [
|
|
27011
|
-
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.
|
|
27012
|
-
|
|
27013
|
-
|
|
27014
|
-
|
|
27015
|
-
|
|
27016
|
-
|
|
27017
|
-
|
|
27001
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("colgroup", { children: (() => {
|
|
27002
|
+
const propMap = {
|
|
27003
|
+
0: "code",
|
|
27004
|
+
1: "name",
|
|
27005
|
+
2: "priceBeforeTax",
|
|
27006
|
+
3: "tax",
|
|
27007
|
+
4: "priceAfterTax",
|
|
27008
|
+
5: "unit",
|
|
27009
|
+
6: "category"
|
|
27010
|
+
};
|
|
27011
|
+
const getCellString = (row, fieldIndex) => {
|
|
27012
|
+
const prop = propMap[fieldIndex];
|
|
27013
|
+
if (!prop) return "";
|
|
27014
|
+
const val = row[prop];
|
|
27015
|
+
if (fieldIndex === 2 || fieldIndex === 4) {
|
|
27016
|
+
return typeof val === "number" ? formatVND(val) : String(val != null ? val : "");
|
|
27017
|
+
}
|
|
27018
|
+
if (fieldIndex === 3) {
|
|
27019
|
+
return typeof val === "number" ? val + "%" : String(val != null ? val : "");
|
|
27020
|
+
}
|
|
27021
|
+
return String(val != null ? val : "");
|
|
27022
|
+
};
|
|
27023
|
+
const columnWeights = visibleSystemFields.map((field) => {
|
|
27024
|
+
const fieldIndex = systemFields.indexOf(field);
|
|
27025
|
+
let maxLen = field.length;
|
|
27026
|
+
filteredRows.forEach((row) => {
|
|
27027
|
+
const cellStr = getCellString(row, fieldIndex);
|
|
27028
|
+
if (cellStr.length > maxLen) {
|
|
27029
|
+
maxLen = cellStr.length;
|
|
27030
|
+
}
|
|
27031
|
+
});
|
|
27032
|
+
let weight = Math.sqrt(maxLen);
|
|
27033
|
+
if (fieldIndex === 0 || fieldIndex === 1) weight *= 1.2;
|
|
27034
|
+
return weight;
|
|
27035
|
+
});
|
|
27036
|
+
const totalWeight = columnWeights.reduce((a2, b) => a2 + b, 0);
|
|
27037
|
+
return visibleSystemFields.map((_, index2) => {
|
|
27038
|
+
const width = `${columnWeights[index2] / totalWeight * 100}%`;
|
|
27039
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("col", { style: { width } }, index2);
|
|
27040
|
+
});
|
|
27041
|
+
})() }),
|
|
27018
27042
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("tr", { children: visibleSystemFields.map((field) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
27019
27043
|
"th",
|
|
27020
27044
|
{
|
|
27021
|
-
className: "px-2 py-3 text-left font-semibold text-[14px] text-[#475467] border-b",
|
|
27045
|
+
className: "px-2 py-3 text-left font-semibold text-[14px] text-[#475467] border-b whitespace-nowrap",
|
|
27022
27046
|
children: field
|
|
27023
27047
|
},
|
|
27024
27048
|
field
|