quasar-ui-danx 0.3.29 → 0.3.31
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 +2908 -2883
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +5 -5
- package/dist/danx.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/Form/Fields/SelectDrawer.vue +49 -49
- package/src/components/ActionTable/listControls.ts +386 -382
- package/src/helpers/FileUpload.ts +299 -292
- package/src/helpers/files.ts +55 -42
package/package.json
CHANGED
@@ -69,74 +69,74 @@ import { ContentDrawer } from "../../../Utility";
|
|
69
69
|
|
70
70
|
const emit = defineEmits(["update:modelValue"]);
|
71
71
|
const props = defineProps({
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
72
|
+
modelValue: {
|
73
|
+
type: [Object, String, Array, null],
|
74
|
+
required: true
|
75
|
+
},
|
76
|
+
options: {
|
77
|
+
type: Array,
|
78
|
+
default: () => []
|
79
|
+
},
|
80
|
+
multiple: Boolean,
|
81
|
+
label: {
|
82
|
+
type: String,
|
83
|
+
default: "Select"
|
84
|
+
},
|
85
|
+
placeholder: {
|
86
|
+
type: String,
|
87
|
+
default: "All"
|
88
|
+
}
|
89
89
|
});
|
90
90
|
|
91
91
|
const showDrawer = ref(false);
|
92
92
|
const formattedOptions = computed(() =>
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
93
|
+
props.options.map((opt) =>
|
94
|
+
typeof opt === "string"
|
95
|
+
? {
|
96
|
+
label: opt,
|
97
|
+
value: opt
|
98
|
+
}
|
99
|
+
: opt
|
100
|
+
)
|
101
101
|
);
|
102
102
|
|
103
103
|
function getOptionValue(option) {
|
104
|
-
|
104
|
+
return option.value === undefined ? option : option.value;
|
105
105
|
}
|
106
106
|
|
107
107
|
function getOptionLabel(value) {
|
108
|
-
|
108
|
+
return formattedOptions.value.find((opt) => opt.value === value)?.label;
|
109
109
|
}
|
110
110
|
|
111
111
|
function isSelected(option) {
|
112
|
-
|
112
|
+
const optionValue = getOptionValue(option);
|
113
113
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
114
|
+
if (props.multiple) {
|
115
|
+
return props.modelValue.includes(optionValue);
|
116
|
+
} else {
|
117
|
+
return props.modelValue === optionValue;
|
118
|
+
}
|
119
119
|
}
|
120
120
|
|
121
121
|
function toggleSelect(option) {
|
122
|
-
|
122
|
+
let optionValue = getOptionValue(option);
|
123
123
|
|
124
|
-
|
124
|
+
let selection = optionValue;
|
125
125
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
126
|
+
if (props.multiple) {
|
127
|
+
selection = [...props.modelValue];
|
128
|
+
if (isSelected(optionValue)) {
|
129
|
+
selection = selection.filter((opt) => opt !== optionValue);
|
130
|
+
} else {
|
131
|
+
selection.push(optionValue);
|
132
|
+
}
|
133
|
+
} else {
|
134
|
+
// Allow deselection on single select
|
135
|
+
if (selection === props.modelValue) {
|
136
|
+
selection = null;
|
137
|
+
}
|
138
|
+
}
|
139
139
|
|
140
|
-
|
140
|
+
emit("update:modelValue", selection);
|
141
141
|
}
|
142
142
|
</script>
|