@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.
- package/{.eslintrc.cjs → .eslintrc.js} +4 -0
- package/README.md +35 -0
- package/android/build.gradle +43 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/expo/modules/api_maker/ApiMakerModule.kt +50 -0
- package/android/src/main/java/expo/modules/api_maker/ApiMakerView.kt +30 -0
- package/build/api.js +120 -0
- package/build/attribute-not-loaded-error.js +2 -0
- package/build/base-component.js +5 -0
- package/build/base-error.js +33 -0
- package/build/base-model/attribute.js +25 -0
- package/build/base-model/column.js +11 -0
- package/build/base-model/reflection.js +14 -0
- package/build/base-model/scope.js +11 -0
- package/build/base-model.js +828 -0
- package/build/bootstrap/attribute-row/index.js +105 -0
- package/build/bootstrap/attribute-rows.js +31 -0
- package/build/bootstrap/card.js +138 -0
- package/build/bootstrap/checkbox.js +97 -0
- package/build/bootstrap/checkboxes.js +183 -0
- package/build/bootstrap/index.js +2 -0
- package/build/bootstrap/input.js +128 -0
- package/build/bootstrap/invalid-feedback.js +27 -0
- package/build/bootstrap/paginate.js +150 -0
- package/build/bootstrap/radio-buttons.js +72 -0
- package/build/bootstrap/select.js +88 -0
- package/build/bootstrap/sort-link.js +130 -0
- package/build/cable-connection-pool.js +128 -0
- package/build/cable-subscription-pool.js +207 -0
- package/build/cable-subscription.js +21 -0
- package/build/cache-key-generator.js +81 -0
- package/build/can-can.js +134 -0
- package/build/channels-consumer.js +3 -0
- package/build/collection-loader.js +48 -0
- package/build/collection.js +279 -0
- package/build/command-submit-data.js +81 -0
- package/build/commands-pool.js +195 -0
- package/build/compose.js +9 -0
- package/build/config.js +53 -0
- package/build/custom-error.js +5 -0
- package/build/data-set-to-attributes.js +10 -0
- package/build/deserializer.js +56 -0
- package/build/destroy-error.js +5 -0
- package/build/devise.js +109 -0
- package/build/draggable-sort/controller.js +136 -0
- package/build/draggable-sort/index.js +114 -0
- package/build/draggable-sort/item.js +188 -0
- package/build/error-logger.js +101 -0
- package/build/error-messages.js +13 -0
- package/build/event-connection.js +32 -0
- package/build/event-model-class.js +24 -0
- package/build/events.js +5 -0
- package/build/form.js +83 -0
- package/build/index.js +3 -0
- package/build/inputs/attachment.js +121 -0
- package/build/inputs/auto-submit.js +36 -0
- package/build/inputs/checkbox.js +145 -0
- package/build/inputs/checkboxes.js +111 -0
- package/build/inputs/id-for-component.js +15 -0
- package/build/inputs/input-wrapper.js +18 -0
- package/build/inputs/input.js +230 -0
- package/build/inputs/money.js +179 -0
- package/build/inputs/name-for-component.js +13 -0
- package/build/inputs/select.js +92 -0
- package/build/instance-of-class-name.js +23 -0
- package/build/key-value-store.js +53 -0
- package/build/link.js +68 -0
- package/build/logger.js +30 -0
- package/build/modal.js +37 -0
- package/build/model-class-require.js +13 -0
- package/build/model-events.js +30 -0
- package/build/model-name.js +28 -0
- package/build/model-prop-type.js +101 -0
- package/build/model-recipes-loader.js +32 -0
- package/build/model-recipes-model-loader.js +357 -0
- package/build/models-response-reader.js +40 -0
- package/build/models.js +8 -0
- package/build/money-formatter.js +77 -0
- package/build/not-loaded-error.js +2 -0
- package/build/params.js +60 -0
- package/build/preloaded.js +38 -0
- package/build/resize-observer.js +11 -0
- package/build/result.js +13 -0
- package/build/router/route.js +262 -0
- package/build/router/switch.js +72 -0
- package/build/router.js +57 -0
- package/build/routes-native.js +202 -0
- package/build/routes.js +50 -0
- package/build/run-last.js +35 -0
- package/build/serializer.js +63 -0
- package/build/services.js +20 -0
- package/build/session-status-updater.js +126 -0
- package/build/source-maps-loader.js +171 -0
- package/build/super-admin/config-reader.js +84 -0
- package/build/super-admin/edit-page/edit-attribute-checkbox.js +85 -0
- package/build/super-admin/edit-page/edit-attribute-content.js +54 -0
- package/build/super-admin/edit-page/edit-attribute-input.js +79 -0
- package/build/super-admin/edit-page/edit-attribute.js +76 -0
- package/build/super-admin/edit-page.js +120 -0
- package/build/super-admin/has-edit-config.js +12 -0
- package/build/super-admin/index-page.js +24 -0
- package/build/super-admin/index.js +180 -0
- package/build/super-admin/layout/header/index.js +151 -0
- package/build/super-admin/layout/index.js +109 -0
- package/build/super-admin/layout/menu/index.js +93 -0
- package/build/super-admin/layout/menu/menu-content.js +40 -0
- package/build/super-admin/layout/menu/menu-item.js +83 -0
- package/build/super-admin/layout/no-access.js +25 -0
- package/build/super-admin/model-class-table.js +61 -0
- package/build/super-admin/models.js +8 -0
- package/build/super-admin/show-nav.js +49 -0
- package/build/super-admin/show-page/belongs-to-attribute-row.js +28 -0
- package/build/super-admin/show-page/index.js +141 -0
- package/build/super-admin/show-reflection-actions.js +47 -0
- package/build/super-admin/show-reflection-link.js +46 -0
- package/build/super-admin/show-reflection-page.js +47 -0
- package/build/table/column-content.js +112 -0
- package/build/table/column-identifier.js +18 -0
- package/build/table/column-visible.js +7 -0
- package/build/table/components/column.js +20 -0
- package/build/table/components/flat-list.js +20 -0
- package/build/table/components/header.js +25 -0
- package/build/table/components/row.js +25 -0
- package/build/table/filters/attribute-element.js +43 -0
- package/build/table/filters/filter-form.js +392 -0
- package/build/table/filters/filter.js +89 -0
- package/build/table/filters/index.js +182 -0
- package/build/table/filters/load-search-modal.js +174 -0
- package/build/table/filters/reflection-element.js +36 -0
- package/build/table/filters/save-search-modal.js +86 -0
- package/build/table/filters/scope-element.js +41 -0
- package/build/table/header-column-content.js +67 -0
- package/build/table/header-column.js +144 -0
- package/build/table/header-select.js +104 -0
- package/build/table/model-callback-args.js +10 -0
- package/build/table/model-column.js +87 -0
- package/build/table/model-row.js +179 -0
- package/build/table/select-calculator.js +63 -0
- package/build/table/settings/column-row.js +97 -0
- package/build/table/settings/download-action.js +78 -0
- package/build/table/settings/index.js +92 -0
- package/build/table/table-settings.js +219 -0
- package/build/table/table.js +972 -0
- package/build/table/use-sorting.js +34 -0
- package/build/table/widths.js +75 -0
- package/build/table/worker-plugins-check-all-checkbox.js +125 -0
- package/build/table/worker-plugins-checkbox.js +115 -0
- package/build/translated-attributes.js +10 -0
- package/build/translated-collections.js +11 -0
- package/build/updated-attribute.js +76 -0
- package/build/url-encode.js +15 -0
- package/build/use-breakpoint.js +44 -0
- package/build/use-can-can.js +55 -0
- package/build/use-collection.js +225 -0
- package/build/use-created-event.js +52 -0
- package/build/use-current-user.js +73 -0
- package/build/use-destroyed-event.js +60 -0
- package/build/use-event-emitter.js +13 -0
- package/build/use-event-listener.js +16 -0
- package/build/use-input.js +140 -0
- package/build/use-model-event.js +60 -0
- package/build/use-model.js +169 -0
- package/build/use-resize-observer.js +23 -0
- package/build/use-router.js +102 -0
- package/build/use-screen-layout.js +39 -0
- package/build/use-updated-event.js +60 -0
- package/build/use-validation-errors.js +30 -0
- package/build/utils/card.js +51 -0
- package/build/utils/checkbox.js +48 -0
- package/build/utils/default-style.js +18 -0
- package/build/utils/modal.js +61 -0
- package/build/utils/text.js +18 -0
- package/build/validation-error.js +28 -0
- package/build/validation-errors.js +98 -0
- package/build/with-collection.js +13 -0
- package/build/with-current-user.js +9 -0
- package/build/with-model.js +14 -0
- package/build/with-router.js +21 -0
- package/expo-module.config.json +17 -0
- package/ios/ApiMaker.podspec +29 -0
- package/ios/ApiMakerModule.swift +48 -0
- package/ios/ApiMakerView.swift +38 -0
- package/package.json +35 -14
- package/src/{api.mjs → api.js} +5 -5
- package/src/{base-error.mjs → base-error.js} +1 -1
- package/src/base-model/{attribute.mjs → attribute.js} +1 -1
- package/src/base-model/{reflection.mjs → reflection.js} +1 -1
- package/src/{base-model.mjs → base-model.js} +14 -14
- package/src/bootstrap/attribute-row/index.jsx +2 -2
- package/src/bootstrap/attribute-rows.jsx +1 -1
- package/src/bootstrap/card.jsx +1 -1
- package/src/bootstrap/checkbox.jsx +1 -1
- package/src/bootstrap/checkboxes.jsx +1 -1
- package/src/bootstrap/input.jsx +1 -1
- package/src/bootstrap/paginate.jsx +2 -2
- package/src/bootstrap/sort-link.jsx +3 -3
- package/src/{cable-connection-pool.mjs → cable-connection-pool.js} +3 -3
- package/src/{cable-subscription-pool.mjs → cable-subscription-pool.js} +4 -4
- package/src/{cable-subscription.mjs → cable-subscription.js} +1 -1
- package/src/{can-can.mjs → can-can.js} +1 -1
- package/src/collection-loader.jsx +2 -2
- package/src/{collection.mjs → collection.js} +3 -3
- package/src/{commands-pool.mjs → commands-pool.js} +11 -11
- package/src/{custom-error.mjs → custom-error.js} +1 -1
- package/src/{deserializer.mjs → deserializer.js} +2 -2
- package/src/{destroy-error.mjs → destroy-error.js} +1 -1
- package/src/{devise.mjs → devise.js} +5 -9
- package/src/draggable-sort/controller.js +137 -0
- package/src/draggable-sort/index.jsx +108 -0
- package/src/draggable-sort/item.jsx +174 -0
- package/src/{error-logger.mjs → error-logger.js} +1 -1
- package/src/event-connection.jsx +1 -1
- package/src/event-model-class.jsx +1 -1
- package/src/form.jsx +1 -1
- package/src/index.js +3 -0
- package/src/inputs/attachment.jsx +2 -2
- package/src/inputs/checkbox.jsx +7 -6
- package/src/inputs/checkboxes.jsx +1 -1
- package/src/inputs/input-wrapper.jsx +1 -1
- package/src/inputs/input.jsx +8 -7
- package/src/inputs/money.jsx +3 -3
- package/src/inputs/select.jsx +1 -1
- package/src/{key-value-store.mjs → key-value-store.js} +1 -1
- package/src/link.jsx +2 -2
- package/src/modal.jsx +1 -1
- package/src/{model-class-require.mjs → model-class-require.js} +4 -2
- package/src/{model-events.mjs → model-events.js} +1 -1
- package/src/{model-name.mjs → model-name.js} +1 -1
- package/src/{model-recipes-loader.mjs → model-recipes-loader.js} +1 -1
- package/src/{model-recipes-model-loader.mjs → model-recipes-model-loader.js} +2 -2
- package/src/{models-response-reader.mjs → models-response-reader.js} +2 -2
- package/src/models.js +7 -0
- package/src/{models.mjs.erb → models.js.erb} +1 -1
- package/src/{params.mjs → params.js} +2 -2
- package/src/{preloaded.mjs → preloaded.js} +1 -1
- package/src/resize-observer.jsx +1 -1
- package/src/router/route.jsx +1 -1
- package/src/router/switch.jsx +1 -1
- package/src/router.jsx +1 -1
- package/src/{routes-native.mjs → routes-native.js} +1 -1
- package/src/{services.mjs → services.js} +1 -1
- package/src/{session-status-updater.mjs → session-status-updater.js} +3 -3
- package/src/{source-maps-loader.mjs → source-maps-loader.js} +1 -1
- package/src/super-admin/edit-page/edit-attribute-checkbox.jsx +1 -1
- package/src/super-admin/edit-page/edit-attribute-content.jsx +1 -1
- package/src/super-admin/edit-page/edit-attribute-input.jsx +1 -1
- package/src/super-admin/edit-page/edit-attribute.jsx +1 -1
- package/src/super-admin/edit-page.jsx +2 -2
- package/src/super-admin/has-edit-config.js +1 -1
- package/src/super-admin/index-page.jsx +1 -1
- package/src/super-admin/index.jsx +7 -7
- package/src/super-admin/layout/header/index.jsx +2 -2
- package/src/super-admin/layout/index.jsx +3 -3
- package/src/super-admin/layout/menu/index.jsx +3 -3
- package/src/super-admin/layout/menu/menu-content.jsx +2 -2
- package/src/super-admin/layout/menu/{menu-item/index.jsx → menu-item.jsx} +5 -6
- package/src/super-admin/layout/no-access.jsx +2 -2
- package/src/super-admin/model-class-table.jsx +3 -3
- package/src/super-admin/models.js +1 -1
- package/src/super-admin/show-nav.jsx +2 -2
- package/src/super-admin/show-page/belongs-to-attribute-row.jsx +1 -1
- package/src/super-admin/show-page/index.jsx +2 -2
- package/src/super-admin/show-reflection-actions.jsx +1 -1
- package/src/super-admin/show-reflection-link.jsx +1 -1
- package/src/super-admin/show-reflection-page.jsx +1 -1
- package/src/table/column-content.jsx +1 -1
- package/src/table/components/column.jsx +8 -2
- package/src/table/components/header.jsx +2 -2
- package/src/table/filters/filter-form.jsx +1 -1
- package/src/table/filters/index.jsx +5 -3
- package/src/table/filters/load-search-modal.jsx +6 -4
- package/src/table/filters/save-search-modal.jsx +4 -4
- package/src/table/header-column.jsx +59 -79
- package/src/table/header-select.jsx +1 -1
- package/src/table/model-column.jsx +12 -6
- package/src/table/model-row.jsx +11 -7
- package/src/table/{select-calculator.mjs → select-calculator.js} +1 -1
- package/src/table/settings/column-row.jsx +4 -3
- package/src/table/settings/download-action.jsx +3 -3
- package/src/table/settings/index.jsx +3 -3
- package/src/table/table-settings.js +5 -4
- package/src/table/table.jsx +149 -71
- package/src/table/{use-sorting.mjs → use-sorting.js} +1 -1
- package/src/table/{widths.mjs → widths.jsx} +11 -2
- package/src/table/worker-plugins-check-all-checkbox.jsx +2 -2
- package/src/table/worker-plugins-checkbox.jsx +2 -2
- package/src/{translated-collections.mjs → translated-collections.js} +1 -1
- package/src/updated-attribute.jsx +1 -1
- package/src/{use-breakpoint.mjs → use-breakpoint.js} +2 -2
- package/src/use-can-can.js +55 -0
- package/src/{use-collection.mjs → use-collection.js} +4 -4
- package/src/{use-created-event.mjs → use-created-event.js} +2 -2
- package/src/{use-current-user.mjs → use-current-user.js} +6 -5
- package/src/{use-destroyed-event.mjs → use-destroyed-event.js} +2 -2
- package/src/{use-input.mjs → use-input.js} +5 -5
- package/src/use-model-event.js +2 -2
- package/src/{use-model.mjs → use-model.js} +4 -4
- package/src/{use-resize-observer.mjs → use-resize-observer.js} +1 -1
- package/src/use-router.jsx +2 -2
- package/src/{use-updated-event.mjs → use-updated-event.js} +2 -2
- package/src/{use-validation-errors.mjs → use-validation-errors.js} +3 -3
- package/src/utils/checkbox.jsx +2 -2
- package/src/{validation-error.mjs → validation-error.js} +1 -1
- package/src/{validation-errors.mjs → validation-errors.js} +1 -1
- package/src/with-current-user.jsx +1 -1
- package/src/with-model.jsx +1 -1
- package/__tests__/base-model.test.mjs +0 -71
- package/__tests__/cable-connection-pool.test.mjs +0 -227
- package/__tests__/cable-subscription-pool.test.mjs +0 -27
- package/__tests__/can-can.test.mjs +0 -34
- package/__tests__/collection.test.mjs +0 -51
- package/__tests__/custom-error.test.mjs +0 -13
- package/__tests__/model-name.test.mjs +0 -34
- package/__tests__/model-prop-type.test.mjs +0 -113
- package/__tests__/params.test.mjs +0 -40
- package/__tests__/routes-native.test.mjs +0 -104
- package/__tests__/routes.test.mjs +0 -47
- package/__tests__/serializer.test.mjs +0 -30
- package/__tests__/support/task.mjs +0 -27
- package/__tests__/support/user.mjs +0 -32
- package/index.js +0 -1
- package/jest.config.js +0 -9
- package/src/event-created.jsx +0 -12
- package/src/event-destroyed.jsx +0 -25
- package/src/event-emitter-listener.jsx +0 -10
- package/src/event-listener.jsx +0 -25
- package/src/event-updated.jsx +0 -27
- package/src/super-admin/layout/menu/menu-item/style.scss +0 -10
- package/src/use-can-can.mjs +0 -48
- package/src/with-can-can.jsx +0 -12
- package/webpack.config.js +0 -15
- /package/src/{attribute-not-loaded-error.mjs → attribute-not-loaded-error.js} +0 -0
- /package/src/base-model/{column.mjs → column.js} +0 -0
- /package/src/base-model/{scope.mjs → scope.js} +0 -0
- /package/src/{cache-key-generator.mjs → cache-key-generator.js} +0 -0
- /package/src/{channels-consumer.mjs → channels-consumer.js} +0 -0
- /package/src/{command-submit-data.mjs → command-submit-data.js} +0 -0
- /package/src/{config.mjs → config.js} +0 -0
- /package/src/{data-set-to-attributes.mjs → data-set-to-attributes.js} +0 -0
- /package/src/{error-messages.mjs → error-messages.js} +0 -0
- /package/src/{events.mjs → events.js} +0 -0
- /package/src/inputs/{auto-submit.mjs → auto-submit.js} +0 -0
- /package/src/inputs/{id-for-component.mjs → id-for-component.js} +0 -0
- /package/src/inputs/{name-for-component.mjs → name-for-component.js} +0 -0
- /package/src/{instance-of-class-name.mjs → instance-of-class-name.js} +0 -0
- /package/src/{logger.mjs → logger.js} +0 -0
- /package/src/{model-prop-type.mjs → model-prop-type.js} +0 -0
- /package/src/{money-formatter.mjs → money-formatter.js} +0 -0
- /package/src/{not-loaded-error.mjs → not-loaded-error.js} +0 -0
- /package/src/{result.mjs → result.js} +0 -0
- /package/src/{routes.mjs → routes.js} +0 -0
- /package/src/{run-last.mjs → run-last.js} +0 -0
- /package/src/{serializer.mjs → serializer.js} +0 -0
- /package/src/table/{column-identifier.mjs → column-identifier.js} +0 -0
- /package/src/table/{column-visible.mjs → column-visible.js} +0 -0
- /package/src/table/{model-callback-args.mjs → model-callback-args.js} +0 -0
- /package/src/{translated-collections-data.mjs.erb → translated-collections-data.js.erb} +0 -0
- /package/src/{url-encode.mjs → url-encode.js} +0 -0
- /package/src/{use-event-emitter.mjs → use-event-emitter.js} +0 -0
- /package/src/{use-event-listener.mjs → use-event-listener.js} +0 -0
- /package/src/{use-screen-layout.mjs → use-screen-layout.js} +0 -0
package/src/table/table.jsx
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {digg, digs} from "diggerize"
|
|
2
|
-
import {
|
|
2
|
+
import React, {createContext, useContext, useMemo, useRef} from "react"
|
|
3
|
+
import {Animated, Pressable, View} from "react-native"
|
|
3
4
|
import BaseComponent from "../base-component"
|
|
4
5
|
import Card from "../bootstrap/card"
|
|
5
6
|
import classNames from "classnames"
|
|
6
7
|
import Collection from "../collection"
|
|
7
|
-
import columnVisible from "./column-visible
|
|
8
|
+
import columnVisible from "./column-visible"
|
|
8
9
|
import debounce from "debounce"
|
|
10
|
+
import DraggableSort from "../draggable-sort/index"
|
|
11
|
+
import EventEmitter from "events"
|
|
9
12
|
import Filters from "./filters"
|
|
10
13
|
import FlatList from "./components/flat-list"
|
|
11
14
|
import FontAwesomeIcon from "react-native-vector-icons/FontAwesome"
|
|
@@ -15,68 +18,80 @@ import HeaderColumn from "./header-column"
|
|
|
15
18
|
import HeaderSelect from "./header-select"
|
|
16
19
|
import * as inflection from "inflection"
|
|
17
20
|
import memo from "set-state-compare/src/memo"
|
|
18
|
-
import modelClassRequire from "../model-class-require
|
|
21
|
+
import modelClassRequire from "../model-class-require"
|
|
19
22
|
import ModelRow from "./model-row"
|
|
20
23
|
import Paginate from "../bootstrap/paginate"
|
|
21
24
|
import Params from "../params"
|
|
22
25
|
import PropTypes from "prop-types"
|
|
23
|
-
import React, {createContext, useContext, useMemo, useRef} from "react"
|
|
24
26
|
import Row from "./components/row"
|
|
25
27
|
import selectCalculator from "./select-calculator"
|
|
26
28
|
import Select from "../inputs/select"
|
|
27
|
-
import Settings from "./settings"
|
|
29
|
+
import Settings from "./settings/index"
|
|
28
30
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
29
31
|
import TableSettings from "./table-settings"
|
|
30
32
|
import Text from "../utils/text"
|
|
31
33
|
import uniqunize from "uniqunize"
|
|
32
34
|
import useBreakpoint from "../use-breakpoint"
|
|
33
35
|
import useCollection from "../use-collection"
|
|
34
|
-
import useI18n from "i18n-on-steroids/src/use-i18n
|
|
35
|
-
import
|
|
36
|
-
import
|
|
36
|
+
import useI18n from "i18n-on-steroids/src/use-i18n"
|
|
37
|
+
import useEventEmitter from "../use-event-emitter"
|
|
38
|
+
import useModelEvent from "../use-model-event"
|
|
39
|
+
import useQueryParams from "on-location-changed/src/use-query-params"
|
|
37
40
|
import Widths from "./widths"
|
|
38
41
|
|
|
39
42
|
const paginationOptions = [30, 60, 90, ["All", "all"]]
|
|
40
43
|
const WorkerPluginsCheckAllCheckbox = React.lazy(() => import("./worker-plugins-check-all-checkbox"))
|
|
41
44
|
const TableContext = createContext()
|
|
42
45
|
|
|
43
|
-
const ListHeaderComponent = memo((
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
46
|
+
const ListHeaderComponent = memo(shapeComponent(class ListHeaderComponent extends BaseComponent {
|
|
47
|
+
setup() {
|
|
48
|
+
this.useStates({
|
|
49
|
+
lastUpdate: new Date()
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
render() {
|
|
54
|
+
const {mdUp} = useBreakpoint()
|
|
55
|
+
const tableContextValue = useContext(TableContext)
|
|
56
|
+
const table = tableContextValue.table
|
|
57
|
+
const {collection, events, queryWithoutPagination, t} = table.tt
|
|
58
|
+
const {query} = digs(collection, "query")
|
|
59
|
+
|
|
60
|
+
useEventEmitter(events, "columnVisibilityUpdated", this.tt.onColumnVisibilityUpdated)
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Row dataSet={{class: "api-maker/table/header-row"}} style={table.styleForRowHeader()}>
|
|
64
|
+
{table.p.workplace && table.s.currentWorkplace &&
|
|
65
|
+
<Header style={table.styleForHeader({style: {width: mdUp ? 41 : undefined}})}>
|
|
66
|
+
<WorkerPluginsCheckAllCheckbox
|
|
67
|
+
currentWorkplace={table.s.currentWorkplace}
|
|
68
|
+
query={queryWithoutPagination}
|
|
69
|
+
style={{marginHorizontal: "auto"}}
|
|
70
|
+
/>
|
|
71
|
+
{!mdUp &&
|
|
72
|
+
<Text style={{marginLeft: 3}}>
|
|
73
|
+
{t(".select_all_found", {defaultValue: "Select all found"})}
|
|
74
|
+
</Text>
|
|
75
|
+
}
|
|
76
|
+
</Header>
|
|
77
|
+
}
|
|
78
|
+
{!mdUp &&
|
|
79
|
+
<Header style={table.styleForHeader({style: {}})}>
|
|
80
|
+
<HeaderSelect preparedColumns={table.s.preparedColumns} query={query} table={table} />
|
|
81
|
+
</Header>
|
|
82
|
+
}
|
|
83
|
+
{mdUp &&
|
|
84
|
+
<>
|
|
85
|
+
{table.headersContentFromColumns()}
|
|
86
|
+
<Header style={table.styleForHeader({style: {}, type: "actions"})} />
|
|
87
|
+
</>
|
|
88
|
+
}
|
|
89
|
+
</Row>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
onColumnVisibilityUpdated = () => this.setState({lastUpdate: new Date()})
|
|
94
|
+
}))
|
|
80
95
|
|
|
81
96
|
export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
82
97
|
static defaultProps = {
|
|
@@ -132,7 +147,9 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
132
147
|
workplace: PropTypes.bool.isRequired
|
|
133
148
|
}
|
|
134
149
|
|
|
135
|
-
|
|
150
|
+
draggableSortEvents = new EventEmitter()
|
|
151
|
+
events = new EventEmitter()
|
|
152
|
+
tableSettings = null
|
|
136
153
|
|
|
137
154
|
setup() {
|
|
138
155
|
const {t} = useI18n({namespace: "js.api_maker.table"})
|
|
@@ -151,14 +168,15 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
151
168
|
|
|
152
169
|
if (!queryName) queryName = collectionKey
|
|
153
170
|
|
|
154
|
-
const columnsAsArray = this.columnsAsArray()
|
|
155
171
|
const querySName = `${queryName}_s`
|
|
156
172
|
|
|
157
173
|
this.useStates({
|
|
158
|
-
columns: columnsAsArray,
|
|
174
|
+
columns: () => this.columnsAsArray(),
|
|
159
175
|
currentWorkplace: undefined,
|
|
160
176
|
currentWorkplaceCount: null,
|
|
161
177
|
filterForm: null,
|
|
178
|
+
columnsToShow: null,
|
|
179
|
+
draggedColumn: null,
|
|
162
180
|
identifier: () => this.props.identifier || `${collectionKey}-default`,
|
|
163
181
|
lastUpdate: () => new Date(),
|
|
164
182
|
preload: undefined,
|
|
@@ -181,9 +199,10 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
181
199
|
() => ({
|
|
182
200
|
cacheKey: this.s.tableSettingFullCacheKey,
|
|
183
201
|
lastUpdate: this.s.lastUpdate,
|
|
202
|
+
resizing: this.s.resizing,
|
|
184
203
|
table: this
|
|
185
204
|
}),
|
|
186
|
-
[this.s.lastUpdate, this.s.tableSettingFullCacheKey]
|
|
205
|
+
[this.s.lastUpdate, this.s.resizing, this.s.tableSettingFullCacheKey]
|
|
187
206
|
)
|
|
188
207
|
|
|
189
208
|
useMemo(() => {
|
|
@@ -195,7 +214,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
195
214
|
}, [this.p.currentUser?.id()])
|
|
196
215
|
|
|
197
216
|
useMemo(() => {
|
|
198
|
-
if (!this.tt.
|
|
217
|
+
if (!this.tt.tableSettings && this.s.width) {
|
|
199
218
|
this.loadTableSetting()
|
|
200
219
|
}
|
|
201
220
|
}, [this.p.currentUser?.id(), this.s.width])
|
|
@@ -235,8 +254,16 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
235
254
|
() => this.collection?.query?.clone()?.except("page"),
|
|
236
255
|
[this.collection.query]
|
|
237
256
|
)
|
|
257
|
+
|
|
258
|
+
useEventEmitter(this.tt.draggableSortEvents, "onDragStart", this.tt.onDragStart)
|
|
259
|
+
useEventEmitter(this.tt.draggableSortEvents, "onDragEndAnimation", this.tt.onDragEndAnimation)
|
|
260
|
+
useEventEmitter(this.tt.events, "columnVisibilityUpdated", this.tt.onColumnVisibilityUpdated)
|
|
238
261
|
}
|
|
239
262
|
|
|
263
|
+
onColumnVisibilityUpdated = () => this.setState({columnsToShow: this.getColumnsToShow(this.s.columns), lastUpdate: new Date()})
|
|
264
|
+
onDragStart = ({item}) => item.animatedZIndex.setValue(9999)
|
|
265
|
+
onDragEndAnimation = ({item}) => item.animatedZIndex.setValue(0)
|
|
266
|
+
|
|
240
267
|
async loadCurrentWorkplace() {
|
|
241
268
|
const Workplace = modelClassRequire("Workplace")
|
|
242
269
|
const result = await Workplace.current()
|
|
@@ -257,6 +284,12 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
257
284
|
this.setState({currentWorkplaceCount})
|
|
258
285
|
}
|
|
259
286
|
|
|
287
|
+
getColumnsToShow(columns) {
|
|
288
|
+
return columns
|
|
289
|
+
.filter(({column, tableSettingColumn}) => columnVisible(column, tableSettingColumn))
|
|
290
|
+
.sort((a, b) => a.tableSettingColumn.position() - b.tableSettingColumn.position())
|
|
291
|
+
}
|
|
292
|
+
|
|
260
293
|
async loadTableSetting() {
|
|
261
294
|
this.tableSettings = new TableSettings({table: this})
|
|
262
295
|
|
|
@@ -264,8 +297,11 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
264
297
|
const {columns, preload} = this.tableSettings.preparedColumns(tableSetting)
|
|
265
298
|
const {width} = this.s
|
|
266
299
|
const widths = new Widths({columns, table: this, width})
|
|
300
|
+
const columnsToShow = this.getColumnsToShow(columns)
|
|
267
301
|
|
|
268
302
|
this.setState({
|
|
303
|
+
columns,
|
|
304
|
+
columnsToShow,
|
|
269
305
|
preparedColumns: columns,
|
|
270
306
|
preload: this.mergedPreloads(preload),
|
|
271
307
|
tableSetting,
|
|
@@ -450,7 +486,11 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
450
486
|
<TableContext.Provider value={this.tt.tableContextValue}>
|
|
451
487
|
<FlatList
|
|
452
488
|
data={models}
|
|
453
|
-
dataSet={{
|
|
489
|
+
dataSet={{
|
|
490
|
+
class: classNames("api-maker--table", className),
|
|
491
|
+
cacheKey: this.s.tableSettingFullCacheKey,
|
|
492
|
+
lastUpdate: this.s.lastUpdate
|
|
493
|
+
}}
|
|
454
494
|
extraData={this.s.lastUpdate}
|
|
455
495
|
keyExtractor={this.tt.keyExtrator}
|
|
456
496
|
ListHeaderComponent={ListHeaderComponent}
|
|
@@ -575,8 +615,6 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
575
615
|
}
|
|
576
616
|
|
|
577
617
|
renderItem = ({index, item: model}) => {
|
|
578
|
-
const {preparedColumns, tableSettingFullCacheKey} = this.s
|
|
579
|
-
|
|
580
618
|
if (!this.s.tableSettingLoaded) {
|
|
581
619
|
return (
|
|
582
620
|
<View>
|
|
@@ -590,13 +628,14 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
590
628
|
return (
|
|
591
629
|
<ModelRow
|
|
592
630
|
cacheKey={model.cacheKey()}
|
|
631
|
+
columns={this.s.columnsToShow}
|
|
593
632
|
columnWidths={this.columnWidths()}
|
|
633
|
+
events={this.tt.events}
|
|
594
634
|
index={index}
|
|
595
635
|
key={model.id()}
|
|
596
636
|
model={model}
|
|
597
|
-
preparedColumns={preparedColumns}
|
|
598
637
|
table={this}
|
|
599
|
-
tableSettingFullCacheKey={tableSettingFullCacheKey}
|
|
638
|
+
tableSettingFullCacheKey={this.s.tableSettingFullCacheKey}
|
|
600
639
|
/>
|
|
601
640
|
)
|
|
602
641
|
}
|
|
@@ -611,7 +650,7 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
611
650
|
|
|
612
651
|
if (styleUI) {
|
|
613
652
|
Object.assign(defaultStyle, {
|
|
614
|
-
backgroundColor: even ? "#f5f5f5" :
|
|
653
|
+
backgroundColor: even ? "#f5f5f5" : "#fff"
|
|
615
654
|
})
|
|
616
655
|
}
|
|
617
656
|
|
|
@@ -648,10 +687,6 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
648
687
|
defaultStyle.borderRight = "1px solid #dbdbdb"
|
|
649
688
|
}
|
|
650
689
|
|
|
651
|
-
if (mdUp) {
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
|
|
655
690
|
const actualStyle = Object.assign(
|
|
656
691
|
defaultStyle,
|
|
657
692
|
style
|
|
@@ -798,17 +833,60 @@ export default memo(shapeComponent(class ApiMakerTable extends BaseComponent {
|
|
|
798
833
|
return columnWidths
|
|
799
834
|
}
|
|
800
835
|
|
|
801
|
-
headersContentFromColumns = () =>
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
836
|
+
headersContentFromColumns = () => {
|
|
837
|
+
return (
|
|
838
|
+
<DraggableSort
|
|
839
|
+
data={this.s.columnsToShow}
|
|
840
|
+
events={this.tt.draggableSortEvents}
|
|
841
|
+
horizontal
|
|
842
|
+
keyExtractor={this.tt.dragListkeyExtractor}
|
|
843
|
+
onItemMoved={this.tt.onItemMoved}
|
|
844
|
+
onReordered={this.tt.onReordered}
|
|
845
|
+
renderItem={this.tt.dragListRenderItemContent}
|
|
846
|
+
/>
|
|
847
|
+
)
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
dragListCacheKeyExtractor = (item) => `${item.tableSettingColumn.identifier()}-${this.s.resizing}`
|
|
851
|
+
dragListkeyExtractor = (item) => item.tableSettingColumn.identifier()
|
|
852
|
+
|
|
853
|
+
onItemMoved = ({animationArgs, itemIndex, x, y}) => {
|
|
854
|
+
const animatedPosition = digg(this, "s", "columnsToShow", itemIndex, "animatedPosition")
|
|
855
|
+
|
|
856
|
+
if (animationArgs) {
|
|
857
|
+
Animated.timing(animatedPosition, animationArgs).start()
|
|
858
|
+
} else {
|
|
859
|
+
animatedPosition.setValue({x, y})
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
onReordered = async ({fromItem, fromPosition, toItem, toPosition}) => {
|
|
864
|
+
if (fromPosition == toPosition) return // Only do requests and queries if changed
|
|
865
|
+
|
|
866
|
+
const TableSettingColumn = fromItem.tableSettingColumn.constructor
|
|
867
|
+
const toColumn = await TableSettingColumn.find(toItem.tableSettingColumn.id()) // Need to load latest position because ActsAsList might have changed it
|
|
868
|
+
|
|
869
|
+
await fromItem.tableSettingColumn.update({position: toColumn.position()})
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
dragListRenderItemContent = ({isActive, item, touchProps}) => {
|
|
873
|
+
const {animatedWidth, animatedZIndex, column, tableSettingColumn} = item
|
|
874
|
+
|
|
875
|
+
return (
|
|
876
|
+
<HeaderColumn
|
|
877
|
+
active={isActive}
|
|
878
|
+
animatedWidth={animatedWidth}
|
|
879
|
+
animatedZIndex={animatedZIndex}
|
|
880
|
+
column={column}
|
|
881
|
+
key={tableSettingColumn.identifier()}
|
|
882
|
+
resizing={this.s.resizing}
|
|
883
|
+
table={this}
|
|
884
|
+
tableSettingColumn={tableSettingColumn}
|
|
885
|
+
touchProps={touchProps}
|
|
886
|
+
widths={this.s.widths}
|
|
887
|
+
/>
|
|
888
|
+
)
|
|
889
|
+
}
|
|
812
890
|
|
|
813
891
|
headerClassNameForColumn(column) {
|
|
814
892
|
const classNames = []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {camelize} from "inflection"
|
|
2
|
-
import useQueryParams from "on-location-changed/src/use-query-params
|
|
2
|
+
import useQueryParams from "on-location-changed/src/use-query-params"
|
|
3
3
|
|
|
4
4
|
const calculateQParams = (defaultParams, queryParams, searchKey) => {
|
|
5
5
|
if (searchKey in queryParams) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Animated, Easing} from "react-native"
|
|
1
2
|
import {digg} from "diggerize"
|
|
2
3
|
|
|
3
4
|
export default class TableWidths {
|
|
@@ -19,7 +20,15 @@ export default class TableWidths {
|
|
|
19
20
|
const column = this.columns[columnIndex]
|
|
20
21
|
const tableSettingColumn = column.tableSettingColumn
|
|
21
22
|
|
|
23
|
+
if (column.animatedPosition) throw new Error("Column already had an animated position")
|
|
24
|
+
|
|
25
|
+
column.animatedPosition = new Animated.ValueXY()
|
|
26
|
+
column.animatedZIndex = new Animated.Value(0)
|
|
27
|
+
|
|
22
28
|
if (tableSettingColumn.hasWidth()) {
|
|
29
|
+
if (column.animatedWidth) throw new Error("Column already had an animated width")
|
|
30
|
+
|
|
31
|
+
column.animatedWidth = new Animated.Value(tableSettingColumn.width())
|
|
23
32
|
column.width = tableSettingColumn.width()
|
|
24
33
|
|
|
25
34
|
widthLeft -= tableSettingColumn.width()
|
|
@@ -44,6 +53,7 @@ export default class TableWidths {
|
|
|
44
53
|
|
|
45
54
|
if (newWidth < 200) newWidth = 200
|
|
46
55
|
|
|
56
|
+
column.animatedWidth = new Animated.Value(newWidth)
|
|
47
57
|
column.width = newWidth
|
|
48
58
|
|
|
49
59
|
updateData << {
|
|
@@ -72,7 +82,6 @@ export default class TableWidths {
|
|
|
72
82
|
if (!column) throw new Error(`No such column: ${identifier}`)
|
|
73
83
|
|
|
74
84
|
column.width = width
|
|
75
|
-
|
|
76
|
-
this.table.setState({lastUpdate: new Date()})
|
|
85
|
+
column.animatedWidth.setValue(width)
|
|
77
86
|
}
|
|
78
87
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {useEffect, useMemo, useRef} from "react"
|
|
2
2
|
import BaseComponent from "../base-component"
|
|
3
3
|
import classNames from "classnames"
|
|
4
|
-
import Collection from "../collection
|
|
4
|
+
import Collection from "../collection"
|
|
5
5
|
import memo from "set-state-compare/src/memo"
|
|
6
6
|
import PropTypes from "prop-types"
|
|
7
7
|
import propTypesExact from "prop-types-exact"
|
|
8
8
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
9
9
|
import {simpleObjectDifferent} from "set-state-compare/src/diff-utils"
|
|
10
|
-
import useModelEvent from "../use-model-event
|
|
10
|
+
import useModelEvent from "../use-model-event"
|
|
11
11
|
|
|
12
12
|
const Checkbox = memo(shapeComponent(class Checkbox extends BaseComponent {
|
|
13
13
|
render() {
|
|
@@ -2,12 +2,12 @@ import BaseComponent from "../base-component"
|
|
|
2
2
|
import classNames from "classnames"
|
|
3
3
|
import {digg} from "diggerize"
|
|
4
4
|
import memo from "set-state-compare/src/memo"
|
|
5
|
-
import modelClassRequire from "../model-class-require
|
|
5
|
+
import modelClassRequire from "../model-class-require"
|
|
6
6
|
import PropTypes from "prop-types"
|
|
7
7
|
import PropTypesExact from "prop-types-exact"
|
|
8
8
|
import {useMemo} from "react"
|
|
9
9
|
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
10
|
-
import useModelEvent from "../use-model-event
|
|
10
|
+
import useModelEvent from "../use-model-event"
|
|
11
11
|
|
|
12
12
|
const Workplace = modelClassRequire("Workplace")
|
|
13
13
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {digg} from "diggerize"
|
|
2
|
-
import translatedCollectionsData from "
|
|
2
|
+
import translatedCollectionsData from "../src/translated-collections-data.js.erb"
|
|
3
3
|
|
|
4
4
|
export default class ApiMakerTranslatedCollections {
|
|
5
5
|
static get (modelClass, collectionName) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {useCallback, useLayoutEffect} from "react"
|
|
2
|
-
import apiMakerConfig from "@kaspernj/api-maker/
|
|
2
|
+
import apiMakerConfig from "@kaspernj/api-maker/build/config"
|
|
3
3
|
import {Dimensions} from "react-native"
|
|
4
|
-
import useShape from "set-state-compare/src/use-shape
|
|
4
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
5
5
|
|
|
6
6
|
const calculateBreakPoint = (window) => {
|
|
7
7
|
const windowWidth = window.width
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import CanCan from "./can-can"
|
|
2
|
+
import {useCallback, useMemo, useState} from "react"
|
|
3
|
+
import useCurrentUser from "./use-current-user"
|
|
4
|
+
import useEventEmitter from "./use-event-emitter"
|
|
5
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
6
|
+
|
|
7
|
+
const useCanCan = (abilitiesCallback, dependencies) => {
|
|
8
|
+
const currentUser = useCurrentUser()
|
|
9
|
+
const s = useShape({abilitiesCallback})
|
|
10
|
+
|
|
11
|
+
s.useStates({
|
|
12
|
+
canCan: null,
|
|
13
|
+
lastUpdate: new Date()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
if (!dependencies) {
|
|
17
|
+
dependencies = [currentUser?.id()]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const loadAbilities = useCallback(async () => {
|
|
21
|
+
const canCan = CanCan.current()
|
|
22
|
+
const abilities = s.p.abilitiesCallback()
|
|
23
|
+
|
|
24
|
+
await canCan.loadAbilities(abilities)
|
|
25
|
+
|
|
26
|
+
s.set({canCan, lastUpdate: new Date()})
|
|
27
|
+
}, [])
|
|
28
|
+
|
|
29
|
+
const onResetAbilities = useCallback(async () => {
|
|
30
|
+
s.set({canCan: null}, {silent: true})
|
|
31
|
+
await loadAbilities()
|
|
32
|
+
}, [])
|
|
33
|
+
|
|
34
|
+
const loadAbilitiesOnNew = useCallback(async () => {
|
|
35
|
+
const canCan = s.s.canCan
|
|
36
|
+
|
|
37
|
+
s.set({canCan: null}, {silent: true})
|
|
38
|
+
|
|
39
|
+
if (canCan) {
|
|
40
|
+
await canCan?.resetAbilities()
|
|
41
|
+
} else {
|
|
42
|
+
await loadAbilities()
|
|
43
|
+
}
|
|
44
|
+
}, [])
|
|
45
|
+
|
|
46
|
+
useMemo(() => {
|
|
47
|
+
loadAbilitiesOnNew()
|
|
48
|
+
}, dependencies)
|
|
49
|
+
|
|
50
|
+
useEventEmitter(CanCan.current().events, "onResetAbilities", onResetAbilities)
|
|
51
|
+
|
|
52
|
+
return s.s.canCan
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default useCanCan
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import debounce from "debounce"
|
|
2
2
|
import {digg} from "diggerize"
|
|
3
3
|
import * as inflection from "inflection"
|
|
4
|
-
import ModelEvents from "./model-events
|
|
4
|
+
import ModelEvents from "./model-events"
|
|
5
5
|
import {useCallback, useLayoutEffect, useMemo} from "react"
|
|
6
|
-
import useCreatedEvent from "./use-created-event
|
|
7
|
-
import useShape from "set-state-compare/src/use-shape
|
|
8
|
-
import useQueryParams from "on-location-changed/src/use-query-params
|
|
6
|
+
import useCreatedEvent from "./use-created-event"
|
|
7
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
8
|
+
import useQueryParams from "on-location-changed/src/use-query-params"
|
|
9
9
|
|
|
10
10
|
const useCollection = (props, cacheKeys = []) => {
|
|
11
11
|
const {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import debounceFunction from "debounce"
|
|
2
|
-
import ModelEvents from "./model-events
|
|
2
|
+
import ModelEvents from "./model-events"
|
|
3
3
|
import PropTypes from "prop-types"
|
|
4
4
|
import propTypesExact from "prop-types-exact"
|
|
5
5
|
import {useCallback, useLayoutEffect} from "react"
|
|
6
|
-
import useShape from "set-state-compare/src/use-shape
|
|
6
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
7
7
|
|
|
8
8
|
const ApiMakerUseCreatedEvent = (modelClass, onCreated, args = {}) => {
|
|
9
9
|
const {active = true, debounce} = args
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {useCallback, useMemo} from "react"
|
|
2
2
|
import {camelize} from "inflection"
|
|
3
|
-
import Devise from "./devise
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import Devise from "./devise"
|
|
4
|
+
import {digg} from "diggerize"
|
|
5
|
+
import Logger from "./logger"
|
|
6
|
+
import Services from "./services"
|
|
7
|
+
import useEventEmitter from "./use-event-emitter"
|
|
8
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
8
9
|
|
|
9
10
|
const logger = new Logger({name: "ApiMaker / useCurrentUser"})
|
|
10
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {useCallback, useLayoutEffect, useMemo} from "react"
|
|
2
2
|
import debounceFunction from "debounce"
|
|
3
|
-
import ModelEvents from "./model-events
|
|
4
|
-
import useShape from "set-state-compare/src/use-shape
|
|
3
|
+
import ModelEvents from "./model-events"
|
|
4
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
5
5
|
|
|
6
6
|
const apiMakerUseDestroyedEvent = (model, onDestroyed, props) => {
|
|
7
7
|
const {active = true, debounce, onConnected, ...restProps} = props || {}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {dig, digg} from "diggerize"
|
|
2
2
|
import {useCallback, useEffect, useMemo} from "react"
|
|
3
|
-
import idForComponent from "./inputs/id-for-component
|
|
4
|
-
import nameForComponent from "./inputs/name-for-component
|
|
3
|
+
import idForComponent from "./inputs/id-for-component"
|
|
4
|
+
import nameForComponent from "./inputs/name-for-component"
|
|
5
5
|
import strftime from "strftime"
|
|
6
|
-
import useShape from "set-state-compare/src/use-shape
|
|
7
|
-
import useValidationErrors from "./use-validation-errors
|
|
6
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
7
|
+
import useValidationErrors from "./use-validation-errors"
|
|
8
8
|
|
|
9
9
|
const useInput = ({props, wrapperOptions, ...useInputRestProps}) => {
|
|
10
10
|
const useInputRestPropsKeys = Object.keys(useInputRestProps)
|
|
@@ -47,7 +47,7 @@ const useInput = ({props, wrapperOptions, ...useInputRestProps}) => {
|
|
|
47
47
|
const inputDefaultChecked = useCallback(() => {
|
|
48
48
|
if ("defaultChecked" in s.props) {
|
|
49
49
|
return s.props.defaultChecked
|
|
50
|
-
} else if (s.props.model) {
|
|
50
|
+
} else if (s.props.attribute && s.props.model) {
|
|
51
51
|
if (!s.props.model[s.props.attribute])
|
|
52
52
|
throw new Error(`No such attribute: ${s.props.attribute}`)
|
|
53
53
|
|
package/src/use-model-event.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {useCallback, useLayoutEffect, useMemo} from "react"
|
|
2
2
|
import debounceFunction from "debounce"
|
|
3
|
-
import ModelEvents from "./model-events
|
|
4
|
-
import useShape from "set-state-compare/src/use-shape
|
|
3
|
+
import ModelEvents from "./model-events"
|
|
4
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
5
5
|
|
|
6
6
|
const apiMakerUseModelEvent = (model, event, onCallback, props) => {
|
|
7
7
|
const {active = true, debounce, onConnected, ...restProps} = props || {}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {useCallback, useLayoutEffect, useMemo} from "react"
|
|
2
|
-
import Devise from "./devise
|
|
2
|
+
import Devise from "./devise"
|
|
3
3
|
import * as inflection from "inflection"
|
|
4
|
-
import ModelEvents from "./model-events
|
|
5
|
-
import useQueryParams from "on-location-changed/src/use-query-params
|
|
6
|
-
import useShape from "set-state-compare/src/use-shape
|
|
4
|
+
import ModelEvents from "./model-events"
|
|
5
|
+
import useQueryParams from "on-location-changed/src/use-query-params"
|
|
6
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
7
7
|
|
|
8
8
|
const useModel = (modelClassArg, argsArg = {}) => {
|
|
9
9
|
const queryParams = useQueryParams()
|
package/src/use-router.jsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import config from "./config
|
|
1
|
+
import config from "./config"
|
|
2
2
|
import escapeStringRegexp from "escape-string-regexp"
|
|
3
3
|
import * as inflection from "inflection"
|
|
4
4
|
import PropTypes from "prop-types"
|
|
5
5
|
import {useCallback, useMemo} from "react"
|
|
6
|
-
import useShape from "set-state-compare/src/use-shape
|
|
6
|
+
import useShape from "set-state-compare/src/use-shape"
|
|
7
7
|
|
|
8
8
|
const useRouter = (props) => {
|
|
9
9
|
const s = useShape(props)
|