@voicenter-team/voicenter-ui-plus 0.0.1

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 (237) hide show
  1. package/README.md +35 -0
  2. package/library/favicon.ico +0 -0
  3. package/library/fonts/VC-icon.eot +0 -0
  4. package/library/fonts/VC-icon.svg +268 -0
  5. package/library/fonts/VC-icon.ttf +0 -0
  6. package/library/fonts/VC-icon.woff +0 -0
  7. package/library/icon-vc.css +753 -0
  8. package/library/images/logo-icon.svg +6 -0
  9. package/library/images/not-found.png +0 -0
  10. package/library/images/perfil.jpg +0 -0
  11. package/library/sound/test-audio.mp3 +0 -0
  12. package/library/style.css +1 -0
  13. package/library/super.mjs +24050 -0
  14. package/library/super.mjs.map +1 -0
  15. package/library/super.umd.js +37 -0
  16. package/library/super.umd.js.map +1 -0
  17. package/library/types/src/components/VcButton/VcButton.types.d.ts +5 -0
  18. package/library/types/src/components/VcButton/VcButton.vue.d.ts +94 -0
  19. package/library/types/src/components/VcButton/VcButtonIcon.vue.d.ts +89 -0
  20. package/library/types/src/components/VcCard/VcCard.vue.d.ts +23 -0
  21. package/library/types/src/components/VcCheckbox/VcCheckbox.vue.d.ts +133 -0
  22. package/library/types/src/components/VcCheckbox/VcCheckboxGroupEl.vue.d.ts +2 -0
  23. package/library/types/src/components/VcCheckbox/group.mixin.d.ts +60 -0
  24. package/library/types/src/components/VcCheckboxGroup/VcCheckboxGroup.vue.d.ts +140 -0
  25. package/library/types/src/components/VcCollapse/VcCollapse.vue.d.ts +33 -0
  26. package/library/types/src/components/VcCollapse/VcCollapseItem.vue.d.ts +106 -0
  27. package/library/types/src/components/VcCollapse/VcCollapseTransition.vue.d.ts +14 -0
  28. package/library/types/src/components/VcColorPicker/ColorPicker/ColorPicker.vue.d.ts +67 -0
  29. package/library/types/src/components/VcColorPicker/ColorPicker/Hue.vue.d.ts +40 -0
  30. package/library/types/src/components/VcColorPicker/ColorPicker/Saturation.vue.d.ts +49 -0
  31. package/library/types/src/components/VcColorPicker/ColorPicker/composible.d.ts +23 -0
  32. package/library/types/src/components/VcColorPicker/VcColorPicker.types.d.ts +10 -0
  33. package/library/types/src/components/VcColorPicker/VcColorPicker.vue.d.ts +65 -0
  34. package/library/types/src/components/VcDatetimeRangePicker/VcDatetimeRangePicker.types.d.ts +27 -0
  35. package/library/types/src/components/VcDatetimeRangePicker/VcDatetimeRangePicker.vue.d.ts +360 -0
  36. package/library/types/src/components/VcDelimitedList/VcDelimitedList.types.d.ts +4 -0
  37. package/library/types/src/components/VcDelimitedList/VcDelimitedList.vue.d.ts +92 -0
  38. package/library/types/src/components/VcExtendedDatetimeRangePicker/ExtendedDatetimeRangePickerPart.vue.d.ts +208 -0
  39. package/library/types/src/components/VcExtendedDatetimeRangePicker/ExtendedDatetimeRangePickerRelative.vue.d.ts +96 -0
  40. package/library/types/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.types.d.ts +11 -0
  41. package/library/types/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue.d.ts +276 -0
  42. package/library/types/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePickerQuickOptionsSelection.vue.d.ts +51 -0
  43. package/library/types/src/components/VcExtendedDatetimeRangePicker/enum.d.ts +6 -0
  44. package/library/types/src/components/VcFileUploader/VcFileUploader.types.d.ts +4 -0
  45. package/library/types/src/components/VcFileUploader/VcFileUploader.vue.d.ts +388 -0
  46. package/library/types/src/components/VcForm/UiComponents/VcInputLabel.vue.d.ts +204 -0
  47. package/library/types/src/components/VcForm/VcForm.vue.d.ts +348 -0
  48. package/library/types/src/components/VcForm/VcFormItem.vue.d.ts +69 -0
  49. package/library/types/src/components/VcHyperLink/VcHyperLink.types.d.ts +2 -0
  50. package/library/types/src/components/VcHyperLink/VcHyperLink.vue.d.ts +54 -0
  51. package/library/types/src/components/VcIconPicker/VcIconPicker.types.d.ts +15 -0
  52. package/library/types/src/components/VcIconPicker/VcIconPicker.vue.d.ts +105 -0
  53. package/library/types/src/components/VcIconPicker/iconPicker.mixin.d.ts +51 -0
  54. package/library/types/src/components/VcInput/VcInput.types.d.ts +2 -0
  55. package/library/types/src/components/VcInput/VcInput.vue.d.ts +202 -0
  56. package/library/types/src/components/VcInputNumber/VcInputNumber.vue.d.ts +256 -0
  57. package/library/types/src/components/VcLoading/Loaders/Circles.vue.d.ts +28 -0
  58. package/library/types/src/components/VcLoading/Loaders/LdsSpinner.vue.d.ts +29 -0
  59. package/library/types/src/components/VcLoading/Loaders/LoadIcon.vue.d.ts +36 -0
  60. package/library/types/src/components/VcLoading/Loaders/Stretch.vue.d.ts +28 -0
  61. package/library/types/src/components/VcLoading/VcLoading.types.d.ts +1 -0
  62. package/library/types/src/components/VcLoading/VcLoading.vue.d.ts +66 -0
  63. package/library/types/src/components/VcModal/VcModal.types.d.ts +4 -0
  64. package/library/types/src/components/VcModal/VcModal.vue.d.ts +210 -0
  65. package/library/types/src/components/VcPagination/VcPagination.types.d.ts +4 -0
  66. package/library/types/src/components/VcPagination/VcPagination.vue.d.ts +64 -0
  67. package/library/types/src/components/VcPagination/VcPaginationButton.vue.d.ts +34 -0
  68. package/library/types/src/components/VcPopover/VcPopover.types.d.ts +3 -0
  69. package/library/types/src/components/VcPopover/VcPopover.vue.d.ts +150 -0
  70. package/library/types/src/components/VcProgress/VcProgress.types.d.ts +16 -0
  71. package/library/types/src/components/VcProgress/VcProgress.vue.d.ts +147 -0
  72. package/library/types/src/components/VcProgress/progress.options.d.ts +13 -0
  73. package/library/types/src/components/VcRadio/VcRadio.vue.d.ts +88 -0
  74. package/library/types/src/components/VcRadioGroup/VcRadioGroup.vue.d.ts +96 -0
  75. package/library/types/src/components/VcRadioTabs/UiComponents/VcRadioTabsNav.vue.d.ts +41 -0
  76. package/library/types/src/components/VcRadioTabs/VcRadioTabs.vue.d.ts +78 -0
  77. package/library/types/src/components/VcSelect/VcSelect.options.d.ts +78 -0
  78. package/library/types/src/components/VcSelect/VcSelect.vue.d.ts +293 -0
  79. package/library/types/src/components/VcSkeletonLoader/Loaders/Card.vue.d.ts +18 -0
  80. package/library/types/src/components/VcSkeletonLoader/Loaders/Circle.vue.d.ts +28 -0
  81. package/library/types/src/components/VcSkeletonLoader/Loaders/Row.vue.d.ts +18 -0
  82. package/library/types/src/components/VcSkeletonLoader/Loaders/Square.vue.d.ts +28 -0
  83. package/library/types/src/components/VcSkeletonLoader/Loaders/Text.vue.d.ts +16 -0
  84. package/library/types/src/components/VcSkeletonLoader/VcSkeletonLoader.types.d.ts +1 -0
  85. package/library/types/src/components/VcSkeletonLoader/VcSkeletonLoader.vue.d.ts +81 -0
  86. package/library/types/src/components/VcSoundplayer/VcSoundPlayer.types.d.ts +2 -0
  87. package/library/types/src/components/VcSoundplayer/VcSoundPlayer.vue.d.ts +130 -0
  88. package/library/types/src/components/VcSplitButton/VcSplitButton.types.d.ts +8 -0
  89. package/library/types/src/components/VcSplitButton/VcSplitButton.vue.d.ts +68 -0
  90. package/library/types/src/components/VcSwitch/VcSwitch.types.d.ts +1 -0
  91. package/library/types/src/components/VcSwitch/VcSwitch.vue.d.ts +151 -0
  92. package/library/types/src/components/VcTable/VcTable.types.d.ts +45 -0
  93. package/library/types/src/components/VcTable/VcTable.vue.d.ts +334 -0
  94. package/library/types/src/components/VcTable/tableOptions.d.ts +6 -0
  95. package/library/types/src/components/VcTabs/VcTabNav.vue.d.ts +54 -0
  96. package/library/types/src/components/VcTabs/VcTabPane.vue.d.ts +92 -0
  97. package/library/types/src/components/VcTabs/VcTabs.types.d.ts +14 -0
  98. package/library/types/src/components/VcTabs/VcTabs.vue.d.ts +62 -0
  99. package/library/types/src/components/VcTag/VcTag.types.d.ts +1 -0
  100. package/library/types/src/components/VcTag/VcTag.vue.d.ts +99 -0
  101. package/library/types/src/components/VcTagInput/VcTagInput.vue.d.ts +290 -0
  102. package/library/types/src/components/VcTimeInput/VcTimeInput.vue.d.ts +269 -0
  103. package/library/types/src/components/VcTree/VcTree.types.d.ts +36 -0
  104. package/library/types/src/components/VcTree/VcTree.vue.d.ts +209 -0
  105. package/library/types/src/components/VcTree/VcTreeNode.vue.d.ts +104 -0
  106. package/library/types/src/components/VcTree/VcTreeSelect.vue.d.ts +305 -0
  107. package/library/types/src/components/VcVerticalTabs/UiComponents/VerticalTabNav.vue.d.ts +54 -0
  108. package/library/types/src/components/VcVerticalTabs/VcVerticalTabs.vue.d.ts +76 -0
  109. package/library/types/src/components/VcViewSwitcher/VcViewSwitcher.vue.d.ts +74 -0
  110. package/library/types/src/components/VcWizard/VcSummaryProgress.vue.d.ts +55 -0
  111. package/library/types/src/components/VcWizard/VcSummaryStep.vue.d.ts +70 -0
  112. package/library/types/src/components/VcWizard/VcWizard.types.d.ts +15 -0
  113. package/library/types/src/components/VcWizard/VcWizard.vue.d.ts +157 -0
  114. package/library/types/src/components/VcWizard/VcWizardNavigation.vue.d.ts +110 -0
  115. package/library/types/src/components/VcWizard/VcWizardSummary.vue.d.ts +47 -0
  116. package/library/types/src/components/VcWizard/VcWizardTransition.vue.d.ts +83 -0
  117. package/library/types/src/components/index.d.ts +43 -0
  118. package/library/types/src/directives/resize.d.ts +6 -0
  119. package/library/types/src/entry.d.ts +2 -0
  120. package/library/types/src/entry.esm.d.ts +4 -0
  121. package/library/types/src/env.d.ts +18 -0
  122. package/library/types/src/localization/Localization.types.d.ts +17 -0
  123. package/library/types/src/localization/index.d.ts +9 -0
  124. package/library/types/src/mixins/common/appendTo.mixin.d.ts +19 -0
  125. package/library/types/src/mixins/defaultComponent.mixin.d.ts +14 -0
  126. package/library/types/src/mixins/input/baseInput.mixin.d.ts +100 -0
  127. package/library/types/src/mixins/input/color.mixin.d.ts +33 -0
  128. package/library/types/src/mixins/input/error.mixin.d.ts +23 -0
  129. package/library/types/src/mixins/input/input.mixin.d.ts +146 -0
  130. package/library/types/src/mixins/input/label.mixin.d.ts +52 -0
  131. package/library/types/src/mixins/optionMethods.mixin.d.ts +38 -0
  132. package/library/types/src/mixins/table/tableProps.mixin.d.ts +108 -0
  133. package/library/types/src/theme/index.d.ts +1 -0
  134. package/library/types/src/theme/theme.types.d.ts +6 -0
  135. package/library/types/src/types/AppendToTarget.types.d.ts +1 -0
  136. package/library/types/src/types/Entry.types.d.ts +6 -0
  137. package/library/types/src/types/OptionAndConfig.types.d.ts +23 -0
  138. package/library/types/src/types/VueGeneric.types.d.ts +1 -0
  139. package/library/types/src/utils/DomHandler.d.ts +5 -0
  140. package/library/types/src/utils/UniqueComponentId.d.ts +1 -0
  141. package/library/types/src/utils/ZIndexUtils.d.ts +12 -0
  142. package/library/types/src/utils/helpers.d.ts +6 -0
  143. package/library/types/src/utils/isValidTime.d.ts +2 -0
  144. package/package.json +66 -0
  145. package/src/assets/element/index.scss +161 -0
  146. package/src/assets/sass/main/_icons.scss +36 -0
  147. package/src/assets/sass/main/_loading.scss +51 -0
  148. package/src/assets/sass/main/_mixins.scss +339 -0
  149. package/src/assets/sass/main/_typography.scss +29 -0
  150. package/src/assets/sass/main.scss +9 -0
  151. package/src/components/VcButton/VcButton.scss +190 -0
  152. package/src/components/VcButton/VcButton.vue +117 -0
  153. package/src/components/VcButton/VcButtonIcon.scss +100 -0
  154. package/src/components/VcButton/VcButtonIcon.vue +97 -0
  155. package/src/components/VcCard/VcCard.vue +53 -0
  156. package/src/components/VcCheckbox/VcCheckbox.scss +66 -0
  157. package/src/components/VcCheckbox/VcCheckbox.vue +99 -0
  158. package/src/components/VcCheckbox/VcCheckboxGroupEl.vue +18 -0
  159. package/src/components/VcCheckboxGroup/VcCheckboxGroup.vue +164 -0
  160. package/src/components/VcCollapse/VcCollapse.vue +70 -0
  161. package/src/components/VcCollapse/VcCollapseItem.vue +229 -0
  162. package/src/components/VcCollapse/VcCollapseTransition.vue +78 -0
  163. package/src/components/VcColorPicker/ColorPicker/ColorPicker.vue +192 -0
  164. package/src/components/VcColorPicker/ColorPicker/Hue.vue +130 -0
  165. package/src/components/VcColorPicker/ColorPicker/Saturation.vue +146 -0
  166. package/src/components/VcColorPicker/VcColorPicker.vue +140 -0
  167. package/src/components/VcDatetimeRangePicker/VcDatetimeRangePicker.vue +474 -0
  168. package/src/components/VcDelimitedList/VcDelimitedList.vue +223 -0
  169. package/src/components/VcExtendedDatetimeRangePicker/ExtendedDatetimeRangePickerPart.vue +166 -0
  170. package/src/components/VcExtendedDatetimeRangePicker/ExtendedDatetimeRangePickerRelative.vue +180 -0
  171. package/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue +178 -0
  172. package/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePickerQuickOptionsSelection.vue +128 -0
  173. package/src/components/VcFileUploader/VcFileUploader.vue +324 -0
  174. package/src/components/VcForm/Styles/VcInputLabel.scss +24 -0
  175. package/src/components/VcForm/UiComponents/VcInputError.vue +31 -0
  176. package/src/components/VcForm/UiComponents/VcInputLabel.vue +67 -0
  177. package/src/components/VcForm/VcForm.vue +88 -0
  178. package/src/components/VcForm/VcFormItem.vue +115 -0
  179. package/src/components/VcHyperLink/VcHyperLink.vue +83 -0
  180. package/src/components/VcIconPicker/VcIconPicker.vue +142 -0
  181. package/src/components/VcInput/VcInput.vue +220 -0
  182. package/src/components/VcInputNumber/VcInputNumber.vue +128 -0
  183. package/src/components/VcLoading/Loaders/Circles.vue +100 -0
  184. package/src/components/VcLoading/Loaders/LdsSpinner.vue +52 -0
  185. package/src/components/VcLoading/Loaders/LoadIcon.vue +56 -0
  186. package/src/components/VcLoading/Loaders/Stretch.vue +82 -0
  187. package/src/components/VcLoading/VcLoading.vue +159 -0
  188. package/src/components/VcModal/VcModal.scss +227 -0
  189. package/src/components/VcModal/VcModal.vue +384 -0
  190. package/src/components/VcNotification/VcNotification.vue +302 -0
  191. package/src/components/VcNotification/VcNotificationMessage.vue +119 -0
  192. package/src/components/VcPagination/VcPagination.vue +175 -0
  193. package/src/components/VcPagination/VcPaginationButton.vue +37 -0
  194. package/src/components/VcPopover/VcPopover.vue +186 -0
  195. package/src/components/VcProgress/VcProgress.vue +235 -0
  196. package/src/components/VcRadio/VcRadio.scss +59 -0
  197. package/src/components/VcRadio/VcRadio.vue +89 -0
  198. package/src/components/VcRadioGroup/VcRadioGroup.vue +146 -0
  199. package/src/components/VcRadioTabs/UiComponents/VcRadioTabsNav.vue +128 -0
  200. package/src/components/VcRadioTabs/VcRadioTabs.vue +151 -0
  201. package/src/components/VcSelect/VcSelect.scss +135 -0
  202. package/src/components/VcSelect/VcSelect.vue +191 -0
  203. package/src/components/VcSkeletonLoader/Loaders/Card.vue +79 -0
  204. package/src/components/VcSkeletonLoader/Loaders/Circle.vue +45 -0
  205. package/src/components/VcSkeletonLoader/Loaders/Row.vue +36 -0
  206. package/src/components/VcSkeletonLoader/Loaders/Square.vue +44 -0
  207. package/src/components/VcSkeletonLoader/Loaders/Text.vue +42 -0
  208. package/src/components/VcSkeletonLoader/VcSkeletonLoader.vue +111 -0
  209. package/src/components/VcSoundplayer/VcSoundPlayer.vue +497 -0
  210. package/src/components/VcSplitButton/VcSplitButton.vue +338 -0
  211. package/src/components/VcSwitch/VcSwitch.vue +352 -0
  212. package/src/components/VcTable/VcTable.vue +869 -0
  213. package/src/components/VcTabs/VcTabNav.scss +120 -0
  214. package/src/components/VcTabs/VcTabNav.vue +203 -0
  215. package/src/components/VcTabs/VcTabPane.vue +128 -0
  216. package/src/components/VcTabs/VcTabs.vue +186 -0
  217. package/src/components/VcTag/VcTag.vue +186 -0
  218. package/src/components/VcTagInput/VcTagInput.vue +280 -0
  219. package/src/components/VcTagInput/VcTagInputStyle.scss +224 -0
  220. package/src/components/VcTimeInput/VcTimeInput.vue +441 -0
  221. package/src/components/VcTree/VcTree.vue +410 -0
  222. package/src/components/VcTree/VcTreeNode.vue +283 -0
  223. package/src/components/VcTree/VcTreeSelect.vue +472 -0
  224. package/src/components/VcVerticalTabs/UiComponents/VerticalTabNav.vue +99 -0
  225. package/src/components/VcVerticalTabs/VcVerticalTabs.vue +125 -0
  226. package/src/components/VcViewSwitcher/VcViewSwitcher.vue +137 -0
  227. package/src/components/VcWizard/VcSummaryProgress.vue +193 -0
  228. package/src/components/VcWizard/VcSummaryStep.vue +172 -0
  229. package/src/components/VcWizard/VcWizard.vue +292 -0
  230. package/src/components/VcWizard/VcWizardNavigation.vue +196 -0
  231. package/src/components/VcWizard/VcWizardSummary.vue +73 -0
  232. package/src/components/VcWizard/VcWizardTransition.vue +119 -0
  233. package/src/theme/index.ts +47 -0
  234. package/src/theme/tailwindConfig.js +143 -0
  235. package/src/theme/tailwindScheme.js +9 -0
  236. package/src/theme/theme.types.ts +6 -0
  237. package/src/theme/themes.json +130 -0
@@ -0,0 +1,869 @@
1
+ <template>
2
+ <div class="vc-table__container">
3
+ <div class="vc-table__header">
4
+ <slot name="header">
5
+ <div
6
+ v-if="withPagination && perPageOptions.length"
7
+ class="vc-table__perpage"
8
+ >
9
+ <VcSelect
10
+ v-model="pagination.perPage"
11
+ :options="perPageOptions"
12
+ />
13
+ </div>
14
+ <div
15
+ v-if="$slots['header-actions']"
16
+ class="vc-table__header-actions"
17
+ >
18
+ <slot name="header-actions" />
19
+ </div>
20
+ </slot>
21
+ </div>
22
+ <div
23
+ :class="[{ 'shadow-table rounded-md': hasFooter }, wrapperClass]"
24
+ >
25
+ <div class="vc-table-wrapper">
26
+ <table
27
+ class="vc-table"
28
+ :class="[
29
+ hasFooter ? 'vc-table--with-footer' : 'vc-table--without-footer',
30
+ { 'w-full': withPagination },
31
+ { 'vc-table--small': compact },
32
+ { 'vc-table--striped': stripe },
33
+ tableClass
34
+ ]"
35
+ >
36
+ <thead class="vc-table-header">
37
+ <tr>
38
+ <th
39
+ v-if="showSelection"
40
+ ref="headerChecked"
41
+ class="selection-col relative"
42
+ >
43
+ <div class="selection-col-content">
44
+ <VcCheckbox
45
+ :model-value="headerChecked"
46
+ :indeterminate="isIndeterminate"
47
+ @change="onChangeAll"
48
+ />
49
+ <div
50
+ v-if="!!$slots['checked-tooltip'] && localOptions.some((el) => el.selected)"
51
+ class="checked-tooltip"
52
+ :style="setPositionForTooltip"
53
+ >
54
+ <slot name="checked-tooltip" />
55
+ </div>
56
+ </div>
57
+ </th>
58
+ <th
59
+ v-if="expandableRow"
60
+ class="expandable-td"
61
+ />
62
+ <th
63
+ v-for="(column, index) in columns"
64
+ :key="index"
65
+ :style="setColumnStyles(column)"
66
+ >
67
+ <div
68
+ :class="`justify-${gettingFlexAlignment(column.columnAlignment)}`"
69
+ class="vc-table-slot"
70
+ >
71
+ <slot
72
+ :name="column.columnItemKey"
73
+ :column="column"
74
+ >
75
+ <div
76
+ class="vc-table-column-header select-none"
77
+ @click.stop="handleSortClick(column)"
78
+ >
79
+ <i
80
+ :class="column.columnItemIcon"
81
+ class="vc-table-column-icon"
82
+ />
83
+ <span :class="column.columnClasses">
84
+ {{ gettingColumnItemData(column) }}
85
+ </span>
86
+ <span
87
+ v-if="isSortableColumn(column)"
88
+ class="header-sort-wrapper"
89
+ >
90
+ <i
91
+ :class="isActiveSortColumn(column, 'asc')"
92
+ class="sort-caret ascending"
93
+ @click.stop="handleSortClick(column, 'asc')"
94
+ />
95
+ <i
96
+ :class="isActiveSortColumn(column, 'desc')"
97
+ class="sort-caret descending"
98
+ @click.stop="handleSortClick(column, 'desc')"
99
+ />
100
+ </span>
101
+ </div>
102
+ </slot>
103
+ </div>
104
+ </th>
105
+ <th
106
+ v-if="showActionsColumn"
107
+ :class="actionsColumnConfig.classes"
108
+ :style="actionsColumnStyles"
109
+ >
110
+ <slot name="actions-column-header">
111
+ <div class="vc-table-slot justify-center">
112
+ <div class="vc-table-column-header">
113
+ <i
114
+ :class="actionsColumnConfig.icon"
115
+ class="vc-table-column-icon"
116
+ />
117
+ <span>
118
+ {{ actionsColumnConfig.columnName }}
119
+ </span>
120
+ </div>
121
+ </div>
122
+ </slot>
123
+ </th>
124
+ </tr>
125
+ </thead>
126
+ <tbody class="vc-table-body">
127
+ <template v-if="$slots['prepend-row']">
128
+ <slot
129
+ name="prepend-row"
130
+ :columns="columns"
131
+ />
132
+ </template>
133
+ <template
134
+ v-for="(option, index) in visibleOptions"
135
+ :key="`tr-${option}`"
136
+ >
137
+ <tr
138
+ :class="[{
139
+ 'selected': rowSelectable && (selectedRow === index)
140
+ }, getRowClass(option, index)]"
141
+ @click="onRowClick(option, index)"
142
+ >
143
+ <td
144
+ v-if="showSelection"
145
+ class="selection-col"
146
+ >
147
+ <div class="selection-col-content">
148
+ <VcCheckbox
149
+ :model-value="!!option.selected"
150
+ @change="onChangeRow(option)"
151
+ />
152
+ </div>
153
+ </td>
154
+ <td
155
+ v-if="expandableRow"
156
+ class="flex items-center justify-center expandable-td"
157
+ >
158
+ <i
159
+ class="vc-icon-down icon-expandable p-1"
160
+ :class="{ 'icon-expandable-active': opened.includes(index) }"
161
+ @click="expandableAction(index)"
162
+ />
163
+ </td>
164
+ <td
165
+ v-for="(rowColumn, rowIndex) in columns"
166
+ :key="`column-${index}-${rowIndex}`"
167
+ :style="setColumnStyles(rowColumn)"
168
+ >
169
+ <div
170
+ :class="`justify-${gettingFlexAlignment(rowColumn.rowItemAlignment)}`"
171
+ class="vc-table-slot"
172
+ >
173
+ <slot
174
+ :name="rowColumn.rowItemKeyKey"
175
+ :row="option"
176
+ :index="index"
177
+ >
178
+ {{ gettingRowItemData(option, rowColumn) }}
179
+ </slot>
180
+ </div>
181
+ </td>
182
+ <td
183
+ v-if="showActionsColumn"
184
+ :style="actionsColumnStyles"
185
+ >
186
+ <slot
187
+ name="actions-column"
188
+ :row="option"
189
+ :index="index"
190
+ />
191
+ </td>
192
+ </tr>
193
+ <tr
194
+ v-if="expandableRow && opened.includes(index)"
195
+ >
196
+ <td :colspan="colspanNumber">
197
+ <slot
198
+ name="expanded-content"
199
+ :row="option"
200
+ />
201
+ </td>
202
+ </tr>
203
+ </template>
204
+ <slot
205
+ v-if="!tableOptions.length"
206
+ name="empty-data"
207
+ >
208
+ <tr class="empty-row">
209
+ <td :colspan="columns.length + (+showActionsColumn)">
210
+ <div class="vc-table__empty-block">
211
+ {{ emptyDataText }}
212
+ </div>
213
+ </td>
214
+ </tr>
215
+ </slot>
216
+ <tr
217
+ v-if="lazyLoadingData && !withPagination"
218
+ v-show="!loading"
219
+ ref="loadMoreTrigger"
220
+ class="vc-table__load-trigger"
221
+ >
222
+ <td :colspan="columns.length" />
223
+ </tr>
224
+ </tbody>
225
+ </table>
226
+ </div>
227
+ <div
228
+ v-if="hasFooter"
229
+ class="vc-table-footer"
230
+ >
231
+ <slot name="table-footer">
232
+ <div
233
+ v-if="isPaginationView"
234
+ class="vc-table-pagination"
235
+ >
236
+ <VcPagination
237
+ v-model="pagination.currentPage"
238
+ :per-page="pagination.perPage"
239
+ :total="pagination.total"
240
+ :label="pagesLabelText"
241
+ />
242
+ </div>
243
+ </slot>
244
+ </div>
245
+ </div>
246
+ <VcLoading
247
+ :active="loading"
248
+ :loader="loaderType"
249
+ />
250
+ </div>
251
+ </template>
252
+
253
+ <script lang="ts">
254
+ /* eslint-disable @typescript-eslint/no-explicit-any */
255
+ import { defineComponent, PropType } from 'vue'
256
+ import {
257
+ OptionType,
258
+ Alignment,
259
+ ColumnTypeItem,
260
+ OptionObjType,
261
+ ConfigType,
262
+ PaginationProp,
263
+ ActionsColumnType
264
+ } from './VcTable.types'
265
+ import VcCheckbox from '@/components/VcCheckbox/VcCheckbox.vue'
266
+ import cloneDeep from 'lodash/cloneDeep'
267
+ import { convertToUnit, resolveFieldData } from '@/utils/helpers'
268
+ import tablePropsMixin from '@/mixins/table/tableProps.mixin'
269
+ import VcLoading from '@/components/VcLoading/VcLoading.vue'
270
+ import { VcLoadingType } from '@/components/VcLoading/VcLoading.types'
271
+ import {
272
+ DEFAULT_PAGINATION,
273
+ DEFAULT_PER_PAGE_OPTIONS,
274
+ SORT_TYPE
275
+ } from './tableOptions'
276
+ import VcPagination from '@/components/VcPagination/VcPagination.vue'
277
+ import VcSelect from '@/components/VcSelect/VcSelect.vue'
278
+
279
+ export default defineComponent({
280
+ name: 'VcTable',
281
+ components: {
282
+ VcSelect,
283
+ VcPagination,
284
+ VcLoading,
285
+ VcCheckbox
286
+ },
287
+ mixins: [tablePropsMixin],
288
+ inheritAttrs: false,
289
+ props: {
290
+ withPagination: {
291
+ type: Boolean,
292
+ default: false
293
+ },
294
+ externalPaginate: {
295
+ type: Object as PropType<PaginationProp>,
296
+ default: undefined
297
+ },
298
+ perPageOptions: {
299
+ type: Array as PropType<number[]>,
300
+ default: DEFAULT_PER_PAGE_OPTIONS
301
+ },
302
+ perPageText: {
303
+ type: String,
304
+ default: ''
305
+ },
306
+ isServerData: {
307
+ type: Boolean,
308
+ default: false
309
+ },
310
+ pagesLabel: {
311
+ type: String,
312
+ default: ''
313
+ },
314
+ loading: {
315
+ type: Boolean,
316
+ default: false
317
+ },
318
+ loaderType: {
319
+ type: String as PropType<VcLoadingType>,
320
+ default: 'lds-spinner'
321
+ },
322
+ lazyLoadingData: {
323
+ type: Boolean,
324
+ default: false
325
+ },
326
+ compact: {
327
+ type: Boolean,
328
+ default: false
329
+ },
330
+ stripe: {
331
+ type: Boolean,
332
+ default: false
333
+ },
334
+ showActionsColumn: {
335
+ type: Boolean,
336
+ default: false
337
+ },
338
+ actionsColumn: {
339
+ type: Object as PropType<ActionsColumnType>,
340
+ default: () => ({
341
+ width: '120px',
342
+ columnName: 'Actions',
343
+ icon: 'vc-icon-edit-pencil',
344
+ minWidth: '100px',
345
+ maxWidth: 'auto'
346
+ })
347
+ },
348
+ rowClassName: {
349
+ type: [String, Function],
350
+ default: undefined
351
+ }
352
+ },
353
+ emits: [
354
+ 'on-row-click',
355
+ 'handle-selection-change',
356
+ 'handle-sort',
357
+ 'update:externalPaginate',
358
+ 'update:currentPage',
359
+ 'load-more'
360
+ ],
361
+ data () {
362
+ return {
363
+ localOptions: [] as OptionType,
364
+ observer: null as null | MutationObserver,
365
+ dir: 'ltr' as string,
366
+ rowOpened: false as boolean,
367
+ opened: [] as number[],
368
+ selectedRow: null as null | number,
369
+ sortBy: '',
370
+ sortOrder: '',
371
+ customSortFunction: undefined as undefined | any,
372
+ localPagination: { ...DEFAULT_PAGINATION },
373
+ viewObserver: null as null | IntersectionObserver
374
+ }
375
+ },
376
+ computed: {
377
+ actionsColumnConfig () {
378
+ return { ...this.actionsColumn }
379
+ },
380
+ actionsColumnStyles () {
381
+ if (this.showActionsColumn) {
382
+ const { width, minWidth, maxWidth } = this.actionsColumn
383
+ return this.setColumnStyles({ width, minWidth, maxWidth })
384
+ }
385
+ return {}
386
+ },
387
+ hasFooter () {
388
+ return !!(this.withPagination || this.$slots['table-footer'])
389
+ },
390
+ isPaginationView () {
391
+ return !!(this.withPagination && this.tableOptions.length)
392
+ },
393
+ visibleOptions () {
394
+ if (!this.withPagination || this.isServerData) {
395
+ return this.tableOptions
396
+ }
397
+ return this.tableOptions.slice(this.start, this.end)
398
+ },
399
+ pagination () {
400
+ if (this.externalPaginate) {
401
+ return this.externalPaginate
402
+ } else {
403
+ return this.localPagination
404
+ }
405
+ },
406
+ start () {
407
+ return Math.max(0, (this.pagination.currentPage * this.pagination.perPage) - this.pagination.perPage)
408
+ },
409
+ end () {
410
+ return this.start + this.pagination.perPage
411
+ },
412
+ setPositionForTooltip () {
413
+ const element = this.$refs.headerChecked as HTMLElement
414
+ const height = element.offsetHeight
415
+ const align = this.dir === 'ltr' ? 'left' : 'right'
416
+ const _checkBox = element.querySelector('.vc-checkbox .el-checkbox__input') as HTMLElement
417
+ return {
418
+ [align]: `${_checkBox.offsetLeft + _checkBox.offsetWidth + 14}px`,
419
+ top: '50%',
420
+ transform: 'translateY(-50%)',
421
+ height: `${height - 6}px`
422
+ }
423
+ },
424
+ colspanNumber () {
425
+ let numberOfColumnSpan = this.columns?.length
426
+ if (this.expandableRow && this.showSelection) {
427
+ numberOfColumnSpan++
428
+ }
429
+ if (this.expandableRow) {
430
+ numberOfColumnSpan++
431
+ }
432
+
433
+ return numberOfColumnSpan
434
+ },
435
+ headerChecked: {
436
+ get () {
437
+ return this.localOptions.every(el => !!el.selected)
438
+ },
439
+ set (val: boolean) {
440
+ return val
441
+ }
442
+ },
443
+ isIndeterminate () {
444
+ return this.localOptions.some(el => !el.selected) && this.localOptions.some(el => el.selected)
445
+ },
446
+ selectedOptions () {
447
+ if (!this.showSelection) {
448
+ return []
449
+ }
450
+ return this.localOptions.filter(i => i.selected)
451
+ },
452
+ tableOptions () {
453
+ if (!this.sortBy || !this.sortOrder) {
454
+ return this.localOptions
455
+ } else {
456
+ const _options = [...this.localOptions]
457
+ if (!this.customSortFunction) {
458
+ return _options.sort(this.defaultSortMethod)
459
+ } else {
460
+ return _options.sort((a, b) => {
461
+ const val1 = this.sortOrder === 'desc' ? b : a
462
+ const val2 = this.sortOrder === 'desc' ? a : b
463
+ return this.customSortFunction(val1, val2)
464
+ })
465
+ }
466
+ }
467
+ },
468
+ perPageMessage () {
469
+ return this.perPageText ? this.perPageText : this.$tVU.t('table.pagination.per.page')
470
+ },
471
+ pagesLabelText () {
472
+ return this.pagesLabel ? this.pagesLabel : this.$tVU.t('table.pagination.pages')
473
+ }
474
+ },
475
+ watch: {
476
+ options: {
477
+ handler (val) {
478
+ this.localOptions = cloneDeep(val)
479
+ this.localPagination.total = this.externalPaginate ? this.externalPaginate.total : val.length
480
+ this.opened = []
481
+ },
482
+ immediate: true
483
+ },
484
+ 'pagination.currentPage' () {
485
+ this.$emit('update:currentPage', { ...this.pagination })
486
+ },
487
+ 'pagination.perPage' () {
488
+ this.pagination.currentPage = 1
489
+ }
490
+ },
491
+ mounted () {
492
+ if (this.sortingOrderDefault) {
493
+ this.sortBy = this.sortingOrderDefault.columnName
494
+ this.sortOrder = this.sortingOrderDefault.order
495
+ }
496
+ if (this.showSelection) {
497
+ this.localOptions = this.localOptions.map(el => {
498
+ el.selected = false
499
+ return el
500
+ })
501
+ const dir = document.documentElement.getAttribute('dir')
502
+ if (dir) {
503
+ this.dir = dir
504
+ }
505
+
506
+ this.initObserver()
507
+ }
508
+ if (this.lazyLoadingData && !this.withPagination) {
509
+ if (this.$refs.loadMoreTrigger) {
510
+ this.viewObserver = new IntersectionObserver(() => {
511
+ this.$emit('load-more', true)
512
+ })
513
+ this.viewObserver.observe(this.$refs.loadMoreTrigger as Element)
514
+ }
515
+ }
516
+ },
517
+ beforeUnmount () {
518
+ if (this.observer) {
519
+ this.observer.disconnect()
520
+ }
521
+ if (this.viewObserver) {
522
+ this.viewObserver.disconnect()
523
+ }
524
+ },
525
+ methods: {
526
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
527
+ defaultSortMethod (data1: any, data2: any) {
528
+ const v1 = resolveFieldData(data1, this.sortBy)
529
+ const v2 = resolveFieldData(data2, this.sortBy)
530
+ let result = null as null | number
531
+ if (v1 == null && v2 != null) {
532
+ result = -1
533
+ } else if (v1 != null && v2 == null) {
534
+ result = 1
535
+ } else if (v1 == null && v2 == null) {
536
+ result = 0
537
+ } else if (typeof v1 === 'string' && typeof v2 === 'string') {
538
+ result = v1.localeCompare(v2, undefined, { numeric: true })
539
+ } else {
540
+ result = (v1 < v2) ? -1 : (v1 > v2) ? 1 : 0
541
+ }
542
+ return result * SORT_TYPE[this.sortOrder]
543
+ },
544
+ isActiveSortColumn (column: ColumnTypeItem, order: string): string | undefined {
545
+ if (!this.isSortableColumn(column) || order !== this.sortOrder) {
546
+ return ''
547
+ }
548
+ if (column.sortBy === this.sortBy) {
549
+ return 'text-active-elements'
550
+ }
551
+ },
552
+ isSortableColumn (column: ColumnTypeItem): boolean {
553
+ return !!(column.sortBy || column.sortableFunction)
554
+ },
555
+ handleSortClick (column: ColumnTypeItem, order = '') {
556
+ if (this.isSortableColumn(column)) {
557
+ const oldSort = this.sortBy
558
+ this.sortBy = column.sortBy || column.columnItemKey
559
+ this.customSortFunction = column.sortableFunction
560
+ if (order) {
561
+ this.sortOrder = order
562
+ } else {
563
+ if (oldSort !== this.sortBy) {
564
+ this.sortOrder = ''
565
+ }
566
+ this.toggleOrder()
567
+ }
568
+ this.$emit('handle-sort', {
569
+ sortBy: this.sortBy,
570
+ order: this.sortOrder
571
+ })
572
+ }
573
+ },
574
+ toggleOrder (): void {
575
+ if (this.sortOrder === 'asc') {
576
+ this.sortOrder = 'desc'
577
+ } else if (this.sortOrder === 'desc') {
578
+ this.sortOrder = ''
579
+ } else {
580
+ this.sortOrder = 'asc'
581
+ }
582
+ },
583
+ onRowClick (option: OptionObjType, index: number): void {
584
+ this.selectedRow = index
585
+ if (this.rowUnselect) {
586
+ this.selectedRow = this.selectedRow == null ? index : null
587
+ }
588
+ this.$emit('on-row-click', option, index)
589
+ },
590
+ gettingFlexAlignment (columnAlignment: Alignment = 'center'): string {
591
+ const alignments = {
592
+ left: 'start',
593
+ center: 'center',
594
+ right: 'end'
595
+ }
596
+
597
+ return alignments[columnAlignment]
598
+ },
599
+ setColumnStyles (column: ColumnTypeItem | ActionsColumnType): { [key: string]: string | undefined } {
600
+ return {
601
+ minWidth: convertToUnit(column.minWidth),
602
+ maxWidth: convertToUnit(column.maxWidth),
603
+ width: convertToUnit(column.width)
604
+ }
605
+ },
606
+ gettingColumnItemData (column: ColumnTypeItem): string {
607
+ return column.columnItemLabel
608
+ },
609
+ gettingRowItemData (option: OptionObjType, rowColumn: ColumnTypeItem): string {
610
+ const labelKey = rowColumn.rowItemLabelKey ? rowColumn.rowItemLabelKey : rowColumn.columnItemLabel
611
+ return option[labelKey] as string
612
+ },
613
+ setOptionChecked (option: OptionObjType, actionValue: boolean) {
614
+ const optionUniqueKey = (this.config as ConfigType).optionUniqueKey as string
615
+ const equalItem = this.localOptions.find((localOption: OptionObjType) => localOption[optionUniqueKey] === option[optionUniqueKey])
616
+ if (equalItem) {
617
+ equalItem.selected = actionValue
618
+ }
619
+ },
620
+ setBulkOptionChecked (optionArray: OptionType, actionValue: boolean) {
621
+ optionArray.forEach((option: OptionObjType) => {
622
+ this.setOptionChecked(option, actionValue)
623
+ })
624
+ },
625
+ onChangeAll (value: boolean) {
626
+ this.localOptions.map(el => {
627
+ el.selected = value
628
+ return el
629
+ })
630
+ this.onSelectionChange()
631
+ },
632
+ onChangeRow (option: any) {
633
+ option.selected = !option.selected
634
+ this.onSelectionChange()
635
+ },
636
+ onSelectionChange () {
637
+ this.$emit('handle-selection-change', this.selectedOptions)
638
+ },
639
+ initObserver () {
640
+ this.observer = new MutationObserver((mutationList) => {
641
+ if (!mutationList || !Object.keys(mutationList).length) {
642
+ return
643
+ }
644
+ if (mutationList[0].attributeName === 'dir') {
645
+ const dir = document.documentElement.getAttribute('dir')
646
+ if (dir) {
647
+ this.dir = dir
648
+ }
649
+ }
650
+ })
651
+
652
+ const elementNode = document.documentElement
653
+
654
+ this.observer.observe(elementNode, {
655
+ attributes: true,
656
+ childList: false,
657
+ subtree: false
658
+ })
659
+ },
660
+ expandableAction (rowIndex: number) {
661
+ const index = this.opened.indexOf(rowIndex)
662
+ if (index > -1) {
663
+ this.opened.splice(index, 1)
664
+ } else {
665
+ this.opened.push(rowIndex)
666
+ }
667
+ },
668
+ getRowClass (row: any, index: number) {
669
+ if (typeof this.rowClassName === 'string') {
670
+ return this.rowClassName
671
+ } else if (typeof this.rowClassName === 'function') {
672
+ return this.rowClassName.call(null, {
673
+ row,
674
+ index
675
+ })
676
+ }
677
+ }
678
+ }
679
+ })
680
+ </script>
681
+
682
+ <style lang="scss" scoped>
683
+ .vc-table {
684
+ @apply w-full;
685
+ &--with-footer {
686
+ @apply rounded-t-md;
687
+ thead, tr {
688
+ @apply rounded-t-md overflow-hidden;
689
+ }
690
+ th:first-child {
691
+ @apply rounded-tl-md;
692
+ }
693
+ th:last-child {
694
+ @apply rounded-tr-md;
695
+ }
696
+ }
697
+
698
+ &--without-footer {
699
+ @apply shadow-table rounded-md overflow-hidden;
700
+ }
701
+
702
+ &-slot {
703
+ @apply flex items-center;
704
+ }
705
+
706
+ &-column-header {
707
+ @apply text-table-headings flex items-center;
708
+ }
709
+
710
+ &__header {
711
+ &:not(:empty) {
712
+ @apply mb-3 w-full flex items-center;
713
+ }
714
+ }
715
+
716
+ &__header-actions {
717
+ @apply flex-shrink-0 flex-grow;
718
+ }
719
+
720
+ &__perpage {
721
+ @apply flex-grow flex-shrink-0;
722
+ max-width: 140px;
723
+ }
724
+
725
+ &-pagination {
726
+ @apply py-3 px-4 border-t border-ui-lines bg-white;
727
+ }
728
+ &-footer {
729
+ @apply rounded-b-md overflow-hidden;
730
+ }
731
+
732
+ .selection-col {
733
+ @apply w-14;
734
+ .selection-col-content {
735
+ @apply flex justify-center items-center h-full w-full;
736
+ }
737
+ .vc-form-check {
738
+ @apply py-0;
739
+ min-height: 1rem;
740
+ }
741
+ }
742
+
743
+ tr.empty-row {
744
+ @apply bg-default-bg rounded-b-md;
745
+ td {
746
+ @apply rounded-b-md;
747
+ }
748
+ }
749
+
750
+ &__empty-block {
751
+ @apply w-full flex justify-center items-center text-default-text text-sm font-semibold;
752
+ }
753
+
754
+ &-column-icon {
755
+ @apply text-lg;
756
+ }
757
+
758
+ &-column-icon, [dir='ltr'] &-column-icon {
759
+ @apply mr-1 ml-0;
760
+ }
761
+
762
+ [dir='rtl'] &-column-icon {
763
+ @apply mr-0 ml-1;
764
+ }
765
+
766
+ td:not(:last-child), th:not(:last-child) {
767
+ @apply border-r border-ui-lines;
768
+ }
769
+
770
+ .header-sort-wrapper {
771
+ @apply inline-flex flex-col items-center cursor-pointer relative align-middle text-inactive-elements w-6 h-4;
772
+ overflow: initial;
773
+
774
+ .sort-caret {
775
+ @apply w-0 h-0 absolute;
776
+ border: solid 5px transparent;
777
+ left: 7px;
778
+
779
+ &.ascending {
780
+ border-bottom-color: currentColor;
781
+ top: -5px;
782
+ }
783
+
784
+ &.descending {
785
+ border-top-color: currentColor;
786
+ bottom: -3px;
787
+ }
788
+ }
789
+ }
790
+
791
+ &__load-trigger {
792
+ td {
793
+ padding: 0 !important;
794
+ }
795
+ }
796
+
797
+ th, td {
798
+ @apply p-2;
799
+ }
800
+
801
+ .expandable-td {
802
+ @apply h-full;
803
+ }
804
+
805
+ thead tr {
806
+ @apply border-b border-ui-lines;
807
+ }
808
+
809
+ tr:not(:first-child) {
810
+ @apply border-t border-ui-lines;
811
+ }
812
+
813
+ tr {
814
+ @apply bg-white;
815
+ }
816
+
817
+ &.vc-table--small {
818
+ @apply text-sm;
819
+ .vc-table-column-icon {
820
+ @apply text-base;
821
+ }
822
+
823
+ th, td {
824
+ @apply py-1.5 px-1;
825
+ }
826
+ }
827
+
828
+ &.vc-table--striped {
829
+ tbody tr:nth-child(even) {
830
+ background-color: #fafafa;
831
+ }
832
+ }
833
+
834
+ tbody tr {
835
+ @apply transition-all duration-300 ease-in-out cursor-pointer;
836
+ &:hover {
837
+ @apply relative shadow-table-row;
838
+
839
+ }
840
+ }
841
+
842
+ .checked-tooltip {
843
+ @apply absolute flex items-center px-2;
844
+ background: linear-gradient(90deg, #FFFFFF 93.42%, rgba(255, 255, 255, 0) 100%);
845
+ }
846
+
847
+ .icon-expandable {
848
+ @apply transition duration-300 ease-in-out;
849
+ }
850
+
851
+ .icon-expandable-active {
852
+ @apply text-primary;
853
+ transform: rotate(180deg);
854
+ }
855
+
856
+ .icon-expandable:hover {
857
+ @apply transition duration-300 ease-in-out text-primary;
858
+ }
859
+ }
860
+ </style>
861
+ <style lang="scss">
862
+ [dir="rtl"] {
863
+ .vc-table {
864
+ td:not(:last-child), th:not(:last-child) {
865
+ @apply border-l border-r-0;
866
+ }
867
+ }
868
+ }
869
+ </style>