bootstrap-vue-wrapper 1.11.2 → 2.0.0
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/CHANGELOG.md +83 -0
- package/README.md +2 -45
- package/dist/bootstrap-vue-wrapper.mjs +7403 -0
- package/dist/bootstrap-vue-wrapper.umd.js +25 -0
- package/dist/components/bs-breadcrumb/BsBreadcrumb.vue.d.ts +33 -0
- package/dist/components/bs-checkbox/BsCheckbox.vue.d.ts +141 -0
- package/dist/components/bs-form/BsForm.vue.d.ts +13 -0
- package/dist/components/bs-input/BsInput.vue.d.ts +106 -0
- package/dist/components/bs-modal/BsModal.vue.d.ts +71 -0
- package/dist/components/bs-offcanvas/BsOffcanvas.vue.d.ts +34 -0
- package/dist/components/bs-paginator/BsPaginator.vue.d.ts +157 -0
- package/dist/components/bs-radio/BsRadio.vue.d.ts +139 -0
- package/dist/components/bs-select/BsSelect.vue.d.ts +139 -0
- package/dist/components/bs-table/BsTable.vue.d.ts +150 -0
- package/dist/components/bs-textarea/BsTextarea.vue.d.ts +106 -0
- package/dist/components/bs-toast/BsToast.vue.d.ts +18 -0
- package/dist/components/validator/Validator.d.ts +6 -0
- package/dist/index.d.ts +13 -0
- package/dist/style.css +1 -0
- package/package.json +53 -26
- package/src/.DS_Store +0 -0
- package/src/components/bs-breadcrumb/BsBreadcrumb.vue +0 -45
- package/src/components/bs-checkbox/BsCheckbox.vue +0 -148
- package/src/components/bs-form/BsForm.vue +0 -37
- package/src/components/bs-input/BsInput.vue +0 -92
- package/src/components/bs-modal/BsModal.vue +0 -90
- package/src/components/bs-offcanvas/BsOffcanvas.vue +0 -67
- package/src/components/bs-paginator/BsPaginator.vue +0 -215
- package/src/components/bs-radio/BsRadio.vue +0 -118
- package/src/components/bs-select/BsSelect.vue +0 -122
- package/src/components/bs-table/BsTable.vue +0 -202
- package/src/components/bs-textarea/BsTextarea.vue +0 -92
- package/src/components/bs-toast/BsToast.vue +0 -23
- package/src/index.js +0 -29
- package/src/mixins/validator.js +0 -107
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
interface Field {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
sort?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("vue").DefineComponent<{
|
|
8
|
+
/**
|
|
9
|
+
* Field list
|
|
10
|
+
*/
|
|
11
|
+
fields: {
|
|
12
|
+
type: PropType<Field[]>;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Item list
|
|
17
|
+
*/
|
|
18
|
+
items: {
|
|
19
|
+
type: ArrayConstructor;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Items is loading
|
|
24
|
+
*/
|
|
25
|
+
isLoading: {
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
default: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Order by field name
|
|
31
|
+
*/
|
|
32
|
+
orderBy: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Sort is descending or ascending
|
|
38
|
+
*/
|
|
39
|
+
sortDesc: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* th element css lass
|
|
45
|
+
*/
|
|
46
|
+
thClass: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
default: undefined;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* td element css class
|
|
52
|
+
*/
|
|
53
|
+
tdClass: {
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
}, unknown, unknown, {}, {
|
|
58
|
+
/**
|
|
59
|
+
* Is order by active by field?
|
|
60
|
+
*
|
|
61
|
+
* @param field
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
isActiveOrderBy(field: any): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Is field sortable?
|
|
67
|
+
*
|
|
68
|
+
* @param field
|
|
69
|
+
* @returns {boolean}
|
|
70
|
+
*/
|
|
71
|
+
isSortableField(field: any): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Sort icon class.
|
|
74
|
+
*
|
|
75
|
+
* @returns {string}
|
|
76
|
+
*/
|
|
77
|
+
getSortIconClass(): string;
|
|
78
|
+
/**
|
|
79
|
+
* Calcuate sort desc value on click
|
|
80
|
+
* Returns null if there is no sortDesc value.
|
|
81
|
+
*/
|
|
82
|
+
calcSortDesc(field: any): boolean | null;
|
|
83
|
+
/**
|
|
84
|
+
* Is order by changed?
|
|
85
|
+
*/
|
|
86
|
+
isOrderByChanged(field: any): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Table head clicked.
|
|
89
|
+
*/
|
|
90
|
+
onHeadClick(field: any): void;
|
|
91
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "orderChanged"[], "orderChanged", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
92
|
+
/**
|
|
93
|
+
* Field list
|
|
94
|
+
*/
|
|
95
|
+
fields: {
|
|
96
|
+
type: PropType<Field[]>;
|
|
97
|
+
required: true;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Item list
|
|
101
|
+
*/
|
|
102
|
+
items: {
|
|
103
|
+
type: ArrayConstructor;
|
|
104
|
+
required: true;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Items is loading
|
|
108
|
+
*/
|
|
109
|
+
isLoading: {
|
|
110
|
+
type: BooleanConstructor;
|
|
111
|
+
default: boolean;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Order by field name
|
|
115
|
+
*/
|
|
116
|
+
orderBy: {
|
|
117
|
+
type: StringConstructor;
|
|
118
|
+
default: undefined;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Sort is descending or ascending
|
|
122
|
+
*/
|
|
123
|
+
sortDesc: {
|
|
124
|
+
type: BooleanConstructor;
|
|
125
|
+
default: undefined;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* th element css lass
|
|
129
|
+
*/
|
|
130
|
+
thClass: {
|
|
131
|
+
type: StringConstructor;
|
|
132
|
+
default: undefined;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* td element css class
|
|
136
|
+
*/
|
|
137
|
+
tdClass: {
|
|
138
|
+
type: StringConstructor;
|
|
139
|
+
default: undefined;
|
|
140
|
+
};
|
|
141
|
+
}>> & {
|
|
142
|
+
onOrderChanged?: ((...args: any[]) => any) | undefined;
|
|
143
|
+
}, {
|
|
144
|
+
isLoading: boolean;
|
|
145
|
+
orderBy: string;
|
|
146
|
+
sortDesc: boolean;
|
|
147
|
+
thClass: string;
|
|
148
|
+
tdClass: string;
|
|
149
|
+
}, {}>;
|
|
150
|
+
export default _default;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
/**
|
|
4
|
+
* Value for v-model
|
|
5
|
+
*/
|
|
6
|
+
modelValue: {
|
|
7
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
8
|
+
default: null;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Html id
|
|
12
|
+
*/
|
|
13
|
+
id: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Label for textarea
|
|
19
|
+
*/
|
|
20
|
+
label: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Attribute hint
|
|
26
|
+
*/
|
|
27
|
+
hint: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Enable or disable validator
|
|
33
|
+
*/
|
|
34
|
+
validatorEnabled: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
inputRef: Ref<HTMLInputElement | null>;
|
|
40
|
+
validator: {
|
|
41
|
+
onInvalid: (event: InputEvent) => void;
|
|
42
|
+
getInvalidMessage: () => string | null;
|
|
43
|
+
setCustomError: (data: string) => void;
|
|
44
|
+
};
|
|
45
|
+
}, unknown, {}, {
|
|
46
|
+
/**
|
|
47
|
+
* Hint id is generated
|
|
48
|
+
*/
|
|
49
|
+
getHintId(): string;
|
|
50
|
+
/**
|
|
51
|
+
* On input event
|
|
52
|
+
*
|
|
53
|
+
* @param event
|
|
54
|
+
*/
|
|
55
|
+
onInput(event: InputEvent): void;
|
|
56
|
+
/**
|
|
57
|
+
* On invalid event
|
|
58
|
+
*
|
|
59
|
+
* @param event
|
|
60
|
+
*/
|
|
61
|
+
onInvalid(event: InputEvent): void;
|
|
62
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
|
+
/**
|
|
64
|
+
* Value for v-model
|
|
65
|
+
*/
|
|
66
|
+
modelValue: {
|
|
67
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
68
|
+
default: null;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Html id
|
|
72
|
+
*/
|
|
73
|
+
id: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
required: true;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Label for textarea
|
|
79
|
+
*/
|
|
80
|
+
label: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Attribute hint
|
|
86
|
+
*/
|
|
87
|
+
hint: {
|
|
88
|
+
type: StringConstructor;
|
|
89
|
+
default: undefined;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Enable or disable validator
|
|
93
|
+
*/
|
|
94
|
+
validatorEnabled: {
|
|
95
|
+
type: BooleanConstructor;
|
|
96
|
+
default: boolean;
|
|
97
|
+
};
|
|
98
|
+
}>> & {
|
|
99
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
100
|
+
}, {
|
|
101
|
+
label: string;
|
|
102
|
+
modelValue: string | number;
|
|
103
|
+
hint: string;
|
|
104
|
+
validatorEnabled: boolean;
|
|
105
|
+
}, {}>;
|
|
106
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {
|
|
2
|
+
/**
|
|
3
|
+
* Trigger toast hide event.
|
|
4
|
+
*/
|
|
5
|
+
hide(): void;
|
|
6
|
+
/**
|
|
7
|
+
* Hidden event.
|
|
8
|
+
*/
|
|
9
|
+
onShown(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Hidden event.
|
|
12
|
+
*/
|
|
13
|
+
onHidden(): void;
|
|
14
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("hidden" | "shown")[], "hidden" | "shown", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
|
|
15
|
+
onHidden?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
onShown?: ((...args: any[]) => any) | undefined;
|
|
17
|
+
}, {}, {}>;
|
|
18
|
+
export default _default;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import BsBreadcrumb from './components/bs-breadcrumb/BsBreadcrumb.vue';
|
|
2
|
+
import BsForm from './components/bs-form/BsForm.vue';
|
|
3
|
+
import BsInput from './components/bs-input/BsInput.vue';
|
|
4
|
+
import BsCheckbox from './components/bs-checkbox/BsCheckbox.vue';
|
|
5
|
+
import BsTextarea from './components/bs-textarea/BsTextarea.vue';
|
|
6
|
+
import BsPaginator from './components/bs-paginator/BsPaginator.vue';
|
|
7
|
+
import BsTable from './components/bs-table/BsTable.vue';
|
|
8
|
+
import BsToast from './components/bs-toast/BsToast.vue';
|
|
9
|
+
import BsModal from './components/bs-modal/BsModal.vue';
|
|
10
|
+
import BsSelect from './components/bs-select/BsSelect.vue';
|
|
11
|
+
import BsRadio from './components/bs-radio/BsRadio.vue';
|
|
12
|
+
import BsOffcanvas from './components/bs-offcanvas/BsOffcanvas.vue';
|
|
13
|
+
export { BsBreadcrumb, BsForm, BsInput, BsCheckbox, BsTextarea, BsPaginator, BsTable, BsToast, BsModal, BsSelect, BsRadio, BsOffcanvas, };
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.page-link[data-v-ff85ae67]{cursor:pointer}.page-item-first[data-v-ff85ae67],.page-item-last[data-v-ff85ae67],.page-item-number[data-v-ff85ae67]:not(.active){display:none}@media (min-width: 576px){.page-item-number[data-v-ff85ae67]:not(.active){display:block}}@media (min-width: 992px){.page-item-first[data-v-ff85ae67],.page-item-last[data-v-ff85ae67]{display:block}}.cursor-pointer[data-v-e8d4b4dc]{cursor:pointer}
|
package/package.json
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bootstrap-vue-wrapper",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Bootstrap 5 components in Vue3
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"main": "src/index.js",
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"bootstrap": "^5.1.0",
|
|
16
|
-
"vue": "^3.2.0",
|
|
17
|
-
"vue-router": "^4.0.0"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"eslint": "^8.8.0",
|
|
21
|
-
"eslint-config-standard": "^16.0.3",
|
|
22
|
-
"eslint-plugin-import": "^2.25.4",
|
|
23
|
-
"eslint-plugin-node": "^11.1.0",
|
|
24
|
-
"eslint-plugin-promise": "^6.0.0",
|
|
25
|
-
"eslint-plugin-vue": "^8.4.1"
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Bootstrap 5 components in Vue3 wrapper.",
|
|
5
|
+
"main": "./dist/bootstrap-vue-wrapper.umd.js",
|
|
6
|
+
"module": "./dist/bootstrap-vue-wrapper.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/bootstrap-vue-wrapper.mjs",
|
|
11
|
+
"require": "./dist/bootstrap-vue-wrapper.umd.js"
|
|
12
|
+
}
|
|
26
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
27
17
|
"scripts": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
18
|
+
"build": "vite build",
|
|
19
|
+
"dev": "vite",
|
|
20
|
+
"serve": "vite preview",
|
|
21
|
+
"eslint": "eslint '{**/*,*}.{js,ts,jsx,tsx,vue}' --cache",
|
|
22
|
+
"eslint:fix": "eslint '{**/*,*}.{js,ts,jsx,tsx,vue}' --fix"
|
|
30
23
|
},
|
|
31
24
|
"keywords": [
|
|
32
25
|
"bootstrap",
|
|
@@ -36,5 +29,39 @@
|
|
|
36
29
|
"bootstrap-vue",
|
|
37
30
|
"bootstrap wrapper",
|
|
38
31
|
"vuejs"
|
|
39
|
-
]
|
|
32
|
+
],
|
|
33
|
+
"author": "Gabor Zemko <gaborzemko@gmail.com>",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@popperjs/core": "^2.0.0",
|
|
36
|
+
"bootstrap": "^5.1.0",
|
|
37
|
+
"bootstrap-icons": "^1.0.0",
|
|
38
|
+
"sass": "^1.70.0",
|
|
39
|
+
"vue": "^3.0.0",
|
|
40
|
+
"vue-i18n": "^9.0.0",
|
|
41
|
+
"vue-router": "^4.0.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@popperjs/core": "^2.11.8",
|
|
45
|
+
"@types/bootstrap": "^5.2.10",
|
|
46
|
+
"@types/node": "^20.11.7",
|
|
47
|
+
"@vitejs/plugin-vue": "^4.5.2",
|
|
48
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
49
|
+
"bootstrap": "^5.3.2",
|
|
50
|
+
"bootstrap-icons": "^1.11.3",
|
|
51
|
+
"eslint": "^8.56.0",
|
|
52
|
+
"eslint-config-standard": "^17.1.0",
|
|
53
|
+
"eslint-plugin-import": "^2.29.1",
|
|
54
|
+
"eslint-plugin-n": "^16.6.2",
|
|
55
|
+
"eslint-plugin-node": "^11.1.0",
|
|
56
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
57
|
+
"eslint-plugin-vue": "^9.20.1",
|
|
58
|
+
"sass": "^1.70.0",
|
|
59
|
+
"typescript": "^5.2.2",
|
|
60
|
+
"vite": "^5.0.8",
|
|
61
|
+
"vite-plugin-dts": "^3.7.2",
|
|
62
|
+
"vue": "^3.3.11",
|
|
63
|
+
"vue-i18n": "^9.9.0",
|
|
64
|
+
"vue-router": "^4.2.5",
|
|
65
|
+
"vue-tsc": "^1.8.25"
|
|
66
|
+
}
|
|
40
67
|
}
|
package/src/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav aria-label="breadcrumb">
|
|
3
|
-
<ol class="breadcrumb">
|
|
4
|
-
<li
|
|
5
|
-
v-for="(item, index) in items"
|
|
6
|
-
:key="index"
|
|
7
|
-
class="breadcrumb-item"
|
|
8
|
-
:class="{ active: !isRouteAvailable(item)}"
|
|
9
|
-
>
|
|
10
|
-
<router-link
|
|
11
|
-
v-if="isRouteAvailable(item)"
|
|
12
|
-
:to="item.route"
|
|
13
|
-
v-text="item.title"
|
|
14
|
-
/>
|
|
15
|
-
<span v-else v-text="item.title" />
|
|
16
|
-
</li>
|
|
17
|
-
</ol>
|
|
18
|
-
</nav>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
export default {
|
|
23
|
-
name: 'BsBreadcrumb',
|
|
24
|
-
props: {
|
|
25
|
-
/**
|
|
26
|
-
* List of breadcrumb items.
|
|
27
|
-
*/
|
|
28
|
-
items: {
|
|
29
|
-
type: Array,
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
methods: {
|
|
34
|
-
/**
|
|
35
|
-
* Is route available
|
|
36
|
-
*
|
|
37
|
-
* @param item
|
|
38
|
-
* @returns {boolean}
|
|
39
|
-
*/
|
|
40
|
-
isRouteAvailable(item) {
|
|
41
|
-
return item.route
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
}
|
|
45
|
-
</script>
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="form-check" :class="classContainer">
|
|
3
|
-
<input
|
|
4
|
-
:id="id"
|
|
5
|
-
ref="inputRef"
|
|
6
|
-
:value="modelValue"
|
|
7
|
-
v-bind="$attrs"
|
|
8
|
-
type="checkbox"
|
|
9
|
-
class="form-check-input"
|
|
10
|
-
:checked="isChecked"
|
|
11
|
-
:aria-describedby="hint !== null ? getHintId() : null"
|
|
12
|
-
@input="onInput"
|
|
13
|
-
@invalid="onInvalid"
|
|
14
|
-
>
|
|
15
|
-
<label
|
|
16
|
-
v-if="label !== null"
|
|
17
|
-
:for="id"
|
|
18
|
-
class="form-check-label"
|
|
19
|
-
v-text="label"
|
|
20
|
-
/>
|
|
21
|
-
<div
|
|
22
|
-
v-if="invalidMessage !== null && !hideValidationMessage"
|
|
23
|
-
class="invalid-feedback"
|
|
24
|
-
v-text="invalidMessage"
|
|
25
|
-
/>
|
|
26
|
-
<div
|
|
27
|
-
v-if="hint !== null"
|
|
28
|
-
:id="getHintId()"
|
|
29
|
-
class="form-text"
|
|
30
|
-
v-text="hint"
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script>
|
|
36
|
-
import validator from '../../mixins/validator.js'
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
name: 'BsCheckbox',
|
|
40
|
-
mixins: [validator],
|
|
41
|
-
props: {
|
|
42
|
-
/**
|
|
43
|
-
* Value for checkbox if v-model is array.
|
|
44
|
-
*/
|
|
45
|
-
value: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: null,
|
|
48
|
-
},
|
|
49
|
-
/**
|
|
50
|
-
* Value for v-model
|
|
51
|
-
*/
|
|
52
|
-
modelValue: {
|
|
53
|
-
type: [Array, Boolean],
|
|
54
|
-
default: null,
|
|
55
|
-
},
|
|
56
|
-
/**
|
|
57
|
-
* Html id
|
|
58
|
-
*/
|
|
59
|
-
id: {
|
|
60
|
-
type: String,
|
|
61
|
-
required: true,
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
* Label for input
|
|
65
|
-
*/
|
|
66
|
-
label: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: null,
|
|
69
|
-
},
|
|
70
|
-
/**
|
|
71
|
-
* Attribute hint
|
|
72
|
-
*/
|
|
73
|
-
hint: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: null,
|
|
76
|
-
},
|
|
77
|
-
/**
|
|
78
|
-
* True value
|
|
79
|
-
*/
|
|
80
|
-
trueValue: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
default: true,
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* False value
|
|
86
|
-
*/
|
|
87
|
-
falseValue: {
|
|
88
|
-
type: Boolean,
|
|
89
|
-
default: false,
|
|
90
|
-
},
|
|
91
|
-
/**
|
|
92
|
-
* Input container div class.
|
|
93
|
-
*/
|
|
94
|
-
classContainer: {
|
|
95
|
-
type: String,
|
|
96
|
-
default: null,
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* If this is true the validation message does not appear.
|
|
100
|
-
*/
|
|
101
|
-
hideValidationMessage: {
|
|
102
|
-
type: Boolean,
|
|
103
|
-
default: false,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
emits: ['update:modelValue'],
|
|
107
|
-
computed: {
|
|
108
|
-
/**
|
|
109
|
-
* Checkbox is checked or not.
|
|
110
|
-
*/
|
|
111
|
-
isChecked() {
|
|
112
|
-
if (this.modelValue instanceof Array) {
|
|
113
|
-
return this.modelValue.includes(this.value)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return this.modelValue === this.trueValue
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
methods: {
|
|
120
|
-
/**
|
|
121
|
-
* Hint id is generated
|
|
122
|
-
*/
|
|
123
|
-
getHintId() {
|
|
124
|
-
return this.id + 'Hint'
|
|
125
|
-
},
|
|
126
|
-
/**
|
|
127
|
-
* On input event
|
|
128
|
-
*
|
|
129
|
-
* @param event
|
|
130
|
-
*/
|
|
131
|
-
onInput(event) {
|
|
132
|
-
const isChecked = event.target.checked
|
|
133
|
-
|
|
134
|
-
if (this.modelValue instanceof Array) {
|
|
135
|
-
const newValue = [...this.modelValue]
|
|
136
|
-
if (isChecked) {
|
|
137
|
-
newValue.push(this.value)
|
|
138
|
-
} else {
|
|
139
|
-
newValue.splice(newValue.indexOf(this.value), 1)
|
|
140
|
-
}
|
|
141
|
-
this.$emit('update:modelValue', newValue)
|
|
142
|
-
} else {
|
|
143
|
-
this.$emit('update:modelValue', isChecked ? this.trueValue : this.falseValue)
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
}
|
|
148
|
-
</script>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<form
|
|
3
|
-
class="needs-validation"
|
|
4
|
-
:class="{
|
|
5
|
-
'was-validated': submitClicked,
|
|
6
|
-
}"
|
|
7
|
-
novalidate
|
|
8
|
-
@submit="onSubmit"
|
|
9
|
-
>
|
|
10
|
-
<slot />
|
|
11
|
-
</form>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
export default {
|
|
16
|
-
name: 'BsForm',
|
|
17
|
-
emits: ['submit'],
|
|
18
|
-
data() {
|
|
19
|
-
return {
|
|
20
|
-
submitClicked: false,
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
methods: {
|
|
24
|
-
/**
|
|
25
|
-
* On submit event.
|
|
26
|
-
*
|
|
27
|
-
* @param event
|
|
28
|
-
*/
|
|
29
|
-
onSubmit(event) {
|
|
30
|
-
event.preventDefault()
|
|
31
|
-
this.submitClicked = true
|
|
32
|
-
|
|
33
|
-
this.$emit('submit', event)
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
</script>
|