edvoyui-component-library-test-flight 0.0.37 → 0.0.39

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.
@@ -1,5 +1,5 @@
1
1
  export * from "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUIDashboardTable.vue?vue&type=script&setup=true&lang.ts";
2
- import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUIDashboardTable.vue?vue&type=style&index=0&scoped=853762cf&lang.scss";
2
+ import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUIDashboardTable.vue?vue&type=style&index=0&scoped=0768fd93&lang.scss";
3
3
  declare const _default: any;
4
4
  export default _default;
5
5
  //# sourceMappingURL=EUIDashboardTable.vue.d.ts.map
@@ -1,5 +1,5 @@
1
1
  export * from "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUITable.vue?vue&type=script&setup=true&lang.ts";
2
- import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUITable.vue?vue&type=style&index=0&scoped=fc4a1467&lang.scss";
2
+ import "/Volumes/work/repos/edvoy-ui-v2/src/components/table/EUITable.vue?vue&type=style&index=0&scoped=fd223767&lang.scss";
3
3
  declare const _default: any;
4
4
  export default _default;
5
5
  //# sourceMappingURL=EUITable.vue.d.ts.map
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.37",
4
+ "version": "0.0.39",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist/",
@@ -88,9 +88,7 @@
88
88
  <EUITableCheckbox
89
89
  :disabled="!isRowCheckable(row)"
90
90
  :checked="isRowChecked(row)"
91
- @change.prevent.stop="
92
- ($event) => checkRow(row, rowIndex, $event)
93
- "
91
+ @change="($event:boolean) => checkRow(row, rowIndex, $event)"
94
92
  />
95
93
  </td>
96
94
  </template>
@@ -241,7 +239,6 @@ const currentSort = ref(defaultSort.value);
241
239
  const currentSortDir = ref(defaultSortDirection.value);
242
240
  const newCheckedRows = ref([...checkedRows.value]);
243
241
  const newCurrentPage = ref(currentPage.value);
244
- const lastCheckedRowIndex = ref();
245
242
  const limit = ref(props.perPage);
246
243
  const loading = computed(() => props.tableLoading);
247
244
 
@@ -388,29 +385,13 @@ const checkAll = () => {
388
385
  emit("update:checkedRows", newCheckedRows.value);
389
386
  };
390
387
 
391
- const removeCheckedRow = (row: any) => {
392
- const index = indexOf(newCheckedRows.value, row, customIsChecked.value);
393
- if (index >= 0) {
394
- newCheckedRows.value.splice(index, 1);
395
- }
396
- };
397
-
398
388
  const isRowChecked = (row: any) => {
399
389
  return indexOf(newCheckedRows.value, row, customIsChecked.value) >= 0;
400
390
  };
401
391
 
