@adcops/autocore-react 3.0.1 → 3.0.4
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/dist/assets/BlocklyLogo.d.ts +3 -0
- package/dist/assets/BlocklyLogo.js +1 -0
- package/dist/assets/Distance.d.ts +3 -0
- package/dist/assets/Distance.js +1 -0
- package/dist/assets/JogLong.d.ts +3 -0
- package/dist/assets/JogLong.js +1 -0
- package/dist/assets/JogMedium.d.ts +3 -0
- package/dist/assets/JogMedium.js +1 -0
- package/dist/assets/JogShort.d.ts +3 -0
- package/dist/assets/JogShort.js +1 -0
- package/dist/assets/PythonLogo.d.ts +3 -0
- package/dist/assets/PythonLogo.js +1 -0
- package/dist/assets/Rotation3D.d.ts +3 -0
- package/dist/assets/Rotation3D.js +1 -0
- package/dist/assets/RotationCcw.d.ts +3 -0
- package/dist/assets/RotationCcw.js +1 -0
- package/dist/assets/RotationCcwA.d.ts +3 -0
- package/dist/assets/RotationCcwA.js +1 -0
- package/dist/assets/RotationCcwB.d.ts +3 -0
- package/dist/assets/RotationCcwB.js +1 -0
- package/dist/assets/RotationCcwC.d.ts +3 -0
- package/dist/assets/RotationCcwC.js +1 -0
- package/dist/assets/RotationCw.d.ts +3 -0
- package/dist/assets/RotationCw.js +1 -0
- package/dist/assets/RotationCwA.d.ts +3 -0
- package/dist/assets/RotationCwA.js +1 -0
- package/dist/assets/RotationCwB.d.ts +3 -0
- package/dist/assets/RotationCwB.js +1 -0
- package/dist/assets/RotationCwC.d.ts +3 -0
- package/dist/assets/RotationCwC.js +1 -0
- package/dist/assets/Run.d.ts +3 -0
- package/dist/assets/Run.js +1 -0
- package/dist/assets/Speed.d.ts +3 -0
- package/dist/assets/Speed.js +1 -0
- package/dist/assets/SpeedFast.d.ts +3 -0
- package/dist/assets/SpeedFast.js +1 -0
- package/dist/assets/SpeedMedium.d.ts +3 -0
- package/dist/assets/SpeedMedium.js +1 -0
- package/dist/assets/SpeedNone.d.ts +3 -0
- package/dist/assets/SpeedNone.js +1 -0
- package/dist/assets/SpeedSlow.d.ts +3 -0
- package/dist/assets/SpeedSlow.js +1 -0
- package/dist/assets/Walk.d.ts +3 -0
- package/dist/assets/Walk.js +1 -0
- package/dist/assets/index.d.ts +22 -0
- package/dist/assets/index.js +1 -0
- package/dist/assets/svg/blockly_logo.svg +82 -0
- package/dist/assets/svg/distance.svg +40 -0
- package/dist/assets/svg/jog_long.svg +1 -0
- package/dist/assets/svg/jog_medium.svg +1 -0
- package/dist/assets/svg/jog_short.svg +1 -0
- package/dist/assets/svg/python_logo.svg +246 -0
- package/dist/assets/svg/rotation_3d.svg +1 -0
- package/dist/assets/svg/rotation_ccw.svg +50 -0
- package/dist/assets/svg/rotation_ccw_a.svg +57 -0
- package/dist/assets/svg/rotation_ccw_b.svg +57 -0
- package/dist/assets/svg/rotation_ccw_c.svg +57 -0
- package/dist/assets/svg/rotation_cw.svg +49 -0
- package/dist/assets/svg/rotation_cw_a.svg +30 -0
- package/dist/assets/svg/rotation_cw_b.svg +30 -0
- package/dist/assets/svg/rotation_cw_c.svg +30 -0
- package/dist/assets/svg/run.svg +1 -0
- package/dist/assets/svg/speed.svg +39 -0
- package/dist/assets/svg/speed_fast.svg +1 -0
- package/dist/assets/svg/speed_medium.svg +1 -0
- package/dist/assets/svg/speed_none.svg +1 -0
- package/dist/assets/svg/speed_slow.svg +1 -0
- package/dist/assets/svg/walk.svg +1 -0
- package/dist/components/BlocklyEditor.css +25 -0
- package/dist/components/BlocklyEditor.d.ts +120 -0
- package/dist/components/BlocklyEditor.js +1 -0
- package/dist/components/CodeEditor.d.ts +76 -0
- package/dist/components/CodeEditor.js +1 -0
- package/dist/components/Indicator.d.ts +12 -27
- package/dist/components/Indicator.js +1 -1
- package/dist/components/IndicatorButton.d.ts +56 -37
- package/dist/components/IndicatorButton.js +1 -1
- package/dist/components/JogPanel.css +41 -0
- package/dist/components/JogPanel.d.ts +118 -0
- package/dist/components/JogPanel.js +1 -0
- package/dist/components/Lamp.d.ts +81 -0
- package/dist/components/Lamp.js +1 -0
- package/dist/components/ToggleGroup.d.ts +103 -0
- package/dist/components/ToggleGroup.js +1 -0
- package/dist/components/ValueInput.d.ts +109 -0
- package/dist/components/ValueInput.js +1 -0
- package/dist/core/ActionMode.d.ts +9 -0
- package/dist/core/ActionMode.js +1 -0
- package/dist/core/IndicatorButtonState.d.ts +21 -0
- package/dist/core/IndicatorButtonState.js +1 -0
- package/dist/core/MaskPatterns.d.ts +4 -0
- package/dist/core/MaskPatterns.js +1 -1
- package/docs/assets/highlight.css +25 -18
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/components_BlocklyEditor.BlocklyEditor.html +124 -0
- package/docs/classes/components_CodeEditor.CodeEditor.html +128 -0
- package/docs/classes/components_Indicator.Indicator.html +8 -8
- package/docs/classes/components_IndicatorButton.IndicatorButton.html +17 -17
- package/docs/classes/components_JogPanel.JogPanel.html +138 -0
- package/docs/classes/components_Lamp.Lamp.html +105 -0
- package/docs/classes/components_OskDialog.OskDialog.html +5 -5
- package/docs/classes/components_ToggleGroup.ToggleGroup.html +118 -0
- package/docs/classes/components_ValueDisplay.ValueDisplay.html +4 -4
- package/docs/classes/components_ValueInput.ValueInput.html +115 -0
- package/docs/classes/core_ValueSimulator.ValueSimulator.html +2 -2
- package/docs/classes/hub_HubBase.HubBase.html +4 -4
- package/docs/classes/hub_HubSimulate.HubSimulate.html +2 -2
- package/docs/classes/hub_HubSocketIo.HubSocketIo.html +5 -5
- package/docs/classes/hub_HubTauri.HubTauri.html +5 -5
- package/docs/enums/components_JogPanel.JogDistanceAction.html +5 -0
- package/docs/enums/components_JogPanel.JogPanelAction.html +18 -0
- package/docs/enums/components_JogPanel.JogSpeedAction.html +5 -0
- package/docs/enums/core_ActionMode.ActionMode.html +6 -0
- package/docs/enums/core_IndicatorColor.IndicatorColor.html +23 -0
- package/docs/functions/assets_BlocklyLogo.default.html +1 -0
- package/docs/functions/assets_Distance.default.html +1 -0
- package/docs/functions/assets_JogLong.default.html +1 -0
- package/docs/functions/assets_JogMedium.default.html +1 -0
- package/docs/functions/assets_JogShort.default.html +1 -0
- package/docs/functions/assets_PythonLogo.default.html +1 -0
- package/docs/functions/assets_Rotation3D.default.html +1 -0
- package/docs/functions/assets_RotationCcw.default.html +1 -0
- package/docs/functions/assets_RotationCcwA.default.html +1 -0
- package/docs/functions/assets_RotationCcwB.default.html +1 -0
- package/docs/functions/assets_RotationCcwC.default.html +1 -0
- package/docs/functions/assets_RotationCw.default.html +1 -0
- package/docs/functions/assets_RotationCwA.default.html +1 -0
- package/docs/functions/assets_RotationCwB.default.html +1 -0
- package/docs/functions/assets_RotationCwC.default.html +1 -0
- package/docs/functions/assets_Run.default.html +1 -0
- package/docs/functions/assets_Speed.default.html +1 -0
- package/docs/functions/assets_SpeedFast.default.html +1 -0
- package/docs/functions/assets_SpeedMedium.default.html +1 -0
- package/docs/functions/assets_SpeedNone.default.html +1 -0
- package/docs/functions/assets_SpeedSlow.default.html +1 -0
- package/docs/functions/assets_Walk.default.html +1 -0
- package/docs/functions/components_BlocklyEditor.createCustomToolbox.html +6 -0
- package/docs/functions/components_Osk.Osk.html +2 -2
- package/docs/functions/core_EventEmitterContext.EventEmitterProvider.html +2 -2
- package/docs/functions/core_UniqueId.UniqueId.html +2 -2
- package/docs/functions/core_hoc.hocAddSubscription.html +2 -2
- package/docs/functions/hub.createHub.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +18 -2
- package/docs/interfaces/components_IndicatorButton.IndicatorButtonProps.html +160 -132
- package/docs/interfaces/components_JogPanel.JogPanelButtonDefinition.html +5 -0
- package/docs/interfaces/components_ToggleGroup.ToggleGroupProps.html +636 -0
- package/docs/interfaces/core_EventEmitterContext.Action.html +2 -2
- package/docs/interfaces/core_EventEmitterContext.EventEmitterContextType.html +2 -2
- package/docs/interfaces/core_EventEmitterContext.State.html +2 -2
- package/docs/interfaces/core_EventEmitterContext.Subscription.html +2 -2
- package/docs/interfaces/core_IndicatorButtonState.IndicatorButtonState.html +10 -0
- package/docs/interfaces/core_PositionContext.IPositionContext.html +2 -2
- package/docs/modules/assets.html +23 -0
- package/docs/modules/assets_BlocklyLogo.html +2 -0
- package/docs/modules/assets_Distance.html +2 -0
- package/docs/modules/assets_JogLong.html +2 -0
- package/docs/modules/assets_JogMedium.html +2 -0
- package/docs/modules/assets_JogShort.html +2 -0
- package/docs/modules/assets_PythonLogo.html +2 -0
- package/docs/modules/assets_Rotation3D.html +2 -0
- package/docs/modules/assets_RotationCcw.html +2 -0
- package/docs/modules/assets_RotationCcwA.html +2 -0
- package/docs/modules/assets_RotationCcwB.html +2 -0
- package/docs/modules/assets_RotationCcwC.html +2 -0
- package/docs/modules/assets_RotationCw.html +2 -0
- package/docs/modules/assets_RotationCwA.html +2 -0
- package/docs/modules/assets_RotationCwB.html +2 -0
- package/docs/modules/assets_RotationCwC.html +2 -0
- package/docs/modules/assets_Run.html +2 -0
- package/docs/modules/assets_Speed.html +2 -0
- package/docs/modules/assets_SpeedFast.html +2 -0
- package/docs/modules/assets_SpeedMedium.html +2 -0
- package/docs/modules/assets_SpeedNone.html +2 -0
- package/docs/modules/assets_SpeedSlow.html +2 -0
- package/docs/modules/assets_Walk.html +2 -0
- package/docs/modules/components_BlocklyEditor.html +5 -0
- package/docs/modules/components_CodeEditor.html +3 -0
- package/docs/modules/components_Indicator.html +2 -2
- package/docs/modules/components_IndicatorButton.html +4 -4
- package/docs/modules/components_JogPanel.html +9 -0
- package/docs/modules/components_Lamp.html +4 -0
- package/docs/modules/components_Osk.html +2 -2
- package/docs/modules/components_OskDialog.html +2 -2
- package/docs/modules/components_ToggleGroup.html +5 -0
- package/docs/modules/components_ValueDisplay.html +2 -2
- package/docs/modules/components_ValueInput.html +2 -0
- package/docs/modules/core_ActionMode.html +2 -0
- package/docs/modules/core_EventEmitterContext.html +2 -2
- package/docs/modules/{components_IndicatorColor.html → core_IndicatorButtonState.html} +2 -2
- package/docs/modules/core_IndicatorColor.html +2 -0
- package/docs/modules/core_MaskPatterns.html +2 -2
- package/docs/modules/core_NumerableTypes.html +2 -2
- package/docs/modules/core_PositionContext.html +2 -2
- package/docs/modules/core_UniqueId.html +2 -2
- package/docs/modules/core_ValueSimulator.html +2 -2
- package/docs/modules/core_hoc.html +2 -2
- package/docs/modules/hub.html +2 -2
- package/docs/modules/hub_HubBase.html +2 -2
- package/docs/modules/hub_HubSimulate.html +2 -2
- package/docs/modules/hub_HubSocketIo.html +2 -2
- package/docs/modules/hub_HubTauri.html +2 -2
- package/docs/types/components_IndicatorButton.IndicatorButtonOptionsType.html +1 -0
- package/docs/types/core_EventEmitterContext.EmitterDispatchFunction.html +2 -2
- package/docs/types/core_EventEmitterContext.EmitterSubscribeFunction.html +2 -2
- package/docs/types/core_EventEmitterContext.EmitterUnsubscribeFunction.html +2 -2
- package/docs/types/core_NumerableTypes.NumerableFormatOptions.html +2 -2
- package/docs/types/core_hoc.HocAddSubscriptionProps.html +2 -2
- package/docs/variables/components_BlocklyEditor.StandardToolbox.html +1 -0
- package/docs/variables/components_JogPanel.DefaultLinearJogButtons.html +2 -0
- package/docs/variables/components_JogPanel.DefaultRotationJogButtons.html +2 -0
- package/docs/variables/core_EventEmitterContext.EventEmitterContext.html +6 -6
- package/docs/variables/core_MaskPatterns.PrimeReactMaskPatterns.html +2 -2
- package/docs/variables/core_MaskPatterns.RegExMaskPatterns.html +3 -2
- package/docs/variables/core_PositionContext.DimensionsContext.html +2 -2
- package/package.json +8 -4
- package/readme.md +33 -0
- package/src/assets/BlocklyLogo.tsx +27 -0
- package/src/assets/Distance.tsx +18 -0
- package/src/assets/JogLong.tsx +13 -0
- package/src/assets/JogMedium.tsx +13 -0
- package/src/assets/JogShort.tsx +13 -0
- package/src/assets/PythonLogo.tsx +83 -0
- package/src/assets/Rotation3D.tsx +13 -0
- package/src/assets/RotationCcw.tsx +33 -0
- package/src/assets/RotationCcwA.tsx +45 -0
- package/src/assets/RotationCcwB.tsx +45 -0
- package/src/assets/RotationCcwC.tsx +45 -0
- package/src/assets/RotationCw.tsx +31 -0
- package/src/assets/RotationCwA.tsx +42 -0
- package/src/assets/RotationCwB.tsx +42 -0
- package/src/assets/RotationCwC.tsx +42 -0
- package/src/assets/Run.tsx +13 -0
- package/src/assets/Speed.tsx +18 -0
- package/src/assets/SpeedFast.tsx +13 -0
- package/src/assets/SpeedMedium.tsx +13 -0
- package/src/assets/SpeedNone.tsx +13 -0
- package/src/assets/SpeedSlow.tsx +13 -0
- package/src/assets/Walk.tsx +13 -0
- package/src/assets/index.ts +22 -0
- package/src/assets/svg/blockly_logo.svg +82 -0
- package/src/assets/svg/distance.svg +40 -0
- package/src/assets/svg/jog_long.svg +1 -0
- package/src/assets/svg/jog_medium.svg +1 -0
- package/src/assets/svg/jog_short.svg +1 -0
- package/src/assets/svg/python_logo.svg +246 -0
- package/src/assets/svg/rotation_3d.svg +1 -0
- package/src/assets/svg/rotation_ccw.svg +50 -0
- package/src/assets/svg/rotation_ccw_a.svg +57 -0
- package/src/assets/svg/rotation_ccw_b.svg +57 -0
- package/src/assets/svg/rotation_ccw_c.svg +57 -0
- package/src/assets/svg/rotation_cw.svg +49 -0
- package/src/assets/svg/rotation_cw_a.svg +30 -0
- package/src/assets/svg/rotation_cw_b.svg +30 -0
- package/src/assets/svg/rotation_cw_c.svg +30 -0
- package/src/assets/svg/run.svg +1 -0
- package/src/assets/svg/speed.svg +39 -0
- package/src/assets/svg/speed_fast.svg +1 -0
- package/src/assets/svg/speed_medium.svg +1 -0
- package/src/assets/svg/speed_none.svg +1 -0
- package/src/assets/svg/speed_slow.svg +1 -0
- package/src/assets/svg/walk.svg +1 -0
- package/src/components/BlocklyEditor.css +25 -0
- package/src/components/BlocklyEditor.tsx +598 -0
- package/src/components/CodeEditor.tsx +156 -0
- package/src/components/Indicator.tsx +63 -118
- package/src/components/IndicatorButton.tsx +104 -50
- package/src/components/JogPanel.css +41 -0
- package/src/components/JogPanel.tsx +461 -0
- package/src/components/Lamp.tsx +243 -0
- package/src/components/ToggleGroup.tsx +429 -0
- package/src/components/ValueInput.tsx +261 -0
- package/src/core/ActionMode.ts +20 -0
- package/src/core/IndicatorButtonState.ts +34 -0
- package/src/core/MaskPatterns.ts +7 -1
- package/tools/copy-distribution-files.cjs +3 -2
- package/dist/components/DPad.css +0 -522
- package/dist/components/DPad.d.ts +0 -34
- package/dist/components/DPad.js +0 -1
- package/docs/enums/components_DPad.VcJoyPadAction.html +0 -10
- package/docs/enums/components_DPad.VcJoyPadButtonId.html +0 -7
- package/docs/enums/components_IndicatorButton.ActionMode.html +0 -6
- package/docs/enums/components_IndicatorColor.IndicatorColor.html +0 -23
- package/docs/functions/components_DPad.VcDPad.html +0 -5
- package/docs/interfaces/components_IndicatorButton.IndicatorButtonState.html +0 -10
- package/docs/modules/components_DPad.html +0 -5
- package/src/components/DPad.css +0 -522
- package/src/components/DPad.tsx +0 -94
- /package/dist/{components → core}/IndicatorColor.d.ts +0 -0
- /package/dist/{components → core}/IndicatorColor.js +0 -0
- /package/src/{components → core}/IndicatorColor.ts +0 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024 Automated Design Corp.. All Rights Reserved.
|
|
3
|
+
* Created Date: 2024-03-12 10:14:48
|
|
4
|
+
* -----
|
|
5
|
+
* Last Modified: 2024-03-12 20:40:14
|
|
6
|
+
* -----
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Component } from 'react';
|
|
11
|
+
import { SelectButton, SelectButtonProps } from 'primereact/selectbutton';
|
|
12
|
+
import {SelectItemOptionsType} from "primereact/selectitem";
|
|
13
|
+
|
|
14
|
+
import { EventEmitterContext, EventEmitterContextType } from '../core/EventEmitterContext';
|
|
15
|
+
import {IndicatorColor} from "../core/IndicatorColor";
|
|
16
|
+
export {IndicatorColor}
|
|
17
|
+
import { ActionMode } from '../core/ActionMode';
|
|
18
|
+
export {ActionMode};
|
|
19
|
+
|
|
20
|
+
import { IndicatorButtonState } from '../core/IndicatorButtonState';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export interface ToggleGroupProps extends SelectButtonProps {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Label of the group/row. Can be any element.
|
|
28
|
+
*
|
|
29
|
+
* ## Examples
|
|
30
|
+
* ```
|
|
31
|
+
* <ToggleGroup label="Simple Text" />
|
|
32
|
+
* <ToggleGroup label={<span><i className="pi pi-check"></i> Icon and Text</span>} />
|
|
33
|
+
* <ToggleGroup label={<YourCustomIconComponent />} />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
label? : React.ReactNode;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Topic name to monitor for state indication.
|
|
41
|
+
* If `value` field is not undefined, then that value is used instead.
|
|
42
|
+
*/
|
|
43
|
+
topic?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Color for the button when the state is TRUE.
|
|
47
|
+
*/
|
|
48
|
+
onColor?: IndicatorColor | IndicatorColor[];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Color for the button when the state is FALSE.
|
|
52
|
+
*/
|
|
53
|
+
offColor?: IndicatorColor;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Name of the command to invoke on button events.
|
|
58
|
+
* If command is "*", then the commandTopic will be dispatched
|
|
59
|
+
* internally.
|
|
60
|
+
*/
|
|
61
|
+
command?: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Optional topic parameter to send along with the command.
|
|
65
|
+
* If set, will automatically be included with commandArgs as
|
|
66
|
+
* the value of field 'topic.'
|
|
67
|
+
*/
|
|
68
|
+
commandTopic? : string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Optional arguments sent with the command.
|
|
72
|
+
*/
|
|
73
|
+
commandArgs?: any;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Topic to disable button interaction.
|
|
77
|
+
*/
|
|
78
|
+
disableTopic?: string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Topic to control the visibility of the button.
|
|
82
|
+
*/
|
|
83
|
+
invisibleTopic?: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Mode of input for the button (e.g., TAP, TOGGLE).
|
|
87
|
+
*/
|
|
88
|
+
actionMode?: ActionMode;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Inverts the signal values for TAP, PRESSED, and RELEASED modes.
|
|
92
|
+
*/
|
|
93
|
+
invert?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
* @param s string | undefined[]
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
// function generateSelectButtonOptions(s? : SelectItemOptionsType | undefined) : SelectItemOptionsType | undefined {
|
|
103
|
+
// if (s !== undefined && s !== null) {
|
|
104
|
+
// let ret : SelectItemOptionsType = [];
|
|
105
|
+
// for (let i=0;i<s.length;++i) {
|
|
106
|
+
// ret.push({label:s[i]});
|
|
107
|
+
// }
|
|
108
|
+
|
|
109
|
+
// return ret;
|
|
110
|
+
// }
|
|
111
|
+
// else {
|
|
112
|
+
// return undefined;
|
|
113
|
+
// }
|
|
114
|
+
// }
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @param currentValue
|
|
120
|
+
* @param options
|
|
121
|
+
* @returns
|
|
122
|
+
*/
|
|
123
|
+
function matchCurrentValue(currentValue : any, options : SelectItemOptionsType | undefined) : any {
|
|
124
|
+
|
|
125
|
+
if (options === undefined || options === null || options.length === 0)
|
|
126
|
+
return undefined;
|
|
127
|
+
|
|
128
|
+
let t = typeof(currentValue);
|
|
129
|
+
if (t == "boolean" ) {
|
|
130
|
+
let b = currentValue as boolean;
|
|
131
|
+
if (b) {
|
|
132
|
+
if (options.length > 1 )
|
|
133
|
+
return options[1];
|
|
134
|
+
else
|
|
135
|
+
return options[0];
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return options[0];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else if (t == "number") {
|
|
142
|
+
let n = currentValue as number;
|
|
143
|
+
if (n !== undefined && n < options.length ) {
|
|
144
|
+
return options[n];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else if (t == "string") {
|
|
148
|
+
// The SelectButton should match to this value automatically, if it's in the
|
|
149
|
+
// options array. No reason to search twice.
|
|
150
|
+
return currentValue;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
*
|
|
161
|
+
* @param currentValue
|
|
162
|
+
* @param options
|
|
163
|
+
* @returns
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
function selectOnColor(
|
|
167
|
+
currentValue: any,
|
|
168
|
+
options: SelectItemOptionsType | undefined,
|
|
169
|
+
onColorProp: IndicatorColor | IndicatorColor[] | undefined
|
|
170
|
+
): IndicatorColor {
|
|
171
|
+
|
|
172
|
+
if (!options || options.length === 0)
|
|
173
|
+
return IndicatorColor.IndicatorInvalid;
|
|
174
|
+
|
|
175
|
+
let colorArray =
|
|
176
|
+
Array.isArray(onColorProp) ? onColorProp :
|
|
177
|
+
onColorProp !== undefined ? [onColorProp] : [IndicatorColor.IndicatorInvalid];
|
|
178
|
+
|
|
179
|
+
let t = typeof(currentValue);
|
|
180
|
+
if (t === "boolean") {
|
|
181
|
+
return currentValue ? colorArray[0] : colorArray.length > 1 ? colorArray[1] : colorArray[0];
|
|
182
|
+
}
|
|
183
|
+
else if (t === "number" && options.length > currentValue) {
|
|
184
|
+
if (colorArray.length > currentValue) {
|
|
185
|
+
let index = currentValue as number;
|
|
186
|
+
return colorArray[index];
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
return colorArray[0];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else if (t === "string") {
|
|
193
|
+
let index = options.indexOf(currentValue);
|
|
194
|
+
if (index !== -1 && index < colorArray.length)
|
|
195
|
+
return colorArray[index];
|
|
196
|
+
else
|
|
197
|
+
return colorArray[0];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (onColorProp !== undefined && onColorProp !== null) {
|
|
201
|
+
return Array.isArray(onColorProp) ? onColorProp[0] : onColorProp as IndicatorColor;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return IndicatorColor.IndicatorInvalid;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
export class ToggleGroup extends Component<ToggleGroupProps, IndicatorButtonState> {
|
|
211
|
+
|
|
212
|
+
static contextType = EventEmitterContext;
|
|
213
|
+
|
|
214
|
+
constructor(props: ToggleGroupProps) {
|
|
215
|
+
super(props);
|
|
216
|
+
this.state = {
|
|
217
|
+
currentValue: undefined,
|
|
218
|
+
isDisabled: false,
|
|
219
|
+
isInvisible: false,
|
|
220
|
+
isPressed: false
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
componentDidMount() {
|
|
225
|
+
this.setupSubscriptions();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
componentDidUpdate(prevProps: ToggleGroupProps) {
|
|
229
|
+
prevProps;
|
|
230
|
+
// Logic to handle updates in props, if necessary
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
componentWillUnmount() {
|
|
234
|
+
// Unsubscribe logic if needed
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Sets up subscriptions based on provided topics.
|
|
239
|
+
*/
|
|
240
|
+
private setupSubscriptions() {
|
|
241
|
+
const { topic, disableTopic, invisibleTopic } = this.props;
|
|
242
|
+
const { subscribe } = this.context as EventEmitterContextType;
|
|
243
|
+
|
|
244
|
+
if (topic) {
|
|
245
|
+
// Subscribe to the main topic
|
|
246
|
+
subscribe(topic, this.handleTopicUpdate);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (disableTopic) {
|
|
250
|
+
// Subscribe to the disable topic
|
|
251
|
+
subscribe(disableTopic, this.handleDisableTopicUpdate);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (invisibleTopic) {
|
|
255
|
+
// Subscribe to the invisible topic
|
|
256
|
+
subscribe(invisibleTopic, this.handleInvisibleTopicUpdate);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Handles updates for the main topic.
|
|
262
|
+
*/
|
|
263
|
+
private handleTopicUpdate = (value: boolean) => {
|
|
264
|
+
this.setState({ currentValue: value });
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Handles updates for the disable topic.
|
|
269
|
+
*/
|
|
270
|
+
private handleDisableTopicUpdate = (value: boolean) => {
|
|
271
|
+
this.setState({ isDisabled: value });
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Handles updates for the invisible topic.
|
|
276
|
+
*/
|
|
277
|
+
private handleInvisibleTopicUpdate = (value: boolean) => {
|
|
278
|
+
this.setState({ isInvisible: value });
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Handle the button being pressed down. Used for TAP and PRESSED action modes.
|
|
284
|
+
*/
|
|
285
|
+
protected handleOnPressed() {
|
|
286
|
+
const { isPressed } = this.state;
|
|
287
|
+
const {actionMode} = this.props;
|
|
288
|
+
|
|
289
|
+
if (!isPressed) {
|
|
290
|
+
this.setState({isPressed: true});
|
|
291
|
+
|
|
292
|
+
if (actionMode === ActionMode.Tap || actionMode === ActionMode.Pressed) {
|
|
293
|
+
this.dispatchCommand(true);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Handle the button being released. Used for TAP and RELEASED action modes.
|
|
300
|
+
*/
|
|
301
|
+
protected handleOnReleased() {
|
|
302
|
+
const { isPressed } = this.state;
|
|
303
|
+
const {actionMode} = this.props;
|
|
304
|
+
|
|
305
|
+
if (isPressed) {
|
|
306
|
+
this.setState({isPressed: false});
|
|
307
|
+
|
|
308
|
+
if (actionMode === ActionMode.Tap ) {
|
|
309
|
+
this.dispatchCommand(false);
|
|
310
|
+
}
|
|
311
|
+
else if (actionMode === ActionMode.Released) {
|
|
312
|
+
this.dispatchCommand(true);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Dispatch a value to any listeners.
|
|
320
|
+
* @param value The value to dispatch as part of the payload.
|
|
321
|
+
*/
|
|
322
|
+
protected dispatchCommand(value : any) {
|
|
323
|
+
|
|
324
|
+
const {command, commandTopic, commandArgs} = this.props;
|
|
325
|
+
const { dispatch } = this.context as EventEmitterContextType;
|
|
326
|
+
|
|
327
|
+
if (command !== undefined && command !== null && command.length > 0 )
|
|
328
|
+
{
|
|
329
|
+
const payload = {
|
|
330
|
+
topic: commandTopic,
|
|
331
|
+
value: value,
|
|
332
|
+
...commandArgs
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
dispatch({
|
|
336
|
+
topic: command,
|
|
337
|
+
payload: payload
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
render() {
|
|
348
|
+
// const { currentValue, isDisabled, isInvisible } = this.state;
|
|
349
|
+
// const { className, severity, label, raised,
|
|
350
|
+
// onColor, offColor, options, topic, command,
|
|
351
|
+
// commandArgs, disableTopic, invisibleTopic, inputMode, invert,
|
|
352
|
+
// onIcon, offIcon, icon,
|
|
353
|
+
// ...restProps
|
|
354
|
+
// } = this.props;
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
const { currentValue, isDisabled, isInvisible} = this.state;
|
|
358
|
+
const { label, value, disabled, className,
|
|
359
|
+
onColor, offColor, options,
|
|
360
|
+
...restProps
|
|
361
|
+
} = this.props;
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
// let btnIcon = currentValue ? onIcon : offIcon;
|
|
365
|
+
// if (btnIcon === undefined || btnIcon === null || btnIcon.length === 0)
|
|
366
|
+
// btnIcon = icon;
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
//
|
|
370
|
+
// Load the value from the proper source.
|
|
371
|
+
// If the `value` property is undefined, that takes precedence.
|
|
372
|
+
//
|
|
373
|
+
let displayValue = currentValue;
|
|
374
|
+
if (value !== undefined) {
|
|
375
|
+
displayValue = value;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
let color = selectOnColor(displayValue, options, onColor); // displayValue ? onColor : offColor;
|
|
379
|
+
|
|
380
|
+
// Handle special cases like undefined state or specific input modes
|
|
381
|
+
if (displayValue === undefined) {
|
|
382
|
+
color = IndicatorColor.IndicatorInvalid;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const isMultiple = options !== undefined && options !== null && options.length > 2;
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
return (
|
|
389
|
+
<div className="flex">
|
|
390
|
+
|
|
391
|
+
<style>{`
|
|
392
|
+
${offColor !== undefined ? `
|
|
393
|
+
.togglegroup-selectbutton-container .p-selectbutton .p-button {
|
|
394
|
+
background-color: ${offColor};
|
|
395
|
+
}
|
|
396
|
+
` : ''}
|
|
397
|
+
.togglegroup-selectbutton-container .p-selectbutton .p-button.p-highlight {
|
|
398
|
+
background-color: ${color} !important;
|
|
399
|
+
border-color: ${color} !important;
|
|
400
|
+
}
|
|
401
|
+
.togglegroup-selectbutton-container .p-selectbutton .p-highlight {
|
|
402
|
+
background-color: ${color} !important;
|
|
403
|
+
border-color: ${color} !important;
|
|
404
|
+
}
|
|
405
|
+
`}
|
|
406
|
+
</style>
|
|
407
|
+
<div className='p-inputgroup togglegroup-selectbutton-container'>
|
|
408
|
+
<span className="p-inputgroup-addon" style={{flexGrow: 1}}>
|
|
409
|
+
{label}
|
|
410
|
+
</span>
|
|
411
|
+
<SelectButton {...restProps}
|
|
412
|
+
options={options}
|
|
413
|
+
disabled={isDisabled || disabled}
|
|
414
|
+
multiple={isMultiple}
|
|
415
|
+
className={`${className || ''} ${displayValue === undefined ? 'p-invalid' : ''}`.trim()}
|
|
416
|
+
{...(isInvisible && { style: { display: 'none' }})}
|
|
417
|
+
value={matchCurrentValue(displayValue, options)}
|
|
418
|
+
allowEmpty={false}
|
|
419
|
+
onMouseDown={() => this.handleOnPressed() }
|
|
420
|
+
onTouchStart={() => this.handleOnPressed() }
|
|
421
|
+
onMouseUp={() => this.handleOnReleased() }
|
|
422
|
+
onTouchEnd={() => this.handleOnReleased() }
|
|
423
|
+
/>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024 Automated Design Corp.. All Rights Reserved.
|
|
3
|
+
* Created Date: 2024-03-20 13:05:42
|
|
4
|
+
* -----
|
|
5
|
+
* Last Modified: 2024-03-20 16:22:06
|
|
6
|
+
* -----
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import React from "react";
|
|
12
|
+
|
|
13
|
+
import { InputText } from 'primereact/inputtext';
|
|
14
|
+
import { Button } from "primereact/button";
|
|
15
|
+
|
|
16
|
+
import { EventEmitterContext } from "../core/EventEmitterContext.js";
|
|
17
|
+
import { KeyFilterType } from "primereact/keyfilter";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Properties of the Configuration View
|
|
21
|
+
*/
|
|
22
|
+
interface ValueInputProps {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The label for the ValueInput field.
|
|
26
|
+
*/
|
|
27
|
+
label : React.ReactNode | undefined;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The value for the field.
|
|
32
|
+
*/
|
|
33
|
+
value : string | undefined;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Optional filter for key entry. Not a validator, but won't accept keystrokes outside the filter.
|
|
38
|
+
* @type {RegExp | "pint" | "int" | "pnum" | "money" | "num" | "hex" | "email" | "alpha" | "alphanum"}
|
|
39
|
+
*/
|
|
40
|
+
keyFilter : KeyFilterType | undefined;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* An optional prefix before the data entry field.
|
|
45
|
+
*/
|
|
46
|
+
prefix : React.ReactNode | undefined;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An optional prefix before the data entry field.
|
|
50
|
+
*/
|
|
51
|
+
suffix : React.ReactNode | undefined;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A small, advisory text below the field.
|
|
55
|
+
*/
|
|
56
|
+
description : React.ReactNode | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* If true, all functions of the field will be disabled.
|
|
60
|
+
*/
|
|
61
|
+
disabled : boolean | undefined;
|
|
62
|
+
|
|
63
|
+
/** Topic on which the value will be dispatched through the user interfave on successful data entry. */
|
|
64
|
+
dispatchTopic : string | undefined;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Placeholder string to display if the value is empty.
|
|
68
|
+
*/
|
|
69
|
+
placeholder : string | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The user has accepted a new value.
|
|
73
|
+
* @param newValue New value accepted by the user.
|
|
74
|
+
*/
|
|
75
|
+
onValueChanged?(newValue: string) : void;
|
|
76
|
+
/** Regular expression used to validate the value before it is broadcast */
|
|
77
|
+
validator : RegExp;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* State variables of the Configuration View
|
|
82
|
+
*/
|
|
83
|
+
interface ValueInputState {
|
|
84
|
+
|
|
85
|
+
entryValue : string | undefined;
|
|
86
|
+
isValid : boolean;
|
|
87
|
+
editing : boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A convenient field with all the usual features of inputing values.
|
|
93
|
+
* Wraps the common features of use of a InputText, p-inputgroup, some icon buttons,
|
|
94
|
+
* accepting and rejecting values and keyboard management.
|
|
95
|
+
*/
|
|
96
|
+
export class ValueInput extends React.Component<ValueInputProps, ValueInputState> {
|
|
97
|
+
|
|
98
|
+
// Here's an example of using the Application-wide EventEmitter con
|
|
99
|
+
// Define the contextType for the class to access the context
|
|
100
|
+
static contextType = EventEmitterContext;
|
|
101
|
+
// After specifying contextType, you can declare the context's type for the TypeScript compiler.
|
|
102
|
+
// Basically, we're telling TypeScript the type of the context; this line doesn't
|
|
103
|
+
// actually do any linking linking to the EventEmitterContext.
|
|
104
|
+
declare context: React.ContextType<typeof EventEmitterContext>;
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Default properties for the component.
|
|
111
|
+
*/
|
|
112
|
+
static defaultProps = {
|
|
113
|
+
label : '',
|
|
114
|
+
value : undefined,
|
|
115
|
+
keyFilter : undefined,
|
|
116
|
+
writeTopic : undefined,
|
|
117
|
+
onValueChanged : undefined,
|
|
118
|
+
description: undefined,
|
|
119
|
+
prefix: undefined,
|
|
120
|
+
suffix : undefined,
|
|
121
|
+
disabled : false,
|
|
122
|
+
dispatchTopic : undefined,
|
|
123
|
+
placeholder : undefined,
|
|
124
|
+
validator : undefined
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @param {FooterViewProps} props
|
|
130
|
+
*/
|
|
131
|
+
constructor(props : ValueInputProps) {
|
|
132
|
+
super(props);
|
|
133
|
+
this.state = {
|
|
134
|
+
entryValue : props.value,
|
|
135
|
+
isValid : props.value !== undefined ? this.validateValue(props.value) : false,
|
|
136
|
+
editing : false
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The component has been loaded into the DOM.
|
|
142
|
+
*/
|
|
143
|
+
componentDidMount() {
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Check the new value against the validator RegEx, if one was specified.
|
|
150
|
+
* @param val The new value.
|
|
151
|
+
* @returns True if no validator specified or the value is valid, false if not valid.
|
|
152
|
+
*/
|
|
153
|
+
private validateValue = (val : string) => {
|
|
154
|
+
|
|
155
|
+
if (this.props.validator !== undefined && this.props.validator !== null) {
|
|
156
|
+
return this.props.validator.test(val);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The user has elected to accept the input value. Validate and store, if valid.
|
|
167
|
+
*/
|
|
168
|
+
private onAcceptValue() {
|
|
169
|
+
if (this.state.entryValue !== undefined ) {
|
|
170
|
+
if (this.validateValue(this.state.entryValue) ) {
|
|
171
|
+
this.setState({isValid : true, editing : false});
|
|
172
|
+
|
|
173
|
+
if (this.props.onValueChanged)
|
|
174
|
+
this.props.onValueChanged(this.state.entryValue);
|
|
175
|
+
|
|
176
|
+
if (this.props.dispatchTopic !== undefined) {
|
|
177
|
+
this.context.dispatch({topic: this.props.dispatchTopic, payload:this.state.entryValue});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
this.setState({isValid : false});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
this.setState({isValid: false});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* The user wishes to reset/cancel the previous value.
|
|
192
|
+
*/
|
|
193
|
+
private onResetValue() {
|
|
194
|
+
this.setState({
|
|
195
|
+
entryValue: this.props.value,
|
|
196
|
+
isValid: this.props.value !== undefined ? this.validateValue(this.props.value) : false,
|
|
197
|
+
editing : false
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
render() {
|
|
203
|
+
|
|
204
|
+
return(
|
|
205
|
+
<div>
|
|
206
|
+
<div className="p-inputgroup flex-1" >
|
|
207
|
+
<span className="p-inputgroup-addon">
|
|
208
|
+
{this.props.label}
|
|
209
|
+
</span>
|
|
210
|
+
{ this.props.prefix !== undefined &&
|
|
211
|
+
<span className="p-inputgroup-addon">
|
|
212
|
+
{this.props.prefix}
|
|
213
|
+
</span>
|
|
214
|
+
}
|
|
215
|
+
<InputText
|
|
216
|
+
keyfilter={this.props.keyFilter}
|
|
217
|
+
placeholder={this.props.placeholder}
|
|
218
|
+
value={this.state.entryValue}
|
|
219
|
+
onChange={(e) => {this.setState({entryValue: e.target.value, editing : true})} }
|
|
220
|
+
className={this.state.isValid ? '' : 'p-invalid'}
|
|
221
|
+
onKeyDown={(e) => {
|
|
222
|
+
if (e.key === 'Enter') {
|
|
223
|
+
this.onAcceptValue();
|
|
224
|
+
}
|
|
225
|
+
else if (e.key === 'Escape') {
|
|
226
|
+
this.onResetValue();
|
|
227
|
+
}
|
|
228
|
+
}}
|
|
229
|
+
disabled={this.props.disabled}
|
|
230
|
+
/>
|
|
231
|
+
{ this.props.suffix !== undefined &&
|
|
232
|
+
<span className="p-inputgroup-addon">
|
|
233
|
+
{this.props.suffix}
|
|
234
|
+
</span>
|
|
235
|
+
}
|
|
236
|
+
<Button
|
|
237
|
+
icon="pi pi-check"
|
|
238
|
+
disabled={this.props.disabled || !this.state.editing}
|
|
239
|
+
className="p-button-success"
|
|
240
|
+
onClick={() => this.onAcceptValue()}
|
|
241
|
+
/>
|
|
242
|
+
|
|
243
|
+
<Button
|
|
244
|
+
icon="pi pi-times"
|
|
245
|
+
disabled={this.props.disabled || !this.state.editing}
|
|
246
|
+
className="p-button-danger"
|
|
247
|
+
onClickCapture={()=>this.onResetValue()}
|
|
248
|
+
/>
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
{this.props.description !== undefined &&
|
|
252
|
+
<small>{this.props.description}</small>
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024 Automated Design Corp.. All Rights Reserved.
|
|
3
|
+
* Created Date: 2024-03-12 10:28:38
|
|
4
|
+
* -----
|
|
5
|
+
* Last Modified: 2024-03-12 10:28:47
|
|
6
|
+
* -----
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Enum for different input modes of the IndicatorButton.
|
|
14
|
+
*/
|
|
15
|
+
export enum ActionMode {
|
|
16
|
+
Tap = 'Tap',
|
|
17
|
+
Toggle = 'Toggle',
|
|
18
|
+
Pressed = 'Pressed',
|
|
19
|
+
Released = 'Released'
|
|
20
|
+
}
|