cloud-ide-shared 1.0.35 → 1.0.37

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.
@@ -1733,29 +1733,28 @@ class FeeDetailsViewerWrapperComponent {
1733
1733
  discount = null;
1734
1734
  // Outputs
1735
1735
  closed = new EventEmitter();
1736
- constructor() {
1737
- // Watch for isOpen changes to load/unload component
1738
- effect(() => {
1736
+ ngOnInit() {
1737
+ if (this.isOpen && this.componentToken) {
1738
+ this.loadComponent();
1739
+ }
1740
+ }
1741
+ ngOnChanges(changes) {
1742
+ // Handle isOpen changes
1743
+ if (changes['isOpen']) {
1739
1744
  if (this.isOpen && this.componentToken && !this.componentRef) {
1740
1745
  this.loadComponent();
1741
1746
  }
1742
1747
  else if (!this.isOpen && this.componentRef) {
1743
1748
  this.destroyComponent();
1744
1749
  }
1745
- });
1746
- }
1747
- ngOnInit() {
1748
- if (this.isOpen && this.componentToken) {
1749
- this.loadComponent();
1750
+ else if (this.componentRef) {
1751
+ this.updateComponentInputs();
1752
+ }
1750
1753
  }
1751
- }
1752
- ngOnChanges(changes) {
1753
- if (this.componentRef) {
1754
+ else if (this.componentRef) {
1755
+ // Update other inputs when they change
1754
1756
  this.updateComponentInputs();
1755
1757
  }
1756
- else if (this.isOpen && this.componentToken && changes['isOpen']?.currentValue) {
1757
- this.loadComponent();
1758
- }
1759
1758
  }
1760
1759
  ngOnDestroy() {
1761
1760
  this.destroyComponent();
@@ -1775,21 +1774,20 @@ class FeeDetailsViewerWrapperComponent {
1775
1774
  this.componentRef = this.viewContainerRef.createComponent(this.componentToken);
1776
1775
  // Set inputs
1777
1776
  this.updateComponentInputs();
1778
- // Subscribe to closed output if it exists
1777
+ // Subscribe to closed output if it exists (signal output)
1779
1778
  if (this.componentRef.instance.closed) {
1780
1779
  const closedOutput = this.componentRef.instance.closed;
1780
+ // Signal outputs are EventEmitters, so we can subscribe
1781
1781
  if (closedOutput && typeof closedOutput.subscribe === 'function') {
1782
1782
  closedOutput.subscribe(() => {
1783
1783
  this.closed.emit();
1784
1784
  });
1785
1785
  }
1786
- else if (typeof closedOutput === 'function') {
1787
- // If it's a function, wrap it
1788
- const originalClosed = closedOutput;
1789
- this.componentRef.instance.closed = () => {
1790
- originalClosed();
1786
+ else if (closedOutput && typeof closedOutput.emit === 'function') {
1787
+ // If it's an EventEmitter-like object
1788
+ closedOutput.subscribe(() => {
1791
1789
  this.closed.emit();
1792
- };
1790
+ });
1793
1791
  }
1794
1792
  }
1795
1793
  }
@@ -1800,32 +1798,12 @@ class FeeDetailsViewerWrapperComponent {
1800
1798
  updateComponentInputs() {
1801
1799
  if (!this.componentRef)
1802
1800
  return;
1803
- // Update component inputs using setInput for proper change detection
1804
- if ('isOpen' in this.componentRef.instance) {
1805
- this.componentRef.setInput('isOpen', this.isOpen);
1806
- }
1807
- if ('feeData' in this.componentRef.instance) {
1808
- this.componentRef.setInput('feeData', this.feeData);
1809
- }
1810
- if ('assignmentDate' in this.componentRef.instance) {
1811
- this.componentRef.setInput('assignmentDate', this.assignmentDate);
1812
- }
1813
- if ('discount' in this.componentRef.instance) {
1814
- this.componentRef.setInput('discount', this.discount);
1815
- }
1816
- // Also try direct assignment for compatibility
1817
- if (this.componentRef.instance.isOpen !== undefined) {
1818
- this.componentRef.instance.isOpen = this.isOpen;
1819
- }
1820
- if (this.componentRef.instance.feeData !== undefined) {
1821
- this.componentRef.instance.feeData = this.feeData;
1822
- }
1823
- if (this.componentRef.instance.assignmentDate !== undefined) {
1824
- this.componentRef.instance.assignmentDate = this.assignmentDate;
1825
- }
1826
- if (this.componentRef.instance.discount !== undefined) {
1827
- this.componentRef.instance.discount = this.discount;
1828
- }
1801
+ // Use setInput for all inputs - this works correctly with signal inputs in Angular 17+
1802
+ // Signal inputs are functions, but setInput handles them correctly
1803
+ this.componentRef.setInput('isOpen', this.isOpen);
1804
+ this.componentRef.setInput('feeData', this.feeData);
1805
+ this.componentRef.setInput('assignmentDate', this.assignmentDate);
1806
+ this.componentRef.setInput('discount', this.discount);
1829
1807
  // Detect changes
1830
1808
  this.componentRef.changeDetectorRef.detectChanges();
1831
1809
  }
@@ -1846,7 +1824,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
1846
1824
  standalone: true,
1847
1825
  template: `<!-- Component will be dynamically loaded here -->`
1848
1826
  }]
1849
- }], ctorParameters: () => [], propDecorators: { isOpen: [{
1827
+ }], propDecorators: { isOpen: [{
1850
1828
  type: Input
1851
1829
  }], feeData: [{
1852
1830
  type: Input
@@ -1858,6 +1836,194 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
1858
1836
  type: Output
1859
1837
  }] } });
1860
1838
 
1839
+ /**
1840
+ * Injection token for ProgramSectionSelectorComponent
1841
+ * This allows the component to be provided without direct import dependency
1842
+ *
1843
+ * @example
1844
+ * ```typescript
1845
+ * // In app.config.ts
1846
+ * import { CideLytProgramSectionSelectorComponent } from 'cloud-ide-academics';
1847
+ * import { PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN } from 'cloud-ide-shared';
1848
+ *
1849
+ * providers: [
1850
+ * { provide: PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, useValue: CideLytProgramSectionSelectorComponent }
1851
+ * ]
1852
+ *
1853
+ * // In component template
1854
+ * <cide-shared-program-section-selector-wrapper
1855
+ * [formGroup]="form"
1856
+ * [classProgramControlName]="'class_program_id'"
1857
+ * [academicYearId]="academicYearId()"
1858
+ * (valuesChange)="onValuesChange($event)">
1859
+ * </cide-shared-program-section-selector-wrapper>
1860
+ * ```
1861
+ */
1862
+ const PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN = new InjectionToken('ProgramSectionSelectorComponent');
1863
+
1864
+ /**
1865
+ * Wrapper component that dynamically loads the ProgramSectionSelectorComponent
1866
+ * This allows front-desk to use the component without directly importing cloud-ide-academics
1867
+ */
1868
+ class ProgramSectionSelectorWrapperComponent {
1869
+ viewContainerRef = inject(ViewContainerRef);
1870
+ destroyRef = inject(DestroyRef);
1871
+ componentToken = inject(PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, { optional: true });
1872
+ componentRef = null;
1873
+ // Inputs that will be passed to the dynamically loaded component
1874
+ formGroup;
1875
+ classProgramControlName = 'class_program_id';
1876
+ branchControlName = 'branch_id';
1877
+ termControlName = 'term_id';
1878
+ sectionControlName = 'section_id';
1879
+ academicYearId = null;
1880
+ entityId = null;
1881
+ disabled = false;
1882
+ showLabels = true;
1883
+ gridCols = 'tw-grid-cols-1 md:tw-grid-cols-3';
1884
+ showAllPrograms = false;
1885
+ includeInactive = false;
1886
+ // Outputs
1887
+ valuesChange = new EventEmitter();
1888
+ ngOnInit() {
1889
+ if (this.componentToken && this.formGroup) {
1890
+ this.loadComponent();
1891
+ }
1892
+ }
1893
+ ngOnChanges(changes) {
1894
+ if (this.componentRef) {
1895
+ this.updateComponentInputs();
1896
+ }
1897
+ else if (this.formGroup && this.componentToken && changes['formGroup']?.currentValue) {
1898
+ this.loadComponent();
1899
+ }
1900
+ }
1901
+ ngOnDestroy() {
1902
+ this.destroyComponent();
1903
+ }
1904
+ loadComponent() {
1905
+ if (!this.componentToken) {
1906
+ console.warn('PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN not provided. ProgramSectionSelectorComponent will not be loaded.');
1907
+ return;
1908
+ }
1909
+ if (!this.formGroup) {
1910
+ console.warn('formGroup is required for ProgramSectionSelectorComponent.');
1911
+ return;
1912
+ }
1913
+ if (this.componentRef) {
1914
+ // Component already loaded, just update inputs
1915
+ this.updateComponentInputs();
1916
+ return;
1917
+ }
1918
+ try {
1919
+ // Create the component dynamically
1920
+ this.componentRef = this.viewContainerRef.createComponent(this.componentToken);
1921
+ // Set inputs
1922
+ this.updateComponentInputs();
1923
+ // Subscribe to valuesChange output if it exists
1924
+ if (this.componentRef.instance.valuesChange) {
1925
+ const valuesChangeOutput = this.componentRef.instance.valuesChange;
1926
+ if (valuesChangeOutput && typeof valuesChangeOutput.subscribe === 'function') {
1927
+ valuesChangeOutput.subscribe((values) => {
1928
+ this.valuesChange.emit(values);
1929
+ });
1930
+ }
1931
+ }
1932
+ }
1933
+ catch (error) {
1934
+ console.error('Error loading ProgramSectionSelectorComponent:', error);
1935
+ }
1936
+ }
1937
+ updateComponentInputs() {
1938
+ if (!this.componentRef)
1939
+ return;
1940
+ const instance = this.componentRef.instance;
1941
+ // Handle signal inputs (Angular 17+)
1942
+ // Use setInput for proper change detection
1943
+ if ('formGroup' in instance) {
1944
+ this.componentRef.setInput('formGroup', this.formGroup);
1945
+ }
1946
+ if ('classProgramControlName' in instance) {
1947
+ this.componentRef.setInput('classProgramControlName', this.classProgramControlName);
1948
+ }
1949
+ if ('branchControlName' in instance) {
1950
+ this.componentRef.setInput('branchControlName', this.branchControlName);
1951
+ }
1952
+ if ('termControlName' in instance) {
1953
+ this.componentRef.setInput('termControlName', this.termControlName);
1954
+ }
1955
+ if ('sectionControlName' in instance) {
1956
+ this.componentRef.setInput('sectionControlName', this.sectionControlName);
1957
+ }
1958
+ if ('academicYearId' in instance) {
1959
+ this.componentRef.setInput('academicYearId', this.academicYearId);
1960
+ }
1961
+ if ('entityId' in instance) {
1962
+ this.componentRef.setInput('entityId', this.entityId);
1963
+ }
1964
+ if ('disabled' in instance) {
1965
+ this.componentRef.setInput('disabled', this.disabled);
1966
+ }
1967
+ if ('showLabels' in instance) {
1968
+ this.componentRef.setInput('showLabels', this.showLabels);
1969
+ }
1970
+ if ('gridCols' in instance) {
1971
+ this.componentRef.setInput('gridCols', this.gridCols);
1972
+ }
1973
+ if ('showAllPrograms' in instance) {
1974
+ this.componentRef.setInput('showAllPrograms', this.showAllPrograms);
1975
+ }
1976
+ if ('includeInactive' in instance) {
1977
+ this.componentRef.setInput('includeInactive', this.includeInactive);
1978
+ }
1979
+ // Detect changes
1980
+ this.componentRef.changeDetectorRef.detectChanges();
1981
+ }
1982
+ destroyComponent() {
1983
+ if (this.componentRef) {
1984
+ this.componentRef.destroy();
1985
+ this.componentRef = null;
1986
+ this.viewContainerRef.clear();
1987
+ }
1988
+ }
1989
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ProgramSectionSelectorWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1990
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.7", type: ProgramSectionSelectorWrapperComponent, isStandalone: true, selector: "cide-shared-program-section-selector-wrapper", inputs: { formGroup: "formGroup", classProgramControlName: "classProgramControlName", branchControlName: "branchControlName", termControlName: "termControlName", sectionControlName: "sectionControlName", academicYearId: "academicYearId", entityId: "entityId", disabled: "disabled", showLabels: "showLabels", gridCols: "gridCols", showAllPrograms: "showAllPrograms", includeInactive: "includeInactive" }, outputs: { valuesChange: "valuesChange" }, usesOnChanges: true, ngImport: i0, template: `<!-- Component will be dynamically loaded here -->`, isInline: true });
1991
+ }
1992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ProgramSectionSelectorWrapperComponent, decorators: [{
1993
+ type: Component,
1994
+ args: [{
1995
+ selector: 'cide-shared-program-section-selector-wrapper',
1996
+ standalone: true,
1997
+ template: `<!-- Component will be dynamically loaded here -->`
1998
+ }]
1999
+ }], propDecorators: { formGroup: [{
2000
+ type: Input
2001
+ }], classProgramControlName: [{
2002
+ type: Input
2003
+ }], branchControlName: [{
2004
+ type: Input
2005
+ }], termControlName: [{
2006
+ type: Input
2007
+ }], sectionControlName: [{
2008
+ type: Input
2009
+ }], academicYearId: [{
2010
+ type: Input
2011
+ }], entityId: [{
2012
+ type: Input
2013
+ }], disabled: [{
2014
+ type: Input
2015
+ }], showLabels: [{
2016
+ type: Input
2017
+ }], gridCols: [{
2018
+ type: Input
2019
+ }], showAllPrograms: [{
2020
+ type: Input
2021
+ }], includeInactive: [{
2022
+ type: Input
2023
+ }], valuesChange: [{
2024
+ type: Output
2025
+ }] } });
2026
+
1861
2027
  /*
1862
2028
  * Public API Surface of cloud-ide-shared
1863
2029
  */
