/konyvtar-js

An opensource library/package of code wrappers for ExtJS 6.2.0 GPL

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

konyvtar-js

npm version npm downloads npm downloads npm downloads npm downloads node contributors stars commits last commit License

An opensource library/package of code wrappers for ExtJS 6.2.0 GPL

Quickstart

Installation

$ npm install --save konyvtar-js

Usage (NPM):

const kony = require('konyvter-js');

Example (Using express and express-es6-template-engine):

@app.js

const express = require('express');
const es6Renderer = require('express-es6-template-engine');
const kony = require('konyvtar-js');

const app = express();

app.engine('html', es6Renderer);
app.set('views', 'views');
app.set('view engine', 'html');

app.get('/', function (req, res) {
    res.render('template', {
        locals: {
            kony
        }
    });
});

app.listen(3000);

@template.html

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="/lib/extjs/ext-all.js"></script>
    <script type="text/javascript" src="/lib/extjs/classic/theme-triton/theme-triton.js"></script>
    <script type="text/javascript" src="/lib/extjs/packages/charts/classic/charts.js"></script>
    <script type="text/javascript" src="/lib/extjs/packages/ux/classic/ux.js"></script>
    <script type="text/javascript"> var Kony = ${kony}; </script>
</head>
<body>
</body>
</html>

Usage (Single File):

@template.html

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="/lib/extjs/ext-all.js"></script>
    <script type="text/javascript" src="/lib/extjs/classic/theme-triton/theme-triton.js"></script>
    <script type="text/javascript" src="/lib/extjs/packages/charts/classic/charts.js"></script>
    <script type="text/javascript" src="/lib/extjs/packages/ux/classic/ux.js"></script>
    <script type="text/javascript" src="/path/to/konyvtar.js</script>
</head>
<body>
</body>
</html>

Running Tests

$ npm test

Documentation

Table of Contents

Features

Component

  • query
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'button',
 * *    reference: 'sample-button'
 * * }
 *
 * * @Controller
 * * Kony.component.query('button[reference = sample-button]');
 *
 * @param {string} queryString
 */
Kony.component.query(queryString);
  • reference
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'button',
 * *    reference: 'sample-button'
 * * }
 *
 * * @Controller
 * * Kony.component.reference('button', 'sample-button');
 *
 * @param {string} component
 * @param {string} reference
 */
Kony.component.reference(component, reference);

Store

  • create
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.store.create('/users', { active: true }, grid, true, 25);
 *
 * @param {string} url
 * @param {object} extraParams
 * @param {string} component
 * @param {boolean} autoLoad
 * @param {number} pageSize
 */
Kony.store.create(url, extraParams, component, autoLoad, pageSize);
  • tree
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.store.tree('/menus', { userId: 2 }, grid, true, true);
 *
 * @param {string} url
 * @param {object} extraParams
 * @param {string} component
 * @param {boolean} autoLoad
 * @param {boolean} folderSort
 */
Kony.store.tree(url, extraParams, component, autoLoad, folderSort);
  • local
/**
 * * Sample Usage:
 *
 * * @Controller
 * * var employees = [
 * *    { name: 'John Doe' },
 * *    { name: 'Jane Doe' }
 * * ];
 * * Kony.store.local(employees);
 *
 * @param {array} records
 */
Kony.store.local(records);

Grid

  • render
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Name', renderer: Kony.grid.render.default() }
 * *    ]
 * * }
 */
Kony.grid.render.default();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Name', renderer: Kony.grid.render.qTip() }
 * *    ]
 * * }
 */
Kony.grid.render.qTip();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Is Active', renderer: Kony.grid.render.checkColumn() }
 * *    ]
 * * }
 */
Kony.grid.render.checkColumn();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Is Active', renderer: Kony.grid.render.yesNo() }
 * *    ]
 * * }
 */
Kony.grid.render.yesNo();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Loan Balance', renderer: Kony.grid.render.currency() }
 * *    ]
 * * }
 */
Kony.grid.render.currency();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Installment Flat Rate', renderer: Kony.grid.render.accurate() }
 * *    ]
 * * }
 */
Kony.grid.render.accurate();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Birthday', renderer: Kony.grid.render.fullDate() }
 * *    ]
 * * }
 */
Kony.grid.render.fullDate();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Birthday', renderer: Kony.grid.render.ymdDate() }
 * *    ]
 * * }
 */
Kony.grid.render.ymdDate();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Birthday', renderer: Kony.grid.render.dmyDate() }
 * *    ]
 * * }
 */
Kony.grid.render.dmyDate();

/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    columns: [
 * *        { text: 'Birthday', renderer: Kony.grid.render.mdyDate() }
 * *    ]
 * * }
 */
