@kingteza/crud-component 1.24.0 → 1.25.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.
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react/jsx-runtime"),c=require("@ant-design/icons"),f=require("antd"),L=require("mime"),o=require("react"),Z=require("../util/ValidationUtil.cjs.js"),{Dragger:_}=f.Upload;function G({name:S,label:M,required:N,provider:a,onUploading:m,onRemoved:p,fieldClassName:W,accept:i,rules:k,maxCount:r=1,block:B,showInGrid:$=!1,gridConfig:q={draggerSpan:12,previewSpan:12},fieldHelper:R,formLayoutProps:H,...I}){const u=f.Form.useFormInstance(),n=o.useMemo(()=>S,[S]),y=f.Form.useWatch(n,u),[A,U]=o.useState(!1),[j,h]=o.useState([]),T=o.useCallback(async e=>{var x,w;const l=e.file,t=(l==null?void 0:l.name)??"",d=`${Date.now()}-${Math.random().toString(36).substring(2,9)}`;h(F=>[...F,{uid:d,name:t,status:"uploading",originFileObj:l}]);try{U(!0),m==null||m(!0);const F=t??"",V=F.split("."),O=V[V.length-1],Q=a.generateFileName(F),X=`${await a.getInitialPath()}/${Q}.${O}`,g=await a.upload({...l,originFileObj:l},X),D=await a.getRealUrl(g),Y=L.getType(g),P=u.getFieldValue(n);if(r>1){const b=[...Array.isArray(P)?P:P?[P]:[],g].filter(Boolean);u.setFieldValue(n,b)}else u.setFieldValue(n,g);h(E=>E.map(b=>b.uid===d?{uid:g,url:D,type:Y,name:F,status:"done",response:g,thumbUrl:D}:b)),(x=e.onSuccess)==null||x.call(e,g)}catch(F){(w=e.onError)==null||w.call(e,F),h(V=>V.filter(O=>O.uid!==d))}finally{m==null||m(!1)}},[u,r,m,a,n]);o.useEffect(()=>{!A&&y&&Promise.all((Array.isArray(y)?y:[y]).map(async e=>{const l=L.getType(e),t=e.split("/").pop(),d=await a.getRealUrl(e);return{uid:e,url:d,type:l,name:t,response:e,thumbUrl:d}})).then(e=>h(e))},[y,A,a]);const z=o.useCallback(async e=>{const l=e.response??e.uid;await a.delete(l),p==null||p();const t=u.getFieldValue(n);if(r>1){const x=(Array.isArray(t)?t:t?[t]:[]).filter(w=>w!==l);u.setFieldValue(n,x.length?x:void 0)}else u.setFieldValue(n,void 0);h(d=>d.filter(x=>x.uid!==e.uid))},[u,r,p,a,n]),C=o.useMemo(()=>{if(!i)return"all files";const e=i.split(",").map(l=>{const t=l.trim().toLowerCase();return t.startsWith("image/")?"images":t===".pdf"||t==="application/pdf"?"PDF files":t.includes("excel")||t.includes(".xls")?"Excel files":t.includes("word")||t.includes(".doc")?"Word files":t.includes("text")||t===".txt"?"text files":t.includes("presentation")||t.includes(".ppt")?"PowerPoint files":t.replace(".","").toUpperCase()});return[...new Set(e)].join(", ")},[i]),J=o.useMemo(()=>i?i.includes("image")?s.jsx(c.FileImageOutlined,{}):i.includes("pdf")?s.jsx(c.FilePdfOutlined,{}):i.includes("word")||i.includes(".doc")?s.jsx(c.FileWordOutlined,{}):i.includes("text")||i.includes(".txt")?s.jsx(c.FileTextOutlined,{}):i.includes("excel")||i.includes(".xls")?s.jsx(c.FileExcelOutlined,{}):i.includes("presentation")||i.includes(".ppt")?s.jsx(c.FilePptOutlined,{}):s.jsx(c.FileOutlined,{}):s.jsx(c.InboxOutlined,{}),[i]),K=((j==null?void 0:j.length)??0)>=r;return s.jsxs(f.Form.Item,{label:M,required:N,name:n,...H,className:W,rules:[...N?Z.required(M):[],...k??[]],help:R,children:[s.jsx("input",{hidden:!0}),s.jsxs(f.Row,{gutter:[8,8],align:"top",style:{width:"100%",margin:0},children:[s.jsx(f.Col,{span:$?q.draggerSpan:24,xs:24,sm:24,children:s.jsxs(_,{...I,accept:i,disabled:K,fileList:[],multiple:r>1,maxCount:r,customRequest:T,onRemove:z,onChange:({file:e})=>{e.status==="error"&&h(l=>l.filter(t=>t.uid!==e.uid))},style:B?{width:"100%"}:void 0,children:[s.jsx("p",{className:"ant-upload-drag-icon",children:J}),s.jsx("p",{className:"ant-upload-text",children:"Click or drag file to this area to upload"}),s.jsx("p",{className:"ant-upload-hint",children:`Maximum file size: 10 MB. Supported formats: ${C}. ${r>1?`Maximum number of files: ${r}`:""}`})]})}),j.length>0&&s.jsx(f.Col,{span:$?q.previewSpan:24,xs:24,sm:24,children:s.jsx(f.Upload,{...I,accept:i,fileList:j,maxCount:r,customRequest:T,onRemove:z,listType:"picture",onChange:({fileList:e})=>h(e),style:{width:"100%"}})})]})]})}module.exports=G;
@@ -0,0 +1,24 @@
1
+ import { UploadProps } from 'antd';
2
+ import { ReactNode } from 'react';
3
+ import { InitialCrudField } from './CrudComponent';
4
+ import { FileUploadProvider } from './ImageCrudField';
5
+ export interface FileCrudDragNDropFieldProps<T> extends _FileCrudDragNDropField<T> {
6
+ type: "file";
7
+ }
8
+ export interface _FileCrudDragNDropField<T> extends InitialCrudField<T> {
9
+ provider: FileUploadProvider;
10
+ onUploading?: (isUploading: boolean) => void;
11
+ onRemoved?: () => void;
12
+ fieldClassName?: string;
13
+ accept?: string;
14
+ maxCount?: number;
15
+ block?: boolean;
16
+ fieldHelper?: ReactNode;
17
+ formLayoutProps?: InitialCrudField<T>["formLayoutProps"];
18
+ showInGrid?: boolean;
19
+ gridConfig?: {
20
+ draggerSpan?: number;
21
+ previewSpan?: number;
22
+ };
23
+ }
24
+ export default function FileCrudDragNDropField<T>({ name, label, required, provider, onUploading, onRemoved, fieldClassName, accept, rules, maxCount, block, showInGrid, gridConfig, fieldHelper: help, formLayoutProps, ...props }: Readonly<_FileCrudDragNDropField<T>> & Omit<UploadProps, "customRequest">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,162 @@
1
+ import { jsx as s, jsxs as O } from "react/jsx-runtime";
2
+ import { InboxOutlined as ee, FileImageOutlined as te, FilePdfOutlined as ie, FileWordOutlined as le, FileTextOutlined as se, FileExcelOutlined as re, FilePptOutlined as ne, FileOutlined as ae } from "@ant-design/icons";
3
+ import { Form as b, Row as ue, Col as W, Upload as H } from "antd";
4
+ import k from "mime";
5
+ import { useMemo as S, useState as B, useCallback as q, useEffect as de } from "react";
6
+ import ce from "../util/ValidationUtil.es.js";
7
+ const { Dragger: fe } = H;
8
+ function Fe({
9
+ name: N,
10
+ label: $,
11
+ required: A,
12
+ provider: a,
13
+ onUploading: c,
14
+ onRemoved: y,
15
+ fieldClassName: J,
16
+ accept: i,
17
+ rules: K,
18
+ maxCount: r = 1,
19
+ block: Q,
20
+ showInGrid: I = !1,
21
+ gridConfig: M = {
22
+ draggerSpan: 12,
23
+ previewSpan: 12
24
+ },
25
+ fieldHelper: R,
26
+ formLayoutProps: U,
27
+ ...T
28
+ }) {
29
+ const u = b.useFormInstance(), n = S(() => N, [N]), p = b.useWatch(n, u), [j, X] = B(!1), [g, f] = B([]), z = q(
30
+ async (e) => {
31
+ var m, F;
32
+ const l = e.file, t = (l == null ? void 0 : l.name) ?? "", d = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
33
+ f((o) => [
34
+ ...o,
35
+ {
36
+ uid: d,
37
+ name: t,
38
+ status: "uploading",
39
+ originFileObj: l
40
+ }
41
+ ]);
42
+ try {
43
+ X(!0), c == null || c(!0);
44
+ const o = t ?? "", w = o.split("."), P = w[w.length - 1], G = a.generateFileName(o), C = `${await a.getInitialPath()}/${G}.${P}`, h = await a.upload(
45
+ { ...l, originFileObj: l },
46
+ C
47
+ ), E = await a.getRealUrl(h), v = k.getType(h), x = u.getFieldValue(n);
48
+ if (r > 1) {
49
+ const V = [...Array.isArray(x) ? x : x ? [x] : [], h].filter(Boolean);
50
+ u.setFieldValue(n, V);
51
+ } else
52
+ u.setFieldValue(n, h);
53
+ f(
54
+ (L) => L.map(
55
+ (V) => V.uid === d ? {
56
+ uid: h,
57
+ url: E,
58
+ type: v,
59
+ name: o,
60
+ status: "done",
61
+ response: h,
62
+ thumbUrl: E
63
+ } : V
64
+ )
65
+ ), (m = e.onSuccess) == null || m.call(e, h);
66
+ } catch (o) {
67
+ (F = e.onError) == null || F.call(e, o), f((w) => w.filter((P) => P.uid !== d));
68
+ } finally {
69
+ c == null || c(!1);
70
+ }
71
+ },
72
+ [u, r, c, a, n]
73
+ );
74
+ de(() => {
75
+ !j && p && Promise.all(
76
+ (Array.isArray(p) ? p : [p]).map(async (e) => {
77
+ const l = k.getType(e), t = e.split("/").pop(), d = await a.getRealUrl(e);
78
+ return { uid: e, url: d, type: l, name: t, response: e, thumbUrl: d };
79
+ })
80
+ ).then((e) => f(e));
81
+ }, [p, j, a]);
82
+ const D = q(
83
+ async (e) => {
84
+ const l = e.response ?? e.uid;
85
+ await a.delete(l), y == null || y();
86
+ const t = u.getFieldValue(n);
87
+ if (r > 1) {
88
+ const m = (Array.isArray(t) ? t : t ? [t] : []).filter((F) => F !== l);
89
+ u.setFieldValue(n, m.length ? m : void 0);
90
+ } else
91
+ u.setFieldValue(n, void 0);
92
+ f((d) => d.filter((m) => m.uid !== e.uid));
93
+ },
94
+ [u, r, y, a, n]
95
+ ), Y = S(() => {
96
+ if (!i) return "all files";
97
+ const e = i.split(",").map((l) => {
98
+ const t = l.trim().toLowerCase();
99
+ return t.startsWith("image/") ? "images" : t === ".pdf" || t === "application/pdf" ? "PDF files" : t.includes("excel") || t.includes(".xls") ? "Excel files" : t.includes("word") || t.includes(".doc") ? "Word files" : t.includes("text") || t === ".txt" ? "text files" : t.includes("presentation") || t.includes(".ppt") ? "PowerPoint files" : t.replace(".", "").toUpperCase();
100
+ });
101
+ return [...new Set(e)].join(", ");
102
+ }, [i]), Z = S(() => i ? i.includes("image") ? /* @__PURE__ */ s(te, {}) : i.includes("pdf") ? /* @__PURE__ */ s(ie, {}) : i.includes("word") || i.includes(".doc") ? /* @__PURE__ */ s(le, {}) : i.includes("text") || i.includes(".txt") ? /* @__PURE__ */ s(se, {}) : i.includes("excel") || i.includes(".xls") ? /* @__PURE__ */ s(re, {}) : i.includes("presentation") || i.includes(".ppt") ? /* @__PURE__ */ s(ne, {}) : /* @__PURE__ */ s(ae, {}) : /* @__PURE__ */ s(ee, {}), [i]), _ = ((g == null ? void 0 : g.length) ?? 0) >= r;
103
+ return /* @__PURE__ */ O(
104
+ b.Item,
105
+ {
106
+ label: $,
107
+ required: A,
108
+ name: n,
109
+ ...U,
110
+ className: J,
111
+ rules: [
112
+ ...A ? ce.required($) : [],
113
+ ...K ?? []
114
+ ],
115
+ help: R,
116
+ children: [
117
+ /* @__PURE__ */ s("input", { hidden: !0 }),
118
+ /* @__PURE__ */ O(ue, { gutter: [8, 8], align: "top", style: { width: "100%", margin: 0 }, children: [
119
+ /* @__PURE__ */ s(W, { span: I ? M.draggerSpan : 24, xs: 24, sm: 24, children: /* @__PURE__ */ O(
120
+ fe,
121
+ {
122
+ ...T,
123
+ accept: i,
124
+ disabled: _,
125
+ fileList: [],
126
+ multiple: r > 1,
127
+ maxCount: r,
128
+ customRequest: z,
129
+ onRemove: D,
130
+ onChange: ({ file: e }) => {
131
+ e.status === "error" && f((l) => l.filter((t) => t.uid !== e.uid));
132
+ },
133
+ style: Q ? { width: "100%" } : void 0,
134
+ children: [
135
+ /* @__PURE__ */ s("p", { className: "ant-upload-drag-icon", children: Z }),
136
+ /* @__PURE__ */ s("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }),
137
+ /* @__PURE__ */ s("p", { className: "ant-upload-hint", children: `Maximum file size: 10 MB. Supported formats: ${Y}. ${r > 1 ? `Maximum number of files: ${r}` : ""}` })
138
+ ]
139
+ }
140
+ ) }),
141
+ g.length > 0 && /* @__PURE__ */ s(W, { span: I ? M.previewSpan : 24, xs: 24, sm: 24, children: /* @__PURE__ */ s(
142
+ H,
143
+ {
144
+ ...T,
145
+ accept: i,
146
+ fileList: g,
147
+ maxCount: r,
148
+ customRequest: z,
149
+ onRemove: D,
150
+ listType: "picture",
151
+ onChange: ({ fileList: e }) => f(e),
152
+ style: { width: "100%" }
153
+ }
154
+ ) })
155
+ ] })
156
+ ]
157
+ }
158
+ );
159
+ }
160
+ export {
161
+ Fe as default
162
+ };
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var H=(s,e,t)=>e in s?D(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var g=(s,e,t)=>H(s,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),R=require("@ant-design/icons"),f=require("antd"),q=require("path-browserify"),i=require("react"),T=require("../util/NumberUtil.cjs.js"),W=require("../util/ValidationUtil.cjs.js"),v=require("uuid"),z=require("../common/picker/ImagePicker.cjs.js"),G=require("../util/ImageUtil.cjs.js");class V{}class J extends V{constructor(t="",a=""){super();g(this,"rootPath");g(this,"subPath");this.rootPath=t,this.subPath=a}cloneFilePath(t){const a=q.parse(t),r=`${a.name}_cloned_${T.default.randInt(1e5)}`;return q.format({dir:a.dir,ext:a.ext,name:r})}generateFileName(t){return`${t.split(".")[0]}_${v.v4().replace("-","")}`}}function K({formLayoutProps:s,name:e,label:t,required:a,provider:r,onUploading:u,aspectRatio:C,onRemoved:d,fieldClassName:x,hideLabel:N=!1,listType:b,fieldHelper:S,showSkipCropButton:$=!1,skipResize:p=!1,asyncUpload:O=!1},_){const m=f.Form.useFormInstance(),I=f.Form.useWatch(e,m),[w,k]=i.useState(!1),h=i.useCallback(async(l,F)=>{if(F){u==null||u(!0);const c=l.name,o=c.split("."),E=o[o.length-1],M=r.generateFileName(c),A=`${await r.getInitialPath()}/${M}.${E}`,B=await r.upload(l,A);k(!0),u==null||u(!1),m.setFieldValue(e,B)}else{const c=m.getFieldsValue(),o=await r.delete(c[e]);d==null||d(),o&&m.setFieldsValue({[e]:null})}},[m,e,d,u,r]),[P,j]=i.useState();return i.useEffect(()=>{!w&&I?r.getRealUrl(I).then(j):j(P)},[I,w,r,P]),i.useImperativeHandle(_,()=>({async uploadBlob(l,F){const c=await G.getBase64(l),o={name:F,uid:F+Math.random().toString(36).substring(2,15),url:c,originFileObj:l};return h(o,!0)}}),[h]),n.jsxs(f.Form.Item,{rules:a?W.required(t):[],label:N?null:t,required:a,name:e,help:S,...s,className:x,children:[n.jsx(z.default,{noStyle:!0,asyncUpload:O,listType:b,aspectRatio:C,values:P,onRemove:l=>{l&&h(l,!1)},onAdd:async l=>{l&&await h(l,!0)},className:x,showSkipCropButton:$,skipResize:p}),n.jsx(f.Input,{hidden:!0})]})}const L=i.forwardRef(K),Q=({provider:s,value:e})=>{const[t,a]=i.useState();return i.useEffect(()=>{e&&s.getRealUrl(e).then(a)},[s,e]),t?n.jsx(y,{url:t}):n.jsx(n.Fragment,{})},y=({url:s})=>n.jsx(f.Avatar,{className:"p-0",children:n.jsx(f.Image,{className:"m-0 p-0 position-relative",src:s,preview:{mask:n.jsx(R.EyeOutlined,{})}})});exports.FileDownloadProvider=V;exports.FileUploadProvider=J;exports.ImageCellValue=y;exports.ImageCrudCellValue=Q;exports.default=L;
1
+ "use strict";var H=Object.defineProperty;var R=(s,e,t)=>e in s?H(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var g=(s,e,t)=>R(s,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),T=require("@ant-design/icons"),f=require("antd"),q=require("path-browserify"),i=require("react"),W=require("../util/NumberUtil.cjs.js"),v=require("../util/ValidationUtil.cjs.js"),z=require("uuid"),G=require("../common/picker/ImagePicker.cjs.js"),J=require("../util/ImageUtil.cjs.js");class V{}class K extends V{constructor(t="",a=""){super();g(this,"rootPath");g(this,"subPath");this.rootPath=t,this.subPath=a}cloneFilePath(t){const a=q.parse(t),r=`${a.name}_cloned_${W.default.randInt(1e5)}`;return q.format({dir:a.dir,ext:a.ext,name:r})}generateFileName(t){return`${t.split(".")[0]}_${z.v4().replace("-","")}`}}function L({formLayoutProps:s,name:e,label:t,required:a,provider:r,onUploading:u,aspectRatio:C,onRemoved:d,fieldClassName:x,hideLabel:N=!1,listType:b,fieldHelper:S,showSkipCropButton:$=!1,skipResize:p=!1,asyncUpload:O=!1,maxCount:_=1},k){const m=f.Form.useFormInstance(),I=f.Form.useWatch(e,m),[w,E]=i.useState(!1),h=i.useCallback(async(l,F)=>{if(F){u==null||u(!0);const c=l.name,o=c.split("."),M=o[o.length-1],A=r.generateFileName(c),B=`${await r.getInitialPath()}/${A}.${M}`,D=await r.upload(l,B);E(!0),u==null||u(!1),m.setFieldValue(e,D)}else{const c=m.getFieldsValue(),o=await r.delete(c[e]);d==null||d(),o&&m.setFieldsValue({[e]:null})}},[m,e,d,u,r]),[P,j]=i.useState();return i.useEffect(()=>{!w&&I?r.getRealUrl(I).then(j):j(P)},[I,w,r,P]),i.useImperativeHandle(k,()=>({async uploadBlob(l,F){const c=await J.getBase64(l),o={name:F,uid:F+Math.random().toString(36).substring(2,15),url:c,originFileObj:l};return h(o,!0)}}),[h]),n.jsxs(f.Form.Item,{rules:a?v.required(t):[],label:N?null:t,required:a,name:e,help:S,...s,className:x,children:[n.jsx(G.default,{noStyle:!0,asyncUpload:O,listType:b,aspectRatio:C,values:P,onRemove:l=>{l&&h(l,!1)},onAdd:async l=>{l&&await h(l,!0)},className:x,showSkipCropButton:$,skipResize:p,maxCount:_}),n.jsx(f.Input,{hidden:!0})]})}const Q=i.forwardRef(L),U=({provider:s,value:e})=>{const[t,a]=i.useState();return i.useEffect(()=>{e&&s.getRealUrl(e).then(a)},[s,e]),t?n.jsx(y,{url:t}):n.jsx(n.Fragment,{})},y=({url:s})=>n.jsx(f.Avatar,{className:"p-0",children:n.jsx(f.Image,{className:"m-0 p-0 position-relative",src:s,preview:{mask:n.jsx(T.EyeOutlined,{})}})});exports.FileDownloadProvider=V;exports.FileUploadProvider=K;exports.ImageCellValue=y;exports.ImageCrudCellValue=U;exports.default=Q;
@@ -12,6 +12,7 @@ export interface _ImageCrudField<T> extends InitialCrudField<T> {
12
12
  showSkipCropButton?: boolean;
13
13
  skipResize?: boolean;
14
14
  asyncUpload?: boolean;
15
+ maxCount?: number;
15
16
  }
16
17
  export interface ImageCrudField<T> extends _ImageCrudField<T> {
17
18
  type: "image";
@@ -1,19 +1,19 @@
1
- var D = Object.defineProperty;
2
- var M = (a, e, t) => e in a ? D(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
- var I = (a, e, t) => M(a, typeof e != "symbol" ? e + "" : e, t);
4
- import { jsx as i, Fragment as W, jsxs as q } from "react/jsx-runtime";
5
- import { EyeOutlined as z } from "@ant-design/icons";
6
- import { Avatar as G, Image as J, Form as d, Input as K } from "antd";
1
+ var M = Object.defineProperty;
2
+ var W = (a, e, t) => e in a ? M(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
+ var I = (a, e, t) => W(a, typeof e != "symbol" ? e + "" : e, t);
4
+ import { jsx as i, Fragment as q, jsxs as z } from "react/jsx-runtime";
5
+ import { EyeOutlined as G } from "@ant-design/icons";
6
+ import { Avatar as J, Image as K, Form as d, Input as L } from "antd";
7
7
  import y from "path-browserify";
8
- import L, { useState as P, useEffect as V, useCallback as Q, useImperativeHandle as R } from "react";
9
- import T from "../util/NumberUtil.es.js";
10
- import X from "../util/ValidationUtil.es.js";
11
- import { v4 as Y } from "uuid";
12
- import Z from "../common/picker/ImagePicker.es.js";
13
- import U from "../util/ImageUtil.es.js";
14
- class v {
8
+ import Q, { useState as P, useEffect as V, useCallback as R, useImperativeHandle as T } from "react";
9
+ import X from "../util/NumberUtil.es.js";
10
+ import Y from "../util/ValidationUtil.es.js";
11
+ import { v4 as Z } from "uuid";
12
+ import U from "../common/picker/ImagePicker.es.js";
13
+ import v from "../util/ImageUtil.es.js";
14
+ class ee {
15
15
  }
16
- class he extends v {
16
+ class Fe extends ee {
17
17
  constructor(t = "", s = "") {
18
18
  super();
19
19
  I(this, "rootPath");
@@ -21,7 +21,7 @@ class he extends v {
21
21
  this.rootPath = t, this.subPath = s;
22
22
  }
23
23
  cloneFilePath(t) {
24
- const s = y.parse(t), l = `${s.name}_cloned_${T.randInt(1e5)}`;
24
+ const s = y.parse(t), l = `${s.name}_cloned_${X.randInt(1e5)}`;
25
25
  return y.format({
26
26
  dir: s.dir,
27
27
  ext: s.ext,
@@ -29,10 +29,10 @@ class he extends v {
29
29
  });
30
30
  }
31
31
  generateFileName(t) {
32
- return `${t.split(".")[0]}_${Y().replace("-", "")}`;
32
+ return `${t.split(".")[0]}_${Z().replace("-", "")}`;
33
33
  }
34
34
  }
35
- function ee({
35
+ function te({
36
36
  formLayoutProps: a,
37
37
  name: e,
38
38
  label: t,
@@ -47,14 +47,15 @@ function ee({
47
47
  fieldHelper: b,
48
48
  showSkipCropButton: O = !1,
49
49
  skipResize: j = !1,
50
- asyncUpload: k = !1
51
- }, S) {
52
- const o = d.useFormInstance(), F = d.useWatch(e, o), [g, _] = P(!1), f = Q(
50
+ asyncUpload: k = !1,
51
+ maxCount: S = 1
52
+ }, _) {
53
+ const o = d.useFormInstance(), F = d.useWatch(e, o), [g, A] = P(!1), f = R(
53
54
  async (r, h) => {
54
55
  if (h) {
55
56
  n == null || n(!0);
56
- const c = r.name, u = c.split("."), A = u[u.length - 1], B = l.generateFileName(c), E = `${await l.getInitialPath()}/${B}.${A}`, H = await l.upload(r, E);
57
- _(!0), n == null || n(!1), o.setFieldValue(e, H);
57
+ const c = r.name, u = c.split("."), B = u[u.length - 1], E = l.generateFileName(c), H = `${await l.getInitialPath()}/${E}.${B}`, D = await l.upload(r, H);
58
+ A(!0), n == null || n(!1), o.setFieldValue(e, D);
58
59
  } else {
59
60
  const c = o.getFieldsValue(), u = await l.delete(c[e]);
60
61
  m == null || m(), u && o.setFieldsValue({ [e]: null });
@@ -64,11 +65,11 @@ function ee({
64
65
  ), [p, N] = P();
65
66
  return V(() => {
66
67
  !g && F ? l.getRealUrl(F).then(N) : N(p);
67
- }, [F, g, l, p]), R(
68
- S,
68
+ }, [F, g, l, p]), T(
69
+ _,
69
70
  () => ({
70
71
  async uploadBlob(r, h) {
71
- const c = await U.getBase64(r), u = {
72
+ const c = await v.getBase64(r), u = {
72
73
  name: h,
73
74
  uid: h + Math.random().toString(36).substring(2, 15),
74
75
  url: c,
@@ -78,10 +79,10 @@ function ee({
78
79
  }
79
80
  }),
80
81
  [f]
81
- ), /* @__PURE__ */ q(
82
+ ), /* @__PURE__ */ z(
82
83
  d.Item,
83
84
  {
84
- rules: s ? X.required(t) : [],
85
+ rules: s ? Y.required(t) : [],
85
86
  label: $ ? null : t,
86
87
  required: s,
87
88
  name: e,
@@ -90,7 +91,7 @@ function ee({
90
91
  className: w,
91
92
  children: [
92
93
  /* @__PURE__ */ i(
93
- Z,
94
+ U,
94
95
  {
95
96
  noStyle: !0,
96
97
  asyncUpload: k,
@@ -105,33 +106,34 @@ function ee({
105
106
  },
106
107
  className: w,
107
108
  showSkipCropButton: O,
108
- skipResize: j
109
+ skipResize: j,
110
+ maxCount: S
109
111
  }
110
112
  ),
111
- /* @__PURE__ */ i(K, { hidden: !0 })
113
+ /* @__PURE__ */ i(L, { hidden: !0 })
112
114
  ]
113
115
  }
114
116
  );
115
117
  }
116
- const Fe = L.forwardRef(ee), pe = ({ provider: a, value: e }) => {
118
+ const pe = Q.forwardRef(te), Ie = ({ provider: a, value: e }) => {
117
119
  const [t, s] = P();
118
120
  return V(() => {
119
121
  e && a.getRealUrl(e).then(s);
120
- }, [a, e]), t ? /* @__PURE__ */ i(te, { url: t }) : /* @__PURE__ */ i(W, {});
121
- }, te = ({ url: a }) => /* @__PURE__ */ i(G, { className: "p-0", children: /* @__PURE__ */ i(
122
- J,
122
+ }, [a, e]), t ? /* @__PURE__ */ i(ae, { url: t }) : /* @__PURE__ */ i(q, {});
123
+ }, ae = ({ url: a }) => /* @__PURE__ */ i(J, { className: "p-0", children: /* @__PURE__ */ i(
124
+ K,
123
125
  {
124
126
  className: "m-0 p-0 position-relative",
125
127
  src: a,
126
128
  preview: {
127
- mask: /* @__PURE__ */ i(z, {})
129
+ mask: /* @__PURE__ */ i(G, {})
128
130
  }
129
131
  }
130
132
  ) });
131
133
  export {
132
- v as FileDownloadProvider,
133
- he as FileUploadProvider,
134
- te as ImageCellValue,
135
- pe as ImageCrudCellValue,
136
- Fe as default
134
+ ee as FileDownloadProvider,
135
+ Fe as FileUploadProvider,
136
+ ae as ImageCellValue,
137
+ Ie as ImageCrudCellValue,
138
+ pe as default
137
139
  };
@@ -13,6 +13,7 @@ export { default as ImageCrudField, FileDownloadProvider, FileUploadProvider, Im
13
13
  export type { ImageCrudField as ImageCrudFieldProps } from './ImageCrudField';
14
14
  export { default as FileCrudField, FileCellValue, FileCrudCellValue, } from './FileCrudField';
15
15
  export type { FileCrudField as FileCrudFieldProps } from './FileCrudField';
16
+ export { default as FileCrudDragNDropField, type FileCrudDragNDropFieldProps, } from './FileCrudDragNDropField';
16
17
  export { default as CrudTextAreaComponent } from './CrudTextAreaComponent';
17
18
  export type { TextAreaBasedFieldProps } from './CrudTextAreaComponent';
18
19
  export { default as CrudImportComponent } from './import/CrudImportComponent';
@@ -1 +1 @@
1
- "use strict";const n=require("react/jsx-runtime"),yt=require("antd"),ht=require("@dnd-kit/core"),qt=require("@dnd-kit/modifiers"),Ct=require("@dnd-kit/utilities"),d=require("@dnd-kit/sortable"),lt=require("../../common/button/Button.cjs.js"),It=require("../../common/button/RefreshButton.cjs.js"),St=require("../../common/button/ViewButtonTable.cjs.js"),Rt=require("../actions/index.cjs.js"),Mt=require("../../common/table/table.cjs.js"),s=require("react"),dt=require("../../locale/index.cjs.js"),Tt=require("../CrudSearchComponent.cjs.js"),Vt=require("./CrudDecListView.cjs.js"),nt=require("./CrudViewerUtil.cjs.js"),Bt=require("@ant-design/icons"),ot=require("../../util/CrudUtil.cjs.js"),Dt=require("../../common/layout/VerticalSpace.cjs.js"),Nt=s.memo(Mt);function kt({summary:h,idField:o="id",loadingData:q,fields:j,isDeleting:R,isHiding:T,viewable:c=!1,paginateProps:m,onDelete:C,onHide:V,onUpdate:B,data:l=[],extraAction:D,onClickUpdate:N,minusHeight:E,scroll:v,onClickClone:z,className:$,expandable:A,size:_,bordered:G,descListColumn:rt,extraView:L,decListLayout:ct,scrollToTop:Ot,onClickRefresh:J,closeViewOnClickUpdate:K,onExport:Q,confirmHiding:X,confirmDeleting:Y,rowClassName:Z,actionWidth:W=190,draggable:t,rowSelection:p,...ut}){const{t:P}=dt.useTranslationLib(),H=s.useMemo(()=>j.map(({hideInTable:e,hidden:r,width:u,label:x,halign:I,...S})=>{const k=ot.getRealName(S.name);return{title:x,width:u,key:k,dataIndex:k,hidden:e||r,align:I??(S.type==="number"?"right":void 0),render:nt.getRendererValueCrudViewer(S),sorter:S.sorter}}),[j]),[i,M]=s.useState(),[U,w]=s.useState(),[y,a]=s.useState([]),it=s.useCallback(e=>{M(e)},[]);s.useEffect(()=>{l&&a(l)},[l]),s.useEffect(()=>{l&&M(e=>{if(e)return l.find(r=>r[o]===e[o])})},[l,o,i]);const F=s.useCallback(e=>{var x;const{active:r,over:u}=e;if(t!=null&&t.onDragEnd&&(t==null||t.onDragEnd(e)),r.id!==(u==null?void 0:u.id)){const I=y.findIndex(f=>f[o]===r.id),S=y.findIndex(f=>f[o]===(u==null?void 0:u.id)),k=d.arrayMove(y,I,S);a(f=>{const ft=f.findIndex(O=>O[o]===(r==null?void 0:r.id)),jt=f.findIndex(O=>O[o]===(u==null?void 0:u.id));return d.arrayMove(f,ft,jt)}),(x=t==null?void 0:t.onDrag)==null||x.call(t,{newOrder:k.map(f=>f[o])})}},[y,o,t]),mt=s.useMemo(()=>{let e=typeof c=="string"?i==null?void 0:i[c]:void 0;if(typeof e=="object"){const r=j.find(u=>ot.getRealName(u.name)===c);e=nt.getRendererValueCrudViewer(r)(e,i,0)}return e},[c,i,j]),b=s.useMemo(()=>({rowSelection:p,rowClassName:Z,className:$,scroll:v??(E?{y:`calc(100vh - ${E})`}:void 0),id:"crud-table",bordered:G,size:_,expandable:A}),[p,Z,$,v,E,G,_,A]),g=s.useMemo(()=>m?{...m,total:m.count,onChange:m.setPage,current:m.page,pageSize:m.pageSize}:void 0,[m]),tt=s.useMemo(()=>{const e=B||N||C||D||c,r=[];return t&&r.push({key:"key",align:"center",width:5,title:t==null?void 0:t.columnLabel,render:()=>n.jsx(Et,{tooltip:t==null?void 0:t.tooltip})}),r.push(...H),e&&e&&r.push({title:P("str.action"),fixed:"right",width:W,render:(u,x)=>n.jsxs(n.Fragment,{children:[c&&n.jsx(St,{value:x,onClick:typeof c=="object"?()=>{var I;return(I=c.onClick)==null?void 0:I.call(c,x)}:it}),n.jsx(Rt,{data:x,idField:o,extraAction:D,onUpdate:B,onClickUpdate:N,onClickClone:z,onDelete:C,onHide:V,onExport:Q,isHiding:T,isDeleting:R,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:K,recentUpdateOrDeleteId:U,setRecentUpdateOrDeleteId:w,setOpenView:M})]})}),r},[H,B,N,C,D,c,P,W]),et=s.useMemo(()=>y.map(e=>e[o]),[y,o]),xt=s.useCallback(()=>{const e=n.jsx(Nt,{...b,summary:h,dataSource:y,loading:q,components:t?{body:{row:Lt}}:void 0,pagination:g,columns:tt});return t?n.jsx(ht.DndContext,{modifiers:[qt.restrictToVerticalAxis],onDragEnd:F,children:n.jsx(d.SortableContext,{items:et,strategy:d.verticalListSortingStrategy,children:e})}):e},[b,y,q,g,tt,t,et,F]);return n.jsxs("div",{children:[(typeof c=="boolean"||typeof c=="string")&&n.jsx(yt.Modal,{width:"100%",open:!!i,title:mt??n.jsx("div",{children:" "}),footer:n.jsx(n.Fragment,{}),closable:!0,onCancel:()=>M(void 0),children:!!i&&n.jsxs("div",{children:[n.jsx(Vt.CrudDecListView,{layout:ct,descListColumn:rt,data:i,fields:j,idField:o,extraAction:D,onUpdate:B,onClickUpdate:N,onClickClone:z,onDelete:C,onHide:V,onExport:Q,isHiding:T,isDeleting:R,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:K,recentUpdateOrDeleteId:U,setRecentUpdateOrDeleteId:w,setOpenView:M}),L==null?void 0:L(i)]},i==null?void 0:i[o])}),n.jsx(Tt,{fields:j,...ut}),n.jsxs(Dt,{children:[!!J&&n.jsx(It.RefreshButton,{onClick:J}),xt()]})]})}const st=s.createContext({}),Et=({tooltip:h})=>{const{setActivatorNodeRef:o,listeners:q}=s.useContext(st);return n.jsx(lt,{type:"text",size:"small",tooltip:h,icon:n.jsx(Bt.HolderOutlined,{}),style:{cursor:"move",border:"none"},ref:o,...q})},Lt=h=>{const{attributes:o,listeners:q,setNodeRef:j,setActivatorNodeRef:R,transform:T,transition:c,isDragging:m}=d.useSortable({id:h["data-row-key"]}),C={...h.style,transform:Ct.CSS.Translate.toString(T),transition:c,...m?{position:"relative",zIndex:9999}:{}},V=s.useMemo(()=>({setActivatorNodeRef:R,listeners:q}),[R,q]);return n.jsx(st.Provider,{value:V,children:n.jsx("tr",{...h,ref:j,style:C,...o})})};module.exports=kt;
1
+ "use strict";const n=require("react/jsx-runtime"),ht=require("antd"),yt=require("@dnd-kit/core"),qt=require("@dnd-kit/modifiers"),Ct=require("@dnd-kit/utilities"),d=require("@dnd-kit/sortable"),lt=require("../../common/button/Button.cjs.js"),It=require("../../common/button/RefreshButton.cjs.js"),St=require("../../common/button/ViewButtonTable.cjs.js"),Rt=require("../actions/index.cjs.js"),Mt=require("../../common/table/table.cjs.js"),s=require("react"),dt=require("../../locale/index.cjs.js"),Tt=require("../CrudSearchComponent.cjs.js"),Vt=require("./CrudDecListView.cjs.js"),nt=require("./CrudViewerUtil.cjs.js"),Bt=require("@ant-design/icons"),ot=require("../../util/CrudUtil.cjs.js"),Dt=require("../../common/layout/VerticalSpace.cjs.js"),Nt=s.memo(Mt);function kt({summary:j,idField:o="id",loadingData:q,fields:h,isDeleting:R,isHiding:T,viewable:c=!1,paginateProps:m,onDelete:C,onHide:V,onUpdate:B,data:l=[],extraAction:D,onClickUpdate:N,minusHeight:E,scroll:v,onClickClone:z,className:$,expandable:A,size:_,bordered:G,descListColumn:rt,extraView:L,decListLayout:ct,scrollToTop:Ot,onClickRefresh:J,closeViewOnClickUpdate:K,onExport:Q,confirmHiding:X,confirmDeleting:Y,rowClassName:Z,actionWidth:W=190,draggable:t,rowSelection:p,...ut}){const{t:P}=dt.useTranslationLib(),H=s.useMemo(()=>h.map(({hideInTable:e,hidden:r,width:u,label:x,halign:I,...S})=>{const k=ot.getRealName(S.name);return{title:x,width:u,key:k,dataIndex:k,hidden:e||r,align:I??(S.type==="number"?"right":void 0),render:nt.getRendererValueCrudViewer(S),sorter:S.sorter}}),[h]),[i,M]=s.useState(),[U,w]=s.useState(),[y,F]=s.useState([]),it=s.useCallback(e=>{M(e)},[]);s.useEffect(()=>{l&&F(l)},[l]),s.useEffect(()=>{l&&M(e=>{if(e)return l.find(r=>r[o]===e[o])})},[l,o,i]);const a=s.useCallback(e=>{var x;const{active:r,over:u}=e;if(t!=null&&t.onDragEnd&&(t==null||t.onDragEnd(e)),r.id!==(u==null?void 0:u.id)){const I=y.findIndex(f=>f[o]===r.id),S=y.findIndex(f=>f[o]===(u==null?void 0:u.id)),k=d.arrayMove(y,I,S);F(f=>{const ft=f.findIndex(O=>O[o]===(r==null?void 0:r.id)),jt=f.findIndex(O=>O[o]===(u==null?void 0:u.id));return d.arrayMove(f,ft,jt)}),(x=t==null?void 0:t.onDrag)==null||x.call(t,{newOrder:k.map(f=>f[o])})}},[y,o,t]),mt=s.useMemo(()=>{let e=typeof c=="string"?i==null?void 0:i[c]:void 0;if(typeof e=="object"){const r=h.find(u=>ot.getRealName(u.name)===c);e=nt.getRendererValueCrudViewer(r)(e,i,0)}return e},[c,i,h]),b=s.useMemo(()=>({rowSelection:p,rowClassName:Z,className:$,scroll:v??(E?{y:`calc(100vh - ${E})`}:void 0),id:"crud-table",bordered:G,size:_,expandable:A}),[p,Z,$,v,E,G,_,A]),g=s.useMemo(()=>m?{...m,total:m.count,onChange:m.setPage,current:m.page,pageSize:m.pageSize}:void 0,[m]),tt=s.useMemo(()=>{const e=B||N||C||D||c,r=[];return t&&r.push({key:"key",align:"center",width:5,title:t==null?void 0:t.columnLabel,render:()=>n.jsx(Et,{tooltip:t==null?void 0:t.tooltip})}),r.push(...H),e&&e&&r.push({title:P("str.action"),fixed:"right",width:W,render:(u,x)=>n.jsxs(n.Fragment,{children:[c&&n.jsx(St,{value:x,onClick:typeof c=="object"?()=>{var I;return(I=c.onClick)==null?void 0:I.call(c,x)}:it}),n.jsx(Rt,{data:x,idField:o,extraAction:D,onUpdate:B,onClickUpdate:N,onClickClone:z,onDelete:C,onHide:V,onExport:Q,isHiding:T,isDeleting:R,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:K,recentUpdateOrDeleteId:U,setRecentUpdateOrDeleteId:w,setOpenView:M})]})}),r},[H,B,N,C,D,c,P,W]),et=s.useMemo(()=>y.map(e=>e[o]),[y,o]),xt=s.useCallback(()=>{const e=n.jsx(Nt,{...b,summary:j,dataSource:y,loading:q,components:t?{body:{row:Lt}}:void 0,pagination:g,columns:tt});return t?n.jsx(yt.DndContext,{modifiers:[qt.restrictToVerticalAxis],onDragEnd:a,children:n.jsx(d.SortableContext,{items:et,strategy:d.verticalListSortingStrategy,children:e})}):e},[b,y,q,g,tt,j,t,et,a]);return n.jsxs("div",{children:[(typeof c=="boolean"||typeof c=="string")&&n.jsx(ht.Modal,{width:"100%",open:!!i,title:mt??n.jsx("div",{children:" "}),footer:n.jsx(n.Fragment,{}),closable:!0,onCancel:()=>M(void 0),children:!!i&&n.jsxs("div",{children:[n.jsx(Vt.CrudDecListView,{layout:ct,descListColumn:rt,data:i,fields:h,idField:o,extraAction:D,onUpdate:B,onClickUpdate:N,onClickClone:z,onDelete:C,onHide:V,onExport:Q,isHiding:T,isDeleting:R,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:K,recentUpdateOrDeleteId:U,setRecentUpdateOrDeleteId:w,setOpenView:M}),L==null?void 0:L(i)]},i==null?void 0:i[o])}),n.jsx(Tt,{fields:h,...ut}),n.jsxs(Dt,{children:[!!J&&n.jsx(It.RefreshButton,{onClick:J}),xt()]})]})}const st=s.createContext({}),Et=({tooltip:j})=>{const{setActivatorNodeRef:o,listeners:q}=s.useContext(st);return n.jsx(lt,{type:"text",size:"small",tooltip:j,icon:n.jsx(Bt.HolderOutlined,{}),style:{cursor:"move",border:"none"},ref:o,...q})},Lt=j=>{const{attributes:o,listeners:q,setNodeRef:h,setActivatorNodeRef:R,transform:T,transition:c,isDragging:m}=d.useSortable({id:j["data-row-key"]}),C={...j.style,transform:Ct.CSS.Translate.toString(T),transition:c,...m?{position:"relative",zIndex:9999}:{}},V=s.useMemo(()=>({setActivatorNodeRef:R,listeners:q}),[R,q]);return n.jsx(st.Provider,{value:V,children:n.jsx("tr",{...j,ref:h,style:C,...o})})};module.exports=kt;
@@ -19,10 +19,10 @@ import ut from "../../util/CrudUtil.es.js";
19
19
  import $t from "../../common/layout/VerticalSpace.es.js";
20
20
  const qt = ft.memo(Vt);
21
21
  function so({
22
- summary: p,
22
+ summary: h,
23
23
  idField: n = "id",
24
24
  loadingData: C,
25
- fields: y,
25
+ fields: p,
26
26
  isDeleting: l,
27
27
  isHiding: D,
28
28
  viewable: c = !1,
@@ -40,9 +40,9 @@ function so({
40
40
  expandable: q,
41
41
  size: G,
42
42
  bordered: J,
43
- descListColumn: yt,
43
+ descListColumn: ht,
44
44
  extraView: V,
45
- decListLayout: ht,
45
+ decListLayout: pt,
46
46
  scrollToTop: Kt,
47
47
  onClickRefresh: K,
48
48
  closeViewOnClickUpdate: Q,
@@ -53,10 +53,10 @@ function so({
53
53
  actionWidth: P = 190,
54
54
  draggable: t,
55
55
  rowSelection: H,
56
- ...pt
56
+ ...yt
57
57
  }) {
58
58
  const { t: U } = zt(), w = x(
59
- () => y.map(({ hideInTable: o, hidden: r, width: s, label: f, halign: T, ...R }) => {
59
+ () => p.map(({ hideInTable: o, hidden: r, width: s, label: f, halign: T, ...R }) => {
60
60
  const E = ut.getRealName(R.name);
61
61
  return {
62
62
  title: f,
@@ -69,8 +69,8 @@ function so({
69
69
  sorter: R.sorter
70
70
  };
71
71
  }),
72
- [y]
73
- ), [m, B] = z(), [F, a] = z(), [h, b] = z([]), Ct = v((o) => {
72
+ [p]
73
+ ), [m, B] = z(), [F, a] = z(), [y, b] = z([]), Ct = v((o) => {
74
74
  B(o);
75
75
  }, []);
76
76
  st(() => {
@@ -86,11 +86,11 @@ function so({
86
86
  var f;
87
87
  const { active: r, over: s } = o;
88
88
  if (t != null && t.onDragEnd && (t == null || t.onDragEnd(o)), r.id !== (s == null ? void 0 : s.id)) {
89
- const T = h.findIndex(
89
+ const T = y.findIndex(
90
90
  (i) => i[n] === r.id
91
- ), R = h.findIndex(
91
+ ), R = y.findIndex(
92
92
  (i) => i[n] === (s == null ? void 0 : s.id)
93
- ), E = ct(h, T, R);
93
+ ), E = ct(y, T, R);
94
94
  b((i) => {
95
95
  const St = i.findIndex(
96
96
  (k) => k[n] === (r == null ? void 0 : r.id)
@@ -103,11 +103,11 @@ function so({
103
103
  });
104
104
  }
105
105
  },
106
- [h, n, t]
106
+ [y, n, t]
107
107
  ), xt = x(() => {
108
108
  let o = typeof c == "string" ? m == null ? void 0 : m[c] : void 0;
109
109
  if (typeof o == "object") {
110
- const r = y.find((s) => ut.getRealName(s.name) === c);
110
+ const r = p.find((s) => ut.getRealName(s.name) === c);
111
111
  o = mt(r)(
112
112
  o,
113
113
  m,
@@ -115,7 +115,7 @@ function so({
115
115
  );
116
116
  }
117
117
  return o;
118
- }, [c, m, y]), tt = x(
118
+ }, [c, m, p]), tt = x(
119
119
  () => ({
120
120
  rowSelection: H,
121
121
  rowClassName: W,
@@ -202,15 +202,15 @@ function so({
202
202
  U,
203
203
  P
204
204
  ]), rt = x(
205
- () => h.map((o) => o[n]),
206
- [h, n]
205
+ () => y.map((o) => o[n]),
206
+ [y, n]
207
207
  ), It = v(() => {
208
208
  const o = /* @__PURE__ */ e(
209
209
  qt,
210
210
  {
211
211
  ...tt,
212
- summary: p,
213
- dataSource: h,
212
+ summary: h,
213
+ dataSource: y,
214
214
  loading: C,
215
215
  components: t ? { body: { row: Jt } } : void 0,
216
216
  pagination: ot,
@@ -227,10 +227,11 @@ function so({
227
227
  ) }) : o;
228
228
  }, [
229
229
  tt,
230
- h,
230
+ y,
231
231
  C,
232
232
  ot,
233
233
  nt,
234
+ h,
234
235
  t,
235
236
  rt,
236
237
  g
@@ -249,10 +250,10 @@ function so({
249
250
  /* @__PURE__ */ e(
250
251
  At,
251
252
  {
252
- layout: ht,
253
- descListColumn: yt,
253
+ layout: pt,
254
+ descListColumn: ht,
254
255
  data: m,
255
- fields: y,
256
+ fields: p,
256
257
  idField: n,
257
258
  extraAction: d,
258
259
  onUpdate: O,
@@ -275,38 +276,38 @@ function so({
275
276
  ] }, m == null ? void 0 : m[n])
276
277
  }
277
278
  ),
278
- /* @__PURE__ */ e(vt, { fields: y, ...pt }),
279
+ /* @__PURE__ */ e(vt, { fields: p, ...yt }),
279
280
  /* @__PURE__ */ L($t, { children: [
280
281
  !!K && /* @__PURE__ */ e(Et, { onClick: K }),
281
282
  It()
282
283
  ] })
283
284
  ] });
284
285
  }
285
- const it = ft.createContext({}), Gt = ({ tooltip: p }) => {
286
+ const it = ft.createContext({}), Gt = ({ tooltip: h }) => {
286
287
  const { setActivatorNodeRef: n, listeners: C } = kt(it);
287
288
  return /* @__PURE__ */ e(
288
289
  jt,
289
290
  {
290
291
  type: "text",
291
292
  size: "small",
292
- tooltip: p,
293
+ tooltip: h,
293
294
  icon: /* @__PURE__ */ e(_t, {}),
294
295
  style: { cursor: "move", border: "none" },
295
296
  ref: n,
296
297
  ...C
297
298
  }
298
299
  );
299
- }, Jt = (p) => {
300
+ }, Jt = (h) => {
300
301
  const {
301
302
  attributes: n,
302
303
  listeners: C,
303
- setNodeRef: y,
304
+ setNodeRef: p,
304
305
  setActivatorNodeRef: l,
305
306
  transform: D,
306
307
  transition: c,
307
308
  isDragging: u
308
- } = dt({ id: p["data-row-key"] }), I = {
309
- ...p.style,
309
+ } = dt({ id: h["data-row-key"] }), I = {
310
+ ...h.style,
310
311
  transform: Dt.Translate.toString(D),
311
312
  transition: c,
312
313
  ...u ? { position: "relative", zIndex: 9999 } : {}
@@ -314,7 +315,7 @@ const it = ft.createContext({}), Gt = ({ tooltip: p }) => {
314
315
  () => ({ setActivatorNodeRef: l, listeners: C }),
315
316
  [l, C]
316
317
  );
317
- return /* @__PURE__ */ e(it.Provider, { value: N, children: /* @__PURE__ */ e("tr", { ...p, ref: y, style: I, ...n }) });
318
+ return /* @__PURE__ */ e(it.Provider, { value: N, children: /* @__PURE__ */ e("tr", { ...h, ref: p, style: I, ...n }) });
318
319
  };
319
320
  export {
320
321
  so as default
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const t=require("./locale/hooks/translation-constants.cjs.js"),u=require("./locale/index.cjs.js"),C=require("./crud/CrudComponent.cjs.js"),r=require("./crud/CrudField.cjs.js"),n=require("./crud/CrudFormWizard.cjs.js"),i=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/CrudTextAreaComponent.cjs.js"),s=require("./crud/import/CrudImportComponent.cjs.js"),m=require("./crud/import/CrudImportButton.cjs.js"),p=require("./crud/actions/index.cjs.js"),c=require("./crud/view/CrudViewer.cjs.js"),F=require("./context/CrudComponentProvider.cjs.js"),d=require("./crud/CrudForm.cjs.js"),q=require("./crud/modal/index.cjs.js"),V=require("./crud/view/CrudDecListView.cjs.js"),I=require("./crud/view/CrudViewerUtil.cjs.js");exports.TRANSLATION_NAMESPACE=t.TRANSLATION_NAMESPACE;exports.setupI18n=u.setupI18n;exports.updateTranslations=u.updateTranslations;exports.CrudComponent=C;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=n;exports.CrudReportComponent=i;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.CrudTextAreaComponent=a;exports.CrudImportComponent=s;exports.CrudImportButton=m;exports.CrudActions=p;exports.CrudViewer=c;exports.CrudComponentProvider=F.CrudComponentProvider;exports.CrudForm=d.CrudForm;exports.CrudFormFields=d.CrudFormFields;exports.CrudModal=q;exports.CrudDecListView=V.CrudDecListView;exports.getRendererValueCrudViewer=I.getRendererValueCrudViewer;
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"),C=require("./crud/CrudComponent.cjs.js"),r=require("./crud/CrudField.cjs.js"),t=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=C;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=t;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;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;
package/dist/index.es.js CHANGED
@@ -2,50 +2,52 @@
2
2
  import { TRANSLATION_NAMESPACE as t } from "./locale/hooks/translation-constants.es.js";
3
3
  import { setupI18n as a, updateTranslations as l } from "./locale/index.es.js";
4
4
  import { default as m } from "./crud/CrudComponent.es.js";
5
- import { ColorCrudFieldComponent as p, default as f, SelectCrudFieldComponent as n } from "./crud/CrudField.es.js";
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";
7
7
  import { default as F } from "./crud/CrudReportComponent.es.js";
8
8
  import { default as I } from "./crud/CrudSearchComponent.es.js";
9
- import { FileDownloadProvider as c, FileUploadProvider as g, ImageCellValue as w, ImageCrudCellValue as P, default as S } from "./crud/ImageCrudField.es.js";
10
- import { FileCellValue as v, FileCrudCellValue as N, default as R } from "./crud/FileCrudField.es.js";
11
- import { default as E } from "./crud/CrudTextAreaComponent.es.js";
12
- import { default as M } from "./crud/import/CrudImportComponent.es.js";
13
- import { default as z } from "./crud/import/CrudImportButton.es.js";
14
- import { default as O } from "./crud/actions/index.es.js";
15
- import { default as W } from "./crud/view/CrudViewer.es.js";
16
- import { CrudComponentProvider as b } from "./context/CrudComponentProvider.es.js";
17
- import { CrudForm as k, CrudFormFields as q } from "./crud/CrudForm.es.js";
18
- import { default as G } from "./crud/modal/index.es.js";
19
- import { CrudDecListView as J } from "./crud/view/CrudDecListView.es.js";
20
- import { getRendererValueCrudViewer as Q } from "./crud/view/CrudViewerUtil.es.js";
9
+ import { FileDownloadProvider as g, FileUploadProvider as c, ImageCellValue as w, ImageCrudCellValue as D, default as N } from "./crud/ImageCrudField.es.js";
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";
12
+ import { default as M } from "./crud/CrudTextAreaComponent.es.js";
13
+ import { default as z } from "./crud/import/CrudImportComponent.es.js";
14
+ import { default as O } from "./crud/import/CrudImportButton.es.js";
15
+ import { default as W } from "./crud/actions/index.es.js";
16
+ import { default as b } from "./crud/view/CrudViewer.es.js";
17
+ import { CrudComponentProvider as k } from "./context/CrudComponentProvider.es.js";
18
+ import { CrudForm as y, CrudFormFields as G } from "./crud/CrudForm.es.js";
19
+ import { default as J } from "./crud/modal/index.es.js";
20
+ import { CrudDecListView as Q } from "./crud/view/CrudDecListView.es.js";
21
+ import { getRendererValueCrudViewer as Y } from "./crud/view/CrudViewerUtil.es.js";
21
22
  export {
22
23
  p as ColorCrudFieldComponent,
23
- O as CrudActions,
24
+ W as CrudActions,
24
25
  m as CrudComponent,
25
- b as CrudComponentProvider,
26
- J as CrudDecListView,
26
+ k as CrudComponentProvider,
27
+ Q as CrudDecListView,
27
28
  f as CrudField,
28
- k as CrudForm,
29
- q as CrudFormFields,
29
+ y as CrudForm,
30
+ G as CrudFormFields,
30
31
  x as CrudFormWizard,
31
- z as CrudImportButton,
32
- M as CrudImportComponent,
33
- G as CrudModal,
32
+ O as CrudImportButton,
33
+ z as CrudImportComponent,
34
+ J as CrudModal,
34
35
  F as CrudReportComponent,
35
36
  I as CrudSearchComponent,
36
- E as CrudTextAreaComponent,
37
- W as CrudViewer,
38
- v as FileCellValue,
39
- N as FileCrudCellValue,
40
- R as FileCrudField,
41
- c as FileDownloadProvider,
42
- g as FileUploadProvider,
37
+ M as CrudTextAreaComponent,
38
+ b as CrudViewer,
39
+ S as FileCellValue,
40
+ T as FileCrudCellValue,
41
+ E as FileCrudDragNDropField,
42
+ v as FileCrudField,
43
+ g as FileDownloadProvider,
44
+ c as FileUploadProvider,
43
45
  w as ImageCellValue,
44
- P as ImageCrudCellValue,
45
- S as ImageCrudField,
46
- n as SelectCrudFieldComponent,
46
+ D as ImageCrudCellValue,
47
+ N as ImageCrudField,
48
+ i as SelectCrudFieldComponent,
47
49
  t as TRANSLATION_NAMESPACE,
48
- Q as getRendererValueCrudViewer,
50
+ Y as getRendererValueCrudViewer,
49
51
  a as setupI18n,
50
52
  l as updateTranslations
51
53
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.24.0",
4
+ "version": "1.25.1",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",