@onehat/ui 0.4.95 → 0.4.97
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 +1 -1
- package/src/Components/Container/Container.js +47 -43
- package/src/Components/Form/Form.js +15 -7
- package/src/Components/Grid/Grid.js +116 -41
- package/src/Components/Hoc/withAlert.js +2 -1
- package/src/Components/Hoc/withEditor.js +37 -7
- package/src/Components/Hoc/withPresetButtons.js +5 -5
- package/src/Components/Panel/GridPanel.js +2 -1
- package/src/Components/Panel/TabPanel.js +6 -3
- package/src/Components/Panel/TreePanel.js +3 -2
- package/src/Components/Tree/Tree.js +38 -4
- package/src/Components/Tree/TreeNode.js +3 -0
- package/src/Components/Viewer/DateTimeViewer.js +25 -0
- package/src/Components/Viewer/DateViewer.js +25 -0
- package/src/Components/Viewer/PmCalcDebugViewer.js +299 -0
- package/src/Components/Viewer/PmStatusesViewer.js +51 -0
- package/src/Components/Viewer/TimeViewer.js +25 -0
- package/src/Components/Viewer/Viewer.js +29 -21
- package/src/Components/index.js +10 -0
- package/src/Constants/Dates.js +1 -0
- package/src/Constants/EditorModes.js +2 -0
- package/src/Constants/MeterSources.js +5 -0
- package/src/Constants/MeterTypes.js +4 -2
- package/src/Constants/PmEventTypes.js +11 -0
- package/src/Constants/PmScheduleModes.js +4 -0
- package/src/Constants/PmStatuses.js +7 -0
- package/src/PlatformImports/Web/Attachments.js +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import DisplayField from '../Form/Field/DisplayField.js';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {
|
|
4
|
+
MOMENT_DATE_FORMAT_5,
|
|
5
|
+
} from '../../Constants/Dates';
|
|
6
|
+
|
|
7
|
+
export default function TimeViewer(props) {
|
|
8
|
+
const {
|
|
9
|
+
moment,
|
|
10
|
+
} = props;
|
|
11
|
+
if (!moment || !moment.isValid()) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
let className = clsx(
|
|
15
|
+
'flex-none',
|
|
16
|
+
);
|
|
17
|
+
if (props.className) {
|
|
18
|
+
className += ' ' + props.className;
|
|
19
|
+
}
|
|
20
|
+
return <DisplayField
|
|
21
|
+
text={moment.format(MOMENT_DATE_FORMAT_5)}
|
|
22
|
+
{...props}
|
|
23
|
+
className={className}
|
|
24
|
+
/>;
|
|
25
|
+
}
|
|
@@ -114,6 +114,7 @@ function Viewer(props) {
|
|
|
114
114
|
}
|
|
115
115
|
let {
|
|
116
116
|
type,
|
|
117
|
+
viewerType,
|
|
117
118
|
title,
|
|
118
119
|
name,
|
|
119
120
|
label,
|
|
@@ -122,6 +123,7 @@ function Viewer(props) {
|
|
|
122
123
|
isHidden = false,
|
|
123
124
|
isHiddenInViewMode = false,
|
|
124
125
|
getDynamicProps,
|
|
126
|
+
viewerFormatter = null,
|
|
125
127
|
...itemPropsToPass
|
|
126
128
|
} = item,
|
|
127
129
|
viewerTypeProps = {};
|
|
@@ -137,7 +139,9 @@ function Viewer(props) {
|
|
|
137
139
|
}
|
|
138
140
|
const propertyDef = name && Repository?.getSchema().getPropertyDefinition(name);
|
|
139
141
|
if (!type) {
|
|
140
|
-
if (
|
|
142
|
+
if (viewerType) {
|
|
143
|
+
type = viewerType;
|
|
144
|
+
} else if (propertyDef?.viewerType?.type) {
|
|
141
145
|
const
|
|
142
146
|
{
|
|
143
147
|
type: t,
|
|
@@ -274,6 +278,9 @@ function Viewer(props) {
|
|
|
274
278
|
value = record.properties[fkDisplayField].displayValue;
|
|
275
279
|
}
|
|
276
280
|
}
|
|
281
|
+
if (viewerFormatter) {
|
|
282
|
+
value = viewerFormatter(value, record, self);
|
|
283
|
+
}
|
|
277
284
|
|
|
278
285
|
let elementClassName = clsx(
|
|
279
286
|
'Viewer-field',
|
|
@@ -543,26 +550,27 @@ function Viewer(props) {
|
|
|
543
550
|
)}
|
|
544
551
|
>
|
|
545
552
|
{scrollToTopAnchor}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
553
|
+
|
|
554
|
+
<Toolbar className="justify-end">
|
|
555
|
+
<HStack className="flex-1 items-center">
|
|
556
|
+
<Text className="text-[20px] ml-1 text-grey-500">View Mode</Text>
|
|
557
|
+
</HStack>
|
|
558
|
+
{onEditMode && (!canUser || canUser(EDIT)) &&
|
|
559
|
+
<Button
|
|
560
|
+
{...testProps('toEditBtn')}
|
|
561
|
+
key="editBtn"
|
|
562
|
+
onPress={onEditMode}
|
|
563
|
+
icon={Pencil}
|
|
564
|
+
_icon={{
|
|
565
|
+
size: 'sm',
|
|
566
|
+
className: 'text-white'
|
|
567
|
+
}}
|
|
568
|
+
className="text-white"
|
|
569
|
+
text="To Edit"
|
|
570
|
+
tooltip="Switch to Edit Mode"
|
|
571
|
+
isDisabled={!canEdit}
|
|
572
|
+
/>}
|
|
573
|
+
</Toolbar>
|
|
566
574
|
|
|
567
575
|
{!_.isEmpty(additionalButtons) &&
|
|
568
576
|
<Toolbar className="justify-end flex-wrap gap-2">
|
package/src/Components/index.js
CHANGED
|
@@ -255,6 +255,8 @@ import Container from './Container/Container.js';
|
|
|
255
255
|
import ContainerColumn from './Container/ContainerColumn.js';
|
|
256
256
|
import DataMgt from './Screens/DataMgt.js';
|
|
257
257
|
import Date from './Form/Field/Date.js';
|
|
258
|
+
import DateViewer from './Viewer/DateViewer.js';
|
|
259
|
+
import DateTimeViewer from './Viewer/DateTimeViewer.js';
|
|
258
260
|
import DateRange from './Filter/DateRange.js';
|
|
259
261
|
import DisplayField from './Form/Field/DisplayField.js';
|
|
260
262
|
import ExpandButton from './Buttons/ExpandButton.js';
|
|
@@ -278,6 +280,8 @@ import NumberRange from './Filter/NumberRange.js';
|
|
|
278
280
|
import Panel from './Panel/Panel.js';
|
|
279
281
|
// import Picker from './Panel/Picker.js';
|
|
280
282
|
import PlusMinusButton from './Buttons/PlusMinusButton.js';
|
|
283
|
+
import PmCalcDebugViewer from './Viewer/PmCalcDebugViewer.js';
|
|
284
|
+
import PmStatusesViewer from './Viewer/PmStatusesViewer.js';
|
|
281
285
|
import RadioGroup from './Form/Field/RadioGroup/RadioGroup.js';
|
|
282
286
|
// import Slider from './Form/Field/Slider.js'; // Currently, Slider is not compatible with the new React architecture. Temporarily remove it from index.js to prevent issues.
|
|
283
287
|
import SquareButton from './Buttons/SquareButton.js';
|
|
@@ -286,6 +290,7 @@ import Tag from './Form/Field/Tag/Tag.js';
|
|
|
286
290
|
import TextArea from './Form/Field/TextArea.js';
|
|
287
291
|
import Text from './Form/Field/Text.js';
|
|
288
292
|
import TextWithLinks from './Viewer/TextWithLinks.js';
|
|
293
|
+
import TimeViewer from './Viewer/TimeViewer.js';
|
|
289
294
|
import TimezonesCombo from './Form/Field/Combo/TimezonesCombo.js';
|
|
290
295
|
import Toggle from './Form/Field/Toggle.js';
|
|
291
296
|
import Toolbar from './Toolbar/Toolbar.js';
|
|
@@ -550,6 +555,8 @@ const components = {
|
|
|
550
555
|
ContainerColumn,
|
|
551
556
|
DataMgt,
|
|
552
557
|
Date,
|
|
558
|
+
DateViewer,
|
|
559
|
+
DateTimeViewer,
|
|
553
560
|
DateRange,
|
|
554
561
|
DisplayField,
|
|
555
562
|
ExpandButton,
|
|
@@ -573,6 +580,8 @@ const components = {
|
|
|
573
580
|
Panel,
|
|
574
581
|
// Picker,
|
|
575
582
|
PlusMinusButton,
|
|
583
|
+
PmCalcDebugViewer,
|
|
584
|
+
PmStatusesViewer,
|
|
576
585
|
RadioGroup,
|
|
577
586
|
// Slider,
|
|
578
587
|
SquareButton,
|
|
@@ -581,6 +590,7 @@ const components = {
|
|
|
581
590
|
Text,
|
|
582
591
|
TextArea,
|
|
583
592
|
TextWithLinks,
|
|
593
|
+
TimeViewer,
|
|
584
594
|
TimezonesCombo,
|
|
585
595
|
Toggle,
|
|
586
596
|
Toolbar,
|
package/src/Constants/Dates.js
CHANGED
|
@@ -18,3 +18,4 @@ export const MOMENT_DATE_FORMAT_2 = 'MMM D YYYY, h:mm:ssa'; // pretty datetime
|
|
|
18
18
|
export const MOMENT_DATE_FORMAT_3 = 'h:mma'; // pretty time
|
|
19
19
|
export const MOMENT_DATE_FORMAT_4 = 'YYYY-MM-DD';
|
|
20
20
|
export const MOMENT_DATE_FORMAT_5 = 'HH:mm:ss';
|
|
21
|
+
export const MOMENT_DATE_FORMAT_6 = 'MMM D, YYYY'; // pretty date
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export const METER_TYPES__HOURS = 1;
|
|
2
|
+
export const METER_TYPES__HOURS_UNITS = 'hrs';
|
|
3
|
+
export const METER_TYPES__HOURS_TEXT = 'Time (' + METER_TYPES__HOURS_UNITS + ')';
|
|
2
4
|
export const METER_TYPES__MILES = 2;
|
|
3
|
-
export const
|
|
4
|
-
export const METER_TYPES__MILES_TEXT = 'Distance (
|
|
5
|
+
export const METER_TYPES__MILES_UNITS = 'mi-km';
|
|
6
|
+
export const METER_TYPES__MILES_TEXT = 'Distance (' + METER_TYPES__MILES_UNITS + ')';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const PM_EVENT_TYPES__INITIAL = 1;
|
|
2
|
+
export const PM_EVENT_TYPES__WORK_ORDER = 2;
|
|
3
|
+
export const PM_EVENT_TYPES__ALERT = 3;
|
|
4
|
+
export const PM_EVENT_TYPES__COMPLETE = 4;
|
|
5
|
+
export const PM_EVENT_TYPES__RESET = 5;
|
|
6
|
+
export const PM_EVENT_TYPES__DELAY_BY_DAYS = 6;
|
|
7
|
+
export const PM_EVENT_TYPES__DELAY_BY_METER = 7;
|
|
8
|
+
export const PM_EVENT_TYPES__SCHEDULE_PM = 8;
|
|
9
|
+
export const PM_EVENT_TYPES__WILL_CALL = 9;
|
|
10
|
+
export const PM_EVENT_TYPES__ASSIGN_TECHNICIAN = 10;
|
|
11
|
+
export const PM_EVENT_TYPES__COMMENT = 11;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const PM_STATUSES__OK = 1;
|
|
2
|
+
export const PM_STATUSES__PM_DUE = 2;
|
|
3
|
+
export const PM_STATUSES__DELAYED = 3;
|
|
4
|
+
export const PM_STATUSES__WILL_CALL = 4;
|
|
5
|
+
export const PM_STATUSES__SCHEDULED = 5;
|
|
6
|
+
export const PM_STATUSES__OVERDUE = 6;
|
|
7
|
+
export const PM_STATUSES__COMPLETED = 7;
|