@mediusinc/mng-commons 0.12.0 → 0.12.1
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/esm2020/lib/components/action/action.component.mjs +14 -13
- package/esm2020/lib/components/form/autocomplete/autocomplete.component.mjs +6 -2
- package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +4 -1
- package/esm2020/lib/components/tableview/table/table.component.mjs +2 -2
- package/esm2020/lib/descriptors/action.descriptor.mjs +49 -21
- package/esm2020/lib/services/configuration.service.mjs +11 -2
- package/esm2020/lib/services/internal/commons-init.service.mjs +2 -2
- package/esm2020/lib/styles/button-style.builder.mjs +112 -0
- package/esm2020/lib/styles/index.mjs +3 -0
- package/esm2020/lib/styles/styles.util.mjs +41 -0
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/mediusinc-mng-commons.mjs +230 -74
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +230 -74
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/action/action.component.d.ts +2 -9
- package/lib/descriptors/action.descriptor.d.ts +31 -6
- package/lib/services/configuration.service.d.ts +10 -1
- package/lib/styles/button-style.builder.d.ts +26 -0
- package/lib/styles/index.d.ts +2 -0
- package/lib/{utils → styles}/styles.util.d.ts +0 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/scss/common/theme/designer/components/button/_speeddial.scss +6 -4
- package/scss/common/theme/designer/components/input/_autocomplete.scss +5 -3
- package/scss/common/theme/designer/components/input/_chips.scss +5 -3
- package/scss/common/theme/designer/components/input/_inputswitch.scss +3 -1
- package/scss/common/theme/designer/components/input/_multiselect.scss +4 -2
- package/scss/common/theme/designer/components/input/_slider.scss +6 -4
- package/scss/common/theme/designer/components/input/_treeselect.scss +4 -2
- package/scss/common/theme/designer/components/menu/_steps.scss +3 -1
- package/scss/common/theme/designer/components/misc/_chip.scss +4 -2
- package/scss/common/theme/designer/components/misc/_tag.scss +3 -1
- package/scss/common/theme/designer/components/overlay/_overlaypanel.scss +4 -2
- package/version-info.json +5 -5
- package/esm2020/lib/utils/styles.util.mjs +0 -41
|
@@ -6,7 +6,6 @@ import { Observable } from 'rxjs';
|
|
|
6
6
|
import { MediusQueryParam } from '../../api/models';
|
|
7
7
|
import { IDataProvider } from '../../data-providers';
|
|
8
8
|
import { ActionDescriptor, ActionLinkDescriptor } from '../../descriptors';
|
|
9
|
-
import { ActionLevelEnum } from '../../descriptors/types';
|
|
10
9
|
import { IViewContainer } from '../../models';
|
|
11
10
|
import { MngAuthorizationService } from '../../security';
|
|
12
11
|
import { MngActionExecutorService, MngViewContainerComponentService } from '../../services';
|
|
@@ -20,15 +19,8 @@ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDe
|
|
|
20
19
|
private actionExecutor;
|
|
21
20
|
private confirmationService;
|
|
22
21
|
private viewContainerService;
|
|
23
|
-
readonly levelDefault = ActionLevelEnum.Default;
|
|
24
|
-
readonly levelPrimary = ActionLevelEnum.Primary;
|
|
25
|
-
readonly levelSecondary = ActionLevelEnum.Secondary;
|
|
26
|
-
readonly levelInfo = ActionLevelEnum.Info;
|
|
27
|
-
readonly levelHelp = ActionLevelEnum.Help;
|
|
28
|
-
readonly levelSuccess = ActionLevelEnum.Success;
|
|
29
|
-
readonly levelWarning = ActionLevelEnum.Warning;
|
|
30
|
-
readonly levelDanger = ActionLevelEnum.Danger;
|
|
31
22
|
hostClass: string;
|
|
23
|
+
isHostHidden: boolean;
|
|
32
24
|
action: ActionDescriptor<T>;
|
|
33
25
|
item?: T;
|
|
34
26
|
itemId?: IdType;
|
|
@@ -62,6 +54,7 @@ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDe
|
|
|
62
54
|
hasNoTitle: boolean;
|
|
63
55
|
private subscriptions;
|
|
64
56
|
private routePermissions?;
|
|
57
|
+
buttonClass: string;
|
|
65
58
|
constructor(route: ActivatedRoute, translate: TranslateService, authorization: MngAuthorizationService, actionExecutor: MngActionExecutorService, confirmationService: ConfirmationService, viewContainerService: MngViewContainerComponentService<T, S> | null);
|
|
66
59
|
ngOnInit(): void;
|
|
67
60
|
ngOnChanges(changes: SimpleChanges): void;
|
|
@@ -5,6 +5,7 @@ import { Observable } from 'rxjs';
|
|
|
5
5
|
import { ActionContext, ActionContextValidation } from '../components/action/models';
|
|
6
6
|
import { IDataProvider, IEditorDataProvider } from '../data-providers';
|
|
7
7
|
import { APermissions } from '../security/model';
|
|
8
|
+
import { ButtonStyleBuilder } from '../styles';
|
|
8
9
|
import { ClassType, IdType } from '../types';
|
|
9
10
|
import { EditorDescriptor, ModelDescriptor } from './';
|
|
10
11
|
import { ActionActivationTriggerEnum, ActionEditorDialogSizeEnum, ActionEditorSubmitTypeEnum, ActionLevelEnum, ActionPositionEnum, ActionSizeEnum, ActionTypeEnum } from './types';
|
|
@@ -24,11 +25,7 @@ export declare class ActionDescriptor<T> {
|
|
|
24
25
|
protected _title?: string | null;
|
|
25
26
|
protected _icon?: string | null;
|
|
26
27
|
protected _tooltip?: string | null;
|
|
27
|
-
protected
|
|
28
|
-
protected _size: ActionSizeEnum;
|
|
29
|
-
protected _isStyleText: boolean;
|
|
30
|
-
protected _isStyleOutlined: boolean;
|
|
31
|
-
protected _isStyleRaised: boolean;
|
|
28
|
+
protected _buttonStyle: ButtonStyleBuilder;
|
|
32
29
|
protected _dataProvider?: IDataProvider<T, any>;
|
|
33
30
|
protected _runFunction?: (ctx: ActionContext<T, any>) => Observable<T | undefined | null>;
|
|
34
31
|
protected _isVisibleFunction?: (ctx: ActionContextValidation<T, any>) => Observable<boolean>;
|
|
@@ -70,14 +67,42 @@ export declare class ActionDescriptor<T> {
|
|
|
70
67
|
get isEnabledFunction(): ((ctx: ActionContextValidation<T, any>) => Observable<boolean>) | undefined;
|
|
71
68
|
get actionName(): string;
|
|
72
69
|
get actionNameLong(): string;
|
|
73
|
-
get
|
|
70
|
+
get buttonStyle(): ButtonStyleBuilder;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated use _buttonStyle instead
|
|
73
|
+
*/
|
|
74
|
+
get className(): string | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated use _buttonStyle instead
|
|
77
|
+
*/
|
|
74
78
|
get isStyleText(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated use _buttonStyle instead
|
|
81
|
+
*/
|
|
75
82
|
get isStyleOutlined(): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated use _buttonStyle instead
|
|
85
|
+
*/
|
|
76
86
|
get isStyleRaised(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated use _buttonStyle instead
|
|
89
|
+
*/
|
|
77
90
|
get size(): ActionSizeEnum;
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated use _buttonStyle instead
|
|
93
|
+
*/
|
|
78
94
|
get isSizeExtraSmall(): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated use _buttonStyle instead
|
|
97
|
+
*/
|
|
79
98
|
get isSizeSmall(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated use _buttonStyle instead
|
|
101
|
+
*/
|
|
80
102
|
get isSizeLarge(): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated use _buttonStyle instead
|
|
105
|
+
*/
|
|
81
106
|
get isSizeExtraLarge(): boolean;
|
|
82
107
|
get hasRunConfirmation(): boolean;
|
|
83
108
|
get runConfirmationIcon(): string | undefined;
|
|
@@ -19,7 +19,16 @@ export declare class MngConfigurationService {
|
|
|
19
19
|
* @param url Url to JSON file.
|
|
20
20
|
*/
|
|
21
21
|
addJsonSource(url?: string, load?: boolean): Observable<boolean>;
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* returns true if there is no jsonSources
|
|
24
|
+
*/
|
|
25
|
+
private skipJsonConfigsLoading;
|
|
26
|
+
/**
|
|
27
|
+
* loads json sources or skips them returning true in both cases
|
|
28
|
+
* used for `skipJsonSourceInit` configuration parameter
|
|
29
|
+
*/
|
|
30
|
+
loadJsonConfigurations: () => Observable<boolean>;
|
|
31
|
+
private loadJsonSources;
|
|
23
32
|
/**
|
|
24
33
|
* Get configuration.
|
|
25
34
|
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ActionLevelEnum, ActionSizeEnum } from '../descriptors/types';
|
|
2
|
+
export declare class ButtonStyleBuilder {
|
|
3
|
+
private _size;
|
|
4
|
+
private _actionLevel;
|
|
5
|
+
private _textButton;
|
|
6
|
+
private _outlineButton;
|
|
7
|
+
private _raisedButton;
|
|
8
|
+
private _customClass?;
|
|
9
|
+
constructor(level: ActionLevelEnum, customClass?: string);
|
|
10
|
+
getButtonClass(hasNoTitle?: boolean): string;
|
|
11
|
+
create(actionLevel?: ActionLevelEnum, size?: ActionSizeEnum, textButton?: boolean, outlineButton?: boolean, raisedButton?: boolean, customClass?: string): ButtonStyleBuilder;
|
|
12
|
+
withActionLevel(actionLevel: ActionLevelEnum): ButtonStyleBuilder;
|
|
13
|
+
withSize(size: ActionSizeEnum): ButtonStyleBuilder;
|
|
14
|
+
withTextButton(withText?: boolean): ButtonStyleBuilder;
|
|
15
|
+
withOutlineButton(withOutline?: boolean): ButtonStyleBuilder;
|
|
16
|
+
withRaisedButton(withRaised?: boolean): ButtonStyleBuilder;
|
|
17
|
+
withCustomClass(customClass: string): ButtonStyleBuilder;
|
|
18
|
+
private convertActionLevelToStyleClass;
|
|
19
|
+
private convertSizeToStyleClass;
|
|
20
|
+
get actionLevel(): ActionLevelEnum;
|
|
21
|
+
get size(): ActionSizeEnum;
|
|
22
|
+
get textButton(): boolean;
|
|
23
|
+
get outlineButton(): boolean;
|
|
24
|
+
get raisedButton(): boolean;
|
|
25
|
+
get customClass(): string | undefined;
|
|
26
|
+
}
|
|
File without changes
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-speeddial-button {
|
|
2
4
|
&.p-button.p-button-icon-only {
|
|
3
5
|
width: $speedDialButtonWidth;
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
|
|
24
26
|
.p-speeddial-direction-up {
|
|
25
27
|
.p-speeddial-item {
|
|
26
|
-
margin: $inlineSpacing
|
|
28
|
+
margin: math.div($inlineSpacing, 2) 0;
|
|
27
29
|
|
|
28
30
|
&:first-child {
|
|
29
31
|
margin-bottom: $inlineSpacing;
|
|
@@ -33,7 +35,7 @@
|
|
|
33
35
|
|
|
34
36
|
.p-speeddial-direction-down {
|
|
35
37
|
.p-speeddial-item {
|
|
36
|
-
margin: $inlineSpacing
|
|
38
|
+
margin: math.div($inlineSpacing, 2) 0;
|
|
37
39
|
|
|
38
40
|
&:first-child {
|
|
39
41
|
margin-top: $inlineSpacing;
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
|
|
44
46
|
.p-speeddial-direction-left {
|
|
45
47
|
.p-speeddial-item {
|
|
46
|
-
margin: 0 $inlineSpacing
|
|
48
|
+
margin: 0 math.div($inlineSpacing, 2);
|
|
47
49
|
|
|
48
50
|
&:first-child {
|
|
49
51
|
margin-right: $inlineSpacing;
|
|
@@ -53,7 +55,7 @@
|
|
|
53
55
|
|
|
54
56
|
.p-speeddial-direction-right {
|
|
55
57
|
.p-speeddial-item {
|
|
56
|
-
margin: 0 $inlineSpacing
|
|
58
|
+
margin: 0 math.div($inlineSpacing, 2);
|
|
57
59
|
|
|
58
60
|
&:first-child {
|
|
59
61
|
margin-left: $inlineSpacing;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-autocomplete {
|
|
2
4
|
.p-autocomplete-loader {
|
|
3
5
|
right: nth($inputPadding, 2);
|
|
@@ -10,7 +12,7 @@
|
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
.p-autocomplete-multiple-container {
|
|
13
|
-
padding: nth($inputPadding, 1)
|
|
15
|
+
padding: math.div(nth($inputPadding, 1), 2) nth($inputPadding, 2);
|
|
14
16
|
|
|
15
17
|
&:not(.p-disabled):hover {
|
|
16
18
|
border-color: $inputHoverBorderColor;
|
|
@@ -21,7 +23,7 @@
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
.p-autocomplete-input-token {
|
|
24
|
-
padding: nth($inputPadding, 1)
|
|
26
|
+
padding: math.div(nth($inputPadding, 1), 2) 0;
|
|
25
27
|
|
|
26
28
|
input {
|
|
27
29
|
font-family: $fontFamily;
|
|
@@ -33,7 +35,7 @@
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
.p-autocomplete-token {
|
|
36
|
-
padding: nth($inputPadding, 1)
|
|
38
|
+
padding: math.div(nth($inputPadding, 1), 2) nth($inputPadding, 2);
|
|
37
39
|
margin-right: $inlineSpacing;
|
|
38
40
|
background: $highlightBg;
|
|
39
41
|
color: $highlightTextColor;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-chips {
|
|
2
4
|
.p-chips-multiple-container {
|
|
3
|
-
padding: nth($inputPadding, 1)
|
|
5
|
+
padding: math.div(nth($inputPadding, 1), 2) nth($inputPadding, 2);
|
|
4
6
|
|
|
5
7
|
&:not(.p-disabled):hover {
|
|
6
8
|
border-color: $inputHoverBorderColor;
|
|
@@ -11,7 +13,7 @@
|
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
.p-chips-token {
|
|
14
|
-
padding: nth($inputPadding, 1)
|
|
16
|
+
padding: math.div(nth($inputPadding, 1), 2) nth($inputPadding, 2);
|
|
15
17
|
margin-right: $inlineSpacing;
|
|
16
18
|
background: $highlightBg;
|
|
17
19
|
color: $highlightTextColor;
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
.p-chips-input-token {
|
|
26
|
-
padding: nth($inputPadding, 1)
|
|
28
|
+
padding: math.div(nth($inputPadding, 1), 2) 0;
|
|
27
29
|
|
|
28
30
|
input {
|
|
29
31
|
font-family: $fontFamily;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-inputswitch {
|
|
2
4
|
width: $inputSwitchWidth;
|
|
3
5
|
height: $inputSwitchHeight;
|
|
@@ -12,7 +14,7 @@
|
|
|
12
14
|
width: $inputSwitchHandleWidth;
|
|
13
15
|
height: $inputSwitchHandleHeight;
|
|
14
16
|
left: $inputSwitchSliderPadding;
|
|
15
|
-
margin-top: -1 * $inputSwitchHandleHeight
|
|
17
|
+
margin-top: -1 * math.div($inputSwitchHandleHeight, 2);
|
|
16
18
|
border-radius: $inputSwitchHandleBorderRadius;
|
|
17
19
|
transition-duration: $transitionDuration;
|
|
18
20
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-multiselect {
|
|
2
4
|
background: $inputBg;
|
|
3
5
|
border: $inputBorder;
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
|
|
24
26
|
&.p-multiselect-chip {
|
|
25
27
|
.p-multiselect-token {
|
|
26
|
-
padding: nth($inputPadding, 1)
|
|
28
|
+
padding: math.div(nth($inputPadding, 1), 2) nth($inputPadding, 2);
|
|
27
29
|
margin-right: $inlineSpacing;
|
|
28
30
|
background: $highlightBg;
|
|
29
31
|
color: $highlightTextColor;
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
.p-multiselect {
|
|
49
51
|
&.p-multiselect-chip {
|
|
50
52
|
.p-multiselect-label {
|
|
51
|
-
padding: nth($inputPadding, 1)
|
|
53
|
+
padding: math.div(nth($inputPadding, 1), 2) nth($inputPadding, 2);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-slider {
|
|
2
4
|
background: $sliderBg;
|
|
3
5
|
border: $sliderBorder;
|
|
@@ -7,8 +9,8 @@
|
|
|
7
9
|
height: $sliderHorizontalHeight;
|
|
8
10
|
|
|
9
11
|
.p-slider-handle {
|
|
10
|
-
margin-top: (-1 * $sliderHandleHeight
|
|
11
|
-
margin-left: (-1 * $sliderHandleWidth
|
|
12
|
+
margin-top: (-1 * math.div($sliderHandleHeight, 2));
|
|
13
|
+
margin-left: (-1 * math.div($sliderHandleWidth, 2));
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -16,8 +18,8 @@
|
|
|
16
18
|
width: $sliderVerticalWidth;
|
|
17
19
|
|
|
18
20
|
.p-slider-handle {
|
|
19
|
-
margin-left: (-1 * $sliderHandleWidth
|
|
20
|
-
margin-bottom: (-1 * $sliderHandleHeight
|
|
21
|
+
margin-left: (-1 * math.div($sliderHandleWidth, 2));
|
|
22
|
+
margin-bottom: (-1 * math.div($sliderHandleHeight, 2));
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-treeselect {
|
|
2
4
|
background: $inputBg;
|
|
3
5
|
border: $inputBorder;
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
|
|
24
26
|
&.p-treeselect-chip {
|
|
25
27
|
.p-treeselect-token {
|
|
26
|
-
padding: nth($inputPadding, 1)
|
|
28
|
+
padding: math.div(nth($inputPadding, 1), 2) nth($inputPadding, 2);
|
|
27
29
|
margin-right: $inlineSpacing;
|
|
28
30
|
background: $chipBg;
|
|
29
31
|
color: $chipTextColor;
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
.p-treeselect {
|
|
49
51
|
&.p-treeselect-chip {
|
|
50
52
|
.p-treeselect-label {
|
|
51
|
-
padding: nth($inputPadding, 1)
|
|
53
|
+
padding: math.div(nth($inputPadding, 1), 2) nth($inputPadding, 2);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-steps {
|
|
2
4
|
.p-steps-item {
|
|
3
5
|
.p-menuitem-link {
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
left: 0;
|
|
49
51
|
display: block;
|
|
50
52
|
position: absolute;
|
|
51
|
-
margin-top: -1 * ($stepsItemNumberHeight
|
|
53
|
+
margin-top: -1 * math.div($stepsItemNumberHeight, 2);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-chip {
|
|
2
4
|
background-color: $chipBg;
|
|
3
5
|
color: $chipTextColor;
|
|
@@ -6,8 +8,8 @@
|
|
|
6
8
|
|
|
7
9
|
.p-chip-text {
|
|
8
10
|
line-height: 1.5;
|
|
9
|
-
margin-top: nth($inputPadding, 1)
|
|
10
|
-
margin-bottom: nth($inputPadding, 1)
|
|
11
|
+
margin-top: math.div(nth($inputPadding, 1), 2);
|
|
12
|
+
margin-bottom: math.div(nth($inputPadding, 1), 2);
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
.p-chip-icon {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
.p-overlaypanel {
|
|
2
4
|
background: $overlayContentBg;
|
|
3
5
|
color: $panelContentTextColor;
|
|
@@ -17,8 +19,8 @@
|
|
|
17
19
|
transition: $actionIconTransition;
|
|
18
20
|
border-radius: $actionIconBorderRadius;
|
|
19
21
|
position: absolute;
|
|
20
|
-
top: -1 * $actionIconWidth
|
|
21
|
-
right: -1 * $actionIconWidth
|
|
22
|
+
top: -1 * math.div($actionIconWidth, 2);
|
|
23
|
+
right: -1 * math.div($actionIconWidth, 2);
|
|
22
24
|
|
|
23
25
|
&:enabled:hover {
|
|
24
26
|
background: $buttonHoverBg;
|
package/version-info.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediusinc/mng-commons",
|
|
3
|
-
"version": "0.12.
|
|
4
|
-
"tag": "v0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
|
+
"tag": "v0.12.1",
|
|
5
5
|
"distance": 0,
|
|
6
|
-
"hash": "
|
|
6
|
+
"hash": "d8483e70",
|
|
7
7
|
"dirty": false,
|
|
8
|
-
"semver": "0.12.
|
|
9
|
-
"raw": "v0.12.
|
|
8
|
+
"semver": "0.12.1",
|
|
9
|
+
"raw": "v0.12.1-d8483e70"
|
|
10
10
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ActionSizeEnum, TableSizeEnum } from '../descriptors/types';
|
|
2
|
-
export class StylesUtil {
|
|
3
|
-
static calculateTableColumnActionWidth(table, actions) {
|
|
4
|
-
const buttonsWidth = actions.reduce((acc, action) => acc + StylesUtil.getActionButtonRoundedWidth(action) + 2 * StylesUtil.ACTION_BUTTON_MARGIN_X, 0);
|
|
5
|
-
const tablePadding = StylesUtil.getTableCellPaddingX(table);
|
|
6
|
-
return buttonsWidth + 2 * tablePadding;
|
|
7
|
-
}
|
|
8
|
-
static getTableCellPaddingX(table) {
|
|
9
|
-
switch (table.size) {
|
|
10
|
-
case TableSizeEnum.Small:
|
|
11
|
-
return StylesUtil.TABLE_CELL_PADDING_X_SM;
|
|
12
|
-
case TableSizeEnum.Large:
|
|
13
|
-
return StylesUtil.TABLE_CELL_PADDING_X_LG;
|
|
14
|
-
default:
|
|
15
|
-
return StylesUtil.TABLE_CELL_PADDING_X;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
static getActionButtonRoundedWidth(action) {
|
|
19
|
-
switch (action.size) {
|
|
20
|
-
case ActionSizeEnum.ExtraSmall:
|
|
21
|
-
return StylesUtil.BUTTON_ROUNDED_WIDTH_XS;
|
|
22
|
-
case ActionSizeEnum.Small:
|
|
23
|
-
return StylesUtil.BUTTON_ROUNDED_WIDTH_SM;
|
|
24
|
-
case ActionSizeEnum.Large:
|
|
25
|
-
case ActionSizeEnum.ExtraLarge:
|
|
26
|
-
return StylesUtil.BUTTON_ROUNDED_WIDTH_LG;
|
|
27
|
-
case ActionSizeEnum.Normal:
|
|
28
|
-
default:
|
|
29
|
-
return StylesUtil.BUTTON_ROUNDED_WIDTH;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
StylesUtil.BUTTON_ROUNDED_WIDTH_XS = 26;
|
|
34
|
-
StylesUtil.BUTTON_ROUNDED_WIDTH_SM = 28;
|
|
35
|
-
StylesUtil.BUTTON_ROUNDED_WIDTH = 32;
|
|
36
|
-
StylesUtil.BUTTON_ROUNDED_WIDTH_LG = 45;
|
|
37
|
-
StylesUtil.ACTION_BUTTON_MARGIN_X = 2;
|
|
38
|
-
StylesUtil.TABLE_CELL_PADDING_X = 8; // left and right paddings are same
|
|
39
|
-
StylesUtil.TABLE_CELL_PADDING_X_SM = 4;
|
|
40
|
-
StylesUtil.TABLE_CELL_PADDING_X_LG = 12;
|
|
41
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3R5bGVzLnV0aWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL3V0aWxzL3N0eWxlcy51dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBQyxjQUFjLEVBQUUsYUFBYSxFQUFDLE1BQU0sc0JBQXNCLENBQUM7QUFFbkUsTUFBTSxPQUFPLFVBQVU7SUFZWixNQUFNLENBQUMsK0JBQStCLENBQUMsS0FBK0IsRUFBRSxPQUF5QztRQUNwSCxNQUFNLFlBQVksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUMsR0FBRyxFQUFFLE1BQU0sRUFBRSxFQUFFLENBQUMsR0F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VybiBTdHlsZXNVdGlsLlRBQkxFX0NFTExfUEFERElOR19YX0xHO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICByZXR1cm4gU3R5bGVzVXRpbC5UQUJMRV9DRUxMX1BBRERJTkdfWDtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHB1YmxpYyBzdGF0aWMgZ2V0QWN0aW9uQnV0dG9uUm91bmRlZFdpZHRoKGFjdGlvbjogQWN0aW9uRGVzY3JpcHRvcjx1bmtub3duPik6IG51bWJlciB7XG4gICAgICAgIHN3aXRjaCAoYWN0aW9uLnNpemUpIHtcbiAgICAgICAgICAgIGNhc2UgQWN0aW9uU2l6ZUVudW0uRXh0cmFTbWFsbDpcbiAgICAgICAgICAgICAgICByZXR1cm4gU3R5bGVzVXRpbC5CVVRUT05fUk9VTkRFRF9XSURUSF9YUztcbiAgICAgICAgICAgIGNhc2UgQWN0aW9uU2l6ZUVudW0uU21hbGw6XG4gICAgICAgICAgICAgICAgcmV0dXJuIFN0eWxlc1V0aWwuQlVUVE9OX1JPVU5ERURfV0lEVEhfU007XG4gICAgICAgICAgICBjYXNlIEFjdGlvblNpemVFbnVtLkxhcmdlOlxuICAgICAgICAgICAgY2FzZSBBY3Rpb25TaXplRW51bS5FeHRyYUxhcmdlOlxuICAgICAgICAgICAgICAgIHJldHVybiBTdHlsZXNVdGlsLkJVVFRPTl9ST1VOREVEX1dJRFRIX0xHO1xuICAgICAgICAgICAgY2FzZSBBY3Rpb25TaXplRW51bS5Ob3JtYWw6XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIHJldHVybiBTdHlsZXNVdGlsLkJVVFRPTl9ST1VOREVEX1dJRFRIO1xuICAgICAgICB9XG4gICAgfVxufVxuIl19
|