@dataloop-ai/components 0.13.0
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.
- package/.eslintrc.js +154 -0
- package/.prettierrc.json +7 -0
- package/Dockerfile +12 -0
- package/LICENSE +201 -0
- package/README.md +43 -0
- package/favicon.ico +0 -0
- package/index.html +13 -0
- package/index.ts +1 -0
- package/jest.config.js +16 -0
- package/jest.setup.js +59 -0
- package/models.ts +1 -0
- package/package.json +109 -0
- package/src/App.vue +201 -0
- package/src/assets/globals.scss +253 -0
- package/src/assets/globalsKeys.ts +28 -0
- package/src/components/DlAccordion/AccordionHeader.vue +148 -0
- package/src/components/DlAccordion/DlAccordion.vue +108 -0
- package/src/components/DlAccordion/index.ts +2 -0
- package/src/components/DlAlert.vue +227 -0
- package/src/components/DlAvatar.vue +99 -0
- package/src/components/DlBadge.vue +127 -0
- package/src/components/DlButton/DlButton.vue +370 -0
- package/src/components/DlButton/index.ts +4 -0
- package/src/components/DlButton/utils.ts +169 -0
- package/src/components/DlButtonGroup.vue +122 -0
- package/src/components/DlCheckbox.vue +298 -0
- package/src/components/DlChip/DlChip.vue +244 -0
- package/src/components/DlChip/index.ts +4 -0
- package/src/components/DlChip/utils.ts +100 -0
- package/src/components/DlColorPicker/DlAlpha.vue +142 -0
- package/src/components/DlColorPicker/DlBox.vue +75 -0
- package/src/components/DlColorPicker/DlColorPicker.vue +306 -0
- package/src/components/DlColorPicker/DlColors.vue +139 -0
- package/src/components/DlColorPicker/DlHue.vue +135 -0
- package/src/components/DlColorPicker/DlPreview.vue +61 -0
- package/src/components/DlColorPicker/DlSaturation.vue +152 -0
- package/src/components/DlColorPicker/constants.ts +16 -0
- package/src/components/DlColorPicker/index.ts +20 -0
- package/src/components/DlColorPicker/types.ts +11 -0
- package/src/components/DlColorPicker/utils.ts +128 -0
- package/src/components/DlCounters.vue +173 -0
- package/src/components/DlDatePicker/DlCalendar.vue +332 -0
- package/src/components/DlDatePicker/DlDatePicker.vue +315 -0
- package/src/components/DlDatePicker/DlMonthCalendar.vue +282 -0
- package/src/components/DlDatePicker/classes/Calendar.ts +110 -0
- package/src/components/DlDatePicker/classes/CalendarDate.ts +12 -0
- package/src/components/DlDatePicker/classes/CustomDate.ts +218 -0
- package/src/components/DlDatePicker/index.ts +3 -0
- package/src/components/DlDatePicker/isInRange.ts +44 -0
- package/src/components/DlDatePicker/types.ts +4 -0
- package/src/components/DlDatePicker/utils.ts +39 -0
- package/src/components/DlDateTimeRange/DlCardSidebar.vue +109 -0
- package/src/components/DlDateTimeRange/DlDateInput.vue +105 -0
- package/src/components/DlDateTimeRange/DlDateTimeRange.vue +468 -0
- package/src/components/DlDateTimeRange/index.ts +3 -0
- package/src/components/DlDateTimeRange/types.ts +42 -0
- package/src/components/DlDialogBox/DlDialogBox.vue +196 -0
- package/src/components/DlDialogBox/DlDialogBoxFooter.vue +22 -0
- package/src/components/DlDialogBox/DlDialogBoxHeader.vue +75 -0
- package/src/components/DlDialogBox/index.ts +5 -0
- package/src/components/DlDropdownButton.vue +463 -0
- package/src/components/DlIcon.vue +147 -0
- package/src/components/DlInfoErrorMessage.vue +91 -0
- package/src/components/DlItem/DlItem.vue +35 -0
- package/src/components/DlItem/index.ts +2 -0
- package/src/components/DlItemSection.vue +88 -0
- package/src/components/DlLink/DlLink.vue +76 -0
- package/src/components/DlLink/index.ts +4 -0
- package/src/components/DlLink/utils.ts +4 -0
- package/src/components/DlList.vue +61 -0
- package/src/components/DlListItem/DlListItem.vue +205 -0
- package/src/components/DlListItem/index.ts +3 -0
- package/src/components/DlListItem/utils.ts +14 -0
- package/src/components/DlMenu/DlMenu.vue +438 -0
- package/src/components/DlMenu/index.ts +3 -0
- package/src/components/DlMenu/utils.ts +138 -0
- package/src/components/DlOptionGroup/DlOptionGroup.vue +201 -0
- package/src/components/DlOptionGroup/MenuItemWrapper.vue +48 -0
- package/src/components/DlOptionGroup/OptionGroup.types.ts +36 -0
- package/src/components/DlOptionGroup/SimpleWrapper.vue +28 -0
- package/src/components/DlOptionGroup/index.ts +4 -0
- package/src/components/DlOptionGroup/utils.ts +40 -0
- package/src/components/DlPagination/DlPagination.vue +184 -0
- package/src/components/DlPagination/PageNavigation.vue +350 -0
- package/src/components/DlPagination/PaginationLegend.vue +41 -0
- package/src/components/DlPagination/QuickNavigation.vue +146 -0
- package/src/components/DlPagination/RowsSelector.vue +74 -0
- package/src/components/DlPagination/index.ts +3 -0
- package/src/components/DlPanelContainer/DlPanel.vue +213 -0
- package/src/components/DlPanelContainer/DlPanelContainer.vue +527 -0
- package/src/components/DlPanelContainer/index.ts +4 -0
- package/src/components/DlPopup/DlPopup.vue +478 -0
- package/src/components/DlPopup/DraggableUpper.vue +64 -0
- package/src/components/DlPopup/PopupHeader.vue +129 -0
- package/src/components/DlPopup/index.ts +1 -0
- package/src/components/DlProgressBar.vue +159 -0
- package/src/components/DlProgressChart.vue +299 -0
- package/src/components/DlRadio.vue +218 -0
- package/src/components/DlRange/DlRange.vue +439 -0
- package/src/components/DlRange/utils.ts +209 -0
- package/src/components/DlSearch.vue +155 -0
- package/src/components/DlSelect/DlSelect.vue +992 -0
- package/src/components/DlSelect/SelectOption.vue +261 -0
- package/src/components/DlSelect/index.ts +4 -0
- package/src/components/DlSelect/utils.ts +43 -0
- package/src/components/DlSkeleton.vue +72 -0
- package/src/components/DlSlider/DlSlider.vue +243 -0
- package/src/components/DlSlider/components/DlSliderBase.vue +380 -0
- package/src/components/DlSlider/components/DlSliderInput.vue +123 -0
- package/src/components/DlSlider/components/index.ts +4 -0
- package/src/components/DlSlider/index.ts +3 -0
- package/src/components/DlSlider/sliderStyles.scss +109 -0
- package/src/components/DlSlider/useSlider.ts +277 -0
- package/src/components/DlSlider/utils.ts +7 -0
- package/src/components/DlSmartSearch/DlJsonEditor.vue +309 -0
- package/src/components/DlSmartSearch/DlSmartSearch.vue +333 -0
- package/src/components/DlSmartSearch/DlSmartSearchInput.vue +741 -0
- package/src/components/DlSmartSearch/DlSuggestionsDropdown.vue +73 -0
- package/src/components/DlSmartSearch/highlightSyntax.ts +169 -0
- package/src/components/DlSmartSearch/index.ts +4 -0
- package/src/components/DlSmartSearch/types.ts +36 -0
- package/src/components/DlSmartSearch/utils.ts +45 -0
- package/src/components/DlStepper/DlStepper.vue +196 -0
- package/src/components/DlStepper/DlStepperContainer.vue +55 -0
- package/src/components/DlStepper/DlStepperContent.vue +101 -0
- package/src/components/DlStepper/DlStepperFooter.vue +133 -0
- package/src/components/DlStepper/DlStepperHeader.vue +49 -0
- package/src/components/DlStepper/DlStepperSidebar.vue +167 -0
- package/src/components/DlStepper/Step.ts +101 -0
- package/src/components/DlStepper/Stepper.ts +107 -0
- package/src/components/DlStepper/index.ts +7 -0
- package/src/components/DlStepper/interfaces.ts +11 -0
- package/src/components/DlSwitch.vue +280 -0
- package/src/components/DlTabPanels/DlTabPanel.vue +22 -0
- package/src/components/DlTabPanels/DlTabPanels.vue +41 -0
- package/src/components/DlTabPanels/index.ts +4 -0
- package/src/components/DlTabPanels/utils.ts +19 -0
- package/src/components/DlTable/DlTable.vue +1264 -0
- package/src/components/DlTable/DlTd.vue +109 -0
- package/src/components/DlTable/DlTh.vue +126 -0
- package/src/components/DlTable/DlTr.vue +44 -0
- package/src/components/DlTable/ResizableManager.ts +233 -0
- package/src/components/DlTable/dl-table-styles.scss +466 -0
- package/src/components/DlTable/hooks/tableActions.ts +64 -0
- package/src/components/DlTable/hooks/tableColumnSelection.ts +112 -0
- package/src/components/DlTable/hooks/tableFilter.ts +42 -0
- package/src/components/DlTable/hooks/tablePagination.ts +197 -0
- package/src/components/DlTable/hooks/tableRowExpand.ts +55 -0
- package/src/components/DlTable/hooks/tableRowSelection.ts +106 -0
- package/src/components/DlTable/hooks/tableSort.ts +125 -0
- package/src/components/DlTable/index.ts +6 -0
- package/src/components/DlTable/types.ts +96 -0
- package/src/components/DlTabs/DlTab.vue +146 -0
- package/src/components/DlTabs/DlTabs.vue +192 -0
- package/src/components/DlTabs/TabsWrapper.vue +104 -0
- package/src/components/DlTabs/index.ts +4 -0
- package/src/components/DlTabs/types.ts +8 -0
- package/src/components/DlTextArea.vue +151 -0
- package/src/components/DlTextHolder.vue +65 -0
- package/src/components/DlTextInput.vue +753 -0
- package/src/components/DlThemeProvider.vue +41 -0
- package/src/components/DlTimePicker/DlTimeCounter.vue +81 -0
- package/src/components/DlTimePicker/DlTimePicker.vue +151 -0
- package/src/components/DlTimePicker/DlTimePickerInput.vue +311 -0
- package/src/components/DlTimePicker/index.ts +3 -0
- package/src/components/DlTimePicker/types.ts +4 -0
- package/src/components/DlTooltip.vue +456 -0
- package/src/components/DlTrend.vue +97 -0
- package/src/components/DlTypography.vue +87 -0
- package/src/components/DlVirtualScroll/DlVirtualScroll.vue +290 -0
- package/src/components/DlVirtualScroll/index.ts +3 -0
- package/src/components/DlVirtualScroll/useVirtualScroll.ts +833 -0
- package/src/components/DlWidget/DlWidget.vue +50 -0
- package/src/components/DlWidget/DlWidgetGrid.vue +360 -0
- package/src/components/DlWidget/index.ts +4 -0
- package/src/components/DlWidget/types.ts +6 -0
- package/src/components/DlWidget/utils.ts +30 -0
- package/src/components/index.ts +118 -0
- package/src/demo/DlAccordionDemo.vue +60 -0
- package/src/demo/DlAlertDemo.vue +54 -0
- package/src/demo/DlAvatarDemo.vue +43 -0
- package/src/demo/DlBadgeDemo.vue +65 -0
- package/src/demo/DlButtonDemo.vue +266 -0
- package/src/demo/DlCheckboxDemo.vue +50 -0
- package/src/demo/DlChipDemo.vue +181 -0
- package/src/demo/DlColorPickerDemo.vue +43 -0
- package/src/demo/DlCounterDemo.vue +53 -0
- package/src/demo/DlDateTimeRangeDemo.vue +217 -0
- package/src/demo/DlDialogBoxDemo.vue +175 -0
- package/src/demo/DlDropdownButtonDemo.vue +260 -0
- package/src/demo/DlIconDemo.vue +47 -0
- package/src/demo/DlLinkDemo.vue +23 -0
- package/src/demo/DlListDemo.vue +177 -0
- package/src/demo/DlMenuDemo.vue +524 -0
- package/src/demo/DlOptionGroupDemo.vue +79 -0
- package/src/demo/DlPaginationDemo.vue +44 -0
- package/src/demo/DlPanelContainerDemo.vue +221 -0
- package/src/demo/DlPopupDemo.vue +58 -0
- package/src/demo/DlProgressBarDemo.vue +22 -0
- package/src/demo/DlProgressChartDemo.vue +71 -0
- package/src/demo/DlRadioDemo.vue +35 -0
- package/src/demo/DlRangeDemo.vue +44 -0
- package/src/demo/DlSearchDemo.vue +27 -0
- package/src/demo/DlSelectDemo.vue +355 -0
- package/src/demo/DlSkeletonDemo.vue +20 -0
- package/src/demo/DlSliderDemo.vue +47 -0
- package/src/demo/DlStepperDemo/CenteredStepperInDialogBox.vue +260 -0
- package/src/demo/DlStepperDemo/SimpleStepper.vue +202 -0
- package/src/demo/DlStepperDemo/StepperInDialogBox.vue +261 -0
- package/src/demo/DlStepperDemo/index.ts +5 -0
- package/src/demo/DlStepperDemo/steps/AssignmentsStep.vue +97 -0
- package/src/demo/DlStepperDemo/steps/DataStep.vue +158 -0
- package/src/demo/DlStepperDemo/steps/GeneralStep.vue +106 -0
- package/src/demo/DlStepperDemo/steps/InstructionStep.vue +176 -0
- package/src/demo/DlStepperDemo/steps/QualityStep.vue +65 -0
- package/src/demo/DlSwitchDemo.vue +49 -0
- package/src/demo/DlTableDemo.vue +475 -0
- package/src/demo/DlTabsDemo.vue +67 -0
- package/src/demo/DlTdDemo.vue +19 -0
- package/src/demo/DlTextAreaDemo.vue +37 -0
- package/src/demo/DlTextHolderDemo.vue +42 -0
- package/src/demo/DlTextInputDemo.vue +89 -0
- package/src/demo/DlThDemo.vue +32 -0
- package/src/demo/DlTooltipDemo.vue +60 -0
- package/src/demo/DlTrDemo.vue +18 -0
- package/src/demo/DlTrendDemo.vue +25 -0
- package/src/demo/DlTypographyDemo.vue +93 -0
- package/src/demo/DlWidgetDemo.vue +157 -0
- package/src/demo/SmartSearchDemo/DlSmartSearchDemo.vue +202 -0
- package/src/demo/SmartSearchDemo/schema.ts +44 -0
- package/src/demo/index.ts +141 -0
- package/src/directives/TouchPan.ts +525 -0
- package/src/env.d.ts +8 -0
- package/src/hooks/use-anchor.ts +223 -0
- package/src/hooks/use-model-toggle.ts +181 -0
- package/src/hooks/use-portal.ts +104 -0
- package/src/hooks/use-scroll-target.ts +53 -0
- package/src/hooks/use-size-observer.ts +24 -0
- package/src/hooks/use-suggestions.ts +355 -0
- package/src/hooks/use-tick.ts +32 -0
- package/src/hooks/use-timeout.ts +20 -0
- package/src/hooks/use-transition.ts +32 -0
- package/src/hooks/use-window-size.ts +25 -0
- package/src/hooks/useForm.ts +12 -0
- package/src/index.ts +7 -0
- package/src/main.ts +4 -0
- package/src/models.ts +4 -0
- package/src/types.ts +6 -0
- package/src/utils/calcs.ts +18 -0
- package/src/utils/click-outside.ts +108 -0
- package/src/utils/component-name-parser.ts +1 -0
- package/src/utils/css-color-names.ts +150 -0
- package/src/utils/dom.ts +55 -0
- package/src/utils/draggable-table.ts +416 -0
- package/src/utils/escape-key.ts +54 -0
- package/src/utils/events.ts +67 -0
- package/src/utils/focus-manager.ts +33 -0
- package/src/utils/focusout.ts +29 -0
- package/src/utils/format.ts +3 -0
- package/src/utils/getColor.ts +17 -0
- package/src/utils/getLighterGradient.ts +36 -0
- package/src/utils/getRootStyles.ts +52 -0
- package/src/utils/global-config.ts +6 -0
- package/src/utils/global-nodes.ts +42 -0
- package/src/utils/includes.ts +3 -0
- package/src/utils/index.ts +29 -0
- package/src/utils/inject-object-prop.ts +21 -0
- package/src/utils/input-sizes.ts +7 -0
- package/src/utils/is-ellipsis-active.ts +3 -0
- package/src/utils/is-in-viewport.ts +13 -0
- package/src/utils/is.ts +15 -0
- package/src/utils/key-composition.ts +17 -0
- package/src/utils/keyCodes.ts +12 -0
- package/src/utils/logger/ConsoleLogger.ts +65 -0
- package/src/utils/logger/ILogger.ts +8 -0
- package/src/utils/logger/index.ts +8 -0
- package/src/utils/nav-keys-constants.ts +1 -0
- package/src/utils/portal.ts +55 -0
- package/src/utils/position-engine.ts +381 -0
- package/src/utils/render.ts +36 -0
- package/src/utils/ripple.ts +7 -0
- package/src/utils/scroll.ts +73 -0
- package/src/utils/selection.ts +15 -0
- package/src/utils/sort.ts +7 -0
- package/src/utils/splitByQuotes.ts +32 -0
- package/src/utils/string.ts +6 -0
- package/src/utils/teleport.ts +14 -0
- package/src/utils/theme.ts +2 -0
- package/src/utils/vm.ts +16 -0
- package/storybook.js +8 -0
- package/tsconfig.json +44 -0
- package/tsconfig.node.json +8 -0
- package/types.ts +1 -0
- package/vite.config.ts +13 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dl-stepper-footer">
|
|
3
|
+
<slot name="footer">
|
|
4
|
+
<div class="dl-stepper-footer__left-actions">
|
|
5
|
+
<dl-button
|
|
6
|
+
:disabled="disabledPrevStep"
|
|
7
|
+
outlined
|
|
8
|
+
:colors-object="prevBtnColorsObject"
|
|
9
|
+
:label="prevLabel"
|
|
10
|
+
@click="$emit('prev')"
|
|
11
|
+
/>
|
|
12
|
+
<dl-button
|
|
13
|
+
:disabled="disabledNextStep"
|
|
14
|
+
class="justify-end"
|
|
15
|
+
outlined
|
|
16
|
+
:label="nextLabel"
|
|
17
|
+
@click="$emit('next')"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="dl-stepper-footer__right-actions">
|
|
21
|
+
<dl-button
|
|
22
|
+
filled
|
|
23
|
+
:label="doneButtonLabel"
|
|
24
|
+
:disabled="!finished"
|
|
25
|
+
@click="$emit('done')"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
</slot>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<script lang="ts">
|
|
32
|
+
import { defineComponent } from 'vue-demi'
|
|
33
|
+
import { DlButton } from '../'
|
|
34
|
+
import { ButtonState, ButtonPart, ButtonColors } from '../DlButton/DlButton.vue'
|
|
35
|
+
|
|
36
|
+
export default defineComponent({
|
|
37
|
+
name: 'DlStepperFooter',
|
|
38
|
+
components: {
|
|
39
|
+
DlButton
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
finished: Boolean,
|
|
43
|
+
doneButtonLabel: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: false,
|
|
46
|
+
default: 'Done'
|
|
47
|
+
},
|
|
48
|
+
prevButtonLabel: {
|
|
49
|
+
type: String,
|
|
50
|
+
required: false,
|
|
51
|
+
default: ''
|
|
52
|
+
},
|
|
53
|
+
nextButtonLabel: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: false,
|
|
56
|
+
default: ''
|
|
57
|
+
},
|
|
58
|
+
disabledNextStep: Boolean,
|
|
59
|
+
disabledPrevStep: Boolean
|
|
60
|
+
},
|
|
61
|
+
emits: ['close', 'done', 'next', 'prev'],
|
|
62
|
+
data(): {
|
|
63
|
+
prevBtnColorsObject: ButtonColors
|
|
64
|
+
} {
|
|
65
|
+
return {
|
|
66
|
+
prevBtnColorsObject: {
|
|
67
|
+
[ButtonState.Active]: {
|
|
68
|
+
[ButtonPart.Text]: 'var(--dl-color-darker)',
|
|
69
|
+
[ButtonPart.Background]: 'var(--dl-color-transparent)',
|
|
70
|
+
[ButtonPart.Border]: 'var(--dl-color-separator)'
|
|
71
|
+
},
|
|
72
|
+
[ButtonState.Hover]: {
|
|
73
|
+
[ButtonPart.Text]: 'var(--dl-color-hover)',
|
|
74
|
+
[ButtonPart.Background]: 'var(--dl-color-transparent)',
|
|
75
|
+
[ButtonPart.Border]: 'var(--dl-color-hover)'
|
|
76
|
+
},
|
|
77
|
+
[ButtonState.Pressed]: {
|
|
78
|
+
[ButtonPart.Text]: 'var(--dl-color-secondary)',
|
|
79
|
+
[ButtonPart.Background]: 'var(--dl-color-transparent)',
|
|
80
|
+
[ButtonPart.Border]: 'var(--dl-color-secondary)'
|
|
81
|
+
},
|
|
82
|
+
[ButtonState.Disabled]: {
|
|
83
|
+
[ButtonPart.Text]: 'var(--dl-color-disabled)',
|
|
84
|
+
[ButtonPart.Background]: 'var(--dl-color-transparent)',
|
|
85
|
+
[ButtonPart.Border]: 'var(--dl-color-separator)'
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
computed: {
|
|
91
|
+
nextLabel(): string {
|
|
92
|
+
let label = 'Next'
|
|
93
|
+
if (this.nextButtonLabel) {
|
|
94
|
+
label = label + `: ${this.nextButtonLabel}`
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return label
|
|
98
|
+
},
|
|
99
|
+
prevLabel(): string {
|
|
100
|
+
let label = 'Back'
|
|
101
|
+
if (this.prevButtonLabel) {
|
|
102
|
+
label = label + `: ${this.prevButtonLabel}`
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return label
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
</script>
|
|
110
|
+
<style lang="scss" scoped>
|
|
111
|
+
.dl-stepper-footer {
|
|
112
|
+
background-color: var(--dl-color-panel-background);
|
|
113
|
+
display: flex;
|
|
114
|
+
justify-content: space-between;
|
|
115
|
+
margin-top: auto;
|
|
116
|
+
position: sticky;
|
|
117
|
+
z-index: 1;
|
|
118
|
+
align-items: center;
|
|
119
|
+
padding: 16px 50px;
|
|
120
|
+
border-top: 1px solid var(--dl-color-separator);
|
|
121
|
+
gap: 15px;
|
|
122
|
+
right: 0;
|
|
123
|
+
left: 0;
|
|
124
|
+
top: 0;
|
|
125
|
+
overflow: auto;
|
|
126
|
+
|
|
127
|
+
&__left-actions,
|
|
128
|
+
&__left-actions {
|
|
129
|
+
display: flex;
|
|
130
|
+
gap: 15px;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dl-stepper-header">
|
|
3
|
+
<slot>
|
|
4
|
+
<dl-typography
|
|
5
|
+
size="h2"
|
|
6
|
+
variant="h2"
|
|
7
|
+
>
|
|
8
|
+
{{ headerTitle }}
|
|
9
|
+
</dl-typography>
|
|
10
|
+
</slot>
|
|
11
|
+
<dl-button
|
|
12
|
+
v-if="!hideCloseBtn"
|
|
13
|
+
text-color="dl-color-darker"
|
|
14
|
+
flat
|
|
15
|
+
icon="icon-dl-close"
|
|
16
|
+
@click="$emit('close')"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { defineComponent } from 'vue-demi'
|
|
22
|
+
import { DlTypography, DlButton } from '../'
|
|
23
|
+
|
|
24
|
+
export default defineComponent({
|
|
25
|
+
name: 'DlStepperHeader',
|
|
26
|
+
components: {
|
|
27
|
+
DlTypography,
|
|
28
|
+
DlButton
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
headerTitle: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: false,
|
|
34
|
+
default: ''
|
|
35
|
+
},
|
|
36
|
+
hideCloseBtn: Boolean
|
|
37
|
+
},
|
|
38
|
+
emits: ['close']
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
41
|
+
<style lang="scss" scoped>
|
|
42
|
+
.dl-stepper-header {
|
|
43
|
+
display: flex;
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
align-items: center;
|
|
46
|
+
padding: 16px;
|
|
47
|
+
border-bottom: 1px solid var(--dl-color-separator);
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sidebar">
|
|
3
|
+
<dl-list>
|
|
4
|
+
<dl-list-item
|
|
5
|
+
v-for="(step, index) in steps"
|
|
6
|
+
:key="index"
|
|
7
|
+
:data-test-index="index"
|
|
8
|
+
:end-icon="getStepIcon(step)"
|
|
9
|
+
:end-icon-color="getStepIconColor(step)"
|
|
10
|
+
end-icon-size="16px"
|
|
11
|
+
:clickable="sidebarNavigation"
|
|
12
|
+
:disabled="!getStepSidebarNavigation(step)"
|
|
13
|
+
:class="sidebarItemClasses(step)"
|
|
14
|
+
@click="handleStepClick(step, index)"
|
|
15
|
+
>
|
|
16
|
+
<dl-item-section no-wrap>
|
|
17
|
+
<span :class="stepClass(step)">
|
|
18
|
+
{{ index + 1 }}.
|
|
19
|
+
<div>
|
|
20
|
+
<span>
|
|
21
|
+
{{ getStepTitle(step) }}
|
|
22
|
+
</span>
|
|
23
|
+
<span class="sidebar--subtitle">
|
|
24
|
+
{{ getStepSubtitle(step) }}
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
</span>
|
|
28
|
+
</dl-item-section>
|
|
29
|
+
</dl-list-item>
|
|
30
|
+
</dl-list>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script lang="ts">
|
|
35
|
+
import { defineComponent, PropType } from 'vue-demi'
|
|
36
|
+
import { DlListItem } from '../DlListItem'
|
|
37
|
+
import DlItemSection from '../DlItemSection.vue'
|
|
38
|
+
import DlList from '../DlList.vue'
|
|
39
|
+
import { Step } from './Step'
|
|
40
|
+
|
|
41
|
+
export default defineComponent({
|
|
42
|
+
name: 'DlStepperSidebar',
|
|
43
|
+
components: {
|
|
44
|
+
DlList,
|
|
45
|
+
DlListItem,
|
|
46
|
+
DlItemSection
|
|
47
|
+
},
|
|
48
|
+
props: {
|
|
49
|
+
steps: {
|
|
50
|
+
type: Array as PropType<Step[]>,
|
|
51
|
+
default: () => [] as Step[]
|
|
52
|
+
},
|
|
53
|
+
bgColor: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: false,
|
|
56
|
+
default: 'dl-color-fill-third'
|
|
57
|
+
},
|
|
58
|
+
sidebarNavigation: { type: Boolean, default: true }
|
|
59
|
+
},
|
|
60
|
+
emits: ['step-click'],
|
|
61
|
+
methods: {
|
|
62
|
+
getStepTitle(step: Step): string {
|
|
63
|
+
const optional = step.optional ? ' (Optional)' : ''
|
|
64
|
+
return `${this.capitalize(step.title)}${optional}`
|
|
65
|
+
},
|
|
66
|
+
getStepSubtitle(step: Step): string {
|
|
67
|
+
if (step.subtitle) {
|
|
68
|
+
return this.capitalize(step.subtitle)
|
|
69
|
+
}
|
|
70
|
+
return ''
|
|
71
|
+
},
|
|
72
|
+
capitalize(str: string): string {
|
|
73
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
74
|
+
},
|
|
75
|
+
sidebarItemClasses(step: Step): string {
|
|
76
|
+
return `sidebar--item${
|
|
77
|
+
step.subtitle ? ' sidebar--item-with_subtitle' : ''
|
|
78
|
+
}`
|
|
79
|
+
},
|
|
80
|
+
stepClass(step: Step) {
|
|
81
|
+
const active = step.active
|
|
82
|
+
? 'sidebar--step-active'
|
|
83
|
+
: step.completed || step.error
|
|
84
|
+
? 'sidebar--step-touched'
|
|
85
|
+
: ''
|
|
86
|
+
return `sidebar--step ${active}`
|
|
87
|
+
},
|
|
88
|
+
handleStepClick(step: Step, index: number) {
|
|
89
|
+
this.$emit('step-click', step, index)
|
|
90
|
+
},
|
|
91
|
+
getStepIcon(step: Step): string {
|
|
92
|
+
return step.error
|
|
93
|
+
? 'icon-dl-error-filled'
|
|
94
|
+
: step.warning
|
|
95
|
+
? 'icon-dl-alert-filled'
|
|
96
|
+
: 'icon-dl-approve-filled'
|
|
97
|
+
},
|
|
98
|
+
getStepIconColor(step: Step): string {
|
|
99
|
+
return step.error
|
|
100
|
+
? 'dl-color-negative'
|
|
101
|
+
: step.warning
|
|
102
|
+
? 'dl-color-warning'
|
|
103
|
+
: step.completed
|
|
104
|
+
? 'dl-color-positive'
|
|
105
|
+
: 'dl-color-transparent'
|
|
106
|
+
},
|
|
107
|
+
getStepSidebarNavigation(step: Step): boolean {
|
|
108
|
+
return step.sidebarNavigation ?? true
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style scoped lang="scss">
|
|
115
|
+
.sidebar {
|
|
116
|
+
display: flex;
|
|
117
|
+
min-width: 250px;
|
|
118
|
+
padding: 15px 0px;
|
|
119
|
+
border-right: 1px solid var(--dl-color-separator);
|
|
120
|
+
background-color: var(--dl-stepper-bg);
|
|
121
|
+
box-sizing: border-box;
|
|
122
|
+
|
|
123
|
+
& > .dl-list {
|
|
124
|
+
width: 100%;
|
|
125
|
+
background-color: var(--dl-color-transparent);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&--item {
|
|
129
|
+
padding: 5px 0;
|
|
130
|
+
&-with_subtitle {
|
|
131
|
+
::v-deep .dl-list-item {
|
|
132
|
+
height: 43px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&--subtitle {
|
|
138
|
+
display: block;
|
|
139
|
+
line-height: 1;
|
|
140
|
+
font-size: var(--dl-font-size-body);
|
|
141
|
+
color: var(--dl-color-lighter);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&--step {
|
|
145
|
+
display: flex;
|
|
146
|
+
gap: 3px;
|
|
147
|
+
font-size: var(--dl-font-size-h4);
|
|
148
|
+
line-height: 18px;
|
|
149
|
+
color: var(--dl-color-lighter);
|
|
150
|
+
|
|
151
|
+
&-active {
|
|
152
|
+
color: var(--dl-color-secondary);
|
|
153
|
+
& .sidebar--subtitle {
|
|
154
|
+
color: var(--dl-color-secondary);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&-touched {
|
|
159
|
+
color: var(--dl-color-darker);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
::v-deep .dl-list-item {
|
|
164
|
+
padding: 0px 20px;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { set, reactive } from 'vue-demi'
|
|
2
|
+
import { StepState } from './interfaces'
|
|
3
|
+
|
|
4
|
+
export class Step {
|
|
5
|
+
_state: Required<StepState>
|
|
6
|
+
_initialState: Required<StepState>
|
|
7
|
+
|
|
8
|
+
constructor(state: StepState) {
|
|
9
|
+
this._initialState = {
|
|
10
|
+
active: false,
|
|
11
|
+
subtitle: '',
|
|
12
|
+
completed: false,
|
|
13
|
+
optional: false,
|
|
14
|
+
sidebarNavigation: true,
|
|
15
|
+
error: '',
|
|
16
|
+
warning: '',
|
|
17
|
+
...state
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this._state = reactive(Object.assign({}, this._initialState))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public get state(): StepState {
|
|
24
|
+
return this._state
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public get title(): string {
|
|
28
|
+
return this._state.title
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public get subtitle(): string {
|
|
32
|
+
return this._state.subtitle
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public get optional(): boolean {
|
|
36
|
+
return this._state.optional
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public set optional(value: boolean) {
|
|
40
|
+
set(this._state, 'optional', value)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public get completed(): boolean {
|
|
44
|
+
return this._state.completed
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public set completed(value: boolean) {
|
|
48
|
+
set(this._state, 'error', '')
|
|
49
|
+
set(this._state, 'warning', false)
|
|
50
|
+
set(this._state, 'completed', value)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public get error(): string {
|
|
54
|
+
return this._state.error
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public set error(value: string) {
|
|
58
|
+
set(this._state, 'error', value)
|
|
59
|
+
set(this._state, 'warning', false)
|
|
60
|
+
set(this._state, 'completed', false)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public get warning(): string {
|
|
64
|
+
return this._state.warning
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public set warning(value: string) {
|
|
68
|
+
set(this._state, 'warning', value)
|
|
69
|
+
set(this._state, 'error', false)
|
|
70
|
+
set(this._state, 'completed', true)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public get value(): string {
|
|
74
|
+
return this._state.value
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public get active(): boolean {
|
|
78
|
+
return this._state.active
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public set active(value: boolean) {
|
|
82
|
+
set(this._state, 'active', value)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public get sidebarNavigation() {
|
|
86
|
+
return this._state.sidebarNavigation
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public set sidebarNavigation(value: boolean) {
|
|
90
|
+
set(this._state, 'sidebarNavigation', value)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public reset() {
|
|
94
|
+
for (const key of Object.keys(this._initialState)) {
|
|
95
|
+
if (key !== 'active') {
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
set(this._state, key, this._initialState[key])
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Step } from './Step'
|
|
2
|
+
|
|
3
|
+
export class Stepper {
|
|
4
|
+
private _currentIndex = 0
|
|
5
|
+
|
|
6
|
+
private _steps: Step[]
|
|
7
|
+
|
|
8
|
+
constructor(steps: Step[]) {
|
|
9
|
+
this._steps = steps
|
|
10
|
+
|
|
11
|
+
if (this.currentStep) {
|
|
12
|
+
this.currentStep.active = true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public get steps(): Step[] {
|
|
17
|
+
return this._steps
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public set currentIndex(v: number) {
|
|
21
|
+
this._currentIndex = v
|
|
22
|
+
|
|
23
|
+
this._steps.forEach((step) => {
|
|
24
|
+
step.active = false
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
if (this.currentStep) {
|
|
28
|
+
this.currentStep.active = true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public get currentIndex(): number {
|
|
33
|
+
return this._currentIndex
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public get currentStep(): Step | null {
|
|
37
|
+
if (this._steps.length === 0) {
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return this._steps[this.currentIndex]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public hasPrevStep(): boolean {
|
|
45
|
+
return this.currentIndex > 0 && this.currentIndex < this._steps.length
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public hasNextStep(): boolean {
|
|
49
|
+
return (
|
|
50
|
+
this.currentIndex >= 0 && this.currentIndex < this._steps.length - 1
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public getNextStep(): Step {
|
|
55
|
+
if (this.hasNextStep()) {
|
|
56
|
+
return this.steps[this._currentIndex + 1]
|
|
57
|
+
}
|
|
58
|
+
return null
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public getPrevStep(): Step {
|
|
62
|
+
if (this.hasPrevStep()) {
|
|
63
|
+
return this.steps[this._currentIndex - 1]
|
|
64
|
+
}
|
|
65
|
+
return null
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public isDone(): boolean {
|
|
69
|
+
return this._steps.every(
|
|
70
|
+
(step: Step) => step.completed || step.optional
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public moveToNextStep() {
|
|
75
|
+
if (this.hasNextStep()) {
|
|
76
|
+
this.currentIndex = this.currentIndex + 1
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public moveToPrevStep() {
|
|
81
|
+
if (this.hasPrevStep()) {
|
|
82
|
+
this.currentIndex = this.currentIndex - 1
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public completeStep() {
|
|
87
|
+
if (!this.currentStep) return
|
|
88
|
+
this.currentStep.completed = true
|
|
89
|
+
this.moveToNextStep()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public failStep(msg?: string) {
|
|
93
|
+
if (!this.currentStep) return
|
|
94
|
+
this.currentStep.error = msg || ''
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public setStepWarning(msg?: string) {
|
|
98
|
+
if (!this.currentStep) return
|
|
99
|
+
this.currentStep.warning = msg || ''
|
|
100
|
+
this.moveToNextStep()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public resetStep() {
|
|
104
|
+
if (!this.currentStep) return
|
|
105
|
+
this.currentStep.reset()
|
|
106
|
+
}
|
|
107
|
+
}
|