@evoke-platform/ui-components 1.0.0-dev.166 → 1.0.0-dev.168
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/published/components/custom/CriteriaBuilder/CriteriaBuilder.d.ts +1 -0
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +3 -3
- package/dist/published/components/custom/CriteriaBuilder/ValueEditor.js +2 -2
- package/dist/published/components/custom/MultiSelect/MultiSelect.js +23 -6
- package/dist/published/stories/CriteriaBuilder.stories.d.ts +2 -1
- package/dist/published/stories/CriteriaBuilder.stories.js +77 -2
- package/package.json +1 -1
- package/dist/published/styles/custom.css +0 -81
@@ -16,6 +16,7 @@ export declare type CriteriaInputProps = {
|
|
16
16
|
operators?: Operator[];
|
17
17
|
disabled?: boolean;
|
18
18
|
hideBorder?: boolean;
|
19
|
+
presetGroupLabel?: string;
|
19
20
|
};
|
20
21
|
export declare const valueEditor: (props: ValueEditorProps) => JSX.Element;
|
21
22
|
declare const CriteriaBuilder: (props: CriteriaInputProps) => JSX.Element;
|
@@ -103,7 +103,7 @@ const customSelector = (props) => {
|
|
103
103
|
return option === value;
|
104
104
|
}, onChange: (event, newValue) => {
|
105
105
|
handleOnChange(newValue === null || newValue === void 0 ? void 0 : newValue.value.name);
|
106
|
-
}, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { size: "small" })), sx: { width: width }, disableClearable: true }));
|
106
|
+
}, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { size: "small" })), sx: { width: width, maxWidth: title === 'Operators' ? '200px' : 'none' }, disableClearable: true }));
|
107
107
|
};
|
108
108
|
const customCombinator = (props) => {
|
109
109
|
const { options, value, handleOnChange } = props;
|
@@ -136,7 +136,7 @@ export const valueEditor = (props) => {
|
|
136
136
|
return ValueEditor(props);
|
137
137
|
};
|
138
138
|
const CriteriaBuilder = (props) => {
|
139
|
-
const { properties, criteria, setCriteria, enablePresetValues, presetValues, operators, dynamicContentInput, disabled, hideBorder, } = props;
|
139
|
+
const { properties, criteria, setCriteria, enablePresetValues, presetValues, operators, dynamicContentInput, disabled, hideBorder, presetGroupLabel, } = props;
|
140
140
|
const [query, setQuery] = useState(undefined);
|
141
141
|
useEffect(() => {
|
142
142
|
if (criteria) {
|
@@ -227,7 +227,7 @@ const CriteriaBuilder = (props) => {
|
|
227
227
|
removeGroupAction: customDelete,
|
228
228
|
removeRuleAction: customDelete,
|
229
229
|
valueEditor: valueEditor
|
230
|
-
}, context: { dynamicContentInput, presetValues, enablePresetValues }, controlClassnames: {
|
230
|
+
}, context: { dynamicContentInput, presetValues, enablePresetValues, presetGroupLabel }, controlClassnames: {
|
231
231
|
queryBuilder: 'queryBuilder-branches',
|
232
232
|
ruleGroup: 'container',
|
233
233
|
}, operators: operators
|
@@ -68,7 +68,7 @@ const ValueEditor = (props) => {
|
|
68
68
|
return (React.createElement(Autocomplete, { freeSolo: true, multiple: true, options: options, getOptionLabel: (option) => (option.label ? option.label : option), value: Array.isArray(value) ? (disabled ? [] : value) : [], disabled: disabled, onChange: (event, newValue) => {
|
69
69
|
const uniqueSelections = newValue.map((item) => { var _a; return (_a = item.value) !== null && _a !== void 0 ? _a : Number(item); });
|
70
70
|
handleOnChange(uniqueSelections.length ? uniqueSelections : '');
|
71
|
-
}, isOptionEqualToValue: (option, value) => option === value, renderInput: (params) => React.createElement(TextField, Object.assign({ label: params.label }, params, { size: "small" })), groupBy: (option) => { var _a; return
|
71
|
+
}, isOptionEqualToValue: (option, value) => option === value, renderInput: (params) => React.createElement(TextField, Object.assign({ label: params.label }, params, { size: "small" })), groupBy: (option) => { var _a; return isPresetValue((_a = option.value) === null || _a === void 0 ? void 0 : _a.name) ? context.presetGroupLabel || 'Preset Values' : 'Options'; }, renderGroup: groupRenderGroup, sx: { width: '33%' } }));
|
72
72
|
}
|
73
73
|
else {
|
74
74
|
return (React.createElement(TextField, Object.assign({ inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => {
|
@@ -101,7 +101,7 @@ const ValueEditor = (props) => {
|
|
101
101
|
value = (_c = (_b = newValue === null || newValue === void 0 ? void 0 : newValue.value) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '';
|
102
102
|
}
|
103
103
|
handleOnChange(value);
|
104
|
-
}, renderInput: (params) => (React.createElement(TextField, Object.assign({ inputRef: inputRef, label: params.label }, params, { size: "small" }))), groupBy: (option) => { var _a; return
|
104
|
+
}, renderInput: (params) => (React.createElement(TextField, Object.assign({ inputRef: inputRef, label: params.label }, params, { size: "small" }))), groupBy: (option) => { var _a; return isPresetValue((_a = option.value) === null || _a === void 0 ? void 0 : _a.name) ? context.presetGroupLabel || 'Preset Values' : 'Options'; }, renderGroup: groupRenderGroup, sortBy: 'NONE', sx: { width: '33%' } }));
|
105
105
|
}
|
106
106
|
else {
|
107
107
|
return (React.createElement(TextField, { inputRef: inputRef, value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => handleOnChange(e.target.value), onClick: onClick, placeholder: "Value", size: "small", sx: { width: '33%' } }));
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
2
|
-
import { Box,
|
2
|
+
import { Box, Grid, InputAdornment, Switch, TextField, Typography, IconButton, Button } from '@mui/material';
|
3
3
|
import { Search, DragHandleOutlined } from '@mui/icons-material';
|
4
4
|
import UIThemeProvider from '../../../theme';
|
5
5
|
import { sortBy } from 'lodash';
|
@@ -7,6 +7,7 @@ import { DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, us
|
|
7
7
|
import { SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
8
8
|
import { restrictToVerticalAxis, restrictToWindowEdges } from '@dnd-kit/modifiers';
|
9
9
|
import { SortableItem } from './SortableItem';
|
10
|
+
import { Tooltip } from '../../core';
|
10
11
|
const styles = {
|
11
12
|
textField: {
|
12
13
|
borderRadius: '8px',
|
@@ -39,6 +40,11 @@ const styles = {
|
|
39
40
|
pointerEvents: 'auto',
|
40
41
|
},
|
41
42
|
},
|
43
|
+
button: {
|
44
|
+
fontWeight: '400',
|
45
|
+
textTransform: 'uppercase',
|
46
|
+
'&:hover': { backgroundColor: 'transparent' },
|
47
|
+
},
|
42
48
|
};
|
43
49
|
export default function MultiSelect(props) {
|
44
50
|
const { options, onChange, maxHeight, isSortable } = props;
|
@@ -72,15 +78,22 @@ export default function MultiSelect(props) {
|
|
72
78
|
onChange(allOptions);
|
73
79
|
setOptions(newOptions);
|
74
80
|
};
|
75
|
-
const
|
76
|
-
setSelectAll(event.target.checked);
|
81
|
+
const updateOptions = (value) => {
|
77
82
|
const newOptions = optionsArray.map((option) => {
|
78
|
-
option.value =
|
83
|
+
option.value = value;
|
79
84
|
return option;
|
80
85
|
});
|
81
86
|
onChange(newOptions);
|
82
87
|
setOptions(newOptions);
|
83
88
|
};
|
89
|
+
const handleSelectAllChange = (event) => {
|
90
|
+
updateOptions(true);
|
91
|
+
setSelectAll(true);
|
92
|
+
};
|
93
|
+
const handleClearAll = (event) => {
|
94
|
+
updateOptions(false);
|
95
|
+
setSelectAll(false);
|
96
|
+
};
|
84
97
|
const filterItems = (event) => {
|
85
98
|
setSearchText(event.target.value);
|
86
99
|
const keyword = event.target.value.toLowerCase();
|
@@ -122,8 +135,12 @@ export default function MultiSelect(props) {
|
|
122
135
|
startAdornment: (React.createElement(InputAdornment, { position: "start" },
|
123
136
|
React.createElement(Search, null))),
|
124
137
|
}, fullWidth: true, sx: styles.textField, value: searchText, onChange: filterItems }))),
|
125
|
-
(optionsArray === null || optionsArray === void 0 ? void 0 : optionsArray.length) > 1 && (React.createElement(Grid, {
|
126
|
-
React.createElement(
|
138
|
+
(optionsArray === null || optionsArray === void 0 ? void 0 : optionsArray.length) > 1 && (React.createElement(Grid, { container: true },
|
139
|
+
React.createElement(Grid, null,
|
140
|
+
React.createElement(Button, { sx: styles.button, variant: "text", onClick: (e) => handleSelectAllChange(e), disabled: optionsArray.every((option) => option.disabled === true || selectAll) }, "Select All")),
|
141
|
+
React.createElement(Grid, { item: true, xs: 6 },
|
142
|
+
React.createElement(Button, { sx: Object.assign({}, styles.button), variant: "text", onClick: (e) => handleClearAll(e), disabled: optionsArray.every((option) => option.disabled === true) ||
|
143
|
+
optionsArray.every((option) => option.value === false) }, "Clear All")))),
|
127
144
|
React.createElement(Box, { sx: Object.assign(Object.assign({}, styles.list), { maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : 'auto' }) }, !!isSortable ? (React.createElement(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, modifiers: [restrictToVerticalAxis, restrictToWindowEdges] },
|
128
145
|
React.createElement(SortableContext, { items: optionsArray, strategy: verticalListSortingStrategy }, optionsArray.map((option) => {
|
129
146
|
var _a, _b;
|
@@ -3,4 +3,5 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
3
|
declare const _default: ComponentMeta<(props: import("../components/custom/CriteriaBuilder/CriteriaBuilder").CriteriaInputProps) => JSX.Element>;
|
4
4
|
export default _default;
|
5
5
|
export declare const CriteriaBuilder: ComponentStory<(props: import("../components/custom/CriteriaBuilder/CriteriaBuilder").CriteriaInputProps) => JSX.Element>;
|
6
|
-
export declare const
|
6
|
+
export declare const CriteriaBuilderPresetUserID: ComponentStory<(props: import("../components/custom/CriteriaBuilder/CriteriaBuilder").CriteriaInputProps) => JSX.Element>;
|
7
|
+
export declare const CriteriaBuilderGroupedPresetValues: ComponentStory<(props: import("../components/custom/CriteriaBuilder/CriteriaBuilder").CriteriaInputProps) => JSX.Element>;
|
@@ -109,8 +109,8 @@ CriteriaBuilder.args = {
|
|
109
109
|
},
|
110
110
|
enablePresetValues: false,
|
111
111
|
};
|
112
|
-
export const
|
113
|
-
|
112
|
+
export const CriteriaBuilderPresetUserID = CriteriaBuilderTemplate.bind({});
|
113
|
+
CriteriaBuilderPresetUserID.args = {
|
114
114
|
properties: [
|
115
115
|
{
|
116
116
|
id: 'name',
|
@@ -204,3 +204,78 @@ CriteriaBuilderPresetValues.args = {
|
|
204
204
|
},
|
205
205
|
enablePresetValues: true,
|
206
206
|
};
|
207
|
+
export const CriteriaBuilderGroupedPresetValues = CriteriaBuilderTemplate.bind({});
|
208
|
+
CriteriaBuilderGroupedPresetValues.args = {
|
209
|
+
properties: [
|
210
|
+
{
|
211
|
+
id: 'name',
|
212
|
+
name: 'name',
|
213
|
+
type: 'string',
|
214
|
+
required: true,
|
215
|
+
},
|
216
|
+
{
|
217
|
+
id: 'issueDate',
|
218
|
+
name: 'issue date',
|
219
|
+
type: 'date',
|
220
|
+
required: false,
|
221
|
+
objectId: '',
|
222
|
+
},
|
223
|
+
{
|
224
|
+
id: 'status',
|
225
|
+
name: 'status',
|
226
|
+
type: 'string',
|
227
|
+
enum: ['active', 'expired', 'pending approval'],
|
228
|
+
required: false,
|
229
|
+
objectId: '',
|
230
|
+
},
|
231
|
+
{
|
232
|
+
id: 'licensedFor',
|
233
|
+
name: 'licensed for',
|
234
|
+
type: 'array',
|
235
|
+
enum: [
|
236
|
+
'amusements',
|
237
|
+
'food and beverage',
|
238
|
+
'entertainment',
|
239
|
+
'transportation',
|
240
|
+
'hot dogs',
|
241
|
+
'swimming pools',
|
242
|
+
'ferris wheels',
|
243
|
+
'bungee jumping',
|
244
|
+
],
|
245
|
+
required: true,
|
246
|
+
searchable: false,
|
247
|
+
},
|
248
|
+
{
|
249
|
+
id: 'inState',
|
250
|
+
name: 'In State',
|
251
|
+
type: 'string',
|
252
|
+
enum: ['Yes', 'No'],
|
253
|
+
required: false,
|
254
|
+
searchable: false,
|
255
|
+
},
|
256
|
+
],
|
257
|
+
setCriteria: (criteria) => console.log('criteria= ', criteria),
|
258
|
+
criteria: {
|
259
|
+
$or: [
|
260
|
+
{
|
261
|
+
name: '',
|
262
|
+
},
|
263
|
+
],
|
264
|
+
},
|
265
|
+
presetValues: [
|
266
|
+
{
|
267
|
+
label: 'Preset 1',
|
268
|
+
value: { name: '{{{1}}}', label: 'thing1', sublabel: 'thing1' },
|
269
|
+
},
|
270
|
+
{
|
271
|
+
label: 'Preset 2',
|
272
|
+
value: { name: '{{{2}}}', label: 'thing2', sublabel: 'thing2' },
|
273
|
+
},
|
274
|
+
{
|
275
|
+
label: 'Preset 3',
|
276
|
+
value: { name: '{{{3}}}', label: 'thing3', sublabel: 'thing3' },
|
277
|
+
},
|
278
|
+
],
|
279
|
+
presetGroupLabel: 'Parameter Values',
|
280
|
+
enablePresetValues: true,
|
281
|
+
};
|
package/package.json
CHANGED
@@ -1,81 +0,0 @@
|
|
1
|
-
.dxreControl {
|
2
|
-
font: 12px Tahoma, Geneva, sans-serif;
|
3
|
-
box-sizing: border-box;
|
4
|
-
border-width: 1px;
|
5
|
-
border-style: solid;
|
6
|
-
border-radius: 6px;
|
7
|
-
min-height: calc(100vh - 232px);
|
8
|
-
}
|
9
|
-
|
10
|
-
/* MUI-ish styles for devexpress modal */
|
11
|
-
.dx-overlay-content.dx-popup-normal {
|
12
|
-
border-radius: 8px;
|
13
|
-
font-family: 'Roboto', sans-serif;
|
14
|
-
font-size: 14px;
|
15
|
-
color: rgba(0, 0, 0, 0.87);
|
16
|
-
background-color: #ffffff;
|
17
|
-
box-shadow: 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14),
|
18
|
-
0px 9px 46px 8px rgba(0, 0, 0, 0.12);
|
19
|
-
transition: none !important;
|
20
|
-
}
|
21
|
-
|
22
|
-
.dx-popup-title {
|
23
|
-
border: none;
|
24
|
-
}
|
25
|
-
|
26
|
-
/* Apply Material UI-like styles to buttons */
|
27
|
-
.dx-overlay-content.dx-popup-normal .dx-toolbar-button .dx-button-content {
|
28
|
-
font-family: 'Roboto', sans-serif;
|
29
|
-
font-size: 14px;
|
30
|
-
}
|
31
|
-
|
32
|
-
.dx-overlay-content .dx-toolbar-after .dx-toolbar-button .dx-button-mode-contained {
|
33
|
-
border-radius: 0px;
|
34
|
-
border: none;
|
35
|
-
}
|
36
|
-
|
37
|
-
/* MUI-ish styles for the Ok button*/
|
38
|
-
.dx-overlay-content .dx-toolbar-after .dx-toolbar-button:nth-child(1) .dx-button-content {
|
39
|
-
border-radius: 8px;
|
40
|
-
line-height: 1.75;
|
41
|
-
letter-spacing: 0.02857em;
|
42
|
-
color: #ffffff;
|
43
|
-
background-color: #0075a7;
|
44
|
-
box-shadow: none;
|
45
|
-
}
|
46
|
-
|
47
|
-
/* MUI-ish styles for the Cancel button */
|
48
|
-
.dx-overlay-content.dx-popup-normal .dx-toolbar-button:nth-child(2) .dx-button-content {
|
49
|
-
border-radius: 8px;
|
50
|
-
line-height: 1.75;
|
51
|
-
letter-spacing: 0.02857em;
|
52
|
-
margin-right: 10px;
|
53
|
-
color: #0075a7;
|
54
|
-
background-color: transparent;
|
55
|
-
border: 1px solid #0075a7;
|
56
|
-
box-shadow: none;
|
57
|
-
}
|
58
|
-
|
59
|
-
/* Cancel button before ok button */
|
60
|
-
.dx-toolbar-after {
|
61
|
-
display: flex;
|
62
|
-
flex-direction: row-reverse;
|
63
|
-
}
|
64
|
-
|
65
|
-
/* MUI-ish styles for tabs */
|
66
|
-
.dx-tabs-wrapper .dx-tab {
|
67
|
-
font-family: 'Roboto', sans-serif;
|
68
|
-
font-size: 14px;
|
69
|
-
color: rgba(0, 0, 0, 0.6);
|
70
|
-
border-bottom: 2px solid transparent;
|
71
|
-
transition: border-bottom-color 0.2s ease-in-out;
|
72
|
-
padding-bottom: 8px;
|
73
|
-
}
|
74
|
-
|
75
|
-
.dx-tabs-wrapper .dx-tab-selected {
|
76
|
-
border-bottom-color: #1976d2;
|
77
|
-
}
|
78
|
-
/*TODO: figure out why this level of specificity doesn't remove the border on a focused tab container */
|
79
|
-
.dx-item.dx-tab.dx-tab-selected.dx-state-focused {
|
80
|
-
border: none !important;
|
81
|
-
}
|