@kaspernj/api-maker 1.0.445 → 1.0.447

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 (361) hide show
  1. package/{.eslintrc.cjs → .eslintrc.js} +4 -0
  2. package/README.md +35 -0
  3. package/android/build.gradle +43 -0
  4. package/android/src/main/AndroidManifest.xml +2 -0
  5. package/android/src/main/java/expo/modules/api_maker/ApiMakerModule.kt +50 -0
  6. package/android/src/main/java/expo/modules/api_maker/ApiMakerView.kt +30 -0
  7. package/build/api.js +120 -0
  8. package/build/attribute-not-loaded-error.js +2 -0
  9. package/build/base-component.js +5 -0
  10. package/build/base-error.js +33 -0
  11. package/build/base-model/attribute.js +25 -0
  12. package/build/base-model/column.js +11 -0
  13. package/build/base-model/reflection.js +14 -0
  14. package/build/base-model/scope.js +11 -0
  15. package/build/base-model.js +828 -0
  16. package/build/bootstrap/attribute-row/index.js +105 -0
  17. package/build/bootstrap/attribute-rows.js +31 -0
  18. package/build/bootstrap/card.js +138 -0
  19. package/build/bootstrap/checkbox.js +97 -0
  20. package/build/bootstrap/checkboxes.js +183 -0
  21. package/build/bootstrap/index.js +2 -0
  22. package/build/bootstrap/input.js +128 -0
  23. package/build/bootstrap/invalid-feedback.js +27 -0
  24. package/build/bootstrap/paginate.js +150 -0
  25. package/build/bootstrap/radio-buttons.js +72 -0
  26. package/build/bootstrap/select.js +88 -0
  27. package/build/bootstrap/sort-link.js +130 -0
  28. package/build/cable-connection-pool.js +128 -0
  29. package/build/cable-subscription-pool.js +207 -0
  30. package/build/cable-subscription.js +21 -0
  31. package/build/cache-key-generator.js +81 -0
  32. package/build/can-can.js +134 -0
  33. package/build/channels-consumer.js +3 -0
  34. package/build/collection-loader.js +48 -0
  35. package/build/collection.js +279 -0
  36. package/build/command-submit-data.js +81 -0
  37. package/build/commands-pool.js +195 -0
  38. package/build/compose.js +9 -0
  39. package/build/config.js +53 -0
  40. package/build/custom-error.js +5 -0
  41. package/build/data-set-to-attributes.js +10 -0
  42. package/build/deserializer.js +56 -0
  43. package/build/destroy-error.js +5 -0
  44. package/build/devise.js +109 -0
  45. package/build/draggable-sort/controller.js +136 -0
  46. package/build/draggable-sort/index.js +114 -0
  47. package/build/draggable-sort/item.js +188 -0
  48. package/build/error-logger.js +101 -0
  49. package/build/error-messages.js +13 -0
  50. package/build/event-connection.js +32 -0
  51. package/build/event-model-class.js +24 -0
  52. package/build/events.js +5 -0
  53. package/build/form.js +83 -0
  54. package/build/index.js +3 -0
  55. package/build/inputs/attachment.js +121 -0
  56. package/build/inputs/auto-submit.js +36 -0
  57. package/build/inputs/checkbox.js +145 -0
  58. package/build/inputs/checkboxes.js +111 -0
  59. package/build/inputs/id-for-component.js +15 -0
  60. package/build/inputs/input-wrapper.js +18 -0
  61. package/build/inputs/input.js +230 -0
  62. package/build/inputs/money.js +179 -0
  63. package/build/inputs/name-for-component.js +13 -0
  64. package/build/inputs/select.js +92 -0
  65. package/build/instance-of-class-name.js +23 -0
  66. package/build/key-value-store.js +53 -0
  67. package/build/link.js +68 -0
  68. package/build/logger.js +30 -0
  69. package/build/modal.js +37 -0
  70. package/build/model-class-require.js +13 -0
  71. package/build/model-events.js +30 -0
  72. package/build/model-name.js +28 -0
  73. package/build/model-prop-type.js +101 -0
  74. package/build/model-recipes-loader.js +32 -0
  75. package/build/model-recipes-model-loader.js +357 -0
  76. package/build/models-response-reader.js +40 -0
  77. package/build/models.js +8 -0
  78. package/build/money-formatter.js +77 -0
  79. package/build/not-loaded-error.js +2 -0
  80. package/build/params.js +60 -0
  81. package/build/preloaded.js +38 -0
  82. package/build/resize-observer.js +11 -0
  83. package/build/result.js +13 -0
  84. package/build/router/route.js +262 -0
  85. package/build/router/switch.js +72 -0
  86. package/build/router.js +57 -0
  87. package/build/routes-native.js +202 -0
  88. package/build/routes.js +50 -0
  89. package/build/run-last.js +35 -0
  90. package/build/serializer.js +63 -0
  91. package/build/services.js +20 -0
  92. package/build/session-status-updater.js +126 -0
  93. package/build/source-maps-loader.js +171 -0
  94. package/build/super-admin/config-reader.js +84 -0
  95. package/build/super-admin/edit-page/edit-attribute-checkbox.js +85 -0
  96. package/build/super-admin/edit-page/edit-attribute-content.js +54 -0
  97. package/build/super-admin/edit-page/edit-attribute-input.js +79 -0
  98. package/build/super-admin/edit-page/edit-attribute.js +76 -0
  99. package/build/super-admin/edit-page.js +120 -0
  100. package/build/super-admin/has-edit-config.js +12 -0
  101. package/build/super-admin/index-page.js +24 -0
  102. package/build/super-admin/index.js +180 -0
  103. package/build/super-admin/layout/header/index.js +151 -0
  104. package/build/super-admin/layout/index.js +109 -0
  105. package/build/super-admin/layout/menu/index.js +93 -0
  106. package/build/super-admin/layout/menu/menu-content.js +40 -0
  107. package/build/super-admin/layout/menu/menu-item.js +83 -0
  108. package/build/super-admin/layout/no-access.js +25 -0
  109. package/build/super-admin/model-class-table.js +61 -0
  110. package/build/super-admin/models.js +8 -0
  111. package/build/super-admin/show-nav.js +49 -0
  112. package/build/super-admin/show-page/belongs-to-attribute-row.js +28 -0
  113. package/build/super-admin/show-page/index.js +141 -0
  114. package/build/super-admin/show-reflection-actions.js +47 -0
  115. package/build/super-admin/show-reflection-link.js +46 -0
  116. package/build/super-admin/show-reflection-page.js +47 -0
  117. package/build/table/column-content.js +112 -0
  118. package/build/table/column-identifier.js +18 -0
  119. package/build/table/column-visible.js +7 -0
  120. package/build/table/components/column.js +20 -0
  121. package/build/table/components/flat-list.js +20 -0
  122. package/build/table/components/header.js +25 -0
  123. package/build/table/components/row.js +25 -0
  124. package/build/table/filters/attribute-element.js +43 -0
  125. package/build/table/filters/filter-form.js +392 -0
  126. package/build/table/filters/filter.js +89 -0
  127. package/build/table/filters/index.js +182 -0
  128. package/build/table/filters/load-search-modal.js +174 -0
  129. package/build/table/filters/reflection-element.js +36 -0
  130. package/build/table/filters/save-search-modal.js +86 -0
  131. package/build/table/filters/scope-element.js +41 -0
  132. package/build/table/header-column-content.js +67 -0
  133. package/build/table/header-column.js +144 -0
  134. package/build/table/header-select.js +104 -0
  135. package/build/table/model-callback-args.js +10 -0
  136. package/build/table/model-column.js +87 -0
  137. package/build/table/model-row.js +179 -0
  138. package/build/table/select-calculator.js +63 -0
  139. package/build/table/settings/column-row.js +97 -0
  140. package/build/table/settings/download-action.js +78 -0
  141. package/build/table/settings/index.js +92 -0
  142. package/build/table/table-settings.js +219 -0
  143. package/build/table/table.js +972 -0
  144. package/build/table/use-sorting.js +34 -0
  145. package/build/table/widths.js +75 -0
  146. package/build/table/worker-plugins-check-all-checkbox.js +125 -0
  147. package/build/table/worker-plugins-checkbox.js +115 -0
  148. package/build/translated-attributes.js +10 -0
  149. package/build/translated-collections.js +11 -0
  150. package/build/updated-attribute.js +76 -0
  151. package/build/url-encode.js +15 -0
  152. package/build/use-breakpoint.js +44 -0
  153. package/build/use-can-can.js +55 -0
  154. package/build/use-collection.js +225 -0
  155. package/build/use-created-event.js +52 -0
  156. package/build/use-current-user.js +73 -0
  157. package/build/use-destroyed-event.js +60 -0
  158. package/build/use-event-emitter.js +13 -0
  159. package/build/use-event-listener.js +16 -0
  160. package/build/use-input.js +140 -0
  161. package/build/use-model-event.js +60 -0
  162. package/build/use-model.js +169 -0
  163. package/build/use-resize-observer.js +23 -0
  164. package/build/use-router.js +102 -0
  165. package/build/use-screen-layout.js +39 -0
  166. package/build/use-updated-event.js +60 -0
  167. package/build/use-validation-errors.js +30 -0
  168. package/build/utils/card.js +51 -0
  169. package/build/utils/checkbox.js +48 -0
  170. package/build/utils/default-style.js +18 -0
  171. package/build/utils/modal.js +61 -0
  172. package/build/utils/text.js +18 -0
  173. package/build/validation-error.js +28 -0
  174. package/build/validation-errors.js +98 -0
  175. package/build/with-collection.js +13 -0
  176. package/build/with-current-user.js +9 -0
  177. package/build/with-model.js +14 -0
  178. package/build/with-router.js +21 -0
  179. package/expo-module.config.json +17 -0
  180. package/ios/ApiMaker.podspec +29 -0
  181. package/ios/ApiMakerModule.swift +48 -0
  182. package/ios/ApiMakerView.swift +38 -0
  183. package/package.json +35 -14
  184. package/src/{api.mjs → api.js} +5 -5
  185. package/src/{base-error.mjs → base-error.js} +1 -1
  186. package/src/base-model/{attribute.mjs → attribute.js} +1 -1
  187. package/src/base-model/{reflection.mjs → reflection.js} +1 -1
  188. package/src/{base-model.mjs → base-model.js} +14 -14
  189. package/src/bootstrap/attribute-row/index.jsx +2 -2
  190. package/src/bootstrap/attribute-rows.jsx +1 -1
  191. package/src/bootstrap/card.jsx +1 -1
  192. package/src/bootstrap/checkbox.jsx +1 -1
  193. package/src/bootstrap/checkboxes.jsx +1 -1
  194. package/src/bootstrap/input.jsx +1 -1
  195. package/src/bootstrap/paginate.jsx +2 -2
  196. package/src/bootstrap/sort-link.jsx +3 -3
  197. package/src/{cable-connection-pool.mjs → cable-connection-pool.js} +3 -3
  198. package/src/{cable-subscription-pool.mjs → cable-subscription-pool.js} +4 -4
  199. package/src/{cable-subscription.mjs → cable-subscription.js} +1 -1
  200. package/src/{can-can.mjs → can-can.js} +1 -1
  201. package/src/collection-loader.jsx +2 -2
  202. package/src/{collection.mjs → collection.js} +3 -3
  203. package/src/{commands-pool.mjs → commands-pool.js} +11 -11
  204. package/src/{custom-error.mjs → custom-error.js} +1 -1
  205. package/src/{deserializer.mjs → deserializer.js} +2 -2
  206. package/src/{destroy-error.mjs → destroy-error.js} +1 -1
  207. package/src/{devise.mjs → devise.js} +5 -9
  208. package/src/draggable-sort/controller.js +137 -0
  209. package/src/draggable-sort/index.jsx +108 -0
  210. package/src/draggable-sort/item.jsx +174 -0
  211. package/src/{error-logger.mjs → error-logger.js} +1 -1
  212. package/src/event-connection.jsx +1 -1
  213. package/src/event-model-class.jsx +1 -1
  214. package/src/form.jsx +1 -1
  215. package/src/index.js +3 -0
  216. package/src/inputs/attachment.jsx +2 -2
  217. package/src/inputs/checkbox.jsx +7 -6
  218. package/src/inputs/checkboxes.jsx +1 -1
  219. package/src/inputs/input-wrapper.jsx +1 -1
  220. package/src/inputs/input.jsx +8 -7
  221. package/src/inputs/money.jsx +3 -3
  222. package/src/inputs/select.jsx +1 -1
  223. package/src/{key-value-store.mjs → key-value-store.js} +1 -1
  224. package/src/link.jsx +2 -2
  225. package/src/modal.jsx +1 -1
  226. package/src/{model-class-require.mjs → model-class-require.js} +4 -2
  227. package/src/{model-events.mjs → model-events.js} +1 -1
  228. package/src/{model-name.mjs → model-name.js} +1 -1
  229. package/src/{model-recipes-loader.mjs → model-recipes-loader.js} +1 -1
  230. package/src/{model-recipes-model-loader.mjs → model-recipes-model-loader.js} +2 -2
  231. package/src/{models-response-reader.mjs → models-response-reader.js} +2 -2
  232. package/src/models.js +7 -0
  233. package/src/{models.mjs.erb → models.js.erb} +1 -1
  234. package/src/{params.mjs → params.js} +2 -2
  235. package/src/{preloaded.mjs → preloaded.js} +1 -1
  236. package/src/resize-observer.jsx +1 -1
  237. package/src/router/route.jsx +1 -1
  238. package/src/router/switch.jsx +1 -1
  239. package/src/router.jsx +1 -1
  240. package/src/{routes-native.mjs → routes-native.js} +1 -1
  241. package/src/{services.mjs → services.js} +1 -1
  242. package/src/{session-status-updater.mjs → session-status-updater.js} +3 -3
  243. package/src/{source-maps-loader.mjs → source-maps-loader.js} +1 -1
  244. package/src/super-admin/edit-page/edit-attribute-checkbox.jsx +1 -1
  245. package/src/super-admin/edit-page/edit-attribute-content.jsx +1 -1
  246. package/src/super-admin/edit-page/edit-attribute-input.jsx +1 -1
  247. package/src/super-admin/edit-page/edit-attribute.jsx +1 -1
  248. package/src/super-admin/edit-page.jsx +2 -2
  249. package/src/super-admin/has-edit-config.js +1 -1
  250. package/src/super-admin/index-page.jsx +1 -1
  251. package/src/super-admin/index.jsx +7 -7
  252. package/src/super-admin/layout/header/index.jsx +2 -2
  253. package/src/super-admin/layout/index.jsx +3 -3
  254. package/src/super-admin/layout/menu/index.jsx +3 -3
  255. package/src/super-admin/layout/menu/menu-content.jsx +2 -2
  256. package/src/super-admin/layout/menu/{menu-item/index.jsx → menu-item.jsx} +5 -6
  257. package/src/super-admin/layout/no-access.jsx +2 -2
  258. package/src/super-admin/model-class-table.jsx +3 -3
  259. package/src/super-admin/models.js +1 -1
  260. package/src/super-admin/show-nav.jsx +2 -2
  261. package/src/super-admin/show-page/belongs-to-attribute-row.jsx +1 -1
  262. package/src/super-admin/show-page/index.jsx +2 -2
  263. package/src/super-admin/show-reflection-actions.jsx +1 -1
  264. package/src/super-admin/show-reflection-link.jsx +1 -1
  265. package/src/super-admin/show-reflection-page.jsx +1 -1
  266. package/src/table/column-content.jsx +1 -1
  267. package/src/table/components/column.jsx +8 -2
  268. package/src/table/components/header.jsx +2 -2
  269. package/src/table/filters/filter-form.jsx +1 -1
  270. package/src/table/filters/index.jsx +5 -3
  271. package/src/table/filters/load-search-modal.jsx +6 -4
  272. package/src/table/filters/save-search-modal.jsx +4 -4
  273. package/src/table/header-column.jsx +59 -79
  274. package/src/table/header-select.jsx +1 -1
  275. package/src/table/model-column.jsx +12 -6
  276. package/src/table/model-row.jsx +11 -7
  277. package/src/table/{select-calculator.mjs → select-calculator.js} +1 -1
  278. package/src/table/settings/column-row.jsx +4 -3
  279. package/src/table/settings/download-action.jsx +3 -3
  280. package/src/table/settings/index.jsx +3 -3
  281. package/src/table/table-settings.js +5 -4
  282. package/src/table/table.jsx +149 -71
  283. package/src/table/{use-sorting.mjs → use-sorting.js} +1 -1
  284. package/src/table/{widths.mjs → widths.jsx} +11 -2
  285. package/src/table/worker-plugins-check-all-checkbox.jsx +2 -2
  286. package/src/table/worker-plugins-checkbox.jsx +2 -2
  287. package/src/{translated-collections.mjs → translated-collections.js} +1 -1
  288. package/src/updated-attribute.jsx +1 -1
  289. package/src/{use-breakpoint.mjs → use-breakpoint.js} +2 -2
  290. package/src/use-can-can.js +55 -0
  291. package/src/{use-collection.mjs → use-collection.js} +4 -4
  292. package/src/{use-created-event.mjs → use-created-event.js} +2 -2
  293. package/src/{use-current-user.mjs → use-current-user.js} +6 -5
  294. package/src/{use-destroyed-event.mjs → use-destroyed-event.js} +2 -2
  295. package/src/{use-input.mjs → use-input.js} +5 -5
  296. package/src/use-model-event.js +2 -2
  297. package/src/{use-model.mjs → use-model.js} +4 -4
  298. package/src/{use-resize-observer.mjs → use-resize-observer.js} +1 -1
  299. package/src/use-router.jsx +2 -2
  300. package/src/{use-updated-event.mjs → use-updated-event.js} +2 -2
  301. package/src/{use-validation-errors.mjs → use-validation-errors.js} +3 -3
  302. package/src/utils/checkbox.jsx +2 -2
  303. package/src/{validation-error.mjs → validation-error.js} +1 -1
  304. package/src/{validation-errors.mjs → validation-errors.js} +1 -1
  305. package/src/with-current-user.jsx +1 -1
  306. package/src/with-model.jsx +1 -1
  307. package/__tests__/base-model.test.mjs +0 -71
  308. package/__tests__/cable-connection-pool.test.mjs +0 -227
  309. package/__tests__/cable-subscription-pool.test.mjs +0 -27
  310. package/__tests__/can-can.test.mjs +0 -34
  311. package/__tests__/collection.test.mjs +0 -51
  312. package/__tests__/custom-error.test.mjs +0 -13
  313. package/__tests__/model-name.test.mjs +0 -34
  314. package/__tests__/model-prop-type.test.mjs +0 -113
  315. package/__tests__/params.test.mjs +0 -40
  316. package/__tests__/routes-native.test.mjs +0 -104
  317. package/__tests__/routes.test.mjs +0 -47
  318. package/__tests__/serializer.test.mjs +0 -30
  319. package/__tests__/support/task.mjs +0 -27
  320. package/__tests__/support/user.mjs +0 -32
  321. package/index.js +0 -1
  322. package/jest.config.js +0 -9
  323. package/src/event-created.jsx +0 -12
  324. package/src/event-destroyed.jsx +0 -25
  325. package/src/event-emitter-listener.jsx +0 -10
  326. package/src/event-listener.jsx +0 -25
  327. package/src/event-updated.jsx +0 -27
  328. package/src/super-admin/layout/menu/menu-item/style.scss +0 -10
  329. package/src/use-can-can.mjs +0 -48
  330. package/src/with-can-can.jsx +0 -12
  331. package/webpack.config.js +0 -15
  332. /package/src/{attribute-not-loaded-error.mjs → attribute-not-loaded-error.js} +0 -0
  333. /package/src/base-model/{column.mjs → column.js} +0 -0
  334. /package/src/base-model/{scope.mjs → scope.js} +0 -0
  335. /package/src/{cache-key-generator.mjs → cache-key-generator.js} +0 -0
  336. /package/src/{channels-consumer.mjs → channels-consumer.js} +0 -0
  337. /package/src/{command-submit-data.mjs → command-submit-data.js} +0 -0
  338. /package/src/{config.mjs → config.js} +0 -0
  339. /package/src/{data-set-to-attributes.mjs → data-set-to-attributes.js} +0 -0
  340. /package/src/{error-messages.mjs → error-messages.js} +0 -0
  341. /package/src/{events.mjs → events.js} +0 -0
  342. /package/src/inputs/{auto-submit.mjs → auto-submit.js} +0 -0
  343. /package/src/inputs/{id-for-component.mjs → id-for-component.js} +0 -0
  344. /package/src/inputs/{name-for-component.mjs → name-for-component.js} +0 -0
  345. /package/src/{instance-of-class-name.mjs → instance-of-class-name.js} +0 -0
  346. /package/src/{logger.mjs → logger.js} +0 -0
  347. /package/src/{model-prop-type.mjs → model-prop-type.js} +0 -0
  348. /package/src/{money-formatter.mjs → money-formatter.js} +0 -0
  349. /package/src/{not-loaded-error.mjs → not-loaded-error.js} +0 -0
  350. /package/src/{result.mjs → result.js} +0 -0
  351. /package/src/{routes.mjs → routes.js} +0 -0
  352. /package/src/{run-last.mjs → run-last.js} +0 -0
  353. /package/src/{serializer.mjs → serializer.js} +0 -0
  354. /package/src/table/{column-identifier.mjs → column-identifier.js} +0 -0
  355. /package/src/table/{column-visible.mjs → column-visible.js} +0 -0
  356. /package/src/table/{model-callback-args.mjs → model-callback-args.js} +0 -0
  357. /package/src/{translated-collections-data.mjs.erb → translated-collections-data.js.erb} +0 -0
  358. /package/src/{url-encode.mjs → url-encode.js} +0 -0
  359. /package/src/{use-event-emitter.mjs → use-event-emitter.js} +0 -0
  360. /package/src/{use-event-listener.mjs → use-event-listener.js} +0 -0
  361. /package/src/{use-screen-layout.mjs → use-screen-layout.js} +0 -0
