Skip to content

Commit 44affb3

Browse files
authored
Merge branch 'master' into tests-refactor
2 parents 1cbd035 + d01b020 commit 44affb3

File tree

14 files changed

+117
-28
lines changed

14 files changed

+117
-28
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"@types/source-map": "0.5.2",
7575
"express": "^4.21.1",
7676
"fflate": "^0.8.1",
77-
"igniteui-theming": "^17.0.0",
77+
"igniteui-theming": "^17.1.0",
7878
"igniteui-trial-watermark": "^3.0.2",
7979
"lodash-es": "^4.17.21",
8080
"rxjs": "^7.8.2",

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"tslib": "^2.3.0",
7474
"igniteui-trial-watermark": "^3.0.2",
7575
"lodash-es": "^4.17.21",
76-
"igniteui-theming": "^17.0.0",
76+
"igniteui-theming": "^17.1.0",
7777
"@igniteui/material-icons-extended": "^3.1.0"
7878
},
7979
"peerDependencies": {

projects/igniteui-angular/src/lib/core/styles/components/chip/_chip-theme.scss

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,14 @@
268268
$box-shadow-focus: map.get((
269269
'material': null,
270270
'fluent': null,
271-
'bootstrap': 0 0 0 rem(2px) var-get($theme, 'focus-outline-color'),
271+
'bootstrap': 0 0 0 rem(4px) var-get($theme, 'focus-outline-color'),
272272
'indigo': 0 0 0 rem(3px) var-get($theme, 'focus-outline-color')
273273
), $variant);
274274

275275
$box-shadow-focus-selected: map.get((
276276
'material': null,
277277
'fluent': null,
278-
'bootstrap': 0 0 0 rem(2px) var-get($theme, 'focus-selected-outline-color'),
278+
'bootstrap': 0 0 0 rem(4px) var-get($theme, 'focus-selected-outline-color'),
279279
'indigo': 0 0 0 rem(3px) var-get($theme, 'focus-selected-outline-color')
280280
), $variant);
281281

@@ -429,9 +429,17 @@
429429
%igx-chip%igx-chip--primary {
430430
&:focus {
431431
%igx-chip__item {
432-
color: contrast-color($color: 'primary', $variant: 800);
433-
background: color($color: 'primary', $variant: 800);
434-
border-color: color($color: 'primary', $variant: 800);
432+
@if $variant != 'bootstrap' and $variant != 'indigo' {
433+
color: contrast-color($color: 'primary', $variant: 800);
434+
background: color($color: 'primary', $variant: 800);
435+
border-color: color($color: 'primary', $variant: 800);
436+
}
437+
438+
@if $variant == "bootstrap" {
439+
color: contrast-color($color: 'primary', $variant: 500);
440+
background: color($color: 'primary', $variant: 500);
441+
border-color: color($color: 'primary', $variant: 500);
442+
}
435443

436444
@if $variant == 'indigo' {
437445
color: contrast-color($color: 'primary', $variant: 900);
@@ -441,7 +449,7 @@
441449
}
442450

443451
@if $variant == 'bootstrap' {
444-
box-shadow: 0 0 0 rem(2px) color($color: 'primary', $variant: 200);
452+
box-shadow: 0 0 0 rem(4px) color($color: 'primary', $variant: 500, $opacity: .38);
445453
}
446454
}
447455
}
@@ -474,15 +482,18 @@
474482
background: color($color: 'info', $variant: 800);
475483
border-color: color($color: 'info', $variant: 800);
476484

477-
@if $variant == 'indigo' {
485+
@if $variant == 'indigo' or $variant == 'bootstrap' {
478486
color: contrast-color($color: 'info', $variant: 500);
479487
background: color($color: 'info', $variant: 500);
480488
border-color: color($color: 'info', $variant: 500);
489+
}
490+
491+
@if $variant == 'indigo' {
481492
box-shadow: 0 0 0 rem(3px) color($color: 'info', $variant: if($theme-variant == 'light', 100, 800));
482493
}
483494

484495
@if $variant == 'bootstrap' {
485-
box-shadow: 0 0 0 rem(2px) color($color: 'info', $variant: 200);
496+
box-shadow: 0 0 0 rem(4px) color($color: 'info', $variant: 500, $opacity: .38);
486497
}
487498
}
488499
}
@@ -519,15 +530,19 @@
519530
background: color($color: 'success', $variant: 800);
520531
border-color: color($color: 'success', $variant: 800);
521532

522-
@if $variant == 'indigo' {
523-
color: contrast-color($color: 'success', $variant: 900);
533+
@if $variant == 'indigo' or $variant == 'bootstrap' {
524534
background: color($color: 'success', $variant: 500);
525535
border-color: color($color: 'success', $variant: 500);
526536
box-shadow: 0 0 0 rem(3px) color($color: 'success', $variant: if($theme-variant == 'light', 200, 800));
527537
}
528538

539+
@if $variant == 'indigo' {
540+
color: contrast-color($color: 'success', $variant: 900);
541+
}
542+
529543
@if $variant == 'bootstrap' {
530-
box-shadow: 0 0 0 rem(2px) color($color: 'success', $variant: 200);
544+
color: contrast-color($color: 'success', $variant: 600);
545+
box-shadow: 0 0 0 rem(4px) color($color: 'success', $variant: 500, $opacity: .38);
531546
}
532547
}
533548
}
@@ -560,15 +575,18 @@
560575
background: color($color: 'warn', $variant: 800);
561576
border-color: color($color: 'warn', $variant: 800);
562577

