novo-elements 11.1.0 → 11.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/fesm2022/novo-elements-elements-button.mjs.map +1 -1
  2. package/fesm2022/novo-elements-elements-chips.mjs.map +1 -1
  3. package/fesm2022/novo-elements-elements-common.mjs +0 -11
  4. package/fesm2022/novo-elements-elements-common.mjs.map +1 -1
  5. package/fesm2022/novo-elements-elements-date-picker.mjs +1 -0
  6. package/fesm2022/novo-elements-elements-date-picker.mjs.map +1 -1
  7. package/fesm2022/novo-elements-elements-drag-drop.mjs.map +1 -1
  8. package/fesm2022/novo-elements-elements-field.mjs +0 -2
  9. package/fesm2022/novo-elements-elements-field.mjs.map +1 -1
  10. package/fesm2022/novo-elements-elements-form.mjs +9 -9
  11. package/fesm2022/novo-elements-elements-form.mjs.map +1 -1
  12. package/fesm2022/novo-elements-elements-layout.mjs +0 -2
  13. package/fesm2022/novo-elements-elements-layout.mjs.map +1 -1
  14. package/fesm2022/novo-elements-elements-picker.mjs +1 -1
  15. package/fesm2022/novo-elements-elements-picker.mjs.map +1 -1
  16. package/fesm2022/novo-elements-elements-query-builder.mjs +0 -1
  17. package/fesm2022/novo-elements-elements-query-builder.mjs.map +1 -1
  18. package/fesm2022/novo-elements-elements-search.mjs.map +1 -1
  19. package/fesm2022/novo-elements-elements-select-search.mjs +1 -2
  20. package/fesm2022/novo-elements-elements-select-search.mjs.map +1 -1
  21. package/fesm2022/novo-elements-elements-tabbed-group-picker.mjs +8 -3
  22. package/fesm2022/novo-elements-elements-tabbed-group-picker.mjs.map +1 -1
  23. package/fesm2022/novo-elements-utils.mjs +120 -8
  24. package/fesm2022/novo-elements-utils.mjs.map +1 -1
  25. package/package.json +1 -1
  26. package/utils/Helpers.d.ts +114 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "novo-elements",
3
- "version": "11.1.0",
3
+ "version": "11.2.0",
4
4
  "sideEffects": true,
