quasar-ui-danx 0.4.27 → 0.4.28
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/danx.es.js +24536 -24082
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +109 -109
- package/dist/danx.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/ActionTable.vue +29 -7
- package/src/components/ActionTable/Filters/FilterableField.vue +14 -2
- package/src/components/ActionTable/Form/ActionForm.vue +17 -12
- package/src/components/ActionTable/Form/Fields/DateField.vue +24 -20
- package/src/components/ActionTable/Form/Fields/DateRangeField.vue +57 -53
- package/src/components/ActionTable/Form/Fields/EditOnClickTextField.vue +9 -2
- package/src/components/ActionTable/Form/Fields/EditableDiv.vue +12 -12
- package/src/components/ActionTable/Form/Fields/FieldLabel.vue +1 -1
- package/src/components/ActionTable/Form/Fields/SelectField.vue +27 -6
- package/src/components/ActionTable/Form/Fields/SelectOrCreateField.vue +56 -0
- package/src/components/ActionTable/Form/Fields/index.ts +1 -0
- package/src/components/ActionTable/Layouts/ActionTableLayout.vue +20 -23
- package/src/components/ActionTable/Toolbars/ActionToolbar.vue +44 -36
- package/src/components/ActionTable/listControls.ts +3 -3
- package/src/components/DragAndDrop/ListItemDraggable.vue +38 -28
- package/src/components/DragAndDrop/dragAndDrop.ts +220 -220
- package/src/components/DragAndDrop/listDragAndDrop.ts +256 -227
- package/src/components/PanelsDrawer/PanelsDrawer.vue +7 -7
- package/src/components/PanelsDrawer/PanelsDrawerTabs.vue +3 -3
- package/src/components/Utility/Buttons/ShowHideButton.vue +86 -0
- package/src/components/Utility/Buttons/index.ts +1 -0
- package/src/components/Utility/Dialogs/ActionFormDialog.vue +30 -0
- package/src/components/Utility/Dialogs/CreateNewWithNameDialog.vue +26 -0
- package/src/components/Utility/Dialogs/RenderedFormDialog.vue +50 -0
- package/src/components/Utility/Dialogs/index.ts +3 -0
- package/src/helpers/actions.ts +84 -20
- package/src/helpers/formats.ts +23 -20
- package/src/helpers/objectStore.ts +24 -12
- package/src/types/actions.d.ts +12 -6
- package/src/types/controls.d.ts +23 -6
- package/types/vue-shims.d.ts +3 -2
@@ -7,231 +7,260 @@ 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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
10
|
+
listPosition = 0;
|
11
|
+
cursorPosition = 0;
|
12
|
+
initialPosition = 0;
|
13
|
+
initialDropZone: HTMLElement | null = null;
|
14
|
+
onPositionChangeCb = null;
|
15
|
+
onDragPositionChangeCb = null;
|
16
|
+
onDropZoneChangeCb = null;
|
17
|
+
placeholder = null;
|
18
|
+
|
19
|
+
constructor(options = {}) {
|
20
|
+
super({
|
21
|
+
showPlaceholder: true,
|
22
|
+
...options
|
23
|
+
});
|
24
|
+
}
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Callback that fires after dragging has ended and the list position has changed from the original
|
28
|
+
*/
|
29
|
+
onPositionChange(cb): ListDragAndDrop {
|
30
|
+
this.onPositionChangeCb = cb;
|
31
|
+
return this;
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Callback that fires when the drop zone has changed
|
36
|
+
*/
|
37
|
+
onDropZoneChange(cb): ListDragAndDrop {
|
38
|
+
this.onDropZoneChangeCb = cb;
|
39
|
+
return this;
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Callback that fires while dragging the element when the cursor's position has changed in the list
|
44
|
+
* @param cb
|
45
|
+
* @returns {ListDragAndDrop}
|
46
|
+
*/
|
47
|
+
onDragPositionChange(cb) {
|
48
|
+
this.onDragPositionChangeCb = cb;
|
49
|
+
return this;
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Start listening for drag events and prepare an element for drag/drop
|
54
|
+
* @param e
|
55
|
+
* @param data
|
56
|
+
*/
|
57
|
+
dragStart(e, data) {
|
58
|
+
super.dragStart(e, data);
|
59
|
+
|
60
|
+
if (this.currentDropZone) {
|
61
|
+
this.listPosition = this.getListPosition(e.target);
|
62
|
+
this.initialPosition = this.listPosition;
|
63
|
+
this.initialDropZone = this.currentDropZone;
|
64
|
+
this.updateScrollPosition();
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* When dragging has ended, check for list position changes and fire the onPositionChange callback if it has
|
70
|
+
*/
|
71
|
+
dragEnd(e) {
|
72
|
+
const draggableData = this.draggableData;
|
73
|
+
this.placeholder?.remove();
|
74
|
+
const newDropZone = this.currentDropZone;
|
75
|
+
super.dragEnd(e);
|
76
|
+
|
77
|
+
// If the list drop zone has changed, trigger the callback for drop zone change
|
78
|
+
if (newDropZone && newDropZone !== this.initialDropZone) {
|
79
|
+
this.onDropZoneChangeCb && this.onDropZoneChangeCb(e, newDropZone, this.listPosition, this.initialPosition, draggableData);
|
80
|
+
} else if (this.listPosition !== this.initialPosition) {
|
81
|
+
// If our list position has changed, trigger the position change callback
|
82
|
+
this.onPositionChangeCb &&
|
83
|
+
this.onPositionChangeCb(this.listPosition, this.initialPosition, draggableData);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* The dragging element is moving
|
89
|
+
* @param e
|
90
|
+
*/
|
91
|
+
dragOver(e) {
|
92
|
+
super.dragOver(e);
|
93
|
+
this.updateListPosition(e);
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Notify if the targeted position of the cursor is different from the current position
|
98
|
+
* @param e
|
99
|
+
*/
|
100
|
+
updateListPosition(e: MouseEvent) {
|
101
|
+
const point = {
|
102
|
+
x: e.clientX,
|
103
|
+
y: e.clientY
|
104
|
+
};
|
105
|
+
const newDropZone = this.getDropZoneForTarget(e.target as HTMLElement);
|
106
|
+
if (newDropZone !== this.currentDropZone) {
|
107
|
+
this.currentDropZone = newDropZone;
|
108
|
+
this.cursorPosition = 0;
|
109
|
+
this.listPosition = 0;
|
110
|
+
this.placeholder?.remove();
|
111
|
+
}
|
112
|
+
|
113
|
+
const prevPosition = this.listPosition;
|
114
|
+
const newPosition = this.getListPositionOfPoint(point);
|
115
|
+
|
116
|
+
// If the cursor position has changed, we should update the rendering and see if our actual list position has
|
117
|
+
// changed
|
118
|
+
if (this.cursorPosition !== newPosition) {
|
119
|
+
this.cursorPosition = newPosition;
|
120
|
+
this.listPosition =
|
121
|
+
this.initialPosition < this.cursorPosition
|
122
|
+
? this.cursorPosition - 1
|
123
|
+
: this.cursorPosition;
|
124
|
+
if (this.options.showPlaceholder) {
|
125
|
+
this.renderPlaceholder();
|
126
|
+
}
|
127
|
+
|
128
|
+
// The position has changed, trigger the callback
|
129
|
+
if (this.listPosition !== prevPosition) {
|
130
|
+
this.onDragPositionChangeCb &&
|
131
|
+
this.onDragPositionChangeCb(this.listPosition, this.draggableData);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Find the numeric position of the element in the children of the list
|
138
|
+
* @returns {Number|null}
|
139
|
+
* @param item
|
140
|
+
*/
|
141
|
+
getListPosition(item) {
|
142
|
+
let index = 0;
|
143
|
+
for (const child of this.getChildren()) {
|
144
|
+
if (child === item) {
|
145
|
+
return index;
|
146
|
+
}
|
147
|
+
index++;
|
148
|
+
}
|
149
|
+
|
150
|
+
return null;
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Get all the children of the current drop zone, excluding the placeholder
|
155
|
+
* @returns {*}
|
156
|
+
*/
|
157
|
+
getChildren() {
|
158
|
+
return [...(this.currentDropZone?.children || [])].filter(
|
159
|
+
(c) => c.className.match(/drag-placeholder/) === null
|
160
|
+
);
|
161
|
+
}
|
162
|
+
|
163
|
+
/**
|
164
|
+
* Get the list element that is the parent of the target element
|
165
|
+
*/
|
166
|
+
getDropZoneForTarget(target: HTMLElement): HTMLElement | null {
|
167
|
+
return target.closest(`[data-drop-zone]`);
|
168
|
+
}
|
169
|
+
|
170
|
+
/**
|
171
|
+
* Find the element at the current cursor position in the given drop zone
|
172
|
+
* @param point
|
173
|
+
* @returns {null}
|
174
|
+
*/
|
175
|
+
getListPositionOfPoint(point) {
|
176
|
+
let index = 0;
|
177
|
+
const children = this.getChildren();
|
178
|
+
|
179
|
+
while (index < children.length) {
|
180
|
+
const rect = children[index].getBoundingClientRect();
|
181
|
+
if (this.isVertical()) {
|
182
|
+
if (point.y < rect.top + rect.height / 2) {
|
183
|
+
break;
|
184
|
+
}
|
185
|
+
} else {
|
186
|
+
if (point.x < rect.left + rect.width / 2) {
|
187
|
+
break;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
index++;
|
191
|
+
}
|
192
|
+
|
193
|
+
return index;
|
194
|
+
}
|
195
|
+
|
196
|
+
/**
|
197
|
+
* Updates the scroll position while dragging an element so a user can navigate a longer list while dragging
|
198
|
+
*/
|
199
|
+
updateScrollPosition() {
|
200
|
+
if (this.currentDropZone) {
|
201
|
+
const rect = this.currentDropZone.getBoundingClientRect();
|
202
|
+
const threshold = 100;
|
203
|
+
let velocity = 0;
|
204
|
+
const velocityFn = (x) => x * 5;
|
205
|
+
const cursorPos = this.isVertical() ? this.cursorY : this.cursorX;
|
206
|
+
const rectStart = this.isVertical() ? rect.top : rect.left;
|
207
|
+
const rectEnd = this.isVertical() ? rect.bottom : rect.right;
|
208
|
+
const beforeDiff = rectStart + threshold - cursorPos;
|
209
|
+
const afterDiff = cursorPos - (rectEnd - threshold);
|
210
|
+
|
211
|
+
if (beforeDiff > 0) {
|
212
|
+
velocity = -velocityFn(beforeDiff);
|
213
|
+
} else if (afterDiff > 0) {
|
214
|
+
velocity = velocityFn(afterDiff);
|
215
|
+
}
|
216
|
+
|
217
|
+
if (velocity) {
|
218
|
+
if (this.isVertical()) {
|
219
|
+
this.currentDropZone.scrollTo({
|
220
|
+
top: this.currentDropZone.scrollTop + velocity,
|
221
|
+
behavior: "smooth"
|
222
|
+
});
|
223
|
+
} else {
|
224
|
+
this.currentDropZone.scrollTo({
|
225
|
+
left: this.currentDropZone.scrollLeft + velocity,
|
226
|
+
behavior: "smooth"
|
227
|
+
});
|
228
|
+
}
|
229
|
+
}
|
230
|
+
|
231
|
+
setTimeout(() => this.updateScrollPosition(), 500);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Render a placeholder element at the given position (in between the elements)
|
237
|
+
*/
|
238
|
+
renderPlaceholder() {
|
239
|
+
if (!this.placeholder) {
|
240
|
+
this.placeholder = document.createElement("div");
|
241
|
+
this.placeholder.classList.add("drag-placeholder");
|
242
|
+
}
|
243
|
+
|
244
|
+
// Make sure the placeholder is oriented correctly
|
245
|
+
if (this.isVertical()) {
|
246
|
+
this.placeholder.classList.add("direction-vertical");
|
247
|
+
this.placeholder.classList.remove("direction-horizontal");
|
248
|
+
this.placeholder.style.height = undefined;
|
249
|
+
} else {
|
250
|
+
this.placeholder.classList.add("direction-horizontal");
|
251
|
+
this.placeholder.classList.remove("direction-vertical");
|
252
|
+
this.placeholder.style.height =
|
253
|
+
this.currentDropZone.getBoundingClientRect().height + "px";
|
254
|
+
}
|
255
|
+
|
256
|
+
const children = this.getChildren();
|
257
|
+
if (this.cursorPosition < children.length) {
|
258
|
+
this.currentDropZone.insertBefore(
|
259
|
+
this.placeholder,
|
260
|
+
children[this.cursorPosition]
|
261
|
+
);
|
262
|
+
} else {
|
263
|
+
this.currentDropZone.appendChild(this.placeholder);
|
264
|
+
}
|
265
|
+
}
|
237
266
|
}
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<h2 v-if="title">
|
17
17
|
{{ title }}
|
18
18
|
</h2>
|
19
|
-
<div v-if="!
|
19
|
+
<div v-if="!target">
|
20
20
|
Loading
|
21
21
|
<QSpinnerHourglass />
|
22
22
|
</div>
|
@@ -39,22 +39,22 @@
|
|
39
39
|
</div>
|
40
40
|
<div class="dx-panels-drawer-body flex-grow overflow-hidden h-full">
|
41
41
|
<div
|
42
|
-
v-if="
|
42
|
+
v-if="target.__timestamp > 0"
|
43
43
|
class="flex items-stretch flex-nowrap h-full"
|
44
44
|
>
|
45
45
|
<PanelsDrawerTabs
|
46
|
-
:key="'pd-tabs:' +
|
46
|
+
:key="'pd-tabs:' + target.id"
|
47
47
|
v-model="activePanel"
|
48
|
-
:
|
48
|
+
:target="target"
|
49
49
|
:class="tabsClass"
|
50
50
|
:panels="panels"
|
51
51
|
@update:model-value="$emit('update:model-value', $event)"
|
52
52
|
/>
|
53
53
|
<PanelsDrawerPanels
|
54
|
-
:key="'pd-panels:' +
|
54
|
+
:key="'pd-panels:' + target.id"
|
55
55
|
:panels="panels"
|
56
56
|
:active-panel="activePanel"
|
57
|
-
:active-item="
|
57
|
+
:active-item="target"
|
58
58
|
:class="activePanelOptions?.class || panelsClass"
|
59
59
|
/>
|
60
60
|
<div
|
@@ -79,7 +79,7 @@ import PanelsDrawerTabs from "./PanelsDrawerTabs";
|
|
79
79
|
export interface Props {
|
80
80
|
title?: string,
|
81
81
|
modelValue?: string | number,
|
82
|
-
|
82
|
+
target: ActionTargetItem;
|
83
83
|
tabsClass?: string | object,
|
84
84
|
panelsClass?: string | object,
|
85
85
|
position?: "standard" | "right" | "left";
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<RenderVnode
|
14
14
|
v-if="panel.tabVnode"
|
15
15
|
:key="panel.name"
|
16
|
-
:vnode="panel.tabVnode(
|
16
|
+
:vnode="panel.tabVnode(target, modelValue)"
|
17
17
|
:is-active="modelValue === panel.name"
|
18
18
|
:name="panel.name"
|
19
19
|
:label="panel.label"
|
@@ -37,7 +37,7 @@ defineEmits(["update:model-value"]);
|
|
37
37
|
|
38
38
|
interface Props {
|
39
39
|
modelValue?: string | number;
|
40
|
-
|
40
|
+
target: ActionTargetItem;
|
41
41
|
panels: ActionPanel[];
|
42
42
|
}
|
43
43
|
|
@@ -51,7 +51,7 @@ function isEnabled(panel) {
|
|
51
51
|
if (!panel.enabled) return false;
|
52
52
|
|
53
53
|
if (typeof panel.enabled === "function") {
|
54
|
-
return panel.enabled(props.
|
54
|
+
return panel.enabled(props.target);
|
55
55
|
}
|
56
56
|
|
57
57
|
return true;
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<template>
|
2
|
+
<QBtn
|
3
|
+
class="py-1 px-2"
|
4
|
+
:disable="disable"
|
5
|
+
@click="onToggle"
|
6
|
+
>
|
7
|
+
<div class="flex items-center flex-nowrap whitespace-nowrap">
|
8
|
+
<slot :is-showing="isShowing">
|
9
|
+
<component
|
10
|
+
:is="isShowing ? (hideIcon || DefaultHideIcon) : (showIcon || DefaultShowIcon)"
|
11
|
+
:class="iconClass"
|
12
|
+
/>
|
13
|
+
<div
|
14
|
+
v-if="label"
|
15
|
+
:class="labelClass"
|
16
|
+
>
|
17
|
+
{{ (isShowing ? hideLabel : showLabel) || label }}
|
18
|
+
</div>
|
19
|
+
</slot>
|
20
|
+
</div>
|
21
|
+
<QTooltip v-if="tooltip">
|
22
|
+
{{ tooltip }}
|
23
|
+
</QTooltip>
|
24
|
+
</QBtn>
|
25
|
+
</template>
|
26
|
+
<script lang="ts" setup>
|
27
|
+
import { FaSolidEye as DefaultShowIcon, FaSolidEyeSlash as DefaultHideIcon } from "danx-icon";
|
28
|
+
import { nextTick } from "vue";
|
29
|
+
import { getItem, setItem } from "../../../helpers";
|
30
|
+
|
31
|
+
export interface Props {
|
32
|
+
name?: string;
|
33
|
+
showLabel?: string;
|
34
|
+
hideLabel?: string;
|
35
|
+
showIcon?: object | string;
|
36
|
+
hideIcon?: object | string;
|
37
|
+
iconClass?: string;
|
38
|
+
labelClass?: string;
|
39
|
+
label?: string;
|
40
|
+
tooltip?: string;
|
41
|
+
disable?: boolean;
|
42
|
+
}
|
43
|
+
|
44
|
+
const emit = defineEmits(["show", "hide"]);
|
45
|
+
const isShowing = defineModel<boolean>();
|
46
|
+
const props = withDefaults(defineProps<Props>(), {
|
47
|
+
name: "",
|
48
|
+
showLabel: "",
|
49
|
+
hideLabel: "",
|
50
|
+
showIcon: null,
|
51
|
+
hideIcon: null,
|
52
|
+
iconClass: "w-4 h-6",
|
53
|
+
labelClass: "ml-2",
|
54
|
+
label: "",
|
55
|
+
tooltip: ""
|
56
|
+
});
|
57
|
+
|
58
|
+
const SETTINGS_KEY = "show-hide-button";
|
59
|
+
const settings = getItem(SETTINGS_KEY, {});
|
60
|
+
|
61
|
+
if (props.name) {
|
62
|
+
if (settings[props.name] !== undefined) {
|
63
|
+
isShowing.value = settings[props.name];
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
function onToggle() {
|
68
|
+
isShowing.value = !isShowing.value;
|
69
|
+
|
70
|
+
|
71
|
+
// NOTE: use nextTick to ensure the value is updated before saving (if the parent does not pass a value for modelValue, this can cause a desync)
|
72
|
+
nextTick(() => {
|
73
|
+
if (isShowing.value) {
|
74
|
+
emit("show");
|
75
|
+
} else {
|
76
|
+
emit("hide");
|
77
|
+
}
|
78
|
+
|
79
|
+
if (props.name) {
|
80
|
+
settings[props.name] = isShowing.value;
|
81
|
+
setItem(SETTINGS_KEY, { ...getItem(SETTINGS_KEY, {}), [props.name]: isShowing.value });
|
82
|
+
}
|
83
|
+
});
|
84
|
+
}
|
85
|
+
|
86
|
+
</script>
|