quasar-ui-danx 0.0.9 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -2
- package/src/components/ActionTable/ActionTable.vue +135 -0
- package/src/components/ActionTable/BatchActionMenu.vue +60 -0
- package/src/components/ActionTable/EmptyTableState.vue +33 -0
- package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +36 -0
- package/src/components/ActionTable/Filters/FilterGroupItem.vue +28 -0
- package/src/components/ActionTable/Filters/FilterGroupList.vue +76 -0
- package/src/components/ActionTable/Filters/FilterListToggle.vue +50 -0
- package/src/components/ActionTable/Filters/FilterableField.vue +141 -0
- package/src/components/ActionTable/Form/Fields/BooleanField.vue +37 -0
- package/src/components/ActionTable/Form/Fields/ConfirmPasswordField.vue +46 -0
- package/src/components/ActionTable/Form/Fields/DateField.vue +59 -0
- package/src/components/ActionTable/Form/Fields/DateRangeField.vue +110 -0
- package/src/components/ActionTable/Form/Fields/DateTimeField.vue +50 -0
- package/src/components/ActionTable/Form/Fields/DateTimePicker.vue +59 -0
- package/src/components/ActionTable/Form/Fields/EditableDiv.vue +39 -0
- package/src/components/ActionTable/Form/Fields/FieldLabel.vue +32 -0
- package/src/components/ActionTable/Form/Fields/FileUploadButton.vue +78 -0
- package/src/components/ActionTable/Form/Fields/InlineDateTimeField.vue +44 -0
- package/src/components/ActionTable/Form/Fields/IntegerField.vue +26 -0
- package/src/components/ActionTable/Form/Fields/LabeledInput.vue +63 -0
- package/src/components/ActionTable/Form/Fields/MultiFileField.vue +91 -0
- package/src/components/ActionTable/Form/Fields/MultiKeywordField.vue +57 -0
- package/src/components/ActionTable/Form/Fields/NewPasswordField.vue +39 -0
- package/src/components/ActionTable/Form/Fields/NumberField.vue +94 -0
- package/src/components/ActionTable/Form/Fields/NumberRangeField.vue +140 -0
- package/src/components/ActionTable/Form/Fields/SelectDrawer.vue +136 -0
- package/src/components/ActionTable/Form/Fields/SelectField.vue +318 -0
- package/src/components/ActionTable/Form/Fields/SelectWithChildrenField.vue +81 -0
- package/src/components/ActionTable/Form/Fields/SingleFileField.vue +78 -0
- package/src/components/ActionTable/Form/Fields/TextField.vue +82 -0
- package/src/components/ActionTable/Form/Fields/WysiwygField.vue +46 -0
- package/src/components/ActionTable/Form/Fields/index.ts +23 -0
- package/src/components/ActionTable/Form/RenderedForm.vue +74 -0
- package/src/components/ActionTable/RenderComponentColumn.vue +22 -0
- package/src/components/ActionTable/TableSummaryRow.vue +95 -0
- package/src/components/ActionTable/index.ts +15 -0
- package/src/components/ActionTable/listActions.ts +361 -0
- package/src/components/ActionTable/tableColumns.ts +72 -0
- package/src/components/ActionTable/tableHelpers.ts +83 -0
- package/src/components/DragAndDrop/listDragAndDrop.ts +210 -210
- package/src/components/Utility/CollapsableSidebar.vue +119 -0
- package/src/components/Utility/ContentDrawer.vue +70 -0
- package/src/components/Utility/Dialogs/ConfirmDialog.vue +132 -0
- package/src/components/Utility/Dialogs/FullScreenDialog.vue +46 -0
- package/src/components/Utility/Dialogs/InfoDialog.vue +92 -0
- package/src/components/Utility/Dialogs/InputDialog.vue +35 -0
- package/src/components/Utility/SvgImg.vue +10 -5
- package/src/components/Utility/Transitions/ListTransition.vue +50 -0
- package/src/components/Utility/Transitions/SlideTransition.vue +63 -0
- package/src/components/Utility/Transitions/StaggeredListTransition.vue +97 -0
- package/src/components/Utility/index.ts +9 -0
- package/src/components/index.ts +3 -0
- package/src/helpers/FileUpload.ts +294 -0
- package/src/helpers/FlashMessages.ts +79 -0
- package/src/helpers/array.ts +37 -0
- package/src/helpers/compatibility.ts +64 -0
- package/src/helpers/date.ts +5 -0
- package/src/helpers/download.ts +192 -0
- package/src/helpers/downloadPdf.ts +92 -0
- package/src/helpers/files.ts +52 -0
- package/src/helpers/formats.ts +183 -0
- package/src/helpers/http.ts +62 -0
- package/src/helpers/index.ts +10 -1
- package/src/helpers/multiFileUpload.ts +68 -0
- package/src/helpers/singleFileUpload.ts +54 -0
- package/src/helpers/storage.ts +8 -0
@@ -7,231 +7,231 @@ import { DragAndDrop } from "./dragAndDrop";
|
|
7
7
|
* @class
|
8
8
|
*/
|
9
9
|
export class ListDragAndDrop extends DragAndDrop {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Callback that fires after dragging has ended and the list position has changed from the original
|
26
|
-
* @param cb
|
27
|
-
* @returns {ListDragAndDrop}
|
28
|
-
*/
|
29
|
-
onPositionChange(cb) {
|
30
|
-
this.onPositionChangeCb = cb;
|
31
|
-
return this;
|
32
|
-
}
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Callback that fires while dragging the element when the cursor's position has changed in the list
|
36
|
-
* @param cb
|
37
|
-
* @returns {ListDragAndDrop}
|
38
|
-
*/
|
39
|
-
onDragPositionChange(cb) {
|
40
|
-
this.onDragPositionChangeCb = cb;
|
41
|
-
return this;
|
42
|
-
}
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Start listening for drag events and prepare an element for drag/drop
|
46
|
-
* @param e
|
47
|
-
* @param data
|
48
|
-
*/
|
49
|
-
dragStart(e, data) {
|
50
|
-
super.dragStart(e, data);
|
51
|
-
|
52
|
-
if (this.currentDropZone) {
|
53
|
-
this.listPosition = this.getListPosition(e.target);
|
54
|
-
this.initialPosition = this.listPosition;
|
55
|
-
this.updateScrollPosition();
|
10
|
+
listPosition = 0;
|
11
|
+
cursorPosition = 0;
|
12
|
+
initialPosition = 0;
|
13
|
+
onPositionChangeCb = null;
|
14
|
+
onDragPositionChangeCb = null;
|
15
|
+
placeholder = null;
|
16
|
+
|
17
|
+
constructor(options = {}) {
|
18
|
+
super({
|
19
|
+
showPlaceholder: true,
|
20
|
+
...options,
|
21
|
+
});
|
56
22
|
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
// If our list position has changed, trigger the drop callback
|
68
|
-
if (this.listPosition !== this.initialPosition) {
|
69
|
-
this.onPositionChangeCb &&
|
70
|
-
this.onPositionChangeCb(this.listPosition, this.initialPosition, draggableData);
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Callback that fires after dragging has ended and the list position has changed from the original
|
26
|
+
* @param cb
|
27
|
+
* @returns {ListDragAndDrop}
|
28
|
+
*/
|
29
|
+
onPositionChange(cb) {
|
30
|
+
this.onPositionChangeCb = cb;
|
31
|
+
return this;
|
71
32
|
}
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
}
|
82
|
-
|
83
|
-
/**
|
84
|
-
* Notify if the targeted position of the cursor is different from the current position
|
85
|
-
* @param e
|
86
|
-
*/
|
87
|
-
updateListPosition(e) {
|
88
|
-
const prevPosition = this.listPosition;
|
89
|
-
const newPosition = this.getListPositionOfPoint({
|
90
|
-
x: e.clientX,
|
91
|
-
y: e.clientY,
|
92
|
-
});
|
93
|
-
|
94
|
-
// If the cursor position has changed, we should update the rendering and see if our actual list position has
|
95
|
-
// changed
|
96
|
-
if (this.cursorPosition !== newPosition) {
|
97
|
-
this.cursorPosition = newPosition;
|
98
|
-
this.listPosition =
|
99
|
-
this.initialPosition < this.cursorPosition
|
100
|
-
? this.cursorPosition - 1
|
101
|
-
: this.cursorPosition;
|
102
|
-
if (this.options.showPlaceholder) {
|
103
|
-
this.renderPlaceholder();
|
104
|
-
}
|
105
|
-
|
106
|
-
// The position has changed, trigger the callback
|
107
|
-
if (this.listPosition !== prevPosition) {
|
108
|
-
this.onDragPositionChangeCb &&
|
109
|
-
this.onDragPositionChangeCb(this.listPosition, this.draggableData);
|
110
|
-
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Callback that fires while dragging the element when the cursor's position has changed in the list
|
36
|
+
* @param cb
|
37
|
+
* @returns {ListDragAndDrop}
|
38
|
+
*/
|
39
|
+
onDragPositionChange(cb) {
|
40
|
+
this.onDragPositionChangeCb = cb;
|
41
|
+
return this;
|
111
42
|
}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Start listening for drag events and prepare an element for drag/drop
|
46
|
+
* @param e
|
47
|
+
* @param data
|
48
|
+
*/
|
49
|
+
dragStart(e, data) {
|
50
|
+
super.dragStart(e, data);
|
51
|
+
|
52
|
+
if (this.currentDropZone) {
|
53
|
+
this.listPosition = this.getListPosition(e.target);
|
54
|
+
this.initialPosition = this.listPosition;
|
55
|
+
this.updateScrollPosition();
|
56
|
+
}
|
126
57
|
}
|
127
58
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
/**
|
142
|
-
* Find the element at the current cursor position in the given drop zone
|
143
|
-
* @param point
|
144
|
-
* @returns {null}
|
145
|
-
*/
|
146
|
-
getListPositionOfPoint(point) {
|
147
|
-
let index = 0;
|
148
|
-
const children = this.getChildren();
|
149
|
-
|
150
|
-
while (index < children.length) {
|
151
|
-
const rect = children[index].getBoundingClientRect();
|
152
|
-
if (this.isVertical()) {
|
153
|
-
if (point.y < rect.top + rect.height / 2) {
|
154
|
-
break;
|
59
|
+
/**
|
60
|
+
* When dragging has ended, check for list position changes and fire the onPositionChange callback if it has
|
61
|
+
*/
|
62
|
+
dragEnd(e) {
|
63
|
+
const draggableData = this.draggableData;
|
64
|
+
this.placeholder?.remove();
|
65
|
+
super.dragEnd(e);
|
66
|
+
|
67
|
+
// If our list position has changed, trigger the drop callback
|
68
|
+
if (this.listPosition !== this.initialPosition) {
|
69
|
+
this.onPositionChangeCb &&
|
70
|
+
this.onPositionChangeCb(this.listPosition, this.initialPosition, draggableData);
|
155
71
|
}
|
156
|
-
|
157
|
-
|
158
|
-
|
72
|
+
}
|
73
|
+
|
74
|
+
/**
|
75
|
+
* The dragging element is moving
|
76
|
+
* @param e
|
77
|
+
*/
|
78
|
+
dragOver(e) {
|
79
|
+
super.dragOver(e);
|
80
|
+
this.updateListPosition(e);
|
81
|
+
}
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Notify if the targeted position of the cursor is different from the current position
|
85
|
+
* @param e
|
86
|
+
*/
|
87
|
+
updateListPosition(e) {
|
88
|
+
const prevPosition = this.listPosition;
|
89
|
+
const newPosition = this.getListPositionOfPoint({
|
90
|
+
x: e.clientX,
|
91
|
+
y: e.clientY,
|
92
|
+
});
|
93
|
+
|
94
|
+
// If the cursor position has changed, we should update the rendering and see if our actual list position has
|
95
|
+
// changed
|
96
|
+
if (this.cursorPosition !== newPosition) {
|
97
|
+
this.cursorPosition = newPosition;
|
98
|
+
this.listPosition =
|
99
|
+
this.initialPosition < this.cursorPosition
|
100
|
+
? this.cursorPosition - 1
|
101
|
+
: this.cursorPosition;
|
102
|
+
if (this.options.showPlaceholder) {
|
103
|
+
this.renderPlaceholder();
|
104
|
+
}
|
105
|
+
|
106
|
+
// The position has changed, trigger the callback
|
107
|
+
if (this.listPosition !== prevPosition) {
|
108
|
+
this.onDragPositionChangeCb &&
|
109
|
+
this.onDragPositionChangeCb(this.listPosition, this.draggableData);
|
110
|
+
}
|
159
111
|
}
|
160
|
-
}
|
161
|
-
index++;
|
162
112
|
}
|
163
113
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
const cursorPos = this.isVertical() ? this.cursorY : this.cursorX;
|
177
|
-
const rectStart = this.isVertical() ? rect.top : rect.left;
|
178
|
-
const rectEnd = this.isVertical() ? rect.bottom : rect.right;
|
179
|
-
const beforeDiff = rectStart + threshold - cursorPos;
|
180
|
-
const afterDiff = cursorPos - (rectEnd - threshold);
|
181
|
-
|
182
|
-
if (beforeDiff > 0) {
|
183
|
-
velocity = -velocityFn(beforeDiff);
|
184
|
-
} else if (afterDiff > 0) {
|
185
|
-
velocity = velocityFn(afterDiff);
|
186
|
-
}
|
187
|
-
|
188
|
-
if (velocity) {
|
189
|
-
if (this.isVertical()) {
|
190
|
-
this.currentDropZone.scrollTo({
|
191
|
-
top: this.currentDropZone.scrollTop + velocity,
|
192
|
-
behavior: "smooth",
|
193
|
-
});
|
194
|
-
} else {
|
195
|
-
this.currentDropZone.scrollTo({
|
196
|
-
left: this.currentDropZone.scrollLeft + velocity,
|
197
|
-
behavior: "smooth",
|
198
|
-
});
|
114
|
+
/**
|
115
|
+
* Find the numeric position of the element in the children of the list
|
116
|
+
* @returns {Number|null}
|
117
|
+
* @param item
|
118
|
+
*/
|
119
|
+
getListPosition(item) {
|
120
|
+
let index = 0;
|
121
|
+
for (const child of this.getChildren()) {
|
122
|
+
if (child === item) {
|
123
|
+
return index;
|
124
|
+
}
|
125
|
+
index++;
|
199
126
|
}
|
200
|
-
}
|
201
127
|
|
202
|
-
|
128
|
+
return null;
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Get all the children of the current drop zone, excluding the placeholder
|
133
|
+
* @returns {*}
|
134
|
+
*/
|
135
|
+
getChildren() {
|
136
|
+
return [...this.currentDropZone.children].filter(
|
137
|
+
(c) => c.className.match(/drag-placeholder/) === null
|
138
|
+
);
|
203
139
|
}
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Find the element at the current cursor position in the given drop zone
|
143
|
+
* @param point
|
144
|
+
* @returns {null}
|
145
|
+
*/
|
146
|
+
getListPositionOfPoint(point) {
|
147
|
+
let index = 0;
|
148
|
+
const children = this.getChildren();
|
149
|
+
|
150
|
+
while (index < children.length) {
|
151
|
+
const rect = children[index].getBoundingClientRect();
|
152
|
+
if (this.isVertical()) {
|
153
|
+
if (point.y < rect.top + rect.height / 2) {
|
154
|
+
break;
|
155
|
+
}
|
156
|
+
} else {
|
157
|
+
if (point.x < rect.left + rect.width / 2) {
|
158
|
+
break;
|
159
|
+
}
|
160
|
+
}
|
161
|
+
index++;
|
162
|
+
}
|
163
|
+
|
164
|
+
return index;
|
213
165
|
}
|
214
166
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
167
|
+
/**
|
168
|
+
* Updates the scroll position while dragging an element so a user can navigate a longer list while dragging
|
169
|
+
*/
|
170
|
+
updateScrollPosition() {
|
171
|
+
if (this.currentDropZone) {
|
172
|
+
const rect = this.currentDropZone.getBoundingClientRect();
|
173
|
+
const threshold = 100;
|
174
|
+
let velocity = 0;
|
175
|
+
const velocityFn = (x) => x * 5;
|
176
|
+
const cursorPos = this.isVertical() ? this.cursorY : this.cursorX;
|
177
|
+
const rectStart = this.isVertical() ? rect.top : rect.left;
|
178
|
+
const rectEnd = this.isVertical() ? rect.bottom : rect.right;
|
179
|
+
const beforeDiff = rectStart + threshold - cursorPos;
|
180
|
+
const afterDiff = cursorPos - (rectEnd - threshold);
|
181
|
+
|
182
|
+
if (beforeDiff > 0) {
|
183
|
+
velocity = -velocityFn(beforeDiff);
|
184
|
+
} else if (afterDiff > 0) {
|
185
|
+
velocity = velocityFn(afterDiff);
|
186
|
+
}
|
187
|
+
|
188
|
+
if (velocity) {
|
189
|
+
if (this.isVertical()) {
|
190
|
+
this.currentDropZone.scrollTo({
|
191
|
+
top: this.currentDropZone.scrollTop + velocity,
|
192
|
+
behavior: "smooth",
|
193
|
+
});
|
194
|
+
} else {
|
195
|
+
this.currentDropZone.scrollTo({
|
196
|
+
left: this.currentDropZone.scrollLeft + velocity,
|
197
|
+
behavior: "smooth",
|
198
|
+
});
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
setTimeout(() => this.updateScrollPosition(), 500);
|
203
|
+
}
|
225
204
|
}
|
226
205
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
206
|
+
/**
|
207
|
+
* Render a placeholder element at the given position (in between the elements)
|
208
|
+
*/
|
209
|
+
renderPlaceholder() {
|
210
|
+
if (!this.placeholder) {
|
211
|
+
this.placeholder = document.createElement("div");
|
212
|
+
this.placeholder.classList.add("drag-placeholder");
|
213
|
+
}
|
214
|
+
|
215
|
+
// Make sure the placeholder is oriented correctly
|
216
|
+
if (this.isVertical()) {
|
217
|
+
this.placeholder.classList.add("direction-vertical");
|
218
|
+
this.placeholder.classList.remove("direction-horizontal");
|
219
|
+
this.placeholder.style.height = undefined;
|
220
|
+
} else {
|
221
|
+
this.placeholder.classList.add("direction-horizontal");
|
222
|
+
this.placeholder.classList.remove("direction-vertical");
|
223
|
+
this.placeholder.style.height =
|
224
|
+
this.currentDropZone.getBoundingClientRect().height + "px";
|
225
|
+
}
|
226
|
+
|
227
|
+
const children = this.getChildren();
|
228
|
+
if (this.cursorPosition < children.length) {
|
229
|
+
this.currentDropZone.insertBefore(
|
230
|
+
this.placeholder,
|
231
|
+
children[this.cursorPosition]
|
232
|
+
);
|
233
|
+
} else {
|
234
|
+
this.currentDropZone.appendChild(this.placeholder);
|
235
|
+
}
|
235
236
|
}
|
236
|
-
}
|
237
237
|
}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
class="collapsable-sidebar overflow-x-hidden overflow-y-scroll relative"
|
4
|
+
:class="{
|
5
|
+
'is-collapsed': isCollapsed,
|
6
|
+
'is-right-side': rightSide,
|
7
|
+
[displayClass]: true,
|
8
|
+
}"
|
9
|
+
:style="style"
|
10
|
+
>
|
11
|
+
<div class="flex-grow max-w-full">
|
12
|
+
<slot :is-collapsed="isCollapsed" />
|
13
|
+
</div>
|
14
|
+
<template v-if="!disabled && (!hideToggleOnCollapse || !isCollapsed)">
|
15
|
+
<div
|
16
|
+
v-if="!toggleAtTop"
|
17
|
+
class="flex w-full p-4"
|
18
|
+
:class="rightSide ? 'justify-start' : 'justify-end'"
|
19
|
+
>
|
20
|
+
<slot name="toggle">
|
21
|
+
<QBtn
|
22
|
+
class="btn-white-gray"
|
23
|
+
@click="toggleCollapse"
|
24
|
+
>
|
25
|
+
<ToggleIcon
|
26
|
+
class="w-5 transition-all"
|
27
|
+
:class="{ 'rotate-180': rightSide ? !isCollapsed : isCollapsed }"
|
28
|
+
/>
|
29
|
+
</QBtn>
|
30
|
+
</slot>
|
31
|
+
</div>
|
32
|
+
<div
|
33
|
+
v-else
|
34
|
+
class="absolute top-0 right-0 cursor-pointer p-2"
|
35
|
+
:class="toggleClass"
|
36
|
+
@click="toggleCollapse"
|
37
|
+
>
|
38
|
+
<ToggleIcon
|
39
|
+
class="w-5 transition-all"
|
40
|
+
:class="{ 'rotate-180': rightSide ? !isCollapsed : isCollapsed }"
|
41
|
+
/>
|
42
|
+
</div>
|
43
|
+
</template>
|
44
|
+
</div>
|
45
|
+
</template>
|
46
|
+
<script setup>
|
47
|
+
import { ChevronLeftIcon as ToggleIcon } from "@heroicons/vue/outline";
|
48
|
+
import { computed, onMounted, ref, watch } from "vue";
|
49
|
+
|
50
|
+
const emit = defineEmits(["collapse", "update:collapse"]);
|
51
|
+
const props = defineProps({
|
52
|
+
rightSide: Boolean,
|
53
|
+
displayClass: {
|
54
|
+
type: String,
|
55
|
+
default: "flex flex-col"
|
56
|
+
},
|
57
|
+
maxWidth: {
|
58
|
+
type: String,
|
59
|
+
default: "13.5rem"
|
60
|
+
},
|
61
|
+
minWidth: {
|
62
|
+
type: String,
|
63
|
+
default: "5.5rem"
|
64
|
+
},
|
65
|
+
disabled: Boolean,
|
66
|
+
collapse: Boolean,
|
67
|
+
name: {
|
68
|
+
type: String,
|
69
|
+
default: "sidebar"
|
70
|
+
},
|
71
|
+
toggleAtTop: Boolean,
|
72
|
+
toggleClass: {
|
73
|
+
type: String,
|
74
|
+
default: ""
|
75
|
+
},
|
76
|
+
hideToggleOnCollapse: Boolean
|
77
|
+
});
|
78
|
+
|
79
|
+
const isCollapsed = ref(props.collapse);
|
80
|
+
|
81
|
+
const stored = localStorage.getItem(props.name + "-is-collapsed");
|
82
|
+
|
83
|
+
if (stored !== null) {
|
84
|
+
isCollapsed.value = stored === "1";
|
85
|
+
}
|
86
|
+
function toggleCollapse() {
|
87
|
+
setCollapse(!isCollapsed.value);
|
88
|
+
emit("collapse", isCollapsed.value);
|
89
|
+
emit("update:collapse", isCollapsed.value);
|
90
|
+
}
|
91
|
+
|
92
|
+
function setCollapse(state) {
|
93
|
+
isCollapsed.value = state;
|
94
|
+
localStorage.setItem(props.name + "-is-collapsed", isCollapsed.value ? "1" : "");
|
95
|
+
}
|
96
|
+
|
97
|
+
onMounted(() => {
|
98
|
+
emit("collapse", isCollapsed.value);
|
99
|
+
emit("update:collapse", isCollapsed.value);
|
100
|
+
});
|
101
|
+
const style = computed(() => {
|
102
|
+
return {
|
103
|
+
width: isCollapsed.value ? props.minWidth : props.maxWidth
|
104
|
+
};
|
105
|
+
});
|
106
|
+
|
107
|
+
watch(() => props.collapse, () => {
|
108
|
+
setCollapse(props.collapse);
|
109
|
+
});
|
110
|
+
</script>
|
111
|
+
|
112
|
+
<style
|
113
|
+
scoped
|
114
|
+
lang="scss"
|
115
|
+
>
|
116
|
+
.collapsable-sidebar {
|
117
|
+
@apply overflow-y-auto scroll-smooth flex-shrink-0 border-r border-neutral-plus-5 transition-all;
|
118
|
+
}
|
119
|
+
</style>
|
@@ -0,0 +1,70 @@
|
|
1
|
+
<template>
|
2
|
+
<QDialog
|
3
|
+
v-model="isShowing"
|
4
|
+
maximized
|
5
|
+
:position="position"
|
6
|
+
:seamless="seamless"
|
7
|
+
:class="{'hide-backdrop': !overlay}"
|
8
|
+
>
|
9
|
+
<div>
|
10
|
+
<div
|
11
|
+
v-if="title"
|
12
|
+
class="dialog-title"
|
13
|
+
@click.stop.prevent
|
14
|
+
>
|
15
|
+
{{ title }}
|
16
|
+
</div>
|
17
|
+
<div
|
18
|
+
class="dialog-content bg-white"
|
19
|
+
:class="{ [contentClass]: true }"
|
20
|
+
>
|
21
|
+
<slot />
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</QDialog>
|
25
|
+
</template>
|
26
|
+
|
27
|
+
<script setup>
|
28
|
+
import { computed } from "vue";
|
29
|
+
|
30
|
+
const emit = defineEmits(["update:show"]);
|
31
|
+
|
32
|
+
const props = defineProps({
|
33
|
+
show: Boolean,
|
34
|
+
seamless: Boolean,
|
35
|
+
overlay: Boolean,
|
36
|
+
position: {
|
37
|
+
type: String,
|
38
|
+
default: "bottom"
|
39
|
+
},
|
40
|
+
contentClass: {
|
41
|
+
type: String,
|
42
|
+
default: "py-8 px-12"
|
43
|
+
},
|
44
|
+
title: {
|
45
|
+
type: String,
|
46
|
+
default: "Edit"
|
47
|
+
}
|
48
|
+
});
|
49
|
+
|
50
|
+
const isShowing = computed({
|
51
|
+
get: () => props.show,
|
52
|
+
set: (value) => emit("update:show", value)
|
53
|
+
});
|
54
|
+
</script>
|
55
|
+
|
56
|
+
<style
|
57
|
+
lang="scss"
|
58
|
+
scoped
|
59
|
+
>
|
60
|
+
.dialog-title {
|
61
|
+
@apply bg-gray-very-light text-gray-default font-medium uppercase text-xs px-6 py-3 border-b border-neutral-plus-5 rounded-t-md;
|
62
|
+
font-family: "Roboto", sans-serif;
|
63
|
+
letter-spacing: 0.05em;
|
64
|
+
box-shadow: 0px -4px 12px rgba(0, 0, 0, 0.25);
|
65
|
+
}
|
66
|
+
|
67
|
+
.dialog-content {
|
68
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
|
69
|
+
}
|
70
|
+
</style>
|