@ferchoposting/gridie
Version:
Vue 3 Create tables with ease! Extensible and powerful
52 lines (39 loc) • 763 B
JavaScript
class GridieColumn {
constructor(name, label, type) {
this.column = {
name,
label,
type,
attrs: {},
};
}
get() {
return this.column;
}
format(callback) {
this.column.format = callback;
return this;
}
type(type) {
this.column.type = type;
return this;
}
class(className) {
this.column.attrs.class = className;
return this;
}
attrs(attributes) {
this.column.attrs = attributes;
return this;
}
extend(attributes) {
this.column = {
...this.column,
...attributes,
};
return this;
}
}
export default function (name, label, type = null) {
return new GridieColumn(name, label, type);
}