@unicef-polymer/etools-form-builder 4.0.2 → 4.0.3
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/form-fields/repeatable-fields/repeatable-choice-field.d.ts +1 -0
- package/dist/form-fields/repeatable-fields/repeatable-choice-field.js +4 -1
- package/dist/form-fields/single-fields/choice-field.d.ts +2 -0
- package/dist/form-fields/single-fields/choice-field.js +4 -1
- package/dist/form-fields/single-fields/scale-field.d.ts +1 -0
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ export declare class RepeatableChoiceField extends RepeatableBaseField<(string |
|
|
|
10
10
|
protected onToggle(itemValue: string | number, checked: boolean, index: number): void;
|
|
11
11
|
protected getLabel(option: FieldOption | string | number): unknown;
|
|
12
12
|
protected getValue(option: FieldOption | string | number): unknown;
|
|
13
|
+
protected getDisabled(option: FieldOption | string | number): unknown;
|
|
13
14
|
protected customValidation(): string | null;
|
|
14
15
|
static get styles(): CSSResultArray;
|
|
15
16
|
}
|
|
@@ -25,7 +25,7 @@ let RepeatableChoiceField = class RepeatableChoiceField extends RepeatableBaseFi
|
|
|
25
25
|
class="checkbox"
|
|
26
26
|
value="${val}"
|
|
27
27
|
?checked="${checked}"
|
|
28
|
-
?disabled="${this.isReadonly}"
|
|
28
|
+
?disabled="${this.isReadonly || this.getDisabled(option)}"
|
|
29
29
|
@sl-change="${(e) => this.onToggle(val, e.target.checked, index)}"
|
|
30
30
|
>
|
|
31
31
|
${this.getLabel(option)}
|
|
@@ -64,6 +64,9 @@ let RepeatableChoiceField = class RepeatableChoiceField extends RepeatableBaseFi
|
|
|
64
64
|
getValue(option) {
|
|
65
65
|
return typeof option === 'object' ? option.value : option;
|
|
66
66
|
}
|
|
67
|
+
getDisabled(option) {
|
|
68
|
+
return typeof option === 'object' ? option.disabled : false;
|
|
69
|
+
}
|
|
67
70
|
customValidation() {
|
|
68
71
|
return null;
|
|
69
72
|
}
|
|
@@ -5,12 +5,14 @@ import '@unicef-polymer/etools-unicef/src/etools-checkbox/etools-checkbox';
|
|
|
5
5
|
export type ChoiceFieldOption = {
|
|
6
6
|
value: any;
|
|
7
7
|
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare class ChoiceField extends BaseField<(string | number)[] | null> {
|
|
10
11
|
options: (ChoiceFieldOption | string | number)[];
|
|
11
12
|
protected controlTemplate(): TemplateResult;
|
|
12
13
|
protected getLabel(option: ChoiceFieldOption | string | number): unknown;
|
|
13
14
|
protected getValue(option: ChoiceFieldOption | string | number): unknown;
|
|
15
|
+
protected getDisabled(option: ChoiceFieldOption | string | number): unknown;
|
|
14
16
|
protected onToggle(itemValue: string | number, checked: boolean): void;
|
|
15
17
|
protected customValidation(): string | null;
|
|
16
18
|
static get styles(): CSSResultArray;
|
|
@@ -23,7 +23,7 @@ let ChoiceField = class ChoiceField extends BaseField {
|
|
|
23
23
|
class="checkbox"
|
|
24
24
|
value="${val}"
|
|
25
25
|
?checked="${checked}"
|
|
26
|
-
?disabled="${this.isReadonly}"
|
|
26
|
+
?disabled="${this.isReadonly || this.getDisabled(option)}"
|
|
27
27
|
@sl-change="${(e) => this.onToggle(val, e.target.checked)}"
|
|
28
28
|
>
|
|
29
29
|
${this.getLabel(option)}
|
|
@@ -52,6 +52,9 @@ let ChoiceField = class ChoiceField extends BaseField {
|
|
|
52
52
|
getValue(option) {
|
|
53
53
|
return typeof option === 'object' ? option.value : option;
|
|
54
54
|
}
|
|
55
|
+
getDisabled(option) {
|
|
56
|
+
return typeof option === 'object' ? option.disabled : false;
|
|
57
|
+
}
|
|
55
58
|
onToggle(itemValue, checked) {
|
|
56
59
|
this.touched = true;
|
|
57
60
|
let newValue = Array.isArray(this.value) ? [...this.value] : [];
|
|
@@ -6,6 +6,7 @@ import '@unicef-polymer/etools-unicef/src/etools-button/etools-button';
|
|
|
6
6
|
export type FieldOption = {
|
|
7
7
|
value: any;
|
|
8
8
|
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare class ScaleField extends BaseField<string | number | null> {
|
|
11
12
|
options: (FieldOption | string | number)[];
|