quasar-ui-danx 0.4.47 → 0.4.49
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 +3408 -3422
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +69 -69
- package/dist/danx.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/Form/Fields/SelectionMenuField.vue +17 -21
- package/src/components/ActionTable/controls.ts +12 -6
- package/src/components/Utility/Buttons/ActionButton.vue +2 -2
- package/src/components/Utility/Dialogs/ConfirmDialog.vue +1 -0
- package/src/types/controls.d.ts +2 -1
package/package.json
CHANGED
@@ -1,19 +1,15 @@
|
|
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
14
|
<QMenu
|
19
15
|
:model-value="isSelecting"
|
@@ -36,24 +32,22 @@
|
|
36
32
|
v-if="deletable"
|
37
33
|
type="trash"
|
38
34
|
class="ml-4 mr-2"
|
39
|
-
size="
|
35
|
+
:size="size"
|
40
36
|
@click.stop.prevent="$emit('delete', option)"
|
41
37
|
/>
|
42
38
|
</div>
|
43
39
|
<template v-if="creatable">
|
44
40
|
<QSeparator class="bg-slate-400 my-2" />
|
45
41
|
<div class="px-4 mb-2">
|
46
|
-
<
|
42
|
+
<ActionButton
|
43
|
+
type="create"
|
44
|
+
color="green"
|
47
45
|
:class="createClass"
|
48
|
-
:
|
46
|
+
:label="createText"
|
47
|
+
:saving="loading"
|
48
|
+
:size="size"
|
49
49
|
@click="$emit('create')"
|
50
|
-
|
51
|
-
<CreateIcon
|
52
|
-
class="w-3"
|
53
|
-
:class="createText ? 'mr-2' : ''"
|
54
|
-
/>
|
55
|
-
{{ createText }}
|
56
|
-
</QBtn>
|
50
|
+
/>
|
57
51
|
</div>
|
58
52
|
</template>
|
59
53
|
</div>
|
@@ -84,6 +78,7 @@
|
|
84
78
|
v-model="editing"
|
85
79
|
:label="editText"
|
86
80
|
:class="editClass"
|
81
|
+
:size="size"
|
87
82
|
class="opacity-0 group-hover:opacity-100 transition-all"
|
88
83
|
:show-icon="EditIcon"
|
89
84
|
:hide-icon="DoneEditingIcon"
|
@@ -105,13 +100,12 @@ import {
|
|
105
100
|
FaSolidCheck as DoneEditingIcon,
|
106
101
|
FaSolidCircleXmark as ClearIcon,
|
107
102
|
FaSolidListCheck as DefaultSelectIcon,
|
108
|
-
FaSolidPencil as EditIcon
|
109
|
-
FaSolidPlus as CreateIcon
|
103
|
+
FaSolidPencil as EditIcon
|
110
104
|
} from "danx-icon";
|
111
105
|
import { ref } from "vue";
|
112
106
|
import { ActionTargetItem } from "../../../../types";
|
113
107
|
import { ShowHideButton } from "../../../Utility/Buttons";
|
114
|
-
import ActionButton from "../../../Utility/Buttons/ActionButton";
|
108
|
+
import { ActionButtonProps, default as ActionButton } from "../../../Utility/Buttons/ActionButton";
|
115
109
|
import EditableDiv from "./EditableDiv";
|
116
110
|
|
117
111
|
defineEmits(["create", "update", "delete"]);
|
@@ -139,6 +133,7 @@ withDefaults(defineProps<{
|
|
139
133
|
nameEditable?: boolean;
|
140
134
|
clearable?: boolean;
|
141
135
|
disable?: boolean;
|
136
|
+
size?: ActionButtonProps["size"];
|
142
137
|
}>(), {
|
143
138
|
selectText: "",
|
144
139
|
createText: "",
|
@@ -146,11 +141,12 @@ withDefaults(defineProps<{
|
|
146
141
|
clearText: "",
|
147
142
|
placeholder: "(No selection)",
|
148
143
|
selectClass: "bg-sky-800",
|
149
|
-
createClass: "
|
144
|
+
createClass: "",
|
150
145
|
editClass: "",
|
151
146
|
clearClass: "rounded-full",
|
152
147
|
labelClass: "text-slate-600",
|
153
|
-
selectIcon: null
|
148
|
+
selectIcon: null,
|
149
|
+
size: "md"
|
154
150
|
});
|
155
151
|
|
156
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,
|
@@ -145,7 +145,7 @@ const colorClass = computed(() => {
|
|
145
145
|
case "green":
|
146
146
|
return "text-green-900 bg-green-300 hover:bg-green-400";
|
147
147
|
case "green-invert":
|
148
|
-
return "text-
|
148
|
+
return "text-green-300 bg-green-900 hover:bg-green-800";
|
149
149
|
case "blue":
|
150
150
|
return "text-blue-900 bg-blue-300 hover:bg-blue-400";
|
151
151
|
case "sky":
|
@@ -155,7 +155,7 @@ const colorClass = computed(() => {
|
|
155
155
|
case "gray":
|
156
156
|
return "text-slate-200 bg-slate-800 hover:bg-slate-900";
|
157
157
|
default:
|
158
|
-
return "
|
158
|
+
return "";
|
159
159
|
}
|
160
160
|
});
|
161
161
|
const typeOptions = computed(() => {
|
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;
|