@evoke-platform/ui-components 1.0.0-dev.155 → 1.0.0-dev.157
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/BuilderGrid/BuilderGrid.d.ts +2 -2
- package/dist/published/components/custom/BuilderGrid/BuilderGrid.js +2 -2
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +39 -14
- package/package.json +1 -1
- /package/dist/published/stories/{Typogrpahy.stories.d.ts → Typography.stories.d.ts} +0 -0
- /package/dist/published/stories/{Typogrpahy.stories.js → Typography.stories.js} +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import { GridValidRowModel, DataGridProps as MuiDataGridProps } from '@mui/x-data-grid';
|
2
|
+
import { GridSortItem, GridValidRowModel, DataGridProps as MuiDataGridProps } from '@mui/x-data-grid';
|
3
3
|
import { EmptyContentSelectOptions } from './EmptyContent';
|
4
4
|
export declare type GridAction = {
|
5
5
|
label: string;
|
@@ -8,7 +8,7 @@ export declare type GridAction = {
|
|
8
8
|
export declare type BuilderGridProps<T extends GridValidRowModel> = MuiDataGridProps<T> & {
|
9
9
|
action?: GridAction;
|
10
10
|
item?: string;
|
11
|
-
initialSort?:
|
11
|
+
initialSort?: GridSortItem;
|
12
12
|
emptyContentSelectOptions?: EmptyContentSelectOptions;
|
13
13
|
};
|
14
14
|
declare const BuilderGrid: <T extends GridValidRowModel>(props: BuilderGridProps<T>) => JSX.Element;
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
10
10
|
return t;
|
11
11
|
};
|
12
12
|
import { Box } from '@mui/material';
|
13
|
-
import { DataGrid as MuiDataGrid } from '@mui/x-data-grid';
|
13
|
+
import { DataGrid as MuiDataGrid, } from '@mui/x-data-grid';
|
14
14
|
import React, { useMemo, useState } from 'react';
|
15
15
|
import UIThemeProvider from '../../../theme';
|
16
16
|
import BuilderGridToolbar from './BuilderGridToolbar';
|
@@ -60,7 +60,7 @@ const BuilderGrid = (props) => {
|
|
60
60
|
marginLeft: '4px',
|
61
61
|
}, height: 'calc(100vh - 240px)' }, rest.sx), getRowId: (row) => row.id, disableColumnMenu: true, initialState: {
|
62
62
|
sorting: {
|
63
|
-
sortModel: initialSort ? [
|
63
|
+
sortModel: initialSort ? [initialSort] : [],
|
64
64
|
},
|
65
65
|
}, componentsProps: {
|
66
66
|
panel: {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { RemoveCircleOutline } from '@mui/icons-material';
|
2
2
|
import { QueryBuilderMaterial } from '@react-querybuilder/material';
|
3
3
|
import React, { useEffect, useMemo, useState } from 'react';
|
4
|
-
import { QueryBuilder, formatQuery, parseMongoDB, } from 'react-querybuilder';
|
4
|
+
import { QueryBuilder, formatQuery, parseMongoDB, useRuleGroup, TestID, RuleGroupBodyComponents, RuleGroupHeaderComponents, } from 'react-querybuilder';
|
5
5
|
import 'react-querybuilder/dist/query-builder.css';
|
6
6
|
import { Autocomplete, Button, DatePicker, IconButton, LocalizationProvider, MenuItem, TextField, Typography, } from '../../core';
|
7
7
|
import { Box } from '../../layout';
|
@@ -26,6 +26,43 @@ const ALL_OPERATORS = [
|
|
26
26
|
{ name: 'between', label: 'between' },
|
27
27
|
{ name: 'notBetween', label: 'not between' },
|
28
28
|
];
|
29
|
+
const CustomRuleGroup = (props) => {
|
30
|
+
const rg = Object.assign(Object.assign({}, props), useRuleGroup(props));
|
31
|
+
const [addRule, addGroup, cloneGroup, toggleLockGroup, removeGroup] = [
|
32
|
+
rg.addRule,
|
33
|
+
rg.addGroup,
|
34
|
+
rg.cloneGroup,
|
35
|
+
rg.toggleLockGroup,
|
36
|
+
rg.removeGroup,
|
37
|
+
].map(f => (event, context) => {
|
38
|
+
event.preventDefault();
|
39
|
+
event.stopPropagation();
|
40
|
+
f(event, context);
|
41
|
+
});
|
42
|
+
const subComponentProps = Object.assign(Object.assign({}, rg), { addRule,
|
43
|
+
addGroup,
|
44
|
+
cloneGroup,
|
45
|
+
toggleLockGroup,
|
46
|
+
removeGroup });
|
47
|
+
return (React.createElement("div", { ref: rg.previewRef, className: rg.outerClassName, "data-testid": TestID.ruleGroup, "data-dragmonitorid": rg.dragMonitorId, "data-dropmonitorid": rg.dropMonitorId, "data-rule-group-id": rg.id, "data-level": rg.path.length, "data-path": JSON.stringify(rg.path) },
|
48
|
+
React.createElement("div", { className: rg.classNames.body },
|
49
|
+
React.createElement(RuleGroupBodyComponents, Object.assign({}, subComponentProps))),
|
50
|
+
React.createElement("div", { ref: rg.dropRef, className: rg.classNames.header },
|
51
|
+
React.createElement(RuleGroupHeaderComponents, Object.assign({}, subComponentProps, { schema: Object.assign(Object.assign({}, subComponentProps.schema), { controls: Object.assign({}, subComponentProps.schema.controls) }) })))));
|
52
|
+
};
|
53
|
+
const customButton = (props) => {
|
54
|
+
const { title, handleOnClick, label } = props;
|
55
|
+
let buttonLabel = label;
|
56
|
+
switch (title) {
|
57
|
+
case 'Add group':
|
58
|
+
buttonLabel = '+ Condition Group';
|
59
|
+
break;
|
60
|
+
case 'Add rule':
|
61
|
+
buttonLabel = '+ Condition';
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
return (React.createElement(Button, { variant: "contained", onClick: handleOnClick, size: "small", sx: { backgroundColor: '#ebf4f8', color: '#0678a9', boxShadow: 'none' } }, buttonLabel));
|
65
|
+
};
|
29
66
|
const customSelector = (props) => {
|
30
67
|
var _a, _b;
|
31
68
|
const { options, value, handleOnChange, title } = props;
|
@@ -75,19 +112,6 @@ const customCombinator = (props) => {
|
|
75
112
|
},
|
76
113
|
}, disableClearable: true }));
|
77
114
|
};
|
78
|
-
const customButton = (props) => {
|
79
|
-
const { title, handleOnClick, label } = props;
|
80
|
-
let buttonLabel = label;
|
81
|
-
switch (title) {
|
82
|
-
case 'Add group':
|
83
|
-
buttonLabel = '+ Condition Group';
|
84
|
-
break;
|
85
|
-
case 'Add rule':
|
86
|
-
buttonLabel = '+ Condition';
|
87
|
-
break;
|
88
|
-
}
|
89
|
-
return (React.createElement(Button, { variant: "contained", onClick: handleOnClick, size: "small", sx: { backgroundColor: '#ebf4f8', color: '#0678a9', boxShadow: 'none' } }, buttonLabel));
|
90
|
-
};
|
91
115
|
const customDelete = (props) => {
|
92
116
|
const { handleOnClick } = props;
|
93
117
|
return (React.createElement(IconButton, { onClick: handleOnClick, size: "small" },
|
@@ -320,6 +344,7 @@ const CriteriaBuilder = (props) => {
|
|
320
344
|
operatorSelector: customSelector,
|
321
345
|
addGroupAction: customButton,
|
322
346
|
addRuleAction: customButton,
|
347
|
+
ruleGroup: CustomRuleGroup,
|
323
348
|
removeGroupAction: customDelete,
|
324
349
|
removeRuleAction: customDelete,
|
325
350
|
valueEditor: enablePresetValues
|
package/package.json
CHANGED
File without changes
|
File without changes
|