@kaspernj/api-maker 1.0.448 → 1.0.450

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 (143) hide show
  1. package/build/bootstrap/attribute-row/index.js +2 -2
  2. package/build/bootstrap/attribute-rows.js +2 -1
  3. package/build/bootstrap/card.js +2 -2
  4. package/build/bootstrap/checkboxes.js +2 -2
  5. package/build/bootstrap/input.js +3 -2
  6. package/build/bootstrap/paginate.js +2 -2
  7. package/build/bootstrap/sort-link.js +2 -1
  8. package/build/draggable-sort/index.js +2 -2
  9. package/build/draggable-sort/item.js +2 -2
  10. package/build/flash-message.js +49 -0
  11. package/build/form.js +3 -3
  12. package/build/inputs/attachment.js +12 -4
  13. package/build/inputs/checkbox.js +2 -2
  14. package/build/inputs/input-wrapper.js +2 -1
  15. package/build/inputs/input.js +19 -6
  16. package/build/inputs/money.js +3 -3
  17. package/build/inputs/select.js +3 -2
  18. package/build/link.js +2 -1
  19. package/build/modal.js +2 -1
  20. package/build/money-formatter.js +6 -5
  21. package/build/router/route.js +11 -3
  22. package/build/router.js +3 -3
  23. package/build/super-admin/edit-page/edit-attribute-input.js +2 -2
  24. package/build/super-admin/edit-page/edit-attribute.js +2 -1
  25. package/build/super-admin/edit-page.js +4 -1
  26. package/build/super-admin/index-page.js +2 -1
  27. package/build/super-admin/index.js +3 -2
  28. package/build/super-admin/layout/header/index.js +2 -1
  29. package/build/super-admin/layout/index.js +6 -6
  30. package/build/super-admin/layout/menu/index.js +3 -1
  31. package/build/super-admin/layout/menu/menu-content.js +9 -3
  32. package/build/super-admin/layout/menu/menu-item.js +2 -1
  33. package/build/super-admin/layout/no-access.js +6 -4
  34. package/build/super-admin/model-class-table.js +2 -2
  35. package/build/super-admin/show-nav.js +3 -1
  36. package/build/super-admin/show-page/belongs-to-attribute-row.js +2 -1
  37. package/build/super-admin/show-page/index.js +2 -2
  38. package/build/super-admin/show-reflection-actions.js +2 -2
  39. package/build/super-admin/show-reflection-link.js +3 -1
  40. package/build/super-admin/show-reflection-page.js +2 -1
  41. package/build/table/column-content.js +10 -5
  42. package/build/table/components/column.js +2 -1
  43. package/build/table/components/flat-list.js +2 -1
  44. package/build/table/components/header.js +2 -1
  45. package/build/table/components/row.js +2 -1
  46. package/build/table/filters/attribute-element.js +2 -1
  47. package/build/table/filters/filter-form.js +15 -5
  48. package/build/table/filters/filter.js +2 -1
  49. package/build/table/filters/index.js +4 -2
  50. package/build/table/filters/load-search-modal.js +4 -3
  51. package/build/table/filters/reflection-element.js +2 -1
  52. package/build/table/filters/save-search-modal.js +3 -1
  53. package/build/table/filters/scope-element.js +2 -1
  54. package/build/table/header-column-content.js +2 -1
  55. package/build/table/header-column.js +2 -2
  56. package/build/table/header-select.js +2 -1
  57. package/build/table/model-column.js +11 -1
  58. package/build/table/model-row.js +16 -3
  59. package/build/table/settings/column-row.js +2 -2
  60. package/build/table/settings/download-action.js +2 -1
  61. package/build/table/settings/index.js +2 -2
  62. package/build/table/worker-plugins-check-all-checkbox.js +2 -2
  63. package/build/table/worker-plugins-checkbox.js +2 -2
  64. package/build/translated-collections.js +3 -2
  65. package/build/use-input.js +4 -7
  66. package/build/utils/default-style.js +2 -2
  67. package/build/utils/text.js +2 -1
  68. package/build/with-collection.js +2 -1
  69. package/build/with-current-user.js +2 -1
  70. package/build/with-model.js +2 -1
  71. package/build/with-router.js +2 -1
  72. package/package.json +3 -3
  73. package/src/bootstrap/attribute-row/index.jsx +1 -1
  74. package/src/bootstrap/attribute-rows.jsx +1 -0
  75. package/src/bootstrap/card.jsx +1 -1
  76. package/src/bootstrap/checkboxes.jsx +1 -1
  77. package/src/bootstrap/input.jsx +2 -1
  78. package/src/bootstrap/paginate.jsx +1 -1
  79. package/src/bootstrap/sort-link.jsx +1 -0
  80. package/src/draggable-sort/index.jsx +1 -1
  81. package/src/draggable-sort/item.jsx +1 -1
  82. package/src/flash-message.js +51 -0
  83. package/src/form.jsx +2 -3
  84. package/src/inputs/attachment.jsx +5 -3
  85. package/src/inputs/checkbox.jsx +1 -1
  86. package/src/inputs/input-wrapper.jsx +1 -0
  87. package/src/inputs/input.jsx +10 -5
  88. package/src/inputs/money.jsx +2 -2
  89. package/src/inputs/select.jsx +2 -1
  90. package/src/link.jsx +1 -0
  91. package/src/modal.jsx +1 -0
  92. package/src/money-formatter.js +5 -4
  93. package/src/router/route.jsx +5 -2
  94. package/src/router.jsx +3 -2
  95. package/src/super-admin/edit-page/edit-attribute-input.jsx +1 -1
  96. package/src/super-admin/edit-page/edit-attribute.jsx +1 -0
  97. package/src/super-admin/edit-page.jsx +3 -0
  98. package/src/super-admin/index-page.jsx +1 -0
  99. package/src/super-admin/index.jsx +2 -1
  100. package/src/super-admin/layout/header/index.jsx +1 -0
  101. package/src/super-admin/layout/index.jsx +4 -4
  102. package/src/super-admin/layout/menu/index.jsx +2 -0
  103. package/src/super-admin/layout/menu/menu-content.jsx +4 -2
  104. package/src/super-admin/layout/menu/menu-item.jsx +1 -0
  105. package/src/super-admin/layout/no-access.jsx +4 -2
  106. package/src/super-admin/model-class-table.jsx +1 -1
  107. package/src/super-admin/show-nav.jsx +2 -0
  108. package/src/super-admin/show-page/belongs-to-attribute-row.jsx +1 -0
  109. package/src/super-admin/show-page/index.jsx +1 -1
  110. package/src/super-admin/show-reflection-actions.jsx +1 -1
  111. package/src/super-admin/show-reflection-link.jsx +2 -0
  112. package/src/super-admin/show-reflection-page.jsx +1 -0
  113. package/src/table/column-content.jsx +8 -5
  114. package/src/table/components/column.jsx +1 -0
  115. package/src/table/components/flat-list.jsx +1 -0
  116. package/src/table/components/header.jsx +1 -0
  117. package/src/table/components/row.jsx +1 -0
  118. package/src/table/filters/attribute-element.jsx +1 -0
  119. package/src/table/filters/filter-form.jsx +13 -5
  120. package/src/table/filters/filter.jsx +1 -0
  121. package/src/table/filters/index.jsx +3 -1
  122. package/src/table/filters/load-search-modal.jsx +3 -2
  123. package/src/table/filters/reflection-element.jsx +1 -0
  124. package/src/table/filters/save-search-modal.jsx +2 -0
  125. package/src/table/filters/scope-element.jsx +1 -0
  126. package/src/table/header-column-content.jsx +1 -0
  127. package/src/table/header-column.jsx +1 -1
  128. package/src/table/header-select.jsx +1 -0
  129. package/src/table/model-column.jsx +4 -1
  130. package/src/table/model-row.jsx +10 -1
  131. package/src/table/settings/column-row.jsx +1 -1
  132. package/src/table/settings/download-action.jsx +1 -0
  133. package/src/table/settings/index.jsx +1 -1
  134. package/src/table/worker-plugins-check-all-checkbox.jsx +1 -1
  135. package/src/table/worker-plugins-checkbox.jsx +1 -1
  136. package/src/translated-collections.js +2 -1
  137. package/src/use-input.js +3 -8
  138. package/src/utils/default-style.jsx +1 -1
  139. package/src/utils/text.jsx +1 -0
  140. package/src/with-collection.jsx +1 -0
  141. package/src/with-current-user.jsx +1 -0
  142. package/src/with-model.jsx +1 -0
  143. package/src/with-router.jsx +1 -0