402
- const checkRow = (row: any, rowIndex: number, event: Event) => {
392
+ const checkRow = (row: any, rowIndex: number, event:boolean) => {
403
393
  if (!isRowCheckable.value(row)) return;
404
- if (event) {
405
- lastCheckedRowIndex.value = rowIndex;
406
- if (!isRowChecked(row)) {
407
- newCheckedRows.value.push(row);
408
- } else {
409
- removeCheckedRow(row);
410
- }
411
- emit("check", newCheckedRows.value, row);
412
- emit("update:checkedRows", newCheckedRows.value);
413
- }
394
+ console.log('@event',row, rowIndex, event)
414
395
  };
415
396
 
416
397
  // watch
@@ -108,7 +108,7 @@
108
108
  <EUITableCheckbox
109
109
  :disabled="!isRowCheckable(row)"
110
110
  :checked="isRowChecked(row)"
111
- @change.prevent.stop="($event) => checkRow(row, rowIndex, $event)"
111
+ @change="($event:boolean) => checkRow(row, rowIndex, $event)"
112
112
  />
113
113
  </td>
114
114
  </template>
@@ -248,7 +248,6 @@ const currentSort = ref(defaultSort.value);
248
248
  const currentSortDir = ref(defaultSortDirection.value);
249
249
  const newCheckedRows = ref([...checkedRows.value]);
250
250
  const newCurrentPage = ref(currentPage.value);
251
- const lastCheckedRowIndex = ref();
252
251
  const limit = ref(props.perPage);
253
252
  const loading = computed(() => props.tableLoading);
254
253
 
@@ -393,29 +392,13 @@ const checkAll = () => {
393
392
  emit("update:checkedRows", newCheckedRows.value);
394
393
  };
395
394
 
396
- const removeCheckedRow = (row:any) => {
397
- const index = indexOf(newCheckedRows.value, row, customIsChecked.value);
398
- if (index >= 0) {
399
- newCheckedRows.value.splice(index, 1);
400
- }
401
- };
402
-
403
395
  const isRowChecked = (row:any) => {
404
396
  return indexOf(newCheckedRows.value, row, customIsChecked.value) >= 0;
405
397
  };
406
398
 
407
- const checkRow = (row: any, rowIndex: number, event: Event) => {
399
+ const checkRow = (row: any, rowIndex: number, event:boolean) => {
408
400
  if (!isRowCheckable.value(row)) return;
409
- if(event) {
410
- lastCheckedRowIndex.value = rowIndex;
411
- if (!isRowChecked(row)) {
412
- newCheckedRows.value.push(row);
413
- } else {
414
- removeCheckedRow(row);
415
- }
416
- emit("check", newCheckedRows.value, row);
417
- emit("update:checkedRows", newCheckedRows.value);
418
- }
401
+ console.log('@event',row, rowIndex, event)
419
402
  };
420
403
 
421
404
  // watch
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <label class="table-checkbox">
3
- <input v-model="selected" type="checkbox" :value="value" v-bind="mergedAttrs" />
3
+ <input v-model="isChecked" type="checkbox" :value="value" v-bind="mergedAttrs" @change="toggle($event)" />
4
4
  <span class="check-icon">
5
5
  <svg
6
6
  xmlns="http://www.w3.org/2000/svg"
@@ -33,51 +33,28 @@ const props = defineProps({
33
33
  default: null
34
34
  }
35
35
  })
36
+ const emit = defineEmits(['update:checked','change']);
37
+ const attrs = useAttrs();
36
38
 
37
- const emit = defineEmits(['change'])
38
- const isIndeterminate = ref(props.indeterminate)
39
-
40
- watch(() => props.indeterminate, (val) => {
41
- isIndeterminate.value = val
42
- })
43
-
44
- const selected = computed({
45
- get() {
46
- return props.checked
47
- },
48
- set(val) {
49
- emit('change', val)
50
- }
51
- })
52
-
53
- const isActive = computed(() => {
54
- const modelIsArray = Array.isArray(props.checked) && props.checked.length !== 0
55
-
56
- const sameValue = (element: any) => element === props.value
57
-
58
- if (modelIsArray) {
59
- return props.checked.some(sameValue)
60
- }
61
-
62
- return props.checked === true
63
- })
64
-
65
- const attrs = useAttrs()
66
- const computedTabIndex = computed(() => (attrs.disabled ? -1 : 0))
67
-
39
+ const isChecked = ref<boolean>(props.checked);
68
40
  const mergedAttrs = computed(() => ({
69
41
  ...attrs,
70
- tabindex: computedTabIndex.value,
42
+ tabindex: attrs.disabled ? -1 : 0,
71
43
  role: 'checkbox',
72
- // 'aria-checked': isIndeterminate.value ? 'mixed' : isActive.value.toString(),
73
- // 'aria-disabled': attrs.disabled,
74
- }))
44
+ }));
45
+ watch(
46
+ () => props.checked,
47
+ (newValue) => {
48
+ isChecked.value = newValue;
49
+ }
50
+ );
75
51
 
76
- watch(isActive, () => {
77
- if (props.indeterminate) {
78
- isIndeterminate.value = false
52
+ const toggle = ($event: Event) => {
53
+ if($event) {
54
+ emit('update:checked', isChecked.value);
55
+ emit('change', isChecked.value)
79
56
  }
80
- })
57
+ };
81
58
  </script>
82
59
 
83
60
  <style lang="scss">