@kingteza/crud-component 1.41.0 → 1.42.0

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("antd"),j=require("../../locale/index.cjs.js"),h=require("../../common/error/ErrorBoundaryComponent.cjs.js"),s=require("../../util/CopyUtilComponent.cjs.js");function x({field:r,value:p}){var b;if(!p)return"-";if(r.multiple){const t=(Array.isArray(p)?p:p?[p]:[]).map(o=>{var y,i;const n=(y=r.tagRender)==null?void 0:y[o],a=j.tWithOrWithoutNS(((i=r==null?void 0:r.translation)==null?void 0:i[o??""])??o,void 0,o);return{tagProps:n,translatedValue:a,item:o}});if(typeof r.tagRender=="object")return e.jsx(s.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>t.map(({translatedValue:o,item:n})=>o??n).join(", "),children:e.jsx(h.ErrorBoundaryComponent,{children:e.jsx(c.Space,{wrap:!0,children:t.map(({tagProps:o,translatedValue:n,item:a},y)=>o?e.jsx(c.Tag,{color:o.color,children:n},y+a):n)})})});if(r!=null&&r.translation)return e.jsx(s.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>t.map(({translatedValue:o,item:n})=>o??n).join(", "),children:e.jsx(h.ErrorBoundaryComponent,{children:t==null?void 0:t.map(({translatedValue:o,item:n})=>o??n).join(", ")})});{const o=t.map(({translatedValue:n,item:a})=>n??a).join(", ");return e.jsx(c.Typography.Text,{copyable:s.copyableFn(r.copyable,o),children:o})}}const l=((b=r==null?void 0:r.translation)==null?void 0:b[p??""])??p,u=j.tWithOrWithoutNS(l,void 0,p);if(typeof r.tagRender=="object"){const t=r.tagRender[p];if(t)return e.jsx(s.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:u,children:e.jsx(c.Tag,{color:t.color,children:u})})}return e.jsx(c.Typography.Text,{copyable:s.copyableFn(r.copyable,u),children:u})}exports.CrudEnumCell=x;
@@ -0,0 +1,6 @@
1
+ import { EnumCrudField } from '../CrudComponent';
2
+ export type CrudEnumCellProps = {
3
+ field: EnumCrudField<{}>;
4
+ value: any;
5
+ };
6
+ export declare function CrudEnumCell({ field, value }: Readonly<CrudEnumCellProps>): import("react/jsx-runtime").JSX.Element | "-";
@@ -0,0 +1,60 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { Space as x, Tag as h, Typography as u } from "antd";
3
+ import { tWithOrWithoutNS as i } from "../../locale/index.es.js";
4
+ import { ErrorBoundaryComponent as g } from "../../common/error/ErrorBoundaryComponent.es.js";
5
+ import { CopyToClipboardButtonWrapper as m, copyableFn as j } from "../../util/CopyUtilComponent.es.js";
6
+ function B({ field: r, value: p }) {
7
+ var s;
8
+ if (!p) return "-";
9
+ if (r.multiple) {
10
+ const t = (Array.isArray(p) ? p : p ? [p] : []).map(
11
+ (o) => {
12
+ var y, b;
13
+ const n = (y = r.tagRender) == null ? void 0 : y[o], a = i(
14
+ ((b = r == null ? void 0 : r.translation) == null ? void 0 : b[o ?? ""]) ?? o,
15
+ void 0,
16
+ o
17
+ );
18
+ return {
19
+ tagProps: n,
20
+ translatedValue: a,
21
+ item: o
22
+ };
23
+ }
24
+ );
25
+ if (typeof r.tagRender == "object")
26
+ return /* @__PURE__ */ c(
27
+ m,
28
+ {
29
+ copyable: r.copyable,
30
+ value: () => t.map(({ translatedValue: o, item: n }) => o ?? n).join(", "),
31
+ children: /* @__PURE__ */ c(g, { children: /* @__PURE__ */ c(x, { wrap: !0, children: t.map(({ tagProps: o, translatedValue: n, item: a }, y) => o ? /* @__PURE__ */ c(h, { color: o.color, children: n }, y + a) : n) }) })
32
+ }
33
+ );
34
+ if (r != null && r.translation)
35
+ return /* @__PURE__ */ c(
36
+ m,
37
+ {
38
+ copyable: r.copyable,
39
+ value: () => t.map(({ translatedValue: o, item: n }) => o ?? n).join(", "),
40
+ children: /* @__PURE__ */ c(g, { children: t == null ? void 0 : t.map(
41
+ ({ translatedValue: o, item: n }) => o ?? n
42
+ ).join(", ") })
43
+ }
44
+ );
45
+ {
46
+ const o = t.map(({ translatedValue: n, item: a }) => n ?? a).join(", ");
47
+ return /* @__PURE__ */ c(u.Text, { copyable: j(r.copyable, o), children: o });
48
+ }
49
+ }
50
+ const l = ((s = r == null ? void 0 : r.translation) == null ? void 0 : s[p ?? ""]) ?? p, e = i(l, void 0, p);
51
+ if (typeof r.tagRender == "object") {
52
+ const t = r.tagRender[p];
53
+ if (t)
54
+ return /* @__PURE__ */ c(m, { copyable: r.copyable, value: e, children: /* @__PURE__ */ c(h, { color: t.color, children: e }) });
55
+ }
56
+ return /* @__PURE__ */ c(u.Text, { copyable: j(r.copyable, e), children: e });
57
+ }
58
+ export {
59
+ B as CrudEnumCell
60
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("@ant-design/icons"),b=require("antd"),B=require("../FileCrudField.cjs.js"),W=require("../ImageCrudField.cjs.js"),C=require("../../util/DateUtil.cjs.js"),v=require("../../util/NumberUtil.cjs.js"),T=require("../../locale/index.cjs.js"),F=require("../../util/CrudUtil.cjs.js"),h=require("../../common/error/ErrorBoundaryComponent.cjs.js"),i=require("../../util/CopyUtilComponent.cjs.js"),q=require("../../util/ObjectUtil.cjs.js");function S({type:d,render:e,...p}){try{return d==="object"?(o,n,a)=>t.jsx(i.CopyToClipboardButtonWrapper,{copyable:p.copyable,value:o,children:typeof e=="function"?e(o,n,a):""}):d==="select"?(o,n,a)=>{if(!o)return"-";const r=p,c=o||(r.items??[]).find(s=>s[r.innerFieldId??"key"]===q.getValueByPath(n,F.getRealName(p.name,"upsertFieldName"))),u=r.multiple?Array.isArray(c)?c.map(s=>s==null?void 0:s[r.innerFieldLabel??"name"]):void 0:c==null?void 0:c[r.innerFieldLabel??"value"];return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,u),children:typeof e=="function"?e(u,n,a):Array.isArray(u)?u.join(", "):u})}:d==="number"?(o,n,a)=>{const r=p;return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,o),children:typeof e=="function"?e(o,n,a):r.int?v.default.toInt(o,r.formatted):v.default.toMoney(o)})}:d==="enum"?(o,n,a)=>{var s;if(!o)return"-";const r=p;if(typeof e=="function")return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:e(o,n,a)});if(r.multiple){const f=(Array.isArray(o)?o:o?[o]:[]).map(l=>{var j,m;const y=(j=r.tagRender)==null?void 0:j[l],x=T.tWithOrWithoutNS(((m=r==null?void 0:r.translation)==null?void 0:m[l??""])??l,void 0,l);return{tagProps:y,translatedValue:x,item:l}});if(typeof r.tagRender=="object")return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>f.map(({translatedValue:l,item:y})=>l??y).join(", "),children:t.jsx(h.ErrorBoundaryComponent,{children:t.jsx(b.Space,{wrap:!0,children:f.map(({tagProps:l,translatedValue:y,item:x},j)=>l?t.jsx(b.Tag,{color:l.color,children:y},j+x):y)})})});if(r!=null&&r.translation)return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>f.map(({translatedValue:l,item:y})=>l??y).join(", "),children:t.jsx(h.ErrorBoundaryComponent,{children:f==null?void 0:f.map(({translatedValue:l,item:y})=>l??y).join(", ")})});{const l=f.map(({translatedValue:y,item:x})=>y??x).join(", ");return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,l),children:l})}}const c=((s=r==null?void 0:r.translation)==null?void 0:s[o??""])??o,u=T.tWithOrWithoutNS(c,void 0,o);if(typeof r.tagRender=="object"){const f=r.tagRender[o];if(f)return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:u,children:t.jsx(b.Tag,{color:f.color,children:u})})}return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,u),children:u})}:d==="date"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.formatTime?C.formatDateTime(o):C.formatDate(o);return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:c,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):c})})}:d==="checkbox"?(o,n,a)=>typeof e=="function"?e(o,n,a):o?t.jsx(g.CheckOutlined,{}):t.jsx(g.CloseOutlined,{}):d==="image"?(o,n,a)=>o?t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):t.jsx(W.ImageCrudCellValue,{value:o,provider:p.provider})}):"-":d==="file"?(o,n,a)=>o?t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):t.jsx(B.FileCrudCellValue,{value:o,provider:p.provider})}):"":d==="time"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.format,u=r.use12Hours,s=C.formatTime(o,c||(u?"hh:mm:ss A":void 0));return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:s,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):s})})}:d==="color"?(o,n,a)=>{const r=p;return o?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):typeof o=="string"&&o.startsWith("#")?t.jsx(b.Tooltip,{title:o,children:t.jsx(b.Avatar,{style:{backgroundColor:o}})}):String(o)})}):"-"}:d==="textarea"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.truncated??1,u=typeof o=="string"&&o.split(" ").length<10;return typeof e=="function"?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:e(o,n,a)}):c?t.jsx(h.ErrorBoundaryComponent,{children:t.jsx(b.Typography.Paragraph,{ellipsis:!u&&{rows:c===!0?1:c,expandable:"collapsible"},copyable:i.copyableFn(r.copyable,o),children:r.rich?t.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}}):o})}):r.rich?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:t.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}})}):t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:o})}:typeof e=="function"?e:(o,n,a)=>{const r=p;return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,o),children:o})}}catch(o){return console.warn("An error occurred while rendering the value for field: "+String(p.name),o),"-"}}exports.getRendererValueCrudViewer=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("@ant-design/icons"),y=require("antd"),C=require("../FileCrudField.cjs.js"),h=require("../ImageCrudField.cjs.js"),f=require("../../util/DateUtil.cjs.js"),m=require("../../util/NumberUtil.cjs.js"),x=require("../../util/CrudUtil.cjs.js"),d=require("../../common/error/ErrorBoundaryComponent.cjs.js"),u=require("../../util/CopyUtilComponent.cjs.js"),j=require("../../util/ObjectUtil.cjs.js"),v=require("./CrudEnumCell.cjs.js");function g({type:c,render:e,...i}){try{return c==="object"?(o,n,l)=>r.jsx(u.CopyToClipboardButtonWrapper,{copyable:i.copyable,value:o,children:typeof e=="function"?e(o,n,l):""}):c==="select"?(o,n,l)=>{if(!o)return"-";const t=i,a=o||(t.items??[]).find(s=>s[t.innerFieldId??"key"]===j.getValueByPath(n,x.getRealName(i.name,"upsertFieldName"))),p=t.multiple?Array.isArray(a)?a.map(s=>s==null?void 0:s[t.innerFieldLabel??"name"]):void 0:a==null?void 0:a[t.innerFieldLabel??"value"];return r.jsx(y.Typography.Text,{copyable:u.copyableFn(t.copyable,p),children:typeof e=="function"?e(p,n,l):Array.isArray(p)?p.join(", "):p})}:c==="number"?(o,n,l)=>{const t=i;return r.jsx(y.Typography.Text,{copyable:u.copyableFn(t.copyable,o),children:typeof e=="function"?e(o,n,l):t.int?m.default.toInt(o,t.formatted):m.default.toMoney(o)})}:c==="enum"?(o,n,l)=>{const t=i;return typeof e=="function"?o?r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:e(o,n,l)}):"-":r.jsx(v.CrudEnumCell,{field:t,value:o})}:c==="date"?(o,n,l)=>{if(!o)return"-";const t=i,a=t.formatTime?f.formatDateTime(o):f.formatDate(o);return r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:a,children:r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):a})})}:c==="checkbox"?(o,n,l)=>typeof e=="function"?e(o,n,l):o?r.jsx(b.CheckOutlined,{}):r.jsx(b.CloseOutlined,{}):c==="image"?(o,n,l)=>o?r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):r.jsx(h.ImageCrudCellValue,{value:o,provider:i.provider})}):"-":c==="file"?(o,n,l)=>o?r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):r.jsx(C.FileCrudCellValue,{value:o,provider:i.provider})}):"":c==="time"?(o,n,l)=>{if(!o)return"-";const t=i,a=t.format,p=t.use12Hours,s=f.formatTime(o,a||(p?"hh:mm:ss A":void 0));return r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:s,children:r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):s})})}:c==="color"?(o,n,l)=>{const t=i;return o?r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):typeof o=="string"&&o.startsWith("#")?r.jsx(y.Tooltip,{title:o,children:r.jsx(y.Avatar,{style:{backgroundColor:o}})}):String(o)})}):"-"}:c==="textarea"?(o,n,l)=>{if(!o)return"-";const t=i,a=t.truncated??1,p=typeof o=="string"&&o.split(" ").length<10;return typeof e=="function"?r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:e(o,n,l)}):a?r.jsx(d.ErrorBoundaryComponent,{children:r.jsx(y.Typography.Paragraph,{ellipsis:!p&&{rows:a===!0?1:a,expandable:"collapsible"},copyable:u.copyableFn(t.copyable,o),children:t.rich?r.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}}):o})}):t.rich?r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:r.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}})}):r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:o})}:typeof e=="function"?e:(o,n,l)=>{const t=i;return r.jsx(y.Typography.Text,{copyable:u.copyableFn(t.copyable,o),children:o})}}catch(o){return console.warn("An error occurred while rendering the value for field: "+String(i.name),o),"-"}}exports.getRendererValueCrudViewer=g;
@@ -1,171 +1,105 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { CheckOutlined as S, CloseOutlined as F } from "@ant-design/icons";
3
- import { Typography as h, Space as P, Tag as C, Tooltip as R, Avatar as V } from "antd";
4
- import { FileCrudCellValue as w } from "../FileCrudField.es.js";
5
- import { ImageCrudCellValue as I } from "../ImageCrudField.es.js";
6
- import T from "../../util/DateUtil.es.js";
7
- import j from "../../util/NumberUtil.es.js";
8
- import { tWithOrWithoutNS as A } from "../../locale/index.es.js";
9
- import k from "../../util/CrudUtil.es.js";
10
- import { ErrorBoundaryComponent as b } from "../../common/error/ErrorBoundaryComponent.es.js";
11
- import { CopyToClipboardButtonWrapper as m, copyableFn as d } from "../../util/CopyUtilComponent.es.js";
12
- import { getValueByPath as D } from "../../util/ObjectUtil.es.js";
13
- function J({
14
- type: y,
15
- render: e,
16
- ...u
2
+ import { CheckOutlined as d, CloseOutlined as v } from "@ant-design/icons";
3
+ import { Typography as y, Tooltip as g, Avatar as C } from "antd";
4
+ import { FileCrudCellValue as T } from "../FileCrudField.es.js";
5
+ import { ImageCrudCellValue as x } from "../ImageCrudField.es.js";
6
+ import b from "../../util/DateUtil.es.js";
7
+ import h from "../../util/NumberUtil.es.js";
8
+ import A from "../../util/CrudUtil.es.js";
9
+ import { ErrorBoundaryComponent as p } from "../../common/error/ErrorBoundaryComponent.es.js";
10
+ import { CopyToClipboardButtonWrapper as m, copyableFn as s } from "../../util/CopyUtilComponent.es.js";
11
+ import { getValueByPath as F } from "../../util/ObjectUtil.es.js";
12
+ import { CrudEnumCell as S } from "./CrudEnumCell.es.js";
13
+ function M({
14
+ type: c,
15
+ render: l,
16
+ ...a
17
17
  }) {
18
18
  try {
19
- return y === "object" ? (t, l, n) => /* @__PURE__ */ r(
19
+ return c === "object" ? (t, n, i) => /* @__PURE__ */ r(
20
20
  m,
21
21
  {
22
- copyable: u.copyable,
22
+ copyable: a.copyable,
23
23
  value: t,
24
- children: typeof e == "function" ? e(t, l, n) : ""
24
+ children: typeof l == "function" ? l(t, n, i) : ""
25
25
  }
26
- ) : y === "select" ? (t, l, n) => {
26
+ ) : c === "select" ? (t, n, i) => {
27
27
  if (!t) return "-";
28
- const o = u, a = t || (o.items ?? []).find(
29
- (f) => f[o.innerFieldId ?? "key"] === D(l, k.getRealName(u.name, "upsertFieldName"))
30
- ), c = o.multiple ? Array.isArray(a) ? a.map((f) => f == null ? void 0 : f[o.innerFieldLabel ?? "name"]) : void 0 : a == null ? void 0 : a[o.innerFieldLabel ?? "value"];
31
- return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, c), children: typeof e == "function" ? e(c, l, n) : Array.isArray(c) ? c.join(", ") : c });
32
- } : y === "number" ? (t, l, n) => {
33
- const o = u;
34
- return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, t), children: typeof e == "function" ? e(t, l, n) : o.int ? j.toInt(t, o.formatted) : j.toMoney(t) });
35
- } : y === "enum" ? (t, l, n) => {
36
- var f;
37
- if (!t) return "-";
38
- const o = u;
39
- if (typeof e == "function")
40
- return /* @__PURE__ */ r(
41
- m,
42
- {
43
- copyable: o.copyable,
44
- value: t,
45
- children: e(t, l, n)
46
- }
47
- );
48
- if (o.multiple) {
49
- const s = (Array.isArray(t) ? t : t ? [t] : []).map((i) => {
50
- var g, x;
51
- const p = (g = o.tagRender) == null ? void 0 : g[i], v = A(
52
- ((x = o == null ? void 0 : o.translation) == null ? void 0 : x[i ?? ""]) ?? i,
53
- void 0,
54
- i
55
- );
56
- return {
57
- tagProps: p,
58
- translatedValue: v,
59
- item: i
60
- };
61
- });
62
- if (typeof o.tagRender == "object")
63
- return /* @__PURE__ */ r(
64
- m,
65
- {
66
- copyable: o.copyable,
67
- value: () => s.map(
68
- ({ translatedValue: i, item: p }) => i ?? p
69
- ).join(", "),
70
- children: /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(P, { wrap: !0, children: s.map(({ tagProps: i, translatedValue: p, item: v }, g) => i ? /* @__PURE__ */ r(C, { color: i.color, children: p }, g + v) : p) }) })
71
- }
72
- );
73
- if (o != null && o.translation)
74
- return /* @__PURE__ */ r(
75
- m,
76
- {
77
- copyable: o.copyable,
78
- value: () => s.map(
79
- ({ translatedValue: i, item: p }) => i ?? p
80
- ).join(", "),
81
- children: /* @__PURE__ */ r(b, { children: s == null ? void 0 : s.map(
82
- ({ translatedValue: i, item: p }) => i ?? p
83
- ).join(", ") })
84
- }
85
- );
28
+ const o = a, e = t || (o.items ?? []).find(
29
+ (f) => f[o.innerFieldId ?? "key"] === F(n, A.getRealName(a.name, "upsertFieldName"))
30
+ ), u = o.multiple ? Array.isArray(e) ? e.map((f) => f == null ? void 0 : f[o.innerFieldLabel ?? "name"]) : void 0 : e == null ? void 0 : e[o.innerFieldLabel ?? "value"];
31
+ return /* @__PURE__ */ r(y.Text, { copyable: s(o.copyable, u), children: typeof l == "function" ? l(u, n, i) : Array.isArray(u) ? u.join(", ") : u });
32
+ } : c === "number" ? (t, n, i) => {
33
+ const o = a;
34
+ return /* @__PURE__ */ r(y.Text, { copyable: s(o.copyable, t), children: typeof l == "function" ? l(t, n, i) : o.int ? h.toInt(t, o.formatted) : h.toMoney(t) });
35
+ } : c === "enum" ? (t, n, i) => {
36
+ const o = a;
37
+ return typeof l == "function" ? t ? /* @__PURE__ */ r(
38
+ m,
86
39
  {
87
- const i = s.map(({ translatedValue: p, item: v }) => p ?? v).join(", ");
88
- return /* @__PURE__ */ r(
89
- h.Text,
90
- {
91
- copyable: d(o.copyable, i),
92
- children: i
93
- }
94
- );
40
+ copyable: o.copyable,
41
+ value: t,
42
+ children: l(t, n, i)
95
43
  }
96
- }
97
- const a = ((f = o == null ? void 0 : o.translation) == null ? void 0 : f[t ?? ""]) ?? t, c = A(a, void 0, t);
98
- if (typeof o.tagRender == "object") {
99
- const s = o.tagRender[t];
100
- if (s)
101
- return /* @__PURE__ */ r(
102
- m,
103
- {
104
- copyable: o.copyable,
105
- value: c,
106
- children: /* @__PURE__ */ r(C, { color: s.color, children: c })
107
- }
108
- );
109
- }
110
- return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, c), children: c });
111
- } : y === "date" ? (t, l, n) => {
44
+ ) : "-" : /* @__PURE__ */ r(S, { field: o, value: t });
45
+ } : c === "date" ? (t, n, i) => {
112
46
  if (!t) return "-";
113
- const o = u, a = o.formatTime ? T.formatDateTime(t) : T.formatDate(t);
47
+ const o = a, e = o.formatTime ? b.formatDateTime(t) : b.formatDate(t);
114
48
  return /* @__PURE__ */ r(
115
49
  m,
116
50
  {
117
51
  copyable: o.copyable,
118
- value: a,
119
- children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : a })
52
+ value: e,
53
+ children: /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : e })
120
54
  }
