@kaspernj/api-maker 1.0.2011 → 1.0.2013
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} +10 -1
- 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.js +135 -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 +129 -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 +131 -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 +9 -0
- package/build/collection-loader.js +48 -0
- package/build/collection.js +280 -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 +62 -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 +112 -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-emitter-listener.js +15 -0
- package/build/event-model-class.js +24 -0
- package/build/events.js +5 -0
- package/build/flash-message.js +79 -0
- package/build/form.js +83 -0
- package/build/history-expo.js +20 -0
- package/build/history-react-native.js +20 -0
- package/build/history.js +3 -0
- package/build/index.js +3 -0
- package/build/inputs/attachment.js +133 -0
- package/build/inputs/auto-submit.js +36 -0
- package/build/inputs/checkbox.js +138 -0
- package/build/inputs/checkboxes.js +112 -0
- package/build/inputs/id-for-component.js +15 -0
- package/build/inputs/input-wrapper.js +19 -0
- package/build/inputs/input.js +243 -0
- package/build/inputs/money.js +179 -0
- package/build/inputs/name-for-component.js +13 -0
- package/build/inputs/select.js +93 -0
- package/build/instance-of-class-name.js +23 -0
- package/build/is-expo.js +22 -0
- package/build/key-value-store.js +53 -0
- package/build/link.js +73 -0
- package/build/logger.js +30 -0
- package/build/modal.js +38 -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 +78 -0
- package/build/not-loaded-error.js +2 -0
- package/build/params.js +61 -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 +270 -0
- package/build/router/switch.js +72 -0
- package/build/router.js +59 -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 +134 -0
- package/build/source-maps-loader.js +184 -0
- package/build/super-admin/config-reader.js +85 -0
- package/build/super-admin/edit-page/edit-attribute-checkbox.js +85 -0
- package/build/super-admin/edit-page/edit-attribute-content.js +55 -0
- package/build/super-admin/edit-page/edit-attribute-input.js +79 -0
- package/build/super-admin/edit-page/edit-attribute.js +77 -0
- package/build/super-admin/edit-page.js +123 -0
- package/build/super-admin/has-edit-config.js +12 -0
- package/build/super-admin/index-page.js +25 -0
- package/build/super-admin/index.js +181 -0
- package/build/super-admin/layout/header/index.js +161 -0
- package/build/super-admin/layout/index.js +164 -0
- package/build/super-admin/layout/menu/index.js +206 -0
- package/build/super-admin/layout/menu/menu-content.js +46 -0
- package/build/super-admin/layout/menu/menu-item.js +84 -0
- package/build/super-admin/layout/no-access.js +27 -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 +51 -0
- package/build/super-admin/show-page/belongs-to-attribute-row.js +29 -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 +48 -0
- package/build/super-admin/show-reflection-page.js +48 -0
- package/build/table/column-content.js +117 -0
- package/build/table/column-identifier.js +18 -0
- package/build/table/column-visible.js +7 -0
- package/build/table/components/column.js +21 -0
- package/build/table/components/flat-list.js +21 -0
- package/build/table/components/header.js +26 -0
- package/build/table/components/row.js +26 -0
- package/build/table/filters/attribute-element.js +44 -0
- package/build/table/filters/filter-form.js +402 -0
- package/build/table/filters/filter.js +90 -0
- package/build/table/filters/index.js +184 -0
- package/build/table/filters/load-search-modal.js +175 -0
- package/build/table/filters/reflection-element.js +37 -0
- package/build/table/filters/save-search-modal.js +88 -0
- package/build/table/filters/scope-element.js +42 -0
- package/build/table/header-column-content.js +68 -0
- package/build/table/header-column.js +144 -0
- package/build/table/header-select.js +105 -0
- package/build/table/model-callback-args.js +10 -0
- package/build/table/model-column.js +97 -0
- package/build/table/model-row.js +193 -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 +79 -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 +12 -0
- package/build/updated-attribute.js +76 -0
- package/build/url-encode.js +15 -0
- package/build/use-breakpoint.js +71 -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 +76 -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 +137 -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 +104 -0
- package/build/use-screen-layout.js +39 -0
- package/build/use-styles.js +41 -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 +78 -0
- package/build/utils/checkboxes.js +163 -0
- package/build/utils/default-style.js +18 -0
- package/build/utils/icon.js +23 -0
- package/build/utils/invalid-feedback.js +19 -0
- package/build/utils/modal.js +62 -0
- package/build/utils/text.js +44 -0
- package/build/validation-error.js +28 -0
- package/build/validation-errors.js +98 -0
- package/build/with-api-maker.js +29 -0
- package/build/with-collection.js +14 -0
- package/build/with-current-user.js +10 -0
- package/build/with-model.js +15 -0
- package/build/with-router.js +22 -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 +49 -46
- package/src/{api.mjs → api.js} +38 -37
- package/src/base-component.jsx +5 -0
- package/src/{base-error.mjs → base-error.js} +4 -6
- package/src/base-model/attribute.js +33 -0
- package/src/base-model/column.js +13 -0
- package/src/base-model/reflection.js +15 -0
- package/src/base-model/scope.js +12 -0
- package/src/{base-model.mjs → base-model.js} +302 -144
- package/src/bootstrap/attribute-row.jsx +135 -0
- package/src/bootstrap/attribute-rows.jsx +27 -0
- package/src/bootstrap/card.jsx +149 -0
- package/src/bootstrap/checkbox.jsx +86 -0
- package/src/bootstrap/checkboxes.jsx +185 -0
- package/src/bootstrap/index.js +0 -0
- package/src/bootstrap/input.jsx +173 -0
- package/src/bootstrap/invalid-feedback.jsx +31 -0
- package/src/bootstrap/paginate.jsx +187 -0
- package/src/bootstrap/radio-buttons.jsx +87 -0
- package/src/bootstrap/select.jsx +110 -0
- package/src/bootstrap/sort-link.jsx +106 -0
- package/src/{cable-connection-pool.mjs → cable-connection-pool.js} +16 -36
- package/src/{cable-subscription-pool.mjs → cable-subscription-pool.js} +26 -21
- package/src/{cable-subscription.mjs → cable-subscription.js} +6 -4
- package/src/cache-key-generator.js +100 -0
- package/src/{can-can.mjs → can-can.js} +13 -12
- package/src/channels-consumer.js +10 -0
- package/src/collection-loader.jsx +58 -224
- package/src/{collection.mjs → collection.js} +98 -44
- package/src/{command-submit-data.mjs → command-submit-data.js} +2 -7
- package/src/{commands-pool.mjs → commands-pool.js} +57 -41
- package/src/compose.js +11 -0
- package/src/{config.mjs → config.js} +6 -2
- package/src/{custom-error.mjs → custom-error.js} +1 -1
- package/src/data-set-to-attributes.js +13 -0
- package/src/{deserializer.mjs → deserializer.js} +3 -3
- package/src/destroy-error.js +7 -0
- package/src/devise.js +129 -0
- 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} +12 -7
- package/src/{error-messages.mjs → error-messages.js} +1 -0
- package/src/event-connection.jsx +1 -1
- package/src/event-emitter-listener.jsx +8 -27
- package/src/event-model-class.jsx +2 -4
- package/src/events.js +7 -0
- package/src/flash-message.js +70 -0
- package/src/form.jsx +91 -0
- package/src/history-expo.js +23 -0
- package/src/history-react-native.js +25 -0
- package/src/history.js +3 -0
- package/src/index.js +3 -0
- package/src/inputs/attachment.jsx +108 -0
- package/src/inputs/auto-submit.js +37 -0
- package/src/inputs/checkbox.jsx +125 -0
- package/src/inputs/checkboxes.jsx +116 -0
- package/src/inputs/id-for-component.js +15 -0
- package/src/inputs/input-wrapper.jsx +16 -0
- package/src/inputs/input.jsx +260 -0
- package/src/inputs/money.jsx +187 -0
- package/src/inputs/name-for-component.js +15 -0
- package/src/inputs/select.jsx +104 -0
- package/src/is-expo.js +18 -0
- package/src/{key-value-store.mjs → key-value-store.js} +1 -1
- package/src/link.jsx +54 -9
- package/src/logger.js +38 -0
- package/src/modal.jsx +37 -0
- package/src/model-class-require.js +17 -0
- package/src/{model-events.mjs → model-events.js} +1 -1
- package/src/{model-name.mjs → model-name.js} +8 -8
- package/src/{model-recipes-loader.mjs → model-recipes-loader.js} +1 -1
- package/src/{model-recipes-model-loader.mjs → model-recipes-model-loader.js} +5 -5
- package/src/{models-response-reader.mjs → models-response-reader.js} +3 -4
- package/src/models.js +7 -0
- package/src/{models.mjs.erb → models.js.erb} +6 -3
- package/src/{money-formatter.mjs → money-formatter.js} +5 -4
- package/src/{params.mjs → params.js} +17 -7
- package/src/{preloaded.mjs → preloaded.js} +2 -2
- package/src/resize-observer.jsx +10 -0
- package/src/result.js +13 -0
- package/src/router/route.jsx +246 -0
- package/src/router/switch.jsx +76 -0
- package/src/router.jsx +23 -21
- package/src/{routes-native.mjs → routes-native.js} +12 -6
- package/src/{routes.mjs → routes.js} +1 -1
- package/src/run-last.js +39 -0
- package/src/{serializer.mjs → serializer.js} +2 -2
- package/src/{services.mjs → services.js} +1 -1
- package/src/session-status-updater.js +172 -0
- package/src/{source-maps-loader.mjs → source-maps-loader.js} +54 -28
- package/src/super-admin/config-reader.jsx +93 -0
- package/src/super-admin/edit-page/edit-attribute-checkbox.jsx +81 -0
- package/src/super-admin/edit-page/edit-attribute-content.jsx +57 -0
- package/src/super-admin/edit-page/edit-attribute-input.jsx +71 -0
- package/src/super-admin/edit-page/edit-attribute.jsx +81 -0
- package/src/super-admin/edit-page.jsx +117 -0
- package/src/super-admin/has-edit-config.js +15 -0
- package/src/super-admin/index-page.jsx +23 -0
- package/src/super-admin/index.jsx +197 -0
- package/src/super-admin/layout/header/index.jsx +144 -0
- package/src/super-admin/layout/header/style.scss +45 -0
- package/src/super-admin/layout/index.jsx +154 -0
- package/src/super-admin/layout/menu/index.jsx +171 -0
- package/src/super-admin/layout/menu/menu-content.jsx +43 -0
- package/src/super-admin/layout/menu/menu-item.jsx +70 -0
- package/src/super-admin/layout/menu/style.scss +11 -0
- package/src/super-admin/layout/no-access.jsx +26 -0
- package/src/super-admin/model-class-table.jsx +66 -0
- package/src/super-admin/models.js +11 -0
- package/src/super-admin/show-nav.jsx +44 -0
- package/src/super-admin/show-page/belongs-to-attribute-row.jsx +30 -0
- package/src/super-admin/show-page/index.jsx +141 -0
- package/src/super-admin/show-reflection-actions.jsx +49 -0
- package/src/super-admin/show-reflection-link.jsx +40 -0
- package/src/super-admin/show-reflection-page.jsx +47 -0
- package/src/super-admin/stylesheets/variables.scss +11 -0
- package/src/table/column-content.jsx +122 -0
- package/src/table/column-identifier.js +23 -0
- package/src/table/column-visible.js +7 -0
- package/src/table/components/column.jsx +19 -0
- package/src/table/components/flat-list.jsx +19 -0
- package/src/table/components/header.jsx +21 -0
- package/src/table/components/row.jsx +23 -0
- package/src/table/filters/attribute-element.jsx +47 -0
- package/src/table/filters/filter-form.jsx +407 -0
- package/src/table/filters/filter.jsx +70 -0
- package/src/table/filters/index.jsx +170 -0
- package/src/table/filters/load-search-modal.jsx +146 -0
- package/src/table/filters/reflection-element.jsx +38 -0
- package/src/table/filters/save-search-modal.jsx +74 -0
- package/src/table/filters/scope-element.jsx +44 -0
- package/src/table/header-column-content.jsx +55 -0
- package/src/table/header-column.jsx +129 -0
- package/src/table/header-select.jsx +73 -0
- package/src/table/model-callback-args.js +10 -0
- package/src/table/model-column.jsx +82 -0
- package/src/table/model-row.jsx +136 -0
- package/src/table/select-calculator.js +65 -0
- package/src/table/settings/column-row.jsx +93 -0
- package/src/table/settings/download-action.jsx +68 -0
- package/src/table/settings/index.jsx +65 -0
- package/src/table/table-settings.js +263 -0
- package/src/table/table.jsx +950 -0
- package/src/table/use-sorting.js +35 -0
- package/src/table/variables.scss +11 -0
- package/src/table/widths.jsx +87 -0
- package/src/table/worker-plugins-check-all-checkbox.jsx +112 -0
- package/src/table/worker-plugins-checkbox.jsx +104 -0
- package/src/translated-attributes.js +11 -0
- package/src/{translated-collections.mjs → translated-collections.js} +3 -2
- package/src/updated-attribute.jsx +1 -1
- package/src/url-encode.js +18 -0
- package/src/use-breakpoint.js +87 -0
- package/src/use-can-can.js +55 -0
- package/src/use-collection.js +280 -0
- package/src/use-created-event.js +55 -0
- package/src/use-current-user.js +88 -0
- package/src/use-destroyed-event.js +60 -0
- package/src/use-event-emitter.js +15 -0
- package/src/use-event-listener.js +19 -0
- package/src/use-input.js +157 -0
- package/src/use-model-event.js +60 -0
- package/src/use-model.js +189 -0
- package/src/use-resize-observer.js +24 -0
- package/src/use-router.jsx +128 -0
- package/src/use-screen-layout.js +49 -0
- package/src/use-styles.js +50 -0
- package/src/use-updated-event.js +60 -0
- package/src/use-validation-errors.js +33 -0
- package/src/utils/card.jsx +49 -0
- package/src/utils/checkbox.jsx +80 -0
- package/src/utils/checkboxes.jsx +158 -0
- package/src/utils/default-style.jsx +25 -0
- package/src/utils/icon.jsx +21 -0
- package/src/utils/invalid-feedback.jsx +20 -0
- package/src/utils/modal.jsx +60 -0
- package/src/utils/text.jsx +38 -0
- package/src/{validation-error.mjs → validation-error.js} +9 -5
- package/src/{validation-errors.mjs → validation-errors.js} +15 -27
- package/src/with-api-maker.jsx +31 -0
- package/src/with-collection.jsx +17 -0
- package/src/with-current-user.jsx +7 -25
- package/src/with-model.jsx +16 -0
- package/src/with-router.jsx +7 -129
- package/__tests__/base-model.test.js +0 -71
- package/__tests__/cable-connection-pool.test.js +0 -227
- package/__tests__/cable-subscription-pool.test.js +0 -26
- package/__tests__/can-can.test.js +0 -34
- package/__tests__/collection.test.js +0 -51
- package/__tests__/custom-error.test.js +0 -13
- package/__tests__/model-name.test.js +0 -34
- package/__tests__/model-prop-type.test.js +0 -113
- package/__tests__/params.test.js +0 -40
- package/__tests__/routes-native.test.js +0 -103
- package/__tests__/routes.test.js +0 -46
- package/__tests__/serializer.test.js +0 -30
- package/__tests__/support/task.js +0 -27
- package/__tests__/support/user.js +0 -32
- package/index.js +0 -1
- package/jest.config.js +0 -4
- package/src/can-can-loader.jsx +0 -54
- package/src/channels-consumer.mjs +0 -3
- package/src/destroy-error.mjs +0 -7
- package/src/devise.mjs +0 -122
- package/src/event-created.jsx +0 -65
- package/src/event-destroyed.jsx +0 -29
- package/src/event-listener.jsx +0 -38
- package/src/event-updated.jsx +0 -74
- package/src/logger.mjs +0 -25
- package/src/model-class-require.mjs +0 -10
- package/src/model-load-wrapper.jsx +0 -116
- package/src/result.mjs +0 -29
- package/src/session-status-updater.mjs +0 -116
- package/webpack.config.js +0 -15
- /package/src/{attribute-not-loaded-error.mjs → attribute-not-loaded-error.js} +0 -0
- /package/src/{instance-of-class-name.mjs → instance-of-class-name.js} +0 -0
- /package/src/{model-prop-type.mjs → model-prop-type.js} +0 -0
- /package/src/{not-loaded-error.mjs → not-loaded-error.js} +0 -0
- /package/src/{translated-collections-data.mjs.erb → translated-collections-data.js.erb} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, {useMemo} from "react"
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
import {digg} from "diggerize"
|
|
4
|
+
import * as inflection from "inflection"
|
|
5
|
+
import memo from "set-state-compare/src/memo"
|
|
6
|
+
import MoneyFormatter from "../money-formatter"
|
|
7
|
+
import PropTypes from "prop-types"
|
|
8
|
+
import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-component"
|
|
9
|
+
import strftime from "strftime"
|
|
10
|
+
import Text from "../utils/text"
|
|
11
|
+
import useI18n from "i18n-on-steroids/src/use-i18n"
|
|
12
|
+
import {View} from "react-native"
|
|
13
|
+
|
|
14
|
+
export default memo(shapeComponent(class ApiMakerBootstrapAttributeRow extends ShapeComponent {
|
|
15
|
+
static defaultProps = {
|
|
16
|
+
checkIfAttributeLoaded: false
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static propTypes = {
|
|
20
|
+
attribute: PropTypes.string,
|
|
21
|
+
checkIfAttributeLoaded: PropTypes.bool.isRequired,
|
|
22
|
+
children: PropTypes.node,
|
|
23
|
+
identifier: PropTypes.string,
|
|
24
|
+
label: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
|
|
25
|
+
model: PropTypes.object,
|
|
26
|
+
value: PropTypes.node
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setup() {
|
|
30
|
+
const {l, t} = useI18n({namespace: "js.api_maker.attribute_row"})
|
|
31
|
+
|
|
32
|
+
this.l = l
|
|
33
|
+
this.t = t
|
|
34
|
+
this.attribute = useMemo(
|
|
35
|
+
() => {
|
|
36
|
+
if (this.props.attribute) {
|
|
37
|
+
return this.props.model?.constructor?.attributes()?.find((attribute) => attribute.name() == inflection.underscore(this.props.attribute))
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[this.props.attribute, this.props.model]
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
render () {
|
|
45
|
+
const {attribute, checkIfAttributeLoaded, children, className, identifier, label, model, style, value, ...restProps} = this.props
|
|
46
|
+
const actualStyle = Object.assign(
|
|
47
|
+
{
|
|
48
|
+
paddingVertical: 8
|
|
49
|
+
},
|
|
50
|
+
style
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View
|
|
55
|
+
dataSet={{
|
|
56
|
+
attribute,
|
|
57
|
+
class: className,
|
|
58
|
+
component: "api-maker/attribute-row",
|
|
59
|
+
identifier
|
|
60
|
+
}}
|
|
61
|
+
style={actualStyle}
|
|
62
|
+
{...restProps}
|
|
63
|
+
>
|
|
64
|
+
<Text dataSet={{class: "attribute-row-label"}} style={{fontWeight: "bold"}}>
|
|
65
|
+
{this.label()}
|
|
66
|
+
</Text>
|
|
67
|
+
<View dataSet={{class: "attribute-row-value"}} style={{marginTop: 3}}>
|
|
68
|
+
{this.value()}
|
|
69
|
+
</View>
|
|
70
|
+
</View>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
label() {
|
|
75
|
+
const {attribute, label, model} = this.props
|
|
76
|
+
|
|
77
|
+
if ("label" in this.props) return label
|
|
78
|
+
if (attribute && model) return model.constructor.humanAttributeName(attribute)
|
|
79
|
+
|
|
80
|
+
throw new Error("Couldn't figure out label")
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
value() {
|
|
84
|
+
const {attribute, checkIfAttributeLoaded, children, model} = this.props
|
|
85
|
+
|
|
86
|
+
if (children) return children
|
|
87
|
+
|
|
88
|
+
if (attribute && !(attribute in model))
|
|
89
|
+
throw new Error(`Attribute not found: ${digg(model.modelClassData(), "name")}#${attribute}`)
|
|
90
|
+
|
|
91
|
+
if (attribute && checkIfAttributeLoaded && !model.isAttributeLoaded(attribute))
|
|
92
|
+
return null
|
|
93
|
+
|
|
94
|
+
if (attribute && model) {
|
|
95
|
+
const value = model[attribute]()
|
|
96
|
+
|
|
97
|
+
return this.valueContent(value)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
valueContent(value) {
|
|
102
|
+
const {l, t} = this.tt
|
|
103
|
+
const columnType = this.attribute?.getColumn()?.getType()
|
|
104
|
+
|
|
105
|
+
if (columnType == "date") {
|
|
106
|
+
return (
|
|
107
|
+
<Text>{l("date.formats.default", value)}</Text>
|
|
108
|
+
)
|
|
109
|
+
} else if (value instanceof Date) {
|
|
110
|
+
return (
|
|
111
|
+
<Text>{strftime("%Y-%m-%d %H:%M", value)}</Text>
|
|
112
|
+
)
|
|
113
|
+
} else if (typeof value === "boolean") {
|
|
114
|
+
if (value) {
|
|
115
|
+
return (
|
|
116
|
+
<Text>{t("js.shared.yes", {defaultValue: "Yes"})}</Text>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<Text>{t("js.shared.no", {defaultValue: "No"})}</Text>
|
|
122
|
+
)
|
|
123
|
+
} else if (MoneyFormatter.isMoney(value)) {
|
|
124
|
+
return (
|
|
125
|
+
<Text>{MoneyFormatter.format(value)}</Text>
|
|
126
|
+
)
|
|
127
|
+
} else if (typeof value == "string") {
|
|
128
|
+
return (
|
|
129
|
+
<Text>{value}</Text>
|
|
130
|
+
)
|
|
131
|
+
} else {
|
|
132
|
+
return value
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}))
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import AttributeRow from "./attribute-row"
|
|
2
|
+
import BaseComponent from "../base-component"
|
|
3
|
+
import memo from "set-state-compare/src/memo"
|
|
4
|
+
import PropTypes from "prop-types"
|
|
5
|
+
import propTypesExact from "prop-types-exact"
|
|
6
|
+
import React from "react"
|
|
7
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
8
|
+
|
|
9
|
+
export default memo(shapeComponent(class ApiMakerBootstrapAttributeRows extends BaseComponent {
|
|
10
|
+
static defaultProps = {
|
|
11
|
+
checkIfAttributeLoaded: false
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static propTypes = propTypesExact({
|
|
15
|
+
attributes: PropTypes.array.isRequired,
|
|
16
|
+
checkIfAttributeLoaded: PropTypes.bool.isRequired,
|
|
17
|
+
model: PropTypes.object.isRequired
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
render () {
|
|
21
|
+
const {attributes, checkIfAttributeLoaded, model} = this.p
|
|
22
|
+
|
|
23
|
+
return attributes.map((attribute) =>
|
|
24
|
+
<AttributeRow attribute={attribute} checkIfAttributeLoaded={checkIfAttributeLoaded} key={`attribute-${attribute}`} model={model} />
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
}))
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import BaseComponent from "../base-component"
|
|
2
|
+
import classNames from "classnames"
|
|
3
|
+
import {digg, digs} from "diggerize"
|
|
4
|
+
import memo from "set-state-compare/src/memo"
|
|
5
|
+
import PropTypes from "prop-types"
|
|
6
|
+
import React, {useRef} from "react"
|
|
7
|
+
import {shapeComponent} from "set-state-compare/src/shape-component"
|
|
8
|
+
|
|
9
|
+
export default memo(shapeComponent(class ApiMakerBootstrapCard extends BaseComponent {
|
|
10
|
+
static defaultProps = {
|
|
11
|
+
defaultExpanded: true,
|
|
12
|
+
expandable: false,
|
|
13
|
+
expandableHide: false,
|
|
14
|
+
responsiveTable: true,
|
|
15
|
+
table: false
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static propTypes = {
|
|
19
|
+
cardRef: PropTypes.object,
|
|
20
|
+
className: PropTypes.string,
|
|
21
|
+
children: PropTypes.node,
|
|
22
|
+
controls: PropTypes.node,
|
|
23
|
+
defaultExpanded: PropTypes.bool.isRequired,
|
|
24
|
+
expandable: PropTypes.bool.isRequired,
|
|
25
|
+
expandableHide: PropTypes.bool.isRequired,
|
|
26
|
+
footer: PropTypes.node,
|
|
27
|
+
header: PropTypes.node,
|
|
28
|
+
striped: PropTypes.bool,
|
|
29
|
+
responsiveTable: PropTypes.bool.isRequired,
|
|
30
|
+
table: PropTypes.bool.isRequired
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setup() {
|
|
34
|
+
this.cardRef = useRef()
|
|
35
|
+
|
|
36
|
+
this.useStates({
|
|
37
|
+
expanded: this.props.defaultExpanded
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
render () {
|
|
42
|
+
const {
|
|
43
|
+
cardRef,
|
|
44
|
+
children,
|
|
45
|
+
className,
|
|
46
|
+
controls,
|
|
47
|
+
defaultExpanded,
|
|
48
|
+
expandable,
|
|
49
|
+
expandableHide,
|
|
50
|
+
footer,
|
|
51
|
+
header,
|
|
52
|
+
responsiveTable,
|
|
53
|
+
striped,
|
|
54
|
+
table,
|
|
55
|
+
...restProps
|
|
56
|
+
} = this.props
|
|
57
|
+
const {expanded} = digs(this.state, "expanded")
|
|
58
|
+
const cardHeaderStyle = {display: "flex"}
|
|
59
|
+
const cardRefToUse = cardRef || this.cardRef
|
|
60
|
+
|
|
61
|
+
if (!expanded) cardHeaderStyle["borderBottom"] = "0"
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
className={classNames("component-bootstrap-card", "card", "card-default", className)}
|
|
66
|
+
data-has-footer={Boolean(footer)}
|
|
67
|
+
ref={cardRefToUse}
|
|
68
|
+
{...restProps}
|
|
69
|
+
>
|
|
70
|
+
{(controls || expandable || header) &&
|
|
71
|
+
<div className="card-header" style={cardHeaderStyle}>
|
|
72
|
+
<div className="card-header-label" style={{alignSelf: "center", marginRight: "auto"}}>
|
|
73
|
+
{header}
|
|
74
|
+
</div>
|
|
75
|
+
{(controls || expandable) &&
|
|
76
|
+
<div className="card-header-actions" style={{alignSelf: "center"}}>
|
|
77
|
+
{controls}
|
|
78
|
+
{expandable && expanded &&
|
|
79
|
+
<a className="collapse-card-button text-muted" href="#" onClick={digg(this, "onCollapseClicked")}>
|
|
80
|
+
<i className="fa fa-angle-up" />
|
|
81
|
+
</a>
|
|
82
|
+
}
|
|
83
|
+
{expandable && !expanded &&
|
|
84
|
+
<a className="expand-card-button text-muted" href="#" onClick={digg(this, "onExpandClicked")}>
|
|
85
|
+
<i className="fa fa-angle-down" />
|
|
86
|
+
</a>
|
|
87
|
+
}
|
|
88
|
+
</div>
|
|
89
|
+
}
|
|
90
|
+
</div>
|
|
91
|
+
}
|
|
92
|
+
{(expanded || expandableHide) &&
|
|
93
|
+
<div className={this.bodyClassNames()}>
|
|
94
|
+
{table &&
|
|
95
|
+
<table className={this.tableClassNames()}>
|
|
96
|
+
{children}
|
|
97
|
+
</table>
|
|
98
|
+
}
|
|
99
|
+
{!table && children}
|
|
100
|
+
</div>
|
|
101
|
+
}
|
|
102
|
+
{footer &&
|
|
103
|
+
<div className="card-footer">
|
|
104
|
+
{footer}
|
|
105
|
+
</div>
|
|
106
|
+
}
|
|
107
|
+
</div>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
bodyClassNames () {
|
|
112
|
+
const {expandableHide, responsiveTable, table} = digs(this.props, "expandableHide", "responsiveTable", "table")
|
|
113
|
+
const {expanded} = digs(this.state, "expanded")
|
|
114
|
+
const classNames = ["card-body"]
|
|
115
|
+
|
|
116
|
+
if (!expanded && expandableHide) {
|
|
117
|
+
classNames.push("d-none")
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (table) {
|
|
121
|
+
if (responsiveTable){
|
|
122
|
+
classNames.push("table-responsive")
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
classNames.push("p-0")
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return classNames.join(" ")
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
onCollapseClicked = (e) => {
|
|
132
|
+
e.preventDefault()
|
|
133
|
+
this.setState({expanded: false})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
onExpandClicked = (e) => {
|
|
137
|
+
e.preventDefault()
|
|
138
|
+
this.setState({expanded: true})
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
tableClassNames () {
|
|
142
|
+
const classNames = ["table", "table-hover", "mb-0", "w-100"]
|
|
143
|
+
|
|
144
|
+
if (this.props.striped)
|
|
145
|
+
classNames.push("table-striped")
|
|
146
|
+
|
|
147
|
+
return classNames.join(" ")
|
|
148
|
+
}
|
|
149
|
+
}))
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-component"
|
|
2
|
+
import Checkbox from "../inputs/checkbox"
|
|
3
|
+
import classNames from "classnames"
|
|
4
|
+
import {digs} from "diggerize"
|
|
5
|
+
import InvalidFeedback from "./invalid-feedback"
|
|
6
|
+
import memo from "set-state-compare/src/memo"
|
|
7
|
+
import PropTypes from "prop-types"
|
|
8
|
+
import React from "react"
|
|
9
|
+
import useInput from "../use-input"
|
|
10
|
+
|
|
11
|
+
export default memo(shapeComponent(class ApiMakerBootstrapCheckbox extends ShapeComponent {
|
|
12
|
+
static defaultProps = {
|
|
13
|
+
defaultValue: 1,
|
|
14
|
+
zeroInput: true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static propTypes = {
|
|
18
|
+
attribute: PropTypes.string,
|
|
19
|
+
className: PropTypes.string,
|
|
20
|
+
defaultChecked: PropTypes.bool,
|
|
21
|
+
defaultValue: PropTypes.node,
|
|
22
|
+
hint: PropTypes.node,
|
|
23
|
+
id: PropTypes.string,
|
|
24
|
+
label: PropTypes.node,
|
|
25
|
+
labelClassName: PropTypes.string,
|
|
26
|
+
model: PropTypes.object,
|
|
27
|
+
name: PropTypes.string,
|
|
28
|
+
onChange: PropTypes.func,
|
|
29
|
+
wrapperClassName: PropTypes.string,
|
|
30
|
+
zeroInput: PropTypes.bool
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setup() {
|
|
34
|
+
const {inputProps, restProps: useInputRestProps, wrapperOpts} = useInput({props: this.props, wrapperOptions: {type: "checkbox"}})
|
|
35
|
+
|
|
36
|
+
this.setInstance({inputProps, useInputRestProps, wrapperOpts})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render () {
|
|
40
|
+
const {inputProps, useInputRestProps, wrapperOpts} = this.tt
|
|
41
|
+
const {className, hint, id, inputRef, label, labelClassName, wrapperClassName, ...restProps} = useInputRestProps
|
|
42
|
+
const {errors} = digs(wrapperOpts, "errors")
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className={this.wrapperClassName()}>
|
|
46
|
+
<div className="form-check">
|
|
47
|
+
<Checkbox
|
|
48
|
+
className={classNames("form-check-input", className, {"is-invalid": errors.length > 0})}
|
|
49
|
+
id={id}
|
|
50
|
+
inputRef={inputRef}
|
|
51
|
+
{...restProps}
|
|
52
|
+
/>
|
|
53
|
+
{wrapperOpts.label &&
|
|
54
|
+
<label className={this.labelClassName()} htmlFor={inputProps.id}>
|
|
55
|
+
{wrapperOpts.label}
|
|
56
|
+
</label>
|
|
57
|
+
}
|
|
58
|
+
{hint &&
|
|
59
|
+
<p className="text-muted">
|
|
60
|
+
{hint}
|
|
61
|
+
</p>
|
|
62
|
+
}
|
|
63
|
+
{errors.length > 0 && <InvalidFeedback errors={errors} />}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
labelClassName () {
|
|
70
|
+
const classNames = ["form-check-label"]
|
|
71
|
+
|
|
72
|
+
if (this.props.labelClassName)
|
|
73
|
+
classNames.push(this.props.labelClassName)
|
|
74
|
+
|
|
75
|
+
return classNames.join(" ")
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
wrapperClassName () {
|
|
79
|
+
const classNames = ["component-bootstrap-checkbox", "form-group"]
|
|
80
|
+
|
|
81
|
+
if (this.props.wrapperClassName)
|
|
82
|
+
classNames.push(this.props.wrapperClassName)
|
|
83
|
+
|
|
84
|
+
return classNames.join(" ")
|
|
85
|
+
}
|
|
86
|
+
}))
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-component"
|
|
2
|
+
import React, {useMemo} from "react"
|
|
3
|
+
import {digs} from "diggerize"
|
|
4
|
+
import {useForm} from "../form"
|
|
5
|
+
import * as inflection from "inflection"
|
|
6
|
+
import InvalidFeedback from "./invalid-feedback"
|
|
7
|
+
import memo from "set-state-compare/src/memo"
|
|
8
|
+
import PropTypes from "prop-types"
|
|
9
|
+
import propTypesExact from "prop-types-exact"
|
|
10
|
+
import useInput from "../use-input"
|
|
11
|
+
|
|
12
|
+
const OptionElement = memo(shapeComponent(class OptionElement extends ShapeComponent {
|
|
13
|
+
render() {
|
|
14
|
+
const {generatedId, inputCheckboxClassName, isDefaultSelected, inputName, option, optionIndex, options, wrapperOpts} = this.p
|
|
15
|
+
const {errors} = digs(wrapperOpts, "errors")
|
|
16
|
+
const id = `${generatedId}-${optionIndex}`
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="checkboxes-option" key={`option-${option[1]}`}>
|
|
20
|
+
<input
|
|
21
|
+
className={inputCheckboxClassName}
|
|
22
|
+
data-option-value={option[1]}
|
|
23
|
+
defaultChecked={isDefaultSelected}
|
|
24
|
+
id={id}
|
|
25
|
+
name={inputName}
|
|
26
|
+
onChange={this.tt.onChange}
|
|
27
|
+
type="checkbox"
|
|
28
|
+
value={option[1]}
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<label className="ml-1" htmlFor={id}>
|
|
32
|
+
{option[0]}
|
|
33
|
+
</label>
|
|
34
|
+
|
|
35
|
+
{(optionIndex + 1) == options.length && errors.length > 0 &&
|
|
36
|
+
<InvalidFeedback errors={errors} />
|
|
37
|
+
}
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onChange = (event, ...restProps) => {
|
|
43
|
+
this.p.onOptionChecked({event, option: this.p.option})
|
|
44
|
+
|
|
45
|
+
if (this.props.onChange) this.props.onChange(event, ...restProps)
|
|
46
|
+
}
|
|
47
|
+
}))
|
|
48
|
+
|
|
49
|
+
export default memo(shapeComponent(class ApiMakerBootstrapCheckboxes extends ShapeComponent {
|
|
50
|
+
static propTypes = propTypesExact({
|
|
51
|
+
attribute: PropTypes.string,
|
|
52
|
+
defaultValue: PropTypes.array,
|
|
53
|
+
label: PropTypes.string,
|
|
54
|
+
labelClassName: PropTypes.string,
|
|
55
|
+
model: PropTypes.object,
|
|
56
|
+
name: PropTypes.string,
|
|
57
|
+
onChange: PropTypes.func,
|
|
58
|
+
options: PropTypes.array.isRequired
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
setup() {
|
|
62
|
+
const {inputProps, wrapperOpts} = useInput({props: this.props})
|
|
63
|
+
|
|
64
|
+
this.generatedId = useMemo(
|
|
65
|
+
() => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
|
|
66
|
+
[]
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
this.setInstance({
|
|
70
|
+
form: useForm(),
|
|
71
|
+
inputProps,
|
|
72
|
+
wrapperOpts
|
|
73
|
+
})
|
|
74
|
+
this.useStates({
|
|
75
|
+
checkedOptions: () => {
|
|
76
|
+
if (Array.isArray(this.props.defaultValue)) return this.props.defaultValue
|
|
77
|
+
if (this.props.defaultValue) return [this.props.defaultValue]
|
|
78
|
+
|
|
79
|
+
return []
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
useMemo(() => {
|
|
84
|
+
if (this.form && inputProps.name) {
|
|
85
|
+
this.form.setValue(inputProps.name, this.s.checkedOptions)
|
|
86
|
+
}
|
|
87
|
+
}, [])
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
render () {
|
|
91
|
+
return (
|
|
92
|
+
<div className="component-bootstrap-checkboxes form-group">
|
|
93
|
+
<label className={this.labelClassName()}>
|
|
94
|
+
{this.tt.wrapperOpts.label}
|
|
95
|
+
</label>
|
|
96
|
+
|
|
97
|
+
<input name={this.inputName()} ref={this.tt.inputProps.ref} type="hidden" value="" />
|
|
98
|
+
{this.props.options.map((option, index) =>
|
|
99
|
+
<OptionElement
|
|
100
|
+
inputCheckboxClassName={this.tt.inputCheckboxClassName()}
|
|
101
|
+
inputName={this.inputName()}
|
|
102
|
+
isDefaultSelected={this.isDefaultSelected(option[1])}
|
|
103
|
+
generatedId={this.tt.generatedId}
|
|
104
|
+
key={option[1]}
|
|
105
|
+
onChange={this.props.onChange}
|
|
106
|
+
onOptionChecked={this.tt.onOptionChecked}
|
|
107
|
+
option={option}
|
|
108
|
+
optionIndex={index}
|
|
109
|
+
options={this.props.options}
|
|
110
|
+
wrapperOpts={this.tt.wrapperOpts}
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
</div>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
inputDefaultValue () {
|
|
118
|
+
const {attribute, defaultValue, model} = this.props
|
|
119
|
+
|
|
120
|
+
if (defaultValue) {
|
|
121
|
+
return defaultValue
|
|
122
|
+
} else if (attribute && model) {
|
|
123
|
+
if (!model[attribute]) throw `No such attribute: ${attribute}`
|
|
124
|
+
|
|
125
|
+
return this.props.model[attribute]()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
inputCheckboxClassName () {
|
|
130
|
+
const classNames = []
|
|
131
|
+
|
|
132
|
+
if (this.tt.wrapperOpts.errors.length > 0) classNames.push("is-invalid")
|
|
133
|
+
|
|
134
|
+
return classNames.join(" ")
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
inputName () {
|
|
138
|
+
if (this.props.name) {
|
|
139
|
+
return `${this.props.name}[]`
|
|
140
|
+
} else if (this.props.model) {
|
|
141
|
+
return `${this.props.model.modelClassData().paramKey}[${inflection.underscore(this.props.attribute)}]`
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
isDefaultSelected (option) {
|
|
146
|
+
let defaultValue = this.inputDefaultValue()
|
|
147
|
+
|
|
148
|
+
if (!defaultValue) return false
|
|
149
|
+
|
|
150
|
+
if (defaultValue.constructor === Array) {
|
|
151
|
+
return defaultValue.includes(option)
|
|
152
|
+
} else {
|
|
153
|
+
return defaultValue == option
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
labelClassName () {
|
|
158
|
+
const classNames = []
|
|
159
|
+
|
|
160
|
+
if (this.props.labelClassName) classNames.push(this.props.labelClassName)
|
|
161
|
+
|
|
162
|
+
return classNames.join(" ")
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
onOptionChecked = ({event, option}) => {
|
|
166
|
+
const {inputProps, form} = this.tt
|
|
167
|
+
const {name} = inputProps
|
|
168
|
+
const checked = event.target.checked
|
|
169
|
+
let newOptions
|
|
170
|
+
|
|
171
|
+
if (checked) {
|
|
172
|
+
newOptions = this.s.checkedOptions.concat([option[1]])
|
|
173
|
+
|
|
174
|
+
this.setState({checkedOptions: newOptions})
|
|
175
|
+
} else {
|
|
176
|
+
newOptions = this.s.checkedOptions.filter((value) => value != option[1])
|
|
177
|
+
|
|
178
|
+
this.setState({checkedOptions: newOptions})
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (form && name) {
|
|
182
|
+
form.setValue(name, newOptions)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}))
|
|
File without changes
|