563-
@if $variant == 'indigo' {
578+
@if $variant == 'indigo' or $variant == 'bootstrap' {
564579
color: contrast-color($color: 'warn', $variant: 900);
565580
background: color($color: 'warn', $variant: 500);
566581
border-color: color($color: 'warn', $variant: 500);
582+
}
583+
584+
@if $variant == 'indigo' {
567585
box-shadow: 0 0 0 rem(3px) color($color: 'warn', $variant: if($theme-variant == 'light', 100, 900));
568586
}
569587

570588
@if $variant == 'bootstrap' {
571-
box-shadow: 0 0 0 rem(2px) color($color: 'warn', $variant: 200);
589+
box-shadow: 0 0 0 rem(4px) color($color: 'warn', $variant: 500, $opacity: .38);
572590
}
573591
}
574592
}
@@ -605,15 +623,19 @@
605623
background: color($color: 'error', $variant: 800);
606624
border-color: color($color: 'error', $variant: 800);
607625

608-
@if $variant == 'indigo' {
609-
color: contrast-color($color: 'error', $variant: 900);
626+
@if $variant == 'indigo' or $variant == 'bootstrap' {
610627
background: color($color: 'error', $variant: 500);
611628
border-color: color($color: 'error', $variant: 500);
629+
}
630+
631+
@if $variant == 'indigo' {
632+
color: contrast-color($color: 'error', $variant: 900);
612633
box-shadow: 0 0 0 rem(3px) color($color: 'error', $variant: if($theme-variant == 'light', 100, 900));
613634
}
614635

615636
@if $variant == 'bootstrap' {
616-
box-shadow: 0 0 0 rem(2px) color($color: 'error', $variant: 200);
637+
color: contrast-color($color: 'error', $variant: 600);
638+
box-shadow: 0 0 0 rem(4px) color($color: 'error', $variant: 500, $opacity: .38);
617639
}
618640
}
619641
}

projects/igniteui-angular/src/lib/data-operations/filtering-expressions-tree.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export enum FilteringExpressionsTreeType {
88
Advanced
99
}
1010

