@evoke-platform/ui-components 1.1.0-testing.2 → 1.1.0-testing.3
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.
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
/// <reference types="react" />
|
2
2
|
import 'react-querybuilder/dist/query-builder.css';
|
3
3
|
import { EvokeObject } from '../../../types';
|
4
4
|
import { ObjectProperty, Operator, PresetValue, TreeViewObject } from './types';
|
@@ -10,10 +10,9 @@ export type CriteriaInputProps = {
|
|
10
10
|
originalCriteria?: Record<string, unknown>;
|
11
11
|
enablePresetValues?: boolean;
|
12
12
|
presetValues?: PresetValue[];
|
13
|
-
|
14
|
-
component:
|
15
|
-
|
16
|
-
trigger?: Record<string, unknown>;
|
13
|
+
customValueEditor?: {
|
14
|
+
component: (props: ValueEditorProps) => JSX.Element;
|
15
|
+
props?: Record<string, unknown>;
|
17
16
|
};
|
18
17
|
operators?: Operator[];
|
19
18
|
disabledCriteria?: {
|
@@ -212,7 +212,10 @@ const customSelector = (props) => {
|
|
212
212
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
213
213
|
onChange: (event, newValue) => {
|
214
214
|
handleOnChange(newValue?.value.name);
|
215
|
-
}, renderInput: (params) => React.createElement(TextField, { ...params, placeholder: placeholder, size: "small"
|
215
|
+
}, renderInput: (params) => (React.createElement(TextField, { ...params, placeholder: placeholder, size: "small", inputProps: {
|
216
|
+
...params.inputProps,
|
217
|
+
'aria-label': placeholder,
|
218
|
+
} })), sx: { width: width, background: '#fff' }, disableClearable: true, readOnly: readOnly }))));
|
216
219
|
};
|
217
220
|
const customCombinator = (props) => {
|
218
221
|
const { value, handleOnChange, context, level, path } = props;
|
@@ -277,7 +280,7 @@ export const valueEditor = (props) => {
|
|
277
280
|
return ValueEditor(props);
|
278
281
|
};
|
279
282
|
const CriteriaBuilder = (props) => {
|
280
|
-
const { properties, criteria, setCriteria, originalCriteria, enablePresetValues, presetValues, operators,
|
283
|
+
const { properties, criteria, setCriteria, originalCriteria, enablePresetValues, presetValues, operators, disabled, disabledCriteria, hideBorder, presetGroupLabel, customValueEditor, treeViewOpts, disableRegexEscapeChars, } = props;
|
281
284
|
const [query, setQuery] = useState(undefined);
|
282
285
|
const [propertyTreeMap, setPropertyTreeMap] = useState();
|
283
286
|
useEffect(() => {
|
@@ -294,7 +297,7 @@ const CriteriaBuilder = (props) => {
|
|
294
297
|
setQuery({ combinator: 'and', rules: [] });
|
295
298
|
}
|
296
299
|
}, [originalCriteria]);
|
297
|
-
|
300
|
+
const processRules = (rules, isSavedValue) => {
|
298
301
|
return rules.map((rule) => {
|
299
302
|
if ('rules' in rule) {
|
300
303
|
return {
|
@@ -320,7 +323,7 @@ const CriteriaBuilder = (props) => {
|
|
320
323
|
};
|
321
324
|
}
|
322
325
|
});
|
323
|
-
}
|
326
|
+
};
|
324
327
|
// this retrieves the properties from a treeview for each property in the query
|
325
328
|
// they are then used in the custom query builder components to determine the input type etc
|
326
329
|
const updatePropertyTreeMap = (q) => {
|
@@ -386,16 +389,12 @@ const CriteriaBuilder = (props) => {
|
|
386
389
|
return defaultRuleProcessorMongoDB(newRule, options);
|
387
390
|
},
|
388
391
|
}));
|
389
|
-
|
390
|
-
|
391
|
-
// since the Add Condition / Add Group buttons add rules with all the fields empty,
|
392
|
-
// we need to check if the first rule was added because q will still parse to { $and: [{ $expr: true }] }
|
393
|
-
const firstRuleAdded = isEmpty(criteria) && q.rules.length > 0;
|
394
|
-
if (allRulesDeleted && !firstRuleAdded) {
|
395
|
-
setCriteria(undefined);
|
392
|
+
if (!isEmpty(difference(newCriteria, { $and: [{ $expr: true }] }))) {
|
393
|
+
setCriteria(newCriteria);
|
396
394
|
}
|
397
395
|
else {
|
398
|
-
|
396
|
+
if (q.rules.length === 0)
|
397
|
+
setCriteria(undefined);
|
399
398
|
}
|
400
399
|
};
|
401
400
|
const fields = useMemo(() => {
|
@@ -498,9 +497,9 @@ const CriteriaBuilder = (props) => {
|
|
498
497
|
ruleGroup: CustomRuleGroup,
|
499
498
|
removeGroupAction: customDelete,
|
500
499
|
removeRuleAction: customDelete,
|
501
|
-
valueEditor: valueEditor,
|
500
|
+
valueEditor: customValueEditor ? customValueEditor.component : valueEditor,
|
502
501
|
}, context: {
|
503
|
-
|
502
|
+
...(customValueEditor?.props ?? {}),
|
504
503
|
presetValues,
|
505
504
|
enablePresetValues,
|
506
505
|
presetGroupLabel,
|
@@ -1,11 +1,13 @@
|
|
1
|
-
export { ClickAwayListener,
|
1
|
+
export { ClickAwayListener, createTheme, darken, lighten, styled, Toolbar } from '@mui/material';
|
2
2
|
export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTimePicker, StaticTimePicker, TimePicker, YearPicker, } from '@mui/x-date-pickers';
|
3
|
+
export * from './colors';
|
3
4
|
export * from './components/core';
|
4
|
-
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormField, MenuBar, MultiSelect, RepeatableField,
|
5
|
+
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormField, HistoryLog, MenuBar, MultiSelect, RepeatableField, RichTextViewer, UserAvatar, } from './components/custom';
|
6
|
+
export { NumericFormat } from './components/custom/FormField/InputFieldComponent';
|
5
7
|
export { Box, Container, Grid, Stack } from './components/layout';
|
6
8
|
export * as EVOKE_TYPES from './types';
|
7
9
|
export * from './util';
|
8
|
-
export type { ButtonBaseActions, ButtonBaseClasses, FormControlProps, FormHelperTextProps, GridSize, MenuItemClasses, Theme, } from '@mui/material';
|
10
|
+
export type { AutocompleteRenderGroupParams, ButtonBaseActions, ButtonBaseClasses, FormControlProps, FormHelperTextProps, GridSize, MenuItemClasses, TextFieldProps, Theme, } from '@mui/material';
|
9
11
|
export type { TouchRippleActions, TouchRippleProps } from '@mui/material/ButtonBase/TouchRipple';
|
10
12
|
export type { CommonProps } from '@mui/material/OverridableComponent';
|
11
13
|
export type { SxProps } from '@mui/system';
|
package/dist/published/index.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
export { ClickAwayListener,
|
1
|
+
export { ClickAwayListener, createTheme, darken, lighten, styled, Toolbar } from '@mui/material';
|
2
2
|
export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTimePicker, StaticTimePicker, TimePicker, YearPicker, } from '@mui/x-date-pickers';
|
3
|
+
export * from './colors';
|
3
4
|
export * from './components/core';
|
4
|
-
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormField, MenuBar, MultiSelect, RepeatableField,
|
5
|
+
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormField, HistoryLog, MenuBar, MultiSelect, RepeatableField, RichTextViewer, UserAvatar, } from './components/custom';
|
6
|
+
export { NumericFormat } from './components/custom/FormField/InputFieldComponent';
|
5
7
|
export { Box, Container, Grid, Stack } from './components/layout';
|
6
8
|
export * as EVOKE_TYPES from './types';
|
7
9
|
export * from './util';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@evoke-platform/ui-components",
|
3
|
-
"version": "1.1.0-testing.
|
3
|
+
"version": "1.1.0-testing.3",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/published/index.js",
|
6
6
|
"module": "dist/published/index.js",
|
@@ -135,12 +135,6 @@
|
|
135
135
|
"npm run lint:fix"
|
136
136
|
]
|
137
137
|
},
|
138
|
-
"husky": {
|
139
|
-
"hooks": {
|
140
|
-
"pre-commit": "npx lint-staged",
|
141
|
-
"commit-msg": "npx commitlint --edit $1"
|
142
|
-
}
|
143
|
-
},
|
144
138
|
"jest": {
|
145
139
|
"verbose": true,
|
146
140
|
"testEnvironment": "jsdom",
|