121
55
  );
122
- } : y === "checkbox" ? (t, l, n) => typeof e == "function" ? e(t, l, n) : t ? /* @__PURE__ */ r(S, {}) : /* @__PURE__ */ r(F, {}) : y === "image" ? (t, l, n) => t ? /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : /* @__PURE__ */ r(
123
- I,
56
+ } : c === "checkbox" ? (t, n, i) => typeof l == "function" ? l(t, n, i) : t ? /* @__PURE__ */ r(d, {}) : /* @__PURE__ */ r(v, {}) : c === "image" ? (t, n, i) => t ? /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : /* @__PURE__ */ r(
57
+ x,
124
58
  {
125
59
  value: t,
126
- provider: u.provider
60
+ provider: a.provider
127
61
  }
128
- ) }) : "-" : y === "file" ? (t, l, n) => t ? /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : /* @__PURE__ */ r(
129
- w,
62
+ ) }) : "-" : c === "file" ? (t, n, i) => t ? /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : /* @__PURE__ */ r(
63
+ T,
130
64
  {
131
65
  value: t,
132
- provider: u.provider
66
+ provider: a.provider
133
67
  }
134
- ) }) : "" : y === "time" ? (t, l, n) => {
68
+ ) }) : "" : c === "time" ? (t, n, i) => {
135
69
  if (!t) return "-";
136
- const o = u, a = o.format, c = o.use12Hours, f = T.formatTime(
70
+ const o = a, e = o.format, u = o.use12Hours, f = b.formatTime(
137
71
  t,
138
- a || (c ? "hh:mm:ss A" : void 0)
72
+ e || (u ? "hh:mm:ss A" : void 0)
139
73
  );
140
74
  return /* @__PURE__ */ r(
141
75
  m,
142
76
  {
143
77
  copyable: o.copyable,
144
78
  value: f,
145
- children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : f })
79
+ children: /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : f })
146
80
  }
