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
|
|
|
}
|