bullet_train-fields 1.2.26 → 1.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdf657eae63387a45977e3fa37f319fa528b2cad4bd4592a609f8f18223bac41
4
- data.tar.gz: 26cc3f561c5e2e513c8a2d3fa7ee5f040edb494cb84968425fdb2056895a834b
3
+ metadata.gz: 65324a21a30cb4525bc2cedfaff8e56560a90a18c6394ad77fdaf57889d8aae7
4
+ data.tar.gz: 6f10605cb0965c5b27f095ecd337d9ec7ce6965f976f318fd9b385b10729b504
5
5
  SHA512:
6
- metadata.gz: df14fb7eb83cf215eccf5b01aa747cbeb61f5dbfd7743a3fe15aa3b471f42624a243bdca2de276ebd20a9e908eb8020e21e0f06dc16035aa3bf2f899a4d44963
7
- data.tar.gz: 3274cbe4fa6b5ea57ef1e5790ecd96d5447368ed3e564c46853a204220cbf81066aeacbe3023c81c5301aa92bac6147167ae7b12ed77516775c3a20834847fb1
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.26"
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.26
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-05-18 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: