@iapps/ng-dhis2-ui 1.1.37 → 1.1.39

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.
@@ -25,7 +25,7 @@ import { Layer } from '@dhis2-ui/layer';
25
25
  import { CircularLoader } from '@dhis2-ui/loader';
26
26
  import { MenuItem, MenuDivider } from '@dhis2-ui/menu';
27
27
  import parse from 'html-react-parser';
28
- import { Button as Button$1, IconDimensionData16, IconClock16, IconDimensionOrgUnit16, spacers as spacers$1, colors as colors$1, IconEdit16, theme as theme$1, Tooltip, SingleSelectField, SingleSelectOption, InputField as InputField$1, TabBar, Tab, Transfer, Modal as Modal$1, ModalTitle as ModalTitle$1, ModalContent as ModalContent$1, ModalActions as ModalActions$1, ButtonStrip as ButtonStrip$1, Checkbox, OrganisationUnitTree, MultiSelect, MultiSelectOption, IconWarningFilled16, Layer as Layer$1, Popper, FlyoutMenu, MenuItem as MenuItem$1, IconMore24, CircularLoader as CircularLoader$1, DataTable, TableHead, DataTableRow, DataTableColumnHeader, TableBody, DataTableCell, TableFoot, Pagination, FileInputField, FileListItem, MultiSelectField, TextAreaField } from '@dhis2/ui';
28
+ import { Button as Button$1, IconDimensionData16, IconClock16, IconDimensionOrgUnit16, spacers as spacers$1, colors as colors$1, IconEdit16, theme as theme$1, Tooltip, SingleSelectField, SingleSelectOption, InputField as InputField$1, TabBar, Tab, Transfer, Modal as Modal$1, ModalTitle as ModalTitle$1, ModalContent as ModalContent$1, ModalActions as ModalActions$1, ButtonStrip as ButtonStrip$1, Checkbox, OrganisationUnitTree, MultiSelect, MultiSelectOption, IconWarningFilled16, Layer as Layer$1, Popper, FlyoutMenu, MenuItem as MenuItem$1, IconMore24, CircularLoader as CircularLoader$1, IconFilter16, DataTable, TableHead, DataTableRow, DataTableColumnHeader, TableBody, DataTableCell, TableFoot, Pagination, FileInputField, FileListItem, MultiSelectField, TextAreaField } from '@dhis2/ui';
29
29
  import { getNowInCalendar, generateFixedPeriods } from '@dhis2/multi-calendar-dates';
30
30
  import { isObject, isString, sortBy, isArray, find, camelCase, flatten, head, isEmpty } from 'lodash';
31
31
  import cx from 'classnames';
