Skip to content

Commit ba737f0

Browse files
Merge pull request #2493 from ReliefApplications/2.x.x
2.x.x
2 parents 0b19650 + 8750247 commit ba737f0

File tree

6 files changed

+204
-155
lines changed

6 files changed

+204
-155
lines changed

libs/shared/src/lib/components/ui/map/utils/leaflet-heatmap.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ L.HeatLayer = (L.Layer ? L.Layer : L.Class).extend({
139139
if (!this._map) {
140140
return;
141141
}
142+
143+
// Calculate the zoom coefficient to ensure the radius maintains its scale
144+
const scale = this._map.getZoomScale(this._map.getZoom()) / this._map.getZoomScale(2);
145+
this._heat.radius(
146+
this.options.radius * scale || this._heat.defaultRadius * scale,
147+
this.options.blur * scale
148+
);
149+
142150
var data = [],
143151
r = this._heat._r,
144152
size = this._map.getSize(),

libs/ui/documentation.json

Lines changed: 139 additions & 139 deletions
Large diffs are not rendered by default.

libs/ui/src/lib/checkbox/checkbox.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
[checked]="checked"
1010
[indeterminate]="indeterminate"
1111
[ngClass]="checkboxClasses"
12-
class="form-checkbox h-4 w-4 rounded border-gray-300 self-center"
12+
class="form-checkbox h-4 w-4 rounded border-gray-300 self-center disabled:bg-gray-50"
1313
(click)="onSelect()"
14+
[disabled]="disabled"
1415
/>
1516
</span>
1617
<span class="text-sm text-dark-100 font-medium leading-6 flex">

libs/ui/src/lib/checkbox/checkbox.stories.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const Template: StoryFn<CheckboxComponent> = (args: CheckboxComponent) => {
5959
<ng-container ngProjectAs="icon">
6060
<ui-icon
6161
icon="info_outline"
62-
[inline]="true"
6362
[size]="18"
6463
variant="grey"
6564
></ui-icon>

libs/ui/src/lib/form-wrapper/form-wrapper.directive.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,10 @@ export class FormWrapperDirective
284284
this.removeDisableState();
285285
}
286286
// Error state
287-
if (this.control.control.validator) {
288-
if (status === 'INVALID') {
289-
this.setInvalidState();
290-
} else {
291-
this.removeInvalidState();
292-
}
287+
if (status === 'INVALID') {
288+
this.setInvalidState();
289+
} else {
290+
this.removeInvalidState();
293291
}
294292
// Required state
295293
const isRequired = this.control?.control?.hasValidator(

libs/ui/src/lib/form-wrapper/form-wrapper.stories.ts

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { SelectMenuModule } from '../select-menu/select-menu.module';
77
import { AutocompleteModule } from '../autocomplete/autocomplete.module';
88
import { ButtonModule } from '../button/button.module';
99
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
10+
import { StorybookTranslateModule } from '../../storybook-translate.module';
1011

1112
export default {
1213
title: 'Components/Form Wrapper',
@@ -22,6 +23,7 @@ export default {
2223
AutocompleteModule,
2324
ButtonModule,
2425
ReactiveFormsModule,
26+
StorybookTranslateModule,
2527
],
2628
}),
2729
],
@@ -47,18 +49,29 @@ const options = [
4749
];
4850

4951
/** Form group to test story with disable option */
50-
const formControl = new FormGroup({
52+
const formGroup = new FormGroup({
5153
name: new FormControl(''),
5254
});
5355
/** Callback to test story with disable option */
5456
const toggleDisabled = () => {
57+
const formControl = formGroup.controls.name;
5558
if (formControl.disabled) {
5659
formControl.enable();
5760
} else {
5861
formControl.disable();
5962
}
6063
};
6164

65+
/** Callback to set status of form control to invalid */
66+
const toggleInvalid = () => {
67+
const formControl = formGroup.controls.name;
68+
if (formControl.valid) {
69+
formControl.setErrors({ customError: true });
70+
} else {
71+
formControl.setErrors(null);
72+
}
73+
};
74+
6275
/**
6376
* Template to create form wrapper component's story
6477
*
@@ -67,14 +80,26 @@ const toggleDisabled = () => {
6780
*/
6881
const Template: StoryFn<any> = (args: any) => {
6982
return {
70-
template: `<div uiFormFieldDirective [outline]="${args.outline}">
83+
template: `
84+
<div [formGroup]="formGroup">
85+
<div uiFormFieldDirective [outline]="${args.outline}">
7186
<label>Phone Number</label>
72-
<input type="text" name="account-number" id="account-number" placeholder="000-00-0000"/>
87+
<input type="text" name="account-number" id="account-number" placeholder="000-00-0000" formControlName="name"/>
7388
<ui-spinner [size]="'medium'" uiSuffix></ui-spinner>
7489
<ui-icon icon="search" uiPrefix></ui-icon>
75-
</div>`,
90+
</div></div>
91+
<ui-button (click)="toggleDisabled()">
92+
Enable/disabled
93+
</ui-button>
94+
<ui-button (click)="toggleInvalid()">
95+
Valid/Invalid
96+
</ui-button>
97+
`,
7698
props: {
7799
...args,
100+
toggleInvalid,
101+
toggleDisabled,
102+
formGroup,
78103
},
79104
};
80105
};
@@ -87,9 +112,12 @@ const Template: StoryFn<any> = (args: any) => {
87112
*/
88113
const TemplateSelect: StoryFn<any> = (args: any) => {
89114
return {
90-
template: `<div uiFormFieldDirective [outline]="${args.outline}">
115+
template: `
116+
<div [formGroup]="formGroup">
117+
<div uiFormFieldDirective [outline]="${args.outline}">
91118
<label>Choose language</label>
92119
<ui-select-menu
120+
formControlName="name"
93121
[multiselect]="false"
94122
[disabled]="false">
95123
<ui-select-option *ngFor="let option of options" [value]="option">
@@ -98,10 +126,21 @@ const TemplateSelect: StoryFn<any> = (args: any) => {
98126
</ui-select-menu>
99127
<ui-spinner [size]="'medium'" uiSuffix></ui-spinner>
100128
<ui-icon icon="search" uiPrefix></ui-icon>
101-
</div>`,
129+
</div>
130+
</div>
131+
<ui-button (click)="toggleDisabled()">
132+
Enable/disabled
133+
</ui-button>
134+
<ui-button (click)="toggleInvalid()">
135+
Valid/Invalid
136+
</ui-button>
137+
`,
102138
props: {
103139
...args,
104140
options,
141+
toggleInvalid,
142+
toggleDisabled,
143+
formGroup,
105144
},
106145
};
107146
};
@@ -115,7 +154,7 @@ const TemplateSelect: StoryFn<any> = (args: any) => {
115154
const TemplateAutocomplete: StoryFn<any> = (args: any) => {
116155
return {
117156
template: `
118-
<div [formGroup]="formControl">
157+
<div [formGroup]="formGroup">
119158
<div uiFormFieldDirective [outline]="${args.outline}">
120159
<label>Choose language</label>
121160
<input
@@ -143,12 +182,16 @@ const TemplateAutocomplete: StoryFn<any> = (args: any) => {
143182
<ui-button (click)="toggleDisabled()">
144183
Enable/disabled
145184
</ui-button>
185+
<ui-button (click)="toggleInvalid()">
186+
Valid/Invalid
187+
</ui-button>
146188
`,
147189
props: {
148190
...args,
149191
options,
150192
toggleDisabled,
151-
formControl,
193+
toggleInvalid,
194+
formGroup,
152195
},
153196
};
154197
};

0 commit comments

Comments
 (0)