@kaspernj/api-maker 1.0.2024 → 1.0.2026

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 (61) hide show
  1. package/build/bootstrap/attribute-row.js +5 -5
  2. package/build/bootstrap/sort-link.js +3 -3
  3. package/build/draggable-sort/index.js +6 -6
  4. package/build/draggable-sort/item.js +6 -6
  5. package/build/link.js +2 -2
  6. package/build/modal.js +4 -4
  7. package/build/super-admin/edit-page/edit-attribute-checkbox.js +3 -3
  8. package/build/super-admin/edit-page/edit-attribute-input.js +4 -4
  9. package/build/super-admin/edit-page/edit-attribute.js +5 -5
  10. package/build/super-admin/edit-page.js +5 -5
  11. package/build/super-admin/layout/header/index.js +13 -16
  12. package/build/super-admin/layout/menu/index.js +7 -7
  13. package/build/table/column-content.js +6 -6
  14. package/build/table/filters/filter.js +4 -4
  15. package/build/table/filters/index.js +7 -5
  16. package/build/table/header-column-content.js +6 -6
  17. package/build/table/header-column.js +3 -3
  18. package/build/table/header-select.js +5 -5
  19. package/build/table/model-column.js +4 -4
  20. package/build/table/model-row.js +9 -9
  21. package/build/table/settings/column-row.js +3 -3
  22. package/build/table/settings/download-action.js +3 -3
  23. package/build/table/settings/index.js +8 -8
  24. package/build/table/table.js +10 -14
  25. package/build/utils/card.js +11 -10
  26. package/build/utils/checkbox.js +15 -14
  27. package/build/utils/checkboxes.js +9 -11
  28. package/build/utils/icon.js +1 -6
  29. package/build/utils/invalid-feedback.js +2 -2
  30. package/build/utils/modal.js +11 -10
  31. package/package.json +2 -2
  32. package/src/bootstrap/attribute-row.jsx +2 -2
  33. package/src/bootstrap/sort-link.jsx +2 -2
  34. package/src/draggable-sort/index.jsx +23 -24
  35. package/src/draggable-sort/item.jsx +11 -14
  36. package/src/link.jsx +1 -1
  37. package/src/modal.jsx +3 -3
  38. package/src/super-admin/edit-page/edit-attribute-checkbox.jsx +4 -1
  39. package/src/super-admin/edit-page/edit-attribute-input.jsx +11 -3
  40. package/src/super-admin/edit-page/edit-attribute.jsx +5 -2
  41. package/src/super-admin/edit-page.jsx +4 -4
  42. package/src/super-admin/layout/header/index.jsx +13 -13
  43. package/src/super-admin/layout/menu/index.jsx +6 -6
  44. package/src/table/column-content.jsx +2 -2
  45. package/src/table/filters/filter.jsx +6 -2
  46. package/src/table/filters/index.jsx +2 -2
  47. package/src/table/header-column-content.jsx +5 -5
  48. package/src/table/header-column.jsx +2 -2
  49. package/src/table/header-select.jsx +9 -4
  50. package/src/table/model-column.jsx +3 -3
  51. package/src/table/model-row.jsx +9 -5
  52. package/src/table/settings/column-row.jsx +1 -1
  53. package/src/table/settings/download-action.jsx +2 -2
  54. package/src/table/settings/index.jsx +7 -7
  55. package/src/table/table.jsx +8 -8
  56. package/src/utils/card.jsx +24 -17
  57. package/src/utils/checkbox.jsx +10 -17
  58. package/src/utils/checkboxes.jsx +8 -9
  59. package/src/utils/icon.jsx +0 -4
  60. package/src/utils/invalid-feedback.jsx +1 -1
  61. package/src/utils/modal.jsx +14 -10
