dga-ui-react 1.8.10 → 1.8.11

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/esm/index.js CHANGED
@@ -869,7 +869,7 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
869
869
  transition: all 0.2s;
870
870
  border-bottom-left-radius: 50px;
871
871
  border-bottom-right-radius: 50px;
872
- `,lo=r=>{var{children:i,menuItems:n,disabled:a,keepOpenOnItemsClicked:l,onOpen:s,onClose:d,reverseOpeningDirection:c}=r,p=v(r,["children","menuItems","disabled","keepOpenOnItemsClicked","onOpen","onClose","reverseOpeningDirection"]);const u=b(),[g,h]=o.useState(!1),[A,f]=o.useState(""),[x,y]=o.useState({top:0,left:0}),w=o.useRef(null),C=o.useRef(null),$=o.useRef(null),k=()=>{const e=Math.max(document.documentElement.clientHeight,window.innerHeight);if(C.current&&$.current){const t=C.current.getBoundingClientRect();let r={top:t.bottom,left:"ltr"===u.direction?t.left:t.right-$.current.clientWidth};"ltr"===u.direction?r.left+$.current.clientWidth>window.innerWidth&&(r.left=window.innerWidth-$.current.clientWidth):r.left&&t.right-$.current.clientWidth<0&&(r.left=0),c&&(r={top:r.top,left:"ltr"===u.direction?t.right-$.current.clientWidth:t.left},r.left<0&&(r.left=0),t.left+$.current.clientWidth>innerWidth&&(r.left=innerWidth-$.current.clientWidth)),t.bottom+$.current.clientHeight>e&&(r.top=t.top-$.current.clientHeight),r.top<0&&(r.top=0),r.top>e&&(r.top=$.current.clientHeight),y(r)}};return o.useEffect((()=>{if(C.current){const e=()=>{k()},t=e=>{var t;(null===(t=w.current)||void 0===t?void 0:t.contains(e.target))||(null==d||d(e),h(!1))};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[C,c]),o.useEffect((()=>{const e=document.getElementsByTagName("body");e&&e[0]&&(e[0].style.overflow=g?"hidden":A)}),[g]),o.useEffect((()=>{var e,t,r;f(null===(r=null===(t=null===(e=document.getElementsByTagName("body"))||void 0===e?void 0:e[0])||void 0===t?void 0:t.style)||void 0===r?void 0:r.overflow)}),[]),t(so,Object.assign({$theme:u},p,{className:m("dgaui dgaui_menu",p.className),ref:w,children:[e("div",{ref:C,onClick:e=>(e=>{g?(h(!1),null==d||d(e)):(k(),h(!0),null==s||s(e))})(e),className:"menuChildren",children:i}),e("div",{ref:$,className:"menueItemsContainer dgaui_hiddenScrollbar "+(g?" slide-bottom":""),style:x,onClick:e=>{l||(h(!1),null==d||d(e))},children:n})]}))},so=sr.div`
872
+ `,lo=r=>{var{children:i,menuItems:n,disabled:a,keepOpenOnItemsClicked:l,onOpen:s,onClose:d,reverseOpeningDirection:c}=r,p=v(r,["children","menuItems","disabled","keepOpenOnItemsClicked","onOpen","onClose","reverseOpeningDirection"]);const u=b(),[g,h]=o.useState(!1),[A,f]=o.useState(""),[x,y]=o.useState({top:0,left:0}),w=o.useRef(null),C=o.useRef(null),$=o.useRef(null),k=()=>{const e=Math.max(document.documentElement.clientHeight,window.innerHeight);if(C.current&&$.current){const t=C.current.getBoundingClientRect();let r={top:t.bottom,left:"ltr"===u.direction?t.left:t.right-$.current.clientWidth};"ltr"===u.direction?r.left+$.current.clientWidth>window.innerWidth&&(r.left=window.innerWidth-$.current.clientWidth):r.left&&t.right-$.current.clientWidth<0&&(r.left=0),c&&(r={top:r.top,left:"ltr"===u.direction?t.right-$.current.clientWidth:t.left},r.left<0&&(r.left=0),t.left+$.current.clientWidth>innerWidth&&(r.left=innerWidth-$.current.clientWidth)),t.bottom+$.current.clientHeight>e&&(r.top=t.top-$.current.clientHeight),r.top<0&&(r.top=0),r.top>e&&(r.top=$.current.clientHeight),y(r)}};return o.useEffect((()=>{if(C.current){const e=()=>{k()},t=e=>{var t;(null===(t=w.current)||void 0===t?void 0:t.contains(e.target))||(null==d||d(e),h(!1))};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[C,c]),o.useEffect((()=>{const e=document.getElementsByTagName("body");e&&e[0]&&(e[0].style.overflow=g?"hidden":A)}),[g]),o.useEffect((()=>{var e,t,r;f(null===(r=null===(t=null===(e=document.getElementsByTagName("body"))||void 0===e?void 0:e[0])||void 0===t?void 0:t.style)||void 0===r?void 0:r.overflow)}),[]),t(so,Object.assign({$theme:u},p,{className:m("dgaui dgaui_menu"+(a?" disabled":""),p.className),ref:w,children:[e("div",{ref:C,onClick:e=>(e=>{g?(h(!1),null==d||d(e)):(k(),h(!0),null==s||s(e))})(e),className:"menuChildren",children:i}),e("div",{ref:$,className:"menueItemsContainer dgaui_hiddenScrollbar "+(g?" slide-bottom":""),style:x,onClick:e=>{l||(h(!1),null==d||d(e))},children:n})]}))},so=sr.div`
873
873
  direction: ${e=>e.$theme.direction};