@@ -1,23 +1,27 @@
1
+ import {useMemo} from "react"
1
2
  import BaseComponent from "../base-component"
2
3
  import classNames from "classnames"
4
+ import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"
3
5
  import Header from "./components/header"
4
6
  import HeaderColumnContent from "./header-column-content"
5
7
  import memo from "set-state-compare/src/memo"
6
- import {Platform, Pressable} from "react-native"
8
+ import {Animated, PanResponder} from "react-native"
7
9
  import PropTypes from "prop-types"
8
10
  import propTypesExact from "prop-types-exact"
9
11
  import {shapeComponent} from "set-state-compare/src/shape-component"
10
12
  import useBreakpoint from "../use-breakpoint"
11
- import useEventListener from "../use-event-listener.mjs"
12
13
  import Widths from "./widths"
13
14
 
14
15
  export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseComponent {
15
16
  static propTypes = propTypesExact({
17
+ active: PropTypes.bool.isRequired,
18
+ animatedWidth: PropTypes.instanceOf(Animated.Value).isRequired,
19
+ animatedZIndex: PropTypes.instanceOf(Animated.Value).isRequired,
16
20
  column: PropTypes.object.isRequired,
17
21
  resizing: PropTypes.bool.isRequired,
18
22
  table: PropTypes.object.isRequired,
19
23
  tableSettingColumn: PropTypes.object.isRequired,
20
- width: PropTypes.number.isRequired,
24
+ touchProps: PropTypes.object.isRequired,
21
25
  widths: PropTypes.instanceOf(Widths).isRequired
22
26
  })
23
27
 
@@ -25,29 +29,64 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
25
29
  const {name: breakpoint, mdUp, smDown} = useBreakpoint()
26
30
 
27
31
  this.setInstance({breakpoint, mdUp, smDown})
28
-
29
- useEventListener(window, "mousemove", this.tt.onWindowMouseMove)
30
- useEventListener(window, "mouseup", this.tt.onWindowMouseUp)
31
-
32
32
  this.useStates({
33
- cursorX: undefined,
34
- originalWidth: undefined,
35
33
  resizing: false
36
34
  })
35
+
36
+ this.resizePanResponder = useMemo(
37
+ () => PanResponder.create({
38
+ onStartShouldSetPanResponder: (_e) => {
39
+ this.originalWidth = this.currentWidth
40
+ this.setState({resizing: true})
41
+ this.p.table.setState({resizing: true})
42
+
43
+ return true
44
+ },
45
+ onPanResponderMove: (_e, gestate) => {
46
+ const newWidth = this.tt.originalWidth + gestate.dx
47
+
48
+ this.p.widths.setWidthOfColumn({
49
+ identifier: this.p.tableSettingColumn.identifier(),
50
+ width: newWidth
51
+ })
52
+ },
53
+ onPanResponderRelease: this.tt.onResizeEnd,
54
+ onPanResponderTerminate: this.tt.onResizeEnd,
55
+ onPanResponderTerminationRequest: () => false // Don't let another PanResponder steal focus and stop resizing until release
56
+ }),
57
+ []
58
+ )
59
+ }
60
+
61
+ onResizeEnd = async () => {
62
+ this.p.table.setState({lastUpdate: new Date(), resizing: false})
63
+ this.setState({resizing: false})
64
+
65
+ const width = this.p.widths.getWidthOfColumn(this.p.tableSettingColumn.identifier())
66
+
67
+ await this.p.tableSettingColumn.update({width})
37
68
  }
