mstate-angular 0.2.1 → 0.2.3
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/esm2022/lib/action-form/action-form.component.mjs +149 -0
- package/esm2022/lib/common/constant.mjs +5 -0
- package/esm2022/lib/common/enum.mjs +48 -0
- package/esm2022/lib/components/action-card/action-card.component.mjs +24 -0
- package/esm2022/lib/components/button/button.component.mjs +20 -0
- package/esm2022/lib/components/dropdown/dropdown.component.mjs +50 -0
- package/esm2022/lib/components/error-card/error-card.component.mjs +23 -0
- package/esm2022/lib/components/input-field/input-field.component.mjs +27 -0
- package/esm2022/lib/components/loader/loader.component.mjs +12 -0
- package/esm2022/lib/components/select/select.component.mjs +50 -0
- package/esm2022/lib/components/workflow-end-card/workflow-end-card.component.mjs +11 -0
- package/esm2022/lib/input-selector/input-selector.component.mjs +42 -0
- package/esm2022/lib/interfaces/api.interface.mjs +2 -0
- package/esm2022/lib/interfaces/interface.mjs +2 -0
- package/esm2022/lib/mstate-angular/mstate-angular.component.mjs +155 -0
- package/esm2022/lib/mstate-angular.helper.mjs +61 -0
- package/esm2022/lib/mstate-angular.module.mjs +18 -0
- package/esm2022/lib/mstate-angular.service.mjs +50 -0
- package/esm2022/mstate-angular.mjs +5 -0
- package/esm2022/public-api.mjs +6 -0
- package/fesm2022/mstate-angular.mjs +673 -0
- package/fesm2022/mstate-angular.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/action-form/action-form.component.d.ts +33 -0
- package/lib/common/constant.d.ts +2 -0
- package/lib/common/enum.d.ts +41 -0
- package/lib/components/action-card/action-card.component.d.ts +11 -0
- package/lib/components/button/button.component.d.ts +7 -0
- package/lib/components/dropdown/dropdown.component.d.ts +22 -0
- package/lib/components/error-card/error-card.component.d.ts +9 -0
- package/lib/components/input-field/input-field.component.d.ts +16 -0
- package/lib/components/loader/loader.component.d.ts +5 -0
- package/lib/components/select/select.component.d.ts +22 -0
- package/lib/components/workflow-end-card/workflow-end-card.component.d.ts +5 -0
- package/lib/input-selector/input-selector.component.d.ts +21 -0
- package/{src/lib/interfaces/api.interface.ts → lib/interfaces/api.interface.d.ts} +42 -51
- package/lib/interfaces/interface.d.ts +73 -0
- package/lib/mstate-angular/mstate-angular.component.d.ts +72 -0
- package/lib/mstate-angular.helper.d.ts +18 -0
- package/lib/mstate-angular.module.d.ts +9 -0
- package/lib/mstate-angular.service.d.ts +17 -0
- package/package.json +27 -14
- package/{src/public-api.ts → public-api.d.ts} +2 -6
- package/ng-package.json +0 -7
- package/src/lib/action-form/action-form.component.html +0 -13
- package/src/lib/action-form/action-form.component.scss +0 -0
- package/src/lib/action-form/action-form.component.spec.ts +0 -23
- package/src/lib/action-form/action-form.component.ts +0 -124
- package/src/lib/common/constant.ts +0 -4
- package/src/lib/common/enum.ts +0 -46
- package/src/lib/components/action-card/action-card.component.html +0 -1
- package/src/lib/components/action-card/action-card.component.scss +0 -0
- package/src/lib/components/action-card/action-card.component.spec.ts +0 -21
- package/src/lib/components/action-card/action-card.component.ts +0 -21
- package/src/lib/components/button/button.component.html +0 -3
- package/src/lib/components/button/button.component.scss +0 -0
- package/src/lib/components/button/button.component.spec.ts +0 -21
- package/src/lib/components/button/button.component.ts +0 -11
- package/src/lib/components/dropdown/dropdown.component.html +0 -10
- package/src/lib/components/dropdown/dropdown.component.scss +0 -0
- package/src/lib/components/dropdown/dropdown.component.spec.ts +0 -21
- package/src/lib/components/dropdown/dropdown.component.ts +0 -46
- package/src/lib/components/input-field/input-field.component.html +0 -9
- package/src/lib/components/input-field/input-field.component.scss +0 -0
- package/src/lib/components/input-field/input-field.component.spec.ts +0 -21
- package/src/lib/components/input-field/input-field.component.ts +0 -16
- package/src/lib/components/loader/loader.component.html +0 -1
- package/src/lib/components/loader/loader.component.scss +0 -0
- package/src/lib/components/loader/loader.component.spec.ts +0 -21
- package/src/lib/components/loader/loader.component.ts +0 -11
- package/src/lib/components/select/select.component.html +0 -10
- package/src/lib/components/select/select.component.scss +0 -43
- package/src/lib/components/select/select.component.spec.ts +0 -21
- package/src/lib/components/select/select.component.ts +0 -46
- package/src/lib/input-selector/input-selector.component.html +0 -23
- package/src/lib/input-selector/input-selector.component.scss +0 -0
- package/src/lib/input-selector/input-selector.component.spec.ts +0 -21
- package/src/lib/input-selector/input-selector.component.ts +0 -38
- package/src/lib/interfaces/interface.ts +0 -81
- package/src/lib/material.scss +0 -439
- package/src/lib/mstate-angular/mstate-angular.component.html +0 -40
- package/src/lib/mstate-angular/mstate-angular.component.scss +0 -36
- package/src/lib/mstate-angular/mstate-angular.component.spec.ts +0 -21
- package/src/lib/mstate-angular/mstate-angular.component.ts +0 -186
- package/src/lib/mstate-angular.helper.ts +0 -35
- package/src/lib/mstate-angular.module.ts +0 -9
- package/src/lib/mstate-angular.service.ts +0 -77
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
@@ -0,0 +1,9 @@
|
|
1
|
+
import * as i0 from "@angular/core";
|
2
|
+
import * as i1 from "@angular/common";
|
3
|
+
import * as i2 from "./mstate-angular/mstate-angular.component";
|
4
|
+
import * as i3 from "@angular/forms";
|
5
|
+
export declare class MstateAngularModule {
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MstateAngularModule, never>;
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<MstateAngularModule, never, [typeof i1.CommonModule, typeof i2.MstateAngularComponent, typeof i3.ReactiveFormsModule], [typeof i2.MstateAngularComponent]>;
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<MstateAngularModule>;
|
9
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
2
|
+
import { GetCurrentActionsWithInstanceIDRequest, GetCurrentActionsWithoutInstanceIDRequest, GetCurrentActionsWithoutInstanceIDResponse, MstateResponse, PostExecuteActionRequest, PostExecuteActionResponse } from './interfaces/api.interface';
|
3
|
+
import { AxiosRequestConfig } from 'axios';
|
4
|
+
import { MstateAngularHelper } from './mstate-angular.helper';
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
export declare class MstateAngularService {
|
7
|
+
private http;
|
8
|
+
private mstateHelper;
|
9
|
+
private getHeaders;
|
10
|
+
constructor(http: HttpClient, mstateHelper: MstateAngularHelper);
|
11
|
+
executeAction<T>(payload: PostExecuteActionRequest<T>): import("rxjs").Observable<MstateResponse<PostExecuteActionResponse>>;
|
12
|
+
getCurrentActionsWithInstanceID(payload: GetCurrentActionsWithInstanceIDRequest): import("rxjs").Observable<MstateResponse<GetCurrentActionsWithoutInstanceIDResponse>>;
|
13
|
+
getCurrentActionsWithoutInstanceID(payload: GetCurrentActionsWithoutInstanceIDRequest): import("rxjs").Observable<MstateResponse<GetCurrentActionsWithoutInstanceIDResponse>>;
|
14
|
+
handleDropdownAPI(request: AxiosRequestConfig, target: string): Promise<any>;
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MstateAngularService, never>;
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MstateAngularService>;
|
17
|
+
}
|
package/package.json
CHANGED
@@ -1,14 +1,27 @@
|
|
1
|
-
{
|
2
|
-
"name": "mstate-angular",
|
3
|
-
"version": "0.2.
|
4
|
-
"peerDependencies": {
|
5
|
-
"@angular/common": "^17.3.0",
|
6
|
-
"@angular/core": "^17.3.0",
|
7
|
-
"@ng-select/ng-select": "^14.1.0",
|
8
|
-
"axios": "^1.7.9"
|
9
|
-
},
|
10
|
-
"dependencies": {
|
11
|
-
"tslib": "^2.3.0"
|
12
|
-
},
|
13
|
-
"sideEffects": false
|
14
|
-
|
1
|
+
{
|
2
|
+
"name": "mstate-angular",
|
3
|
+
"version": "0.2.3",
|
4
|
+
"peerDependencies": {
|
5
|
+
"@angular/common": "^17.3.0",
|
6
|
+
"@angular/core": "^17.3.0",
|
7
|
+
"@ng-select/ng-select": "^14.1.0",
|
8
|
+
"axios": "^1.7.9"
|
9
|
+
},
|
10
|
+
"dependencies": {
|
11
|
+
"tslib": "^2.3.0"
|
12
|
+
},
|
13
|
+
"sideEffects": false,
|
14
|
+
"module": "fesm2022/mstate-angular.mjs",
|
15
|
+
"typings": "index.d.ts",
|
16
|
+
"exports": {
|
17
|
+
"./package.json": {
|
18
|
+
"default": "./package.json"
|
19
|
+
},
|
20
|
+
".": {
|
21
|
+
"types": "./index.d.ts",
|
22
|
+
"esm2022": "./esm2022/mstate-angular.mjs",
|
23
|
+
"esm": "./esm2022/mstate-angular.mjs",
|
24
|
+
"default": "./fesm2022/mstate-angular.mjs"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -1,6 +1,2 @@
|
|
1
|
-
|
2
|
-
*
|
3
|
-
*/
|
4
|
-
|
5
|
-
export * from './lib/mstate-angular/mstate-angular.component';
|
6
|
-
export * from './lib/mstate-angular.module';
|
1
|
+
export * from './lib/mstate-angular/mstate-angular.component';
|
2
|
+
export * from './lib/mstate-angular.module';
|
package/ng-package.json
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
<div>
|
2
|
-
<h4>{{ config.meta?.title ?? config.name }}</h4>
|
3
|
-
|
4
|
-
<form #userForm="ngForm">
|
5
|
-
@for (step of config.steps; track $index) {
|
6
|
-
<mobi-office-input-selector [step]="step" [mstateModel]="mstateModel" />
|
7
|
-
}
|
8
|
-
</form>
|
9
|
-
|
10
|
-
<mobi-office-button (click)="handleExecuteAction()"
|
11
|
-
>Submit</mobi-office-button
|
12
|
-
>
|
13
|
-
</div>
|
File without changes
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
2
|
-
|
3
|
-
import { ActionFormComponent } from './action-form.component';
|
4
|
-
|
5
|
-
describe('ActionFormComponent', () => {
|
6
|
-
let component: ActionFormComponent;
|
7
|
-
let fixture: ComponentFixture<ActionFormComponent>;
|
8
|
-
|
9
|
-
beforeEach(async () => {
|
10
|
-
await TestBed.configureTestingModule({
|
11
|
-
imports: [ActionFormComponent]
|
12
|
-
})
|
13
|
-
.compileComponents();
|
14
|
-
|
15
|
-
fixture = TestBed.createComponent(ActionFormComponent);
|
16
|
-
component = fixture.componentInstance;
|
17
|
-
fixture.detectChanges();
|
18
|
-
});
|
19
|
-
|
20
|
-
it('should create', () => {
|
21
|
-
expect(component).toBeTruthy();
|
22
|
-
});
|
23
|
-
});
|
@@ -1,124 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
Component,
|
3
|
-
Input,
|
4
|
-
OnChanges,
|
5
|
-
OnInit,
|
6
|
-
SimpleChanges,
|
7
|
-
} from '@angular/core';
|
8
|
-
import { MstateAngularService } from '../mstate-angular.service';
|
9
|
-
import { catchError, finalize } from 'rxjs';
|
10
|
-
import { ActionConfig, UserInput } from '../interfaces/interface';
|
11
|
-
import { EvaluatedAction } from '../interfaces/api.interface';
|
12
|
-
import { ActionType, ManualStepModule } from '../common/enum';
|
13
|
-
import { InputSelectorComponent } from '../input-selector/input-selector.component';
|
14
|
-
import { ButtonComponent } from '../components/button/button.component';
|
15
|
-
import { FormsModule } from '@angular/forms';
|
16
|
-
import { MstateAngularHelper } from '../mstate-angular.helper';
|
17
|
-
|
18
|
-
@Component({
|
19
|
-
selector: 'lib-action-form',
|
20
|
-
standalone: true,
|
21
|
-
imports: [FormsModule, InputSelectorComponent, ButtonComponent],
|
22
|
-
providers: [MstateAngularService, MstateAngularHelper],
|
23
|
-
templateUrl: './action-form.component.html',
|
24
|
-
styleUrl: './action-form.component.scss',
|
25
|
-
})
|
26
|
-
export class ActionFormComponent implements OnInit, OnChanges {
|
27
|
-
@Input({ required: true }) token: string = '';
|
28
|
-
@Input({ required: true }) workflow: string = '';
|
29
|
-
@Input({ required: true }) config: ActionConfig | EvaluatedAction = {
|
30
|
-
name: '',
|
31
|
-
type: ActionType.MANUAL,
|
32
|
-
steps: [],
|
33
|
-
};
|
34
|
-
@Input({ required: true }) onExecuteAction: (
|
35
|
-
response: any,
|
36
|
-
errors?: string[]
|
37
|
-
) => void = () => {};
|
38
|
-
@Input() updateCustomFieldValue?: (key: string) => unknown;
|
39
|
-
|
40
|
-
@Input() instanceID?: string;
|
41
|
-
@Input() onSuccess?: (actionName: string) => void;
|
42
|
-
|
43
|
-
//#region Custom Declaration
|
44
|
-
protected isLoading = true;
|
45
|
-
protected mstateModel: any = {};
|
46
|
-
|
47
|
-
constructor(
|
48
|
-
private mstateAngularService: MstateAngularService,
|
49
|
-
private mstateAngularHelper: MstateAngularHelper
|
50
|
-
) {}
|
51
|
-
|
52
|
-
ngOnInit(): void {
|
53
|
-
if (Boolean(this.config?.steps?.length) === false) {
|
54
|
-
this.handleExecuteAction();
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
|
58
|
-
this.handleStepConfigFilter();
|
59
|
-
}
|
60
|
-
|
61
|
-
ngOnChanges(changes: SimpleChanges): void {
|
62
|
-
console.log({ changes });
|
63
|
-
if (this.mstateAngularHelper.detectChange(changes, ['mstateModel'])) {
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
//#region handlers
|
68
|
-
|
69
|
-
protected handleExecuteAction() {
|
70
|
-
this.isLoading = true;
|
71
|
-
console.log(this.mstateModel);
|
72
|
-
// this.mstateAngularService
|
73
|
-
// .executeAction({
|
74
|
-
// action: {
|
75
|
-
// name: this.config.name,
|
76
|
-
// payload: this.mstateModel,
|
77
|
-
// },
|
78
|
-
// token: this.token,
|
79
|
-
// workflow: this.workflow,
|
80
|
-
// })
|
81
|
-
// .pipe(
|
82
|
-
// catchError(e => {
|
83
|
-
// throw e;
|
84
|
-
// }),
|
85
|
-
// finalize(() => {
|
86
|
-
// this.isLoading = false;
|
87
|
-
// })
|
88
|
-
// )
|
89
|
-
// .subscribe(data => {
|
90
|
-
// this.onExecuteAction(data.data);
|
91
|
-
// });
|
92
|
-
}
|
93
|
-
|
94
|
-
private handleStepConfigFilter = () => {
|
95
|
-
const keyForAPISet = new Set();
|
96
|
-
|
97
|
-
this.config.steps = this.config?.steps?.filter(stepConfig => {
|
98
|
-
const step = stepConfig as UserInput;
|
99
|
-
|
100
|
-
switch (step?.module) {
|
101
|
-
case ManualStepModule.CUSTOM_FIELD: {
|
102
|
-
if (this.updateCustomFieldValue) {
|
103
|
-
this.mstateModel[step?.context?.as] = this.updateCustomFieldValue(
|
104
|
-
step?.context?.key
|
105
|
-
);
|
106
|
-
}
|
107
|
-
return true;
|
108
|
-
}
|
109
|
-
|
110
|
-
case ManualStepModule.CONTEXT_FIELD:
|
111
|
-
this.mstateModel[step?.context?.as] = step?.context?.value;
|
112
|
-
return true;
|
113
|
-
|
114
|
-
default: {
|
115
|
-
const isDuplicate = keyForAPISet.has(step?.field?.keyForAPI);
|
116
|
-
keyForAPISet.add(step?.field?.keyForAPI);
|
117
|
-
return isDuplicate === false;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}) as UserInput[];
|
121
|
-
};
|
122
|
-
|
123
|
-
//#endregion
|
124
|
-
}
|
package/src/lib/common/enum.ts
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
export enum Route {
|
2
|
-
EXECUTE_ACTION = 'workflow/v2/execute',
|
3
|
-
GET_WORKFLOW_CONFIG = 'workflow/config',
|
4
|
-
GET_CURRENT_ACTIONS_WITHOUT_INSTANCE = 'workflow/v2/actions',
|
5
|
-
GET_CURRENT_ACTIONS_WITH_INSTANCE = 'workflow/actions',
|
6
|
-
}
|
7
|
-
|
8
|
-
export enum FieldType {
|
9
|
-
DATE_PICKER = 'datePicker',
|
10
|
-
TIME_PICKER = 'timePicker',
|
11
|
-
INPUT_FIELD = 'inputField',
|
12
|
-
TEXT_AREA = 'textArea',
|
13
|
-
CHECKBOX = 'checkBox',
|
14
|
-
RADIO_LIST = 'radioList',
|
15
|
-
DROP_DOWN = 'dropDown',
|
16
|
-
SUMMARY = 'summary',
|
17
|
-
CONTEXT_FIELD = 'CONTEXT_FIELD',
|
18
|
-
CUSTOM_FIELD = 'CUSTOM_FIELD',
|
19
|
-
}
|
20
|
-
|
21
|
-
export enum ManualStepModule {
|
22
|
-
CONTEXT_FIELD = 'CONTEXT_FIELD',
|
23
|
-
CUSTOM_FIELD = 'CUSTOM_FIELD',
|
24
|
-
USER_INPUT = 'USER_INPUT',
|
25
|
-
}
|
26
|
-
|
27
|
-
export enum Theme {
|
28
|
-
DARK = 'dark',
|
29
|
-
LIGHT = 'light',
|
30
|
-
SYSTEM = 'system',
|
31
|
-
}
|
32
|
-
|
33
|
-
export enum Variable {
|
34
|
-
WORKFLOW = 'workflow',
|
35
|
-
TOKEN = 'token',
|
36
|
-
INSTANCE_ID = 'instanceID',
|
37
|
-
START = 'start',
|
38
|
-
TRIGGER_AGAIN = 'triggerAgain',
|
39
|
-
ERRORS = 'errors',
|
40
|
-
}
|
41
|
-
|
42
|
-
export enum ActionType {
|
43
|
-
MANUAL = 'MANUAL',
|
44
|
-
AUTO = 'AUTO',
|
45
|
-
CHAINED = 'CHAINED',
|
46
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
<p>action-card works!</p>
|
File without changes
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
2
|
-
import { ActionCardComponent } from './action-card.component';
|
3
|
-
|
4
|
-
describe('ActionCardComponent', () => {
|
5
|
-
let component: ActionCardComponent;
|
6
|
-
let fixture: ComponentFixture<ActionCardComponent>;
|
7
|
-
|
8
|
-
beforeEach(async () => {
|
9
|
-
await TestBed.configureTestingModule({
|
10
|
-
imports: [ActionCardComponent],
|
11
|
-
}).compileComponents();
|
12
|
-
|
13
|
-
fixture = TestBed.createComponent(ActionCardComponent);
|
14
|
-
component = fixture.componentInstance;
|
15
|
-
fixture.detectChanges();
|
16
|
-
});
|
17
|
-
|
18
|
-
it('should create', () => {
|
19
|
-
expect(component).toBeTruthy();
|
20
|
-
});
|
21
|
-
});
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
2
|
-
import { CommonModule } from '@angular/common';
|
3
|
-
import { EvaluatedAction } from '../../interfaces/api.interface';
|
4
|
-
import { ActionConfig } from '../../interfaces/interface';
|
5
|
-
|
6
|
-
@Component({
|
7
|
-
selector: 'mobi-office-action-card',
|
8
|
-
standalone: true,
|
9
|
-
imports: [CommonModule],
|
10
|
-
templateUrl: './action-card.component.html',
|
11
|
-
styleUrl: './action-card.component.scss',
|
12
|
-
})
|
13
|
-
export class ActionCardComponent {
|
14
|
-
@Input({ required: true }) error?: EvaluatedAction | ActionConfig;
|
15
|
-
|
16
|
-
@Output() retryEmitter = new EventEmitter<EvaluatedAction | ActionConfig>();
|
17
|
-
|
18
|
-
handleRetry() {
|
19
|
-
this.retryEmitter.emit(this.error);
|
20
|
-
}
|
21
|
-
}
|
File without changes
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
2
|
-
import { ButtonComponent } from './button.component';
|
3
|
-
|
4
|
-
describe('ButtonComponent', () => {
|
5
|
-
let component: ButtonComponent;
|
6
|
-
let fixture: ComponentFixture<ButtonComponent>;
|
7
|
-
|
8
|
-
beforeEach(async () => {
|
9
|
-
await TestBed.configureTestingModule({
|
10
|
-
imports: [ButtonComponent],
|
11
|
-
}).compileComponents();
|
12
|
-
|
13
|
-
fixture = TestBed.createComponent(ButtonComponent);
|
14
|
-
component = fixture.componentInstance;
|
15
|
-
fixture.detectChanges();
|
16
|
-
});
|
17
|
-
|
18
|
-
it('should create', () => {
|
19
|
-
expect(component).toBeTruthy();
|
20
|
-
});
|
21
|
-
});
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { Component } from '@angular/core';
|
2
|
-
import { CommonModule } from '@angular/common';
|
3
|
-
|
4
|
-
@Component({
|
5
|
-
selector: 'mobi-office-button',
|
6
|
-
standalone: true,
|
7
|
-
imports: [CommonModule],
|
8
|
-
templateUrl: './button.component.html',
|
9
|
-
styleUrl: './button.component.scss',
|
10
|
-
})
|
11
|
-
export class ButtonComponent {}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<div class="form-group">
|
2
|
-
<ng-select
|
3
|
-
[items]="list"
|
4
|
-
[multiple]="config.field.placeholder"
|
5
|
-
[bindLabel]="this.config.field.mapper?.label ?? 'label'"
|
6
|
-
[placeholder]="config.field.placeholder"
|
7
|
-
[(ngModel)]="mstateModel[config.field.keyForAPI]"
|
8
|
-
>
|
9
|
-
</ng-select>
|
10
|
-
</div>
|
File without changes
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
2
|
-
import { DropdownComponent } from './dropdown.component';
|
3
|
-
|
4
|
-
describe('DropdownComponent', () => {
|
5
|
-
let component: DropdownComponent;
|
6
|
-
let fixture: ComponentFixture<DropdownComponent>;
|
7
|
-
|
8
|
-
beforeEach(async () => {
|
9
|
-
await TestBed.configureTestingModule({
|
10
|
-
imports: [DropdownComponent],
|
11
|
-
}).compileComponents();
|
12
|
-
|
13
|
-
fixture = TestBed.createComponent(DropdownComponent);
|
14
|
-
component = fixture.componentInstance;
|
15
|
-
fixture.detectChanges();
|
16
|
-
});
|
17
|
-
|
18
|
-
it('should create', () => {
|
19
|
-
expect(component).toBeTruthy();
|
20
|
-
});
|
21
|
-
});
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
2
|
-
import { CommonModule } from '@angular/common';
|
3
|
-
import { UserInput } from '../../interfaces/interface';
|
4
|
-
import { FormsModule } from '@angular/forms';
|
5
|
-
import { MstateAngularService } from '../../mstate-angular.service';
|
6
|
-
import { MstateAngularHelper } from '../../mstate-angular.helper';
|
7
|
-
import { NgSelectModule } from '@ng-select/ng-select';
|
8
|
-
|
9
|
-
@Component({
|
10
|
-
selector: 'mobi-office-dropdown',
|
11
|
-
standalone: true,
|
12
|
-
imports: [FormsModule, NgSelectModule, CommonModule],
|
13
|
-
providers: [MstateAngularService],
|
14
|
-
templateUrl: './dropdown.component.html',
|
15
|
-
styleUrl: './dropdown.component.scss',
|
16
|
-
})
|
17
|
-
export class DropdownComponent implements OnInit {
|
18
|
-
@Input({ required: true }) config!: UserInput;
|
19
|
-
@Input({ required: true }) mstateModel!: any;
|
20
|
-
|
21
|
-
constructor(
|
22
|
-
private mstateService: MstateAngularService,
|
23
|
-
private mstateHelper: MstateAngularHelper
|
24
|
-
) {}
|
25
|
-
|
26
|
-
protected list: any[] = [];
|
27
|
-
|
28
|
-
ngOnInit(): void {
|
29
|
-
const field = this.config.field ?? {};
|
30
|
-
|
31
|
-
if (field.request) {
|
32
|
-
this.mstateService
|
33
|
-
.handleDropdownAPI(field.request, field?.mapper?.target ?? '')
|
34
|
-
.then((data) => {
|
35
|
-
this.list = data;
|
36
|
-
})
|
37
|
-
.catch((e) => console.log(e));
|
38
|
-
} else {
|
39
|
-
this.list = field.itemList ?? [];
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
getObjectValue(obj: any, target: string) {
|
44
|
-
return this.mstateHelper.getObjectValue(obj, target);
|
45
|
-
}
|
46
|
-
}
|
File without changes
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
2
|
-
import { InputFieldComponent } from './input-field.component';
|
3
|
-
|
4
|
-
describe('InputFieldComponent', () => {
|
5
|
-
let component: InputFieldComponent;
|
6
|
-
let fixture: ComponentFixture<InputFieldComponent>;
|
7
|
-
|
8
|
-
beforeEach(async () => {
|
9
|
-
await TestBed.configureTestingModule({
|
10
|
-
imports: [InputFieldComponent],
|
11
|
-
}).compileComponents();
|
12
|
-
|
13
|
-
fixture = TestBed.createComponent(InputFieldComponent);
|
14
|
-
component = fixture.componentInstance;
|
15
|
-
fixture.detectChanges();
|
16
|
-
});
|
17
|
-
|
18
|
-
it('should create', () => {
|
19
|
-
expect(component).toBeTruthy();
|
20
|
-
});
|
21
|
-
});
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
2
|
-
import { CommonModule } from '@angular/common';
|
3
|
-
import { UserInput } from '../../interfaces/interface';
|
4
|
-
import { FormsModule } from '@angular/forms';
|
5
|
-
|
6
|
-
@Component({
|
7
|
-
selector: 'mobi-office-input-field',
|
8
|
-
standalone: true,
|
9
|
-
imports: [CommonModule, FormsModule],
|
10
|
-
templateUrl: './input-field.component.html',
|
11
|
-
styleUrl: './input-field.component.scss',
|
12
|
-
})
|
13
|
-
export class InputFieldComponent {
|
14
|
-
@Input({ required: true }) config!: UserInput;
|
15
|
-
@Input({ required: true }) mstateModel!: any;
|
16
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
<p>Loading...</p>
|
File without changes
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
2
|
-
import { LoaderComponent } from './loader.component';
|
3
|
-
|
4
|
-
describe('LoaderComponent', () => {
|
5
|
-
let component: LoaderComponent;
|
6
|
-
let fixture: ComponentFixture<LoaderComponent>;
|
7
|
-
|
8
|
-
beforeEach(async () => {
|
9
|
-
await TestBed.configureTestingModule({
|
10
|
-
imports: [LoaderComponent],
|
11
|
-
}).compileComponents();
|
12
|
-
|
13
|
-
fixture = TestBed.createComponent(LoaderComponent);
|
14
|
-
component = fixture.componentInstance;
|
15
|
-
fixture.detectChanges();
|
16
|
-
});
|
17
|
-
|
18
|
-
it('should create', () => {
|
19
|
-
expect(component).toBeTruthy();
|
20
|
-
});
|
21
|
-
});
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { Component } from '@angular/core';
|
2
|
-
import { CommonModule } from '@angular/common';
|
3
|
-
|
4
|
-
@Component({
|
5
|
-
selector: 'mobi-office-loader',
|
6
|
-
standalone: true,
|
7
|
-
imports: [CommonModule],
|
8
|
-
templateUrl: './loader.component.html',
|
9
|
-
styleUrl: './loader.component.scss',
|
10
|
-
})
|
11
|
-
export class LoaderComponent {}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<div class="form-group">
|
2
|
-
<ng-select
|
3
|
-
[items]="list"
|
4
|
-
[multiple]="config.field.placeholder"
|
5
|
-
[bindLabel]="this.config.field.mapper?.label ?? 'label'"
|
6
|
-
[placeholder]="config.field.placeholder"
|
7
|
-
[(ngModel)]="mstateModel[config.field.keyForAPI]"
|
8
|
-
>
|
9
|
-
</ng-select>
|
10
|
-
</div>
|
@@ -1,43 +0,0 @@
|
|
1
|
-
.dropdown {
|
2
|
-
position: relative;
|
3
|
-
width: 300px;
|
4
|
-
}
|
5
|
-
|
6
|
-
.search-input {
|
7
|
-
width: 100%;
|
8
|
-
padding: 8px;
|
9
|
-
border: 1px solid #ccc;
|
10
|
-
border-radius: 4px;
|
11
|
-
}
|
12
|
-
|
13
|
-
.dropdown-menu {
|
14
|
-
position: absolute;
|
15
|
-
width: 100%;
|
16
|
-
max-height: 150px;
|
17
|
-
overflow-y: auto;
|
18
|
-
background: white;
|
19
|
-
border: 1px solid #ccc;
|
20
|
-
border-radius: 4px;
|
21
|
-
margin-top: 5px;
|
22
|
-
z-index: 10;
|
23
|
-
}
|
24
|
-
|
25
|
-
.dropdown-item {
|
26
|
-
padding: 8px;
|
27
|
-
cursor: pointer;
|
28
|
-
}
|
29
|
-
|
30
|
-
.dropdown-item:hover {
|
31
|
-
background-color: #f0f0f0;
|
32
|
-
}
|
33
|
-
|
34
|
-
.no-results {
|
35
|
-
padding: 8px;
|
36
|
-
color: #888;
|
37
|
-
text-align: center;
|
38
|
-
}
|
39
|
-
|
40
|
-
.selected-option {
|
41
|
-
margin-top: 10px;
|
42
|
-
font-weight: bold;
|
43
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
2
|
-
import { SelectComponent } from './select.component';
|
3
|
-
|
4
|
-
describe('SelectComponent', () => {
|
5
|
-
let component: SelectComponent;
|
6
|
-
let fixture: ComponentFixture<SelectComponent>;
|
7
|
-
|
8
|
-
beforeEach(async () => {
|
9
|
-
await TestBed.configureTestingModule({
|
10
|
-
imports: [SelectComponent],
|
11
|
-
}).compileComponents();
|
12
|
-
|
13
|
-
fixture = TestBed.createComponent(SelectComponent);
|
14
|
-
component = fixture.componentInstance;
|
15
|
-
fixture.detectChanges();
|
16
|
-
});
|
17
|
-
|
18
|
-
it('should create', () => {
|
19
|
-
expect(component).toBeTruthy();
|
20
|
-
});
|
21
|
-
});
|