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

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.147",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist/",
@@ -150,32 +150,32 @@
150
150
  </template>
151
151
 
152
152
  <template v-else-if="isSelectAll || isCheckbox" #list-header>
153
- <div v-if="isCheckbox" class="flex flex-row items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 border-solid">
154
- <h3 class="text-sm font-semibold text-black">
155
- All values
153
+ <div v-if="isCheckbox && groupSelect" class="flex flex-row items-center justify-between gap-1 px-2 py-2 border-b border-gray-200 border-solid">
154
+ <h3 class="text-xs font-semibold text-black">
155
+ Options
156
156
  </h3>
157
157
 
158
- <div class="flex items-center gap-1 whitespace-nowrap">
158
+ <div class="flex items-center gap-px whitespace-nowrap">
159
159
  <button
160
- class="w-full px-2 py-1 text-xs font-medium transition duration-75 text-start"
161
- :class="[items?.length !== selected?.length ? 'text-gray-600 hover:text-gray-900': 'pointer-events-none opacity-50 cursor-default text-gray-400']"
160
+ class="w-full p-1 font-medium transition duration-75 rounded text-xss text-start"
161
+ :class="[items?.length !== selected?.length ? 'text-gray-600 hover:bg-gray-50 hover:text-violet-600': 'pointer-events-none opacity-50 cursor-default text-gray-400']"
162
162
  :disabled="items?.length === selected?.length"
163
163
  @click.prevent="isCheckedAll"
164
164
  >
165
165
  Select All
166
166
  </button>
167
167
  <button
168
- class="w-full px-2 py-1 text-xs font-medium transition duration-75 text-start"
169
- :class="[(selected?.length ?? 0) > 0 ? 'text-gray-600 hover:text-gray-900': 'pointer-events-none opacity-50 cursor-default text-gray-400']"
168
+ class="w-full p-1 font-medium transition duration-75 rounded text-xss text-start"
169
+ :class="[(selected?.length ?? 0) > 0 ? 'text-gray-600 hover:text-red-600 hover:bg-gray-50': 'pointer-events-none opacity-50 cursor-default text-gray-400']"
170
170
  :disabled="(selected?.length ?? 0) === 0"
171
171
  @click.prevent="clearAll"
172
172
  >
173
- Clear all
173
+ Clear All
174
174
  </button>
175
175
  </div>
176
176
  </div>
177
177
 
178
- <template v-else>
178
+ <template v-else-if="isSelectAll">
179
179
  <button
180
180
  v-if="items.length !== selected?.length"
181
181
  class="w-full px-6 py-2 text-sm font-medium text-gray-600 transition duration-75 hover:font-bold hover:text-gray-900 text-start"
@@ -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: {
@@ -400,6 +401,7 @@ const props = defineProps({
400
401
  type: Boolean,
401
402
  default: false,
402
403
  },
404
+ groupSelect: { type: Boolean, default: false }
403
405
  });
404
406
 
405
407
  const {
@@ -458,20 +460,31 @@ const clearAll = (e:Event) => {
458
460
  }
459
461
 
460
462
  const onCheckBoxChange = (item: any, event: Event) => {
461
- const target = event.target as HTMLInputElement
463
+ const target = event.target as HTMLInputElement;
462
464
 
463
465
  if (!Array.isArray(selected.value)) {
464
- selected.value = []
466
+ selected.value = [];
465
467
  }
466
468
 
469
+ const current = selected.value as any[];
470
+
467
471
  if (target.checked) {
468
- if (!selected.value?.some(s => s?.value === item?.value)) {
469
- selected.value?.push(item)
472
+ const exists = current.some((s) => {
473
+ if (typeof s === 'string') return s === item[fieldName.value];
474
+ return s?.[fieldName.value] === item[fieldName.value];
475
+ });
476
+
477
+ if (!exists) {
478
+ current.push(item);
470
479
  }
471
480
  } else {
472
- selected.value = selected.value?.filter(s => s?.value !== item?.value)
481
+ selected.value = current.filter((s) => {
482
+ if (typeof s === 'string') return s !== item[fieldName.value];
483
+ return s?.[fieldName.value] !== item[fieldName.value];
484
+ });
473
485
  }
474
- }
486
+ };
487
+
475
488
 
476
489
  const selectAll = (e: Event) => {
477
490
  if (e.target) {