primereact 9.0.0-rc.1 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/accordion/accordion.d.ts +2 -2
- package/autocomplete/autocomplete.d.ts +2 -2
- package/avatar/avatar.d.ts +2 -2
- package/avatargroup/avatargroup.d.ts +2 -2
- package/badge/badge.d.ts +2 -2
- package/blockui/blockui.d.ts +2 -2
- package/breadcrumb/breadcrumb.d.ts +2 -2
- package/button/button.cjs.js +15 -2
- package/button/button.cjs.min.js +1 -1
- package/button/button.d.ts +46 -2
- package/button/button.esm.js +15 -2
- package/button/button.esm.min.js +1 -1
- package/button/button.js +15 -2
- package/button/button.min.js +1 -1
- package/calendar/calendar.d.ts +2 -2
- package/card/card.d.ts +2 -2
- package/carousel/carousel.d.ts +2 -3
- package/cascadeselect/cascadeselect.cjs.js +28 -0
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +11 -2
- package/cascadeselect/cascadeselect.esm.js +29 -1
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +28 -0
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/chart/chart.d.ts +2 -2
- package/checkbox/checkbox.d.ts +2 -2
- package/chip/chip.d.ts +2 -2
- package/chips/chips.d.ts +2 -2
- package/colorpicker/colorpicker.d.ts +2 -2
- package/column/column.d.ts +3 -45
- package/columngroup/columngroup.d.ts +2 -2
- package/confirmdialog/confirmdialog.d.ts +2 -4
- package/confirmpopup/confirmpopup.d.ts +2 -4
- package/contextmenu/contextmenu.d.ts +2 -2
- package/core/core.js +33 -3
- package/core/core.min.js +4 -4
- package/csstransition/csstransition.d.ts +2 -2
- package/datascroller/datascroller.d.ts +2 -2
- package/datatable/datatable.d.ts +10 -29
- package/dataview/dataview.d.ts +3 -5
- package/deferredcontent/deferredcontent.d.ts +2 -2
- package/dialog/dialog.d.ts +2 -3
- package/divider/divider.d.ts +2 -2
- package/dock/dock.d.ts +2 -4
- package/dropdown/dropdown.d.ts +2 -3
- package/editor/editor.d.ts +2 -2
- package/fieldset/fieldset.d.ts +2 -2
- package/fileupload/fileupload.cjs.js +156 -23
- package/fileupload/fileupload.cjs.min.js +1 -1
- package/fileupload/fileupload.d.ts +2 -6
- package/fileupload/fileupload.esm.js +156 -23
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +156 -23
- package/fileupload/fileupload.min.css +1 -1
- package/fileupload/fileupload.min.js +1 -1
- package/galleria/galleria.d.ts +2 -3
- package/hooks/hooks.cjs.js +15 -0
- package/hooks/hooks.cjs.min.js +1 -1
- package/hooks/hooks.d.ts +2 -8
- package/hooks/hooks.esm.js +15 -0
- package/hooks/hooks.esm.min.js +1 -1
- package/hooks/hooks.js +15 -0
- package/hooks/hooks.min.js +1 -1
- package/image/image.d.ts +2 -2
- package/inplace/inplace.d.ts +20 -10
- package/inputmask/inputmask.d.ts +2 -2
- package/inputnumber/inputnumber.d.ts +2 -2
- package/inputswitch/inputswitch.d.ts +2 -2
- package/inputtext/inputtext.d.ts +2 -2
- package/inputtextarea/inputtextarea.d.ts +2 -2
- package/knob/knob.d.ts +2 -2
- package/listbox/listbox.d.ts +2 -5
- package/megamenu/megamenu.d.ts +2 -2
- package/mention/mention.d.ts +2 -3
- package/menu/menu.d.ts +2 -2
- package/menubar/menubar.d.ts +2 -2
- package/menubar/menubar.min.css +1 -1
- package/menuitem/menuitem.d.ts +3 -4
- package/message/message.d.ts +2 -2
- package/messages/messages.d.ts +2 -2
- package/multiselect/multiselect.d.ts +2 -4
- package/multistatecheckbox/multistatecheckbox.d.ts +2 -3
- package/orderlist/orderlist.cjs.js +33 -2
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.d.ts +7 -3
- package/orderlist/orderlist.esm.js +31 -3
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +33 -2
- package/orderlist/orderlist.min.js +1 -1
- package/organizationchart/organizationchart.cjs.js +2 -1
- package/organizationchart/organizationchart.cjs.min.js +1 -1
- package/organizationchart/organizationchart.d.ts +6 -2
- package/organizationchart/organizationchart.esm.js +2 -1
- package/organizationchart/organizationchart.esm.min.js +1 -1
- package/organizationchart/organizationchart.js +2 -1
- package/organizationchart/organizationchart.min.js +1 -1
- package/overlaypanel/overlaypanel.d.ts +2 -3
- package/overlayservice/overlayservice.d.ts +2 -3
- package/package.json +3 -3
- package/paginator/paginator.cjs.js +1 -1
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.d.ts +5 -17
- package/paginator/paginator.esm.js +1 -1
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +1 -1
- package/paginator/paginator.min.js +1 -1
- package/panel/panel.d.ts +2 -3
- package/panelmenu/panelmenu.d.ts +2 -2
- package/password/password.d.ts +2 -2
- package/picklist/picklist.cjs.js +34 -2
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.d.ts +12 -3
- package/picklist/picklist.esm.js +32 -3
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +34 -2
- package/picklist/picklist.min.js +1 -1
- package/primereact.all.cjs.js +191 -27
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +191 -27
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +191 -27
- package/primereact.all.min.js +1 -1
- package/progressbar/progressbar.d.ts +2 -2
- package/progressspinner/progressspinner.d.ts +2 -2
- package/radiobutton/radiobutton.d.ts +2 -2
- package/rating/rating.d.ts +2 -2
- package/resources/primereact.css +643 -625
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +1 -44
- package/resources/themes/arya-green/theme.css +1 -44
- package/resources/themes/arya-orange/theme.css +1 -44
- package/resources/themes/arya-purple/theme.css +1 -44
- package/resources/themes/bootstrap4-dark-blue/theme.css +0 -44
- package/resources/themes/bootstrap4-dark-purple/theme.css +0 -44
- package/resources/themes/bootstrap4-light-blue/theme.css +0 -44
- package/resources/themes/bootstrap4-light-purple/theme.css +0 -44
- package/resources/themes/fluent-light/theme.css +0 -44
- package/resources/themes/lara-dark-blue/theme.css +0 -44
- package/resources/themes/lara-dark-indigo/theme.css +0 -44
- package/resources/themes/lara-dark-purple/theme.css +0 -44
- package/resources/themes/lara-dark-teal/theme.css +0 -44
- package/resources/themes/lara-light-blue/theme.css +0 -44
- package/resources/themes/lara-light-indigo/theme.css +0 -44
- package/resources/themes/lara-light-purple/theme.css +0 -44
- package/resources/themes/lara-light-teal/theme.css +0 -44
- package/resources/themes/luna-amber/theme.css +0 -44
- package/resources/themes/luna-blue/theme.css +0 -44
- package/resources/themes/luna-green/theme.css +0 -44
- package/resources/themes/luna-pink/theme.css +0 -44
- package/resources/themes/md-dark-deeppurple/theme.css +0 -44
- package/resources/themes/md-dark-indigo/theme.css +0 -44
- package/resources/themes/md-light-deeppurple/theme.css +0 -44
- package/resources/themes/md-light-indigo/theme.css +0 -44
- package/resources/themes/mdc-dark-deeppurple/theme.css +0 -44
- package/resources/themes/mdc-dark-indigo/theme.css +0 -44
- package/resources/themes/mdc-light-deeppurple/theme.css +0 -44
- package/resources/themes/mdc-light-indigo/theme.css +0 -44
- package/resources/themes/mira/theme.css +0 -44
- package/resources/themes/nano/theme.css +0 -44
- package/resources/themes/nova/theme.css +0 -44
- package/resources/themes/nova-accent/theme.css +0 -44
- package/resources/themes/nova-alt/theme.css +0 -44
- package/resources/themes/rhea/theme.css +0 -44
- package/resources/themes/saga-blue/theme.css +0 -44
- package/resources/themes/saga-green/theme.css +0 -44
- package/resources/themes/saga-orange/theme.css +0 -44
- package/resources/themes/saga-purple/theme.css +0 -44
- package/resources/themes/soho-dark/theme.css +0 -44
- package/resources/themes/soho-light/theme.css +0 -44
- package/resources/themes/tailwind-light/theme.css +7 -54
- package/resources/themes/vela-blue/theme.css +0 -44
- package/resources/themes/vela-green/theme.css +0 -44
- package/resources/themes/vela-orange/theme.css +0 -44
- package/resources/themes/vela-purple/theme.css +0 -44
- package/resources/themes/viva-dark/theme.css +0 -44
- package/resources/themes/viva-light/theme.css +0 -44
- package/ripple/ripple.d.ts +2 -2
- package/row/row.d.ts +2 -2
- package/scrollpanel/scrollpanel.d.ts +2 -2
- package/scrolltop/scrolltop.d.ts +2 -2
- package/selectbutton/selectbutton.d.ts +2 -2
- package/selectitem/selectitem.d.ts +0 -1
- package/sidebar/sidebar.d.ts +2 -2
- package/skeleton/skeleton.d.ts +2 -2
- package/slidemenu/slidemenu.d.ts +2 -2
- package/slider/slider.d.ts +2 -2
- package/speeddial/speeddial.d.ts +2 -3
- package/splitbutton/splitbutton.d.ts +2 -2
- package/splitter/splitter.d.ts +2 -2
- package/steps/steps.d.ts +2 -2
- package/styleclass/styleclass.d.ts +2 -2
- package/tabmenu/tabmenu.d.ts +2 -2
- package/tabview/tabview.d.ts +2 -3
- package/tag/tag.d.ts +2 -2
- package/terminal/terminal.d.ts +2 -2
- package/terminalservice/terminalservice.d.ts +2 -3
- package/tieredmenu/tieredmenu.d.ts +2 -2
- package/timeline/timeline.d.ts +2 -2
- package/toast/toast.d.ts +2 -3
- package/togglebutton/togglebutton.d.ts +2 -3
- package/toolbar/toolbar.d.ts +2 -2
- package/tooltip/tooltip.d.ts +2 -2
- package/tooltip/tooltipoptions.d.ts +49 -14
- package/tree/tree.d.ts +2 -11
- package/treeselect/treeselect.d.ts +2 -7
- package/treetable/treetable.d.ts +2 -7
- package/tristatecheckbox/tristatecheckbox.d.ts +2 -2
- package/virtualscroller/virtualscroller.cjs.js +2 -0
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.d.ts +2 -9
- package/virtualscroller/virtualscroller.esm.js +2 -0
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +2 -0
- package/virtualscroller/virtualscroller.min.css +1 -1
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +2 -2
- package/accordion/package.json +0 -7
- package/api/package.json +0 -7
- package/autocomplete/package.json +0 -7
- package/avatar/package.json +0 -7
- package/avatargroup/package.json +0 -7
- package/badge/package.json +0 -7
- package/blockui/package.json +0 -7
- package/breadcrumb/package.json +0 -7
- package/button/package.json +0 -7
- package/calendar/package.json +0 -7
- package/card/package.json +0 -7
- package/carousel/package.json +0 -7
- package/cascadeselect/package.json +0 -7
- package/chart/package.json +0 -7
- package/checkbox/package.json +0 -7
- package/chip/package.json +0 -7
- package/chips/package.json +0 -7
- package/colorpicker/package.json +0 -7
- package/column/package.json +0 -7
- package/columngroup/package.json +0 -7
- package/confirmdialog/package.json +0 -7
- package/confirmpopup/package.json +0 -7
- package/contextmenu/package.json +0 -7
- package/csstransition/package.json +0 -7
- package/datascroller/package.json +0 -7
- package/datatable/package.json +0 -7
- package/dataview/package.json +0 -7
- package/deferredcontent/package.json +0 -7
- package/dialog/package.json +0 -7
- package/divider/package.json +0 -7
- package/dock/package.json +0 -7
- package/dropdown/package.json +0 -7
- package/editor/package.json +0 -7
- package/fieldset/package.json +0 -7
- package/fileupload/package.json +0 -7
- package/galleria/package.json +0 -7
- package/hooks/package.json +0 -7
- package/image/package.json +0 -7
- package/inplace/package.json +0 -7
- package/inputmask/package.json +0 -7
- package/inputnumber/package.json +0 -7
- package/inputswitch/package.json +0 -7
- package/inputtext/package.json +0 -7
- package/inputtextarea/package.json +0 -7
- package/keyfilter/package.json +0 -7
- package/knob/package.json +0 -7
- package/listbox/package.json +0 -7
- package/megamenu/package.json +0 -7
- package/mention/package.json +0 -7
- package/menu/package.json +0 -7
- package/menubar/package.json +0 -7
- package/menuitem/package.json +0 -4
- package/message/package.json +0 -7
- package/messages/package.json +0 -7
- package/multiselect/package.json +0 -7
- package/multistatecheckbox/package.json +0 -7
- package/orderlist/package.json +0 -7
- package/organizationchart/package.json +0 -7
- package/overlaypanel/package.json +0 -7
- package/overlayservice/package.json +0 -7
- package/paginator/package.json +0 -7
- package/panel/package.json +0 -7
- package/panelmenu/package.json +0 -7
- package/password/package.json +0 -7
- package/picklist/package.json +0 -7
- package/portal/package.json +0 -6
- package/progressbar/package.json +0 -7
- package/progressspinner/package.json +0 -7
- package/radiobutton/package.json +0 -7
- package/rating/package.json +0 -7
- package/ripple/package.json +0 -7
- package/row/package.json +0 -7
- package/scrollpanel/package.json +0 -7
- package/scrolltop/package.json +0 -7
- package/selectbutton/package.json +0 -7
- package/selectitem/package.json +0 -4
- package/sidebar/package.json +0 -7
- package/skeleton/package.json +0 -7
- package/slidemenu/package.json +0 -7
- package/slider/package.json +0 -7
- package/speeddial/package.json +0 -7
- package/splitbutton/package.json +0 -7
- package/splitter/package.json +0 -7
- package/steps/package.json +0 -7
- package/styleclass/package.json +0 -7
- package/tabmenu/package.json +0 -7
- package/tabview/package.json +0 -7
- package/tag/package.json +0 -7
- package/terminal/package.json +0 -7
- package/terminalservice/package.json +0 -7
- package/tieredmenu/package.json +0 -7
- package/timeline/package.json +0 -7
- package/toast/package.json +0 -7
- package/togglebutton/package.json +0 -7
- package/toolbar/package.json +0 -7
- package/tooltip/package.json +0 -7
- package/tree/package.json +0 -7
- package/treenode/package.json +0 -4
- package/treeselect/package.json +0 -7
- package/treetable/package.json +0 -7
- package/tristatecheckbox/package.json +0 -7
- package/utils/package.json +0 -7
- package/virtualscroller/package.json +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),r=require("primereact/hooks"),n=require("primereact/utils"),l=require("primereact/button"),i=require("primereact/ripple");function o(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 a=o(e);function u(){return u=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},u.apply(this,arguments)}function c(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 s(e){if(Array.isArray(e))return c(e)}function d(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e,t){if(e){if("string"==typeof e)return c(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)?c(e,t):void 0}}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){return s(e)||d(e)||f(e)||p()}function v(e){if(Array.isArray(e))return e}function g(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,l,i,o,a=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,l=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw l}}return a}}function h(){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 y(e,t){return v(e)||g(e,t)||f(e,t)||h()}var b={defaultProps:{__TYPE:"OrderList",id:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,dataKey:null,onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},getProps:function(e){return n.ObjectUtils.getMergedProps(e,b.defaultProps)},getOtherProps:function(e){return n.ObjectUtils.getDiffProps(e,b.defaultProps)}},E=a.memo((function(e){return a.createElement("div",{className:"p-orderlist-controls"},a.createElement(l.Button,{type:"button",icon:"pi pi-angle-up",onClick:function(t){if(e.selection){for(var r=m(e.value),l=0;l<e.selection.length;l++){var i=n.ObjectUtils.findIndexInList(e.selection[l],r,e.dataKey);if(0===i)break;var o=r[i-1];r[i-1]=r[i],r[i]=o}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"up"})}}}),a.createElement(l.Button,{type:"button",icon:"pi pi-angle-double-up",onClick:function(t){if(e.selection){for(var r=m(e.value),l=0;l<e.selection.length;l++){var i=n.ObjectUtils.findIndexInList(e.selection[l],r,e.dataKey);if(0===i)break;var o=r.splice(i,1)[0];r.unshift(o)}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"top"})}}}),a.createElement(l.Button,{type:"button",icon:"pi pi-angle-down",onClick:function(t){if(e.selection){for(var r=m(e.value),l=e.selection.length-1;l>=0;l--){var i=n.ObjectUtils.findIndexInList(e.selection[l],r,e.dataKey);if(i===r.length-1)break;var o=r[i+1];r[i+1]=r[i],r[i]=o}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"down"})}}}),a.createElement(l.Button,{type:"button",icon:"pi pi-angle-double-down",onClick:function(t){if(e.selection){for(var r=m(e.value),l=e.selection.length-1;l>=0;l--){var i=n.ObjectUtils.findIndexInList(e.selection[l],r,e.dataKey);if(i===r.length-1)break;var o=r.splice(i,1)[0];r.push(o)}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"bottom"})}}}))}));E.displayName="OrderListControls";var O=a.memo((function(e){var t,r=a.useRef(null),l=a.useRef(null),o=a.useRef(null),u=a.useRef(null),c={filter:function(t){return e.onFilterInputChange(t)},reset:function(){return e.resetFilter()}},s=function(t){return-1!==n.ObjectUtils.findIndexInList(t,e.selection,e.dataKey)},d=function(e,t){l.current!==t&&l.current+1!==t&&(o.current=t,n.DomHandler.addClass(e.target,"p-orderlist-droppoint-highlight"),e.preventDefault())},f=function(e){o.current=null,n.DomHandler.removeClass(e.target,"p-orderlist-droppoint-highlight")},p=function(t){var r=l.current>o.current?o.current:0===o.current?0:o.current-1,i=m(e.value);n.ObjectUtils.reorderArray(i,l.current,r),o.current=null,n.DomHandler.removeClass(t.target,"p-orderlist-droppoint-highlight"),e.onChange&&e.onChange({originalEvent:t,value:i})},v=function(e){r.current=!1},g=function(e){if(r.current){var t=u.current.getBoundingClientRect().top+n.DomHandler.getWindowScrollTop(),l=t+u.current.clientHeight-e.pageY,i=e.pageY-t;l<25&&l>0?u.current.scrollTop+=15:i<25&&i>0&&(u.current.scrollTop-=15)}},h=function(e){13===e.which&&e.preventDefault()},y=function(e,t){return a.createElement("li",{key:t,className:"p-orderlist-droppoint",onDragOver:function(t){return d(t,e+1)},onDragLeave:f,onDrop:p})},b=e.header?a.createElement("div",{className:"p-orderlist-header"},e.header):null,E=function(){if(e.filter){var t=a.createElement("div",{className:"p-orderlist-filter"},a.createElement("input",{type:"text",value:e.filterValue,onChange:e.onFilter,onKeyDown:h,placeholder:e.placeholder,className:"p-orderlist-filter-input p-inputtext p-component"}),a.createElement("span",{className:"p-orderlist-filter-icon pi pi-search"}));if(e.filterTemplate)t=n.ObjectUtils.getJSXElement(e.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:e.onFilter,onKeyDown:h},filterOptions:c,iconClassName:"p-orderlist-filter-icon pi pi-search",element:t,props:e});return a.createElement("div",{className:"p-orderlist-filter-container"},t)}return null}(),O=(t=e.value?e.value.map((function(t,o){var u=e.itemTemplate?e.itemTemplate(t):t,c=n.classNames("p-orderlist-item",{"p-highlight":s(t)},e.className),d=JSON.stringify(t);if(e.dragdrop){var f=[];return 0===o&&f.push(y(t,o)),f.push(a.createElement("li",{key:d,className:c,onClick:function(r){return e.onItemClick({originalEvent:r,value:t,index:o})},onKeyDown:function(r){return e.onItemKeyDown({originalEvent:r,value:t,index:o})},role:"option","aria-selected":s(t),draggable:"true",onDragStart:function(t){return n=t,i=o,r.current=!0,l.current=i,void(e.dragdropScope&&n.dataTransfer.setData("text","orderlist"));var n,i},onDragEnd:v,tabIndex:e.tabIndex},u,a.createElement(i.Ripple,null))),f.push(y(o,d+"_droppoint")),f}return a.createElement("li",{key:d,className:c,role:"option","aria-selected":s(t),onClick:function(r){return e.onItemClick({originalEvent:r,value:t,index:o})},onKeyDown:function(r){return e.onItemKeyDown({originalEvent:r,value:t,index:o})},tabIndex:e.tabIndex},u)})):null,a.createElement("ul",{ref:u,className:"p-orderlist-list",style:e.listStyle,onDragOver:g,role:"listbox","aria-multiselectable":!0},t));return a.createElement("div",{className:"p-orderlist-list-container"},b,E,O)}));O.displayName="OrderListSubList";var I=a.memo(a.forwardRef((function(e,l){var i=b.getProps(e),o=y(a.useState([]),2),c=o[0],s=o[1],d=y(a.useState(""),2),f=d[0],p=d[1],v=n.ObjectUtils.isNotEmpty(f),g=a.useRef(null),h=a.useRef(null),I=function(e){var t,r=e.originalEvent.metaKey||e.originalEvent.ctrlKey,l=n.ObjectUtils.findIndexInList(e.value,c,i.dataKey);t=-1!==l?r?c.filter((function(e,t){return t!==l})):[e.value]:r?[].concat(m(c),[e.value]):[e.value],s(t)},C=function e(t){var r=t.nextElementSibling;return r?n.DomHandler.hasClass(r,"p-orderlist-item")?r:e(r):null},D=function e(t){var r=t.previousElementSibling;return r?n.DomHandler.hasClass(r,"p-orderlist-item")?r:e(r):null},w=function(){var e=n.DomHandler.findSingle(g.current,".p-orderlist-list"),t=n.DomHandler.find(e,".p-orderlist-item.p-highlight");if(t&&t.length)switch(h.current){case"up":n.DomHandler.scrollInView(e,t[0]);break;case"top":e.scrollTop=0;break;case"down":n.DomHandler.scrollInView(e,t[t.length-1]);break;case"bottom":setTimeout((function(){return e.scrollTop=e.scrollHeight}),100)}};a.useImperativeHandle(l,(function(){return{props:i,getElement:function(){return g.current}}})),r.useUpdateEffect((function(){h.current&&(w(),h.current=null)}));var j=b.getOtherProps(i),x=n.classNames("p-orderlist p-component",i.className),N=function(){if(v){var e=f.trim().toLocaleLowerCase(i.filterLocale),r=i.filterBy?i.filterBy.split(","):[];return t.FilterService.filter(i.value,r,e,i.filterMatchMode,i.filterLocale)}return i.value}();return a.createElement("div",u({ref:g,id:i.id,className:x,style:i.style},j),a.createElement(E,{value:N,selection:c,onReorder:function(e){i.onChange&&i.onChange({event:e.originalEvent,value:e.value}),h.current=e.direction},dataKey:i.dataKey}),a.createElement(O,{value:N,selection:c,onItemClick:I,onItemKeyDown:function(e){var t=e.originalEvent,r=t.currentTarget;switch(t.which){case 40:var n=C(r);n&&n.focus(),t.preventDefault();break;case 38:var l=D(r);l&&l.focus(),t.preventDefault();break;case 13:I(e),t.preventDefault()}},onFilterInputChange:function(e){var t=e.target.value;p(t),i.onFilter&&i.onFilter({originalEvent:e,filter:t})},itemTemplate:i.itemTemplate,filter:i.filter,onFilter:function(e){var t=e.target.value;p(t),i.onFilter&&i.onFilter({originalEvent:e,value:t})},resetFilter:function(){p(""),i.onFilter&&i.onFilter({filter:""})},filterTemplate:i.filterTemplate,header:i.header,listStyle:i.listStyle,dataKey:i.dataKey,dragdrop:i.dragdrop,onChange:i.onChange,tabIndex:i.tabIndex}))})));I.displayName="OrderList",exports.OrderList=I;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),r=require("primereact/hooks"),n=require("primereact/utils"),l=require("primereact/button"),i=require("primereact/ripple");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(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 u=a(e),c=o(t);function s(){return s=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},s.apply(this,arguments)}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p(e){if(Array.isArray(e))return d(e)}function f(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function m(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function v(){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 g(e){return p(e)||f(e)||m(e)||v()}function h(e){if(Array.isArray(e))return e}function y(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,l,i,o,a=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,l=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw l}}return a}}function b(){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(e,t){return h(e)||y(e,t)||m(e,t)||b()}var I={defaultProps:{__TYPE:"OrderList",id:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,dataKey:null,breakpoint:"960px",onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},getProps:function(e){return n.ObjectUtils.getMergedProps(e,I.defaultProps)},getOtherProps:function(e){return n.ObjectUtils.getDiffProps(e,I.defaultProps)}},O=u.memo((function(e){return u.createElement("div",{className:"p-orderlist-controls"},u.createElement(l.Button,{type:"button",icon:"pi pi-angle-up",onClick:function(t){if(e.selection){for(var r=g(e.value),l=0;l<e.selection.length;l++){var i=n.ObjectUtils.findIndexInList(e.selection[l],r,e.dataKey);if(0===i)break;var o=r[i-1];r[i-1]=r[i],r[i]=o}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"up"})}}}),u.createElement(l.Button,{type:"button",icon:"pi pi-angle-double-up",onClick:function(t){if(e.selection){for(var r=g(e.value),l=0;l<e.selection.length;l++){var i=n.ObjectUtils.findIndexInList(e.selection[l],r,e.dataKey);if(0===i)break;var o=r.splice(i,1)[0];r.unshift(o)}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"top"})}}}),u.createElement(l.Button,{type:"button",icon:"pi pi-angle-down",onClick:function(t){if(e.selection){for(var r=g(e.value),l=e.selection.length-1;l>=0;l--){var i=n.ObjectUtils.findIndexInList(e.selection[l],r,e.dataKey);if(i===r.length-1)break;var o=r[i+1];r[i+1]=r[i],r[i]=o}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"down"})}}}),u.createElement(l.Button,{type:"button",icon:"pi pi-angle-double-down",onClick:function(t){if(e.selection){for(var r=g(e.value),l=e.selection.length-1;l>=0;l--){var i=n.ObjectUtils.findIndexInList(e.selection[l],r,e.dataKey);if(i===r.length-1)break;var o=r.splice(i,1)[0];r.push(o)}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"bottom"})}}}))}));O.displayName="OrderListControls";var D=u.memo((function(e){var t,r=u.useRef(null),l=u.useRef(null),o=u.useRef(null),a=u.useRef(null),c={filter:function(t){return e.onFilterInputChange(t)},reset:function(){return e.resetFilter()}},s=function(t){return-1!==n.ObjectUtils.findIndexInList(t,e.selection,e.dataKey)},d=function(e,t){l.current!==t&&l.current+1!==t&&(o.current=t,n.DomHandler.addClass(e.target,"p-orderlist-droppoint-highlight"),e.preventDefault())},p=function(e){o.current=null,n.DomHandler.removeClass(e.target,"p-orderlist-droppoint-highlight")},f=function(t){var r=l.current>o.current?o.current:0===o.current?0:o.current-1,i=g(e.value);n.ObjectUtils.reorderArray(i,l.current,r),o.current=null,n.DomHandler.removeClass(t.target,"p-orderlist-droppoint-highlight"),e.onChange&&e.onChange({originalEvent:t,value:i})},m=function(e){r.current=!1},v=function(e){if(r.current){var t=a.current.getBoundingClientRect().top+n.DomHandler.getWindowScrollTop(),l=t+a.current.clientHeight-e.pageY,i=e.pageY-t;l<25&&l>0?a.current.scrollTop+=15:i<25&&i>0&&(a.current.scrollTop-=15)}},h=function(e){13===e.which&&e.preventDefault()},y=function(e,t){return u.createElement("li",{key:t,className:"p-orderlist-droppoint",onDragOver:function(t){return d(t,e+1)},onDragLeave:p,onDrop:f})},b=e.header?u.createElement("div",{className:"p-orderlist-header"},e.header):null,E=function(){if(e.filter){var t=u.createElement("div",{className:"p-orderlist-filter"},u.createElement("input",{type:"text",value:e.filterValue,onChange:e.onFilter,onKeyDown:h,placeholder:e.placeholder,className:"p-orderlist-filter-input p-inputtext p-component"}),u.createElement("span",{className:"p-orderlist-filter-icon pi pi-search"}));if(e.filterTemplate)t=n.ObjectUtils.getJSXElement(e.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:e.onFilter,onKeyDown:h},filterOptions:c,iconClassName:"p-orderlist-filter-icon pi pi-search",element:t,props:e});return u.createElement("div",{className:"p-orderlist-filter-container"},t)}return null}(),I=(t=e.value?e.value.map((function(t,o){var a=e.itemTemplate?e.itemTemplate(t):t,c=n.classNames("p-orderlist-item",{"p-highlight":s(t)},e.className),d=JSON.stringify(t);if(e.dragdrop){var p=[];return 0===o&&p.push(y(t,o)),p.push(u.createElement("li",{key:d,className:c,onClick:function(r){return e.onItemClick({originalEvent:r,value:t,index:o})},onKeyDown:function(r){return e.onItemKeyDown({originalEvent:r,value:t,index:o})},role:"option","aria-selected":s(t),draggable:"true",onDragStart:function(t){return n=t,i=o,r.current=!0,l.current=i,void(e.dragdropScope&&n.dataTransfer.setData("text","orderlist"));var n,i},onDragEnd:m,tabIndex:e.tabIndex},a,u.createElement(i.Ripple,null))),p.push(y(o,d+"_droppoint")),p}return u.createElement("li",{key:d,className:c,role:"option","aria-selected":s(t),onClick:function(r){return e.onItemClick({originalEvent:r,value:t,index:o})},onKeyDown:function(r){return e.onItemKeyDown({originalEvent:r,value:t,index:o})},tabIndex:e.tabIndex},a)})):null,u.createElement("ul",{ref:a,className:"p-orderlist-list",style:e.listStyle,onDragOver:v,role:"listbox","aria-multiselectable":!0},t));return u.createElement("div",{className:"p-orderlist-list-container"},b,E,I)}));D.displayName="OrderListSubList";var C=u.memo(u.forwardRef((function(e,l){var i=I.getProps(e),o=E(u.useState([]),2),a=o[0],d=o[1],p=E(u.useState(""),2),f=p[0],m=p[1],v=E(u.useState(null),2),h=v[0],y=v[1],b=n.ObjectUtils.isNotEmpty(f),C=u.useRef(null),w=u.useRef(null),x=u.useRef(null),j=function(e){var t,r=e.originalEvent.metaKey||e.originalEvent.ctrlKey,l=n.ObjectUtils.findIndexInList(e.value,a,i.dataKey);t=-1!==l?r?a.filter((function(e,t){return t!==l})):[e.value]:r?[].concat(g(a),[e.value]):[e.value],d(t)},S=function e(t){var r=t.nextElementSibling;return r?n.DomHandler.hasClass(r,"p-orderlist-item")?r:e(r):null},k=function e(t){var r=t.previousElementSibling;return r?n.DomHandler.hasClass(r,"p-orderlist-item")?r:e(r):null},N=function(){var e=n.DomHandler.findSingle(C.current,".p-orderlist-list"),t=n.DomHandler.find(e,".p-orderlist-item.p-highlight");if(t&&t.length)switch(x.current){case"up":n.DomHandler.scrollInView(e,t[0]);break;case"top":e.scrollTop=0;break;case"down":n.DomHandler.scrollInView(e,t[t.length-1]);break;case"bottom":setTimeout((function(){return e.scrollTop=e.scrollHeight}),100)}},T=function(){if(!w.current){w.current=n.DomHandler.createInlineStyle(c.default.nonce);var e="\n@media screen and (max-width: ".concat(i.breakpoint,") {\n .p-orderlist[").concat(h,"] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(h,"] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(h,"] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(h,"] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");w.current.innerHTML=e}};u.useImperativeHandle(l,(function(){return{props:i,getElement:function(){return C.current}}})),r.useMountEffect((function(){!h&&y(n.UniqueComponentId())})),r.useUpdateEffect((function(){return h&&(C.current.setAttribute(h,""),T()),function(){w.current=n.DomHandler.removeInlineStyle(w.current)}}),[h,i.breakpoint]),r.useUpdateEffect((function(){x.current&&(N(),x.current=null)}));var K=I.getOtherProps(i),L=n.classNames("p-orderlist p-component",i.className),R=function(){if(b){var e=f.trim().toLocaleLowerCase(i.filterLocale),r=i.filterBy?i.filterBy.split(","):[];return t.FilterService.filter(i.value,r,e,i.filterMatchMode,i.filterLocale)}return i.value}();return u.createElement("div",s({ref:C,id:i.id,className:L,style:i.style},K),u.createElement(O,{value:R,selection:a,onReorder:function(e){i.onChange&&i.onChange({event:e.originalEvent,value:e.value}),x.current=e.direction},dataKey:i.dataKey}),u.createElement(D,{value:R,selection:a,onItemClick:j,onItemKeyDown:function(e){var t=e.originalEvent,r=t.currentTarget;switch(t.which){case 40:var n=S(r);n&&n.focus(),t.preventDefault();break;case 38:var l=k(r);l&&l.focus(),t.preventDefault();break;case 13:j(e),t.preventDefault()}},onFilterInputChange:function(e){var t=e.target.value;m(t),i.onFilter&&i.onFilter({originalEvent:e,filter:t})},itemTemplate:i.itemTemplate,filter:i.filter,onFilter:function(e){var t=e.target.value;m(t),i.onFilter&&i.onFilter({originalEvent:e,value:t})},resetFilter:function(){m(""),i.onFilter&&i.onFilter({filter:""})},filterTemplate:i.filterTemplate,header:i.header,listStyle:i.listStyle,dataKey:i.dataKey,dragdrop:i.dragdrop,onChange:i.onChange,tabIndex:i.tabIndex}))})));C.displayName="OrderList",exports.OrderList=C;
|
package/orderlist/orderlist.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* OrderList is used to sort a collection.
|
|
4
4
|
*
|
|
5
|
-
* [Live Demo](https://www.
|
|
5
|
+
* [Live Demo](https://www.primereact.org/orderlist/)
|
|
6
6
|
*
|
|
7
7
|
* @module orderlist
|
|
8
8
|
*
|
|
@@ -27,7 +27,6 @@ interface OrderListChangeEvent {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Custom filter options.
|
|
30
|
-
* @group Misc
|
|
31
30
|
*/
|
|
32
31
|
interface OrderListFilterOptions {
|
|
33
32
|
/**
|
|
@@ -66,6 +65,11 @@ export interface OrderListProps extends Omit<React.DetailedHTMLProps<React.HTMLA
|
|
|
66
65
|
* Name of the field that uniquely identifies the a record in the data.
|
|
67
66
|
*/
|
|
68
67
|
dataKey?: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* The breakpoint to define the maximum width boundary when responsiveness is enabled.
|
|
70
|
+
* @defaultValue '960px'.
|
|
71
|
+
*/
|
|
72
|
+
breakpoint?: string | undefined;
|
|
69
73
|
/**
|
|
70
74
|
* When specified, displays an input field to filter the items on keyup.
|
|
71
75
|
* @defaultValue false
|
|
@@ -116,7 +120,7 @@ export interface OrderListProps extends Omit<React.DetailedHTMLProps<React.HTMLA
|
|
|
116
120
|
*
|
|
117
121
|
* _OrderList is used to sort a collection._
|
|
118
122
|
*
|
|
119
|
-
* [Live Demo](https://www.
|
|
123
|
+
* [Live Demo](https://www.primereact.org/orderlist/)
|
|
120
124
|
* --- ---
|
|
121
125
|
* 
|
|
122
126
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { FilterService } from 'primereact/api';
|
|
3
|
-
import { useUpdateEffect } from 'primereact/hooks';
|
|
4
|
-
import { ObjectUtils, DomHandler, classNames } from 'primereact/utils';
|
|
2
|
+
import PrimeReact, { FilterService } from 'primereact/api';
|
|
3
|
+
import { useMountEffect, useUpdateEffect } from 'primereact/hooks';
|
|
4
|
+
import { ObjectUtils, DomHandler, classNames, UniqueComponentId } from 'primereact/utils';
|
|
5
5
|
import { Button } from 'primereact/button';
|
|
6
6
|
import { Ripple } from 'primereact/ripple';
|
|
7
7
|
|
|
@@ -103,6 +103,7 @@ var OrderListBase = {
|
|
|
103
103
|
dragdrop: false,
|
|
104
104
|
tabIndex: 0,
|
|
105
105
|
dataKey: null,
|
|
106
|
+
breakpoint: '960px',
|
|
106
107
|
onChange: null,
|
|
107
108
|
itemTemplate: null,
|
|
108
109
|
filter: false,
|
|
@@ -450,8 +451,13 @@ var OrderList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
450
451
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
451
452
|
filterValueState = _React$useState4[0],
|
|
452
453
|
setFilterValueState = _React$useState4[1];
|
|
454
|
+
var _React$useState5 = React.useState(null),
|
|
455
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
456
|
+
attributeSelectorState = _React$useState6[0],
|
|
457
|
+
setAttributeSelectorState = _React$useState6[1];
|
|
453
458
|
var hasFilter = ObjectUtils.isNotEmpty(filterValueState);
|
|
454
459
|
var elementRef = React.useRef(null);
|
|
460
|
+
var styleElementRef = React.useRef(null);
|
|
455
461
|
var reorderDirection = React.useRef(null);
|
|
456
462
|
var onItemClick = function onItemClick(event) {
|
|
457
463
|
var metaKey = event.originalEvent.metaKey || event.originalEvent.ctrlKey;
|
|
@@ -562,6 +568,16 @@ var OrderList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
562
568
|
}
|
|
563
569
|
}
|
|
564
570
|
};
|
|
571
|
+
var createStyle = function createStyle() {
|
|
572
|
+
if (!styleElementRef.current) {
|
|
573
|
+
styleElementRef.current = DomHandler.createInlineStyle(PrimeReact.nonce);
|
|
574
|
+
var innerHTML = "\n@media screen and (max-width: ".concat(props.breakpoint, ") {\n .p-orderlist[").concat(attributeSelectorState, "] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(attributeSelectorState, "] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(attributeSelectorState, "] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(attributeSelectorState, "] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");
|
|
575
|
+
styleElementRef.current.innerHTML = innerHTML;
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
var destroyStyle = function destroyStyle() {
|
|
579
|
+
styleElementRef.current = DomHandler.removeInlineStyle(styleElementRef.current);
|
|
580
|
+
};
|
|
565
581
|
React.useImperativeHandle(ref, function () {
|
|
566
582
|
return {
|
|
567
583
|
props: props,
|
|
@@ -570,6 +586,18 @@ var OrderList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
570
586
|
}
|
|
571
587
|
};
|
|
572
588
|
});
|
|
589
|
+
useMountEffect(function () {
|
|
590
|
+
!attributeSelectorState && setAttributeSelectorState(UniqueComponentId());
|
|
591
|
+
});
|
|
592
|
+
useUpdateEffect(function () {
|
|
593
|
+
if (attributeSelectorState) {
|
|
594
|
+
elementRef.current.setAttribute(attributeSelectorState, '');
|
|
595
|
+
createStyle();
|
|
596
|
+
}
|
|
597
|
+
return function () {
|
|
598
|
+
destroyStyle();
|
|
599
|
+
};
|
|
600
|
+
}, [attributeSelectorState, props.breakpoint]);
|
|
573
601
|
useUpdateEffect(function () {
|
|
574
602
|
if (reorderDirection.current) {
|
|
575
603
|
updateListScroll();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{FilterService as t}from"primereact/api";import{useUpdateEffect as r}from"primereact/hooks";import{ObjectUtils as n,DomHandler as l,classNames as i}from"primereact/utils";import{Button as o}from"primereact/button";import{Ripple as a}from"primereact/ripple";function u(){return u=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},u.apply(this,arguments)}function c(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 s(e){if(Array.isArray(e))return c(e)}function p(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e,t){if(e){if("string"==typeof e)return c(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)?c(e,t):void 0}}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){return s(e)||p(e)||f(e)||d()}function v(e){if(Array.isArray(e))return e}function g(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,l,i,o,a=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,l=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw l}}return a}}function h(){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 y(e,t){return v(e)||g(e,t)||f(e,t)||h()}var b={defaultProps:{__TYPE:"OrderList",id:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,dataKey:null,onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},getProps:function(e){return n.getMergedProps(e,b.defaultProps)},getOtherProps:function(e){return n.getDiffProps(e,b.defaultProps)}},E=e.memo((function(t){return e.createElement("div",{className:"p-orderlist-controls"},e.createElement(o,{type:"button",icon:"pi pi-angle-up",onClick:function(e){if(t.selection){for(var r=m(t.value),l=0;l<t.selection.length;l++){var i=n.findIndexInList(t.selection[l],r,t.dataKey);if(0===i)break;var o=r[i-1];r[i-1]=r[i],r[i]=o}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"up"})}}}),e.createElement(o,{type:"button",icon:"pi pi-angle-double-up",onClick:function(e){if(t.selection){for(var r=m(t.value),l=0;l<t.selection.length;l++){var i=n.findIndexInList(t.selection[l],r,t.dataKey);if(0===i)break;var o=r.splice(i,1)[0];r.unshift(o)}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"top"})}}}),e.createElement(o,{type:"button",icon:"pi pi-angle-down",onClick:function(e){if(t.selection){for(var r=m(t.value),l=t.selection.length-1;l>=0;l--){var i=n.findIndexInList(t.selection[l],r,t.dataKey);if(i===r.length-1)break;var o=r[i+1];r[i+1]=r[i],r[i]=o}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"down"})}}}),e.createElement(o,{type:"button",icon:"pi pi-angle-double-down",onClick:function(e){if(t.selection){for(var r=m(t.value),l=t.selection.length-1;l>=0;l--){var i=n.findIndexInList(t.selection[l],r,t.dataKey);if(i===r.length-1)break;var o=r.splice(i,1)[0];r.push(o)}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"bottom"})}}}))}));E.displayName="OrderListControls";var I=e.memo((function(t){var r,o=e.useRef(null),u=e.useRef(null),c=e.useRef(null),s=e.useRef(null),p={filter:function(e){return t.onFilterInputChange(e)},reset:function(){return t.resetFilter()}},f=function(e){return-1!==n.findIndexInList(e,t.selection,t.dataKey)},d=function(e,t){u.current!==t&&u.current+1!==t&&(c.current=t,l.addClass(e.target,"p-orderlist-droppoint-highlight"),e.preventDefault())},v=function(e){c.current=null,l.removeClass(e.target,"p-orderlist-droppoint-highlight")},g=function(e){var r=u.current>c.current?c.current:0===c.current?0:c.current-1,i=m(t.value);n.reorderArray(i,u.current,r),c.current=null,l.removeClass(e.target,"p-orderlist-droppoint-highlight"),t.onChange&&t.onChange({originalEvent:e,value:i})},h=function(e){o.current=!1},y=function(e){if(o.current){var t=s.current.getBoundingClientRect().top+l.getWindowScrollTop(),r=t+s.current.clientHeight-e.pageY,n=e.pageY-t;r<25&&r>0?s.current.scrollTop+=15:n<25&&n>0&&(s.current.scrollTop-=15)}},b=function(e){13===e.which&&e.preventDefault()},E=function(t,r){return e.createElement("li",{key:r,className:"p-orderlist-droppoint",onDragOver:function(e){return d(e,t+1)},onDragLeave:v,onDrop:g})},I=t.header?e.createElement("div",{className:"p-orderlist-header"},t.header):null,C=function(){if(t.filter){var r=e.createElement("div",{className:"p-orderlist-filter"},e.createElement("input",{type:"text",value:t.filterValue,onChange:t.onFilter,onKeyDown:b,placeholder:t.placeholder,className:"p-orderlist-filter-input p-inputtext p-component"}),e.createElement("span",{className:"p-orderlist-filter-icon pi pi-search"}));if(t.filterTemplate)r=n.getJSXElement(t.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:t.onFilter,onKeyDown:b},filterOptions:p,iconClassName:"p-orderlist-filter-icon pi pi-search",element:r,props:t});return e.createElement("div",{className:"p-orderlist-filter-container"},r)}return null}(),w=(r=t.value?t.value.map((function(r,n){var l=t.itemTemplate?t.itemTemplate(r):r,c=i("p-orderlist-item",{"p-highlight":f(r)},t.className),s=JSON.stringify(r);if(t.dragdrop){var p=[];return 0===n&&p.push(E(r,n)),p.push(e.createElement("li",{key:s,className:c,onClick:function(e){return t.onItemClick({originalEvent:e,value:r,index:n})},onKeyDown:function(e){return t.onItemKeyDown({originalEvent:e,value:r,index:n})},role:"option","aria-selected":f(r),draggable:"true",onDragStart:function(e){return r=e,l=n,o.current=!0,u.current=l,void(t.dragdropScope&&r.dataTransfer.setData("text","orderlist"));var r,l},onDragEnd:h,tabIndex:t.tabIndex},l,e.createElement(a,null))),p.push(E(n,s+"_droppoint")),p}return e.createElement("li",{key:s,className:c,role:"option","aria-selected":f(r),onClick:function(e){return t.onItemClick({originalEvent:e,value:r,index:n})},onKeyDown:function(e){return t.onItemKeyDown({originalEvent:e,value:r,index:n})},tabIndex:t.tabIndex},l)})):null,e.createElement("ul",{ref:s,className:"p-orderlist-list",style:t.listStyle,onDragOver:y,role:"listbox","aria-multiselectable":!0},r));return e.createElement("div",{className:"p-orderlist-list-container"},I,C,w)}));I.displayName="OrderListSubList";var C=e.memo(e.forwardRef((function(o,a){var c=b.getProps(o),s=y(e.useState([]),2),p=s[0],f=s[1],d=y(e.useState(""),2),v=d[0],g=d[1],h=n.isNotEmpty(v),C=e.useRef(null),w=e.useRef(null),x=function(e){var t,r=e.originalEvent.metaKey||e.originalEvent.ctrlKey,l=n.findIndexInList(e.value,p,c.dataKey);t=-1!==l?r?p.filter((function(e,t){return t!==l})):[e.value]:r?[].concat(m(p),[e.value]):[e.value],f(t)},N=function e(t){var r=t.nextElementSibling;return r?l.hasClass(r,"p-orderlist-item")?r:e(r):null},S=function e(t){var r=t.previousElementSibling;return r?l.hasClass(r,"p-orderlist-item")?r:e(r):null},k=function(){var e=l.findSingle(C.current,".p-orderlist-list"),t=l.find(e,".p-orderlist-item.p-highlight");if(t&&t.length)switch(w.current){case"up":l.scrollInView(e,t[0]);break;case"top":e.scrollTop=0;break;case"down":l.scrollInView(e,t[t.length-1]);break;case"bottom":setTimeout((function(){return e.scrollTop=e.scrollHeight}),100)}};e.useImperativeHandle(a,(function(){return{props:c,getElement:function(){return C.current}}})),r((function(){w.current&&(k(),w.current=null)}));var T=b.getOtherProps(c),D=i("p-orderlist p-component",c.className),K=function(){if(h){var e=v.trim().toLocaleLowerCase(c.filterLocale),r=c.filterBy?c.filterBy.split(","):[];return t.filter(c.value,r,e,c.filterMatchMode,c.filterLocale)}return c.value}();return e.createElement("div",u({ref:C,id:c.id,className:D,style:c.style},T),e.createElement(E,{value:K,selection:p,onReorder:function(e){c.onChange&&c.onChange({event:e.originalEvent,value:e.value}),w.current=e.direction},dataKey:c.dataKey}),e.createElement(I,{value:K,selection:p,onItemClick:x,onItemKeyDown:function(e){var t=e.originalEvent,r=t.currentTarget;switch(t.which){case 40:var n=N(r);n&&n.focus(),t.preventDefault();break;case 38:var l=S(r);l&&l.focus(),t.preventDefault();break;case 13:x(e),t.preventDefault()}},onFilterInputChange:function(e){var t=e.target.value;g(t),c.onFilter&&c.onFilter({originalEvent:e,filter:t})},itemTemplate:c.itemTemplate,filter:c.filter,onFilter:function(e){var t=e.target.value;g(t),c.onFilter&&c.onFilter({originalEvent:e,value:t})},resetFilter:function(){g(""),c.onFilter&&c.onFilter({filter:""})},filterTemplate:c.filterTemplate,header:c.header,listStyle:c.listStyle,dataKey:c.dataKey,dragdrop:c.dragdrop,onChange:c.onChange,tabIndex:c.tabIndex}))})));C.displayName="OrderList";export{C as OrderList};
|
|
1
|
+
import*as e from"react";import t,{FilterService as r}from"primereact/api";import{useMountEffect as n,useUpdateEffect as i}from"primereact/hooks";import{ObjectUtils as l,DomHandler as o,classNames as a,UniqueComponentId as u}from"primereact/utils";import{Button as c}from"primereact/button";import{Ripple as s}from"primereact/ripple";function p(){return p=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},p.apply(this,arguments)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e){if(Array.isArray(e))return f(e)}function m(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function v(e,t){if(e){if("string"==typeof e)return f(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)?f(e,t):void 0}}function g(){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){return d(e)||m(e)||v(e)||g()}function y(e){if(Array.isArray(e))return e}function b(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,l,o,a=[],u=!0,c=!1;try{if(l=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=l.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function E(){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 y(e)||b(e,t)||v(e,t)||E()}var C={defaultProps:{__TYPE:"OrderList",id:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,dataKey:null,breakpoint:"960px",onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},getProps:function(e){return l.getMergedProps(e,C.defaultProps)},getOtherProps:function(e){return l.getDiffProps(e,C.defaultProps)}},w=e.memo((function(t){return e.createElement("div",{className:"p-orderlist-controls"},e.createElement(c,{type:"button",icon:"pi pi-angle-up",onClick:function(e){if(t.selection){for(var r=h(t.value),n=0;n<t.selection.length;n++){var i=l.findIndexInList(t.selection[n],r,t.dataKey);if(0===i)break;var o=r[i-1];r[i-1]=r[i],r[i]=o}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"up"})}}}),e.createElement(c,{type:"button",icon:"pi pi-angle-double-up",onClick:function(e){if(t.selection){for(var r=h(t.value),n=0;n<t.selection.length;n++){var i=l.findIndexInList(t.selection[n],r,t.dataKey);if(0===i)break;var o=r.splice(i,1)[0];r.unshift(o)}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"top"})}}}),e.createElement(c,{type:"button",icon:"pi pi-angle-down",onClick:function(e){if(t.selection){for(var r=h(t.value),n=t.selection.length-1;n>=0;n--){var i=l.findIndexInList(t.selection[n],r,t.dataKey);if(i===r.length-1)break;var o=r[i+1];r[i+1]=r[i],r[i]=o}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"down"})}}}),e.createElement(c,{type:"button",icon:"pi pi-angle-double-down",onClick:function(e){if(t.selection){for(var r=h(t.value),n=t.selection.length-1;n>=0;n--){var i=l.findIndexInList(t.selection[n],r,t.dataKey);if(i===r.length-1)break;var o=r.splice(i,1)[0];r.push(o)}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"bottom"})}}}))}));w.displayName="OrderListControls";var x=e.memo((function(t){var r,n=e.useRef(null),i=e.useRef(null),u=e.useRef(null),c=e.useRef(null),p={filter:function(e){return t.onFilterInputChange(e)},reset:function(){return t.resetFilter()}},f=function(e){return-1!==l.findIndexInList(e,t.selection,t.dataKey)},d=function(e,t){i.current!==t&&i.current+1!==t&&(u.current=t,o.addClass(e.target,"p-orderlist-droppoint-highlight"),e.preventDefault())},m=function(e){u.current=null,o.removeClass(e.target,"p-orderlist-droppoint-highlight")},v=function(e){var r=i.current>u.current?u.current:0===u.current?0:u.current-1,n=h(t.value);l.reorderArray(n,i.current,r),u.current=null,o.removeClass(e.target,"p-orderlist-droppoint-highlight"),t.onChange&&t.onChange({originalEvent:e,value:n})},g=function(e){n.current=!1},y=function(e){if(n.current){var t=c.current.getBoundingClientRect().top+o.getWindowScrollTop(),r=t+c.current.clientHeight-e.pageY,i=e.pageY-t;r<25&&r>0?c.current.scrollTop+=15:i<25&&i>0&&(c.current.scrollTop-=15)}},b=function(e){13===e.which&&e.preventDefault()},E=function(t,r){return e.createElement("li",{key:r,className:"p-orderlist-droppoint",onDragOver:function(e){return d(e,t+1)},onDragLeave:m,onDrop:v})},I=t.header?e.createElement("div",{className:"p-orderlist-header"},t.header):null,C=function(){if(t.filter){var r=e.createElement("div",{className:"p-orderlist-filter"},e.createElement("input",{type:"text",value:t.filterValue,onChange:t.onFilter,onKeyDown:b,placeholder:t.placeholder,className:"p-orderlist-filter-input p-inputtext p-component"}),e.createElement("span",{className:"p-orderlist-filter-icon pi pi-search"}));if(t.filterTemplate)r=l.getJSXElement(t.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:t.onFilter,onKeyDown:b},filterOptions:p,iconClassName:"p-orderlist-filter-icon pi pi-search",element:r,props:t});return e.createElement("div",{className:"p-orderlist-filter-container"},r)}return null}(),w=(r=t.value?t.value.map((function(r,l){var o=t.itemTemplate?t.itemTemplate(r):r,u=a("p-orderlist-item",{"p-highlight":f(r)},t.className),c=JSON.stringify(r);if(t.dragdrop){var p=[];return 0===l&&p.push(E(r,l)),p.push(e.createElement("li",{key:c,className:u,onClick:function(e){return t.onItemClick({originalEvent:e,value:r,index:l})},onKeyDown:function(e){return t.onItemKeyDown({originalEvent:e,value:r,index:l})},role:"option","aria-selected":f(r),draggable:"true",onDragStart:function(e){return r=e,o=l,n.current=!0,i.current=o,void(t.dragdropScope&&r.dataTransfer.setData("text","orderlist"));var r,o},onDragEnd:g,tabIndex:t.tabIndex},o,e.createElement(s,null))),p.push(E(l,c+"_droppoint")),p}return e.createElement("li",{key:c,className:u,role:"option","aria-selected":f(r),onClick:function(e){return t.onItemClick({originalEvent:e,value:r,index:l})},onKeyDown:function(e){return t.onItemKeyDown({originalEvent:e,value:r,index:l})},tabIndex:t.tabIndex},o)})):null,e.createElement("ul",{ref:c,className:"p-orderlist-list",style:t.listStyle,onDragOver:y,role:"listbox","aria-multiselectable":!0},r));return e.createElement("div",{className:"p-orderlist-list-container"},I,C,w)}));x.displayName="OrderListSubList";var S=e.memo(e.forwardRef((function(c,s){var f=C.getProps(c),d=I(e.useState([]),2),m=d[0],v=d[1],g=I(e.useState(""),2),y=g[0],b=g[1],E=I(e.useState(null),2),S=E[0],k=E[1],N=l.isNotEmpty(y),T=e.useRef(null),D=e.useRef(null),K=e.useRef(null),L=function(e){var t,r=e.originalEvent.metaKey||e.originalEvent.ctrlKey,n=l.findIndexInList(e.value,m,f.dataKey);t=-1!==n?r?m.filter((function(e,t){return t!==n})):[e.value]:r?[].concat(h(m),[e.value]):[e.value],v(t)},O=function e(t){var r=t.nextElementSibling;return r?o.hasClass(r,"p-orderlist-item")?r:e(r):null},R=function e(t){var r=t.previousElementSibling;return r?o.hasClass(r,"p-orderlist-item")?r:e(r):null},F=function(){var e=o.findSingle(T.current,".p-orderlist-list"),t=o.find(e,".p-orderlist-item.p-highlight");if(t&&t.length)switch(K.current){case"up":o.scrollInView(e,t[0]);break;case"top":e.scrollTop=0;break;case"down":o.scrollInView(e,t[t.length-1]);break;case"bottom":setTimeout((function(){return e.scrollTop=e.scrollHeight}),100)}},P=function(){if(!D.current){D.current=o.createInlineStyle(t.nonce);var e="\n@media screen and (max-width: ".concat(f.breakpoint,") {\n .p-orderlist[").concat(S,"] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(S,"] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(S,"] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(S,"] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");D.current.innerHTML=e}};e.useImperativeHandle(s,(function(){return{props:f,getElement:function(){return T.current}}})),n((function(){!S&&k(u())})),i((function(){return S&&(T.current.setAttribute(S,""),P()),function(){D.current=o.removeInlineStyle(D.current)}}),[S,f.breakpoint]),i((function(){K.current&&(F(),K.current=null)}));var A=C.getOtherProps(f),j=a("p-orderlist p-component",f.className),M=function(){if(N){var e=y.trim().toLocaleLowerCase(f.filterLocale),t=f.filterBy?f.filterBy.split(","):[];return r.filter(f.value,t,e,f.filterMatchMode,f.filterLocale)}return f.value}();return e.createElement("div",p({ref:T,id:f.id,className:j,style:f.style},A),e.createElement(w,{value:M,selection:m,onReorder:function(e){f.onChange&&f.onChange({event:e.originalEvent,value:e.value}),K.current=e.direction},dataKey:f.dataKey}),e.createElement(x,{value:M,selection:m,onItemClick:L,onItemKeyDown:function(e){var t=e.originalEvent,r=t.currentTarget;switch(t.which){case 40:var n=O(r);n&&n.focus(),t.preventDefault();break;case 38:var i=R(r);i&&i.focus(),t.preventDefault();break;case 13:L(e),t.preventDefault()}},onFilterInputChange:function(e){var t=e.target.value;b(t),f.onFilter&&f.onFilter({originalEvent:e,filter:t})},itemTemplate:f.itemTemplate,filter:f.filter,onFilter:function(e){var t=e.target.value;b(t),f.onFilter&&f.onFilter({originalEvent:e,value:t})},resetFilter:function(){b(""),f.onFilter&&f.onFilter({filter:""})},filterTemplate:f.filterTemplate,header:f.header,listStyle:f.listStyle,dataKey:f.dataKey,dragdrop:f.dragdrop,onChange:f.onChange,tabIndex:f.tabIndex}))})));S.displayName="OrderList";export{S as OrderList};
|
package/orderlist/orderlist.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
this.primereact = this.primereact || {};
|
|
2
|
-
this.primereact.orderlist = (function (exports, React,
|
|
2
|
+
this.primereact.orderlist = (function (exports, React, PrimeReact, hooks, utils, button, ripple) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
5
7
|
function _interopNamespace(e) {
|
|
6
8
|
if (e && e.__esModule) return e;
|
|
7
9
|
var n = Object.create(null);
|
|
@@ -21,6 +23,7 @@ this.primereact.orderlist = (function (exports, React, api, hooks, utils, button
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
var PrimeReact__default = /*#__PURE__*/_interopDefaultLegacy(PrimeReact);
|
|
24
27
|
|
|
25
28
|
function _extends() {
|
|
26
29
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -120,6 +123,7 @@ this.primereact.orderlist = (function (exports, React, api, hooks, utils, button
|
|
|
120
123
|
dragdrop: false,
|
|
121
124
|
tabIndex: 0,
|
|
122
125
|
dataKey: null,
|
|
126
|
+
breakpoint: '960px',
|
|
123
127
|
onChange: null,
|
|
124
128
|
itemTemplate: null,
|
|
125
129
|
filter: false,
|
|
@@ -467,8 +471,13 @@ this.primereact.orderlist = (function (exports, React, api, hooks, utils, button
|
|
|
467
471
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
468
472
|
filterValueState = _React$useState4[0],
|
|
469
473
|
setFilterValueState = _React$useState4[1];
|
|
474
|
+
var _React$useState5 = React__namespace.useState(null),
|
|
475
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
476
|
+
attributeSelectorState = _React$useState6[0],
|
|
477
|
+
setAttributeSelectorState = _React$useState6[1];
|
|
470
478
|
var hasFilter = utils.ObjectUtils.isNotEmpty(filterValueState);
|
|
471
479
|
var elementRef = React__namespace.useRef(null);
|
|
480
|
+
var styleElementRef = React__namespace.useRef(null);
|
|
472
481
|
var reorderDirection = React__namespace.useRef(null);
|
|
473
482
|
var onItemClick = function onItemClick(event) {
|
|
474
483
|
var metaKey = event.originalEvent.metaKey || event.originalEvent.ctrlKey;
|
|
@@ -535,7 +544,7 @@ this.primereact.orderlist = (function (exports, React, api, hooks, utils, button
|
|
|
535
544
|
if (hasFilter) {
|
|
536
545
|
var filterValue = filterValueState.trim().toLocaleLowerCase(props.filterLocale);
|
|
537
546
|
var searchFields = props.filterBy ? props.filterBy.split(',') : [];
|
|
538
|
-
return
|
|
547
|
+
return PrimeReact.FilterService.filter(props.value, searchFields, filterValue, props.filterMatchMode, props.filterLocale);
|
|
539
548
|
}
|
|
540
549
|
return props.value;
|
|
541
550
|
};
|
|
@@ -579,6 +588,16 @@ this.primereact.orderlist = (function (exports, React, api, hooks, utils, button
|
|
|
579
588
|
}
|
|
580
589
|
}
|
|
581
590
|
};
|
|
591
|
+
var createStyle = function createStyle() {
|
|
592
|
+
if (!styleElementRef.current) {
|
|
593
|
+
styleElementRef.current = utils.DomHandler.createInlineStyle(PrimeReact__default["default"].nonce);
|
|
594
|
+
var innerHTML = "\n@media screen and (max-width: ".concat(props.breakpoint, ") {\n .p-orderlist[").concat(attributeSelectorState, "] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(attributeSelectorState, "] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(attributeSelectorState, "] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(attributeSelectorState, "] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");
|
|
595
|
+
styleElementRef.current.innerHTML = innerHTML;
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
var destroyStyle = function destroyStyle() {
|
|
599
|
+
styleElementRef.current = utils.DomHandler.removeInlineStyle(styleElementRef.current);
|
|
600
|
+
};
|
|
582
601
|
React__namespace.useImperativeHandle(ref, function () {
|
|
583
602
|
return {
|
|
584
603
|
props: props,
|
|
@@ -587,6 +606,18 @@ this.primereact.orderlist = (function (exports, React, api, hooks, utils, button
|
|
|
587
606
|
}
|
|
588
607
|
};
|
|
589
608
|
});
|
|
609
|
+
hooks.useMountEffect(function () {
|
|
610
|
+
!attributeSelectorState && setAttributeSelectorState(utils.UniqueComponentId());
|
|
611
|
+
});
|
|
612
|
+
hooks.useUpdateEffect(function () {
|
|
613
|
+
if (attributeSelectorState) {
|
|
614
|
+
elementRef.current.setAttribute(attributeSelectorState, '');
|
|
615
|
+
createStyle();
|
|
616
|
+
}
|
|
617
|
+
return function () {
|
|
618
|
+
destroyStyle();
|
|
619
|
+
};
|
|
620
|
+
}, [attributeSelectorState, props.breakpoint]);
|
|
590
621
|
hooks.useUpdateEffect(function () {
|
|
591
622
|
if (reorderDirection.current) {
|
|
592
623
|
updateListScroll();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.orderlist=function(e,t,r,n,l,i,a){"use strict";function o(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 u=o(t);function c(){return c=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},c.apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e){if(Array.isArray(e))return s(e)}function f(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function p(e,t){if(e){if("string"==typeof e)return s(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)?s(e,t):void 0}}function m(){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 v(e){return d(e)||f(e)||p(e)||m()}function g(e){if(Array.isArray(e))return e}function h(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,l,i,a,o=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(o.push(n.value),o.length!==t);u=!0);}catch(e){c=!0,l=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw l}}return o}}function y(){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 b(e,t){return g(e)||h(e,t)||p(e,t)||y()}var E={defaultProps:{__TYPE:"OrderList",id:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,dataKey:null,onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},getProps:function(e){return l.ObjectUtils.getMergedProps(e,E.defaultProps)},getOtherProps:function(e){return l.ObjectUtils.getDiffProps(e,E.defaultProps)}},O=u.memo((function(e){return u.createElement("div",{className:"p-orderlist-controls"},u.createElement(i.Button,{type:"button",icon:"pi pi-angle-up",onClick:function(t){if(e.selection){for(var r=v(e.value),n=0;n<e.selection.length;n++){var i=l.ObjectUtils.findIndexInList(e.selection[n],r,e.dataKey);if(0===i)break;var a=r[i-1];r[i-1]=r[i],r[i]=a}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"up"})}}}),u.createElement(i.Button,{type:"button",icon:"pi pi-angle-double-up",onClick:function(t){if(e.selection){for(var r=v(e.value),n=0;n<e.selection.length;n++){var i=l.ObjectUtils.findIndexInList(e.selection[n],r,e.dataKey);if(0===i)break;var a=r.splice(i,1)[0];r.unshift(a)}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"top"})}}}),u.createElement(i.Button,{type:"button",icon:"pi pi-angle-down",onClick:function(t){if(e.selection){for(var r=v(e.value),n=e.selection.length-1;n>=0;n--){var i=l.ObjectUtils.findIndexInList(e.selection[n],r,e.dataKey);if(i===r.length-1)break;var a=r[i+1];r[i+1]=r[i],r[i]=a}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"down"})}}}),u.createElement(i.Button,{type:"button",icon:"pi pi-angle-double-down",onClick:function(t){if(e.selection){for(var r=v(e.value),n=e.selection.length-1;n>=0;n--){var i=l.ObjectUtils.findIndexInList(e.selection[n],r,e.dataKey);if(i===r.length-1)break;var a=r.splice(i,1)[0];r.push(a)}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"bottom"})}}}))}));O.displayName="OrderListControls";var I=u.memo((function(e){var t,r=u.useRef(null),n=u.useRef(null),i=u.useRef(null),o=u.useRef(null),c={filter:function(t){return e.onFilterInputChange(t)},reset:function(){return e.resetFilter()}},s=function(t){return-1!==l.ObjectUtils.findIndexInList(t,e.selection,e.dataKey)},d=function(e,t){n.current!==t&&n.current+1!==t&&(i.current=t,l.DomHandler.addClass(e.target,"p-orderlist-droppoint-highlight"),e.preventDefault())},f=function(e){i.current=null,l.DomHandler.removeClass(e.target,"p-orderlist-droppoint-highlight")},p=function(t){var r=n.current>i.current?i.current:0===i.current?0:i.current-1,a=v(e.value);l.ObjectUtils.reorderArray(a,n.current,r),i.current=null,l.DomHandler.removeClass(t.target,"p-orderlist-droppoint-highlight"),e.onChange&&e.onChange({originalEvent:t,value:a})},m=function(e){r.current=!1},g=function(e){if(r.current){var t=o.current.getBoundingClientRect().top+l.DomHandler.getWindowScrollTop(),n=t+o.current.clientHeight-e.pageY,i=e.pageY-t;n<25&&n>0?o.current.scrollTop+=15:i<25&&i>0&&(o.current.scrollTop-=15)}},h=function(e){13===e.which&&e.preventDefault()},y=function(e,t){return u.createElement("li",{key:t,className:"p-orderlist-droppoint",onDragOver:function(t){return d(t,e+1)},onDragLeave:f,onDrop:p})},b=e.header?u.createElement("div",{className:"p-orderlist-header"},e.header):null,E=function(){if(e.filter){var t=u.createElement("div",{className:"p-orderlist-filter"},u.createElement("input",{type:"text",value:e.filterValue,onChange:e.onFilter,onKeyDown:h,placeholder:e.placeholder,className:"p-orderlist-filter-input p-inputtext p-component"}),u.createElement("span",{className:"p-orderlist-filter-icon pi pi-search"}));if(e.filterTemplate)t=l.ObjectUtils.getJSXElement(e.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:e.onFilter,onKeyDown:h},filterOptions:c,iconClassName:"p-orderlist-filter-icon pi pi-search",element:t,props:e});return u.createElement("div",{className:"p-orderlist-filter-container"},t)}return null}(),O=(t=e.value?e.value.map((function(t,i){var o=e.itemTemplate?e.itemTemplate(t):t,c=l.classNames("p-orderlist-item",{"p-highlight":s(t)},e.className),d=JSON.stringify(t);if(e.dragdrop){var f=[];return 0===i&&f.push(y(t,i)),f.push(u.createElement("li",{key:d,className:c,onClick:function(r){return e.onItemClick({originalEvent:r,value:t,index:i})},onKeyDown:function(r){return e.onItemKeyDown({originalEvent:r,value:t,index:i})},role:"option","aria-selected":s(t),draggable:"true",onDragStart:function(t){return l=t,a=i,r.current=!0,n.current=a,void(e.dragdropScope&&l.dataTransfer.setData("text","orderlist"));var l,a},onDragEnd:m,tabIndex:e.tabIndex},o,u.createElement(a.Ripple,null))),f.push(y(i,d+"_droppoint")),f}return u.createElement("li",{key:d,className:c,role:"option","aria-selected":s(t),onClick:function(r){return e.onItemClick({originalEvent:r,value:t,index:i})},onKeyDown:function(r){return e.onItemKeyDown({originalEvent:r,value:t,index:i})},tabIndex:e.tabIndex},o)})):null,u.createElement("ul",{ref:o,className:"p-orderlist-list",style:e.listStyle,onDragOver:g,role:"listbox","aria-multiselectable":!0},t));return u.createElement("div",{className:"p-orderlist-list-container"},b,E,O)}));I.displayName="OrderListSubList";var C=u.memo(u.forwardRef((function(e,t){var i=E.getProps(e),a=b(u.useState([]),2),o=a[0],s=a[1],d=b(u.useState(""),2),f=d[0],p=d[1],m=l.ObjectUtils.isNotEmpty(f),g=u.useRef(null),h=u.useRef(null),y=function(e){var t,r=e.originalEvent.metaKey||e.originalEvent.ctrlKey,n=l.ObjectUtils.findIndexInList(e.value,o,i.dataKey);t=-1!==n?r?o.filter((function(e,t){return t!==n})):[e.value]:r?[].concat(v(o),[e.value]):[e.value],s(t)},C=function e(t){var r=t.nextElementSibling;return r?l.DomHandler.hasClass(r,"p-orderlist-item")?r:e(r):null},D=function e(t){var r=t.previousElementSibling;return r?l.DomHandler.hasClass(r,"p-orderlist-item")?r:e(r):null},w=function(){var e=l.DomHandler.findSingle(g.current,".p-orderlist-list"),t=l.DomHandler.find(e,".p-orderlist-item.p-highlight");if(t&&t.length)switch(h.current){case"up":l.DomHandler.scrollInView(e,t[0]);break;case"top":e.scrollTop=0;break;case"down":l.DomHandler.scrollInView(e,t[t.length-1]);break;case"bottom":setTimeout((function(){return e.scrollTop=e.scrollHeight}),100)}};u.useImperativeHandle(t,(function(){return{props:i,getElement:function(){return g.current}}})),n.useUpdateEffect((function(){h.current&&(w(),h.current=null)}));var j=E.getOtherProps(i),N=l.classNames("p-orderlist p-component",i.className),x=function(){if(m){var e=f.trim().toLocaleLowerCase(i.filterLocale),t=i.filterBy?i.filterBy.split(","):[];return r.FilterService.filter(i.value,t,e,i.filterMatchMode,i.filterLocale)}return i.value}();return u.createElement("div",c({ref:g,id:i.id,className:N,style:i.style},j),u.createElement(O,{value:x,selection:o,onReorder:function(e){i.onChange&&i.onChange({event:e.originalEvent,value:e.value}),h.current=e.direction},dataKey:i.dataKey}),u.createElement(I,{value:x,selection:o,onItemClick:y,onItemKeyDown:function(e){var t=e.originalEvent,r=t.currentTarget;switch(t.which){case 40:var n=C(r);n&&n.focus(),t.preventDefault();break;case 38:var l=D(r);l&&l.focus(),t.preventDefault();break;case 13:y(e),t.preventDefault()}},onFilterInputChange:function(e){var t=e.target.value;p(t),i.onFilter&&i.onFilter({originalEvent:e,filter:t})},itemTemplate:i.itemTemplate,filter:i.filter,onFilter:function(e){var t=e.target.value;p(t),i.onFilter&&i.onFilter({originalEvent:e,value:t})},resetFilter:function(){p(""),i.onFilter&&i.onFilter({filter:""})},filterTemplate:i.filterTemplate,header:i.header,listStyle:i.listStyle,dataKey:i.dataKey,dragdrop:i.dragdrop,onChange:i.onChange,tabIndex:i.tabIndex}))})));return C.displayName="OrderList",e.OrderList=C,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.hooks,primereact.utils,primereact.button,primereact.ripple);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.orderlist=function(e,t,r,n,l,i,o){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(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 c=u(t),s=a(r);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 p(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 f(e){if(Array.isArray(e))return p(e)}function m(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function v(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}function g(){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){return f(e)||m(e)||v(e)||g()}function y(e){if(Array.isArray(e))return e}function b(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,l,i,o,a=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(e){c=!0,l=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw l}}return a}}function E(){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 y(e)||b(e,t)||v(e,t)||E()}var O={defaultProps:{__TYPE:"OrderList",id:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,dataKey:null,breakpoint:"960px",onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},getProps:function(e){return l.ObjectUtils.getMergedProps(e,O.defaultProps)},getOtherProps:function(e){return l.ObjectUtils.getDiffProps(e,O.defaultProps)}},D=c.memo((function(e){return c.createElement("div",{className:"p-orderlist-controls"},c.createElement(i.Button,{type:"button",icon:"pi pi-angle-up",onClick:function(t){if(e.selection){for(var r=h(e.value),n=0;n<e.selection.length;n++){var i=l.ObjectUtils.findIndexInList(e.selection[n],r,e.dataKey);if(0===i)break;var o=r[i-1];r[i-1]=r[i],r[i]=o}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"up"})}}}),c.createElement(i.Button,{type:"button",icon:"pi pi-angle-double-up",onClick:function(t){if(e.selection){for(var r=h(e.value),n=0;n<e.selection.length;n++){var i=l.ObjectUtils.findIndexInList(e.selection[n],r,e.dataKey);if(0===i)break;var o=r.splice(i,1)[0];r.unshift(o)}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"top"})}}}),c.createElement(i.Button,{type:"button",icon:"pi pi-angle-down",onClick:function(t){if(e.selection){for(var r=h(e.value),n=e.selection.length-1;n>=0;n--){var i=l.ObjectUtils.findIndexInList(e.selection[n],r,e.dataKey);if(i===r.length-1)break;var o=r[i+1];r[i+1]=r[i],r[i]=o}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"down"})}}}),c.createElement(i.Button,{type:"button",icon:"pi pi-angle-double-down",onClick:function(t){if(e.selection){for(var r=h(e.value),n=e.selection.length-1;n>=0;n--){var i=l.ObjectUtils.findIndexInList(e.selection[n],r,e.dataKey);if(i===r.length-1)break;var o=r.splice(i,1)[0];r.push(o)}e.onReorder&&e.onReorder({originalEvent:t,value:r,direction:"bottom"})}}}))}));D.displayName="OrderListControls";var C=c.memo((function(e){var t,r=c.useRef(null),n=c.useRef(null),i=c.useRef(null),a=c.useRef(null),u={filter:function(t){return e.onFilterInputChange(t)},reset:function(){return e.resetFilter()}},s=function(t){return-1!==l.ObjectUtils.findIndexInList(t,e.selection,e.dataKey)},d=function(e,t){n.current!==t&&n.current+1!==t&&(i.current=t,l.DomHandler.addClass(e.target,"p-orderlist-droppoint-highlight"),e.preventDefault())},p=function(e){i.current=null,l.DomHandler.removeClass(e.target,"p-orderlist-droppoint-highlight")},f=function(t){var r=n.current>i.current?i.current:0===i.current?0:i.current-1,o=h(e.value);l.ObjectUtils.reorderArray(o,n.current,r),i.current=null,l.DomHandler.removeClass(t.target,"p-orderlist-droppoint-highlight"),e.onChange&&e.onChange({originalEvent:t,value:o})},m=function(e){r.current=!1},v=function(e){if(r.current){var t=a.current.getBoundingClientRect().top+l.DomHandler.getWindowScrollTop(),n=t+a.current.clientHeight-e.pageY,i=e.pageY-t;n<25&&n>0?a.current.scrollTop+=15:i<25&&i>0&&(a.current.scrollTop-=15)}},g=function(e){13===e.which&&e.preventDefault()},y=function(e,t){return c.createElement("li",{key:t,className:"p-orderlist-droppoint",onDragOver:function(t){return d(t,e+1)},onDragLeave:p,onDrop:f})},b=e.header?c.createElement("div",{className:"p-orderlist-header"},e.header):null,E=function(){if(e.filter){var t=c.createElement("div",{className:"p-orderlist-filter"},c.createElement("input",{type:"text",value:e.filterValue,onChange:e.onFilter,onKeyDown:g,placeholder:e.placeholder,className:"p-orderlist-filter-input p-inputtext p-component"}),c.createElement("span",{className:"p-orderlist-filter-icon pi pi-search"}));if(e.filterTemplate)t=l.ObjectUtils.getJSXElement(e.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:e.onFilter,onKeyDown:g},filterOptions:u,iconClassName:"p-orderlist-filter-icon pi pi-search",element:t,props:e});return c.createElement("div",{className:"p-orderlist-filter-container"},t)}return null}(),I=(t=e.value?e.value.map((function(t,i){var a=e.itemTemplate?e.itemTemplate(t):t,u=l.classNames("p-orderlist-item",{"p-highlight":s(t)},e.className),d=JSON.stringify(t);if(e.dragdrop){var p=[];return 0===i&&p.push(y(t,i)),p.push(c.createElement("li",{key:d,className:u,onClick:function(r){return e.onItemClick({originalEvent:r,value:t,index:i})},onKeyDown:function(r){return e.onItemKeyDown({originalEvent:r,value:t,index:i})},role:"option","aria-selected":s(t),draggable:"true",onDragStart:function(t){return l=t,o=i,r.current=!0,n.current=o,void(e.dragdropScope&&l.dataTransfer.setData("text","orderlist"));var l,o},onDragEnd:m,tabIndex:e.tabIndex},a,c.createElement(o.Ripple,null))),p.push(y(i,d+"_droppoint")),p}return c.createElement("li",{key:d,className:u,role:"option","aria-selected":s(t),onClick:function(r){return e.onItemClick({originalEvent:r,value:t,index:i})},onKeyDown:function(r){return e.onItemKeyDown({originalEvent:r,value:t,index:i})},tabIndex:e.tabIndex},a)})):null,c.createElement("ul",{ref:a,className:"p-orderlist-list",style:e.listStyle,onDragOver:v,role:"listbox","aria-multiselectable":!0},t));return c.createElement("div",{className:"p-orderlist-list-container"},b,E,I)}));C.displayName="OrderListSubList";var w=c.memo(c.forwardRef((function(e,t){var i=O.getProps(e),o=I(c.useState([]),2),a=o[0],u=o[1],p=I(c.useState(""),2),f=p[0],m=p[1],v=I(c.useState(null),2),g=v[0],y=v[1],b=l.ObjectUtils.isNotEmpty(f),E=c.useRef(null),w=c.useRef(null),x=c.useRef(null),j=function(e){var t,r=e.originalEvent.metaKey||e.originalEvent.ctrlKey,n=l.ObjectUtils.findIndexInList(e.value,a,i.dataKey);t=-1!==n?r?a.filter((function(e,t){return t!==n})):[e.value]:r?[].concat(h(a),[e.value]):[e.value],u(t)},S=function e(t){var r=t.nextElementSibling;return r?l.DomHandler.hasClass(r,"p-orderlist-item")?r:e(r):null},k=function e(t){var r=t.previousElementSibling;return r?l.DomHandler.hasClass(r,"p-orderlist-item")?r:e(r):null},N=function(){var e=l.DomHandler.findSingle(E.current,".p-orderlist-list"),t=l.DomHandler.find(e,".p-orderlist-item.p-highlight");if(t&&t.length)switch(x.current){case"up":l.DomHandler.scrollInView(e,t[0]);break;case"top":e.scrollTop=0;break;case"down":l.DomHandler.scrollInView(e,t[t.length-1]);break;case"bottom":setTimeout((function(){return e.scrollTop=e.scrollHeight}),100)}},T=function(){if(!w.current){w.current=l.DomHandler.createInlineStyle(s.default.nonce);var e="\n@media screen and (max-width: ".concat(i.breakpoint,") {\n .p-orderlist[").concat(g,"] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(g,"] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(g,"] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(g,"] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");w.current.innerHTML=e}};c.useImperativeHandle(t,(function(){return{props:i,getElement:function(){return E.current}}})),n.useMountEffect((function(){!g&&y(l.UniqueComponentId())})),n.useUpdateEffect((function(){return g&&(E.current.setAttribute(g,""),T()),function(){w.current=l.DomHandler.removeInlineStyle(w.current)}}),[g,i.breakpoint]),n.useUpdateEffect((function(){x.current&&(N(),x.current=null)}));var K=O.getOtherProps(i),R=l.classNames("p-orderlist p-component",i.className),L=function(){if(b){var e=f.trim().toLocaleLowerCase(i.filterLocale),t=i.filterBy?i.filterBy.split(","):[];return r.FilterService.filter(i.value,t,e,i.filterMatchMode,i.filterLocale)}return i.value}();return c.createElement("div",d({ref:E,id:i.id,className:R,style:i.style},K),c.createElement(D,{value:L,selection:a,onReorder:function(e){i.onChange&&i.onChange({event:e.originalEvent,value:e.value}),x.current=e.direction},dataKey:i.dataKey}),c.createElement(C,{value:L,selection:a,onItemClick:j,onItemKeyDown:function(e){var t=e.originalEvent,r=t.currentTarget;switch(t.which){case 40:var n=S(r);n&&n.focus(),t.preventDefault();break;case 38:var l=k(r);l&&l.focus(),t.preventDefault();break;case 13:j(e),t.preventDefault()}},onFilterInputChange:function(e){var t=e.target.value;m(t),i.onFilter&&i.onFilter({originalEvent:e,filter:t})},itemTemplate:i.itemTemplate,filter:i.filter,onFilter:function(e){var t=e.target.value;m(t),i.onFilter&&i.onFilter({originalEvent:e,value:t})},resetFilter:function(){m(""),i.onFilter&&i.onFilter({filter:""})},filterTemplate:i.filterTemplate,header:i.header,listStyle:i.listStyle,dataKey:i.dataKey,dragdrop:i.dragdrop,onChange:i.onChange,tabIndex:i.tabIndex}))})));return w.displayName="OrderList",e.OrderList=w,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.hooks,primereact.utils,primereact.button,primereact.ripple);
|
|
@@ -250,6 +250,7 @@ var OrganizationChartNode = /*#__PURE__*/React__namespace.memo(function (props)
|
|
|
250
250
|
colSpan: colspan
|
|
251
251
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
252
252
|
className: nodeClassName,
|
|
253
|
+
style: node.style,
|
|
253
254
|
onClick: function onClick(e) {
|
|
254
255
|
return onNodeClick(e, node);
|
|
255
256
|
}
|
|
@@ -272,7 +273,7 @@ var OrganizationChart = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__
|
|
|
272
273
|
var onNodeClick = function onNodeClick(event, node) {
|
|
273
274
|
if (props.selectionMode) {
|
|
274
275
|
var target = event.target;
|
|
275
|
-
if (node.selectable === false ||
|
|
276
|
+
if (node.selectable === false || utils.DomHandler.hasClass(target, 'p-node-toggler') || utils.DomHandler.hasClass(target, 'p-node-toggler-icon')) {
|
|
276
277
|
return;
|
|
277
278
|
}
|
|
278
279
|
var index = findIndexInSelection(node);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils");function n(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 r=n(e);function l(){return l=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},l.apply(this,arguments)}function o(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 a(e){if(Array.isArray(e))return o(e)}function i(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u={defaultProps:{__TYPE:"OrganizationChart",id:null,value:null,style:null,className:null,selectionMode:null,selection:null,nodeTemplate:null,onSelectionChange:null,onNodeSelect:null,onNodeUnselect:null,children:void 0},getProps:function(e){return t.ObjectUtils.getMergedProps(e,u.defaultProps)},getOtherProps:function(e){return t.ObjectUtils.getDiffProps(e,u.defaultProps)}};function d(e){if(Array.isArray(e))return e}function f(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,o,a,i=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,l=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw l}}return i}}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p=r.memo((function(e){var n,l,o,a,i,s,u=e.node,h=r.useState(u.expanded),g=(l=2,d(n=h)||f(n,l)||c(n,l)||m()),v=g[0],y=g[1],b=!1!==u.leaf&&!(u.children&&u.children.length),N=u.children&&u.children.length?2*u.children.length:null,E=e.isSelected(u),S=!b&&v?"inherit":"hidden",O=function(t,n){e.onNodeClick(t,n)},j=function(){if(!b){var e=t.classNames("p-node-toggler-icon",{"pi pi-chevron-down":v,"pi pi-chevron-up":!v});return r.createElement("a",{href:"#",className:"p-node-toggler",onClick:function(e){return t=e,y((function(e){return!e})),void t.preventDefault();var t}},r.createElement("i",{className:e}))}return null},z=function(){var n=e.nodeTemplate&&t.ObjectUtils.getJSXElement(e.nodeTemplate,u)||u.label;return r.createElement("div",null,n)},C=(o=t.classNames("p-organizationchart-node-content",{"p-organizationchart-selectable-node":e.selectionMode&&!1!==u.selectable,"p-highlight":E},u.className),a=z(),i=j(),r.createElement("tr",null,r.createElement("td",{colSpan:N},r.createElement("div",{className:o,style:u.style,onClick:function(e){return O(e,u)}},a,i)))),M=r.createElement("tr",{style:{visibility:S},className:"p-organizationchart-lines"},r.createElement("td",{colSpan:N},r.createElement("div",{className:"p-organizationchart-line-down"}))),P=(s=u.children&&u.children.length,r.createElement("tr",{style:{visibility:S},className:"p-organizationchart-lines"},u.children&&1===u.children.length&&r.createElement("td",{colSpan:N},r.createElement("div",{className:"p-organizationchart-line-down"})),u.children&&u.children.length>1&&u.children.map((function(e,n){var l=t.classNames("p-organizationchart-line-left",{"p-organizationchart-line-top":0!==n}),o=t.classNames("p-organizationchart-line-right",{"p-organizationchart-line-top":n!==s-1});return[r.createElement("td",{key:n+"_lineleft",className:l}," "),r.createElement("td",{key:n+"_lineright",className:o}," ")]})))),w=r.createElement("tr",{style:{visibility:S},className:"p-organizationchart-nodes"},u.children&&u.children.map((function(t,n){return r.createElement("td",{key:n,colSpan:"2"},r.createElement(p,{node:t,nodeTemplate:e.nodeTemplate,selectionMode:e.selectionMode,onNodeClick:e.onNodeClick,isSelected:e.isSelected}))})));return r.createElement("table",{className:"p-organizationchart-table"},r.createElement("tbody",null,C,M,P,w))}));p.displayName="OrganizationChartNode";var h=r.memo(r.forwardRef((function(e,n){var o=u.getProps(e),d=r.useRef(null),f=o.value&&o.value.length?o.value[0]:null,m=function(e){if(o.selectionMode&&o.selection){if("single"===o.selectionMode)return o.selection===e?0:-1;if("multiple"===o.selectionMode)return o.selection.findIndex((function(t){return t===e}))}return-1};r.useImperativeHandle(n,(function(){return{props:o,getElement:function(){return d.current}}}));var h=u.getOtherProps(o),g=t.classNames("p-organizationchart p-component",o.className);return r.createElement("div",l({id:o.id,ref:d,style:o.style,className:g},h),r.createElement(p,{node:f,nodeTemplate:o.nodeTemplate,selectionMode:o.selectionMode,onNodeClick:function(e,n){if(o.selectionMode){var r=e.target;if(!1===n.selectable||t.DomHandler.hasClass(r,"p-node-toggler")||t.DomHandler.hasClass(r,"p-node-toggler-icon"))return;var l,u=m(n),d=u>=0;"single"===o.selectionMode?d?(l=null,o.onNodeUnselect&&o.onNodeUnselect({originalEvent:e,node:n})):(l=n,o.onNodeSelect&&o.onNodeSelect({originalEvent:e,node:n})):"multiple"===o.selectionMode&&(d?(l=o.selection.filter((function(e,t){return t!==u})),o.onNodeUnselect&&o.onNodeUnselect({originalEvent:e,node:n})):(l=[].concat(a(f=o.selection||[])||i(f)||c(f)||s(),[n]),o.onNodeSelect&&o.onNodeSelect({originalEvent:e,node:n}))),o.onSelectionChange&&o.onSelectionChange({originalEvent:e,data:l})}var f},isSelected:function(e){return-1!==m(e)}}))})));h.displayName="OrganizationChart",exports.OrganizationChart=h;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* OrganizationChart visualizes hierarchical organization data.
|
|
4
4
|
*
|
|
5
|
-
* [Live Demo](https://www.
|
|
5
|
+
* [Live Demo](https://www.primereact.org/organizationchart/)
|
|
6
6
|
*
|
|
7
7
|
* @module organizationchart
|
|
8
8
|
*
|
|
@@ -68,6 +68,10 @@ interface OrganizationChartNodeData {
|
|
|
68
68
|
label?: string;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Defines valid properties in OrganizationChart component. In addition to these, all properties of HTMLDivElement can be used in this component.
|
|
73
|
+
* @group Properties
|
|
74
|
+
*/
|
|
71
75
|
export interface OrganizationChartProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref'> {
|
|
72
76
|
/**
|
|
73
77
|
* An array of nested TreeNodes.
|
|
@@ -113,7 +117,7 @@ export interface OrganizationChartProps extends Omit<React.DetailedHTMLProps<Rea
|
|
|
113
117
|
*
|
|
114
118
|
* _OrganizationChart visualizes hierarchical organization data._
|
|
115
119
|
*
|
|
116
|
-
* [Live Demo](https://www.
|
|
120
|
+
* [Live Demo](https://www.primereact.org/organizationchart/)
|
|
117
121
|
* --- ---
|
|
118
122
|
* 
|
|
119
123
|
*
|
|
@@ -226,6 +226,7 @@ var OrganizationChartNode = /*#__PURE__*/React.memo(function (props) {
|
|
|
226
226
|
colSpan: colspan
|
|
227
227
|
}, /*#__PURE__*/React.createElement("div", {
|
|
228
228
|
className: nodeClassName,
|
|
229
|
+
style: node.style,
|
|
229
230
|
onClick: function onClick(e) {
|
|
230
231
|
return onNodeClick(e, node);
|
|
231
232
|
}
|
|
@@ -248,7 +249,7 @@ var OrganizationChart = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(f
|
|
|
248
249
|
var onNodeClick = function onNodeClick(event, node) {
|
|
249
250
|
if (props.selectionMode) {
|
|
250
251
|
var target = event.target;
|
|
251
|
-
if (node.selectable === false ||
|
|
252
|
+
if (node.selectable === false || DomHandler.hasClass(target, 'p-node-toggler') || DomHandler.hasClass(target, 'p-node-toggler-icon')) {
|
|
252
253
|
return;
|
|
253
254
|
}
|
|
254
255
|
var index = findIndexInSelection(node);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{ObjectUtils as n,classNames as t,DomHandler as r}from"primereact/utils";function l(){return l=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},l.apply(this,arguments)}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function a(e){if(Array.isArray(e))return o(e)}function i(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,n){if(e){if("string"==typeof e)return o(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,n):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d={defaultProps:{__TYPE:"OrganizationChart",id:null,value:null,style:null,className:null,selectionMode:null,selection:null,nodeTemplate:null,onSelectionChange:null,onNodeSelect:null,onNodeUnselect:null,children:void 0},getProps:function(e){return n.getMergedProps(e,d.defaultProps)},getOtherProps:function(e){return n.getDiffProps(e,d.defaultProps)}};function u(e){if(Array.isArray(e))return e}function p(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,l,o,a,i=[],c=!0,s=!1;try{if(o=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=o.call(t)).done)&&(i.push(r.value),i.length!==n);c=!0);}catch(e){s=!0,l=e}finally{try{if(!c&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw l}}return i}}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f=e.memo((function(r){var l,o,a,i,s,d,h=r.node,g=e.useState(h.expanded),v=(o=2,u(l=g)||p(l,o)||c(l,o)||m()),y=v[0],b=v[1],N=!1!==h.leaf&&!(h.children&&h.children.length),E=h.children&&h.children.length?2*h.children.length:null,S=r.isSelected(h),z=!N&&y?"inherit":"hidden",C=function(e,n){r.onNodeClick(e,n)},M=function(){if(!N){var n=t("p-node-toggler-icon",{"pi pi-chevron-down":y,"pi pi-chevron-up":!y});return e.createElement("a",{href:"#",className:"p-node-toggler",onClick:function(e){return n=e,b((function(e){return!e})),void n.preventDefault();var n}},e.createElement("i",{className:n}))}return null},O=function(){var t=r.nodeTemplate&&n.getJSXElement(r.nodeTemplate,h)||h.label;return e.createElement("div",null,t)},w=(a=t("p-organizationchart-node-content",{"p-organizationchart-selectable-node":r.selectionMode&&!1!==h.selectable,"p-highlight":S},h.className),i=O(),s=M(),e.createElement("tr",null,e.createElement("td",{colSpan:E},e.createElement("div",{className:a,onClick:function(e){return C(e,h)}},i,s)))),P=e.createElement("tr",{style:{visibility:z},className:"p-organizationchart-lines"},e.createElement("td",{colSpan:E},e.createElement("div",{className:"p-organizationchart-line-down"}))),T=(d=h.children&&h.children.length,e.createElement("tr",{style:{visibility:z},className:"p-organizationchart-lines"},h.children&&1===h.children.length&&e.createElement("td",{colSpan:E},e.createElement("div",{className:"p-organizationchart-line-down"})),h.children&&h.children.length>1&&h.children.map((function(n,r){var l=t("p-organizationchart-line-left",{"p-organizationchart-line-top":0!==r}),o=t("p-organizationchart-line-right",{"p-organizationchart-line-top":r!==d-1});return[e.createElement("td",{key:r+"_lineleft",className:l}," "),e.createElement("td",{key:r+"_lineright",className:o}," ")]})))),j=e.createElement("tr",{style:{visibility:z},className:"p-organizationchart-nodes"},h.children&&h.children.map((function(n,t){return e.createElement("td",{key:t,colSpan:"2"},e.createElement(f,{node:n,nodeTemplate:r.nodeTemplate,selectionMode:r.selectionMode,onNodeClick:r.onNodeClick,isSelected:r.isSelected}))})));return e.createElement("table",{className:"p-organizationchart-table"},e.createElement("tbody",null,w,P,T,j))}));f.displayName="OrganizationChartNode";var h=e.memo(e.forwardRef((function(n,o){var u=d.getProps(n),p=e.useRef(null),m=u.value&&u.value.length?u.value[0]:null,h=function(e){if(u.selectionMode&&u.selection){if("single"===u.selectionMode)return u.selection===e?0:-1;if("multiple"===u.selectionMode)return u.selection.findIndex((function(n){return n===e}))}return-1};e.useImperativeHandle(o,(function(){return{props:u,getElement:function(){return p.current}}}));var g=d.getOtherProps(u),v=t("p-organizationchart p-component",u.className);return e.createElement("div",l({id:u.id,ref:p,style:u.style,className:v},g),e.createElement(f,{node:m,nodeTemplate:u.nodeTemplate,selectionMode:u.selectionMode,onNodeClick:function(e,n){if(u.selectionMode){var t=e.target;if(!1===n.selectable
|
|
1
|
+
import*as e from"react";import{ObjectUtils as n,classNames as t,DomHandler as r}from"primereact/utils";function l(){return l=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},l.apply(this,arguments)}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function a(e){if(Array.isArray(e))return o(e)}function i(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,n){if(e){if("string"==typeof e)return o(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,n):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d={defaultProps:{__TYPE:"OrganizationChart",id:null,value:null,style:null,className:null,selectionMode:null,selection:null,nodeTemplate:null,onSelectionChange:null,onNodeSelect:null,onNodeUnselect:null,children:void 0},getProps:function(e){return n.getMergedProps(e,d.defaultProps)},getOtherProps:function(e){return n.getDiffProps(e,d.defaultProps)}};function u(e){if(Array.isArray(e))return e}function p(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,l,o,a,i=[],c=!0,s=!1;try{if(o=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=o.call(t)).done)&&(i.push(r.value),i.length!==n);c=!0);}catch(e){s=!0,l=e}finally{try{if(!c&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw l}}return i}}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f=e.memo((function(r){var l,o,a,i,s,d,h=r.node,g=e.useState(h.expanded),v=(o=2,u(l=g)||p(l,o)||c(l,o)||m()),y=v[0],b=v[1],N=!1!==h.leaf&&!(h.children&&h.children.length),E=h.children&&h.children.length?2*h.children.length:null,S=r.isSelected(h),z=!N&&y?"inherit":"hidden",C=function(e,n){r.onNodeClick(e,n)},M=function(){if(!N){var n=t("p-node-toggler-icon",{"pi pi-chevron-down":y,"pi pi-chevron-up":!y});return e.createElement("a",{href:"#",className:"p-node-toggler",onClick:function(e){return n=e,b((function(e){return!e})),void n.preventDefault();var n}},e.createElement("i",{className:n}))}return null},O=function(){var t=r.nodeTemplate&&n.getJSXElement(r.nodeTemplate,h)||h.label;return e.createElement("div",null,t)},w=(a=t("p-organizationchart-node-content",{"p-organizationchart-selectable-node":r.selectionMode&&!1!==h.selectable,"p-highlight":S},h.className),i=O(),s=M(),e.createElement("tr",null,e.createElement("td",{colSpan:E},e.createElement("div",{className:a,style:h.style,onClick:function(e){return C(e,h)}},i,s)))),P=e.createElement("tr",{style:{visibility:z},className:"p-organizationchart-lines"},e.createElement("td",{colSpan:E},e.createElement("div",{className:"p-organizationchart-line-down"}))),T=(d=h.children&&h.children.length,e.createElement("tr",{style:{visibility:z},className:"p-organizationchart-lines"},h.children&&1===h.children.length&&e.createElement("td",{colSpan:E},e.createElement("div",{className:"p-organizationchart-line-down"})),h.children&&h.children.length>1&&h.children.map((function(n,r){var l=t("p-organizationchart-line-left",{"p-organizationchart-line-top":0!==r}),o=t("p-organizationchart-line-right",{"p-organizationchart-line-top":r!==d-1});return[e.createElement("td",{key:r+"_lineleft",className:l}," "),e.createElement("td",{key:r+"_lineright",className:o}," ")]})))),j=e.createElement("tr",{style:{visibility:z},className:"p-organizationchart-nodes"},h.children&&h.children.map((function(n,t){return e.createElement("td",{key:t,colSpan:"2"},e.createElement(f,{node:n,nodeTemplate:r.nodeTemplate,selectionMode:r.selectionMode,onNodeClick:r.onNodeClick,isSelected:r.isSelected}))})));return e.createElement("table",{className:"p-organizationchart-table"},e.createElement("tbody",null,w,P,T,j))}));f.displayName="OrganizationChartNode";var h=e.memo(e.forwardRef((function(n,o){var u=d.getProps(n),p=e.useRef(null),m=u.value&&u.value.length?u.value[0]:null,h=function(e){if(u.selectionMode&&u.selection){if("single"===u.selectionMode)return u.selection===e?0:-1;if("multiple"===u.selectionMode)return u.selection.findIndex((function(n){return n===e}))}return-1};e.useImperativeHandle(o,(function(){return{props:u,getElement:function(){return p.current}}}));var g=d.getOtherProps(u),v=t("p-organizationchart p-component",u.className);return e.createElement("div",l({id:u.id,ref:p,style:u.style,className:v},g),e.createElement(f,{node:m,nodeTemplate:u.nodeTemplate,selectionMode:u.selectionMode,onNodeClick:function(e,n){if(u.selectionMode){var t=e.target;if(!1===n.selectable||r.hasClass(t,"p-node-toggler")||r.hasClass(t,"p-node-toggler-icon"))return;var l,o=h(n),d=o>=0;"single"===u.selectionMode?d?(l=null,u.onNodeUnselect&&u.onNodeUnselect({originalEvent:e,node:n})):(l=n,u.onNodeSelect&&u.onNodeSelect({originalEvent:e,node:n})):"multiple"===u.selectionMode&&(d?(l=u.selection.filter((function(e,n){return n!==o})),u.onNodeUnselect&&u.onNodeUnselect({originalEvent:e,node:n})):(l=[].concat(a(p=u.selection||[])||i(p)||c(p)||s(),[n]),u.onNodeSelect&&u.onNodeSelect({originalEvent:e,node:n}))),u.onSelectionChange&&u.onSelectionChange({originalEvent:e,data:l})}var p},isSelected:function(e){return-1!==h(e)}}))})));h.displayName="OrganizationChart";export{h as OrganizationChart};
|
|
@@ -247,6 +247,7 @@ this.primereact.organizationchart = (function (exports, React, utils) {
|
|
|
247
247
|
colSpan: colspan
|
|
248
248
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
249
249
|
className: nodeClassName,
|
|
250
|
+
style: node.style,
|
|
250
251
|
onClick: function onClick(e) {
|
|
251
252
|
return onNodeClick(e, node);
|
|
252
253
|
}
|
|
@@ -269,7 +270,7 @@ this.primereact.organizationchart = (function (exports, React, utils) {
|
|
|
269
270
|
var onNodeClick = function onNodeClick(event, node) {
|
|
270
271
|
if (props.selectionMode) {
|
|
271
272
|
var target = event.target;
|
|
272
|
-
if (node.selectable === false ||
|
|
273
|
+
if (node.selectable === false || utils.DomHandler.hasClass(target, 'p-node-toggler') || utils.DomHandler.hasClass(target, 'p-node-toggler-icon')) {
|
|
273
274
|
return;
|
|
274
275
|
}
|
|
275
276
|
var index = findIndexInSelection(node);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.organizationchart=function(e,t,n){"use strict";function r(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 l=r(t);function o(){return o=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},o.apply(this,arguments)}function a(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 i(e){if(Array.isArray(e))return a(e)}function c(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function s(e,t){if(e){if("string"==typeof e)return a(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)?a(e,t):void 0}}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d={defaultProps:{__TYPE:"OrganizationChart",id:null,value:null,style:null,className:null,selectionMode:null,selection:null,nodeTemplate:null,onSelectionChange:null,onNodeSelect:null,onNodeUnselect:null,children:void 0},getProps:function(e){return n.ObjectUtils.getMergedProps(e,d.defaultProps)},getOtherProps:function(e){return n.ObjectUtils.getDiffProps(e,d.defaultProps)}};function f(e){if(Array.isArray(e))return e}function m(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,o,a,i=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,l=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw l}}return i}}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h=l.memo((function(e){var t,r,o,a,i,c,u=e.node,d=l.useState(u.expanded),g=(r=2,f(t=d)||m(t,r)||s(t,r)||p()),v=g[0],y=g[1],b=!1!==u.leaf&&!(u.children&&u.children.length),N=u.children&&u.children.length?2*u.children.length:null,E=e.isSelected(u),S=!b&&v?"inherit":"hidden",O=function(t,n){e.onNodeClick(t,n)},z=function(){if(!b){var e=n.classNames("p-node-toggler-icon",{"pi pi-chevron-down":v,"pi pi-chevron-up":!v});return l.createElement("a",{href:"#",className:"p-node-toggler",onClick:function(e){return t=e,y((function(e){return!e})),void t.preventDefault();var t}},l.createElement("i",{className:e}))}return null},j=function(){var t=e.nodeTemplate&&n.ObjectUtils.getJSXElement(e.nodeTemplate,u)||u.label;return l.createElement("div",null,t)},C=(o=n.classNames("p-organizationchart-node-content",{"p-organizationchart-selectable-node":e.selectionMode&&!1!==u.selectable,"p-highlight":E},u.className),a=j(),i=z(),l.createElement("tr",null,l.createElement("td",{colSpan:N},l.createElement("div",{className:o,onClick:function(e){return O(e,u)}},a,i)))),M=l.createElement("tr",{style:{visibility:S},className:"p-organizationchart-lines"},l.createElement("td",{colSpan:N},l.createElement("div",{className:"p-organizationchart-line-down"}))),P=(c=u.children&&u.children.length,l.createElement("tr",{style:{visibility:S},className:"p-organizationchart-lines"},u.children&&1===u.children.length&&l.createElement("td",{colSpan:N},l.createElement("div",{className:"p-organizationchart-line-down"})),u.children&&u.children.length>1&&u.children.map((function(e,t){var r=n.classNames("p-organizationchart-line-left",{"p-organizationchart-line-top":0!==t}),o=n.classNames("p-organizationchart-line-right",{"p-organizationchart-line-top":t!==c-1});return[l.createElement("td",{key:t+"_lineleft",className:r}," "),l.createElement("td",{key:t+"_lineright",className:o}," ")]})))),w=l.createElement("tr",{style:{visibility:S},className:"p-organizationchart-nodes"},u.children&&u.children.map((function(t,n){return l.createElement("td",{key:n,colSpan:"2"},l.createElement(h,{node:t,nodeTemplate:e.nodeTemplate,selectionMode:e.selectionMode,onNodeClick:e.onNodeClick,isSelected:e.isSelected}))})));return l.createElement("table",{className:"p-organizationchart-table"},l.createElement("tbody",null,C,M,P,w))}));h.displayName="OrganizationChartNode";var g=l.memo(l.forwardRef((function(e,t){var r=d.getProps(e),a=l.useRef(null),f=r.value&&r.value.length?r.value[0]:null,m=function(e){if(r.selectionMode&&r.selection){if("single"===r.selectionMode)return r.selection===e?0:-1;if("multiple"===r.selectionMode)return r.selection.findIndex((function(t){return t===e}))}return-1};l.useImperativeHandle(t,(function(){return{props:r,getElement:function(){return a.current}}}));var p=d.getOtherProps(r),g=n.classNames("p-organizationchart p-component",r.className);return l.createElement("div",o({id:r.id,ref:a,style:r.style,className:g},p),l.createElement(h,{node:f,nodeTemplate:r.nodeTemplate,selectionMode:r.selectionMode,onNodeClick:function(e,t){if(r.selectionMode){var l=e.target;if(!1===t.selectable
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.organizationchart=function(e,t,n){"use strict";function r(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 l=r(t);function o(){return o=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},o.apply(this,arguments)}function a(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 i(e){if(Array.isArray(e))return a(e)}function c(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function s(e,t){if(e){if("string"==typeof e)return a(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)?a(e,t):void 0}}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d={defaultProps:{__TYPE:"OrganizationChart",id:null,value:null,style:null,className:null,selectionMode:null,selection:null,nodeTemplate:null,onSelectionChange:null,onNodeSelect:null,onNodeUnselect:null,children:void 0},getProps:function(e){return n.ObjectUtils.getMergedProps(e,d.defaultProps)},getOtherProps:function(e){return n.ObjectUtils.getDiffProps(e,d.defaultProps)}};function f(e){if(Array.isArray(e))return e}function m(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,o,a,i=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,l=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw l}}return i}}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h=l.memo((function(e){var t,r,o,a,i,c,u=e.node,d=l.useState(u.expanded),g=(r=2,f(t=d)||m(t,r)||s(t,r)||p()),v=g[0],y=g[1],b=!1!==u.leaf&&!(u.children&&u.children.length),N=u.children&&u.children.length?2*u.children.length:null,E=e.isSelected(u),S=!b&&v?"inherit":"hidden",O=function(t,n){e.onNodeClick(t,n)},z=function(){if(!b){var e=n.classNames("p-node-toggler-icon",{"pi pi-chevron-down":v,"pi pi-chevron-up":!v});return l.createElement("a",{href:"#",className:"p-node-toggler",onClick:function(e){return t=e,y((function(e){return!e})),void t.preventDefault();var t}},l.createElement("i",{className:e}))}return null},j=function(){var t=e.nodeTemplate&&n.ObjectUtils.getJSXElement(e.nodeTemplate,u)||u.label;return l.createElement("div",null,t)},C=(o=n.classNames("p-organizationchart-node-content",{"p-organizationchart-selectable-node":e.selectionMode&&!1!==u.selectable,"p-highlight":E},u.className),a=j(),i=z(),l.createElement("tr",null,l.createElement("td",{colSpan:N},l.createElement("div",{className:o,style:u.style,onClick:function(e){return O(e,u)}},a,i)))),M=l.createElement("tr",{style:{visibility:S},className:"p-organizationchart-lines"},l.createElement("td",{colSpan:N},l.createElement("div",{className:"p-organizationchart-line-down"}))),P=(c=u.children&&u.children.length,l.createElement("tr",{style:{visibility:S},className:"p-organizationchart-lines"},u.children&&1===u.children.length&&l.createElement("td",{colSpan:N},l.createElement("div",{className:"p-organizationchart-line-down"})),u.children&&u.children.length>1&&u.children.map((function(e,t){var r=n.classNames("p-organizationchart-line-left",{"p-organizationchart-line-top":0!==t}),o=n.classNames("p-organizationchart-line-right",{"p-organizationchart-line-top":t!==c-1});return[l.createElement("td",{key:t+"_lineleft",className:r}," "),l.createElement("td",{key:t+"_lineright",className:o}," ")]})))),w=l.createElement("tr",{style:{visibility:S},className:"p-organizationchart-nodes"},u.children&&u.children.map((function(t,n){return l.createElement("td",{key:n,colSpan:"2"},l.createElement(h,{node:t,nodeTemplate:e.nodeTemplate,selectionMode:e.selectionMode,onNodeClick:e.onNodeClick,isSelected:e.isSelected}))})));return l.createElement("table",{className:"p-organizationchart-table"},l.createElement("tbody",null,C,M,P,w))}));h.displayName="OrganizationChartNode";var g=l.memo(l.forwardRef((function(e,t){var r=d.getProps(e),a=l.useRef(null),f=r.value&&r.value.length?r.value[0]:null,m=function(e){if(r.selectionMode&&r.selection){if("single"===r.selectionMode)return r.selection===e?0:-1;if("multiple"===r.selectionMode)return r.selection.findIndex((function(t){return t===e}))}return-1};l.useImperativeHandle(t,(function(){return{props:r,getElement:function(){return a.current}}}));var p=d.getOtherProps(r),g=n.classNames("p-organizationchart p-component",r.className);return l.createElement("div",o({id:r.id,ref:a,style:r.style,className:g},p),l.createElement(h,{node:f,nodeTemplate:r.nodeTemplate,selectionMode:r.selectionMode,onNodeClick:function(e,t){if(r.selectionMode){var l=e.target;if(!1===t.selectable||n.DomHandler.hasClass(l,"p-node-toggler")||n.DomHandler.hasClass(l,"p-node-toggler-icon"))return;var o,a=m(t),d=a>=0;"single"===r.selectionMode?d?(o=null,r.onNodeUnselect&&r.onNodeUnselect({originalEvent:e,node:t})):(o=t,r.onNodeSelect&&r.onNodeSelect({originalEvent:e,node:t})):"multiple"===r.selectionMode&&(d?(o=r.selection.filter((function(e,t){return t!==a})),r.onNodeUnselect&&r.onNodeUnselect({originalEvent:e,node:t})):(o=[].concat(i(f=r.selection||[])||c(f)||s(f)||u(),[t]),r.onNodeSelect&&r.onNodeSelect({originalEvent:e,node:t}))),r.onSelectionChange&&r.onSelectionChange({originalEvent:e,data:o})}var f},isSelected:function(e){return-1!==m(e)}}))})));return g.displayName="OrganizationChart",e.OrganizationChart=g,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* OverlayPanel, also known as Popover, is a container component that can overlay other components on page.
|
|
4
4
|
*
|
|
5
|
-
* [Live Demo](https://www.
|
|
5
|
+
* [Live Demo](https://www.primereact.org/overlaypanel)
|
|
6
6
|
*
|
|
7
7
|
* @module overlaypanel
|
|
8
8
|
*
|
|
@@ -12,7 +12,6 @@ import { CSSTransitionProps } from '../csstransition';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Custom overlay panel breakpoints
|
|
15
|
-
* @group Misc
|
|
16
15
|
*/
|
|
17
16
|
interface OverlayPanelBreakpoints {
|
|
18
17
|
/**
|
|
@@ -74,7 +73,7 @@ export interface OverlayPanelProps extends Omit<React.DetailedHTMLProps<React.HT
|
|
|
74
73
|
*
|
|
75
74
|
* _OverlayPanel, also known as Popover, is a container component that can overlay other components on page._
|
|
76
75
|
*
|
|
77
|
-
* [Live Demo](https://www.
|
|
76
|
+
* [Live Demo](https://www.primereact.org/overlaypanel/)
|
|
78
77
|
* --- ---
|
|
79
78
|
* 
|
|
80
79
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
*
|
|
3
3
|
* OverlayService allows all overlay components to communicate with each other.
|
|
4
4
|
*
|
|
5
|
-
* [Live Demo](https://www.
|
|
5
|
+
* [Live Demo](https://www.primereact.org/dropdown/)
|
|
6
6
|
*
|
|
7
7
|
* @module overlayservice
|
|
8
8
|
*
|
|
@@ -24,7 +24,6 @@ export interface OverlayServiceEvent {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* @group Misc
|
|
28
27
|
*/
|
|
29
28
|
export interface OverlayServiceOptions {
|
|
30
29
|
/**
|
|
@@ -52,7 +51,7 @@ export interface OverlayServiceOptions {
|
|
|
52
51
|
*
|
|
53
52
|
* _OverlayService allows all overlay components to communicate with each other._
|
|
54
53
|
*
|
|
55
|
-
* [Live Demo](https://www.
|
|
54
|
+
* [Live Demo](https://www.primereact.org/dropdown/)
|
|
56
55
|
* --- ---
|
|
57
56
|
* 
|
|
58
57
|
*
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primereact",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "PrimeTek Informatics",
|
|
6
6
|
"description": "PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, which has 370+ ready to use UI blocks to build spectacular applications in no time.",
|
|
7
|
-
"homepage": "https://www.
|
|
7
|
+
"homepage": "https://www.primereact.org",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/primefaces/primereact.git"
|
|
@@ -53,4 +53,4 @@
|
|
|
53
53
|
"sideEffects": [
|
|
54
54
|
"**/*.css"
|
|
55
55
|
]
|
|
56
|
-
}
|
|
56
|
+
}
|