@controleonline/ui-default 1.0.284 → 1.0.285

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controleonline/ui-default",
3
- "version": "1.0.284",
3
+ "version": "1.0.285",
4
4
  "author": "ControleOnline",
5
5
  "description": "ControleOnline Default Quasar UI Component",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@ pinnedIdentityCell: {
46
46
  zIndex: 6,
47
47
  ...Platform.select({
48
48
  web: {
49
- boxShadow: '2px 0 0 rgba(226,232,240,0.9)',
49
+ boxShadow: '2px 0 6px rgba(15,23,42,0.08)',
50
50
  position: 'relative',
51
51
  },
52
52
  default: {},
@@ -57,7 +57,7 @@ pinnedActionsCell: {
57
57
  zIndex: 6,
58
58
  ...Platform.select({
59
59
  web: {
60
- boxShadow: '-2px 0 0 rgba(226,232,240,0.9)',
60
+ boxShadow: '-2px 0 6px rgba(15,23,42,0.08)',
61
61
  position: 'relative',
62
62
  },
63
63
  default: {},
@@ -27,6 +27,14 @@ import {getCompactColumnLabel} from './DefaultTableCompact.helpers';
27
27
  import useDefaultTableRowInteraction from './useDefaultTableRowInteraction';
28
28
  import useDefaultTableTheme from './useDefaultTableTheme';
29
29
 
30
+
31
+ const isIdentityColumn = column => {
32
+ if (!column) return false;
33
+ if (column.isIdentity === true) return true;
34
+ const key = String(getColumnKey(column) || '').toLowerCase();
35
+ return key === 'id' || key === 'uuid';
36
+ };
37
+
30
38
  /** Row stripes: themes-map listItemEvenRow / listItemOddRow — never status.color. */
31
39
  export const resolveRowBackgroundColor = ({ index, tableOddColor, tableEvenColor }) => {
32
40
  return index % 2 === 0 ? tableOddColor : tableEvenColor;
@@ -96,16 +104,22 @@ const DefaultTableRows = ({ storeName }) => {
96
104
  : next;
97
105
  });
98
106
  };
107
+ // Body cells live inside FlatList (own overflow). CSS position:sticky breaks there
108
+ // relative to the outer horizontal ScrollView — pin with translateX instead.
99
109
  const stickyBodyTransforms = useMemo(() => {
100
110
  const viewportWidth = Number(horizontalMetrics.viewportWidth || 0);
101
111
  const contentWidth = Number(horizontalMetrics.contentWidth || 0);
102
112
  const x = Number(horizontalMetrics.x || 0);
103
- const canScrollHorizontally = viewportWidth > 0 && contentWidth > viewportWidth;
104
- const actionsTranslateX = canScrollHorizontally
105
- ? x + viewportWidth - contentWidth
106
- : 0;
107
-
113
+ const canScrollHorizontally = viewportWidth > 0 && contentWidth > viewportWidth + 0.5;
114
+ if (!canScrollHorizontally) {
115
+ return { identity: null, actions: null };
116
+ }
117
+ // Identity stays at the left edge of the viewport.
118
+ const identityTranslateX = x;
119
+ // Actions stay at the right edge of the viewport.
120
+ const actionsTranslateX = x + viewportWidth - contentWidth;
108
121
  return {
122
+ identity: identityTranslateX !== 0 ? [{ translateX: identityTranslateX }] : null,
109
123
  actions:
110
124
  shouldPinRowActions && actionsTranslateX !== 0
111
125
  ? [{ translateX: actionsTranslateX }]
@@ -174,12 +188,15 @@ const DefaultTableRows = ({ storeName }) => {
174
188
  <React.Fragment key={getColumnKey(column)}>
175
189
  <DefaultTableInput
176
190
  column={column}
177
- options={{...(column?.isIdentity ? {
191
+ options={{...(isIdentityColumn(column) ? {
178
192
  cellStyle: [
179
193
  styles.pinnedIdentityCell,
180
- styles.stickyIdentityCell,
181
194
  {
182
195
  backgroundColor: rowBackgroundColor,
196
+ zIndex: 6,
197
+ ...(stickyBodyTransforms.identity
198
+ ? { transform: stickyBodyTransforms.identity }
199
+ : {}),
183
200
  },
184
201
  ],
185
202
  } : {
@@ -200,12 +217,12 @@ const DefaultTableRows = ({ storeName }) => {
200
217
  styles.cell,
201
218
  styles.actionsCell,
202
219
  shouldPinRowActions ? styles.pinnedActionsCell : null,
203
- shouldPinRowActions ? styles.stickyActionsCell : null,
204
220
  {
205
221
  minWidth: actionsCellWidth,
206
222
  width: actionsCellWidth,
207
223
  flexBasis: actionsCellWidth,
208
224
  maxWidth: actionsCellWidth,
225
+ zIndex: shouldPinRowActions ? 6 : undefined,
209
226
  ...(stickyBodyTransforms.actions
210
227
  ? { transform: stickyBodyTransforms.actions }
211
228
  : {}),
@@ -286,7 +303,7 @@ const DefaultTableRows = ({ storeName }) => {
286
303
  accessibilityHint={configs.resolvedSort?.field === sortFieldName ? `Ordem ${configs.resolvedSort.direction === 'asc' ? 'crescente' : 'decrescente'}` : undefined}
287
304
  style={[
288
305
  getColumnStyle(column),
289
- column?.isIdentity
306
+ isIdentityColumn(column)
290
307
  ? [styles.stickyIdentityCell, styles.stickyHeaderCell, { backgroundColor: tableHeaderColor }]
291
308
  : null,
292
309
  ]}
@@ -347,7 +364,7 @@ const DefaultTableRows = ({ storeName }) => {
347
364
  key={`${fieldName}-filter`}
348
365
  style={[
349
366
  getColumnStyle(column),
350
- column?.isIdentity
367
+ isIdentityColumn(column)
351
368
  ? [styles.stickyIdentityCell, { backgroundColor: tableHeaderColor }]
352
369
  : null,
353
370
  ]}