primereact 10.0.9 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/api.cjs.js +29 -6
- package/api/api.cjs.min.js +1 -1
- package/api/api.esm.js +29 -6
- package/api/api.esm.min.js +1 -1
- package/api/api.js +29 -6
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +2 -1
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +2 -1
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +2 -1
- package/autocomplete/autocomplete.min.js +1 -1
- package/button/button.cjs.js +3 -3
- package/button/button.cjs.min.js +1 -1
- package/button/button.d.ts +5 -0
- package/button/button.esm.js +3 -3
- package/button/button.esm.min.js +1 -1
- package/button/button.js +3 -3
- package/button/button.min.js +1 -1
- package/calendar/calendar.cjs.js +3 -2
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +3 -2
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +3 -2
- package/calendar/calendar.min.js +1 -1
- package/cascadeselect/cascadeselect.cjs.js +4 -3
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.esm.js +4 -3
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +5 -4
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/colorpicker/colorpicker.cjs.js +2 -1
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +2 -1
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +3 -2
- package/colorpicker/colorpicker.min.js +1 -1
- package/componentbase/componentbase.cjs.js +2 -2
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.js +2 -2
- package/componentbase/componentbase.esm.min.js +1 -1
- package/componentbase/componentbase.js +2 -2
- package/componentbase/componentbase.min.js +1 -1
- package/contextmenu/contextmenu.cjs.js +4 -5
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +4 -5
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +4 -5
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +78 -45
- package/core/core.min.js +10 -10
- package/datatable/datatable.cjs.js +64 -60
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +6 -0
- package/datatable/datatable.esm.js +64 -60
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +64 -60
- package/datatable/datatable.min.js +1 -1
- package/dataview/dataview.cjs.js +1 -2
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +1 -2
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +1 -2
- package/dataview/dataview.min.js +1 -1
- package/dialog/dialog.cjs.js +3 -5
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +3 -5
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +3 -5
- package/dialog/dialog.min.js +1 -1
- package/dropdown/dropdown.cjs.js +3 -1
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +3 -1
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +3 -1
- package/dropdown/dropdown.min.js +1 -1
- package/fileupload/fileupload.cjs.js +1 -1
- package/fileupload/fileupload.cjs.min.js +1 -1
- package/fileupload/fileupload.esm.js +1 -1
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +1 -1
- package/fileupload/fileupload.min.js +1 -1
- package/hooks/hooks.cjs.js +7 -16
- package/hooks/hooks.cjs.min.js +1 -1
- package/hooks/hooks.esm.js +7 -16
- package/hooks/hooks.esm.min.js +1 -1
- package/hooks/hooks.js +7 -16
- package/hooks/hooks.min.js +1 -1
- package/inputmask/inputmask.cjs.js +8 -3
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.esm.js +8 -3
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +8 -3
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +18 -3
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +18 -3
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +18 -3
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputtext/inputtext.d.ts +5 -1
- package/megamenu/megamenu.cjs.js +1 -1
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +1 -1
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +1 -1
- package/megamenu/megamenu.min.js +1 -1
- package/mention/mention.cjs.js +4 -1
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.esm.js +5 -2
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +4 -1
- package/mention/mention.min.js +1 -1
- package/multiselect/multiselect.cjs.js +11 -0
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +20 -0
- package/multiselect/multiselect.esm.js +11 -0
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +11 -0
- package/multiselect/multiselect.min.js +1 -1
- package/overlaypanel/overlaypanel.cjs.js +1 -1
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +1 -1
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +1 -1
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +5 -2
- package/panelmenu/panelmenu.cjs.js +5 -3
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +5 -3
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +5 -3
- package/panelmenu/panelmenu.min.js +1 -1
- package/passthrough/tailwind/index.cjs.js +6 -6
- package/passthrough/tailwind/index.cjs.min.js +1 -1
- package/passthrough/tailwind/index.esm.js +6 -6
- package/passthrough/tailwind/index.esm.min.js +1 -1
- package/passthrough/tailwind/index.js +6 -6
- package/passthrough/tailwind/index.min.js +1 -1
- package/password/password.cjs.js +8 -2
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +9 -3
- package/password/password.esm.min.js +1 -1
- package/password/password.js +8 -2
- package/password/password.min.js +1 -1
- package/primereact.all.cjs.js +241 -168
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +241 -168
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +241 -168
- package/primereact.all.min.js +1 -1
- package/resources/themes/arya-blue/theme.css +96 -91
- package/resources/themes/arya-green/theme.css +96 -91
- package/resources/themes/arya-orange/theme.css +96 -91
- package/resources/themes/arya-purple/theme.css +96 -91
- package/resources/themes/bootstrap4-dark-blue/theme.css +96 -91
- package/resources/themes/bootstrap4-dark-purple/theme.css +96 -91
- package/resources/themes/bootstrap4-light-blue/theme.css +95 -90
- package/resources/themes/bootstrap4-light-purple/theme.css +95 -90
- package/resources/themes/fluent-light/theme.css +96 -91
- package/resources/themes/lara-dark-amber/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-amber/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-amber/theme.css +6049 -0
- package/resources/themes/lara-dark-blue/theme.css +999 -955
- package/resources/themes/lara-dark-cyan/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-cyan/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-cyan/theme.css +6049 -0
- package/resources/themes/lara-dark-green/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-green/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-green/theme.css +6049 -0
- package/resources/themes/lara-dark-indigo/theme.css +999 -955
- package/resources/themes/lara-dark-pink/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-pink/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-pink/theme.css +6049 -0
- package/resources/themes/lara-dark-purple/theme.css +999 -955
- package/resources/themes/lara-dark-teal/theme.css +999 -955
- package/resources/themes/lara-light-amber/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-amber/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-amber/theme.css +6041 -0
- package/resources/themes/lara-light-blue/theme.css +836 -800
- package/resources/themes/lara-light-cyan/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-cyan/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-cyan/theme.css +6041 -0
- package/resources/themes/lara-light-green/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-green/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-green/theme.css +6041 -0
- package/resources/themes/lara-light-indigo/theme.css +836 -800
- package/resources/themes/lara-light-pink/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-pink/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-pink/theme.css +6041 -0
- package/resources/themes/lara-light-purple/theme.css +836 -800
- package/resources/themes/lara-light-teal/theme.css +1109 -1073
- package/resources/themes/luna-amber/theme.css +96 -91
- package/resources/themes/luna-blue/theme.css +96 -91
- package/resources/themes/luna-green/theme.css +96 -91
- package/resources/themes/luna-pink/theme.css +96 -91
- package/resources/themes/md-dark-deeppurple/theme.css +140 -135
- package/resources/themes/md-dark-indigo/theme.css +140 -135
- package/resources/themes/md-light-deeppurple/theme.css +140 -135
- package/resources/themes/md-light-indigo/theme.css +140 -135
- package/resources/themes/mdc-dark-deeppurple/theme.css +140 -135
- package/resources/themes/mdc-dark-indigo/theme.css +140 -135
- package/resources/themes/mdc-light-deeppurple/theme.css +140 -135
- package/resources/themes/mdc-light-indigo/theme.css +140 -135
- package/resources/themes/mira/theme.css +101 -91
- package/resources/themes/nano/theme.css +100 -91
- package/resources/themes/nova/theme.css +96 -91
- package/resources/themes/nova-accent/theme.css +96 -91
- package/resources/themes/nova-alt/theme.css +96 -91
- package/resources/themes/rhea/theme.css +96 -91
- package/resources/themes/saga-blue/theme.css +96 -91
- package/resources/themes/saga-green/theme.css +96 -91
- package/resources/themes/saga-orange/theme.css +96 -91
- package/resources/themes/saga-purple/theme.css +96 -91
- package/resources/themes/soho-dark/theme.css +101 -91
- package/resources/themes/soho-light/theme.css +101 -91
- package/resources/themes/vela-blue/theme.css +96 -91
- package/resources/themes/vela-green/theme.css +96 -91
- package/resources/themes/vela-orange/theme.css +96 -91
- package/resources/themes/vela-purple/theme.css +96 -91
- package/resources/themes/viva-dark/theme.css +96 -91
- package/resources/themes/viva-light/theme.css +96 -91
- package/ripple/ripple.cjs.js +1 -1
- package/ripple/ripple.cjs.min.js +1 -1
- package/ripple/ripple.esm.js +1 -1
- package/ripple/ripple.esm.min.js +1 -1
- package/ripple/ripple.js +1 -1
- package/ripple/ripple.min.js +1 -1
- package/scrolltop/scrolltop.cjs.js +1 -1
- package/scrolltop/scrolltop.cjs.min.js +1 -1
- package/scrolltop/scrolltop.esm.js +1 -1
- package/scrolltop/scrolltop.esm.min.js +1 -1
- package/scrolltop/scrolltop.js +1 -1
- package/scrolltop/scrolltop.min.js +1 -1
- package/sidebar/sidebar.cjs.js +2 -2
- package/sidebar/sidebar.cjs.min.js +1 -1
- package/sidebar/sidebar.esm.js +2 -2
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +2 -2
- package/sidebar/sidebar.min.js +1 -1
- package/slider/slider.cjs.js +2 -2
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.esm.js +2 -2
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +2 -2
- package/slider/slider.min.js +1 -1
- package/speeddial/speeddial.cjs.js +2 -4
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.esm.js +2 -4
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +2 -4
- package/speeddial/speeddial.min.js +1 -1
- package/splitbutton/splitbutton.cjs.js +4 -4
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.esm.js +4 -4
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +4 -4
- package/splitbutton/splitbutton.min.js +1 -1
- package/splitter/splitter.cjs.js +3 -1
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +3 -1
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +3 -1
- package/splitter/splitter.min.js +1 -1
- package/tabview/tabview.cjs.js +13 -9
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.d.ts +1 -1
- package/tabview/tabview.esm.js +13 -9
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +13 -9
- package/tabview/tabview.min.js +1 -1
- package/tag/tag.cjs.js +1 -2
- package/tag/tag.cjs.min.js +1 -1
- package/tag/tag.esm.js +1 -2
- package/tag/tag.esm.min.js +1 -1
- package/tag/tag.js +1 -2
- package/tag/tag.min.js +1 -1
- package/tieredmenu/tieredmenu.cjs.js +1 -1
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +1 -1
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +1 -1
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/timeline.cjs.js +1 -2
- package/timeline/timeline.cjs.min.js +1 -1
- package/timeline/timeline.esm.js +1 -2
- package/timeline/timeline.esm.min.js +1 -1
- package/timeline/timeline.js +1 -2
- package/timeline/timeline.min.js +1 -1
- package/tooltip/tooltip.cjs.js +9 -5
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +9 -5
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +9 -5
- package/tooltip/tooltip.min.js +1 -1
- package/tree/tree.cjs.js +3 -3
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +3 -3
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +3 -3
- package/tree/tree.min.js +1 -1
- package/treeselect/treeselect.cjs.js +1 -0
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +1 -0
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +1 -0
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +15 -11
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +15 -11
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +15 -11
- package/treetable/treetable.min.js +1 -1
- package/utils/utils.d.ts +1 -1
- package/web-types.json +39 -1
package/dataview/dataview.cjs.js
CHANGED
|
@@ -177,9 +177,8 @@ var classes = {
|
|
|
177
177
|
});
|
|
178
178
|
},
|
|
179
179
|
root: function root(_ref2) {
|
|
180
|
-
var _classNames;
|
|
181
180
|
var props = _ref2.props;
|
|
182
|
-
return utils.classNames('p-dataview p-component', (
|
|
181
|
+
return utils.classNames('p-dataview p-component', _defineProperty(_defineProperty({}, "p-dataview-".concat(props.layout), !!props.layout), 'p-dataview-loading', props.loading));
|
|
183
182
|
}
|
|
184
183
|
};
|
|
185
184
|
var styles = "\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),r=require("primereact/componentbase"),n=require("primereact/icons/bars"),o=require("primereact/icons/spinner"),a=require("primereact/icons/thlarge"),i=require("primereact/paginator"),l=require("primereact/ripple"),u=require("primereact/utils");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(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 p=c(e),m=s(t);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e){if(Array.isArray(e))return g(e)}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function v(e,t){if(e){if("string"==typeof e)return g(e,t);var r=Object.prototype.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)?g(e,t):void 0}}function b(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function P(e){if(Array.isArray(e))return e}function h(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}function w(){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 P(e)||h(e,t)||v(e,t)||w()}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)||null===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 N(e){var t=S(e,"string");return"symbol"===j(t)?t:String(t)}function E(e,t,r){return(t=N(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var I=r.ComponentBase.extend({defaultProps:{__TYPE:"DataView",id:null,header:null,footer:null,value:null,layout:"list",dataKey:null,rows:null,first:0,totalRecords:null,paginator:!1,paginatorPosition:"bottom",alwaysShowPaginator:!0,paginatorClassName:null,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",paginatorLeft:null,paginatorRight:null,paginatorDropdownAppendTo:null,pageLinkSize:5,rowsPerPageOptions:null,currentPageReportTemplate:"({currentPage} of {totalPages})",emptyMessage:null,sortField:null,sortOrder:null,style:null,className:null,lazy:!1,loading:!1,loadingIcon:null,gutter:!1,itemTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-col-12 col-12 p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(e){return u.classNames("p-grid grid",{"p-nogutter grid-nogutter":!e.props.gutter})},root:function(e){var t,r=e.props;return u.classNames("p-dataview p-component",(E(t={},"p-dataview-".concat(r.layout),!!r.layout),E(t,"p-dataview-loading",r.loading),t))}},styles:"\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n"}}),D=r.ComponentBase.extend({defaultProps:{__TYPE:"DataViewLayoutOptions",id:null,style:null,className:null,layout:null,listIcon:null,gridIcon:null,onChange:null,children:void 0},css:{classes:{root:"p-dataview-layout-options p-selectbutton p-buttonset",listButton:function(e){return u.classNames("p-button p-button-icon-only",{"p-highlight":"list"===e.props.layout})},gridButton:function(e){return u.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===e.props.layout})}}}});function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=C(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}function C(e,t){if(e){if("string"==typeof e)return T(e,t);var r=Object.prototype.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)?T(e,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x(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 R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x(Object(r),!0).forEach((function(t){E(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var L=p.memo((function(e){var r=p.useContext(t.PrimeReactContext),o=D.getProps(e,r),i=D.setMetaData({props:o}),s=i.ptm,c=i.cx,m=function(e,t){o.onChange({originalEvent:e,value:t}),e.preventDefault()},f=u.mergeProps(s("list")),g=u.mergeProps(s("grid")),d=u.IconUtils.getJSXIcon(o.listIcon||p.createElement(n.BarsIcon,f),R({},f),{props:o}),y=u.IconUtils.getJSXIcon(o.gridIcon||p.createElement(a.ThLargeIcon,g),R({},g),{props:o}),v=u.mergeProps({id:o.id,style:o.style,className:u.classNames(o.className,c("root"))},D.getOtherProps(o),s("root")),b=u.mergeProps({type:"button",className:c("listButton"),onClick:function(e){return m(e,"list")}},s("listButton")),P=u.mergeProps({type:"button",className:c("gridButton"),onClick:function(e){return m(e,"grid")}},s("gridButton"));return p.createElement("div",v,p.createElement("button",b,d,p.createElement(l.Ripple,null)),p.createElement("button",P,y,p.createElement(l.Ripple,null)))})),M=p.memo((function(e){return e.template(e.item,e.layout)})),k=p.memo(p.forwardRef((function(e,n){var a=p.useContext(t.PrimeReactContext),l=I.getProps(e,a),s=O(p.useState(l.first),2),c=s[0],g=s[1],P=O(p.useState(l.rows),2),h=P[0],w=P[1],j={props:l,state:{first:c,rows:h}},S=I.setMetaData(j),N=S.ptm,E=S.cx;r.useHandleStyle(I.css.styles,S.isUnstyled,{name:"dataview"});var D=p.useRef(null),C=l.onPage?l.first:c,T=l.onPage?l.rows:h,x=function(e){return l.dataKey?u.ObjectUtils.resolveFieldData(e,l.dataKey):null},L=function(){return l.totalRecords?l.totalRecords:l.value?l.value.length:0},k=function(e){var t=u.classNames("p-paginator-"+e,l.paginatorClassName),r=L();return p.createElement(i.Paginator,{first:C,rows:T,pageLinkSize:l.pageLinkSize,className:t,onPageChange:U,template:l.paginatorTemplate,totalRecords:r,rowsPerPageOptions:l.rowsPerPageOptions,currentPageReportTemplate:l.currentPageReportTemplate,leftContent:l.paginatorLeft,rightContent:l.paginatorRight,alwaysShow:l.alwaysShowPaginator,dropdownAppendTo:l.paginatorDropdownAppendTo,ptm:N("paginator"),unstyled:l.unstyled,__parentMetadata:{parent:j}})},U=function(e){l.onPage?l.onPage(e):(g(e.first),w(e.rows))},_=function(){if(l.value){var e,t=new Map,r=u.ObjectUtils.localeComparator(a&&a.locale||m.default.locale),n=d(s=l.value)||y(s)||v(s)||b(),o=A(n);try{for(o.s();!(e=o.n()).done;){var i=e.value;t.set(i,u.ObjectUtils.resolveFieldData(i,l.sortField))}}catch(e){o.e(e)}finally{o.f()}return n.sort((function(e,n){var o=t.get(e),i=t.get(n);return u.ObjectUtils.sort(o,i,l.sortOrder,r,a&&a.nullSortOrder||m.default.nullSortOrder)})),n}var s;return null},q=function(){if(!l.loading){var e=l.emptyMessage||t.localeOption("emptyMessage"),r=u.mergeProps({className:E("emptyMessage")},N("emptyMessage"));return p.createElement("div",r,e)}return null},B=function(e){if(u.ObjectUtils.isNotEmpty(e)){if(l.paginator){for(var t=l.lazy?0:C,r=L(),n=Math.min(T+t,r),o=[],a=t;a<n;a++){var i=e[a];i&&o.push(p.createElement(M,{key:x(e)||a,template:l.itemTemplate,layout:l.layout,item:i}))}return o}return e.map((function(e,t){return p.createElement(M,{key:x(e)||t,template:l.itemTemplate,layout:l.layout,item:e})}))}return q()};p.useImperativeHandle(n,(function(){return{props:l,getElement:function(){return D.current}}}));var V,z,F,J=function(){var e=l.value;return u.ObjectUtils.isNotEmpty(e)&&l.sortField&&(e=_()),e}(),K=function(){if(l.loading){var e=u.mergeProps({className:E("loadingIcon")},N("loadingIcon")),t=l.loadingIcon||p.createElement(o.SpinnerIcon,f({},e,{spin:!0})),r=u.IconUtils.getJSXIcon(t,R({},e),{props:l}),n=u.mergeProps({className:E("loadingOverlay")},N("loadingOverlay"));return p.createElement("div",n,r)}return null}(),X=!l.paginator||"bottom"===l.paginatorPosition&&"both"!==l.paginatorPosition?null:k("top"),H=!l.paginator||"top"===l.paginatorPosition&&"both"!==l.paginatorPosition?null:k("bottom"),Y=function(){if(l.header){var e=u.mergeProps({className:E("header")},N("header"));return p.createElement("div",e,l.header)}return null}(),$=function(){if(l.footer){var e=u.mergeProps({className:E("footer")},N("footer"));return p.createElement("div",e,l.footer)}return null}(),G=(V=B(J),z=u.mergeProps({className:E("grid")},N("grid")),F=u.mergeProps({className:E("content")},N("content")),p.createElement("div",F,p.createElement("div",z,V))),Q=u.mergeProps({id:l.id,ref:D,style:l.style,className:u.classNames(l.className,E("root"))},I.getOtherProps(l),N("root"));return p.createElement("div",Q,K,Y,X,G,H,$)})));L.displayName="DataViewLayoutOptions",M.displayName="DataViewItem",k.displayName="DataView",exports.DataView=k,exports.DataViewItem=M,exports.DataViewLayoutOptions=L;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),r=require("primereact/componentbase"),n=require("primereact/icons/bars"),o=require("primereact/icons/spinner"),a=require("primereact/icons/thlarge"),i=require("primereact/paginator"),l=require("primereact/ripple"),u=require("primereact/utils");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(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 p=c(e),m=s(t);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e){if(Array.isArray(e))return g(e)}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function v(e,t){if(e){if("string"==typeof e)return g(e,t);var r=Object.prototype.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)?g(e,t):void 0}}function b(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function P(e){if(Array.isArray(e))return e}function h(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}function w(){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 P(e)||h(e,t)||v(e,t)||w()}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)||null===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 N(e){var t=S(e,"string");return"symbol"===j(t)?t:String(t)}function E(e,t,r){return(t=N(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var I=r.ComponentBase.extend({defaultProps:{__TYPE:"DataView",id:null,header:null,footer:null,value:null,layout:"list",dataKey:null,rows:null,first:0,totalRecords:null,paginator:!1,paginatorPosition:"bottom",alwaysShowPaginator:!0,paginatorClassName:null,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",paginatorLeft:null,paginatorRight:null,paginatorDropdownAppendTo:null,pageLinkSize:5,rowsPerPageOptions:null,currentPageReportTemplate:"({currentPage} of {totalPages})",emptyMessage:null,sortField:null,sortOrder:null,style:null,className:null,lazy:!1,loading:!1,loadingIcon:null,gutter:!1,itemTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-col-12 col-12 p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(e){return u.classNames("p-grid grid",{"p-nogutter grid-nogutter":!e.props.gutter})},root:function(e){var t=e.props;return u.classNames("p-dataview p-component",E(E({},"p-dataview-".concat(t.layout),!!t.layout),"p-dataview-loading",t.loading))}},styles:"\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n"}}),D=r.ComponentBase.extend({defaultProps:{__TYPE:"DataViewLayoutOptions",id:null,style:null,className:null,layout:null,listIcon:null,gridIcon:null,onChange:null,children:void 0},css:{classes:{root:"p-dataview-layout-options p-selectbutton p-buttonset",listButton:function(e){return u.classNames("p-button p-button-icon-only",{"p-highlight":"list"===e.props.layout})},gridButton:function(e){return u.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===e.props.layout})}}}});function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=C(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}function C(e,t){if(e){if("string"==typeof e)return T(e,t);var r=Object.prototype.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)?T(e,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x(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 R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x(Object(r),!0).forEach((function(t){E(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var L=p.memo((function(e){var r=p.useContext(t.PrimeReactContext),o=D.getProps(e,r),i=D.setMetaData({props:o}),s=i.ptm,c=i.cx,m=function(e,t){o.onChange({originalEvent:e,value:t}),e.preventDefault()},f=u.mergeProps(s("list")),g=u.mergeProps(s("grid")),d=u.IconUtils.getJSXIcon(o.listIcon||p.createElement(n.BarsIcon,f),R({},f),{props:o}),y=u.IconUtils.getJSXIcon(o.gridIcon||p.createElement(a.ThLargeIcon,g),R({},g),{props:o}),v=u.mergeProps({id:o.id,style:o.style,className:u.classNames(o.className,c("root"))},D.getOtherProps(o),s("root")),b=u.mergeProps({type:"button",className:c("listButton"),onClick:function(e){return m(e,"list")}},s("listButton")),P=u.mergeProps({type:"button",className:c("gridButton"),onClick:function(e){return m(e,"grid")}},s("gridButton"));return p.createElement("div",v,p.createElement("button",b,d,p.createElement(l.Ripple,null)),p.createElement("button",P,y,p.createElement(l.Ripple,null)))})),M=p.memo((function(e){return e.template(e.item,e.layout)})),k=p.memo(p.forwardRef((function(e,n){var a=p.useContext(t.PrimeReactContext),l=I.getProps(e,a),s=O(p.useState(l.first),2),c=s[0],g=s[1],P=O(p.useState(l.rows),2),h=P[0],w=P[1],j={props:l,state:{first:c,rows:h}},S=I.setMetaData(j),N=S.ptm,E=S.cx;r.useHandleStyle(I.css.styles,S.isUnstyled,{name:"dataview"});var D=p.useRef(null),C=l.onPage?l.first:c,T=l.onPage?l.rows:h,x=function(e){return l.dataKey?u.ObjectUtils.resolveFieldData(e,l.dataKey):null},L=function(){return l.totalRecords?l.totalRecords:l.value?l.value.length:0},k=function(e){var t=u.classNames("p-paginator-"+e,l.paginatorClassName),r=L();return p.createElement(i.Paginator,{first:C,rows:T,pageLinkSize:l.pageLinkSize,className:t,onPageChange:U,template:l.paginatorTemplate,totalRecords:r,rowsPerPageOptions:l.rowsPerPageOptions,currentPageReportTemplate:l.currentPageReportTemplate,leftContent:l.paginatorLeft,rightContent:l.paginatorRight,alwaysShow:l.alwaysShowPaginator,dropdownAppendTo:l.paginatorDropdownAppendTo,ptm:N("paginator"),unstyled:l.unstyled,__parentMetadata:{parent:j}})},U=function(e){l.onPage?l.onPage(e):(g(e.first),w(e.rows))},_=function(){if(l.value){var e,t=new Map,r=u.ObjectUtils.localeComparator(a&&a.locale||m.default.locale),n=d(s=l.value)||y(s)||v(s)||b(),o=A(n);try{for(o.s();!(e=o.n()).done;){var i=e.value;t.set(i,u.ObjectUtils.resolveFieldData(i,l.sortField))}}catch(e){o.e(e)}finally{o.f()}return n.sort((function(e,n){var o=t.get(e),i=t.get(n);return u.ObjectUtils.sort(o,i,l.sortOrder,r,a&&a.nullSortOrder||m.default.nullSortOrder)})),n}var s;return null},q=function(){if(!l.loading){var e=l.emptyMessage||t.localeOption("emptyMessage"),r=u.mergeProps({className:E("emptyMessage")},N("emptyMessage"));return p.createElement("div",r,e)}return null},B=function(e){if(u.ObjectUtils.isNotEmpty(e)){if(l.paginator){for(var t=l.lazy?0:C,r=L(),n=Math.min(T+t,r),o=[],a=t;a<n;a++){var i=e[a];i&&o.push(p.createElement(M,{key:x(e)||a,template:l.itemTemplate,layout:l.layout,item:i}))}return o}return e.map((function(e,t){return p.createElement(M,{key:x(e)||t,template:l.itemTemplate,layout:l.layout,item:e})}))}return q()};p.useImperativeHandle(n,(function(){return{props:l,getElement:function(){return D.current}}}));var V,z,F,J=function(){var e=l.value;return u.ObjectUtils.isNotEmpty(e)&&l.sortField&&(e=_()),e}(),K=function(){if(l.loading){var e=u.mergeProps({className:E("loadingIcon")},N("loadingIcon")),t=l.loadingIcon||p.createElement(o.SpinnerIcon,f({},e,{spin:!0})),r=u.IconUtils.getJSXIcon(t,R({},e),{props:l}),n=u.mergeProps({className:E("loadingOverlay")},N("loadingOverlay"));return p.createElement("div",n,r)}return null}(),X=!l.paginator||"bottom"===l.paginatorPosition&&"both"!==l.paginatorPosition?null:k("top"),H=!l.paginator||"top"===l.paginatorPosition&&"both"!==l.paginatorPosition?null:k("bottom"),Y=function(){if(l.header){var e=u.mergeProps({className:E("header")},N("header"));return p.createElement("div",e,l.header)}return null}(),$=function(){if(l.footer){var e=u.mergeProps({className:E("footer")},N("footer"));return p.createElement("div",e,l.footer)}return null}(),G=(V=B(J),z=u.mergeProps({className:E("grid")},N("grid")),F=u.mergeProps({className:E("content")},N("content")),p.createElement("div",F,p.createElement("div",z,V))),Q=u.mergeProps({id:l.id,ref:D,style:l.style,className:u.classNames(l.className,E("root"))},I.getOtherProps(l),N("root"));return p.createElement("div",Q,K,Y,X,G,H,$)})));L.displayName="DataViewLayoutOptions",M.displayName="DataViewItem",k.displayName="DataView",exports.DataView=k,exports.DataViewItem=M,exports.DataViewLayoutOptions=L;
|
package/dataview/dataview.esm.js
CHANGED
|
@@ -150,9 +150,8 @@ var classes = {
|
|
|
150
150
|
});
|
|
151
151
|
},
|
|
152
152
|
root: function root(_ref2) {
|
|
153
|
-
var _classNames;
|
|
154
153
|
var props = _ref2.props;
|
|
155
|
-
return classNames('p-dataview p-component', (
|
|
154
|
+
return classNames('p-dataview p-component', _defineProperty(_defineProperty({}, "p-dataview-".concat(props.layout), !!props.layout), 'p-dataview-loading', props.loading));
|
|
156
155
|
}
|
|
157
156
|
};
|
|
158
157
|
var styles = "\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"react";import e,{PrimeReactContext as r,localeOption as n}from"primereact/api";import{ComponentBase as o,useHandleStyle as a}from"primereact/componentbase";import{BarsIcon as i}from"primereact/icons/bars";import{SpinnerIcon as l}from"primereact/icons/spinner";import{ThLargeIcon as u}from"primereact/icons/thlarge";import{Paginator as s}from"primereact/paginator";import{Ripple as c}from"primereact/ripple";import{classNames as p,mergeProps as m,IconUtils as f,ObjectUtils as g}from"primereact/utils";function d(){return d=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},d.apply(this,arguments)}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function v(t){if(Array.isArray(t))return y(t)}function b(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function h(t,e){if(t){if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(t,e):void 0}}function w(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function P(t){if(Array.isArray(t))return t}function O(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}function S(){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 E(t,e){return P(t)||O(t,e)||h(t,e)||S()}function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function N(t,e){if("object"!==j(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function I(t){var e=N(t,"string");return"symbol"===j(e)?e:String(e)}function A(t,e,r){return(e=I(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var D=o.extend({defaultProps:{__TYPE:"DataView",id:null,header:null,footer:null,value:null,layout:"list",dataKey:null,rows:null,first:0,totalRecords:null,paginator:!1,paginatorPosition:"bottom",alwaysShowPaginator:!0,paginatorClassName:null,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",paginatorLeft:null,paginatorRight:null,paginatorDropdownAppendTo:null,pageLinkSize:5,rowsPerPageOptions:null,currentPageReportTemplate:"({currentPage} of {totalPages})",emptyMessage:null,sortField:null,sortOrder:null,style:null,className:null,lazy:!1,loading:!1,loadingIcon:null,gutter:!1,itemTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-col-12 col-12 p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(t){return p("p-grid grid",{"p-nogutter grid-nogutter":!t.props.gutter})},root:function(t){var e,r=t.props;return p("p-dataview p-component",(A(e={},"p-dataview-".concat(r.layout),!!r.layout),A(e,"p-dataview-loading",r.loading),e))}},styles:"\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n"}}),T=o.extend({defaultProps:{__TYPE:"DataViewLayoutOptions",id:null,style:null,className:null,layout:null,listIcon:null,gridIcon:null,onChange:null,children:void 0},css:{classes:{root:"p-dataview-layout-options p-selectbutton p-buttonset",listButton:function(t){return p("p-button p-button-icon-only",{"p-highlight":"list"===t.props.layout})},gridButton:function(t){return p("p-button p-button-icon-only",{"p-highlight":"grid"===t.props.layout})}}}});function C(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=k(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}function k(t,e){if(t){if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(t,e):void 0}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function x(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?M(Object(r),!0).forEach((function(e){A(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var R=t.memo((function(e){var n=t.useContext(r),o=T.getProps(e,n),a=T.setMetaData({props:o}),l=a.ptm,s=a.cx,g=function(t,e){o.onChange({originalEvent:t,value:e}),t.preventDefault()},d=m(l("list")),y=m(l("grid")),v=f.getJSXIcon(o.listIcon||t.createElement(i,d),x({},d),{props:o}),b=f.getJSXIcon(o.gridIcon||t.createElement(u,y),x({},y),{props:o}),h=m({id:o.id,style:o.style,className:p(o.className,s("root"))},T.getOtherProps(o),l("root")),w=m({type:"button",className:s("listButton"),onClick:function(t){return g(t,"list")}},l("listButton")),P=m({type:"button",className:s("gridButton"),onClick:function(t){return g(t,"grid")}},l("gridButton"));return t.createElement("div",h,t.createElement("button",w,v,t.createElement(c,null)),t.createElement("button",P,b,t.createElement(c,null)))})),z=t.memo((function(t){return t.template(t.item,t.layout)})),B=t.memo(t.forwardRef((function(o,i){var u=t.useContext(r),c=D.getProps(o,u),y=E(t.useState(c.first),2),P=y[0],O=y[1],S=E(t.useState(c.rows),2),j=S[0],N=S[1],I={props:c,state:{first:P,rows:j}},A=D.setMetaData(I),T=A.ptm,k=A.cx;a(D.css.styles,A.isUnstyled,{name:"dataview"});var L=t.useRef(null),M=c.onPage?c.first:P,R=c.onPage?c.rows:j,B=function(t){return c.dataKey?g.resolveFieldData(t,c.dataKey):null},F=function(){return c.totalRecords?c.totalRecords:c.value?c.value.length:0},_=function(e){var r=p("p-paginator-"+e,c.paginatorClassName),n=F();return t.createElement(s,{first:M,rows:R,pageLinkSize:c.pageLinkSize,className:r,onPageChange:V,template:c.paginatorTemplate,totalRecords:n,rowsPerPageOptions:c.rowsPerPageOptions,currentPageReportTemplate:c.currentPageReportTemplate,leftContent:c.paginatorLeft,rightContent:c.paginatorRight,alwaysShow:c.alwaysShowPaginator,dropdownAppendTo:c.paginatorDropdownAppendTo,ptm:T("paginator"),unstyled:c.unstyled,__parentMetadata:{parent:I}})},V=function(t){c.onPage?c.onPage(t):(O(t.first),N(t.rows))},J=function(){if(c.value){var t,r=new Map,n=g.localeComparator(u&&u.locale||e.locale),o=v(l=c.value)||b(l)||h(l)||w(),a=C(o);try{for(a.s();!(t=a.n()).done;){var i=t.value;r.set(i,g.resolveFieldData(i,c.sortField))}}catch(t){a.e(t)}finally{a.f()}return o.sort((function(t,o){var a=r.get(t),i=r.get(o);return g.sort(a,i,c.sortOrder,n,u&&u.nullSortOrder||e.nullSortOrder)})),o}var l;return null},K=function(){if(!c.loading){var e=c.emptyMessage||n("emptyMessage"),r=m({className:k("emptyMessage")},T("emptyMessage"));return t.createElement("div",r,e)}return null},U=function(e){if(g.isNotEmpty(e)){if(c.paginator){for(var r=c.lazy?0:M,n=F(),o=Math.min(R+r,n),a=[],i=r;i<o;i++){var l=e[i];l&&a.push(t.createElement(z,{key:B(e)||i,template:c.itemTemplate,layout:c.layout,item:l}))}return a}return e.map((function(e,r){return t.createElement(z,{key:B(e)||r,template:c.itemTemplate,layout:c.layout,item:e})}))}return K()};t.useImperativeHandle(i,(function(){return{props:c,getElement:function(){return L.current}}}));var X,Y,$,H=function(){var t=c.value;return g.isNotEmpty(t)&&c.sortField&&(t=J()),t}(),q=function(){if(c.loading){var e=m({className:k("loadingIcon")},T("loadingIcon")),r=c.loadingIcon||t.createElement(l,d({},e,{spin:!0})),n=f.getJSXIcon(r,x({},e),{props:c}),o=m({className:k("loadingOverlay")},T("loadingOverlay"));return t.createElement("div",o,n)}return null}(),G=!c.paginator||"bottom"===c.paginatorPosition&&"both"!==c.paginatorPosition?null:_("top"),Q=!c.paginator||"top"===c.paginatorPosition&&"both"!==c.paginatorPosition?null:_("bottom"),W=function(){if(c.header){var e=m({className:k("header")},T("header"));return t.createElement("div",e,c.header)}return null}(),Z=function(){if(c.footer){var e=m({className:k("footer")},T("footer"));return t.createElement("div",e,c.footer)}return null}(),tt=(X=U(H),Y=m({className:k("grid")},T("grid")),$=m({className:k("content")},T("content")),t.createElement("div",$,t.createElement("div",Y,X))),et=m({id:c.id,ref:L,style:c.style,className:p(c.className,k("root"))},D.getOtherProps(c),T("root"));return t.createElement("div",et,q,W,G,tt,Q,Z)})));R.displayName="DataViewLayoutOptions",z.displayName="DataViewItem",B.displayName="DataView";export{B as DataView,z as DataViewItem,R as DataViewLayoutOptions};
|
|
1
|
+
import*as t from"react";import e,{PrimeReactContext as r,localeOption as n}from"primereact/api";import{ComponentBase as o,useHandleStyle as a}from"primereact/componentbase";import{BarsIcon as i}from"primereact/icons/bars";import{SpinnerIcon as l}from"primereact/icons/spinner";import{ThLargeIcon as u}from"primereact/icons/thlarge";import{Paginator as s}from"primereact/paginator";import{Ripple as c}from"primereact/ripple";import{classNames as p,mergeProps as m,IconUtils as f,ObjectUtils as g}from"primereact/utils";function d(){return d=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},d.apply(this,arguments)}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function v(t){if(Array.isArray(t))return y(t)}function b(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function h(t,e){if(t){if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(t,e):void 0}}function w(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function P(t){if(Array.isArray(t))return t}function O(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}function S(){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 E(t,e){return P(t)||O(t,e)||h(t,e)||S()}function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function N(t,e){if("object"!==j(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function I(t){var e=N(t,"string");return"symbol"===j(e)?e:String(e)}function A(t,e,r){return(e=I(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var D=o.extend({defaultProps:{__TYPE:"DataView",id:null,header:null,footer:null,value:null,layout:"list",dataKey:null,rows:null,first:0,totalRecords:null,paginator:!1,paginatorPosition:"bottom",alwaysShowPaginator:!0,paginatorClassName:null,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",paginatorLeft:null,paginatorRight:null,paginatorDropdownAppendTo:null,pageLinkSize:5,rowsPerPageOptions:null,currentPageReportTemplate:"({currentPage} of {totalPages})",emptyMessage:null,sortField:null,sortOrder:null,style:null,className:null,lazy:!1,loading:!1,loadingIcon:null,gutter:!1,itemTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-col-12 col-12 p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(t){return p("p-grid grid",{"p-nogutter grid-nogutter":!t.props.gutter})},root:function(t){var e=t.props;return p("p-dataview p-component",A(A({},"p-dataview-".concat(e.layout),!!e.layout),"p-dataview-loading",e.loading))}},styles:"\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n"}}),T=o.extend({defaultProps:{__TYPE:"DataViewLayoutOptions",id:null,style:null,className:null,layout:null,listIcon:null,gridIcon:null,onChange:null,children:void 0},css:{classes:{root:"p-dataview-layout-options p-selectbutton p-buttonset",listButton:function(t){return p("p-button p-button-icon-only",{"p-highlight":"list"===t.props.layout})},gridButton:function(t){return p("p-button p-button-icon-only",{"p-highlight":"grid"===t.props.layout})}}}});function C(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=k(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}function k(t,e){if(t){if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(t,e):void 0}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function x(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?M(Object(r),!0).forEach((function(e){A(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var R=t.memo((function(e){var n=t.useContext(r),o=T.getProps(e,n),a=T.setMetaData({props:o}),l=a.ptm,s=a.cx,g=function(t,e){o.onChange({originalEvent:t,value:e}),t.preventDefault()},d=m(l("list")),y=m(l("grid")),v=f.getJSXIcon(o.listIcon||t.createElement(i,d),x({},d),{props:o}),b=f.getJSXIcon(o.gridIcon||t.createElement(u,y),x({},y),{props:o}),h=m({id:o.id,style:o.style,className:p(o.className,s("root"))},T.getOtherProps(o),l("root")),w=m({type:"button",className:s("listButton"),onClick:function(t){return g(t,"list")}},l("listButton")),P=m({type:"button",className:s("gridButton"),onClick:function(t){return g(t,"grid")}},l("gridButton"));return t.createElement("div",h,t.createElement("button",w,v,t.createElement(c,null)),t.createElement("button",P,b,t.createElement(c,null)))})),z=t.memo((function(t){return t.template(t.item,t.layout)})),B=t.memo(t.forwardRef((function(o,i){var u=t.useContext(r),c=D.getProps(o,u),y=E(t.useState(c.first),2),P=y[0],O=y[1],S=E(t.useState(c.rows),2),j=S[0],N=S[1],I={props:c,state:{first:P,rows:j}},A=D.setMetaData(I),T=A.ptm,k=A.cx;a(D.css.styles,A.isUnstyled,{name:"dataview"});var L=t.useRef(null),M=c.onPage?c.first:P,R=c.onPage?c.rows:j,B=function(t){return c.dataKey?g.resolveFieldData(t,c.dataKey):null},F=function(){return c.totalRecords?c.totalRecords:c.value?c.value.length:0},_=function(e){var r=p("p-paginator-"+e,c.paginatorClassName),n=F();return t.createElement(s,{first:M,rows:R,pageLinkSize:c.pageLinkSize,className:r,onPageChange:V,template:c.paginatorTemplate,totalRecords:n,rowsPerPageOptions:c.rowsPerPageOptions,currentPageReportTemplate:c.currentPageReportTemplate,leftContent:c.paginatorLeft,rightContent:c.paginatorRight,alwaysShow:c.alwaysShowPaginator,dropdownAppendTo:c.paginatorDropdownAppendTo,ptm:T("paginator"),unstyled:c.unstyled,__parentMetadata:{parent:I}})},V=function(t){c.onPage?c.onPage(t):(O(t.first),N(t.rows))},J=function(){if(c.value){var t,r=new Map,n=g.localeComparator(u&&u.locale||e.locale),o=v(l=c.value)||b(l)||h(l)||w(),a=C(o);try{for(a.s();!(t=a.n()).done;){var i=t.value;r.set(i,g.resolveFieldData(i,c.sortField))}}catch(t){a.e(t)}finally{a.f()}return o.sort((function(t,o){var a=r.get(t),i=r.get(o);return g.sort(a,i,c.sortOrder,n,u&&u.nullSortOrder||e.nullSortOrder)})),o}var l;return null},K=function(){if(!c.loading){var e=c.emptyMessage||n("emptyMessage"),r=m({className:k("emptyMessage")},T("emptyMessage"));return t.createElement("div",r,e)}return null},U=function(e){if(g.isNotEmpty(e)){if(c.paginator){for(var r=c.lazy?0:M,n=F(),o=Math.min(R+r,n),a=[],i=r;i<o;i++){var l=e[i];l&&a.push(t.createElement(z,{key:B(e)||i,template:c.itemTemplate,layout:c.layout,item:l}))}return a}return e.map((function(e,r){return t.createElement(z,{key:B(e)||r,template:c.itemTemplate,layout:c.layout,item:e})}))}return K()};t.useImperativeHandle(i,(function(){return{props:c,getElement:function(){return L.current}}}));var X,Y,$,H=function(){var t=c.value;return g.isNotEmpty(t)&&c.sortField&&(t=J()),t}(),q=function(){if(c.loading){var e=m({className:k("loadingIcon")},T("loadingIcon")),r=c.loadingIcon||t.createElement(l,d({},e,{spin:!0})),n=f.getJSXIcon(r,x({},e),{props:c}),o=m({className:k("loadingOverlay")},T("loadingOverlay"));return t.createElement("div",o,n)}return null}(),G=!c.paginator||"bottom"===c.paginatorPosition&&"both"!==c.paginatorPosition?null:_("top"),Q=!c.paginator||"top"===c.paginatorPosition&&"both"!==c.paginatorPosition?null:_("bottom"),W=function(){if(c.header){var e=m({className:k("header")},T("header"));return t.createElement("div",e,c.header)}return null}(),Z=function(){if(c.footer){var e=m({className:k("footer")},T("footer"));return t.createElement("div",e,c.footer)}return null}(),tt=(X=U(H),Y=m({className:k("grid")},T("grid")),$=m({className:k("content")},T("content")),t.createElement("div",$,t.createElement("div",Y,X))),et=m({id:c.id,ref:L,style:c.style,className:p(c.className,k("root"))},D.getOtherProps(c),T("root"));return t.createElement("div",et,q,W,G,tt,Q,Z)})));R.displayName="DataViewLayoutOptions",z.displayName="DataViewItem",B.displayName="DataView";export{B as DataView,z as DataViewItem,R as DataViewLayoutOptions};
|
package/dataview/dataview.js
CHANGED
|
@@ -166,9 +166,8 @@ this.primereact.dataview = (function (exports, React, PrimeReact, componentbase,
|
|
|
166
166
|
});
|
|
167
167
|
},
|
|
168
168
|
root: function root(_ref2) {
|
|
169
|
-
var _classNames;
|
|
170
169
|
var props = _ref2.props;
|
|
171
|
-
return utils.classNames('p-dataview p-component', (
|
|
170
|
+
return utils.classNames('p-dataview p-component', _defineProperty(_defineProperty({}, "p-dataview-".concat(props.layout), !!props.layout), 'p-dataview-loading', props.loading));
|
|
172
171
|
}
|
|
173
172
|
};
|
|
174
173
|
var styles = "\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n";
|
package/dataview/dataview.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.dataview=function(e,t,r,n,o,a,i,l,s,u){"use strict";function c(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 m=p(t),f=c(r);function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(this,arguments)}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e){if(Array.isArray(e))return d(e)}function v(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function b(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.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)?d(e,t):void 0}}function P(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e){if(Array.isArray(e))return e}function w(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}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 h(e)||w(e,t)||b(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 N(e,t){if("object"!==S(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==S(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=N(e,"string");return"symbol"===S(t)?t:String(t)}function I(e,t,r){return(t=E(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var D=n.ComponentBase.extend({defaultProps:{__TYPE:"DataView",id:null,header:null,footer:null,value:null,layout:"list",dataKey:null,rows:null,first:0,totalRecords:null,paginator:!1,paginatorPosition:"bottom",alwaysShowPaginator:!0,paginatorClassName:null,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",paginatorLeft:null,paginatorRight:null,paginatorDropdownAppendTo:null,pageLinkSize:5,rowsPerPageOptions:null,currentPageReportTemplate:"({currentPage} of {totalPages})",emptyMessage:null,sortField:null,sortOrder:null,style:null,className:null,lazy:!1,loading:!1,loadingIcon:null,gutter:!1,itemTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-col-12 col-12 p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(e){return u.classNames("p-grid grid",{"p-nogutter grid-nogutter":!e.props.gutter})},root:function(e){var t,r=e.props;return u.classNames("p-dataview p-component",(I(t={},"p-dataview-".concat(r.layout),!!r.layout),I(t,"p-dataview-loading",r.loading),t))}},styles:"\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n"}}),A=n.ComponentBase.extend({defaultProps:{__TYPE:"DataViewLayoutOptions",id:null,style:null,className:null,layout:null,listIcon:null,gridIcon:null,onChange:null,children:void 0},css:{classes:{root:"p-dataview-layout-options p-selectbutton p-buttonset",listButton:function(e){return u.classNames("p-button p-button-icon-only",{"p-highlight":"list"===e.props.layout})},gridButton:function(e){return u.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===e.props.layout})}}}});function C(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=T(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}function T(e,t){if(e){if("string"==typeof e)return R(e,t);var r=Object.prototype.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)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function L(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 M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){I(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var k=m.memo((function(e){var t=m.useContext(r.PrimeReactContext),n=A.getProps(e,t),a=A.setMetaData({props:n}),l=a.ptm,c=a.cx,p=function(e,t){n.onChange({originalEvent:e,value:t}),e.preventDefault()},f=u.mergeProps(l("list")),g=u.mergeProps(l("grid")),d=u.IconUtils.getJSXIcon(n.listIcon||m.createElement(o.BarsIcon,f),M({},f),{props:n}),y=u.IconUtils.getJSXIcon(n.gridIcon||m.createElement(i.ThLargeIcon,g),M({},g),{props:n}),v=u.mergeProps({id:n.id,style:n.style,className:u.classNames(n.className,c("root"))},A.getOtherProps(n),l("root")),b=u.mergeProps({type:"button",className:c("listButton"),onClick:function(e){return p(e,"list")}},l("listButton")),P=u.mergeProps({type:"button",className:c("gridButton"),onClick:function(e){return p(e,"grid")}},l("gridButton"));return m.createElement("div",v,m.createElement("button",b,d,m.createElement(s.Ripple,null)),m.createElement("button",P,y,m.createElement(s.Ripple,null)))})),x=m.memo((function(e){return e.template(e.item,e.layout)})),U=m.memo(m.forwardRef((function(e,t){var o=m.useContext(r.PrimeReactContext),i=D.getProps(e,o),s=j(m.useState(i.first),2),c=s[0],p=s[1],d=j(m.useState(i.rows),2),h=d[0],w=d[1],O={props:i,state:{first:c,rows:h}},S=D.setMetaData(O),N=S.ptm,E=S.cx;n.useHandleStyle(D.css.styles,S.isUnstyled,{name:"dataview"});var I=m.useRef(null),A=i.onPage?i.first:c,T=i.onPage?i.rows:h,R=function(e){return i.dataKey?u.ObjectUtils.resolveFieldData(e,i.dataKey):null},L=function(){return i.totalRecords?i.totalRecords:i.value?i.value.length:0},k=function(e){var t=u.classNames("p-paginator-"+e,i.paginatorClassName),r=L();return m.createElement(l.Paginator,{first:A,rows:T,pageLinkSize:i.pageLinkSize,className:t,onPageChange:U,template:i.paginatorTemplate,totalRecords:r,rowsPerPageOptions:i.rowsPerPageOptions,currentPageReportTemplate:i.currentPageReportTemplate,leftContent:i.paginatorLeft,rightContent:i.paginatorRight,alwaysShow:i.alwaysShowPaginator,dropdownAppendTo:i.paginatorDropdownAppendTo,ptm:N("paginator"),unstyled:i.unstyled,__parentMetadata:{parent:O}})},U=function(e){i.onPage?i.onPage(e):(p(e.first),w(e.rows))},_=function(){if(i.value){var e,t=new Map,r=u.ObjectUtils.localeComparator(o&&o.locale||f.default.locale),n=y(s=i.value)||v(s)||b(s)||P(),a=C(n);try{for(a.s();!(e=a.n()).done;){var l=e.value;t.set(l,u.ObjectUtils.resolveFieldData(l,i.sortField))}}catch(e){a.e(e)}finally{a.f()}return n.sort((function(e,n){var a=t.get(e),l=t.get(n);return u.ObjectUtils.sort(a,l,i.sortOrder,r,o&&o.nullSortOrder||f.default.nullSortOrder)})),n}var s;return null},B=function(){if(!i.loading){var e=i.emptyMessage||r.localeOption("emptyMessage"),t=u.mergeProps({className:E("emptyMessage")},N("emptyMessage"));return m.createElement("div",t,e)}return null},V=function(e){if(u.ObjectUtils.isNotEmpty(e)){if(i.paginator){for(var t=i.lazy?0:A,r=L(),n=Math.min(T+t,r),o=[],a=t;a<n;a++){var l=e[a];l&&o.push(m.createElement(x,{key:R(e)||a,template:i.itemTemplate,layout:i.layout,item:l}))}return o}return e.map((function(e,t){return m.createElement(x,{key:R(e)||t,template:i.itemTemplate,layout:i.layout,item:e})}))}return B()};m.useImperativeHandle(t,(function(){return{props:i,getElement:function(){return I.current}}}));var z,F,J,K=function(){var e=i.value;return u.ObjectUtils.isNotEmpty(e)&&i.sortField&&(e=_()),e}(),X=function(){if(i.loading){var e=u.mergeProps({className:E("loadingIcon")},N("loadingIcon")),t=i.loadingIcon||m.createElement(a.SpinnerIcon,g({},e,{spin:!0})),r=u.IconUtils.getJSXIcon(t,M({},e),{props:i}),n=u.mergeProps({className:E("loadingOverlay")},N("loadingOverlay"));return m.createElement("div",n,r)}return null}(),H=!i.paginator||"bottom"===i.paginatorPosition&&"both"!==i.paginatorPosition?null:k("top"),Y=!i.paginator||"top"===i.paginatorPosition&&"both"!==i.paginatorPosition?null:k("bottom"),$=function(){if(i.header){var e=u.mergeProps({className:E("header")},N("header"));return m.createElement("div",e,i.header)}return null}(),q=function(){if(i.footer){var e=u.mergeProps({className:E("footer")},N("footer"));return m.createElement("div",e,i.footer)}return null}(),G=(z=V(K),F=u.mergeProps({className:E("grid")},N("grid")),J=u.mergeProps({className:E("content")},N("content")),m.createElement("div",J,m.createElement("div",F,z))),Q=u.mergeProps({id:i.id,ref:I,style:i.style,className:u.classNames(i.className,E("root"))},D.getOtherProps(i),N("root"));return m.createElement("div",Q,X,$,H,G,Y,q)})));return k.displayName="DataViewLayoutOptions",x.displayName="DataViewItem",U.displayName="DataView",e.DataView=U,e.DataViewItem=x,e.DataViewLayoutOptions=k,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.icons.bars,primereact.icons.spinner,primereact.icons.thlarge,primereact.paginator,primereact.ripple,primereact.utils);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.dataview=function(e,t,r,n,o,a,i,l,s,u){"use strict";function c(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 m=p(t),f=c(r);function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(this,arguments)}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e){if(Array.isArray(e))return d(e)}function v(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function b(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.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)?d(e,t):void 0}}function P(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e){if(Array.isArray(e))return e}function w(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}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 h(e)||w(e,t)||b(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 N(e,t){if("object"!==S(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==S(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=N(e,"string");return"symbol"===S(t)?t:String(t)}function I(e,t,r){return(t=E(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var D=n.ComponentBase.extend({defaultProps:{__TYPE:"DataView",id:null,header:null,footer:null,value:null,layout:"list",dataKey:null,rows:null,first:0,totalRecords:null,paginator:!1,paginatorPosition:"bottom",alwaysShowPaginator:!0,paginatorClassName:null,paginatorTemplate:"FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",paginatorLeft:null,paginatorRight:null,paginatorDropdownAppendTo:null,pageLinkSize:5,rowsPerPageOptions:null,currentPageReportTemplate:"({currentPage} of {totalPages})",emptyMessage:null,sortField:null,sortOrder:null,style:null,className:null,lazy:!1,loading:!1,loadingIcon:null,gutter:!1,itemTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-col-12 col-12 p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(e){return u.classNames("p-grid grid",{"p-nogutter grid-nogutter":!e.props.gutter})},root:function(e){var t=e.props;return u.classNames("p-dataview p-component",I(I({},"p-dataview-".concat(t.layout),!!t.layout),"p-dataview-loading",t.loading))}},styles:"\n@layer primereact {\n .p-dataview-loading {\n position: relative;\n min-height: 4rem;\n }\n \n .p-dataview .p-dataview-loading-overlay {\n position: absolute;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n"}}),A=n.ComponentBase.extend({defaultProps:{__TYPE:"DataViewLayoutOptions",id:null,style:null,className:null,layout:null,listIcon:null,gridIcon:null,onChange:null,children:void 0},css:{classes:{root:"p-dataview-layout-options p-selectbutton p-buttonset",listButton:function(e){return u.classNames("p-button p-button-icon-only",{"p-highlight":"list"===e.props.layout})},gridButton:function(e){return u.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===e.props.layout})}}}});function C(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=T(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}function T(e,t){if(e){if("string"==typeof e)return R(e,t);var r=Object.prototype.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)?R(e,t):void 0}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function L(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 M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach((function(t){I(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var k=m.memo((function(e){var t=m.useContext(r.PrimeReactContext),n=A.getProps(e,t),a=A.setMetaData({props:n}),l=a.ptm,c=a.cx,p=function(e,t){n.onChange({originalEvent:e,value:t}),e.preventDefault()},f=u.mergeProps(l("list")),g=u.mergeProps(l("grid")),d=u.IconUtils.getJSXIcon(n.listIcon||m.createElement(o.BarsIcon,f),M({},f),{props:n}),y=u.IconUtils.getJSXIcon(n.gridIcon||m.createElement(i.ThLargeIcon,g),M({},g),{props:n}),v=u.mergeProps({id:n.id,style:n.style,className:u.classNames(n.className,c("root"))},A.getOtherProps(n),l("root")),b=u.mergeProps({type:"button",className:c("listButton"),onClick:function(e){return p(e,"list")}},l("listButton")),P=u.mergeProps({type:"button",className:c("gridButton"),onClick:function(e){return p(e,"grid")}},l("gridButton"));return m.createElement("div",v,m.createElement("button",b,d,m.createElement(s.Ripple,null)),m.createElement("button",P,y,m.createElement(s.Ripple,null)))})),x=m.memo((function(e){return e.template(e.item,e.layout)})),U=m.memo(m.forwardRef((function(e,t){var o=m.useContext(r.PrimeReactContext),i=D.getProps(e,o),s=j(m.useState(i.first),2),c=s[0],p=s[1],d=j(m.useState(i.rows),2),h=d[0],w=d[1],O={props:i,state:{first:c,rows:h}},S=D.setMetaData(O),N=S.ptm,E=S.cx;n.useHandleStyle(D.css.styles,S.isUnstyled,{name:"dataview"});var I=m.useRef(null),A=i.onPage?i.first:c,T=i.onPage?i.rows:h,R=function(e){return i.dataKey?u.ObjectUtils.resolveFieldData(e,i.dataKey):null},L=function(){return i.totalRecords?i.totalRecords:i.value?i.value.length:0},k=function(e){var t=u.classNames("p-paginator-"+e,i.paginatorClassName),r=L();return m.createElement(l.Paginator,{first:A,rows:T,pageLinkSize:i.pageLinkSize,className:t,onPageChange:U,template:i.paginatorTemplate,totalRecords:r,rowsPerPageOptions:i.rowsPerPageOptions,currentPageReportTemplate:i.currentPageReportTemplate,leftContent:i.paginatorLeft,rightContent:i.paginatorRight,alwaysShow:i.alwaysShowPaginator,dropdownAppendTo:i.paginatorDropdownAppendTo,ptm:N("paginator"),unstyled:i.unstyled,__parentMetadata:{parent:O}})},U=function(e){i.onPage?i.onPage(e):(p(e.first),w(e.rows))},_=function(){if(i.value){var e,t=new Map,r=u.ObjectUtils.localeComparator(o&&o.locale||f.default.locale),n=y(s=i.value)||v(s)||b(s)||P(),a=C(n);try{for(a.s();!(e=a.n()).done;){var l=e.value;t.set(l,u.ObjectUtils.resolveFieldData(l,i.sortField))}}catch(e){a.e(e)}finally{a.f()}return n.sort((function(e,n){var a=t.get(e),l=t.get(n);return u.ObjectUtils.sort(a,l,i.sortOrder,r,o&&o.nullSortOrder||f.default.nullSortOrder)})),n}var s;return null},B=function(){if(!i.loading){var e=i.emptyMessage||r.localeOption("emptyMessage"),t=u.mergeProps({className:E("emptyMessage")},N("emptyMessage"));return m.createElement("div",t,e)}return null},V=function(e){if(u.ObjectUtils.isNotEmpty(e)){if(i.paginator){for(var t=i.lazy?0:A,r=L(),n=Math.min(T+t,r),o=[],a=t;a<n;a++){var l=e[a];l&&o.push(m.createElement(x,{key:R(e)||a,template:i.itemTemplate,layout:i.layout,item:l}))}return o}return e.map((function(e,t){return m.createElement(x,{key:R(e)||t,template:i.itemTemplate,layout:i.layout,item:e})}))}return B()};m.useImperativeHandle(t,(function(){return{props:i,getElement:function(){return I.current}}}));var z,F,J,K=function(){var e=i.value;return u.ObjectUtils.isNotEmpty(e)&&i.sortField&&(e=_()),e}(),X=function(){if(i.loading){var e=u.mergeProps({className:E("loadingIcon")},N("loadingIcon")),t=i.loadingIcon||m.createElement(a.SpinnerIcon,g({},e,{spin:!0})),r=u.IconUtils.getJSXIcon(t,M({},e),{props:i}),n=u.mergeProps({className:E("loadingOverlay")},N("loadingOverlay"));return m.createElement("div",n,r)}return null}(),H=!i.paginator||"bottom"===i.paginatorPosition&&"both"!==i.paginatorPosition?null:k("top"),Y=!i.paginator||"top"===i.paginatorPosition&&"both"!==i.paginatorPosition?null:k("bottom"),$=function(){if(i.header){var e=u.mergeProps({className:E("header")},N("header"));return m.createElement("div",e,i.header)}return null}(),q=function(){if(i.footer){var e=u.mergeProps({className:E("footer")},N("footer"));return m.createElement("div",e,i.footer)}return null}(),G=(z=V(K),F=u.mergeProps({className:E("grid")},N("grid")),J=u.mergeProps({className:E("content")},N("content")),m.createElement("div",J,m.createElement("div",F,z))),Q=u.mergeProps({id:i.id,ref:I,style:i.style,className:u.classNames(i.className,E("root"))},D.getOtherProps(i),N("root"));return m.createElement("div",Q,X,$,H,G,Y,q)})));return k.displayName="DataViewLayoutOptions",x.displayName="DataViewItem",U.displayName="DataView",e.DataView=U,e.DataViewItem=x,e.DataViewLayoutOptions=k,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.icons.bars,primereact.icons.spinner,primereact.icons.thlarge,primereact.paginator,primereact.ripple,primereact.utils);
|
package/dialog/dialog.cjs.js
CHANGED
|
@@ -311,7 +311,7 @@ var classes = {
|
|
|
311
311
|
},
|
|
312
312
|
transition: 'p-dialog'
|
|
313
313
|
};
|
|
314
|
-
var styles = "\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0
|
|
314
|
+
var styles = "\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px;\n left: 0px;\n }\n \n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n \n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n \n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n \n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n } \n}\n";
|
|
315
315
|
var inlineStyles = {
|
|
316
316
|
mask: function mask(_ref5) {
|
|
317
317
|
var props = _ref5.props;
|
|
@@ -782,7 +782,7 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
782
782
|
styleElement.current = utils.DomHandler.createInlineStyle(context && context.nonce || PrimeReact__default["default"].nonce);
|
|
783
783
|
var innerHTML = '';
|
|
784
784
|
for (var breakpoint in props.breakpoints) {
|
|
785
|
-
innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-dialog[").concat(attributeSelector.current, "] {\n width: ").concat(props.breakpoints[breakpoint], "
|
|
785
|
+
innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-dialog[").concat(attributeSelector.current, "] {\n width: ").concat(props.breakpoints[breakpoint], ";\n }\n }\n ");
|
|
786
786
|
}
|
|
787
787
|
styleElement.current.innerHTML = innerHTML;
|
|
788
788
|
};
|
|
@@ -958,9 +958,7 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
958
958
|
var maskProps = utils.mergeProps({
|
|
959
959
|
ref: maskRef,
|
|
960
960
|
style: sx('mask'),
|
|
961
|
-
className: cx('mask',
|
|
962
|
-
maskVisibleState: maskVisibleState
|
|
963
|
-
}),
|
|
961
|
+
className: cx('mask'),
|
|
964
962
|
onPointerUp: onMaskPointerUp
|
|
965
963
|
}, ptm('mask'));
|
|
966
964
|
var rootProps = utils.mergeProps({
|
package/dialog/dialog.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),n=require("primereact/api"),r=require("primereact/componentbase"),o=require("primereact/csstransition"),i=require("primereact/hooks"),a=require("primereact/icons/times"),l=require("primereact/icons/windowmaximize"),c=require("primereact/icons/windowminimize"),u=require("primereact/portal"),s=require("primereact/ripple");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(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 m=d(e),g=p(n);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e){if(Array.isArray(e))return b(e)}function v(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function h(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.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)?b(e,t):void 0}}function x(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function w(e){return w="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},w(e)}function E(e,t){if("object"!==w(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function O(e){var t=E(e,"string");return"symbol"===w(t)?t:String(t)}function D(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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,i,a,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function z(){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 k(e,t){return S(e)||P(e,t)||h(e,t)||z()}var I=function(e){var t=m.useRef(void 0);return m.useEffect((function(){t.current=e})),t.current},j=function(e,n,r){var o,i,a,l,c,u,s,p,d,g,f,b,y,v,h,x=(l=void 0===(a=(o={type:"keydown",listener:function(e){"Esc"!==e.key&&"Escape"!==e.key||(e.stopImmediatePropagation(),r(e))}}).target)?"document":a,c=o.type,u=o.listener,s=o.options,d=void 0===(p=o.when)||p,g=m.useRef(null),f=m.useRef(null),b=I(u),y=I(s),v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.ObjectUtils.isNotEmpty(e.target)&&(h(),(e.when||d)&&(g.current=t.DomHandler.getTargetElement(e.target))),!f.current&&g.current&&(f.current=function(e){return u&&u(e)},g.current.addEventListener(c,f.current,s))},h=function(){f.current&&(g.current.removeEventListener(c,f.current,s),f.current=null)},m.useEffect((function(){d?g.current=t.DomHandler.getTargetElement(l):(h(),g.current=null)}),[l,d]),m.useEffect((function(){!f.current||""+b==""+u&&y===s||(h(),d&&v())}),[u,s,d]),i=function(){h()},m.useEffect((function(){return i}),[]),[v,h]),w=k(x,2),E=w[0],O=w[1];return m.useEffect((function(){if(n&&e.current)return E(),function(){O()}})),[e,r]};function C(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 R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var H=r.ComponentBase.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,header:null,headerClassName:null,headerStyle:null,icons:null,id:null,keepInViewport:!0,maskClassName:null,maskStyle:null,maximizable:!1,maximizeIcon:null,maximized:!1,minX:0,minY:0,minimizeIcon:null,modal:!0,onClick:null,onDrag:null,onDragEnd:null,onDragStart:null,onHide:null,onMaskClick:null,onMaximize:null,onResize:null,onResizeEnd:null,onResizeStart:null,onShow:null,position:"center",resizable:!0,rtl:!1,showHeader:!0,style:null,transitionOptions:null,visible:!1,children:void 0},css:{classes:{closeButtonIcon:"p-dialog-header-close-icon",closeButton:"p-dialog-header-icon p-dialog-header-close p-link",maximizableIcon:"p-dialog-header-maximize-icon",maximizableButton:"p-dialog-header-icon p-dialog-header-maximize p-link",header:function(e){return t.classNames("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return t.classNames("p-dialog-content",e.props.contentClassName)},footer:"p-dialog-footer",mask:function(e){var n=e.props,r=e.maskVisibleState,o=["center","left","right","top","top-left","top-right","bottom","bottom-left","bottom-right"].find((function(e){return e===n.position||e.replace("-","")===n.position}));return t.classNames("p-dialog-mask",o?"p-dialog-".concat(o):"",{"p-component-overlay p-component-overlay-enter":n.modal,"p-dialog-visible":r,"p-dialog-draggable":n.draggable,"p-dialog-resizable":n.resizable},n.maskClassName)},root:function(e){var n=e.props,r=e.maximized,o=e.context;return t.classNames("p-dialog p-component",n.className,{"p-dialog-rtl":n.rtl,"p-dialog-maximized":r,"p-dialog-default":!r,"p-input-filled":o&&"filled"===o.inputStyle||"filled"===g.default.inputStyle,"p-ripple-disabled":o&&!1===o.ripple||!1===g.default.ripple})},transition:"p-dialog"},styles:"\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n }\n \n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n \n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n \n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n \n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n } \n}\n",inlineStyles:{mask:function(e){var t=e.props;return R({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",justifyContent:"left"===t.position||"top-left"===t.position||"bottom-left"===t.position?"flex-start":"right"===t.position||"top-right"===t.position||"bottom-right"===t.position?"flex-end":"center",alignItems:"top"===t.position||"top-left"===t.position||"top-right"===t.position?"flex-start":"bottom"===t.position||"bottom-left"===t.position||"bottom-right"===t.position?"flex-end":"center",pointerEvents:!t.modal&&"none"},t.maskStyle)}}}});function N(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 M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var T=m.forwardRef((function(e,p){var d=m.useContext(n.PrimeReactContext),b=H.getProps(e,d),w=b.id?b.id:t.UniqueComponentId(),E=k(m.useState(w),2),O=E[0],D=k(m.useState(!1),2),S=D[0],P=D[1],z=k(m.useState(!1),2),I=z[0],C=z[1],R=k(m.useState(b.maximized),2),N=R[0],T=R[1],B=m.useRef(null),U=m.useRef(null),X=m.useRef(null),_=m.useRef(null),q=m.useRef(null),L=m.useRef(null),A=m.useRef(null),Y=m.useRef(!1),V=m.useRef(!1),Z=m.useRef(null),F=m.useRef(null),J=m.useRef(null),W=m.useRef(w),$=m.useRef(null),K=b.onMaximize?b.maximized:N,G=I&&(b.blockScroll||b.maximizable&&K),Q=H.setMetaData(M(M({props:b},b.__parentMetadata),{},{state:{id:O,maximized:K,containerVisible:S}})),ee=Q.ptm,te=Q.cx,ne=Q.sx;r.useHandleStyle(H.css.styles,Q.isUnstyled,{name:"dialog"}),j(U,b.closable&&b.closeOnEscape,(function(e){var t=e.currentTarget;if(t&&t.primeDialogParams){var n=t.primeDialogParams,r=n.length;ve(e),n.splice(r-1,1)}}));var re=k(i.useEventListener({type:"keydown",listener:function(e){return Ee(e)}}),2),oe=re[0],ie=re[1],ae=k(i.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return ke(e)}}),2),le=ae[0],ce=ae[1],ue=k(i.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Ie(e)}}),2),se=ue[0],pe=ue[1],de=k(i.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return De(e)}}),2),me=de[0],ge=de[1],fe=k(i.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Se(e)}}),2),be=fe[0],ye=fe[1],ve=function(e){b.onHide(),e.preventDefault()},he=function(e){X.current=e.target,b.onPointerDown&&b.onPointerDown(e)},xe=function(e){b.dismissableMask&&b.modal&&U.current===e.target&&!X.current&&ve(e),b.onMaskClick&&b.onMaskClick(e),X.current=null},we=function(e){b.onMaximize?b.onMaximize({originalEvent:e,maximized:!K}):T((function(e){return!e})),e.preventDefault()},Ee=function(e){var n=e.currentTarget;if(n&&n.primeDialogParams){var r=n.primeDialogParams,o=r.length,i=r[o-1]?r[o-1].id:void 0;if(i===O){var a=document.getElementById(i);if("Tab"===e.key){e.preventDefault();var l=t.DomHandler.getFocusableElements(a);if(l&&l.length>0)if(document.activeElement){var c=l.indexOf(document.activeElement);e.shiftKey?-1===c||0===c?l[l.length-1].focus():l[c-1].focus():-1===c||c===l.length-1?l[0].focus():l[c+1].focus()}else l[0].focus()}}}},Oe=function(e){t.DomHandler.hasClass(e.target,"p-dialog-header-icon")||t.DomHandler.hasClass(e.target.parentElement,"p-dialog-header-icon")||b.draggable&&(Y.current=!0,Z.current=e.pageX,F.current=e.pageY,B.current.style.margin="0",t.DomHandler.addClass(document.body,"p-unselectable-text"),b.onDragStart&&b.onDragStart(e))},De=function(e){if(Y.current){var n=t.DomHandler.getOuterWidth(B.current),r=t.DomHandler.getOuterHeight(B.current),o=e.pageX-Z.current,i=e.pageY-F.current,a=B.current.getBoundingClientRect(),l=a.left+o,c=a.top+i,u=t.DomHandler.getViewport(),s=getComputedStyle(B.current),p=parseFloat(s.marginLeft),d=parseFloat(s.marginTop);B.current.style.position="fixed",b.keepInViewport?(l>=b.minX&&l+n<u.width&&(Z.current=e.pageX,B.current.style.left=l-p+"px"),c>=b.minY&&c+r<u.height&&(F.current=e.pageY,B.current.style.top=c-d+"px")):(Z.current=e.pageX,B.current.style.left=l-p+"px",F.current=e.pageY,B.current.style.top=c-d+"px"),b.onDrag&&b.onDrag(e)}},Se=function(e){Y.current&&(Y.current=!1,t.DomHandler.removeClass(document.body,"p-unselectable-text"),b.onDragEnd&&b.onDragEnd(e))},Pe=function(e){b.resizable&&(V.current=!0,Z.current=e.pageX,F.current=e.pageY,t.DomHandler.addClass(document.body,"p-unselectable-text"),b.onResizeStart&&b.onResizeStart(e))},ze=function(e,n,r){!r&&(r=t.DomHandler.getViewport());var o=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?o*(r[n]/100):o},ke=function(e){if(V.current){var n=e.pageX-Z.current,r=e.pageY-F.current,o=t.DomHandler.getOuterWidth(B.current),i=t.DomHandler.getOuterHeight(B.current),a=B.current.getBoundingClientRect(),l=t.DomHandler.getViewport(),c=!parseInt(B.current.style.top)||!parseInt(B.current.style.left),u=ze(B.current.style.minWidth,"width",l),s=ze(B.current.style.minHeight,"height",l),p=o+n,d=i+r;c&&(p+=n,d+=r),(!u||p>u)&&a.left+p<l.width&&(B.current.style.width=p+"px"),(!s||d>s)&&a.top+d<l.height&&(B.current.style.height=d+"px"),Z.current=e.pageX,F.current=e.pageY,b.onResize&&b.onResize(e)}},Ie=function(e){V.current&&(V.current=!1,t.DomHandler.removeClass(document.body,"p-unselectable-text"),b.onResizeEnd&&b.onResizeEnd(e))},je=function(){B.current.style.position="",B.current.style.left="",B.current.style.top="",B.current.style.margin=""},Ce=function(){B.current.setAttribute(W.current,"")},Re=function(){var e;b.onShow&&b.onShow(),b.focusOnShow&&!((e=document.activeElement)&&B.current&&B.current.contains(e))&&b.closable&&b.showHeader&&A.current.focus(),Me()},He=function(){b.modal&&t.DomHandler.addClass(U.current,"p-component-overlay-leave")},Ne=function(){Y.current=!1,t.ZIndexUtils.clear(U.current),P(!1),Te(),t.DomHandler.focus($.current),$.current=null},Me=function(){Ue(),Be(!0)},Te=function(){Xe(),Be(!1)},Be=function(e){if(e){var n={id:O,hasBlockScroll:G};document.primeDialogParams||(document.primeDialogParams=[]);var r=document.primeDialogParams.findIndex((function(e){return e.id===O}));document.primeDialogParams=-1===r?[].concat(y(o=document.primeDialogParams)||v(o)||h(o)||x(),[n]):document.primeDialogParams.toSpliced(r,1,n)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==O}));var o;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?t.DomHandler.blockBodyScroll():t.DomHandler.unblockBodyScroll()},Ue=function(){b.draggable&&(me(),be()),b.resizable&&(le(),se()),oe()},Xe=function(){ge(),ye(),ce(),pe(),ie()},_e=function(){J.current=t.DomHandler.createInlineStyle(d&&d.nonce||g.default.nonce);var e="";for(var n in b.breakpoints)e+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(W.current,"] {\n width: ").concat(b.breakpoints[n]," !important;\n }\n }\n ");J.current.innerHTML=e};i.useMountEffect((function(){b.visible&&P(!0),b.breakpoints&&_e()})),i.useUpdateEffect((function(){b.visible&&!S&&P(!0),b.visible!==I&&S&&C(b.visible),b.visible&&($.current=document.activeElement)}),[b.visible,S]),i.useUpdateEffect((function(){S&&(t.ZIndexUtils.set("modal",U.current,d&&d.autoZIndex||g.default.autoZIndex,b.baseZIndex||d&&d.zIndex.modal||g.default.zIndex.modal),C(!0))}),[S]),i.useUpdateEffect((function(){Be(!0)}),[G]),i.useUnmountEffect((function(){Te(),t.DomHandler.removeInlineStyle(J.current),t.ZIndexUtils.clear(U.current)})),m.useImperativeHandle(p,(function(){return{props:b,resetPosition:je,getElement:function(){return B.current},getMask:function(){return U.current},getContent:function(){return _.current},getHeader:function(){return q.current},getFooter:function(){return L.current},getCloseButton:function(){return A.current}}}));var qe,Le,Ae,Ye,Ve,Ze,Fe,Je,We,$e,Ke,Ge,Qe=function(){if(b.closable){var e=b.ariaCloseIconLabel||n.localeOption("close"),r=t.mergeProps({className:te("closeButtonIcon"),"aria-hidden":!0},ee("closeButtonIcon")),o=t.IconUtils.getJSXIcon(b.closeIcon||m.createElement(a.TimesIcon,r),M({},r),{props:b}),i=t.mergeProps({ref:A,type:"button",className:te("closeButton"),"aria-label":e,onClick:ve},ee("closeButton"));return m.createElement("button",i,o,m.createElement(s.Ripple,null))}return null},et=function(){var e=t.mergeProps({className:te("maximizableIcon")},ee("maximizableIcon")),n=t.IconUtils.getJSXIcon(K?b.minimizeIcon||m.createElement(c.WindowMinimizeIcon,e):b.maximizeIcon||m.createElement(l.WindowMaximizeIcon,e),e,{props:b});if(b.maximizable){var r=t.mergeProps({type:"button",className:te("maximizableButton"),onClick:we},ee("maximizableButton"));return m.createElement("button",r,n,m.createElement(s.Ripple,null))}return null},tt=function(){if(b.showHeader){var e=Qe(),n=et(),r=t.ObjectUtils.getJSXElement(b.icons,b),o=t.ObjectUtils.getJSXElement(b.header,b),i=O+"_header",a=t.mergeProps({ref:q,style:b.headerStyle,className:te("header"),onMouseDown:Oe},ee("header")),l=t.mergeProps({id:i,className:te("headerTitle")},ee("headerTitle")),c=t.mergeProps({className:te("headerIcons")},ee("headerIcons"));return m.createElement("div",a,m.createElement("div",l,o),m.createElement("div",c,r,n,e))}return null},nt=function(){var e=t.ObjectUtils.getJSXElement(b.footer,b),n=t.mergeProps({ref:L,className:te("footer")},ee("footer"));return e&&m.createElement("div",n,e)};return S&&(Le=tt(),qe=t.mergeProps({id:O+"_content",ref:_,style:b.contentStyle,className:te("content")},ee("content")),Ae=m.createElement("div",qe,b.children),Ye=nt(),Ve=b.resizable?m.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Pe}):null,Ze=O+"_header",Fe=O+"_content",Je={enter:"center"===b.position?150:300,exit:"center"===b.position?150:300},We=t.mergeProps({ref:U,style:ne("mask"),className:te("mask",{maskVisibleState:S}),onPointerUp:xe},ee("mask")),$e=t.mergeProps({ref:B,id:O,className:te("root",{props:b,maximized:K,context:d}),style:b.style,onClick:b.onClick,role:"dialog","aria-labelledby":Ze,"aria-describedby":Fe,"aria-modal":b.modal,onPointerDown:he},H.getOtherProps(b),ee("root")),Ke=t.mergeProps({classNames:te("transition"),timeout:Je,in:I,options:b.transitionOptions,unmountOnExit:!0,onEnter:Ce,onEntered:Re,onExiting:He,onExited:Ne},ee("transition")),Ge=m.createElement("div",We,m.createElement(o.CSSTransition,f({nodeRef:B},Ke),m.createElement("div",$e,Le,Ae,Ye,Ve))),m.createElement(u.Portal,{element:Ge,appendTo:b.appendTo,visible:!0}))}));T.displayName="Dialog",exports.Dialog=T;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),n=require("primereact/api"),r=require("primereact/componentbase"),o=require("primereact/csstransition"),i=require("primereact/hooks"),a=require("primereact/icons/times"),l=require("primereact/icons/windowmaximize"),c=require("primereact/icons/windowminimize"),u=require("primereact/portal"),s=require("primereact/ripple");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(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 m=d(e),g=p(n);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e){if(Array.isArray(e))return b(e)}function v(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function h(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.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)?b(e,t):void 0}}function x(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function w(e){return w="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},w(e)}function E(e,t){if("object"!==w(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==w(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function O(e){var t=E(e,"string");return"symbol"===w(t)?t:String(t)}function D(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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,i,a,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function z(){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 k(e,t){return S(e)||P(e,t)||h(e,t)||z()}var I=function(e){var t=m.useRef(void 0);return m.useEffect((function(){t.current=e})),t.current},j=function(e,n,r){var o,i,a,l,c,u,s,p,d,g,f,b,y,v,h,x=(l=void 0===(a=(o={type:"keydown",listener:function(e){"Esc"!==e.key&&"Escape"!==e.key||(e.stopImmediatePropagation(),r(e))}}).target)?"document":a,c=o.type,u=o.listener,s=o.options,d=void 0===(p=o.when)||p,g=m.useRef(null),f=m.useRef(null),b=I(u),y=I(s),v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.ObjectUtils.isNotEmpty(e.target)&&(h(),(e.when||d)&&(g.current=t.DomHandler.getTargetElement(e.target))),!f.current&&g.current&&(f.current=function(e){return u&&u(e)},g.current.addEventListener(c,f.current,s))},h=function(){f.current&&(g.current.removeEventListener(c,f.current,s),f.current=null)},m.useEffect((function(){d?g.current=t.DomHandler.getTargetElement(l):(h(),g.current=null)}),[l,d]),m.useEffect((function(){!f.current||""+b==""+u&&y===s||(h(),d&&v())}),[u,s,d]),i=function(){h()},m.useEffect((function(){return i}),[]),[v,h]),w=k(x,2),E=w[0],O=w[1];return m.useEffect((function(){if(n&&e.current)return E(),function(){O()}})),[e,r]};function C(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 R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var H=r.ComponentBase.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,header:null,headerClassName:null,headerStyle:null,icons:null,id:null,keepInViewport:!0,maskClassName:null,maskStyle:null,maximizable:!1,maximizeIcon:null,maximized:!1,minX:0,minY:0,minimizeIcon:null,modal:!0,onClick:null,onDrag:null,onDragEnd:null,onDragStart:null,onHide:null,onMaskClick:null,onMaximize:null,onResize:null,onResizeEnd:null,onResizeStart:null,onShow:null,position:"center",resizable:!0,rtl:!1,showHeader:!0,style:null,transitionOptions:null,visible:!1,children:void 0},css:{classes:{closeButtonIcon:"p-dialog-header-close-icon",closeButton:"p-dialog-header-icon p-dialog-header-close p-link",maximizableIcon:"p-dialog-header-maximize-icon",maximizableButton:"p-dialog-header-icon p-dialog-header-maximize p-link",header:function(e){return t.classNames("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return t.classNames("p-dialog-content",e.props.contentClassName)},footer:"p-dialog-footer",mask:function(e){var n=e.props,r=e.maskVisibleState,o=["center","left","right","top","top-left","top-right","bottom","bottom-left","bottom-right"].find((function(e){return e===n.position||e.replace("-","")===n.position}));return t.classNames("p-dialog-mask",o?"p-dialog-".concat(o):"",{"p-component-overlay p-component-overlay-enter":n.modal,"p-dialog-visible":r,"p-dialog-draggable":n.draggable,"p-dialog-resizable":n.resizable},n.maskClassName)},root:function(e){var n=e.props,r=e.maximized,o=e.context;return t.classNames("p-dialog p-component",n.className,{"p-dialog-rtl":n.rtl,"p-dialog-maximized":r,"p-dialog-default":!r,"p-input-filled":o&&"filled"===o.inputStyle||"filled"===g.default.inputStyle,"p-ripple-disabled":o&&!1===o.ripple||!1===g.default.ripple})},transition:"p-dialog"},styles:"\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px;\n left: 0px;\n }\n \n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n \n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n \n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n \n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n } \n}\n",inlineStyles:{mask:function(e){var t=e.props;return R({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",justifyContent:"left"===t.position||"top-left"===t.position||"bottom-left"===t.position?"flex-start":"right"===t.position||"top-right"===t.position||"bottom-right"===t.position?"flex-end":"center",alignItems:"top"===t.position||"top-left"===t.position||"top-right"===t.position?"flex-start":"bottom"===t.position||"bottom-left"===t.position||"bottom-right"===t.position?"flex-end":"center",pointerEvents:!t.modal&&"none"},t.maskStyle)}}}});function N(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 M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var T=m.forwardRef((function(e,p){var d=m.useContext(n.PrimeReactContext),b=H.getProps(e,d),w=b.id?b.id:t.UniqueComponentId(),E=k(m.useState(w),2),O=E[0],D=k(m.useState(!1),2),S=D[0],P=D[1],z=k(m.useState(!1),2),I=z[0],C=z[1],R=k(m.useState(b.maximized),2),N=R[0],T=R[1],B=m.useRef(null),U=m.useRef(null),X=m.useRef(null),_=m.useRef(null),q=m.useRef(null),L=m.useRef(null),A=m.useRef(null),Y=m.useRef(!1),V=m.useRef(!1),Z=m.useRef(null),F=m.useRef(null),J=m.useRef(null),W=m.useRef(w),$=m.useRef(null),K=b.onMaximize?b.maximized:N,G=I&&(b.blockScroll||b.maximizable&&K),Q=H.setMetaData(M(M({props:b},b.__parentMetadata),{},{state:{id:O,maximized:K,containerVisible:S}})),ee=Q.ptm,te=Q.cx,ne=Q.sx;r.useHandleStyle(H.css.styles,Q.isUnstyled,{name:"dialog"}),j(U,b.closable&&b.closeOnEscape,(function(e){var t=e.currentTarget;if(t&&t.primeDialogParams){var n=t.primeDialogParams,r=n.length;ve(e),n.splice(r-1,1)}}));var re=k(i.useEventListener({type:"keydown",listener:function(e){return Ee(e)}}),2),oe=re[0],ie=re[1],ae=k(i.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return ke(e)}}),2),le=ae[0],ce=ae[1],ue=k(i.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Ie(e)}}),2),se=ue[0],pe=ue[1],de=k(i.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return De(e)}}),2),me=de[0],ge=de[1],fe=k(i.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Se(e)}}),2),be=fe[0],ye=fe[1],ve=function(e){b.onHide(),e.preventDefault()},he=function(e){X.current=e.target,b.onPointerDown&&b.onPointerDown(e)},xe=function(e){b.dismissableMask&&b.modal&&U.current===e.target&&!X.current&&ve(e),b.onMaskClick&&b.onMaskClick(e),X.current=null},we=function(e){b.onMaximize?b.onMaximize({originalEvent:e,maximized:!K}):T((function(e){return!e})),e.preventDefault()},Ee=function(e){var n=e.currentTarget;if(n&&n.primeDialogParams){var r=n.primeDialogParams,o=r.length,i=r[o-1]?r[o-1].id:void 0;if(i===O){var a=document.getElementById(i);if("Tab"===e.key){e.preventDefault();var l=t.DomHandler.getFocusableElements(a);if(l&&l.length>0)if(document.activeElement){var c=l.indexOf(document.activeElement);e.shiftKey?-1===c||0===c?l[l.length-1].focus():l[c-1].focus():-1===c||c===l.length-1?l[0].focus():l[c+1].focus()}else l[0].focus()}}}},Oe=function(e){t.DomHandler.hasClass(e.target,"p-dialog-header-icon")||t.DomHandler.hasClass(e.target.parentElement,"p-dialog-header-icon")||b.draggable&&(Y.current=!0,Z.current=e.pageX,F.current=e.pageY,B.current.style.margin="0",t.DomHandler.addClass(document.body,"p-unselectable-text"),b.onDragStart&&b.onDragStart(e))},De=function(e){if(Y.current){var n=t.DomHandler.getOuterWidth(B.current),r=t.DomHandler.getOuterHeight(B.current),o=e.pageX-Z.current,i=e.pageY-F.current,a=B.current.getBoundingClientRect(),l=a.left+o,c=a.top+i,u=t.DomHandler.getViewport(),s=getComputedStyle(B.current),p=parseFloat(s.marginLeft),d=parseFloat(s.marginTop);B.current.style.position="fixed",b.keepInViewport?(l>=b.minX&&l+n<u.width&&(Z.current=e.pageX,B.current.style.left=l-p+"px"),c>=b.minY&&c+r<u.height&&(F.current=e.pageY,B.current.style.top=c-d+"px")):(Z.current=e.pageX,B.current.style.left=l-p+"px",F.current=e.pageY,B.current.style.top=c-d+"px"),b.onDrag&&b.onDrag(e)}},Se=function(e){Y.current&&(Y.current=!1,t.DomHandler.removeClass(document.body,"p-unselectable-text"),b.onDragEnd&&b.onDragEnd(e))},Pe=function(e){b.resizable&&(V.current=!0,Z.current=e.pageX,F.current=e.pageY,t.DomHandler.addClass(document.body,"p-unselectable-text"),b.onResizeStart&&b.onResizeStart(e))},ze=function(e,n,r){!r&&(r=t.DomHandler.getViewport());var o=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?o*(r[n]/100):o},ke=function(e){if(V.current){var n=e.pageX-Z.current,r=e.pageY-F.current,o=t.DomHandler.getOuterWidth(B.current),i=t.DomHandler.getOuterHeight(B.current),a=B.current.getBoundingClientRect(),l=t.DomHandler.getViewport(),c=!parseInt(B.current.style.top)||!parseInt(B.current.style.left),u=ze(B.current.style.minWidth,"width",l),s=ze(B.current.style.minHeight,"height",l),p=o+n,d=i+r;c&&(p+=n,d+=r),(!u||p>u)&&a.left+p<l.width&&(B.current.style.width=p+"px"),(!s||d>s)&&a.top+d<l.height&&(B.current.style.height=d+"px"),Z.current=e.pageX,F.current=e.pageY,b.onResize&&b.onResize(e)}},Ie=function(e){V.current&&(V.current=!1,t.DomHandler.removeClass(document.body,"p-unselectable-text"),b.onResizeEnd&&b.onResizeEnd(e))},je=function(){B.current.style.position="",B.current.style.left="",B.current.style.top="",B.current.style.margin=""},Ce=function(){B.current.setAttribute(W.current,"")},Re=function(){var e;b.onShow&&b.onShow(),b.focusOnShow&&!((e=document.activeElement)&&B.current&&B.current.contains(e))&&b.closable&&b.showHeader&&A.current.focus(),Me()},He=function(){b.modal&&t.DomHandler.addClass(U.current,"p-component-overlay-leave")},Ne=function(){Y.current=!1,t.ZIndexUtils.clear(U.current),P(!1),Te(),t.DomHandler.focus($.current),$.current=null},Me=function(){Ue(),Be(!0)},Te=function(){Xe(),Be(!1)},Be=function(e){if(e){var n={id:O,hasBlockScroll:G};document.primeDialogParams||(document.primeDialogParams=[]);var r=document.primeDialogParams.findIndex((function(e){return e.id===O}));document.primeDialogParams=-1===r?[].concat(y(o=document.primeDialogParams)||v(o)||h(o)||x(),[n]):document.primeDialogParams.toSpliced(r,1,n)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==O}));var o;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?t.DomHandler.blockBodyScroll():t.DomHandler.unblockBodyScroll()},Ue=function(){b.draggable&&(me(),be()),b.resizable&&(le(),se()),oe()},Xe=function(){ge(),ye(),ce(),pe(),ie()},_e=function(){J.current=t.DomHandler.createInlineStyle(d&&d.nonce||g.default.nonce);var e="";for(var n in b.breakpoints)e+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(W.current,"] {\n width: ").concat(b.breakpoints[n],";\n }\n }\n ");J.current.innerHTML=e};i.useMountEffect((function(){b.visible&&P(!0),b.breakpoints&&_e()})),i.useUpdateEffect((function(){b.visible&&!S&&P(!0),b.visible!==I&&S&&C(b.visible),b.visible&&($.current=document.activeElement)}),[b.visible,S]),i.useUpdateEffect((function(){S&&(t.ZIndexUtils.set("modal",U.current,d&&d.autoZIndex||g.default.autoZIndex,b.baseZIndex||d&&d.zIndex.modal||g.default.zIndex.modal),C(!0))}),[S]),i.useUpdateEffect((function(){Be(!0)}),[G]),i.useUnmountEffect((function(){Te(),t.DomHandler.removeInlineStyle(J.current),t.ZIndexUtils.clear(U.current)})),m.useImperativeHandle(p,(function(){return{props:b,resetPosition:je,getElement:function(){return B.current},getMask:function(){return U.current},getContent:function(){return _.current},getHeader:function(){return q.current},getFooter:function(){return L.current},getCloseButton:function(){return A.current}}}));var qe,Le,Ae,Ye,Ve,Ze,Fe,Je,We,$e,Ke,Ge,Qe=function(){if(b.closable){var e=b.ariaCloseIconLabel||n.localeOption("close"),r=t.mergeProps({className:te("closeButtonIcon"),"aria-hidden":!0},ee("closeButtonIcon")),o=t.IconUtils.getJSXIcon(b.closeIcon||m.createElement(a.TimesIcon,r),M({},r),{props:b}),i=t.mergeProps({ref:A,type:"button",className:te("closeButton"),"aria-label":e,onClick:ve},ee("closeButton"));return m.createElement("button",i,o,m.createElement(s.Ripple,null))}return null},et=function(){var e=t.mergeProps({className:te("maximizableIcon")},ee("maximizableIcon")),n=t.IconUtils.getJSXIcon(K?b.minimizeIcon||m.createElement(c.WindowMinimizeIcon,e):b.maximizeIcon||m.createElement(l.WindowMaximizeIcon,e),e,{props:b});if(b.maximizable){var r=t.mergeProps({type:"button",className:te("maximizableButton"),onClick:we},ee("maximizableButton"));return m.createElement("button",r,n,m.createElement(s.Ripple,null))}return null},tt=function(){if(b.showHeader){var e=Qe(),n=et(),r=t.ObjectUtils.getJSXElement(b.icons,b),o=t.ObjectUtils.getJSXElement(b.header,b),i=O+"_header",a=t.mergeProps({ref:q,style:b.headerStyle,className:te("header"),onMouseDown:Oe},ee("header")),l=t.mergeProps({id:i,className:te("headerTitle")},ee("headerTitle")),c=t.mergeProps({className:te("headerIcons")},ee("headerIcons"));return m.createElement("div",a,m.createElement("div",l,o),m.createElement("div",c,r,n,e))}return null},nt=function(){var e=t.ObjectUtils.getJSXElement(b.footer,b),n=t.mergeProps({ref:L,className:te("footer")},ee("footer"));return e&&m.createElement("div",n,e)};return S&&(Le=tt(),qe=t.mergeProps({id:O+"_content",ref:_,style:b.contentStyle,className:te("content")},ee("content")),Ae=m.createElement("div",qe,b.children),Ye=nt(),Ve=b.resizable?m.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Pe}):null,Ze=O+"_header",Fe=O+"_content",Je={enter:"center"===b.position?150:300,exit:"center"===b.position?150:300},We=t.mergeProps({ref:U,style:ne("mask"),className:te("mask"),onPointerUp:xe},ee("mask")),$e=t.mergeProps({ref:B,id:O,className:te("root",{props:b,maximized:K,context:d}),style:b.style,onClick:b.onClick,role:"dialog","aria-labelledby":Ze,"aria-describedby":Fe,"aria-modal":b.modal,onPointerDown:he},H.getOtherProps(b),ee("root")),Ke=t.mergeProps({classNames:te("transition"),timeout:Je,in:I,options:b.transitionOptions,unmountOnExit:!0,onEnter:Ce,onEntered:Re,onExiting:He,onExited:Ne},ee("transition")),Ge=m.createElement("div",We,m.createElement(o.CSSTransition,f({nodeRef:B},Ke),m.createElement("div",$e,Le,Ae,Ye,Ve))),m.createElement(u.Portal,{element:Ge,appendTo:b.appendTo,visible:!0}))}));T.displayName="Dialog",exports.Dialog=T;
|
package/dialog/dialog.esm.js
CHANGED
|
@@ -284,7 +284,7 @@ var classes = {
|
|
|
284
284
|
},
|
|
285
285
|
transition: 'p-dialog'
|
|
286
286
|
};
|
|
287
|
-
var styles = "\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0
|
|
287
|
+
var styles = "\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px;\n left: 0px;\n }\n \n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n \n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n \n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n \n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n } \n}\n";
|
|
288
288
|
var inlineStyles = {
|
|
289
289
|
mask: function mask(_ref5) {
|
|
290
290
|
var props = _ref5.props;
|
|
@@ -755,7 +755,7 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
755
755
|
styleElement.current = DomHandler.createInlineStyle(context && context.nonce || PrimeReact.nonce);
|
|
756
756
|
var innerHTML = '';
|
|
757
757
|
for (var breakpoint in props.breakpoints) {
|
|
758
|
-
innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-dialog[").concat(attributeSelector.current, "] {\n width: ").concat(props.breakpoints[breakpoint], "
|
|
758
|
+
innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-dialog[").concat(attributeSelector.current, "] {\n width: ").concat(props.breakpoints[breakpoint], ";\n }\n }\n ");
|
|
759
759
|
}
|
|
760
760
|
styleElement.current.innerHTML = innerHTML;
|
|
761
761
|
};
|
|
@@ -931,9 +931,7 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
931
931
|
var maskProps = mergeProps({
|
|
932
932
|
ref: maskRef,
|
|
933
933
|
style: sx('mask'),
|
|
934
|
-
className: cx('mask',
|
|
935
|
-
maskVisibleState: maskVisibleState
|
|
936
|
-
}),
|
|
934
|
+
className: cx('mask'),
|
|
937
935
|
onPointerUp: onMaskPointerUp
|
|
938
936
|
}, ptm('mask'));
|
|
939
937
|
var rootProps = mergeProps({
|
package/dialog/dialog.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{DomHandler as t,ObjectUtils as n,classNames as r,UniqueComponentId as o,ZIndexUtils as i,mergeProps as a,IconUtils as l}from"primereact/utils";import c,{PrimeReactContext as u,localeOption as s}from"primereact/api";import{ComponentBase as p,useHandleStyle as d}from"primereact/componentbase";import{CSSTransition as m}from"primereact/csstransition";import{useEventListener as g,useMountEffect as f,useUpdateEffect as b,useUnmountEffect as y}from"primereact/hooks";import{TimesIcon as h}from"primereact/icons/times";import{WindowMaximizeIcon as v}from"primereact/icons/windowmaximize";import{WindowMinimizeIcon as x}from"primereact/icons/windowminimize";import{Portal as w}from"primereact/portal";import{Ripple as E}from"primereact/ripple";function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},S.apply(this,arguments)}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function k(e){if(Array.isArray(e))return z(e)}function O(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function P(e,t){if(e){if("string"==typeof e)return z(e,t);var n=Object.prototype.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)?z(e,t):void 0}}function D(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}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 j(e,t){if("object"!==I(e)||null===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 C(e){var t=j(e,"string");return"symbol"===I(t)?t:String(t)}function R(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(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,i,a,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function T(){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 M(e,t){return N(e)||B(e,t)||P(e,t)||T()}var X=function(t){var n=e.useRef(void 0);return e.useEffect((function(){n.current=t})),n.current},A=function(r,o,i){var a,l,c,u,s,p,d,m,g,f,b,y,h,v,x,w=(u=void 0===(c=(a={type:"keydown",listener:function(e){"Esc"!==e.key&&"Escape"!==e.key||(e.stopImmediatePropagation(),i(e))}}).target)?"document":c,s=a.type,p=a.listener,d=a.options,g=void 0===(m=a.when)||m,f=e.useRef(null),b=e.useRef(null),y=X(p),h=X(d),v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.isNotEmpty(e.target)&&(x(),(e.when||g)&&(f.current=t.getTargetElement(e.target))),!b.current&&f.current&&(b.current=function(e){return p&&p(e)},f.current.addEventListener(s,b.current,d))},x=function(){b.current&&(f.current.removeEventListener(s,b.current,d),b.current=null)},e.useEffect((function(){g?f.current=t.getTargetElement(u):(x(),f.current=null)}),[u,g]),e.useEffect((function(){!b.current||""+y==""+p&&h===d||(x(),g&&v())}),[p,d,g]),l=function(){x()},e.useEffect((function(){return l}),[]),[v,x]),E=M(w,2),S=E[0],z=E[1];return e.useEffect((function(){if(o&&r.current)return S(),function(){z()}})),[r,i]};function H(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 Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var _=p.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,header:null,headerClassName:null,headerStyle:null,icons:null,id:null,keepInViewport:!0,maskClassName:null,maskStyle:null,maximizable:!1,maximizeIcon:null,maximized:!1,minX:0,minY:0,minimizeIcon:null,modal:!0,onClick:null,onDrag:null,onDragEnd:null,onDragStart:null,onHide:null,onMaskClick:null,onMaximize:null,onResize:null,onResizeEnd:null,onResizeStart:null,onShow:null,position:"center",resizable:!0,rtl:!1,showHeader:!0,style:null,transitionOptions:null,visible:!1,children:void 0},css:{classes:{closeButtonIcon:"p-dialog-header-close-icon",closeButton:"p-dialog-header-icon p-dialog-header-close p-link",maximizableIcon:"p-dialog-header-maximize-icon",maximizableButton:"p-dialog-header-icon p-dialog-header-maximize p-link",header:function(e){return r("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return r("p-dialog-content",e.props.contentClassName)},footer:"p-dialog-footer",mask:function(e){var t=e.props,n=e.maskVisibleState,o=["center","left","right","top","top-left","top-right","bottom","bottom-left","bottom-right"].find((function(e){return e===t.position||e.replace("-","")===t.position}));return r("p-dialog-mask",o?"p-dialog-".concat(o):"",{"p-component-overlay p-component-overlay-enter":t.modal,"p-dialog-visible":n,"p-dialog-draggable":t.draggable,"p-dialog-resizable":t.resizable},t.maskClassName)},root:function(e){var t=e.props,n=e.maximized,o=e.context;return r("p-dialog p-component",t.className,{"p-dialog-rtl":t.rtl,"p-dialog-maximized":n,"p-dialog-default":!n,"p-input-filled":o&&"filled"===o.inputStyle||"filled"===c.inputStyle,"p-ripple-disabled":o&&!1===o.ripple||!1===c.ripple})},transition:"p-dialog"},styles:"\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n }\n \n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n \n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n \n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n \n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n } \n}\n",inlineStyles:{mask:function(e){var t=e.props;return Y({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",justifyContent:"left"===t.position||"top-left"===t.position||"bottom-left"===t.position?"flex-start":"right"===t.position||"top-right"===t.position||"bottom-right"===t.position?"flex-end":"center",alignItems:"top"===t.position||"top-left"===t.position||"top-right"===t.position?"flex-start":"bottom"===t.position||"bottom-left"===t.position||"bottom-right"===t.position?"flex-end":"center",pointerEvents:!t.modal&&"none"},t.maskStyle)}}}});function L(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?L(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=e.forwardRef((function(r,p){var z=e.useContext(u),I=_.getProps(r,z),j=I.id?I.id:o(),C=M(e.useState(j),2),R=C[0],N=M(e.useState(!1),2),B=N[0],T=N[1],X=M(e.useState(!1),2),H=X[0],Y=X[1],L=M(e.useState(I.maximized),2),F=L[0],J=L[1],U=e.useRef(null),Z=e.useRef(null),W=e.useRef(null),$=e.useRef(null),K=e.useRef(null),q=e.useRef(null),G=e.useRef(null),Q=e.useRef(!1),ee=e.useRef(!1),te=e.useRef(null),ne=e.useRef(null),re=e.useRef(null),oe=e.useRef(j),ie=e.useRef(null),ae=I.onMaximize?I.maximized:F,le=H&&(I.blockScroll||I.maximizable&&ae),ce=_.setMetaData(V(V({props:I},I.__parentMetadata),{},{state:{id:R,maximized:ae,containerVisible:B}})),ue=ce.ptm,se=ce.cx,pe=ce.sx;d(_.css.styles,ce.isUnstyled,{name:"dialog"}),A(Z,I.closable&&I.closeOnEscape,(function(e){var t=e.currentTarget;if(t&&t.primeDialogParams){var n=t.primeDialogParams,r=n.length;Pe(e),n.splice(r-1,1)}}));var de=M(g({type:"keydown",listener:function(e){return Ce(e)}}),2),me=de[0],ge=de[1],fe=M(g({type:"mousemove",target:function(){return window.document},listener:function(e){return Xe(e)}}),2),be=fe[0],ye=fe[1],he=M(g({type:"mouseup",target:function(){return window.document},listener:function(e){return Ae(e)}}),2),ve=he[0],xe=he[1],we=M(g({type:"mousemove",target:function(){return window.document},listener:function(e){return Ne(e)}}),2),Ee=we[0],Se=we[1],ze=M(g({type:"mouseup",target:function(){return window.document},listener:function(e){return Be(e)}}),2),ke=ze[0],Oe=ze[1],Pe=function(e){I.onHide(),e.preventDefault()},De=function(e){W.current=e.target,I.onPointerDown&&I.onPointerDown(e)},Ie=function(e){I.dismissableMask&&I.modal&&Z.current===e.target&&!W.current&&Pe(e),I.onMaskClick&&I.onMaskClick(e),W.current=null},je=function(e){I.onMaximize?I.onMaximize({originalEvent:e,maximized:!ae}):J((function(e){return!e})),e.preventDefault()},Ce=function(e){var n=e.currentTarget;if(n&&n.primeDialogParams){var r=n.primeDialogParams,o=r.length,i=r[o-1]?r[o-1].id:void 0;if(i===R){var a=document.getElementById(i);if("Tab"===e.key){e.preventDefault();var l=t.getFocusableElements(a);if(l&&l.length>0)if(document.activeElement){var c=l.indexOf(document.activeElement);e.shiftKey?-1===c||0===c?l[l.length-1].focus():l[c-1].focus():-1===c||c===l.length-1?l[0].focus():l[c+1].focus()}else l[0].focus()}}}},Re=function(e){t.hasClass(e.target,"p-dialog-header-icon")||t.hasClass(e.target.parentElement,"p-dialog-header-icon")||I.draggable&&(Q.current=!0,te.current=e.pageX,ne.current=e.pageY,U.current.style.margin="0",t.addClass(document.body,"p-unselectable-text"),I.onDragStart&&I.onDragStart(e))},Ne=function(e){if(Q.current){var n=t.getOuterWidth(U.current),r=t.getOuterHeight(U.current),o=e.pageX-te.current,i=e.pageY-ne.current,a=U.current.getBoundingClientRect(),l=a.left+o,c=a.top+i,u=t.getViewport(),s=getComputedStyle(U.current),p=parseFloat(s.marginLeft),d=parseFloat(s.marginTop);U.current.style.position="fixed",I.keepInViewport?(l>=I.minX&&l+n<u.width&&(te.current=e.pageX,U.current.style.left=l-p+"px"),c>=I.minY&&c+r<u.height&&(ne.current=e.pageY,U.current.style.top=c-d+"px")):(te.current=e.pageX,U.current.style.left=l-p+"px",ne.current=e.pageY,U.current.style.top=c-d+"px"),I.onDrag&&I.onDrag(e)}},Be=function(e){Q.current&&(Q.current=!1,t.removeClass(document.body,"p-unselectable-text"),I.onDragEnd&&I.onDragEnd(e))},Te=function(e){I.resizable&&(ee.current=!0,te.current=e.pageX,ne.current=e.pageY,t.addClass(document.body,"p-unselectable-text"),I.onResizeStart&&I.onResizeStart(e))},Me=function(e,n,r){!r&&(r=t.getViewport());var o=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?o*(r[n]/100):o},Xe=function(e){if(ee.current){var n=e.pageX-te.current,r=e.pageY-ne.current,o=t.getOuterWidth(U.current),i=t.getOuterHeight(U.current),a=U.current.getBoundingClientRect(),l=t.getViewport(),c=!parseInt(U.current.style.top)||!parseInt(U.current.style.left),u=Me(U.current.style.minWidth,"width",l),s=Me(U.current.style.minHeight,"height",l),p=o+n,d=i+r;c&&(p+=n,d+=r),(!u||p>u)&&a.left+p<l.width&&(U.current.style.width=p+"px"),(!s||d>s)&&a.top+d<l.height&&(U.current.style.height=d+"px"),te.current=e.pageX,ne.current=e.pageY,I.onResize&&I.onResize(e)}},Ae=function(e){ee.current&&(ee.current=!1,t.removeClass(document.body,"p-unselectable-text"),I.onResizeEnd&&I.onResizeEnd(e))},He=function(){U.current.style.position="",U.current.style.left="",U.current.style.top="",U.current.style.margin=""},Ye=function(){U.current.setAttribute(oe.current,"")},_e=function(){var e;I.onShow&&I.onShow(),I.focusOnShow&&!((e=document.activeElement)&&U.current&&U.current.contains(e))&&I.closable&&I.showHeader&&G.current.focus(),Fe()},Le=function(){I.modal&&t.addClass(Z.current,"p-component-overlay-leave")},Ve=function(){Q.current=!1,i.clear(Z.current),T(!1),Je(),t.focus(ie.current),ie.current=null},Fe=function(){Ze(),Ue(!0)},Je=function(){We(),Ue(!1)},Ue=function(e){if(e){var n={id:R,hasBlockScroll:le};document.primeDialogParams||(document.primeDialogParams=[]);var r=document.primeDialogParams.findIndex((function(e){return e.id===R}));document.primeDialogParams=-1===r?[].concat(k(o=document.primeDialogParams)||O(o)||P(o)||D(),[n]):document.primeDialogParams.toSpliced(r,1,n)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==R}));var o;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?t.blockBodyScroll():t.unblockBodyScroll()},Ze=function(){I.draggable&&(Ee(),ke()),I.resizable&&(be(),ve()),me()},We=function(){Se(),Oe(),ye(),xe(),ge()},$e=function(){re.current=t.createInlineStyle(z&&z.nonce||c.nonce);var e="";for(var n in I.breakpoints)e+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(oe.current,"] {\n width: ").concat(I.breakpoints[n]," !important;\n }\n }\n ");re.current.innerHTML=e};f((function(){I.visible&&T(!0),I.breakpoints&&$e()})),b((function(){I.visible&&!B&&T(!0),I.visible!==H&&B&&Y(I.visible),I.visible&&(ie.current=document.activeElement)}),[I.visible,B]),b((function(){B&&(i.set("modal",Z.current,z&&z.autoZIndex||c.autoZIndex,I.baseZIndex||z&&z.zIndex.modal||c.zIndex.modal),Y(!0))}),[B]),b((function(){Ue(!0)}),[le]),y((function(){Je(),t.removeInlineStyle(re.current),i.clear(Z.current)})),e.useImperativeHandle(p,(function(){return{props:I,resetPosition:He,getElement:function(){return U.current},getMask:function(){return Z.current},getContent:function(){return $.current},getHeader:function(){return K.current},getFooter:function(){return q.current},getCloseButton:function(){return G.current}}}));var Ke,qe,Ge,Qe,et,tt,nt,rt,ot,it,at,lt,ct=function(){if(I.closable){var t=I.ariaCloseIconLabel||s("close"),n=a({className:se("closeButtonIcon"),"aria-hidden":!0},ue("closeButtonIcon")),r=l.getJSXIcon(I.closeIcon||e.createElement(h,n),V({},n),{props:I}),o=a({ref:G,type:"button",className:se("closeButton"),"aria-label":t,onClick:Pe},ue("closeButton"));return e.createElement("button",o,r,e.createElement(E,null))}return null},ut=function(){var t=a({className:se("maximizableIcon")},ue("maximizableIcon")),n=l.getJSXIcon(ae?I.minimizeIcon||e.createElement(x,t):I.maximizeIcon||e.createElement(v,t),t,{props:I});if(I.maximizable){var r=a({type:"button",className:se("maximizableButton"),onClick:je},ue("maximizableButton"));return e.createElement("button",r,n,e.createElement(E,null))}return null},st=function(){if(I.showHeader){var t=ct(),r=ut(),o=n.getJSXElement(I.icons,I),i=n.getJSXElement(I.header,I),l=R+"_header",c=a({ref:K,style:I.headerStyle,className:se("header"),onMouseDown:Re},ue("header")),u=a({id:l,className:se("headerTitle")},ue("headerTitle")),s=a({className:se("headerIcons")},ue("headerIcons"));return e.createElement("div",c,e.createElement("div",u,i),e.createElement("div",s,o,r,t))}return null},pt=function(){var t=n.getJSXElement(I.footer,I),r=a({ref:q,className:se("footer")},ue("footer"));return t&&e.createElement("div",r,t)};return B&&(qe=st(),Ke=a({id:R+"_content",ref:$,style:I.contentStyle,className:se("content")},ue("content")),Ge=e.createElement("div",Ke,I.children),Qe=pt(),et=I.resizable?e.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Te}):null,tt=R+"_header",nt=R+"_content",rt={enter:"center"===I.position?150:300,exit:"center"===I.position?150:300},ot=a({ref:Z,style:pe("mask"),className:se("mask",{maskVisibleState:B}),onPointerUp:Ie},ue("mask")),it=a({ref:U,id:R,className:se("root",{props:I,maximized:ae,context:z}),style:I.style,onClick:I.onClick,role:"dialog","aria-labelledby":tt,"aria-describedby":nt,"aria-modal":I.modal,onPointerDown:De},_.getOtherProps(I),ue("root")),at=a({classNames:se("transition"),timeout:rt,in:H,options:I.transitionOptions,unmountOnExit:!0,onEnter:Ye,onEntered:_e,onExiting:Le,onExited:Ve},ue("transition")),lt=e.createElement("div",ot,e.createElement(m,S({nodeRef:U},at),e.createElement("div",it,qe,Ge,Qe,et))),e.createElement(w,{element:lt,appendTo:I.appendTo,visible:!0}))}));F.displayName="Dialog";export{F as Dialog};
|
|
1
|
+
import*as e from"react";import{DomHandler as t,ObjectUtils as n,classNames as r,UniqueComponentId as o,ZIndexUtils as i,mergeProps as a,IconUtils as l}from"primereact/utils";import c,{PrimeReactContext as u,localeOption as s}from"primereact/api";import{ComponentBase as p,useHandleStyle as d}from"primereact/componentbase";import{CSSTransition as m}from"primereact/csstransition";import{useEventListener as g,useMountEffect as f,useUpdateEffect as b,useUnmountEffect as y}from"primereact/hooks";import{TimesIcon as h}from"primereact/icons/times";import{WindowMaximizeIcon as v}from"primereact/icons/windowmaximize";import{WindowMinimizeIcon as x}from"primereact/icons/windowminimize";import{Portal as w}from"primereact/portal";import{Ripple as E}from"primereact/ripple";function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},S.apply(this,arguments)}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e){if(Array.isArray(e))return z(e)}function k(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function P(e,t){if(e){if("string"==typeof e)return z(e,t);var n=Object.prototype.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)?z(e,t):void 0}}function D(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}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 j(e,t){if("object"!==I(e)||null===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 C(e){var t=j(e,"string");return"symbol"===I(t)?t:String(t)}function R(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(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,i,a,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function T(){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 M(e,t){return N(e)||B(e,t)||P(e,t)||T()}var X=function(t){var n=e.useRef(void 0);return e.useEffect((function(){n.current=t})),n.current},A=function(r,o,i){var a,l,c,u,s,p,d,m,g,f,b,y,h,v,x,w=(u=void 0===(c=(a={type:"keydown",listener:function(e){"Esc"!==e.key&&"Escape"!==e.key||(e.stopImmediatePropagation(),i(e))}}).target)?"document":c,s=a.type,p=a.listener,d=a.options,g=void 0===(m=a.when)||m,f=e.useRef(null),b=e.useRef(null),y=X(p),h=X(d),v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.isNotEmpty(e.target)&&(x(),(e.when||g)&&(f.current=t.getTargetElement(e.target))),!b.current&&f.current&&(b.current=function(e){return p&&p(e)},f.current.addEventListener(s,b.current,d))},x=function(){b.current&&(f.current.removeEventListener(s,b.current,d),b.current=null)},e.useEffect((function(){g?f.current=t.getTargetElement(u):(x(),f.current=null)}),[u,g]),e.useEffect((function(){!b.current||""+y==""+p&&h===d||(x(),g&&v())}),[p,d,g]),l=function(){x()},e.useEffect((function(){return l}),[]),[v,x]),E=M(w,2),S=E[0],z=E[1];return e.useEffect((function(){if(o&&r.current)return S(),function(){z()}})),[r,i]};function H(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 Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var _=p.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,header:null,headerClassName:null,headerStyle:null,icons:null,id:null,keepInViewport:!0,maskClassName:null,maskStyle:null,maximizable:!1,maximizeIcon:null,maximized:!1,minX:0,minY:0,minimizeIcon:null,modal:!0,onClick:null,onDrag:null,onDragEnd:null,onDragStart:null,onHide:null,onMaskClick:null,onMaximize:null,onResize:null,onResizeEnd:null,onResizeStart:null,onShow:null,position:"center",resizable:!0,rtl:!1,showHeader:!0,style:null,transitionOptions:null,visible:!1,children:void 0},css:{classes:{closeButtonIcon:"p-dialog-header-close-icon",closeButton:"p-dialog-header-icon p-dialog-header-close p-link",maximizableIcon:"p-dialog-header-maximize-icon",maximizableButton:"p-dialog-header-icon p-dialog-header-maximize p-link",header:function(e){return r("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return r("p-dialog-content",e.props.contentClassName)},footer:"p-dialog-footer",mask:function(e){var t=e.props,n=e.maskVisibleState,o=["center","left","right","top","top-left","top-right","bottom","bottom-left","bottom-right"].find((function(e){return e===t.position||e.replace("-","")===t.position}));return r("p-dialog-mask",o?"p-dialog-".concat(o):"",{"p-component-overlay p-component-overlay-enter":t.modal,"p-dialog-visible":n,"p-dialog-draggable":t.draggable,"p-dialog-resizable":t.resizable},t.maskClassName)},root:function(e){var t=e.props,n=e.maximized,o=e.context;return r("p-dialog p-component",t.className,{"p-dialog-rtl":t.rtl,"p-dialog-maximized":n,"p-dialog-default":!n,"p-input-filled":o&&"filled"===o.inputStyle||"filled"===c.inputStyle,"p-ripple-disabled":o&&!1===o.ripple||!1===c.ripple})},transition:"p-dialog"},styles:"\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n \n .p-dialog-visible {\n display: flex;\n }\n \n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n \n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n \n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n \n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n \n .p-dialog-footer {\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n \n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n \n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n \n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n \n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n \n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-dialog-enter-done {\n transform: none;\n }\n \n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n \n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n \n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n \n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n \n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n \n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n \n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n \n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n \n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px;\n left: 0px;\n }\n \n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n \n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n \n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n \n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n } \n}\n",inlineStyles:{mask:function(e){var t=e.props;return Y({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",justifyContent:"left"===t.position||"top-left"===t.position||"bottom-left"===t.position?"flex-start":"right"===t.position||"top-right"===t.position||"bottom-right"===t.position?"flex-end":"center",alignItems:"top"===t.position||"top-left"===t.position||"top-right"===t.position?"flex-start":"bottom"===t.position||"bottom-left"===t.position||"bottom-right"===t.position?"flex-end":"center",pointerEvents:!t.modal&&"none"},t.maskStyle)}}}});function L(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?L(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=e.forwardRef((function(r,p){var z=e.useContext(u),I=_.getProps(r,z),j=I.id?I.id:o(),C=M(e.useState(j),2),R=C[0],N=M(e.useState(!1),2),B=N[0],T=N[1],X=M(e.useState(!1),2),H=X[0],Y=X[1],L=M(e.useState(I.maximized),2),F=L[0],J=L[1],U=e.useRef(null),Z=e.useRef(null),W=e.useRef(null),$=e.useRef(null),K=e.useRef(null),q=e.useRef(null),G=e.useRef(null),Q=e.useRef(!1),ee=e.useRef(!1),te=e.useRef(null),ne=e.useRef(null),re=e.useRef(null),oe=e.useRef(j),ie=e.useRef(null),ae=I.onMaximize?I.maximized:F,le=H&&(I.blockScroll||I.maximizable&&ae),ce=_.setMetaData(V(V({props:I},I.__parentMetadata),{},{state:{id:R,maximized:ae,containerVisible:B}})),ue=ce.ptm,se=ce.cx,pe=ce.sx;d(_.css.styles,ce.isUnstyled,{name:"dialog"}),A(Z,I.closable&&I.closeOnEscape,(function(e){var t=e.currentTarget;if(t&&t.primeDialogParams){var n=t.primeDialogParams,r=n.length;Pe(e),n.splice(r-1,1)}}));var de=M(g({type:"keydown",listener:function(e){return Ce(e)}}),2),me=de[0],ge=de[1],fe=M(g({type:"mousemove",target:function(){return window.document},listener:function(e){return Xe(e)}}),2),be=fe[0],ye=fe[1],he=M(g({type:"mouseup",target:function(){return window.document},listener:function(e){return Ae(e)}}),2),ve=he[0],xe=he[1],we=M(g({type:"mousemove",target:function(){return window.document},listener:function(e){return Ne(e)}}),2),Ee=we[0],Se=we[1],ze=M(g({type:"mouseup",target:function(){return window.document},listener:function(e){return Be(e)}}),2),Oe=ze[0],ke=ze[1],Pe=function(e){I.onHide(),e.preventDefault()},De=function(e){W.current=e.target,I.onPointerDown&&I.onPointerDown(e)},Ie=function(e){I.dismissableMask&&I.modal&&Z.current===e.target&&!W.current&&Pe(e),I.onMaskClick&&I.onMaskClick(e),W.current=null},je=function(e){I.onMaximize?I.onMaximize({originalEvent:e,maximized:!ae}):J((function(e){return!e})),e.preventDefault()},Ce=function(e){var n=e.currentTarget;if(n&&n.primeDialogParams){var r=n.primeDialogParams,o=r.length,i=r[o-1]?r[o-1].id:void 0;if(i===R){var a=document.getElementById(i);if("Tab"===e.key){e.preventDefault();var l=t.getFocusableElements(a);if(l&&l.length>0)if(document.activeElement){var c=l.indexOf(document.activeElement);e.shiftKey?-1===c||0===c?l[l.length-1].focus():l[c-1].focus():-1===c||c===l.length-1?l[0].focus():l[c+1].focus()}else l[0].focus()}}}},Re=function(e){t.hasClass(e.target,"p-dialog-header-icon")||t.hasClass(e.target.parentElement,"p-dialog-header-icon")||I.draggable&&(Q.current=!0,te.current=e.pageX,ne.current=e.pageY,U.current.style.margin="0",t.addClass(document.body,"p-unselectable-text"),I.onDragStart&&I.onDragStart(e))},Ne=function(e){if(Q.current){var n=t.getOuterWidth(U.current),r=t.getOuterHeight(U.current),o=e.pageX-te.current,i=e.pageY-ne.current,a=U.current.getBoundingClientRect(),l=a.left+o,c=a.top+i,u=t.getViewport(),s=getComputedStyle(U.current),p=parseFloat(s.marginLeft),d=parseFloat(s.marginTop);U.current.style.position="fixed",I.keepInViewport?(l>=I.minX&&l+n<u.width&&(te.current=e.pageX,U.current.style.left=l-p+"px"),c>=I.minY&&c+r<u.height&&(ne.current=e.pageY,U.current.style.top=c-d+"px")):(te.current=e.pageX,U.current.style.left=l-p+"px",ne.current=e.pageY,U.current.style.top=c-d+"px"),I.onDrag&&I.onDrag(e)}},Be=function(e){Q.current&&(Q.current=!1,t.removeClass(document.body,"p-unselectable-text"),I.onDragEnd&&I.onDragEnd(e))},Te=function(e){I.resizable&&(ee.current=!0,te.current=e.pageX,ne.current=e.pageY,t.addClass(document.body,"p-unselectable-text"),I.onResizeStart&&I.onResizeStart(e))},Me=function(e,n,r){!r&&(r=t.getViewport());var o=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?o*(r[n]/100):o},Xe=function(e){if(ee.current){var n=e.pageX-te.current,r=e.pageY-ne.current,o=t.getOuterWidth(U.current),i=t.getOuterHeight(U.current),a=U.current.getBoundingClientRect(),l=t.getViewport(),c=!parseInt(U.current.style.top)||!parseInt(U.current.style.left),u=Me(U.current.style.minWidth,"width",l),s=Me(U.current.style.minHeight,"height",l),p=o+n,d=i+r;c&&(p+=n,d+=r),(!u||p>u)&&a.left+p<l.width&&(U.current.style.width=p+"px"),(!s||d>s)&&a.top+d<l.height&&(U.current.style.height=d+"px"),te.current=e.pageX,ne.current=e.pageY,I.onResize&&I.onResize(e)}},Ae=function(e){ee.current&&(ee.current=!1,t.removeClass(document.body,"p-unselectable-text"),I.onResizeEnd&&I.onResizeEnd(e))},He=function(){U.current.style.position="",U.current.style.left="",U.current.style.top="",U.current.style.margin=""},Ye=function(){U.current.setAttribute(oe.current,"")},_e=function(){var e;I.onShow&&I.onShow(),I.focusOnShow&&!((e=document.activeElement)&&U.current&&U.current.contains(e))&&I.closable&&I.showHeader&&G.current.focus(),Fe()},Le=function(){I.modal&&t.addClass(Z.current,"p-component-overlay-leave")},Ve=function(){Q.current=!1,i.clear(Z.current),T(!1),Je(),t.focus(ie.current),ie.current=null},Fe=function(){Ze(),Ue(!0)},Je=function(){We(),Ue(!1)},Ue=function(e){if(e){var n={id:R,hasBlockScroll:le};document.primeDialogParams||(document.primeDialogParams=[]);var r=document.primeDialogParams.findIndex((function(e){return e.id===R}));document.primeDialogParams=-1===r?[].concat(O(o=document.primeDialogParams)||k(o)||P(o)||D(),[n]):document.primeDialogParams.toSpliced(r,1,n)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==R}));var o;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?t.blockBodyScroll():t.unblockBodyScroll()},Ze=function(){I.draggable&&(Ee(),Oe()),I.resizable&&(be(),ve()),me()},We=function(){Se(),ke(),ye(),xe(),ge()},$e=function(){re.current=t.createInlineStyle(z&&z.nonce||c.nonce);var e="";for(var n in I.breakpoints)e+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(oe.current,"] {\n width: ").concat(I.breakpoints[n],";\n }\n }\n ");re.current.innerHTML=e};f((function(){I.visible&&T(!0),I.breakpoints&&$e()})),b((function(){I.visible&&!B&&T(!0),I.visible!==H&&B&&Y(I.visible),I.visible&&(ie.current=document.activeElement)}),[I.visible,B]),b((function(){B&&(i.set("modal",Z.current,z&&z.autoZIndex||c.autoZIndex,I.baseZIndex||z&&z.zIndex.modal||c.zIndex.modal),Y(!0))}),[B]),b((function(){Ue(!0)}),[le]),y((function(){Je(),t.removeInlineStyle(re.current),i.clear(Z.current)})),e.useImperativeHandle(p,(function(){return{props:I,resetPosition:He,getElement:function(){return U.current},getMask:function(){return Z.current},getContent:function(){return $.current},getHeader:function(){return K.current},getFooter:function(){return q.current},getCloseButton:function(){return G.current}}}));var Ke,qe,Ge,Qe,et,tt,nt,rt,ot,it,at,lt,ct=function(){if(I.closable){var t=I.ariaCloseIconLabel||s("close"),n=a({className:se("closeButtonIcon"),"aria-hidden":!0},ue("closeButtonIcon")),r=l.getJSXIcon(I.closeIcon||e.createElement(h,n),V({},n),{props:I}),o=a({ref:G,type:"button",className:se("closeButton"),"aria-label":t,onClick:Pe},ue("closeButton"));return e.createElement("button",o,r,e.createElement(E,null))}return null},ut=function(){var t=a({className:se("maximizableIcon")},ue("maximizableIcon")),n=l.getJSXIcon(ae?I.minimizeIcon||e.createElement(x,t):I.maximizeIcon||e.createElement(v,t),t,{props:I});if(I.maximizable){var r=a({type:"button",className:se("maximizableButton"),onClick:je},ue("maximizableButton"));return e.createElement("button",r,n,e.createElement(E,null))}return null},st=function(){if(I.showHeader){var t=ct(),r=ut(),o=n.getJSXElement(I.icons,I),i=n.getJSXElement(I.header,I),l=R+"_header",c=a({ref:K,style:I.headerStyle,className:se("header"),onMouseDown:Re},ue("header")),u=a({id:l,className:se("headerTitle")},ue("headerTitle")),s=a({className:se("headerIcons")},ue("headerIcons"));return e.createElement("div",c,e.createElement("div",u,i),e.createElement("div",s,o,r,t))}return null},pt=function(){var t=n.getJSXElement(I.footer,I),r=a({ref:q,className:se("footer")},ue("footer"));return t&&e.createElement("div",r,t)};return B&&(qe=st(),Ke=a({id:R+"_content",ref:$,style:I.contentStyle,className:se("content")},ue("content")),Ge=e.createElement("div",Ke,I.children),Qe=pt(),et=I.resizable?e.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Te}):null,tt=R+"_header",nt=R+"_content",rt={enter:"center"===I.position?150:300,exit:"center"===I.position?150:300},ot=a({ref:Z,style:pe("mask"),className:se("mask"),onPointerUp:Ie},ue("mask")),it=a({ref:U,id:R,className:se("root",{props:I,maximized:ae,context:z}),style:I.style,onClick:I.onClick,role:"dialog","aria-labelledby":tt,"aria-describedby":nt,"aria-modal":I.modal,onPointerDown:De},_.getOtherProps(I),ue("root")),at=a({classNames:se("transition"),timeout:rt,in:H,options:I.transitionOptions,unmountOnExit:!0,onEnter:Ye,onEntered:_e,onExiting:Le,onExited:Ve},ue("transition")),lt=e.createElement("div",ot,e.createElement(m,S({nodeRef:U},at),e.createElement("div",it,qe,Ge,Qe,et))),e.createElement(w,{element:lt,appendTo:I.appendTo,visible:!0}))}));F.displayName="Dialog";export{F as Dialog};
|