147
81
  );
148
- } : y === "color" ? (t, l, n) => {
149
- const o = u;
150
- return t ? /* @__PURE__ */ r(m, { copyable: o.copyable, value: t, children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ r(R, { title: t, children: /* @__PURE__ */ r(V, { style: { backgroundColor: t } }) }) : String(t) }) }) : "-";
151
- } : y === "textarea" ? (t, l, n) => {
82
+ } : c === "color" ? (t, n, i) => {
83
+ const o = a;
84
+ return t ? /* @__PURE__ */ r(m, { copyable: o.copyable, value: t, children: /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ r(g, { title: t, children: /* @__PURE__ */ r(C, { style: { backgroundColor: t } }) }) : String(t) }) }) : "-";
85
+ } : c === "textarea" ? (t, n, i) => {
152
86
  if (!t) return "-";
153
- const o = u, a = o.truncated ?? 1, c = typeof t == "string" && t.split(" ").length < 10;
154
- return typeof e == "function" ? /* @__PURE__ */ r(
87
+ const o = a, e = o.truncated ?? 1, u = typeof t == "string" && t.split(" ").length < 10;
88
+ return typeof l == "function" ? /* @__PURE__ */ r(
155
89
  m,
156
90
  {
157
91
  copyable: o.copyable,
158
92
  value: t,
159
- children: e(t, l, n)
93
+ children: l(t, n, i)
160
94
  }
161
- ) : a ? /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
162
- h.Paragraph,
95
+ ) : e ? /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r(
96
+ y.Paragraph,
163
97
  {
164
- ellipsis: !c && {
165
- rows: a === !0 ? 1 : a,
98
+ ellipsis: !u && {
99
+ rows: e === !0 ? 1 : e,
166
100
  expandable: "collapsible"
167
101
  },
168
- copyable: d(o.copyable, t),
102
+ copyable: s(o.copyable, t),
169
103
  children: o.rich ? /* @__PURE__ */ r(
170
104
  "div",
171
105
  {
@@ -195,17 +129,17 @@ function J({
195
129
  children: t
196
130
  }
197
131
  );
198
- } : typeof e == "function" ? e : (t, l, n) => {
199
- const o = u;
200
- return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, t), children: t });
132
+ } : typeof l == "function" ? l : (t, n, i) => {
133
+ const o = a;
134
+ return /* @__PURE__ */ r(y.Text, { copyable: s(o.copyable, t), children: t });
201
135
  };
202
136
  } catch (t) {
203
137
  return console.warn(
204
- "An error occurred while rendering the value for field: " + String(u.name),
138
+ "An error occurred while rendering the value for field: " + String(a.name),
205
139
  t
206
140
  ), "-";
207
141
  }
208
142
  }
209
143
  export {
210
- J as getRendererValueCrudViewer
144
+ M as getRendererValueCrudViewer
211
145
  };
@@ -1,5 +1,7 @@
1
1
  export { CrudDecListView } from './CrudDecListView';
2
2
  export type { CrudDecListViewProps, DescListColumn } from './CrudDecListView';
3
+ export { CrudEnumCell } from './CrudEnumCell';
4
+ export type { CrudEnumCellProps } from './CrudEnumCell';
3
5
  export { default as CrudViewer } from './CrudViewer';
4
6
  export type { CrudViewerProps } from './CrudViewer';
5
7
  export { getRendererValueCrudViewer } from './CrudViewerUtil';
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const i=require("./locale/hooks/translation-constants.cjs.js"),u=require("./locale/index.cjs.js"),t=require("./crud/CrudComponent.cjs.js"),r=require("./crud/CrudField.cjs.js"),C=require("./crud/CrudFormWizard.cjs.js"),n=require("./crud/CrudReportComponent.cjs.js"),l=require("./crud/CrudSearchComponent.cjs.js"),e=require("./crud/ImageCrudField.cjs.js"),o=require("./crud/FileCrudField.cjs.js"),a=require("./crud/FileCrudDragNDropField.cjs.js"),s=require("./crud/CrudTextAreaComponent.cjs.js"),m=require("./crud/import/CrudImportComponent.cjs.js"),F=require("./crud/import/CrudImportButton.cjs.js"),p=require("./crud/actions/index.cjs.js"),c=require("./crud/view/CrudViewer.cjs.js"),q=require("./context/CrudComponentProvider.cjs.js"),d=require("./crud/CrudForm.cjs.js"),V=require("./crud/modal/index.cjs.js"),I=require("./crud/view/CrudDecListView.cjs.js"),g=require("./crud/view/CrudViewerUtil.cjs.js");exports.TRANSLATION_NAMESPACE=i.TRANSLATION_NAMESPACE;exports.setupI18n=u.setupI18n;exports.updateTranslations=u.updateTranslations;exports.CrudComponent=t;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=C;exports.CrudReportComponent=n;exports.CrudSearchComponent=l;exports.FileDownloadProvider=e.FileDownloadProvider;exports.FileUploadProvider=e.FileUploadProvider;exports.ImageCellValue=e.ImageCellValue;exports.ImageCrudCellValue=e.ImageCrudCellValue;exports.ImageCrudField=e.default;exports.FileCellValue=o.FileCellValue;exports.FileCrudCellValue=o.FileCrudCellValue;exports.FileCrudField=o.default;exports.FileCrudDragNDropField=a;exports.CrudTextAreaComponent=s;exports.CrudImportComponent=m;exports.CrudImportButton=F;exports.CrudActions=p.default;exports.CrudViewer=c;exports.CrudComponentProvider=q.CrudComponentProvider;exports.CrudForm=d.CrudForm;exports.CrudFormFields=d.CrudFormFields;exports.CrudModal=V;exports.CrudDecListView=I.CrudDecListView;exports.getRendererValueCrudViewer=g.getRendererValueCrudViewer;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const C=require("./locale/hooks/translation-constants.cjs.js"),u=require("./locale/index.cjs.js"),n=require("./crud/CrudComponent.cjs.js"),r=require("./crud/CrudField.cjs.js"),i=require("./crud/CrudFormWizard.cjs.js"),t=require("./crud/CrudReportComponent.cjs.js"),l=require("./crud/CrudSearchComponent.cjs.js"),e=require("./crud/ImageCrudField.cjs.js"),o=require("./crud/FileCrudField.cjs.js"),a=require("./crud/FileCrudDragNDropField.cjs.js"),m=require("./crud/CrudTextAreaComponent.cjs.js"),s=require("./crud/import/CrudImportComponent.cjs.js"),F=require("./crud/import/CrudImportButton.cjs.js"),p=require("./crud/actions/index.cjs.js"),c=require("./crud/view/CrudViewer.cjs.js"),q=require("./context/CrudComponentProvider.cjs.js"),d=require("./crud/CrudForm.cjs.js"),V=require("./crud/modal/index.cjs.js"),I=require("./crud/view/CrudDecListView.cjs.js"),g=require("./crud/view/CrudEnumCell.cjs.js"),A=require("./crud/view/CrudViewerUtil.cjs.js");exports.TRANSLATION_NAMESPACE=C.TRANSLATION_NAMESPACE;exports.setupI18n=u.setupI18n;exports.updateTranslations=u.updateTranslations;exports.CrudComponent=n;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=i;exports.CrudReportComponent=t;exports.CrudSearchComponent=l;exports.FileDownloadProvider=e.FileDownloadProvider;exports.FileUploadProvider=e.FileUploadProvider;exports.ImageCellValue=e.ImageCellValue;exports.ImageCrudCellValue=e.ImageCrudCellValue;exports.ImageCrudField=e.default;exports.FileCellValue=o.FileCellValue;exports.FileCrudCellValue=o.FileCrudCellValue;exports.FileCrudField=o.default;exports.FileCrudDragNDropField=a;exports.CrudTextAreaComponent=m;exports.CrudImportComponent=s;exports.CrudImportButton=F;exports.CrudActions=p.default;exports.CrudViewer=c;exports.CrudComponentProvider=q.CrudComponentProvider;exports.CrudForm=d.CrudForm;exports.CrudFormFields=d.CrudFormFields;exports.CrudModal=V;exports.CrudDecListView=I.CrudDecListView;exports.CrudEnumCell=g.CrudEnumCell;exports.getRendererValueCrudViewer=A.getRendererValueCrudViewer;
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* empty css */
2
2
  import { TRANSLATION_NAMESPACE as t } from "./locale/hooks/translation-constants.es.js";
