primereact 9.0.0 → 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/button/button.cjs.js +15 -2
- package/button/button.cjs.min.js +1 -1
- package/button/button.d.ts +33 -0
- 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/cascadeselect/cascadeselect.cjs.js +28 -0
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +9 -0
- 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/core/core.js +30 -2
- package/core/core.min.js +2 -2
- package/fileupload/fileupload.cjs.js +156 -23
- package/fileupload/fileupload.cjs.min.js +1 -1
- 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/hooks/hooks.cjs.js +15 -0
- package/hooks/hooks.cjs.min.js +1 -1
- 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/menubar/menubar.min.css +1 -1
- package/orderlist/orderlist.cjs.js +33 -2
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.d.ts +5 -0
- 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.d.ts +4 -0
- package/package.json +2 -2
- package/picklist/picklist.cjs.js +34 -2
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.d.ts +10 -0
- 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 +186 -25
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +186 -25
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +186 -25
- package/primereact.all.min.js +1 -1
- package/resources/primereact.css +685 -671
- 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/tooltip/tooltipoptions.d.ts +49 -12
- package/web-types.json +1 -1
- 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
package/hooks/hooks.js
CHANGED
|
@@ -744,6 +744,19 @@ this.primereact.hooks = (function (exports, React, utils) {
|
|
|
744
744
|
_useResizeListener2 = _slicedToArray(_useResizeListener, 2),
|
|
745
745
|
bindWindowResizeListener = _useResizeListener2[0],
|
|
746
746
|
unbindWindowResizeListener = _useResizeListener2[1];
|
|
747
|
+
var _useEventListener3 = useEventListener({
|
|
748
|
+
target: 'window',
|
|
749
|
+
type: 'orientationchange',
|
|
750
|
+
listener: function listener(event) {
|
|
751
|
+
_listener && _listener(event, {
|
|
752
|
+
type: 'orientationchange',
|
|
753
|
+
valid: true
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
}),
|
|
757
|
+
_useEventListener4 = _slicedToArray(_useEventListener3, 2),
|
|
758
|
+
bindWindowOrientationChangeListener = _useEventListener4[0],
|
|
759
|
+
unbindWindowOrientationChangeListener = _useEventListener4[1];
|
|
747
760
|
var _useOverlayScrollList = useOverlayScrollListener({
|
|
748
761
|
target: target,
|
|
749
762
|
listener: function listener(event) {
|
|
@@ -762,11 +775,13 @@ this.primereact.hooks = (function (exports, React, utils) {
|
|
|
762
775
|
var bind = function bind() {
|
|
763
776
|
bindDocumentClickListener();
|
|
764
777
|
bindWindowResizeListener();
|
|
778
|
+
bindWindowOrientationChangeListener();
|
|
765
779
|
bindOverlayScrollListener();
|
|
766
780
|
};
|
|
767
781
|
var unbind = function unbind() {
|
|
768
782
|
unbindDocumentClickListener();
|
|
769
783
|
unbindWindowResizeListener();
|
|
784
|
+
unbindWindowOrientationChangeListener();
|
|
770
785
|
unbindOverlayScrollListener();
|
|
771
786
|
};
|
|
772
787
|
React__namespace.useEffect(function () {
|
package/hooks/hooks.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.hooks=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 u=r(t);function c(e){if(Array.isArray(e))return e}function o(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,u,c,o,i=[],f=!0,a=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;f=!1}else for(;!(f=(r=c.call(n)).done)&&(i.push(r.value),i.length!==t);f=!0);}catch(e){a=!0,u=e}finally{try{if(!f&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(a)throw u}}return i}}function i(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 f(e,t){if(e){if("string"==typeof e)return i(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)?i(e,t):void 0}}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,t){return c(e)||o(e,t)||f(e,t)||a()}var s=function(e){var t=u.useRef(void 0);return u.useEffect((function(){t.current=e})),t.current},v=function(e){return u.useEffect((function(){return e}),[])},p=function(e){var t=e.target,r=void 0===t?"document":t,c=e.type,o=e.listener,i=e.options,f=e.when,a=void 0===f||f,l=u.useRef(null),p=u.useRef(null),d=s(i),g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.ObjectUtils.isNotEmpty(e.target)&&(m(),(e.when||a)&&(l.current=n.DomHandler.getTargetElement(e.target))),!p.current&&l.current&&(p.current=function(e){return o&&o(e)},l.current.addEventListener(c,p.current,i))},m=function(){p.current&&(l.current.removeEventListener(c,p.current,i),p.current=null)};return u.useEffect((function(){a?l.current=n.DomHandler.getTargetElement(r):(m(),l.current=null)}),[r,a]),u.useEffect((function(){!p.current||p.current===o&&d===i||(m(),a&&g())}),[o,i]),v((function(){m()})),[g,m]},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=u.useRef(null),c=u.useRef(null),o=u.useCallback((function(){return clearTimeout(r.current)}),[r.current]);return u.useEffect((function(){c.current=e})),u.useEffect((function(){if(n)return r.current=setTimeout((function(){c.current()}),t),o;o()}),[t,n]),v((function(){o()})),[o]},g={ico:"image/x-icon",png:"image/png",svg:"image/svg+xml",gif:"image/gif"};function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function y(e,t){if("object"!==m(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function b(e){var t=y(e,"string");return"symbol"===m(t)?t:String(t)}function h(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var j=function(e){var t=e.target,r=e.listener,c=e.options,o=e.when,i=void 0===o||o,f=u.useRef(null),a=u.useRef(null),l=u.useRef([]),p=s(c),d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.ObjectUtils.isNotEmpty(e.target)&&(g(),(e.when||i)&&(f.current=n.DomHandler.getTargetElement(e.target))),!a.current&&f.current){var t=l.current=n.DomHandler.getScrollableParents(f.current);a.current=function(e){return r&&r(e)},t.forEach((function(e){return e.addEventListener("scroll",a.current,c)}))}},g=function(){a.current&&(l.current.forEach((function(e){return e.removeEventListener("scroll",a.current,c)})),a.current=null)};return u.useEffect((function(){i?f.current=n.DomHandler.getTargetElement(t):(g(),f.current=null)}),[t,i]),u.useEffect((function(){!a.current||a.current===r&&p===c||(g(),i&&d())}),[r,c]),v((function(){g()})),[d,g]},P=function(e){return p({target:"window",type:"resize",listener:e.listener})},D=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"local",r="undefined"!=typeof window,c=p({target:"window",type:"storage",listener:function(e){var r="local"===n?window.localStorage:window.sessionStorage;e.storageArea===r&&e.key===t&&d(e.newValue||void 0)}}),o=l(c,2),i=o[0],f=o[1],a=u.useState(void 0),s=l(a,2),v=s[0],d=s[1],g=function(e){try{var u=e instanceof Function?e(v):e;if(d(u),r){var c=JSON.stringify(u);"local"===n?window.localStorage.setItem(t,c):window.sessionStorage.setItem(t,c)}}catch(e){throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(t))}};return u.useEffect((function(){r||d(e);try{var u="local"===n?window.localStorage.getItem(t):window.sessionStorage.getItem(t);d(u?JSON.parse(u):e)}catch(t){d(e)}return i(),function(){return f()}}),[]),[v,g]};return e.useClickOutside=function(e,t){var n=function(n){e.current&&!e.current.contains(n.target)&&t(n)},r=l(p({type:"mousedown",listener:n}),2),c=r[0],o=r[1],i=l(p({type:"touchstart",listener:n}),2),f=i[0],a=i[1];return u.useEffect((function(){if(e.current)return c(),f(),function(){o(),a()}})),[e,t]},e.useCounter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{step:1},n=u.useState(e),r=l(n,2),c=r[0],o=r[1],i=function(){t.max&&c>=t.max||o(c+t.step)},f=function(){if(t.min||0===t.min&&c<=t.min)return null;o(c-t.step)},a=function(){o(0)};return{count:c,increment:i,decrement:f,reset:a}},e.useDebounce=function(e,t){var n=l(u.useState(e),2),r=n[0],c=n[1],o=l(u.useState(e),2),i=o[0],f=o[1];return d((function(){f(r)}),t,r!==i),[r,i,c]},e.useEventListener=p,e.useFavicon=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"shortcut icon";u.useLayoutEffect((function(){if(e){document.querySelectorAll("link[rel*='icon']").forEach((function(e){document.head.removeChild(e)}));var n=document.createElement("link");n.setAttribute("type",g[e.split(".").pop()]),n.setAttribute("rel",t),n.setAttribute("href",e),document.head.appendChild(n)}}),[e,t])},e.useIntersectionObserver=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=u.useState(!1),r=l(n,2),c=r[0],o=r[1];return u.useEffect((function(){if(e.current){var n=new IntersectionObserver((function(e){var t=l(e,1);o(t[0].isIntersecting)}),t);return n.observe(e.current),function(){n.disconnect()}}}),[t,e]),c},e.useInterval=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=u.useRef(null),c=u.useRef(null),o=u.useCallback((function(){return clearInterval(r.current)}),[r.current]);return u.useEffect((function(){c.current=e})),u.useEffect((function(){if(n)return r.current=setInterval((function(){c.current()}),t),o;o()}),[t,n]),v((function(){o()})),[o]},e.useLocalStorage=function(e,t){return D(e,t,"local")},e.useMountEffect=function(e){return u.useEffect(e,[])},e.useMouse=function(){var e=l(u.useState({x:0,y:0}),2),t=e[0],n=e[1],r=u.useRef(null),c=u.useCallback((function(e){var t,u;if(r.current){var c=e.currentTarget.getBoundingClientRect();t=e.pageX-c.left-(window.pageXOffset||window.scrollX),u=e.pageY-c.top-(window.pageYOffset||window.scrollY)}else t=e.clientX,u=e.clientY;n({x:Math.max(0,Math.round(t)),y:Math.max(0,Math.round(u))})}),[]),o=l(p({target:r,type:"mousemove",listener:c}),2),i=o[0],f=o[1],a=l(p({type:"mousemove",listener:c}),2),s=a[0],v=a[1];return u.useEffect((function(){return i(),r.current||s(),function(){f(),r.current||v()}}),[s,i,v,f]),O(O({ref:r},t),{},{reset:function(){return n({x:0,y:0})}})},e.useMove=function(e){var t=e.mode,n=void 0===t?"both":t,r=e.initialValue,c=void 0===r?{x:0,y:0}:r,o=l(u.useState(c),2),i=o[0],f=o[1],a=l(u.useState(!1),2),s=a[0],v=a[1],d=u.useRef(!1),g=u.useRef(!1),m=u.useRef(null),y=function(e){return B({x:e.clientX,y:e.clientY})},b=function(e){var t=e.clampedX,r=e.clampedY;"vertical"===n?f({y:1-r}):"horizontal"===n?f({x:t}):"both"===n&&f({x:t,y:r})},h=function(){g.current&&d.current&&(g.current=!1,v(!1),_())},w=function(e){e.cancelable&&e.preventDefault(),B({x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY})},O=l(p({type:"mousemove",listener:y}),2),E=O[0],j=O[1],P=l(p({type:"mouseup",listener:h}),2),D=P[0],R=P[1],x=l(p({type:"touchmove",listener:w}),2),T=x[0],k=x[1],I=l(p({type:"touchend",listener:h}),2),M=I[0],A=I[1],C=l(p({target:m,type:"mousedown",listener:function(e){F(),e.preventDefault(),y(e)}}),2),L=C[0],X=C[1],Y=l(p({target:m,type:"touchstart",listener:function(e){e.cancelable&&e.preventDefault(),F(),w(e)},options:{passive:!1}}),2),H=Y[0],z=Y[1],N=function(e,t,n){return Math.min(Math.max(e,t),n)},U=function(e){var t=e.y;return{clampedX:N(e.x,0,1),clampedY:N(t,0,1)}},_=function(){j(),R(),k(),A()};u.useEffect((function(){d.current=!0}),[]);var F=function(){!g.current&&d.current&&(g.current=!0,v(!0),E(),D(),T(),M())},B=function(e){var t=e.x,n=e.y;if(g.current){var r=m.current.getBoundingClientRect(),u=U({x:(t-r.left)/r.width,y:(n-r.top)/r.height});b({clampedX:u.clampedX,clampedY:u.clampedY})}};return u.useEffect((function(){return m.current&&(L(),H()),function(){m.current&&(X(),z())}}),[L,H,i,X,z]),S(S({ref:m},i),{},{active:s,reset:function(){f(c)}})},e.useOverlayListener=function(e){var t=e.target,r=e.overlay,c=e.listener,o=e.when,i=void 0===o||o,f=u.useRef(null),a=u.useRef(null),s=l(p({type:"click",listener:function(e){c&&c(e,{type:"outside",valid:3!==e.which&&E(e)})}}),2),d=s[0],g=s[1],m=l(P({listener:function(e){c&&c(e,{type:"resize",valid:!n.DomHandler.isTouchDevice()})}}),2),y=m[0],b=m[1],h=l(j({target:t,listener:function(e){c&&c(e,{type:"scroll",valid:!0})}}),2),w=h[0],O=h[1],E=function(e){return f.current&&!(f.current.isSameNode(e.target)||f.current.contains(e.target)||a.current&&a.current.contains(e.target))},S=function(){g(),b(),O()};return u.useEffect((function(){i?(f.current=n.DomHandler.getTargetElement(t),a.current=n.DomHandler.getTargetElement(r)):(S(),f.current=a.current=null)}),[t,r,i]),u.useEffect((function(){S()}),[i]),v((function(){S()})),[function(){d(),y(),w()},S]},e.useOverlayScrollListener=j,e.usePrevious=s,e.useResizeListener=P,e.useSessionStorage=function(e,t){return D(e,t,"session")},e.useStorage=D,e.useTimeout=d,e.useUnmountEffect=v,e.useUpdateEffect=function(e,t){var n=u.useRef(!1);return u.useEffect((function(){if(n.current)return e&&e();n.current=!0}),t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.hooks=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 u=r(t);function c(e){if(Array.isArray(e))return e}function o(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,u,c,o,i=[],f=!0,a=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;f=!1}else for(;!(f=(r=c.call(n)).done)&&(i.push(r.value),i.length!==t);f=!0);}catch(e){a=!0,u=e}finally{try{if(!f&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(a)throw u}}return i}}function i(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 f(e,t){if(e){if("string"==typeof e)return i(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)?i(e,t):void 0}}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,t){return c(e)||o(e,t)||f(e,t)||a()}var s=function(e){var t=u.useRef(void 0);return u.useEffect((function(){t.current=e})),t.current},v=function(e){return u.useEffect((function(){return e}),[])},p=function(e){var t=e.target,r=void 0===t?"document":t,c=e.type,o=e.listener,i=e.options,f=e.when,a=void 0===f||f,l=u.useRef(null),p=u.useRef(null),d=s(i),g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.ObjectUtils.isNotEmpty(e.target)&&(m(),(e.when||a)&&(l.current=n.DomHandler.getTargetElement(e.target))),!p.current&&l.current&&(p.current=function(e){return o&&o(e)},l.current.addEventListener(c,p.current,i))},m=function(){p.current&&(l.current.removeEventListener(c,p.current,i),p.current=null)};return u.useEffect((function(){a?l.current=n.DomHandler.getTargetElement(r):(m(),l.current=null)}),[r,a]),u.useEffect((function(){!p.current||p.current===o&&d===i||(m(),a&&g())}),[o,i]),v((function(){m()})),[g,m]},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=u.useRef(null),c=u.useRef(null),o=u.useCallback((function(){return clearTimeout(r.current)}),[r.current]);return u.useEffect((function(){c.current=e})),u.useEffect((function(){if(n)return r.current=setTimeout((function(){c.current()}),t),o;o()}),[t,n]),v((function(){o()})),[o]},g={ico:"image/x-icon",png:"image/png",svg:"image/svg+xml",gif:"image/gif"};function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function y(e,t){if("object"!==m(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function b(e){var t=y(e,"string");return"symbol"===m(t)?t:String(t)}function h(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var j=function(e){var t=e.target,r=e.listener,c=e.options,o=e.when,i=void 0===o||o,f=u.useRef(null),a=u.useRef(null),l=u.useRef([]),p=s(c),d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.ObjectUtils.isNotEmpty(e.target)&&(g(),(e.when||i)&&(f.current=n.DomHandler.getTargetElement(e.target))),!a.current&&f.current){var t=l.current=n.DomHandler.getScrollableParents(f.current);a.current=function(e){return r&&r(e)},t.forEach((function(e){return e.addEventListener("scroll",a.current,c)}))}},g=function(){a.current&&(l.current.forEach((function(e){return e.removeEventListener("scroll",a.current,c)})),a.current=null)};return u.useEffect((function(){i?f.current=n.DomHandler.getTargetElement(t):(g(),f.current=null)}),[t,i]),u.useEffect((function(){!a.current||a.current===r&&p===c||(g(),i&&d())}),[r,c]),v((function(){g()})),[d,g]},P=function(e){return p({target:"window",type:"resize",listener:e.listener})},D=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"local",r="undefined"!=typeof window,c=p({target:"window",type:"storage",listener:function(e){var r="local"===n?window.localStorage:window.sessionStorage;e.storageArea===r&&e.key===t&&d(e.newValue||void 0)}}),o=l(c,2),i=o[0],f=o[1],a=u.useState(void 0),s=l(a,2),v=s[0],d=s[1],g=function(e){try{var u=e instanceof Function?e(v):e;if(d(u),r){var c=JSON.stringify(u);"local"===n?window.localStorage.setItem(t,c):window.sessionStorage.setItem(t,c)}}catch(e){throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(t))}};return u.useEffect((function(){r||d(e);try{var u="local"===n?window.localStorage.getItem(t):window.sessionStorage.getItem(t);d(u?JSON.parse(u):e)}catch(t){d(e)}return i(),function(){return f()}}),[]),[v,g]};return e.useClickOutside=function(e,t){var n=function(n){e.current&&!e.current.contains(n.target)&&t(n)},r=l(p({type:"mousedown",listener:n}),2),c=r[0],o=r[1],i=l(p({type:"touchstart",listener:n}),2),f=i[0],a=i[1];return u.useEffect((function(){if(e.current)return c(),f(),function(){o(),a()}})),[e,t]},e.useCounter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{step:1},n=u.useState(e),r=l(n,2),c=r[0],o=r[1],i=function(){t.max&&c>=t.max||o(c+t.step)},f=function(){if(t.min||0===t.min&&c<=t.min)return null;o(c-t.step)},a=function(){o(0)};return{count:c,increment:i,decrement:f,reset:a}},e.useDebounce=function(e,t){var n=l(u.useState(e),2),r=n[0],c=n[1],o=l(u.useState(e),2),i=o[0],f=o[1];return d((function(){f(r)}),t,r!==i),[r,i,c]},e.useEventListener=p,e.useFavicon=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"shortcut icon";u.useLayoutEffect((function(){if(e){document.querySelectorAll("link[rel*='icon']").forEach((function(e){document.head.removeChild(e)}));var n=document.createElement("link");n.setAttribute("type",g[e.split(".").pop()]),n.setAttribute("rel",t),n.setAttribute("href",e),document.head.appendChild(n)}}),[e,t])},e.useIntersectionObserver=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=u.useState(!1),r=l(n,2),c=r[0],o=r[1];return u.useEffect((function(){if(e.current){var n=new IntersectionObserver((function(e){var t=l(e,1);o(t[0].isIntersecting)}),t);return n.observe(e.current),function(){n.disconnect()}}}),[t,e]),c},e.useInterval=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=u.useRef(null),c=u.useRef(null),o=u.useCallback((function(){return clearInterval(r.current)}),[r.current]);return u.useEffect((function(){c.current=e})),u.useEffect((function(){if(n)return r.current=setInterval((function(){c.current()}),t),o;o()}),[t,n]),v((function(){o()})),[o]},e.useLocalStorage=function(e,t){return D(e,t,"local")},e.useMountEffect=function(e){return u.useEffect(e,[])},e.useMouse=function(){var e=l(u.useState({x:0,y:0}),2),t=e[0],n=e[1],r=u.useRef(null),c=u.useCallback((function(e){var t,u;if(r.current){var c=e.currentTarget.getBoundingClientRect();t=e.pageX-c.left-(window.pageXOffset||window.scrollX),u=e.pageY-c.top-(window.pageYOffset||window.scrollY)}else t=e.clientX,u=e.clientY;n({x:Math.max(0,Math.round(t)),y:Math.max(0,Math.round(u))})}),[]),o=l(p({target:r,type:"mousemove",listener:c}),2),i=o[0],f=o[1],a=l(p({type:"mousemove",listener:c}),2),s=a[0],v=a[1];return u.useEffect((function(){return i(),r.current||s(),function(){f(),r.current||v()}}),[s,i,v,f]),O(O({ref:r},t),{},{reset:function(){return n({x:0,y:0})}})},e.useMove=function(e){var t=e.mode,n=void 0===t?"both":t,r=e.initialValue,c=void 0===r?{x:0,y:0}:r,o=l(u.useState(c),2),i=o[0],f=o[1],a=l(u.useState(!1),2),s=a[0],v=a[1],d=u.useRef(!1),g=u.useRef(!1),m=u.useRef(null),y=function(e){return B({x:e.clientX,y:e.clientY})},b=function(e){var t=e.clampedX,r=e.clampedY;"vertical"===n?f({y:1-r}):"horizontal"===n?f({x:t}):"both"===n&&f({x:t,y:r})},h=function(){g.current&&d.current&&(g.current=!1,v(!1),_())},w=function(e){e.cancelable&&e.preventDefault(),B({x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY})},O=l(p({type:"mousemove",listener:y}),2),E=O[0],j=O[1],P=l(p({type:"mouseup",listener:h}),2),D=P[0],R=P[1],x=l(p({type:"touchmove",listener:w}),2),T=x[0],k=x[1],I=l(p({type:"touchend",listener:h}),2),M=I[0],A=I[1],C=l(p({target:m,type:"mousedown",listener:function(e){F(),e.preventDefault(),y(e)}}),2),L=C[0],X=C[1],Y=l(p({target:m,type:"touchstart",listener:function(e){e.cancelable&&e.preventDefault(),F(),w(e)},options:{passive:!1}}),2),H=Y[0],z=Y[1],N=function(e,t,n){return Math.min(Math.max(e,t),n)},U=function(e){var t=e.y;return{clampedX:N(e.x,0,1),clampedY:N(t,0,1)}},_=function(){j(),R(),k(),A()};u.useEffect((function(){d.current=!0}),[]);var F=function(){!g.current&&d.current&&(g.current=!0,v(!0),E(),D(),T(),M())},B=function(e){var t=e.x,n=e.y;if(g.current){var r=m.current.getBoundingClientRect(),u=U({x:(t-r.left)/r.width,y:(n-r.top)/r.height});b({clampedX:u.clampedX,clampedY:u.clampedY})}};return u.useEffect((function(){return m.current&&(L(),H()),function(){m.current&&(X(),z())}}),[L,H,i,X,z]),S(S({ref:m},i),{},{active:s,reset:function(){f(c)}})},e.useOverlayListener=function(e){var t=e.target,r=e.overlay,c=e.listener,o=e.when,i=void 0===o||o,f=u.useRef(null),a=u.useRef(null),s=l(p({type:"click",listener:function(e){c&&c(e,{type:"outside",valid:3!==e.which&&R(e)})}}),2),d=s[0],g=s[1],m=l(P({listener:function(e){c&&c(e,{type:"resize",valid:!n.DomHandler.isTouchDevice()})}}),2),y=m[0],b=m[1],h=l(p({target:"window",type:"orientationchange",listener:function(e){c&&c(e,{type:"orientationchange",valid:!0})}}),2),w=h[0],O=h[1],E=l(j({target:t,listener:function(e){c&&c(e,{type:"scroll",valid:!0})}}),2),S=E[0],D=E[1],R=function(e){return f.current&&!(f.current.isSameNode(e.target)||f.current.contains(e.target)||a.current&&a.current.contains(e.target))},x=function(){g(),b(),O(),D()};return u.useEffect((function(){i?(f.current=n.DomHandler.getTargetElement(t),a.current=n.DomHandler.getTargetElement(r)):(x(),f.current=a.current=null)}),[t,r,i]),u.useEffect((function(){x()}),[i]),v((function(){x()})),[function(){d(),y(),w(),S()},x]},e.useOverlayScrollListener=j,e.usePrevious=s,e.useResizeListener=P,e.useSessionStorage=function(e,t){return D(e,t,"session")},e.useStorage=D,e.useTimeout=d,e.useUnmountEffect=v,e.useUpdateEffect=function(e,t){var n=u.useRef(!1);return u.useEffect((function(){if(n.current)return e&&e();n.current=!0}),t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils);
|
package/menubar/menubar.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.p-menubar{display:flex;align-items:center}.p-menubar ul{margin:0;padding:0;list-style:none}.p-menubar .p-menuitem-link{cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-menubar .p-menuitem-text{line-height:1}.p-menubar .p-menuitem{position:relative}.p-menubar-root-list{display:flex;align-items:center}.p-menubar-root-list>li ul{display:none;z-index:1}.p-menubar-root-list>.p-menuitem-active>.p-submenu-list{display:block}.p-menubar .p-submenu-list{display:none;position:absolute;z-index:1}.p-menubar .p-submenu-list>.p-menuitem-active>.p-submenu-list{display:block;left:100%;top:0}.p-menubar .p-submenu-list .p-menuitem-link .p-submenu-icon{margin-left:auto}.p-menubar .p-menubar-custom,.p-menubar .p-menubar-end{margin-left:auto;align-self:center}.p-menubar-button{display:none;cursor:pointer;align-items:center;justify-content:center;text-decoration:none}
|
|
1
|
+
.p-menubar{display:flex;align-items:center}.p-menubar ul{margin:0;padding:0;list-style:none}.p-menubar .p-menuitem-link{cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-menubar .p-menuitem-text{line-height:1}.p-menubar .p-menuitem{position:relative}.p-menubar-root-list{display:flex;align-items:center;flex-wrap:wrap}.p-menubar-root-list>li ul{display:none;z-index:1}.p-menubar-root-list>.p-menuitem-active>.p-submenu-list{display:block}.p-menubar .p-submenu-list{display:none;position:absolute;z-index:1}.p-menubar .p-submenu-list>.p-menuitem-active>.p-submenu-list{display:block;left:100%;top:0}.p-menubar .p-submenu-list .p-menuitem-link .p-submenu-icon{margin-left:auto}.p-menubar .p-menubar-custom,.p-menubar .p-menubar-end{margin-left:auto;align-self:center}.p-menubar-button{display:none;cursor:pointer;align-items:center;justify-content:center;text-decoration:none}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var PrimeReact = require('primereact/api');
|
|
7
7
|
var hooks = require('primereact/hooks');
|
|
8
8
|
var utils = require('primereact/utils');
|
|
9
9
|
var button = require('primereact/button');
|
|
10
10
|
var ripple = require('primereact/ripple');
|
|
11
11
|
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
12
14
|
function _interopNamespace(e) {
|
|
13
15
|
if (e && e.__esModule) return e;
|
|
14
16
|
var n = Object.create(null);
|
|
@@ -28,6 +30,7 @@ function _interopNamespace(e) {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
|
+
var PrimeReact__default = /*#__PURE__*/_interopDefaultLegacy(PrimeReact);
|
|
31
34
|
|
|
32
35
|
function _extends() {
|
|
33
36
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -127,6 +130,7 @@ var OrderListBase = {
|
|
|
127
130
|
dragdrop: false,
|
|
128
131
|
tabIndex: 0,
|
|
129
132
|
dataKey: null,
|
|
133
|
+
breakpoint: '960px',
|
|
130
134
|
onChange: null,
|
|
131
135
|
itemTemplate: null,
|
|
132
136
|
filter: false,
|
|
@@ -474,8 +478,13 @@ var OrderList = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespac
|
|
|
474
478
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
475
479
|
filterValueState = _React$useState4[0],
|
|
476
480
|
setFilterValueState = _React$useState4[1];
|
|
481
|
+
var _React$useState5 = React__namespace.useState(null),
|
|
482
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
483
|
+
attributeSelectorState = _React$useState6[0],
|
|
484
|
+
setAttributeSelectorState = _React$useState6[1];
|
|
477
485
|
var hasFilter = utils.ObjectUtils.isNotEmpty(filterValueState);
|
|
478
486
|
var elementRef = React__namespace.useRef(null);
|
|
487
|
+
var styleElementRef = React__namespace.useRef(null);
|
|
479
488
|
var reorderDirection = React__namespace.useRef(null);
|
|
480
489
|
var onItemClick = function onItemClick(event) {
|
|
481
490
|
var metaKey = event.originalEvent.metaKey || event.originalEvent.ctrlKey;
|
|
@@ -542,7 +551,7 @@ var OrderList = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespac
|
|
|
542
551
|
if (hasFilter) {
|
|
543
552
|
var filterValue = filterValueState.trim().toLocaleLowerCase(props.filterLocale);
|
|
544
553
|
var searchFields = props.filterBy ? props.filterBy.split(',') : [];
|
|
545
|
-
return
|
|
554
|
+
return PrimeReact.FilterService.filter(props.value, searchFields, filterValue, props.filterMatchMode, props.filterLocale);
|
|
546
555
|
}
|
|
547
556
|
return props.value;
|
|
548
557
|
};
|
|
@@ -586,6 +595,16 @@ var OrderList = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespac
|
|
|
586
595
|
}
|
|
587
596
|
}
|
|
588
597
|
};
|
|
598
|
+
var createStyle = function createStyle() {
|
|
599
|
+
if (!styleElementRef.current) {
|
|
600
|
+
styleElementRef.current = utils.DomHandler.createInlineStyle(PrimeReact__default["default"].nonce);
|
|
601
|
+
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");
|
|
602
|
+
styleElementRef.current.innerHTML = innerHTML;
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
var destroyStyle = function destroyStyle() {
|
|
606
|
+
styleElementRef.current = utils.DomHandler.removeInlineStyle(styleElementRef.current);
|
|
607
|
+
};
|
|
589
608
|
React__namespace.useImperativeHandle(ref, function () {
|
|
590
609
|
return {
|
|
591
610
|
props: props,
|
|
@@ -594,6 +613,18 @@ var OrderList = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespac
|
|
|
594
613
|
}
|
|
595
614
|
};
|
|
596
615
|
});
|
|
616
|
+
hooks.useMountEffect(function () {
|
|
617
|
+
!attributeSelectorState && setAttributeSelectorState(utils.UniqueComponentId());
|
|
618
|
+
});
|
|
619
|
+
hooks.useUpdateEffect(function () {
|
|
620
|
+
if (attributeSelectorState) {
|
|
621
|
+
elementRef.current.setAttribute(attributeSelectorState, '');
|
|
622
|
+
createStyle();
|
|
623
|
+
}
|
|
624
|
+
return function () {
|
|
625
|
+
destroyStyle();
|
|
626
|
+
};
|
|
627
|
+
}, [attributeSelectorState, props.breakpoint]);
|
|
597
628
|
hooks.useUpdateEffect(function () {
|
|
598
629
|
if (reorderDirection.current) {
|
|
599
630
|
updateListScroll();
|
|
@@ -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
|
@@ -65,6 +65,11 @@ export interface OrderListProps extends Omit<React.DetailedHTMLProps<React.HTMLA
|
|
|
65
65
|
* Name of the field that uniquely identifies the a record in the data.
|
|
66
66
|
*/
|
|
67
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;
|
|
68
73
|
/**
|
|
69
74
|
* When specified, displays an input field to filter the items on keyup.
|
|
70
75
|
* @defaultValue false
|
|
@@ -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);
|
|
@@ -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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.",
|
|
@@ -53,4 +53,4 @@
|
|
|
53
53
|
"sideEffects": [
|
|
54
54
|
"**/*.css"
|
|
55
55
|
]
|
|
56
|
-
}
|
|
56
|
+
}
|