@onehat/ui 0.3.380 → 0.4.0
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/package.json +37 -9
- package/src/Components/Accordion/Accordion.js +22 -17
- package/src/Components/Blank.js +1 -3
- package/src/Components/Buttons/BackButton.js +21 -12
- package/src/Components/Buttons/Button.js +65 -13
- package/src/Components/Buttons/CartButtonWithBadge.js +14 -6
- package/src/Components/Buttons/IconButton.js +31 -74
- package/src/Components/Buttons/PlusMinusButton.js +34 -21
- package/src/Components/Buttons/ReloadButton.js +7 -8
- package/src/Components/Buttons/SquareButton.js +41 -55
- package/src/Components/Container/Container.js +55 -16
- package/src/Components/Container/ScreenContainer.js +26 -16
- package/src/Components/Container/Splitter.js +38 -25
- package/src/Components/Editor/Editor.js +3 -2
- package/src/Components/Editor/InlineEditor.js +38 -32
- package/src/Components/Filter/DateRange.js +37 -18
- package/src/Components/Filter/NumberRange.js +87 -83
- package/src/Components/Form/Field/CKEditor/CKEditor.js +4 -4
- package/src/Components/Form/Field/Checkbox/CheckboxGroup.js +9 -6
- package/src/Components/Form/Field/Color.js +95 -86
- package/src/Components/Form/Field/Combo/Combo.js +347 -284
- package/src/Components/Form/Field/Combo/PageSizeCombo.js +4 -7
- package/src/Components/Form/Field/Date.js +276 -312
- package/src/Components/Form/Field/DisplayField.js +11 -5
- package/src/Components/Form/Field/File.js +26 -32
- package/src/Components/Form/Field/FormikForm.js +1018 -0
- package/src/Components/Form/Field/Input.js +91 -41
- package/src/Components/Form/Field/Json.js +25 -21
- package/src/Components/Form/Field/Number.js +70 -51
- package/src/Components/Form/Field/RadioGroup/RadioGroup.js +4 -6
- package/src/Components/Form/Field/Select/PageSizeSelect.js +33 -0
- package/src/Components/Form/Field/Select/Select.js +109 -0
- package/src/Components/Form/Field/Slider.js +38 -30
- package/src/Components/Form/Field/Tag/Tag.js +88 -72
- package/src/Components/Form/Field/Tag/ValueBox.js +25 -20
- package/src/Components/Form/Field/Text.js +21 -12
- package/src/Components/Form/Field/TextArea.js +32 -15
- package/src/Components/Form/Field/Toggle.js +42 -24
- package/src/Components/Form/FieldSet.js +77 -54
- package/src/Components/Form/Form.js +491 -268
- package/src/Components/Form/Label.js +28 -17
- package/src/Components/Gluestack/accordion/index.tsx +394 -0
- package/src/Components/Gluestack/actionsheet/index.tsx +619 -0
- package/src/Components/Gluestack/alert/index.tsx +310 -0
- package/src/Components/Gluestack/alert-dialog/index.tsx +295 -0
- package/src/Components/Gluestack/avatar/index.tsx +190 -0
- package/src/Components/Gluestack/badge/index.tsx +272 -0
- package/src/Components/Gluestack/bottomsheet/index.tsx +294 -0
- package/src/Components/Gluestack/box/index.tsx +19 -0
- package/src/Components/Gluestack/box/index.web.tsx +18 -0
- package/src/Components/Gluestack/box/styles.tsx +10 -0
- package/src/Components/Gluestack/button/index.tsx +494 -0
- package/src/Components/Gluestack/card/index.tsx +23 -0
- package/src/Components/Gluestack/card/index.web.tsx +22 -0
- package/src/Components/Gluestack/card/styles.tsx +20 -0
- package/src/Components/Gluestack/center/index.tsx +22 -0
- package/src/Components/Gluestack/center/index.web.tsx +19 -0
- package/src/Components/Gluestack/center/styles.tsx +8 -0
- package/src/Components/Gluestack/checkbox/index.tsx +305 -0
- package/src/Components/Gluestack/divider/index.tsx +44 -0
- package/src/Components/Gluestack/drawer/index.tsx +354 -0
- package/src/Components/Gluestack/fab/index.tsx +286 -0
- package/src/Components/Gluestack/flat-list/index.tsx +2 -0
- package/src/Components/Gluestack/form-control/index.tsx +527 -0
- package/src/Components/Gluestack/gluestack-ui-provider/config.ts +332 -0
- package/src/Components/Gluestack/gluestack-ui-provider/index.tsx +47 -0
- package/src/Components/Gluestack/gluestack-ui-provider/index.web.tsx +94 -0
- package/src/Components/Gluestack/gluestack-ui-provider/script.ts +19 -0
- package/src/Components/Gluestack/grid/index.tsx +341 -0
- package/src/Components/Gluestack/grid/index.web.tsx +65 -0
- package/src/Components/Gluestack/grid/styles.tsx +15 -0
- package/src/Components/Gluestack/heading/index.tsx +212 -0
- package/src/Components/Gluestack/heading/index.web.tsx +203 -0
- package/src/Components/Gluestack/heading/styles.tsx +43 -0
- package/src/Components/Gluestack/hstack/index.tsx +23 -0
- package/src/Components/Gluestack/hstack/index.web.tsx +22 -0
- package/src/Components/Gluestack/hstack/styles.tsx +25 -0
- package/src/Components/Gluestack/image/index.tsx +52 -0
- package/src/Components/Gluestack/image-background/index.tsx +21 -0
- package/src/Components/Gluestack/index.js +116 -0
- package/src/Components/Gluestack/input/index.tsx +287 -0
- package/src/Components/Gluestack/input-accessory-view/index.tsx +2 -0
- package/src/Components/Gluestack/keyboard-avoiding-view/index.tsx +2 -0
- package/src/Components/Gluestack/link/index.tsx +107 -0
- package/src/Components/Gluestack/menu/index.tsx +210 -0
- package/src/Components/Gluestack/modal/index.tsx +279 -0
- package/src/Components/Gluestack/popover/index.tsx +352 -0
- package/src/Components/Gluestack/portal/index.tsx +13 -0
- package/src/Components/Gluestack/pressable/index.tsx +46 -0
- package/src/Components/Gluestack/progress/index.tsx +164 -0
- package/src/Components/Gluestack/radio/index.tsx +304 -0
- package/src/Components/Gluestack/refresh-control/index.tsx +2 -0
- package/src/Components/Gluestack/safe-area-view/index.tsx +2 -0
- package/src/Components/Gluestack/scroll-view/index.tsx +2 -0
- package/src/Components/Gluestack/section-list/index.tsx +2 -0
- package/src/Components/Gluestack/select/index.tsx +335 -0
- package/src/Components/Gluestack/select/select-actionsheet.tsx +584 -0
- package/src/Components/Gluestack/skeleton/index.tsx +138 -0
- package/src/Components/Gluestack/skeleton/index.web.tsx +103 -0
- package/src/Components/Gluestack/skeleton/styles.tsx +35 -0
- package/src/Components/Gluestack/slider/index.tsx +283 -0
- package/src/Components/Gluestack/spinner/index.tsx +34 -0
- package/src/Components/Gluestack/status-bar/index.tsx +2 -0
- package/src/Components/Gluestack/switch/index.tsx +55 -0
- package/src/Components/Gluestack/table/index.tsx +200 -0
- package/src/Components/Gluestack/table/index.web.tsx +142 -0
- package/src/Components/Gluestack/table/styles.tsx +44 -0
- package/src/Components/Gluestack/text/index.tsx +48 -0
- package/src/Components/Gluestack/text/index.web.tsx +45 -0
- package/src/Components/Gluestack/text/styles.tsx +47 -0
- package/src/Components/Gluestack/textarea/index.tsx +108 -0
- package/src/Components/Gluestack/toast/index.tsx +225 -0
- package/src/Components/Gluestack/tooltip/index.tsx +125 -0
- package/src/Components/Gluestack/utils/use-break-point-value.ts +101 -0
- package/src/Components/Gluestack/view/index.tsx +2 -0
- package/src/Components/Gluestack/virtualized-list/index.tsx +2 -0
- package/src/Components/Gluestack/vstack/index.tsx +24 -0
- package/src/Components/Gluestack/vstack/index.web.tsx +23 -0
- package/src/Components/Gluestack/vstack/styles.tsx +25 -0
- package/src/Components/Grid/Grid.js +192 -135
- package/src/Components/Grid/GridHeaderRow.js +51 -59
- package/src/Components/Grid/GridRow.js +152 -58
- package/src/Components/Grid/HeaderColumnSelectorHandle.js +16 -10
- package/src/Components/Grid/HeaderReorderHandle.js +17 -13
- package/src/Components/Grid/HeaderResizeHandle.js +17 -13
- package/src/Components/Grid/NoRecordsFound.js +15 -18
- package/src/Components/Grid/RowDragHandle.js +9 -13
- package/src/Components/Hoc/Secondary/withSecondaryEditor.js +14 -9
- package/src/Components/Hoc/Secondary/withSecondaryWindowedEditor.js +14 -11
- package/src/Components/Hoc/withAlert.js +150 -200
- package/src/Components/Hoc/withBlank.js +4 -6
- package/src/Components/Hoc/withCollapsible.js +4 -3
- package/src/Components/Hoc/withComponent.js +33 -6
- package/src/Components/Hoc/withContextMenu.js +133 -141
- package/src/Components/Hoc/withData.js +5 -4
- package/src/Components/Hoc/withDnd.js +11 -9
- package/src/Components/Hoc/withDraggable.js +10 -10
- package/src/Components/Hoc/withEditor.js +18 -13
- package/src/Components/Hoc/withEvents.js +4 -6
- package/src/Components/Hoc/withFilters.js +524 -498
- package/src/Components/Hoc/withInlineEditor.js +7 -5
- package/src/Components/Hoc/withModal.js +79 -137
- package/src/Components/Hoc/withMultiSelection.js +4 -2
- package/src/Components/Hoc/withPdfButtons.js +109 -111
- package/src/Components/Hoc/withPresetButtons.js +49 -53
- package/src/Components/Hoc/withSelection.js +6 -5
- package/src/Components/Hoc/withSideEditor.js +12 -6
- package/src/Components/Hoc/withTooltip.js +18 -12
- package/src/Components/Hoc/withValue.js +6 -5
- package/src/Components/Hoc/withWindowedEditor.js +13 -11
- package/src/Components/Icons/AddressBook.js +7 -10
- package/src/Components/Icons/Alt.js +8 -15
- package/src/Components/Icons/AngleLeft.js +7 -14
- package/src/Components/Icons/AngleRight.js +7 -14
- package/src/Components/Icons/AnglesLeft.js +7 -14
- package/src/Components/Icons/AnglesRight.js +7 -14
- package/src/Components/Icons/Asterisk.js +7 -10
- package/src/Components/Icons/Ban.js +9 -14
- package/src/Components/Icons/Bars.js +7 -10
- package/src/Components/Icons/BarsStaggered.js +7 -10
- package/src/Components/Icons/Bell.js +7 -19
- package/src/Components/Icons/BigCircle.js +7 -14
- package/src/Components/Icons/Book.js +7 -10
- package/src/Components/Icons/BookOpen.js +7 -10
- package/src/Components/Icons/Bookmark.js +8 -17
- package/src/Components/Icons/Bug.js +7 -10
- package/src/Components/Icons/Building.js +7 -10
- package/src/Components/Icons/Calendar.js +7 -14
- package/src/Components/Icons/Calendar2.js +7 -14
- package/src/Components/Icons/CalendarDays.js +7 -14
- package/src/Components/Icons/Camera.js +7 -14
- package/src/Components/Icons/CaretDown.js +7 -14
- package/src/Components/Icons/CaretUp.js +7 -14
- package/src/Components/Icons/CartPlus.js +7 -10
- package/src/Components/Icons/CartShopping.js +7 -10
- package/src/Components/Icons/CashRegister.js +7 -10
- package/src/Components/Icons/Certificate.js +7 -10
- package/src/Components/Icons/ChartLine.js +7 -10
- package/src/Components/Icons/ChartPie.js +7 -10
- package/src/Components/Icons/Check.js +7 -10
- package/src/Components/Icons/CheckDouble.js +7 -10
- package/src/Components/Icons/ChevronDown.js +7 -10
- package/src/Components/Icons/ChevronLeft.js +7 -10
- package/src/Components/Icons/ChevronRight.js +7 -10
- package/src/Components/Icons/ChevronUp.js +7 -10
- package/src/Components/Icons/Circle.js +7 -10
- package/src/Components/Icons/CircleArrowRight.js +7 -10
- package/src/Components/Icons/CircleExclamation.js +7 -14
- package/src/Components/Icons/CircleInfo.js +7 -10
- package/src/Components/Icons/CircleQuestion.js +7 -10
- package/src/Components/Icons/CircleXmark.js +7 -10
- package/src/Components/Icons/CircleXmarkRegular.js +7 -10
- package/src/Components/Icons/Clipboard.js +7 -14
- package/src/Components/Icons/ClipboardCheck.js +7 -17
- package/src/Components/Icons/ClipboardList.js +7 -16
- package/src/Components/Icons/Clock.js +7 -10
- package/src/Components/Icons/ClockRegular.js +7 -10
- package/src/Components/Icons/ClockRotateLeft.js +7 -10
- package/src/Components/Icons/Clone.js +7 -10
- package/src/Components/Icons/Collapse.js +7 -14
- package/src/Components/Icons/Comment.js +7 -10
- package/src/Components/Icons/CommentDots.js +7 -10
- package/src/Components/Icons/CommentRegular.js +7 -10
- package/src/Components/Icons/Comments.js +7 -10
- package/src/Components/Icons/CommentsRegular.js +7 -10
- package/src/Components/Icons/Copyright.js +7 -10
- package/src/Components/Icons/Dot.js +10 -15
- package/src/Components/Icons/Download.js +11 -0
- package/src/Components/Icons/Duplicate.js +7 -14
- package/src/Components/Icons/Edit.js +7 -14
- package/src/Components/Icons/EllipsisHorizontal.js +7 -16
- package/src/Components/Icons/EllipsisVertical.js +7 -14
- package/src/Components/Icons/Envelope.js +7 -10
- package/src/Components/Icons/EnvelopeRegular.js +7 -10
- package/src/Components/Icons/Excel.js +7 -10
- package/src/Components/Icons/Exclamation.js +7 -10
- package/src/Components/Icons/Expand.js +7 -10
- package/src/Components/Icons/Eye.js +7 -14
- package/src/Components/Icons/EyeSlash.js +7 -10
- package/src/Components/Icons/File.js +7 -14
- package/src/Components/Icons/FloppyDiskRegular.js +7 -10
- package/src/Components/Icons/Folder.js +7 -10
- package/src/Components/Icons/FolderClosed.js +7 -10
- package/src/Components/Icons/FolderOpen.js +7 -10
- package/src/Components/Icons/FolderTree.js +7 -10
- package/src/Components/Icons/FullWidth.js +10 -25
- package/src/Components/Icons/Gauge.js +7 -17
- package/src/Components/Icons/Gear.js +7 -14
- package/src/Components/Icons/Gears.js +7 -10
- package/src/Components/Icons/Gift.js +7 -10
- package/src/Components/Icons/Grip.js +7 -14
- package/src/Components/Icons/GripLines.js +7 -14
- package/src/Components/Icons/GripLinesVertical.js +7 -14
- package/src/Components/Icons/GripVertical.js +7 -14
- package/src/Components/Icons/Hammer.js +7 -10
- package/src/Components/Icons/Hand.js +7 -10
- package/src/Components/Icons/HighPriority.js +7 -17
- package/src/Components/Icons/House.js +7 -10
- package/src/Components/Icons/Images.js +7 -10
- package/src/Components/Icons/Info.js +7 -10
- package/src/Components/Icons/ItunesNote.js +7 -10
- package/src/Components/Icons/Js.js +7 -16
- package/src/Components/Icons/Leaf.js +7 -10
- package/src/Components/Icons/Link.js +7 -9
- package/src/Components/Icons/List.js +7 -10
- package/src/Components/Icons/ListCheck.js +7 -10
- package/src/Components/Icons/LocationDot.js +7 -10
- package/src/Components/Icons/Loop.js +7 -14
- package/src/Components/Icons/Loop1.js +8 -13
- package/src/Components/Icons/LoopAll.js +8 -13
- package/src/Components/Icons/LowPriority.js +7 -17
- package/src/Components/Icons/MagnifyingGlass.js +7 -10
- package/src/Components/Icons/Maximize.js +7 -10
- package/src/Components/Icons/MedPriority.js +7 -17
- package/src/Components/Icons/Microphone.js +7 -10
- package/src/Components/Icons/Minimize.js +7 -10
- package/src/Components/Icons/Minus.js +7 -14
- package/src/Components/Icons/MobileScreenButton.js +7 -10
- package/src/Components/Icons/MoneyBill.js +7 -10
- package/src/Components/Icons/MoneyBillWave.js +7 -10
- package/src/Components/Icons/Mouth.js +10 -21
- package/src/Components/Icons/Music.js +7 -10
- package/src/Components/Icons/Na.js +7 -14
- package/src/Components/Icons/NoLoop.js +11 -13
- package/src/Components/Icons/NoReorderRows.js +17 -22
- package/src/Components/Icons/ObjectGroupRegular.js +7 -10
- package/src/Components/Icons/Pause.js +7 -10
- package/src/Components/Icons/Pdf.js +7 -10
- package/src/Components/Icons/Pencil.js +7 -14
- package/src/Components/Icons/Phone.js +7 -10
- package/src/Components/Icons/Play.js +7 -10
- package/src/Components/Icons/Plus.js +7 -14
- package/src/Components/Icons/Presentation.js +7 -16
- package/src/Components/Icons/Print.js +7 -14
- package/src/Components/Icons/Question.js +7 -10
- package/src/Components/Icons/Rate-.25x.js +12 -17
- package/src/Components/Icons/Rate-.5x.js +11 -16
- package/src/Components/Icons/Rate-.75x.js +8 -13
- package/src/Components/Icons/Rate-1.25x.js +8 -13
- package/src/Components/Icons/Rate-1.5x.js +8 -13
- package/src/Components/Icons/Rate-1.75x.js +8 -13
- package/src/Components/Icons/Rate-1x.js +11 -16
- package/src/Components/Icons/Rate-2x.js +8 -13
- package/src/Components/Icons/RateIcon-.25x.js +8 -13
- package/src/Components/Icons/RateIcon-.5x.js +11 -16
- package/src/Components/Icons/RateIcon-.75x.js +8 -13
- package/src/Components/Icons/RateIcon-1.25x.js +8 -13
- package/src/Components/Icons/RateIcon-1.5x.js +8 -13
- package/src/Components/Icons/RateIcon-1.75x.js +8 -13
- package/src/Components/Icons/RateIcon-1x.js +8 -13
- package/src/Components/Icons/RateIcon-2x.js +8 -13
- package/src/Components/Icons/RectangleXmark.js +7 -10
- package/src/Components/Icons/RectangleXmarkRegular.js +7 -10
- package/src/Components/Icons/ReorderRows.js +8 -13
- package/src/Components/Icons/RightFromBracket.js +7 -10
- package/src/Components/Icons/RightLeft.js +7 -10
- package/src/Components/Icons/RightToBracket.js +7 -10
- package/src/Components/Icons/Rotate.js +7 -14
- package/src/Components/Icons/RotateLeft.js +7 -10
- package/src/Components/Icons/RotateRight.js +7 -14
- package/src/Components/Icons/ScrewdriverWrench.js +7 -10
- package/src/Components/Icons/Scroll.js +7 -10
- package/src/Components/Icons/Share.js +7 -10
- package/src/Components/Icons/Shop.js +7 -10
- package/src/Components/Icons/SideBySide.js +7 -20
- package/src/Components/Icons/SortDown.js +7 -10
- package/src/Components/Icons/SortDownAlt.js +7 -10
- package/src/Components/Icons/SortUp.js +7 -10
- package/src/Components/Icons/SortUpAlt.js +7 -14
- package/src/Components/Icons/Square.js +7 -10
- package/src/Components/Icons/SquareCheck.js +7 -10
- package/src/Components/Icons/SquareCheckRegular.js +7 -10
- package/src/Components/Icons/SquareMinus.js +7 -14
- package/src/Components/Icons/SquareRegular.js +7 -10
- package/src/Components/Icons/Store.js +7 -10
- package/src/Components/Icons/Table.js +7 -16
- package/src/Components/Icons/ThumbsDown.js +7 -10
- package/src/Components/Icons/ThumbsDownRegular.js +7 -10
- package/src/Components/Icons/ThumbsUp.js +7 -10
- package/src/Components/Icons/ThumbsUpRegular.js +7 -10
- package/src/Components/Icons/Trash.js +7 -14
- package/src/Components/Icons/TrashCan.js +7 -14
- package/src/Components/Icons/TriangleExclamation.js +7 -14
- package/src/Components/Icons/Truck.js +7 -10
- package/src/Components/Icons/TruckFast.js +7 -10
- package/src/Components/Icons/Upload.js +11 -0
- package/src/Components/Icons/UploadDownload.js +11 -11
- package/src/Components/Icons/User.js +7 -10
- package/src/Components/Icons/UserGroup.js +7 -10
- package/src/Components/Icons/UserPlus.js +7 -10
- package/src/Components/Icons/UserSecret.js +7 -10
- package/src/Components/Icons/Video.js +7 -16
- package/src/Components/Icons/X.js +7 -10
- package/src/Components/Icons/Xmark.js +7 -10
- package/src/Components/Layout/CenterBox.js +13 -9
- package/src/Components/Layout/Footer.js +20 -13
- package/src/Components/Messages/ConfirmationMessage.js +30 -13
- package/src/Components/Messages/ErrorMessage.js +29 -23
- package/src/Components/Messages/Loading.js +10 -8
- package/src/Components/Messages/OkMessage.js +30 -13
- package/src/Components/Messages/Unauthorized.js +5 -8
- package/src/Components/Messages/WaitMessage.js +37 -73
- package/src/Components/Panel/AccordionGridPanel.js +6 -6
- package/src/Components/Panel/FormPanel.js +7 -3
- package/src/Components/Panel/Header.js +132 -94
- package/src/Components/Panel/Mask.js +4 -4
- package/src/Components/Panel/Panel.js +55 -72
- package/src/Components/Panel/TabPanel.js +1 -1
- package/src/Components/Picker/Picker.js +10 -9
- package/src/Components/Report/Report.js +17 -14
- package/src/Components/Screens/Manager.js +22 -22
- package/src/Components/Tab/TabBar.js +293 -225
- package/src/Components/Toolbar/FilterToolbar.js +15 -11
- package/src/Components/Toolbar/Pagination.js +51 -46
- package/src/Components/Toolbar/PaginationToolbar.js +25 -19
- package/src/Components/Toolbar/Toolbar.js +26 -13
- package/src/Components/Tooltip/Tooltip.js +35 -0
- package/src/Components/Tree/Tree.js +144 -147
- package/src/Components/Tree/TreeNode.js +75 -36
- package/src/Components/Viewer/Viewer.js +203 -80
- package/src/Components/Window/Editor.js +0 -5
- package/src/Components/Window/UploadsDownloadsWindow.js +40 -22
- package/src/Components/index.js +11 -8
- package/src/Constants/Alert.js +0 -0
- package/src/Constants/AppStates.js +0 -0
- package/src/Constants/Colors.js +13 -0
- package/src/Constants/Commands.js +0 -0
- package/src/Constants/Date.js +0 -0
- package/src/Constants/Dates.js +16 -0
- package/src/Constants/Directions.js +0 -0
- package/src/Constants/Editor.js +0 -0
- package/src/Constants/EditorModes.js +2 -0
- package/src/Constants/File.js +0 -0
- package/src/Constants/Filters.js +0 -0
- package/src/Constants/Grid.js +0 -0
- package/src/Constants/Input.js +1 -0
- package/src/Constants/MimeTypes.js +0 -0
- package/src/Constants/Selection.js +0 -0
- package/src/Constants/Styles.js +119 -108
- package/src/Constants/Tasks.js +3 -0
- package/src/Constants/Tree.js +0 -0
- package/src/Constants/UiModes.js +4 -3
- package/src/Functions/BankersRound.js +0 -0
- package/src/Functions/Cypress/button_functions.js +0 -0
- package/src/Functions/Cypress/crud_functions.js +0 -0
- package/src/Functions/Cypress/dom_functions.js +0 -0
- package/src/Functions/Cypress/grid_functions.js +0 -0
- package/src/Functions/Cypress/navigation_functions.js +0 -0
- package/src/Functions/Cypress/tree_functions.js +0 -0
- package/src/Functions/Cypress/utilities.js +0 -0
- package/src/Functions/PlatformDetector.js +0 -0
- package/src/Functions/Timer.js +0 -0
- package/src/Functions/buildAdditionalButtons.js +5 -5
- package/src/Functions/chunkArray.js +0 -0
- package/src/Functions/colorConversions.js +74 -0
- package/src/Functions/delay.js +0 -0
- package/src/Functions/delayUntil.js +0 -0
- package/src/Functions/deleteSaved.js +0 -0
- package/src/Functions/deleteSecure.js +0 -0
- package/src/Functions/downloadInBackground.js +0 -0
- package/src/Functions/downloadWithFetch.js +0 -0
- package/src/Functions/emptyFn.js +0 -0
- package/src/Functions/getComponentFromType.js +0 -0
- package/src/Functions/getIconButtonFromConfig.js +5 -9
- package/src/Functions/getIsMobile.js +0 -0
- package/src/Functions/getNodeIcon.js +28 -0
- package/src/Functions/getPref.js +0 -0
- package/src/Functions/getSaved.js +0 -0
- package/src/Functions/getSecure.js +0 -0
- package/src/Functions/getTokenHeaders.js +0 -0
- package/src/Functions/gsToHex.js +205 -0
- package/src/Functions/ignoreWanings.js +46 -0
- package/src/Functions/inArray.js +0 -0
- package/src/Functions/isJson.js +0 -0
- package/src/Functions/isSerializable.js +0 -0
- package/src/Functions/isVideo.js +0 -0
- package/src/Functions/jsonValidator.js +0 -0
- package/src/Functions/nbToRgb.js +1 -1
- package/src/Functions/objectToClassName.js +72 -0
- package/src/Functions/parseNotification.js +0 -0
- package/src/Functions/processImage.js +0 -0
- package/src/Functions/registerReactNativeComponents.js +0 -0
- package/src/Functions/registerWebComponents.js +0 -0
- package/src/Functions/setCustomInflector.js +0 -0
- package/src/Functions/setPref.js +0 -0
- package/src/Functions/setProgress.js +0 -0
- package/src/Functions/setSaved.js +0 -0
- package/src/Functions/setSecure.js +0 -0
- package/src/Functions/setThemeOverrides.js +0 -0
- package/src/Functions/setUiSavesRepo.js +0 -0
- package/src/Functions/sleep.js +0 -0
- package/src/Functions/tailwindFunctions.js +384 -0
- package/src/Functions/testProps.js +0 -0
- package/src/Functions/trackEngagementHit.js +0 -0
- package/src/Functions/verifyCompleted.js +0 -0
- package/src/Functions/waitFor.js +2 -2
- package/src/PlatformImports/Web/Attachments.js +32 -38
- package/src/PlatformImports/Web/File.js +38 -31
- package/src/UiGlobals.js +8 -1
- package/src/Components/Grid/ColumnSelectorWindow.js +0 -125
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState, useRef, isValidElement, } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Box,
|
|
4
|
-
|
|
4
|
+
HStack,
|
|
5
5
|
Icon,
|
|
6
|
-
Row,
|
|
7
6
|
ScrollView,
|
|
8
7
|
Text,
|
|
9
|
-
|
|
8
|
+
VStack,
|
|
9
|
+
VStackNative,
|
|
10
|
+
} from '../Gluestack';
|
|
10
11
|
import {
|
|
11
12
|
VIEW,
|
|
12
13
|
} from '../../Constants/Commands.js';
|
|
@@ -20,6 +21,10 @@ import {
|
|
|
20
21
|
EDITOR_MODE__ADD,
|
|
21
22
|
EDITOR_MODE__EDIT,
|
|
22
23
|
} from '../../Constants/Editor.js';
|
|
24
|
+
import {
|
|
25
|
+
hasWidth,
|
|
26
|
+
hasFlex,
|
|
27
|
+
} from '../../Functions/tailwindFunctions.js';
|
|
23
28
|
import { useForm, Controller } from 'react-hook-form'; // https://react-hook-form.com/api/
|
|
24
29
|
import * as yup from 'yup'; // https://github.com/jquense/yup#string
|
|
25
30
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -28,7 +33,6 @@ import UiGlobals from '../../UiGlobals.js';
|
|
|
28
33
|
import withAlert from '../Hoc/withAlert.js';
|
|
29
34
|
import withComponent from '../Hoc/withComponent.js';
|
|
30
35
|
import withEditor from '../Hoc/withEditor.js';
|
|
31
|
-
import withPdfButtons from '../Hoc/withPdfButtons.js';
|
|
32
36
|
import inArray from '../../Functions/inArray.js';
|
|
33
37
|
import getComponentFromType from '../../Functions/getComponentFromType.js';
|
|
34
38
|
import buildAdditionalButtons from '../../Functions/buildAdditionalButtons.js';
|
|
@@ -44,10 +48,6 @@ import Footer from '../Layout/Footer.js';
|
|
|
44
48
|
import Label from '../Form/Label.js';
|
|
45
49
|
import _ from 'lodash';
|
|
46
50
|
|
|
47
|
-
const
|
|
48
|
-
ONE_COLUMN_THRESHOLD = 900, // only allow one column in form
|
|
49
|
-
STACK_ROW_THRESHOLD = 500; // stack field-row elements
|
|
50
|
-
|
|
51
51
|
// TODO: memoize field Components
|
|
52
52
|
|
|
53
53
|
// Modes:
|
|
@@ -94,14 +94,12 @@ function Form(props) {
|
|
|
94
94
|
useAdditionalEditButtons = true,
|
|
95
95
|
additionalFooterButtons,
|
|
96
96
|
disableFooter = false,
|
|
97
|
+
hideResetButton = false,
|
|
97
98
|
|
|
98
99
|
// sizing of outer container
|
|
99
|
-
h,
|
|
100
100
|
maxHeight,
|
|
101
101
|
minHeight = 0,
|
|
102
|
-
w,
|
|
103
102
|
maxWidth,
|
|
104
|
-
flex,
|
|
105
103
|
onLayout, // onLayout handler for main view
|
|
106
104
|
|
|
107
105
|
// withComponent
|
|
@@ -130,10 +128,12 @@ function Form(props) {
|
|
|
130
128
|
|
|
131
129
|
// withAlert
|
|
132
130
|
alert,
|
|
131
|
+
|
|
133
132
|
} = props,
|
|
134
133
|
formRef = useRef(),
|
|
135
134
|
styles = UiGlobals.styles,
|
|
136
135
|
record = props.record?.length === 1 ? props.record[0] : props.record;
|
|
136
|
+
|
|
137
137
|
let skipAll = false;
|
|
138
138
|
if (record?.isDestroyed) {
|
|
139
139
|
skipAll = true; // if record is destroyed, skip render, but allow hooks to still be called
|
|
@@ -189,14 +189,16 @@ function Form(props) {
|
|
|
189
189
|
// Build the fields that match the current columnsConfig in the grid
|
|
190
190
|
const
|
|
191
191
|
elements = [],
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
192
|
+
columnClassName = `
|
|
193
|
+
Form-column
|
|
194
|
+
justify-center
|
|
195
|
+
items-center
|
|
196
|
+
h-[60px]
|
|
197
|
+
border-r-1
|
|
198
|
+
border-r-grey-200
|
|
199
|
+
px-1
|
|
200
|
+
${styles.INLINE_EDITOR_MIN_WIDTH}
|
|
201
|
+
`;
|
|
200
202
|
_.each(columnsConfig, (config, ix) => {
|
|
201
203
|
let {
|
|
202
204
|
fieldName,
|
|
@@ -211,7 +213,7 @@ function Form(props) {
|
|
|
211
213
|
getDynamicProps,
|
|
212
214
|
getIsRequired,
|
|
213
215
|
isHidden = false,
|
|
214
|
-
...
|
|
216
|
+
...configPropsToPass
|
|
215
217
|
} = config,
|
|
216
218
|
type,
|
|
217
219
|
editorTypeProps = {},
|
|
@@ -273,7 +275,7 @@ function Form(props) {
|
|
|
273
275
|
}
|
|
274
276
|
if (isCombo) {
|
|
275
277
|
// editorTypeProps.showEyeButton = true;
|
|
276
|
-
if (_.isNil(
|
|
278
|
+
if (_.isNil(configPropsToPass.showXButton)) {
|
|
277
279
|
editorTypeProps.showXButton = true;
|
|
278
280
|
}
|
|
279
281
|
}
|
|
@@ -295,15 +297,41 @@ function Form(props) {
|
|
|
295
297
|
}
|
|
296
298
|
}
|
|
297
299
|
|
|
300
|
+
let elementClassName = '';
|
|
301
|
+
const
|
|
302
|
+
boxFlex = configPropsToPass.flex,
|
|
303
|
+
boxW = configPropsToPass.w;
|
|
304
|
+
delete configPropsToPass.w;
|
|
305
|
+
delete configPropsToPass.flex;
|
|
306
|
+
const configPropsToPassClassName = configPropsToPass.className;
|
|
307
|
+
if (configPropsToPassClassName) {
|
|
308
|
+
elementClassName += ' ' + configPropsToPassClassName;
|
|
309
|
+
}
|
|
310
|
+
const viewerTypeClassName = viewerTypeProps.className;
|
|
311
|
+
if (viewerTypeClassName) {
|
|
312
|
+
elementClassName += ' ' + viewerTypeClassName;
|
|
313
|
+
}
|
|
298
314
|
let element = <Element
|
|
299
315
|
{...testProps('field-' + fieldName)}
|
|
300
316
|
value={value}
|
|
301
317
|
parent={self}
|
|
302
318
|
reference={fieldName}
|
|
303
|
-
{...
|
|
319
|
+
{...configPropsToPass}
|
|
304
320
|
{...viewerTypeProps}
|
|
321
|
+
className={elementClassName}
|
|
305
322
|
/>;
|
|
306
|
-
|
|
323
|
+
const style = {};
|
|
324
|
+
if (boxFlex) {
|
|
325
|
+
style.flex = boxFlex;
|
|
326
|
+
}
|
|
327
|
+
if (boxW) {
|
|
328
|
+
style.width = boxW;
|
|
329
|
+
}
|
|
330
|
+
elements.push(<Box
|
|
331
|
+
key={ix}
|
|
332
|
+
className={columnClassName}
|
|
333
|
+
style={style}
|
|
334
|
+
>{element}</Box>);
|
|
307
335
|
return;
|
|
308
336
|
}
|
|
309
337
|
|
|
@@ -338,8 +366,8 @@ function Form(props) {
|
|
|
338
366
|
if (useSelectorId) { // This causes the whole form to use selectorId
|
|
339
367
|
editorTypeProps.selectorId = selectorId;
|
|
340
368
|
}
|
|
341
|
-
if (
|
|
342
|
-
if (_.isNil(
|
|
369
|
+
if (configPropsToPass.selectorId || editorTypeProps.selectorId) { // editorTypeProps.selectorId causes just this one field to use selectorId
|
|
370
|
+
if (_.isNil(configPropsToPass.selectorSelected)) {
|
|
343
371
|
editorTypeProps.selectorSelected = record;
|
|
344
372
|
}
|
|
345
373
|
}
|
|
@@ -348,42 +376,76 @@ function Form(props) {
|
|
|
348
376
|
dynamicProps = getDynamicProps({ fieldState, formSetValue, formGetValues, formState });
|
|
349
377
|
}
|
|
350
378
|
|
|
379
|
+
let elementClassName = 'flex-1';
|
|
351
380
|
if (type.match(/Tag/)) {
|
|
352
|
-
|
|
381
|
+
elementClassName += ' overflow-auto';
|
|
353
382
|
}
|
|
354
383
|
if (!type.match(/Toggle/)) {
|
|
355
|
-
|
|
384
|
+
elementClassName += ' h-full';
|
|
385
|
+
}
|
|
386
|
+
const configPropsToPassClassName = configPropsToPass.className;
|
|
387
|
+
if (configPropsToPassClassName) {
|
|
388
|
+
elementClassName += ' ' + configPropsToPassClassName;
|
|
389
|
+
}
|
|
390
|
+
const editorTypeClassName = editorTypeProps.className;
|
|
391
|
+
if (editorTypeClassName) {
|
|
392
|
+
elementClassName += ' ' + editorTypeClassName;
|
|
393
|
+
}
|
|
394
|
+
const dynamicClassName = dynamicProps.className;
|
|
395
|
+
if (dynamicClassName) {
|
|
396
|
+
elementClassName += ' ' + dynamicClassName;
|
|
356
397
|
}
|
|
357
398
|
|
|
358
399
|
let element = <Element
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
400
|
+
{...testProps('field-' + name)}
|
|
401
|
+
name={name}
|
|
402
|
+
value={value}
|
|
403
|
+
onChangeValue={(newValue) => {
|
|
404
|
+
if (newValue === undefined) {
|
|
405
|
+
newValue = null; // React Hook Form doesn't respond well when setting value to undefined
|
|
406
|
+
}
|
|
407
|
+
onChange(newValue);
|
|
408
|
+
if (onEditorChange) {
|
|
409
|
+
onEditorChange(newValue, formSetValue, formGetValues, formState, trigger);
|
|
410
|
+
}
|
|
411
|
+
}}
|
|
412
|
+
onBlur={onBlur}
|
|
413
|
+
minimizeForRow={true}
|
|
414
|
+
parent={self}
|
|
415
|
+
reference={name}
|
|
416
|
+
{...configPropsToPass}
|
|
417
|
+
{...editorTypeProps}
|
|
418
|
+
{...dynamicProps}
|
|
419
|
+
className={elementClassName}
|
|
420
|
+
/>;
|
|
379
421
|
|
|
380
|
-
const dirtyIcon = isDirty && !disableDirtyIcon ?
|
|
381
|
-
|
|
422
|
+
const dirtyIcon = isDirty && !disableDirtyIcon ?
|
|
423
|
+
<Icon
|
|
424
|
+
as={Pencil}
|
|
425
|
+
size="2xs"
|
|
426
|
+
className={`
|
|
427
|
+
absolute
|
|
428
|
+
top-[2px]
|
|
429
|
+
left-[2px]
|
|
430
|
+
text-grey-300
|
|
431
|
+
`}
|
|
432
|
+
/> : null;
|
|
433
|
+
return <HStack
|
|
434
|
+
key={ix}
|
|
435
|
+
className={`
|
|
436
|
+
flex-${flex}
|
|
437
|
+
${error ? "bg-[#fdd]" : "bg-white"}
|
|
438
|
+
${columnClassName}
|
|
439
|
+
`}
|
|
440
|
+
style={{
|
|
441
|
+
width: w,
|
|
442
|
+
}}
|
|
443
|
+
>{dirtyIcon}{element}</HStack>;
|
|
382
444
|
}}
|
|
383
445
|
/>);
|
|
384
446
|
|
|
385
447
|
});
|
|
386
|
-
return <
|
|
448
|
+
return <HStack>{elements}</HStack>;
|
|
387
449
|
},
|
|
388
450
|
buildFromItems = () => {
|
|
389
451
|
return _.map(items, (item, ix) => buildFromItem(item, ix, columnDefaults));
|
|
@@ -392,7 +454,7 @@ function Form(props) {
|
|
|
392
454
|
if (!item) {
|
|
393
455
|
return null;
|
|
394
456
|
}
|
|
395
|
-
if (
|
|
457
|
+
if (isValidElement(item)) {
|
|
396
458
|
return item;
|
|
397
459
|
}
|
|
398
460
|
let {
|
|
@@ -408,17 +470,19 @@ function Form(props) {
|
|
|
408
470
|
isHidden = false,
|
|
409
471
|
getDynamicProps,
|
|
410
472
|
getIsRequired,
|
|
411
|
-
...
|
|
473
|
+
...itemPropsToPass
|
|
412
474
|
} = item,
|
|
413
475
|
editorTypeProps = {},
|
|
414
476
|
viewerTypeProps = {};
|
|
415
|
-
|
|
416
477
|
if (isHidden) {
|
|
417
478
|
return null;
|
|
418
479
|
}
|
|
419
480
|
if (type === 'DisplayField') {
|
|
420
481
|
isEditable = false;
|
|
421
482
|
}
|
|
483
|
+
if (!itemPropsToPass.className) {
|
|
484
|
+
itemPropsToPass.className = '';
|
|
485
|
+
}
|
|
422
486
|
const propertyDef = name && Repository?.getSchema().getPropertyDefinition(name);
|
|
423
487
|
if (!useAdditionalEditButtons) {
|
|
424
488
|
item = _.omit(item, 'additionalEditButtons');
|
|
@@ -461,42 +525,78 @@ function Form(props) {
|
|
|
461
525
|
}
|
|
462
526
|
if (isCombo) {
|
|
463
527
|
// editorTypeProps.showEyeButton = true;
|
|
464
|
-
if (_.isNil(
|
|
528
|
+
if (_.isNil(itemPropsToPass.showXButton)) {
|
|
465
529
|
editorTypeProps.showXButton = true;
|
|
466
530
|
}
|
|
467
531
|
}
|
|
468
532
|
const Element = getComponentFromType(type);
|
|
469
533
|
|
|
470
534
|
if (inArray(type, ['Column', 'Row', 'FieldSet'])) {
|
|
471
|
-
let children;
|
|
472
535
|
if (_.isEmpty(items)) {
|
|
473
536
|
return null;
|
|
474
537
|
}
|
|
538
|
+
let children;
|
|
539
|
+
const style = {};
|
|
475
540
|
if (type === 'Column') {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
if (
|
|
479
|
-
|
|
541
|
+
const isEverythingInOneColumn = containerWidth < styles.FORM_ONE_COLUMN_THRESHOLD;
|
|
542
|
+
if (itemPropsToPass.hasOwnProperty('flex')) {
|
|
543
|
+
if (!isEverythingInOneColumn) {
|
|
544
|
+
style.flex = itemPropsToPass.flex;
|
|
480
545
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
if (
|
|
485
|
-
|
|
546
|
+
delete itemPropsToPass.flex;
|
|
547
|
+
}
|
|
548
|
+
if (itemPropsToPass.hasOwnProperty('w')) {
|
|
549
|
+
if (!isEverythingInOneColumn) {
|
|
550
|
+
style.width = itemPropsToPass.w;
|
|
486
551
|
}
|
|
487
|
-
|
|
488
|
-
|
|
552
|
+
delete itemPropsToPass.w;
|
|
553
|
+
}
|
|
554
|
+
if (!style.flex && !style.width) {
|
|
555
|
+
style.flex = 1;
|
|
489
556
|
}
|
|
490
|
-
|
|
557
|
+
itemPropsToPass.className += ' Column';
|
|
491
558
|
}
|
|
492
559
|
if (type === 'Row') {
|
|
493
|
-
|
|
560
|
+
itemPropsToPass.className += ' Row w-full';
|
|
494
561
|
}
|
|
495
562
|
const itemDefaults = item.defaults || {};
|
|
496
563
|
children = _.map(items, (item, ix) => {
|
|
497
564
|
return buildFromItem(item, ix, {...defaults, ...itemDefaults});
|
|
498
565
|
});
|
|
499
|
-
|
|
566
|
+
|
|
567
|
+
let elementClassName = '';
|
|
568
|
+
const defaultsClassName = defaults.className;
|
|
569
|
+
if (defaultsClassName) {
|
|
570
|
+
elementClassName += ' ' + defaultsClassName;
|
|
571
|
+
}
|
|
572
|
+
const itemDefaultsClassName = itemDefaults.className;
|
|
573
|
+
if (itemDefaultsClassName) {
|
|
574
|
+
elementClassName += ' ' + itemDefaultsClassName;
|
|
575
|
+
}
|
|
576
|
+
const itemPropsToPassClassName = itemPropsToPass.className;
|
|
577
|
+
if (itemPropsToPassClassName) {
|
|
578
|
+
elementClassName += ' ' + itemPropsToPassClassName;
|
|
579
|
+
}
|
|
580
|
+
const editorTypeClassName = editorTypeProps.className;
|
|
581
|
+
if (editorTypeClassName) {
|
|
582
|
+
elementClassName += ' ' + editorTypeClassName;
|
|
583
|
+
}
|
|
584
|
+
let defaultsToPass = {},
|
|
585
|
+
itemDefaultsToPass = {};
|
|
586
|
+
if (type === 'FieldSet') { // don't pass for Row and Column, as they use regular <div>s for web
|
|
587
|
+
defaultsToPass = defaults;
|
|
588
|
+
itemDefaultsToPass = itemDefaults;
|
|
589
|
+
}
|
|
590
|
+
return <Element
|
|
591
|
+
key={ix}
|
|
592
|
+
title={title}
|
|
593
|
+
{...defaultsToPass}
|
|
594
|
+
{...itemDefaultsToPass}
|
|
595
|
+
{...itemPropsToPass}
|
|
596
|
+
{...editorTypeProps}
|
|
597
|
+
className={elementClassName}
|
|
598
|
+
style={style}
|
|
599
|
+
>{children}</Element>;
|
|
500
600
|
}
|
|
501
601
|
|
|
502
602
|
if (!label && Repository && propertyDef?.title) {
|
|
@@ -504,40 +604,60 @@ function Form(props) {
|
|
|
504
604
|
}
|
|
505
605
|
|
|
506
606
|
if (isEditorViewOnly || !isEditable) {
|
|
507
|
-
let value = null;
|
|
508
|
-
if (record?.properties && record.properties[name]) {
|
|
509
|
-
value = record.properties[name].displayValue;
|
|
510
|
-
}
|
|
607
|
+
let value = record?.properties[name]?.displayValue || null;
|
|
511
608
|
if (_.isNil(value) && record && record[name]) {
|
|
512
609
|
value = record[name];
|
|
513
610
|
}
|
|
514
611
|
if (_.isNil(value) && startingValues && startingValues[name]) {
|
|
515
612
|
value = startingValues[name];
|
|
516
613
|
}
|
|
614
|
+
|
|
615
|
+
let elementClassName = 'field-' + name;
|
|
616
|
+
const defaultsClassName = defaults.className;
|
|
617
|
+
if (defaultsClassName) {
|
|
618
|
+
elementClassName += ' ' + defaultsClassName;
|
|
619
|
+
}
|
|
620
|
+
const itemPropsToPassClassName = itemPropsToPass.className;
|
|
621
|
+
if (itemPropsToPassClassName) {
|
|
622
|
+
elementClassName += ' ' + itemPropsToPassClassName;
|
|
623
|
+
}
|
|
624
|
+
const viewerTypeClassName = viewerTypeProps.className;
|
|
625
|
+
if (viewerTypeClassName) {
|
|
626
|
+
elementClassName += ' ' + viewerTypeClassName;
|
|
627
|
+
}
|
|
517
628
|
|
|
518
629
|
let element = <Element
|
|
519
630
|
{...testProps('field-' + name)}
|
|
520
631
|
value={value}
|
|
521
632
|
parent={self}
|
|
522
633
|
reference={name}
|
|
523
|
-
{...
|
|
634
|
+
{...itemPropsToPass}
|
|
524
635
|
{...viewerTypeProps}
|
|
636
|
+
className={elementClassName}
|
|
525
637
|
/>;
|
|
526
638
|
if (!disableLabels && label) {
|
|
527
|
-
const
|
|
639
|
+
const style = {};
|
|
528
640
|
if (defaults?.labelWidth) {
|
|
529
|
-
|
|
641
|
+
style.width = defaults.labelWidth;
|
|
530
642
|
}
|
|
531
|
-
if (
|
|
532
|
-
|
|
643
|
+
if (!style.width) {
|
|
644
|
+
style.width = '50px';
|
|
645
|
+
}
|
|
646
|
+
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
647
|
+
element = <HStack className="HStackA py-1">
|
|
648
|
+
<Label style={style}>{label}</Label>
|
|
649
|
+
{element}
|
|
650
|
+
</HStack>;
|
|
533
651
|
} else {
|
|
534
|
-
element = <
|
|
652
|
+
element = <VStack className="HStackA w-full py-1 mt-3">
|
|
653
|
+
<Label style={style}>{label}</Label>
|
|
654
|
+
{element}
|
|
655
|
+
</VStack>;
|
|
535
656
|
}
|
|
536
657
|
}
|
|
537
|
-
return <
|
|
658
|
+
return <HStack key={ix} className="HStackB px-2 pb-1">{element}</HStack>;
|
|
538
659
|
}
|
|
539
660
|
|
|
540
|
-
|
|
541
661
|
|
|
542
662
|
// // These rules are for fields *outside* the model
|
|
543
663
|
// // but which want validation on the form anyway.
|
|
@@ -590,8 +710,8 @@ function Form(props) {
|
|
|
590
710
|
if (useSelectorId) { // This causes the whole form to use selectorId
|
|
591
711
|
editorTypeProps.selectorId = selectorId;
|
|
592
712
|
}
|
|
593
|
-
if (
|
|
594
|
-
if (_.isNil(
|
|
713
|
+
if (itemPropsToPass.selectorId || editorTypeProps.selectorId) { // editorTypeProps.selectorId causes just this one field to use selectorId
|
|
714
|
+
if (_.isNil(itemPropsToPass.selectorSelected)) {
|
|
595
715
|
editorTypeProps.selectorSelected = record;
|
|
596
716
|
}
|
|
597
717
|
}
|
|
@@ -599,6 +719,25 @@ function Form(props) {
|
|
|
599
719
|
if (getDynamicProps) {
|
|
600
720
|
dynamicProps = getDynamicProps({ fieldState, formSetValue, formGetValues, formState });
|
|
601
721
|
}
|
|
722
|
+
|
|
723
|
+
let elementClassName = 'field-' + name + ' flex-1 Form-Element';
|
|
724
|
+
const defaultsClassName = defaults.className;
|
|
725
|
+
if (defaultsClassName) {
|
|
726
|
+
elementClassName += ' ' + defaultsClassName;
|
|
727
|
+
}
|
|
728
|
+
const itemPropsToPassClassName = itemPropsToPass.className;
|
|
729
|
+
if (itemPropsToPassClassName) {
|
|
730
|
+
elementClassName += ' ' + itemPropsToPassClassName;
|
|
731
|
+
}
|
|
732
|
+
const editorTypeClassName = editorTypeProps.className;
|
|
733
|
+
if (editorTypeClassName) {
|
|
734
|
+
elementClassName += ' ' + editorTypeClassName;
|
|
735
|
+
}
|
|
736
|
+
const dynamicClassName = dynamicProps.className;
|
|
737
|
+
if (dynamicClassName) {
|
|
738
|
+
elementClassName += ' ' + dynamicClassName;
|
|
739
|
+
}
|
|
740
|
+
|
|
602
741
|
let element = <Element
|
|
603
742
|
{...testProps('field-' + name)}
|
|
604
743
|
name={name}
|
|
@@ -613,13 +752,13 @@ function Form(props) {
|
|
|
613
752
|
}
|
|
614
753
|
}}
|
|
615
754
|
onBlur={onBlur}
|
|
616
|
-
flex={1}
|
|
617
755
|
parent={self}
|
|
618
756
|
reference={name}
|
|
619
757
|
{...defaults}
|
|
620
|
-
{...
|
|
758
|
+
{...itemPropsToPass}
|
|
621
759
|
{...editorTypeProps}
|
|
622
760
|
{...dynamicProps}
|
|
761
|
+
className={elementClassName}
|
|
623
762
|
/>;
|
|
624
763
|
let message = null;
|
|
625
764
|
if (error) {
|
|
@@ -629,27 +768,27 @@ function Form(props) {
|
|
|
629
768
|
}
|
|
630
769
|
}
|
|
631
770
|
if (message) {
|
|
632
|
-
message = <Text
|
|
771
|
+
message = <Text className="text-[#f00]">{message}</Text>;
|
|
633
772
|
}
|
|
634
|
-
element = <
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
773
|
+
element = <VStack className="Form-messageContainer pt-1 flex-1">
|
|
774
|
+
{element}
|
|
775
|
+
{message}
|
|
776
|
+
</VStack>;
|
|
638
777
|
|
|
639
778
|
if (item.additionalEditButtons) {
|
|
640
779
|
const buttons = buildAdditionalButtons(item.additionalEditButtons, self, { fieldState, formSetValue, formGetValues, formState });
|
|
641
|
-
if (containerWidth >
|
|
642
|
-
element = <
|
|
780
|
+
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
781
|
+
element = <HStack className="Form-additionalEditButtons flex-1 flex-wrap">
|
|
643
782
|
{element}
|
|
644
783
|
{buttons}
|
|
645
|
-
</
|
|
784
|
+
</HStack>;
|
|
646
785
|
} else {
|
|
647
|
-
element = <
|
|
786
|
+
element = <VStack className="Form-additionalEditButtons flex-1 w-full">
|
|
648
787
|
{element}
|
|
649
|
-
<
|
|
788
|
+
<HStack className="Form-additionalEditButtons-VStack flex-1 w-full mt-1 flex-wrap">
|
|
650
789
|
{buttons}
|
|
651
|
-
</
|
|
652
|
-
</
|
|
790
|
+
</HStack>
|
|
791
|
+
</VStack>;
|
|
653
792
|
}
|
|
654
793
|
}
|
|
655
794
|
|
|
@@ -668,34 +807,59 @@ function Form(props) {
|
|
|
668
807
|
isRequired = true;
|
|
669
808
|
}
|
|
670
809
|
if (isRequired) {
|
|
671
|
-
requiredIndicator = <Text
|
|
810
|
+
requiredIndicator = <Text className="text-[#f00] text-[30px] pr-1">*</Text>;
|
|
672
811
|
}
|
|
673
812
|
}
|
|
674
813
|
if (!disableLabels && label && editorType !== EDITOR_TYPE__INLINE) {
|
|
675
|
-
const
|
|
814
|
+
const style = {};
|
|
676
815
|
if (defaults?.labelWidth) {
|
|
677
|
-
|
|
816
|
+
style.width = defaults.labelWidth;
|
|
817
|
+
}
|
|
818
|
+
if (!style.width) {
|
|
819
|
+
style.width = '50px';
|
|
678
820
|
}
|
|
679
|
-
if (containerWidth >
|
|
680
|
-
element = <
|
|
681
|
-
|
|
821
|
+
if (containerWidth > styles.FORM_STACK_ROW_THRESHOLD) {
|
|
822
|
+
element = <HStack className="HStack3 flex-1 py-1">
|
|
823
|
+
<Label style={style}>{requiredIndicator}{label}</Label>
|
|
682
824
|
{element}
|
|
683
|
-
|
|
825
|
+
</HStack>;
|
|
684
826
|
} else {
|
|
685
|
-
element = <
|
|
686
|
-
<Label {
|
|
827
|
+
element = <VStack className="VStack3 flex-1 py-1 mt-3">
|
|
828
|
+
<Label style={style}>{requiredIndicator}{label}</Label>
|
|
687
829
|
{element}
|
|
688
|
-
</
|
|
830
|
+
</VStack>;
|
|
689
831
|
}
|
|
690
832
|
} else if (disableLabels && requiredIndicator) {
|
|
691
|
-
element = <
|
|
833
|
+
element = <HStack className="HStack3 flex-1 py-1">
|
|
692
834
|
{requiredIndicator}
|
|
693
835
|
{element}
|
|
694
|
-
</
|
|
836
|
+
</HStack>;
|
|
695
837
|
}
|
|
696
838
|
|
|
697
|
-
const dirtyIcon = isDirty && !disableDirtyIcon ?
|
|
698
|
-
|
|
839
|
+
const dirtyIcon = isDirty && !disableDirtyIcon ?
|
|
840
|
+
<Icon
|
|
841
|
+
as={Pencil}
|
|
842
|
+
size="2xs"
|
|
843
|
+
className={`
|
|
844
|
+
absolute
|
|
845
|
+
top-[2px]
|
|
846
|
+
left-[2px]
|
|
847
|
+
text-grey-300
|
|
848
|
+
`}
|
|
849
|
+
/> : null;
|
|
850
|
+
return <HStack
|
|
851
|
+
key={ix}
|
|
852
|
+
className={`
|
|
853
|
+
HStack4
|
|
854
|
+
flex-none
|
|
855
|
+
px-2
|
|
856
|
+
pb-1
|
|
857
|
+
${error ? 'bg-[#fdd]' : ''}
|
|
858
|
+
`}
|
|
859
|
+
>
|
|
860
|
+
{dirtyIcon}
|
|
861
|
+
{element}
|
|
862
|
+
</HStack>;
|
|
699
863
|
}}
|
|
700
864
|
/>;
|
|
701
865
|
},
|
|
@@ -708,41 +872,55 @@ function Form(props) {
|
|
|
708
872
|
title = null,
|
|
709
873
|
description = null,
|
|
710
874
|
selectorId,
|
|
711
|
-
...
|
|
875
|
+
...itemPropsToPass
|
|
712
876
|
} = item;
|
|
713
877
|
if (isMultiple && type !== 'Attachments') {
|
|
714
878
|
return;
|
|
715
879
|
}
|
|
716
|
-
if (!
|
|
717
|
-
|
|
880
|
+
if (type.match(/Grid/) && !itemPropsToPass.h) {
|
|
881
|
+
itemPropsToPass.h = 400;
|
|
718
882
|
}
|
|
883
|
+
|
|
719
884
|
const
|
|
720
885
|
Element = getComponentFromType(type),
|
|
721
886
|
element = <Element
|
|
722
887
|
{...testProps('ancillary-' + type)}
|
|
723
888
|
selectorId={selectorId}
|
|
724
889
|
selectorSelected={selectorSelected || record}
|
|
725
|
-
flex={1}
|
|
726
890
|
uniqueRepository={true}
|
|
727
891
|
parent={self}
|
|
728
|
-
{...
|
|
892
|
+
{...itemPropsToPass}
|
|
729
893
|
/>;
|
|
730
894
|
if (title) {
|
|
731
895
|
if (record?.displayValue) {
|
|
732
896
|
title += ' for ' + record.displayValue;
|
|
733
897
|
}
|
|
734
898
|
title = <Text
|
|
735
|
-
|
|
736
|
-
|
|
899
|
+
className={`
|
|
900
|
+
font-bold
|
|
901
|
+
${styles.FORM_ANCILLARY_TITLE_FONTSIZE}
|
|
902
|
+
`}
|
|
737
903
|
>{title}</Text>;
|
|
738
904
|
}
|
|
739
905
|
if (description) {
|
|
740
906
|
description = <Text
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
907
|
+
className={`
|
|
908
|
+
italic
|
|
909
|
+
${styles.FORM_ANCILLARY_DESCRIPTION_FONTSIZE}
|
|
910
|
+
`}
|
|
911
|
+
>{description}</Text>;
|
|
744
912
|
}
|
|
745
|
-
components.push(<
|
|
913
|
+
components.push(<VStack
|
|
914
|
+
key={'ancillary-' + ix}
|
|
915
|
+
className={`
|
|
916
|
+
mx-1
|
|
917
|
+
my-3
|
|
918
|
+
`}
|
|
919
|
+
>
|
|
920
|
+
{title}
|
|
921
|
+
{description}
|
|
922
|
+
{element}
|
|
923
|
+
</VStack>);
|
|
746
924
|
});
|
|
747
925
|
}
|
|
748
926
|
return components;
|
|
@@ -841,7 +1019,7 @@ function Form(props) {
|
|
|
841
1019
|
// }
|
|
842
1020
|
|
|
843
1021
|
if (!_.isNil(editorStateRef)) {
|
|
844
|
-
editorStateRef.current = formState; // Update state so
|
|
1022
|
+
editorStateRef.current = formState; // Update state so withEditor can know what's going on
|
|
845
1023
|
}
|
|
846
1024
|
|
|
847
1025
|
if (self) {
|
|
@@ -853,66 +1031,51 @@ function Form(props) {
|
|
|
853
1031
|
self.formGetValues = formGetValues;
|
|
854
1032
|
}
|
|
855
1033
|
|
|
856
|
-
const
|
|
857
|
-
if (!
|
|
858
|
-
|
|
859
|
-
} else {
|
|
860
|
-
if (h) {
|
|
861
|
-
sizeProps.h = h;
|
|
862
|
-
}
|
|
863
|
-
if (w) {
|
|
864
|
-
sizeProps.w = w;
|
|
865
|
-
}
|
|
866
|
-
if (flex) {
|
|
867
|
-
sizeProps.flex = flex;
|
|
868
|
-
}
|
|
1034
|
+
const style = props.style || {};
|
|
1035
|
+
if (!hasWidth(props) && !hasFlex(props)) {
|
|
1036
|
+
style.flex = 1;
|
|
869
1037
|
}
|
|
870
1038
|
if (maxWidth) {
|
|
871
|
-
|
|
1039
|
+
style.maxWidth = maxWidth;
|
|
872
1040
|
}
|
|
873
1041
|
if (maxHeight) {
|
|
874
|
-
|
|
1042
|
+
style.maxHeight = maxHeight;
|
|
875
1043
|
}
|
|
876
1044
|
|
|
877
1045
|
const formButtons = [];
|
|
878
1046
|
let modeHeader = null,
|
|
1047
|
+
footer = null,
|
|
1048
|
+
footerButtons = null,
|
|
879
1049
|
formComponents,
|
|
880
1050
|
editor,
|
|
881
1051
|
additionalButtons,
|
|
882
1052
|
isSaveDisabled = false,
|
|
883
1053
|
isSubmitDisabled = false,
|
|
884
|
-
savingProps = {},
|
|
885
|
-
|
|
886
1054
|
showDeleteBtn = false,
|
|
887
1055
|
showResetBtn = false,
|
|
888
1056
|
showCloseBtn = false,
|
|
889
1057
|
showCancelBtn = false,
|
|
890
1058
|
showSaveBtn = false,
|
|
891
1059
|
showSubmitBtn = false;
|
|
892
|
-
|
|
893
1060
|
if (containerWidth) { // we need to render this component twice in order to get the container width. Skip this on first render
|
|
894
|
-
|
|
895
|
-
if (isSaving) {
|
|
896
|
-
savingProps.borderTopWidth = 2;
|
|
897
|
-
savingProps.borderTopColor = '#f00';
|
|
898
|
-
}
|
|
899
1061
|
|
|
1062
|
+
// create editor
|
|
900
1063
|
if (editorType === EDITOR_TYPE__INLINE) {
|
|
901
1064
|
editor = buildFromColumnsConfig();
|
|
902
1065
|
// } else if (editorType === EDITOR_TYPE__PLAIN) {
|
|
903
1066
|
// formComponents = buildFromItems();
|
|
904
1067
|
// const formAncillaryComponents = buildAncillary();
|
|
905
1068
|
// editor = <>
|
|
906
|
-
// <
|
|
907
|
-
// <
|
|
1069
|
+
// <VStack className="p-4">{formComponents}</VStack>
|
|
1070
|
+
// <VStack className="pt-4">{formAncillaryComponents}</VStack>
|
|
908
1071
|
// </>;
|
|
909
1072
|
} else {
|
|
910
1073
|
formComponents = buildFromItems();
|
|
911
1074
|
const formAncillaryComponents = buildAncillary();
|
|
912
1075
|
editor = <>
|
|
913
|
-
{containerWidth >=
|
|
914
|
-
{containerWidth <
|
|
915
|
-
<
|
|
1076
|
+
{containerWidth >= styles.FORM_ONE_COLUMN_THRESHOLD ? <HStack className="Form-formComponents-HStack p-4 gap-4 justify-center">{formComponents}</HStack> : null}
|
|
1077
|
+
{containerWidth < styles.FORM_ONE_COLUMN_THRESHOLD ? <VStack className="Form-formComponents-VStack p-4">{formComponents}</VStack> : null}
|
|
1078
|
+
<VStack className="Form-AncillaryComponents m-2 pt-4 px-2">{formAncillaryComponents}</VStack>
|
|
916
1079
|
</>;
|
|
917
1080
|
|
|
918
1081
|
additionalButtons = buildAdditionalButtons(additionalEditButtons);
|
|
@@ -921,35 +1084,49 @@ function Form(props) {
|
|
|
921
1084
|
isSingle && editorMode === EDITOR_MODE__EDIT &&
|
|
922
1085
|
(onBack || (onViewMode && !disableView))) {
|
|
923
1086
|
modeHeader = <Toolbar>
|
|
924
|
-
<
|
|
1087
|
+
<HStack className="flex-1 items-center">
|
|
925
1088
|
{onBack &&
|
|
926
1089
|
<Button
|
|
927
1090
|
{...testProps('backBtn')}
|
|
928
1091
|
key="backBtn"
|
|
929
1092
|
onPress={onBack}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1093
|
+
icon={AngleLeft}
|
|
1094
|
+
_icon={{
|
|
1095
|
+
size: 'sm',
|
|
1096
|
+
className: 'text-white',
|
|
1097
|
+
}}
|
|
1098
|
+
className={`
|
|
1099
|
+
mr-4
|
|
1100
|
+
`}
|
|
1101
|
+
text="Back"
|
|
1102
|
+
/>}
|
|
1103
|
+
<Text className="text-[20px] ml-1 text-grey-500">Edit Mode</Text>
|
|
1104
|
+
</HStack>
|
|
936
1105
|
{onViewMode && !disableView && (!canUser || canUser(VIEW)) &&
|
|
937
1106
|
<Button
|
|
938
1107
|
{...testProps('toViewBtn')}
|
|
939
1108
|
key="viewBtn"
|
|
940
1109
|
onPress={onViewMode}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1110
|
+
icon={Eye}
|
|
1111
|
+
_icon={{
|
|
1112
|
+
size: 'sm',
|
|
1113
|
+
className: 'text-white',
|
|
1114
|
+
}}
|
|
1115
|
+
text="To View"
|
|
1116
|
+
tooltip="Switch to View Mode"
|
|
1117
|
+
/>}
|
|
944
1118
|
</Toolbar>;
|
|
945
1119
|
}
|
|
946
1120
|
if (editorMode === EDITOR_MODE__EDIT && !_.isEmpty(additionalButtons)) {
|
|
947
|
-
formButtons.push(<Toolbar key="additionalButtonsToolbar"
|
|
1121
|
+
formButtons.push(<Toolbar key="additionalButtonsToolbar" className="justify-end flex-wrap">
|
|
948
1122
|
{additionalButtons}
|
|
949
1123
|
</Toolbar>)
|
|
950
1124
|
}
|
|
951
1125
|
}
|
|
952
1126
|
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
// create footer
|
|
953
1130
|
if (!formState.isValid) {
|
|
954
1131
|
isSaveDisabled = true;
|
|
955
1132
|
isSubmitDisabled = true;
|
|
@@ -957,25 +1134,10 @@ function Form(props) {
|
|
|
957
1134
|
if (_.isEmpty(formState.dirtyFields) && !isPhantom) {
|
|
958
1135
|
isSaveDisabled = true;
|
|
959
1136
|
}
|
|
960
|
-
|
|
961
|
-
if (editorType === EDITOR_TYPE__INLINE) {
|
|
962
|
-
footerProps.position = 'sticky';
|
|
963
|
-
footerProps.alignSelf = 'flex-start';
|
|
964
|
-
footerProps.justifyContent = 'center';
|
|
965
|
-
footerProps.top = '100px';
|
|
966
|
-
footerProps.left = '20px';
|
|
967
|
-
footerProps.width = '200px';
|
|
968
|
-
footerProps.bg = 'primary.100';
|
|
969
|
-
footerProps.p = 0;
|
|
970
|
-
footerProps.px = 4;
|
|
971
|
-
footerProps.py = 2;
|
|
972
|
-
footerProps.borderBottomRadius = 5;
|
|
973
|
-
}
|
|
974
|
-
|
|
975
1137
|
if (onDelete && editorMode === EDITOR_MODE__EDIT && isSingle) {
|
|
976
1138
|
showDeleteBtn = true;
|
|
977
1139
|
}
|
|
978
|
-
if (!isEditorViewOnly) {
|
|
1140
|
+
if (!isEditorViewOnly && !hideResetButton) {
|
|
979
1141
|
showResetBtn = true;
|
|
980
1142
|
}
|
|
981
1143
|
if (editorType !== EDITOR_TYPE__SIDE) { // side editor won't show either close or cancel buttons!
|
|
@@ -1004,105 +1166,166 @@ function Form(props) {
|
|
|
1004
1166
|
if (!!onSubmit) {
|
|
1005
1167
|
showSubmitBtn = true;
|
|
1006
1168
|
}
|
|
1007
|
-
|
|
1169
|
+
footerButtons =
|
|
1170
|
+
<>
|
|
1171
|
+
{onDelete && editorMode === EDITOR_MODE__EDIT && isSingle &&
|
|
1172
|
+
|
|
1173
|
+
<HStack className="flex-1 justify-start">
|
|
1174
|
+
<Button
|
|
1175
|
+
{...testProps('deleteBtn')}
|
|
1176
|
+
key="deleteBtn"
|
|
1177
|
+
onPress={onDelete}
|
|
1178
|
+
className={`
|
|
1179
|
+
bg-warning-500
|
|
1180
|
+
hover:bg-warning-700
|
|
1181
|
+
text-white
|
|
1182
|
+
`}
|
|
1183
|
+
text="Delete"
|
|
1184
|
+
/>
|
|
1185
|
+
</HStack>}
|
|
1186
|
+
|
|
1187
|
+
{showResetBtn &&
|
|
1188
|
+
<IconButton
|
|
1189
|
+
{...testProps('resetBtn')}
|
|
1190
|
+
key="resetBtn"
|
|
1191
|
+
onPress={() => doReset()}
|
|
1192
|
+
icon={Rotate}
|
|
1193
|
+
className="mr-2"
|
|
1194
|
+
isDisabled={!formState.isDirty}
|
|
1195
|
+
/>}
|
|
1196
|
+
|
|
1197
|
+
{showCancelBtn &&
|
|
1198
|
+
<Button
|
|
1199
|
+
{...testProps('cancelBtn')}
|
|
1200
|
+
key="cancelBtn"
|
|
1201
|
+
variant="outline"
|
|
1202
|
+
onPress={onCancel}
|
|
1203
|
+
className="text-white mr-2"
|
|
1204
|
+
text="Cancel"
|
|
1205
|
+
/>}
|
|
1206
|
+
|
|
1207
|
+
{showCloseBtn &&
|
|
1208
|
+
<Button
|
|
1209
|
+
{...testProps('closeBtn')}
|
|
1210
|
+
key="closeBtn"
|
|
1211
|
+
variant="outline"
|
|
1212
|
+
onPress={onClose}
|
|
1213
|
+
className="text-white mr-2"
|
|
1214
|
+
text="Close"
|
|
1215
|
+
/>}
|
|
1216
|
+
|
|
1217
|
+
{showSaveBtn &&
|
|
1218
|
+
<Button
|
|
1219
|
+
{...testProps('saveBtn')}
|
|
1220
|
+
key="saveBtn"
|
|
1221
|
+
onPress={(e) => handleSubmit(onSaveDecorated, onSubmitError)(e)}
|
|
1222
|
+
isDisabled={isSaveDisabled}
|
|
1223
|
+
className="text-white"
|
|
1224
|
+
text={editorMode === EDITOR_MODE__ADD ? 'Add' : 'Save'}
|
|
1225
|
+
/>}
|
|
1226
|
+
|
|
1227
|
+
{showSubmitBtn &&
|
|
1228
|
+
<Button
|
|
1229
|
+
{...testProps('submitBtn')}
|
|
1230
|
+
key="submitBtn"
|
|
1231
|
+
onPress={(e) => handleSubmit(onSubmitDecorated, onSubmitError)(e)}
|
|
1232
|
+
isDisabled={isSubmitDisabled}
|
|
1233
|
+
className="text-white"
|
|
1234
|
+
text={submitBtnLabel || 'Submit'}
|
|
1235
|
+
/>}
|
|
1236
|
+
|
|
1237
|
+
{additionalFooterButtons && _.map(additionalFooterButtons, (props) => {
|
|
1238
|
+
return <Button
|
|
1239
|
+
{...testProps('additionalFooterBtn-' + props.key)}
|
|
1240
|
+
{...props}
|
|
1241
|
+
onPress={(e) => handleSubmit(props.onPress, onSubmitError)(e)}
|
|
1242
|
+
text={props.text}
|
|
1243
|
+
/>;
|
|
1244
|
+
})}
|
|
1245
|
+
</>;
|
|
1246
|
+
|
|
1247
|
+
if (editorType === EDITOR_TYPE__INLINE) {
|
|
1248
|
+
footer =
|
|
1249
|
+
<Box
|
|
1250
|
+
className={`
|
|
1251
|
+
Form-inlineFooter-container
|
|
1252
|
+
relative
|
|
1253
|
+
w-full
|
|
1254
|
+
`}
|
|
1255
|
+
>
|
|
1256
|
+
<HStack
|
|
1257
|
+
className={`
|
|
1258
|
+
Form-inlineFooter
|
|
1259
|
+
absolute
|
|
1260
|
+
top-[9px]
|
|
1261
|
+
left-[100px]
|
|
1262
|
+
w-[100px]
|
|
1263
|
+
min-w-[300px]
|
|
1264
|
+
py-2
|
|
1265
|
+
justify-center
|
|
1266
|
+
items-center
|
|
1267
|
+
rounded-b-lg
|
|
1268
|
+
bg-red-500
|
|
1269
|
+
${styles.GRID_INLINE_EDITOR_BG}
|
|
1270
|
+
`}
|
|
1271
|
+
>{footerButtons}</HStack>
|
|
1272
|
+
</Box>;
|
|
1273
|
+
} else {
|
|
1274
|
+
if (!disableFooter) {
|
|
1275
|
+
let footerClassName = '';
|
|
1276
|
+
footerClassName += ' justify-end';
|
|
1277
|
+
if (editorType === EDITOR_TYPE__INLINE) {
|
|
1278
|
+
footerClassName += `
|
|
1279
|
+
sticky
|
|
1280
|
+
self-start
|
|
1281
|
+
justify-center
|
|
1282
|
+
bg-primary-100
|
|
1283
|
+
rounded-b-lg
|
|
1284
|
+
`;
|
|
1285
|
+
}
|
|
1286
|
+
if (isSaving) {
|
|
1287
|
+
footerClassName += ' border-t-2 border-t-[#f00]'
|
|
1288
|
+
}
|
|
1289
|
+
footer = <Footer className={footerClassName} {...footerProps}>
|
|
1290
|
+
{footerButtons}
|
|
1291
|
+
</Footer>;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
} // END if (containerWidth)
|
|
1008
1296
|
|
|
1009
|
-
|
|
1297
|
+
let className = props.className || '';
|
|
1298
|
+
className += ' Form-VStackNative';
|
|
1299
|
+
return <VStackNative
|
|
1300
|
+
ref={formRef}
|
|
1301
|
+
{...testProps(self)}
|
|
1302
|
+
style={style}
|
|
1303
|
+
onLayout={onLayoutDecorated}
|
|
1304
|
+
className={className}
|
|
1305
|
+
>
|
|
1010
1306
|
{!!containerWidth && <>
|
|
1011
1307
|
{editorType === EDITOR_TYPE__INLINE &&
|
|
1012
|
-
|
|
1013
|
-
display="inline-block"
|
|
1014
|
-
flex={1}
|
|
1015
|
-
bg="#fff"
|
|
1016
|
-
py={1}
|
|
1017
|
-
borderTopWidth={3}
|
|
1018
|
-
borderBottomWidth={5}
|
|
1019
|
-
borderTopColor="primary.100"
|
|
1020
|
-
borderBottomColor="primary.100"
|
|
1021
|
-
>{editor}</Row>}
|
|
1308
|
+
editor}
|
|
1022
1309
|
{editorType !== EDITOR_TYPE__INLINE &&
|
|
1023
|
-
<ScrollView
|
|
1310
|
+
<ScrollView
|
|
1311
|
+
className={`
|
|
1312
|
+
ScrollView
|
|
1313
|
+
w-full
|
|
1314
|
+
flex-1
|
|
1315
|
+
pb-1
|
|
1316
|
+
web:min-h-[${minHeight}px]
|
|
1317
|
+
`}
|
|
1318
|
+
>
|
|
1024
1319
|
{modeHeader}
|
|
1025
1320
|
{formHeader}
|
|
1026
1321
|
{formButtons}
|
|
1027
1322
|
{editor}
|
|
1028
1323
|
</ScrollView>}
|
|
1029
|
-
|
|
1030
|
-
{!disableFooter &&
|
|
1031
|
-
<Footer justifyContent="flex-end" {...footerProps} {...savingProps}>
|
|
1032
|
-
{onDelete && editorMode === EDITOR_MODE__EDIT && isSingle &&
|
|
1033
|
-
|
|
1034
|
-
<Row flex={1} justifyContent="flex-start">
|
|
1035
|
-
<Button
|
|
1036
|
-
{...testProps('deleteBtn')}
|
|
1037
|
-
key="deleteBtn"
|
|
1038
|
-
onPress={onDelete}
|
|
1039
|
-
bg="warning"
|
|
1040
|
-
_hover={{
|
|
1041
|
-
bg: 'warningHover',
|
|
1042
|
-
}}
|
|
1043
|
-
color="#fff"
|
|
1044
|
-
>Delete</Button>
|
|
1045
|
-
</Row>}
|
|
1046
1324
|
|
|
1047
|
-
|
|
1048
|
-
<IconButton
|
|
1049
|
-
{...testProps('resetBtn')}
|
|
1050
|
-
key="resetBtn"
|
|
1051
|
-
onPress={() => doReset()}
|
|
1052
|
-
icon={Rotate}
|
|
1053
|
-
_icon={{
|
|
1054
|
-
color: !formState.isDirty ? 'trueGray.400' : '#000',
|
|
1055
|
-
}}
|
|
1056
|
-
isDisabled={!formState.isDirty}
|
|
1057
|
-
mr={2}
|
|
1058
|
-
/>}
|
|
1325
|
+
{footer}
|
|
1059
1326
|
|
|
1060
|
-
{showCancelBtn &&
|
|
1061
|
-
<Button
|
|
1062
|
-
{...testProps('cancelBtn')}
|
|
1063
|
-
key="cancelBtn"
|
|
1064
|
-
variant="ghost"
|
|
1065
|
-
onPress={onCancel}
|
|
1066
|
-
color="#fff"
|
|
1067
|
-
>Cancel</Button>}
|
|
1068
|
-
|
|
1069
|
-
{showCloseBtn &&
|
|
1070
|
-
<Button
|
|
1071
|
-
{...testProps('closeBtn')}
|
|
1072
|
-
key="closeBtn"
|
|
1073
|
-
variant="ghost"
|
|
1074
|
-
onPress={onClose}
|
|
1075
|
-
color="#fff"
|
|
1076
|
-
>Close</Button>}
|
|
1077
|
-
|
|
1078
|
-
{showSaveBtn &&
|
|
1079
|
-
<Button
|
|
1080
|
-
{...testProps('saveBtn')}
|
|
1081
|
-
key="saveBtn"
|
|
1082
|
-
onPress={(e) => handleSubmit(onSaveDecorated, onSubmitError)(e)}
|
|
1083
|
-
isDisabled={isSaveDisabled}
|
|
1084
|
-
color="#fff"
|
|
1085
|
-
>{editorMode === EDITOR_MODE__ADD ? 'Add' : 'Save'}</Button>}
|
|
1086
|
-
|
|
1087
|
-
{showSubmitBtn &&
|
|
1088
|
-
<Button
|
|
1089
|
-
{...testProps('submitBtn')}
|
|
1090
|
-
key="submitBtn"
|
|
1091
|
-
onPress={(e) => handleSubmit(onSubmitDecorated, onSubmitError)(e)}
|
|
1092
|
-
isDisabled={isSubmitDisabled}
|
|
1093
|
-
color="#fff"
|
|
1094
|
-
>{submitBtnLabel || 'Submit'}</Button>}
|
|
1095
|
-
|
|
1096
|
-
{additionalFooterButtons && _.map(additionalFooterButtons, (props) => {
|
|
1097
|
-
return <Button
|
|
1098
|
-
{...testProps('additionalFooterBtn-' + props.key)}
|
|
1099
|
-
{...props}
|
|
1100
|
-
onPress={(e) => handleSubmit(props.onPress, onSubmitError)(e)}
|
|
1101
|
-
>{props.text}</Button>;
|
|
1102
|
-
})}
|
|
1103
|
-
</Footer>}
|
|
1104
1327
|
</>}
|
|
1105
|
-
</
|
|
1328
|
+
</VStackNative>;
|
|
1106
1329
|
}
|
|
1107
1330
|
|
|
1108
1331
|
// helper fns
|
|
@@ -1149,6 +1372,6 @@ function getNullFieldValues(initialValues, Repository) {
|
|
|
1149
1372
|
return ret;
|
|
1150
1373
|
}
|
|
1151
1374
|
|
|
1152
|
-
export const FormEditor = withComponent(withAlert(withEditor(
|
|
1375
|
+
export const FormEditor = withComponent(withAlert(withEditor(Form)));
|
|
1153
1376
|
|
|
1154
|
-
export default withComponent(withAlert(
|
|
1377
|
+
export default withComponent(withAlert(Form));
|