edvoyui-component-library-test-flight 0.0.145 → 0.0.146

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "edvoyui-component-library-test-flight",
3
3
  "private": false,
4
- "version": "0.0.145",
4
+ "version": "0.0.146",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist/",
@@ -254,7 +254,8 @@ const startCaseText = (x: string) => {
254
254
  return startCase(x);
255
255
  };
256
256
 
257
- const selected = ref<any[] | null>([]);
257
+ const selected = ref<string | string[] | Record<string, any> | Record<string, any>[] | null>(null)
258
+
258
259
  const nodropDown = ref(false);
259
260
  const props = defineProps({
260
261
  clearable: {
@@ -458,20 +459,31 @@ const clearAll = (e:Event) => {
458
459
  }
459
460
 
460
461
  const onCheckBoxChange = (item: any, event: Event) => {
461
- const target = event.target as HTMLInputElement
462
+ const target = event.target as HTMLInputElement;
462
463
 
463
464
  if (!Array.isArray(selected.value)) {
464
- selected.value = []
465
+ selected.value = [];
465
466
  }
466
467
 
468
+ const current = selected.value as any[];
469
+
467
470
  if (target.checked) {
468
- if (!selected.value?.some(s => s?.value === item?.value)) {
469
- selected.value?.push(item)
471
+ const exists = current.some((s) => {
472
+ if (typeof s === 'string') return s === item[fieldName.value];
473
+ return s?.[fieldName.value] === item[fieldName.value];
474
+ });
475
+
476
+ if (!exists) {
477
+ current.push(item);
470
478
  }
471
479
  } else {
472
- selected.value = selected.value?.filter(s => s?.value !== item?.value)
480
+ selected.value = current.filter((s) => {
481
+ if (typeof s === 'string') return s !== item[fieldName.value];
482
+ return s?.[fieldName.value] !== item[fieldName.value];
483
+ });
473
484
  }
474
- }
485
+ };
486
+
475
487
 
476
488
  const selectAll = (e: Event) => {
477
489
  if (e.target) {