@kaspernj/api-maker 1.0.387 → 1.0.388

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": "@kaspernj/api-maker",
3
- "version": "1.0.387",
3
+ "version": "1.0.388",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "index.js",
@@ -36,8 +36,9 @@ export default class ApiMakerSuperAdminConfigReader {
36
36
 
37
37
  defaultAttributesToShow() {
38
38
  const attributesToShow = []
39
+ const {columns} = this.defaultTableColumns()
39
40
 
40
- for (const column of this.defaultTableColumns()) {
41
+ for (const column of columns) {
41
42
  attributesToShow.push(digg(column, "attribute"))
42
43
  }
43
44
 
@@ -51,13 +52,19 @@ export default class ApiMakerSuperAdminConfigReader {
51
52
  return modelConfig.table.columns()
52
53
  }
53
54
 
54
- return this.defaultTableColumns()
55
+ const {columns} = this.defaultTableColumns()
56
+
57
+ return columns
55
58
  }
56
59
 
57
60
  defaultTableColumns() {
58
61
  const {modelClass} = digs(this, "modelClass")
59
62
  const attributes = modelClass.attributes()
60
63
  const columns = []
64
+ const select = {}
65
+ const modelClassSelect = []
66
+
67
+ select[modelClass.modelClassData().name] = modelClassSelect
61
68
 
62
69
  for (const attribute of attributes) {
63
70
  if (!attribute.isSelectedByDefault() && attribute.name() != "name") {
@@ -75,9 +82,10 @@ export default class ApiMakerSuperAdminConfigReader {
75
82
  column.sortKey = `currentTranslation${camelizedName}`
76
83
  }
77
84
 
85
+ modelClassSelect.push(camelizedName)
78
86
  columns.push(column)
79
87
  }
80
88
 
81
- return columns
89
+ return {columns, select}
82
90
  }
83
91
  }
@@ -19,7 +19,7 @@ export default memo(shapeComponent(class ApiMakerSuperAdminModelClassTable exten
19
19
  const {modelClass, ...restProps} = this.props
20
20
  const currentUser = useCurrentUser()
21
21
  const configReader = useMemo(() => ConfigReader.forModel(modelClass), [modelClass])
22
- const columns = useMemo(() => configReader.tableColumns(), [modelClass])
22
+ const {columns, select} = useMemo(() => configReader.tableColumns(), [modelClass])
23
23
  const tableConfig = configReader.modelConfig?.table
24
24
  const tableProps = {}
25
25
 
@@ -31,6 +31,7 @@ export default memo(shapeComponent(class ApiMakerSuperAdminModelClassTable exten
31
31
  currentUser={currentUser}
32
32
  editModelPath={hasEditConfig(modelClass) ? this.tt.editModelPath : undefined}
33
33
  modelClass={modelClass}
34
+ select={select}
34
35
  viewModelPath={this.tt.viewModelPath}
35
36
  workplace
36
37
  {...tableProps}