@@ -8,9 +8,11 @@ import EventEmitter from "events"
8
8
  import PropTypes from "prop-types"
9
9
  import propTypesExact from "prop-types-exact"
10
10
  import memo from "set-state-compare/src/memo"
11
+ import React from "react"
11
12
  import {shapeComponent} from "set-state-compare/src/shape-component"
12
13
  import Text from "../utils/text"
13
14
  import useBreakpoint from "../use-breakpoint"
15
+ import useI18n from "i18n-on-steroids/src/use-i18n"
14
16
 
15
17
  export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseComponent {
16
18
  static propTypes = propTypesExact({
@@ -27,6 +29,7 @@ export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseCo
27
29
  })
28
30
 
29
31
  render() {
32
+ const {l, t} = useI18n({namespace: "js.api_maker.table.model_column"})
30
33
  const {mdUp} = useBreakpoint()
31
34
  const {animatedWidth, animatedZIndex, column, columnIndex, even, model, table} = this.props
32
35
  const columnProps = table.columnProps(column)
@@ -62,7 +65,7 @@ export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseCo
62
65
  </View>
63
66
  }
64
67
  <View dataSet={{class: "table--column-value"}}>
65
- {new ColumnContent({column, model, table}).content()}
68
+ {new ColumnContent({column, l, model, t, table}).content()}
66
69
  </View>
67
70
  </Column>
68
71
  )
@@ -10,9 +10,11 @@ import Link from "../link"
10
10
  import ModelColumn from "./model-column"
11
11
  import PropTypes from "prop-types"
12
12
  import propTypesExact from "prop-types-exact"
13
+ import React from "react"
13
14
  import Row from "./components/row"
14
15
  import memo from "set-state-compare/src/memo"
15
16
  import {shapeComponent} from "set-state-compare/src/shape-component"
17
+ import useI18n from "i18n-on-steroids/src/use-i18n"
16
18
 
17
19
  const WorkerPluginsCheckbox = React.lazy(() => import("./worker-plugins-checkbox"))
18
20
 
@@ -28,6 +30,12 @@ export default memo(shapeComponent(class ApiMakerBootStrapLiveTableModelRow exte
28
30
  tableSettingFullCacheKey: PropTypes.string.isRequired
29
31
  })
30
32
 
33
+ setup() {
34
+ const {t} = useI18n({namespace: "js.api_maker.table.model_row"})
35
+
36
+ this.t = t
37
+ }
38
+
31
39
  render() {
32
40
  const {index, table, model} = this.p
33
41
  const {modelClass, workplace} = table.p
@@ -106,10 +114,11 @@ export default memo(shapeComponent(class ApiMakerBootStrapLiveTableModelRow exte
106
114
  }
107
115
 
108
116
  onDestroyClicked = async () => {
117
+ const {t} = this.tt
109
118
  const {destroyMessage} = this.p.table.props
110
119
  const {model} = this.p
111
120
 
112
- if (!confirm(I18n.t("js.shared.are_you_sure"))) {
121
+ if (!confirm(t("js.shared.are_you_sure"))) {
113
122
  return
114
123
  }
115
124
 
@@ -1,9 +1,9 @@
1
+ import React, {useEffect, useRef} from "react"
1
2
  import BaseComponent from "../../base-component"
2
3
  import columnIdentifier from "../column-identifier"
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 {useEffect, useRef} from "react"
7
7
  import {shapeComponent} from "set-state-compare/src/shape-component"
8
8
  import Text from "../../utils/text"
9
9
  import {View} from "react-native"
@@ -7,6 +7,7 @@ import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"
7
7
  import memo from "set-state-compare/src/memo"
8
8
  import PropTypes from "prop-types"
9
9
  import propTypesExact from "prop-types-exact"
10
+ import React from "react"
10
11
  import {renderToString} from "react-dom/server"
11
12
  import {shapeComponent} from "set-state-compare/src/shape-component"
12
13
  import {Pressable} from "react-native"
@@ -1,8 +1,8 @@
1
+ import React, {useRef} from "react"
1
2
  import BaseComponent from "../../base-component"
2
3
  import columnIdentifier from "../column-identifier"
3
4
  import ColumnRow from "./column-row"
4
5
  import DownloadAction from "./download-action"
5
- import {useRef} from "react"
6
6
  import memo from "set-state-compare/src/memo"
7
7
  import Modal from "../../modal"
8
8
  import PropTypes from "prop-types"
@@ -1,4 +1,4 @@
1
- import {useEffect, useMemo, useRef} from "react"
1
+ import React, {useEffect, useMemo, useRef} from "react"
2
2
  import BaseComponent from "../base-component"
3
3
  import classNames from "classnames"
4
4
  import Collection from "../collection"
@@ -1,3 +1,4 @@
1
+ import React, {useMemo} from "react"
1
2
  import BaseComponent from "../base-component"
2
3
  import classNames from "classnames"
3
4
  import {digg} from "diggerize"
@@ -5,7 +6,6 @@ import memo from "set-state-compare/src/memo"
5
6
  import modelClassRequire from "../model-class-require"
6
7
  import PropTypes from "prop-types"
7
8
  import PropTypesExact from "prop-types-exact"
8
- import {useMemo} from "react"
9
9
  import {shapeComponent} from "set-state-compare/src/shape-component"
10
10
  import useModelEvent from "../use-model-event"
11
11
 
@@ -1,9 +1,10 @@
1
1
  import {digg} from "diggerize"
2
+ import I18nOnSteroids from "i18n-on-steroids"
2
3
  import translatedCollectionsData from "../src/translated-collections-data.js.erb"
3
4
 
4
5
  export default class ApiMakerTranslatedCollections {
5
6
  static get (modelClass, collectionName) {
6
- const locale = I18n.locale
7
+ const locale = I18nOnSteroids.getCurrent().locale
7
8
  const modelClassName = digg(modelClass.modelClassData(), "name")
8
9
  const collection = digg(translatedCollectionsData, modelClassName, collectionName, locale, "collection_array")
9
10
 
package/src/use-input.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {dig, digg} from "diggerize"
2
- import {useCallback, useEffect, useMemo} from "react"
2
+ import {useCallback, useEffect, useMemo, useRef} from "react"
3
3
  import idForComponent from "./inputs/id-for-component"
4
4
  import nameForComponent from "./inputs/name-for-component"
5
5
  import strftime from "strftime"
@@ -14,6 +14,7 @@ const useInput = ({props, wrapperOptions, ...useInputRestProps}) => {
14
14
  }
15
15
 
16
16
  const s = useShape(props)
17
+ const backupRef = useRef()
17
18
 
18
19
  s.useStates({
19
20
  form: undefined
@@ -67,13 +68,7 @@ const useInput = ({props, wrapperOptions, ...useInputRestProps}) => {
67
68
  }
68
69
  }, [])
69
70
 
70
- const inputRefBackup = useCallback(() => {
71
- if (!s.meta._inputRefBackup) s.meta._inputRefBackup = React.createRef()
72
-
73
- return s.meta._inputRefBackup
74
- }, [])
75
-
76
- const inputRef = useCallback(() => s.props.inputRef || inputRefBackup())
71
+ const inputRef = useCallback(() => s.props.inputRef || backupRef)
77
72
 
78
73
  const inputType = useCallback(() => {
79
74
  if ("type" in s.props) {
@@ -1,4 +1,4 @@
1
- import {createContext, useContext} from "react"
1
+ import React, {createContext, useContext} from "react"
2
2
  import memo from "set-state-compare/src/memo"
3
3
 
4
4
  const DefaultStyleContext = createContext({
@@ -1,4 +1,5 @@
1
1
  import memo from "set-state-compare/src/memo"
2
+ import React from "react"
2
3
  import {Text} from "react-native"
3
4
  import {useDefaultStyle, WithDefaultStyle} from "./default-style"
4
5
 
@@ -1,5 +1,6 @@
1
1
  import {digg} from "diggerize"
2
2
  import memo from "set-state-compare/src/memo"
3
+ import React from "react"
3
4
  import useCollection from "./use-collection"
4
5
 
5
6
  export default (WrappedComponent, withCollectionArgs) => memo(() => {
@@ -1,3 +1,4 @@
1
+ import React from "react"
1
2
  import useCurrentUser from "./use-current-user"
2
3
 
3
4
  export default (WrappedComponent) => (props) => {
@@ -1,4 +1,5 @@
1
1
  import memo from "set-state-compare/src/memo"
2
+ import React from "react"
2
3
  import useModel from "./use-model"
3
4
 
4
5
  export default (WrappedComponent, modelClass, givenArgs) => {
@@ -1,3 +1,4 @@
1
+ import React from "react"
1
2
  import useRouter from "./use-router"
2
3
 
3
4
  export default (WrapperComponent) => (props) => {