npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

antd-img-crop

v4.24.0

Published

An image cropper for Ant Design Upload

Downloads

316,130

Readme

Link in bio to widgets, your online home screen. ➫ 🔗 kee.so


antd-img-crop

图片裁切工具,用于 Ant Design Upload 组件

npm npm npm bundle size GitHub npm type definitions

English | 简体中文

安装

pnpm add antd-img-crop
# or
yarn add antd-img-crop
# or
npm i antd-img-crop

使用

import { Upload } from 'antd';
import ImgCrop from 'antd-img-crop';

const Demo = () => (
  <ImgCrop>
    <Upload>+ Add image</Upload>
  </ImgCrop>
);

Edit antd-img-crop

Props

| 属性 | 类型 | 默认 | 说明 | | -------------- | -------------------- | ------------ | ---------------------------------------------------------------- | | quality | number | 0.4 | 裁切图片质量,01 之间 | | fillColor | string | 'white' | 裁切图像填充色 | | zoomSlider | boolean | true | 允许缩放 | | rotationSlider | boolean | false | 允许旋转 | | aspectSlider | boolean | false | 允许调整裁切比 | | showReset | boolean | false | 显示重置按钮,重置缩放 & 旋转 & 裁切比 | | resetText | string | 重置 | 重置按钮文字 | | aspect | number | 1 / 1 | 裁切区域宽高比,width / height | | minZoom | number | 1 | 最小缩放 | | maxZoom | number | 3 | 最大缩放 | | minAspect | number | 0.5 | 最小裁切比 | | maxAspect | number | 2 | 最大裁切比 | | cropShape | string | 'rect' | 裁切区域形状,'rect''round' | | showGrid | boolean | false | 显示裁切区域网格(九宫格) | | cropperProps | object | - | react-easy-crop 的 props(* 已有 props 无法重写) | | modalClassName | string | '' | 弹窗 className | | modalTitle | string | '编辑图片' | 弹窗标题 | | modalWidth | number | string | | 弹窗宽度 | | modalOk | string | | 确定按钮文字 | | modalCancel | string | | 取消按钮文字 | | onModalOK | function | - | 点击确定按钮的回调 | | onModalCancel | function | - | 点击取消按钮、遮罩层、或右上角 'x' 的回调 | | modalProps | object | | Ant Design Modal 的 props(* 已有 props 无法重写) | | beforeCrop | function | - | 裁切弹窗打开前的回调,若返回 falsereject,弹窗将不会打开 |

FAQ

ConfigProvider 无效?

尝试设置 libraryDirectory'es''lib')到 babel-plugin-import 的配置项,看看哪个会生效。

module.exports = {
  plugins: [
    ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }],
  ],
};

没有样式?(仅 antd<=v4

若使用 antd<=v4 + babel-plugin-import,且未引入 ModalSlider,请手动引入这些样式:

import 'antd/es/modal/style';
import 'antd/es/slider/style';

协议

MIT License (c) nanxiaobei