bullet_train-fields 1.6.10 → 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: 415a128edafe2a61851d85827982262099b59d46354b5f84362841e865e8e295
4
- data.tar.gz: 56a3e00517e3366d70411acd8b0c244cf659ff83c1312e5a08bda9e295bbbe00
3
+ metadata.gz: ff1dfd84917dc33ffd47b249b3183508b2f6b823d990e1136be350e7f3b06919
4
+ data.tar.gz: 9280b48ccd3bb60aae522b7844592502cc1a3891959b0385228d4cd26a054416
5
5
  SHA512:
6
- metadata.gz: 2ccfb00753dd0e487e5365b337ec930e0e584a6c685e1e73f1777dbb6e8760bb21d0e144c17dbc8d4ea9bd1c43fcbf4f98fca4a1e971e9a977c518e3878cd0c5
7
- data.tar.gz: cba09fcb9b34061139e78a3f2ca0d7ca9521d9d508e12e4ad62be2d329da928f7bb16281939957f510ab964855d3ac31346ab37ac5a377aea4fa02234e47b03b
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.10"
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.10
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-03 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