primereact 10.9.1 → 10.9.3
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 +2 -1
- package/api/api.cjs.min.js +1 -1
- package/api/api.d.ts +5 -1
- package/api/api.esm.js +2 -1
- package/api/api.esm.min.js +1 -1
- package/api/api.js +2 -1
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +25 -4
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.d.ts +2 -2
- package/autocomplete/autocomplete.esm.js +25 -4
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +25 -4
- package/autocomplete/autocomplete.min.js +1 -1
- package/breadcrumb/breadcrumb.cjs.js +1 -1
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +1 -1
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +1 -1
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/buttongroup/buttongroup.cjs.js +4 -1
- package/buttongroup/buttongroup.cjs.min.js +1 -1
- package/buttongroup/buttongroup.esm.js +4 -1
- package/buttongroup/buttongroup.esm.min.js +1 -1
- package/buttongroup/buttongroup.js +4 -1
- package/buttongroup/buttongroup.min.js +1 -1
- package/calendar/calendar.cjs.js +41 -21
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.d.ts +16 -62
- package/calendar/calendar.esm.js +41 -21
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +41 -21
- package/calendar/calendar.min.js +1 -1
- package/carousel/carousel.cjs.js +1 -1
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +1 -1
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +1 -1
- package/carousel/carousel.min.js +1 -1
- package/chip/chip.cjs.js +11 -2
- package/chip/chip.cjs.min.js +1 -1
- package/chip/chip.d.ts +13 -2
- package/chip/chip.esm.js +11 -2
- package/chip/chip.esm.min.js +1 -1
- package/chip/chip.js +11 -2
- package/chip/chip.min.js +1 -1
- package/componentbase/componentbase.cjs.js +15 -6
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.js +15 -6
- package/componentbase/componentbase.esm.min.js +1 -1
- package/componentbase/componentbase.js +15 -6
- package/componentbase/componentbase.min.js +1 -1
- package/confirmdialog/confirmdialog.cjs.js +4 -3
- package/confirmdialog/confirmdialog.cjs.min.js +1 -1
- package/confirmdialog/confirmdialog.esm.js +4 -3
- package/confirmdialog/confirmdialog.esm.min.js +1 -1
- package/confirmdialog/confirmdialog.js +4 -3
- package/confirmdialog/confirmdialog.min.js +1 -1
- package/contextmenu/contextmenu.cjs.js +0 -1
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +0 -1
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +0 -1
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +167 -92
- package/core/core.min.js +10 -10
- package/datascroller/datascroller.cjs.js +2 -0
- package/datascroller/datascroller.cjs.min.js +1 -1
- package/datascroller/datascroller.esm.js +2 -0
- package/datascroller/datascroller.esm.min.js +1 -1
- package/datascroller/datascroller.js +2 -0
- package/datascroller/datascroller.min.js +1 -1
- package/datatable/datatable.cjs.js +85 -58
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +85 -58
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +85 -58
- package/datatable/datatable.min.js +1 -1
- package/dataview/dataview.cjs.js +7 -3
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +7 -3
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +8 -4
- package/dataview/dataview.min.js +1 -1
- package/dialog/dialog.cjs.js +0 -1
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +0 -1
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +0 -1
- package/dialog/dialog.min.js +1 -1
- package/divider/divider.cjs.js +2 -2
- package/divider/divider.cjs.min.js +1 -1
- package/divider/divider.esm.js +2 -2
- package/divider/divider.esm.min.js +1 -1
- package/divider/divider.js +2 -2
- package/divider/divider.min.js +1 -1
- package/dock/dock.cjs.js +0 -1
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.esm.js +0 -1
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +0 -1
- package/dock/dock.min.js +1 -1
- package/dropdown/dropdown.cjs.js +36 -30
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.d.ts +5 -0
- package/dropdown/dropdown.esm.js +38 -32
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +36 -30
- package/dropdown/dropdown.min.js +1 -1
- package/fileupload/fileupload.cjs.js +2 -1
- package/fileupload/fileupload.cjs.min.js +1 -1
- package/fileupload/fileupload.d.ts +4 -0
- package/fileupload/fileupload.esm.js +2 -1
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +2 -1
- package/fileupload/fileupload.min.js +1 -1
- package/galleria/galleria.cjs.js +1 -1
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +1 -1
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +1 -1
- package/galleria/galleria.min.js +1 -1
- package/hooks/hooks.d.ts +3 -2
- package/inputmask/inputmask.cjs.js +4 -2
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.esm.js +4 -2
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +4 -2
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +7 -1
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +7 -1
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +7 -1
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputtext/inputtext.d.ts +1 -1
- package/inputtextarea/inputtextarea.cjs.js +1 -1
- package/inputtextarea/inputtextarea.cjs.min.js +1 -1
- package/inputtextarea/inputtextarea.esm.js +1 -1
- package/inputtextarea/inputtextarea.esm.min.js +1 -1
- package/inputtextarea/inputtextarea.js +1 -1
- package/inputtextarea/inputtextarea.min.js +1 -1
- package/megamenu/megamenu.cjs.js +5 -10
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +5 -10
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +5 -10
- package/megamenu/megamenu.min.js +1 -1
- package/mention/mention.cjs.js +1 -1
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.esm.js +1 -1
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +1 -1
- package/mention/mention.min.js +1 -1
- package/menu/menu.cjs.js +6 -1
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +6 -1
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +6 -1
- package/menu/menu.min.js +1 -1
- package/menubar/menubar.cjs.js +2 -3
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +2 -3
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +2 -3
- package/menubar/menubar.min.js +1 -1
- package/multiselect/multiselect.cjs.js +29 -29
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +6 -1
- package/multiselect/multiselect.esm.js +30 -30
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +29 -29
- package/multiselect/multiselect.min.js +1 -1
- package/orderlist/orderlist.cjs.js +24 -23
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +24 -23
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +24 -23
- package/orderlist/orderlist.min.js +1 -1
- package/package.json +1 -1
- package/paginator/paginator.cjs.js +3 -2
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +3 -2
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +3 -2
- package/paginator/paginator.min.js +1 -1
- package/panelmenu/panelmenu.cjs.js +1 -2
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +1 -2
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +1 -2
- package/panelmenu/panelmenu.min.js +1 -1
- package/passthrough/tailwind/index.cjs.js +1 -1
- package/passthrough/tailwind/index.cjs.min.js +1 -1
- package/passthrough/tailwind/index.esm.js +1 -1
- package/passthrough/tailwind/index.esm.min.js +1 -1
- package/passthrough/tailwind/index.js +1 -1
- package/passthrough/tailwind/index.min.js +1 -1
- package/picklist/picklist.cjs.js +22 -8
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +22 -8
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +22 -8
- package/picklist/picklist.min.js +1 -1
- package/primereact.all.cjs.js +684 -489
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +684 -489
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +684 -489
- package/primereact.all.min.js +1 -1
- package/sidebar/sidebar.cjs.js +1 -1
- package/sidebar/sidebar.cjs.min.js +1 -1
- package/sidebar/sidebar.esm.js +1 -1
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +1 -1
- package/sidebar/sidebar.min.js +1 -1
- package/speeddial/speeddial.cjs.js +1 -1
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.esm.js +1 -1
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +1 -1
- package/speeddial/speeddial.min.js +1 -1
- package/splitbutton/splitbutton.cjs.js +0 -1
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.esm.js +0 -1
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +0 -1
- package/splitbutton/splitbutton.min.js +1 -1
- package/stepper/stepper.d.ts +27 -13
- package/tabview/tabview.cjs.js +1 -1
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.esm.js +1 -1
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +1 -1
- package/tabview/tabview.min.js +1 -1
- package/tieredmenu/tieredmenu.cjs.js +0 -1
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +0 -1
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +0 -1
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/togglebutton/togglebutton.cjs.js +2 -2
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.esm.js +2 -2
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +2 -2
- package/togglebutton/togglebutton.min.js +1 -1
- package/tooltip/tooltip.cjs.js +7 -1
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +7 -1
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +7 -1
- package/tooltip/tooltip.min.js +1 -1
- package/tree/tree.cjs.js +40 -38
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.d.ts +11 -1
- package/tree/tree.esm.js +41 -39
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +41 -39
- package/tree/tree.min.js +1 -1
- package/treeselect/treeselect.cjs.js +12 -13
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.d.ts +6 -1
- package/treeselect/treeselect.esm.js +13 -14
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +12 -13
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +264 -254
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +265 -255
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +265 -255
- package/treetable/treetable.min.js +1 -1
- package/utils/utils.cjs.js +53 -8
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +53 -8
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +53 -8
- package/utils/utils.min.js +1 -1
- package/virtualscroller/virtualscroller.cjs.js +3 -3
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +3 -3
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +3 -3
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +1001 -47
package/dataview/dataview.cjs.js
CHANGED
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var PrimeReact = require('primereact/api');
|
|
8
8
|
var componentbase = require('primereact/componentbase');
|
|
9
|
+
var hooks = require('primereact/hooks');
|
|
9
10
|
var bars = require('primereact/icons/bars');
|
|
10
11
|
var spinner = require('primereact/icons/spinner');
|
|
11
12
|
var thlarge = require('primereact/icons/thlarge');
|
|
12
13
|
var paginator = require('primereact/paginator');
|
|
13
14
|
var ripple = require('primereact/ripple');
|
|
14
15
|
var utils = require('primereact/utils');
|
|
15
|
-
var hooks = require('primereact/hooks');
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
18
|
|
|
@@ -361,7 +361,7 @@ var DataView = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__namespace.
|
|
|
361
361
|
rightContent: props.paginatorRight,
|
|
362
362
|
alwaysShow: props.alwaysShowPaginator,
|
|
363
363
|
dropdownAppendTo: props.paginatorDropdownAppendTo,
|
|
364
|
-
|
|
364
|
+
pt: ptm('paginator'),
|
|
365
365
|
unstyled: props.unstyled,
|
|
366
366
|
__parentMetadata: {
|
|
367
367
|
parent: metaData
|
|
@@ -491,7 +491,11 @@ var DataView = /*#__PURE__*/React__namespace.memo(/*#__PURE__*/React__namespace.
|
|
|
491
491
|
var content = null;
|
|
492
492
|
if (props.listTemplate) {
|
|
493
493
|
var items = getItems(value);
|
|
494
|
-
|
|
494
|
+
if (utils.ObjectUtils.isNotEmpty(items)) {
|
|
495
|
+
content = utils.ObjectUtils.getJSXElement(props.listTemplate, items, props.layout);
|
|
496
|
+
} else {
|
|
497
|
+
content = createEmptyMessage();
|
|
498
|
+
}
|
|
495
499
|
} else {
|
|
496
500
|
var _items = createItems(value);
|
|
497
501
|
var gridProps = mergeProps({
|
|
@@ -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"),a=require("primereact/icons/spinner"),o=require("primereact/icons/thlarge"),i=require("primereact/paginator"),l=require("primereact/ripple"),u=require("primereact/utils"),s=require("primereact/hooks");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 f=p(e),m=c(t);function d(){return d=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},d.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 y(e){if(Array.isArray(e))return g(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 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 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 h(e){if(Array.isArray(e))return e}function P(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,l=[],u=!0,s=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){s=!0,a=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw a}}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)||P(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=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,listTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"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"}}),T=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 p-component p-dataview-layout-options p-selectbutton p-button-group",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,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}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 o,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,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw o}}}}function C(e,t){if(e){if("string"==typeof e)return x(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)?x(e,t):void 0}}function x(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 M(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?M(Object(r),!0).forEach((function(t){I(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var L=f.memo((function(e){var r=s.useMergeProps(),a=f.useContext(t.PrimeReactContext),i=T.getProps(e,a),c=T.setMetaData({props:i}),p=c.ptm,m=c.cx,d=function(e,t){i.onChange({originalEvent:e,value:t}),e.preventDefault()},g=r(p("list")),y=r(p("grid")),v=u.IconUtils.getJSXIcon(i.listIcon||f.createElement(n.BarsIcon,g),R({},g),{props:i}),b=u.IconUtils.getJSXIcon(i.gridIcon||f.createElement(o.ThLargeIcon,y),R({},y),{props:i}),w=r({id:i.id,style:i.style,className:u.classNames(i.className,m("root"))},T.getOtherProps(i),p("root")),h=r({type:"button",className:m("listButton"),onClick:function(e){return d(e,"list")}},p("listButton")),P=r({type:"button",className:m("gridButton"),onClick:function(e){return d(e,"grid")}},p("gridButton"));return f.createElement("div",w,f.createElement("button",h,v,f.createElement(l.Ripple,null)),f.createElement("button",P,b,f.createElement(l.Ripple,null)))})),k=f.memo((function(e){return e.template(e.item,e.layout)})),U=f.memo(f.forwardRef((function(e,n){var o=s.useMergeProps(),l=f.useContext(t.PrimeReactContext),c=D.getProps(e,l),p=j(f.useState(c.first),2),g=p[0],h=p[1],P=j(f.useState(c.rows),2),O=P[0],S=P[1],N={props:c,state:{first:g,rows:O}},E=D.setMetaData(N),I=E.ptm,T=E.cx;r.useHandleStyle(D.css.styles,E.isUnstyled,{name:"dataview"});var C=f.useRef(null),x=c.onPage?c.first:g,M=c.onPage?c.rows:O,L=function(e){return c.dataKey?u.ObjectUtils.resolveFieldData(e,c.dataKey):null},U=function(){return c.totalRecords?c.totalRecords:c.value?c.value.length:0},q=function(e){var t=u.classNames("p-paginator-"+e,c.paginatorClassName),r=U();return f.createElement(i.Paginator,{first:x,rows:M,pageLinkSize:c.pageLinkSize,className:t,onPageChange:_,template:c.paginatorTemplate,totalRecords:r,rowsPerPageOptions:c.rowsPerPageOptions,currentPageReportTemplate:c.currentPageReportTemplate,leftContent:c.paginatorLeft,rightContent:c.paginatorRight,alwaysShow:c.alwaysShowPaginator,dropdownAppendTo:c.paginatorDropdownAppendTo,ptm:I("paginator"),unstyled:c.unstyled,__parentMetadata:{parent:N}})},_=function(e){c.onPage?c.onPage(e):(h(e.first),S(e.rows))},B=function(e){if(c.paginator){var t=c.lazy?0:x,r=U(),n=Math.min(M+t,r);return e.slice(t,n)||[]}return e},V=function(){if(c.value){var e,t=new Map,r=u.ObjectUtils.localeComparator(l&&l.locale||m.default.locale),n=y(i=c.value)||v(i)||b(i)||w(),a=A(n);try{for(a.s();!(e=a.n()).done;){var o=e.value;t.set(o,u.ObjectUtils.resolveFieldData(o,c.sortField))}}catch(e){a.e(e)}finally{a.f()}return n.sort((function(e,n){var a=t.get(e),o=t.get(n);return u.ObjectUtils.sort(a,o,c.sortOrder,r,l&&l.nullSortOrder||m.default.nullSortOrder)})),n}var i;return null},z=function(){if(!c.loading){var e=c.emptyMessage||t.localeOption("emptyMessage"),r=o({className:T("emptyMessage")},I("emptyMessage"));return f.createElement("div",r,e)}return null},F=function(e){return u.ObjectUtils.isNotEmpty(e)?B(e).map((function(e,t){return f.createElement(k,{key:L(e)||t,template:c.itemTemplate,layout:c.layout,item:e})})):z()};f.useImperativeHandle(n,(function(){return{props:c,getElement:function(){return C.current}}}));var J=function(){var e=c.value;return u.ObjectUtils.isNotEmpty(e)&&c.sortField&&(e=V()),e}(),X=function(){if(c.loading){var e=o({className:T("loadingIcon")},I("loadingIcon")),t=c.loadingIcon||f.createElement(a.SpinnerIcon,d({},e,{spin:!0})),r=u.IconUtils.getJSXIcon(t,R({},e),{props:c}),n=o({className:T("loadingOverlay")},I("loadingOverlay"));return f.createElement("div",n,r)}return null}(),K=!c.paginator||"bottom"===c.paginatorPosition&&"both"!==c.paginatorPosition?null:q("top"),H=!c.paginator||"top"===c.paginatorPosition&&"both"!==c.paginatorPosition?null:q("bottom"),Y=function(){if(c.header){var e=o({className:T("header")},I("header"));return f.createElement("div",e,c.header)}return null}(),$=function(){if(c.footer){var e=o({className:T("footer")},I("footer"));return f.createElement("div",e,c.footer)}return null}(),G=function(e){var t=o({className:T("content")},I("content")),r=null;if(c.listTemplate){var n=B(e);r=u.ObjectUtils.getJSXElement(c.listTemplate,n,c.layout)}else{var a=F(e),i=o({className:T("grid")},I("grid"));r=f.createElement("div",i,a)}return f.createElement("div",t,r)}(J),Q=o({id:c.id,ref:C,style:c.style,className:u.classNames(c.className,T("root"))},D.getOtherProps(c),I("root"));return f.createElement("div",Q,X,Y,K,G,H,$)})));L.displayName="DataViewLayoutOptions",k.displayName="DataViewItem",U.displayName="DataView",exports.DataView=U,exports.DataViewItem=k,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/hooks"),a=require("primereact/icons/bars"),o=require("primereact/icons/spinner"),i=require("primereact/icons/thlarge"),l=require("primereact/paginator"),u=require("primereact/ripple"),s=require("primereact/utils");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 f=p(e),m=c(t);function d(){return d=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},d.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 y(e){if(Array.isArray(e))return g(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 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 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 h(e){if(Array.isArray(e))return e}function P(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,l=[],u=!0,s=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){s=!0,a=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw a}}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)||P(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=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,listTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(e){return s.classNames("p-grid grid",{"p-nogutter grid-nogutter":!e.props.gutter})},root:function(e){var t=e.props;return s.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"}}),T=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 p-component p-dataview-layout-options p-selectbutton p-button-group",listButton:function(e){return s.classNames("p-button p-button-icon-only",{"p-highlight":"list"===e.props.layout})},gridButton:function(e){return s.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,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}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 o,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,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw o}}}}function C(e,t){if(e){if("string"==typeof e)return x(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)?x(e,t):void 0}}function x(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 M(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?M(Object(r),!0).forEach((function(t){I(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var L=f.memo((function(e){var r=n.useMergeProps(),o=f.useContext(t.PrimeReactContext),l=T.getProps(e,o),c=T.setMetaData({props:l}),p=c.ptm,m=c.cx,d=function(e,t){l.onChange({originalEvent:e,value:t}),e.preventDefault()},g=r(p("list")),y=r(p("grid")),v=s.IconUtils.getJSXIcon(l.listIcon||f.createElement(a.BarsIcon,g),R({},g),{props:l}),b=s.IconUtils.getJSXIcon(l.gridIcon||f.createElement(i.ThLargeIcon,y),R({},y),{props:l}),w=r({id:l.id,style:l.style,className:s.classNames(l.className,m("root"))},T.getOtherProps(l),p("root")),h=r({type:"button",className:m("listButton"),onClick:function(e){return d(e,"list")}},p("listButton")),P=r({type:"button",className:m("gridButton"),onClick:function(e){return d(e,"grid")}},p("gridButton"));return f.createElement("div",w,f.createElement("button",h,v,f.createElement(u.Ripple,null)),f.createElement("button",P,b,f.createElement(u.Ripple,null)))})),k=f.memo((function(e){return e.template(e.item,e.layout)})),U=f.memo(f.forwardRef((function(e,a){var i=n.useMergeProps(),u=f.useContext(t.PrimeReactContext),c=D.getProps(e,u),p=j(f.useState(c.first),2),g=p[0],h=p[1],P=j(f.useState(c.rows),2),O=P[0],S=P[1],N={props:c,state:{first:g,rows:O}},E=D.setMetaData(N),I=E.ptm,T=E.cx;r.useHandleStyle(D.css.styles,E.isUnstyled,{name:"dataview"});var C=f.useRef(null),x=c.onPage?c.first:g,M=c.onPage?c.rows:O,L=function(e){return c.dataKey?s.ObjectUtils.resolveFieldData(e,c.dataKey):null},U=function(){return c.totalRecords?c.totalRecords:c.value?c.value.length:0},q=function(e){var t=s.classNames("p-paginator-"+e,c.paginatorClassName),r=U();return f.createElement(l.Paginator,{first:x,rows:M,pageLinkSize:c.pageLinkSize,className:t,onPageChange:_,template:c.paginatorTemplate,totalRecords:r,rowsPerPageOptions:c.rowsPerPageOptions,currentPageReportTemplate:c.currentPageReportTemplate,leftContent:c.paginatorLeft,rightContent:c.paginatorRight,alwaysShow:c.alwaysShowPaginator,dropdownAppendTo:c.paginatorDropdownAppendTo,pt:I("paginator"),unstyled:c.unstyled,__parentMetadata:{parent:N}})},_=function(e){c.onPage?c.onPage(e):(h(e.first),S(e.rows))},B=function(e){if(c.paginator){var t=c.lazy?0:x,r=U(),n=Math.min(M+t,r);return e.slice(t,n)||[]}return e},V=function(){if(c.value){var e,t=new Map,r=s.ObjectUtils.localeComparator(u&&u.locale||m.default.locale),n=y(i=c.value)||v(i)||b(i)||w(),a=A(n);try{for(a.s();!(e=a.n()).done;){var o=e.value;t.set(o,s.ObjectUtils.resolveFieldData(o,c.sortField))}}catch(e){a.e(e)}finally{a.f()}return n.sort((function(e,n){var a=t.get(e),o=t.get(n);return s.ObjectUtils.sort(a,o,c.sortOrder,r,u&&u.nullSortOrder||m.default.nullSortOrder)})),n}var i;return null},z=function(){if(!c.loading){var e=c.emptyMessage||t.localeOption("emptyMessage"),r=i({className:T("emptyMessage")},I("emptyMessage"));return f.createElement("div",r,e)}return null},F=function(e){return s.ObjectUtils.isNotEmpty(e)?B(e).map((function(e,t){return f.createElement(k,{key:L(e)||t,template:c.itemTemplate,layout:c.layout,item:e})})):z()};f.useImperativeHandle(a,(function(){return{props:c,getElement:function(){return C.current}}}));var J=function(){var e=c.value;return s.ObjectUtils.isNotEmpty(e)&&c.sortField&&(e=V()),e}(),X=function(){if(c.loading){var e=i({className:T("loadingIcon")},I("loadingIcon")),t=c.loadingIcon||f.createElement(o.SpinnerIcon,d({},e,{spin:!0})),r=s.IconUtils.getJSXIcon(t,R({},e),{props:c}),n=i({className:T("loadingOverlay")},I("loadingOverlay"));return f.createElement("div",n,r)}return null}(),K=!c.paginator||"bottom"===c.paginatorPosition&&"both"!==c.paginatorPosition?null:q("top"),H=!c.paginator||"top"===c.paginatorPosition&&"both"!==c.paginatorPosition?null:q("bottom"),Y=function(){if(c.header){var e=i({className:T("header")},I("header"));return f.createElement("div",e,c.header)}return null}(),$=function(){if(c.footer){var e=i({className:T("footer")},I("footer"));return f.createElement("div",e,c.footer)}return null}(),G=function(e){var t=i({className:T("content")},I("content")),r=null;if(c.listTemplate){var n=B(e);r=s.ObjectUtils.isNotEmpty(n)?s.ObjectUtils.getJSXElement(c.listTemplate,n,c.layout):z()}else{var a=F(e),o=i({className:T("grid")},I("grid"));r=f.createElement("div",o,a)}return f.createElement("div",t,r)}(J),Q=i({id:c.id,ref:C,style:c.style,className:s.classNames(c.className,T("root"))},D.getOtherProps(c),I("root"));return f.createElement("div",Q,X,Y,K,G,H,$)})));L.displayName="DataViewLayoutOptions",k.displayName="DataViewItem",U.displayName="DataView",exports.DataView=U,exports.DataViewItem=k,exports.DataViewLayoutOptions=L;
|
package/dataview/dataview.esm.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PrimeReact, { PrimeReactContext, localeOption } from 'primereact/api';
|
|
4
4
|
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
5
|
+
import { useMergeProps } from 'primereact/hooks';
|
|
5
6
|
import { BarsIcon } from 'primereact/icons/bars';
|
|
6
7
|
import { SpinnerIcon } from 'primereact/icons/spinner';
|
|
7
8
|
import { ThLargeIcon } from 'primereact/icons/thlarge';
|
|
8
9
|
import { Paginator } from 'primereact/paginator';
|
|
9
10
|
import { Ripple } from 'primereact/ripple';
|
|
10
11
|
import { classNames, IconUtils, ObjectUtils } from 'primereact/utils';
|
|
11
|
-
import { useMergeProps } from 'primereact/hooks';
|
|
12
12
|
|
|
13
13
|
function _extends() {
|
|
14
14
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -334,7 +334,7 @@ var DataView = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function (i
|
|
|
334
334
|
rightContent: props.paginatorRight,
|
|
335
335
|
alwaysShow: props.alwaysShowPaginator,
|
|
336
336
|
dropdownAppendTo: props.paginatorDropdownAppendTo,
|
|
337
|
-
|
|
337
|
+
pt: ptm('paginator'),
|
|
338
338
|
unstyled: props.unstyled,
|
|
339
339
|
__parentMetadata: {
|
|
340
340
|
parent: metaData
|
|
@@ -464,7 +464,11 @@ var DataView = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function (i
|
|
|
464
464
|
var content = null;
|
|
465
465
|
if (props.listTemplate) {
|
|
466
466
|
var items = getItems(value);
|
|
467
|
-
|
|
467
|
+
if (ObjectUtils.isNotEmpty(items)) {
|
|
468
|
+
content = ObjectUtils.getJSXElement(props.listTemplate, items, props.layout);
|
|
469
|
+
} else {
|
|
470
|
+
content = createEmptyMessage();
|
|
471
|
+
}
|
|
468
472
|
} else {
|
|
469
473
|
var _items = createItems(value);
|
|
470
474
|
var gridProps = mergeProps({
|
|
@@ -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 p}from"primereact/ripple";import{classNames as c,IconUtils as m,ObjectUtils as f}from"primereact/utils";import{useMergeProps as g}from"primereact/hooks";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 T(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 A=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,listTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(t){return c("p-grid grid",{"p-nogutter grid-nogutter":!t.props.gutter})},root:function(t){var e=t.props;return c("p-dataview p-component",T(T({},"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"}}),D=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 p-component p-dataview-layout-options p-selectbutton p-button-group",listButton:function(t){return c("p-button p-button-icon-only",{"p-highlight":"list"===t.props.layout})},gridButton:function(t){return c("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){T(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=g(),o=t.useContext(r),a=D.getProps(e,o),l=D.setMetaData({props:a}),s=l.ptm,f=l.cx,d=function(t,e){a.onChange({originalEvent:t,value:e}),t.preventDefault()},y=n(s("list")),v=n(s("grid")),b=m.getJSXIcon(a.listIcon||t.createElement(i,y),x({},y),{props:a}),h=m.getJSXIcon(a.gridIcon||t.createElement(u,v),x({},v),{props:a}),w=n({id:a.id,style:a.style,className:c(a.className,f("root"))},D.getOtherProps(a),s("root")),P=n({type:"button",className:f("listButton"),onClick:function(t){return d(t,"list")}},s("listButton")),O=n({type:"button",className:f("gridButton"),onClick:function(t){return d(t,"grid")}},s("gridButton"));return t.createElement("div",w,t.createElement("button",P,b,t.createElement(p,null)),t.createElement("button",O,h,t.createElement(p,null)))})),z=t.memo((function(t){return t.template(t.item,t.layout)})),B=t.memo(t.forwardRef((function(o,i){var u=g(),p=t.useContext(r),y=A.getProps(o,p),P=E(t.useState(y.first),2),O=P[0],S=P[1],j=E(t.useState(y.rows),2),N=j[0],I=j[1],T={props:y,state:{first:O,rows:N}},D=A.setMetaData(T),k=D.ptm,L=D.cx;a(A.css.styles,D.isUnstyled,{name:"dataview"});var M=t.useRef(null),R=y.onPage?y.first:O,B=y.onPage?y.rows:N,F=function(t){return y.dataKey?f.resolveFieldData(t,y.dataKey):null},_=function(){return y.totalRecords?y.totalRecords:y.value?y.value.length:0},V=function(e){var r=c("p-paginator-"+e,y.paginatorClassName),n=_();return t.createElement(s,{first:R,rows:B,pageLinkSize:y.pageLinkSize,className:r,onPageChange:J,template:y.paginatorTemplate,totalRecords:n,rowsPerPageOptions:y.rowsPerPageOptions,currentPageReportTemplate:y.currentPageReportTemplate,leftContent:y.paginatorLeft,rightContent:y.paginatorRight,alwaysShow:y.alwaysShowPaginator,dropdownAppendTo:y.paginatorDropdownAppendTo,ptm:k("paginator"),unstyled:y.unstyled,__parentMetadata:{parent:T}})},J=function(t){y.onPage?y.onPage(t):(S(t.first),I(t.rows))},X=function(t){if(y.paginator){var e=y.lazy?0:R,r=_(),n=Math.min(B+e,r);return t.slice(e,n)||[]}return t},K=function(){if(y.value){var t,r=new Map,n=f.localeComparator(p&&p.locale||e.locale),o=v(l=y.value)||b(l)||h(l)||w(),a=C(o);try{for(a.s();!(t=a.n()).done;){var i=t.value;r.set(i,f.resolveFieldData(i,y.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 f.sort(a,i,y.sortOrder,n,p&&p.nullSortOrder||e.nullSortOrder)})),o}var l;return null},U=function(){if(!y.loading){var e=y.emptyMessage||n("emptyMessage"),r=u({className:L("emptyMessage")},k("emptyMessage"));return t.createElement("div",r,e)}return null},Y=function(e){return f.isNotEmpty(e)?X(e).map((function(e,r){return t.createElement(z,{key:F(e)||r,template:y.itemTemplate,layout:y.layout,item:e})})):U()};t.useImperativeHandle(i,(function(){return{props:y,getElement:function(){return M.current}}}));var $=function(){var t=y.value;return f.isNotEmpty(t)&&y.sortField&&(t=K()),t}(),H=function(){if(y.loading){var e=u({className:L("loadingIcon")},k("loadingIcon")),r=y.loadingIcon||t.createElement(l,d({},e,{spin:!0})),n=m.getJSXIcon(r,x({},e),{props:y}),o=u({className:L("loadingOverlay")},k("loadingOverlay"));return t.createElement("div",o,n)}return null}(),q=!y.paginator||"bottom"===y.paginatorPosition&&"both"!==y.paginatorPosition?null:V("top"),G=!y.paginator||"top"===y.paginatorPosition&&"both"!==y.paginatorPosition?null:V("bottom"),Q=function(){if(y.header){var e=u({className:L("header")},k("header"));return t.createElement("div",e,y.header)}return null}(),W=function(){if(y.footer){var e=u({className:L("footer")},k("footer"));return t.createElement("div",e,y.footer)}return null}(),Z=function(e){var r=u({className:L("content")},k("content")),n=null;if(y.listTemplate){var o=X(e);n=f.getJSXElement(y.listTemplate,o,y.layout)}else{var a=Y(e),i=u({className:L("grid")},k("grid"));n=t.createElement("div",i,a)}return t.createElement("div",r,n)}($),tt=u({id:y.id,ref:M,style:y.style,className:c(y.className,L("root"))},A.getOtherProps(y),k("root"));return t.createElement("div",tt,H,Q,q,Z,G,W)})));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{useMergeProps as i}from"primereact/hooks";import{BarsIcon as l}from"primereact/icons/bars";import{SpinnerIcon as u}from"primereact/icons/spinner";import{ThLargeIcon as s}from"primereact/icons/thlarge";import{Paginator as p}from"primereact/paginator";import{Ripple as c}from"primereact/ripple";import{classNames 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 T(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 A=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,listTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(t){return m("p-grid grid",{"p-nogutter grid-nogutter":!t.props.gutter})},root:function(t){var e=t.props;return m("p-dataview p-component",T(T({},"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"}}),D=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 p-component p-dataview-layout-options p-selectbutton p-button-group",listButton:function(t){return m("p-button p-button-icon-only",{"p-highlight":"list"===t.props.layout})},gridButton:function(t){return m("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){T(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=i(),o=t.useContext(r),a=D.getProps(e,o),u=D.setMetaData({props:a}),p=u.ptm,g=u.cx,d=function(t,e){a.onChange({originalEvent:t,value:e}),t.preventDefault()},y=n(p("list")),v=n(p("grid")),b=f.getJSXIcon(a.listIcon||t.createElement(l,y),x({},y),{props:a}),h=f.getJSXIcon(a.gridIcon||t.createElement(s,v),x({},v),{props:a}),w=n({id:a.id,style:a.style,className:m(a.className,g("root"))},D.getOtherProps(a),p("root")),P=n({type:"button",className:g("listButton"),onClick:function(t){return d(t,"list")}},p("listButton")),O=n({type:"button",className:g("gridButton"),onClick:function(t){return d(t,"grid")}},p("gridButton"));return t.createElement("div",w,t.createElement("button",P,b,t.createElement(c,null)),t.createElement("button",O,h,t.createElement(c,null)))})),z=t.memo((function(t){return t.template(t.item,t.layout)})),B=t.memo(t.forwardRef((function(o,l){var s=i(),c=t.useContext(r),y=A.getProps(o,c),P=E(t.useState(y.first),2),O=P[0],S=P[1],j=E(t.useState(y.rows),2),N=j[0],I=j[1],T={props:y,state:{first:O,rows:N}},D=A.setMetaData(T),k=D.ptm,L=D.cx;a(A.css.styles,D.isUnstyled,{name:"dataview"});var M=t.useRef(null),R=y.onPage?y.first:O,B=y.onPage?y.rows:N,F=function(t){return y.dataKey?g.resolveFieldData(t,y.dataKey):null},_=function(){return y.totalRecords?y.totalRecords:y.value?y.value.length:0},V=function(e){var r=m("p-paginator-"+e,y.paginatorClassName),n=_();return t.createElement(p,{first:R,rows:B,pageLinkSize:y.pageLinkSize,className:r,onPageChange:J,template:y.paginatorTemplate,totalRecords:n,rowsPerPageOptions:y.rowsPerPageOptions,currentPageReportTemplate:y.currentPageReportTemplate,leftContent:y.paginatorLeft,rightContent:y.paginatorRight,alwaysShow:y.alwaysShowPaginator,dropdownAppendTo:y.paginatorDropdownAppendTo,pt:k("paginator"),unstyled:y.unstyled,__parentMetadata:{parent:T}})},J=function(t){y.onPage?y.onPage(t):(S(t.first),I(t.rows))},X=function(t){if(y.paginator){var e=y.lazy?0:R,r=_(),n=Math.min(B+e,r);return t.slice(e,n)||[]}return t},K=function(){if(y.value){var t,r=new Map,n=g.localeComparator(c&&c.locale||e.locale),o=v(l=y.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,y.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,y.sortOrder,n,c&&c.nullSortOrder||e.nullSortOrder)})),o}var l;return null},U=function(){if(!y.loading){var e=y.emptyMessage||n("emptyMessage"),r=s({className:L("emptyMessage")},k("emptyMessage"));return t.createElement("div",r,e)}return null},Y=function(e){return g.isNotEmpty(e)?X(e).map((function(e,r){return t.createElement(z,{key:F(e)||r,template:y.itemTemplate,layout:y.layout,item:e})})):U()};t.useImperativeHandle(l,(function(){return{props:y,getElement:function(){return M.current}}}));var $=function(){var t=y.value;return g.isNotEmpty(t)&&y.sortField&&(t=K()),t}(),H=function(){if(y.loading){var e=s({className:L("loadingIcon")},k("loadingIcon")),r=y.loadingIcon||t.createElement(u,d({},e,{spin:!0})),n=f.getJSXIcon(r,x({},e),{props:y}),o=s({className:L("loadingOverlay")},k("loadingOverlay"));return t.createElement("div",o,n)}return null}(),q=!y.paginator||"bottom"===y.paginatorPosition&&"both"!==y.paginatorPosition?null:V("top"),G=!y.paginator||"top"===y.paginatorPosition&&"both"!==y.paginatorPosition?null:V("bottom"),Q=function(){if(y.header){var e=s({className:L("header")},k("header"));return t.createElement("div",e,y.header)}return null}(),W=function(){if(y.footer){var e=s({className:L("footer")},k("footer"));return t.createElement("div",e,y.footer)}return null}(),Z=function(e){var r=s({className:L("content")},k("content")),n=null;if(y.listTemplate){var o=X(e);n=g.isNotEmpty(o)?g.getJSXElement(y.listTemplate,o,y.layout):U()}else{var a=Y(e),i=s({className:L("grid")},k("grid"));n=t.createElement("div",i,a)}return t.createElement("div",r,n)}($),tt=s({id:y.id,ref:M,style:y.style,className:m(y.className,L("root"))},A.getOtherProps(y),k("root"));return t.createElement("div",tt,H,Q,q,Z,G,W)})));R.displayName="DataViewLayoutOptions",z.displayName="DataViewItem",B.displayName="DataView";export{B as DataView,z as DataViewItem,R as DataViewLayoutOptions};
|
package/dataview/dataview.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
this.primereact = this.primereact || {};
|
|
2
|
-
this.primereact.dataview = (function (exports, React, PrimeReact, componentbase, bars, spinner, thlarge, paginator, ripple, utils
|
|
2
|
+
this.primereact.dataview = (function (exports, React, PrimeReact, componentbase, hooks, bars, spinner, thlarge, paginator, ripple, utils) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -349,7 +349,7 @@ this.primereact.dataview = (function (exports, React, PrimeReact, componentbase,
|
|
|
349
349
|
rightContent: props.paginatorRight,
|
|
350
350
|
alwaysShow: props.alwaysShowPaginator,
|
|
351
351
|
dropdownAppendTo: props.paginatorDropdownAppendTo,
|
|
352
|
-
|
|
352
|
+
pt: ptm('paginator'),
|
|
353
353
|
unstyled: props.unstyled,
|
|
354
354
|
__parentMetadata: {
|
|
355
355
|
parent: metaData
|
|
@@ -479,7 +479,11 @@ this.primereact.dataview = (function (exports, React, PrimeReact, componentbase,
|
|
|
479
479
|
var content = null;
|
|
480
480
|
if (props.listTemplate) {
|
|
481
481
|
var items = getItems(value);
|
|
482
|
-
|
|
482
|
+
if (utils.ObjectUtils.isNotEmpty(items)) {
|
|
483
|
+
content = utils.ObjectUtils.getJSXElement(props.listTemplate, items, props.layout);
|
|
484
|
+
} else {
|
|
485
|
+
content = createEmptyMessage();
|
|
486
|
+
}
|
|
483
487
|
} else {
|
|
484
488
|
var _items = createItems(value);
|
|
485
489
|
var gridProps = mergeProps({
|
|
@@ -531,4 +535,4 @@ this.primereact.dataview = (function (exports, React, PrimeReact, componentbase,
|
|
|
531
535
|
|
|
532
536
|
return exports;
|
|
533
537
|
|
|
534
|
-
})({}, React, primereact.api, primereact.componentbase, primereact.icons.bars, primereact.icons.spinner, primereact.icons.thlarge, primereact.paginator, primereact.ripple, primereact.utils
|
|
538
|
+
})({}, React, primereact.api, primereact.componentbase, primereact.hooks, primereact.icons.bars, primereact.icons.spinner, primereact.icons.thlarge, primereact.paginator, primereact.ripple, primereact.utils);
|
package/dataview/dataview.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.dataview=function(t,e,n,r,a,o,i,l,u,s,c){"use strict";function p(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function f(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var m=f(e),d=p(n);function g(){return g=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g.apply(this,arguments)}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}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 n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?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 n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],u=!0,s=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);u=!0);}catch(t){s=!0,a=t}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}function j(){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 S(t,e){return P(t)||O(t,e)||h(t,e)||j()}function N(t){return N="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},N(t)}function E(t,e){if("object"!==N(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!==N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function I(t){var e=E(t,"string");return"symbol"===N(e)?e:String(e)}function D(t,e,n){return(e=I(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var T=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,listTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(t){return s.classNames("p-grid grid",{"p-nogutter grid-nogutter":!t.props.gutter})},root:function(t){var e=t.props;return s.classNames("p-dataview p-component",D(D({},"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"}}),A=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 p-component p-dataview-layout-options p-selectbutton p-button-group",listButton:function(t){return s.classNames("p-button p-button-icon-only",{"p-highlight":"list"===t.props.layout})},gridButton:function(t){return s.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===t.props.layout})}}}});function C(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=M(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}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 o,i=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function M(t,e){if(t){if("string"==typeof t)return R(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(t,e):void 0}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function k(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?L(Object(n),!0).forEach((function(e){D(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var x=m.memo((function(t){var e=c.useMergeProps(),r=m.useContext(n.PrimeReactContext),o=A.getProps(t,r),l=A.setMetaData({props:o}),p=l.ptm,f=l.cx,d=function(t,e){o.onChange({originalEvent:t,value:e}),t.preventDefault()},g=e(p("list")),y=e(p("grid")),v=s.IconUtils.getJSXIcon(o.listIcon||m.createElement(a.BarsIcon,g),k({},g),{props:o}),b=s.IconUtils.getJSXIcon(o.gridIcon||m.createElement(i.ThLargeIcon,y),k({},y),{props:o}),h=e({id:o.id,style:o.style,className:s.classNames(o.className,f("root"))},A.getOtherProps(o),p("root")),w=e({type:"button",className:f("listButton"),onClick:function(t){return d(t,"list")}},p("listButton")),P=e({type:"button",className:f("gridButton"),onClick:function(t){return d(t,"grid")}},p("gridButton"));return m.createElement("div",h,m.createElement("button",w,v,m.createElement(u.Ripple,null)),m.createElement("button",P,b,m.createElement(u.Ripple,null)))})),U=m.memo((function(t){return t.template(t.item,t.layout)})),_=m.memo(m.forwardRef((function(t,e){var a=c.useMergeProps(),i=m.useContext(n.PrimeReactContext),u=T.getProps(t,i),p=S(m.useState(u.first),2),f=p[0],y=p[1],P=S(m.useState(u.rows),2),O=P[0],j=P[1],N={props:u,state:{first:f,rows:O}},E=T.setMetaData(N),I=E.ptm,D=E.cx;r.useHandleStyle(T.css.styles,E.isUnstyled,{name:"dataview"});var A=m.useRef(null),M=u.onPage?u.first:f,R=u.onPage?u.rows:O,L=function(t){return u.dataKey?s.ObjectUtils.resolveFieldData(t,u.dataKey):null},x=function(){return u.totalRecords?u.totalRecords:u.value?u.value.length:0},_=function(t){var e=s.classNames("p-paginator-"+t,u.paginatorClassName),n=x();return m.createElement(l.Paginator,{first:M,rows:R,pageLinkSize:u.pageLinkSize,className:e,onPageChange:B,template:u.paginatorTemplate,totalRecords:n,rowsPerPageOptions:u.rowsPerPageOptions,currentPageReportTemplate:u.currentPageReportTemplate,leftContent:u.paginatorLeft,rightContent:u.paginatorRight,alwaysShow:u.alwaysShowPaginator,dropdownAppendTo:u.paginatorDropdownAppendTo,ptm:I("paginator"),unstyled:u.unstyled,__parentMetadata:{parent:N}})},B=function(t){u.onPage?u.onPage(t):(y(t.first),j(t.rows))},V=function(t){if(u.paginator){var e=u.lazy?0:M,n=x(),r=Math.min(R+e,n);return t.slice(e,r)||[]}return t},z=function(){if(u.value){var t,e=new Map,n=s.ObjectUtils.localeComparator(i&&i.locale||d.default.locale),r=v(l=u.value)||b(l)||h(l)||w(),a=C(r);try{for(a.s();!(t=a.n()).done;){var o=t.value;e.set(o,s.ObjectUtils.resolveFieldData(o,u.sortField))}}catch(t){a.e(t)}finally{a.f()}return r.sort((function(t,r){var a=e.get(t),o=e.get(r);return s.ObjectUtils.sort(a,o,u.sortOrder,n,i&&i.nullSortOrder||d.default.nullSortOrder)})),r}var l;return null},F=function(){if(!u.loading){var t=u.emptyMessage||n.localeOption("emptyMessage"),e=a({className:D("emptyMessage")},I("emptyMessage"));return m.createElement("div",e,t)}return null},J=function(t){return s.ObjectUtils.isNotEmpty(t)?V(t).map((function(t,e){return m.createElement(U,{key:L(t)||e,template:u.itemTemplate,layout:u.layout,item:t})})):F()};m.useImperativeHandle(e,(function(){return{props:u,getElement:function(){return A.current}}}));var X=function(){var t=u.value;return s.ObjectUtils.isNotEmpty(t)&&u.sortField&&(t=z()),t}(),K=function(){if(u.loading){var t=a({className:D("loadingIcon")},I("loadingIcon")),e=u.loadingIcon||m.createElement(o.SpinnerIcon,g({},t,{spin:!0})),n=s.IconUtils.getJSXIcon(e,k({},t),{props:u}),r=a({className:D("loadingOverlay")},I("loadingOverlay"));return m.createElement("div",r,n)}return null}(),H=!u.paginator||"bottom"===u.paginatorPosition&&"both"!==u.paginatorPosition?null:_("top"),Y=!u.paginator||"top"===u.paginatorPosition&&"both"!==u.paginatorPosition?null:_("bottom"),$=function(){if(u.header){var t=a({className:D("header")},I("header"));return m.createElement("div",t,u.header)}return null}(),q=function(){if(u.footer){var t=a({className:D("footer")},I("footer"));return m.createElement("div",t,u.footer)}return null}(),G=function(t){var e=a({className:D("content")},I("content")),n=null;if(u.listTemplate){var r=V(t);n=s.ObjectUtils.getJSXElement(u.listTemplate,r,u.layout)}else{var o=J(t),i=a({className:D("grid")},I("grid"));n=m.createElement("div",i,o)}return m.createElement("div",e,n)}(X),Q=a({id:u.id,ref:A,style:u.style,className:s.classNames(u.className,D("root"))},T.getOtherProps(u),I("root"));return m.createElement("div",Q,K,$,H,G,Y,q)})));return x.displayName="DataViewLayoutOptions",U.displayName="DataViewItem",_.displayName="DataView",t.DataView=_,t.DataViewItem=U,t.DataViewLayoutOptions=x,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.api,primereact.componentbase,primereact.icons.bars,primereact.icons.spinner,primereact.icons.thlarge,primereact.paginator,primereact.ripple,primereact.utils,primereact.hooks);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.dataview=function(t,e,n,r,a,o,i,l,u,s,c){"use strict";function p(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function f(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var m=f(e),d=p(n);function g(){return g=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g.apply(this,arguments)}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}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 n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?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 n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],u=!0,s=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);u=!0);}catch(t){s=!0,a=t}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}function j(){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 S(t,e){return P(t)||O(t,e)||h(t,e)||j()}function N(t){return N="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},N(t)}function E(t,e){if("object"!==N(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!==N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function I(t){var e=E(t,"string");return"symbol"===N(e)?e:String(e)}function D(t,e,n){return(e=I(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var T=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,listTemplate:null,onPage:null,children:void 0},css:{classes:{loadingIcon:"p-dataview-loading-icon",loadingOverlay:"p-dataview-loading-overlay p-component-overlay",emptyMessage:"p-dataview-emptymessage",header:"p-dataview-header",footer:"p-dataview-footer",content:"p-dataview-content",grid:function(t){return c.classNames("p-grid grid",{"p-nogutter grid-nogutter":!t.props.gutter})},root:function(t){var e=t.props;return c.classNames("p-dataview p-component",D(D({},"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"}}),A=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 p-component p-dataview-layout-options p-selectbutton p-button-group",listButton:function(t){return c.classNames("p-button p-button-icon-only",{"p-highlight":"list"===t.props.layout})},gridButton:function(t){return c.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===t.props.layout})}}}});function C(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=M(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}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 o,i=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function M(t,e){if(t){if("string"==typeof t)return R(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(t,e):void 0}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function k(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?L(Object(n),!0).forEach((function(e){D(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var U=m.memo((function(t){var e=a.useMergeProps(),r=m.useContext(n.PrimeReactContext),i=A.getProps(t,r),u=A.setMetaData({props:i}),p=u.ptm,f=u.cx,d=function(t,e){i.onChange({originalEvent:t,value:e}),t.preventDefault()},g=e(p("list")),y=e(p("grid")),v=c.IconUtils.getJSXIcon(i.listIcon||m.createElement(o.BarsIcon,g),k({},g),{props:i}),b=c.IconUtils.getJSXIcon(i.gridIcon||m.createElement(l.ThLargeIcon,y),k({},y),{props:i}),h=e({id:i.id,style:i.style,className:c.classNames(i.className,f("root"))},A.getOtherProps(i),p("root")),w=e({type:"button",className:f("listButton"),onClick:function(t){return d(t,"list")}},p("listButton")),P=e({type:"button",className:f("gridButton"),onClick:function(t){return d(t,"grid")}},p("gridButton"));return m.createElement("div",h,m.createElement("button",w,v,m.createElement(s.Ripple,null)),m.createElement("button",P,b,m.createElement(s.Ripple,null)))})),x=m.memo((function(t){return t.template(t.item,t.layout)})),_=m.memo(m.forwardRef((function(t,e){var o=a.useMergeProps(),l=m.useContext(n.PrimeReactContext),s=T.getProps(t,l),p=S(m.useState(s.first),2),f=p[0],y=p[1],P=S(m.useState(s.rows),2),O=P[0],j=P[1],N={props:s,state:{first:f,rows:O}},E=T.setMetaData(N),I=E.ptm,D=E.cx;r.useHandleStyle(T.css.styles,E.isUnstyled,{name:"dataview"});var A=m.useRef(null),M=s.onPage?s.first:f,R=s.onPage?s.rows:O,L=function(t){return s.dataKey?c.ObjectUtils.resolveFieldData(t,s.dataKey):null},U=function(){return s.totalRecords?s.totalRecords:s.value?s.value.length:0},_=function(t){var e=c.classNames("p-paginator-"+t,s.paginatorClassName),n=U();return m.createElement(u.Paginator,{first:M,rows:R,pageLinkSize:s.pageLinkSize,className:e,onPageChange:B,template:s.paginatorTemplate,totalRecords:n,rowsPerPageOptions:s.rowsPerPageOptions,currentPageReportTemplate:s.currentPageReportTemplate,leftContent:s.paginatorLeft,rightContent:s.paginatorRight,alwaysShow:s.alwaysShowPaginator,dropdownAppendTo:s.paginatorDropdownAppendTo,pt:I("paginator"),unstyled:s.unstyled,__parentMetadata:{parent:N}})},B=function(t){s.onPage?s.onPage(t):(y(t.first),j(t.rows))},V=function(t){if(s.paginator){var e=s.lazy?0:M,n=U(),r=Math.min(R+e,n);return t.slice(e,r)||[]}return t},z=function(){if(s.value){var t,e=new Map,n=c.ObjectUtils.localeComparator(l&&l.locale||d.default.locale),r=v(i=s.value)||b(i)||h(i)||w(),a=C(r);try{for(a.s();!(t=a.n()).done;){var o=t.value;e.set(o,c.ObjectUtils.resolveFieldData(o,s.sortField))}}catch(t){a.e(t)}finally{a.f()}return r.sort((function(t,r){var a=e.get(t),o=e.get(r);return c.ObjectUtils.sort(a,o,s.sortOrder,n,l&&l.nullSortOrder||d.default.nullSortOrder)})),r}var i;return null},F=function(){if(!s.loading){var t=s.emptyMessage||n.localeOption("emptyMessage"),e=o({className:D("emptyMessage")},I("emptyMessage"));return m.createElement("div",e,t)}return null},J=function(t){return c.ObjectUtils.isNotEmpty(t)?V(t).map((function(t,e){return m.createElement(x,{key:L(t)||e,template:s.itemTemplate,layout:s.layout,item:t})})):F()};m.useImperativeHandle(e,(function(){return{props:s,getElement:function(){return A.current}}}));var X=function(){var t=s.value;return c.ObjectUtils.isNotEmpty(t)&&s.sortField&&(t=z()),t}(),K=function(){if(s.loading){var t=o({className:D("loadingIcon")},I("loadingIcon")),e=s.loadingIcon||m.createElement(i.SpinnerIcon,g({},t,{spin:!0})),n=c.IconUtils.getJSXIcon(e,k({},t),{props:s}),r=o({className:D("loadingOverlay")},I("loadingOverlay"));return m.createElement("div",r,n)}return null}(),H=!s.paginator||"bottom"===s.paginatorPosition&&"both"!==s.paginatorPosition?null:_("top"),Y=!s.paginator||"top"===s.paginatorPosition&&"both"!==s.paginatorPosition?null:_("bottom"),$=function(){if(s.header){var t=o({className:D("header")},I("header"));return m.createElement("div",t,s.header)}return null}(),q=function(){if(s.footer){var t=o({className:D("footer")},I("footer"));return m.createElement("div",t,s.footer)}return null}(),G=function(t){var e=o({className:D("content")},I("content")),n=null;if(s.listTemplate){var r=V(t);n=c.ObjectUtils.isNotEmpty(r)?c.ObjectUtils.getJSXElement(s.listTemplate,r,s.layout):F()}else{var a=J(t),i=o({className:D("grid")},I("grid"));n=m.createElement("div",i,a)}return m.createElement("div",e,n)}(X),Q=o({id:s.id,ref:A,style:s.style,className:c.classNames(s.className,D("root"))},T.getOtherProps(s),I("root"));return m.createElement("div",Q,K,$,H,G,Y,q)})));return U.displayName="DataViewLayoutOptions",x.displayName="DataViewItem",_.displayName="DataView",t.DataView=_,t.DataViewItem=x,t.DataViewLayoutOptions=U,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.icons.bars,primereact.icons.spinner,primereact.icons.thlarge,primereact.paginator,primereact.ripple,primereact.utils);
|
package/dialog/dialog.cjs.js
CHANGED
|
@@ -572,7 +572,6 @@ var Dialog = /*#__PURE__*/React__namespace.forwardRef(function (inProps, ref) {
|
|
|
572
572
|
dragging.current = true;
|
|
573
573
|
lastPageX.current = event.pageX;
|
|
574
574
|
lastPageY.current = event.pageY;
|
|
575
|
-
dialogRef.current.style.margin = '0';
|
|
576
575
|
utils.DomHandler.addClass(document.body, 'p-unselectable-text');
|
|
577
576
|
props.onDragStart && props.onDragStart(event);
|
|
578
577
|
}
|
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/api"),n=require("primereact/componentbase"),r=require("primereact/csstransition"),o=require("primereact/hooks"),i=require("primereact/utils"),a=require("primereact/icons/times"),l=require("primereact/icons/windowmaximize"),c=require("primereact/icons/windowminimize"),s=require("primereact/portal"),u=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=p(e),f=d(e),g=p(t);function b(){return b=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},b.apply(this,arguments)}function y(e){return y="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},y(e)}function h(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 v(e){if(Array.isArray(e))return h(e)}function x(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function O(e,t){if(e){if("string"==typeof e)return h(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)?h(e,t):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 E(e,t){if("object"!==y(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function D(e){var t=E(e,"string");return"symbol"===y(t)?t:String(t)}function S(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){if(Array.isArray(e))return e}function j(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,s=!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){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)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 I(e,t){return P(e)||j(e,t)||O(e,t)||z()}var k=n.ComponentBase.extend({defaultProps:{__TYPE:"FocusTrap",children:void 0},css:{styles:""},getProps:function(e){return i.ObjectUtils.getMergedProps(e,k.defaultProps)},getOtherProps:function(e){return i.ObjectUtils.getDiffProps(e,k.defaultProps)}});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){S(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=m.default.memo(m.default.forwardRef((function(e,n){var r=m.default.useRef(null),a=m.default.useRef(null),l=m.default.useRef(null),c=m.default.useContext(t.PrimeReactContext),s=k.getProps(e,c),u={props:s};o.useStyle(k.css.styles,{name:"focustrap"});k.setMetaData(R({},u));m.default.useImperativeHandle(n,(function(){return{props:s,getInk:function(){return a.current},getTarget:function(){return r.current}}})),o.useMountEffect((function(){s.disabled||(r.current=y(),h(r.current))}));var p,d,f,g,b,y=function(){return a.current&&a.current.parentElement},h=function(e){var t=s||{},n=t.autoFocusSelector,r=t.firstFocusableSelector,o=void 0===r?"":r,a=t.autoFocus,l=void 0!==a&&a,c="".concat(v(void 0===n?"":n)),u="[autofocus]".concat(c,", [data-pc-autofocus='true']").concat(c),p=i.DomHandler.getFirstFocusableElement(e,u);l&&!p&&(p=i.DomHandler.getFirstFocusableElement(e,v(o))),i.DomHandler.focus(p)},v=function(e){return':not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])'.concat(null!=e?e:"")},x=function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_firsthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_firsthiddenfocusableelement:i.DomHandler.getLastFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)};return d=void 0===(p=(s||{}).tabIndex)?0:p,g=(f=function(e,t,n){return m.default.createElement("span",{ref:e,className:"p-hidden-accessible p-hidden-focusable",tabIndex:d,role:"presentation","aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:t,"data-pc-section":n})})(a,(function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_lasthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_lasthiddenfocusableelement:i.DomHandler.getFirstFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)}),"firstfocusableelement"),b=f(l,x,"lastfocusableelement"),a.current&&l.current&&(a.current.$_pfocustrap_lasthiddenfocusableelement=l.current,l.current.$_pfocustrap_firsthiddenfocusableelement=a.current),m.default.createElement(m.default.Fragment,null,g,s.children,b)})));function _(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 N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var M=n.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,content:null,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,footerClassName: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 i.classNames("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return i.classNames("p-dialog-content",e.props.contentClassName)},footer:function(e){return i.classNames("p-dialog-footer",e.props.footerClassName)},mask:function(e){var t=e.props,n=e.maskVisibleState,r=["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 i.classNames("p-dialog-mask",r?"p-dialog-".concat(r):"",{"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.maximized,n=e.context;return i.classNames("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":n&&"filled"===n.inputStyle||"filled"===g.default.inputStyle,"p-ripple-disabled":n&&!1===n.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 !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 N({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 T(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 B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=f.forwardRef((function(e,p){var d=o.useMergeProps(),m=f.useContext(t.PrimeReactContext),y=M.getProps(e,m),h=y.id?y.id:i.UniqueComponentId(),E=I(f.useState(h),2),D=E[0],S=I(f.useState(!1),2),P=S[0],j=S[1],z=I(f.useState(!1),2),k=z[0],C=z[1],R=I(f.useState(y.maximized),2),_=R[0],N=R[1],T=f.useRef(null),F=f.useRef(null),U=f.useRef(null),X=f.useRef(null),A=f.useRef(null),L=f.useRef(null),q=f.useRef(null),Y=f.useRef(!1),$=f.useRef(!1),V=f.useRef(null),Z=f.useRef(null),J=f.useRef(null),W=f.useRef(h),G=f.useRef(null),K=y.onMaximize?y.maximized:_,Q=k&&(y.blockScroll||y.maximizable&&K),ee=y.closable&&y.closeOnEscape&&k,te=o.useDisplayOrder("dialog",ee),ne=M.setMetaData(B(B({props:y},y.__parentMetadata),{},{state:{id:D,maximized:K,containerVisible:P}})),re=ne.ptm,oe=ne.cx,ie=ne.sx,ae=ne.isUnstyled;n.useHandleStyle(M.css.styles,ae,{name:"dialog"}),o.useGlobalOnEscapeKey({callback:function(e){ve(e)},when:ee&&te,priority:[o.ESC_KEY_HANDLING_PRIORITIES.DIALOG,te]});var le=I(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return ze(e)}}),2),ce=le[0],se=le[1],ue=I(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Ie(e)}}),2),pe=ue[0],de=ue[1],me=I(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return De(e)}}),2),fe=me[0],ge=me[1],be=I(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Se(e)}}),2),ye=be[0],he=be[1],ve=function(e){y.onHide(e),e.preventDefault()},xe=function(e){U.current=e.target,y.onPointerDown&&y.onPointerDown(e)},Oe=function(e){y.dismissableMask&&y.modal&&F.current===e.target&&!U.current&&ve(e),y.onMaskClick&&y.onMaskClick(e),U.current=null},we=function(e){y.onMaximize?y.onMaximize({originalEvent:e,maximized:!K}):N((function(e){return!e})),e.preventDefault()},Ee=function(e){i.DomHandler.hasClass(e.target,"p-dialog-header-icon")||i.DomHandler.hasClass(e.target.parentElement,"p-dialog-header-icon")||y.draggable&&(Y.current=!0,V.current=e.pageX,Z.current=e.pageY,T.current.style.margin="0",i.DomHandler.addClass(document.body,"p-unselectable-text"),y.onDragStart&&y.onDragStart(e))},De=function(e){if(Y.current){var t=i.DomHandler.getOuterWidth(T.current),n=i.DomHandler.getOuterHeight(T.current),r=e.pageX-V.current,o=e.pageY-Z.current,a=T.current.getBoundingClientRect(),l=a.left+r,c=a.top+o,s=i.DomHandler.getViewport(),u=getComputedStyle(T.current),p=parseFloat(u.marginLeft),d=parseFloat(u.marginTop);T.current.style.position="fixed",y.keepInViewport?(l>=y.minX&&l+t<s.width&&(V.current=e.pageX,T.current.style.left=l-p+"px"),c>=y.minY&&c+n<s.height&&(Z.current=e.pageY,T.current.style.top=c-d+"px")):(V.current=e.pageX,T.current.style.left=l-p+"px",Z.current=e.pageY,T.current.style.top=c-d+"px"),y.onDrag&&y.onDrag(e)}},Se=function(e){Y.current&&(Y.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),y.onDragEnd&&y.onDragEnd(e))},Pe=function(e){y.resizable&&($.current=!0,V.current=e.pageX,Z.current=e.pageY,i.DomHandler.addClass(document.body,"p-unselectable-text"),y.onResizeStart&&y.onResizeStart(e))},je=function(e,t,n){!n&&(n=i.DomHandler.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},ze=function(e){if($.current){var t=e.pageX-V.current,n=e.pageY-Z.current,r=i.DomHandler.getOuterWidth(T.current),o=i.DomHandler.getOuterHeight(T.current),a=T.current.getBoundingClientRect(),l=i.DomHandler.getViewport(),c=!parseInt(T.current.style.top)||!parseInt(T.current.style.left),s=je(T.current.style.minWidth,"width",l),u=je(T.current.style.minHeight,"height",l),p=r+t,d=o+n;c&&(p+=t,d+=n),(!s||p>s)&&a.left+p<l.width&&(T.current.style.width=p+"px"),(!u||d>u)&&a.top+d<l.height&&(T.current.style.height=d+"px"),V.current=e.pageX,Z.current=e.pageY,y.onResize&&y.onResize(e)}},Ie=function(e){$.current&&($.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),y.onResizeEnd&&y.onResizeEnd(e))},ke=function(){T.current.style.position="",T.current.style.left="",T.current.style.top="",T.current.style.margin=""},Ce=function(){T.current.setAttribute(W.current,"")},Re=function(){var e;y.onShow&&y.onShow(),y.focusOnShow&&!((e=document.activeElement)&&T.current&&T.current.contains(e))&&y.closable&&y.showHeader&&q.current&&q.current.focus(),Ne()},He=function(){y.modal&&!ae()&&i.DomHandler.addClass(F.current,"p-component-overlay-leave")},_e=function(){Y.current=!1,i.ZIndexUtils.clear(F.current),j(!1),Me(),i.DomHandler.focus(G.current),G.current=null},Ne=function(){Be()},Me=function(){Fe()},Te=function(e){if(e&&k){var t={id:D,hasBlockScroll:Q};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===D}));document.primeDialogParams=-1===n?[].concat(v(r=document.primeDialogParams)||x(r)||O(r)||w(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==D}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?i.DomHandler.blockBodyScroll():i.DomHandler.unblockBodyScroll()},Be=function(){y.draggable&&(fe(),ye()),y.resizable&&(ce(),pe())},Fe=function(){ge(),he(),se(),de()},Ue=function(){J.current=i.DomHandler.createInlineStyle(m&&m.nonce||g.default.nonce,m&&m.styleContainer);var e="";for(var t in y.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(W.current,"] {\n width: ").concat(y.breakpoints[t]," !important;\n }\n }\n ");J.current.innerHTML=e};o.useMountEffect((function(){Te(!0),y.visible&&j(!0)})),f.useEffect((function(){return y.breakpoints&&Ue(),function(){J.current=i.DomHandler.removeInlineStyle(J.current)}}),[y.breakpoints]),o.useUpdateEffect((function(){y.visible&&!P&&j(!0),y.visible!==k&&P&&C(y.visible),y.visible&&(G.current=document.activeElement)}),[y.visible,P]),o.useUpdateEffect((function(){P&&(i.ZIndexUtils.set("modal",F.current,m&&m.autoZIndex||g.default.autoZIndex,y.baseZIndex||m&&m.zIndex.modal||g.default.zIndex.modal),C(!0))}),[P]),o.useUpdateEffect((function(){Te(!0)}),[Q,k]),o.useUnmountEffect((function(){Me(),Te(!1),i.DomHandler.removeInlineStyle(J.current),i.ZIndexUtils.clear(F.current)})),f.useImperativeHandle(p,(function(){return{props:y,resetPosition:ke,getElement:function(){return T.current},getMask:function(){return F.current},getContent:function(){return X.current},getHeader:function(){return A.current},getFooter:function(){return L.current},getCloseButton:function(){return q.current}}}));var Xe=function(){if(y.closable){var e=y.ariaCloseIconLabel||t.ariaLabel("close"),n=d({className:oe("closeButtonIcon"),"aria-hidden":!0},re("closeButtonIcon")),r=i.IconUtils.getJSXIcon(y.closeIcon||f.createElement(a.TimesIcon,n),B({},n),{props:y}),o=d({ref:q,type:"button",className:oe("closeButton"),"aria-label":e,onClick:ve,onKeyDown:function(e){"Escape"!==e.key&&e.stopPropagation()}},re("closeButton"));return f.createElement("button",o,r,f.createElement(u.Ripple,null))}return null},Ae=function(){var e=d({className:oe("maximizableIcon")},re("maximizableIcon")),t=i.IconUtils.getJSXIcon(K?y.minimizeIcon||f.createElement(c.WindowMinimizeIcon,e):y.maximizeIcon||f.createElement(l.WindowMaximizeIcon,e),e,{props:y});if(y.maximizable){var n=d({type:"button",className:oe("maximizableButton"),onClick:we},re("maximizableButton"));return f.createElement("button",n,t,f.createElement(u.Ripple,null))}return null},Le=function(){if(y.showHeader){var e=Xe(),t=Ae(),n=i.ObjectUtils.getJSXElement(y.icons,y),r=i.ObjectUtils.getJSXElement(y.header,y),o=D+"_header",a=d({ref:A,style:y.headerStyle,className:oe("header"),onMouseDown:Ee},re("header")),l=d({id:o,className:oe("headerTitle")},re("headerTitle")),c=d({className:oe("headerIcons")},re("headerIcons"));return f.createElement("div",a,f.createElement("div",l,r),f.createElement("div",c,n,t,e))}return null},qe=function(){var e=i.ObjectUtils.getJSXElement(y.footer,y),t=d({ref:L,className:oe("footer")},re("footer"));return e&&f.createElement("div",t,e)};return P&&function(){var t,n,o,a,l,c,u=D+"_header",p=D+"_content",g={enter:"center"===y.position?150:300,exit:"center"===y.position?150:300},h=d({ref:F,style:ie("mask"),className:oe("mask"),onPointerUp:Oe},re("mask")),v=d({ref:T,id:D,className:i.classNames(y.className,oe("root",{props:y,maximized:K,context:m})),style:y.style,onClick:y.onClick,role:"dialog","aria-labelledby":u,"aria-describedby":p,"aria-modal":y.modal,onPointerDown:xe},M.getOtherProps(y),re("root")),x=d({classNames:oe("transition"),timeout:g,in:k,options:y.transitionOptions,unmountOnExit:!0,onEnter:Ce,onEntered:Re,onExiting:He,onExited:_e},re("transition")),O=null;null!=e&&e.content?(c={header:y.header,content:y.message,message:null==y||null===(l=y.children)||void 0===l||null===(l=l[1])||void 0===l||null===(l=l.props)||void 0===l?void 0:l.children},O=i.ObjectUtils.getJSXElement(e.content,{headerRef:A,contentRef:X,footerRef:L,closeRef:q,hide:ve,message:c})):(n=Le(),t=d({id:D+"_content",ref:X,style:y.contentStyle,className:oe("content")},re("content")),o=f.createElement("div",t,y.children),a=qe(),O=f.createElement(f.Fragment,null,n,o,a,y.resizable?f.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Pe}):null));var w=f.createElement("div",h,f.createElement(r.CSSTransition,b({nodeRef:T},x),f.createElement("div",v,f.createElement(H,{autoFocus:y.focusOnShow},O))));return f.createElement(s.Portal,{element:w,appendTo:y.appendTo,visible:!0})}()}));F.displayName="Dialog",exports.Dialog=F;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),r=require("primereact/csstransition"),o=require("primereact/hooks"),i=require("primereact/utils"),a=require("primereact/icons/times"),l=require("primereact/icons/windowmaximize"),c=require("primereact/icons/windowminimize"),s=require("primereact/portal"),u=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=p(e),f=d(e),g=p(t);function b(){return b=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},b.apply(this,arguments)}function h(e){return h="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},h(e)}function y(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 v(e){if(Array.isArray(e))return y(e)}function x(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function O(e,t){if(e){if("string"==typeof e)return y(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)?y(e,t):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 E(e,t){if("object"!==h(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function D(e){var t=E(e,"string");return"symbol"===h(t)?t:String(t)}function S(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){if(Array.isArray(e))return e}function j(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,s=!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){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)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 I(e,t){return P(e)||j(e,t)||O(e,t)||z()}var k=n.ComponentBase.extend({defaultProps:{__TYPE:"FocusTrap",children:void 0},css:{styles:""},getProps:function(e){return i.ObjectUtils.getMergedProps(e,k.defaultProps)},getOtherProps:function(e){return i.ObjectUtils.getDiffProps(e,k.defaultProps)}});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){S(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=m.default.memo(m.default.forwardRef((function(e,n){var r=m.default.useRef(null),a=m.default.useRef(null),l=m.default.useRef(null),c=m.default.useContext(t.PrimeReactContext),s=k.getProps(e,c),u={props:s};o.useStyle(k.css.styles,{name:"focustrap"});k.setMetaData(R({},u));m.default.useImperativeHandle(n,(function(){return{props:s,getInk:function(){return a.current},getTarget:function(){return r.current}}})),o.useMountEffect((function(){s.disabled||(r.current=h(),y(r.current))}));var p,d,f,g,b,h=function(){return a.current&&a.current.parentElement},y=function(e){var t=s||{},n=t.autoFocusSelector,r=t.firstFocusableSelector,o=void 0===r?"":r,a=t.autoFocus,l=void 0!==a&&a,c="".concat(v(void 0===n?"":n)),u="[autofocus]".concat(c,", [data-pc-autofocus='true']").concat(c),p=i.DomHandler.getFirstFocusableElement(e,u);l&&!p&&(p=i.DomHandler.getFirstFocusableElement(e,v(o))),i.DomHandler.focus(p)},v=function(e){return':not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])'.concat(null!=e?e:"")},x=function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_firsthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_firsthiddenfocusableelement:i.DomHandler.getLastFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)};return d=void 0===(p=(s||{}).tabIndex)?0:p,g=(f=function(e,t,n){return m.default.createElement("span",{ref:e,className:"p-hidden-accessible p-hidden-focusable",tabIndex:d,role:"presentation","aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:t,"data-pc-section":n})})(a,(function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_lasthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_lasthiddenfocusableelement:i.DomHandler.getFirstFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)}),"firstfocusableelement"),b=f(l,x,"lastfocusableelement"),a.current&&l.current&&(a.current.$_pfocustrap_lasthiddenfocusableelement=l.current,l.current.$_pfocustrap_firsthiddenfocusableelement=a.current),m.default.createElement(m.default.Fragment,null,g,s.children,b)})));function _(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 N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var M=n.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,content:null,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,footerClassName: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 i.classNames("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return i.classNames("p-dialog-content",e.props.contentClassName)},footer:function(e){return i.classNames("p-dialog-footer",e.props.footerClassName)},mask:function(e){var t=e.props,n=e.maskVisibleState,r=["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 i.classNames("p-dialog-mask",r?"p-dialog-".concat(r):"",{"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.maximized,n=e.context;return i.classNames("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":n&&"filled"===n.inputStyle||"filled"===g.default.inputStyle,"p-ripple-disabled":n&&!1===n.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 !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 N({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 T(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 B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=f.forwardRef((function(e,p){var d=o.useMergeProps(),m=f.useContext(t.PrimeReactContext),h=M.getProps(e,m),y=h.id?h.id:i.UniqueComponentId(),E=I(f.useState(y),2),D=E[0],S=I(f.useState(!1),2),P=S[0],j=S[1],z=I(f.useState(!1),2),k=z[0],C=z[1],R=I(f.useState(h.maximized),2),_=R[0],N=R[1],T=f.useRef(null),F=f.useRef(null),U=f.useRef(null),X=f.useRef(null),A=f.useRef(null),L=f.useRef(null),q=f.useRef(null),Y=f.useRef(!1),$=f.useRef(!1),V=f.useRef(null),Z=f.useRef(null),J=f.useRef(null),W=f.useRef(y),G=f.useRef(null),K=h.onMaximize?h.maximized:_,Q=k&&(h.blockScroll||h.maximizable&&K),ee=h.closable&&h.closeOnEscape&&k,te=o.useDisplayOrder("dialog",ee),ne=M.setMetaData(B(B({props:h},h.__parentMetadata),{},{state:{id:D,maximized:K,containerVisible:P}})),re=ne.ptm,oe=ne.cx,ie=ne.sx,ae=ne.isUnstyled;n.useHandleStyle(M.css.styles,ae,{name:"dialog"}),o.useGlobalOnEscapeKey({callback:function(e){ve(e)},when:ee&&te,priority:[o.ESC_KEY_HANDLING_PRIORITIES.DIALOG,te]});var le=I(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return ze(e)}}),2),ce=le[0],se=le[1],ue=I(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Ie(e)}}),2),pe=ue[0],de=ue[1],me=I(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return De(e)}}),2),fe=me[0],ge=me[1],be=I(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Se(e)}}),2),he=be[0],ye=be[1],ve=function(e){h.onHide(e),e.preventDefault()},xe=function(e){U.current=e.target,h.onPointerDown&&h.onPointerDown(e)},Oe=function(e){h.dismissableMask&&h.modal&&F.current===e.target&&!U.current&&ve(e),h.onMaskClick&&h.onMaskClick(e),U.current=null},we=function(e){h.onMaximize?h.onMaximize({originalEvent:e,maximized:!K}):N((function(e){return!e})),e.preventDefault()},Ee=function(e){i.DomHandler.hasClass(e.target,"p-dialog-header-icon")||i.DomHandler.hasClass(e.target.parentElement,"p-dialog-header-icon")||h.draggable&&(Y.current=!0,V.current=e.pageX,Z.current=e.pageY,i.DomHandler.addClass(document.body,"p-unselectable-text"),h.onDragStart&&h.onDragStart(e))},De=function(e){if(Y.current){var t=i.DomHandler.getOuterWidth(T.current),n=i.DomHandler.getOuterHeight(T.current),r=e.pageX-V.current,o=e.pageY-Z.current,a=T.current.getBoundingClientRect(),l=a.left+r,c=a.top+o,s=i.DomHandler.getViewport(),u=getComputedStyle(T.current),p=parseFloat(u.marginLeft),d=parseFloat(u.marginTop);T.current.style.position="fixed",h.keepInViewport?(l>=h.minX&&l+t<s.width&&(V.current=e.pageX,T.current.style.left=l-p+"px"),c>=h.minY&&c+n<s.height&&(Z.current=e.pageY,T.current.style.top=c-d+"px")):(V.current=e.pageX,T.current.style.left=l-p+"px",Z.current=e.pageY,T.current.style.top=c-d+"px"),h.onDrag&&h.onDrag(e)}},Se=function(e){Y.current&&(Y.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),h.onDragEnd&&h.onDragEnd(e))},Pe=function(e){h.resizable&&($.current=!0,V.current=e.pageX,Z.current=e.pageY,i.DomHandler.addClass(document.body,"p-unselectable-text"),h.onResizeStart&&h.onResizeStart(e))},je=function(e,t,n){!n&&(n=i.DomHandler.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},ze=function(e){if($.current){var t=e.pageX-V.current,n=e.pageY-Z.current,r=i.DomHandler.getOuterWidth(T.current),o=i.DomHandler.getOuterHeight(T.current),a=T.current.getBoundingClientRect(),l=i.DomHandler.getViewport(),c=!parseInt(T.current.style.top)||!parseInt(T.current.style.left),s=je(T.current.style.minWidth,"width",l),u=je(T.current.style.minHeight,"height",l),p=r+t,d=o+n;c&&(p+=t,d+=n),(!s||p>s)&&a.left+p<l.width&&(T.current.style.width=p+"px"),(!u||d>u)&&a.top+d<l.height&&(T.current.style.height=d+"px"),V.current=e.pageX,Z.current=e.pageY,h.onResize&&h.onResize(e)}},Ie=function(e){$.current&&($.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),h.onResizeEnd&&h.onResizeEnd(e))},ke=function(){T.current.style.position="",T.current.style.left="",T.current.style.top="",T.current.style.margin=""},Ce=function(){T.current.setAttribute(W.current,"")},Re=function(){var e;h.onShow&&h.onShow(),h.focusOnShow&&!((e=document.activeElement)&&T.current&&T.current.contains(e))&&h.closable&&h.showHeader&&q.current&&q.current.focus(),Ne()},He=function(){h.modal&&!ae()&&i.DomHandler.addClass(F.current,"p-component-overlay-leave")},_e=function(){Y.current=!1,i.ZIndexUtils.clear(F.current),j(!1),Me(),i.DomHandler.focus(G.current),G.current=null},Ne=function(){Be()},Me=function(){Fe()},Te=function(e){if(e&&k){var t={id:D,hasBlockScroll:Q};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===D}));document.primeDialogParams=-1===n?[].concat(v(r=document.primeDialogParams)||x(r)||O(r)||w(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==D}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?i.DomHandler.blockBodyScroll():i.DomHandler.unblockBodyScroll()},Be=function(){h.draggable&&(fe(),he()),h.resizable&&(ce(),pe())},Fe=function(){ge(),ye(),se(),de()},Ue=function(){J.current=i.DomHandler.createInlineStyle(m&&m.nonce||g.default.nonce,m&&m.styleContainer);var e="";for(var t in h.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(W.current,"] {\n width: ").concat(h.breakpoints[t]," !important;\n }\n }\n ");J.current.innerHTML=e};o.useMountEffect((function(){Te(!0),h.visible&&j(!0)})),f.useEffect((function(){return h.breakpoints&&Ue(),function(){J.current=i.DomHandler.removeInlineStyle(J.current)}}),[h.breakpoints]),o.useUpdateEffect((function(){h.visible&&!P&&j(!0),h.visible!==k&&P&&C(h.visible),h.visible&&(G.current=document.activeElement)}),[h.visible,P]),o.useUpdateEffect((function(){P&&(i.ZIndexUtils.set("modal",F.current,m&&m.autoZIndex||g.default.autoZIndex,h.baseZIndex||m&&m.zIndex.modal||g.default.zIndex.modal),C(!0))}),[P]),o.useUpdateEffect((function(){Te(!0)}),[Q,k]),o.useUnmountEffect((function(){Me(),Te(!1),i.DomHandler.removeInlineStyle(J.current),i.ZIndexUtils.clear(F.current)})),f.useImperativeHandle(p,(function(){return{props:h,resetPosition:ke,getElement:function(){return T.current},getMask:function(){return F.current},getContent:function(){return X.current},getHeader:function(){return A.current},getFooter:function(){return L.current},getCloseButton:function(){return q.current}}}));var Xe=function(){if(h.closable){var e=h.ariaCloseIconLabel||t.ariaLabel("close"),n=d({className:oe("closeButtonIcon"),"aria-hidden":!0},re("closeButtonIcon")),r=i.IconUtils.getJSXIcon(h.closeIcon||f.createElement(a.TimesIcon,n),B({},n),{props:h}),o=d({ref:q,type:"button",className:oe("closeButton"),"aria-label":e,onClick:ve,onKeyDown:function(e){"Escape"!==e.key&&e.stopPropagation()}},re("closeButton"));return f.createElement("button",o,r,f.createElement(u.Ripple,null))}return null},Ae=function(){var e=d({className:oe("maximizableIcon")},re("maximizableIcon")),t=i.IconUtils.getJSXIcon(K?h.minimizeIcon||f.createElement(c.WindowMinimizeIcon,e):h.maximizeIcon||f.createElement(l.WindowMaximizeIcon,e),e,{props:h});if(h.maximizable){var n=d({type:"button",className:oe("maximizableButton"),onClick:we},re("maximizableButton"));return f.createElement("button",n,t,f.createElement(u.Ripple,null))}return null},Le=function(){if(h.showHeader){var e=Xe(),t=Ae(),n=i.ObjectUtils.getJSXElement(h.icons,h),r=i.ObjectUtils.getJSXElement(h.header,h),o=D+"_header",a=d({ref:A,style:h.headerStyle,className:oe("header"),onMouseDown:Ee},re("header")),l=d({id:o,className:oe("headerTitle")},re("headerTitle")),c=d({className:oe("headerIcons")},re("headerIcons"));return f.createElement("div",a,f.createElement("div",l,r),f.createElement("div",c,n,t,e))}return null},qe=function(){var e=i.ObjectUtils.getJSXElement(h.footer,h),t=d({ref:L,className:oe("footer")},re("footer"));return e&&f.createElement("div",t,e)};return P&&function(){var t,n,o,a,l,c,u=D+"_header",p=D+"_content",g={enter:"center"===h.position?150:300,exit:"center"===h.position?150:300},y=d({ref:F,style:ie("mask"),className:oe("mask"),onPointerUp:Oe},re("mask")),v=d({ref:T,id:D,className:i.classNames(h.className,oe("root",{props:h,maximized:K,context:m})),style:h.style,onClick:h.onClick,role:"dialog","aria-labelledby":u,"aria-describedby":p,"aria-modal":h.modal,onPointerDown:xe},M.getOtherProps(h),re("root")),x=d({classNames:oe("transition"),timeout:g,in:k,options:h.transitionOptions,unmountOnExit:!0,onEnter:Ce,onEntered:Re,onExiting:He,onExited:_e},re("transition")),O=null;null!=e&&e.content?(c={header:h.header,content:h.message,message:null==h||null===(l=h.children)||void 0===l||null===(l=l[1])||void 0===l||null===(l=l.props)||void 0===l?void 0:l.children},O=i.ObjectUtils.getJSXElement(e.content,{headerRef:A,contentRef:X,footerRef:L,closeRef:q,hide:ve,message:c})):(n=Le(),t=d({id:D+"_content",ref:X,style:h.contentStyle,className:oe("content")},re("content")),o=f.createElement("div",t,h.children),a=qe(),O=f.createElement(f.Fragment,null,n,o,a,h.resizable?f.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Pe}):null));var w=f.createElement("div",y,f.createElement(r.CSSTransition,b({nodeRef:T},x),f.createElement("div",v,f.createElement(H,{autoFocus:h.focusOnShow},O))));return f.createElement(s.Portal,{element:w,appendTo:h.appendTo,visible:!0})}()}));F.displayName="Dialog",exports.Dialog=F;
|
package/dialog/dialog.esm.js
CHANGED
|
@@ -545,7 +545,6 @@ var Dialog = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
545
545
|
dragging.current = true;
|
|
546
546
|
lastPageX.current = event.pageX;
|
|
547
547
|
lastPageY.current = event.pageY;
|
|
548
|
-
dialogRef.current.style.margin = '0';
|
|
549
548
|
DomHandler.addClass(document.body, 'p-unselectable-text');
|
|
550
549
|
props.onDragStart && props.onDragStart(event);
|
|
551
550
|
}
|
package/dialog/dialog.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import t from"react";import n,{PrimeReactContext as r,ariaLabel as o}from"primereact/api";import{ComponentBase as i,useHandleStyle as a}from"primereact/componentbase";import{CSSTransition as l}from"primereact/csstransition";import{useStyle as c,useMountEffect as s,useMergeProps as u,useDisplayOrder as p,useGlobalOnEscapeKey as d,ESC_KEY_HANDLING_PRIORITIES as m,useEventListener as f,useUpdateEffect as g,useUnmountEffect as b}from"primereact/hooks";import{ObjectUtils as h,DomHandler as y,classNames as v,UniqueComponentId as x,ZIndexUtils as w,IconUtils as O}from"primereact/utils";import{TimesIcon as S}from"primereact/icons/times";import{WindowMaximizeIcon as E}from"primereact/icons/windowmaximize";import{WindowMinimizeIcon as P}from"primereact/icons/windowminimize";import{Portal as z}from"primereact/portal";import{Ripple as k}from"primereact/ripple";function j(){return j=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},j.apply(this,arguments)}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 D(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 R(e){if(Array.isArray(e))return D(e)}function C(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _(e,t){if(e){if("string"==typeof e)return D(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)?D(e,t):void 0}}function N(){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 T(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 M(e){var t=T(e,"string");return"symbol"===I(t)?t:String(t)}function F(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B(e){if(Array.isArray(e))return e}function X(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,s=!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){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}function A(){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 H(e,t){return B(e)||X(e,t)||_(e,t)||A()}var Y=i.extend({defaultProps:{__TYPE:"FocusTrap",children:void 0},css:{styles:""},getProps:function(e){return h.getMergedProps(e,Y.defaultProps)},getOtherProps:function(e){return h.getDiffProps(e,Y.defaultProps)}});function $(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 L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var V=t.memo(t.forwardRef((function(e,n){var o=t.useRef(null),i=t.useRef(null),a=t.useRef(null),l=t.useContext(r),u=Y.getProps(e,l),p={props:u};c(Y.css.styles,{name:"focustrap"});Y.setMetaData(L({},p));t.useImperativeHandle(n,(function(){return{props:u,getInk:function(){return i.current},getTarget:function(){return o.current}}})),s((function(){u.disabled||(o.current=h(),v(o.current))}));var d,m,f,g,b,h=function(){return i.current&&i.current.parentElement},v=function(e){var t=u||{},n=t.autoFocusSelector,r=t.firstFocusableSelector,o=void 0===r?"":r,i=t.autoFocus,a=void 0!==i&&i,l="".concat(x(void 0===n?"":n)),c="[autofocus]".concat(l,", [data-pc-autofocus='true']").concat(l),s=y.getFirstFocusableElement(e,c);a&&!s&&(s=y.getFirstFocusableElement(e,x(o))),y.focus(s)},x=function(e){return':not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])'.concat(null!=e?e:"")},w=function(e){var t,n=e.currentTarget,r=e.relatedTarget,i=r!==n.$_pfocustrap_firsthiddenfocusableelement&&null!==(t=o.current)&&void 0!==t&&t.contains(r)?n.$_pfocustrap_firsthiddenfocusableelement:y.getLastFocusableElement(n.parentElement,x(n.$_pfocustrap_focusableselector));y.focus(i)};return m=void 0===(d=(u||{}).tabIndex)?0:d,g=(f=function(e,n,r){return t.createElement("span",{ref:e,className:"p-hidden-accessible p-hidden-focusable",tabIndex:m,role:"presentation","aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:n,"data-pc-section":r})})(i,(function(e){var t,n=e.currentTarget,r=e.relatedTarget,i=r!==n.$_pfocustrap_lasthiddenfocusableelement&&null!==(t=o.current)&&void 0!==t&&t.contains(r)?n.$_pfocustrap_lasthiddenfocusableelement:y.getFirstFocusableElement(n.parentElement,x(n.$_pfocustrap_focusableselector));y.focus(i)}),"firstfocusableelement"),b=f(a,w,"lastfocusableelement"),i.current&&a.current&&(i.current.$_pfocustrap_lasthiddenfocusableelement=a.current,a.current.$_pfocustrap_firsthiddenfocusableelement=i.current),t.createElement(t.Fragment,null,g,u.children,b)})));function J(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 Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var U=i.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,content:null,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,footerClassName: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 v("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return v("p-dialog-content",e.props.contentClassName)},footer:function(e){return v("p-dialog-footer",e.props.footerClassName)},mask:function(e){var t=e.props,n=e.maskVisibleState,r=["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 v("p-dialog-mask",r?"p-dialog-".concat(r):"",{"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.maximized,r=e.context;return v("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":r&&"filled"===r.inputStyle||"filled"===n.inputStyle,"p-ripple-disabled":r&&!1===r.ripple||!1===n.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 !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 Z({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 W(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 G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var K=e.forwardRef((function(t,i){var c=u(),I=e.useContext(r),D=U.getProps(t,I),T=D.id?D.id:x(),M=H(e.useState(T),2),F=M[0],B=H(e.useState(!1),2),X=B[0],A=B[1],Y=H(e.useState(!1),2),$=Y[0],L=Y[1],J=H(e.useState(D.maximized),2),Z=J[0],W=J[1],K=e.useRef(null),q=e.useRef(null),Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null),ne=e.useRef(null),re=e.useRef(null),oe=e.useRef(!1),ie=e.useRef(!1),ae=e.useRef(null),le=e.useRef(null),ce=e.useRef(null),se=e.useRef(T),ue=e.useRef(null),pe=D.onMaximize?D.maximized:Z,de=$&&(D.blockScroll||D.maximizable&&pe),me=D.closable&&D.closeOnEscape&&$,fe=p("dialog",me),ge=U.setMetaData(G(G({props:D},D.__parentMetadata),{},{state:{id:F,maximized:pe,containerVisible:X}})),be=ge.ptm,he=ge.cx,ye=ge.sx,ve=ge.isUnstyled;a(U.css.styles,ve,{name:"dialog"}),d({callback:function(e){Ce(e)},when:me&&fe,priority:[m.DIALOG,fe]});var xe=H(f({type:"mousemove",target:function(){return window.document},listener:function(e){return He(e)}}),2),we=xe[0],Oe=xe[1],Se=H(f({type:"mouseup",target:function(){return window.document},listener:function(e){return Ye(e)}}),2),Ee=Se[0],Pe=Se[1],ze=H(f({type:"mousemove",target:function(){return window.document},listener:function(e){return Fe(e)}}),2),ke=ze[0],je=ze[1],Ie=H(f({type:"mouseup",target:function(){return window.document},listener:function(e){return Be(e)}}),2),De=Ie[0],Re=Ie[1],Ce=function(e){D.onHide(e),e.preventDefault()},_e=function(e){Q.current=e.target,D.onPointerDown&&D.onPointerDown(e)},Ne=function(e){D.dismissableMask&&D.modal&&q.current===e.target&&!Q.current&&Ce(e),D.onMaskClick&&D.onMaskClick(e),Q.current=null},Te=function(e){D.onMaximize?D.onMaximize({originalEvent:e,maximized:!pe}):W((function(e){return!e})),e.preventDefault()},Me=function(e){y.hasClass(e.target,"p-dialog-header-icon")||y.hasClass(e.target.parentElement,"p-dialog-header-icon")||D.draggable&&(oe.current=!0,ae.current=e.pageX,le.current=e.pageY,K.current.style.margin="0",y.addClass(document.body,"p-unselectable-text"),D.onDragStart&&D.onDragStart(e))},Fe=function(e){if(oe.current){var t=y.getOuterWidth(K.current),n=y.getOuterHeight(K.current),r=e.pageX-ae.current,o=e.pageY-le.current,i=K.current.getBoundingClientRect(),a=i.left+r,l=i.top+o,c=y.getViewport(),s=getComputedStyle(K.current),u=parseFloat(s.marginLeft),p=parseFloat(s.marginTop);K.current.style.position="fixed",D.keepInViewport?(a>=D.minX&&a+t<c.width&&(ae.current=e.pageX,K.current.style.left=a-u+"px"),l>=D.minY&&l+n<c.height&&(le.current=e.pageY,K.current.style.top=l-p+"px")):(ae.current=e.pageX,K.current.style.left=a-u+"px",le.current=e.pageY,K.current.style.top=l-p+"px"),D.onDrag&&D.onDrag(e)}},Be=function(e){oe.current&&(oe.current=!1,y.removeClass(document.body,"p-unselectable-text"),D.onDragEnd&&D.onDragEnd(e))},Xe=function(e){D.resizable&&(ie.current=!0,ae.current=e.pageX,le.current=e.pageY,y.addClass(document.body,"p-unselectable-text"),D.onResizeStart&&D.onResizeStart(e))},Ae=function(e,t,n){!n&&(n=y.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},He=function(e){if(ie.current){var t=e.pageX-ae.current,n=e.pageY-le.current,r=y.getOuterWidth(K.current),o=y.getOuterHeight(K.current),i=K.current.getBoundingClientRect(),a=y.getViewport(),l=!parseInt(K.current.style.top)||!parseInt(K.current.style.left),c=Ae(K.current.style.minWidth,"width",a),s=Ae(K.current.style.minHeight,"height",a),u=r+t,p=o+n;l&&(u+=t,p+=n),(!c||u>c)&&i.left+u<a.width&&(K.current.style.width=u+"px"),(!s||p>s)&&i.top+p<a.height&&(K.current.style.height=p+"px"),ae.current=e.pageX,le.current=e.pageY,D.onResize&&D.onResize(e)}},Ye=function(e){ie.current&&(ie.current=!1,y.removeClass(document.body,"p-unselectable-text"),D.onResizeEnd&&D.onResizeEnd(e))},$e=function(){K.current.style.position="",K.current.style.left="",K.current.style.top="",K.current.style.margin=""},Le=function(){K.current.setAttribute(se.current,"")},Ve=function(){var e;D.onShow&&D.onShow(),D.focusOnShow&&!((e=document.activeElement)&&K.current&&K.current.contains(e))&&D.closable&&D.showHeader&&re.current&&re.current.focus(),Ue()},Je=function(){D.modal&&!ve()&&y.addClass(q.current,"p-component-overlay-leave")},Ze=function(){oe.current=!1,w.clear(q.current),A(!1),We(),y.focus(ue.current),ue.current=null},Ue=function(){Ke()},We=function(){qe()},Ge=function(e){if(e&&$){var t={id:F,hasBlockScroll:de};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===F}));document.primeDialogParams=-1===n?[].concat(R(r=document.primeDialogParams)||C(r)||_(r)||N(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==F}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?y.blockBodyScroll():y.unblockBodyScroll()},Ke=function(){D.draggable&&(ke(),De()),D.resizable&&(we(),Ee())},qe=function(){je(),Re(),Oe(),Pe()},Qe=function(){ce.current=y.createInlineStyle(I&&I.nonce||n.nonce,I&&I.styleContainer);var e="";for(var t in D.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(se.current,"] {\n width: ").concat(D.breakpoints[t]," !important;\n }\n }\n ");ce.current.innerHTML=e};s((function(){Ge(!0),D.visible&&A(!0)})),e.useEffect((function(){return D.breakpoints&&Qe(),function(){ce.current=y.removeInlineStyle(ce.current)}}),[D.breakpoints]),g((function(){D.visible&&!X&&A(!0),D.visible!==$&&X&&L(D.visible),D.visible&&(ue.current=document.activeElement)}),[D.visible,X]),g((function(){X&&(w.set("modal",q.current,I&&I.autoZIndex||n.autoZIndex,D.baseZIndex||I&&I.zIndex.modal||n.zIndex.modal),L(!0))}),[X]),g((function(){Ge(!0)}),[de,$]),b((function(){We(),Ge(!1),y.removeInlineStyle(ce.current),w.clear(q.current)})),e.useImperativeHandle(i,(function(){return{props:D,resetPosition:$e,getElement:function(){return K.current},getMask:function(){return q.current},getContent:function(){return ee.current},getHeader:function(){return te.current},getFooter:function(){return ne.current},getCloseButton:function(){return re.current}}}));var et=function(){if(D.closable){var t=D.ariaCloseIconLabel||o("close"),n=c({className:he("closeButtonIcon"),"aria-hidden":!0},be("closeButtonIcon")),r=O.getJSXIcon(D.closeIcon||e.createElement(S,n),G({},n),{props:D}),i=c({ref:re,type:"button",className:he("closeButton"),"aria-label":t,onClick:Ce,onKeyDown:function(e){"Escape"!==e.key&&e.stopPropagation()}},be("closeButton"));return e.createElement("button",i,r,e.createElement(k,null))}return null},tt=function(){var t=c({className:he("maximizableIcon")},be("maximizableIcon")),n=O.getJSXIcon(pe?D.minimizeIcon||e.createElement(P,t):D.maximizeIcon||e.createElement(E,t),t,{props:D});if(D.maximizable){var r=c({type:"button",className:he("maximizableButton"),onClick:Te},be("maximizableButton"));return e.createElement("button",r,n,e.createElement(k,null))}return null},nt=function(){if(D.showHeader){var t=et(),n=tt(),r=h.getJSXElement(D.icons,D),o=h.getJSXElement(D.header,D),i=F+"_header",a=c({ref:te,style:D.headerStyle,className:he("header"),onMouseDown:Me},be("header")),l=c({id:i,className:he("headerTitle")},be("headerTitle")),s=c({className:he("headerIcons")},be("headerIcons"));return e.createElement("div",a,e.createElement("div",l,o),e.createElement("div",s,r,n,t))}return null},rt=function(){var t=h.getJSXElement(D.footer,D),n=c({ref:ne,className:he("footer")},be("footer"));return t&&e.createElement("div",n,t)};return X&&function(){var n,r,o,i,a,s,u=F+"_header",p=F+"_content",d={enter:"center"===D.position?150:300,exit:"center"===D.position?150:300},m=c({ref:q,style:ye("mask"),className:he("mask"),onPointerUp:Ne},be("mask")),f=c({ref:K,id:F,className:v(D.className,he("root",{props:D,maximized:pe,context:I})),style:D.style,onClick:D.onClick,role:"dialog","aria-labelledby":u,"aria-describedby":p,"aria-modal":D.modal,onPointerDown:_e},U.getOtherProps(D),be("root")),g=c({classNames:he("transition"),timeout:d,in:$,options:D.transitionOptions,unmountOnExit:!0,onEnter:Le,onEntered:Ve,onExiting:Je,onExited:Ze},be("transition")),b=null;null!=t&&t.content?(s={header:D.header,content:D.message,message:null==D||null===(a=D.children)||void 0===a||null===(a=a[1])||void 0===a||null===(a=a.props)||void 0===a?void 0:a.children},b=h.getJSXElement(t.content,{headerRef:te,contentRef:ee,footerRef:ne,closeRef:re,hide:Ce,message:s})):(r=nt(),n=c({id:F+"_content",ref:ee,style:D.contentStyle,className:he("content")},be("content")),o=e.createElement("div",n,D.children),i=rt(),b=e.createElement(e.Fragment,null,r,o,i,D.resizable?e.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Xe}):null));var y=e.createElement("div",m,e.createElement(l,j({nodeRef:K},g),e.createElement("div",f,e.createElement(V,{autoFocus:D.focusOnShow},b))));return e.createElement(z,{element:y,appendTo:D.appendTo,visible:!0})}()}));K.displayName="Dialog";export{K as Dialog};
|
|
1
|
+
import*as e from"react";import t from"react";import n,{PrimeReactContext as r,ariaLabel as o}from"primereact/api";import{ComponentBase as i,useHandleStyle as a}from"primereact/componentbase";import{CSSTransition as l}from"primereact/csstransition";import{useStyle as c,useMountEffect as s,useMergeProps as u,useDisplayOrder as p,useGlobalOnEscapeKey as d,ESC_KEY_HANDLING_PRIORITIES as m,useEventListener as f,useUpdateEffect as g,useUnmountEffect as b}from"primereact/hooks";import{ObjectUtils as h,DomHandler as y,classNames as v,UniqueComponentId as x,ZIndexUtils as w,IconUtils as O}from"primereact/utils";import{TimesIcon as S}from"primereact/icons/times";import{WindowMaximizeIcon as E}from"primereact/icons/windowmaximize";import{WindowMinimizeIcon as P}from"primereact/icons/windowminimize";import{Portal as z}from"primereact/portal";import{Ripple as k}from"primereact/ripple";function j(){return j=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},j.apply(this,arguments)}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 D(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 R(e){if(Array.isArray(e))return D(e)}function C(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _(e,t){if(e){if("string"==typeof e)return D(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)?D(e,t):void 0}}function N(){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 T(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 M(e){var t=T(e,"string");return"symbol"===I(t)?t:String(t)}function F(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function B(e){if(Array.isArray(e))return e}function X(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,s=!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){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}function A(){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 H(e,t){return B(e)||X(e,t)||_(e,t)||A()}var Y=i.extend({defaultProps:{__TYPE:"FocusTrap",children:void 0},css:{styles:""},getProps:function(e){return h.getMergedProps(e,Y.defaultProps)},getOtherProps:function(e){return h.getDiffProps(e,Y.defaultProps)}});function $(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 L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var V=t.memo(t.forwardRef((function(e,n){var o=t.useRef(null),i=t.useRef(null),a=t.useRef(null),l=t.useContext(r),u=Y.getProps(e,l),p={props:u};c(Y.css.styles,{name:"focustrap"});Y.setMetaData(L({},p));t.useImperativeHandle(n,(function(){return{props:u,getInk:function(){return i.current},getTarget:function(){return o.current}}})),s((function(){u.disabled||(o.current=h(),v(o.current))}));var d,m,f,g,b,h=function(){return i.current&&i.current.parentElement},v=function(e){var t=u||{},n=t.autoFocusSelector,r=t.firstFocusableSelector,o=void 0===r?"":r,i=t.autoFocus,a=void 0!==i&&i,l="".concat(x(void 0===n?"":n)),c="[autofocus]".concat(l,", [data-pc-autofocus='true']").concat(l),s=y.getFirstFocusableElement(e,c);a&&!s&&(s=y.getFirstFocusableElement(e,x(o))),y.focus(s)},x=function(e){return':not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])'.concat(null!=e?e:"")},w=function(e){var t,n=e.currentTarget,r=e.relatedTarget,i=r!==n.$_pfocustrap_firsthiddenfocusableelement&&null!==(t=o.current)&&void 0!==t&&t.contains(r)?n.$_pfocustrap_firsthiddenfocusableelement:y.getLastFocusableElement(n.parentElement,x(n.$_pfocustrap_focusableselector));y.focus(i)};return m=void 0===(d=(u||{}).tabIndex)?0:d,g=(f=function(e,n,r){return t.createElement("span",{ref:e,className:"p-hidden-accessible p-hidden-focusable",tabIndex:m,role:"presentation","aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:n,"data-pc-section":r})})(i,(function(e){var t,n=e.currentTarget,r=e.relatedTarget,i=r!==n.$_pfocustrap_lasthiddenfocusableelement&&null!==(t=o.current)&&void 0!==t&&t.contains(r)?n.$_pfocustrap_lasthiddenfocusableelement:y.getFirstFocusableElement(n.parentElement,x(n.$_pfocustrap_focusableselector));y.focus(i)}),"firstfocusableelement"),b=f(a,w,"lastfocusableelement"),i.current&&a.current&&(i.current.$_pfocustrap_lasthiddenfocusableelement=a.current,a.current.$_pfocustrap_firsthiddenfocusableelement=i.current),t.createElement(t.Fragment,null,g,u.children,b)})));function J(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 Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var U=i.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,content:null,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,footerClassName: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 v("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return v("p-dialog-content",e.props.contentClassName)},footer:function(e){return v("p-dialog-footer",e.props.footerClassName)},mask:function(e){var t=e.props,n=e.maskVisibleState,r=["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 v("p-dialog-mask",r?"p-dialog-".concat(r):"",{"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.maximized,r=e.context;return v("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":r&&"filled"===r.inputStyle||"filled"===n.inputStyle,"p-ripple-disabled":r&&!1===r.ripple||!1===n.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 !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 Z({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 W(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 G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach((function(t){F(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var K=e.forwardRef((function(t,i){var c=u(),I=e.useContext(r),D=U.getProps(t,I),T=D.id?D.id:x(),M=H(e.useState(T),2),F=M[0],B=H(e.useState(!1),2),X=B[0],A=B[1],Y=H(e.useState(!1),2),$=Y[0],L=Y[1],J=H(e.useState(D.maximized),2),Z=J[0],W=J[1],K=e.useRef(null),q=e.useRef(null),Q=e.useRef(null),ee=e.useRef(null),te=e.useRef(null),ne=e.useRef(null),re=e.useRef(null),oe=e.useRef(!1),ie=e.useRef(!1),ae=e.useRef(null),le=e.useRef(null),ce=e.useRef(null),se=e.useRef(T),ue=e.useRef(null),pe=D.onMaximize?D.maximized:Z,de=$&&(D.blockScroll||D.maximizable&&pe),me=D.closable&&D.closeOnEscape&&$,fe=p("dialog",me),ge=U.setMetaData(G(G({props:D},D.__parentMetadata),{},{state:{id:F,maximized:pe,containerVisible:X}})),be=ge.ptm,he=ge.cx,ye=ge.sx,ve=ge.isUnstyled;a(U.css.styles,ve,{name:"dialog"}),d({callback:function(e){Ce(e)},when:me&&fe,priority:[m.DIALOG,fe]});var xe=H(f({type:"mousemove",target:function(){return window.document},listener:function(e){return He(e)}}),2),we=xe[0],Oe=xe[1],Se=H(f({type:"mouseup",target:function(){return window.document},listener:function(e){return Ye(e)}}),2),Ee=Se[0],Pe=Se[1],ze=H(f({type:"mousemove",target:function(){return window.document},listener:function(e){return Fe(e)}}),2),ke=ze[0],je=ze[1],Ie=H(f({type:"mouseup",target:function(){return window.document},listener:function(e){return Be(e)}}),2),De=Ie[0],Re=Ie[1],Ce=function(e){D.onHide(e),e.preventDefault()},_e=function(e){Q.current=e.target,D.onPointerDown&&D.onPointerDown(e)},Ne=function(e){D.dismissableMask&&D.modal&&q.current===e.target&&!Q.current&&Ce(e),D.onMaskClick&&D.onMaskClick(e),Q.current=null},Te=function(e){D.onMaximize?D.onMaximize({originalEvent:e,maximized:!pe}):W((function(e){return!e})),e.preventDefault()},Me=function(e){y.hasClass(e.target,"p-dialog-header-icon")||y.hasClass(e.target.parentElement,"p-dialog-header-icon")||D.draggable&&(oe.current=!0,ae.current=e.pageX,le.current=e.pageY,y.addClass(document.body,"p-unselectable-text"),D.onDragStart&&D.onDragStart(e))},Fe=function(e){if(oe.current){var t=y.getOuterWidth(K.current),n=y.getOuterHeight(K.current),r=e.pageX-ae.current,o=e.pageY-le.current,i=K.current.getBoundingClientRect(),a=i.left+r,l=i.top+o,c=y.getViewport(),s=getComputedStyle(K.current),u=parseFloat(s.marginLeft),p=parseFloat(s.marginTop);K.current.style.position="fixed",D.keepInViewport?(a>=D.minX&&a+t<c.width&&(ae.current=e.pageX,K.current.style.left=a-u+"px"),l>=D.minY&&l+n<c.height&&(le.current=e.pageY,K.current.style.top=l-p+"px")):(ae.current=e.pageX,K.current.style.left=a-u+"px",le.current=e.pageY,K.current.style.top=l-p+"px"),D.onDrag&&D.onDrag(e)}},Be=function(e){oe.current&&(oe.current=!1,y.removeClass(document.body,"p-unselectable-text"),D.onDragEnd&&D.onDragEnd(e))},Xe=function(e){D.resizable&&(ie.current=!0,ae.current=e.pageX,le.current=e.pageY,y.addClass(document.body,"p-unselectable-text"),D.onResizeStart&&D.onResizeStart(e))},Ae=function(e,t,n){!n&&(n=y.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},He=function(e){if(ie.current){var t=e.pageX-ae.current,n=e.pageY-le.current,r=y.getOuterWidth(K.current),o=y.getOuterHeight(K.current),i=K.current.getBoundingClientRect(),a=y.getViewport(),l=!parseInt(K.current.style.top)||!parseInt(K.current.style.left),c=Ae(K.current.style.minWidth,"width",a),s=Ae(K.current.style.minHeight,"height",a),u=r+t,p=o+n;l&&(u+=t,p+=n),(!c||u>c)&&i.left+u<a.width&&(K.current.style.width=u+"px"),(!s||p>s)&&i.top+p<a.height&&(K.current.style.height=p+"px"),ae.current=e.pageX,le.current=e.pageY,D.onResize&&D.onResize(e)}},Ye=function(e){ie.current&&(ie.current=!1,y.removeClass(document.body,"p-unselectable-text"),D.onResizeEnd&&D.onResizeEnd(e))},$e=function(){K.current.style.position="",K.current.style.left="",K.current.style.top="",K.current.style.margin=""},Le=function(){K.current.setAttribute(se.current,"")},Ve=function(){var e;D.onShow&&D.onShow(),D.focusOnShow&&!((e=document.activeElement)&&K.current&&K.current.contains(e))&&D.closable&&D.showHeader&&re.current&&re.current.focus(),Ue()},Je=function(){D.modal&&!ve()&&y.addClass(q.current,"p-component-overlay-leave")},Ze=function(){oe.current=!1,w.clear(q.current),A(!1),We(),y.focus(ue.current),ue.current=null},Ue=function(){Ke()},We=function(){qe()},Ge=function(e){if(e&&$){var t={id:F,hasBlockScroll:de};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===F}));document.primeDialogParams=-1===n?[].concat(R(r=document.primeDialogParams)||C(r)||_(r)||N(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==F}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?y.blockBodyScroll():y.unblockBodyScroll()},Ke=function(){D.draggable&&(ke(),De()),D.resizable&&(we(),Ee())},qe=function(){je(),Re(),Oe(),Pe()},Qe=function(){ce.current=y.createInlineStyle(I&&I.nonce||n.nonce,I&&I.styleContainer);var e="";for(var t in D.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(se.current,"] {\n width: ").concat(D.breakpoints[t]," !important;\n }\n }\n ");ce.current.innerHTML=e};s((function(){Ge(!0),D.visible&&A(!0)})),e.useEffect((function(){return D.breakpoints&&Qe(),function(){ce.current=y.removeInlineStyle(ce.current)}}),[D.breakpoints]),g((function(){D.visible&&!X&&A(!0),D.visible!==$&&X&&L(D.visible),D.visible&&(ue.current=document.activeElement)}),[D.visible,X]),g((function(){X&&(w.set("modal",q.current,I&&I.autoZIndex||n.autoZIndex,D.baseZIndex||I&&I.zIndex.modal||n.zIndex.modal),L(!0))}),[X]),g((function(){Ge(!0)}),[de,$]),b((function(){We(),Ge(!1),y.removeInlineStyle(ce.current),w.clear(q.current)})),e.useImperativeHandle(i,(function(){return{props:D,resetPosition:$e,getElement:function(){return K.current},getMask:function(){return q.current},getContent:function(){return ee.current},getHeader:function(){return te.current},getFooter:function(){return ne.current},getCloseButton:function(){return re.current}}}));var et=function(){if(D.closable){var t=D.ariaCloseIconLabel||o("close"),n=c({className:he("closeButtonIcon"),"aria-hidden":!0},be("closeButtonIcon")),r=O.getJSXIcon(D.closeIcon||e.createElement(S,n),G({},n),{props:D}),i=c({ref:re,type:"button",className:he("closeButton"),"aria-label":t,onClick:Ce,onKeyDown:function(e){"Escape"!==e.key&&e.stopPropagation()}},be("closeButton"));return e.createElement("button",i,r,e.createElement(k,null))}return null},tt=function(){var t=c({className:he("maximizableIcon")},be("maximizableIcon")),n=O.getJSXIcon(pe?D.minimizeIcon||e.createElement(P,t):D.maximizeIcon||e.createElement(E,t),t,{props:D});if(D.maximizable){var r=c({type:"button",className:he("maximizableButton"),onClick:Te},be("maximizableButton"));return e.createElement("button",r,n,e.createElement(k,null))}return null},nt=function(){if(D.showHeader){var t=et(),n=tt(),r=h.getJSXElement(D.icons,D),o=h.getJSXElement(D.header,D),i=F+"_header",a=c({ref:te,style:D.headerStyle,className:he("header"),onMouseDown:Me},be("header")),l=c({id:i,className:he("headerTitle")},be("headerTitle")),s=c({className:he("headerIcons")},be("headerIcons"));return e.createElement("div",a,e.createElement("div",l,o),e.createElement("div",s,r,n,t))}return null},rt=function(){var t=h.getJSXElement(D.footer,D),n=c({ref:ne,className:he("footer")},be("footer"));return t&&e.createElement("div",n,t)};return X&&function(){var n,r,o,i,a,s,u=F+"_header",p=F+"_content",d={enter:"center"===D.position?150:300,exit:"center"===D.position?150:300},m=c({ref:q,style:ye("mask"),className:he("mask"),onPointerUp:Ne},be("mask")),f=c({ref:K,id:F,className:v(D.className,he("root",{props:D,maximized:pe,context:I})),style:D.style,onClick:D.onClick,role:"dialog","aria-labelledby":u,"aria-describedby":p,"aria-modal":D.modal,onPointerDown:_e},U.getOtherProps(D),be("root")),g=c({classNames:he("transition"),timeout:d,in:$,options:D.transitionOptions,unmountOnExit:!0,onEnter:Le,onEntered:Ve,onExiting:Je,onExited:Ze},be("transition")),b=null;null!=t&&t.content?(s={header:D.header,content:D.message,message:null==D||null===(a=D.children)||void 0===a||null===(a=a[1])||void 0===a||null===(a=a.props)||void 0===a?void 0:a.children},b=h.getJSXElement(t.content,{headerRef:te,contentRef:ee,footerRef:ne,closeRef:re,hide:Ce,message:s})):(r=nt(),n=c({id:F+"_content",ref:ee,style:D.contentStyle,className:he("content")},be("content")),o=e.createElement("div",n,D.children),i=rt(),b=e.createElement(e.Fragment,null,r,o,i,D.resizable?e.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Xe}):null));var y=e.createElement("div",m,e.createElement(l,j({nodeRef:K},g),e.createElement("div",f,e.createElement(V,{autoFocus:D.focusOnShow},b))));return e.createElement(z,{element:y,appendTo:D.appendTo,visible:!0})}()}));K.displayName="Dialog";export{K as Dialog};
|
package/dialog/dialog.js
CHANGED
|
@@ -559,7 +559,6 @@ this.primereact.dialog = (function (exports, React, PrimeReact, componentbase, c
|
|
|
559
559
|
dragging.current = true;
|
|
560
560
|
lastPageX.current = event.pageX;
|
|
561
561
|
lastPageY.current = event.pageY;
|
|
562
|
-
dialogRef.current.style.margin = '0';
|
|
563
562
|
utils.DomHandler.addClass(document.body, 'p-unselectable-text');
|
|
564
563
|
props.onDragStart && props.onDragStart(event);
|
|
565
564
|
}
|