项目作者: ne0guille

项目描述 :
aurelia spinner plugin based on spinkit spinners
高级语言: TypeScript
项目地址: git://github.com/ne0guille/aurelia-spinner.git
创建时间: 2017-08-24T01:13:01Z
项目社区:https://github.com/ne0guille/aurelia-spinner

开源协议:MIT License

下载


Aurelia custom attribute to add awesome spinners based on http://tobiasahlin.com/spinkit/

demo
https://ne0guille-aurelia-spinner.azurewebsites.net/

Installation

npm install aurelia-spinner --save

Plugin Setup
The only required attribute its the spinner view.

  1. import { SpinnerConfig, spinnerViews } from 'aurelia-spinner';
  2. const spinnerConfig: SpinnerConfig = {
  3. spinner: spinnerViews.circle,
  4. useBackgroundOverlay: false,
  5. blockerClass: 'my-default-overlay-background',
  6. color: 'black'
  7. };
  8. aurelia.use.plugin(PLATFORM.moduleName('aurelia-spinner', spinnerConfig))

Configuration Options
You can see all of the spinners available in the demo site.

  1. spinnerViews = {
  2. chasingDots
  3. circle,
  4. cubeGrid,
  5. doubleBounce,
  6. fadingCircle,
  7. foldingCube,
  8. pulse,
  9. rotatingPlane,
  10. threeBounce,
  11. wanderingCubes,
  12. wave
  13. }

add style in webpack
if you use te spinner-block class you need to add this file.

  1. 'aurelia-spinner/dist/styles.css'
  2. css: 'spinkit/css/spinkit.css;
  3. sass: 'spinkit/scss/spinkit.scss;
  4. or you can import a single spinner file under the spinner folder.
  5. css: 'spinkit/css/spinners/9-cube-grid.css';
  6. sass: 'spinkit/scss/spinners/9-cube-grid.scss';

Usage
Usage with default configurations

  1. <div class="container">
  2. <div spinner="show.bind: showVM"></div>
  3. </div>
  4. <div spinner="show.bind: showVM; view.bind: viewVM; block: true">
  5. </div>
  6. Currently, you need to wrap your custom element or code.
  7. You can specify the container element adding the spinner-container class first the children node. Also you can add the 'aurelia-spinner' class on the parent node to render the spinner component on top of your code.
  8. The background overlay class will be added on the container / wrapper node.
  9. <section spinner="show.bind: showVM">
  10. <!-- spinner will be inserted here -->
  11. <div class="spinner-container"> <!-- wrapper div --> <!-- background ovelay will be added here -->
  12. <!-- my-custom-code -->
  13. </div>
  14. </section>
  15. <section class="aurelia-spinner">
  16. <!-- spinner will be inserted here -->
  17. <div spinner="show.bind: showVM"> <!-- wrapper div --> <!-- background ovelay will be added here -->
  18. <!-- my-custom-code -->
  19. </div>
  20. </section>
  21. <section>
  22. <div spinner="show.bind: showVM" class="playground__spinner"> <!-- spinner-container class will be added here -->
  23. <!-- spinner will be inserted here -->
  24. stuff
  25. </div>
  26. </section>

Bindables

  1. Bindable used to show or hide the spinner.
  2. show: boolean = false;
  3. Just if you want to override the previous configured view.
  4. view: string = undefined;
  5. Used to display an overlay blocker with the spinner. You can change the style setting the class in the default configurarion object or overriding the css of the spinner-block class.
  6. block: boolean = false;
  7. Type a color name or an hexa code.
  8. color: string = #333;
  9. example:
  10. <div spinner="show.bind: showVM; block: true; view: viewVM; color: white"></div>

Dependencies
“spinkit”: https://github.com/tobiasahlin/SpinKit