design-system-next 2.7.17 → 2.7.18
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.
|
Binary file
|
package/package.json
CHANGED
|
@@ -186,6 +186,8 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
186
186
|
} else {
|
|
187
187
|
selectedData.value.push(item);
|
|
188
188
|
}
|
|
189
|
+
|
|
190
|
+
emitSelectedData()
|
|
189
191
|
};
|
|
190
192
|
|
|
191
193
|
const handleSelectAll = () => {
|
|
@@ -194,6 +196,8 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
194
196
|
} else {
|
|
195
197
|
selectedData.value = [...sortedData.value];
|
|
196
198
|
}
|
|
199
|
+
|
|
200
|
+
emitSelectedData()
|
|
197
201
|
};
|
|
198
202
|
|
|
199
203
|
const isRowSelected = (item: TableData) => {
|
|
@@ -210,9 +214,7 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
210
214
|
});
|
|
211
215
|
};
|
|
212
216
|
|
|
213
|
-
|
|
214
|
-
() => selectedData.value.length,
|
|
215
|
-
() => {
|
|
217
|
+
const emitSelectedData = () => {
|
|
216
218
|
if (returnCompleteSelectedProperties.value) {
|
|
217
219
|
emit('update:selectedData', selectedData.value);
|
|
218
220
|
} else {
|
|
@@ -226,8 +228,31 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
226
228
|
});
|
|
227
229
|
emit('update:selectedData', mappedData);
|
|
228
230
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
watch(sortedData, (newVal) => {
|
|
234
|
+
if(newVal && props.isMultiSelect && selectedData.value.length > 0) {
|
|
235
|
+
// Remove items from selectedData that are not in the new sortedData
|
|
236
|
+
// This is to ensure that the selectedData is always in sync with the sortedData
|
|
237
|
+
|
|
238
|
+
newVal.forEach((item) => {
|
|
239
|
+
const selectedIndex = selectedData.value.findIndex((data) => {
|
|
240
|
+
const typedSelectedData = data[selectedKeyId.value] as TableDataProps;
|
|
241
|
+
const typedSortedData = item[selectedKeyId.value] as TableDataProps;
|
|
242
|
+
|
|
243
|
+
if (isTableDataObject(typedSelectedData) && isTableDataObject(typedSortedData)) {
|
|
244
|
+
return typedSelectedData.title === typedSortedData.title;
|
|
245
|
+
} else {
|
|
246
|
+
return data[selectedKeyId.value] === item[selectedKeyId.value];
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
if (selectedIndex === -1) {
|
|
251
|
+
selectedData.value.splice(selectedIndex, 1);
|
|
252
|
+
}
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
});
|
|
231
256
|
|
|
232
257
|
return {
|
|
233
258
|
sortData,
|
|
@@ -246,6 +271,6 @@ export const useTable = (props: TablePropTypes, emit: SetupContext<TableEmitType
|
|
|
246
271
|
isAllSelected,
|
|
247
272
|
isRowSelected,
|
|
248
273
|
isIndeterminate,
|
|
249
|
-
sortedDataItem
|
|
274
|
+
sortedDataItem,
|
|
250
275
|
};
|
|
251
276
|
};
|