playbook_ui 7.0.0.pre.alpha14 → 7.0.0.pre.alpha15

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: 972b3bf2414f87c7f6374f5eff1a0b2de27d145d7394399c13d30d6a96e293ca
4
- data.tar.gz: 850d50a56e852f315630cd3d9180db0e655607b76a0c6f5cf04a84f601b431b3
3
+ metadata.gz: 748e8b8bd2267aeeebe8fa55a3ca6bb5404fbd8d4133b80b22c7bb37217ff9b8
4
+ data.tar.gz: 011e14d3bf83bdba2ac94c9c719ab0b31ad026616df14c9e79cb0ae62ab932f6
5
5
  SHA512:
6
- metadata.gz: 607c7ef165b2d71d6279dc73c159a1326a56c1fafd4b41446bd6b8cd22d49d4ebffbb24e1f339a2b32ddd2559663fa7bc9b51eb8ca7cd5b0b3a8e6231f787773
7
- data.tar.gz: b9351d4c6df7546eb39ae5742546d3c44e699005ffa6da44c8af1d1e256412e69a95ec208f986bd6619434a1647b7f17bd9f88e4b872556b11d6f57e1ddff568
6
+ metadata.gz: 6962424a2fdb0aafedda050a5dd2620b614107e6744631bd2f36d1be3065f6a27c76e11ceb20261ae2f47ecbcfc35cdaddd3a50cb9441afdf9819a116d3b2682
7
+ data.tar.gz: 9201beceb3d221d4af35cdf45fffc49fa66c289ded941774ee80bc5bd5876e138cd608b99a0d9a6700bc79e9ab1ed25b90aa27c4d8f4ec4e1d017419f7757b50
@@ -16,6 +16,7 @@ const datePickerHelper = (config) => {
16
16
  required,
17
17
  yearRange,
18
18
  } = config
19
+
19
20
  // ===========================================================
20
21
  // | Hook Definitions |
21
22
  // ===========================================================
@@ -48,6 +49,7 @@ const datePickerHelper = (config) => {
48
49
  parentInput.style.justifyContent = ''
49
50
  }
50
51
  }
52
+
51
53
  // ===========================================================
52
54
  // | Flatpickr initializer w/ config |
53
55
  // ===========================================================
@@ -98,6 +100,7 @@ const datePickerHelper = (config) => {
98
100
  prevArrow: '<i class="far fa-angle-left"></i>',
99
101
  static: true,
100
102
  })
103
+
101
104
  // ===========================================================
102
105
  // Additional JS Functionality |
103
106
  // ===========================================================
@@ -115,7 +118,7 @@ const datePickerHelper = (config) => {
115
118
  years += `<option value="${year}">${year}</option>`
116
119
  }
117
120
 
118
- // variablize each dropdown selecttor
121
+ // variablize each dropdown selector
119
122
  const dropdown = document.querySelector(`#year-${pickerId}`)
120
123
 
121
124
  // inject year options into dropdown and assign it the flatpickr's current year value
@@ -127,98 +130,21 @@ const datePickerHelper = (config) => {
127
130
  picker.changeYear(Number(e.target.value))
128
131
  })
129
132
 
