@boomerang-io/carbon-addons-boomerang-react 4.6.14-beta.11 → 4.6.14-beta.13
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/cjs/components/Creatable/Creatable.js +32 -3
- package/dist/cjs/components/DataDrivenInput/DataDrivenInput.js +11 -2
- package/dist/cjs/components/DynamicFormik/DynamicFormik.js +11 -1
- package/dist/cjs/constants/DataDrivenInputTypes.js +4 -0
- package/dist/esm/components/Creatable/Creatable.js +34 -5
- package/dist/esm/components/DataDrivenInput/DataDrivenInput.js +11 -2
- package/dist/esm/components/DynamicFormik/DynamicFormik.js +11 -1
- package/dist/esm/constants/DataDrivenInputTypes.js +4 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +5 -2
- package/scss/components/Creatable/_creatable.scss +30 -1
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var react = require('@carbon/react');
|
|
7
7
|
var icons = require('@carbon/react/icons');
|
|
8
|
+
var core = require('@dnd-kit/core');
|
|
9
|
+
var sortable = require('@dnd-kit/sortable');
|
|
10
|
+
var utilities = require('@dnd-kit/utilities');
|
|
8
11
|
var cx = require('classnames');
|
|
9
12
|
var TooltipHover = require('../TooltipHover/TooltipHover.js');
|
|
10
13
|
var accessibility = require('../../tools/accessibility.js');
|
|
@@ -20,7 +23,7 @@ IBM Confidential
|
|
|
20
23
|
694970X, 69497O0
|
|
21
24
|
© Copyright IBM Corp. 2022, 2024
|
|
22
25
|
*/
|
|
23
|
-
function CreatableComponent({ buttonClassName = `${settings.prefix}--bmrg-creatable__button`, buttonContent = "Add", buttonProps, createKeyValuePair = false, disabled, id, initialValues: externalInitialValues, invalid, invalidText, helperText, key, keyHelperText, keyLabel, keyLabelText, keyPlaceholder, label, labelText = "", max, nonDeletable = false, onKeyBlur, onValueBlur, onInputBlur, onChange, placeholder, tagProps, tagType = "teal", textInputProps, tooltipClassName = `${settings.prefix}--bmrg-creatable__tooltip`, tooltipContent, tooltipProps = { direction: "top" }, type = "text", valueHelperText, valueLabel, valueLabelText, valuePlaceholder, value: externalValues, values, trimInput = false, removeOnlyFirst = false, }) {
|
|
26
|
+
function CreatableComponent({ buttonClassName = `${settings.prefix}--bmrg-creatable__button`, buttonContent = "Add", buttonProps, createKeyValuePair = false, disabled, id, initialValues: externalInitialValues, invalid, invalidText, helperText, key, keyHelperText, keyLabel, keyLabelText, keyPlaceholder, label, labelText = "", max, nonDeletable = false, onKeyBlur, onValueBlur, onInputBlur, onChange, placeholder, reorderable, tagProps, tagType = "teal", textInputProps, tooltipClassName = `${settings.prefix}--bmrg-creatable__tooltip`, tooltipContent, tooltipProps = { direction: "top" }, type = "text", valueHelperText, valueLabel, valueLabelText, valuePlaceholder, value: externalValues, values, trimInput = false, removeOnlyFirst = false, }) {
|
|
24
27
|
const [keyValue, setKeyValue] = React.useState("");
|
|
25
28
|
const [value, setValue] = React.useState("");
|
|
26
29
|
const [input, setInput] = React.useState("");
|
|
@@ -128,6 +131,21 @@ function CreatableComponent({ buttonClassName = `${settings.prefix}--bmrg-creata
|
|
|
128
131
|
if (onChange)
|
|
129
132
|
onChange(items);
|
|
130
133
|
};
|
|
134
|
+
const sensors = core.useSensors(core.useSensor(core.PointerSensor, {
|
|
135
|
+
activationConstraint: { distance: 5 },
|
|
136
|
+
}));
|
|
137
|
+
function handleDragEnd(event) {
|
|
138
|
+
const { active, over } = event;
|
|
139
|
+
if (over && active.id !== over.id) {
|
|
140
|
+
const oldIndex = tagItems.indexOf(active.id);
|
|
141
|
+
const newIndex = tagItems.indexOf(over.id);
|
|
142
|
+
const reorderedItems = sortable.arrayMove(tagItems, oldIndex, newIndex);
|
|
143
|
+
setCreatedItems(reorderedItems);
|
|
144
|
+
if (onChange) {
|
|
145
|
+
onChange(reorderedItems);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
131
149
|
return (React__default.default.createElement("div", { key: key, className: `${settings.prefix}--bmrg-creatable` },
|
|
132
150
|
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-creatable__input` },
|
|
133
151
|
createKeyValuePair ? (React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-creatable__key-value-inputs` },
|
|
@@ -149,9 +167,20 @@ function CreatableComponent({ buttonClassName = `${settings.prefix}--bmrg-creata
|
|
|
149
167
|
React__default.default.createElement(TooltipHover.default, { ...tooltipProps, tooltipText: tooltipContent },
|
|
150
168
|
React__default.default.createElement(icons.Information, { size: 16, fill: "currentColor" }))))), onBlur: onInputBlur, onChange: onInputChange, placeholder: placeholder, ref: inputRef, type: type, value: input, ...textInputProps })),
|
|
151
169
|
React__default.default.createElement(react.Button, { className: createButtonClassName, disabled: isAddButtonDisabled, onClick: addValue, iconDescription: "Add", renderIcon: icons.Add, size: "md", type: "button", ...buttonProps }, buttonContent)),
|
|
152
|
-
|
|
170
|
+
reorderable ? (React__default.default.createElement(core.DndContext, { sensors: disabled ? [] : sensors, collisionDetection: core.closestCenter, onDragEnd: handleDragEnd },
|
|
171
|
+
React__default.default.createElement(sortable.SortableContext, { items: tagsToShow, strategy: sortable.verticalListSortingStrategy },
|
|
172
|
+
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-creatable__tags--reorderable` }, tagsToShow.map((item, index) => (React__default.default.createElement(ReorderableTag, { key: `${item}-${index}`, disabled: disabled, initialTagItems: initialTagItems, item: item, nonDeletable: nonDeletable, removeValue: removeValue, tagProps: tagProps, tagType: tagType }))))))) : (React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-creatable__tags` }, tagsToShow.map((item, index) => (React__default.default.createElement(react.Tag, { key: `${item}-${index}`, disabled: disabled, type: tagType, onClick: nonDeletable && initialTagItems.includes(item) ? undefined : () => removeValue(item), onKeyDown: nonDeletable && initialTagItems.includes(item)
|
|
153
173
|
? undefined
|
|
154
|
-
: (e) => accessibility.isAccessibleKeyDownEvent(e) && removeValue(item), filter: !nonDeletable || (nonDeletable && !initialTagItems.includes(item)), ...tagProps }, item))))));
|
|
174
|
+
: (e) => accessibility.isAccessibleKeyDownEvent(e) && removeValue(item), filter: !nonDeletable || (nonDeletable && !initialTagItems.includes(item)), ...tagProps }, item)))))));
|
|
175
|
+
}
|
|
176
|
+
function ReorderableTag({ disabled, initialTagItems, item, nonDeletable, removeValue, tagProps, tagType, }) {
|
|
177
|
+
const { attributes, listeners, setNodeRef, transform, transition } = sortable.useSortable({ id: item });
|
|
178
|
+
const style = {
|
|
179
|
+
transform: utilities.CSS.Transform.toString(transform),
|
|
180
|
+
transition,
|
|
181
|
+
};
|
|
182
|
+
return (React__default.default.createElement("div", { ref: setNodeRef, ...attributes, ...(!disabled ? listeners : {}), style: style },
|
|
183
|
+
React__default.default.createElement(react.DismissibleTag, { disabled: disabled, type: tagType, onClose: nonDeletable && initialTagItems.includes(item) ? undefined : () => removeValue(item), renderIcon: icons.Draggable, title: "", text: item, ...tagProps })));
|
|
155
184
|
}
|
|
156
185
|
|
|
157
186
|
exports.default = CreatableComponent;
|
|
@@ -117,9 +117,18 @@ function DataDrivenInput(props) {
|
|
|
117
117
|
Component = Creatable$1;
|
|
118
118
|
componentProps = {
|
|
119
119
|
...allInputProps,
|
|
120
|
-
createKeyValuePair: type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR ||
|
|
120
|
+
createKeyValuePair: type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR ||
|
|
121
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_NON_DELETABLE ||
|
|
122
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE ||
|
|
123
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE_NON_DELETABLE,
|
|
121
124
|
nonDeletable: type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_SINGLE_NON_DELETABLE ||
|
|
122
|
-
type === DataDrivenInputTypes.CREATABLE_TYPES.
|
|
125
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE_NON_DELETABLE ||
|
|
126
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_NON_DELETABLE ||
|
|
127
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE_NON_DELETABLE,
|
|
128
|
+
reorderable: type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE ||
|
|
129
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE_NON_DELETABLE ||
|
|
130
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE ||
|
|
131
|
+
type === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE_NON_DELETABLE,
|
|
123
132
|
invalid: invalidInput,
|
|
124
133
|
invalidText: invalidTextMessage,
|
|
125
134
|
placeholder,
|
|
@@ -134,7 +134,13 @@ async function handleGoverningSelectChange({ formikProps, input, inputs, isInput
|
|
|
134
134
|
/** Erase value of governed inputs */
|
|
135
135
|
if (inputsGovernedByCurrentOne.length) {
|
|
136
136
|
await inputsGovernedByCurrentOne.forEach(async (input) => {
|
|
137
|
-
await handleGoverningSelectChange({
|
|
137
|
+
await handleGoverningSelectChange({
|
|
138
|
+
formikProps,
|
|
139
|
+
input,
|
|
140
|
+
inputs,
|
|
141
|
+
isInputBeingChanged: false,
|
|
142
|
+
selectedItem: null,
|
|
143
|
+
});
|
|
138
144
|
});
|
|
139
145
|
}
|
|
140
146
|
// only the top governing select should display warnings if changed and reset touched status for governed ones
|
|
@@ -226,8 +232,12 @@ function generateYupAst({ inputs, allowCustomPropertySyntax, customPropertySynta
|
|
|
226
232
|
if (inputType === DataDrivenInputTypes.MULTI_SELECT_TYPES.MULTI_SELECT ||
|
|
227
233
|
inputType === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_SINGLE ||
|
|
228
234
|
inputType === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_SINGLE_NON_DELETABLE ||
|
|
235
|
+
inputType === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE ||
|
|
236
|
+
inputType === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE_NON_DELETABLE ||
|
|
229
237
|
inputType === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR ||
|
|
230
238
|
inputType === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_NON_DELETABLE ||
|
|
239
|
+
inputType === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE ||
|
|
240
|
+
inputType === DataDrivenInputTypes.CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE_NON_DELETABLE ||
|
|
231
241
|
inputType === DataDrivenInputTypes.CHECKBOX_TYPES.CHECKBOX) {
|
|
232
242
|
if (useCSVforArrays) {
|
|
233
243
|
yupValidationArray.push(["yup.string"]);
|
|
@@ -11,8 +11,12 @@ const CHECKBOX_TYPES = {
|
|
|
11
11
|
const CREATABLE_TYPES = {
|
|
12
12
|
CREATABLE_SINGLE: "creatable-single",
|
|
13
13
|
CREATABLE_SINGLE_NON_DELETABLE: "creatable-single-non-deletable",
|
|
14
|
+
CREATABLE_SINGLE_REORDERABLE: "creatable-single-reorderable",
|
|
15
|
+
CREATABLE_SINGLE_REORDERABLE_NON_DELETABLE: "creatable-single-reorderable-non-deletable",
|
|
14
16
|
CREATABLE_PAIR: "creatable-pair",
|
|
15
17
|
CREATABLE_PAIR_NON_DELETABLE: "creatable-pair-non-deletable",
|
|
18
|
+
CREATABLE_PAIR_REORDERABLE: "creatable-pair-reorderable",
|
|
19
|
+
CREATABLE_PAIR_REORDERABLE_NON_DELETABLE: "creatable-pair-reorderable-non-deletable",
|
|
16
20
|
};
|
|
17
21
|
const DATE_TYPES = {
|
|
18
22
|
DATE: "date",
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { TextInput, Button, Tag } from '@carbon/react';
|
|
3
|
-
import { Information, Add } from '@carbon/react/icons';
|
|
2
|
+
import { TextInput, Button, Tag, DismissibleTag } from '@carbon/react';
|
|
3
|
+
import { Information, Add, Draggable } from '@carbon/react/icons';
|
|
4
|
+
import { useSensors, useSensor, PointerSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
5
|
+
import { SortableContext, verticalListSortingStrategy, useSortable, arrayMove } from '@dnd-kit/sortable';
|
|
6
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
4
7
|
import cx from 'classnames';
|
|
5
8
|
import TooltipHover from '../TooltipHover/TooltipHover.js';
|
|
6
9
|
import { isAccessibleKeyDownEvent } from '../../tools/accessibility.js';
|
|
@@ -11,7 +14,7 @@ IBM Confidential
|
|
|
11
14
|
694970X, 69497O0
|
|
12
15
|
© Copyright IBM Corp. 2022, 2024
|
|
13
16
|
*/
|
|
14
|
-
function CreatableComponent({ buttonClassName = `${prefix}--bmrg-creatable__button`, buttonContent = "Add", buttonProps, createKeyValuePair = false, disabled, id, initialValues: externalInitialValues, invalid, invalidText, helperText, key, keyHelperText, keyLabel, keyLabelText, keyPlaceholder, label, labelText = "", max, nonDeletable = false, onKeyBlur, onValueBlur, onInputBlur, onChange, placeholder, tagProps, tagType = "teal", textInputProps, tooltipClassName = `${prefix}--bmrg-creatable__tooltip`, tooltipContent, tooltipProps = { direction: "top" }, type = "text", valueHelperText, valueLabel, valueLabelText, valuePlaceholder, value: externalValues, values, trimInput = false, removeOnlyFirst = false, }) {
|
|
17
|
+
function CreatableComponent({ buttonClassName = `${prefix}--bmrg-creatable__button`, buttonContent = "Add", buttonProps, createKeyValuePair = false, disabled, id, initialValues: externalInitialValues, invalid, invalidText, helperText, key, keyHelperText, keyLabel, keyLabelText, keyPlaceholder, label, labelText = "", max, nonDeletable = false, onKeyBlur, onValueBlur, onInputBlur, onChange, placeholder, reorderable, tagProps, tagType = "teal", textInputProps, tooltipClassName = `${prefix}--bmrg-creatable__tooltip`, tooltipContent, tooltipProps = { direction: "top" }, type = "text", valueHelperText, valueLabel, valueLabelText, valuePlaceholder, value: externalValues, values, trimInput = false, removeOnlyFirst = false, }) {
|
|
15
18
|
const [keyValue, setKeyValue] = useState("");
|
|
16
19
|
const [value, setValue] = useState("");
|
|
17
20
|
const [input, setInput] = useState("");
|
|
@@ -119,6 +122,21 @@ function CreatableComponent({ buttonClassName = `${prefix}--bmrg-creatable__butt
|
|
|
119
122
|
if (onChange)
|
|
120
123
|
onChange(items);
|
|
121
124
|
};
|
|
125
|
+
const sensors = useSensors(useSensor(PointerSensor, {
|
|
126
|
+
activationConstraint: { distance: 5 },
|
|
127
|
+
}));
|
|
128
|
+
function handleDragEnd(event) {
|
|
129
|
+
const { active, over } = event;
|
|
130
|
+
if (over && active.id !== over.id) {
|
|
131
|
+
const oldIndex = tagItems.indexOf(active.id);
|
|
132
|
+
const newIndex = tagItems.indexOf(over.id);
|
|
133
|
+
const reorderedItems = arrayMove(tagItems, oldIndex, newIndex);
|
|
134
|
+
setCreatedItems(reorderedItems);
|
|
135
|
+
if (onChange) {
|
|
136
|
+
onChange(reorderedItems);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
122
140
|
return (React.createElement("div", { key: key, className: `${prefix}--bmrg-creatable` },
|
|
123
141
|
React.createElement("div", { className: `${prefix}--bmrg-creatable__input` },
|
|
124
142
|
createKeyValuePair ? (React.createElement("div", { className: `${prefix}--bmrg-creatable__key-value-inputs` },
|
|
@@ -140,9 +158,20 @@ function CreatableComponent({ buttonClassName = `${prefix}--bmrg-creatable__butt
|
|
|
140
158
|
React.createElement(TooltipHover, { ...tooltipProps, tooltipText: tooltipContent },
|
|
141
159
|
React.createElement(Information, { size: 16, fill: "currentColor" }))))), onBlur: onInputBlur, onChange: onInputChange, placeholder: placeholder, ref: inputRef, type: type, value: input, ...textInputProps })),
|
|
142
160
|
React.createElement(Button, { className: createButtonClassName, disabled: isAddButtonDisabled, onClick: addValue, iconDescription: "Add", renderIcon: Add, size: "md", type: "button", ...buttonProps }, buttonContent)),
|
|
143
|
-
|
|
161
|
+
reorderable ? (React.createElement(DndContext, { sensors: disabled ? [] : sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd },
|
|
162
|
+
React.createElement(SortableContext, { items: tagsToShow, strategy: verticalListSortingStrategy },
|
|
163
|
+
React.createElement("div", { className: `${prefix}--bmrg-creatable__tags--reorderable` }, tagsToShow.map((item, index) => (React.createElement(ReorderableTag, { key: `${item}-${index}`, disabled: disabled, initialTagItems: initialTagItems, item: item, nonDeletable: nonDeletable, removeValue: removeValue, tagProps: tagProps, tagType: tagType }))))))) : (React.createElement("div", { className: `${prefix}--bmrg-creatable__tags` }, tagsToShow.map((item, index) => (React.createElement(Tag, { key: `${item}-${index}`, disabled: disabled, type: tagType, onClick: nonDeletable && initialTagItems.includes(item) ? undefined : () => removeValue(item), onKeyDown: nonDeletable && initialTagItems.includes(item)
|
|
144
164
|
? undefined
|
|
145
|
-
: (e) => isAccessibleKeyDownEvent(e) && removeValue(item), filter: !nonDeletable || (nonDeletable && !initialTagItems.includes(item)), ...tagProps }, item))))));
|
|
165
|
+
: (e) => isAccessibleKeyDownEvent(e) && removeValue(item), filter: !nonDeletable || (nonDeletable && !initialTagItems.includes(item)), ...tagProps }, item)))))));
|
|
166
|
+
}
|
|
167
|
+
function ReorderableTag({ disabled, initialTagItems, item, nonDeletable, removeValue, tagProps, tagType, }) {
|
|
168
|
+
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: item });
|
|
169
|
+
const style = {
|
|
170
|
+
transform: CSS.Transform.toString(transform),
|
|
171
|
+
transition,
|
|
172
|
+
};
|
|
173
|
+
return (React.createElement("div", { ref: setNodeRef, ...attributes, ...(!disabled ? listeners : {}), style: style },
|
|
174
|
+
React.createElement(DismissibleTag, { disabled: disabled, type: tagType, onClose: nonDeletable && initialTagItems.includes(item) ? undefined : () => removeValue(item), renderIcon: Draggable, title: "", text: item, ...tagProps })));
|
|
146
175
|
}
|
|
147
176
|
|
|
148
177
|
export { CreatableComponent as default };
|
|
@@ -109,9 +109,18 @@ function DataDrivenInput(props) {
|
|
|
109
109
|
Component = Creatable;
|
|
110
110
|
componentProps = {
|
|
111
111
|
...allInputProps,
|
|
112
|
-
createKeyValuePair: type === CREATABLE_TYPES.CREATABLE_PAIR ||
|
|
112
|
+
createKeyValuePair: type === CREATABLE_TYPES.CREATABLE_PAIR ||
|
|
113
|
+
type === CREATABLE_TYPES.CREATABLE_PAIR_NON_DELETABLE ||
|
|
114
|
+
type === CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE ||
|
|
115
|
+
type === CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE_NON_DELETABLE,
|
|
113
116
|
nonDeletable: type === CREATABLE_TYPES.CREATABLE_SINGLE_NON_DELETABLE ||
|
|
114
|
-
type === CREATABLE_TYPES.
|
|
117
|
+
type === CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE_NON_DELETABLE ||
|
|
118
|
+
type === CREATABLE_TYPES.CREATABLE_PAIR_NON_DELETABLE ||
|
|
119
|
+
type === CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE_NON_DELETABLE,
|
|
120
|
+
reorderable: type === CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE ||
|
|
121
|
+
type === CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE_NON_DELETABLE ||
|
|
122
|
+
type === CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE ||
|
|
123
|
+
type === CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE_NON_DELETABLE,
|
|
115
124
|
invalid: invalidInput,
|
|
116
125
|
invalidText: invalidTextMessage,
|
|
117
126
|
placeholder,
|
|
@@ -106,7 +106,13 @@ async function handleGoverningSelectChange({ formikProps, input, inputs, isInput
|
|
|
106
106
|
/** Erase value of governed inputs */
|
|
107
107
|
if (inputsGovernedByCurrentOne.length) {
|
|
108
108
|
await inputsGovernedByCurrentOne.forEach(async (input) => {
|
|
109
|
-
await handleGoverningSelectChange({
|
|
109
|
+
await handleGoverningSelectChange({
|
|
110
|
+
formikProps,
|
|
111
|
+
input,
|
|
112
|
+
inputs,
|
|
113
|
+
isInputBeingChanged: false,
|
|
114
|
+
selectedItem: null,
|
|
115
|
+
});
|
|
110
116
|
});
|
|
111
117
|
}
|
|
112
118
|
// only the top governing select should display warnings if changed and reset touched status for governed ones
|
|
@@ -198,8 +204,12 @@ function generateYupAst({ inputs, allowCustomPropertySyntax, customPropertySynta
|
|
|
198
204
|
if (inputType === MULTI_SELECT_TYPES.MULTI_SELECT ||
|
|
199
205
|
inputType === CREATABLE_TYPES.CREATABLE_SINGLE ||
|
|
200
206
|
inputType === CREATABLE_TYPES.CREATABLE_SINGLE_NON_DELETABLE ||
|
|
207
|
+
inputType === CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE ||
|
|
208
|
+
inputType === CREATABLE_TYPES.CREATABLE_SINGLE_REORDERABLE_NON_DELETABLE ||
|
|
201
209
|
inputType === CREATABLE_TYPES.CREATABLE_PAIR ||
|
|
202
210
|
inputType === CREATABLE_TYPES.CREATABLE_PAIR_NON_DELETABLE ||
|
|
211
|
+
inputType === CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE ||
|
|
212
|
+
inputType === CREATABLE_TYPES.CREATABLE_PAIR_REORDERABLE_NON_DELETABLE ||
|
|
203
213
|
inputType === CHECKBOX_TYPES.CHECKBOX) {
|
|
204
214
|
if (useCSVforArrays) {
|
|
205
215
|
yupValidationArray.push(["yup.string"]);
|
|
@@ -9,8 +9,12 @@ const CHECKBOX_TYPES = {
|
|
|
9
9
|
const CREATABLE_TYPES = {
|
|
10
10
|
CREATABLE_SINGLE: "creatable-single",
|
|
11
11
|
CREATABLE_SINGLE_NON_DELETABLE: "creatable-single-non-deletable",
|
|
12
|
+
CREATABLE_SINGLE_REORDERABLE: "creatable-single-reorderable",
|
|
13
|
+
CREATABLE_SINGLE_REORDERABLE_NON_DELETABLE: "creatable-single-reorderable-non-deletable",
|
|
12
14
|
CREATABLE_PAIR: "creatable-pair",
|
|
13
15
|
CREATABLE_PAIR_NON_DELETABLE: "creatable-pair-non-deletable",
|
|
16
|
+
CREATABLE_PAIR_REORDERABLE: "creatable-pair-reorderable",
|
|
17
|
+
CREATABLE_PAIR_REORDERABLE_NON_DELETABLE: "creatable-pair-reorderable-non-deletable",
|
|
14
18
|
};
|
|
15
19
|
const DATE_TYPES = {
|
|
16
20
|
DATE: "date",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -657,6 +657,7 @@ type Props$y = {
|
|
|
657
657
|
onChange?: (items: string[]) => void;
|
|
658
658
|
placeholder?: string;
|
|
659
659
|
readOnly?: boolean;
|
|
660
|
+
reorderable?: boolean;
|
|
660
661
|
tagProps?: any;
|
|
661
662
|
tagType?: string;
|
|
662
663
|
textInputProps?: any;
|
|
@@ -671,7 +672,7 @@ type Props$y = {
|
|
|
671
672
|
value?: string | string[];
|
|
672
673
|
values?: string | string[];
|
|
673
674
|
};
|
|
674
|
-
declare function CreatableComponent({ buttonClassName, buttonContent, buttonProps, createKeyValuePair, disabled, id, initialValues: externalInitialValues, invalid, invalidText, helperText, key, keyHelperText, keyLabel, keyLabelText, keyPlaceholder, label, labelText, max, nonDeletable, onKeyBlur, onValueBlur, onInputBlur, onChange, placeholder, tagProps, tagType, textInputProps, tooltipClassName, tooltipContent, tooltipProps, type, valueHelperText, valueLabel, valueLabelText, valuePlaceholder, value: externalValues, values, trimInput, removeOnlyFirst, }: Props$y): React.JSX.Element;
|
|
675
|
+
declare function CreatableComponent({ buttonClassName, buttonContent, buttonProps, createKeyValuePair, disabled, id, initialValues: externalInitialValues, invalid, invalidText, helperText, key, keyHelperText, keyLabel, keyLabelText, keyPlaceholder, label, labelText, max, nonDeletable, onKeyBlur, onValueBlur, onInputBlur, onChange, placeholder, reorderable, tagProps, tagType, textInputProps, tooltipClassName, tooltipContent, tooltipProps, type, valueHelperText, valueLabel, valueLabelText, valuePlaceholder, value: externalValues, values, trimInput, removeOnlyFirst, }: Props$y): React.JSX.Element;
|
|
675
676
|
|
|
676
677
|
type OwnDataDrivenInputProps = {
|
|
677
678
|
id?: string;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boomerang-io/carbon-addons-boomerang-react",
|
|
3
3
|
"description": "Carbon Addons for Boomerang apps",
|
|
4
|
-
"version": "4.6.14-beta.
|
|
4
|
+
"version": "4.6.14-beta.13",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Tim Bula",
|
|
7
7
|
"email": "timrbula@gmail.com"
|
|
8
8
|
},
|
|
9
9
|
"license": "Apache-2",
|
|
10
|
-
"repository": {
|
|
10
|
+
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git@github.com:boomerang-io/carbon-addons-boomerang-react"
|
|
13
13
|
},
|
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@carbon/ibm-products": "2.57.1",
|
|
51
51
|
"@carbon/react": "1.77.0",
|
|
52
|
+
"@dnd-kit/core": "^6.3.1",
|
|
53
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
54
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
52
55
|
"@stomp/stompjs": "6.1.2",
|
|
53
56
|
"@tippyjs/react": "4.2.6",
|
|
54
57
|
"classnames": "2.3.2",
|
|
@@ -4,7 +4,6 @@ IBM Confidential
|
|
|
4
4
|
© Copyright IBM Corp. 2022, 2024
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
@use "../../global/config" as *;
|
|
9
8
|
.#{$prefix}--bmrg-creatable {
|
|
10
9
|
position: relative;
|
|
@@ -42,6 +41,36 @@ IBM Confidential
|
|
|
42
41
|
width: 100%;
|
|
43
42
|
}
|
|
44
43
|
|
|
44
|
+
.#{$prefix}--bmrg-creatable__tags--reorderable {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
width: 100%;
|
|
48
|
+
|
|
49
|
+
.cds--tag {
|
|
50
|
+
cursor: grab;
|
|
51
|
+
margin-left: 0;
|
|
52
|
+
min-width: 100%;
|
|
53
|
+
width: 100%;
|
|
54
|
+
|
|
55
|
+
.cds--tag__custom-icon ~ span {
|
|
56
|
+
min-width: calc(100% - 1.25rem);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.cds--interactive--tag-children {
|
|
60
|
+
max-inline-size: none !important;
|
|
61
|
+
width: 100%;
|
|
62
|
+
|
|
63
|
+
.cds--popover {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.cds--tag__label {
|
|
69
|
+
min-width: calc(100% - 1.5rem);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
45
74
|
.#{$prefix}--bmrg-creatable__tooltip {
|
|
46
75
|
line-height: 0;
|
|
47
76
|
margin-left: 0.5rem;
|