@proyecto-viviana/solid-stately 0.4.1 → 0.5.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/dist/collections/types.d.ts +3 -0
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/collections/ListCollection.ts +9 -1
- package/src/collections/createListState.ts +13 -1
- package/src/collections/types.ts +3 -0
- package/src/combobox/createComboBoxState.ts +18 -3
- package/src/tabs/createTabListState.ts +9 -1
package/dist/index.js
CHANGED
|
@@ -748,7 +748,7 @@ function createListCollection(items, options = {}) {
|
|
|
748
748
|
return o.key ?? o.id ?? index;
|
|
749
749
|
}, getTextValue = (item) => {
|
|
750
750
|
const o = item;
|
|
751
|
-
return o.textValue ?? o.label ?? String(item);
|
|
751
|
+
return o.textValue ?? o.label ?? o.name ?? o.title ?? (item != null && typeof item === "object" ? String(o.key ?? o.id ?? "") : String(item));
|
|
752
752
|
}, getDisabled = (item) => item.isDisabled ?? false } = options;
|
|
753
753
|
return new ListCollection(items.map((item, index) => ({
|
|
754
754
|
type: "item",
|
|
@@ -1448,11 +1448,12 @@ function createListState(props) {
|
|
|
1448
1448
|
const p = getProps();
|
|
1449
1449
|
return new ListCollection((p.items ?? []).map((item, index) => {
|
|
1450
1450
|
const o = item;
|
|
1451
|
+
const key = p.getKey?.(item) ?? o.key ?? o.id ?? index;
|
|
1451
1452
|
return {
|
|
1452
1453
|
type: "item",
|
|
1453
|
-
key
|
|
1454
|
+
key,
|
|
1454
1455
|
value: item,
|
|
1455
|
-
textValue: p.getTextValue?.(item) ?? o.textValue ?? o.label ?? String(item),
|
|
1456
|
+
textValue: p.getTextValue?.(item) ?? o.textValue ?? o.label ?? o.name ?? o.title ?? (item != null && typeof item === "object" ? String(key) : String(item)),
|
|
1456
1457
|
rendered: null,
|
|
1457
1458
|
level: 0,
|
|
1458
1459
|
index,
|
|
@@ -4668,7 +4669,7 @@ function createComboBoxState(props) {
|
|
|
4668
4669
|
const key = selectedKey();
|
|
4669
4670
|
const textValue = (key != null ? originalCollection().getItem(key) : null)?.textValue ?? "";
|
|
4670
4671
|
if (!isInputControlled() || !isSelectionControlled()) {
|
|
4671
|
-
if (key != null && textValue !== inputValue
|
|
4672
|
+
if (key != null && textValue !== untrack(inputValue)) {
|
|
4672
4673
|
setInputValue(textValue);
|
|
4673
4674
|
setLastValue(textValue);
|
|
4674
4675
|
}
|
|
@@ -4849,11 +4850,12 @@ function createTabListState(props) {
|
|
|
4849
4850
|
const p = getProps();
|
|
4850
4851
|
return new ListCollection((p.items ?? []).map((item, index) => {
|
|
4851
4852
|
const o = item;
|
|
4853
|
+
const key = p.getKey?.(item) ?? o.key ?? o.id ?? index;
|
|
4852
4854
|
return {
|
|
4853
4855
|
type: "item",
|
|
4854
|
-
key
|
|
4856
|
+
key,
|
|
4855
4857
|
value: item,
|
|
4856
|
-
textValue: p.getTextValue?.(item) ?? o.textValue ?? o.label ?? String(item),
|
|
4858
|
+
textValue: p.getTextValue?.(item) ?? o.textValue ?? o.label ?? o.name ?? o.title ?? (item != null && typeof item === "object" ? String(key) : String(item)),
|
|
4857
4859
|
rendered: null,
|
|
4858
4860
|
level: 0,
|
|
4859
4861
|
index,
|