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

sf-dnd

v0.1.6

Published

DropAndDrag container component for Sailfish

Downloads

12

Readme

七鱼拖拽组件

Draggable

:::ysfdoc axis属性设置拖拽方向, clone属性选择是否克隆

    <style>
        .pg-drop {
            height : 100px;
            width : 100px;
            background-color: rgba(33, 150, 243, 0.5);
            border : 2px dashed #d1d1d1;
            font-size: 18px;
            color: white;
            text-align: center;
            vertical-align: middle;
            line-height: 100px;
        }
    </style>

    <template>
        <sf-draggable axis="horizontal" name="">
               <div class="pg-drop"> Drag </div>
        </sf-draggable>
    </template>

:::

Draggable(clone)

:::ysfdoc axis属性设置拖拽方向, clone属性选择是否克隆

    <style>
        .pg-drop {
            height : 100px;
            width : 100px;
            background-color: rgba(33, 150, 243, 0.5);
            border : 2px dashed #d1d1d1;
            font-size: 18px;
            color: white;
            text-align: center;
            vertical-align: middle;
            line-height: 100px;
        }
    </style>

    <template>
        <sf-draggable axis="horizontal" name="" clone>
               <div class="pg-drop"> Drag </div>
        </sf-draggable>
    </template>

:::

DragAndDrop

:::ysfdoc 继承于sf-draggable 组件

    <style>
       .h1 {
            margin-bottom: 30px;
            text-align: center;
            font-size: 36px;
        }
        .sf-dnd-tom{
            padding: 20px;
            border:1px dotted #d1d1d1
        }
        .sf-dnd-tom .tom_item{
            height:33px;
            line-height:33px;
            padding : 5px;
            box-sizing: border-box;
        }
        .sf-dnd-tom .tom_item:nth-child(n+2){
            border-top : 2px dashed #ffffff;
        }
        .sf-dnd-tom .tom_item:nth-child(even){
            background-color : rgba(255, 193, 7, 0.5)
        }
        .sf-dnd-tom .tom_item:nth-child(odd){
            background-color : rgba(33, 150, 243, 0.5)
        }

        .sf-dnd-lucy{
             padding: 20px;
             border:1px dotted #d1d1d1
         }
        .sf-dnd-lucy .tom_item{
            height:33px;
            line-height:33px;
            padding : 5px;
            box-sizing: border-box;
        }
        .sf-dnd-lucy .tom_item:nth-child(n+2){
            border-top : 2px dashed #ffffff;
        }
        .sf-dnd-lucy .tom_item:nth-child(even){
            background-color : rgba(255, 193, 7, 0.5)
        }
        .sf-dnd-lucy .tom_item:nth-child(odd){
            background-color : rgba(33, 150, 243, 0.5)
        }
        .sf-dnd-juck{
            padding: 20px;
            border:1px dotted #d1d1d1
        }
        .sf-dnd-juck .tom_item{
            height:33px;
            line-height:33px;
            padding : 5px;
            box-sizing: border-box;
        }
        .sf-dnd-juck .tom_item:nth-child(n+2){
            border-top : 2px dashed #ffffff;
        }
        .sf-dnd-juck .tom_item:nth-child(even){
            background-color : rgba(255, 193, 7, 0.5)
        }
        .sf-dnd-juck .tom_item:nth-child(odd){
            background-color : rgba(33, 150, 243, 0.5)
        }
        .code{
            margin-top:20px;
            text-align: center;
        }
    </style>

    <template>
         <h1 class="h1" >lucy -- tom</h1>
         	<sf-dnd :source="source" name="lucy" from="tom" >
         		<li v-for="(x, index) in source" :key="x" class="tom_item" >
         			{{x}}
         		</li>
         	</sf-dnd>
         	<h1>juck -- lucy</h1>
         	<sf-dnd :source="source2" name="juck" from="lucy" >
         		<li v-for="(x, index) in source2" :key="x" class="tom_item"  >
         				{{x}}
         		</li>
         	</sf-dnd>
         	<h1>tom -- lucy</h1>
         	<sf-dnd :source="source1" name="tom" from="lucy">
         		<li v-for="(x, index) in source1" :key="x" class="tom_item">
         			{{x}}
         		</li>
         	</sf-dnd>

         	<h1 class="code">{{source1}}</h1>
         	<h1 class="code">{{list}}</h1>
    </template>

    <script>
            window.sfDND = {
        		tom : ['1','2','3','4','5'],
        		juck : ['z', 'y'],
        		lucy : ['a', 'b']
        	};

        	export default {
        		data : function(){
        			return {
        				source1 : window.sfDND.tom,
        				source : window.sfDND.lucy,
        				source2 : window.sfDND.juck,
        				list : []
        			}
        		},
        		methods:{
        			change : function(list){
        				console.log(list)
        			}
        		}
        	}
    </script>

:::

DragResize [Custom Directive]

:::ysfdoc e, w, n, s, ew, ns 六种模式,实例为ew模式,鼠标hover区块最右边可以拖动。

    <style>
    .drag-container {
    	position: relative;
    	display: inline-block;
    }
    .drag-dom{
    	height : 200px;
    	width  : 200px;
    	display: inline-block;
    	background-color: #03a9f4;
        box-sizing: border-box;
        border: 2px dashed #ddd;
        border-right : 0px;
    }
    .sf-dragresize--ew{
    	right : 0;
    }
    </style>

    <template>
         <div class="drag-container">
            <div class="drag-dom" v-dragresize:ew="resize"></div>
         </div>
    </template>

    <script>
        window.sfDND = {
            tom : ['1','2','3','4','5'],
            juck : ['z', 'y'],
            lucy : ['a', 'b']
        };
        export default {
            data : function(){
                return {
                    source1 : window.sfDND.tom,
                    source : window.sfDND.lucy,
                    source2 : window.sfDND.juck,
                    list : []
                }
            },
            methods:{
                 /**
                  * [resize description]
                  * @param  {[type]} store [数据实体]
                  * @param  {[type]} type  [mousemove, mouseup, mousedown]
                  * @param  {[type]} el    [拖动节点元素]
                  */
                 resize : function(store, type, el){
                     switch(type){
                         case 'mousedown':
                             break;
                         case 'mousemove':
                             el.style.height = store.rectangle.height + 'px';
                             el.style.width = store.rectangle.width + 'px';
                             break;
                         case 'mouseup':
                             break;
                     }
                 },
                 change : function(list){
                     console.log(list)
                 }
            }
        }
    </script>

:::

Draggable Attributes

| name | 描述 |参数| 必填 | |:---|:---|:---|:---| | axis | 拖动方式 |horizontal,vertical,x, y |否| | name | 拖动的名称 | '' |是| | clone | 是否克隆元素 | |否|

DragAndDrop Attributes

| name | 描述 | 必填 | |:----|:----|:----| | drag | 可否拉起 |否| | drop | 可否放置 |否| | from | 可接受的DND别名 |否| | to | 可到达的DND别名 |否| | name | DND名称 |是| | source | 数据源 |是|

栗子

组件演示地址demo