Git Product home page Git Product logo

ng-data-picker's Introduction

No time for maintenance - welcome to send a useful PR :)

ng-data-picker Version Badge

๐Ÿ„๐Ÿพ A Data Picker for Angular 4+

npm package travis build NPM downloads gzip size CircleCI

NPM Description

Let's more easily select some data on the touch screen device, such as time / city / gender / seat number / product / ...

Examples

See branch gh-pages for all code of extant examples and environment.

Demo Level Code
gender โ˜… gender.component.ts
product โ˜…โ˜… product.component.ts
date-time โ˜…โ˜…โ˜… date-time.component.ts

Take a look

Screen shot

โš ๏ธ Below gif is a temporary used from vue version of this picker. will be updated soon.

Screen record

Install

yarn add ng-data-picker

or

npm i -S ng-data-picker

Usage

Quick look

app.module.ts

import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'
import { DataPickerComponent } from 'ng-data-picker'

@NgModule({
  ...
  declarations: [
    DataPickerComponent
  ],
  schemas: [
    NO_ERRORS_SCHEMA // for third party component
  ],
  ...
})

app.component.ts

export class AppComponent {
  data = [
    {
      list: ['sun', 'earth', 'moon']
    }
  ]

  change ({ gIndex, iIndex }) {
    console.log(gIndex, iIndex)
  }
}

app.component.html

<ng-data-picker [data]="data" (change)="change($event)"></ng-data-picker>

โš™๏ธ Props

name type default explain
change Function ({gIndex,iIndex})=>{} Callback after which group's current index changed, pass two arguments, group index gIndex and item index iIndex
data Array [] Picker initial data
data[i].currentIndex Number 0 Current index of this group's list
data[i].weight Number 1 Group weights in parent width 1..12
data[i].list Array - List of the group
data[i].list[j] String or Object - Item in the list of group, use value key when it is a object item
data[i].onClick Function - Click event on the middle layer of this group, pass two arguments that group index gIndex and selected index iIndex of this group
data[i].textAlign String - start center end justify left right nowrap wrap
data[i].className String - Your custom class name for this group
data[i].divider Boolean false If it is true, then onClick list currentIndex will not be used
data[i].text String - Just use this text when divider is true

๐Ÿ”จ Instance methods

name type explain
setGroupData Function (gIndex,gData)=>void Dynamically set a group data with two arguments (gIndex, gData), group index and group data (see props data[i])
getCurrentIndexList Function ()=>[] Return a Array of the groups current index list (has divider current index, and it is default to 0)
getGroupsRectList Function ()=>void Get some info for gesture, you can call this function when the component displayed if the component is hidden when it's initialization

Development

npm start # development
npm run build:prod # build for production
npm run prepare # build for third party

Any problem?

Please let me know.

Is it useful?

๐ŸŒš Donate A github star โŸ

License

MIT

ng-data-picker's People

Contributors

acurrieclark avatar hiyali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ng-data-picker's Issues

Enable to use in AOT compiled environment

I have integrated your library in Ionic v3 and I am able to use the library without any issue when I do a dev build. When I take production (which inturn uses --aot) option, I am getting the following error

Unexpected value 'DataPickerComponent in node_modules/ng-data-picker/lib/data-picker.module.js' imported by the module '......

Could you please enable the library to be used in AOT compiled environments?

New version for Angular15+

Hi @hiyali ,

I've been trying to upgrade your code to the latest version of Angular, but I failed. So, I've decided to create a new project based on your logic instead. You can find my repository here

In my project, I've enhanced the code to support the latest version of Angular and I'm also planning to expand the feature set.

I would appreciate it if you could take a look at my project and let me know your thoughts.

Thanks,

No typings file/package

No typing file/package available for this library. So it's hard to use this with latest agnular projects. I'm not sure even it's possible.

Angular 11 compatibility

Hey, I'm unable to run it on an Angular 11 app, getting error:
Value at position 10 in the NgModule.declarations of MyAppModule is not a reference. Value could not be determined statically.(-991010)
Is there something I'm doing wrong?
Thx

2021-07-27 15_45_42-Window

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.