@elyra/canvas 12.27.1 → 12.28.1

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.
Files changed (181) hide show
  1. package/dist/{canvas-constants-07dbe4b7.js → canvas-constants-046e4126.js} +2 -2
  2. package/dist/{canvas-constants-07dbe4b7.js.map → canvas-constants-046e4126.js.map} +1 -1
  3. package/dist/canvas-constants-f4e65d4d.js +2 -0
  4. package/dist/canvas-constants-f4e65d4d.js.map +1 -0
  5. package/dist/{canvas-controller-01c28c3a.js → canvas-controller-1bbd9c0e.js} +2 -2
  6. package/dist/canvas-controller-1bbd9c0e.js.map +1 -0
  7. package/dist/canvas-controller-d6aa7d4d.js +2 -0
  8. package/dist/canvas-controller-d6aa7d4d.js.map +1 -0
  9. package/dist/common-canvas-9c735f47.js +2 -0
  10. package/dist/common-canvas-9c735f47.js.map +1 -0
  11. package/dist/common-canvas-a02e75c1.js +2 -0
  12. package/dist/common-canvas-a02e75c1.js.map +1 -0
  13. package/dist/common-canvas.es.js +1 -1
  14. package/dist/common-canvas.js +1 -1
  15. package/dist/common-properties-3b9f3106.js +2 -0
  16. package/dist/common-properties-3b9f3106.js.map +1 -0
  17. package/dist/common-properties-86b9b936.js +2 -0
  18. package/dist/common-properties-86b9b936.js.map +1 -0
  19. package/dist/datarecord-metadata-v3-schema-6a3754ce.js +1 -1
  20. package/dist/datarecord-metadata-v3-schema-6a3754ce.js.map +1 -1
  21. package/dist/datarecord-metadata-v3-schema-ba1f2849.js +1 -1
  22. package/dist/datarecord-metadata-v3-schema-ba1f2849.js.map +1 -1
  23. package/dist/en-7201b548.js +1 -1
  24. package/dist/en-7201b548.js.map +1 -1
  25. package/dist/en-a08356c8.js +1 -1
  26. package/dist/en-a08356c8.js.map +1 -1
  27. package/dist/{extends-de3127ea.js → extends-7d4f15b6.js} +2 -2
  28. package/dist/extends-7d4f15b6.js.map +1 -0
  29. package/dist/extends-d144eab9.js +7 -0
  30. package/dist/extends-d144eab9.js.map +1 -0
  31. package/dist/flexible-table-8219d7a0.js +2 -0
  32. package/dist/flexible-table-8219d7a0.js.map +1 -0
  33. package/dist/flexible-table-f5d55fe4.js +2 -0
  34. package/dist/flexible-table-f5d55fe4.js.map +1 -0
  35. package/dist/{icon-63afae46.js → icon-221bb2e5.js} +2 -2
  36. package/dist/{icon-63afae46.js.map → icon-221bb2e5.js.map} +1 -1
  37. package/dist/icon-ea917a08.js +2 -0
  38. package/dist/{icon-94bf4b86.js.map → icon-ea917a08.js.map} +1 -1
  39. package/dist/index-17b33a9b.js +2 -0
  40. package/dist/index-17b33a9b.js.map +1 -0
  41. package/dist/index-ac265f1e.js +2 -0
  42. package/dist/index-ac265f1e.js.map +1 -0
  43. package/dist/isArrayLikeObject-a9c7973b.js +1 -1
  44. package/dist/isArrayLikeObject-a9c7973b.js.map +1 -1
  45. package/dist/isArrayLikeObject-f3b27f64.js +1 -1
  46. package/dist/isArrayLikeObject-f3b27f64.js.map +1 -1
  47. package/dist/lib/canvas-controller.es.js +1 -1
  48. package/dist/lib/canvas-controller.js +1 -1
  49. package/dist/lib/canvas.es.js +1 -1
  50. package/dist/lib/canvas.js +1 -1
  51. package/dist/lib/context-menu.es.js +1 -1
  52. package/dist/lib/context-menu.js +1 -1
  53. package/dist/lib/properties/field-picker.es.js +1 -1
  54. package/dist/lib/properties/field-picker.js +1 -1
  55. package/dist/lib/properties/flexible-table.es.js +1 -1
  56. package/dist/lib/properties/flexible-table.js +1 -1
  57. package/dist/lib/properties.es.js +1 -1
  58. package/dist/lib/properties.js +1 -1
  59. package/dist/lib/tooltip.es.js +1 -1
  60. package/dist/lib/tooltip.es.js.map +1 -1
  61. package/dist/lib/tooltip.js +1 -1
  62. package/dist/lib/tooltip.js.map +1 -1
  63. package/dist/styles/common-canvas.min.css +1 -1
  64. package/dist/styles/common-canvas.min.css.map +1 -1
  65. package/dist/toolbar-2bbc9542.js +2 -0
  66. package/dist/toolbar-2bbc9542.js.map +1 -0
  67. package/dist/toolbar-c173e22a.js +2 -0
  68. package/dist/toolbar-c173e22a.js.map +1 -0
  69. package/locales/common-properties/locales/de.json +2 -1
  70. package/locales/common-properties/locales/en.json +2 -0
  71. package/locales/common-properties/locales/eo.json +2 -0
  72. package/locales/common-properties/locales/es.json +3 -2
  73. package/locales/common-properties/locales/fr.json +2 -1
  74. package/locales/common-properties/locales/it.json +2 -1
  75. package/locales/common-properties/locales/ja.json +2 -1
  76. package/locales/common-properties/locales/ko.json +2 -1
  77. package/locales/common-properties/locales/pt-br.json +2 -1
  78. package/locales/common-properties/locales/sv.json +2 -1
  79. package/locales/common-properties/locales/zh-CN.json +5 -4
  80. package/locales/common-properties/locales/zh-TW.json +2 -1
  81. package/locales/notification-panel/locales/de.json +3 -0
  82. package/locales/notification-panel/locales/es.json +3 -0
  83. package/locales/notification-panel/locales/fr.json +3 -0
  84. package/locales/notification-panel/locales/it.json +3 -0
  85. package/locales/notification-panel/locales/ja.json +3 -0
  86. package/locales/notification-panel/locales/ko.json +3 -0
  87. package/locales/notification-panel/locales/pt-BR.json +3 -0
  88. package/locales/notification-panel/locales/sv.json +3 -0
  89. package/locales/notification-panel/locales/zh-CN.json +3 -0
  90. package/locales/notification-panel/locales/zh-TW.json +3 -0
  91. package/package.json +1 -1
  92. package/src/common-canvas/canvas-controller.js +31 -0
  93. package/src/common-canvas/cc-toolbar.jsx +5 -5
  94. package/src/common-canvas/constants/canvas-constants.js +2 -0
  95. package/src/common-canvas/svg-canvas-renderer.js +29 -14
  96. package/src/common-properties/actions/button/button.jsx +1 -3
  97. package/src/common-properties/actions/image/image.jsx +1 -3
  98. package/src/common-properties/common-properties.jsx +8 -5
  99. package/src/common-properties/components/control-item/control-item.jsx +1 -3
  100. package/src/common-properties/components/control-item/control-item.scss +2 -0
  101. package/src/common-properties/components/field-picker/field-picker.jsx +1 -3
  102. package/src/common-properties/components/truncated-content-tooltip/truncated-content-tooltip.jsx +11 -3
  103. package/src/common-properties/components/truncated-content-tooltip/truncated-content-tooltip.scss +1 -1
  104. package/src/common-properties/components/validation-message/validation-message.jsx +1 -2
  105. package/src/common-properties/components/virtualized-table/virtualized-table.jsx +18 -31
  106. package/src/common-properties/constants/constants.js +12 -1
  107. package/src/common-properties/constants/form-constants.js +2 -0
  108. package/src/common-properties/controls/abstract-table.jsx +7 -4
  109. package/src/common-properties/controls/checkbox/checkbox.jsx +1 -2
  110. package/src/common-properties/controls/checkboxset/checkboxset.jsx +1 -1
  111. package/src/common-properties/controls/control-factory.js +10 -0
  112. package/src/common-properties/controls/controls.scss +3 -1
  113. package/src/common-properties/controls/datepicker/datepicker.jsx +118 -0
  114. package/src/common-properties/controls/datepicker/datepicker.scss +23 -0
  115. package/src/common-properties/controls/datepicker/index.js +18 -0
  116. package/src/common-properties/controls/datepicker-range/datepicker-range.jsx +194 -0
  117. package/src/common-properties/controls/datepicker-range/datepicker-range.scss +21 -0
  118. package/src/common-properties/controls/datepicker-range/index.js +18 -0
  119. package/src/common-properties/controls/dropdown/dropdown.jsx +2 -1
  120. package/src/common-properties/controls/expression/expression-builder/expression-select-field-function.jsx +3 -2
  121. package/src/common-properties/controls/expression/expression-builder/expression-select-operator.jsx +1 -3
  122. package/src/common-properties/controls/radioset/radioset.jsx +1 -1
  123. package/src/common-properties/controls/readonly/readonly.jsx +7 -0
  124. package/src/common-properties/controls/textarea/textarea.jsx +3 -2
  125. package/src/common-properties/controls/textfield/textfield.jsx +15 -17
  126. package/src/common-properties/controls/textfield/textfield.scss +1 -0
  127. package/src/common-properties/form/EditorForm.js +5 -1
  128. package/src/common-properties/form/Form.js +2 -8
  129. package/src/common-properties/panels/sub-panel/cell.jsx +1 -2
  130. package/src/common-properties/panels/summary/summary.jsx +12 -12
  131. package/src/common-properties/panels/summary/summary.scss +4 -10
  132. package/src/common-properties/properties-controller.js +15 -6
  133. package/src/common-properties/properties-main/properties-main.jsx +11 -3
  134. package/src/common-properties/ui-conditions/condition-ops/contains.js +1 -1
  135. package/src/common-properties/ui-conditions/condition-ops/greaterThan.js +22 -1
  136. package/src/common-properties/ui-conditions/condition-ops/isDateTime.js +9 -6
  137. package/src/common-properties/ui-conditions/condition-ops/isEmpty.js +7 -1
  138. package/src/common-properties/ui-conditions/condition-ops/isNotEmpty.js +5 -1
  139. package/src/common-properties/ui-conditions/condition-ops/lessThan.js +22 -1
  140. package/src/common-properties/ui-conditions/condition-ops/notContains.js +1 -1
  141. package/src/common-properties/ui-conditions/conditions-utils.js +5 -5
  142. package/src/common-properties/util/control-utils.js +18 -3
  143. package/src/common-properties/util/date-utils.js +152 -0
  144. package/src/common-properties/util/property-utils.js +29 -12
  145. package/src/object-model/api-pipeline.js +1 -0
  146. package/src/object-model/object-model.js +12 -0
  147. package/src/object-model/redux/reducers/canvasinfo.js +8 -0
  148. package/src/themes/light.scss +16 -0
  149. package/src/toolbar/toolbar-action-item.jsx +9 -7
  150. package/src/tooltip/tooltip.jsx +28 -15
  151. package/src/tooltip/tooltip.scss +7 -7
  152. package/stats.html +1 -1
  153. package/dist/canvas-constants-ba465147.js +0 -2
  154. package/dist/canvas-constants-ba465147.js.map +0 -1
  155. package/dist/canvas-controller-01c28c3a.js.map +0 -1
  156. package/dist/canvas-controller-fc5bee30.js +0 -2
  157. package/dist/canvas-controller-fc5bee30.js.map +0 -1
  158. package/dist/common-canvas-4f99983f.js +0 -2
  159. package/dist/common-canvas-4f99983f.js.map +0 -1
  160. package/dist/common-canvas-e1879d85.js +0 -2
  161. package/dist/common-canvas-e1879d85.js.map +0 -1
  162. package/dist/common-properties-9a5037f4.js +0 -2
  163. package/dist/common-properties-9a5037f4.js.map +0 -1
  164. package/dist/common-properties-cae41b08.js +0 -2
  165. package/dist/common-properties-cae41b08.js.map +0 -1
  166. package/dist/extends-86f8d713.js +0 -7
  167. package/dist/extends-86f8d713.js.map +0 -1
  168. package/dist/extends-de3127ea.js.map +0 -1
  169. package/dist/flexible-table-d68c24c6.js +0 -2
  170. package/dist/flexible-table-d68c24c6.js.map +0 -1
  171. package/dist/flexible-table-f14863ac.js +0 -2
  172. package/dist/flexible-table-f14863ac.js.map +0 -1
  173. package/dist/icon-94bf4b86.js +0 -2
  174. package/dist/index-5c0ad9bb.js +0 -2
  175. package/dist/index-5c0ad9bb.js.map +0 -1
  176. package/dist/index-fc1b32b4.js +0 -2
  177. package/dist/index-fc1b32b4.js.map +0 -1
  178. package/dist/toolbar-393d299e.js +0 -2
  179. package/dist/toolbar-393d299e.js.map +0 -1
  180. package/dist/toolbar-91001066.js +0 -2
  181. package/dist/toolbar-91001066.js.map +0 -1
