cloud-ide-shared 1.0.36 → 1.0.38

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.
@@ -145,6 +145,22 @@ const COUNTRY_SERVICE_TOKEN = new InjectionToken('CideCoreCountryService');
145
145
  */
146
146
  const NATIONALITY_SERVICE_TOKEN = new InjectionToken('CideCoreNationalityService');
147
147
 
148
+ /**
149
+ * Injection token for Currency Service (CideCoreCurrencyService)
150
+ * Used to provide and inject currency service implementations
151
+ * This enables dependency injection with interface-based contracts
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * // In app.config.ts
156
+ * { provide: CURRENCY_SERVICE_TOKEN, useExisting: CideCoreCurrencyService }
157
+ *
158
+ * // In component
159
+ * private currencyService = inject(CURRENCY_SERVICE_TOKEN) as ICurrencyService;
160
+ * ```
161
+ */
162
+ const CURRENCY_SERVICE_TOKEN = new InjectionToken('CideCoreCurrencyService');
163
+
148
164
  /**
149
165
  * Injection token for Class Program Master Service (CideCoreClassProgramMasterService)
150
166
  * Used to provide and inject class program master service implementations
@@ -1836,6 +1852,194 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
1836
1852
  type: Output
1837
1853
  }] } });
1838
1854
 
1855
+ /**
1856
+ * Injection token for ProgramSectionSelectorComponent
1857
+ * This allows the component to be provided without direct import dependency
1858
+ *
1859
+ * @example
1860
+ * ```typescript
1861
+ * // In app.config.ts
1862
+ * import { CideLytProgramSectionSelectorComponent } from 'cloud-ide-academics';
1863
+ * import { PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN } from 'cloud-ide-shared';
1864
+ *
1865
+ * providers: [
1866
+ * { provide: PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, useValue: CideLytProgramSectionSelectorComponent }
1867
+ * ]
1868
+ *
1869
+ * // In component template
1870
+ * <cide-shared-program-section-selector-wrapper
1871
+ * [formGroup]="form"
1872
+ * [classProgramControlName]="'class_program_id'"
1873
+ * [academicYearId]="academicYearId()"
1874
+ * (valuesChange)="onValuesChange($event)">
1875
+ * </cide-shared-program-section-selector-wrapper>
1876
+ * ```
1877
+ */
1878
+ const PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN = new InjectionToken('ProgramSectionSelectorComponent');
1879
+
1880
+ /**
1881
+ * Wrapper component that dynamically loads the ProgramSectionSelectorComponent
1882
+ * This allows front-desk to use the component without directly importing cloud-ide-academics
1883
+ */
1884
+ class ProgramSectionSelectorWrapperComponent {
1885
+ viewContainerRef = inject(ViewContainerRef);
1886
+ destroyRef = inject(DestroyRef);
1887
+ componentToken = inject(PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN, { optional: true });
1888
+ componentRef = null;
1889
+ // Inputs that will be passed to the dynamically loaded component
1890
+ formGroup;
1891
+ classProgramControlName = 'class_program_id';
1892
+ branchControlName = 'branch_id';
1893
+ termControlName = 'term_id';
1894
+ sectionControlName = 'section_id';
1895
+ academicYearId = null;
1896
+ entityId = null;
1897
+ disabled = false;
1898
+ showLabels = true;
1899
+ gridCols = 'tw-grid-cols-1 md:tw-grid-cols-3';
1900
+ showAllPrograms = false;
1901
+ includeInactive = false;
1902
+ // Outputs
1903
+ valuesChange = new EventEmitter();
1904
+ ngOnInit() {
1905
+ if (this.componentToken && this.formGroup) {
1906
+ this.loadComponent();
1907
+ }
1908
+ }
1909
+ ngOnChanges(changes) {
1910
+ if (this.componentRef) {
1911
+ this.updateComponentInputs();
1912
+ }
1913
+ else if (this.formGroup && this.componentToken && changes['formGroup']?.currentValue) {
1914
+ this.loadComponent();
1915
+ }
1916
+ }
1917
+ ngOnDestroy() {
1918
+ this.destroyComponent();
1919
+ }
1920
+ loadComponent() {
1921
+ if (!this.componentToken) {
1922
+ console.warn('PROGRAM_SECTION_SELECTOR_COMPONENT_TOKEN not provided. ProgramSectionSelectorComponent will not be loaded.');
1923
+ return;
1924
+ }
1925
+ if (!this.formGroup) {
1926
+ console.warn('formGroup is required for ProgramSectionSelectorComponent.');
1927
+ return;
1928
+ }
1929
+ if (this.componentRef) {
1930
+ // Component already loaded, just update inputs
1931
+ this.updateComponentInputs();
1932
+ return;
1933
+ }
1934
+ try {
1935
+ // Create the component dynamically
1936
+ this.componentRef = this.viewContainerRef.createComponent(this.componentToken);
1937
+ // Set inputs
1938
+ this.updateComponentInputs();
1939
+ // Subscribe to valuesChange output if it exists
1940
+ if (this.componentRef.instance.valuesChange) {
1941
+ const valuesChangeOutput = this.componentRef.instance.valuesChange;
1942
+ if (valuesChangeOutput && typeof valuesChangeOutput.subscribe === 'function') {
1943
+ valuesChangeOutput.subscribe((values) => {
1944
+ this.valuesChange.emit(values);
1945
+ });
1946
+ }
1947
+ }
1948
+ }
1949
+ catch (error) {
1950
+ console.error('Error loading ProgramSectionSelectorComponent:', error);
1951
+ }
1952
+ }
1953
+ updateComponentInputs() {
1954
+ if (!this.componentRef)
1955
+ return;
1956
+ const instance = this.componentRef.instance;
1957
+ // Handle signal inputs (Angular 17+)
1958
+ // Use setInput for proper change detection
1959
+ if ('formGroup' in instance) {
1960
+ this.componentRef.setInput('formGroup', this.formGroup);
1961
+ }
1962
+ if ('classProgramControlName' in instance) {
1963
+ this.componentRef.setInput('classProgramControlName', this.classProgramControlName);
1964
+ }
1965
+ if ('branchControlName' in instance) {
1966
+ this.componentRef.setInput('branchControlName', this.branchControlName);
1967
+ }
1968
+ if ('termControlName' in instance) {
1969
+ this.componentRef.setInput('termControlName', this.termControlName);
1970
+ }
1971
+ if ('sectionControlName' in instance) {
1972
+ this.componentRef.setInput('sectionControlName', this.sectionControlName);
1973
+ }
1974
+ if ('academicYearId' in instance) {
1975
+ this.componentRef.setInput('academicYearId', this.academicYearId);
1976
+ }
1977
+ if ('entityId' in instance) {
1978
+ this.componentRef.setInput('entityId', this.entityId);
1979
+ }
1980
+ if ('disabled' in instance) {
1981
+ this.componentRef.setInput('disabled', this.disabled);
1982
+ }
1983
+ if ('showLabels' in instance) {
1984
+ this.componentRef.setInput('showLabels', this.showLabels);
1985
+ }
1986
+ if ('gridCols' in instance) {
1987
+ this.componentRef.setInput('gridCols', this.gridCols);
1988
+ }
1989
+ if ('showAllPrograms' in instance) {
1990
+ this.componentRef.setInput('showAllPrograms', this.showAllPrograms);
1991
+ }
1992
+ if ('includeInactive' in instance) {
1993
+ this.componentRef.setInput('includeInactive', this.includeInactive);
1994
+ }
1995
+ // Detect changes
1996
+ this.componentRef.changeDetectorRef.detectChanges();
1997
+ }
1998
+ destroyComponent() {
1999
+ if (this.componentRef) {
2000
+ this.componentRef.destroy();
2001
+ this.componentRef = null;
2002
+ this.viewContainerRef.clear();
2003
+ }
2004
+ }
2005
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ProgramSectionSelectorWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2006
+ 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 });
2007
+ }
2008
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ProgramSectionSelectorWrapperComponent, decorators: [{
2009
+ type: Component,
2010
+ args: [{
2011
+ selector: 'cide-shared-program-section-selector-wrapper',
2012
+ standalone: true,
2013
+ template: `<!-- Component will be dynamically loaded here -->`
2014
+ }]
2015
+ }], propDecorators: { formGroup: [{
2016
+ type: Input
2017
+ }], classProgramControlName: [{
2018
+ type: Input
2019
+ }], branchControlName: [{
2020
+ type: Input
2021
+ }], termControlName: [{
2022
+ type: Input
2023
+ }], sectionControlName: [{
2024
+ type: Input
2025
+ }], academicYearId: [{
2026
+ type: Input
2027
+ }], entityId: [{
2028
+ type: Input
2029
+ }], disabled: [{
2030
+ type: Input
2031
+ }], showLabels: [{
2032
+ type: Input
2033
+ }], gridCols: [{
2034
+ type: Input
2035
+ }], showAllPrograms: [{
2036
+ type: Input
2037
+ }], includeInactive: [{
2038
+ type: Input
2039
+ }], valuesChange: [{
2040
+ type: Output
2041
+ }] } });
2042
+
1839
2043
  /*
1840
2044
  * Public API Surface of cloud-ide-shared
1841
2045
  */
@@ -1844,5 +2048,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
1844
2048
  * Generated bundle index. Do not edit.
1845
2049
  */
1846
2050
 
1847
- 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 };
2051
+ export { ACADEMIC_YEAR_SERVICE_TOKEN, APP_STATE_SERVICE_TOKEN, AUTH_SERVICE_TOKEN, CLASS_PROGRAM_MASTER_SERVICE_TOKEN, COUNTRY_SERVICE_TOKEN, CURRENCY_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 };
1848
2052
  //# sourceMappingURL=cloud-ide-shared.mjs.map