@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,261 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:id="uuid"
|
|
4
|
+
:class="identifierClass"
|
|
5
|
+
style="width: 100%"
|
|
6
|
+
>
|
|
7
|
+
<dl-list-item
|
|
8
|
+
class="option"
|
|
9
|
+
:class="{ highlighted: highlightSelected && isSelected }"
|
|
10
|
+
:with-wave="withWave"
|
|
11
|
+
clickable
|
|
12
|
+
style="width: 100%"
|
|
13
|
+
@click="handleClick"
|
|
14
|
+
>
|
|
15
|
+
<dl-item-section
|
|
16
|
+
:color="color"
|
|
17
|
+
style="width: 100%"
|
|
18
|
+
>
|
|
19
|
+
<span
|
|
20
|
+
v-if="multiselect"
|
|
21
|
+
class="multiselect-option"
|
|
22
|
+
:style="`padding-left: ${depth * 30}px;`"
|
|
23
|
+
>
|
|
24
|
+
<span v-if="hasChildren">
|
|
25
|
+
<dl-icon
|
|
26
|
+
:icon="'icon-dl-right-chevron'"
|
|
27
|
+
style="margin-right: 10px"
|
|
28
|
+
class="expand-icon"
|
|
29
|
+
:class="`${showChildren && 'expanded'}`"
|
|
30
|
+
@click="chevronClick"
|
|
31
|
+
/>
|
|
32
|
+
</span>
|
|
33
|
+
<dl-checkbox
|
|
34
|
+
:ref="`checkboxRef-${value}`"
|
|
35
|
+
:class="{ capitalized }"
|
|
36
|
+
:model-value="modelValue"
|
|
37
|
+
:value="value"
|
|
38
|
+
:label="
|
|
39
|
+
label
|
|
40
|
+
? capitalized
|
|
41
|
+
? label.toLowerCase()
|
|
42
|
+
: label
|
|
43
|
+
: null
|
|
44
|
+
"
|
|
45
|
+
:indeterminate-value="indeterminateValue"
|
|
46
|
+
@update:model-value="handleCheckboxUpdate"
|
|
47
|
+
@checked="handleSingleSelect"
|
|
48
|
+
@unchecked="handleSingleDeselect"
|
|
49
|
+
/>
|
|
50
|
+
<span
|
|
51
|
+
class="multiselect-label"
|
|
52
|
+
:class="{ capitalized }"
|
|
53
|
+
>
|
|
54
|
+
<slot />
|
|
55
|
+
</span>
|
|
56
|
+
<span
|
|
57
|
+
v-if="count"
|
|
58
|
+
class="counter"
|
|
59
|
+
> ({{ count }}) </span>
|
|
60
|
+
</span>
|
|
61
|
+
<div
|
|
62
|
+
v-else
|
|
63
|
+
:class="{ capitalized }"
|
|
64
|
+
>
|
|
65
|
+
<slot>
|
|
66
|
+
{{
|
|
67
|
+
capitalized ? value.toString().toLowerCase() : value
|
|
68
|
+
}}
|
|
69
|
+
</slot>
|
|
70
|
+
</div>
|
|
71
|
+
</dl-item-section>
|
|
72
|
+
</dl-list-item>
|
|
73
|
+
<div v-if="hasChildren && showChildren">
|
|
74
|
+
<div
|
|
75
|
+
v-for="(child, index) in children"
|
|
76
|
+
:key="`${componentId}-${getValue(child)}-${index}`"
|
|
77
|
+
>
|
|
78
|
+
<select-option
|
|
79
|
+
:multiselect="multiselect"
|
|
80
|
+
:count="count"
|
|
81
|
+
clickable
|
|
82
|
+
:model-value="modelValue"
|
|
83
|
+
:value="getValue(child)"
|
|
84
|
+
:children="getChildren(child)"
|
|
85
|
+
:label="getLabel(child)"
|
|
86
|
+
:depth="depth + 1"
|
|
87
|
+
:highlight-selected="highlightSelected"
|
|
88
|
+
:with-wave="withWave"
|
|
89
|
+
:capitalized="capitalized"
|
|
90
|
+
@update:model-value="handleCheckboxUpdate"
|
|
91
|
+
@selected="handleSingleSelect"
|
|
92
|
+
@deselected="handleSingleDeselect"
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<script lang="ts">
|
|
100
|
+
import { defineComponent } from 'vue-demi'
|
|
101
|
+
import { DlListItem } from '../DlListItem'
|
|
102
|
+
import DlItemSection from '../DlItemSection.vue'
|
|
103
|
+
import DlCheckbox from '../DlCheckbox.vue'
|
|
104
|
+
import DlIcon from '../DlIcon.vue'
|
|
105
|
+
import { v4 } from 'uuid'
|
|
106
|
+
import { debounce } from 'lodash'
|
|
107
|
+
|
|
108
|
+
const ValueTypes = [Array, Boolean, String, Number, Object, Function]
|
|
109
|
+
|
|
110
|
+
export default defineComponent({
|
|
111
|
+
name: 'SelectOption',
|
|
112
|
+
components: {
|
|
113
|
+
DlListItem,
|
|
114
|
+
DlItemSection,
|
|
115
|
+
DlCheckbox,
|
|
116
|
+
DlIcon
|
|
117
|
+
},
|
|
118
|
+
model: {
|
|
119
|
+
prop: 'modelValue',
|
|
120
|
+
event: 'update:model-value'
|
|
121
|
+
},
|
|
122
|
+
props: {
|
|
123
|
+
withWave: Boolean,
|
|
124
|
+
defaultStyles: { type: Boolean, default: true },
|
|
125
|
+
multiselect: { type: Boolean, default: false },
|
|
126
|
+
value: { type: ValueTypes, default: null },
|
|
127
|
+
children: { type: Array, default: null },
|
|
128
|
+
highlightSelected: { type: Boolean, default: false },
|
|
129
|
+
count: { type: Number, default: null },
|
|
130
|
+
totalItems: { type: Boolean, default: false },
|
|
131
|
+
modelValue: {
|
|
132
|
+
type: ValueTypes,
|
|
133
|
+
default: [] as any
|
|
134
|
+
},
|
|
135
|
+
depth: { type: Number, default: 0 },
|
|
136
|
+
label: { type: String, default: null },
|
|
137
|
+
capitalized: { type: Boolean, default: false }
|
|
138
|
+
},
|
|
139
|
+
emits: ['update:model-value', 'click', 'selected', 'deselected'],
|
|
140
|
+
data() {
|
|
141
|
+
return {
|
|
142
|
+
showChildren: false,
|
|
143
|
+
componentId: v4(),
|
|
144
|
+
uuid: `dl-select-option-${v4()}`
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
computed: {
|
|
148
|
+
identifierClass(): string {
|
|
149
|
+
return `dl-select-option-${this.value}`.replaceAll(' ', '-')
|
|
150
|
+
},
|
|
151
|
+
color(): string | null {
|
|
152
|
+
return this.defaultStyles ? 'dl-color-darker' : null
|
|
153
|
+
},
|
|
154
|
+
isSelected(): boolean {
|
|
155
|
+
return (
|
|
156
|
+
(this.modelValue as any[])?.includes(this.value) ||
|
|
157
|
+
this.modelValue === true
|
|
158
|
+
)
|
|
159
|
+
},
|
|
160
|
+
indeterminateValue(): string | undefined {
|
|
161
|
+
return this.totalItems ? 'indeterminate' : undefined
|
|
162
|
+
},
|
|
163
|
+
handleChildren(): any {
|
|
164
|
+
return debounce(this.toggleChildren.bind(this), 50)
|
|
165
|
+
},
|
|
166
|
+
hasChildren(): boolean {
|
|
167
|
+
return this.children && this.children?.length > 0
|
|
168
|
+
},
|
|
169
|
+
indent(): { padding: string } {
|
|
170
|
+
return { padding: `0 ${this.depth * 30}px 0 0` }
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
methods: {
|
|
174
|
+
handleSingleSelect(value?: any) {
|
|
175
|
+
this.$emit('selected', value ?? this.value)
|
|
176
|
+
},
|
|
177
|
+
handleSingleDeselect(value?: any) {
|
|
178
|
+
this.$emit('deselected', value ?? this.value)
|
|
179
|
+
},
|
|
180
|
+
handleCheckboxUpdate(newVal: string[] | boolean, e: Event): void {
|
|
181
|
+
this.$emit('update:model-value', newVal, e)
|
|
182
|
+
},
|
|
183
|
+
handleClick(e: Event) {
|
|
184
|
+
e.stopPropagation()
|
|
185
|
+
e.preventDefault()
|
|
186
|
+
if (this.multiselect) {
|
|
187
|
+
const checkboxRef: any = this.$refs[`checkboxRef-${this.value}`]
|
|
188
|
+
checkboxRef.$refs.container?.click()
|
|
189
|
+
}
|
|
190
|
+
this.$emit('click', e)
|
|
191
|
+
},
|
|
192
|
+
chevronClick(e: Event) {
|
|
193
|
+
e.stopPropagation()
|
|
194
|
+
this.handleChildren(e)
|
|
195
|
+
},
|
|
196
|
+
toggleChildren() {
|
|
197
|
+
this.showChildren = !this.showChildren
|
|
198
|
+
},
|
|
199
|
+
getChildren(option: any) {
|
|
200
|
+
return typeof option === 'object' ? option.children : null
|
|
201
|
+
},
|
|
202
|
+
getLabel(option: any) {
|
|
203
|
+
return typeof option === 'object' ? option.label : null
|
|
204
|
+
},
|
|
205
|
+
getValue(option: any) {
|
|
206
|
+
return typeof option === 'object' ? option.value : null
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
</script>
|
|
211
|
+
|
|
212
|
+
<style lang="scss" scoped>
|
|
213
|
+
.option {
|
|
214
|
+
&::v-deep .container {
|
|
215
|
+
padding: 0 10px 0 0;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.highlighted {
|
|
220
|
+
background-color: var(--dl-color-fill);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.multiselect-option {
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
white-space: nowrap;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.multiselect-label {
|
|
230
|
+
flex-grow: 1;
|
|
231
|
+
overflow: hidden;
|
|
232
|
+
text-overflow: ellipsis;
|
|
233
|
+
white-space: nowrap;
|
|
234
|
+
/* max-width: 40%; */
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.counter {
|
|
238
|
+
color: var(--dl-color-lighter);
|
|
239
|
+
font-size: 10px;
|
|
240
|
+
}
|
|
241
|
+
.expand-icon {
|
|
242
|
+
display: flex !important;
|
|
243
|
+
justify-content: center !important;
|
|
244
|
+
color: var(--dl-color-medium);
|
|
245
|
+
transition-property: transform, -webkit-transform;
|
|
246
|
+
transition-duration: 0.28s, 0.28s;
|
|
247
|
+
transition-timing-function: ease, ease;
|
|
248
|
+
transition-delay: 0s, 0s;
|
|
249
|
+
&.expanded {
|
|
250
|
+
transform: rotate(90deg);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
.capitalized {
|
|
254
|
+
text-transform: capitalize !important;
|
|
255
|
+
}
|
|
256
|
+
</style>
|
|
257
|
+
<style lang="scss">
|
|
258
|
+
.capitalized .checkbox-label {
|
|
259
|
+
text-transform: capitalize !important;
|
|
260
|
+
}
|
|
261
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TInputSizes } from '../../utils/input-sizes'
|
|
2
|
+
|
|
3
|
+
export type SelectOptionType = string | number | Record<string, any>
|
|
4
|
+
|
|
5
|
+
export const getLabel = (option: any) => {
|
|
6
|
+
if (typeof option === 'object' && 'label' in option) {
|
|
7
|
+
return option.label
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return option
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ICON_SIZES = {
|
|
14
|
+
s: '12px',
|
|
15
|
+
m: '14px',
|
|
16
|
+
l: '16px'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const getLabelOfSelectedOption = (
|
|
20
|
+
valueToSearch: string,
|
|
21
|
+
options: SelectOptionType[]
|
|
22
|
+
) => {
|
|
23
|
+
if (options.length === 0) return ''
|
|
24
|
+
|
|
25
|
+
if (typeof options[0] === 'string') {
|
|
26
|
+
return options.find((opt) => opt === valueToSearch)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (options.find((opt: any) => opt.value === valueToSearch) as any)
|
|
30
|
+
.label
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const getIconSize = (size: TInputSizes) => ICON_SIZES[size] ?? '14px'
|
|
34
|
+
|
|
35
|
+
export const optionsValidator = (opts: SelectOptionType[]) => {
|
|
36
|
+
return opts.every((opt: string | any) => {
|
|
37
|
+
if (typeof opt === 'string' || typeof opt === 'number') {
|
|
38
|
+
return true
|
|
39
|
+
}
|
|
40
|
+
const keys = Object.keys(opt)
|
|
41
|
+
return keys.includes('value') && keys.includes('label')
|
|
42
|
+
})
|
|
43
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:id="uuid"
|
|
4
|
+
class="skeleton-box"
|
|
5
|
+
:style="`width: ${width}; height: ${height}; margin: ${margin};`"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { v4 } from 'uuid'
|
|
11
|
+
import { defineComponent } from 'vue-demi'
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
name: 'DlSkeleton',
|
|
15
|
+
props: {
|
|
16
|
+
width: { required: false, default: '100%', type: String },
|
|
17
|
+
height: { required: false, default: '100%', type: String },
|
|
18
|
+
margin: { required: false, default: '0 auto', type: String }
|
|
19
|
+
},
|
|
20
|
+
setup: () => {
|
|
21
|
+
return {
|
|
22
|
+
uuid: `dl-skeleton-${v4()}`
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
template: 'dl-skeleton'
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style scoped lang="css">
|
|
30
|
+
.skeleton-box {
|
|
31
|
+
position: relative;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
background-color: #24282d;
|
|
34
|
+
}
|
|
35
|
+
.skeleton-box::after {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
transform: translateX(-100%);
|
|
42
|
+
background-image: linear-gradient(
|
|
43
|
+
90deg,
|
|
44
|
+
rgba(255, 255, 255, 0) 0,
|
|
45
|
+
rgba(255, 255, 255, 0.2) 20%,
|
|
46
|
+
rgba(255, 255, 255, 0.5) 60%,
|
|
47
|
+
rgba(255, 255, 255, 0)
|
|
48
|
+
);
|
|
49
|
+
animation: shimmer 2s infinite;
|
|
50
|
+
content: '';
|
|
51
|
+
}
|
|
52
|
+
@-moz-keyframes shimmer {
|
|
53
|
+
100% {
|
|
54
|
+
transform: translateX(100%);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
@-webkit-keyframes shimmer {
|
|
58
|
+
100% {
|
|
59
|
+
transform: translateX(100%);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
@-o-keyframes shimmer {
|
|
63
|
+
100% {
|
|
64
|
+
transform: translateX(100%);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
@keyframes shimmer {
|
|
68
|
+
100% {
|
|
69
|
+
transform: translateX(100%);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:id="uuid"
|
|
4
|
+
class="slider-content"
|
|
5
|
+
:style="sliderStyles"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
v-if="editable"
|
|
9
|
+
class="slider editable"
|
|
10
|
+
data-test="editable-slider"
|
|
11
|
+
>
|
|
12
|
+
<span class="text capitalize">{{ text }}</span>
|
|
13
|
+
<dl-slider-input
|
|
14
|
+
v-model="sliderValue"
|
|
15
|
+
:min="min"
|
|
16
|
+
:max="max"
|
|
17
|
+
:readonly="readonly"
|
|
18
|
+
:disabled="disabled"
|
|
19
|
+
:style="{ marginRight: '10px' }"
|
|
20
|
+
data-test="editable-slider-input"
|
|
21
|
+
/>
|
|
22
|
+
<div class="slider-bar-container">
|
|
23
|
+
<dl-slider-base
|
|
24
|
+
v-model.number="sliderValue"
|
|
25
|
+
:min="min"
|
|
26
|
+
:max="max"
|
|
27
|
+
:step="step"
|
|
28
|
+
:color="color"
|
|
29
|
+
:readonly="readonly"
|
|
30
|
+
:disabled="disabled"
|
|
31
|
+
:snap="snap"
|
|
32
|
+
:tabindex="tabindex"
|
|
33
|
+
:name="name"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div
|
|
38
|
+
v-else
|
|
39
|
+
class="slider non-editable"
|
|
40
|
+
data-test="non-editable-slider"
|
|
41
|
+
>
|
|
42
|
+
<div class="header">
|
|
43
|
+
<div class="row text capitalize">
|
|
44
|
+
{{ text }}
|
|
45
|
+
<dl-icon
|
|
46
|
+
v-if="hint"
|
|
47
|
+
icon="icon-dl-info"
|
|
48
|
+
size="12px"
|
|
49
|
+
style="margin-left: 5px"
|
|
50
|
+
>
|
|
51
|
+
<dl-tooltip>
|
|
52
|
+
{{ hint }}
|
|
53
|
+
</dl-tooltip>
|
|
54
|
+
</dl-icon>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="right-container capitalize">
|
|
57
|
+
<dl-button
|
|
58
|
+
flat
|
|
59
|
+
size="m"
|
|
60
|
+
label="Reset"
|
|
61
|
+
:disabled="disabled || readonly"
|
|
62
|
+
data-test="non-editable-slider-btn"
|
|
63
|
+
@click="handleResetButtonClick"
|
|
64
|
+
/>
|
|
65
|
+
<dl-slider-input
|
|
66
|
+
id="slider-input"
|
|
67
|
+
v-model="sliderValue"
|
|
68
|
+
:min="min"
|
|
69
|
+
:max="max"
|
|
70
|
+
:readonly="readonly"
|
|
71
|
+
:disabled="disabled"
|
|
72
|
+
data-test="non-editable-slider-input"
|
|
73
|
+
@change="handleChange"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="slider-bar-container">
|
|
78
|
+
<dl-slider-base
|
|
79
|
+
v-model.number="sliderValue"
|
|
80
|
+
:min="min"
|
|
81
|
+
:max="max"
|
|
82
|
+
:step="step"
|
|
83
|
+
:color="color"
|
|
84
|
+
:readonly="readonly"
|
|
85
|
+
:disabled="disabled"
|
|
86
|
+
:snap="snap"
|
|
87
|
+
:name="name"
|
|
88
|
+
@change="handleChange"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script lang="ts">
|
|
96
|
+
import { defineComponent } from 'vue-demi'
|
|
97
|
+
import { DlSliderBase, DlSliderInput } from './components/'
|
|
98
|
+
import { DlButton, DlIcon, DlTooltip } from '..'
|
|
99
|
+
import { getColor, between } from '../../utils'
|
|
100
|
+
import { v4 } from 'uuid'
|
|
101
|
+
|
|
102
|
+
export default defineComponent({
|
|
103
|
+
name: 'DlSlider',
|
|
104
|
+
components: {
|
|
105
|
+
DlSliderBase,
|
|
106
|
+
DlButton,
|
|
107
|
+
DlSliderInput,
|
|
108
|
+
DlTooltip,
|
|
109
|
+
DlIcon
|
|
110
|
+
},
|
|
111
|
+
model: {
|
|
112
|
+
prop: 'modelValue',
|
|
113
|
+
event: 'update:model-value'
|
|
114
|
+
},
|
|
115
|
+
props: {
|
|
116
|
+
width: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: '100%'
|
|
119
|
+
},
|
|
120
|
+
color: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: 'dl-color-secondary'
|
|
123
|
+
},
|
|
124
|
+
textColor: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: 'dl-color-darker'
|
|
127
|
+
},
|
|
128
|
+
disabled: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: false
|
|
131
|
+
},
|
|
132
|
+
editable: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: false
|
|
135
|
+
},
|
|
136
|
+
min: {
|
|
137
|
+
type: Number,
|
|
138
|
+
default: 0
|
|
139
|
+
},
|
|
140
|
+
max: {
|
|
141
|
+
type: Number,
|
|
142
|
+
default: 100
|
|
143
|
+
},
|
|
144
|
+
readonly: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: false
|
|
147
|
+
},
|
|
148
|
+
snap: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: false
|
|
151
|
+
},
|
|
152
|
+
step: {
|
|
153
|
+
type: Number,
|
|
154
|
+
default: 1
|
|
155
|
+
},
|
|
156
|
+
tabindex: {
|
|
157
|
+
type: [String, Number],
|
|
158
|
+
default: '0'
|
|
159
|
+
},
|
|
160
|
+
text: {
|
|
161
|
+
type: String,
|
|
162
|
+
required: true
|
|
163
|
+
},
|
|
164
|
+
modelValue: {
|
|
165
|
+
type: Number,
|
|
166
|
+
default: null,
|
|
167
|
+
validator: (v: number | null) => typeof v === 'number' || v === null
|
|
168
|
+
},
|
|
169
|
+
name: {
|
|
170
|
+
type: String,
|
|
171
|
+
default: null
|
|
172
|
+
},
|
|
173
|
+
hint: {
|
|
174
|
+
type: String,
|
|
175
|
+
default: null,
|
|
176
|
+
required: false
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
emits: ['update:model-value', 'change'],
|
|
180
|
+
data() {
|
|
181
|
+
const val =
|
|
182
|
+
this.modelValue === null
|
|
183
|
+
? this.min
|
|
184
|
+
: between(this.modelValue, this.min, this.max)
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
uuid: `dl-slider-${v4()}`,
|
|
188
|
+
initialValue: val,
|
|
189
|
+
value: val,
|
|
190
|
+
displaySliderInput: false
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
computed: {
|
|
194
|
+
valueUpdate(): string {
|
|
195
|
+
return `${this.modelValue}|${this.min}|${this.max}`
|
|
196
|
+
},
|
|
197
|
+
sliderValue: {
|
|
198
|
+
get(): number {
|
|
199
|
+
return this.value
|
|
200
|
+
},
|
|
201
|
+
set(val: number | string): void {
|
|
202
|
+
this.$emit(
|
|
203
|
+
'update:model-value',
|
|
204
|
+
typeof val === 'number' ? val : null
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
sliderStyles(): Record<string, any> {
|
|
209
|
+
return {
|
|
210
|
+
'--text-color': getColor(this.textColor, 'dl-color-darker'),
|
|
211
|
+
'--width': this.width,
|
|
212
|
+
'--color': getColor(this.color, 'dl-color-secondary')
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
watch: {
|
|
217
|
+
valueUpdate() {
|
|
218
|
+
this.value =
|
|
219
|
+
this.modelValue === null
|
|
220
|
+
? this.min
|
|
221
|
+
: between(this.modelValue, this.min, this.max)
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
methods: {
|
|
225
|
+
handleChange(value: string) {
|
|
226
|
+
this.$emit('change', value)
|
|
227
|
+
},
|
|
228
|
+
handleResetButtonClick() {
|
|
229
|
+
if (this.value === this.initialValue) return
|
|
230
|
+
|
|
231
|
+
this.sliderValue = this.initialValue
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
</script>
|
|
236
|
+
|
|
237
|
+
<style scoped lang="scss">
|
|
238
|
+
@import './sliderStyles.scss';
|
|
239
|
+
|
|
240
|
+
.dl-button {
|
|
241
|
+
padding: 0;
|
|
242
|
+
}
|
|
243
|
+
</style>
|