UNPKG

devextreme-vue

Version:

DevExtreme Vue UI and Visualization Components

349 lines (347 loc) • 10.9 kB
/*! * devextreme-vue * Version: 25.1.5 * Build date: Wed Sep 03 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-vue */ import { defineComponent } from "vue"; import { prepareExtensionComponentConfig } from "./core/index"; import Validator from "devextreme/ui/validator"; import { prepareConfigurationComponentConfig } from "./core/index"; const componentConfig = { props: { adapter: Object, elementAttr: Object, height: [Number, String], name: String, onDisposing: Function, onInitialized: Function, onOptionChanged: Function, onValidated: Function, validationGroup: String, validationRules: Array, width: [Number, String] }, emits: { "update:isActive": null, "update:hoveredElement": null, "update:adapter": null, "update:elementAttr": null, "update:height": null, "update:name": null, "update:onDisposing": null, "update:onInitialized": null, "update:onOptionChanged": null, "update:onValidated": null, "update:validationGroup": null, "update:validationRules": null, "update:width": null, }, computed: { instance() { return this.$_instance; } }, beforeCreate() { this.$_WidgetClass = Validator; this.$_hasAsyncTemplate = true; this.$_expectedChildren = { adapter: { isCollectionItem: false, optionName: "adapter" }, AsyncRule: { isCollectionItem: true, optionName: "validationRules" }, CompareRule: { isCollectionItem: true, optionName: "validationRules" }, CustomRule: { isCollectionItem: true, optionName: "validationRules" }, EmailRule: { isCollectionItem: true, optionName: "validationRules" }, NumericRule: { isCollectionItem: true, optionName: "validationRules" }, PatternRule: { isCollectionItem: true, optionName: "validationRules" }, RangeRule: { isCollectionItem: true, optionName: "validationRules" }, RequiredRule: { isCollectionItem: true, optionName: "validationRules" }, StringLengthRule: { isCollectionItem: true, optionName: "validationRules" }, validationRule: { isCollectionItem: true, optionName: "validationRules" } }; } }; prepareExtensionComponentConfig(componentConfig); const DxValidator = defineComponent(componentConfig); const DxAdapterConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:applyValidationResults": null, "update:bypass": null, "update:focus": null, "update:getValue": null, "update:reset": null, "update:validationRequestsCallbacks": null, }, props: { applyValidationResults: Function, bypass: Function, focus: Function, getValue: Function, reset: Function, validationRequestsCallbacks: Array } }; prepareConfigurationComponentConfig(DxAdapterConfig); const DxAdapter = defineComponent(DxAdapterConfig); DxAdapter.$_optionName = "adapter"; const DxAsyncRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:ignoreEmptyValue": null, "update:message": null, "update:reevaluate": null, "update:type": null, "update:validationCallback": null, }, props: { ignoreEmptyValue: Boolean, message: String, reevaluate: Boolean, type: String, validationCallback: Function } }; prepareConfigurationComponentConfig(DxAsyncRuleConfig); const DxAsyncRule = defineComponent(DxAsyncRuleConfig); DxAsyncRule.$_optionName = "validationRules"; DxAsyncRule.$_isCollectionItem = true; DxAsyncRule.$_predefinedProps = { type: "async" }; const DxCompareRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:comparisonTarget": null, "update:comparisonType": null, "update:ignoreEmptyValue": null, "update:message": null, "update:type": null, }, props: { comparisonTarget: Function, comparisonType: String, ignoreEmptyValue: Boolean, message: String, type: String } }; prepareConfigurationComponentConfig(DxCompareRuleConfig); const DxCompareRule = defineComponent(DxCompareRuleConfig); DxCompareRule.$_optionName = "validationRules"; DxCompareRule.$_isCollectionItem = true; DxCompareRule.$_predefinedProps = { type: "compare" }; const DxCustomRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:ignoreEmptyValue": null, "update:message": null, "update:reevaluate": null, "update:type": null, "update:validationCallback": null, }, props: { ignoreEmptyValue: Boolean, message: String, reevaluate: Boolean, type: String, validationCallback: Function } }; prepareConfigurationComponentConfig(DxCustomRuleConfig); const DxCustomRule = defineComponent(DxCustomRuleConfig); DxCustomRule.$_optionName = "validationRules"; DxCustomRule.$_isCollectionItem = true; DxCustomRule.$_predefinedProps = { type: "custom" }; const DxEmailRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:ignoreEmptyValue": null, "update:message": null, "update:type": null, }, props: { ignoreEmptyValue: Boolean, message: String, type: String } }; prepareConfigurationComponentConfig(DxEmailRuleConfig); const DxEmailRule = defineComponent(DxEmailRuleConfig); DxEmailRule.$_optionName = "validationRules"; DxEmailRule.$_isCollectionItem = true; DxEmailRule.$_predefinedProps = { type: "email" }; const DxNumericRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:ignoreEmptyValue": null, "update:message": null, "update:type": null, }, props: { ignoreEmptyValue: Boolean, message: String, type: String } }; prepareConfigurationComponentConfig(DxNumericRuleConfig); const DxNumericRule = defineComponent(DxNumericRuleConfig); DxNumericRule.$_optionName = "validationRules"; DxNumericRule.$_isCollectionItem = true; DxNumericRule.$_predefinedProps = { type: "numeric" }; const DxPatternRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:ignoreEmptyValue": null, "update:message": null, "update:pattern": null, "update:type": null, }, props: { ignoreEmptyValue: Boolean, message: String, pattern: [RegExp, String], type: String } }; prepareConfigurationComponentConfig(DxPatternRuleConfig); const DxPatternRule = defineComponent(DxPatternRuleConfig); DxPatternRule.$_optionName = "validationRules"; DxPatternRule.$_isCollectionItem = true; DxPatternRule.$_predefinedProps = { type: "pattern" }; const DxRangeRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:ignoreEmptyValue": null, "update:max": null, "update:message": null, "update:min": null, "update:reevaluate": null, "update:type": null, }, props: { ignoreEmptyValue: Boolean, max: [Date, Number, String], message: String, min: [Date, Number, String], reevaluate: Boolean, type: String } }; prepareConfigurationComponentConfig(DxRangeRuleConfig); const DxRangeRule = defineComponent(DxRangeRuleConfig); DxRangeRule.$_optionName = "validationRules"; DxRangeRule.$_isCollectionItem = true; DxRangeRule.$_predefinedProps = { type: "range" }; const DxRequiredRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:message": null, "update:trim": null, "update:type": null, }, props: { message: String, trim: Boolean, type: String } }; prepareConfigurationComponentConfig(DxRequiredRuleConfig); const DxRequiredRule = defineComponent(DxRequiredRuleConfig); DxRequiredRule.$_optionName = "validationRules"; DxRequiredRule.$_isCollectionItem = true; DxRequiredRule.$_predefinedProps = { type: "required" }; const DxStringLengthRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:ignoreEmptyValue": null, "update:max": null, "update:message": null, "update:min": null, "update:trim": null, "update:type": null, }, props: { ignoreEmptyValue: Boolean, max: Number, message: String, min: Number, trim: Boolean, type: String } }; prepareConfigurationComponentConfig(DxStringLengthRuleConfig); const DxStringLengthRule = defineComponent(DxStringLengthRuleConfig); DxStringLengthRule.$_optionName = "validationRules"; DxStringLengthRule.$_isCollectionItem = true; DxStringLengthRule.$_predefinedProps = { type: "stringLength" }; const DxValidationRuleConfig = { emits: { "update:isActive": null, "update:hoveredElement": null, "update:comparisonTarget": null, "update:comparisonType": null, "update:ignoreEmptyValue": null, "update:max": null, "update:message": null, "update:min": null, "update:pattern": null, "update:reevaluate": null, "update:trim": null, "update:type": null, "update:validationCallback": null, }, props: { comparisonTarget: Function, comparisonType: String, ignoreEmptyValue: Boolean, max: [Date, Number, String], message: String, min: [Date, Number, String], pattern: [RegExp, String], reevaluate: Boolean, trim: Boolean, type: String, validationCallback: Function } }; prepareConfigurationComponentConfig(DxValidationRuleConfig); const DxValidationRule = defineComponent(DxValidationRuleConfig); DxValidationRule.$_optionName = "validationRules"; DxValidationRule.$_isCollectionItem = true; DxValidationRule.$_predefinedProps = { type: "required" }; export default DxValidator; export { DxValidator, DxAdapter, DxAsyncRule, DxCompareRule, DxCustomRule, DxEmailRule, DxNumericRule, DxPatternRule, DxRangeRule, DxRequiredRule, DxStringLengthRule, DxValidationRule };