@itwin/ecschema-locaters 5.5.0-dev.11 → 5.5.0-dev.13

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.
@@ -9,7 +9,7 @@ var jumpToCode = (function init() {
9
9
  // We don't want to select elements that are direct descendants of another match
10
10
  var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
11
11
 
12
- // Selecter that finds elements on the page to which we can jump
12
+ // Selector that finds elements on the page to which we can jump
13
13
  var selector =
14
14
  fileListingElements.join(', ') +
15
15
  ', ' +
@@ -27,17 +27,31 @@ var addSorting = (function() {
27
27
  function onFilterInput() {
28
28
  const searchValue = document.getElementById('fileSearch').value;
29
29
  const rows = document.getElementsByTagName('tbody')[0].children;
30
+
31
+ // Try to create a RegExp from the searchValue. If it fails (invalid regex),
32
+ // it will be treated as a plain text search
33
+ let searchRegex;
34
+ try {
35
+ searchRegex = new RegExp(searchValue, 'i'); // 'i' for case-insensitive
36
+ } catch (error) {
37
+ searchRegex = null;
38
+ }
39
+
30
40
  for (let i = 0; i < rows.length; i++) {
31
41
  const row = rows[i];
32
- if (
33
- row.textContent
34
- .toLowerCase()
35
- .includes(searchValue.toLowerCase())
36
- ) {
37
- row.style.display = '';
42
+ let isMatch = false;
43
+
44
+ if (searchRegex) {
45
+ // If a valid regex was created, use it for matching
46
+ isMatch = searchRegex.test(row.textContent);
38
47
  } else {
39
- row.style.display = 'none';
48
+ // Otherwise, fall back to the original plain text search
49
+ isMatch = row.textContent
50
+ .toLowerCase()
51
+ .includes(searchValue.toLowerCase());
40
52
  }
53
+
54
+ row.style.display = isMatch ? '' : 'none';
41
55
  }
42
56
  }
43
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/ecschema-locaters",
3
- "version": "5.5.0-dev.11",
3
+ "version": "5.5.0-dev.13",
4
4
  "description": "EC Schema file locaters",
5
5
  "license": "MIT",
6
6
  "main": "lib/cjs/ecschema-locaters.js",
@@ -54,8 +54,8 @@
54
54
  "rimraf": "^6.0.1",
55
55
  "sinon": "^17.0.2",
56
56
  "typescript": "~5.6.2",
57
- "@itwin/build-tools": "5.5.0-dev.11",
58
- "@itwin/ecschema-metadata": "5.5.0-dev.11"
57
+ "@itwin/ecschema-metadata": "5.5.0-dev.13",
58
+ "@itwin/build-tools": "5.5.0-dev.13"
59
59
  },
60
60
  "dependencies": {
61
61
  "glob": "^10.5.0",
@@ -63,7 +63,7 @@
63
63
  "@xmldom/xmldom": "~0.8.10"
64
64
  },
65
65
  "peerDependencies": {
66
- "@itwin/ecschema-metadata": "5.5.0-dev.11"
66
+ "@itwin/ecschema-metadata": "5.5.0-dev.13"
67
67
  },
68
68
  "nyc": {
69
69
  "extends": "./node_modules/@itwin/build-tools/.nycrc",