874
874
  display: inline-block;
875
875
 
@@ -905,7 +905,12 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
905
905
  }
906
906
  }
907
907
  }
908
- `;var co="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD/SURBVHgB7dUxroJAEAbgAV5I6LaBUHqExxG8wWtf9Z4n8Ah6I49gbaU30JJAIQUVCeA/xsLCgl2zRpP/SzYLxSSTmZ1dESIiIiJ6IE3TZZZlK3lSKJ6M4xhgWyPJvTFmJu8IVfzHOiPJo2uSgXiW5/lsGIYtPg2qOq/r+mAT7z1BdZ9k13VF0zSnqbFfYkEPPrYfsdT3vQTBtRYmjmMdnMXUWKshuR18J4htxMFLWqwDgsppiyUMw3lZlqepsVYtdoFj8Y32blBBg1+r5JS3e1AhuT9s18pFUVTYTrBX+opgjXpR6xSLo0g8SZKkQGt3VVX9tm3rNCBEREREn+8C+TlJKy8I1/cAAAAASUVORK5CYII=",po="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEJSURBVHgB7dU9boNAEAXgtySigYKGn9JHSI7AEXIC5wi5QXKEtOlyhZwgbTp8g7gEUWQLQBEF+I1l916stWxpPmnFFFsMszO7gFJKKaXULbvDmbIse43j+LHv+x94EGChJElWTK5i+DbPc4JrckjuN03TP65neHQPR0zogZ9vLstVtm27gUfGZbNULgxDSQ5BEJR1XW/hmVOCrN6nMWbNcMO+s1iAP/bVNM37yfvhgMkdw4sNhVMFi6JYTdO0P+JxHEtr7RaeOVVQeo5H+ySx9KL0JDxzvgdlamVAJGaSFftyjWskx83kKt6Hc57nL/Bk8VPXdZ0dhuEjiiLOjvn39dQppZRSSt22HXZvSded5pbnAAAAAElFTkSuQmCC";const uo=({hijri:r=!1,range:i=!1,minYear:n,maxYear:a,minDate:l,maxDate:s,onChange:c,onRangeChange:p,value:u,withTextInput:g=!0,textInputProps:h,closeOnSelect:m=!0,rangeSeparator:A=" - "})=>{const f=b(),[x,v]=o.useState(),[y,w]=o.useState(""),[C,$]=o.useState([]),[k,S]=o.useState(0),B=o.useRef(),E=i&&Array.isArray(x)&&1===x.length;o.useEffect((()=>{let e=0,t=0;r?(e=l?l.year:n||1300,t=s?s.year:a||1500):(e=l?l.year:n||1900,t=(s?s.year:a||2100)+1);let o=[];if(e>=t)return o=Array(200).fill(0).map(((e,t)=>t+1900)),void $(o);o=e&&t?Array(t-e).fill(0).map(((t,r)=>r+e)):e&&!t?Array(200).fill(0).map(((t,r)=>r+e)):!e&&t?Array(200).fill(0).map(((e,t)=>t+(r?1300:1900))):r?Array(200).fill(0).map(((e,t)=>t+1300)):Array(200).fill(0).map(((e,t)=>t+1900)),$(o)}),[n,a,l,s,r]),o.useEffect((()=>{const e=u&&Array.isArray(u)?u[0].year:u&&!Array.isArray(u)?u.year:(new Date).getFullYear(),t=(new Date).getMonth()+1;S(r?function(e,t){let r=(e-622)/.970224;t>=9&&(r+=1);return Math.floor(r)}(e,t):e)}),[r]),o.useEffect((()=>{i||v(void 0)}),[i]),o.useEffect((()=>{v(u)}),[u]),o.useEffect((()=>{let e="";i&&Array.isArray(x)&&2===x.length?e=`${mo(x[0])}${A}${mo(x[1])}`:x&&!Array.isArray(x)&&(e=mo(x)),w(e)}),[x,i]),o.useEffect((()=>{l&&setTimeout((()=>{var e,t;null===(e=null==B?void 0:B.current)||void 0===e||e.set("year",n||(null==l?void 0:l.year)),null===(t=null==B?void 0:B.current)||void 0===t||t.set("month",n||(null==l?void 0:l.month))}),200),n&&setTimeout((()=>{var e;null===(e=null==B?void 0:B.current)||void 0===e||e.set("year",n||(null==l?void 0:l.year))}),200)}),[l,n]);const N=e(d,{ref:B,value:u||x,range:i,calendar:r?_r:Zr,onMonthChange:e=>S(e.year),locale:r?to:"rtl"===f.direction?eo:void 0,weekStartDayIndex:r?1:0,weekDays:r?["سبت","أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة"]:"rtl"===f.direction?["أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"]:void 0,onChange:e=>{v(e),i&&p&&Array.isArray(e)?p(e):e&&c&&c(e),m&&(i&&Array.isArray(e)&&e.length>1?document.body.click():i||document.body.click())},format:"YYYY/MM/DD",showOtherDays:!0,monthYearSeparator:" ",minDate:l,maxDate:s,children:e("div",{className:"yearsSelect",children:e("select",{value:k,onChange:e=>(e=>{var t;v(void 0),null===(t=null==B?void 0:B.current)||void 0===t||t.set("year",e),S(e)})(+e.target.value),children:C.map((t=>e("option",{value:t,children:t},t)))})})});return t(go,{className:"dgaui"+(E?" rangeOnlyOneSelected":""),$theme:f,children:[!g&&N,g&&e(lo,{menuItems:N,keepOpenOnItemsClicked:!0,children:e(oo,Object.assign({value:(null==h?void 0:h.value)||y,readOnly:!0},h))})]})},go=sr.div`
908
+
909
+ &.disabled {
910
+ pointer-events: none;
911
+ color: ${e=>e.$theme.palette.neutral[300]};
912
+ }
913
+ `;var co="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD/SURBVHgB7dUxroJAEAbgAV5I6LaBUHqExxG8wWtf9Z4n8Ah6I49gbaU30JJAIQUVCeA/xsLCgl2zRpP/SzYLxSSTmZ1dESIiIiJ6IE3TZZZlK3lSKJ6M4xhgWyPJvTFmJu8IVfzHOiPJo2uSgXiW5/lsGIYtPg2qOq/r+mAT7z1BdZ9k13VF0zSnqbFfYkEPPrYfsdT3vQTBtRYmjmMdnMXUWKshuR18J4htxMFLWqwDgsppiyUMw3lZlqepsVYtdoFj8Y32blBBg1+r5JS3e1AhuT9s18pFUVTYTrBX+opgjXpR6xSLo0g8SZKkQGt3VVX9tm3rNCBEREREn+8C+TlJKy8I1/cAAAAASUVORK5CYII=",po="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEJSURBVHgB7dU9boNAEAXgtySigYKGn9JHSI7AEXIC5wi5QXKEtOlyhZwgbTp8g7gEUWQLQBEF+I1l916stWxpPmnFFFsMszO7gFJKKaXULbvDmbIse43j+LHv+x94EGChJElWTK5i+DbPc4JrckjuN03TP65neHQPR0zogZ9vLstVtm27gUfGZbNULgxDSQ5BEJR1XW/hmVOCrN6nMWbNcMO+s1iAP/bVNM37yfvhgMkdw4sNhVMFi6JYTdO0P+JxHEtr7RaeOVVQeo5H+ySx9KL0JDxzvgdlamVAJGaSFftyjWskx83kKt6Hc57nL/Bk8VPXdZ0dhuEjiiLOjvn39dQppZRSSt22HXZvSded5pbnAAAAAElFTkSuQmCC";const uo=({hijri:r=!1,range:i=!1,minYear:n,maxYear:a,minDate:l,maxDate:s,onChange:c,onRangeChange:p,value:u,withTextInput:g=!0,textInputProps:h,closeOnSelect:m=!0,rangeSeparator:A=" - "})=>{const f=b(),[x,v]=o.useState(),[y,w]=o.useState(""),[C,$]=o.useState([]),[k,S]=o.useState(0),B=o.useRef(),E=i&&Array.isArray(x)&&1===x.length;o.useEffect((()=>{let e=0,t=0;r?(e=l?l.year:n||1300,t=s?s.year:a||1500):(e=l?l.year:n||1900,t=(s?s.year:a||2100)+1);let o=[];if(e>=t)return o=Array(200).fill(0).map(((e,t)=>t+1900)),void $(o);o=e&&t?Array(t-e).fill(0).map(((t,r)=>r+e)):e&&!t?Array(200).fill(0).map(((t,r)=>r+e)):!e&&t?Array(200).fill(0).map(((e,t)=>t+(r?1300:1900))):r?Array(200).fill(0).map(((e,t)=>t+1300)):Array(200).fill(0).map(((e,t)=>t+1900)),$(o)}),[n,a,l,s,r]),o.useEffect((()=>{const e=u&&Array.isArray(u)?u[0].year:u&&!Array.isArray(u)?u.year:(new Date).getFullYear(),t=(new Date).getMonth()+1;S(r?function(e,t){let r=(e-622)/.970224;t>=9&&(r+=1);return Math.floor(r)}(e,t):e)}),[r]),o.useEffect((()=>{i||v(void 0)}),[i]),o.useEffect((()=>{v(u)}),[u]),o.useEffect((()=>{let e="";i&&Array.isArray(x)&&2===x.length?e=`${mo(x[0])}${A}${mo(x[1])}`:x&&!Array.isArray(x)&&(e=mo(x)),w(e)}),[x,i]),o.useEffect((()=>{l&&setTimeout((()=>{var e,t;null===(e=null==B?void 0:B.current)||void 0===e||e.set("year",n||(null==l?void 0:l.year)),null===(t=null==B?void 0:B.current)||void 0===t||t.set("month",n||(null==l?void 0:l.month))}),200),n&&setTimeout((()=>{var e;null===(e=null==B?void 0:B.current)||void 0===e||e.set("year",n||(null==l?void 0:l.year))}),200)}),[l,n]);const N=e(d,{ref:B,value:u||x,range:i,calendar:r?_r:Zr,onMonthChange:e=>S(e.year),locale:r?to:"rtl"===f.direction?eo:void 0,weekStartDayIndex:r?1:0,weekDays:r?["سبت","أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة"]:"rtl"===f.direction?["أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"]:void 0,onChange:e=>{v(e),i&&p&&Array.isArray(e)?p(e):e&&c&&c(e),m&&(i&&Array.isArray(e)&&e.length>1?document.body.click():i||document.body.click())},format:"YYYY/MM/DD",showOtherDays:!0,monthYearSeparator:" ",minDate:l,maxDate:s,children:e("div",{className:"yearsSelect",children:e("select",{value:k,onChange:e=>(e=>{var t;v(void 0),null===(t=null==B?void 0:B.current)||void 0===t||t.set("year",e),S(e)})(+e.target.value),children:C.map((t=>e("option",{value:t,children:t},t)))})})});return t(go,{className:"dgaui"+(E?" rangeOnlyOneSelected":""),$theme:f,children:[!g&&N,g&&e(lo,{menuItems:N,keepOpenOnItemsClicked:!0,disabled:null==h?void 0:h.disabled,children:e(oo,Object.assign({value:(null==h?void 0:h.value)||y,readOnly:!0},h))})]})},go=sr.div`
909
914
  .rmdp-top-class {
910
915
  width: 424px;
911
916
  display: block !important;