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

rc-image

Package Overview
Dependencies
Maintainers
3
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-image - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

1

es/Image.d.ts

@@ -5,2 +5,3 @@ import * as React from 'react';

prefixCls?: string;
previewPrefixCls?: string;
placeholder?: React.ReactNode;

@@ -7,0 +8,0 @@ fallback?: string;

14

es/Image.js

@@ -17,2 +17,4 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

prefixCls = _ref$prefixCls === void 0 ? 'rc-image' : _ref$prefixCls,
_ref$previewPrefixCls = _ref.previewPrefixCls,
previewPrefixCls = _ref$previewPrefixCls === void 0 ? "".concat(prefixCls, "-preview") : _ref$previewPrefixCls,
placeholder = _ref.placeholder,

@@ -34,4 +36,6 @@ fallback = _ref.fallback,

useMap = _ref.useMap,
otherProps = _objectWithoutProperties(_ref, ["src", "alt", "onPreviewClose", "prefixCls", "placeholder", "fallback", "width", "height", "style", "preview", "className", "onClick", "crossOrigin", "decoding", "loading", "referrerPolicy", "sizes", "srcSet", "useMap"]);
otherProps = _objectWithoutProperties(_ref, ["src", "alt", "onPreviewClose", "prefixCls", "previewPrefixCls", "placeholder", "fallback", "width", "height", "style", "preview", "className", "onClick", "crossOrigin", "decoding", "loading", "referrerPolicy", "sizes", "srcSet", "useMap"]);
var isCustomPlaceholder = placeholder && placeholder !== true;
var _useState = useState(false),

@@ -42,3 +46,3 @@ _useState2 = _slicedToArray(_useState, 2),

var _useState3 = useState(placeholder ? 'loading' : 'normal'),
var _useState3 = useState(isCustomPlaceholder ? 'loading' : 'normal'),
_useState4 = _slicedToArray(_useState3, 2),

@@ -84,3 +88,3 @@ status = _useState4[0],

React.useEffect(function () {
if (placeholder) {
if (isCustomPlaceholder) {
setStatus('loading');

@@ -100,3 +104,3 @@ }

alt: alt,
className: "".concat(prefixCls, "-img")
className: cn("".concat(prefixCls, "-img"), _defineProperty({}, "".concat(prefixCls, "-img-placeholder"), placeholder === true))
};

@@ -122,3 +126,3 @@ return React.createElement("div", Object.assign({}, otherProps, {

visible: isShowPreview,
prefixCls: "".concat(prefixCls, "-preview"),
prefixCls: previewPrefixCls,
onClose: onPreviewClose,

@@ -125,0 +129,0 @@ mousePosition: mousePosition,

@@ -5,2 +5,3 @@ import * as React from 'react';

prefixCls?: string;
previewPrefixCls?: string;
placeholder?: React.ReactNode;

@@ -7,0 +8,0 @@ fallback?: string;

@@ -34,2 +34,4 @@ "use strict";

prefixCls = _ref$prefixCls === void 0 ? 'rc-image' : _ref$prefixCls,
_ref$previewPrefixCls = _ref.previewPrefixCls,
previewPrefixCls = _ref$previewPrefixCls === void 0 ? "".concat(prefixCls, "-preview") : _ref$previewPrefixCls,
placeholder = _ref.placeholder,

@@ -51,3 +53,4 @@ fallback = _ref.fallback,

useMap = _ref.useMap,
otherProps = (0, _objectWithoutProperties2.default)(_ref, ["src", "alt", "onPreviewClose", "prefixCls", "placeholder", "fallback", "width", "height", "style", "preview", "className", "onClick", "crossOrigin", "decoding", "loading", "referrerPolicy", "sizes", "srcSet", "useMap"]);
otherProps = (0, _objectWithoutProperties2.default)(_ref, ["src", "alt", "onPreviewClose", "prefixCls", "previewPrefixCls", "placeholder", "fallback", "width", "height", "style", "preview", "className", "onClick", "crossOrigin", "decoding", "loading", "referrerPolicy", "sizes", "srcSet", "useMap"]);
var isCustomPlaceholder = placeholder && placeholder !== true;

@@ -59,3 +62,3 @@ var _useState = (0, React.useState)(false),

var _useState3 = (0, React.useState)(placeholder ? 'loading' : 'normal'),
var _useState3 = (0, React.useState)(isCustomPlaceholder ? 'loading' : 'normal'),
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),

@@ -101,3 +104,3 @@ status = _useState4[0],

React.useEffect(function () {
if (placeholder) {
if (isCustomPlaceholder) {
setStatus('loading');

@@ -117,3 +120,3 @@ }

alt: alt,
className: "".concat(prefixCls, "-img")
className: (0, _classnames.default)("".concat(prefixCls, "-img"), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-img-placeholder"), placeholder === true))
};

@@ -139,3 +142,3 @@ return React.createElement("div", Object.assign({}, otherProps, {

visible: isShowPreview,
prefixCls: "".concat(prefixCls, "-preview"),
prefixCls: previewPrefixCls,
onClose: onPreviewClose,

@@ -142,0 +145,0 @@ mousePosition: mousePosition,

{
"name": "rc-image",
"version": "3.0.1",
"version": "3.0.2",
"description": "React easy to use image component",

@@ -5,0 +5,0 @@ "keywords": [

@@ -53,9 +53,10 @@ # rc-image

| Name | Type | Default | Description |
| -------------- | ----------- | -------- | ----------------------- |
| preview | boolean | true | Whether to show preview |
| prefixCls | string | rc-image | Classname prefix |
| placeholder | ReactNode | - | Loading placeholder |
| fallback | string | - | Load failed src |
| onPreviewClose | function(e) | - | Preview close callback |
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| preview | boolean | true | Whether to show preview |
| prefixCls | string | rc-image | Classname prefix |
| placeholder | boolean \| ReactElement | - | if `true` will set default placeholder or use `ReactElement` set customize placeholder |
| fallback | string | - | Load failed src |
| onPreviewClose | function(e) | - | Preview close callback |
| previewPrefixCls | string | rc-image-preview | Preview classname prefix |

@@ -62,0 +63,0 @@ ## Example

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