bullet_train-fields 1.6.9 → 1.6.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72d366b8d0ddcccbcfd6e63f96940b2ee9fd2b1051a9eab40903ce25840f26bc
4
- data.tar.gz: 98fc604f47050f84fd7ecad96741cad8050ab991355e60450bcb14ac4d89f850
3
+ metadata.gz: ff1dfd84917dc33ffd47b249b3183508b2f6b823d990e1136be350e7f3b06919
4
+ data.tar.gz: 9280b48ccd3bb60aae522b7844592502cc1a3891959b0385228d4cd26a054416
5
5
  SHA512:
6
- metadata.gz: 4bcd16f1e72101cb34186b8d3bc94910910b93adf50c43d9635719c203f7327db4ff00fee547a662acdb13e940989d86c2969d958453d038432e0ce223c1ba9c
7
- data.tar.gz: c70db8349d60be50db4ec9634808553ec54d425d626ab1923fc30164181916f1815053ad9424a4f81e1d29f5e3c18e732a40e169a564084d300f148fc68ee4c7
6
+ metadata.gz: dc19e9d978c54669874872e6baf67b7cd69e68d2ce18f6f4c30d80e417c6ae9b67619b2b06e97c0d4ef0a1ffddd1b0160bbbf56f28a06e073004cb89e9b573c0
7
+ data.tar.gz: 1ff9f03414914689d63ff224fe5a964446f175e6881f0acf2b905caf2c309613a04638e5962bab830f917c691b0c3f35319d171d07231925abf3ca285c1bc8b8
@@ -11,7 +11,7 @@ module Fields::AddressFieldHelper
11
11
  def admin_division_label_for(address_form)
12
12
  # using country_id because it's fastest, even if this case statement is hard to read
13
13
  admin_divisions_key = case address_form.object.country_id
14
- when 233, 31, 142, 239, 101
14
+ when 31, 142, 239, 101
15
15
  :states
16
16
  when 39
17
17
  :provinces_territories
@@ -19,7 +19,7 @@ module Fields::AddressFieldHelper
19
19
  :prefectures
20
20
  when 107, 45, 116, 182, 207, 219, 230, 156, 204
21
21
  :provinces
22
- when 14
22
+ when 14, 233
23
23
  :states_territories
24
24
  when 59
25
25
  :regions
@@ -7,46 +7,46 @@ export default class extends Controller {
7
7
  loading: { type: Boolean, default: false }
8
8
  }
9
9
  static classes = [ "loading" ]
10
-
10
+
11
11
  updateFrameFromDependableField(event) {
12
12
  const field = event?.detail?.event?.detail?.event?.target || // super select nests its original jQuery event, contains <select> target
13
13
  event?.detail?.event?.target || // dependable_controller will include the original event in detail
14
14
  event?.target // maybe it was fired straight from the field
15
-
15
+
16
16
  if (!field) { return }
17
-
17
+
18
18
  this.storeFieldValues()
19
-
19
+
20
20
  this.loadingValue = true
21
21
  this.disableFieldInputWhileRefreshing()
22
-
22
+
23
23
  const frame = this.element
24
24
  frame.src = this.constructNewUrlUpdatingField(field.name, field.value)
25
25
  }
26
-
26
+
27
27
  finishFrameUpdate(event) {
28
28
  if (event.target !== this.element) { return }
29
-
29
+
30
30
  this.restoreFieldValues()
31
31
  this.loadingValue = false
32
32
  }
33
-
33
+
34
34
  constructNewUrlUpdatingField(fieldName, fieldValue) {
35
35
  const url = new URL(window.location.href)
36
36
  url.searchParams.set(fieldName, fieldValue)
37
-
37
+
38
38
  return url.href
39
39
  }
40
-
40
+
41
41
  disableFieldInputWhileRefreshing() {
42
42
  this.fieldTargets.forEach(field => field.disabled = true )
43
43
  }
44
-
44
+
45
45
  loadingValueChanged() {
46
46
  if (!this.hasLoadingClass) { return }
47
47
  this.element.classList.toggle(...this.loadingClasses, this.loadingValue)
48
48
  }
49
-
49
+
50
50
  storeFieldValues() {
51
51
  this.fieldTargets.forEach(field => {
52
52
  let storeUpdate = {}
@@ -54,7 +54,7 @@ export default class extends Controller {
54
54
  this.valuesStoreValue = Object.assign(this.valuesStoreValue, storeUpdate)
55
55
  })
56
56
  }
57
-
57
+
58
58
  restoreFieldValues() {
59
59
  this.fieldTargets.forEach(field => {
60
60
  const storedValue = this.valuesStoreValue[field.name]
@@ -62,7 +62,7 @@ export default class extends Controller {
62
62
  field.value = storedValue
63
63
  field.dispatchEvent(new Event('change')) // ensures cascading effects, including super-select validating against valid options
64
64
  })
65
-
65
+
66
66
  this.valuesStoreValue = {}
67
67
  }
68
- }
68
+ }
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Fields
3
- VERSION = "1.6.9"
3
+ VERSION = "1.6.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.9
4
+ version: 1.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-02 00:00:00.000000000 Z
11
+ date: 2023-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard