Skip to content

Commit 6808cf4

Browse files
committed
add Development and Installation sections to README
1 parent 7a10a5d commit 6808cf4

File tree

1 file changed

+96
-25
lines changed

1 file changed

+96
-25
lines changed

README.md

Lines changed: 96 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
- [Introduction](#introduction)
1212
- [Why?](#why)
1313
- [How it works](#how-it-works)
14-
- [In action](#in-action)
1514
- [Basic usage](#basic-usage)
1615
- [Examples](#examples)
17-
- [Structure](#structure)
16+
- [Install and connect](#install-and-connect)
1817
- [uiScroll directive](#uiscroll-directive)
1918
- [Parametrs](#parametrs)
2019
- [Datasource](#datasource)
@@ -23,6 +22,7 @@
2322
- [jqLiteExtras service](#jqliteextras-service)
2423
- [uiScrollTh and uiScrollTd](#uiscrollth-and-uiscrolltd-directives)
2524
- [GridAdapter](#gridadapter)
25+
- [Development](#development)
2626
- [Change log](#change-log)
2727

2828

@@ -58,8 +58,6 @@ The directive is asking the datasource for data to build and render elements unt
5858
It will start retrieving new data for new elements again if the user scrolls up/down to the edge of visible element list.
5959

6060

61-
### In action
62-
6361
![](https://raw.githubusercontent.com/angular-ui/ui-scroll/modules/demo/ui-scroll-demo.gif)
6462

6563

@@ -92,17 +90,41 @@ absolutely independent and has its own html-page and the javascript file with th
9290
To run the examples use __[this link](http://rawgithub.com/angular-ui/ui-scroll/master/demo/index.html)__.
9391

9492

95-
### Structure
93+
### Install and connect
94+
95+
To install the package via npm use
96+
97+
```
98+
npm install --save angular-ui-scroll
99+
```
100+
101+
After installation, the ui-scroll distributive files will be available as
102+
103+
```
104+
<script src="node_modules/angular-ui-scroll/dist/ui-scroll.min.js">
105+
<script src="node_modules/angular-ui-scroll/dist/ui-scroll-grid.min.js">
106+
```
107+
108+
There are also uncompressed versions (ui-scroll.js, ui-scroll-grid.js) and sourcemaps for all of js-files.
109+
110+
To use it in your angular-app you should add the module (modules)
96111

97-
Currently we have 3 modules wich can be added to the angular-app you are developing.
112+
```
113+
angular.module('application', ['ui.scroll', 'ui.scroll.grid'])
114+
```
115+
116+
Currently we have 2 regular modules which can be added to the angular-app you are developing.
98117
- __ui.scroll__ module which has
99-
- uiScroll directive
100-
- uiScrollViewport directive
101-
- jqLiteExtras service (with runner)
118+
- [uiScroll directive](#uiscroll-directive)
119+
- [uiScrollViewport directive](#uiscrollviewport-directive)
120+
- [jqLiteExtras service](#jqliteextras-service) (with runner)
102121
- __ui.scroll.grid__ module which has
103-
- uiScrollTh directive
104-
- uiScrollTd directive
105-
- __ui.scroll.jqlite__ module which is just empty since it was deprecated in v1.6.0
122+
- [uiScrollTh directive](#uiscrollth-and-uiscrolltd-directives)
123+
- [uiScrollTd directive](#uiscrollth-and-uiscrolltd-directives)
124+
125+
Also there is one more additional module in a separate file
126+
- __ui.scroll.jqlite__ module
127+
It is empty since it was deprecated in v1.6.0.
106128

107129

108130
-------------------
@@ -135,7 +157,7 @@ Some of the properties offered by the adapter can also be accessed directly from
135157
* **top-visible-element - assignable expression**, optional - a reference to the DOM element currently in the topmost visible position will be injected in the appropriate scope. See also `topVisibleElement` adapter property.
136158
* **top-visible-scope - assignable expression**, optional - a reference to the scope created for the item currently in the topmost visible position will be injected in the appropriate scope. See also `topVisibleScope` adapter property.
137159

138-
The `expression` can be any angular expression (assignable expression where so specified). All expressions are evaluated once at the time when the scroller is initalized. Changes in the expresion value after scroller intialization will have no impact on the scroller behavior.
160+
The `expression` can be any angular expression (assignable expression where so specified). All expressions are evaluated once at the time when the scroller is initialized. Changes in the expression value after scroller initialization will have no impact on the scroller behavior.
139161

140162
The assignable expressions will be used by scroller to inject the requested value into the target scope. The scope associated with the viewport (the element marked with the [uiScrollViewport](#uiscrollviewport-directive) directive) will be used as the target scope. If the viewport is not defined (window viewport), the $rootScope will be used as the target scope. Note that the nearest additional scope-wrapper (like ng-if directive set right on the viewport) makes this mechanism unusable. There are two options which help in this case:
141163

@@ -175,9 +197,9 @@ exactly `count` elements unless it hit eof/bof.
175197

176198
* Properties `minIndex` and `maxIndex`
177199

178-
As the scroller recieves the items requested by the `get` method, the value of minimum and maximum values of the item index are placed in the `minIndex` and `maxIndex` properties respectively. The values of the properties are cumulative - the value of the `minIndex` will never increase, and the value of the `maxIndex` will never decrease - except the values are reset in response to a call to the adapter `reload` method. The values of the properties are used to maintain the appearance of the scroller scrollBar.
200+
As the scroller receives the items requested by the `get` method, the value of minimum and maximum values of the item index are placed in the `minIndex` and `maxIndex` properties respectively. The values of the properties are cumulative - the value of the `minIndex` will never increase, and the value of the `maxIndex` will never decrease - except the values are reset in response to a call to the adapter `reload` method. The values of the properties are used to maintain the appearance of the scroller scrollBar.
179201

180-
Values of the properties can be assigned programmatically. If the range of the index values is known in advance, assigneing them programmatically would improve the usability of the scrollBar.
202+
Values of the properties can be assigned programmatically. If the range of the index values is known in advance, assigning them programmatically would improve the usability of the scrollBar.
181203

182204

183205
###Adapter
@@ -192,7 +214,7 @@ Adapter object implements the following properties:
192214
* `topVisibleScope` - a read only reference to the scope created for the item currently in the topmost visible position.
193215
* `disabled` - setting `disabled` to `true` disables scroller's scroll/resize events handlers. This can be useful if you have multiple scrollers within the same scrollViewport and you want to prevent some of them from responding to the events.
194216

195-
Adapater object implements the following methods
217+
Adapter object implements the following methods
196218

197219
* Method `isBOF`
198220

@@ -258,7 +280,7 @@ Adapater object implements the following methods
258280
Adapter methods `applyUpdates`, `append` and `prepend` provide a way to update the scroller content without full reload of the content from the datasource. The updates are performed by changing the items in the scroller internal buffer after they are loaded from the datasource. Items in the buffer can be deleted or replaced with one or more items.
259281

260282
_Important!_ Update datasource to match the scroller buffer content. Keep in mind that the modifications made by the adapter methods are only applied to the content of the buffer. As the items in response to scrolling are pushed out of the buffer, the modifications are lost. It is your responsibility to ensure that as the scroller is scrolled back and a modified item is requested from the datasource again the values returned by the datasource would reflect the updated state. In other words you have to make sure that in addition to manipulating the scroller content you also apply the modifications to the dataset underlying the datasource.
261-
[Here](https://rawgit.com/angular-ui/ui-scroll/master/demo/append/append.html) is the example of such implementaion.
283+
[Here](https://rawgit.com/angular-ui/ui-scroll/master/demo/append/append.html) is the example of such implementation.
262284

263285
#### Animations
264286
In the fashion similar to ngRepeat the following animations are supported:
@@ -291,7 +313,7 @@ the browser window object will be used as viewport.
291313

292314
## jqLiteExtras service
293315

294-
This service implements some DOM element methods of jQuery which are currently not implemented in jQlite, namely
316+
This service implements some DOM element methods of jQuery which are currently not implemented in jqLite, namely
295317

296318
* before(elem)
297319
* height() and height(value)
@@ -300,7 +322,7 @@ This service implements some DOM element methods of jQuery which are currently n
300322
* offset()
301323

302324
These methods are being registered on angular.element during 'ui.scroll' module run automatically only if jQuery is not loaded.
303-
It is so since ui-scroll v1.6.0. In previous versions there was a separate module 'ui.scroll.jqlite' wchich should have been
325+
It is so since ui-scroll v1.6.0. In previous versions there was a separate module 'ui.scroll.jqlite' which should have been
304326
included in the dependency list of the main app module. So currently we leave 'ui.scroll.jqlite' module stub with no content
305327
to provide full backward compatibility.
306328

@@ -310,10 +332,10 @@ to provide full backward compatibility.
310332

311333
## uiScrollTh and uiScrollTd directives
312334

313-
The uiScrollTh and uiScrollTd directives provide a way to build flexible dynamic grids. Handling of grid rows is done by the uiScroll directive itself. In addition to this uiScrollTh and uiScrollTd directive provide tools to programmatically change grid layout, inclduing applying styles to columns, changing column size and order, as well as saving the modifications to the layout and applying previosly saved layouts.
335+
The uiScrollTh and uiScrollTd directives provide a way to build flexible dynamic grids. Handling of grid rows is done by the uiScroll directive itself. In addition to this uiScrollTh and uiScrollTd directive provide tools to programmatically change grid layout, including applying styles to columns, changing column size and order, as well as saving the modifications to the layout and applying previously saved layouts.
314336
At this point the above functionality is supported only for table based scrollable grids.
315337

316-
Here is the basic html template for scrollable grid using the uiScrollTh and uiScrollTd directives. Keep in mind that the height of the scroll viewport (in this case the `<TABLE>` tag) should be constrained. Also make sure that the initial column widths are applied uniformly to both headers (`<TH>`) and cells (`<TD>`)
338+
Here is the basic html template for scrollable grid using the uiScrollTh and uiScrollTd directives. Keep in mind that the height of the scroll viewport (in this case the `<TABLE>` tag) should be constrained. Also, make sure that the initial column widths are applied uniformly to both headers (`<TH>`) and cells (`<TD>`)
317339

318340
```html
319341
<TABLE ui-scroll-viewport class="grid">
@@ -349,13 +371,62 @@ A reference to this object is injected as a property named `gridAdapter`in the s
349371

350372
* Method `getLayout()` - returns an object describing current scrollable grid layout.
351373
* Method `applyLayout(layout)` - restores scrollabel grid layout to the state as defined by the object passed as the parameter
352-
* Method `columnFromPoint(x,y)` - if the coordinates belong to a scrollable grid column returns the appropriate ColumnAdapter object. Otherwise returns `undefined`.
374+
* Method `columnFromPoint(x,y)` - if the coordinates belong to a scrollable grid column returns the appropriate ColumnAdapter object. Otherwise, returns `undefined`.
353375

354376
`ColumnAdapter` object implements the following methods:
355377

356378
* Method `css(name, value)` - sets the css property `name` to `value` for the column header as well as for the column cells.
357-
* Method `moveBefore(column)` - moves the column in front of the column refrenced by the parameter. If the parameter is null the column will become the rightmost column.
379+
* Method `moveBefore(column)` - moves the column in front of the column referenced by the parameter. If the parameter is null, the column will become the rightmost column.
380+
381+
382+
-------------------
383+
384+
385+
## Development
358386

387+
Please feel free to make Pull Requests. Below is the information which could be useful for local developing and contributing.
388+
389+
The ui-scroll sources are in [./src](https://github.com/angular-ui/ui-scroll/tree/master/src) folder. They could not be run as is
390+
because of ES6 modules (since v1.6.0), they should be built. Build process includes jshint sources verification, webpack-based
391+
distributive files forming and tests running.
392+
393+
Three npm scripts are available for developing.
394+
395+
__1__. To run dev-server use
396+
397+
```
398+
npm start
399+
```
400+
401+
This should start development server on 5005 port over the [./demo](https://github.com/angular-ui/ui-scroll/tree/master/demo) folder.
402+
The middleware is configured to provide work with temporary distributive files (./temp) despite the direct links to public distributive
403+
files (./dist). So the dist-folder should stay clear until the development is finished. Dev-server watches for the source codes (./src)
404+
and automatically re-build temporary distributive files.
405+
406+
__2__. To run tests in keep-alive mode use
407+
408+
```
409+
npm run test
410+
```
411+
412+
This runs karma testing against temporary distributive files (./temp). We created a number of specifications which consist of more
413+
than 160 tests. They are living at [./test](https://github.com/angular-ui/ui-scroll/tree/master/test) folder. Karma watches for temp
414+
and test folders changes and automatically re-run tests.
415+
416+
__3__. To run full build use
417+
418+
```
419+
npm run build
420+
```
421+
422+
After developing and testing complete the build process should be run to
423+
a) pass through jshint,
424+
b) generate minified versions of distributive,
425+
c) run tests with minified distributive files,
426+
d) obtain all necessary files in [./dist](https://github.com/angular-ui/ui-scroll/tree/master/dist) folder.
427+
428+
PR should include source code (./scr) and tests (./test) changes and may not include public distributive (./dist) changes.
429+
359430

360431
-------------------
361432

@@ -366,6 +437,7 @@ A reference to this object is injected as a property named `gridAdapter`in the s
366437
* Introduced ES6 modules in the source codes.
367438
* Improved build process with Webpack.
368439
* Added sourcemaps. Fixed dev-server.
440+
* Removed 'ui.scroll.jqlite' module. Added jqLiteExtras service to 'ui.scroll' module.
369441
* Significantly changed readme.
370442

371443
###v1.5.2
@@ -382,7 +454,7 @@ A reference to this object is injected as a property named `gridAdapter`in the s
382454
* Implemented "on controller" syntax to specify the scope where an adapter object has to be injected.
383455

384456
###v1.4.1
385-
* Developed a new complex approach of paddings elements height calculation (see [details](https://github.com/angular-ui/ui-scroll/pull/77)).
457+
* Developed a new complex approach of padding elements height calculation (see [details](https://github.com/angular-ui/ui-scroll/pull/77)).
386458
* Added startIndex attribute.
387459
* Changed clipTop/clipBottom methods logic.
388460
* Some new demos, tests, cleanup and other minor refactoring.
@@ -427,4 +499,3 @@ A reference to this object is injected as a property named `gridAdapter`in the s
427499
* Introduced API to dynamically update scroller content.
428500
* Deep 'name' properties access via dot-notation in template.
429501
* Fixed the problem occurring if the scroller is $destroyed while there are requests pending: [#64](https://github.com/Hill30/NGScroller/issues/64).
430-

0 commit comments

Comments
 (0)