@kingteza/crud-component 1.0.51 → 1.0.54
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/App.d.ts +1 -0
- package/Play.d.ts +2 -0
- package/_virtual/_commonjsHelpers.cjs.js +1 -0
- package/_virtual/_commonjsHelpers.es.js +8 -0
- package/_virtual/_nodeUtil.cjs.js +1 -0
- package/_virtual/_nodeUtil.es.js +4 -0
- package/_virtual/index.cjs.js +1 -0
- package/_virtual/index.cjs2.js +1 -0
- package/_virtual/index.cjs3.js +1 -0
- package/_virtual/index.es.js +11 -0
- package/_virtual/index.es2.js +7 -0
- package/_virtual/index.es3.js +4 -0
- package/_virtual/isBuffer.cjs.js +1 -0
- package/_virtual/isBuffer.es.js +4 -0
- package/_virtual/quill.cjs.js +1 -0
- package/_virtual/quill.es.js +4 -0
- package/common/button/Button.cjs.js +1 -1
- package/common/button/Button.es.js +38 -52
- package/common/button/CloneButtonTable.cjs.js +1 -1
- package/common/button/HideButtonTable.cjs.js +1 -1
- package/common/button/NewButton.cjs.js +1 -1
- package/common/button/PrintButton.cjs.js +1 -1
- package/common/button/RefreshButton.cjs.js +1 -1
- package/common/button/UnHideButton.cjs.js +1 -1
- package/common/button/UpdateButtonTable.cjs.js +1 -1
- package/common/button/ViewButtonTable.cjs.js +1 -1
- package/common/icon/KIcon.cjs.js +1 -0
- package/common/icon/KIcon.d.ts +9 -0
- package/common/icon/KIcon.es.js +11 -0
- package/common/index.cjs.js +1 -1
- package/common/index.es.js +68 -68
- package/common/picker/ImagePicker.cjs.js +1 -1
- package/common/picker/ImagePicker.es.js +228 -189
- package/common/rich/index.cjs.js +1 -1
- package/common/rich/index.es.js +10 -10
- package/common/select/SelectComponent.es.js +4 -4
- package/common/tab/TabViewWithRoute.cjs.js +1 -1
- package/common/tab/TabViewWithRoute.es.js +21 -21
- package/common/table/table.d.ts +1 -1
- package/common/text-field/TextField.cjs.js +1 -1
- package/common/wizard/WizardResult.es.js +4 -4
- package/crud/CrudComponent.cjs.js +1 -1
- package/crud/CrudComponent.d.ts +5 -1
- package/crud/CrudComponent.es.js +66 -64
- package/crud/CrudField.es.js +1 -1
- package/crud/CrudReportComponent.cjs.js +1 -1
- package/crud/FileCrudField.cjs.js +1 -1
- package/crud/FileCrudField.es.js +23 -23
- package/crud/import/CrudImportComponent.cjs.js +2 -2
- package/crud/import/CrudImportComponent.es.js +10 -10
- package/crud/view/CrudViewer.cjs.js +1 -1
- package/crud/view/CrudViewer.d.ts +11 -1
- package/crud/view/CrudViewer.es.js +285 -174
- package/index.cjs.js +1 -1
- package/index.es.js +19 -19
- package/locale/index.d.ts +5 -0
- package/locale/translations/en.cjs.js +1 -1
- package/locale/translations/en.d.ts +5 -0
- package/locale/translations/en.es.js +7 -2
- package/package.json +7 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as w, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { WarningTwoTone as B, DownloadOutlined as z } from "@ant-design/icons";
|
|
3
3
|
import $ from "papaparse";
|
|
4
|
-
import { Tooltip as V, App as
|
|
5
|
-
import { saveAs as
|
|
6
|
-
import { useState as T, useEffect as
|
|
4
|
+
import { Tooltip as V, App as H, Modal as R, Space as O, Spin as U, Progress as Y } from "antd";
|
|
5
|
+
import { saveAs as _ } from "file-saver";
|
|
6
|
+
import { useState as T, useEffect as G, useMemo as A, useCallback as f } from "react";
|
|
7
7
|
import { useTranslationLib as J } from "../../locale/index.es.js";
|
|
8
8
|
import K from "../view/CrudViewer.es.js";
|
|
9
9
|
import Q from "../../util/DateUtil.es.js";
|
|
@@ -16,7 +16,7 @@ function de({
|
|
|
16
16
|
importProps: o
|
|
17
17
|
}) {
|
|
18
18
|
const [c, F] = T([]), [g, C] = T(!1), [N, I] = T(0);
|
|
19
|
-
|
|
19
|
+
G(() => {
|
|
20
20
|
x || (F([]), C(!1));
|
|
21
21
|
}, [x]);
|
|
22
22
|
const u = A(
|
|
@@ -40,7 +40,7 @@ function de({
|
|
|
40
40
|
async function() {
|
|
41
41
|
const e = `${E.join(",")}
|
|
42
42
|
`, t = new Blob([e], { type: "text/csv;charset=utf-8;" });
|
|
43
|
-
|
|
43
|
+
_(
|
|
44
44
|
t,
|
|
45
45
|
(o == null ? void 0 : o.name) + " - " + Q.formatDateTimeWithSecond(/* @__PURE__ */ new Date()).replaceAll(":", "-") + ".csv"
|
|
46
46
|
);
|
|
@@ -95,7 +95,7 @@ function de({
|
|
|
95
95
|
} finally {
|
|
96
96
|
C(!1), I(0);
|
|
97
97
|
}
|
|
98
|
-
}, [c, o, b, q]), { modal: S } =
|
|
98
|
+
}, [c, o, b, q]), { modal: S } = H.useApp(), M = f(async () => {
|
|
99
99
|
k ? S.warning ? S.warning({
|
|
100
100
|
title: s("str.warning"),
|
|
101
101
|
content: s("qus.importWithIssues"),
|
|
@@ -108,13 +108,13 @@ function de({
|
|
|
108
108
|
), window.confirm(s("qus.importWithIssues")) && y()) : y();
|
|
109
109
|
}, [k, y, s]);
|
|
110
110
|
return /* @__PURE__ */ w(
|
|
111
|
-
|
|
111
|
+
R,
|
|
112
112
|
{
|
|
113
113
|
title: [s("str.import"), o == null ? void 0 : o.name].filter(Boolean).join(" "),
|
|
114
114
|
width: "100%",
|
|
115
115
|
open: x,
|
|
116
116
|
onOk: M,
|
|
117
|
-
|
|
117
|
+
destroyOnHidden: !0,
|
|
118
118
|
onCancel: () => b(!1),
|
|
119
119
|
okText: s("str.import"),
|
|
120
120
|
confirmLoading: g,
|
|
@@ -155,11 +155,11 @@ function de({
|
|
|
155
155
|
)
|
|
156
156
|
] }),
|
|
157
157
|
/* @__PURE__ */ i(
|
|
158
|
-
|
|
158
|
+
U,
|
|
159
159
|
{
|
|
160
160
|
spinning: g,
|
|
161
161
|
indicator: N ? /* @__PURE__ */ i(
|
|
162
|
-
|
|
162
|
+
Y,
|
|
163
163
|
{
|
|
164
164
|
type: "circle",
|
|
165
165
|
percent: N * 100,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),ft=require("antd"),xt=require("../../node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.cjs.js"),jt=require("../../node_modules/.pnpm/@dnd-kit_modifiers@9.0.0_@dnd-kit_core@6.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1__react@18.3.1/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.cjs.js"),ht=require("../../node_modules/.pnpm/@dnd-kit_utilities@3.2.2_react@18.3.1/node_modules/@dnd-kit/utilities/dist/utilities.esm.cjs.js"),M=require("../../node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1__react@18.3.1/node_modules/@dnd-kit/sortable/dist/sortable.esm.cjs.js"),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:m,isDeleting:T,isHiding:S,viewable:f=!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:nt,extraView:D,decListLayout:ot,scrollToTop:zt,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(()=>m.map(({hideInTable:t,hidden:n,width:c,name:r,label:N,halign:$,...E})=>({title:N,width:c,key:r,dataIndex:r,hidden:t||n,align:$??(E.type==="number"?"right":void 0),render:et.getRendererValueCrudViewer(E)})),[m]),[i,V]=u.useState(),[_,O]=u.useState(),[q,d]=u.useState([]);u.useEffect(()=>{B&&d(B)},[B]),u.useEffect(()=>{B&&V(t=>{if(t)return B.find(n=>n[e]===t[e])})},[B,e,i]);const z=u.useCallback(t=>{var c;const n=I==null?void 0:I(t);return(Array.isArray(n)?(c=n==null?void 0:n.filter(Boolean))!=null&&c.length:n)||l||y||R||h?s.jsxs(s.Fragment,{children:[n,(l||y)&&s.jsx(It,{value:t,onClick:r=>{O(r[e]),y==null||y(t),Z&&V(void 0)}}),R&&s.jsx(qt,{value:t,onClick:r=>R(r)}),L&&s.jsx(vt.ExportButton,{value:t,onClick:async r=>await L(r)}),C&&s.jsx(St,{value:t,disabled:S,shouldConfirm:A,loading:S&&t[e]===_,onClick:async r=>{O(r[e]),await C({[e]:r[e]})}}),h&&s.jsx(lt,{value:t,disabled:T,shouldConfirm:P,loading:T&&t[e]===_,onClick:async r=>{O(r[e]),await h({[e]:r[e]})}})]}):void 0},[Z,P,A,I,e,T,S,R,y,h,L,C,l,_]),b=u.useCallback(t=>{var r;const{active:n,over:c}=t;if(o!=null&&o.onDragEnd&&(o==null||o.onDragEnd(t)),n.id!==(c==null?void 0:c.id)){const N=q.findIndex(x=>x[e]===n.id),$=q.findIndex(x=>x[e]===(c==null?void 0:c.id)),E=M.arrayMove(q,N,$);d(x=>{const it=x.findIndex(k=>k[e]===(n==null?void 0:n.id)),mt=x.findIndex(k=>k[e]===(c==null?void 0:c.id));return M.arrayMove(x,it,mt)}),(r=o==null?void 0:o.onDrag)==null||r.call(o,{newOrder:E.map(x=>x[e])})}},[q,e,o]),ut=u.useMemo(()=>{let t=typeof f=="string"?i==null?void 0:i[f]:void 0;if(typeof t=="object"){const n=m.find(c=>c.name===f);t=et.getRendererValueCrudViewer(n)(t,i,0)}return t},[f,i,m]),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||f,n=[];return o&&n.push({key:"key",align:"center",width:5,title:o==null?void 0:o.columnLabel,render:()=>s.jsx(_t,{tooltip:o==null?void 0:o.tooltip})}),n.push(...U),t&&t&&n.push({title:p("str.action"),fixed:"right",width:H,render:(c,r)=>s.jsxs(s.Fragment,{children:[f&&s.jsx(Tt,{value:r,onClick:V}),z(r)]})}),n},[U,l,y,h,I,f,p,H,z]),tt=u.useMemo(()=>q.map(t=>t[e]),[q,e]),ct=u.useCallback(()=>{const t=s.jsx(Dt,{...a,dataSource:q,loading:v,components:o?{body:{row:Ot}}:void 0,pagination:F,columns:g});return o?s.jsx(xt.DndContext,{modifiers:[jt.restrictToVerticalAxis],onDragEnd:b,children:s.jsx(M.SortableContext,{items:tt,strategy:M.verticalListSortingStrategy,children:t})}):t},[a,q,v,F,g,o,tt,b]);return s.jsxs("div",{children:[f&&s.jsx(ft.Modal,{width:"100%",open:!!i,title:ut??s.jsx("div",{children:" "}),footer:s.jsx(s.Fragment,{}),closable:!0,onCancel:()=>V(void 0),children:!!i&&s.jsxs("div",{children:[s.jsx(Vt.CrudDecListView,{layout:ot,descListColumn:nt,data:i,fields:m,action:z(i)}),D==null?void 0:D(i)]},i==null?void 0:i[e])}),s.jsx(Rt,{fields:m,...rt}),s.jsxs(wt,{children:[!!Y&&s.jsx(Bt.RefreshButton,{onClick:Y}),ct()]})]})}const st=u.createContext({}),_t=({tooltip:e})=>{const{setActivatorNodeRef:v,listeners:m}=u.useContext(st);return s.jsx(yt,{type:"text",size:"small",tooltip:e,icon:s.jsx(Et.HolderOutlined,{}),style:{cursor:"move",border:"none"},ref:v,...m})},Ot=e=>{const{attributes:v,listeners:m,setNodeRef:T,setActivatorNodeRef:S,transform:f,transition:j,isDragging:h}=M.useSortable({id:e["data-row-key"]}),C={...e.style,transform:ht.CSS.Translate.toString(f),transition:j,...h?{position:"relative",zIndex:9999}:{}},l=u.useMemo(()=>({setActivatorNodeRef:S,listeners:m}),[S,m]);return s.jsx(st.Provider,{value:l,children:s.jsx("tr",{...e,ref:T,style:C,...v})})};module.exports=Lt;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
2
2
|
import { ExpandableConfig } from 'antd/es/table/interface';
|
|
3
|
+
import { DragEndEvent } from '@dnd-kit/core';
|
|
3
4
|
import { TableProps } from 'antd/lib';
|
|
4
5
|
import { default as React, ReactElement } from 'react';
|
|
5
6
|
import { default as IdProps } from '../../types/Id';
|
|
6
7
|
import { CrudFieldProps, CrudPaginateProps } from '../CrudComponent';
|
|
7
8
|
import { CrudSearchComponentProps } from '../CrudSearchComponent';
|
|
8
9
|
import { DescListColumn } from './CrudDecListView';
|
|
10
|
+
export type CrudDragableProps<T> = {
|
|
11
|
+
onDragEnd?: (event: DragEndEvent) => void;
|
|
12
|
+
onDrag?: (params: {
|
|
13
|
+
newOrder: T[];
|
|
14
|
+
}) => void;
|
|
15
|
+
columnLabel?: string;
|
|
16
|
+
tooltip?: string;
|
|
17
|
+
};
|
|
9
18
|
export type CrudViewerProps<T, FormType> = {
|
|
10
19
|
fields: CrudFieldProps<T>[];
|
|
11
20
|
decListLayout?: "horizontal" | "vertical";
|
|
@@ -38,6 +47,7 @@ export type CrudViewerProps<T, FormType> = {
|
|
|
38
47
|
scrollToTop?: boolean;
|
|
39
48
|
rowClassName?: TableProps<T>["rowClassName"];
|
|
40
49
|
actionWidth?: string | number;
|
|
50
|
+
draggable?: CrudDragableProps<T>;
|
|
41
51
|
} & CrudSearchComponentProps<T, FormType>;
|
|
42
|
-
declare function CrudViewer<T, FormType = T>({ idField, loadingData, fields, isDeleting, isHiding, viewable, paginateProps, onDelete, onHide, onUpdate, data, extraAction, onClickUpdate, minusHeight, scroll, onClickClone, className, expandable, size, bordered, descListColumn, extraView, decListLayout, scrollToTop, onClickRefresh, closeViewOnClickUpdate, onExport, confirmHiding, confirmDeleting, rowClassName, actionWidth, ...props }: CrudViewerProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
declare function CrudViewer<T, FormType = T>({ idField, loadingData, fields, isDeleting, isHiding, viewable, paginateProps, onDelete, onHide, onUpdate, data, extraAction, onClickUpdate, minusHeight, scroll, onClickClone, className, expandable, size, bordered, descListColumn, extraView, decListLayout, scrollToTop, onClickRefresh, closeViewOnClickUpdate, onExport, confirmHiding, confirmDeleting, rowClassName, actionWidth, draggable, ...props }: CrudViewerProps<T, FormType>): import("react/jsx-runtime").JSX.Element;
|
|
43
53
|
export default CrudViewer;
|
|
@@ -1,216 +1,327 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Modal as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { jsxs as D, Fragment as G, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as It } from "antd";
|
|
3
|
+
import { DndContext as St } from "../../node_modules/.pnpm/@dnd-kit_core@6.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.es.js";
|
|
4
|
+
import { restrictToVerticalAxis as lt } from "../../node_modules/.pnpm/@dnd-kit_modifiers@9.0.0_@dnd-kit_core@6.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1__react@18.3.1/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.es.js";
|
|
5
|
+
import { CSS as Bt } from "../../node_modules/.pnpm/@dnd-kit_utilities@3.2.2_react@18.3.1/node_modules/@dnd-kit/utilities/dist/utilities.esm.es.js";
|
|
6
|
+
import { arrayMove as st, SortableContext as Ct, verticalListSortingStrategy as xt, useSortable as Rt } from "../../node_modules/.pnpm/@dnd-kit_sortable@10.0.0_@dnd-kit_core@6.3.1_react-dom@18.3.1_react@18.3.1__react@18.3.1__react@18.3.1/node_modules/@dnd-kit/sortable/dist/sortable.esm.es.js";
|
|
7
|
+
import Dt from "../../common/button/Button.es.js";
|
|
8
|
+
import Et from "../../common/button/CloneButtonTable.es.js";
|
|
9
|
+
import Lt from "../../common/button/DeleteButtonTable.es.js";
|
|
10
|
+
import { ExportButton as Mt } from "../../common/button/ExportButton.es.js";
|
|
11
|
+
import Ot from "../../common/button/HideButtonTable.es.js";
|
|
12
|
+
import { RefreshButton as jt } from "../../common/button/RefreshButton.es.js";
|
|
13
|
+
import zt from "../../common/button/UpdateButtonTable.es.js";
|
|
14
|
+
import Vt from "../../common/button/ViewButtonTable.es.js";
|
|
15
|
+
import wt from "../../common/table/table.es.js";
|
|
16
|
+
import et, { useMemo as I, useState as J, useEffect as ct, useCallback as K, useContext as Nt } from "react";
|
|
17
|
+
import { useTranslationLib as _t } from "../../locale/index.es.js";
|
|
18
|
+
import $t from "../CrudSearchComponent.es.js";
|
|
19
|
+
import { CrudDecListView as qt } from "./CrudDecListView.es.js";
|
|
20
|
+
import { getRendererValueCrudViewer as mt } from "./CrudViewerUtil.es.js";
|
|
21
|
+
import { HolderOutlined as Gt } from "@ant-design/icons";
|
|
22
|
+
import Jt from "../../common/layout/VerticalSpace.es.js";
|
|
23
|
+
const Kt = et.memo(wt);
|
|
24
|
+
function io({
|
|
25
|
+
idField: o = "id",
|
|
26
|
+
loadingData: S,
|
|
27
|
+
fields: u,
|
|
28
|
+
isDeleting: x,
|
|
29
|
+
isHiding: l,
|
|
30
|
+
viewable: f = !1,
|
|
31
|
+
paginateProps: h,
|
|
32
|
+
onDelete: y,
|
|
33
|
+
onHide: R,
|
|
34
|
+
onUpdate: T,
|
|
28
35
|
data: B = [],
|
|
29
|
-
extraAction:
|
|
30
|
-
onClickUpdate:
|
|
31
|
-
minusHeight:
|
|
32
|
-
scroll:
|
|
33
|
-
onClickClone:
|
|
34
|
-
className:
|
|
35
|
-
expandable:
|
|
36
|
-
size:
|
|
37
|
-
bordered:
|
|
38
|
-
descListColumn:
|
|
39
|
-
extraView:
|
|
40
|
-
decListLayout:
|
|
41
|
-
scrollToTop:
|
|
42
|
-
onClickRefresh:
|
|
43
|
-
closeViewOnClickUpdate:
|
|
44
|
-
onExport:
|
|
45
|
-
confirmHiding:
|
|
46
|
-
confirmDeleting:
|
|
47
|
-
rowClassName:
|
|
48
|
-
actionWidth:
|
|
49
|
-
|
|
36
|
+
extraAction: C,
|
|
37
|
+
onClickUpdate: p,
|
|
38
|
+
minusHeight: O,
|
|
39
|
+
scroll: Q,
|
|
40
|
+
onClickClone: E,
|
|
41
|
+
className: X,
|
|
42
|
+
expandable: Y,
|
|
43
|
+
size: Z,
|
|
44
|
+
bordered: A,
|
|
45
|
+
descListColumn: ft,
|
|
46
|
+
extraView: j,
|
|
47
|
+
decListLayout: it,
|
|
48
|
+
scrollToTop: Yt,
|
|
49
|
+
onClickRefresh: P,
|
|
50
|
+
closeViewOnClickUpdate: W,
|
|
51
|
+
onExport: z,
|
|
52
|
+
confirmHiding: k,
|
|
53
|
+
confirmDeleting: H,
|
|
54
|
+
rowClassName: U,
|
|
55
|
+
actionWidth: b = 190,
|
|
56
|
+
draggable: r,
|
|
57
|
+
...ht
|
|
50
58
|
}) {
|
|
51
|
-
const { t:
|
|
52
|
-
() =>
|
|
53
|
-
({ hideInTable:
|
|
54
|
-
title:
|
|
55
|
-
width:
|
|
56
|
-
key:
|
|
57
|
-
dataIndex:
|
|
58
|
-
hidden:
|
|
59
|
-
align:
|
|
60
|
-
render:
|
|
59
|
+
const { t: d } = _t(), F = I(
|
|
60
|
+
() => u.map(
|
|
61
|
+
({ hideInTable: t, hidden: n, width: m, name: s, label: _, halign: $, ...M }) => ({
|
|
62
|
+
title: _,
|
|
63
|
+
width: m,
|
|
64
|
+
key: s,
|
|
65
|
+
dataIndex: s,
|
|
66
|
+
hidden: t || n,
|
|
67
|
+
align: $ ?? (M.type === "number" ? "right" : void 0),
|
|
68
|
+
render: mt(M)
|
|
61
69
|
})
|
|
62
70
|
),
|
|
63
|
-
[
|
|
64
|
-
), [
|
|
65
|
-
|
|
66
|
-
B &&
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
[u]
|
|
72
|
+
), [e, L] = J(), [V, w] = J(), [v, a] = J([]);
|
|
73
|
+
ct(() => {
|
|
74
|
+
B && a(B);
|
|
75
|
+
}, [B]), ct(() => {
|
|
76
|
+
B && L((t) => {
|
|
77
|
+
if (t)
|
|
78
|
+
return B.find((n) => n[o] === t[o]);
|
|
69
79
|
});
|
|
70
|
-
}, [B,
|
|
71
|
-
const
|
|
72
|
-
(
|
|
73
|
-
var
|
|
74
|
-
const
|
|
75
|
-
return (Array.isArray(
|
|
76
|
-
|
|
77
|
-
(
|
|
78
|
-
|
|
80
|
+
}, [B, o, e]);
|
|
81
|
+
const N = K(
|
|
82
|
+
(t) => {
|
|
83
|
+
var m;
|
|
84
|
+
const n = C == null ? void 0 : C(t);
|
|
85
|
+
return (Array.isArray(n) ? (m = n == null ? void 0 : n.filter(Boolean)) != null && m.length : n) || T || p || E || y ? /* @__PURE__ */ D(G, { children: [
|
|
86
|
+
n,
|
|
87
|
+
(T || p) && /* @__PURE__ */ c(
|
|
88
|
+
zt,
|
|
79
89
|
{
|
|
80
|
-
value:
|
|
81
|
-
onClick: (
|
|
82
|
-
|
|
90
|
+
value: t,
|
|
91
|
+
onClick: (s) => {
|
|
92
|
+
w(s[o]), p == null || p(t), W && L(void 0);
|
|
83
93
|
}
|
|
84
94
|
}
|
|
85
95
|
),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
E && /* @__PURE__ */ c(Et, { value: t, onClick: (s) => E(s) }),
|
|
97
|
+
z && /* @__PURE__ */ c(
|
|
98
|
+
Mt,
|
|
89
99
|
{
|
|
90
|
-
value:
|
|
91
|
-
onClick: async (
|
|
100
|
+
value: t,
|
|
101
|
+
onClick: async (s) => await z(s)
|
|
92
102
|
}
|
|
93
103
|
),
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
R && /* @__PURE__ */ c(
|
|
105
|
+
Ot,
|
|
96
106
|
{
|
|
97
|
-
value:
|
|
98
|
-
disabled:
|
|
99
|
-
shouldConfirm:
|
|
100
|
-
loading:
|
|
101
|
-
onClick: async (
|
|
102
|
-
|
|
107
|
+
value: t,
|
|
108
|
+
disabled: l,
|
|
109
|
+
shouldConfirm: k,
|
|
110
|
+
loading: l && t[o] === V,
|
|
111
|
+
onClick: async (s) => {
|
|
112
|
+
w(s[o]), await R({ [o]: s[o] });
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
115
|
),
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
y && /* @__PURE__ */ c(
|
|
117
|
+
Lt,
|
|
108
118
|
{
|
|
109
|
-
value:
|
|
110
|
-
disabled:
|
|
111
|
-
shouldConfirm:
|
|
112
|
-
loading:
|
|
113
|
-
onClick: async (
|
|
114
|
-
|
|
119
|
+
value: t,
|
|
120
|
+
disabled: x,
|
|
121
|
+
shouldConfirm: H,
|
|
122
|
+
loading: x && t[o] === V,
|
|
123
|
+
onClick: async (s) => {
|
|
124
|
+
w(s[o]), await y({ [o]: s[o] });
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
127
|
)
|
|
118
128
|
] }) : void 0;
|
|
119
129
|
},
|
|
120
130
|
[
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
131
|
+
W,
|
|
132
|
+
H,
|
|
133
|
+
k,
|
|
134
|
+
C,
|
|
135
|
+
o,
|
|
136
|
+
x,
|
|
137
|
+
l,
|
|
138
|
+
E,
|
|
126
139
|
p,
|
|
127
|
-
i,
|
|
128
|
-
T,
|
|
129
|
-
e,
|
|
130
|
-
h,
|
|
131
|
-
I,
|
|
132
|
-
S,
|
|
133
140
|
y,
|
|
134
|
-
|
|
141
|
+
z,
|
|
142
|
+
R,
|
|
143
|
+
T,
|
|
144
|
+
V
|
|
135
145
|
]
|
|
136
|
-
),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
r
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
), g = K(
|
|
147
|
+
(t) => {
|
|
148
|
+
var s;
|
|
149
|
+
const { active: n, over: m } = t;
|
|
150
|
+
if (r != null && r.onDragEnd && (r == null || r.onDragEnd(t)), n.id !== (m == null ? void 0 : m.id)) {
|
|
151
|
+
const _ = v.findIndex(
|
|
152
|
+
(i) => i[o] === n.id
|
|
153
|
+
), $ = v.findIndex(
|
|
154
|
+
(i) => i[o] === (m == null ? void 0 : m.id)
|
|
155
|
+
), M = st(v, _, $);
|
|
156
|
+
a((i) => {
|
|
157
|
+
const vt = i.findIndex(
|
|
158
|
+
(q) => q[o] === (n == null ? void 0 : n.id)
|
|
159
|
+
), Tt = i.findIndex(
|
|
160
|
+
(q) => q[o] === (m == null ? void 0 : m.id)
|
|
161
|
+
);
|
|
162
|
+
return st(i, vt, Tt);
|
|
163
|
+
}), (s = r == null ? void 0 : r.onDrag) == null || s.call(r, {
|
|
164
|
+
newOrder: M.map((i) => i[o])
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
[v, o, r]
|
|
169
|
+
), yt = I(() => {
|
|
170
|
+
let t = typeof f == "string" ? e == null ? void 0 : e[f] : void 0;
|
|
171
|
+
if (typeof t == "object") {
|
|
172
|
+
const n = u.find((m) => m.name === f);
|
|
173
|
+
t = mt(n)(
|
|
174
|
+
t,
|
|
175
|
+
e,
|
|
143
176
|
0
|
|
144
177
|
);
|
|
145
178
|
}
|
|
146
|
-
return
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
179
|
+
return t;
|
|
180
|
+
}, [f, e, u]), tt = I(
|
|
181
|
+
() => ({
|
|
182
|
+
rowClassName: U,
|
|
183
|
+
className: X,
|
|
184
|
+
scroll: Q ?? (O ? { y: `calc(100vh - ${O})` } : void 0),
|
|
185
|
+
id: "crud-table",
|
|
186
|
+
bordered: A,
|
|
187
|
+
size: Z,
|
|
188
|
+
expandable: Y
|
|
189
|
+
}),
|
|
190
|
+
[U, X, Q, O, A, Z, Y]
|
|
191
|
+
), ot = I(
|
|
192
|
+
() => h ? {
|
|
193
|
+
total: h.count,
|
|
194
|
+
onChange: h.setPage,
|
|
195
|
+
current: h.page,
|
|
196
|
+
pageSize: h.pageSize
|
|
197
|
+
} : void 0,
|
|
198
|
+
[h]
|
|
199
|
+
), nt = I(() => {
|
|
200
|
+
const t = T || p || y || C || f, n = [];
|
|
201
|
+
return r && n.push({
|
|
202
|
+
key: "key",
|
|
203
|
+
align: "center",
|
|
204
|
+
width: 5,
|
|
205
|
+
title: r == null ? void 0 : r.columnLabel,
|
|
206
|
+
render: () => /* @__PURE__ */ c(Qt, { tooltip: r == null ? void 0 : r.tooltip })
|
|
207
|
+
}), n.push(...F), t && t && n.push({
|
|
208
|
+
title: d("str.action"),
|
|
209
|
+
fixed: "right",
|
|
210
|
+
width: b,
|
|
211
|
+
render: (m, s) => /* @__PURE__ */ D(G, { children: [
|
|
212
|
+
f && /* @__PURE__ */ c(Vt, { value: s, onClick: L }),
|
|
213
|
+
N(s)
|
|
214
|
+
] })
|
|
215
|
+
}), n;
|
|
216
|
+
}, [
|
|
217
|
+
F,
|
|
218
|
+
T,
|
|
219
|
+
p,
|
|
220
|
+
y,
|
|
221
|
+
C,
|
|
222
|
+
f,
|
|
223
|
+
d,
|
|
224
|
+
b,
|
|
225
|
+
N
|
|
226
|
+
]), rt = I(
|
|
227
|
+
() => v.map((t) => t[o]),
|
|
228
|
+
[v, o]
|
|
229
|
+
), pt = K(() => {
|
|
230
|
+
const t = /* @__PURE__ */ c(
|
|
231
|
+
Kt,
|
|
232
|
+
{
|
|
233
|
+
...tt,
|
|
234
|
+
dataSource: v,
|
|
235
|
+
loading: S,
|
|
236
|
+
components: r ? { body: { row: Xt } } : void 0,
|
|
237
|
+
pagination: ot,
|
|
238
|
+
columns: nt
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
return r ? /* @__PURE__ */ c(St, { modifiers: [lt], onDragEnd: g, children: /* @__PURE__ */ c(
|
|
242
|
+
Ct,
|
|
243
|
+
{
|
|
244
|
+
items: rt,
|
|
245
|
+
strategy: xt,
|
|
246
|
+
children: t
|
|
247
|
+
}
|
|
248
|
+
) }) : t;
|
|
249
|
+
}, [
|
|
250
|
+
tt,
|
|
251
|
+
v,
|
|
252
|
+
S,
|
|
253
|
+
ot,
|
|
254
|
+
nt,
|
|
255
|
+
r,
|
|
256
|
+
rt,
|
|
257
|
+
g
|
|
258
|
+
]);
|
|
259
|
+
return /* @__PURE__ */ D("div", { children: [
|
|
260
|
+
f && /* @__PURE__ */ c(
|
|
261
|
+
It,
|
|
151
262
|
{
|
|
152
263
|
width: "100%",
|
|
153
|
-
open: !!
|
|
154
|
-
title:
|
|
155
|
-
footer: /* @__PURE__ */
|
|
264
|
+
open: !!e,
|
|
265
|
+
title: yt ?? /* @__PURE__ */ c("div", { children: " " }),
|
|
266
|
+
footer: /* @__PURE__ */ c(G, {}),
|
|
156
267
|
closable: !0,
|
|
157
|
-
onCancel: () =>
|
|
158
|
-
children: !!
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
|
|
268
|
+
onCancel: () => L(void 0),
|
|
269
|
+
children: !!e && /* @__PURE__ */ D("div", { children: [
|
|
270
|
+
/* @__PURE__ */ c(
|
|
271
|
+
qt,
|
|
161
272
|
{
|
|
162
|
-
layout:
|
|
163
|
-
descListColumn:
|
|
164
|
-
data:
|
|
165
|
-
fields:
|
|
166
|
-
action:
|
|
273
|
+
layout: it,
|
|
274
|
+
descListColumn: ft,
|
|
275
|
+
data: e,
|
|
276
|
+
fields: u,
|
|
277
|
+
action: N(e)
|
|
167
278
|
}
|
|
168
279
|
),
|
|
169
|
-
|
|
170
|
-
] },
|
|
280
|
+
j == null ? void 0 : j(e)
|
|
281
|
+
] }, e == null ? void 0 : e[o])
|
|
171
282
|
}
|
|
172
283
|
),
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
!!
|
|
176
|
-
|
|
177
|
-
cr,
|
|
178
|
-
{
|
|
179
|
-
rowClassName: w,
|
|
180
|
-
className: Q,
|
|
181
|
-
scroll: N ?? (L ? {
|
|
182
|
-
y: `calc(100vh - ${L})`
|
|
183
|
-
} : void 0),
|
|
184
|
-
id: "crud-table",
|
|
185
|
-
dataSource: B,
|
|
186
|
-
loading: K,
|
|
187
|
-
bordered: Y,
|
|
188
|
-
size: X,
|
|
189
|
-
expandable: W,
|
|
190
|
-
pagination: s ? {
|
|
191
|
-
total: s.count,
|
|
192
|
-
onChange: s.setPage,
|
|
193
|
-
current: s.page,
|
|
194
|
-
pageSize: s.pageSize
|
|
195
|
-
} : void 0,
|
|
196
|
-
columns: y || e || h || a || c ? [
|
|
197
|
-
..._,
|
|
198
|
-
{
|
|
199
|
-
title: k("str.action"),
|
|
200
|
-
dataIndex: "",
|
|
201
|
-
fixed: "right",
|
|
202
|
-
width: D,
|
|
203
|
-
render: (r, o) => /* @__PURE__ */ v(z, { children: [
|
|
204
|
-
c && /* @__PURE__ */ n(nr, { value: o, onClick: b }),
|
|
205
|
-
$(o)
|
|
206
|
-
] })
|
|
207
|
-
}
|
|
208
|
-
] : _
|
|
209
|
-
}
|
|
210
|
-
)
|
|
284
|
+
/* @__PURE__ */ c($t, { fields: u, ...ht }),
|
|
285
|
+
/* @__PURE__ */ D(Jt, { children: [
|
|
286
|
+
!!P && /* @__PURE__ */ c(jt, { onClick: P }),
|
|
287
|
+
pt()
|
|
211
288
|
] })
|
|
212
289
|
] });
|
|
213
290
|
}
|
|
291
|
+
const ut = et.createContext({}), Qt = ({ tooltip: o }) => {
|
|
292
|
+
const { setActivatorNodeRef: S, listeners: u } = Nt(ut);
|
|
293
|
+
return /* @__PURE__ */ c(
|
|
294
|
+
Dt,
|
|
295
|
+
{
|
|
296
|
+
type: "text",
|
|
297
|
+
size: "small",
|
|
298
|
+
tooltip: o,
|
|
299
|
+
icon: /* @__PURE__ */ c(Gt, {}),
|
|
300
|
+
style: { cursor: "move", border: "none" },
|
|
301
|
+
ref: S,
|
|
302
|
+
...u
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}, Xt = (o) => {
|
|
306
|
+
const {
|
|
307
|
+
attributes: S,
|
|
308
|
+
listeners: u,
|
|
309
|
+
setNodeRef: x,
|
|
310
|
+
setActivatorNodeRef: l,
|
|
311
|
+
transform: f,
|
|
312
|
+
transition: h,
|
|
313
|
+
isDragging: y
|
|
314
|
+
} = Rt({ id: o["data-row-key"] }), R = {
|
|
315
|
+
...o.style,
|
|
316
|
+
transform: Bt.Translate.toString(f),
|
|
317
|
+
transition: h,
|
|
318
|
+
...y ? { position: "relative", zIndex: 9999 } : {}
|
|
319
|
+
}, T = I(
|
|
320
|
+
() => ({ setActivatorNodeRef: l, listeners: u }),
|
|
321
|
+
[l, u]
|
|
322
|
+
);
|
|
323
|
+
return /* @__PURE__ */ c(ut.Provider, { value: T, children: /* @__PURE__ */ c("tr", { ...o, ref: x, style: R, ...S }) });
|
|
324
|
+
};
|
|
214
325
|
export {
|
|
215
|
-
|
|
326
|
+
io as default
|
|
216
327
|
};
|
package/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./locale/hooks/translation-constants.cjs.js"),u=require("./locale/index.cjs.js"),t=require("./crud/CrudComponent.cjs.js"),r=require("./crud/CrudField.cjs.js"),C=require("./crud/CrudFormWizard.cjs.js"),i=require("./crud/CrudReportComponent.cjs.js"),n=require("./crud/CrudSearchComponent.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./locale/hooks/translation-constants.cjs.js"),u=require("./locale/index.cjs.js"),t=require("./crud/CrudComponent.cjs.js"),r=require("./crud/CrudField.cjs.js"),C=require("./crud/CrudFormWizard.cjs.js"),i=require("./crud/CrudReportComponent.cjs.js"),n=require("./crud/CrudSearchComponent.cjs.js"),e=require("./crud/ImageCrudField.cjs.js"),o=require("./crud/FileCrudField.cjs.js"),a=require("./crud/import/CrudImportComponent.cjs.js"),s=require("./crud/import/CrudImportButton.cjs.js"),m=require("./crud/view/CrudViewer.cjs.js"),d=require("./crud/CrudForm.cjs.js"),F=require("./crud/view/CrudDecListView.cjs.js"),p=require("./crud/view/CrudViewerUtil.cjs.js");exports.TRANSLATION_NAMESPACE=l.TRANSLATION_NAMESPACE;exports.setupI18n=u.setupI18n;exports.updateTranslations=u.updateTranslations;exports.CrudComponent=t;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=C;exports.CrudReportComponent=i;exports.CrudSearchComponent=n;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.CrudImportComponent=a;exports.CrudImportButton=s;exports.CrudViewer=m;exports.CrudForm=d.CrudForm;exports.CrudFormFields=d.CrudFormFields;exports.CrudDecListView=F.CrudDecListView;exports.getRendererValueCrudViewer=p.getRendererValueCrudViewer;
|