Compare commits

..

2 Commits

Author SHA1 Message Date
ca7aa12218 v2.0.2
Some checks failed
Default (tags) / security (push) Failing after 16s
Default (tags) / test (push) Failing after 17s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-11-30 23:57:14 +00:00
c2ee19308d fix(dees-stepper): Make step validation abortable and cancel active step listeners when navigating 2025-11-30 23:57:14 +00:00
4 changed files with 21 additions and 4 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## 2025-11-30 - 2.0.2 - fix(dees-stepper)
Make step validation abortable and cancel active step listeners when navigating
- Extend IStep.validationFunc signature to accept an optional AbortSignal so validation handlers can be cancelled.
- Store an AbortController on the selected step and pass its signal into validationFunc when invoked.
- Abort the step's AbortController when navigating to the previous or next step to cancel any active listeners or async operations.
## 2025-11-30 - 2.0.1 - fix(dees-stepper)
Improve dees-stepper visual style and transitions

View File

@@ -1,6 +1,6 @@
{
"name": "@design.estate/dees-catalog",
"version": "2.0.1",
"version": "2.0.2",
"private": false,
"description": "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.",
"main": "dist_ts_web/index.js",

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@design.estate/dees-catalog',
version: '2.0.1',
version: '2.0.2',
description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
}

View File

@@ -19,9 +19,10 @@ import { stepperDemo } from './dees-stepper.demo.js';
export interface IStep {
title: string;
content: TemplateResult;
validationFunc?: (stepper: DeesStepper, htmlElement: HTMLElement) => Promise<any>;
validationFunc?: (stepper: DeesStepper, htmlElement: HTMLElement, signal?: AbortSignal) => Promise<any>;
onReturnToStepFunc?: (stepper: DeesStepper, htmlElement: HTMLElement) => Promise<any>;
validationFuncCalled?: boolean;
abortController?: AbortController;
}
declare global {
@@ -250,8 +251,9 @@ export class DeesStepper extends DeesElement {
);
}
if (!this.selectedStep.validationFuncCalled && this.selectedStep.validationFunc) {
this.selectedStep.abortController = new AbortController();
this.selectedStep.validationFuncCalled = true;
await this.selectedStep.validationFunc(this, selectedStepElement);
await this.selectedStep.validationFunc(this, selectedStepElement, this.selectedStep.abortController.signal);
}
this.scroller.to(scrollPosition);
}
@@ -261,6 +263,10 @@ export class DeesStepper extends DeesElement {
if (currentIndex <= 0) {
return;
}
// Abort any active listeners on current step
if (this.selectedStep.abortController) {
this.selectedStep.abortController.abort();
}
const currentStep = this.steps[currentIndex];
currentStep.validationFuncCalled = false;
const previousStep = this.steps[currentIndex - 1];
@@ -276,6 +282,10 @@ export class DeesStepper extends DeesElement {
if (currentIndex < 0 || currentIndex >= this.steps.length - 1) {
return;
}
// Abort any active listeners on current step
if (this.selectedStep.abortController) {
this.selectedStep.abortController.abort();
}
const currentStep = this.steps[currentIndex];
currentStep.validationFuncCalled = false;
const nextStep = this.steps[currentIndex + 1];