renusify 2.5.1 → 3.0.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.
- package/components/app/index.vue +74 -22
- package/components/app/toast/index.vue +76 -71
- package/components/app/toast/toast.vue +62 -44
- package/components/avatar/index.vue +208 -84
- package/components/button/buttonConfirm.vue +53 -26
- package/components/button/buttonGroup.js +0 -2
- package/components/button/buttonGroup.vue +310 -62
- package/components/button/index.vue +584 -100
- package/components/calendar/index.js +0 -2
- package/components/calendar/index.vue +326 -262
- package/components/calendar/month.vue +64 -55
- package/components/calendar/year.vue +30 -25
- package/components/card/index.vue +139 -59
- package/components/codeEditor/highlightCss.vue +38 -39
- package/components/codeEditor/highlightHtml.vue +64 -64
- package/components/codeEditor/highlightJs.vue +37 -38
- package/components/codeEditor/index.vue +129 -79
- package/components/codeEditor/run.vue +225 -39
- package/components/codeEditor/useCodeFormatter.js +150 -0
- package/components/confirm/index.vue +140 -81
- package/components/container/col.vue +5 -4
- package/components/container/divider.vue +28 -19
- package/components/container/index.vue +34 -15
- package/components/container/row.vue +26 -9
- package/components/container/spacer.vue +2 -4
- package/components/container/style.scss +3 -0
- package/components/content/index.vue +49 -32
- package/components/cropper/index.vue +401 -244
- package/components/float/index.vue +542 -415
- package/components/form/addressInput/index.vue +184 -109
- package/components/form/camInput/index.vue +370 -244
- package/components/form/checkInput/index.vue +138 -71
- package/components/form/checkboxInput/index.vue +87 -47
- package/components/form/colorInput/Alpha.vue +81 -83
- package/components/form/colorInput/Hue.vue +91 -68
- package/components/form/colorInput/Preview.vue +43 -47
- package/components/form/colorInput/Saturation.vue +101 -86
- package/components/form/colorInput/index.vue +72 -40
- package/components/form/colorInput/picker.vue +111 -106
- package/components/form/colorInput/useColor.js +153 -0
- package/components/form/dateInput/index.vue +691 -356
- package/components/form/dateInput/month.vue +63 -54
- package/components/form/dateInput/year.vue +35 -25
- package/components/form/fileInput/index.js +0 -1
- package/components/form/fileInput/index.vue +263 -106
- package/components/form/fileInput/single.vue +323 -164
- package/components/form/groupInput/index.vue +199 -101
- package/components/form/index.vue +189 -83
- package/components/form/input/index.vue +416 -377
- package/components/form/jsonInput/JsonView.vue +54 -56
- package/components/form/jsonInput/index.vue +247 -165
- package/components/form/maskInput/index.vue +252 -132
- package/components/form/numberInput/index.js +0 -1
- package/components/form/numberInput/index.vue +226 -117
- package/components/form/passwordInput/index.js +2 -1
- package/components/form/passwordInput/index.vue +269 -102
- package/components/form/radioInput/index.vue +143 -72
- package/components/form/rangeInput/index.vue +280 -167
- package/components/form/ratingInput/index.vue +57 -57
- package/components/form/selectInput/index.js +1 -3
- package/components/form/selectInput/index.vue +584 -296
- package/components/form/switchInput/index.vue +73 -59
- package/components/form/telInput/index.js +0 -1
- package/components/form/telInput/index.vue +238 -135
- package/components/form/textArea/index.vue +72 -35
- package/components/form/textEditor/index.vue +739 -0
- package/components/form/{text-editor → textEditor}/style.scss +8 -16
- package/components/form/textInput/index.vue +54 -32
- package/components/form/timeInput/index.vue +83 -56
- package/components/form/timeInput/range.vue +116 -95
- package/components/form/timeInput/timepicker.vue +382 -449
- package/components/form/uniqueInput/index.vue +105 -48
- package/components/form/unitInput/index.vue +139 -84
- package/components/formCreator/index.js +0 -1
- package/components/formCreator/index.vue +314 -148
- package/components/highlight/index.vue +41 -25
- package/components/highlight/style.scss +2 -2
- package/components/highlight/{mixin.js → useHighlight.js} +181 -160
- package/components/icon/index.vue +79 -33
- package/components/img/index.vue +249 -147
- package/components/img/preview.vue +180 -198
- package/components/img/svgImg.vue +42 -39
- package/components/index.js +5 -20
- package/components/infinite/index.js +1 -2
- package/components/infinite/index.vue +248 -66
- package/components/map/index.vue +428 -261
- package/components/map/route.vue +794 -487
- package/components/map/select.vue +118 -58
- package/components/menu/index.vue +201 -91
- package/components/meta/meta.js +26 -3
- package/components/modal/index.vue +383 -158
- package/components/notify/index.vue +204 -86
- package/components/notify/notification.vue +38 -55
- package/components/progress/circle.vue +189 -70
- package/components/progress/line.vue +266 -46
- package/components/searchBox/index.js +1 -3
- package/components/searchBox/index.vue +194 -101
- package/components/skeleton/index.vue +45 -20
- package/components/slider/index.vue +318 -156
- package/components/swiper/index.vue +254 -106
- package/components/table/crud/footer.vue +77 -53
- package/components/table/crud/header.vue +71 -72
- package/components/table/crud/index.vue +631 -401
- package/components/table/index.vue +721 -278
- package/components/timeAgo/index.vue +145 -96
- package/components/tour/index.vue +338 -235
- package/components/tree/index.vue +235 -89
- package/components/tree/tree-element.vue +107 -106
- package/directive/animate/index.js +77 -0
- package/directive/clickOutSide/index.js +98 -0
- package/directive/drag/index.js +153 -0
- package/directive/index.js +11 -13
- package/directive/intersect/index.js +263 -0
- package/directive/mask/index.js +67 -0
- package/directive/parallax/index.js +78 -0
- package/directive/ripple/index.js +14 -0
- package/directive/scroll/index.js +244 -0
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +10 -8
- package/package.json +5 -2
- package/plugins/validation/Validate.js +88 -79
- package/scripts/generate-docs.mjs +226 -0
- package/scripts/menu.mjs +240 -0
- package/scripts/parser.mjs +1086 -0
- package/style/_index.scss +7 -0
- package/style/app.scss +13 -65
- package/style/colors.scss +5 -22
- package/style/functions/index.scss +8 -0
- package/style/mixins/index.scss +17 -5
- package/style/variables/base.scss +154 -175
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +6 -1
- package/tools/root.js +71 -0
- package/components/app/style.scss +0 -41
- package/components/app/toast/style.scss +0 -20
- package/components/avatar/style.scss +0 -32
- package/components/bar/bottomNav.js +0 -1
- package/components/bar/bottomNav.vue +0 -28
- package/components/bar/bottomNavigationCircle.js +0 -2
- package/components/bar/bottomNavigationCircle.vue +0 -99
- package/components/bar/scss/bottomNav.scss +0 -67
- package/components/bar/scss/toolbar.scss +0 -174
- package/components/bar/toolbar/index.js +0 -8
- package/components/bar/toolbar/index.vue +0 -35
- package/components/bar/toolbar/laptop.vue +0 -33
- package/components/bar/toolbar/menuChilds.vue +0 -41
- package/components/bar/toolbar/menuLaptop.vue +0 -41
- package/components/bar/toolbar/menuMob.vue +0 -39
- package/components/bar/toolbar/mixin.js +0 -43
- package/components/bar/toolbar/mobile.vue +0 -34
- package/components/breadcrumb/bredcrumbItem.vue +0 -39
- package/components/breadcrumb/index.js +0 -3
- package/components/breadcrumb/index.vue +0 -71
- package/components/breadcrumb/style.scss +0 -51
- package/components/button/style.scss +0 -411
- package/components/card/style.scss +0 -86
- package/components/chart/chart.js +0 -1
- package/components/chart/chart.vue +0 -69
- package/components/chart/worldMap.js +0 -2
- package/components/chart/worldMap.vue +0 -1112
- package/components/chat/MessageList.vue +0 -163
- package/components/chat/chatInput.vue +0 -150
- package/components/chat/chatMsg.vue +0 -276
- package/components/chat/index.js +0 -11
- package/components/chat/index.vue +0 -113
- package/components/chip/index.js +0 -3
- package/components/chip/index.vue +0 -77
- package/components/chip/style.scss +0 -199
- package/components/codeEditor/mixin.js +0 -145
- package/components/countdown/index.js +0 -1
- package/components/countdown/index.vue +0 -105
- package/components/form/colorInput/mixin.js +0 -132
- package/components/form/fileInput/file.js +0 -148
- package/components/form/telInput/assets/flags.png +0 -0
- package/components/form/telInput/assets/flags@2x.png +0 -0
- package/components/form/text-editor/index.vue +0 -710
- package/components/icon/style.scss +0 -17
- package/components/infinite/div.js +0 -6
- package/components/infinite/div.vue +0 -193
- package/components/infinite/page.js +0 -3
- package/components/infinite/page.vue +0 -105
- package/components/list/index.js +0 -3
- package/components/list/index.vue +0 -122
- package/components/list/style.scss +0 -66
- package/components/message/index.js +0 -4
- package/components/message/index.vue +0 -40
- package/components/modal/style.scss +0 -146
- package/components/nestable/NestableItem.vue +0 -307
- package/components/nestable/editable.js +0 -44
- package/components/nestable/index.js +0 -1
- package/components/nestable/index.vue +0 -226
- package/components/nestable/methods.js +0 -416
- package/components/progress/style.scss +0 -229
- package/components/table/style.scss +0 -338
- package/components/tabs/index.js +0 -3
- package/components/tabs/index.vue +0 -151
- package/components/timeline/index.js +0 -6
- package/components/timeline/index.vue +0 -76
- package/directive/resize/index.js +0 -30
- package/directive/skeleton/index.js +0 -27
- package/directive/skeleton/style.scss +0 -37
- package/plugins/request/Request.js +0 -68
- package/style/animation.scss +0 -94
- package/style/style.scss +0 -8
- package/tools/rootable.js +0 -75
- /package/components/form/{text-editor → textEditor}/index.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
@use "sass:map";
|
|
2
|
-
@use "../../style/variables/base";
|
|
3
|
-
@use "../../style/mixins";
|
|
4
|
-
@use "../../style/mixins/container" as mixins2;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
.#{base.$prefix}modal-overlay {
|
|
8
|
-
position: fixed;
|
|
9
|
-
inset: 0;
|
|
10
|
-
z-index: map.get(base.$z-index, 'important');
|
|
11
|
-
background-color: var(--color-overlay);
|
|
12
|
-
backdrop-filter: blur(3px) grayscale(30%);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.#{base.$prefix}modal {
|
|
16
|
-
position: fixed;
|
|
17
|
-
inset: 0;
|
|
18
|
-
display: flex;
|
|
19
|
-
z-index: map.get(base.$z-index, 'important');
|
|
20
|
-
outline: none;
|
|
21
|
-
|
|
22
|
-
// Position variants
|
|
23
|
-
&.modal-center {
|
|
24
|
-
align-items: center;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&.modal-bottom {
|
|
29
|
-
align-items: flex-end;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.modal-top {
|
|
34
|
-
align-items: flex-start;
|
|
35
|
-
justify-content: center;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&.modal-start {
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: flex-start;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&.modal-end {
|
|
44
|
-
align-items: center;
|
|
45
|
-
justify-content: flex-end;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.modal-btn {
|
|
49
|
-
width: 100%;
|
|
50
|
-
position: relative;
|
|
51
|
-
|
|
52
|
-
.#{base.$prefix}btn {
|
|
53
|
-
position: absolute;
|
|
54
|
-
bottom: -40px;
|
|
55
|
-
z-index: map.get(base.$z-index, 'important') + 1;
|
|
56
|
-
|
|
57
|
-
@include mixins.rtl() {
|
|
58
|
-
left: 5px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@include mixins.ltr() {
|
|
62
|
-
right: 5px;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.modal-container {
|
|
68
|
-
width: 95%;
|
|
69
|
-
max-width: 100vw;
|
|
70
|
-
max-height: 90vh;
|
|
71
|
-
z-index: map.get(base.$z-index, 'important');
|
|
72
|
-
background-color: var(--color-sheet-container-low);
|
|
73
|
-
color: var(--color-on-sheet);
|
|
74
|
-
border: 1px solid var(--color-sheet-container-low);
|
|
75
|
-
border-radius: base.$border-modal;
|
|
76
|
-
overflow: hidden;
|
|
77
|
-
display: flex;
|
|
78
|
-
flex-direction: column;
|
|
79
|
-
|
|
80
|
-
&.modal-bottom,
|
|
81
|
-
&.modal-top {
|
|
82
|
-
width: 100%;
|
|
83
|
-
border-radius: base.$border-modal base.$border-modal 0 0;
|
|
84
|
-
|
|
85
|
-
&:not(.modal-full-width) {
|
|
86
|
-
max-width: map.get(base.$container-max-widths, 'lg');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&.modal-start,
|
|
91
|
-
&.modal-end {
|
|
92
|
-
height: 100%;
|
|
93
|
-
max-height: 100vh;
|
|
94
|
-
border-radius: 0 base.$border-modal base.$border-modal 0;
|
|
95
|
-
|
|
96
|
-
&:not(.modal-full-height) {
|
|
97
|
-
max-height: 90vh;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&.modal-start {
|
|
102
|
-
border-radius: base.$border-modal 0 0 base.$border-modal;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.modal-content {
|
|
107
|
-
flex: 1;
|
|
108
|
-
overflow-y: auto;
|
|
109
|
-
overflow-x: hidden;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
@include mixins2.media-breakpoint-up('md') {
|
|
113
|
-
.modal-container:not(.modal-full-width):not(.modal-mini) {
|
|
114
|
-
width: 75%;
|
|
115
|
-
max-width: 75vw;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.modal-mini {
|
|
120
|
-
max-width: 500px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.modal-full-width {
|
|
124
|
-
width: 100%;
|
|
125
|
-
max-width: 100vw;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.modal-full-height {
|
|
129
|
-
height: 100%;
|
|
130
|
-
max-height: 100vh;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Animations
|
|
135
|
-
.animate-modal-vibrate {
|
|
136
|
-
animation: animate-modal-vibrate 0.15s map.get(base.$transition, 'fast-in-fast-out');
|
|
137
|
-
|
|
138
|
-
@keyframes animate-modal-vibrate {
|
|
139
|
-
0%, 100% {
|
|
140
|
-
transform: scale(1);
|
|
141
|
-
}
|
|
142
|
-
50% {
|
|
143
|
-
transform: scale(1.03);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="itemClasses"
|
|
4
|
-
class="nestable-handle"
|
|
5
|
-
draggable="true"
|
|
6
|
-
@dragstart="dragstart"
|
|
7
|
-
@touchend="touchend"
|
|
8
|
-
@touchmove="touchmove"
|
|
9
|
-
@touchstart="dragstart"
|
|
10
|
-
:aria-expanded="!closed"
|
|
11
|
-
:aria-label="item.title || `Item ${item[keyProp]}`"
|
|
12
|
-
role="listitem"
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
class="nestable-item-content"
|
|
16
|
-
@mouseenter="onMouseEnter"
|
|
17
|
-
@mouseleave="onMouseLeave"
|
|
18
|
-
@mousemove="onMouseMove"
|
|
19
|
-
tabindex="0"
|
|
20
|
-
@keydown="onKeyDown"
|
|
21
|
-
>
|
|
22
|
-
<r-btn-confirm
|
|
23
|
-
v-if="editable"
|
|
24
|
-
:aria-label="`Delete ${item.title || 'item'}`"
|
|
25
|
-
icon
|
|
26
|
-
text
|
|
27
|
-
@click="del(item)"
|
|
28
|
-
class="color-error-text mr-2"
|
|
29
|
-
>
|
|
30
|
-
<r-icon v-html="$r.icons.delete"></r-icon>
|
|
31
|
-
</r-btn-confirm>
|
|
32
|
-
|
|
33
|
-
<r-btn
|
|
34
|
-
v-if="hasChildren"
|
|
35
|
-
:aria-label="closed ? 'Expand' : 'Collapse'"
|
|
36
|
-
class="mr-2"
|
|
37
|
-
icon
|
|
38
|
-
text
|
|
39
|
-
@click="toggleChildren"
|
|
40
|
-
>
|
|
41
|
-
<r-icon v-html="closed ? $r.icons.plus : $r.icons.minus"></r-icon>
|
|
42
|
-
</r-btn>
|
|
43
|
-
|
|
44
|
-
<r-btn
|
|
45
|
-
v-else
|
|
46
|
-
aria-hidden="true"
|
|
47
|
-
class="mr-2"
|
|
48
|
-
icon
|
|
49
|
-
text
|
|
50
|
-
></r-btn>
|
|
51
|
-
|
|
52
|
-
<slot :item="item">{{ item.title || `Item ${item[keyProp]}` }}</slot>
|
|
53
|
-
</div>
|
|
54
|
-
|
|
55
|
-
<transition name="nestable-children">
|
|
56
|
-
<div
|
|
57
|
-
v-if="hasChildren && !closed"
|
|
58
|
-
class="nestable-list ms-5"
|
|
59
|
-
role="group"
|
|
60
|
-
>
|
|
61
|
-
<template
|
|
62
|
-
v-for="(child, childIndex) in item[childrenProp]"
|
|
63
|
-
:key="child[keyProp]"
|
|
64
|
-
>
|
|
65
|
-
<NestableItem
|
|
66
|
-
:childrenProp="childrenProp"
|
|
67
|
-
:dragItem="dragItem"
|
|
68
|
-
:editable="editable"
|
|
69
|
-
:index="childIndex"
|
|
70
|
-
:item="child"
|
|
71
|
-
:keyProp="keyProp"
|
|
72
|
-
:maxDepth="maxDepth"
|
|
73
|
-
is-child
|
|
74
|
-
@delete="$emit('delete', $event)"
|
|
75
|
-
@drag-start="$emit('drag-start', $event)"
|
|
76
|
-
@touch-move="$emit('touch-move', $event)"
|
|
77
|
-
@mouse-enter="$emit('mouse-enter', $event)"
|
|
78
|
-
@drag-end="$emit('drag-end', $event)"
|
|
79
|
-
>
|
|
80
|
-
<template v-slot="{ item }">
|
|
81
|
-
<slot :item="item" itemscope>{{ item.title || `Item ${item[keyProp]}` }}</slot>
|
|
82
|
-
</template>
|
|
83
|
-
</NestableItem>
|
|
84
|
-
</template>
|
|
85
|
-
</div>
|
|
86
|
-
</transition>
|
|
87
|
-
</div>
|
|
88
|
-
</template>
|
|
89
|
-
|
|
90
|
-
<script>
|
|
91
|
-
export default {
|
|
92
|
-
name: "NestableItem",
|
|
93
|
-
props: {
|
|
94
|
-
editable: Boolean,
|
|
95
|
-
keyProp: String,
|
|
96
|
-
item: {
|
|
97
|
-
type: Object,
|
|
98
|
-
required: true,
|
|
99
|
-
default: () => ({}),
|
|
100
|
-
},
|
|
101
|
-
index: {
|
|
102
|
-
type: Number,
|
|
103
|
-
required: false,
|
|
104
|
-
default: null,
|
|
105
|
-
},
|
|
106
|
-
isChild: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
required: false,
|
|
109
|
-
default: false,
|
|
110
|
-
},
|
|
111
|
-
childrenProp: String,
|
|
112
|
-
dragItem: Object,
|
|
113
|
-
maxDepth: Number,
|
|
114
|
-
},
|
|
115
|
-
data() {
|
|
116
|
-
return {
|
|
117
|
-
breakPoint: null,
|
|
118
|
-
moveDown: false,
|
|
119
|
-
closed: false,
|
|
120
|
-
isKeyboardNavigating: false
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
computed: {
|
|
124
|
-
isDragging() {
|
|
125
|
-
return (
|
|
126
|
-
this.dragItem && this.dragItem[this.keyProp] === this.item[this.keyProp]
|
|
127
|
-
);
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
hasChildren() {
|
|
131
|
-
return (
|
|
132
|
-
this.item[this.childrenProp] && this.item[this.childrenProp].length > 0
|
|
133
|
-
);
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
itemClasses() {
|
|
137
|
-
const classes = [
|
|
138
|
-
"nestable-item",
|
|
139
|
-
`nestable-item-${this.item[this.keyProp]}`,
|
|
140
|
-
];
|
|
141
|
-
|
|
142
|
-
if (this.isDragging) {
|
|
143
|
-
classes.push("is-dragging");
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (this.isKeyboardNavigating) {
|
|
147
|
-
classes.push("is-focused");
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return classes;
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
depth() {
|
|
154
|
-
return this.getDepth(this.item);
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
methods: {
|
|
158
|
-
getDepth(item, level = 0) {
|
|
159
|
-
if (!item[this.childrenProp] || item[this.childrenProp].length === 0) {
|
|
160
|
-
return level;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
let maxDepth = level;
|
|
164
|
-
item[this.childrenProp].forEach(child => {
|
|
165
|
-
const childDepth = this.getDepth(child, level + 1);
|
|
166
|
-
if (childDepth > maxDepth) {
|
|
167
|
-
maxDepth = childDepth;
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
return maxDepth;
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
toggleChildren() {
|
|
175
|
-
this.closed = !this.closed;
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
del(item) {
|
|
179
|
-
this.$emit("delete", item);
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
dragstart(event) {
|
|
183
|
-
event.dataTransfer.setData('text/plain', this.item[this.keyProp]);
|
|
184
|
-
event.dataTransfer.effectAllowed = 'move';
|
|
185
|
-
this.$emit("drag-start", [event, this.item]);
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
touchend(event) {
|
|
189
|
-
this.$emit("drag-end", event);
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
touchmove(event) {
|
|
193
|
-
this.$emit("touch-move", event);
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
onMouseEnter(event) {
|
|
197
|
-
if (!this.dragItem) return;
|
|
198
|
-
|
|
199
|
-
if (!event.movementY) {
|
|
200
|
-
return this.sendNotification(event);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
this.moveDown = event.movementY > 0;
|
|
204
|
-
this.breakPoint = event.target.getBoundingClientRect().height / 2;
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
onMouseLeave() {
|
|
208
|
-
this.breakPoint = null;
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
onMouseMove(event) {
|
|
212
|
-
if (!this.breakPoint) return;
|
|
213
|
-
|
|
214
|
-
const delta = event.offsetY - this.breakPoint;
|
|
215
|
-
|
|
216
|
-
if (this.moveDown && delta < this.breakPoint / 4) return;
|
|
217
|
-
if (!this.moveDown && delta > -this.breakPoint / 4) return;
|
|
218
|
-
|
|
219
|
-
this.sendNotification(event);
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
sendNotification(event) {
|
|
223
|
-
this.breakPoint = null;
|
|
224
|
-
this.$emit("mouse-enter", [event, this.item]);
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
onKeyDown(event) {
|
|
228
|
-
// Handle keyboard navigation
|
|
229
|
-
switch (event.key) {
|
|
230
|
-
case 'ArrowUp':
|
|
231
|
-
this.navigate(-1);
|
|
232
|
-
break;
|
|
233
|
-
case 'ArrowDown':
|
|
234
|
-
this.navigate(1);
|
|
235
|
-
break;
|
|
236
|
-
case 'ArrowLeft':
|
|
237
|
-
if (!this.closed && this.hasChildren) {
|
|
238
|
-
this.closed = true;
|
|
239
|
-
}
|
|
240
|
-
break;
|
|
241
|
-
case 'ArrowRight':
|
|
242
|
-
if (this.closed && this.hasChildren) {
|
|
243
|
-
this.closed = false;
|
|
244
|
-
}
|
|
245
|
-
break;
|
|
246
|
-
case 'Enter':
|
|
247
|
-
case ' ':
|
|
248
|
-
if (this.hasChildren) {
|
|
249
|
-
this.closed = !this.closed;
|
|
250
|
-
}
|
|
251
|
-
break;
|
|
252
|
-
case 'Delete':
|
|
253
|
-
if (this.editable) {
|
|
254
|
-
this.del(this.item);
|
|
255
|
-
}
|
|
256
|
-
break;
|
|
257
|
-
default:
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
event.preventDefault();
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
navigate(direction) {
|
|
265
|
-
// Implement keyboard navigation between items
|
|
266
|
-
this.isKeyboardNavigating = true;
|
|
267
|
-
// You'll need to implement actual navigation logic here
|
|
268
|
-
// This would involve finding the next/previous item in the tree
|
|
269
|
-
// and focusing it
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
</script>
|
|
274
|
-
|
|
275
|
-
<style lang="scss">
|
|
276
|
-
@use "../../style/variables/base";
|
|
277
|
-
|
|
278
|
-
.#{base.$prefix}nestable {
|
|
279
|
-
.nestable-item {
|
|
280
|
-
outline: none;
|
|
281
|
-
|
|
282
|
-
&.is-focused {
|
|
283
|
-
box-shadow: 0 0 0 2px #4a90e2;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.nestable-children-enter-active,
|
|
288
|
-
.nestable-children-leave-active {
|
|
289
|
-
transition: all 0.3s ease;
|
|
290
|
-
overflow: hidden;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.nestable-children-enter-from,
|
|
294
|
-
.nestable-children-leave-to {
|
|
295
|
-
opacity: 0;
|
|
296
|
-
transform: translateY(-10px);
|
|
297
|
-
max-height: 0;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.nestable-children-enter-to,
|
|
301
|
-
.nestable-children-leave-from {
|
|
302
|
-
opacity: 1;
|
|
303
|
-
transform: translateY(0);
|
|
304
|
-
max-height: 1000px;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
</style>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
data() {
|
|
3
|
-
return {
|
|
4
|
-
form: {},
|
|
5
|
-
};
|
|
6
|
-
},
|
|
7
|
-
methods: {
|
|
8
|
-
lastId(list) {
|
|
9
|
-
let r = 0;
|
|
10
|
-
list.map((item) => {
|
|
11
|
-
if (typeof item.id === "number" && item.id > r) {
|
|
12
|
-
r = item.id;
|
|
13
|
-
}
|
|
14
|
-
let d = this.lastId(item[this.childrenProp]);
|
|
15
|
-
if (d > r) {
|
|
16
|
-
r = d;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return r;
|
|
20
|
-
},
|
|
21
|
-
add() {
|
|
22
|
-
let items = this.modelValue;
|
|
23
|
-
Object.assign(this.form, {
|
|
24
|
-
[this.keyProp]: this.lastId(items) + 1,
|
|
25
|
-
[this.childrenProp]: [],
|
|
26
|
-
})
|
|
27
|
-
items.push(this.form);
|
|
28
|
-
this.$emit("update:model-value", items);
|
|
29
|
-
this.form = {};
|
|
30
|
-
},
|
|
31
|
-
del(item) {
|
|
32
|
-
const removePath = this.getSplicePath(
|
|
33
|
-
this.getPathById(item[this.keyProp]),
|
|
34
|
-
{
|
|
35
|
-
numToRemove: 1,
|
|
36
|
-
childrenProp: this.childrenProp,
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
let items = this.modelValue;
|
|
40
|
-
items = this.update(items, removePath);
|
|
41
|
-
this.$emit("update:model-value", items);
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as rNestable from './index.vue'
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="nestable"
|
|
4
|
-
:class="`${$r.prefix}nestable`"
|
|
5
|
-
aria-label="Nestable list"
|
|
6
|
-
>
|
|
7
|
-
<div class="nestable-list nestable-group" role="list">
|
|
8
|
-
<template v-for="(item, index) in modelValue" :key="item[keyProp]">
|
|
9
|
-
<nestable-item
|
|
10
|
-
:childrenProp="childrenProp"
|
|
11
|
-
:dragItem="dragItem"
|
|
12
|
-
:editable="editable"
|
|
13
|
-
:index="index"
|
|
14
|
-
:item="item"
|
|
15
|
-
:keyProp="keyProp"
|
|
16
|
-
:maxDepth="maxDepth"
|
|
17
|
-
@delete="del"
|
|
18
|
-
@drag-start="dragstart"
|
|
19
|
-
@touch-move="touchmove"
|
|
20
|
-
@mouse-enter="mouseenter"
|
|
21
|
-
@drag-end="onDragEnd"
|
|
22
|
-
>
|
|
23
|
-
<template v-slot="{ item }">
|
|
24
|
-
<slot :item="item">{{ item.title || `Item ${item[keyProp]}` }}</slot>
|
|
25
|
-
</template>
|
|
26
|
-
</nestable-item>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div v-if="editable" class="d-flex v-end w-full mt-3">
|
|
33
|
-
<slot :add="add" :form="form" name="form">
|
|
34
|
-
<div class="pe-1 flex-grow-1">
|
|
35
|
-
<r-text-input
|
|
36
|
-
ref="inputField"
|
|
37
|
-
v-model="form.title"
|
|
38
|
-
:label="labelInput"
|
|
39
|
-
@keydown.enter="form.title && add()"
|
|
40
|
-
></r-text-input>
|
|
41
|
-
</div>
|
|
42
|
-
<r-btn
|
|
43
|
-
:aria-label="'Add new item'"
|
|
44
|
-
:disabled="!form.title"
|
|
45
|
-
class="color-success"
|
|
46
|
-
icon
|
|
47
|
-
@click="add"
|
|
48
|
-
>
|
|
49
|
-
<r-icon v-html="$r.icons.plus"></r-icon>
|
|
50
|
-
</r-btn>
|
|
51
|
-
</slot>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
55
|
-
|
|
56
|
-
<script>
|
|
57
|
-
import {defineAsyncComponent, nextTick} from 'vue'
|
|
58
|
-
import methods from "./methods.js";
|
|
59
|
-
import editable from "./editable.js";
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
name: "r-nestable",
|
|
63
|
-
components: {
|
|
64
|
-
NestableItem: defineAsyncComponent(() => import('./NestableItem.vue')),
|
|
65
|
-
},
|
|
66
|
-
mixins: [methods, editable],
|
|
67
|
-
props: {
|
|
68
|
-
labelInput: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: "New item"
|
|
71
|
-
},
|
|
72
|
-
editable: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
default: false
|
|
75
|
-
},
|
|
76
|
-
modelValue: {
|
|
77
|
-
type: Array,
|
|
78
|
-
default: () => [],
|
|
79
|
-
},
|
|
80
|
-
threshold: {
|
|
81
|
-
type: Number,
|
|
82
|
-
default: 30,
|
|
83
|
-
},
|
|
84
|
-
maxDepth: {
|
|
85
|
-
type: Number,
|
|
86
|
-
default: 7,
|
|
87
|
-
},
|
|
88
|
-
keyProp: {
|
|
89
|
-
type: String,
|
|
90
|
-
default: "id",
|
|
91
|
-
},
|
|
92
|
-
childrenProp: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: "children",
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
data() {
|
|
98
|
-
return {
|
|
99
|
-
itemsOld: null,
|
|
100
|
-
dragItem: null,
|
|
101
|
-
mouse: {
|
|
102
|
-
last: {x: 0, y: 0},
|
|
103
|
-
shift: {x: 0, y: 0},
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
},
|
|
107
|
-
mounted() {
|
|
108
|
-
const items = this.listAddChildren(this.modelValue, this.childrenProp);
|
|
109
|
-
this.$emit("update:model-value", items);
|
|
110
|
-
},
|
|
111
|
-
beforeUnmount() {
|
|
112
|
-
this.stopTrackMouse();
|
|
113
|
-
},
|
|
114
|
-
methods: {
|
|
115
|
-
// Override add method to focus input after adding
|
|
116
|
-
async add() {
|
|
117
|
-
let items = this.modelValue;
|
|
118
|
-
Object.assign(this.form, {
|
|
119
|
-
[this.keyProp]: this.lastId(items) + 1,
|
|
120
|
-
[this.childrenProp]: [],
|
|
121
|
-
})
|
|
122
|
-
items.push(this.form);
|
|
123
|
-
this.$emit("update:model-value", items);
|
|
124
|
-
this.form = {};
|
|
125
|
-
|
|
126
|
-
await nextTick();
|
|
127
|
-
this.$refs.inputField?.focus();
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
// Update mouse move for placeholder positioning
|
|
131
|
-
onMouseMove(event) {
|
|
132
|
-
event && event.preventDefault();
|
|
133
|
-
|
|
134
|
-
const {clientX, clientY} = this.getXandYFromEvent(event);
|
|
135
|
-
|
|
136
|
-
if (this.mouse.last.x === 0) {
|
|
137
|
-
this.mouse.last.x = clientX;
|
|
138
|
-
this.mouse.last.y = clientY;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const diffX = this.$r.rtl
|
|
142
|
-
? this.mouse.last.x - clientX
|
|
143
|
-
: clientX - this.mouse.last.x;
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
(diffX >= 0 && this.mouse.shift.x >= 0) ||
|
|
147
|
-
(diffX <= 0 && this.mouse.shift.x <= 0)
|
|
148
|
-
) {
|
|
149
|
-
this.mouse.shift.x += diffX;
|
|
150
|
-
} else {
|
|
151
|
-
this.mouse.shift.x = 0;
|
|
152
|
-
}
|
|
153
|
-
this.mouse.last.x = clientX;
|
|
154
|
-
this.mouse.last.y = clientY;
|
|
155
|
-
|
|
156
|
-
if (Math.abs(this.mouse.shift.x) > this.threshold) {
|
|
157
|
-
if (this.mouse.shift.x > 0) {
|
|
158
|
-
this.tryIncreaseDepth(this.dragItem);
|
|
159
|
-
} else {
|
|
160
|
-
this.tryDecreaseDepth(this.dragItem);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
this.mouse.shift.x = 0;
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
onDragEnd(event, isCancel = false) {
|
|
168
|
-
event?.preventDefault();
|
|
169
|
-
|
|
170
|
-
this.stopTrackMouse();
|
|
171
|
-
if (isCancel) {
|
|
172
|
-
this.dragRevert();
|
|
173
|
-
} else {
|
|
174
|
-
this.dragApply();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
this.pathTo = null;
|
|
178
|
-
this.itemsOld = null;
|
|
179
|
-
this.dragItem = null;
|
|
180
|
-
},
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
</script>
|
|
184
|
-
|
|
185
|
-
<style lang="scss">
|
|
186
|
-
@use "../../style/variables/base";
|
|
187
|
-
|
|
188
|
-
.#{base.$prefix}nestable {
|
|
189
|
-
position: relative;
|
|
190
|
-
|
|
191
|
-
.nestable-handle {
|
|
192
|
-
cursor: grab;
|
|
193
|
-
transition: transform 0.2s ease, opacity 0.2s ease;
|
|
194
|
-
|
|
195
|
-
&:active {
|
|
196
|
-
cursor: grabbing;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.is-dragging {
|
|
201
|
-
opacity: 0.5;
|
|
202
|
-
cursor: grabbing !important;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.nestable-drag-item {
|
|
206
|
-
display: none;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.nestable-item-content {
|
|
210
|
-
display: flex;
|
|
211
|
-
align-items: center;
|
|
212
|
-
padding: 8px 12px;
|
|
213
|
-
transition: background 0.2s ease;
|
|
214
|
-
|
|
215
|
-
&:hover {
|
|
216
|
-
opacity: 0.8;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
.nestable-list {
|
|
222
|
-
position: relative;
|
|
223
|
-
transition: all 0.3s ease;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
</style>
|