inertia-bootstrap-forms 1.0.44 → 1.0.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inertia-bootstrap-forms",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "description": "Create bootstrap forms with inertia and twitter bootstrap",
5
5
  "main": "dist/inertia-bootstrap-forms.cjs.js",
6
6
  "module": "dist/inertia-bootstrap-forms.es.js",
@@ -2,175 +2,186 @@
2
2
  import Vue3PersianDatetimePicker from 'vue3-persian-datetime-picker';
3
3
  import {computed, defineComponent, inject} from "vue";
4
4
 
5
+ let _this;
5
6
  export default defineComponent({
6
- components: {Vue3PersianDatetimePicker},
7
- props: {
8
- name: {
9
- type: String,
10
- required: true,
11
- },
12
- calendar: {
13
- type: String,
14
- default: 'date',
15
- },
16
- view: {
17
- type: String,
18
- default: 'date',
19
- },
20
- min: String,
21
- max: String,
22
- range: Boolean,
23
- locale: {
24
- default: 'fa',
25
- },
26
- format: {
27
- type: String,
28
- default: 'jYYYY-jMM-jDD',
29
- },
30
- inputFormat: {
31
- type: String,
32
- default: null,
33
- },
34
- placeholder: String,
7
+ components: {Vue3PersianDatetimePicker},
8
+ emits: ['update:modelValue', 'change'],
9
+ props: {
10
+ name: {
11
+ type: String,
12
+ required: true,
35
13
  },
36
- emits: ['update:modelValue'],
37
- setup(props) {
38
- let form = inject('form', {
39
- errors: {},
40
- getID(name) {
41
- return name;
42
- }
43
- });
44
- let group = inject('group', {});
45
-
46
- const modelValue = computed({
47
- get() {
48
- return (group.value && form.value[group.value.name]) ? group.value?.getData(props.name) : form.value[props.name];
49
- },
50
- set(value) {
51
- if (group?.value?.name) {
52
- group.value.setData(props.name, value);
53
- } else {
54
- form.value[props.name] = value;
55
- }
56
- }
57
- });
58
-
59
- return {modelValue, form, group};
14
+ calendar: {
15
+ type: String,
16
+ default: 'date',
60
17
  },
61
- methods: {
62
- clear() {
63
- this.modelValue = null;
64
- }
18
+ view: {
19
+ type: String,
20
+ default: 'date',
21
+ },
22
+ min: String,
23
+ max: String,
24
+ range: Boolean,
25
+ locale: {
26
+ default: 'fa',
27
+ },
28
+ format: {
29
+ type: String,
30
+ default: 'jYYYY-jMM-jDD',
65
31
  },
66
- computed: {
67
- isSsr() {
68
- return !window || !document;
69
- },
70
- inputID() {
71
- return this.form.getID(this)
32
+ inputFormat: {
33
+ type: String,
34
+ default: null,
35
+ },
36
+ placeholder: String,
37
+ },
38
+ setup(props) {
39
+ let form = inject('form', {
40
+ errors: {},
41
+ getID(name) {
42
+ return name;
43
+ }
44
+ });
45
+ let group = inject('group', {});
46
+
47
+ const modelValue = computed({
48
+ get() {
49
+ return (group.value && form.value[group.value.name]) ? group.value?.getData(props.name) : form.value[props.name];
50
+ },
51
+ set(value) {
52
+ if (group?.value?.name) {
53
+ group.value.setData(props.name, value);
54
+ } else {
55
+ form.value[props.name] = value;
72
56
  }
57
+ }
58
+ });
59
+
60
+ return {modelValue, form, group};
61
+ },
62
+ watch: {
63
+ modelValue: (newVal, oldVal) => {
64
+ _this?.$emit('change', newVal, oldVal);
65
+ }
66
+ },
67
+ methods: {
68
+ clear() {
69
+ this.modelValue = null;
70
+ },
71
+ },
72
+ mounted() {
73
+ _this = this;
74
+ },
75
+ computed: {
76
+ isSsr() {
77
+ return !window || !document;
73
78
  },
74
- data() {
75
- return {}
79
+ inputID() {
80
+ return this.form.getID(this)
76
81
  }
82
+ },
83
+ data() {
84
+ return {}
85
+ }
77
86
  })
78
87
  </script>
79
88
 
80
89
  <template>
81
- <div class="input-group">
82
- <input
83
- :name="name"
84
- :id="inputID"
85
- :value="modelValue"
86
- :placeholder="(placeholder || 'انتخاب تاریخ')"
87
- :class="{'is-invalid': form.errors[name]}"
88
- :disabled="form?.processing"
89
- type="text" class="form-control form-control--datepicker text-start fanum">
90
- <button
91
- type="button"
92
- @click="clear"
93
- class="input-group-text input-group-datepicker-delete"
94
- :class="{'input-group-datepicker-delete-show': modelValue}">
95
- <svg width="25px" height="25px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
96
- <path d="M14 22H10C6.22876 22 4.34315 22 3.17157 20.8284C2 19.6569 2 17.7712 2 14V12C2 8.22876 2 6.34315 3.17157 5.17157C4.34315 4 6.22876 4 10 4H14C17.7712 4 19.6569 4 20.8284 5.17157C22 6.34315 22 8.22876 22 12V14C22 17.7712 22 19.6569 20.8284 20.8284C20.1752 21.4816 19.3001 21.7706 18 21.8985" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
97
- <path d="M7 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
98
- <path d="M17 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
99
- <path d="M21.5 9H16.625H10.75M2 9H5.875" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
100
- <path d="M18 17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17C16 16.4477 16.4477 16 17 16C17.5523 16 18 16.4477 18 17Z" fill="#1C274C"/>
101
- <path d="M18 13C18 13.5523 17.5523 14 17 14C16.4477 14 16 13.5523 16 13C16 12.4477 16.4477 12 17 12C17.5523 12 18 12.4477 18 13Z" fill="#1C274C"/>
102
- <path d="M13 17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17C11 16.4477 11.4477 16 12 16C12.5523 16 13 16.4477 13 17Z" fill="#1C274C"/>
103
- <path d="M13 13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13C11 12.4477 11.4477 12 12 12C12.5523 12 13 12.4477 13 13Z" fill="#1C274C"/>
104
- <path d="M8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16C7.55228 16 8 16.4477 8 17Z" fill="#1C274C"/>
105
- <path d="M8 13C8 13.5523 7.55228 14 7 14C6.44772 14 6 13.5523 6 13C6 12.4477 6.44772 12 7 12C7.55228 12 8 12.4477 8 13Z" fill="#1C274C"/>
106
- </svg>
107
- </button>
108
- </div>
109
- <Vue3PersianDatetimePicker
110
- :type="calendar"
111
- :view="view"
112
- :min="min"
113
- :max="max"
114
- v-if="!isSsr"
115
- jumpminute="15"
116
- :range="range"
117
- :locale="locale"
118
- :simple="false"
119
- :roundminute="true"
120
- :showNowBtn="true"
121
- :autoSubmit="true"
122
- :format="format"
123
- :inputFormat="(inputFormat ? inputFormat : format)"
124
- :displayFormat="format"
125
- v-model="modelValue"
126
- :custom-input="'#'+inputID"/>
90
+ <div class="input-group">
91
+ <input
92
+ :name="name"
93
+ :id="inputID"
94
+ :value="modelValue"
95
+ :placeholder="(placeholder || 'انتخاب تاریخ')"
96
+ :class="{'is-invalid': form.errors[name]}"
97
+ :disabled="form?.processing"
98
+ type="text" class="form-control form-control--datepicker text-start fanum">
99
+ <button
100
+ type="button"
101
+ @click="clear"
102
+ class="input-group-text input-group-datepicker-delete"
103
+ :class="{'input-group-datepicker-delete-show': modelValue}">
104
+ <svg width="25px" height="25px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
105
+ <path
106
+ d="M14 22H10C6.22876 22 4.34315 22 3.17157 20.8284C2 19.6569 2 17.7712 2 14V12C2 8.22876 2 6.34315 3.17157 5.17157C4.34315 4 6.22876 4 10 4H14C17.7712 4 19.6569 4 20.8284 5.17157C22 6.34315 22 8.22876 22 12V14C22 17.7712 22 19.6569 20.8284 20.8284C20.1752 21.4816 19.3001 21.7706 18 21.8985"
107
+ stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
108
+ <path d="M7 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
109
+ <path d="M17 4V2.5" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
110
+ <path d="M21.5 9H16.625H10.75M2 9H5.875" stroke="#1C274C" stroke-width="1.5" stroke-linecap="round"/>
111
+ <path d="M18 17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17C16 16.4477 16.4477 16 17 16C17.5523 16 18 16.4477 18 17Z" fill="#1C274C"/>
112
+ <path d="M18 13C18 13.5523 17.5523 14 17 14C16.4477 14 16 13.5523 16 13C16 12.4477 16.4477 12 17 12C17.5523 12 18 12.4477 18 13Z" fill="#1C274C"/>
113
+ <path d="M13 17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17C11 16.4477 11.4477 16 12 16C12.5523 16 13 16.4477 13 17Z" fill="#1C274C"/>
114
+ <path d="M13 13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13C11 12.4477 11.4477 12 12 12C12.5523 12 13 12.4477 13 13Z" fill="#1C274C"/>
115
+ <path d="M8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16C7.55228 16 8 16.4477 8 17Z" fill="#1C274C"/>
116
+ <path d="M8 13C8 13.5523 7.55228 14 7 14C6.44772 14 6 13.5523 6 13C6 12.4477 6.44772 12 7 12C7.55228 12 8 12.4477 8 13Z" fill="#1C274C"/>
117
+ </svg>
118
+ </button>
119
+ </div>
120
+ <Vue3PersianDatetimePicker
121
+ :type="calendar"
122
+ :view="view"
123
+ :min="min"
124
+ :max="max"
125
+ v-if="!isSsr"
126
+ jumpminute="15"
127
+ :range="range"
128
+ :locale="locale"
129
+ :simple="false"
130
+ :roundminute="true"
131
+ :showNowBtn="true"
132
+ :autoSubmit="true"
133
+ :format="format"
134
+ :inputFormat="(inputFormat ? inputFormat : format)"
135
+ :displayFormat="format"
136
+ v-model="modelValue"
137
+ :custom-input="'#'+inputID"/>
127
138
  </template>
128
139
  <style>
129
140
  .form-control--datepicker {
130
- direction: rtl;
141
+ direction: rtl;
131
142
  }
132
143
 
133
144
  .input-group-datepicker-delete {
134
- width: 42px;
135
- text-align: center;
145
+ width: 42px;
146
+ text-align: center;
136
147
  }
137
148
 
138
149
  .input-group-datepicker-delete .fa-times {
139
- display: none;
150
+ display: none;
140
151
  }
141
152
 
142
153
  .input-group-datepicker-delete-show:hover .fa-times {
143
- display: block;
154
+ display: block;
144
155
  }
145
156
 
146
157
  .input-group-datepicker-delete-show:hover .fa-calendars {
147
- display: none;
158
+ display: none;
148
159
  }
149
160
 
150
161
  .vpd-content {
151
- color: var(--bs-body-color) !important;
152
- background-color: var(--bs-body-bg) !important;
153
- -moz-font-feature-settings: "ss01";
154
- -webkit-font-feature-settings: "ss01";
155
- font-feature-settings: "ss01";
162
+ color: var(--bs-body-color) !important;
163
+ background-color: var(--bs-body-bg) !important;
164
+ -moz-font-feature-settings: "ss01";
165
+ -webkit-font-feature-settings: "ss01";
166
+ font-feature-settings: "ss01";
156
167
  }
157
168
 
158
169
  .vpd-time .vpd-down-arrow-btn, .vpd-time .vpd-up-arrow-btn {
159
- text-align: center;
170
+ text-align: center;
160
171
  }
161
172
 
162
173
  .vpd-time .vpd-down-arrow-btn svg,
163
174
  .vpd-time .vpd-up-arrow-btn svg {
164
- margin: 0 auto;
175
+ margin: 0 auto;
165
176
  }
166
177
 
167
178
  .vpd-controls button {
168
- display: flex;
169
- align-items: center;
170
- justify-content: center;
179
+ display: flex;
180
+ align-items: center;
181
+ justify-content: center;
171
182
  }
172
183
 
173
184
  .vpd-month-label {
174
- width: 110px;
185
+ width: 110px;
175
186
  }
176
187
  </style>