├── .gitignore ├── .travis.yml ├── .versions ├── CHANGELOG.md ├── Gruntfile.js ├── LICENSE ├── README.md ├── bower.json ├── dist ├── README.md ├── ng-flow-standalone.js ├── ng-flow-standalone.min.js ├── ng-flow.js └── ng-flow.min.js ├── index.js ├── karma.conf.js ├── package.js ├── package.json ├── samples ├── basic │ ├── app.js │ ├── index.html │ └── upload.php ├── dataurl │ ├── app.js │ ├── flow.png │ └── index.html └── image │ ├── app.js │ ├── index.html │ └── upload.php ├── src ├── angular-flow.js ├── directives │ ├── btn.js │ ├── drag-events.js │ ├── drop.js │ ├── events.js │ ├── img.js │ ├── init.js │ └── transfers.js └── provider.js ├── test ├── events.spec.js └── init.spec.js └── travis.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # phpstorm project files 2 | .idea/* 3 | 4 | # netbeans project files 5 | nbproject 6 | 7 | # zend studio for eclipse project files 8 | .buildpath 9 | .project 10 | .settings 11 | 12 | # windows thumbnail cache 13 | Thumbs.db 14 | 15 | # build 16 | /build/* 17 | 18 | # node 19 | /node_modules/* 20 | 21 | # bower 22 | /bower_components/* 23 | 24 | # test coverage 25 | test-results -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | services: 4 | - xvfb 5 | cache: 6 | directories: 7 | - node_modules 8 | env: 9 | global: 10 | - SAUCE_USERNAE=ng-flow 11 | - SAUCE_ACCESS_KEY=008c40ec-dbaf-4edc-abad-6c6afcc5d13a 12 | matrix: 13 | fast_finish: true 14 | include: 15 | - env: TEST='unit-tests' 16 | node_js: "lts/*" 17 | - env: TEST='browser-tests' 18 | node_js: "lts/*" 19 | addons: 20 | sauce_connect: true 21 | allow_failures: 22 | - env: TEST='browser-tests' 23 | before_install: npm install -g grunt-cli bower codeclimate-test-reporter 24 | install: 25 | - npm install 26 | - bower update 27 | script: 28 | - $TRAVIS_BUILD_DIR/travis.sh 29 | -------------------------------------------------------------------------------- /.versions: -------------------------------------------------------------------------------- 1 | angular:angular@1.2.24 2 | digimet:flowjs@2.9.0 3 | digimet:ng-flow@2.6.1 4 | meteor@1.1.6 5 | underscore@1.0.3 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 2.0.0 2 | 3 | ## Features 4 | - **flowDragEnter** directive added 5 | - **flowPreventDrop** directive added 6 | - event attributes, such as **flowFilesSubmitted**, now can be assigned inside **flowInit** 7 | directive 8 | - **flowInit** directive also **$broadcast** all events to child scopes 9 | 10 | ## Breaking Changes 11 | - Module **ngFlow** was renamed to **flow** 12 | - All directives and attributes, starting with **ng-flow**, was renamed to **flow** 13 | - **flowBtn** directive attributes **ng-directory** and **ng-single-file** renamed to 14 | **flow-directory** and **flow-single-file** 15 | - **ngDragOverClass** directive dropped, use **flowDragEnter** directive instead 16 | - some files in src directory was renamed -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | // Project configuration. 3 | grunt.initConfig({ 4 | pkg: grunt.file.readJSON('package.json'), 5 | uglify: { 6 | options: { 7 | banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n' 8 | }, 9 | 'ng-flow': { 10 | src: ['dist/ng-flow.js'], 11 | dest: 'dist/ng-flow.min.js' 12 | }, 13 | 'ng-flow-standalone': { 14 | src: ['dist/ng-flow-standalone.js'], 15 | dest: 'dist/ng-flow-standalone.min.js' 16 | } 17 | }, 18 | concat: { 19 | flow: { 20 | files: { 21 | 'dist/ng-flow.js': [ 22 | 'src/provider.js', 23 | 'src/directives/init.js', 24 | 'src/directives/*.js', 25 | 'src/*.js' 26 | ], 27 | 'dist/ng-flow-standalone.js': [ 28 | 'bower_components/flow.js/dist/flow.js', 29 | 'src/provider.js', 30 | 'src/directives/init.js', 31 | 'src/directives/*.js', 32 | 'src/*.js' 33 | ] 34 | } 35 | } 36 | }, 37 | karma: { 38 | options: { 39 | configFile: 'karma.conf.js' 40 | }, 41 | continuous: { 42 | singleRun: true 43 | }, 44 | coverage: { 45 | singleRun: true, 46 | browsers: ['Firefox'], 47 | reporters: ['progress', 'coverage'], 48 | preprocessors: { 49 | 'src/**/*.js': 'coverage' 50 | }, 51 | coverageReporter: { 52 | type: "lcov", 53 | dir: "coverage" 54 | } 55 | }, 56 | saucelabs: { 57 | singleRun: true, 58 | reporters: ['progress', 'saucelabs'], 59 | preprocessors: { 60 | 'src/**/*.js': 'coverage' 61 | }, 62 | coverageReporter: { 63 | type: "lcov", 64 | dir: "coverage" 65 | }, 66 | // global config for SauceLabs 67 | sauceLabs: { 68 | testName: 'ng-flow', 69 | username: grunt.option('sauce-username') || process.env.SAUCE_USERNAME, 70 | accessKey: grunt.option('sauce-access-key') || process.env.SAUCE_ACCESS_KEY, 71 | tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER, 72 | startConnect: false 73 | } 74 | } 75 | }, 76 | clean: { 77 | release: ["dist/ng*"] 78 | }, 79 | bump: { 80 | options: { 81 | files: ['package.json', 'bower.json'], 82 | updateConfigs: ['pkg'], 83 | commit: true, 84 | commitMessage: 'Release v%VERSION%', 85 | commitFiles: ['-a'], // '-a' for all files 86 | createTag: true, 87 | tagName: 'v%VERSION%', 88 | tagMessage: 'Version %VERSION%', 89 | push: true, 90 | pushTo: 'origin', 91 | gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe' 92 | } 93 | } 94 | }); 95 | 96 | // Loading dependencies 97 | for (var key in grunt.file.readJSON("package.json").devDependencies) { 98 | if (key !== "grunt" && key.indexOf("grunt") === 0) grunt.loadNpmTasks(key); 99 | } 100 | 101 | // Default task. 102 | grunt.registerTask('default', ['test']); 103 | 104 | // Release tasks 105 | grunt.registerTask('build', ['concat', 'uglify']); 106 | grunt.registerTask('release', function(type) { 107 | type = type ? type : 'patch'; 108 | grunt.task.run('bump-only:' + type); 109 | grunt.task.run('clean', 'build'); 110 | grunt.task.run('bump-commit'); 111 | }); 112 | 113 | // Development 114 | grunt.registerTask('test', ["karma:coverage"]); 115 | }; 116 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Aidas Klimas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ng-flow [![Build Status](https://travis-ci.org/flowjs/ng-flow.svg)](https://travis-ci.org/flowjs/ng-flow) [![Test Coverage](https://codeclimate.com/github/flowjs/ng-flow/badges/coverage.svg)](https://codeclimate.com/github/flowjs/ng-flow/coverage) 2 | 3 | [![Saucelabs Test Status](https://saucelabs.com/browser-matrix/ng-flow.svg)](https://saucelabs.com/u/ng-flow) 4 | 5 | View angular2+ repo at https://github.com/flowjs/ngx-flow 6 | 7 | ng-flow is a [Flow.js](https://github.com/flowjs/flow.js) extensions for angular.js framework, no 3rd party JS dependencies required! 8 | 9 | Demo: http://flowjs.github.io/ng-flow/ 10 | 11 | How can I install it? 12 | ============ 13 | 1) Get the library: 14 | 15 | **Direct Download** 16 | Download a latest build from https://github.com/flowjs/ng-flow/releases 17 | it contains development and minified production files in `dist/` directory, 18 | they are also concatenated with core flow.js library. 19 | 20 | **Using NPM** 21 | 22 | npm install @flowjs/ng-flow --save 23 | 24 | **Using Bower** 25 | 26 | bower install ng-flow#~2 27 | 28 | **Git Clone** 29 | 30 | git clone https://github.com/flowjs/ng-flow 31 | 32 | **Using Yeoman** 33 | 34 | bower install "ng-flow#~2" --save 35 | grunt bower-install 36 | 37 | 2) Add the module to your app as a dependency: 38 | 39 | angular.module('app', ['flow']) 40 | 41 | 3) Include the files in your project 42 | ```html 43 | 44 | 45 | 46 | 47 | 48 | ``` 49 | 50 | How can I use it? 51 | ============ 52 | 53 | First of all wrap places there you are going to use Flow.js 54 | ````html 55 |
56 | ... other flow directives goes here ... 57 |
58 | ```` 59 | 60 | This directive is going to add $flow variable to current scope. 61 | Also directive can be nested, because `$flow` variable is going to be overridden. 62 | `$flow` is instance of [Flow](https://github.com/flowjs/flow.js#flow). 63 | 64 | 65 | Secondly you need to assign some upload buttons: 66 | ````html 67 | 68 | 69 | Input OR Other element as upload button 70 | Upload File 71 | ```` 72 | 73 | First button is for normal uploads and second is for directory uploads. 74 | Note: avoid using `` and `