@dataloop-ai/components 0.16.44 → 0.16.46
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 +2 -2
- package/package.json +10 -9
- package/src/App.vue +116 -57
- package/src/assets/globals.scss +2 -0
- package/src/components/basic/DlAlert/DlAlert.vue +1 -1
- package/src/components/basic/DlButton/DlButton.vue +22 -10
- package/src/components/basic/DlCard/DlCard.vue +217 -0
- package/src/components/basic/DlCard/index.ts +3 -0
- package/src/components/basic/DlCard/types.ts +20 -0
- package/src/components/basic/DlChip/DlChip.vue +1 -0
- package/src/components/basic/DlEllipsis/DlEllipsis.vue +90 -0
- package/src/components/basic/DlEllipsis/index.ts +2 -0
- package/src/components/basic/DlListItem/DlListItem.vue +11 -5
- package/src/components/basic/index.ts +2 -0
- package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +8 -1
- package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +22 -6
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +526 -0
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/index.ts +2 -0
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +96 -0
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +2 -2
- package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +22 -6
- package/src/components/compound/DlCharts/charts/index.ts +1 -0
- package/src/components/compound/DlCharts/components/DlBrush.vue +8 -1
- package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +34 -21
- package/src/components/compound/DlCharts/types/DlConfusionMatrix.types.ts +19 -0
- package/src/components/compound/DlCharts/types/index.ts +2 -1
- package/src/components/compound/DlCharts/types/props.ts +14 -0
- package/src/components/compound/DlDialogBox/DlDialogBox.vue +1 -1
- package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -0
- package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +58 -12
- package/src/components/compound/DlInput/DlInput.vue +45 -23
- package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +13 -29
- package/src/components/compound/DlPagination/DlPagination.vue +14 -4
- package/src/components/compound/DlPagination/components/PageNavigation.vue +24 -25
- package/src/components/compound/DlPagination/components/PaginationLegend.vue +2 -1
- package/src/components/compound/DlPagination/components/QuickNavigation.vue +1 -0
- package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +86 -49
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +20 -13
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +43 -4
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +1 -55
- package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +42 -10
- package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +107 -0
- package/src/components/compound/DlSelect/DlSelect.vue +41 -8
- package/src/components/compound/DlTable/DlTable.vue +13 -10
- package/src/components/compound/DlTable/styles/dl-table-styles.scss +16 -4
- package/src/components/compound/DlToggleButton/DlToggleButton.vue +109 -0
- package/src/components/compound/DlToggleButton/config.ts +27 -0
- package/src/components/compound/DlToggleButton/index.ts +3 -0
- package/src/components/compound/DlToggleButton/types.ts +4 -0
- package/src/components/compound/index.ts +1 -0
- package/src/components/compound/types.ts +1 -0
- package/src/components/essential/DlColorPicker/DlColorPicker.vue +4 -1
- package/src/components/essential/DlColorPicker/components/DlColors.vue +2 -6
- package/src/components/essential/DlIcon/DlIcon.vue +5 -1
- package/src/components/essential/DlMenu/DlMenu.vue +30 -2
- package/src/components/essential/DlSeparator/DlSeparator.vue +62 -0
- package/src/components/essential/DlSeparator/index.ts +2 -0
- package/src/components/essential/DlSpinner/DlSpinner.vue +53 -217
- package/src/components/essential/DlSpinner/components/DlSpinnerCircle.vue +44 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerClock.vue +79 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerDots.vue +113 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerGrid.vue +166 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerLogo.vue +152 -0
- package/src/components/essential/DlSpinner/index.ts +14 -1
- package/src/components/essential/DlSpinner/styles/spinnerStyles.scss +111 -0
- package/src/components/essential/DlSpinner/types.ts +7 -0
- package/src/components/essential/index.ts +1 -0
- package/src/components/essential/types.ts +1 -0
- package/src/components/shared/DlItemSection/DlItemSection.vue +21 -15
- package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +36 -21
- package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +8 -10
- package/src/{demo → demos}/DlButtonDemo.vue +36 -1
- package/src/demos/DlCardDemo.vue +47 -0
- package/src/{demo → demos}/DlColorPickerDemo.vue +16 -1
- package/src/demos/DlConfusionMatrixDemo.vue +53 -0
- package/src/{demo → demos}/DlDialogBoxDemo.vue +4 -1
- package/src/demos/DlDropdownButtonDemo.vue +386 -0
- package/src/demos/DlEllipsisDemo.vue +30 -0
- package/src/{demo → demos}/DlLineChartDemo.vue +8 -8
- package/src/{demo → demos}/DlMenuDemo.vue +61 -2
- package/src/{demo → demos}/DlSearchDemo.vue +3 -2
- package/src/demos/DlSeparatorDemo.vue +44 -0
- package/src/demos/DlSpinnerDemo.vue +59 -0
- package/src/{demo → demos}/DlTableDemo.vue +117 -29
- package/src/demos/DlToggleButtonDemo.vue +57 -0
- package/src/{demo → demos}/DlTooltipDemo.vue +43 -2
- package/src/{demo → demos}/DlWidgetDemo.vue +34 -19
- package/src/{demo → demos}/SmartSearchDemo/DlSmartSearchDemo.vue +2 -50
- package/src/{demo → demos}/index.ts +14 -56
- package/src/hooks/use-arrow-navigation.ts +58 -0
- package/src/hooks/use-suggestions.ts +97 -74
- package/src/utils/colors.ts +1 -1
- package/src/utils/draggable-table.ts +2 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/parse-smart-query.ts +87 -0
- package/src/components/compound/DlCharts/types.ts +0 -1
- package/src/demo/DlDropdownButtonDemo.vue +0 -260
- package/src/demo/DlSpinnerDemo.vue +0 -20
- /package/src/{demo → demos}/BarChartDemo.vue +0 -0
- /package/src/{demo → demos}/ColumnChartDemo.vue +0 -0
- /package/src/{demo → demos}/DlAccordionDemo.vue +0 -0
- /package/src/{demo → demos}/DlAlertDemo.vue +0 -0
- /package/src/{demo → demos}/DlAvatarDemo.vue +0 -0
- /package/src/{demo → demos}/DlBadgeDemo.vue +0 -0
- /package/src/{demo → demos}/DlChartDoughnutDemo.vue +0 -0
- /package/src/{demo → demos}/DlCheckboxDemo.vue +0 -0
- /package/src/{demo → demos}/DlChipDemo.vue +0 -0
- /package/src/{demo → demos}/DlCounterDemo.vue +0 -0
- /package/src/{demo → demos}/DlDateTimeRangeDemo.vue +0 -0
- /package/src/{demo → demos}/DlIconDemo.vue +0 -0
- /package/src/{demo → demos}/DlInputDemo.vue +0 -0
- /package/src/{demo → demos}/DlKpiDemo.vue +0 -0
- /package/src/{demo → demos}/DlLinkDemo.vue +0 -0
- /package/src/{demo → demos}/DlListDemo.vue +0 -0
- /package/src/{demo → demos}/DlOptionGroupDemo.vue +0 -0
- /package/src/{demo → demos}/DlPaginationDemo.vue +0 -0
- /package/src/{demo → demos}/DlPanelContainerDemo.vue +0 -0
- /package/src/{demo → demos}/DlPopupDemo.vue +0 -0
- /package/src/{demo → demos}/DlProgressBarDemo.vue +0 -0
- /package/src/{demo → demos}/DlProgressChartDemo.vue +0 -0
- /package/src/{demo → demos}/DlRadioDemo.vue +0 -0
- /package/src/{demo → demos}/DlRangeDemo.vue +0 -0
- /package/src/{demo → demos}/DlSelectDemo.vue +0 -0
- /package/src/{demo → demos}/DlSkeletonDemo.vue +0 -0
- /package/src/{demo → demos}/DlSliderDemo.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/CenteredStepperInDialogBox.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/DlStepperDemo.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/SimpleStepper.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/StepperInDialogBox.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/index.ts +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/AssignmentsStep.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/DataStep.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/GeneralStep.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/InstructionStep.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/QualityStep.vue +0 -0
- /package/src/{demo → demos}/DlSwitchDemo.vue +0 -0
- /package/src/{demo → demos}/DlTabsDemo.vue +0 -0
- /package/src/{demo → demos}/DlTdDemo.vue +0 -0
- /package/src/{demo → demos}/DlTextAreaDemo.vue +0 -0
- /package/src/{demo → demos}/DlTextHolderDemo.vue +0 -0
- /package/src/{demo → demos}/DlThDemo.vue +0 -0
- /package/src/{demo → demos}/DlToastDemo.vue +0 -0
- /package/src/{demo → demos}/DlTrDemo.vue +0 -0
- /package/src/{demo → demos}/DlTrendDemo.vue +0 -0
- /package/src/{demo → demos}/DlTypographyDemo.vue +0 -0
- /package/src/{demo → demos}/SmartSearchDemo/schema.ts +0 -0
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
export * from './highlightSyntax'
|
|
2
|
+
export * from './utils'
|
|
2
3
|
|
|
3
|
-
import { dateIntervalPattern } from '../../../../../hooks/use-suggestions'
|
|
4
4
|
import { DateInterval } from '../../../DlDateTime/types'
|
|
5
5
|
|
|
6
|
+
const startDatePattern = new RegExp(
|
|
7
|
+
/\(from\s?\d{2}\/\d{2}\/\d{4}\s?\)|\(from\s?dd\/mm\/yyyy\s?\)/,
|
|
8
|
+
'gi'
|
|
9
|
+
)
|
|
10
|
+
const endDatePattern = new RegExp(
|
|
11
|
+
/\(to\s?\d{2}\/\d{2}\/\d{4}\s?\)|\(to\s?dd\/mm\/yyyy\s?\)/,
|
|
12
|
+
'gi'
|
|
13
|
+
)
|
|
14
|
+
const dateIntervalPattern = new RegExp(
|
|
15
|
+
/\((from\s?\(\d{2}\/\d{2}\/\d{4}\)\s?to\s?\(\d{2}\/\d{2}\/\d{4}\))\)|\((from\s?\(dd\/mm\/yyyy\)\s?to\s?\(dd\/mm\/yyyy\))\)/,
|
|
16
|
+
'gi'
|
|
17
|
+
)
|
|
18
|
+
|
|
6
19
|
export const isEndOfString = (str: string, pattern: RegExp): boolean => {
|
|
7
20
|
const trimmed = str.trim()
|
|
8
21
|
const matches = trimmed.match(pattern)
|
|
@@ -13,8 +26,13 @@ export const isEndOfString = (str: string, pattern: RegExp): boolean => {
|
|
|
13
26
|
return trimmed.lastIndexOf(lastMatch) + lastMatch.length === trimmed.length
|
|
14
27
|
}
|
|
15
28
|
|
|
16
|
-
export const isEndingWithDateIntervalPattern = (str: string) =>
|
|
17
|
-
|
|
29
|
+
export const isEndingWithDateIntervalPattern = (str: string) => {
|
|
30
|
+
return (
|
|
31
|
+
isEndOfString(str, dateIntervalPattern) ||
|
|
32
|
+
isEndOfString(str, startDatePattern) ||
|
|
33
|
+
isEndOfString(str, endDatePattern)
|
|
34
|
+
)
|
|
35
|
+
}
|
|
18
36
|
|
|
19
37
|
export const replaceDateInterval = (
|
|
20
38
|
str: string,
|
|
@@ -22,24 +40,38 @@ export const replaceDateInterval = (
|
|
|
22
40
|
) => {
|
|
23
41
|
const dateFrom = new Date(dateInterval.from)
|
|
24
42
|
const dateTo = new Date(dateInterval.to)
|
|
43
|
+
const values = str.match(/\((.*?)\)/g)
|
|
44
|
+
let newStr = ''
|
|
45
|
+
if (!values) return str
|
|
25
46
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
if (values.length > 1) {
|
|
48
|
+
newStr = `(From (${formatDate(dateFrom)}) To (${formatDate(dateTo)}))`
|
|
49
|
+
return replaceLastOccurrence(str, newStr, dateIntervalPattern)
|
|
50
|
+
} else if (values[0].includes('From')) {
|
|
51
|
+
newStr = `(From ${formatDate(dateFrom)})`
|
|
52
|
+
return replaceLastOccurrence(str, newStr, startDatePattern)
|
|
53
|
+
} else if (values[0].includes('To')) {
|
|
54
|
+
newStr = `(To ${formatDate(dateTo)})`
|
|
55
|
+
return replaceLastOccurrence(str, newStr, endDatePattern)
|
|
56
|
+
}
|
|
29
57
|
}
|
|
30
58
|
|
|
31
59
|
const formatDate = (date: Date): string => {
|
|
32
|
-
return
|
|
60
|
+
return `${addZero(date.getDate())}/${addZero(
|
|
33
61
|
date.getMonth() + 1
|
|
34
|
-
)}/${date.getFullYear()}
|
|
62
|
+
)}/${date.getFullYear()}`
|
|
35
63
|
}
|
|
36
64
|
|
|
37
65
|
const addZero = (value: number): string => {
|
|
38
66
|
return value < 10 ? `0${value}` : value.toString()
|
|
39
67
|
}
|
|
40
68
|
|
|
41
|
-
const replaceLastOccurrence = (
|
|
42
|
-
|
|
69
|
+
const replaceLastOccurrence = (
|
|
70
|
+
string: string,
|
|
71
|
+
replaceValue: string,
|
|
72
|
+
pattern: RegExp
|
|
73
|
+
) => {
|
|
74
|
+
const matches = string.match(pattern)
|
|
43
75
|
|
|
44
76
|
return matches && matches.length
|
|
45
77
|
? string.replace(matches[matches.length - 1], replaceValue)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ColorSchema, SyntaxColorSchema } from '../types'
|
|
2
|
+
import {
|
|
3
|
+
operators,
|
|
4
|
+
Alias,
|
|
5
|
+
startDatePattern,
|
|
6
|
+
endDatePattern,
|
|
7
|
+
dateIntervalPattern
|
|
8
|
+
} from '../../../../../hooks/use-suggestions'
|
|
9
|
+
|
|
10
|
+
export function replaceWithJsDates(str: string) {
|
|
11
|
+
const intervals = str.match(dateIntervalPattern)
|
|
12
|
+
const starts = str.match(startDatePattern)
|
|
13
|
+
const ends = str.match(endDatePattern)
|
|
14
|
+
|
|
15
|
+
intervals?.forEach((interval) => {
|
|
16
|
+
str = str.replaceAll(interval, formatToDateObj(interval))
|
|
17
|
+
})
|
|
18
|
+
starts?.forEach((start) => {
|
|
19
|
+
str = str.replaceAll(start, formatToDateObj(start))
|
|
20
|
+
})
|
|
21
|
+
ends?.forEach((end) => {
|
|
22
|
+
str = str.replaceAll(end, formatToDateObj(end))
|
|
23
|
+
})
|
|
24
|
+
return str
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function formatToDateObj(str: string) {
|
|
28
|
+
const [day, month, year] = str.split(' ')[1].split('/')
|
|
29
|
+
const date = new Date(parseInt(year), parseInt(month), parseInt(day))
|
|
30
|
+
if (!isValidDate(date)) return str
|
|
31
|
+
const [toDay, toMonth, toYear] = str.split(' ')[3]?.split('/') || []
|
|
32
|
+
const toDate = new Date(
|
|
33
|
+
parseInt(toYear),
|
|
34
|
+
parseInt(toMonth),
|
|
35
|
+
parseInt(toDay)
|
|
36
|
+
)
|
|
37
|
+
if (!isValidDate(toDate)) return date.toISOString()
|
|
38
|
+
return JSON.stringify({
|
|
39
|
+
from: date.toISOString(),
|
|
40
|
+
to: toDate.toISOString()
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isValidDate(d: Date) {
|
|
45
|
+
return d instanceof Date && !isNaN(d as any)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function replaceAliases(json: string, aliases: Alias[]) {
|
|
49
|
+
let newJson = json
|
|
50
|
+
aliases.forEach((alias) => {
|
|
51
|
+
newJson = newJson.replaceAll(alias.alias, alias.key)
|
|
52
|
+
})
|
|
53
|
+
return newJson
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function createColorSchema(
|
|
57
|
+
colorSchema: ColorSchema,
|
|
58
|
+
aliases: Alias[]
|
|
59
|
+
): SyntaxColorSchema {
|
|
60
|
+
const thisFields = []
|
|
61
|
+
for (const key in aliases) {
|
|
62
|
+
thisFields.push(aliases[key].alias)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const thisOperators = []
|
|
66
|
+
for (const key in operators) {
|
|
67
|
+
thisOperators.push(operators[key])
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
fields: {
|
|
72
|
+
values: thisFields,
|
|
73
|
+
color: colorSchema.fields
|
|
74
|
+
},
|
|
75
|
+
operators: {
|
|
76
|
+
values: thisOperators,
|
|
77
|
+
color: colorSchema.operators
|
|
78
|
+
},
|
|
79
|
+
keywords: {
|
|
80
|
+
values: ['OR', 'AND'],
|
|
81
|
+
color: colorSchema.keywords
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const isEligibleToChange = (target: HTMLElement, expanded: boolean) => {
|
|
87
|
+
let childOffsetRight = 0
|
|
88
|
+
let childOffsetBottom = 20
|
|
89
|
+
|
|
90
|
+
if (target?.lastChild) {
|
|
91
|
+
const range = document.createRange()
|
|
92
|
+
range.selectNode(target?.lastChild)
|
|
93
|
+
childOffsetRight =
|
|
94
|
+
range.getBoundingClientRect().right -
|
|
95
|
+
target.getBoundingClientRect().left
|
|
96
|
+
childOffsetBottom =
|
|
97
|
+
range.getBoundingClientRect().bottom -
|
|
98
|
+
target.getBoundingClientRect().top +
|
|
99
|
+
5
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (childOffsetRight <= target.clientWidth) {
|
|
103
|
+
return [-childOffsetRight, 5]
|
|
104
|
+
} else {
|
|
105
|
+
return [-target.clientWidth, 5]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
</div>
|
|
47
47
|
<div
|
|
48
48
|
class="select-wrapper"
|
|
49
|
+
tabindex="0"
|
|
49
50
|
:style="placeholderStyles"
|
|
50
51
|
>
|
|
51
52
|
<div
|
|
@@ -142,8 +143,11 @@
|
|
|
142
143
|
:offset="[0, 3]"
|
|
143
144
|
style="border-radius: 0"
|
|
144
145
|
:disabled="disabled || readonly"
|
|
146
|
+
:arrow-nav-items="options"
|
|
145
147
|
@show="onMenuOpen"
|
|
146
148
|
@hide="closeMenu"
|
|
149
|
+
@highlightedIndex="setHighlightedIndex"
|
|
150
|
+
@handleSelectedItem="handleSelectedItem"
|
|
147
151
|
>
|
|
148
152
|
<dl-list
|
|
149
153
|
class="select-list"
|
|
@@ -183,7 +187,7 @@
|
|
|
183
187
|
</template>
|
|
184
188
|
</dl-select-option>
|
|
185
189
|
<dl-select-option
|
|
186
|
-
v-for="option in options"
|
|
190
|
+
v-for="(option, optionIndex) in options"
|
|
187
191
|
:key="getKeyForOption(option)"
|
|
188
192
|
clickable
|
|
189
193
|
:multiselect="multiselect"
|
|
@@ -191,6 +195,11 @@
|
|
|
191
195
|
selected:
|
|
192
196
|
option === selectedOption && highlightSelected
|
|
193
197
|
}"
|
|
198
|
+
:style="
|
|
199
|
+
optionIndex === highlightedIndex
|
|
200
|
+
? 'background-color: var(--dl-color-fill)'
|
|
201
|
+
: ''
|
|
202
|
+
"
|
|
194
203
|
:with-wave="withWave"
|
|
195
204
|
:model-value="modelValue"
|
|
196
205
|
:value="getOptionValue(option)"
|
|
@@ -251,7 +260,7 @@ import { InputSizes, TInputSizes } from '../../../utils/input-sizes'
|
|
|
251
260
|
import { DlListItem } from '../../basic'
|
|
252
261
|
import { DlTooltip, DlList, DlIcon, DlMenu } from '../../essential'
|
|
253
262
|
import { DlInfoErrorMessage, DlItemSection } from '../../shared'
|
|
254
|
-
import { defineComponent, isVue2, PropType } from 'vue-demi'
|
|
263
|
+
import { defineComponent, isVue2, PropType, ref } from 'vue-demi'
|
|
255
264
|
import {
|
|
256
265
|
getLabel,
|
|
257
266
|
getIconSize,
|
|
@@ -337,11 +346,39 @@ export default defineComponent({
|
|
|
337
346
|
'selected',
|
|
338
347
|
'deselected'
|
|
339
348
|
],
|
|
349
|
+
setup(props, { emit }) {
|
|
350
|
+
const isExpanded = ref(false)
|
|
351
|
+
const selectedIndex = ref(-1)
|
|
352
|
+
const highlightedIndex = ref(-1)
|
|
353
|
+
|
|
354
|
+
const setHighlightedIndex = (value: any) => {
|
|
355
|
+
highlightedIndex.value = value
|
|
356
|
+
}
|
|
357
|
+
const handleModelValueUpdate = (val: any) => {
|
|
358
|
+
emit('update:model-value', val)
|
|
359
|
+
emit('change', val)
|
|
360
|
+
}
|
|
361
|
+
const handleSelectedItem = (value: any) => {
|
|
362
|
+
selectedIndex.value = props.options.findIndex(
|
|
363
|
+
(option: string | Record<string, string | number> | number) =>
|
|
364
|
+
isEqual(option as any, value)
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
handleModelValueUpdate(value)
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return {
|
|
371
|
+
isExpanded,
|
|
372
|
+
highlightedIndex,
|
|
373
|
+
selectedIndex,
|
|
374
|
+
setHighlightedIndex,
|
|
375
|
+
handleSelectedItem,
|
|
376
|
+
handleModelValueUpdate
|
|
377
|
+
}
|
|
378
|
+
},
|
|
340
379
|
data() {
|
|
341
380
|
return {
|
|
342
381
|
uuid: `dl-select-${v4()}`,
|
|
343
|
-
isExpanded: false,
|
|
344
|
-
selectedIndex: -1,
|
|
345
382
|
isEmpty: true
|
|
346
383
|
}
|
|
347
384
|
},
|
|
@@ -666,10 +703,6 @@ export default defineComponent({
|
|
|
666
703
|
this.selectedIndex = -1
|
|
667
704
|
this.closeMenu()
|
|
668
705
|
},
|
|
669
|
-
handleModelValueUpdate(val: any) {
|
|
670
|
-
this.$emit('update:model-value', val)
|
|
671
|
-
this.$emit('change', val)
|
|
672
|
-
},
|
|
673
706
|
selectOption(selected: any) {
|
|
674
707
|
if (this.multiselect) {
|
|
675
708
|
return
|
|
@@ -58,12 +58,13 @@
|
|
|
58
58
|
v-if="hasVirtScroll"
|
|
59
59
|
ref="virtScrollRef"
|
|
60
60
|
:class="tableClass"
|
|
61
|
+
:draggable-classes="additionalClasses"
|
|
61
62
|
:style="tableStyle"
|
|
62
63
|
:scroll-target="virtualScrollTarget"
|
|
63
64
|
:items="computedRows"
|
|
64
|
-
:on-virtual-scroll="onVScroll"
|
|
65
65
|
:table-colspan="computedColspan"
|
|
66
66
|
v-bind="virtProps"
|
|
67
|
+
@virtual-scroll="onVScroll"
|
|
67
68
|
>
|
|
68
69
|
<template #before>
|
|
69
70
|
<thead>
|
|
@@ -144,16 +145,18 @@
|
|
|
144
145
|
<DlTr
|
|
145
146
|
:key="getRowKey(props.item)"
|
|
146
147
|
:class="
|
|
147
|
-
isRowSelected(getRowKey(
|
|
148
|
+
isRowSelected(getRowKey(props.item))
|
|
148
149
|
? 'selected'
|
|
149
150
|
: hasAnyAction
|
|
150
151
|
? ' cursor-pointer'
|
|
151
152
|
: ''
|
|
152
153
|
"
|
|
153
154
|
:no-hover="noHover"
|
|
154
|
-
@click="onTrClick($event,
|
|
155
|
-
@dblclick="onTrDblClick($event,
|
|
156
|
-
@contextmenu="
|
|
155
|
+
@click="onTrClick($event, props.item, pageIndex)"
|
|
156
|
+
@dblclick="onTrDblClick($event, props.item, pageIndex)"
|
|
157
|
+
@contextmenu="
|
|
158
|
+
onTrContextMenu($event, props.item, pageIndex)
|
|
159
|
+
"
|
|
157
160
|
>
|
|
158
161
|
<td v-if="hasDraggableRows">
|
|
159
162
|
<dl-icon
|
|
@@ -302,7 +305,7 @@
|
|
|
302
305
|
</tr>
|
|
303
306
|
</slot>
|
|
304
307
|
</thead>
|
|
305
|
-
<tbody>
|
|
308
|
+
<tbody id="draggable">
|
|
306
309
|
<slot
|
|
307
310
|
name="top-row"
|
|
308
311
|
:cols="computedCols"
|
|
@@ -723,7 +726,7 @@ export default defineComponent({
|
|
|
723
726
|
|
|
724
727
|
onMounted(() => {
|
|
725
728
|
tableEl = (rootRef.value as HTMLDivElement).querySelector(
|
|
726
|
-
'.dl-table'
|
|
729
|
+
'table.dl-table'
|
|
727
730
|
) as HTMLTableElement
|
|
728
731
|
resizableManager = new ResizableManager()
|
|
729
732
|
|
|
@@ -753,7 +756,7 @@ export default defineComponent({
|
|
|
753
756
|
hasVirtScroll,
|
|
754
757
|
() => {
|
|
755
758
|
tableEl = (rootRef.value as HTMLDivElement).querySelector(
|
|
756
|
-
'.dl-table'
|
|
759
|
+
'table.dl-table'
|
|
757
760
|
) as HTMLTableElement
|
|
758
761
|
|
|
759
762
|
if (props.resizable) {
|
|
@@ -1049,8 +1052,8 @@ export default defineComponent({
|
|
|
1049
1052
|
acc[p] = (props as Record<string, any>)[p]
|
|
1050
1053
|
})
|
|
1051
1054
|
|
|
1052
|
-
if (acc.virtualScrollItemSize
|
|
1053
|
-
acc.virtualScrollItemSize = props.dense === true ?
|
|
1055
|
+
if (!acc.virtualScrollItemSize) {
|
|
1056
|
+
acc.virtualScrollItemSize = props.dense === true ? 30 : 40
|
|
1054
1057
|
}
|
|
1055
1058
|
|
|
1056
1059
|
return acc
|
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/* this is when the loading indicator appears */
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
&--loading {
|
|
25
|
+
thead tr:last-child th {
|
|
26
|
+
/* height of all previous header rows */
|
|
27
|
+
top: 38px;
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
th:first-child,
|
|
@@ -371,6 +373,7 @@
|
|
|
371
373
|
*/
|
|
372
374
|
|
|
373
375
|
.dl-table--dense {
|
|
376
|
+
|
|
374
377
|
.dl-table__top {
|
|
375
378
|
position: relative;
|
|
376
379
|
padding: 5px 16px;
|
|
@@ -385,6 +388,8 @@
|
|
|
385
388
|
font-size: 80%;
|
|
386
389
|
}
|
|
387
390
|
|
|
391
|
+
|
|
392
|
+
|
|
388
393
|
.dl-table {
|
|
389
394
|
|
|
390
395
|
th {
|
|
@@ -423,6 +428,13 @@
|
|
|
423
428
|
}
|
|
424
429
|
}
|
|
425
430
|
|
|
431
|
+
.dl-table--dense.dl-table--loading {
|
|
432
|
+
thead tr:last-child th {
|
|
433
|
+
/* height of all previous header rows */
|
|
434
|
+
top: 32px;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
426
438
|
/*
|
|
427
439
|
* Separators
|
|
428
440
|
*/
|
|
@@ -463,4 +475,4 @@
|
|
|
463
475
|
position: relative;
|
|
464
476
|
border-bottom: 1px solid var(--dl-color-separator);
|
|
465
477
|
}
|
|
466
|
-
}
|
|
478
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="{ width }"
|
|
4
|
+
class="container"
|
|
5
|
+
>
|
|
6
|
+
<dl-button
|
|
7
|
+
v-for="(btn, idx) in toggleButtons"
|
|
8
|
+
:key="idx"
|
|
9
|
+
:styles="
|
|
10
|
+
getStyles(btn.value === scopedValue, hoverBtn === btn.value)
|
|
11
|
+
"
|
|
12
|
+
data-test="button"
|
|
13
|
+
fluid
|
|
14
|
+
@mouseenter="hoverBtn = btn.value"
|
|
15
|
+
@mouseleave="hoverBtn = null"
|
|
16
|
+
@click="value = btn.value"
|
|
17
|
+
>
|
|
18
|
+
<span v-if="!$slots.button && !$slots[`button-${idx}`]">
|
|
19
|
+
{{ btn.label }}
|
|
20
|
+
</span>
|
|
21
|
+
<slot
|
|
22
|
+
:label="btn.label"
|
|
23
|
+
:name="`button-${idx}`"
|
|
24
|
+
/>
|
|
25
|
+
<slot
|
|
26
|
+
:label="btn.label"
|
|
27
|
+
name="button"
|
|
28
|
+
/>
|
|
29
|
+
</dl-button>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script lang="ts">
|
|
34
|
+
import { defineComponent } from 'vue-demi'
|
|
35
|
+
import { DlToggleButtonOption } from './types'
|
|
36
|
+
import { DlButton } from '../../basic'
|
|
37
|
+
import { ButtonsStyles } from './config'
|
|
38
|
+
|
|
39
|
+
export default defineComponent({
|
|
40
|
+
name: 'DlToggleButton',
|
|
41
|
+
components: { DlButton },
|
|
42
|
+
model: {
|
|
43
|
+
prop: 'modelValue',
|
|
44
|
+
event: 'update:model-value'
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
width: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: '100%'
|
|
50
|
+
},
|
|
51
|
+
modelValue: {
|
|
52
|
+
type: [String, Number],
|
|
53
|
+
default: null
|
|
54
|
+
},
|
|
55
|
+
options: {
|
|
56
|
+
type: Array as () => DlToggleButtonOption[],
|
|
57
|
+
required: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
emits: ['update:modelValue', 'change'],
|
|
61
|
+
data: () => ({
|
|
62
|
+
scopedValue: null as string | number,
|
|
63
|
+
hoverBtn: null as string | number
|
|
64
|
+
}),
|
|
65
|
+
computed: {
|
|
66
|
+
value: {
|
|
67
|
+
get() {
|
|
68
|
+
return this.modelValue
|
|
69
|
+
},
|
|
70
|
+
set(value: string | number) {
|
|
71
|
+
this.$emit('change', value)
|
|
72
|
+
let buttonValue
|
|
73
|
+
if (this.scopedValue !== value) {
|
|
74
|
+
buttonValue = value
|
|
75
|
+
} else {
|
|
76
|
+
buttonValue = null
|
|
77
|
+
}
|
|
78
|
+
this.scopedValue = buttonValue
|
|
79
|
+
this.$emit('update:modelValue', buttonValue)
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
toggleButtons() {
|
|
83
|
+
return this.options.slice(0, 3)
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
created() {
|
|
87
|
+
this.scopedValue = this.value
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
getStyles(activeBtn: boolean, hovered: boolean) {
|
|
91
|
+
if (activeBtn) {
|
|
92
|
+
return ButtonsStyles.activeStyles
|
|
93
|
+
} else if (hovered) {
|
|
94
|
+
return ButtonsStyles.hoverStyles
|
|
95
|
+
} else {
|
|
96
|
+
return ButtonsStyles.nonActiveStyles
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style lang="scss" scoped>
|
|
104
|
+
.container {
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
border-radius: 2px;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const generalStyles = {
|
|
2
|
+
padding: '7px 10px',
|
|
3
|
+
height: '28px',
|
|
4
|
+
fontSize: 'var(--dl-font-size-body)',
|
|
5
|
+
borderRadius: '0'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ButtonsStyles = Object.freeze({
|
|
9
|
+
nonActiveStyles: {
|
|
10
|
+
...generalStyles,
|
|
11
|
+
color: 'var(--dl-color-darker)',
|
|
12
|
+
borderColor: 'var(--dl-color-separator)',
|
|
13
|
+
background: 'var(--dl-color-bg)'
|
|
14
|
+
},
|
|
15
|
+
activeStyles: {
|
|
16
|
+
...generalStyles,
|
|
17
|
+
color: 'var(--dl-color-secondary)',
|
|
18
|
+
borderColor: 'var(--dl-color-secondary)',
|
|
19
|
+
background: 'var(--dl-color-secondary-opaque)'
|
|
20
|
+
},
|
|
21
|
+
hoverStyles: {
|
|
22
|
+
...generalStyles,
|
|
23
|
+
color: 'var(--dl-color-hover)',
|
|
24
|
+
borderColor: 'var(--dl-color-hover)',
|
|
25
|
+
background: 'var(--dl-color-bg)'
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -287,8 +287,9 @@ export default defineComponent({
|
|
|
287
287
|
.hu-color-picker {
|
|
288
288
|
width: 180px;
|
|
289
289
|
padding: 10px;
|
|
290
|
-
background: var(--dl-color-
|
|
290
|
+
background: var(--dl-color-panel-background);
|
|
291
291
|
border-radius: 2px;
|
|
292
|
+
border: 1px solid var(--dl-color-separator);
|
|
292
293
|
box-shadow: 0px 3px 6px 0px rgba(16, 30, 115, 0.15);
|
|
293
294
|
z-index: 1;
|
|
294
295
|
text-align: left;
|
|
@@ -301,6 +302,8 @@ export default defineComponent({
|
|
|
301
302
|
.color-show {
|
|
302
303
|
margin-top: 11px;
|
|
303
304
|
display: flex;
|
|
305
|
+
border: 1px solid var(--dl-color-separator);
|
|
306
|
+
overflow: hidden;
|
|
304
307
|
}
|
|
305
308
|
}
|
|
306
309
|
</style>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
/>
|
|
14
14
|
<div
|
|
15
15
|
:style="{ background: `${item}` }"
|
|
16
|
-
|
|
16
|
+
class="color"
|
|
17
17
|
/>
|
|
18
18
|
</li>
|
|
19
19
|
</ul>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
/>
|
|
34
34
|
<div
|
|
35
35
|
:style="{ background: `${item}` }"
|
|
36
|
-
|
|
36
|
+
class="color"
|
|
37
37
|
/>
|
|
38
38
|
</li>
|
|
39
39
|
</ul>
|
|
@@ -125,11 +125,7 @@ export default defineComponent({
|
|
|
125
125
|
position: absolute;
|
|
126
126
|
left: 0;
|
|
127
127
|
top: 0;
|
|
128
|
-
width: 100%;
|
|
129
|
-
height: 100%;
|
|
130
128
|
border-radius: 3px;
|
|
131
|
-
}
|
|
132
|
-
.color-white {
|
|
133
129
|
border: 1px solid var(--dl-color-separator);
|
|
134
130
|
width: calc(100% - 2px);
|
|
135
131
|
height: calc(100% - 2px);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div
|
|
3
3
|
v-if="!svg"
|
|
4
4
|
:id="uuid"
|
|
5
|
-
:style="inlineStyles"
|
|
5
|
+
:style="[inlineStyles, styles]"
|
|
6
6
|
@click="$emit('click', $event)"
|
|
7
7
|
>
|
|
8
8
|
<i
|
|
@@ -48,6 +48,10 @@ export default defineComponent({
|
|
|
48
48
|
type: String,
|
|
49
49
|
default: '12px'
|
|
50
50
|
},
|
|
51
|
+
styles: {
|
|
52
|
+
type: [Array, String, Object],
|
|
53
|
+
default: null
|
|
54
|
+
},
|
|
51
55
|
svg: {
|
|
52
56
|
type: Boolean,
|
|
53
57
|
default: false
|