@kingteza/crud-component 1.35.0 → 1.36.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime"),R=require("antd"),n=require("react"),y=require("../appearance/Hider.cjs.js"),H=n.forwardRef(({pages:d,onSubmit:u,initPosition:f=0,type:w,labelPlacement:p,className:x,pageStyle:C,showSteps:k=!0,freeNavigation:S},q)=>{const[t,i]=n.useState(0),[r,m]=n.useState([]);n.useEffect(()=>{i(f)},[f]),n.useImperativeHandle(q,()=>({gotTo:s=>i(s)}),[]);const h=n.useCallback((s,a=!1,l=!1)=>{const e=[...r];if(s!==void 0&&(e[t]=s,m(e)),l||i(t+1),a&&u){let o={};for(const j of e)for(const v in j)o[v]=j[v];u(e,o)}},[t,r,u]),b=n.useCallback(()=>{const s=[...r];s[t]=void 0,m(s),i(t-1)},[t,r]),g=n.useMemo(()=>{let s=[],a=[];const l=d.filter(e=>!e.hidden);for(let e=0;e<l.length;e++){const o=l[e];a.push(c.jsx(y,{hide:t!==e,children:o.component({forward:h,backward:b},r,t===e)},`${o.title}${e}`)),s.push({icon:o.icon,title:o.title,disabled:o.disabled})}return{_pages:a,steps:s}},[b,t,r,h,d]),F=n.useCallback(s=>{i(s)},[]);return c.jsxs(c.Fragment,{children:[k&&c.jsx(R.Steps,{labelPlacement:p,titlePlacement:p,className:[x,"pb-3"].join(" "),current:t,type:w,items:g.steps,onChange:S?F:void 0}),c.jsx("div",{style:C,children:g._pages})]})});module.exports=H;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { StepsProps } from 'antd/lib';
|
|
1
2
|
import { default as React, ReactElement } from 'react';
|
|
2
3
|
interface WizardViewFormProps {
|
|
3
4
|
pages: {
|
|
4
5
|
hidden?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
5
7
|
icon?: React.ReactNode;
|
|
6
8
|
title: string;
|
|
7
9
|
component: (func: {
|
|
@@ -9,13 +11,14 @@ interface WizardViewFormProps {
|
|
|
9
11
|
backward: () => void;
|
|
10
12
|
}, formSubmissionData: any[], isActive: boolean) => ReactElement;
|
|
11
13
|
}[];
|
|
12
|
-
labelPlacement?:
|
|
14
|
+
labelPlacement?: 'vertical' | 'horizontal';
|
|
13
15
|
initPosition?: number;
|
|
14
16
|
onSubmit?: (val: (any | undefined)[], combinedValue: any) => void;
|
|
15
|
-
type?:
|
|
17
|
+
type?: StepsProps['type'];
|
|
16
18
|
className?: string;
|
|
17
|
-
progressDot?: boolean;
|
|
18
19
|
pageStyle?: React.CSSProperties;
|
|
20
|
+
showSteps?: boolean;
|
|
21
|
+
freeNavigation?: boolean;
|
|
19
22
|
}
|
|
20
23
|
export interface WizardViewFormRef {
|
|
21
24
|
gotTo: (index: number) => void;
|
|
@@ -1,74 +1,81 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Steps as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { jsx as a, jsxs as _, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { Steps as z } from "antd";
|
|
3
|
+
import { forwardRef as E, useState as C, useEffect as I, useImperativeHandle as M, useCallback as d, useMemo as N } from "react";
|
|
4
|
+
import R from "../appearance/Hider.es.js";
|
|
5
|
+
const A = E(
|
|
6
6
|
({
|
|
7
|
-
pages:
|
|
7
|
+
pages: f,
|
|
8
8
|
onSubmit: l,
|
|
9
|
-
initPosition:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
C,
|
|
9
|
+
initPosition: m = 0,
|
|
10
|
+
type: S,
|
|
11
|
+
labelPlacement: p,
|
|
12
|
+
className: j,
|
|
13
|
+
pageStyle: k,
|
|
14
|
+
showSteps: x = !0,
|
|
15
|
+
freeNavigation: F
|
|
16
|
+
}, y) => {
|
|
17
|
+
const [s, n] = C(0), [r, u] = C([]);
|
|
18
|
+
I(() => {
|
|
19
|
+
n(m);
|
|
20
|
+
}, [m]), M(
|
|
21
|
+
y,
|
|
23
22
|
() => ({
|
|
24
|
-
gotTo: (
|
|
23
|
+
gotTo: (t) => n(t)
|
|
25
24
|
}),
|
|
26
25
|
[]
|
|
27
26
|
);
|
|
28
|
-
const
|
|
29
|
-
(
|
|
27
|
+
const h = d(
|
|
28
|
+
(t, i = !1, c = !1) => {
|
|
30
29
|
const e = [...r];
|
|
31
|
-
if (
|
|
32
|
-
|
|
30
|
+
if (t !== void 0 && (e[s] = t, u(e)), c || n(s + 1), i && l) {
|
|
31
|
+
let o = {};
|
|
33
32
|
for (const w of e)
|
|
34
|
-
for (const
|
|
35
|
-
o[
|
|
33
|
+
for (const b in w)
|
|
34
|
+
o[b] = w[b];
|
|
36
35
|
l(e, o);
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
|
-
[
|
|
40
|
-
),
|
|
41
|
-
const
|
|
42
|
-
s
|
|
43
|
-
}, [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
c
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
[s, r, l]
|
|
39
|
+
), g = d(() => {
|
|
40
|
+
const t = [...r];
|
|
41
|
+
t[s] = void 0, u(t), n(s - 1);
|
|
42
|
+
}, [s, r]), v = N(() => {
|
|
43
|
+
let t = [], i = [];
|
|
44
|
+
const c = f.filter((e) => !e.hidden);
|
|
45
|
+
for (let e = 0; e < c.length; e++) {
|
|
46
|
+
const o = c[e];
|
|
47
|
+
i.push(
|
|
48
|
+
/* @__PURE__ */ a(R, { hide: s !== e, children: o.component({ forward: h, backward: g }, r, s === e) }, `${o.title}${e}`)
|
|
49
|
+
), t.push({
|
|
50
|
+
icon: o.icon,
|
|
51
|
+
title: o.title,
|
|
52
|
+
disabled: o.disabled
|
|
53
|
+
});
|
|
50
54
|
}
|
|
51
55
|
return {
|
|
52
|
-
_pages:
|
|
53
|
-
steps:
|
|
56
|
+
_pages: i,
|
|
57
|
+
steps: t
|
|
54
58
|
};
|
|
55
|
-
}, [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
}, [g, s, r, h, f]), H = d((t) => {
|
|
60
|
+
n(t);
|
|
61
|
+
}, []);
|
|
62
|
+
return /* @__PURE__ */ _($, { children: [
|
|
63
|
+
x && /* @__PURE__ */ a(
|
|
64
|
+
z,
|
|
59
65
|
{
|
|
60
|
-
labelPlacement:
|
|
61
|
-
|
|
62
|
-
className: [
|
|
63
|
-
current:
|
|
64
|
-
type:
|
|
65
|
-
|
|
66
|
+
labelPlacement: p,
|
|
67
|
+
titlePlacement: p,
|
|
68
|
+
className: [j, "pb-3"].join(" "),
|
|
69
|
+
current: s,
|
|
70
|
+
type: S,
|
|
71
|
+
items: v.steps,
|
|
72
|
+
onChange: F ? H : void 0
|
|
66
73
|
}
|
|
67
74
|
),
|
|
68
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ a("div", { style: k, children: v._pages })
|
|
69
76
|
] });
|
|
70
77
|
}
|
|
71
78
|
);
|
|
72
79
|
export {
|
|
73
|
-
|
|
80
|
+
A as default
|
|
74
81
|
};
|
package/dist/locale/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./hooks/translation-constants.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./hooks/translation-constants.cjs.js"),A=require("./translations/en.cjs.js"),r=require("i18next"),u=require("react-i18next"),l={en:{[a.TRANSLATION_NAMESPACE]:A}};exports.i18nInstance=r;const c=(t={})=>{const{translations:n=l,language:e="en",i18nInstance:i}=t,s=i||r;return exports.i18nInstance=s,s.isInitialized?Object.entries(n).forEach(([o,T])=>{Object.entries(T).forEach(([I,N])=>{s.addResourceBundle(o,I,N,!0,!0)})}):s.use(u.initReactI18next).init({resources:n,lng:e,fallbackLng:"en",ns:a.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),s},d=(t,n,e)=>{(e||r).addResourceBundle(t,a.TRANSLATION_NAMESPACE,n,!0,!0)},S=t=>{const n=exports.i18nInstance||r;return n.isInitialized||c({}),u.useTranslation(a.TRANSLATION_NAMESPACE,{...t,i18n:n})},E=t=>{const n=exports.i18nInstance||r;return n.isInitialized||c({}),u.useTranslation(void 0,{...t,i18n:n})},f=(t,n)=>{var e;return(e=exports.i18nInstance)==null?void 0:e.t(t,{ns:a.TRANSLATION_NAMESPACE,...n})},L=(t,n,e)=>{var s,o;const i=(s=exports.i18nInstance)==null?void 0:s.t(t,n);return i&&t&&i!==t?i:e||((o=exports.i18nInstance)==null?void 0:o.t(t,{ns:void 0,...n}))};exports.defaultTranslations=l;exports.setupI18n=c;exports.t=f;exports.tWithOrWithoutNS=L;exports.updateTranslations=d;exports.useTranslationLib=S;exports.useTranslationLibNoNS=E;
|
package/dist/locale/index.es.js
CHANGED
|
@@ -8,18 +8,18 @@ const N = {
|
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
let e = a;
|
|
11
|
-
const c = (
|
|
11
|
+
const c = (n = {}) => {
|
|
12
12
|
const {
|
|
13
|
-
translations:
|
|
13
|
+
translations: t = N,
|
|
14
14
|
language: i = "en",
|
|
15
15
|
i18nInstance: s
|
|
16
|
-
} =
|
|
17
|
-
return e = r, r.isInitialized ? Object.entries(
|
|
16
|
+
} = n, r = s || a;
|
|
17
|
+
return e = r, r.isInitialized ? Object.entries(t).forEach(([l, d]) => {
|
|
18
18
|
Object.entries(d).forEach(([f, T]) => {
|
|
19
19
|
r.addResourceBundle(l, f, T, !0, !0);
|
|
20
20
|
});
|
|
21
21
|
}) : r.use(p).init({
|
|
22
|
-
resources:
|
|
22
|
+
resources: t,
|
|
23
23
|
lng: i,
|
|
24
24
|
fallbackLng: "en",
|
|
25
25
|
ns: o,
|
|
@@ -27,36 +27,36 @@ const c = (t = {}) => {
|
|
|
27
27
|
escapeValue: !1
|
|
28
28
|
}
|
|
29
29
|
}), r;
|
|
30
|
-
}, E = (
|
|
30
|
+
}, E = (n, t, i) => {
|
|
31
31
|
(i || a).addResourceBundle(
|
|
32
|
-
t,
|
|
33
|
-
o,
|
|
34
32
|
n,
|
|
33
|
+
o,
|
|
34
|
+
t,
|
|
35
35
|
!0,
|
|
36
36
|
!0
|
|
37
37
|
);
|
|
38
|
-
}, L = (
|
|
39
|
-
const
|
|
40
|
-
return
|
|
41
|
-
}, O = (
|
|
42
|
-
const
|
|
43
|
-
return
|
|
44
|
-
},
|
|
38
|
+
}, L = (n) => {
|
|
39
|
+
const t = e || a;
|
|
40
|
+
return t.isInitialized || c({}), u(o, { ...n, i18n: t });
|
|
41
|
+
}, O = (n) => {
|
|
42
|
+
const t = e || a;
|
|
43
|
+
return t.isInitialized || c({}), u(void 0, { ...n, i18n: t });
|
|
44
|
+
}, R = (n, t) => e == null ? void 0 : e.t(n, {
|
|
45
45
|
ns: o,
|
|
46
|
-
...
|
|
47
|
-
}),
|
|
48
|
-
const s =
|
|
49
|
-
return s &&
|
|
46
|
+
...t
|
|
47
|
+
}), S = (n, t, i) => {
|
|
48
|
+
const s = e == null ? void 0 : e.t(n, t);
|
|
49
|
+
return s && n && s !== n ? s : i || (e == null ? void 0 : e.t(n, {
|
|
50
50
|
ns: void 0,
|
|
51
|
-
...
|
|
51
|
+
...t
|
|
52
52
|
}));
|
|
53
53
|
};
|
|
54
54
|
export {
|
|
55
55
|
N as defaultTranslations,
|
|
56
56
|
e as i18nInstance,
|
|
57
57
|
c as setupI18n,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
R as t,
|
|
59
|
+
S as tWithOrWithoutNS,
|
|
60
60
|
E as updateTranslations,
|
|
61
61
|
L as useTranslationLib,
|
|
62
62
|
O as useTranslationLibNoNS
|