inertia-bootstrap-forms 1.0.82 → 1.0.84

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/index.d.ts CHANGED
@@ -200,7 +200,55 @@ export const UppyInput: DefineComponent<{
200
200
  >;
201
201
  export const FileInput: DefineComponent<{}, {}, any>;
202
202
  export const SimpleUploader: DefineComponent<{}, {}, any>;
203
- export const FormContainer: DefineComponent<{}, {}, any>;
203
+ export const FormContainer: DefineComponent<{
204
+ url: {
205
+ type: String,
206
+ default: '',
207
+ required: false,
208
+ },
209
+ method: {
210
+ default: 'post'
211
+ },
212
+ only: {
213
+ type: Array,
214
+ default: [],
215
+ required: false,
216
+ },
217
+ modelValue: {
218
+ type: Object,
219
+ default: {},
220
+ required: false,
221
+ },
222
+ options: {
223
+ type: Object,
224
+ default: {},
225
+ required: false,
226
+ },
227
+ resetOnSuccess: {
228
+ type: Boolean,
229
+ default: true,
230
+ },
231
+ submitHandler: {
232
+ type: Function,
233
+ default: null,
234
+ required: false,
235
+ },
236
+ }, {}, any,
237
+ {},
238
+ {},
239
+ {},
240
+ {},
241
+ {
242
+ 'update:modelValue': (data) => void,
243
+ 'submit': (event) => void,
244
+ 'reset': (file) => void,
245
+ 'onStart': () => void,
246
+ 'onFinish': (data) => void,
247
+ 'onSuccess': (data) => void,
248
+ 'onError': (errors) => void,
249
+ 'change': (data) => void,
250
+ }
251
+ >;
204
252
  export const FormLabel: DefineComponent<{}, {}, any>;
205
253
  export const GroupControl: DefineComponent<{}, {}, any>;
206
254
  export const LocationInput: DefineComponent<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inertia-bootstrap-forms",
3
- "version": "1.0.82",
3
+ "version": "1.0.84",
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",
@@ -25,6 +25,15 @@ export default defineComponent({
25
25
  default: {},
26
26
  required: false,
27
27
  },
28
+ options: {
29
+ type: Object,
30
+ default: {},
31
+ required: false,
32
+ },
33
+ resetOnSuccess: {
34
+ type: Boolean,
35
+ default: true,
36
+ },
28
37
  submitHandler: {
29
38
  type: Function,
30
39
  default: null,
@@ -37,6 +46,7 @@ export default defineComponent({
37
46
  const form = useForm({
38
47
  hasMessage: false,
39
48
  successMessage: null,
49
+ ...props.options,
40
50
  ...formData
41
51
  });
42
52
 
@@ -132,6 +142,10 @@ export default defineComponent({
132
142
  this.form.successMessage = data?.props?.message;
133
143
  }
134
144
 
145
+ if (this.resetOnSuccess) {
146
+ this.form?.reset();
147
+ }
148
+
135
149
  this.$emit('onSuccess', data);
136
150
  }
137
151
  });
package/src/UppyInput.vue CHANGED
@@ -3,10 +3,10 @@
3
3
  <UppyContextProvider :name="'uu' + name" :uppy="uppy">
4
4
  <slot :uppy="uppy">
5
5
  <FilesList class="uppy-file-lists"/>
6
- <Dropzone/>
6
+ <Dropzone class="uppy-drop-zone"/>
7
7
  </slot>
8
8
  </UppyContextProvider>
9
- <div class="uppy-input-area--caption small text-body-secondary fst-italic" v-if="restrictionCaption">{{restrictionCaption}}</div>
9
+ <div class="uppy-input-area--caption small text-body-secondary fst-italic" v-if="restrictionCaption">{{ restrictionCaption }}</div>
10
10
  </div>
11
11
  </template>
12
12
 
@@ -192,6 +192,13 @@ onMounted(() => {
192
192
  if (uppy.value?.opts?.restrictions) {
193
193
  restrictionCaption.value = buildRestrictionsCaption(uppy.value.opts.restrictions)
194
194
  }
195
+
196
+
197
+ if (inputEl && uppy.value?.opts?.locale?.strings?.dropzoneText) {
198
+ inputEl.value?.querySelectorAll('[data-uppy-element="dropzone"]>div>div>p')?.forEach(el => {
199
+ el.innerHTML = uppy.value?.opts?.locale?.strings?.dropzoneText;
200
+ });
201
+ }
195
202
  });
196
203
 
197
204
  onBeforeUnmount(() => {
@@ -230,6 +237,7 @@ function showError(message) {
230
237
  }
231
238
 
232
239
  const niceBytesUnits = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
240
+
233
241
  function niceBytes(x) {
234
242
  let l = 0, n = parseInt(x, 10) || 0;
235
243
  while (n >= 1024 && ++l) {