38
69
 
39
70
  render() {
40
71
  const {mdUp} = this.tt
41
- const {column, resizing, table, tableSettingColumn, width} = this.p
72
+ const {active, animatedWidth, column, resizing, table, tableSettingColumn, touchProps} = this.p
42
73
  const {styleForHeader} = table.tt
43
74
  const headerProps = table.headerProps(column)
44
75
  const {style, ...restColumnProps} = headerProps
45
- const actualStyle = Object.assign(
46
- {
47
- cursor: resizing ? "col-resize" : undefined,
48
- width: mdUp ? width : "100%"
76
+ const actualStyle = useMemo(
77
+ () => {
78
+ const actualStyle = Object.assign(
79
+ {
80
+ cursor: resizing ? "col-resize" : undefined,
81
+ width: mdUp ? animatedWidth : "100%",
82
+ height: mdUp ? "100%" : undefined
83
+ },
84
+ style
85
+ )
86
+
87
+ return actualStyle
49
88
  },
50
- style
89
+ [active, animatedWidth, mdUp, resizing, style]
51
90
  )
52
91
 
53
92
  return (
@@ -60,11 +99,12 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
60
99
  style={styleForHeader({style: actualStyle})}
61
100
  {...restColumnProps}
62
101
  >
102
+ {mdUp &&
103
+ <FontAwesomeIcon name="bars" style={{marginRight: 3, fontSize: 12}} {...touchProps} />
104
+ }
63
105
  <HeaderColumnContent column={column} table={table} tableSettingColumn={tableSettingColumn} />
64
106
  {mdUp &&
65
- <Pressable
66
- onMouseDown={Platform.OS == "web" ? this.tt.onResizeMouseDown : undefined}
67
- onPressIn={this.tt.onResizePressIn}
107
+ <Animated.View
68
108
  style={{
69
109
  position: "absolute",
70
110
  top: 0,
@@ -74,6 +114,7 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
74
114
  cursor: "col-resize",
75
115
  zIndex: 9999
76
116
  }}
117
+ {...this.tt.resizePanResponder.panHandlers}
77
118
  />
78
119
  }
79
120
  </Header>
@@ -85,65 +126,4 @@ export default memo(shapeComponent(class ApiMakerTableHeaderColumn extends BaseC
85
126
 
86
127
  this.currentWidth = width
87
128
  }
88
-
89
- onResizeEnd = async () => {
90
- this.setState({cursorX: undefined, resizing: false})
91
- this.p.table.setState({resizing: false})
92
-
93
- const width = this.p.widths.getWidthOfColumn(this.p.tableSettingColumn.identifier())
94
-
95
- await this.p.tableSettingColumn.update({width})
96
- }
97
-
98
- // Otherwise text is selectable on web
99
- onResizeMouseDown = (e) => {
100
- e.preventDefault()
101
- e.stopPropagation()
102
-
103
- const originalWidth = this.currentWidth
104
- const cursorX = e.nativeEvent.pageX
105
-
106
- this.setState({
107
- cursorX,
108
- originalWidth,
109
- resizing: true
110
- })
111
- this.p.table.setState({resizing: true})
112
- }
113
-
114
- onResizePressIn = (e) => {
115
- e.preventDefault()
116
- e.stopPropagation()
117
-
118
- const originalWidth = this.currentWidth
119
- const cursorX = e.nativeEvent.pageX
120
-
121
- this.setState({
122
- cursorX,
123
- originalWidth,
124
- resizing: true
125
- })
126
- this.p.table.setState({resizing: true})
127
- }
128
-
129
- onWindowMouseMove = (e) => {
130
- const {cursorX, resizing, originalWidth} = this.s
131
-
132
- if (resizing) {
133
- const newCursorX = e.pageX
134
- const diffX = newCursorX - cursorX
135
- const newWidth = originalWidth + diffX
136
-
137
- this.p.widths.setWidthOfColumn({
138
- identifier: this.p.tableSettingColumn.identifier(),
139
- width: newWidth
140
- })
141
- }
142
- }
143
-
144
- onWindowMouseUp = () => {
145
- if (this.s.resizing) {
146
- this.onResizeEnd()
147
- }
148
- }
149
129
  }))
@@ -8,7 +8,7 @@ import PropTypes from "prop-types"
8
8
  import propTypesExact from "prop-types-exact"
9
9
  import {shapeComponent} from "set-state-compare/src/shape-component"
10
10
  import Text from "../utils/text"
11
- import useI18n from "i18n-on-steroids/src/use-i18n.mjs"
11
+ import useI18n from "i18n-on-steroids/src/use-i18n"
12
12
  import useSorting from "./use-sorting"
13
13
 
14
14
  export default memo(shapeComponent(class ApiMakerTableHeaderSelect extends BaseComponent {
@@ -1,9 +1,10 @@
1
- import {View} from "react-native"
1
+ import {Animated, View} from "react-native"
2
2
  import BaseComponent from "../base-component"
3
3
  import classNames from "classnames"
4
4
  import Column from "./components/column"
5
5
  import ColumnContent from "./column-content"
6
- import columnIdentifier from "./column-identifier.mjs"
6
+ import columnIdentifier from "./column-identifier"
7
+ import EventEmitter from "events"
7
8
  import PropTypes from "prop-types"
8
9
  import propTypesExact from "prop-types-exact"
9
10
  import memo from "set-state-compare/src/memo"
@@ -13,18 +14,21 @@ import useBreakpoint from "../use-breakpoint"
13
14
 
14
15
  export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseComponent {
15
16
  static propTypes = propTypesExact({
17
+ animatedPosition: PropTypes.instanceOf(Animated.ValueXY).isRequired,
18
+ animatedWidth: PropTypes.instanceOf(Animated.Value).isRequired,
19
+ animatedZIndex: PropTypes.instanceOf(Animated.Value).isRequired,
16
20
  column: PropTypes.object.isRequired,
17
21
  columnIndex: PropTypes.number.isRequired,
18
22
  even: PropTypes.bool.isRequired,
23
+ events: PropTypes.instanceOf(EventEmitter).isRequired,
19
24
  model: PropTypes.object.isRequired,
20
25
  table: PropTypes.object.isRequired,
21
- tableSettingColumn: PropTypes.object.isRequired,
22
- width: PropTypes.number.isRequired
26
+ tableSettingColumn: PropTypes.object.isRequired
23
27
  })
24
28
 
25
29
  render() {
26
30
  const {mdUp} = useBreakpoint()
27
- const {column, columnIndex, even, model, table, width} = this.props
31
+ const {animatedWidth, animatedZIndex, column, columnIndex, even, model, table} = this.props
28
32
  const columnProps = table.columnProps(column)
29
33
  const {style, ...restColumnProps} = columnProps
30
34
  const actualStyle = Object.assign(
@@ -33,7 +37,9 @@ export default memo(shapeComponent(class ApiMakerTableModelColumn extends BaseCo
33
37
  columnIndex,
34
38
  even,
35
39
  style: {
36
- width: mdUp ? width : "100%"
40
+ zIndex: animatedZIndex,
41
+ transform: this.p.animatedPosition.getTranslateTransform(),
42
+ width: mdUp ? animatedWidth : "100%"
37
43
  }
38
44
  }),
39
45
  style
@@ -1,11 +1,11 @@
1
1
  import {Pressable} from "react-native"
2
2
  import BaseComponent from "../base-component"
3
3
  import Column from "./components/column"
4
- import columnIdentifier from "./column-identifier.mjs"
5
- import columnVisible from "./column-visible.mjs"
4
+ import columnIdentifier from "./column-identifier"
5
+ import EventEmitter from "events"
6
6
  import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"
7
7
  import * as inflection from "inflection"
8
- import modelCallbackArgs from "./model-callback-args.mjs"
8
+ import modelCallbackArgs from "./model-callback-args"
9
9
  import Link from "../link"
10
10
  import ModelColumn from "./model-column"
11
11
  import PropTypes from "prop-types"
@@ -19,11 +19,12 @@ const WorkerPluginsCheckbox = React.lazy(() => import("./worker-plugins-checkbox
19
19
  export default memo(shapeComponent(class ApiMakerBootStrapLiveTableModelRow extends BaseComponent {
20
20
  static propTypes = propTypesExact({
21
21
  cacheKey: PropTypes.string.isRequired,
22
+ columns: PropTypes.array,
22
23
  columnWidths: PropTypes.object.isRequired,
24
+ events: PropTypes.instanceOf(EventEmitter).isRequired,
23
25
  index: PropTypes.number.isRequired,
24
26
  model: PropTypes.object.isRequired,
25
27
  table: PropTypes.object.isRequired,
26
- preparedColumns: PropTypes.array,
27
28
  tableSettingFullCacheKey: PropTypes.string.isRequired
28
29
  })
29
30
 
@@ -85,18 +86,21 @@ export default memo(shapeComponent(class ApiMakerBootStrapLiveTableModelRow exte
85
86
  }
86
87
 
87
88
  columnsContentFromColumns(model, even) {
88
- const {table, preparedColumns} = this.p
89
+ const {columns, events, table} = this.p
89
90
 
90
- return preparedColumns?.map(({column, tableSettingColumn, width}, columnIndex) => columnVisible(column, tableSettingColumn) &&
91
+ return columns?.map(({animatedPosition, animatedWidth, animatedZIndex, column, tableSettingColumn}, columnIndex) =>
91
92
  <ModelColumn
93
+ animatedPosition={animatedPosition}
94
+ animatedWidth={animatedWidth}
95
+ animatedZIndex={animatedZIndex}
92
96
  column={column}
93
97
  columnIndex={columnIndex}
94
98
  even={even}
99
+ events={events}
95
100
  key={columnIdentifier(column)}
96
101
  model={model}
97
102
  table={table}
98
103
  tableSettingColumn={tableSettingColumn}
99
- width={width}
100
104
  />
101
105
  )
102
106
  }
@@ -1,6 +1,6 @@
1
1
  import {digg, digs} from "diggerize"
2
2
  import * as inflection from "inflection"
3
- import modelClassRequire from "../model-class-require.mjs"
3
+ import modelClassRequire from "../model-class-require"
4
4
 
5
5
  class SelectCalculator {
6
6
  constructor({table}) {
@@ -1,10 +1,10 @@
1
1
  import BaseComponent from "../../base-component"
2
- import columnIdentifier from "../column-identifier.mjs"
2
+ import columnIdentifier from "../column-identifier"
3
3
  import memo from "set-state-compare/src/memo"
4
4
  import PropTypes from "prop-types"
5
5
  import propTypesExact from "prop-types-exact"
6
6
  import {useEffect, useRef} from "react"
7
- import {shapeComponent} from "set-state-compare/src/shape-component.js"
7
+ import {shapeComponent} from "set-state-compare/src/shape-component"
8
8
  import Text from "../../utils/text"
9
9
  import {View} from "react-native"
10
10
 
@@ -87,6 +87,7 @@ export default memo(shapeComponent(class ColumnRow extends BaseComponent {
87
87
  const {table, tableSettingColumn} = this.p
88
88
 
89
89
  await tableSettingColumn.update({visible: this.checked})
90
- table.updateSettingsFullCacheKey()
90
+
91
+ table.events.emit("columnVisibilityUpdated", {tableSettingColumn})
91
92
  }
92
93
  }))
@@ -1,14 +1,14 @@
1
1
  import BaseComponent from "../../base-component"
2
2
  import ColumnContent from "../column-content"
3
- import columnIdentifier from "../column-identifier.mjs"
4
- import columnVisible from "../column-visible.mjs"
3
+ import columnIdentifier from "../column-identifier"
4
+ import columnVisible from "../column-visible"
5
5
  import {saveAs} from "file-saver"
6
6
  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
10
  import {renderToString} from "react-dom/server"
11
- import {shapeComponent} from "set-state-compare/src/shape-component.js"
11
+ import {shapeComponent} from "set-state-compare/src/shape-component"
12
12
  import {Pressable} from "react-native"
13
13
  import Text from "../../utils/text"
14
14
 
@@ -1,5 +1,5 @@
1
1
  import BaseComponent from "../../base-component"
2
- import columnIdentifier from "../column-identifier.mjs"
2
+ import columnIdentifier from "../column-identifier"
3
3
  import ColumnRow from "./column-row"
4
4
  import DownloadAction from "./download-action"
5
5
  import {useRef} from "react"
@@ -7,10 +7,10 @@ import memo from "set-state-compare/src/memo"
7
7
  import Modal from "../../modal"
8
8
  import PropTypes from "prop-types"
9
9
  import propTypesExact from "prop-types-exact"
10
- import {shapeComponent} from "set-state-compare/src/shape-component.js"
10
+ import {shapeComponent} from "set-state-compare/src/shape-component"
11
11
  import {View} from "react-native"
12
12
  import Text from "../../utils/text"
13
- import useI18n from "i18n-on-steroids/src/use-i18n.mjs"
13
+ import useI18n from "i18n-on-steroids/src/use-i18n"
14
14
 
15
15
  export default memo(shapeComponent(class ApiMakerTableSettings extends BaseComponent {
16
16
  static propTypes = propTypesExact({
@@ -1,14 +1,15 @@
1
- import columnIdentifier from "./column-identifier.mjs"
2
- import columnVisible from "./column-visible.mjs"
1
+ import columnIdentifier from "./column-identifier"
2
+ import columnVisible from "./column-visible"
3
3
  import {digg} from "diggerize"
4
4
  import * as inflection from "inflection"
5
- import Logger from "../logger.mjs"
5
+ import Logger from "../logger"
6
6
  import {ReadersWriterLock} from "epic-locks"
7
7
  import {serialize as objectToFormData} from "object-to-formdata"
8
- import {TableSetting} from "../models.mjs.erb"
8
+ import models from "../models"
9
9
  import {v4 as uuidv4} from "uuid"
10
10
 
11
11
  const logger = new Logger({name: "ApiMaker / TableSettings"})
12
+ const {TableSetting} = models
12
13
 
13
14
  // Have a lock for each unique table identifier
14
15
  const tableSettingsLocks = {}