@deltastone/ngx-ds
is a robust, scalable Angular component library designed for building enterprise-grade web applications with complex data management, advanced form handling, and seamless integration capabilities.
The library provides advanced relation handling across different cardinality types:
Example :// Many-to-Many Relation Example
@Component({
template: `
<ngx-ds-input-relation-autocomplete [(ngModel)]="selectedTeamMembers" [model]="projectModel" [multiple]="true">
</ngx-ds-input-relation-autocomplete>
`,
})
export class TeamManagementComponent {
// Automatically handles complex relation loading and management
}
Intelligent form generation with runtime validation and access control:
Example :export class UserFormComponent extends FormPageComponent<UserEntity> {
constructor(userService: UserService) {
super(
userService,
'User Management',
UserModel,
// Automatic permission and validation setup
);
}
}
@Injectable()
export class AuthorizationService {
// Fine-grained permission checking
canPerformAction(action: string, resource: string): boolean {
return this.sessionService.user.can(action, resource);
}
}
const complexQuery = userService
.getQuery()
.and('department', FilterOperator.$eq, 'Engineering')
.orderBy('lastName', SortDirection.asc)
.populate('projects')
.setLimit(50);
// Dynamic translation with fallback
@Pipe({name: 'smartTranslate'})
export class SmartTranslatePipe {
transform(value: any, definition: FieldDefinition): string {
// Intelligent translation with type awareness
}
}
@Component({
template: ` <ngx-ds-input-condition [(ngModel)]="complexFilter" [model]="dataModel"> </ngx-ds-input-condition> `,
})
export class AdvancedFilterComponent {}
export const routes: Routes = [
{
path: 'admin',
canActivate: [AuthGuard, AdminPermissionGuard],
loadChildren: () => import('./admin/admin.module'),
},
];
npm install @deltastone/ngx-ds
@NgModule({
imports: [
AuthModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: createTranslationLoader,
},
}),
],
})
export class AppModule {}
To use the library in your project, you need to import the module assets in your app.module.ts to load the i18n translations
Example :export function HttpLoaderFactory(http: HttpBackend): MultiTranslateHttpLoader {
return new MultiTranslateHttpLoader(http, ['./assets/i18n/', './assets/form/common/i18n/']);
}
Alternatively, you can use the SRR Loaders to load the translations with ng universal.
Example :TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (loader: ServerSideTranslateLoader) => loader,
deps: [ServerSideTranslateLoader],
},
defaultLanguage: 'en',
});
Use the server side loader in the ssr module and the browser loader in the browser module. The server side loader needs the path to the translations. Provided with 'clientPath' as extraProvider in the backend ssr module.
Furthermore, you need to import the assets folder in your angular.json file.
Example :{
"glob": "**/*",
"input": "node_modules/@deltastone/ngx-ds/assets/form/common",
"output": "assets/form/common"
}
Available assets are form/common, form/editor
The code input requires some external resources from the monaco editor. To include these add this to the project assets:
Example :{
"glob": "**/*",
"input": "node_modules/monaco-editor",
"output": "/assets/monaco/"
}
It also requires installation of raw-loader
[Specify Licensing Details]
Would you like me to elaborate on any specific section or provide more detailed technical insights?