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

angular-mixed-cdk-drag-drop

v2.3.0

Published

angular-mixed-cdk-drag-drop is an Angular `Directive` to support mixed orientation drag drop using angular cdk.

Downloads

3,027

Readme

AngularMixedCdkDragDrop

angular-mixed-cdk-drag-drop is an Angular Directive to support mixed orientation drag drop using angular cdk.

Demo

h_demo v_demo

Installation

npm install angular-mixed-cdk-drag-drop

Versions

  • for angular 18 use v^2.2.4 / angular18
npm install angular-mixed-cdk-drag-drop@angular18
  • for angular 17 use v^2.2.3 / angular17
npm install angular-mixed-cdk-drag-drop@angular17
  • for angular 16 use v^2.1.0 / angular16
npm install angular-mixed-cdk-drag-drop@angular16
  • for angular 15 use v^2.0.0 / angular15
npm install angular-mixed-cdk-drag-drop@angular15
  • for angular 14 use angular14
npm install angular-mixed-cdk-drag-drop@angular14

Usage

The official cdkDropList is implement like below.

<div cdkDropList cdkDropListOrientation="horizontal" class="example-list" (cdkDropListDropped)="drop($event)">
  <div class="example-box" *ngFor="let item of items" cdkDrag>{{item}}</div>
</div>

To use this mixed orientation directive, we need to put every cdkDrag in an individual cdkDropList and grouped all the dropList in a CdkDropListGroup. To do so with the following few steps.

  1. change the original CdkDropList to CdkDropListGroup, applied mixedCdkDragDrop directive and set orientation(required). (the list group need to be a Flex container which set the style display property to flex.)
  2. add additional cdkDropList with mixedCdkDropList directive as the parent of every cdkDrag.
  3. you can now be happy to enjoy the mixed cdk drag drop.
<div class="example-list"
     cdkDropListGroup mixedCdkDragDrop
     [orientation]="'horizontal'"
     [itemList]="items"
     (dropped)="dropped($event)">
        <span *ngFor="let item of items" cdkDropList mixedCdkDropList>
          <div class="example-box" cdkDrag>
                {{item}}
                <div cdkDragHandle> = </div>
            </div>
        </span>
      </div>

mixedCdkDragSizeHelper

When cdkDrag size is originally depend on its container. Applied mixedCdkDragDrop will break the style by adding additional cdkDropList parent element. MixedCdkDragSizeHelper directive will help to handle the CdkDrag size in this case.

  1. Applied mixedCdkDragSizeHelper to cdkDrag.
  2. ContentBoxSize emitter is required. (default Emitter MixedCdkDragSizeHelperDirective.defaultEmitter is provided.)
  3. Set containerSelector in mixedCdkDragDrop if needed. (default value is mixedCdkDragDrop.)
<div class="example-list"
     cdkDropListGroup mixedCdkDragDrop
     [containerSelector]="'.example-list'">
        <span *ngFor="let item of items" cdkDropList mixedCdkDropList>
          <div class="example-box" cdkDrag mixedCdkDragSizeHelper
               (contentBoxSize)="onSizeChange($event)">
                {{item}}
                <div cdkDragHandle> = </div>
            </div>
        </span>
</div>
onSizeChange(event: MixedCdkDragContainerSize) {
    MixedCdkDragSizeHelperDirective.defaultEmitter(event, Number(this.percentWidth), Number(this.percentHeight));
}

Global settings

You can use MixedCdkDragDropModule.forRoot to define global settings:

MixedCdkDragDropModule.forRoot({ autoScrollStep: 4 });

Publish

ng build angular-mixed-cdk-drag-drop
npm publish dist/angular-mixed-cdk-drag-drop

License

Copyright 2024 Rose Chung

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.