11+
/* marshalByValue */
1112
export declare interface IExpressionTree {
1213
filteringOperands: (IExpressionTree | IFilteringExpression)[];
1314
operator: FilteringLogic;

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ export class IgxGridForOfDirective<T, U extends T[] = T[]> extends IgxForOfDirec
18001800
changes.forEachItem((item) => {
18011801
if (item.previousIndex !== null &&
18021802
(numRemovedItems < 2 || !identityChanges.length || identityChanges[item.currentIndex])
1803-
&& this.igxForScrollOrientation !== "horizontal") {
1803+
&& this.igxForScrollOrientation !== "horizontal" && this.individualSizeCache.length > 0) {
18041804
// Reuse cache on those who have previousIndex.
18051805
// When there are more than one removed items currently the changes are not readable so ones with identity change
18061806
// should be racalculated.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { getUUID } from './random';
2+
3+
describe('Random (crypto.randomUuid()) fallback unit tests', () => {
4+
let originalRandomUuid = crypto.randomUUID;
5+
6+
beforeAll(() => {
7+
crypto.randomUUID = null; // Mock crypto.randomUUID to simulate a non-secure context
8+
});
9+
10+
it('should generate a valid UUID', () => {
11+
const uuid = getUUID();
12+
expect(uuid).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
13+
});
14+
15+
it('should generate unique UUIDs', () => {
16+
const uuids = new Set();
17+
for (let i = 0; i < 100; i++) {
18+
uuids.add(getUUID());
19+
}
20+
expect(uuids.size).toBe(100); // All UUIDs should be unique
21+
});
22+
23+
afterAll(() => {
24+
crypto.randomUUID = originalRandomUuid; // Restore the original function
25+
});
26+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Use the function to get a random UUID string when secure context is not guaranteed making crypto.randomUUID unavailable.
3+
* @returns A random UUID string.
4+
*/
5+
export function getUUID(): `${string}-${string}-${string}-${string}-${string}` {
6+
if (typeof crypto.randomUUID === 'function') {
7+
return crypto.randomUUID();
8+
}
9+
// Secure fallback using crypto.getRandomValues()
10+
const bytes = new Uint8Array(16);
11+
crypto.getRandomValues(bytes);
12+
13+
// Set version (4) and variant (RFC 4122)
14+
bytes[6] = (bytes[6] & 0x0f) | 0x40; // Version 4
15+
bytes[8] = (bytes[8] & 0x3f) | 0x80; // Variant 1
16+
17+
const a = [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
18+
return `${a.slice(0, 8)}-${a.slice(8, 12)}-${a.slice(12, 16)}-${a.slice(16, 20)}-${a.slice(20)}`;
19+
}

projects/igniteui-angular/src/lib/grids/filtering/excel-style/common.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { isTree } from '../../../data-operations/expressions-tree-util';
22
import { FilteringLogic, IFilteringExpression } from '../../../data-operations/filtering-expression.interface';
33
import { IFilteringExpressionsTree } from '../../../data-operations/filtering-expressions-tree';
4+
import { getUUID } from '../../common/random';
45

56
/**
67
* @hidden @internal
@@ -30,7 +31,7 @@ export class ExpressionUI {
3031

3132
constructor() {
3233
// Use IDs to identify expressions clearly and use to track them in template @for cycles.
33-
this.expressionId = crypto.randomUUID();
34+
this.expressionId = getUUID();
3435
}
3536
}
3637

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ import { IgxGridCellComponent } from './cell.component';
180180
import { IgxGridValidationService } from './grid/grid-validation.service';
181181
import { getCurrentResourceStrings } from '../core/i18n/resources';
182182
import { isTree, recreateTreeFromFields } from '../data-operations/expressions-tree-util';
183+
import { getUUID } from './common/random';
183184

184185
interface IMatchInfoCache {
185186
row: any;
@@ -3787,7 +3788,7 @@ export abstract class IgxGridBaseDirective implements GridType,
37873788
const primaryColumn = this._columns.find(col => col.field === this.primaryKey);
37883789
const idType = this.data.length ?
37893790
this.resolveDataTypes(this.data[0][this.primaryKey]) : primaryColumn ? primaryColumn.dataType : 'string';
3790-
return idType === 'string' ? crypto.randomUUID() : FAKE_ROW_ID--;
3791+
return idType === 'string' ? getUUID() : FAKE_ROW_ID--;
37913792
}
37923793

37933794
/**

0 commit comments

Comments
 (0)