@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,44 @@
|
|
|
1
|
+
import { Schema, Alias } from '../../hooks/use-suggestions'
|
|
2
|
+
|
|
3
|
+
export const schema: Schema = {
|
|
4
|
+
name: 'string',
|
|
5
|
+
level: ['high', 'medium', 'low', 30],
|
|
6
|
+
metadata: {
|
|
7
|
+
nesting: {
|
|
8
|
+
age: 'number',
|
|
9
|
+
valid: 'boolean'
|
|
10
|
+
},
|
|
11
|
+
date: 'date',
|
|
12
|
+
start: 'datetime',
|
|
13
|
+
classTime: 'time'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const aliases: Alias[] = [
|
|
18
|
+
{
|
|
19
|
+
alias: 'Name',
|
|
20
|
+
key: 'name'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
alias: 'Age',
|
|
24
|
+
key: 'metadata.nesting.age'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
alias: 'StartTime',
|
|
28
|
+
key: 'metadata.start'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
alias: 'Level',
|
|
32
|
+
key: 'level'
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
export const colorSchema: object = {
|
|
37
|
+
fields: 'blue',
|
|
38
|
+
operators: 'green',
|
|
39
|
+
keywords: 'bold'
|
|
40
|
+
}
|
|
41
|
+
export const status: object = {
|
|
42
|
+
type: 'info',
|
|
43
|
+
message: ''
|
|
44
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import AvatarDemo from './DlAvatarDemo.vue'
|
|
2
|
+
import DlAlertDemo from './DlAlertDemo.vue'
|
|
3
|
+
import DlProgressChartDemo from './DlProgressChartDemo.vue'
|
|
4
|
+
import DlRangeDemo from './DlRangeDemo.vue'
|
|
5
|
+
import DlSliderDemo from './DlSliderDemo.vue'
|
|
6
|
+
import DlTooltipDemo from './DlTooltipDemo.vue'
|
|
7
|
+
import DlTypographyDemo from './DlTypographyDemo.vue'
|
|
8
|
+
import DlMenuDemo from './DlMenuDemo.vue'
|
|
9
|
+
import PopupDemo from './DlPopupDemo.vue'
|
|
10
|
+
import AccordionDemo from './DlAccordionDemo.vue'
|
|
11
|
+
import DropdownButtonDemo from './DlDropdownButtonDemo.vue'
|
|
12
|
+
import DlDialogBoxDemo from './DlDialogBoxDemo.vue'
|
|
13
|
+
import DlPanelContainerDemo from './DlPanelContainerDemo.vue'
|
|
14
|
+
import DlSelectDemo from './DlSelectDemo.vue'
|
|
15
|
+
import TabsDemo from './DlTabsDemo.vue'
|
|
16
|
+
import {
|
|
17
|
+
SimpleStepper,
|
|
18
|
+
StepperInDialogBox,
|
|
19
|
+
CenteredStepperInDialogBox
|
|
20
|
+
} from './DlStepperDemo'
|
|
21
|
+
import DlTrDemo from './DlTrDemo.vue'
|
|
22
|
+
import DlThDemo from './DlThDemo.vue'
|
|
23
|
+
import DlTdDemo from './DlTdDemo.vue'
|
|
24
|
+
import DlTableDemo from './DlTableDemo.vue'
|
|
25
|
+
import DlPaginationDemo from './DlPaginationDemo.vue'
|
|
26
|
+
import DlDateTimeRangeDemo from './DlDateTimeRangeDemo.vue'
|
|
27
|
+
import DlSmartSearchDemo from './SmartSearchDemo/DlSmartSearchDemo.vue'
|
|
28
|
+
import DlSkeletonDemo from './DlSkeletonDemo.vue'
|
|
29
|
+
import DlLinkDemo from './DlLinkDemo.vue'
|
|
30
|
+
import DlProgressBarDemo from './DlProgressBarDemo.vue'
|
|
31
|
+
import DlIconDemo from './DlIconDemo.vue'
|
|
32
|
+
import DlButtonDemo from './DlButtonDemo.vue'
|
|
33
|
+
import DlOptionGroupDemo from './DlOptionGroupDemo.vue'
|
|
34
|
+
import DlColorPickerDemo from './DlColorPickerDemo.vue'
|
|
35
|
+
import DlCheckboxDemo from './DlCheckboxDemo.vue'
|
|
36
|
+
import DlChipDemo from './DlChipDemo.vue'
|
|
37
|
+
import DlListDemo from './DlListDemo.vue'
|
|
38
|
+
import DlCounterDemo from './DlCounterDemo.vue'
|
|
39
|
+
import DlTextareaDemo from './DlTextAreaDemo.vue'
|
|
40
|
+
import DlTextInputDemo from './DlTextInputDemo.vue'
|
|
41
|
+
import DlSearchDemo from './DlSearchDemo.vue'
|
|
42
|
+
import DlBadgeDemo from './DlBadgeDemo.vue'
|
|
43
|
+
import DlTrendDemo from './DlTrendDemo.vue'
|
|
44
|
+
import DlWidgetDemo from './DlWidgetDemo.vue'
|
|
45
|
+
import DlRadioDemo from './DlRadioDemo.vue'
|
|
46
|
+
import DlTextHolderDemo from './DlTextHolderDemo.vue'
|
|
47
|
+
import DlSwitchDemo from './DlSwitchDemo.vue'
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
AvatarDemo,
|
|
51
|
+
DlAlertDemo,
|
|
52
|
+
DlProgressChartDemo,
|
|
53
|
+
DlRangeDemo,
|
|
54
|
+
DlSliderDemo,
|
|
55
|
+
DlTooltipDemo,
|
|
56
|
+
PopupDemo,
|
|
57
|
+
DlSelectDemo,
|
|
58
|
+
DlTypographyDemo,
|
|
59
|
+
DlMenuDemo,
|
|
60
|
+
AccordionDemo,
|
|
61
|
+
DropdownButtonDemo,
|
|
62
|
+
DlDialogBoxDemo,
|
|
63
|
+
DlPanelContainerDemo,
|
|
64
|
+
TabsDemo,
|
|
65
|
+
SimpleStepper,
|
|
66
|
+
StepperInDialogBox,
|
|
67
|
+
DlTrDemo,
|
|
68
|
+
DlThDemo,
|
|
69
|
+
DlTdDemo,
|
|
70
|
+
DlTableDemo,
|
|
71
|
+
DlPaginationDemo,
|
|
72
|
+
DlDateTimeRangeDemo,
|
|
73
|
+
DlSmartSearchDemo,
|
|
74
|
+
DlSkeletonDemo,
|
|
75
|
+
DlLinkDemo,
|
|
76
|
+
DlProgressBarDemo,
|
|
77
|
+
DlIconDemo,
|
|
78
|
+
DlButtonDemo,
|
|
79
|
+
DlOptionGroupDemo,
|
|
80
|
+
DlColorPickerDemo,
|
|
81
|
+
DlCheckboxDemo,
|
|
82
|
+
DlChipDemo,
|
|
83
|
+
DlListDemo,
|
|
84
|
+
DlCounterDemo,
|
|
85
|
+
DlTextareaDemo,
|
|
86
|
+
DlTextInputDemo,
|
|
87
|
+
DlSearchDemo,
|
|
88
|
+
DlBadgeDemo,
|
|
89
|
+
DlTrendDemo,
|
|
90
|
+
DlWidgetDemo,
|
|
91
|
+
DlRadioDemo,
|
|
92
|
+
DlTextHolderDemo,
|
|
93
|
+
DlSwitchDemo,
|
|
94
|
+
CenteredStepperInDialogBox
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const demoState = {
|
|
98
|
+
accordion: AccordionDemo,
|
|
99
|
+
alert: DlAlertDemo,
|
|
100
|
+
avatar: AvatarDemo,
|
|
101
|
+
badge: DlBadgeDemo,
|
|
102
|
+
button: DlButtonDemo,
|
|
103
|
+
checkbox: DlCheckboxDemo,
|
|
104
|
+
chip: DlChipDemo,
|
|
105
|
+
color_picker: DlColorPickerDemo,
|
|
106
|
+
counter: DlCounterDemo,
|
|
107
|
+
dialog_box: DlDialogBoxDemo,
|
|
108
|
+
dropdown_button: DropdownButtonDemo,
|
|
109
|
+
icon: DlIconDemo,
|
|
110
|
+
link: DlLinkDemo,
|
|
111
|
+
list: DlListDemo,
|
|
112
|
+
menu: DlMenuDemo,
|
|
113
|
+
option_group: DlOptionGroupDemo,
|
|
114
|
+
pagination: DlPaginationDemo,
|
|
115
|
+
panel_container: DlPanelContainerDemo,
|
|
116
|
+
popup: PopupDemo,
|
|
117
|
+
progress_bar: DlProgressBarDemo,
|
|
118
|
+
progress_chart: DlProgressChartDemo,
|
|
119
|
+
range: DlRangeDemo,
|
|
120
|
+
search: DlSearchDemo,
|
|
121
|
+
select: DlSelectDemo,
|
|
122
|
+
skeleton: DlSkeletonDemo,
|
|
123
|
+
slider: DlSliderDemo,
|
|
124
|
+
stepper: StepperInDialogBox,
|
|
125
|
+
table: DlTableDemo,
|
|
126
|
+
table_td: DlTdDemo,
|
|
127
|
+
table_th: DlThDemo,
|
|
128
|
+
table_tr: DlTrDemo,
|
|
129
|
+
tabs: TabsDemo,
|
|
130
|
+
text_input: DlTextInputDemo,
|
|
131
|
+
textarea: DlTextareaDemo,
|
|
132
|
+
text_holder: DlTextHolderDemo,
|
|
133
|
+
time_picker: DlDateTimeRangeDemo,
|
|
134
|
+
tooltip: DlTooltipDemo,
|
|
135
|
+
trend: DlTrendDemo,
|
|
136
|
+
typography: DlTypographyDemo,
|
|
137
|
+
widget: DlWidgetDemo,
|
|
138
|
+
radio: DlRadioDemo,
|
|
139
|
+
switch: DlSwitchDemo,
|
|
140
|
+
smart_search: DlSmartSearchDemo
|
|
141
|
+
}
|
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { isVue2 } from 'vue-demi'
|
|
2
|
+
import {
|
|
3
|
+
stopAndPrevent,
|
|
4
|
+
prevent,
|
|
5
|
+
cleanEvt,
|
|
6
|
+
leftClick,
|
|
7
|
+
addEvt,
|
|
8
|
+
position,
|
|
9
|
+
stop
|
|
10
|
+
} from '../utils/events'
|
|
11
|
+
import { clearSelection } from '../utils'
|
|
12
|
+
|
|
13
|
+
type Modifiers = {
|
|
14
|
+
[key: string]: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type Ctx = {
|
|
18
|
+
uid: string
|
|
19
|
+
handler: any
|
|
20
|
+
modifiers: Modifiers
|
|
21
|
+
direction: Record<string, any>
|
|
22
|
+
lastEvt?: any
|
|
23
|
+
event?: any
|
|
24
|
+
initialEvent?: any
|
|
25
|
+
styleCleanup?: any
|
|
26
|
+
mouseStart: (evt: MouseEvent) => void
|
|
27
|
+
touchStart: (evt: TouchEvent) => void
|
|
28
|
+
start: (evt: any, mouseEvent?: boolean) => void
|
|
29
|
+
move: (evt: MouseEvent) => void
|
|
30
|
+
end: (evt: MouseEvent, abort?: boolean) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getChanges(
|
|
34
|
+
evt: MouseEvent,
|
|
35
|
+
ctx: Record<string, any>,
|
|
36
|
+
isFinal?: boolean
|
|
37
|
+
) {
|
|
38
|
+
const pos = position(evt)
|
|
39
|
+
let dir
|
|
40
|
+
let distX = pos.left - ctx.event.x
|
|
41
|
+
let distY = pos.top - ctx.event.y
|
|
42
|
+
let absX = Math.abs(distX)
|
|
43
|
+
let absY = Math.abs(distY)
|
|
44
|
+
|
|
45
|
+
const direction = ctx.direction
|
|
46
|
+
|
|
47
|
+
if (direction.horizontal === true) {
|
|
48
|
+
dir = distX < 0 ? 'left' : 'right'
|
|
49
|
+
} else if (direction.up === true && distY < 0) {
|
|
50
|
+
dir = 'up'
|
|
51
|
+
if (absX > absY) {
|
|
52
|
+
if (direction.left === true && distX < 0) {
|
|
53
|
+
dir = 'left'
|
|
54
|
+
} else if (direction.right === true && distX > 0) {
|
|
55
|
+
dir = 'right'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else if (direction.down === true && distY > 0) {
|
|
59
|
+
dir = 'down'
|
|
60
|
+
if (absX > absY) {
|
|
61
|
+
if (direction.left === true && distX < 0) {
|
|
62
|
+
dir = 'left'
|
|
63
|
+
} else if (direction.right === true && distX > 0) {
|
|
64
|
+
dir = 'right'
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} else if (direction.left === true && distX < 0) {
|
|
68
|
+
dir = 'left'
|
|
69
|
+
if (absX < absY) {
|
|
70
|
+
if (direction.up === true && distY < 0) {
|
|
71
|
+
dir = 'up'
|
|
72
|
+
} else if (direction.down === true && distY > 0) {
|
|
73
|
+
dir = 'down'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} else if (direction.right === true && distX > 0) {
|
|
77
|
+
dir = 'right'
|
|
78
|
+
if (absX < absY) {
|
|
79
|
+
if (direction.up === true && distY < 0) {
|
|
80
|
+
dir = 'up'
|
|
81
|
+
} else if (direction.down === true && distY > 0) {
|
|
82
|
+
dir = 'down'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let synthetic = false
|
|
88
|
+
|
|
89
|
+
if (dir === void 0 && isFinal === false) {
|
|
90
|
+
if (ctx.event.isFirst === true || ctx.event.lastDir === void 0) {
|
|
91
|
+
return {}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
dir = ctx.event.lastDir
|
|
95
|
+
synthetic = true
|
|
96
|
+
|
|
97
|
+
if (dir === 'left' || dir === 'right') {
|
|
98
|
+
pos.left -= distX
|
|
99
|
+
absX = 0
|
|
100
|
+
distX = 0
|
|
101
|
+
} else {
|
|
102
|
+
pos.top -= distY
|
|
103
|
+
absY = 0
|
|
104
|
+
distY = 0
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
synthetic,
|
|
110
|
+
payload: {
|
|
111
|
+
evt,
|
|
112
|
+
touch: ctx.event.mouse !== true,
|
|
113
|
+
mouse: ctx.event.mouse === true,
|
|
114
|
+
position: pos,
|
|
115
|
+
direction: dir,
|
|
116
|
+
isFirst: ctx.event.isFirst,
|
|
117
|
+
isFinal: isFinal === true,
|
|
118
|
+
duration: Date.now() - ctx.event.time,
|
|
119
|
+
distance: {
|
|
120
|
+
x: absX,
|
|
121
|
+
y: absY
|
|
122
|
+
},
|
|
123
|
+
offset: {
|
|
124
|
+
x: distX,
|
|
125
|
+
y: distY
|
|
126
|
+
},
|
|
127
|
+
delta: {
|
|
128
|
+
x: pos.left - ctx.event.lastX,
|
|
129
|
+
y: pos.top - ctx.event.lastY
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function destroy(el: any) {
|
|
136
|
+
const ctx = el.__dl_touchpan
|
|
137
|
+
if (ctx !== void 0) {
|
|
138
|
+
// emit the end event when the directive is destroyed while active
|
|
139
|
+
// this is only needed in TouchPan because the rest of the touch directives do not emit an end event
|
|
140
|
+
// the condition is also checked in the start of function but we avoid the call
|
|
141
|
+
if (ctx.event !== void 0) {
|
|
142
|
+
ctx.end()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
cleanEvt(ctx, 'main')
|
|
146
|
+
cleanEvt(ctx, 'temp')
|
|
147
|
+
|
|
148
|
+
if (ctx.styleCleanup !== void 0) {
|
|
149
|
+
ctx.styleCleanup()
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
delete el.__dl_touchpan
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function shouldStart(evt: any, ctx: any) {
|
|
157
|
+
return (
|
|
158
|
+
ctx.event === void 0 &&
|
|
159
|
+
evt.target !== void 0 &&
|
|
160
|
+
evt.target.draggable !== true &&
|
|
161
|
+
typeof ctx.handler === 'function' &&
|
|
162
|
+
evt.target.nodeName.toUpperCase() !== 'INPUT' &&
|
|
163
|
+
(evt.qClonedBy === void 0 || evt.qClonedBy.indexOf(ctx.uid) === -1)
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let uid = 0
|
|
168
|
+
|
|
169
|
+
const touchPanV2 = {
|
|
170
|
+
bind(el: HTMLElement, { value, modifiers }: any) {
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
if (el.__dl_touchpan !== void 0) {
|
|
173
|
+
destroy(el)
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
el.__dl_touchpan_destroyed = true
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (modifiers.mouse !== true) {
|
|
179
|
+
return
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function handleEvent(evt: any, mouseEvent: boolean) {
|
|
183
|
+
if (modifiers.mouse === true && mouseEvent === true) {
|
|
184
|
+
stopAndPrevent(evt)
|
|
185
|
+
} else {
|
|
186
|
+
if (modifiers.stop === true) {
|
|
187
|
+
stop(evt)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (modifiers.prevent === true) {
|
|
191
|
+
prevent(evt)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const ctx: Ctx = {
|
|
197
|
+
uid: 'qvtp_' + uid++,
|
|
198
|
+
handler: value,
|
|
199
|
+
modifiers,
|
|
200
|
+
direction: {
|
|
201
|
+
left: true,
|
|
202
|
+
right: true
|
|
203
|
+
},
|
|
204
|
+
mouseStart(evt: MouseEvent) {
|
|
205
|
+
if (shouldStart(evt, ctx) && leftClick(evt)) {
|
|
206
|
+
addEvt(ctx, 'temp', [
|
|
207
|
+
[document, 'mousemove', 'move', 'notPassiveCapture'],
|
|
208
|
+
[document, 'mouseup', 'end', 'passiveCapture']
|
|
209
|
+
])
|
|
210
|
+
|
|
211
|
+
ctx.start(evt, true)
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
touchStart(evt: TouchEvent) {
|
|
216
|
+
if (shouldStart(evt, ctx)) {
|
|
217
|
+
const target = evt.target as HTMLElement
|
|
218
|
+
|
|
219
|
+
addEvt(ctx, 'temp', [
|
|
220
|
+
[target, 'touchmove', 'move', 'notPassiveCapture'],
|
|
221
|
+
[target, 'touchcancel', 'end', 'passiveCapture'],
|
|
222
|
+
[target, 'touchend', 'end', 'passiveCapture']
|
|
223
|
+
])
|
|
224
|
+
|
|
225
|
+
ctx.start(evt)
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
start(evt: any, mouseEvent?: boolean) {
|
|
230
|
+
ctx.lastEvt = evt
|
|
231
|
+
|
|
232
|
+
const pos = position(evt)
|
|
233
|
+
|
|
234
|
+
/*
|
|
235
|
+
* Stop propagation so possible upper v-touch-pan don't catch this as well;
|
|
236
|
+
* If we're not the target (based on modifiers), we'll re-emit the event later
|
|
237
|
+
*/
|
|
238
|
+
if (mouseEvent === true || modifiers.stop === true) {
|
|
239
|
+
/*
|
|
240
|
+
* are we directly switching to detected state?
|
|
241
|
+
* clone event only otherwise
|
|
242
|
+
*/
|
|
243
|
+
if (
|
|
244
|
+
ctx.direction.all !== true &&
|
|
245
|
+
(mouseEvent !== true ||
|
|
246
|
+
ctx.direction.mouseAllDir !== true)
|
|
247
|
+
) {
|
|
248
|
+
const clone: any =
|
|
249
|
+
evt.type.indexOf('mouse') > -1
|
|
250
|
+
? new MouseEvent(evt.type, evt)
|
|
251
|
+
: new TouchEvent(evt.type, evt)
|
|
252
|
+
|
|
253
|
+
if (evt.defaultPrevented === true) {
|
|
254
|
+
prevent(clone)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (evt.cancelBubble === true) {
|
|
258
|
+
stop(clone)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
clone.qClonedBy =
|
|
262
|
+
evt.qClonedBy === void 0
|
|
263
|
+
? [ctx.uid]
|
|
264
|
+
: evt.qClonedBy.concat(ctx.uid)
|
|
265
|
+
clone.qKeyEvent = evt.qKeyEvent
|
|
266
|
+
clone.qClickOutside = evt.qClickOutside
|
|
267
|
+
|
|
268
|
+
ctx.initialEvent = {
|
|
269
|
+
target: evt.target,
|
|
270
|
+
event: clone
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
stop(evt)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
ctx.event = {
|
|
278
|
+
x: pos.left,
|
|
279
|
+
y: pos.top,
|
|
280
|
+
time: Date.now(),
|
|
281
|
+
mouse: mouseEvent === true,
|
|
282
|
+
detected: false,
|
|
283
|
+
isFirst: true,
|
|
284
|
+
isFinal: false,
|
|
285
|
+
lastX: pos.left,
|
|
286
|
+
lastY: pos.top
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
move(evt: MouseEvent) {
|
|
291
|
+
if (ctx.event === void 0) {
|
|
292
|
+
return
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
ctx.lastEvt = evt
|
|
296
|
+
|
|
297
|
+
const isMouseEvt = ctx.event.mouse === true
|
|
298
|
+
const start = () => {
|
|
299
|
+
handleEvent(evt, isMouseEvt)
|
|
300
|
+
|
|
301
|
+
if (modifiers.preserveCursor !== true) {
|
|
302
|
+
document.documentElement.style.cursor = 'grabbing'
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (isMouseEvt === true) {
|
|
306
|
+
document.body.classList.add(
|
|
307
|
+
'no-pointer-events--children'
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
document.body.classList.add('non-selectable')
|
|
312
|
+
clearSelection()
|
|
313
|
+
|
|
314
|
+
ctx.styleCleanup = (withDelayedFn: any) => {
|
|
315
|
+
ctx.styleCleanup = void 0
|
|
316
|
+
|
|
317
|
+
if (modifiers.preserveCursor !== true) {
|
|
318
|
+
document.documentElement.style.cursor = ''
|
|
319
|
+
}
|
|
320
|
+
document.body.classList.remove('non-selectable')
|
|
321
|
+
|
|
322
|
+
if (isMouseEvt === true) {
|
|
323
|
+
const remove = () => {
|
|
324
|
+
document.body.classList.remove(
|
|
325
|
+
'no-pointer-events--children'
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (withDelayedFn !== void 0) {
|
|
330
|
+
setTimeout(() => {
|
|
331
|
+
remove()
|
|
332
|
+
withDelayedFn()
|
|
333
|
+
}, 50)
|
|
334
|
+
} else {
|
|
335
|
+
remove()
|
|
336
|
+
}
|
|
337
|
+
} else if (withDelayedFn !== void 0) {
|
|
338
|
+
withDelayedFn()
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (ctx.event.detected === true) {
|
|
344
|
+
if (ctx.event.isFirst !== true) {
|
|
345
|
+
handleEvent(evt, ctx.event.mouse)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const { payload, synthetic } = getChanges(evt, ctx, false)
|
|
349
|
+
|
|
350
|
+
if (payload !== void 0) {
|
|
351
|
+
if (ctx.handler(payload) === false) {
|
|
352
|
+
ctx.end(evt)
|
|
353
|
+
} else {
|
|
354
|
+
if (
|
|
355
|
+
ctx.styleCleanup === void 0 &&
|
|
356
|
+
ctx.event.isFirst === true
|
|
357
|
+
) {
|
|
358
|
+
start()
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
ctx.event.lastX = payload.position.left
|
|
362
|
+
ctx.event.lastY = payload.position.top
|
|
363
|
+
ctx.event.lastDir =
|
|
364
|
+
synthetic === true ? void 0 : payload.direction
|
|
365
|
+
ctx.event.isFirst = false
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (
|
|
373
|
+
ctx.direction.all === true ||
|
|
374
|
+
(isMouseEvt === true && ctx.modifiers.mouseAllDir === true)
|
|
375
|
+
) {
|
|
376
|
+
start()
|
|
377
|
+
ctx.event.detected = true
|
|
378
|
+
ctx.move(evt)
|
|
379
|
+
return
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const pos = position(evt)
|
|
383
|
+
const distX = pos.left - ctx.event.x
|
|
384
|
+
const distY = pos.top - ctx.event.y
|
|
385
|
+
const absX = Math.abs(distX)
|
|
386
|
+
const absY = Math.abs(distY)
|
|
387
|
+
|
|
388
|
+
if (absX !== absY) {
|
|
389
|
+
if (
|
|
390
|
+
(ctx.direction.horizontal === true && absX > absY) ||
|
|
391
|
+
(ctx.direction.vertical === true && absX < absY) ||
|
|
392
|
+
(ctx.direction.up === true &&
|
|
393
|
+
absX < absY &&
|
|
394
|
+
distY < 0) ||
|
|
395
|
+
(ctx.direction.down === true &&
|
|
396
|
+
absX < absY &&
|
|
397
|
+
distY > 0) ||
|
|
398
|
+
(ctx.direction.left === true &&
|
|
399
|
+
absX > absY &&
|
|
400
|
+
distX < 0) ||
|
|
401
|
+
(ctx.direction.right === true &&
|
|
402
|
+
absX > absY &&
|
|
403
|
+
distX > 0)
|
|
404
|
+
) {
|
|
405
|
+
ctx.event.detected = true
|
|
406
|
+
ctx.move(evt)
|
|
407
|
+
} else {
|
|
408
|
+
ctx.end(evt, true)
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
|
|
413
|
+
end(evt: MouseEvent, abort?: boolean) {
|
|
414
|
+
if (ctx.event === void 0) {
|
|
415
|
+
return
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
cleanEvt(ctx, 'temp')
|
|
419
|
+
if (abort === true) {
|
|
420
|
+
if (ctx.styleCleanup !== void 0) {
|
|
421
|
+
ctx.styleCleanup()
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (
|
|
425
|
+
ctx.event.detected !== true &&
|
|
426
|
+
ctx.initialEvent !== void 0
|
|
427
|
+
) {
|
|
428
|
+
ctx.initialEvent.target.dispatchEvent(
|
|
429
|
+
ctx.initialEvent.event
|
|
430
|
+
)
|
|
431
|
+
}
|
|
432
|
+
} else if (ctx.event.detected === true) {
|
|
433
|
+
if (ctx.event.isFirst === true) {
|
|
434
|
+
ctx.handler(
|
|
435
|
+
getChanges(evt === void 0 ? ctx.lastEvt : evt, ctx)
|
|
436
|
+
.payload
|
|
437
|
+
)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const { payload } = getChanges(
|
|
441
|
+
evt === void 0 ? ctx.lastEvt : evt,
|
|
442
|
+
ctx,
|
|
443
|
+
true
|
|
444
|
+
)
|
|
445
|
+
const fn = () => {
|
|
446
|
+
ctx.handler(payload)
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if (ctx.styleCleanup !== void 0) {
|
|
450
|
+
ctx.styleCleanup(fn)
|
|
451
|
+
} else {
|
|
452
|
+
fn()
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
ctx.event = void 0
|
|
457
|
+
ctx.initialEvent = void 0
|
|
458
|
+
ctx.lastEvt = void 0
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// @ts-ignore
|
|
463
|
+
el.__dl_touchpan = ctx
|
|
464
|
+
|
|
465
|
+
if (modifiers.mouse === true) {
|
|
466
|
+
addEvt(ctx, 'main', [
|
|
467
|
+
[
|
|
468
|
+
el,
|
|
469
|
+
'mousedown',
|
|
470
|
+
'mouseStart',
|
|
471
|
+
`passive${modifiers.mouseCapture === true ? 'Capture' : ''}`
|
|
472
|
+
]
|
|
473
|
+
])
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
if ('ontouchstart' in window === true) {
|
|
477
|
+
addEvt(ctx, 'main', [
|
|
478
|
+
[
|
|
479
|
+
el,
|
|
480
|
+
'touchstart',
|
|
481
|
+
'touchStart',
|
|
482
|
+
`passive${modifiers.capture === true ? 'Capture' : ''}`
|
|
483
|
+
],
|
|
484
|
+
[el, 'touchmove', 'notPassiveCapture']
|
|
485
|
+
])
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
|
|
489
|
+
update(el: HTMLElement, { oldValue, value }: any) {
|
|
490
|
+
// @ts-ignore
|
|
491
|
+
const ctx = el.__dl_touchpan
|
|
492
|
+
if (ctx !== void 0 && oldValue !== value) {
|
|
493
|
+
if (typeof value !== 'function') {
|
|
494
|
+
ctx.end()
|
|
495
|
+
}
|
|
496
|
+
ctx.handler = value
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
|
|
500
|
+
unbind(el: HTMLElement) {
|
|
501
|
+
// @ts-ignore
|
|
502
|
+
if (el.__dl_touchpan_destroyed === void 0) {
|
|
503
|
+
destroy(el)
|
|
504
|
+
} else {
|
|
505
|
+
// @ts-ignore
|
|
506
|
+
delete el.__dl_touchpan_destroyed
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const touchPanV3 = {
|
|
512
|
+
beforeMount(el: HTMLElement, bindings: any) {
|
|
513
|
+
touchPanV2.bind.apply(this, [el, bindings])
|
|
514
|
+
},
|
|
515
|
+
|
|
516
|
+
beforeUpdate(el: HTMLElement, bindings: any) {
|
|
517
|
+
touchPanV2.update.apply(this, [el, bindings])
|
|
518
|
+
},
|
|
519
|
+
|
|
520
|
+
unmounted(el: HTMLElement) {
|
|
521
|
+
touchPanV2.unbind.apply(this, [el])
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export default isVue2 ? touchPanV2 : touchPanV3
|