@kingteza/crud-component 1.0.25 → 1.0.26
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/README.md +89 -0
- package/package.json +4 -6
- package/App.d.ts +0 -2
- package/components/common/DatePicker/DatePicker.cjs +0 -1
- package/components/common/DatePicker/DatePicker.d.ts +0 -37
- package/components/common/DatePicker/DatePicker.js +0 -88
- package/components/common/DatePicker/TimePicker.cjs +0 -1
- package/components/common/DatePicker/TimePicker.d.ts +0 -34
- package/components/common/DatePicker/TimePicker.js +0 -78
- package/components/common/DatePicker/index.d.ts +0 -3
- package/components/common/appearance/Hider.cjs +0 -1
- package/components/common/appearance/Hider.d.ts +0 -6
- package/components/common/appearance/Hider.js +0 -5
- package/components/common/appearance/index.d.ts +0 -0
- package/components/common/button/Button.cjs +0 -1
- package/components/common/button/Button.d.ts +0 -12
- package/components/common/button/Button.js +0 -79
- package/components/common/button/CloneButtonTable.cjs +0 -1
- package/components/common/button/CloneButtonTable.d.ts +0 -6
- package/components/common/button/CloneButtonTable.js +0 -20
- package/components/common/button/DeleteButtonTable.cjs +0 -1
- package/components/common/button/DeleteButtonTable.d.ts +0 -13
- package/components/common/button/DeleteButtonTable.js +0 -68
- package/components/common/button/ExportButton.cjs +0 -1
- package/components/common/button/ExportButton.d.ts +0 -4
- package/components/common/button/ExportButton.js +0 -27
- package/components/common/button/HideButtonTable.cjs +0 -1
- package/components/common/button/HideButtonTable.d.ts +0 -13
- package/components/common/button/HideButtonTable.js +0 -68
- package/components/common/button/ImportButton.cjs +0 -1
- package/components/common/button/ImportButton.d.ts +0 -9
- package/components/common/button/ImportButton.js +0 -56
- package/components/common/button/NewButton.cjs +0 -1
- package/components/common/button/NewButton.d.ts +0 -12
- package/components/common/button/NewButton.js +0 -24
- package/components/common/button/PrintButton.cjs +0 -1
- package/components/common/button/PrintButton.d.ts +0 -12
- package/components/common/button/PrintButton.js +0 -26
- package/components/common/button/RefreshButton.cjs +0 -1
- package/components/common/button/RefreshButton.d.ts +0 -11
- package/components/common/button/RefreshButton.js +0 -24
- package/components/common/button/UnHideButton.cjs +0 -1
- package/components/common/button/UnHideButton.d.ts +0 -14
- package/components/common/button/UnHideButton.js +0 -70
- package/components/common/button/UpdateButtonTable.cjs +0 -1
- package/components/common/button/UpdateButtonTable.d.ts +0 -6
- package/components/common/button/UpdateButtonTable.js +0 -20
- package/components/common/button/ViewButtonTable.cjs +0 -1
- package/components/common/button/ViewButtonTable.d.ts +0 -6
- package/components/common/button/ViewButtonTable.js +0 -20
- package/components/common/button/index.d.ts +0 -14
- package/components/common/check-box/CheckBox.cjs +0 -1
- package/components/common/check-box/CheckBox.d.ts +0 -9
- package/components/common/check-box/CheckBox.js +0 -40
- package/components/common/check-box/index.d.ts +0 -2
- package/components/common/description/DescList.cjs +0 -1
- package/components/common/description/DescList.d.ts +0 -18
- package/components/common/description/DescList.js +0 -16
- package/components/common/description/DescriptionComponent.d.ts +0 -7
- package/components/common/description/index.d.ts +0 -3
- package/components/common/index.d.ts +0 -22
- package/components/common/layout/VerticalSpace.cjs +0 -1
- package/components/common/layout/VerticalSpace.d.ts +0 -5
- package/components/common/layout/VerticalSpace.js +0 -6
- package/components/common/layout/index.d.ts +0 -2
- package/components/common/loading/LoadingIndicator.cjs +0 -1
- package/components/common/loading/LoadingIndicator.d.ts +0 -6
- package/components/common/loading/LoadingIndicator.js +0 -24
- package/components/common/loading/index.d.ts +0 -2
- package/components/common/picker/ImagePicker.cjs +0 -1
- package/components/common/picker/ImagePicker.d.ts +0 -56
- package/components/common/picker/ImagePicker.js +0 -282
- package/components/common/picker/index.d.ts +0 -2
- package/components/common/radio/RadioGroupComponent.cjs +0 -1
- package/components/common/radio/RadioGroupComponent.d.ts +0 -18
- package/components/common/radio/RadioGroupComponent.js +0 -19
- package/components/common/radio/index.d.ts +0 -2
- package/components/common/report/SelectFieldInReport.cjs +0 -1
- package/components/common/report/SelectFieldInReport.d.ts +0 -16
- package/components/common/report/SelectFieldInReport.js +0 -30
- package/components/common/report/index.d.ts +0 -3
- package/components/common/select/CustomSelectOption.cjs +0 -1
- package/components/common/select/CustomSelectOption.d.ts +0 -7
- package/components/common/select/CustomSelectOption.js +0 -13
- package/components/common/select/SelectComponent.cjs +0 -1
- package/components/common/select/SelectComponent.d.ts +0 -21
- package/components/common/select/SelectComponent.js +0 -89
- package/components/common/select/index.d.ts +0 -3
- package/components/common/show-more/index.cjs +0 -1
- package/components/common/show-more/index.d.ts +0 -4
- package/components/common/show-more/index.js +0 -8
- package/components/common/tab/TabViewWithRoute.cjs +0 -1
- package/components/common/tab/TabViewWithRoute.d.ts +0 -13
- package/components/common/tab/TabViewWithRoute.js +0 -38
- package/components/common/tab/index.d.ts +0 -2
- package/components/common/table/index.d.ts +0 -3
- package/components/common/table/table.cjs +0 -1
- package/components/common/table/table.d.ts +0 -19
- package/components/common/table/table.js +0 -40
- package/components/common/tag/StatusTag.cjs +0 -1
- package/components/common/tag/StatusTag.d.ts +0 -14
- package/components/common/tag/StatusTag.js +0 -30
- package/components/common/tag/index.d.ts +0 -2
- package/components/common/text/index.cjs +0 -1
- package/components/common/text/index.d.ts +0 -3
- package/components/common/text/index.js +0 -5
- package/components/common/text/title/TitleWithHeadTitle.d.ts +0 -7
- package/components/common/text/title/index.cjs +0 -1
- package/components/common/text/title/index.d.ts +0 -1
- package/components/common/text/title/index.js +0 -5
- package/components/common/text-field/NumberField.cjs +0 -1
- package/components/common/text-field/NumberField.d.ts +0 -13
- package/components/common/text-field/NumberField.js +0 -83
- package/components/common/text-field/PhoneNumberField.cjs +0 -1
- package/components/common/text-field/PhoneNumberField.d.ts +0 -4
- package/components/common/text-field/PhoneNumberField.js +0 -18
- package/components/common/text-field/TextArea.cjs +0 -1
- package/components/common/text-field/TextArea.d.ts +0 -17
- package/components/common/text-field/TextArea.js +0 -47
- package/components/common/text-field/TextField.cjs +0 -1
- package/components/common/text-field/TextField.d.ts +0 -27
- package/components/common/text-field/TextField.js +0 -73
- package/components/common/text-field/index.d.ts +0 -5
- package/components/common/tooltip/TooltipComponent.cjs +0 -1
- package/components/common/tooltip/TooltipComponent.d.ts +0 -5
- package/components/common/tooltip/TooltipComponent.js +0 -9
- package/components/common/tooltip/index.d.ts +0 -2
- package/components/common/wizard/WizardResult.cjs +0 -1
- package/components/common/wizard/WizardResult.d.ts +0 -16
- package/components/common/wizard/WizardResult.js +0 -60
- package/components/common/wizard/WizardViewForm.cjs +0 -1
- package/components/common/wizard/WizardViewForm.d.ts +0 -24
- package/components/common/wizard/WizardViewForm.js +0 -74
- package/components/common/wizard/index.d.ts +0 -3
- package/components/crud/CrudComponent.cjs +0 -1
- package/components/crud/CrudComponent.d.ts +0 -237
- package/components/crud/CrudComponent.js +0 -210
- package/components/crud/CrudField.cjs +0 -1
- package/components/crud/CrudField.d.ts +0 -4
- package/components/crud/CrudField.js +0 -459
- package/components/crud/CrudForm.cjs +0 -1
- package/components/crud/CrudForm.d.ts +0 -14
- package/components/crud/CrudForm.js +0 -91
- package/components/crud/CrudFormWizard.cjs +0 -1
- package/components/crud/CrudFormWizard.d.ts +0 -14
- package/components/crud/CrudFormWizard.js +0 -140
- package/components/crud/CrudReportComponent.cjs +0 -4
- package/components/crud/CrudReportComponent.d.ts +0 -44
- package/components/crud/CrudReportComponent.js +0 -255
- package/components/crud/CrudSearchComponent.cjs +0 -1
- package/components/crud/CrudSearchComponent.d.ts +0 -21
- package/components/crud/CrudSearchComponent.js +0 -95
- package/components/crud/FileCrudField.cjs +0 -1
- package/components/crud/FileCrudField.d.ts +0 -25
- package/components/crud/FileCrudField.js +0 -220
- package/components/crud/ImageCrudField.cjs +0 -1
- package/components/crud/ImageCrudField.d.ts +0 -38
- package/components/crud/ImageCrudField.js +0 -113
- package/components/crud/import/CrudImportButton.cjs +0 -1
- package/components/crud/import/CrudImportButton.d.ts +0 -3
- package/components/crud/import/CrudImportButton.js +0 -31
- package/components/crud/import/CrudImportComponent.cjs +0 -2
- package/components/crud/import/CrudImportComponent.d.ts +0 -14
- package/components/crud/import/CrudImportComponent.js +0 -223
- package/components/crud/index.d.ts +0 -15
- package/components/crud/view/CrudDecListView.cjs +0 -1
- package/components/crud/view/CrudDecListView.d.ts +0 -14
- package/components/crud/view/CrudDecListView.js +0 -42
- package/components/crud/view/CrudViewer.cjs +0 -1
- package/components/crud/view/CrudViewer.d.ts +0 -43
- package/components/crud/view/CrudViewer.js +0 -217
- package/components/crud/view/CrudViewerUtil.cjs +0 -1
- package/components/crud/view/CrudViewerUtil.d.ts +0 -2
- package/components/crud/view/CrudViewerUtil.js +0 -57
- package/components/crud/view/index.d.ts +0 -5
- package/index.cjs +0 -1
- package/index.d.ts +0 -4
- package/index.js +0 -32
- package/locale/hooks/translation-constants.cjs +0 -1
- package/locale/hooks/translation-constants.d.ts +0 -1
- package/locale/hooks/translation-constants.js +0 -4
- package/locale/index.cjs +0 -1
- package/locale/index.d.ts +0 -74
- package/locale/index.js +0 -37
- package/locale/translations/en.cjs +0 -1
- package/locale/translations/en.d.ts +0 -58
- package/locale/translations/en.js +0 -60
- package/main.d.ts +0 -0
- package/util/DateUtil.cjs +0 -1
- package/util/DateUtil.d.ts +0 -7
- package/util/DateUtil.js +0 -6
- package/util/ImageUtil.cjs +0 -1
- package/util/ImageUtil.d.ts +0 -14
- package/util/ImageUtil.js +0 -63
- package/util/NumberUtil.cjs +0 -1
- package/util/NumberUtil.d.ts +0 -17
- package/util/NumberUtil.js +0 -60
- package/util/ValidationUtil.cjs +0 -1
- package/util/ValidationUtil.d.ts +0 -14
- package/util/ValidationUtil.js +0 -60
- package/util/index.cjs +0 -1
- package/util/index.d.ts +0 -4
- package/util/index.js +0 -10
- package/vite-env.d.ts +0 -1
|
@@ -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,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';
|
package/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./locale/hooks/translation-constants.cjs"),o=require("./locale/index.cjs"),C=require("./components/crud/CrudComponent.cjs"),r=require("./components/crud/CrudField.cjs"),i=require("./components/crud/CrudFormWizard.cjs"),n=require("./components/crud/CrudReportComponent.cjs"),t=require("./components/crud/CrudSearchComponent.cjs"),d=require("./components/crud/CrudForm.cjs"),l=require("./components/crud/FileCrudField.cjs"),e=require("./components/crud/ImageCrudField.cjs");exports.TRANSLATION_NAMESPACE=u.TRANSLATION_NAMESPACE;exports.setupI18n=o.setupI18n;exports.updateTranslations=o.updateTranslations;exports.CrudComponent=C;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=i;exports.CrudReportComponent=n;exports.CrudSearchComponent=t;exports.CrudForm=d.CrudForm;exports.CrudFormFields=d.CrudFormFields;exports.FileCellValue=l.FileCellValue;exports.FileCrudCellValue=l.FileCrudCellValue;exports.FileCrudField=l.default;exports.FileDownloadProvider=e.FileDownloadProvider;exports.FileUploadProvider=e.FileUploadProvider;exports.ImageCellValue=e.ImageCellValue;exports.ImageCrudCellValue=e.ImageCrudCellValue;exports.ImageCrudField=e.default;
|
package/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { TRANSLATION_NAMESPACE } from './locale/hooks/translation-constants';
|
|
2
|
-
export { setupI18n, updateTranslations } from './locale';
|
|
3
|
-
export { ColorCrudFieldComponent, CrudComponent, CrudField, CrudForm, CrudFormFields, CrudFormWizard, CrudReportComponent, CrudSearchComponent, FileCellValue, FileCrudCellValue, FileCrudField, FileDownloadProvider, FileUploadProvider, ImageCellValue, ImageCrudCellValue, ImageCrudField, SelectCrudFieldComponent, } from './components/crud';
|
|
4
|
-
export type { CheckboxBasedFieldProps, ColorPickerFieldProps, CrudComponentProps, CrudFieldGrid, CrudFieldProps, CrudFormWizardProps, CrudPaginateProps, CrudPurpose, CrudReportComponentProps, CrudReportSubmitForm, CrudSearchComponentProps, CrudSearchOption, CrudWizardProp, CurdFormFieldsProps, DateBasedFieldProps, EnumCrudField, FileCrudFieldProps, FormBuilderFunc, FormBuilderFunc0, GetFormFieldOptions, ImageCrudFieldProps, InitialCrudField, NumberBasedFieldProps, ObjectCrudField, ReportCrudFields, SearchOnlyFields, SelectCrudField, SelectFieldItem, TextAreaBasedFieldProps, TextBasedFieldProps, TimeBasedFieldProps, } from './components/crud';
|
package/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { TRANSLATION_NAMESPACE as o } from "./locale/hooks/translation-constants.js";
|
|
2
|
-
import { setupI18n as d, updateTranslations as a } from "./locale/index.js";
|
|
3
|
-
import { default as u } from "./components/crud/CrudComponent.js";
|
|
4
|
-
import { ColorCrudFieldComponent as m, default as p, SelectCrudFieldComponent as f } from "./components/crud/CrudField.js";
|
|
5
|
-
import { default as n } from "./components/crud/CrudFormWizard.js";
|
|
6
|
-
import { default as s } from "./components/crud/CrudReportComponent.js";
|
|
7
|
-
import { default as I } from "./components/crud/CrudSearchComponent.js";
|
|
8
|
-
import { CrudForm as S, CrudFormFields as V } from "./components/crud/CrudForm.js";
|
|
9
|
-
import { FileCellValue as N, FileCrudCellValue as P, default as T } from "./components/crud/FileCrudField.js";
|
|
10
|
-
import { FileDownloadProvider as v, FileUploadProvider as E, ImageCellValue as R, ImageCrudCellValue as h, default as w } from "./components/crud/ImageCrudField.js";
|
|
11
|
-
export {
|
|
12
|
-
m as ColorCrudFieldComponent,
|
|
13
|
-
u as CrudComponent,
|
|
14
|
-
p as CrudField,
|
|
15
|
-
S as CrudForm,
|
|
16
|
-
V as CrudFormFields,
|
|
17
|
-
n as CrudFormWizard,
|
|
18
|
-
s as CrudReportComponent,
|
|
19
|
-
I as CrudSearchComponent,
|
|
20
|
-
N as FileCellValue,
|
|
21
|
-
P as FileCrudCellValue,
|
|
22
|
-
T as FileCrudField,
|
|
23
|
-
v as FileDownloadProvider,
|
|
24
|
-
E as FileUploadProvider,
|
|
25
|
-
R as ImageCellValue,
|
|
26
|
-
h as ImageCrudCellValue,
|
|
27
|
-
w as ImageCrudField,
|
|
28
|
-
f as SelectCrudFieldComponent,
|
|
29
|
-
o as TRANSLATION_NAMESPACE,
|
|
30
|
-
d as setupI18n,
|
|
31
|
-
a as updateTranslations
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="crud-component";exports.TRANSLATION_NAMESPACE=e;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const TRANSLATION_NAMESPACE = "crud-component";
|
package/locale/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./hooks/translation-constants.cjs"),d=require("./translations/en.cjs"),n=require("i18next"),A=require("react-i18next"),o={en:{[a.TRANSLATION_NAMESPACE]:d}},I=(t={})=>{const{translations:e=o,language:s="en",i18nInstance:r}=t,i=r||n;return i.isInitialized?Object.entries(e).forEach(([u,c])=>{Object.entries(c).forEach(([l,T])=>{n.addResourceBundle(u,l,T,!0,!0)})}):i.use(A.initReactI18next).init({resources:e,lng:s,fallbackLng:"en",ns:a.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),n},N=(t,e,s)=>{(s||n).addResourceBundle(t,a.TRANSLATION_NAMESPACE,e,!0,!0)};exports.defaultTranslations=o;exports.setupI18n=I;exports.updateTranslations=N;
|
package/locale/index.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { TRANSLATION_NAMESPACE } from 'locale/hooks/translation-constants';
|
|
2
|
-
import { default as en } from './translations/en';
|
|
3
|
-
import { default as i18n } from 'i18next';
|
|
4
|
-
export declare const defaultTranslations: {
|
|
5
|
-
en: {
|
|
6
|
-
"crud-component": {
|
|
7
|
-
str: {
|
|
8
|
-
delete: string;
|
|
9
|
-
clone: string;
|
|
10
|
-
update: string;
|
|
11
|
-
new: string;
|
|
12
|
-
back: string;
|
|
13
|
-
next: string;
|
|
14
|
-
save: string;
|
|
15
|
-
import: string;
|
|
16
|
-
cancel: string;
|
|
17
|
-
print: string;
|
|
18
|
-
hide: string;
|
|
19
|
-
no: string;
|
|
20
|
-
action: string;
|
|
21
|
-
remove: string;
|
|
22
|
-
view: string;
|
|
23
|
-
ok: string;
|
|
24
|
-
yes: string;
|
|
25
|
-
warning: string;
|
|
26
|
-
success: string;
|
|
27
|
-
error: string;
|
|
28
|
-
retry: string;
|
|
29
|
-
previous: string;
|
|
30
|
-
unhide: string;
|
|
31
|
-
downloadCsvTemplate: string;
|
|
32
|
-
importCsvFile: string;
|
|
33
|
-
export: string;
|
|
34
|
-
goBack: string;
|
|
35
|
-
refresh: string;
|
|
36
|
-
fileUploadMessage1: string;
|
|
37
|
-
fileUploadMessage2: string;
|
|
38
|
-
};
|
|
39
|
-
err: {
|
|
40
|
-
save: string;
|
|
41
|
-
validation: {
|
|
42
|
-
required: string;
|
|
43
|
-
minLength8: string;
|
|
44
|
-
percentage: string;
|
|
45
|
-
maximumValueExceeded: string;
|
|
46
|
-
invalidNic: string;
|
|
47
|
-
invalid: string;
|
|
48
|
-
};
|
|
49
|
-
notFound: string;
|
|
50
|
-
};
|
|
51
|
-
message: {
|
|
52
|
-
loading: {
|
|
53
|
-
saving: string;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
qus: {
|
|
57
|
-
importWithIssues: string;
|
|
58
|
-
doYouWantToDelete: string;
|
|
59
|
-
doYouWantToHide: string;
|
|
60
|
-
doYouWantToUnhide: string;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
export type LibTranslations = typeof en;
|
|
66
|
-
export interface SetupI18nOptions {
|
|
67
|
-
translations?: Record<string, {
|
|
68
|
-
[TRANSLATION_NAMESPACE]: LibTranslations;
|
|
69
|
-
}>;
|
|
70
|
-
language?: string;
|
|
71
|
-
i18nInstance?: typeof i18n;
|
|
72
|
-
}
|
|
73
|
-
export declare const setupI18n: (options?: SetupI18nOptions) => import('i18next').i18n;
|
|
74
|
-
export declare const updateTranslations: (language: string, translations: Record<string, any>, i18nInstance?: typeof i18n) => void;
|
package/locale/index.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { TRANSLATION_NAMESPACE as o } from "./hooks/translation-constants.js";
|
|
2
|
-
import f from "./translations/en.js";
|
|
3
|
-
import n from "i18next";
|
|
4
|
-
import { initReactI18next as d } from "react-i18next";
|
|
5
|
-
const p = {
|
|
6
|
-
en: {
|
|
7
|
-
[o]: f
|
|
8
|
-
}
|
|
9
|
-
}, A = (t = {}) => {
|
|
10
|
-
const { translations: e = p, language: s = "en", i18nInstance: r } = t, i = r || n;
|
|
11
|
-
return i.isInitialized ? Object.entries(e).forEach(([a, c]) => {
|
|
12
|
-
Object.entries(c).forEach(([u, l]) => {
|
|
13
|
-
n.addResourceBundle(a, u, l, !0, !0);
|
|
14
|
-
});
|
|
15
|
-
}) : i.use(d).init({
|
|
16
|
-
resources: e,
|
|
17
|
-
lng: s,
|
|
18
|
-
fallbackLng: "en",
|
|
19
|
-
ns: o,
|
|
20
|
-
interpolation: {
|
|
21
|
-
escapeValue: !1
|
|
22
|
-
}
|
|
23
|
-
}), n;
|
|
24
|
-
}, E = (t, e, s) => {
|
|
25
|
-
(s || n).addResourceBundle(
|
|
26
|
-
t,
|
|
27
|
-
o,
|
|
28
|
-
e,
|
|
29
|
-
!0,
|
|
30
|
-
!0
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
p as defaultTranslations,
|
|
35
|
-
A as setupI18n,
|
|
36
|
-
E as updateTranslations
|
|
37
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e={str:{delete:"Delete",clone:"Clone",update:"Update",new:"New",back:"Back",next:"Next",save:"Save",import:"Import",cancel:"Cancel",print:"Print",hide:"Hide",no:"No",action:"Action",remove:"Remove",view:"View",ok:"Ok",yes:"Yes",warning:"Warning",success:"Success",error:"Error",retry:"Retry",previous:"Previous",unhide:"Unhide",downloadCsvTemplate:"Download CSV Template",importCsvFile:"Import CSV File",export:"Export",goBack:"Go Back",refresh:"Refresh",fileUploadMessage1:"Drag file here or ",fileUploadMessage2:"Click to Upload"},err:{save:"An error occurred while saving",validation:{required:"is required",minLength8:"must be at least 8 characters",percentage:"must be a percentage",maximumValueExceeded:"must be less than %maxValue%",invalidNic:"must be a valid NIC",invalid:"must be a valid"},notFound:"Not Found"},message:{loading:{saving:"Saving"}},qus:{importWithIssues:"Some fields have issues. Do you want to proceed with the import?",doYouWantToDelete:"Do you want to delete?",doYouWantToHide:"Do you want to hide?",doYouWantToUnhide:"Do you want to unhide?"}};module.exports=e;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
str: {
|
|
3
|
-
delete: string;
|
|
4
|
-
clone: string;
|
|
5
|
-
update: string;
|
|
6
|
-
new: string;
|
|
7
|
-
back: string;
|
|
8
|
-
next: string;
|
|
9
|
-
save: string;
|
|
10
|
-
import: string;
|
|
11
|
-
cancel: string;
|
|
12
|
-
print: string;
|
|
13
|
-
hide: string;
|
|
14
|
-
no: string;
|
|
15
|
-
action: string;
|
|
16
|
-
remove: string;
|
|
17
|
-
view: string;
|
|
18
|
-
ok: string;
|
|
19
|
-
yes: string;
|
|
20
|
-
warning: string;
|
|
21
|
-
success: string;
|
|
22
|
-
error: string;
|
|
23
|
-
retry: string;
|
|
24
|
-
previous: string;
|
|
25
|
-
unhide: string;
|
|
26
|
-
downloadCsvTemplate: string;
|
|
27
|
-
importCsvFile: string;
|
|
28
|
-
export: string;
|
|
29
|
-
goBack: string;
|
|
30
|
-
refresh: string;
|
|
31
|
-
fileUploadMessage1: string;
|
|
32
|
-
fileUploadMessage2: string;
|
|
33
|
-
};
|
|
34
|
-
err: {
|
|
35
|
-
save: string;
|
|
36
|
-
validation: {
|
|
37
|
-
required: string;
|
|
38
|
-
minLength8: string;
|
|
39
|
-
percentage: string;
|
|
40
|
-
maximumValueExceeded: string;
|
|
41
|
-
invalidNic: string;
|
|
42
|
-
invalid: string;
|
|
43
|
-
};
|
|
44
|
-
notFound: string;
|
|
45
|
-
};
|
|
46
|
-
message: {
|
|
47
|
-
loading: {
|
|
48
|
-
saving: string;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
qus: {
|
|
52
|
-
importWithIssues: string;
|
|
53
|
-
doYouWantToDelete: string;
|
|
54
|
-
doYouWantToHide: string;
|
|
55
|
-
doYouWantToUnhide: string;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export default _default;
|