mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Update react-awesome-query-builder package (#75766)
* Upgrade react-awesome-query-builder to v6.4.1 * Update package * Update package and fix types * Remove unnecessary package
This commit is contained in:
parent
1f266a051d
commit
dcaad5b3fd
@ -274,6 +274,7 @@
|
||||
"@react-aria/menu": "3.10.0",
|
||||
"@react-aria/overlays": "3.15.0",
|
||||
"@react-aria/utils": "3.18.0",
|
||||
"@react-awesome-query-builder/ui": "6.4.1",
|
||||
"@react-stately/collections": "3.9.0",
|
||||
"@react-stately/menu": "3.5.3",
|
||||
"@react-stately/tree": "3.7.0",
|
||||
@ -359,7 +360,6 @@
|
||||
"rc-tree": "5.7.9",
|
||||
"re-resizable": "6.9.9",
|
||||
"react": "18.2.0",
|
||||
"react-awesome-query-builder": "5.4.0",
|
||||
"react-beautiful-dnd": "13.1.1",
|
||||
"react-diff-viewer": "^3.1.1",
|
||||
"react-dom": "18.2.0",
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { List } from 'immutable';
|
||||
import { isString } from 'lodash';
|
||||
import React from 'react';
|
||||
import {
|
||||
AnyObject,
|
||||
BasicConfig,
|
||||
Config,
|
||||
JsonItem,
|
||||
@ -9,10 +7,14 @@ import {
|
||||
Operator,
|
||||
Settings,
|
||||
SimpleField,
|
||||
SqlFormatOperator,
|
||||
Utils,
|
||||
ValueSource,
|
||||
Widgets,
|
||||
} from 'react-awesome-query-builder';
|
||||
} from '@react-awesome-query-builder/ui';
|
||||
import { List } from 'immutable';
|
||||
import { isString } from 'lodash';
|
||||
import React from 'react';
|
||||
|
||||
import { dateTime, toOption } from '@grafana/data';
|
||||
import { Button, DateTimePicker, Input, Select } from '@grafana/ui';
|
||||
@ -202,11 +204,24 @@ export const raqbConfig: Config = {
|
||||
|
||||
export type { Config };
|
||||
|
||||
const noop = () => '';
|
||||
|
||||
const isSqlFormatOp = (func: unknown): func is SqlFormatOperator => {
|
||||
return typeof func === 'function';
|
||||
};
|
||||
|
||||
function getCustomOperators(config: BasicConfig) {
|
||||
const { ...supportedOperators } = config.operators;
|
||||
const noop = () => '';
|
||||
|
||||
// IN operator expects array, override IN formatter for multi-value variables
|
||||
const sqlFormatInOp = supportedOperators[Op.IN].sqlFormatOp || noop;
|
||||
const sqlFormatInOpOrNoop = () => {
|
||||
const sqlFormatOp = supportedOperators[Op.IN].sqlFormatOp;
|
||||
if (isSqlFormatOp(sqlFormatOp)) {
|
||||
return sqlFormatOp;
|
||||
}
|
||||
return noop;
|
||||
};
|
||||
|
||||
const customSqlInFormatter = (
|
||||
field: string,
|
||||
op: string,
|
||||
@ -214,13 +229,29 @@ function getCustomOperators(config: BasicConfig) {
|
||||
valueSrc: ValueSource,
|
||||
valueType: string,
|
||||
opDef: Operator,
|
||||
operatorOptions: object,
|
||||
operatorOptions: AnyObject,
|
||||
fieldDef: SimpleField
|
||||
) => {
|
||||
return sqlFormatInOp(field, op, splitIfString(value), valueSrc, valueType, opDef, operatorOptions, fieldDef);
|
||||
return sqlFormatInOpOrNoop()(
|
||||
field,
|
||||
op,
|
||||
splitIfString(value),
|
||||
valueSrc,
|
||||
valueType,
|
||||
opDef,
|
||||
operatorOptions,
|
||||
fieldDef
|
||||
);
|
||||
};
|
||||
// NOT IN operator expects array, override NOT IN formatter for multi-value variables
|
||||
const sqlFormatNotInOp = supportedOperators[Op.NOT_IN].sqlFormatOp || noop;
|
||||
const sqlFormatNotInOpOrNoop = () => {
|
||||
const sqlFormatOp = supportedOperators[Op.NOT_IN].sqlFormatOp;
|
||||
if (isSqlFormatOp(sqlFormatOp)) {
|
||||
return sqlFormatOp;
|
||||
}
|
||||
return noop;
|
||||
};
|
||||
|
||||
const customSqlNotInFormatter = (
|
||||
field: string,
|
||||
op: string,
|
||||
@ -228,10 +259,19 @@ function getCustomOperators(config: BasicConfig) {
|
||||
valueSrc: ValueSource,
|
||||
valueType: string,
|
||||
opDef: Operator,
|
||||
operatorOptions: object,
|
||||
operatorOptions: AnyObject,
|
||||
fieldDef: SimpleField
|
||||
) => {
|
||||
return sqlFormatNotInOp(field, op, splitIfString(value), valueSrc, valueType, opDef, operatorOptions, fieldDef);
|
||||
return sqlFormatNotInOpOrNoop()(
|
||||
field,
|
||||
op,
|
||||
splitIfString(value),
|
||||
valueSrc,
|
||||
valueType,
|
||||
opDef,
|
||||
operatorOptions,
|
||||
fieldDef
|
||||
);
|
||||
};
|
||||
|
||||
const customOperators = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { injectGlobal } from '@emotion/css';
|
||||
import { Builder, Config, ImmutableTree, Query, Utils } from '@react-awesome-query-builder/ui';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { Builder, Config, ImmutableTree, Query, Utils } from 'react-awesome-query-builder';
|
||||
|
||||
import { SQLExpression } from '../../types';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { JsonTree } from 'react-awesome-query-builder';
|
||||
import { JsonTree } from '@react-awesome-query-builder/ui';
|
||||
|
||||
import {
|
||||
DataFrame,
|
||||
|
99
yarn.lock
99
yarn.lock
@ -2778,24 +2778,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@date-io/core@npm:^1.3.13":
|
||||
version: 1.3.13
|
||||
resolution: "@date-io/core@npm:1.3.13"
|
||||
checksum: 5a9e9d1de20f0346a3c7d2d5946190caef4bfb0b64d82ba1f4c566657a9192667c94ebe7f438d11d4286d9c190974daad4fb2159294225cd8af4d9a140239879
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@date-io/moment@npm:^1.3.13":
|
||||
version: 1.3.13
|
||||
resolution: "@date-io/moment@npm:1.3.13"
|
||||
dependencies:
|
||||
"@date-io/core": ^1.3.13
|
||||
peerDependencies:
|
||||
moment: ^2.24.0
|
||||
checksum: c4847f9d1bf09bb22c1acc5806fc50825c0bdb52408c9fec8cc5f9a65f16a8014870b5890a0eeb73b2c53a6487c35acbd2ab2a5c49068ff5a5dccbcb5c9e654b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@daybrush/utils@npm:1.13.0, @daybrush/utils@npm:^1.13.0":
|
||||
version: 1.13.0
|
||||
resolution: "@daybrush/utils@npm:1.13.0"
|
||||
@ -7460,6 +7442,38 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@react-awesome-query-builder/core@npm:^6.4.1":
|
||||
version: 6.4.1
|
||||
resolution: "@react-awesome-query-builder/core@npm:6.4.1"
|
||||
dependencies:
|
||||
clone: ^2.1.2
|
||||
immutable: ^3.8.2
|
||||
json-logic-js: ^2.0.2
|
||||
lodash: ^4.17.21
|
||||
moment: ^2.29.4
|
||||
spel2js: ^0.2.8
|
||||
sqlstring: ^2.3.3
|
||||
checksum: 0eafbe012ab25aa2e918207e46950d2f39ee56c542d4a34c74b64a17f4228eb9323320f38820cf18a93e90f570a2b3517a37c9a80ddbc5d6919f3efda76a2260
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@react-awesome-query-builder/ui@npm:6.4.1":
|
||||
version: 6.4.1
|
||||
resolution: "@react-awesome-query-builder/ui@npm:6.4.1"
|
||||
dependencies:
|
||||
"@react-awesome-query-builder/core": ^6.4.1
|
||||
classnames: ^2.3.1
|
||||
lodash: ^4.17.21
|
||||
prop-types: ^15.7.2
|
||||
react-redux: ^7.2.2
|
||||
redux: ^4.2.0
|
||||
peerDependencies:
|
||||
react: ^16.8.4 || ^17.0.1 || ^18.0.0
|
||||
react-dom: ^16.8.4 || ^17.0.1 || ^18.0.0
|
||||
checksum: 34103e9dd2a76d0d57310436babd35d7aabe70d34ed60de6338ceb75b9e2faad73372d799e0b26d2766d33df7ca959e17026a13e600c27469023e19fddce89f8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@react-stately/collections@npm:3.9.0, @react-stately/collections@npm:^3.9.0":
|
||||
version: 3.9.0
|
||||
resolution: "@react-stately/collections@npm:3.9.0"
|
||||
@ -20000,6 +20014,7 @@ __metadata:
|
||||
"@react-aria/menu": 3.10.0
|
||||
"@react-aria/overlays": 3.15.0
|
||||
"@react-aria/utils": 3.18.0
|
||||
"@react-awesome-query-builder/ui": 6.4.1
|
||||
"@react-stately/collections": 3.9.0
|
||||
"@react-stately/menu": 3.5.3
|
||||
"@react-stately/tree": 3.7.0
|
||||
@ -20205,7 +20220,6 @@ __metadata:
|
||||
rc-tree: 5.7.9
|
||||
re-resizable: 6.9.9
|
||||
react: 18.2.0
|
||||
react-awesome-query-builder: 5.4.0
|
||||
react-beautiful-dnd: 13.1.1
|
||||
react-diff-viewer: ^3.1.1
|
||||
react-dom: 18.2.0
|
||||
@ -23534,6 +23548,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"json-logic-js@npm:^2.0.2":
|
||||
version: 2.0.2
|
||||
resolution: "json-logic-js@npm:2.0.2"
|
||||
checksum: 34846500b76a25a86de65560afe358e844b384f0f61c1832fed6a9dfc8f45d884be0b0c8ab033d1a2df7c92b33910d8cee1b3d28e0f461cc55c715d2761219ef
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"json-markup@npm:^1.1.0":
|
||||
version: 1.1.4
|
||||
resolution: "json-markup@npm:1.1.4"
|
||||
@ -28326,46 +28347,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"react-awesome-query-builder@npm:5.4.0":
|
||||
version: 5.4.0
|
||||
resolution: "react-awesome-query-builder@npm:5.4.0"
|
||||
dependencies:
|
||||
"@date-io/moment": ^1.3.13
|
||||
classnames: ^2.3.1
|
||||
clone: ^2.1.2
|
||||
immutable: ^3.8.2
|
||||
lodash: ^4.17.21
|
||||
moment: ^2.29.4
|
||||
prop-types: ^15.7.2
|
||||
react-redux: ^7.2.2
|
||||
redux: ^4.2.0
|
||||
spel2js: ^0.2.8
|
||||
sqlstring: ^2.3.3
|
||||
peerDependencies:
|
||||
"@ant-design/icons": ^4.0.0
|
||||
"@emotion/react": ^11.7.1
|
||||
"@emotion/styled": ^11.6.0
|
||||
"@fortawesome/fontawesome-svg-core": ^1.2.0 || ^6.1.0
|
||||
"@fortawesome/free-solid-svg-icons": ^5.15.4 || ^6.0.0
|
||||
"@fortawesome/react-fontawesome": ^0.1.16 || ^0.2.0
|
||||
"@material-ui/core": ^4.12.3
|
||||
"@material-ui/icons": ^4.0.0
|
||||
"@material-ui/lab": ^4.0.0-alpha.57
|
||||
"@material-ui/pickers": ^3.2.10
|
||||
"@mui/icons-material": ^5.2.4
|
||||
"@mui/lab": ^5.0.0-alpha.60
|
||||
"@mui/material": ^5.2.4
|
||||
"@mui/x-date-pickers": ^5.0.0-beta.2
|
||||
antd: ^4.0.0
|
||||
bootstrap: ^5.1.3
|
||||
material-ui-confirm: ^2.0.1 || ^3.0.0
|
||||
react: ^16.8.4 || ^17.0.1 || ^18.0.0
|
||||
react-dom: ^16.8.4 || ^17.0.1 || ^18.0.0
|
||||
reactstrap: ^9.0.0
|
||||
checksum: 96f97b94c6544549e9d0991cec3f7753db722066ed2c24ba75cc0c8f90f2b04ab7f338c6a4a124bac78a0916c53ea864af4382ecb552e283602941c40ae9a035
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"react-beautiful-dnd@npm:13.1.1":
|
||||
version: 13.1.1
|
||||
resolution: "react-beautiful-dnd@npm:13.1.1"
|
||||
|
Loading…
Reference in New Issue
Block a user