GithubHelp home page GithubHelp logo

rebolon / ng-address-data-gouv Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.86 MB

Composant web de recherche d'adresses au travers d'un système d'autocomplétion et d'utilisation du service officiel geo.api.gouv.fr

Home Page: https://rebolon.github.io/ng-address-data-gouv/

JavaScript 10.35% TypeScript 55.56% HTML 33.81% SCSS 0.29%

ng-address-data-gouv's Introduction

NgAddressDataGouv

The aim of this project is to provide a web custom elements with an autocomplete input that consumes the API of https://adresse.data.gouv.fr/api-doc

With this component you can fill an french address that will be validated against official https://adresse.data.gouv.fr/api-doc

You may also import the library to use the component inside your angular project.

Usage

npm install @rebolon/ng-address-data-gouv

Html or any web applications

You only need to require the javascript files in your html template like this:

<script src="node_modules/ng-address-data-gouv/dist/app/output.js" type="module"></script>

Angular application

Import the library from dist like this

import {AddressSearchComponent, NgAddressDataGouvModule} from '@rebolon/ng-address-data-gouv/dist/lib/';

All application

And then you can use the custom elements everywhere like this:

<ng-address-data-gouv-search></ng-address-data-gouv-search>

Parameters

  • loaderSize: in px, default is 15
  • width: of the input field, in px, default is 250
  • placeholder: of the input, default is empty
  • label: of the input, default is empty
  • id: of the input if you need one, default is like this 'ri-address-search-component-' + (new Date()).getTime();
  • uri: of the API in case you host your own server (cloned from https://github.com/etalab), default is the official uri https://adresse.data.gouv.fr/api-doc

Output

  • addressFound: the full address retrieved from API with coordinates
  • isLoading: true/false while the http call is pending

Sample

<ng-address-data-gouv-search(addressFound)="console.log($event)" label="Just fill the input with a french postal address: " width="500"></app-search-address>

Extra infos

In fact you should never keep node_modules in production, but you should move dist files in your app using Webpack, or your Continous Integration with your pipelines.

This project was generated with Angular CLI version 8.0.6.

Development server

Run npm start for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

This is the debug mode, a bit like a StoryBook project where the component AddressSearchComponent is built like a full angular component

Build

Run npm run build to build the project as a custom element.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

You can add issues or do some PR to improve this package !

ng-address-data-gouv's People

Contributors

dependabot[bot] avatar rebolon avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

ng-address-data-gouv's Issues

Restore a sample with loader

Do a sample with the docs/ folder where you could add an icon to display a loader
In previous version there was a loding component, but it was'nt the right place coz ot coupled both components together

Size of the js bundle

Current size in es2015 output is 216Kb, so 65,8Kb in gziped version
Is there any better way to reduce this package size ?

  • all related parts to custom-elements could be externalized ?
  • all related angular core could be externalized (and be loaded only once ?)
  • any other idea ?

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.