@dataloop-ai/components 0.18.145 → 0.19.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/package.json +4 -1
- package/src/assets/constants.scss +25 -26
- package/src/assets/globals.scss +58 -56
- package/src/assets/grid.css +1 -1
- package/src/assets/grid.scss +4 -4
- package/src/components/basic/DlAccordion/DlAccordion.vue +10 -3
- package/src/components/basic/DlEmptyState/types.ts +1 -1
- package/src/components/basic/DlGrid/DlGrid.vue +2 -1
- package/src/components/basic/DlPopup/DlPopup.vue +159 -396
- package/src/components/basic/DlWidget/DlWidget.vue +2 -1
- package/src/components/basic/utils.ts +0 -9
- package/src/components/blocks/DlLabelPicker/DlLabelPicker.vue +127 -0
- package/src/components/blocks/DlLabelPicker/index.ts +3 -0
- package/src/components/blocks/DlLabelPicker/types.ts +6 -0
- package/src/components/blocks/index.ts +1 -0
- package/src/components/blocks/types.ts +1 -0
- package/src/components/compound/DlCodeEditor/README.md +5 -4
- package/src/components/compound/DlCodeEditor/styles/themes-base16.css +16934 -11289
- package/src/components/compound/DlCodeEditor/styles/themes.css +5122 -3448
- package/src/components/compound/DlInput/DlInput.vue +609 -178
- package/src/components/compound/DlInput/components/InputFileElement.vue +97 -0
- package/src/components/compound/DlInput/types.ts +12 -0
- package/src/components/compound/DlInput/utils.ts +117 -0
- package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +10 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +3 -3
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +1 -1
- package/src/components/compound/DlSlider/sliderStyles.scss +92 -92
- package/src/components/compound/DlTable/DlTable.vue +701 -358
- package/src/components/compound/DlTable/components/DlTd.vue +11 -9
- package/src/components/compound/DlTable/components/DlTh.vue +22 -21
- package/src/components/compound/DlTable/components/SortableJS.vue +33 -0
- package/src/components/compound/DlTable/hooks/tableActions.ts +3 -3
- package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +3 -4
- package/src/components/compound/DlTable/hooks/use-sortable.ts +152 -0
- package/src/components/compound/DlTable/styles/dl-table-styles.scss +372 -377
- package/src/components/compound/DlTable/types.ts +6 -0
- package/src/components/compound/DlTable/utils/getCellValue.ts +27 -0
- package/src/components/compound/DlTable/utils/insertAtIndex.ts +22 -0
- package/src/components/compound/DlTable/utils/tableClasses.ts +22 -0
- package/src/components/compound/DlToast/api/useToast.ts +10 -4
- package/src/components/compound/DlToast/components/ToastComponent.vue +26 -21
- package/src/components/compound/DlToast/utils/render.ts +15 -8
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +708 -323
- package/src/components/compound/DlTreeTable/components/DlTdTree.vue +10 -9
- package/src/components/compound/DlTreeTable/components/DlTrTree.vue +13 -0
- package/src/components/compound/DlTreeTable/emits.ts +2 -2
- package/src/components/compound/DlTreeTable/utils/index.ts +6 -0
- package/src/components/compound/DlTreeTable/utils/moveNestedRow.ts +95 -0
- package/src/components/compound/DlTreeTable/utils/trSpacing.ts +12 -1
- package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +10 -7
- package/src/components/compound/DlTreeTable/views/DlTrTreeView.vue +52 -58
- package/src/components/essential/DlMenu/DlMenu.vue +25 -0
- package/src/components/index.ts +1 -0
- package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +2 -1
- package/src/components/shared/DlVirtualScroll/styles/dl-virtual-scroll-styles.scss +62 -41
- package/src/components/types.ts +1 -0
- package/src/demos/DlAccordionDemo.vue +32 -0
- package/src/demos/DlButtonDemo.vue +7 -0
- package/src/demos/DlDemoPage.vue +1 -0
- package/src/demos/DlInputDemo.vue +122 -64
- package/src/demos/DlLabelPickerDemo.vue +46 -0
- package/src/demos/DlPopupDemo.vue +94 -4
- package/src/demos/DlSearchDemo.vue +0 -1
- package/src/demos/DlTableDemo.vue +261 -162
- package/src/demos/DlToastDemo.vue +28 -1
- package/src/demos/DlTreeTableDemo.vue +266 -262
- package/src/demos/DlVirtualScrollDemo.vue +1 -4
- package/src/demos/index.ts +3 -1
- package/src/hooks/use-model-toggle.ts +26 -62
- package/src/utils/browse-nested-nodes.ts +26 -0
- package/src/utils/draggable-table.ts +100 -488
- package/src/utils/get-element-above.ts +8 -0
- package/src/utils/getSlotByVersion.ts +11 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/keyCodes.ts +1 -1
- package/src/utils/remove-child-nodes.ts +5 -0
- package/src/utils/render-fn.ts +46 -0
- package/src/utils/resizable-table.ts +110 -0
- package/src/utils/selection.ts +196 -0
- package/src/utils/swap-nodes.ts +11 -0
- package/src/utils/table-columns.ts +209 -0
- package/src/components/compound/DlTable/utils/ResizableManager.ts +0 -236
- package/src/components/compound/DlTable/utils/index.ts +0 -1
- package/src/components/compound/DlTable/utils/props.ts +0 -120
- package/src/components/compound/DlTreeTable/props.ts +0 -134
- package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +0 -19
|
@@ -1,171 +1,142 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<dl-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<dl-menu
|
|
3
|
+
ref="menuRef"
|
|
4
|
+
v-bind="menuProps"
|
|
5
|
+
:model-value="modelV"
|
|
6
|
+
@click="handleClick"
|
|
7
|
+
@escapekey="handleEscape"
|
|
8
|
+
@before-show="handleBeforeShow"
|
|
9
|
+
@before-hide="handleBeforeHide"
|
|
10
|
+
@show="handleShow"
|
|
11
|
+
@hide="handleHide"
|
|
12
|
+
@update:model-value="updateModelValue"
|
|
5
13
|
>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
<draggable-upper
|
|
15
|
+
v-if="draggable"
|
|
16
|
+
class="popup-dialog-upper"
|
|
17
|
+
@move="movePopup"
|
|
18
|
+
/>
|
|
19
|
+
<popup-header
|
|
20
|
+
v-if="hasHeaderSlot || hasCloseButtonSlot || withCloseButton"
|
|
21
|
+
:title="title"
|
|
22
|
+
:additional-info="additionalInfo"
|
|
23
|
+
:subtitle="subtitle"
|
|
24
|
+
:with-close-button="withCloseButton"
|
|
25
|
+
@close-button-click="handleCloseClick"
|
|
9
26
|
>
|
|
10
|
-
<
|
|
11
|
-
v-if="
|
|
12
|
-
|
|
13
|
-
ref="innerRef"
|
|
14
|
-
tabIndex="-1"
|
|
15
|
-
:class="classes"
|
|
16
|
-
:style="styles"
|
|
27
|
+
<template
|
|
28
|
+
v-if="hasHeaderSlot"
|
|
29
|
+
#header
|
|
17
30
|
>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
>
|
|
37
|
-
<slot name="header" />
|
|
38
|
-
</template>
|
|
39
|
-
<template
|
|
40
|
-
v-if="hasCloseButtonSlot"
|
|
41
|
-
#close-button
|
|
42
|
-
>
|
|
43
|
-
<slot name="close-button" />
|
|
44
|
-
</template>
|
|
45
|
-
</popup-header>
|
|
46
|
-
<div class="popup-content">
|
|
47
|
-
<slot v-if="!isEmpty" />
|
|
48
|
-
<dl-empty-state
|
|
49
|
-
v-if="isEmpty && emptyStateProps"
|
|
50
|
-
v-bind="emptyStateProps"
|
|
51
|
-
>
|
|
52
|
-
<template
|
|
53
|
-
v-for="(_, slot) in $slots"
|
|
54
|
-
#[slot]="props"
|
|
55
|
-
>
|
|
56
|
-
<slot
|
|
57
|
-
:name="slot"
|
|
58
|
-
v-bind="props"
|
|
59
|
-
/>
|
|
60
|
-
</template>
|
|
61
|
-
</dl-empty-state>
|
|
62
|
-
</div>
|
|
63
|
-
<div
|
|
64
|
-
v-if="hasFooterSlot"
|
|
65
|
-
class="popup-footer"
|
|
31
|
+
<slot name="header" />
|
|
32
|
+
</template>
|
|
33
|
+
<template
|
|
34
|
+
v-if="hasCloseButtonSlot"
|
|
35
|
+
#close-button
|
|
36
|
+
>
|
|
37
|
+
<slot name="close-button" />
|
|
38
|
+
</template>
|
|
39
|
+
</popup-header>
|
|
40
|
+
<div class="popup-content">
|
|
41
|
+
<slot v-if="!isEmpty" />
|
|
42
|
+
<dl-empty-state
|
|
43
|
+
v-if="isEmpty && emptyStateProps"
|
|
44
|
+
v-bind="emptyStateProps"
|
|
45
|
+
>
|
|
46
|
+
<template
|
|
47
|
+
v-for="(_, slot) in $slots"
|
|
48
|
+
#[slot]="props"
|
|
66
49
|
>
|
|
67
|
-
<slot
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
<slot
|
|
51
|
+
:name="slot"
|
|
52
|
+
v-bind="props"
|
|
53
|
+
/>
|
|
54
|
+
</template>
|
|
55
|
+
</dl-empty-state>
|
|
56
|
+
</div>
|
|
57
|
+
<div
|
|
58
|
+
v-if="hasFooterSlot"
|
|
59
|
+
class="popup-footer"
|
|
60
|
+
>
|
|
61
|
+
<slot name="footer" />
|
|
62
|
+
</div>
|
|
63
|
+
</dl-menu>
|
|
72
64
|
</template>
|
|
73
65
|
|
|
74
66
|
<script lang="ts">
|
|
75
67
|
import {
|
|
76
|
-
h as _h,
|
|
77
68
|
defineComponent,
|
|
78
|
-
onBeforeUnmount,
|
|
79
69
|
getCurrentInstance,
|
|
80
70
|
ref,
|
|
81
71
|
watch,
|
|
82
72
|
computed,
|
|
83
73
|
PropType,
|
|
84
74
|
Ref,
|
|
85
|
-
|
|
75
|
+
toRef
|
|
86
76
|
} from 'vue-demi'
|
|
87
77
|
|
|
88
|
-
import
|
|
89
|
-
import useAnchor, { useAnchorProps } from '../../../hooks/use-anchor'
|
|
90
|
-
import useScrollTarget from '../../../hooks/use-scroll-target'
|
|
91
|
-
import useModelToggle, {
|
|
92
|
-
useModelToggleProps,
|
|
93
|
-
AnchorEvent
|
|
94
|
-
} from '../../../hooks/use-model-toggle'
|
|
95
|
-
import usePortal from '../../../hooks/use-portal'
|
|
96
|
-
import useTransition, {
|
|
97
|
-
useTransitionProps
|
|
98
|
-
} from '../../../hooks/use-transition'
|
|
99
|
-
import useTick from '../../../hooks/use-tick'
|
|
100
|
-
import useTimeout from '../../../hooks/use-timeout'
|
|
101
|
-
|
|
102
|
-
import { getScrollTarget } from '../../../utils/scroll'
|
|
103
|
-
import DlTeleport from '../../../utils/teleport'
|
|
104
|
-
import { removeEscapeKey } from '../../../utils/escape-key'
|
|
105
|
-
import { addFocusout, removeFocusout } from '../../../utils/focusout'
|
|
106
|
-
import { childHasFocus } from '../../../utils/dom'
|
|
78
|
+
import { useAnchorProps } from '../../../hooks/use-anchor'
|
|
107
79
|
import {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
80
|
+
AnchorEvent,
|
|
81
|
+
useModelToggleEmits,
|
|
82
|
+
useModelToggleProps
|
|
83
|
+
} from '../../../hooks/use-model-toggle'
|
|
84
|
+
import { useTransitionProps } from '../../../hooks/use-transition'
|
|
113
85
|
import {
|
|
114
86
|
validatePosition,
|
|
115
87
|
validateOffset,
|
|
116
|
-
setPosition,
|
|
117
|
-
parsePosition,
|
|
118
88
|
setForcedPosition
|
|
119
89
|
} from '../../../utils/position-engine'
|
|
120
|
-
import {
|
|
121
|
-
getAnchorOrigin,
|
|
122
|
-
handleWatcherEvents,
|
|
123
|
-
setOffsetOnShow,
|
|
124
|
-
updateUnwatchPosition,
|
|
125
|
-
refocusTargetFn,
|
|
126
|
-
conditionalHandler,
|
|
127
|
-
handleClickOutside
|
|
128
|
-
} from '../../essential/DlMenu/utils'
|
|
129
90
|
import DraggableUpper from './components/DraggableUpper.vue'
|
|
130
91
|
import PopupHeader from './components/PopupHeader.vue'
|
|
131
92
|
import { v4 } from 'uuid'
|
|
132
|
-
import { isString } from 'lodash'
|
|
133
93
|
import { DlEmptyStateProps } from '../DlEmptyState/types'
|
|
134
|
-
import { stringStyleToRecord } from '../../../utils'
|
|
135
94
|
import DlEmptyState from '../DlEmptyState/DlEmptyState.vue'
|
|
95
|
+
import { DlMenu } from '../../essential/DlMenu'
|
|
136
96
|
|
|
137
97
|
export default defineComponent({
|
|
138
98
|
name: 'DlPopup',
|
|
139
99
|
components: {
|
|
140
|
-
DlTeleport,
|
|
141
100
|
PopupHeader,
|
|
142
101
|
DraggableUpper,
|
|
143
|
-
DlEmptyState
|
|
102
|
+
DlEmptyState,
|
|
103
|
+
DlMenu
|
|
144
104
|
},
|
|
145
105
|
model: {
|
|
146
106
|
prop: 'modelValue',
|
|
147
107
|
event: 'update:model-value'
|
|
148
108
|
},
|
|
149
109
|
props: {
|
|
110
|
+
additionalInfo: { type: String, default: '' },
|
|
111
|
+
title: { type: String, default: '' },
|
|
112
|
+
subtitle: { type: String, default: '' },
|
|
113
|
+
withCloseButton: Boolean,
|
|
114
|
+
height: { type: String, default: 'auto' },
|
|
115
|
+
width: { type: String, default: 'auto' },
|
|
116
|
+
draggable: Boolean,
|
|
117
|
+
isEmpty: Boolean,
|
|
118
|
+
emptyStateProps: {
|
|
119
|
+
type: Object as PropType<DlEmptyStateProps>,
|
|
120
|
+
default: null
|
|
121
|
+
},
|
|
122
|
+
|
|
150
123
|
...useAnchorProps,
|
|
151
124
|
...useModelToggleProps,
|
|
152
125
|
...useTransitionProps,
|
|
126
|
+
|
|
153
127
|
disabled: Boolean,
|
|
154
128
|
persistent: Boolean,
|
|
155
129
|
autoClose: Boolean,
|
|
156
130
|
noRefocus: Boolean,
|
|
157
|
-
|
|
131
|
+
fitContainer: Boolean,
|
|
132
|
+
fitContent: Boolean,
|
|
133
|
+
cover: Boolean,
|
|
134
|
+
square: Boolean,
|
|
158
135
|
anchor: {
|
|
159
136
|
type: String,
|
|
160
|
-
default: '
|
|
137
|
+
default: 'bottom middle',
|
|
161
138
|
validator: validatePosition
|
|
162
139
|
},
|
|
163
|
-
additionalInfo: { type: String, default: '' },
|
|
164
|
-
title: { type: String, default: '' },
|
|
165
|
-
subtitle: { type: String, default: '' },
|
|
166
|
-
withCloseButton: { type: Boolean, default: false },
|
|
167
|
-
preventHide: { type: Boolean, default: false },
|
|
168
|
-
disableCloseByEsc: { type: Boolean, default: false },
|
|
169
140
|
self: {
|
|
170
141
|
type: String,
|
|
171
142
|
default: 'top middle',
|
|
@@ -180,54 +151,37 @@ export default defineComponent({
|
|
|
180
151
|
type: String as PropType<Element | string>,
|
|
181
152
|
default: null
|
|
182
153
|
},
|
|
154
|
+
|
|
183
155
|
touchPosition: Boolean,
|
|
184
156
|
maxHeight: { type: String, default: 'auto' },
|
|
185
157
|
maxWidth: { type: String, default: 'auto' },
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
type:
|
|
192
|
-
default:
|
|
158
|
+
menuClass: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: ''
|
|
161
|
+
},
|
|
162
|
+
arrowNavItems: {
|
|
163
|
+
type: [String, Array, Object],
|
|
164
|
+
default: () => [] as any[]
|
|
193
165
|
},
|
|
194
166
|
zIndex: {
|
|
195
167
|
type: [Number, String],
|
|
196
168
|
default: 'var(--dl-z-index-popup)'
|
|
169
|
+
},
|
|
170
|
+
/**
|
|
171
|
+
* the % of the parent element that triggers the tooltips visibility
|
|
172
|
+
*/
|
|
173
|
+
triggerPercentage: {
|
|
174
|
+
type: Number,
|
|
175
|
+
default: 1
|
|
197
176
|
}
|
|
198
177
|
},
|
|
199
|
-
emits: [
|
|
200
|
-
|
|
201
|
-
'show',
|
|
202
|
-
'before-show',
|
|
203
|
-
'hide',
|
|
204
|
-
'escapekey',
|
|
205
|
-
'before-hide',
|
|
206
|
-
'update:model-value'
|
|
207
|
-
],
|
|
208
|
-
setup(props, { attrs, slots }) {
|
|
178
|
+
emits: [...useModelToggleEmits, 'click', 'escapekey', 'close-button-click'],
|
|
179
|
+
setup(props, { attrs, slots, emit }) {
|
|
209
180
|
const vm = getCurrentInstance()
|
|
210
181
|
|
|
211
|
-
let refocusTarget: HTMLElement | Element | null = null
|
|
212
|
-
let absoluteOffset: Record<any, any> | undefined
|
|
213
|
-
let unwatchPosition: Function | undefined
|
|
214
|
-
|
|
215
182
|
const proxy = vm!.proxy!
|
|
216
183
|
|
|
217
|
-
const
|
|
218
|
-
const showing = ref(false)
|
|
219
|
-
|
|
220
|
-
const { registerTick, removeTick } = useTick()
|
|
221
|
-
const { registerTimeout, removeTimeout } = useTimeout()
|
|
222
|
-
const { transitionStyle } = useTransition(props, showing)
|
|
223
|
-
const { localScrollTarget, changeScrollEvent } = useScrollTarget(
|
|
224
|
-
props,
|
|
225
|
-
configureScrollTarget
|
|
226
|
-
)
|
|
227
|
-
|
|
228
|
-
const { anchorEl, canShow } = useAnchor({})
|
|
229
|
-
|
|
230
|
-
const screen = useWindowSize()
|
|
184
|
+
const menuRef: Ref<HTMLElement | null> = ref(null)
|
|
231
185
|
|
|
232
186
|
const hasFooterSlot = computed(() => slots.footer !== undefined)
|
|
233
187
|
|
|
@@ -237,211 +191,68 @@ export default defineComponent({
|
|
|
237
191
|
() => slots['close-button'] !== undefined
|
|
238
192
|
)
|
|
239
193
|
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
canShow,
|
|
243
|
-
handleShow,
|
|
244
|
-
handleHide,
|
|
245
|
-
processOnMount: true
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
const {
|
|
249
|
-
showPortal,
|
|
250
|
-
hidePortal,
|
|
251
|
-
portalEl,
|
|
252
|
-
portalIsActive,
|
|
253
|
-
portalIsAccessible
|
|
254
|
-
} = usePortal(vm, innerRef)
|
|
255
|
-
|
|
256
|
-
const clickOutsideProps = {
|
|
257
|
-
anchorEl,
|
|
258
|
-
innerRef,
|
|
259
|
-
onClickOutside: (e: AnchorEvent) =>
|
|
260
|
-
handleClickOutside(e, {
|
|
261
|
-
persistent: props.persistent,
|
|
262
|
-
showing: showing.value,
|
|
263
|
-
fn: hide
|
|
264
|
-
})
|
|
194
|
+
const handleClick = (e: MouseEvent) => {
|
|
195
|
+
emit('click', e)
|
|
265
196
|
}
|
|
266
197
|
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
)
|
|
270
|
-
|
|
271
|
-
const selfOrigin = computed(() =>
|
|
272
|
-
parsePosition(props.self || 'top start')
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
const handlesFocus = computed(
|
|
276
|
-
() => showing.value === true && props.persistent !== true
|
|
277
|
-
)
|
|
278
|
-
|
|
279
|
-
const stylesFromProps = computed(() => {
|
|
280
|
-
return {
|
|
281
|
-
'--popup-max-width': props.maxWidth,
|
|
282
|
-
'--popup-max-height': props.maxHeight,
|
|
283
|
-
'--popup-width': props.width,
|
|
284
|
-
'--popup-height': props.height,
|
|
285
|
-
'--popup-z-index': props.zIndex ?? 'var(--dl-z-index-popup)'
|
|
286
|
-
}
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
watch(handlesFocus, (val) =>
|
|
290
|
-
handleWatcherEvents(val, onEscapeKey, clickOutsideProps)
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
function focus() {
|
|
294
|
-
addFocusFn(() => {
|
|
295
|
-
let node = innerRef.value as unknown as HTMLElement
|
|
296
|
-
|
|
297
|
-
if (node && node.contains(document.activeElement) !== true) {
|
|
298
|
-
node =
|
|
299
|
-
node.querySelector('[autofocus], [data-autofocus]') ||
|
|
300
|
-
node
|
|
301
|
-
node.focus({ preventScroll: true })
|
|
302
|
-
}
|
|
303
|
-
})
|
|
198
|
+
const handleBeforeShow = (e: AnchorEvent) => {
|
|
199
|
+
emit('before-show', e)
|
|
304
200
|
}
|
|
305
201
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
removeTimeout()
|
|
309
|
-
|
|
310
|
-
refocusTarget =
|
|
311
|
-
props.noRefocus === false ? document.activeElement : null
|
|
312
|
-
|
|
313
|
-
addFocusout(onFocusout)
|
|
314
|
-
|
|
315
|
-
showPortal()
|
|
316
|
-
|
|
317
|
-
absoluteOffset = null
|
|
318
|
-
|
|
319
|
-
const offsetOnShow = setOffsetOnShow(evt as TouchEvent, {
|
|
320
|
-
contextMenu: props.contextMenu,
|
|
321
|
-
touchPosition: props.touchPosition,
|
|
322
|
-
anchorEl,
|
|
323
|
-
absoluteOffset
|
|
324
|
-
})
|
|
325
|
-
|
|
326
|
-
absoluteOffset = offsetOnShow as Record<any, any> | undefined
|
|
327
|
-
|
|
328
|
-
if (!unwatchPosition) {
|
|
329
|
-
unwatchPosition = watch(() => screen, updatePosition, {
|
|
330
|
-
deep: true
|
|
331
|
-
})
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
if (!props.noFocus) (document.activeElement as HTMLElement).blur()
|
|
335
|
-
|
|
336
|
-
registerTick(() => {
|
|
337
|
-
updatePosition()
|
|
338
|
-
if (!props.noFocus) focus()
|
|
339
|
-
})
|
|
340
|
-
|
|
341
|
-
registerTimeout(() => {
|
|
342
|
-
updatePosition()
|
|
343
|
-
showPortal(true) // done showing portal
|
|
344
|
-
proxy.$emit('show', evt)
|
|
345
|
-
}, props.transitionDuration)
|
|
202
|
+
const handleBeforeHide = (e: AnchorEvent) => {
|
|
203
|
+
emit('before-hide', e)
|
|
346
204
|
}
|
|
347
205
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
removeTimeout()
|
|
351
|
-
hidePortal()
|
|
352
|
-
|
|
353
|
-
anchorCleanup(true)
|
|
354
|
-
refocusTarget = refocusTargetFn(evt, refocusTarget as HTMLElement)
|
|
355
|
-
|
|
356
|
-
registerTimeout(() => {
|
|
357
|
-
hidePortal(true) // done hiding, now destroy
|
|
358
|
-
proxy.$emit('hide', evt)
|
|
359
|
-
}, props.transitionDuration)
|
|
206
|
+
const handleShow = (e: AnchorEvent) => {
|
|
207
|
+
emit('show', e)
|
|
360
208
|
}
|
|
361
209
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
unwatchPosition = updateUnwatchPosition(unwatchPosition)
|
|
366
|
-
|
|
367
|
-
conditionalHandler(hiding || showing.value, () => {
|
|
368
|
-
removeFocusout(onFocusout)
|
|
369
|
-
removeClickOutside(clickOutsideProps)
|
|
370
|
-
removeEscapeKey(onEscapeKey)
|
|
371
|
-
})
|
|
372
|
-
|
|
373
|
-
conditionalHandler(!hiding, () => {
|
|
374
|
-
refocusTarget = null
|
|
375
|
-
})
|
|
210
|
+
const handleHide = (e: AnchorEvent) => {
|
|
211
|
+
emit('hide', e)
|
|
376
212
|
}
|
|
377
213
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
localScrollTarget.value = getScrollTarget(
|
|
381
|
-
anchorEl.value as HTMLElement,
|
|
382
|
-
props.scrollTarget
|
|
383
|
-
)
|
|
384
|
-
changeScrollEvent(
|
|
385
|
-
(localScrollTarget as Ref<any>).value,
|
|
386
|
-
updatePosition
|
|
387
|
-
)
|
|
388
|
-
}
|
|
214
|
+
const handleEscape = () => {
|
|
215
|
+
emit('escapekey')
|
|
389
216
|
}
|
|
390
217
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
conditionalHandler(
|
|
394
|
-
handlesFocus.value === true &&
|
|
395
|
-
props.noFocus !== true &&
|
|
396
|
-
childHasFocus(
|
|
397
|
-
innerRef.value as HTMLElement,
|
|
398
|
-
evt.target as Node
|
|
399
|
-
) !== true,
|
|
400
|
-
focus
|
|
401
|
-
)
|
|
218
|
+
const handleCloseClick = () => {
|
|
219
|
+
emit('update:model-value', false)
|
|
402
220
|
}
|
|
403
221
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
if (!props.disableCloseByEsc) {
|
|
407
|
-
hide(evt)
|
|
408
|
-
}
|
|
222
|
+
const updateModelValue = (val: boolean) => {
|
|
223
|
+
emit('update:model-value', val)
|
|
409
224
|
}
|
|
410
225
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
maxHeight: props.maxHeight,
|
|
427
|
-
maxWidth: props.maxWidth
|
|
428
|
-
})
|
|
429
|
-
}
|
|
226
|
+
const {
|
|
227
|
+
draggable,
|
|
228
|
+
additionalInfo,
|
|
229
|
+
title,
|
|
230
|
+
subtitle,
|
|
231
|
+
withCloseButton,
|
|
232
|
+
height,
|
|
233
|
+
width,
|
|
234
|
+
isEmpty,
|
|
235
|
+
emptyStateProps,
|
|
236
|
+
modelValue,
|
|
237
|
+
...menuProps
|
|
238
|
+
} = props
|
|
239
|
+
|
|
240
|
+
const modelV = toRef(props, 'modelValue')
|
|
430
241
|
|
|
431
242
|
function movePopup(x: number, y: number) {
|
|
432
|
-
const el =
|
|
243
|
+
const el = menuRef.value
|
|
433
244
|
|
|
434
|
-
if (el === null
|
|
245
|
+
if (el === null) {
|
|
435
246
|
return
|
|
436
247
|
}
|
|
437
248
|
|
|
438
249
|
setForcedPosition(
|
|
439
250
|
{
|
|
440
|
-
el,
|
|
251
|
+
el: (proxy.$refs.menuRef as any).innerRef,
|
|
441
252
|
offset: props.offset as number[],
|
|
442
|
-
anchorEl: anchorEl
|
|
443
|
-
anchorOrigin: anchorOrigin
|
|
444
|
-
selfOrigin: selfOrigin
|
|
253
|
+
anchorEl: (proxy as any).anchorEl as HTMLElement,
|
|
254
|
+
anchorOrigin: (proxy as any).anchorOrigin,
|
|
255
|
+
selfOrigin: (proxy as any).selfOrigin
|
|
445
256
|
},
|
|
446
257
|
{
|
|
447
258
|
top: y,
|
|
@@ -450,64 +261,31 @@ export default defineComponent({
|
|
|
450
261
|
)
|
|
451
262
|
}
|
|
452
263
|
|
|
453
|
-
function handleCloseClick(e: Event) {
|
|
454
|
-
if (!props.preventHide) {
|
|
455
|
-
hide(e as AnchorEvent)
|
|
456
|
-
}
|
|
457
|
-
proxy.$emit('close-button-click', e)
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
onBeforeUnmount(anchorCleanup as any)
|
|
461
|
-
|
|
462
|
-
// expose public methods
|
|
463
|
-
Object.assign(proxy, { focus, updatePosition })
|
|
464
|
-
|
|
465
264
|
return {
|
|
265
|
+
menuProps,
|
|
266
|
+
modelV,
|
|
267
|
+
handleCloseClick,
|
|
466
268
|
uuid: (attrs.id as string)?.length
|
|
467
269
|
? (attrs.id as string)
|
|
468
270
|
: `dl-popup-${v4()}`,
|
|
469
|
-
portalIsAccessible,
|
|
470
|
-
anchorEl,
|
|
471
|
-
showing,
|
|
472
|
-
handleCloseClick,
|
|
473
271
|
hasCloseButtonSlot,
|
|
474
272
|
hasFooterSlot,
|
|
475
273
|
movePopup,
|
|
476
274
|
hasHeaderSlot,
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
transitionStyle.value,
|
|
486
|
-
stylesFromProps.value
|
|
487
|
-
] as any
|
|
275
|
+
menuRef,
|
|
276
|
+
handleClick,
|
|
277
|
+
handleEscape,
|
|
278
|
+
handleBeforeShow,
|
|
279
|
+
handleBeforeHide,
|
|
280
|
+
handleShow,
|
|
281
|
+
handleHide,
|
|
282
|
+
updateModelValue
|
|
488
283
|
}
|
|
489
284
|
}
|
|
490
285
|
})
|
|
491
286
|
</script>
|
|
492
287
|
|
|
493
288
|
<style lang="scss" scoped>
|
|
494
|
-
.dl-popup {
|
|
495
|
-
z-index: var(--popup-z-index);
|
|
496
|
-
position: fixed !important;
|
|
497
|
-
padding: var(--dl-popup-padding, 10px 0 16px 0);
|
|
498
|
-
border: 1px solid var(--dl-color-separator);
|
|
499
|
-
display: flex;
|
|
500
|
-
background-color: var(--dl-color-panel-background);
|
|
501
|
-
flex-direction: column;
|
|
502
|
-
max-width: var(--popup-max-width);
|
|
503
|
-
max-height: var(--popup-max-height);
|
|
504
|
-
width: var(--popup-width);
|
|
505
|
-
height: var(--popup-height);
|
|
506
|
-
/* TODO: Change to variable */
|
|
507
|
-
box-shadow: 0px 3px 6px rgba(16, 30, 115, 0.15);
|
|
508
|
-
border-radius: 2px;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
289
|
.popup-dialog-upper {
|
|
512
290
|
opacity: 0;
|
|
513
291
|
position: absolute;
|
|
@@ -518,32 +296,17 @@ export default defineComponent({
|
|
|
518
296
|
opacity: 1;
|
|
519
297
|
}
|
|
520
298
|
|
|
299
|
+
.popup-header {
|
|
300
|
+
padding: var(--dl-popup-padding, 10px 0 16px 0);
|
|
301
|
+
}
|
|
302
|
+
|
|
521
303
|
.popup-content {
|
|
522
304
|
max-width: 100%;
|
|
523
|
-
padding:
|
|
305
|
+
padding: var(--dl-popup-padding, 16px 16px);
|
|
524
306
|
height: 100%;
|
|
525
307
|
}
|
|
526
308
|
|
|
527
309
|
.popup-footer {
|
|
528
|
-
padding: 20px 16px
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
// Fade Related transition
|
|
532
|
-
.fade-enter,
|
|
533
|
-
.fade-enter-active {
|
|
534
|
-
animation: fade-in var(--dl-transition-duration);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
.fade-leave-active,
|
|
538
|
-
.fade-leave-to {
|
|
539
|
-
animation: fade-in var(--dl-transition-duration) reverse;
|
|
540
|
-
}
|
|
541
|
-
@keyframes fade-in {
|
|
542
|
-
0% {
|
|
543
|
-
opacity: 0;
|
|
544
|
-
}
|
|
545
|
-
100% {
|
|
546
|
-
opacity: 1;
|
|
547
|
-
}
|
|
310
|
+
padding: var(--dl-popup-padding, 20px 16px 16px);
|
|
548
311
|
}
|
|
549
312
|
</style>
|