@@ -3327,7 +3327,8 @@ const addActionsColumn = (columns, actionOptions) => {
3327
3327
  class LineListTableComponent extends ReactWrapperModule {
3328
3328
  constructor() {
3329
3329
  super(...arguments);
3330
- this.showApprovalButton = false;
3330
+ this.dispatchTeis = false;
3331
+ this.showFilterButton = false;
3331
3332
  this.actionSelected = new EventEmitter();
3332
3333
  this.reactStateUpdaters = null;
3333
3334
  this.approvalSelected = new EventEmitter();
@@ -3357,6 +3358,7 @@ class LineListTableComponent extends ReactWrapperModule {
3357
3358
  const [isButtonLoading, setIsButtonLoading] = useState(this.isButtonLoading);
3358
3359
  const [filteredColumns, setFilteredColumns] = useState();
3359
3360
  const [inputValues, setInputValues] = useState({});
3361
+ const [filters, setFilters] = useState(false);
3360
3362
  // Store updaters in refs for Angular to access
3361
3363
  const updateRefs = useRef({
3362
3364
  setProgramIdState,
@@ -3524,18 +3526,7 @@ class LineListTableComponent extends ReactWrapperModule {
3524
3526
  // filteredColumns
3525
3527
  // );
3526
3528
  return (React__default.createElement("div", null,
3527
- React__default.createElement("div", { style: { display: 'flex', gap: '10px', flexWrap: 'wrap' } }, (filteredColumns ?? []).map(({ label, key }) => (React__default.createElement(InputField$1, { key: key, label: label, value: inputValues[key] || '', onChange: (e) => {
3528
- // console.log(`Event for key "${key}":`, e);
3529
- // Check if it's a standard event with target.value
3530
- if ('target' in e && e.target) {
3531
- handleInputChange(key, e.target.value);
3532
- }
3533
- // Check if it's a DHIS2 UI event with direct value
3534
- else if ('value' in e) {
3535
- handleInputChange(key, e.value ?? '');
3536
- }
3537
- } })))),
3538
- this.showApprovalButton && (React__default.createElement("div", { style: {
3529
+ React__default.createElement("div", { style: {
3539
3530
  width: '100%',
3540
3531
  display: 'flex',
3541
3532
  justifyContent: 'flex-end',
@@ -3543,7 +3534,45 @@ class LineListTableComponent extends ReactWrapperModule {
3543
3534
  gap: 8,
3544
3535
  padding: 8,
3545
3536
  marginBottom: 16,
3546
- } }, isButtonLoading ? (React__default.createElement(CircularLoader$1, { small: true })) : (React__default.createElement(Button$1, { className: "bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600", onClick: handleApprovalClick, primary: true }, this.buttonLabel)))),
3537
+ } },
3538
+ this.dispatchTeis &&
3539
+ (isButtonLoading ? (React__default.createElement(CircularLoader$1, { small: true })) : (React__default.createElement(Button$1, { style: {
3540
+ backgroundColor: '#3b82f6', // Blue color
3541
+ color: 'white',
3542
+ padding: '8px 16px',
3543
+ borderRadius: '4px',
3544
+ cursor: 'pointer',
3545
+ }, onClick: handleApprovalClick, primary: true }, this.buttonLabel))),
3546
+ this.showFilterButton && (React__default.createElement(Button$1, { style: {
3547
+ backgroundColor: '#6b7280', // Gray color
3548
+ color: 'white',
3549
+ padding: '8px 16px',
3550
+ borderRadius: '4px',
3551
+ cursor: 'pointer',
3552
+ display: 'flex',
3553
+ alignItems: 'center',
3554
+ gap: 8,
3555
+ }, onClick: () => {
3556
+ setFilters(!filters);
3557
+ } },
3558
+ React__default.createElement(IconFilter16, null),
3559
+ filters ? 'Hide Filters' : 'Show Filters'))),
3560
+ filters && (React__default.createElement("div", { style: {
3561
+ display: 'flex',
3562
+ gap: '10px',
3563
+ flexWrap: 'wrap',
3564
+ paddingBottom: '16px',
3565
+ } }, (filteredColumns ?? []).map(({ label, key }) => (React__default.createElement(InputField$1, { key: key, label: label, value: inputValues[key] || '', onChange: (e) => {
3566
+ console.log(`Event for key "${key}":`, e);
3567
+ // Check if it's a standard event with target.value
3568
+ if ('target' in e && e.target) {
3569
+ handleInputChange(key, e.target.value);
3570
+ }
3571
+ // Check if it's an event with direct value
3572
+ else if ('value' in e) {
3573
+ handleInputChange(key, e.value ?? '');
3574
+ }
3575
+ } }))))),
3547
3576
  loading ? (React__default.createElement("div", { style: {
3548
3577
  display: 'flex',
3549
3578
  alignItems: 'center',
@@ -3611,7 +3640,7 @@ class LineListTableComponent extends ReactWrapperModule {
3611
3640
  this.render();
3612
3641
  }
3613
3642
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
3614
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", showApprovalButton: "showApprovalButton", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["[data-test=dhis2-uiwidgets-pagination]{display:flex!important;flex-direction:row!important;justify-content:space-between!important;align-items:center!important}\n"] }); }
3643
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", showFilterButton: "showFilterButton", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["[data-test=dhis2-uiwidgets-pagination]{display:flex!important;flex-direction:row!important;justify-content:space-between!important;align-items:center!important}\n"] }); }
3615
3644
  }
3616
3645
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
3617
3646
  type: Component,
@@ -3634,7 +3663,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
3634
3663
  type: Input
3635
3664
  }], ouMode: [{
3636
3665
  type: Input
3637
- }], showApprovalButton: [{
3666
+ }], dispatchTeis: [{
3667
+ type: Input
3668
+ }], showFilterButton: [{
3638
3669
  type: Input
3639
3670
  }], actionSelected: [{
3640
3671
  type: Output