@kaspernj/api-maker 1.0.436 → 1.0.437

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/table/table.jsx +33 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaspernj/api-maker",
3
- "version": "1.0.436",
3
+ "version": "1.0.437",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "index.js",
@@ -37,13 +37,6 @@ import Widths from "./widths"
37
37
 
38
38
  const paginationOptions = [30, 60, 90, ["All", "all"]]
39
39
  const WorkerPluginsCheckAllCheckbox = React.lazy(() => import("./worker-plugins-check-all-checkbox"))
40
- const styleSheet = StyleSheet.create({
41
- flatList: {
42
- border: "1px solid #dbdbdb",
43
- borderRadius: 5,
44
- overflowX: "auto"
45
- }
46
- })
47
40
  const TableContext = createContext()
48
41
 
49
42
  const ListHeaderComponent = memo(() => {
@@ -95,6 +88,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
95
88
  noRecordsFoundContent: undefined,
96
89
  preloads: [],
97
90
  select: {},
91
+ styleUI: true,
98
92
  workplace: false
99
93
  }
100
94
 
@@ -132,6 +126,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
132
126
  select: PropTypes.object,
133
127
  selectColumns: PropTypes.object,
134
128
  styles: PropTypes.object,
129
+ styleUI: PropTypes.bool.isRequired,
135
130
  viewModelPath: PropTypes.func,
136
131
  workplace: PropTypes.bool.isRequired
137
132
  }
@@ -180,7 +175,14 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
180
175
  widths: null
181
176
  })
182
177
 
183
- this.tableContextValue = useMemo(() => ({cacheKey: this.s.tableSettingFullCacheKey, table: this}), [this.s.tableSettingFullCacheKey])
178
+ this.tableContextValue = useMemo(
179
+ () => ({
180
+ cacheKey: this.s.tableSettingFullCacheKey,
181
+ lastUpdate: this.s.lastUpdate,
182
+ table: this
183
+ }),
184
+ [this.s.lastUpdate, this.s.tableSettingFullCacheKey]
185
+ )
184
186
 
185
187
  useMemo(() => {
186
188
  if (this.props.workplace) {
@@ -408,6 +410,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
408
410
  queryName,
409
411
  select,
410
412
  selectColumns,
413
+ styleUI,
411
414
  viewModelPath,
412
415
  workplace,
413
416
  ...restProps
@@ -432,6 +435,15 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
432
435
  }
433
436
  }
434
437
 
438
+ const flatListStyle = {
439
+ overflowX: "auto"
440
+ }
441
+
442
+ if (styleUI) {
443
+ flatListStyle.border = "1px solid #dbdbdb"
444
+ flatListStyle.borderRadius = 5
445
+ }
446
+
435
447
  const flatList = (
436
448
  <TableContext.Provider value={this.tt.tableContextValue}>
437
449
  <FlatList
@@ -442,7 +454,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
442
454
  ListHeaderComponent={ListHeaderComponent}
443
455
  renderItem={this.tt.renderItem}
444
456
  showsHorizontalScrollIndicator
445
- style={styleSheet.flatList}
457
+ style={flatListStyle}
446
458
  {...restProps}
447
459
  />
448
460
  </TableContext.Provider>
@@ -586,13 +598,19 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
586
598
  }
587
599
 
588
600
  styleForColumn = ({column, columnIndex, even, style, type}) => {
601
+ const {styleUI} = this.p
589
602
  const defaultStyle = {
590
603
  justifyContent: "center",
591
604
  padding: 8,
592
- backgroundColor: even ? "#f5f5f5" : undefined,
593
605
  overflow: "hidden"
594
606
  }
595
607
 
608
+ if (styleUI) {
609
+ Object.assign(defaultStyle, {
610
+ backgroundColor: even ? "#f5f5f5" : undefined
611
+ })
612
+ }
613
+
596
614
  if (type == "actions") {
597
615
  defaultStyle.flexDirection = "row"
598
616
  defaultStyle.alignItems = "center"
@@ -602,7 +620,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
602
620
  } else {
603
621
  defaultStyle.marginRight = "auto"
604
622
  }
605
- } else if (this.tt.mdUp) {
623
+ } else if (this.tt.mdUp && styleUI) {
606
624
  defaultStyle.borderRight = "1px solid #dbdbdb"
607
625
  }
608
626
 
@@ -621,7 +639,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
621
639
  padding: 8
622
640
  }
623
641
 
624
- if (type != "actions" && this.tt.mdUp) {
642
+ if (type != "actions" && this.tt.mdUp && this.p.styleUI) {
625
643
  defaultStyle.borderRight = "1px solid #dbdbdb"
626
644
  }
627
645
 
@@ -639,20 +657,20 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
639
657
  return actualStyle
640
658
  }
641
659
 
642
- styleForRow({even} = {}) {
660
+ styleForRow = ({even} = {}) => {
643
661
  const actualStyle = {
644
662
  flex: 1,
645
663
  alignItems: "stretch"
646
664
  }
647
665
 
648
- if (even) {
666
+ if (even && this.p.styleUI) {
649
667
  actualStyle.backgroundColor = "#f5f5f5"
650
668
  }
651
669
 
652
670
  return actualStyle
653
671
  }
654
672
 
655
- styleForRowHeader() {
673
+ styleForRowHeader = () => {
656
674
  const actualStyle = {
657
675
  flex: 1,
658
676
  alignItems: "stretch"