@@ -26,6 +26,7 @@ import * as PropertyUtils from "./../util/property-utils";
26
26
  import classNames from "classnames";
27
27
  import { Add16, TrashCan16, Edit16 } from "@carbon/icons-react";
28
28
  import { ControlType, EditStyle } from "./../constants/form-constants";
29
+ import { v4 as uuid4 } from "uuid";
29
30
 
30
31
  import { MESSAGE_KEYS, STATES, TABLE_SUBPANEL_BUTTON_WIDTH, SORT_DIRECTION, ROW_SELECTION, UPDATE_TYPE } from "./../constants/constants";
31
32
 
@@ -80,6 +81,7 @@ export default class AbstractTable extends React.Component {
80
81
  this.selectSummaryPropertyName = "table-multi-select-edit-property-" + props.control.name;
81
82
  props.controller.saveControls([{ name: this.selectSummaryPropertyName }]);
82
83
  this.setSelectedSummaryRowValue(props.selectedRows);
84
+ this.uuid = uuid4();
83
85
  }
84
86
 
85
87
  componentDidMount() {
@@ -697,9 +699,8 @@ export default class AbstractTable extends React.Component {
697
699
 
698
700
  makeHeader(sortFields, filterFields) {
699
701
  const headers = [];
700
- for (var j = 0; j < this.props.control.subControls.length; j++) {
702
+ for (let j = 0; j < this.props.control.subControls.length; j++) {
701
703
  const columnDef = this.props.control.subControls[j];
702
- const checkboxName = this.props.control.name + j; // TODO might not be unique
703
704
  // See if the entire column is disabled
704
705
  const colState = this.props.controller.getControlState({ name: this.props.control.name, col: j });
705
706
  const disabled = colState === STATES.DISABLED || colState === STATES.HIDDEN;
@@ -707,7 +708,7 @@ export default class AbstractTable extends React.Component {
707
708
  ? (
708
709
  <Checkbox
709
710
  disabled={disabled}
710
- id={checkboxName}
711
+ id={`properties-at-header-cb-${this.uuid}-${this.props.control.name}=${j}`}
711
712
  checked={this.checkedAll(j)}
712
713
  onChange={this.checkedAllValue.bind(this, j)}
713
714
  labelText={columnDef.label.text}
@@ -722,7 +723,9 @@ export default class AbstractTable extends React.Component {
722
723
  "width": columnDef.width,
723
724
  "description": (columnDef.description ? columnDef.description.text : null),
724
725
  "resizable": columnDef.resizable ? columnDef.resizable : false,
725
- "operation": (columnDef.generatedValues && columnDef.generatedValues.operation ? columnDef.generatedValues.operation : null) });
726
+ "operation": (columnDef.generatedValues && columnDef.generatedValues.operation ? columnDef.generatedValues.operation : null),
727
+ "disabled": disabled
728
+ });
726
729
  if (columnDef.filterable) {
727
730
  filterFields.push(columnDef.name);
728
731
  }
@@ -23,7 +23,6 @@ import ValidationMessage from "./../../components/validation-message";
23
23
  import * as ControlUtils from "./../../util/control-utils";
24
24
  import { STATES, CARBON_ICONS } from "./../../constants/constants.js";
25
25
  import Tooltip from "./../../../tooltip/tooltip.jsx";
26
- import { v4 as uuid4 } from "uuid";
27
26
  import classNames from "classnames";
28
27
  import Icon from "./../../../icons/icon";
29
28
 
@@ -40,7 +39,7 @@ class CheckboxControl extends React.Component {
40
39
 
41
40
  render() {
42
41
  const label = this.props.control.label ? this.props.control.label.text : "";
43
- const tooltipId = uuid4() + "-tooltip-" + this.props.control.name;
42
+ const tooltipId = "tooltip-" + this.props.control.name;
44
43
  let tooltip = "";
45
44
  if (this.props.control.description && !(this.props.state === STATES.DISABLED || this.props.state === STATES.HIDDEN) && !this.props.tableControl) {
46
45
  tooltip = (
@@ -94,7 +94,7 @@ class CheckboxsetControl extends React.Component {
94
94
  <span >{this.props.control.valueDescs[i]}</span>
95
95
  );
96
96
  tooltipIcon = (<Tooltip
97
- id={`tooltip-${this.uuid}-${i}`}
97
+ id={`tooltip-${i}`}
98
98
  tip={tooltip}
99
99
  direction="bottom"
100
100
  className="properties-tooltips"
@@ -33,6 +33,8 @@ import ExpressionControl from "./expression";
33
33
  import PasswordControl from "./passwordfield";
34
34
  import NumberfieldControl from "./numberfield";
35
35
  import DatefieldControl from "./datefield";
36
+ import DatepickerControl from "./datepicker";
37
+ import DatepickerRangeControl from "./datepicker-range";
36
38
  import TimefieldControl from "./timefield";
37
39
  import CheckboxControl from "./checkbox";
38
40
  import ToggleControl from "./toggle";
@@ -59,6 +61,8 @@ const accessibleControls = [
59
61
  ControlType.CHECKBOXSET,
60
62
  ControlType.HIDDEN,
61
63
  ControlType.DATEFIELD,
64
+ ControlType.DATEPICKER,
65
+ ControlType.DATEPICKERRANGE,
62
66
  ControlType.NUMBERFIELD,
63
67
  ControlType.SPINNER,
64
68
  ControlType.PASSWORDFIELD,
@@ -224,6 +228,12 @@ export default class ControlFactory {
224
228
  case (ControlType.DATEFIELD):
225
229
  createdControl = (<DatefieldControl {...props} />);
226
230
  break;
231
+ case (ControlType.DATEPICKER):
232
+ createdControl = (<DatepickerControl {...props} />);
233
+ break;
234
+ case (ControlType.DATEPICKERRANGE):
235
+ createdControl = (<DatepickerRangeControl {...props} />);
236
+ break;
227
237
  case (ControlType.TIMEFIELD):
228
238
  createdControl = (<TimefieldControl {...props} />);
229
239
  break;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2017-2022 Elyra Authors
2
+ * Copyright 2017-2023 Elyra Authors
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -30,6 +30,8 @@
30
30
  @import "./numberfield/numberfield";
31
31
  @import "./structureeditor/structureeditor";
32
32
  @import "./multiselect/multiselect";
33
+ @import "./datepicker-range/datepicker-range";
34
+ @import "./datepicker/datepicker";
33
35
 
34
36
  .properties-ctrl-wrapper {
35
37
  padding-bottom: $spacing-05; // Adds padding to the control
@@ -0,0 +1,118 @@
1
+ /*
2
+ * Copyright 2023 Elyra Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import React from "react";
18
+ import PropTypes from "prop-types";
19
+ import { connect } from "react-redux";
20
+ import { DatePicker, DatePickerInput } from "carbon-components-react";
21
+ import classNames from "classnames";
22
+
23
+ import ValidationMessage from "../../components/validation-message";
24
+ import * as ControlUtils from "../../util/control-utils";
25
+ import { getFormattedDate, getISODate } from "../../util/date-utils";
26
+ import { STATES, DATEPICKER_TYPE } from "../../constants/constants.js";
27
+
28
+ class DatepickerControl extends React.Component {
29
+ constructor(props) {
30
+ super(props);
31
+ this.id = ControlUtils.getControlId(props.propertyId);
32
+ this.locale = props.controller.getLocale();
33
+
34
+ this.dateFormat = ControlUtils.getDateTimeFormat(props.control);
35
+
36
+ this.state = {
37
+ value: props.value ? getFormattedDate(props.value, this.dateFormat) : ""
38
+ };
39
+
40
+ this.getDatepickerSize = this.getDatepickerSize.bind(this);
41
+ }
42
+
43
+ getDatepickerSize() {
44
+ return this.props.tableControl ? "sm" : "md";
45
+ }
46
+
47
+ handleChange(evt) {
48
+ if (evt.length > 0) {
49
+ const isoDate = getISODate(evt[0]);
50
+ const value = getFormattedDate(evt[0], this.dateFormat); // display value
51
+ this.props.controller.updatePropertyValue(this.props.propertyId, isoDate); // internal format
52
+ this.setState({ value });
53
+ } else {
54
+ this.props.controller.updatePropertyValue(this.props.propertyId, "");
55
+ this.setState({ value: "" });
56
+ }
57
+ }
58
+
59
+ // Allows user to manually type in the input
60
+ // Once the calendar closes, it will trigger an onChange evt that will correct any invalid dates
61
+ handleInputChange(evt) {
62
+ const value = evt.target.value; // Display value as what user enters
63
+ this.setState({ value });
64
+ }
65
+
66
+ render() {
67
+ const helperText = this.props.controller.getResource(`${this.props.control.name}.helper`, null);
68
+ const className = classNames("properties-datepicker", "properties-input-control", { "hide": this.props.state === STATES.HIDDEN },
69
+ this.props.messageInfo ? this.props.messageInfo.type : null);
70
+ const validationProps = ControlUtils.getValidationProps(this.props.messageInfo, this.props.tableControl);
71
+
72
+ return (
73
+ <div className={className} data-id={ControlUtils.getDataId(this.props.propertyId)}>
74
+ <DatePicker
75
+ className="properties-datepicker-wrapper-parent"
76
+ datePickerType={DATEPICKER_TYPE.SINGLE}
77
+ dateFormat={this.dateFormat}
78
+ light={this.props.controller.getLight() && this.props.control.light}
79
+ onChange={this.handleChange.bind(this)}
80
+ locale={this.locale}
81
+ >
82
+ <DatePickerInput
83
+ {...validationProps}
84
+ id={this.id}
85
+ className="properties-datepicker-wrapper-input"
86
+ placeholder={this.props.control.additionalText}
87
+ labelText={!this.props.tableControl && this.props.controlItem}
88
+ disabled={this.props.state === STATES.DISABLED}
89
+ size={this.getDatepickerSize()}
90
+ onChange={this.handleInputChange.bind(this)}
91
+ value={this.state.value}
92
+ helperText={!this.props.tableControl && helperText}
93
+ />
94
+ </DatePicker>
95
+ <ValidationMessage inTable={this.props.tableControl} tableOnly state={this.props.state} messageInfo={this.props.messageInfo} />
96
+ </div>
97
+ );
98
+ }
99
+ }
100
+
101
+ DatepickerControl.propTypes = {
102
+ control: PropTypes.object.isRequired,
103
+ propertyId: PropTypes.object.isRequired,
104
+ controller: PropTypes.object.isRequired,
105
+ controlItem: PropTypes.element,
106
+ tableControl: PropTypes.bool,
107
+ state: PropTypes.string, // pass in by redux
108
+ value: PropTypes.string, // pass in by redux
109
+ messageInfo: PropTypes.object // pass in by redux
110
+ };
111
+
112
+ const mapStateToProps = (state, ownProps) => ({
113
+ value: ownProps.controller.getPropertyValue(ownProps.propertyId),
114
+ state: ownProps.controller.getControlState(ownProps.propertyId),
115
+ messageInfo: ownProps.controller.getErrorMessage(ownProps.propertyId)
116
+ });
117
+
118
+ export default connect(mapStateToProps, null)(DatepickerControl);
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright 2023 Elyra Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ .properties-table-cell-control {
18
+ .properties-datepicker {
19
+ .bx--date-picker.bx--date-picker--single .bx--date-picker__input {
20
+ width: unset; // Unset width when displayed within a table
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright 2023 Elyra Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import DatePicker from "./datepicker.jsx";
18
+ export default DatePicker;
@@ -0,0 +1,194 @@
1
+ /*
2
+ * Copyright 2023 Elyra Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import React from "react";
18
+ import PropTypes from "prop-types";
19
+ import { connect } from "react-redux";
20
+ import { DatePicker, DatePickerInput } from "carbon-components-react";
21
+ import classNames from "classnames";
22
+ import { v4 as uuid4 } from "uuid";
23
+
24
+ import Tooltip from "./../../../tooltip/tooltip.jsx";
25
+ import Icon from "./../../../icons/icon.jsx";
26
+ import ValidationMessage from "../../components/validation-message";
27
+ import * as ControlUtils from "../../util/control-utils";
28
+ import { getFormattedDate, getISODate } from "../../util/date-utils";
29
+ import { STATES, DATEPICKER_TYPE, MESSAGE_KEYS, CARBON_ICONS } from "../../constants/constants.js";
30
+ import { formatMessage } from "./../../util/property-utils";
31
+
32
+ class DatepickerRangeControl extends React.Component {
33
+ constructor(props) {
34
+ super(props);
35
+ this.reactIntl = props.controller.getReactIntl();
36
+ this.id = ControlUtils.getControlId(this.props.propertyId);
37
+ this.locale = props.controller.getLocale();
38
+ this.uuid = uuid4();
39
+
40
+ this.dateFormat = ControlUtils.getDateTimeFormat(props.control);
41
+
42
+ this.state = {
43
+ valueStart: props.value && props.value[0] ? getFormattedDate(props.value[0], this.dateFormat) : "",
44
+ valueEnd: props.value && props.value[1] ? getFormattedDate(props.value[1], this.dateFormat) : ""
45
+ };
46
+
47
+ this.getDatepickerSize = this.getDatepickerSize.bind(this);
48
+ this.createInfoDesc = this.createInfoDesc.bind(this);
49
+ }
50
+
51
+ onStartBlur(evt) {
52
+ const isoStartDate = getISODate(evt.target.value, this.dateFormat);
53
+ const isoEndDate = getISODate(this.state.valueEnd, this.dateFormat);
54
+ this.props.controller.updatePropertyValue(this.props.propertyId, [isoStartDate, isoEndDate]);
55
+ }
56
+
57
+ onEndBlur(evt) {
58
+ const isoStartDate = getISODate(evt.target.value, this.dateFormat);
59
+ const isoEndDate = getISODate(this.state.valueEnd, this.dateFormat);
60
+ this.props.controller.updatePropertyValue(this.props.propertyId, [isoStartDate, isoEndDate]);
61
+ }
62
+
63
+ getDatepickerSize() {
64
+ return this.props.tableControl ? "sm" : "md";
65
+ }
66
+
67
+ // This handles changes for simple, single, and the start range date
68
+ handleDateRangeChange(evt) {
69
+ if (evt[0]) {
70
+ const isoStartDate = getISODate(evt[0]); // internal format
71
+ const valueStart = getFormattedDate(evt[0], this.dateFormat); // display value
72
+ let isoEndDate = "";
73
+ let valueEnd = "";
74
+
75
+ if (evt[1]) { // Cannot enter end date without specifying start date
76
+ isoEndDate = getISODate(evt[1]); // internal format
77
+ valueEnd = getFormattedDate(evt[1], this.dateFormat); // display value
78
+ }
79
+ this.props.controller.updatePropertyValue(this.props.propertyId, [isoStartDate, isoEndDate]);
80
+ this.setState({ valueStart, valueEnd });
81
+ }
82
+ }
83
+
84
+ // Allows user to manually type in the input
85
+ // Once the calendar closes, it will trigger an onChange evt that will correct any invalid dates
86
+ handleInputStartChange(evt) {
87
+ this.setState({ valueStart: evt.target.value }); // Display value as what user enters
88
+ }
89
+ handleInputEndChange(evt) {
90
+ this.setState({ valueEnd: evt.target.value }); // Display value as what user enters
91
+ }
92
+
93
+ createInfoDesc(label, description, range) {
94
+ return description
95
+ ? (<div className="properties-label-container">
96
+ {label}
97
+ <Tooltip
98
+ id={`${this.uuid}-tooltip-label-${this.props.control.name}-${range}`}
99
+ tip={description}
100
+ tooltipLinkHandler={this.props.controller.getHandlers().tooltipLinkHandler}
101
+ direction="bottom"
102
+ disable={this.props.state === STATES.DISABLED}
103
+ showToolTipOnClick
104
+ >
105
+ <Icon type={CARBON_ICONS.INFORMATION} className="properties-control-description-icon-info" />
106
+ </Tooltip>
107
+ </div>)
108
+ : label;
109
+ }
110
+
111
+ render() {
112
+ const datepickerRangeStartLabel = `${this.props.control.name}.range.start.label`;
113
+ const datepickerRangeStartDesc = `${this.props.control.name}.range.start.desc`;
114
+ const datepickerRangeStartHelper = `${this.props.control.name}.range.start.helper`;
115
+ const datepickerRangeEndLabel = `${this.props.control.name}.range.end.label`;
116
+ const datepickerRangeEndDesc = `${this.props.control.name}.range.end.desc`;
117
+ const datepickerRangeEndHelper = `${this.props.control.name}.range.end.helper`;
118
+
119
+ const defaultDatepickerRangeStartLabel = formatMessage(this.reactIntl, MESSAGE_KEYS.DATEPICKER_RANGE_START_LABEL);
120
+ const defaultDatepickerRangeEndLabel = formatMessage(this.reactIntl, MESSAGE_KEYS.DATEPICKER_RANGE_END_LABEL);
121
+
122
+ let startLabel = this.props.controller.getResource(datepickerRangeStartLabel, defaultDatepickerRangeStartLabel);
123
+ const startDesc = this.props.controller.getResource(datepickerRangeStartDesc, null);
124
+ const startHelperText = this.props.controller.getResource(datepickerRangeStartHelper, null);
125
+ let endLabel = this.props.controller.getResource(datepickerRangeEndLabel, defaultDatepickerRangeEndLabel);
126
+ const endDesc = this.props.controller.getResource(datepickerRangeEndDesc, null);
127
+ const endHelperText = this.props.controller.getResource(datepickerRangeEndHelper, null);
128
+
129
+ startLabel = this.createInfoDesc(startLabel, startDesc, "start");
130
+ endLabel = this.createInfoDesc(endLabel, endDesc, "end");
131
+
132
+ const className = classNames("properties-datepicker-range", "properties-input-control", { "hide": this.props.state === STATES.HIDDEN },
133
+ this.props.messageInfo ? this.props.messageInfo.type : null);
134
+ const validationProps = ControlUtils.getValidationProps(this.props.messageInfo, this.props.tableControl);
135
+
136
+ return (
137
+ <div className={className} data-id={ControlUtils.getDataId(this.props.propertyId)}>
138
+ <DatePicker
139
+ datePickerType={DATEPICKER_TYPE.RANGE}
140
+ dateFormat={this.dateFormat}
141
+ light={this.props.controller.getLight() && this.props.control.light}
142
+ onChange={this.handleDateRangeChange.bind(this)}
143
+ locale={this.locale}
144
+ allowInput
145
+ >
146
+ <DatePickerInput
147
+ {...validationProps}
148
+ id={`${this.id}-start`}
149
+ placeholder={this.props.control.additionalText}
150
+ labelText={!this.props.tableControl && startLabel}
151
+ disabled={this.props.state === STATES.DISABLED}
152
+ size={this.getDatepickerSize()}
153
+ onChange={this.handleInputStartChange.bind(this)}
154
+ value={this.state.valueStart}
155
+ onBlur={this.onStartBlur.bind(this)}
156
+ helperText={!this.props.tableControl && startHelperText}
157
+ />
158
+ <DatePickerInput
159
+ {...validationProps}
160
+ id={`${this.id}-end`}
161
+ placeholder={this.props.control.additionalText}
162
+ labelText={!this.props.tableControl && endLabel}
163
+ disabled={this.props.state === STATES.DISABLED}
164
+ size={this.getDatepickerSize()}
165
+ onChange={this.handleInputEndChange.bind(this)}
166
+ value={this.state.valueEnd}
167
+ onBlur={this.onEndBlur.bind(this)}
168
+ helperText={!this.props.tableControl && endHelperText}
169
+ />
170
+ </DatePicker>
171
+ <ValidationMessage inTable={this.props.tableControl} tableOnly state={this.props.state} messageInfo={this.props.messageInfo} />
172
+ </div>
173
+ );
174
+ }
175
+ }
176
+
177
+ DatepickerRangeControl.propTypes = {
178
+ control: PropTypes.object.isRequired,
179
+ propertyId: PropTypes.object.isRequired,
180
+ controller: PropTypes.object.isRequired,
181
+ controlItem: PropTypes.element,
182
+ tableControl: PropTypes.bool,
183
+ state: PropTypes.string, // pass in by redux
184
+ value: PropTypes.array, // pass in by redux
185
+ messageInfo: PropTypes.object // pass in by redux
186
+ };
187
+
188
+ const mapStateToProps = (state, ownProps) => ({
189
+ value: ownProps.controller.getPropertyValue(ownProps.propertyId),
190
+ state: ownProps.controller.getControlState(ownProps.propertyId),
191
+ messageInfo: ownProps.controller.getErrorMessage(ownProps.propertyId)
192
+ });
193
+
194
+ export default connect(mapStateToProps, null)(DatepickerRangeControl);
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Copyright 2023 Elyra Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ .properties-datepicker-range {
18
+ .bx--date-picker-container {
19
+ justify-content: normal; // Override carbon to fix layout when only one has helper text
20
+ }
21
+ }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright 2023 Elyra Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import DatePickerRange from "./datepicker-range.jsx";
18
+ export default DatePickerRange;
@@ -196,7 +196,8 @@ class DropDown extends React.Component {
196
196
 
197
197
  const listBoxMenuIconTranslationIds = {
198
198
  "close.menu": formatMessage(this.reactIntl, MESSAGE_KEYS.DROPDOWN_TOOLTIP_CLOSEMENU),
199
- "open.menu": formatMessage(this.reactIntl, MESSAGE_KEYS.DROPDOWN_TOOLTIP_OPENMENU)
199
+ "open.menu": formatMessage(this.reactIntl, MESSAGE_KEYS.DROPDOWN_TOOLTIP_OPENMENU),
200
+ "clear.selection": formatMessage(this.reactIntl, MESSAGE_KEYS.DROPDOWN_TOOLTIP_CLEARSELECTION)
200
201
  };
201
202
 
202
203
  let dropdownComponent = null;
@@ -29,6 +29,7 @@ const FIELDS_SPECIAL_CHARACTERS_REGEX = new RegExp("[0-9- _$]", "g");
29
29
  export default class ExpressionSelectFieldOrFunction extends React.Component {
30
30
  constructor(props) {
31
31
  super(props);
32
+ this.uuid = uuid4();
32
33
  this.reactIntl = props.controller.getReactIntl();
33
34
  this.valueColumn = formatMessage(this.reactIntl, MESSAGE_KEYS.EXPRESSION_VALUE_COLUMN);
34
35
  this.valueColumnDesc = formatMessage(this.reactIntl, MESSAGE_KEYS.EXPRESSION_VALUE_COLUMN_DESCRIPTION);
@@ -549,7 +550,7 @@ export default class ExpressionSelectFieldOrFunction extends React.Component {
549
550
  return (
550
551
  <div className="properties-expression-function-select">
551
552
  <Dropdown
552
- id={"properties-expression-function-select-dropdown-" + uuid4()}
553
+ id={"properties-expression-function-select-dropdown-" + this.uuid}
553
554
  light={this.props.controller.getLight()}
554
555
  label={label}
555
556
  items={items}
@@ -578,7 +579,7 @@ export default class ExpressionSelectFieldOrFunction extends React.Component {
578
579
  return (
579
580
  <div className="properties-expression-field-select">
580
581
  <Dropdown
581
- id={"properties-expression-field-select-dropdown-" + uuid4()}
582
+ id={"properties-expression-field-select-dropdown-" + this.uuid}
582
583
  light={this.props.controller.getLight()}
583
584
  label={label}
584
585
  items={newItems}
@@ -19,12 +19,10 @@ import PropTypes from "prop-types";
19
19
  import { Button } from "carbon-components-react";
20
20
 
21
21
  import Tooltip from "./../../../../tooltip/tooltip";
22
- import { v4 as uuid4 } from "uuid";
23
22
  import classNames from "classnames";
24
23
 
25
24
 
26
25
  export default class ExpressionSelectOperator extends React.Component {
27
-
28
26
  onOperatorClick(value, evt) {
29
27
  if (this.props.onChange) {
30
28
  this.props.onChange(value);
@@ -35,7 +33,7 @@ export default class ExpressionSelectOperator extends React.Component {
35
33
  if (this.props.operatorList) {
36
34
  const operatorButtons = [];
37
35
  this.props.operatorList.forEach((operator, index) => {
38
- const tooltipId = uuid4() + "-tooltip-expression-operator";
36
+ const tooltipId = `tooltip-expression-operator-${index}`;
39
37
  const tooltip = (
40
38
  <div className="properties-tooltips">
41
39
  {operator.help}
@@ -179,7 +179,7 @@ class RadiosetControl extends React.Component {
179
179
  );
180
180
  tooltipIcon = (
181
181
  <Tooltip
182
- id={`tooltip-${this.uuid}-${i}`}
182
+ id={`tooltip-${i}`}
183
183
  tip={tooltip}
184
184
  direction="bottom"
185
185
  className="properties-tooltips"
@@ -30,6 +30,7 @@ import Icon from "./../../../icons/icon";
30
30
 
31
31
  import { ControlType } from "./../../constants/form-constants";
32
32
  import { stringifyFieldValue } from "./../../util/property-utils";
33
+ import { getFormattedDate } from "./../../util/date-utils";
33
34
 
34
35
  class ReadonlyControl extends React.Component {
35
36
  constructor(props) {
@@ -96,6 +97,12 @@ class ReadonlyControl extends React.Component {
96
97
  } else {
97
98
  controlValue = ""; // invalid timestamp
98
99
  }
100
+ } else if (this.props.control.controlType === ControlType.DATEPICKER) {
101
+ controlValue = controlValue ? getFormattedDate(controlValue, this.props.control.dateFormat) : "";
102
+ } else if (this.props.control.controlType === ControlType.DATEPICKERRANGE) {
103
+ const startDate = this.props.value && this.props.value[0] ? getFormattedDate(this.props.value[0], this.props.control.dateFormat) : "";
104
+ const endDate = this.props.value && this.props.value[1] ? getFormattedDate(this.props.value[1], this.props.control.dateFormat) : "";
105
+ controlValue = [startDate, endDate].toString();
99
106
  }
100
107
  const readOnly = <span className="properties-field-type" disabled={this.props.state === STATES.DISABLED}>{controlValue}</span>;
101
108
  let display = readOnly;
@@ -34,7 +34,8 @@ class TextareaControl extends React.Component {
34
34
  super(props);
35
35
  this.reactIntl = props.controller.getReactIntl();
36
36
  this.charLimit = ControlUtils.getCharLimit(props.control, props.controller.getMaxLengthForMultiLineControls());
37
- this.id = ControlUtils.getControlId(this.props.propertyId);
37
+ this.uuid = uuid4();
38
+ this.id = ControlUtils.getControlId(this.props.propertyId, this.uuid);
38
39
  }
39
40
 
40
41
  handleChange(evt) {
@@ -98,7 +99,7 @@ class TextareaControl extends React.Component {
98
99
 
99
100
  let display = textArea;
100
101
  if (this.props.tableControl) {
101
- const tooltipId = uuid4() + "-tooltip-column-" + this.props.propertyId.toString();
102
+ const tooltipId = "tooltip-column-textarea";
102
103
  let disabled = true;
103
104
  if (value && this.props.state !== STATES.DISABLED) {
104
105
  disabled = false;