From 2e1ae9ffb253e89bab607279747429b1d2d5feb4 Mon Sep 17 00:00:00 2001 From: edencoder Date: Thu, 9 Apr 2020 21:50:42 +1000 Subject: [PATCH] various changes --- bundles/grid/helpers/{grid.js => grid.ts} | 26 ++++++++--------------- bundles/grid/models/{grid.js => grid.ts} | 12 +++-------- bundles/grid/public/js/grid.js | 2 +- 3 files changed, 13 insertions(+), 27 deletions(-) rename bundles/grid/helpers/{grid.js => grid.ts} (97%) rename bundles/grid/models/{grid.js => grid.ts} (65%) diff --git a/bundles/grid/helpers/grid.js b/bundles/grid/helpers/grid.ts similarity index 97% rename from bundles/grid/helpers/grid.js rename to bundles/grid/helpers/grid.ts index 25e14f8..907413f 100755 --- a/bundles/grid/helpers/grid.js +++ b/bundles/grid/helpers/grid.ts @@ -1,11 +1,11 @@ // Require local class dependencies -const xl = require('excel4node'); -const uuid = require('uuid'); -const Helper = require('helper'); -const moment = require('moment'); -const toText = require('html-to-text'); -const dotProp = require('dot-prop'); -const json2csv = require('json2csv'); +import xl from 'excel4node'; +import uuid from 'uuid'; +import Helper from 'helper'; +import moment from 'moment'; +import toText from 'html-to-text'; +import dotProp from 'dot-prop'; +import json2csv from 'json2csv'; // require models @@ -14,7 +14,7 @@ const Grid = model('grid'); /** * Create Grid Helper class */ -class GridHelper extends Helper { +export default class GridHelper extends Helper { /** * Construct Grid Helper class * @@ -148,7 +148,6 @@ class GridHelper extends Helper { ['where', 'match', 'eq', 'ne', 'or', 'and', 'elem', 'in', 'nin', 'gt', 'lt', 'gte', 'lte'].forEach((method) => { // Create new function this[method] = (...args) => { - // Set where // eslint-disable-next-line no-return-assign return this.__query = this.__query[method](...args); }; @@ -799,11 +798,4 @@ class GridHelper extends Helper { // returns true if object return (item && typeof item === 'object' && !Array.isArray(item)); } -} - -/** - * Export new Grid Helper instance - * - * @type {GridHelper} - */ -module.exports = GridHelper; +} \ No newline at end of file diff --git a/bundles/grid/models/grid.js b/bundles/grid/models/grid.ts similarity index 65% rename from bundles/grid/models/grid.js rename to bundles/grid/models/grid.ts index 6c26281..6265753 100755 --- a/bundles/grid/models/grid.js +++ b/bundles/grid/models/grid.ts @@ -1,11 +1,11 @@ // import dependencies -const Model = require('model'); +import Model from 'model'; /** * create user class */ -class Grid extends Model { +export default class Grid extends Model { /** * sanitises placement * @@ -17,10 +17,4 @@ class Grid extends Model { id : this.get('_id') ? this.get('_id').toString() : null, }; } -} - -/** - * export user class - * @type {user} - */ -module.exports = Grid; +} \ No newline at end of file diff --git a/bundles/grid/public/js/grid.js b/bundles/grid/public/js/grid.js index c8ce510..f1cd050 100755 --- a/bundles/grid/public/js/grid.js +++ b/bundles/grid/public/js/grid.js @@ -5,7 +5,7 @@ const Events = require('events'); const dotProp = require('dot-prop'); // Require live model -const EdenModel = require('model/public/js/model'); +const EdenModel = require('sync/public/js/model'); /** * create grid store