@microsoft/teams.cards
Version:
<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=code" ta
110 lines (109 loc) • 2.26 kB
JavaScript
class AreaGridLayout {
type;
/**
* The areas in the grid layout.
*/
areas;
/**
* The columns in the grid layout, defined as a percentage of the available width or in pixels using the <number>px format.
*/
columns;
/**
* The space between columns.
* @default `default`
*/
columnSpacing;
/**
* The space between rows.
* @default `default`
*/
rowSpacing;
/**
* Controls for which card width the layout should be used.
*/
targetWidth;
constructor(...areas) {
this.type = "Layout.AreaGrid";
this.areas = areas;
this.columns = [];
}
static from(options) {
const layout = new AreaGridLayout(...options.areas);
Object.assign(layout, options);
return layout;
}
withColumnSpacing(value) {
this.columnSpacing = value;
return this;
}
withRowSpacing(value) {
this.rowSpacing = value;
return this;
}
withTargetWidth(value) {
this.targetWidth = value;
return this;
}
addAreas(...value) {
this.areas.push(...value);
return this;
}
addColumns(...value) {
this.columns.push(...value);
return this;
}
}
class GridArea {
/**
* The start column index of the area. Column indices start at 1.
* @default 1
*/
column;
/**
* Defines how many columns the area should span.
* @default 1
*/
columnSpan;
/**
* The name of the area. To place an element in this area, set its grid.area property to match the name of the area.
*/
name;
/**
* The start row index of the area. Row indices start at 1.
* @default 1
*/
row;
/**
* Defines how many rows the area should span.
* @default 1
*/
rowSpan;
constructor(value = {}) {
Object.assign(this, value);
}
withColumn(value, span) {
this.column = value;
this.columnSpan = span;
return this;
}
withColumnSpan(value) {
this.columnSpan = value;
return this;
}
withName(value) {
this.name = value;
return this;
}
withRow(value, span) {
this.row = value;
this.rowSpan = span;
return this;
}
withRowSpan(value) {
this.rowSpan = value;
return this;
}
}
export { AreaGridLayout, GridArea };
//# sourceMappingURL=area-grid.mjs.map
//# sourceMappingURL=area-grid.mjs.map