playbook_ui 14.9.0.pre.alpha.PBNTR767advancedtablemultiheadercolumns5136 → 14.9.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5120
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_advanced_table/Components/TableHeaderCell.tsx +19 -32
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -37
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +18 -32
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +6 -1
- data/dist/chunks/{_typeahead-C63YYbKQ.js → _typeahead-BdFkerD3.js} +1 -1
- data/dist/chunks/_weekday_stacked-BiePMYeU.js +45 -0
- 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/version.rb +1 -1
- metadata +4 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.jsx +0 -74
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.md +0 -1
- data/dist/chunks/_weekday_stacked-CPOjyT4z.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da8a7920b5da846030bda1d8bcb3c18037bf19595c200269f9db7dd51764c766
|
4
|
+
data.tar.gz: 8a07e7da151e04fc89634772bd5ec1cd1ef27a8aef0b69858df3063485701a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39185b19e732294072ed4b0f2b331d12a6f897f8803b46651af31b95589087da685e8a2f72f1d5ae93b80159176d406d154fb35751fab93fc5fe3a96ca51cf07
|
7
|
+
data.tar.gz: bfd1b02747edb49bfafe7601fd23bc6e38c898439f7e85b363920a46344468a06da31bd776f4a51c5670e393c28523d65d636fb089ded77314b84c55b65f4c4a
|
@@ -40,59 +40,46 @@ export const TableHeaderCell = ({
|
|
40
40
|
|
41
41
|
const toggleSortButton = (event: React.SyntheticEvent) => {
|
42
42
|
if (sortControl) {
|
43
|
-
const sortIsDesc = header
|
43
|
+
const sortIsDesc = header.column.getIsSorted() === "desc"
|
44
44
|
sortIsDesc
|
45
45
|
? sortControl.onChange({ desc: true })
|
46
46
|
: sortControl.onChange({ desc: false })
|
47
47
|
} else {
|
48
|
-
header
|
48
|
+
header.column.getToggleSortingHandler()(event)
|
49
49
|
}
|
50
50
|
}
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
header?.column.getLeafColumns()[0].id === header.column.id
|
55
|
-
|
56
|
-
const isLastHeaderCell =
|
57
|
-
header?.column.parent?.columns.at(-1) === header?.column ||
|
58
|
-
(header?.colSpan > 1 && header?.column.parent !== undefined);
|
59
|
-
|
60
|
-
const cellClassName = classnames(
|
61
|
-
"table-header-cells",
|
62
|
-
`${isChrome() ? "chrome-styles" : ""}`,
|
52
|
+
const cellClassName = classnames("table-header-cells",
|
53
|
+
`${isChrome() ? "chrome-styles" : ""}`,
|
63
54
|
`${enableSorting ? "table-header-cells-active" : ""}`,
|
64
|
-
{
|
65
|
-
|
66
|
-
);
|
55
|
+
{ 'pinned-left': responsive === "scroll" && isPinnedLeft },
|
56
|
+
)
|
67
57
|
|
68
58
|
const cellId = `${loading ?
|
69
|
-
`loading-${header
|
70
|
-
: `${header
|
59
|
+
`loading-${header.id}`
|
60
|
+
: `${header.id}`
|
71
61
|
}`
|
72
62
|
|
73
63
|
const isToggleExpansionEnabledLoading =
|
74
|
-
header
|
64
|
+
header.index === 0 &&
|
75
65
|
loading &&
|
76
66
|
(enableToggleExpansion === "all" || "header") &&
|
77
67
|
enableToggleExpansion !== "none"
|
78
68
|
|
79
69
|
const isToggleExpansionEnabled =
|
80
|
-
header
|
70
|
+
header.index === 0 &&
|
81
71
|
!loading &&
|
82
72
|
(enableToggleExpansion === "all" || "header") &&
|
83
73
|
enableToggleExpansion !== "none"
|
84
74
|
|
85
|
-
const justifyHeader = isLeafColumn ? "end" : "center"
|
86
|
-
|
87
75
|
return (
|
88
76
|
<th
|
89
77
|
align="right"
|
90
78
|
className={cellClassName}
|
91
|
-
colSpan={header?.colSpan}
|
92
79
|
id={cellId}
|
93
|
-
key={`${header
|
80
|
+
key={`${header.id}-header`}
|
94
81
|
>
|
95
|
-
{header
|
82
|
+
{header.isPlaceholder ? null : headerChildren && header.index === 0 ? (
|
96
83
|
<Flex alignItems="center">
|
97
84
|
{headerChildren}
|
98
85
|
<div>
|
@@ -102,7 +89,7 @@ const justifyHeader = isLeafColumn ? "end" : "center"
|
|
102
89
|
) : (
|
103
90
|
<Flex
|
104
91
|
alignItems="center"
|
105
|
-
justify={header
|
92
|
+
justify={header.index === 0 && enableSorting ? "between" : header.index === 0 && !enableSorting ? "start" : "end"}
|
106
93
|
>
|
107
94
|
{isToggleExpansionEnabled && (
|
108
95
|
<ToggleIconButton onClick={handleExpandOrCollapse} />
|
@@ -113,11 +100,11 @@ const justifyHeader = isLeafColumn ? "end" : "center"
|
|
113
100
|
)}
|
114
101
|
|
115
102
|
<Flex
|
116
|
-
className={`${header
|
103
|
+
className={`${header.index === 0 &&
|
117
104
|
enableSorting &&
|
118
105
|
"header-sort-button pb_th_link"}`}
|
119
|
-
cursor={header
|
120
|
-
{...(header
|
106
|
+
cursor={header.index === 0 && enableSorting ? "pointer" : "default"}
|
107
|
+
{...(header.index === 0 &&
|
121
108
|
enableSorting && {
|
122
109
|
htmlOptions: {
|
123
110
|
onClick: (event: React.MouseEvent) => toggleSortButton(event),
|
@@ -129,14 +116,14 @@ const justifyHeader = isLeafColumn ? "end" : "center"
|
|
129
116
|
tabIndex: 0,
|
130
117
|
},
|
131
118
|
})}
|
132
|
-
justify={header
|
119
|
+
justify={header.index === 0 && enableSorting ? "between" : "none"}
|
133
120
|
paddingLeft={enableSorting ? "xxs" : "xs"}
|
134
121
|
>
|
135
122
|
<div>
|
136
|
-
{flexRender(header
|
123
|
+
{flexRender(header.column.columnDef.header, header.getContext())}
|
137
124
|
</div>
|
138
125
|
|
139
|
-
{header
|
126
|
+
{header.index === 0 &&
|
140
127
|
header.column.getCanSort() &&
|
141
128
|
enableSorting &&
|
142
129
|
(loading ? (
|
@@ -86,7 +86,6 @@ export const TableBody = ({
|
|
86
86
|
>
|
87
87
|
{row.getVisibleCells().map((cell, i) => {
|
88
88
|
const isPinnedLeft = columnPinning.left.includes(cell.column.id)
|
89
|
-
const isLastCell = cell.column.parent?.columns.at(-1)?.id === cell.column.id
|
90
89
|
|
91
90
|
return (
|
92
91
|
<td
|
@@ -94,8 +93,7 @@ export const TableBody = ({
|
|
94
93
|
className={classnames(
|
95
94
|
`${cell.id}-cell position_relative`,
|
96
95
|
isChrome() ? "chrome-styles" : "",
|
97
|
-
isPinnedLeft && 'pinned-left'
|
98
|
-
isLastCell && 'last-cell',
|
96
|
+
isPinnedLeft && 'pinned-left'
|
99
97
|
)}
|
100
98
|
key={`${cell.id}-data`}
|
101
99
|
>
|
@@ -31,43 +31,6 @@
|
|
31
31
|
min-width: 180px;
|
32
32
|
}
|
33
33
|
|
34
|
-
.pb_advanced_table_header {
|
35
|
-
> tr:not(:first-child) {
|
36
|
-
.last-header-cell {
|
37
|
-
border-right: 1px solid $border_light !important;
|
38
|
-
}
|
39
|
-
|
40
|
-
th {
|
41
|
-
border-radius: 0px !important;
|
42
|
-
border-width: 0 0 1px 0 !important;
|
43
|
-
}
|
44
|
-
th:first-child {
|
45
|
-
border-left-width: 1px !important;
|
46
|
-
@media only screen and (max-width: $screen-xl-min) {
|
47
|
-
border-left-width: 0 !important;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
th:last-child {
|
51
|
-
border-right-width: 1px !important;
|
52
|
-
@media only screen and (max-width: $screen-xl-min) {
|
53
|
-
border-right-width: 0 !important;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
th[colspan]:not([colspan="1"]) {
|
58
|
-
border-right: 1px solid $border_light;
|
59
|
-
}
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
|
64
|
-
.pb_advanced_table_body {
|
65
|
-
.last-cell {
|
66
|
-
border-right: 1px solid $border_light !important;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
|
71
34
|
.table-header-cells-active:first-child {
|
72
35
|
color: $primary !important;
|
73
36
|
}
|
@@ -142,41 +142,27 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
142
142
|
}
|
143
143
|
return columnCells
|
144
144
|
}
|
145
|
-
|
146
|
-
const
|
147
|
-
|
148
|
-
columnDefinitions &&
|
145
|
+
//Create column array in format needed by Tanstack
|
146
|
+
const columns =
|
147
|
+
columnDefinitions &&
|
149
148
|
columnDefinitions.map((column, index) => {
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
} else {
|
157
|
-
// Define the base column structure
|
158
|
-
const columnStructure = {
|
159
|
-
...columnHelper.accessor(column.accessor, {
|
160
|
-
header: column.label || "",
|
161
|
-
}),
|
162
|
-
};
|
163
|
-
|
164
|
-
if (column.cellAccessors || column.customRenderer) {
|
165
|
-
columnStructure.cell = createCellFunction(
|
166
|
-
column.cellAccessors,
|
167
|
-
column.customRenderer,
|
168
|
-
index
|
169
|
-
);
|
170
|
-
}
|
149
|
+
// Define the base column structure
|
150
|
+
const columnStructure = {
|
151
|
+
...columnHelper.accessor(column.accessor, {
|
152
|
+
header: column.label,
|
153
|
+
}),
|
154
|
+
}
|
171
155
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
156
|
+
if (column.cellAccessors || column.customRenderer) {
|
157
|
+
columnStructure.cell = createCellFunction(
|
158
|
+
column.cellAccessors,
|
159
|
+
column.customRenderer,
|
160
|
+
index
|
161
|
+
)
|
162
|
+
}
|
177
163
|
|
178
|
-
|
179
|
-
|
164
|
+
return columnStructure
|
165
|
+
})
|
180
166
|
|
181
167
|
//Syntax for sorting Array if we want to manage state ourselves
|
182
168
|
const sorting = [
|
@@ -21,5 +21,3 @@ examples:
|
|
21
21
|
- advanced_table_custom_cell: Custom Components for Cells
|
22
22
|
- advanced_table_pagination: Pagination
|
23
23
|
- advanced_table_pagination_with_props: Pagination Props
|
24
|
-
- advanced_table_column_headers: Multi-Header Columns
|
25
|
-
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
@@ -12,5 +12,3 @@ export { default as AdvancedTableResponsive } from './_advanced_table_responsive
|
|
12
12
|
export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cell.jsx'
|
13
13
|
export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
|
14
14
|
export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
|
15
|
-
export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
|
16
|
-
export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
|
@@ -123,6 +123,11 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
123
123
|
|
124
124
|
const childInput = children ? children.type === "input" : undefined
|
125
125
|
|
126
|
+
let formattedValue = value.toString()
|
127
|
+
if (isMaskedInput) {
|
128
|
+
formattedValue = INPUTMASKS[mask].format(formattedValue)
|
129
|
+
}
|
130
|
+
|
126
131
|
const textInput = (
|
127
132
|
childInput ? React.cloneElement(children, { className: "text_input" }) :
|
128
133
|
(<input
|
@@ -138,7 +143,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
138
143
|
ref={ref}
|
139
144
|
required={required}
|
140
145
|
type={type}
|
141
|
-
value={
|
146
|
+
value={formattedValue}
|
142
147
|
/>)
|
143
148
|
)
|
144
149
|
|