Commit 7e74f852 authored by LAVENIER's avatar LAVENIER
Browse files

Migrate to @sumaris-net/ngx-components

parent 5a8b9e9f
......@@ -265,5 +265,8 @@
}
}
},
"defaultProject": "app"
"defaultProject": "app",
"cli": {
"analytics": false
}
}
......@@ -5,7 +5,7 @@ module.exports = {
/text-mask-core\//,
]
},
'@sumaris/ngx-components': {
'@sumaris-net/ngx-components': {
ignorableDeepImportMatchers: [
/@ionic-native\//,
/ionic-cache\//,
......
......@@ -6,7 +6,7 @@
"license": "AGPL-3.0",
"readmeFilename": "README.md",
"scripts": {
"postinstall": "node scripts/node/postinstall.js && ngcc",
"postinstall": "ngcc",
"start": "ng serve",
"serve.aot": "ng serve --aot",
"build": "ng build",
......@@ -32,13 +32,26 @@
"@angular/router": "^11.2.14",
"@apollo/client": "^3.3.19",
"@e-is/ngx-material-table": "^0.11.9",
"@ionic/angular": "^5.6.8",
"@ionic/core": "^5.6.8",
"@ionic-native/audio-management": "^5.33.0",
"@ionic-native/camera": "^5.33.1",
"@ionic-native/core": "^5.33.1",
"@ionic-native/downloader": "^5.33.1",
"@ionic-native/geolocation": "^5.33.1",
"@ionic-native/in-app-browser": "^5.33.1",
"@ionic-native/keyboard": "^5.33.1",
"@ionic-native/native-audio": "^5.33.1",
"@ionic-native/network": "^5.33.1",
"@ionic-native/splash-screen": "^5.33.1",
"@ionic-native/status-bar": "^5.33.1",
"@ionic-native/vibration": "^5.33.1",
"@ionic/angular": "^5.6.9",
"@ionic/core": "^5.6.9",
"@ionic/pwa-elements": "^3.0.2",
"@ionic/storage": "^2.3.1",
"@ngtools/webpack": "^11.2.13",
"@ngtools/webpack": "^11.2.14",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@sumaris-net/ngx-components": "^0.0.18",
"angular-split": "^5.0.0",
"angular2-text-mask": "^9.0.0",
"apollo-angular": "^2.6.0",
......@@ -48,7 +61,7 @@
"apollo3-cache-persist": "^0.9.1",
"chart.js": "^2.9.4",
"clovelced-plugin-audiomanagement": "^1.0.2",
"core-js": "^3.11.3",
"core-js": "^3.13.1",
"cors": "^2.8.5",
"ember-cli-roboto-fontface": "^2.0.5",
"geojson": "^0.5.0",
......@@ -74,7 +87,6 @@
"scrypt-async": "^2.0.1",
"seedrandom": "^3.0.5",
"subscriptions-transport-ws": "^0.9.18",
"@sumaris-net/ngx-components": "^0.0.5",
"tslib": "^2.2.0",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1",
......@@ -82,24 +94,24 @@
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1102.13",
"@angular-devkit/core": "^11.2.13",
"@angular-devkit/schematics": "^11.2.13",
"@angular-devkit/build-angular": "~0.1102.14",
"@angular-devkit/core": "^11.2.14",
"@angular-devkit/schematics": "^11.2.14",
"@angular-eslint/builder": "4.2.1",
"@angular-eslint/eslint-plugin": "4.2.1",
"@angular-eslint/eslint-plugin-template": "4.2.1",
"@angular-eslint/schematics": "4.2.1",
"@angular-eslint/template-parser": "^4.2.1",
"@angular/cli": "^11.2.13",
"@angular/cli": "^11.2.14",
"@angular/compiler": "^11.1.2",
"@angular/compiler-cli": "^11.1.2",
"@angular/language-service": "^11.2.14",
"@ionic/angular-toolkit": "^3.1.1",
"@ionic/cli": "^6.16.1",
"@schematics/angular": "^11.1.0",
"@ionic/cli": "^6.16.3",
"@schematics/angular": "^11.2.14",
"@types/jasmine": "^3.7.1",
"@types/jasminewd2": "~2.0.8",
"@types/node": "^12.20.12",
"@types/node": "^12.20.15",
"@types/uuid": "^3.4.9",
"@typescript-eslint/eslint-plugin": "4.22.1",
"@typescript-eslint/parser": "4.22.1",
......@@ -117,7 +129,7 @@
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "~7.0.0",
"react": "^17.0.1",
"sass": "^1.34.0",
"sass": "^1.35.1",
"postcss": "^8.3.0",
"sass-loader": "^10.2.0",
"tar": "^5.0.5",
......@@ -134,7 +146,7 @@
"url": "https://gitlab.ifremer.fr/simm/sar-app/-/issues"
},
"engines": {
"node": ">= 12.19.1",
"node": ">= 12.20.15",
"npm": ">= 6.14.4"
}
}
#!/usr/bin/env node
const fs = require('fs'),
path = require('path');
// Replace @sumaris/ngx-components with a symbolic link to local project
try {
fs.unlinkSync('node_modules/@sumaris');
} catch (e) {
// Silent
}
try {
fs.rmdirSync('node_modules/@sumaris', {recursive: true});
} catch (e) {
// Silent
}
try {
fs.mkdirSync('node_modules/@sumaris');
fs.symlinkSync(path.resolve('../../sumaris/ngx-components/dist'), 'node_modules/@sumaris/ngx-components', 'junction');
} catch (e) {
throw new Error(e);
}
import {RouterModule, Routes} from '@angular/router';
import {NgModule} from '@angular/core';
import {AuthGuardService, UsersPage} from '@sumaris/ngx-components';
import {SarAdminModule} from '@app/admin/admin.module';
import {AuthGuardService, UsersPage} from '@sumaris-net/ngx-components';
import {AppAdminModule} from '@app/admin/admin.module';
const routes: Routes = [
{
......@@ -17,7 +17,7 @@ const routes: Routes = [
@NgModule({
imports: [
SarAdminModule,
AppAdminModule,
RouterModule.forChild(routes)
],
exports: [RouterModule]
......
......@@ -4,10 +4,10 @@ import {IonicStorageModule} from '@ionic/storage';
import {HttpClientModule} from '@angular/common/http';
import {CacheModule} from 'ionic-cache';
import {TranslateModule} from '@ngx-translate/core';
import {AdminModule, AdminRoutingModule, AppGraphQLModule, AuthGuardService, CoreModule, PlatformService, UsersPage} from '@sumaris/ngx-components';
import {SarSharedModule} from '@app/shared/shared.module';
import {AdminModule, AdminRoutingModule, AppGraphQLModule, AuthGuardService, CoreModule, PlatformService, UsersPage} from '@sumaris-net/ngx-components';
import {AppSharedModule} from '@app/shared/shared.module';
import {CommonModule} from "@angular/common";
import {SarCoreModule} from "@app/core/core.module";
import {AppCoreModule} from "@app/core/core.module";
......@@ -15,7 +15,7 @@ import {SarCoreModule} from "@app/core/core.module";
imports: [
CommonModule,
AdminModule,
SarCoreModule
AppCoreModule
],
declarations: [
],
......@@ -23,6 +23,6 @@ import {SarCoreModule} from "@app/core/core.module";
AdminModule
]
})
export class SarAdminModule {
export class AppAdminModule {
}
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {HomePage, AccountPage, AuthGuardService, SettingsPage} from '@sumaris/ngx-components';
import {HomePage, AccountPage, AuthGuardService, SettingsPage} from '@sumaris-net/ngx-components';
import {QuicklinkStrategy} from 'ngx-quicklink';
const routes: Routes = [
// Core path
......
......@@ -15,7 +15,7 @@ import {
MenuComponent,
mixHex,
PlatformService
} from '@sumaris/ngx-components';
} from '@sumaris-net/ngx-components';
import {Apollo} from 'apollo-angular';
@Component({
......
......@@ -33,13 +33,13 @@ import {
LocalSettings,
SocialModule,
TestingPage
} from '@sumaris/ngx-components';
} from '@sumaris-net/ngx-components';
import {TypePolicies} from '@apollo/client';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {environment} from '@environments/environment';
import {REFERENTIAL_CONFIG_OPTIONS, REFERENTIAL_GRAPHQL_TYPE_POLICIES} from '@app/referential/services/config/referential.config';
import {SarSharedModule} from '@app/shared/shared.module';
import {SarCoreModule} from "@app/core/core.module";
import {AppSharedModule} from '@app/shared/shared.module';
import {AppCoreModule} from "@app/core/core.module";
@NgModule({
......@@ -71,15 +71,24 @@ import {SarCoreModule} from "@app/core/core.module";
}),
// functional modules
SarCoreModule.forRoot(),
SarSharedModule.forRoot(environment),
AppCoreModule.forRoot(),
AppSharedModule.forRoot(environment),
SocialModule.forRoot(),
HammerModule,
AppRoutingModule
],
providers: [
{provide: APP_BASE_HREF, useValue: (environment.baseUrl || '/')},
{provide: APP_BASE_HREF, useFactory: function () {
try {
return document.getElementsByTagName('base')[0].href;
}
catch (err) {
console.error(err);
return environment.baseUrl || '/';
}
}
},
{provide: ENVIRONMENT, useValue: environment},
......
import {ModuleWithProviders, NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {IonicStorageModule} from '@ionic/storage';
import {HttpClientModule} from '@angular/common/http';
import {CacheModule} from 'ionic-cache';
import {TranslateModule} from '@ngx-translate/core';
import {AppGraphQLModule, CoreModule, PlatformService} from '@sumaris/ngx-components';
import {SarSharedModule} from '@app/shared/shared.module';
import {AppGraphQLModule, CoreModule} from '@sumaris-net/ngx-components';
import {AppSharedModule} from '@app/shared/shared.module';
@NgModule({
imports: [
CoreModule,
SarSharedModule,
AppSharedModule,
HttpClientModule,
AppGraphQLModule,
CacheModule,
......@@ -20,15 +18,15 @@ import {SarSharedModule} from '@app/shared/shared.module';
],
exports: [
CoreModule,
SarSharedModule
AppSharedModule
]
})
export class SarCoreModule {
export class AppCoreModule {
static forRoot(): ModuleWithProviders<SarCoreModule> {
static forRoot(): ModuleWithProviders<AppCoreModule> {
return {
ngModule: SarCoreModule,
ngModule: AppCoreModule,
providers: [
...CoreModule.forRoot().providers
]
......
import {EntityClass, BaseReferential} from '@sumaris/ngx-components';
import {EntityClass, BaseReferential} from '@sumaris-net/ngx-components';
@EntityClass()
export class ConstructionCategory extends BaseReferential<ConstructionCategory> {
......
......@@ -4,7 +4,7 @@ import {Subject} from 'rxjs';
import {AppTableDataSourceOptions, EntitiesTableDataSource,
ReferentialRef,
IEntity, IEntitiesService, AppTable,
isNotNil, toBoolean} from '@sumaris/ngx-components';
isNotNil, toBoolean} from '@sumaris-net/ngx-components';
import {environment} from "@environments/environment";
@Directive()
......
......@@ -2,7 +2,7 @@ import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector, Input}
import {ActivatedRoute, Router} from '@angular/router';
import {ModalController, Platform} from '@ionic/angular';
import {Location} from '@angular/common';
import {Entity, AppTable, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, LocalSettingsService} from '@sumaris/ngx-components';
import {Entity, AppTable, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, LocalSettingsService} from '@sumaris-net/ngx-components';
import {AbstractControl, FormBuilder, FormGroup} from '@angular/forms';
import {debounceTime, filter} from 'rxjs/operators';
import {environment} from '@environments/environment';
......
import {StatusIds} from '@sumaris/ngx-components';
import {StatusIds} from '@sumaris-net/ngx-components';
export declare interface StatusValue {
id: number;
......
......@@ -23,14 +23,14 @@
<!-- reset filter -->
<button mat-icon-button (click)="resetFilter()"
*ngIf="!filterIsEmpty">
*ngIf="filterCriteriaCount">
<mat-icon color="accent">filter_list_alt</mat-icon>
<mat-icon class="icon-secondary" style="left: 16px; top: 5px; font-weight: bold;">close</mat-icon>
</button>
<!-- show filter -->
<button mat-icon-button (click)="filterExpansionPanel.toggle()">
<mat-icon *ngIf="!filterIsEmpty; else emptyFilter"
<mat-icon *ngIf="filterCriteriaCount; else emptyFilter"
[matBadge]="filterCriteriaCount"
matBadgeColor="accent"
matBadgeSize="small"
......@@ -178,8 +178,11 @@
<!-- table -->
<div class="table-container">
<table mat-table #table [dataSource]="dataSource" class="trips-table" matSort matSortActive="label" matSortDirection="asc"
matSortDisableClear [trackBy]="trackByFn">
<table #table mat-table matSort matSortDisableClear
[dataSource]="dataSource"
[matSortActive]="defaultSortBy"
[matSortDirection]="defaultSortDirection"
[trackBy]="trackByFn">
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]="!canEdit">
......@@ -276,7 +279,7 @@
</th>
<td mat-cell *matCellDef="let row" class="mat-form-field-disabled">
<ion-text class="ion-text-end" color="medium" *ngIf="row.id!==-1">
<small [matTooltip]="'REFERENTIAL.CREATION_DATE'|translate" *ngIf="row.currentData.updateDate; let creationDate">
<small [matTooltip]="'REFERENTIAL.CREATION_DATE'|translate" *ngIf="row.currentData.creationDate; let creationDate">
<ion-icon name="calendar"></ion-icon> {{ creationDate | dateFormat: {time: true} }}
</small><br/>
<small [matTooltip]="'REFERENTIAL.UPDATE_DATE'|translate" *ngIf="row.currentData.updateDate; let updateDate">
......
......@@ -12,7 +12,7 @@ import {TranslateService} from '@ngx-translate/core';
import {AppTable, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS, LocalSettingsService, AccountService, Referential,
EntitiesTableDataSource,
isNil, isNotEmptyArray, isNotNil, isNotNilOrBlank, sort, firstNotNilPromise,
slideUpDownAnimation} from '@sumaris/ngx-components';
slideUpDownAnimation} from '@sumaris-net/ngx-components';
import {environment} from '@environments/environment';
import {ReferentialFilter} from '../services/filter/referential.filter';
import {MatExpansionPanel} from '@angular/material/expansion';
......@@ -33,7 +33,7 @@ export const REFERENTIAL_TABLE_SETTINGS_ENUM = {
})
export class ReferentialTable extends AppTable<Referential, ReferentialFilter> implements OnInit, OnDestroy {
static defaultEntityName = 'ConstructionCategory';
static DEFAULT_ENTITY_NAME = 'ConstructionCategory';
private _entityName: string;
......@@ -44,7 +44,6 @@ export class ReferentialTable extends AppTable<Referential, ReferentialFilter> i
levels: Observable<Referential[]>;
statusList = DEFAULT_STATUS_LIST;
statusById: any;
filterIsEmpty = true;
filterCriteriaCount = 0;
// eslint-disable-next-line @typescript-eslint/member-ordering
......@@ -166,7 +165,6 @@ export class ReferentialTable extends AppTable<Referential, ReferentialFilter> i
tap(value => {
const filter = this.asFilter(value);
this.filterCriteriaCount = filter.countNotEmptyCriteria();
this.filterIsEmpty = this.filterCriteriaCount === 0;
this.markForCheck();
// Applying the filter
this.setFilter(filter, {emitEvent: false});
......@@ -202,7 +200,6 @@ export class ReferentialTable extends AppTable<Referential, ReferentialFilter> i
const filter = this.asFilter(json);
this.filterForm.patchValue(json, {emitEvent: false});
this.filterCriteriaCount = filter.countNotEmptyCriteria();
this.filterIsEmpty = this.filterCriteriaCount === 0;
this.markForCheck();
return this.applyEntityName(filter.entityName);
}
......@@ -220,7 +217,7 @@ export class ReferentialTable extends AppTable<Referential, ReferentialFilter> i
}
// Load default entity
await this.applyEntityName(ReferentialTable.defaultEntityName);
await this.applyEntityName(ReferentialTable.DEFAULT_ENTITY_NAME);
}
async applyEntityName(entityName: string, opts?: { emitEvent?: boolean; skipLocationChange?: boolean }) {
......@@ -253,7 +250,7 @@ export class ReferentialTable extends AppTable<Referential, ReferentialFilter> i
entityName
});
this.filterForm.patchValue({entityName}, {emitEvent: false});
this.applyFilter(filter, {emitEvent: opts.emitEvent});
this.setFilter(filter, {emitEvent: opts.emitEvent});
// Update route location
if (opts.skipLocationChange !== true && this.canSelectEntity) {
......
......@@ -2,7 +2,7 @@ import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit} fr
import {ModalController} from '@ionic/angular';
import {ReferentialFilter} from '../services/filter/referential.filter';
import {ReferentialRefService} from '../services/referential-ref.service';
import {ReferentialRef, changeCaseToUnderscore} from '@sumaris/ngx-components';
import {ReferentialRef, changeCaseToUnderscore} from '@sumaris-net/ngx-components';
import {BaseSelectEntityModal} from './base-select-entity.modal';
@Component({
......
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Injector, Input, OnInit} from '@angular/core';
import {TableElement, ValidatorService} from '@e-is/ngx-material-table';
import {AccountService, AppInMemoryTable, InMemoryEntitiesService, isNotNil, LocalSettingsService, Referential, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS} from '@sumaris/ngx-components';
import {AccountService, AppInMemoryTable, InMemoryEntitiesService, isNotNil, LocalSettingsService, Referential, RESERVED_END_COLUMNS, RESERVED_START_COLUMNS} from '@sumaris-net/ngx-components';
import {ActivatedRoute, Router} from '@angular/router';
import {ModalController, Platform} from '@ionic/angular';
import {environment} from '@environments/environment';
......
......@@ -2,7 +2,7 @@ import {RouterModule, Routes} from '@angular/router';
import {NgModule} from '@angular/core';
import {ReferentialTable} from './generic/referential.table';
import {ReferentialModule} from './referential.module';
import {SharedRoutingModule} from '@sumaris/ngx-components';
import {SharedRoutingModule} from '@sumaris-net/ngx-components';
const routes: Routes = [
{
......
import {NgModule} from '@angular/core';
import {SarCoreModule} from '../core/core.module';
import {AppCoreModule} from '../core/core.module';
import {ReferentialTable} from './generic/referential.table';
import {SelectReferentialModal} from './generic/select-referential.modal';
import {ReferentialRefTable} from './generic/referential-ref.table';
......@@ -12,7 +12,7 @@ import {SimpleReferentialTable} from './generic/simple-referential.table';
@NgModule({
imports: [
CommonModule,
SarCoreModule,
AppCoreModule,
TextMaskModule,
TranslateModule.forChild()
],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment