Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-viewer

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-viewer - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

dist/rc-viewer.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("viewerjs"),require("viewerjs/dist/viewer.min.css")):"function"==typeof define&&define.amd?define(["react","viewerjs","viewerjs/dist/viewer.min.css"],t):e.RcViewer=t(e.React,e.Viewer)}(this,function(e,t){"use strict";var n="default"in e?e.default:e;t=t&&t.hasOwnProperty("default")?t.default:t;var r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t};return function(a){function c(e){r(this,c);var t=u(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,e));return t.container=null,t.viewer=null,t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(c,e.Component),i(c,[{key:"componentDidMount",value:function(){this.viewerInit()}},{key:"getViewer",value:function(){return{viewer:this.viewer,container:this.container}}},{key:"componentDidUpdate",value:function(){this.viewer&&!this.isIdentical()&&this.viewerInit()}},{key:"componentWillUnmount",value:function(){this.viewer&&this.viewer.destroy()}},{key:"isIdentical",value:function(){var e=this.viewer.images||[];this.viewer.update();var t=this.viewer.images||[];return!e.length&&!t.length||e.length===t.length&&t.every(function(t){return e.some(function(e){return e===t})})}},{key:"viewerInit",value:function(){this.viewer&&this.viewer.destroy();var e=this.props,n=e.options,r=void 0===n?{}:n,i=e.children;this.viewer=new t(this.container,o({navbar:!(!Array.isArray(i)||!i.length)},r))}},{key:"render",value:function(){var e=this,t=this.props,r=(t.options,t.children),i=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(t,["options","children"]);return n.createElement("div",o({ref:function(t){e.container=t}},i),r)}}]),c}()});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("viewerjs"),require("viewerjs/dist/viewer.min.css")):"function"==typeof define&&define.amd?define(["react","viewerjs","viewerjs/dist/viewer.min.css"],t):e.RcViewer=t(e.React,e.Viewer)}(this,function(e,t){"use strict";var n="default"in e?e.default:e;t=t&&t.hasOwnProperty("default")?t.default:t;var r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t};return function(u){function c(e){r(this,c);var t=a(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,e));return t.container=null,t.viewer=null,t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(c,e.Component),i(c,[{key:"componentDidMount",value:function(){this.viewerInit()}},{key:"getViewer",value:function(){return{viewer:this.viewer,container:this.container}}},{key:"componentDidUpdate",value:function(){this.viewer&&!this.isIdentical()&&this.viewerInit()}},{key:"componentWillUnmount",value:function(){this.viewer&&this.viewer.destroy()}},{key:"isIdentical",value:function(){var e=this.viewer.images||[];this.viewer.update();var t=this.viewer.images||[];return!e.length&&!t.length||e.length===t.length&&t.every(function(t,n){return e[n]===t})}},{key:"viewerInit",value:function(){this.viewer&&this.viewer.destroy();var e=this.props,n=e.options,r=void 0===n?{}:n,i=e.children;this.viewer=new t(this.container,o({navbar:!(!Array.isArray(i)||!i.length)},r))}},{key:"render",value:function(){var e=this,t=this.props,r=(t.options,t.children),i=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(t,["options","children"]);return n.createElement("div",o({ref:function(t){e.container=t}},i),r)}}]),c}()});
{
"name": "rc-viewer",
"version": "0.0.7",
"version": "0.0.8",
"description": "Image viewer component for react, supports rotation, scale, zoom and so on, based on viewer.js",

@@ -5,0 +5,0 @@ "main": "dist/rc-viewer.js",

# rc-viewer
Image viewer component for React, supports rotation, scale, zoom and so on, based on [viewer.js](https://github.com/fengyuanchen/viewerjs)
## [Demo](https://hyk51594176.github.io/rc-viewer/demo/demo.html)
## umd
```html
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script src="https://cdn.bootcss.com/viewerjs/1.0.0/viewer.min.js"></script>
<link href="https://cdn.bootcss.com/viewerjs/1.0.0/viewer.min.css" rel="stylesheet">
<script src="../dist/rc-viewer.js"></script>
```
## Installation

@@ -52,3 +63,3 @@ Install from GitHub via NPM

You may set viewer options with `options`.
You may set viewer options with `props.options`.

@@ -55,0 +66,0 @@

@@ -34,3 +34,3 @@ import React, { Component } from 'react'

if (imgarr.length !== imgarr2.length) return false
return imgarr2.every(img => imgarr.some(img2 => img2 === img))
return imgarr2.every((img,index) => imgarr[index] === img)
}

@@ -37,0 +37,0 @@ viewerInit () {

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