0.0.1 • Published 3 years ago

n-widgets v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

NWidgets

This library was generated with Angular CLI version 12.2.0.

Installation

npm install n-widgets

Library require angular2-draggable

npm install angular2-draggable

Add node_modules/angular2-draggable/css/resizable.min.css in angular.json file

Import styles in main style file @import '~n-widgets/styles/lib-style.scss';

##Styles Examples how to style lib components.

Widgets

lib-n-widget .n-widget {
 background: white;
 box-shadow: 1px 1px 2px 0 grey, -1px -1px 2px 0 grey;
}

Container

lib-n-container .n-container {
 background: aliceblue;
}

##Use exaple

<lib-n-widgets [addMode]="addMode" (addedWidgetPosition)="addWidget($event)">
    <lib-n-widget *ngFor="let widget of widgets"
                  [id]="widget.id"
                  [position]="widget.position"
                  [editable]="editMode"
                  (endMove)="endMovieWidget($event, widget.id)"
    >
      <div>My widgets</div>
    </lib-n-widget>
  </lib-n-widgets>

lib-n-widgets

Inputs:

namedescription
addModeenable add mode widget

Outputs:

namedescription
addedWidgetPositionEmmit information about current position and size of new widget{x: 0, y: 0, w: 100, h:100}

lib-n-widget

Inputs:

namedescription
idwidget identifier
positionObject with information about top/left position and size {x: 0, y: 0, w: 100, h:100}
editableIf true, widget can change position and size

Outputs:

namedescription
endMoveEmmit information about current position and size{x: 0, y: 0, w: 100, h:100}

Build

Run ng build n-widgets to build the project. The build artifacts will be stored in the dist/ directory.

or

Run npm run build-lib to build the project. The build artifacts will be stored in the dist/ directory and will be pack to tgz in main application directory.

Publishing

After building your library with ng build n-widgets, go to the dist folder cd dist/n-widgets and run npm publish.

Running unit tests

Run ng test n-widgets to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.