@cubejs-client/react 0.34.60 → 0.35.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.
- package/dist/cubejs-client-react.esm.js +27 -40
- package/dist/cubejs-client-react.esm.js.map +1 -1
- package/dist/cubejs-client-react.js +28 -41
- package/dist/cubejs-client-react.js.map +1 -1
- package/dist/cubejs-client-react.umd.js +28 -41
- package/dist/cubejs-client-react.umd.js.map +1 -1
- package/index.d.ts +22 -33
- package/package.json +3 -3
- package/src/CubeProvider.jsx +2 -9
- package/src/QueryBuilder.jsx +11 -11
- package/src/QueryRenderer.jsx +12 -12
- package/src/hooks/cube-fetch.js +1 -1
- package/src/hooks/cube-query.js +2 -8
|
@@ -11240,7 +11240,7 @@
|
|
|
11240
11240
|
query = _this$props2.query,
|
|
11241
11241
|
queries = _this$props2.queries,
|
|
11242
11242
|
render = _this$props2.render,
|
|
11243
|
-
|
|
11243
|
+
cubeApi = _this$props2.cubeApi,
|
|
11244
11244
|
loadSql = _this$props2.loadSql,
|
|
11245
11245
|
updateOnlyOnStateChange = _this$props2.updateOnlyOnStateChange;
|
|
11246
11246
|
|
|
@@ -11248,7 +11248,7 @@
|
|
|
11248
11248
|
return true;
|
|
11249
11249
|
}
|
|
11250
11250
|
|
|
11251
|
-
return !equals(nextProps.query, query) || !equals(nextProps.queries, queries) || (nextProps.render == null || render == null) && nextProps.render !== render || nextProps.
|
|
11251
|
+
return !equals(nextProps.query, query) || !equals(nextProps.queries, queries) || (nextProps.render == null || render == null) && nextProps.render !== render || nextProps.cubeApi !== cubeApi || nextProps.loadSql !== loadSql || !equals(nextState, this.state) || nextProps.updateOnlyOnStateChange !== updateOnlyOnStateChange;
|
|
11252
11252
|
}
|
|
11253
11253
|
}, {
|
|
11254
11254
|
key: "componentDidUpdate",
|
|
@@ -11266,10 +11266,10 @@
|
|
|
11266
11266
|
}
|
|
11267
11267
|
}
|
|
11268
11268
|
}, {
|
|
11269
|
-
key: "
|
|
11270
|
-
value: function
|
|
11269
|
+
key: "cubeApi",
|
|
11270
|
+
value: function cubeApi() {
|
|
11271
11271
|
// eslint-disable-next-line react/destructuring-assignment
|
|
11272
|
-
return this.props.
|
|
11272
|
+
return this.props.cubeApi || this.context && this.context.cubeApi;
|
|
11273
11273
|
}
|
|
11274
11274
|
}, {
|
|
11275
11275
|
key: "load",
|
|
@@ -11285,11 +11285,11 @@
|
|
|
11285
11285
|
resultSet: null
|
|
11286
11286
|
} : {}));
|
|
11287
11287
|
var loadSql = this.props.loadSql;
|
|
11288
|
-
var
|
|
11288
|
+
var cubeApi = this.cubeApi();
|
|
11289
11289
|
|
|
11290
11290
|
if (query && isQueryPresent(query)) {
|
|
11291
11291
|
if (loadSql === 'only') {
|
|
11292
|
-
|
|
11292
|
+
cubeApi.sql(query, {
|
|
11293
11293
|
mutexObj: this.mutexObj,
|
|
11294
11294
|
mutexKey: 'sql'
|
|
11295
11295
|
}).then(function (sqlQuery) {
|
|
@@ -11307,10 +11307,10 @@
|
|
|
11307
11307
|
}));
|
|
11308
11308
|
});
|
|
11309
11309
|
} else if (loadSql) {
|
|
11310
|
-
Promise.all([
|
|
11310
|
+
Promise.all([cubeApi.sql(query, {
|
|
11311
11311
|
mutexObj: this.mutexObj,
|
|
11312
11312
|
mutexKey: 'sql'
|
|
11313
|
-
}),
|
|
11313
|
+
}), cubeApi.load(query, {
|
|
11314
11314
|
mutexObj: this.mutexObj,
|
|
11315
11315
|
mutexKey: 'query'
|
|
11316
11316
|
})]).then(function (_ref) {
|
|
@@ -11333,7 +11333,7 @@
|
|
|
11333
11333
|
}));
|
|
11334
11334
|
});
|
|
11335
11335
|
} else {
|
|
11336
|
-
|
|
11336
|
+
cubeApi.load(query, {
|
|
11337
11337
|
mutexObj: this.mutexObj,
|
|
11338
11338
|
mutexKey: 'query'
|
|
11339
11339
|
}).then(function (resultSet) {
|
|
@@ -11358,7 +11358,7 @@
|
|
|
11358
11358
|
value: function loadQueries(queries) {
|
|
11359
11359
|
var _this3 = this;
|
|
11360
11360
|
|
|
11361
|
-
var
|
|
11361
|
+
var cubeApi = this.cubeApi();
|
|
11362
11362
|
var resetResultSetOnChange = this.props.resetResultSetOnChange;
|
|
11363
11363
|
this.setState(_objectSpread$6(_objectSpread$6({
|
|
11364
11364
|
isLoading: true
|
|
@@ -11372,7 +11372,7 @@
|
|
|
11372
11372
|
name = _ref4[0],
|
|
11373
11373
|
query = _ref4[1];
|
|
11374
11374
|
|
|
11375
|
-
return
|
|
11375
|
+
return cubeApi.load(query, {
|
|
11376
11376
|
mutexObj: _this3.mutexObj,
|
|
11377
11377
|
mutexKey: name
|
|
11378
11378
|
}).then(function (r) {
|
|
@@ -11435,7 +11435,7 @@
|
|
|
11435
11435
|
_defineProperty(QueryRenderer, "contextType", CubeContext);
|
|
11436
11436
|
|
|
11437
11437
|
_defineProperty(QueryRenderer, "defaultProps", {
|
|
11438
|
-
|
|
11438
|
+
cubeApi: null,
|
|
11439
11439
|
query: null,
|
|
11440
11440
|
render: null,
|
|
11441
11441
|
queries: null,
|
|
@@ -11744,7 +11744,7 @@
|
|
|
11744
11744
|
while (1) {
|
|
11745
11745
|
switch (_context.prev = _context.next) {
|
|
11746
11746
|
case 0:
|
|
11747
|
-
if (_this.
|
|
11747
|
+
if (_this.cubeApi()) {
|
|
11748
11748
|
_context.next = 2;
|
|
11749
11749
|
break;
|
|
11750
11750
|
}
|
|
@@ -11762,7 +11762,7 @@
|
|
|
11762
11762
|
});
|
|
11763
11763
|
|
|
11764
11764
|
_context.next = 9;
|
|
11765
|
-
return _this.
|
|
11765
|
+
return _this.cubeApi().meta();
|
|
11766
11766
|
|
|
11767
11767
|
case 9:
|
|
11768
11768
|
meta = _context.sent;
|
|
@@ -11855,7 +11855,7 @@
|
|
|
11855
11855
|
_this$props = this.props, schemaVersion = _this$props.schemaVersion, onSchemaChange = _this$props.onSchemaChange;
|
|
11856
11856
|
meta = this.state.meta;
|
|
11857
11857
|
|
|
11858
|
-
if (!(((_this$prevContext = this.prevContext) === null || _this$prevContext === void 0 ? void 0 : _this$prevContext.
|
|
11858
|
+
if (!(((_this$prevContext = this.prevContext) === null || _this$prevContext === void 0 ? void 0 : _this$prevContext.cubeApi) !== ((_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.cubeApi))) {
|
|
11859
11859
|
_context4.next = 6;
|
|
11860
11860
|
break;
|
|
11861
11861
|
}
|
|
@@ -11872,7 +11872,7 @@
|
|
|
11872
11872
|
|
|
11873
11873
|
_context4.prev = 7;
|
|
11874
11874
|
_context4.next = 10;
|
|
11875
|
-
return this.
|
|
11875
|
+
return this.cubeApi().meta();
|
|
11876
11876
|
|
|
11877
11877
|
case 10:
|
|
11878
11878
|
newMeta = _context4.sent;
|
|
@@ -11932,11 +11932,11 @@
|
|
|
11932
11932
|
return componentDidUpdate;
|
|
11933
11933
|
}()
|
|
11934
11934
|
}, {
|
|
11935
|
-
key: "
|
|
11936
|
-
value: function
|
|
11937
|
-
var
|
|
11935
|
+
key: "cubeApi",
|
|
11936
|
+
value: function cubeApi() {
|
|
11937
|
+
var cubeApi = this.props.cubeApi; // eslint-disable-next-line react/destructuring-assignment
|
|
11938
11938
|
|
|
11939
|
-
return
|
|
11939
|
+
return cubeApi || this.context && this.context.cubeApi;
|
|
11940
11940
|
}
|
|
11941
11941
|
}, {
|
|
11942
11942
|
key: "getMissingMembers",
|
|
@@ -12302,7 +12302,7 @@
|
|
|
12302
12302
|
|
|
12303
12303
|
_context5.prev = 16;
|
|
12304
12304
|
_context5.next = 19;
|
|
12305
|
-
return this.
|
|
12305
|
+
return this.cubeApi().dryRun(finalState.query, {
|
|
12306
12306
|
mutexObj: this.mutexObj
|
|
12307
12307
|
});
|
|
12308
12308
|
|
|
@@ -12393,14 +12393,14 @@
|
|
|
12393
12393
|
|
|
12394
12394
|
var query = this.state.query;
|
|
12395
12395
|
var _this$props4 = this.props,
|
|
12396
|
-
|
|
12396
|
+
cubeApi = _this$props4.cubeApi,
|
|
12397
12397
|
_render = _this$props4.render,
|
|
12398
12398
|
wrapWithQueryRenderer = _this$props4.wrapWithQueryRenderer;
|
|
12399
12399
|
|
|
12400
12400
|
if (wrapWithQueryRenderer) {
|
|
12401
12401
|
return /*#__PURE__*/React__default['default'].createElement(QueryRenderer, {
|
|
12402
12402
|
query: query,
|
|
12403
|
-
|
|
12403
|
+
cubeApi: cubeApi,
|
|
12404
12404
|
resetResultSetOnChange: false,
|
|
12405
12405
|
render: function render(queryRendererProps) {
|
|
12406
12406
|
if (_render) {
|
|
@@ -12481,7 +12481,7 @@
|
|
|
12481
12481
|
_defineProperty(QueryBuilder, "contextType", CubeContext);
|
|
12482
12482
|
|
|
12483
12483
|
_defineProperty(QueryBuilder, "defaultProps", {
|
|
12484
|
-
|
|
12484
|
+
cubeApi: null,
|
|
12485
12485
|
stateChangeHeuristics: null,
|
|
12486
12486
|
disableHeuristics: false,
|
|
12487
12487
|
render: null,
|
|
@@ -12499,18 +12499,11 @@
|
|
|
12499
12499
|
|
|
12500
12500
|
function CubeProvider(_ref) {
|
|
12501
12501
|
var cubeApi = _ref.cubeApi,
|
|
12502
|
-
cubejsApi = _ref.cubejsApi,
|
|
12503
12502
|
children = _ref.children,
|
|
12504
12503
|
_ref$options = _ref.options,
|
|
12505
12504
|
options = _ref$options === void 0 ? {} : _ref$options;
|
|
12506
|
-
React.useEffect(function () {
|
|
12507
|
-
if (cubejsApi && !cubeApi) {
|
|
12508
|
-
console.warn('"cubejsApi" is deprecated and will be removed in the following version. Use "cubeApi" instead.');
|
|
12509
|
-
}
|
|
12510
|
-
}, [cubeApi, cubejsApi]);
|
|
12511
12505
|
return /*#__PURE__*/React__default['default'].createElement(CubeContext.Provider, {
|
|
12512
12506
|
value: {
|
|
12513
|
-
cubejsApi: cubejsApi,
|
|
12514
12507
|
cubeApi: cubeApi,
|
|
12515
12508
|
options: options
|
|
12516
12509
|
}
|
|
@@ -12589,7 +12582,7 @@
|
|
|
12589
12582
|
case 0:
|
|
12590
12583
|
loadOptions = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
12591
12584
|
ignoreSkip = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
12592
|
-
cubeApi = options.cubeApi ||
|
|
12585
|
+
cubeApi = options.cubeApi || (context === null || context === void 0 ? void 0 : context.cubeApi);
|
|
12593
12586
|
query = loadOptions.query || options.query;
|
|
12594
12587
|
queryCondition = method === 'meta' ? true : query && isQueryPresent(query);
|
|
12595
12588
|
|
|
@@ -12734,12 +12727,6 @@
|
|
|
12734
12727
|
return setProgress(progressResponse);
|
|
12735
12728
|
};
|
|
12736
12729
|
|
|
12737
|
-
React.useEffect(function () {
|
|
12738
|
-
if (options.cubejsApi && !options.cubeApi) {
|
|
12739
|
-
console.warn('"cubejsApi" is deprecated and will be removed in the following version. Use "cubeApi" instead.');
|
|
12740
|
-
}
|
|
12741
|
-
}, [options.cubeApi, options.cubejsApi]);
|
|
12742
|
-
|
|
12743
12730
|
function fetch() {
|
|
12744
12731
|
return _fetch.apply(this, arguments);
|
|
12745
12732
|
}
|
|
@@ -12753,7 +12740,7 @@
|
|
|
12753
12740
|
switch (_context2.prev = _context2.next) {
|
|
12754
12741
|
case 0:
|
|
12755
12742
|
resetResultSetOnChange = options.resetResultSetOnChange;
|
|
12756
|
-
cubeApi = options.cubeApi ||
|
|
12743
|
+
cubeApi = options.cubeApi || (context === null || context === void 0 ? void 0 : context.cubeApi);
|
|
12757
12744
|
|
|
12758
12745
|
if (cubeApi) {
|
|
12759
12746
|
_context2.next = 4;
|
|
@@ -12818,7 +12805,7 @@
|
|
|
12818
12805
|
var _options$skip = options.skip,
|
|
12819
12806
|
skip = _options$skip === void 0 ? false : _options$skip,
|
|
12820
12807
|
resetResultSetOnChange = options.resetResultSetOnChange;
|
|
12821
|
-
var cubeApi = options.cubeApi ||
|
|
12808
|
+
var cubeApi = options.cubeApi || (context === null || context === void 0 ? void 0 : context.cubeApi);
|
|
12822
12809
|
|
|
12823
12810
|
if (!cubeApi) {
|
|
12824
12811
|
throw new Error('Cube API client is not provided');
|