design-system-next 2.15.0 → 2.15.2
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/dist/design-system-next.es.js +3880 -3863
- package/dist/design-system-next.es.js.gz +0 -0
- package/dist/design-system-next.umd.js +10 -10
- package/dist/design-system-next.umd.js.gz +0 -0
- package/dist/package.json.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/select/select-ladderized/select-ladderized.ts +1 -1
- package/src/components/select/select.ts +2 -2
- package/src/components/select/select.vue +50 -47
- package/src/components/table/table.ts +4 -0
- package/src/components/table/table.vue +8 -2
- package/src/components/table/use-table.ts +12 -5
|
Binary file
|
package/dist/package.json.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -83,7 +83,7 @@ export const selectPropTypes = {
|
|
|
83
83
|
validator: (value: (typeof TRIGGER_EVENTS)[number][]) => {
|
|
84
84
|
return value.every((val) => TRIGGER_EVENTS.includes(val));
|
|
85
85
|
},
|
|
86
|
-
default: () => [
|
|
86
|
+
default: () => [],
|
|
87
87
|
},
|
|
88
88
|
popperTriggers: {
|
|
89
89
|
type: Array as PropType<(typeof TRIGGER_EVENTS)[number][]>,
|
|
@@ -94,7 +94,7 @@ export const selectPropTypes = {
|
|
|
94
94
|
},
|
|
95
95
|
autoHide: {
|
|
96
96
|
type: Boolean,
|
|
97
|
-
default:
|
|
97
|
+
default: false,
|
|
98
98
|
},
|
|
99
99
|
popperStrategy: {
|
|
100
100
|
type: String,
|
|
@@ -27,53 +27,56 @@
|
|
|
27
27
|
}"
|
|
28
28
|
>
|
|
29
29
|
<div ref="selectRef">
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
30
|
+
<div @click="!props.searchable? selectPopperState = !selectPopperState: null">
|
|
31
|
+
<spr-input
|
|
32
|
+
:id="`input-${props.id}`"
|
|
33
|
+
v-model="inputText"
|
|
34
|
+
:class="{
|
|
35
|
+
'spr-cursor-pointer': !props.searchable,
|
|
36
|
+
}"
|
|
37
|
+
:placeholder="props.placeholder"
|
|
38
|
+
autocomplete="off"
|
|
39
|
+
:helper-text="props.helperText"
|
|
40
|
+
:helper-icon="props.helperIcon"
|
|
41
|
+
:display-helper="props.displayHelper"
|
|
42
|
+
:active="props.active"
|
|
43
|
+
:readonly="!props.searchable"
|
|
44
|
+
:disabled="props.disabled"
|
|
45
|
+
:error="props.error"
|
|
46
|
+
@keyup="handleSearch"
|
|
47
|
+
@click="props.searchable ? selectPopperState = true : null"
|
|
48
|
+
>
|
|
49
|
+
<template #icon>
|
|
50
|
+
<div class="spr-flex spr-cursor-pointer spr-items-center">
|
|
51
|
+
<Icon
|
|
52
|
+
v-if="props.clearable && inputText"
|
|
53
|
+
class="spr-cursor-pointer"
|
|
54
|
+
icon="ph:x"
|
|
55
|
+
@click.stop="handleClear"
|
|
56
|
+
/>
|
|
57
|
+
<Icon icon="ph:caret-down" />
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<template #helperMessage>
|
|
62
|
+
<slot name="helperMessage" />
|
|
63
|
+
</template>
|
|
64
|
+
</spr-input>
|
|
65
|
+
|
|
66
|
+
<!-- Hidden Select for QA automation -->
|
|
67
|
+
<select
|
|
68
|
+
v-if="selectOptions && selectOptions.length"
|
|
69
|
+
:value="Array.isArray(selectModel) ? selectModel[0] : selectModel"
|
|
70
|
+
data-testid="qa-hidden-select"
|
|
71
|
+
tabindex="-1"
|
|
72
|
+
aria-hidden="true"
|
|
73
|
+
hidden
|
|
74
|
+
>
|
|
75
|
+
<option v-for="item in selectOptions" :key="item.value" :value="item.value">
|
|
76
|
+
{{ item.text }}
|
|
77
|
+
</option>
|
|
78
|
+
</select>
|
|
79
|
+
</div>
|
|
77
80
|
|
|
78
81
|
<!-- This div used to poppulate popper menu -->
|
|
79
82
|
<div
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
</template>
|
|
205
205
|
|
|
206
206
|
<script lang="ts" setup>
|
|
207
|
-
import { useSlots,
|
|
207
|
+
import { useSlots, ref, watch } from 'vue';
|
|
208
208
|
import { Icon } from '@iconify/vue';
|
|
209
209
|
import SprAvatar from '@/components/avatar/avatar.vue';
|
|
210
210
|
import SprEmptyState from '@/components/empty-state/empty-state.vue';
|
|
@@ -224,7 +224,7 @@ const props = defineProps(tablePropTypes);
|
|
|
224
224
|
const emit = defineEmits(tableEmitTypes);
|
|
225
225
|
const slots = useSlots();
|
|
226
226
|
|
|
227
|
-
const sortableTBody =
|
|
227
|
+
const sortableTBody = ref<HTMLElement | null>(null);
|
|
228
228
|
|
|
229
229
|
const {
|
|
230
230
|
getHeaderCount,
|
|
@@ -240,6 +240,7 @@ const {
|
|
|
240
240
|
dragOptions,
|
|
241
241
|
tableKey,
|
|
242
242
|
isDragging,
|
|
243
|
+
|
|
243
244
|
|
|
244
245
|
isRowSelected,
|
|
245
246
|
sortData,
|
|
@@ -250,10 +251,15 @@ const {
|
|
|
250
251
|
sortedDataItem,
|
|
251
252
|
getSortIcon,
|
|
252
253
|
getRowKey,
|
|
254
|
+
clearSelectedData
|
|
253
255
|
} = useTable(props, emit, slots);
|
|
254
256
|
|
|
255
257
|
const { reinitializeSortable } = useDraggableTableRows(sortableTBody, dragOptions);
|
|
256
258
|
|
|
259
|
+
defineExpose({
|
|
260
|
+
clearSelectedData
|
|
261
|
+
});
|
|
262
|
+
|
|
257
263
|
watch(tableKey, () => {
|
|
258
264
|
reinitializeSortable();
|
|
259
265
|
});
|
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
TABLE_SORT,
|
|
7
7
|
TableData,
|
|
8
8
|
TableDataProps,
|
|
9
|
-
Header,
|
|
9
|
+
Header,
|
|
10
10
|
SortableDragEvent,
|
|
11
11
|
} from './table';
|
|
12
12
|
import type { SetupContext } from 'vue';
|
|
@@ -263,7 +263,7 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
263
263
|
'spr-border-color-weak spr-border-x-0 spr-border-b spr-border-t-0 spr-border-solid',
|
|
264
264
|
);
|
|
265
265
|
|
|
266
|
-
const multiselectClass = classNames('spr-px-size-spacing-2xs spr-py-size-spacing-3xs spr-w-[44px]
|
|
266
|
+
const multiselectClass = classNames('spr-px-size-spacing-2xs spr-py-size-spacing-3xs spr-w-[44px]');
|
|
267
267
|
|
|
268
268
|
const emptyStateClasses = classNames(`${emptyStateBaseClasses} ${props.emptyStateCustomClasses}`);
|
|
269
269
|
const tableActionSlotClasses = classNames(`${defaultSlotClasses} ${props.tableActionSlotCustomClasses}`);
|
|
@@ -369,7 +369,7 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
369
369
|
watch(sortedData, (newVal) => {
|
|
370
370
|
tableData.value = [...newVal];
|
|
371
371
|
|
|
372
|
-
if (props.isMultiSelect && selectedData.value.length > 0) {
|
|
372
|
+
if (props.isMultiSelect && selectedData.value.length > 0 && !props.retainSelectionOnDataChange) {
|
|
373
373
|
// Remove items from selectedData that are not in the new sortedData
|
|
374
374
|
// This is to ensure that the selectedData is always in sync with the sortedData
|
|
375
375
|
|
|
@@ -392,12 +392,18 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
392
392
|
}
|
|
393
393
|
});
|
|
394
394
|
|
|
395
|
+
const clearSelectedData = () => {
|
|
396
|
+
selectedData.value = [];
|
|
397
|
+
}
|
|
398
|
+
|
|
395
399
|
watch(tableData, () => {
|
|
396
400
|
tableKey.value = tableKey.value + 1;
|
|
397
401
|
});
|
|
398
402
|
|
|
399
403
|
onMounted(() => {
|
|
400
|
-
|
|
404
|
+
if (sortedData.value.length > 0) {
|
|
405
|
+
tableData.value = [...sortedData.value];
|
|
406
|
+
}
|
|
401
407
|
});
|
|
402
408
|
|
|
403
409
|
return {
|
|
@@ -420,12 +426,13 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
420
426
|
sortedDataItem,
|
|
421
427
|
getSortIcon,
|
|
422
428
|
sortField,
|
|
423
|
-
allowSelfDrag,
|
|
429
|
+
allowSelfDrag,
|
|
424
430
|
tableData,
|
|
425
431
|
isDraggable,
|
|
426
432
|
dragOptions,
|
|
427
433
|
getRowKey,
|
|
428
434
|
isDragging: toRef(() => isDragging.value),
|
|
429
435
|
tableKey,
|
|
436
|
+
clearSelectedData
|
|
430
437
|
};
|
|
431
438
|
};
|