@radioactive-labs/plutonium 0.4.8 → 0.4.9
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.
- package/package.json +1 -1
- package/src/css/flatpickr.css +797 -0
- package/src/css/plutonium.css +1 -0
- package/src/dist/css/plutonium.css +2 -2
- package/src/dist/js/plutonium.js +10 -2
- package/src/dist/js/plutonium.js.map +2 -2
- package/src/dist/js/plutonium.min.js +2 -2
- package/src/dist/js/plutonium.min.js.map +2 -2
- package/src/js/controllers/attachment_input_controller.js +2 -1
- package/src/js/controllers/flatpickr_controller.js +25 -14
|
@@ -10,6 +10,7 @@ import DomElement from "../support/dom_element"
|
|
|
10
10
|
export default class extends Controller {
|
|
11
11
|
static values = {
|
|
12
12
|
identifier: String,
|
|
13
|
+
endpoint: String,
|
|
13
14
|
|
|
14
15
|
maxFileSize: { type: Number, default: null },
|
|
15
16
|
minFileSize: { type: Number, default: null },
|
|
@@ -75,7 +76,7 @@ export default class extends Controller {
|
|
|
75
76
|
#configureUploader() {
|
|
76
77
|
this.uppy
|
|
77
78
|
.use(XHRUpload, {
|
|
78
|
-
endpoint:
|
|
79
|
+
endpoint: this.endpointValue, // path to the upload endpoint
|
|
79
80
|
})
|
|
80
81
|
}
|
|
81
82
|
|
|
@@ -1,35 +1,46 @@
|
|
|
1
|
-
import { Controller } from "@hotwired/stimulus"
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
2
|
|
|
3
3
|
// Connects to data-controller="flatpickr"
|
|
4
4
|
export default class extends Controller {
|
|
5
5
|
connect() {
|
|
6
|
-
this.
|
|
7
|
-
|
|
6
|
+
this.modal = document.querySelector("[data-controller=remote-modal]");
|
|
7
|
+
|
|
8
|
+
this.picker = new flatpickr(this.element, this.#buildOptions());
|
|
9
|
+
|
|
10
|
+
this.element.setAttribute(
|
|
11
|
+
"data-action",
|
|
12
|
+
"turbo:morph-element->flatpickr#reconnect"
|
|
13
|
+
);
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
disconnect() {
|
|
11
17
|
if (this.picker) {
|
|
12
|
-
this.picker.destroy()
|
|
13
|
-
this.picker = null
|
|
18
|
+
this.picker.destroy();
|
|
19
|
+
this.picker = null;
|
|
14
20
|
}
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
reconnect() {
|
|
18
|
-
this.disconnect()
|
|
19
|
-
this.connect()
|
|
24
|
+
this.disconnect();
|
|
25
|
+
this.connect();
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
#buildOptions() {
|
|
23
|
-
let options = { altInput: true }
|
|
29
|
+
let options = { altInput: true };
|
|
30
|
+
|
|
24
31
|
if (this.element.attributes.type.value == "datetime-local") {
|
|
25
|
-
options.enableTime = true
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
options.
|
|
29
|
-
options.noCalendar = true
|
|
32
|
+
options.enableTime = true;
|
|
33
|
+
} else if (this.element.attributes.type.value == "time") {
|
|
34
|
+
options.enableTime = true;
|
|
35
|
+
options.noCalendar = true;
|
|
30
36
|
// options.time_24hr = true
|
|
31
37
|
// options.altFormat = "H:i"
|
|
32
38
|
}
|
|
33
|
-
|
|
39
|
+
|
|
40
|
+
if (this.modal) {
|
|
41
|
+
options.appendTo = this.modal;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return options;
|
|
34
45
|
}
|
|
35
46
|
}
|