sprintify-ui 0.0.179 → 0.0.180

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.
Files changed (31) hide show
  1. package/dist/sprintify-ui.es.js +7850 -7684
  2. package/dist/style.css +1 -1
  3. package/dist/types/src/components/BaseDataIterator.vue.d.ts +52 -13
  4. package/dist/types/src/components/BaseDataIteratorSectionBox.vue.d.ts +23 -0
  5. package/dist/types/src/components/BaseDataIteratorSectionButton.vue.d.ts +20 -0
  6. package/dist/types/src/components/{BaseDataTableToggleColumns.vue.d.ts → BaseDataIteratorSectionColumns.vue.d.ts} +6 -40
  7. package/dist/types/src/components/BaseDataIteratorSectionModal.vue.d.ts +29 -0
  8. package/dist/types/src/components/BaseDataTable.vue.d.ts +50 -11
  9. package/dist/types/src/components/BaseDataTableRowAction.vue.d.ts +18 -0
  10. package/dist/types/src/components/BaseMenu.vue.d.ts +9 -0
  11. package/dist/types/src/components/BaseMenuItem.vue.d.ts +9 -0
  12. package/dist/types/src/components/BaseTable.vue.d.ts +2 -17
  13. package/dist/types/src/index.d.ts +12 -0
  14. package/dist/types/src/types/index.d.ts +15 -0
  15. package/package.json +1 -1
  16. package/src/assets/main.css +23 -0
  17. package/src/components/BaseActionItem.vue +3 -1
  18. package/src/components/BaseDataIterator.vue +123 -85
  19. package/src/components/BaseDataIteratorSectionBox.vue +33 -0
  20. package/src/components/BaseDataIteratorSectionButton.vue +34 -0
  21. package/src/components/{BaseDataTableToggleColumns.vue → BaseDataIteratorSectionColumns.vue} +3 -3
  22. package/src/components/BaseDataIteratorSectionModal.vue +41 -0
  23. package/src/components/BaseDataTable.stories.js +45 -14
  24. package/src/components/BaseDataTable.vue +219 -78
  25. package/src/components/BaseDataTableRowAction.vue +28 -0
  26. package/src/components/BaseMenu.vue +7 -0
  27. package/src/components/BaseMenuItem.vue +17 -1
  28. package/src/components/BaseTable.vue +37 -85
  29. package/src/lang/en.json +3 -0
  30. package/src/lang/fr.json +3 -0
  31. package/src/types/index.ts +17 -0
@@ -22,13 +22,13 @@
22
22
  <th
23
23
  v-if="showDetailRowIcon"
24
24
  class="th"
25
- :style="detailsStyles"
25
+ :style="detailsStyles(true)"
26
26
  />
27
27
  <th
28
28
  v-if="checkable && checkboxPosition === 'left'"
29
29
  class="th group cursor-pointer py-0 pl-3"
30
30
  align="left"
31
- :style="checkStyles"
31
+ :style="checkStyles(true)"
32
32
  @click="checkAll"
33
33
  >
34
34
  <div class="flex items-center">
@@ -47,16 +47,18 @@
47
47
  v-bind="column.thAttrs && column.thAttrs(column)"
48
48
  :style="[
49
49
  column.style,
50
- index == 0 ? firstColStyles : { position: 'relative' },
50
+ index == 0 ? firstColStyles(true) : {},
51
51
  ]"
52
52
  class="th group py-2 pl-3 pr-3 text-left"
53
+ :class="{
54
+ 'cursor-pointer': column.sortable,
55
+ }"
53
56
  @click.stop="sort(column, undefined, $event as any)"
54
57
  >
55
58
  <button
56
59
  type="button"
57
60
  class="flex w-full items-center bg-transparent text-left text-sm font-medium leading-tight text-slate-900"
58
61
  :class="{
59
- 'cursor-default': !column.sortable,
60
62
  'text-blue-600':
61
63
  column.sortable && currentSortColumn === column,
62
64
  }"
@@ -113,63 +115,6 @@
113
115
  </thead>
114
116
 
115
117
  <tbody class="bg-white">
116
- <tr v-if="newCheckedRows.length">
117
- <td
118
- :colspan="columnCount"
119
- class="sticky z-[1] p-0"
120
- :style="{
121
- top: theadHeight + 'px',
122
- }"
123
- :class="[borderClasses]"
124
- >
125
- <slot
126
- name="checkedHeader"
127
- :uncheck-all="uncheckAll"
128
- :count="newCheckedRows.length"
129
- :check-rows="newCheckedRows"
130
- >
131
- <div
132
- class="flex items-center justify-between bg-slate-100 py-2 pl-3 pr-2 text-sm"
133
- >
134
- <div>
135
- <span class="mr-3 text-slate-500"
136
- >{{
137
- $t('sui.x_rows_selected', {
138
- count: newCheckedRows.length,
139
- })
140
- }}.</span
141
- >
142
- <button
143
- type="button"
144
- class="mr-3 inline text-slate-700 underline"
145
- @click="uncheckAll()"
146
- >
147
- {{ $t('sui.deselect_all') }}
148
- </button>
149
- </div>
150
- <BaseMenu
151
- v-if="checkableActions?.length"
152
- menu-class="w-52"
153
- :items="checkableActions"
154
- >
155
- <template #button="{ open }">
156
- <div
157
- class="flex h-10 w-10 items-center justify-center rounded-full border border-slate-300 bg-white duration-150 hover:bg-slate-50"
158
- :class="[
159
- open
160
- ? 'ring-2 ring-primary-500 ring-offset-2'
161
- : false,
162
- ]"
163
- >
164
- <BaseIcon icon="heroicons-solid:dots-vertical" />
165
- </div>
166
- </template>
167
- </BaseMenu>
168
- </div>
169
- </slot>
170
- </td>
171
- </tr>
172
-
173
118
  <template
174
119
  v-for="(row, index) in data"
175
120
  :key="getRowIndex(row, index)"
@@ -179,7 +124,7 @@
179
124
  v-if="showDetailRowIcon"
180
125
  class="group cursor-pointer bg-white pl-3"
181
126
  :class="borderBottomClasses(index, row)"
182
- :style="detailsStyles"
127
+ :style="detailsStyles(false)"
183
128
  @click.stop="toggleDetails(row)"
184
129
  >
185
130
  <button
@@ -200,7 +145,7 @@
200
145
  <td
201
146
  v-if="checkable && checkboxPosition === 'left'"
202
147
  class="group z-[1] cursor-pointer bg-white pl-3"
203
- :style="checkStyles"
148
+ :style="checkStyles(false)"
204
149
  :class="borderBottomClasses(index, row)"
205
150
  @click="checkRow(row, index, $event as MouseEvent)"
206
151
  >
@@ -226,7 +171,7 @@
226
171
  class="bg-white py-3 pl-3 pr-3 text-sm"
227
172
  :style="[
228
173
  column.style,
229
- colindex === 0 ? firstColStyles : {},
174
+ colindex === 0 ? firstColStyles(false) : {},
230
175
  ]"
231
176
  :class="[
232
177
  borderBottomClasses(index, row),
@@ -317,11 +262,10 @@ export default {
317
262
 
318
263
  <script lang="ts" setup>
319
264
  import { PropType, ref } from 'vue';
320
- import { BaseTableColumn, MenuItemInterface, Row } from '@/types';
265
+ import { BaseTableColumn, Row } from '@/types';
321
266
  import SlotComponent from './SlotComponent';
322
267
  import { useResizeObserver, useScroll } from '@vueuse/core';
323
268
  import { debounce, isArray } from 'lodash';
324
- import BaseMenu from './BaseMenu.vue';
325
269
  import BaseSpinnerLarge from '../svg/BaseSpinnerLarge.vue';
326
270
 
327
271
  const checkboxStyle =
@@ -356,11 +300,6 @@ const props = defineProps({
356
300
  default: false,
357
301
  type: Boolean,
358
302
  },
359
- /** Define checkable actions */
360
- checkableActions: {
361
- default: undefined,
362
- type: Array as PropType<MenuItemInterface[]>,
363
- },
364
303
  /**
365
304
  * Position of the checkbox (if checkable is true)
366
305
  * @values left, right
@@ -590,13 +529,17 @@ const isAllChecked = computed(() => {
590
529
  return !missingChecked;
591
530
  });
592
531
 
532
+ function getCheckedRowIndex(row: Row) {
533
+ return newCheckedRows.value.findIndex(
534
+ (r) => r[props.rowKey] == row[props.rowKey]
535
+ );
536
+ }
537
+
593
538
  /**
594
539
  * Remove a checked row from the array.
595
540
  */
596
541
  function removeCheckedRow(row: Row) {
597
- const index = newCheckedRows.value.findIndex(
598
- (r) => r[props.rowKey] == row[props.rowKey]
599
- );
542
+ const index = getCheckedRowIndex(row);
600
543
  if (index >= 0) {
601
544
  newCheckedRows.value.splice(index, 1);
602
545
  }
@@ -611,7 +554,7 @@ function checkAll() {
611
554
  newCheckedRows.value = [];
612
555
  } else {
613
556
  props.data.forEach((currentRow) => {
614
- if (props.isRowCheckable(currentRow)) {
557
+ if (props.isRowCheckable(currentRow) && !isRowChecked(currentRow)) {
615
558
  newCheckedRows.value.push(currentRow);
616
559
  }
617
560
  });
@@ -850,10 +793,17 @@ watch(x, (value) => {
850
793
  horizontalScrolling.value = value > 0;
851
794
  });
852
795
 
853
- const detailsStyles = computed<any>(() => {
796
+ function zIndex(th: boolean) {
797
+ if (th) {
798
+ return props.maxHeight ? 3 : 2;
799
+ }
800
+ return 1;
801
+ }
802
+
803
+ function detailsStyles(th: boolean): any {
854
804
  if (props.detailed) {
855
805
  return {
856
- zIndex: 1,
806
+ zIndex: zIndex(th),
857
807
  position: 'sticky',
858
808
  left: 0,
859
809
  width: DETAIL_ROW_WIDTH + 'px',
@@ -862,12 +812,12 @@ const detailsStyles = computed<any>(() => {
862
812
  };
863
813
  }
864
814
  return {};
865
- });
815
+ }
866
816
 
867
- const checkStyles = computed<any>(() => {
817
+ function checkStyles(th: boolean): any {
868
818
  if (props.checkable) {
869
819
  return {
870
- zIndex: 1,
820
+ zIndex: zIndex(th),
871
821
  position: 'sticky',
872
822
  left: props.detailed ? DETAIL_ROW_WIDTH + 'px' : 0,
873
823
  width: CHECK_ROW_WIDTH + 'px',
@@ -876,9 +826,9 @@ const checkStyles = computed<any>(() => {
876
826
  };
877
827
  }
878
828
  return {};
879
- });
829
+ }
880
830
 
881
- const firstColStyles = computed<any>(() => {
831
+ function firstColStyles(th: boolean): any {
882
832
  let left = 0;
883
833
  if (props.checkable) {
884
834
  left += CHECK_ROW_WIDTH;
@@ -887,12 +837,12 @@ const firstColStyles = computed<any>(() => {
887
837
  left += DETAIL_ROW_WIDTH;
888
838
  }
889
839
  return {
890
- zIndex: 1,
840
+ zIndex: zIndex(th),
891
841
  position: 'sticky',
892
842
  left: left + 'px',
893
843
  borderRight: horizontalScrolling.value ? '1px solid #e2e8f0' : 'none',
894
844
  };
895
- });
845
+ }
896
846
 
897
847
  provide('addColumn', addColumn);
898
848
  provide('removeColumn', removeColumn);
@@ -900,11 +850,13 @@ provide('nextSequence', nextSequence);
900
850
 
901
851
  defineExpose({
902
852
  newColumns,
853
+ uncheckAll,
903
854
  });
904
855
  </script>
905
856
 
906
857
  <style lang="postcss" scoped>
907
858
  .th {
859
+ @apply relative;
908
860
  @apply bg-slate-50;
909
861
  @apply border-b border-slate-300;
910
862
  }
@@ -912,7 +864,7 @@ defineExpose({
912
864
  .base-table--has-max-height .th {
913
865
  @apply sticky;
914
866
  @apply top-0;
915
- @apply z-[1];
867
+ @apply z-[2];
916
868
  @apply bg-opacity-75 backdrop-blur backdrop-filter;
917
869
  }
918
870
 
package/src/lang/en.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "address_1_placeholder": "Postal address",
5
5
  "address_2_description": "Apartment, suite, unit, building",
6
6
  "and": "and",
7
+ "apply": "Apply",
7
8
  "apply_filters": "Apply filters",
8
9
  "autocomplete_placeholder": "Type to start your search",
9
10
  "cancel": "Cancel",
@@ -17,10 +18,12 @@
17
18
  "country": "Country",
18
19
  "create_new": "Create new",
19
20
  "day": "Day",
21
+ "delete": "Delete",
20
22
  "delete_record": "Delete the record",
21
23
  "delete_record_description": "Are you sure to delete this record? This action is irreversible.",
22
24
  "deselect_all": "Deselect all",
23
25
  "drop_or_click_to_upload": "Drop or click to upload",
26
+ "edit": "Edit",
24
27
  "error": "Error",
25
28
  "file_must_be_of_type": "The file must be of type",
26
29
  "filters": "Filters",
package/src/lang/fr.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "address_1_placeholder": "Adresse postale",
5
5
  "address_2_description": "Appartement, suite, unité, immeuble",
6
6
  "and": "et",
7
+ "apply": "Appliquer",
7
8
  "apply_filters": "Appliquer les filtres",
8
9
  "autocomplete_placeholder": "Tapez pour lancer votre recherche",
9
10
  "cancel": "Annuler",
@@ -17,10 +18,12 @@
17
18
  "country": "Pays",
18
19
  "create_new": "Créer un nouveau",
19
20
  "day": "Jour",
21
+ "delete": "Supprimer",
20
22
  "delete_record": "Supprimer l'item",
21
23
  "delete_record_description": "Voulez-vous vraiment supprimer cet item ? \nCette action est irréversible.",
22
24
  "deselect_all": "Tout déselectionner",
23
25
  "drop_or_click_to_upload": "Déposez ou cliquez pour télécharger",
26
+ "edit": "Modifier",
24
27
  "error": "Erreur",
25
28
  "file_must_be_of_type": "Le fichier doit être de type",
26
29
  "filters": "Filtres",
@@ -84,6 +84,7 @@ export interface ActionItem {
84
84
  action?: () => Promise<void> | void;
85
85
  icon?: string;
86
86
  count?: number;
87
+ disabled?: boolean;
87
88
  meta?: Record<string, any>;
88
89
  actions?: ActionItem[];
89
90
  }
@@ -209,3 +210,19 @@ export interface SelectConfiguration {
209
210
  options: SelectConfigurationOption[];
210
211
  onChange?: (option: SelectConfigurationOption | null) => void;
211
212
  }
213
+
214
+ export interface DataIteratorSection {
215
+ name: string;
216
+ title: string;
217
+ closeText: string;
218
+ icon: string;
219
+ opened?: boolean;
220
+ }
221
+
222
+ export interface RowAction {
223
+ label: string;
224
+ icon: string;
225
+ action?: (row: CollectionItem) => Promise<void> | void;
226
+ to?: (row: CollectionItem) => RouteLocationRaw;
227
+ disabled?: (row: CollectionItem) => boolean;
228
+ }