Skip to content

Commit

Permalink
feat: add missing attributes
Browse files Browse the repository at this point in the history
* added bindable gs-item attributes

* added min size example

Co-authored-by: Kobe Wulteputte <kobe.wulteputte@orbid.be>
  • Loading branch information
Kobe-Wulteputte and Kobe Wulteputte committed Oct 4, 2022
1 parent 9924ab9 commit f7a904a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function configure(aurelia: Aurelia) {
<grid-stack-item x="0" y="0" w="2" h="1">
<div class="item">Item1</div>
</grid-stack-item>
<grid-stack-item x="1" y="1" w="2" h="2">
<grid-stack-item x="1" y="1" w="2" h="2" min-w="2" min-h="2">
<div class="item">Item2</div>
</grid-stack-item>
<grid-stack-item x="3" y="2" w="1" h="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,56 @@ export class GridStackItem {
this.root.removeAttribute('gs-h');
}
}

@bindable.number({ defaultBindingMode: bindingMode.twoWay })
minW?: number;
minWChanged() {
if (this.minW !== undefined) {
this.root.setAttribute("gs-min-w", this.minW.toString());
} else {
this.root.removeAttribute("gs-min-w");
}
}

@bindable.number({ defaultBindingMode: bindingMode.twoWay })
minH?: number;
minHChanged() {
if (this.minH !== undefined) {
this.root.setAttribute("gs-min-h", this.minH.toString());
} else {
this.root.removeAttribute("gs-min-h");
}
}

@bindable.number({ defaultBindingMode: bindingMode.twoWay })
maxW?: number;
maxWChanged() {
if (this.maxW !== undefined) {
this.root.setAttribute("gs-max-w", this.maxW.toString());
} else {
this.root.removeAttribute("gs-max-w");
}
}

@bindable.number({ defaultBindingMode: bindingMode.twoWay })
maxH?: number;
maxHChanged() {
if (this.maxH !== undefined) {
this.root.setAttribute("gs-max-h", this.maxH.toString());
} else {
this.root.removeAttribute("gs-max-h");
}
}

@bindable.number({ defaultBindingMode: bindingMode.twoWay })
id?: number;
idChanged() {
if (this.id !== undefined) {
this.root.setAttribute("gs-id", this.id.toString());
} else {
this.root.removeAttribute("gs-id");
}
}

@bindable.booleanAttr
noMove: boolean;
Expand Down

0 comments on commit f7a904a

Please sign in to comment.