1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-16 05:17:19 +02:00
TableFilter/src/register.js

27 lines
668 B
JavaScript
Raw Normal View History

2019-01-22 12:23:36 +01:00
import {defaultsStr} from './settings';
import {toCamelCase} from './string';
2019-02-09 14:27:55 +01:00
import {FEATURES} from './const';
2019-02-06 21:27:52 +01:00
2019-01-22 12:23:36 +01:00
export class Register {
constructor(tf, cls = {}) {
2019-02-09 14:27:55 +01:00
cls.meta = cls.meta || {};
2019-01-22 12:23:36 +01:00
/**
* TableFilter instance
* @type {TableFilter}
*/
this.tf = tf;
/**
2019-02-09 14:27:55 +01:00
* Feature name, retrieved from alternate class name if found or from
* camelised class name as per TableFilter convention
2019-01-22 12:23:36 +01:00
* @type {String}
*/
2019-02-09 14:27:55 +01:00
this.feature = defaultsStr(cls.meta.altName, toCamelCase(cls.name));
2019-01-22 12:23:36 +01:00
2019-02-09 14:27:55 +01:00
cls.meta.name = this.feature;
2019-01-22 12:23:36 +01:00
2019-02-09 14:27:55 +01:00
FEATURES[this.feature] = cls;
2019-01-22 12:23:36 +01:00
2019-02-09 14:27:55 +01:00
}
2019-01-22 12:23:36 +01:00
}