@kingteza/crud-component 1.0.29 → 1.0.30

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.
Files changed (42) hide show
  1. package/crud/CrudComponent.cjs +1 -0
  2. package/crud/CrudComponent.d.ts +237 -0
  3. package/crud/CrudComponent.js +210 -0
  4. package/crud/CrudField.cjs +1 -0
  5. package/crud/CrudField.d.ts +4 -0
  6. package/crud/CrudField.js +459 -0
  7. package/crud/CrudForm.cjs +1 -0
  8. package/crud/CrudForm.d.ts +14 -0
  9. package/crud/CrudForm.js +91 -0
  10. package/crud/CrudFormWizard.cjs +1 -0
  11. package/crud/CrudFormWizard.d.ts +14 -0
  12. package/crud/CrudFormWizard.js +140 -0
  13. package/crud/CrudReportComponent.cjs +4 -0
  14. package/crud/CrudReportComponent.d.ts +44 -0
  15. package/crud/CrudReportComponent.js +255 -0
  16. package/crud/CrudSearchComponent.cjs +1 -0
  17. package/crud/CrudSearchComponent.d.ts +21 -0
  18. package/crud/CrudSearchComponent.js +95 -0
  19. package/crud/FileCrudField.cjs +1 -0
  20. package/crud/FileCrudField.d.ts +25 -0
  21. package/crud/FileCrudField.js +220 -0
  22. package/crud/ImageCrudField.cjs +1 -0
  23. package/crud/ImageCrudField.d.ts +38 -0
  24. package/crud/ImageCrudField.js +113 -0
  25. package/crud/import/CrudImportButton.cjs +1 -0
  26. package/crud/import/CrudImportButton.d.ts +3 -0
  27. package/crud/import/CrudImportButton.js +31 -0
  28. package/crud/import/CrudImportComponent.cjs +2 -0
  29. package/crud/import/CrudImportComponent.d.ts +14 -0
  30. package/crud/import/CrudImportComponent.js +223 -0
  31. package/crud/index.d.ts +15 -0
  32. package/crud/view/CrudDecListView.cjs +1 -0
  33. package/crud/view/CrudDecListView.d.ts +14 -0
  34. package/crud/view/CrudDecListView.js +42 -0
  35. package/crud/view/CrudViewer.cjs +1 -0
  36. package/crud/view/CrudViewer.d.ts +43 -0
  37. package/crud/view/CrudViewer.js +217 -0
  38. package/crud/view/CrudViewerUtil.cjs +1 -0
  39. package/crud/view/CrudViewerUtil.d.ts +2 -0
  40. package/crud/view/CrudViewerUtil.js +57 -0
  41. package/crud/view/index.d.ts +5 -0
  42. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),q=require("../../common/description/DescList.cjs"),C=require("react"),f=require("react-i18next"),x=require("../../locale/hooks/translation-constants.cjs"),V=require("./CrudViewerUtil.cjs");function a({className:l,fields:u,data:e,descListColumn:c={xs:1,md:3,sm:2,lg:4},layout:m,action:t,keepEmptyValues:b}){const{t:i}=f.useTranslation(x.TRANSLATION_NAMESPACE),g=C.useMemo(()=>{const o=u.filter(({hidden:r,hideInDescList:s})=>!r&&!s).map((r,s)=>({label:r.label,noFormatting:!0,value:V.getRendererValueCrudViewer(r)(e==null?void 0:e[r.name],e,s)}));return t&&o.push({label:i("str.action"),value:t}),o},[t,e,u,i]);return e?n.jsx(q,{keepEmptyValues:b,bordered:!0,column:c,className:l,layout:m,list:g}):n.jsx(n.Fragment,{})}exports.CrudDecListView=a;
