@kingteza/crud-component 1.25.0 → 1.26.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.
- package/dist/crud/CrudComponent.d.ts +1 -0
- package/dist/crud/FileCrudDragNDropField.cjs.js +1 -1
- package/dist/crud/FileCrudDragNDropField.d.ts +2 -2
- package/dist/crud/FileCrudDragNDropField.es.js +12 -12
- package/dist/crud/index.d.ts +1 -2
- package/dist/crud/view/CrudViewer.cjs.js +1 -1
- package/dist/crud/view/CrudViewer.es.js +78 -77
- package/package.json +1 -1
|
@@ -1 +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:
|
|
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;
|
|
@@ -2,7 +2,7 @@ import { UploadProps } from 'antd';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { InitialCrudField } from './CrudComponent';
|
|
4
4
|
import { FileUploadProvider } from './ImageCrudField';
|
|
5
|
-
export interface
|
|
5
|
+
export interface FileCrudDragNDropFieldProps<T> extends _FileCrudDragNDropField<T> {
|
|
6
6
|
type: "file";
|
|
7
7
|
}
|
|
8
8
|
export interface _FileCrudDragNDropField<T> extends InitialCrudField<T> {
|
|
@@ -21,4 +21,4 @@ export interface _FileCrudDragNDropField<T> extends InitialCrudField<T> {
|
|
|
21
21
|
previewSpan?: number;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
export default function
|
|
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;
|
|
@@ -28,10 +28,10 @@ function Fe({
|
|
|
28
28
|
}) {
|
|
29
29
|
const u = b.useFormInstance(), n = S(() => N, [N]), p = b.useWatch(n, u), [j, X] = B(!1), [g, f] = B([]), z = q(
|
|
30
30
|
async (e) => {
|
|
31
|
-
var
|
|
31
|
+
var m, F;
|
|
32
32
|
const l = e.file, t = (l == null ? void 0 : l.name) ?? "", d = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
33
|
-
f((
|
|
34
|
-
...
|
|
33
|
+
f((o) => [
|
|
34
|
+
...o,
|
|
35
35
|
{
|
|
36
36
|
uid: d,
|
|
37
37
|
name: t,
|
|
@@ -41,9 +41,9 @@ function Fe({
|
|
|
41
41
|
]);
|
|
42
42
|
try {
|
|
43
43
|
X(!0), c == null || c(!0);
|
|
44
|
-
const
|
|
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
45
|
{ ...l, originFileObj: l },
|
|
46
|
-
|
|
46
|
+
C
|
|
47
47
|
), E = await a.getRealUrl(h), v = k.getType(h), x = u.getFieldValue(n);
|
|
48
48
|
if (r > 1) {
|
|
49
49
|
const V = [...Array.isArray(x) ? x : x ? [x] : [], h].filter(Boolean);
|
|
@@ -56,15 +56,15 @@ function Fe({
|
|
|
56
56
|
uid: h,
|
|
57
57
|
url: E,
|
|
58
58
|
type: v,
|
|
59
|
-
name:
|
|
59
|
+
name: o,
|
|
60
60
|
status: "done",
|
|
61
61
|
response: h,
|
|
62
62
|
thumbUrl: E
|
|
63
63
|
} : V
|
|
64
64
|
)
|
|
65
|
-
), (
|
|
66
|
-
} catch (
|
|
67
|
-
(F = e.onError) == null || F.call(e,
|
|
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
68
|
} finally {
|
|
69
69
|
c == null || c(!1);
|
|
70
70
|
}
|
|
@@ -85,11 +85,11 @@ function Fe({
|
|
|
85
85
|
await a.delete(l), y == null || y();
|
|
86
86
|
const t = u.getFieldValue(n);
|
|
87
87
|
if (r > 1) {
|
|
88
|
-
const
|
|
89
|
-
u.setFieldValue(n,
|
|
88
|
+
const m = (Array.isArray(t) ? t : t ? [t] : []).filter((F) => F !== l);
|
|
89
|
+
u.setFieldValue(n, m.length ? m : void 0);
|
|
90
90
|
} else
|
|
91
91
|
u.setFieldValue(n, void 0);
|
|
92
|
-
f((d) => d.filter((
|
|
92
|
+
f((d) => d.filter((m) => m.uid !== e.uid));
|
|
93
93
|
},
|
|
94
94
|
[u, r, y, a, n]
|
|
95
95
|
), Y = S(() => {
|
package/dist/crud/index.d.ts
CHANGED
|
@@ -13,8 +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 } from './FileCrudDragNDropField';
|
|
17
|
-
export type { FileCrudDragNDropField as FileCrudDragNDropFieldProps, } from './FileCrudDragNDropField';
|
|
16
|
+
export { default as FileCrudDragNDropField, type FileCrudDragNDropFieldProps, } from './FileCrudDragNDropField';
|
|
18
17
|
export { default as CrudTextAreaComponent } from './CrudTextAreaComponent';
|
|
19
18
|
export type { TextAreaBasedFieldProps } from './CrudTextAreaComponent';
|
|
20
19
|
export { default as CrudImportComponent } from './import/CrudImportComponent';
|
|
@@ -1 +1 @@
|
|
|
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"),
|
|
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"),M=require("@dnd-kit/sortable"),lt=require("../../common/button/Button.cjs.js"),St=require("../../common/button/RefreshButton.cjs.js"),dt=require("../../common/button/ViewButtonTable.cjs.js"),It=require("../actions/index.cjs.js"),Rt=require("../../common/table/table.cjs.js"),s=require("react"),Mt=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"),Ot=s.memo(Rt);function Nt({summary:j,idField:o="id",loadingData:q,fields:h,isDeleting:I,isHiding:T,viewable:c=!1,paginateProps:f,onDelete:l,onHide:V,onUpdate:B,data:S=[],extraAction:D,onClickUpdate:O,minusHeight:k,scroll:v,onClickClone:z,className:$,expandable:A,size:_,bordered:G,descListColumn:rt,extraView:E,decListLayout:ct,scrollToTop:Lt,onClickRefresh:J,closeViewOnClickUpdate:K,onExport:Q,confirmHiding:X,confirmDeleting:Y,rowClassName:Z,actionWidth:W=190,draggable:t,rowSelection:P,...ut}){const{t:H}=Mt.useTranslationLib(),U=s.useMemo(()=>h.map(({hideInTable:e,hidden:r,width:u,label:m,halign:d,...C})=>{const N=ot.getRealName(C.name);return{title:m,width:u,key:N,dataIndex:N,hidden:e||r,align:d??(C.type==="number"?"right":void 0),render:nt.getRendererValueCrudViewer(C),sorter:C.sorter,defaultSortOrder:C.defaultSortOrder}}),[h]),[i,R]=s.useState(),[p,w]=s.useState(),[y,a]=s.useState([]),it=s.useCallback(e=>{R(e)},[]);s.useEffect(()=>{S&&a(S)},[S]),s.useEffect(()=>{S&&R(e=>{if(e)return S.find(r=>r[o]===e[o])})},[S,o,i]);const F=s.useCallback(e=>{var m;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 d=y.findIndex(x=>x[o]===r.id),C=y.findIndex(x=>x[o]===(u==null?void 0:u.id)),N=M.arrayMove(y,d,C);a(x=>{const xt=x.findIndex(L=>L[o]===(r==null?void 0:r.id)),jt=x.findIndex(L=>L[o]===(u==null?void 0:u.id));return M.arrayMove(x,xt,jt)}),(m=t==null?void 0:t.onDrag)==null||m.call(t,{newOrder:N.map(x=>x[o])})}},[y,o,t]),ft=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??(k?{y:`calc(100vh - ${k})`}:void 0),id:"crud-table",bordered:G,size:_,expandable:A}),[P,Z,$,v,k,G,_,A]),g=s.useMemo(()=>f?{...f,total:f.count,onChange:f.setPage,current:f.page,pageSize:f.pageSize}:void 0,[f]),tt=s.useMemo(()=>{const e=B||O||l||D||c,r=[];return t&&r.push({key:"key",align:"center",width:5,title:t==null?void 0:t.columnLabel,render:()=>n.jsx(kt,{tooltip:t==null?void 0:t.tooltip})}),r.push(...U),e&&e&&r.push({title:H("str.action"),fixed:"right",width:W,render:(u,m)=>n.jsxs(n.Fragment,{children:[c&&n.jsx(dt,{value:m,onClick:typeof c=="object"?()=>{var d;return(d=c.onClick)==null?void 0:d.call(c,m)}:it}),n.jsx(It,{data:m,idField:o,extraAction:D,onUpdate:B,onClickUpdate:O,onClickClone:z,onDelete:l,onHide:V,onExport:Q,isHiding:T,isDeleting:I,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:K,recentUpdateOrDeleteId:p,setRecentUpdateOrDeleteId:w,setOpenView:R})]})}),r},[U,B,O,l,D,c,H,W]),et=s.useMemo(()=>y.map(e=>e[o]),[y,o]),mt=s.useCallback(()=>{const e=n.jsx(Ot,{...b,summary:j,dataSource:y,loading:q,components:t?{body:{row:Et}}:void 0,pagination:g,columns:tt});return t?n.jsx(yt.DndContext,{modifiers:[qt.restrictToVerticalAxis],onDragEnd:F,children:n.jsx(M.SortableContext,{items:et,strategy:M.verticalListSortingStrategy,children:e})}):e},[b,y,q,g,tt,j,t,et,F]);return n.jsxs("div",{children:[(typeof c=="boolean"||typeof c=="string")&&n.jsx(ht.Modal,{width:"100%",open:!!i,title:ft??n.jsx("div",{children:" "}),footer:n.jsx(n.Fragment,{}),closable:!0,onCancel:()=>R(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:O,onClickClone:z,onDelete:l,onHide:V,onExport:Q,isHiding:T,isDeleting:I,confirmHiding:X,confirmDeleting:Y,closeViewOnClickUpdate:K,recentUpdateOrDeleteId:p,setRecentUpdateOrDeleteId:w,setOpenView:R}),E==null?void 0:E(i)]},i==null?void 0:i[o])}),n.jsx(Tt,{fields:h,...ut}),n.jsxs(Dt,{children:[!!J&&n.jsx(St.RefreshButton,{onClick:J}),mt()]})]})}const st=s.createContext({}),kt=({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})},Et=j=>{const{attributes:o,listeners:q,setNodeRef:h,setActivatorNodeRef:I,transform:T,transition:c,isDragging:f}=M.useSortable({id:j["data-row-key"]}),l={...j.style,transform:Ct.CSS.Translate.toString(T),transition:c,...f?{position:"relative",zIndex:9999}:{}},V=s.useMemo(()=>({setActivatorNodeRef:I,listeners:q}),[I,q]);return n.jsx(st.Provider,{value:V,children:n.jsx("tr",{...j,ref:h,style:l,...o})})};module.exports=Nt;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as L, Fragment as et } from "react/jsx-runtime";
|
|
2
|
-
import { Modal as
|
|
3
|
-
import { DndContext as
|
|
4
|
-
import { restrictToVerticalAxis as
|
|
5
|
-
import { CSS as
|
|
6
|
-
import { arrayMove as ct, SortableContext as
|
|
2
|
+
import { Modal as lt } from "antd";
|
|
3
|
+
import { DndContext as Rt } from "@dnd-kit/core";
|
|
4
|
+
import { restrictToVerticalAxis as dt } from "@dnd-kit/modifiers";
|
|
5
|
+
import { CSS as Ot } from "@dnd-kit/utilities";
|
|
6
|
+
import { arrayMove as ct, SortableContext as Bt, verticalListSortingStrategy as Dt, useSortable as Nt } from "@dnd-kit/sortable";
|
|
7
7
|
import jt from "../../common/button/Button.es.js";
|
|
8
8
|
import { RefreshButton as Et } from "../../common/button/RefreshButton.es.js";
|
|
9
9
|
import Lt from "../../common/button/ViewButtonTable.es.js";
|
|
@@ -22,16 +22,16 @@ function so({
|
|
|
22
22
|
summary: h,
|
|
23
23
|
idField: n = "id",
|
|
24
24
|
loadingData: C,
|
|
25
|
-
fields:
|
|
26
|
-
isDeleting:
|
|
27
|
-
isHiding:
|
|
25
|
+
fields: y,
|
|
26
|
+
isDeleting: R,
|
|
27
|
+
isHiding: O,
|
|
28
28
|
viewable: c = !1,
|
|
29
29
|
paginateProps: u,
|
|
30
30
|
onDelete: I,
|
|
31
|
-
onHide:
|
|
32
|
-
onUpdate:
|
|
33
|
-
data:
|
|
34
|
-
extraAction:
|
|
31
|
+
onHide: B,
|
|
32
|
+
onUpdate: D,
|
|
33
|
+
data: T = [],
|
|
34
|
+
extraAction: N,
|
|
35
35
|
onClickUpdate: j,
|
|
36
36
|
minusHeight: M,
|
|
37
37
|
scroll: A,
|
|
@@ -42,7 +42,7 @@ function so({
|
|
|
42
42
|
bordered: J,
|
|
43
43
|
descListColumn: ht,
|
|
44
44
|
extraView: V,
|
|
45
|
-
decListLayout:
|
|
45
|
+
decListLayout: yt,
|
|
46
46
|
scrollToTop: Kt,
|
|
47
47
|
onClickRefresh: K,
|
|
48
48
|
closeViewOnClickUpdate: Q,
|
|
@@ -53,61 +53,62 @@ function so({
|
|
|
53
53
|
actionWidth: P = 190,
|
|
54
54
|
draggable: t,
|
|
55
55
|
rowSelection: H,
|
|
56
|
-
...
|
|
56
|
+
...pt
|
|
57
57
|
}) {
|
|
58
58
|
const { t: U } = zt(), w = x(
|
|
59
|
-
() =>
|
|
60
|
-
const E = ut.getRealName(
|
|
59
|
+
() => y.map(({ hideInTable: o, hidden: r, width: s, label: f, halign: l, ...S }) => {
|
|
60
|
+
const E = ut.getRealName(S.name);
|
|
61
61
|
return {
|
|
62
62
|
title: f,
|
|
63
63
|
width: s,
|
|
64
64
|
key: E,
|
|
65
65
|
dataIndex: E,
|
|
66
66
|
hidden: o || r,
|
|
67
|
-
align:
|
|
68
|
-
render: mt(
|
|
69
|
-
sorter:
|
|
67
|
+
align: l ?? (S.type === "number" ? "right" : void 0),
|
|
68
|
+
render: mt(S),
|
|
69
|
+
sorter: S.sorter,
|
|
70
|
+
defaultSortOrder: S.defaultSortOrder
|
|
70
71
|
};
|
|
71
72
|
}),
|
|
72
|
-
[
|
|
73
|
-
), [m,
|
|
74
|
-
|
|
73
|
+
[y]
|
|
74
|
+
), [m, d] = z(), [F, a] = z(), [p, b] = z([]), Ct = v((o) => {
|
|
75
|
+
d(o);
|
|
75
76
|
}, []);
|
|
76
77
|
st(() => {
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
|
|
78
|
+
T && b(T);
|
|
79
|
+
}, [T]), st(() => {
|
|
80
|
+
T && d((o) => {
|
|
80
81
|
if (o)
|
|
81
|
-
return
|
|
82
|
+
return T.find((r) => r[n] === o[n]);
|
|
82
83
|
});
|
|
83
|
-
}, [
|
|
84
|
+
}, [T, n, m]);
|
|
84
85
|
const g = v(
|
|
85
86
|
(o) => {
|
|
86
87
|
var f;
|
|
87
88
|
const { active: r, over: s } = o;
|
|
88
89
|
if (t != null && t.onDragEnd && (t == null || t.onDragEnd(o)), r.id !== (s == null ? void 0 : s.id)) {
|
|
89
|
-
const
|
|
90
|
+
const l = p.findIndex(
|
|
90
91
|
(i) => i[n] === r.id
|
|
91
|
-
),
|
|
92
|
+
), S = p.findIndex(
|
|
92
93
|
(i) => i[n] === (s == null ? void 0 : s.id)
|
|
93
|
-
), E = ct(
|
|
94
|
+
), E = ct(p, l, S);
|
|
94
95
|
b((i) => {
|
|
95
|
-
const
|
|
96
|
+
const It = i.findIndex(
|
|
96
97
|
(k) => k[n] === (r == null ? void 0 : r.id)
|
|
97
98
|
), Tt = i.findIndex(
|
|
98
99
|
(k) => k[n] === (s == null ? void 0 : s.id)
|
|
99
100
|
);
|
|
100
|
-
return ct(i,
|
|
101
|
+
return ct(i, It, Tt);
|
|
101
102
|
}), (f = t == null ? void 0 : t.onDrag) == null || f.call(t, {
|
|
102
103
|
newOrder: E.map((i) => i[n])
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
},
|
|
106
|
-
[
|
|
107
|
-
),
|
|
107
|
+
[p, n, t]
|
|
108
|
+
), St = x(() => {
|
|
108
109
|
let o = typeof c == "string" ? m == null ? void 0 : m[c] : void 0;
|
|
109
110
|
if (typeof o == "object") {
|
|
110
|
-
const r =
|
|
111
|
+
const r = y.find((s) => ut.getRealName(s.name) === c);
|
|
111
112
|
o = mt(r)(
|
|
112
113
|
o,
|
|
113
114
|
m,
|
|
@@ -115,7 +116,7 @@ function so({
|
|
|
115
116
|
);
|
|
116
117
|
}
|
|
117
118
|
return o;
|
|
118
|
-
}, [c, m,
|
|
119
|
+
}, [c, m, y]), tt = x(
|
|
119
120
|
() => ({
|
|
120
121
|
rowSelection: H,
|
|
121
122
|
rowClassName: W,
|
|
@@ -146,7 +147,7 @@ function so({
|
|
|
146
147
|
} : void 0,
|
|
147
148
|
[u]
|
|
148
149
|
), nt = x(() => {
|
|
149
|
-
const o =
|
|
150
|
+
const o = D || j || I || N || c, r = [];
|
|
150
151
|
return t && r.push({
|
|
151
152
|
key: "key",
|
|
152
153
|
align: "center",
|
|
@@ -163,8 +164,8 @@ function so({
|
|
|
163
164
|
{
|
|
164
165
|
value: f,
|
|
165
166
|
onClick: typeof c == "object" ? () => {
|
|
166
|
-
var
|
|
167
|
-
return (
|
|
167
|
+
var l;
|
|
168
|
+
return (l = c.onClick) == null ? void 0 : l.call(c, f);
|
|
168
169
|
} : Ct
|
|
169
170
|
}
|
|
170
171
|
),
|
|
@@ -173,61 +174,61 @@ function so({
|
|
|
173
174
|
{
|
|
174
175
|
data: f,
|
|
175
176
|
idField: n,
|
|
176
|
-
extraAction:
|
|
177
|
-
onUpdate:
|
|
177
|
+
extraAction: N,
|
|
178
|
+
onUpdate: D,
|
|
178
179
|
onClickUpdate: j,
|
|
179
180
|
onClickClone: _,
|
|
180
181
|
onDelete: I,
|
|
181
|
-
onHide:
|
|
182
|
+
onHide: B,
|
|
182
183
|
onExport: X,
|
|
183
|
-
isHiding:
|
|
184
|
-
isDeleting:
|
|
184
|
+
isHiding: O,
|
|
185
|
+
isDeleting: R,
|
|
185
186
|
confirmHiding: Y,
|
|
186
187
|
confirmDeleting: Z,
|
|
187
188
|
closeViewOnClickUpdate: Q,
|
|
188
189
|
recentUpdateOrDeleteId: F,
|
|
189
190
|
setRecentUpdateOrDeleteId: a,
|
|
190
|
-
setOpenView:
|
|
191
|
+
setOpenView: d
|
|
191
192
|
}
|
|
192
193
|
)
|
|
193
194
|
] })
|
|
194
195
|
}), r;
|
|
195
196
|
}, [
|
|
196
197
|
w,
|
|
197
|
-
|
|
198
|
+
D,
|
|
198
199
|
j,
|
|
199
200
|
I,
|
|
200
|
-
|
|
201
|
+
N,
|
|
201
202
|
c,
|
|
202
203
|
U,
|
|
203
204
|
P
|
|
204
205
|
]), rt = x(
|
|
205
|
-
() =>
|
|
206
|
-
[
|
|
207
|
-
),
|
|
206
|
+
() => p.map((o) => o[n]),
|
|
207
|
+
[p, n]
|
|
208
|
+
), xt = v(() => {
|
|
208
209
|
const o = /* @__PURE__ */ e(
|
|
209
210
|
qt,
|
|
210
211
|
{
|
|
211
212
|
...tt,
|
|
212
213
|
summary: h,
|
|
213
|
-
dataSource:
|
|
214
|
+
dataSource: p,
|
|
214
215
|
loading: C,
|
|
215
216
|
components: t ? { body: { row: Jt } } : void 0,
|
|
216
217
|
pagination: ot,
|
|
217
218
|
columns: nt
|
|
218
219
|
}
|
|
219
220
|
);
|
|
220
|
-
return t ? /* @__PURE__ */ e(
|
|
221
|
-
|
|
221
|
+
return t ? /* @__PURE__ */ e(Rt, { modifiers: [dt], onDragEnd: g, children: /* @__PURE__ */ e(
|
|
222
|
+
Bt,
|
|
222
223
|
{
|
|
223
224
|
items: rt,
|
|
224
|
-
strategy:
|
|
225
|
+
strategy: Dt,
|
|
225
226
|
children: o
|
|
226
227
|
}
|
|
227
228
|
) }) : o;
|
|
228
229
|
}, [
|
|
229
230
|
tt,
|
|
230
|
-
|
|
231
|
+
p,
|
|
231
232
|
C,
|
|
232
233
|
ot,
|
|
233
234
|
nt,
|
|
@@ -238,48 +239,48 @@ function so({
|
|
|
238
239
|
]);
|
|
239
240
|
return /* @__PURE__ */ L("div", { children: [
|
|
240
241
|
(typeof c == "boolean" || typeof c == "string") && /* @__PURE__ */ e(
|
|
241
|
-
|
|
242
|
+
lt,
|
|
242
243
|
{
|
|
243
244
|
width: "100%",
|
|
244
245
|
open: !!m,
|
|
245
|
-
title:
|
|
246
|
+
title: St ?? /* @__PURE__ */ e("div", { children: " " }),
|
|
246
247
|
footer: /* @__PURE__ */ e(et, {}),
|
|
247
248
|
closable: !0,
|
|
248
|
-
onCancel: () =>
|
|
249
|
+
onCancel: () => d(void 0),
|
|
249
250
|
children: !!m && /* @__PURE__ */ L("div", { children: [
|
|
250
251
|
/* @__PURE__ */ e(
|
|
251
252
|
At,
|
|
252
253
|
{
|
|
253
|
-
layout:
|
|
254
|
+
layout: yt,
|
|
254
255
|
descListColumn: ht,
|
|
255
256
|
data: m,
|
|
256
|
-
fields:
|
|
257
|
+
fields: y,
|
|
257
258
|
idField: n,
|
|
258
|
-
extraAction:
|
|
259
|
-
onUpdate:
|
|
259
|
+
extraAction: N,
|
|
260
|
+
onUpdate: D,
|
|
260
261
|
onClickUpdate: j,
|
|
261
262
|
onClickClone: _,
|
|
262
263
|
onDelete: I,
|
|
263
|
-
onHide:
|
|
264
|
+
onHide: B,
|
|
264
265
|
onExport: X,
|
|
265
|
-
isHiding:
|
|
266
|
-
isDeleting:
|
|
266
|
+
isHiding: O,
|
|
267
|
+
isDeleting: R,
|
|
267
268
|
confirmHiding: Y,
|
|
268
269
|
confirmDeleting: Z,
|
|
269
270
|
closeViewOnClickUpdate: Q,
|
|
270
271
|
recentUpdateOrDeleteId: F,
|
|
271
272
|
setRecentUpdateOrDeleteId: a,
|
|
272
|
-
setOpenView:
|
|
273
|
+
setOpenView: d
|
|
273
274
|
}
|
|
274
275
|
),
|
|
275
276
|
V == null ? void 0 : V(m)
|
|
276
277
|
] }, m == null ? void 0 : m[n])
|
|
277
278
|
}
|
|
278
279
|
),
|
|
279
|
-
/* @__PURE__ */ e(vt, { fields:
|
|
280
|
+
/* @__PURE__ */ e(vt, { fields: y, ...pt }),
|
|
280
281
|
/* @__PURE__ */ L($t, { children: [
|
|
281
282
|
!!K && /* @__PURE__ */ e(Et, { onClick: K }),
|
|
282
|
-
|
|
283
|
+
xt()
|
|
283
284
|
] })
|
|
284
285
|
] });
|
|
285
286
|
}
|
|
@@ -301,21 +302,21 @@ const it = ft.createContext({}), Gt = ({ tooltip: h }) => {
|
|
|
301
302
|
const {
|
|
302
303
|
attributes: n,
|
|
303
304
|
listeners: C,
|
|
304
|
-
setNodeRef:
|
|
305
|
-
setActivatorNodeRef:
|
|
306
|
-
transform:
|
|
305
|
+
setNodeRef: y,
|
|
306
|
+
setActivatorNodeRef: R,
|
|
307
|
+
transform: O,
|
|
307
308
|
transition: c,
|
|
308
309
|
isDragging: u
|
|
309
|
-
} =
|
|
310
|
+
} = Nt({ id: h["data-row-key"] }), I = {
|
|
310
311
|
...h.style,
|
|
311
|
-
transform:
|
|
312
|
+
transform: Ot.Translate.toString(O),
|
|
312
313
|
transition: c,
|
|
313
314
|
...u ? { position: "relative", zIndex: 9999 } : {}
|
|
314
|
-
},
|
|
315
|
-
() => ({ setActivatorNodeRef:
|
|
316
|
-
[
|
|
315
|
+
}, B = x(
|
|
316
|
+
() => ({ setActivatorNodeRef: R, listeners: C }),
|
|
317
|
+
[R, C]
|
|
317
318
|
);
|
|
318
|
-
return /* @__PURE__ */ e(it.Provider, { value:
|
|
319
|
+
return /* @__PURE__ */ e(it.Provider, { value: B, children: /* @__PURE__ */ e("tr", { ...h, ref: y, style: I, ...n }) });
|
|
319
320
|
};
|
|
320
321
|
export {
|
|
321
322
|
so as default
|