-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
78 lines (72 loc) · 2.52 KB
/
Copy pathindex.html
File metadata and controls
78 lines (72 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Blinx Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Blinx: Model‑Driven UI</h1>
<div class="card">
<div id="form-container"></div>
<div class="flex">
<button id="btn-prev" class="btn">Previous</button>
<button id="btn-next" class="btn">Next</button>
<span id="record-indicator"></span>
<button id="btn-save" class="btn btn-primary">Save</button>
<button id="btn-reset" class="btn">Reset</button>
<button id="btn-create" class="btn">Create</button>
<button id="btn-delete" class="btn">Delete</button>
<span id="save-status"></span>
</div>
</div>
<div class="card">
<div id="table-container"></div>
<div class="flex">
<button id="tbl-create" class="btn">Create</button>
<button id="tbl-delete-selected" class="btn">Delete Selected</button>
<span id="tbl-status"></span>
</div>
</div>
<script type="module">
import { productModel, productFormView, productTableView, initialDataset } from './model/product.model.js';
import { createBlinxStore } from './lib/blinx.store.js';
import { BlinxDefaultAdapter } from './lib/blinx.adapters.default.js';
import { renderBlinxForm } from './lib/blinx.form.js';
import { renderBlinxTable } from './lib/blinx.table.js';
const store = createBlinxStore(initialDataset, productModel);
const ui = new BlinxDefaultAdapter();
const { formApi } = renderBlinxForm({
root: document.getElementById('form-container'),
view: productFormView,
store,
ui,
recordIndex: 0,
controls: {
saveButtonId: 'btn-save',
resetButtonId: 'btn-reset',
nextButtonId: 'btn-next',
prevButtonId: 'btn-prev',
createButtonId: 'btn-create',
deleteButtonId: 'btn-delete',
recordIndicatorId: 'record-indicator',
saveStatusId: 'save-status',
}
});
const { tableApi } = renderBlinxTable({
root: document.getElementById('table-container'),
view: productTableView,
store,
ui,
pageSize: 10,
onRowClick: (rowIndex) => formApi.setRecordIndex(rowIndex),
controls: {
createButtonId: 'tbl-create',
deleteSelectedButtonId: 'tbl-delete-selected',
statusId: 'tbl-status',
}
});
</script>
</body>
</html>