@kingteza/crud-component 1.36.1 → 1.38.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/common/text-field/NumberField.cjs.js +1 -1
- package/dist/common/text-field/NumberField.d.ts +1 -1
- package/dist/common/text-field/NumberField.es.js +112 -66
- package/dist/common/text-field/TextField.cjs.js +1 -1
- package/dist/common/text-field/TextField.d.ts +1 -0
- package/dist/common/text-field/TextField.es.js +58 -55
- package/dist/context/CrudSearchContext.cjs.js +1 -0
- package/dist/context/CrudSearchContext.d.ts +12 -0
- package/dist/context/CrudSearchContext.es.js +14 -0
- package/dist/crud/CrudField.cjs.js +1 -1
- package/dist/crud/CrudField.d.ts +2 -1
- package/dist/crud/CrudField.es.js +436 -404
- package/dist/crud/CrudSearchComponent.cjs.js +1 -1
- package/dist/crud/CrudSearchComponent.d.ts +17 -0
- package/dist/crud/CrudSearchComponent.es.js +45 -44
- package/dist/crud/CrudTextAreaComponent.cjs.js +1 -1
- package/dist/crud/CrudTextAreaComponent.es.js +39 -38
- package/dist/locale/translations/en.cjs.js +1 -1
- package/dist/locale/translations/en.d.ts +1 -0
- package/dist/locale/translations/en.es.js +2 -1
- package/dist/util/NumberUtil.cjs.js +1 -1
- package/dist/util/NumberUtil.d.ts +1 -1
- package/dist/util/NumberUtil.es.js +4 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),o=require("react"),p=require("@ant-design/icons"),l=require("antd"),N=require("./CrudField.cjs.js"),w=require("../util/CrudUtil.cjs.js"),M=require("../common/button/Button.cjs.js");function R({searchFields:t=[],fields:g,searchOnChange:
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),o=require("react"),p=require("@ant-design/icons"),l=require("antd"),N=require("./CrudField.cjs.js"),w=require("../util/CrudUtil.cjs.js"),C=require("../context/CrudSearchContext.cjs.js"),M=require("../common/button/Button.cjs.js");function R({searchFields:t=[],fields:g,searchOnChange:a,onSearch:m,searchDefaultValues:b,searchFieldsCustomColumnProps:d}){const y=o.useMemo(()=>t.map(n=>typeof n=="string"?{...g.find(x=>n===x.name),required:!1}:{...g.find(r=>(n==null?void 0:n.name)===r.name),...n}).filter(n=>n&&!(n!=null&&n.hidden)),[t,g]),c=o.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]),j=o.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]),q=o.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]),[u]=l.Form.useForm(),f=o.useCallback(async n=>{if((n||a)&&m){const i=await u.validateFields();m(i)}},[u,m,a]);return o.useEffect(()=>{b&&(u.setFieldsValue(b),f(!0))},[u,b]),t!=null&&t.length?e.jsx(l.Form,{form:u,onFinish:()=>f(!0),layout:"vertical",className:"mb-2",onChange:()=>f(!1),children:e.jsx(C.CrudSearchContextProvider,{search:()=>f(!1),children:e.jsxs(l.Row,{gutter:[4,8],className:"w-100",children:[y.map((n,i)=>{const r=(d==null?void 0:d[i])??{md:c.field,sm:j.field,xs:q.field},x=w.getRealName(n.name);return o.createElement(l.Col,{...r,key:`search_field_${String(x)}`,className:"align-self-end"},e.jsx(N.default,{...n,readonly:!1,fieldClassName:"mb-0"}))}),e.jsx(l.Col,{md:c.button,sm:j.button,xs:q.button,style:{alignSelf:"end"},children:e.jsx(M,{type:"primary",htmlType:"submit",block:!0,icon:e.jsx(p.SearchOutlined,{})})})]})})}):e.jsx(e.Fragment,{})}module.exports=R;
|
|
@@ -5,10 +5,27 @@ export type CrudSearchOption<T> = {
|
|
|
5
5
|
} & ({
|
|
6
6
|
type: "text";
|
|
7
7
|
name: keyof T;
|
|
8
|
+
label?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
fieldClassName?: string;
|
|
8
11
|
} | {
|
|
9
12
|
type: "select";
|
|
10
13
|
name: keyof T;
|
|
11
14
|
multiple?: boolean;
|
|
15
|
+
label?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
fieldClassName?: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: "date";
|
|
20
|
+
name: keyof T;
|
|
21
|
+
label?: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
fieldClassName?: string;
|
|
24
|
+
range?: boolean;
|
|
25
|
+
format?: string;
|
|
26
|
+
disabledFutureDays?: boolean;
|
|
27
|
+
disabledPastDays?: boolean;
|
|
28
|
+
disableToday?: boolean;
|
|
12
29
|
});
|
|
13
30
|
export interface CrudSearchComponentProps<T, FormType> {
|
|
14
31
|
searchFields?: Array<keyof T | CrudSearchOption<T>>;
|
|
@@ -1,79 +1,80 @@
|
|
|
1
|
-
import { jsx as o, Fragment as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { SearchOutlined as
|
|
4
|
-
import { Form as N, Row as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { jsx as o, Fragment as v, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u, useCallback as j, useEffect as C, createElement as E } from "react";
|
|
3
|
+
import { SearchOutlined as R } from "@ant-design/icons";
|
|
4
|
+
import { Form as N, Row as _, Col as w } from "antd";
|
|
5
|
+
import q from "./CrudField.es.js";
|
|
6
|
+
import B from "../util/CrudUtil.es.js";
|
|
7
|
+
import { CrudSearchContextProvider as M } from "../context/CrudSearchContext.es.js";
|
|
7
8
|
import T from "../common/button/Button.es.js";
|
|
8
|
-
function
|
|
9
|
+
function J({
|
|
9
10
|
searchFields: t = [],
|
|
10
|
-
fields:
|
|
11
|
-
searchOnChange:
|
|
12
|
-
onSearch:
|
|
13
|
-
searchDefaultValues:
|
|
14
|
-
searchFieldsCustomColumnProps:
|
|
11
|
+
fields: i,
|
|
12
|
+
searchOnChange: p,
|
|
13
|
+
onSearch: g,
|
|
14
|
+
searchDefaultValues: b,
|
|
15
|
+
searchFieldsCustomColumnProps: r
|
|
15
16
|
}) {
|
|
16
|
-
const k =
|
|
17
|
+
const k = u(
|
|
17
18
|
() => t.map((n) => typeof n == "string" ? {
|
|
18
|
-
...
|
|
19
|
+
...i.find((d) => n === d.name),
|
|
19
20
|
required: !1
|
|
20
21
|
} : {
|
|
21
|
-
...
|
|
22
|
-
(
|
|
22
|
+
...i.find(
|
|
23
|
+
(l) => (n == null ? void 0 : n.name) === l.name
|
|
23
24
|
),
|
|
24
25
|
...n
|
|
25
26
|
}).filter((n) => n && !(n != null && n.hidden)),
|
|
26
|
-
[t,
|
|
27
|
-
),
|
|
27
|
+
[t, i]
|
|
28
|
+
), a = u(
|
|
28
29
|
() => 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 },
|
|
29
30
|
[t.length]
|
|
30
|
-
),
|
|
31
|
+
), y = u(
|
|
31
32
|
() => 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 },
|
|
32
33
|
[t.length]
|
|
33
|
-
), x =
|
|
34
|
+
), x = u(
|
|
34
35
|
() => 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 },
|
|
35
36
|
[t.length]
|
|
36
|
-
), [f] = N.useForm(),
|
|
37
|
+
), [f] = N.useForm(), e = j(
|
|
37
38
|
async (n) => {
|
|
38
|
-
if ((n ||
|
|
39
|
+
if ((n || p) && g) {
|
|
39
40
|
const m = await f.validateFields();
|
|
40
|
-
|
|
41
|
+
g(m);
|
|
41
42
|
}
|
|
42
43
|
},
|
|
43
|
-
[f,
|
|
44
|
+
[f, g, p]
|
|
44
45
|
);
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
}, [f,
|
|
46
|
+
return C(() => {
|
|
47
|
+
b && (f.setFieldsValue(b), e(!0));
|
|
48
|
+
}, [f, b]), t != null && t.length ? /* @__PURE__ */ o(
|
|
48
49
|
N,
|
|
49
50
|
{
|
|
50
51
|
form: f,
|
|
51
|
-
onFinish: () =>
|
|
52
|
+
onFinish: () => e(!0),
|
|
52
53
|
layout: "vertical",
|
|
53
54
|
className: "mb-2",
|
|
54
|
-
onChange: () =>
|
|
55
|
-
children: /* @__PURE__ */
|
|
55
|
+
onChange: () => e(!1),
|
|
56
|
+
children: /* @__PURE__ */ o(M, { search: () => e(!1), children: /* @__PURE__ */ S(_, { gutter: [4, 8], className: "w-100", children: [
|
|
56
57
|
k.map((n, m) => {
|
|
57
|
-
const
|
|
58
|
-
md:
|
|
59
|
-
sm:
|
|
58
|
+
const l = (r == null ? void 0 : r[m]) ?? {
|
|
59
|
+
md: a.field,
|
|
60
|
+
sm: y.field,
|
|
60
61
|
xs: x.field
|
|
61
|
-
},
|
|
62
|
-
return /* @__PURE__ */
|
|
62
|
+
}, d = B.getRealName(n.name);
|
|
63
|
+
return /* @__PURE__ */ E(
|
|
63
64
|
w,
|
|
64
65
|
{
|
|
65
|
-
...
|
|
66
|
-
key: `search_field_${String(
|
|
66
|
+
...l,
|
|
67
|
+
key: `search_field_${String(d)}`,
|
|
67
68
|
className: "align-self-end"
|
|
68
69
|
},
|
|
69
|
-
/* @__PURE__ */ o(
|
|
70
|
+
/* @__PURE__ */ o(q, { ...n, readonly: !1, fieldClassName: "mb-0" })
|
|
70
71
|
);
|
|
71
72
|
}),
|
|
72
73
|
/* @__PURE__ */ o(
|
|
73
74
|
w,
|
|
74
75
|
{
|
|
75
|
-
md:
|
|
76
|
-
sm:
|
|
76
|
+
md: a.button,
|
|
77
|
+
sm: y.button,
|
|
77
78
|
xs: x.button,
|
|
78
79
|
style: { alignSelf: "end" },
|
|
79
80
|
children: /* @__PURE__ */ o(
|
|
@@ -82,15 +83,15 @@ function I({
|
|
|
82
83
|
type: "primary",
|
|
83
84
|
htmlType: "submit",
|
|
84
85
|
block: !0,
|
|
85
|
-
icon: /* @__PURE__ */ o(
|
|
86
|
+
icon: /* @__PURE__ */ o(R, {})
|
|
86
87
|
}
|
|
87
88
|
)
|
|
88
89
|
}
|
|
89
90
|
)
|
|
90
|
-
] })
|
|
91
|
+
] }) })
|
|
91
92
|
}
|
|
92
|
-
) : /* @__PURE__ */ o(
|
|
93
|
+
) : /* @__PURE__ */ o(v, {});
|
|
93
94
|
}
|
|
94
95
|
export {
|
|
95
|
-
|
|
96
|
+
J as default
|
|
96
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const a=require("react/jsx-runtime"),j=require("../common/text-field/TextArea.cjs.js"),F=require("../common/rich/index.cjs.js"),R=require("antd"),p=require("../util/CrudUtil.cjs.js"),A=({onChange:s,label:o,required:i,rules:l,name:c,updatable:n=!0,formLayoutProps:d,maxLength:t,rows:m,cols:f,...e})=>{const x=R.Form.useFormInstance(),C=p.getRealName(c,"upsertFieldName");if(e.rich)return a.jsx(F.RichTextEditor,{name:C,label:o,required:i,rules:l,disabled:!n,help:e.fieldHelper,formLayoutProps:d,rows:m,cols:f});{const{placeholder:N,rows:h,cols:q,fieldClassName:w,fieldTooltip:T}=e;return a.jsx(j.default,{...d,maxLength:t,showCount:!!(t&&t>0),rules:l,placeholder:N,onChange:s?r=>{var u;return s((u=r==null?void 0:r.target)==null?void 0:u.value,x)}:void 0,tooltip:T,required:i,disabled:!n,name:c,label:o,className:w,rows:h,cols:q,help:e.fieldHelper})}};module.exports=A;
|
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
2
|
import F from "../common/text-field/TextArea.es.js";
|
|
3
|
-
import { RichTextEditor as
|
|
4
|
-
import { Form as
|
|
5
|
-
import
|
|
3
|
+
import { RichTextEditor as A } from "../common/rich/index.es.js";
|
|
4
|
+
import { Form as H } from "antd";
|
|
5
|
+
import R from "../util/CrudUtil.es.js";
|
|
6
6
|
const b = ({
|
|
7
7
|
onChange: t,
|
|
8
|
-
label:
|
|
9
|
-
required:
|
|
10
|
-
rules:
|
|
11
|
-
name:
|
|
12
|
-
updatable:
|
|
13
|
-
formLayoutProps:
|
|
14
|
-
maxLength:
|
|
15
|
-
rows:
|
|
8
|
+
label: i,
|
|
9
|
+
required: l,
|
|
10
|
+
rules: s,
|
|
11
|
+
name: m,
|
|
12
|
+
updatable: d = !0,
|
|
13
|
+
formLayoutProps: c,
|
|
14
|
+
maxLength: o,
|
|
15
|
+
rows: a,
|
|
16
16
|
cols: p,
|
|
17
17
|
...e
|
|
18
18
|
}) => {
|
|
19
|
-
const
|
|
19
|
+
const u = H.useFormInstance(), C = R.getRealName(m, "upsertFieldName");
|
|
20
20
|
if (e.rich)
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
21
|
+
return /* @__PURE__ */ f(
|
|
22
|
+
A,
|
|
23
23
|
{
|
|
24
|
-
name:
|
|
25
|
-
label:
|
|
26
|
-
required:
|
|
27
|
-
rules:
|
|
28
|
-
disabled: !
|
|
24
|
+
name: C,
|
|
25
|
+
label: i,
|
|
26
|
+
required: l,
|
|
27
|
+
rules: s,
|
|
28
|
+
disabled: !d,
|
|
29
29
|
help: e.fieldHelper,
|
|
30
|
-
formLayoutProps:
|
|
31
|
-
rows:
|
|
30
|
+
formLayoutProps: c,
|
|
31
|
+
rows: a,
|
|
32
32
|
cols: p
|
|
33
33
|
}
|
|
34
34
|
);
|
|
35
35
|
{
|
|
36
|
-
const { placeholder:
|
|
37
|
-
return /* @__PURE__ */
|
|
36
|
+
const { placeholder: N, rows: h, cols: w, fieldClassName: T, fieldTooltip: x } = e;
|
|
37
|
+
return /* @__PURE__ */ f(
|
|
38
38
|
F,
|
|
39
39
|
{
|
|
40
|
-
...
|
|
41
|
-
maxLength:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
...c,
|
|
41
|
+
maxLength: o,
|
|
42
|
+
showCount: !!(o && o > 0),
|
|
43
|
+
rules: s,
|
|
44
|
+
placeholder: N,
|
|
45
|
+
onChange: t ? (r) => {
|
|
46
|
+
var n;
|
|
47
|
+
return t((n = r == null ? void 0 : r.target) == null ? void 0 : n.value, u);
|
|
47
48
|
} : void 0,
|
|
48
|
-
tooltip:
|
|
49
|
-
required:
|
|
50
|
-
disabled: !
|
|
51
|
-
name:
|
|
52
|
-
label:
|
|
49
|
+
tooltip: x,
|
|
50
|
+
required: l,
|
|
51
|
+
disabled: !d,
|
|
52
|
+
name: m,
|
|
53
|
+
label: i,
|
|
53
54
|
className: T,
|
|
54
|
-
rows:
|
|
55
|
-
cols:
|
|
55
|
+
rows: h,
|
|
56
|
+
cols: w,
|
|
56
57
|
help: e.fieldHelper
|
|
57
58
|
}
|
|
58
59
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={str:{delete:"Delete",clone:"Clone",update:"Update",new:"New",back:"Back",next:"Next",save:"Save",import:"Import",cancel:"Cancel",print:"Print",hide:"Hide",no:"No",action:"Action",remove:"Remove",view:"View",ok:"Ok",yes:"Yes",warning:"Warning",success:"Success",error:"Error",retry:"Retry",previous:"Previous",unhide:"Unhide",downloadCsvTemplate:"Download CSV Template",importCsvFile:"Import CSV File",export:"Export",goBack:"Go Back",refresh:"Refresh",fileUploadMessage1:"Drag file here or ",fileUploadMessage2:"Click to Upload",rotateLeft:"Rotate Left",rotateRight:"Rotate Right",flipHorizontal:"Flip Horizontal",flipVertical:"Flip Vertical",skipCrop:"Skip Crop",showFields:"Show Fields"},err:{save:"An error occurred while saving",validation:{required:"is required",minLength8:"must be at least 8 characters",percentage:"must be a percentage",maximumValueExceeded:"must be less than %maxValue%",invalidNic:"must be a valid NIC",invalid:"must be a valid"},notFound:"Not Found"},message:{loading:{saving:"Saving"},uploadButtonText:"Click to Upload"},qus:{importWithIssues:"Some fields have issues. Do you want to proceed with the import?",doYouWantToDelete:"Do you want to delete?",doYouWantToHide:"Do you want to hide?",doYouWantToUnhide:"Do you want to unhide?"}};module.exports=e;
|
|
1
|
+
"use strict";const e={str:{delete:"Delete",clone:"Clone",update:"Update",new:"New",back:"Back",next:"Next",save:"Save",import:"Import",cancel:"Cancel",print:"Print",hide:"Hide",no:"No",action:"Action",remove:"Remove",view:"View",ok:"Ok",yes:"Yes",warning:"Warning",success:"Success",error:"Error",retry:"Retry",previous:"Previous",unhide:"Unhide",downloadCsvTemplate:"Download CSV Template",importCsvFile:"Import CSV File",export:"Export",goBack:"Go Back",refresh:"Refresh",fileUploadMessage1:"Drag file here or ",fileUploadMessage2:"Click to Upload",rotateLeft:"Rotate Left",rotateRight:"Rotate Right",flipHorizontal:"Flip Horizontal",flipVertical:"Flip Vertical",skipCrop:"Skip Crop",showFields:"Show Fields"},err:{save:"An error occurred while saving",validation:{required:"is required",minLength8:"must be at least 8 characters",percentage:"must be a percentage",maximumValueExceeded:"must be less than %maxValue%",invalidNic:"must be a valid NIC",invalid:"must be a valid",integer:"must be an integer"},notFound:"Not Found"},message:{loading:{saving:"Saving"},uploadButtonText:"Click to Upload"},qus:{importWithIssues:"Some fields have issues. Do you want to proceed with the import?",doYouWantToDelete:"Do you want to delete?",doYouWantToHide:"Do you want to hide?",doYouWantToUnhide:"Do you want to unhide?"}};module.exports=e;
|
|
@@ -45,7 +45,8 @@ const e = {
|
|
|
45
45
|
percentage: "must be a percentage",
|
|
46
46
|
maximumValueExceeded: "must be less than %maxValue%",
|
|
47
47
|
invalidNic: "must be a valid NIC",
|
|
48
|
-
invalid: "must be a valid"
|
|
48
|
+
invalid: "must be a valid",
|
|
49
|
+
integer: "must be an integer"
|
|
49
50
|
},
|
|
50
51
|
notFound: "Not Found"
|
|
51
52
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i={minimumFractionDigits:2,maximumFractionDigits:2},a={minimumFractionDigits:0,maximumFractionDigits:0};function u(t=0){return(+t).toLocaleString("en",i)}function c(t=0,
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i={minimumFractionDigits:2,maximumFractionDigits:2},a={minimumFractionDigits:0,maximumFractionDigits:0};function u(t=0){return(+t).toLocaleString("en",i)}function c(t=0,r=2){const n=e(t,r);return isNaN(n)?void 0:n}function e(t=0,r=2){switch(t=+t,(typeof r!="number"||r<0)&&(r=2),r){case 0:return Math.round(t);case 1:return Math.round(t*10)/10;case 2:return Math.round(t*100)/100;case 3:return Math.round(t*1e3)/1e3;case 4:return Math.round(t*1e4)/1e4;default:{const n=Math.pow(10,r);return Math.round(t*n)/n}}}function s(t,r=!1){if(isNaN(t)||t===null)return"";const n=Math.floor(t);return r?n.toLocaleString("en",a):n.toString()}function l(t=1e9){return Math.floor(Math.random()*(t+1))}function o(t){const r=Number(t);return isNaN(r)?0:r}function d(t=0){const r=t.toString();if(!r.includes("."))return t;const n=r.replace(/\.?0+$/,"");return Number(n)}const f={toInt:s,round:e,toMoney:u,randInt:l,withoutNan:o,removeTrailingZeros:d,roundNoNan:c};exports.default=f;exports.withoutNan=o;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare function toMoney(num?: number): string;
|
|
2
2
|
declare function roundNoNan(num?: number, pow?: number): number | undefined;
|
|
3
3
|
declare function round(num?: number, pow?: number): number;
|
|
4
|
-
declare function toInt(num
|
|
4
|
+
declare function toInt(num: number, formatted?: boolean): string;
|
|
5
5
|
declare function randInt(max?: number): number;
|
|
6
6
|
export declare function withoutNan(value: number): number;
|
|
7
7
|
declare function removeTrailingZeros(num?: number): number;
|
|
@@ -27,7 +27,8 @@ function e(t = 0, n = 2) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function c(t
|
|
30
|
+
function c(t, n = !1) {
|
|
31
|
+
if (isNaN(t) || t === null) return "";
|
|
31
32
|
const r = Math.floor(t);
|
|
32
33
|
return n ? r.toLocaleString("en", i) : r.toString();
|
|
33
34
|
}
|
|
@@ -45,7 +46,7 @@ function f(t = 0) {
|
|
|
45
46
|
const r = n.replace(/\.?0+$/, "");
|
|
46
47
|
return Number(r);
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
+
const l = {
|
|
49
50
|
toInt: c,
|
|
50
51
|
round: e,
|
|
51
52
|
toMoney: a,
|
|
@@ -55,6 +56,6 @@ const m = {
|
|
|
55
56
|
roundNoNan: u
|
|
56
57
|
};
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
+
l as default,
|
|
59
60
|
d as withoutNan
|
|
60
61
|
};
|