aloha-vue 2.74.0 → 2.75.0

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 (166) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -21
  3. package/dist/aloha-vue.css +13594 -13594
  4. package/dist/aloha-vue.css.map +1 -1
  5. package/dist/aloha-vue.es.js +59266 -64918
  6. package/dist/aloha-vue.umd.js +338 -211
  7. package/package.json +27 -34
  8. package/scss/components/ATable.scss +2 -2
  9. package/scss/utils/button.scss +362 -362
  10. package/scss/utils/funktions.scss +162 -162
  11. package/src/AAccordion/AAccordionItem/AAccordionItem.js +235 -230
  12. package/src/ACarousel/ACarousel.js +7 -2
  13. package/src/ADropdown/ADropdown.js +4 -1
  14. package/src/AFilters/AFilterCenter/AFilterCenter.js +5 -1
  15. package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +7 -2
  16. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontal.js +412 -396
  17. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/AFiltersHorizontalFilter.js +102 -99
  18. package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSavedDeleteAPI.js +108 -108
  19. package/src/AFilters/AFiltersMain/AFiltersMain.js +114 -111
  20. package/src/AFilters/AFiltersSaveModal/compositionAPI/SaveAPI.js +65 -65
  21. package/src/ALinkCopy/ALinkCopy.js +98 -95
  22. package/src/ALinkCopy/compositionAPI/CopyAPI.js +48 -48
  23. package/src/AList/__tests__/AList.test.js +33 -33
  24. package/src/AList/compositionAPI/__tests__/TagAPI.test.js +43 -43
  25. package/src/AMenu/AMenu.js +4 -1
  26. package/src/AMenu/AMenuBreadcrumbs/AMenuBreadcrumbs.js +240 -237
  27. package/src/AMenu/AMenuPanelLink/AMenuPanelLink.js +4 -1
  28. package/src/AMenu/AMenuSearchPanelBreadcrumbs/AMenuSearchPanelBreadcrumbs.js +122 -119
  29. package/src/AModalWizard/AModalWizard.js +58 -53
  30. package/src/AModalWizard/compositionAPI/__tests__/ScrollAPI.test.js +46 -46
  31. package/src/APagination/APaginationPages/APaginationPages.js +15 -4
  32. package/src/ARate/ARate.js +254 -249
  33. package/src/ARate/ARateIcon/ADecimalIcon/ADecimalIcon.js +53 -50
  34. package/src/ARate/ARateIcon/ARateIcon.js +109 -104
  35. package/src/AResizer/AResizer.js +167 -162
  36. package/src/ATable/ATableHeaderTh/compositionAPI/SortAPI.js +172 -167
  37. package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +14 -4
  38. package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +191 -184
  39. package/src/ATable/ATablePreviewDown/ATablePreviewDown.js +72 -69
  40. package/src/ATable/ATablePreviewRight/ATablePreviewRight.js +265 -258
  41. package/src/ATable/ATableSortingAdditional/ATableSortingAdditional.js +224 -219
  42. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.AttributesAPI.test.js +39 -39
  43. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ColumnsAPI.test.js +68 -68
  44. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.DropdownAPI.test.js +45 -45
  45. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.FormAPI.test.js +95 -95
  46. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ModelAPI.test.js +1 -1
  47. package/src/ATable/ATableTd/ATableTd.js +4 -1
  48. package/src/ATable/ATableTdAction/ATableTdAction.js +19 -12
  49. package/src/ATable/ATableTopPanel/ATableTopPanel.js +11 -3
  50. package/src/ATable/ATableTr/ATableTr.js +408 -405
  51. package/src/ATable/__tests__/ATable.HeaderSlot.test.js +102 -97
  52. package/src/ATable/__tests__/ATable.RowIdsAPI.test.js +66 -66
  53. package/src/ATableForm/ATableForm.js +88 -85
  54. package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +14 -4
  55. package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +196 -187
  56. package/src/ATableForm/ATableFormRow/compositionAPI/EditAPI.js +104 -104
  57. package/src/ATableForm/__tests__/ATableForm.DragAndDropAPI.test.js +200 -212
  58. package/src/ATableForm/__tests__/ATableForm.ListView.test.js +134 -174
  59. package/src/ATableForm/compositionAPI/IconsAPI.js +24 -21
  60. package/src/AVerticalScroll/AVerticalScroll.js +182 -177
  61. package/src/AWizard/AWizard.js +26 -21
  62. package/src/AWizard/AWizardStep/AWizardStep.js +275 -270
  63. package/src/AWizard/compositionAPI/__tests__/ChangeStepAPI.test.js +32 -32
  64. package/src/AWizard/compositionAPI/__tests__/LocalAPI.test.js +55 -55
  65. package/src/PuxDatepicker/PuxDatepickerCalendarPanel/PuxDatepickerCalendarPanel.js +646 -648
  66. package/src/PuxDatepicker/panel/PanelDate/PanelDate.js +300 -301
  67. package/src/PuxDatepicker/panel/PanelMonth/PanelMonth.js +148 -149
  68. package/src/PuxDatepicker/panel/PanelTime/PanelTime.js +256 -257
  69. package/src/PuxDatepicker/panel/PanelYear/PanelYear.js +136 -137
  70. package/src/PuxDatepicker/utils/index.js +100 -100
  71. package/src/compositionAPI/AHttpAPI.js +593 -593
  72. package/src/compositionAPI/__tests__/AHttpAPI.test.js +42 -42
  73. package/src/filters/__tests__/filterBoolean.test.js +38 -38
  74. package/src/filters/__tests__/filterCapitalize.test.js +38 -38
  75. package/src/filters/__tests__/filterCurrency.test.js +21 -21
  76. package/src/filters/__tests__/filterDate.test.js +42 -42
  77. package/src/filters/__tests__/filterDefaultForEmpty.test.js +24 -24
  78. package/src/filters/__tests__/filterEmail.test.js +42 -42
  79. package/src/filters/__tests__/filterEscapeHtml.test.js +45 -45
  80. package/src/filters/__tests__/filterFileSize.test.js +45 -45
  81. package/src/filters/__tests__/filterFloat.test.js +74 -74
  82. package/src/filters/__tests__/filterJson.test.js +74 -74
  83. package/src/filters/__tests__/filterKeyValue.test.js +50 -50
  84. package/src/filters/__tests__/filterLimitTo.test.js +39 -39
  85. package/src/filters/__tests__/filterLink.test.js +41 -41
  86. package/src/filters/__tests__/filterList.test.js +149 -149
  87. package/src/filters/__tests__/filterLowerCase.test.js +38 -38
  88. package/src/filters/__tests__/filterMask.test.js +80 -80
  89. package/src/filters/__tests__/filterPropertyByValue.test.js +27 -27
  90. package/src/filters/__tests__/filterSearchHighlight.test.js +129 -129
  91. package/src/filters/__tests__/filterUpperCase.test.js +38 -38
  92. package/src/filters/__tests__/filterValueByCondition.test.js +3 -3
  93. package/src/filters/filterJson.js +39 -39
  94. package/src/filters/filterValueByCondition.js +2 -2
  95. package/src/plugins/AAlertPlugin.js +16 -5
  96. package/src/plugins/AMultiselectOrderedPlugin.js +88 -81
  97. package/src/plugins/ASelectPlugin.js +12 -10
  98. package/src/ui/ACheckbox/ACheckbox.js +82 -79
  99. package/src/ui/ADatepicker/compositionAPI/EventsAPI.js +297 -297
  100. package/src/ui/ADatepicker/utils/index.js +76 -76
  101. package/src/ui/ADatepickerAlt/ADatepicker.js +912 -912
  102. package/src/ui/ADatepickerAlt/utils/index.js +98 -98
  103. package/src/ui/AFieldset/__tests__/AFieldset.ClassColumn.test.js +113 -114
  104. package/src/ui/AFormElementBtnClear/AFormElementBtnClear.js +4 -1
  105. package/src/ui/AInputCurrency/AInputCurrency.js +20 -15
  106. package/src/ui/AInputCurrency/__tests__/AInputCurrency.ModelAPI.test.js +73 -73
  107. package/src/ui/AInputNumber/AInputNumber.js +17 -12
  108. package/src/ui/AJson/AJson.js +12 -3
  109. package/src/ui/AJson/compositionAPI/JsonAPI.js +116 -116
  110. package/src/ui/ALabel/__tests__/ALabel.IdAPI.test.js +42 -42
  111. package/src/ui/ALabel/__tests__/ALabel.LabelAPI.test.js +33 -33
  112. package/src/ui/ARadio/ARadio.js +80 -77
  113. package/src/ui/ASelect/ASelect.js +390 -383
  114. package/src/ui/ASelect/ASelectElement/ASelectElement.js +179 -176
  115. package/src/ui/ASelect/ASelectValueCloseable/ASelectValueCloseable.js +143 -141
  116. package/src/ui/ASelect/__tests__/SelectedFirstAPI.test.js +101 -101
  117. package/src/ui/ASelect/__tests__/SelectedVisibleAPI.test.js +98 -98
  118. package/src/ui/ASlider/compositionAPI/SliderAPI.js +23 -23
  119. package/src/ui/AValidatedJson/AValidatedJson.js +4 -1
  120. package/src/ui/AValidatedJson/AValidatedJsonItem/AValidatedJsonItem.js +308 -298
  121. package/src/ui/compositionApi/UiCollapseAPI.js +68 -63
  122. package/src/ui/compositionApi/UiInputAutofillAPI.js +41 -41
  123. package/src/ui/compositionApi/__tests__/UIDataGroupAPI.test.js +106 -106
  124. package/src/ui/compositionApi/__tests__/UIExcludeRenderAttributesAPI.test.js +39 -39
  125. package/src/ui/compositionApi/__tests__/UiDataWithKeyIdAndLabelAPI.test.js +128 -128
  126. package/src/ui/compositionApi/__tests__/UiSearchAPI.test.js +71 -71
  127. package/src/utils/EventBus.js +51 -8
  128. package/src/utils/__tests__/EventBus.test.js +138 -0
  129. package/src/utils/__tests__/utils.aOrderBy.test.js +1 -1
  130. package/src/utils/__tests__/utils.aSortBy.test.js +1 -1
  131. package/src/utils/__tests__/utils.getTotalNestedCount.test.js +56 -56
  132. package/src/utils/__tests__/utils.isArrayOfArrays.test.js +44 -44
  133. package/src/utils/__tests__/utils.isArrayOfStrings.test.js +36 -36
  134. package/src/utils/__tests__/utilsArray.aFirst.test.js +1 -1
  135. package/src/utils/__tests__/utilsArray.aLast.test.js +1 -1
  136. package/src/utils/__tests__/utilsLang.isArguments.test.js +1 -1
  137. package/src/utils/__tests__/utilsLang.isArray.test.js +1 -1
  138. package/src/utils/__tests__/utilsLang.isArrayBuffer.test.js +1 -1
  139. package/src/utils/__tests__/utilsLang.isBoolean.test.js +1 -1
  140. package/src/utils/__tests__/utilsLang.isBuffer.test.js +1 -1
  141. package/src/utils/__tests__/utilsLang.isDate.test.js +1 -1
  142. package/src/utils/__tests__/utilsLang.isElement.test.js +5 -3
  143. package/src/utils/__tests__/utilsLang.isError.test.js +1 -1
  144. package/src/utils/__tests__/utilsLang.isFinite.test.js +1 -1
  145. package/src/utils/__tests__/utilsLang.isFunction.test.js +1 -1
  146. package/src/utils/__tests__/utilsLang.isInteger.test.js +1 -1
  147. package/src/utils/__tests__/utilsLang.isMap.test.js +1 -1
  148. package/src/utils/__tests__/utilsLang.isNaN.test.js +1 -1
  149. package/src/utils/__tests__/utilsLang.isNil.test.js +1 -1
  150. package/src/utils/__tests__/utilsLang.isNull.test.js +1 -1
  151. package/src/utils/__tests__/utilsLang.isNumber.test.js +1 -1
  152. package/src/utils/__tests__/utilsLang.isObject.test.js +1 -1
  153. package/src/utils/__tests__/utilsLang.isObjectLike.test.js +5 -3
  154. package/src/utils/__tests__/utilsLang.isPlainObject.test.js +3 -2
  155. package/src/utils/__tests__/utilsLang.isPromise.test.js +5 -2
  156. package/src/utils/__tests__/utilsLang.isRegExp.test.js +1 -1
  157. package/src/utils/__tests__/utilsLang.isSet.test.js +1 -1
  158. package/src/utils/__tests__/utilsLang.isString.test.js +1 -1
  159. package/src/utils/__tests__/utilsLang.isSymbol.test.js +5 -3
  160. package/src/utils/__tests__/utilsLang.isUndefined.test.js +1 -1
  161. package/src/utils/__tests__/utilsLang.isWeakMap.test.js +1 -1
  162. package/src/utils/__tests__/utilsLang.isWeakSet.test.js +1 -1
  163. package/src/utils/__tests__/utilsMath.isEven.test.js +43 -43
  164. package/src/utils/__tests__/utilsMath.isOdd.test.js +43 -43
  165. package/src/utils/__tests__/utilsUi.isModelForFilterNotEmpty.test.js +65 -65
  166. package/src/utils/autosize.js +1 -1
