quasar-ui-danx 0.2.16 → 0.2.17
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/components/ActionTable/ActionMenu.vue +4 -4
- package/src/components/ActionTable/ActionTable.vue +12 -12
- package/src/components/ActionTable/ActionTableColumn.vue +11 -11
- package/src/components/ActionTable/Columns/ColumnListItem.vue +2 -2
- package/src/components/ActionTable/Columns/ColumnSettingsDialog.vue +8 -8
- package/src/components/ActionTable/Columns/TitleColumnFormat.vue +1 -1
- package/src/components/ActionTable/Columns/VisibleColumnsToggleButtons.vue +7 -7
- package/src/components/ActionTable/EmptyTableState.vue +4 -4
- package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +3 -3
- package/src/components/ActionTable/Filters/FilterFieldList.vue +6 -6
- package/src/components/ActionTable/Filters/FilterListToggle.vue +3 -3
- package/src/components/ActionTable/Filters/FilterToolbarLayout.vue +3 -3
- package/src/components/ActionTable/Filters/FilterableField.vue +6 -6
- package/src/components/ActionTable/Form/Fields/BooleanField.vue +4 -4
- package/src/components/ActionTable/Form/Fields/ConfirmPasswordField.vue +7 -7
- package/src/components/ActionTable/Form/Fields/DateField.vue +6 -6
- package/src/components/ActionTable/Form/Fields/DateRangeField.vue +13 -13
- package/src/components/ActionTable/Form/Fields/DateTimeField.vue +6 -6
- package/src/components/ActionTable/Form/Fields/DateTimePicker.vue +6 -6
- package/src/components/ActionTable/Form/Fields/EditableDiv.vue +3 -3
- package/src/components/ActionTable/Form/Fields/FieldLabel.vue +2 -2
- package/src/components/ActionTable/Form/Fields/FileUploadButton.vue +15 -15
- package/src/components/ActionTable/Form/Fields/InlineDateTimeField.vue +7 -7
- package/src/components/ActionTable/Form/Fields/IntegerField.vue +2 -2
- package/src/components/ActionTable/Form/Fields/LabeledInput.vue +2 -2
- package/src/components/ActionTable/Form/Fields/MultiFileField.vue +6 -6
- package/src/components/ActionTable/Form/Fields/MultiKeywordField.vue +8 -8
- package/src/components/ActionTable/Form/Fields/NewPasswordField.vue +6 -6
- package/src/components/ActionTable/Form/Fields/NumberField.vue +20 -20
- package/src/components/ActionTable/Form/Fields/NumberRangeField.vue +20 -20
- package/src/components/ActionTable/Form/Fields/SelectDrawer.vue +8 -8
- package/src/components/ActionTable/Form/Fields/SelectField.vue +36 -36
- package/src/components/ActionTable/Form/Fields/SelectWithChildrenField.vue +9 -9
- package/src/components/ActionTable/Form/Fields/SingleFileField.vue +6 -6
- package/src/components/ActionTable/Form/Fields/TextField.vue +15 -15
- package/src/components/ActionTable/Form/Fields/WysiwygField.vue +4 -4
- package/src/components/ActionTable/Form/RenderedForm.vue +5 -5
- package/src/components/ActionTable/TableSummaryRow.vue +8 -8
- package/src/components/ActionTable/listControls.ts +5 -5
- package/src/components/ActionTable/listHelpers.ts +1 -1
- package/src/components/ActionTable/tableColumns.ts +24 -1
- package/src/components/AuditHistory/AuditHistoryItem.vue +4 -4
- package/src/components/AuditHistory/AuditHistoryItemValue.vue +10 -10
- package/src/components/DragAndDrop/HandleDraggable.vue +8 -8
- package/src/components/DragAndDrop/ListItemDraggable.vue +8 -8
- package/src/components/DragAndDrop/dragAndDrop.ts +219 -219
- package/src/components/DragAndDrop/listDragAndDrop.ts +4 -4
- package/src/components/PanelsDrawer/PanelsDrawer.vue +7 -7
- package/src/components/PanelsDrawer/PanelsDrawerPanels.vue +1 -1
- package/src/components/PanelsDrawer/PanelsDrawerTabs.vue +4 -4
- package/src/components/Utility/Buttons/ExportButton.vue +4 -4
- package/src/components/Utility/Buttons/RefreshButton.vue +2 -2
- package/src/components/Utility/Controls/PreviousNextControls.vue +2 -2
- package/src/components/Utility/Dialogs/ConfirmDialog.vue +14 -14
- package/src/components/Utility/Dialogs/FullScreenDialog.vue +8 -8
- package/src/components/Utility/Dialogs/FullscreenCarouselDialog.vue +11 -11
- package/src/components/Utility/Dialogs/InfoDialog.vue +12 -12
- package/src/components/Utility/Dialogs/InputDialog.vue +5 -5
- package/src/components/Utility/Files/FilePreview.vue +10 -10
- package/src/components/Utility/Formats/GpsCoordinatesFormat.vue +4 -4
- package/src/components/Utility/Formats/IconWithTextFormat.vue +2 -2
- package/src/components/Utility/Formats/LabelValueFormat.vue +2 -2
- package/src/components/Utility/Layouts/CollapsableSidebar.vue +15 -15
- package/src/components/Utility/Layouts/ContentDrawer.vue +6 -6
- package/src/components/Utility/Popovers/InteractiveTooltip.vue +4 -4
- package/src/components/Utility/Popovers/PopoverMenu.vue +49 -49
- package/src/components/Utility/Tabs/BadgeTab.vue +1 -1
- package/src/components/Utility/Tabs/IndicatorTab.vue +3 -3
- package/src/components/Utility/Tools/ActionVnode.vue +3 -3
- package/src/components/Utility/Tools/RenderComponent.vue +3 -3
- package/src/components/Utility/Transitions/StaggeredListTransition.vue +3 -3
- package/src/helpers/array.ts +16 -16
- package/src/helpers/storage.ts +5 -5
- package/src/helpers/utils.ts +1 -1
- package/src/index.common.js +1 -2
- package/src/index.esm.js +1 -1
- package/src/index.umd.js +2 -2
- package/src/svg/CaretDownIcon.svg +1 -1
- package/src/svg/DragHandleDotsIcon.svg +3 -3
- package/src/svg/DragHandleIcon.svg +3 -3
- package/src/svg/FilterIcon.svg +5 -5
- package/src/svg/ImageIcon.svg +27 -27
- package/src/svg/PdfIcon.svg +5 -5
- package/src/svg/SkipNextIcon.svg +3 -3
- package/src/svg/SkipPreviousIcon.svg +3 -3
- package/src/svg/TrashIcon.svg +12 -12
- package/src/svg/WarningIcon.svg +3 -3
- package/src/svg/XIcon.svg +15 -15
- package/src/vue-plugin.js +5 -5
@@ -15,30 +15,30 @@
|
|
15
15
|
multiple
|
16
16
|
@change="onAttachFiles"
|
17
17
|
/>
|
18
|
-
|
18
|
+
</QBtn>
|
19
19
|
</template>
|
20
20
|
<script setup>
|
21
|
-
import { PlusIcon } from
|
22
|
-
import { QBtn } from
|
23
|
-
import { ref } from
|
24
|
-
import { FileUpload } from
|
21
|
+
import { PlusIcon } from "@heroicons/vue/outline";
|
22
|
+
import { QBtn } from "quasar";
|
23
|
+
import { ref } from "vue";
|
24
|
+
import { FileUpload } from "../../../../helpers";
|
25
25
|
|
26
26
|
defineExpose({ upload });
|
27
27
|
const emit = defineEmits([
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
"uploading",
|
29
|
+
"file-progress",
|
30
|
+
"file-complete",
|
31
|
+
"complete"
|
32
32
|
]);
|
33
33
|
const props = defineProps({
|
34
34
|
...QBtn.props,
|
35
35
|
text: {
|
36
36
|
type: String,
|
37
|
-
default:
|
37
|
+
default: "Add File"
|
38
38
|
},
|
39
39
|
locationWaitMessage: {
|
40
40
|
type: String,
|
41
|
-
default:
|
41
|
+
default: "Waiting for location..."
|
42
42
|
},
|
43
43
|
geolocation: Boolean
|
44
44
|
});
|
@@ -56,17 +56,17 @@ function upload() {
|
|
56
56
|
* @returns {Promise<void>}
|
57
57
|
*/
|
58
58
|
async function onAttachFiles({ target: { files } }) {
|
59
|
-
emit(
|
59
|
+
emit("uploading", files);
|
60
60
|
let fileUpload = new FileUpload(files)
|
61
61
|
.onProgress(({ file, progress }) => {
|
62
62
|
file.progress = progress;
|
63
|
-
emit(
|
63
|
+
emit("file-progress", file);
|
64
64
|
})
|
65
65
|
.onComplete(({ file, uploadedFile }) => {
|
66
|
-
emit(
|
66
|
+
emit("file-complete", { file, uploadedFile });
|
67
67
|
})
|
68
68
|
.onAllComplete(() => {
|
69
|
-
emit(
|
69
|
+
emit("complete", fileUpload.files);
|
70
70
|
});
|
71
71
|
|
72
72
|
if (props.geolocation) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<div
|
4
4
|
class="cursor-pointer py-2 hover:bg-blue-light flex items-center justify-end"
|
5
5
|
>
|
6
|
-
{{ fLocalizedDateTime(modelValue, { empty:
|
6
|
+
{{ fLocalizedDateTime(modelValue, { empty: "Never" }) }}
|
7
7
|
<EditIcon class="w-4 font-bold ml-2 text-gray-base" />
|
8
8
|
<QPopupEdit
|
9
9
|
v-slot="scope"
|
@@ -23,11 +23,11 @@
|
|
23
23
|
</div>
|
24
24
|
</template>
|
25
25
|
<script setup>
|
26
|
-
import { PencilIcon as EditIcon } from
|
27
|
-
import { fLocalizedDateTime } from
|
28
|
-
import DateTimePicker from
|
26
|
+
import { PencilIcon as EditIcon } from "@heroicons/vue/solid";
|
27
|
+
import { fLocalizedDateTime } from "../../../../helpers";
|
28
|
+
import DateTimePicker from "./DateTimePicker";
|
29
29
|
|
30
|
-
const emit = defineEmits([
|
30
|
+
const emit = defineEmits(["close", "save", "update:model-value"]);
|
31
31
|
defineProps({
|
32
32
|
modelValue: {
|
33
33
|
type: String,
|
@@ -37,8 +37,8 @@ defineProps({
|
|
37
37
|
});
|
38
38
|
|
39
39
|
function onSave(scope) {
|
40
|
-
emit(
|
41
|
-
emit(
|
40
|
+
emit("update:model-value", scope.value);
|
41
|
+
emit("save", scope.value);
|
42
42
|
scope.set();
|
43
43
|
}
|
44
44
|
</script>
|
@@ -9,9 +9,9 @@
|
|
9
9
|
</template>
|
10
10
|
|
11
11
|
<script setup>
|
12
|
-
import NumberField from
|
12
|
+
import NumberField from "./NumberField";
|
13
13
|
|
14
|
-
defineEmits([
|
14
|
+
defineEmits(["update:model-value"]);
|
15
15
|
defineProps({
|
16
16
|
modelValue: {
|
17
17
|
type: [String, Number],
|
@@ -61,12 +61,12 @@
|
|
61
61
|
</template>
|
62
62
|
|
63
63
|
<script setup>
|
64
|
-
import { onMounted } from
|
65
|
-
import { useMultiFileUpload } from
|
66
|
-
import { FilePreview } from
|
67
|
-
import FieldLabel from
|
64
|
+
import { onMounted } from "vue";
|
65
|
+
import { useMultiFileUpload } from "../../../../helpers";
|
66
|
+
import { FilePreview } from "../../../Utility";
|
67
|
+
import FieldLabel from "./FieldLabel";
|
68
68
|
|
69
|
-
const emit = defineEmits([
|
69
|
+
const emit = defineEmits(["update:model-value"]);
|
70
70
|
const props = defineProps({
|
71
71
|
modelValue: {
|
72
72
|
type: [Object, String],
|
@@ -87,5 +87,5 @@ onMounted(() => {
|
|
87
87
|
uploadedFiles.value = props.modelValue;
|
88
88
|
}
|
89
89
|
});
|
90
|
-
onComplete(() => emit(
|
90
|
+
onComplete(() => emit("update:model-value", uploadedFiles.value));
|
91
91
|
</script>
|
@@ -23,15 +23,15 @@
|
|
23
23
|
</template>
|
24
24
|
|
25
25
|
<script setup>
|
26
|
-
import { computed, ref, watch } from
|
27
|
-
import SelectField from
|
28
|
-
import TextField from
|
26
|
+
import { computed, ref, watch } from "vue";
|
27
|
+
import SelectField from "./SelectField";
|
28
|
+
import TextField from "./TextField";
|
29
29
|
|
30
|
-
const emit = defineEmits([
|
30
|
+
const emit = defineEmits(["update:model-value"]);
|
31
31
|
const props = defineProps({
|
32
32
|
modelValue: {
|
33
33
|
type: [String, Number, Object],
|
34
|
-
default:
|
34
|
+
default: ""
|
35
35
|
},
|
36
36
|
field: {
|
37
37
|
type: Object,
|
@@ -43,12 +43,12 @@ const selectedFieldName = ref(props.field.defaultOption);
|
|
43
43
|
const searchList = computed(() => props.modelValue && props.modelValue[selectedFieldName.value]);
|
44
44
|
const textInput = ref(formatModelValue());
|
45
45
|
function onChange() {
|
46
|
-
textInput.value = textInput.value?.replace(/\n/g,
|
47
|
-
emit(
|
46
|
+
textInput.value = textInput.value?.replace(/\n/g, ",").replace(/,{2,}/g, ",") || "";
|
47
|
+
emit("update:model-value", textInput.value ? { [selectedFieldName.value]: textInput.value.split(",") } : undefined);
|
48
48
|
}
|
49
49
|
|
50
50
|
function formatModelValue() {
|
51
|
-
return Array.isArray(searchList.value) ? searchList.value?.join(
|
51
|
+
return Array.isArray(searchList.value) ? searchList.value?.join(",") : "";
|
52
52
|
}
|
53
53
|
|
54
54
|
watch(() => props.modelValue, () => {
|
@@ -8,21 +8,21 @@
|
|
8
8
|
</template>
|
9
9
|
|
10
10
|
<script setup>
|
11
|
-
import LabeledInput from
|
11
|
+
import LabeledInput from "./LabeledInput";
|
12
12
|
|
13
|
-
defineEmits([
|
13
|
+
defineEmits(["update:model-value"]);
|
14
14
|
const props = defineProps({
|
15
15
|
name: {
|
16
16
|
type: String,
|
17
|
-
default:
|
17
|
+
default: "password"
|
18
18
|
},
|
19
19
|
label: {
|
20
20
|
type: String,
|
21
|
-
default:
|
21
|
+
default: "Password"
|
22
22
|
},
|
23
23
|
placeholder: {
|
24
24
|
type: String,
|
25
|
-
default:
|
25
|
+
default: "Enter Password"
|
26
26
|
},
|
27
27
|
modelValue: {
|
28
28
|
type: [String, Number],
|
@@ -35,5 +35,5 @@ const props = defineProps({
|
|
35
35
|
disabled: Boolean
|
36
36
|
});
|
37
37
|
|
38
|
-
const rules = [(val) => val.length >= 8 ||
|
38
|
+
const rules = [(val) => val.length >= 8 || "Please use at least 8 characters"];
|
39
39
|
</script>
|
@@ -16,20 +16,20 @@
|
|
16
16
|
:show-name="showName"
|
17
17
|
/>
|
18
18
|
</template>
|
19
|
-
|
19
|
+
</QInput>
|
20
20
|
</template>
|
21
21
|
|
22
22
|
<script setup>
|
23
|
-
import { useDebounceFn } from
|
24
|
-
import { computed, nextTick, ref, watch } from
|
25
|
-
import { fNumber } from
|
26
|
-
import FieldLabel from
|
23
|
+
import { useDebounceFn } from "@vueuse/core";
|
24
|
+
import { computed, nextTick, ref, watch } from "vue";
|
25
|
+
import { fNumber } from "../../../../helpers";
|
26
|
+
import FieldLabel from "./FieldLabel";
|
27
27
|
|
28
|
-
const emit = defineEmits([
|
28
|
+
const emit = defineEmits(["update:model-value", "update"]);
|
29
29
|
const props = defineProps({
|
30
30
|
modelValue: {
|
31
31
|
type: [String, Number],
|
32
|
-
default:
|
32
|
+
default: ""
|
33
33
|
},
|
34
34
|
precision: {
|
35
35
|
type: Number,
|
@@ -45,7 +45,7 @@ const props = defineProps({
|
|
45
45
|
},
|
46
46
|
inputClass: {
|
47
47
|
type: String,
|
48
|
-
default:
|
48
|
+
default: ""
|
49
49
|
},
|
50
50
|
delay: {
|
51
51
|
type: Number,
|
@@ -59,47 +59,47 @@ const props = defineProps({
|
|
59
59
|
const numberVal = ref(format(props.modelValue));
|
60
60
|
watch(() => props.modelValue, () => numberVal.value = format(props.modelValue));
|
61
61
|
|
62
|
-
const fieldOptions = computed(() => props.field || { label: props.label ||
|
62
|
+
const fieldOptions = computed(() => props.field || { label: props.label || "", placeholder: "", id: "" });
|
63
63
|
|
64
64
|
function format(number) {
|
65
|
-
if (!number && number !== 0 && number !==
|
65
|
+
if (!number && number !== 0 && number !== "0") return number;
|
66
66
|
|
67
|
-
const minimumFractionDigits = Math.min(props.precision, (
|
67
|
+
const minimumFractionDigits = Math.min(props.precision, ("" + number).split(".")[1]?.length || 0);
|
68
68
|
let options = {
|
69
69
|
minimumFractionDigits
|
70
70
|
};
|
71
71
|
|
72
72
|
if (props.currency) {
|
73
73
|
options = {
|
74
|
-
style:
|
75
|
-
currency:
|
74
|
+
style: "currency",
|
75
|
+
currency: "USD",
|
76
76
|
minimumFractionDigits
|
77
77
|
};
|
78
78
|
}
|
79
79
|
return fNumber(number, options);
|
80
80
|
}
|
81
81
|
|
82
|
-
const onUpdateDebounced = useDebounceFn((val) => emit(
|
82
|
+
const onUpdateDebounced = useDebounceFn((val) => emit("update", val), props.delay);
|
83
83
|
|
84
84
|
function onInput(value) {
|
85
|
-
let number =
|
85
|
+
let number = "";
|
86
86
|
|
87
87
|
// Prevent invalid characters
|
88
88
|
if (value.match(/[^\d.,$]/)) {
|
89
89
|
const oldVal = numberVal.value;
|
90
90
|
// XXX: To get QInput to show only the value we want
|
91
|
-
numberVal.value +=
|
91
|
+
numberVal.value += " ";
|
92
92
|
return nextTick(() => numberVal.value = oldVal);
|
93
93
|
}
|
94
94
|
|
95
|
-
if (value !==
|
96
|
-
value = value.replace(/[^\d.]/g,
|
95
|
+
if (value !== "") {
|
96
|
+
value = value.replace(/[^\d.]/g, "");
|
97
97
|
number = Number(value);
|
98
98
|
numberVal.value = format(number);
|
99
99
|
}
|
100
100
|
|
101
|
-
number = number ===
|
102
|
-
emit(
|
101
|
+
number = number === "" ? undefined : number;
|
102
|
+
emit("update:model-value", number);
|
103
103
|
|
104
104
|
// Delay the change event, so we only see the value after the user has finished
|
105
105
|
onUpdateDebounced(number);
|
@@ -37,14 +37,14 @@
|
|
37
37
|
</template>
|
38
38
|
|
39
39
|
<script setup>
|
40
|
-
import { CurrencyDollarIcon as CurrencyIcon, HashtagIcon as NumberIcon } from
|
41
|
-
import { useDebounceFn } from
|
42
|
-
import { computed, ref, watch } from
|
43
|
-
import { fCurrency, fNumber, fPercent } from
|
44
|
-
import { PercentIcon } from
|
45
|
-
import NumberField from
|
40
|
+
import { CurrencyDollarIcon as CurrencyIcon, HashtagIcon as NumberIcon } from "@heroicons/vue/outline";
|
41
|
+
import { useDebounceFn } from "@vueuse/core";
|
42
|
+
import { computed, ref, watch } from "vue";
|
43
|
+
import { fCurrency, fNumber, fPercent } from "../../../../helpers";
|
44
|
+
import { PercentIcon } from "../../../../svg";
|
45
|
+
import NumberField from "./NumberField";
|
46
46
|
|
47
|
-
const emit = defineEmits([
|
47
|
+
const emit = defineEmits(["update:model-value"]);
|
48
48
|
const props = defineProps({
|
49
49
|
modelValue: {
|
50
50
|
type: Object,
|
@@ -68,28 +68,28 @@ const props = defineProps({
|
|
68
68
|
|
69
69
|
const symbol = computed(() => {
|
70
70
|
if (props.currency) {
|
71
|
-
return
|
71
|
+
return "$";
|
72
72
|
} else if (props.percent) {
|
73
|
-
return
|
73
|
+
return "%";
|
74
74
|
} else {
|
75
|
-
return
|
75
|
+
return "";
|
76
76
|
}
|
77
77
|
});
|
78
78
|
const minField = computed(() => {
|
79
79
|
return {
|
80
|
-
id:
|
81
|
-
name:
|
82
|
-
label:
|
83
|
-
placeholder:
|
80
|
+
id: "min-field",
|
81
|
+
name: "from",
|
82
|
+
label: "Min" + symbol.value,
|
83
|
+
placeholder: "0"
|
84
84
|
};
|
85
85
|
});
|
86
86
|
|
87
87
|
const maxField = computed(() => {
|
88
88
|
return {
|
89
|
-
id:
|
90
|
-
name:
|
91
|
-
label:
|
92
|
-
placeholder:
|
89
|
+
id: "max-field",
|
90
|
+
name: "to",
|
91
|
+
label: "Max" + symbol.value,
|
92
|
+
placeholder: "No Limit"
|
93
93
|
};
|
94
94
|
});
|
95
95
|
|
@@ -112,7 +112,7 @@ setRange(props.modelValue || { from: undefined, to: undefined });
|
|
112
112
|
* @returns {string}
|
113
113
|
*/
|
114
114
|
function formatNum(num) {
|
115
|
-
if (num === undefined) return
|
115
|
+
if (num === undefined) return "No Limit";
|
116
116
|
if (props.currency) {
|
117
117
|
return fCurrency(num);
|
118
118
|
}
|
@@ -134,7 +134,7 @@ const onSave = useDebounceFn(() => {
|
|
134
134
|
from: (range.value.from ? range.value.from * multiplier : undefined),
|
135
135
|
to: (range.value.to ? range.value.to * multiplier : undefined)
|
136
136
|
};
|
137
|
-
emit(
|
137
|
+
emit("update:model-value", newVal);
|
138
138
|
}
|
139
139
|
}, props.debounce);
|
140
140
|
</script>
|
@@ -53,15 +53,15 @@
|
|
53
53
|
<slot name="placeholder">{{ placeholder }}</slot>
|
54
54
|
</template>
|
55
55
|
</slot>
|
56
|
-
|
56
|
+
</QChip>
|
57
57
|
</div>
|
58
58
|
</template>
|
59
59
|
|
60
60
|
<script setup>
|
61
|
-
import { computed, ref } from
|
62
|
-
import { ContentDrawer } from
|
61
|
+
import { computed, ref } from "vue";
|
62
|
+
import { ContentDrawer } from "../../../Utility";
|
63
63
|
|
64
|
-
const emit = defineEmits([
|
64
|
+
const emit = defineEmits(["update:modelValue"]);
|
65
65
|
const props = defineProps({
|
66
66
|
modelValue: {
|
67
67
|
type: [Object, String, Array, null],
|
@@ -74,18 +74,18 @@ const props = defineProps({
|
|
74
74
|
multiple: Boolean,
|
75
75
|
label: {
|
76
76
|
type: String,
|
77
|
-
default:
|
77
|
+
default: "Select"
|
78
78
|
},
|
79
79
|
placeholder: {
|
80
80
|
type: String,
|
81
|
-
default:
|
81
|
+
default: "All"
|
82
82
|
}
|
83
83
|
});
|
84
84
|
|
85
85
|
const showDrawer = ref(false);
|
86
86
|
const formattedOptions = computed(() =>
|
87
87
|
props.options.map((opt) =>
|
88
|
-
typeof opt ===
|
88
|
+
typeof opt === "string"
|
89
89
|
? {
|
90
90
|
label: opt,
|
91
91
|
value: opt
|
@@ -131,6 +131,6 @@ function toggleSelect(option) {
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
|
134
|
-
emit(
|
134
|
+
emit("update:modelValue", selection);
|
135
135
|
}
|
136
136
|
</script>
|
@@ -41,13 +41,13 @@
|
|
41
41
|
:key="'selected-' + chipOption.label"
|
42
42
|
class="!mr-1"
|
43
43
|
>{{ chipOption.label }}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
</QChip>
|
45
|
+
<QChip
|
46
|
+
v-if="selectedOptions.length > chipOptions.length"
|
47
|
+
class="!mr-1"
|
48
|
+
>
|
49
|
+
+{{ selectedOptions.length - chipOptions.length }}
|
50
|
+
</QChip>
|
51
51
|
</template>
|
52
52
|
<template v-else>
|
53
53
|
{{ placeholder }}
|
@@ -59,15 +59,15 @@
|
|
59
59
|
>{{ selectedLabel }}
|
60
60
|
</div>
|
61
61
|
</template>
|
62
|
-
|
62
|
+
</QSelect>
|
63
63
|
</div>
|
64
64
|
</template>
|
65
65
|
<script setup>
|
66
|
-
import { ChevronDownIcon as DropDownIcon } from
|
67
|
-
import { QSelect } from
|
68
|
-
import { computed, isRef, nextTick, ref } from
|
66
|
+
import { ChevronDownIcon as DropDownIcon } from "@heroicons/vue/outline";
|
67
|
+
import { QSelect } from "quasar";
|
68
|
+
import { computed, isRef, nextTick, ref } from "vue";
|
69
69
|
|
70
|
-
const emit = defineEmits([
|
70
|
+
const emit = defineEmits(["update:model-value", "search", "update"]);
|
71
71
|
const props = defineProps({
|
72
72
|
...QSelect.props,
|
73
73
|
modelValue: {
|
@@ -76,7 +76,7 @@ const props = defineProps({
|
|
76
76
|
},
|
77
77
|
placeholder: {
|
78
78
|
type: String,
|
79
|
-
default:
|
79
|
+
default: ""
|
80
80
|
},
|
81
81
|
selectionLabel: {
|
82
82
|
type: String,
|
@@ -88,11 +88,11 @@ const props = defineProps({
|
|
88
88
|
},
|
89
89
|
inputClass: {
|
90
90
|
type: String,
|
91
|
-
default:
|
91
|
+
default: ""
|
92
92
|
},
|
93
93
|
selectionClass: {
|
94
94
|
type: String,
|
95
|
-
default:
|
95
|
+
default: ""
|
96
96
|
},
|
97
97
|
options: {
|
98
98
|
type: Array,
|
@@ -148,10 +148,10 @@ const selectedValue = computed(() => {
|
|
148
148
|
if (props.multiple) {
|
149
149
|
const arrVal = Array.isArray(props.modelValue) ? props.modelValue : [];
|
150
150
|
return arrVal.map((v) => {
|
151
|
-
return v === null ?
|
151
|
+
return v === null ? "__null__" : v;
|
152
152
|
}) || [];
|
153
153
|
} else {
|
154
|
-
return props.modelValue === null ?
|
154
|
+
return props.modelValue === null ? "__null__" : props.modelValue;
|
155
155
|
}
|
156
156
|
});
|
157
157
|
|
@@ -165,7 +165,7 @@ const selectedOptions = computed(() => {
|
|
165
165
|
values = (values || values === 0) ? [values] : [];
|
166
166
|
}
|
167
167
|
return computedOptions.value.filter((o) => {
|
168
|
-
return values.includes(o.value) || values.map(v => typeof v ===
|
168
|
+
return values.includes(o.value) || values.map(v => typeof v === "object" && v.id).includes(o.value?.id);
|
169
169
|
});
|
170
170
|
});
|
171
171
|
|
@@ -175,10 +175,10 @@ const selectedOptions = computed(() => {
|
|
175
175
|
* @type {ComputedRef<unknown>}
|
176
176
|
*/
|
177
177
|
const selectedLabel = computed(() => {
|
178
|
-
if (props.filterable && isShowing.value) return
|
178
|
+
if (props.filterable && isShowing.value) return "";
|
179
179
|
|
180
180
|
if (!selectedOptions.value || selectedOptions.value.length === 0) {
|
181
|
-
return props.placeholder ||
|
181
|
+
return props.placeholder || "(Select Option)";
|
182
182
|
}
|
183
183
|
return selectedOptions.value[0].selectionLabel;
|
184
184
|
});
|
@@ -197,13 +197,13 @@ const chipOptions = computed(() => {
|
|
197
197
|
* @returns {*|string}
|
198
198
|
*/
|
199
199
|
function resolveLabel(option) {
|
200
|
-
if (typeof option ===
|
200
|
+
if (typeof option === "string") {
|
201
201
|
return option;
|
202
202
|
}
|
203
|
-
if (typeof props.optionLabel ===
|
203
|
+
if (typeof props.optionLabel === "string") {
|
204
204
|
return option[props.optionLabel];
|
205
205
|
}
|
206
|
-
if (typeof props.optionLabel ===
|
206
|
+
if (typeof props.optionLabel === "function") {
|
207
207
|
return props.optionLabel(option);
|
208
208
|
}
|
209
209
|
return option?.label;
|
@@ -216,13 +216,13 @@ function resolveLabel(option) {
|
|
216
216
|
* @returns {*|{default: null, type: String | StringConstructor}|string}
|
217
217
|
*/
|
218
218
|
function resolveSelectionLabel(option) {
|
219
|
-
if (typeof option ===
|
219
|
+
if (typeof option === "string") {
|
220
220
|
return option;
|
221
221
|
}
|
222
|
-
if (typeof props.selectionLabel ===
|
222
|
+
if (typeof props.selectionLabel === "string") {
|
223
223
|
return option[props.selectionLabel];
|
224
224
|
}
|
225
|
-
if (typeof props.selectionLabel ===
|
225
|
+
if (typeof props.selectionLabel === "function") {
|
226
226
|
return props.selectionLabel(option);
|
227
227
|
}
|
228
228
|
return option?.selectionLabel || option?.label;
|
@@ -234,17 +234,17 @@ function resolveSelectionLabel(option) {
|
|
234
234
|
* @returns {string|*|string}
|
235
235
|
*/
|
236
236
|
function resolveValue(option) {
|
237
|
-
if (typeof option ===
|
237
|
+
if (typeof option === "string") {
|
238
238
|
return option;
|
239
239
|
}
|
240
240
|
let value = option.value;
|
241
|
-
if (typeof props.optionValue ===
|
241
|
+
if (typeof props.optionValue === "string") {
|
242
242
|
value = option[props.optionValue];
|
243
|
-
} else if (typeof props.optionValue ===
|
243
|
+
} else if (typeof props.optionValue === "function") {
|
244
244
|
value = props.optionValue(option);
|
245
245
|
}
|
246
246
|
// Note the __null__ special case here. See the onUpdate function for more details
|
247
|
-
return value === null ?
|
247
|
+
return value === null ? "__null__" : value;
|
248
248
|
}
|
249
249
|
|
250
250
|
/**
|
@@ -255,13 +255,13 @@ function resolveValue(option) {
|
|
255
255
|
*/
|
256
256
|
function onUpdate(value) {
|
257
257
|
if (Array.isArray(value)) {
|
258
|
-
value = value.map((v) => v ===
|
258
|
+
value = value.map((v) => v === "__null__" ? null : v);
|
259
259
|
}
|
260
260
|
|
261
|
-
value = value ===
|
261
|
+
value = value === "__null__" ? null : value;
|
262
262
|
|
263
|
-
emit(
|
264
|
-
emit(
|
263
|
+
emit("update", value);
|
264
|
+
emit("update:model-value", value);
|
265
265
|
}
|
266
266
|
|
267
267
|
/** XXX: This tells us when we should apply the filter. QSelect likes to trigger a new filter everytime you open the dropdown
|
@@ -295,8 +295,8 @@ async function onFilter(val, update) {
|
|
295
295
|
* See the onUpdate function for more details
|
296
296
|
*/
|
297
297
|
function onClear() {
|
298
|
-
emit(
|
299
|
-
emit(
|
298
|
+
emit("update:model-value", undefined);
|
299
|
+
emit("update", undefined);
|
300
300
|
}
|
301
301
|
|
302
302
|
/**
|