@@ -0,0 +1,14 @@
1
+ import { Breakpoint } from 'antd';
2
+ import { default as React } from 'react';
3
+ import { CrudFieldProps } from '../CrudComponent';
4
+ export type DescListColumn = number | Partial<Record<Breakpoint, number>> | undefined;
5
+ export interface CrudDecListViewProps<T> {
6
+ fields: CrudFieldProps<T>[];
7
+ data: T | undefined;
8
+ className?: string;
9
+ descListColumn?: DescListColumn;
10
+ layout?: "horizontal" | "vertical";
11
+ action?: React.JSX.Element;
12
+ keepEmptyValues?: boolean;
13
+ }
14
+ export declare function CrudDecListView<T>({ className, fields, data, descListColumn, layout, action, keepEmptyValues, }: CrudDecListViewProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { jsx as l, Fragment as b } from "react/jsx-runtime";
2
+ import g from "../../common/description/DescList.js";
3
+ import { useMemo as A } from "react";
4
+ import { useTranslation as x } from "react-i18next";
5
+ import { TRANSLATION_NAMESPACE as C } from "../../locale/hooks/translation-constants.js";
6
+ import { getRendererValueCrudViewer as L } from "./CrudViewerUtil.js";
7
+ function E({
8
+ className: n,
9
+ fields: t,
10
+ data: r,
11
+ descListColumn: u = { xs: 1, md: 3, sm: 2, lg: 4 },
12
+ layout: f,
13
+ action: o,
14
+ keepEmptyValues: p
15
+ }) {
16
+ const { t: i } = x(C), c = A(() => {
17
+ const s = t.filter(({ hidden: e, hideInDescList: m }) => !e && !m).map((e, m) => ({
18
+ label: e.label,
19
+ noFormatting: !0,
20
+ value: L(e)(
21
+ r == null ? void 0 : r[e.name],
22
+ r,
23
+ m
24
+ )
25
+ }));
26
+ return o && s.push({ label: i("str.action"), value: o }), s;
27
+ }, [o, r, t, i]);
28
+ return r ? /* @__PURE__ */ l(
29
+ g,
30
+ {
31
+ keepEmptyValues: p,
32
+ bordered: !0,
33
+ column: u,
34
+ className: n,
35
+ layout: f,
36
+ list: c
37
+ }
38
+ ) : /* @__PURE__ */ l(b, {});
39
+ }
40
+ export {
41
+ E as CrudDecListView
42
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("react/jsx-runtime"),k=require("antd"),H=require("../../common/button/CloneButtonTable.cjs"),p=require("../../common/button/DeleteButtonTable.cjs"),U=require("../../common/button/ExportButton.cjs"),F=require("../../common/button/HideButtonTable.cjs"),rr=require("../../common/button/RefreshButton.cjs"),er=require("../../common/button/UpdateButtonTable.cjs"),tr=require("../../common/button/ViewButtonTable.cjs"),sr=require("../../common/layout/VerticalSpace.cjs"),ur=require("../../common/table/table.cjs"),j=require("react"),nr=require("react-i18next"),or=require("../../locale/hooks/translation-constants.cjs"),cr=require("../CrudSearchComponent.cjs"),lr=require("./CrudDecListView.cjs"),O=require("./CrudViewerUtil.cjs");function ar({idField:s="id",loadingData:z,fields:l,isDeleting:T,isHiding:m,viewable:o=!1,paginateProps:h,onDelete:q,onHide:y,onUpdate:v,data:x=[],extraAction:i,onClickUpdate:c,minusHeight:R,scroll:_,onClickClone:B,className:$,expandable:w,size:A,bordered:G,descListColumn:J,extraView:S,decListLayout:K,scrollToTop:jr,onClickRefresh:I,closeViewOnClickUpdate:V,onExport:g,confirmHiding:M,confirmDeleting:d,rowClassName:Q,actionWidth:W=190,...X}){const{t:Y}=nr.useTranslation(or.TRANSLATION_NAMESPACE),E=j.useMemo(()=>l.map(({hideInTable:e,hidden:t,width:a,name:n,label:D,halign:P,...N})=>({title:D,width:a,key:n,dataIndex:n,hidden:e||t,align:P??(N.type==="number"?"right":void 0),render:O.getRendererValueCrudViewer(N)})),[l]),[u,f]=j.useState(),[b,C]=j.useState();j.useEffect(()=>{x&&f(e=>{if(e)return x.find(t=>t[s]===e[s])})},[x,s,u]);const L=j.useCallback(e=>{var a;const t=i==null?void 0:i(e);return(Array.isArray(t)?(a=t==null?void 0:t.filter(Boolean))!=null&&a.length:t)||v||c||B||q?r.jsxs(r.Fragment,{children:[t,(v||c)&&r.jsx(er,{value:e,onClick:n=>{C(n[s]),c==null||c(e),V&&f(void 0)}}),B&&r.jsx(H,{value:e,onClick:n=>B(n)}),g&&r.jsx(U.ExportButton,{value:e,onClick:async n=>await g(n)}),y&&r.jsx(F,{value:e,disabled:m,shouldConfirm:M,loading:m&&e[s]===b,onClick:async n=>{C(n[s]),await y({[s]:n[s]})}}),q&&r.jsx(p,{value:e,disabled:T,shouldConfirm:d,loading:T&&e[s]===b,onClick:async n=>{C(n[s]),await q({[s]:n[s]})}})]}):void 0},[V,d,M,i,s,T,m,B,c,q,g,y,v,b]),Z=j.useMemo(()=>{let e=typeof o=="string"?u==null?void 0:u[o]:void 0;if(typeof e=="object"){const t=l.find(a=>a.name===o);e=O.getRendererValueCrudViewer(t)(e,u,0)}return e},[o,u,l]);return r.jsxs("div",{children:[o&&r.jsx(k.Modal,{width:"100%",open:!!u,title:Z??r.jsx("div",{children:" "}),footer:r.jsx(r.Fragment,{}),closable:!0,onCancel:()=>f(void 0),children:!!u&&r.jsxs("div",{children:[r.jsx(lr.CrudDecListView,{layout:K,descListColumn:J,data:u,fields:l,action:L(u)}),S==null?void 0:S(u)]},u==null?void 0:u[s])}),r.jsx(cr,{fields:l,...X}),r.jsxs(sr,{children:[!!I&&r.jsx(rr.RefreshButton,{onClick:I}),r.jsx(ur,{rowClassName:Q,className:$,scroll:_??(R?{y:`calc(100vh - ${R})`}:void 0),id:"crud-table",dataSource:x,loading:z,bordered:G,size:A,expandable:w,pagination:h?{total:h.count,onChange:h.setPage,current:h.page,pageSize:h.pageSize}:void 0,columns:v||c||q||i||o?[...E,{title:Y("str.action"),dataIndex:"",fixed:"right",width:W,render:(e,t)=>r.jsxs(r.Fragment,{children:[o&&r.jsx(tr,{value:t,onClick:f}),L(t)]})}]:E})]})]})}module.exports=ar;
@@ -0,0 +1,43 @@
1
+ import { SizeType } from 'antd/es/config-provider/SizeContext';
2
+ import { ExpandableConfig } from 'antd/es/table/interface';
3
+ import { TableProps } from 'antd/lib';
4
+ import { default as React, ReactElement } from 'react';
5
+ import { default as IdProps } from 'types/Id';
6
+ import { CrudFieldProps, CrudPaginateProps } from '../CrudComponent';
7
+ import { CrudSearchComponentProps } from '../CrudSearchComponent';
8
+ import { DescListColumn } from './CrudDecListView';
9
+ export type CrudViewerProps<T, FormType> = {
10
+ fields: CrudFieldProps<T>[];
11
+ decListLayout?: "horizontal" | "vertical";
12
+ viewable?: boolean | keyof T;
13
+ paginateProps?: CrudPaginateProps;
14
+ onDelete?: (id: any) => Promise<any>;
15
+ confirmDeleting?: boolean;
16
+ confirmHiding?: boolean;
17
+ onHide?: (id: any) => Promise<any>;
18
+ onUpdate?: (t: FormType & IdProps) => Promise<any>;
19
+ onExport?: (t: T) => Promise<any>;
20
+ data: T[] | undefined;
21
+ extraAction?: (t: T) => ReactElement | undefined | ReactElement[];
22
+ onClickUpdate?: (t: T) => void;
23
+ closeViewOnClickUpdate?: boolean;
24
+ isHiding?: boolean;
25
+ isDeleting?: boolean;
26
+ idField?: string;
27
+ loadingData?: boolean;
28
+ minusHeight?: string;
29
+ scroll?: TableProps<T>["scroll"];
30
+ className?: string;
31
+ bordered?: boolean;
32
+ size?: SizeType;
33
+ onClickClone?: (t: T) => Promise<any>;
34
+ onClickRefresh?: () => void;
35
+ expandable?: ExpandableConfig<T>;
36
+ descListColumn?: DescListColumn;
37
+ extraView?: (t: T) => React.ReactElement;
38
+ scrollToTop?: boolean;
39
+ rowClassName?: TableProps<T>["rowClassName"];
40
+ actionWidth?: string | number;
41
+ } & CrudSearchComponentProps<T, FormType>;
42
+ declare function CrudViewer<T, FormType = T>({ idField, loadingData, fields, isDeleting, isHiding, viewable, paginateProps, onDelete, onHide, onUpdate, data, extraAction, onClickUpdate, minusHeight, scroll, onClickClone, className, expandable, size, bordered, descListColumn, extraView, decListLayout, scrollToTop, onClickRefresh, closeViewOnClickUpdate, onExport, confirmHiding, confirmDeleting, rowClassName, actionWidth, ...props }: CrudViewerProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
43
+ export default CrudViewer;
@@ -0,0 +1,217 @@
1
+ import { jsxs as v, Fragment as M, jsx as n } from "react/jsx-runtime";
2
+ import { Modal as U } from "antd";
3
+ import F from "../../common/button/CloneButtonTable.js";
4
+ import rr from "../../common/button/DeleteButtonTable.js";
5
+ import { ExportButton as or } from "../../common/button/ExportButton.js";
6
+ import tr from "../../common/button/HideButtonTable.js";
7
+ import { RefreshButton as mr } from "../../common/button/RefreshButton.js";
8
+ import ur from "../../common/button/UpdateButtonTable.js";
9
+ import nr from "../../common/button/ViewButtonTable.js";
10
+ import fr from "../../common/layout/VerticalSpace.js";
11
+ import cr from "../../common/table/table.js";
12
+ import { useMemo as $, useState as q, useEffect as er, useCallback as lr } from "react";
13
+ import { useTranslation as sr } from "react-i18next";
14
+ import { TRANSLATION_NAMESPACE as hr } from "../../locale/hooks/translation-constants.js";
15
+ import ar from "../CrudSearchComponent.js";
16
+ import { CrudDecListView as vr } from "./CrudDecListView.js";
17
+ import { getRendererValueCrudViewer as A } from "./CrudViewerUtil.js";
18
+ function _r({
19
+ idField: t = "id",
20
+ loadingData: G,
21
+ fields: e,
22
+ isDeleting: S,
23
+ isHiding: b,
24
+ viewable: f = !1,
25
+ paginateProps: s,
26
+ onDelete: h,
27
+ onHide: i,
28
+ onUpdate: T,
29
+ data: y = [],
30
+ extraAction: a,
31
+ onClickUpdate: c,
32
+ minusHeight: N,
33
+ scroll: J,
34
+ onClickClone: B,
35
+ className: K,
36
+ expandable: Q,
37
+ size: W,
38
+ bordered: X,
39
+ descListColumn: Y,
40
+ extraView: g,
41
+ decListLayout: Z,
42
+ scrollToTop: Tr,
43
+ onClickRefresh: O,
44
+ closeViewOnClickUpdate: R,
45
+ onExport: I,
46
+ confirmHiding: z,
47
+ confirmDeleting: E,
48
+ rowClassName: d,
49
+ actionWidth: P = 190,
50
+ ...w
51
+ }) {
52
+ const { t: D } = sr(hr), L = $(
53
+ () => e.map(
54
+ ({ hideInTable: r, hidden: o, width: l, name: u, label: H, halign: x, ...V }) => ({
55
+ title: H,
56
+ width: l,
57
+ key: u,
58
+ dataIndex: u,
59
+ hidden: r || o,
60
+ align: x ?? (V.type === "number" ? "right" : void 0),
61
+ render: A(V)
62
+ })
63
+ ),
64
+ [e]
65
+ ), [m, p] = q(), [C, j] = q();
66
+ er(() => {
67
+ y && p((r) => {
68
+ if (r)
69
+ return y.find((o) => o[t] === r[t]);
70
+ });
71
+ }, [y, t, m]);
72
+ const _ = lr(
73
+ (r) => {
74
+ var l;
75
+ const o = a == null ? void 0 : a(r);
76
+ return (Array.isArray(o) ? (l = o == null ? void 0 : o.filter(Boolean)) != null && l.length : o) || T || c || B || h ? /* @__PURE__ */ v(M, { children: [
77
+ o,
78
+ (T || c) && /* @__PURE__ */ n(
79
+ ur,
80
+ {
81
+ value: r,
82
+ onClick: (u) => {
83
+ j(u[t]), c == null || c(r), R && p(void 0);
84
+ }
85
+ }
86
+ ),
87
+ B && /* @__PURE__ */ n(F, { value: r, onClick: (u) => B(u) }),
88
+ I && /* @__PURE__ */ n(
89
+ or,
90
+ {
91
+ value: r,
92
+ onClick: async (u) => await I(u)
93
+ }
94
+ ),
95
+ i && /* @__PURE__ */ n(
96
+ tr,
97
+ {
98
+ value: r,
99
+ disabled: b,
100
+ shouldConfirm: z,
101
+ loading: b && r[t] === C,
102
+ onClick: async (u) => {
103
+ j(u[t]), await i({ [t]: u[t] });
104
+ }
105
+ }
106
+ ),
107
+ h && /* @__PURE__ */ n(
108
+ rr,
109
+ {
110
+ value: r,
111
+ disabled: S,
112
+ shouldConfirm: E,
113
+ loading: S && r[t] === C,
114
+ onClick: async (u) => {
115
+ j(u[t]), await h({ [t]: u[t] });
116
+ }
117
+ }
118
+ )
119
+ ] }) : void 0;
120
+ },
121
+ [
122
+ R,
123
+ E,
124
+ z,
125
+ a,
126
+ t,
127
+ S,
128
+ b,
129
+ B,
130
+ c,
131
+ h,
132
+ I,
133
+ i,
134
+ T,
135
+ C
136
+ ]
137
+ ), k = $(() => {
138
+ let r = typeof f == "string" ? m == null ? void 0 : m[f] : void 0;
139
+ if (typeof r == "object") {
140
+ const o = e.find((l) => l.name === f);
141
+ r = A(o)(
142
+ r,
143
+ m,
144
+ 0
145
+ );
146
+ }
147
+ return r;
148
+ }, [f, m, e]);
149
+ return /* @__PURE__ */ v("div", { children: [
150
+ f && /* @__PURE__ */ n(
151
+ U,
152
+ {
153
+ width: "100%",
154
+ open: !!m,
155
+ title: k ?? /* @__PURE__ */ n("div", { children: " " }),
156
+ footer: /* @__PURE__ */ n(M, {}),
157
+ closable: !0,
158
+ onCancel: () => p(void 0),
159
+ children: !!m && /* @__PURE__ */ v("div", { children: [
160
+ /* @__PURE__ */ n(
161
+ vr,
162
+ {
163
+ layout: Z,
164
+ descListColumn: Y,
165
+ data: m,
166
+ fields: e,
167
+ action: _(m)
168
+ }
169
+ ),
170
+ g == null ? void 0 : g(m)
171
+ ] }, m == null ? void 0 : m[t])
172
+ }
173
+ ),
174
+ /* @__PURE__ */ n(ar, { fields: e, ...w }),
175
+ /* @__PURE__ */ v(fr, { children: [
176
+ !!O && /* @__PURE__ */ n(mr, { onClick: O }),
177
+ /* @__PURE__ */ n(
178
+ cr,
179
+ {
180
+ rowClassName: d,
181
+ className: K,
182
+ scroll: J ?? (N ? {
183
+ y: `calc(100vh - ${N})`
184
+ } : void 0),
185
+ id: "crud-table",
186
+ dataSource: y,
187
+ loading: G,
188
+ bordered: X,
189
+ size: W,
190
+ expandable: Q,
191
+ pagination: s ? {
192
+ total: s.count,
193
+ onChange: s.setPage,
194
+ current: s.page,
195
+ pageSize: s.pageSize
196
+ } : void 0,
197
+ columns: T || c || h || a || f ? [
198
+ ...L,
199
+ {
200
+ title: D("str.action"),
201
+ dataIndex: "",
202
+ fixed: "right",
203
+ width: P,
204
+ render: (r, o) => /* @__PURE__ */ v(M, { children: [
205
+ f && /* @__PURE__ */ n(nr, { value: o, onClick: p }),
206
+ _(o)
207
+ ] })
208
+ }
209
+ ] : L
210
+ }
211
+ )
212
+ ] })
213
+ ] });
214
+ }
215
+ export {
216
+ _r as default
217
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),m=require("@ant-design/icons"),s=require("antd"),y=require("../../common/show-more/index.cjs"),C=require("../FileCrudField.cjs"),g=require("../ImageCrudField.cjs"),d=require("../../locale/hooks/translation-constants.cjs"),j=require("i18next"),r=require("../../util/DateUtil.cjs"),v=require("../../util/NumberUtil.cjs");function x({type:a,render:i,...n}){return a==="object"?(t,u,o)=>typeof i=="function"?i(t,u,o):"":a==="select"?(t,u,o)=>{const e=n;let c=e.multiple?Array.isArray(t)?t.map(f=>f==null?void 0:f[e.innerFieldLabel??"name"]):void 0:t==null?void 0:t[e.innerFieldLabel??"name"];return(!c&&typeof t=="string"||typeof t=="number")&&(c=t),typeof i=="function"?i(c,u,o):Array.isArray(c)?c.join(", "):c}:a==="number"?(t,u,o)=>typeof i=="function"?i(t,u,o):n!=null&&n.int?v.default.toInt(t,n.formatted):v.default.toMoney(t):a==="enum"?(t,u,o)=>{var c;const e=j.t(((c=n==null?void 0:n.translation)==null?void 0:c[t??""])??t,{ns:d.TRANSLATION_NAMESPACE});return typeof i=="function"?i(t,u,o):e}:a==="date"?(t,u,o)=>{if(!t)return"-";const e=n!=null&&n.formatTime?r.formatDateTime(t):r.formatDate(t);return typeof i=="function"?i(t,u,o):e}:a==="checkbox"?(t,u,o)=>typeof i=="function"?i(t,u,o):t?l.jsx(m.CheckOutlined,{}):l.jsx(m.CloseOutlined,{}):a==="image"?(t,u,o)=>typeof i=="function"?i(t,u,o):l.jsx(g.ImageCrudCellValue,{value:t,provider:n.provider}):a==="file"?(t,u,o)=>typeof i=="function"?i(t,u,o):l.jsx(C.FileCrudCellValue,{value:t,provider:n.provider}):a==="time"?(t,u,o)=>{if(!t)return"-";const e=n==null?void 0:n.format,c=n==null?void 0:n.use12Hours,f=r.formatTime(t,e||(c?"hh:mm:ss A":void 0));return typeof i=="function"?i(t,u,o):f}:a==="color"?(t,u,o)=>typeof i=="function"?i(t,u,o):typeof t=="string"&&t.startsWith("#")?l.jsx(s.Tooltip,{title:t,children:l.jsx(s.Avatar,{style:{backgroundColor:t}})}):String(t):a==="textarea"?(t,u,o)=>{const e=(n==null?void 0:n.truncated)??1;return typeof i=="function"?i(t,u,o):e?l.jsx(y.ShowMore,{lines:e===!0?1:e,children:t}):t}:typeof i=="function"?i:t=>t}exports.getRendererValueCrudViewer=x;
@@ -0,0 +1,2 @@
1
+ import { CrudFieldProps } from 'crud/CrudComponent';
2
+ export declare function getRendererValueCrudViewer<T>({ type, render, ...props }: CrudFieldProps<T>): (value: any, obj: T, index: number) => any;
@@ -0,0 +1,57 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { CheckOutlined as y, CloseOutlined as A } from "@ant-design/icons";
3
+ import { Tooltip as e, Avatar as C } from "antd";
4
+ import { ShowMore as b } from "../../common/show-more/index.js";
5
+ import { FileCrudCellValue as g } from "../FileCrudField.js";
6
+ import { ImageCrudCellValue as h } from "../ImageCrudField.js";
7
+ import { TRANSLATION_NAMESPACE as T } from "../../locale/hooks/translation-constants.js";
8
+ import { t as S } from "i18next";
9
+ import r from "../../util/DateUtil.js";
10
+ import v from "../../util/NumberUtil.js";
11
+ function O({
12
+ type: m,
13
+ render: i,
14
+ ...o
15
+ }) {
16
+ return m === "object" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : "" : m === "select" ? (t, n, f) => {
17
+ const u = o;
18
+ let a = u.multiple ? Array.isArray(t) ? t.map((c) => c == null ? void 0 : c[u.innerFieldLabel ?? "name"]) : void 0 : t == null ? void 0 : t[u.innerFieldLabel ?? "name"];
19
+ return (!a && typeof t == "string" || typeof t == "number") && (a = t), typeof i == "function" ? i(a, n, f) : Array.isArray(a) ? a.join(", ") : a;
20
+ } : m === "number" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : o != null && o.int ? v.toInt(t, o.formatted) : v.toMoney(t) : m === "enum" ? (t, n, f) => {
21
+ var a;
22
+ const u = S(
23
+ ((a = o == null ? void 0 : o.translation) == null ? void 0 : a[t ?? ""]) ?? t,
24
+ { ns: T }
25
+ );
26
+ return typeof i == "function" ? i(t, n, f) : u;
27
+ } : m === "date" ? (t, n, f) => {
28
+ if (!t) return "-";
29
+ const u = o != null && o.formatTime ? r.formatDateTime(t) : r.formatDate(t);
30
+ return typeof i == "function" ? i(t, n, f) : u;
31
+ } : m === "checkbox" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : t ? /* @__PURE__ */ l(y, {}) : /* @__PURE__ */ l(A, {}) : m === "image" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
32
+ h,
33
+ {
34
+ value: t,
35
+ provider: o.provider
36
+ }
37
+ ) : m === "file" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : /* @__PURE__ */ l(
38
+ g,
39
+ {
40
+ value: t,
41
+ provider: o.provider
42
+ }
43
+ ) : m === "time" ? (t, n, f) => {
44
+ if (!t) return "-";
45
+ const u = o == null ? void 0 : o.format, a = o == null ? void 0 : o.use12Hours, c = r.formatTime(
46
+ t,
47
+ u || (a ? "hh:mm:ss A" : void 0)
48
+ );
49
+ return typeof i == "function" ? i(t, n, f) : c;
50
+ } : m === "color" ? (t, n, f) => typeof i == "function" ? i(t, n, f) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ l(e, { title: t, children: /* @__PURE__ */ l(C, { style: { backgroundColor: t } }) }) : String(t) : m === "textarea" ? (t, n, f) => {
51
+ const u = (o == null ? void 0 : o.truncated) ?? 1;
52
+ return typeof i == "function" ? i(t, n, f) : u ? /* @__PURE__ */ l(b, { lines: u === !0 ? 1 : u, children: t }) : t;
53
+ } : typeof i == "function" ? i : (t) => t;
54
+ }
55
+ export {
56
+ O as getRendererValueCrudViewer
57
+ };
@@ -0,0 +1,5 @@
1
+ export { CrudDecListView } from './CrudDecListView';
2
+ export type { CrudDecListViewProps, DescListColumn } from './CrudDecListView';
3
+ export { default as CrudViewer } from './CrudViewer';
4
+ export type { CrudViewerProps } from './CrudViewer';
5
+ export { getRendererValueCrudViewer } from './CrudViewerUtil';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.29",
4
+ "version": "1.0.30",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",
@@ -22,7 +22,7 @@
22
22
  "/*.js",
23
23
  "/*.cjs",
24
24
  "/*.d.ts",
25
- "/components/",
25
+ "/crud/",
26
26
  "/common/",
27
27
  "/util/",
28
28
  "/locale/",