@kingteza/crud-component 1.2.4 → 1.2.5
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/App.d.ts +8 -0
- package/dist/common/error/ErrorBoundaryComponent.cjs.js +1 -0
- package/dist/common/error/ErrorBoundaryComponent.d.ts +2 -0
- package/dist/common/error/ErrorBoundaryComponent.es.js +12 -0
- package/dist/crud/view/CrudViewerUtil.cjs.js +1 -1
- package/dist/crud/view/CrudViewerUtil.es.js +55 -52
- package/dist/node_modules/.pnpm/react-error-boundary@6.0.0_react@18.3.1/node_modules/react-error-boundary/dist/react-error-boundary.cjs.js +1 -0
- package/dist/node_modules/.pnpm/react-error-boundary@6.0.0_react@18.3.1/node_modules/react-error-boundary/dist/react-error-boundary.es.js +89 -0
- package/package.json +2 -1
package/dist/App.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare const useWorkShiftCrudComponentProps: () => {
|
|
|
40
40
|
type: string;
|
|
41
41
|
required: boolean;
|
|
42
42
|
hideInTable?: undefined;
|
|
43
|
+
truncated?: undefined;
|
|
43
44
|
format?: undefined;
|
|
44
45
|
use12Hours?: undefined;
|
|
45
46
|
readonly?: undefined;
|
|
@@ -54,6 +55,7 @@ export declare const useWorkShiftCrudComponentProps: () => {
|
|
|
54
55
|
label: string;
|
|
55
56
|
type: string;
|
|
56
57
|
hideInTable: boolean;
|
|
58
|
+
truncated: boolean;
|
|
57
59
|
required?: undefined;
|
|
58
60
|
format?: undefined;
|
|
59
61
|
use12Hours?: undefined;
|
|
@@ -72,6 +74,7 @@ export declare const useWorkShiftCrudComponentProps: () => {
|
|
|
72
74
|
use12Hours: boolean;
|
|
73
75
|
required: boolean;
|
|
74
76
|
hideInTable?: undefined;
|
|
77
|
+
truncated?: undefined;
|
|
75
78
|
readonly?: undefined;
|
|
76
79
|
int?: undefined;
|
|
77
80
|
max?: undefined;
|
|
@@ -88,6 +91,7 @@ export declare const useWorkShiftCrudComponentProps: () => {
|
|
|
88
91
|
readonly: boolean;
|
|
89
92
|
required?: undefined;
|
|
90
93
|
hideInTable?: undefined;
|
|
94
|
+
truncated?: undefined;
|
|
91
95
|
int?: undefined;
|
|
92
96
|
max?: undefined;
|
|
93
97
|
} | {
|
|
@@ -101,6 +105,7 @@ export declare const useWorkShiftCrudComponentProps: () => {
|
|
|
101
105
|
int: boolean;
|
|
102
106
|
required: boolean;
|
|
103
107
|
hideInTable: boolean;
|
|
108
|
+
truncated?: undefined;
|
|
104
109
|
format?: undefined;
|
|
105
110
|
use12Hours?: undefined;
|
|
106
111
|
readonly?: undefined;
|
|
@@ -117,6 +122,7 @@ export declare const useWorkShiftCrudComponentProps: () => {
|
|
|
117
122
|
required: boolean;
|
|
118
123
|
hideInTable: boolean;
|
|
119
124
|
max: number;
|
|
125
|
+
truncated?: undefined;
|
|
120
126
|
format?: undefined;
|
|
121
127
|
use12Hours?: undefined;
|
|
122
128
|
readonly?: undefined;
|
|
@@ -128,6 +134,7 @@ export declare const useWorkShiftCrudComponentProps: () => {
|
|
|
128
134
|
required: boolean;
|
|
129
135
|
grid?: undefined;
|
|
130
136
|
hideInTable?: undefined;
|
|
137
|
+
truncated?: undefined;
|
|
131
138
|
format?: undefined;
|
|
132
139
|
use12Hours?: undefined;
|
|
133
140
|
readonly?: undefined;
|
|
@@ -143,6 +150,7 @@ export declare const useWorkShiftCrudComponentProps: () => {
|
|
|
143
150
|
int: boolean;
|
|
144
151
|
required: boolean;
|
|
145
152
|
hideInTable?: undefined;
|
|
153
|
+
truncated?: undefined;
|
|
146
154
|
format?: undefined;
|
|
147
155
|
use12Hours?: undefined;
|
|
148
156
|
readonly?: undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../../node_modules/.pnpm/react-error-boundary@6.0.0_react@18.3.1/node_modules/react-error-boundary/dist/react-error-boundary.cjs.js");function n({error:r,resetErrorBoundary:s}){return console.error(r),e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:"Something went wrong:"}),e.jsx("pre",{style:{color:"red"},children:r.message})]})}const t=({children:r})=>e.jsx(o.ErrorBoundary,{fallbackRender:n,children:r});exports.ErrorBoundaryComponent=t;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as o, jsxs as e } from "react/jsx-runtime";
|
|
2
|
+
import { ErrorBoundary as n } from "../../node_modules/.pnpm/react-error-boundary@6.0.0_react@18.3.1/node_modules/react-error-boundary/dist/react-error-boundary.es.js";
|
|
3
|
+
function t({ error: r, resetErrorBoundary: l }) {
|
|
4
|
+
return console.error(r), /* @__PURE__ */ e("div", { role: "alert", children: [
|
|
5
|
+
/* @__PURE__ */ o("p", { children: "Something went wrong:" }),
|
|
6
|
+
/* @__PURE__ */ o("pre", { style: { color: "red" }, children: r.message })
|
|
7
|
+
] });
|
|
8
|
+
}
|
|
9
|
+
const c = ({ children: r }) => /* @__PURE__ */ o(n, { fallbackRender: t, children: r });
|
|
10
|
+
export {
|
|
11
|
+
c as ErrorBoundaryComponent
|
|
12
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),b=require("@ant-design/icons"),h=require("antd"),A=require("../../common/show-more/index.cjs.js"),F=require("../FileCrudField.cjs.js"),T=require("../ImageCrudField.cjs.js"),j=require("../../util/DateUtil.cjs.js"),q=require("../../util/NumberUtil.cjs.js"),g=require("../../locale/index.cjs.js"),B=require("../../util/CrudUtil.cjs.js"),m=require("../../common/error/ErrorBoundaryComponent.cjs.js");function R({type:l,render:r,...o}){try{return l==="object"?(t,e,i)=>typeof r=="function"?r(t,e,i):"":l==="select"?(t,e,i)=>{if(!t)return"-";const n=o,a=t||(n.items??[]).find(s=>s[n.innerFieldId??"key"]===e[B.getRealName(o.name,"upsertFieldName")]),f=n.multiple?Array.isArray(a)?a.map(s=>s==null?void 0:s[n.innerFieldLabel??"name"]):void 0:a==null?void 0:a[n.innerFieldLabel??"value"];return typeof r=="function"?r(f,e,i):Array.isArray(f)?f.join(", "):f}:l==="number"?(t,e,i)=>typeof r=="function"?r(t,e,i):o!=null&&o.int?q.default.toInt(t,o.formatted):q.default.toMoney(t):l==="enum"?(t,e,i)=>{var s;if(!t)return"-";const n=o;if(typeof r=="function")return r(t,e,i);if(n.multiple){const c=Array.isArray(t)?t:t?[t]:[];return typeof n.tagRender=="object"?u.jsx(m.ErrorBoundaryComponent,{children:u.jsx(h.Space,{wrap:!0,children:c.map((d,y)=>{var v,S;const x=(v=n.tagRender)==null?void 0:v[d],C=g.tWithOrWithoutNS(((S=n==null?void 0:n.translation)==null?void 0:S[d??""])??d);return x?u.jsx(h.Tag,{color:x.color,children:C},y+d):C})})}):n!=null&&n.translation?u.jsx(m.ErrorBoundaryComponent,{children:c==null?void 0:c.map(d=>{var y;return g.tWithOrWithoutNS(((y=n==null?void 0:n.translation)==null?void 0:y[d??""])??d)}).join(", ")}):c==null?void 0:c.join(", ")}const a=((s=n==null?void 0:n.translation)==null?void 0:s[t??""])??t,f=g.tWithOrWithoutNS(a);if(typeof n.tagRender=="object"){const c=n.tagRender[t];if(c)return u.jsx(h.Tag,{color:c.color,children:f})}return f}:l==="date"?(t,e,i)=>{if(!t)return"-";const n=o!=null&&o.formatTime?j.formatDateTime(t):j.formatDate(t);return u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,e,i):n})}:l==="checkbox"?(t,e,i)=>typeof r=="function"?r(t,e,i):t?u.jsx(b.CheckOutlined,{}):u.jsx(b.CloseOutlined,{}):l==="image"?(t,e,i)=>t?u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,e,i):u.jsx(T.ImageCrudCellValue,{value:t,provider:o.provider})}):"-":l==="file"?(t,e,i)=>t?u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,e,i):u.jsx(F.FileCrudCellValue,{value:t,provider:o.provider})}):"":l==="time"?(t,e,i)=>{if(!t)return"-";const n=o==null?void 0:o.format,a=o==null?void 0:o.use12Hours,f=j.formatTime(t,n||(a?"hh:mm:ss A":void 0));return u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,e,i):f})}:l==="color"?(t,e,i)=>t?typeof r=="function"?r(t,e,i):typeof t=="string"&&t.startsWith("#")?u.jsx(h.Tooltip,{title:t,children:u.jsx(h.Avatar,{style:{backgroundColor:t}})}):String(t):"-":l==="textarea"?(t,e,i)=>{if(!t)return"-";const n=o,a=n.truncated??1;return typeof r=="function"?r(t,e,i):a?u.jsx(m.ErrorBoundaryComponent,{children:u.jsx(A.ShowMore,{lines:a===!0?1:a,children:n.rich?u.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t})}):n.rich?u.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}:typeof r=="function"?r:(t,e,i)=>t}catch(t){return console.warn("An error occurred while rendering the value for field: "+String(o.name),t),"-"}}exports.getRendererValueCrudViewer=R;
|
|
@@ -1,84 +1,87 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { CheckOutlined as
|
|
3
|
-
import { Space as
|
|
4
|
-
import { ShowMore as
|
|
5
|
-
import { FileCrudCellValue as
|
|
6
|
-
import { ImageCrudCellValue as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { CheckOutlined as T, CloseOutlined as F } from "@ant-design/icons";
|
|
3
|
+
import { Space as R, Tag as S, Tooltip as w, Avatar as I } from "antd";
|
|
4
|
+
import { ShowMore as V } from "../../common/show-more/index.es.js";
|
|
5
|
+
import { FileCrudCellValue as k } from "../FileCrudField.es.js";
|
|
6
|
+
import { ImageCrudCellValue as x } from "../ImageCrudField.es.js";
|
|
7
|
+
import y from "../../util/DateUtil.es.js";
|
|
8
|
+
import j from "../../util/NumberUtil.es.js";
|
|
9
9
|
import { tWithOrWithoutNS as g } from "../../locale/index.es.js";
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import H from "../../util/CrudUtil.es.js";
|
|
11
|
+
import { ErrorBoundaryComponent as h } from "../../common/error/ErrorBoundaryComponent.es.js";
|
|
12
|
+
function z({
|
|
13
|
+
type: u,
|
|
13
14
|
render: n,
|
|
14
|
-
...
|
|
15
|
+
...l
|
|
15
16
|
}) {
|
|
16
17
|
try {
|
|
17
|
-
return
|
|
18
|
+
return u === "object" ? (t, o, r) => typeof n == "function" ? n(t, o, r) : "" : u === "select" ? (t, o, r) => {
|
|
18
19
|
if (!t) return "-";
|
|
19
|
-
const i =
|
|
20
|
-
(m) => m[i.innerFieldId ?? "key"] === o[
|
|
21
|
-
),
|
|
22
|
-
return typeof n == "function" ? n(
|
|
23
|
-
} :
|
|
20
|
+
const i = l, a = t || (i.items ?? []).find(
|
|
21
|
+
(m) => m[i.innerFieldId ?? "key"] === o[H.getRealName(l.name, "upsertFieldName")]
|
|
22
|
+
), f = i.multiple ? Array.isArray(a) ? a.map((m) => m == null ? void 0 : m[i.innerFieldLabel ?? "name"]) : void 0 : a == null ? void 0 : a[i.innerFieldLabel ?? "value"];
|
|
23
|
+
return typeof n == "function" ? n(f, o, r) : Array.isArray(f) ? f.join(", ") : f;
|
|
24
|
+
} : u === "number" ? (t, o, r) => typeof n == "function" ? n(t, o, r) : l != null && l.int ? j.toInt(t, l.formatted) : j.toMoney(t) : u === "enum" ? (t, o, r) => {
|
|
24
25
|
var m;
|
|
25
26
|
if (!t) return "-";
|
|
26
|
-
const i =
|
|
27
|
+
const i = l;
|
|
27
28
|
if (typeof n == "function")
|
|
28
29
|
return n(t, o, r);
|
|
29
30
|
if (i.multiple) {
|
|
30
|
-
const
|
|
31
|
-
return typeof i.tagRender == "object" ? /* @__PURE__ */
|
|
31
|
+
const c = Array.isArray(t) ? t : t ? [t] : [];
|
|
32
|
+
return typeof i.tagRender == "object" ? /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(R, { wrap: !0, children: c.map((d, s) => {
|
|
32
33
|
var b, A;
|
|
33
|
-
const
|
|
34
|
-
((A = i == null ? void 0 : i.translation) == null ? void 0 : A[
|
|
34
|
+
const v = (b = i.tagRender) == null ? void 0 : b[d], C = g(
|
|
35
|
+
((A = i == null ? void 0 : i.translation) == null ? void 0 : A[d ?? ""]) ?? d
|
|
35
36
|
);
|
|
36
|
-
return
|
|
37
|
-
}) }) : i != null && i.translation ?
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
return v ? /* @__PURE__ */ e(S, { color: v.color, children: C }, s + d) : C;
|
|
38
|
+
}) }) }) : i != null && i.translation ? /* @__PURE__ */ e(h, { children: c == null ? void 0 : c.map(
|
|
39
|
+
(d) => {
|
|
40
|
+
var s;
|
|
41
|
+
return g(((s = i == null ? void 0 : i.translation) == null ? void 0 : s[d ?? ""]) ?? d);
|
|
42
|
+
}
|
|
43
|
+
).join(", ") }) : c == null ? void 0 : c.join(", ");
|
|
41
44
|
}
|
|
42
|
-
const
|
|
45
|
+
const a = ((m = i == null ? void 0 : i.translation) == null ? void 0 : m[t ?? ""]) ?? t, f = g(a);
|
|
43
46
|
if (typeof i.tagRender == "object") {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
+
const c = i.tagRender[t];
|
|
48
|
+
if (c)
|
|
49
|
+
return /* @__PURE__ */ e(S, { color: c.color, children: f });
|
|
47
50
|
}
|
|
48
|
-
return
|
|
49
|
-
} :
|
|
51
|
+
return f;
|
|
52
|
+
} : u === "date" ? (t, o, r) => {
|
|
50
53
|
if (!t) return "-";
|
|
51
|
-
const i =
|
|
52
|
-
return typeof n == "function" ? n(t, o, r) : i;
|
|
53
|
-
} :
|
|
54
|
-
|
|
54
|
+
const i = l != null && l.formatTime ? y.formatDateTime(t) : y.formatDate(t);
|
|
55
|
+
return /* @__PURE__ */ e(h, { children: typeof n == "function" ? n(t, o, r) : i });
|
|
56
|
+
} : u === "checkbox" ? (t, o, r) => typeof n == "function" ? n(t, o, r) : t ? /* @__PURE__ */ e(T, {}) : /* @__PURE__ */ e(F, {}) : u === "image" ? (t, o, r) => t ? /* @__PURE__ */ e(h, { children: typeof n == "function" ? n(t, o, r) : /* @__PURE__ */ e(
|
|
57
|
+
x,
|
|
55
58
|
{
|
|
56
59
|
value: t,
|
|
57
|
-
provider:
|
|
60
|
+
provider: l.provider
|
|
58
61
|
}
|
|
59
|
-
) : "-" :
|
|
60
|
-
|
|
62
|
+
) }) : "-" : u === "file" ? (t, o, r) => t ? /* @__PURE__ */ e(h, { children: typeof n == "function" ? n(t, o, r) : /* @__PURE__ */ e(
|
|
63
|
+
k,
|
|
61
64
|
{
|
|
62
65
|
value: t,
|
|
63
|
-
provider:
|
|
66
|
+
provider: l.provider
|
|
64
67
|
}
|
|
65
|
-
) : "" :
|
|
68
|
+
) }) : "" : u === "time" ? (t, o, r) => {
|
|
66
69
|
if (!t) return "-";
|
|
67
|
-
const i =
|
|
70
|
+
const i = l == null ? void 0 : l.format, a = l == null ? void 0 : l.use12Hours, f = y.formatTime(
|
|
68
71
|
t,
|
|
69
|
-
i || (
|
|
72
|
+
i || (a ? "hh:mm:ss A" : void 0)
|
|
70
73
|
);
|
|
71
|
-
return typeof n == "function" ? n(t, o, r) :
|
|
72
|
-
} :
|
|
74
|
+
return /* @__PURE__ */ e(h, { children: typeof n == "function" ? n(t, o, r) : f });
|
|
75
|
+
} : u === "color" ? (t, o, r) => t ? typeof n == "function" ? n(t, o, r) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ e(w, { title: t, children: /* @__PURE__ */ e(I, { style: { backgroundColor: t } }) }) : String(t) : "-" : u === "textarea" ? (t, o, r) => {
|
|
73
76
|
if (!t) return "-";
|
|
74
|
-
const i =
|
|
75
|
-
return typeof n == "function" ? n(t, o, r) :
|
|
77
|
+
const i = l, a = i.truncated ?? 1;
|
|
78
|
+
return typeof n == "function" ? n(t, o, r) : a ? /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(V, { lines: a === !0 ? 1 : a, children: i.rich ? /* @__PURE__ */ e(
|
|
76
79
|
"div",
|
|
77
80
|
{
|
|
78
81
|
style: { all: "unset" },
|
|
79
82
|
dangerouslySetInnerHTML: { __html: t }
|
|
80
83
|
}
|
|
81
|
-
) : t }) : i.rich ? /* @__PURE__ */
|
|
84
|
+
) : t }) }) : i.rich ? /* @__PURE__ */ e(
|
|
82
85
|
"div",
|
|
83
86
|
{
|
|
84
87
|
style: { all: "unset" },
|
|
@@ -88,11 +91,11 @@ function q({
|
|
|
88
91
|
} : typeof n == "function" ? n : (t, o, r) => t;
|
|
89
92
|
} catch (t) {
|
|
90
93
|
return console.warn(
|
|
91
|
-
"An error occurred while rendering the value for field: " + String(
|
|
94
|
+
"An error occurred while rendering the value for field: " + String(l.name),
|
|
92
95
|
t
|
|
93
96
|
), "-";
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
export {
|
|
97
|
-
|
|
100
|
+
z as getRendererValueCrudViewer
|
|
98
101
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),c=i.createContext(null),d={didCatch:!1,error:null};class h extends i.Component{constructor(r){super(r),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=d}static getDerivedStateFromError(r){return{didCatch:!0,error:r}}resetErrorBoundary(){const{error:r}=this.state;if(r!==null){for(var t,e,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];(t=(e=this.props).onReset)===null||t===void 0||t.call(e,{args:a,reason:"imperative-api"}),this.setState(d)}}componentDidCatch(r,t){var e,n;(e=(n=this.props).onError)===null||e===void 0||e.call(n,r,t)}componentDidUpdate(r,t){const{didCatch:e}=this.state,{resetKeys:n}=this.props;if(e&&t.error!==null&&m(r.resetKeys,n)){var a,o;(a=(o=this.props).onReset)===null||a===void 0||a.call(o,{next:n,prev:r.resetKeys,reason:"keys"}),this.setState(d)}}render(){const{children:r,fallbackRender:t,FallbackComponent:e,fallback:n}=this.props,{didCatch:a,error:o}=this.state;let s=r;if(a){const u={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof t=="function")s=t(u);else if(e)s=i.createElement(e,u);else if(n!==void 0)s=n;else throw o}return i.createElement(c.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},s)}}function m(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return l.length!==r.length||l.some((t,e)=>!Object.is(t,r[e]))}exports.ErrorBoundary=h;exports.ErrorBoundaryContext=c;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Component as c, createElement as u, createContext as h } from "react";
|
|
2
|
+
const m = h(null), l = {
|
|
3
|
+
didCatch: !1,
|
|
4
|
+
error: null
|
|
5
|
+
};
|
|
6
|
+
class p extends c {
|
|
7
|
+
constructor(r) {
|
|
8
|
+
super(r), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = l;
|
|
9
|
+
}
|
|
10
|
+
static getDerivedStateFromError(r) {
|
|
11
|
+
return {
|
|
12
|
+
didCatch: !0,
|
|
13
|
+
error: r
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
resetErrorBoundary() {
|
|
17
|
+
const {
|
|
18
|
+
error: r
|
|
19
|
+
} = this.state;
|
|
20
|
+
if (r !== null) {
|
|
21
|
+
for (var t, e, n = arguments.length, s = new Array(n), o = 0; o < n; o++)
|
|
22
|
+
s[o] = arguments[o];
|
|
23
|
+
(t = (e = this.props).onReset) === null || t === void 0 || t.call(e, {
|
|
24
|
+
args: s,
|
|
25
|
+
reason: "imperative-api"
|
|
26
|
+
}), this.setState(l);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
componentDidCatch(r, t) {
|
|
30
|
+
var e, n;
|
|
31
|
+
(e = (n = this.props).onError) === null || e === void 0 || e.call(n, r, t);
|
|
32
|
+
}
|
|
33
|
+
componentDidUpdate(r, t) {
|
|
34
|
+
const {
|
|
35
|
+
didCatch: e
|
|
36
|
+
} = this.state, {
|
|
37
|
+
resetKeys: n
|
|
38
|
+
} = this.props;
|
|
39
|
+
if (e && t.error !== null && f(r.resetKeys, n)) {
|
|
40
|
+
var s, o;
|
|
41
|
+
(s = (o = this.props).onReset) === null || s === void 0 || s.call(o, {
|
|
42
|
+
next: n,
|
|
43
|
+
prev: r.resetKeys,
|
|
44
|
+
reason: "keys"
|
|
45
|
+
}), this.setState(l);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const {
|
|
50
|
+
children: r,
|
|
51
|
+
fallbackRender: t,
|
|
52
|
+
FallbackComponent: e,
|
|
53
|
+
fallback: n
|
|
54
|
+
} = this.props, {
|
|
55
|
+
didCatch: s,
|
|
56
|
+
error: o
|
|
57
|
+
} = this.state;
|
|
58
|
+
let a = r;
|
|
59
|
+
if (s) {
|
|
60
|
+
const d = {
|
|
61
|
+
error: o,
|
|
62
|
+
resetErrorBoundary: this.resetErrorBoundary
|
|
63
|
+
};
|
|
64
|
+
if (typeof t == "function")
|
|
65
|
+
a = t(d);
|
|
66
|
+
else if (e)
|
|
67
|
+
a = u(e, d);
|
|
68
|
+
else if (n !== void 0)
|
|
69
|
+
a = n;
|
|
70
|
+
else
|
|
71
|
+
throw o;
|
|
72
|
+
}
|
|
73
|
+
return u(m.Provider, {
|
|
74
|
+
value: {
|
|
75
|
+
didCatch: s,
|
|
76
|
+
error: o,
|
|
77
|
+
resetErrorBoundary: this.resetErrorBoundary
|
|
78
|
+
}
|
|
79
|
+
}, a);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function f() {
|
|
83
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
84
|
+
return i.length !== r.length || i.some((t, e) => !Object.is(t, r[e]));
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
p as ErrorBoundary,
|
|
88
|
+
m as ErrorBoundaryContext
|
|
89
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingteza/crud-component",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.5",
|
|
5
5
|
"description": "React CRUD component library with Ant Design",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"papaparse": "^5.4.1",
|
|
65
65
|
"path-browserify": "^1.0.1",
|
|
66
66
|
"react-advanced-cropper": "^0.20.1",
|
|
67
|
+
"react-error-boundary": "^6.0.0",
|
|
67
68
|
"react-highlight-words": "^0.20.0",
|
|
68
69
|
"react-i18next": "^15.2.0",
|
|
69
70
|
"react-quill": "^2.0.0",
|