novo-elements 11.1.0-next.1 → 11.1.0-next.3

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.
@@ -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') {
@@ -21674,13 +21710,19 @@ class Helpers {
21674
21710
  }
21675
21711
  }
21676
21712
  /**
21677
- * Checks to see if the object is a undefined or null
21713
+ * Checks to see if the object is undefined or null
21678
21714
  */
21679
21715
  static isBlank(obj) {
21716
+ return Helpers.isNullOrUndefined(obj);
21717
+ }
21718
+ /**
21719
+ * Checks to see if the object is null or undefined
21720
+ */
21721
+ static isNullOrUndefined(obj) {
21680
21722
  return obj === undefined || obj === null;
21681
21723
  }
21682
21724
  /**
21683
- * Checks to see if the object is a undefined or null
21725
+ * Checks to see if the object is undefined, null, an empty string, or an empty array
21684
21726
  */
21685
21727
  static isEmpty(obj) {
21686
21728
  return Helpers.isBlank(obj) || obj === '' || (Array.isArray(obj) && obj.length === 0);
@@ -21697,6 +21739,11 @@ class Helpers {
21697
21739
  static isDate(obj) {
21698
21740
  return obj instanceof Date;
21699
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
+ */
21700
21747
  static isIsoDate(str) {
21701
21748
  if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) {
21702
21749
  return false;
@@ -21704,6 +21751,11 @@ class Helpers {
21704
21751
  const d = new Date(str);
21705
21752
  return d.toISOString() === str;
21706
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
+ */
21707
21759
  static convertToArray(obj) {
21708
21760
  if (obj === undefined) {
21709
21761
  return [];
@@ -21713,6 +21765,12 @@ class Helpers {
21713
21765
  }
21714
21766
  return obj;
21715
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
+ */
21716
21774
  static sortByField(fields, reverse = false) {
21717
21775
  return (previous, current) => {
21718
21776
  if (Helpers.isFunction(fields)) {
@@ -21750,6 +21808,13 @@ class Helpers {
21750
21808
  return 0;
21751
21809
  };
21752
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
+ */
21753
21818
  static filterByField(key, value) {
21754
21819
  return (item) => {
21755
21820
  const results = [];
@@ -21797,11 +21862,23 @@ class Helpers {
21797
21862
  return results.every((x) => x);
21798
21863
  };
21799
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
+ */
21800
21871
  static findAncestor(element, selector) {
21801
21872
  while ((element = element.parentElement) && !element.matches.call(element, selector))
21802
21873
  ; // tslint:disable-line
21803
21874
  return element;
21804
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
+ */
21805
21882
  static deepClone(item) {
21806
21883
  if (Array.isArray(item)) {
21807
21884
  const newArr = [];
@@ -21831,6 +21908,13 @@ class Helpers {
21831
21908
  }
21832
21909
  return item;
21833
21910
  }
21911
+ /**
21912
+ * Recursively merges multiple objects into a single object
21913
+ * Nested objects and arrays are merged deeply
21914
+ * @param objs - Two or more objects to merge
21915
+ * @returns A new object with all properties merged
21916
+ * @throws Error if fewer than 2 objects are provided
21917
+ */
21834
21918
  static deepAssign(...objs) {
21835
21919
  if (objs.length < 2) {
21836
21920
  throw new Error('Need two or more objects to merge');
@@ -21900,6 +21984,11 @@ class Helpers {
21900
21984
  return e;
21901
21985
  }
21902
21986
  }
21987
+ /**
21988
+ * Converts a Date object to an object with formatted date and time parts
21989
+ * @param date - The Date object to convert
21990
+ * @returns An object with date components (year, month, day, hour, minute, second, weekday, era, dayPeriod)
21991
+ */
21903
21992
  static dateToObject(date) {
21904
21993
  const dateObj = {
21905
21994
  day: '',
@@ -21931,10 +22020,22 @@ class Helpers {
21931
22020
  return dateObj;
21932
22021
  }
21933
22022
  }
22023
+ /**
22024
+ * Helper class for safe property access using dot notation
22025
+ */
21934
22026
  class Can {
22027
+ /**
22028
+ * Creates a new Can instance
22029
+ * @param obj - The object to wrap for safe property access
22030
+ */
21935
22031
  constructor(obj) {
21936
22032
  this.obj = obj;
21937
22033
  }
22034
+ /**
22035
+ * Safely accesses a property using dot notation
22036
+ * @param key - The property key (supports dot notation for nested properties)
22037
+ * @returns The property value or undefined
22038
+ */
21938
22039
  have(key) {
21939
22040
  const props = key.split('.');
21940
22041
  let item = this.obj;
@@ -21946,14 +22047,32 @@ class Can {
21946
22047
  }
21947
22048
  return item;
21948
22049
  }
22050
+ /**
22051
+ * Checks if a value is defined (not undefined)
22052
+ * @param thing - The value to check
22053
+ * @returns true if the value is defined, false otherwise
22054
+ */
21949
22055
  check(thing) {
21950
22056
  return thing !== void 0;
21951
22057
  }
21952
22058
  }
22059
+ /**
22060
+ * Factory function to create a Can instance for safe property access
22061
+ * @param obj - The object to wrap
22062
+ * @returns A new Can instance
22063
+ */
21953
22064
  function can(obj) {
21954
22065
  return new Can(obj);
21955
22066
  }
21956
- // Assumes data is already sorted
22067
+ /**
22068
+ * Performs a binary search on a sorted array
22069
+ * Note: Assumes the array is already sorted according to the compare function
22070
+ * @param item - The item to search for
22071
+ * @param array - The sorted array to search in
22072
+ * @param compare - Comparator function that returns -1 (item < array[i]), 0 (equal), or 1 (item > array[i])
22073
+ * @returns The matching item if found, undefined otherwise
22074
+ * @throws Error if the item is not comparable to an array element
22075
+ */
21957
22076
  function binarySearch(item, array, compare) {
21958
22077
  return search(0, array.length - 1);
21959
22078
  function search(min, max) {