@onehat/ui 0.1.2 → 0.2.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/ckeditor5/LICENSE.md +49 -0
- package/ckeditor5/README.md +68 -0
- package/ckeditor5/build/ckeditor.js +6 -0
- package/ckeditor5/build/ckeditor.js.map +1 -0
- package/ckeditor5/build/translations/af.js +1 -0
- package/ckeditor5/build/translations/ar.js +1 -0
- package/ckeditor5/build/translations/ast.js +1 -0
- package/ckeditor5/build/translations/az.js +1 -0
- package/ckeditor5/build/translations/bg.js +1 -0
- package/ckeditor5/build/translations/bn.js +1 -0
- package/ckeditor5/build/translations/bs.js +1 -0
- package/ckeditor5/build/translations/ca.js +1 -0
- package/ckeditor5/build/translations/cs.js +1 -0
- package/ckeditor5/build/translations/da.js +1 -0
- package/ckeditor5/build/translations/de-ch.js +1 -0
- package/ckeditor5/build/translations/de.js +1 -0
- package/ckeditor5/build/translations/el.js +1 -0
- package/ckeditor5/build/translations/en-au.js +1 -0
- package/ckeditor5/build/translations/en-gb.js +1 -0
- package/ckeditor5/build/translations/eo.js +1 -0
- package/ckeditor5/build/translations/es-co.js +1 -0
- package/ckeditor5/build/translations/es.js +1 -0
- package/ckeditor5/build/translations/et.js +1 -0
- package/ckeditor5/build/translations/eu.js +1 -0
- package/ckeditor5/build/translations/fa.js +1 -0
- package/ckeditor5/build/translations/fi.js +1 -0
- package/ckeditor5/build/translations/fr.js +1 -0
- package/ckeditor5/build/translations/gl.js +1 -0
- package/ckeditor5/build/translations/gu.js +1 -0
- package/ckeditor5/build/translations/he.js +1 -0
- package/ckeditor5/build/translations/hi.js +1 -0
- package/ckeditor5/build/translations/hr.js +1 -0
- package/ckeditor5/build/translations/hu.js +1 -0
- package/ckeditor5/build/translations/id.js +1 -0
- package/ckeditor5/build/translations/it.js +1 -0
- package/ckeditor5/build/translations/ja.js +1 -0
- package/ckeditor5/build/translations/jv.js +1 -0
- package/ckeditor5/build/translations/kk.js +1 -0
- package/ckeditor5/build/translations/km.js +1 -0
- package/ckeditor5/build/translations/kn.js +1 -0
- package/ckeditor5/build/translations/ko.js +1 -0
- package/ckeditor5/build/translations/ku.js +1 -0
- package/ckeditor5/build/translations/lt.js +1 -0
- package/ckeditor5/build/translations/lv.js +1 -0
- package/ckeditor5/build/translations/ms.js +1 -0
- package/ckeditor5/build/translations/nb.js +1 -0
- package/ckeditor5/build/translations/ne.js +1 -0
- package/ckeditor5/build/translations/nl.js +1 -0
- package/ckeditor5/build/translations/no.js +1 -0
- package/ckeditor5/build/translations/oc.js +1 -0
- package/ckeditor5/build/translations/pl.js +1 -0
- package/ckeditor5/build/translations/pt-br.js +1 -0
- package/ckeditor5/build/translations/pt.js +1 -0
- package/ckeditor5/build/translations/ro.js +1 -0
- package/ckeditor5/build/translations/ru.js +1 -0
- package/ckeditor5/build/translations/si.js +1 -0
- package/ckeditor5/build/translations/sk.js +1 -0
- package/ckeditor5/build/translations/sl.js +1 -0
- package/ckeditor5/build/translations/sq.js +1 -0
- package/ckeditor5/build/translations/sr-latn.js +1 -0
- package/ckeditor5/build/translations/sr.js +1 -0
- package/ckeditor5/build/translations/sv.js +1 -0
- package/ckeditor5/build/translations/th.js +1 -0
- package/ckeditor5/build/translations/tk.js +1 -0
- package/ckeditor5/build/translations/tr.js +1 -0
- package/ckeditor5/build/translations/tt.js +1 -0
- package/ckeditor5/build/translations/ug.js +1 -0
- package/ckeditor5/build/translations/uk.js +1 -0
- package/ckeditor5/build/translations/ur.js +1 -0
- package/ckeditor5/build/translations/uz.js +1 -0
- package/ckeditor5/build/translations/vi.js +1 -0
- package/ckeditor5/build/translations/zh-cn.js +1 -0
- package/ckeditor5/build/translations/zh.js +1 -0
- package/ckeditor5/package.json +46 -0
- package/ckeditor5/sample/index.html +130 -0
- package/ckeditor5/sample/styles.css +496 -0
- package/ckeditor5/src/ckeditor.js +138 -0
- package/ckeditor5/webpack.config.js +96 -0
- package/package.json +19 -23
- package/src/Components/Accordion/Accordion.js +144 -0
- package/src/Components/Blank.js +14 -0
- package/src/Components/Buttons/BackButton.js +16 -0
- package/src/Components/Buttons/CartButtonWithBadge.js +25 -0
- package/src/Components/Buttons/IconButton.js +42 -0
- package/src/Components/Container/Container.js +178 -0
- package/src/Components/Container/Splitter.js +61 -0
- package/src/Components/Filter/DateRange.js +99 -0
- package/src/Components/Filter/NumberRange.js +96 -0
- package/src/Components/Form/Field/CKEditor/CKEditor.js +62 -0
- package/src/Components/Form/Field/CKEditor/styles.css +503 -0
- package/src/Components/Form/Field/CKEditor.js +12 -0
- package/src/Components/Form/Field/CheckboxGroup/ArrayCheckboxGroup.js +13 -0
- package/src/Components/Form/Field/CheckboxGroup/CheckboxGroup.js +61 -0
- package/src/Components/Form/Field/Color.js +226 -0
- package/src/Components/Form/Field/Combo/ArrayCombo.js +15 -0
- package/src/Components/Form/Field/Combo/BooleanCombo.js +23 -0
- package/src/Components/Form/Field/Combo/Combo.js +504 -0
- package/src/Components/Form/Field/Combo/ComboEditor.js +22 -0
- package/src/Components/Form/Field/Combo/IntervalsCombo.js +18 -0
- package/src/Components/Form/Field/Combo/MonthsCombo.js +24 -0
- package/src/Components/Form/Field/Combo/PageSizeCombo.js +38 -0
- package/src/Components/Form/Field/Combo/Tag.js +12 -0
- package/src/Components/Form/Field/Combo/TimezonesCombo.js +432 -0
- package/src/Components/Form/Field/Combo/YearsCombo.js +35 -0
- package/src/Components/Form/Field/Date.js +370 -0
- package/src/Components/Form/Field/DisplayField.js +28 -0
- package/src/Components/Form/Field/Field.js +14 -0
- package/src/Components/Form/Field/File.js +218 -0
- package/src/Components/Form/Field/Input.js +96 -0
- package/src/Components/Form/Field/Number.js +151 -0
- package/src/Components/Form/Field/RadioGroup/ArrayRadioGroup.js +13 -0
- package/src/Components/Form/Field/RadioGroup/RadioGroup.js +62 -0
- package/src/Components/Form/Field/Tag.js +11 -0
- package/src/Components/Form/Field/Text.js +28 -0
- package/src/Components/Form/Field/TextArea.js +26 -0
- package/src/Components/Form/Field/Toggle.js +39 -0
- package/src/Components/Form/Field/datetime.css +5 -0
- package/src/Components/Form/FieldSet.js +64 -0
- package/src/Components/Form/FiltersForm.js +66 -0
- package/src/Components/Form/Form.js +535 -0
- package/src/Components/Form/Label.js +24 -0
- package/src/Components/Grid/Grid.js +877 -0
- package/src/Components/Grid/GridHeaderRow.js +455 -0
- package/src/Components/Grid/GridRow.js +134 -0
- package/src/Components/Grid/HeaderReorderHandle.js +29 -0
- package/src/Components/Grid/HeaderResizeHandle.js +29 -0
- package/src/Components/Grid/NoRecordsFound.js +43 -0
- package/src/Components/Grid/ReactGrid.js +468 -0
- package/src/Components/Grid/SenchaGrid.js +421 -0
- package/src/Components/Grid/reactgrid.css +6 -0
- package/src/Components/Hoc/withAlert.js +176 -0
- package/src/Components/Hoc/withBlank.js +12 -0
- package/src/Components/Hoc/withCollapsible.js +20 -0
- package/src/Components/Hoc/withContextMenu.js +127 -0
- package/src/Components/Hoc/withData.js +85 -0
- package/src/Components/Hoc/withDraggable.js +259 -0
- package/src/Components/Hoc/withEditor.js +160 -0
- package/src/Components/Hoc/withEvents.js +12 -0
- package/src/Components/Hoc/withFilters.js +456 -0
- package/src/Components/Hoc/withInlineEditor.js +119 -0
- package/src/Components/Hoc/withMultiSelection.js +16 -0
- package/src/Components/Hoc/withPresetButtons.js +239 -0
- package/src/Components/Hoc/withSelection.js +332 -0
- package/src/Components/Hoc/withTooltip.js +21 -0
- package/src/Components/Hoc/withValue.js +87 -0
- package/src/Components/Hoc/withWindowedEditor.js +51 -0
- package/src/Components/Icons/AddressBook.js +14 -0
- package/src/Components/Icons/Alt.js +17 -0
- package/src/Components/Icons/AngleLeft.js +18 -0
- package/src/Components/Icons/AngleRight.js +18 -0
- package/src/Components/Icons/AnglesLeft.js +18 -0
- package/src/Components/Icons/AnglesRight.js +18 -0
- package/src/Components/Icons/Asterisk.js +14 -0
- package/src/Components/Icons/Ban.js +18 -0
- package/src/Components/Icons/Bars.js +14 -0
- package/src/Components/Icons/BigCircle.js +17 -0
- package/src/Components/Icons/Book.js +14 -0
- package/src/Components/Icons/BookOpen.js +14 -0
- package/src/Components/Icons/Bug.js +14 -0
- package/src/Components/Icons/Building.js +14 -0
- package/src/Components/Icons/Calendar.js +18 -0
- package/src/Components/Icons/Calendar2.js +18 -0
- package/src/Components/Icons/CalendarDays.js +18 -0
- package/src/Components/Icons/Camera.js +18 -0
- package/src/Components/Icons/CaretDown.js +18 -0
- package/src/Components/Icons/CaretUp.js +18 -0
- package/src/Components/Icons/CartPlus.js +14 -0
- package/src/Components/Icons/CartShopping.js +14 -0
- package/src/Components/Icons/CashRegister.js +14 -0
- package/src/Components/Icons/ChartLine.js +14 -0
- package/src/Components/Icons/Check.js +14 -0
- package/src/Components/Icons/CheckDouble.js +14 -0
- package/src/Components/Icons/ChevronDown.js +14 -0
- package/src/Components/Icons/ChevronLeft.js +14 -0
- package/src/Components/Icons/ChevronRight.js +14 -0
- package/src/Components/Icons/ChevronUp.js +14 -0
- package/src/Components/Icons/CircleArrowRight.js +14 -0
- package/src/Components/Icons/CircleExclamation.js +18 -0
- package/src/Components/Icons/CircleInfo.js +14 -0
- package/src/Components/Icons/CircleQuestion.js +14 -0
- package/src/Components/Icons/CircleXmark.js +14 -0
- package/src/Components/Icons/CircleXmarkRegular.js +14 -0
- package/src/Components/Icons/Clipboard.js +18 -0
- package/src/Components/Icons/Clock.js +14 -0
- package/src/Components/Icons/ClockRegular.js +14 -0
- package/src/Components/Icons/ClockRotateLeft.js +14 -0
- package/src/Components/Icons/Clone.js +14 -0
- package/src/Components/Icons/Comment.js +14 -0
- package/src/Components/Icons/CommentRegular.js +14 -0
- package/src/Components/Icons/Comments.js +14 -0
- package/src/Components/Icons/CommentsRegular.js +14 -0
- package/src/Components/Icons/Copyright.js +14 -0
- package/src/Components/Icons/Duplicate.js +18 -0
- package/src/Components/Icons/Edit.js +18 -0
- package/src/Components/Icons/EllipsisVertical.js +18 -0
- package/src/Components/Icons/Envelope.js +14 -0
- package/src/Components/Icons/EnvelopeRegular.js +14 -0
- package/src/Components/Icons/Exclamation.js +14 -0
- package/src/Components/Icons/Expand.js +14 -0
- package/src/Components/Icons/Eye.js +18 -0
- package/src/Components/Icons/File.js +18 -0
- package/src/Components/Icons/FloppyDiskRegular.js +14 -0
- package/src/Components/Icons/Gear.js +18 -0
- package/src/Components/Icons/Gift.js +14 -0
- package/src/Components/Icons/Grip.js +18 -0
- package/src/Components/Icons/GripLines.js +18 -0
- package/src/Components/Icons/GripLinesVertical.js +18 -0
- package/src/Components/Icons/GripVertical.js +18 -0
- package/src/Components/Icons/Hammer.js +14 -0
- package/src/Components/Icons/Hand.js +14 -0
- package/src/Components/Icons/House.js +14 -0
- package/src/Components/Icons/Info.js +14 -0
- package/src/Components/Icons/ItunesNote.js +14 -0
- package/src/Components/Icons/List.js +14 -0
- package/src/Components/Icons/ListCheck.js +14 -0
- package/src/Components/Icons/LocationDot.js +14 -0
- package/src/Components/Icons/Loop.js +17 -0
- package/src/Components/Icons/Loop1.js +18 -0
- package/src/Components/Icons/LoopAll.js +18 -0
- package/src/Components/Icons/Maximize.js +14 -0
- package/src/Components/Icons/Microphone.js +14 -0
- package/src/Components/Icons/Minimize.js +14 -0
- package/src/Components/Icons/Minus.js +18 -0
- package/src/Components/Icons/MobileScreenButton.js +14 -0
- package/src/Components/Icons/MoneyBill.js +14 -0
- package/src/Components/Icons/MoneyBillWave.js +14 -0
- package/src/Components/Icons/Mouth.js +24 -0
- package/src/Components/Icons/Music.js +14 -0
- package/src/Components/Icons/NoLoop.js +24 -0
- package/src/Components/Icons/NoReorderRows.js +25 -0
- package/src/Components/Icons/ObjectGroupRegular.js +14 -0
- package/src/Components/Icons/Pause.js +14 -0
- package/src/Components/Icons/Pencil.js +18 -0
- package/src/Components/Icons/Phone.js +14 -0
- package/src/Components/Icons/Play.js +14 -0
- package/src/Components/Icons/Plus.js +18 -0
- package/src/Components/Icons/Presentation.js +19 -0
- package/src/Components/Icons/Print.js +18 -0
- package/src/Components/Icons/Question.js +14 -0
- package/src/Components/Icons/Rate-.25x.js +20 -0
- package/src/Components/Icons/Rate-.5x.js +19 -0
- package/src/Components/Icons/Rate-.75x.js +19 -0
- package/src/Components/Icons/Rate-1.25x.js +20 -0
- package/src/Components/Icons/Rate-1.5x.js +19 -0
- package/src/Components/Icons/Rate-1.75x.js +19 -0
- package/src/Components/Icons/Rate-1x.js +19 -0
- package/src/Components/Icons/Rate-2x.js +19 -0
- package/src/Components/Icons/RateIcon-.25x.js +20 -0
- package/src/Components/Icons/RateIcon-.5x.js +19 -0
- package/src/Components/Icons/RateIcon-.75x.js +19 -0
- package/src/Components/Icons/RateIcon-1.25x.js +20 -0
- package/src/Components/Icons/RateIcon-1.5x.js +19 -0
- package/src/Components/Icons/RateIcon-1.75x.js +19 -0
- package/src/Components/Icons/RateIcon-1x.js +19 -0
- package/src/Components/Icons/RateIcon-2x.js +19 -0
- package/src/Components/Icons/RectangleXmark.js +14 -0
- package/src/Components/Icons/RectangleXmarkRegular.js +14 -0
- package/src/Components/Icons/ReorderRows.js +21 -0
- package/src/Components/Icons/RightFromBracket.js +14 -0
- package/src/Components/Icons/RightToBracket.js +14 -0
- package/src/Components/Icons/Rotate.js +18 -0
- package/src/Components/Icons/RotateLeft.js +14 -0
- package/src/Components/Icons/RotateRight.js +18 -0
- package/src/Components/Icons/ScrewdriverWrench.js +14 -0
- package/src/Components/Icons/Scroll.js +14 -0
- package/src/Components/Icons/Share.js +14 -0
- package/src/Components/Icons/Shop.js +14 -0
- package/src/Components/Icons/SortDown.js +18 -0
- package/src/Components/Icons/SortUp.js +18 -0
- package/src/Components/Icons/Square.js +14 -0
- package/src/Components/Icons/SquareCheck.js +14 -0
- package/src/Components/Icons/SquareCheckRegular.js +14 -0
- package/src/Components/Icons/SquareMinus.js +18 -0
- package/src/Components/Icons/SquareRegular.js +14 -0
- package/src/Components/Icons/Store.js +14 -0
- package/src/Components/Icons/ThumbsDown.js +14 -0
- package/src/Components/Icons/ThumbsDownRegular.js +14 -0
- package/src/Components/Icons/ThumbsUp.js +14 -0
- package/src/Components/Icons/ThumbsUpRegular.js +14 -0
- package/src/Components/Icons/Trash.js +18 -0
- package/src/Components/Icons/TrashCan.js +18 -0
- package/src/Components/Icons/TriangleExclamation.js +18 -0
- package/src/Components/Icons/Truck.js +14 -0
- package/src/Components/Icons/TruckFast.js +14 -0
- package/src/Components/Icons/User.js +14 -0
- package/src/Components/Icons/UserGroup.js +14 -0
- package/src/Components/Icons/UserSecret.js +14 -0
- package/src/Components/Icons/X.js +14 -0
- package/src/Components/Icons/Xmark.js +14 -0
- package/src/Components/Mask.js +11 -0
- package/src/Components/Messages/ConfirmationMessage.js +26 -0
- package/src/Components/Messages/ErrorMessage.js +15 -0
- package/src/Components/Messages/Loading.js +16 -0
- package/src/Components/Messages/OkMessage.js +24 -0
- package/src/Components/Messages/WaitMessage.js +18 -0
- package/src/Components/Panel/AccordionGridPanel.js +94 -0
- package/src/Components/Panel/Footer.js +20 -0
- package/src/Components/Panel/FormPanel.js +23 -0
- package/src/Components/Panel/GridPanel.js +45 -0
- package/src/Components/Panel/Header.js +107 -0
- package/src/Components/Panel/Panel.js +152 -0
- package/src/Components/Panel/TabPanel.js +331 -0
- package/src/Components/Panel/UploadDownload.js +10 -0
- package/src/Components/Picker/Picker.js +64 -0
- package/src/Components/ScreenContainer.js +71 -0
- package/src/Components/Screens/DataMgt.js +250 -0
- package/src/Components/Toolbar/FilterToolbar.js +20 -0
- package/src/Components/Toolbar/Pagination.js +146 -0
- package/src/Components/Toolbar/PaginationToolbar.js +22 -0
- package/src/Components/Toolbar/Toolbar.js +18 -0
- package/src/Components/WaitModal.js +31 -0
- package/src/Components/Window/Editor.js +19 -0
- package/src/Constants/Alert.js +3 -0
- package/src/Constants/Date.js +3 -0
- package/src/Constants/Directions.js +8 -0
- package/src/Constants/EditorTypes.js +4 -0
- package/src/Constants/File.js +2 -0
- package/src/Constants/Grid.js +4 -0
- package/src/Constants/Input.js +1 -0
- package/src/Constants/Selection.js +5 -0
- package/src/Constants/Styles.js +86 -0
- package/src/Constants/UiModes.js +2 -0
- package/src/Data/Hoc/withRedux.js +48 -0
- package/src/Data/useOneHatData.js +75 -0
- package/src/Functions/BankersRound.js +11 -0
- package/src/Functions/Timer.js +92 -0
- package/src/Functions/deleteSecure.js +6 -0
- package/src/Functions/emptyFn.js +1 -0
- package/src/Functions/getComponentFromType.js +106 -0
- package/src/Functions/getIsMobile.js +5 -0
- package/src/Functions/getPref.js +7 -0
- package/src/Functions/getSecure.js +21 -0
- package/src/Functions/getTokenHeaders.js +13 -0
- package/src/Functions/inArray.js +5 -0
- package/src/Functions/isJson.js +8 -0
- package/src/Functions/processImage.js +16 -0
- package/src/Functions/setPref.js +14 -0
- package/src/Functions/setProgress.js +49 -0
- package/src/Functions/setSecure.js +35 -0
- package/src/Functions/setUiMode.js +5 -0
- package/src/Functions/sleep.js +3 -0
- package/src/Functions/testProps.js +24 -0
- package/src/Functions/trackEngagementHit.js +11 -0
- package/src/Functions/verifyCompleted.js +18 -0
- package/src/Functions/waitFor.js +16 -0
- package/src/Hooks/useAppState.js +34 -0
- package/src/Hooks/useAsync.js +13 -0
- package/src/Hooks/useBlocking.js +18 -0
- package/src/Hooks/useCameraRoll.js +41 -0
- package/src/Hooks/useForceUpdate.js +14 -0
- package/src/Hooks/useIsMounted.js +14 -0
- package/src/Hooks/useNotifications.js +279 -0
- package/src/Styles/StyleSheets.js +14 -0
- package/src/Styles/ThemeOverrides.js +264 -0
- package/src/UiConfig.js +19 -0
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { useState, useEffect, useMemo, } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Icon,
|
|
4
|
+
Pressable,
|
|
5
|
+
Row,
|
|
6
|
+
Text,
|
|
7
|
+
} from 'native-base';
|
|
8
|
+
import {
|
|
9
|
+
SORT_ASCENDING,
|
|
10
|
+
SORT_DESCENDING,
|
|
11
|
+
} from '../../Constants/Grid';
|
|
12
|
+
import {
|
|
13
|
+
HORIZONTAL,
|
|
14
|
+
} from '../../Constants/Directions';
|
|
15
|
+
import {
|
|
16
|
+
UI_MODE_WEB,
|
|
17
|
+
} from '../../Constants/UiModes';
|
|
18
|
+
import UiConfig from '../../UiConfig';
|
|
19
|
+
import styles from '../../Constants/Styles';
|
|
20
|
+
import useBlocking from '../../Hooks/useBlocking';
|
|
21
|
+
import AngleRight from '../Icons/AngleRight';
|
|
22
|
+
import HeaderReorderHandle from './HeaderReorderHandle';
|
|
23
|
+
import HeaderResizeHandle from './HeaderResizeHandle';
|
|
24
|
+
import SortDown from '../Icons/SortDown';
|
|
25
|
+
import SortUp from '../Icons/SortUp';
|
|
26
|
+
import _ from 'lodash';
|
|
27
|
+
|
|
28
|
+
// This was broken out from Grid simply so we can memoize it
|
|
29
|
+
|
|
30
|
+
export default function GridHeaderRow(props) {
|
|
31
|
+
let {
|
|
32
|
+
canColumnsReorder,
|
|
33
|
+
canColumnsResize,
|
|
34
|
+
} = props;
|
|
35
|
+
const {
|
|
36
|
+
Repository,
|
|
37
|
+
columnsConfig,
|
|
38
|
+
setColumnsConfig,
|
|
39
|
+
hideNavColumn,
|
|
40
|
+
canColumnsSort,
|
|
41
|
+
setSelection,
|
|
42
|
+
gridRef,
|
|
43
|
+
isHovered,
|
|
44
|
+
} = props,
|
|
45
|
+
sortFn = Repository && Repository.getSortFn(),
|
|
46
|
+
sortField = Repository && Repository.getSortField(),
|
|
47
|
+
{ isBlocked } = useBlocking(),
|
|
48
|
+
[dragColumnSlot, setDragColumnSlot] = useState(null),
|
|
49
|
+
[isDragging, setIsDragging] = useState(false),
|
|
50
|
+
[isSortDirectionAsc, setIsSortDirectionAsc] = useState(Repository && Repository.getSortDirection() === SORT_ASCENDING),
|
|
51
|
+
[localColumnsConfig, setLocalColumnsConfig] = useState(columnsConfig),
|
|
52
|
+
onSort = (cellData, e) => {
|
|
53
|
+
if (!Repository) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let currentSortField = sortField,
|
|
57
|
+
selectedSortField = cellData.fieldName,
|
|
58
|
+
isCurrentSortDirectionAsc = isSortDirectionAsc;
|
|
59
|
+
if (selectedSortField !== currentSortField) {
|
|
60
|
+
// Change the field, sort Asc
|
|
61
|
+
currentSortField = selectedSortField
|
|
62
|
+
isCurrentSortDirectionAsc = true;
|
|
63
|
+
} else {
|
|
64
|
+
// Toggle direction
|
|
65
|
+
isCurrentSortDirectionAsc = !isCurrentSortDirectionAsc;
|
|
66
|
+
}
|
|
67
|
+
setIsSortDirectionAsc(isCurrentSortDirectionAsc);
|
|
68
|
+
|
|
69
|
+
// Change sorter on OneHatData
|
|
70
|
+
Repository.sort(currentSortField, isCurrentSortDirectionAsc ? SORT_ASCENDING : SORT_DESCENDING, sortFn);
|
|
71
|
+
|
|
72
|
+
// clear the selection
|
|
73
|
+
setSelection([]);
|
|
74
|
+
},
|
|
75
|
+
onHeaderMouseEnter = (e, ix) => {
|
|
76
|
+
if (isDragging) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const columnsConfig = _.clone(localColumnsConfig); // work with a copy, so that setter forces rerender
|
|
80
|
+
columnsConfig[ix].showDragHandles = true;
|
|
81
|
+
setLocalColumnsConfig(columnsConfig);
|
|
82
|
+
},
|
|
83
|
+
onHeaderMouseLeave = (e, ix) => {
|
|
84
|
+
if (isDragging) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const columnsConfig = _.clone(localColumnsConfig); // work with a copy, so that setter forces rerender
|
|
88
|
+
columnsConfig[ix].showDragHandles = false;
|
|
89
|
+
setLocalColumnsConfig(columnsConfig);
|
|
90
|
+
},
|
|
91
|
+
onColumnReorderDragStart = (info, e, proxy, node) => {
|
|
92
|
+
const
|
|
93
|
+
proxyRect = proxy.getBoundingClientRect(),
|
|
94
|
+
columnHeader = node.parentElement,
|
|
95
|
+
columnHeaders = _.filter(columnHeader.parentElement.children, (childNode) => {
|
|
96
|
+
return childNode.getBoundingClientRect().width !== 0; // Skip zero-width children
|
|
97
|
+
}),
|
|
98
|
+
currentX = proxyRect.left; // left position of pointer
|
|
99
|
+
|
|
100
|
+
// Figure out which index the user wants
|
|
101
|
+
let newIx = 0;
|
|
102
|
+
_.each(columnHeaders, (child, ix, all) => {
|
|
103
|
+
const
|
|
104
|
+
rect = child.getBoundingClientRect(), // rect of the columnHeader of this iteration
|
|
105
|
+
{
|
|
106
|
+
left,
|
|
107
|
+
right,
|
|
108
|
+
width,
|
|
109
|
+
} = rect,
|
|
110
|
+
halfWidth = width /2;
|
|
111
|
+
|
|
112
|
+
if (ix === 0) {
|
|
113
|
+
// first column
|
|
114
|
+
if (currentX < left + halfWidth) {
|
|
115
|
+
newIx = 0;
|
|
116
|
+
return false;
|
|
117
|
+
} else if (currentX < right) {
|
|
118
|
+
newIx = 1;
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
} else if (ix === all.length -1) {
|
|
122
|
+
// last column
|
|
123
|
+
if (currentX < left + halfWidth) {
|
|
124
|
+
newIx = ix;
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
newIx = ix +1;
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// all other columns
|
|
132
|
+
if (left <= currentX && currentX < left + halfWidth) {
|
|
133
|
+
newIx = ix;
|
|
134
|
+
return false;
|
|
135
|
+
} else if (currentX < right) {
|
|
136
|
+
newIx = ix +1;
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// Verify index can actually be used
|
|
142
|
+
if (typeof localColumnsConfig[newIx] === 'undefined' || !localColumnsConfig[newIx].reorderable) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Render marker showing destination location (can't use regular render cycle because this div is absolutely positioned on page)
|
|
147
|
+
const
|
|
148
|
+
columnHeaderRect = columnHeaders[newIx].getBoundingClientRect(),
|
|
149
|
+
left = columnHeaderRect.left,
|
|
150
|
+
gridRowsContainer = gridRef.current._listRef._scrollRef.childNodes[0],
|
|
151
|
+
gridRowsContainerRect = gridRowsContainer.getBoundingClientRect(),
|
|
152
|
+
marker = document.createElement('div');
|
|
153
|
+
|
|
154
|
+
marker.style.position = 'absolute';
|
|
155
|
+
marker.style.height = gridRowsContainerRect.height + columnHeaderRect.height + 'px';
|
|
156
|
+
marker.style.width = '4px';
|
|
157
|
+
marker.style.top = columnHeaderRect.top + 'px';
|
|
158
|
+
// marker.style.right = 0;
|
|
159
|
+
marker.style.backgroundColor = '#ccc';
|
|
160
|
+
|
|
161
|
+
document.body.appendChild(marker);
|
|
162
|
+
marker.style.left = left + 'px';
|
|
163
|
+
|
|
164
|
+
setDragColumnSlot({ ix: newIx, marker, });
|
|
165
|
+
},
|
|
166
|
+
onColumnReorderDrag = (info, e, proxy, node) => {
|
|
167
|
+
const
|
|
168
|
+
proxyRect = proxy.getBoundingClientRect(),
|
|
169
|
+
columnHeader = node.parentElement,
|
|
170
|
+
columnHeaders = _.filter(columnHeader.parentElement.children, (childNode) => {
|
|
171
|
+
return childNode.getBoundingClientRect().width !== 0; // Skip zero-width children
|
|
172
|
+
}),
|
|
173
|
+
currentX = proxyRect.left; // left position of pointer
|
|
174
|
+
|
|
175
|
+
// Figure out which index the user wants
|
|
176
|
+
let newIx = 0;
|
|
177
|
+
_.each(columnHeaders, (child, ix, all) => {
|
|
178
|
+
const
|
|
179
|
+
rect = child.getBoundingClientRect(), // rect of the columnHeader of this iteration
|
|
180
|
+
{
|
|
181
|
+
left,
|
|
182
|
+
right,
|
|
183
|
+
width,
|
|
184
|
+
} = rect,
|
|
185
|
+
halfWidth = width /2;
|
|
186
|
+
|
|
187
|
+
if (ix === 0) {
|
|
188
|
+
// first column
|
|
189
|
+
if (currentX < left + halfWidth) {
|
|
190
|
+
newIx = 0;
|
|
191
|
+
return false;
|
|
192
|
+
} else if (currentX < right) {
|
|
193
|
+
newIx = 1;
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
} else if (ix === all.length -1) {
|
|
197
|
+
// last column
|
|
198
|
+
if (currentX < left + halfWidth) {
|
|
199
|
+
newIx = ix;
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
newIx = ix +1;
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// all other columns
|
|
207
|
+
if (left <= currentX && currentX < left + halfWidth) {
|
|
208
|
+
newIx = ix;
|
|
209
|
+
return false;
|
|
210
|
+
} else if (currentX < right) {
|
|
211
|
+
newIx = ix +1;
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Verify index can actually be used
|
|
217
|
+
if (typeof localColumnsConfig[newIx] === 'undefined' || !localColumnsConfig[newIx].reorderable) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Render marker showing destination location (can't use regular render cycle because this div is absolutely positioned on page)
|
|
222
|
+
const
|
|
223
|
+
columnHeaderRect = columnHeaders[newIx].getBoundingClientRect(),
|
|
224
|
+
left = columnHeaderRect.left;
|
|
225
|
+
let marker = dragColumnSlot && dragColumnSlot.marker;
|
|
226
|
+
if (marker) {
|
|
227
|
+
marker.style.left = left + 'px';
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
setDragColumnSlot({ ix: newIx, marker, });
|
|
231
|
+
},
|
|
232
|
+
onColumnReorderDragStop = (delta, e, config) => {
|
|
233
|
+
const columnsConfig = _.clone(localColumnsConfig); // work with a copy, so that setter forces rerender
|
|
234
|
+
|
|
235
|
+
_.pull(columnsConfig, config);
|
|
236
|
+
|
|
237
|
+
// Stick the column at the new ix (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
|
|
238
|
+
columnsConfig.splice(dragColumnSlot.ix, 0, config);
|
|
239
|
+
|
|
240
|
+
setLocalColumnsConfig(columnsConfig);
|
|
241
|
+
setColumnsConfig(columnsConfig);
|
|
242
|
+
|
|
243
|
+
if (dragColumnSlot) {
|
|
244
|
+
dragColumnSlot.marker.remove();
|
|
245
|
+
}
|
|
246
|
+
setDragColumnSlot(null);
|
|
247
|
+
},
|
|
248
|
+
onColumnResize = (delta, e, node, config) => {
|
|
249
|
+
const columnsConfig = _.clone(localColumnsConfig); // work with a copy, so that setter forces rerender
|
|
250
|
+
if (config.w) {
|
|
251
|
+
config.w = Math.round(config.w + delta);
|
|
252
|
+
} else if (config.flex) {
|
|
253
|
+
// Figure out the previous width
|
|
254
|
+
// Add it as 'w' here and delete flex
|
|
255
|
+
const
|
|
256
|
+
columnHeader = node.parentElement,
|
|
257
|
+
previousWidth = columnHeader.getBoundingClientRect().width;
|
|
258
|
+
delete config.flex;
|
|
259
|
+
config.w = Math.round(previousWidth + delta);
|
|
260
|
+
}
|
|
261
|
+
setLocalColumnsConfig(columnsConfig);
|
|
262
|
+
setColumnsConfig(columnsConfig);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
useEffect(() => {
|
|
266
|
+
// Make localColumnsConfig match what was supplied
|
|
267
|
+
if (columnsConfig !== localColumnsConfig) {
|
|
268
|
+
setLocalColumnsConfig(columnsConfig);
|
|
269
|
+
}
|
|
270
|
+
}, [columnsConfig]);
|
|
271
|
+
|
|
272
|
+
if (UiConfig.mode !== UI_MODE_WEB) {
|
|
273
|
+
canColumnsReorder = false;
|
|
274
|
+
canColumnsResize = false;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return useMemo(() => {
|
|
278
|
+
const renderHeaders = () => {
|
|
279
|
+
const
|
|
280
|
+
sorters = Repository && Repository.sorters,
|
|
281
|
+
sorter = sorters && sorters.length === 1 ? sorters[0] : null,
|
|
282
|
+
sortField = sorter && sorter.name,
|
|
283
|
+
isSortDirectionAsc = sorter && sorter.direction === 'ASC';
|
|
284
|
+
|
|
285
|
+
// These header Components should match the columns exactly
|
|
286
|
+
// so we can drag/drop them to control the columns.
|
|
287
|
+
const headerColumns = _.map(localColumnsConfig, (config, ix) => {
|
|
288
|
+
let {
|
|
289
|
+
columnId,
|
|
290
|
+
fieldName,
|
|
291
|
+
header = _.upperFirst(fieldName),
|
|
292
|
+
reorderable,
|
|
293
|
+
resizable,
|
|
294
|
+
sortable,
|
|
295
|
+
w,
|
|
296
|
+
flex,
|
|
297
|
+
showDragHandles,
|
|
298
|
+
} = config,
|
|
299
|
+
isSorter = sortable && canColumnsSort && sortField === fieldName,
|
|
300
|
+
isReorderable = canColumnsReorder && reorderable,
|
|
301
|
+
isResizable = canColumnsResize && resizable,
|
|
302
|
+
propsToPass = {
|
|
303
|
+
borderRightWidth: 2,
|
|
304
|
+
borderRightColor: '#fff',
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (w) {
|
|
308
|
+
propsToPass.w = w;
|
|
309
|
+
} else if (flex) {
|
|
310
|
+
propsToPass.flex = flex;
|
|
311
|
+
propsToPass.minWidth = 100;
|
|
312
|
+
} else if (localColumnsConfig.length === 1) {
|
|
313
|
+
// Only one column and flex is not set
|
|
314
|
+
propsToPass.flex = 1;
|
|
315
|
+
if (!header) {
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return <Pressable
|
|
320
|
+
key={ix}
|
|
321
|
+
onPress={(e) => {
|
|
322
|
+
if (isBlocked.current) { // withDraggable initiates block
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (canColumnsSort) {
|
|
326
|
+
onSort(config, e);
|
|
327
|
+
}
|
|
328
|
+
}}
|
|
329
|
+
flexDirection="row"
|
|
330
|
+
h="100%"
|
|
331
|
+
bg={styles.GRID_HEADER_BG}
|
|
332
|
+
_hover={{
|
|
333
|
+
bg: styles.GRID_HEADER_HOVER_BG,
|
|
334
|
+
}}
|
|
335
|
+
p={0}
|
|
336
|
+
style={{ userSelect: 'none', }}
|
|
337
|
+
onMouseEnter={(e) => onHeaderMouseEnter(e, ix)}
|
|
338
|
+
onMouseLeave={(e) => onHeaderMouseLeave(e, ix)}
|
|
339
|
+
{...propsToPass}
|
|
340
|
+
>
|
|
341
|
+
{isReorderable && showDragHandles &&
|
|
342
|
+
<HeaderReorderHandle
|
|
343
|
+
key="HeaderReorderHandle"
|
|
344
|
+
mode={HORIZONTAL}
|
|
345
|
+
onDragStart={onColumnReorderDragStart}
|
|
346
|
+
onDrag={onColumnReorderDrag}
|
|
347
|
+
onDragStop={(delta, e) => onColumnReorderDragStop(delta, e, config)}
|
|
348
|
+
onChangeIsDragging={setIsDragging}
|
|
349
|
+
getProxy={(node) => {
|
|
350
|
+
const
|
|
351
|
+
columnHeader = node.parentElement,
|
|
352
|
+
columnHeaderRect = columnHeader.getBoundingClientRect(),
|
|
353
|
+
proxy = columnHeader.cloneNode(true);
|
|
354
|
+
|
|
355
|
+
proxy.style.top = columnHeaderRect.top + 10 + 'px';
|
|
356
|
+
proxy.style.left = columnHeaderRect.left + 'px';
|
|
357
|
+
proxy.style.height = columnHeaderRect.height + 'px';
|
|
358
|
+
proxy.style.width = columnHeaderRect.width + 'px';
|
|
359
|
+
proxy.style.display = 'flex';
|
|
360
|
+
proxy.style.backgroundColor = '#ddd';
|
|
361
|
+
return proxy;
|
|
362
|
+
}}
|
|
363
|
+
/>}
|
|
364
|
+
|
|
365
|
+
<Text
|
|
366
|
+
key="Text"
|
|
367
|
+
fontSize={styles.GRID_HEADER_FONTSIZE}
|
|
368
|
+
overflow="hidden"
|
|
369
|
+
textOverflow="ellipsis"
|
|
370
|
+
flex={1}
|
|
371
|
+
h="100%"
|
|
372
|
+
px={2}
|
|
373
|
+
py={2}
|
|
374
|
+
alignItems="center"
|
|
375
|
+
justifyContent="center"
|
|
376
|
+
numberOfLines={1}
|
|
377
|
+
ellipsizeMode="head"
|
|
378
|
+
>{header}</Text>
|
|
379
|
+
|
|
380
|
+
{isSorter && <Icon key="Icon" as={isSortDirectionAsc ? SortDown : SortUp} textAlign="center" size="sm" mt={3} mr={2} color="trueGray.500" />}
|
|
381
|
+
|
|
382
|
+
{isResizable && showDragHandles &&
|
|
383
|
+
<HeaderResizeHandle
|
|
384
|
+
key="HeaderResizeHandle"
|
|
385
|
+
mode={HORIZONTAL}
|
|
386
|
+
onDragStop={(delta, e, node) => onColumnResize(delta, e, node, config)}
|
|
387
|
+
onChangeIsDragging={setIsDragging}
|
|
388
|
+
getProxy={(node) => {
|
|
389
|
+
const
|
|
390
|
+
columnHeader = node.parentElement,
|
|
391
|
+
columnHeaderRect = columnHeader.getBoundingClientRect(),
|
|
392
|
+
nodeRect = node.getBoundingClientRect(),
|
|
393
|
+
gridRowsContainer = gridRef.current._listRef._scrollRef.childNodes[0],
|
|
394
|
+
gridRowsContainerRect = gridRowsContainer.getBoundingClientRect(),
|
|
395
|
+
proxy = node.cloneNode(true),
|
|
396
|
+
verticalLine = document.createElement('div');
|
|
397
|
+
|
|
398
|
+
verticalLine.style.position = 'absolute';
|
|
399
|
+
verticalLine.style.height = gridRowsContainerRect.height + columnHeaderRect.height + 'px';
|
|
400
|
+
verticalLine.style.width = '1px';
|
|
401
|
+
verticalLine.style.top = 0;
|
|
402
|
+
verticalLine.style.right = 0;
|
|
403
|
+
verticalLine.style.backgroundColor = '#ddd';
|
|
404
|
+
proxy.appendChild(verticalLine);
|
|
405
|
+
|
|
406
|
+
proxy.style.top = nodeRect.top + 'px';
|
|
407
|
+
proxy.style.left = nodeRect.left + 'px';
|
|
408
|
+
proxy.style.height = nodeRect.height + 'px';
|
|
409
|
+
proxy.style.width = nodeRect.width + 'px';
|
|
410
|
+
proxy.style.display = 'flex';
|
|
411
|
+
|
|
412
|
+
return proxy;
|
|
413
|
+
}}
|
|
414
|
+
/>}
|
|
415
|
+
</Pressable>;
|
|
416
|
+
});
|
|
417
|
+
if (!hideNavColumn) {
|
|
418
|
+
headerColumns.push(<AngleRight
|
|
419
|
+
key="AngleRight"
|
|
420
|
+
color="#aaa"
|
|
421
|
+
variant="ghost"
|
|
422
|
+
w={30}
|
|
423
|
+
alignSelf="center"
|
|
424
|
+
ml={3}
|
|
425
|
+
/>);
|
|
426
|
+
}
|
|
427
|
+
return headerColumns;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
return <Row
|
|
431
|
+
w="100%"
|
|
432
|
+
bg="trueGray.200"
|
|
433
|
+
style={{
|
|
434
|
+
scrollbarWidth: 'none',
|
|
435
|
+
}}
|
|
436
|
+
>
|
|
437
|
+
{renderHeaders()}
|
|
438
|
+
</Row>;
|
|
439
|
+
|
|
440
|
+
}, [
|
|
441
|
+
Repository,
|
|
442
|
+
localColumnsConfig,
|
|
443
|
+
hideNavColumn,
|
|
444
|
+
canColumnsSort,
|
|
445
|
+
canColumnsReorder,
|
|
446
|
+
canColumnsResize,
|
|
447
|
+
isHovered,
|
|
448
|
+
dragColumnSlot,
|
|
449
|
+
isDragging,
|
|
450
|
+
isSortDirectionAsc,
|
|
451
|
+
sortFn,
|
|
452
|
+
sortField,
|
|
453
|
+
]);
|
|
454
|
+
}
|
|
455
|
+
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { useState, useMemo, } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Row,
|
|
5
|
+
Text,
|
|
6
|
+
} from 'native-base';
|
|
7
|
+
import {
|
|
8
|
+
VERTICAL,
|
|
9
|
+
} from '../../Constants/Directions';
|
|
10
|
+
import withDraggable from '../Hoc/withDraggable';
|
|
11
|
+
import styles from '../../Constants/Styles';
|
|
12
|
+
import AngleRight from '../Icons/AngleRight';
|
|
13
|
+
import _ from 'lodash';
|
|
14
|
+
|
|
15
|
+
// This was broken out from Grid simply so we can memoize it
|
|
16
|
+
|
|
17
|
+
export default function GridRow(props) {
|
|
18
|
+
const {
|
|
19
|
+
columnsConfig,
|
|
20
|
+
columnProps,
|
|
21
|
+
fields,
|
|
22
|
+
rowProps,
|
|
23
|
+
hideNavColumn,
|
|
24
|
+
bg,
|
|
25
|
+
item,
|
|
26
|
+
} = props,
|
|
27
|
+
isPhantom = item.isPhantom,
|
|
28
|
+
hash = item.hash || item;
|
|
29
|
+
|
|
30
|
+
return useMemo(() => {
|
|
31
|
+
const renderColumns = (item) => {
|
|
32
|
+
if (_.isArray(columnsConfig)) {
|
|
33
|
+
return _.map(columnsConfig, (config, key) => {
|
|
34
|
+
let value;
|
|
35
|
+
if (_.isPlainObject(config)) {
|
|
36
|
+
if (config.renderer) {
|
|
37
|
+
return config.renderer(item, key);
|
|
38
|
+
}
|
|
39
|
+
if (config.fieldName) {
|
|
40
|
+
if (item.properties && item.properties[config.fieldName]) {
|
|
41
|
+
const property = item.properties[config.fieldName];
|
|
42
|
+
value = property.displayValue;
|
|
43
|
+
} else if (item[config.fieldName]) {
|
|
44
|
+
value = item[config.fieldName];
|
|
45
|
+
} else if (fields) {
|
|
46
|
+
const ix = fields.indexOf(config.fieldName);
|
|
47
|
+
value = item[ix];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (_.isString(config)) {
|
|
52
|
+
if (fields) {
|
|
53
|
+
const ix = fields.indexOf(config);
|
|
54
|
+
value = item[ix];
|
|
55
|
+
} else {
|
|
56
|
+
value = item[config];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (_.isFunction(config)) {
|
|
60
|
+
value = config(item);
|
|
61
|
+
}
|
|
62
|
+
if (_.isFunction(value)) {
|
|
63
|
+
return value(key);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const propsToPass = columnProps[key] || {};
|
|
67
|
+
if (config.w) {
|
|
68
|
+
propsToPass.w = config.w;
|
|
69
|
+
} else if (config.flex) {
|
|
70
|
+
propsToPass.flex = config.flex;
|
|
71
|
+
propsToPass.minWidth = 100;
|
|
72
|
+
} else {
|
|
73
|
+
propsToPass.flex = 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return <Text
|
|
77
|
+
key={key}
|
|
78
|
+
overflow="hidden"
|
|
79
|
+
textOverflow="ellipsis"
|
|
80
|
+
alignSelf="center"
|
|
81
|
+
style={{ userSelect: 'none', }}
|
|
82
|
+
fontSize={styles.GRID_CELL_FONTSIZE}
|
|
83
|
+
numberOfLines={1}
|
|
84
|
+
ellipsizeMode="head"
|
|
85
|
+
{...propsToPass}
|
|
86
|
+
>{value}</Text>;
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
// TODO: if 'columnsConfig' is an object, parse its contents
|
|
90
|
+
throw new Error('Non-array columnsConfig not yet supported');
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return <Row
|
|
94
|
+
alignItems="center"
|
|
95
|
+
flexGrow={1}
|
|
96
|
+
{...rowProps}
|
|
97
|
+
bg={bg}
|
|
98
|
+
key={hash}
|
|
99
|
+
>
|
|
100
|
+
{isPhantom && <Box position="absolute" bg="#f00" h={2} w={2} t={0} l={0} />}
|
|
101
|
+
|
|
102
|
+
{renderColumns(item)}
|
|
103
|
+
|
|
104
|
+
{!hideNavColumn && <AngleRight
|
|
105
|
+
color={styles.GRID_NAV_COLUMN_COLOR}
|
|
106
|
+
variant="ghost"
|
|
107
|
+
w={30}
|
|
108
|
+
alignSelf="center"
|
|
109
|
+
ml={3}
|
|
110
|
+
/>}
|
|
111
|
+
</Row>;
|
|
112
|
+
}, [
|
|
113
|
+
columnsConfig,
|
|
114
|
+
columnProps,
|
|
115
|
+
fields,
|
|
116
|
+
rowProps,
|
|
117
|
+
hideNavColumn,
|
|
118
|
+
bg,
|
|
119
|
+
item,
|
|
120
|
+
isPhantom,
|
|
121
|
+
hash, // this is an easy way to determine if the data has changed and the item needs to be rerendered
|
|
122
|
+
]);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function withAdditionalProps(WrappedComponent) {
|
|
126
|
+
return (props) => {
|
|
127
|
+
return <WrappedComponent
|
|
128
|
+
mode={VERTICAL}
|
|
129
|
+
{...props}
|
|
130
|
+
/>;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const ReorderableGridRow = withAdditionalProps(withDraggable(GridRow));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
Icon,
|
|
4
|
+
Row,
|
|
5
|
+
Text,
|
|
6
|
+
} from 'native-base';
|
|
7
|
+
import styles from '../../Styles/StyleSheets.js';
|
|
8
|
+
import withDraggable from '../Hoc/withDraggable';
|
|
9
|
+
import GripVertical from '../Icons/GripVertical';
|
|
10
|
+
|
|
11
|
+
function HeaderReorderHandle(props) {
|
|
12
|
+
const {
|
|
13
|
+
isDragging,
|
|
14
|
+
} = props;
|
|
15
|
+
|
|
16
|
+
return <Column
|
|
17
|
+
testID="HeaderReorderHandle"
|
|
18
|
+
bg={isDragging ? 'trueGray.300' : 'trueGray.100'}
|
|
19
|
+
h="100%"
|
|
20
|
+
w={3}
|
|
21
|
+
alignItems="center"
|
|
22
|
+
justifyContent="center"
|
|
23
|
+
style={styles.ewResize}
|
|
24
|
+
>
|
|
25
|
+
<Icon as={GripVertical} testID="handle" size="xs" w="100%" h="100%" color="#ccc" />
|
|
26
|
+
</Column>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default withDraggable(HeaderReorderHandle);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
Icon,
|
|
4
|
+
Row,
|
|
5
|
+
Text,
|
|
6
|
+
} from 'native-base';
|
|
7
|
+
import styles from '../../Styles/StyleSheets.js';
|
|
8
|
+
import withDraggable from '../Hoc/withDraggable';
|
|
9
|
+
import GripLinesVertical from '../Icons/GripLinesVertical';
|
|
10
|
+
|
|
11
|
+
function HeaderResizeHandle(props) {
|
|
12
|
+
const {
|
|
13
|
+
isDragging,
|
|
14
|
+
} = props;
|
|
15
|
+
|
|
16
|
+
return <Column
|
|
17
|
+
testID="HeaderResizeHandle"
|
|
18
|
+
bg={isDragging ? 'trueGray.300' : 'trueGray.100'}
|
|
19
|
+
h="100%"
|
|
20
|
+
w={3}
|
|
21
|
+
alignItems="center"
|
|
22
|
+
justifyContent="center"
|
|
23
|
+
style={styles.ewResize}
|
|
24
|
+
>
|
|
25
|
+
<Icon as={GripLinesVertical} testID="handle" size="sm" color="#ccc" />
|
|
26
|
+
</Column>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default withDraggable(HeaderResizeHandle);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
Row,
|
|
4
|
+
Text,
|
|
5
|
+
} from 'native-base';
|
|
6
|
+
import IconButton from '../Buttons/IconButton';
|
|
7
|
+
import Rotate from '../Icons/Rotate';
|
|
8
|
+
|
|
9
|
+
export default function NoRecordsFound(props) {
|
|
10
|
+
const
|
|
11
|
+
{
|
|
12
|
+
onRefresh,
|
|
13
|
+
text = 'No Records found.',
|
|
14
|
+
} = props,
|
|
15
|
+
textComponent = <Text
|
|
16
|
+
textAlign="center"
|
|
17
|
+
>{text}</Text>;
|
|
18
|
+
|
|
19
|
+
let component = textComponent;
|
|
20
|
+
if (onRefresh) {
|
|
21
|
+
component = <Row justifyContent="center" alignItems="center" w="100%" flex={1}>
|
|
22
|
+
<IconButton
|
|
23
|
+
_icon={{
|
|
24
|
+
as: Rotate,
|
|
25
|
+
name: 'redo-alt',
|
|
26
|
+
style: {
|
|
27
|
+
fontSize: 16,
|
|
28
|
+
},
|
|
29
|
+
}}
|
|
30
|
+
onPress={onRefresh}
|
|
31
|
+
variant="ghost"
|
|
32
|
+
p={1}
|
|
33
|
+
ml={-4}
|
|
34
|
+
/>
|
|
35
|
+
{textComponent}
|
|
36
|
+
</Row>;
|
|
37
|
+
} else {
|
|
38
|
+
component = <Column justifyContent="center" alignItems="center" w="100%" flex={1}>
|
|
39
|
+
{textComponent}
|
|
40
|
+
</Column>;
|
|
41
|
+
}
|
|
42
|
+
return component;
|
|
43
|
+
}
|