quasar-ui-danx 0.4.55 → 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.55",
3
+ "version": "0.4.57",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@ interface ActionFormProps {
21
21
  form: Form;
22
22
  noLabel?: boolean;
23
23
  showName?: boolean;
24
- disable?: boolean;
24
+ disabled?: boolean;
25
25
  readonly?: boolean;
26
26
  clearable?: boolean;
27
27
  fieldClass?: string;
@@ -38,7 +38,7 @@ const renderedFormProps = {
38
38
  form: props.form,
39
39
  noLabel: props.noLabel,
40
40
  showName: props.showName,
41
- disable: props.disable,
41
+ disabled: props.disabled,
42
42
  readonly: props.readonly,
43
43
  clearable: props.clearable,
44
44
  fieldClass: props.fieldClass,
@@ -2,7 +2,7 @@
2
2
  <QToggle
3
3
  :data-testid="'boolean-field-' + (name || label)"
4
4
  :model-value="modelValue || (toggleIndeterminate ? modelValue : false)"
5
- :disable="disable || readonly"
5
+ :disable="disabled || readonly"
6
6
  :toggle-indeterminate="toggleIndeterminate"
7
7
  :indeterminate-value="undefined"
8
8
  @update:model-value="$emit('update:model-value', $event)"
@@ -40,7 +40,7 @@ defineProps({
40
40
  },
41
41
  showName: Boolean,
42
42
  toggleIndeterminate: Boolean,
43
- disable: Boolean,
43
+ disabled: Boolean,
44
44
  readonly: Boolean
45
45
  });
46
46
  </script>
@@ -11,7 +11,7 @@
11
11
  />
12
12
 
13
13
  <input
14
- v-if="!disable && !readonly"
14
+ v-if="!disabled && !readonly"
15
15
  ref="file"
16
16
  class="hidden"
17
17
  type="file"
@@ -29,11 +29,11 @@
29
29
  :file="file"
30
30
  :related-files="file.transcodes || uploadedFiles"
31
31
  downloadable
32
- :removable="!readonly && !disable"
32
+ :removable="!readonly && !disabled"
33
33
  @remove="onRemove(file)"
34
34
  />
35
35
  <div
36
- v-if="!disable && !readonly"
36
+ v-if="!disabled && !readonly"
37
37
  class="dx-add-remove-files m-2 flex flex-col flex-nowrap items-center overflow-hidden cursor-pointer"
38
38
  :class="filePreviewClass"
39
39
  :style="styleSize"
@@ -85,7 +85,7 @@ const props = withDefaults(defineProps<{
85
85
  field?: FormField;
86
86
  label?: string;
87
87
  showName?: boolean;
88
- disable?: boolean;
88
+ disabled?: boolean;
89
89
  readonly?: boolean;
90
90
  width?: number | string;
91
91
  height?: number | string;
@@ -14,7 +14,7 @@
14
14
  <ShowHideButton
15
15
  v-if="showEdit"
16
16
  v-model="editing"
17
- :disable="!canEdit"
17
+ :disabled="!canEdit"
18
18
  :label="editText"
19
19
  :class="editClass"
20
20
  :show-icon="EditIcon"
@@ -3,7 +3,7 @@
3
3
  <ShowHideButton
4
4
  v-if="selectable"
5
5
  v-model="isSelecting"
6
- :disable="disable"
6
+ :disabled="disabled"
7
7
  :label="selectText"
8
8
  :saving="loading"
9
9
  :class="selectClass"
@@ -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"
@@ -79,9 +79,11 @@
79
79
  :label="editText"
80
80
  :class="editClass"
81
81
  :size="size"
82
+ :disabled="editDisabled"
82
83
  class="opacity-0 group-hover:opacity-100 transition-all"
83
84
  :show-icon="EditIcon"
84
85
  :hide-icon="DoneEditingIcon"
86
+ :tooltip="editDisabled ? 'You are not allowed to edit' : ''"
85
87
  />
86
88
 
87
89
  <QBtn
@@ -102,7 +104,7 @@ import {
102
104
  FaSolidListCheck as DefaultSelectIcon,
103
105
  FaSolidPencil as EditIcon
104
106
  } from "danx-icon";
105
- import { ref } from "vue";
107
+ import { computed, ref } from "vue";
106
108
  import { ActionTargetItem } from "../../../../types";
107
109
  import { ShowHideButton } from "../../../Utility/Buttons";
108
110
  import { ActionButtonProps, default as ActionButton } from "../../../Utility/Buttons/ActionButton";
@@ -111,7 +113,7 @@ import EditableDiv from "./EditableDiv";
111
113
  defineEmits(["create", "update", "delete"]);
112
114
  const selected = defineModel<ActionTargetItem | null>("selected");
113
115
  const editing = defineModel<boolean>("editing");
114
- withDefaults(defineProps<{
116
+ const props = withDefaults(defineProps<{
115
117
  options: ActionTargetItem[];
116
118
  showEdit?: boolean;
117
119
  loading?: boolean;
@@ -132,7 +134,8 @@ withDefaults(defineProps<{
132
134
  deletable?: boolean;
133
135
  nameEditable?: boolean;
134
136
  clearable?: boolean;
135
- disable?: boolean;
137
+ disabled?: boolean;
138
+ editDisabled?: boolean;
136
139
  size?: ActionButtonProps["size"];
137
140
  }>(), {
138
141
  selectText: "",
@@ -150,4 +153,10 @@ withDefaults(defineProps<{
150
153
  });
151
154
 
152
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
+ });
153
162
  </script>
@@ -13,7 +13,7 @@
13
13
  class="text-sm font-semibold"
14
14
  />
15
15
  <div
16
- v-if="!disable && !readonly"
16
+ v-if="!disabled && !readonly"
17
17
  class="text-sm mt-2"
18
18
  >
19
19
  <a
@@ -39,7 +39,7 @@
39
39
  :class="{'border border-dashed border-blue-600': !uploadedFile, 'mx-auto': !readonly}"
40
40
  :file="uploadedFile || undefined"
41
41
  downloadable
42
- @click="!disable && $refs.file.click()"
42
+ @click="!disabled && $refs.file.click()"
43
43
  />
44
44
  <div
45
45
  v-else-if="readonly"
@@ -63,7 +63,7 @@ const props = defineProps<{
63
63
  label?: string;
64
64
  name?: string;
65
65
  showName?: boolean;
66
- disable?: boolean;
66
+ disabled?: boolean;
67
67
  readonly?: boolean;
68
68
  }>();
69
69
  const { onComplete, onDrop, onFileSelected, uploadedFile, clearUploadedFile } = useSingleFileUpload();
@@ -15,7 +15,7 @@
15
15
  v-else
16
16
  class="mt-2"
17
17
  :api-key="danxOptions.tinyMceApiKey"
18
- :disabled="disable"
18
+ :disabled="disabled"
19
19
  :model-value="modelValue"
20
20
  @update:model-value="$emit('update:model-value', $event)"
21
21
  />
@@ -39,7 +39,7 @@ defineProps({
39
39
  },
40
40
  noLabel: Boolean,
41
41
  showName: Boolean,
42
- disable: Boolean,
42
+ disabled: Boolean,
43
43
  readonly: Boolean
44
44
  });
45
45
  </script>
@@ -27,7 +27,7 @@
27
27
  {{ name || "1" }}
28
28
  </div>
29
29
  <div
30
- v-if="!disable && !readonly && canModifyVariations"
30
+ v-if="!disabled && !readonly && canModifyVariations"
31
31
  class="flex flex-nowrap items-center mr-2"
32
32
  >
33
33
  <a
@@ -86,7 +86,8 @@
86
86
  :no-label="noLabel"
87
87
  :show-name="showName"
88
88
  :clearable="field.clearable || clearable"
89
- :disable="disable"
89
+ :disabled="disabled"
90
+ :disable="disabled"
90
91
  :readonly="readonly"
91
92
  @update:model-value="onInput(field.name, $event)"
92
93
  />
@@ -206,7 +207,8 @@ function getVnodeProps(field) {
206
207
  label: field.label,
207
208
  clearable: field.clearable || props.clearable,
208
209
  readonly: props.readonly,
209
- disable: props.disable,
210
+ disabled: props.disabled,
211
+ disable: props.disabled,
210
212
  showName: props.showName,
211
213
  noLabel: props.noLabel
212
214
  };
@@ -225,7 +227,7 @@ const currentVariation = ref(variationNames.value[0] || "");
225
227
  const newVariationName = ref("");
226
228
  const variationToEdit = ref<boolean | string>(false);
227
229
  const variationToDelete = ref("");
228
- const canAddVariation = computed(() => props.canModifyVariations && !props.readonly && !props.disable && variationNames.value.length < (props.form.variations || 0));
230
+ const canAddVariation = computed(() => props.canModifyVariations && !props.readonly && !props.disabled && variationNames.value.length < (props.form.variations || 0));
229
231
 
230
232
  function getFieldResponse(name: string, variation?: string) {
231
233
  if (!fieldResponses.value) return undefined;
@@ -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 = {
@@ -23,7 +23,7 @@
23
23
  :label="doneText"
24
24
  class="dx-dialog-button dx-dialog-button-done"
25
25
  :class="doneClass"
26
- :disable="disable"
26
+ :disable="disabled"
27
27
  @click="onClose"
28
28
  >
29
29
  <slot name="done-text" />
@@ -40,7 +40,7 @@ import DialogLayout from "./DialogLayout";
40
40
  const emit = defineEmits(["update:model-value", "close"]);
41
41
  defineProps({
42
42
  ...DialogLayout.props,
43
- disable: Boolean,
43
+ disabled: Boolean,
44
44
  doneClass: {
45
45
  type: [String, Object],
46
46
  default: ""
@@ -27,7 +27,7 @@ const props = defineProps<{
27
27
  form: Form;
28
28
  noLabel?: boolean;
29
29
  showName?: boolean;
30
- disable?: boolean;
30
+ disabled?: boolean;
31
31
  readonly?: boolean;
32
32
  clearable?: boolean;
33
33
  fieldClass?: string;
@@ -41,7 +41,7 @@ const renderedFormProps = {
41
41
  form: props.form,
42
42
  noLabel: props.noLabel,
43
43
  showName: props.showName,
44
- disable: props.disable,
44
+ disabled: props.disabled,
45
45
  readonly: props.readonly,
46
46
  clearable: props.clearable,
47
47
  fieldClass: props.fieldClass,
@@ -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 {
@@ -44,7 +44,7 @@ export interface RenderedFormProps {
44
44
  form: Form;
45
45
  noLabel?: boolean;
46
46
  showName?: boolean;
47
- disable?: boolean;
47
+ disabled?: boolean;
48
48
  readonly?: boolean;
49
49
  saving?: boolean;
50
50
  clearable?: boolean;
@@ -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>