@kingteza/crud-component 1.40.1 → 1.42.0
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/_virtual/index.cjs.js +1 -1
- package/dist/_virtual/index.cjs2.js +1 -1
- package/dist/_virtual/index.cjs3.js +1 -1
- package/dist/_virtual/index.es.js +5 -2
- package/dist/_virtual/index.es2.js +5 -5
- package/dist/_virtual/index.es3.js +2 -5
- package/dist/crud/CrudSearchComponent.cjs.js +1 -1
- package/dist/crud/CrudSearchComponent.d.ts +2 -1
- package/dist/crud/CrudSearchComponent.es.js +83 -56
- package/dist/crud/view/CrudEnumCell.cjs.js +1 -0
- package/dist/crud/view/CrudEnumCell.d.ts +6 -0
- package/dist/crud/view/CrudEnumCell.es.js +60 -0
- package/dist/crud/view/CrudViewerUtil.cjs.js +1 -1
- package/dist/crud/view/CrudViewerUtil.es.js +65 -131
- package/dist/crud/view/index.d.ts +2 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +9 -7
- package/dist/node_modules/.pnpm/input-format@0.3.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/input-format/modules/react/Input.cjs.js +1 -1
- package/dist/node_modules/.pnpm/input-format@0.3.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/input-format/modules/react/Input.es.js +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.cjs.js +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.es.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/CountryIcon.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/CountryIcon.es.js +2 -2
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/CountrySelect.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/CountrySelect.es.js +2 -2
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/Flag.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/Flag.es.js +2 -2
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/InputBasic.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/InputBasic.es.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/InputSmart.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/InputSmart.es.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/InternationalIcon.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/InternationalIcon.es.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/PhoneInputWithCountry.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/PhoneInputWithCountry.es.js +2 -2
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/PropTypes.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-phone-number-input@3.4.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-phone-number-input/modules/PropTypes.es.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const e=require("./_commonjsHelpers.cjs.js"),r=require("../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.cjs.js");var s=r.__require();const o=e.getDefaultExportFromCjs(s);module.exports=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const s=require("./_commonjsHelpers.cjs.js"),e=require("../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js");var r=e.__require();const t=s.getDefaultExportFromCjs(r);module.exports=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.es.js";
|
|
2
|
+
import { __require as o } from "../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.es.js";
|
|
3
|
+
var p = /* @__PURE__ */ o();
|
|
4
|
+
const s = /* @__PURE__ */ r(p);
|
|
2
5
|
export {
|
|
3
|
-
|
|
6
|
+
s as default
|
|
4
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getDefaultExportFromCjs as
|
|
2
|
-
import { __require as
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
import { getDefaultExportFromCjs as s } from "./_commonjsHelpers.es.js";
|
|
2
|
+
import { __require as r } from "../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
3
|
+
var a = r();
|
|
4
|
+
const t = /* @__PURE__ */ s(a);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
t as default
|
|
7
7
|
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { __require as r } from "../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
3
|
-
var a = r();
|
|
4
|
-
const t = /* @__PURE__ */ s(a);
|
|
1
|
+
var p = { exports: {} };
|
|
5
2
|
export {
|
|
6
|
-
|
|
3
|
+
p as __module
|
|
7
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),e=require("react"),p=require("@ant-design/icons"),i=require("antd"),N=require("./CrudField.cjs.js"),E=require("../util/CrudUtil.cjs.js"),C=require("../context/CrudSearchContext.cjs.js"),_=require("../common/button/Button.cjs.js");function k({searchFields:t=[],fields:g,searchOnChange:c,onSearch:b,searchDefaultValues:a,searchFieldsCustomColumnProps:d}){const j=e.useMemo(()=>t.map(n=>{if(e.isValidElement(n))return n;if(typeof n=="string"){const l=g.find(m=>n===m.name);return l?{...l,required:!1}:null}const u=g.find(l=>(n==null?void 0:n.name)===l.name);return u?{...u,...n}:null}).filter(n=>e.isValidElement(n)||n&&!(n!=null&&n.hidden)),[t,g]),x=e.useMemo(()=>t.length===1?{field:22,button:2}:t.length===2?{field:11,button:2}:t.length===3?{field:6,button:6}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),s=e.useMemo(()=>t.length===1?{field:22,button:2}:t.length===2?{field:11,button:2}:t.length===3?{field:6,button:6}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),y=e.useMemo(()=>t.length===1?{field:21,button:3}:t.length===2?{field:11,button:2}:t.length===3?{field:24,button:24}:t.length===4?{field:5,button:4}:t.length===5?{field:4,button:4}:{field:4,button:4},[t.length]),[r]=i.Form.useForm(),f=e.useCallback(async n=>{if((n||c)&&b){const u=await r.validateFields();b(u)}},[r,b,c]);return e.useEffect(()=>{a&&(r.setFieldsValue(a),f(!0))},[r,a]),t!=null&&t.length?o.jsx(i.Form,{form:r,onFinish:()=>f(!0),layout:"vertical",className:"mb-2",onChange:()=>f(!1),children:o.jsx(C.CrudSearchContextProvider,{search:()=>f(!1),children:o.jsxs(i.Row,{gutter:[4,8],className:"w-100",children:[j.map((n,u)=>{const l=(d==null?void 0:d[u])??{md:x.field,sm:s.field,xs:y.field};if(e.isValidElement(n))return e.createElement(i.Col,{...l,key:`search_field_element_${u}`,className:"align-self-end"},n);const m=n,q=E.getRealName(m.name);return e.createElement(i.Col,{...l,key:`search_field_${String(q)}`,className:"align-self-end"},o.jsx(N.default,{...m,readonly:!1,fieldClassName:"mb-0"}))}),o.jsx(i.Col,{md:x.button,sm:s.button,xs:y.button,style:{alignSelf:"end"},children:o.jsx(_,{type:"primary",htmlType:"submit",block:!0,icon:o.jsx(p.SearchOutlined,{})})})]})})}):o.jsx(o.Fragment,{})}module.exports=k;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ColProps } from 'antd/lib';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
2
3
|
import { ReadonlyCrudFields } from './CrudComponent';
|
|
3
4
|
export type CrudSearchOption<T> = {
|
|
4
5
|
required?: boolean;
|
|
@@ -28,7 +29,7 @@ export type CrudSearchOption<T> = {
|
|
|
28
29
|
disableToday?: boolean;
|
|
29
30
|
});
|
|
30
31
|
export interface CrudSearchComponentProps<T, FormType> {
|
|
31
|
-
searchFields?: Array<keyof T | CrudSearchOption<T
|
|
32
|
+
searchFields?: Array<keyof T | CrudSearchOption<T> | ReactElement>;
|
|
32
33
|
fields: ReadonlyCrudFields<T>;
|
|
33
34
|
searchOnChange?: boolean;
|
|
34
35
|
searchDefaultValues?: FormType;
|
|
@@ -1,97 +1,124 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsx as f, Fragment as S, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as r, isValidElement as d, useCallback as j, useEffect as C, createElement as k } from "react";
|
|
3
3
|
import { SearchOutlined as R } from "@ant-design/icons";
|
|
4
|
-
import { Form as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { CrudSearchContextProvider as
|
|
8
|
-
import
|
|
9
|
-
function
|
|
4
|
+
import { Form as w, Row as $, Col as a } from "antd";
|
|
5
|
+
import h from "./CrudField.es.js";
|
|
6
|
+
import q from "../util/CrudUtil.es.js";
|
|
7
|
+
import { CrudSearchContextProvider as B } from "../context/CrudSearchContext.es.js";
|
|
8
|
+
import M from "../common/button/Button.es.js";
|
|
9
|
+
function K({
|
|
10
10
|
searchFields: t = [],
|
|
11
11
|
fields: i,
|
|
12
|
-
searchOnChange:
|
|
12
|
+
searchOnChange: y,
|
|
13
13
|
onSearch: g,
|
|
14
14
|
searchDefaultValues: b,
|
|
15
|
-
searchFieldsCustomColumnProps:
|
|
15
|
+
searchFieldsCustomColumnProps: p
|
|
16
16
|
}) {
|
|
17
|
-
const
|
|
18
|
-
() => t.map((n) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
const v = r(
|
|
18
|
+
() => t.map((n) => {
|
|
19
|
+
if (d(n))
|
|
20
|
+
return n;
|
|
21
|
+
if (typeof n == "string") {
|
|
22
|
+
const e = i.find((u) => n === u.name);
|
|
23
|
+
return e ? {
|
|
24
|
+
...e,
|
|
25
|
+
required: !1
|
|
26
|
+
} : null;
|
|
27
|
+
}
|
|
28
|
+
const o = i.find(
|
|
29
|
+
(e) => (n == null ? void 0 : n.name) === e.name
|
|
30
|
+
);
|
|
31
|
+
return o ? {
|
|
32
|
+
...o,
|
|
33
|
+
...n
|
|
34
|
+
} : null;
|
|
35
|
+
}).filter((n) => d(n) || n && !(n != null && n.hidden)),
|
|
27
36
|
[t, i]
|
|
28
|
-
),
|
|
37
|
+
), x = r(
|
|
29
38
|
() => t.length === 1 ? { field: 22, button: 2 } : t.length === 2 ? { field: 11, button: 2 } : t.length === 3 ? { field: 6, button: 6 } : t.length === 4 ? { field: 5, button: 4 } : t.length === 5 ? { field: 4, button: 4 } : { field: 4, button: 4 },
|
|
30
39
|
[t.length]
|
|
31
|
-
),
|
|
40
|
+
), N = r(
|
|
32
41
|
() => t.length === 1 ? { field: 22, button: 2 } : t.length === 2 ? { field: 11, button: 2 } : t.length === 3 ? { field: 6, button: 6 } : t.length === 4 ? { field: 5, button: 4 } : t.length === 5 ? { field: 4, button: 4 } : { field: 4, button: 4 },
|
|
33
42
|
[t.length]
|
|
34
|
-
),
|
|
43
|
+
), _ = r(
|
|
35
44
|
() => t.length === 1 ? { field: 21, button: 3 } : t.length === 2 ? { field: 11, button: 2 } : t.length === 3 ? { field: 24, button: 24 } : t.length === 4 ? { field: 5, button: 4 } : t.length === 5 ? { field: 4, button: 4 } : { field: 4, button: 4 },
|
|
36
45
|
[t.length]
|
|
37
|
-
), [
|
|
46
|
+
), [l] = w.useForm(), m = j(
|
|
38
47
|
async (n) => {
|
|
39
|
-
if ((n ||
|
|
40
|
-
const
|
|
41
|
-
g(
|
|
48
|
+
if ((n || y) && g) {
|
|
49
|
+
const o = await l.validateFields();
|
|
50
|
+
g(o);
|
|
42
51
|
}
|
|
43
52
|
},
|
|
44
|
-
[
|
|
53
|
+
[l, g, y]
|
|
45
54
|
);
|
|
46
55
|
return C(() => {
|
|
47
|
-
b && (
|
|
48
|
-
}, [
|
|
49
|
-
|
|
56
|
+
b && (l.setFieldsValue(b), m(!0));
|
|
57
|
+
}, [l, b]), t != null && t.length ? /* @__PURE__ */ f(
|
|
58
|
+
w,
|
|
50
59
|
{
|
|
51
|
-
form:
|
|
52
|
-
onFinish: () =>
|
|
60
|
+
form: l,
|
|
61
|
+
onFinish: () => m(!0),
|
|
53
62
|
layout: "vertical",
|
|
54
63
|
className: "mb-2",
|
|
55
|
-
onChange: () =>
|
|
56
|
-
children: /* @__PURE__ */
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
md:
|
|
60
|
-
sm:
|
|
61
|
-
xs:
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
onChange: () => m(!1),
|
|
65
|
+
children: /* @__PURE__ */ f(B, { search: () => m(!1), children: /* @__PURE__ */ c($, { gutter: [4, 8], className: "w-100", children: [
|
|
66
|
+
v.map((n, o) => {
|
|
67
|
+
const e = (p == null ? void 0 : p[o]) ?? {
|
|
68
|
+
md: x.field,
|
|
69
|
+
sm: N.field,
|
|
70
|
+
xs: _.field
|
|
71
|
+
};
|
|
72
|
+
if (d(n))
|
|
73
|
+
return /* @__PURE__ */ k(
|
|
74
|
+
a,
|
|
75
|
+
{
|
|
76
|
+
...e,
|
|
77
|
+
key: `search_field_element_${o}`,
|
|
78
|
+
className: "align-self-end"
|
|
79
|
+
},
|
|
80
|
+
n
|
|
81
|
+
);
|
|
82
|
+
const u = n, E = q.getRealName(u.name);
|
|
83
|
+
return /* @__PURE__ */ k(
|
|
84
|
+
a,
|
|
65
85
|
{
|
|
66
|
-
...
|
|
67
|
-
key: `search_field_${String(
|
|
86
|
+
...e,
|
|
87
|
+
key: `search_field_${String(E)}`,
|
|
68
88
|
className: "align-self-end"
|
|
69
89
|
},
|
|
70
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ f(
|
|
91
|
+
h,
|
|
92
|
+
{
|
|
93
|
+
...u,
|
|
94
|
+
readonly: !1,
|
|
95
|
+
fieldClassName: "mb-0"
|
|
96
|
+
}
|
|
97
|
+
)
|
|
71
98
|
);
|
|
72
99
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
100
|
+
/* @__PURE__ */ f(
|
|
101
|
+
a,
|
|
75
102
|
{
|
|
76
|
-
md:
|
|
77
|
-
sm:
|
|
78
|
-
xs:
|
|
103
|
+
md: x.button,
|
|
104
|
+
sm: N.button,
|
|
105
|
+
xs: _.button,
|
|
79
106
|
style: { alignSelf: "end" },
|
|
80
|
-
children: /* @__PURE__ */
|
|
81
|
-
|
|
107
|
+
children: /* @__PURE__ */ f(
|
|
108
|
+
M,
|
|
82
109
|
{
|
|
83
110
|
type: "primary",
|
|
84
111
|
htmlType: "submit",
|
|
85
112
|
block: !0,
|
|
86
|
-
icon: /* @__PURE__ */
|
|
113
|
+
icon: /* @__PURE__ */ f(R, {})
|
|
87
114
|
}
|
|
88
115
|
)
|
|
89
116
|
}
|
|
90
117
|
)
|
|
91
118
|
] }) })
|
|
92
119
|
}
|
|
93
|
-
) : /* @__PURE__ */
|
|
120
|
+
) : /* @__PURE__ */ f(S, {});
|
|
94
121
|
}
|
|
95
122
|
export {
|
|
96
|
-
|
|
123
|
+
K as default
|
|
97
124
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("antd"),j=require("../../locale/index.cjs.js"),h=require("../../common/error/ErrorBoundaryComponent.cjs.js"),s=require("../../util/CopyUtilComponent.cjs.js");function x({field:r,value:p}){var b;if(!p)return"-";if(r.multiple){const t=(Array.isArray(p)?p:p?[p]:[]).map(o=>{var y,i;const n=(y=r.tagRender)==null?void 0:y[o],a=j.tWithOrWithoutNS(((i=r==null?void 0:r.translation)==null?void 0:i[o??""])??o,void 0,o);return{tagProps:n,translatedValue:a,item:o}});if(typeof r.tagRender=="object")return e.jsx(s.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>t.map(({translatedValue:o,item:n})=>o??n).join(", "),children:e.jsx(h.ErrorBoundaryComponent,{children:e.jsx(c.Space,{wrap:!0,children:t.map(({tagProps:o,translatedValue:n,item:a},y)=>o?e.jsx(c.Tag,{color:o.color,children:n},y+a):n)})})});if(r!=null&&r.translation)return e.jsx(s.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:()=>t.map(({translatedValue:o,item:n})=>o??n).join(", "),children:e.jsx(h.ErrorBoundaryComponent,{children:t==null?void 0:t.map(({translatedValue:o,item:n})=>o??n).join(", ")})});{const o=t.map(({translatedValue:n,item:a})=>n??a).join(", ");return e.jsx(c.Typography.Text,{copyable:s.copyableFn(r.copyable,o),children:o})}}const l=((b=r==null?void 0:r.translation)==null?void 0:b[p??""])??p,u=j.tWithOrWithoutNS(l,void 0,p);if(typeof r.tagRender=="object"){const t=r.tagRender[p];if(t)return e.jsx(s.CopyToClipboardButtonWrapper,{copyable:r.copyable,value:u,children:e.jsx(c.Tag,{color:t.color,children:u})})}return e.jsx(c.Typography.Text,{copyable:s.copyableFn(r.copyable,u),children:u})}exports.CrudEnumCell=x;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { Space as x, Tag as h, Typography as u } from "antd";
|
|
3
|
+
import { tWithOrWithoutNS as i } from "../../locale/index.es.js";
|
|
4
|
+
import { ErrorBoundaryComponent as g } from "../../common/error/ErrorBoundaryComponent.es.js";
|
|
5
|
+
import { CopyToClipboardButtonWrapper as m, copyableFn as j } from "../../util/CopyUtilComponent.es.js";
|
|
6
|
+
function B({ field: r, value: p }) {
|
|
7
|
+
var s;
|
|
8
|
+
if (!p) return "-";
|
|
9
|
+
if (r.multiple) {
|
|
10
|
+
const t = (Array.isArray(p) ? p : p ? [p] : []).map(
|
|
11
|
+
(o) => {
|
|
12
|
+
var y, b;
|
|
13
|
+
const n = (y = r.tagRender) == null ? void 0 : y[o], a = i(
|
|
14
|
+
((b = r == null ? void 0 : r.translation) == null ? void 0 : b[o ?? ""]) ?? o,
|
|
15
|
+
void 0,
|
|
16
|
+
o
|
|
17
|
+
);
|
|
18
|
+
return {
|
|
19
|
+
tagProps: n,
|
|
20
|
+
translatedValue: a,
|
|
21
|
+
item: o
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
if (typeof r.tagRender == "object")
|
|
26
|
+
return /* @__PURE__ */ c(
|
|
27
|
+
m,
|
|
28
|
+
{
|
|
29
|
+
copyable: r.copyable,
|
|
30
|
+
value: () => t.map(({ translatedValue: o, item: n }) => o ?? n).join(", "),
|
|
31
|
+
children: /* @__PURE__ */ c(g, { children: /* @__PURE__ */ c(x, { wrap: !0, children: t.map(({ tagProps: o, translatedValue: n, item: a }, y) => o ? /* @__PURE__ */ c(h, { color: o.color, children: n }, y + a) : n) }) })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
if (r != null && r.translation)
|
|
35
|
+
return /* @__PURE__ */ c(
|
|
36
|
+
m,
|
|
37
|
+
{
|
|
38
|
+
copyable: r.copyable,
|
|
39
|
+
value: () => t.map(({ translatedValue: o, item: n }) => o ?? n).join(", "),
|
|
40
|
+
children: /* @__PURE__ */ c(g, { children: t == null ? void 0 : t.map(
|
|
41
|
+
({ translatedValue: o, item: n }) => o ?? n
|
|
42
|
+
).join(", ") })
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
{
|
|
46
|
+
const o = t.map(({ translatedValue: n, item: a }) => n ?? a).join(", ");
|
|
47
|
+
return /* @__PURE__ */ c(u.Text, { copyable: j(r.copyable, o), children: o });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const l = ((s = r == null ? void 0 : r.translation) == null ? void 0 : s[p ?? ""]) ?? p, e = i(l, void 0, p);
|
|
51
|
+
if (typeof r.tagRender == "object") {
|
|
52
|
+
const t = r.tagRender[p];
|
|
53
|
+
if (t)
|
|
54
|
+
return /* @__PURE__ */ c(m, { copyable: r.copyable, value: e, children: /* @__PURE__ */ c(h, { color: t.color, children: e }) });
|
|
55
|
+
}
|
|
56
|
+
return /* @__PURE__ */ c(u.Text, { copyable: j(r.copyable, e), children: e });
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
B as CrudEnumCell
|
|
60
|
+
};
|
|
@@ -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"),b=require("@ant-design/icons"),y=require("antd"),C=require("../FileCrudField.cjs.js"),h=require("../ImageCrudField.cjs.js"),f=require("../../util/DateUtil.cjs.js"),m=require("../../util/NumberUtil.cjs.js"),x=require("../../util/CrudUtil.cjs.js"),d=require("../../common/error/ErrorBoundaryComponent.cjs.js"),u=require("../../util/CopyUtilComponent.cjs.js"),j=require("../../util/ObjectUtil.cjs.js"),v=require("./CrudEnumCell.cjs.js");function g({type:c,render:e,...i}){try{return c==="object"?(o,n,l)=>r.jsx(u.CopyToClipboardButtonWrapper,{copyable:i.copyable,value:o,children:typeof e=="function"?e(o,n,l):""}):c==="select"?(o,n,l)=>{if(!o)return"-";const t=i,a=o||(t.items??[]).find(s=>s[t.innerFieldId??"key"]===j.getValueByPath(n,x.getRealName(i.name,"upsertFieldName"))),p=t.multiple?Array.isArray(a)?a.map(s=>s==null?void 0:s[t.innerFieldLabel??"name"]):void 0:a==null?void 0:a[t.innerFieldLabel??"value"];return r.jsx(y.Typography.Text,{copyable:u.copyableFn(t.copyable,p),children:typeof e=="function"?e(p,n,l):Array.isArray(p)?p.join(", "):p})}:c==="number"?(o,n,l)=>{const t=i;return r.jsx(y.Typography.Text,{copyable:u.copyableFn(t.copyable,o),children:typeof e=="function"?e(o,n,l):t.int?m.default.toInt(o,t.formatted):m.default.toMoney(o)})}:c==="enum"?(o,n,l)=>{const t=i;return typeof e=="function"?o?r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:e(o,n,l)}):"-":r.jsx(v.CrudEnumCell,{field:t,value:o})}:c==="date"?(o,n,l)=>{if(!o)return"-";const t=i,a=t.formatTime?f.formatDateTime(o):f.formatDate(o);return r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:a,children:r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):a})})}:c==="checkbox"?(o,n,l)=>typeof e=="function"?e(o,n,l):o?r.jsx(b.CheckOutlined,{}):r.jsx(b.CloseOutlined,{}):c==="image"?(o,n,l)=>o?r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):r.jsx(h.ImageCrudCellValue,{value:o,provider:i.provider})}):"-":c==="file"?(o,n,l)=>o?r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):r.jsx(C.FileCrudCellValue,{value:o,provider:i.provider})}):"":c==="time"?(o,n,l)=>{if(!o)return"-";const t=i,a=t.format,p=t.use12Hours,s=f.formatTime(o,a||(p?"hh:mm:ss A":void 0));return r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:s,children:r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):s})})}:c==="color"?(o,n,l)=>{const t=i;return o?r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:r.jsx(d.ErrorBoundaryComponent,{children:typeof e=="function"?e(o,n,l):typeof o=="string"&&o.startsWith("#")?r.jsx(y.Tooltip,{title:o,children:r.jsx(y.Avatar,{style:{backgroundColor:o}})}):String(o)})}):"-"}:c==="textarea"?(o,n,l)=>{if(!o)return"-";const t=i,a=t.truncated??1,p=typeof o=="string"&&o.split(" ").length<10;return typeof e=="function"?r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:e(o,n,l)}):a?r.jsx(d.ErrorBoundaryComponent,{children:r.jsx(y.Typography.Paragraph,{ellipsis:!p&&{rows:a===!0?1:a,expandable:"collapsible"},copyable:u.copyableFn(t.copyable,o),children:t.rich?r.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}}):o})}):t.rich?r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:r.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:o}})}):r.jsx(u.CopyToClipboardButtonWrapper,{copyable:t.copyable,value:o,children:o})}:typeof e=="function"?e:(o,n,l)=>{const t=i;return r.jsx(y.Typography.Text,{copyable:u.copyableFn(t.copyable,o),children:o})}}catch(o){return console.warn("An error occurred while rendering the value for field: "+String(i.name),o),"-"}}exports.getRendererValueCrudViewer=g;
|
|
@@ -1,171 +1,105 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { CheckOutlined as
|
|
3
|
-
import { Typography as
|
|
4
|
-
import { FileCrudCellValue as
|
|
5
|
-
import { ImageCrudCellValue as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
function
|
|
14
|
-
type:
|
|
15
|
-
render:
|
|
16
|
-
...
|
|
2
|
+
import { CheckOutlined as d, CloseOutlined as v } from "@ant-design/icons";
|
|
3
|
+
import { Typography as y, Tooltip as g, Avatar as C } from "antd";
|
|
4
|
+
import { FileCrudCellValue as T } from "../FileCrudField.es.js";
|
|
5
|
+
import { ImageCrudCellValue as x } from "../ImageCrudField.es.js";
|
|
6
|
+
import b from "../../util/DateUtil.es.js";
|
|
7
|
+
import h from "../../util/NumberUtil.es.js";
|
|
8
|
+
import A from "../../util/CrudUtil.es.js";
|
|
9
|
+
import { ErrorBoundaryComponent as p } from "../../common/error/ErrorBoundaryComponent.es.js";
|
|
10
|
+
import { CopyToClipboardButtonWrapper as m, copyableFn as s } from "../../util/CopyUtilComponent.es.js";
|
|
11
|
+
import { getValueByPath as F } from "../../util/ObjectUtil.es.js";
|
|
12
|
+
import { CrudEnumCell as S } from "./CrudEnumCell.es.js";
|
|
13
|
+
function M({
|
|
14
|
+
type: c,
|
|
15
|
+
render: l,
|
|
16
|
+
...a
|
|
17
17
|
}) {
|
|
18
18
|
try {
|
|
19
|
-
return
|
|
19
|
+
return c === "object" ? (t, n, i) => /* @__PURE__ */ r(
|
|
20
20
|
m,
|
|
21
21
|
{
|
|
22
|
-
copyable:
|
|
22
|
+
copyable: a.copyable,
|
|
23
23
|
value: t,
|
|
24
|
-
children: typeof
|
|
24
|
+
children: typeof l == "function" ? l(t, n, i) : ""
|
|
25
25
|
}
|
|
26
|
-
) :
|
|
26
|
+
) : c === "select" ? (t, n, i) => {
|
|
27
27
|
if (!t) return "-";
|
|
28
|
-
const o =
|
|
29
|
-
(f) => f[o.innerFieldId ?? "key"] ===
|
|
30
|
-
),
|
|
31
|
-
return /* @__PURE__ */ r(
|
|
32
|
-
} :
|
|
33
|
-
const o =
|
|
34
|
-
return /* @__PURE__ */ r(
|
|
35
|
-
} :
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (typeof e == "function")
|
|
40
|
-
return /* @__PURE__ */ r(
|
|
41
|
-
m,
|
|
42
|
-
{
|
|
43
|
-
copyable: o.copyable,
|
|
44
|
-
value: t,
|
|
45
|
-
children: e(t, l, n)
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
if (o.multiple) {
|
|
49
|
-
const s = (Array.isArray(t) ? t : t ? [t] : []).map((i) => {
|
|
50
|
-
var g, x;
|
|
51
|
-
const p = (g = o.tagRender) == null ? void 0 : g[i], v = A(
|
|
52
|
-
((x = o == null ? void 0 : o.translation) == null ? void 0 : x[i ?? ""]) ?? i,
|
|
53
|
-
void 0,
|
|
54
|
-
i
|
|
55
|
-
);
|
|
56
|
-
return {
|
|
57
|
-
tagProps: p,
|
|
58
|
-
translatedValue: v,
|
|
59
|
-
item: i
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
if (typeof o.tagRender == "object")
|
|
63
|
-
return /* @__PURE__ */ r(
|
|
64
|
-
m,
|
|
65
|
-
{
|
|
66
|
-
copyable: o.copyable,
|
|
67
|
-
value: () => s.map(
|
|
68
|
-
({ translatedValue: i, item: p }) => i ?? p
|
|
69
|
-
).join(", "),
|
|
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) }) })
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
if (o != null && o.translation)
|
|
74
|
-
return /* @__PURE__ */ r(
|
|
75
|
-
m,
|
|
76
|
-
{
|
|
77
|
-
copyable: o.copyable,
|
|
78
|
-
value: () => s.map(
|
|
79
|
-
({ translatedValue: i, item: p }) => i ?? p
|
|
80
|
-
).join(", "),
|
|
81
|
-
children: /* @__PURE__ */ r(b, { children: s == null ? void 0 : s.map(
|
|
82
|
-
({ translatedValue: i, item: p }) => i ?? p
|
|
83
|
-
).join(", ") })
|
|
84
|
-
}
|
|
85
|
-
);
|
|
28
|
+
const o = a, e = t || (o.items ?? []).find(
|
|
29
|
+
(f) => f[o.innerFieldId ?? "key"] === F(n, A.getRealName(a.name, "upsertFieldName"))
|
|
30
|
+
), u = o.multiple ? Array.isArray(e) ? e.map((f) => f == null ? void 0 : f[o.innerFieldLabel ?? "name"]) : void 0 : e == null ? void 0 : e[o.innerFieldLabel ?? "value"];
|
|
31
|
+
return /* @__PURE__ */ r(y.Text, { copyable: s(o.copyable, u), children: typeof l == "function" ? l(u, n, i) : Array.isArray(u) ? u.join(", ") : u });
|
|
32
|
+
} : c === "number" ? (t, n, i) => {
|
|
33
|
+
const o = a;
|
|
34
|
+
return /* @__PURE__ */ r(y.Text, { copyable: s(o.copyable, t), children: typeof l == "function" ? l(t, n, i) : o.int ? h.toInt(t, o.formatted) : h.toMoney(t) });
|
|
35
|
+
} : c === "enum" ? (t, n, i) => {
|
|
36
|
+
const o = a;
|
|
37
|
+
return typeof l == "function" ? t ? /* @__PURE__ */ r(
|
|
38
|
+
m,
|
|
86
39
|
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
copyable: d(o.copyable, i),
|
|
92
|
-
children: i
|
|
93
|
-
}
|
|
94
|
-
);
|
|
40
|
+
copyable: o.copyable,
|
|
41
|
+
value: t,
|
|
42
|
+
children: l(t, n, i)
|
|
95
43
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (typeof o.tagRender == "object") {
|
|
99
|
-
const s = o.tagRender[t];
|
|
100
|
-
if (s)
|
|
101
|
-
return /* @__PURE__ */ r(
|
|
102
|
-
m,
|
|
103
|
-
{
|
|
104
|
-
copyable: o.copyable,
|
|
105
|
-
value: c,
|
|
106
|
-
children: /* @__PURE__ */ r(C, { color: s.color, children: c })
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, c), children: c });
|
|
111
|
-
} : y === "date" ? (t, l, n) => {
|
|
44
|
+
) : "-" : /* @__PURE__ */ r(S, { field: o, value: t });
|
|
45
|
+
} : c === "date" ? (t, n, i) => {
|
|
112
46
|
if (!t) return "-";
|
|
113
|
-
const o =
|
|
47
|
+
const o = a, e = o.formatTime ? b.formatDateTime(t) : b.formatDate(t);
|
|
114
48
|
return /* @__PURE__ */ r(
|
|
115
49
|
m,
|
|
116
50
|
{
|
|
117
51
|
copyable: o.copyable,
|
|
118
|
-
value:
|
|
119
|
-
children: /* @__PURE__ */ r(
|
|
52
|
+
value: e,
|
|
53
|
+
children: /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : e })
|
|
120
54
|
}
|
|
121
55
|
);
|
|
122
|
-
} :
|
|
123
|
-
|
|
56
|
+
} : c === "checkbox" ? (t, n, i) => typeof l == "function" ? l(t, n, i) : t ? /* @__PURE__ */ r(d, {}) : /* @__PURE__ */ r(v, {}) : c === "image" ? (t, n, i) => t ? /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : /* @__PURE__ */ r(
|
|
57
|
+
x,
|
|
124
58
|
{
|
|
125
59
|
value: t,
|
|
126
|
-
provider:
|
|
60
|
+
provider: a.provider
|
|
127
61
|
}
|
|
128
|
-
) }) : "-" :
|
|
129
|
-
|
|
62
|
+
) }) : "-" : c === "file" ? (t, n, i) => t ? /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : /* @__PURE__ */ r(
|
|
63
|
+
T,
|
|
130
64
|
{
|
|
131
65
|
value: t,
|
|
132
|
-
provider:
|
|
66
|
+
provider: a.provider
|
|
133
67
|
}
|
|
134
|
-
) }) : "" :
|
|
68
|
+
) }) : "" : c === "time" ? (t, n, i) => {
|
|
135
69
|
if (!t) return "-";
|
|
136
|
-
const o =
|
|
70
|
+
const o = a, e = o.format, u = o.use12Hours, f = b.formatTime(
|
|
137
71
|
t,
|
|
138
|
-
|
|
72
|
+
e || (u ? "hh:mm:ss A" : void 0)
|
|
139
73
|
);
|
|
140
74
|
return /* @__PURE__ */ r(
|
|
141
75
|
m,
|
|
142
76
|
{
|
|
143
77
|
copyable: o.copyable,
|
|
144
78
|
value: f,
|
|
145
|
-
children: /* @__PURE__ */ r(
|
|
79
|
+
children: /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : f })
|
|
146
80
|
}
|
|
147
81
|
);
|
|
148
|
-
} :
|
|
149
|
-
const o =
|
|
150
|
-
return t ? /* @__PURE__ */ r(m, { copyable: o.copyable, value: t, children: /* @__PURE__ */ r(
|
|
151
|
-
} :
|
|
82
|
+
} : c === "color" ? (t, n, i) => {
|
|
83
|
+
const o = a;
|
|
84
|
+
return t ? /* @__PURE__ */ r(m, { copyable: o.copyable, value: t, children: /* @__PURE__ */ r(p, { children: typeof l == "function" ? l(t, n, i) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ r(g, { title: t, children: /* @__PURE__ */ r(C, { style: { backgroundColor: t } }) }) : String(t) }) }) : "-";
|
|
85
|
+
} : c === "textarea" ? (t, n, i) => {
|
|
152
86
|
if (!t) return "-";
|
|
153
|
-
const o =
|
|
154
|
-
return typeof
|
|
87
|
+
const o = a, e = o.truncated ?? 1, u = typeof t == "string" && t.split(" ").length < 10;
|
|
88
|
+
return typeof l == "function" ? /* @__PURE__ */ r(
|
|
155
89
|
m,
|
|
156
90
|
{
|
|
157
91
|
copyable: o.copyable,
|
|
158
92
|
value: t,
|
|
159
|
-
children:
|
|
93
|
+
children: l(t, n, i)
|
|
160
94
|
}
|
|
161
|
-
) :
|
|
162
|
-
|
|
95
|
+
) : e ? /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r(
|
|
96
|
+
y.Paragraph,
|
|
163
97
|
{
|
|
164
|
-
ellipsis: !
|
|
165
|
-
rows:
|
|
98
|
+
ellipsis: !u && {
|
|
99
|
+
rows: e === !0 ? 1 : e,
|
|
166
100
|
expandable: "collapsible"
|
|
167
101
|
},
|
|
168
|
-
copyable:
|
|
102
|
+
copyable: s(o.copyable, t),
|
|
169
103
|
children: o.rich ? /* @__PURE__ */ r(
|
|
170
104
|
"div",
|
|
171
105
|
{
|
|
@@ -195,17 +129,17 @@ function J({
|
|
|
195
129
|
children: t
|
|
196
130
|
}
|
|
197
131
|
);
|
|
198
|
-
} : typeof
|
|
199
|
-
const o =
|
|
200
|
-
return /* @__PURE__ */ r(
|
|
132
|
+
} : typeof l == "function" ? l : (t, n, i) => {
|
|
133
|
+
const o = a;
|
|
134
|
+
return /* @__PURE__ */ r(y.Text, { copyable: s(o.copyable, t), children: t });
|
|
201
135
|
};
|
|
202
136
|
} catch (t) {
|
|
203
137
|
return console.warn(
|
|
204
|
-
"An error occurred while rendering the value for field: " + String(
|
|
138
|
+
"An error occurred while rendering the value for field: " + String(a.name),
|
|
205
139
|
t
|
|
206
140
|
), "-";
|
|
207
141
|
}
|
|
208
142
|
}
|
|
209
143
|
export {
|
|
210
|
-
|
|
144
|
+
M as getRendererValueCrudViewer
|
|
211
145
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { CrudDecListView } from './CrudDecListView';
|
|
2
2
|
export type { CrudDecListViewProps, DescListColumn } from './CrudDecListView';
|
|
3
|
+
export { CrudEnumCell } from './CrudEnumCell';
|
|
4
|
+
export type { CrudEnumCellProps } from './CrudEnumCell';
|
|
3
5
|
export { default as CrudViewer } from './CrudViewer';
|
|
4
6
|
export type { CrudViewerProps } from './CrudViewer';
|
|
5
7
|
export { getRendererValueCrudViewer } from './CrudViewerUtil';
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const C=require("./locale/hooks/translation-constants.cjs.js"),u=require("./locale/index.cjs.js"),n=require("./crud/CrudComponent.cjs.js"),r=require("./crud/CrudField.cjs.js"),i=require("./crud/CrudFormWizard.cjs.js"),t=require("./crud/CrudReportComponent.cjs.js"),l=require("./crud/CrudSearchComponent.cjs.js"),e=require("./crud/ImageCrudField.cjs.js"),o=require("./crud/FileCrudField.cjs.js"),a=require("./crud/FileCrudDragNDropField.cjs.js"),m=require("./crud/CrudTextAreaComponent.cjs.js"),s=require("./crud/import/CrudImportComponent.cjs.js"),F=require("./crud/import/CrudImportButton.cjs.js"),p=require("./crud/actions/index.cjs.js"),c=require("./crud/view/CrudViewer.cjs.js"),q=require("./context/CrudComponentProvider.cjs.js"),d=require("./crud/CrudForm.cjs.js"),V=require("./crud/modal/index.cjs.js"),I=require("./crud/view/CrudDecListView.cjs.js"),g=require("./crud/view/CrudEnumCell.cjs.js"),A=require("./crud/view/CrudViewerUtil.cjs.js");exports.TRANSLATION_NAMESPACE=C.TRANSLATION_NAMESPACE;exports.setupI18n=u.setupI18n;exports.updateTranslations=u.updateTranslations;exports.CrudComponent=n;exports.ColorCrudFieldComponent=r.ColorCrudFieldComponent;exports.CrudField=r.default;exports.SelectCrudFieldComponent=r.SelectCrudFieldComponent;exports.CrudFormWizard=i;exports.CrudReportComponent=t;exports.CrudSearchComponent=l;exports.FileDownloadProvider=e.FileDownloadProvider;exports.FileUploadProvider=e.FileUploadProvider;exports.ImageCellValue=e.ImageCellValue;exports.ImageCrudCellValue=e.ImageCrudCellValue;exports.ImageCrudField=e.default;exports.FileCellValue=o.FileCellValue;exports.FileCrudCellValue=o.FileCrudCellValue;exports.FileCrudField=o.default;exports.FileCrudDragNDropField=a;exports.CrudTextAreaComponent=m;exports.CrudImportComponent=s;exports.CrudImportButton=F;exports.CrudActions=p.default;exports.CrudViewer=c;exports.CrudComponentProvider=q.CrudComponentProvider;exports.CrudForm=d.CrudForm;exports.CrudFormFields=d.CrudFormFields;exports.CrudModal=V;exports.CrudDecListView=I.CrudDecListView;exports.CrudEnumCell=g.CrudEnumCell;exports.getRendererValueCrudViewer=A.getRendererValueCrudViewer;
|
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
import { TRANSLATION_NAMESPACE as t } from "./locale/hooks/translation-constants.es.js";
|
|
3
|
-
import { setupI18n as
|
|
3
|
+
import { setupI18n as l, updateTranslations as u } from "./locale/index.es.js";
|
|
4
4
|
import { default as m } from "./crud/CrudComponent.es.js";
|
|
5
5
|
import { ColorCrudFieldComponent as p, default as f, SelectCrudFieldComponent as i } from "./crud/CrudField.es.js";
|
|
6
6
|
import { default as x } from "./crud/CrudFormWizard.es.js";
|
|
@@ -8,7 +8,7 @@ import { default as F } from "./crud/CrudReportComponent.es.js";
|
|
|
8
8
|
import { default as I } from "./crud/CrudSearchComponent.es.js";
|
|
9
9
|
import { FileDownloadProvider as g, FileUploadProvider as c, ImageCellValue as w, ImageCrudCellValue as D, default as N } from "./crud/ImageCrudField.es.js";
|
|
10
10
|
import { FileCellValue as S, FileCrudCellValue as T, default as v } from "./crud/FileCrudField.es.js";
|
|
11
|
-
import { default as
|
|
11
|
+
import { default as R } from "./crud/FileCrudDragNDropField.es.js";
|
|
12
12
|
import { default as M } from "./crud/CrudTextAreaComponent.es.js";
|
|
13
13
|
import { default as z } from "./crud/import/CrudImportComponent.es.js";
|
|
14
14
|
import { default as O } from "./crud/import/CrudImportButton.es.js";
|
|
@@ -18,13 +18,15 @@ import { CrudComponentProvider as k } from "./context/CrudComponentProvider.es.j
|
|
|
18
18
|
import { CrudForm as y, CrudFormFields as G } from "./crud/CrudForm.es.js";
|
|
19
19
|
import { default as J } from "./crud/modal/index.es.js";
|
|
20
20
|
import { CrudDecListView as Q } from "./crud/view/CrudDecListView.es.js";
|
|
21
|
-
import {
|
|
21
|
+
import { CrudEnumCell as Y } from "./crud/view/CrudEnumCell.es.js";
|
|
22
|
+
import { getRendererValueCrudViewer as $ } from "./crud/view/CrudViewerUtil.es.js";
|
|
22
23
|
export {
|
|
23
24
|
p as ColorCrudFieldComponent,
|
|
24
25
|
W as CrudActions,
|
|
25
26
|
m as CrudComponent,
|
|
26
27
|
k as CrudComponentProvider,
|
|
27
28
|
Q as CrudDecListView,
|
|
29
|
+
Y as CrudEnumCell,
|
|
28
30
|
f as CrudField,
|
|
29
31
|
y as CrudForm,
|
|
30
32
|
G as CrudFormFields,
|
|
@@ -38,7 +40,7 @@ export {
|
|
|
38
40
|
b as CrudViewer,
|
|
39
41
|
S as FileCellValue,
|
|
40
42
|
T as FileCrudCellValue,
|
|
41
|
-
|
|
43
|
+
R as FileCrudDragNDropField,
|
|
42
44
|
v as FileCrudField,
|
|
43
45
|
g as FileDownloadProvider,
|
|
44
46
|
c as FileUploadProvider,
|
|
@@ -47,7 +49,7 @@ export {
|
|
|
47
49
|
N as ImageCrudField,
|
|
48
50
|
i as SelectCrudFieldComponent,
|
|
49
51
|
t as TRANSLATION_NAMESPACE,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
$ as getRendererValueCrudViewer,
|
|
53
|
+
l as setupI18n,
|
|
54
|
+
u as updateTranslations
|
|
53
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react"),u=require("../../../../../../../_virtual/index.
|
|
1
|
+
"use strict";const c=require("react"),u=require("../../../../../../../_virtual/index.cjs.js"),m=require("./useInput.cjs.js");var w=["inputComponent","parse","format","value","defaultValue","onChange","controlled","onKeyDown","type"];function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function P(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?l(Object(t),!0).forEach(function(n){j(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function j(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e,r){if(e==null)return{};var t=C(e,r),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function C(e,r){if(e==null)return{};var t={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(r.indexOf(o)>=0)&&(t[o]=e[o]);return t}function i(e,r){var t=e.inputComponent,n=t===void 0?"input":t,o=e.parse,a=e.format,f=e.value,s=e.defaultValue,y=e.onChange,O=e.controlled,d=e.onKeyDown,p=e.type,g=p===void 0?"text":p,b=h(e,w),v=m(P({ref:r,parse:o,format:a,value:f,defaultValue:s,onChange:y,controlled:O,onKeyDown:d,type:g},b));return c.createElement(n,v)}i=c.forwardRef(i);i.propTypes={parse:u.func.isRequired,format:u.func.isRequired,inputComponent:u.elementType,type:u.string,value:u.string,defaultValue:u.string,onChange:u.func,controlled:u.bool,onKeyDown:u.func,onCut:u.func,onPaste:u.func};module.exports=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import f from "react";
|
|
2
|
-
import u from "../../../../../../../_virtual/index.
|
|
2
|
+
import u from "../../../../../../../_virtual/index.es.js";
|
|
3
3
|
import v from "./useInput.es.js";
|
|
4
4
|
var P = ["inputComponent", "parse", "format", "value", "defaultValue", "onChange", "controlled", "onKeyDown", "type"];
|
|
5
5
|
function l(e, r) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../../_virtual/index.cjs3.js"),t=require("../../../react-is@16.13.1/node_modules/react-is/index.cjs.js"),u=require("./factoryWithTypeCheckers.cjs.js"),s=require("./factoryWithThrowingShims.cjs.js");var r;function _(){if(r)return e.__module.exports;if(r=1,process.env.NODE_ENV!=="production"){var o=t.__require(),i=!0;e.__module.exports=u.__require()(o.isElement,i)}else e.__module.exports=s.__require()();return e.__module.exports}exports.__require=_;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as r } from "../../../../../_virtual/index.
|
|
1
|
+
import { __module as r } from "../../../../../_virtual/index.es3.js";
|
|
2
2
|
import { __require as s } from "../../../react-is@16.13.1/node_modules/react-is/index.es.js";
|
|
3
3
|
import { __require as t } from "./factoryWithTypeCheckers.es.js";
|
|
4
4
|
import { __require as p } from "./factoryWithThrowingShims.es.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),u=require("../../../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),u=require("../../../../../../_virtual/index.cjs.js"),b=require("../../../../../../_virtual/index.cjs2.js"),y=require("./InternationalIcon.cjs.js"),v=require("./Flag.cjs.js");var h=["country","label","aspectRatio"];function s(){return s=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s.apply(this,arguments)}function d(t,o){if(t==null)return{};var r=C(t,o),n,e;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(e=0;e<a.length;e++)n=a[e],!(o.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function C(t,o){if(t==null)return{};var r={},n=Object.keys(t),e,a;for(a=0;a<n.length;a++)e=n[a],!(o.indexOf(e)>=0)&&(r[e]=t[e]);return r}function f(t){var o=t.flags,r=t.flagUrl,n=t.flagComponent,e=t.internationalIcon;function a(i){var c=i.country,p=i.label,m=i.aspectRatio,I=d(i,h),g=e===y?m:void 0;return l.createElement("div",s({},I,{className:b("PhoneInputCountryIcon",{"PhoneInputCountryIcon--square":g===1,"PhoneInputCountryIcon--border":c})}),c?l.createElement(n,{country:c,countryName:p,flags:o,flagUrl:r,className:"PhoneInputCountryIconImg"}):l.createElement(e,{title:p,aspectRatio:g,className:"PhoneInputCountryIconImg"}))}return a.propTypes={country:u.string,label:u.string.isRequired,aspectRatio:u.number},a}f({flagUrl:"https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg",flagComponent:v,internationalIcon:y});exports.createCountryIconComponent=f;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import c from "react";
|
|
2
|
-
import p from "../../../../../../_virtual/index.
|
|
3
|
-
import I from "../../../../../../_virtual/index.
|
|
2
|
+
import p from "../../../../../../_virtual/index.es.js";
|
|
3
|
+
import I from "../../../../../../_virtual/index.es2.js";
|
|
4
4
|
import f from "./InternationalIcon.es.js";
|
|
5
5
|
import b from "./Flag.es.js";
|
|
6
6
|
var h = ["country", "label", "aspectRatio"];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react"),i=require("../../../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react"),i=require("../../../../../../_virtual/index.cjs.js"),C=require("../../../../../../_virtual/index.cjs2.js"),O=require("../../../../country-flag-icons@1.6.12/node_modules/country-flag-icons/modules/unicode.cjs.js");var I=["value","onChange","options","disabled","readOnly"],S=["value","options","className","iconComponent","getIconAspectRatio","arrowComponent","unicodeFlags"];function j(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=w(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(e,t){if(e){if(typeof e=="string")return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}}function y(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}function m(e,t){if(e==null)return{};var n=A(e,t),r,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function A(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function v(e){var t=e.value,n=e.onChange,r=e.options,o=e.disabled,a=e.readOnly,f=m(e,I),s=l.useCallback(function(c){var u=c.target.value;n(u==="ZZ"?void 0:u)},[n]);return l.useMemo(function(){return g(r,t)},[r,t]),l.createElement("select",p({},f,{disabled:o||a,readOnly:a,value:t||"ZZ",onChange:s}),r.map(function(c){var u=c.value,h=c.label,d=c.divider;return l.createElement("option",{key:d?"|":u||"ZZ",value:d?"|":u||"ZZ",disabled:!!d,style:d?E:void 0},h)}))}v.propTypes={value:i.string,onChange:i.func.isRequired,options:i.arrayOf(i.shape({value:i.string,label:i.string,divider:i.bool})).isRequired,disabled:i.bool,readOnly:i.bool};var E={fontSize:"1px",backgroundColor:"currentColor",color:"inherit"};function b(e){var t=e.value,n=e.options,r=e.className,o=e.iconComponent;e.getIconAspectRatio;var a=e.arrowComponent,f=a===void 0?P:a,s=e.unicodeFlags,c=m(e,S),u=l.useMemo(function(){return g(n,t)},[n,t]);return l.createElement("div",{className:"PhoneInputCountry"},l.createElement(v,p({},c,{value:t,options:n,className:C("PhoneInputCountrySelect",r)})),u&&(s&&t?l.createElement("div",{className:"PhoneInputCountryIconUnicode"},O(t)):l.createElement(o,{"aria-hidden":!0,country:t,label:u.label,aspectRatio:s?1:void 0})),l.createElement(f,null))}b.propTypes={iconComponent:i.elementType,arrowComponent:i.elementType,unicodeFlags:i.bool};function P(){return l.createElement("div",{className:"PhoneInputCountrySelectArrow"})}function g(e,t){for(var n=j(e),r;!(r=n()).done;){var o=r.value;if(!o.divider&&T(o.value,t))return o}}function T(e,t){return e==null?t==null:e===t}exports.CountrySelectWithIcon=b;exports.default=v;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import u, { useMemo as v, useCallback as C } from "react";
|
|
2
|
-
import i from "../../../../../../_virtual/index.
|
|
3
|
-
import O from "../../../../../../_virtual/index.
|
|
2
|
+
import i from "../../../../../../_virtual/index.es.js";
|
|
3
|
+
import O from "../../../../../../_virtual/index.es2.js";
|
|
4
4
|
import I from "../../../../country-flag-icons@1.6.12/node_modules/country-flag-icons/modules/unicode.es.js";
|
|
5
5
|
var S = ["value", "onChange", "options", "disabled", "readOnly"], w = ["value", "options", "className", "iconComponent", "getIconAspectRatio", "arrowComponent", "unicodeFlags"];
|
|
6
6
|
function A(e, n) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react"),o=require("../../../../../../_virtual/index.
|
|
1
|
+
"use strict";const s=require("react"),o=require("../../../../../../_virtual/index.cjs.js");require("../../../../../../_virtual/index.cjs2.js");var c=["country","countryName","flags","flagUrl"];function l(){return l=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},l.apply(this,arguments)}function f(t,r){if(t==null)return{};var n=g(t,r),e,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)e=a[i],!(r.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}function g(t,r){if(t==null)return{};var n={},e=Object.keys(t),i,a;for(a=0;a<e.length;a++)i=e[a],!(r.indexOf(i)>=0)&&(n[i]=t[i]);return n}function u(t){var r=t.country,n=t.countryName,e=t.flags,i=t.flagUrl,a=f(t,c);return e&&e[r]?e[r]({title:n}):s.createElement("img",l({},a,{alt:n,role:n?void 0:"presentation",src:i.replace("{XX}",r).replace("{xx}",r.toLowerCase())}))}u.propTypes={country:o.string.isRequired,countryName:o.string.isRequired,flags:o.objectOf(o.elementType),flagUrl:o.string.isRequired};module.exports=u;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import u from "react";
|
|
2
|
-
import i from "../../../../../../_virtual/index.
|
|
3
|
-
import "../../../../../../_virtual/index.
|
|
2
|
+
import i from "../../../../../../_virtual/index.es.js";
|
|
3
|
+
import "../../../../../../_virtual/index.es2.js";
|
|
4
4
|
var f = ["country", "countryName", "flags", "flagUrl"];
|
|
5
5
|
function l() {
|
|
6
6
|
return l = Object.assign ? Object.assign.bind() : function(t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react"),i=require("../../../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react"),i=require("../../../../../../_virtual/index.cjs.js"),O=require("./helpers/inputValuePrefix.cjs.js"),P=require("./useInputKeyDownHandler.cjs.js"),T=require("../../../../libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.cjs.js"),j=require("../../../../libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.cjs.js");var F=["value","onChange","onKeyDown","country","inputFormat","metadata","inputComponent","international","withCountryCallingCode"];function s(){return s=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},s.apply(this,arguments)}function R(t,r){if(t==null)return{};var e=q(t,r),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o<a.length;o++)n=a[o],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(e[n]=t[n])}return e}function q(t,r){if(t==null)return{};var e={},n=Object.keys(t),o,a;for(a=0;a<n.length;a++)o=n[a],!(r.indexOf(o)>=0)&&(e[o]=t[o]);return e}function b(t){function r(e,n){var o=e.value,a=e.onChange,h=e.onKeyDown,l=e.country,f=e.inputFormat,v=e.metadata,p=v===void 0?t:v,d=e.inputComponent,N=d===void 0?"input":d;e.international,e.withCountryCallingCode;var I=R(e,F),c=O.getPrefixForFormattingValueAsPhoneNumber({inputFormat:f,country:l,metadata:p}),C=m.useCallback(function(g){var u=T.default(g.target.value);if(u===o){var A=y(c,u,l,p);A.indexOf(g.target.value)===0&&(u=u.slice(0,-1))}a(u)},[c,o,a,l,p]),w=P({onKeyDown:h,inputFormat:f});return m.createElement(N,s({},I,{ref:n,value:y(c,o,l,p),onChange:C,onKeyDown:w}))}return r=m.forwardRef(r),r.propTypes={value:i.string.isRequired,onChange:i.func.isRequired,onKeyDown:i.func,country:i.string,inputFormat:i.oneOf(["INTERNATIONAL","NATIONAL_PART_OF_INTERNATIONAL","NATIONAL","INTERNATIONAL_OR_NATIONAL"]).isRequired,metadata:i.object,inputComponent:i.elementType},r}const x=b();function y(t,r,e,n){return O.removePrefixFromFormattedPhoneNumber(j(t+r,e,n),t)}exports.createInput=b;exports.default=x;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import g, { useCallback as w } from "react";
|
|
2
|
-
import i from "../../../../../../_virtual/index.
|
|
2
|
+
import i from "../../../../../../_virtual/index.es.js";
|
|
3
3
|
import { getPrefixForFormattingValueAsPhoneNumber as A, removePrefixFromFormattedPhoneNumber as P } from "./helpers/inputValuePrefix.es.js";
|
|
4
4
|
import T from "./useInputKeyDownHandler.es.js";
|
|
5
5
|
import F from "../../../../libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.es.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react"),i=require("../../../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react"),i=require("../../../../../../_virtual/index.cjs.js"),s=require("./helpers/inputValuePrefix.cjs.js"),h=require("./helpers/parsePhoneNumberCharacter.cjs.js"),w=require("./useInputKeyDownHandler.cjs.js"),A=require("../../../../libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/AsYouType.cjs.js"),P=require("../../../../input-format@0.3.14_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/input-format/modules/react/Input.cjs.js");var T=["onKeyDown","country","inputFormat","metadata","international","withCountryCallingCode"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},f.apply(this,arguments)}function F(e,n){if(e==null)return{};var t=j(e,n),r,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)r=o[a],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}function j(e,n){if(e==null)return{};var t={},r=Object.keys(e),a,o;for(o=0;o<r.length;o++)a=r[o],!(n.indexOf(a)>=0)&&(t[a]=e[a]);return t}function O(e){function n(t,r){var a=t.onKeyDown,o=t.country,y=t.inputFormat,d=t.metadata,p=d===void 0?e:d;t.international,t.withCountryCallingCode;var g=F(t,T),b=l.useCallback(function(I){var v=new A(o,p),u=s.getPrefixForFormattingValueAsPhoneNumber({inputFormat:y,country:o,metadata:p}),c=v.input(u+I),m=v.getTemplate();return u&&(c=s.removePrefixFromFormattedPhoneNumber(c,u),m&&(m=s.removePrefixFromFormattedPhoneNumber(m,u))),{text:c,template:m}},[o,p]),N=w({onKeyDown:a,inputFormat:y});return l.createElement(P,f({},g,{ref:r,parse:h,format:b,onKeyDown:N}))}return n=l.forwardRef(n),n.propTypes={value:i.string.isRequired,onChange:i.func.isRequired,onKeyDown:i.func,country:i.string,inputFormat:i.oneOf(["INTERNATIONAL","NATIONAL_PART_OF_INTERNATIONAL","NATIONAL","INTERNATIONAL_OR_NATIONAL"]).isRequired,metadata:i.object},n}const x=O();exports.createInput=O;exports.default=x;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import v, { useCallback as w } from "react";
|
|
2
|
-
import i from "../../../../../../_virtual/index.
|
|
2
|
+
import i from "../../../../../../_virtual/index.es.js";
|
|
3
3
|
import { getPrefixForFormattingValueAsPhoneNumber as A, removePrefixFromFormattedPhoneNumber as O } from "./helpers/inputValuePrefix.es.js";
|
|
4
4
|
import I from "./helpers/parsePhoneNumberCharacter.es.js";
|
|
5
5
|
import h from "./useInputKeyDownHandler.es.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react"),c=require("../../../../../../_virtual/index.
|
|
1
|
+
"use strict";const e=require("react"),c=require("../../../../../../_virtual/index.cjs.js");var d=["aspectRatio"],h=["title"],E=["title"];function i(){return i=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},i.apply(this,arguments)}function s(t,r){if(t==null)return{};var n=f(t,r),a,l;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(l=0;l<o.length;l++)a=o[l],!(r.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}function f(t,r){if(t==null)return{};var n={},a=Object.keys(t),l,o;for(o=0;o<a.length;o++)l=a[o],!(r.indexOf(l)>=0)&&(n[l]=t[l]);return n}function p(t){var r=t.aspectRatio,n=s(t,d);return r===1?e.createElement(m,n):e.createElement(u,n)}p.propTypes={title:c.string.isRequired,aspectRatio:c.number};function u(t){var r=t.title,n=s(t,h);return e.createElement("svg",i({},n,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 75 50"}),e.createElement("title",null,r),e.createElement("g",{className:"PhoneInputInternationalIconGlobe",stroke:"currentColor",fill:"none",strokeWidth:"2",strokeMiterlimit:"10"},e.createElement("path",{strokeLinecap:"round",d:"M47.2,36.1C48.1,36,49,36,50,36c7.4,0,14,1.7,18.5,4.3"}),e.createElement("path",{d:"M68.6,9.6C64.2,12.3,57.5,14,50,14c-7.4,0-14-1.7-18.5-4.3"}),e.createElement("line",{x1:"26",y1:"25",x2:"74",y2:"25"}),e.createElement("line",{x1:"50",y1:"1",x2:"50",y2:"49"}),e.createElement("path",{strokeLinecap:"round",d:"M46.3,48.7c1.2,0.2,2.5,0.3,3.7,0.3c13.3,0,24-10.7,24-24S63.3,1,50,1S26,11.7,26,25c0,2,0.3,3.9,0.7,5.8"}),e.createElement("path",{strokeLinecap:"round",d:"M46.8,48.2c1,0.6,2.1,0.8,3.2,0.8c6.6,0,12-10.7,12-24S56.6,1,50,1S38,11.7,38,25c0,1.4,0.1,2.7,0.2,4c0,0.1,0,0.2,0,0.2"})),e.createElement("path",{className:"PhoneInputInternationalIconPhone",stroke:"none",fill:"currentColor",d:"M12.4,17.9c2.9-2.9,5.4-4.8,0.3-11.2S4.1,5.2,1.3,8.1C-2,11.4,1.1,23.5,13.1,35.6s24.3,15.2,27.5,11.9c2.8-2.8,7.8-6.3,1.4-11.5s-8.3-2.6-11.2,0.3c-2,2-7.2-2.2-11.7-6.7S10.4,19.9,12.4,17.9z"}))}u.propTypes={title:c.string.isRequired};function m(t){var r=t.title,n=s(t,E);return e.createElement("svg",i({},n,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 50 50"}),e.createElement("title",null,r),e.createElement("g",{className:"PhoneInputInternationalIconGlobe",stroke:"currentColor",fill:"none",strokeWidth:"2",strokeLinecap:"round"},e.createElement("path",{d:"M8.45,13A21.44,21.44,0,1,1,37.08,41.56"}),e.createElement("path",{d:"M19.36,35.47a36.9,36.9,0,0,1-2.28-13.24C17.08,10.39,21.88.85,27.8.85s10.72,9.54,10.72,21.38c0,6.48-1.44,12.28-3.71,16.21"}),e.createElement("path",{d:"M17.41,33.4A39,39,0,0,1,27.8,32.06c6.62,0,12.55,1.5,16.48,3.86"}),e.createElement("path",{d:"M44.29,8.53c-3.93,2.37-9.86,3.88-16.49,3.88S15.25,10.9,11.31,8.54"}),e.createElement("line",{x1:"27.8",y1:"0.85",x2:"27.8",y2:"34.61"}),e.createElement("line",{x1:"15.2",y1:"22.23",x2:"49.15",y2:"22.23"})),e.createElement("path",{className:"PhoneInputInternationalIconPhone",stroke:"transparent",fill:"currentColor",d:"M9.42,26.64c2.22-2.22,4.15-3.59.22-8.49S3.08,17,.93,19.17c-2.49,2.48-.13,11.74,9,20.89s18.41,11.5,20.89,9c2.15-2.15,5.91-4.77,1-8.71s-6.27-2-8.49.22c-1.55,1.55-5.48-1.69-8.86-5.08S7.87,28.19,9.42,26.64Z"}))}m.propTypes={title:c.string.isRequired};module.exports=p;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "react";
|
|
2
|
-
import i from "../../../../../../_virtual/index.
|
|
2
|
+
import i from "../../../../../../_virtual/index.es.js";
|
|
3
3
|
var m = ["aspectRatio"], d = ["title"], h = ["title"];
|
|
4
4
|
function c() {
|
|
5
5
|
return c = Object.assign ? Object.assign.bind() : function(t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const P=require("react"),i=require("../../../../../../_virtual/index.cjs2.js"),$=require("../../../../../../_virtual/index.cjs3.js"),tt=require("./InputSmart.cjs.js"),et=require("./InputBasic.cjs.js"),nt=require("./CountrySelect.cjs.js"),ot=require("./Flag.cjs.js"),rt=require("./InternationalIcon.cjs.js"),it=require("./helpers/isE164Number.cjs.js"),B=require("./helpers/countries.cjs.js"),at=require("./CountryIcon.cjs.js"),ut=require("./useExternalRef.cjs.js"),W=require("./PropTypes.cjs.js"),b=require("./helpers/phoneInputHelpers.cjs.js"),lt=require("./helpers/getPhoneInputWithCountryStateUpdateFromNewProps.cjs.js"),k=require("../../../../libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/getCountries.cjs.js");var st=["name","disabled","readOnly","autoComplete","style","className","inputRef","inputComponent","numberInputProps","smartCaret","countrySelectComponent","countrySelectProps","containerComponent","containerComponentProps","defaultCountry","countries","countryOptionsOrder","labels","flags","flagComponent","flagUrl","addInternationalOption","internationalIcon","displayInitialValueAsLocalNumber","initialValueFormat","onCountryChange","limitMaxLength","countryCallingCodeEditable","focusInputOnCountrySelection","reset","metadata","international","locales"];function w(n){"@babel/helpers - typeof";return w=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(n)}function K(n,e){var o=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),o.push.apply(o,t)}return o}function H(n){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};e%2?K(Object(o),!0).forEach(function(t){p(n,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):K(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function F(){return F=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(n[t]=o[t])}return n},F.apply(this,arguments)}function ct(n,e){if(n==null)return{};var o=pt(n,e),t,r;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(r=0;r<a.length;r++)t=a[r],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(n,t)&&(o[t]=n[t])}return o}function pt(n,e){if(n==null)return{};var o={},t=Object.keys(n),r,a;for(a=0;a<t.length;a++)r=t[a],!(e.indexOf(r)>=0)&&(o[r]=n[r]);return o}function yt(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function X(n,e){for(var o=0;o<e.length;o++){var t=e[o];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,J(t.key),t)}}function ft(n,e,o){return e&&X(n.prototype,e),o&&X(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n}function dt(n,e,o){return e=T(e),mt(n,G()?Reflect.construct(e,o||[],T(n).constructor):e.apply(n,o))}function mt(n,e){if(e&&(w(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ct(n)}function Ct(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function G(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(G=function(){return!!n})()}function T(n){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},T(n)}function gt(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&U(n,e)}function U(n,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},U(n,e)}function p(n,e,o){return e=J(e),e in n?Object.defineProperty(n,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[e]=o,n}function J(n){var e=ht(n,"string");return w(e)=="symbol"?e:e+""}function ht(n,e){if(w(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var t=o.call(n,e);if(w(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var bt=(function(n){function e(o){var t;yt(this,e),t=dt(this,e,[o]),p(t,"setInputRef",function(l){ut.setRefsValue([t.props.inputRef,t.inputRef],l)}),p(t,"isCountrySupportedWithError",function(l){var u=t.props.metadata;return B.isCountrySupportedWithError(l,u)}),p(t,"onCountryChange",function(l){var u=t.props,c=u.international,d=u.metadata,N=u.onChange,h=u.focusInputOnCountrySelection,v=t.state,j=v.phoneDigits,D=v.country,m=b.getPhoneDigitsForNewCountry(j,{prevCountry:D,newCountry:l,metadata:d,useNationalFormat:!c}),S=b.e164(m,l,d);h&&t.inputRef.current.focus(),t.setState({country:l,latestCountrySelectedByUser:l,hasUserSelectedACountry:!0,phoneDigits:m,value:S},function(){N(S)})}),p(t,"onChange",function(l){var u=t.props,c=u.defaultCountry,d=u.onChange,N=u.addInternationalOption,h=u.international,v=u.limitMaxLength,j=u.countryCallingCodeEditable,D=u.metadata,m=t.state,S=m.countries,A=m.phoneDigits,Y=m.country,L=m.latestCountrySelectedByUser,M=b.onPhoneDigitsChange(l,{prevPhoneDigits:A,country:Y,countryRequired:!N,defaultCountry:c,latestCountrySelectedByUser:L,getAnyCountry:function(){return t.getFirstSupportedCountry({countries:S})},countries:S,international:h,limitMaxLength:v,countryCallingCodeEditable:j,metadata:D}),V=M.phoneDigits,Z=M.country,R=M.value,x={phoneDigits:V,value:R,country:Z};L&&R&&!b.couldNumberBelongToCountry(R,L,D)&&(x.latestCountrySelectedByUser=void 0),j===!1&&!R&&V===t.state.phoneDigits&&(x.forceRerender={}),t.setState(x,function(){return d(R)})}),p(t,"_onFocus",function(){return t.setState({isFocused:!0})}),p(t,"_onBlur",function(){return t.setState({isFocused:!1})}),p(t,"onFocus",function(l){t._onFocus();var u=t.props.onFocus;u&&u(l)}),p(t,"onBlur",function(l){var u=t.props.onBlur;t._onBlur(),u&&u(l)}),p(t,"onCountryFocus",function(l){t._onFocus();var u=t.props.countrySelectProps;if(u){var c=u.onFocus;c&&c(l)}}),p(t,"onCountryBlur",function(l){t._onBlur();var u=t.props.countrySelectProps;if(u){var c=u.onBlur;c&&c(l)}}),t.inputRef=P.createRef();var r=t.props,a=r.value;r.labels;var y=r.international,E=r.addInternationalOption,I=r.displayInitialValueAsLocalNumber,_=r.initialValueFormat,f=r.metadata,C=t.props,s=C.defaultCountry,O=C.countries;s&&(t.isCountrySupportedWithError(s)||(s=void 0)),a&&it.validateE164Number(a),O=B.getSupportedCountries(O,f);var g=b.parsePhoneNumber(a,f);t.CountryIcon=at.createCountryIconComponent(t.props);var q=b.getPreSelectedCountry({value:a,phoneNumber:g,defaultCountry:s,required:!E,countries:O||k(f),getAnyCountry:function(){return t.getFirstSupportedCountry({countries:O})},metadata:f});return t.state={props:t.props,country:q,countries:O,phoneDigits:b.getInitialPhoneDigits({value:a,phoneNumber:g,defaultCountry:s,international:y,useNationalFormat:I||_==="national",metadata:f}),value:a},t}return gt(e,n),ft(e,[{key:"componentDidMount",value:function(){var t=this.props.onCountryChange,r=this.props.defaultCountry,a=this.state.country;t&&(r&&(this.isCountrySupportedWithError(r)||(r=void 0)),a!==r&&t(a))}},{key:"componentDidUpdate",value:function(t,r){var a=this.props.onCountryChange,y=this.state.country;a&&y!==r.country&&a(y)}},{key:"getCountrySelectOptions",value:function(t){var r=t.countries,a=this.props,y=a.international,E=a.countryCallingCodeEditable,I=a.countryOptionsOrder,_=a.addInternationalOption,f=a.labels,C=a.locales,s=a.metadata;return this.useMemoCountrySelectOptions(function(){return B.sortCountryOptions(b.getCountrySelectOptions({countries:r||k(s),countryNames:f,addInternationalOption:y&&E===!1?!1:_,compareStringsLocales:C}),B.getSupportedCountryOptions(I,s))},[r,I,_,f,s])}},{key:"useMemoCountrySelectOptions",value:function(t,r){return(!this.countrySelectOptionsMemoDependencies||!vt(r,this.countrySelectOptionsMemoDependencies))&&(this.countrySelectOptionsMemo=t(),this.countrySelectOptionsMemoDependencies=r),this.countrySelectOptionsMemo}},{key:"getFirstSupportedCountry",value:function(t){var r=t.countries,a=this.getCountrySelectOptions({countries:r});return a[0].value}},{key:"render",value:function(){var t=this.props,r=t.name,a=t.disabled,y=t.readOnly,E=t.autoComplete,I=t.style,_=t.className;t.inputRef;var f=t.inputComponent,C=t.numberInputProps,s=t.smartCaret,O=t.countrySelectComponent,g=t.countrySelectProps,q=t.containerComponent,l=t.containerComponentProps;t.defaultCountry,t.countries,t.countryOptionsOrder;var u=t.labels;t.flags,t.flagComponent,t.flagUrl,t.addInternationalOption,t.internationalIcon,t.displayInitialValueAsLocalNumber,t.initialValueFormat,t.onCountryChange,t.limitMaxLength,t.countryCallingCodeEditable,t.focusInputOnCountrySelection,t.reset;var c=t.metadata,d=t.international;t.locales;var N=ct(t,st),h=this.state,v=h.country,j=h.countries,D=h.phoneDigits,m=h.isFocused,S=s?tt.default:et.default,A=this.getCountrySelectOptions({countries:j});return P.createElement(q,F({style:I,className:$(_,"PhoneInput",{"PhoneInput--focus":m,"PhoneInput--disabled":a,"PhoneInput--readOnly":y})},l),P.createElement(O,F({name:r?"".concat(r,"Country"):void 0,"aria-label":u.country},g,{value:v,options:A,onChange:this.onCountryChange,onFocus:this.onCountryFocus,onBlur:this.onCountryBlur,disabled:a||g&&g.disabled,readOnly:y||g&&g.readOnly,iconComponent:this.CountryIcon})),P.createElement(S,F({ref:this.setInputRef,type:"tel",autoComplete:E},C,N,{inputFormat:d===!0?"INTERNATIONAL":d===!1?"NATIONAL":"INTERNATIONAL_OR_NATIONAL",international:d?!0:void 0,withCountryCallingCode:d?!0:void 0,name:r,metadata:c,country:v,value:D||"",onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,disabled:a,readOnly:y,inputComponent:f,className:$("PhoneInputInput",C&&C.className,N.className)})))}}],[{key:"getDerivedStateFromProps",value:function(t,r){return H({props:t},lt.default(t,r.props,r))}}])})(P.PureComponent),Q=P.forwardRef(function(n,e){return P.createElement(bt,F({},Ot(n),{inputRef:e}))});Q.propTypes={value:i.string,onChange:i.func.isRequired,onFocus:i.func,onBlur:i.func,disabled:i.bool,readOnly:i.bool,autoComplete:i.string,initialValueFormat:i.oneOf(["national"]),displayInitialValueAsLocalNumber:i.bool,defaultCountry:i.string,countries:i.arrayOf(i.string),labels:W.labels,locales:i.oneOfType([i.string,i.arrayOf(i.string)]),flagUrl:i.string,flags:i.objectOf(i.elementType),flagComponent:i.elementType,addInternationalOption:i.bool,internationalIcon:i.elementType,countryOptionsOrder:i.arrayOf(i.string),style:i.object,className:i.string,countrySelectComponent:i.elementType,countrySelectProps:i.object,inputComponent:i.elementType,numberInputProps:i.object,containerComponent:i.elementType,containerComponentProps:i.object,smartCaret:i.bool,international:i.bool,limitMaxLength:i.bool,countryCallingCodeEditable:i.bool,metadata:W.metadata,onCountryChange:i.func,focusInputOnCountrySelection:i.bool};var z={autoComplete:"tel",countrySelectComponent:nt.CountrySelectWithIcon,flagComponent:ot,flagUrl:"https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg",internationalIcon:rt,inputComponent:"input",containerComponent:"div",reset:i.any,smartCaret:!0,addInternationalOption:!0,countryCallingCodeEditable:!0,focusInputOnCountrySelection:!0};function Ot(n){n=H({},n);for(var e in z)n[e]===void 0&&(n[e]=z[e]);return n}function vt(n,e){if(n.length!==e.length)return!1;for(var o=0;o<n.length;){if(n[o]!==e[o])return!1;o++}return!0}module.exports=Q;
|
|
1
|
+
"use strict";const P=require("react"),i=require("../../../../../../_virtual/index.cjs.js"),$=require("../../../../../../_virtual/index.cjs2.js"),tt=require("./InputSmart.cjs.js"),et=require("./InputBasic.cjs.js"),nt=require("./CountrySelect.cjs.js"),ot=require("./Flag.cjs.js"),rt=require("./InternationalIcon.cjs.js"),it=require("./helpers/isE164Number.cjs.js"),B=require("./helpers/countries.cjs.js"),at=require("./CountryIcon.cjs.js"),ut=require("./useExternalRef.cjs.js"),W=require("./PropTypes.cjs.js"),b=require("./helpers/phoneInputHelpers.cjs.js"),lt=require("./helpers/getPhoneInputWithCountryStateUpdateFromNewProps.cjs.js"),k=require("../../../../libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/getCountries.cjs.js");var st=["name","disabled","readOnly","autoComplete","style","className","inputRef","inputComponent","numberInputProps","smartCaret","countrySelectComponent","countrySelectProps","containerComponent","containerComponentProps","defaultCountry","countries","countryOptionsOrder","labels","flags","flagComponent","flagUrl","addInternationalOption","internationalIcon","displayInitialValueAsLocalNumber","initialValueFormat","onCountryChange","limitMaxLength","countryCallingCodeEditable","focusInputOnCountrySelection","reset","metadata","international","locales"];function w(n){"@babel/helpers - typeof";return w=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(n)}function K(n,e){var o=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),o.push.apply(o,t)}return o}function H(n){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};e%2?K(Object(o),!0).forEach(function(t){p(n,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):K(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function F(){return F=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(n[t]=o[t])}return n},F.apply(this,arguments)}function ct(n,e){if(n==null)return{};var o=pt(n,e),t,r;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(r=0;r<a.length;r++)t=a[r],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(n,t)&&(o[t]=n[t])}return o}function pt(n,e){if(n==null)return{};var o={},t=Object.keys(n),r,a;for(a=0;a<t.length;a++)r=t[a],!(e.indexOf(r)>=0)&&(o[r]=n[r]);return o}function yt(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function X(n,e){for(var o=0;o<e.length;o++){var t=e[o];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,J(t.key),t)}}function ft(n,e,o){return e&&X(n.prototype,e),o&&X(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n}function dt(n,e,o){return e=T(e),mt(n,G()?Reflect.construct(e,o||[],T(n).constructor):e.apply(n,o))}function mt(n,e){if(e&&(w(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ct(n)}function Ct(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function G(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(G=function(){return!!n})()}function T(n){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},T(n)}function gt(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&U(n,e)}function U(n,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},U(n,e)}function p(n,e,o){return e=J(e),e in n?Object.defineProperty(n,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[e]=o,n}function J(n){var e=ht(n,"string");return w(e)=="symbol"?e:e+""}function ht(n,e){if(w(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var t=o.call(n,e);if(w(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var bt=(function(n){function e(o){var t;yt(this,e),t=dt(this,e,[o]),p(t,"setInputRef",function(l){ut.setRefsValue([t.props.inputRef,t.inputRef],l)}),p(t,"isCountrySupportedWithError",function(l){var u=t.props.metadata;return B.isCountrySupportedWithError(l,u)}),p(t,"onCountryChange",function(l){var u=t.props,c=u.international,d=u.metadata,N=u.onChange,h=u.focusInputOnCountrySelection,v=t.state,j=v.phoneDigits,D=v.country,m=b.getPhoneDigitsForNewCountry(j,{prevCountry:D,newCountry:l,metadata:d,useNationalFormat:!c}),S=b.e164(m,l,d);h&&t.inputRef.current.focus(),t.setState({country:l,latestCountrySelectedByUser:l,hasUserSelectedACountry:!0,phoneDigits:m,value:S},function(){N(S)})}),p(t,"onChange",function(l){var u=t.props,c=u.defaultCountry,d=u.onChange,N=u.addInternationalOption,h=u.international,v=u.limitMaxLength,j=u.countryCallingCodeEditable,D=u.metadata,m=t.state,S=m.countries,A=m.phoneDigits,Y=m.country,L=m.latestCountrySelectedByUser,M=b.onPhoneDigitsChange(l,{prevPhoneDigits:A,country:Y,countryRequired:!N,defaultCountry:c,latestCountrySelectedByUser:L,getAnyCountry:function(){return t.getFirstSupportedCountry({countries:S})},countries:S,international:h,limitMaxLength:v,countryCallingCodeEditable:j,metadata:D}),V=M.phoneDigits,Z=M.country,R=M.value,x={phoneDigits:V,value:R,country:Z};L&&R&&!b.couldNumberBelongToCountry(R,L,D)&&(x.latestCountrySelectedByUser=void 0),j===!1&&!R&&V===t.state.phoneDigits&&(x.forceRerender={}),t.setState(x,function(){return d(R)})}),p(t,"_onFocus",function(){return t.setState({isFocused:!0})}),p(t,"_onBlur",function(){return t.setState({isFocused:!1})}),p(t,"onFocus",function(l){t._onFocus();var u=t.props.onFocus;u&&u(l)}),p(t,"onBlur",function(l){var u=t.props.onBlur;t._onBlur(),u&&u(l)}),p(t,"onCountryFocus",function(l){t._onFocus();var u=t.props.countrySelectProps;if(u){var c=u.onFocus;c&&c(l)}}),p(t,"onCountryBlur",function(l){t._onBlur();var u=t.props.countrySelectProps;if(u){var c=u.onBlur;c&&c(l)}}),t.inputRef=P.createRef();var r=t.props,a=r.value;r.labels;var y=r.international,E=r.addInternationalOption,I=r.displayInitialValueAsLocalNumber,_=r.initialValueFormat,f=r.metadata,C=t.props,s=C.defaultCountry,O=C.countries;s&&(t.isCountrySupportedWithError(s)||(s=void 0)),a&&it.validateE164Number(a),O=B.getSupportedCountries(O,f);var g=b.parsePhoneNumber(a,f);t.CountryIcon=at.createCountryIconComponent(t.props);var q=b.getPreSelectedCountry({value:a,phoneNumber:g,defaultCountry:s,required:!E,countries:O||k(f),getAnyCountry:function(){return t.getFirstSupportedCountry({countries:O})},metadata:f});return t.state={props:t.props,country:q,countries:O,phoneDigits:b.getInitialPhoneDigits({value:a,phoneNumber:g,defaultCountry:s,international:y,useNationalFormat:I||_==="national",metadata:f}),value:a},t}return gt(e,n),ft(e,[{key:"componentDidMount",value:function(){var t=this.props.onCountryChange,r=this.props.defaultCountry,a=this.state.country;t&&(r&&(this.isCountrySupportedWithError(r)||(r=void 0)),a!==r&&t(a))}},{key:"componentDidUpdate",value:function(t,r){var a=this.props.onCountryChange,y=this.state.country;a&&y!==r.country&&a(y)}},{key:"getCountrySelectOptions",value:function(t){var r=t.countries,a=this.props,y=a.international,E=a.countryCallingCodeEditable,I=a.countryOptionsOrder,_=a.addInternationalOption,f=a.labels,C=a.locales,s=a.metadata;return this.useMemoCountrySelectOptions(function(){return B.sortCountryOptions(b.getCountrySelectOptions({countries:r||k(s),countryNames:f,addInternationalOption:y&&E===!1?!1:_,compareStringsLocales:C}),B.getSupportedCountryOptions(I,s))},[r,I,_,f,s])}},{key:"useMemoCountrySelectOptions",value:function(t,r){return(!this.countrySelectOptionsMemoDependencies||!vt(r,this.countrySelectOptionsMemoDependencies))&&(this.countrySelectOptionsMemo=t(),this.countrySelectOptionsMemoDependencies=r),this.countrySelectOptionsMemo}},{key:"getFirstSupportedCountry",value:function(t){var r=t.countries,a=this.getCountrySelectOptions({countries:r});return a[0].value}},{key:"render",value:function(){var t=this.props,r=t.name,a=t.disabled,y=t.readOnly,E=t.autoComplete,I=t.style,_=t.className;t.inputRef;var f=t.inputComponent,C=t.numberInputProps,s=t.smartCaret,O=t.countrySelectComponent,g=t.countrySelectProps,q=t.containerComponent,l=t.containerComponentProps;t.defaultCountry,t.countries,t.countryOptionsOrder;var u=t.labels;t.flags,t.flagComponent,t.flagUrl,t.addInternationalOption,t.internationalIcon,t.displayInitialValueAsLocalNumber,t.initialValueFormat,t.onCountryChange,t.limitMaxLength,t.countryCallingCodeEditable,t.focusInputOnCountrySelection,t.reset;var c=t.metadata,d=t.international;t.locales;var N=ct(t,st),h=this.state,v=h.country,j=h.countries,D=h.phoneDigits,m=h.isFocused,S=s?tt.default:et.default,A=this.getCountrySelectOptions({countries:j});return P.createElement(q,F({style:I,className:$(_,"PhoneInput",{"PhoneInput--focus":m,"PhoneInput--disabled":a,"PhoneInput--readOnly":y})},l),P.createElement(O,F({name:r?"".concat(r,"Country"):void 0,"aria-label":u.country},g,{value:v,options:A,onChange:this.onCountryChange,onFocus:this.onCountryFocus,onBlur:this.onCountryBlur,disabled:a||g&&g.disabled,readOnly:y||g&&g.readOnly,iconComponent:this.CountryIcon})),P.createElement(S,F({ref:this.setInputRef,type:"tel",autoComplete:E},C,N,{inputFormat:d===!0?"INTERNATIONAL":d===!1?"NATIONAL":"INTERNATIONAL_OR_NATIONAL",international:d?!0:void 0,withCountryCallingCode:d?!0:void 0,name:r,metadata:c,country:v,value:D||"",onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,disabled:a,readOnly:y,inputComponent:f,className:$("PhoneInputInput",C&&C.className,N.className)})))}}],[{key:"getDerivedStateFromProps",value:function(t,r){return H({props:t},lt.default(t,r.props,r))}}])})(P.PureComponent),Q=P.forwardRef(function(n,e){return P.createElement(bt,F({},Ot(n),{inputRef:e}))});Q.propTypes={value:i.string,onChange:i.func.isRequired,onFocus:i.func,onBlur:i.func,disabled:i.bool,readOnly:i.bool,autoComplete:i.string,initialValueFormat:i.oneOf(["national"]),displayInitialValueAsLocalNumber:i.bool,defaultCountry:i.string,countries:i.arrayOf(i.string),labels:W.labels,locales:i.oneOfType([i.string,i.arrayOf(i.string)]),flagUrl:i.string,flags:i.objectOf(i.elementType),flagComponent:i.elementType,addInternationalOption:i.bool,internationalIcon:i.elementType,countryOptionsOrder:i.arrayOf(i.string),style:i.object,className:i.string,countrySelectComponent:i.elementType,countrySelectProps:i.object,inputComponent:i.elementType,numberInputProps:i.object,containerComponent:i.elementType,containerComponentProps:i.object,smartCaret:i.bool,international:i.bool,limitMaxLength:i.bool,countryCallingCodeEditable:i.bool,metadata:W.metadata,onCountryChange:i.func,focusInputOnCountrySelection:i.bool};var z={autoComplete:"tel",countrySelectComponent:nt.CountrySelectWithIcon,flagComponent:ot,flagUrl:"https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg",internationalIcon:rt,inputComponent:"input",containerComponent:"div",reset:i.any,smartCaret:!0,addInternationalOption:!0,countryCallingCodeEditable:!0,focusInputOnCountrySelection:!0};function Ot(n){n=H({},n);for(var e in z)n[e]===void 0&&(n[e]=z[e]);return n}function vt(n,e){if(n.length!==e.length)return!1;for(var o=0;o<n.length;){if(n[o]!==e[o])return!1;o++}return!0}module.exports=Q;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import S from "react";
|
|
2
|
-
import i from "../../../../../../_virtual/index.
|
|
3
|
-
import V from "../../../../../../_virtual/index.
|
|
2
|
+
import i from "../../../../../../_virtual/index.es.js";
|
|
3
|
+
import V from "../../../../../../_virtual/index.es2.js";
|
|
4
4
|
import J from "./InputSmart.es.js";
|
|
5
5
|
import Q from "./InputBasic.es.js";
|
|
6
6
|
import { CountrySelectWithIcon as Y } from "./CountrySelect.es.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../../../_virtual/index.cjs.js");var t=e.shape({country_calling_codes:e.object.isRequired,countries:e.object.isRequired}),a=e.objectOf(e.string);exports.labels=a;exports.metadata=t;
|