quasar-ui-danx 0.4.56 → 0.4.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.4.56",
3
+ "version": "0.4.57",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  >
19
19
  <div>
20
20
  <div
21
- v-for="option in options"
21
+ v-for="option in optionsPlusSelected"
22
22
  :key="option.id"
23
23
  v-ripple
24
24
  class="cursor-pointer flex items-center relative"
@@ -104,7 +104,7 @@ import {
104
104
  FaSolidListCheck as DefaultSelectIcon,
105
105
  FaSolidPencil as EditIcon
106
106
  } from "danx-icon";
107
- import { ref } from "vue";
107
+ import { computed, ref } from "vue";
108
108
  import { ActionTargetItem } from "../../../../types";
109
109
  import { ShowHideButton } from "../../../Utility/Buttons";
110
110
  import { ActionButtonProps, default as ActionButton } from "../../../Utility/Buttons/ActionButton";
@@ -113,7 +113,7 @@ import EditableDiv from "./EditableDiv";
113
113
  defineEmits(["create", "update", "delete"]);
114
114
  const selected = defineModel<ActionTargetItem | null>("selected");
115
115
  const editing = defineModel<boolean>("editing");
116
- withDefaults(defineProps<{
116
+ const props = withDefaults(defineProps<{
117
117
  options: ActionTargetItem[];
118
118
  showEdit?: boolean;
119
119
  loading?: boolean;
@@ -153,4 +153,10 @@ withDefaults(defineProps<{
153
153
  });
154
154
 
155
155
  const isSelecting = ref(false);
156
+
157
+ // If the selected option is not in the options list, it should be added in
158
+ const optionsPlusSelected = computed(() => {
159
+ if (!selected.value || props.options.find((o) => o.id === selected.value?.id)) return props.options;
160
+ return [selected.value, ...props.options];
161
+ });
156
162
  </script>
@@ -46,6 +46,7 @@
46
46
  class="flex items-stretch flex-nowrap h-full"
47
47
  >
48
48
  <PanelsDrawerTabs
49
+ v-if="!hideTabs"
49
50
  :key="'pd-tabs:' + target.id"
50
51
  v-model="activePanel"
51
52
  :target="target"
@@ -53,13 +54,31 @@
53
54
  :panels="panels"
54
55
  @update:model-value="$emit('update:model-value', $event)"
55
56
  />
56
- <PanelsDrawerPanels
57
+
58
+ <QTabPanels
57
59
  :key="'pd-panels:' + target.id"
58
- :panels="panels"
59
- :active-panel="activePanel"
60
- :active-item="target"
60
+ :model-value="activePanel"
61
61
  :class="activePanelOptions?.class || panelsClass"
62
- />
62
+ class="dx-panels-drawer-panels overflow-y-auto h-full transition-all"
63
+ >
64
+ <slot
65
+ name="panels"
66
+ :active-panel="activePanel"
67
+ >
68
+ <QTabPanel
69
+ v-for="panel in panels"
70
+ :key="panel.name"
71
+ :name="panel.name"
72
+ >
73
+ <RenderVnode
74
+ v-if="panel.vnode"
75
+ :vnode="panel.vnode"
76
+ :props="target"
77
+ />
78
+ </QTabPanel>
79
+ </slot>
80
+ </QTabPanels>
81
+
63
82
  <div
64
83
  v-if="$slots['right-sidebar']"
65
84
  class="border-l overflow-y-auto"
@@ -81,8 +100,7 @@
81
100
  import { computed, onMounted, ref, watch } from "vue";
82
101
  import { XIcon as CloseIcon } from "../../svg";
83
102
  import { ActionPanel, ActionTargetItem } from "../../types";
84
- import { ContentDrawer } from "../Utility";
85
- import PanelsDrawerPanels from "./PanelsDrawerPanels";
103
+ import { ContentDrawer, RenderVnode } from "../Utility";
86
104
  import PanelsDrawerTabs from "./PanelsDrawerTabs";
87
105
 
88
106
  export interface PanelsDrawerProps {
@@ -93,7 +111,8 @@ export interface PanelsDrawerProps {
93
111
  panelsClass?: string | object,
94
112
  drawerClass?: string | object,
95
113
  position?: "standard" | "right" | "left";
96
- panels: ActionPanel[]
114
+ panels: ActionPanel[];
115
+ hideTabs?: boolean;
97
116
  }
98
117
 
99
118
  defineEmits(["update:model-value", "close"]);
@@ -1,3 +1,2 @@
1
1
  export { default as PanelsDrawer } from "./PanelsDrawer.vue";
2
- export { default as PanelsDrawerPanels } from "./PanelsDrawerPanels.vue";
3
2
  export { default as PanelsDrawerTabs } from "./PanelsDrawerTabs.vue";
@@ -25,6 +25,7 @@
25
25
  <QTooltip
26
26
  v-if="tooltip"
27
27
  class="whitespace-nowrap"
28
+ :class="tooltipClass"
28
29
  >
29
30
  <slot name="tooltip">
30
31
  {{ tooltip }}
@@ -89,6 +90,7 @@ export interface ActionButtonProps {
89
90
  disabledClass?: string;
90
91
  confirm?: boolean;
91
92
  confirmText?: string;
93
+ tooltipClass?: string;
92
94
  }
93
95
 
94
96
  const emit = defineEmits(["success", "error", "always"]);
@@ -105,7 +107,8 @@ const props = withDefaults(defineProps<ActionButtonProps>(), {
105
107
  target: null,
106
108
  input: null,
107
109
  confirmText: "Are you sure?",
108
- disabledClass: "text-slate-800 bg-slate-500 opacity-50"
110
+ disabledClass: "text-slate-800 bg-slate-500 opacity-50",
111
+ tooltipClass: ""
109
112
  });
110
113
 
111
114
  const mappedSizeClass = {
@@ -87,10 +87,6 @@
87
87
  &.scroll {
88
88
  overflow: auto;
89
89
  }
90
-
91
- .q-tab-panel {
92
- padding: 0;
93
- }
94
90
  }
95
91
 
96
92
  &.overflow-y-auto {
@@ -1,29 +0,0 @@
1
- <template>
2
- <QTabPanels
3
- :model-value="activePanel"
4
- class="dx-panels-drawer-panels overflow-y-auto h-full transition-all"
5
- >
6
- <QTabPanel
7
- v-for="panel in panels"
8
- :key="panel.name"
9
- :name="panel.name"
10
- >
11
- <RenderVnode
12
- v-if="panel.vnode"
13
- :vnode="panel.vnode"
14
- :props="activeItem"
15
- />
16
- </QTabPanel>
17
- </QTabPanels>
18
- </template>
19
-
20
- <script setup lang="ts">
21
- import { ActionPanel, ActionTargetItem } from "../../types";
22
- import { RenderVnode } from "../Utility";
23
-
24
- defineProps<{
25
- activePanel?: string | number,
26
- activeItem: ActionTargetItem,
27
- panels: ActionPanel[]
28
- }>();
29
- </script>