@@ -1866,5 +2032,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
1866
2032
  * Generated bundle index. Do not edit.
1867
2033
  */
1868
2034
 
1869
- export { ACADEMIC_YEAR_SERVICE_TOKEN, APP_STATE_SERVICE_TOKEN, AUTH_SERVICE_TOKEN, CLASS_PROGRAM_MASTER_SERVICE_TOKEN, COUNTRY_SERVICE_TOKEN, CideCoreGeneralMasterService, CideCoreGeneralMasterTypeService, CideSharedOrgStructureComponent, CideSharedProgramSectionSelectorComponent, CloudIdeShared, ENTITY_SERVICE_TOKEN, FEE_DETAILS_VIEWER_COMPONENT_TOKEN, FEE_PAYMENT_SERVICE_TOKEN, FEE_STRUCTURE_SERVICE_TOKEN, FINANCIAL_YEAR_SERVICE_TOKEN, FeeDetailsViewerWrapperComponent, NATIONALITY_SERVICE_TOKEN, PIN_CODE_SERVICE_TOKEN, PROGRAM_TERM_SECTION_SERVICE_TOKEN, SharedObjectIdService, USER_SERVICE_TOKEN, authGuard };
2035
+ export { ACADEMIC_YEAR_SERVICE_TOKEN, APP_STATE_SERVICE_TOKEN, AUTH_SERVICE_TOKEN, CLASS_PROGRAM_MASTER_SERVICE_TOKEN, COUNTRY_SERVICE_TOKEN, CideCoreGeneralMasterService, CideCoreGeneralMasterTypeService, CideSharedOrgStructureComponent, CideSharedProgramSectionSelectorComponent, CloudIdeShared, ENTITY_SERVICE_TOKEN, FEE_DETAILS_VIEWER_COMPONENT_TOKEN, FEE_PAYMENT_SERVICE_TOKEN, FEE_STRUCTURE_SERVICE_TOKEN, FINANCIAL_YEAR_SERVICE_TOKEN, FeeDetailsViewerWrapperComponent, NATIONALITY_SERVICE_TOKEN, PIN_CODE_SERVICE_TOKEN, PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, PROGRAM_TERM_SECTION_SERVICE_TOKEN, ProgramSectionSelectorWrapperComponent, SharedObjectIdService, USER_SERVICE_TOKEN, authGuard };
1870
2036
  //# sourceMappingURL=cloud-ide-shared.mjs.map