@@ -1,104 +1,109 @@
1
- import {
2
- h,
3
- } from "vue";
4
-
5
- import ADecimalIcon from "./ADecimalIcon/ADecimalIcon";
6
- import AIcon from "../../AIcon/AIcon";
7
-
8
- import Star from "aloha-svg/dist/js/bootstrap/Star";
9
- import StarFill from "aloha-svg/dist/js/bootstrap/StarFill";
10
-
11
- export default {
12
- name: "ARateIcon",
13
- components: {
14
- AIcon,
15
- ADecimalIcon,
16
- },
17
- props: {
18
- value: {
19
- type: Number,
20
- default: 50,
21
- },
22
- color: {
23
- type: String,
24
- default: "yellow",
25
- },
26
- icon: {
27
- type: String,
28
- default: Star,
29
- },
30
- iconFill: {
31
- type: String,
32
- default: StarFill,
33
- },
34
- size: {
35
- type: String,
36
- default: "medium",
37
- validator: value => ["small", "medium", "big"].includes(value),
38
- },
39
- isHovered: {
40
- type: Boolean,
41
- default: false,
42
- },
43
- },
44
- emits: [
45
- "mouseenter",
46
- "mouseleave",
47
- "click",
48
- "dblclick",
49
- "mousemove",
50
- ],
51
- setup(props, { emit }) {
52
- return {
53
- handleMouseEnter(event) {
54
- emit("mouseenter", event);
55
- },
56
- handleMouseLeave(event) {
57
- emit("mouseleave", event);
58
- },
59
- handleClick(event) {
60
- emit("click", event);
61
- },
62
- handleDblClick(event) {
63
- emit("dblclick", event);
64
- },
65
- handleMouseMove(event) {
66
- emit("mousemove", event);
67
- },
68
- };
69
- },
70
- render() {
71
- return h(
72
- "span",
73
- {
74
- class: `el-rate__item a_rate_icon_${ this.size }`,
75
- style: {
76
- position: "relative",
77
- display: "inline-flex",
78
- alignItems: "center",
79
- justifyContent: "center",
80
- },
81
- onClick: this.handleClick,
82
- onDblclick: this.handleDblClick,
83
- onMouseenter: this.handleMouseEnter,
84
- onMouseleave: this.handleMouseLeave,
85
- onMousemove: this.handleMouseMove,
86
- },
87
- [
88
- h("div", { class: "a_rate_icon_align" }, [
89
- h(AIcon, {
90
- icon: this.icon,
91
- class: `a_decimal_rate_icon a_rate_decimal`,
92
- color: this.color,
93
- }),
94
- h(ADecimalIcon, {
95
- icon: this.iconFill,
96
- value: this.value,
97
- color: this.color,
98
- size: this.size,
99
- }),
100
- ]),
101
- ],
102
- );
103
- },
104
- };
1
+ import {
2
+ h,
3
+ } from "vue";
4
+
5
+ import ADecimalIcon from "./ADecimalIcon/ADecimalIcon";
6
+ import AIcon from "../../AIcon/AIcon";
7
+
8
+ const Star = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star" viewBox="0 0 16 16">
9
+ <path d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.56.56 0 0 0-.163-.505L1.71 6.745l4.052-.576a.53.53 0 0 0 .393-.288L8 2.223l1.847 3.658a.53.53 0 0 0 .393.288l4.052.575-2.906 2.77a.56.56 0 0 0-.163.506l.694 3.957-3.686-1.894a.5.5 0 0 0-.461 0z"/>
10
+ </svg>`;
11
+ const StarFill = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16">
12
+ <path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/>
13
+ </svg>`;
14
+
15
+
16
+ export default {
17
+ name: "ARateIcon",
18
+ components: {
19
+ AIcon,
20
+ ADecimalIcon,
21
+ },
22
+ props: {
23
+ value: {
24
+ type: Number,
25
+ default: 50,
26
+ },
27
+ color: {
28
+ type: String,
29
+ default: "yellow",
30
+ },
31
+ icon: {
32
+ type: String,
33
+ default: Star,
34
+ },
35
+ iconFill: {
36
+ type: String,
37
+ default: StarFill,
38
+ },
39
+ size: {
40
+ type: String,
41
+ default: "medium",
42
+ validator: value => ["small", "medium", "big"].includes(value),
43
+ },
44
+ isHovered: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+ },
49
+ emits: [
50
+ "mouseenter",
51
+ "mouseleave",
52
+ "click",
53
+ "dblclick",
54
+ "mousemove",
55
+ ],
56
+ setup(props, { emit }) {
57
+ return {
58
+ handleMouseEnter(event) {
59
+ emit("mouseenter", event);
60
+ },
61
+ handleMouseLeave(event) {
62
+ emit("mouseleave", event);
63
+ },
64
+ handleClick(event) {
65
+ emit("click", event);
66
+ },
67
+ handleDblClick(event) {
68
+ emit("dblclick", event);
69
+ },
70
+ handleMouseMove(event) {
71
+ emit("mousemove", event);
72
+ },
73
+ };
74
+ },
75
+ render() {
76
+ return h(
77
+ "span",
78
+ {
79
+ class: `el-rate__item a_rate_icon_${ this.size }`,
80
+ style: {
81
+ position: "relative",
82
+ display: "inline-flex",
83
+ alignItems: "center",
84
+ justifyContent: "center",
85
+ },
86
+ onClick: this.handleClick,
87
+ onDblclick: this.handleDblClick,
88
+ onMouseenter: this.handleMouseEnter,
89
+ onMouseleave: this.handleMouseLeave,
90
+ onMousemove: this.handleMouseMove,
91
+ },
92
+ [
93
+ h("div", { class: "a_rate_icon_align" }, [
94
+ h(AIcon, {
95
+ icon: this.icon,
96
+ class: `a_decimal_rate_icon a_rate_decimal`,
97
+ color: this.color,
98
+ }),
99
+ h(ADecimalIcon, {
100
+ icon: this.iconFill,
101
+ value: this.value,
102
+ color: this.color,
103
+ size: this.size,
104
+ }),
105
+ ]),
106
+ ],
107
+ );
108
+ },
109
+ };
@@ -1,162 +1,167 @@
1
- import {
2
- h,
3
- } from "vue";
4
-
5
- import AIcon from "../AIcon/AIcon";
6
-
7
- import ThreeDots from "aloha-svg/dist/js/bootstrap/ThreeDots";
8
- import ThreeDotsVertical from "aloha-svg/dist/js/bootstrap/ThreeDotsVertical";
9
-
10
- export default {
11
- name: "AResizer",
12
- props: {
13
- direction: {
14
- type: String,
15
- required: true,
16
- validator: value => ["x", "y"].indexOf(value) !== -1,
17
- },
18
- disabled: {
19
- type: Boolean,
20
- required: false,
21
- },
22
- },
23
- emits: [
24
- "mousedown",
25
- "mousemove",
26
- "mouseoutDocument",
27
- "mouseup",
28
- ],
29
- data() {
30
- return {
31
- clientHeight: 0,
32
- clientWidth: 0,
33
- };
34
- },
35
- computed: {
36
- isDirectionX() {
37
- return this.direction === "x";
38
- },
39
-
40
- isDirectionY() {
41
- return this.direction === "y";
42
- },
43
-
44
- directionClass() {
45
- return `a_resizer_${ this.direction }`;
46
- },
47
-
48
- directionIcon() {
49
- if (this.direction === "x") {
50
- return ThreeDotsVertical;
51
- }
52
- if (this.direction === "y") {
53
- return ThreeDots;
54
- }
55
- },
56
-
57
- cursor() {
58
- if (this.direction === "x") {
59
- return "w-resize";
60
- }
61
- if (this.direction === "y") {
62
- return "s-resize";
63
- }
64
- },
65
-
66
- bodyClass() {
67
- return `a_resizer_${ this.direction }_active__body`;
68
- },
69
-
70
- attributesResizer() {
71
- const ATTRIBUTES = {
72
- class: ["a_resizer", this.directionClass, {
73
- a_resizer_disabled: this.disabled,
74
- }],
75
- ariaHidden: true,
76
- };
77
- if (!this.disabled) {
78
- ATTRIBUTES.onMousedown = this.mousedown;
79
- }
80
-
81
- return ATTRIBUTES;
82
- },
83
- },
84
- unmounted() {
85
- this.removeMouseEventListeners();
86
- this.removeClassFromBody();
87
- },
88
- methods: {
89
- mousedown($event) {
90
- this.addMouseEventListeners();
91
- this.clientHeight = document.documentElement.clientHeight;
92
- this.clientWidth = document.documentElement.clientWidth;
93
- this.$emit("mousedown", {
94
- $event,
95
- clientHeight: this.clientHeight,
96
- clientWidth: this.clientWidth,
97
- });
98
- this.addClassToBody();
99
- },
100
-
101
- mousemove($event) {
102
- this.$emit("mousemove", {
103
- $event,
104
- clientX: $event.clientX,
105
- clientY: $event.clientY,
106
- clientHeight: this.clientHeight,
107
- clientWidth: this.clientWidth,
108
- });
109
- },
110
-
111
- mouseup($event) {
112
- this.removeMouseEventListeners();
113
- this.$emit("mouseup", {
114
- $event,
115
- clientHeight: this.clientHeight,
116
- clientWidth: this.clientWidth,
117
- });
118
- this.removeClassFromBody();
119
- },
120
-
121
- mouseoutDocument($event) {
122
- this.removeMouseEventListeners();
123
- this.$emit("mouseoutDocument", {
124
- $event,
125
- clientHeight: this.clientHeight,
126
- clientWidth: this.clientWidth,
127
- });
128
- this.removeClassFromBody();
129
- },
130
-
131
- addMouseEventListeners() {
132
- document.addEventListener("mousemove", this.mousemove);
133
- document.addEventListener("mouseup", this.mouseup);
134
- document.addEventListener("mouseleave", this.mouseoutDocument);
135
- },
136
-
137
- removeMouseEventListeners() {
138
- document.removeEventListener("mousemove", this.mousemove);
139
- document.removeEventListener("mouseup", this.mouseup);
140
- document.removeEventListener("mouseleave", this.mouseoutDocument);
141
- },
142
-
143
- addClassToBody() {
144
- document.body.classList.add(this.bodyClass);
145
- },
146
-
147
- removeClassFromBody() {
148
- document.body.classList.remove(this.bodyClass);
149
- },
150
- },
151
- render() {
152
- return h("div", this.attributesResizer, [
153
- h("div", {
154
- class: "a_resizer__line",
155
- }),
156
- h(AIcon, {
157
- class: "a_resizer__icon",
158
- icon: this.directionIcon,
159
- }),
160
- ]);
161
- },
162
- };
1
+ import {
2
+ h,
3
+ } from "vue";
4
+
5
+ import AIcon from "../AIcon/AIcon";
6
+
7
+ const ThreeDots = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-three-dots" viewBox="0 0 16 16">
8
+ <path d="M3 9.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3m5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"/>
9
+ </svg>`;
10
+ const ThreeDotsVertical = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-three-dots-vertical" viewBox="0 0 16 16">
11
+ <path d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
12
+ </svg>`;
13
+
14
+
15
+ export default {
16
+ name: "AResizer",
17
+ props: {
18
+ direction: {
19
+ type: String,
20
+ required: true,
21
+ validator: value => ["x", "y"].indexOf(value) !== -1,
22
+ },
23
+ disabled: {
24
+ type: Boolean,
25
+ required: false,
26
+ },
27
+ },
28
+ emits: [
29
+ "mousedown",
30
+ "mousemove",
31
+ "mouseoutDocument",
32
+ "mouseup",
33
+ ],
34
+ data() {
35
+ return {
36
+ clientHeight: 0,
37
+ clientWidth: 0,
38
+ };
39
+ },
40
+ computed: {
41
+ isDirectionX() {
42
+ return this.direction === "x";
43
+ },
44
+
45
+ isDirectionY() {
46
+ return this.direction === "y";
47
+ },
48
+
49
+ directionClass() {
50
+ return `a_resizer_${ this.direction }`;
51
+ },
52
+
53
+ directionIcon() {
54
+ if (this.direction === "x") {
55
+ return ThreeDotsVertical;
56
+ }
57
+ if (this.direction === "y") {
58
+ return ThreeDots;
59
+ }
60
+ },
61
+
62
+ cursor() {
63
+ if (this.direction === "x") {
64
+ return "w-resize";
65
+ }
66
+ if (this.direction === "y") {
67
+ return "s-resize";
68
+ }
69
+ },
70
+
71
+ bodyClass() {
72
+ return `a_resizer_${ this.direction }_active__body`;
73
+ },
74
+
75
+ attributesResizer() {
76
+ const ATTRIBUTES = {
77
+ class: ["a_resizer", this.directionClass, {
78
+ a_resizer_disabled: this.disabled,
79
+ }],
80
+ ariaHidden: true,
81
+ };
82
+ if (!this.disabled) {
83
+ ATTRIBUTES.onMousedown = this.mousedown;
84
+ }
85
+
86
+ return ATTRIBUTES;
87
+ },
88
+ },
89
+ unmounted() {
90
+ this.removeMouseEventListeners();
91
+ this.removeClassFromBody();
92
+ },
93
+ methods: {
94
+ mousedown($event) {
95
+ this.addMouseEventListeners();
96
+ this.clientHeight = document.documentElement.clientHeight;
97
+ this.clientWidth = document.documentElement.clientWidth;
98
+ this.$emit("mousedown", {
99
+ $event,
100
+ clientHeight: this.clientHeight,
101
+ clientWidth: this.clientWidth,
102
+ });
103
+ this.addClassToBody();
104
+ },
105
+
106
+ mousemove($event) {
107
+ this.$emit("mousemove", {
108
+ $event,
109
+ clientX: $event.clientX,
110
+ clientY: $event.clientY,
111
+ clientHeight: this.clientHeight,
112
+ clientWidth: this.clientWidth,
113
+ });
114
+ },
115
+
116
+ mouseup($event) {
117
+ this.removeMouseEventListeners();
118
+ this.$emit("mouseup", {
119
+ $event,
120
+ clientHeight: this.clientHeight,
121
+ clientWidth: this.clientWidth,
122
+ });
123
+ this.removeClassFromBody();
124
+ },
125
+
126
+ mouseoutDocument($event) {
127
+ this.removeMouseEventListeners();
128
+ this.$emit("mouseoutDocument", {
129
+ $event,
130
+ clientHeight: this.clientHeight,
131
+ clientWidth: this.clientWidth,
132
+ });
133
+ this.removeClassFromBody();
134
+ },
135
+
136
+ addMouseEventListeners() {
137
+ document.addEventListener("mousemove", this.mousemove);
138
+ document.addEventListener("mouseup", this.mouseup);
139
+ document.addEventListener("mouseleave", this.mouseoutDocument);
140
+ },
141
+
142
+ removeMouseEventListeners() {
143
+ document.removeEventListener("mousemove", this.mousemove);
144
+ document.removeEventListener("mouseup", this.mouseup);
145
+ document.removeEventListener("mouseleave", this.mouseoutDocument);
146
+ },
147
+
148
+ addClassToBody() {
149
+ document.body.classList.add(this.bodyClass);
150
+ },
151
+
152
+ removeClassFromBody() {
153
+ document.body.classList.remove(this.bodyClass);
154
+ },
155
+ },
156
+ render() {
157
+ return h("div", this.attributesResizer, [
158
+ h("div", {
159
+ class: "a_resizer__line",
160
+ }),
161
+ h(AIcon, {
162
+ class: "a_resizer__icon",
163
+ icon: this.directionIcon,
164
+ }),
165
+ ]);
166
+ },
167
+ };