@smartsoft001/crud-shell-angular 2.76.0 → 2.80.0
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.
- package/fesm2022/smartsoft001-crud-shell-angular.mjs +2840 -0
- package/fesm2022/smartsoft001-crud-shell-angular.mjs.map +1 -0
- package/index.d.ts +632 -0
- package/package.json +18 -3
- package/.storybook/addons.js +0 -1
- package/.storybook/config.js +0 -5
- package/.storybook/tsconfig.json +0 -8
- package/.storybook/webpack.config.js +0 -7
- package/jest.config.ts +0 -38
- package/ng-package.json +0 -7
- package/project.json +0 -49
- package/src/index.ts +0 -13
- package/src/lib/+state/crud.facade.ts +0 -82
- package/src/lib/+state/crud.methods.ts +0 -258
- package/src/lib/+state/crud.store.ts +0 -77
- package/src/lib/components/components.module.ts +0 -58
- package/src/lib/components/export/export.component.ts +0 -69
- package/src/lib/components/filter/base/base.component.ts +0 -175
- package/src/lib/components/filter/check/check.component.scss +0 -25
- package/src/lib/components/filter/check/check.component.ts +0 -72
- package/src/lib/components/filter/date/date.component.html +0 -30
- package/src/lib/components/filter/date/date.component.ts +0 -70
- package/src/lib/components/filter/date-time/date-time.component.html +0 -62
- package/src/lib/components/filter/date-time/date-time.component.ts +0 -56
- package/src/lib/components/filter/date-with-edit/date-with-edit.component.html +0 -109
- package/src/lib/components/filter/date-with-edit/date-with-edit.component.ts +0 -70
- package/src/lib/components/filter/filter.component.html +0 -52
- package/src/lib/components/filter/filter.component.ts +0 -34
- package/src/lib/components/filter/flag/flag.component.ts +0 -55
- package/src/lib/components/filter/index.ts +0 -9
- package/src/lib/components/filter/int/int.component.html +0 -74
- package/src/lib/components/filter/int/int.component.ts +0 -57
- package/src/lib/components/filter/radio/radio.component.ts +0 -74
- package/src/lib/components/filter/text/text.component.ts +0 -46
- package/src/lib/components/filters/filters.component.scss +0 -150
- package/src/lib/components/filters/filters.component.ts +0 -157
- package/src/lib/components/filters-config/filters-config.component.ts +0 -69
- package/src/lib/components/group/group.component.ts +0 -93
- package/src/lib/components/index.ts +0 -7
- package/src/lib/components/multiselect/multiselect.component.html +0 -41
- package/src/lib/components/multiselect/multiselect.component.scss +0 -125
- package/src/lib/components/multiselect/multiselect.component.ts +0 -104
- package/src/lib/crud-full.module.ts +0 -51
- package/src/lib/crud.config.ts +0 -79
- package/src/lib/crud.module.ts +0 -72
- package/src/lib/factories/list-pagination/list-pagination.factory.ts +0 -77
- package/src/lib/models/index.ts +0 -1
- package/src/lib/models/interfaces.ts +0 -34
- package/src/lib/pages/index.ts +0 -6
- package/src/lib/pages/item/base/base.component.ts +0 -54
- package/src/lib/pages/item/item.component.ts +0 -513
- package/src/lib/pages/item/standard/standard.component.scss +0 -0
- package/src/lib/pages/item/standard/standard.component.ts +0 -50
- package/src/lib/pages/list/base/base.component.ts +0 -29
- package/src/lib/pages/list/list.component.stories.ts +0 -77
- package/src/lib/pages/list/list.component.ts +0 -438
- package/src/lib/pages/list/standard/standard.component.ts +0 -42
- package/src/lib/pipes/form-options/form-options.pipe.ts +0 -61
- package/src/lib/pipes/index.ts +0 -2
- package/src/lib/pipes/pipes.module.ts +0 -9
- package/src/lib/providers/model-possibilities/model-possibilities.provider.ts +0 -19
- package/src/lib/services/crud/crud.service.spec.ts +0 -303
- package/src/lib/services/crud/crud.service.ts +0 -178
- package/src/lib/services/list-group/list-group.service.spec.ts +0 -87
- package/src/lib/services/list-group/list-group.service.ts +0 -65
- package/src/lib/services/page/page.service.spec.ts +0 -143
- package/src/lib/services/page/page.service.ts +0 -44
- package/src/lib/services/search/search.service.spec.ts +0 -134
- package/src/lib/services/search/search.service.ts +0 -42
- package/test-setup.ts +0 -0
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -31
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -10
- package/tslint.json +0 -10
package/src/lib/crud.config.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Injectable, Type } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
IIconButtonOptions,
|
|
5
|
-
ICellPipe,
|
|
6
|
-
InputBaseComponent,
|
|
7
|
-
ListMode,
|
|
8
|
-
PaginationMode,
|
|
9
|
-
} from '@smartsoft001/angular';
|
|
10
|
-
|
|
11
|
-
import { ICrudFilterQueryItem, ICrudListGroup } from './models';
|
|
12
|
-
|
|
13
|
-
@Injectable()
|
|
14
|
-
export class CrudConfig<T> {
|
|
15
|
-
apiUrl: string;
|
|
16
|
-
entity: string;
|
|
17
|
-
type?: any;
|
|
18
|
-
reducerFactory?: () => any;
|
|
19
|
-
baseQuery?: Array<ICrudFilterQueryItem>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Injectable()
|
|
23
|
-
export class CrudFullConfig<T> extends CrudConfig<T> {
|
|
24
|
-
type: any;
|
|
25
|
-
title: string;
|
|
26
|
-
details?:
|
|
27
|
-
| boolean
|
|
28
|
-
| {
|
|
29
|
-
cellPipe?: ICellPipe<T>;
|
|
30
|
-
components?: {
|
|
31
|
-
top?: any;
|
|
32
|
-
bottom?: any;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
edit?:
|
|
36
|
-
| boolean
|
|
37
|
-
| {
|
|
38
|
-
cellPipe?: ICellPipe<T>;
|
|
39
|
-
components?: {
|
|
40
|
-
top?: any;
|
|
41
|
-
bottom?: any;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
add?:
|
|
45
|
-
| boolean
|
|
46
|
-
| {
|
|
47
|
-
components?: {
|
|
48
|
-
top?: any;
|
|
49
|
-
bottom?: any;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
remove?: boolean;
|
|
53
|
-
search?: boolean;
|
|
54
|
-
export?: boolean;
|
|
55
|
-
pagination?: {
|
|
56
|
-
limit: number;
|
|
57
|
-
};
|
|
58
|
-
sort?:
|
|
59
|
-
| boolean
|
|
60
|
-
| {
|
|
61
|
-
default?: string;
|
|
62
|
-
defaultDesc?: boolean;
|
|
63
|
-
};
|
|
64
|
-
list?: {
|
|
65
|
-
cellPipe?: ICellPipe<T>;
|
|
66
|
-
components?: {
|
|
67
|
-
top?: any;
|
|
68
|
-
multi?: any;
|
|
69
|
-
};
|
|
70
|
-
mode?: ListMode;
|
|
71
|
-
paginationMode?: PaginationMode;
|
|
72
|
-
resetQuery?: 'beforeInit';
|
|
73
|
-
groups?: Array<ICrudListGroup>;
|
|
74
|
-
};
|
|
75
|
-
buttons?: Array<IIconButtonOptions>;
|
|
76
|
-
inputComponents?: {
|
|
77
|
-
[key: string]: Type<InputBaseComponent<T>>;
|
|
78
|
-
};
|
|
79
|
-
}
|
package/src/lib/crud.module.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { ModuleWithProviders, NgModule } from '@angular/core';
|
|
3
|
-
import { FormsModule } from '@angular/forms';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
FILE_SERVICE_CONFIG,
|
|
7
|
-
IFileServiceConfig,
|
|
8
|
-
SharedModule,
|
|
9
|
-
} from '@smartsoft001/angular';
|
|
10
|
-
import { IEntity } from '@smartsoft001/domain-core';
|
|
11
|
-
|
|
12
|
-
import { CrudFacade } from './+state/crud.facade';
|
|
13
|
-
import { CrudComponentsModule } from './components';
|
|
14
|
-
import { CrudFullModule } from './crud-full.module';
|
|
15
|
-
import { CrudConfig, CrudFullConfig } from './crud.config';
|
|
16
|
-
import { CrudListPaginationFactory } from './factories/list-pagination/list-pagination.factory';
|
|
17
|
-
import { CrudPipesModule } from './pipes';
|
|
18
|
-
import { CrudService } from './services/crud/crud.service';
|
|
19
|
-
import { CrudListGroupService } from './services/list-group/list-group.service';
|
|
20
|
-
import { PageService } from './services/page/page.service';
|
|
21
|
-
|
|
22
|
-
@NgModule({
|
|
23
|
-
imports: [
|
|
24
|
-
SharedModule,
|
|
25
|
-
CrudPipesModule,
|
|
26
|
-
FormsModule,
|
|
27
|
-
CommonModule,
|
|
28
|
-
CrudComponentsModule,
|
|
29
|
-
],
|
|
30
|
-
exports: [CrudComponentsModule],
|
|
31
|
-
providers: [
|
|
32
|
-
CrudService,
|
|
33
|
-
CrudListGroupService,
|
|
34
|
-
PageService,
|
|
35
|
-
CrudFacade,
|
|
36
|
-
CrudListPaginationFactory,
|
|
37
|
-
],
|
|
38
|
-
})
|
|
39
|
-
export class CrudCoreModule {}
|
|
40
|
-
|
|
41
|
-
@NgModule({})
|
|
42
|
-
export class CrudModule<T extends IEntity<string>> {
|
|
43
|
-
static forFeature<T extends IEntity<string>>(
|
|
44
|
-
options:
|
|
45
|
-
| ICrudModuleOptionsWithRoutng<T>
|
|
46
|
-
| ICrudModuleOptionsWithoutRoutng<T>,
|
|
47
|
-
): ModuleWithProviders<CrudModule<any>> {
|
|
48
|
-
return {
|
|
49
|
-
ngModule: options.routing ? CrudFullModule : CrudCoreModule,
|
|
50
|
-
providers: [
|
|
51
|
-
{ provide: CrudConfig, useValue: options.config },
|
|
52
|
-
{ provide: CrudFullConfig, useValue: options.config },
|
|
53
|
-
{
|
|
54
|
-
provide: FILE_SERVICE_CONFIG,
|
|
55
|
-
useValue: { apiUrl: options.config.apiUrl } as IFileServiceConfig,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface ICrudModuleOptionsWithRoutng<T> {
|
|
63
|
-
config: CrudFullConfig<T>;
|
|
64
|
-
socket?: boolean;
|
|
65
|
-
routing: true;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface ICrudModuleOptionsWithoutRoutng<T> {
|
|
69
|
-
config: CrudConfig<T>;
|
|
70
|
-
socket?: boolean;
|
|
71
|
-
routing: false;
|
|
72
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { computed, inject, Injectable } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import { IListPaginationOptions, PaginationMode } from '@smartsoft001/angular';
|
|
4
|
-
import { IEntity } from '@smartsoft001/domain-core';
|
|
5
|
-
|
|
6
|
-
import { CrudFacade } from '../../+state/crud.facade';
|
|
7
|
-
import { ICrudFilter } from '../../models';
|
|
8
|
-
|
|
9
|
-
@Injectable()
|
|
10
|
-
export class CrudListPaginationFactory<T extends IEntity<string>> {
|
|
11
|
-
private readonly facade = inject(CrudFacade<T>);
|
|
12
|
-
|
|
13
|
-
async create(options: {
|
|
14
|
-
mode?: PaginationMode;
|
|
15
|
-
limit: number;
|
|
16
|
-
provider: {
|
|
17
|
-
getLinks(): any;
|
|
18
|
-
getFilter(): ICrudFilter;
|
|
19
|
-
};
|
|
20
|
-
}): Promise<IListPaginationOptions> {
|
|
21
|
-
return {
|
|
22
|
-
mode: options.mode,
|
|
23
|
-
limit: options.limit,
|
|
24
|
-
loadNextPage: () => {
|
|
25
|
-
if (!options.provider.getLinks() || !options.provider.getLinks().next)
|
|
26
|
-
return Promise.resolve(false);
|
|
27
|
-
|
|
28
|
-
return new Promise((res) => {
|
|
29
|
-
if (this.facade.loaded()) {
|
|
30
|
-
setTimeout(() => {
|
|
31
|
-
res(
|
|
32
|
-
options.provider.getLinks() && options.provider.getLinks().next,
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const filter = options.provider.getFilter();
|
|
38
|
-
this.facade.read({
|
|
39
|
-
...filter,
|
|
40
|
-
offset: filter.offset + filter.limit,
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
loadPrevPage: () => {
|
|
45
|
-
if (!options.provider.getLinks() || !options.provider.getLinks().prev)
|
|
46
|
-
return Promise.resolve(false);
|
|
47
|
-
|
|
48
|
-
return new Promise((res) => {
|
|
49
|
-
const loaded = this.facade.loaded();
|
|
50
|
-
if (loaded) {
|
|
51
|
-
setTimeout(() => {
|
|
52
|
-
res(
|
|
53
|
-
options.provider.getLinks() && options.provider.getLinks().prev,
|
|
54
|
-
);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
this.facade.read({
|
|
59
|
-
...options.provider.getFilter(),
|
|
60
|
-
offset:
|
|
61
|
-
options.provider.getFilter().offset -
|
|
62
|
-
options.provider.getFilter().limit,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
page: computed(() => {
|
|
67
|
-
const f = this.facade.filter();
|
|
68
|
-
return f?.limit ? f.offset / f.limit + 1 : 0;
|
|
69
|
-
}),
|
|
70
|
-
totalPages: computed(() => {
|
|
71
|
-
const filter = this.facade.filter();
|
|
72
|
-
const totalCount = this.facade.totalCount();
|
|
73
|
-
return filter?.limit ? Math.ceil(totalCount / filter.limit) : 0;
|
|
74
|
-
}),
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
package/src/lib/models/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './interfaces';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { PaginationMode } from '@smartsoft001/angular';
|
|
2
|
-
import { IModelFilter } from '@smartsoft001/models';
|
|
3
|
-
|
|
4
|
-
export interface ICrudFilter {
|
|
5
|
-
searchText?: string;
|
|
6
|
-
sortBy?: string;
|
|
7
|
-
sortDesc?: boolean;
|
|
8
|
-
offset?: number;
|
|
9
|
-
limit?: number;
|
|
10
|
-
paginationMode?: PaginationMode;
|
|
11
|
-
query?: Array<ICrudFilterQueryItem>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ICrudFilterQueryItem extends IModelFilter {
|
|
15
|
-
key: string;
|
|
16
|
-
value: any;
|
|
17
|
-
type: '=' | '!=' | '>=' | '<=' | '<' | '>';
|
|
18
|
-
hidden?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ICrudCreateManyOptions {
|
|
22
|
-
mode: CrudCreateManyMode;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface ICrudListGroup {
|
|
26
|
-
key: string;
|
|
27
|
-
value: string;
|
|
28
|
-
text: string;
|
|
29
|
-
show?: boolean;
|
|
30
|
-
changed?: boolean;
|
|
31
|
-
children?: Array<ICrudListGroup>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type CrudCreateManyMode = 'default' | 'replace';
|
package/src/lib/pages/index.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from './item/base/base.component';
|
|
2
|
-
export * from './item/item.component';
|
|
3
|
-
export * from './item/standard/standard.component';
|
|
4
|
-
export * from './list/list.component';
|
|
5
|
-
export * from './list/base/base.component';
|
|
6
|
-
export * from './list/standard/standard.component';
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Directive,
|
|
3
|
-
inject,
|
|
4
|
-
input,
|
|
5
|
-
output,
|
|
6
|
-
Signal,
|
|
7
|
-
viewChild,
|
|
8
|
-
viewChildren,
|
|
9
|
-
ViewContainerRef,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
BaseComponent,
|
|
14
|
-
DynamicComponentType,
|
|
15
|
-
FormComponent,
|
|
16
|
-
IDetailsOptions,
|
|
17
|
-
} from '@smartsoft001/angular';
|
|
18
|
-
import { IEntity } from '@smartsoft001/domain-core';
|
|
19
|
-
|
|
20
|
-
import { CrudFacade } from '../../../+state/crud.facade';
|
|
21
|
-
import { CrudFullConfig } from '../../../crud.config';
|
|
22
|
-
|
|
23
|
-
@Directive()
|
|
24
|
-
export abstract class CrudItemPageBaseComponent<
|
|
25
|
-
T extends IEntity<string>,
|
|
26
|
-
> extends BaseComponent {
|
|
27
|
-
public config = inject(CrudFullConfig<T>);
|
|
28
|
-
public facade = inject(CrudFacade<T>);
|
|
29
|
-
|
|
30
|
-
static smartType: DynamicComponentType = 'crud-item-page';
|
|
31
|
-
|
|
32
|
-
selected: Signal<T>;
|
|
33
|
-
|
|
34
|
-
contentTpl = viewChild<ViewContainerRef>('contentTpl');
|
|
35
|
-
|
|
36
|
-
formComponents = viewChildren(FormComponent);
|
|
37
|
-
|
|
38
|
-
detailsOptions = input<IDetailsOptions<T>>();
|
|
39
|
-
|
|
40
|
-
mode = input<string>();
|
|
41
|
-
|
|
42
|
-
uniqueProvider = input<(values: Record<keyof T, any>) => Promise<boolean>>();
|
|
43
|
-
|
|
44
|
-
onPartialChange = output<Partial<T>>();
|
|
45
|
-
|
|
46
|
-
onChange = output<T>();
|
|
47
|
-
|
|
48
|
-
onValidChange = output<boolean>();
|
|
49
|
-
|
|
50
|
-
constructor() {
|
|
51
|
-
super();
|
|
52
|
-
this.selected = this.facade.selected;
|
|
53
|
-
}
|
|
54
|
-
}
|