@oliasoft-open-source/react-ui-library 5.16.0 → 5.17.0-beta-2
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/index.js +31 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8963,10 +8963,30 @@ const createDiffJson = (e, t, n) => {
|
|
|
8963
8963
|
oldJson: a,
|
|
8964
8964
|
newJson: o
|
|
8965
8965
|
};
|
|
8966
|
-
}
|
|
8966
|
+
};
|
|
8967
|
+
var humanize = (e) => e.replace(/\[\d+\]/g, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), formatValue = (e) => {
|
|
8968
|
+
if (e == null || e === "") return "empty";
|
|
8969
|
+
if (typeof e == "boolean") return e ? "true" : "false";
|
|
8970
|
+
if (typeof e == "string") return e;
|
|
8971
|
+
if (typeof e == "number") return String(e);
|
|
8972
|
+
if (Array.isArray(e)) return e.length ? e.join(", ") : "empty";
|
|
8973
|
+
try {
|
|
8974
|
+
return JSON.stringify(e);
|
|
8975
|
+
} catch {
|
|
8976
|
+
return String(e);
|
|
8977
|
+
}
|
|
8978
|
+
}, getChangedProperty = (e) => humanize(e.length > 0 ? e[e.length - 1] : ""), buildChangeSentence = ({ userName: e, type: t, property: n, before: r, after: i, sectionName: a }) => {
|
|
8979
|
+
let o = formatValue(r), s = formatValue(i);
|
|
8980
|
+
switch (t.toLowerCase()) {
|
|
8981
|
+
case "Modified": return `${e} updated ${n} from ${o} to ${s} in ${a}.`;
|
|
8982
|
+
case "Created": return s === "empty" ? `${e} created ${n} in ${a}.` : `${e} created ${n} with value ${s} in ${a}.`;
|
|
8983
|
+
case "Deleted": return o === "empty" ? `${e} deleted ${n} in ${a}.` : `${e} deleted ${n} (previously ${o}) in ${a}.`;
|
|
8984
|
+
default: return `${e} changed ${n} in ${a}.`;
|
|
8985
|
+
}
|
|
8986
|
+
};
|
|
8987
|
+
const ChangesOverview = ({ sectionNames: e, userName: t, diffs: n }) => /* @__PURE__ */ jsx(Table, { table: {
|
|
8967
8988
|
headers: [{ cells: [
|
|
8968
|
-
{ value: "
|
|
8969
|
-
{ value: "Type" },
|
|
8989
|
+
{ value: "Sentence" },
|
|
8970
8990
|
{ value: "Before" },
|
|
8971
8991
|
{ value: "After" },
|
|
8972
8992
|
{ value: "" }
|
|
@@ -8974,8 +8994,14 @@ const createDiffJson = (e, t, n) => {
|
|
|
8974
8994
|
rows: n.map((n) => {
|
|
8975
8995
|
let { deltaFormat: r, path: i } = n, a = getSectionName(e, i), { type: o, before: s, after: c } = defaultMessage(r);
|
|
8976
8996
|
return { cells: [
|
|
8977
|
-
{ value:
|
|
8978
|
-
|
|
8997
|
+
{ value: buildChangeSentence({
|
|
8998
|
+
userName: t,
|
|
8999
|
+
type: o,
|
|
9000
|
+
property: getChangedProperty(i),
|
|
9001
|
+
before: s,
|
|
9002
|
+
after: c,
|
|
9003
|
+
sectionName: a
|
|
9004
|
+
}) },
|
|
8979
9005
|
{ value: s },
|
|
8980
9006
|
{ value: c },
|
|
8981
9007
|
{ value: a }
|
package/package.json
CHANGED