@mediusinc/mng-commons 6.0.0-rc.2 → 6.0.0-rc.4
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/core/helpers/notification.d.ts +17 -1
- package/core/i18n/i18n-error.d.ts +2 -3
- package/core/router/route-builder.d.ts +1 -1
- package/esm2022/core/helpers/notification.mjs +19 -4
- package/esm2022/core/i18n/i18n-error.mjs +10 -8
- package/esm2022/core/router/route-builder.mjs +2 -2
- package/esm2022/form/api/descriptors/action-button.descriptor.mjs +5 -17
- package/esm2022/form/api/descriptors/button-style.builder.mjs +80 -101
- package/esm2022/form/api/index.mjs +2 -1
- package/esm2022/form/api/models/button.model.mjs +2 -0
- package/esm2022/model/helpers/i18n.mjs +14 -9
- package/esm2022/table/components/column-value/column-value.component.mjs +4 -3
- package/esm2022/table/components/table/table.component.mjs +12 -11
- package/esm2022/table/helpers/notification.mjs +19 -13
- package/esm2022/tableview/action/components/action/action.component.mjs +41 -37
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +13 -8
- package/esm2022/tableview/action/helpers/i18n.mjs +50 -30
- package/esm2022/tableview/action/helpers/notification.mjs +73 -12
- package/esm2022/tableview/action/helpers/styles.mjs +2 -2
- package/esm2022/tableview/action/services/action-executor.service.mjs +83 -66
- package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +34 -21
- package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +4 -4
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +49 -67
- package/esm2022/tableview/api/action/models/action-confirmation.model.mjs +2 -0
- package/esm2022/tableview/api/action/models/action-descriptor.types.mjs +1 -1
- package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +14 -8
- package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +1 -1
- package/esm2022/tableview/api/index.mjs +2 -2
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +67 -37
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +5 -8
- package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +7 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +29 -18
- package/esm2022/tableview/provide.mjs +44 -1
- package/fesm2022/mediusinc-mng-commons-core.mjs +29 -12
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form-api.mjs +137 -169
- package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-model.mjs +13 -8
- package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +32 -24
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +165 -215
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +358 -197
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/form/api/descriptors/action-button.descriptor.d.ts +11 -13
- package/form/api/descriptors/button-style.builder.d.ts +30 -44
- package/form/api/index.d.ts +1 -0
- package/form/api/models/button.model.d.ts +19 -0
- package/i18n/sl.json +56 -6
- package/model/helpers/i18n.d.ts +8 -3
- package/package.json +1 -1
- package/table/components/column-value/column-value.component.d.ts +1 -0
- package/table/components/table/table.component.d.ts +0 -1
- package/table/helpers/notification.d.ts +10 -1
- package/tableview/action/components/action/action.component.d.ts +8 -11
- package/tableview/action/helpers/i18n.d.ts +36 -11
- package/tableview/action/helpers/notification.d.ts +37 -3
- package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +18 -8
- package/tableview/api/action/descriptors/action.descriptor.d.ts +22 -31
- package/tableview/api/action/models/action-confirmation.model.d.ts +14 -0
- package/tableview/api/action/models/action-descriptor.types.d.ts +4 -0
- package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +5 -5
- package/tableview/api/index.d.ts +1 -1
- package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +1 -1
- package/tableview/provide.d.ts +7 -0
- package/version-info.json +6 -6
- package/esm2022/tableview/api/action/descriptors/action-confirmation.descriptor.mjs +0 -88
- package/tableview/api/action/descriptors/action-confirmation.descriptor.d.ts +0 -37
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class ActionButtonDescriptor {
|
|
1
|
+
import { IActionButtonDescriptor, IButtonStyleDescriptor } from '../models/button.model';
|
|
2
|
+
export declare class ActionButtonDescriptor implements IActionButtonDescriptor {
|
|
3
3
|
private _label?;
|
|
4
4
|
private _icon?;
|
|
5
|
-
private _iconPosition
|
|
6
|
-
private _styleClass
|
|
5
|
+
private _iconPosition?;
|
|
6
|
+
private _styleClass?;
|
|
7
7
|
private _badge?;
|
|
8
8
|
private _tooltip?;
|
|
9
9
|
private _tooltipPosition?;
|
|
10
10
|
withLabel(label?: string | null): this;
|
|
11
|
-
withIcon(icon: string | null): this;
|
|
12
|
-
|
|
13
|
-
withStyleClass(style: ButtonStyleBuilder): this;
|
|
11
|
+
withIcon(icon: string | null, iconPosition?: 'left' | 'right'): this;
|
|
12
|
+
withStyle(style?: IButtonStyleDescriptor): this;
|
|
14
13
|
withBadge(badge: string): this;
|
|
15
|
-
withTooltip(tooltip: string, position?: 'top' | 'bottom' | 'left' | 'right'): this;
|
|
16
|
-
withTooltipPosition(position: 'top' | 'bottom' | 'left' | 'right'): this;
|
|
14
|
+
withTooltip(tooltip: string | null, position?: 'top' | 'bottom' | 'left' | 'right'): this;
|
|
17
15
|
get label(): string | null | undefined;
|
|
18
16
|
get icon(): string | null | undefined;
|
|
19
|
-
get iconPosition(): "left" | "right";
|
|
20
|
-
get
|
|
17
|
+
get iconPosition(): "left" | "right" | undefined;
|
|
18
|
+
get style(): IButtonStyleDescriptor | undefined;
|
|
21
19
|
get badge(): string | undefined;
|
|
22
|
-
get tooltip(): string | undefined;
|
|
23
|
-
get tooltipPosition(): "
|
|
20
|
+
get tooltip(): string | null | undefined;
|
|
21
|
+
get tooltipPosition(): "left" | "right" | "top" | "bottom" | undefined;
|
|
24
22
|
copy(): ActionButtonDescriptor;
|
|
25
23
|
}
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import { StyleLevelEnum, StyleSizeEnum } from '@mediusinc/mng-commons/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
private
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @param customClass additional custom classes (will be added at generating)
|
|
20
|
-
*/
|
|
21
|
-
static create(actionLevel?: StyleLevelEnum, size?: StyleSizeEnum, textButton?: boolean, outlineButton?: boolean, raisedButton?: boolean, roundedButton?: ButtonStyleRoundedEnum, customClass?: string): ButtonStyleBuilder;
|
|
2
|
+
import { IButtonStyleDescriptor } from '../models/button.model';
|
|
3
|
+
export declare class ButtonStyleBuilder implements IButtonStyleDescriptor {
|
|
4
|
+
private _level?;
|
|
5
|
+
private _size?;
|
|
6
|
+
private _textButton?;
|
|
7
|
+
private _outlined?;
|
|
8
|
+
private _raised?;
|
|
9
|
+
private _rounded?;
|
|
10
|
+
private _class?;
|
|
11
|
+
static from(opts?: IButtonStyleDescriptor): ButtonStyleBuilder;
|
|
12
|
+
get level(): StyleLevelEnum | undefined;
|
|
13
|
+
get size(): StyleSizeEnum | undefined;
|
|
14
|
+
get textButton(): boolean | undefined;
|
|
15
|
+
get outlined(): boolean | undefined;
|
|
16
|
+
get raised(): boolean | undefined;
|
|
17
|
+
get rounded(): boolean | undefined;
|
|
18
|
+
get class(): string | undefined;
|
|
22
19
|
/**
|
|
23
20
|
* sets custom action level and returns this object
|
|
24
|
-
* @param
|
|
21
|
+
* @param level
|
|
25
22
|
*/
|
|
26
|
-
|
|
23
|
+
withLevel(level: StyleLevelEnum): ButtonStyleBuilder;
|
|
27
24
|
/**
|
|
28
25
|
* sets custom size and return this object
|
|
29
26
|
* @param size
|
|
@@ -31,38 +28,27 @@ export declare class ButtonStyleBuilder {
|
|
|
31
28
|
withSize(size: StyleSizeEnum): ButtonStyleBuilder;
|
|
32
29
|
/**
|
|
33
30
|
* sets text button property
|
|
34
|
-
* @param
|
|
31
|
+
* @param text default true
|
|
35
32
|
*/
|
|
36
|
-
withTextButton(
|
|
33
|
+
withTextButton(text?: boolean): ButtonStyleBuilder;
|
|
37
34
|
/**
|
|
38
35
|
* sets outline button property
|
|
39
|
-
* @param
|
|
36
|
+
* @param outlined default true
|
|
40
37
|
*/
|
|
41
|
-
|
|
38
|
+
withOutlined(outlined?: boolean): ButtonStyleBuilder;
|
|
42
39
|
/**
|
|
43
40
|
* sets raised button property
|
|
44
|
-
* @param
|
|
41
|
+
* @param raised default true
|
|
45
42
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
withRaised(raised?: boolean): ButtonStyleBuilder;
|
|
44
|
+
withRounded(rounded?: boolean): ButtonStyleBuilder;
|
|
48
45
|
/**
|
|
49
46
|
* sets custom style class
|
|
50
47
|
* @param customClass
|
|
51
48
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
private convertSizeToStyleClass;
|
|
49
|
+
withClass(customClass: string): ButtonStyleBuilder;
|
|
50
|
+
build(hasNoTitle?: boolean): string;
|
|
55
51
|
copy(): ButtonStyleBuilder;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
get textButton(): boolean;
|
|
59
|
-
get outlineButton(): boolean;
|
|
60
|
-
get raisedButton(): boolean;
|
|
61
|
-
get roundedStyle(): ButtonStyleRoundedEnum;
|
|
62
|
-
get customClass(): string | undefined;
|
|
63
|
-
}
|
|
64
|
-
export declare enum ButtonStyleRoundedEnum {
|
|
65
|
-
DEFAULT = 0,
|
|
66
|
-
ROUNDED = 1,
|
|
67
|
-
SQUARE = 2
|
|
52
|
+
private levelToStyleClass;
|
|
53
|
+
private sizeToStyleClass;
|
|
68
54
|
}
|
package/form/api/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export * from './data-providers/lookup.data-provider';
|
|
|
2
2
|
export * from './data-providers/lookup-data-provider.factory';
|
|
3
3
|
export * from './descriptors/action-button.descriptor';
|
|
4
4
|
export * from './descriptors/button-style.builder';
|
|
5
|
+
export * from './models/button.model';
|
|
5
6
|
export * from './models/trim.model';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StyleLevelEnum, StyleSizeEnum } from '@mediusinc/mng-commons/core';
|
|
2
|
+
export interface IActionButtonDescriptor {
|
|
3
|
+
label?: string | null;
|
|
4
|
+
icon?: string | null;
|
|
5
|
+
iconPosition?: 'left' | 'right';
|
|
6
|
+
style?: IButtonStyleDescriptor;
|
|
7
|
+
badge?: string;
|
|
8
|
+
tooltip?: string | null;
|
|
9
|
+
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right';
|
|
10
|
+
}
|
|
11
|
+
export interface IButtonStyleDescriptor {
|
|
12
|
+
size?: StyleSizeEnum;
|
|
13
|
+
level?: StyleLevelEnum;
|
|
14
|
+
textButton?: boolean;
|
|
15
|
+
outlined?: boolean;
|
|
16
|
+
raised?: boolean;
|
|
17
|
+
rounded?: boolean;
|
|
18
|
+
class?: string;
|
|
19
|
+
}
|
package/i18n/sl.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"returnHome": "Pojdi nazaj na začetno stran",
|
|
19
19
|
"confirmation": "Potrditev",
|
|
20
20
|
"success": "Uspešno",
|
|
21
|
-
"successMessage": "
|
|
21
|
+
"successMessage": "Akcija uspešna.",
|
|
22
22
|
"error": "Napaka",
|
|
23
23
|
"errorMessage": "{{errorMessage}}",
|
|
24
24
|
"general": "Splošno",
|
|
@@ -248,11 +248,61 @@
|
|
|
248
248
|
"choose": "Izberi",
|
|
249
249
|
"upload": "Naloži",
|
|
250
250
|
"cancel": "Prekliči",
|
|
251
|
-
"dayNames": [
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
251
|
+
"dayNames": [
|
|
252
|
+
"Nedelja",
|
|
253
|
+
"Ponedeljek",
|
|
254
|
+
"Torek",
|
|
255
|
+
"Sreda",
|
|
256
|
+
"Četrtek",
|
|
257
|
+
"Petek",
|
|
258
|
+
"Sobota"
|
|
259
|
+
],
|
|
260
|
+
"dayNamesShort": [
|
|
261
|
+
"Ned",
|
|
262
|
+
"Pon",
|
|
263
|
+
"Tor",
|
|
264
|
+
"Sre",
|
|
265
|
+
"Čet",
|
|
266
|
+
"Pet",
|
|
267
|
+
"Sob"
|
|
268
|
+
],
|
|
269
|
+
"dayNamesMin": [
|
|
270
|
+
"Ne",
|
|
271
|
+
"Po",
|
|
272
|
+
"To",
|
|
273
|
+
"Sr",
|
|
274
|
+
"Če",
|
|
275
|
+
"Pe",
|
|
276
|
+
"So"
|
|
277
|
+
],
|
|
278
|
+
"monthNames": [
|
|
279
|
+
"Januar",
|
|
280
|
+
"Februar",
|
|
281
|
+
"Marec",
|
|
282
|
+
"April",
|
|
283
|
+
"Maj",
|
|
284
|
+
"Junij",
|
|
285
|
+
"Julij",
|
|
286
|
+
"Avgust",
|
|
287
|
+
"September",
|
|
288
|
+
"Oktober",
|
|
289
|
+
"November",
|
|
290
|
+
"December"
|
|
291
|
+
],
|
|
292
|
+
"monthNamesShort": [
|
|
293
|
+
"Jan",
|
|
294
|
+
"Feb",
|
|
295
|
+
"Mar",
|
|
296
|
+
"Apr",
|
|
297
|
+
"Maj",
|
|
298
|
+
"Jun",
|
|
299
|
+
"Jul",
|
|
300
|
+
"Avg",
|
|
301
|
+
"Sep",
|
|
302
|
+
"Okt",
|
|
303
|
+
"Nov",
|
|
304
|
+
"Dec"
|
|
305
|
+
],
|
|
256
306
|
"dateFormat": "dd.mm.yy",
|
|
257
307
|
"firstDayOfWeek": 0,
|
|
258
308
|
"today": "Danes",
|
package/model/helpers/i18n.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { TranslateService } from '@ngx-translate/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { KeyOfType } from '@mediusinc/mng-commons/core';
|
|
4
3
|
import { ModelDescriptor } from '../descriptors/model.descriptor';
|
|
5
|
-
|
|
4
|
+
type ModelI18nOptsType = {
|
|
5
|
+
customKey?: string;
|
|
6
|
+
fallbackKey?: string;
|
|
7
|
+
item?: any;
|
|
8
|
+
params?: any;
|
|
9
|
+
};
|
|
10
|
+
export declare function getI18nForModel(translate: TranslateService, model: ModelDescriptor<any>, keyPath: string, opts?: ModelI18nOptsType): string | null;
|
|
6
11
|
export declare function getI18nModelParams(translate: TranslateService, model?: ModelDescriptor<any>, item?: any, params?: any): any;
|
|
7
12
|
export declare function getI18nModelParamsAsync(translate: TranslateService, model?: ModelDescriptor<any>, item?: any, params?: any): Observable<any>;
|
|
8
|
-
export
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ export declare class TableColumnValueComponent<T, TT> {
|
|
|
21
21
|
className: import("@angular/core").Signal<string>;
|
|
22
22
|
value: import("@angular/core").Signal<any>;
|
|
23
23
|
currency: import("@angular/core").Signal<string | undefined>;
|
|
24
|
+
hasCopyToClipboard: import("@angular/core").Signal<boolean>;
|
|
24
25
|
copyToClipboard(event: Event): void;
|
|
25
26
|
static ɵfac: i0.ɵɵFactoryDeclaration<TableColumnValueComponent<any, any>, never>;
|
|
26
27
|
static ɵcmp: i0.ɵɵComponentDeclaration<TableColumnValueComponent<any, any>, "mng-table-column-value", never, { "descriptor": { "alias": "descriptor"; "required": true; "isSignal": true; }; "item": { "alias": "item"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -68,7 +68,6 @@ export declare class TableComponent<Item = any, Service = undefined, Sorts = any
|
|
|
68
68
|
hasLastColumn: Signal<boolean | Type<any> | TemplateRef<any>>;
|
|
69
69
|
private lastLazyLoadEvent?;
|
|
70
70
|
private lastParamsWithDefaults?;
|
|
71
|
-
private lastQueryParams?;
|
|
72
71
|
private navigationOutOfTableInProgress;
|
|
73
72
|
private navigationInTableInProgress;
|
|
74
73
|
constructor();
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { TranslateService } from '@ngx-translate/core';
|
|
2
2
|
import { Message, MessageService } from 'primeng/api';
|
|
3
3
|
import { TableDescriptorInst } from '@mediusinc/mng-commons/table/api';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Generates and displays a notification for a table-related error with localized error messages and details.
|
|
6
|
+
*
|
|
7
|
+
* @param {TranslateService} translate - The service used to handle localization and translations.
|
|
8
|
+
* @param {MessageService} messageService - The service used to manage and display messages.
|
|
9
|
+
* @param {TableDescriptorInst<any>} table - The table descriptor containing table-specific information and model data.
|
|
10
|
+
* @param {Error} error - The error object providing details about the error that occurred.
|
|
11
|
+
* @return {Message | null} The generated message object for the error notification or null if no notification was created.
|
|
12
|
+
*/
|
|
13
|
+
export declare function tableNotificationError(translate: TranslateService, messageService: MessageService, table: TableDescriptorInst<any>, error: Error): Message | null;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { OnDestroy } from '@angular/core';
|
|
2
2
|
import { ActivatedRoute } from '@angular/router';
|
|
3
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
4
3
|
import { MenuItem } from 'primeng/api';
|
|
5
4
|
import { Menu } from 'primeng/menu';
|
|
6
|
-
import { ActionData, ActionParameters, DataListParams, IDataProvider, IdType
|
|
5
|
+
import { ActionData, ActionParameters, DataListParams, IDataProvider, IdType } from '@mediusinc/mng-commons/core';
|
|
7
6
|
import { ActionDescriptorInst, ActionLinkDescriptorInst, IActionComponent } from '@mediusinc/mng-commons/tableview/api';
|
|
8
7
|
import { ActionInstance } from '../../models/execution/action-instance.model';
|
|
9
|
-
import { ActionExecutorService } from '../../services/action-executor.service';
|
|
10
|
-
import { ViewContainer } from '../../services/view-container.service';
|
|
11
8
|
import * as i0 from "@angular/core";
|
|
12
9
|
export declare class ActionComponent<Item = any, Service = undefined> implements OnDestroy {
|
|
13
|
-
private routeService;
|
|
14
|
-
private translate;
|
|
15
|
-
private authorization;
|
|
16
|
-
private actionExecutor;
|
|
17
|
-
private viewContainer
|
|
10
|
+
private readonly routeService;
|
|
11
|
+
private readonly translate;
|
|
12
|
+
private readonly authorization;
|
|
13
|
+
private readonly actionExecutor;
|
|
14
|
+
private readonly viewContainer?;
|
|
18
15
|
action: import("@angular/core").InputSignal<ActionDescriptorInst<Item, Service, any, any, any>>;
|
|
19
16
|
item: import("@angular/core").InputSignal<Item | undefined>;
|
|
20
17
|
itemId: import("@angular/core").InputSignal<IdType | undefined>;
|
|
@@ -54,12 +51,12 @@ export declare class ActionComponent<Item = any, Service = undefined> implements
|
|
|
54
51
|
subactions: import("@angular/core").WritableSignal<MenuItem[]>;
|
|
55
52
|
private subactionSubscriptions;
|
|
56
53
|
private instance?;
|
|
57
|
-
constructor(
|
|
54
|
+
constructor();
|
|
58
55
|
ngOnDestroy(): void;
|
|
59
56
|
triggerAction(action: ActionDescriptorInst<Item, Service>, parameters?: ActionParameters<Item>, event?: Event): void;
|
|
60
57
|
onCustomActionCmpInst(instance: IActionComponent<Item>): void;
|
|
61
58
|
private processSubscriptions;
|
|
62
59
|
private processSubactions;
|
|
63
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ActionComponent<any, any>,
|
|
60
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ActionComponent<any, any>, never>;
|
|
64
61
|
static ɵcmp: i0.ɵɵComponentDeclaration<ActionComponent<any, any>, "mng-action", never, { "action": { "alias": "action"; "required": true; "isSignal": true; }; "item": { "alias": "item"; "required": false; "isSignal": true; }; "itemId": { "alias": "itemId"; "required": false; "isSignal": true; }; "actionData": { "alias": "actionData"; "required": false; "isSignal": true; }; "dataListParams": { "alias": "dataListParams"; "required": false; "isSignal": true; }; "dataProvider": { "alias": "dataProvider"; "required": false; "isSignal": true; }; "hostComponent": { "alias": "hostComponent"; "required": false; "isSignal": true; }; "routeInit": { "alias": "route"; "required": false; "isSignal": true; }; "inputDisabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "inputLoading": { "alias": "loading"; "required": false; "isSignal": true; }; "selectedItems": { "alias": "selectedItems"; "required": false; "isSignal": true; }; }, { "finish": "finish"; }, never, never, true, never>;
|
|
65
62
|
}
|
|
@@ -2,21 +2,46 @@ import { TranslateService } from '@ngx-translate/core';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { I18nMissingTranslationStrategy } from '@mediusinc/mng-commons/core';
|
|
4
4
|
import { ActionDescriptorInst, ActionEditorDescriptorInst } from '@mediusinc/mng-commons/tableview/api';
|
|
5
|
-
|
|
5
|
+
type ActionI18nOptsType = {
|
|
6
|
+
customKey?: string;
|
|
7
|
+
fallbackKey?: string;
|
|
8
|
+
item?: any;
|
|
9
|
+
params?: any;
|
|
10
|
+
missingTranslationStrategy?: I18nMissingTranslationStrategy;
|
|
11
|
+
};
|
|
6
12
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
13
|
+
* Asynchronously retrieves internationalized text for a specified action.
|
|
14
|
+
*
|
|
15
|
+
* If no translation is found for actionPathKeys, the fallback is used (if provided).
|
|
16
|
+
* If custom key is provided, no other key will be used.
|
|
17
|
+
* Item can be interpolated under itemTitle, itemId (if specified in action model) or under item.* (JSON-like path to property).
|
|
18
|
+
* Params are interpolated in translation.
|
|
19
|
+
*
|
|
20
|
+
* @param {TranslateService} translate - The translation service used for retrieving localized strings.
|
|
21
|
+
* @param {ActionDescriptorInst<any>} action - The action descriptor that provides context for localization keys and parameters.
|
|
22
|
+
* @param {string | Array<string>} pathKeys - A string or array of strings representing the priority order of localization keys to look up for the action.
|
|
23
|
+
* @param {ActionI18nOptsType} [opts] - Optional settings to customize the localization behavior, including custom keys, fallback keys, parameters, and missing translation strategies.
|
|
24
|
+
* @return {Observable<string | null>} An observable that emits the localized string for the action or null if no appropriate translation is found.
|
|
16
25
|
*/
|
|
17
|
-
export declare function
|
|
26
|
+
export declare function getI18nForAction(translate: TranslateService, action: ActionDescriptorInst<any>, pathKeys: string | Array<string>, opts?: ActionI18nOptsType): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Asynchronously retrieves internationalized text for a specified action.
|
|
29
|
+
*
|
|
30
|
+
* If no translation is found for actionPathKeys, the fallback is used (if provided).
|
|
31
|
+
* If custom key is provided, no other key will be used.
|
|
32
|
+
* Item can be interpolated under itemTitle, itemId (if specified in action model) or under item.* (JSON-like path to property).
|
|
33
|
+
* Params are interpolated in translation.
|
|
34
|
+
*
|
|
35
|
+
* @param {TranslateService} translate - The translation service used for retrieving localized strings.
|
|
36
|
+
* @param {ActionDescriptorInst<any>} action - The action descriptor that provides context for localization keys and parameters.
|
|
37
|
+
* @param {string | Array<string>} pathKeys - A string or array of strings representing the priority order of localization keys to look up for the action.
|
|
38
|
+
* @param {ActionI18nOptsType} [opts] - Optional settings to customize the localization behavior, including custom keys, fallback keys, parameters, and missing translation strategies.
|
|
39
|
+
* @return {Observable<string | null>} An observable that emits the localized string for the action or null if no appropriate translation is found.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getI18nForActionAsync(translate: TranslateService, action: ActionDescriptorInst<any>, pathKeys: string | Array<string>, opts?: ActionI18nOptsType): Observable<string | null>;
|
|
18
42
|
export declare function getI18nActionTitleAsync(translate: TranslateService, action: ActionDescriptorInst<any>, item?: any): Observable<string | null>;
|
|
19
43
|
export declare function getI18nActionEditorTitleAsync(translate: TranslateService, action: ActionEditorDescriptorInst<any>, item?: any): Observable<string | null>;
|
|
20
44
|
export declare function getI18nActionParams(translate: TranslateService, action: ActionDescriptorInst<any>, item?: any, params?: any): any;
|
|
21
45
|
export declare function getI18nActionParamsAsync(translate: TranslateService, action: ActionDescriptorInst<any>, item?: any, params?: any): Observable<any>;
|
|
22
46
|
export declare function populateI18nActionParams(params?: any): any;
|
|
47
|
+
export {};
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import { TranslateService } from '@ngx-translate/core';
|
|
2
2
|
import { Message, MessageService } from 'primeng/api';
|
|
3
3
|
import { ICommonsError } from '@mediusinc/mng-commons/core';
|
|
4
|
-
import { ActionDescriptorInst } from '@mediusinc/mng-commons/tableview/api';
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { ActionDescriptorInst, ActionNotificationType } from '@mediusinc/mng-commons/tableview/api';
|
|
5
|
+
type ActionNotificationOptsType = ActionNotificationType & {
|
|
6
|
+
item?: any;
|
|
7
|
+
functionName?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Executes a notification success action for a given operation, translating
|
|
11
|
+
* and displaying a success message using the specified translation and message services.
|
|
12
|
+
*
|
|
13
|
+
* Provide title or message for custom titles (unrelated to model/action base paths for i18n).
|
|
14
|
+
* Item is interpolated as itemId, itemTitle or item.* for accessing desired properties.
|
|
15
|
+
* Set functionName in order to get specific translations for executing function (run, fetch, submit).
|
|
16
|
+
*
|
|
17
|
+
* @param {TranslateService} translate - The translation service used to retrieve localized messages.
|
|
18
|
+
* @param {MessageService} messageService - The message service responsible for displaying notifications.
|
|
19
|
+
* @param {ActionDescriptorInst<any>} action - The action descriptor instance that defines the operation.
|
|
20
|
+
* @param {ActionNotificationOptsType} [opts] - Optional configuration for customizing the success notification.
|
|
21
|
+
* @return {Message | undefined} The generated message object if a success message is found, otherwise undefined.
|
|
22
|
+
*/
|
|
23
|
+
export declare function actionNotificationSuccess(translate: TranslateService, messageService: MessageService, action: ActionDescriptorInst<any>, opts?: ActionNotificationOptsType): Message | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Displays a notification for an error that occurred during an action execution.
|
|
26
|
+
*
|
|
27
|
+
* Provide title or message for custom titles (unrelated to model/action base paths for i18n).
|
|
28
|
+
* Item is interpolated as itemId, itemTitle or item.* for accessing desired properties.
|
|
29
|
+
* Set functionName in order to get specific translations for executing function (run, fetch, submit).
|
|
30
|
+
*
|
|
31
|
+
* @param {TranslateService} translate - The service used for translations.
|
|
32
|
+
* @param {MessageService} messageService - The service used for displaying messages.
|
|
33
|
+
* @param {ActionDescriptorInst<any>} action - The action descriptor instance related to the error.
|
|
34
|
+
* @param {ICommonsError} error - The error object containing details about the error.
|
|
35
|
+
* @param {'warn' | 'error'} [severity='error'] - The severity level of the notification (either 'warn' or 'error').
|
|
36
|
+
* @param {ActionNotificationOptsType} [opts] - Optional parameters for customizing the notification, such as title, message, or function name.
|
|
37
|
+
* @return {Message} - The message object created and displayed as a notification.
|
|
38
|
+
*/
|
|
39
|
+
export declare function actionNotificationError(translate: TranslateService, messageService: MessageService, action: ActionDescriptorInst<any>, error: ICommonsError, severity?: 'warn' | 'error', opts?: ActionNotificationOptsType): Message;
|
|
40
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { ServiceClassType, StyleSizeEnum } from '@mediusinc/mng-commons/core';
|
|
|
3
3
|
import { ModelDescriptor } from '@mediusinc/mng-commons/model';
|
|
4
4
|
import { IEditorDataProvider } from '../../editor/data-providers/editor.data-provider';
|
|
5
5
|
import { EditorDescriptorInst } from '../../editor/descriptors/editor.descriptor';
|
|
6
|
-
import { ActionRunFnType } from '../models/action-descriptor.types';
|
|
6
|
+
import { ActionNotificationType, ActionRunFnType } from '../models/action-descriptor.types';
|
|
7
7
|
import { ActionEditorSubmitTypeEnum } from '../models/action.type';
|
|
8
8
|
import { ActionDescriptorCreateOptsParentType, ActionDescriptorInst } from './action.descriptor';
|
|
9
9
|
export type ActionEditorDescriptorConstructorOptsType<Model, Service> = ActionDescriptorCreateOptsParentType & ActionEditorDescriptorCreateOptsProviderType<Model, Service> & {
|
|
@@ -20,9 +20,8 @@ export declare class ActionEditorDescriptorInst<Item, Service = any, EditorItem
|
|
|
20
20
|
protected _editorActions: ActionDescriptorInst<any, any, EditorItem, any, EditorItem>[];
|
|
21
21
|
protected _editorTitle?: string | null;
|
|
22
22
|
protected _editorTitleParams?: any;
|
|
23
|
-
protected
|
|
24
|
-
protected
|
|
25
|
-
protected _fetchNotificationSuccessMessage?: string;
|
|
23
|
+
protected _fetchNotificationOnSuccess?: ActionNotificationType | boolean;
|
|
24
|
+
protected _fetchNotificationOnError?: ActionNotificationType | boolean;
|
|
26
25
|
protected _dialogSize: StyleSizeEnum;
|
|
27
26
|
protected _dialogClassName?: string;
|
|
28
27
|
protected _fetchFunction?: ActionRunFnType<Item, Service, FetchInputItem, EditorItem>;
|
|
@@ -37,9 +36,8 @@ export declare class ActionEditorDescriptorInst<Item, Service = any, EditorItem
|
|
|
37
36
|
get editorDescriptor(): EditorDescriptorInst<EditorItem, any>;
|
|
38
37
|
get dialogSize(): StyleSizeEnum;
|
|
39
38
|
get dialogClassName(): string | undefined;
|
|
40
|
-
get
|
|
41
|
-
get
|
|
42
|
-
get fetchNotificationSuccessMessage(): string | undefined;
|
|
39
|
+
get fetchNotificationOnSuccess(): boolean | ActionNotificationType | undefined;
|
|
40
|
+
get fetchNotificationOnError(): boolean | ActionNotificationType | undefined;
|
|
43
41
|
get dataProvider(): IEditorDataProvider<Item, any> | undefined;
|
|
44
42
|
get hasRunFunction(): boolean;
|
|
45
43
|
get runFunction(): ActionRunFnType<Item, Service, EditorItem, SubmitReturnItem>;
|
|
@@ -58,7 +56,19 @@ export declare class ActionEditorDescriptorInst<Item, Service = any, EditorItem
|
|
|
58
56
|
withRunFunction(fn: ActionRunFnType<Item, Service, EditorItem, SubmitReturnItem>): this;
|
|
59
57
|
withFetchFunction(fn: ActionRunFnType<Item, Service, FetchInputItem, EditorItem>): this;
|
|
60
58
|
withSubmitFunction(fn: ActionRunFnType<Item, Service, EditorItem, SubmitReturnItem>): this;
|
|
61
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Override default notifications setup. Notifications can either be overridden with custom text or turned on/off.
|
|
61
|
+
*
|
|
62
|
+
* @param opts Provide config for texts or on/off flag for submit (is same as run) or fetch success/error notifications.
|
|
63
|
+
*/
|
|
64
|
+
withNotifications(opts?: {
|
|
65
|
+
submitOnSuccess?: ActionNotificationType | boolean;
|
|
66
|
+
submitOnError?: ActionNotificationType | boolean;
|
|
67
|
+
runOnSuccess?: ActionNotificationType | boolean;
|
|
68
|
+
runOnError?: ActionNotificationType | boolean;
|
|
69
|
+
fetchOnSuccess?: ActionNotificationType | boolean;
|
|
70
|
+
fetchOnError?: ActionNotificationType | boolean;
|
|
71
|
+
} | boolean): this;
|
|
62
72
|
withEditorAction(action: ActionDescriptorInst<any, any, EditorItem, any, EditorItem>): this;
|
|
63
73
|
withEditorActions(actions: ActionDescriptorInst<any, any, EditorItem, any, EditorItem>[]): this;
|
|
64
74
|
withEditorComponent(editorComponent: Type<any>): this;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { InjectionToken, Type } from '@angular/core';
|
|
2
2
|
import { APermissions, ClassType, IActionDescriptor, IDataProvider, ServiceClassType, StyleLevelEnum } from '@mediusinc/mng-commons/core';
|
|
3
|
-
import {
|
|
3
|
+
import { IActionButtonDescriptor } from '@mediusinc/mng-commons/form/api';
|
|
4
4
|
import { ModelDescriptor } from '@mediusinc/mng-commons/model';
|
|
5
5
|
import { IActionComponent } from '../models/action-component.model';
|
|
6
|
-
import {
|
|
6
|
+
import { ActionConfirmation } from '../models/action-confirmation.model';
|
|
7
|
+
import { ActionNotificationType, ActionRunFnType, ActionValidationFnType } from '../models/action-descriptor.types';
|
|
7
8
|
import { ActionActivationTriggerEnum, ActionPositionEnum, ActionTypeEnum } from '../models/action.type';
|
|
8
9
|
import { IActionContext } from '../models/execution/action-context.model';
|
|
9
|
-
import { ActionConfirmationDescriptor } from './action-confirmation.descriptor';
|
|
10
10
|
export type ActionDescriptorCreateOptsProviderType<Item, Service> = {
|
|
11
11
|
serviceType?: ServiceClassType<Service>;
|
|
12
12
|
dataProvider?: IDataProvider<Item, Service>;
|
|
@@ -38,17 +38,13 @@ export declare class ActionDescriptorInst<Item, Service = any, RunInputItem = It
|
|
|
38
38
|
protected _runFunction?: ActionRunFnType<Item, Service, RunInputItem, RunReturnItem>;
|
|
39
39
|
protected _isVisibleFunction?: ActionValidationFnType<ValidationInputItem, Service>;
|
|
40
40
|
protected _isEnabledFunction?: ActionValidationFnType<ValidationInputItem, Service>;
|
|
41
|
-
protected
|
|
42
|
-
protected
|
|
43
|
-
protected
|
|
44
|
-
protected _runNotificationSuccessMessage?: string;
|
|
45
|
-
protected _hasRunNotificationError: boolean;
|
|
46
|
-
protected _runNotificationErrorTitle?: string;
|
|
47
|
-
protected _runNotificationErrorMessage?: string;
|
|
41
|
+
protected _runConfirmation?: ActionConfirmation<RunInputItem>;
|
|
42
|
+
protected _runNotificationOnSuccess?: ActionNotificationType | boolean;
|
|
43
|
+
protected _runNotificationOnError?: ActionNotificationType | boolean;
|
|
48
44
|
protected _afterRunAction?: AfterRunActionType<RunReturnItem> | ((ctx: IActionContext<Item, RunInputItem, any>) => AfterRunActionType<RunReturnItem>);
|
|
49
45
|
protected _onRunErrorAction?: OnErrorActionType<RunInputItem> | ((ctx: IActionContext<Item, RunInputItem, any>) => OnErrorActionType<RunInputItem>);
|
|
50
46
|
protected _permissions?: APermissions;
|
|
51
|
-
protected _button
|
|
47
|
+
protected _button?: IActionButtonDescriptor;
|
|
52
48
|
protected _hasItemsSelection: boolean;
|
|
53
49
|
protected _component?: Type<IActionComponent<Item>>;
|
|
54
50
|
protected _componentFromDi?: InjectionToken<Type<any>>;
|
|
@@ -62,7 +58,6 @@ export declare class ActionDescriptorInst<Item, Service = any, RunInputItem = It
|
|
|
62
58
|
get type(): ActionTypeEnum;
|
|
63
59
|
get activationTrigger(): ActionActivationTriggerEnum;
|
|
64
60
|
get position(): ActionPositionEnum;
|
|
65
|
-
get level(): StyleLevelEnum;
|
|
66
61
|
get routeUrl(): string | null;
|
|
67
62
|
get dataProvider(): IDataProvider<Item, Service> | undefined;
|
|
68
63
|
get hasRunFunction(): boolean;
|
|
@@ -71,21 +66,15 @@ export declare class ActionDescriptorInst<Item, Service = any, RunInputItem = It
|
|
|
71
66
|
get isEnabledFunction(): ActionValidationFnType<ValidationInputItem, Service> | undefined;
|
|
72
67
|
get actionName(): string;
|
|
73
68
|
get actionNameLong(): string;
|
|
74
|
-
get
|
|
75
|
-
get
|
|
76
|
-
get
|
|
77
|
-
get hasRunNotificationSuccess(): boolean;
|
|
78
|
-
get runNotificationSuccessTitle(): string | undefined;
|
|
79
|
-
get runNotificationSuccessMessage(): string | undefined;
|
|
80
|
-
get hasRunNotificationError(): boolean;
|
|
81
|
-
get runNotificationErrorTitle(): string | undefined;
|
|
82
|
-
get runNotificationErrorMessage(): string | undefined;
|
|
69
|
+
get runConfirmation(): ActionConfirmation<RunInputItem> | undefined;
|
|
70
|
+
get runNotificationOnSuccess(): boolean | ActionNotificationType | undefined;
|
|
71
|
+
get runNotificationOnError(): boolean | ActionNotificationType | undefined;
|
|
83
72
|
get afterRunAction(): AfterRunActionType<RunReturnItem> | ((ctx: IActionContext<Item, RunInputItem, any>) => AfterRunActionType<RunReturnItem>) | undefined;
|
|
84
73
|
get onRunErrorAction(): OnErrorActionType<RunInputItem> | ((ctx: IActionContext<Item, RunInputItem, any>) => OnErrorActionType<RunInputItem>) | undefined;
|
|
85
74
|
get permissions(): APermissions | undefined;
|
|
86
75
|
get tableviewCategory(): string | undefined;
|
|
87
76
|
get hasItemsSelection(): boolean;
|
|
88
|
-
get button():
|
|
77
|
+
get button(): IActionButtonDescriptor | undefined;
|
|
89
78
|
get component(): Type<IActionComponent<Item, undefined>> | undefined;
|
|
90
79
|
get componentFromDi(): InjectionToken<Type<any>> | undefined;
|
|
91
80
|
get positionTableviewCategories(): string[] | undefined;
|
|
@@ -98,22 +87,24 @@ export declare class ActionDescriptorInst<Item, Service = any, RunInputItem = It
|
|
|
98
87
|
withRouteTrigger(routeUrl: string): this;
|
|
99
88
|
withPosition(position: ActionPositionEnum): this;
|
|
100
89
|
/**
|
|
101
|
-
*
|
|
90
|
+
* Creates confirmation action with default style based on action descriptor
|
|
102
91
|
*/
|
|
103
|
-
withRunConfirmation():
|
|
92
|
+
withRunConfirmation(opts?: boolean | ActionConfirmation<RunInputItem>): this;
|
|
104
93
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
94
|
+
* Override default notifications setup. Notifications can either be overridden with custom text or turned on/off.
|
|
95
|
+
*
|
|
96
|
+
* @param opts Provide config for texts or on/off flag for run success/error notifications.
|
|
107
97
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
98
|
+
withNotifications(opts?: {
|
|
99
|
+
runOnSuccess?: ActionNotificationType | boolean;
|
|
100
|
+
runOnError?: ActionNotificationType | boolean;
|
|
101
|
+
} | boolean): this;
|
|
111
102
|
withAfterRunAction(action?: AfterRunActionType<RunReturnItem> | ((ctx: IActionContext<Item, RunInputItem, any>) => AfterRunActionType<RunReturnItem>)): this;
|
|
112
103
|
withOnRunErrorAction(action?: OnErrorActionType<RunInputItem> | ((ctx: IActionContext<Item, RunInputItem, any>) => OnErrorActionType<RunInputItem>)): this;
|
|
113
104
|
withPermissions(permissions: APermissions): this;
|
|
114
105
|
withTableviewCategory(category: string): this;
|
|
115
|
-
|
|
116
|
-
withButton(label?: string | null, icon?: string | null,
|
|
106
|
+
withButtonOpts(button?: IActionButtonDescriptor): this;
|
|
107
|
+
withButton(label?: string | null, icon?: string | null, level?: StyleLevelEnum): this;
|
|
117
108
|
withItemsSelection(hasSelection?: boolean): this;
|
|
118
109
|
withComponent(component: Type<IActionComponent<Item>>): this;
|
|
119
110
|
withComponentFromDi(injectionToken: InjectionToken<Type<any>>): this;
|