bullet_train-fields 1.2.27 → 1.3.0

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: 4be930c3809bf1418879ad8babb154208449488a9a0be0d9e814fec05b0616f1
4
- data.tar.gz: 5fdfb6b6ad842df36fe89acfcd44b443e7fca90ea8f1d36e69f01b862e839e09
3
+ metadata.gz: 65324a21a30cb4525bc2cedfaff8e56560a90a18c6394ad77fdaf57889d8aae7
4
+ data.tar.gz: 6f10605cb0965c5b27f095ecd337d9ec7ce6965f976f318fd9b385b10729b504
5
5
  SHA512:
6
- metadata.gz: cdd2b0d7b072a6d6488bb967c59eccda5f9a3bba375ffa8048983b6117b1a6bd017c35afa0c4d204f56bc88217a4b10668eb16912c83eeb091e546e35e9d481b
7
- data.tar.gz: b5b606fd3bac4286ce8c3060bad7fcbbde89f0b7ff9628d4fa2a41dba18266e3197587ba7977056c1c3b4cb5d45e749fcb38765dca99f03c21d77297c2083dbb
6
+ metadata.gz: 9946226d50ce8bfcf9b3826f12a625ca4c8aa6b065fc2c921cae6d1d746cb9e7f5a1633bd05ecf5e387ff370948bf896804a20ad194bf98fc9d92e3b524dc9bf
7
+ data.tar.gz: 06eac5f6f67f5843619a2b80fe688dcd700032a4d38598d8d08e967f0da8076e504d5b908edb74a77c98a2bbef098d19f5dc6d227a7d597ec082a7c43ef3092b
@@ -11,6 +11,7 @@ export default class extends Controller {
11
11
  acceptsNew: Boolean,
12
12
  enableSearch: Boolean,
13
13
  searchUrl: String,
14
+ select2Options: String,
14
15
  }
15
16
 
16
17
  // will be reissued as native dom events name prepended with '$' e.g. '$change', '$select2:closing', etc
@@ -28,6 +29,11 @@ export default class extends Controller {
28
29
  return window?.$?.fn?.select2 !== undefined
29
30
  }
30
31
 
32
+ get optionsOverride() {
33
+ if (!this.hasSelect2OptionsValue) { return {} }
34
+ return this.select2OptionsValue
35
+ }
36
+
31
37
  connect() {
32
38
  if (this.isSelect2LoadedOnWindowJquery) {
33
39
  this.initPluginInstance()
@@ -65,7 +71,6 @@ export default class extends Controller {
65
71
  }
66
72
  return query
67
73
  }
68
- // Any additional params go here...
69
74
  }
70
75
  }
71
76
 
@@ -73,6 +78,10 @@ export default class extends Controller {
73
78
  options.templateSelection = this.formatState;
74
79
  options.width = 'style';
75
80
 
81
+ // Merge in custom options.
82
+ const custom_options = Object.keys(this.optionsOverride).length > 0 ? JSON.parse(this.optionsOverride) : {}
83
+ options = {...options, ...custom_options}
84
+
76
85
  this.cleanupBeforeInit() // in case improperly torn down
77
86
  this.pluginMainEl = this.selectTarget // required because this.selectTarget is unavailable on disconnect()
78
87
  $(this.pluginMainEl).select2(options);
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Fields
3
- VERSION = "1.2.27"
3
+ VERSION = "1.3.0"
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.2.27
4
+ version: 1.3.0
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-07-27 00:00:00.000000000 Z
11
+ date: 2023-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -122,12 +122,12 @@ files:
122
122
  - lib/bullet_train/fields/engine.rb
123
123
  - lib/bullet_train/fields/version.rb
124
124
  - lib/tasks/bullet_train/fields_tasks.rake
125
- homepage: https://github.com/bullet-train-co/bullet_train-fields
125
+ homepage: https://github.com/bullet-train-co/bullet_train-core/tree/main/bullet_train-fields
126
126
  licenses:
127
127
  - MIT
128
128
  metadata:
129
- homepage_uri: https://github.com/bullet-train-co/bullet_train-fields
130
- source_code_uri: https://github.com/bullet-train-co/bullet_train-fields
129
+ homepage_uri: https://github.com/bullet-train-co/bullet_train-core/tree/main/bullet_train-fields
130
+ source_code_uri: https://github.com/bullet-train-co/bullet_train-core/tree/main/bullet_train-fields
131
131
  post_install_message:
132
132
  rdoc_options: []
133
133
  require_paths:
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.4.10
146
+ rubygems_version: 3.3.7
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Bullet Train Fields