@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,324 @@
1
+ <template>
2
+ <div :style="setMaxWidth">
3
+ <VcInputLabel
4
+ :label="label"
5
+ :required="required"
6
+ :icon="icon"
7
+ :info-text="infoText"
8
+ :info-tooltip-width="infoTooltipWidth"
9
+ class="mb-2"
10
+ />
11
+ <div class="vc-input___file-uploader-wrapper">
12
+ <div class="vc-input__file-uploader-wrapper-label">
13
+ <VcButton
14
+ :type="buttonType"
15
+ :color="buttonColor"
16
+ :icon="buttonIcon"
17
+ :size="buttonSize"
18
+ @click="triggerInputClick"
19
+ >
20
+ {{ uploadButtonText }}
21
+ </VcButton>
22
+ </div>
23
+
24
+ <input
25
+ :id="id"
26
+ ref="inputUploader"
27
+ hidden
28
+ :name="id"
29
+ :accept="accept"
30
+ :multiple="multiple"
31
+ :data-test="dataTestName"
32
+ :disabled="disabled"
33
+ :maxlength="maxLength"
34
+ class="vc-input__file-uploader-wrapper-input"
35
+ type="file"
36
+ @change="onFileChange"
37
+ >
38
+ </div>
39
+ <div
40
+ v-if="!items.length"
41
+ class="vc-input__message-wrapper"
42
+ >
43
+ <span class="vc-input__message-wrapper--text">
44
+ {{ noFilesSelectedText }}
45
+ </span>
46
+ </div>
47
+ <div
48
+ v-if="errorText"
49
+ class="vc-input__error-wrapper"
50
+ >
51
+ <span class="vc-input__error-wrapper--text">
52
+ {{ errorText }}
53
+ </span>
54
+ </div>
55
+ <div
56
+ v-if="showFileName && items.length"
57
+ class="mt-1"
58
+ >
59
+ <VcDelimitedList
60
+ :list="items"
61
+ :limit="maxLength"
62
+ trigger="hover"
63
+ popover-max-width="400"
64
+ separator=""
65
+ >
66
+ <template #list-item="{item}">
67
+ <VcTag
68
+ :label="item.name"
69
+ :max-content="tagMaxContentWidth"
70
+ :icon="tagIcon"
71
+ closable
72
+ @on-close="onTagClose(item.id)"
73
+ />
74
+ </template>
75
+ <template #reference="{listLength}">
76
+ <VcTag
77
+ :label="`+ ${listLength}`"
78
+ />
79
+ </template>
80
+ <template #other-content="{list}">
81
+ <div
82
+ v-for="(item, index) in list"
83
+ :key="index"
84
+ class="flex items-center justify-start p-2"
85
+ >
86
+ <VcTag
87
+ :label="item.name"
88
+ :icon="tagIcon"
89
+ :max-content="tagMaxContentWidth"
90
+ closable
91
+ @on-close="onTagClose(item.id)"
92
+ />
93
+ </div>
94
+ </template>
95
+ </VcDelimitedList>
96
+ </div>
97
+ </div>
98
+ </template>
99
+
100
+ <script lang="ts">
101
+ import { defineComponent, PropType } from 'vue'
102
+ import { ButtonType, ButtonColor, ButtonSize } from '@/components/VcButton/VcButton.types'
103
+ import { VcDelimitedList, VcButton } from '@/components'
104
+ import VcTag from '@/components/VcTag/VcTag.vue'
105
+ import { FileUploaded } from './VcFileUploader.types'
106
+ import { getFileSize } from '@/utils/helpers'
107
+ import inputMixin from '@/mixins/input/input.mixin'
108
+ import errorMixin from '@/mixins/input/error.mixin'
109
+ import VcInputLabel from '@/components/VcForm/UiComponents/VcInputLabel.vue'
110
+ import labelMixin from '@/mixins/input/label.mixin'
111
+
112
+ const DEFAULT_BUTTON_SIZE = 'middle'
113
+ const DEFAULT_BUTTON_TYPE = 'default'
114
+ const DEFAULT_BUTTON_COLOR = 'primary'
115
+
116
+ export default defineComponent({
117
+ name: 'VcFileUploader',
118
+ components: {
119
+ VcTag,
120
+ VcInputLabel,
121
+ VcDelimitedList,
122
+ VcButton
123
+ },
124
+ mixins: [inputMixin, errorMixin, labelMixin],
125
+ props: {
126
+ files: {
127
+ type: Array,
128
+ default: () => []
129
+ },
130
+ modelValue: {
131
+ type: Array,
132
+ default: () => []
133
+ },
134
+ maxLength: {
135
+ type: Number,
136
+ default: Infinity
137
+ },
138
+ accept: {
139
+ type: String,
140
+ default: '*'
141
+ },
142
+ tagIcon: {
143
+ type: String,
144
+ default: 'vc-icon-confirm-action'
145
+ },
146
+ showFileName: {
147
+ type: Boolean,
148
+ default: true
149
+ },
150
+ multiple: {
151
+ type: Boolean,
152
+ default: false
153
+ },
154
+ noDataText: {
155
+ type: String,
156
+ default: ''
157
+ },
158
+ fileSizeLimit: {
159
+ type: Number,
160
+ default: null,
161
+ description: 'File size limit in bytes'
162
+ },
163
+ fileListSizeLimit: {
164
+ type: Number,
165
+ default: null,
166
+ description: 'Files list size limit in bytes'
167
+ },
168
+ buttonType: {
169
+ type: String as PropType<ButtonType>,
170
+ default: DEFAULT_BUTTON_TYPE
171
+ },
172
+ buttonIcon: {
173
+ type: String,
174
+ default: ''
175
+ },
176
+ buttonColor: {
177
+ type: String as PropType<ButtonColor>,
178
+ default: DEFAULT_BUTTON_COLOR
179
+ },
180
+ buttonSize: {
181
+ type: String as PropType<ButtonSize>,
182
+ default: DEFAULT_BUTTON_SIZE
183
+ },
184
+ buttonText: {
185
+ type: String,
186
+ default: ''
187
+ },
188
+ tagMaxContentWidth: {
189
+ type: String,
190
+ default: '200'
191
+ }
192
+ },
193
+ emits: ['update:modelValue', 'input'],
194
+ data () {
195
+ return {
196
+ items: [] as FileUploaded[],
197
+ innerErrorText: '' as string
198
+ }
199
+ },
200
+ computed: {
201
+ errorText () {
202
+ if (this.innerErrorText) {
203
+ return this.innerErrorText
204
+ }
205
+ return this.error
206
+ },
207
+ noFilesSelectedText () {
208
+ return this.noDataText ? this.noDataText : this.$tVU.t('uploader.no.files.selected')
209
+ },
210
+ uploadButtonText () {
211
+ return this.buttonText ? this.buttonText : this.$tVU.t('uploader.upload.file')
212
+ }
213
+ },
214
+ watch: {
215
+ modelValue (val: FileUploaded[] | FileList) {
216
+ this.parseFiles(val)
217
+ },
218
+ files: {
219
+ immediate: true,
220
+ handler (files: FileUploaded[] | FileList): void {
221
+ this.parseFiles(files)
222
+ }
223
+ }
224
+ },
225
+ methods: {
226
+ parseFiles (files: FileUploaded[] | FileList): void {
227
+ files = Array.from(files)
228
+
229
+ if (files.length && files.length > this.maxLength) {
230
+ files = files.slice(0, this.maxLength)
231
+ }
232
+
233
+ this.items = files.map((item: FileUploaded, index: number) => {
234
+ item.id = index
235
+ return item
236
+ })
237
+ },
238
+ onFileChange (e: Event): void {
239
+ this.innerErrorText = ''
240
+ const target = e.target as HTMLInputElement
241
+ const targetFiles = target?.files as FileList
242
+
243
+ if (target && targetFiles && targetFiles.length) {
244
+ let files = Array.from(targetFiles)
245
+
246
+ files = this.processFilesLength(files)
247
+ files = this.processFileSize(files)
248
+
249
+ if (this.$refs.inputUploader) {
250
+ const inputElement = this.$refs.inputUploader as HTMLInputElement
251
+ inputElement.value = ''
252
+ }
253
+
254
+ this.$emit('input', files)
255
+ this.$emit('update:modelValue', files)
256
+ }
257
+ },
258
+ processFilesLength (files: FileUploaded[]): FileUploaded[] {
259
+ if (this.multiple && files.length > this.maxLength) {
260
+ this.innerErrorText = this.$tVU.t('uploader.some.file.were.concat.files.limit')
261
+ return files.slice(0, this.maxLength)
262
+ }
263
+ return files
264
+ },
265
+ processFileSize (files: FileUploaded[]): FileUploaded[] {
266
+ if (this.multiple) {
267
+ const filesSizeSum = files.map((file: FileUploaded): number => file.size)
268
+ .reduce((sizeSum: number, a: number): number => sizeSum + a, 0)
269
+
270
+ if (this.fileListSizeLimit && filesSizeSum > this.fileListSizeLimit) {
271
+ const sizeToExceed = getFileSize(this.fileListSizeLimit)
272
+ this.innerErrorText = this.$tVU.t('uploader.file.size.sum.should.not.exceed', { value: sizeToExceed[0], measure: sizeToExceed[1] })
273
+ return []
274
+ }
275
+
276
+ if (this.fileSizeLimit) {
277
+ files = files.filter((file: FileUploaded): boolean => {
278
+ if (file.size > this.fileSizeLimit) {
279
+ this.innerErrorText = this.$tVU.t('uploader.some.files.were.concat.size.limit')
280
+ return false
281
+ }
282
+ return true
283
+ })
284
+ }
285
+
286
+ return files
287
+ } else {
288
+ if (!this.fileSizeLimit) return files
289
+
290
+ const limitSize = getFileSize(this.fileSizeLimit)
291
+ const file = files[0]
292
+ if (file && file.size > this.fileSizeLimit) {
293
+ const fileSize = getFileSize(file.size)
294
+ this.innerErrorText = this.$tVU.t('uploader.file.size.is.but.limit.is', { fileSize: fileSize[0], fileMeasure: fileSize[1], limitSize: limitSize[0], limitMeasure: limitSize[1] })
295
+ return []
296
+ }
297
+ return files
298
+ }
299
+ },
300
+ onTagClose (index: number): void {
301
+ this.innerErrorText = ''
302
+ const files = this.items.filter((item: FileUploaded) => item.id !== index)
303
+
304
+ this.$emit('input', files)
305
+ this.$emit('update:modelValue', files)
306
+ },
307
+ triggerInputClick (): void {
308
+ if (this.$refs.inputUploader && this.$refs.inputUploader instanceof HTMLElement) {
309
+ this.$refs.inputUploader.click()
310
+ }
311
+ }
312
+ }
313
+ })
314
+ </script>
315
+
316
+ <style lang="scss" scoped>
317
+ @import 'src/assets/sass/main/mixins';
318
+
319
+ .vc-input {
320
+ @include input;
321
+ @include fileUploader;
322
+ @include errorContainer;
323
+ }
324
+ </style>
@@ -0,0 +1,24 @@
1
+ .vc-input__label {
2
+ @apply flex w-full leading-none items-center;
3
+ &-wrapper {
4
+ @apply flex text-sm text-default-text font-normal flex-grow;
5
+ &--left-item {
6
+ @apply inline-flex;
7
+ &-icon {
8
+ @apply mr-2 leading-none rtl:mr-0 rtl:ml-2 text-icons;
9
+ }
10
+ }
11
+ &-label {
12
+ @apply text-sm text-default-text font-normal;
13
+ &__required-icon {
14
+ @apply text-primary-actions;
15
+ }
16
+ }
17
+ }
18
+ &-info {
19
+ @apply text-active-elements cursor-pointer;
20
+ }
21
+ &-actions {
22
+ @apply ltr:ml-2 rtl:mr-2;
23
+ }
24
+ }
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div class="vc-input__error-wrapper">
3
+ <span class="vc-input__error-wrapper--text">
4
+ {{ errorMessage }}
5
+ </span>
6
+ </div>
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import { defineComponent } from 'vue'
11
+
12
+ export default defineComponent({
13
+ name: 'VcInputError',
14
+ props: {
15
+ errorMessage: {
16
+ type: String,
17
+ default: ''
18
+ }
19
+ }
20
+ })
21
+ </script>
22
+
23
+ <style lang="scss">
24
+ .vc-input__error-wrapper {
25
+ @apply relative w-full text-xs leading-normal;
26
+ &--text {
27
+ @apply inline-flex flex-wrap text-destructive-actions text-xs
28
+ left-0 top-0 w-full overflow-hidden overflow-ellipsis whitespace-normal;
29
+ }
30
+ }
31
+ </style>
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <div class="vc-input__label">
3
+ <div class="vc-input__label-wrapper flex items-center">
4
+ <span
5
+ v-if="icon"
6
+ class="vc-input__label-wrapper--left-item"
7
+ >
8
+ <i
9
+ :class="icon"
10
+ class="icon-lg vc-input__label-wrapper--left-item-icon"
11
+ />
12
+ </span>
13
+ <span
14
+ v-if="label"
15
+ class="vc-input__label-wrapper-label"
16
+ >
17
+ {{ label }}
18
+ <span
19
+ v-if="required"
20
+ class="vc-input__label-wrapper-label__required-icon"
21
+ >
22
+ *
23
+ </span>
24
+ </span>
25
+ <VcPopover
26
+ v-if="infoText || $slots['info-text']"
27
+ trigger="hover"
28
+ :popover-width="infoTooltipWidth"
29
+ placement="top"
30
+ >
31
+ <template #reference>
32
+ <span class="vc-input__label-info px-1 flex items-center">
33
+ <i class="vc-icon-info icon-base" />
34
+ </span>
35
+ </template>
36
+ <div
37
+ class="label-info-text p-2 text-xs"
38
+ >
39
+ <slot name="info-text">
40
+ {{ infoText }}
41
+ </slot>
42
+ </div>
43
+ </VcPopover>
44
+ </div>
45
+ <span
46
+ v-if="$slots['label-action']"
47
+ class="vc-input__label-actions"
48
+ >
49
+ <slot name="label-action" />
50
+ </span>
51
+ </div>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import labelMixin from '@/mixins/input/label.mixin'
56
+ import VcPopover from '@/components/VcPopover/VcPopover.vue'
57
+
58
+ export default {
59
+ name: 'VcInputLabel',
60
+ components: { VcPopover },
61
+ mixins: [labelMixin]
62
+ }
63
+ </script>
64
+
65
+ <style lang="scss">
66
+ @import "../Styles/VcInputLabel";
67
+ </style>
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <el-form
3
+ ref="elForm"
4
+ :label-position="labelPosition"
5
+ :style="{ maxWidth: formMaxWidth }"
6
+ require-asterisk-position="right"
7
+ class="vc-form"
8
+ v-bind="$attrs"
9
+ >
10
+ <slot />
11
+ </el-form>
12
+ </template>
13
+
14
+ <script lang="ts">
15
+ import { defineComponent, PropType } from 'vue'
16
+ import { convertToUnit } from '@/utils/helpers'
17
+ import { ElForm } from 'element-plus'
18
+
19
+ type LabelPositionType = 'left' | 'right' | 'top'
20
+
21
+ export default defineComponent({
22
+ name: 'VcForm',
23
+ components: { ElForm },
24
+ props: {
25
+ labelPosition: {
26
+ type: String as PropType<LabelPositionType>,
27
+ default: 'top'
28
+ },
29
+ maxWidth: {
30
+ type: [String, Number],
31
+ default: '100%'
32
+ }
33
+ },
34
+ computed: {
35
+ formMaxWidth () {
36
+ return convertToUnit(this.maxWidth)
37
+ },
38
+ formElement () {
39
+ return this.$refs.elForm as typeof ElForm | undefined
40
+ }
41
+ },
42
+ methods: {
43
+ validate () {
44
+ return new Promise(resolve => {
45
+ if (!this.formElement) {
46
+ resolve({
47
+ isValid: true,
48
+ invalidFields: []
49
+ })
50
+ } else {
51
+ this.formElement.validate((isValid: boolean, invalidFields?: unknown) => {
52
+ resolve({
53
+ isValid,
54
+ invalidFields
55
+ })
56
+ })
57
+ }
58
+ })
59
+ },
60
+ validateField (field: string | string[]) {
61
+ return new Promise(resolve => {
62
+ if (!this.formElement) {
63
+ resolve({
64
+ isValid: true,
65
+ invalidFields: []
66
+ })
67
+ } else {
68
+ this.formElement.validateField(field, (isValid: boolean, invalidFields?: unknown) => {
69
+ resolve({
70
+ isValid,
71
+ invalidFields
72
+ })
73
+ })
74
+ }
75
+ })
76
+ },
77
+ resetFields (fields?: string | string[]) {
78
+ this.formElement?.resetFields(fields)
79
+ },
80
+ scrollToField (prop?: string) {
81
+ this.formElement?.scrollToField(prop)
82
+ },
83
+ clearValidate (props?: string | string[]) {
84
+ this.formElement?.clearValidate(props)
85
+ }
86
+ }
87
+ })
88
+ </script>
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <el-form-item
3
+ v-if="parentFormContext"
4
+ class="vc-form-item"
5
+ :rules="rules"
6
+ v-bind="$attrs"
7
+ >
8
+ <template #label>
9
+ <VcInputLabel
10
+ :label="label"
11
+ :icon="icon"
12
+ :required="isRequired"
13
+ :info-text="infoText"
14
+ :info-tooltip-width="infoTooltipWidth"
15
+ :class="{'mb-2': !parentFormContext}"
16
+ >
17
+ <template
18
+ v-if="$slots['label-action']"
19
+ #label-action
20
+ >
21
+ <slot name="label-action" />
22
+ </template>
23
+ </VcInputLabel>
24
+ </template>
25
+ <slot />
26
+ </el-form-item>
27
+ <template v-else>
28
+ <VcInputLabel
29
+ :label="label"
30
+ :icon="icon"
31
+ :required="isRequired"
32
+ :info-text="infoText"
33
+ :info-tooltip-width="infoTooltipWidth"
34
+ class="mb-2"
35
+ >
36
+ <template
37
+ v-if="$slots['label-action']"
38
+ #label-action
39
+ >
40
+ <slot name="label-action" />
41
+ </template>
42
+ </VcInputLabel>
43
+ <slot />
44
+ </template>
45
+ </template>
46
+
47
+ <script lang="ts">
48
+ import { defineComponent, PropType } from 'vue'
49
+ import { ElFormItem, formContextKey } from 'element-plus'
50
+ import labelMixin from '@/mixins/input/label.mixin'
51
+ import VcInputLabel from '@/components/VcForm/UiComponents/VcInputLabel.vue'
52
+ import { FormItemRule } from 'element-plus/es/tokens/form'
53
+
54
+ export default defineComponent({
55
+ name: 'VcFormItem',
56
+ components: {
57
+ ElFormItem,
58
+ VcInputLabel
59
+ },
60
+ mixins: [labelMixin],
61
+ inject: {
62
+ formContext: {
63
+ from: formContextKey as symbol,
64
+ default: () => undefined
65
+ }
66
+ },
67
+ props: {
68
+ rules: {
69
+ type: Array as PropType<FormItemRule[]>,
70
+ default: () => []
71
+ }
72
+ },
73
+ computed: {
74
+ isRequired (): boolean {
75
+ return !!(this.required || this.rules.some((rule: FormItemRule) => rule?.required === true))
76
+ },
77
+ parentFormContext () {
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
+ return (this as any).formContext || null
80
+ }
81
+ }
82
+ })
83
+ </script>
84
+
85
+ <style lang="scss">
86
+ .vc-form-item.el-form-item {
87
+ .el-form-item__label {
88
+ @apply items-center p-0;
89
+ &:after, &:before {
90
+ display: none !important;
91
+ }
92
+ }
93
+ &.is-error {
94
+ .el-input {
95
+ .el-input__wrapper {
96
+ @apply shadow-none border-error;
97
+ }
98
+ &:not(.is-disabled) {
99
+ .el-input__wrapper {
100
+ &:hover {
101
+ @apply shadow-hover-outer-active;
102
+ }
103
+ }
104
+ }
105
+ }
106
+ .el-select.vc-select {
107
+ .el-input {
108
+ .el-input__wrapper, .el-input__wrapper.is-focus {
109
+ @apply border-error;
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ </style>