@@ -47,13 +47,21 @@ export default memo(shapeComponent(class EditAttributeInput extends BaseComponen
47
47
  <Text>{label}</Text>
48
48
  <View>
49
49
  <TextInput
50
- dataSet={{
50
+ dataSet={this.cache("textInputDataSet", {
51
51
  attribute: attributeName,
52
52
  id,
53
53
  name
54
- }}
54
+ }, [attributeName, id, name])}
55
55
  onChangeText={this.tt.onChangeText}
56
- style={{paddingTop: 9, paddingRight: 13, paddingBottom: 9, paddingLeft: 13, borderRadius: 5, backgroundColor: "#fff", border: "1px solid #cecece"}}
56
+ style={this.textInputStyle ||= {
57
+ paddingTop: 9,
58
+ paddingRight: 13,
59
+ paddingBottom: 9,
60
+ paddingLeft: 13,
61
+ borderRadius: 5,
62
+ backgroundColor: "#fff",
63
+ border: "1px solid #cecece"
64
+ }}
57
65
  value={value}
58
66
  />
59
67
  </View>
@@ -26,7 +26,10 @@ export default memo(shapeComponent(class EditAttribute extends BaseComponent {
26
26
  const modelAttribute = modelClass.attributes().find((modelAttributeI) => modelAttributeI.name() == attribute.attribute)
27
27
 
28
28
  return (
29
- <View dataSet={{component: "api-maker/super-admin/edit-page/edit-attribute"}} style={{marginBottom: attribute.translated ? undefined : 12}}>
29
+ <View
30
+ dataSet={this.rootViewDataSet ||= {component: "api-maker/super-admin/edit-page/edit-attribute"}}
31
+ style={this.cache("rootViewStyle", {marginBottom: attribute.translated ? undefined : 12}, [attribute.translated])}
32
+ >
30
33
  {(() => {
31
34
  if (attribute.content) {
32
35
  return (
@@ -41,7 +44,7 @@ export default memo(shapeComponent(class EditAttribute extends BaseComponent {
41
44
  return (
42
45
  <>
43
46
  {availableLocales.map((locale) =>
44
- <View key={locale} style={{marginBottom: 12}}>
47
+ <View key={locale} style={this.localeViewStyle ||= {marginBottom: 12}}>
45
48
  <EditAttributeInput
46
49
  attributeName={`${attribute.attribute}${inflection.camelize(locale)}`}
47
50
  id={`${inflection.underscore(camelizedLower)}_${inflection.underscore(attribute.attribute)}_${locale}`}
@@ -74,16 +74,16 @@ export default memo(shapeComponent(class ApiMakerSuperAdminEditPage extends Base
74
74
  const extraContent = this.configReader.modelConfig?.edit?.extraContentconst
75
75
 
76
76
  return (
77
- <View dataSet={{class: "super-admin--edit-page"}}>
77
+ <View dataSet={this.rootViewDataSet ||= {class: "super-admin--edit-page"}}>
78
78
  <Form setForm={this.setStates.form}>
79
79
  {model && attributes?.map((attribute) =>
80
80
  <EditAttribute attribute={attribute} key={attribute.attribute} model={model} modelClass={modelClass} />
81
81
  )}
82
82
  {extraContent && extraContent(modelArgs)}
83
83
  <Pressable
84
- dataSet={{class: "submit-button"}}
84
+ dataSet={this.pressableDataSet ||= {class: "submit-button"}}
85
85
  onPress={this.tt.onSubmit}
86
- style={{
86
+ style={this.pressableStyle ||= {
87
87
  paddingTop: 18,
88
88
  paddingRight: 24,
89
89
  paddingBottom: 18,
@@ -93,7 +93,7 @@ export default memo(shapeComponent(class ApiMakerSuperAdminEditPage extends Base
93
93
  marginTop: 10
94
94
  }}
95
95
  >
96
- <Text style={{color: "#fff"}}>
96
+ <Text style={this.buttonTextStyle ||= {color: "#fff"}}>
97
97
  Submit
98
98
  </Text>
99
99
  </Pressable>
@@ -90,16 +90,16 @@ export default memo(shapeComponent(class ApiMakerSuperAdminLayoutHeader extends
90
90
  }
91
91
 
92
92
  return (
93
- <View dataSet={{component: "super-admin--layout--header"}} style={headerStyle}>
94
- <View dataSet={{class: "header-title-container"}}>
95
- <Text style={{color: "#282a33", fontSize: 22}}>
93
+ <View dataSet={this.rootViewDataSet ||= {component: "super-admin--layout--header"}} style={headerStyle}>
94
+ <View dataSet={this.headerTitleViewDataSet ||= {class: "header-title-container"}}>
95
+ <Text style={this.headerTitleTextStyle ||= {color: "#282a33", fontSize: 22}}>
96
96
  {title}
97
97
  </Text>
98
98
  </View>
99
99
  {actions &&
100
100
  <View dataSet={{active: this.s.headerActionsActive, class: "header-actions-container"}} style={headerActionsContainerStyle}>
101
101
  <View
102
- dataSet={{class: "header-actions"}}
102
+ dataSet={this.headerActionsViewDataSet ||= {class: "header-actions"}}
103
103
  ref={this.tt.headerActionsRef}
104
104
  style={headerActionsStyle}
105
105
  >
@@ -109,18 +109,22 @@ export default memo(shapeComponent(class ApiMakerSuperAdminLayoutHeader extends
109
109
  }
110
110
  {!mdUp &&
111
111
  <View
112
- dataSet={{class: "burger-menu-container"}}
113
- style={{
112
+ dataSet={this.burgerMenuContainerDataSet ||= {class: "burger-menu-container"}}
113
+ style={this.burgerMenuContainerStyle ||= {
114
114
  flexDirection: "row",
115
115
  marginLeft: "auto"
116
116
  }}
117
117
  >
118
118
  {actions &&
119
- <Pressable dataSet={{class: "actions-link"}} onPress={this.tt.onGearsClicked} style={{marginRight: 8, fontSize: 22}}>
119
+ <Pressable
120
+ dataSet={this.actionsLinkDataSet ||= {class: "actions-link"}}
121
+ onPress={this.tt.onGearsClicked}
122
+ style={this.actionsLinkStyle ||= {marginRight: 8, fontSize: 22}}
123
+ >
120
124
  <Icon name="gear" size={20} />
121
125
  </Pressable>
122
126
  }
123
- <Pressable dataSet={{class: "burger-menu-link"}} onPress={onTriggerMenu}>
127
+ <Pressable dataSet={this.burgerMenuLinkDataSet ||= {class: "burger-menu-link"}} onPress={onTriggerMenu}>
124
128
  <Icon name="bars" size={20} />
125
129
  </Pressable>
126
130
  </View>
@@ -129,11 +133,7 @@ export default memo(shapeComponent(class ApiMakerSuperAdminLayoutHeader extends
129
133
  )
130
134
  }
131
135
 
132
- onGearsClicked = () => {
133
- console.log("onGearsClicked")
134
-
135
- this.setState({headerActionsActive: !this.s.headerActionsActive})
136
- }
136
+ onGearsClicked = () => this.setState({headerActionsActive: !this.s.headerActionsActive})
137
137
 
138
138
  onWindowMouseUp = (e) => {
139
139
  // Close the header actions menu if clicked happened outside
@@ -85,20 +85,20 @@ export default memo(shapeComponent(class ComponentsAdminLayoutMenu extends BaseC
85
85
  }
86
86
 
87
87
  return (
88
- <View dataSet={{component: "super-admin--layout--menu", triggered}} style={style}>
89
- <WithDefaultStyle style={{Text: {color: "#fff"}}}>
88
+ <View dataSet={this.rootViewDataSet ||= {component: "super-admin--layout--menu", triggered}} style={style}>
89
+ <WithDefaultStyle style={this.withDefaultStyleStyle ||= {Text: {color: "#fff"}}}>
90
90
  <View
91
- dataSet={{class: "menu-logo"}}
92
- style={{
91
+ dataSet={this.menuLogoViewDataSet ||= {class: "menu-logo"}}
92
+ style={this.menuLogoViewStyle ||= {
93
93
  overflow: "hidden",
94
94
  marginTop: 25,
95
95
  marginRight: "auto",
96
96
  marginLeft: "auto"
97
97
  }}
98
98
  >
99
- <Link dataSet={{class: "menu-logo-link"}} to={Params.withParams({})}>
99
+ <Link dataSet={this.menuLogoLinkDataSet ||= {class: "menu-logo-link"}} to={Params.withParams({})}>
100
100
  <Text
101
- style={{
101
+ style={this.menuLogoLinkTextStyle ||= {
102
102
  fontSize: 42,
103
103
  textOverflow: "ellipsis",
104
104
  whiteSpace: "nowrap"
@@ -73,7 +73,7 @@ export default class ApiMakerTableColumnContent {
73
73
  }
74
74
  }
75
75
 
76
- presentColumnValue(value) {
76
+ presentColumnValue = (value) => {
77
77
  let contentText
78
78
 
79
79
  if (value instanceof Date) {
@@ -106,7 +106,7 @@ export default class ApiMakerTableColumnContent {
106
106
  return <Text>{contentText}</Text>
107
107
  }
108
108
 
109
- presentDateTime({apiMakerType, value}) {
109
+ presentDateTime = ({apiMakerType, value}) => {
110
110
  if (!apiMakerType || apiMakerType == "time") {
111
111
  const dateTimeFormatName = this.table.props.defaultDateTimeFormatName || "time.formats.default"
112
112
 
@@ -30,7 +30,7 @@ export default memo(shapeComponent(class ApiMakerTableFilter extends BaseCompone
30
30
  const {a, pre, sc} = this.props
31
31
 
32
32
  return (
33
- <View style={{alignItems: "center", flexDirection: "row", backgroundColor: "grey", paddingVertical: 10, paddingHorizontal: 6}}>
33
+ <View style={this.rootViewStyle ||= {alignItems: "center", flexDirection: "row", backgroundColor: "grey", paddingVertical: 10, paddingHorizontal: 6}}>
34
34
  <Pressable
35
35
  dataSet={{
36
36
  attribute: a,
@@ -46,7 +46,11 @@ export default memo(shapeComponent(class ApiMakerTableFilter extends BaseCompone
46
46
  {a} {sc} {pre} {v}
47
47
  </Text>
48
48
  </Pressable>
49
- <Pressable dataSet={{class: "remove-filter-button"}} onPress={this.tt.onRemoveFilterPressed} style={{marginLeft: 6}}>
49
+ <Pressable
50
+ dataSet={this.removeFilterButtonDataSet ||= {class: "remove-filter-button"}}
51
+ onPress={this.tt.onRemoveFilterPressed}
52
+ style={this.removeFilterButtonStyle ||= {marginLeft: 6}}
53
+ >
50
54
  <Icon name="remove" />
51
55
  </Pressable>
52
56
  </View>
@@ -42,7 +42,7 @@ export default memo(shapeComponent(class ApiMakerTableFilters extends BaseCompon
42
42
  const currentFilters = this.currentFilters()
43
43
 
44
44
  return (
45
- <View dataSet={{class: "api-maker--table--filters"}} style={{alignItems: "flex-start"}}>
45
+ <View dataSet={this.rootViewDataSet ||= {class: "api-maker--table--filters"}} style={this.rootViewStyle ||= {alignItems: "flex-start"}}>
46
46
  {filter &&
47
47
  <FilterForm
48
48
  filter={filter}
@@ -78,7 +78,7 @@ export default memo(shapeComponent(class ApiMakerTableFilters extends BaseCompon
78
78
  {...filterData}
79
79
  />
80
80
  )}
81
- <View className="filter-actions" style={{flexDirection: "row", marginTop: 10}}>
81
+ <View dataSet={this.filterActionsDataSet ||= {class: "filter-actions"}} style={this.filterActionsStyle ||= {flexDirection: "row", marginTop: 10}}>
82
82
  <button className="add-new-filter-button" onClick={this.tt.onAddFilterClicked}>
83
83
  {this.t(".add_new_filter", {defaultValue: "Add new filter"})}
84
84
  </button>
@@ -26,11 +26,11 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
26
26
 
27
27
  return (
28
28
  <View
29
- dataSet={{
29
+ dataSet={this.cache("rootViewDataSet", {
30
30
  component: "api-maker/table/header-column-content",
31
31
  identifier: tableSettingColumn.identifier()
32
- }}
33
- style={{display: "flex", flexDirection: "row", alignItems: "center"}}
32
+ }, [tableSettingColumn.identifier()])}
33
+ style={this.rootViewStyle ||= {display: "flex", flexDirection: "row", alignItems: "center"}}
34
34
  {...columnProps}
35
35
  >
36
36
  {tableSettingColumn.hasSortKey() && query &&
@@ -38,14 +38,14 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
38
38
  attribute={tableSettingColumn.sortKey()}
39
39
  defaultParams={defaultParams}
40
40
  query={query}
41
- style={{whiteSpace: "nowrap", overflow: "hidden"}}
41
+ style={this.sortLinkStyle ||= {whiteSpace: "nowrap", overflow: "hidden"}}
42
42
  textProps={{ellipsizeMode: "clip", numberOfLines: 1, style: styleForHeaderText()}}
43
43
  title={table.headerLabelForColumn(column)}
44
44
  {...this.props.sortLinkProps}
45
45
  />
46
46
  }
47
47
  {(!tableSettingColumn.hasSortKey() || !query) &&
48
- <Text ellipsizeMode="clip" numberOfLines={1} style={{fontWeight: "bold"}}>
48
+ <Text ellipsizeMode="clip" numberOfLines={1} style={this.headerLabelStyle ||= {fontWeight: "bold"}}>
49
49
  {table.headerLabelForColumn(column)}
50
50
  </Text>
51
51
  }
@@ -100,12 +100,12 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
100
100
  {...restColumnProps}
101
101
  >
102
102
  {mdUp &&
103
- <Icon name="bars" style={{marginRight: 3, fontSize: 12}} {...touchProps} />
103
+ <Icon name="bars" style={this.barsIconStyle ||= {marginRight: 3, fontSize: 12}} {...touchProps} />
104
104
  }
105
105
  <HeaderColumnContent column={column} table={table} tableSettingColumn={tableSettingColumn} />
106
106
  {mdUp &&
107
107
  <Animated.View
108
- style={{
108
+ style={this.resizeColumnViewStyle ||= {
109
109
  position: "absolute",
110
110
  top: 0,
111
111
  right: 0,
@@ -38,15 +38,20 @@ export default memo(shapeComponent(class ApiMakerTableHeaderSelect extends BaseC
38
38
  const columnLabel = column && table.headerLabelForColumn(column)
39
39
 
40
40
  return (
41
- <View dataSet={{component: "api-maker/table/header-select"}}>
41
+ <View dataSet={this.rootViewDataSet ||= {component: "api-maker/table/header-select"}}>
42
42
  {this.s.modalOpen &&
43
- <Modal dataSet={{class: "table-header-select-modal"}} onRequestClose={this.tt.onModalRequestClose} transparent>
43
+ <Modal dataSet={this.modalDataSet ||= {class: "table-header-select-modal"}} onRequestClose={this.tt.onModalRequestClose} transparent>
44
44
  {this.p.preparedColumns.map(({column, tableSettingColumn}) =>
45
45
  <View
46
46
  key={tableSettingColumn.identifier()}
47
- style={{marginVertical: 5}}
47
+ style={this.headerColumnContentViewStyle ||= {marginVertical: 5}}
48
48
  >
49
- <HeaderColumnContent column={column} table={table} tableSettingColumn={tableSettingColumn} sortLinkProps={{usePressable: true}} />
49
+ <HeaderColumnContent
50
+ column={column}
51
+ table={table}
52
+ tableSettingColumn={tableSettingColumn}
53
+ sortLinkProps={this.sortLinkProps ||= {usePressable: true}}
54
+ />
50
55
  </View>
51
56
  )}
52
57
  </Modal>
@@ -58,13 +58,13 @@ export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseCo
58
58
  {...restColumnProps}
59
59
  >
60
60
  {!mdUp &&
61
- <View dataSet={{class: "table--column-label"}}>
62
- <Text style={{fontWeight: "bold"}}>
61
+ <View dataSet={this.columnLabelDataSet ||= {class: "table--column-label"}}>
62
+ <Text style={this.columnLabelTextStyle ||= {fontWeight: "bold"}}>
63
63
  {table.headerLabelForColumn(column)}
64
64
  </Text>
65
65
  </View>
66
66
  }
67
- <View dataSet={{class: "table--column-value"}}>
67
+ <View dataSet={this.columnValueDataSet ||= {class: "table--column-value"}}>
68
68
  {new ColumnContent({column, l, model, t, table}).content()}
69
69
  </View>
70
70
  </Column>
@@ -63,11 +63,11 @@ export default memo(shapeComponent(class ApiMakerBootStrapLiveTableModelRow exte
63
63
  style={styleForRow({even})}
64
64
  >
65
65
  {workplace &&
66
- <Column dataSet={{class: "workplace-column"}} style={styleForColumn({even, style: {width: 41}})}>
66
+ <Column dataSet={this.columnDataSet ||= {class: "workplace-column"}} style={styleForColumn({even, style: {width: 41}})}>
67
67
  <WorkerPluginsCheckbox
68
68
  currentWorkplace={currentWorkplace}
69
69
  model={model}
70
- style={{marginHorizontal: "auto"}}
70
+ style={this.workerPluginsCheckboxStyle ||= {marginHorizontal: "auto"}}
71
71
  />
72
72
  </Column>
73
73
  }
@@ -75,17 +75,21 @@ export default memo(shapeComponent(class ApiMakerBootStrapLiveTableModelRow exte
75
75
  <Column dataSet={{class: "actions-column"}} style={styleForColumn({even, style: {}, type: "actions"})}>
76
76
  {actionsContent && actionsContent(this.tt.modelCallbackArgs)}
77
77
  {viewPath &&
78
- <Link dataSet={{class: "view-button"}} style={{marginLeft: 2, marginRight: 2}} to={viewPath}>
78
+ <Link dataSet={this.viewButtonDataSet ||= {class: "view-button"}} style={this.searchLinkStyle ||= {marginLeft: 2, marginRight: 2}} to={viewPath}>
79
79
  <Icon name="search" size={18} />
80
80
  </Link>
81
81
  }
82
82
  {editPath &&
83
- <Link dataSet={{class: "edit-button"}} style={{marginLeft: 2, marginRight: 2}} to={editPath}>
83
+ <Link dataSet={this.editButtonDataSet ||= {class: "edit-button"}} style={this.editButtonStyle ||= {marginLeft: 2, marginRight: 2}} to={editPath}>
84
84
  <Icon name="pencil" size={20} />
85
85
  </Link>
86
86
  }
87
87
  {destroyEnabled && model.can("destroy") &&
88
- <Pressable dataSet={{class: "destroy-button"}} style={{marginLeft: 2, marginRight: 2}} onPress={this.tt.onDestroyClicked}>
88
+ <Pressable
89
+ dataSet={this.destroyButtonDataSet ||= {class: "destroy-button"}}
90
+ style={this.destroyButtonStyle ||= {marginLeft: 2, marginRight: 2}}
91
+ onPress={this.tt.onDestroyClicked}
92
+ >
89
93
  <Icon name="remove" size={22} />
90
94
  </Pressable>
91
95
  }
@@ -35,7 +35,7 @@ export default memo(shapeComponent(class ColumnRow extends BaseComponent {
35
35
  }
36
36
 
37
37
  return (
38
- <View dataSet={{component: "api-maker--table--settings--column-row"}} style={{justifyContent: "center"}}>
38
+ <View dataSet={this.rootViewDataSet ||= {component: "api-maker--table--settings--column-row"}} style={this.rootViewStyle ||= {justifyContent: "center"}}>
39
39
  <label style={{whiteSpace: "nowrap"}}>
40
40
  <input
41
41
  className="api-maker--table--setings--column-checkbox"
@@ -20,9 +20,9 @@ export default memo(shapeComponent(class ApiMakerTableSettingsDownloadAction ext
20
20
 
21
21
  render() {
22
22
  return (
23
- <Pressable onPress={this.tt.onDownloadPress} style={{flexDirection: "row", alignItems: "center"}}>
23
+ <Pressable onPress={this.tt.onDownloadPress} style={this.pressableStyle ||= {flexDirection: "row", alignItems: "center"}}>
24
24
  <Icon name="download" size={20} />
25
- <Text style={{marginLeft: 5}}>
25
+ <Text style={this.textStyle ||= {marginLeft: 5}}>
26
26
  Download
27
27
  </Text>
28
28
  </Pressable>
@@ -33,10 +33,10 @@ export default memo(shapeComponent(class ApiMakerTableSettings extends BaseCompo
33
33
  const {preparedColumns} = table.s
34
34
 
35
35
  return (
36
- <Modal onBackdropPress={this.p.onRequestClose} onRequestClose={this.p.onRequestClose} style={{backgroundColor: "#000"}} transparent>
36
+ <Modal onBackdropPress={this.p.onRequestClose} onRequestClose={this.p.onRequestClose} style={this.rootModalStyle ||= {backgroundColor: "#000"}} transparent>
37
37
  <View
38
- dataSet={{class: "api-maker--table--settings"}}
39
- style={{
38
+ dataSet={this.rootViewDataSet ||= {class: "api-maker--table--settings"}}
39
+ style={this.rootViewStyle ||= {
40
40
  width: "100%",
41
41
  maxWidth: 800,
42
42
  padding: 20,
@@ -44,14 +44,14 @@ export default memo(shapeComponent(class ApiMakerTableSettings extends BaseCompo
44
44
  border: "1px solid black"
45
45
  }}
46
46
  >
47
- <View style={{marginBottom: 5}}>
48
- <Text style={{fontSize: 16, fontWeight: "bold"}}>
47
+ <View style={this.settingsHeaderViewStyle ||= {marginBottom: 5}}>
48
+ <Text style={this.settingsHeaderTextSTyle ||= {fontSize: 16, fontWeight: "bold"}}>
49
49
  {t(".settings", {defaultValue: "Settings"})}
50
50
  </Text>
51
51
  </View>
52
52
  <DownloadAction table={table} />
53
- <View style={{marginBottom: 5}}>
54
- <Text style={{fontSize: 16, fontWeight: "bold"}}>
53
+ <View style={this.columnsHeaderViewStyle ||= {marginBottom: 5}}>
54
+ <Text style={this.columnsHeaderTextStyle ||= {fontSize: 16, fontWeight: "bold"}}>
55
55
  {t(".columns", {defaultValue: "Columns"})}
56
56
  </Text>
57
57
  </View>
@@ -67,10 +67,10 @@ const ListHeaderComponent = memo(shapeComponent(class ListHeaderComponent extend
67
67
  <WorkerPluginsCheckAllCheckbox
68
68
  currentWorkplace={table.s.currentWorkplace}
69
69
  query={queryWithoutPagination}
70
- style={{marginHorizontal: "auto"}}
70
+ style={this.workerPlguinsCheckAllCheckboxStyle ||= {marginHorizontal: "auto"}}
71
71
  />
72
72
  {!mdUp &&
73
- <Text style={{marginLeft: 3}}>
73
+ <Text style={this.selectAllFoundTextStyle ||= {marginLeft: 3}}>
74
74
  {t(".select_all_found", {defaultValue: "Select all found"})}
75
75
  </Text>
76
76
  }
@@ -730,16 +730,16 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
730
730
  const {models, qParams, query, result} = digs(this.collection, "models", "qParams", "query", "result")
731
731
 
732
732
  return (
733
- <View style={{flexDirection: "row"}}>
733
+ <View style={this.rootViewStyle ||= {flexDirection: "row"}}>
734
734
  {controls && controls({models, qParams, query, result})}
735
735
  <Pressable dataSet={{class: "filter-button"}} onPress={this.tt.onFilterClicked}>
736
736
  <Icon name="search" size={20} />
737
737
  </Pressable>
738
- <View style={{position: "relative"}}>
738
+ <View>
739
739
  {showSettings &&
740
740
  <Settings onRequestClose={this.tt.onRequestCloseSettings} table={this} />
741
741
  }
742
- <Pressable dataSet={{class: "settings-button"}} onPress={this.tt.onSettingsClicked}>
742
+ <Pressable dataSet={this.settingsButtonDataSet ||= {class: "settings-button"}} onPress={this.tt.onSettingsClicked}>
743
743
  <Icon name="gear" size={20} />
744
744
  </Pressable>
745
745
  </View>
@@ -759,13 +759,13 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
759
759
  if (to === 0) from = 0
760
760
 
761
761
  return (
762
- <View style={{flexDirection: "row", justifyContent: "space-between", marginTop: 10}}>
763
- <View dataSet={{class: "showing-counts"}} style={{flexDirection: "row"}}>
762
+ <View style={this.rootViewStyle ||= {flexDirection: "row", justifyContent: "space-between", marginTop: 10}}>
763
+ <View dataSet={this.showingCountsDataSet ||= {class: "showing-counts"}} style={this.showingCountsStyle ||= {flexDirection: "row"}}>
764
764
  <Text>
765
765
  {this.t(".showing_from_to_out_of_total", {defaultValue, from, to, total_count: totalCount})}
766
766
  </Text>
767
767
  {this.p.workplace && this.s.currentWorkplaceCount !== null &&
768
- <Text style={{marginLeft: 3}}>
768
+ <Text style={this.xSelectedTextStyle ||= {marginLeft: 3}}>
769
769
  {this.t(".x_selected", {defaultValue: "%{selected} selected.", selected: this.s.currentWorkplaceCount})}
770
770
  </Text>
771
771
  }
@@ -1,11 +1,12 @@
1
- import BaseComponent from "../base-component"
1
+ import React, {useMemo} from "react"
2
+ import classNames from "classnames"
2
3
  import memo from "set-state-compare/src/memo"
3
4
  import PropTypes from "prop-types"
4
5
  import propTypesExact from "prop-types-exact"
5
- import {shapeComponent} from "set-state-compare/src/shape-component"
6
+ import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-component"
6
7
  import Text from "./text"
7
8
 
8
- export default memo(shapeComponent(class ApiMakerUtilsCard extends BaseComponent {
9
+ export default memo(shapeComponent(class ApiMakerUtilsCard extends ShapeComponent {
9
10
  static propTypes = propTypesExact({
10
11
  children: PropTypes.node,
11
12
  controls: PropTypes.node,
@@ -17,28 +18,34 @@ export default memo(shapeComponent(class ApiMakerUtilsCard extends BaseComponent
17
18
  render() {
18
19
  const {children, controls, dataSet, header, style} = this.props
19
20
  const {component, ...restDataSet} = dataSet || {}
20
- const actualDataSet = Object.assign(
21
- {component: classNames("api-maker/utils/card", component)},
22
- restDataSet
23
- )
24
- const actualStyle = Object.assign(
25
- {
26
- backgroundColor: "#fff",
27
- borderRadius: 15,
28
- padding: 30
29
- },
30
- style
31
- )
21
+
22
+ const actualDataSet = useMemo(() =>
23
+ Object.assign(
24
+ {component: classNames("api-maker/utils/card", component)},
25
+ restDataSet
26
+ )
27
+ , [component, restDataSet])
28
+
29
+ const actualStyle = useMemo(() =>
30
+ Object.assign(
31
+ {
32
+ backgroundColor: "#fff",
33
+ borderRadius: 15,
34
+ padding: 30
35
+ },
36
+ style
37
+ )
38
+ , [style])
32
39
 
33
40
  return (
34
41
  <View dataSet={actualDataSet} style={actualStyle}>
35
42
  {controls &&
36
- <View style={{position: "absolute", top: 15, right: 15}}>
43
+ <View style={this.controlsViewStyle ||= {position: "absolute", top: 15, right: 15}}>
37
44
  {controls}
38
45
  </View>
39
46
  }
40
47
  {header &&
41
- <Text style={{fontSize: 24}}>
48
+ <Text style={this.headerTextStyle ||= {fontSize: 24}}>
42
49
  {header}
43
50
  </Text>
44
51
  }
@@ -1,15 +1,17 @@
1
- import BaseComponent from "../base-component"
2
1
  import {CheckBox, Pressable, View} from "react-native"
2
+ import React, {useMemo} from "react"
3
+ import BaseComponent from "../base-component"
3
4
  import memo from "set-state-compare/src/memo"
4
5
  import PropTypes from "prop-types"
5
6
  import propTypesExact from "prop-types-exact"
6
- import React from "react"
7
7
  import {shapeComponent} from "set-state-compare/src/shape-component"
8
8
  import Text from "./text"
9
9
 
10
10
  export default memo(shapeComponent(class ApiMakerUtilsCheckbox extends BaseComponent {
11
11
  static defaultProps = {
12
- label: undefined
12
+ dataSet: null,
13
+ label: undefined,
14
+ style: null
13
15
  }
14
16
 
15
17
  static propTypes = propTypesExact({
@@ -38,28 +40,19 @@ export default memo(shapeComponent(class ApiMakerUtilsCheckbox extends BaseCompo
38
40
 
39
41
  render() {
40
42
  const {isChecked} = this.tt
41
- const {label} = this.p
42
- const {dataSet} = this.props
43
- const actualStyle = Object.assign(
44
- {flexDirection: "row", alignItems: "center"},
45
- this.props.style
46
- )
47
- const actualDataSet = Object.assign(
48
- {
49
- checked: isChecked
50
- },
51
- dataSet
52
- )
43
+ const {dataSet, label, style} = this.p
44
+ const actualStyle = useMemo(() => Object.assign({flexDirection: "row", alignItems: "center"}, style), [style])
45
+ const actualDataSet = useMemo(() => Object.assign({checked: isChecked}, dataSet), [dataSet, isChecked])
53
46
 
54
47
  return (
55
48
  <View
56
- dataSet={{component: "api-maker/utils/checkbox"}}
49
+ dataSet={this.viewContainerDataSet ||= {component: "api-maker/utils/checkbox"}}
57
50
  style={actualStyle}
58
51
  >
59
52
  <CheckBox dataSet={actualDataSet} onValueChange={this.tt.onValueChange} value={isChecked} />
60
53
  {label &&
61
54
  <Pressable onPress={this.tt.onLabelPressed}>
62
- <Text style={{marginLeft: 3}}>
55
+ <Text style={this.textStyle ||= {marginLeft: 3}}>
63
56
  {label}
64
57
  </Text>
65
58
  </Pressable>
@@ -22,16 +22,17 @@ const OptionElement = memo(shapeComponent(class OptionElement extends ShapeCompo
22
22
 
23
23
  render() {
24
24
  const {checked, inputName, option} = this.p
25
+ const dataSet = useMemo(() => ({
26
+ component: "api-maker/utils/checkboxes/option",
27
+ name: inputName,
28
+ value: option[1]
29
+ }), [inputName, option[1]])
25
30
 
26
31
  return (
27
32
  <View >
28
33
  <Checkbox
29
34
  checked={checked}
30
- dataSet={{
31
- component: "api-maker/utils/checkboxes/option",
32
- name: inputName,
33
- value: option[1]
34
- }}
35
+ dataSet={dataSet}
35
36
  label={option[0]}
36
37
  onCheckedChange={this.tt.onChange}
37
38
  />
@@ -88,8 +89,8 @@ export default memo(shapeComponent(class ApiMakerUtilsCheckboxes extends ShapeCo
88
89
  const {errors} = digs(wrapperOpts, "errors")
89
90
 
90
91
  return (
91
- <View dataSet={{component: "api-maker/utils/checkboxes"}}>
92
- <Text style={{fontWeight: "bold"}}>
92
+ <View dataSet={this.rootViewDataSet ||= {component: "api-maker/utils/checkboxes"}}>
93
+ <Text style={this.textStyle ||= {fontWeight: "bold"}}>
93
94
  {this.tt.wrapperOpts.label}
94
95
  </Text>
95
96
  {this.props.options.map((option) =>
@@ -145,8 +146,6 @@ export default memo(shapeComponent(class ApiMakerUtilsCheckboxes extends ShapeCo
145
146
  this.setState({checkedOptions: newOptions})
146
147
  }
147
148
 
148
- console.log({checkedOptions: this.s.checkedOptions})
149
-
150
149
  if (this.props.onChange) {
151
150
  this.p.onChange({checked, option})
152
151
  }
@@ -36,10 +36,6 @@ export default memo(shapeComponent(class ApiMakerUtilsIcon extends BaseComponent
36
36
  return actualStylesList
37
37
  }, [stylesList, style])
38
38
 
39
- if (this.props.name == "person") {
40
- console.log("Icon", {props: this.props})
41
- }
42
-
43
39
  if (version == "FontAwesome") {
44
40
  return <FontAwesomeIcon style={actualStylesList} {...restProps} />
45
41
  } else if (version == "FontAwesome5") {