@kingteza/crud-component 1.0.28 → 1.0.29

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