@iapps/ng-dhis2-ui 1.0.2 → 1.0.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.
- package/esm2022/index.mjs +2 -2
- package/esm2022/lib/modules/button/button.component.mjs +2 -2
- package/esm2022/lib/modules/header-bar/header-bar.component.mjs +2 -2
- package/esm2022/lib/modules/organisation-unit-selector/organisation-unit-selector.component.mjs +14 -4
- package/esm2022/lib/modules/period-selector/period-selector.component.mjs +2 -2
- package/esm2022/lib/modules/react-wrapper/index.mjs +6 -0
- package/esm2022/lib/modules/react-wrapper/react-wrapper.component.mjs +55 -0
- package/esm2022/lib/modules/react-wrapper/react-wrapper.module.mjs +18 -0
- package/esm2022/lib/shared/components/index.mjs +1 -3
- package/fesm2022/iapps-ng-dhis2-ui.mjs +85 -55
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/lib/modules/button/button.component.d.ts +1 -1
- package/lib/modules/header-bar/header-bar.component.d.ts +1 -1
- package/lib/modules/organisation-unit-selector/organisation-unit-selector.component.d.ts +2 -1
- package/lib/modules/period-selector/period-selector.component.d.ts +1 -1
- package/lib/modules/react-wrapper/index.d.ts +2 -0
- package/lib/modules/react-wrapper/react-wrapper.module.d.ts +8 -0
- package/lib/shared/components/index.d.ts +0 -2
- package/package.json +1 -1
- package/esm2022/lib/shared/components/react-component-wrapper/react-wrapper.component.mjs +0 -53
- /package/lib/{shared/components/react-component-wrapper → modules/react-wrapper}/react-wrapper.component.d.ts +0 -0
package/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export * from './lib/modules/header-bar';
|
|
|
3
3
|
export * from './lib/modules/button';
|
|
4
4
|
export * from './lib/modules/period-selector';
|
|
5
5
|
export * from './lib/modules/organisation-unit-selector';
|
|
6
|
-
export * from './lib/
|
|
6
|
+
export * from './lib/modules/react-wrapper';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
|
-
import { ReactWrapperComponent } from '
|
|
2
|
+
import { ReactWrapperComponent } from '../react-wrapper';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class ButtonComponent extends ReactWrapperComponent {
|
|
5
5
|
label: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementRef } from '@angular/core';
|
|
2
2
|
import { NgxDhis2HttpClientService } from '@iapps/ngx-dhis2-http-client';
|
|
3
|
-
import { ReactWrapperComponent } from '
|
|
3
|
+
import { ReactWrapperComponent } from '../react-wrapper';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class HeaderBarComponent extends ReactWrapperComponent {
|
|
6
6
|
private httpClient;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementRef, EventEmitter } from '@angular/core';
|
|
2
|
-
import { ReactWrapperComponent } from '../../shared';
|
|
3
2
|
import { NgxDhis2HttpClientService } from '@iapps/ngx-dhis2-http-client';
|
|
4
3
|
import { OrganisationUnitSelectionConfig, OrganisationUnitSelectionUsageType } from './models';
|
|
4
|
+
import { ReactWrapperComponent } from '../react-wrapper';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
type OrganisationUnitSelectionEvent = {
|
|
7
7
|
dimensionId: string;
|
|
@@ -15,6 +15,7 @@ export declare class OrganisationUnitSelectorComponent extends ReactWrapperCompo
|
|
|
15
15
|
props: Record<string, unknown>;
|
|
16
16
|
constructor(elementRef: ElementRef<HTMLElement>, httpClient: NgxDhis2HttpClientService);
|
|
17
17
|
ngAfterViewInit(): Promise<void>;
|
|
18
|
+
private getAppConfig;
|
|
18
19
|
getOrgUnitAttributeByUsage(usageType: OrganisationUnitSelectionUsageType): "organisationUnits" | "dataViewOrganisationUnits";
|
|
19
20
|
getRootOrgUnits(): Promise<string[]>;
|
|
20
21
|
getOrgUnitGroups(): Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementRef, EventEmitter } from '@angular/core';
|
|
2
2
|
import { NgxDhis2HttpClientService } from '@iapps/ngx-dhis2-http-client';
|
|
3
|
-
import { ReactWrapperComponent } from '
|
|
3
|
+
import { ReactWrapperComponent } from '../react-wrapper/react-wrapper.component';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
type PeriodSelectionEvent = {
|
|
6
6
|
dimensionId: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./react-wrapper.component.tsx";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
export declare class ReactWrapperModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ReactWrapperModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ReactWrapperModule, [typeof i1.ReactWrapperComponent], [typeof i2.CommonModule], [typeof i1.ReactWrapperComponent]>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ReactWrapperModule>;
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ContentChild, Directive, ElementRef, Input, } from '@angular/core';
|
|
2
|
-
import parse from 'html-react-parser';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as ReactDOM from 'react-dom/client';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
window.React = React;
|
|
7
|
-
export class ReactWrapperComponent {
|
|
8
|
-
constructor(elementRef) {
|
|
9
|
-
this.elementRef = elementRef;
|
|
10
|
-
}
|
|
11
|
-
ngAfterViewInit() {
|
|
12
|
-
if (!this.elementRef)
|
|
13
|
-
throw new Error('No element ref');
|
|
14
|
-
this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
|
|
15
|
-
this.render();
|
|
16
|
-
}
|
|
17
|
-
ngOnChanges() {
|
|
18
|
-
if (this.elementRef)
|
|
19
|
-
this.render();
|
|
20
|
-
}
|
|
21
|
-
ngOnDestroy() {
|
|
22
|
-
this.reactDomRoot?.unmount();
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
if (!this.component)
|
|
26
|
-
throw new Error('React component must be supplied');
|
|
27
|
-
if (!this.reactDomRoot)
|
|
28
|
-
return;
|
|
29
|
-
const jsxContent = this.content?.nativeElement?.outerHTML
|
|
30
|
-
? parse(this.content?.nativeElement?.outerHTML)
|
|
31
|
-
: undefined;
|
|
32
|
-
this.reactDomRoot.render(React.createElement(this.component, { ...this.props },
|
|
33
|
-
" ",
|
|
34
|
-
jsxContent || '',
|
|
35
|
-
" "));
|
|
36
|
-
}
|
|
37
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactWrapperComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
38
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ReactWrapperComponent, selector: "ng-dhis2-ui-wrapper", inputs: { props: "props", component: "component" }, queries: [{ propertyName: "content", first: true, predicate: ["ngDhis2UiContent"], descendants: true }], usesOnChanges: true, ngImport: i0 }); }
|
|
39
|
-
}
|
|
40
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactWrapperComponent, decorators: [{
|
|
41
|
-
type: Directive,
|
|
42
|
-
args: [{
|
|
43
|
-
selector: 'ng-dhis2-ui-wrapper',
|
|
44
|
-
}]
|
|
45
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { props: [{
|
|
46
|
-
type: Input
|
|
47
|
-
}], component: [{
|
|
48
|
-
type: Input
|
|
49
|
-
}], content: [{
|
|
50
|
-
type: ContentChild,
|
|
51
|
-
args: ['ngDhis2UiContent']
|
|
52
|
-
}] } });
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhY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