@kingteza/crud-component 1.0.52 → 1.0.55
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/common/icon/KIcon.cjs.js +1 -1
- package/common/icon/KIcon.es.js +1 -1
- package/common/picker/ImagePicker.cjs.js +1 -1
- package/common/picker/ImagePicker.es.js +28 -28
- package/crud/view/CrudViewer.cjs.js +1 -1
- package/crud/view/CrudViewer.es.js +4 -4
- package/package.json +2 -1
- package/_virtual/_commonjsHelpers.cjs.js +0 -1
- package/_virtual/_commonjsHelpers.es.js +0 -6
- package/_virtual/index.cjs.js +0 -1
- package/_virtual/index.cjs2.js +0 -1
- package/_virtual/index.es.js +0 -7
- package/_virtual/index.es2.js +0 -4
package/common/icon/KIcon.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),s=require("@ant-design/icons"),o=require("@iconify/react"),u=require("react"),i=e=>t=>n.jsx(o.Icon,{...t,icon:e}),I=({icon:e,component:t,...r})=>{const c=u.useMemo(()=>t??i(e),[e,t]);return n.jsx(s,{...r,component:c})};module.exports=I;
|
package/common/icon/KIcon.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import c from "@ant-design/icons";
|
|
3
|
-
import { Icon as e } from "
|
|
3
|
+
import { Icon as e } from "@iconify/react";
|
|
4
4
|
import { useMemo as s } from "react";
|
|
5
5
|
const f = (o) => (r) => /* @__PURE__ */ t(e, { ...r, icon: o }), u = ({ icon: o, component: r, ...n }) => {
|
|
6
6
|
const m = s(() => r ?? f(o), [o, r]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),je=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),je=require("react-advanced-cropper");;/* empty css */;/* empty css */const O=require("@ant-design/icons"),U=require("antd"),s=require("react"),he=require("../../locale/index.cjs.js"),I=require("../button/Button.cjs.js"),we=require("../../util/ImageUtil.cjs.js"),Ce=require("../../icons/FlipHIcon.cjs.js"),be=require("../../icons/FlipVIcon.cjs.js"),ve=U.Form.Item,Y="crud-component.image-picker.button-state";function Z(o){return new Promise((u,p)=>{const n=new FileReader;n.readAsDataURL(o),n.onload=()=>u(n.result),n.onerror=m=>p(m)})}const Se=({values:o=[],required:u,buttonType:p,label:n,name:m,onChange:f,aspectRatio:h,buttonTitle:w,hidePreview:C,buttonSize:g="large",showButtonText:x=!0,showOnlyIcon:_=!1,icon:k=t.jsx(O.UploadOutlined,{}),loading:F,maxCount:b=1,onAdd:a,onRemove:R,listType:q,...A})=>{const[te,re]=s.useState(""),[se,oe]=s.useState(""),[ne,B]=s.useState(!1),T=s.useRef(),l=s.useRef(null),[i,z]=s.useState([]),[j,P]=s.useState(),ie=s.useRef(),ae=()=>B(!1),ce=async e=>{!e.url&&!e.preview&&(e.preview=await Z(e.originFileObj)),oe(e.url||e.preview),B(!0),re(e.name)},[D,N]=s.useState(!1),H=e=>{var r;(r=l.current)==null||r.rotateImage(e?-90:90)},L=s.useCallback(e=>{var r;l.current&&((r=l.current)==null||r.flipImage(e==="h",e==="v"))},[]);s.useEffect(()=>{f==null||f(i[0],i)},[i,f]);const le=async()=>{var y;const e=(y=l.current)==null?void 0:y.getCanvas(),{type:r,size:c,name:v,uid:S}=T.current;N(!0),e==null||e.toBlob(async ge=>{const xe=Object.assign(new File([ge],v,{type:r}),{uid:S}),Q=await we.resizeImage(xe),E=await Z(Q);console.log({url:E});const X={url:E,name:v,uid:S,type:r,size:c,thumbUrl:E,originFileObj:Q};if(a)try{N(!0),await a(X)}finally{N(!1)}z([X,...i]),N(!1)}),P(void 0)},ue=()=>{P(void 0),T.current=void 0},V=s.useCallback(e=>{const r=e;if(r){T.current=r;const c=new FileReader;c.addEventListener("load",()=>{var v;if(typeof c.result=="string"){P(c.result);const S=localStorage.getItem(Y),y=S?JSON.parse(S):void 0;y&&((v=l.current)==null||v.setState(y)),setTimeout(()=>{K(l.current)},100)}}),c.readAsDataURL(r)}},[]);s.useEffect(()=>{if(o!=null&&o.length||typeof o=="string"){const e=Array.isArray(o)?o.map(r=>[{uid:o,url:r}]):[{uid:o,url:o}];z(e)}},[o]);const{t:d}=he.useTranslationLib(),de=s.useMemo(()=>u?{required:u,validator:(e,r,c)=>{j||i!=null&&i.length?c():c(`${n??""} ${d("err.validation.required")}`)}}:void 0,[u,j,i==null?void 0:i.length,n,d]),J=w??d("message.uploadButtonText"),W=s.useMemo(()=>t.jsx(ee,{showLoadingIndicator:D,_buttonTitle:J,buttonSize:g,buttonType:p,fileList:i,hidePreview:C,icon:k,loading:F,listType:q,maxCount:b,onChangeFile:V,onRemove:R,showButtonText:x,handlePreview:ce,setFileList:z}),[D,J,g,p,i,C,k,F,q,b,V,R,x]);ie.current=W.props.beforeUpload;const[pe,$]=s.useState(0),[me,G]=s.useState(0),[M,fe]=s.useState();s.useEffect(()=>{const e=setTimeout(()=>{M&&localStorage.setItem(Y,JSON.stringify(M))},400);return()=>clearTimeout(e)},[M]),s.useEffect(()=>{if(!j){$(0),G(0);const e=setTimeout(()=>{var r;(r=l.current)==null||r.reset()},1500);return()=>clearTimeout(e)}},[j]);const K=s.useCallback(async e=>{if(e){const r=e.getCoordinates();fe(e.getState()),$((r==null?void 0:r.width)??10),G((r==null?void 0:r.height)??10)}},[]);return t.jsxs(t.Fragment,{children:[t.jsx(ve,{label:n,...A,name:m,className:"mb-0",rules:[de,...A.rules??[]],children:W}),t.jsxs(U.Modal,{open:!!j,maskClosable:!1,onOk:le,closable:!1,onCancel:ue,destroyOnHidden:!0,children:[t.jsx(je.Cropper,{ref:l,stencilProps:{grid:!0},style:{border:"1px solid black"},src:j,onChange:e=>{K(e)},aspectRatio:h?{minimum:h,maximum:h}:void 0}),t.jsx("p",{className:"text-center",children:[pe,me].join(" ⨉ ")}),t.jsx("div",{className:"mt-2 d-flex justify-content-center",children:t.jsxs(U.Space.Compact,{children:[t.jsx(I,{size:"large",tooltip:d("str.rotateLeft"),icon:t.jsx(O.RotateLeftOutlined,{}),onClick:()=>H(!0)}),t.jsx(I,{size:"large",icon:t.jsx(O.RotateRightOutlined,{}),tooltip:d("str.rotateRight"),onClick:()=>H(!1)}),t.jsx(I,{size:"large",icon:t.jsx(Ce,{}),tooltip:d("str.flipHorizontal"),onClick:()=>L("h")}),t.jsx(I,{size:"large",icon:t.jsx(be,{}),tooltip:d("str.flipVertical"),onClick:()=>L("v")})]})})]}),t.jsx(U.Modal,{open:ne,title:te,footer:null,onCancel:ae,children:t.jsx("div",{className:"text-center",children:t.jsx("img",{alt:"example",style:{maxWidth:"400px"},src:se})})})]})},ee=({_buttonTitle:o,buttonSize:u,buttonType:p,fileList:n,hidePreview:m,icon:f,loading:h,maxCount:w,onChangeFile:C,onRemove:g,showButtonText:x,handlePreview:_,setFileList:k,showLoadingIndicator:F,listType:b="picture"})=>t.jsxs(U.Upload,{accept:"image/x-png,image/gif,image/jpeg",fileList:n,defaultFileList:n,onChange:()=>{},className:(n.length>=w?" hide-upload ":"")+" mb-0",multiple:!1,onPreview:m?void 0:_,onDrop:a=>(C(a.dataTransfer.files.item(0)),!1),listType:b,showUploadList:!m,onRemove:a=>{const R=n.filter(q=>a.uid!==q.uid);g==null||g(a),k(R)},beforeUpload:async a=>(C(a),!1),maxCount:w,children:[F&&t.jsx(O.LoadingOutlined,{}),t.jsx("div",{className:"d-flex flex-column",children:n.length<w&&(b==="picture-circle"?t.jsx(O.UploadOutlined,{}):t.jsx(I,{loading:h,tooltip:x?void 0:o,size:u,icon:f,type:x?p:"text",children:x?o:void 0}))})]},n.length);exports.UploadComponent=ee;exports.default=Se;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as r, jsxs as z, Fragment as
|
|
2
|
-
import { Cropper as xe } from "
|
|
1
|
+
import { jsx as r, jsxs as z, Fragment as Ie } from "react/jsx-runtime";
|
|
2
|
+
import { Cropper as xe } from "react-advanced-cropper";
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { RotateLeftOutlined as Fe, RotateRightOutlined as Oe, UploadOutlined as
|
|
5
|
+
import { RotateLeftOutlined as Fe, RotateRightOutlined as Oe, UploadOutlined as ne, LoadingOutlined as Se } from "@ant-design/icons";
|
|
6
6
|
import { Form as Ue, Modal as te, Space as ke, Upload as Re } from "antd";
|
|
7
7
|
import H, { useRef as L, useState as w, useCallback as V, useEffect as j, useMemo as re } from "react";
|
|
8
8
|
import { useTranslationLib as Ne } from "../../locale/index.es.js";
|
|
@@ -30,7 +30,7 @@ const Ke = ({
|
|
|
30
30
|
buttonSize: f = "large",
|
|
31
31
|
showButtonText: g = !0,
|
|
32
32
|
showOnlyIcon: _ = !1,
|
|
33
|
-
icon: S = /* @__PURE__ */ r(
|
|
33
|
+
icon: S = /* @__PURE__ */ r(ne, {}),
|
|
34
34
|
loading: U,
|
|
35
35
|
maxCount: y = 1,
|
|
36
36
|
onAdd: s,
|
|
@@ -38,8 +38,8 @@ const Ke = ({
|
|
|
38
38
|
listType: R,
|
|
39
39
|
...E
|
|
40
40
|
}) => {
|
|
41
|
-
const [
|
|
42
|
-
!e.url && !e.preview && (e.preview = await ie(e.originFileObj)),
|
|
41
|
+
const [se, ae] = H.useState(""), [le, ce] = H.useState(""), [de, M] = H.useState(!1), T = L(), l = L(null), [n, P] = w([]), [h, B] = w(), me = L(), pe = () => M(!1), ue = async (e) => {
|
|
42
|
+
!e.url && !e.preview && (e.preview = await ie(e.originFileObj)), ce(e.url || e.preview), M(!0), ae(e.name);
|
|
43
43
|
}, [J, N] = w(!1), W = (e) => {
|
|
44
44
|
var t;
|
|
45
45
|
(t = l.current) == null || t.rotateImage(e ? -90 : 90);
|
|
@@ -50,13 +50,13 @@ const Ke = ({
|
|
|
50
50
|
j(() => {
|
|
51
51
|
u == null || u(n[0], n);
|
|
52
52
|
}, [n, u]);
|
|
53
|
-
const
|
|
53
|
+
const fe = async () => {
|
|
54
54
|
var F;
|
|
55
55
|
const e = (F = l.current) == null ? void 0 : F.getCanvas(), { type: t, size: a, name: I, uid: x } = T.current;
|
|
56
|
-
N(!0), e == null || e.toBlob(async (
|
|
57
|
-
const
|
|
56
|
+
N(!0), e == null || e.toBlob(async (ve) => {
|
|
57
|
+
const ye = Object.assign(new File([ve], I, { type: t }), {
|
|
58
58
|
uid: x
|
|
59
|
-
}), q = await je.resizeImage(
|
|
59
|
+
}), q = await je.resizeImage(ye), D = await ie(q);
|
|
60
60
|
console.log({ url: D });
|
|
61
61
|
const ee = {
|
|
62
62
|
url: D,
|
|
@@ -75,7 +75,7 @@ const Ke = ({
|
|
|
75
75
|
}
|
|
76
76
|
P([ee, ...n]), N(!1);
|
|
77
77
|
}), B(void 0);
|
|
78
|
-
},
|
|
78
|
+
}, ge = () => {
|
|
79
79
|
B(void 0), T.current = void 0;
|
|
80
80
|
}, G = V((e) => {
|
|
81
81
|
const t = e;
|
|
@@ -100,7 +100,7 @@ const Ke = ({
|
|
|
100
100
|
P(e);
|
|
101
101
|
}
|
|
102
102
|
}, [o]);
|
|
103
|
-
const { t: d } = Ne(),
|
|
103
|
+
const { t: d } = Ne(), he = re(
|
|
104
104
|
() => c ? {
|
|
105
105
|
required: c,
|
|
106
106
|
validator: (e, t, a) => {
|
|
@@ -125,7 +125,7 @@ const Ke = ({
|
|
|
125
125
|
onChangeFile: G,
|
|
126
126
|
onRemove: k,
|
|
127
127
|
showButtonText: g,
|
|
128
|
-
handlePreview:
|
|
128
|
+
handlePreview: ue,
|
|
129
129
|
setFileList: P
|
|
130
130
|
}
|
|
131
131
|
),
|
|
@@ -145,8 +145,8 @@ const Ke = ({
|
|
|
145
145
|
g
|
|
146
146
|
]
|
|
147
147
|
);
|
|
148
|
-
|
|
149
|
-
const [
|
|
148
|
+
me.current = Q.props.beforeUpload;
|
|
149
|
+
const [we, X] = w(0), [Ce, Y] = w(0), [A, be] = w();
|
|
150
150
|
j(() => {
|
|
151
151
|
const e = setTimeout(() => {
|
|
152
152
|
A && localStorage.setItem(oe, JSON.stringify(A));
|
|
@@ -165,10 +165,10 @@ const Ke = ({
|
|
|
165
165
|
const Z = V(async (e) => {
|
|
166
166
|
if (e) {
|
|
167
167
|
const t = e.getCoordinates();
|
|
168
|
-
|
|
168
|
+
be(e.getState()), X((t == null ? void 0 : t.width) ?? 10), Y((t == null ? void 0 : t.height) ?? 10);
|
|
169
169
|
}
|
|
170
170
|
}, []);
|
|
171
|
-
return /* @__PURE__ */ z(
|
|
171
|
+
return /* @__PURE__ */ z(Ie, { children: [
|
|
172
172
|
/* @__PURE__ */ r(
|
|
173
173
|
Pe,
|
|
174
174
|
{
|
|
@@ -176,7 +176,7 @@ const Ke = ({
|
|
|
176
176
|
...E,
|
|
177
177
|
name: p,
|
|
178
178
|
className: "mb-0",
|
|
179
|
-
rules: [
|
|
179
|
+
rules: [he, ...E.rules ?? []],
|
|
180
180
|
children: Q
|
|
181
181
|
}
|
|
182
182
|
),
|
|
@@ -185,9 +185,9 @@ const Ke = ({
|
|
|
185
185
|
{
|
|
186
186
|
open: !!h,
|
|
187
187
|
maskClosable: !1,
|
|
188
|
-
onOk:
|
|
188
|
+
onOk: fe,
|
|
189
189
|
closable: !1,
|
|
190
|
-
onCancel:
|
|
190
|
+
onCancel: ge,
|
|
191
191
|
destroyOnHidden: !0,
|
|
192
192
|
children: [
|
|
193
193
|
/* @__PURE__ */ r(
|
|
@@ -208,7 +208,7 @@ const Ke = ({
|
|
|
208
208
|
} : void 0
|
|
209
209
|
}
|
|
210
210
|
),
|
|
211
|
-
/* @__PURE__ */ r("p", { className: "text-center", children: [
|
|
211
|
+
/* @__PURE__ */ r("p", { className: "text-center", children: [we, Ce].join(" ⨉ ") }),
|
|
212
212
|
/* @__PURE__ */ r("div", { className: "mt-2 d-flex justify-content-center", children: /* @__PURE__ */ z(ke.Compact, { children: [
|
|
213
213
|
/* @__PURE__ */ r(
|
|
214
214
|
O,
|
|
@@ -253,11 +253,11 @@ const Ke = ({
|
|
|
253
253
|
/* @__PURE__ */ r(
|
|
254
254
|
te,
|
|
255
255
|
{
|
|
256
|
-
open:
|
|
257
|
-
title:
|
|
256
|
+
open: de,
|
|
257
|
+
title: se,
|
|
258
258
|
footer: null,
|
|
259
|
-
onCancel:
|
|
260
|
-
children: /* @__PURE__ */ r("div", { className: "text-center", children: /* @__PURE__ */ r("img", { alt: "example", style: { maxWidth: "400px" }, src:
|
|
259
|
+
onCancel: pe,
|
|
260
|
+
children: /* @__PURE__ */ r("div", { className: "text-center", children: /* @__PURE__ */ r("img", { alt: "example", style: { maxWidth: "400px" }, src: le }) })
|
|
261
261
|
}
|
|
262
262
|
)
|
|
263
263
|
] });
|
|
@@ -277,7 +277,7 @@ const Ke = ({
|
|
|
277
277
|
setFileList: S,
|
|
278
278
|
showLoadingIndicator: U,
|
|
279
279
|
listType: y = "picture"
|
|
280
|
-
}) => /* @__PURE__ */
|
|
280
|
+
}) => /* @__PURE__ */ z(
|
|
281
281
|
Re,
|
|
282
282
|
{
|
|
283
283
|
accept: "image/x-png,image/gif,image/jpeg",
|
|
@@ -299,7 +299,7 @@ const Ke = ({
|
|
|
299
299
|
maxCount: b,
|
|
300
300
|
children: [
|
|
301
301
|
U && /* @__PURE__ */ r(Se, {}),
|
|
302
|
-
/* @__PURE__ */ r("div", { className: "d-flex flex-column", children: i.length < b && (y === "picture-circle" ? /* @__PURE__ */ r(
|
|
302
|
+
/* @__PURE__ */ r("div", { className: "d-flex flex-column", children: i.length < b && (y === "picture-circle" ? /* @__PURE__ */ r(ne, {}) : /* @__PURE__ */ r(
|
|
303
303
|
O,
|
|
304
304
|
{
|
|
305
305
|
loading: C,
|
|
@@ -313,7 +313,7 @@ const Ke = ({
|
|
|
313
313
|
]
|
|
314
314
|
},
|
|
315
315
|
i.length
|
|
316
|
-
)
|
|
316
|
+
);
|
|
317
317
|
export {
|
|
318
318
|
Be as UploadComponent,
|
|
319
319
|
Ke as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),xt=require("antd"),mt=require("@dnd-kit/core"),jt=require("@dnd-kit/modifiers"),ht=require("@dnd-kit/utilities"),M=require("@dnd-kit/sortable"),yt=require("../../common/button/Button.cjs.js"),qt=require("../../common/button/CloneButtonTable.cjs.js"),lt=require("../../common/button/DeleteButtonTable.cjs.js"),vt=require("../../common/button/ExportButton.cjs.js"),St=require("../../common/button/HideButtonTable.cjs.js"),Bt=require("../../common/button/RefreshButton.cjs.js"),It=require("../../common/button/UpdateButtonTable.cjs.js"),Tt=require("../../common/button/ViewButtonTable.cjs.js"),Ct=require("../../common/table/table.cjs.js"),u=require("react"),Mt=require("../../locale/index.cjs.js"),Rt=require("../CrudSearchComponent.cjs.js"),Vt=require("./CrudDecListView.cjs.js"),et=require("./CrudViewerUtil.cjs.js"),Et=require("@ant-design/icons"),wt=require("../../common/layout/VerticalSpace.cjs.js"),Dt=u.memo(Ct);function Lt({idField:e="id",loadingData:v,fields:f,isDeleting:T,isHiding:S,viewable:x=!1,paginateProps:j,onDelete:h,onHide:C,onUpdate:l,data:B=[],extraAction:I,onClickUpdate:y,minusHeight:w,scroll:G,onClickClone:R,className:J,expandable:K,size:Q,bordered:X,descListColumn:st,extraView:D,decListLayout:ot,scrollToTop:Nt,onClickRefresh:Y,closeViewOnClickUpdate:Z,onExport:L,confirmHiding:A,confirmDeleting:P,rowClassName:W,actionWidth:H=190,draggable:o,...rt}){const{t:p}=Mt.useTranslationLib(),U=u.useMemo(()=>f.map(({hideInTable:t,hidden:s,width:c,name:r,label:_,halign:$,...E})=>({title:_,width:c,key:r,dataIndex:r,hidden:t||s,align:$??(E.type==="number"?"right":void 0),render:et.getRendererValueCrudViewer(E)})),[f]),[i,V]=u.useState(),[O,z]=u.useState(),[q,d]=u.useState([]);u.useEffect(()=>{B&&d(B)},[B]),u.useEffect(()=>{B&&V(t=>{if(t)return B.find(s=>s[e]===t[e])})},[B,e,i]);const N=u.useCallback(t=>{var c;const s=I==null?void 0:I(t);return(Array.isArray(s)?(c=s==null?void 0:s.filter(Boolean))!=null&&c.length:s)||l||y||R||h?n.jsxs(n.Fragment,{children:[s,(l||y)&&n.jsx(It,{value:t,onClick:r=>{z(r[e]),y==null||y(t),Z&&V(void 0)}}),R&&n.jsx(qt,{value:t,onClick:r=>R(r)}),L&&n.jsx(vt.ExportButton,{value:t,onClick:async r=>await L(r)}),C&&n.jsx(St,{value:t,disabled:S,shouldConfirm:A,loading:S&&t[e]===O,onClick:async r=>{z(r[e]),await C({[e]:r[e]})}}),h&&n.jsx(lt,{value:t,disabled:T,shouldConfirm:P,loading:T&&t[e]===O,onClick:async r=>{z(r[e]),await h({[e]:r[e]})}})]}):void 0},[Z,P,A,I,e,T,S,R,y,h,L,C,l,O]),b=u.useCallback(t=>{var r;const{active:s,over:c}=t;if(o!=null&&o.onDragEnd&&(o==null||o.onDragEnd(t)),s.id!==(c==null?void 0:c.id)){const _=q.findIndex(m=>m[e]===s.id),$=q.findIndex(m=>m[e]===(c==null?void 0:c.id)),E=M.arrayMove(q,_,$);d(m=>{const it=m.findIndex(k=>k[e]===(s==null?void 0:s.id)),ft=m.findIndex(k=>k[e]===(c==null?void 0:c.id));return M.arrayMove(m,it,ft)}),(r=o==null?void 0:o.onDrag)==null||r.call(o,{newOrder:E.map(m=>m[e])})}},[q,e,o]),ut=u.useMemo(()=>{let t=typeof x=="string"?i==null?void 0:i[x]:void 0;if(typeof t=="object"){const s=f.find(c=>c.name===x);t=et.getRendererValueCrudViewer(s)(t,i,0)}return t},[x,i,f]),a=u.useMemo(()=>({rowClassName:W,className:J,scroll:G??(w?{y:`calc(100vh - ${w})`}:void 0),id:"crud-table",bordered:X,size:Q,expandable:K}),[W,J,G,w,X,Q,K]),F=u.useMemo(()=>j?{total:j.count,onChange:j.setPage,current:j.page,pageSize:j.pageSize}:void 0,[j]),g=u.useMemo(()=>{const t=l||y||h||I||x,s=[];return o&&s.push({key:"key",align:"center",width:5,title:o==null?void 0:o.columnLabel,render:()=>n.jsx(Ot,{tooltip:o==null?void 0:o.tooltip})}),s.push(...U),t&&t&&s.push({title:p("str.action"),fixed:"right",width:H,render:(c,r)=>n.jsxs(n.Fragment,{children:[x&&n.jsx(Tt,{value:r,onClick:V}),N(r)]})}),s},[U,l,y,h,I,x,p,H,N]),tt=u.useMemo(()=>q.map(t=>t[e]),[q,e]),ct=u.useCallback(()=>{const t=n.jsx(Dt,{...a,dataSource:q,loading:v,components:o?{body:{row:zt}}:void 0,pagination:F,columns:g});return o?n.jsx(mt.DndContext,{modifiers:[jt.restrictToVerticalAxis],onDragEnd:b,children:n.jsx(M.SortableContext,{items:tt,strategy:M.verticalListSortingStrategy,children:t})}):t},[a,q,v,F,g,o,tt,b]);return n.jsxs("div",{children:[x&&n.jsx(xt.Modal,{width:"100%",open:!!i,title:ut??n.jsx("div",{children:" "}),footer:n.jsx(n.Fragment,{}),closable:!0,onCancel:()=>V(void 0),children:!!i&&n.jsxs("div",{children:[n.jsx(Vt.CrudDecListView,{layout:ot,descListColumn:st,data:i,fields:f,action:N(i)}),D==null?void 0:D(i)]},i==null?void 0:i[e])}),n.jsx(Rt,{fields:f,...rt}),n.jsxs(wt,{children:[!!Y&&n.jsx(Bt.RefreshButton,{onClick:Y}),ct()]})]})}const nt=u.createContext({}),Ot=({tooltip:e})=>{const{setActivatorNodeRef:v,listeners:f}=u.useContext(nt);return n.jsx(yt,{type:"text",size:"small",tooltip:e,icon:n.jsx(Et.HolderOutlined,{}),style:{cursor:"move",border:"none"},ref:v,...f})},zt=e=>{const{attributes:v,listeners:f,setNodeRef:T,setActivatorNodeRef:S,transform:x,transition:j,isDragging:h}=M.useSortable({id:e["data-row-key"]}),C={...e.style,transform:ht.CSS.Translate.toString(x),transition:j,...h?{position:"relative",zIndex:9999}:{}},l=u.useMemo(()=>({setActivatorNodeRef:S,listeners:f}),[S,f]);return n.jsx(nt.Provider,{value:l,children:n.jsx("tr",{...e,ref:T,style:C,...v})})};module.exports=Lt;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as D, Fragment as G, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { Modal as It } from "antd";
|
|
3
|
-
import { DndContext as St } from "
|
|
4
|
-
import { restrictToVerticalAxis as lt } from "
|
|
5
|
-
import { CSS as Bt } from "
|
|
6
|
-
import { arrayMove as st, SortableContext as Ct, verticalListSortingStrategy as xt, useSortable as Rt } from "
|
|
3
|
+
import { DndContext as St } from "@dnd-kit/core";
|
|
4
|
+
import { restrictToVerticalAxis as lt } from "@dnd-kit/modifiers";
|
|
5
|
+
import { CSS as Bt } from "@dnd-kit/utilities";
|
|
6
|
+
import { arrayMove as st, SortableContext as Ct, verticalListSortingStrategy as xt, useSortable as Rt } from "@dnd-kit/sortable";
|
|
7
7
|
import Dt from "../../common/button/Button.es.js";
|
|
8
8
|
import Et from "../../common/button/CloneButtonTable.es.js";
|
|
9
9
|
import Lt from "../../common/button/DeleteButtonTable.es.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingteza/crud-component",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.55",
|
|
5
5
|
"description": "React CRUD component library with Ant Design",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"build": "npm run clean && tsc && vite build && cp package.json README.md .npmignore dist/",
|
|
39
39
|
"publish-npm": "yarn build && cd dist && npm whoami >/dev/null 2>&1 || npm login && npm publish",
|
|
40
40
|
"lint": "eslint .",
|
|
41
|
+
"tsc": "tsc",
|
|
41
42
|
"preview": "vite preview"
|
|
42
43
|
},
|
|
43
44
|
"exports": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}exports.getDefaultExportFromCjs=e;
|
package/_virtual/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./_commonjsHelpers.cjs.js"),r=require("../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js");var s=r.__require();const t=e.getDefaultExportFromCjs(s);module.exports=t;
|
package/_virtual/index.cjs2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
package/_virtual/index.es.js
DELETED
package/_virtual/index.es2.js
DELETED