tam_select 1.1.1 → 1.2.3
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 +4 -4
- data/README.md +148 -49
- data/Rakefile +5 -2
- data/lib/generators/tam_select/install_generator.rb +33 -1
- data/lib/generators/tam_select/templates/tam_select_controller.js +1 -1
- data/lib/generators/tam_select/templates/tam_select_helper.rb +1 -1
- data/lib/generators/tam_select/templates/tam_select_input.rb +1 -1
- data/lib/generators/tam_select/templates/tam_select_paginatable.rb +11 -4
- data/lib/generators/tam_select/templates/tam_select_remote.rb +7 -1
- data/lib/tam_select/version.rb +1 -1
- data/package.json +48 -0
- data/rails/app/controllers/concerns/tam_select_paginatable.rb +32 -0
- data/rails/app/helpers/tam_select_helper.rb +17 -0
- data/rails/app/inputs/tam_select_input.rb +30 -0
- data/rails/app/javascript/controllers/tam_select_controller.js +31 -0
- data/src/tam-select.js +592 -149
- metadata +6 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
import TamSelect from "tam-select"
|
|
3
|
+
|
|
4
|
+
export default class extends Controller {
|
|
5
|
+
static values = {
|
|
6
|
+
options: { type: Object, default: {} }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
connect() {
|
|
10
|
+
this.instance = TamSelect.getInstance(this.element) || new TamSelect(this.element, this.optionsValue)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
disconnect() {
|
|
14
|
+
this.instance?.destroy()
|
|
15
|
+
this.instance = null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
optionsValueChanged() {
|
|
19
|
+
if (!this.instance) return
|
|
20
|
+
this.instance.destroy()
|
|
21
|
+
this.instance = new TamSelect(this.element, this.optionsValue)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
refresh() {
|
|
25
|
+
this.instance?.refresh()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
clear() {
|
|
29
|
+
this.instance?.clear()
|
|
30
|
+
}
|
|
31
|
+
}
|