-
+ class="control is-clearfix">
+ getMask ? onInput($event.detail.value) : null"
+ @input="($event) => getMask ? null : onInput($event.target.value)"
+ @blur="onBlur" >
+
import { isCancel } from '../../../js/axios';
import { dynamicFilterTypeMixin } from '../../../js/filter-types-mixin';
+ import { IMaskDirective } from 'vue-imask';
export default {
+ directives: {
+ imask: IMaskDirective
+ },
mixins: [dynamicFilterTypeMixin],
props: {
itemMetadatum: Object,
@@ -72,6 +82,15 @@
return this.itemMetadatum.metadatum.metadata_type_options.display_suggestions == 'yes';
else
return false;
+ },
+ getMask() {
+ if (this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.mask)
+ return {
+ mask: this.itemMetadatum.metadatum.metadata_type_options.mask,
+ lazy: false
+ };
+ else
+ return false;
}
},
created() {
diff --git a/src/views/admin/components/metadata-types/text/class-tainacan-text.php b/src/views/admin/components/metadata-types/text/class-tainacan-text.php
index 03b82f61a..b88fd9539 100644
--- a/src/views/admin/components/metadata-types/text/class-tainacan-text.php
+++ b/src/views/admin/components/metadata-types/text/class-tainacan-text.php
@@ -35,6 +35,10 @@ class Text extends Metadata_Type {
'display_suggestions' => [
'title' => __( 'Display suggestions', 'tainacan' ),
'description' => __( 'Show an autocomplete input suggesting values inserted previously on other items for this metadatum.', 'tainacan' ),
+ ],
+ 'mask' => [
+ 'title' => __( 'Mask input', 'tainacan' ),
+ 'description' => __( 'Define a pattern that will be used to mask the input.', 'tainacan' ),
]
];
}