Skip to content

Commit 76f8efe

Browse files
committed
Merge branch 'FredericHeem-bau'
2 parents 42fe56a + 2ec64ec commit 76f8efe

File tree

3 files changed

+400
-64
lines changed

3 files changed

+400
-64
lines changed

frameworks/non-keyed/bau/main.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,18 @@ const N = [
6464

6565
let nextId = 1;
6666

67+
const buildLabel = () =>
68+
bau.state(
69+
`${A[random(A.length)]} ${C[random(C.length)]} ${N[random(N.length)]}`
70+
);
71+
6772
const buildData = (count) => {
6873
const data = new Array(count);
6974

7075
for (let i = 0; i < count; i++) {
7176
data[i] = {
7277
id: nextId++,
73-
label: `${A[random(A.length)]} ${C[random(C.length)]} ${
74-
N[random(N.length)]
75-
}`,
78+
label: buildLabel(),
7679
};
7780
}
7881

@@ -99,7 +102,8 @@ const add = () => {
99102
const update = () => {
100103
for (let i = 0; i < dataState.val.length; i += 10) {
101104
const r = dataState.val[i];
102-
dataState.val[i].label = r.label + " !!!";
105+
const label = dataState.val[i].label;
106+
label.val = r.label.val + " !!!";
103107
}
104108
};
105109

@@ -131,12 +135,8 @@ const select = ({ id, event }) => {
131135
const Row = ({ id, label }) =>
132136
tr(
133137
{
134-
class: {
135-
deps: [selectedState],
136-
renderProp: (selected) => (selected == id ? "danger" : ""),
137-
},
138+
class: () => (selectedState.val == id ? "danger" : ""),
138139
},
139-
140140
td({ class: "col-md-1" }, id),
141141
td(
142142
{ class: "col-md-4" },
@@ -208,14 +208,7 @@ const Main = () =>
208208
Jumbotron({}),
209209
table(
210210
{ class: "table table-hover table-striped test-data" },
211-
bau.bind({
212-
deps: [dataState],
213-
render:
214-
({ renderItem }) =>
215-
(arr) =>
216-
tbody(arr.map(renderItem())),
217-
renderItem: () => Row,
218-
}),
211+
bau.loop(dataState, tbody(), Row),
219212
span({
220213
class: "preloadicon glyphicon glyphicon-remove",
221214
"aria-hidden": true,

0 commit comments

Comments
 (0)