inertia-bootstrap-forms 1.0.0 → 1.0.3

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 (37) hide show
  1. package/README.md +46 -0
  2. package/dist/css/from-select.scss +374 -0
  3. package/index.js +49 -0
  4. package/package.json +15 -1
  5. package/{Inputs → src}/AmountInput.vue +1 -2
  6. package/{Inputs → src}/CaptchaInput.vue +11 -6
  7. package/{Inputs/CheckboxInput.vue → src/CheckboxButtonInput.vue} +21 -8
  8. package/src/CheckboxInput.vue +79 -0
  9. package/src/CheckboxToggle.vue +109 -0
  10. package/{Inputs → src}/EditorInput.vue +1 -0
  11. package/{Inputs → src}/EmailInput.vue +1 -1
  12. package/{Inputs → src}/FormContainer.vue +22 -9
  13. package/src/GroupControl.vue +67 -0
  14. package/src/MultiQuantityInput.vue +68 -0
  15. package/src/PersianDatePickerInput.vue +176 -0
  16. package/src/QuantityInput.vue +106 -0
  17. package/src/SecondarySubmitButton.vue +22 -0
  18. package/src/Select2Input.vue +190 -0
  19. package/src/StarRatingInput.vue +158 -0
  20. package/{Inputs → src}/SubmitButton.vue +4 -2
  21. package/src/TextAreaInput.vue +44 -0
  22. package/src/TextInput.vue +51 -0
  23. package/src/locationInput.vue +124 -0
  24. package/Bootstrap/InputGroup.vue +0 -9
  25. package/Bootstrap/InputGroupText.vue +0 -9
  26. package/Inputs/DatePickerInput.vue +0 -137
  27. package/Inputs/Select2Input.vue +0 -193
  28. package/Inputs/TextAreaInput.vue +0 -33
  29. package/Inputs/TextInput.vue +0 -34
  30. package/Inputs/locationInput.vue +0 -122
  31. package/vue-select.css +0 -387
  32. /package/{Inputs → src}/FileInput.vue +0 -0
  33. /package/{Inputs → src}/FormLabel.vue +0 -0
  34. /package/{Inputs → src}/MobileInput.vue +0 -0
  35. /package/{Inputs → src}/PasswordInput.vue +0 -0
  36. /package/{Inputs → src}/TelInput.vue +0 -0
  37. /package/{Inputs → src}/countryCodes.js +0 -0
