1mpacto-react-ui 2.0.19 → 2.0.21
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/assets/style.css +1 -1
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.mjs +40 -40
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +3 -3
- package/dist/components/Breadcrumbs/Breadcrumbs.mjs +43 -43
- package/dist/components/ButtonPopover/ButtonPopover.cjs +1 -1
- package/dist/components/ButtonPopover/ButtonPopover.mjs +28 -31
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.mjs +98 -100
- package/dist/components/Calendar/CalendarMonth.cjs +1 -1
- package/dist/components/Calendar/CalendarMonth.mjs +41 -42
- package/dist/components/Calendar/CalendarRange.cjs +1 -1
- package/dist/components/Calendar/CalendarRange.mjs +59 -61
- package/dist/components/Calendar/CalendarYear.cjs +2 -2
- package/dist/components/Calendar/CalendarYear.mjs +37 -38
- package/dist/components/Chart/DoughnutChart.cjs +1 -1
- package/dist/components/Chart/DoughnutChart.mjs +93 -96
- package/dist/components/Chart/GradientBarChart.cjs +1 -1
- package/dist/components/Chart/GradientBarChart.mjs +80 -81
- package/dist/components/Chart/GradientLineChart.cjs +1 -1
- package/dist/components/Chart/GradientLineChart.mjs +50 -51
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.mjs +23 -23
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.mjs +45 -48
- package/dist/components/Collapse/Collapse.cjs +1 -1
- package/dist/components/Collapse/Collapse.mjs +23 -24
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +86 -89
- package/dist/components/DatePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DatePicker/DateRangePicker.mjs +91 -92
- package/dist/components/DatePicker/FilterDate.cjs +1 -1
- package/dist/components/DatePicker/FilterDate.mjs +107 -110
- package/dist/components/DatePicker/MonthYearPicker.cjs +1 -1
- package/dist/components/DatePicker/MonthYearPicker.mjs +51 -53
- package/dist/components/FilterContainer/FilterContainer.cjs +1 -1
- package/dist/components/FilterContainer/FilterContainer.mjs +27 -27
- package/dist/components/Input/InputFloatingInner.cjs +5 -5
- package/dist/components/Input/InputFloatingInner.mjs +24 -25
- package/dist/components/NumberFormat/NumberFormat.cjs +1 -1
- package/dist/components/NumberFormat/NumberFormat.mjs +12 -13
- package/dist/components/Pagination/Pagination.cjs +2 -2
- package/dist/components/Pagination/Pagination.mjs +76 -80
- package/dist/components/SelectDropdownContainer/SelectDropdownContainer.cjs +1 -1
- package/dist/components/SelectDropdownContainer/SelectDropdownContainer.mjs +98 -102
- package/dist/components/Sidebar/ItemSidebar.cjs +8 -8
- package/dist/components/Sidebar/ItemSidebar.mjs +71 -72
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.mjs +65 -68
- package/dist/components/Step/Step.cjs +5 -5
- package/dist/components/Step/Step.mjs +52 -52
- package/dist/components/Table/Table.cjs +3 -3
- package/dist/components/Table/Table.mjs +275 -298
- package/dist/components/Table/TableSubMobile.cjs +1 -1
- package/dist/components/Table/TableSubMobile.mjs +32 -35
- package/dist/components/Tabs/Tabs.cjs +8 -8
- package/dist/components/Tabs/Tabs.mjs +66 -70
- package/dist/components/Textarea/Textarea.cjs +7 -7
- package/dist/components/Textarea/Textarea.mjs +47 -50
- package/dist/components/Textarea/TextareaFloatingInner.cjs +6 -6
- package/dist/components/Textarea/TextareaFloatingInner.mjs +56 -61
- package/dist/components/Textarea/TextareaInnerLabel.cjs +6 -6
- package/dist/components/Textarea/TextareaInnerLabel.mjs +47 -50
- package/dist/components/TimeRange/TimeRange.cjs +1 -1
- package/dist/components/TimeRange/TimeRange.mjs +88 -91
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.mjs +44 -46
- package/dist/components/Upload/UploadFile.cjs +1 -1
- package/dist/components/Upload/UploadFile.mjs +50 -54
- package/dist/components/Upload/UploadImage.cjs +3 -3
- package/dist/components/Upload/UploadImage.mjs +62 -68
- package/dist/components/Upload/UploadMultipleFile.cjs +1 -1
- package/dist/components/Upload/UploadMultipleFile.mjs +61 -62
- package/dist/components/Virtualization/ListVirtualization.cjs +1 -1
- package/dist/components/Virtualization/ListVirtualization.mjs +52 -55
- package/dist/components/Virtualization/TableVirtualization.cjs +1 -1
- package/dist/components/Virtualization/TableVirtualization.mjs +56 -59
- package/dist/config/components/tinymce.cjs +2 -2
- package/dist/config/components/tinymce.mjs +3 -3
- package/dist/hooks/useCountdown.cjs +1 -1
- package/dist/hooks/useCountdown.mjs +15 -15
- package/dist/hooks/useDebounce.cjs +1 -0
- package/dist/hooks/useDebounce.mjs +27 -0
- package/dist/hooks/useOtpInput.cjs +1 -1
- package/dist/hooks/useOtpInput.mjs +47 -51
- package/dist/hooks/usePacked.cjs +1 -0
- package/dist/hooks/usePacked.mjs +56 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +52 -48
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.d.ts +5 -4
- package/dist/package.json.mjs +1 -1
- package/dist/src/hooks/index.d.ts +4 -2
- package/dist/src/hooks/useDebounce.d.ts +61 -0
- package/dist/src/hooks/usePacked.d.ts +84 -0
- package/dist/utils/common.cjs +1 -1
- package/dist/utils/common.mjs +172 -173
- package/package.json +4 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* [ID] : Interface untuk opsi konfigurasi hook usePacked.
|
|
4
|
+
* [EN] : Interface for usePacked hook configuration options.
|
|
5
|
+
*/
|
|
6
|
+
export interface IUsePackedOptions {
|
|
7
|
+
/**
|
|
8
|
+
* [ID] : Jumlah kolom layout.
|
|
9
|
+
* [EN] : Layout column count.
|
|
10
|
+
*/
|
|
11
|
+
columns: number;
|
|
12
|
+
/**
|
|
13
|
+
* [ID] : Jarak horizontal antar item.
|
|
14
|
+
* [EN] : Horizontal gap between items.
|
|
15
|
+
*/
|
|
16
|
+
gapX: number;
|
|
17
|
+
/**
|
|
18
|
+
* [ID] : Jarak vertikal antar item.
|
|
19
|
+
* [EN] : Vertical gap between items.
|
|
20
|
+
*/
|
|
21
|
+
gapY: number;
|
|
22
|
+
/**
|
|
23
|
+
* [ID] : Aktifkan animasi transisi (opsional).
|
|
24
|
+
* [EN] : Enable transition animation (optional).
|
|
25
|
+
*/
|
|
26
|
+
animationEnabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* [ID] : Map nama breakpoint ke lebar minimum (opsional).
|
|
29
|
+
* [EN] : Map of breakpoint name to minimum width (optional).
|
|
30
|
+
*/
|
|
31
|
+
breakpoints?: Record<string, number>;
|
|
32
|
+
/**
|
|
33
|
+
* [ID] : Orientasi penempatan item (opsional).
|
|
34
|
+
* [EN] : Item placement orientation (optional).
|
|
35
|
+
*/
|
|
36
|
+
orientation?: 'top-bottom' | 'bottom-top';
|
|
37
|
+
/**
|
|
38
|
+
* [ID] : Arah layout (opsional).
|
|
39
|
+
* [EN] : Layout direction (optional).
|
|
40
|
+
*/
|
|
41
|
+
direction?: 'ltr' | 'rtl';
|
|
42
|
+
/**
|
|
43
|
+
* [ID] : Waktu debounce untuk resize event dalam milidetik (opsional, default: 150).
|
|
44
|
+
* [EN] : Debounce wait for resize event in milliseconds (optional, default: 150).
|
|
45
|
+
*/
|
|
46
|
+
debounceResize?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* [ID] : Interface untuk return value hook usePacked.
|
|
50
|
+
* [EN] : Interface for usePacked hook return value.
|
|
51
|
+
*/
|
|
52
|
+
export interface IUsePackedReturn {
|
|
53
|
+
/**
|
|
54
|
+
* [ID] : Referensi elemen kontainer DOM.
|
|
55
|
+
* [EN] : DOM container element reference.
|
|
56
|
+
*/
|
|
57
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
58
|
+
/**
|
|
59
|
+
* [ID] : Tinggi kontainer yang dihitung.
|
|
60
|
+
* [EN] : Calculated container height.
|
|
61
|
+
*/
|
|
62
|
+
containerHeight: number;
|
|
63
|
+
/**
|
|
64
|
+
* [ID] : Fungsi untuk menghitung ulang layout secara manual.
|
|
65
|
+
* [EN] : Function to manually recalculate layout.
|
|
66
|
+
*/
|
|
67
|
+
recalculate: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* [ID] : Type fungsi hook usePacked.
|
|
71
|
+
* [EN] : usePacked hook function type.
|
|
72
|
+
* @param options - [ID] : Opsi konfigurasi layout. [EN] : Layout configuration options.
|
|
73
|
+
* @param dependencies - [ID] : Daftar dependensi untuk memicu hitung ulang.
|
|
74
|
+
* [EN] : Dependency list to trigger recalculation.
|
|
75
|
+
* @returns [ID] : Referensi kontainer, tinggi kontainer, dan fungsi hitung ulang.
|
|
76
|
+
* [EN] : Container ref, container height, and recalculate function.
|
|
77
|
+
*/
|
|
78
|
+
export type TUsePacked = (options: IUsePackedOptions, dependencies?: React.DependencyList) => IUsePackedReturn;
|
|
79
|
+
/**
|
|
80
|
+
* [ID] : Hook untuk mengatur layout packed/grid dengan penempatan item otomatis berdasarkan kolom terpendek.
|
|
81
|
+
* [EN] : Hook to manage packed/grid layout with automatic item placement based on shortest column.
|
|
82
|
+
*/
|
|
83
|
+
declare const usePacked: TUsePacked;
|
|
84
|
+
export default usePacked;
|
package/dist/utils/common.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("date-fns"),g=require("date-fns/locale"),N=require("../config/bigNumber/index.cjs"),b=require("node-forge"),D=e=>{try{return N.BigNumber(e).isFinite()}catch{return!1}},F=e=>{if(typeof e=="number"&&Number.isFinite(e))return!0;if(typeof e=="string"&&e.trim()!==""&&!isNaN(Number(e))){const r=Number(e);return Number.isFinite(r)}return!1};function j(e,r){const{minimumFractionDigits:n,instance:t=!1,ignoreFractionLimit:o=!1}=r||{};let{maximumFractionDigits:i=2}=r||{};D(e)||(e="0"),!o&&n!==void 0&&n>i&&(i=n);let c="";if(o?c=N.BigNumber(e).toString():c=N.BigNumber(e).toFixed(i),c.includes(".")&&!o){const[s,a]=c.split(".");let u=a.replace(/0+$/,"");n!==void 0&&n>=0&&(u=u.padEnd(n,"0")),c=u?`${s}.${u}`:s}return t?N.BigNumber(c):c}const S=(e,r=2)=>{let n=parseFloat(F(e)?e:0);return n=(+(Math.round(n+"e"+r)+"e-"+r)).toFixed(r),n=Number(n),n};function E(e,r="currency",n){const{minimumFractionDigits:t=0,locale:o="id-ID",currency:i="IDR",withSpace:c=!1}=n||{},s=new Intl.NumberFormat(o,{style:r,currency:i,minimumFractionDigits:t}).format(S(e,t>0?t:2));return c?s:s.replace(/\s/g,"")}const B=(e,r,n,t)=>{const o={"id-ID":g.id,"zh-CN":g.zhCN,"en-US":g.enUS,"nl-BE":g.nl};let i=n??"-";return e&&!isNaN(new Date(e).getTime())&&(i=M.format(e,r??"dd/MM/yyyy",{locale:o[t??"id-ID"]})),i},I=(e,r,n,t,o,i)=>{const c={"id-ID":g.id,"zh-CN":g.zhCN,"en-US":g.enUS,"nl-NL":g.nl};if(e&&!isNaN(new Date(e).getTime())){const s=M.format(e,n??"dd/MM/yyyy",{locale:c[i??"id-ID"]});if(r&&!isNaN(new Date(r).getTime())){const a=M.format(r,n??"dd/MM/yyyy",{locale:c[i??"id-ID"]});return s===a?s:`${s}${t??"-"}${a}`}return s}return o??"-"},K=(e,r)=>e.reduce((n,t)=>{const o=String(t[r]);return n[o]||(n[o]=[]),n[o].push(t),n},{}),V=({value:e,keyDate:r="date",keyFormat:n="formatDate",format:t="dd/MM/yyyy"})=>{const o=e.map(i=>({...i,[n]:B(i[r],t)}));return K(o,n)},C=e=>(Object.keys(e).forEach(r=>{["",null,void 0,[],{}].includes(e[r])&&delete e[r]}),e),L=(e,r)=>{const n=/^-?\d+[0-9.,]*$/,t=/([.])(?=.*\1)/,o=/([,])(?=.*\1)/,i=e.split(",")[0]?.trim()||"",c=e.split(",")[1]?.trim()||"",s=!t.test(i)&&(i==="-"||n.test(i)||!i),a=!t.test(c)&&(c==="-"||n.test(c)||!c),u=(l,p,y)=>{let d=l;const A=l.split(".")[0];return isNaN(parseFloat(A.split(".")[0]))||(parseFloat(A.split(".")[0])<=p?d=`${p}`:parseFloat(A)>=y&&(d=`${y}`)),d},f=u(i,r?.latMin??-85,r?.latMax??85),m=u(c,r?.longMin??-180,r?.longMax??180);return{latitude:f,longitude:m,latlong:`${f}${e.includes(",")?","+m:""}`,isValid:!o.test(e)&&s&&a}},R=(e,r)=>e?Object.fromEntries(Object.entries(r).filter(([t])=>t.startsWith(e))):r,w=(e,r)=>e.map(n=>n[r]).join(","),T=(e,r)=>e.map(n=>n[r]),P=(e,r)=>Array.isArray(e)?e?.map((n,t,o)=>typeof r=="function"?r(n,t,o):n):[],q=(e,r,n,t,o)=>Array.isArray(e)?{[r]:e?.map((i,c,s)=>typeof n=="function"?n(i,c,s):i),[`${r}-val-be`]:i=>t==="array-of-object-to-array"?T(i,o):w(i,o)}:{[r]:"",[`${r}-val-be`]:()=>""};function x(e,r){if(e===r)return!0;if(typeof e!="object"||typeof r!="object"||e===null||r===null)return!1;const n=Object.keys(e),t=Object.keys(r);if(n.length!==t.length)return!1;for(const o of n)if(!t.includes(o)||!x(e[o],r[o]))return!1;return!0}function v(e,r={maxTime:"hour"}){const{maxTime:n="hour"}=r,t=a=>a<10?`0${a}`:a;let o=t(0),i=t(0);const c=t(Math.floor(e%3600/60)),s=t(Math.floor(e%60));return n==="hour"?i=t(Math.floor(e/3600)):n==="day"&&(o=t(Math.floor(e/(3600*24))),i=t(Math.floor(e%(3600*24)/3600))),{day:o,hour:i,minute:c,second:s}}function h(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function $(e,...r){if(!r.length)return e;const n=r.shift();if(h(e)&&h(n))for(const t in n)h(n[t])?(e[t]||Object.assign(e,{[t]:{}}),$(e[t],n[t])):Object.assign(e,{[t]:n[t]});return $(e,...r)}function O(e,r){const n=r.match(/[^.[\]]+/g);if(!n||n.length===0)return;const t=(o,i)=>{if(typeof o!="object"||o===null||i.length===0)return;const c=o,s=i[0],a=i.slice(1);if(a.length===0){delete c[s];return}const u=c[s];if(s==="*"&&Array.isArray(c)){for(const f of c)t(f,a);return}t(u,a)};t(e,n)}function z(e,r){if(!e||!r)return e;if(Array.isArray(r))for(const n of r)O(e,n);else O(e,r);return e}function J(e,r){const n=JSON.parse(JSON.stringify(e));if(Array.isArray(r))for(const t of r)O(n,t);else O(n,r);return n}function U(e,r,n={}){const t=n.arrayMergeStrategy||"combine",o=(n.keepKeys||[]).map(s=>s.match(/[^.[\]]+/g)||[]),i=s=>o.some(a=>a.length!==s.length?!1:a.every((u,f)=>u===s[f]));function c(s,a,u){if(u.length>0&&i(u))return s;if(Array.isArray(a)&&Array.isArray(s)){if(t==="overwrite")return[...a];const f=t==="sync"?a.length:Math.max(s.length,a.length),m=new Array(f);for(let l=0;l<f;l++){const p=[...u,String(l)],y=s[l],d=a[l];if(l>=a.length){m[l]=y;continue}if(l>=s.length){m[l]=d;continue}m[l]=c(y,d,p)}return m}if(h(a)&&h(s)){const f={...s};return Object.keys(a).forEach(m=>{const l=[...u,m],p=a[m],y=s[m];f[m]=c(y,p,l)}),f}return a===void 0?s:a}return c(e,r,[])}const H=e=>S(e||0),W=e=>j(e||0),G=(e,r)=>j(e||0,r),Q=e=>isNaN(e)?void 0:e,X=e=>{const r=e.toString().split(""),n=r[1]!=="0"?`,${r[1]}`:"";let[t]=e.toString().split(".");return t=t.replaceAll("-",""),t.length>=15?`${+t.substring(0,3)} T`:t.length===14?`${+t.substring(0,2)} T`:t.length===13?`${+t.substring(0,1)}${n} T`:t.length===12?`${+t.substring(0,3)} M`:t.length===11?`${+t.substring(0,2)} M`:t.length===10?`${+t.substring(0,1)}${n} M`:t.length===9?`${+t.substring(0,3)} JT`:t.length===8?`${+t.substring(0,2)} JT`:t.length===7?`${+t.substring(0,1)}${n} JT`:t.length===6?`${+t.substring(0,3)} RB`:t.length===5?`${+t.substring(0,2)} RB`:t.length===4?`${+t.substring(0,1)}${n} RB`:t.length<=3?+t?`${+t}`:0:null};function Y(e){if(typeof e!="string")throw new Error("Input harus berupa string");const r=e.split(".");if(r.length===1)return{filename:e,extension:""};const n="."+r[r.length-1];return{filename:r.slice(0,-1).join("."),extension:n}}const Z=e=>(new DOMParser().parseFromString(e||"","text/html").body.textContent??"").toString();function _(e,r){const n=typeof e=="string"?e:JSON.stringify(e),t=b.util.decode64(r.replace(/\s+/g,"")),o=b.util.decode64(t),i=b.asn1.fromDer(o),s=b.pki.publicKeyFromAsn1(i).encrypt(n,"RSA-OAEP",{md:b.md.sha256.create(),mgf1:{md:b.md.sha1.create()}});return b.util.encode64(s)}exports.deepCompareEquals=x;exports.deepMerge=U;exports.deleteKeysImmutable=J;exports.deleteKeysMutable=z;exports.encryptRSAOAEP=_;exports.extractElementStringToOriginalValue=Z;exports.formatDate=B;exports.formatDateRange=I;exports.formatNumber=E;exports.groupByKey=K;exports.isAccurateBigNumber=D;exports.isAccurateNumber=F;exports.isObject=h;exports.mergeObjects=$;exports.parseBigDecimal=j;exports.parseDecimal=S;exports.parseFileName=Y;exports.removeKeyObjectEmptyValue=C;exports.sanitizeObjectKeyPrefix=R;exports.setDigit=X;exports.transformArrayMapping=P;exports.transformArrayMappingObjectFC=q;exports.transformArrayOfObjectToArray=T;exports.transformArrayOfObjectToString=w;exports.transformBigNumber=W;exports.transformBigNumberOpt=G;exports.transformDataHistory=V;exports.transformLatLong=L;exports.transformNumber=H;exports.transformSecondTime=v;exports.transfromIsNan=Q;
|
package/dist/utils/common.mjs
CHANGED
|
@@ -1,264 +1,263 @@
|
|
|
1
|
-
import { format as
|
|
2
|
-
import { nl as
|
|
3
|
-
import { BigNumber as
|
|
1
|
+
import { format as $ } from "date-fns";
|
|
2
|
+
import { nl as O, enUS as j, zhCN as S, id as w } from "date-fns/locale";
|
|
3
|
+
import { BigNumber as b } from "../config/bigNumber/index.mjs";
|
|
4
4
|
import y from "node-forge";
|
|
5
|
-
const
|
|
5
|
+
const x = (e) => {
|
|
6
6
|
try {
|
|
7
|
-
return
|
|
7
|
+
return b(e).isFinite();
|
|
8
8
|
} catch {
|
|
9
9
|
return !1;
|
|
10
10
|
}
|
|
11
|
-
},
|
|
11
|
+
}, K = (e) => {
|
|
12
12
|
if (typeof e == "number" && Number.isFinite(e))
|
|
13
13
|
return !0;
|
|
14
14
|
if (typeof e == "string" && e.trim() !== "" && !isNaN(Number(e))) {
|
|
15
|
-
const
|
|
16
|
-
return Number.isFinite(
|
|
15
|
+
const r = Number(e);
|
|
16
|
+
return Number.isFinite(r);
|
|
17
17
|
}
|
|
18
18
|
return !1;
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
const { minimumFractionDigits: n, instance:
|
|
22
|
-
let { maximumFractionDigits: i = 2 } =
|
|
23
|
-
|
|
20
|
+
function D(e, r) {
|
|
21
|
+
const { minimumFractionDigits: n, instance: t = !1, ignoreFractionLimit: o = !1 } = r || {};
|
|
22
|
+
let { maximumFractionDigits: i = 2 } = r || {};
|
|
23
|
+
x(e) || (e = "0"), !o && n !== void 0 && n > i && (i = n);
|
|
24
24
|
let c = "";
|
|
25
|
-
if (
|
|
26
|
-
const [
|
|
25
|
+
if (o ? c = b(e).toString() : c = b(e).toFixed(i), c.includes(".") && !o) {
|
|
26
|
+
const [s, u] = c.split(".");
|
|
27
27
|
let l = u.replace(/0+$/, "");
|
|
28
|
-
n !== void 0 && n >= 0 && (l = l.padEnd(n, "0")), c = l ? `${
|
|
28
|
+
n !== void 0 && n >= 0 && (l = l.padEnd(n, "0")), c = l ? `${s}.${l}` : s;
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return t ? b(c) : c;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
let n = parseFloat(
|
|
34
|
-
return n = (+(Math.round(n + "e" +
|
|
32
|
+
const F = (e, r = 2) => {
|
|
33
|
+
let n = parseFloat(K(e) ? e : 0);
|
|
34
|
+
return n = (+(Math.round(n + "e" + r) + "e-" + r)).toFixed(r), n = Number(n), n;
|
|
35
35
|
};
|
|
36
|
-
function
|
|
37
|
-
const { minimumFractionDigits:
|
|
38
|
-
style:
|
|
36
|
+
function J(e, r = "currency", n) {
|
|
37
|
+
const { minimumFractionDigits: t = 0, locale: o = "id-ID", currency: i = "IDR", withSpace: c = !1 } = n || {}, s = new Intl.NumberFormat(o, {
|
|
38
|
+
style: r,
|
|
39
39
|
currency: i,
|
|
40
|
-
minimumFractionDigits:
|
|
41
|
-
}).format(
|
|
42
|
-
return c ?
|
|
40
|
+
minimumFractionDigits: t
|
|
41
|
+
}).format(F(e, t > 0 ? t : 2));
|
|
42
|
+
return c ? s : s.replace(/\s/g, "");
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
const
|
|
44
|
+
const T = (e, r, n, t) => {
|
|
45
|
+
const o = { "id-ID": w, "zh-CN": S, "en-US": j, "nl-BE": O };
|
|
46
46
|
let i = n ?? "-";
|
|
47
|
-
return e && !isNaN(new Date(e).getTime()) && (i =
|
|
48
|
-
},
|
|
49
|
-
const c = { "id-ID":
|
|
47
|
+
return e && !isNaN(new Date(e).getTime()) && (i = $(e, r ?? "dd/MM/yyyy", { locale: o[t ?? "id-ID"] })), i;
|
|
48
|
+
}, v = (e, r, n, t, o, i) => {
|
|
49
|
+
const c = { "id-ID": w, "zh-CN": S, "en-US": j, "nl-NL": O };
|
|
50
50
|
if (e && !isNaN(new Date(e).getTime())) {
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
const u =
|
|
54
|
-
return
|
|
51
|
+
const s = $(e, n ?? "dd/MM/yyyy", { locale: c[i ?? "id-ID"] });
|
|
52
|
+
if (r && !isNaN(new Date(r).getTime())) {
|
|
53
|
+
const u = $(r, n ?? "dd/MM/yyyy", { locale: c[i ?? "id-ID"] });
|
|
54
|
+
return s === u ? s : `${s}${t ?? "-"}${u}`;
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return s;
|
|
57
57
|
}
|
|
58
|
-
return
|
|
59
|
-
},
|
|
60
|
-
const
|
|
61
|
-
return n[
|
|
62
|
-
}, {}),
|
|
58
|
+
return o ?? "-";
|
|
59
|
+
}, B = (e, r) => e.reduce((n, t) => {
|
|
60
|
+
const o = String(t[r]);
|
|
61
|
+
return n[o] || (n[o] = []), n[o].push(t), n;
|
|
62
|
+
}, {}), z = ({
|
|
63
63
|
value: e,
|
|
64
|
-
keyDate:
|
|
64
|
+
keyDate: r = "date",
|
|
65
65
|
keyFormat: n = "formatDate",
|
|
66
|
-
format:
|
|
66
|
+
format: t = "dd/MM/yyyy"
|
|
67
67
|
}) => {
|
|
68
|
-
const
|
|
68
|
+
const o = e.map((i) => ({
|
|
69
69
|
...i,
|
|
70
|
-
[n]:
|
|
70
|
+
[n]: T(i[r], t)
|
|
71
71
|
}));
|
|
72
|
-
return
|
|
73
|
-
},
|
|
74
|
-
["", null, void 0, [], {}].includes(e[
|
|
75
|
-
}), e),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, a = l(i, (t == null ? void 0 : t.latMin) ?? -85, (t == null ? void 0 : t.latMax) ?? 85), g = l(c, (t == null ? void 0 : t.longMin) ?? -180, (t == null ? void 0 : t.longMax) ?? 180);
|
|
72
|
+
return B(o, n);
|
|
73
|
+
}, U = (e) => (Object.keys(e).forEach((r) => {
|
|
74
|
+
["", null, void 0, [], {}].includes(e[r]) && delete e[r];
|
|
75
|
+
}), e), q = (e, r) => {
|
|
76
|
+
const n = /^-?\d+[0-9.,]*$/, t = /([.])(?=.*\1)/, o = /([,])(?=.*\1)/, i = e.split(",")[0]?.trim() || "", c = e.split(",")[1]?.trim() || "", s = !t.test(i) && (i === "-" || n.test(i) || !i), u = !t.test(c) && (c === "-" || n.test(c) || !c), l = (a, p, m) => {
|
|
77
|
+
let d = a;
|
|
78
|
+
const A = a.split(".")[0];
|
|
79
|
+
return isNaN(parseFloat(A.split(".")[0])) || (parseFloat(A.split(".")[0]) <= p ? d = `${p}` : parseFloat(A) >= m && (d = `${m}`)), d;
|
|
80
|
+
}, f = l(i, r?.latMin ?? -85, r?.latMax ?? 85), g = l(c, r?.longMin ?? -180, r?.longMax ?? 180);
|
|
82
81
|
return {
|
|
83
|
-
latitude:
|
|
82
|
+
latitude: f,
|
|
84
83
|
longitude: g,
|
|
85
|
-
latlong: `${
|
|
86
|
-
isValid: !
|
|
84
|
+
latlong: `${f}${e.includes(",") ? "," + g : ""}`,
|
|
85
|
+
isValid: !o.test(e) && s && u
|
|
87
86
|
};
|
|
88
|
-
},
|
|
89
|
-
(n,
|
|
90
|
-
) : [],
|
|
91
|
-
[
|
|
92
|
-
(i, c,
|
|
87
|
+
}, H = (e, r) => e ? Object.fromEntries(Object.entries(r).filter(([t]) => t.startsWith(e))) : r, I = (e, r) => e.map((n) => n[r]).join(","), V = (e, r) => e.map((n) => n[r]), W = (e, r) => Array.isArray(e) ? e?.map(
|
|
88
|
+
(n, t, o) => typeof r == "function" ? r(n, t, o) : n
|
|
89
|
+
) : [], G = (e, r, n, t, o) => Array.isArray(e) ? {
|
|
90
|
+
[r]: e?.map(
|
|
91
|
+
(i, c, s) => typeof n == "function" ? n(i, c, s) : i
|
|
93
92
|
),
|
|
94
|
-
[`${
|
|
95
|
-
} : { [
|
|
96
|
-
function
|
|
97
|
-
if (e ===
|
|
98
|
-
if (typeof e != "object" || typeof
|
|
93
|
+
[`${r}-val-be`]: (i) => t === "array-of-object-to-array" ? V(i, o) : I(i, o)
|
|
94
|
+
} : { [r]: "", [`${r}-val-be`]: () => "" };
|
|
95
|
+
function E(e, r) {
|
|
96
|
+
if (e === r) return !0;
|
|
97
|
+
if (typeof e != "object" || typeof r != "object" || e === null || r === null)
|
|
99
98
|
return !1;
|
|
100
|
-
const n = Object.keys(e),
|
|
101
|
-
if (n.length !==
|
|
102
|
-
for (const
|
|
103
|
-
if (!
|
|
99
|
+
const n = Object.keys(e), t = Object.keys(r);
|
|
100
|
+
if (n.length !== t.length) return !1;
|
|
101
|
+
for (const o of n)
|
|
102
|
+
if (!t.includes(o) || !E(e[o], r[o]))
|
|
104
103
|
return !1;
|
|
105
104
|
return !0;
|
|
106
105
|
}
|
|
107
|
-
function
|
|
108
|
-
const { maxTime: n = "hour" } =
|
|
109
|
-
let
|
|
110
|
-
const c =
|
|
111
|
-
return n === "hour" ? i =
|
|
112
|
-
day:
|
|
106
|
+
function Q(e, r = { maxTime: "hour" }) {
|
|
107
|
+
const { maxTime: n = "hour" } = r, t = (u) => u < 10 ? `0${u}` : u;
|
|
108
|
+
let o = t(0), i = t(0);
|
|
109
|
+
const c = t(Math.floor(e % 3600 / 60)), s = t(Math.floor(e % 60));
|
|
110
|
+
return n === "hour" ? i = t(Math.floor(e / 3600)) : n === "day" && (o = t(Math.floor(e / (3600 * 24))), i = t(Math.floor(e % (3600 * 24) / 3600))), {
|
|
111
|
+
day: o,
|
|
113
112
|
hour: i,
|
|
114
113
|
minute: c,
|
|
115
|
-
second:
|
|
114
|
+
second: s
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
|
-
function
|
|
117
|
+
function h(e) {
|
|
119
118
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
120
119
|
}
|
|
121
|
-
function
|
|
122
|
-
if (!
|
|
123
|
-
const n =
|
|
124
|
-
if (
|
|
125
|
-
for (const
|
|
126
|
-
|
|
127
|
-
return
|
|
120
|
+
function M(e, ...r) {
|
|
121
|
+
if (!r.length) return e;
|
|
122
|
+
const n = r.shift();
|
|
123
|
+
if (h(e) && h(n))
|
|
124
|
+
for (const t in n)
|
|
125
|
+
h(n[t]) ? (e[t] || Object.assign(e, { [t]: {} }), M(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
|
|
126
|
+
return M(e, ...r);
|
|
128
127
|
}
|
|
129
|
-
function N(e,
|
|
130
|
-
const n =
|
|
128
|
+
function N(e, r) {
|
|
129
|
+
const n = r.match(/[^.[\]]+/g);
|
|
131
130
|
if (!n || n.length === 0)
|
|
132
131
|
return;
|
|
133
|
-
const
|
|
134
|
-
if (typeof
|
|
132
|
+
const t = (o, i) => {
|
|
133
|
+
if (typeof o != "object" || o === null || i.length === 0)
|
|
135
134
|
return;
|
|
136
|
-
const c =
|
|
135
|
+
const c = o, s = i[0], u = i.slice(1);
|
|
137
136
|
if (u.length === 0) {
|
|
138
|
-
delete c[
|
|
137
|
+
delete c[s];
|
|
139
138
|
return;
|
|
140
139
|
}
|
|
141
|
-
const l = c[
|
|
142
|
-
if (
|
|
143
|
-
for (const
|
|
144
|
-
|
|
140
|
+
const l = c[s];
|
|
141
|
+
if (s === "*" && Array.isArray(c)) {
|
|
142
|
+
for (const f of c)
|
|
143
|
+
t(f, u);
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
|
-
|
|
146
|
+
t(l, u);
|
|
148
147
|
};
|
|
149
|
-
|
|
148
|
+
t(e, n);
|
|
150
149
|
}
|
|
151
|
-
function
|
|
152
|
-
if (!e || !
|
|
150
|
+
function X(e, r) {
|
|
151
|
+
if (!e || !r)
|
|
153
152
|
return e;
|
|
154
|
-
if (Array.isArray(
|
|
155
|
-
for (const n of
|
|
153
|
+
if (Array.isArray(r))
|
|
154
|
+
for (const n of r)
|
|
156
155
|
N(e, n);
|
|
157
156
|
else
|
|
158
|
-
N(e,
|
|
157
|
+
N(e, r);
|
|
159
158
|
return e;
|
|
160
159
|
}
|
|
161
|
-
function
|
|
160
|
+
function Y(e, r) {
|
|
162
161
|
const n = JSON.parse(JSON.stringify(e));
|
|
163
|
-
if (Array.isArray(
|
|
164
|
-
for (const
|
|
165
|
-
N(n,
|
|
162
|
+
if (Array.isArray(r))
|
|
163
|
+
for (const t of r)
|
|
164
|
+
N(n, t);
|
|
166
165
|
else
|
|
167
|
-
N(n,
|
|
166
|
+
N(n, r);
|
|
168
167
|
return n;
|
|
169
168
|
}
|
|
170
|
-
function
|
|
171
|
-
const
|
|
172
|
-
function c(
|
|
169
|
+
function Z(e, r, n = {}) {
|
|
170
|
+
const t = n.arrayMergeStrategy || "combine", o = (n.keepKeys || []).map((s) => s.match(/[^.[\]]+/g) || []), i = (s) => o.some((u) => u.length !== s.length ? !1 : u.every((l, f) => l === s[f]));
|
|
171
|
+
function c(s, u, l) {
|
|
173
172
|
if (l.length > 0 && i(l))
|
|
174
|
-
return
|
|
175
|
-
if (Array.isArray(u) && Array.isArray(
|
|
176
|
-
if (
|
|
173
|
+
return s;
|
|
174
|
+
if (Array.isArray(u) && Array.isArray(s)) {
|
|
175
|
+
if (t === "overwrite")
|
|
177
176
|
return [...u];
|
|
178
|
-
const
|
|
179
|
-
for (let
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
g[
|
|
177
|
+
const f = t === "sync" ? u.length : Math.max(s.length, u.length), g = new Array(f);
|
|
178
|
+
for (let a = 0; a < f; a++) {
|
|
179
|
+
const p = [...l, String(a)], m = s[a], d = u[a];
|
|
180
|
+
if (a >= u.length) {
|
|
181
|
+
g[a] = m;
|
|
183
182
|
continue;
|
|
184
183
|
}
|
|
185
|
-
if (
|
|
186
|
-
g[
|
|
184
|
+
if (a >= s.length) {
|
|
185
|
+
g[a] = d;
|
|
187
186
|
continue;
|
|
188
187
|
}
|
|
189
|
-
g[
|
|
188
|
+
g[a] = c(m, d, p);
|
|
190
189
|
}
|
|
191
190
|
return g;
|
|
192
191
|
}
|
|
193
|
-
if (
|
|
194
|
-
const
|
|
192
|
+
if (h(u) && h(s)) {
|
|
193
|
+
const f = { ...s };
|
|
195
194
|
return Object.keys(u).forEach((g) => {
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
}),
|
|
195
|
+
const a = [...l, g], p = u[g], m = s[g];
|
|
196
|
+
f[g] = c(m, p, a);
|
|
197
|
+
}), f;
|
|
199
198
|
}
|
|
200
|
-
return u === void 0 ?
|
|
199
|
+
return u === void 0 ? s : u;
|
|
201
200
|
}
|
|
202
|
-
return c(e,
|
|
201
|
+
return c(e, r, []);
|
|
203
202
|
}
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
let [
|
|
207
|
-
return
|
|
203
|
+
const _ = (e) => F(e || 0), k = (e) => D(e || 0), ee = (e, r) => D(e || 0, r), te = (e) => isNaN(e) ? void 0 : e, re = (e) => {
|
|
204
|
+
const r = e.toString().split(""), n = r[1] !== "0" ? `,${r[1]}` : "";
|
|
205
|
+
let [t] = e.toString().split(".");
|
|
206
|
+
return t = t.replaceAll("-", ""), t.length >= 15 ? `${+t.substring(0, 3)} T` : t.length === 14 ? `${+t.substring(0, 2)} T` : t.length === 13 ? `${+t.substring(0, 1)}${n} T` : t.length === 12 ? `${+t.substring(0, 3)} M` : t.length === 11 ? `${+t.substring(0, 2)} M` : t.length === 10 ? `${+t.substring(0, 1)}${n} M` : t.length === 9 ? `${+t.substring(0, 3)} JT` : t.length === 8 ? `${+t.substring(0, 2)} JT` : t.length === 7 ? `${+t.substring(0, 1)}${n} JT` : t.length === 6 ? `${+t.substring(0, 3)} RB` : t.length === 5 ? `${+t.substring(0, 2)} RB` : t.length === 4 ? `${+t.substring(0, 1)}${n} RB` : t.length <= 3 ? +t ? `${+t}` : 0 : null;
|
|
208
207
|
};
|
|
209
|
-
function
|
|
208
|
+
function ne(e) {
|
|
210
209
|
if (typeof e != "string")
|
|
211
210
|
throw new Error("Input harus berupa string");
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
211
|
+
const r = e.split(".");
|
|
212
|
+
if (r.length === 1)
|
|
214
213
|
return {
|
|
215
214
|
filename: e,
|
|
216
215
|
extension: ""
|
|
217
216
|
};
|
|
218
|
-
const n = "." +
|
|
217
|
+
const n = "." + r[r.length - 1];
|
|
219
218
|
return {
|
|
220
|
-
filename:
|
|
219
|
+
filename: r.slice(0, -1).join("."),
|
|
221
220
|
extension: n
|
|
222
221
|
};
|
|
223
222
|
}
|
|
224
|
-
const
|
|
225
|
-
function
|
|
226
|
-
const n = typeof e == "string" ? e : JSON.stringify(e),
|
|
223
|
+
const ie = (e) => (new DOMParser().parseFromString(e || "", "text/html").body.textContent ?? "").toString();
|
|
224
|
+
function oe(e, r) {
|
|
225
|
+
const n = typeof e == "string" ? e : JSON.stringify(e), t = y.util.decode64(r.replace(/\s+/g, "")), o = y.util.decode64(t), i = y.asn1.fromDer(o), s = y.pki.publicKeyFromAsn1(i).encrypt(n, "RSA-OAEP", {
|
|
227
226
|
md: y.md.sha256.create(),
|
|
228
227
|
mgf1: { md: y.md.sha1.create() }
|
|
229
228
|
});
|
|
230
|
-
return y.util.encode64(
|
|
229
|
+
return y.util.encode64(s);
|
|
231
230
|
}
|
|
232
231
|
export {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
232
|
+
E as deepCompareEquals,
|
|
233
|
+
Z as deepMerge,
|
|
234
|
+
Y as deleteKeysImmutable,
|
|
235
|
+
X as deleteKeysMutable,
|
|
236
|
+
oe as encryptRSAOAEP,
|
|
237
|
+
ie as extractElementStringToOriginalValue,
|
|
238
|
+
T as formatDate,
|
|
239
|
+
v as formatDateRange,
|
|
240
|
+
J as formatNumber,
|
|
241
|
+
B as groupByKey,
|
|
242
|
+
x as isAccurateBigNumber,
|
|
243
|
+
K as isAccurateNumber,
|
|
244
|
+
h as isObject,
|
|
245
|
+
M as mergeObjects,
|
|
246
|
+
D as parseBigDecimal,
|
|
247
|
+
F as parseDecimal,
|
|
248
|
+
ne as parseFileName,
|
|
249
|
+
U as removeKeyObjectEmptyValue,
|
|
250
|
+
H as sanitizeObjectKeyPrefix,
|
|
251
|
+
re as setDigit,
|
|
252
|
+
W as transformArrayMapping,
|
|
253
|
+
G as transformArrayMappingObjectFC,
|
|
254
|
+
V as transformArrayOfObjectToArray,
|
|
255
|
+
I as transformArrayOfObjectToString,
|
|
256
|
+
k as transformBigNumber,
|
|
257
|
+
ee as transformBigNumberOpt,
|
|
258
|
+
z as transformDataHistory,
|
|
259
|
+
q as transformLatLong,
|
|
260
|
+
_ as transformNumber,
|
|
261
|
+
Q as transformSecondTime,
|
|
262
|
+
te as transfromIsNan
|
|
264
263
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "1mpacto-react-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.21",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.19.4",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/react-dom": "^19.1.7",
|
|
44
44
|
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
45
45
|
"@typescript-eslint/parser": "^8.48.1",
|
|
46
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
46
|
+
"@vitejs/plugin-react-swc": "^4.3.0",
|
|
47
47
|
"1mpacto-sass": "^0.0.6",
|
|
48
48
|
"eslint": "^9.32.0",
|
|
49
49
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"storybook": "10.1.4",
|
|
65
65
|
"ts-node": "^10.9.2",
|
|
66
66
|
"typescript": "~5.9.3",
|
|
67
|
-
"vite": "^
|
|
67
|
+
"vite": "^7.3.2",
|
|
68
68
|
"vite-plugin-dts": "^4.5.4"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
@@ -125,4 +125,4 @@
|
|
|
125
125
|
"react-virtuoso": "^4.16.1",
|
|
126
126
|
"tinymce": "^8.2.2"
|
|
127
127
|
}
|
|
128
|
-
}
|
|
128
|
+
}
|