playbook_ui 11.16.0.pre.alpha.paginationrails1 → 11.16.0.pre.alpha.reactupgrade1
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/_playbook.scss +0 -2
- data/app/pb_kits/playbook/data/menu.yml +0 -1
- data/app/pb_kits/playbook/index.js +2 -2
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +111 -0
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +151 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.html.erb +21 -9
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +47 -7
- data/app/pb_kits/playbook/pb_dashboard/{pbChartsDarkTheme.ts → pbChartsDarkTheme.js} +21 -6
- data/app/pb_kits/playbook/pb_dashboard/{pbChartsLightTheme.ts → pbChartsLightTheme.js} +21 -6
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +112 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +0 -4
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.html.erb +1 -1
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +8 -8
- data/app/pb_kits/playbook/pb_gauge/gauge.html.erb +11 -1
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +8 -3
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +113 -0
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +120 -130
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx +1 -1
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +79 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +1 -1
- data/app/pb_kits/playbook/playbook-doc.js +0 -2
- data/app/pb_kits/playbook/playbook-rails-react-bindings.js +0 -4
- data/app/pb_kits/playbook/playbook-rails.js +4 -0
- data/app/pb_kits/playbook/plugins/pb_chart.js +322 -0
- data/lib/playbook/kit_base.rb +0 -2
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook.rb +0 -1
- metadata +10 -36
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +0 -145
- data/app/pb_kits/playbook/pb_circle_chart/ChartsTypes.ts +0 -2
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +0 -207
- data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +0 -16
- data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +0 -16
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +0 -202
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +0 -148
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +0 -68
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -41
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.html.erb +0 -28
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +0 -12
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +0 -9
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +0 -7
- data/app/pb_kits/playbook/pb_pagination/pagination.rb +0 -18
- data/app/pb_kits/playbook/pb_pagination/pagination.test.jsx +0 -17
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +0 -111
- data/lib/playbook/pagination_renderer.rb +0 -41
@@ -1,28 +0,0 @@
|
|
1
|
-
<% @data = [{
|
2
|
-
first_name: 'Jon',
|
3
|
-
last_name: 'Ron',
|
4
|
-
email: "jon@mail.com",
|
5
|
-
id: 1,
|
6
|
-
}, {
|
7
|
-
first_name: 'Sam',
|
8
|
-
last_name: 'Bob',
|
9
|
-
email: "sam@mail.com",
|
10
|
-
id: 2,
|
11
|
-
}, {
|
12
|
-
first_name: 'Nick',
|
13
|
-
last_name: 'Jack',
|
14
|
-
email: "nick@mail.com",
|
15
|
-
id: 3,
|
16
|
-
}, {
|
17
|
-
first_name: 'Jake',
|
18
|
-
last_name: 'Wade',
|
19
|
-
email: "jon@mail.com",
|
20
|
-
id: 4,
|
21
|
-
}, {
|
22
|
-
first_name: 'Blake',
|
23
|
-
last_name: 'Chad',
|
24
|
-
email: "jon@mail.com",
|
25
|
-
id: 5,
|
26
|
-
}] %>
|
27
|
-
|
28
|
-
<%= pb_rails("pagination", props: { data: @data}) %>
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default as PaginationDefault } from './_pagination_default.jsx'
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "will_paginate/array"
|
4
|
-
module Playbook
|
5
|
-
module PbPagination
|
6
|
-
class Pagination < ::Playbook::KitBase
|
7
|
-
prop :data, type: Playbook::Props::Array,
|
8
|
-
default: []
|
9
|
-
def page_data
|
10
|
-
new_user_array = []
|
11
|
-
data.each do |user|
|
12
|
-
new_user_array.push(user)
|
13
|
-
end
|
14
|
-
new_user_array.paginate(page: params[:page], per_page: 3)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { renderKit } from '../utilities/test-utils'
|
2
|
-
|
3
|
-
import { Pagination } from '../'
|
4
|
-
|
5
|
-
/* See these resources for more testing info:
|
6
|
-
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
7
|
-
- https://jestjs.io/docs/en/using-matchers
|
8
|
-
*/
|
9
|
-
|
10
|
-
test('generated scaffold test - update me', () => {
|
11
|
-
const props = {
|
12
|
-
data: { testid: 'default' }
|
13
|
-
}
|
14
|
-
|
15
|
-
const kit = renderKit(Pagination , props)
|
16
|
-
expect(kit).toBeInTheDocument()
|
17
|
-
})
|
@@ -1,111 +0,0 @@
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
2
|
-
import classnames from "classnames";
|
3
|
-
|
4
|
-
import { globalProps } from "../utilities/globalProps";
|
5
|
-
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
6
|
-
|
7
|
-
import HighchartsReact from "highcharts-react-official";
|
8
|
-
import Highcharts from "highcharts";
|
9
|
-
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
10
|
-
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
|
-
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
12
|
-
import treemap from 'highcharts/modules/treemap'
|
13
|
-
|
14
|
-
type TreemapChartProps = {
|
15
|
-
chartData: {
|
16
|
-
name: string;
|
17
|
-
parent?: string | number;
|
18
|
-
value: number;
|
19
|
-
color?: string;
|
20
|
-
id?: string | number;
|
21
|
-
}[];
|
22
|
-
className?: string;
|
23
|
-
colors: string[];
|
24
|
-
dark?: boolean;
|
25
|
-
drillable: boolean;
|
26
|
-
grouped: boolean;
|
27
|
-
height?: string;
|
28
|
-
id: number | string;
|
29
|
-
title?: string;
|
30
|
-
tooltipHtml: string;
|
31
|
-
type?: string;
|
32
|
-
aria?: { [key: string]: string };
|
33
|
-
data?: { [key: string]: string };
|
34
|
-
};
|
35
|
-
|
36
|
-
const TreemapChart = ({
|
37
|
-
aria = {},
|
38
|
-
data = {},
|
39
|
-
chartData,
|
40
|
-
colors,
|
41
|
-
dark = false,
|
42
|
-
drillable = false,
|
43
|
-
grouped = false,
|
44
|
-
height,
|
45
|
-
id,
|
46
|
-
title = "",
|
47
|
-
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.value}</b>',
|
48
|
-
type = "treemap",
|
49
|
-
...props
|
50
|
-
}: TreemapChartProps) => {
|
51
|
-
const ariaProps = buildAriaProps(aria);
|
52
|
-
const dataProps = buildDataProps(data);
|
53
|
-
const setupTheme = () => {
|
54
|
-
dark
|
55
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
56
|
-
: Highcharts.setOptions(highchartsTheme);
|
57
|
-
};
|
58
|
-
treemap(Highcharts)
|
59
|
-
setupTheme();
|
60
|
-
|
61
|
-
const staticOptions = {
|
62
|
-
title: {
|
63
|
-
text: title,
|
64
|
-
},
|
65
|
-
chart: {
|
66
|
-
height: height,
|
67
|
-
type: type,
|
68
|
-
},
|
69
|
-
credits: false,
|
70
|
-
series: [
|
71
|
-
{
|
72
|
-
data: chartData,
|
73
|
-
},
|
74
|
-
],
|
75
|
-
plotOptions: {
|
76
|
-
treemap: {
|
77
|
-
tooltip: {
|
78
|
-
pointFormat: tooltipHtml,
|
79
|
-
},
|
80
|
-
allowTraversingTree: drillable,
|
81
|
-
colorByPoint: !grouped,
|
82
|
-
colors:
|
83
|
-
colors !== undefined && colors.length > 0
|
84
|
-
? mapColors(colors)
|
85
|
-
: highchartsTheme.colors,
|
86
|
-
},
|
87
|
-
},
|
88
|
-
};
|
89
|
-
|
90
|
-
const [options, setOptions] = useState({});
|
91
|
-
|
92
|
-
useEffect(() => {
|
93
|
-
|
94
|
-
setOptions({ ...staticOptions });
|
95
|
-
}, [chartData]);
|
96
|
-
|
97
|
-
return (
|
98
|
-
<HighchartsReact
|
99
|
-
containerProps={{
|
100
|
-
className: classnames(globalProps(props), "pb_treemap_chart"),
|
101
|
-
id: id,
|
102
|
-
...ariaProps,
|
103
|
-
...dataProps,
|
104
|
-
}}
|
105
|
-
highcharts={Highcharts}
|
106
|
-
options={options}
|
107
|
-
/>
|
108
|
-
);
|
109
|
-
};
|
110
|
-
|
111
|
-
export default TreemapChart;
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "will_paginate/view_helpers/action_view"
|
4
|
-
|
5
|
-
module Playbook
|
6
|
-
module Pagination
|
7
|
-
class Rails < WillPaginate::ActionView::LinkRenderer
|
8
|
-
def container_attributes
|
9
|
-
{ class: "pb_pagination" }
|
10
|
-
end
|
11
|
-
|
12
|
-
def page_number(page)
|
13
|
-
if page == current_page
|
14
|
-
tag("li", tag("span", page), class: "active")
|
15
|
-
else
|
16
|
-
tag("li", link(page, page, rel: rel_value(page)))
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def previous_or_next_page(page, text, classname)
|
21
|
-
if page
|
22
|
-
tag("li", link(text, page), class: classname)
|
23
|
-
else
|
24
|
-
tag("li", tag("span", text), class: "%s disabled")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def gap; end
|
29
|
-
|
30
|
-
def previous_page
|
31
|
-
num = @collection.current_page > 1 && @collection.current_page - 1
|
32
|
-
previous_or_next_page(num, "<i class='far fa-chevron-left fa-xs'></i>", "prev")
|
33
|
-
end
|
34
|
-
|
35
|
-
def next_page
|
36
|
-
num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
|
37
|
-
previous_or_next_page(num, "<i class='far fa-chevron-right fa-xs'></i>", "next")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|