@@ -1,137 +0,0 @@
1
- <script>
2
- import Vue3PersianDatetimePicker from 'vue3-persian-datetime-picker';
3
- import Icon from "@/Components/Icon.vue";
4
- import {inject} from "vue";
5
-
6
- export default {
7
- components: {Icon, Vue3PersianDatetimePicker},
8
- props: {
9
- name: {
10
- type: String,
11
- required: true,
12
- },
13
- calendar: {
14
- type: String,
15
- default: 'date',
16
- },
17
- view: {
18
- type: String,
19
- default: 'date',
20
- },
21
- min: String,
22
- max: String,
23
- format: {
24
- type: String,
25
- default: 'jYYYY-jMM-jDD',
26
- },
27
- inputFormat: {
28
- type: String,
29
- default: null,
30
- },
31
- placeholder: String,
32
- },
33
- emits: ['update:modelValue'],
34
- setup(props) {
35
- let form = inject('form');
36
-
37
- if (form === undefined) {
38
- form = {
39
- errors: {},
40
- getID(name) {
41
- }
42
- };
43
- }
44
-
45
- return {form};
46
- },
47
- methods: {
48
- clear() {
49
- if (this.form && this.form[this.name]) this.form[this.name] = null;
50
- }
51
- },
52
- computed: {
53
- isSsr() {
54
- return !window || !document;
55
- },
56
- },
57
- data() {
58
- return {}
59
- }
60
- }
61
- </script>
62
-
63
- <template>
64
- <div class="input-group">
65
- <input
66
- :name="name"
67
- :id="name+'Input'"
68
- :value="form[name]"
69
- :placeholder="(placeholder || 'انتخاب تاریخ')"
70
- :class="{'is-invalid': form.errors[name]}"
71
- :disabled="form?.processing"
72
- type="text" class="form-control form-control--datepicker text-start fanum">
73
- <button
74
- type="button"
75
- @click="clear"
76
- class="input-group-text input-group-datepicker-delete"
77
- :class="{'input-group-datepicker-delete-show': form[name]}">
78
- <Icon icon="times" library="fal"></Icon>
79
- <Icon icon="calendars" library="fal"></Icon>
80
- </button>
81
- </div>
82
- <Vue3PersianDatetimePicker
83
- :type="calendar"
84
- :view="view"
85
- :min="min"
86
- :max="max"
87
- v-if="!isSsr"
88
- jumpminute="15"
89
- :simple="false"
90
- :roundminute="true"
91
- :showNowBtn="true"
92
- :autoSubmit="true"
93
- :format="format"
94
- :inputFormat="(inputFormat ? inputFormat : format)"
95
- :displayFormat="format"
96
- v-model="form[name]"
97
- :custom-input="'#'+name+'Input'"/>
98
- </template>
99
- <style>
100
- .form-control--datepicker {
101
- direction: rtl;
102
- }
103
-
104
- .input-group-datepicker-delete {
105
- width: 42px;
106
- text-align: center;
107
- }
108
-
109
- .input-group-datepicker-delete .fa-times {
110
- display: none;
111
- }
112
-
113
- .input-group-datepicker-delete-show:hover .fa-times {
114
- display: block;
115
- }
116
-
117
- .input-group-datepicker-delete-show:hover .fa-calendars {
118
- display: none;
119
- }
120
-
121
- .vpd-content {
122
- color: var(--bs-body-color) !important;
123
- background-color: var(--bs-body-bg) !important;
124
- -moz-font-feature-settings: "ss01";
125
- -webkit-font-feature-settings: "ss01";
126
- font-feature-settings: "ss01";
127
- }
128
-
129
- .vpd-time .vpd-down-arrow-btn, .vpd-time .vpd-up-arrow-btn{
130
- text-align: center;
131
- }
132
-
133
- .vpd-time .vpd-down-arrow-btn svg,
134
- .vpd-time .vpd-up-arrow-btn svg{
135
- margin: 0 auto;
136
- }
137
- </style>
@@ -1,193 +0,0 @@
1
- <script>
2
- import '../vue-select.css';
3
- import vSelect from 'vue-select';
4
- import axios from "axios";
5
- import Icon from "@/Components/Icon.vue";
6
- import {inject} from "vue";
7
-
8
- export default {
9
- components: {Icon, vSelect},
10
- emits: ['update:modelValue', 'search', 'change', 'selected'],
11
- props: {
12
- name: {
13
- type: String,
14
- required: true,
15
- },
16
- modelValue: '',
17
- label: {
18
- type: String,
19
- default: 'name',
20
- },
21
- placeholder: {
22
- type: String,
23
- default: '-- انتخاب کنید',
24
- },
25
- multiple: {
26
- type: Boolean,
27
- default: false,
28
- },
29
- options: Array,
30
- search: {
31
- type: Object,
32
- default: {
33
- url: null,
34
- }
35
- },
36
- reduce: {
37
- type: Function,
38
- default: (item) => item.id
39
- },
40
- },
41
- computed: {
42
- allOptions() {
43
- return [
44
- ...(this.options !== undefined ? this.options : []),
45
- // ...this.selectedSearchOptions,
46
- ...this.searchOptions,
47
- ];
48
- },
49
- },
50
- watch: {
51
- 'options': function (newVal) {
52
- if (this.form && this.form[this.name] && !newVal.filter(item => item.id === this.form[this.name] || item === this.form[this.name]).length) {
53
- this.form[this.name] = null;
54
- }
55
- },
56
- },
57
- setup(props) {
58
- let form = inject('form');
59
-
60
- if (form === undefined) {
61
- form = {
62
- errors: {},
63
- getID(name) {
64
- }
65
- };
66
- }
67
-
68
- return {form};
69
- },
70
- methods: {
71
- async searchHandler(search, loading) {
72
- if (!search || search.length < 3) return;
73
-
74
- if (this.searchTimeout) {
75
- clearTimeout(this.searchTimeout);
76
- }
77
-
78
- let _this = this;
79
- this.searchTimeout = setTimeout(function () {
80
- _this.doSearch(search, loading);
81
- }, 500);
82
- },
83
- async doSearch(search, loading) {
84
- if (!this.search.url) return false;
85
-
86
- if (this.searchController) {
87
- this.searchController.abort();
88
- }
89
- this.searchController = new AbortController();
90
-
91
- loading(true);
92
- this.searchOptions = [];
93
- await axios.post(this.search.url, {
94
- query: search,
95
- }).then(res => {
96
- this.searchOptions = res.data;
97
- }).finally(() => {
98
- loading(false);
99
- });
100
- },
101
- itemsSelected(items) {
102
- this.$emit('change', items);
103
- this.$emit('selected', items);
104
- if (this.search && this.search.url && this.searchOptions && this.searchOptions.length) {
105
- this.selectedSearchOptions = items;
106
- }
107
- },
108
- input(event) {
109
- this.$emit('change', event);
110
- this.form?.handlers?.handleDomInput(event);
111
- },
112
- change(event) {
113
- this.$emit('change', event);
114
- this.form?.handlers?.handleChange(event);
115
- }
116
- },
117
- data() {
118
- return {
119
- searchTimeout: null,
120
- searchController: null,
121
- selectedSearchOptions: [],
122
- searchOptions: [],
123
- }
124
- }
125
- }
126
- </script>
127
- <template>
128
- <v-select
129
- ref="input"
130
- v-model="form[name]"
131
- @change="change"
132
- @input="input"
133
- @search="searchHandler"
134
- @option:selected="itemsSelected"
135
- @option:deselected="change"
136
- :label="label"
137
- :multiple="multiple"
138
- :options="allOptions"
139
- :disabled="form?.processing"
140
- :filterable="!search?.url"
141
- :placeholder="placeholder"
142
- class="fanum"
143
- :class="{'is-invalid': form?.errors[name]}"
144
- :reduce="reduce"
145
- :autocomplete="false"
146
- :deselectFromDropdown="true"
147
- :clearable="false">
148
- <template #no-options="{ search, searching, loading }">
149
- <span v-if="this.search?.url" class="p-2 d-block bg-body-tertiary">
150
- <Icon icon="search" class="align-middle"/>
151
- برای جستجو تایپ کنید
152
- </span>
153
- <span v-else>هیچ آیتمی پیدا نشد</span>
154
- </template>
155
- <slot/>
156
- </v-select>
157
- </template>
158
- <style>
159
- .v-select {
160
- min-width: 100px;
161
- max-width: 100%;
162
- }
163
-
164
- .v-select > ul {
165
- margin: 0 !important;
166
- padding: 0 !important;
167
- }
168
-
169
- .input-group > .v-select, .input-group > .form-floating, .input-group > .v-select {
170
- position: relative;
171
- flex: 1 1 auto;
172
- width: 1%;
173
- min-width: 0;
174
- }
175
-
176
- .input-group > .v-select:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) .vs__dropdown-toggle {
177
- margin-right: calc(var(--bs-border-width) * -1);
178
- border-top-right-radius: 0;
179
- border-bottom-right-radius: 0;
180
- }
181
-
182
- .input-group:not(.has-validation) > .dropdown-toggle:nth-last-child(n+3),
183
- .input-group:not(.has-validation) > .form-floating:not(:last-child) > .form-control,
184
- .input-group:not(.has-validation) > .form-floating:not(:last-child) > .form-select,
185
- .input-group:not(.has-validation) > .v-select:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating) .vs__dropdown-toggle {
186
- border-top-left-radius: 0;
187
- border-bottom-left-radius: 0;
188
- }
189
-
190
- .is-invalid .vs__dropdown-toggle {
191
- border-color: var(--bs-form-invalid-border-color);
192
- }
193
- </style>
@@ -1,33 +0,0 @@
1
- <script>
2
- import {inject} from "vue";
3
-
4
- export default {
5
- props: {
6
- name: {
7
- type: String,
8
- required: true,
9
- },
10
- },
11
- setup(props) {
12
- let form = inject('form');
13
-
14
- if (form === undefined) {
15
- form = {
16
- errors: {},
17
- getID(name) {
18
- }
19
- };
20
- }
21
-
22
- return {form};
23
- },
24
- }
25
- </script>
26
- <template>
27
- <textarea
28
- :name="name"
29
- v-model="form[this.name]"
30
- :class="{'is-invalid': form?.errors[name] !== undefined}"
31
- :disabled="form?.processing"
32
- class="form-control"></textarea>
33
- </template>
@@ -1,34 +0,0 @@
1
- <script>
2
- import {inject} from "vue";
3
-
4
- export default {
5
- props: {
6
- name: {
7
- type: String,
8
- required: true,
9
- },
10
- },
11
- setup(props) {
12
- let form = inject('form');
13
-
14
- if (form === undefined) {
15
- form = {
16
- errors: {},
17
- getID(name) {
18
- }
19
- };
20
- }
21
-
22
- return {form};
23
- },
24
- }
25
- </script>
26
- <template>
27
- <input
28
- :name="name"
29
- v-model="form[this.name]"
30
- :class="{'is-invalid': form?.errors[name] !== undefined}"
31
- :disabled="form?.processing"
32
- type="text"
33
- class="form-control">
34
- </template>
@@ -1,122 +0,0 @@
1
- <script>
2
- import "leaflet/dist/leaflet.css";
3
- import {LMap, LTileLayer, LMarker} from "@vue-leaflet/vue-leaflet";
4
- import {inject} from "vue";
5
-
6
- export default {
7
- components: {
8
- LMap, LTileLayer, LMarker
9
- },
10
- props: {
11
- name: {
12
- type: String,
13
- default: 'location',
14
- required: false,
15
- },
16
- disabled: {
17
- type: [Boolean, String],
18
- default: false,
19
- },
20
- modelValue: Object,
21
- },
22
- setup(props) {
23
- let form = inject('form');
24
-
25
- if (form === undefined) {
26
- form = {
27
- errors: {},
28
- zoom: 8,
29
- center: [47.41322, -1.219482],
30
- getID(name) {
31
- }
32
- };
33
- }
34
-
35
- return {form};
36
- },
37
- methods: {
38
- setMarker(event) {
39
- this.marker = {
40
- lat: event?.latlng?.lat || event?.target?._latlng?.lat,
41
- lng: event?.latlng?.lng || event?.target?._latlng?.lng,
42
- };
43
-
44
- this.$emit('update:modelValue', this.marker);
45
- this.form[this.name] = this.marker;
46
- }
47
- },
48
- data() {
49
- return {
50
- zoom: 13,
51
- marker: {
52
- lat: this.modelValue?.lat || this.form[this.name]?.lat || null,
53
- lng: this.modelValue?.lng || this.form[this.name]?.lng || null,
54
- },
55
- center: {
56
- lat: this.modelValue?.lat || this.form[this.name]?.lat || 35.69293,
57
- lng: this.modelValue?.lng || this.form[this.name]?.lng || 51.36372,
58
- },
59
- };
60
- },
61
-
62
- }
63
- </script>
64
- <template>
65
- <div class="location-map-container" :class="{disabled: disabled || form.processing, 'is-invalid': form?.errors[name] !== undefined}">
66
- <l-map ref="map" v-model:zoom="zoom" :useGlobalLeaflet="false" :center="this.center" @click="setMarker">
67
- <l-tile-layer
68
- url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
69
- layer-type="base"
70
- name="OpenStreetMap"
71
- ></l-tile-layer>
72
- <LMarker :lat-lng="marker" v-if="marker" :draggable="true" @dragend="setMarker"/>
73
- </l-map>
74
- </div>
75
- </template>
76
- <style>
77
- .location-map-container {
78
- position: relative;
79
- width: 100%;
80
- height: 300px;
81
- overflow: hidden;
82
- border-radius: var(--bs-border-radius);
83
- }
84
-
85
- .location-map-container.is-invalid {
86
- border: 1px solid var(--bs-form-invalid-border-color);
87
- }
88
-
89
- .location-map-container[disabled],
90
- .location-map-container.disabled:before {
91
- content: "";
92
- background-color: rgba(var(--bs-light-rgb), 0.4);
93
- display: block;
94
- position: absolute;
95
- top: 0;
96
- right: 0;
97
- left: 0;
98
- bottom: 0;
99
- z-index: 9999;
100
- }
101
-
102
- .location-map-container {
103
- .leaflet-pane,
104
- .leaflet-tile,
105
- .leaflet-marker-icon,
106
- .leaflet-marker-shadow,
107
- .leaflet-tile-container,
108
- .leaflet-pane > svg,
109
- .leaflet-pane > canvas,
110
- .leaflet-zoom-box,
111
- .leaflet-image-layer,
112
- .leaflet-layer {
113
- left: auto;
114
- right: 0;
115
- }
116
-
117
- .leaflet-control-attribution.leaflet-control {
118
- display: none;
119
- }
120
- }
121
-
122
- </style>