@kingteza/crud-component 1.29.0 → 1.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/rich/index.d.ts +2 -1
- package/dist/common/text-field/NumberField.cjs.js +1 -1
- package/dist/common/text-field/NumberField.es.js +17 -18
- package/dist/crud/CrudComponent.d.ts +6 -4
- package/dist/crud/CrudForm.d.ts +2 -2
- package/dist/crud/CrudFormWizard.cjs.js +1 -1
- package/dist/crud/CrudFormWizard.d.ts +2 -2
- package/dist/crud/CrudFormWizard.es.js +82 -78
- package/dist/crud/CrudReportComponent.d.ts +5 -5
- package/dist/crud/CrudSearchComponent.d.ts +2 -2
- package/dist/crud/import/CrudImportComponent.d.ts +2 -2
- package/dist/crud/index.d.ts +1 -1
- package/dist/crud/modal/index.cjs.js +1 -1
- package/dist/crud/modal/index.d.ts +2 -2
- package/dist/crud/modal/index.es.js +101 -96
- package/dist/crud/view/CrudDecListView.cjs.js +1 -1
- package/dist/crud/view/CrudDecListView.d.ts +2 -2
- package/dist/crud/view/CrudDecListView.es.js +31 -30
- package/dist/crud/view/CrudViewer.d.ts +2 -2
- package/dist/crud/view/CrudViewerUtil.cjs.js +1 -1
- package/dist/crud/view/CrudViewerUtil.es.js +39 -38
- package/dist/util/CrudUtil.d.ts +1 -1
- package/dist/util/ObjectUtil.cjs.js +1 -0
- package/dist/util/ObjectUtil.d.ts +2 -0
- package/dist/util/ObjectUtil.es.js +10 -0
- package/package.json +1 -1
- package/dist/locale/index.d.ts +0 -86
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Rule } from 'antd/es/form';
|
|
2
|
+
import { NamePath } from 'antd/es/form/interface';
|
|
2
3
|
import { FormItemProps } from 'antd/lib';
|
|
3
4
|
import { FC, ReactNode } from 'react';
|
|
4
5
|
export interface RichTextEditorProps {
|
|
5
6
|
help?: ReactNode;
|
|
6
7
|
label?: string;
|
|
7
|
-
name:
|
|
8
|
+
name: NamePath;
|
|
8
9
|
required?: boolean;
|
|
9
10
|
rules?: Rule[];
|
|
10
11
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("react/jsx-runtime"),m=require("antd"),x=require("react"),
|
|
1
|
+
"use strict";const i=require("react/jsx-runtime"),m=require("antd"),x=require("react"),M=require("../../locale/index.cjs.js"),P=require("../tooltip/TooltipComponent.cjs.js"),_=require("./TextField.cjs.js"),b=x.forwardRef(function({type:v,required:o,label:e,rules:c=[],placeholder:r,onEnter:a,form:f,nextFocus:q,min:d,moneyField:n,addonAfter:j,minLength:T,defaultValue:$,pattern:g,disabled:I,readOnly:N,onChange:R,value:w,max:B,addonBefore:E,size:F,isInt:u=!1,tooltip:h,help:z,...y},C){const{t:p}=M.useTranslationLib(),L=x.useMemo(()=>[...c,{required:o,message:`${e||r||""} ${p("err.validation.required")}`}],[c,e,r,p,o]);return i.jsx(P,{title:h,children:i.jsx(m.Form.Item,{...y,label:e,rules:L,children:i.jsx(m.InputNumber,{ref:C,disabled:I,defaultValue:$,value:w,readOnly:N,addonBefore:E,minLength:T,addonAfter:j,step:u?1:void 0,pattern:u?"d*":g,onChange:R,onPressEnter:t=>_.onEnterInternalTextField(t,q,f,a),className:"max-width",min:d===null?void 0:d??0,max:B,type:n?void 0:"number",size:F,formatter:n?t=>{if(t.includes(".")){const s=`${t}`.split(".");return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),s.join(".")}else return`${t}`.replace(/\B(?=(\d{3})+(?!\d))/g,",")}:void 0,parser:n?t=>t==null?void 0:t.replace(/\$\s?|(,*)/g,""):void 0,placeholder:r||e})})})});module.exports=b;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { Form as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useTranslationLib as
|
|
5
|
-
import
|
|
6
|
-
import { onEnterInternalTextField as
|
|
7
|
-
const
|
|
2
|
+
import { Form as M, InputNumber as P } from "antd";
|
|
3
|
+
import { forwardRef as R, useMemo as _ } from "react";
|
|
4
|
+
import { useTranslationLib as b } from "../../locale/index.es.js";
|
|
5
|
+
import k from "../tooltip/TooltipComponent.es.js";
|
|
6
|
+
import { onEnterInternalTextField as q } from "./TextField.es.js";
|
|
7
|
+
const Q = R(
|
|
8
8
|
function({
|
|
9
|
-
|
|
10
|
-
type: A,
|
|
9
|
+
type: z,
|
|
11
10
|
required: s,
|
|
12
11
|
label: t,
|
|
13
12
|
rules: m = [],
|
|
@@ -29,11 +28,11 @@ const S = b(
|
|
|
29
28
|
addonBefore: E,
|
|
30
29
|
size: h,
|
|
31
30
|
isInt: d = !1,
|
|
32
|
-
tooltip:
|
|
33
|
-
help:
|
|
34
|
-
...
|
|
35
|
-
},
|
|
36
|
-
const { t: f } =
|
|
31
|
+
tooltip: y,
|
|
32
|
+
help: A,
|
|
33
|
+
...C
|
|
34
|
+
}, F) {
|
|
35
|
+
const { t: f } = b(), L = _(
|
|
37
36
|
() => [
|
|
38
37
|
...m,
|
|
39
38
|
{
|
|
@@ -45,10 +44,10 @@ const S = b(
|
|
|
45
44
|
],
|
|
46
45
|
[m, t, o, f, s]
|
|
47
46
|
);
|
|
48
|
-
return /* @__PURE__ */ i(
|
|
49
|
-
|
|
47
|
+
return /* @__PURE__ */ i(k, { title: y, children: /* @__PURE__ */ i(M.Item, { ...C, label: t, rules: L, children: /* @__PURE__ */ i(
|
|
48
|
+
P,
|
|
50
49
|
{
|
|
51
|
-
ref:
|
|
50
|
+
ref: F,
|
|
52
51
|
disabled: I,
|
|
53
52
|
defaultValue: g,
|
|
54
53
|
value: w,
|
|
@@ -59,7 +58,7 @@ const S = b(
|
|
|
59
58
|
step: d ? 1 : void 0,
|
|
60
59
|
pattern: d ? "d*" : T,
|
|
61
60
|
onChange: j,
|
|
62
|
-
onPressEnter: (r) =>
|
|
61
|
+
onPressEnter: (r) => q(r, a, u, c),
|
|
63
62
|
className: "max-width",
|
|
64
63
|
min: p === null ? void 0 : p ?? 0,
|
|
65
64
|
max: B,
|
|
@@ -79,5 +78,5 @@ const S = b(
|
|
|
79
78
|
}
|
|
80
79
|
);
|
|
81
80
|
export {
|
|
82
|
-
|
|
81
|
+
Q as default
|
|
83
82
|
};
|
|
@@ -10,11 +10,11 @@ import { CrudImportProps } from './import/CrudImportComponent';
|
|
|
10
10
|
import { CrudDragableProps, CrudViewableProps } from './view/CrudViewer';
|
|
11
11
|
import { SelectTagRenderProps } from '../common/select/SelectComponent';
|
|
12
12
|
import { default as IdProps } from '../types/Id';
|
|
13
|
-
import { TextAreaBasedFieldProps } from '
|
|
13
|
+
import { TextAreaBasedFieldProps } from './CrudTextAreaComponent';
|
|
14
14
|
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
15
|
-
import { Copyable } from '
|
|
15
|
+
import { Copyable } from '../util/CopyUtilComponent';
|
|
16
16
|
import { ColumnType } from 'antd/es/table';
|
|
17
|
-
import { PhoneNumberConfigProps } from '
|
|
17
|
+
import { PhoneNumberConfigProps } from '../common/text-field/PhoneNumberField';
|
|
18
18
|
export type SelectFieldItem = {
|
|
19
19
|
key?: string | number;
|
|
20
20
|
value: string | number;
|
|
@@ -236,6 +236,8 @@ export type CrudFieldProps<T> = {
|
|
|
236
236
|
readonly type: K;
|
|
237
237
|
};
|
|
238
238
|
}[keyof CrudFieldTypeMap<T>];
|
|
239
|
+
/** Field lists passed into CRUD components; accepts mutable arrays and `as const` tuples. */
|
|
240
|
+
export type ReadonlyCrudFields<T> = readonly CrudFieldProps<T>[];
|
|
239
241
|
export type CrudPaginateProps = false | ({
|
|
240
242
|
page?: number;
|
|
241
243
|
setPage?: (page: number, pageSize?: number) => void;
|
|
@@ -250,7 +252,7 @@ export type CrudWizardProp<T> = {
|
|
|
250
252
|
grid?: boolean;
|
|
251
253
|
};
|
|
252
254
|
export type CrudComponentProps<T, FormType = T> = {
|
|
253
|
-
fields:
|
|
255
|
+
fields: ReadonlyCrudFields<T>;
|
|
254
256
|
data: T[] | undefined;
|
|
255
257
|
idField?: string;
|
|
256
258
|
grid?: boolean;
|
package/dist/crud/CrudForm.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FormInstance, FormProps } from 'antd';
|
|
2
|
-
import {
|
|
2
|
+
import { CrudPurpose, FormBuilderFunc, ReadonlyCrudFields } from './CrudComponent';
|
|
3
3
|
export interface CurdFormFieldsProps<T> {
|
|
4
4
|
onDeleteFile?: (e: any) => void;
|
|
5
5
|
onUploadFile?: (e: any) => void;
|
|
6
6
|
grid?: boolean;
|
|
7
7
|
formBuilder?: FormBuilderFunc<T>;
|
|
8
|
-
fields:
|
|
8
|
+
fields: ReadonlyCrudFields<T>;
|
|
9
9
|
purpose?: CrudPurpose;
|
|
10
10
|
onValuesChange?: FormProps<T>["onValuesChange"];
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),y=require("@ant-design/icons"),a=require("antd"),q=require("react"),R=require("../locale/index.cjs.js"),S=require("./CrudForm.cjs.js"),B=require("../common/wizard/WizardViewForm.cjs.js"),v=require("../util/CrudUtil.cjs.js"),k=require("../util/ObjectUtil.cjs.js"),C=require("../common/button/Button.cjs.js");function w({fields:u,className:x,onDeleteFile:j,onUploadFile:i,purpose:l,wizard:t=[],updatingValue:g,onSave:b,submitting:F,onValuesChange:d}){const h=q.useMemo(()=>t.map(r=>{let n=!0;const o=u.filter(c=>{const s=v.getRealName(c.name);return!Array.isArray(s)&&r.fields.includes(s)});return o.forEach(c=>n&&(n=c.hidden??!1)),{...r,hidden:n,fieldThatShouldShowing:o}}),[u,t]),m=q.useMemo(()=>h.filter(r=>!r.hidden),[h]);return e.jsx(B,{onSubmit:(r,n)=>{b(n)},className:x,pages:m.map(({title:r,icon:n,fieldThatShouldShowing:o,hidden:c},s)=>({title:r,icon:n,hidden:c,component:f=>e.jsx(O,{fields:o,onDeleteFile:j,onUploadFile:i,purpose:l,i:s,updatingValue:g,backward:f.backward,forward:f.forward,wizard:m,submitting:F,onValuesChange:d},s)}))})}function O({fields:u,onDeleteFile:x,onUploadFile:j,purpose:i,wizard:l=[],i:t,forward:g,backward:b,submitting:F,updatingValue:d,onValuesChange:h}){const m=l[t],{t:r}=R.useTranslationLib(),[n]=a.Form.useForm();return q.useEffect(()=>{if(d&&(i==="update"||i==="clone")){const o={};for(const c of u){const s=v.getRealName(c.name,"upsertFieldName"),f=k.getValueByPath(d,s);k.setValueByPath(o,s,f)}n.setFieldsValue(o)}},[u,n,i,d]),e.jsxs(a.Form,{name:String(t),form:n,layout:"vertical",onValuesChange:h,children:[e.jsx(S.CrudFormFields,{fields:u,formBuilder:m.formBuilder,grid:m.grid,onDeleteFile:x,onUploadFile:j,purpose:i}),e.jsx(a.Divider,{}),e.jsxs(a.Row,{gutter:[8,8],children:[t>0&&e.jsx(a.Col,{md:12,children:e.jsx(C,{block:!0,icon:e.jsx(y.LeftOutlined,{}),htmlType:"button",type:"default",size:"large",onClick:()=>b(),children:r("str.back")})}),e.jsx(a.Col,{md:t>0?12:24,children:e.jsx(C,{block:!0,icon:l.length-1===t?e.jsx(y.SaveOutlined,{}):e.jsx(y.RightOutlined,{}),htmlType:"submit",type:"primary",loading:F,size:"large",onClick:()=>{n.validateFields().then(o=>{g(o,l.length-1===t,l.length-1===t)})},children:l.length-1===t?r("str."+(i==="update"?"update":"save")):r("str.next")})})]})]})}module.exports=w;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
|
-
import {
|
|
2
|
+
import { CrudPurpose, CrudWizardProp, ReadonlyCrudFields } from './CrudComponent';
|
|
3
3
|
export interface CrudFormWizardProps<T> {
|
|
4
4
|
onDeleteFile?: (e: any) => void;
|
|
5
5
|
onUploadFile?: (e: any) => void;
|
|
6
|
-
fields:
|
|
6
|
+
fields: ReadonlyCrudFields<T>;
|
|
7
7
|
purpose?: CrudPurpose;
|
|
8
8
|
wizard?: CrudWizardProp<T>[];
|
|
9
9
|
className?: string;
|
|
@@ -1,145 +1,149 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { LeftOutlined as
|
|
3
|
-
import { Form as
|
|
1
|
+
import { jsx as o, jsxs as F } from "react/jsx-runtime";
|
|
2
|
+
import { LeftOutlined as w, SaveOutlined as x, RightOutlined as R } from "@ant-design/icons";
|
|
3
|
+
import { Form as k, Divider as T, Row as W, Col as C } from "antd";
|
|
4
4
|
import { useMemo as v, useEffect as j } from "react";
|
|
5
5
|
import { useTranslationLib as z } from "../locale/index.es.js";
|
|
6
|
-
import { CrudFormFields as
|
|
6
|
+
import { CrudFormFields as N } from "./CrudForm.es.js";
|
|
7
7
|
import O from "../common/wizard/WizardViewForm.es.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
8
|
+
import B from "../util/CrudUtil.es.js";
|
|
9
|
+
import { getValueByPath as A, setValueByPath as E } from "../util/ObjectUtil.es.js";
|
|
10
|
+
import S from "../common/button/Button.es.js";
|
|
11
|
+
function J({
|
|
11
12
|
fields: d,
|
|
12
|
-
className:
|
|
13
|
-
onDeleteFile:
|
|
14
|
-
onUploadFile:
|
|
15
|
-
purpose:
|
|
13
|
+
className: h,
|
|
14
|
+
onDeleteFile: g,
|
|
15
|
+
onUploadFile: l,
|
|
16
|
+
purpose: m,
|
|
16
17
|
wizard: e = [],
|
|
17
|
-
updatingValue:
|
|
18
|
-
onSave:
|
|
19
|
-
submitting:
|
|
20
|
-
onValuesChange:
|
|
18
|
+
updatingValue: p,
|
|
19
|
+
onSave: b,
|
|
20
|
+
submitting: y,
|
|
21
|
+
onValuesChange: c
|
|
21
22
|
}) {
|
|
22
|
-
const
|
|
23
|
+
const s = v(() => e.map((t) => {
|
|
23
24
|
let r = !0;
|
|
24
|
-
const n = d.filter(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const n = d.filter((a) => {
|
|
26
|
+
const i = B.getRealName(a.name);
|
|
27
|
+
return !Array.isArray(i) && t.fields.includes(i);
|
|
28
|
+
});
|
|
29
|
+
return n.forEach((a) => r && (r = a.hidden ?? !1)), {
|
|
28
30
|
...t,
|
|
29
31
|
hidden: r,
|
|
30
32
|
fieldThatShouldShowing: n
|
|
31
33
|
};
|
|
32
|
-
}), [d, e]),
|
|
33
|
-
() =>
|
|
34
|
-
[
|
|
34
|
+
}), [d, e]), u = v(
|
|
35
|
+
() => s.filter((t) => !t.hidden),
|
|
36
|
+
[s]
|
|
35
37
|
);
|
|
36
38
|
return /* @__PURE__ */ o(
|
|
37
39
|
O,
|
|
38
40
|
{
|
|
39
41
|
onSubmit: (t, r) => {
|
|
40
|
-
|
|
42
|
+
b(r);
|
|
41
43
|
},
|
|
42
|
-
className:
|
|
43
|
-
pages:
|
|
44
|
-
({ title: t, icon: r, fieldThatShouldShowing: n, hidden:
|
|
44
|
+
className: h,
|
|
45
|
+
pages: u.map(
|
|
46
|
+
({ title: t, icon: r, fieldThatShouldShowing: n, hidden: a }, i) => ({
|
|
45
47
|
title: t,
|
|
46
48
|
icon: r,
|
|
47
|
-
hidden:
|
|
48
|
-
component: (
|
|
49
|
-
|
|
49
|
+
hidden: a,
|
|
50
|
+
component: (f) => /* @__PURE__ */ o(
|
|
51
|
+
L,
|
|
50
52
|
{
|
|
51
53
|
fields: n,
|
|
52
|
-
onDeleteFile:
|
|
53
|
-
onUploadFile:
|
|
54
|
-
purpose:
|
|
55
|
-
i
|
|
56
|
-
updatingValue:
|
|
57
|
-
backward:
|
|
58
|
-
forward:
|
|
59
|
-
wizard:
|
|
60
|
-
submitting:
|
|
61
|
-
onValuesChange:
|
|
54
|
+
onDeleteFile: g,
|
|
55
|
+
onUploadFile: l,
|
|
56
|
+
purpose: m,
|
|
57
|
+
i,
|
|
58
|
+
updatingValue: p,
|
|
59
|
+
backward: f.backward,
|
|
60
|
+
forward: f.forward,
|
|
61
|
+
wizard: u,
|
|
62
|
+
submitting: y,
|
|
63
|
+
onValuesChange: c
|
|
62
64
|
},
|
|
63
|
-
|
|
65
|
+
i
|
|
64
66
|
)
|
|
65
67
|
})
|
|
66
68
|
)
|
|
67
69
|
}
|
|
68
70
|
);
|
|
69
71
|
}
|
|
70
|
-
function
|
|
72
|
+
function L({
|
|
71
73
|
fields: d,
|
|
72
|
-
onDeleteFile:
|
|
73
|
-
onUploadFile:
|
|
74
|
-
purpose:
|
|
75
|
-
wizard:
|
|
74
|
+
onDeleteFile: h,
|
|
75
|
+
onUploadFile: g,
|
|
76
|
+
purpose: l,
|
|
77
|
+
wizard: m = [],
|
|
76
78
|
i: e,
|
|
77
|
-
forward:
|
|
78
|
-
backward:
|
|
79
|
-
submitting:
|
|
80
|
-
updatingValue:
|
|
81
|
-
onValuesChange:
|
|
79
|
+
forward: p,
|
|
80
|
+
backward: b,
|
|
81
|
+
submitting: y,
|
|
82
|
+
updatingValue: c,
|
|
83
|
+
onValuesChange: s
|
|
82
84
|
}) {
|
|
83
|
-
const
|
|
85
|
+
const u = m[e], { t } = z(), [r] = k.useForm();
|
|
84
86
|
return j(() => {
|
|
85
|
-
if (
|
|
87
|
+
if (c && (l === "update" || l === "clone")) {
|
|
86
88
|
const n = {};
|
|
87
|
-
for (const
|
|
88
|
-
|
|
89
|
+
for (const a of d) {
|
|
90
|
+
const i = B.getRealName(a.name, "upsertFieldName"), f = A(c, i);
|
|
91
|
+
E(n, i, f);
|
|
92
|
+
}
|
|
89
93
|
r.setFieldsValue(n);
|
|
90
94
|
}
|
|
91
|
-
}, [d, r,
|
|
92
|
-
|
|
95
|
+
}, [d, r, l, c]), /* @__PURE__ */ F(
|
|
96
|
+
k,
|
|
93
97
|
{
|
|
94
98
|
name: String(e),
|
|
95
99
|
form: r,
|
|
96
100
|
layout: "vertical",
|
|
97
|
-
onValuesChange:
|
|
101
|
+
onValuesChange: s,
|
|
98
102
|
children: [
|
|
99
103
|
/* @__PURE__ */ o(
|
|
100
|
-
|
|
104
|
+
N,
|
|
101
105
|
{
|
|
102
106
|
fields: d,
|
|
103
|
-
formBuilder:
|
|
104
|
-
grid:
|
|
105
|
-
onDeleteFile:
|
|
106
|
-
onUploadFile:
|
|
107
|
-
purpose:
|
|
107
|
+
formBuilder: u.formBuilder,
|
|
108
|
+
grid: u.grid,
|
|
109
|
+
onDeleteFile: h,
|
|
110
|
+
onUploadFile: g,
|
|
111
|
+
purpose: l
|
|
108
112
|
}
|
|
109
113
|
),
|
|
110
114
|
/* @__PURE__ */ o(T, {}),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
e > 0 && /* @__PURE__ */ o(
|
|
113
|
-
|
|
115
|
+
/* @__PURE__ */ F(W, { gutter: [8, 8], children: [
|
|
116
|
+
e > 0 && /* @__PURE__ */ o(C, { md: 12, children: /* @__PURE__ */ o(
|
|
117
|
+
S,
|
|
114
118
|
{
|
|
115
119
|
block: !0,
|
|
116
|
-
icon: /* @__PURE__ */ o(
|
|
120
|
+
icon: /* @__PURE__ */ o(w, {}),
|
|
117
121
|
htmlType: "button",
|
|
118
122
|
type: "default",
|
|
119
123
|
size: "large",
|
|
120
|
-
onClick: () =>
|
|
124
|
+
onClick: () => b(),
|
|
121
125
|
children: t("str.back")
|
|
122
126
|
}
|
|
123
127
|
) }),
|
|
124
|
-
/* @__PURE__ */ o(
|
|
125
|
-
|
|
128
|
+
/* @__PURE__ */ o(C, { md: e > 0 ? 12 : 24, children: /* @__PURE__ */ o(
|
|
129
|
+
S,
|
|
126
130
|
{
|
|
127
131
|
block: !0,
|
|
128
|
-
icon:
|
|
132
|
+
icon: m.length - 1 === e ? /* @__PURE__ */ o(x, {}) : /* @__PURE__ */ o(R, {}),
|
|
129
133
|
htmlType: "submit",
|
|
130
134
|
type: "primary",
|
|
131
|
-
loading:
|
|
135
|
+
loading: y,
|
|
132
136
|
size: "large",
|
|
133
137
|
onClick: () => {
|
|
134
138
|
r.validateFields().then((n) => {
|
|
135
|
-
|
|
139
|
+
p(
|
|
136
140
|
n,
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
m.length - 1 === e,
|
|
142
|
+
m.length - 1 === e
|
|
139
143
|
);
|
|
140
144
|
});
|
|
141
145
|
},
|
|
142
|
-
children:
|
|
146
|
+
children: m.length - 1 === e ? t("str." + (l === "update" ? "update" : "save")) : t("str.next")
|
|
143
147
|
}
|
|
144
148
|
) })
|
|
145
149
|
] })
|
|
@@ -148,5 +152,5 @@ function E({
|
|
|
148
152
|
);
|
|
149
153
|
}
|
|
150
154
|
export {
|
|
151
|
-
|
|
155
|
+
J as default
|
|
152
156
|
};
|
|
@@ -15,7 +15,7 @@ export type SearchOnlyFields<F> = CrudFieldProps<F> & {
|
|
|
15
15
|
export type ReportCrudFields<T, F> = CrudFieldProps<T> | SearchOnlyFields<F>;
|
|
16
16
|
export interface CrudReportComponentProps<T_Data, F_Search> {
|
|
17
17
|
summary?: React.ReactNode;
|
|
18
|
-
fields: ReportCrudFields<T_Data, F_Search>[];
|
|
18
|
+
fields: readonly ReportCrudFields<T_Data, F_Search>[];
|
|
19
19
|
onSubmit: (value: CrudReportSubmitForm<F_Search>) => void;
|
|
20
20
|
data: T_Data[];
|
|
21
21
|
idField?: string;
|
|
@@ -23,16 +23,16 @@ export interface CrudReportComponentProps<T_Data, F_Search> {
|
|
|
23
23
|
size?: SizeType;
|
|
24
24
|
paginateProps?: CrudPaginateProps;
|
|
25
25
|
onClickPrint?: (props: {
|
|
26
|
-
fields: CrudFieldProps<T_Data>
|
|
26
|
+
fields: readonly (CrudFieldProps<T_Data> & {
|
|
27
27
|
render: (value: any, obj: T_Data, index: number) => any;
|
|
28
|
-
}[];
|
|
28
|
+
})[];
|
|
29
29
|
data: T_Data[];
|
|
30
30
|
tableId: string;
|
|
31
31
|
}) => void;
|
|
32
32
|
onClickExcelExport?: (props: {
|
|
33
|
-
fields: CrudFieldProps<T_Data>
|
|
33
|
+
fields: readonly (CrudFieldProps<T_Data> & {
|
|
34
34
|
render: (value: any, obj: T_Data, index: number) => any;
|
|
35
|
-
}[];
|
|
35
|
+
})[];
|
|
36
36
|
data: T_Data[];
|
|
37
37
|
tableId: string;
|
|
38
38
|
}) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColProps } from 'antd/lib';
|
|
2
|
-
import {
|
|
2
|
+
import { ReadonlyCrudFields } from './CrudComponent';
|
|
3
3
|
export type CrudSearchOption<T> = {
|
|
4
4
|
required?: boolean;
|
|
5
5
|
} & ({
|
|
@@ -12,7 +12,7 @@ export type CrudSearchOption<T> = {
|
|
|
12
12
|
});
|
|
13
13
|
export interface CrudSearchComponentProps<T, FormType> {
|
|
14
14
|
searchFields?: Array<keyof T | CrudSearchOption<T>>;
|
|
15
|
-
fields:
|
|
15
|
+
fields: ReadonlyCrudFields<T>;
|
|
16
16
|
searchOnChange?: boolean;
|
|
17
17
|
searchDefaultValues?: FormType;
|
|
18
18
|
onSearch?: (values: Partial<FormType>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReadonlyCrudFields } from '../CrudComponent';
|
|
2
2
|
import { DialogProps } from '../../types/DialogComponentProp';
|
|
3
3
|
export interface CrudImportComponentProps<T> {
|
|
4
|
-
fields:
|
|
4
|
+
fields: ReadonlyCrudFields<T>;
|
|
5
5
|
importProps: CrudImportProps<T>;
|
|
6
6
|
}
|
|
7
7
|
export interface CrudImportProps<T> {
|
package/dist/crud/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { CheckboxBasedFieldProps, ColorPickerFieldProps, CrudComponentProps, CrudFieldGrid, CrudFieldProps, CrudPaginateProps, CrudPurpose, CrudWizardProp, DateBasedFieldProps, EnumCrudField, FormBuilderFunc, FormBuilderFunc0, GetFormFieldOptions, InitialCrudField, NumberBasedFieldProps, ObjectCrudField, SelectCrudField, SelectFieldItem, TextBasedFieldProps, TimeBasedFieldProps, } from './CrudComponent';
|
|
1
|
+
export type { CheckboxBasedFieldProps, ColorPickerFieldProps, CrudComponentProps, CrudFieldGrid, CrudFieldProps, CrudPaginateProps, ReadonlyCrudFields, CrudPurpose, CrudWizardProp, DateBasedFieldProps, EnumCrudField, FormBuilderFunc, FormBuilderFunc0, GetFormFieldOptions, InitialCrudField, NumberBasedFieldProps, ObjectCrudField, SelectCrudField, SelectFieldItem, TextBasedFieldProps, TimeBasedFieldProps, } from './CrudComponent';
|
|
2
2
|
export { default as CrudComponent } from './CrudComponent';
|
|
3
3
|
export { default as CrudField, ColorCrudFieldComponent, SelectCrudFieldComponent, } from './CrudField';
|
|
4
4
|
export { CrudForm, CrudFormFields } from './CrudForm';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const b=require("react/jsx-runtime"),S=require("antd"),t=require("react"),K=require("../CrudForm.cjs.js"),Q=require("../CrudFormWizard.cjs.js"),X=require("../../locale/index.cjs.js"),M=require("../../util/CrudUtil.cjs.js"),Y=require("dayjs"),d=require("../../util/ObjectUtil.cjs.js"),Z=({fields:r,wizard:l,grid:T,fullWidthModal:W,isCreating:C,isUpdating:x,onCreate:B,onUpdate:h,idField:v="id",formBuilder:_,onValuesChange:j},A)=>{const[s]=S.Form.useForm(),{t:V}=X.useTranslationLib(),[k,m]=t.useState(!1),[f,q]=t.useState("new"),[y,F]=t.useState(),[L,g]=t.useState(),[E,N]=t.useState(!1),[$,P]=t.useState(!1),[w,U]=t.useState(!1),O=t.useCallback(async c=>{var a;const p=l?c:await s.validateFields(),i=r.filter(o=>o.type==="color"),n={};for(const o of i){const e=M.getRealName(o.name,"upsertFieldName"),u=s.getFieldValue(e);d.setValueByPath(n,e,typeof u=="string"?u:(a=u==null?void 0:u.toHexString())==null?void 0:a.toUpperCase())}Object.assign(p,n),y&&h?(await h({...p,[v]:y[v]}),F(void 0)):!y&&B&&await B(p),g(void 0),s.resetFields(),m(!1)},[r,s,v,B,h,y,l]),R=t.useCallback(async c=>{N(c),P(!0)},[]),D=t.useCallback(async()=>{P(!0)},[]),H=t.useCallback(()=>{m(!0),q("new"),s.resetFields(),F(void 0),g(void 0)},[s]),I=t.useCallback(async(c,p=!0,i=!1)=>{try{U(!0),m(!0),q(i?"clone":"update");const n={};for(const a of r){const o=M.getRealName(a.name,"upsertFieldName"),e=d.getValueByPath(c,o);if(i&&a.type==="image"){const u=e;try{const J=await a.provider.clone(u);d.setValueByPath(n,o,J);continue}catch{continue}}a.type==="date"||a.type==="time"?e&&d.setValueByPath(n,o,Y(e)):a.type==="select"?a.multiple&&Array.isArray(e)?d.setValueByPath(n,o,e.map(u=>u[a.innerFieldId??"id"])):e&&typeof e=="object"?d.setValueByPath(n,o,e[a.innerFieldId??"id"]):(e&&typeof e=="string"||typeof e=="number")&&d.setValueByPath(n,o,e):d.setValueByPath(n,o,e)}s.setFieldsValue(n),g(n),p&&F(c)}finally{U(!1)}},[r,s]);t.useImperativeHandle(A,()=>({create:H,update:I}),[H,I]),t.useEffect(()=>{k&&(N(!1),P(!1))},[k]);const G=t.useCallback(async()=>{try{if(f==="clone"){const c=l?y:s.getFieldsValue(),p=r.filter(i=>i.type==="image");for(const i of p)c[i.name]&&i.provider.delete(c[i.name])}}finally{}l||s.resetFields(),g(void 0),F(void 0),m(!1)},[f,l,s,y,r]);return b.jsx(S.Modal,{width:W?"100%":void 0,title:V("str."+(f??"new")),open:k,confirmLoading:C||x,okText:V("str."+(f==="update"?"update":"save")),cancelText:V("str.cancel"),cancelButtonProps:{disabled:$,hidden:!!l},okButtonProps:{disabled:E,hidden:!!l},onCancel:G,onOk:()=>O(),destroyOnHidden:!0,children:b.jsxs(S.Spin,{spinning:w,children:[l?null:b.jsx(K.CrudForm,{purpose:f,fields:r,form:s,formBuilder:_,grid:T,onDeleteFile:D,onUploadFile:R,onValuesChange:j}),l&&b.jsx(Q,{submitting:C||x,className:"mt-2",onSave:O,updatingValue:L,fields:r,onDeleteFile:D,onUploadFile:R,purpose:f,wizard:l,onValuesChange:j})]})})},z=t.forwardRef(Z);module.exports=z;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { CrudWizardProp, FormBuilderFunc, ReadonlyCrudFields } from '../CrudComponent';
|
|
4
4
|
import { default as IdProps } from '../../types/Id';
|
|
5
5
|
export interface CrudModalProps<T, FormType> {
|
|
6
|
-
fields:
|
|
6
|
+
fields: ReadonlyCrudFields<T>;
|
|
7
7
|
wizard?: CrudWizardProp<T>[];
|
|
8
8
|
grid?: boolean;
|
|
9
9
|
fullWidthModal?: boolean;
|
|
@@ -1,149 +1,154 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Form as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { CrudForm as
|
|
5
|
-
import
|
|
6
|
-
import { useTranslationLib as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { jsx as P, jsxs as K } from "react/jsx-runtime";
|
|
2
|
+
import { Form as Q, Modal as X, Spin as Y } from "antd";
|
|
3
|
+
import { forwardRef as Z, useState as u, useCallback as F, useImperativeHandle as z, useEffect as ee } from "react";
|
|
4
|
+
import { CrudForm as te } from "../CrudForm.es.js";
|
|
5
|
+
import oe from "../CrudFormWizard.es.js";
|
|
6
|
+
import { useTranslationLib as ne } from "../../locale/index.es.js";
|
|
7
|
+
import T from "../../util/CrudUtil.es.js";
|
|
8
|
+
import se from "dayjs";
|
|
9
|
+
import { setValueByPath as p, getValueByPath as ae } from "../../util/ObjectUtil.es.js";
|
|
10
|
+
const le = ({
|
|
10
11
|
fields: c,
|
|
11
|
-
wizard:
|
|
12
|
-
grid:
|
|
13
|
-
fullWidthModal:
|
|
14
|
-
isCreating:
|
|
15
|
-
isUpdating:
|
|
16
|
-
onCreate:
|
|
17
|
-
onUpdate:
|
|
18
|
-
idField:
|
|
19
|
-
formBuilder:
|
|
20
|
-
onValuesChange:
|
|
21
|
-
},
|
|
22
|
-
const [t] =
|
|
12
|
+
wizard: a,
|
|
13
|
+
grid: W,
|
|
14
|
+
fullWidthModal: _,
|
|
15
|
+
isCreating: S,
|
|
16
|
+
isUpdating: x,
|
|
17
|
+
onCreate: b,
|
|
18
|
+
onUpdate: B,
|
|
19
|
+
idField: h = "id",
|
|
20
|
+
formBuilder: A,
|
|
21
|
+
onValuesChange: C
|
|
22
|
+
}, L) => {
|
|
23
|
+
const [t] = Q.useForm(), { t: k } = ne(), [V, y] = u(!1), [f, j] = u("new"), [m, g] = u(), [E, v] = u(), [$, U] = u(!1), [q, N] = u(!1), [w, O] = u(!1), D = F(
|
|
23
24
|
async (i) => {
|
|
24
25
|
var o;
|
|
25
|
-
const d =
|
|
26
|
-
for (const s of
|
|
27
|
-
const e =
|
|
28
|
-
|
|
26
|
+
const d = a ? i : await t.validateFields(), l = c.filter((s) => s.type === "color"), n = {};
|
|
27
|
+
for (const s of l) {
|
|
28
|
+
const e = T.getRealName(s.name, "upsertFieldName"), r = t.getFieldValue(e);
|
|
29
|
+
p(
|
|
30
|
+
n,
|
|
31
|
+
e,
|
|
32
|
+
typeof r == "string" ? r : (o = r == null ? void 0 : r.toHexString()) == null ? void 0 : o.toUpperCase()
|
|
33
|
+
);
|
|
29
34
|
}
|
|
30
|
-
Object.assign(d, n),
|
|
35
|
+
Object.assign(d, n), m && B ? (await B({
|
|
31
36
|
...d,
|
|
32
|
-
[
|
|
33
|
-
}),
|
|
37
|
+
[h]: m[h]
|
|
38
|
+
}), g(void 0)) : !m && b && await b(d), v(void 0), t.resetFields(), y(!1);
|
|
34
39
|
},
|
|
35
|
-
[c, t,
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
}, []),
|
|
40
|
+
[c, t, h, b, B, m, a]
|
|
41
|
+
), H = F(async (i) => {
|
|
42
|
+
U(i), N(!0);
|
|
43
|
+
}, []), I = F(async () => {
|
|
39
44
|
N(!0);
|
|
40
|
-
}, []),
|
|
41
|
-
|
|
42
|
-
}, [t]),
|
|
43
|
-
async (i, d = !0,
|
|
45
|
+
}, []), M = F(() => {
|
|
46
|
+
y(!0), j("new"), t.resetFields(), g(void 0), v(void 0);
|
|
47
|
+
}, [t]), R = F(
|
|
48
|
+
async (i, d = !0, l = !1) => {
|
|
44
49
|
try {
|
|
45
|
-
|
|
50
|
+
O(!0), y(!0), j(l ? "clone" : "update");
|
|
46
51
|
const n = {};
|
|
47
52
|
for (const o of c) {
|
|
48
|
-
const s =
|
|
53
|
+
const s = T.getRealName(
|
|
49
54
|
o.name,
|
|
50
55
|
"upsertFieldName"
|
|
51
|
-
), e = i
|
|
52
|
-
if (
|
|
56
|
+
), e = ae(i, s);
|
|
57
|
+
if (l && o.type === "image") {
|
|
53
58
|
const r = e;
|
|
54
59
|
try {
|
|
55
|
-
const
|
|
56
|
-
n
|
|
60
|
+
const J = await o.provider.clone(r);
|
|
61
|
+
p(n, s, J);
|
|
57
62
|
continue;
|
|
58
63
|
} catch {
|
|
59
64
|
continue;
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
|
-
o.type === "date" || o.type === "time" ? e && (n
|
|
67
|
+
o.type === "date" || o.type === "time" ? e && p(n, s, se(e)) : o.type === "select" ? o.multiple && Array.isArray(e) ? p(n, s, e.map(
|
|
63
68
|
(r) => r[o.innerFieldId ?? "id"]
|
|
64
|
-
) : e && typeof e == "object" ? n
|
|
69
|
+
)) : e && typeof e == "object" ? p(n, s, e[o.innerFieldId ?? "id"]) : (e && typeof e == "string" || typeof e == "number") && p(n, s, e) : p(n, s, e);
|
|
65
70
|
}
|
|
66
|
-
t.setFieldsValue(n),
|
|
71
|
+
t.setFieldsValue(n), v(n), d && g(i);
|
|
67
72
|
} finally {
|
|
68
|
-
|
|
73
|
+
O(!1);
|
|
69
74
|
}
|
|
70
75
|
},
|
|
71
76
|
[c, t]
|
|
72
77
|
);
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
z(
|
|
79
|
+
L,
|
|
75
80
|
() => ({
|
|
76
|
-
create:
|
|
77
|
-
update:
|
|
81
|
+
create: M,
|
|
82
|
+
update: R
|
|
78
83
|
}),
|
|
79
|
-
[
|
|
80
|
-
),
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
const
|
|
84
|
+
[M, R]
|
|
85
|
+
), ee(() => {
|
|
86
|
+
V && (U(!1), N(!1));
|
|
87
|
+
}, [V]);
|
|
88
|
+
const G = F(async () => {
|
|
84
89
|
try {
|
|
85
|
-
if (
|
|
86
|
-
const i =
|
|
87
|
-
for (const
|
|
88
|
-
i[
|
|
90
|
+
if (f === "clone") {
|
|
91
|
+
const i = a ? m : t.getFieldsValue(), d = c.filter((l) => l.type === "image");
|
|
92
|
+
for (const l of d)
|
|
93
|
+
i[l.name] && l.provider.delete(i[l.name]);
|
|
89
94
|
}
|
|
90
95
|
} finally {
|
|
91
96
|
}
|
|
92
|
-
|
|
93
|
-
}, [
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
|
|
97
|
+
a || t.resetFields(), v(void 0), g(void 0), y(!1);
|
|
98
|
+
}, [f, a, t, m, c]);
|
|
99
|
+
return /* @__PURE__ */ P(
|
|
100
|
+
X,
|
|
96
101
|
{
|
|
97
|
-
width:
|
|
98
|
-
title:
|
|
99
|
-
open:
|
|
100
|
-
confirmLoading:
|
|
101
|
-
okText:
|
|
102
|
-
cancelText:
|
|
102
|
+
width: _ ? "100%" : void 0,
|
|
103
|
+
title: k("str." + (f ?? "new")),
|
|
104
|
+
open: V,
|
|
105
|
+
confirmLoading: S || x,
|
|
106
|
+
okText: k("str." + (f === "update" ? "update" : "save")),
|
|
107
|
+
cancelText: k("str.cancel"),
|
|
103
108
|
cancelButtonProps: {
|
|
104
|
-
disabled:
|
|
105
|
-
hidden: !!
|
|
109
|
+
disabled: q,
|
|
110
|
+
hidden: !!a
|
|
106
111
|
},
|
|
107
112
|
okButtonProps: {
|
|
108
|
-
disabled:
|
|
109
|
-
hidden: !!
|
|
113
|
+
disabled: $,
|
|
114
|
+
hidden: !!a
|
|
110
115
|
},
|
|
111
|
-
onCancel:
|
|
112
|
-
onOk: () =>
|
|
116
|
+
onCancel: G,
|
|
117
|
+
onOk: () => D(),
|
|
113
118
|
destroyOnHidden: !0,
|
|
114
|
-
children: /* @__PURE__ */
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
children: /* @__PURE__ */ K(Y, { spinning: w, children: [
|
|
120
|
+
a ? null : /* @__PURE__ */ P(
|
|
121
|
+
te,
|
|
117
122
|
{
|
|
118
|
-
purpose:
|
|
123
|
+
purpose: f,
|
|
119
124
|
fields: c,
|
|
120
125
|
form: t,
|
|
121
|
-
formBuilder:
|
|
122
|
-
grid:
|
|
123
|
-
onDeleteFile:
|
|
124
|
-
onUploadFile:
|
|
125
|
-
onValuesChange:
|
|
126
|
+
formBuilder: A,
|
|
127
|
+
grid: W,
|
|
128
|
+
onDeleteFile: I,
|
|
129
|
+
onUploadFile: H,
|
|
130
|
+
onValuesChange: C
|
|
126
131
|
}
|
|
127
132
|
),
|
|
128
|
-
|
|
129
|
-
|
|
133
|
+
a && /* @__PURE__ */ P(
|
|
134
|
+
oe,
|
|
130
135
|
{
|
|
131
|
-
submitting:
|
|
136
|
+
submitting: S || x,
|
|
132
137
|
className: "mt-2",
|
|
133
|
-
onSave:
|
|
134
|
-
updatingValue:
|
|
138
|
+
onSave: D,
|
|
139
|
+
updatingValue: E,
|
|
135
140
|
fields: c,
|
|
136
|
-
onDeleteFile:
|
|
137
|
-
onUploadFile:
|
|
138
|
-
purpose:
|
|
139
|
-
wizard:
|
|
140
|
-
onValuesChange:
|
|
141
|
+
onDeleteFile: I,
|
|
142
|
+
onUploadFile: H,
|
|
143
|
+
purpose: f,
|
|
144
|
+
wizard: a,
|
|
145
|
+
onValuesChange: C
|
|
141
146
|
}
|
|
142
147
|
)
|
|
143
148
|
] })
|
|
144
149
|
}
|
|
145
150
|
);
|
|
146
|
-
},
|
|
151
|
+
}, ye = Z(le);
|
|
147
152
|
export {
|
|
148
|
-
|
|
153
|
+
ye as default
|
|
149
154
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),x=require("../../common/description/DescList.cjs.js"),j=require("react"),C=require("../../locale/index.cjs.js"),V=require("./CrudViewerUtil.cjs.js"),v=require("../../util/CrudUtil.cjs.js"),f=require("../actions/index.cjs.js"),p=require("../../util/ObjectUtil.cjs.js");function w({className:m,fields:i,data:e,descListColumn:a={xs:1,md:3,sm:2,lg:4},layout:d,keepEmptyValues:b,inBuiltModalProps:u,...s}){const{t:o}=C.useTranslationLib(),g=j.useMemo(()=>{const l=i.filter(({hidden:t,hideInDescList:n})=>!t&&!n).map((t,n)=>{const q=v.getRealName(t.name);return{label:t.label,noFormatting:!0,value:V.getRendererValueCrudViewer(t)(p.getValueByPath(e,q),e,n)}}),c=e?r.jsx(f,{data:e,...s,inBuiltModalProps:u?{...u,fields:i}:void 0}):void 0;return c&&l.push({label:o("str.action"),value:c}),l},[e,i,o,s]);return e?r.jsx(x,{keepEmptyValues:b,bordered:!0,column:a,className:m,layout:d,list:g}):r.jsx(r.Fragment,{})}exports.CrudDecListView=w;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Breakpoint } from 'antd';
|
|
2
|
-
import {
|
|
2
|
+
import { ReadonlyCrudFields } from '../CrudComponent';
|
|
3
3
|
import { CrudActionsProps } from '../actions';
|
|
4
4
|
import { CrudModalProps } from '../modal';
|
|
5
5
|
export type DescListColumn = number | Partial<Record<Breakpoint, number>> | undefined;
|
|
6
6
|
export interface CrudDecListViewProps<T, FormType = T> extends Omit<CrudActionsProps<T, FormType>, "inBuiltModalProps"> {
|
|
7
|
-
fields:
|
|
7
|
+
fields: ReadonlyCrudFields<T>;
|
|
8
8
|
data: T | undefined;
|
|
9
9
|
className?: string;
|
|
10
10
|
descListColumn?: DescListColumn;
|
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { useTranslationLib as
|
|
5
|
-
import { getRendererValueCrudViewer as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { jsx as m, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import d from "../../common/description/DescList.es.js";
|
|
3
|
+
import { useMemo as v } from "react";
|
|
4
|
+
import { useTranslationLib as V } from "../../locale/index.es.js";
|
|
5
|
+
import { getRendererValueCrudViewer as x } from "./CrudViewerUtil.es.js";
|
|
6
|
+
import F from "../../util/CrudUtil.es.js";
|
|
7
|
+
import L from "../actions/index.es.js";
|
|
8
|
+
import { getValueByPath as h } from "../../util/ObjectUtil.es.js";
|
|
9
|
+
function T({
|
|
9
10
|
className: p,
|
|
10
|
-
fields:
|
|
11
|
+
fields: t,
|
|
11
12
|
data: r,
|
|
12
|
-
descListColumn:
|
|
13
|
-
layout:
|
|
14
|
-
keepEmptyValues:
|
|
15
|
-
inBuiltModalProps:
|
|
13
|
+
descListColumn: f = { xs: 1, md: 3, sm: 2, lg: 4 },
|
|
14
|
+
layout: c,
|
|
15
|
+
keepEmptyValues: a,
|
|
16
|
+
inBuiltModalProps: i,
|
|
16
17
|
...n
|
|
17
18
|
}) {
|
|
18
|
-
const { t: u } =
|
|
19
|
-
const l =
|
|
20
|
-
const
|
|
19
|
+
const { t: u } = V(), g = v(() => {
|
|
20
|
+
const l = t.filter(({ hidden: e, hideInDescList: o }) => !e && !o).map((e, o) => {
|
|
21
|
+
const b = F.getRealName(e.name);
|
|
21
22
|
return {
|
|
22
23
|
label: e.label,
|
|
23
24
|
noFormatting: !0,
|
|
24
|
-
value:
|
|
25
|
-
r
|
|
25
|
+
value: x(e)(
|
|
26
|
+
h(r, b),
|
|
26
27
|
r,
|
|
27
|
-
|
|
28
|
+
o
|
|
28
29
|
)
|
|
29
30
|
};
|
|
30
|
-
}), s = r ? /* @__PURE__ */
|
|
31
|
-
|
|
31
|
+
}), s = r ? /* @__PURE__ */ m(
|
|
32
|
+
L,
|
|
32
33
|
{
|
|
33
34
|
data: r,
|
|
34
35
|
...n,
|
|
35
|
-
inBuiltModalProps:
|
|
36
|
+
inBuiltModalProps: i ? { ...i, fields: t } : void 0
|
|
36
37
|
}
|
|
37
38
|
) : void 0;
|
|
38
39
|
return s && l.push({
|
|
39
40
|
label: u("str.action"),
|
|
40
41
|
value: s
|
|
41
42
|
}), l;
|
|
42
|
-
}, [r,
|
|
43
|
-
return r ? /* @__PURE__ */
|
|
44
|
-
|
|
43
|
+
}, [r, t, u, n]);
|
|
44
|
+
return r ? /* @__PURE__ */ m(
|
|
45
|
+
d,
|
|
45
46
|
{
|
|
46
|
-
keepEmptyValues:
|
|
47
|
+
keepEmptyValues: a,
|
|
47
48
|
bordered: !0,
|
|
48
|
-
column:
|
|
49
|
+
column: f,
|
|
49
50
|
className: p,
|
|
50
|
-
layout:
|
|
51
|
+
layout: c,
|
|
51
52
|
list: g
|
|
52
53
|
}
|
|
53
|
-
) : /* @__PURE__ */
|
|
54
|
+
) : /* @__PURE__ */ m(C, {});
|
|
54
55
|
}
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
T as CrudDecListView
|
|
57
58
|
};
|
|
@@ -4,7 +4,7 @@ import { DragEndEvent } from '@dnd-kit/core';
|
|
|
4
4
|
import { TableProps } from 'antd/lib';
|
|
5
5
|
import { CrudActionsProps } from '../actions';
|
|
6
6
|
import { default as React } from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { CrudPaginateProps, ReadonlyCrudFields } from '../CrudComponent';
|
|
8
8
|
import { CrudSearchComponentProps } from '../CrudSearchComponent';
|
|
9
9
|
import { DescListColumn } from './CrudDecListView';
|
|
10
10
|
type TableRowSelection<T> = TableProps<T>["rowSelection"];
|
|
@@ -21,7 +21,7 @@ export type CrudViewableProps<T> = boolean | keyof T | {
|
|
|
21
21
|
};
|
|
22
22
|
export type CrudViewerProps<T, FormType> = {
|
|
23
23
|
summary?: TableProps<T>["summary"];
|
|
24
|
-
fields:
|
|
24
|
+
fields: ReadonlyCrudFields<T>;
|
|
25
25
|
decListLayout?: "horizontal" | "vertical";
|
|
26
26
|
viewable?: CrudViewableProps<T>;
|
|
27
27
|
paginateProps?: CrudPaginateProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("@ant-design/icons"),b=require("antd"),B=require("../FileCrudField.cjs.js"),W=require("../ImageCrudField.cjs.js"),C=require("../../util/DateUtil.cjs.js"),v=require("../../util/NumberUtil.cjs.js"),T=require("../../locale/index.cjs.js"),F=require("../../util/CrudUtil.cjs.js"),h=require("../../common/error/ErrorBoundaryComponent.cjs.js"),i=require("../../util/CopyUtilComponent.cjs.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),g=require("@ant-design/icons"),b=require("antd"),B=require("../FileCrudField.cjs.js"),W=require("../ImageCrudField.cjs.js"),C=require("../../util/DateUtil.cjs.js"),v=require("../../util/NumberUtil.cjs.js"),T=require("../../locale/index.cjs.js"),F=require("../../util/CrudUtil.cjs.js"),h=require("../../common/error/ErrorBoundaryComponent.cjs.js"),i=require("../../util/CopyUtilComponent.cjs.js"),q=require("../../util/ObjectUtil.cjs.js");function S({type:d,render:e,...p}){try{return d==="object"?(o,n,a)=>t.jsx(i.CopyToClipboardButtonWrapper,{copyable:p.copyable,value:o,children:typeof e=="function"?e(o,n,a):""}):d==="select"?(o,n,a)=>{if(!o)return"-";const r=p,c=o||(r.items??[]).find(s=>s[r.innerFieldId??"key"]===q.getValueByPath(n,F.getRealName(p.name,"upsertFieldName"))),u=r.multiple?Array.isArray(c)?c.map(s=>s==null?void 0:s[r.innerFieldLabel??"name"]):void 0:c==null?void 0:c[r.innerFieldLabel??"value"];return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,u),children:typeof e=="function"?e(u,n,a):Array.isArray(u)?u.join(", "):u})}:d==="number"?(o,n,a)=>{const r=p;return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,o),children:typeof e=="function"?e(o,n,a):r.int?v.default.toInt(o,r.formatted):v.default.toMoney(o)})}:d==="enum"?(o,n,a)=>{var s;if(!o)return"-";const r=p;if(typeof e=="function")return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:e(o,n,a)});if(r.multiple){const f=(Array.isArray(o)?o:o?[o]:[]).map(l=>{var j,m;const y=(j=r.tagRender)==null?void 0:j[l],x=T.tWithOrWithoutNS(((m=r==null?void 0:r.translation)==null?void 0:m[l??""])??l,void 0,l);return{tagProps:y,translatedValue:x,item:l}});if(typeof r.tagRender=="object")return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>f.map(({translatedValue:l,item:y})=>l??y).join(", "),children:t.jsx(h.ErrorBoundaryComponent,{children:t.jsx(b.Space,{wrap:!0,children:f.map(({tagProps:l,translatedValue:y,item:x},j)=>l?t.jsx(b.Tag,{color:l.color,children:y},j+x):y)})})});if(r!=null&&r.translation)return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>f.map(({translatedValue:l,item:y})=>l??y).join(", "),children:t.jsx(h.ErrorBoundaryComponent,{children:f==null?void 0:f.map(({translatedValue:l,item:y})=>l??y).join(", ")})});{const l=f.map(({translatedValue:y,item:x})=>y??x).join(", ");return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,l),children:l})}}const c=((s=r==null?void 0:r.translation)==null?void 0:s[o??""])??o,u=T.tWithOrWithoutNS(c,void 0,o);if(typeof r.tagRender=="object"){const f=r.tagRender[o];if(f)return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:u,children:t.jsx(b.Tag,{color:f.color,children:u})})}return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,u),children:u})}:d==="date"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.formatTime?C.formatDateTime(o):C.formatDate(o);return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:c,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):c})})}:d==="checkbox"?(o,n,a)=>typeof e=="function"?e(o,n,a):o?t.jsx(g.CheckOutlined,{}):t.jsx(g.CloseOutlined,{}):d==="image"?(o,n,a)=>o?t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):t.jsx(W.ImageCrudCellValue,{value:o,provider:p.provider})}):"-":d==="file"?(o,n,a)=>o?t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):t.jsx(B.FileCrudCellValue,{value:o,provider:p.provider})}):"":d==="time"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.format,u=r.use12Hours,s=C.formatTime(o,c||(u?"hh:mm:ss A":void 0));return t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:s,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):s})})}:d==="color"?(o,n,a)=>{const r=p;return o?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:t.jsx(h.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,a):typeof o=="string"&&o.startsWith("#")?t.jsx(b.Tooltip,{title:o,children:t.jsx(b.Avatar,{style:{backgroundColor:o}})}):String(o)})}):"-"}:d==="textarea"?(o,n,a)=>{if(!o)return"-";const r=p,c=r.truncated??1,u=typeof o=="string"&&o.split(" ").length<10;return typeof e=="function"?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:e(o,n,a)}):c?t.jsx(h.ErrorBoundaryComponent,{children:t.jsx(b.Typography.Paragraph,{ellipsis:!u&&{rows:c===!0?1:c,expandable:"collapsible"},copyable:i.copyableFn(r.copyable,o),children:r.rich?t.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}}):o})}):r.rich?t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:t.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}})}):t.jsx(i.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:o,children:o})}:typeof e=="function"?e:(o,n,a)=>{const r=p;return t.jsx(b.Typography.Text,{copyable:i.copyableFn(r.copyable,o),children:o})}}catch(o){return console.warn("An error occurred while rendering the value for field: "+String(p.name),o),"-"}}exports.getRendererValueCrudViewer=S;
|
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { CheckOutlined as S, CloseOutlined as F } from "@ant-design/icons";
|
|
3
|
-
import { Typography as
|
|
4
|
-
import { FileCrudCellValue as
|
|
5
|
-
import { ImageCrudCellValue as
|
|
3
|
+
import { Typography as h, Space as P, Tag as C, Tooltip as R, Avatar as V } from "antd";
|
|
4
|
+
import { FileCrudCellValue as w } from "../FileCrudField.es.js";
|
|
5
|
+
import { ImageCrudCellValue as I } from "../ImageCrudField.es.js";
|
|
6
6
|
import T from "../../util/DateUtil.es.js";
|
|
7
7
|
import j from "../../util/NumberUtil.es.js";
|
|
8
8
|
import { tWithOrWithoutNS as A } from "../../locale/index.es.js";
|
|
9
9
|
import k from "../../util/CrudUtil.es.js";
|
|
10
10
|
import { ErrorBoundaryComponent as b } from "../../common/error/ErrorBoundaryComponent.es.js";
|
|
11
|
-
import { CopyToClipboardButtonWrapper as m, copyableFn as
|
|
12
|
-
|
|
11
|
+
import { CopyToClipboardButtonWrapper as m, copyableFn as d } from "../../util/CopyUtilComponent.es.js";
|
|
12
|
+
import { getValueByPath as D } from "../../util/ObjectUtil.es.js";
|
|
13
|
+
function J({
|
|
13
14
|
type: y,
|
|
14
|
-
render:
|
|
15
|
+
render: e,
|
|
15
16
|
...u
|
|
16
17
|
}) {
|
|
17
18
|
try {
|
|
18
|
-
return y === "object" ? (t, l,
|
|
19
|
+
return y === "object" ? (t, l, n) => /* @__PURE__ */ r(
|
|
19
20
|
m,
|
|
20
21
|
{
|
|
21
22
|
copyable: u.copyable,
|
|
22
23
|
value: t,
|
|
23
|
-
children: typeof
|
|
24
|
+
children: typeof e == "function" ? e(t, l, n) : ""
|
|
24
25
|
}
|
|
25
|
-
) : y === "select" ? (t, l,
|
|
26
|
+
) : y === "select" ? (t, l, n) => {
|
|
26
27
|
if (!t) return "-";
|
|
27
28
|
const o = u, a = t || (o.items ?? []).find(
|
|
28
|
-
(f) => f[o.innerFieldId ?? "key"] === l
|
|
29
|
+
(f) => f[o.innerFieldId ?? "key"] === D(l, k.getRealName(u.name, "upsertFieldName"))
|
|
29
30
|
), c = o.multiple ? Array.isArray(a) ? a.map((f) => f == null ? void 0 : f[o.innerFieldLabel ?? "name"]) : void 0 : a == null ? void 0 : a[o.innerFieldLabel ?? "value"];
|
|
30
|
-
return /* @__PURE__ */ r(
|
|
31
|
-
} : y === "number" ? (t, l,
|
|
31
|
+
return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, c), children: typeof e == "function" ? e(c, l, n) : Array.isArray(c) ? c.join(", ") : c });
|
|
32
|
+
} : y === "number" ? (t, l, n) => {
|
|
32
33
|
const o = u;
|
|
33
|
-
return /* @__PURE__ */ r(
|
|
34
|
-
} : y === "enum" ? (t, l,
|
|
34
|
+
return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, t), children: typeof e == "function" ? e(t, l, n) : o.int ? j.toInt(t, o.formatted) : j.toMoney(t) });
|
|
35
|
+
} : y === "enum" ? (t, l, n) => {
|
|
35
36
|
var f;
|
|
36
37
|
if (!t) return "-";
|
|
37
38
|
const o = u;
|
|
38
|
-
if (typeof
|
|
39
|
+
if (typeof e == "function")
|
|
39
40
|
return /* @__PURE__ */ r(
|
|
40
41
|
m,
|
|
41
42
|
{
|
|
42
43
|
copyable: o.copyable,
|
|
43
44
|
value: t,
|
|
44
|
-
children:
|
|
45
|
+
children: e(t, l, n)
|
|
45
46
|
}
|
|
46
47
|
);
|
|
47
48
|
if (o.multiple) {
|
|
@@ -66,7 +67,7 @@ function z({
|
|
|
66
67
|
value: () => s.map(
|
|
67
68
|
({ translatedValue: i, item: p }) => i ?? p
|
|
68
69
|
).join(", "),
|
|
69
|
-
children: /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
|
|
70
|
+
children: /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(P, { wrap: !0, children: s.map(({ tagProps: i, translatedValue: p, item: v }, g) => i ? /* @__PURE__ */ r(C, { color: i.color, children: p }, g + v) : p) }) })
|
|
70
71
|
}
|
|
71
72
|
);
|
|
72
73
|
if (o != null && o.translation)
|
|
@@ -85,9 +86,9 @@ function z({
|
|
|
85
86
|
{
|
|
86
87
|
const i = s.map(({ translatedValue: p, item: v }) => p ?? v).join(", ");
|
|
87
88
|
return /* @__PURE__ */ r(
|
|
88
|
-
|
|
89
|
+
h.Text,
|
|
89
90
|
{
|
|
90
|
-
copyable:
|
|
91
|
+
copyable: d(o.copyable, i),
|
|
91
92
|
children: i
|
|
92
93
|
}
|
|
93
94
|
);
|
|
@@ -106,8 +107,8 @@ function z({
|
|
|
106
107
|
}
|
|
107
108
|
);
|
|
108
109
|
}
|
|
109
|
-
return /* @__PURE__ */ r(
|
|
110
|
-
} : y === "date" ? (t, l,
|
|
110
|
+
return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, c), children: c });
|
|
111
|
+
} : y === "date" ? (t, l, n) => {
|
|
111
112
|
if (!t) return "-";
|
|
112
113
|
const o = u, a = o.formatTime ? T.formatDateTime(t) : T.formatDate(t);
|
|
113
114
|
return /* @__PURE__ */ r(
|
|
@@ -115,22 +116,22 @@ function z({
|
|
|
115
116
|
{
|
|
116
117
|
copyable: o.copyable,
|
|
117
118
|
value: a,
|
|
118
|
-
children: /* @__PURE__ */ r(b, { children: typeof
|
|
119
|
+
children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : a })
|
|
119
120
|
}
|
|
120
121
|
);
|
|
121
|
-
} : y === "checkbox" ? (t, l,
|
|
122
|
-
|
|
122
|
+
} : y === "checkbox" ? (t, l, n) => typeof e == "function" ? e(t, l, n) : t ? /* @__PURE__ */ r(S, {}) : /* @__PURE__ */ r(F, {}) : y === "image" ? (t, l, n) => t ? /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : /* @__PURE__ */ r(
|
|
123
|
+
I,
|
|
123
124
|
{
|
|
124
125
|
value: t,
|
|
125
126
|
provider: u.provider
|
|
126
127
|
}
|
|
127
|
-
) }) : "-" : y === "file" ? (t, l,
|
|
128
|
-
|
|
128
|
+
) }) : "-" : y === "file" ? (t, l, n) => t ? /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : /* @__PURE__ */ r(
|
|
129
|
+
w,
|
|
129
130
|
{
|
|
130
131
|
value: t,
|
|
131
132
|
provider: u.provider
|
|
132
133
|
}
|
|
133
|
-
) }) : "" : y === "time" ? (t, l,
|
|
134
|
+
) }) : "" : y === "time" ? (t, l, n) => {
|
|
134
135
|
if (!t) return "-";
|
|
135
136
|
const o = u, a = o.format, c = o.use12Hours, f = T.formatTime(
|
|
136
137
|
t,
|
|
@@ -141,30 +142,30 @@ function z({
|
|
|
141
142
|
{
|
|
142
143
|
copyable: o.copyable,
|
|
143
144
|
value: f,
|
|
144
|
-
children: /* @__PURE__ */ r(b, { children: typeof
|
|
145
|
+
children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : f })
|
|
145
146
|
}
|
|
146
147
|
);
|
|
147
|
-
} : y === "color" ? (t, l,
|
|
148
|
+
} : y === "color" ? (t, l, n) => {
|
|
148
149
|
const o = u;
|
|
149
|
-
return t ? /* @__PURE__ */ r(m, { copyable: o.copyable, value: t, children: /* @__PURE__ */ r(b, { children: typeof
|
|
150
|
-
} : y === "textarea" ? (t, l,
|
|
150
|
+
return t ? /* @__PURE__ */ r(m, { copyable: o.copyable, value: t, children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ r(R, { title: t, children: /* @__PURE__ */ r(V, { style: { backgroundColor: t } }) }) : String(t) }) }) : "-";
|
|
151
|
+
} : y === "textarea" ? (t, l, n) => {
|
|
151
152
|
if (!t) return "-";
|
|
152
153
|
const o = u, a = o.truncated ?? 1, c = typeof t == "string" && t.split(" ").length < 10;
|
|
153
|
-
return typeof
|
|
154
|
+
return typeof e == "function" ? /* @__PURE__ */ r(
|
|
154
155
|
m,
|
|
155
156
|
{
|
|
156
157
|
copyable: o.copyable,
|
|
157
158
|
value: t,
|
|
158
|
-
children:
|
|
159
|
+
children: e(t, l, n)
|
|
159
160
|
}
|
|
160
161
|
) : a ? /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
|
|
161
|
-
|
|
162
|
+
h.Paragraph,
|
|
162
163
|
{
|
|
163
164
|
ellipsis: !c && {
|
|
164
165
|
rows: a === !0 ? 1 : a,
|
|
165
166
|
expandable: "collapsible"
|
|
166
167
|
},
|
|
167
|
-
copyable:
|
|
168
|
+
copyable: d(o.copyable, t),
|
|
168
169
|
children: o.rich ? /* @__PURE__ */ r(
|
|
169
170
|
"div",
|
|
170
171
|
{
|
|
@@ -194,9 +195,9 @@ function z({
|
|
|
194
195
|
children: t
|
|
195
196
|
}
|
|
196
197
|
);
|
|
197
|
-
} : typeof
|
|
198
|
+
} : typeof e == "function" ? e : (t, l, n) => {
|
|
198
199
|
const o = u;
|
|
199
|
-
return /* @__PURE__ */ r(
|
|
200
|
+
return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, t), children: t });
|
|
200
201
|
};
|
|
201
202
|
} catch (t) {
|
|
202
203
|
return console.warn(
|
|
@@ -206,5 +207,5 @@ function z({
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
export {
|
|
209
|
-
|
|
210
|
+
J as getRendererValueCrudViewer
|
|
210
211
|
};
|
package/dist/util/CrudUtil.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitialCrudField, SelectCrudField } from '
|
|
1
|
+
import { InitialCrudField, SelectCrudField } from '../crud/CrudComponent';
|
|
2
2
|
declare class CrudUtil {
|
|
3
3
|
static getRealName<T>(name: InitialCrudField<T>["name"] | SelectCrudField<T>["name"], extract?: "name" | "upsertFieldName"): (string | number)[] | keyof T;
|
|
4
4
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function y(e,r){return typeof e!="object"||e===null?e:Array.isArray(r)?r.reduce((t,u)=>t[u],e):e[r]}function i(e,r,t){return typeof e!="object"||e===null?e:Array.isArray(r)?r.reduce((u,n)=>u[n],e):(e[r]=t,e)}exports.getValueByPath=y;exports.setValueByPath=i;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function f(r, e) {
|
|
2
|
+
return typeof r != "object" || r === null ? r : Array.isArray(e) ? e.reduce((u, t) => u[t], r) : r[e];
|
|
3
|
+
}
|
|
4
|
+
function i(r, e, u) {
|
|
5
|
+
return typeof r != "object" || r === null ? r : Array.isArray(e) ? e.reduce((t, n) => t[n], r) : (r[e] = u, r);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
f as getValueByPath,
|
|
9
|
+
i as setValueByPath
|
|
10
|
+
};
|
package/package.json
CHANGED
package/dist/locale/index.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { TRANSLATION_NAMESPACE } from '../locale/hooks/translation-constants';
|
|
2
|
-
import { default as en } from './translations/en';
|
|
3
|
-
import { i18n as i18nType } from 'i18next';
|
|
4
|
-
import { UseTranslationOptions } from 'react-i18next';
|
|
5
|
-
export declare const defaultTranslations: {
|
|
6
|
-
en: {
|
|
7
|
-
"crud-component": {
|
|
8
|
-
str: {
|
|
9
|
-
delete: string;
|
|
10
|
-
clone: string;
|
|
11
|
-
update: string;
|
|
12
|
-
new: string;
|
|
13
|
-
back: string;
|
|
14
|
-
next: string;
|
|
15
|
-
save: string;
|
|
16
|
-
import: string;
|
|
17
|
-
cancel: string;
|
|
18
|
-
print: string;
|
|
19
|
-
hide: string;
|
|
20
|
-
no: string;
|
|
21
|
-
action: string;
|
|
22
|
-
remove: string;
|
|
23
|
-
view: string;
|
|
24
|
-
ok: string;
|
|
25
|
-
yes: string;
|
|
26
|
-
warning: string;
|
|
27
|
-
success: string;
|
|
28
|
-
error: string;
|
|
29
|
-
retry: string;
|
|
30
|
-
previous: string;
|
|
31
|
-
unhide: string;
|
|
32
|
-
downloadCsvTemplate: string;
|
|
33
|
-
importCsvFile: string;
|
|
34
|
-
export: string;
|
|
35
|
-
goBack: string;
|
|
36
|
-
refresh: string;
|
|
37
|
-
fileUploadMessage1: string;
|
|
38
|
-
fileUploadMessage2: string;
|
|
39
|
-
rotateLeft: string;
|
|
40
|
-
rotateRight: string;
|
|
41
|
-
flipHorizontal: string;
|
|
42
|
-
flipVertical: string;
|
|
43
|
-
skipCrop: string;
|
|
44
|
-
};
|
|
45
|
-
err: {
|
|
46
|
-
save: string;
|
|
47
|
-
validation: {
|
|
48
|
-
required: string;
|
|
49
|
-
minLength8: string;
|
|
50
|
-
percentage: string;
|
|
51
|
-
maximumValueExceeded: string;
|
|
52
|
-
invalidNic: string;
|
|
53
|
-
invalid: string;
|
|
54
|
-
};
|
|
55
|
-
notFound: string;
|
|
56
|
-
};
|
|
57
|
-
message: {
|
|
58
|
-
loading: {
|
|
59
|
-
saving: string;
|
|
60
|
-
};
|
|
61
|
-
uploadButtonText: string;
|
|
62
|
-
};
|
|
63
|
-
qus: {
|
|
64
|
-
importWithIssues: string;
|
|
65
|
-
doYouWantToDelete: string;
|
|
66
|
-
doYouWantToHide: string;
|
|
67
|
-
doYouWantToUnhide: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
export type LibTranslations = typeof en;
|
|
73
|
-
export interface SetupI18nOptions {
|
|
74
|
-
translations?: Record<string, {
|
|
75
|
-
[TRANSLATION_NAMESPACE]: LibTranslations;
|
|
76
|
-
}>;
|
|
77
|
-
language?: string;
|
|
78
|
-
i18nInstance?: i18nType;
|
|
79
|
-
}
|
|
80
|
-
export declare let i18nInstance: i18nType;
|
|
81
|
-
export declare const setupI18n: (options?: SetupI18nOptions) => i18nType;
|
|
82
|
-
export declare const updateTranslations: (language: string, translations: Record<string, any>, i18nInstance?: i18nType) => void;
|
|
83
|
-
export declare const useTranslationLib: (options?: Omit<UseTranslationOptions<string>, "i18n">) => import('react-i18next').UseTranslationResponse<"crud-component", string>;
|
|
84
|
-
export declare const useTranslationLibNoNS: (options?: Omit<UseTranslationOptions<string>, "i18n">) => import('react-i18next').UseTranslationResponse<"translation", string>;
|
|
85
|
-
export declare const t: (key: string, options?: any) => string | import('node_modules/i18next/typescript/helpers').$SpecialObject | import('i18next').TFunctionDetailedResult<string | import('node_modules/i18next/typescript/helpers').$SpecialObject, any>;
|
|
86
|
-
export declare const tWithOrWithoutNS: (key: string, options?: any, fallback?: string) => string | object;
|