@elliemae/ds-query-builder 2.0.0-rc.6 → 2.0.0

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,5 +1,4 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
3
2
  import { Component } from 'react';
4
3
  import { Grid } from '@elliemae/ds-grid';
5
4
  import { convertPropToCssClassName } from '@elliemae/ds-classnames';
@@ -15,7 +14,7 @@ class DisplayOutput extends Component {
15
14
  constructor(props) {
16
15
  super(props);
17
16
 
18
- _defineProperty(this, "handleChange", () => {
17
+ this.handleChange = () => {
19
18
  this.setState(_ref => {
20
19
  let {
21
20
  show
@@ -24,7 +23,7 @@ class DisplayOutput extends Component {
24
23
  show: !show
25
24
  };
26
25
  });
27
- });
26
+ };
28
27
 
29
28
  this.state = {
30
29
  show: props.show
@@ -31,43 +31,43 @@ class Nestable extends Component {
31
31
  constructor(props) {
32
32
  super(props);
33
33
 
34
- _defineProperty(this, "onDragStart", (e, item) => {
34
+ this.onDragStart = (e, item) => {
35
35
  onDragStart.call(this, e, item);
36
- });
36
+ };
37
37
 
38
- _defineProperty(this, "onDragEnd", (e, isCancel) => onDragEnd.call(this, e, isCancel));
38
+ this.onDragEnd = (e, isCancel) => onDragEnd.call(this, e, isCancel);
39
39
 
40
- _defineProperty(this, "onMouseMove", e => onMouseMove.call(this, e));
40
+ this.onMouseMove = e => onMouseMove.call(this, e);
41
41
 
42
- _defineProperty(this, "onMouseEnter", (e, item) => onMouseEnter.call(this, e, item));
42
+ this.onMouseEnter = (e, item) => onMouseEnter.call(this, e, item);
43
43
 
44
- _defineProperty(this, "onToggleCollapse", (item, isGetter) => onToggleCollapse.call(this, item, isGetter));
44
+ this.onToggleCollapse = (item, isGetter) => onToggleCollapse.call(this, item, isGetter);
45
45
 
46
- _defineProperty(this, "onKeyDown", e => onKeyDown.call(this, e));
46
+ this.onKeyDown = e => onKeyDown.call(this, e);
47
47
 
48
- _defineProperty(this, "getDefaultItems", () => {
48
+ this.getDefaultItems = () => {
49
49
  const {
50
50
  items
51
51
  } = this.state;
52
52
  return items;
53
- });
53
+ };
54
54
 
55
- _defineProperty(this, "getItemDepth", item => getItemDepth.call(this, item));
55
+ this.getItemDepth = item => getItemDepth.call(this, item);
56
56
 
57
- _defineProperty(this, "startTrackMouse", () => {
57
+ this.startTrackMouse = () => {
58
58
  document.addEventListener('mousemove', this.onMouseMove);
59
59
  document.addEventListener('mouseup', this.onDragEnd);
60
60
  document.addEventListener('keydown', this.onKeyDown);
61
- });
61
+ };
62
62
 
63
- _defineProperty(this, "stopTrackMouse", () => {
63
+ this.stopTrackMouse = () => {
64
64
  document.removeEventListener('mousemove', this.onMouseMove);
65
65
  document.removeEventListener('mouseup', this.onDragEnd);
66
66
  document.removeEventListener('keydown', this.onKeyDown);
67
67
  this.elCopyStyles = null;
68
- });
68
+ };
69
69
 
70
- _defineProperty(this, "isCollapsed", item => {
70
+ this.isCollapsed = item => {
71
71
  const {
72
72
  collapsed
73
73
  } = this.props;
@@ -75,9 +75,9 @@ class Nestable extends Component {
75
75
  collapsedGroups
76
76
  } = this.state;
77
77
  return !!(collapsedGroups.indexOf(item.id) > -1 ^ collapsed);
78
- });
78
+ };
79
79
 
80
- _defineProperty(this, "checkFilterChildren", items => items.find(current => {
80
+ this.checkFilterChildren = items => items.find(current => {
81
81
  const {
82
82
  element: {
83
83
  type
@@ -86,9 +86,9 @@ class Nestable extends Component {
86
86
  } = current;
87
87
  if (type === 'filter' && children.length > 0) return true;
88
88
  return this.checkFilterChildren(children);
89
- }));
89
+ });
90
90
 
91
- _defineProperty(this, "dragRevert", () => {
91
+ this.dragRevert = () => {
92
92
  const {
93
93
  itemsOld
94
94
  } = this.state;
@@ -98,7 +98,7 @@ class Nestable extends Component {
98
98
  dragItem: null,
99
99
  isDirty: false
100
100
  });
101
- });
101
+ };
102
102
 
103
103
  this.state = {
104
104
  items: [],
@@ -25,26 +25,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
25
25
  class QueryBuilderImpl extends Component {
26
26
  constructor(props) {
27
27
  super(props);
28
+ this.isDraggableItem = true;
28
29
 
29
- _defineProperty(this, "isDraggableItem", true);
30
-
31
- _defineProperty(this, "onOrderDragAndDrop", (items, item) => {
30
+ this.onOrderDragAndDrop = (items, item) => {
32
31
  const newFilters = this.store.onOrderDragAndDrop(items, item);
33
32
  this.sendCall('reOrderOnDragAndDrop', {
34
33
  items
35
34
  });
36
35
  this.sendChange(newFilters);
37
- });
36
+ };
38
37
 
39
- _defineProperty(this, "onAddFilterToGroup", idGroup => {
38
+ this.onAddFilterToGroup = idGroup => {
40
39
  const newFilters = this.store.addFilter(idGroup);
41
40
  this.sendCall('onAddFilterToGroup', {
42
41
  idGroup
43
42
  });
44
43
  this.sendChange(newFilters);
45
- });
44
+ };
46
45
 
47
- _defineProperty(this, "onAddFilter", (idGroup, idFilter) => {
46
+ this.onAddFilter = (idGroup, idFilter) => {
48
47
  const {
49
48
  addFilterMethod
50
49
  } = this.props;
@@ -54,9 +53,9 @@ class QueryBuilderImpl extends Component {
54
53
  idFilter
55
54
  });
56
55
  this.sendChange(newFilters);
57
- });
56
+ };
58
57
 
59
- _defineProperty(this, "onAddRuleContainer", (idGroup, idFilter) => {
58
+ this.onAddRuleContainer = (idGroup, idFilter) => {
60
59
  const {
61
60
  groupFilterMethod
62
61
  } = this.props;
@@ -66,17 +65,17 @@ class QueryBuilderImpl extends Component {
66
65
  idFilter
67
66
  });
68
67
  this.sendChange(newFilters);
69
- });
68
+ };
70
69
 
71
- _defineProperty(this, "onRemoveFilter", idFilter => {
70
+ this.onRemoveFilter = idFilter => {
72
71
  const newFilters = this.store.onRemoveFilter(idFilter);
73
72
  this.sendCall('onRemoveFilter', {
74
73
  idFilter
75
74
  });
76
75
  this.sendChange(newFilters);
77
- });
76
+ };
78
77
 
79
- _defineProperty(this, "handleFieldChange", data => {
78
+ this.handleFieldChange = data => {
80
79
  const {
81
80
  fieldsSharedActions
82
81
  } = this.props;
@@ -87,26 +86,26 @@ class QueryBuilderImpl extends Component {
87
86
  data
88
87
  });
89
88
  this.sendChange(newFilters);
90
- });
89
+ };
91
90
 
92
- _defineProperty(this, "handleRuleContainerOperator", (idGroup, value) => {
91
+ this.handleRuleContainerOperator = (idGroup, value) => {
93
92
  const newFilters = this.store.changeGroupOperator(idGroup, value);
94
93
  this.sendCall('handleRuleContainerOperator', {
95
94
  idGroup,
96
95
  value
97
96
  });
98
97
  this.sendChange(newFilters);
99
- });
98
+ };
100
99
 
101
- _defineProperty(this, "handleRuleContainerUnGroup", idGroup => {
100
+ this.handleRuleContainerUnGroup = idGroup => {
102
101
  const newFilters = this.store.unGroup(idGroup);
103
102
  this.sendCall('handleRuleContainerUnGroup', {
104
103
  idGroup
105
104
  });
106
105
  this.sendChange(newFilters);
107
- });
106
+ };
108
107
 
109
- _defineProperty(this, "handleDropFilter", (filter, dragTo) => {
108
+ this.handleDropFilter = (filter, dragTo) => {
110
109
  const {
111
110
  position: oldPosition,
112
111
  idGroup,
@@ -122,9 +121,9 @@ class QueryBuilderImpl extends Component {
122
121
  dragTo
123
122
  });
124
123
  this.sendChange(newFilters);
125
- });
124
+ };
126
125
 
127
- _defineProperty(this, "handleDropGroup", (group, dragTo) => {
126
+ this.handleDropGroup = (group, dragTo) => {
128
127
  const {
129
128
  position: oldPosition,
130
129
  idFilter,
@@ -140,17 +139,17 @@ class QueryBuilderImpl extends Component {
140
139
  dragTo
141
140
  });
142
141
  this.sendChange(newFilters);
143
- });
142
+ };
144
143
 
145
- _defineProperty(this, "handleDrop", (dragElement, dragTo) => {
144
+ this.handleDrop = (dragElement, dragTo) => {
146
145
  const {
147
146
  type
148
147
  } = dragElement;
149
148
  if (type === QB_DRAG_TYPES.FILTER) return this.handleDropFilter(dragElement, dragTo);
150
149
  return this.handleDropGroup(dragElement, dragTo);
151
- });
150
+ };
152
151
 
153
- _defineProperty(this, "sendChange", _ref => {
152
+ this.sendChange = _ref => {
154
153
  let {
155
154
  format
156
155
  } = _ref,
@@ -163,16 +162,16 @@ class QueryBuilderImpl extends Component {
163
162
  onChange
164
163
  } = this.props;
165
164
  onChange(format, newFilters);
166
- });
165
+ };
167
166
 
168
- _defineProperty(this, "sendCall", (action, data) => {
167
+ this.sendCall = (action, data) => {
169
168
  const {
170
169
  [action]: callback
171
170
  } = this.props;
172
171
  if (callback) callback(data);
173
- });
172
+ };
174
173
 
175
- _defineProperty(this, "setDraggableItems", drag => {
174
+ this.setDraggableItems = drag => {
176
175
  this.isDraggableItem = true;
177
176
 
178
177
  try {
@@ -195,7 +194,7 @@ class QueryBuilderImpl extends Component {
195
194
  } catch (error) {
196
195
  this.isDraggableItem = true;
197
196
  }
198
- });
197
+ };
199
198
 
200
199
  this.store = new QueryBuilderStore(props.init, props.format);
201
200
  this.state = this.store.getInitialState();
@@ -106,31 +106,31 @@ class QueryBuilderRow extends Component {
106
106
  constructor(props) {
107
107
  super(props);
108
108
 
109
- _defineProperty(this, "handleMouseEnterRow", () => {});
109
+ this.handleMouseEnterRow = () => {};
110
110
 
111
- _defineProperty(this, "handleMouseLeaveRow", () => {
111
+ this.handleMouseLeaveRow = () => {
112
112
  this.handleTooltipRow(false);
113
- });
113
+ };
114
114
 
115
- _defineProperty(this, "handleMouseEnterInput", () => {
115
+ this.handleMouseEnterInput = () => {
116
116
  const {
117
117
  setDraggableItems
118
118
  } = this.props;
119
119
  setDraggableItems(false);
120
- });
120
+ };
121
121
 
122
- _defineProperty(this, "handleMouseLeaveInput", () => {
122
+ this.handleMouseLeaveInput = () => {
123
123
  const {
124
124
  setDraggableItems
125
125
  } = this.props;
126
126
  setDraggableItems(true);
127
- });
127
+ };
128
128
 
129
- _defineProperty(this, "handleTooltipRow", isOpen => {
129
+ this.handleTooltipRow = isOpen => {
130
130
  this.setState({
131
131
  isOpen
132
132
  });
133
- });
133
+ };
134
134
 
135
135
  this.state = {
136
136
  isOpen: false
@@ -1,29 +1,27 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
1
  import { sqlFormat } from './sqlFormat.js';
3
2
  import { xmlFormat } from './xmlFormat.js';
4
3
  import { sqlSafeFormat } from './sqlSafeFormat.js';
5
4
 
6
5
  class QueryBuilderFormat {
7
6
  constructor() {
8
- _defineProperty(this, "format", {
7
+ this.format = {
9
8
  defaultFormat: query => query,
10
9
  sqlFormat,
11
10
  xmlFormat,
12
11
  sqlSafeFormat
13
- });
12
+ };
13
+ this.currentFormat = 'sqlFormat';
14
14
 
15
- _defineProperty(this, "currentFormat", 'sqlFormat');
16
-
17
- _defineProperty(this, "setDefaultFormat", formatName => {
15
+ this.setDefaultFormat = formatName => {
18
16
  if (this.format[formatName]) this.currentFormat = formatName;
19
- });
17
+ };
20
18
 
21
- _defineProperty(this, "addFormat", (formatName, format) => this.format[formatName] = format);
19
+ this.addFormat = (formatName, format) => this.format[formatName] = format;
22
20
 
23
- _defineProperty(this, "run", (query, formatName) => {
21
+ this.run = (query, formatName) => {
24
22
  if (this.format[formatName]) return this.format[formatName](query);
25
23
  return this.format[this.currentFormat](query);
26
- });
24
+ };
27
25
  }
28
26
 
29
27
  }
@@ -24,36 +24,30 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
24
24
 
25
25
  class QueryBuilderStore {
26
26
  constructor(init, _format) {
27
- _defineProperty(this, "items", []);
27
+ this.items = [];
28
+ this.step = 0;
29
+ this.steps = {};
30
+ this.mapFilters = {};
31
+ this.mapGroups = {};
32
+ this.main = null;
33
+ this.format = null;
28
34
 
29
- _defineProperty(this, "step", 0);
35
+ this.createNewFilter = idGroup => createNewFilter.call(this, idGroup);
30
36
 
31
- _defineProperty(this, "steps", {});
37
+ this.createNewGroup = parentIdGroup => createNewGroup.call(this, parentIdGroup);
32
38
 
33
- _defineProperty(this, "mapFilters", {});
34
-
35
- _defineProperty(this, "mapGroups", {});
36
-
37
- _defineProperty(this, "main", null);
38
-
39
- _defineProperty(this, "format", null);
40
-
41
- _defineProperty(this, "createNewFilter", idGroup => createNewFilter.call(this, idGroup));
42
-
43
- _defineProperty(this, "createNewGroup", parentIdGroup => createNewGroup.call(this, parentIdGroup));
44
-
45
- _defineProperty(this, "onOrderDragAndDrop", items => {
39
+ this.onOrderDragAndDrop = items => {
46
40
  this.items = items;
47
41
  return this.getState();
48
- });
42
+ };
49
43
 
50
- _defineProperty(this, "addFilterNextToFilterId", (idGroup, idFilter) => {
44
+ this.addFilterNextToFilterId = (idGroup, idFilter) => {
51
45
  // eslint-disable-line
52
46
  this.addFilter(idGroup);
53
47
  return this.getState();
54
- });
48
+ };
55
49
 
56
- _defineProperty(this, "addFilter", idGroup => {
50
+ this.addFilter = idGroup => {
57
51
  const newFilter = this.createNewFilter(idGroup);
58
52
  addFilterToMap.call(this, newFilter); // new API
59
53
 
@@ -68,22 +62,22 @@ class QueryBuilderStore {
68
62
  }
69
63
 
70
64
  return this.getState();
71
- });
65
+ };
72
66
 
73
- _defineProperty(this, "onRemoveFilter", idFilter => {
67
+ this.onRemoveFilter = idFilter => {
74
68
  // new API
75
69
  removeFilterItem.call(this, idFilter);
76
70
  return this.getState();
77
- });
71
+ };
78
72
 
79
- _defineProperty(this, "addRuleContainerInPlace", (idGroup, idFilter) => {
73
+ this.addRuleContainerInPlace = (idGroup, idFilter) => {
80
74
  // Create a new group
81
75
  const newGroup = this.createNewGroup(idGroup);
82
76
  addGroupFilterToItem.call(this, idGroup, idFilter, newGroup);
83
77
  return this.getState();
84
- });
78
+ };
85
79
 
86
- _defineProperty(this, "addRuleContainer", (idGroup, idFilter) => {
80
+ this.addRuleContainer = (idGroup, idFilter) => {
87
81
  // eslint-disable-line
88
82
  const newGroup = this.createNewGroup(idGroup);
89
83
  addGroupToMap.call(this, newGroup);
@@ -99,33 +93,33 @@ class QueryBuilderStore {
99
93
  }
100
94
 
101
95
  return this.getState();
102
- });
96
+ };
103
97
 
104
- _defineProperty(this, "unGroup", idGroup => {
98
+ this.unGroup = idGroup => {
105
99
  unGroupFilterToItem.call(this, idGroup);
106
100
  return this.getState();
107
- });
101
+ };
108
102
 
109
- _defineProperty(this, "changeGroupOperator", (idGroup, value) => {
103
+ this.changeGroupOperator = (idGroup, value) => {
110
104
  this.getGroupById(idGroup).condition = value;
111
105
  changeGroupOperator.call(this, idGroup, value);
112
106
  return this.getState();
113
- });
107
+ };
114
108
 
115
- _defineProperty(this, "changeFilter", data => {
109
+ this.changeFilter = data => {
116
110
  const {
117
111
  idFilter
118
112
  } = data;
119
113
  this.mapFilters[idFilter] = _objectSpread(_objectSpread({}, this.mapFilters[idFilter]), data);
120
114
  changeFilterItem.call(this, data);
121
115
  return this.getState();
122
- });
116
+ };
123
117
 
124
- _defineProperty(this, "getGroupById", idGroup => this.mapGroups[idGroup] || {});
118
+ this.getGroupById = idGroup => this.mapGroups[idGroup] || {};
125
119
 
126
- _defineProperty(this, "getFilterById", idFilter => this.mapFilters[idFilter]);
120
+ this.getFilterById = idFilter => this.mapFilters[idFilter];
127
121
 
128
- _defineProperty(this, "getInitialState", () => {
122
+ this.getInitialState = () => {
129
123
  const newFilters = {
130
124
  step: this.step,
131
125
  mapFilters: _objectSpread({}, this.mapFilters),
@@ -137,9 +131,9 @@ class QueryBuilderStore {
137
131
  return _objectSpread(_objectSpread({}, newFilters), {}, {
138
132
  format
139
133
  });
140
- });
134
+ };
141
135
 
142
- _defineProperty(this, "getState", () => {
136
+ this.getState = () => {
143
137
  this.step += 1;
144
138
  const newFilters = {
145
139
  step: this.step,
@@ -152,7 +146,7 @@ class QueryBuilderStore {
152
146
  return _objectSpread(_objectSpread({}, newFilters), {}, {
153
147
  format
154
148
  });
155
- });
149
+ };
156
150
 
157
151
  this.firstLoad = true;
158
152
  this.format = _format;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-query-builder",
3
- "version": "2.0.0-rc.6",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Query Builder",
6
6
  "module": "./esm/index.js",
@@ -168,12 +168,17 @@
168
168
  "build": "node ../../scripts/build/build.js"
169
169
  },
170
170
  "dependencies": {
171
- "@elliemae/ds-basic": "2.0.0-rc.6",
172
- "@elliemae/ds-classnames": "2.0.0-rc.6",
173
- "@elliemae/ds-grid": "2.0.0-rc.6",
174
- "@elliemae/ds-icons": "2.0.0-rc.6",
175
- "@elliemae/ds-shared": "2.0.0-rc.6",
176
- "@elliemae/ds-utilities": "2.0.0-rc.6",
171
+ "@elliemae/ds-accordion": "2.0.0",
172
+ "@elliemae/ds-button": "2.0.0",
173
+ "@elliemae/ds-classnames": "2.0.0",
174
+ "@elliemae/ds-form": "2.0.0",
175
+ "@elliemae/ds-grid": "2.0.0",
176
+ "@elliemae/ds-icon": "2.0.0",
177
+ "@elliemae/ds-icons": "2.0.0",
178
+ "@elliemae/ds-popper": "2.0.0",
179
+ "@elliemae/ds-shared": "2.0.0",
180
+ "@elliemae/ds-tooltip": "2.0.0",
181
+ "@elliemae/ds-utilities": "2.0.0",
177
182
  "classnames": "~2.2.6",
178
183
  "prop-types": "~15.7.2",
179
184
  "react-addons-update": "~15.6.3",