3
- import { setupI18n as a, updateTranslations as l } from "./locale/index.es.js";
3
+ import { setupI18n as l, updateTranslations as u } from "./locale/index.es.js";
4
4
  import { default as m } from "./crud/CrudComponent.es.js";
5
5
  import { ColorCrudFieldComponent as p, default as f, SelectCrudFieldComponent as i } from "./crud/CrudField.es.js";
6
6
  import { default as x } from "./crud/CrudFormWizard.es.js";
@@ -8,7 +8,7 @@ import { default as F } from "./crud/CrudReportComponent.es.js";
8
8
  import { default as I } from "./crud/CrudSearchComponent.es.js";
9
9
  import { FileDownloadProvider as g, FileUploadProvider as c, ImageCellValue as w, ImageCrudCellValue as D, default as N } from "./crud/ImageCrudField.es.js";
10
10
  import { FileCellValue as S, FileCrudCellValue as T, default as v } from "./crud/FileCrudField.es.js";
11
- import { default as E } from "./crud/FileCrudDragNDropField.es.js";
11
+ import { default as R } from "./crud/FileCrudDragNDropField.es.js";
12
12
  import { default as M } from "./crud/CrudTextAreaComponent.es.js";
13
13
  import { default as z } from "./crud/import/CrudImportComponent.es.js";
