@naptics/vue-collection 0.0.1
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.
- package/README.md +27 -0
- package/lib/components/NAlert.d.ts +72 -0
- package/lib/components/NAlert.jsx +69 -0
- package/lib/components/NBadge.d.ts +174 -0
- package/lib/components/NBadge.jsx +58 -0
- package/lib/components/NBreadcrub.d.ts +161 -0
- package/lib/components/NBreadcrub.jsx +64 -0
- package/lib/components/NButton.d.ts +149 -0
- package/lib/components/NButton.jsx +58 -0
- package/lib/components/NCheckbox.d.ts +51 -0
- package/lib/components/NCheckbox.jsx +38 -0
- package/lib/components/NCheckboxLabel.d.ts +70 -0
- package/lib/components/NCheckboxLabel.jsx +42 -0
- package/lib/components/NCrudModal.d.ts +301 -0
- package/lib/components/NCrudModal.jsx +89 -0
- package/lib/components/NDialog.d.ts +190 -0
- package/lib/components/NDialog.jsx +144 -0
- package/lib/components/NDropdown.d.ts +116 -0
- package/lib/components/NDropdown.jsx +92 -0
- package/lib/components/NDropzone.d.ts +162 -0
- package/lib/components/NDropzone.jsx +211 -0
- package/lib/components/NForm.d.ts +43 -0
- package/lib/components/NForm.jsx +26 -0
- package/lib/components/NFormModal.d.ts +190 -0
- package/lib/components/NFormModal.jsx +48 -0
- package/lib/components/NIconButton.d.ts +202 -0
- package/lib/components/NIconButton.jsx +71 -0
- package/lib/components/NIconCircle.d.ts +135 -0
- package/lib/components/NIconCircle.jsx +67 -0
- package/lib/components/NInput.css +11 -0
- package/lib/components/NInput.d.ts +232 -0
- package/lib/components/NInput.jsx +97 -0
- package/lib/components/NInputPhone.d.ts +150 -0
- package/lib/components/NInputPhone.jsx +31 -0
- package/lib/components/NInputSelect.d.ts +271 -0
- package/lib/components/NInputSelect.jsx +89 -0
- package/lib/components/NInputSuggestion.d.ts +212 -0
- package/lib/components/NInputSuggestion.jsx +48 -0
- package/lib/components/NLink.d.ts +111 -0
- package/lib/components/NLink.jsx +58 -0
- package/lib/components/NList.d.ts +43 -0
- package/lib/components/NList.jsx +24 -0
- package/lib/components/NLoadingIndicator.css +46 -0
- package/lib/components/NLoadingIndicator.d.ts +77 -0
- package/lib/components/NLoadingIndicator.jsx +42 -0
- package/lib/components/NModal.d.ts +333 -0
- package/lib/components/NModal.jsx +170 -0
- package/lib/components/NPagination.css +15 -0
- package/lib/components/NPagination.d.ts +99 -0
- package/lib/components/NPagination.jsx +104 -0
- package/lib/components/NSearchbar.d.ts +94 -0
- package/lib/components/NSearchbar.jsx +58 -0
- package/lib/components/NSearchbarList.d.ts +90 -0
- package/lib/components/NSearchbarList.jsx +20 -0
- package/lib/components/NSelect.d.ts +159 -0
- package/lib/components/NSelect.jsx +81 -0
- package/lib/components/NSuggestionList.d.ts +275 -0
- package/lib/components/NSuggestionList.jsx +157 -0
- package/lib/components/NTable.css +3 -0
- package/lib/components/NTable.d.ts +187 -0
- package/lib/components/NTable.jsx +146 -0
- package/lib/components/NTableAction.d.ts +74 -0
- package/lib/components/NTableAction.jsx +35 -0
- package/lib/components/NTextArea.d.ts +252 -0
- package/lib/components/NTextArea.jsx +108 -0
- package/lib/components/NTooltip.css +37 -0
- package/lib/components/NTooltip.d.ts +186 -0
- package/lib/components/NTooltip.jsx +161 -0
- package/lib/components/NValInput.d.ts +297 -0
- package/lib/components/NValInput.jsx +101 -0
- package/lib/components/ValidatedForm.d.ts +34 -0
- package/lib/components/ValidatedForm.js +25 -0
- package/lib/i18n/de/template.json +10 -0
- package/lib/i18n/de/vue-collection.json +58 -0
- package/lib/i18n/de.d.ts +61 -0
- package/lib/i18n/de.js +5 -0
- package/lib/i18n/en/template.json +10 -0
- package/lib/i18n/en/vue-collection.json +58 -0
- package/lib/i18n/en.d.ts +61 -0
- package/lib/i18n/en.js +5 -0
- package/lib/i18n/index.d.ts +17 -0
- package/lib/i18n/index.js +34 -0
- package/lib/index.d.ts +64 -0
- package/lib/index.js +65 -0
- package/lib/utils/breakpoints.d.ts +15 -0
- package/lib/utils/breakpoints.js +37 -0
- package/lib/utils/component.d.ts +50 -0
- package/lib/utils/component.js +51 -0
- package/lib/utils/deferred.d.ts +13 -0
- package/lib/utils/deferred.js +17 -0
- package/lib/utils/identifiable.d.ts +57 -0
- package/lib/utils/identifiable.js +78 -0
- package/lib/utils/stringMaxLength.d.ts +14 -0
- package/lib/utils/stringMaxLength.js +28 -0
- package/lib/utils/tailwind.d.ts +2 -0
- package/lib/utils/tailwind.js +1 -0
- package/lib/utils/utils.d.ts +27 -0
- package/lib/utils/utils.js +26 -0
- package/lib/utils/vModel.d.ts +182 -0
- package/lib/utils/vModel.js +215 -0
- package/lib/utils/validation.d.ts +84 -0
- package/lib/utils/validation.js +163 -0
- package/lib/utils/vue.d.ts +13 -0
- package/lib/utils/vue.js +19 -0
- package/package.json +56 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createComponent, createProps } from '../utils/component';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { ref, reactive, watch } from 'vue';
|
|
4
|
+
import NInput, { nInputProps } from './NInput';
|
|
5
|
+
import { validate, required } from '../utils/validation';
|
|
6
|
+
export const validationProps = createProps({
|
|
7
|
+
/**
|
|
8
|
+
* If set to `true` this input is always valid when its value is empty.
|
|
9
|
+
* If set to `false` the input receives the {@link required} rule. Default is `false`.
|
|
10
|
+
*/
|
|
11
|
+
optional: Boolean,
|
|
12
|
+
/**
|
|
13
|
+
* The rules which this input is checked with.
|
|
14
|
+
* The rules are checked sequentially and the error of the first failed rule is displayed.
|
|
15
|
+
* If `optional` is set to false, the rule {@link required} will be checked first.
|
|
16
|
+
*/
|
|
17
|
+
rules: {
|
|
18
|
+
type: [Function, Array],
|
|
19
|
+
default: () => [],
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* The form, which this input will be added to.
|
|
23
|
+
* On initialization, this input will call {@link ValidatedForm.addInput} passing itself to the form.
|
|
24
|
+
*/
|
|
25
|
+
form: Object,
|
|
26
|
+
/**
|
|
27
|
+
* Overrides the internal error state. If set to true, it will always display an error.
|
|
28
|
+
*/
|
|
29
|
+
error: Boolean,
|
|
30
|
+
/**
|
|
31
|
+
* Overrides the internal error message. If set, this message is always displayed.
|
|
32
|
+
*/
|
|
33
|
+
errorMessage: String,
|
|
34
|
+
/**
|
|
35
|
+
* If set to `true` the error message is not shown.
|
|
36
|
+
* However, the input is still marked red if it is in an error state.
|
|
37
|
+
*/
|
|
38
|
+
hideErrorMessage: Boolean,
|
|
39
|
+
/**
|
|
40
|
+
* Disables the validation on blur. Should only be used in special occasions.
|
|
41
|
+
*/
|
|
42
|
+
disableBlurValidation: Boolean,
|
|
43
|
+
});
|
|
44
|
+
export const nValInputProps = createProps({
|
|
45
|
+
...nInputProps,
|
|
46
|
+
...validationProps,
|
|
47
|
+
/**
|
|
48
|
+
* A slot to replace the input.
|
|
49
|
+
*/
|
|
50
|
+
input: Function,
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* The `NValInput` is a `NInput` with custom validation.
|
|
54
|
+
*/
|
|
55
|
+
export default createComponent('NValInput', nValInputProps, (props, context) => {
|
|
56
|
+
const rules = computed(() => {
|
|
57
|
+
const otherRules = Array.isArray(props.rules) ? props.rules : [props.rules];
|
|
58
|
+
return props.optional ? otherRules : [required, ...otherRules];
|
|
59
|
+
});
|
|
60
|
+
const validationResult = ref();
|
|
61
|
+
const validateRules = (input) => {
|
|
62
|
+
const result = validate(input, rules.value);
|
|
63
|
+
validationResult.value = result;
|
|
64
|
+
return result;
|
|
65
|
+
};
|
|
66
|
+
const showError = computed(() => props.error || (validationResult.value != null && !validationResult.value.isValid));
|
|
67
|
+
const showErrorMessage = computed(() => !props.hideErrorMessage && showError.value);
|
|
68
|
+
const errorMessage = computed(() => props.errorMessage || validationResult.value?.errorMessage);
|
|
69
|
+
const validateIfError = (value = props.value) => {
|
|
70
|
+
if (showError.value)
|
|
71
|
+
validateRules(value);
|
|
72
|
+
};
|
|
73
|
+
watch(() => props.value, () => validateIfError());
|
|
74
|
+
watch(() => rules.value, () => validateIfError());
|
|
75
|
+
const onBlur = () => {
|
|
76
|
+
if (!props.disableBlurValidation)
|
|
77
|
+
validateRules(props.value);
|
|
78
|
+
props.onBlur?.();
|
|
79
|
+
};
|
|
80
|
+
const onUpdateValue = (newValue) => {
|
|
81
|
+
validateIfError(newValue);
|
|
82
|
+
props.onUpdateValue?.(newValue);
|
|
83
|
+
};
|
|
84
|
+
const inputSlotProps = reactive({
|
|
85
|
+
onBlur,
|
|
86
|
+
onUpdateValue,
|
|
87
|
+
error: showError,
|
|
88
|
+
});
|
|
89
|
+
const inputRef = ref();
|
|
90
|
+
const expose = {
|
|
91
|
+
validate: () => validateRules(props.value),
|
|
92
|
+
reset: () => (validationResult.value = undefined),
|
|
93
|
+
focus: () => inputRef.value?.focus(),
|
|
94
|
+
};
|
|
95
|
+
context.expose(expose);
|
|
96
|
+
props.form?.addInput(expose);
|
|
97
|
+
return () => (<div>
|
|
98
|
+
{props.input?.(inputSlotProps) || <NInput ref={inputRef} {...{ ...props, ...inputSlotProps }}/>}
|
|
99
|
+
{showErrorMessage.value && <p class="text-red-500 text-xs mt-1">{errorMessage.value}</p>}
|
|
100
|
+
</div>);
|
|
101
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ValidationResult } from '../utils/validation';
|
|
2
|
+
import type { NValInputExposed } from './NValInput';
|
|
3
|
+
/**
|
|
4
|
+
* A ValidatedForm groups different inputs together and provides functions, which operate on all inputs at the same time.
|
|
5
|
+
* With a form multiple inputs can be validated together by calling the validate function.
|
|
6
|
+
* @example
|
|
7
|
+
* const form = createValidatedForm()
|
|
8
|
+
* <NValInput ... form={form} />
|
|
9
|
+
* <NValInput ... form={form} />
|
|
10
|
+
* const onClick = () => form.validate()
|
|
11
|
+
*/
|
|
12
|
+
export type ValidatedForm = {
|
|
13
|
+
/**
|
|
14
|
+
* Adds the input to the list of this form.
|
|
15
|
+
* If this form is passed to a `<NValInput />` via the props, will add itself to this form.
|
|
16
|
+
* @example
|
|
17
|
+
* <NValInput ... form={form} />
|
|
18
|
+
*/
|
|
19
|
+
addInput(input: NValInputExposed): void;
|
|
20
|
+
/**
|
|
21
|
+
* Validates all inputs of the form. If inputs are invalid they will show it visually.
|
|
22
|
+
* The first invalid validation result is returned.
|
|
23
|
+
*/
|
|
24
|
+
validate(): ValidationResult;
|
|
25
|
+
/**
|
|
26
|
+
* Resets the validation state of all inputs.
|
|
27
|
+
*/
|
|
28
|
+
reset(): void;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new ValidatedForm.
|
|
32
|
+
* @returns the instance of the new form.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createValidatedForm(): ValidatedForm;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new ValidatedForm.
|
|
3
|
+
* @returns the instance of the new form.
|
|
4
|
+
*/
|
|
5
|
+
export function createValidatedForm() {
|
|
6
|
+
return new ValidatedFormImpl();
|
|
7
|
+
}
|
|
8
|
+
class ValidatedFormImpl {
|
|
9
|
+
inputs = [];
|
|
10
|
+
addInput(input) {
|
|
11
|
+
this.inputs.push(input);
|
|
12
|
+
}
|
|
13
|
+
validate() {
|
|
14
|
+
const results = this.inputs.map(input => input.validate());
|
|
15
|
+
// return first invalid result
|
|
16
|
+
for (const result of results)
|
|
17
|
+
if (result && !result.isValid)
|
|
18
|
+
return result;
|
|
19
|
+
// else return valid result
|
|
20
|
+
return { isValid: true };
|
|
21
|
+
}
|
|
22
|
+
reset() {
|
|
23
|
+
this.inputs.forEach(input => input.reset());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": {},
|
|
3
|
+
"subtitle": {},
|
|
4
|
+
"text": {
|
|
5
|
+
"loading-search-results": "Ergebnisse werden geladen...",
|
|
6
|
+
"no-search-results": "Keine Ergebnisse für «{input}».",
|
|
7
|
+
"drag-n-drop-files": "Datei auswählen oder per Drag & Drop hinzufügen. | Bis zu {n} Dateien auswählen oder per Drag & Drop hinzufügen.",
|
|
8
|
+
"files-selected": "Keine Datei ausgewählt. | Eine Datei ausgewählt. | {n} Dateien ausgewählt."
|
|
9
|
+
},
|
|
10
|
+
"property": {},
|
|
11
|
+
"term": {},
|
|
12
|
+
"action": {
|
|
13
|
+
"search": "Suchen",
|
|
14
|
+
"select": "Auswählen",
|
|
15
|
+
"remove": "Löschen",
|
|
16
|
+
"cancel": "Abbrechen",
|
|
17
|
+
"all-right": "Alles klar",
|
|
18
|
+
"proceed": "Fortfahren",
|
|
19
|
+
"save": "Speichern",
|
|
20
|
+
"clear-files": "Auswahl löschen."
|
|
21
|
+
},
|
|
22
|
+
"enum": {},
|
|
23
|
+
"error": {
|
|
24
|
+
"file-type": "Eine Datei wurde nicht hinzugefügt, da sie im falschen Format ist. | {n} Dateien wurden nicht hinzugefügt, da sie im falschen Format sind.",
|
|
25
|
+
"file-size": "Eine Datei wurde nicht hinzugefügt, da sie zu gross ist. | {n} Dateien wurden nicht hinzugefügt, da sie zu gross sind.",
|
|
26
|
+
"too-many-files": "Es kann nur eine Datei hinzugefügt werden. | Es können nicht mehr als {n} Dateien hinzugefügt werden."
|
|
27
|
+
},
|
|
28
|
+
"validation": {
|
|
29
|
+
"rules": {
|
|
30
|
+
"email": "Dieses Feld muss eine gültige Email-Adresse sein.",
|
|
31
|
+
"integer": "Dieses Feld muss eine Ganzzahl sein.",
|
|
32
|
+
"length": {
|
|
33
|
+
"min": "Der Text darf nicht weniger als {min} Zeichen enthalten.",
|
|
34
|
+
"max": "Der Text darf nicht mehr als {max} Zeichen enthalten.",
|
|
35
|
+
"min-max": "Der Text muss zwischen {min} und {max} Zeichen enthalten."
|
|
36
|
+
},
|
|
37
|
+
"matches": "Die Felder stimmen nicht überein.",
|
|
38
|
+
"number-range": {
|
|
39
|
+
"nan": "Dieses Feld muss eine Zahl sein.",
|
|
40
|
+
"min": "Die Zahl darf nicht kleiner als {min} sein.",
|
|
41
|
+
"max": "Die Zahl darf nicht grösser als {max} sein.",
|
|
42
|
+
"min-max": "Die Zahl muss im Bereich von {min} bis {max} liegen."
|
|
43
|
+
},
|
|
44
|
+
"option": "Dieses Feld muss eine Option aus der Liste sein.",
|
|
45
|
+
"password": {
|
|
46
|
+
"to-short": "Das Passwort muss aus mindestens 8 Zeichen bestehen.",
|
|
47
|
+
"no-lowercase": "Das Passwort muss einen Kleinbuchstaben enthalten.",
|
|
48
|
+
"no-uppercase": "Das Passwort muss einen Grossbuchstaben enthalten.",
|
|
49
|
+
"no-digits": "Das Passwort muss eine Ziffer enthalten.",
|
|
50
|
+
"no-special-chars": "Das Passwort muss ein Sonderzeichen enthalten.",
|
|
51
|
+
"unknown": "Dieses Feld erfüllt nicht die Anforderungen für ein Passwort."
|
|
52
|
+
},
|
|
53
|
+
"phone": "Dieses Feld muss eine gültige Telefonnummer sein.",
|
|
54
|
+
"required": "Dieses Feld ist ein Pflichtfeld.",
|
|
55
|
+
"regex": "Dieses Feld entspricht nicht dem geforderten Format."
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/lib/i18n/de.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
declare const de: {
|
|
2
|
+
"vue-collection": {
|
|
3
|
+
title: {};
|
|
4
|
+
subtitle: {};
|
|
5
|
+
text: {
|
|
6
|
+
"loading-search-results": string;
|
|
7
|
+
"no-search-results": string;
|
|
8
|
+
"drag-n-drop-files": string;
|
|
9
|
+
"files-selected": string;
|
|
10
|
+
};
|
|
11
|
+
property: {};
|
|
12
|
+
term: {};
|
|
13
|
+
action: {
|
|
14
|
+
search: string;
|
|
15
|
+
select: string;
|
|
16
|
+
remove: string;
|
|
17
|
+
cancel: string;
|
|
18
|
+
"all-right": string;
|
|
19
|
+
proceed: string;
|
|
20
|
+
save: string;
|
|
21
|
+
"clear-files": string;
|
|
22
|
+
};
|
|
23
|
+
enum: {};
|
|
24
|
+
error: {
|
|
25
|
+
"file-type": string;
|
|
26
|
+
"file-size": string;
|
|
27
|
+
"too-many-files": string;
|
|
28
|
+
};
|
|
29
|
+
validation: {
|
|
30
|
+
rules: {
|
|
31
|
+
email: string;
|
|
32
|
+
integer: string;
|
|
33
|
+
length: {
|
|
34
|
+
min: string;
|
|
35
|
+
max: string;
|
|
36
|
+
"min-max": string;
|
|
37
|
+
};
|
|
38
|
+
matches: string;
|
|
39
|
+
"number-range": {
|
|
40
|
+
nan: string;
|
|
41
|
+
min: string;
|
|
42
|
+
max: string;
|
|
43
|
+
"min-max": string;
|
|
44
|
+
};
|
|
45
|
+
option: string;
|
|
46
|
+
password: {
|
|
47
|
+
"to-short": string;
|
|
48
|
+
"no-lowercase": string;
|
|
49
|
+
"no-uppercase": string;
|
|
50
|
+
"no-digits": string;
|
|
51
|
+
"no-special-chars": string;
|
|
52
|
+
unknown: string;
|
|
53
|
+
};
|
|
54
|
+
phone: string;
|
|
55
|
+
required: string;
|
|
56
|
+
regex: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export default de;
|
package/lib/i18n/de.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": {},
|
|
3
|
+
"subtitle": {},
|
|
4
|
+
"text": {
|
|
5
|
+
"loading-search-results": "Loading results...",
|
|
6
|
+
"no-search-results": "No results found for «{input}».",
|
|
7
|
+
"drag-n-drop-files": "Select a file or add it by drag & drop. | Select up to {n} files or add them by drag & drop.",
|
|
8
|
+
"files-selected": "No file selected. | One file selected. | {n} files selected."
|
|
9
|
+
},
|
|
10
|
+
"property": {},
|
|
11
|
+
"term": {},
|
|
12
|
+
"action": {
|
|
13
|
+
"search": "Search",
|
|
14
|
+
"select": "Select",
|
|
15
|
+
"remove": "Delete",
|
|
16
|
+
"cancel": "Cancel",
|
|
17
|
+
"all-right": "All right",
|
|
18
|
+
"proceed": "Continue",
|
|
19
|
+
"save": "Save",
|
|
20
|
+
"clear-files": "Clear. | Clear all."
|
|
21
|
+
},
|
|
22
|
+
"enum": {},
|
|
23
|
+
"error": {
|
|
24
|
+
"file-type": "One file has not been added as it is in the wrong format. | {n} files have not been added as they are in the wrong format.",
|
|
25
|
+
"file-size": "One file has not been added as it exceeds the maximum file size. | {n} files have not been added as they exceed the maximum file size.",
|
|
26
|
+
"too-many-files": "Only one file can be added. | Can not add more than {max} files."
|
|
27
|
+
},
|
|
28
|
+
"validation": {
|
|
29
|
+
"rules": {
|
|
30
|
+
"email": "This field must be a valid email address.",
|
|
31
|
+
"integer": "This field must be an integer.",
|
|
32
|
+
"length": {
|
|
33
|
+
"min": "The text must not have less than {min} characters.",
|
|
34
|
+
"max": "The text must not have more than {max} characters.",
|
|
35
|
+
"min-max": "The text must have a length between {min} and {max} characters."
|
|
36
|
+
},
|
|
37
|
+
"matches": "The fields don't match.",
|
|
38
|
+
"number-range": {
|
|
39
|
+
"nan": "This filed must be a number.",
|
|
40
|
+
"min": "The number must not be smaller than {min}.",
|
|
41
|
+
"max": "The number must not be bigger than {max}.",
|
|
42
|
+
"min-max": "The number must be in the range from {min} to {max}."
|
|
43
|
+
},
|
|
44
|
+
"option": "This field has to be an option from the list.",
|
|
45
|
+
"password": {
|
|
46
|
+
"to-short": "The password must have at least 8 characters.",
|
|
47
|
+
"no-lowercase": "The password must contain a lowercase letter.",
|
|
48
|
+
"no-uppercase": "The password must contain an uppercase letter.",
|
|
49
|
+
"no-digits": "The password must contain a digit.",
|
|
50
|
+
"no-special-chars": "The password must contain a special character.",
|
|
51
|
+
"unknown": "This field does not match the required password format."
|
|
52
|
+
},
|
|
53
|
+
"phone": "This field must be a valid phone number.",
|
|
54
|
+
"required": "This field is required.",
|
|
55
|
+
"regex": "This field does not conform to the required format."
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/lib/i18n/en.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
declare const en: {
|
|
2
|
+
"vue-collection": {
|
|
3
|
+
title: {};
|
|
4
|
+
subtitle: {};
|
|
5
|
+
text: {
|
|
6
|
+
"loading-search-results": string;
|
|
7
|
+
"no-search-results": string;
|
|
8
|
+
"drag-n-drop-files": string;
|
|
9
|
+
"files-selected": string;
|
|
10
|
+
};
|
|
11
|
+
property: {};
|
|
12
|
+
term: {};
|
|
13
|
+
action: {
|
|
14
|
+
search: string;
|
|
15
|
+
select: string;
|
|
16
|
+
remove: string;
|
|
17
|
+
cancel: string;
|
|
18
|
+
"all-right": string;
|
|
19
|
+
proceed: string;
|
|
20
|
+
save: string;
|
|
21
|
+
"clear-files": string;
|
|
22
|
+
};
|
|
23
|
+
enum: {};
|
|
24
|
+
error: {
|
|
25
|
+
"file-type": string;
|
|
26
|
+
"file-size": string;
|
|
27
|
+
"too-many-files": string;
|
|
28
|
+
};
|
|
29
|
+
validation: {
|
|
30
|
+
rules: {
|
|
31
|
+
email: string;
|
|
32
|
+
integer: string;
|
|
33
|
+
length: {
|
|
34
|
+
min: string;
|
|
35
|
+
max: string;
|
|
36
|
+
"min-max": string;
|
|
37
|
+
};
|
|
38
|
+
matches: string;
|
|
39
|
+
"number-range": {
|
|
40
|
+
nan: string;
|
|
41
|
+
min: string;
|
|
42
|
+
max: string;
|
|
43
|
+
"min-max": string;
|
|
44
|
+
};
|
|
45
|
+
option: string;
|
|
46
|
+
password: {
|
|
47
|
+
"to-short": string;
|
|
48
|
+
"no-lowercase": string;
|
|
49
|
+
"no-uppercase": string;
|
|
50
|
+
"no-digits": string;
|
|
51
|
+
"no-special-chars": string;
|
|
52
|
+
unknown: string;
|
|
53
|
+
};
|
|
54
|
+
phone: string;
|
|
55
|
+
required: string;
|
|
56
|
+
regex: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export default en;
|
package/lib/i18n/en.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translates the specified key with the according message.
|
|
3
|
+
* @param key the key to translate.
|
|
4
|
+
* @param params formatting parameters for the message.
|
|
5
|
+
* @returns the translated message.
|
|
6
|
+
*/
|
|
7
|
+
export declare function trsl(key: string, params?: Record<string, unknown>): string;
|
|
8
|
+
/**
|
|
9
|
+
* Translates the specified key using pluralization.
|
|
10
|
+
* The provided `count`is automatically passed as the parameter `n` to the translation library.
|
|
11
|
+
* @param key the key to translate.
|
|
12
|
+
* @param count the count used for the pluralization.
|
|
13
|
+
* @param params formatting parameters for the message.
|
|
14
|
+
* @returns the translated message.
|
|
15
|
+
* @see trsl
|
|
16
|
+
*/
|
|
17
|
+
export declare function trslc(key: string, count: number | null | undefined, params?: Record<string, unknown>): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import en from './en';
|
|
2
|
+
import de from './de';
|
|
3
|
+
import { createI18n } from 'vue-i18n';
|
|
4
|
+
const i18n = createI18n({
|
|
5
|
+
legacy: false,
|
|
6
|
+
locale: 'en',
|
|
7
|
+
messages: {
|
|
8
|
+
en,
|
|
9
|
+
de,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Translates the specified key with the according message.
|
|
14
|
+
* @param key the key to translate.
|
|
15
|
+
* @param params formatting parameters for the message.
|
|
16
|
+
* @returns the translated message.
|
|
17
|
+
*/
|
|
18
|
+
export function trsl(key, params) {
|
|
19
|
+
return i18n.global.t(key, params == null ? {} : params);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Translates the specified key using pluralization.
|
|
23
|
+
* The provided `count`is automatically passed as the parameter `n` to the translation library.
|
|
24
|
+
* @param key the key to translate.
|
|
25
|
+
* @param count the count used for the pluralization.
|
|
26
|
+
* @param params formatting parameters for the message.
|
|
27
|
+
* @returns the translated message.
|
|
28
|
+
* @see trsl
|
|
29
|
+
*/
|
|
30
|
+
export function trslc(key, count, params) {
|
|
31
|
+
const newCount = count ?? 0;
|
|
32
|
+
const newParams = { n: newCount, ...params };
|
|
33
|
+
return i18n.global.t(key, newParams, { plural: newCount });
|
|
34
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import NAlert from './components/NAlert';
|
|
2
|
+
export { NAlert };
|
|
3
|
+
import NBadge from './components/NBadge';
|
|
4
|
+
export { NBadge };
|
|
5
|
+
import NBreadcrumb from './components/NBreadcrub';
|
|
6
|
+
export { NBreadcrumb };
|
|
7
|
+
import NButton from './components/NButton';
|
|
8
|
+
export { NButton };
|
|
9
|
+
import NCheckbox from './components/NCheckbox';
|
|
10
|
+
export { NCheckbox };
|
|
11
|
+
import NCheckboxLabel from './components/NCheckboxLabel';
|
|
12
|
+
export { NCheckboxLabel };
|
|
13
|
+
import NCrudModal from './components/NCrudModal';
|
|
14
|
+
export { NCrudModal };
|
|
15
|
+
import NDialog from './components/NDialog';
|
|
16
|
+
export { NDialog };
|
|
17
|
+
import NDropdown from './components/NDropdown';
|
|
18
|
+
export { NDropdown };
|
|
19
|
+
import NDropzone from './components/NDropzone';
|
|
20
|
+
export { NDropzone };
|
|
21
|
+
import NForm from './components/NForm';
|
|
22
|
+
export { NForm };
|
|
23
|
+
import NFormModal from './components/NFormModal';
|
|
24
|
+
export { NFormModal };
|
|
25
|
+
import NIconButton from './components/NIconButton';
|
|
26
|
+
export { NIconButton };
|
|
27
|
+
import NInput from './components/NInput';
|
|
28
|
+
export { NInput };
|
|
29
|
+
import NInputPhone from './components/NInputPhone';
|
|
30
|
+
export { NInputPhone };
|
|
31
|
+
import NInputSelect from './components/NInputSelect';
|
|
32
|
+
export { NInputSelect };
|
|
33
|
+
import NInputSuggestion from './components/NInputSuggestion';
|
|
34
|
+
export { NInputSuggestion };
|
|
35
|
+
import NLink from './components/NLink';
|
|
36
|
+
export { NLink };
|
|
37
|
+
import NList from './components/NList';
|
|
38
|
+
export { NList };
|
|
39
|
+
import NLoadingIndicator from './components/NLoadingIndicator';
|
|
40
|
+
export { NLoadingIndicator };
|
|
41
|
+
import NModal from './components/NModal';
|
|
42
|
+
export { NModal };
|
|
43
|
+
import NPagination from './components/NPagination';
|
|
44
|
+
export { NPagination };
|
|
45
|
+
import NSearchbar from './components/NSearchbar';
|
|
46
|
+
export { NSearchbar };
|
|
47
|
+
import NSearchbarList from './components/NSearchbarList';
|
|
48
|
+
export { NSearchbarList };
|
|
49
|
+
import NSelect from './components/NSelect';
|
|
50
|
+
export { NSelect };
|
|
51
|
+
import NSuggestionList from './components/NSuggestionList';
|
|
52
|
+
export { NSuggestionList };
|
|
53
|
+
import NTable from './components/NTable';
|
|
54
|
+
export { NTable };
|
|
55
|
+
import NTableAction from './components/NTableAction';
|
|
56
|
+
export { NTableAction };
|
|
57
|
+
import NTextArea from './components/NTextArea';
|
|
58
|
+
export { NTextArea };
|
|
59
|
+
import NTooltip from './components/NTooltip';
|
|
60
|
+
export { NTooltip };
|
|
61
|
+
import NValInput from './components/NValInput';
|
|
62
|
+
export { NValInput };
|
|
63
|
+
import { type ValidatedForm, createValidatedForm } from './components/ValidatedForm';
|
|
64
|
+
export { ValidatedForm, createValidatedForm };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// All components are directly available via the entry point
|
|
2
|
+
import NAlert from './components/NAlert';
|
|
3
|
+
export { NAlert };
|
|
4
|
+
import NBadge from './components/NBadge';
|
|
5
|
+
export { NBadge };
|
|
6
|
+
import NBreadcrumb from './components/NBreadcrub';
|
|
7
|
+
export { NBreadcrumb };
|
|
8
|
+
import NButton from './components/NButton';
|
|
9
|
+
export { NButton };
|
|
10
|
+
import NCheckbox from './components/NCheckbox';
|
|
11
|
+
export { NCheckbox };
|
|
12
|
+
import NCheckboxLabel from './components/NCheckboxLabel';
|
|
13
|
+
export { NCheckboxLabel };
|
|
14
|
+
import NCrudModal from './components/NCrudModal';
|
|
15
|
+
export { NCrudModal };
|
|
16
|
+
import NDialog from './components/NDialog';
|
|
17
|
+
export { NDialog };
|
|
18
|
+
import NDropdown from './components/NDropdown';
|
|
19
|
+
export { NDropdown };
|
|
20
|
+
import NDropzone from './components/NDropzone';
|
|
21
|
+
export { NDropzone };
|
|
22
|
+
import NForm from './components/NForm';
|
|
23
|
+
export { NForm };
|
|
24
|
+
import NFormModal from './components/NFormModal';
|
|
25
|
+
export { NFormModal };
|
|
26
|
+
import NIconButton from './components/NIconButton';
|
|
27
|
+
export { NIconButton };
|
|
28
|
+
import NInput from './components/NInput';
|
|
29
|
+
export { NInput };
|
|
30
|
+
import NInputPhone from './components/NInputPhone';
|
|
31
|
+
export { NInputPhone };
|
|
32
|
+
import NInputSelect from './components/NInputSelect';
|
|
33
|
+
export { NInputSelect };
|
|
34
|
+
import NInputSuggestion from './components/NInputSuggestion';
|
|
35
|
+
export { NInputSuggestion };
|
|
36
|
+
import NLink from './components/NLink';
|
|
37
|
+
export { NLink };
|
|
38
|
+
import NList from './components/NList';
|
|
39
|
+
export { NList };
|
|
40
|
+
import NLoadingIndicator from './components/NLoadingIndicator';
|
|
41
|
+
export { NLoadingIndicator };
|
|
42
|
+
import NModal from './components/NModal';
|
|
43
|
+
export { NModal };
|
|
44
|
+
import NPagination from './components/NPagination';
|
|
45
|
+
export { NPagination };
|
|
46
|
+
import NSearchbar from './components/NSearchbar';
|
|
47
|
+
export { NSearchbar };
|
|
48
|
+
import NSearchbarList from './components/NSearchbarList';
|
|
49
|
+
export { NSearchbarList };
|
|
50
|
+
import NSelect from './components/NSelect';
|
|
51
|
+
export { NSelect };
|
|
52
|
+
import NSuggestionList from './components/NSuggestionList';
|
|
53
|
+
export { NSuggestionList };
|
|
54
|
+
import NTable from './components/NTable';
|
|
55
|
+
export { NTable };
|
|
56
|
+
import NTableAction from './components/NTableAction';
|
|
57
|
+
export { NTableAction };
|
|
58
|
+
import NTextArea from './components/NTextArea';
|
|
59
|
+
export { NTextArea };
|
|
60
|
+
import NTooltip from './components/NTooltip';
|
|
61
|
+
export { NTooltip };
|
|
62
|
+
import NValInput from './components/NValInput';
|
|
63
|
+
export { NValInput };
|
|
64
|
+
import { createValidatedForm } from './components/ValidatedForm';
|
|
65
|
+
export { createValidatedForm };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComputedRef } from 'vue';
|
|
2
|
+
export type TWBreakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
3
|
+
export declare const breakpoints: Readonly<Record<TWBreakpoint, number>>;
|
|
4
|
+
export declare const bodyWidth: import("vue").Ref<number>;
|
|
5
|
+
/**
|
|
6
|
+
* This function has to be called once in the app two ensure that the breakpoint utilities actually update.
|
|
7
|
+
* It sets a `window.onresize` listener.
|
|
8
|
+
*/
|
|
9
|
+
export declare function addDocumentResizeEventListener(): void;
|
|
10
|
+
export declare function isWidthBreakpoint(breakpoint: TWBreakpoint): ComputedRef<boolean>;
|
|
11
|
+
export declare const isWidth2xl: ComputedRef<boolean>;
|
|
12
|
+
export declare const isWidthXl: ComputedRef<boolean>;
|
|
13
|
+
export declare const isWidthLg: ComputedRef<boolean>;
|
|
14
|
+
export declare const isWidthMd: ComputedRef<boolean>;
|
|
15
|
+
export declare const isWidthSm: ComputedRef<boolean>;
|