quasar-ui-danx 0.4.46 → 0.4.48
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/dist/danx.es.js +3397 -3399
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +69 -69
- package/dist/danx.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/Form/Fields/SelectionMenuField.vue +47 -52
- package/src/components/ActionTable/controls.ts +12 -6
- package/src/components/Utility/Buttons/ShowHideButton.vue +0 -2
- package/src/components/Utility/Dialogs/ConfirmDialog.vue +1 -0
- package/src/components/Utility/Widgets/LabelPillWidget.vue +1 -0
- package/src/types/controls.d.ts +2 -1
package/package.json
CHANGED
@@ -1,64 +1,57 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="group flex items-center flex-nowrap gap-x-1 relative">
|
3
|
-
<QInnerLoading
|
4
|
-
v-if="loading"
|
5
|
-
showing
|
6
|
-
class="bg-sky-900 opacity-50 z-10 rounded"
|
7
|
-
color="teal"
|
8
|
-
/>
|
9
3
|
<ShowHideButton
|
10
4
|
v-if="selectable"
|
11
5
|
v-model="isSelecting"
|
12
6
|
:disable="disable"
|
13
7
|
:label="selectText"
|
8
|
+
:saving="loading"
|
14
9
|
:class="selectClass"
|
15
10
|
:show-icon="selectIcon || DefaultSelectIcon"
|
16
11
|
class="mr-2"
|
12
|
+
:size="size"
|
17
13
|
>
|
18
|
-
<
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
>
|
24
|
-
<div
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
>
|
33
|
-
|
34
|
-
|
35
|
-
|
14
|
+
<QMenu
|
15
|
+
:model-value="isSelecting"
|
16
|
+
@before-hide="isSelecting = false"
|
17
|
+
@hide="isSelecting = false"
|
18
|
+
>
|
19
|
+
<div>
|
20
|
+
<div
|
21
|
+
v-for="option in options"
|
22
|
+
:key="option.id"
|
23
|
+
v-ripple
|
24
|
+
class="cursor-pointer flex items-center relative"
|
25
|
+
:class="{'bg-sky-900 hover:bg-sky-800': selected?.id === option.id, 'hover:bg-slate-600': selected?.id !== option.id}"
|
26
|
+
@click="selected = option"
|
27
|
+
>
|
28
|
+
<div class="flex-grow px-4 py-2">
|
29
|
+
{{ option.name }}
|
30
|
+
</div>
|
31
|
+
<ActionButton
|
32
|
+
v-if="deletable"
|
33
|
+
type="trash"
|
34
|
+
class="ml-4 mr-2"
|
35
|
+
:size="size"
|
36
|
+
@click.stop.prevent="$emit('delete', option)"
|
37
|
+
/>
|
38
|
+
</div>
|
39
|
+
<template v-if="creatable">
|
40
|
+
<QSeparator class="bg-slate-400 my-2" />
|
41
|
+
<div class="px-4 mb-2">
|
36
42
|
<ActionButton
|
37
|
-
|
38
|
-
|
39
|
-
class="
|
40
|
-
|
43
|
+
type="create"
|
44
|
+
color="green"
|
45
|
+
:class="createClass"
|
46
|
+
:label="createText"
|
47
|
+
:saving="loading"
|
48
|
+
:size="size"
|
49
|
+
@click="$emit('create')"
|
41
50
|
/>
|
42
51
|
</div>
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
<QBtn
|
47
|
-
:class="createClass"
|
48
|
-
:loading="loading"
|
49
|
-
@click="$emit('create')"
|
50
|
-
>
|
51
|
-
<CreateIcon
|
52
|
-
class="w-3"
|
53
|
-
:class="createText ? 'mr-2' : ''"
|
54
|
-
/>
|
55
|
-
{{ createText }}
|
56
|
-
</QBtn>
|
57
|
-
</div>
|
58
|
-
</template>
|
59
|
-
</div>
|
60
|
-
</QMenu>
|
61
|
-
</template>
|
52
|
+
</template>
|
53
|
+
</div>
|
54
|
+
</QMenu>
|
62
55
|
</ShowHideButton>
|
63
56
|
|
64
57
|
<div :class="labelClass">
|
@@ -85,6 +78,7 @@
|
|
85
78
|
v-model="editing"
|
86
79
|
:label="editText"
|
87
80
|
:class="editClass"
|
81
|
+
:size="size"
|
88
82
|
class="opacity-0 group-hover:opacity-100 transition-all"
|
89
83
|
:show-icon="EditIcon"
|
90
84
|
:hide-icon="DoneEditingIcon"
|
@@ -106,13 +100,12 @@ import {
|
|
106
100
|
FaSolidCheck as DoneEditingIcon,
|
107
101
|
FaSolidCircleXmark as ClearIcon,
|
108
102
|
FaSolidListCheck as DefaultSelectIcon,
|
109
|
-
FaSolidPencil as EditIcon
|
110
|
-
FaSolidPlus as CreateIcon
|
103
|
+
FaSolidPencil as EditIcon
|
111
104
|
} from "danx-icon";
|
112
105
|
import { ref } from "vue";
|
113
106
|
import { ActionTargetItem } from "../../../../types";
|
114
107
|
import { ShowHideButton } from "../../../Utility/Buttons";
|
115
|
-
import ActionButton from "../../../Utility/Buttons/ActionButton";
|
108
|
+
import { ActionButtonProps, default as ActionButton } from "../../../Utility/Buttons/ActionButton";
|
116
109
|
import EditableDiv from "./EditableDiv";
|
117
110
|
|
118
111
|
defineEmits(["create", "update", "delete"]);
|
@@ -140,6 +133,7 @@ withDefaults(defineProps<{
|
|
140
133
|
nameEditable?: boolean;
|
141
134
|
clearable?: boolean;
|
142
135
|
disable?: boolean;
|
136
|
+
size?: ActionButtonProps["size"];
|
143
137
|
}>(), {
|
144
138
|
selectText: "",
|
145
139
|
createText: "",
|
@@ -147,11 +141,12 @@ withDefaults(defineProps<{
|
|
147
141
|
clearText: "",
|
148
142
|
placeholder: "(No selection)",
|
149
143
|
selectClass: "bg-sky-800",
|
150
|
-
createClass: "
|
144
|
+
createClass: "",
|
151
145
|
editClass: "",
|
152
146
|
clearClass: "rounded-full",
|
153
147
|
labelClass: "text-slate-600",
|
154
|
-
selectIcon: null
|
148
|
+
selectIcon: null,
|
149
|
+
size: "md"
|
155
150
|
});
|
156
151
|
|
157
152
|
const isSelecting = ref(false);
|
@@ -35,7 +35,8 @@ export function useControls(name: string, options: ListControlsOptions): ListCon
|
|
35
35
|
// Field options are the lists of field values available given the applied filter on the list query. These are used for drop-downs / options in forms, filters, etc.
|
36
36
|
// (ie: all states available under the current filter)
|
37
37
|
const fieldOptions = ref<AnyObject>({});
|
38
|
-
const
|
38
|
+
const isLoadingFieldOptions = ref(false);
|
39
|
+
const hasLoadedFieldOptions = ref(false);
|
39
40
|
|
40
41
|
const filterActiveCount = computed(() => Object.keys(activeFilter.value).filter(key => activeFilter.value[key] !== undefined).length);
|
41
42
|
|
@@ -108,6 +109,9 @@ export function useControls(name: string, options: ListControlsOptions): ListCon
|
|
108
109
|
* Gets the field options for the given field name.
|
109
110
|
*/
|
110
111
|
function getFieldOptions(field: string): any[] {
|
112
|
+
if (!hasLoadedFieldOptions.value) {
|
113
|
+
loadFieldOptions();
|
114
|
+
}
|
111
115
|
return fieldOptions.value[field] || [];
|
112
116
|
}
|
113
117
|
|
@@ -115,15 +119,16 @@ export function useControls(name: string, options: ListControlsOptions): ListCon
|
|
115
119
|
* Loads the filter field options for the current filter.
|
116
120
|
*/
|
117
121
|
async function loadFieldOptions() {
|
118
|
-
if (
|
122
|
+
if (isLoadingFieldOptions.value || !options.routes.fieldOptions || options.isFieldOptionsEnabled === false) return;
|
119
123
|
|
120
|
-
|
124
|
+
isLoadingFieldOptions.value = true;
|
121
125
|
try {
|
122
126
|
fieldOptions.value = await options.routes.fieldOptions() || {};
|
127
|
+
hasLoadedFieldOptions.value = true;
|
123
128
|
} catch (e) {
|
124
129
|
// Fail silently
|
125
130
|
} finally {
|
126
|
-
|
131
|
+
isLoadingFieldOptions.value = false;
|
127
132
|
}
|
128
133
|
}
|
129
134
|
|
@@ -271,7 +276,7 @@ export function useControls(name: string, options: ListControlsOptions): ListCon
|
|
271
276
|
loadSummary();
|
272
277
|
}
|
273
278
|
|
274
|
-
if (!
|
279
|
+
if (!isLoadingFieldOptions.value) {
|
275
280
|
loadFieldOptions();
|
276
281
|
}
|
277
282
|
}, 1);
|
@@ -498,7 +503,8 @@ export function useControls(name: string, options: ListControlsOptions): ListCon
|
|
498
503
|
summary,
|
499
504
|
selectedRows,
|
500
505
|
isLoadingList,
|
501
|
-
|
506
|
+
isLoadingFieldOptions,
|
507
|
+
hasLoadedFieldOptions,
|
502
508
|
isLoadingSummary,
|
503
509
|
pager,
|
504
510
|
pagination,
|
@@ -39,14 +39,12 @@ const props = withDefaults(defineProps<Props>(), {
|
|
39
39
|
label: ""
|
40
40
|
});
|
41
41
|
|
42
|
-
console.log("isShowing", isShowing.value);
|
43
42
|
const SETTINGS_KEY = "show-hide-button";
|
44
43
|
const settings = getItem(SETTINGS_KEY, {});
|
45
44
|
|
46
45
|
if (props.name) {
|
47
46
|
if (settings[props.name] !== undefined) {
|
48
47
|
isShowing.value = settings[props.name];
|
49
|
-
console.log("setting is sowing to", isShowing.value);
|
50
48
|
}
|
51
49
|
}
|
52
50
|
|
package/src/types/controls.d.ts
CHANGED
@@ -85,7 +85,8 @@ export interface ListController<T = ActionTargetItem> {
|
|
85
85
|
summary: Ref<object | null>;
|
86
86
|
selectedRows: Ref<T[]>;
|
87
87
|
isLoadingList: Ref<boolean>;
|
88
|
-
|
88
|
+
isLoadingFieldOptions: Ref<boolean>;
|
89
|
+
hasLoadedFieldOptions: Ref<boolean>;
|
89
90
|
isLoadingSummary: Ref<boolean>;
|
90
91
|
pager: ComputedRef<{
|
91
92
|
perPage: number;
|