14
14
  import { default as O } from "./crud/import/CrudImportButton.es.js";
@@ -18,13 +18,15 @@ import { CrudComponentProvider as k } from "./context/CrudComponentProvider.es.j
18
18
  import { CrudForm as y, CrudFormFields as G } from "./crud/CrudForm.es.js";
19
19
  import { default as J } from "./crud/modal/index.es.js";
20
20
  import { CrudDecListView as Q } from "./crud/view/CrudDecListView.es.js";
21
- import { getRendererValueCrudViewer as Y } from "./crud/view/CrudViewerUtil.es.js";
21
+ import { CrudEnumCell as Y } from "./crud/view/CrudEnumCell.es.js";
22
+ import { getRendererValueCrudViewer as $ } from "./crud/view/CrudViewerUtil.es.js";
22
23
  export {
23
24
  p as ColorCrudFieldComponent,
24
25
  W as CrudActions,
25
26
  m as CrudComponent,
26
27
  k as CrudComponentProvider,
27
28
  Q as CrudDecListView,
29
+ Y as CrudEnumCell,
28
30
  f as CrudField,
29
31
  y as CrudForm,
30
32
  G as CrudFormFields,
@@ -38,7 +40,7 @@ export {
38
40
  b as CrudViewer,
39
41
  S as FileCellValue,
40
42
  T as FileCrudCellValue,
41
- E as FileCrudDragNDropField,
43
+ R as FileCrudDragNDropField,
42
44
  v as FileCrudField,
43
45
  g as FileDownloadProvider,
44
46
  c as FileUploadProvider,
@@ -47,7 +49,7 @@ export {
47
49
  N as ImageCrudField,
48
50
  i as SelectCrudFieldComponent,
49
51
  t as TRANSLATION_NAMESPACE,
50
- Y as getRendererValueCrudViewer,
51
- a as setupI18n,
52
- l as updateTranslations
52
+ $ as getRendererValueCrudViewer,
53
+ l as setupI18n,
54
+ u as updateTranslations
53
55
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.41.0",
4
+ "version": "1.42.0",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",