@naptics/vue-collection 0.2.3 → 0.2.5

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.
Files changed (65) hide show
  1. package/components/NAlert.d.ts +2 -2
  2. package/components/NAlert.js +3 -2
  3. package/components/NBadge.d.ts +2 -2
  4. package/components/NBadge.js +3 -2
  5. package/components/NBreadcrub.d.ts +2 -2
  6. package/components/NBreadcrub.js +3 -2
  7. package/components/NButton.d.ts +2 -2
  8. package/components/NButton.js +3 -2
  9. package/components/NCheckbox.d.ts +2 -2
  10. package/components/NCheckbox.js +3 -2
  11. package/components/NCheckboxLabel.d.ts +2 -2
  12. package/components/NCheckboxLabel.js +3 -2
  13. package/components/NCrudModal.d.ts +2 -2
  14. package/components/NCrudModal.js +3 -2
  15. package/components/NDialog.d.ts +2 -2
  16. package/components/NDialog.js +3 -2
  17. package/components/NDropdown.d.ts +4 -72
  18. package/components/NDropdown.js +3 -2
  19. package/components/NDropzone.d.ts +2 -2
  20. package/components/NDropzone.js +2 -1
  21. package/components/NForm.d.ts +2 -2
  22. package/components/NForm.js +3 -2
  23. package/components/NFormModal.d.ts +2 -2
  24. package/components/NFormModal.js +3 -2
  25. package/components/NIconButton.d.ts +2 -2
  26. package/components/NIconButton.js +3 -2
  27. package/components/NIconCircle.d.ts +2 -2
  28. package/components/NIconCircle.js +3 -2
  29. package/components/NInput.d.ts +2 -2
  30. package/components/NInput.js +3 -2
  31. package/components/NInputPhone.d.ts +6 -2
  32. package/components/NInputPhone.js +2 -1
  33. package/components/NInputSelect.d.ts +2 -2
  34. package/components/NInputSelect.js +3 -2
  35. package/components/NInputSuggestion.d.ts +6 -2
  36. package/components/NInputSuggestion.js +3 -2
  37. package/components/NLink.d.ts +2 -2
  38. package/components/NLink.js +3 -2
  39. package/components/NList.d.ts +2 -2
  40. package/components/NList.js +2 -1
  41. package/components/NLoadingIndicator.d.ts +2 -2
  42. package/components/NLoadingIndicator.js +3 -2
  43. package/components/NModal.d.ts +2 -2
  44. package/components/NModal.js +3 -2
  45. package/components/NPagination.d.ts +2 -2
  46. package/components/NPagination.js +2 -1
  47. package/components/NSearchbar.d.ts +2 -2
  48. package/components/NSearchbar.js +3 -2
  49. package/components/NSearchbarList.d.ts +2 -2
  50. package/components/NSearchbarList.js +3 -2
  51. package/components/NSelect.d.ts +2 -2
  52. package/components/NSelect.js +3 -2
  53. package/components/NSuggestionList.d.ts +4 -4
  54. package/components/NSuggestionList.js +3 -2
  55. package/components/NTable.d.ts +2 -2
  56. package/components/NTable.js +2 -1
  57. package/components/NTableAction.d.ts +2 -2
  58. package/components/NTableAction.js +3 -2
  59. package/components/NTextArea.d.ts +6 -2
  60. package/components/NTextArea.js +2 -1
  61. package/components/NTooltip.d.ts +2 -2
  62. package/components/NTooltip.js +2 -1
  63. package/components/NValInput.d.ts +35 -5
  64. package/components/NValInput.js +11 -4
  65. package/package.json +1 -1
@@ -3,8 +3,13 @@ import { createComponentWithSlots } from '../utils/component';
3
3
  import { computed } from 'vue';
4
4
  import { ref, reactive, watch } from 'vue';
5
5
  import NInput, { nInputProps } from './NInput';
6
- import { validate, required } from '../utils/validation';
6
+ import { validate, required, validResult } from '../utils/validation';
7
7
  export const validationProps = {
8
+ /**
9
+ * If set to `true` this inputs validation will always succeed and all validation
10
+ * rules are ignored. Default is `false`.
11
+ */
12
+ disableValidation: Boolean,
8
13
  /**
9
14
  * If set to `true` this input is always valid when its value is empty.
10
15
  * If set to `false` the input receives the {@link required} rule. Default is `false`.
@@ -53,14 +58,14 @@ export const nValInputProps = {
53
58
  /**
54
59
  * The `NValInput` is a `NInput` with custom validation.
55
60
  */
56
- export default createComponentWithSlots('NValInput', nValInputProps, ['input'], (props, context) => {
61
+ const Component = createComponentWithSlots('NValInput', nValInputProps, ['input'], (props, context) => {
57
62
  const rules = computed(() => {
58
63
  const otherRules = Array.isArray(props.rules) ? props.rules : [props.rules];
59
64
  return props.optional ? otherRules : [required, ...otherRules];
60
65
  });
61
66
  const validationResult = ref();
62
67
  const validateRules = input => {
63
- const result = validate(input, rules.value);
68
+ const result = props.disableValidation ? validResult() : validate(input, rules.value);
64
69
  validationResult.value = result;
65
70
  return result;
66
71
  };
@@ -72,6 +77,7 @@ export default createComponentWithSlots('NValInput', nValInputProps, ['input'],
72
77
  };
73
78
  watch(() => props.value, () => validateIfError());
74
79
  watch(() => rules.value, () => validateIfError());
80
+ watch(() => props.disableValidation, () => validateIfError());
75
81
  const onBlur = () => {
76
82
  if (!props.disableBlurValidation) validateRules(props.value);
77
83
  props.onBlur?.();
@@ -101,4 +107,5 @@ export default createComponentWithSlots('NValInput', nValInputProps, ['input'],
101
107
  }), null), showErrorMessage.value && _createVNode("p", {
102
108
  "class": "text-red-500 text-xs mt-1"
103
109
  }, [errorMessage.value])]);
104
- });
110
+ });
111
+ export { Component as NValInput, Component as default };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@naptics/vue-collection",
3
3
  "author": "Timo Siegenthaler",
4
4
  "description": "Vue Collection is a collection of styled and fully functional Vue components which can easily be integrated into our projects.",
5
- "version": "0.2.3",
5
+ "version": "0.2.5",
6
6
  "main": "./index.js",
7
7
  "repository": {
8
8
  "type": "git",