Skip to content

Commit

Permalink
feat(compiler-cli): use ngc to generate *.metadata.json (#308)
Browse files Browse the repository at this point in the history
* compile with compiler-cli

* use del-cli in clean script

* fix ngc issue (unused param)

* update readme
  • Loading branch information
otelnov authored and valorkin committed Oct 6, 2016
1 parent 229333f commit 0f2b707
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ ng2-table.js.map
ng2-table.d.ts

/logs

factories

/**/*.metadata.json
/**/*.ngfactory.ts
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ webpack.config.js
/components/**/*.ts
!/components/**/*.d.ts

factories
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,30 @@ Follow me [![twitter](https://img.shields.io/twitter/follow/valorkin.svg?style=s
- `filtering` (`?any`) - switch on the filtering plugin
- `filterString` (`string`) - the default value for filter
- `columnName` (`string`) - the property name in raw data
- `className` (`string|Array<string>`) - additional CSS classes that should be added to a <table>
- `rows` (`?Array<any>`) - only list of the rows which should be displayed
- `columns` (`?Array<any>`) - config for columns (+ sorting settings if it's needed)
- `title` (`string`) - the title of column header
- `name` (`string`) - the property name in data
- `sort` (`?string|boolean`) - config for columns (+ sorting settings if it's needed), sorting is switched on by default for each column
- `className` (`string|Array<string>`) - additional CSS classes that should be added to a column header
- `filtering` (`?any`) - switch on the filtering plugin
- `filterString` (`string`) - the default value for filter
- `columnName` (`string`) - the property name in raw data
### Outputs (Events)
- `table-changed` - onclick event handler
- `tableChanged`: data change event handler
- `cellClicked`: onclick event handler
### Filter
The responsibility of the filtering issue falls on user. You should choose on which columns the filter would be applied. You could add any number of different filters.
Filter string - it's a string for matching values in raw data. Column name refers to the property name in raw data. The rest logic you could organize by yourself (the order of filters, data formats, etc). Even you could use filter for list of data columns.

You can also set up `filtering` param for columns, in this case filter box will appear in first row of the table.

### Sorting

Data sorting could be in 3 modes: asc, desc and without sorting data (as it comes from backend or somewhere else). If you want to switch off the sorting for some of the columns then you should set it forcibly in columns config (set property sort to false value for each column you want)
Expand Down
2 changes: 1 addition & 1 deletion components/table/ng-table-sorting.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class NgTableSortingDirective {
this.ngTableSorting = value;
}

@HostListener('click', ['$event', '$target'])
@HostListener('click', ['$event'])
public onToggleSort(event:any):void {
if (event) {
event.preventDefault();
Expand Down
32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
"description": "Simple angular2 table components with sorting, filtering...",
"scripts": {
"flow.compile": "npm run flow.compile:common && npm run flow.compile:system ",
"flow.compile:common": "./node_modules/.bin/tsc",
"flow.compile:system": "./.config/bundle-system.js",
"flow.copy:src": "./node_modules/.bin/cpy ng2-table.ts \"components/*.ts\" ts --parents",
"flow.clean": "./node_modules/.bin/del bundles coverage demo-build \"components/**/*.+(js|d.ts|js.map)\" dist \"ng2-table.+(js|d.ts|js.map)\"",
"flow.deploy:gh-pages": "npm run flow.build:prod && ./node_modules/.bin/gh-pages -d demo-build",
"flow.eslint": "./node_modules/.bin/eslint --ignore-path .gitignore --ext js --fix . .config",
"flow.tslint": "./node_modules/.bin/gulp lint",
"flow.compile:common": "ngc -p tsconfig.publish.json",
"flow.compile:system": "node ./.config/bundle-system.js",
"flow.copy:src": "cpy ng2-table.ts \"components/*.ts\" ts --parents",
"flow.clean": "del-cli bundles coverage demo-build \"components/**/*.+(js|d.ts|js.map|metadata.json)\" dist \"ng2-table.+(js|d.ts|js.map|metadata.json)\" factories",
"flow.deploy:gh-pages": "npm run flow.build:prod && gh-pages -d demo-build",
"flow.eslint": "eslint --ignore-path .gitignore --ext js --fix . .config",
"flow.tslint": "gulp lint",
"flow.lint": "npm run flow.eslint && npm run flow.tslint",
"flow.changelog": "./node_modules/.bin/conventional-changelog -i CHANGELOG.md -s -p angular -v",
"flow.github-release": "./node_modules/.bin/conventional-github-releaser -p angular",
"flow.build:prod": "NODE_ENV=production ./node_modules/.bin/webpack --progress --color",
"flow.build:dev": "./node_modules/.bin/webpack --progress --color",
"flow.serve:dev": "./node_modules/.bin/webpack-dev-server --hot --inline --colors --display-error-details --display-cached",
"flow.serve:prod": "NODE_ENV=production ./node_modules/.bin/webpack-dev-server --hot --inline --colors --display-error-details --display-cached",
"flow.changelog": "conventional-changelog -i CHANGELOG.md -s -p angular -v",
"flow.github-release": "conventional-github-releaser -p angular",
"flow.build:prod": "NODE_ENV=production webpack --progress --color",
"flow.build:dev": "webpack --progress --color",
"flow.serve:dev": "webpack-dev-server --hot --inline --colors --display-error-details --display-cached",
"flow.serve:prod": "NODE_ENV=production webpack-dev-server --hot --inline --colors --display-error-details --display-cached",
"prepublish": "npm run flow.clean && npm run flow.compile",
"postpublish": "npm run flow.deploy:gh-pages",
"start": "npm run flow.serve:dev",
"pretest": "npm run flow.lint",
"test": "NODE_ENV=test ./node_modules/.bin/karma start",
"test": "NODE_ENV=test karma start",
"preversion": "npm test",
"version": "npm run flow.changelog && git add -A",
"postversion": "git push origin development && git push --tags"
Expand Down Expand Up @@ -56,10 +56,12 @@
"devDependencies": {
"@angular/common": "2.0.1",
"@angular/compiler": "2.0.1",
"@angular/compiler-cli": "0.6.3",
"@angular/core": "2.0.1",
"@angular/forms": "2.0.1",
"@angular/platform-browser": "2.0.1",
"@angular/platform-browser-dynamic": "2.0.1",
"@angular/platform-server": "2.0.1",
"@types/jasmine": "2.2.34",
"@types/node": "6.0.42",
"@types/webpack": "1.12.34",
Expand All @@ -80,7 +82,7 @@
"gulp-tslint": "6.1.2",
"lite-server": "2.2.2",
"marked": "0.3.6",
"ng2-bootstrap": "1.1.5",
"ng2-bootstrap": "1.1.8",
"ng2-webpack-config": "0.0.5",
"pre-commit": "1.1.3",
"prismjs": "1.5.1",
Expand Down
31 changes: 31 additions & 0 deletions tsconfig.publish.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": false,
"noEmitHelpers": false,
"noImplicitAny": true,
"declaration": true,
"skipLibCheck": true,
"stripInternal": true,
"lib": ["dom", "es6"],
"types": [
"jasmine",
"node",
"webpack"
]
},
"exclude": [
"node_modules"
],
"files": [
"./demo/custom-typings.d.ts",
"./ng2-table.ts"
],
"angularCompilerOptions": {
"genDir": "factories"
}
}

0 comments on commit 0f2b707

Please sign in to comment.