Kony.grid.render.mdyDate();
  • get
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    reference: 'sample-grid'
 * * }
 *
 * * @Controller
 * * Kony.grid.get('sample-grid');
 *
 * @param {string} reference
 */
Kony.grid.get(reference);
  • setup
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    reference: 'sample-button'
 * * }
 *
 * * @Controller
 * * Kony.grid.setup('sample-button', '/users', { active: true });
 *
 * @param {string} reference
 * @param {string} storeUrl
 * @param {object} filters
 */
Kony.grid.setup(reference, storeUrl, filters);
  • clear
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    reference: 'sample-grid'
 * * }
 *
 * * @Controller
 * * Kony.grid.clear('sample-grid');
 *
 * @param {string} reference
 */
Kony.grid.clear(reference);
  • getSelection
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    reference: 'sample-grid'
 * * }
 *
 * * @Controller
 * * Kony.grid.getSelection('sample-grid');
 *
 * @param {string} reference
 */
Kony.grid.getSelection(reference);
  • clearSelection
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    reference: 'sample-grid'
 * * }
 *
 * * @Controller
 * * Kony.grid.clearSelection('sample-grid');
 *
 * @param {string} reference
 */
Kony.grid.clearSelection(reference);
  • getStore
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    reference: 'sample-grid'
 * * }
 *
 * * @Controller
 * * Kony.grid.getStore('sample-grid');
 *
 * @param {string} reference
 */
Kony.grid.getStore(reference);
  • reload
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'grid',
 * *    reference: 'sample-grid'
 * * }
 *
 * * @Controller
 * * Kony.grid.reload('sample-grid');
 *
 * @param {string} reference
 */
Kony.grid.reload(reference);

Combobox

  • get
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'combobox',
 * *    reference: 'sample-combobox'
 * * }
 *
 * * @Controller
 * * Kony.combobox.get('sample-combobox');
 *
 * @param {string} reference
 */
Kony.combobox.get(reference);
  • setup
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'combobox',
 * *    reference: 'sample-combobox'
 * * }
 *
 * * @Controller
 * * Kony.combobox.setup('sample-combobox', '/contries', { region: southeast });
 *
 * @param {string} reference
 * @param {string} storeUrl
 * @param {object} filters
 */
Kony.combobox.setup(reference, storeUrl, filters);
  • getRecordById
/**
 *
 * * @View
 * * {
 * *    xtype: 'combobox',
 * *    reference: 'sample-combobox'
 * * }
 *
 * * @Controller
 * * Sample Usage: Kony.combobox.getRecordById('sample-combobox', 2);
 *
 * @param {string} reference
 * @param {number} id
 */
Kony.combobox.getRecordById(reference, id);

Form

  • get
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'form',
 * *    reference: 'sample-form'
 * * }
 *
 * * @Controller
 * * Kony.form.get('sample-form');
 *
 * @param {string} reference
 */
Kony.form.get(reference);
  • getValues
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'form',
 * *    reference: 'sample-form'
 * * }
 *
 * * @Controller
 * * Kony.form.getValues('sample-form');
 *
 * @param {string} reference
 */
Kony.form.getValues(reference);
  • loadRecord
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'form',
 * *    reference: 'sample-form'
 * * }
 *
 * * @Controller
 * * var employee = {
 * *    data: { name: 'John Doe' }
 * * };
 * * Kony.form.loadRecord('sample-form', employee);
 *
 * @param {string} reference
 * @param {object} record
 */
Kony.form.loadRecord(reference, record);
  • setReadOnly
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'form',
 * *    reference: 'sample-form'
 * * }
 *
 * * @Controller
 * * Kony.form.setReadOnly('sample-form', true);
 *
 * @param {string} reference
 * @param {boolean} isReadOnly
 */
Kony.form.setReadOnly(reference, isReadOnly);
  • clear
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'form',
 * *    reference: 'sample-form'
 * * }
 *
 * * @Controller
 * * Kony.form.clear('sample-form');
 *
 * @param {string} reference
 */
Kony.form.clear(reference);
  • isValid
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'form',
 * *    reference: 'sample-form'
 * * }
 *
 * * @Controller
 * * Kony.form.isValid('sample-form');
 *
 * @param {string} reference
 */
Kony.form.isValid(reference);
  • getInvalidFields
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'form',
 * *    reference: 'sample-form'
 * * }
 *
 * * @Controller
 * * Kony.form.getInvalidFields('sample-form');
 *
 * @param {string} reference
 */
Kony.form.getInvalidFields(reference);

Button

  • get
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'button',
 * *    reference: 'sample-button'
 * * }
 *
 * * @Controller
 * * Kony.button.get('sample-button');
 *
 * @param {string} reference
 */
