Skip to content

Commit b3eab78

Browse files
Adding support for loadingWait prop. Cleaning. Updating styles.
1 parent 13c70fb commit b3eab78

File tree

5 files changed

+64
-11
lines changed

5 files changed

+64
-11
lines changed

src/plugin/VInlineCheckbox.vue

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
:density="settings.density"
5353
:disabled="loading"
5454
:error="error"
55-
:false-icon="settings.falseIcon"
55+
:false-icon="theFalseIcon"
5656
:false-value="settings.falseValue"
5757
:hide-details="settings.hideDetails"
5858
:label="settings.label"
59-
:true-icon="settings.trueIcon"
59+
:true-icon="theTrueIcon"
6060
:value="settings.trueValue"
6161
@update:model-value="saveValue"
6262
>
@@ -79,6 +79,7 @@
7979
v-if="!settings.fieldOnly"
8080
class="ms-1"
8181
:color="settings.cancelButtonColor"
82+
:disabled="loading"
8283
icon
8384
:size="settings.cancelButtonSize"
8485
:title="settings.cancelButtonTitle"
@@ -129,15 +130,24 @@ const slots = useSlots();
129130
const emit = defineEmits([...inlineEmits]);
130131
const iconOptions = inject<IconOptions>(Symbol.for('vuetify:icons'));
131132
133+
console.log(iconOptions);
134+
132135
const props = withDefaults(defineProps<VInlineCheckboxProps>(), { ...checkboxProps });
133136
let settings = reactive({ ...attrs, ...props });
134137
135138
const error = ref<boolean>(false);
136-
const loading = ref<boolean>(false);
137139
const showField = ref<boolean>(false);
138140
const timeOpened = ref<TimeOpened>(null);
139141
140142
143+
// ------------------------------------------------ Loading //
144+
watch(() => props.loading, (newVal, oldVal) => {
145+
if (!newVal && oldVal && showField.value) {
146+
toggleField();
147+
}
148+
});
149+
150+
141151
// ------------------------------------------------ Icons //
142152
const theCancelIcon = computed(() => {
143153
return useGetIcon({
@@ -147,6 +157,21 @@ const theCancelIcon = computed(() => {
147157
});
148158
});
149159
160+
const theFalseIcon = computed(() => {
161+
return useGetIcon({
162+
icon: props.trueIcon,
163+
iconOptions,
164+
name: 'checkboxFalse',
165+
});
166+
});
167+
168+
const theTrueIcon = computed(() => {
169+
return useGetIcon({
170+
icon: props.iconTrue,
171+
iconOptions,
172+
name: 'checkboxTrue',
173+
});
174+
});
150175
151176
// ------------------------------------------------ The displayed value //
152177
const displayValue = computed(() => {
@@ -159,6 +184,8 @@ const inlineFieldsContainerClass = computed(() => useInlineFieldsContainerClass(
159184
density: settings.density,
160185
disabled: settings.disabled,
161186
field: 'v-checkbox',
187+
loading: props.loading,
188+
loadingWait: settings.loadingWait,
162189
tableField: settings.tableField,
163190
}));
164191
@@ -200,7 +227,7 @@ const displayValueStyle = computed(() => useDisplayValueStyles({
200227
201228
// ------------------------------------------------ Toggle the field //
202229
function toggleField() {
203-
if (settings.disabled) {
230+
if (settings.disabled || (settings.loadingWait && props.loading)) {
204231
return;
205232
}
206233

src/plugin/VInlineSelect.vue

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ const inlineFieldsContainerClass = computed(() => useInlineFieldsContainerClass(
182182
density: settings.density,
183183
disabled: settings.disabled,
184184
field: 'v-select',
185+
iconSet: iconOptions?.defaultSet,
186+
loading: props.loading,
187+
loadingWait: settings.loadingWait,
185188
tableField: settings.tableField,
186189
}));
187190
@@ -233,7 +236,7 @@ function closeField() {
233236
234237
// ------------------------------------------------ Toggle the field //
235238
function toggleField() {
236-
if (settings.disabled) {
239+
if (settings.disabled || (settings.loadingWait && props.loading)) {
237240
return;
238241
}
239242
@@ -322,9 +325,22 @@ onUnmounted(() => {
322325
</script>
323326

324327
<style lang="scss" scoped>
325-
// TODO: When clearable prop = true //
326-
// FIX: Adjust clearable icon position and fontawesome size
327-
// FIX: Adjust arrow icon position and fontawesome size
328+
.v-inline-fields {
329+
&--container {
330+
&-icon-set {
331+
&-fa {
332+
:deep(.v-field__clearable) {
333+
align-items: center;
334+
font-size: .8rem;
335+
}
336+
337+
:deep(.v-field__append-inner) {
338+
align-items: center;
339+
}
340+
}
341+
}
342+
}
343+
}
328344
329345
:deep(.v-input__append) {
330346
padding: 0 !important;
@@ -334,6 +350,10 @@ onUnmounted(() => {
334350
align-items: flex-end !important;
335351
}
336352
353+
:deep(.v-field__clearable) {
354+
padding: 0 !important;
355+
}
356+
337357
.icons-container {
338358
height: 100%;
339359
}

src/plugin/VInlineSwitch.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ const inlineFieldsContainerClass = computed(() => useInlineFieldsContainerClass(
164164
density: settings.density,
165165
disabled: settings.disabled,
166166
field: 'v-switch',
167+
loading: props.loading,
168+
loadingWait: settings.loadingWait,
167169
tableField: settings.tableField,
168170
}));
169171
@@ -205,7 +207,7 @@ const displayValueStyle = computed(() => useDisplayValueStyles({
205207
206208
// ------------------------------------------------ Toggle the field //
207209
function toggleField() {
208-
if (settings.disabled) {
210+
if (settings.disabled || (settings.loadingWait && props.loading)) {
209211
return;
210212
}
211213

src/plugin/VInlineTextField.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ const inlineFieldsContainerClass = computed(() => useInlineFieldsContainerClass(
163163
density: settings.density,
164164
disabled: settings.disabled,
165165
field: 'v-text-field',
166+
loading: props.loading,
167+
loadingWait: settings.loadingWait,
166168
tableField: settings.tableField,
167169
}));
168170
@@ -214,7 +216,7 @@ function closeField() {
214216
215217
// ------------------------------------------------ Toggle the field //
216218
function toggleField() {
217-
if (settings.disabled) {
219+
if (settings.disabled || (settings.loadingWait && props.loading)) {
218220
return;
219221
}
220222

src/plugin/VInlineTextarea.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ const inlineFieldsContainerClass = computed(() => useInlineFieldsContainerClass(
164164
density: settings.density,
165165
disabled: settings.disabled,
166166
field: 'v-textarea',
167+
loading: props.loading,
168+
loadingWait: settings.loadingWait,
167169
tableField: settings.tableField,
168170
}));
169171
@@ -215,7 +217,7 @@ function closeField() {
215217
216218
// ------------------------------------------------ Toggle the field //
217219
function toggleField() {
218-
if (settings.disabled) {
220+
if (settings.disabled || (settings.loadingWait && props.loading)) {
219221
return;
220222
}
221223

0 commit comments

Comments
 (0)