Initial Commit ...
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
{{! templates/module/module.ts.hbs }}
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { AuthGuard } from 'x-framework-identity-sdk';
|
||||
import { XCanDeactivateGuard } from 'x-framework-core';
|
||||
import { BaseRoutes } from 'src/app/config/page.config';
|
||||
import { ViewsModule } from 'src/app/views/views.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [
|
||||
ViewsModule,
|
||||
RouterModule.forChild([
|
||||
{
|
||||
pathMatch: 'full',
|
||||
path: BaseRoutes.Default,
|
||||
redirectTo: '__NAME__',
|
||||
},
|
||||
{
|
||||
path: '__NAME__',
|
||||
canActivate: [AuthGuard],
|
||||
canDeactivate: [XCanDeactivateGuard],
|
||||
loadChildren: () =>
|
||||
import('./pages/__NAME__/__NAME__.module').then(
|
||||
(m) => m.__CLASS__PageModule
|
||||
),
|
||||
},
|
||||
]),
|
||||
],
|
||||
exports: [ViewsModule, RouterModule],
|
||||
})
|
||||
export class __CLASS__PageModule {}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{! templates/page/page.page.html.hbs }}
|
||||
<!-- -->
|
||||
<!-- Page Presenter -->
|
||||
<!-- -->
|
||||
<v-page-presenter
|
||||
[loading]="loading"
|
||||
[containerBase]="this"
|
||||
[uiDisabled]="uiDisabled"
|
||||
[contentTemplate]="contentTemplate"
|
||||
></v-page-presenter>
|
||||
|
||||
<!-- -->
|
||||
<!-- Page Content -->
|
||||
<!-- -->
|
||||
<ng-template #contentTemplate>
|
||||
<!-- TODO: Add content -->
|
||||
</ng-template>
|
||||
@@ -0,0 +1,2 @@
|
||||
// __NAME__.page.scss
|
||||
// TODO: Add styles
|
||||
@@ -0,0 +1,29 @@
|
||||
{{! templates/page/page.page.ts.hbs }}
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { XSideType } from 'x-framework-components';
|
||||
import { VPageComponent } from 'src/app/views/v-page/v-page.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-__NAME__',
|
||||
templateUrl: './__NAME__.page.html',
|
||||
styleUrls: ['./__NAME__.page.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
// tslint:disable-next-line:component-class-suffix
|
||||
export class __CLASS__Page extends VPageComponent {
|
||||
//
|
||||
//#region Props ...
|
||||
hasSide = true;
|
||||
toolbarShowSubTitle = true;
|
||||
showToolbarEndSlot = true;
|
||||
showToolbarContent = false;
|
||||
titleRes = this.AppResourceIDs.__TITLE_RES__;
|
||||
toolbarSubTitle = this.resourceProvider(this.titleRes);
|
||||
|
||||
/**
|
||||
* use this for Menu always Visible ...
|
||||
*/
|
||||
toggleMenuWhen = '';
|
||||
sideType = XSideType.Overlay;
|
||||
//#endregion
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{{! templates/provider-page/base.provider.page.ts.hbs }}
|
||||
import {
|
||||
Component,
|
||||
ViewChild,
|
||||
TemplateRef,
|
||||
ChangeDetectionStrategy,
|
||||
} from '@angular/core';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { nameof, getFieldNames, isNullOrUndefined } from 'x-framework-core';
|
||||
import { X__CLASS__Dto, default__CLASS__Dto } from 'x-saherelm-api-sdk';
|
||||
import { XQueryDto, XQueryResultDto } from 'x-framework-identity-sdk';
|
||||
import { VQueryPresenterBasePage } from 'src/app/views/v-query-presenter/v-query-presenter.base.page';
|
||||
import { VBaseDtoActionModel, VBaseDtoPresentType } from 'src/app/views/v-dto/v-dto.typings';
|
||||
import { XListItem } from 'x-framework-components';
|
||||
|
||||
@Component({
|
||||
template: '',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export abstract class __CLASS__BaseProviderPage extends VQueryPresenterBasePage {
|
||||
//
|
||||
modelIdentifier: string = nameof<X__CLASS__Dto>('id');
|
||||
listTabCardTitle = this.AppResourceIDs.__NAME__s;
|
||||
|
||||
//
|
||||
queryPresenterActionProvider = new Subject<any>();
|
||||
listItemActionProvider = new Subject<VBaseDtoActionModel>();
|
||||
|
||||
//
|
||||
query: XQueryDto = {
|
||||
page: 1,
|
||||
filter: '',
|
||||
pageSize: this.config.defaultPageSize,
|
||||
sortBy: nameof<X__CLASS__Dto>('id'),
|
||||
};
|
||||
dtoQueryResult: XQueryResultDto<X__CLASS__Dto> = undefined;
|
||||
hasQueryResultError = false;
|
||||
|
||||
// Templates
|
||||
@ViewChild('itemTemplate') itemTemplate!: TemplateRef<any>;
|
||||
@ViewChild('listItemTemplate') listItemTemplate!: TemplateRef<any>;
|
||||
@ViewChild('addItemTemplate') addItemTemplate!: TemplateRef<any>;
|
||||
@ViewChild('updateItemTemplate') updateItemTemplate!: TemplateRef<any>;
|
||||
@ViewChild('detailsItemTemplate') detailsItemTemplate!: TemplateRef<any>;
|
||||
|
||||
abstract getModelTask(identifier: string): Observable<any>;
|
||||
abstract queryModelTask(query: XQueryDto): Observable<XQueryResultDto<any>>;
|
||||
|
||||
async handleGetQueryResult(query: XQueryDto): Promise<XQueryResultDto<any>> {
|
||||
// TODO: implement
|
||||
return undefined as any;
|
||||
}
|
||||
async validateAndPrepareListItems(items: XListItem<any>[]) {
|
||||
return items;
|
||||
}
|
||||
async requestFillingItems(exists: any[], recieved: any[]) {
|
||||
return undefined as any;
|
||||
}
|
||||
async doItemActions(info: { id: string; data: any }) {
|
||||
// TODO
|
||||
}
|
||||
async handleCustomError(error?: string) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{! templates/service/service.ts.hbs }}
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { XBaseService } from 'x-framework-core';
|
||||
import { XManagerService } from 'x-framework-services';
|
||||
import { X_CONFIG } from 'src/app/config/x.config';
|
||||
import { XConfig } from 'src/app/config/app.config';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class X__CLASS__Service extends XBaseService {
|
||||
constructor(
|
||||
@Inject(X_CONFIG) public config: XConfig,
|
||||
public managerService: XManagerService
|
||||
) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
// TODO: Add methods
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{{! templates/view/view.component.ts.hbs }}
|
||||
import {
|
||||
Component,
|
||||
ChangeDetectionStrategy,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
getFieldNames,
|
||||
XExceptionIDs,
|
||||
isNullOrUndefined,
|
||||
isNullOrEmptyString,
|
||||
} from 'x-framework-core';
|
||||
import {
|
||||
X__CLASS__Dto,
|
||||
default__CLASS__Dto,
|
||||
prepare__CLASS__DtoFields,
|
||||
} from 'x-saherelm-api-sdk';
|
||||
import {
|
||||
VBaseDtoComponent,
|
||||
VModelFieldDescriptor,
|
||||
VModelValidationResult,
|
||||
} from '../../v-dto/v-dto.typings';
|
||||
|
||||
@Component({
|
||||
selector: 'v-__NAME__',
|
||||
templateUrl: './v-__NAME__.component.html',
|
||||
styleUrls: ['./v-__NAME__.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class V__CLASS__Component extends VBaseDtoComponent<X__CLASS__Dto> {
|
||||
readonly defaultModel: X__CLASS__Dto = { ...default__CLASS__Dto };
|
||||
readonly FieldNames = getFieldNames(this.defaultModel);
|
||||
|
||||
defaultFieldDescriptors: VModelFieldDescriptor<any>[] = [
|
||||
// TODO: Add field descriptors
|
||||
];
|
||||
|
||||
validate(
|
||||
model?: Partial<X__CLASS__Dto>
|
||||
): VModelValidationResult<X__CLASS__Dto> {
|
||||
// TODO: Implement validation
|
||||
const normalized = this.normalize(model);
|
||||
return {
|
||||
isValid: true,
|
||||
normalized,
|
||||
isValidForAdd: true,
|
||||
isValidForUpdate: true,
|
||||
validationErrors: [],
|
||||
};
|
||||
}
|
||||
|
||||
prepare(model?: X__CLASS__Dto): X__CLASS__Dto {
|
||||
return prepare__CLASS__DtoFields(model);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user