@kingteza/crud-component 1.44.2 → 1.45.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 +2 -5
- package/dist/_virtual/index.es2.js +5 -5
- package/dist/_virtual/index.es3.js +5 -2
- package/dist/common/picker/ImagePicker.cjs.js +1 -1
- package/dist/common/picker/ImagePicker.d.ts +2 -0
- package/dist/common/picker/ImagePicker.es.js +141 -135
- package/dist/crud/ImageCrudField.cjs.js +1 -1
- package/dist/crud/ImageCrudField.d.ts +2 -0
- package/dist/crud/ImageCrudField.es.js +49 -47
- 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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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";
|
|
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,7 +1,4 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
var p = { exports: {} };
|
|
5
2
|
export {
|
|
6
|
-
|
|
3
|
+
p as __module
|
|
7
4
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getDefaultExportFromCjs as
|
|
2
|
-
import { __require as
|
|
3
|
-
var
|
|
4
|
-
const
|
|
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);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
s as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
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);
|
|
2
5
|
export {
|
|
3
|
-
|
|
6
|
+
t as default
|
|
4
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),Ie=require("react-advanced-cropper"),q=require("@ant-design/icons"),R=require("antd"),r=require("react"),ke=require("../../locale/index.cjs.js"),O=require("../button/Button.cjs.js"),le=require("../../util/ImageUtil.cjs.js"),Oe=require("../../icons/FlipHIcon.cjs.js"),Re=require("../../icons/FlipVIcon.cjs.js"),Ue=R.Form.Item,ue="crud-component.image-picker.button-state";function $(u){return new Promise((w,b)=>{const i=new FileReader;i.readAsDataURL(u),i.onload=()=>w(i.result),i.onerror=f=>b(f)})}const Pe=({values:u=[],getRealUrl:w,required:b,buttonType:i,label:f,name:H,onChange:y,aspectRatio:S,buttonTitle:N,hidePreview:F,buttonSize:C="large",showButtonText:T=!0,showOnlyIcon:A=!1,icon:z=t.jsx(q.UploadOutlined,{}),loading:U,maxCount:a=1,onAdd:I,onRemove:B,listType:G,showSkipCropButton:pe,skipCrop:K=!1,skipResize:V,asyncUpload:M,...Q})=>{const[me,fe]=r.useState(""),[ge,je]=r.useState(""),[xe,X]=r.useState(!1),E=r.useRef(),g=r.useRef(null),[d,j]=r.useState([]),[k,L]=r.useState(),he=r.useRef(),ve=()=>X(!1),we=async e=>{!e.url&&!e.preview&&(e.preview=await $(e.originFileObj)),je(e.url||e.preview),X(!0),fe(e.name)},[Y,P]=r.useState(!1),Z=e=>{var s;(s=g.current)==null||s.rotateImage(e?-90:90)},ee=r.useCallback(e=>{var s;g.current&&((s=g.current)==null||s.flipImage(e==="h",e==="v"))},[]);r.useEffect(()=>{y==null||y(d[0],d)},[d,y]);const[_,J]=r.useState(),D=r.useCallback(async e=>{var ae;const{type:s,size:o,name:h,uid:c}=E.current;J(e?"skip-crop":"crop"),P(!0);const v=async n=>{if(I)try{if(P(!0),M)j(l=>a<=1?[n]:[n,...l]),I(n).then(l=>{j(p=>p.map(m=>m.uid===n.uid?{...m,status:"done",response:l??m.response}:m))});else{const l=await I(n),p={...n,response:l??n.response,status:"done"};j(m=>a<=1?[p]:[p,...m])}}finally{P(!1)}else j(l=>a<=1?[n]:[n,...l])};if(e){const n=E.current,l=V?n:await le.resizeImage(n),p=await $(l);await v({url:p,name:h,uid:c,type:s,size:o,thumbUrl:p,originFileObj:l,status:M?"uploading":void 0}),P(!1),L(void 0),J(void 0)}else{const n=(ae=g.current)==null?void 0:ae.getCanvas();n==null||n.toBlob(async l=>{const p=Object.assign(new File([l],h,{type:s}),{uid:c}),m=V?p:await le.resizeImage(p),ce=await $(m);await v({url:ce,name:h,uid:c,type:s,size:o,thumbUrl:ce,originFileObj:m,status:M?"uploading":void 0}),P(!1),L(void 0),J(void 0)})}},[M,a,I,V]),be=()=>{L(void 0),E.current=void 0},te=r.useCallback(e=>{const s=e;if(!s)return;if(E.current=s,K){D(!0);return}const o=new FileReader;o.addEventListener("load",()=>{var h;if(typeof o.result=="string"){L(o.result);const c=localStorage.getItem(ue),v=c?JSON.parse(c):void 0;v&&((h=g.current)==null||h.setState(v)),setTimeout(()=>{ie(g.current)},100)}}),o.readAsDataURL(s)},[D,K]);r.useEffect(()=>{let e=!1;return(async()=>{if(u==null||u===""){e||j([]);return}const o=typeof u=="string"?[u]:u;if(!o.length){e||j([]);return}const h=await Promise.all(o.map(async c=>{const v=w?await w(c):c;return{uid:c,url:v,thumbUrl:v,response:c,name:c.split("/").pop()??c}}));e||j(h)})(),()=>{e=!0}},[u,w]);const{t:x}=ke.useTranslationLib(),Se=r.useMemo(()=>b?{required:b,validator:(e,s,o)=>{k||d!=null&&d.length?o():o(`${f??""} ${x("err.validation.required")}`)}}:void 0,[b,k,d==null?void 0:d.length,f,x]),se=N??x("message.uploadButtonText"),re=r.useMemo(()=>t.jsx(de,{showLoadingIndicator:Y,_buttonTitle:se,buttonSize:C,buttonType:i,fileList:d,hidePreview:F,icon:z,loading:U,listType:G,maxCount:a,onChangeFile:te,onRemove:B,showButtonText:T,handlePreview:we,setFileList:j}),[Y,se,C,i,d,F,z,U,G,a,te,B,T]);he.current=re.props.beforeUpload;const[ye,ne]=r.useState(0),[Fe,oe]=r.useState(0),[W,Ce]=r.useState();r.useEffect(()=>{const e=setTimeout(()=>{W&&localStorage.setItem(ue,JSON.stringify(W))},400);return()=>clearTimeout(e)},[W]),r.useEffect(()=>{if(!k){ne(0),oe(0);const e=setTimeout(()=>{var s;(s=g.current)==null||s.reset()},1500);return()=>clearTimeout(e)}},[k]);const ie=r.useCallback(async e=>{if(e){const s=e.getCoordinates();Ce(e.getState()),ne((s==null?void 0:s.width)??10),oe((s==null?void 0:s.height)??10)}},[]);return t.jsxs(t.Fragment,{children:[t.jsx(Ue,{label:f,...Q,name:H,className:"mb-0",rules:[Se,...Q.rules??[]],children:re}),t.jsxs(R.Modal,{open:!!k,maskClosable:!1,onOk:()=>D(!1),closable:!1,okButtonProps:{loading:_==="crop",disabled:_==="skip-crop"},onCancel:be,footer:(e,{CancelBtn:s,OkBtn:o})=>pe?t.jsxs(R.Space,{children:[t.jsx(s,{}),t.jsx(O,{type:"primary",loading:_==="skip-crop",disabled:_==="crop",onClick:()=>D(!0),children:x("str.skipCrop")}),t.jsx(o,{})]}):t.jsx(t.Fragment,{children:e}),destroyOnHidden:!0,children:[t.jsx(Ie.Cropper,{ref:g,stencilProps:{grid:!0},style:{border:"1px solid black"},src:k,onChange:e=>{ie(e)},aspectRatio:S?{minimum:S,maximum:S}:void 0}),t.jsx("p",{className:"text-center",children:[ye,Fe].join(" ⨉ ")}),t.jsx("div",{className:"mt-2 d-flex justify-content-center",children:t.jsxs(R.Space.Compact,{children:[t.jsx(O,{size:"large",tooltip:x("str.rotateLeft"),icon:t.jsx(q.RotateLeftOutlined,{}),onClick:()=>Z(!0)}),t.jsx(O,{size:"large",icon:t.jsx(q.RotateRightOutlined,{}),tooltip:x("str.rotateRight"),onClick:()=>Z(!1)}),t.jsx(O,{size:"large",icon:t.jsx(Oe,{}),tooltip:x("str.flipHorizontal"),onClick:()=>ee("h")}),t.jsx(O,{size:"large",icon:t.jsx(Re,{}),tooltip:x("str.flipVertical"),onClick:()=>ee("v")})]})})]}),t.jsx(R.Modal,{open:xe,title:me,footer:null,onCancel:ve,children:t.jsx("div",{className:"text-center",children:t.jsx("img",{alt:"example",style:{maxWidth:"400px"},src:ge})})})]})},de=({_buttonTitle:u,buttonSize:w,buttonType:b,fileList:i,hidePreview:f,icon:H,loading:y,maxCount:S,onChangeFile:N,onRemove:F,showButtonText:C,handlePreview:T,setFileList:A,showLoadingIndicator:z,listType:U="picture"})=>t.jsxs(R.Upload,{accept:"image/x-png,image/gif,image/jpeg",fileList:i,defaultFileList:i,onChange:()=>{},className:(i.length>=S?" hide-upload ":"")+" mb-0",multiple:!1,onPreview:f?void 0:T,onDrop:a=>(N(a.dataTransfer.files.item(0)),!1),listType:U,showUploadList:!f,onRemove:a=>{const I=i.filter(B=>a.uid!==B.uid);F==null||F(a),A(I)},beforeUpload:async a=>(N(a),!1),maxCount:S,children:[z&&t.jsx(q.LoadingOutlined,{}),t.jsx("div",{className:"d-flex flex-column",children:i.length<S&&(U==="picture-circle"?t.jsx(q.UploadOutlined,{}):t.jsx(O,{loading:y,tooltip:C?void 0:u,size:w,icon:H,type:C?b:"text",children:C?u:void 0}))})]},i.length);exports.UploadComponent=de;exports.default=Pe;
|
|
@@ -28,6 +28,8 @@ interface Props extends FormItemProps {
|
|
|
28
28
|
onAdd?: (file?: UploadFileExtended) => Promise<string | void>;
|
|
29
29
|
onRemove?: (file?: UploadFileExtended) => void;
|
|
30
30
|
showSkipCropButton?: boolean;
|
|
31
|
+
/** When true, skips the crop modal entirely and uploads the original image. */
|
|
32
|
+
skipCrop?: boolean;
|
|
31
33
|
skipResize?: boolean;
|
|
32
34
|
asyncUpload?: boolean;
|
|
33
35
|
}
|
|
@@ -1,72 +1,73 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Cropper as
|
|
3
|
-
import { RotateLeftOutlined as
|
|
4
|
-
import { Form as
|
|
5
|
-
import
|
|
6
|
-
import { useTranslationLib as
|
|
1
|
+
import { jsx as r, jsxs as U, Fragment as ue } from "react/jsx-runtime";
|
|
2
|
+
import { Cropper as Be } from "react-advanced-cropper";
|
|
3
|
+
import { RotateLeftOutlined as Re, RotateRightOutlined as Te, UploadOutlined as ve, LoadingOutlined as Le } from "@ant-design/icons";
|
|
4
|
+
import { Form as De, Modal as me, Space as fe, Upload as He } from "antd";
|
|
5
|
+
import G, { useRef as K, useState as I, useCallback as E, useEffect as M, useMemo as ge } from "react";
|
|
6
|
+
import { useTranslationLib as Ve } from "../../locale/index.es.js";
|
|
7
7
|
import x from "../button/Button.es.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
const
|
|
12
|
-
function
|
|
8
|
+
import he from "../../util/ImageUtil.es.js";
|
|
9
|
+
import _e from "../../icons/FlipHIcon.es.js";
|
|
10
|
+
import Ee from "../../icons/FlipVIcon.es.js";
|
|
11
|
+
const Me = De.Item, we = "crud-component.image-picker.button-state";
|
|
12
|
+
function Q(c) {
|
|
13
13
|
return new Promise((b, y) => {
|
|
14
14
|
const n = new FileReader();
|
|
15
15
|
n.readAsDataURL(c), n.onload = () => b(n.result), n.onerror = (m) => y(m);
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const tt = ({
|
|
19
19
|
values: c = [],
|
|
20
20
|
getRealUrl: b,
|
|
21
21
|
required: y,
|
|
22
22
|
buttonType: n,
|
|
23
23
|
label: m,
|
|
24
|
-
name:
|
|
24
|
+
name: J,
|
|
25
25
|
onChange: C,
|
|
26
26
|
aspectRatio: F,
|
|
27
27
|
buttonTitle: z,
|
|
28
|
-
hidePreview:
|
|
29
|
-
buttonSize:
|
|
28
|
+
hidePreview: O,
|
|
29
|
+
buttonSize: k = "large",
|
|
30
30
|
showButtonText: B = !0,
|
|
31
|
-
showOnlyIcon:
|
|
32
|
-
icon: R = /* @__PURE__ */
|
|
31
|
+
showOnlyIcon: X = !1,
|
|
32
|
+
icon: R = /* @__PURE__ */ r(ve, {}),
|
|
33
33
|
loading: N,
|
|
34
34
|
maxCount: s = 1,
|
|
35
35
|
onAdd: S,
|
|
36
36
|
onRemove: T,
|
|
37
|
-
listType:
|
|
38
|
-
showSkipCropButton:
|
|
39
|
-
|
|
37
|
+
listType: Y,
|
|
38
|
+
showSkipCropButton: be,
|
|
39
|
+
skipCrop: Z = !1,
|
|
40
|
+
skipResize: W,
|
|
40
41
|
asyncUpload: L,
|
|
41
|
-
...
|
|
42
|
+
...q
|
|
42
43
|
}) => {
|
|
43
|
-
const [
|
|
44
|
-
!e.url && !e.preview && (e.preview = await
|
|
45
|
-
}, [
|
|
44
|
+
const [ye, Fe] = G.useState(""), [Ie, Ce] = G.useState(""), [Oe, ee] = G.useState(!1), D = K(), f = K(null), [d, g] = I([]), [j, H] = I(), ke = K(), Se = () => ee(!1), je = async (e) => {
|
|
45
|
+
!e.url && !e.preview && (e.preview = await Q(e.originFileObj)), Ce(e.url || e.preview), ee(!0), Fe(e.name);
|
|
46
|
+
}, [te, P] = I(!1), re = (e) => {
|
|
46
47
|
var t;
|
|
47
48
|
(t = f.current) == null || t.rotateImage(e ? -90 : 90);
|
|
48
|
-
},
|
|
49
|
+
}, oe = E((e) => {
|
|
49
50
|
var t;
|
|
50
51
|
f.current && ((t = f.current) == null || t.flipImage(e === "h", e === "v"));
|
|
51
52
|
}, []);
|
|
52
|
-
|
|
53
|
+
M(() => {
|
|
53
54
|
C == null || C(d[0], d);
|
|
54
55
|
}, [d, C]);
|
|
55
|
-
const [V,
|
|
56
|
+
const [V, $] = I(), _ = E(
|
|
56
57
|
async (e) => {
|
|
57
|
-
var
|
|
58
|
+
var de;
|
|
58
59
|
const { type: t, size: i, name: w, uid: a } = D.current;
|
|
59
|
-
|
|
60
|
-
const v = async (
|
|
60
|
+
$(e ? "skip-crop" : "crop"), P(!0);
|
|
61
|
+
const v = async (o) => {
|
|
61
62
|
if (S)
|
|
62
63
|
try {
|
|
63
64
|
if (P(!0), L)
|
|
64
65
|
g(
|
|
65
|
-
(l) => s <= 1 ? [
|
|
66
|
-
), S(
|
|
66
|
+
(l) => s <= 1 ? [o] : [o, ...l]
|
|
67
|
+
), S(o).then((l) => {
|
|
67
68
|
g(
|
|
68
69
|
(p) => p.map(
|
|
69
|
-
(u) => u.uid ===
|
|
70
|
+
(u) => u.uid === o.uid ? {
|
|
70
71
|
...u,
|
|
71
72
|
status: "done",
|
|
72
73
|
response: l ?? u.response
|
|
@@ -75,9 +76,9 @@ const et = ({
|
|
|
75
76
|
);
|
|
76
77
|
});
|
|
77
78
|
else {
|
|
78
|
-
const l = await S(
|
|
79
|
-
...
|
|
80
|
-
response: l ??
|
|
79
|
+
const l = await S(o), p = {
|
|
80
|
+
...o,
|
|
81
|
+
response: l ?? o.response,
|
|
81
82
|
status: "done"
|
|
82
83
|
};
|
|
83
84
|
g(
|
|
@@ -88,10 +89,10 @@ const et = ({
|
|
|
88
89
|
P(!1);
|
|
89
90
|
}
|
|
90
91
|
else
|
|
91
|
-
g((l) => s <= 1 ? [
|
|
92
|
+
g((l) => s <= 1 ? [o] : [o, ...l]);
|
|
92
93
|
};
|
|
93
94
|
if (e) {
|
|
94
|
-
const
|
|
95
|
+
const o = D.current, l = W ? o : await he.resizeImage(o), p = await Q(l);
|
|
95
96
|
await v({
|
|
96
97
|
url: p,
|
|
97
98
|
name: w,
|
|
@@ -101,47 +102,52 @@ const et = ({
|
|
|
101
102
|
thumbUrl: p,
|
|
102
103
|
originFileObj: l,
|
|
103
104
|
status: L ? "uploading" : void 0
|
|
104
|
-
}), P(!1), H(void 0),
|
|
105
|
+
}), P(!1), H(void 0), $(void 0);
|
|
105
106
|
} else {
|
|
106
|
-
const
|
|
107
|
-
|
|
107
|
+
const o = (de = f.current) == null ? void 0 : de.getCanvas();
|
|
108
|
+
o == null || o.toBlob(async (l) => {
|
|
108
109
|
const p = Object.assign(new File([l], w, { type: t }), {
|
|
109
110
|
uid: a
|
|
110
|
-
}), u =
|
|
111
|
+
}), u = W ? p : await he.resizeImage(p), pe = await Q(u);
|
|
111
112
|
await v({
|
|
112
|
-
url:
|
|
113
|
+
url: pe,
|
|
113
114
|
name: w,
|
|
114
115
|
uid: a,
|
|
115
116
|
type: t,
|
|
116
117
|
size: i,
|
|
117
|
-
thumbUrl:
|
|
118
|
+
thumbUrl: pe,
|
|
118
119
|
originFileObj: u,
|
|
119
120
|
status: L ? "uploading" : void 0
|
|
120
|
-
}), P(!1), H(void 0),
|
|
121
|
+
}), P(!1), H(void 0), $(void 0);
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
},
|
|
124
|
-
[L, s, S,
|
|
125
|
-
),
|
|
125
|
+
[L, s, S, W]
|
|
126
|
+
), xe = () => {
|
|
126
127
|
H(void 0), D.current = void 0;
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
}, ie = E(
|
|
129
|
+
(e) => {
|
|
130
|
+
const t = e;
|
|
131
|
+
if (!t) return;
|
|
132
|
+
if (D.current = t, Z) {
|
|
133
|
+
_(!0);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
131
136
|
const i = new FileReader();
|
|
132
137
|
i.addEventListener("load", () => {
|
|
133
138
|
var w;
|
|
134
139
|
if (typeof i.result == "string") {
|
|
135
140
|
H(i.result);
|
|
136
|
-
const a = localStorage.getItem(
|
|
141
|
+
const a = localStorage.getItem(we), v = a ? JSON.parse(a) : void 0;
|
|
137
142
|
v && ((w = f.current) == null || w.setState(v)), setTimeout(() => {
|
|
138
|
-
|
|
143
|
+
ce(f.current);
|
|
139
144
|
}, 100);
|
|
140
145
|
}
|
|
141
146
|
}), i.readAsDataURL(t);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
},
|
|
148
|
+
[_, Z]
|
|
149
|
+
);
|
|
150
|
+
M(() => {
|
|
145
151
|
let e = !1;
|
|
146
152
|
return (async () => {
|
|
147
153
|
if (c == null || c === "") {
|
|
@@ -170,7 +176,7 @@ const et = ({
|
|
|
170
176
|
e = !0;
|
|
171
177
|
};
|
|
172
178
|
}, [c, b]);
|
|
173
|
-
const { t: h } =
|
|
179
|
+
const { t: h } = Ve(), Ne = ge(
|
|
174
180
|
() => y ? {
|
|
175
181
|
required: y,
|
|
176
182
|
validator: (e, t, i) => {
|
|
@@ -178,53 +184,53 @@ const et = ({
|
|
|
178
184
|
}
|
|
179
185
|
} : void 0,
|
|
180
186
|
[y, j, d == null ? void 0 : d.length, m, h]
|
|
181
|
-
),
|
|
182
|
-
() => /* @__PURE__ */
|
|
183
|
-
|
|
187
|
+
), ne = z ?? h("message.uploadButtonText"), se = ge(
|
|
188
|
+
() => /* @__PURE__ */ r(
|
|
189
|
+
Je,
|
|
184
190
|
{
|
|
185
|
-
showLoadingIndicator:
|
|
186
|
-
_buttonTitle:
|
|
187
|
-
buttonSize:
|
|
191
|
+
showLoadingIndicator: te,
|
|
192
|
+
_buttonTitle: ne,
|
|
193
|
+
buttonSize: k,
|
|
188
194
|
buttonType: n,
|
|
189
195
|
fileList: d,
|
|
190
|
-
hidePreview:
|
|
196
|
+
hidePreview: O,
|
|
191
197
|
icon: R,
|
|
192
198
|
loading: N,
|
|
193
|
-
listType:
|
|
199
|
+
listType: Y,
|
|
194
200
|
maxCount: s,
|
|
195
|
-
onChangeFile:
|
|
201
|
+
onChangeFile: ie,
|
|
196
202
|
onRemove: T,
|
|
197
203
|
showButtonText: B,
|
|
198
|
-
handlePreview:
|
|
204
|
+
handlePreview: je,
|
|
199
205
|
setFileList: g
|
|
200
206
|
}
|
|
201
207
|
),
|
|
202
208
|
[
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
209
|
+
te,
|
|
210
|
+
ne,
|
|
211
|
+
k,
|
|
206
212
|
n,
|
|
207
213
|
d,
|
|
208
|
-
|
|
214
|
+
O,
|
|
209
215
|
R,
|
|
210
216
|
N,
|
|
211
|
-
|
|
217
|
+
Y,
|
|
212
218
|
s,
|
|
213
|
-
|
|
219
|
+
ie,
|
|
214
220
|
T,
|
|
215
221
|
B
|
|
216
222
|
]
|
|
217
223
|
);
|
|
218
|
-
ke.current =
|
|
219
|
-
const [
|
|
220
|
-
|
|
224
|
+
ke.current = se.props.beforeUpload;
|
|
225
|
+
const [Pe, ae] = I(0), [Ue, le] = I(0), [A, ze] = I();
|
|
226
|
+
M(() => {
|
|
221
227
|
const e = setTimeout(() => {
|
|
222
|
-
|
|
228
|
+
A && localStorage.setItem(we, JSON.stringify(A));
|
|
223
229
|
}, 400);
|
|
224
230
|
return () => clearTimeout(e);
|
|
225
|
-
}, [
|
|
231
|
+
}, [A]), M(() => {
|
|
226
232
|
if (!j) {
|
|
227
|
-
|
|
233
|
+
ae(0), le(0);
|
|
228
234
|
const e = setTimeout(() => {
|
|
229
235
|
var t;
|
|
230
236
|
(t = f.current) == null || t.reset();
|
|
@@ -232,54 +238,54 @@ const et = ({
|
|
|
232
238
|
return () => clearTimeout(e);
|
|
233
239
|
}
|
|
234
240
|
}, [j]);
|
|
235
|
-
const
|
|
241
|
+
const ce = E(async (e) => {
|
|
236
242
|
if (e) {
|
|
237
243
|
const t = e.getCoordinates();
|
|
238
|
-
|
|
244
|
+
ze(e.getState()), ae((t == null ? void 0 : t.width) ?? 10), le((t == null ? void 0 : t.height) ?? 10);
|
|
239
245
|
}
|
|
240
246
|
}, []);
|
|
241
|
-
return /* @__PURE__ */ U(
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
|
|
247
|
+
return /* @__PURE__ */ U(ue, { children: [
|
|
248
|
+
/* @__PURE__ */ r(
|
|
249
|
+
Me,
|
|
244
250
|
{
|
|
245
251
|
label: m,
|
|
246
|
-
...
|
|
247
|
-
name:
|
|
252
|
+
...q,
|
|
253
|
+
name: J,
|
|
248
254
|
className: "mb-0",
|
|
249
|
-
rules: [
|
|
250
|
-
children:
|
|
255
|
+
rules: [Ne, ...q.rules ?? []],
|
|
256
|
+
children: se
|
|
251
257
|
}
|
|
252
258
|
),
|
|
253
259
|
/* @__PURE__ */ U(
|
|
254
|
-
|
|
260
|
+
me,
|
|
255
261
|
{
|
|
256
262
|
open: !!j,
|
|
257
263
|
maskClosable: !1,
|
|
258
|
-
onOk: () =>
|
|
264
|
+
onOk: () => _(!1),
|
|
259
265
|
closable: !1,
|
|
260
266
|
okButtonProps: {
|
|
261
267
|
loading: V === "crop",
|
|
262
268
|
disabled: V === "skip-crop"
|
|
263
269
|
},
|
|
264
|
-
onCancel:
|
|
265
|
-
footer: (e, { CancelBtn: t, OkBtn: i }) =>
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
270
|
+
onCancel: xe,
|
|
271
|
+
footer: (e, { CancelBtn: t, OkBtn: i }) => be ? /* @__PURE__ */ U(fe, { children: [
|
|
272
|
+
/* @__PURE__ */ r(t, {}),
|
|
273
|
+
/* @__PURE__ */ r(
|
|
268
274
|
x,
|
|
269
275
|
{
|
|
270
276
|
type: "primary",
|
|
271
277
|
loading: V === "skip-crop",
|
|
272
278
|
disabled: V === "crop",
|
|
273
|
-
onClick: () =>
|
|
279
|
+
onClick: () => _(!0),
|
|
274
280
|
children: h("str.skipCrop")
|
|
275
281
|
}
|
|
276
282
|
),
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
-
] }) : /* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ r(i, {})
|
|
284
|
+
] }) : /* @__PURE__ */ r(ue, { children: e }),
|
|
279
285
|
destroyOnHidden: !0,
|
|
280
286
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
|
|
287
|
+
/* @__PURE__ */ r(
|
|
288
|
+
Be,
|
|
283
289
|
{
|
|
284
290
|
ref: f,
|
|
285
291
|
stencilProps: {
|
|
@@ -288,7 +294,7 @@ const et = ({
|
|
|
288
294
|
style: { border: "1px solid black" },
|
|
289
295
|
src: j,
|
|
290
296
|
onChange: (e) => {
|
|
291
|
-
|
|
297
|
+
ce(e);
|
|
292
298
|
},
|
|
293
299
|
aspectRatio: F ? {
|
|
294
300
|
minimum: F,
|
|
@@ -296,77 +302,77 @@ const et = ({
|
|
|
296
302
|
} : void 0
|
|
297
303
|
}
|
|
298
304
|
),
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ r("p", { className: "text-center", children: [Pe, Ue].join(" ⨉ ") }),
|
|
306
|
+
/* @__PURE__ */ r("div", { className: "mt-2 d-flex justify-content-center", children: /* @__PURE__ */ U(fe.Compact, { children: [
|
|
307
|
+
/* @__PURE__ */ r(
|
|
302
308
|
x,
|
|
303
309
|
{
|
|
304
310
|
size: "large",
|
|
305
311
|
tooltip: h("str.rotateLeft"),
|
|
306
|
-
icon: /* @__PURE__ */
|
|
307
|
-
onClick: () =>
|
|
312
|
+
icon: /* @__PURE__ */ r(Re, {}),
|
|
313
|
+
onClick: () => re(!0)
|
|
308
314
|
}
|
|
309
315
|
),
|
|
310
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ r(
|
|
311
317
|
x,
|
|
312
318
|
{
|
|
313
319
|
size: "large",
|
|
314
|
-
icon: /* @__PURE__ */
|
|
320
|
+
icon: /* @__PURE__ */ r(Te, {}),
|
|
315
321
|
tooltip: h("str.rotateRight"),
|
|
316
|
-
onClick: () =>
|
|
322
|
+
onClick: () => re(!1)
|
|
317
323
|
}
|
|
318
324
|
),
|
|
319
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ r(
|
|
320
326
|
x,
|
|
321
327
|
{
|
|
322
328
|
size: "large",
|
|
323
|
-
icon: /* @__PURE__ */
|
|
329
|
+
icon: /* @__PURE__ */ r(_e, {}),
|
|
324
330
|
tooltip: h("str.flipHorizontal"),
|
|
325
|
-
onClick: () =>
|
|
331
|
+
onClick: () => oe("h")
|
|
326
332
|
}
|
|
327
333
|
),
|
|
328
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ r(
|
|
329
335
|
x,
|
|
330
336
|
{
|
|
331
337
|
size: "large",
|
|
332
|
-
icon: /* @__PURE__ */
|
|
338
|
+
icon: /* @__PURE__ */ r(Ee, {}),
|
|
333
339
|
tooltip: h("str.flipVertical"),
|
|
334
|
-
onClick: () =>
|
|
340
|
+
onClick: () => oe("v")
|
|
335
341
|
}
|
|
336
342
|
)
|
|
337
343
|
] }) })
|
|
338
344
|
]
|
|
339
345
|
}
|
|
340
346
|
),
|
|
341
|
-
/* @__PURE__ */
|
|
342
|
-
|
|
347
|
+
/* @__PURE__ */ r(
|
|
348
|
+
me,
|
|
343
349
|
{
|
|
344
|
-
open:
|
|
345
|
-
title:
|
|
350
|
+
open: Oe,
|
|
351
|
+
title: ye,
|
|
346
352
|
footer: null,
|
|
347
|
-
onCancel:
|
|
348
|
-
children: /* @__PURE__ */
|
|
353
|
+
onCancel: Se,
|
|
354
|
+
children: /* @__PURE__ */ r("div", { className: "text-center", children: /* @__PURE__ */ r("img", { alt: "example", style: { maxWidth: "400px" }, src: Ie }) })
|
|
349
355
|
}
|
|
350
356
|
)
|
|
351
357
|
] });
|
|
352
|
-
},
|
|
358
|
+
}, Je = ({
|
|
353
359
|
_buttonTitle: c,
|
|
354
360
|
buttonSize: b,
|
|
355
361
|
buttonType: y,
|
|
356
362
|
fileList: n,
|
|
357
363
|
hidePreview: m,
|
|
358
|
-
icon:
|
|
364
|
+
icon: J,
|
|
359
365
|
loading: C,
|
|
360
366
|
maxCount: F,
|
|
361
367
|
onChangeFile: z,
|
|
362
|
-
onRemove:
|
|
363
|
-
showButtonText:
|
|
368
|
+
onRemove: O,
|
|
369
|
+
showButtonText: k,
|
|
364
370
|
handlePreview: B,
|
|
365
|
-
setFileList:
|
|
371
|
+
setFileList: X,
|
|
366
372
|
showLoadingIndicator: R,
|
|
367
373
|
listType: N = "picture"
|
|
368
374
|
}) => /* @__PURE__ */ U(
|
|
369
|
-
|
|
375
|
+
He,
|
|
370
376
|
{
|
|
371
377
|
accept: "image/x-png,image/gif,image/jpeg",
|
|
372
378
|
fileList: n,
|
|
@@ -381,21 +387,21 @@ const et = ({
|
|
|
381
387
|
showUploadList: !m,
|
|
382
388
|
onRemove: (s) => {
|
|
383
389
|
const S = n.filter((T) => s.uid !== T.uid);
|
|
384
|
-
|
|
390
|
+
O == null || O(s), X(S);
|
|
385
391
|
},
|
|
386
392
|
beforeUpload: async (s) => (z(s), !1),
|
|
387
393
|
maxCount: F,
|
|
388
394
|
children: [
|
|
389
|
-
R && /* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
395
|
+
R && /* @__PURE__ */ r(Le, {}),
|
|
396
|
+
/* @__PURE__ */ r("div", { className: "d-flex flex-column", children: n.length < F && (N === "picture-circle" ? /* @__PURE__ */ r(ve, {}) : /* @__PURE__ */ r(
|
|
391
397
|
x,
|
|
392
398
|
{
|
|
393
399
|
loading: C,
|
|
394
|
-
tooltip:
|
|
400
|
+
tooltip: k ? void 0 : c,
|
|
395
401
|
size: b,
|
|
396
|
-
icon:
|
|
397
|
-
type:
|
|
398
|
-
children:
|
|
402
|
+
icon: J,
|
|
403
|
+
type: k ? y : "text",
|
|
404
|
+
children: k ? c : void 0
|
|
399
405
|
}
|
|
400
406
|
)) })
|
|
401
407
|
]
|
|
@@ -403,6 +409,6 @@ const et = ({
|
|
|
403
409
|
n.length
|
|
404
410
|
);
|
|
405
411
|
export {
|
|
406
|
-
|
|
407
|
-
|
|
412
|
+
Je as UploadComponent,
|
|
413
|
+
tt as default
|
|
408
414
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var T=Object.defineProperty;var W=(s,e,t)=>e in s?T(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var q=(s,e,t)=>W(s,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),G=require("@ant-design/icons"),F=require("antd"),x=require("path-browserify"),d=require("react"),J=require("../util/NumberUtil.cjs.js"),K=require("../util/ValidationUtil.cjs.js"),L=require("uuid"),Q=require("../common/picker/ImagePicker.cjs.js"),X=require("../util/ImageUtil.cjs.js");class N{}class Y extends N{constructor(t="",l=""){super();q(this,"rootPath");q(this,"subPath");this.rootPath=t,this.subPath=l}cloneFilePath(t){const l=x.parse(t),a=`${l.name}_cloned_${J.default.randInt(1e5)}`;return x.format({dir:l.dir,ext:l.ext,name:a})}generateFileName(t){return`${t.split(".")[0]}_${L.v4().replace("-","")}`}}function Z({formLayoutProps:s,name:e,label:t,required:l,provider:a,onUploading:i,aspectRatio:$,onRemoved:m,fieldClassName:A,hideLabel:k=!1,listType:C,fieldHelper:O,showSkipCropButton:S=!1,skipCrop:_=!1,skipResize:B=!1,asyncUpload:M=!1,maxCount:h=1},z){const f=F.Form.useFormInstance(),o=e,y=F.Form.useWatch(o,f),D=d.useCallback(r=>a.getRealUrl(r),[a]),g=d.useCallback(async(r,P)=>{if(P){i==null||i(!0);try{const u=r.name,c=u.split("."),p=c[c.length-1],I=a.generateFileName(u),w=`${await a.getInitialPath()}/${I}.${p}`,j=await a.upload(r,w),V=f.getFieldValue(o);if(h>1){const H=Array.isArray(V)?V:V?[V]:[];f.setFieldValue(o,[...H,j].filter(Boolean))}else f.setFieldValue(o,j);return j}finally{i==null||i(!1)}}else{const u=f.getFieldValue(o);if(h>1){const c=r.response??(typeof r.uid=="string"?r.uid:void 0);if(!c)return;await a.delete(c),m==null||m();const I=(Array.isArray(u)?u:u?[u]:[]).filter(w=>w!==c);f.setFieldValue(o,I.length?I:null)}else{const c=await a.delete(u);m==null||m(),c&&f.setFieldValue(o,null)}}},[f,h,o,m,i,a]);d.useImperativeHandle(z,()=>({async uploadBlob(r,P){const u=await X.getBase64(r),c={name:P,uid:P+Math.random().toString(36).substring(2,15),url:u,originFileObj:r};await g(c,!0)}}),[g]);const E=d.useMemo(()=>y?(Array.isArray(y),y):h>1?[]:void 0,[y,h]);return n.jsxs(F.Form.Item,{rules:l?K.required(t):[],label:k?null:t,required:l,name:o,help:O,...s,className:A,children:[n.jsx(Q.default,{noStyle:!0,asyncUpload:M,listType:C,aspectRatio:$,values:E,getRealUrl:D,onRemove:r=>{r&&g(r,!1)},onAdd:async r=>{if(r)return g(r,!0)},className:A,showSkipCropButton:S,skipCrop:_,skipResize:B,maxCount:h}),n.jsx(F.Input,{hidden:!0})]})}const U=d.forwardRef(Z),R=({provider:s,value:e})=>{const[t,l]=d.useState([]);return d.useEffect(()=>{if(!e){l([]);return}const a=Array.isArray(e)?e:[e];Promise.all(a.filter(Boolean).map(i=>s.getRealUrl(i))).then(l)},[s,e]),t.length?n.jsx(n.Fragment,{children:t.map(a=>n.jsx(b,{url:a},a))}):n.jsx(n.Fragment,{})},b=({url:s})=>n.jsx(F.Avatar,{className:"p-0",children:n.jsx(F.Image,{className:"m-0 p-0 position-relative",src:s,preview:{mask:n.jsx(G.EyeOutlined,{})}})});exports.FileDownloadProvider=N;exports.FileUploadProvider=Y;exports.ImageCellValue=b;exports.ImageCrudCellValue=R;exports.default=U;
|
|
@@ -10,6 +10,8 @@ export interface _ImageCrudField<T> extends InitialCrudField<T> {
|
|
|
10
10
|
fieldClassName?: string;
|
|
11
11
|
listType?: UploadListType;
|
|
12
12
|
showSkipCropButton?: boolean;
|
|
13
|
+
/** When true, skips the crop modal entirely and uploads the original image. */
|
|
14
|
+
skipCrop?: boolean;
|
|
13
15
|
skipResize?: boolean;
|
|
14
16
|
asyncUpload?: boolean;
|
|
15
17
|
maxCount?: number;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var w = (s, e, t) =>
|
|
4
|
-
import { jsx as o, Fragment as $, jsxs as
|
|
5
|
-
import { EyeOutlined as
|
|
6
|
-
import { Avatar as
|
|
1
|
+
var W = Object.defineProperty;
|
|
2
|
+
var q = (s, e, t) => e in s ? W(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var w = (s, e, t) => q(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { jsx as o, Fragment as $, jsxs as G } from "react/jsx-runtime";
|
|
5
|
+
import { EyeOutlined as J } from "@ant-design/icons";
|
|
6
|
+
import { Avatar as K, Image as L, Form as I, Input as Q } from "antd";
|
|
7
7
|
import b from "path-browserify";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { v4 as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
class
|
|
8
|
+
import T, { useState as X, useEffect as Y, useCallback as k, useImperativeHandle as Z, useMemo as U } from "react";
|
|
9
|
+
import R from "../util/NumberUtil.es.js";
|
|
10
|
+
import v from "../util/ValidationUtil.es.js";
|
|
11
|
+
import { v4 as ee } from "uuid";
|
|
12
|
+
import te from "../common/picker/ImagePicker.es.js";
|
|
13
|
+
import ae from "../util/ImageUtil.es.js";
|
|
14
|
+
class re {
|
|
15
15
|
}
|
|
16
|
-
class
|
|
16
|
+
class pe extends re {
|
|
17
17
|
constructor(t = "", l = "") {
|
|
18
18
|
super();
|
|
19
19
|
w(this, "rootPath");
|
|
@@ -21,7 +21,7 @@ class Fe extends ae {
|
|
|
21
21
|
this.rootPath = t, this.subPath = l;
|
|
22
22
|
}
|
|
23
23
|
cloneFilePath(t) {
|
|
24
|
-
const l = b.parse(t), a = `${l.name}_cloned_${
|
|
24
|
+
const l = b.parse(t), a = `${l.name}_cloned_${R.randInt(1e5)}`;
|
|
25
25
|
return b.format({
|
|
26
26
|
dir: l.dir,
|
|
27
27
|
ext: l.ext,
|
|
@@ -29,10 +29,10 @@ class Fe extends ae {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
generateFileName(t) {
|
|
32
|
-
return `${t.split(".")[0]}_${
|
|
32
|
+
return `${t.split(".")[0]}_${ee().replace("-", "")}`;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function se({
|
|
36
36
|
formLayoutProps: s,
|
|
37
37
|
name: e,
|
|
38
38
|
label: t,
|
|
@@ -46,11 +46,12 @@ function re({
|
|
|
46
46
|
listType: j,
|
|
47
47
|
fieldHelper: z,
|
|
48
48
|
showSkipCropButton: S = !1,
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
skipCrop: _ = !1,
|
|
50
|
+
skipResize: x = !1,
|
|
51
|
+
asyncUpload: E = !1,
|
|
51
52
|
maxCount: h = 1
|
|
52
|
-
},
|
|
53
|
-
const m = I.useFormInstance(), u = e, d = I.useWatch(u, m),
|
|
53
|
+
}, H) {
|
|
54
|
+
const m = I.useFormInstance(), u = e, d = I.useWatch(u, m), M = k(
|
|
54
55
|
(r) => a.getRealUrl(r),
|
|
55
56
|
[a]
|
|
56
57
|
), y = k(
|
|
@@ -60,9 +61,9 @@ function re({
|
|
|
60
61
|
try {
|
|
61
62
|
const i = r.name, c = i.split("."), N = c[c.length - 1], p = a.generateFileName(i), g = `${await a.getInitialPath()}/${p}.${N}`, V = await a.upload(r, g), P = m.getFieldValue(u);
|
|
62
63
|
if (h > 1) {
|
|
63
|
-
const
|
|
64
|
+
const D = Array.isArray(P) ? P : P ? [P] : [];
|
|
64
65
|
m.setFieldValue(u, [
|
|
65
|
-
...
|
|
66
|
+
...D,
|
|
66
67
|
V
|
|
67
68
|
].filter(Boolean));
|
|
68
69
|
} else
|
|
@@ -90,11 +91,11 @@ function re({
|
|
|
90
91
|
},
|
|
91
92
|
[m, h, u, f, n, a]
|
|
92
93
|
);
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
Z(
|
|
95
|
+
H,
|
|
95
96
|
() => ({
|
|
96
97
|
async uploadBlob(r, F) {
|
|
97
|
-
const i = await
|
|
98
|
+
const i = await ae.getBase64(r), c = {
|
|
98
99
|
name: F,
|
|
99
100
|
uid: F + Math.random().toString(36).substring(2, 15),
|
|
100
101
|
url: i,
|
|
@@ -105,11 +106,11 @@ function re({
|
|
|
105
106
|
}),
|
|
106
107
|
[y]
|
|
107
108
|
);
|
|
108
|
-
const
|
|
109
|
-
return /* @__PURE__ */
|
|
109
|
+
const C = U(() => d ? (Array.isArray(d), d) : h > 1 ? [] : void 0, [d, h]);
|
|
110
|
+
return /* @__PURE__ */ G(
|
|
110
111
|
I.Item,
|
|
111
112
|
{
|
|
112
|
-
rules: l ?
|
|
113
|
+
rules: l ? v.required(t) : [],
|
|
113
114
|
label: O ? null : t,
|
|
114
115
|
required: l,
|
|
115
116
|
name: u,
|
|
@@ -118,14 +119,14 @@ function re({
|
|
|
118
119
|
className: A,
|
|
119
120
|
children: [
|
|
120
121
|
/* @__PURE__ */ o(
|
|
121
|
-
|
|
122
|
+
te,
|
|
122
123
|
{
|
|
123
124
|
noStyle: !0,
|
|
124
|
-
asyncUpload:
|
|
125
|
+
asyncUpload: E,
|
|
125
126
|
listType: j,
|
|
126
127
|
aspectRatio: B,
|
|
127
|
-
values:
|
|
128
|
-
getRealUrl:
|
|
128
|
+
values: C,
|
|
129
|
+
getRealUrl: M,
|
|
129
130
|
onRemove: (r) => {
|
|
130
131
|
r && y(r, !1);
|
|
131
132
|
},
|
|
@@ -134,18 +135,19 @@ function re({
|
|
|
134
135
|
},
|
|
135
136
|
className: A,
|
|
136
137
|
showSkipCropButton: S,
|
|
137
|
-
|
|
138
|
+
skipCrop: _,
|
|
139
|
+
skipResize: x,
|
|
138
140
|
maxCount: h
|
|
139
141
|
}
|
|
140
142
|
),
|
|
141
|
-
/* @__PURE__ */ o(
|
|
143
|
+
/* @__PURE__ */ o(Q, { hidden: !0 })
|
|
142
144
|
]
|
|
143
145
|
}
|
|
144
146
|
);
|
|
145
147
|
}
|
|
146
|
-
const
|
|
147
|
-
const [t, l] =
|
|
148
|
-
return
|
|
148
|
+
const Pe = T.forwardRef(se), ge = ({ provider: s, value: e }) => {
|
|
149
|
+
const [t, l] = X([]);
|
|
150
|
+
return Y(() => {
|
|
149
151
|
if (!e) {
|
|
150
152
|
l([]);
|
|
151
153
|
return;
|
|
@@ -154,21 +156,21 @@ const pe = Q.forwardRef(re), Pe = ({ provider: s, value: e }) => {
|
|
|
154
156
|
Promise.all(a.filter(Boolean).map((n) => s.getRealUrl(n))).then(
|
|
155
157
|
l
|
|
156
158
|
);
|
|
157
|
-
}, [s, e]), t.length ? /* @__PURE__ */ o($, { children: t.map((a) => /* @__PURE__ */ o(
|
|
158
|
-
},
|
|
159
|
-
|
|
159
|
+
}, [s, e]), t.length ? /* @__PURE__ */ o($, { children: t.map((a) => /* @__PURE__ */ o(le, { url: a }, a)) }) : /* @__PURE__ */ o($, {});
|
|
160
|
+
}, le = ({ url: s }) => /* @__PURE__ */ o(K, { className: "p-0", children: /* @__PURE__ */ o(
|
|
161
|
+
L,
|
|
160
162
|
{
|
|
161
163
|
className: "m-0 p-0 position-relative",
|
|
162
164
|
src: s,
|
|
163
165
|
preview: {
|
|
164
|
-
mask: /* @__PURE__ */ o(
|
|
166
|
+
mask: /* @__PURE__ */ o(J, {})
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
169
|
) });
|
|
168
170
|
export {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
re as FileDownloadProvider,
|
|
172
|
+
pe as FileUploadProvider,
|
|
173
|
+
le as ImageCellValue,
|
|
174
|
+
ge as ImageCrudCellValue,
|
|
175
|
+
Pe as default
|
|
174
176
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("react"),u=require("../../../../../../../_virtual/index.
|
|
1
|
+
"use strict";const c=require("react"),u=require("../../../../../../../_virtual/index.cjs2.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.es2.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.cjs.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.es.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.cjs2.js"),b=require("../../../../../../_virtual/index.cjs3.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.es2.js";
|
|
3
|
+
import I from "../../../../../../_virtual/index.es3.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.cjs2.js"),C=require("../../../../../../_virtual/index.cjs3.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.es2.js";
|
|
3
|
+
import O from "../../../../../../_virtual/index.es3.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.cjs2.js");require("../../../../../../_virtual/index.cjs3.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.es2.js";
|
|
3
|
+
import "../../../../../../_virtual/index.es3.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.cjs2.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.es2.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.cjs2.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.es2.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.cjs2.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.es2.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.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
|
+
"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,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.es2.js";
|
|
3
|
+
import V from "../../../../../../_virtual/index.es3.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.cjs2.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;
|