UNPKG

react-antd-admin-panel

Version:

Easy prototyping admin panel using React and Antd

27 lines 1.1 kB
export default class SelectItem { constructor(key, value, title, text) { var _a; this.propsToAdd = ['id', 'text']; this.key(key); this.value(value !== null && value !== void 0 ? value : key); this.title((_a = title !== null && title !== void 0 ? title : (value && value[0].toUpperCase() + value.substr(1))) !== null && _a !== void 0 ? _a : (key && key[0].toUpperCase() + key.substr(1))); } id(v) { this._id = v; return this; } key(v) { this._key = v; return this; } value(v) { this._value = v; return this; } text(v) { this._text = v; return this; } title(v) { this._title = v; return this; } render(v) { this._render = v; return this; } getObject() { let addProps = {}; // @ts-ignore this.propsToAdd.forEach((r) => { if (this[`_${r}`]) addProps[r] = this[`_${r}`]; }); return (Object.assign({ key: this._key, value: this._value, title: this._title, }, addProps)); } } //# sourceMappingURL=SelectItem.js.map