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

@molejs/unmodeled-layer-2

v0.0.1

Published

使用 rc-trigger 来实现弹框可见性的控制, 包括动画,定位等信息, 封装 rc-trigger,实现自适应位置

Downloads

30

Readme

@beisen-phoenix/unmodeled-layer

使用 rc-trigger 来实现弹框可见性的控制, 包括动画,定位等信息, 封装 rc-trigger,实现自适应位置

API 属性如下:

| 成员 | 说明 | 类型 | 默认值 | | ------------------ | :----------------------------------------------------------------: | :-----------------------------------------------------: | ---------- | | visible | 是否显示 | boolean | - | | size | 尺寸大小: small(170px) large(340px) auto(与父级自适应) | string | - | | width | 自定义大小,优先级低于 size | number | - | | autoSize | 是否监听弹层的大小变化 | Boolean | true | | childMargin | 子组件的外边距 | string | 0px | | trigger | 触发展示的行为: hover click | Array<'hover' 'click'> | [ 'hover'] | | footer | 自定义按钮 | object | - | | autoAdjust | 是否自适应调整位置 | Boolean | true | | content | 弹窗内容 | ReactNode | - | | stretch | 弹层拉伸 | string('width'、 'minWidth'、 'height'、 'minHeight') | - | | onVisibleChange | 弹层显示状态改变时调用, 参数为 visible | Function(visible) | - | | onOk | 默认确定按钮的回调函数 | Function | - | | extraCls | 自定义 class | string | "" | | blockContainer | 外层容器的显示类型(true 是 block 类型,false 则是 inline-block) | Boolean | false | | placement | 弹层的显示位置(可选值:topLeft, topRight, bottomRight, bottomLeft) | string | bottomLeft | | builtinPlacements | 弹层的可定义偏移位置(具体可参考 dom-align) | object | -- | | getPopupContainer | 弹层挂载的容器 | Function | - | | destroyPopupOnHide | 隐藏的时候是否销毁节点 | boolean | false |

builtinPlacements 取值举例

{
  topLeft: {
    points: ['bl', 'tl'],
  },
  topRight: {
    points: ['br', 'tr'],
  },
  bottomRight: {
    points: ['tr', 'br'],
  },
  bottomLeft: {
    points: ['tl', 'bl'],
    offset: [-11, -15]
  },
}

代码示例

let footer = [{
  text: '按钮1',
  onClick: ()=> console.log("按钮1")
}, {
  text: '按钮2',
  onClick: ()=> console.log("按钮2")
}]
<UnmodeledLayer
  visible={visible}
  size = 'small'
  footer={footer}
  trigger={['hover', 'click']}
  content={content}
  onOk={this.handleOk}
  onVisibleChange={this.onVisibleChange}
  >
  <Button>打开</Button>
</UnmodeledLayer>