5
5
  "peerDependencies": {
6
6
  "@angular/animations": ">=10",
@@ -1,10 +1,30 @@
1
1
  export declare class Helpers {
2
+ /**
3
+ * Checks if the provided value is an Angular TemplateRef
4
+ * @param value - The value to check
5
+ * @returns true if the value is an instance of TemplateRef, false otherwise
6
+ */
2
7
  static isTemplateRef(value: any): boolean;
3
8
  /**
4
9
  * Swallows an event to stop further execution
5
10
  */
6
11
  static swallowEvent(event: any): void;
12
+ /**
13
+ * Interpolates a string or function with provided properties
14
+ * Replaces placeholders in the format $variableName with values from props
15
+ * @param str - The format string or function to interpolate
16
+ * @param props - The object containing values to replace placeholders
17
+ * @returns The interpolated string
18
+ */
7
19
  static interpolate(str: string | Function, props: any): string;
20
+ /**
21
+ * Interpolates a format string (or array of strings) with provided data
22
+ * Attempts to replace all variables, returning the first successful interpolation
23
+ * or an empty string if all attempts fail
24
+ * @param formatString - A single format string or array of format strings to try
25
+ * @param data - The object containing values to replace placeholders
26
+ * @returns The first successfully interpolated string, or an empty string
27
+ */
8
28
  static interpolateWithFallback(formatString: string | string[], data: any): string;
9
29
  /**
10
30
  * Verifies that an object has every property expected by a string to interpolate
@@ -12,12 +32,28 @@ export declare class Helpers {
12
32
  * @param props The params to replace in string.
13
33
  */
14
34
  static validateInterpolationProps(str: string | Function, props: any): boolean;
35
+ /**
36
+ * Checks if the provided value is a plain object
37
+ * @param item - The value to check
38
+ * @returns true if the value is an object but not an array or null, false otherwise
39
+ */
15
40
  static isObject(item: any): boolean;
16
41
  /**
17
42
  * Checks to see if the object is a string
18
43
  */
19
44
  static isString(obj: any): obj is string;
45
+ /**
46
+ * Escapes special regex characters in a string
47
+ * @param obj - The value to escape (if it's a string)
48
+ * @returns The escaped string if input is a string, otherwise the original value
49
+ */
20
50
  static escapeString(obj: any): any;
51
+ /**
52
+ * Checks if a value is a valid number (string or numeric type)
53
+ * @param val - The value to check
54
+ * @param includeNegatives - Whether to allow negative numbers (default: false)
55
+ * @returns true if the value is a valid number, false otherwise
56
+ */
21
57
  static isNumber(val: any, includeNegatives?: boolean): boolean;
22
58
  /**
23
59
  * Checks to see if the object is undefined or null
@@ -39,12 +75,54 @@ export declare class Helpers {
39
75
  * Checks to see if the object is a Date
40
76
  */
41
77
  static isDate(obj: any): obj is Date;
78
+ /**
79
+ * Checks if a string is a valid ISO 8601 date format
80
+ * @param str - The string to validate
81
+ * @returns true if the string is a valid ISO date, false otherwise
82
+ */
42
83
  static isIsoDate(str: string): boolean;
84
+ /**
85
+ * Converts a value to an array
86
+ * @param obj - The value to convert
87
+ * @returns An empty array if undefined, the value wrapped in an array if not already an array, or the array as-is
88
+ */
43
89
  static convertToArray(obj: unknown): any[];
90
+ /**
91
+ * Creates a comparator function for sorting objects by specified fields
92
+ * @param fields - A field name, array of field names, or custom comparator function
93
+ * @param reverse - Whether to reverse the sort order (default: false for ascending)
94
+ * @returns A comparator function suitable for use with Array.sort()
95
+ */
44
96
  static sortByField(fields: any, reverse?: boolean): (previous: any, current: any) => any;
97
+ /**
98
+ * Creates a filter function for filtering objects by field values
99
+ * Supports exact matching, arrays, ranges, and complex filter objects
100
+ * @param key - The field key to filter on (supports dot notation for nested properties)
101
+ * @param value - The filter value (can be a function, array, range object, or regex pattern string)
102
+ * @returns A filter function suitable for use with Array.filter()
103
+ */
45
104
  static filterByField(key: any, value: any): (item: any) => boolean;
105
+ /**
106
+ * Finds the first ancestor element that matches the provided CSS selector
107
+ * @param element - The starting element to search from
108
+ * @param selector - The CSS selector to match against
109
+ * @returns The first matching ancestor element, or undefined if none found
110
+ */
46
111
  static findAncestor(element: Element, selector: string): Element;
112
+ /**
113
+ * Creates a deep clone of an object or array
114
+ * Recursively clones all nested properties and array elements
115
+ * @param item - The item to clone
116
+ * @returns A deep clone of the provided item
117
+ */
47
118
  static deepClone(item: any): any;
119
+ /**
120
+ * Recursively merges multiple objects into a single object
121
+ * Nested objects and arrays are merged deeply
122
+ * @param objs - Two or more objects to merge
123
+ * @returns A new object with all properties merged
124
+ * @throws Error if fewer than 2 objects are provided
125
+ */
48
126
  static deepAssign(...objs: any[]): any;
49
127
  /**
50
128
  * Workaround for Edge browser since Element:nextElementSibling is undefined inside of template directives
@@ -52,6 +130,11 @@ export declare class Helpers {
52
130
  * @returns the next sibling node that is of type: Element
53
131
  */
54
132
  static getNextElementSibling(element: Element): Node;
133
+ /**
134
+ * Converts a Date object to an object with formatted date and time parts
135
+ * @param date - The Date object to convert
136
+ * @returns An object with date components (year, month, day, hour, minute, second, weekday, era, dayPeriod)
137
+ */
55
138
  static dateToObject(date: Date): {
56
139
  day: string;
57
140
  dayPeriod: string;
@@ -64,11 +147,42 @@ export declare class Helpers {
64
147
  year: string;
65
148
  };
66
149
  }
150
+ /**
151
+ * Helper class for safe property access using dot notation
152
+ */
67
153
  export declare class Can {
68
154
  obj: Object;
155
+ /**
156
+ * Creates a new Can instance
157
+ * @param obj - The object to wrap for safe property access
158
+ */
69
159
  constructor(obj: Object);
160
+ /**
161
+ * Safely accesses a property using dot notation
162
+ * @param key - The property key (supports dot notation for nested properties)
163
+ * @returns The property value or undefined
164
+ */
70
165
  have(key: string): any;
166
+ /**
167
+ * Checks if a value is defined (not undefined)
168
+ * @param thing - The value to check
169
+ * @returns true if the value is defined, false otherwise
170
+ */
71
171
  check(thing: any): boolean;
72
172
  }
173
+ /**
174
+ * Factory function to create a Can instance for safe property access
175
+ * @param obj - The object to wrap
176
+ * @returns A new Can instance
177
+ */
73
178
  export declare function can(obj: any): Can;
179
+ /**
180
+ * Performs a binary search on a sorted array
181
+ * Note: Assumes the array is already sorted according to the compare function
182
+ * @param item - The item to search for
183
+ * @param array - The sorted array to search in
184
+ * @param compare - Comparator function that returns -1 (item < array[i]), 0 (equal), or 1 (item > array[i])
185
+ * @returns The matching item if found, undefined otherwise
186
+ * @throws Error if the item is not comparable to an array element
187
+ */
74
188
  export declare function binarySearch<T>(item: T, array: T[], compare: (a: T, b: T) => 1 | -1 | 0 | undefined): T | undefined;