ngx-sfc-common 0.0.35 → 0.0.37
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/button/button.component.mjs +1 -1
- package/esm2020/lib/components/load-more-button/load-more-button.component.mjs +2 -2
- package/esm2020/lib/components/pagination/pagination.component.mjs +2 -2
- package/esm2020/lib/constants/common.constants.mjs +3 -1
- package/esm2020/lib/enums/color.enum.mjs +43 -0
- package/esm2020/lib/enums/compare.enum.mjs +3 -1
- package/esm2020/lib/enums/index.mjs +2 -1
- package/esm2020/lib/models/index.mjs +1 -1
- package/esm2020/lib/models/position.model.mjs +2 -0
- package/esm2020/lib/types/index.mjs +1 -1
- package/esm2020/lib/types/primitive.type.mjs +2 -0
- package/esm2020/lib/types/segment.type.mjs +2 -0
- package/esm2020/lib/utils/collections.utils.mjs +41 -1
- package/esm2020/lib/utils/common.utils.mjs +171 -31
- package/esm2020/lib/utils/index.mjs +3 -3
- package/fesm2015/ngx-sfc-common.mjs +264 -37
- package/fesm2015/ngx-sfc-common.mjs.map +1 -1
- package/fesm2020/ngx-sfc-common.mjs +264 -37
- package/fesm2020/ngx-sfc-common.mjs.map +1 -1
- package/lib/components/button/button.component.d.ts +3 -2
- package/lib/constants/common.constants.d.ts +2 -0
- package/lib/enums/color.enum.d.ts +30 -0
- package/lib/enums/compare.enum.d.ts +3 -1
- package/lib/enums/index.d.ts +1 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/position.model.d.ts +4 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/primitive.type.d.ts +1 -0
- package/lib/types/segment.type.d.ts +1 -0
- package/lib/utils/collections.utils.d.ts +23 -0
- package/lib/utils/common.utils.d.ts +25 -9
- package/lib/utils/index.d.ts +2 -2
- package/package.json +1 -1
- package/styles/_mixins.scss +38 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ButtonType } from './button-type.enum';
|
|
2
2
|
import { IconDefinition } from '@fortawesome/free-solid-svg-icons';
|
|
3
3
|
import { IClassModel } from '../../models';
|
|
4
|
+
import { empty } from '../../types';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
export declare class ButtonComponent {
|
|
6
7
|
private readonly BUTTON_DEFAULT_TEXT;
|
|
7
8
|
text?: string;
|
|
8
|
-
iconBefore?: IconDefinition;
|
|
9
|
-
iconAfter?: IconDefinition;
|
|
9
|
+
iconBefore?: IconDefinition | empty;
|
|
10
|
+
iconAfter?: IconDefinition | empty;
|
|
10
11
|
disabled: boolean;
|
|
11
12
|
types: Array<ButtonType>;
|
|
12
13
|
get label(): string | undefined;
|
|
@@ -4,7 +4,9 @@ export declare class CommonConstants {
|
|
|
4
4
|
static DEFAULT_KEY_VALUE: number;
|
|
5
5
|
static MOUSE_BUTTON_LEFT: number;
|
|
6
6
|
static FULL_PERCENTAGE: number;
|
|
7
|
+
static LOW_PERCENTAGE: number;
|
|
7
8
|
static COMMON_TEXT_DELIMETER: string;
|
|
8
9
|
static PERCENTAGE_SYMBOL: string;
|
|
9
10
|
static DOT: string;
|
|
11
|
+
static ASTERISK: string;
|
|
10
12
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum Color {
|
|
2
|
+
White_0 = "#fff",
|
|
3
|
+
White_1 = "#e6e9ed",
|
|
4
|
+
Grey_0 = "#ccd1d9",
|
|
5
|
+
Grey_1 = "#aab2bd",
|
|
6
|
+
Grey_2 = "#656d78",
|
|
7
|
+
Black_0 = "#34323d",
|
|
8
|
+
Black_1 = "#1b1d1f",
|
|
9
|
+
Black_2 = "#000",
|
|
10
|
+
Red_0 = "#ed5565",
|
|
11
|
+
Red_1 = "#da4453",
|
|
12
|
+
Orange_0 = "#fc6e51",
|
|
13
|
+
Orange_1 = "#e9573f",
|
|
14
|
+
Yellow_0 = "#ffce54",
|
|
15
|
+
Yellow_1 = "#fcbb42",
|
|
16
|
+
Yellow_2 = "#f8e976",
|
|
17
|
+
Green_0 = "#a0d468",
|
|
18
|
+
Green_1 = "#8cc152",
|
|
19
|
+
Green_2 = "#48cfad",
|
|
20
|
+
Green_3 = "#37bc9b",
|
|
21
|
+
Green_4 = "#2bbbad",
|
|
22
|
+
Blue_0 = "#4fc1e9",
|
|
23
|
+
Blue_1 = "#3bafda",
|
|
24
|
+
Blue_2 = "#5d9cec",
|
|
25
|
+
Blue_3 = "#4a89dc",
|
|
26
|
+
Magenta_0 = "#ac92ec",
|
|
27
|
+
Magenta_1 = "#967adc",
|
|
28
|
+
Pink_0 = "#ec87c0",
|
|
29
|
+
Pink_1 = "#d770ad"
|
|
30
|
+
}
|
package/lib/enums/index.d.ts
CHANGED
package/lib/models/index.d.ts
CHANGED
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type primitive = string | number | boolean | null | undefined | symbol | bigint;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type segment = string | number | "*";
|
|
@@ -155,6 +155,13 @@ export declare function removeItemBy<T>(collection: Array<T>, predicate: (item:
|
|
|
155
155
|
* @returns True if successfully removed
|
|
156
156
|
*/
|
|
157
157
|
export declare function updateItemBy<T>(collection: Array<T>, predicate: (item: T) => boolean, newItem: T): Array<T> | null;
|
|
158
|
+
/**
|
|
159
|
+
* Toggle item in array
|
|
160
|
+
* @param arr Array of items
|
|
161
|
+
* @param item Item to toggle
|
|
162
|
+
* @returns Toggling result array
|
|
163
|
+
*/
|
|
164
|
+
export declare function toggleItem<T>(array: T[], item: T): T[];
|
|
158
165
|
/**
|
|
159
166
|
* Return collection or empty if collection is not defined
|
|
160
167
|
* @param collection Array of items
|
|
@@ -168,3 +175,19 @@ export declare function getCollectionOrEmpty<T>(collection: Array<T>): Array<T>;
|
|
|
168
175
|
* @returns True if arrays are equal
|
|
169
176
|
*/
|
|
170
177
|
export declare function isArraysEquals<T>(a: Array<T>, b: Array<T>): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Get previous item in array depend on key
|
|
180
|
+
* @param array Array of objects
|
|
181
|
+
* @param key Key name
|
|
182
|
+
* @param value Value for key
|
|
183
|
+
* @returns Previous item
|
|
184
|
+
*/
|
|
185
|
+
export declare function getPreviousItemByKey<T, K extends keyof T>(array: T[], key: K, value: T[K]): T | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Get next item in array depend on key
|
|
188
|
+
* @param array Array of objects
|
|
189
|
+
* @param key Key name
|
|
190
|
+
* @param value Value for key
|
|
191
|
+
* @returns Next item
|
|
192
|
+
*/
|
|
193
|
+
export declare function getNextItemByKey<T, K extends keyof T>(array: T[], key: K, value: T[K]): T | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { empty } from '../types';
|
|
2
|
+
import { segment } from '../types/segment.type';
|
|
2
3
|
/**
|
|
3
4
|
* Return true if value defined
|
|
4
5
|
* @param value Value to check
|
|
@@ -97,20 +98,27 @@ export declare function stopAndPreventPropagation(event: Event): void;
|
|
|
97
98
|
/**
|
|
98
99
|
* Update property in object by key
|
|
99
100
|
* @param obj Object to change
|
|
100
|
-
* @param
|
|
101
|
+
* @param key Property to change
|
|
101
102
|
* @param newPropertyValue New property value
|
|
102
|
-
* @param
|
|
103
|
+
* @param options Options for array types
|
|
103
104
|
* @returns Updated object
|
|
104
105
|
*/
|
|
105
|
-
export declare function updatePropertyByKey(obj: any,
|
|
106
|
+
export declare function updatePropertyByKey<T>(obj: any, key: string, newPropertyValue: T, options?: {
|
|
107
|
+
arrayMode?: "toggle" | "replace";
|
|
108
|
+
arrayToggleValue?: T;
|
|
109
|
+
}): any;
|
|
106
110
|
/**
|
|
107
|
-
*
|
|
108
|
-
* @param
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
111
|
-
* @
|
|
111
|
+
* Update property in object by path
|
|
112
|
+
* @param obj Object to change
|
|
113
|
+
* @param path Property to change
|
|
114
|
+
* @param newPropertyValue New property value
|
|
115
|
+
* @param previousPropertyValue New property value
|
|
116
|
+
* @param options Options for array types
|
|
117
|
+
* @returns Updated object
|
|
112
118
|
*/
|
|
113
|
-
export declare function
|
|
119
|
+
export declare function updatePropertyByPath<T>(obj: any, path: string | segment[], newPropertyValue: T, previousPropertyValue: T, options?: {
|
|
120
|
+
arrayMode?: "toggle" | "replace";
|
|
121
|
+
}): any;
|
|
114
122
|
/**
|
|
115
123
|
* Get changed property key
|
|
116
124
|
* @param previous Previous value
|
|
@@ -118,6 +126,14 @@ export declare function findChangedPropertyPath(previous: any, current: any, par
|
|
|
118
126
|
* @returns Key of property that was changed
|
|
119
127
|
*/
|
|
120
128
|
export declare function findChangedPropertyKey(previous: any, current: any): string | empty;
|
|
129
|
+
/**
|
|
130
|
+
* Get changed property path
|
|
131
|
+
* @param previous Previous value
|
|
132
|
+
* @param current Currency value
|
|
133
|
+
* @param parentKey Parent object key name
|
|
134
|
+
* @returns Path of property that was changed
|
|
135
|
+
*/
|
|
136
|
+
export declare function findChangedPropertyPath(previous: any, current: any, parentKey?: string): string | empty;
|
|
121
137
|
/**
|
|
122
138
|
* Clone object without any reference
|
|
123
139
|
* @param value Object to clone
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { isDefined, isObject, isAsyncData, addPropertyToObject, removePropertyFromObject, mergeDeep, nameof, isNumeric, isString, isChromeBrowser, isEmail, parseBoolean, isEqual, generateGuid, isJsonString, stopAndPreventPropagation, updatePropertyByKey,
|
|
1
|
+
export { isDefined, isObject, isAsyncData, addPropertyToObject, removePropertyFromObject, mergeDeep, nameof, isNumeric, isString, isChromeBrowser, isEmail, parseBoolean, isEqual, generateGuid, isJsonString, stopAndPreventPropagation, updatePropertyByKey, updatePropertyByPath, findChangedPropertyKey, findChangedPropertyPath, deepClone } from './common.utils';
|
|
2
2
|
export { isNullOrEmptyString, contains, trim } from './string.utils';
|
|
3
3
|
export { setMinutes, setHours, setDay, setYear, setSeconds, setMilliseconds, setDefaultSecondsAndMiliseconds, getNextDate, getPreviousDate, getNextMonth, getPreviousMonth, getNextYear, getPreviousYear, getFirstDayOfMonth, getLastDayOfMonth, getFirstDayOfYear, getLastDayOfYear, getFirstDayOfMonthByYearAndMonth, getLastDayOfMonthByYearAndMonth, getWeeksNumberInMonth, isEqualDates, isEqualDateTimes, isDateGreat, isDateGreatOrEqual, isDateTimeGreat, isDateTimeGreatOrEqual, isDateTimeLessOrEqual, isTimeGreatOrEqual, isTimeLessOrEqual, convertUTCDateToLocalDate, convertTimestampToDate, convertDateToTimestamp, getAge } from './date-time.utils';
|
|
4
4
|
export { parseFileSize, getFileExtension, readAsDataURL, isImage, convertToBase64String, convertFromBase64String } from './file.utils';
|
|
5
5
|
export { getCssLikeValue, getValueFromCssLikeValue, getCalcValue, getRotateValue, addClasses, removeClasses, rgbToHex, hexToRgb, replaceRgbOpacity } from './ui.utils';
|
|
6
|
-
export { any, hasItem, hasItemBy, hasObjectItem, hasAnyItem, firstOrDefault, firstItem, lastItem, all, where, skip, sort, sortBy, sortByPath, distinct, sum, max, remove, addItem, removeItem, removeItemBy, updateItemBy, getCollectionOrEmpty, count, isArraysEquals } from './collections.utils';
|
|
6
|
+
export { any, hasItem, hasItemBy, hasObjectItem, hasAnyItem, firstOrDefault, firstItem, lastItem, all, where, skip, sort, sortBy, sortByPath, distinct, sum, max, remove, addItem, removeItem, removeItemBy, updateItemBy, toggleItem, getCollectionOrEmpty, count, isArraysEquals, getPreviousItemByKey, getNextItemByKey } from './collections.utils';
|
|
7
7
|
export { buildHttpParams } from './http.utils';
|
package/package.json
CHANGED
package/styles/_mixins.scss
CHANGED
|
@@ -36,16 +36,35 @@
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
@mixin wrap($gap: 0) {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-wrap: wrap;
|
|
42
|
+
gap: $gap;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@mixin wrap-row($gap: 0) {
|
|
46
|
+
@include wrap($gap);
|
|
47
|
+
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@mixin wrap-column($gap: 0) {
|
|
52
|
+
@include wrap($gap);
|
|
53
|
+
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
@mixin center() {
|
|
40
58
|
display: flex;
|
|
41
59
|
align-items: center;
|
|
42
60
|
justify-content: center;
|
|
43
61
|
}
|
|
44
62
|
|
|
45
|
-
@mixin center-wrap() {
|
|
63
|
+
@mixin center-wrap($gap: 0) {
|
|
46
64
|
@include center;
|
|
47
65
|
|
|
48
66
|
flex-wrap: wrap;
|
|
67
|
+
gap: $gap;
|
|
49
68
|
}
|
|
50
69
|
|
|
51
70
|
@mixin center-column() {
|
|
@@ -54,6 +73,24 @@
|
|
|
54
73
|
flex-direction: column;
|
|
55
74
|
}
|
|
56
75
|
|
|
76
|
+
@mixin center-wrap-column($gap: 0) {
|
|
77
|
+
@include center-wrap($gap);
|
|
78
|
+
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@mixin center-row() {
|
|
83
|
+
@include center;
|
|
84
|
+
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@mixin center-wrap-row($gap: 0) {
|
|
89
|
+
@include center-wrap($gap);
|
|
90
|
+
|
|
91
|
+
flex-direction: row;
|
|
92
|
+
}
|
|
93
|
+
|
|
57
94
|
@mixin not-first-not-last {
|
|
58
95
|
&:not(:first-child, :last-child) {
|
|
59
96
|
@content;
|