Last active
January 23, 2022 13:53
-
-
Save Seebiscuit/36de16cd457c5456f6ed7bf04d651090 to your computer and use it in GitHub Desktop.
Replaceale Parts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dumber Gist</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | |
<base href="/"> | |
</head> | |
<!-- | |
Dumber gist uses dumber bundler, the default bundle file | |
is /dist/entry-bundle.js. | |
The starting module is pointed to aurelia-bootstrapper | |
(data-main attribute on script) for Aurelia, | |
The aurelia bootstrapper then loads up user module "main" | |
(aurelia-app attribute on <body>) which is your src/main.js. | |
--> | |
<body aurelia-app="main"> | |
<script src="/dist/entry-bundle.js" data-main="aurelia-bootstrapper"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"aurelia-bootstrapper": "latest" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./table-component.html"></require> | |
<require from="./my-component.html"></require> | |
<h4>Custom template with dynamic part</h4> | |
<table-component columns.bind="appColumns"> | |
<template replace-part="${column}"> | |
<div>From app</div> | |
<strong>${column}</strong> | |
</template> | |
</table-component> | |
<h4>Custom template with default and custom</h4> | |
<table-component columns.bind="appColumns"> | |
<template replace-part="part1"> | |
<div>From app</div> | |
<strong>${column}</strong> | |
</template> | |
</table-component> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./awesome-table.html"></require> | |
<require from="./table-component.html"></require> | |
<require from="./my-component.html"></require> | |
<style> | |
.sans-serif { | |
font-family: sans-serif; | |
} | |
</style> | |
<!-- | |
<awesome-table columns.bind="appColumns"> | |
</awesome-table> | |
--> | |
<awesome-table columns.bind="appColumns"> | |
<!-- <template replace-part="outer-${columnPart}"> --> | |
<th data-app-part="true"> | |
<template | |
replace-part="inner-columns" | |
> | |
<my-component | |
if.bind="columnPart === 'part1'" | |
class="sans-serif" | |
> | |
App Value1 <span style="font-weight:normal;">${columnPart}</span> | |
</my-component> | |
<my-component | |
else | |
> | |
App Value2 <span style="font-weight:normal;">${columnPart}</span> | |
</my-component> | |
</template> | |
</th> | |
<!-- </template> --> | |
<template replace-part="inner"> | |
<em> | |
Column Inner ${columnPart} | |
</em> | |
</template> | |
<template replace-part="content"> | |
<em> | |
Content ${columns} | |
</em> | |
<br> | |
<my-component> | |
<template replace-part="content"> | |
Component Content | |
</template> | |
</my-component> | |
</template> | |
</awesome-table> | |
<!-- | |
<th repeat.for="columnPart of columns" rreplace-part="header">${columnPart.name}</th> | |
--> | |
<hr> | |
<hr> | |
<template replace-part="content"> | |
<div>My component</div> | |
<strong>${columns}</strong> | |
</template> | |
<h4>Default template</h4> | |
<table-component columns.bind="appColumns"></table-component> | |
<hr> | |
<h4>Custom template with dynamic part</h4> | |
<table-component columns.bind="appColumns"> | |
<template replace-part="${column}"> | |
<div>From app</div> | |
<strong>${column}</strong> | |
</template> | |
</table-component> | |
<h4>Custom template with default and custom part</h4> | |
<table-component columns.bind="appColumns"> | |
<template replace-part="part1"> | |
<div>From app</div> | |
<strong>${column}</strong> | |
</template> | |
</table-component> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
appColumns = ['part1', 'part2'] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template bindable="columns"> | |
<h5>Table</h5> | |
<table> | |
<thead> | |
<tr> | |
<th repeat.for="columnPart of columns" replaceable part="outer-${columnPart}"> | |
| | |
<template replaceable part="inner-columns"> | |
Default Value <span style="font-weight:normal;">${columnPart}</span> | |
</template> | |
</th> | |
</tr> | |
</thead> | |
</table> | |
<h5>Element</h5> | |
<template replaceable part="content"> | |
Default Value | |
</template> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging('info'); | |
aurelia.start().then(() => aurelia.setRoot()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<slot> | |
Default Value | |
</slot> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template bindable="columns"> | |
<table> | |
<thead> | |
<th repeat.for="column of columns"> | |
<template replaceable part="columns"> | |
Default Value <span style="font-weight:normal;">${column}</span> | |
</template> | |
</th> | |
</thead> | |
</table> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment