@gravitee/ui-particles-angular 17.7.0 → 17.7.1-fix-apim-12804-endpoint-group-headers-sync-bee5b77
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.
|
@@ -3331,6 +3331,8 @@ class GioFormJsonSchemaComponent {
|
|
|
3331
3331
|
this.touched = false;
|
|
3332
3332
|
this.isValid$ = new ReplaySubject(1); // Wait JsonSchema to be loaded to check if it's valid
|
|
3333
3333
|
this.stateChanges$ = new Subject();
|
|
3334
|
+
this.isWritingValue = false;
|
|
3335
|
+
this.isStable = false;
|
|
3334
3336
|
if (ngControl) {
|
|
3335
3337
|
// Setting the value accessor directly (instead of using
|
|
3336
3338
|
// the providers `NG_VALUE_ACCESSOR`) to avoid running into a circular import.
|
|
@@ -3377,9 +3379,9 @@ class GioFormJsonSchemaComponent {
|
|
|
3377
3379
|
// Sync control value with default value (without emit event) as long as the component is not ready
|
|
3378
3380
|
// When formly is initialised, it emits several values as it builds up step by step.
|
|
3379
3381
|
this.formGroup.valueChanges
|
|
3380
|
-
.pipe(distinctUntilChanged(isEqual), tap(value => {
|
|
3382
|
+
.pipe(distinctUntilChanged(isEqual), filter(() => this.isReady && !this.isWritingValue && this.isStable), tap(value => {
|
|
3381
3383
|
this.ngControl?.control?.reset(value, { emitEvent: false });
|
|
3382
|
-
}), takeUntil(this.
|
|
3384
|
+
}), takeUntil(this.unsubscribe$))
|
|
3383
3385
|
.subscribe();
|
|
3384
3386
|
// Avoid ExpressionChangedAfterItHasBeenCheckedError on project
|
|
3385
3387
|
this.changeDetectorRef.markForCheck();
|
|
@@ -3437,7 +3439,14 @@ class GioFormJsonSchemaComponent {
|
|
|
3437
3439
|
}
|
|
3438
3440
|
// From ControlValueAccessor
|
|
3439
3441
|
writeValue(value) {
|
|
3442
|
+
this.isWritingValue = true;
|
|
3443
|
+
this.isStable = false;
|
|
3440
3444
|
this.model = cloneDeep(value) ?? {};
|
|
3445
|
+
setTimeout(() => {
|
|
3446
|
+
this.isWritingValue = false;
|
|
3447
|
+
this.isStable = true;
|
|
3448
|
+
this.changeDetectorRef.markForCheck();
|
|
3449
|
+
}, 0);
|
|
3441
3450
|
}
|
|
3442
3451
|
// From ControlValueAccessor
|
|
3443
3452
|
registerOnChange(fn) {
|
|
@@ -4809,10 +4818,41 @@ const toCronExpression = (cronDisplay) => {
|
|
|
4809
4818
|
const toCronDescription = (cronExpression) => {
|
|
4810
4819
|
throwIfInvalid(cronExpression);
|
|
4811
4820
|
if (!isEmpty(cronExpression)) {
|
|
4812
|
-
return Cronstrue.toString(cronExpression);
|
|
4821
|
+
return Cronstrue.toString(expandMisleadingSteps(cronExpression));
|
|
4813
4822
|
}
|
|
4814
4823
|
return '';
|
|
4815
4824
|
};
|
|
4825
|
+
/**
|
|
4826
|
+
* Expand step values (like *\/50) that don't evenly divide the field range
|
|
4827
|
+
* into explicit value lists (like 0,50) so that cronstrue generates an accurate description.
|
|
4828
|
+
*
|
|
4829
|
+
* For example, *\/50 in the minutes field means "at every minute divisible by 50" (i.e. 0 and 50),
|
|
4830
|
+
* NOT "every 50 minutes". Without this fix, cronstrue would display "Every 50 minutes" which is misleading.
|
|
4831
|
+
*
|
|
4832
|
+
* See: https://github.com/bradymholt/cRonstrue/issues/360
|
|
4833
|
+
*/
|
|
4834
|
+
const expandMisleadingSteps = (cronExpression) => {
|
|
4835
|
+
const parts = cronExpression.trim().split(/\s+/);
|
|
4836
|
+
// Field ranges: [seconds, minutes, hours, day-of-month, month, day-of-week]
|
|
4837
|
+
const fieldRanges = [60, 60, 24, undefined, undefined, undefined];
|
|
4838
|
+
const expandedParts = parts.map((part, index) => {
|
|
4839
|
+
const range = fieldRanges[index];
|
|
4840
|
+
if (range === undefined)
|
|
4841
|
+
return part;
|
|
4842
|
+
const match = part.match(/^\*\/(\d+)$/);
|
|
4843
|
+
if (!match)
|
|
4844
|
+
return part;
|
|
4845
|
+
const step = parseInt(match[1], 10);
|
|
4846
|
+
if (step <= 0 || range % step === 0)
|
|
4847
|
+
return part;
|
|
4848
|
+
const values = [];
|
|
4849
|
+
for (let v = 0; v < range; v += step) {
|
|
4850
|
+
values.push(v);
|
|
4851
|
+
}
|
|
4852
|
+
return values.join(',');
|
|
4853
|
+
});
|
|
4854
|
+
return expandedParts.join(' ');
|
|
4855
|
+
};
|
|
4816
4856
|
/**
|
|
4817
4857
|
* Simple validation to ensure that the cron expression has 6 parts.
|
|
4818
4858
|
* Note : The full cron expression validation is done by the backend.
|