@oliasoft-open-source/react-ui-library 5.23.0-beta-20 → 5.23.0-beta-21

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.
@@ -1 +1 @@
1
- {"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../../../src/components/audit-log/audit-log.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAe,YAAY,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,QAAQ,GACR,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,aAAa,GAAG,KAAK,GAAG,WAAW,CAAC;AAE5E,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE5C,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,GAAG,EAAE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;IAChE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,GAAG,EAAE,CAAC;IAC1C,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC;CAChD;AAuCD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAiJ7C,CAAC"}
@@ -21,6 +21,7 @@ export declare const getSectionName: (sectionNames: ISectionName[], sectionPath:
21
21
  export declare const toText: (v: any) => string;
22
22
  export declare const defaultMessage: (deltaFormat: any[]) => DefaultMessage;
23
23
  export type JsonDelta = any;
24
+ export declare const getAuditLogDate: (log: AuditLogItem) => string | undefined;
24
25
  export declare const createDiffJson: (auditLog: AuditLogItem, auditLogs: AuditLogItem[], data: any) => {
25
26
  oldJson: string;
26
27
  newJson: string;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/audit-log/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA6DF,eAAO,MAAM,WAAW,GAAI,OAAO,GAAG,KAAG,YAexC,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,cAAc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G,GAAG,CAAC;AAoB5B,eAAO,MAAM,eAAe,GAAI,KAAK,YAAY,uBAA8B,CAAC;AAEhF,eAAO,MAAM,cAAc,GACzB,UAAU,YAAY,EACtB,WAAW,YAAY,EAAE,EACzB,MAAM,GAAG;;;CAgDV,CAAC"}
package/dist/index.js CHANGED
@@ -8753,30 +8753,35 @@ var Zd = ((e = {}) => Xd({
8753
8753
  after: ""
8754
8754
  };
8755
8755
  }
8756
- }, af = (e) => Array.isArray(e), of = (e, t) => t ? af(t) ? t.length === 0 ? e : t.reduce((e, t) => Zd.unpatch(zt(e), zt(t)), zt(e)) : Zd.unpatch(zt(e), zt(t)) : e, sf = (e, t, n) => {
8757
- let r = t.filter((t) => !!t.diffs && (t.createdAt || t.date) >= (e.createdAt || e.date)), i = Array(r.length + 1);
8758
- i[0] = zt(n);
8759
- let a = "", o = "";
8756
+ }, af = (e) => Array.isArray(e), of = (e, t) => t ? af(t) ? t.length === 0 ? e : t.reduce((e, t) => Zd.unpatch(zt(e), zt(t)), zt(e)) : Zd.unpatch(zt(e), zt(t)) : e, sf = (e) => e.createdAt || e.date, cf = (e, t, n) => {
8757
+ let r = sf(e);
8758
+ if (!r) throw Error(`Cannot create diff JSON: missing date for audit log ${e.id}`);
8759
+ let i = t.filter((e) => {
8760
+ let t = sf(e);
8761
+ return !!(e.diffs && t && t >= r);
8762
+ }), a = Array(i.length + 1);
8763
+ a[0] = zt(n);
8764
+ let o = "", s = "";
8760
8765
  try {
8761
- for (let e = 0; e < r.length; e++) {
8762
- var s, c;
8763
- let t = (s = (c = r[e]) == null ? void 0 : c.diffs) == null ? null : s;
8766
+ for (let e = 0; e < i.length; e++) {
8767
+ var c, l;
8768
+ let t = (c = (l = i[e]) == null ? void 0 : l.diffs) == null ? null : c;
8764
8769
  if (!t) {
8765
- i[e + 1] = i[e];
8770
+ a[e + 1] = a[e];
8766
8771
  continue;
8767
8772
  }
8768
- i[e + 1] = of(i[e], t);
8773
+ a[e + 1] = of(a[e], t);
8769
8774
  }
8770
- let e = r.length > 0 ? i[r.length - 1] : n, t = r.length > 0 ? i[r.length] : n;
8771
- a = JSON.stringify(t == null ? "" : t, null, 2), o = JSON.stringify(e == null ? "" : e, null, 2);
8775
+ let e = i.length > 0 ? a[i.length - 1] : n, t = i.length > 0 ? a[i.length] : n;
8776
+ o = JSON.stringify(t == null ? "" : t, null, 2), s = JSON.stringify(e == null ? "" : e, null, 2);
8772
8777
  } catch (e) {
8773
8778
  console.error("err", e);
8774
8779
  }
8775
8780
  return {
8776
- oldJson: a,
8777
- newJson: o
8781
+ oldJson: o,
8782
+ newJson: s
8778
8783
  };
8779
- }, cf = (e) => e.replace(/\[\d+\]/g, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), lf = (e) => {
8784
+ }, lf = (e) => e.replace(/\[\d+\]/g, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), uf = (e) => {
8780
8785
  if (e == null || e === "") return "empty";
8781
8786
  if (typeof e == "boolean") return e ? "true" : "false";
8782
8787
  if (typeof e == "string") return e;
@@ -8787,32 +8792,32 @@ var Zd = ((e = {}) => Xd({
8787
8792
  } catch {
8788
8793
  return String(e);
8789
8794
  }
8790
- }, uf = (e, t = e.length - 1) => {
8795
+ }, df = (e, t = e.length - 1) => {
8791
8796
  if (t >= e.length) return "Value";
8792
8797
  let n = e[t];
8793
- return !n || xn(n) ? uf(e, t - 1) : cf(n);
8794
- }, df = ({ userName: e, type: t, property: n, before: r, after: i, sectionName: a }) => {
8795
- let o = lf(r), s = lf(i), c = a ? ` in ${a}` : "";
8798
+ return !n || xn(n) ? df(e, t - 1) : lf(n);
8799
+ }, ff = ({ userName: e, type: t, property: n, before: r, after: i, sectionName: a }) => {
8800
+ let o = uf(r), s = uf(i), c = a ? ` in ${a}` : "";
8796
8801
  switch (t) {
8797
8802
  case "modified": return `${e} updated ${n} from ${o} to ${s}${c}.`;
8798
8803
  case "created": return `${e} created ${s}${c}.`;
8799
8804
  case "deleted": return `${e} deleted ${o}${c}.`;
8800
8805
  default: return `${e} changed ${n}${c}.`;
8801
8806
  }
8802
- }, ff = ({ sectionNames: e, userName: t, diffs: n }) => /* @__PURE__ */ R(qs, { table: {
8807
+ }, pf = ({ sectionNames: e, userName: t, diffs: n }) => /* @__PURE__ */ R(qs, { table: {
8803
8808
  headers: [{ cells: [{ value: "Changes" }] }],
8804
8809
  rows: n.map((n) => {
8805
8810
  let { deltaFormat: r, path: i } = n, a = tf(e, i), { type: o, before: s, after: c } = rf(r);
8806
- return { cells: [{ value: df({
8811
+ return { cells: [{ value: ff({
8807
8812
  userName: t,
8808
8813
  type: o,
8809
- property: uf(i),
8814
+ property: df(i),
8810
8815
  before: s,
8811
8816
  after: c,
8812
8817
  sectionName: a
8813
8818
  }) }] };
8814
8819
  })
8815
- } }), pf = Object.freeze({
8820
+ } }), mf = Object.freeze({
8816
8821
  summary: {
8817
8822
  label: "Summary",
8818
8823
  value: "summary"
@@ -8821,7 +8826,7 @@ var Zd = ((e = {}) => Xd({
8821
8826
  label: "Compare",
8822
8827
  value: "compare"
8823
8828
  }
8824
- }), mf = (e) => {
8829
+ }), hf = (e) => {
8825
8830
  let t = ["user", "unittemplate"], n = [], r = [], i = (e) => {
8826
8831
  e && Object.keys(e).forEach((a) => {
8827
8832
  t.includes(a) || (r.push(a), Wt(e[a]) ? n.push({
@@ -8831,13 +8836,13 @@ var Zd = ((e = {}) => Xd({
8831
8836
  });
8832
8837
  };
8833
8838
  return e ? (i(e), n) : [];
8834
- }, hf = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, sectionNames: i, onClose: a }) => {
8835
- let o = [pf.summary, pf.compare].map(({ label: e, value: t }) => ({
8839
+ }, gf = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, sectionNames: i, onClose: a }) => {
8840
+ let o = [mf.summary, mf.compare].map(({ label: e, value: t }) => ({
8836
8841
  label: e,
8837
8842
  value: t
8838
8843
  })), [s, c] = m(o[0]), { diffs: l = void 0 } = e || {};
8839
8844
  if (!l) return null;
8840
- let { oldJson: u, newJson: d } = sf(e, t, n);
8845
+ let { oldJson: u, newJson: d } = cf(e, t, n);
8841
8846
  return /* @__PURE__ */ R(Ca, {
8842
8847
  visible: r,
8843
8848
  centered: !0,
@@ -8849,10 +8854,10 @@ var Zd = ((e = {}) => Xd({
8849
8854
  onChange: (e) => c(o.find((t) => t.value === e.target.value)),
8850
8855
  options: o,
8851
8856
  value: s
8852
- }), s.value === "summary" ? /* @__PURE__ */ R(ff, {
8857
+ }), s.value === "summary" ? /* @__PURE__ */ R(pf, {
8853
8858
  userName: e.userName,
8854
8859
  sectionNames: i,
8855
- diffs: mf(l)
8860
+ diffs: hf(l)
8856
8861
  }) : /* @__PURE__ */ R(ad, {
8857
8862
  oldJson: u,
8858
8863
  newJson: d
@@ -8866,7 +8871,7 @@ var Zd = ((e = {}) => Xd({
8866
8871
  height: "90vh"
8867
8872
  } })
8868
8873
  });
8869
- }, gf = [
8874
+ }, _f = [
8870
8875
  {
8871
8876
  label: "10 / page",
8872
8877
  value: 10
@@ -8879,7 +8884,7 @@ var Zd = ((e = {}) => Xd({
8879
8884
  label: "50 / page",
8880
8885
  value: 50
8881
8886
  }
8882
- ], _f = (e) => e.createdAt || e.date, vf = (e) => {
8887
+ ], vf = (e) => {
8883
8888
  let { diffs: t, userName: n, source: r, operation: i, operationMetaData: a } = e, o = ef(t).total, s = o ? `${o} change${o === 1 ? "" : "s"}` : "no field changes";
8884
8889
  if (r === "API") return i === "Created" ? "Created through API" : "Changed through API";
8885
8890
  switch (i) {
@@ -8929,7 +8934,7 @@ var Zd = ((e = {}) => Xd({
8929
8934
  },
8930
8935
  {
8931
8936
  value: od({
8932
- date: _f(e),
8937
+ date: sf(e),
8933
8938
  showTime: !0
8934
8939
  }),
8935
8940
  type: "Static"
@@ -8971,14 +8976,14 @@ var Zd = ((e = {}) => Xd({
8971
8976
  onChange: (e) => {
8972
8977
  c(Number(e.target.value));
8973
8978
  },
8974
- options: gf,
8979
+ options: _f,
8975
8980
  value: a
8976
8981
  },
8977
8982
  onSelectPage: (e) => l(e),
8978
8983
  small: !0
8979
8984
  } }
8980
8985
  } })
8981
- }), h && _ && _.diffs && /* @__PURE__ */ R(hf, {
8986
+ }), h && _ && _.diffs && /* @__PURE__ */ R(gf, {
8982
8987
  sectionNames: o,
8983
8988
  isOpen: h,
8984
8989
  onClose: () => g(!1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.23.0-beta-20",
3
+ "version": "5.23.0-beta-21",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {