Comparing version 3.0.0 to 3.1.0
@@ -1,1 +0,1 @@ | ||
"use strict";var _actionTypes=require("./actionTypes");Object.defineProperty(exports,"__esModule",{value:!0}),exports.updateDataList=updateDataList,exports.deselectAll=deselectAll,exports.selectAll=selectAll,exports.setUniqueKey=setUniqueKey;function updateDataList(a){return{type:_actionTypes.UPDATE_DATA_LIST,payload:{dataList:a}}}function deselectAll(){return{type:_actionTypes.DESELECT_ALL}}function selectAll(){return{type:_actionTypes.SELECT_ALL}}function setUniqueKey(a){return{type:_actionTypes.SET_UNIQUE_KEY,payload:{uniqueKey:a}}} | ||
"use strict";var _actionTypes=require("./actionTypes");Object.defineProperty(exports,"__esModule",{value:!0}),exports.updateDataList=updateDataList,exports.deselectAll=deselectAll,exports.selectAll=selectAll,exports.setUniqueKey=setUniqueKey;function updateDataList(a,b){return{type:_actionTypes.UPDATE_DATA_LIST,payload:{dataList:a,GlobalUniqueId:b}}}function deselectAll(a){return{type:_actionTypes.DESELECT_ALL,payload:{GlobalUniqueId:a}}}function selectAll(a){return{type:_actionTypes.SELECT_ALL,payload:{GlobalUniqueId:a}}}function setUniqueKey(a){return{type:_actionTypes.SET_UNIQUE_KEY,payload:{uniqueKey:a}}} |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}const initialState={dataList:[],uniqueKey:"Id"};function addReducer(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,b=1<arguments.length?arguments[1]:void 0;switch(b.type){case"UPDATE_DATA_LIST":return _objectSpread(_objectSpread({},a),{},{dataList:b.payload.dataList});case"DESELECT_ALL":return _objectSpread(_objectSpread({},a),{},{dataList:a.dataList.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!1}))});case"SELECT_ALL":return _objectSpread(_objectSpread({},a),{},{dataList:a.dataList.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!0}))});case"SET_UNIQUE_KEY":return _objectSpread(_objectSpread({},a),{},{uniqueKey:b.payload.uniqueKey});default:return a;}}var _default=addReducer;exports.default=_default; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}const initialState={};function addReducer(){var a;let b=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,c=1<arguments.length?arguments[1]:void 0;const d=null===c||void 0===c||null===(a=c.payload)||void 0===a?void 0:a.GlobalUniqueId;switch(c.type){case"UPDATE_DATA_LIST":return _objectSpread(_objectSpread({},b),{},{[d]:_objectSpread(_objectSpread({},b[d]),{},{dataList:c.payload.dataList})});case"DESELECT_ALL":return _objectSpread(_objectSpread({},b),{},{[d]:_objectSpread(_objectSpread({},b[d]),{},{dataList:b[d].dataList.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!1}))})});case"SELECT_ALL":return _objectSpread(_objectSpread({},b),{},{[d]:_objectSpread(_objectSpread({},b[d]),{},{dataList:b[d].dataList.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!0}))})});case"SET_UNIQUE_KEY":return _objectSpread(_objectSpread({},b),{},{[d]:_objectSpread(_objectSpread({},b[d]),{},{uniqueKey:c.payload.uniqueKey})});default:return b;}}var _default=addReducer;exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";const _excluded=["isSelected"];Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.array.sort.js"),require("./SuperDD.css");var _react=_interopRequireWildcard(require("react")),_reactRedux=require("react-redux"),_actions=require("../Redux/actions"),_enums=require("../Common/enums");function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!=typeof a&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}const SuperDD=/*#__PURE__*/_react.default.memo(a=>{const{DataList:b,UniqueKey:c,DisplayBy:d,PlaceHolder:f="Select Items ...",ShowUpdateButton:g=!0,ShowCancelButton:h=!0,UpdateAction:i=()=>{},CancelAction:j=()=>{},Filterable:k=!0,Sortable:l=!0,SetSelectedItems:e,CloseAfterEachUpdate:m=!1,SelectFiltered:n=!1}=a;if(!c)throw new Error("the name of the UniqueKey of your data must be provided");const o=(0,_reactRedux.useDispatch)(),[p,q]=(0,_react.useState)(""),[r,s]=(0,_react.useState)(!1),[t,u]=(0,_react.useState)(_enums.SortState.None),v=(0,_reactRedux.useSelector)(a=>a.dataList),w=function getInitLocalDataList(){let a=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0];if(a&&0<v.length)return v;var c;return null!==(c=null===b||void 0===b?void 0:b.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!1})))&&void 0!==c?c:[]},[x,y]=(0,_react.useState)(w());(0,_react.useEffect)(()=>{o((0,_actions.setUniqueKey)(c))},[c]),(0,_react.useEffect)(()=>{""!=v.map(a=>a.isSelected).toString()&&(y(w()),F())},[v.map(a=>a.isSelected).toString()]),(0,_react.useEffect)(()=>{o((0,_actions.updateDataList)([])),y(w(!1))},[b.map(a=>a[c]).toString()]);const z=(a,b)=>{y(x.map(d=>_objectSpread(_objectSpread({},d),{},{isSelected:d[c]==b[c]?a.target.checked:d.isSelected})))},A=()=>x.filter(a=>-1!==a[d].toLowerCase().indexOf(null===p||void 0===p?void 0:p.toLowerCase())),B=()=>{y(x.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!1})))},C=()=>{y(x.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!0})))},D=()=>{let a=A();y(x.map(b=>_objectSpread(_objectSpread({},b),{},{isSelected:!(-1!=a.findIndex(a=>a[c]===b[c]))&&b.isSelected})))},E=()=>{let a=A();y(x.map(b=>_objectSpread(_objectSpread({},b),{},{isSelected:-1!=a.findIndex(a=>a[c]===b[c])||b.isSelected})))},F=()=>{const a=[...v.filter(a=>a.isSelected).map(a=>{const{isSelected:b}=a,c=_objectWithoutProperties(a,_excluded);return c})];e&&e(a),i(a)},G=()=>{r?(s(!1),q("")):s(!0)},H=()=>x.every(a=>a.isSelected),I=()=>A().every(a=>a.isSelected);return/*#__PURE__*/_react.default.createElement("div",{className:"supperDD"},/*#__PURE__*/_react.default.createElement("div",{className:"superdd-select-wrapper"},/*#__PURE__*/_react.default.createElement("div",{className:"superdd-select"},/*#__PURE__*/_react.default.createElement("div",{onClick:G,className:r?"superdd-select-output active":"superdd-select-output"},/*#__PURE__*/_react.default.createElement("p",null,f),/*#__PURE__*/_react.default.createElement("div",{className:"icon"},/*#__PURE__*/_react.default.createElement("div",{className:"dropdown"}))),/*#__PURE__*/_react.default.createElement("div",{className:r?"superdd-select-box show":"superdd-select-box"},k&&/*#__PURE__*/_react.default.createElement("div",{className:"superdd-search-input-container"},/*#__PURE__*/_react.default.createElement("input",{className:"superdd-search-input",onChange:a=>{q(a.target.value)},value:p,type:"text"}),0===A().length&&/*#__PURE__*/_react.default.createElement("div",{className:"superdd-selectall-container-no-items"},"No items Found"),0<A().length&&/*#__PURE__*/_react.default.createElement("div",{className:"superdd-selectall-container"},/*#__PURE__*/_react.default.createElement("div",{className:"selectall-checkbox"},/*#__PURE__*/_react.default.createElement("input",{type:"checkbox",onChange:n?()=>{I()?D():E()}:()=>{H()?B():C()},className:"superdd-selectall-input supperDDcheckbox",title:"Select All",checked:n?I():H()}),/*#__PURE__*/_react.default.createElement("label",null,"Select All")),/*#__PURE__*/_react.default.createElement("div",{onClick:()=>{switch(t){case _enums.SortState.None:u(_enums.SortState.Asc);break;case _enums.SortState.Asc:u(_enums.SortState.Des);break;case _enums.SortState.Des:u(_enums.SortState.None);break;default:}},className:"sort-button"},(()=>{if(!l)return"";return t===_enums.SortState.None?/*#__PURE__*/_react.default.createElement("span",null,"\u296F"):t===_enums.SortState.Asc?/*#__PURE__*/_react.default.createElement("span",null,"\u2963"):t===_enums.SortState.Des?/*#__PURE__*/_react.default.createElement("span",null,"\u2965"):""})()))),/*#__PURE__*/_react.default.createElement("div",{className:"supperDDcheckbox-list-container"},(()=>{let a=A(),b=a;return(t==_enums.SortState.Asc||t==_enums.SortState.Des)&&l&&(b=a.sort(function(c,a){var b=c[d].toUpperCase(),e=a[d].toUpperCase();return b<e?t==_enums.SortState.Asc?-1:1:b>e?t==_enums.SortState.Asc?1:-1:0})),b.map((a,b)=>/*#__PURE__*/_react.default.createElement("div",{key:b,className:"supperDDcheckbox-container"+(a.isSelected?" supperDDcheckbox-active":"")},/*#__PURE__*/_react.default.createElement("input",{type:"checkbox",className:"supperDDcheckbox",onChange:b=>z(b,a),checked:a.isSelected}),/*#__PURE__*/_react.default.createElement("label",{className:"supperDDcheckbox-label"},a[d])))})()),/*#__PURE__*/_react.default.createElement("div",{className:"superdd-select-buttons"},g&&/*#__PURE__*/_react.default.createElement("button",{onClick:()=>{o((0,_actions.updateDataList)(x)),m&&G()},type:"button"},"Update"),h&&/*#__PURE__*/_react.default.createElement("button",{onClick:()=>{j(),G()},type:"button"},"Cancel"))))))});var _default=SuperDD;exports.default=_default; | ||
"use strict";const _excluded=["isSelected"];Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.array.sort.js"),require("./SuperDD.css");var _react=_interopRequireWildcard(require("react")),_reactRedux=require("react-redux"),_actions=require("../Redux/actions"),_enums=require("../Common/enums");function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!=typeof a&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}const SuperDD=/*#__PURE__*/_react.default.memo(a=>{const{DataList:b,UniqueKey:c,DisplayBy:d,PlaceHolder:g="Select Items ...",ShowUpdateButton:h=!0,ShowCancelButton:i=!0,UpdateAction:j=()=>{},CancelAction:k=()=>{},Filterable:l=!0,Sortable:m=!0,SetSelectedItems:e,CloseAfterEachUpdate:n=!1,SelectFiltered:o=!1,GlobalUniqueId:f}=a;if(!c)throw new Error("UniqueKey of your data must be provided");if(!f)throw new Error("GlobalUniqueId of your data must be provided");const p=(0,_reactRedux.useDispatch)(),[q,r]=(0,_react.useState)(""),[s,t]=(0,_react.useState)(!1),[u,v]=(0,_react.useState)(_enums.SortState.None),w=(0,_reactRedux.useSelector)(a=>{var b,c;return null!==(b=null===(c=a[f])||void 0===c?void 0:c.dataList)&&void 0!==b?b:[]}),x=function getInitLocalDataList(){let a=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0];if(a&&0<w.length)return w;var c;return null!==(c=null===b||void 0===b?void 0:b.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!1})))&&void 0!==c?c:[]},[y,z]=(0,_react.useState)(x());(0,_react.useEffect)(()=>{p((0,_actions.setUniqueKey)(c))},[c,f]),(0,_react.useEffect)(()=>{""!=w.map(a=>a.isSelected).toString()&&(z(x()),G())},[w.map(a=>a.isSelected).toString()]),(0,_react.useEffect)(()=>{p((0,_actions.updateDataList)([],f)),z(x(!1))},[f,b.map(a=>a[c]).toString()]);const A=(a,b)=>{z(y.map(d=>_objectSpread(_objectSpread({},d),{},{isSelected:d[c]==b[c]?a.target.checked:d.isSelected})))},B=()=>y.filter(a=>-1!==a[d].toLowerCase().indexOf(null===q||void 0===q?void 0:q.toLowerCase())),C=()=>{z(y.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!1})))},D=()=>{z(y.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:!0})))},E=()=>{let a=B();z(y.map(b=>_objectSpread(_objectSpread({},b),{},{isSelected:!(-1!=a.findIndex(a=>a[c]===b[c]))&&b.isSelected})))},F=()=>{let a=B();z(y.map(b=>_objectSpread(_objectSpread({},b),{},{isSelected:-1!=a.findIndex(a=>a[c]===b[c])||b.isSelected})))},G=()=>{const a=[...w.filter(a=>a.isSelected).map(a=>{const{isSelected:b}=a,c=_objectWithoutProperties(a,_excluded);return c})];e&&e(a),j(a)},H=()=>{s?(t(!1),r("")):t(!0)},I=()=>y.every(a=>a.isSelected),J=()=>B().every(a=>a.isSelected);return/*#__PURE__*/_react.default.createElement("div",{className:"supperDD"},/*#__PURE__*/_react.default.createElement("div",{className:"superdd-select-wrapper"},/*#__PURE__*/_react.default.createElement("div",{className:"superdd-select"},/*#__PURE__*/_react.default.createElement("div",{onClick:H,className:s?"superdd-select-output active":"superdd-select-output"},/*#__PURE__*/_react.default.createElement("p",null,g),/*#__PURE__*/_react.default.createElement("div",{className:"icon"},/*#__PURE__*/_react.default.createElement("div",{className:"dropdown"}))),/*#__PURE__*/_react.default.createElement("div",{className:s?"superdd-select-box show":"superdd-select-box"},l&&/*#__PURE__*/_react.default.createElement("div",{className:"superdd-search-input-container"},/*#__PURE__*/_react.default.createElement("input",{className:"superdd-search-input",onChange:a=>{r(a.target.value)},value:q,type:"text"}),0===B().length&&/*#__PURE__*/_react.default.createElement("div",{className:"superdd-selectall-container-no-items"},"No items Found"),0<B().length&&/*#__PURE__*/_react.default.createElement("div",{className:"superdd-selectall-container"},/*#__PURE__*/_react.default.createElement("div",{className:"selectall-checkbox"},/*#__PURE__*/_react.default.createElement("input",{type:"checkbox",onChange:o?()=>{J()?E():F()}:()=>{I()?C():D()},className:"superdd-selectall-input supperDDcheckbox",title:"Select All",checked:o?J():I()}),/*#__PURE__*/_react.default.createElement("label",null,"Select All")),/*#__PURE__*/_react.default.createElement("div",{onClick:()=>{switch(u){case _enums.SortState.None:v(_enums.SortState.Asc);break;case _enums.SortState.Asc:v(_enums.SortState.Des);break;case _enums.SortState.Des:v(_enums.SortState.None);break;default:}},className:"sort-button"},(()=>{if(!m)return"";return u===_enums.SortState.None?/*#__PURE__*/_react.default.createElement("span",null,"\u296F"):u===_enums.SortState.Asc?/*#__PURE__*/_react.default.createElement("span",null,"\u2963"):u===_enums.SortState.Des?/*#__PURE__*/_react.default.createElement("span",null,"\u2965"):""})()))),/*#__PURE__*/_react.default.createElement("div",{className:"supperDDcheckbox-list-container"},(()=>{let a=B(),b=a;return(u==_enums.SortState.Asc||u==_enums.SortState.Des)&&m&&(b=a.sort(function(c,a){var b=c[d].toUpperCase(),e=a[d].toUpperCase();return b<e?u==_enums.SortState.Asc?-1:1:b>e?u==_enums.SortState.Asc?1:-1:0})),b.map((a,b)=>/*#__PURE__*/_react.default.createElement("div",{key:b,className:"supperDDcheckbox-container"+(a.isSelected?" supperDDcheckbox-active":"")},/*#__PURE__*/_react.default.createElement("input",{type:"checkbox",className:"supperDDcheckbox",onChange:b=>A(b,a),checked:a.isSelected}),/*#__PURE__*/_react.default.createElement("label",{className:"supperDDcheckbox-label"},a[d])))})()),/*#__PURE__*/_react.default.createElement("div",{className:"superdd-select-buttons"},h&&/*#__PURE__*/_react.default.createElement("button",{onClick:()=>{p((0,_actions.updateDataList)(y,f)),n&&H()},type:"button"},"Update"),i&&/*#__PURE__*/_react.default.createElement("button",{onClick:()=>{k(),H()},type:"button"},"Cancel"))))))});var _default=SuperDD;exports.default=_default; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("./TagsContainer.css");var _react=_interopRequireWildcard(require("react")),_reactRedux=require("react-redux"),_actions=require("../Redux/actions");function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!=typeof a&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}const TagsContainer=/*#__PURE__*/_react.default.memo(a=>{var b;const{DisplayBy:c,TagsHasDeselect:d=!0,ContainerHasDeselect:e=!0,DeselectAll:f=!1,DeselectAllSetter:g=()=>{}}=a;if(!c)throw new Error("the DisplayBy must be provided to TagsContainer");const h=(0,_reactRedux.useDispatch)(),i=(0,_reactRedux.useSelector)(a=>a.dataList),j=(0,_reactRedux.useSelector)(a=>a.uniqueKey);(0,_react.useEffect)(()=>{var a;l(null!==(a=null===i||void 0===i?void 0:i.filter(a=>a.isSelected))&&void 0!==a?a:[])},[i]);const[k,l]=(0,_react.useState)(null!==(b=null===i||void 0===i?void 0:i.filter(a=>a.isSelected))&&void 0!==b?b:[]),m=(a,b)=>{h((0,_actions.updateDataList)([...i.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:a[j]!=b[j]&&a.isSelected}))]))};(0,_react.useEffect)(()=>{f&&g&&(n(),g(!1))},[f]);const n=()=>{h((0,_actions.deselectAll)())};return/*#__PURE__*/_react.default.createElement("div",{className:"tags-container"},/*#__PURE__*/_react.default.createElement("ul",{id:"tags"},k.map((a,b)=>/*#__PURE__*/_react.default.createElement("li",{key:b,className:"tag"},/*#__PURE__*/_react.default.createElement("span",{className:"tag-title"},a[c]),d&&/*#__PURE__*/_react.default.createElement("span",{className:"tag-close-icon",onClick:b=>m(b,a)},"\u2716")))),1<k.length&&e&&/*#__PURE__*/_react.default.createElement("button",{onClick:n,className:"close-button"},"\u2716"))});var _default=TagsContainer;exports.default=_default; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("./TagsContainer.css");var _react=_interopRequireWildcard(require("react")),_reactRedux=require("react-redux"),_actions=require("../Redux/actions");function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function _getRequireWildcardCache(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!=typeof a&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}const TagsContainer=/*#__PURE__*/_react.default.memo(a=>{var b;const{DisplayBy:c,TagsHasDeselect:e=!0,ContainerHasDeselect:f=!0,maxTagsBeforeShowMore:g=null,DeselectAll:h=!1,DeselectAllSetter:i=()=>{},GlobalUniqueId:d}=a;if(!c)throw new Error("the DisplayBy must be provided to TagsContainer");if(!d)throw new Error("GlobalUniqueId of your data must be provided");const j=(0,_reactRedux.useDispatch)(),k=(0,_reactRedux.useSelector)(a=>{var b,c;return null!==(b=null===(c=a[d])||void 0===c?void 0:c.dataList)&&void 0!==b?b:[]}),l=(0,_reactRedux.useSelector)(a=>{var b,c;return null!==(b=null===(c=a[d])||void 0===c?void 0:c.uniqueKey)&&void 0!==b?b:"Id"});(0,_react.useEffect)(()=>{var a;n(null!==(a=null===k||void 0===k?void 0:k.filter(a=>a.isSelected))&&void 0!==a?a:[])},[k]);const[m,n]=(0,_react.useState)(null!==(b=null===k||void 0===k?void 0:k.filter(a=>a.isSelected))&&void 0!==b?b:[]),o=(a,b)=>{j((0,_actions.updateDataList)([...k.map(a=>_objectSpread(_objectSpread({},a),{},{isSelected:a[l]!=b[l]&&a.isSelected}))],d))};(0,_react.useEffect)(()=>{h&&i&&(p(),i(!1))},[h]);const p=()=>{j((0,_actions.deselectAll)(d))},[q,r]=(0,_react.useState)(!1),s=g&&0<g;return/*#__PURE__*/_react.default.createElement("div",{className:"tags-container"},/*#__PURE__*/_react.default.createElement("ul",{id:"tags"},m.map((a,b)=>s&&b+1>g&&!q?null:/*#__PURE__*/_react.default.createElement("li",{key:b,className:"tag"},/*#__PURE__*/_react.default.createElement("span",{className:"tag-title"},a[c]),e&&/*#__PURE__*/_react.default.createElement("span",{className:"tag-close-icon",onClick:b=>o(b,a)},"\u2716"))),s&&!q&&m.length>g&&/*#__PURE__*/_react.default.createElement("li",{className:"tag"},/*#__PURE__*/_react.default.createElement("span",{className:"tag-title",style:{cursor:"pointer"},onClick:()=>{r(!0)}},"+".concat(m.length-g," More"))),s&&q&&/*#__PURE__*/_react.default.createElement("li",{className:"tag"},/*#__PURE__*/_react.default.createElement("span",{className:"tag-title",style:{cursor:"pointer"},onClick:()=>{r(!1)}},"...Show Less"))),1<m.length&&f&&/*#__PURE__*/_react.default.createElement("button",{onClick:p,className:"close-button"},"\u2716"))});var _default=TagsContainer;exports.default=_default; |
{ | ||
"name": "superdd", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "[Super Drop Down] is a very useful react component for multi selection dropdown with Filtering, Sorting, Toggle selecting all, Tags in another component and Custom buttons inside dropdown with custom functions can be provided from the outside ", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27658