inertia-bootstrap-forms 1.0.106 → 1.0.107

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.106",
3
+ "version": "1.0.107",
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",
@@ -1,6 +1,5 @@
1
1
  <script>
2
2
  import {computed, defineComponent, inject} from 'vue';
3
- import RangeSlider from 'svelte-range-slider-pips';
4
3
 
5
4
  export default defineComponent({
6
5
  emits: ['update:modelValue', 'change'],
@@ -68,31 +67,25 @@ export default defineComponent({
68
67
  },
69
68
  methods: {},
70
69
  mounted() {
71
- let _this=this;
72
- this.rangeSliderEn = new RangeSlider({
73
- target: this.$refs.rangeSliderEl,
74
- props: {
75
- values: this.modelValue,
76
- pips: true,
77
- spring: true,
78
- rangeFloat: true,
79
- range: true,
80
- formatter: (v) => Intl.NumberFormat().format(v),
81
- rangeFormatter: (x, y) => Intl.NumberFormat().format(x) + ' - ' + Intl.NumberFormat().format(y),
82
- first: 'label',
83
- last: 'label',
84
- ...this.options,
85
- min: this.min || null,
86
- max: this.max || null,
87
-
88
- }
89
- }).$on('change', function (e) {
90
- _this.$emit('change', e);
91
-
92
- const value = _this.range ? e.detail?.values : e.detail?.value;
93
- _this.modelValue = value;
94
- _this.$emit('update:modelValue', value);
95
- });
70
+ import('svelte-range-slider-pips').then(({ default: RangeSlider }) => {
71
+ let _this = this
72
+ this.rangeSliderEn = new RangeSlider({
73
+ target: this.$refs.rangeSliderEl,
74
+ props: {
75
+ values: this.modelValue,
76
+ pips: true,
77
+ // ... بقیه props
78
+ min: this.min || null,
79
+ max: this.max || null,
80
+ ...this.options,
81
+ }
82
+ }).$on('change', function (e) {
83
+ _this.$emit('change', e)
84
+ const value = _this.range ? e.detail?.values : e.detail?.value
85
+ _this.modelValue = value
86
+ _this.$emit('update:modelValue', value)
87
+ })
88
+ })
96
89
  },
97
90
  beforeUnmount() {
98
91
  },
@@ -1,6 +1,5 @@
1
1
  <script>
2
2
  import './css/from-select.scss';
3
- import Choices from 'choices.js';
4
3
  import {computed, defineComponent, inject} from "vue";
5
4
 
6
5
  export default defineComponent({
@@ -115,11 +114,17 @@ export default defineComponent({
115
114
  return (this.getKeyFromItem(item)) === this.modelValue?.toString()
116
115
  },
117
116
  init() {
117
+ if (!this.ChoicesClass) return
118
+
118
119
  if (this.choices) {
119
120
  this.destroy();
120
121
  }
121
122
 
122
- this.choices = new Choices(this.$refs.input, {
123
+ if (this.locale === 'en' && document.dir === 'rtl') {
124
+ this.currentLocale = 'fa';
125
+ }
126
+
127
+ this.choices = new this.ChoicesClass(this.$refs.input, {
123
128
  searchEnabled: (this.searchEnabled || !!this.search?.url),
124
129
  searchChoices: (this.searchEnabled && !this.search?.url),
125
130
  removeItemButton: true,
@@ -135,7 +140,7 @@ export default defineComponent({
135
140
  },
136
141
  destroy() {
137
142
  this.$refs.input.removeEventListener('search', this.searchHandle);
138
- this.choices.destroy();
143
+ this.choices?.destroy();
139
144
  },
140
145
  searchHandle(event) {
141
146
  this.$emit('search', event)
@@ -192,17 +197,17 @@ export default defineComponent({
192
197
  }
193
198
  },
194
199
  mounted() {
195
- if (typeof window !== 'undefined' && this.locale === 'en' && document.dir === 'rtl') {
196
- this.currentLocale = 'fa';
197
- }
198
-
199
- this.init()
200
+ import('choices.js').then(({ default: Choices }) => {
201
+ this.ChoicesClass = Choices
202
+ this.init()
203
+ })
200
204
  },
201
205
  beforeUnmount() {
202
206
  this.destroy()
203
207
  },
204
208
  data() {
205
209
  return {
210
+ ChoicesClass: null,
206
211
  choices: null,
207
212
  loading: false,
208
213
  searchDebounceTimer: null,