Kony.button.get(reference);
  • disable
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'button',
 * *    reference: 'sample-button'
 * * }
 *
 * * @Controller
 * * Kony.button.disable('sample-button');
 *
 * @param {string} reference
 */
Kony.button.disable(reference);
  • enable
/**
 * * Sample Usage:
 *
 * * @View
 * * {
 * *    xtype: 'button',
 * *    reference: 'sample-button'
 * * }
 *
 * * @Controller
 * * Kony.button.enable('sample-button');
 *
 * @param {string} reference
 */
Kony.button.enable(reference);

Render

  • default
/**
 * * Sample Usage:
 * * renderer: Kony.render.default(value);
 *
 * @param {*} value
 */
Kony.render.default(value);
  • yesNo
/**
 * * Sample Usage:
 * * renderer: Kony.render.yesNo(value);
 *
 * @param {number} value
 */
Kony.render.yesNo(value);
  • currency
/**
 * * Sample Usage:
 * * renderer: Kony.render.currency(value);
 *
 * @param {number} value
 */
Kony.render.currency(value);
  • accurate
/**
 * * Sample Usage:
 * * renderer: Kony.render.accurate(value);
 *
 * @param {number} value
 */
Kony.render.accurate(value);
  • fullDate
/**
 * * Sample Usage:
 * * renderer: Kony.render.fullDate(value);
 *
 * @param {string|date} value
 */
Kony.render.fullDate(value);
  • ymdDate
/**
 * * Sample Usage:
 * * renderer: Kony.render.ymdDate(value);
 *
 * @param {string|date} value
 */
Kony.render.ymdDate(value);
  • dmyDate
/**
 * * Sample Usage:
 * * renderer: Kony.render.dmyDate(value);
 *
 * @param {string|date} value
 */
Kony.render.dmyDate(value);
  • mdyDate
/**
 * * Sample Usage:
 * * renderer: Kony.render.mdyDate(value);
 *
 * @param {string|date} value
 */
Kony.render.mdyDate(value);
  • formatDate
/**
 * * Sample Usage:
 * * renderer: Kony.render.formatDate(value, 'YYYY');
 *
 * @param {string|date} value
 * @param {string} format
 */
Kony.render.formatDate(value, format);

Ajax

  • request
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.ajax.request('/login', 'POST', { user: john, pass: doe }, function (){}, function (){}, false);
 *
 * @param {string} url
 * @param {string} method
 * @param {object} params
 * @param {function} sucessCallback
 * @param {function} failureCallback
 * @param {boolean} async
 */
Kony.ajax.request(url, method, params, sucessCallback, failureCallback, async);

Url

  • convertObjectToQuery
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.url.convertObjectToQuery({ user: john, pass: doe });
 *
 * @param {object} params
 */
Kony.url.convertObjectToQuery(params);

Task

  • create
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.task.create(function (){});
 *
 * @param {function} callback
 */
Kony.task.create(callback);

Window

  • getHeight
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.window.getHeight();
 */
Kony.window.getHeight();
  • getWidth
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.window.getWidth();
 */
Kony.window.getWidth();

Message

  • custom
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.message.custom('Test', 'test', Ext.Msg.YESNO, Ext.Msg.QUESTION, function (){});
 *
 * @param {string} title
 * @param {string} message
 * @param {class} btn
 * @param {class} icon
 * @param {function} callback
 */
Kony.message.custom(title, message, btn, icon, callback);
  • alert
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.message.alert('test');
 *
 * @param {string} message
 */
Kony.message.alert(message);
  • confirm
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.message.confirm('test', function (){});
 *
 * @param {string} message
 * @param {function} callback
 */
Kony.message.confirm(message, callback);
  • error
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.message.error('test');
 *
 * @param {string} message
 */
Kony.message.error(message);
  • info
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.message.info('test');
 *
 * @param {string} message
 */
Kony.message.info(message);
  • *ask
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.message.ask('test', function (){});
 *
 * @param {string} message
 * @param {function} callback
 */
Kony.message.ask(message, callback);
  • warn
/**
 * * Sample Usage:
 *
 * * @Controller
 * * Kony.message.warn('test');
 *
 * @param {string} message
 */
Kony.message.warn(message);

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Related Projects

You might want to checkout these projects:

  • NchikotaJS - An opensource tech stack composed of ExpressJS, NodeJS, ExtJS.
  • PasserelleJS - An opensource API gateway built with ExpressJS.

Base Contributors

Contributors

Author

Eagan Martin

License

Copyright © 2019, Eagan Martin. Release under the GPL-3.0 License