inertia-bootstrap-forms 1.0.7 → 1.0.8

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.7",
3
+ "version": "1.0.8",
4
4
  "description": "Create bootstrap forms with inertia and twitter bootstrap",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -21,9 +21,11 @@ export default {
21
21
  },
22
22
  max: {
23
23
  type: Number,
24
+ default: null,
24
25
  },
25
26
  totalMax: {
26
27
  type: Number,
28
+ default: null,
27
29
  },
28
30
  min: {
29
31
  type: Number,
@@ -31,7 +33,11 @@ export default {
31
33
  },
32
34
  totalMin: {
33
35
  type: Number,
34
- default: 1,
36
+ default: null,
37
+ },
38
+ unit: {
39
+ type: String,
40
+ default: 'Number',
35
41
  },
36
42
  },
37
43
  setup(props) {
@@ -65,6 +71,11 @@ export default {
65
71
 
66
72
  return {modelValue, form};
67
73
  },
74
+ computed: {
75
+ totalQuantity() {
76
+ return this.modelValue ? Object.values(this.modelValue).reduce((sum, value) => sum + value, 0) : this.options.length;
77
+ }
78
+ },
68
79
  methods: {},
69
80
  data() {
70
81
  return {}
@@ -73,8 +84,8 @@ export default {
73
84
  </script>
74
85
  <template>
75
86
  <Dropdown class="multi-quantity-input">
76
- <DropdownToggle class="form-control" data-bs-auto-close="outside">
77
- asdsa
87
+ <DropdownToggle class="form-control fanum" data-bs-auto-close="outside">
88
+ {{ totalQuantity }} {{unit}}
78
89
  </DropdownToggle>
79
90
  <DropdownMenu>
80
91
  <GroupControl :name="name">
@@ -91,6 +102,10 @@ export default {
91
102
  </Dropdown>
92
103
  </template>
93
104
  <style>
105
+ .multi-quantity-input .dropdown-toggle {
106
+ text-align: start;
107
+ }
108
+
94
109
  .multi-quantity-input .dropdown-menu {
95
110
  width: 100%;
96
111
  padding: 10px 15px;
@@ -54,6 +54,10 @@ export default {
54
54
  }
55
55
  });
56
56
 
57
+ if (!modelValue.value) {
58
+ modelValue.value = 1;
59
+ }
60
+
57
61
  return {modelValue, group, form};
58
62
  },
59
63
  methods: {