2 lines
9.5 KiB
JavaScript
2 lines
9.5 KiB
JavaScript
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/paginator"),r=require("primereact/utils"),n=require("primereact/ripple"),o=require("primereact/api");function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=a(t);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function l(t){if(Array.isArray(t))return s(t)}function p(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function u(t,e){if(t){if("string"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}function c(){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 f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,r){return e&&h(t.prototype,e),r&&h(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function g(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function y(t,e){return y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},y(t,e)}function m(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(t,e){if(e&&("object"===v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return g(t)}function P(t){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},P(t)}function w(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function k(t){var e=E();return function(){var r,n=P(t);if(e){var o=P(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return b(this,r)}}function E(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var N=function(e){m(a,t.Component);var o=k(a);function a(t){var e;return f(this,a),(e=o.call(this,t)).changeLayout=e.changeLayout.bind(g(e)),e}return d(a,[{key:"changeLayout",value:function(t,e){this.props.onChange({originalEvent:t,value:e}),t.preventDefault()}},{key:"render",value:function(){var t=this,e=r.classNames("p-dataview-layout-options p-selectbutton p-buttonset",this.props.className),o=r.classNames("p-button p-button-icon-only",{"p-highlight":"list"===this.props.layout}),a=r.classNames("p-button p-button-icon-only",{"p-highlight":"grid"===this.props.layout});return i.default.createElement("div",{id:this.props.id,style:this.props.style,className:e},i.default.createElement("button",{type:"button",className:o,onClick:function(e){return t.changeLayout(e,"list")}},i.default.createElement("i",{className:"pi pi-bars"}),i.default.createElement(n.Ripple,null)),i.default.createElement("button",{type:"button",className:a,onClick:function(e){return t.changeLayout(e,"grid")}},i.default.createElement("i",{className:"pi pi-th-large"}),i.default.createElement(n.Ripple,null)))}}]),a}();w(N,"defaultProps",{id:null,style:n
|