Skip to content
Permalink
Browse files

feat(project): add resource variable

  • Loading branch information...
VMBindraban
VMBindraban committed Jun 9, 2016
1 parent d6dd8da commit b50a4bbde04218b8cd5baf38554831e2041faad8
Showing with 52 additions and 25 deletions.
  1. +11 −10 README.md
  2. +7 −3 dist/amd/datatable.js
  3. +8 −2 dist/commonjs/datatable.js
  4. +7 −2 dist/es2015/datatable.js
  5. +10 −4 dist/system/datatable.js
  6. +9 −4 src/datatable.js
@@ -1,29 +1,30 @@
# Data-table
A data-table with pagination built with [Spoonx/Aurelia-orm](https://github.com/SpoonX/aurelia-orm) and [Spoonx/Aurelia-pager](https://github.com/SpoonX/aurelia-pager)

## Bindables

#### columns
### columns
String representing the column names, supports renaming columns with `as` e.g. `name as username`.

#### repository
A entity with [Spoonx/Aurelia-orm](https://github.com/SpoonX/aurelia-orm).
### repository (optional)
A entity with [Spoonx/Aurelia-orm](https://github.com/SpoonX/aurelia-orm) e.g. `entityManager.getRepository('users')`

### resource (optional)
The name of a repository e.g. `users`

#### limit
### limit
The amount of items to show on 1 page, defaults to 30.

## Optional attributes

##### destroy
### destroy
Show delete button. Rows are removable, will trigger `deleted.delegate="myEventCallback($event)"` when clicked.

##### update
### update
Show edit button. Rows are editable, will trigger `updated.delegate="myEventCallback($event)"` when clicked.

##### sortable
### sortable
Columns can be sorted.

##### searchable
### searchable
Show the search field

## Custom html
@@ -1,4 +1,4 @@
define(['exports', 'aurelia-framework', 'aurelia-view-manager', 'aurelia-router', 'json-statham'], function (exports, _aureliaFramework, _aureliaViewManager, _aureliaRouter, _jsonStatham) {
define(['exports', 'aurelia-framework', 'aurelia-view-manager', 'aurelia-orm', 'aurelia-router', 'json-statham'], function (exports, _aureliaFramework, _aureliaViewManager, _aureliaOrm, _aureliaRouter, _jsonStatham) {
'use strict';

Object.defineProperty(exports, "__esModule", {
@@ -75,8 +75,8 @@ define(['exports', 'aurelia-framework', 'aurelia-view-manager', 'aurelia-router'

var _dec, _dec2, _dec3, _dec4, _dec5, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14;

var DataTable = exports.DataTable = (_dec = (0, _aureliaFramework.customElement)('data-table'), _dec2 = (0, _aureliaViewManager.resolvedView)('aurelia-data-table', 'datatable'), _dec3 = (0, _aureliaFramework.inject)(_aureliaRouter.Router, Element), _dec4 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec5 = (0, _aureliaFramework.computedFrom)('columns'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = function () {
function DataTable(Router, element, pager) {
var DataTable = exports.DataTable = (_dec = (0, _aureliaFramework.customElement)('data-table'), _dec2 = (0, _aureliaViewManager.resolvedView)('aurelia-data-table', 'datatable'), _dec3 = (0, _aureliaFramework.inject)(_aureliaRouter.Router, Element, _aureliaOrm.EntityManager), _dec4 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec5 = (0, _aureliaFramework.computedFrom)('columns'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = function () {
function DataTable(Router, element, entityManager) {
_classCallCheck(this, DataTable);

_initDefineProp(this, 'criteria', _descriptor, this);
@@ -114,6 +114,10 @@ define(['exports', 'aurelia-framework', 'aurelia-view-manager', 'aurelia-router'

this.router = Router;
this.element = element;

if (!this.repository && this.element.hasAttribute('resource')) {
this.repository = entityManager.getRepository(this.element.getAttribute('resource'));
}
}

DataTable.prototype.attached = function attached() {
@@ -13,6 +13,8 @@ var _aureliaFramework = require('aurelia-framework');

var _aureliaViewManager = require('aurelia-view-manager');

var _aureliaOrm = require('aurelia-orm');

var _aureliaRouter = require('aurelia-router');

var _jsonStatham = require('json-statham');
@@ -62,8 +64,8 @@ function _initializerWarningHelper(descriptor, context) {
throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}

var DataTable = exports.DataTable = (_dec = (0, _aureliaFramework.customElement)('data-table'), _dec2 = (0, _aureliaViewManager.resolvedView)('aurelia-data-table', 'datatable'), _dec3 = (0, _aureliaFramework.inject)(_aureliaRouter.Router, Element), _dec4 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec5 = (0, _aureliaFramework.computedFrom)('columns'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = function () {
function DataTable(Router, element, pager) {
var DataTable = exports.DataTable = (_dec = (0, _aureliaFramework.customElement)('data-table'), _dec2 = (0, _aureliaViewManager.resolvedView)('aurelia-data-table', 'datatable'), _dec3 = (0, _aureliaFramework.inject)(_aureliaRouter.Router, Element, _aureliaOrm.EntityManager), _dec4 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec5 = (0, _aureliaFramework.computedFrom)('columns'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = function () {
function DataTable(Router, element, entityManager) {
_classCallCheck(this, DataTable);

_initDefineProp(this, 'criteria', _descriptor, this);
@@ -101,6 +103,10 @@ var DataTable = exports.DataTable = (_dec = (0, _aureliaFramework.customElement)

this.router = Router;
this.element = element;

if (!this.repository && this.element.hasAttribute('resource')) {
this.repository = entityManager.getRepository(this.element.getAttribute('resource'));
}
}

DataTable.prototype.attached = function attached() {
@@ -45,12 +45,13 @@ function _initializerWarningHelper(descriptor, context) {

import { bindable, inject, computedFrom, customElement, bindingMode } from 'aurelia-framework';
import { resolvedView } from 'aurelia-view-manager';
import { EntityManager } from "aurelia-orm";
import { Router } from 'aurelia-router';
import { Statham } from 'json-statham';

export let DataTable = (_dec = customElement('data-table'), _dec2 = resolvedView('aurelia-data-table', 'datatable'), _dec3 = inject(Router, Element), _dec4 = bindable({ defaultBindingMode: bindingMode.twoWay }), _dec5 = computedFrom('columns'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class DataTable {
export let DataTable = (_dec = customElement('data-table'), _dec2 = resolvedView('aurelia-data-table', 'datatable'), _dec3 = inject(Router, Element, EntityManager), _dec4 = bindable({ defaultBindingMode: bindingMode.twoWay }), _dec5 = computedFrom('columns'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class DataTable {

constructor(Router, element, pager) {
constructor(Router, element, entityManager) {
_initDefineProp(this, 'criteria', _descriptor, this);

_initDefineProp(this, 'repository', _descriptor2, this);
@@ -86,6 +87,10 @@ export let DataTable = (_dec = customElement('data-table'), _dec2 = resolvedView

this.router = Router;
this.element = element;

if (!this.repository && this.element.hasAttribute('resource')) {
this.repository = entityManager.getRepository(this.element.getAttribute('resource'));
}
}

attached() {
@@ -1,9 +1,9 @@
'use strict';

System.register(['aurelia-framework', 'aurelia-view-manager', 'aurelia-router', 'json-statham'], function (_export, _context) {
System.register(['aurelia-framework', 'aurelia-view-manager', 'aurelia-orm', 'aurelia-router', 'json-statham'], function (_export, _context) {
"use strict";

var bindable, inject, computedFrom, customElement, bindingMode, resolvedView, Router, Statham, _createClass, _dec, _dec2, _dec3, _dec4, _dec5, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, DataTable;
var bindable, inject, computedFrom, customElement, bindingMode, resolvedView, EntityManager, Router, Statham, _createClass, _dec, _dec2, _dec3, _dec4, _dec5, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, DataTable;

function _initDefineProp(target, property, descriptor, context) {
if (!descriptor) return;
@@ -63,6 +63,8 @@ System.register(['aurelia-framework', 'aurelia-view-manager', 'aurelia-router',
bindingMode = _aureliaFramework.bindingMode;
}, function (_aureliaViewManager) {
resolvedView = _aureliaViewManager.resolvedView;
}, function (_aureliaOrm) {
EntityManager = _aureliaOrm.EntityManager;
}, function (_aureliaRouter) {
Router = _aureliaRouter.Router;
}, function (_jsonStatham) {
@@ -87,8 +89,8 @@ System.register(['aurelia-framework', 'aurelia-view-manager', 'aurelia-router',
};
}();

_export('DataTable', DataTable = (_dec = customElement('data-table'), _dec2 = resolvedView('aurelia-data-table', 'datatable'), _dec3 = inject(Router, Element), _dec4 = bindable({ defaultBindingMode: bindingMode.twoWay }), _dec5 = computedFrom('columns'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = function () {
function DataTable(Router, element, pager) {
_export('DataTable', DataTable = (_dec = customElement('data-table'), _dec2 = resolvedView('aurelia-data-table', 'datatable'), _dec3 = inject(Router, Element, EntityManager), _dec4 = bindable({ defaultBindingMode: bindingMode.twoWay }), _dec5 = computedFrom('columns'), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = function () {
function DataTable(Router, element, entityManager) {
_classCallCheck(this, DataTable);

_initDefineProp(this, 'criteria', _descriptor, this);
@@ -126,6 +128,10 @@ System.register(['aurelia-framework', 'aurelia-view-manager', 'aurelia-router',

this.router = Router;
this.element = element;

if (!this.repository && this.element.hasAttribute('resource')) {
this.repository = entityManager.getRepository(this.element.getAttribute('resource'));
}
}

DataTable.prototype.attached = function attached() {
@@ -1,11 +1,12 @@
import {bindable, inject, computedFrom, customElement, bindingMode} from 'aurelia-framework';
import {resolvedView} from 'aurelia-view-manager';
import {EntityManager} from "aurelia-orm";
import {Router} from 'aurelia-router';
import {Statham} from 'json-statham';

@customElement('data-table')
@resolvedView('aurelia-data-table', 'datatable')
@inject(Router, Element)
@inject(Router, Element, EntityManager)
export class DataTable {
// search criteria
@bindable({defaultBindingMode: bindingMode.twoWay}) criteria;
@@ -47,9 +48,13 @@ export class DataTable {
sortingCriteria = {};
searchCriteria = {}

constructor(Router, element) {
this.router = Router;
this.element = element;
constructor(Router, element, entityManager) {
this.router = Router;
this.element = element;

if (!this.repository && this.element.hasAttribute('resource')) {
this.repository = entityManager.getRepository(this.element.getAttribute('resource'));
}
}

attached() {

0 comments on commit b50a4bb

Please sign in to comment.
You can’t perform that action at this time.