@kingteza/crud-component 1.0.60 → 1.0.61

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
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),b=require("@ant-design/icons"),m=require("antd"),A=require("../../common/show-more/index.cjs.js"),F=require("../FileCrudField.cjs.js"),S=require("../ImageCrudField.cjs.js"),y=require("../../util/DateUtil.cjs.js"),q=require("../../util/NumberUtil.cjs.js"),j=require("../../locale/index.cjs.js"),T=require("../../util/CrudUtil.cjs.js");function R({type:u,render:e,...r}){try{return u==="object"?(t,i,o)=>typeof e=="function"?e(t,i,o):"":u==="select"?(t,i,o)=>{const n=r,a=t||(n.items??[]).find(s=>s[n.innerFieldId??"key"]===i[T.getRealName(r.name,"upsertFieldName")]),f=n.multiple?Array.isArray(a)?a.map(s=>s==null?void 0:s[n.innerFieldLabel??"name"]):void 0:a==null?void 0:a[n.innerFieldLabel??"value"];return typeof e=="function"?e(f,i,o):Array.isArray(f)?f.join(", "):f}:u==="number"?(t,i,o)=>typeof e=="function"?e(t,i,o):r!=null&&r.int?q.default.toInt(t,r.formatted):q.default.toMoney(t):u==="enum"?(t,i,o)=>{var s;const n=r;if(typeof e=="function")return e(t,i,o);if(n.multiple){const c=Array.isArray(t)?t:t?[t]:[];return typeof n.tagRender=="object"?l.jsx(m.Space,{wrap:!0,children:c.map((d,g)=>{var x,C;const v=(x=n.tagRender)==null?void 0:x[d],h=j.t(((C=n==null?void 0:n.translation)==null?void 0:C[d??""])??d);return v?l.jsx(m.Tag,{color:v.color,children:h},g+d):h})}):n!=null&&n.translation?c==null?void 0:c.map(d=>{var g;return j.t(((g=n==null?void 0:n.translation)==null?void 0:g[d??""])??d)}).join(", "):c==null?void 0:c.join(", ")}const a=((s=n==null?void 0:n.translation)==null?void 0:s[t??""])??t,f=j.t(a);if(typeof n.tagRender=="object"){const c=n.tagRender[t];if(c)return l.jsx(m.Tag,{color:c.color,children:f})}return f}:u==="date"?(t,i,o)=>{if(!t)return"-";const n=r!=null&&r.formatTime?y.formatDateTime(t):y.formatDate(t);return typeof e=="function"?e(t,i,o):n}:u==="checkbox"?(t,i,o)=>typeof e=="function"?e(t,i,o):t?l.jsx(b.CheckOutlined,{}):l.jsx(b.CloseOutlined,{}):u==="image"?(t,i,o)=>typeof e=="function"?e(t,i,o):l.jsx(S.ImageCrudCellValue,{value:t,provider:r.provider}):u==="file"?(t,i,o)=>typeof e=="function"?e(t,i,o):l.jsx(F.FileCrudCellValue,{value:t,provider:r.provider}):u==="time"?(t,i,o)=>{if(!t)return"-";const n=r==null?void 0:r.format,a=r==null?void 0:r.use12Hours,f=y.formatTime(t,n||(a?"hh:mm:ss A":void 0));return typeof e=="function"?e(t,i,o):f}:u==="color"?(t,i,o)=>typeof e=="function"?e(t,i,o):typeof t=="string"&&t.startsWith("#")?l.jsx(m.Tooltip,{title:t,children:l.jsx(m.Avatar,{style:{backgroundColor:t}})}):String(t):u==="textarea"?(t,i,o)=>{const n=r,a=n.truncated??1;return typeof e=="function"?e(t,i,o):a?l.jsx(A.ShowMore,{lines:a===!0?1:a,children:n.rich?l.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}):n.rich?l.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}:typeof e=="function"?e:(t,i,o)=>t}catch(t){return console.warn("An error occurred while rendering the value for field: "+String(r.name),t),"-"}}exports.getRendererValueCrudViewer=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),b=require("@ant-design/icons"),m=require("antd"),A=require("../../common/show-more/index.cjs.js"),F=require("../FileCrudField.cjs.js"),S=require("../ImageCrudField.cjs.js"),y=require("../../util/DateUtil.cjs.js"),q=require("../../util/NumberUtil.cjs.js"),j=require("../../locale/index.cjs.js"),T=require("../../util/CrudUtil.cjs.js");function R({type:l,render:e,...u}){try{return l==="object"?(t,i,r)=>typeof e=="function"?e(t,i,r):"":l==="select"?(t,i,r)=>{if(!t)return"-";const n=u,o=t||(n.items??[]).find(s=>s[n.innerFieldId??"key"]===i[T.getRealName(u.name,"upsertFieldName")]),f=n.multiple?Array.isArray(o)?o.map(s=>s==null?void 0:s[n.innerFieldLabel??"name"]):void 0:o==null?void 0:o[n.innerFieldLabel??"value"];return typeof e=="function"?e(f,i,r):Array.isArray(f)?f.join(", "):f}:l==="number"?(t,i,r)=>typeof e=="function"?e(t,i,r):u!=null&&u.int?q.default.toInt(t,u.formatted):q.default.toMoney(t):l==="enum"?(t,i,r)=>{var s;if(!t)return"-";const n=u;if(typeof e=="function")return e(t,i,r);if(n.multiple){const c=Array.isArray(t)?t:t?[t]:[];return typeof n.tagRender=="object"?a.jsx(m.Space,{wrap:!0,children:c.map((d,g)=>{var x,C;const v=(x=n.tagRender)==null?void 0:x[d],h=j.t(((C=n==null?void 0:n.translation)==null?void 0:C[d??""])??d);return v?a.jsx(m.Tag,{color:v.color,children:h},g+d):h})}):n!=null&&n.translation?c==null?void 0:c.map(d=>{var g;return j.t(((g=n==null?void 0:n.translation)==null?void 0:g[d??""])??d)}).join(", "):c==null?void 0:c.join(", ")}const o=((s=n==null?void 0:n.translation)==null?void 0:s[t??""])??t,f=j.t(o);if(typeof n.tagRender=="object"){const c=n.tagRender[t];if(c)return a.jsx(m.Tag,{color:c.color,children:f})}return f}:l==="date"?(t,i,r)=>{if(!t)return"-";const n=u!=null&&u.formatTime?y.formatDateTime(t):y.formatDate(t);return typeof e=="function"?e(t,i,r):n}:l==="checkbox"?(t,i,r)=>typeof e=="function"?e(t,i,r):t?a.jsx(b.CheckOutlined,{}):a.jsx(b.CloseOutlined,{}):l==="image"?(t,i,r)=>t?typeof e=="function"?e(t,i,r):a.jsx(S.ImageCrudCellValue,{value:t,provider:u.provider}):"-":l==="file"?(t,i,r)=>t?typeof e=="function"?e(t,i,r):a.jsx(F.FileCrudCellValue,{value:t,provider:u.provider}):"":l==="time"?(t,i,r)=>{if(!t)return"-";const n=u==null?void 0:u.format,o=u==null?void 0:u.use12Hours,f=y.formatTime(t,n||(o?"hh:mm:ss A":void 0));return typeof e=="function"?e(t,i,r):f}:l==="color"?(t,i,r)=>t?typeof e=="function"?e(t,i,r):typeof t=="string"&&t.startsWith("#")?a.jsx(m.Tooltip,{title:t,children:a.jsx(m.Avatar,{style:{backgroundColor:t}})}):String(t):"-":l==="textarea"?(t,i,r)=>{if(!t)return"-";const n=u,o=n.truncated??1;return typeof e=="function"?e(t,i,r):o?a.jsx(A.ShowMore,{lines:o===!0?1:o,children:n.rich?a.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}):n.rich?a.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}:typeof e=="function"?e:(t,i,r)=>t}catch(t){return console.warn("An error occurred while rendering the value for field: "+String(u.name),t),"-"}}exports.getRendererValueCrudViewer=R;
@@ -11,65 +11,68 @@ import x from "../../util/CrudUtil.es.js";
11
11
  function q({
12
12
  type: u,
13
13
  render: n,
14
- ...r
14
+ ...a
15
15
  }) {
16
16
  try {
17
- return u === "object" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : "" : u === "select" ? (t, o, a) => {
18
- const i = r, l = t || (i.items ?? []).find(
19
- (m) => m[i.innerFieldId ?? "key"] === o[x.getRealName(r.name, "upsertFieldName")]
20
- ), f = i.multiple ? Array.isArray(l) ? l.map((m) => m == null ? void 0 : m[i.innerFieldLabel ?? "name"]) : void 0 : l == null ? void 0 : l[i.innerFieldLabel ?? "value"];
21
- return typeof n == "function" ? n(f, o, a) : Array.isArray(f) ? f.join(", ") : f;
22
- } : u === "number" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : r != null && r.int ? j.toInt(t, r.formatted) : j.toMoney(t) : u === "enum" ? (t, o, a) => {
17
+ return u === "object" ? (t, o, r) => typeof n == "function" ? n(t, o, r) : "" : u === "select" ? (t, o, r) => {
18
+ if (!t) return "-";
19
+ const i = a, l = t || (i.items ?? []).find(
20
+ (m) => m[i.innerFieldId ?? "key"] === o[x.getRealName(a.name, "upsertFieldName")]
21
+ ), c = i.multiple ? Array.isArray(l) ? l.map((m) => m == null ? void 0 : m[i.innerFieldLabel ?? "name"]) : void 0 : l == null ? void 0 : l[i.innerFieldLabel ?? "value"];
22
+ return typeof n == "function" ? n(c, o, r) : Array.isArray(c) ? c.join(", ") : c;
23
+ } : u === "number" ? (t, o, r) => typeof n == "function" ? n(t, o, r) : a != null && a.int ? j.toInt(t, a.formatted) : j.toMoney(t) : u === "enum" ? (t, o, r) => {
23
24
  var m;
24
- const i = r;
25
+ if (!t) return "-";
26
+ const i = a;
25
27
  if (typeof n == "function")
26
- return n(t, o, a);
28
+ return n(t, o, r);
27
29
  if (i.multiple) {
28
- const c = Array.isArray(t) ? t : t ? [t] : [];
29
- return typeof i.tagRender == "object" ? /* @__PURE__ */ e(F, { wrap: !0, children: c.map((s, d) => {
30
+ const f = Array.isArray(t) ? t : t ? [t] : [];
31
+ return typeof i.tagRender == "object" ? /* @__PURE__ */ e(F, { wrap: !0, children: f.map((s, d) => {
30
32
  var b, A;
31
33
  const h = (b = i.tagRender) == null ? void 0 : b[s], v = y(
32
34
  ((A = i == null ? void 0 : i.translation) == null ? void 0 : A[s ?? ""]) ?? s
33
35
  );
34
36
  return h ? /* @__PURE__ */ e(C, { color: h.color, children: v }, d + s) : v;
35
- }) }) : i != null && i.translation ? c == null ? void 0 : c.map((s) => {
37
+ }) }) : i != null && i.translation ? f == null ? void 0 : f.map((s) => {
36
38
  var d;
37
39
  return y(((d = i == null ? void 0 : i.translation) == null ? void 0 : d[s ?? ""]) ?? s);
38
- }).join(", ") : c == null ? void 0 : c.join(", ");
40
+ }).join(", ") : f == null ? void 0 : f.join(", ");
39
41
  }
40
- const l = ((m = i == null ? void 0 : i.translation) == null ? void 0 : m[t ?? ""]) ?? t, f = y(l);
42
+ const l = ((m = i == null ? void 0 : i.translation) == null ? void 0 : m[t ?? ""]) ?? t, c = y(l);
41
43
  if (typeof i.tagRender == "object") {
42
- const c = i.tagRender[t];
43
- if (c)
44
- return /* @__PURE__ */ e(C, { color: c.color, children: f });
44
+ const f = i.tagRender[t];
45
+ if (f)
46
+ return /* @__PURE__ */ e(C, { color: f.color, children: c });
45
47
  }
46
- return f;
47
- } : u === "date" ? (t, o, a) => {
48
+ return c;
49
+ } : u === "date" ? (t, o, r) => {
48
50
  if (!t) return "-";
49
- const i = r != null && r.formatTime ? g.formatDateTime(t) : g.formatDate(t);
50
- return typeof n == "function" ? n(t, o, a) : i;
51
- } : u === "checkbox" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : t ? /* @__PURE__ */ e(S, {}) : /* @__PURE__ */ e(T, {}) : u === "image" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : /* @__PURE__ */ e(
51
+ const i = a != null && a.formatTime ? g.formatDateTime(t) : g.formatDate(t);
52
+ return typeof n == "function" ? n(t, o, r) : i;
53
+ } : u === "checkbox" ? (t, o, r) => typeof n == "function" ? n(t, o, r) : t ? /* @__PURE__ */ e(S, {}) : /* @__PURE__ */ e(T, {}) : u === "image" ? (t, o, r) => t ? typeof n == "function" ? n(t, o, r) : /* @__PURE__ */ e(
52
54
  k,
53
55
  {
54
56
  value: t,
55
- provider: r.provider
57
+ provider: a.provider
56
58
  }
57
- ) : u === "file" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : /* @__PURE__ */ e(
59
+ ) : "-" : u === "file" ? (t, o, r) => t ? typeof n == "function" ? n(t, o, r) : /* @__PURE__ */ e(
58
60
  V,
59
61
  {
60
62
  value: t,
61
- provider: r.provider
63
+ provider: a.provider
62
64
  }
63
- ) : u === "time" ? (t, o, a) => {
65
+ ) : "" : u === "time" ? (t, o, r) => {
64
66
  if (!t) return "-";
65
- const i = r == null ? void 0 : r.format, l = r == null ? void 0 : r.use12Hours, f = g.formatTime(
67
+ const i = a == null ? void 0 : a.format, l = a == null ? void 0 : a.use12Hours, c = g.formatTime(
66
68
  t,
67
69
  i || (l ? "hh:mm:ss A" : void 0)
68
70
  );
69
- return typeof n == "function" ? n(t, o, a) : f;
70
- } : u === "color" ? (t, o, a) => typeof n == "function" ? n(t, o, a) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ e(R, { title: t, children: /* @__PURE__ */ e(w, { style: { backgroundColor: t } }) }) : String(t) : u === "textarea" ? (t, o, a) => {
71
- const i = r, l = i.truncated ?? 1;
72
- return typeof n == "function" ? n(t, o, a) : l ? /* @__PURE__ */ e(I, { lines: l === !0 ? 1 : l, children: i.rich ? /* @__PURE__ */ e(
71
+ return typeof n == "function" ? n(t, o, r) : c;
72
+ } : u === "color" ? (t, o, r) => t ? typeof n == "function" ? n(t, o, r) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ e(R, { title: t, children: /* @__PURE__ */ e(w, { style: { backgroundColor: t } }) }) : String(t) : "-" : u === "textarea" ? (t, o, r) => {
73
+ if (!t) return "-";
74
+ const i = a, l = i.truncated ?? 1;
75
+ return typeof n == "function" ? n(t, o, r) : l ? /* @__PURE__ */ e(I, { lines: l === !0 ? 1 : l, children: i.rich ? /* @__PURE__ */ e(
73
76
  "div",
74
77
  {
75
78
  style: { all: "unset" },
@@ -82,10 +85,10 @@ function q({
82
85
  dangerouslySetInnerHTML: { __html: t }
83
86
  }
84
87
  ) : t;
85
- } : typeof n == "function" ? n : (t, o, a) => t;
88
+ } : typeof n == "function" ? n : (t, o, r) => t;
86
89
  } catch (t) {
87
90
  return console.warn(
88
- "An error occurred while rendering the value for field: " + String(r.name),
91
+ "An error occurred while rendering the value for field: " + String(a.name),
89
92
  t
90
93
  ), "-";
91
94
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.60",
4
+ "version": "1.0.61",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",