primereact 10.9.4 → 10.9.5
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/autocomplete/autocomplete.cjs.js +13 -1
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +14 -2
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +13 -1
- package/autocomplete/autocomplete.min.js +1 -1
- package/breadcrumb/breadcrumb.cjs.js +2 -1
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +2 -1
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +2 -1
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/calendar/calendar.cjs.js +10 -2
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +11 -3
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +10 -2
- package/calendar/calendar.min.js +1 -1
- package/cascadeselect/cascadeselect.cjs.js +9 -2
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +9 -0
- package/cascadeselect/cascadeselect.esm.js +9 -2
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +9 -2
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/checkbox/checkbox.cjs.js +1 -1
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.esm.js +1 -1
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +1 -1
- package/checkbox/checkbox.min.js +1 -1
- package/chip/chip.cjs.js +15 -2
- package/chip/chip.cjs.min.js +1 -1
- package/chip/chip.esm.js +17 -4
- package/chip/chip.esm.min.js +1 -1
- package/chip/chip.js +15 -2
- package/chip/chip.min.js +1 -1
- package/chips/chips.cjs.js +1 -1
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.esm.js +1 -1
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +1 -1
- package/chips/chips.min.js +1 -1
- package/colorpicker/colorpicker.cjs.js +9 -2
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +9 -2
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +9 -2
- package/colorpicker/colorpicker.min.js +1 -1
- package/confirmpopup/confirmpopup.cjs.js +10 -2
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.esm.js +10 -2
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +10 -2
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/core/core.js +172 -30
- package/core/core.min.js +6 -6
- package/datatable/datatable.cjs.js +278 -238
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +279 -239
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +278 -238
- package/datatable/datatable.min.js +1 -1
- package/dropdown/dropdown.cjs.js +13 -2
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.d.ts +4 -0
- package/dropdown/dropdown.esm.js +13 -2
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +13 -2
- package/dropdown/dropdown.min.js +1 -1
- package/hooks/hooks.cjs.js +16 -6
- package/hooks/hooks.cjs.min.js +1 -1
- package/hooks/hooks.esm.js +16 -6
- package/hooks/hooks.esm.min.js +1 -1
- package/hooks/hooks.js +16 -6
- package/hooks/hooks.min.js +1 -1
- package/inputmask/inputmask.cjs.js +1 -1
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.esm.js +1 -1
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +1 -1
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +5 -2
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +5 -2
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +5 -2
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputotp/inputotp.cjs.js +1 -0
- package/inputotp/inputotp.cjs.min.js +1 -1
- package/inputotp/inputotp.esm.js +1 -0
- package/inputotp/inputotp.esm.min.js +1 -1
- package/inputotp/inputotp.js +1 -0
- package/inputotp/inputotp.min.js +1 -1
- package/mention/mention.cjs.js +18 -9
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.d.ts +5 -0
- package/mention/mention.esm.js +18 -9
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +18 -9
- package/mention/mention.min.js +1 -1
- package/menu/menu.cjs.js +11 -3
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +12 -4
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +11 -3
- package/menu/menu.min.js +1 -1
- package/menubar/menubar.cjs.js +6 -9
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +6 -9
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +6 -9
- package/menubar/menubar.min.js +1 -1
- package/multiselect/multiselect.cjs.js +7 -3
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +7 -3
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +7 -3
- package/multiselect/multiselect.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.cjs.js +1 -1
- package/multistatecheckbox/multistatecheckbox.cjs.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +1 -1
- package/multistatecheckbox/multistatecheckbox.esm.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.js +1 -1
- package/multistatecheckbox/multistatecheckbox.min.js +1 -1
- package/orderlist/orderlist.cjs.js +34 -3
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +34 -3
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +34 -3
- package/orderlist/orderlist.min.js +1 -1
- package/overlaypanel/overlaypanel.cjs.js +9 -10
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +9 -10
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +9 -10
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +1 -1
- package/password/password.cjs.js +9 -2
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +10 -3
- package/password/password.esm.min.js +1 -1
- package/password/password.js +9 -2
- package/password/password.min.js +1 -1
- package/primereact.all.cjs.js +641 -334
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +642 -335
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +641 -334
- package/primereact.all.min.js +1 -1
- package/radiobutton/radiobutton.cjs.js +2 -2
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.d.ts +1 -1
- package/radiobutton/radiobutton.esm.js +2 -2
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +2 -2
- package/radiobutton/radiobutton.min.js +1 -1
- package/slidemenu/slidemenu.cjs.js +9 -2
- package/slidemenu/slidemenu.cjs.min.js +1 -1
- package/slidemenu/slidemenu.esm.js +10 -3
- package/slidemenu/slidemenu.esm.min.js +1 -1
- package/slidemenu/slidemenu.js +9 -2
- package/slidemenu/slidemenu.min.js +1 -1
- package/tree/tree.cjs.js +1 -1
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +1 -1
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +1 -1
- package/tree/tree.min.js +1 -1
- package/treeselect/treeselect.cjs.js +15 -8
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +15 -8
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +15 -8
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +1 -1
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +1 -1
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +1 -1
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.js +6 -6
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +6 -6
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +6 -6
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/utils/utils.cjs.js +136 -18
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +5 -1
- package/utils/utils.esm.js +136 -18
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +136 -18
- package/utils/utils.min.js +1 -1
- package/web-types.json +29 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),r=require("primereact/button"),n=require("primereact/componentbase"),o=require("primereact/csstransition"),c=require("primereact/hooks"),a=require("primereact/overlayservice"),i=require("primereact/portal"),l=require("primereact/utils");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=p(e),f=u(t);function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m.apply(null,arguments)}function d(e){if(Array.isArray(e))return e}function v(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c,a,i=[],l=!0,u=!1;try{if(c=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=c.call(r)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return i}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){if(e){if("string"==typeof e)return b(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e,t){return d(e)||v(e,t)||y(e,t)||g()}function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function S(e,t){if("object"!=j(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function h(e){var t=S(e,"string");return"symbol"==j(t)?t:t+""}function E(e,t,r){return(t=h(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var P=n.ComponentBase.extend({defaultProps:{__TYPE:"ConfirmPopup",accept:null,acceptClassName:null,acceptIcon:null,acceptLabel:null,appendTo:null,children:void 0,className:null,closeOnEscape:!0,content:null,defaultFocus:"accept",dismissable:!0,footer:null,icon:null,message:null,onHide:null,onShow:null,reject:null,rejectClassName:null,rejectIcon:null,rejectLabel:null,style:null,tagKey:void 0,target:null,transitionOptions:null,visible:!1},css:{classes:{root:function(e){var t=e.context;return l.classNames("p-confirm-popup p-component",(0,e.getPropValue)("className"),{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===f.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===f.default.ripple})},acceptButton:function(e){return l.classNames("p-confirm-popup-accept p-button-sm",(0,e.getPropValue)("acceptClassName"))},rejectButton:function(e){var t=e.getPropValue;return l.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!t("rejectClassName")},t("rejectClassName"))},content:"p-confirm-popup-content",icon:"p-confirm-popup-icon",message:"p-confirm-popup-message",footer:"p-confirm-popup-footer",transition:"p-connected-overlay"},styles:'\n@layer primereact {\n .p-confirm-popup {\n margin-top: 10px; \n }\n\n .p-confirm-popup-flipped {\n margin-top: -10px;\n }\n \n .p-confirm-popup:after, .p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-confirm-popup-flipped:after, .p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent\n }\n \n .p-confirm-popup .p-confirm-popup-content {\n display: flex;\n align-items: center;\n }\n}\n'}});function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){E(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var w=s.memo(s.forwardRef((function(e,u){var p=c.useMergeProps(),d=s.useContext(t.PrimeReactContext),v=P.getProps(e,d),b=O(s.useState(v.visible),2),y=b[0],g=b[1],j=O(s.useState(!1),2),S=j[0],h=j[1],E={props:v,state:{visible:y,reshow:S}},N=P.setMetaData(E),w=N.ptm,C=N.cx,I=N.isUnstyled;n.useHandleStyle(P.css.styles,I,{name:"confirmpopup"});var R=s.useRef(null),D=s.useRef(null),U=s.useRef(null),_=s.useRef(!1),k=s.useRef(null),A=s.useRef(null),B=s.useRef(null),H=s.useRef(!1),L=function(){return A.current||v},q=function(e){return(A.current||v)[e]},T=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return l.ObjectUtils.getPropValue(q(e),r)},M=q("acceptLabel")||t.localeOption("accept"),V=q("rejectLabel")||t.localeOption("reject"),J=v.dismissable&&v.closeOnEscape&&y,K=c.useDisplayOrder("dialog",J);c.useGlobalOnEscapeKey({callback:function(){$("hide")},when:J&&K,priority:[c.ESC_KEY_HANDLING_PRIORITIES.DIALOG,K]});var X=O(c.useOverlayListener({target:q("target"),overlay:R,listener:function(e,t){t.valid&&("outside"===t.type?v.dismissable&&!_.current&&$("hide"):$("hide")),_.current=!1},when:y}),2),Z=X[0],z=X[1],G=function(){H.current||(H.current=!0,T("accept"),$("accept"))},F=function(){H.current||(H.current=!0,T("reject"),$("reject"))},Y=function(){var e=L();h(!1),e.group===v.group&&(g(!0),H.current=!1,k.current=function(e){!W(e.target)&&(_.current=!0)},a.OverlayService.on("overlay-click",k.current),B.current=document.activeElement)},$=function(e){g(!1),a.OverlayService.off("overlay-click",k.current),k.current=null,e&&T("onHide",e),l.DomHandler.focus(B.current),B.current=null},Q=function(){if(q("target")){l.DomHandler.absolutePosition(R.current,q("target"));var e=l.DomHandler.getOffset(R.current),t=l.DomHandler.getOffset(q("target")),r=0;e.left<t.left&&(r=t.left-e.left),R.current.style.setProperty("--overlayArrowLeft","".concat(r,"px")),e.top<t.top&&!I()&&l.DomHandler.addClass(R.current,"p-confirm-popup-flipped")}},W=function(e){return R&&R.current&&!(R.current.isSameNode(e)||R.current.contains(e))},ee=function(e){if(e.tagKey===v.tagKey){var t=y!==e.visible;q("target")!==e.target&&!v.target?($(),A.current=e,h(!0)):t&&(A.current=e,e.visible?Y():$())}};s.useEffect((function(){v.visible?Y():$()}),[v.visible]),s.useEffect((function(){return v.target||v.message||a.OverlayService.on("confirm-popup",ee),function(){a.OverlayService.off("confirm-popup",ee)}}),[v.target]),c.useUpdateEffect((function(){S&&Y()}),[S]),c.useUnmountEffect((function(){k.current&&(a.OverlayService.off("overlay-click",k.current),k.current=null),a.OverlayService.off("confirm-popup",ee),l.ZIndexUtils.clear(R.current)})),s.useImperativeHandle(u,(function(){return{props:v,confirm:ee}}));var te,re,ne=function(){var e=l.classNames("p-confirm-popup-accept p-button-sm",q("acceptClassName")),t=l.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!q("rejectClassName")},q("rejectClassName")),n=p({className:C("footer")},w("footer")),o=p({ref:U,label:V,icon:q("rejectIcon"),className:C("rejectButton",{getPropValue:q}),onClick:F,pt:w("rejectButton"),unstyled:v.unstyled,__parentMetadata:{parent:E}}),c=p({ref:D,label:M,icon:q("acceptIcon"),className:C("acceptButton",{getPropValue:q}),onClick:G,pt:w("acceptButton"),unstyled:v.unstyled,__parentMetadata:{parent:E}}),a=s.createElement("div",n,s.createElement(r.Button,o),s.createElement(r.Button,c));if(q("footer")){var i={accept:G,reject:F,className:"p-confirm-popup-footer",acceptClassName:e,rejectClassName:t,acceptLabel:M,rejectLabel:V,element:a,props:L()};return l.ObjectUtils.getJSXElement(q("footer"),i)}return a},oe=p({ref:R,id:q("id"),className:l.classNames(v.className,C("root",{context:d,getPropValue:q})),style:q("style"),onClick:function(e){_.current=!0,a.OverlayService.emit("overlay-click",{originalEvent:e,target:q("target")})}},P.getOtherProps(v),w("root")),ce=p({classNames:C("transition"),in:y,timeout:{enter:120,exit:100},options:q("transitionOptions"),unmountOnExit:!0,onEnter:function(){l.ZIndexUtils.set("overlay",R.current,d&&d.autoZIndex||f.default.autoZIndex,d&&d.zIndex.overlay||f.default.zIndex.overlay),l.DomHandler.addStyles(R.current,{position:"absolute",top:"0",left:"0"}),Q()},onEntered:function(){Z();var e=q("defaultFocus");void 0!==e&&"accept"!==e||D.current&&D.current.focus(),"reject"===e&&U.current&&U.current.focus(),T("onShow")},onExit:function(){z()},onExited:function(){l.ZIndexUtils.clear(R.current),_.current=!1}},w("transition")),ae=null!=e&&e.content?(te=L(),re={message:l.ObjectUtils.getJSXElement(q("message"),te),acceptBtnRef:D,rejectBtnRef:U,hide:$},s.createElement(o.CSSTransition,m({nodeRef:R},ce),s.createElement("div",oe,l.ObjectUtils.getJSXElement(e.content,re)))):function(){var e,t,r,n,c,a,i=(e=L(),t=l.ObjectUtils.getJSXElement(q("message"),e),r=p({className:C("icon")},w("icon")),n=l.IconUtils.getJSXIcon(q("icon"),x({},r),{props:e}),c=p({className:C("message")},w("message")),a=p({className:C("content")},w("content")),s.createElement("div",a,n,s.createElement("span",c,t))),u=ne();return s.createElement(o.CSSTransition,m({nodeRef:R},ce),s.createElement("div",oe,i,u))}();return s.createElement(i.Portal,{element:ae,appendTo:q("appendTo"),visible:q("visible")})})));w.displayName="ConfirmPopup",exports.ConfirmPopup=w,exports.confirmPopup=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=x(x({},e),{visible:void 0===e.visible||e.visible})).visible&&a.OverlayService.emit("confirm-popup",e);return{show:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a.OverlayService.emit("confirm-popup",x(x(x({},e),t),{visible:!0}))},hide:function(){a.OverlayService.emit("confirm-popup",{visible:!1})}}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),r=require("primereact/button"),n=require("primereact/componentbase"),o=require("primereact/csstransition"),c=require("primereact/hooks"),a=require("primereact/overlayservice"),i=require("primereact/portal"),l=require("primereact/utils");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=p(e),f=u(t);function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m.apply(null,arguments)}function d(e){if(Array.isArray(e))return e}function v(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c,a,i=[],l=!0,u=!1;try{if(c=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=c.call(r)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return i}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){if(e){if("string"==typeof e)return b(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e,t){return d(e)||v(e,t)||y(e,t)||g()}function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function S(e,t){if("object"!=j(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function h(e){var t=S(e,"string");return"symbol"==j(t)?t:t+""}function E(e,t,r){return(t=h(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var P=n.ComponentBase.extend({defaultProps:{__TYPE:"ConfirmPopup",accept:null,acceptClassName:null,acceptIcon:null,acceptLabel:null,appendTo:null,children:void 0,className:null,closeOnEscape:!0,content:null,defaultFocus:"accept",dismissable:!0,footer:null,icon:null,message:null,onHide:null,onShow:null,reject:null,rejectClassName:null,rejectIcon:null,rejectLabel:null,style:null,tagKey:void 0,target:null,transitionOptions:null,visible:!1},css:{classes:{root:function(e){var t=e.context;return l.classNames("p-confirm-popup p-component",(0,e.getPropValue)("className"),{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===f.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===f.default.ripple})},acceptButton:function(e){return l.classNames("p-confirm-popup-accept p-button-sm",(0,e.getPropValue)("acceptClassName"))},rejectButton:function(e){var t=e.getPropValue;return l.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!t("rejectClassName")},t("rejectClassName"))},content:"p-confirm-popup-content",icon:"p-confirm-popup-icon",message:"p-confirm-popup-message",footer:"p-confirm-popup-footer",transition:"p-connected-overlay"},styles:'\n@layer primereact {\n .p-confirm-popup {\n margin-top: 10px; \n }\n\n .p-confirm-popup-flipped {\n margin-top: -10px;\n }\n \n .p-confirm-popup:after, .p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-confirm-popup-flipped:after, .p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent\n }\n \n .p-confirm-popup .p-confirm-popup-content {\n display: flex;\n align-items: center;\n }\n}\n'}});function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach((function(t){E(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var w=s.memo(s.forwardRef((function(e,u){var p=c.useMergeProps(),d=s.useContext(t.PrimeReactContext),v=P.getProps(e,d),b=O(s.useState(v.visible),2),y=b[0],g=b[1],j=O(s.useState(!1),2),S=j[0],h=j[1],E={props:v,state:{visible:y,reshow:S}},N=P.setMetaData(E),w=N.ptm,C=N.cx,I=N.isUnstyled;n.useHandleStyle(P.css.styles,I,{name:"confirmpopup"});var D=s.useRef(null),R=s.useRef(null),U=s.useRef(null),_=s.useRef(!1),H=s.useRef(null),k=s.useRef(null),A=s.useRef(null),B=s.useRef(!1),L=function(){return k.current||v},q=function(e){return(k.current||v)[e]},T=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return l.ObjectUtils.getPropValue(q(e),r)},M=q("acceptLabel")||t.localeOption("accept"),V=q("rejectLabel")||t.localeOption("reject"),J=v.dismissable&&v.closeOnEscape&&y,K=c.useDisplayOrder("dialog",J);c.useGlobalOnEscapeKey({callback:function(){$("hide")},when:J&&K,priority:[c.ESC_KEY_HANDLING_PRIORITIES.DIALOG,K]});var X=O(c.useOverlayListener({target:q("target"),overlay:D,listener:function(e,t){t.valid&&("outside"===t.type?(v.dismissable&&!_.current&&$("hide"),_.current=!1):d.hideOverlaysOnDocumentScrolling?$("hide"):l.DomHandler.isDocument(e.target)||Q())},when:y}),2),Z=X[0],z=X[1],G=function(){B.current||(B.current=!0,T("accept"),$("accept"))},F=function(){B.current||(B.current=!0,T("reject"),$("reject"))},Y=function(){var e=L();h(!1),e.group===v.group&&(g(!0),B.current=!1,H.current=function(e){!W(e.target)&&(_.current=!0)},a.OverlayService.on("overlay-click",H.current),A.current=document.activeElement)},$=function(e){g(!1),a.OverlayService.off("overlay-click",H.current),H.current=null,e&&T("onHide",e),l.DomHandler.focus(A.current),A.current=null},Q=function(){if(q("target")){l.DomHandler.absolutePosition(D.current,q("target"));var e=l.DomHandler.getOffset(D.current),t=l.DomHandler.getOffset(q("target")),r=0;e.left<t.left&&(r=t.left-e.left),D.current.style.setProperty("--overlayArrowLeft","".concat(r,"px")),e.top<t.top&&!I()&&l.DomHandler.addClass(D.current,"p-confirm-popup-flipped")}},W=function(e){return D&&D.current&&!(D.current.isSameNode(e)||D.current.contains(e))},ee=function(e){if(e.tagKey===v.tagKey){var t=y!==e.visible;q("target")!==e.target&&!v.target?($(),k.current=e,h(!0)):t&&(k.current=e,e.visible?Y():$())}};s.useEffect((function(){v.visible?Y():$()}),[v.visible]),s.useEffect((function(){return v.target||v.message||a.OverlayService.on("confirm-popup",ee),function(){a.OverlayService.off("confirm-popup",ee)}}),[v.target]),c.useUpdateEffect((function(){S&&Y()}),[S]),c.useUnmountEffect((function(){H.current&&(a.OverlayService.off("overlay-click",H.current),H.current=null),a.OverlayService.off("confirm-popup",ee),l.ZIndexUtils.clear(D.current)})),s.useImperativeHandle(u,(function(){return{props:v,confirm:ee}}));var te,re,ne=function(){var e=l.classNames("p-confirm-popup-accept p-button-sm",q("acceptClassName")),t=l.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!q("rejectClassName")},q("rejectClassName")),n=p({className:C("footer")},w("footer")),o=p({ref:U,label:V,icon:q("rejectIcon"),className:C("rejectButton",{getPropValue:q}),onClick:F,pt:w("rejectButton"),unstyled:v.unstyled,__parentMetadata:{parent:E}}),c=p({ref:R,label:M,icon:q("acceptIcon"),className:C("acceptButton",{getPropValue:q}),onClick:G,pt:w("acceptButton"),unstyled:v.unstyled,__parentMetadata:{parent:E}}),a=s.createElement("div",n,s.createElement(r.Button,o),s.createElement(r.Button,c));if(q("footer")){var i={accept:G,reject:F,className:"p-confirm-popup-footer",acceptClassName:e,rejectClassName:t,acceptLabel:M,rejectLabel:V,element:a,props:L()};return l.ObjectUtils.getJSXElement(q("footer"),i)}return a},oe=p({ref:D,id:q("id"),className:l.classNames(v.className,C("root",{context:d,getPropValue:q})),style:q("style"),onClick:function(e){_.current=!0,a.OverlayService.emit("overlay-click",{originalEvent:e,target:q("target")})}},P.getOtherProps(v),w("root")),ce=p({classNames:C("transition"),in:y,timeout:{enter:120,exit:100},options:q("transitionOptions"),unmountOnExit:!0,onEnter:function(){l.ZIndexUtils.set("overlay",D.current,d&&d.autoZIndex||f.default.autoZIndex,d&&d.zIndex.overlay||f.default.zIndex.overlay),l.DomHandler.addStyles(D.current,{position:"absolute",top:"0",left:"0"}),Q()},onEntered:function(){Z();var e=q("defaultFocus");void 0!==e&&"accept"!==e||R.current&&R.current.focus(),"reject"===e&&U.current&&U.current.focus(),T("onShow")},onExit:function(){z()},onExited:function(){l.ZIndexUtils.clear(D.current),_.current=!1}},w("transition")),ae=null!=e&&e.content?(te=L(),re={message:l.ObjectUtils.getJSXElement(q("message"),te),acceptBtnRef:R,rejectBtnRef:U,hide:$},s.createElement(o.CSSTransition,m({nodeRef:D},ce),s.createElement("div",oe,l.ObjectUtils.getJSXElement(e.content,re)))):function(){var e,t,r,n,c,a,i=(e=L(),t=l.ObjectUtils.getJSXElement(q("message"),e),r=p({className:C("icon")},w("icon")),n=l.IconUtils.getJSXIcon(q("icon"),x({},r),{props:e}),c=p({className:C("message")},w("message")),a=p({className:C("content")},w("content")),s.createElement("div",a,n,s.createElement("span",c,t))),u=ne();return s.createElement(o.CSSTransition,m({nodeRef:D},ce),s.createElement("div",oe,i,u))}();return s.createElement(i.Portal,{element:ae,appendTo:q("appendTo"),visible:q("visible")})})));w.displayName="ConfirmPopup",exports.ConfirmPopup=w,exports.confirmPopup=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=x(x({},e),{visible:void 0===e.visible||e.visible})).visible&&a.OverlayService.emit("confirm-popup",e);return{show:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a.OverlayService.emit("confirm-popup",x(x(x({},e),t),{visible:!0}))},hide:function(){a.OverlayService.emit("confirm-popup",{visible:!1})}}};
|
|
@@ -257,9 +257,17 @@ var ConfirmPopup = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(functio
|
|
|
257
257
|
var type = _ref.type,
|
|
258
258
|
valid = _ref.valid;
|
|
259
259
|
if (valid) {
|
|
260
|
-
type === 'outside'
|
|
260
|
+
if (type === 'outside') {
|
|
261
|
+
if (props.dismissable && !isPanelClicked.current) {
|
|
262
|
+
hide('hide');
|
|
263
|
+
}
|
|
264
|
+
isPanelClicked.current = false;
|
|
265
|
+
} else if (context.hideOverlaysOnDocumentScrolling) {
|
|
266
|
+
hide('hide');
|
|
267
|
+
} else if (!DomHandler.isDocument(event.target)) {
|
|
268
|
+
align();
|
|
269
|
+
}
|
|
261
270
|
}
|
|
262
|
-
isPanelClicked.current = false;
|
|
263
271
|
},
|
|
264
272
|
when: visibleState
|
|
265
273
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import t,{PrimeReactContext as n,localeOption as r}from"primereact/api";import{Button as o}from"primereact/button";import{ComponentBase as c,useHandleStyle as i}from"primereact/componentbase";import{CSSTransition as a}from"primereact/csstransition";import{useMergeProps as p,useDisplayOrder as l,useGlobalOnEscapeKey as u,ESC_KEY_HANDLING_PRIORITIES as s,useOverlayListener as f,useUpdateEffect as m,useUnmountEffect as b}from"primereact/hooks";import{OverlayService as d}from"primereact/overlayservice";import{Portal as v}from"primereact/portal";import{classNames as y,DomHandler as g,ZIndexUtils as j,ObjectUtils as h,IconUtils as O}from"primereact/utils";function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},E.apply(null,arguments)}function P(e){if(Array.isArray(e))return e}function S(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c,i,a=[],p=!0,l=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;p=!1}else for(;!(p=(r=c.call(n)).done)&&(a.push(r.value),a.length!==t);p=!0);}catch(e){l=!0,o=e}finally{try{if(!p&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return a}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){if(e){if("string"==typeof e)return w(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function N(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(e,t){return P(e)||S(e,t)||x(e,t)||N()}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function R(e,t){if("object"!=I(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function k(e){var t=R(e,"string");return"symbol"==I(t)?t:t+""}function A(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var L=c.extend({defaultProps:{__TYPE:"ConfirmPopup",accept:null,acceptClassName:null,acceptIcon:null,acceptLabel:null,appendTo:null,children:void 0,className:null,closeOnEscape:!0,content:null,defaultFocus:"accept",dismissable:!0,footer:null,icon:null,message:null,onHide:null,onShow:null,reject:null,rejectClassName:null,rejectIcon:null,rejectLabel:null,style:null,tagKey:void 0,target:null,transitionOptions:null,visible:!1},css:{classes:{root:function(e){var n=e.context;return y("p-confirm-popup p-component",(0,e.getPropValue)("className"),{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===t.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===t.ripple})},acceptButton:function(e){return y("p-confirm-popup-accept p-button-sm",(0,e.getPropValue)("acceptClassName"))},rejectButton:function(e){var t=e.getPropValue;return y("p-confirm-popup-reject p-button-sm",{"p-button-text":!t("rejectClassName")},t("rejectClassName"))},content:"p-confirm-popup-content",icon:"p-confirm-popup-icon",message:"p-confirm-popup-message",footer:"p-confirm-popup-footer",transition:"p-connected-overlay"},styles:'\n@layer primereact {\n .p-confirm-popup {\n margin-top: 10px; \n }\n\n .p-confirm-popup-flipped {\n margin-top: -10px;\n }\n \n .p-confirm-popup:after, .p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-confirm-popup-flipped:after, .p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent\n }\n \n .p-confirm-popup .p-confirm-popup-content {\n display: flex;\n align-items: center;\n }\n}\n'}});function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach((function(t){A(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=V(V({},e),{visible:void 0===e.visible||e.visible})).visible&&d.emit("confirm-popup",e);return{show:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d.emit("confirm-popup",V(V(V({},e),t),{visible:!0}))},hide:function(){d.emit("confirm-popup",{visible:!1})}}},T=e.memo(e.forwardRef((function(c,P){var S=p(),w=e.useContext(n),x=L.getProps(c,w),N=C(e.useState(x.visible),2),I=N[0],R=N[1],k=C(e.useState(!1),2),A=k[0],B=k[1],D={props:x,state:{visible:I,reshow:A}},T=L.setMetaData(D),_=T.ptm,J=T.cx,X=T.isUnstyled;i(L.css.styles,X,{name:"confirmpopup"});var M=e.useRef(null),H=e.useRef(null),K=e.useRef(null),z=e.useRef(!1),F=e.useRef(null),U=e.useRef(null),Z=e.useRef(null),G=e.useRef(!1),Y=function(){return U.current||x},$=function(e){return(U.current||x)[e]},q=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return h.getPropValue($(e),n)},Q=$("acceptLabel")||r("accept"),W=$("rejectLabel")||r("reject"),ee=x.dismissable&&x.closeOnEscape&&I,te=l("dialog",ee);u({callback:function(){pe("hide")},when:ee&&te,priority:[s.DIALOG,te]});var ne=C(f({target:$("target"),overlay:M,listener:function(e,t){t.valid&&("outside"===t.type?x.dismissable&&!z.current&&pe("hide"):pe("hide")),z.current=!1},when:I}),2),re=ne[0],oe=ne[1],ce=function(){G.current||(G.current=!0,q("accept"),pe("accept"))},ie=function(){G.current||(G.current=!0,q("reject"),pe("reject"))},ae=function(){var e=Y();B(!1),e.group===x.group&&(R(!0),G.current=!1,F.current=function(e){!ue(e.target)&&(z.current=!0)},d.on("overlay-click",F.current),Z.current=document.activeElement)},pe=function(e){R(!1),d.off("overlay-click",F.current),F.current=null,e&&q("onHide",e),g.focus(Z.current),Z.current=null},le=function(){if($("target")){g.absolutePosition(M.current,$("target"));var e=g.getOffset(M.current),t=g.getOffset($("target")),n=0;e.left<t.left&&(n=t.left-e.left),M.current.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&!X()&&g.addClass(M.current,"p-confirm-popup-flipped")}},ue=function(e){return M&&M.current&&!(M.current.isSameNode(e)||M.current.contains(e))},se=function(e){if(e.tagKey===x.tagKey){var t=I!==e.visible;$("target")!==e.target&&!x.target?(pe(),U.current=e,B(!0)):t&&(U.current=e,e.visible?ae():pe())}};e.useEffect((function(){x.visible?ae():pe()}),[x.visible]),e.useEffect((function(){return x.target||x.message||d.on("confirm-popup",se),function(){d.off("confirm-popup",se)}}),[x.target]),m((function(){A&&ae()}),[A]),b((function(){F.current&&(d.off("overlay-click",F.current),F.current=null),d.off("confirm-popup",se),j.clear(M.current)})),e.useImperativeHandle(P,(function(){return{props:x,confirm:se}}));var fe,me,be=function(){var t=y("p-confirm-popup-accept p-button-sm",$("acceptClassName")),n=y("p-confirm-popup-reject p-button-sm",{"p-button-text":!$("rejectClassName")},$("rejectClassName")),r=S({className:J("footer")},_("footer")),c=S({ref:K,label:W,icon:$("rejectIcon"),className:J("rejectButton",{getPropValue:$}),onClick:ie,pt:_("rejectButton"),unstyled:x.unstyled,__parentMetadata:{parent:D}}),i=S({ref:H,label:Q,icon:$("acceptIcon"),className:J("acceptButton",{getPropValue:$}),onClick:ce,pt:_("acceptButton"),unstyled:x.unstyled,__parentMetadata:{parent:D}}),a=e.createElement("div",r,e.createElement(o,c),e.createElement(o,i));if($("footer")){var p={accept:ce,reject:ie,className:"p-confirm-popup-footer",acceptClassName:t,rejectClassName:n,acceptLabel:Q,rejectLabel:W,element:a,props:Y()};return h.getJSXElement($("footer"),p)}return a},de=S({ref:M,id:$("id"),className:y(x.className,J("root",{context:w,getPropValue:$})),style:$("style"),onClick:function(e){z.current=!0,d.emit("overlay-click",{originalEvent:e,target:$("target")})}},L.getOtherProps(x),_("root")),ve=S({classNames:J("transition"),in:I,timeout:{enter:120,exit:100},options:$("transitionOptions"),unmountOnExit:!0,onEnter:function(){j.set("overlay",M.current,w&&w.autoZIndex||t.autoZIndex,w&&w.zIndex.overlay||t.zIndex.overlay),g.addStyles(M.current,{position:"absolute",top:"0",left:"0"}),le()},onEntered:function(){re();var e=$("defaultFocus");void 0!==e&&"accept"!==e||H.current&&H.current.focus(),"reject"===e&&K.current&&K.current.focus(),q("onShow")},onExit:function(){oe()},onExited:function(){j.clear(M.current),z.current=!1}},_("transition")),ye=null!=c&&c.content?(fe=Y(),me={message:h.getJSXElement($("message"),fe),acceptBtnRef:H,rejectBtnRef:K,hide:pe},e.createElement(a,E({nodeRef:M},ve),e.createElement("div",de,h.getJSXElement(c.content,me)))):function(){var t,n,r,o,c,i,p=(t=Y(),n=h.getJSXElement($("message"),t),r=S({className:J("icon")},_("icon")),o=O.getJSXIcon($("icon"),V({},r),{props:t}),c=S({className:J("message")},_("message")),i=S({className:J("content")},_("content")),e.createElement("div",i,o,e.createElement("span",c,n))),l=be();return e.createElement(a,E({nodeRef:M},ve),e.createElement("div",de,p,l))}();return e.createElement(v,{element:ye,appendTo:$("appendTo"),visible:$("visible")})})));T.displayName="ConfirmPopup";export{T as ConfirmPopup,D as confirmPopup};
|
|
1
|
+
import*as e from"react";import t,{PrimeReactContext as n,localeOption as r}from"primereact/api";import{Button as o}from"primereact/button";import{ComponentBase as c,useHandleStyle as i}from"primereact/componentbase";import{CSSTransition as a}from"primereact/csstransition";import{useMergeProps as p,useDisplayOrder as l,useGlobalOnEscapeKey as u,ESC_KEY_HANDLING_PRIORITIES as s,useOverlayListener as f,useUpdateEffect as m,useUnmountEffect as b}from"primereact/hooks";import{OverlayService as d}from"primereact/overlayservice";import{Portal as v}from"primereact/portal";import{classNames as y,DomHandler as g,ZIndexUtils as j,ObjectUtils as h,IconUtils as O}from"primereact/utils";function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},E.apply(null,arguments)}function S(e){if(Array.isArray(e))return e}function P(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c,i,a=[],p=!0,l=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;p=!1}else for(;!(p=(r=c.call(n)).done)&&(a.push(r.value),a.length!==t);p=!0);}catch(e){l=!0,o=e}finally{try{if(!p&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return a}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){if(e){if("string"==typeof e)return w(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function N(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(e,t){return S(e)||P(e,t)||x(e,t)||N()}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function R(e,t){if("object"!=I(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function k(e){var t=R(e,"string");return"symbol"==I(t)?t:t+""}function A(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var L=c.extend({defaultProps:{__TYPE:"ConfirmPopup",accept:null,acceptClassName:null,acceptIcon:null,acceptLabel:null,appendTo:null,children:void 0,className:null,closeOnEscape:!0,content:null,defaultFocus:"accept",dismissable:!0,footer:null,icon:null,message:null,onHide:null,onShow:null,reject:null,rejectClassName:null,rejectIcon:null,rejectLabel:null,style:null,tagKey:void 0,target:null,transitionOptions:null,visible:!1},css:{classes:{root:function(e){var n=e.context;return y("p-confirm-popup p-component",(0,e.getPropValue)("className"),{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===t.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===t.ripple})},acceptButton:function(e){return y("p-confirm-popup-accept p-button-sm",(0,e.getPropValue)("acceptClassName"))},rejectButton:function(e){var t=e.getPropValue;return y("p-confirm-popup-reject p-button-sm",{"p-button-text":!t("rejectClassName")},t("rejectClassName"))},content:"p-confirm-popup-content",icon:"p-confirm-popup-icon",message:"p-confirm-popup-message",footer:"p-confirm-popup-footer",transition:"p-connected-overlay"},styles:'\n@layer primereact {\n .p-confirm-popup {\n margin-top: 10px; \n }\n\n .p-confirm-popup-flipped {\n margin-top: -10px;\n }\n \n .p-confirm-popup:after, .p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-confirm-popup-flipped:after, .p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent\n }\n \n .p-confirm-popup .p-confirm-popup-content {\n display: flex;\n align-items: center;\n }\n}\n'}});function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach((function(t){A(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var V=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=D(D({},e),{visible:void 0===e.visible||e.visible})).visible&&d.emit("confirm-popup",e);return{show:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d.emit("confirm-popup",D(D(D({},e),t),{visible:!0}))},hide:function(){d.emit("confirm-popup",{visible:!1})}}},T=e.memo(e.forwardRef((function(c,S){var P=p(),w=e.useContext(n),x=L.getProps(c,w),N=C(e.useState(x.visible),2),I=N[0],R=N[1],k=C(e.useState(!1),2),A=k[0],B=k[1],V={props:x,state:{visible:I,reshow:A}},T=L.setMetaData(V),_=T.ptm,J=T.cx,X=T.isUnstyled;i(L.css.styles,X,{name:"confirmpopup"});var M=e.useRef(null),H=e.useRef(null),K=e.useRef(null),z=e.useRef(!1),F=e.useRef(null),U=e.useRef(null),Z=e.useRef(null),G=e.useRef(!1),Y=function(){return U.current||x},$=function(e){return(U.current||x)[e]},q=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return h.getPropValue($(e),n)},Q=$("acceptLabel")||r("accept"),W=$("rejectLabel")||r("reject"),ee=x.dismissable&&x.closeOnEscape&&I,te=l("dialog",ee);u({callback:function(){pe("hide")},when:ee&&te,priority:[s.DIALOG,te]});var ne=C(f({target:$("target"),overlay:M,listener:function(e,t){t.valid&&("outside"===t.type?(x.dismissable&&!z.current&&pe("hide"),z.current=!1):w.hideOverlaysOnDocumentScrolling?pe("hide"):g.isDocument(e.target)||le())},when:I}),2),re=ne[0],oe=ne[1],ce=function(){G.current||(G.current=!0,q("accept"),pe("accept"))},ie=function(){G.current||(G.current=!0,q("reject"),pe("reject"))},ae=function(){var e=Y();B(!1),e.group===x.group&&(R(!0),G.current=!1,F.current=function(e){!ue(e.target)&&(z.current=!0)},d.on("overlay-click",F.current),Z.current=document.activeElement)},pe=function(e){R(!1),d.off("overlay-click",F.current),F.current=null,e&&q("onHide",e),g.focus(Z.current),Z.current=null},le=function(){if($("target")){g.absolutePosition(M.current,$("target"));var e=g.getOffset(M.current),t=g.getOffset($("target")),n=0;e.left<t.left&&(n=t.left-e.left),M.current.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&!X()&&g.addClass(M.current,"p-confirm-popup-flipped")}},ue=function(e){return M&&M.current&&!(M.current.isSameNode(e)||M.current.contains(e))},se=function(e){if(e.tagKey===x.tagKey){var t=I!==e.visible;$("target")!==e.target&&!x.target?(pe(),U.current=e,B(!0)):t&&(U.current=e,e.visible?ae():pe())}};e.useEffect((function(){x.visible?ae():pe()}),[x.visible]),e.useEffect((function(){return x.target||x.message||d.on("confirm-popup",se),function(){d.off("confirm-popup",se)}}),[x.target]),m((function(){A&&ae()}),[A]),b((function(){F.current&&(d.off("overlay-click",F.current),F.current=null),d.off("confirm-popup",se),j.clear(M.current)})),e.useImperativeHandle(S,(function(){return{props:x,confirm:se}}));var fe,me,be=function(){var t=y("p-confirm-popup-accept p-button-sm",$("acceptClassName")),n=y("p-confirm-popup-reject p-button-sm",{"p-button-text":!$("rejectClassName")},$("rejectClassName")),r=P({className:J("footer")},_("footer")),c=P({ref:K,label:W,icon:$("rejectIcon"),className:J("rejectButton",{getPropValue:$}),onClick:ie,pt:_("rejectButton"),unstyled:x.unstyled,__parentMetadata:{parent:V}}),i=P({ref:H,label:Q,icon:$("acceptIcon"),className:J("acceptButton",{getPropValue:$}),onClick:ce,pt:_("acceptButton"),unstyled:x.unstyled,__parentMetadata:{parent:V}}),a=e.createElement("div",r,e.createElement(o,c),e.createElement(o,i));if($("footer")){var p={accept:ce,reject:ie,className:"p-confirm-popup-footer",acceptClassName:t,rejectClassName:n,acceptLabel:Q,rejectLabel:W,element:a,props:Y()};return h.getJSXElement($("footer"),p)}return a},de=P({ref:M,id:$("id"),className:y(x.className,J("root",{context:w,getPropValue:$})),style:$("style"),onClick:function(e){z.current=!0,d.emit("overlay-click",{originalEvent:e,target:$("target")})}},L.getOtherProps(x),_("root")),ve=P({classNames:J("transition"),in:I,timeout:{enter:120,exit:100},options:$("transitionOptions"),unmountOnExit:!0,onEnter:function(){j.set("overlay",M.current,w&&w.autoZIndex||t.autoZIndex,w&&w.zIndex.overlay||t.zIndex.overlay),g.addStyles(M.current,{position:"absolute",top:"0",left:"0"}),le()},onEntered:function(){re();var e=$("defaultFocus");void 0!==e&&"accept"!==e||H.current&&H.current.focus(),"reject"===e&&K.current&&K.current.focus(),q("onShow")},onExit:function(){oe()},onExited:function(){j.clear(M.current),z.current=!1}},_("transition")),ye=null!=c&&c.content?(fe=Y(),me={message:h.getJSXElement($("message"),fe),acceptBtnRef:H,rejectBtnRef:K,hide:pe},e.createElement(a,E({nodeRef:M},ve),e.createElement("div",de,h.getJSXElement(c.content,me)))):function(){var t,n,r,o,c,i,p=(t=Y(),n=h.getJSXElement($("message"),t),r=P({className:J("icon")},_("icon")),o=O.getJSXIcon($("icon"),D({},r),{props:t}),c=P({className:J("message")},_("message")),i=P({className:J("content")},_("content")),e.createElement("div",i,o,e.createElement("span",c,n))),l=be();return e.createElement(a,E({nodeRef:M},ve),e.createElement("div",de,p,l))}();return e.createElement(v,{element:ye,appendTo:$("appendTo"),visible:$("visible")})})));T.displayName="ConfirmPopup";export{T as ConfirmPopup,V as confirmPopup};
|
|
@@ -273,9 +273,17 @@ this.primereact.confirmpopup = (function (exports, React, PrimeReact, button, co
|
|
|
273
273
|
var type = _ref.type,
|
|
274
274
|
valid = _ref.valid;
|
|
275
275
|
if (valid) {
|
|
276
|
-
type === 'outside'
|
|
276
|
+
if (type === 'outside') {
|
|
277
|
+
if (props.dismissable && !isPanelClicked.current) {
|
|
278
|
+
hide('hide');
|
|
279
|
+
}
|
|
280
|
+
isPanelClicked.current = false;
|
|
281
|
+
} else if (context.hideOverlaysOnDocumentScrolling) {
|
|
282
|
+
hide('hide');
|
|
283
|
+
} else if (!utils.DomHandler.isDocument(event.target)) {
|
|
284
|
+
align();
|
|
285
|
+
}
|
|
277
286
|
}
|
|
278
|
-
isPanelClicked.current = false;
|
|
279
287
|
},
|
|
280
288
|
when: visibleState
|
|
281
289
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.confirmpopup=function(e,t,n,r,o,c,a,i,l,u){"use strict";function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var f=s(t),m=p(n);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(null,arguments)}function v(e){if(Array.isArray(e))return e}function b(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c,a,i=[],l=!0,u=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=c.call(n)).done)&&(i.push(r.value),i.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return i}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function O(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(e,t){return v(e)||b(e,t)||g(e,t)||O()}function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function h(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=h(e,"string");return"symbol"==S(t)?t:t+""}function P(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=o.ComponentBase.extend({defaultProps:{__TYPE:"ConfirmPopup",accept:null,acceptClassName:null,acceptIcon:null,acceptLabel:null,appendTo:null,children:void 0,className:null,closeOnEscape:!0,content:null,defaultFocus:"accept",dismissable:!0,footer:null,icon:null,message:null,onHide:null,onShow:null,reject:null,rejectClassName:null,rejectIcon:null,rejectLabel:null,style:null,tagKey:void 0,target:null,transitionOptions:null,visible:!1},css:{classes:{root:function(e){var t=e.context;return u.classNames("p-confirm-popup p-component",(0,e.getPropValue)("className"),{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===m.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===m.default.ripple})},acceptButton:function(e){return u.classNames("p-confirm-popup-accept p-button-sm",(0,e.getPropValue)("acceptClassName"))},rejectButton:function(e){var t=e.getPropValue;return u.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!t("rejectClassName")},t("rejectClassName"))},content:"p-confirm-popup-content",icon:"p-confirm-popup-icon",message:"p-confirm-popup-message",footer:"p-confirm-popup-footer",transition:"p-connected-overlay"},styles:'\n@layer primereact {\n .p-confirm-popup {\n margin-top: 10px; \n }\n\n .p-confirm-popup-flipped {\n margin-top: -10px;\n }\n \n .p-confirm-popup:after, .p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-confirm-popup-flipped:after, .p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent\n }\n \n .p-confirm-popup .p-confirm-popup-content {\n display: flex;\n align-items: center;\n }\n}\n'}});function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var C=f.memo(f.forwardRef((function(e,t){var p=a.useMergeProps(),s=f.useContext(n.PrimeReactContext),v=N.getProps(e,s),b=j(f.useState(v.visible),2),y=b[0],g=b[1],O=j(f.useState(!1),2),S=O[0],h=O[1],E={props:v,state:{visible:y,reshow:S}},P=N.setMetaData(E),x=P.ptm,C=P.cx,I=P.isUnstyled;o.useHandleStyle(N.css.styles,I,{name:"confirmpopup"});var R=f.useRef(null),D=f.useRef(null),U=f.useRef(null),_=f.useRef(!1),k=f.useRef(null),A=f.useRef(null),B=f.useRef(null),H=f.useRef(!1),L=function(){return A.current||v},T=function(e){return(A.current||v)[e]},M=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return u.ObjectUtils.getPropValue(T(e),n)},V=T("acceptLabel")||n.localeOption("accept"),J=T("rejectLabel")||n.localeOption("reject"),K=v.dismissable&&v.closeOnEscape&&y,X=a.useDisplayOrder("dialog",K);a.useGlobalOnEscapeKey({callback:function(){q("hide")},when:K&&X,priority:[a.ESC_KEY_HANDLING_PRIORITIES.DIALOG,X]});var Z=j(a.useOverlayListener({target:T("target"),overlay:R,listener:function(e,t){t.valid&&("outside"===t.type?v.dismissable&&!_.current&&q("hide"):q("hide")),_.current=!1},when:y}),2),z=Z[0],G=Z[1],F=function(){H.current||(H.current=!0,M("accept"),q("accept"))},Y=function(){H.current||(H.current=!0,M("reject"),q("reject"))},$=function(){var e=L();h(!1),e.group===v.group&&(g(!0),H.current=!1,k.current=function(e){!W(e.target)&&(_.current=!0)},i.OverlayService.on("overlay-click",k.current),B.current=document.activeElement)},q=function(e){g(!1),i.OverlayService.off("overlay-click",k.current),k.current=null,e&&M("onHide",e),u.DomHandler.focus(B.current),B.current=null},Q=function(){if(T("target")){u.DomHandler.absolutePosition(R.current,T("target"));var e=u.DomHandler.getOffset(R.current),t=u.DomHandler.getOffset(T("target")),n=0;e.left<t.left&&(n=t.left-e.left),R.current.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&!I()&&u.DomHandler.addClass(R.current,"p-confirm-popup-flipped")}},W=function(e){return R&&R.current&&!(R.current.isSameNode(e)||R.current.contains(e))},ee=function(e){if(e.tagKey===v.tagKey){var t=y!==e.visible;T("target")!==e.target&&!v.target?(q(),A.current=e,h(!0)):t&&(A.current=e,e.visible?$():q())}};f.useEffect((function(){v.visible?$():q()}),[v.visible]),f.useEffect((function(){return v.target||v.message||i.OverlayService.on("confirm-popup",ee),function(){i.OverlayService.off("confirm-popup",ee)}}),[v.target]),a.useUpdateEffect((function(){S&&$()}),[S]),a.useUnmountEffect((function(){k.current&&(i.OverlayService.off("overlay-click",k.current),k.current=null),i.OverlayService.off("confirm-popup",ee),u.ZIndexUtils.clear(R.current)})),f.useImperativeHandle(t,(function(){return{props:v,confirm:ee}}));var te,ne,re=function(){var e=u.classNames("p-confirm-popup-accept p-button-sm",T("acceptClassName")),t=u.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!T("rejectClassName")},T("rejectClassName")),n=p({className:C("footer")},x("footer")),o=p({ref:U,label:J,icon:T("rejectIcon"),className:C("rejectButton",{getPropValue:T}),onClick:Y,pt:x("rejectButton"),unstyled:v.unstyled,__parentMetadata:{parent:E}}),c=p({ref:D,label:V,icon:T("acceptIcon"),className:C("acceptButton",{getPropValue:T}),onClick:F,pt:x("acceptButton"),unstyled:v.unstyled,__parentMetadata:{parent:E}}),a=f.createElement("div",n,f.createElement(r.Button,o),f.createElement(r.Button,c));if(T("footer")){var i={accept:F,reject:Y,className:"p-confirm-popup-footer",acceptClassName:e,rejectClassName:t,acceptLabel:V,rejectLabel:J,element:a,props:L()};return u.ObjectUtils.getJSXElement(T("footer"),i)}return a},oe=p({ref:R,id:T("id"),className:u.classNames(v.className,C("root",{context:s,getPropValue:T})),style:T("style"),onClick:function(e){_.current=!0,i.OverlayService.emit("overlay-click",{originalEvent:e,target:T("target")})}},N.getOtherProps(v),x("root")),ce=p({classNames:C("transition"),in:y,timeout:{enter:120,exit:100},options:T("transitionOptions"),unmountOnExit:!0,onEnter:function(){u.ZIndexUtils.set("overlay",R.current,s&&s.autoZIndex||m.default.autoZIndex,s&&s.zIndex.overlay||m.default.zIndex.overlay),u.DomHandler.addStyles(R.current,{position:"absolute",top:"0",left:"0"}),Q()},onEntered:function(){z();var e=T("defaultFocus");void 0!==e&&"accept"!==e||D.current&&D.current.focus(),"reject"===e&&U.current&&U.current.focus(),M("onShow")},onExit:function(){G()},onExited:function(){u.ZIndexUtils.clear(R.current),_.current=!1}},x("transition")),ae=null!=e&&e.content?(te=L(),ne={message:u.ObjectUtils.getJSXElement(T("message"),te),acceptBtnRef:D,rejectBtnRef:U,hide:q},f.createElement(c.CSSTransition,d({nodeRef:R},ce),f.createElement("div",oe,u.ObjectUtils.getJSXElement(e.content,ne)))):function(){var e,t,n,r,o,a,i=(e=L(),t=u.ObjectUtils.getJSXElement(T("message"),e),n=p({className:C("icon")},x("icon")),r=u.IconUtils.getJSXIcon(T("icon"),w({},n),{props:e}),o=p({className:C("message")},x("message")),a=p({className:C("content")},x("content")),f.createElement("div",a,r,f.createElement("span",o,t))),l=re();return f.createElement(c.CSSTransition,d({nodeRef:R},ce),f.createElement("div",oe,i,l))}();return f.createElement(l.Portal,{element:ae,appendTo:T("appendTo"),visible:T("visible")})})));return C.displayName="ConfirmPopup",e.ConfirmPopup=C,e.confirmPopup=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=w(w({},e),{visible:void 0===e.visible||e.visible})).visible&&i.OverlayService.emit("confirm-popup",e);return{show:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.OverlayService.emit("confirm-popup",w(w(w({},e),t),{visible:!0}))},hide:function(){i.OverlayService.emit("confirm-popup",{visible:!1})}}},Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.button,primereact.componentbase,primereact.csstransition,primereact.hooks,primereact.overlayservice,primereact.portal,primereact.utils);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.confirmpopup=function(e,t,n,r,o,c,a,i,l,u){"use strict";function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var f=s(t),m=p(n);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(null,arguments)}function v(e){if(Array.isArray(e))return e}function b(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,c,a,i=[],l=!0,u=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=c.call(n)).done)&&(i.push(r.value),i.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return i}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function O(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(e,t){return v(e)||b(e,t)||g(e,t)||O()}function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function h(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=h(e,"string");return"symbol"==S(t)?t:t+""}function P(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=o.ComponentBase.extend({defaultProps:{__TYPE:"ConfirmPopup",accept:null,acceptClassName:null,acceptIcon:null,acceptLabel:null,appendTo:null,children:void 0,className:null,closeOnEscape:!0,content:null,defaultFocus:"accept",dismissable:!0,footer:null,icon:null,message:null,onHide:null,onShow:null,reject:null,rejectClassName:null,rejectIcon:null,rejectLabel:null,style:null,tagKey:void 0,target:null,transitionOptions:null,visible:!1},css:{classes:{root:function(e){var t=e.context;return u.classNames("p-confirm-popup p-component",(0,e.getPropValue)("className"),{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===m.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===m.default.ripple})},acceptButton:function(e){return u.classNames("p-confirm-popup-accept p-button-sm",(0,e.getPropValue)("acceptClassName"))},rejectButton:function(e){var t=e.getPropValue;return u.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!t("rejectClassName")},t("rejectClassName"))},content:"p-confirm-popup-content",icon:"p-confirm-popup-icon",message:"p-confirm-popup-message",footer:"p-confirm-popup-footer",transition:"p-connected-overlay"},styles:'\n@layer primereact {\n .p-confirm-popup {\n margin-top: 10px; \n }\n\n .p-confirm-popup-flipped {\n margin-top: -10px;\n }\n \n .p-confirm-popup:after, .p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-confirm-popup-flipped:after, .p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent\n }\n \n .p-confirm-popup .p-confirm-popup-content {\n display: flex;\n align-items: center;\n }\n}\n'}});function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var C=f.memo(f.forwardRef((function(e,t){var p=a.useMergeProps(),s=f.useContext(n.PrimeReactContext),v=N.getProps(e,s),b=j(f.useState(v.visible),2),y=b[0],g=b[1],O=j(f.useState(!1),2),S=O[0],h=O[1],E={props:v,state:{visible:y,reshow:S}},P=N.setMetaData(E),x=P.ptm,C=P.cx,I=P.isUnstyled;o.useHandleStyle(N.css.styles,I,{name:"confirmpopup"});var D=f.useRef(null),R=f.useRef(null),U=f.useRef(null),_=f.useRef(!1),H=f.useRef(null),k=f.useRef(null),A=f.useRef(null),B=f.useRef(!1),L=function(){return k.current||v},T=function(e){return(k.current||v)[e]},M=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return u.ObjectUtils.getPropValue(T(e),n)},V=T("acceptLabel")||n.localeOption("accept"),J=T("rejectLabel")||n.localeOption("reject"),K=v.dismissable&&v.closeOnEscape&&y,X=a.useDisplayOrder("dialog",K);a.useGlobalOnEscapeKey({callback:function(){q("hide")},when:K&&X,priority:[a.ESC_KEY_HANDLING_PRIORITIES.DIALOG,X]});var Z=j(a.useOverlayListener({target:T("target"),overlay:D,listener:function(e,t){t.valid&&("outside"===t.type?(v.dismissable&&!_.current&&q("hide"),_.current=!1):s.hideOverlaysOnDocumentScrolling?q("hide"):u.DomHandler.isDocument(e.target)||Q())},when:y}),2),z=Z[0],G=Z[1],F=function(){B.current||(B.current=!0,M("accept"),q("accept"))},Y=function(){B.current||(B.current=!0,M("reject"),q("reject"))},$=function(){var e=L();h(!1),e.group===v.group&&(g(!0),B.current=!1,H.current=function(e){!W(e.target)&&(_.current=!0)},i.OverlayService.on("overlay-click",H.current),A.current=document.activeElement)},q=function(e){g(!1),i.OverlayService.off("overlay-click",H.current),H.current=null,e&&M("onHide",e),u.DomHandler.focus(A.current),A.current=null},Q=function(){if(T("target")){u.DomHandler.absolutePosition(D.current,T("target"));var e=u.DomHandler.getOffset(D.current),t=u.DomHandler.getOffset(T("target")),n=0;e.left<t.left&&(n=t.left-e.left),D.current.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&!I()&&u.DomHandler.addClass(D.current,"p-confirm-popup-flipped")}},W=function(e){return D&&D.current&&!(D.current.isSameNode(e)||D.current.contains(e))},ee=function(e){if(e.tagKey===v.tagKey){var t=y!==e.visible;T("target")!==e.target&&!v.target?(q(),k.current=e,h(!0)):t&&(k.current=e,e.visible?$():q())}};f.useEffect((function(){v.visible?$():q()}),[v.visible]),f.useEffect((function(){return v.target||v.message||i.OverlayService.on("confirm-popup",ee),function(){i.OverlayService.off("confirm-popup",ee)}}),[v.target]),a.useUpdateEffect((function(){S&&$()}),[S]),a.useUnmountEffect((function(){H.current&&(i.OverlayService.off("overlay-click",H.current),H.current=null),i.OverlayService.off("confirm-popup",ee),u.ZIndexUtils.clear(D.current)})),f.useImperativeHandle(t,(function(){return{props:v,confirm:ee}}));var te,ne,re=function(){var e=u.classNames("p-confirm-popup-accept p-button-sm",T("acceptClassName")),t=u.classNames("p-confirm-popup-reject p-button-sm",{"p-button-text":!T("rejectClassName")},T("rejectClassName")),n=p({className:C("footer")},x("footer")),o=p({ref:U,label:J,icon:T("rejectIcon"),className:C("rejectButton",{getPropValue:T}),onClick:Y,pt:x("rejectButton"),unstyled:v.unstyled,__parentMetadata:{parent:E}}),c=p({ref:R,label:V,icon:T("acceptIcon"),className:C("acceptButton",{getPropValue:T}),onClick:F,pt:x("acceptButton"),unstyled:v.unstyled,__parentMetadata:{parent:E}}),a=f.createElement("div",n,f.createElement(r.Button,o),f.createElement(r.Button,c));if(T("footer")){var i={accept:F,reject:Y,className:"p-confirm-popup-footer",acceptClassName:e,rejectClassName:t,acceptLabel:V,rejectLabel:J,element:a,props:L()};return u.ObjectUtils.getJSXElement(T("footer"),i)}return a},oe=p({ref:D,id:T("id"),className:u.classNames(v.className,C("root",{context:s,getPropValue:T})),style:T("style"),onClick:function(e){_.current=!0,i.OverlayService.emit("overlay-click",{originalEvent:e,target:T("target")})}},N.getOtherProps(v),x("root")),ce=p({classNames:C("transition"),in:y,timeout:{enter:120,exit:100},options:T("transitionOptions"),unmountOnExit:!0,onEnter:function(){u.ZIndexUtils.set("overlay",D.current,s&&s.autoZIndex||m.default.autoZIndex,s&&s.zIndex.overlay||m.default.zIndex.overlay),u.DomHandler.addStyles(D.current,{position:"absolute",top:"0",left:"0"}),Q()},onEntered:function(){z();var e=T("defaultFocus");void 0!==e&&"accept"!==e||R.current&&R.current.focus(),"reject"===e&&U.current&&U.current.focus(),M("onShow")},onExit:function(){G()},onExited:function(){u.ZIndexUtils.clear(D.current),_.current=!1}},x("transition")),ae=null!=e&&e.content?(te=L(),ne={message:u.ObjectUtils.getJSXElement(T("message"),te),acceptBtnRef:R,rejectBtnRef:U,hide:q},f.createElement(c.CSSTransition,d({nodeRef:D},ce),f.createElement("div",oe,u.ObjectUtils.getJSXElement(e.content,ne)))):function(){var e,t,n,r,o,a,i=(e=L(),t=u.ObjectUtils.getJSXElement(T("message"),e),n=p({className:C("icon")},x("icon")),r=u.IconUtils.getJSXIcon(T("icon"),w({},n),{props:e}),o=p({className:C("message")},x("message")),a=p({className:C("content")},x("content")),f.createElement("div",a,r,f.createElement("span",o,t))),l=re();return f.createElement(c.CSSTransition,d({nodeRef:D},ce),f.createElement("div",oe,i,l))}();return f.createElement(l.Portal,{element:ae,appendTo:T("appendTo"),visible:T("visible")})})));return C.displayName="ConfirmPopup",e.ConfirmPopup=C,e.confirmPopup=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=w(w({},e),{visible:void 0===e.visible||e.visible})).visible&&i.OverlayService.emit("confirm-popup",e);return{show:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.OverlayService.emit("confirm-popup",w(w(w({},e),t),{visible:!0}))},hide:function(){i.OverlayService.emit("confirm-popup",{visible:!1})}}},Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.button,primereact.componentbase,primereact.csstransition,primereact.hooks,primereact.overlayservice,primereact.portal,primereact.utils);
|
package/core/core.js
CHANGED
|
@@ -549,11 +549,18 @@ this.primereact.utils = (function (exports, React) {
|
|
|
549
549
|
element.style.transformOrigin = 'top';
|
|
550
550
|
}
|
|
551
551
|
var targetOffsetPx = targetOffset.left;
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
552
|
+
if (align === 'left') {
|
|
553
|
+
if (targetOffsetPx + elementOuterWidth > viewport.width) {
|
|
554
|
+
left = Math.max(0, targetOffsetPx + windowScrollLeft + targetOuterWidth - elementOuterWidth);
|
|
555
|
+
} else {
|
|
556
|
+
left = targetOffsetPx + windowScrollLeft;
|
|
557
|
+
}
|
|
555
558
|
} else {
|
|
556
|
-
|
|
559
|
+
if (targetOffsetPx + targetOuterWidth - elementOuterWidth < 0) {
|
|
560
|
+
left = windowScrollLeft;
|
|
561
|
+
} else {
|
|
562
|
+
left = targetOffsetPx + targetOuterWidth - elementOuterWidth + windowScrollLeft;
|
|
563
|
+
}
|
|
557
564
|
}
|
|
558
565
|
element.style.top = top + 'px';
|
|
559
566
|
element.style.left = left + 'px';
|
|
@@ -762,13 +769,12 @@ this.primereact.utils = (function (exports, React) {
|
|
|
762
769
|
/**
|
|
763
770
|
* Gets all scrollable parent elements of a given element
|
|
764
771
|
* @param {HTMLElement} element - The element to find scrollable parents for
|
|
765
|
-
* @param {boolean} hideOverlaysOnDocumentScrolling - Whether to include window/document level scrolling
|
|
766
772
|
* @returns {Array} Array of scrollable parent elements
|
|
767
773
|
*/
|
|
768
774
|
}, {
|
|
769
775
|
key: "getScrollableParents",
|
|
770
776
|
value: function getScrollableParents(element) {
|
|
771
|
-
var
|
|
777
|
+
var _this3 = this;
|
|
772
778
|
var scrollableParents = [];
|
|
773
779
|
if (element) {
|
|
774
780
|
// Get all parent elements
|
|
@@ -791,10 +797,8 @@ this.primereact.utils = (function (exports, React) {
|
|
|
791
797
|
* @param {HTMLElement} node - Element to add
|
|
792
798
|
*/
|
|
793
799
|
var addScrollableParent = function addScrollableParent(node) {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
scrollableParents.push(node.nodeName === 'BODY' || node.nodeName === 'HTML' || node.nodeType === 9 ? window : node);
|
|
797
|
-
}
|
|
800
|
+
// For document/body/html elements, add window instead
|
|
801
|
+
scrollableParents.push(node.nodeName === 'BODY' || node.nodeName === 'HTML' || _this3.isDocument(node) ? window : node);
|
|
798
802
|
};
|
|
799
803
|
|
|
800
804
|
// Iterate through all parent elements
|
|
@@ -838,13 +842,6 @@ this.primereact.utils = (function (exports, React) {
|
|
|
838
842
|
_iterator.f();
|
|
839
843
|
}
|
|
840
844
|
}
|
|
841
|
-
|
|
842
|
-
// Ensure window/body is always included as fallback
|
|
843
|
-
if (!scrollableParents.some(function (node) {
|
|
844
|
-
return node === document.body || node === window;
|
|
845
|
-
})) {
|
|
846
|
-
scrollableParents.push(hideOverlaysOnDocumentScrolling ? window : document.body);
|
|
847
|
-
}
|
|
848
845
|
return scrollableParents;
|
|
849
846
|
}
|
|
850
847
|
}, {
|
|
@@ -984,6 +981,11 @@ this.primereact.utils = (function (exports, React) {
|
|
|
984
981
|
value: function isElement(obj) {
|
|
985
982
|
return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? obj instanceof HTMLElement : obj && _typeof(obj) === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string';
|
|
986
983
|
}
|
|
984
|
+
}, {
|
|
985
|
+
key: "isDocument",
|
|
986
|
+
value: function isDocument(obj) {
|
|
987
|
+
return (typeof Document === "undefined" ? "undefined" : _typeof(Document)) === 'object' ? obj instanceof Document : obj && _typeof(obj) === 'object' && obj !== null && obj.nodeType === 9;
|
|
988
|
+
}
|
|
987
989
|
}, {
|
|
988
990
|
key: "scrollInView",
|
|
989
991
|
value: function scrollInView(container, item) {
|
|
@@ -1321,7 +1323,7 @@ this.primereact.utils = (function (exports, React) {
|
|
|
1321
1323
|
return !!(obj && obj.constructor && obj.call && obj.apply);
|
|
1322
1324
|
};
|
|
1323
1325
|
var element = isFunction(target) ? target() : target;
|
|
1324
|
-
return element
|
|
1326
|
+
return this.isDocument(element) || this.isExist(element) ? element : null;
|
|
1325
1327
|
}
|
|
1326
1328
|
|
|
1327
1329
|
/**
|
|
@@ -2034,6 +2036,122 @@ this.primereact.utils = (function (exports, React) {
|
|
|
2034
2036
|
obj = obj[fields[i]];
|
|
2035
2037
|
}
|
|
2036
2038
|
}
|
|
2039
|
+
|
|
2040
|
+
/**
|
|
2041
|
+
* This helper function takes an object and a dot-separated key path. It traverses the object based on the path,
|
|
2042
|
+
* returning the value at the specified depth. If any part of the path is missing or undefined, it returns undefined.
|
|
2043
|
+
*
|
|
2044
|
+
* Example:
|
|
2045
|
+
* const obj = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
|
|
2046
|
+
* const path = 'address.city';
|
|
2047
|
+
* const result = ObjectUtils.getNestedValue(obj, path);
|
|
2048
|
+
* console.log(result); // Output: "Wonderland"
|
|
2049
|
+
*
|
|
2050
|
+
* @param {object} obj - The object to traverse.
|
|
2051
|
+
* @param {string} path - The dot-separated key path.
|
|
2052
|
+
* @returns {*} The value at the specified depth, or undefined if any part of the path is missing or undefined.
|
|
2053
|
+
*/
|
|
2054
|
+
}, {
|
|
2055
|
+
key: "getNestedValue",
|
|
2056
|
+
value: function getNestedValue(obj, path) {
|
|
2057
|
+
return path.split('.').reduce(function (acc, part) {
|
|
2058
|
+
return acc && acc[part] !== undefined ? acc[part] : undefined;
|
|
2059
|
+
}, obj);
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* This function takes an object and a dot-separated key path. It traverses the object based on the path,
|
|
2064
|
+
* returning the value at the specified depth. If any part of the path is missing or undefined, it returns undefined.
|
|
2065
|
+
*
|
|
2066
|
+
* Example:
|
|
2067
|
+
* const objA = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
|
|
2068
|
+
* const objB = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
|
|
2069
|
+
* const result = ObjectUtils.absoluteCompare(objA, objB);
|
|
2070
|
+
* console.log(result); // Output: true
|
|
2071
|
+
*
|
|
2072
|
+
* const objC = { name: 'Alice', address: { city: 'Wonderland', zip: 12346 } };
|
|
2073
|
+
* const result2 = ObjectUtils.absoluteCompare(objA, objC);
|
|
2074
|
+
* console.log(result2); // Output: false
|
|
2075
|
+
*
|
|
2076
|
+
* @param {object} objA - The first object to compare.
|
|
2077
|
+
* @param {object} objB - The second object to compare.
|
|
2078
|
+
* @param {number} [maxDepth=1] - The maximum depth to compare.
|
|
2079
|
+
* @param {number} [currentDepth=0] - The current depth (used internally for recursion).
|
|
2080
|
+
* @returns {boolean} True if the objects are equal within the specified depth, false otherwise.
|
|
2081
|
+
*
|
|
2082
|
+
*/
|
|
2083
|
+
}, {
|
|
2084
|
+
key: "absoluteCompare",
|
|
2085
|
+
value: function absoluteCompare(objA, objB) {
|
|
2086
|
+
var maxDepth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
2087
|
+
var currentDepth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
2088
|
+
if (!objA || !objB) return true;
|
|
2089
|
+
if (currentDepth > maxDepth) return true;
|
|
2090
|
+
if (_typeof(objA) !== _typeof(objB)) return false;
|
|
2091
|
+
var aKeys = Object.keys(objA);
|
|
2092
|
+
var bKeys = Object.keys(objB);
|
|
2093
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
2094
|
+
for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
|
|
2095
|
+
var key = _aKeys[_i];
|
|
2096
|
+
var aValue = objA[key];
|
|
2097
|
+
var bValue = objB[key];
|
|
2098
|
+
|
|
2099
|
+
// Skip comparison if values are objects
|
|
2100
|
+
var isObject = ObjectUtils.isObject(aValue) && ObjectUtils.isObject(bValue);
|
|
2101
|
+
var isFunction = ObjectUtils.isFunction(aValue) && ObjectUtils.isFunction(bValue);
|
|
2102
|
+
if ((isObject || isFunction) && !this.absoluteCompare(aValue, bValue, maxDepth, currentDepth + 1)) return false;
|
|
2103
|
+
if (!isObject && aValue !== bValue) return false;
|
|
2104
|
+
}
|
|
2105
|
+
return true;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* This helper function takes two objects and a list of keys to compare. It compares the values of the specified keys
|
|
2110
|
+
* in both objects. If any comparison fails, it returns false. If all specified properties are equal, it returns true.
|
|
2111
|
+
* It performs a shallow comparison using absoluteCompare if no keys are provided.
|
|
2112
|
+
*
|
|
2113
|
+
* Example:
|
|
2114
|
+
* const objA = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
|
|
2115
|
+
* const objB = { name: 'Alice', address: { city: 'Wonderland', zip: 12345 } };
|
|
2116
|
+
* const keysToCompare = ['name', 'address.city', 'address.zip'];
|
|
2117
|
+
* const result = ObjectUtils.selectiveCompare(objA, objB, keysToCompare);
|
|
2118
|
+
* console.log(result); // Output: true
|
|
2119
|
+
*
|
|
2120
|
+
* const objC = { name: 'Alice', address: { city: 'Wonderland', zip: 12346 } };
|
|
2121
|
+
* const result2 = ObjectUtils.selectiveCompare(objA, objC, keysToCompare);
|
|
2122
|
+
* console.log(result2); // Output: false
|
|
2123
|
+
*
|
|
2124
|
+
* @param {object} a - The first object to compare.
|
|
2125
|
+
* @param {object} b - The second object to compare.
|
|
2126
|
+
* @param {string[]} [keysToCompare] - The keys to compare. If not provided, performs a shallow comparison using absoluteCompare.
|
|
2127
|
+
* @returns {boolean} True if all specified properties are equal, false otherwise.
|
|
2128
|
+
*/
|
|
2129
|
+
}, {
|
|
2130
|
+
key: "selectiveCompare",
|
|
2131
|
+
value: function selectiveCompare(a, b, keysToCompare) {
|
|
2132
|
+
if (a === b) return true;
|
|
2133
|
+
if (!a || !b || _typeof(a) !== 'object' || _typeof(b) !== 'object') return false;
|
|
2134
|
+
if (!keysToCompare) return this.absoluteCompare(a, b, 1); // If no keys are provided, the comparison is limited to one depth level.
|
|
2135
|
+
var _iterator2 = _createForOfIteratorHelper(keysToCompare),
|
|
2136
|
+
_step2;
|
|
2137
|
+
try {
|
|
2138
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2139
|
+
var key = _step2.value;
|
|
2140
|
+
var aValue = this.getNestedValue(a, key);
|
|
2141
|
+
var bValue = this.getNestedValue(b, key);
|
|
2142
|
+
var isObject = _typeof(aValue) === 'object' && aValue !== null && _typeof(bValue) === 'object' && bValue !== null;
|
|
2143
|
+
|
|
2144
|
+
// If the current key is an object, they are compared in one further level only.
|
|
2145
|
+
if (isObject && !this.absoluteCompare(aValue, bValue, 1)) return false;
|
|
2146
|
+
if (!isObject && aValue !== bValue) return false;
|
|
2147
|
+
}
|
|
2148
|
+
} catch (err) {
|
|
2149
|
+
_iterator2.e(err);
|
|
2150
|
+
} finally {
|
|
2151
|
+
_iterator2.f();
|
|
2152
|
+
}
|
|
2153
|
+
return true;
|
|
2154
|
+
}
|
|
2037
2155
|
}]);
|
|
2038
2156
|
}();
|
|
2039
2157
|
|
|
@@ -5037,7 +5155,14 @@ this.primereact.hooks = (function (exports, React, utils, PrimeReact) {
|
|
|
5037
5155
|
}
|
|
5038
5156
|
if (!listenerRef.current && targetRef.current) {
|
|
5039
5157
|
var hideOnScroll = context ? context.hideOverlaysOnDocumentScrolling : PrimeReact__default["default"].hideOverlaysOnDocumentScrolling;
|
|
5040
|
-
var nodes = scrollableParentsRef.current = utils.DomHandler.getScrollableParents(targetRef.current
|
|
5158
|
+
var nodes = scrollableParentsRef.current = utils.DomHandler.getScrollableParents(targetRef.current);
|
|
5159
|
+
|
|
5160
|
+
// Ensure window/body is always included as fallback
|
|
5161
|
+
if (!nodes.some(function (node) {
|
|
5162
|
+
return node === document.body || node === window;
|
|
5163
|
+
})) {
|
|
5164
|
+
nodes.push(hideOnScroll ? window : document.body);
|
|
5165
|
+
}
|
|
5041
5166
|
listenerRef.current = function (event) {
|
|
5042
5167
|
return listener && listener(event);
|
|
5043
5168
|
};
|
|
@@ -5129,19 +5254,20 @@ this.primereact.hooks = (function (exports, React, utils, PrimeReact) {
|
|
|
5129
5254
|
type: 'outside',
|
|
5130
5255
|
valid: event.which !== 3 && isOutsideClicked(event)
|
|
5131
5256
|
});
|
|
5132
|
-
}
|
|
5257
|
+
},
|
|
5258
|
+
when: when
|
|
5133
5259
|
}),
|
|
5134
5260
|
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
5135
5261
|
bindDocumentClickListener = _useEventListener2[0],
|
|
5136
5262
|
unbindDocumentClickListener = _useEventListener2[1];
|
|
5137
5263
|
var _useResizeListener = useResizeListener({
|
|
5138
|
-
target: 'window',
|
|
5139
5264
|
listener: function listener(event) {
|
|
5140
5265
|
_listener && _listener(event, {
|
|
5141
5266
|
type: 'resize',
|
|
5142
5267
|
valid: !utils.DomHandler.isTouchDevice()
|
|
5143
5268
|
});
|
|
5144
|
-
}
|
|
5269
|
+
},
|
|
5270
|
+
when: when
|
|
5145
5271
|
}),
|
|
5146
5272
|
_useResizeListener2 = _slicedToArray(_useResizeListener, 2),
|
|
5147
5273
|
bindWindowResizeListener = _useResizeListener2[0],
|
|
@@ -5154,7 +5280,8 @@ this.primereact.hooks = (function (exports, React, utils, PrimeReact) {
|
|
|
5154
5280
|
type: 'orientationchange',
|
|
5155
5281
|
valid: true
|
|
5156
5282
|
});
|
|
5157
|
-
}
|
|
5283
|
+
},
|
|
5284
|
+
when: when
|
|
5158
5285
|
}),
|
|
5159
5286
|
_useEventListener4 = _slicedToArray(_useEventListener3, 2),
|
|
5160
5287
|
bindWindowOrientationChangeListener = _useEventListener4[0],
|
|
@@ -5166,7 +5293,8 @@ this.primereact.hooks = (function (exports, React, utils, PrimeReact) {
|
|
|
5166
5293
|
type: 'scroll',
|
|
5167
5294
|
valid: true
|
|
5168
5295
|
});
|
|
5169
|
-
}
|
|
5296
|
+
},
|
|
5297
|
+
when: when
|
|
5170
5298
|
}),
|
|
5171
5299
|
_useOverlayScrollList2 = _slicedToArray(_useOverlayScrollList, 2),
|
|
5172
5300
|
bindOverlayScrollListener = _useOverlayScrollList2[0],
|
|
@@ -10878,7 +11006,7 @@ this.primereact.checkbox = (function (exports, React, api, componentbase, hooks,
|
|
|
10878
11006
|
return props.checked === props.trueValue;
|
|
10879
11007
|
};
|
|
10880
11008
|
var _onChange = function onChange(event) {
|
|
10881
|
-
if (props.disabled || props.
|
|
11009
|
+
if (props.disabled || props.readOnly) {
|
|
10882
11010
|
return;
|
|
10883
11011
|
}
|
|
10884
11012
|
if (props.onChange) {
|
|
@@ -12392,8 +12520,11 @@ this.primereact.inputnumber = (function (exports, React, PrimeReact, componentba
|
|
|
12392
12520
|
newValueStr = insertText(inputValue, text, selectionStart, selectionEnd);
|
|
12393
12521
|
updateValue(event, newValueStr, text, 'insert');
|
|
12394
12522
|
} else if (decimalCharIndex === -1 && (maxFractionDigits || props.maxFractionDigits)) {
|
|
12395
|
-
|
|
12396
|
-
|
|
12523
|
+
var allowedDecimal = inputMode !== 'numeric' || inputMode === 'numeric' && (props.min || props.max);
|
|
12524
|
+
if (allowedDecimal) {
|
|
12525
|
+
newValueStr = insertText(inputValue, text, selectionStart, selectionEnd);
|
|
12526
|
+
updateValue(event, newValueStr, text, 'insert');
|
|
12527
|
+
}
|
|
12397
12528
|
}
|
|
12398
12529
|
} else {
|
|
12399
12530
|
var operation = selectionStart !== selectionEnd ? 'range-insert' : 'insert';
|
|
@@ -14322,7 +14453,15 @@ this.primereact.dropdown = (function (exports, React, PrimeReact, componentbase,
|
|
|
14322
14453
|
var type = _ref.type,
|
|
14323
14454
|
valid = _ref.valid;
|
|
14324
14455
|
if (valid) {
|
|
14325
|
-
type === 'outside'
|
|
14456
|
+
if (type === 'outside') {
|
|
14457
|
+
if (!isClearClicked(event)) {
|
|
14458
|
+
hide();
|
|
14459
|
+
}
|
|
14460
|
+
} else if (context.hideOverlaysOnDocumentScrolling) {
|
|
14461
|
+
hide();
|
|
14462
|
+
} else if (!utils.DomHandler.isDocument(event.target)) {
|
|
14463
|
+
alignOverlay();
|
|
14464
|
+
}
|
|
14326
14465
|
}
|
|
14327
14466
|
},
|
|
14328
14467
|
when: overlayVisibleState
|
|
@@ -14521,12 +14660,14 @@ this.primereact.dropdown = (function (exports, React, PrimeReact, componentbase,
|
|
|
14521
14660
|
case 'ArrowRight':
|
|
14522
14661
|
onArrowLeftKey(event, true);
|
|
14523
14662
|
break;
|
|
14524
|
-
case 'Escape':
|
|
14525
14663
|
case 'Enter':
|
|
14526
14664
|
case 'NumpadEnter':
|
|
14527
14665
|
onEnterKey(event);
|
|
14528
14666
|
event.preventDefault();
|
|
14529
14667
|
break;
|
|
14668
|
+
case 'Escape':
|
|
14669
|
+
onEscapeKey(event);
|
|
14670
|
+
break;
|
|
14530
14671
|
}
|
|
14531
14672
|
};
|
|
14532
14673
|
var hasFocusableElements = function hasFocusableElements() {
|
|
@@ -15268,6 +15409,7 @@ this.primereact.dropdown = (function (exports, React, PrimeReact, componentbase,
|
|
|
15268
15409
|
"in": overlayVisibleState,
|
|
15269
15410
|
isOptionDisabled: isOptionDisabled,
|
|
15270
15411
|
isSelected: isSelected,
|
|
15412
|
+
onOverlayHide: hide,
|
|
15271
15413
|
onClick: onPanelClick,
|
|
15272
15414
|
onEnter: onOverlayEnter,
|
|
15273
15415
|
onEntered: onOverlayEntered,
|
|
@@ -17875,7 +18017,7 @@ this.primereact.tree = (function (exports, React, api, componentbase, hooks, sea
|
|
|
17875
18017
|
return props.checked === props.trueValue;
|
|
17876
18018
|
};
|
|
17877
18019
|
var _onChange = function onChange(event) {
|
|
17878
|
-
if (props.disabled || props.
|
|
18020
|
+
if (props.disabled || props.readOnly) {
|
|
17879
18021
|
return;
|
|
17880
18022
|
}
|
|
17881
18023
|
if (props.onChange) {
|