playbook_ui 13.21.0.pre.alpha.PBNTR225advancedtablefeedback2438 → 13.21.0.pre.alpha.PBNTR238DatePickerYearBug2436

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +19 -21
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +3 -6
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/SubRowHeaderRow.tsx +8 -12
  5. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +9 -14
  6. data/app/pb_kits/playbook/pb_advanced_table/Components/ToggleIconButton.tsx +5 -9
  7. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +11 -15
  8. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +8 -12
  9. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +2 -3
  10. data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +2 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +9 -2
  12. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +79 -83
  13. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +54 -54
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.jsx +7 -7
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.jsx +7 -7
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx +7 -7
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx +7 -7
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +1 -1
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.jsx +7 -7
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.jsx +7 -7
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.jsx +7 -7
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.jsx +7 -7
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.jsx +7 -7
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +7 -7
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data.js +1 -1
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data_inline_loading.js +1 -1
  27. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +9 -7
  28. data/dist/playbook-rails.js +1 -1
  29. data/lib/playbook/version.rb +1 -1
  30. metadata +1 -2
  31. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/_chrome_styles.scss +0 -13
@@ -1,4 +1,5 @@
1
1
  import flatpickr from 'flatpickr'
2
+ import { Instance } from "flatpickr/dist/types/instance"
2
3
  import { BaseOptions } from 'flatpickr/dist/types/options'
3
4
  import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect'
4
5
  import weekSelect from "flatpickr/dist/plugins/weekSelect/weekSelect"
@@ -165,9 +166,9 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
165
166
  }
166
167
 
167
168
  // two way binding
168
- const initialDropdown = document.querySelector<HTMLElement & { [x: string]: any }>(`#year-${pickerId}`)
169
- const yearChangeHook = () => {
170
- initialDropdown.value = initialPicker.currentYear
169
+ const yearChangeHook = (fp: Instance) => {
170
+ const yearInput = document.querySelector(`#year-${fp.input.id}`) as HTMLInputElement
171
+ yearInput.value = fp.currentYear?.toString()
171
172
  }
172
173
 
173
174
  // ===========================================================
@@ -199,11 +200,12 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
199
200
  if (!staticPosition && scrollContainer) detachFromScroll(scrollContainer as HTMLElement)
200
201
  onClose(selectedDates, dateStr)
201
202
  }],
202
- onChange: [(selectedDates, dateStr) => {
203
+ onChange: [(selectedDates, dateStr, fp) => {
204
+ yearChangeHook(fp)
203
205
  onChange(dateStr, selectedDates)
204
206
  }],
205
- onYearChange: [() => {
206
- yearChangeHook()
207
+ onYearChange: [(_selectedDates, _dateStr, fp) => {
208
+ yearChangeHook(fp)
207
209
  }],
208
210
  plugins: setPlugins(thisRangesEndToday, customQuickPickDates),
209
211
  position,
@@ -248,7 +250,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
248
250
  /* Reset date picker to default value on form.reset() */
249
251
  if (defaultDate){
250
252
  picker.setDate(defaultDate)
251
- yearChangeHook()
253
+ yearChangeHook(picker)
252
254
  }
253
255
  }, 0)
254
256
  })