Socket
Socket
Sign inDemoInstall

@jswork/react-draggable-list

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jswork/react-draggable-list - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

2

dist/index.cjs.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var M=Object.create;var y=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptor,Y=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,F=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var v=(o,e,t)=>e in o?y(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,_=(o,e)=>{for(var t in e||(e={}))I.call(e,t)&&v(o,t,e[t]);if(u)for(var t of u(e))w.call(e,t)&&v(o,t,e[t]);return o},P=(o,e)=>G(o,Y(e)),a=(o,e)=>y(o,"name",{value:e,configurable:!0});var x=(o,e)=>{var t={};for(var n in o)I.call(o,n)&&e.indexOf(n)<0&&(t[n]=o[n]);if(o!=null&&u)for(var n of u(o))e.indexOf(n)<0&&w.call(o,n)&&(t[n]=o[n]);return t};var C=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var V=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of $(e))!I.call(o,s)&&s!==t&&y(o,s,{get:()=>e[s],enumerable:!(n=J(e,s))||n.enumerable});return o};var g=(o,e,t)=>(t=o!=null?M(F(o)):{},V(e||!o||!o.__esModule?y(t,"default",{value:o,enumerable:!0}):t,o));var i=(o,e,t)=>(v(o,typeof e!="symbol"?e+"":e,t),t);var T=C((f,b)=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});var R=a(function(){},"NOOP"),k="",q=[],z={};b.exports=R;f.default=R;f.NOOP_STRING=k;f.NOOP_ARRAY=q;f.NOOP_OBJECT=z});var E=C((ee,O)=>{(function(){"use strict";var o={}.hasOwnProperty;function e(){for(var s="",r=0;r<arguments.length;r++){var c=arguments[r];c&&(s=n(s,t(c)))}return s}a(e,"classNames");function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var r="";for(var c in s)o.call(s,c)&&s[c]&&(r=n(r,c));return r}a(t,"parseValue");function n(s,r){return r?s?s+" "+r:s+r:s}a(n,"appendClass"),typeof O!="undefined"&&O.exports?(e.default=e,O.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var K=g(T()),j=g(E());var _reactlist = require('@jswork/react-list'); var _reactlist2 = _interopRequireDefault(_reactlist);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _sortablejs = require('sortablejs'); var _sortablejs2 = _interopRequireDefault(_sortablejs);var h="react-draggable-list",X={animation:300,draggable:`.${h}__item`,ghostClass:"react-draggable-list__ghost",chosenClass:"react-draggable-list__chosen",dragClass:"react-draggable-list__drag"},Z=a(()=>Math.random().toString(36).substr(2),"randomKey"),p=class p extends _react.Component{constructor(t){super(t);i(this,"cacheKey");i(this,"template",a(({item:t,index:n})=>{let{template:s,rowKey:r}=this.props;return _react2.default.createElement("div",{key:t[r],className:`${h}__item`},s({item:t,index:n}))},"template"));i(this,"handleUpdate",a(t=>{let{oldIndex:n,newIndex:s}=t,{items:r,onChange:c,rowKey:l}=this.props,d=r[n];s<n?(r.splice(n,1),r.splice(s,0,d)):(r.splice(s+1,0,d),r.splice(n,1));let m=r.map(N=>N[l]);c({target:{value:m}})},"handleUpdate"));i(this,"handleAdd",a(t=>{let{newIndex:n,oldIndex:s}=t,{cacheKey:r}=t.from.dataset,c=p.cachedItems[r],{items:l,onChange:d,rowKey:m}=this.props,N=c[s];l.splice(n,0,N);let U=l.map(B=>B[m]);d({target:{value:U}})},"handleAdd"));i(this,"handleRemove",a(t=>{let{oldIndex:n}=t,{items:s,onChange:r,rowKey:c}=this.props;s.splice(n,1);let l=s.map(d=>d[c]);r({target:{value:l}})},"handleRemove"));i(this,"handleRef",a(t=>{if(!t)return;let{rowKey:n,options:s}=this.props,r=_({dataIdAttr:n,onUpdate:this.handleUpdate,onAdd:this.handleAdd,onRemove:this.handleRemove},s);_sortablejs2.default.create(t,r)},"handleRef"));let{items:n}=t;this.cacheKey=Z(),p.cachedItems[this.cacheKey]=n}render(){let m=this.props,{className:t,children:n,items:s,template:r,rowKey:c,options:l}=m,d=x(m,["className","children","items","template","rowKey","options"]);return _react2.default.createElement("div",P(_({"data-component":h,"data-cache-key":this.cacheKey,className:(0,j.default)(h,t)},d),{ref:this.handleRef}),_react2.default.createElement(_reactlist2.default,{items:s,template:this.template}),n)}};a(p,"ReactDraggableList"),i(p,"displayName",h),i(p,"defaultProps",{onChange:K.default,items:[],template:K.default,rowKey:"id",options:X}),i(p,"cachedItems",{});var S=p;exports.default = S;
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var M=Object.create;var y=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptor,Y=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,F=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var v=(o,t,e)=>t in o?y(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,A=(o,t)=>{for(var e in t||(t={}))I.call(t,e)&&v(o,e,t[e]);if(u)for(var e of u(t))w.call(t,e)&&v(o,e,t[e]);return o},C=(o,t)=>G(o,Y(t)),a=(o,t)=>y(o,"name",{value:t,configurable:!0});var P=(o,t)=>{var e={};for(var n in o)I.call(o,n)&&t.indexOf(n)<0&&(e[n]=o[n]);if(o!=null&&u)for(var n of u(o))t.indexOf(n)<0&&w.call(o,n)&&(e[n]=o[n]);return e};var x=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var V=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $(t))!I.call(o,s)&&s!==e&&y(o,s,{get:()=>t[s],enumerable:!(n=J(t,s))||n.enumerable});return o};var g=(o,t,e)=>(e=o!=null?M(F(o)):{},V(t||!o||!o.__esModule?y(e,"default",{value:o,enumerable:!0}):e,o));var i=(o,t,e)=>(v(o,typeof t!="symbol"?t+"":t,e),e);var T=x((h,b)=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});var R=a(function(){},"NOOP"),k="",q=[],z={};b.exports=R;h.default=R;h.NOOP_STRING=k;h.NOOP_ARRAY=q;h.NOOP_OBJECT=z});var E=x((ee,O)=>{(function(){"use strict";var o={}.hasOwnProperty;function t(){for(var s="",r=0;r<arguments.length;r++){var c=arguments[r];c&&(s=n(s,e(c)))}return s}a(t,"classNames");function e(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return t.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var r="";for(var c in s)o.call(s,c)&&s[c]&&(r=n(r,c));return r}a(e,"parseValue");function n(s,r){return r?s?s+" "+r:s+r:s}a(n,"appendClass"),typeof O!="undefined"&&O.exports?(t.default=t,O.exports=t):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return t}):window.classNames=t})()});var _=g(T()),U=g(E());var _reactlist = require('@jswork/react-list'); var _reactlist2 = _interopRequireDefault(_reactlist);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _sortablejs = require('sortablejs'); var _sortablejs2 = _interopRequireDefault(_sortablejs);var f="react-draggable-list",X={animation:300,draggable:`.${f}__item`,ghostClass:"react-draggable-list__ghost",chosenClass:"react-draggable-list__chosen",dragClass:"react-draggable-list__drag"},Z=a(()=>Math.random().toString(36).substr(2),"randomKey"),d=class d extends _react.Component{constructor(e){super(e);i(this,"cacheKey");i(this,"template",a(({item:e,index:n})=>{let{template:s,rowKey:r}=this.props;return _react2.default.createElement("div",{key:e[r],className:`${f}__item`},s({item:e,index:n}))},"template"));i(this,"handleUpdate",a(e=>{let{oldIndex:n,newIndex:s}=e,{items:r,onChange:c,rowKey:l}=this.props,p=r[n];s<n?(r.splice(n,1),r.splice(s,0,p)):(r.splice(s+1,0,p),r.splice(n,1));let m=r.map(N=>N[l]);c({target:{value:m}})},"handleUpdate"));i(this,"handleAdd",a(e=>{let{newIndex:n,oldIndex:s}=e,{cacheKey:r}=e.from.dataset,c=d.cachedItems[r],{items:l,onChange:p,rowKey:m}=this.props,N=c[s];l.splice(n,0,N);let j=l.map(B=>B[m]);p({target:{value:j}})},"handleAdd"));i(this,"handleRemove",a(e=>{let{oldIndex:n}=e,{items:s,onChange:r,rowKey:c}=this.props;s.splice(n,1);let l=s.map(p=>p[c]);r({target:{value:l}})},"handleRemove"));i(this,"handleRef",a(e=>{if(!e)return;let{rowKey:n,options:s}=this.props,r=A({dataIdAttr:n,onUpdate:this.handleUpdate,onAdd:this.handleAdd,onRemove:this.handleRemove},s);_sortablejs2.default.create(e,r)},"handleRef"));let{items:n}=e;this.cacheKey=Z(),d.cachedItems[this.cacheKey]=n}shouldComponentUpdate(e){let{items:n}=e;return d.cachedItems[this.cacheKey]=n,!0}render(){let m=this.props,{className:e,children:n,items:s,template:r,rowKey:c,options:l}=m,p=P(m,["className","children","items","template","rowKey","options"]);return _react2.default.createElement("div",C(A({"data-component":f,"data-cache-key":this.cacheKey,className:(0,U.default)(f,e)},p),{ref:this.handleRef}),_react2.default.createElement(_reactlist2.default,{items:s,template:this.template}),n)}};a(d,"ReactDraggableList"),i(d,"displayName",f),i(d,"defaultProps",{onChange:_.default,items:[],template:_.default,rowKey:"id",options:X}),i(d,"cachedItems",{});var S=d;exports.default = S;
/*! Bundled license information:

@@ -3,0 +3,0 @@

@@ -36,2 +36,3 @@ import React, { Component } from 'react';

constructor(inProps: any);
shouldComponentUpdate(nextProps: Readonly<ReactDraggableListProps>): boolean;
template: ({ item, index }: {

@@ -38,0 +39,0 @@ item: any;

@@ -1,2 +0,2 @@

var M=Object.create;var y=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptor,Y=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,F=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var v=(o,e,t)=>e in o?y(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,_=(o,e)=>{for(var t in e||(e={}))I.call(e,t)&&v(o,t,e[t]);if(u)for(var t of u(e))w.call(e,t)&&v(o,t,e[t]);return o},P=(o,e)=>G(o,Y(e)),a=(o,e)=>y(o,"name",{value:e,configurable:!0});var x=(o,e)=>{var t={};for(var n in o)I.call(o,n)&&e.indexOf(n)<0&&(t[n]=o[n]);if(o!=null&&u)for(var n of u(o))e.indexOf(n)<0&&w.call(o,n)&&(t[n]=o[n]);return t};var C=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var V=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of $(e))!I.call(o,s)&&s!==t&&y(o,s,{get:()=>e[s],enumerable:!(n=J(e,s))||n.enumerable});return o};var g=(o,e,t)=>(t=o!=null?M(F(o)):{},V(e||!o||!o.__esModule?y(t,"default",{value:o,enumerable:!0}):t,o));var i=(o,e,t)=>(v(o,typeof e!="symbol"?e+"":e,t),t);var T=C((f,b)=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});var R=a(function(){},"NOOP"),k="",q=[],z={};b.exports=R;f.default=R;f.NOOP_STRING=k;f.NOOP_ARRAY=q;f.NOOP_OBJECT=z});var E=C((ee,O)=>{(function(){"use strict";var o={}.hasOwnProperty;function e(){for(var s="",r=0;r<arguments.length;r++){var c=arguments[r];c&&(s=n(s,t(c)))}return s}a(e,"classNames");function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var r="";for(var c in s)o.call(s,c)&&s[c]&&(r=n(r,c));return r}a(t,"parseValue");function n(s,r){return r?s?s+" "+r:s+r:s}a(n,"appendClass"),typeof O!="undefined"&&O.exports?(e.default=e,O.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var K=g(T()),j=g(E());import H from"@jswork/react-list";import A,{Component as Q}from"react";import W from"sortablejs";var h="react-draggable-list",X={animation:300,draggable:`.${h}__item`,ghostClass:"react-draggable-list__ghost",chosenClass:"react-draggable-list__chosen",dragClass:"react-draggable-list__drag"},Z=a(()=>Math.random().toString(36).substr(2),"randomKey"),p=class p extends Q{constructor(t){super(t);i(this,"cacheKey");i(this,"template",a(({item:t,index:n})=>{let{template:s,rowKey:r}=this.props;return A.createElement("div",{key:t[r],className:`${h}__item`},s({item:t,index:n}))},"template"));i(this,"handleUpdate",a(t=>{let{oldIndex:n,newIndex:s}=t,{items:r,onChange:c,rowKey:l}=this.props,d=r[n];s<n?(r.splice(n,1),r.splice(s,0,d)):(r.splice(s+1,0,d),r.splice(n,1));let m=r.map(N=>N[l]);c({target:{value:m}})},"handleUpdate"));i(this,"handleAdd",a(t=>{let{newIndex:n,oldIndex:s}=t,{cacheKey:r}=t.from.dataset,c=p.cachedItems[r],{items:l,onChange:d,rowKey:m}=this.props,N=c[s];l.splice(n,0,N);let U=l.map(B=>B[m]);d({target:{value:U}})},"handleAdd"));i(this,"handleRemove",a(t=>{let{oldIndex:n}=t,{items:s,onChange:r,rowKey:c}=this.props;s.splice(n,1);let l=s.map(d=>d[c]);r({target:{value:l}})},"handleRemove"));i(this,"handleRef",a(t=>{if(!t)return;let{rowKey:n,options:s}=this.props,r=_({dataIdAttr:n,onUpdate:this.handleUpdate,onAdd:this.handleAdd,onRemove:this.handleRemove},s);W.create(t,r)},"handleRef"));let{items:n}=t;this.cacheKey=Z(),p.cachedItems[this.cacheKey]=n}render(){let m=this.props,{className:t,children:n,items:s,template:r,rowKey:c,options:l}=m,d=x(m,["className","children","items","template","rowKey","options"]);return A.createElement("div",P(_({"data-component":h,"data-cache-key":this.cacheKey,className:(0,j.default)(h,t)},d),{ref:this.handleRef}),A.createElement(H,{items:s,template:this.template}),n)}};a(p,"ReactDraggableList"),i(p,"displayName",h),i(p,"defaultProps",{onChange:K.default,items:[],template:K.default,rowKey:"id",options:X}),i(p,"cachedItems",{});var S=p;export{S as default};
var M=Object.create;var y=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptor,Y=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,F=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var v=(o,t,e)=>t in o?y(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,A=(o,t)=>{for(var e in t||(t={}))I.call(t,e)&&v(o,e,t[e]);if(u)for(var e of u(t))w.call(t,e)&&v(o,e,t[e]);return o},C=(o,t)=>G(o,Y(t)),a=(o,t)=>y(o,"name",{value:t,configurable:!0});var P=(o,t)=>{var e={};for(var n in o)I.call(o,n)&&t.indexOf(n)<0&&(e[n]=o[n]);if(o!=null&&u)for(var n of u(o))t.indexOf(n)<0&&w.call(o,n)&&(e[n]=o[n]);return e};var x=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var V=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $(t))!I.call(o,s)&&s!==e&&y(o,s,{get:()=>t[s],enumerable:!(n=J(t,s))||n.enumerable});return o};var g=(o,t,e)=>(e=o!=null?M(F(o)):{},V(t||!o||!o.__esModule?y(e,"default",{value:o,enumerable:!0}):e,o));var i=(o,t,e)=>(v(o,typeof t!="symbol"?t+"":t,e),e);var T=x((h,b)=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});var R=a(function(){},"NOOP"),k="",q=[],z={};b.exports=R;h.default=R;h.NOOP_STRING=k;h.NOOP_ARRAY=q;h.NOOP_OBJECT=z});var E=x((ee,O)=>{(function(){"use strict";var o={}.hasOwnProperty;function t(){for(var s="",r=0;r<arguments.length;r++){var c=arguments[r];c&&(s=n(s,e(c)))}return s}a(t,"classNames");function e(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return t.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var r="";for(var c in s)o.call(s,c)&&s[c]&&(r=n(r,c));return r}a(e,"parseValue");function n(s,r){return r?s?s+" "+r:s+r:s}a(n,"appendClass"),typeof O!="undefined"&&O.exports?(t.default=t,O.exports=t):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return t}):window.classNames=t})()});var _=g(T()),U=g(E());import H from"@jswork/react-list";import K,{Component as Q}from"react";import W from"sortablejs";var f="react-draggable-list",X={animation:300,draggable:`.${f}__item`,ghostClass:"react-draggable-list__ghost",chosenClass:"react-draggable-list__chosen",dragClass:"react-draggable-list__drag"},Z=a(()=>Math.random().toString(36).substr(2),"randomKey"),d=class d extends Q{constructor(e){super(e);i(this,"cacheKey");i(this,"template",a(({item:e,index:n})=>{let{template:s,rowKey:r}=this.props;return K.createElement("div",{key:e[r],className:`${f}__item`},s({item:e,index:n}))},"template"));i(this,"handleUpdate",a(e=>{let{oldIndex:n,newIndex:s}=e,{items:r,onChange:c,rowKey:l}=this.props,p=r[n];s<n?(r.splice(n,1),r.splice(s,0,p)):(r.splice(s+1,0,p),r.splice(n,1));let m=r.map(N=>N[l]);c({target:{value:m}})},"handleUpdate"));i(this,"handleAdd",a(e=>{let{newIndex:n,oldIndex:s}=e,{cacheKey:r}=e.from.dataset,c=d.cachedItems[r],{items:l,onChange:p,rowKey:m}=this.props,N=c[s];l.splice(n,0,N);let j=l.map(B=>B[m]);p({target:{value:j}})},"handleAdd"));i(this,"handleRemove",a(e=>{let{oldIndex:n}=e,{items:s,onChange:r,rowKey:c}=this.props;s.splice(n,1);let l=s.map(p=>p[c]);r({target:{value:l}})},"handleRemove"));i(this,"handleRef",a(e=>{if(!e)return;let{rowKey:n,options:s}=this.props,r=A({dataIdAttr:n,onUpdate:this.handleUpdate,onAdd:this.handleAdd,onRemove:this.handleRemove},s);W.create(e,r)},"handleRef"));let{items:n}=e;this.cacheKey=Z(),d.cachedItems[this.cacheKey]=n}shouldComponentUpdate(e){let{items:n}=e;return d.cachedItems[this.cacheKey]=n,!0}render(){let m=this.props,{className:e,children:n,items:s,template:r,rowKey:c,options:l}=m,p=P(m,["className","children","items","template","rowKey","options"]);return K.createElement("div",C(A({"data-component":f,"data-cache-key":this.cacheKey,className:(0,U.default)(f,e)},p),{ref:this.handleRef}),K.createElement(H,{items:s,template:this.template}),n)}};a(d,"ReactDraggableList"),i(d,"displayName",f),i(d,"defaultProps",{onChange:_.default,items:[],template:_.default,rowKey:"id",options:X}),i(d,"cachedItems",{});var S=d;export{S as default};
/*! Bundled license information:

@@ -3,0 +3,0 @@

{
"name": "@jswork/react-draggable-list",
"description": "A simple draggable list component.",
"version": "1.1.3",
"version": "1.1.4",
"main": "dist/index.cjs.js",

@@ -6,0 +6,0 @@ "module": "dist/index.esm.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc