UNPKG

react-antd-admin-panel

Version:

Easy prototyping admin panel using React and Antd

44 lines 1.5 kB
export default class DefaultItem { constructor(r, merge = true) { this.setLoading = () => { }; this._objects = {}; this._editable = false; this._autoFocus = false; this._placeholder = ''; if (!r) return; this.object(r); let ignore = Object.keys(this); if (merge) Object.keys(r).forEach(k => { if (!ignore.includes(k) || k[0] === '_' || ['index', 'key'].includes(k)) { // @ts-ignore this[k] = r[k]; } else { // console.log(`Ignores key ${k} since this will overwrite a ListItem variable.`) } }); } fetch() { this._get.get(this); } onThen(v) { if (this._get) this._get.onThen(v); } onCatch(v) { if (this._get) this._get.onCatch(v); } get(v) { this._get = v; return this; } parent(v) { this._parent = v; return this; } object(v) { this._object = v; return this; } objects(v) { this._objects = v; return this; } render(v) { this._render = v; return this; } section(v) { this._section = v; return this; } editable(v) { this._editable = v ? v : !v; return this; } autoFocus(v) { this._autoFocus = v ? v : !v; return this; } placeholder(v) { this._placeholder = v; return this; } } //# sourceMappingURL=DefaultItem.js.map