@oliasoft-open-source/react-ui-library 5.16.0 → 5.17.0-beta-1
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 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8963,23 +8963,39 @@ const createDiffJson = (e, t, n) => {
|
|
|
8963
8963
|
oldJson: a,
|
|
8964
8964
|
newJson: o
|
|
8965
8965
|
};
|
|
8966
|
-
}
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
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: {
|
|
8988
|
+
headers: [{ cells: [{ value: "Type" }] }],
|
|
8974
8989
|
rows: n.map((n) => {
|
|
8975
8990
|
let { deltaFormat: r, path: i } = n, a = getSectionName(e, i), { type: o, before: s, after: c } = defaultMessage(r);
|
|
8976
|
-
return { cells: [
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8991
|
+
return { cells: [{ value: buildChangeSentence({
|
|
8992
|
+
userName: t,
|
|
8993
|
+
type: o,
|
|
8994
|
+
property: getChangedProperty(i),
|
|
8995
|
+
before: s,
|
|
8996
|
+
after: c,
|
|
8997
|
+
sectionName: a
|
|
8998
|
+
}) }] };
|
|
8983
8999
|
})
|
|
8984
9000
|
} }), viewTypes = Object.freeze({
|
|
8985
9001
|
summary: {
|
package/package.json
CHANGED