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.
- package/fesm2022/novo-elements-elements-button.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-chips.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-common.mjs +0 -11
- package/fesm2022/novo-elements-elements-common.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-date-picker.mjs +1 -0
- package/fesm2022/novo-elements-elements-date-picker.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-drag-drop.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-field.mjs +0 -2
- package/fesm2022/novo-elements-elements-field.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-form.mjs +9 -9
- package/fesm2022/novo-elements-elements-form.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-layout.mjs +0 -2
- package/fesm2022/novo-elements-elements-layout.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-picker.mjs +1 -1
- package/fesm2022/novo-elements-elements-picker.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-query-builder.mjs +0 -1
- package/fesm2022/novo-elements-elements-query-builder.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-search.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-select-search.mjs +1 -2
- package/fesm2022/novo-elements-elements-select-search.mjs.map +1 -1
- package/fesm2022/novo-elements-elements-tabbed-group-picker.mjs +8 -3
- package/fesm2022/novo-elements-elements-tabbed-group-picker.mjs.map +1 -1
- package/fesm2022/novo-elements-utils.mjs +120 -8
- package/fesm2022/novo-elements-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/Helpers.d.ts +114 -0
|
@@ -88,7 +88,7 @@ class AppBridge {
|
|
|
88
88
|
}
|
|
89
89
|
_trace(eventType, event) {
|
|
90
90
|
if (this._tracing) {
|
|
91
|
-
console.
|
|
91
|
+
console.info(`[${this.traceName || this.id}] "${eventType}"`, event);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
_setupHandlers() {
|
|
@@ -368,7 +368,7 @@ class AppBridge {
|
|
|
368
368
|
}
|
|
369
369
|
else {
|
|
370
370
|
if (packet) {
|
|
371
|
-
console.info('[AppBridge] - close(packet) is deprecated! Please just use close()!');
|
|
371
|
+
console.info('[AppBridge] - close(packet) is deprecated! Please just use close()!');
|
|
372
372
|
}
|
|
373
373
|
const realPacket = { id: this.id, windowName: this.windowName };
|
|
374
374
|
this.postRobot
|
|
@@ -405,7 +405,7 @@ class AppBridge {
|
|
|
405
405
|
}
|
|
406
406
|
else {
|
|
407
407
|
if (packet) {
|
|
408
|
-
console.info('[AppBridge] - refresh(packet) is deprecated! Please just use refresh()!');
|
|
408
|
+
console.info('[AppBridge] - refresh(packet) is deprecated! Please just use refresh()!');
|
|
409
409
|
}
|
|
410
410
|
const realPacket = { id: this.id, windowName: this.windowName };
|
|
411
411
|
this.postRobot
|
|
@@ -461,7 +461,7 @@ class AppBridge {
|
|
|
461
461
|
}
|
|
462
462
|
else {
|
|
463
463
|
if (packet) {
|
|
464
|
-
console.info('[AppBridge] - pin(packet) is deprecated! Please just use pin()!');
|
|
464
|
+
console.info('[AppBridge] - pin(packet) is deprecated! Please just use pin()!');
|
|
465
465
|
}
|
|
466
466
|
const realPacket = { id: this.id, windowName: this.windowName };
|
|
467
467
|
this.postRobot
|
|
@@ -21568,6 +21568,11 @@ function Deferred() {
|
|
|
21568
21568
|
|
|
21569
21569
|
// @dynamic
|
|
21570
21570
|
class Helpers {
|
|
21571
|
+
/**
|
|
21572
|
+
* Checks if the provided value is an Angular TemplateRef
|
|
21573
|
+
* @param value - The value to check
|
|
21574
|
+
* @returns true if the value is an instance of TemplateRef, false otherwise
|
|
21575
|
+
*/
|
|
21571
21576
|
static isTemplateRef(value) {
|
|
21572
21577
|
return value instanceof TemplateRef;
|
|
21573
21578
|
}
|
|
@@ -21580,6 +21585,13 @@ class Helpers {
|
|
|
21580
21585
|
event.preventDefault();
|
|
21581
21586
|
}
|
|
21582
21587
|
}
|
|
21588
|
+
/**
|
|
21589
|
+
* Interpolates a string or function with provided properties
|
|
21590
|
+
* Replaces placeholders in the format $variableName with values from props
|
|
21591
|
+
* @param str - The format string or function to interpolate
|
|
21592
|
+
* @param props - The object containing values to replace placeholders
|
|
21593
|
+
* @returns The interpolated string
|
|
21594
|
+
*/
|
|
21583
21595
|
static interpolate(str, props) {
|
|
21584
21596
|
if (typeof str === 'function') {
|
|
21585
21597
|
return str(props);
|
|
@@ -21597,6 +21609,14 @@ class Helpers {
|
|
|
21597
21609
|
return value !== undefined ? value : '';
|
|
21598
21610
|
});
|
|
21599
21611
|
}
|
|
21612
|
+
/**
|
|
21613
|
+
* Interpolates a format string (or array of strings) with provided data
|
|
21614
|
+
* Attempts to replace all variables, returning the first successful interpolation
|
|
21615
|
+
* or an empty string if all attempts fail
|
|
21616
|
+
* @param formatString - A single format string or array of format strings to try
|
|
21617
|
+
* @param data - The object containing values to replace placeholders
|
|
21618
|
+
* @returns The first successfully interpolated string, or an empty string
|
|
21619
|
+
*/
|
|
21600
21620
|
static interpolateWithFallback(formatString, data) {
|
|
21601
21621
|
// Format string can be an array, it will attempt to interpolate each item
|
|
21602
21622
|
// in the array, if there is a failure to replace it will mark it as such
|
|
@@ -21649,6 +21669,11 @@ class Helpers {
|
|
|
21649
21669
|
return props.hasOwnProperty(key.substr(1));
|
|
21650
21670
|
});
|
|
21651
21671
|
}
|
|
21672
|
+
/**
|
|
21673
|
+
* Checks if the provided value is a plain object
|
|
21674
|
+
* @param item - The value to check
|
|
21675
|
+
* @returns true if the value is an object but not an array or null, false otherwise
|
|
21676
|
+
*/
|
|
21652
21677
|
static isObject(item) {
|
|
21653
21678
|
return item && typeof item === 'object' && !Array.isArray(item) && item !== null;
|
|
21654
21679
|
}
|
|
@@ -21658,12 +21683,23 @@ class Helpers {
|
|
|
21658
21683
|
static isString(obj) {
|
|
21659
21684
|
return typeof obj === 'string';
|
|
21660
21685
|
}
|
|
21686
|
+
/**
|
|
21687
|
+
* Escapes special regex characters in a string
|
|
21688
|
+
* @param obj - The value to escape (if it's a string)
|
|
21689
|
+
* @returns The escaped string if input is a string, otherwise the original value
|
|
21690
|
+
*/
|
|
21661
21691
|
static escapeString(obj) {
|
|
21662
21692
|
if (Helpers.isString(obj)) {
|
|
21663
21693
|
return obj.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
21664
21694
|
}
|
|
21665
21695
|
return obj;
|
|
21666
21696
|
}
|
|
21697
|
+
/**
|
|
21698
|
+
* Checks if a value is a valid number (string or numeric type)
|
|
21699
|
+
* @param val - The value to check
|
|
21700
|
+
* @param includeNegatives - Whether to allow negative numbers (default: false)
|
|
21701
|
+
* @returns true if the value is a valid number, false otherwise
|
|
21702
|
+
*/
|
|
21667
21703
|
static isNumber(val, includeNegatives = false) {
|
|
21668
21704
|
const numberRegex = includeNegatives ? /^-{0,1}\d*\.?\d*$/ : /^\d*\.?\d*$/;
|
|
21669
21705
|
if (typeof val === 'string') {
|
|
@@ -21703,6 +21739,11 @@ class Helpers {
|
|
|
21703
21739
|
static isDate(obj) {
|
|
21704
21740
|
return obj instanceof Date;
|
|
21705
21741
|
}
|
|
21742
|
+
/**
|
|
21743
|
+
* Checks if a string is a valid ISO 8601 date format
|
|
21744
|
+
* @param str - The string to validate
|
|
21745
|
+
* @returns true if the string is a valid ISO date, false otherwise
|
|
21746
|
+
*/
|
|
21706
21747
|
static isIsoDate(str) {
|
|
21707
21748
|
if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) {
|
|
21708
21749
|
return false;
|
|
@@ -21710,6 +21751,11 @@ class Helpers {
|
|
|
21710
21751
|
const d = new Date(str);
|
|
21711
21752
|
return d.toISOString() === str;
|
|
21712
21753
|
}
|
|
21754
|
+
/**
|
|
21755
|
+
* Converts a value to an array
|
|
21756
|
+
* @param obj - The value to convert
|
|
21757
|
+
* @returns An empty array if undefined, the value wrapped in an array if not already an array, or the array as-is
|
|
21758
|
+
*/
|
|
21713
21759
|
static convertToArray(obj) {
|
|
21714
21760
|
if (obj === undefined) {
|
|
21715
21761
|
return [];
|
|
@@ -21719,6 +21765,12 @@ class Helpers {
|
|
|
21719
21765
|
}
|
|
21720
21766
|
return obj;
|
|
21721
21767
|
}
|
|
21768
|
+
/**
|
|
21769
|
+
* Creates a comparator function for sorting objects by specified fields
|
|
21770
|
+
* @param fields - A field name, array of field names, or custom comparator function
|
|
21771
|
+
* @param reverse - Whether to reverse the sort order (default: false for ascending)
|
|
21772
|
+
* @returns A comparator function suitable for use with Array.sort()
|
|
21773
|
+
*/
|
|
21722
21774
|
static sortByField(fields, reverse = false) {
|
|
21723
21775
|
return (previous, current) => {
|
|
21724
21776
|
if (Helpers.isFunction(fields)) {
|
|
@@ -21756,6 +21808,13 @@ class Helpers {
|
|
|
21756
21808
|
return 0;
|
|
21757
21809
|
};
|
|
21758
21810
|
}
|
|
21811
|
+
/**
|
|
21812
|
+
* Creates a filter function for filtering objects by field values
|
|
21813
|
+
* Supports exact matching, arrays, ranges, and complex filter objects
|
|
21814
|
+
* @param key - The field key to filter on (supports dot notation for nested properties)
|
|
21815
|
+
* @param value - The filter value (can be a function, array, range object, or regex pattern string)
|
|
21816
|
+
* @returns A filter function suitable for use with Array.filter()
|
|
21817
|
+
*/
|
|
21759
21818
|
static filterByField(key, value) {
|
|
21760
21819
|
return (item) => {
|
|
21761
21820
|
const results = [];
|
|
@@ -21803,16 +21862,27 @@ class Helpers {
|
|
|
21803
21862
|
return results.every((x) => x);
|
|
21804
21863
|
};
|
|
21805
21864
|
}
|
|
21865
|
+
/**
|
|
21866
|
+
* Finds the first ancestor element that matches the provided CSS selector
|
|
21867
|
+
* @param element - The starting element to search from
|
|
21868
|
+
* @param selector - The CSS selector to match against
|
|
21869
|
+
* @returns The first matching ancestor element, or undefined if none found
|
|
21870
|
+
*/
|
|
21806
21871
|
static findAncestor(element, selector) {
|
|
21807
21872
|
while ((element = element.parentElement) && !element.matches.call(element, selector))
|
|
21808
|
-
;
|
|
21873
|
+
;
|
|
21809
21874
|
return element;
|
|
21810
21875
|
}
|
|
21876
|
+
/**
|
|
21877
|
+
* Creates a deep clone of an object or array
|
|
21878
|
+
* Recursively clones all nested properties and array elements
|
|
21879
|
+
* @param item - The item to clone
|
|
21880
|
+
* @returns A deep clone of the provided item
|
|
21881
|
+
*/
|
|
21811
21882
|
static deepClone(item) {
|
|
21812
21883
|
if (Array.isArray(item)) {
|
|
21813
21884
|
const newArr = [];
|
|
21814
21885
|
for (let i = item.length; i-- > 0;) {
|
|
21815
|
-
// tslint:disable-line
|
|
21816
21886
|
newArr[i] = Helpers.deepClone(item[i]);
|
|
21817
21887
|
}
|
|
21818
21888
|
return newArr;
|
|
@@ -21837,6 +21907,13 @@ class Helpers {
|
|
|
21837
21907
|
}
|
|
21838
21908
|
return item;
|
|
21839
21909
|
}
|
|
21910
|
+
/**
|
|
21911
|
+
* Recursively merges multiple objects into a single object
|
|
21912
|
+
* Nested objects and arrays are merged deeply
|
|
21913
|
+
* @param objs - Two or more objects to merge
|
|
21914
|
+
* @returns A new object with all properties merged
|
|
21915
|
+
* @throws Error if fewer than 2 objects are provided
|
|
21916
|
+
*/
|
|
21840
21917
|
static deepAssign(...objs) {
|
|
21841
21918
|
if (objs.length < 2) {
|
|
21842
21919
|
throw new Error('Need two or more objects to merge');
|
|
@@ -21906,6 +21983,11 @@ class Helpers {
|
|
|
21906
21983
|
return e;
|
|
21907
21984
|
}
|
|
21908
21985
|
}
|
|
21986
|
+
/**
|
|
21987
|
+
* Converts a Date object to an object with formatted date and time parts
|
|
21988
|
+
* @param date - The Date object to convert
|
|
21989
|
+
* @returns An object with date components (year, month, day, hour, minute, second, weekday, era, dayPeriod)
|
|
21990
|
+
*/
|
|
21909
21991
|
static dateToObject(date) {
|
|
21910
21992
|
const dateObj = {
|
|
21911
21993
|
day: '',
|
|
@@ -21937,10 +22019,22 @@ class Helpers {
|
|
|
21937
22019
|
return dateObj;
|
|
21938
22020
|
}
|
|
21939
22021
|
}
|
|
22022
|
+
/**
|
|
22023
|
+
* Helper class for safe property access using dot notation
|
|
22024
|
+
*/
|
|
21940
22025
|
class Can {
|
|
22026
|
+
/**
|
|
22027
|
+
* Creates a new Can instance
|
|
22028
|
+
* @param obj - The object to wrap for safe property access
|
|
22029
|
+
*/
|
|
21941
22030
|
constructor(obj) {
|
|
21942
22031
|
this.obj = obj;
|
|
21943
22032
|
}
|
|
22033
|
+
/**
|
|
22034
|
+
* Safely accesses a property using dot notation
|
|
22035
|
+
* @param key - The property key (supports dot notation for nested properties)
|
|
22036
|
+
* @returns The property value or undefined
|
|
22037
|
+
*/
|
|
21944
22038
|
have(key) {
|
|
21945
22039
|
const props = key.split('.');
|
|
21946
22040
|
let item = this.obj;
|
|
@@ -21952,14 +22046,32 @@ class Can {
|
|
|
21952
22046
|
}
|
|
21953
22047
|
return item;
|
|
21954
22048
|
}
|
|
22049
|
+
/**
|
|
22050
|
+
* Checks if a value is defined (not undefined)
|
|
22051
|
+
* @param thing - The value to check
|
|
22052
|
+
* @returns true if the value is defined, false otherwise
|
|
22053
|
+
*/
|
|
21955
22054
|
check(thing) {
|
|
21956
22055
|
return thing !== void 0;
|
|
21957
22056
|
}
|
|
21958
22057
|
}
|
|
22058
|
+
/**
|
|
22059
|
+
* Factory function to create a Can instance for safe property access
|
|
22060
|
+
* @param obj - The object to wrap
|
|
22061
|
+
* @returns A new Can instance
|
|
22062
|
+
*/
|
|
21959
22063
|
function can(obj) {
|
|
21960
22064
|
return new Can(obj);
|
|
21961
22065
|
}
|
|
21962
|
-
|
|
22066
|
+
/**
|
|
22067
|
+
* Performs a binary search on a sorted array
|
|
22068
|
+
* Note: Assumes the array is already sorted according to the compare function
|
|
22069
|
+
* @param item - The item to search for
|
|
22070
|
+
* @param array - The sorted array to search in
|
|
22071
|
+
* @param compare - Comparator function that returns -1 (item < array[i]), 0 (equal), or 1 (item > array[i])
|
|
22072
|
+
* @returns The matching item if found, undefined otherwise
|
|
22073
|
+
* @throws Error if the item is not comparable to an array element
|
|
22074
|
+
*/
|
|
21963
22075
|
function binarySearch(item, array, compare) {
|
|
21964
22076
|
return search(0, array.length - 1);
|
|
21965
22077
|
function search(min, max) {
|
|
@@ -22088,7 +22200,7 @@ function notify(message) {
|
|
|
22088
22200
|
return;
|
|
22089
22201
|
}
|
|
22090
22202
|
notifications[message] = true;
|
|
22091
|
-
console.warn(message);
|
|
22203
|
+
console.warn(message);
|
|
22092
22204
|
}
|
|
22093
22205
|
|
|
22094
22206
|
// NG2
|