130
- // Allow the date picker form resetting
133
+ // Reverse month and year dropdown reset on form.reset()
131
134
  if (picker.input.form) {
132
- // let adaptive = false
133
- // const adaptedReset = (e) => {
134
- // picker.input.form.removeEventListener('reset', namedFunc)
135
- // debugger
136
- // e.target.reset()
137
- // picker.input.form.addEventListener('reset', namedFunc)
138
- // picker.monthsDropdownContainer.value = picker.currentMonth
139
- // dropdown.value = picker.currentYear
140
- // }
141
-
142
- // const namedFunc = (e) => {
143
- // e.preventDefault()
144
- // debugger
145
- // adaptedReset(e)
146
- // }
147
-
148
- // picker.input.form.addEventListener('reset', namedFunc)
149
-
150
- // const myAsync = async() => {
151
- // console.log('reset')
152
- // return 'arb'
153
- // }
154
-
155
- // const promise = new Promise((resolve) => {
156
- // picker.input.form.addEventListener('reset', () => console.log('reset'))
157
- // resolve('chyeah')
158
- // })
159
-
160
- // promise.then((val) => {
161
- // console.log('select cleanup', val)
162
- // picker.monthsDropdownContainer.value = picker.currentMonth
163
- // dropdown.value = picker.currentYear
164
- // })
165
-
166
- picker.input.form.addEventListener('reset', (e) => {
135
+ picker.input.form.addEventListener('reset', () => {
136
+ // Code block triggers after form.reset() is called and executed
167
137
  setTimeout(() => {
168
138
  dropdown.value = picker.currentYear
169
139
  picker.monthsDropdownContainer.value = picker.currentMonth
140
+
141
+ /* Reset date picker to default value on form.reset() */
142
+ if (defaultDate){
143
+ picker.setDate(defaultDate)
144
+ yearChangeHook()
145
+ }
170
146
  }, 0)
171
147
  })
172
-
173
- // picker.input.form.addEventListener('reset', (e) => {
174
- // // debugger
175
- // // adaptedReset(e.target)
176
- // // e.preventDefault()
177
- // // debugger
178
- // // e.target.reset()
179
- // // debugger
180
-
181
- // // const manualReset = async() => {
182
- // // e.target.reset()
183
- // // debugger
184
- // // return 'test-val'
185
- // // }
186
-
187
- // // const resetSelects = async() => {
188
- // // const arb = await manualReset()
189
- // // console.log(arb)
190
- // // debugger
191
- // // picker.monthsDropdownContainer.value = picker.currentMonth
192
- // // dropdown.value = picker.currentYear
193
- // // }
194
-
195
- // // e.preventDefault()
196
- // // if (defaultDate){
197
- // // picker.setDate(defaultDate)
198
- // // yearChangeHook()
199
- // // } else {
200
- // // picker.clear()
201
- // // }
202
-
203
- // // const fields = e.target.querySelectorAll('select, input, textarea')
204
-
205
- // // // Prevent year and month dropdowns from being reset
206
- // // fields.forEach((field) => {
207
- // // if (field == picker.monthsDropdownContainer || field == dropdown || field == picker.input){
208
- // // // console.log(field)
209
- // // return
210
- // // } else {
211
- // // field.value = field.defaultValue
212
- // // }
213
- // // })
214
- // // debugger
215
- // // setTimeout(() => {
216
- // // dropdown.value = picker.currentYear
217
- // // picker.monthsDropdownContainer.value = picker.currentMonth
218
- // // console.log(picker)
219
- // // debugger
220
- // // }, 10)
221
- // })
222
148
  }
223
149
 
224
150
  // two way binding
@@ -30,7 +30,6 @@
30
30
  <%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
31
31
  <%= form.text_field :example_text_field, props: { label: true } %>
32
32
  <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
33
- <%= form.date_picker :test_id, props: { label: true, default_date: "10/02/1993" }%>
34
33
 
35
34
  <%= form.actions do |action| %>
36
35
  <%= action.submit props: { text: "Apply", data: { disable_with: "<i class='far fa-spinner fa-spin mr-3'></i>Searching...".html_safe },}%>
@@ -8,7 +8,7 @@ module Playbook
8
8
  prefix = @object_name
9
9
  html_attribute_name = "#{prefix}[#{name}]"
10
10
  html_id = "#{prefix}_#{name}"
11
- props[:label] = @template.label(@object_name, name) if props[:label] && !props[:label].is_a?(String)
11
+ props[:label] = @template.label(@object_name, name) if props[:label] == true
12
12
 
13
13
  props[:name] = html_attribute_name
14
14
  props[:picker_id] = html_id
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Playbook
3
- VERSION = "7.0.0.pre.alpha14"
3
+ VERSION = "7.0.0.pre.alpha15"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0.pre.alpha14
4
+ version: 7.0.0.pre.alpha15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-07 00:00:00.000000000 Z
12
+ date: 2020-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack