@vsn-ux/ngx-gaia 0.10.1 → 0.10.2
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/DOCS.md +24 -0
- package/fesm2022/vsn-ux-ngx-gaia.mjs +17 -4
- package/fesm2022/vsn-ux-ngx-gaia.mjs.map +1 -1
- package/index.d.ts +8 -6
- package/package.json +1 -1
package/DOCS.md
CHANGED
|
@@ -1114,6 +1114,7 @@ Segmented control container component.
|
|
|
1114
1114
|
#### Inputs:
|
|
1115
1115
|
|
|
1116
1116
|
- `selected: any` - Selected value
|
|
1117
|
+
- `compareFn: (o1: any, o2: any) => boolean` - Comparison function for object values (default: `(a, b) => a === b`)
|
|
1117
1118
|
|
|
1118
1119
|
#### Outputs:
|
|
1119
1120
|
|
|
@@ -1164,6 +1165,29 @@ Icon buttons
|
|
|
1164
1165
|
</ga-segmented-control>
|
|
1165
1166
|
```
|
|
1166
1167
|
|
|
1168
|
+
Object values with compareFn
|
|
1169
|
+
|
|
1170
|
+
```html
|
|
1171
|
+
<ga-segmented-control [(selected)]="selectedOption" [compareFn]="compareById">
|
|
1172
|
+
<ga-segmented-control-text-button [value]="options[0]"
|
|
1173
|
+
>{{ options[0].label }}</ga-segmented-control-text-button
|
|
1174
|
+
>
|
|
1175
|
+
<ga-segmented-control-text-button [value]="options[1]"
|
|
1176
|
+
>{{ options[1].label }}</ga-segmented-control-text-button
|
|
1177
|
+
>
|
|
1178
|
+
</ga-segmented-control>
|
|
1179
|
+
```
|
|
1180
|
+
|
|
1181
|
+
```typescript
|
|
1182
|
+
options = [
|
|
1183
|
+
{ id: 1, label: 'Table' },
|
|
1184
|
+
{ id: 2, label: 'List' },
|
|
1185
|
+
];
|
|
1186
|
+
selectedOption = { id: 1, label: 'Table' };
|
|
1187
|
+
compareById = (a: typeOfOption | null, b: typeOfOption | null) =>
|
|
1188
|
+
a?.id === b?.id;
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1167
1191
|
## Select
|
|
1168
1192
|
|
|
1169
1193
|
Select components for dropdown selections with multi-select capabilities. Use for static selects where all options are loaded upfront.
|
|
@@ -1911,9 +1911,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
|
|
|
1911
1911
|
|
|
1912
1912
|
class GaSegmentedControlComponent {
|
|
1913
1913
|
selected = model();
|
|
1914
|
+
compareFn = input((a, b) => a === b);
|
|
1914
1915
|
change = output();
|
|
1916
|
+
safeCompareFn = computed(() => {
|
|
1917
|
+
const compareFn = this.compareFn();
|
|
1918
|
+
return (o1, o2) => {
|
|
1919
|
+
if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {
|
|
1920
|
+
return o1 === o2;
|
|
1921
|
+
}
|
|
1922
|
+
return compareFn(o1, o2);
|
|
1923
|
+
};
|
|
1924
|
+
});
|
|
1915
1925
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1916
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.4", type: GaSegmentedControlComponent, isStandalone: true, selector: "ga-segmented-control", inputs: { selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", change: "change" }, host: { attributes: { "role": "group" }, classAttribute: "ga-segmented-control" }, ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1926
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.4", type: GaSegmentedControlComponent, isStandalone: true, selector: "ga-segmented-control", inputs: { selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, compareFn: { classPropertyName: "compareFn", publicName: "compareFn", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", change: "change" }, host: { attributes: { "role": "group" }, classAttribute: "ga-segmented-control" }, ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1917
1927
|
}
|
|
1918
1928
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaSegmentedControlComponent, decorators: [{
|
|
1919
1929
|
type: Component,
|
|
@@ -1935,9 +1945,12 @@ class GaSegmentedControlButtonDirective {
|
|
|
1935
1945
|
});
|
|
1936
1946
|
value = input();
|
|
1937
1947
|
selected = computed(() => {
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1948
|
+
const value = this.value();
|
|
1949
|
+
const selectedValue = this.group.selected();
|
|
1950
|
+
if (value === undefined || selectedValue === undefined) {
|
|
1951
|
+
return false;
|
|
1952
|
+
}
|
|
1953
|
+
return this.group.safeCompareFn()(selectedValue, value);
|
|
1941
1954
|
});
|
|
1942
1955
|
onClick() {
|
|
1943
1956
|
this.group.selected.set(this.value());
|