@iapps/ng-dhis2-ui 1.2.83 → 1.2.85
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/fesm2022/iapps-ng-dhis2-ui.mjs +127 -260
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/lib/modules/form/components/base-form-field.component.d.ts +5 -4
- package/lib/modules/form/containers/form/form.component.d.ts +10 -9
- package/lib/modules/form/containers/form-field/form-field.component.d.ts +8 -7
- package/lib/modules/form/shared/components/base-form-wrapper.component.d.ts +2 -1
- package/lib/modules/line-list/components/table/tableHeader.d.ts +1 -1
- package/lib/modules/line-list/components/table/tableRow.d.ts +1 -1
- package/lib/modules/line-list/containers/line-list.component.d.ts +1 -1
- package/lib/modules/program-entry-form/program-entry-form.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3330,7 +3330,6 @@ const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setO
|
|
|
3330
3330
|
//date={tempStartDateState || "yyyy-mm-dd"}
|
|
3331
3331
|
clearable: !!tempStartDateState && tempStartDateState !== 'yyyy-mm-dd', date: tempStartDateState || 'yyyy-mm-dd', onDateSelect: (selectedDate) => {
|
|
3332
3332
|
setTempStartDateState(selectedDate.calendarDateString);
|
|
3333
|
-
console.log('selectedDate', selectedDate);
|
|
3334
3333
|
if (selectedDate.calendarDateString === null) {
|
|
3335
3334
|
setStartDateState(selectedDate.calendarDateString);
|
|
3336
3335
|
}
|
|
@@ -3347,7 +3346,6 @@ const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setO
|
|
|
3347
3346
|
handleDateSelect(key, selectedDate);
|
|
3348
3347
|
const filteredFilters = dataQueryFiltersState.filter((f) => f.attribute !== key);
|
|
3349
3348
|
if (selectedDate.calendarDateString === null) {
|
|
3350
|
-
console.log('selectedDate', selectedDate);
|
|
3351
3349
|
setDataQueryFiltersState(filteredFilters);
|
|
3352
3350
|
}
|
|
3353
3351
|
} }));
|
|
@@ -3392,36 +3390,7 @@ const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setO
|
|
|
3392
3390
|
React__default.createElement(Button$1, { onClick: handleSearch }, "Search"),
|
|
3393
3391
|
React__default.createElement(Button$1, { onClick: () => setShowAllFilters(!showAllFilters) }, showAllFilters ? 'Less Filters' : 'More Filters')))));
|
|
3394
3392
|
|
|
3395
|
-
|
|
3396
|
-
// columns,
|
|
3397
|
-
// data,
|
|
3398
|
-
// }: {
|
|
3399
|
-
// columns: any[];
|
|
3400
|
-
// data: TableRow;
|
|
3401
|
-
// }) => {
|
|
3402
|
-
// const [checked, setChecked] = useState(false);
|
|
3403
|
-
// const handleCheckboxChange = () => {
|
|
3404
|
-
// const newChecked = !checked;
|
|
3405
|
-
// setChecked(newChecked);
|
|
3406
|
-
// console.log('Header checkbox toggled. Checked:', newChecked);
|
|
3407
|
-
// console.log('Row selected:', data);
|
|
3408
|
-
// };
|
|
3409
|
-
// return (
|
|
3410
|
-
// <TableHead>
|
|
3411
|
-
// <DataTableRow>
|
|
3412
|
-
// <DataTableColumnHeader width="48px">
|
|
3413
|
-
// <Checkbox checked={checked} onChange={handleCheckboxChange} />
|
|
3414
|
-
// </DataTableColumnHeader>
|
|
3415
|
-
// {columns.map((col) => (
|
|
3416
|
-
// <DataTableColumnHeader key={col.key}>
|
|
3417
|
-
// {col.label}
|
|
3418
|
-
// </DataTableColumnHeader>
|
|
3419
|
-
// ))}
|
|
3420
|
-
// </DataTableRow>
|
|
3421
|
-
// </TableHead>
|
|
3422
|
-
// );
|
|
3423
|
-
// };
|
|
3424
|
-
const TableHeader = ({ columns, allSelected, onSelectAll, selectable, showActionButtons }) => {
|
|
3393
|
+
const TableHeader = ({ columns, allSelected, onSelectAll, selectable, showActionButtons, }) => {
|
|
3425
3394
|
const handleCheckboxChange = () => {
|
|
3426
3395
|
onSelectAll(!allSelected);
|
|
3427
3396
|
};
|
|
@@ -3592,62 +3561,7 @@ const TableCell = ({ cell, getTextColorFromBackGround, }) => {
|
|
|
3592
3561
|
React__default.createElement("div", { className: "text-sm text-gray-800" }, cell?.value || '-')));
|
|
3593
3562
|
};
|
|
3594
3563
|
|
|
3595
|
-
|
|
3596
|
-
// row,
|
|
3597
|
-
// columns,
|
|
3598
|
-
// getTextColorFromBackGround,
|
|
3599
|
-
// actionOptions,
|
|
3600
|
-
// actionOptionOrientation,
|
|
3601
|
-
// actionSelected,
|
|
3602
|
-
// }: any) => {
|
|
3603
|
-
// const [isChecked, setIsChecked] = useState(false);
|
|
3604
|
-
// const handleCheckBoxChange = () => {
|
|
3605
|
-
// const newState = !isChecked;
|
|
3606
|
-
// setIsChecked(newState);
|
|
3607
|
-
// console.log('Row selected:', row, 'Checked:', newState);
|
|
3608
|
-
// };
|
|
3609
|
-
// return (
|
|
3610
|
-
// <DataTableRow key={row.index.value}>
|
|
3611
|
-
// <DataTableCell width="48px">
|
|
3612
|
-
// <Checkbox
|
|
3613
|
-
// onChange={handleCheckBoxChange}
|
|
3614
|
-
// value="id_1"
|
|
3615
|
-
// checked={isChecked}
|
|
3616
|
-
// />
|
|
3617
|
-
// </DataTableCell>
|
|
3618
|
-
// {columns.map((col: any) => {
|
|
3619
|
-
// if (col.key === 'actions') {
|
|
3620
|
-
// return (
|
|
3621
|
-
// <DataTableCell key={col.key}>
|
|
3622
|
-
// {actionOptions && (
|
|
3623
|
-
// <DataTableActions
|
|
3624
|
-
// actionOptions={actionOptions}
|
|
3625
|
-
// actionOptionOrientation={actionOptionOrientation}
|
|
3626
|
-
// onClick={(option) => {
|
|
3627
|
-
// const data = row['responseData']?.['value'];
|
|
3628
|
-
// if (option.onClick) option.onClick(data);
|
|
3629
|
-
// actionSelected.emit({
|
|
3630
|
-
// action: option.label,
|
|
3631
|
-
// data,
|
|
3632
|
-
// });
|
|
3633
|
-
// }}
|
|
3634
|
-
// />
|
|
3635
|
-
// )}
|
|
3636
|
-
// </DataTableCell>
|
|
3637
|
-
// );
|
|
3638
|
-
// }
|
|
3639
|
-
// return (
|
|
3640
|
-
// <TableCell
|
|
3641
|
-
// key={col.key}
|
|
3642
|
-
// cell={row[col.key]}
|
|
3643
|
-
// getTextColorFromBackGround={getTextColorFromBackGround}
|
|
3644
|
-
// />
|
|
3645
|
-
// );
|
|
3646
|
-
// })}
|
|
3647
|
-
// </DataTableRow>
|
|
3648
|
-
// );
|
|
3649
|
-
// };
|
|
3650
|
-
const TableRow = ({ row, columns, getTextColorFromBackGround, actionOptions, actionOptionOrientation, actionSelected, isChecked, onToggle, selectable, showActionButtons }) => {
|
|
3564
|
+
const TableRow = ({ row, columns, getTextColorFromBackGround, actionOptions, actionOptionOrientation, actionSelected, isChecked, onToggle, selectable, showActionButtons, }) => {
|
|
3651
3565
|
const handleCheckBoxChange = () => {
|
|
3652
3566
|
onToggle(row);
|
|
3653
3567
|
};
|
|
@@ -6014,6 +5928,7 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6014
5928
|
this.form = model.required();
|
|
6015
5929
|
this.isValid = input();
|
|
6016
5930
|
this.isValueAssigned = input();
|
|
5931
|
+
this.dataId = input();
|
|
6017
5932
|
this.value = model();
|
|
6018
5933
|
this.value$ = toObservable(this.value);
|
|
6019
5934
|
this.isValueAssigned$ = toObservable(this.isValueAssigned);
|
|
@@ -6035,13 +5950,6 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6035
5950
|
this.component = this.InputField;
|
|
6036
5951
|
this.render();
|
|
6037
5952
|
}
|
|
6038
|
-
ngOnChanges(changes) {
|
|
6039
|
-
if (!(changes['field'] || {})?.firstChange) {
|
|
6040
|
-
this.InputField = this.#getInputField();
|
|
6041
|
-
this.component = this.#getInputField();
|
|
6042
|
-
this.render();
|
|
6043
|
-
}
|
|
6044
|
-
}
|
|
6045
5953
|
#getInputField() {
|
|
6046
5954
|
return () => {
|
|
6047
5955
|
const [value, setValue] = useState(this.form().get(this.field().id)?.value ||
|
|
@@ -6053,19 +5961,25 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6053
5961
|
const [recordExistError, setRecordExistError] = useState();
|
|
6054
5962
|
const [checkingUniqueness, setCheckingUniqueness] = useState();
|
|
6055
5963
|
useEffect(() => {
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
5964
|
+
const isAssignedSubscription = this.isValueAssigned$
|
|
5965
|
+
.pipe(filter((isValueAssigned) => isValueAssigned === true))
|
|
5966
|
+
.subscribe({
|
|
5967
|
+
next: () => {
|
|
5968
|
+
const value = this.form().get(this.field().id)?.value ||
|
|
5969
|
+
this.form().get(this.field().key)?.value;
|
|
5970
|
+
setValue(value);
|
|
5971
|
+
setDisabled(true);
|
|
5972
|
+
checkValueUniqueness();
|
|
5973
|
+
},
|
|
5974
|
+
});
|
|
5975
|
+
return () => {
|
|
5976
|
+
isAssignedSubscription.unsubscribe();
|
|
5977
|
+
};
|
|
5978
|
+
}, []);
|
|
6064
5979
|
// TODO: Review error handling as take() has potential to missed any other updated error information
|
|
6065
5980
|
useEffect(() => {
|
|
6066
5981
|
const fieldErrorSubscription = this.fieldError$
|
|
6067
|
-
.pipe(filter((error) => error !== initialError), take(1)
|
|
6068
|
-
)
|
|
5982
|
+
.pipe(filter((error) => error !== initialError), take(1))
|
|
6069
5983
|
.subscribe({
|
|
6070
5984
|
next: (error) => {
|
|
6071
5985
|
setInitialError(error);
|
|
@@ -6075,7 +5989,6 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6075
5989
|
fieldErrorSubscription.unsubscribe();
|
|
6076
5990
|
};
|
|
6077
5991
|
}, [initialError]); // Add initialError as a dependency to avoid stale closures
|
|
6078
|
-
const onChange = (payload) => setSelected(payload.selected);
|
|
6079
5992
|
const arrayValue = useMemo(() => {
|
|
6080
5993
|
if (value && value.length > 0) {
|
|
6081
5994
|
return value.split(',');
|
|
@@ -6097,24 +6010,26 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6097
6010
|
value,
|
|
6098
6011
|
touched,
|
|
6099
6012
|
});
|
|
6013
|
+
const onValueChange = (value) => {
|
|
6014
|
+
this.ngZone.run(() => {
|
|
6015
|
+
(this.form().get(this.field().id) ||
|
|
6016
|
+
this.form().get(this.field().key))?.setValue(value);
|
|
6017
|
+
this.update.emit({
|
|
6018
|
+
form: this.form(),
|
|
6019
|
+
value,
|
|
6020
|
+
});
|
|
6021
|
+
});
|
|
6022
|
+
setValue(value);
|
|
6023
|
+
setTouched(true);
|
|
6024
|
+
};
|
|
6100
6025
|
const checkValueUniqueness = async () => {
|
|
6101
|
-
if (this.field().unique &&
|
|
6026
|
+
if (this.field().unique && value && value.length > 0 && touched) {
|
|
6102
6027
|
setCheckingUniqueness(true);
|
|
6103
6028
|
setRecordExistError(undefined);
|
|
6104
|
-
const d2 = window.d2Web;
|
|
6105
6029
|
try {
|
|
6106
|
-
const
|
|
6107
|
-
.setTrackedEntityType(this.field().trackedEntityType)
|
|
6108
|
-
.setOuMode('ACCESSIBLE')
|
|
6109
|
-
.setFilters([
|
|
6110
|
-
new DataQueryFilter()
|
|
6111
|
-
.setAttribute(this.field().id)
|
|
6112
|
-
.setCondition(DataFilterCondition.Equal)
|
|
6113
|
-
.setValue(value),
|
|
6114
|
-
])
|
|
6115
|
-
.get())?.data;
|
|
6030
|
+
const isDuplicate = await this.searchForDuplicates(value);
|
|
6116
6031
|
setCheckingUniqueness(false);
|
|
6117
|
-
if (
|
|
6032
|
+
if (isDuplicate) {
|
|
6118
6033
|
const customError = `Record with this ${this.label()} is already registered`;
|
|
6119
6034
|
(this.form().controls[this.field().id] ||
|
|
6120
6035
|
this.form().controls[this.field().key])?.setErrors({
|
|
@@ -6133,34 +6048,13 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6133
6048
|
switch (this.field().controlType) {
|
|
6134
6049
|
case 'textarea':
|
|
6135
6050
|
return (React__default.createElement(TextAreaField, { error: hasError, validationText: validationError, inputWidth: this.fieldConfig()?.inputWidth, required: this.field().required, name: this.field().id, disabled: disabled, label: this.label(), rows: 5, placeholder: this.placeholder(), value: value, onChange: (event) => {
|
|
6136
|
-
|
|
6137
|
-
(this.form().get(this.field().id) ||
|
|
6138
|
-
this.form().get(this.field().key))?.setValue(event.value);
|
|
6139
|
-
this.immediateUpdate.emit({
|
|
6140
|
-
form: this.form(),
|
|
6141
|
-
value: event.value,
|
|
6142
|
-
});
|
|
6143
|
-
});
|
|
6144
|
-
setValue(event.value);
|
|
6145
|
-
setTouched(true);
|
|
6051
|
+
onValueChange(event.value);
|
|
6146
6052
|
}, onBlur: () => {
|
|
6147
6053
|
checkValueUniqueness();
|
|
6148
|
-
this.ngZone.run(() => {
|
|
6149
|
-
this.update.emit({ form: this.form(), value });
|
|
6150
|
-
});
|
|
6151
6054
|
} }));
|
|
6152
6055
|
case 'org-unit':
|
|
6153
6056
|
return (React__default.createElement(OrgUnitFormField, { label: this.label(), key: this.field().id, required: this.field().required, disabled: disabled, onSelectOrgUnit: (selectedOrgUnit) => {
|
|
6154
|
-
|
|
6155
|
-
(this.form().get(this.field().id) ||
|
|
6156
|
-
this.form().get(this.field().key))?.setValue(selectedOrgUnit);
|
|
6157
|
-
this.update.emit({
|
|
6158
|
-
form: this.form(),
|
|
6159
|
-
value: selectedOrgUnit,
|
|
6160
|
-
});
|
|
6161
|
-
});
|
|
6162
|
-
setValue(selectedOrgUnit);
|
|
6163
|
-
setTouched(true);
|
|
6057
|
+
onValueChange(selectedOrgUnit);
|
|
6164
6058
|
}, selected: value }));
|
|
6165
6059
|
case 'transfer':
|
|
6166
6060
|
return (React__default.createElement(Transfer, { filterable: true, filterPlaceholder: "Search", selected: selected, leftHeader: React__default.createElement("div", { style: {
|
|
@@ -6170,91 +6064,37 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6170
6064
|
fontSize: 14,
|
|
6171
6065
|
padding: '8px 4px',
|
|
6172
6066
|
} }, this.field().selectedOptionsLabel), options: this.field().options, onChange: (event) => {
|
|
6173
|
-
|
|
6174
|
-
this.ngZone.run(() => {
|
|
6175
|
-
(this.form().get(this.field().id) ||
|
|
6176
|
-
this.form().get(this.field().key))?.setValue(event.selected);
|
|
6177
|
-
});
|
|
6178
|
-
setValue(event.selected);
|
|
6179
|
-
setTouched(true);
|
|
6180
|
-
this.update.emit({ form: this.form(), value });
|
|
6067
|
+
onValueChange(event.selected);
|
|
6181
6068
|
} }));
|
|
6182
6069
|
case 'checkbox':
|
|
6183
6070
|
return (React__default.createElement(Checkbox, { checked: Boolean(value), error: hasError, label: this.label(), name: this.field().id, disabled: disabled, onChange: (event) => {
|
|
6184
|
-
|
|
6185
|
-
(this.form().get(this.field().id) ||
|
|
6186
|
-
this.form().get(this.field().key))?.setValue(event.checked);
|
|
6187
|
-
});
|
|
6188
|
-
setValue(event.checked);
|
|
6189
|
-
setTouched(true);
|
|
6071
|
+
onValueChange(event.checked);
|
|
6190
6072
|
}, onBlur: () => {
|
|
6191
6073
|
checkValueUniqueness();
|
|
6192
|
-
this.ngZone.run(() => {
|
|
6193
|
-
this.update.emit({ form: this.form(), value });
|
|
6194
|
-
});
|
|
6195
6074
|
} }));
|
|
6196
6075
|
case 'dropdown':
|
|
6197
6076
|
return (React__default.createElement(SingleSelectField, { filterable: (this.field().options || []).length > 5, clearable: true, error: hasError, validationText: validationError, inputWidth: this.fieldConfig()?.inputWidth, disabled: disabled, required: this.field().required, className: "select", label: this.label(), selected: value, onChange: (event) => {
|
|
6198
|
-
|
|
6199
|
-
(this.form().get(this.field().id) ||
|
|
6200
|
-
this.form().get(this.field().key))?.setValue(event.selected);
|
|
6201
|
-
this.update.emit({
|
|
6202
|
-
form: this.form(),
|
|
6203
|
-
value: event.selected,
|
|
6204
|
-
});
|
|
6205
|
-
});
|
|
6206
|
-
setValue(event.selected);
|
|
6207
|
-
setTouched(true);
|
|
6077
|
+
onValueChange(event.selected);
|
|
6208
6078
|
}, onBlur: () => {
|
|
6209
6079
|
checkValueUniqueness();
|
|
6210
6080
|
} }, (this.field().options || []).map((option) => (React__default.createElement(SingleSelectOption, { key: crypto.randomUUID() || option.key, label: option.label, value: option.value })))));
|
|
6211
6081
|
case 'multi-dropdown':
|
|
6212
6082
|
return (React__default.createElement(MultiSelectField, { clearText: "Clear", clearable: true, empty: "No data found", filterable: (this.field().options || []).length > 5, filterPlaceholder: "Type to filter options", error: hasError, validationText: validationError, inputWidth: this.fieldConfig()?.inputWidth, disabled: disabled, label: this.label(), required: this.field().required, loadingText: "Loading options", noMatchText: "No options found", onChange: (event) => {
|
|
6213
6083
|
const selectedValue = (event.selected || []).join(',');
|
|
6214
|
-
|
|
6215
|
-
(this.form().get(this.field().id) ||
|
|
6216
|
-
this.form().get(this.field().key))?.setValue(selectedValue);
|
|
6217
|
-
this.update.emit({
|
|
6218
|
-
form: this.form(),
|
|
6219
|
-
value: selectedValue,
|
|
6220
|
-
});
|
|
6221
|
-
});
|
|
6222
|
-
setValue(selectedValue);
|
|
6223
|
-
setTouched(true);
|
|
6084
|
+
onValueChange(selectedValue);
|
|
6224
6085
|
}, onBlur: () => {
|
|
6225
6086
|
checkValueUniqueness();
|
|
6226
6087
|
}, selected: arrayValue }, (this.field().options || []).map((option) => (React__default.createElement(MultiSelectOption, { key: option.key, label: option.label, value: option.value })))));
|
|
6227
6088
|
case 'file':
|
|
6228
6089
|
return (React__default.createElement(React__default.Fragment, null,
|
|
6229
6090
|
React__default.createElement(FileUploadField, { label: this.label(), id: this.field().id, hasError: hasError, required: this.field().required, validationText: validationError, performUpload: true, uploadUrl: 'fileResources', onUploadSuccess: (fileId) => {
|
|
6230
|
-
|
|
6231
|
-
this.form().get(this.field().id) ||
|
|
6232
|
-
this.form().get(this.field().key)?.setValue(fileId);
|
|
6233
|
-
this.update.emit({
|
|
6234
|
-
form: this.form(),
|
|
6235
|
-
value: fileId,
|
|
6236
|
-
});
|
|
6237
|
-
});
|
|
6238
|
-
setValue(fileId);
|
|
6239
|
-
setTouched(true);
|
|
6091
|
+
onValueChange(fileId);
|
|
6240
6092
|
}, extension: this.field()?.extension })));
|
|
6241
6093
|
default:
|
|
6242
6094
|
return (React__default.createElement(InputField$1, { error: hasError, validationText: validationError, type: this.field().type, inputWidth: inputWidth, required: this.field().required, name: this.field().id, label: this.label(), min: this.field().min?.toString(), max: this.field().max?.toString(), placeholder: this.placeholder(), value: value, readOnly: disabled, onChange: (event) => {
|
|
6243
|
-
|
|
6244
|
-
(this.form().get(this.field().id) ||
|
|
6245
|
-
this.form().get(this.field().key))?.setValue(event.value);
|
|
6246
|
-
this.immediateUpdate.emit({
|
|
6247
|
-
form: this.form(),
|
|
6248
|
-
value: event.value,
|
|
6249
|
-
});
|
|
6250
|
-
});
|
|
6251
|
-
setValue(event.value);
|
|
6252
|
-
setTouched(true);
|
|
6095
|
+
onValueChange(event.value);
|
|
6253
6096
|
}, onBlur: () => {
|
|
6254
6097
|
checkValueUniqueness();
|
|
6255
|
-
this.ngZone.run(() => {
|
|
6256
|
-
this.update.emit({ form: this.form(), value });
|
|
6257
|
-
});
|
|
6258
6098
|
} }));
|
|
6259
6099
|
}
|
|
6260
6100
|
};
|
|
@@ -6275,8 +6115,44 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6275
6115
|
onChange(event) {
|
|
6276
6116
|
this.value.set(event);
|
|
6277
6117
|
}
|
|
6118
|
+
async searchForDuplicates(value) {
|
|
6119
|
+
const d2 = window.d2Web;
|
|
6120
|
+
if (!value) {
|
|
6121
|
+
return false;
|
|
6122
|
+
}
|
|
6123
|
+
switch (this.field().metaType) {
|
|
6124
|
+
case 'ATTRIBUTE': {
|
|
6125
|
+
const data = (await d2.trackerModule.trackedEntity
|
|
6126
|
+
.setTrackedEntityType(this.field().trackedEntityType)
|
|
6127
|
+
.setOuMode('ACCESSIBLE')
|
|
6128
|
+
.setFilters([
|
|
6129
|
+
new DataQueryFilter()
|
|
6130
|
+
.setAttribute(this.field().id)
|
|
6131
|
+
.setCondition(DataFilterCondition.Equal)
|
|
6132
|
+
.setValue(value),
|
|
6133
|
+
])
|
|
6134
|
+
.get())?.data;
|
|
6135
|
+
return (data?.filter((trackedEntity) => trackedEntity.trackedEntity !== this.dataId())?.length > 0);
|
|
6136
|
+
}
|
|
6137
|
+
case 'DATA_ELEMENT': {
|
|
6138
|
+
const data = (await d2.eventModule.event
|
|
6139
|
+
.setOuMode('ACCESSIBLE')
|
|
6140
|
+
.setFilters([
|
|
6141
|
+
new DataQueryFilter()
|
|
6142
|
+
.setAttribute(this.field().id)
|
|
6143
|
+
.setCondition(DataFilterCondition.Equal)
|
|
6144
|
+
.setValue(value)
|
|
6145
|
+
.setType('DATA_ELEMENT'),
|
|
6146
|
+
])
|
|
6147
|
+
.get())?.data;
|
|
6148
|
+
return (data?.filter((event) => event.event !== this.dataId())?.length > 0);
|
|
6149
|
+
}
|
|
6150
|
+
default:
|
|
6151
|
+
return false;
|
|
6152
|
+
}
|
|
6153
|
+
}
|
|
6278
6154
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: BaseFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
6279
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.8", type: BaseFormFieldComponent, isStandalone: true, inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, fieldError: { classPropertyName: "fieldError", publicName: "fieldError", isSignal: true, isRequired: false, transformFunction: null }, fieldConfig: { classPropertyName: "fieldConfig", publicName: "fieldConfig", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, isValid: { classPropertyName: "isValid", publicName: "isValid", isSignal: true, isRequired: false, transformFunction: null }, isValueAssigned: { classPropertyName: "isValueAssigned", publicName: "isValueAssigned", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { form: "formChange", value: "valueChange", update: "update", immediateUpdate: "immediateUpdate" }, usesInheritance: true,
|
|
6155
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.8", type: BaseFormFieldComponent, isStandalone: true, inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, fieldError: { classPropertyName: "fieldError", publicName: "fieldError", isSignal: true, isRequired: false, transformFunction: null }, fieldConfig: { classPropertyName: "fieldConfig", publicName: "fieldConfig", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, isValid: { classPropertyName: "isValid", publicName: "isValid", isSignal: true, isRequired: false, transformFunction: null }, isValueAssigned: { classPropertyName: "isValueAssigned", publicName: "isValueAssigned", isSignal: true, isRequired: false, transformFunction: null }, dataId: { classPropertyName: "dataId", publicName: "dataId", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { form: "formChange", value: "valueChange", update: "update", immediateUpdate: "immediateUpdate" }, usesInheritance: true, ngImport: i0 }); }
|
|
6280
6156
|
}
|
|
6281
6157
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: BaseFormFieldComponent, decorators: [{
|
|
6282
6158
|
type: Directive
|
|
@@ -6302,8 +6178,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
|
|
|
6302
6178
|
class FormFieldComponent {
|
|
6303
6179
|
constructor() {
|
|
6304
6180
|
this.field = input.required();
|
|
6181
|
+
this.fieldConfig = input.required();
|
|
6182
|
+
this.isCheckBoxButton = input();
|
|
6183
|
+
this.fieldClass = input('');
|
|
6305
6184
|
this.programRuleActions = input([]);
|
|
6306
|
-
this.
|
|
6185
|
+
this.dataEntities = input({});
|
|
6186
|
+
this.minDate = input();
|
|
6187
|
+
this.maxDate = input(new Date());
|
|
6188
|
+
this.dataId = input();
|
|
6307
6189
|
this.color = 'primary';
|
|
6308
6190
|
this.fieldUpdate = new EventEmitter();
|
|
6309
6191
|
this.immediateFieldUpdate = new EventEmitter();
|
|
@@ -6482,24 +6364,12 @@ class FormFieldComponent {
|
|
|
6482
6364
|
this._runtimeOptions = [...options];
|
|
6483
6365
|
}
|
|
6484
6366
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6485
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.8", type: FormFieldComponent, isStandalone: false, selector: "ng-dhis2-ui-form-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, fieldConfig: { classPropertyName: "fieldConfig", publicName: "fieldConfig", isSignal:
|
|
6367
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.8", type: FormFieldComponent, isStandalone: false, selector: "ng-dhis2-ui-form-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, fieldConfig: { classPropertyName: "fieldConfig", publicName: "fieldConfig", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, isCheckBoxButton: { classPropertyName: "isCheckBoxButton", publicName: "isCheckBoxButton", isSignal: true, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: true, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: true, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, dataId: { classPropertyName: "dataId", publicName: "dataId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fieldUpdate: "fieldUpdate", immediateFieldUpdate: "immediateFieldUpdate", runtimeOptionChange: "runtimeOptionChange" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"field()\" class=\"form-field-item\">\n <ng-dhis2-ui-form-field-item\n [field]=\"field()\"\n [fieldError]=\"runtimeError()\"\n [isValueAssigned]=\"isValueAssigned()\"\n [fieldConfig]=\"fieldConfig()\"\n [(form)]=\"form\"\n [dataId]=\"dataId()\"\n [value]=\"value()\"\n (update)=\"onValueChange()\"\n (immediateUpdate)=\"onImmediateChange($event)\"\n />\n</div>\n", styles: [".form-field-item{margin-bottom:16px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormFieldItemComponent, selector: "ng-dhis2-ui-form-field-item" }] }); }
|
|
6486
6368
|
}
|
|
6487
6369
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
6488
6370
|
type: Component,
|
|
6489
|
-
args: [{ selector: 'ng-dhis2-ui-form-field', standalone: false, template: "<div *ngIf=\"field()\" class=\"form-field-item\">\n <ng-dhis2-ui-form-field-item\n [field]=\"field()\"\n [fieldError]=\"runtimeError()\"\n [isValueAssigned]=\"isValueAssigned()\"\n [fieldConfig]=\"fieldConfig\"\n [(form)]=\"form\"\n [value]=\"value()\"\n (update)=\"onValueChange()\"\n (immediateUpdate)=\"onImmediateChange($event)\"\n />\n</div>\n", styles: [".form-field-item{margin-bottom:16px}\n"] }]
|
|
6490
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
6491
|
-
type: Input
|
|
6492
|
-
}], form: [{
|
|
6493
|
-
type: Input
|
|
6494
|
-
}], isCheckBoxButton: [{
|
|
6495
|
-
type: Input
|
|
6496
|
-
}], fieldClass: [{
|
|
6497
|
-
type: Input
|
|
6498
|
-
}], dataEntities: [{
|
|
6499
|
-
type: Input
|
|
6500
|
-
}], minDate: [{
|
|
6501
|
-
type: Input
|
|
6502
|
-
}], maxDate: [{
|
|
6371
|
+
args: [{ selector: 'ng-dhis2-ui-form-field', standalone: false, template: "<div *ngIf=\"field()\" class=\"form-field-item\">\n <ng-dhis2-ui-form-field-item\n [field]=\"field()\"\n [fieldError]=\"runtimeError()\"\n [isValueAssigned]=\"isValueAssigned()\"\n [fieldConfig]=\"fieldConfig()\"\n [(form)]=\"form\"\n [dataId]=\"dataId()\"\n [value]=\"value()\"\n (update)=\"onValueChange()\"\n (immediateUpdate)=\"onImmediateChange($event)\"\n />\n</div>\n", styles: [".form-field-item{margin-bottom:16px}\n"] }]
|
|
6372
|
+
}], ctorParameters: () => [], propDecorators: { form: [{
|
|
6503
6373
|
type: Input
|
|
6504
6374
|
}], fieldUpdate: [{
|
|
6505
6375
|
type: Output
|
|
@@ -6511,7 +6381,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
|
|
|
6511
6381
|
|
|
6512
6382
|
class FormComponent {
|
|
6513
6383
|
get sanitizedFields() {
|
|
6514
|
-
return (this.fields || []).filter((field) => {
|
|
6384
|
+
return (this.fields() || []).filter((field) => {
|
|
6515
6385
|
if (field.hidden) {
|
|
6516
6386
|
return false;
|
|
6517
6387
|
}
|
|
@@ -6533,7 +6403,7 @@ class FormComponent {
|
|
|
6533
6403
|
});
|
|
6534
6404
|
}
|
|
6535
6405
|
get layoutCssClass() {
|
|
6536
|
-
if (!this.isFormHorizontal) {
|
|
6406
|
+
if (!this.isFormHorizontal()) {
|
|
6537
6407
|
return 'col-12';
|
|
6538
6408
|
}
|
|
6539
6409
|
const numberOfFields = this.sanitizedFields.length;
|
|
@@ -6547,11 +6417,20 @@ class FormComponent {
|
|
|
6547
6417
|
}
|
|
6548
6418
|
constructor() {
|
|
6549
6419
|
this.formConfig = input();
|
|
6420
|
+
this.fields = input.required();
|
|
6421
|
+
this.form = input.required();
|
|
6422
|
+
this.isFormHorizontal = input(false);
|
|
6423
|
+
this.showSaveButton = input(false);
|
|
6424
|
+
this.fieldsData = input();
|
|
6425
|
+
this.fieldClass = input('');
|
|
6426
|
+
this.shouldRenderAsCheckBoxesButton = input(false);
|
|
6550
6427
|
this.programRuleActions = input([]);
|
|
6428
|
+
this.dataEntities = input(undefined);
|
|
6429
|
+
this.dataId = input();
|
|
6551
6430
|
this.configuration = computed(() => {
|
|
6552
6431
|
if (!this.formConfig()) {
|
|
6553
6432
|
return new FormConfig({
|
|
6554
|
-
direction: this.isFormHorizontal ? 'horizontal' : 'vertical',
|
|
6433
|
+
direction: this.isFormHorizontal() ? 'horizontal' : 'vertical',
|
|
6555
6434
|
});
|
|
6556
6435
|
}
|
|
6557
6436
|
return this.formConfig();
|
|
@@ -6562,18 +6441,19 @@ class FormComponent {
|
|
|
6562
6441
|
});
|
|
6563
6442
|
}
|
|
6564
6443
|
ngOnChanges(changes) {
|
|
6565
|
-
this.values = this.form.getRawValue();
|
|
6444
|
+
this.values = this.form().getRawValue();
|
|
6566
6445
|
}
|
|
6567
6446
|
#processRules(ruleActions) {
|
|
6568
6447
|
ruleActions.forEach((ruleAction) => {
|
|
6569
6448
|
switch (ruleAction.actionType) {
|
|
6570
6449
|
case 'HIDEFIELD': {
|
|
6571
|
-
const fieldToRemove = this.fields.find((field) => field.id === ruleAction.field);
|
|
6450
|
+
const fieldToRemove = this.fields().find((field) => field.id === ruleAction.field);
|
|
6572
6451
|
if (fieldToRemove) {
|
|
6573
|
-
const
|
|
6452
|
+
const form = this.form();
|
|
6453
|
+
const currentValue = form.get(fieldToRemove.key)?.value;
|
|
6574
6454
|
if (currentValue != null) {
|
|
6575
|
-
|
|
6576
|
-
this.onFieldUpdate(
|
|
6455
|
+
form.get(fieldToRemove.key)?.setValue(null);
|
|
6456
|
+
this.onFieldUpdate(form, fieldToRemove);
|
|
6577
6457
|
}
|
|
6578
6458
|
}
|
|
6579
6459
|
break;
|
|
@@ -6584,24 +6464,24 @@ class FormComponent {
|
|
|
6584
6464
|
});
|
|
6585
6465
|
}
|
|
6586
6466
|
onSubmit() {
|
|
6587
|
-
this.formUpdate.emit(this.form.getRawValue());
|
|
6467
|
+
this.formUpdate.emit(this.form().getRawValue());
|
|
6588
6468
|
}
|
|
6589
6469
|
onFieldUpdate(form, field) {
|
|
6590
|
-
if (!this.showSaveButton && form) {
|
|
6591
|
-
this.formUpdate.emit(new FormValue(this.form, this.fields, field));
|
|
6470
|
+
if (!this.showSaveButton() && form) {
|
|
6471
|
+
this.formUpdate.emit(new FormValue(this.form(), this.fields(), field));
|
|
6592
6472
|
this.values = form.getRawValue();
|
|
6593
6473
|
}
|
|
6594
6474
|
}
|
|
6595
6475
|
onClear() {
|
|
6596
|
-
this.form.reset();
|
|
6476
|
+
this.form().reset();
|
|
6597
6477
|
}
|
|
6598
6478
|
isFormInValid() {
|
|
6599
|
-
return this.form.invalid;
|
|
6479
|
+
return this.form().invalid;
|
|
6600
6480
|
}
|
|
6601
6481
|
onRunTimeOptionUpdate(result) {
|
|
6602
6482
|
if (this.fieldComponents) {
|
|
6603
6483
|
const fieldToUpdate = this.fieldComponents.find((fieldComponent) => fieldComponent?.field()?.dependentField?.id === result?.field?.id);
|
|
6604
|
-
const parentOption = result?.options.find((option) => option.code === this.form?.value[result?.field?.id]);
|
|
6484
|
+
const parentOption = result?.options.find((option) => option.code === this.form()?.value[result?.field?.id]);
|
|
6605
6485
|
fieldToUpdate?.onUpdateRuntimeOptions(parentOption?.options || []);
|
|
6606
6486
|
}
|
|
6607
6487
|
}
|
|
@@ -6609,28 +6489,12 @@ class FormComponent {
|
|
|
6609
6489
|
this.ruleProcessor.destroy();
|
|
6610
6490
|
}
|
|
6611
6491
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6612
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.8", type: FormComponent, isStandalone: false, selector: "ng-dhis2-ui-form", inputs: { formConfig: { classPropertyName: "formConfig", publicName: "formConfig", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal:
|
|
6492
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.8", type: FormComponent, isStandalone: false, selector: "ng-dhis2-ui-form", inputs: { formConfig: { classPropertyName: "formConfig", publicName: "formConfig", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, isFormHorizontal: { classPropertyName: "isFormHorizontal", publicName: "isFormHorizontal", isSignal: true, isRequired: false, transformFunction: null }, showSaveButton: { classPropertyName: "showSaveButton", publicName: "showSaveButton", isSignal: true, isRequired: false, transformFunction: null }, fieldsData: { classPropertyName: "fieldsData", publicName: "fieldsData", isSignal: true, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: true, isRequired: false, transformFunction: null }, shouldRenderAsCheckBoxesButton: { classPropertyName: "shouldRenderAsCheckBoxesButton", publicName: "shouldRenderAsCheckBoxesButton", isSignal: true, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: true, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: true, isRequired: false, transformFunction: null }, dataId: { classPropertyName: "dataId", publicName: "dataId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formUpdate: "formUpdate" }, viewQueries: [{ propertyName: "fieldComponents", predicate: FormFieldComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"form()\" class=\"{{ configuration().directionClassName }}\">\n <!-- form name -->\n <div class=\"form-name\">\n <h2>{{ configuration().formName }}</h2>\n </div>\n <div\n *ngFor=\"let field of sanitizedFields\"\n class=\"form-field-{{ configuration().direction }}\"\n >\n <ng-dhis2-ui-form-field\n [field]=\"field\"\n [fieldConfig]=\"configuration().fieldConfig\"\n [form]=\"form()\"\n [fieldClass]=\"fieldClass()\"\n [dataEntities]=\"dataEntities()\"\n [dataId]=\"dataId()\"\n [programRuleActions]=\"programRuleActions()\"\n [isCheckBoxButton]=\"shouldRenderAsCheckBoxesButton()\"\n (fieldUpdate)=\"onFieldUpdate($event, field)\"\n (runtimeOptionChange)=\"onRunTimeOptionUpdate($event)\"\n />\n </div>\n</form>\n", styles: [".form-horizontal{display:flex;flex-wrap:wrap;gap:16px;width:100%}.hidden-field{display:none}.units-and-ranges span{margin-left:1%;font-weight:600}.for-warning{margin-left:8px}.form-field-vertical{margin-bottom:8px}.form-field-horizontal{flex:1;margin-bottom:8px;width:100%}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: FormFieldComponent, selector: "ng-dhis2-ui-form-field", inputs: ["field", "fieldConfig", "form", "isCheckBoxButton", "fieldClass", "programRuleActions", "dataEntities", "minDate", "maxDate", "dataId"], outputs: ["fieldUpdate", "immediateFieldUpdate", "runtimeOptionChange"] }] }); }
|
|
6613
6493
|
}
|
|
6614
6494
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FormComponent, decorators: [{
|
|
6615
6495
|
type: Component,
|
|
6616
|
-
args: [{ selector: 'ng-dhis2-ui-form', standalone: false, template: "<form [formGroup]=\"form\" class=\"{{ configuration().directionClassName }}\">\n <!-- form name -->\n <div class=\"form-name\">\n <h2>{{ configuration().formName }}</h2>\n </div>\n <div\n *ngFor=\"let field of sanitizedFields\"\n class=\"form-field-{{ configuration().direction }}\"\n >\n <ng-dhis2-ui-form-field\n [field]=\"field\"\n [fieldConfig]=\"configuration().fieldConfig\"\n [form]=\"form\"\n [fieldClass]=\"fieldClass\"\n [dataEntities]=\"dataEntities\"\n [programRuleActions]=\"programRuleActions()\"\n [isCheckBoxButton]=\"shouldRenderAsCheckBoxesButton\"\n (fieldUpdate)=\"onFieldUpdate($event, field)\"\n (runtimeOptionChange)=\"onRunTimeOptionUpdate($event)\"\n />\n </div>\n</form>\n", styles: [".form-horizontal{display:flex;flex-wrap:wrap;gap:16px;width:100%}.hidden-field{display:none}.units-and-ranges span{margin-left:1%;font-weight:600}.for-warning{margin-left:8px}.form-field-vertical{margin-bottom:8px}.form-field-horizontal{flex:1;margin-bottom:8px;width:100%}\n"] }]
|
|
6617
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
6618
|
-
type: Input
|
|
6619
|
-
}], form: [{
|
|
6620
|
-
type: Input
|
|
6621
|
-
}], isFormHorizontal: [{
|
|
6622
|
-
type: Input
|
|
6623
|
-
}], showSaveButton: [{
|
|
6624
|
-
type: Input
|
|
6625
|
-
}], fieldsData: [{
|
|
6626
|
-
type: Input
|
|
6627
|
-
}], fieldClass: [{
|
|
6628
|
-
type: Input
|
|
6629
|
-
}], shouldRenderAsCheckBoxesButton: [{
|
|
6630
|
-
type: Input
|
|
6631
|
-
}], dataEntities: [{
|
|
6632
|
-
type: Input
|
|
6633
|
-
}], formUpdate: [{
|
|
6496
|
+
args: [{ selector: 'ng-dhis2-ui-form', standalone: false, template: "<form [formGroup]=\"form()\" class=\"{{ configuration().directionClassName }}\">\n <!-- form name -->\n <div class=\"form-name\">\n <h2>{{ configuration().formName }}</h2>\n </div>\n <div\n *ngFor=\"let field of sanitizedFields\"\n class=\"form-field-{{ configuration().direction }}\"\n >\n <ng-dhis2-ui-form-field\n [field]=\"field\"\n [fieldConfig]=\"configuration().fieldConfig\"\n [form]=\"form()\"\n [fieldClass]=\"fieldClass()\"\n [dataEntities]=\"dataEntities()\"\n [dataId]=\"dataId()\"\n [programRuleActions]=\"programRuleActions()\"\n [isCheckBoxButton]=\"shouldRenderAsCheckBoxesButton()\"\n (fieldUpdate)=\"onFieldUpdate($event, field)\"\n (runtimeOptionChange)=\"onRunTimeOptionUpdate($event)\"\n />\n </div>\n</form>\n", styles: [".form-horizontal{display:flex;flex-wrap:wrap;gap:16px;width:100%}.hidden-field{display:none}.units-and-ranges span{margin-left:1%;font-weight:600}.for-warning{margin-left:8px}.form-field-vertical{margin-bottom:8px}.form-field-horizontal{flex:1;margin-bottom:8px;width:100%}\n"] }]
|
|
6497
|
+
}], ctorParameters: () => [], propDecorators: { formUpdate: [{
|
|
6634
6498
|
type: Output
|
|
6635
6499
|
}], fieldComponents: [{
|
|
6636
6500
|
type: ViewChildren,
|
|
@@ -6687,7 +6551,7 @@ class RepeatableFormComponent {
|
|
|
6687
6551
|
};
|
|
6688
6552
|
}
|
|
6689
6553
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: RepeatableFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6690
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: RepeatableFormComponent, isStandalone: false, selector: "ng-dhis2-ui-repeatable-form", inputs: { formObject: { classPropertyName: "formObject", publicName: "formObject", isSignal: false, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: false, isRequired: false, transformFunction: null }, fieldGroup: { classPropertyName: "fieldGroup", publicName: "fieldGroup", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, numberOfRows: { classPropertyName: "numberOfRows", publicName: "numberOfRows", isSignal: false, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: false, isRequired: false, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: false, transformFunction: null }, program: { classPropertyName: "program", publicName: "program", isSignal: false, isRequired: false, transformFunction: null }, programStage: { classPropertyName: "programStage", publicName: "programStage", isSignal: false, isRequired: false, transformFunction: null }, repeatDependentField: { classPropertyName: "repeatDependentField", publicName: "repeatDependentField", isSignal: false, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { events: "eventsChange", repeatableStageUpdate: "repeatableStageUpdate" }, ngImport: i0, template: "<div class=\"form__repeatable-stage-container\">\n <!-- <ng-dhis2-ui-wrapper [component]=\"EventTable()\"></ng-dhis2-ui-wrapper> -->\n @if(showForm()) {\n <div class=\"form__repeatable-stage-form\">\n <ng-dhis2-ui-form\n [fields]=\"fieldGroup().fields || []\"\n [form]=\"eventForm\"\n [programRuleActions]=\"programRuleActions\"\n [dataEntities]=\"{}\"\n [isFormHorizontal]=\"false\"\n (formUpdate)=\"onFormUpdate($event)\"\n >\n </ng-dhis2-ui-form>\n\n <!-- <ng-dhis2-ui-wrapper [component]=\"FormActionButtons\"></ng-dhis2-ui-wrapper> -->\n </div>\n }\n</div>\n", styles: [".form__repeatable-stage-container{margin-top:16px}.form__repeatable-stage-form{border:solid 1px rgb(232,237,242);border-top-style:none;background-color:#fff;padding:16px}\n"], dependencies: [{ kind: "component", type: FormComponent, selector: "ng-dhis2-ui-form", inputs: ["formConfig", "fields", "form", "isFormHorizontal", "showSaveButton", "fieldsData", "fieldClass", "shouldRenderAsCheckBoxesButton", "programRuleActions", "dataEntities"], outputs: ["formUpdate"] }] }); }
|
|
6554
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: RepeatableFormComponent, isStandalone: false, selector: "ng-dhis2-ui-repeatable-form", inputs: { formObject: { classPropertyName: "formObject", publicName: "formObject", isSignal: false, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: false, isRequired: false, transformFunction: null }, fieldGroup: { classPropertyName: "fieldGroup", publicName: "fieldGroup", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, numberOfRows: { classPropertyName: "numberOfRows", publicName: "numberOfRows", isSignal: false, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: false, isRequired: false, transformFunction: null }, events: { classPropertyName: "events", publicName: "events", isSignal: true, isRequired: false, transformFunction: null }, program: { classPropertyName: "program", publicName: "program", isSignal: false, isRequired: false, transformFunction: null }, programStage: { classPropertyName: "programStage", publicName: "programStage", isSignal: false, isRequired: false, transformFunction: null }, repeatDependentField: { classPropertyName: "repeatDependentField", publicName: "repeatDependentField", isSignal: false, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { events: "eventsChange", repeatableStageUpdate: "repeatableStageUpdate" }, ngImport: i0, template: "<div class=\"form__repeatable-stage-container\">\n <!-- <ng-dhis2-ui-wrapper [component]=\"EventTable()\"></ng-dhis2-ui-wrapper> -->\n @if(showForm()) {\n <div class=\"form__repeatable-stage-form\">\n <ng-dhis2-ui-form\n [fields]=\"fieldGroup().fields || []\"\n [form]=\"eventForm\"\n [programRuleActions]=\"programRuleActions\"\n [dataEntities]=\"{}\"\n [isFormHorizontal]=\"false\"\n (formUpdate)=\"onFormUpdate($event)\"\n >\n </ng-dhis2-ui-form>\n\n <!-- <ng-dhis2-ui-wrapper [component]=\"FormActionButtons\"></ng-dhis2-ui-wrapper> -->\n </div>\n }\n</div>\n", styles: [".form__repeatable-stage-container{margin-top:16px}.form__repeatable-stage-form{border:solid 1px rgb(232,237,242);border-top-style:none;background-color:#fff;padding:16px}\n"], dependencies: [{ kind: "component", type: FormComponent, selector: "ng-dhis2-ui-form", inputs: ["formConfig", "fields", "form", "isFormHorizontal", "showSaveButton", "fieldsData", "fieldClass", "shouldRenderAsCheckBoxesButton", "programRuleActions", "dataEntities", "dataId"], outputs: ["formUpdate"] }] }); }
|
|
6691
6555
|
}
|
|
6692
6556
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: RepeatableFormComponent, decorators: [{
|
|
6693
6557
|
type: Component,
|
|
@@ -6811,7 +6675,7 @@ class SectionFormComponent {
|
|
|
6811
6675
|
return valueValidity || repeatableDataValidity;
|
|
6812
6676
|
}
|
|
6813
6677
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SectionFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6814
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: SectionFormComponent, isStandalone: false, selector: "ng-dhis2-ui-section-form", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, formMetaData: { classPropertyName: "formMetaData", publicName: "formMetaData", isSignal: true, isRequired: true, transformFunction: null }, dataValueEntities: { classPropertyName: "dataValueEntities", publicName: "dataValueEntities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { save: "save", formUpdate: "formUpdate", cancel: "cancel" }, ngImport: i0, template: "<ng-container *ngIf=\"formMetaData()\">\n <ng-container *ngFor=\"let formSection of formMetaData().sections\">\n @if(formSection?.name; as sectionName) {\n <div class=\"form__section-name\">\n {{ sectionName }}\n </div>\n }\n <div class=\"form__section-content\">\n <ng-container *ngIf=\"formSection\">\n <div *ngFor=\"let fieldGroup of formSection?.fieldGroups\">\n <ng-container *ngIf=\"formGroups[fieldGroup.id] as formGroup\">\n <div\n *ngIf=\"fieldGroup.name && !fieldGroup.repeatableStage\"\n class=\"form__field-group-name\"\n >\n {{ fieldGroup?.name }}\n </div>\n <div *ngIf=\"fieldGroup.fields\">\n <!-- Single stage form section -->\n <ng-container *ngIf=\"!fieldGroup.repeatableStage\">\n <ng-dhis2-ui-form\n *ngIf=\"fieldGroup.fields.length > 0\"\n [fields]=\"fieldGroup.fields\"\n [form]=\"formGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [programRuleActions]=\"ruleActions()\"\n [isFormHorizontal]=\"fieldGroup.isFormHorizontal || false\"\n (formUpdate)=\"onFormUpdate($event, fieldGroup.id)\"\n ></ng-dhis2-ui-form>\n </ng-container>\n\n <!-- Repeatable stage form section -->\n <ng-container *ngIf=\"fieldGroup.repeatableStage\">\n @if(fieldGroup.repeatDependentField) {\n\n <ng-container *ngIf=\"fieldGroup.repeatDependentField\">\n <ng-container\n *ngIf=\"{\n numberOfRows:\n dataValueEntities()[fieldGroup.repeatDependentField]\n } as dataParams\"\n >\n <ng-dhis2-ui-repeatable-form\n *ngIf=\"\n dataParams.numberOfRows &&\n dataParams.numberOfRows !== '0'\n \"\n [fieldGroup]=\"fieldGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [form]=\"formGroup\"\n [program]=\"formSection.program || ''\"\n [programStage]=\"fieldGroup.repeatableStage\"\n [programRuleActions]=\"ruleActions()\"\n [numberOfRows]=\"+dataParams.numberOfRows\"\n [repeatDependentField]=\"\n fieldGroup.repeatDependentField || ''\n \"\n [events]=\"dataValueEntities()[fieldGroup.dataKey!]\"\n (repeatableStageUpdate)=\"\n onUpdateRepeatableStage($event, fieldGroup)\n \"\n ></ng-dhis2-ui-repeatable-form\n ></ng-container>\n </ng-container>\n } @else {\n <ng-dhis2-ui-repeatable-form\n [fieldGroup]=\"fieldGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [form]=\"formGroup\"\n [program]=\"formSection.program || ''\"\n [programStage]=\"fieldGroup.repeatableStage\"\n [programRuleActions]=\"ruleActions()\"\n [numberOfRows]=\"1\"\n [repeatDependentField]=\"fieldGroup.repeatDependentField || ''\"\n [events]=\"dataValueEntities()[fieldGroup.dataKey!]\"\n (repeatableStageUpdate)=\"\n onUpdateRepeatableStage($event, fieldGroup)\n \"\n ></ng-dhis2-ui-repeatable-form>\n }\n </ng-container>\n </div>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</ng-container>\n", styles: [".form__section-name{font-size:16px;font-weight:600;margin-bottom:16px}.form__section-content{margin-bottom:24px}.form__field-group-name{font-size:14px;font-weight:500;padding-bottom:8px;border-bottom:solid 1px rgb(232,237,242);margin-bottom:16px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormComponent, selector: "ng-dhis2-ui-form", inputs: ["formConfig", "fields", "form", "isFormHorizontal", "showSaveButton", "fieldsData", "fieldClass", "shouldRenderAsCheckBoxesButton", "programRuleActions", "dataEntities"], outputs: ["formUpdate"] }, { kind: "component", type: RepeatableFormComponent, selector: "ng-dhis2-ui-repeatable-form", inputs: ["formObject", "formData", "fieldGroup", "form", "numberOfRows", "programRuleActions", "events", "program", "programStage", "repeatDependentField", "dataEntities"], outputs: ["eventsChange", "repeatableStageUpdate"] }] }); }
|
|
6678
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: SectionFormComponent, isStandalone: false, selector: "ng-dhis2-ui-section-form", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, formMetaData: { classPropertyName: "formMetaData", publicName: "formMetaData", isSignal: true, isRequired: true, transformFunction: null }, dataValueEntities: { classPropertyName: "dataValueEntities", publicName: "dataValueEntities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { save: "save", formUpdate: "formUpdate", cancel: "cancel" }, ngImport: i0, template: "<ng-container *ngIf=\"formMetaData()\">\n <ng-container *ngFor=\"let formSection of formMetaData().sections\">\n @if(formSection?.name; as sectionName) {\n <div class=\"form__section-name\">\n {{ sectionName }}\n </div>\n }\n <div class=\"form__section-content\">\n <ng-container *ngIf=\"formSection\">\n <div *ngFor=\"let fieldGroup of formSection?.fieldGroups\">\n <ng-container *ngIf=\"formGroups[fieldGroup.id] as formGroup\">\n <div\n *ngIf=\"fieldGroup.name && !fieldGroup.repeatableStage\"\n class=\"form__field-group-name\"\n >\n {{ fieldGroup?.name }}\n </div>\n <div *ngIf=\"fieldGroup.fields\">\n <!-- Single stage form section -->\n <ng-container *ngIf=\"!fieldGroup.repeatableStage\">\n <ng-dhis2-ui-form\n *ngIf=\"fieldGroup.fields.length > 0\"\n [fields]=\"fieldGroup.fields\"\n [form]=\"formGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [programRuleActions]=\"ruleActions()\"\n [isFormHorizontal]=\"fieldGroup.isFormHorizontal || false\"\n (formUpdate)=\"onFormUpdate($event, fieldGroup.id)\"\n ></ng-dhis2-ui-form>\n </ng-container>\n\n <!-- Repeatable stage form section -->\n <ng-container *ngIf=\"fieldGroup.repeatableStage\">\n @if(fieldGroup.repeatDependentField) {\n\n <ng-container *ngIf=\"fieldGroup.repeatDependentField\">\n <ng-container\n *ngIf=\"{\n numberOfRows:\n dataValueEntities()[fieldGroup.repeatDependentField]\n } as dataParams\"\n >\n <ng-dhis2-ui-repeatable-form\n *ngIf=\"\n dataParams.numberOfRows &&\n dataParams.numberOfRows !== '0'\n \"\n [fieldGroup]=\"fieldGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [form]=\"formGroup\"\n [program]=\"formSection.program || ''\"\n [programStage]=\"fieldGroup.repeatableStage\"\n [programRuleActions]=\"ruleActions()\"\n [numberOfRows]=\"+dataParams.numberOfRows\"\n [repeatDependentField]=\"\n fieldGroup.repeatDependentField || ''\n \"\n [events]=\"dataValueEntities()[fieldGroup.dataKey!]\"\n (repeatableStageUpdate)=\"\n onUpdateRepeatableStage($event, fieldGroup)\n \"\n ></ng-dhis2-ui-repeatable-form\n ></ng-container>\n </ng-container>\n } @else {\n <ng-dhis2-ui-repeatable-form\n [fieldGroup]=\"fieldGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [form]=\"formGroup\"\n [program]=\"formSection.program || ''\"\n [programStage]=\"fieldGroup.repeatableStage\"\n [programRuleActions]=\"ruleActions()\"\n [numberOfRows]=\"1\"\n [repeatDependentField]=\"fieldGroup.repeatDependentField || ''\"\n [events]=\"dataValueEntities()[fieldGroup.dataKey!]\"\n (repeatableStageUpdate)=\"\n onUpdateRepeatableStage($event, fieldGroup)\n \"\n ></ng-dhis2-ui-repeatable-form>\n }\n </ng-container>\n </div>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</ng-container>\n", styles: [".form__section-name{font-size:16px;font-weight:600;margin-bottom:16px}.form__section-content{margin-bottom:24px}.form__field-group-name{font-size:14px;font-weight:500;padding-bottom:8px;border-bottom:solid 1px rgb(232,237,242);margin-bottom:16px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormComponent, selector: "ng-dhis2-ui-form", inputs: ["formConfig", "fields", "form", "isFormHorizontal", "showSaveButton", "fieldsData", "fieldClass", "shouldRenderAsCheckBoxesButton", "programRuleActions", "dataEntities", "dataId"], outputs: ["formUpdate"] }, { kind: "component", type: RepeatableFormComponent, selector: "ng-dhis2-ui-repeatable-form", inputs: ["formObject", "formData", "fieldGroup", "form", "numberOfRows", "programRuleActions", "events", "program", "programStage", "repeatDependentField", "dataEntities"], outputs: ["eventsChange", "repeatableStageUpdate"] }] }); }
|
|
6815
6679
|
}
|
|
6816
6680
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SectionFormComponent, decorators: [{
|
|
6817
6681
|
type: Component,
|
|
@@ -6835,6 +6699,7 @@ class BaseFormWrapperComponent {
|
|
|
6835
6699
|
this.fields = input.required();
|
|
6836
6700
|
this.rules = input([]);
|
|
6837
6701
|
this.dataValues = input({});
|
|
6702
|
+
this.dataId = input();
|
|
6838
6703
|
this.ruleActions = signal([]);
|
|
6839
6704
|
this.isFormValid = signal(true);
|
|
6840
6705
|
this.#updatedDataValues = signal({});
|
|
@@ -6866,7 +6731,7 @@ class BaseFormWrapperComponent {
|
|
|
6866
6731
|
this.ruleProcessor.destroy();
|
|
6867
6732
|
}
|
|
6868
6733
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: BaseFormWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
6869
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.8", type: BaseFormWrapperComponent, isStandalone: true, inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: true, transformFunction: null }, rules: { classPropertyName: "rules", publicName: "rules", isSignal: true, isRequired: false, transformFunction: null }, dataValues: { classPropertyName: "dataValues", publicName: "dataValues", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formSave: "formSave", formUpdate: "formUpdate", formCancel: "formCancel", formValidityUpdate: "formValidityUpdate" }, ngImport: i0 }); }
|
|
6734
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.8", type: BaseFormWrapperComponent, isStandalone: true, inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: true, transformFunction: null }, rules: { classPropertyName: "rules", publicName: "rules", isSignal: true, isRequired: false, transformFunction: null }, dataValues: { classPropertyName: "dataValues", publicName: "dataValues", isSignal: true, isRequired: false, transformFunction: null }, dataId: { classPropertyName: "dataId", publicName: "dataId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formSave: "formSave", formUpdate: "formUpdate", formCancel: "formCancel", formValidityUpdate: "formValidityUpdate" }, ngImport: i0 }); }
|
|
6870
6735
|
}
|
|
6871
6736
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: BaseFormWrapperComponent, decorators: [{
|
|
6872
6737
|
type: Directive
|
|
@@ -6894,16 +6759,15 @@ class FlatFormComponent extends BaseFormWrapperComponent {
|
|
|
6894
6759
|
this.onFormUpdate();
|
|
6895
6760
|
}
|
|
6896
6761
|
onFormUpdate() {
|
|
6897
|
-
console.log('WE ARE UPDATING HERE');
|
|
6898
6762
|
this.updateDataValues(this.formGroup.getRawValue());
|
|
6899
6763
|
this.updateFormValidity(this.formGroup.valid);
|
|
6900
6764
|
}
|
|
6901
6765
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FlatFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
6902
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: FlatFormComponent, isStandalone: false, selector: "ng-dhis2-ui-flat-form", usesInheritance: true, ngImport: i0, template: "<ng-dhis2-ui-form\n [fields]=\"fields()\"\n [form]=\"formGroup\"\n [dataEntities]=\"dataValues()\"\n [programRuleActions]=\"ruleActions()\"\n (formUpdate)=\"onFormUpdate()\"\n/>\n", dependencies: [{ kind: "component", type: FormComponent, selector: "ng-dhis2-ui-form", inputs: ["formConfig", "fields", "form", "isFormHorizontal", "showSaveButton", "fieldsData", "fieldClass", "shouldRenderAsCheckBoxesButton", "programRuleActions", "dataEntities"], outputs: ["formUpdate"] }] }); }
|
|
6766
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: FlatFormComponent, isStandalone: false, selector: "ng-dhis2-ui-flat-form", usesInheritance: true, ngImport: i0, template: "<ng-dhis2-ui-form\n [fields]=\"fields()\"\n [form]=\"formGroup\"\n [dataEntities]=\"dataValues()\"\n [dataId]=\"dataId()\"\n [programRuleActions]=\"ruleActions()\"\n (formUpdate)=\"onFormUpdate()\"\n/>\n", dependencies: [{ kind: "component", type: FormComponent, selector: "ng-dhis2-ui-form", inputs: ["formConfig", "fields", "form", "isFormHorizontal", "showSaveButton", "fieldsData", "fieldClass", "shouldRenderAsCheckBoxesButton", "programRuleActions", "dataEntities", "dataId"], outputs: ["formUpdate"] }] }); }
|
|
6903
6767
|
}
|
|
6904
6768
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FlatFormComponent, decorators: [{
|
|
6905
6769
|
type: Component,
|
|
6906
|
-
args: [{ selector: 'ng-dhis2-ui-flat-form', standalone: false, template: "<ng-dhis2-ui-form\n [fields]=\"fields()\"\n [form]=\"formGroup\"\n [dataEntities]=\"dataValues()\"\n [programRuleActions]=\"ruleActions()\"\n (formUpdate)=\"onFormUpdate()\"\n/>\n" }]
|
|
6770
|
+
args: [{ selector: 'ng-dhis2-ui-flat-form', standalone: false, template: "<ng-dhis2-ui-form\n [fields]=\"fields()\"\n [form]=\"formGroup\"\n [dataEntities]=\"dataValues()\"\n [dataId]=\"dataId()\"\n [programRuleActions]=\"ruleActions()\"\n (formUpdate)=\"onFormUpdate()\"\n/>\n" }]
|
|
6907
6771
|
}] });
|
|
6908
6772
|
|
|
6909
6773
|
class D2FormModule {
|
|
@@ -7801,6 +7665,9 @@ class ProgramEntryFormModule {
|
|
|
7801
7665
|
this.FormLoader = () => {
|
|
7802
7666
|
return React__default.createElement(CircularLoader$1, { small: true });
|
|
7803
7667
|
};
|
|
7668
|
+
this.dataId = computed(() => {
|
|
7669
|
+
return this.instance()?.trackedEntity || this.instance()?.event;
|
|
7670
|
+
});
|
|
7804
7671
|
this.FormActionButtons = computed(() => {
|
|
7805
7672
|
if (this.config().hideActionButtons) {
|
|
7806
7673
|
return React__default.createElement(React__default.Fragment, null);
|
|
@@ -7955,11 +7822,11 @@ class ProgramEntryFormModule {
|
|
|
7955
7822
|
}
|
|
7956
7823
|
}
|
|
7957
7824
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: ProgramEntryFormModule, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7958
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: ProgramEntryFormModule, isStandalone: true, selector: "ng-dhis2-ui-program-entry-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null }, event: { classPropertyName: "event", publicName: "event", isSignal: true, isRequired: false, transformFunction: null }, enrollment: { classPropertyName: "enrollment", publicName: "enrollment", isSignal: true, isRequired: false, transformFunction: null }, orgUnit: { classPropertyName: "orgUnit", publicName: "orgUnit", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { instanceSave: "instanceSave", instanceSaveCompleted: "instanceSaveCompleted", instanceUpdate: "instanceUpdate", formValidityUpdate: "formValidityUpdate", formCancel: "formCancel" }, ngImport: i0, template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n\n <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n />\n }\n\n <!-- SECTION display -->\n @case ('SECTION') { Section form }\n\n <!-- CUSTOM FORM -->\n @case ('CUSTOM') { } }\n\n <!-- Action buttons -->\n\n @if(!config().hideActionButtons) {\n <ng-dhis2-ui-wrapper [component]=\"FormActionButtons()\" />\n }\n</div>\n}\n", styles: ["::ng-deep .program-entry__form-loader{padding:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: D2FormModule }, { kind: "component", type: FlatFormComponent, selector: "ng-dhis2-ui-flat-form" }, { kind: "directive", type: ReactWrapperModule, selector: "ng-dhis2-ui-wrapper", inputs: ["props", "component"] }] }); }
|
|
7825
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: ProgramEntryFormModule, isStandalone: true, selector: "ng-dhis2-ui-program-entry-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null }, event: { classPropertyName: "event", publicName: "event", isSignal: true, isRequired: false, transformFunction: null }, enrollment: { classPropertyName: "enrollment", publicName: "enrollment", isSignal: true, isRequired: false, transformFunction: null }, orgUnit: { classPropertyName: "orgUnit", publicName: "orgUnit", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { instanceSave: "instanceSave", instanceSaveCompleted: "instanceSaveCompleted", instanceUpdate: "instanceUpdate", formValidityUpdate: "formValidityUpdate", formCancel: "formCancel" }, ngImport: i0, template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n\n <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [dataId]=\"dataId()\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n />\n }\n\n <!-- SECTION display -->\n @case ('SECTION') { Section form }\n\n <!-- CUSTOM FORM -->\n @case ('CUSTOM') { } }\n\n <!-- Action buttons -->\n\n @if(!config().hideActionButtons) {\n <ng-dhis2-ui-wrapper [component]=\"FormActionButtons()\" />\n }\n</div>\n}\n", styles: ["::ng-deep .program-entry__form-loader{padding:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: D2FormModule }, { kind: "component", type: FlatFormComponent, selector: "ng-dhis2-ui-flat-form" }, { kind: "directive", type: ReactWrapperModule, selector: "ng-dhis2-ui-wrapper", inputs: ["props", "component"] }] }); }
|
|
7959
7826
|
}
|
|
7960
7827
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: ProgramEntryFormModule, decorators: [{
|
|
7961
7828
|
type: Component,
|
|
7962
|
-
args: [{ selector: 'ng-dhis2-ui-program-entry-form', imports: [CommonModule, D2FormModule, ReactWrapperModule], template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n\n <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n />\n }\n\n <!-- SECTION display -->\n @case ('SECTION') { Section form }\n\n <!-- CUSTOM FORM -->\n @case ('CUSTOM') { } }\n\n <!-- Action buttons -->\n\n @if(!config().hideActionButtons) {\n <ng-dhis2-ui-wrapper [component]=\"FormActionButtons()\" />\n }\n</div>\n}\n", styles: ["::ng-deep .program-entry__form-loader{padding:8px}\n"] }]
|
|
7829
|
+
args: [{ selector: 'ng-dhis2-ui-program-entry-form', imports: [CommonModule, D2FormModule, ReactWrapperModule], template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n\n <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [dataId]=\"dataId()\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n />\n }\n\n <!-- SECTION display -->\n @case ('SECTION') { Section form }\n\n <!-- CUSTOM FORM -->\n @case ('CUSTOM') { } }\n\n <!-- Action buttons -->\n\n @if(!config().hideActionButtons) {\n <ng-dhis2-ui-wrapper [component]=\"FormActionButtons()\" />\n }\n</div>\n}\n", styles: ["::ng-deep .program-entry__form-loader{padding:8px}\n"] }]
|
|
7963
7830
|
}], propDecorators: { instanceSave: [{
|
|
7964
7831
|
type: Output
|
|
7965
7832
|
}], instanceSaveCompleted: [{
|