diff --git a/frontend_src/vstutils/components/TagsSelector.vue b/frontend_src/vstutils/components/TagsSelector.vue index 194fe94c..86aa4214 100644 --- a/frontend_src/vstutils/components/TagsSelector.vue +++ b/frontend_src/vstutils/components/TagsSelector.vue @@ -13,7 +13,14 @@ {{ item }} - + @@ -24,6 +31,7 @@ value: { type: Array, default: () => [] }, unique: { type: Boolean, default: false }, validator: { type: Function, default: (value) => value || undefined }, + inputmode: { type: String, default: 'text' }, }); const emit = defineEmits(['change']); diff --git a/frontend_src/vstutils/fields/array/custom/number.ts b/frontend_src/vstutils/fields/array/custom/number.ts index 10a5cd59..d42d631e 100644 --- a/frontend_src/vstutils/fields/array/custom/number.ts +++ b/frontend_src/vstutils/fields/array/custom/number.ts @@ -16,6 +16,7 @@ export const NumberArrayFieldEdit = defineComponent({ data() { return { itemsValidator: validateNumber, + inputmode: 'decimal', }; }, }); @@ -41,6 +42,7 @@ export const IntegerArrayFieldEdit = defineComponent({ data() { return { itemsValidator: validateInteger, + inputmode: 'numeric', }; }, }); diff --git a/frontend_src/vstutils/fields/array/custom/string.ts b/frontend_src/vstutils/fields/array/custom/string.ts index 095865c2..8ac95c54 100644 --- a/frontend_src/vstutils/fields/array/custom/string.ts +++ b/frontend_src/vstutils/fields/array/custom/string.ts @@ -22,6 +22,7 @@ export const StringArrayFieldEdit = defineComponent({ data() { return { itemsValidator: undefined, + inputmode: undefined, }; }, render() { @@ -31,6 +32,7 @@ export const StringArrayFieldEdit = defineComponent({ value: this.value || [], unique: this.field.uniqueItems, validator: this.itemsValidator, + inputmode: this.inputmode, }, on: { change: (items: unknown[]) => this.$emit('set-value', items) }, class: 'tags-selector', diff --git a/frontend_src/vstutils/fields/fk/fk/FKFieldContentEditable.vue b/frontend_src/vstutils/fields/fk/fk/FKFieldContentEditable.vue index a8aea976..e243fc68 100644 --- a/frontend_src/vstutils/fields/fk/fk/FKFieldContentEditable.vue +++ b/frontend_src/vstutils/fields/fk/fk/FKFieldContentEditable.vue @@ -51,6 +51,9 @@ $(this.selectEl!).off().select2('destroy'); }, methods: { + getSelectContainer() { + return this.$el; + }, /** * Method, that mounts select2 to current field's select. */ @@ -66,6 +69,7 @@ }, allowClear: this.field.nullable, placeholder: { id: undefined, text: '' }, + dropdownParent: $(this.getSelectContainer()), }) .on('change', () => { // @ts-expect-error Select2 has no types diff --git a/frontend_src/vstutils/fields/numbers/number.js b/frontend_src/vstutils/fields/numbers/number.js index b54adeda..554064df 100644 --- a/frontend_src/vstutils/fields/numbers/number.js +++ b/frontend_src/vstutils/fields/numbers/number.js @@ -7,7 +7,7 @@ export const NumberFieldContentMixin = { if (this.field.isValueValid(value)) { this.$emit('set-value', value); } else { - this.$refs.input.value = this.value; + this.$refs.input.value = this.value ?? ''; } }, }, diff --git a/frontend_src/vstutils/fields/text/PhoneFieldContentEdit.vue b/frontend_src/vstutils/fields/text/PhoneFieldContentEdit.vue index cc863fa9..7d0a23d9 100644 --- a/frontend_src/vstutils/fields/text/PhoneFieldContentEdit.vue +++ b/frontend_src/vstutils/fields/text/PhoneFieldContentEdit.vue @@ -6,7 +6,7 @@ { + test('country code selector is rendered', async () => { + const app = await createApp({ + schema: createSchema(), + }); + + const phoneField = app.fieldsResolver.resolveField({ + name: 'phone', + type: 'string', + format: 'phone', + }); + + const wrapper = mount({ + template: '', + components: { + PhoneField: phoneField.getComponent(), + }, + setup() { + return { + field: phoneField, + }; + }, + }); + + expect(wrapper.find('select').exists()).toBeTruthy(); + }); +}); diff --git a/vstutils/__init__.py b/vstutils/__init__.py index 95b6b272..4826670b 100644 --- a/vstutils/__init__.py +++ b/vstutils/__init__.py @@ -1,2 +1,2 @@ # pylint: disable=django-not-available -__version__: str = '5.8.17' +__version__: str = '5.8.18'