playbook_ui 14.16.0.pre.rc.5 → 14.16.0
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/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +115 -5
- data/app/pb_kits/playbook/pb_draggable/_draggable.tsx +6 -4
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +35 -9
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +35 -28
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.jsx +184 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.jsx +97 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_drop_zones_colors.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +11 -2
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +65 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +3 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +67 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +67 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.scss +8 -1
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +10 -4
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +49 -24
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +4 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_click.jsx +13 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.tsx +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +5 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +23 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +40 -5
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.html.erb +76 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.jsx +94 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.html.erb +75 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.jsx +93 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.html.erb +75 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.jsx +93 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.html.erb +74 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.jsx +92 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent_default.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_error.jsx +97 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +71 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +14 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_multi_level_select/index.js +105 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +10 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +1 -0
- data/app/pb_kits/playbook/pb_nav/_nav.scss +5 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.html.erb +19 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -0
- data/app/pb_kits/playbook/pb_user/_user.tsx +78 -13
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.html.erb +22 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +40 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options_rails.md +5 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options_react.md +5 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_user/user.html.erb +27 -6
- data/app/pb_kits/playbook/pb_user/user.rb +17 -1
- data/app/pb_kits/playbook/pb_user/user.test.js +182 -1
- data/app/pb_kits/playbook/tokens/_colors.scss +1 -4
- data/app/pb_kits/playbook/utilities/object.test.js +139 -1
- data/app/pb_kits/playbook/utilities/object.ts +86 -0
- data/app/pb_kits/playbook/utilities/text.ts +1 -1
- data/dist/chunks/_typeahead-BuTZG1Jn.js +22 -0
- data/dist/chunks/_weekday_stacked-oT22q75-.js +45 -0
- data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
- data/dist/chunks/{lib-BeKPJYlk.js → lib-Co5y3V4K.js} +2 -2
- data/dist/chunks/{pb_form_validation-BvDxpfs-.js → pb_form_validation-DMajaRt3.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/multi_level_select_field.rb +2 -0
- data/lib/playbook/version.rb +1 -1
- metadata +35 -7
- data/dist/chunks/_typeahead-D720juMS.js +0 -22
- data/dist/chunks/_weekday_stacked-D_IMHltv.js +0 -45
- data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
@@ -9,6 +9,8 @@ import {
|
|
9
9
|
} from "../utilities/props";
|
10
10
|
import Icon from "../pb_icon/_icon";
|
11
11
|
import FormPill from "../pb_form_pill/_form_pill";
|
12
|
+
import Body from "../pb_body/_body";
|
13
|
+
import Caption from "../pb_caption/_caption";
|
12
14
|
import { cloneDeep } from "lodash";
|
13
15
|
import MultiLevelSelectOptions from "./multi_level_select_options";
|
14
16
|
import MultiLevelSelectContext from "./context";
|
@@ -35,11 +37,14 @@ type MultiLevelSelectProps = {
|
|
35
37
|
className?: string
|
36
38
|
data?: { [key: string]: string }
|
37
39
|
disabled?: boolean
|
40
|
+
error?: string
|
38
41
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
39
42
|
id?: string
|
40
43
|
inputDisplay?: "pills" | "none"
|
41
44
|
inputName?: string
|
45
|
+
label?: string
|
42
46
|
name?: string
|
47
|
+
required?: boolean
|
43
48
|
returnAllSelected?: boolean
|
44
49
|
treeData?: { [key: string]: string; }[] | any
|
45
50
|
onChange?: (event: { target: { name?: string; value: any } }) => void
|
@@ -56,11 +61,14 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
56
61
|
className,
|
57
62
|
data = {},
|
58
63
|
disabled = false,
|
64
|
+
error,
|
59
65
|
htmlOptions = {},
|
60
66
|
id,
|
61
67
|
inputDisplay = "pills",
|
62
68
|
inputName,
|
63
69
|
name,
|
70
|
+
label,
|
71
|
+
required = false,
|
64
72
|
returnAllSelected = false,
|
65
73
|
treeData,
|
66
74
|
onChange = () => null,
|
@@ -77,6 +85,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
77
85
|
const htmlProps = buildHtmlProps(htmlOptions);
|
78
86
|
const classes = classnames(
|
79
87
|
buildCss("pb_multi_level_select"),
|
88
|
+
error && "error",
|
80
89
|
globalProps(props),
|
81
90
|
className
|
82
91
|
);
|
@@ -113,7 +122,9 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
113
122
|
return;
|
114
123
|
}
|
115
124
|
return tree.map((item: { [key: string]: any }) => {
|
116
|
-
item.
|
125
|
+
if (!item.disabled) {
|
126
|
+
item.checked = check;
|
127
|
+
}
|
117
128
|
item.children = modifyRecursive(item.children, check);
|
118
129
|
return item;
|
119
130
|
});
|
@@ -124,12 +135,16 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
124
135
|
treeData: { [key: string]: any }[],
|
125
136
|
selectedIds: string[],
|
126
137
|
parent_id: string | null = null,
|
127
|
-
depth = 0
|
138
|
+
depth = 0,
|
139
|
+
parentDisabled = false
|
128
140
|
) => {
|
129
141
|
if (!Array.isArray(treeData)) {
|
130
142
|
return;
|
131
143
|
}
|
132
144
|
return treeData.map((item: { [key: string]: any } | any) => {
|
145
|
+
// An item is disabled if it is explicitly set as disabled or if its parent is disabled
|
146
|
+
const isDisabled = item.disabled || (parentDisabled && !returnAllSelected);
|
147
|
+
|
133
148
|
const newItem = {
|
134
149
|
...item,
|
135
150
|
checked: Boolean(
|
@@ -137,6 +152,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
137
152
|
),
|
138
153
|
parent_id,
|
139
154
|
depth,
|
155
|
+
disabled: isDisabled,
|
140
156
|
};
|
141
157
|
if (newItem.children && newItem.children.length > 0) {
|
142
158
|
const children =
|
@@ -147,7 +163,8 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
147
163
|
children,
|
148
164
|
selectedIds,
|
149
165
|
newItem.id,
|
150
|
-
depth + 1
|
166
|
+
depth + 1,
|
167
|
+
isDisabled
|
151
168
|
);
|
152
169
|
}
|
153
170
|
return newItem;
|
@@ -244,8 +261,9 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
244
261
|
return tree.map((item: any) => {
|
245
262
|
if (item.id != id) item.children = modifyValue(id, item.children, check);
|
246
263
|
else {
|
247
|
-
item.
|
248
|
-
|
264
|
+
if (!item.disabled) {
|
265
|
+
item.checked = check;
|
266
|
+
}
|
249
267
|
if (variant === "single") {
|
250
268
|
// Single select: no children should be checked
|
251
269
|
item.children = modifyRecursive(item.children, !check);
|
@@ -430,6 +448,12 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
430
448
|
className={classes}
|
431
449
|
id={id}
|
432
450
|
>
|
451
|
+
{label &&
|
452
|
+
<Caption
|
453
|
+
marginBottom="xs"
|
454
|
+
text={label}
|
455
|
+
/>
|
456
|
+
}
|
433
457
|
<MultiLevelSelectContext.Provider value={{
|
434
458
|
variant,
|
435
459
|
inputName,
|
@@ -453,6 +477,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
453
477
|
disabled={disabled}
|
454
478
|
key={selectedItem.id}
|
455
479
|
name={`${name}[]`}
|
480
|
+
required={required}
|
456
481
|
type="hidden"
|
457
482
|
value={selectedItem.id}
|
458
483
|
/>
|
@@ -467,6 +492,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
467
492
|
disabled={disabled}
|
468
493
|
key={item.id}
|
469
494
|
name={`${name}[]`}
|
495
|
+
required={required}
|
470
496
|
type="hidden"
|
471
497
|
value={item.id}
|
472
498
|
/>
|
@@ -479,6 +505,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
479
505
|
disabled={disabled}
|
480
506
|
key={item.id}
|
481
507
|
name={`${name}[]`}
|
508
|
+
required={required}
|
482
509
|
type="hidden"
|
483
510
|
value={item.id}
|
484
511
|
/>
|
@@ -539,6 +566,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
539
566
|
} selected`
|
540
567
|
: "Start typing..."
|
541
568
|
}
|
569
|
+
required={required}
|
542
570
|
value={singleSelectedItem.value || filterItem}
|
543
571
|
/>
|
544
572
|
</div>
|
@@ -571,6 +599,13 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
571
599
|
</div>
|
572
600
|
</div>
|
573
601
|
</MultiLevelSelectContext.Provider>
|
602
|
+
{error &&
|
603
|
+
<Body
|
604
|
+
dark={props.dark}
|
605
|
+
status="negative"
|
606
|
+
text={error}
|
607
|
+
/>
|
608
|
+
}
|
574
609
|
</div>
|
575
610
|
);
|
576
611
|
}) as MultiLevelSelectComponent;
|
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options.html.erb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
<% treeData = [{
|
2
|
+
label: "Power Home Remodeling",
|
3
|
+
value: "Power Home Remodeling",
|
4
|
+
id: "powerhome1",
|
5
|
+
expanded: true,
|
6
|
+
children: [
|
7
|
+
{
|
8
|
+
label: "People",
|
9
|
+
value: "People",
|
10
|
+
id: "people1",
|
11
|
+
expanded: true,
|
12
|
+
children: [
|
13
|
+
{
|
14
|
+
label: "Talent Acquisition",
|
15
|
+
value: "Talent Acquisition",
|
16
|
+
id: "talent1",
|
17
|
+
disabled: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
label: "Business Affairs",
|
21
|
+
value: "Business Affairs",
|
22
|
+
id: "business1",
|
23
|
+
children: [
|
24
|
+
{
|
25
|
+
label: "Initiatives",
|
26
|
+
value: "Initiatives",
|
27
|
+
id: "initiative1",
|
28
|
+
disabled: true,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
label: "Learning & Development",
|
32
|
+
value: "Learning & Development",
|
33
|
+
id: "development1",
|
34
|
+
},
|
35
|
+
],
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: "People Experience",
|
39
|
+
value: "People Experience",
|
40
|
+
id: "experience1",
|
41
|
+
},
|
42
|
+
],
|
43
|
+
},
|
44
|
+
{
|
45
|
+
label: "Contact Center",
|
46
|
+
value: "Contact Center",
|
47
|
+
id: "contact1",
|
48
|
+
children: [
|
49
|
+
{
|
50
|
+
label: "Appointment Management",
|
51
|
+
value: "Appointment Management",
|
52
|
+
id: "appointment1",
|
53
|
+
},
|
54
|
+
{
|
55
|
+
label: "Customer Service",
|
56
|
+
value: "Customer Service",
|
57
|
+
id: "customer1",
|
58
|
+
disabled: true,
|
59
|
+
},
|
60
|
+
{
|
61
|
+
label: "Energy",
|
62
|
+
value: "Energy",
|
63
|
+
id: "energy1",
|
64
|
+
},
|
65
|
+
],
|
66
|
+
},
|
67
|
+
],
|
68
|
+
}] %>
|
69
|
+
|
70
|
+
|
71
|
+
<%= pb_rails("multi_level_select", props: {
|
72
|
+
id: "multi-level-select-disabled-options-rails",
|
73
|
+
name: "disabled_options",
|
74
|
+
return_all_selected: true,
|
75
|
+
tree_data: treeData
|
76
|
+
}) %>
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import MultiLevelSelect from "../_multi_level_select";
|
3
|
+
|
4
|
+
const treeData = [
|
5
|
+
{
|
6
|
+
label: "Power Home Remodeling",
|
7
|
+
value: "Power Home Remodeling",
|
8
|
+
id: "powerhome1",
|
9
|
+
expanded: true,
|
10
|
+
children: [
|
11
|
+
{
|
12
|
+
label: "People",
|
13
|
+
value: "People",
|
14
|
+
id: "people1",
|
15
|
+
expanded: true,
|
16
|
+
children: [
|
17
|
+
{
|
18
|
+
label: "Talent Acquisition",
|
19
|
+
value: "Talent Acquisition",
|
20
|
+
id: "talent1",
|
21
|
+
disabled: true,
|
22
|
+
},
|
23
|
+
{
|
24
|
+
label: "Business Affairs",
|
25
|
+
value: "Business Affairs",
|
26
|
+
id: "business1",
|
27
|
+
children: [
|
28
|
+
{
|
29
|
+
label: "Initiatives",
|
30
|
+
value: "Initiatives",
|
31
|
+
id: "initiative1",
|
32
|
+
disabled: true,
|
33
|
+
},
|
34
|
+
{
|
35
|
+
label: "Learning & Development",
|
36
|
+
value: "Learning & Development",
|
37
|
+
id: "development1",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: "People Experience",
|
43
|
+
value: "People Experience",
|
44
|
+
id: "experience1",
|
45
|
+
},
|
46
|
+
],
|
47
|
+
},
|
48
|
+
{
|
49
|
+
label: "Contact Center",
|
50
|
+
value: "Contact Center",
|
51
|
+
id: "contact1",
|
52
|
+
children: [
|
53
|
+
{
|
54
|
+
label: "Appointment Management",
|
55
|
+
value: "Appointment Management",
|
56
|
+
id: "appointment1",
|
57
|
+
},
|
58
|
+
{
|
59
|
+
label: "Customer Service",
|
60
|
+
value: "Customer Service",
|
61
|
+
id: "customer1",
|
62
|
+
disabled: true,
|
63
|
+
},
|
64
|
+
{
|
65
|
+
label: "Energy",
|
66
|
+
value: "Energy",
|
67
|
+
id: "energy1",
|
68
|
+
},
|
69
|
+
],
|
70
|
+
},
|
71
|
+
],
|
72
|
+
},
|
73
|
+
];
|
74
|
+
|
75
|
+
const MultiLevelSelectDisabledOptions = (props) => {
|
76
|
+
return (
|
77
|
+
<div>
|
78
|
+
<MultiLevelSelect
|
79
|
+
id='multiselect-disabled-options'
|
80
|
+
onSelect={(selectedNodes) =>
|
81
|
+
console.log(
|
82
|
+
"Selected Items",
|
83
|
+
selectedNodes
|
84
|
+
)
|
85
|
+
}
|
86
|
+
returnAllSelected
|
87
|
+
treeData={treeData}
|
88
|
+
{...props}
|
89
|
+
/>
|
90
|
+
</div>
|
91
|
+
)
|
92
|
+
};
|
93
|
+
|
94
|
+
export default MultiLevelSelectDisabledOptions;
|
@@ -0,0 +1 @@
|
|
1
|
+
individual items can also be disabled by including the `disabled:true` within the object on the treeData for the `returnAllSelected`/`return_all_selected` variant. As noted above, this variant will return data on all checked nodes from the dropdown, irrespective of whether it is a parent or child node.
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<% treeData = [{
|
2
|
+
label: "Power Home Remodeling",
|
3
|
+
value: "Power Home Remodeling",
|
4
|
+
id: "powerhome1",
|
5
|
+
expanded: true,
|
6
|
+
children: [
|
7
|
+
{
|
8
|
+
label: "People",
|
9
|
+
value: "People",
|
10
|
+
id: "people1",
|
11
|
+
expanded: true,
|
12
|
+
children: [
|
13
|
+
{
|
14
|
+
label: "Talent Acquisition",
|
15
|
+
value: "Talent Acquisition",
|
16
|
+
id: "talent1",
|
17
|
+
disabled: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
label: "Business Affairs",
|
21
|
+
value: "Business Affairs",
|
22
|
+
id: "business1",
|
23
|
+
children: [
|
24
|
+
{
|
25
|
+
label: "Initiatives",
|
26
|
+
value: "Initiatives",
|
27
|
+
id: "initiative1",
|
28
|
+
disabled: true,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
label: "Learning & Development",
|
32
|
+
value: "Learning & Development",
|
33
|
+
id: "development1",
|
34
|
+
},
|
35
|
+
],
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: "People Experience",
|
39
|
+
value: "People Experience",
|
40
|
+
id: "experience1",
|
41
|
+
},
|
42
|
+
],
|
43
|
+
},
|
44
|
+
{
|
45
|
+
label: "Contact Center",
|
46
|
+
value: "Contact Center",
|
47
|
+
id: "contact1",
|
48
|
+
children: [
|
49
|
+
{
|
50
|
+
label: "Appointment Management",
|
51
|
+
value: "Appointment Management",
|
52
|
+
id: "appointment1",
|
53
|
+
},
|
54
|
+
{
|
55
|
+
label: "Customer Service",
|
56
|
+
value: "Customer Service",
|
57
|
+
id: "customer1",
|
58
|
+
disabled: true,
|
59
|
+
},
|
60
|
+
{
|
61
|
+
label: "Energy",
|
62
|
+
value: "Energy",
|
63
|
+
id: "energy1",
|
64
|
+
},
|
65
|
+
],
|
66
|
+
},
|
67
|
+
],
|
68
|
+
}] %>
|
69
|
+
|
70
|
+
|
71
|
+
<%= pb_rails("multi_level_select", props: {
|
72
|
+
id: "multi-level-select-disabled-options-default-rails",
|
73
|
+
name: "disabled_options_default",
|
74
|
+
tree_data: treeData
|
75
|
+
}) %>
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import MultiLevelSelect from "../_multi_level_select";
|
3
|
+
|
4
|
+
const treeData = [
|
5
|
+
{
|
6
|
+
label: "Power Home Remodeling",
|
7
|
+
value: "Power Home Remodeling",
|
8
|
+
id: "powerhome1",
|
9
|
+
expanded: true,
|
10
|
+
children: [
|
11
|
+
{
|
12
|
+
label: "People",
|
13
|
+
value: "People",
|
14
|
+
id: "people1",
|
15
|
+
expanded: true,
|
16
|
+
children: [
|
17
|
+
{
|
18
|
+
label: "Talent Acquisition",
|
19
|
+
value: "Talent Acquisition",
|
20
|
+
id: "talent1",
|
21
|
+
disabled: true,
|
22
|
+
},
|
23
|
+
{
|
24
|
+
label: "Business Affairs",
|
25
|
+
value: "Business Affairs",
|
26
|
+
id: "business1",
|
27
|
+
children: [
|
28
|
+
{
|
29
|
+
label: "Initiatives",
|
30
|
+
value: "Initiatives",
|
31
|
+
id: "initiative1",
|
32
|
+
disabled: true,
|
33
|
+
},
|
34
|
+
{
|
35
|
+
label: "Learning & Development",
|
36
|
+
value: "Learning & Development",
|
37
|
+
id: "development1",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: "People Experience",
|
43
|
+
value: "People Experience",
|
44
|
+
id: "experience1",
|
45
|
+
},
|
46
|
+
],
|
47
|
+
},
|
48
|
+
{
|
49
|
+
label: "Contact Center",
|
50
|
+
value: "Contact Center",
|
51
|
+
id: "contact1",
|
52
|
+
children: [
|
53
|
+
{
|
54
|
+
label: "Appointment Management",
|
55
|
+
value: "Appointment Management",
|
56
|
+
id: "appointment1",
|
57
|
+
},
|
58
|
+
{
|
59
|
+
label: "Customer Service",
|
60
|
+
value: "Customer Service",
|
61
|
+
id: "customer1",
|
62
|
+
disabled: true,
|
63
|
+
},
|
64
|
+
{
|
65
|
+
label: "Energy",
|
66
|
+
value: "Energy",
|
67
|
+
id: "energy1",
|
68
|
+
},
|
69
|
+
],
|
70
|
+
},
|
71
|
+
],
|
72
|
+
},
|
73
|
+
];
|
74
|
+
|
75
|
+
const MultiLevelSelectDisabledOptionsDefault = (props) => {
|
76
|
+
return (
|
77
|
+
<div>
|
78
|
+
<MultiLevelSelect
|
79
|
+
id='multiselect-disabled-options-default'
|
80
|
+
onSelect={(selectedNodes) =>
|
81
|
+
console.log(
|
82
|
+
"Selected Items",
|
83
|
+
selectedNodes
|
84
|
+
)
|
85
|
+
}
|
86
|
+
treeData={treeData}
|
87
|
+
{...props}
|
88
|
+
/>
|
89
|
+
</div>
|
90
|
+
)
|
91
|
+
};
|
92
|
+
|
93
|
+
export default MultiLevelSelectDisabledOptionsDefault;
|
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_default.md
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
To disable individual items in the treeData, include `disabled:true` within the object on the treeData that you want disabled. See the code snippet below for an example of how to do this.
|
2
|
+
|
3
|
+
If a parent is selected, the parent will be returned in the selected items list, even if it has disabled children.
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<% treeData = [{
|
2
|
+
label: "Power Home Remodeling",
|
3
|
+
value: "Power Home Remodeling",
|
4
|
+
id: "powerhome1",
|
5
|
+
expanded: true,
|
6
|
+
children: [
|
7
|
+
{
|
8
|
+
label: "People",
|
9
|
+
value: "People",
|
10
|
+
id: "people1",
|
11
|
+
expanded: true,
|
12
|
+
children: [
|
13
|
+
{
|
14
|
+
label: "Talent Acquisition",
|
15
|
+
value: "Talent Acquisition",
|
16
|
+
id: "talent1",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
label: "Business Affairs",
|
20
|
+
value: "Business Affairs",
|
21
|
+
id: "business1",
|
22
|
+
expanded: true,
|
23
|
+
disabled: true,
|
24
|
+
children: [
|
25
|
+
{
|
26
|
+
label: "Initiatives",
|
27
|
+
value: "Initiatives",
|
28
|
+
id: "initiative1",
|
29
|
+
},
|
30
|
+
{
|
31
|
+
label: "Learning & Development",
|
32
|
+
value: "Learning & Development",
|
33
|
+
id: "development1",
|
34
|
+
},
|
35
|
+
],
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: "People Experience",
|
39
|
+
value: "People Experience",
|
40
|
+
id: "experience1",
|
41
|
+
},
|
42
|
+
],
|
43
|
+
},
|
44
|
+
{
|
45
|
+
label: "Contact Center",
|
46
|
+
value: "Contact Center",
|
47
|
+
id: "contact1",
|
48
|
+
children: [
|
49
|
+
{
|
50
|
+
label: "Appointment Management",
|
51
|
+
value: "Appointment Management",
|
52
|
+
id: "appointment1",
|
53
|
+
},
|
54
|
+
{
|
55
|
+
label: "Customer Service",
|
56
|
+
value: "Customer Service",
|
57
|
+
id: "customer1",
|
58
|
+
},
|
59
|
+
{
|
60
|
+
label: "Energy",
|
61
|
+
value: "Energy",
|
62
|
+
id: "energy1",
|
63
|
+
},
|
64
|
+
],
|
65
|
+
},
|
66
|
+
],
|
67
|
+
}] %>
|
68
|
+
|
69
|
+
|
70
|
+
<%= pb_rails("multi_level_select", props: {
|
71
|
+
id: "mls-disabled-options-parent-rails",
|
72
|
+
name: "disabled_options_parent",
|
73
|
+
return_all_selected: true,
|
74
|
+
tree_data: treeData
|
75
|
+
}) %>
|
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.jsx
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import MultiLevelSelect from "../_multi_level_select";
|
3
|
+
|
4
|
+
const treeData = [
|
5
|
+
{
|
6
|
+
label: "Power Home Remodeling",
|
7
|
+
value: "Power Home Remodeling",
|
8
|
+
id: "powerhome1",
|
9
|
+
expanded: true,
|
10
|
+
children: [
|
11
|
+
{
|
12
|
+
label: "People",
|
13
|
+
value: "People",
|
14
|
+
id: "people1",
|
15
|
+
expanded: true,
|
16
|
+
children: [
|
17
|
+
{
|
18
|
+
label: "Talent Acquisition",
|
19
|
+
value: "Talent Acquisition",
|
20
|
+
id: "talent1",
|
21
|
+
},
|
22
|
+
{
|
23
|
+
label: "Business Affairs",
|
24
|
+
value: "Business Affairs",
|
25
|
+
id: "business1",
|
26
|
+
expanded: true,
|
27
|
+
disabled: true,
|
28
|
+
children: [
|
29
|
+
{
|
30
|
+
label: "Initiatives",
|
31
|
+
value: "Initiatives",
|
32
|
+
id: "initiative1",
|
33
|
+
},
|
34
|
+
{
|
35
|
+
label: "Learning & Development",
|
36
|
+
value: "Learning & Development",
|
37
|
+
id: "development1",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: "People Experience",
|
43
|
+
value: "People Experience",
|
44
|
+
id: "experience1",
|
45
|
+
},
|
46
|
+
],
|
47
|
+
},
|
48
|
+
{
|
49
|
+
label: "Contact Center",
|
50
|
+
value: "Contact Center",
|
51
|
+
id: "contact1",
|
52
|
+
children: [
|
53
|
+
{
|
54
|
+
label: "Appointment Management",
|
55
|
+
value: "Appointment Management",
|
56
|
+
id: "appointment1",
|
57
|
+
},
|
58
|
+
{
|
59
|
+
label: "Customer Service",
|
60
|
+
value: "Customer Service",
|
61
|
+
id: "customer1",
|
62
|
+
},
|
63
|
+
{
|
64
|
+
label: "Energy",
|
65
|
+
value: "Energy",
|
66
|
+
id: "energy1",
|
67
|
+
},
|
68
|
+
],
|
69
|
+
},
|
70
|
+
],
|
71
|
+
},
|
72
|
+
];
|
73
|
+
|
74
|
+
const MultiLevelSelectDisabledOptionsParent = (props) => {
|
75
|
+
return (
|
76
|
+
<div>
|
77
|
+
<MultiLevelSelect
|
78
|
+
id='multiselect-disabled-options-parent'
|
79
|
+
onSelect={(selectedNodes) =>
|
80
|
+
console.log(
|
81
|
+
"Selected Items",
|
82
|
+
selectedNodes
|
83
|
+
)
|
84
|
+
}
|
85
|
+
returnAllSelected
|
86
|
+
treeData={treeData}
|
87
|
+
{...props}
|
88
|
+
/>
|
89
|
+
</div>
|
90
|
+
)
|
91
|
+
};
|
92
|
+
|
93
|
+
export default MultiLevelSelectDisabledOptionsParent;
|
data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled_options_parent.md
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
For the `returnAllSelected`/`return_all_selected` variant, disabling the parent item will NOT automatically disable it's children since this version allows you to select a parent even if all children are unselected.
|
2
|
+
|
3
|
+
You can manually pass `disabled:true` to any and all children of a disabled parent if you want to do so.
|