@cahyo-dimas/freeday 3.25.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/COMPONENTS.md +5 -3
- package/README.id.md +1 -1
- package/README.md +1 -1
- package/adapters/blazor/FdyCascade.razor.cs +22 -0
- package/dist/freeday-cascade.js +28 -0
- package/dist/freeday.js +28 -0
- package/docs/getting-started.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,26 @@ benar. Perubahan seperti itu ditulis di bawah `### Changed: BREAKING (types)`
|
|
|
9
9
|
lama → tipe baru, dan cara menyempitkannya — bukan di bawah `### Added`, betapapun aditifnya dari
|
|
10
10
|
sisi kit.
|
|
11
11
|
|
|
12
|
+
## [3.26.0] - 2026-11-27
|
|
13
|
+
|
|
14
|
+
**Pohon `FdyCascade` Blazor mengikuti host** (`#123`), butir terakhir kelas "nilai dan opsi dari host"
|
|
15
|
+
yang 3.25.0 tutup untuk nilai di enam wrapper dan opsi autocomplete.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- **`FreedayCascade.setNodes(root, tree)`**, dengan pohon `[{ value, label, children }]` yang dibaca
|
|
19
|
+
seperti `<ul>` seed: nilai kosong jatuh ke label, tanpa anak berarti daun. Tampilan kembali ke
|
|
20
|
+
tingkat atas dan jalur nilai terpilih dicari ulang; nilai yang tidak ada di pohon baru menampilkan
|
|
21
|
+
placeholder sampai host menyetel yang ada.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- **`FdyCascade` Blazor mendorong `Nodes` yang berubah sesudah render pertama.** Enhancer menelan
|
|
25
|
+
`<ul>` seed saat init, jadi pohon yang diganti host tidak pernah tampil. Pohon dibandingkan menurut
|
|
26
|
+
isi (kesetaraan record C# membandingkan `Children` per referensi), dan didorong sebelum `Value`,
|
|
27
|
+
supaya nilai yang hanya ada di pohon baru menemukan jalurnya.
|
|
28
|
+
|
|
29
|
+
### Catatan
|
|
30
|
+
- Diuji: 2 bUnit dan 1 uji peramban baru, merah pada kode lama.
|
|
31
|
+
|
|
12
32
|
## [3.25.0] - 2026-11-27
|
|
13
33
|
|
|
14
34
|
**Nilai dari host sampai ke layar, di setiap wrapper Blazor** (`#123`, sisa audit 3.24.0). Wrapper
|
package/COMPONENTS.md
CHANGED
|
@@ -145,9 +145,11 @@ event, so the binding that set it does not hear it back as a pick. `FreedayCombo
|
|
|
145
145
|
`FreedayDatepicker.setValue(root, v)` (`YYYY-MM-DD`, `YYYY-MM` in month mode, `"start/end"` on a
|
|
146
146
|
single-field range), `FreedayDatepicker.setRange(root, from, to)` on a two-picker
|
|
147
147
|
`data-fdy-daterange` root (it relinks the end's minimum as a pick would), `FreedayTimepicker.setValue`,
|
|
148
|
-
`FreedayCascade.setValue
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
`FreedayCascade.setValue` with `FreedayCascade.setNodes(root, tree)` (`[{ value, label, children }]`,
|
|
149
|
+
read as the seed `<ul>` is: an empty value falls back to the label, no children means a leaf), and
|
|
150
|
+
`FreedayAutocomplete.setValue(root, text)` with `FreedayAutocomplete.setOptions(root, labels)`. An
|
|
151
|
+
empty string clears. The Blazor wrappers call these when a bound `Value`, `From`, `To`, `Options` or
|
|
152
|
+
`Nodes` changes after the first render, comparing lists and trees by content; before 3.25.0 only
|
|
151
153
|
`FdyCombo` did, and the others kept showing their first value. The autocomplete also reads its
|
|
152
154
|
options from the list each time it uses them, so options an app renders later are filtered like the
|
|
153
155
|
rest.
|
package/README.id.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> **Lebih banyak _free day_ buat dev. UI kit-nya sudah siap pakai.**
|
|
6
6
|
|
|
7
7
|
[](https://cahyo-dimas.github.io/freeday-ui-kit/)
|
|
8
|
-
[](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.26.0)
|
|
9
9
|
|
|
10
10
|
UI KIT yang token-driven & framework-agnostic. Satu sumber kebenaran untuk warna, tipografi,
|
|
11
11
|
spasi, dan komponen. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> **More free days for devs. The UI kit is ready to use.**
|
|
6
6
|
|
|
7
7
|
[](https://cahyo-dimas.github.io/freeday-ui-kit/)
|
|
8
|
-
[](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.26.0)
|
|
9
9
|
|
|
10
10
|
A token-driven, framework-agnostic UI kit. One source of truth for color, typography,
|
|
11
11
|
spacing, and components. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
|
|
@@ -56,6 +56,21 @@ public partial class FdyCascade
|
|
|
56
56
|
protected override bool ShouldRender() => !Hydrated;
|
|
57
57
|
|
|
58
58
|
private string? _shownValue;
|
|
59
|
+
private IReadOnlyList<FdyCascadeNode> _shownNodes = Array.Empty<FdyCascadeNode>();
|
|
60
|
+
|
|
61
|
+
/// <summary>The same tree by content. Record equality compares <c>Children</c> by reference, so a
|
|
62
|
+
/// host that rebuilds an identical tree on every render would otherwise push it every time.</summary>
|
|
63
|
+
private static bool SameTree(IReadOnlyList<FdyCascadeNode>? a, IReadOnlyList<FdyCascadeNode>? b)
|
|
64
|
+
{
|
|
65
|
+
int countA = a?.Count ?? 0, countB = b?.Count ?? 0;
|
|
66
|
+
if (countA != countB) return false;
|
|
67
|
+
for (int i = 0; i < countA; i++)
|
|
68
|
+
{
|
|
69
|
+
FdyCascadeNode x = a![i], y = b![i];
|
|
70
|
+
if (x.Value != y.Value || x.Label != y.Label || !SameTree(x.Children, y.Children)) return false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
59
74
|
|
|
60
75
|
/* Pushed, not re-rendered: the seed's <ul> is consumed and removed by the enhancer, so this
|
|
61
76
|
component can never render again. */
|
|
@@ -66,8 +81,15 @@ public partial class FdyCascade
|
|
|
66
81
|
if (!Hydrated)
|
|
67
82
|
{
|
|
68
83
|
_shownValue = Value;
|
|
84
|
+
_shownNodes = Nodes;
|
|
69
85
|
return;
|
|
70
86
|
}
|
|
87
|
+
/* The tree before the value, so a value that only exists in the new tree finds its path. */
|
|
88
|
+
if (!SameTree(_shownNodes, Nodes))
|
|
89
|
+
{
|
|
90
|
+
_shownNodes = Nodes;
|
|
91
|
+
await JS.InvokeVoidAsync("FreedayCascade.setNodes", Root, Nodes);
|
|
92
|
+
}
|
|
71
93
|
if (Value != _shownValue)
|
|
72
94
|
{
|
|
73
95
|
_shownValue = Value;
|
package/dist/freeday-cascade.js
CHANGED
|
@@ -42,6 +42,18 @@
|
|
|
42
42
|
});
|
|
43
43
|
return nodes;
|
|
44
44
|
}
|
|
45
|
+
/* A tree from a host, in the shape parse() produces: an empty value falls back to the label, and
|
|
46
|
+
a node with no children (or an empty list) is a leaf. */
|
|
47
|
+
function normalize(list) {
|
|
48
|
+
return (list || []).map(function (n) {
|
|
49
|
+
var label = String(n.label == null ? '' : n.label);
|
|
50
|
+
return {
|
|
51
|
+
label: label,
|
|
52
|
+
value: n.value != null && n.value !== '' ? String(n.value) : label,
|
|
53
|
+
children: n.children && n.children.length ? normalize(n.children) : null
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
45
57
|
// Depth-first search for the stack of labels leading to a leaf value.
|
|
46
58
|
function pathTo(nodes, value, trail) {
|
|
47
59
|
for (var i = 0; i < nodes.length; i++) {
|
|
@@ -334,6 +346,17 @@
|
|
|
334
346
|
wrap.setAttribute('data-value', selectedValue);
|
|
335
347
|
showValue();
|
|
336
348
|
if (!panel.hidden) render();
|
|
349
|
+
},
|
|
350
|
+
/* A new tree from the host. The seed <ul> was consumed at init, so this is the only way a
|
|
351
|
+
render-once host (Blazor) can change the options (#123). The view goes back to the top
|
|
352
|
+
level, and the value's path is looked up again: a value the new tree lacks shows the
|
|
353
|
+
placeholder until the host sets one it has. */
|
|
354
|
+
setNodes: function (tree) {
|
|
355
|
+
root = normalize(tree);
|
|
356
|
+
stack = [];
|
|
357
|
+
current = root;
|
|
358
|
+
showValue();
|
|
359
|
+
if (!panel.hidden) render();
|
|
337
360
|
}
|
|
338
361
|
};
|
|
339
362
|
wrap._fdyCascade = api;
|
|
@@ -364,6 +387,11 @@
|
|
|
364
387
|
setValue: function (root, value) {
|
|
365
388
|
var api = root && root._fdyCascade ? root._fdyCascade : null;
|
|
366
389
|
if (api) api.setValue(value);
|
|
390
|
+
},
|
|
391
|
+
/* The options as a tree, [{ value, label, children }], replacing the one the seed gave. */
|
|
392
|
+
setNodes: function (root, tree) {
|
|
393
|
+
var api = root && root._fdyCascade ? root._fdyCascade : null;
|
|
394
|
+
if (api) api.setNodes(tree);
|
|
367
395
|
}
|
|
368
396
|
};
|
|
369
397
|
})();
|
package/dist/freeday.js
CHANGED
|
@@ -851,6 +851,18 @@
|
|
|
851
851
|
});
|
|
852
852
|
return nodes;
|
|
853
853
|
}
|
|
854
|
+
/* A tree from a host, in the shape parse() produces: an empty value falls back to the label, and
|
|
855
|
+
a node with no children (or an empty list) is a leaf. */
|
|
856
|
+
function normalize(list) {
|
|
857
|
+
return (list || []).map(function (n) {
|
|
858
|
+
var label = String(n.label == null ? '' : n.label);
|
|
859
|
+
return {
|
|
860
|
+
label: label,
|
|
861
|
+
value: n.value != null && n.value !== '' ? String(n.value) : label,
|
|
862
|
+
children: n.children && n.children.length ? normalize(n.children) : null
|
|
863
|
+
};
|
|
864
|
+
});
|
|
865
|
+
}
|
|
854
866
|
// Depth-first search for the stack of labels leading to a leaf value.
|
|
855
867
|
function pathTo(nodes, value, trail) {
|
|
856
868
|
for (var i = 0; i < nodes.length; i++) {
|
|
@@ -1143,6 +1155,17 @@
|
|
|
1143
1155
|
wrap.setAttribute('data-value', selectedValue);
|
|
1144
1156
|
showValue();
|
|
1145
1157
|
if (!panel.hidden) render();
|
|
1158
|
+
},
|
|
1159
|
+
/* A new tree from the host. The seed <ul> was consumed at init, so this is the only way a
|
|
1160
|
+
render-once host (Blazor) can change the options (#123). The view goes back to the top
|
|
1161
|
+
level, and the value's path is looked up again: a value the new tree lacks shows the
|
|
1162
|
+
placeholder until the host sets one it has. */
|
|
1163
|
+
setNodes: function (tree) {
|
|
1164
|
+
root = normalize(tree);
|
|
1165
|
+
stack = [];
|
|
1166
|
+
current = root;
|
|
1167
|
+
showValue();
|
|
1168
|
+
if (!panel.hidden) render();
|
|
1146
1169
|
}
|
|
1147
1170
|
};
|
|
1148
1171
|
wrap._fdyCascade = api;
|
|
@@ -1173,6 +1196,11 @@
|
|
|
1173
1196
|
setValue: function (root, value) {
|
|
1174
1197
|
var api = root && root._fdyCascade ? root._fdyCascade : null;
|
|
1175
1198
|
if (api) api.setValue(value);
|
|
1199
|
+
},
|
|
1200
|
+
/* The options as a tree, [{ value, label, children }], replacing the one the seed gave. */
|
|
1201
|
+
setNodes: function (root, tree) {
|
|
1202
|
+
var api = root && root._fdyCascade ? root._fdyCascade : null;
|
|
1203
|
+
if (api) api.setNodes(tree);
|
|
1176
1204
|
}
|
|
1177
1205
|
};
|
|
1178
1206
|
})();
|
package/docs/getting-started.md
CHANGED
|
@@ -198,7 +198,7 @@ live docs also have a copy button per component.
|
|
|
198
198
|
```bash
|
|
199
199
|
npm i @cahyo-dimas/freeday
|
|
200
200
|
```
|
|
201
|
-
Lands in `package.json` as `"@cahyo-dimas/freeday": "^3.
|
|
201
|
+
Lands in `package.json` as `"@cahyo-dimas/freeday": "^3.26.0"` (public npm package). `dist/` is
|
|
202
202
|
committed and published → no build step; `npm ci` runs without auth.
|
|
203
203
|
|
|
204
204
|
### 2. Import the CSS + enhancers **once** in your entry (`src/main.ts`)
|