@hitachivantara/uikit-react-lab 3.45.4 → 3.45.7

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.
@@ -3,7 +3,19 @@ import { StandardProps } from "@material-ui/core";
3
3
 
4
4
  import { Attribute, Query, QueryBuilderLabels, QueryCombinator, QueryOperator } from "./types";
5
5
 
6
- export type HvQueryBuilderClassKey = "";
6
+ export type HvQueryBuilderClassKey =
7
+ | "root"
8
+ | "topGroup"
9
+ | "subGroup"
10
+ | "combinator"
11
+ | "topCombinator"
12
+ | "combinatorButton"
13
+ | "removeButton"
14
+ | "topRemoveButton"
15
+ | "rulesContainer"
16
+ | "subRulesContainer"
17
+ | "actionButtonContainer"
18
+ | "topActionButtonContainer";
7
19
 
8
20
  export interface HvQueryBuilderProps
9
21
  extends StandardProps<React.HTMLAttributes<HTMLDivElement>, HvQueryBuilderClassKey, "onChange"> {
@@ -38,4 +50,4 @@ export interface HvQueryBuilderProps
38
50
  labels?: QueryBuilderLabels;
39
51
  }
40
52
 
41
- export default function HvSlider(props: HvQueryBuilderProps): JSX.Element | null;
53
+ export default function HvQueryBuilder(props: HvQueryBuilderProps): JSX.Element | null;
@@ -66,7 +66,8 @@ var HvQueryBuilder = function HvQueryBuilder(_ref) {
66
66
  combinators = _ref.combinators,
67
67
  _ref$maxDepth = _ref.maxDepth,
68
68
  maxDepth = _ref$maxDepth === void 0 ? 1 : _ref$maxDepth,
69
- labels = _ref.labels;
69
+ labels = _ref.labels,
70
+ classes = _ref.classes;
70
71
 
71
72
  var _useState = (0, _react.useState)(),
72
73
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -141,7 +142,8 @@ var HvQueryBuilder = function HvQueryBuilder(_ref) {
141
142
  level: 0,
142
143
  id: state.id,
143
144
  combinator: state.combinator,
144
- rules: state.rules
145
+ rules: state.rules,
146
+ classes: classes
145
147
  }), /*#__PURE__*/_react.default.createElement(_ConfirmationDialog.default, {
146
148
  isOpen: pendingAction != null,
147
149
  onConfirm: onConfirmHandler,
@@ -156,8 +158,70 @@ var HvQueryBuilder = function HvQueryBuilder(_ref) {
156
158
 
157
159
  process.env.NODE_ENV !== "production" ? HvQueryBuilder.propTypes = {
158
160
  /**
159
- * The query rules attributes.
161
+ * Override or extend the styles applied to the component.
162
+ * See CSS API tab for more details.
160
163
  */
164
+ classes: _propTypes.default.shape({
165
+ /**
166
+ * Styles applied to the component root class.
167
+ */
168
+ root: _propTypes.default.string,
169
+
170
+ /**
171
+ * Styles applied to the top group container.
172
+ */
173
+ topGroup: _propTypes.default.string,
174
+
175
+ /**
176
+ * Styles applied to the sub group containers.
177
+ */
178
+ subGroup: _propTypes.default.string,
179
+
180
+ /**
181
+ * Styles applied to the multi-button combinator container.
182
+ */
183
+ combinator: _propTypes.default.string,
184
+
185
+ /**
186
+ * Styles applied to the multi-button combinator container on the top group.
187
+ */
188
+ topCombinator: _propTypes.default.string,
189
+
190
+ /**
191
+ * Styles applied to each combinator button.
192
+ */
193
+ combinatorButton: _propTypes.default.string,
194
+
195
+ /**
196
+ * Styles applied to the remove button.
197
+ */
198
+ removeButton: _propTypes.default.string,
199
+
200
+ /**
201
+ * Styles applied to the remove button on the top group.
202
+ */
203
+ topRemoveButton: _propTypes.default.string,
204
+
205
+ /**
206
+ * Styles applied to the rules container.
207
+ */
208
+ rulesContainer: _propTypes.default.string,
209
+
210
+ /**
211
+ * Styles applied to the sub rules container.
212
+ */
213
+ subRulesContainer: _propTypes.default.string,
214
+
215
+ /**
216
+ * Styles applied to the action button container.
217
+ */
218
+ actionButtonContainer: _propTypes.default.string,
219
+
220
+ /**
221
+ * Styles applied to the top action button container.
222
+ */
223
+ topActionButtonContainer: _propTypes.default.string
224
+ }),
161
225
  attributes: _propTypes.default.shape({
162
226
  key: _propTypes.default.shape({
163
227
  id: _propTypes.default.number,
@@ -1 +1 @@
1
- {"version":3,"file":"QueryBuilder.js","names":["HvQueryBuilder","attributes","query","onChange","operators","combinators","maxDepth","labels","pendingAction","askAction","currentAttributes","reducer","initialState","state","dispatchAction","prevState","setPrevState","defaultcontext","Context","context","initialTouched","current","type","onConfirmHandler","undefined","actions","forEach","action","onCancelHandler","id","combinator","rules","dialog","dialogTitle","dialogMessage","dialogConfirm","dialogCancel","dialogCloseTooltip","propTypes","PropTypes","shape","key","number","label","string","isRequired","value","any","order","arrayOf","operator","operand","attribute","func","instanceOf","Object","styles","name"],"sources":["../../src/QueryBuilder/QueryBuilder.js"],"sourcesContent":["import React, { useEffect, useMemo, useReducer, useRef, useState, useContext } from \"react\";\nimport PropTypes from \"prop-types\";\nimport isEqual from \"lodash/isEqual\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { withStyles } from \"@material-ui/core\";\n\nimport Context from \"./Context\";\nimport RuleGroup from \"./RuleGroup\";\nimport ConfirmationDialog from \"./ConfirmationDialog\";\nimport { emptyGroup, clearNodeIds } from \"./utils\";\nimport reducer from \"./utils/reducer\";\nimport styles from \"./styles\";\n\n/**\n * **HvQueryBuilder** component allows you to create conditions and group them using logical operators.\n * It outputs a structured set of rules which can be easily parsed to create SQL/NoSQL/whatever queries.\n *\n * **PLEASE NOTE**: This component implementation is still a WIP. There might be breaking changes.\n */\nconst HvQueryBuilder = ({\n attributes = [],\n query,\n onChange,\n operators,\n combinators,\n maxDepth = 1,\n labels,\n}) => {\n const [pendingAction, askAction] = useState();\n const currentAttributes = useRef();\n const [state, dispatchAction] = useReducer(\n reducer,\n query,\n (initialState) => initialState || emptyGroup()\n );\n\n const initialState = query === state;\n const [prevState, setPrevState] = useState();\n\n const defaultcontext = useContext(Context);\n\n const context = useMemo(\n () => ({\n dispatchAction,\n askAction,\n attributes,\n operators: operators ?? defaultcontext.operators,\n combinators: combinators ?? defaultcontext.combinators,\n maxDepth: maxDepth ?? defaultcontext.maxDepth,\n labels: labels ?? defaultcontext.labels,\n initialTouched: initialState,\n }),\n [\n attributes,\n operators,\n defaultcontext.operators,\n defaultcontext.combinators,\n defaultcontext.maxDepth,\n defaultcontext.labels,\n combinators,\n maxDepth,\n labels,\n initialState,\n ]\n );\n\n useEffect(() => {\n if (currentAttributes.current == null) {\n // first run, nothing to do\n currentAttributes.current = attributes;\n } else if (currentAttributes.current !== attributes) {\n // attributes changed, the existing query is almost certain invalid, so reset it\n currentAttributes.current = attributes;\n dispatchAction({ type: \"reset-query\" });\n }\n }, [attributes]);\n\n // Propagate the change if the query is modified.\n useEffect(() => {\n if (!initialState && !isEqual(state, prevState)) {\n onChange?.(clearNodeIds(state));\n setPrevState(cloneDeep(state));\n }\n }, [state, prevState, initialState, onChange]);\n\n const onConfirmHandler = () => {\n if (pendingAction) {\n askAction(undefined);\n pendingAction.actions.forEach((action) => dispatchAction(action));\n }\n };\n\n const onCancelHandler = () => {\n askAction(undefined);\n };\n\n return (\n <Context.Provider value={context}>\n <RuleGroup level={0} id={state.id} combinator={state.combinator} rules={state.rules} />\n <ConfirmationDialog\n isOpen={pendingAction != null}\n onConfirm={onConfirmHandler}\n onCancel={onCancelHandler}\n title={pendingAction?.dialog.dialogTitle || \"\"}\n message={pendingAction?.dialog.dialogMessage || \"\"}\n confirmButtonLabel={pendingAction?.dialog.dialogConfirm || \"\"}\n cancelButtonLabel={pendingAction?.dialog.dialogCancel || \"\"}\n closeButtonTooltip={pendingAction?.dialog.dialogCloseTooltip || \"\"}\n />\n </Context.Provider>\n );\n};\n\nHvQueryBuilder.propTypes = {\n /**\n * The query rules attributes.\n */\n attributes: PropTypes.shape({\n key: PropTypes.shape({\n id: PropTypes.number,\n label: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n value: PropTypes.any,\n order: PropTypes.number,\n }),\n }).isRequired,\n /**\n * The query rules operators by attribute type and combinator.\n */\n operators: PropTypes.shape({\n type: PropTypes.arrayOf(\n PropTypes.shape({\n operator: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n combinators: PropTypes.arrayOf(PropTypes.string).isRequired,\n })\n ),\n }),\n /**\n * The query combinators operands.\n */\n combinators: PropTypes.arrayOf(\n PropTypes.shape({\n operand: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n })\n ),\n /**\n * The initial query representation.\n */\n query: PropTypes.shape({\n id: PropTypes.number,\n combinator: PropTypes.string.isRequired,\n rules: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number,\n attribute: PropTypes.string,\n operator: PropTypes.string,\n value: PropTypes.any,\n })\n ).isRequired,\n }),\n /**\n * Callback fired when query changes.\n */\n onChange: PropTypes.func,\n /**\n * Max depth of nested query groups.\n */\n maxDepth: PropTypes.number,\n /**\n * An object containing all the labels.\n */\n labels: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvQueryBuilder\" })(HvQueryBuilder);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,OAQjB;EAAA,2BAPJC,UAOI;EAAA,IAPJA,UAOI,gCAPS,EAOT;EAAA,IANJC,KAMI,QANJA,KAMI;EAAA,IALJC,QAKI,QALJA,QAKI;EAAA,IAJJC,SAII,QAJJA,SAII;EAAA,IAHJC,WAGI,QAHJA,WAGI;EAAA,yBAFJC,QAEI;EAAA,IAFJA,QAEI,8BAFO,CAEP;EAAA,IADJC,MACI,QADJA,MACI;;EACJ,gBAAmC,sBAAnC;EAAA;EAAA,IAAOC,aAAP;EAAA,IAAsBC,SAAtB;;EACA,IAAMC,iBAAiB,GAAG,oBAA1B;;EACA,kBAAgC,uBAC9BC,gBAD8B,EAE9BT,KAF8B,EAG9B,UAACU,YAAD;IAAA,OAAkBA,YAAY,IAAI,wBAAlC;EAAA,CAH8B,CAAhC;EAAA;EAAA,IAAOC,KAAP;EAAA,IAAcC,cAAd;;EAMA,IAAMF,YAAY,GAAGV,KAAK,KAAKW,KAA/B;;EACA,iBA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,KAAK,EAAEqC,mBAAUC,KAAV,CAAgB;IACrBX,EAAE,EAAEU,mBAAUG,MADO;IAErBZ,UAAU,EAAES,mBAAUK,MAAV,CAAiBC,UAFR;IAGrBd,KAAK,EAAEQ,mBAAUU,OAAV,CACLV,mBAAUC,KAAV,CAAgB;MACdX,EAAE,EAAEU,mBAAUG,MADA;MAEdU,SAAS,EAAEb,mBAAUK,MAFP;MAGdM,QAAQ,EAAEX,mBAAUK,MAHN;MAIdE,KAAK,EAAEP,mBAAUQ;IAJH,CAAhB,CADK,EAOLF;EAVmB,CAAhB,CArCkB;;EAiDzB;AACF;AACA;EACE1C,QAAQ,EAAEoC,mBAAUc,IApDK;;EAqDzB;AACF;AACA;EACE/C,QAAQ,EAAEiC,mBAAUG,MAxDK;;EAyDzB;AACF;AACA;EACEnC,MAAM,EAAEgC,mBAAUe,UAAV,CAAqBC,MAArB;AA5DiB,CAA3B;;eA+De,sBAAWC,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAA+CzD,cAA/C,C"}
1
+ {"version":3,"file":"QueryBuilder.js","names":["HvQueryBuilder","attributes","query","onChange","operators","combinators","maxDepth","labels","classes","pendingAction","askAction","currentAttributes","reducer","initialState","state","dispatchAction","prevState","setPrevState","defaultcontext","Context","context","initialTouched","current","type","onConfirmHandler","undefined","actions","forEach","action","onCancelHandler","id","combinator","rules","dialog","dialogTitle","dialogMessage","dialogConfirm","dialogCancel","dialogCloseTooltip","propTypes","PropTypes","shape","root","string","topGroup","subGroup","topCombinator","combinatorButton","removeButton","topRemoveButton","rulesContainer","subRulesContainer","actionButtonContainer","topActionButtonContainer","key","number","label","isRequired","value","any","order","arrayOf","operator","operand","attribute","func","instanceOf","Object","styles","name"],"sources":["../../src/QueryBuilder/QueryBuilder.js"],"sourcesContent":["import React, { useEffect, useMemo, useReducer, useRef, useState, useContext } from \"react\";\nimport PropTypes from \"prop-types\";\nimport isEqual from \"lodash/isEqual\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { withStyles } from \"@material-ui/core\";\n\nimport Context from \"./Context\";\nimport RuleGroup from \"./RuleGroup\";\nimport ConfirmationDialog from \"./ConfirmationDialog\";\nimport { emptyGroup, clearNodeIds } from \"./utils\";\nimport reducer from \"./utils/reducer\";\nimport styles from \"./styles\";\n\n/**\n * **HvQueryBuilder** component allows you to create conditions and group them using logical operators.\n * It outputs a structured set of rules which can be easily parsed to create SQL/NoSQL/whatever queries.\n *\n * **PLEASE NOTE**: This component implementation is still a WIP. There might be breaking changes.\n */\nconst HvQueryBuilder = ({\n attributes = [],\n query,\n onChange,\n operators,\n combinators,\n maxDepth = 1,\n labels,\n classes,\n}) => {\n const [pendingAction, askAction] = useState();\n const currentAttributes = useRef();\n const [state, dispatchAction] = useReducer(\n reducer,\n query,\n (initialState) => initialState || emptyGroup()\n );\n\n const initialState = query === state;\n const [prevState, setPrevState] = useState();\n\n const defaultcontext = useContext(Context);\n\n const context = useMemo(\n () => ({\n dispatchAction,\n askAction,\n attributes,\n operators: operators ?? defaultcontext.operators,\n combinators: combinators ?? defaultcontext.combinators,\n maxDepth: maxDepth ?? defaultcontext.maxDepth,\n labels: labels ?? defaultcontext.labels,\n initialTouched: initialState,\n }),\n [\n attributes,\n operators,\n defaultcontext.operators,\n defaultcontext.combinators,\n defaultcontext.maxDepth,\n defaultcontext.labels,\n combinators,\n maxDepth,\n labels,\n initialState,\n ]\n );\n\n useEffect(() => {\n if (currentAttributes.current == null) {\n // first run, nothing to do\n currentAttributes.current = attributes;\n } else if (currentAttributes.current !== attributes) {\n // attributes changed, the existing query is almost certain invalid, so reset it\n currentAttributes.current = attributes;\n dispatchAction({ type: \"reset-query\" });\n }\n }, [attributes]);\n\n // Propagate the change if the query is modified.\n useEffect(() => {\n if (!initialState && !isEqual(state, prevState)) {\n onChange?.(clearNodeIds(state));\n setPrevState(cloneDeep(state));\n }\n }, [state, prevState, initialState, onChange]);\n\n const onConfirmHandler = () => {\n if (pendingAction) {\n askAction(undefined);\n pendingAction.actions.forEach((action) => dispatchAction(action));\n }\n };\n\n const onCancelHandler = () => {\n askAction(undefined);\n };\n\n return (\n <Context.Provider value={context}>\n <RuleGroup\n level={0}\n id={state.id}\n combinator={state.combinator}\n rules={state.rules}\n classes={classes}\n />\n <ConfirmationDialog\n isOpen={pendingAction != null}\n onConfirm={onConfirmHandler}\n onCancel={onCancelHandler}\n title={pendingAction?.dialog.dialogTitle || \"\"}\n message={pendingAction?.dialog.dialogMessage || \"\"}\n confirmButtonLabel={pendingAction?.dialog.dialogConfirm || \"\"}\n cancelButtonLabel={pendingAction?.dialog.dialogCancel || \"\"}\n closeButtonTooltip={pendingAction?.dialog.dialogCloseTooltip || \"\"}\n />\n </Context.Provider>\n );\n};\n\nHvQueryBuilder.propTypes = {\n /**\n * Override or extend the styles applied to the component.\n * See CSS API tab for more details.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the top group container.\n */\n topGroup: PropTypes.string,\n /**\n * Styles applied to the sub group containers.\n */\n subGroup: PropTypes.string,\n /**\n * Styles applied to the multi-button combinator container.\n */\n combinator: PropTypes.string,\n /**\n * Styles applied to the multi-button combinator container on the top group.\n */\n topCombinator: PropTypes.string,\n /**\n * Styles applied to each combinator button.\n */\n combinatorButton: PropTypes.string,\n /**\n * Styles applied to the remove button.\n */\n removeButton: PropTypes.string,\n /**\n * Styles applied to the remove button on the top group.\n */\n topRemoveButton: PropTypes.string,\n /**\n * Styles applied to the rules container.\n */\n rulesContainer: PropTypes.string,\n /**\n * Styles applied to the sub rules container.\n */\n subRulesContainer: PropTypes.string,\n /**\n * Styles applied to the action button container.\n */\n actionButtonContainer: PropTypes.string,\n /**\n * Styles applied to the top action button container.\n */\n topActionButtonContainer: PropTypes.string,\n }),\n attributes: PropTypes.shape({\n key: PropTypes.shape({\n id: PropTypes.number,\n label: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n value: PropTypes.any,\n order: PropTypes.number,\n }),\n }).isRequired,\n /**\n * The query rules operators by attribute type and combinator.\n */\n operators: PropTypes.shape({\n type: PropTypes.arrayOf(\n PropTypes.shape({\n operator: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n combinators: PropTypes.arrayOf(PropTypes.string).isRequired,\n })\n ),\n }),\n /**\n * The query combinators operands.\n */\n combinators: PropTypes.arrayOf(\n PropTypes.shape({\n operand: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n })\n ),\n /**\n * The initial query representation.\n */\n query: PropTypes.shape({\n id: PropTypes.number,\n combinator: PropTypes.string.isRequired,\n rules: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number,\n attribute: PropTypes.string,\n operator: PropTypes.string,\n value: PropTypes.any,\n })\n ).isRequired,\n }),\n /**\n * Callback fired when query changes.\n */\n onChange: PropTypes.func,\n /**\n * Max depth of nested query groups.\n */\n maxDepth: PropTypes.number,\n /**\n * An object containing all the labels.\n */\n labels: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvQueryBuilder\" })(HvQueryBuilder);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,OASjB;EAAA,2BARJC,UAQI;EAAA,IARJA,UAQI,gCARS,EAQT;EAAA,IAPJC,KAOI,QAPJA,KAOI;EAAA,IANJC,QAMI,QANJA,QAMI;EAAA,IALJC,SAKI,QALJA,SAKI;EAAA,IAJJC,WAII,QAJJA,WAII;EAAA,yBAHJC,QAGI;EAAA,IAHJA,QAGI,8BAHO,CAGP;EAAA,IAFJC,MAEI,QAFJA,MAEI;EAAA,IADJC,OACI,QADJA,OACI;;EACJ,gBAAmC,sBAAnC;EAAA;EAAA,IAAOC,aAAP;EAAA,IAAsBC,SAAtB;;EACA,IAAMC,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MAEdS,SAAS,EAAExB,mBAAUG,MAFP;MAGdmB,QAAQ,EAAEtB,mBAAUG,MAHN;MAIde,KAAK,EAAElB,mBAAUmB;IAJH,CAAhB,CADK,EAOLF;EAVmB,CAAhB,CAxFkB;;EAoGzB;AACF;AACA;EACEtD,QAAQ,EAAEqC,mBAAUyB,IAvGK;;EAwGzB;AACF;AACA;EACE3D,QAAQ,EAAEkC,mBAAUe,MA3GK;;EA4GzB;AACF;AACA;EACEhD,MAAM,EAAEiC,mBAAU0B,UAAV,CAAqBC,MAArB;AA/GiB,CAA3B;;eAkHe,sBAAWC,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAA+CrE,cAA/C,C"}
@@ -29,6 +29,8 @@ var _react = _interopRequireWildcard(require("react"));
29
29
 
30
30
  var _clsx = _interopRequireDefault(require("clsx"));
31
31
 
32
+ var _core = require("@material-ui/core");
33
+
32
34
  var _propTypes = _interopRequireDefault(require("prop-types"));
33
35
 
34
36
  var _uikitReactCore = require("@hitachivantara/uikit-react-core");
@@ -56,10 +58,8 @@ var RuleGroup = function RuleGroup(_ref) {
56
58
  _ref$combinator = _ref.combinator,
57
59
  combinator = _ref$combinator === void 0 ? "and" : _ref$combinator,
58
60
  _ref$rules = _ref.rules,
59
- rules = _ref$rules === void 0 ? [] : _ref$rules;
60
- var classes = (0, _styles.default)({
61
- level: level
62
- });
61
+ rules = _ref$rules === void 0 ? [] : _ref$rules,
62
+ classes = _ref.classes;
63
63
  var context = (0, _react.useContext)(_Context.default);
64
64
  var dispatchAction = context.dispatchAction,
65
65
  askAction = context.askAction,
@@ -138,7 +138,8 @@ var RuleGroup = function RuleGroup(_ref) {
138
138
  key: rule.id || Math.random(),
139
139
  level: level + 1
140
140
  }, rule, {
141
- id: rule.id
141
+ id: rule.id,
142
+ classes: classes
142
143
  }));
143
144
  }
144
145
 
@@ -197,11 +198,80 @@ var RuleGroup = function RuleGroup(_ref) {
197
198
  };
198
199
 
199
200
  process.env.NODE_ENV !== "production" ? RuleGroup.propTypes = {
201
+ /**
202
+ * Override or extend the styles applied to the component.
203
+ * See CSS API tab for more details.
204
+ */
205
+ classes: _propTypes.default.shape({
206
+ /**
207
+ * Styles applied to the component root class.
208
+ */
209
+ root: _propTypes.default.string,
210
+
211
+ /**
212
+ * Styles applied to the top group container.
213
+ */
214
+ topGroup: _propTypes.default.string,
215
+
216
+ /**
217
+ * Styles applied to the sub group containers.
218
+ */
219
+ subGroup: _propTypes.default.string,
220
+
221
+ /**
222
+ * Styles applied to the multi-button combinator container.
223
+ */
224
+ combinator: _propTypes.default.string,
225
+
226
+ /**
227
+ * Styles applied to the multi-button combinator container on the top group.
228
+ */
229
+ topCombinator: _propTypes.default.string,
230
+
231
+ /**
232
+ * Styles applied to each combinator button.
233
+ */
234
+ combinatorButton: _propTypes.default.string,
235
+
236
+ /**
237
+ * Styles applied to the remove button.
238
+ */
239
+ removeButton: _propTypes.default.string,
240
+
241
+ /**
242
+ * Styles applied to the remove button on the top group.
243
+ */
244
+ topRemoveButton: _propTypes.default.string,
245
+
246
+ /**
247
+ * Styles applied to the rules container.
248
+ */
249
+ rulesContainer: _propTypes.default.string,
250
+
251
+ /**
252
+ * Styles applied to the sub rules container.
253
+ */
254
+ subRulesContainer: _propTypes.default.string,
255
+
256
+ /**
257
+ * Styles applied to the action button container.
258
+ */
259
+ actionButtonContainer: _propTypes.default.string,
260
+
261
+ /**
262
+ * Styles applied to the top action button container.
263
+ */
264
+ topActionButtonContainer: _propTypes.default.string
265
+ }),
200
266
  id: _propTypes.default.number,
201
267
  level: _propTypes.default.number,
202
268
  combinator: _propTypes.default.string,
203
269
  rules: _propTypes.default.array
204
270
  } : void 0;
205
- var _default = RuleGroup;
271
+
272
+ var _default = (0, _core.withStyles)(_styles.default, {
273
+ name: "RuleGroup"
274
+ })(RuleGroup);
275
+
206
276
  exports.default = _default;
207
277
  //# sourceMappingURL=RuleGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RuleGroup.js","names":["RuleGroup","level","id","combinator","rules","classes","context","Context","dispatchAction","askAction","maxDepth","combinators","labels","normalizedMaxDepth","actionButtons","type","query","addRule","label","group","addGroup","DeleteIcon","delete","tooltip","onClickCombinator","item","operand","root","topGroup","subGroup","topCombinator","map","combinatorButton","removeButton","topRemoveButton","actions","dialog","ariaLabel","length","rulesContainer","subRulesContainer","rule","index","Math","random","isInvalid","some","r","i","attribute","empty","title","cursor","textDecoration","createCondition","spacer","createGroup","actionButtonContainer","topActionButtonContainer","propTypes","PropTypes","number","string","array"],"sources":["../../../src/QueryBuilder/RuleGroup/RuleGroup.js"],"sourcesContent":["import React, { useCallback, useContext } from \"react\";\nimport clsx from \"clsx\";\nimport PropTypes from \"prop-types\";\nimport {\n HvGrid,\n HvMultiButton,\n HvButton,\n HvEmptyState,\n HvTypography,\n withTooltip,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Add, Delete, Info } from \"@hitachivantara/uikit-react-icons\";\n\nimport Context from \"../Context\";\nimport Rule from \"../Rule\";\nimport useStyles from \"./styles\";\n\nconst RuleGroup = ({ level = 0, id, combinator = \"and\", rules = [] }) => {\n const classes = useStyles({ level });\n const context = useContext(Context);\n\n const { dispatchAction, askAction, maxDepth, combinators, labels } = context;\n const normalizedMaxDepth = maxDepth - 1;\n\n const actionButtons = (\n <>\n <HvButton\n category=\"secondary\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n >\n <Add />\n {level === 0 && labels.query?.addRule?.label != null\n ? labels.query?.addRule?.label\n : labels.group.addRule.label}\n </HvButton>\n {level <= normalizedMaxDepth && (\n <HvButton\n category=\"secondary\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n >\n <Add />\n {level === 0 && labels.query?.addGroup?.label != null\n ? labels.query?.addGroup?.label\n : labels.group.addGroup.label}\n </HvButton>\n )}\n </>\n );\n\n const DeleteIcon = withTooltip(\n () => <Delete />,\n level === 0 && labels.query?.delete?.tooltip\n ? labels.query?.delete?.tooltip\n : labels.group.delete.tooltip,\n \"top\"\n );\n\n const onClickCombinator = useCallback(\n (item) => {\n dispatchAction({\n type: \"set-combinator\",\n id,\n combinator: item.operand,\n });\n },\n [dispatchAction, id]\n );\n\n return (\n <div\n className={clsx(classes.root, {\n [classes.topGroup]: level === 0,\n [classes.subGroup]: level !== 0,\n })}\n >\n <HvGrid container>\n <HvGrid item>\n <HvMultiButton className={clsx(classes.combinator, classes.topCombinator)}>\n {combinators.map((item) => (\n <HvButton\n key={item.operand}\n className={classes.combinatorButton}\n selected={item.operand === combinator}\n onClick={() => item.operand && onClickCombinator(item)}\n >\n {item.label}\n </HvButton>\n ))}\n </HvMultiButton>\n </HvGrid>\n <HvGrid item>\n <HvButton\n icon\n className={clsx(classes.removeButton, classes.topRemoveButton)}\n onClick={() => {\n askAction({\n actions: [{ type: \"remove-node\", id }],\n dialog:\n level === 0 && labels.query?.delete != null\n ? labels.query.delete\n : labels.group.delete,\n });\n }}\n aria-label={\n level === 0 && labels.query?.delete?.ariaLabel\n ? labels.query?.delete?.ariaLabel\n : labels.group.delete.ariaLabel\n }\n >\n <DeleteIcon />\n </HvButton>\n </HvGrid>\n </HvGrid>\n {rules?.length > 0 && (\n <div\n className={clsx(classes.rulesContainer, {\n [classes.subRulesContainer]: level > 0,\n topRulesContainer: level === 0,\n })}\n >\n {rules.map((rule, index) => {\n if (\"combinator\" in rule) {\n return (\n <RuleGroup\n key={rule.id || Math.random()}\n level={level + 1}\n {...rule}\n id={rule.id}\n />\n );\n }\n\n const isInvalid =\n combinator === \"and\" &&\n rules.some((r, i) => {\n if (\"attribute\" in r) {\n if (r.attribute === rule.attribute && r.id !== rule.id && i < index) {\n return true;\n }\n }\n return false;\n });\n\n return (\n <Rule\n key={rule.id || Math.random()}\n {...rule}\n isInvalid={isInvalid}\n id={rule.id}\n combinator={combinator}\n />\n );\n })}\n </div>\n )}\n {rules?.length === 0 && (\n <HvEmptyState\n title={labels.empty?.title}\n message={\n <>\n <HvTypography\n variant=\"link\"\n component=\"a\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n style={{ cursor: \"pointer\", textDecoration: \"underline\" }}\n >\n {`${labels.empty?.createCondition}`}\n </HvTypography>\n {level <= normalizedMaxDepth && (\n <>\n {`${labels.empty?.spacer}`}\n <HvTypography\n variant=\"link\"\n component=\"a\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n style={{ cursor: \"pointer\", textDecoration: \"underline\" }}\n >\n {`${labels.empty?.createGroup}`}\n </HvTypography>\n </>\n )}\n </>\n }\n icon={<Info />}\n />\n )}\n <HvGrid container>\n <HvGrid\n item\n className={clsx(classes.actionButtonContainer, classes.topActionButtonContainer)}\n >\n {actionButtons}\n </HvGrid>\n </HvGrid>\n </div>\n );\n};\n\nRuleGroup.propTypes = {\n id: PropTypes.number,\n level: PropTypes.number,\n combinator: PropTypes.string,\n rules: PropTypes.array,\n};\n\nexport default RuleGroup;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAQA;;AAEA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY,OAAuD;EAAA;;EAAA,sBAApDC,KAAoD;EAAA,IAApDA,KAAoD,2BAA5C,CAA4C;EAAA,IAAzCC,EAAyC,QAAzCA,EAAyC;EAAA,2BAArCC,UAAqC;EAAA,IAArCA,UAAqC,gCAAxB,KAAwB;EAAA,sBAAjBC,KAAiB;EAAA,IAAjBA,KAAiB,2BAAT,EAAS;EACvE,IAAMC,OAAO,GAAG,qBAAU;IAAEJ,KAAK,EAALA;EAAF,CAAV,CAAhB;EACA,IAAMK,OAAO,GAAG,uBAAWC,gBAAX,CAAhB;EAEA,IAAQC,cAAR,GAAqEF,OAArE,CAAQE,cAAR;EAAA,IAAwBC,SAAxB,GAAqEH,OAArE,CAAwBG,SAAxB;EAAA,IAAmCC,QAAnC,GAAqEJ,OAArE,CAAmCI,QAAnC;EAAA,IAA6CC,WAA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KAAK,EAAE;QAAEkD,MAAM,EAAE,SAAV;QAAqBC,cAAc,EAAE;MAArC;IANT,+BAQMzC,MAAM,CAACsC,KARb,mDAQM,eAAcM,WARpB,EAFF,CAZJ,CAHJ;IA+BE,IAAI,iCAAE,6BAAC,qBAAD,OAAF;EA/BN,EAvFJ,eAyHE,6BAAC,sBAAD;IAAQ,SAAS;EAAjB,gBACE,6BAAC,sBAAD;IACE,IAAI,MADN;IAEE,SAAS,EAAE,mBAAKnD,OAAO,CAACoD,qBAAb,EAAoCpD,OAAO,CAACqD,wBAA5C;EAFb,GAIG5C,aAJH,CADF,CAzHF,CADF;AAoID,CA3LD;;AA6LA,wCAAAd,SAAS,CAAC2D,SAAV,GAAsB;EACpBzD,EAAE,EAAE0D,mBAAUC,MADM;EAEpB5D,KAAK,EAAE2D,mBAAUC,MAFG;EAGpB1D,UAAU,EAAEyD,mBAAUE,MAHF;EAIpB1D,KAAK,EAAEwD,mBAAUG;AAJG,CAAtB;eAOe/D,S"}
1
+ {"version":3,"file":"RuleGroup.js","names":["RuleGroup","level","id","combinator","rules","classes","context","Context","dispatchAction","askAction","maxDepth","combinators","labels","normalizedMaxDepth","actionButtons","type","query","addRule","label","group","addGroup","DeleteIcon","delete","tooltip","onClickCombinator","item","operand","root","topGroup","subGroup","topCombinator","map","combinatorButton","removeButton","topRemoveButton","actions","dialog","ariaLabel","length","rulesContainer","subRulesContainer","rule","index","Math","random","isInvalid","some","r","i","attribute","empty","title","cursor","textDecoration","createCondition","spacer","createGroup","actionButtonContainer","topActionButtonContainer","propTypes","PropTypes","shape","string","number","array","styles","name"],"sources":["../../../src/QueryBuilder/RuleGroup/RuleGroup.js"],"sourcesContent":["import React, { useCallback, useContext } from \"react\";\nimport clsx from \"clsx\";\nimport { withStyles } from \"@material-ui/core\";\nimport PropTypes from \"prop-types\";\nimport {\n HvGrid,\n HvMultiButton,\n HvButton,\n HvEmptyState,\n HvTypography,\n withTooltip,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Add, Delete, Info } from \"@hitachivantara/uikit-react-icons\";\n\nimport Context from \"../Context\";\nimport Rule from \"../Rule\";\nimport styles from \"./styles\";\n\nconst RuleGroup = ({ level = 0, id, combinator = \"and\", rules = [], classes }) => {\n const context = useContext(Context);\n\n const { dispatchAction, askAction, maxDepth, combinators, labels } = context;\n const normalizedMaxDepth = maxDepth - 1;\n\n const actionButtons = (\n <>\n <HvButton\n category=\"secondary\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n >\n <Add />\n {level === 0 && labels.query?.addRule?.label != null\n ? labels.query?.addRule?.label\n : labels.group.addRule.label}\n </HvButton>\n {level <= normalizedMaxDepth && (\n <HvButton\n category=\"secondary\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n >\n <Add />\n {level === 0 && labels.query?.addGroup?.label != null\n ? labels.query?.addGroup?.label\n : labels.group.addGroup.label}\n </HvButton>\n )}\n </>\n );\n\n const DeleteIcon = withTooltip(\n () => <Delete />,\n level === 0 && labels.query?.delete?.tooltip\n ? labels.query?.delete?.tooltip\n : labels.group.delete.tooltip,\n \"top\"\n );\n\n const onClickCombinator = useCallback(\n (item) => {\n dispatchAction({\n type: \"set-combinator\",\n id,\n combinator: item.operand,\n });\n },\n [dispatchAction, id]\n );\n\n return (\n <div\n className={clsx(classes.root, {\n [classes.topGroup]: level === 0,\n [classes.subGroup]: level !== 0,\n })}\n >\n <HvGrid container>\n <HvGrid item>\n <HvMultiButton className={clsx(classes.combinator, classes.topCombinator)}>\n {combinators.map((item) => (\n <HvButton\n key={item.operand}\n className={classes.combinatorButton}\n selected={item.operand === combinator}\n onClick={() => item.operand && onClickCombinator(item)}\n >\n {item.label}\n </HvButton>\n ))}\n </HvMultiButton>\n </HvGrid>\n <HvGrid item>\n <HvButton\n icon\n className={clsx(classes.removeButton, classes.topRemoveButton)}\n onClick={() => {\n askAction({\n actions: [{ type: \"remove-node\", id }],\n dialog:\n level === 0 && labels.query?.delete != null\n ? labels.query.delete\n : labels.group.delete,\n });\n }}\n aria-label={\n level === 0 && labels.query?.delete?.ariaLabel\n ? labels.query?.delete?.ariaLabel\n : labels.group.delete.ariaLabel\n }\n >\n <DeleteIcon />\n </HvButton>\n </HvGrid>\n </HvGrid>\n {rules?.length > 0 && (\n <div\n className={clsx(classes.rulesContainer, {\n [classes.subRulesContainer]: level > 0,\n topRulesContainer: level === 0,\n })}\n >\n {rules.map((rule, index) => {\n if (\"combinator\" in rule) {\n return (\n <RuleGroup\n key={rule.id || Math.random()}\n level={level + 1}\n {...rule}\n id={rule.id}\n classes={classes}\n />\n );\n }\n\n const isInvalid =\n combinator === \"and\" &&\n rules.some((r, i) => {\n if (\"attribute\" in r) {\n if (r.attribute === rule.attribute && r.id !== rule.id && i < index) {\n return true;\n }\n }\n return false;\n });\n\n return (\n <Rule\n key={rule.id || Math.random()}\n {...rule}\n isInvalid={isInvalid}\n id={rule.id}\n combinator={combinator}\n />\n );\n })}\n </div>\n )}\n {rules?.length === 0 && (\n <HvEmptyState\n title={labels.empty?.title}\n message={\n <>\n <HvTypography\n variant=\"link\"\n component=\"a\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n style={{ cursor: \"pointer\", textDecoration: \"underline\" }}\n >\n {`${labels.empty?.createCondition}`}\n </HvTypography>\n {level <= normalizedMaxDepth && (\n <>\n {`${labels.empty?.spacer}`}\n <HvTypography\n variant=\"link\"\n component=\"a\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n style={{ cursor: \"pointer\", textDecoration: \"underline\" }}\n >\n {`${labels.empty?.createGroup}`}\n </HvTypography>\n </>\n )}\n </>\n }\n icon={<Info />}\n />\n )}\n <HvGrid container>\n <HvGrid\n item\n className={clsx(classes.actionButtonContainer, classes.topActionButtonContainer)}\n >\n {actionButtons}\n </HvGrid>\n </HvGrid>\n </div>\n );\n};\n\nRuleGroup.propTypes = {\n /**\n * Override or extend the styles applied to the component.\n * See CSS API tab for more details.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the top group container.\n */\n topGroup: PropTypes.string,\n /**\n * Styles applied to the sub group containers.\n */\n subGroup: PropTypes.string,\n /**\n * Styles applied to the multi-button combinator container.\n */\n combinator: PropTypes.string,\n /**\n * Styles applied to the multi-button combinator container on the top group.\n */\n topCombinator: PropTypes.string,\n /**\n * Styles applied to each combinator button.\n */\n combinatorButton: PropTypes.string,\n /**\n * Styles applied to the remove button.\n */\n removeButton: PropTypes.string,\n /**\n * Styles applied to the remove button on the top group.\n */\n topRemoveButton: PropTypes.string,\n /**\n * Styles applied to the rules container.\n */\n rulesContainer: PropTypes.string,\n /**\n * Styles applied to the sub rules container.\n */\n subRulesContainer: PropTypes.string,\n /**\n * Styles applied to the action button container.\n */\n actionButtonContainer: PropTypes.string,\n /**\n * Styles applied to the top action button container.\n */\n topActionButtonContainer: PropTypes.string,\n }),\n id: PropTypes.number,\n level: PropTypes.number,\n combinator: PropTypes.string,\n rules: PropTypes.array,\n};\n\nexport default withStyles(styles, { name: \"RuleGroup\" })(RuleGroup);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AAEA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY,OAAgE;EAAA;;EAAA,sBAA7DC,KAA6D;EAAA,IAA7DA,KAA6D,2BAArD,CAAqD;EAAA,IAAlDC,EAAkD,QAAlDA,EAAkD;EAAA,2BAA9CC,UAA8C;EAAA,IAA9CA,UAA8C,gCAAjC,KAAiC;EAAA,sBAA1BC,KAA0B;EAAA,IAA1BA,KAA0B,2BAAlB,EAAkB;EAAA,IAAdC,OAAc,QAAdA,OAAc;EAChF,IAAMC,OAAO,GAAG,uBAAWC,gBAAX,CAAhB;EAEA,IAAQC,cAAR,GAAqEF,OAArE,CAAQE,cAAR;EAAA,IAAwBC,SAAxB,GAAqEH,OAArE,CA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AUE,MA5CV;;IA6CvB;AACJ;AACA;IACIJ,wBAAwB,EAAEE,mBAAUE;EAhDb,CAAhB,CALW;EAuDpB5D,EAAE,EAAE0D,mBAAUG,MAvDM;EAwDpB9D,KAAK,EAAE2D,mBAAUG,MAxDG;EAyDpB5D,UAAU,EAAEyD,mBAAUE,MAzDF;EA0DpB1D,KAAK,EAAEwD,mBAAUI;AA1DG,CAAtB;;eA6De,sBAAWC,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAA0ClE,SAA1C,C"}
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _core = require("@material-ui/core");
9
-
10
- var useStyles = (0, _core.makeStyles)(function (theme) {
8
+ var styles = function styles(theme) {
11
9
  return {
12
10
  root: {
13
11
  position: "relative",
@@ -88,7 +86,8 @@ var useStyles = (0, _core.makeStyles)(function (theme) {
88
86
  width: "100%"
89
87
  }
90
88
  };
91
- });
92
- var _default = useStyles;
89
+ };
90
+
91
+ var _default = styles;
93
92
  exports.default = _default;
94
93
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","names":["useStyles","theme","root","position","padding","hv","spacing","sm","marginTop","marginBottom","border","palette","atmosphere","atmo4","subGroup","margin","minHeight","paddingBottom","content","zIndex","width","height","borderBottom","borderLeft","top","left","topGroup","backgroundColor","maxWidth","minWidth","combinator","topCombinator","combinatorButton","actionButtonContainer","marginLeft","topActionButtonContainer","bottom","md","right","removeButton","topRemoveButton","atmo2","rulesContainer","subRulesContainer","paddingLeft","paddingTop"],"sources":["../../../src/QueryBuilder/RuleGroup/styles.js"],"sourcesContent":["import { makeStyles } from \"@material-ui/core\";\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n position: \"relative\",\n padding: theme.hv.spacing.sm,\n\n marginTop: 12,\n marginBottom: 32,\n\n border: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n },\n subGroup: {\n margin: \"40px 14px 32px 20px\",\n minHeight: 120,\n paddingBottom: 60,\n\n \"&::before\": {\n content: '\"\"',\n position: \"absolute\",\n zIndex: 2,\n\n width: 21,\n height: 36,\n\n borderBottom: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n borderLeft: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n\n top: -38,\n left: -42,\n },\n \":not(.topRulesContainer)>&:last-child::after\": {\n content: '\"\"',\n position: \"absolute\",\n zIndex: 1,\n\n width: 32,\n height: \"100%\",\n\n borderLeft: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n\n top: 0,\n left: -22,\n },\n },\n topGroup: {\n margin: theme.hv.spacing.sm,\n backgroundColor: \"transparent\",\n maxWidth: \"100%\",\n minWidth: 740,\n\n paddingBottom: theme.hv.spacing.sm * 3,\n },\n\n combinator: {\n minWidth: 80,\n },\n topCombinator: {\n position: \"absolute\",\n top: -theme.hv.spacing.sm,\n left: -theme.hv.spacing.sm,\n },\n\n combinatorButton: {},\n\n actionButtonContainer: {\n marginLeft: \"auto\",\n\n \"&>*\": {\n marginLeft: theme.hv.spacing.sm,\n },\n },\n topActionButtonContainer: {\n position: \"absolute\",\n bottom: -theme.hv.spacing.md,\n right: theme.hv.spacing.sm,\n },\n\n removeButton: {},\n topRemoveButton: {\n position: \"absolute\",\n top: -16,\n right: -16,\n backgroundColor: theme.hv.palette.atmosphere.atmo2,\n },\n\n rulesContainer: {},\n\n subRulesContainer: {\n borderLeft: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n\n marginLeft: theme.hv.spacing.sm,\n marginBottom: theme.hv.spacing.md,\n paddingLeft: theme.hv.spacing.sm,\n\n paddingTop: 7,\n\n position: \"relative\",\n left: -41,\n\n width: \"100%\",\n },\n}));\n\nexport default useStyles;\n"],"mappings":";;;;;;;AAAA;;AAEA,IAAMA,SAAS,GAAG,sBAAW,UAACC,KAAD;EAAA,OAAY;IACvCC,IAAI,EAAE;MACJC,QAAQ,EAAE,U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BC,EALb;MAOjBsC,UAAU,EAAE,CAPK;MASjB1C,QAAQ,EAAE,UATO;MAUjBsB,IAAI,EAAE,CAAC,EAVU;MAYjBL,KAAK,EAAE;IAZU;EAtFoB,CAAZ;AAAA,CAAX,CAAlB;eAsGepB,S"}
1
+ {"version":3,"file":"styles.js","names":["styles","theme","root","position","padding","hv","spacing","sm","marginTop","marginBottom","border","palette","atmosphere","atmo4","subGroup","margin","minHeight","paddingBottom","content","zIndex","width","height","borderBottom","borderLeft","top","left","topGroup","backgroundColor","maxWidth","minWidth","combinator","topCombinator","combinatorButton","actionButtonContainer","marginLeft","topActionButtonContainer","bottom","md","right","removeButton","topRemoveButton","atmo2","rulesContainer","subRulesContainer","paddingLeft","paddingTop"],"sources":["../../../src/QueryBuilder/RuleGroup/styles.js"],"sourcesContent":["const styles = (theme) => ({\n root: {\n position: \"relative\",\n padding: theme.hv.spacing.sm,\n\n marginTop: 12,\n marginBottom: 32,\n\n border: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n },\n subGroup: {\n margin: \"40px 14px 32px 20px\",\n minHeight: 120,\n paddingBottom: 60,\n\n \"&::before\": {\n content: '\"\"',\n position: \"absolute\",\n zIndex: 2,\n\n width: 21,\n height: 36,\n\n borderBottom: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n borderLeft: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n\n top: -38,\n left: -42,\n },\n \":not(.topRulesContainer)>&:last-child::after\": {\n content: '\"\"',\n position: \"absolute\",\n zIndex: 1,\n\n width: 32,\n height: \"100%\",\n\n borderLeft: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n\n top: 0,\n left: -22,\n },\n },\n topGroup: {\n margin: theme.hv.spacing.sm,\n backgroundColor: \"transparent\",\n maxWidth: \"100%\",\n minWidth: 740,\n\n paddingBottom: theme.hv.spacing.sm * 3,\n },\n\n combinator: {\n minWidth: 80,\n },\n topCombinator: {\n position: \"absolute\",\n top: -theme.hv.spacing.sm,\n left: -theme.hv.spacing.sm,\n },\n\n combinatorButton: {},\n\n actionButtonContainer: {\n marginLeft: \"auto\",\n\n \"&>*\": {\n marginLeft: theme.hv.spacing.sm,\n },\n },\n topActionButtonContainer: {\n position: \"absolute\",\n bottom: -theme.hv.spacing.md,\n right: theme.hv.spacing.sm,\n },\n\n removeButton: {},\n topRemoveButton: {\n position: \"absolute\",\n top: -16,\n right: -16,\n backgroundColor: theme.hv.palette.atmosphere.atmo2,\n },\n\n rulesContainer: {},\n\n subRulesContainer: {\n borderLeft: `1px solid ${theme.hv.palette.atmosphere.atmo4}`,\n\n marginLeft: theme.hv.spacing.sm,\n marginBottom: theme.hv.spacing.md,\n paddingLeft: theme.hv.spacing.sm,\n\n paddingTop: 7,\n\n position: \"relative\",\n left: -41,\n\n width: \"100%\",\n },\n});\n\nexport default styles;\n"],"mappings":";;;;;;;AAAA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;EAAA,OAAY;IACzBC,IAAI,EAAE;MACJC,QAAQ,EAAE,UADN;MAEJC,OAAO,EAAEH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EAFtB;MAIJC,SAAS,EAAE,EAJP;MAKJC,YAAY,EAAE,EALV;MAOJC,MAAM,sBAAeT,KAAK,CAACI,EAAN,CAASM,OAAT,CAAiBC,UAAjB,CAA4BC,KAA3C;IAPF,CADmB;IAUzBC,QAAQ,EAAE;MACRC,MAAM,EAAE,qBADA;MAERC,SAAS,EAAE,GAFH;MAGRC,aAAa,EAAE,EAHP;MAKR,aAAa;QACXC,OAAO,EAAE,IADE;QAEXf,QAAQ,EAAE,UAFC;QAGXgB,MAAM,EAAE,CAHG;QAKXC,KAAK,EAAE,EALI;QAMXC,MAAM,EAAE,EANG;QAQXC,YAAY,sBAAerB,KAAK,CAACI,EAAN,CAASM,OAAT,CAAiBC,UAAjB,CAA4BC,KAA3C,CARD;QASXU,UAAU,sBAAetB,KAAK,CAACI,EAAN,CAASM,OAAT,CAAiBC,UA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EAAErC,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC;IAHA,CAtED;IA4EzBgC,YAAY,EAAE,EA5EW;IA6EzBC,eAAe,EAAE;MACfrC,QAAQ,EAAE,UADK;MAEfqB,GAAG,EAAE,CAAC,EAFS;MAGfc,KAAK,EAAE,CAAC,EAHO;MAIfX,eAAe,EAAE1B,KAAK,CAACI,EAAN,CAASM,OAAT,CAAiBC,UAAjB,CAA4B6B;IAJ9B,CA7EQ;IAoFzBC,cAAc,EAAE,EApFS;IAsFzBC,iBAAiB,EAAE;MACjBpB,UAAU,sBAAetB,KAAK,CAACI,EAAN,CAASM,OAAT,CAAiBC,UAAjB,CAA4BC,KAA3C,CADO;MAGjBqB,UAAU,EAAEjC,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EAHZ;MAIjBE,YAAY,EAAER,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiB+B,EAJd;MAKjBO,WAAW,EAAE3C,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,EALb;MAOjBsC,UAAU,EAAE,CAPK;MASjB1C,QAAQ,EAAE,UATO;MAUjBsB,IAAI,EAAE,CAAC,EAVU;MAYjBL,KAAK,EAAE;IAZU;EAtFM,CAAZ;AAAA,CAAf;;eAsGepB,M"}
@@ -3,7 +3,19 @@ import { StandardProps } from "@material-ui/core";
3
3
 
4
4
  import { Attribute, Query, QueryBuilderLabels, QueryCombinator, QueryOperator } from "./types";
5
5
 
6
- export type HvQueryBuilderClassKey = "";
6
+ export type HvQueryBuilderClassKey =
7
+ | "root"
8
+ | "topGroup"
9
+ | "subGroup"
10
+ | "combinator"
11
+ | "topCombinator"
12
+ | "combinatorButton"
13
+ | "removeButton"
14
+ | "topRemoveButton"
15
+ | "rulesContainer"
16
+ | "subRulesContainer"
17
+ | "actionButtonContainer"
18
+ | "topActionButtonContainer";
7
19
 
8
20
  export interface HvQueryBuilderProps
9
21
  extends StandardProps<React.HTMLAttributes<HTMLDivElement>, HvQueryBuilderClassKey, "onChange"> {
@@ -38,4 +50,4 @@ export interface HvQueryBuilderProps
38
50
  labels?: QueryBuilderLabels;
39
51
  }
40
52
 
41
- export default function HvSlider(props: HvQueryBuilderProps): JSX.Element | null;
53
+ export default function HvQueryBuilder(props: HvQueryBuilderProps): JSX.Element | null;
@@ -28,7 +28,8 @@ var HvQueryBuilder = function HvQueryBuilder(_ref) {
28
28
  combinators = _ref.combinators,
29
29
  _ref$maxDepth = _ref.maxDepth,
30
30
  maxDepth = _ref$maxDepth === void 0 ? 1 : _ref$maxDepth,
31
- labels = _ref.labels;
31
+ labels = _ref.labels,
32
+ classes = _ref.classes;
32
33
 
33
34
  var _useState = useState(),
34
35
  _useState2 = _slicedToArray(_useState, 2),
@@ -103,7 +104,8 @@ var HvQueryBuilder = function HvQueryBuilder(_ref) {
103
104
  level: 0,
104
105
  id: state.id,
105
106
  combinator: state.combinator,
106
- rules: state.rules
107
+ rules: state.rules,
108
+ classes: classes
107
109
  }), /*#__PURE__*/React.createElement(ConfirmationDialog, {
108
110
  isOpen: pendingAction != null,
109
111
  onConfirm: onConfirmHandler,
@@ -118,8 +120,70 @@ var HvQueryBuilder = function HvQueryBuilder(_ref) {
118
120
 
119
121
  process.env.NODE_ENV !== "production" ? HvQueryBuilder.propTypes = {
120
122
  /**
121
- * The query rules attributes.
123
+ * Override or extend the styles applied to the component.
124
+ * See CSS API tab for more details.
122
125
  */
126
+ classes: PropTypes.shape({
127
+ /**
128
+ * Styles applied to the component root class.
129
+ */
130
+ root: PropTypes.string,
131
+
132
+ /**
133
+ * Styles applied to the top group container.
134
+ */
135
+ topGroup: PropTypes.string,
136
+
137
+ /**
138
+ * Styles applied to the sub group containers.
139
+ */
140
+ subGroup: PropTypes.string,
141
+
142
+ /**
143
+ * Styles applied to the multi-button combinator container.
144
+ */
145
+ combinator: PropTypes.string,
146
+
147
+ /**
148
+ * Styles applied to the multi-button combinator container on the top group.
149
+ */
150
+ topCombinator: PropTypes.string,
151
+
152
+ /**
153
+ * Styles applied to each combinator button.
154
+ */
155
+ combinatorButton: PropTypes.string,
156
+
157
+ /**
158
+ * Styles applied to the remove button.
159
+ */
160
+ removeButton: PropTypes.string,
161
+
162
+ /**
163
+ * Styles applied to the remove button on the top group.
164
+ */
165
+ topRemoveButton: PropTypes.string,
166
+
167
+ /**
168
+ * Styles applied to the rules container.
169
+ */
170
+ rulesContainer: PropTypes.string,
171
+
172
+ /**
173
+ * Styles applied to the sub rules container.
174
+ */
175
+ subRulesContainer: PropTypes.string,
176
+
177
+ /**
178
+ * Styles applied to the action button container.
179
+ */
180
+ actionButtonContainer: PropTypes.string,
181
+
182
+ /**
183
+ * Styles applied to the top action button container.
184
+ */
185
+ topActionButtonContainer: PropTypes.string
186
+ }),
123
187
  attributes: PropTypes.shape({
124
188
  key: PropTypes.shape({
125
189
  id: PropTypes.number,
@@ -1 +1 @@
1
- {"version":3,"file":"QueryBuilder.js","names":["React","useEffect","useMemo","useReducer","useRef","useState","useContext","PropTypes","isEqual","cloneDeep","withStyles","Context","RuleGroup","ConfirmationDialog","emptyGroup","clearNodeIds","reducer","styles","HvQueryBuilder","attributes","query","onChange","operators","combinators","maxDepth","labels","pendingAction","askAction","currentAttributes","initialState","state","dispatchAction","prevState","setPrevState","defaultcontext","context","initialTouched","current","type","onConfirmHandler","undefined","actions","forEach","action","onCancelHandler","id","combinator","rules","dialog","dialogTitle","dialogMessage","dialogConfirm","dialogCancel","dialogCloseTooltip","propTypes","shape","key","number","label","string","isRequired","value","any","order","arrayOf","operator","operand","attribute","func","instanceOf","Object","name"],"sources":["../../../src/QueryBuilder/QueryBuilder.js"],"sourcesContent":["import React, { useEffect, useMemo, useReducer, useRef, useState, useContext } from \"react\";\nimport PropTypes from \"prop-types\";\nimport isEqual from \"lodash/isEqual\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { withStyles } from \"@material-ui/core\";\n\nimport Context from \"./Context\";\nimport RuleGroup from \"./RuleGroup\";\nimport ConfirmationDialog from \"./ConfirmationDialog\";\nimport { emptyGroup, clearNodeIds } from \"./utils\";\nimport reducer from \"./utils/reducer\";\nimport styles from \"./styles\";\n\n/**\n * **HvQueryBuilder** component allows you to create conditions and group them using logical operators.\n * It outputs a structured set of rules which can be easily parsed to create SQL/NoSQL/whatever queries.\n *\n * **PLEASE NOTE**: This component implementation is still a WIP. There might be breaking changes.\n */\nconst HvQueryBuilder = ({\n attributes = [],\n query,\n onChange,\n operators,\n combinators,\n maxDepth = 1,\n labels,\n}) => {\n const [pendingAction, askAction] = useState();\n const currentAttributes = useRef();\n const [state, dispatchAction] = useReducer(\n reducer,\n query,\n (initialState) => initialState || emptyGroup()\n );\n\n const initialState = query === state;\n const [prevState, setPrevState] = useState();\n\n const defaultcontext = useContext(Context);\n\n const context = useMemo(\n () => ({\n dispatchAction,\n askAction,\n attributes,\n operators: operators ?? defaultcontext.operators,\n combinators: combinators ?? defaultcontext.combinators,\n maxDepth: maxDepth ?? defaultcontext.maxDepth,\n labels: labels ?? defaultcontext.labels,\n initialTouched: initialState,\n }),\n [\n attributes,\n operators,\n defaultcontext.operators,\n defaultcontext.combinators,\n defaultcontext.maxDepth,\n defaultcontext.labels,\n combinators,\n maxDepth,\n labels,\n initialState,\n ]\n );\n\n useEffect(() => {\n if (currentAttributes.current == null) {\n // first run, nothing to do\n currentAttributes.current = attributes;\n } else if (currentAttributes.current !== attributes) {\n // attributes changed, the existing query is almost certain invalid, so reset it\n currentAttributes.current = attributes;\n dispatchAction({ type: \"reset-query\" });\n }\n }, [attributes]);\n\n // Propagate the change if the query is modified.\n useEffect(() => {\n if (!initialState && !isEqual(state, prevState)) {\n onChange?.(clearNodeIds(state));\n setPrevState(cloneDeep(state));\n }\n }, [state, prevState, initialState, onChange]);\n\n const onConfirmHandler = () => {\n if (pendingAction) {\n askAction(undefined);\n pendingAction.actions.forEach((action) => dispatchAction(action));\n }\n };\n\n const onCancelHandler = () => {\n askAction(undefined);\n };\n\n return (\n <Context.Provider value={context}>\n <RuleGroup level={0} id={state.id} combinator={state.combinator} rules={state.rules} />\n <ConfirmationDialog\n isOpen={pendingAction != null}\n onConfirm={onConfirmHandler}\n onCancel={onCancelHandler}\n title={pendingAction?.dialog.dialogTitle || \"\"}\n message={pendingAction?.dialog.dialogMessage || \"\"}\n confirmButtonLabel={pendingAction?.dialog.dialogConfirm || \"\"}\n cancelButtonLabel={pendingAction?.dialog.dialogCancel || \"\"}\n closeButtonTooltip={pendingAction?.dialog.dialogCloseTooltip || \"\"}\n />\n </Context.Provider>\n );\n};\n\nHvQueryBuilder.propTypes = {\n /**\n * The query rules attributes.\n */\n attributes: PropTypes.shape({\n key: PropTypes.shape({\n id: PropTypes.number,\n label: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n value: PropTypes.any,\n order: PropTypes.number,\n }),\n }).isRequired,\n /**\n * The query rules operators by attribute type and combinator.\n */\n operators: PropTypes.shape({\n type: PropTypes.arrayOf(\n PropTypes.shape({\n operator: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n combinators: PropTypes.arrayOf(PropTypes.string).isRequired,\n })\n ),\n }),\n /**\n * The query combinators operands.\n */\n combinators: PropTypes.arrayOf(\n PropTypes.shape({\n operand: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n })\n ),\n /**\n * The initial query representation.\n */\n query: PropTypes.shape({\n id: PropTypes.number,\n combinator: PropTypes.string.isRequired,\n rules: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number,\n attribute: PropTypes.string,\n operator: PropTypes.string,\n value: PropTypes.any,\n })\n ).isRequired,\n }),\n /**\n * Callback fired when query changes.\n */\n onChange: PropTypes.func,\n /**\n * Max depth of nested query groups.\n */\n maxDepth: PropTypes.number,\n /**\n * An object containing all the labels.\n */\n labels: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvQueryBuilder\" })(HvQueryBuilder);\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,OAA3B,EAAoCC,UAApC,E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5BY;;EAkCzB;AACF;AACA;EACExC,KAAK,EAAEb,SAAS,CAACgD,KAAV,CAAgB;IACrBV,EAAE,EAAEtC,SAAS,CAACkD,MADO;IAErBX,UAAU,EAAEvC,SAAS,CAACoD,MAAV,CAAiBC,UAFR;IAGrBb,KAAK,EAAExC,SAAS,CAACyD,OAAV,CACLzD,SAAS,CAACgD,KAAV,CAAgB;MACdV,EAAE,EAAEtC,SAAS,CAACkD,MADA;MAEdU,SAAS,EAAE5D,SAAS,CAACoD,MAFP;MAGdM,QAAQ,EAAE1D,SAAS,CAACoD,MAHN;MAIdE,KAAK,EAAEtD,SAAS,CAACuD;IAJH,CAAhB,CADK,EAOLF;EAVmB,CAAhB,CArCkB;;EAiDzB;AACF;AACA;EACEvC,QAAQ,EAAEd,SAAS,CAAC6D,IApDK;;EAqDzB;AACF;AACA;EACE5C,QAAQ,EAAEjB,SAAS,CAACkD,MAxDK;;EAyDzB;AACF;AACA;EACEhC,MAAM,EAAElB,SAAS,CAAC8D,UAAV,CAAqBC,MAArB;AA5DiB,CAA3B;AA+DA,eAAe5D,UAAU,CAACO,MAAD,EAAS;EAAEsD,IAAI,EAAE;AAAR,CAAT,CAAV,CAA+CrD,cAA/C,CAAf"}
1
+ {"version":3,"file":"QueryBuilder.js","names":["React","useEffect","useMemo","useReducer","useRef","useState","useContext","PropTypes","isEqual","cloneDeep","withStyles","Context","RuleGroup","ConfirmationDialog","emptyGroup","clearNodeIds","reducer","styles","HvQueryBuilder","attributes","query","onChange","operators","combinators","maxDepth","labels","classes","pendingAction","askAction","currentAttributes","initialState","state","dispatchAction","prevState","setPrevState","defaultcontext","context","initialTouched","current","type","onConfirmHandler","undefined","actions","forEach","action","onCancelHandler","id","combinator","rules","dialog","dialogTitle","dialogMessage","dialogConfirm","dialogCancel","dialogCloseTooltip","propTypes","shape","root","string","topGroup","subGroup","topCombinator","combinatorButton","removeButton","topRemoveButton","rulesContainer","subRulesContainer","actionButtonContainer","topActionButtonContainer","key","number","label","isRequired","value","any","order","arrayOf","operator","operand","attribute","func","instanceOf","Object","name"],"sources":["../../../src/QueryBuilder/QueryBuilder.js"],"sourcesContent":["import React, { useEffect, useMemo, useReducer, useRef, useState, useContext } from \"react\";\nimport PropTypes from \"prop-types\";\nimport isEqual from \"lodash/isEqual\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { withStyles } from \"@material-ui/core\";\n\nimport Context from \"./Context\";\nimport RuleGroup from \"./RuleGroup\";\nimport ConfirmationDialog from \"./ConfirmationDialog\";\nimport { emptyGroup, clearNodeIds } from \"./utils\";\nimport reducer from \"./utils/reducer\";\nimport styles from \"./styles\";\n\n/**\n * **HvQueryBuilder** component allows you to create conditions and group them using logical operators.\n * It outputs a structured set of rules which can be easily parsed to create SQL/NoSQL/whatever queries.\n *\n * **PLEASE NOTE**: This component implementation is still a WIP. There might be breaking changes.\n */\nconst HvQueryBuilder = ({\n attributes = [],\n query,\n onChange,\n operators,\n combinators,\n maxDepth = 1,\n labels,\n classes,\n}) => {\n const [pendingAction, askAction] = useState();\n const currentAttributes = useRef();\n const [state, dispatchAction] = useReducer(\n reducer,\n query,\n (initialState) => initialState || emptyGroup()\n );\n\n const initialState = query === state;\n const [prevState, setPrevState] = useState();\n\n const defaultcontext = useContext(Context);\n\n const context = useMemo(\n () => ({\n dispatchAction,\n askAction,\n attributes,\n operators: operators ?? defaultcontext.operators,\n combinators: combinators ?? defaultcontext.combinators,\n maxDepth: maxDepth ?? defaultcontext.maxDepth,\n labels: labels ?? defaultcontext.labels,\n initialTouched: initialState,\n }),\n [\n attributes,\n operators,\n defaultcontext.operators,\n defaultcontext.combinators,\n defaultcontext.maxDepth,\n defaultcontext.labels,\n combinators,\n maxDepth,\n labels,\n initialState,\n ]\n );\n\n useEffect(() => {\n if (currentAttributes.current == null) {\n // first run, nothing to do\n currentAttributes.current = attributes;\n } else if (currentAttributes.current !== attributes) {\n // attributes changed, the existing query is almost certain invalid, so reset it\n currentAttributes.current = attributes;\n dispatchAction({ type: \"reset-query\" });\n }\n }, [attributes]);\n\n // Propagate the change if the query is modified.\n useEffect(() => {\n if (!initialState && !isEqual(state, prevState)) {\n onChange?.(clearNodeIds(state));\n setPrevState(cloneDeep(state));\n }\n }, [state, prevState, initialState, onChange]);\n\n const onConfirmHandler = () => {\n if (pendingAction) {\n askAction(undefined);\n pendingAction.actions.forEach((action) => dispatchAction(action));\n }\n };\n\n const onCancelHandler = () => {\n askAction(undefined);\n };\n\n return (\n <Context.Provider value={context}>\n <RuleGroup\n level={0}\n id={state.id}\n combinator={state.combinator}\n rules={state.rules}\n classes={classes}\n />\n <ConfirmationDialog\n isOpen={pendingAction != null}\n onConfirm={onConfirmHandler}\n onCancel={onCancelHandler}\n title={pendingAction?.dialog.dialogTitle || \"\"}\n message={pendingAction?.dialog.dialogMessage || \"\"}\n confirmButtonLabel={pendingAction?.dialog.dialogConfirm || \"\"}\n cancelButtonLabel={pendingAction?.dialog.dialogCancel || \"\"}\n closeButtonTooltip={pendingAction?.dialog.dialogCloseTooltip || \"\"}\n />\n </Context.Provider>\n );\n};\n\nHvQueryBuilder.propTypes = {\n /**\n * Override or extend the styles applied to the component.\n * See CSS API tab for more details.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the top group container.\n */\n topGroup: PropTypes.string,\n /**\n * Styles applied to the sub group containers.\n */\n subGroup: PropTypes.string,\n /**\n * Styles applied to the multi-button combinator container.\n */\n combinator: PropTypes.string,\n /**\n * Styles applied to the multi-button combinator container on the top group.\n */\n topCombinator: PropTypes.string,\n /**\n * Styles applied to each combinator button.\n */\n combinatorButton: PropTypes.string,\n /**\n * Styles applied to the remove button.\n */\n removeButton: PropTypes.string,\n /**\n * Styles applied to the remove button on the top group.\n */\n topRemoveButton: PropTypes.string,\n /**\n * Styles applied to the rules container.\n */\n rulesContainer: PropTypes.string,\n /**\n * Styles applied to the sub rules container.\n */\n subRulesContainer: PropTypes.string,\n /**\n * Styles applied to the action button container.\n */\n actionButtonContainer: PropTypes.string,\n /**\n * Styles applied to the top action button container.\n */\n topActionButtonContainer: PropTypes.string,\n }),\n attributes: PropTypes.shape({\n key: PropTypes.shape({\n id: PropTypes.number,\n label: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n value: PropTypes.any,\n order: PropTypes.number,\n }),\n }).isRequired,\n /**\n * The query rules operators by attribute type and combinator.\n */\n operators: PropTypes.shape({\n type: PropTypes.arrayOf(\n PropTypes.shape({\n operator: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n combinators: PropTypes.arrayOf(PropTypes.string).isRequired,\n })\n ),\n }),\n /**\n * The query combinators operands.\n */\n combinators: PropTypes.arrayOf(\n PropTypes.shape({\n operand: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n })\n ),\n /**\n * The initial query representation.\n */\n query: PropTypes.shape({\n id: PropTypes.number,\n combinator: PropTypes.string.isRequired,\n rules: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number,\n attribute: PropTypes.string,\n operator: PropTypes.string,\n value: PropTypes.any,\n })\n ).isRequired,\n }),\n /**\n * Callback fired when query changes.\n */\n onChange: PropTypes.func,\n /**\n * Max depth of nested query groups.\n */\n maxDepth: PropTypes.number,\n /**\n * An object containing all the labels.\n */\n labels: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvQueryBuilder\" })(HvQueryBuilder);\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,OAA3B,EAAoCC,UAApC,EAAgDC,MAAhD,EAAwDC,QAAxD,EAAkEC,UAAlE,QAAoF,OAApF;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,SAAP,MAAsB,kBAAtB;AACA,SAASC,UAAT,QAA2B,mBAA3B;AAEA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,OAAOC,kBAAP,M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