@microsoft/atlas-js
Advanced tools
Comparing version 1.5.3 to 1.5.4
@@ -38,3 +38,3 @@ export declare const defaultMessageStrings: { | ||
handleEvent(event: Event): void; | ||
navigate(href: string | null): void; | ||
navigate(href: string | null): boolean; | ||
scheduleCommit(event: Event): void; | ||
@@ -92,5 +92,5 @@ commit: (event: Event) => void; | ||
export declare function setValidationMessage(element: HTMLValueElement, message: string): void; | ||
export declare function navigateAfterSubmit(href: string | null, navigationStep: NavigationSteps): void; | ||
export declare function navigateAfterSubmit(href: string | null, navigationStep: NavigationSteps): boolean; | ||
export declare function collectCustomElementsByName(form: HTMLFormElement): Element[]; | ||
export {}; | ||
//# sourceMappingURL=form-behavior.d.ts.map |
@@ -103,3 +103,4 @@ import { generateElementId, kebabToCamelCase } from '../utilities/util'; | ||
navigate(href) { | ||
navigateAfterSubmit(href, this.getAttribute('navigation')); | ||
const navigate = navigateAfterSubmit(href, this.getAttribute('navigation')); | ||
return navigate; | ||
} | ||
@@ -148,2 +149,3 @@ scheduleCommit(event) { | ||
} | ||
let isNavigating = false; | ||
try { | ||
@@ -200,3 +202,3 @@ this.submitting = true; | ||
})); | ||
this.navigate(response.headers.get('location') ?? this.getAttribute('navigation-href')); | ||
isNavigating = this.navigate(response.headers.get('location') ?? this.getAttribute('navigation-href')); | ||
} | ||
@@ -225,3 +227,3 @@ else { | ||
finally { | ||
this.submitting = false; | ||
this.submitting = isNavigating; | ||
setBusySubmitButton(form, this.submitting); | ||
@@ -511,8 +513,9 @@ } | ||
// do nothing. | ||
break; | ||
return false; | ||
case 'follow': | ||
if (href) { | ||
location.href = href; | ||
return true; | ||
} | ||
break; | ||
return false; | ||
case 'hash-reload': | ||
@@ -526,12 +529,14 @@ if (href) { | ||
location.reload(); | ||
return true; | ||
} | ||
break; | ||
return false; | ||
case 'replace': | ||
if (href) { | ||
location.replace(href); | ||
return true; | ||
} | ||
break; | ||
return false; | ||
case 'reload': | ||
location.reload(); | ||
break; | ||
return true; | ||
default: | ||
@@ -538,0 +543,0 @@ throw new Error(`Unexpected navigation attribute value.`); |
{ | ||
"name": "@microsoft/atlas-js", | ||
"version": "1.5.3", | ||
"version": "1.5.4", | ||
"public": true, | ||
@@ -36,11 +36,11 @@ "description": "Scripts backing the Atlas Design System used by Microsoft's Developer Relations.", | ||
"devDependencies": { | ||
"eslint": "^8.12.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint": "^8.24.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jasmine": "^4.1.3", | ||
"eslint-plugin-jsdoc": "^38.1.3", | ||
"eslint-plugin-security": "^1.4.0", | ||
"eslint-plugin-jsdoc": "^39.3.6", | ||
"eslint-plugin-security": "^1.5.0", | ||
"rimraf": "^3.0.2", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.6.3" | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.8.4" | ||
} | ||
} |
@@ -129,3 +129,4 @@ import { generateElementId, kebabToCamelCase } from '../utilities/util'; | ||
navigate(href: string | null) { | ||
navigateAfterSubmit(href, this.getAttribute('navigation') as NavigationSteps); | ||
const navigate = navigateAfterSubmit(href, this.getAttribute('navigation') as NavigationSteps); | ||
return navigate; | ||
} | ||
@@ -186,3 +187,3 @@ | ||
} | ||
let isNavigating = false; | ||
try { | ||
@@ -248,3 +249,5 @@ this.submitting = true; | ||
); | ||
this.navigate(response.headers.get('location') ?? this.getAttribute('navigation-href')); | ||
isNavigating = this.navigate( | ||
response.headers.get('location') ?? this.getAttribute('navigation-href') | ||
); | ||
} else { | ||
@@ -274,3 +277,3 @@ const { errorAlert, errorList } = this.getErrorAlert(form); | ||
} finally { | ||
this.submitting = false; | ||
this.submitting = isNavigating; | ||
setBusySubmitButton(form, this.submitting); | ||
@@ -693,8 +696,9 @@ } | ||
// do nothing. | ||
break; | ||
return false; | ||
case 'follow': | ||
if (href) { | ||
location.href = href; | ||
return true; | ||
} | ||
break; | ||
return false; | ||
case 'hash-reload': | ||
@@ -708,12 +712,14 @@ if (href) { | ||
location.reload(); | ||
return true; | ||
} | ||
break; | ||
return false; | ||
case 'replace': | ||
if (href) { | ||
location.replace(href); | ||
return true; | ||
} | ||
break; | ||
return false; | ||
case 'reload': | ||
location.reload(); | ||
break; | ||
return true; | ||
default: | ||
@@ -720,0 +726,0 @@ throw new Error(`Unexpected navigation attribute value.`); |
Sorry, the diff of this file is not supported yet
63335
1613