diff --git a/Angular/src/app/app.component.html b/Angular/src/app/app.component.html index 360cdff..6fa9cac 100644 --- a/Angular/src/app/app.component.html +++ b/Angular/src/app/app.component.html @@ -1,33 +1,10 @@ - - -
-
-
-
{{ data.label }}
+ +
+
+
+
{{ data.label }}
- - - - - -
\ No newline at end of file + diff --git a/Angular/src/app/app.component.ts b/Angular/src/app/app.component.ts index 848e238..e5bbbf8 100644 --- a/Angular/src/app/app.component.ts +++ b/Angular/src/app/app.component.ts @@ -7,10 +7,21 @@ import { DxStepperTypes } from 'devextreme-angular/stepper'; styleUrls: ['./app.component.scss'], }) export class AppComponent { - onSelectionChanged(e: DxStepperTypes.SelectionChangedEvent) { + steps = [ + { label: 'Personal Details', template: 'starTemplate' }, + { label: 'Program Selection', icon: 'detailslayout' }, + { label: 'Campus and Start Dates', icon: 'map' }, + { label: 'Supporting Documents', icon: 'textdocument' }, + { label: 'Scholarship and Aid', icon: 'money', optional: true }, + { label: 'Review and Submit', icon: 'send' } + ]; + + onSelectionChanged(e: DxStepperTypes.SelectionChangedEvent): void { const newItem = e.addedItems[0]; - const items = e.component.option('items'); - const newIndex = items.findIndex((item) => newItem.label === item.label); - e.component.option(`items[${newIndex - 1}].disabled`, true); + const newIndex = this.steps.findIndex(item => item.label === newItem.label); + + if (newIndex > 0 && !this.steps[newIndex - 1].disabled) { + this.steps[newIndex - 1].disabled = true; + } } } diff --git a/README.md b/README.md index eed7da0..f05d5ab 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/979187465/25.1.3%2B) [![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T1290489) [![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183) [![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives) diff --git a/React/src/App.tsx b/React/src/App.tsx index 1c83d58..c266f59 100644 --- a/React/src/App.tsx +++ b/React/src/App.tsx @@ -1,31 +1,41 @@ -import { JSX } from 'react'; +import React, { JSX, useState } from 'react'; import { Stepper, Item, StepperTypes } from 'devextreme-react/stepper'; -import React from 'react'; -const renderFirstItem = (data: StepperTypes.TemplateData) => - +const renderFirstItem = (data: StepperTypes.TemplateData) => ( + <>
{data.label}
-
; - -const onSelectionChanged = (e: StepperTypes.SelectionChangedEvent) => { - const newItem = e.addedItems[0]; - const items = e.component.option('items'); - const newIndex = items.findIndex((item: StepperTypes.Item) => newItem.label === item.label); - e.component.option(`items[${newIndex - 1}].disabled`, true); -}; + +); export default function App(): JSX.Element { + const [steps, setSteps] = useState([ + { label: 'Personal Details', render: renderFirstItem }, + { label: 'Program Selection', icon: 'detailslayout' }, + { label: 'Campus and Start Dates', icon: 'map' }, + { label: 'Supporting Documents', icon: 'textdocument' }, + { label: 'Scholarship and Aid', icon: 'money', optional: true }, + { label: 'Review and Submit', icon: 'send' } + ]); + + const onSelectionChanged = (e: StepperTypes.SelectionChangedEvent) => { + const newItem = e.addedItems[0]; + const newIndex = steps.findIndex((item) => item.label === newItem.label); + + if (newIndex > 0 && !steps[newIndex - 1].disabled) { + const updated = [...steps]; + updated[newIndex - 1] = { ...updated[newIndex - 1], disabled: true }; + setSteps(updated); + } + }; + return ( - - - - - - + {steps.map((item, index) => ( + + ))} ); } diff --git a/Vue/src/components/HomeContent.vue b/Vue/src/components/HomeContent.vue index 4a25f47..732a304 100644 --- a/Vue/src/components/HomeContent.vue +++ b/Vue/src/components/HomeContent.vue @@ -1,26 +1,42 @@ + - +