@iapps/ng-dhis2-ui 1.1.2 → 1.1.4

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.
@@ -2948,25 +2948,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
2948
2948
  // Use of this source code is governed by a BSD-style
2949
2949
  // license that can be found in the LICENSE file.
2950
2950
 
2951
- const dropdownStyles = {
2951
+ const dropdownStyles$1 = {
2952
2952
  layer: {
2953
2953
  zIndex: '1 !important',
2954
2954
  },
2955
2955
  };
2956
2956
 
2957
2957
  // Helper function to generate a unique class name
2958
- const generateClassName = (base) => `${base}-${Math.random().toString(36).substr(2, 9)}`;
2958
+ const generateClassName$1 = (base) => `${base}-${Math.random().toString(36).substr(2, 9)}`;
2959
2959
  // Helper function to convert camelCased properties to hyphenated CSS properties
2960
- const convertStylesToCSS = (className, styles) => {
2960
+ const convertStylesToCSS$1 = (className, styles) => {
2961
2961
  let cssString = `.${className} {`;
2962
2962
  for (const key in styles) {
2963
2963
  if (typeof styles[key] === "object" && key.startsWith("@media")) {
2964
- const mediaStyles = convertStylesToCSS(className, styles[key]);
2964
+ const mediaStyles = convertStylesToCSS$1(className, styles[key]);
2965
2965
  cssString += `${key} { ${mediaStyles} }`;
2966
2966
  }
2967
2967
  else if (key.startsWith("&:")) {
2968
2968
  const pseudoClass = key.replace("&", "");
2969
- cssString += `${pseudoClass} { ${convertStylesToCSS("", styles[key])} }`;
2969
+ cssString += `${pseudoClass} { ${convertStylesToCSS$1("", styles[key])} }`;
2970
2970
  }
2971
2971
  else {
2972
2972
  const cssKey = key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
@@ -2977,13 +2977,13 @@ const convertStylesToCSS = (className, styles) => {
2977
2977
  return cssString;
2978
2978
  };
2979
2979
  // Custom hook for dynamic styles with generics
2980
- const useDynamicStyles = (stylesObj) => {
2980
+ const useDynamicStyles$1 = (stylesObj) => {
2981
2981
  const [classNames, setClassNames] = useState({});
2982
2982
  useEffect(() => {
2983
2983
  const convertedStyles = Object.keys(stylesObj).map((key) => {
2984
- const className = generateClassName(key);
2984
+ const className = generateClassName$1(key);
2985
2985
  const styleElement = document.createElement("style");
2986
- styleElement.innerHTML = convertStylesToCSS(className, stylesObj[key]);
2986
+ styleElement.innerHTML = convertStylesToCSS$1(className, stylesObj[key]);
2987
2987
  document.head.appendChild(styleElement);
2988
2988
  return {
2989
2989
  key,
@@ -3006,7 +3006,7 @@ const useDynamicStyles = (stylesObj) => {
3006
3006
  return classNames;
3007
3007
  };
3008
3008
 
3009
- const useCurrentModal = () => {
3009
+ const useCurrentModal$1 = () => {
3010
3010
  const [CurrentModal, setCurrentModal] = useState();
3011
3011
  return [
3012
3012
  CurrentModal,
@@ -3017,10 +3017,10 @@ const useCurrentModal = () => {
3017
3017
  },
3018
3018
  ];
3019
3019
  };
3020
- const ContextMenu = (params) => {
3020
+ const ContextMenu$1 = (params) => {
3021
3021
  const { onClose, onMenuClick, anchorRef, dropDownOptions } = params;
3022
- const [CurrentModal, setCurrentModal] = useCurrentModal();
3023
- const styles = useDynamicStyles(dropdownStyles);
3022
+ const [CurrentModal, setCurrentModal] = useCurrentModal$1();
3023
+ const styles = useDynamicStyles$1(dropdownStyles$1);
3024
3024
  return (React__default.createElement(React__default.Fragment, null,
3025
3025
  React__default.createElement(Layer$1, { onBackdropClick: (event, data) => onClose(event, data), className: styles.layer },
3026
3026
  React__default.createElement(Popper, { reference: anchorRef, placement: "bottom-start" },
@@ -3033,13 +3033,13 @@ const ContextMenu = (params) => {
3033
3033
  setCurrentModal(null);
3034
3034
  } }))));
3035
3035
  };
3036
- const DropdownMenu = (props) => {
3036
+ const DropdownMenu$1 = (props) => {
3037
3037
  const ref = useRef();
3038
3038
  const [visible, setVisible] = useState(false);
3039
3039
  const { dropdownOptions, onClick } = props;
3040
3040
  return (React__default.createElement("div", { ref: ref, style: { display: "inline-block" } },
3041
3041
  React__default.createElement(Button$1, { small: true, secondary: true, icon: React__default.createElement(IconMore24, { color: colors$1.grey600 }), onClick: () => setVisible(true) }),
3042
- visible && (React__default.createElement(ContextMenu, { dropDownOptions: dropdownOptions, anchorRef: ref, onClose: () => setVisible(false), onMenuClick: (dropDownOption) => {
3042
+ visible && (React__default.createElement(ContextMenu$1, { dropDownOptions: dropdownOptions, anchorRef: ref, onClose: () => setVisible(false), onMenuClick: (dropDownOption) => {
3043
3043
  onClick(dropDownOption);
3044
3044
  } }))));
3045
3045
  };
@@ -3397,7 +3397,7 @@ class LineListTableComponent extends ReactWrapperModule {
3397
3397
  } }, "Loading"))) : (React__default.createElement(DataTable, null,
3398
3398
  React__default.createElement(TableHead, null,
3399
3399
  React__default.createElement(DataTableRow, null, columns.map((col) => (React__default.createElement(DataTableColumnHeader, { key: col.key }, col.label))))),
3400
- React__default.createElement(TableBody, null, data.map((row) => (React__default.createElement(DataTableRow, { key: row.index }, columns.map((col) => (React__default.createElement(DataTableCell, { key: col.key }, col.key === 'actions' ? (React__default.createElement(DropdownMenu, { dropdownOptions: getDropdownOptions(row), onClick: (option) => option.onClick?.() })) : (row[col.key])))))))),
3400
+ React__default.createElement(TableBody, null, data.map((row) => (React__default.createElement(DataTableRow, { key: row.index }, columns.map((col) => (React__default.createElement(DataTableCell, { key: col.key }, col.key === 'actions' ? (React__default.createElement(DropdownMenu$1, { dropdownOptions: getDropdownOptions(row), onClick: (option) => option.onClick?.() })) : (row[col.key])))))))),
3401
3401
  React__default.createElement(TableFoot, null,
3402
3402
  React__default.createElement(DataTableRow, null,
3403
3403
  React__default.createElement(DataTableCell, { colSpan: columns.length.toString() },
@@ -3484,6 +3484,196 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
3484
3484
  }]
3485
3485
  }] });
3486
3486
 
3487
+ const dropdownStyles = {
3488
+ layer: {
3489
+ zIndex: '1 !important',
3490
+ },
3491
+ };
3492
+
3493
+ // Helper function to generate a unique class name
3494
+ const generateClassName = (base) => `${base}-${Math.random().toString(36).substr(2, 9)}`;
3495
+ // Helper function to convert camelCased properties to hyphenated CSS properties
3496
+ const convertStylesToCSS = (className, styles) => {
3497
+ let cssString = `.${className} {`;
3498
+ for (const key in styles) {
3499
+ if (typeof styles[key] === "object" && key.startsWith("@media")) {
3500
+ const mediaStyles = convertStylesToCSS(className, styles[key]);
3501
+ cssString += `${key} { ${mediaStyles} }`;
3502
+ }
3503
+ else if (key.startsWith("&:")) {
3504
+ const pseudoClass = key.replace("&", "");
3505
+ cssString += `${pseudoClass} { ${convertStylesToCSS("", styles[key])} }`;
3506
+ }
3507
+ else {
3508
+ const cssKey = key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
3509
+ cssString += `${cssKey}: ${styles[key]}; `;
3510
+ }
3511
+ }
3512
+ cssString += "}";
3513
+ return cssString;
3514
+ };
3515
+ // Custom hook for dynamic styles with generics
3516
+ const useDynamicStyles = (stylesObj) => {
3517
+ const [classNames, setClassNames] = useState({});
3518
+ useEffect(() => {
3519
+ const convertedStyles = Object.keys(stylesObj).map((key) => {
3520
+ const className = generateClassName(key);
3521
+ const styleElement = document.createElement("style");
3522
+ styleElement.innerHTML = convertStylesToCSS(className, stylesObj[key]);
3523
+ document.head.appendChild(styleElement);
3524
+ return {
3525
+ key,
3526
+ className,
3527
+ styleElement,
3528
+ };
3529
+ });
3530
+ setClassNames(convertedStyles.reduce((classNameEntity, convertedStyle) => {
3531
+ return {
3532
+ ...classNameEntity,
3533
+ [convertedStyle.key]: convertedStyle.className,
3534
+ };
3535
+ }, {}));
3536
+ return () => {
3537
+ convertedStyles.forEach((convertedStyle) => {
3538
+ document.head.removeChild(convertedStyle.styleElement);
3539
+ });
3540
+ };
3541
+ }, []);
3542
+ return classNames;
3543
+ };
3544
+
3545
+ const useCurrentModal = () => {
3546
+ const [CurrentModal, setCurrentModal] = useState();
3547
+ return [
3548
+ CurrentModal,
3549
+ (Modal) => {
3550
+ // As setState supports functional updates, we can't pass functional
3551
+ // components directly
3552
+ setCurrentModal(() => Modal);
3553
+ },
3554
+ ];
3555
+ };
3556
+ const ContextMenu = (params) => {
3557
+ const { onClose, onMenuClick, anchorRef, dropDownOptions } = params;
3558
+ const [CurrentModal, setCurrentModal] = useCurrentModal();
3559
+ const styles = useDynamicStyles(dropdownStyles);
3560
+ return (React__default.createElement(React__default.Fragment, null,
3561
+ React__default.createElement(Layer$1, { onBackdropClick: (event, data) => onClose(event, data), className: styles.layer },
3562
+ React__default.createElement(Popper, { reference: anchorRef, placement: "bottom-start" },
3563
+ React__default.createElement(FlyoutMenu, null, dropDownOptions.map((dropDownOption, index) => (React__default.createElement(MenuItem$1, { key: index, destructive: dropDownOption.destructive, label: dropDownOption.label, icon: dropDownOption.icon, onClick: () => {
3564
+ onMenuClick(dropDownOption);
3565
+ onClose();
3566
+ }, dense: true })))))),
3567
+ CurrentModal && (React__default.createElement(CurrentModal, { onClose: () => {
3568
+ onClose();
3569
+ setCurrentModal(null);
3570
+ } }))));
3571
+ };
3572
+ const DropdownMenu = (props) => {
3573
+ const ref = useRef();
3574
+ const [visible, setVisible] = useState(false);
3575
+ const { dropdownOptions, onClick } = props;
3576
+ return (React__default.createElement("div", { ref: ref, style: { display: "inline-block" } },
3577
+ React__default.createElement(Button$1, { small: true, secondary: true, icon: React__default.createElement(IconMore24, { color: colors$1.grey600 }), onClick: () => setVisible(true) }),
3578
+ visible && (React__default.createElement(ContextMenu, { dropDownOptions: dropdownOptions, anchorRef: ref, onClose: () => setVisible(false), onMenuClick: (dropDownOption) => {
3579
+ onClick(dropDownOption);
3580
+ } }))));
3581
+ };
3582
+
3583
+ class DataTableUIComponent extends ReactWrapperModule {
3584
+ constructor() {
3585
+ super(...arguments);
3586
+ this.actionSelected = new EventEmitter();
3587
+ this.DataTableUI = () => {
3588
+ const [columns, setColumns] = useState([]);
3589
+ const [tableData, setTableData] = useState([]);
3590
+ useEffect(() => {
3591
+ if (!this.data || !this.columnDefinitions)
3592
+ return;
3593
+ const filteredColumns = this.columnDefinitions.filter((col) => col.visible !== false);
3594
+ const sortedColumns = filteredColumns.sort((a, b) => {
3595
+ const indexA = Number(a.index) || 0;
3596
+ const indexB = Number(b.index) || 0;
3597
+ return indexA - indexB;
3598
+ });
3599
+ setColumns(sortedColumns);
3600
+ setTableData(this.data);
3601
+ }, [this.data, this.columnDefinitions]);
3602
+ const getDropdownOptions = (row) => {
3603
+ return (this.actionOptions || []).map((option) => ({
3604
+ ...option,
3605
+ onClick: () => {
3606
+ // Ensure the onClick is called with the correct context
3607
+ if (option.onClick) {
3608
+ option.onClick(row); // Passing row to the handler
3609
+ }
3610
+ this.actionSelected.emit({ action: option.label, row }); // Emit action and row details
3611
+ },
3612
+ }));
3613
+ };
3614
+ return (React__default.createElement("div", null,
3615
+ React__default.createElement(DataTable, null,
3616
+ React__default.createElement(TableHead, null,
3617
+ React__default.createElement(DataTableRow, null,
3618
+ columns.map((col) => (React__default.createElement(DataTableColumnHeader, { key: col.column }, col.display))),
3619
+ this.actionOptions && this.actionOptions.length > 0 && (React__default.createElement(DataTableColumnHeader, null, "Actions")))),
3620
+ React__default.createElement(TableBody, null, tableData.map((row, rowIndex) => (React__default.createElement(DataTableRow, { key: rowIndex },
3621
+ columns.map((col) => (React__default.createElement(DataTableCell, { key: col.column }, row[col.column] || '-'))),
3622
+ this.actionOptions && this.actionOptions.length > 0 && (React__default.createElement(DataTableCell, null,
3623
+ React__default.createElement(DropdownMenu, { dropdownOptions: getDropdownOptions(row), onClick: (option) => option.onClick?.(row) }))))))),
3624
+ React__default.createElement(TableFoot, null,
3625
+ React__default.createElement(DataTableRow, null,
3626
+ React__default.createElement(DataTableCell, { colSpan: columns.length + 1 }))))));
3627
+ };
3628
+ }
3629
+ async ngAfterViewInit() {
3630
+ if (!this.elementRef)
3631
+ throw new Error('No element ref');
3632
+ this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
3633
+ this.component = this.DataTableUI;
3634
+ this.render();
3635
+ }
3636
+ ngOnChanges(changes) {
3637
+ console.log("THIS IS MORE");
3638
+ if (changes['data'] || changes['columnDefinitions']) {
3639
+ if (!this.elementRef)
3640
+ throw new Error('No element ref');
3641
+ this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
3642
+ this.component = this.DataTableUI;
3643
+ this.render();
3644
+ }
3645
+ }
3646
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: DataTableUIComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
3647
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: DataTableUIComponent, isStandalone: false, selector: "app-data-table-ui", inputs: { data: "data", columnDefinitions: "columnDefinitions", actionOptions: "actionOptions" }, outputs: { actionSelected: "actionSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [""] }); }
3648
+ }
3649
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: DataTableUIComponent, decorators: [{
3650
+ type: Component,
3651
+ args: [{ selector: 'app-data-table-ui', standalone: false, template: '<ng-content></ng-content>' }]
3652
+ }], propDecorators: { data: [{
3653
+ type: Input
3654
+ }], columnDefinitions: [{
3655
+ type: Input
3656
+ }], actionOptions: [{
3657
+ type: Input
3658
+ }], actionSelected: [{
3659
+ type: Output
3660
+ }] } });
3661
+
3662
+ class DataTableUIModule {
3663
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: DataTableUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3664
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.8", ngImport: i0, type: DataTableUIModule, declarations: [DataTableUIComponent], imports: [CommonModule, SharedDhis2UiModule, ReactWrapperModule], exports: [DataTableUIComponent] }); }
3665
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: DataTableUIModule, imports: [CommonModule, SharedDhis2UiModule] }); }
3666
+ }
3667
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: DataTableUIModule, decorators: [{
3668
+ type: NgModule,
3669
+ args: [{
3670
+ declarations: [DataTableUIComponent],
3671
+ exports: [DataTableUIComponent],
3672
+ imports: [CommonModule, SharedDhis2UiModule, ReactWrapperModule],
3673
+ providers: [],
3674
+ }]
3675
+ }] });
3676
+
3487
3677
  class FormField {
3488
3678
  constructor(options = {}) {
3489
3679
  this.value = options.value || '';
@@ -5154,6 +5344,175 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
5154
5344
  // Use of this source code is governed by a BSD-style
5155
5345
  // license that can be found in the LICENSE file.
5156
5346
 
5347
+ class SelectionFiltersComponent extends ReactWrapperModule {
5348
+ constructor() {
5349
+ super(...arguments);
5350
+ this.actionOptions = [];
5351
+ this.attributeFilters = [];
5352
+ this.dataElementFilters = [];
5353
+ this.actionSelected = new EventEmitter();
5354
+ this.SelectionFiltersUI = () => {
5355
+ const [filters, setFilters] = useState({
5356
+ attributeFilters: this.attributeFilters || [],
5357
+ dataElementFilters: this.dataElementFilters || [],
5358
+ });
5359
+ useEffect(() => {
5360
+ setFilters({
5361
+ attributeFilters: this.attributeFilters,
5362
+ dataElementFilters: this.dataElementFilters,
5363
+ });
5364
+ }, [this.attributeFilters, this.dataElementFilters]);
5365
+ const handleAttributeChange = (index, selectedValue) => {
5366
+ setFilters((prevFilters) => {
5367
+ const updatedFilters = [...prevFilters.attributeFilters];
5368
+ updatedFilters[index] = { ...updatedFilters[index], value: selectedValue };
5369
+ return { ...prevFilters, attributeFilters: updatedFilters };
5370
+ });
5371
+ };
5372
+ const handleDataElementChange = (index, selectedValue) => {
5373
+ setFilters((prevFilters) => {
5374
+ const updatedFilters = [...prevFilters.dataElementFilters];
5375
+ updatedFilters[index] = { ...updatedFilters[index], value: selectedValue };
5376
+ return { ...prevFilters, dataElementFilters: updatedFilters };
5377
+ });
5378
+ };
5379
+ const handleSearch = () => {
5380
+ this.actionSelected.emit(filters);
5381
+ };
5382
+ // Grid Column Span Logic for Attribute Filters
5383
+ const getAttributeColumnSpan = (index) => {
5384
+ const totalItems = filters.attributeFilters.length;
5385
+ if (totalItems <= 4) {
5386
+ // If 1 to 4 items, place them in a single row (span all columns if there's only one item)
5387
+ if (totalItems === 1) {
5388
+ return 'span 4'; // One item spans all four columns
5389
+ }
5390
+ if (totalItems === 2) {
5391
+ return 'span 2'; // Two items, each spans 2 columns
5392
+ }
5393
+ if (totalItems === 3) {
5394
+ return 'span 1'; // Three items, each spans one column
5395
+ }
5396
+ if (totalItems === 4) {
5397
+ return 'span 1'; // Four items, each spans one column
5398
+ }
5399
+ }
5400
+ else {
5401
+ // More than 4 items, recursively adjust the placement
5402
+ const rowIndex = Math.floor(index / 2); // Calculate row by pairs
5403
+ if (index % 2 === 0) {
5404
+ // For first item in each row, span 2 columns
5405
+ return 'span 2';
5406
+ }
5407
+ else if (index === totalItems - 1) {
5408
+ // Last item, spans the full row (4 columns)
5409
+ return 'span 4';
5410
+ }
5411
+ else {
5412
+ // For other items, span 2 columns
5413
+ return 'span 2';
5414
+ }
5415
+ }
5416
+ return 'span 1'; // Default behavior
5417
+ };
5418
+ // Grid Column Span Logic for Data Element Filters
5419
+ const getDataElementColumnSpan = (index) => {
5420
+ const totalItems = filters.dataElementFilters.length;
5421
+ if (totalItems <= 4) {
5422
+ // If 1 to 4 items, place them in a single row (span all columns if there's only one item)
5423
+ if (totalItems === 1) {
5424
+ return 'span 4'; // One item spans all four columns
5425
+ }
5426
+ if (totalItems === 2) {
5427
+ return 'span 2'; // Two items, each spans 2 columns
5428
+ }
5429
+ if (totalItems === 3) {
5430
+ return 'span 1'; // Three items, each spans one column
5431
+ }
5432
+ if (totalItems === 4) {
5433
+ return 'span 1'; // Four items, each spans one column
5434
+ }
5435
+ }
5436
+ else {
5437
+ // More than 4 items, recursively adjust the placement
5438
+ const rowIndex = Math.floor(index / 2); // Calculate row by pairs
5439
+ if (index % 2 === 0) {
5440
+ // For first item in each row, span 2 columns
5441
+ return 'span 2';
5442
+ }
5443
+ else if (index === totalItems - 1) {
5444
+ // Last item, spans the full row (4 columns)
5445
+ return 'span 4';
5446
+ }
5447
+ else {
5448
+ // For other items, span 2 columns
5449
+ return 'span 2';
5450
+ }
5451
+ }
5452
+ return 'span 1'; // Default behavior
5453
+ };
5454
+ return (React__default.createElement("div", { style: {
5455
+ fontFamily: 'Arial, sans-serif',
5456
+ padding: '20px',
5457
+ backgroundColor: '#f9f9f9',
5458
+ borderRadius: '8px',
5459
+ boxShadow: '0 4px 8px rgba(0, 0, 0, 0.1)',
5460
+ } },
5461
+ React__default.createElement("div", { style: {
5462
+ display: 'grid',
5463
+ gridTemplateColumns: 'repeat(4, 1fr)',
5464
+ gap: '16px',
5465
+ } }, filters.attributeFilters.map((filter, index) => (React__default.createElement("div", { key: index, style: { gridColumn: getAttributeColumnSpan(index) } }, filter.hasOptions && filter.options.length > 0 ? (React__default.createElement(SingleSelectField, { className: "single-select", label: filter.name || 'Select Option', selected: filter.value, onChange: (event) => handleAttributeChange(index, event.selected) }, filter.options.map((option, i) => (React__default.createElement(SingleSelectOption, { key: i, label: option.name, value: option.id }))))) : (React__default.createElement(InputField$1, { className: "input-field", label: filter.name || 'Program name', value: filter.value, onChange: (event) => handleAttributeChange(index, event.value) })))))),
5466
+ React__default.createElement("div", { style: {
5467
+ display: 'grid',
5468
+ gridTemplateColumns: 'repeat(4, 1fr)',
5469
+ gap: '16px',
5470
+ } }, filters.dataElementFilters.map((filter, index) => (React__default.createElement("div", { key: index, style: { gridColumn: getDataElementColumnSpan(index) } }, filter.hasOptions && filter.options.length > 0 ? (React__default.createElement(SingleSelectField, { className: "single-select", label: filter.name || 'Aggregation type', selected: filter.value, onChange: (event) => handleDataElementChange(index, event.selected) }, filter.options.map((option, i) => (React__default.createElement(SingleSelectOption, { key: i, label: option.name, value: option.id }))))) : (React__default.createElement(InputField$1, { className: "input-field", label: filter.name || 'Program name', value: filter.value, onChange: (event) => handleDataElementChange(index, event.value) })))))),
5471
+ React__default.createElement("div", { style: { textAlign: 'right', marginTop: '16px' } },
5472
+ React__default.createElement(Button$1, { onClick: handleSearch }, "Search"))));
5473
+ };
5474
+ }
5475
+ async ngAfterViewInit() {
5476
+ if (!this.elementRef)
5477
+ throw new Error('No element ref');
5478
+ this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
5479
+ this.component = this.SelectionFiltersUI;
5480
+ this.render();
5481
+ }
5482
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SelectionFiltersComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
5483
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: SelectionFiltersComponent, isStandalone: false, selector: "app-selection-filters-ui", inputs: { actionOptions: "actionOptions", attributeFilters: "attributeFilters", dataElementFilters: "dataElementFilters", startDate: "startDate", endDate: "endDate" }, outputs: { actionSelected: "actionSelected" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [".react-filters-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:20px}.input-field,.single-select{width:100%}\n"] }); }
5484
+ }
5485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SelectionFiltersComponent, decorators: [{
5486
+ type: Component,
5487
+ args: [{ selector: 'app-selection-filters-ui', template: '<ng-content></ng-content>', standalone: false, styles: [".react-filters-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:20px}.input-field,.single-select{width:100%}\n"] }]
5488
+ }], propDecorators: { actionOptions: [{
5489
+ type: Input
5490
+ }], attributeFilters: [{
5491
+ type: Input
5492
+ }], dataElementFilters: [{
5493
+ type: Input
5494
+ }], startDate: [{
5495
+ type: Input
5496
+ }], endDate: [{
5497
+ type: Input
5498
+ }], actionSelected: [{
5499
+ type: Output
5500
+ }] } });
5501
+
5502
+ class SelectionFiltersUiModule {
5503
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SelectionFiltersUiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
5504
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.8", ngImport: i0, type: SelectionFiltersUiModule, declarations: [SelectionFiltersComponent], imports: [CommonModule, SharedDhis2UiModule, ReactWrapperModule], exports: [SelectionFiltersComponent] }); }
5505
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SelectionFiltersUiModule, imports: [CommonModule, SharedDhis2UiModule] }); }
5506
+ }
5507
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SelectionFiltersUiModule, decorators: [{
5508
+ type: NgModule,
5509
+ args: [{
5510
+ declarations: [SelectionFiltersComponent],
5511
+ imports: [CommonModule, SharedDhis2UiModule, ReactWrapperModule],
5512
+ exports: [SelectionFiltersComponent],
5513
+ }]
5514
+ }] });
5515
+
5157
5516
  class TrackerFormComponent {
5158
5517
  constructor() {
5159
5518
  this.program = input.required();
@@ -5162,6 +5521,7 @@ class TrackerFormComponent {
5162
5521
  async ngOnInit() {
5163
5522
  this.trackerQuery = this.d2.trackerModule.trackedEntity.setProgram(this.program());
5164
5523
  const program = await this.trackerQuery.getMetaData();
5524
+ const instance = await this.trackerQuery.create();
5165
5525
  if (program) {
5166
5526
  this.formMetaData = new FormMetaData({
5167
5527
  programs: [program],
@@ -5200,5 +5560,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
5200
5560
  * Generated bundle index. Do not edit.
5201
5561
  */
5202
5562
 
5203
- export { Boolean$1 as Boolean, ButtonComponent, ButtonModule, CheckBox, D2FormModule, DateField, DateRangeValue, Dropdown, FieldConfig, FieldControlTypeUtil, FieldDropdown, FieldType, FieldUtil, FormComponent, FormConfig, FormField, FormFieldComponent, FormFieldGroup, FormFieldTypeUtil, FormMetaData, FormMetadataSection, FormUtil, FormValue, FormValueUtil, HeaderBarComponent, HeaderBarModule, LineListModule, LineListTableComponent, MetadataRule, MetadataRuleAction, OrganisationUnitSelectionConfig, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperModule, RepeatableFormComponent, SectionFormComponent, TrackerFormComponent, TrackerFormModule, TranslationUtil };
5563
+ export { Boolean$1 as Boolean, ButtonComponent, ButtonModule, CheckBox, D2FormModule, DataTableUIComponent, DataTableUIModule, DateField, DateRangeValue, Dropdown, FieldConfig, FieldControlTypeUtil, FieldDropdown, FieldType, FieldUtil, FormComponent, FormConfig, FormField, FormFieldComponent, FormFieldGroup, FormFieldTypeUtil, FormMetaData, FormMetadataSection, FormUtil, FormValue, FormValueUtil, HeaderBarComponent, HeaderBarModule, LineListModule, LineListTableComponent, MetadataRule, MetadataRuleAction, OrganisationUnitSelectionConfig, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperModule, RepeatableFormComponent, SectionFormComponent, SelectionFiltersComponent, SelectionFiltersUiModule, TrackerFormComponent, TrackerFormModule, TranslationUtil };
5204
5564
  //# sourceMappingURL=iapps-ng-dhis2-ui.mjs.map