playbook_ui_docs 12.28.0.pre.alpha.20230613implementbakesupport865 → 12.29.0.pre.alpha.play716popoverkitcloseonclickissue893
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.html.erb +12 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.md +3 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.html.erb +12 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.jsx +18 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.jsx +17 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.md +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +3 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_with_custom_button.jsx +83 -0
- data/app/pb_kits/playbook/pb_map/docs/_map_with_custom_button.md +1 -0
- data/app/pb_kits/playbook/pb_map/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_map/docs/index.js +1 -0
- data/dist/playbook-doc.js +199 -199
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e789156f94ae954cd02fd69d7604306f6d645b40e1b9fb9c10b250fe663b658
|
4
|
+
data.tar.gz: 7ed006f7b8b2dcf930ef8e457c664fa7de11ff0ad71d9bb897549f205e91d1a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58e09483e4cac927a5cf69b8ea766e33b0883a202e9ab10f6a5f0af9f31a60ee83426d4eaeea17faacc87a2df048d4fa2ad6a5f6597870e867ec42683bf1380b
|
7
|
+
data.tar.gz: 389de65e49bff2d7658209c15cb65b4f1de556bfa7b8994df4fa7112a216e9ae8f1b19184aa0daa57b0a9ec07bbc005fada4c962f9c2623fec55e6b3f5297133
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= pb_rails("date_picker", props: {
|
2
|
+
allow_input: true,
|
3
|
+
end_date_id: "quick-pick-end-date",
|
4
|
+
end_date_name: "quick-pick-end-date",
|
5
|
+
mode: "range",
|
6
|
+
picker_id: "date-picker-quick-pick",
|
7
|
+
placeholder: "mm/dd/yyyy to mm/dd/yyyy",
|
8
|
+
selection_type: "quickpick",
|
9
|
+
start_date_id: "quick-pick-start-date",
|
10
|
+
start_date_name: "quick-pick-start-date"
|
11
|
+
}) %>
|
12
|
+
|
@@ -0,0 +1,3 @@
|
|
1
|
+
This date range variant uses hidden inputs to handle start and end dates. While they are not required props, it is advisable to specify a unique `start_date_id`, `start_date_name`, `end_date_id`, and `end_date_name` for each quick pick instance you place in a form and/or on a page.
|
2
|
+
|
3
|
+
Like all other date pickers, the quick pick does require a `picker_id`.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= pb_rails("date_picker", props: {
|
2
|
+
allow_input: true,
|
3
|
+
end_date_id: "range-limit-end-date",
|
4
|
+
end_date_name: "range-limit-end-date",
|
5
|
+
mode: "range",
|
6
|
+
picker_id: "thisRangesEndToday",
|
7
|
+
placeholder: "mm/dd/yyyy to mm/dd/yyyy",
|
8
|
+
selection_type: "quickpick",
|
9
|
+
start_date_id: "range-limit-start-date",
|
10
|
+
start_date_name: "range-limit-start-date",
|
11
|
+
this_ranges_end_today: true
|
12
|
+
}) %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import DatePicker from '../_date_picker'
|
3
|
+
|
4
|
+
const DatePickerQuickPickRangeLimit = (props) => (
|
5
|
+
<>
|
6
|
+
<DatePicker
|
7
|
+
allowInput
|
8
|
+
mode="range"
|
9
|
+
pickerId="thisRangesEndToday"
|
10
|
+
placeholder="mm/dd/yyyy to mm/dd/yyyy"
|
11
|
+
selectionType="quickpick"
|
12
|
+
thisRangesEndToday
|
13
|
+
{...props}
|
14
|
+
/>
|
15
|
+
</>
|
16
|
+
)
|
17
|
+
|
18
|
+
export default DatePickerQuickPickRangeLimit
|
@@ -0,0 +1 @@
|
|
1
|
+
Applying `this_ranges_end_today` (Rails) or `thisRangesEndToday` (React) causes all “This” preset ranges (i.e., this week, this month, this quarter, this year) to use an endDate of today, instead of their natural end date in the future.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import DatePicker from '../_date_picker'
|
3
|
+
|
4
|
+
const DatePickerQuickPickReact = (props) => (
|
5
|
+
<>
|
6
|
+
<DatePicker
|
7
|
+
allowInput
|
8
|
+
mode="range"
|
9
|
+
pickerId="date-picker-quick-pick"
|
10
|
+
placeholder="mm/dd/yyyy to mm/dd/yyyy"
|
11
|
+
selectionType="quickpick"
|
12
|
+
{...props}
|
13
|
+
/>
|
14
|
+
</>
|
15
|
+
)
|
16
|
+
|
17
|
+
export default DatePickerQuickPickReact
|
@@ -0,0 +1 @@
|
|
1
|
+
Use the `onChange` handler function to access the startDate and endDate values. Check the [`onChange` example](https://playbook.powerapp.cloud/kits/date_picker/react#onchange) for more information.
|
@@ -8,6 +8,8 @@ examples:
|
|
8
8
|
- date_picker_input: Input Field
|
9
9
|
- date_picker_label: Label
|
10
10
|
- date_picker_range: Range
|
11
|
+
- date_picker_quick_pick_rails: Range (Quick Pick)
|
12
|
+
- date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
|
11
13
|
- date_picker_format: Format
|
12
14
|
- date_picker_disabled: Disabled Dates
|
13
15
|
- date_picker_min_max: Min Max
|
@@ -33,6 +35,8 @@ examples:
|
|
33
35
|
- date_picker_on_change: onChange
|
34
36
|
- date_picker_on_close: onClose
|
35
37
|
- date_picker_range: Range
|
38
|
+
- date_picker_quick_pick_react: Range (Quick Pick)
|
39
|
+
- date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
|
36
40
|
- date_picker_format: Format
|
37
41
|
- date_picker_disabled: Disabled Dates
|
38
42
|
- date_picker_min_max: Min Max
|
@@ -19,4 +19,6 @@ export { default as DatePickerWeek } from './_date_picker_week.jsx'
|
|
19
19
|
export { default as DatePickerPositions } from './_date_picker_positions.jsx'
|
20
20
|
export { default as DatePickerPositionsElement } from './_date_picker_positions_element.jsx'
|
21
21
|
export { default as DatePickerAllowInput } from './_date_picker_allow_input'
|
22
|
-
export { default as
|
22
|
+
export { default as DatePickerQuickPickReact } from './_date_picker_quick_pick_react'
|
23
|
+
export { default as DatePickerQuickPickRangeLimit } from './_date_picker_quick_pick_range_limit'
|
24
|
+
export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import React, { useRef, useEffect, useState } from 'react'
|
2
|
+
import { Map, mapTheme, MapCustomButton } from '../..'
|
3
|
+
import maplibregl from 'maplibre-gl'
|
4
|
+
|
5
|
+
const MapWithCustomButton = (props) => {
|
6
|
+
|
7
|
+
//set Map instance to access from outside useEffect
|
8
|
+
const [mapInstance, setMapInstance] = useState(null)
|
9
|
+
const mapContainerRef = useRef(null)
|
10
|
+
|
11
|
+
//Set default position
|
12
|
+
const defaultPosition = [-75.379143, 39.831200]
|
13
|
+
|
14
|
+
// linking Maplibre methods to PB custom zoom in, zoom out, and fly to buttons
|
15
|
+
const handleZoomIn = (map) => {map.zoomIn({...mapTheme.zoomConfig})}
|
16
|
+
const handleZoomOut = (map) => {map.zoomOut({...mapTheme.zoomConfig})}
|
17
|
+
const handleFlyTo = (map) => {map.flyTo({
|
18
|
+
center: defaultPosition,
|
19
|
+
... mapTheme.flyToConfig
|
20
|
+
});}
|
21
|
+
|
22
|
+
//This function is called by the useEffect when map instance first loads
|
23
|
+
const loadMap = ( { target: map }) => {
|
24
|
+
//set marker/pin
|
25
|
+
new maplibregl.Marker({
|
26
|
+
color: mapTheme.marker,
|
27
|
+
}).setLngLat(defaultPosition)
|
28
|
+
.setPopup(new maplibregl.Popup({closeButton: false}).setHTML(`<h4 class="pb_title_kit_size_4">Hello World!</h4>`)) // add popup
|
29
|
+
.addTo(map);
|
30
|
+
|
31
|
+
// disable map zoom when using scroll
|
32
|
+
map.scrollZoom.disable();
|
33
|
+
|
34
|
+
//add attributioncontrols
|
35
|
+
map.addControl(new maplibregl.AttributionControl({
|
36
|
+
compact: true
|
37
|
+
}));
|
38
|
+
|
39
|
+
//set map instance
|
40
|
+
setMapInstance(map)
|
41
|
+
}
|
42
|
+
|
43
|
+
useEffect(() => {
|
44
|
+
new maplibregl.Map({
|
45
|
+
container: mapContainerRef.current,
|
46
|
+
center: defaultPosition,
|
47
|
+
...mapTheme.mapConfig
|
48
|
+
}).on('load', loadMap)
|
49
|
+
|
50
|
+
}, [])
|
51
|
+
|
52
|
+
return (
|
53
|
+
<Map
|
54
|
+
{...props}
|
55
|
+
>
|
56
|
+
<Map.Controls flyTo
|
57
|
+
flyToClick={()=> {handleFlyTo(mapInstance)}}
|
58
|
+
zoomBtns
|
59
|
+
zoomInClick={() => {handleZoomIn(mapInstance)}}
|
60
|
+
zoomOutClick={()=> {handleZoomOut(mapInstance)}}
|
61
|
+
>
|
62
|
+
<MapCustomButton icon="home"
|
63
|
+
onClick={() => alert("button clicked!")}
|
64
|
+
/>
|
65
|
+
<MapCustomButton icon="search"
|
66
|
+
onClick={() => alert("button clicked!")}
|
67
|
+
/>
|
68
|
+
</Map.Controls>
|
69
|
+
<div
|
70
|
+
ref={mapContainerRef}
|
71
|
+
style={{
|
72
|
+
position: 'absolute',
|
73
|
+
left: 0,
|
74
|
+
right: 0,
|
75
|
+
top: 0,
|
76
|
+
bottom: 0,
|
77
|
+
}}
|
78
|
+
/>
|
79
|
+
</Map>
|
80
|
+
)
|
81
|
+
}
|
82
|
+
|
83
|
+
export default MapWithCustomButton
|
@@ -0,0 +1 @@
|
|
1
|
+
If you want to add custom buttons to the Map, you can use the `MapCustomButton` component nested inside Map.Controls as shown in the code snippet below. Note that when Map.Controls is used in this way, the props for the rest of the buttons must also be passed to Map.Controls instead of the Map itself.
|