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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e0587b55894626bf9c1b536de994c6be32b554343ab23d48fbce936348df99c
4
- data.tar.gz: c27323f03b333905152b3f074197c3a151e3e64adf7c145a486e060d59e1168a
3
+ metadata.gz: da8a7920b5da846030bda1d8bcb3c18037bf19595c200269f9db7dd51764c766
4
+ data.tar.gz: 8a07e7da151e04fc89634772bd5ec1cd1ef27a8aef0b69858df3063485701a6f
5
5
  SHA512:
6
- metadata.gz: e2743697539265ab20f86e4a9ee8399c71ab490d02a22a14098f65c6002a8c598a81cfb429e086aa720e4008be1693ac5c467e44243abf9b5fbe31feaed54f4a
7
- data.tar.gz: eb592ba87c70fc8b736db3ce899a78447d4b7f2a78e2949067b063f588c0cfdea52f2936614147bc4c52a613242be414c44d50c5b59c00c4c28db04d0fb7e5f2
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?.column.getIsSorted() === "desc"
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?.column.getToggleSortingHandler()(event)
48
+ header.column.getToggleSortingHandler()(event)
49
49
  }
50
50
  }
51
51
 
52
- const isLeafColumn =
53
- header?.column.getLeafColumns().length === 1 &&
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
- { "pinned-left": responsive === "scroll" && isPinnedLeft },
65
- isLastHeaderCell ? "last-header-cell" : ""
66
- );
55
+ { 'pinned-left': responsive === "scroll" && isPinnedLeft },
56
+ )
67
57
 
68
58
  const cellId = `${loading ?
69
- `loading-${header?.id}`
70
- : `${header?.id}`
59
+ `loading-${header.id}`
60
+ : `${header.id}`
71
61
  }`
72
62
 
73
63
  const isToggleExpansionEnabledLoading =
74
- header?.index === 0 &&
64
+ header.index === 0 &&
75
65
  loading &&
76
66
  (enableToggleExpansion === "all" || "header") &&
77
67
  enableToggleExpansion !== "none"
78
68
 
79
69
  const isToggleExpansionEnabled =
80
- header?.index === 0 &&
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?.id}-header`}
80
+ key={`${header.id}-header`}
94
81
  >
95
- {header?.isPlaceholder ? null : headerChildren && header?.index === 0 ? (
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?.index === 0 && enableSorting ? "between" : header?.index === 0 && !enableSorting ? "start" : justifyHeader}
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?.index === 0 &&
103
+ className={`${header.index === 0 &&
117
104
  enableSorting &&
118
105
  "header-sort-button pb_th_link"}`}
119
- cursor={header?.index === 0 && enableSorting ? "pointer" : "default"}
120
- {...(header?.index === 0 &&
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?.index === 0 && enableSorting ? "between" : "none"}
119
+ justify={header.index === 0 && enableSorting ? "between" : "none"}
133
120
  paddingLeft={enableSorting ? "xxs" : "xs"}
134
121
  >
135
122
  <div>
136
- {flexRender(header?.column.columnDef.header, header?.getContext())}
123
+ {flexRender(header.column.columnDef.header, header.getContext())}
137
124
  </div>
138
125
 
139
- {header?.index === 0 &&
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 buildColumns = (columnDefinitions: GenericObject[]): any => {
147
- return (
148
- columnDefinitions &&
145
+ //Create column array in format needed by Tanstack
146
+ const columns =
147
+ columnDefinitions &&
149
148
  columnDefinitions.map((column, index) => {
150
- //Checking to see if grouped column or not
151
- if (column.columns && column.columns.length > 0) {
152
- return {
153
- header: column.label || "",
154
- columns: buildColumns(column.columns),
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
- return columnStructure;
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
- //Create column array in format needed by Tanstack
179
- const columns = buildColumns(columnDefinitions);
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={value}
146
+ value={formattedValue}
142
147
  />)
143
148
  )
144
149