@vizzly/dashboard 0.15.0-dev-d8c6020f516c4db05074d3f3e57c59a3eb56308b → 0.15.0-dev-7ff9d1595e60e37497596000c80eee55ff192ba9
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/dashboard/src/contexts/GlobalProvider/useGlobalProvider.d.ts +6 -0
- package/dist/dashboard/src/contexts/SessionContext/useSessionContext.d.ts +1 -0
- package/dist/dashboard/src/types.d.ts +1 -0
- package/dist/dashboard.cjs.development.js +37 -13
- package/dist/dashboard.cjs.production.min.js +1 -1
- package/dist/dashboard.esm.js +37 -13
- package/dist/services/src/index.d.ts +3 -0
- package/dist/shared-ui/src/contexts/DashboardBehaviour/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/dashboard.esm.js
CHANGED
|
@@ -12326,14 +12326,21 @@ var buildViewOnlyQuery = function buildViewOnlyQuery(dataSet) {
|
|
|
12326
12326
|
};
|
|
12327
12327
|
};
|
|
12328
12328
|
|
|
12329
|
-
// Idempotently add custom fields
|
|
12329
|
+
// Idempotently add custom fields, preferring those defined in data sets than persisted
|
|
12330
|
+
// on dashboards to allow updating.
|
|
12330
12331
|
var addCustomFields = function addCustomFields(dataSets, customFields) {
|
|
12331
12332
|
if (!customFields) return dataSets;
|
|
12332
|
-
dataSets = dataSets.map(removeCustomFields);
|
|
12333
12333
|
var newDataSets = [].concat(dataSets).map(function (dataSet) {
|
|
12334
|
-
var
|
|
12334
|
+
var customFieldsForDataSetFromDashboard = (customFields[dataSet.id] || []).map(upcast);
|
|
12335
|
+
var preferredFieldIds = dataSet.fields.map(function (field) {
|
|
12336
|
+
return field.id;
|
|
12337
|
+
});
|
|
12338
|
+
customFieldsForDataSetFromDashboard = customFieldsForDataSetFromDashboard.filter(function (persistedCustomFieldOnDashboard) {
|
|
12339
|
+
var fieldIdAlreadyUsed = preferredFieldIds.includes(persistedCustomFieldOnDashboard.id);
|
|
12340
|
+
return !fieldIdAlreadyUsed;
|
|
12341
|
+
});
|
|
12335
12342
|
return _extends({}, dataSet, {
|
|
12336
|
-
fields: [].concat(dataSet.fields,
|
|
12343
|
+
fields: [].concat(dataSet.fields, customFieldsForDataSetFromDashboard)
|
|
12337
12344
|
});
|
|
12338
12345
|
});
|
|
12339
12346
|
return [].concat(newDataSets);
|
|
@@ -73315,7 +73322,7 @@ var IN_BROWSER = 'in-browser';
|
|
|
73315
73322
|
* access tokens used for the identity logic.
|
|
73316
73323
|
*/
|
|
73317
73324
|
var VizzlyLoader = /*#__PURE__*/function () {
|
|
73318
|
-
function VizzlyLoader(queryEngine, loadAccessTokens, loadDataSetsCallback, options) {
|
|
73325
|
+
function VizzlyLoader(queryEngine, loadAccessTokens, loadDataSetsCallback, extraCustomFields, options) {
|
|
73319
73326
|
if (options === void 0) {
|
|
73320
73327
|
options = DEFAULT_OPTIONS$1;
|
|
73321
73328
|
}
|
|
@@ -73324,7 +73331,9 @@ var VizzlyLoader = /*#__PURE__*/function () {
|
|
|
73324
73331
|
this.queryEngine = void 0;
|
|
73325
73332
|
this.loadAccessTokens = void 0;
|
|
73326
73333
|
this.loadDataSetsCallback = void 0;
|
|
73334
|
+
this.extraCustomFields = void 0;
|
|
73327
73335
|
this.options = void 0;
|
|
73336
|
+
this.extraCustomFields = extraCustomFields;
|
|
73328
73337
|
this.queryEngine = queryEngine || IN_BROWSER;
|
|
73329
73338
|
this.loadAccessTokens = loadAccessTokens;
|
|
73330
73339
|
this.loadDataSetsCallback = loadDataSetsCallback;
|
|
@@ -73431,6 +73440,7 @@ var VizzlyLoader = /*#__PURE__*/function () {
|
|
|
73431
73440
|
}();
|
|
73432
73441
|
_proto.load = /*#__PURE__*/function () {
|
|
73433
73442
|
var _load = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
73443
|
+
var _this2 = this;
|
|
73434
73444
|
var _yield$Promise$all, identityConfig, queryEngineConfig, dataSets, dashboardStorageStrategy;
|
|
73435
73445
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
73436
73446
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -73443,13 +73453,22 @@ var VizzlyLoader = /*#__PURE__*/function () {
|
|
|
73443
73453
|
queryEngineConfig = _yield$Promise$all[1];
|
|
73444
73454
|
dataSets = _yield$Promise$all[2];
|
|
73445
73455
|
dashboardStorageStrategy = this.getDashboardStorageStrategy(queryEngineConfig);
|
|
73456
|
+
if (this.extraCustomFields) {
|
|
73457
|
+
dataSets = dataSets.map(function (dataSet) {
|
|
73458
|
+
var newFields = _this2.extraCustomFields ? _this2.extraCustomFields(dataSet) : [];
|
|
73459
|
+
console.log('adding fields', newFields);
|
|
73460
|
+
return _extends({}, dataSet, {
|
|
73461
|
+
fields: [].concat(dataSet.fields, newFields)
|
|
73462
|
+
});
|
|
73463
|
+
});
|
|
73464
|
+
}
|
|
73446
73465
|
return _context4.abrupt("return", {
|
|
73447
73466
|
queryEngineConfig: queryEngineConfig,
|
|
73448
73467
|
dataSets: dataSets,
|
|
73449
73468
|
identityConfig: identityConfig,
|
|
73450
73469
|
dashboardStorageStrategy: dashboardStorageStrategy
|
|
73451
73470
|
});
|
|
73452
|
-
case
|
|
73471
|
+
case 9:
|
|
73453
73472
|
case "end":
|
|
73454
73473
|
return _context4.stop();
|
|
73455
73474
|
}
|
|
@@ -75593,17 +75612,21 @@ var VizzlyServices = /*#__PURE__*/function () {
|
|
|
75593
75612
|
this.identityConfig = identityConfig;
|
|
75594
75613
|
this.vizzlyAPIClient = getVizzlyAPIClient(identityConfig, dashboardStorageStrategy, options);
|
|
75595
75614
|
}
|
|
75615
|
+
var _proto = VizzlyServices.prototype;
|
|
75616
|
+
_proto.getDataSets = function getDataSets() {
|
|
75617
|
+
return this.dataSets;
|
|
75618
|
+
}
|
|
75596
75619
|
|
|
75597
75620
|
/**
|
|
75598
75621
|
* @param properties
|
|
75599
75622
|
* @param options
|
|
75600
75623
|
* @returns Vizzly instance for programmatically managing dashboards.
|
|
75601
|
-
|
|
75624
|
+
*/;
|
|
75602
75625
|
VizzlyServices.load =
|
|
75603
75626
|
/*#__PURE__*/
|
|
75604
75627
|
function () {
|
|
75605
75628
|
var _load = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(properties, options) {
|
|
75606
|
-
var queryEngine, dataSetsFn, loadAccessTokens, programmaticDashboard, loader, _yield$loader$load, queryEngineConfig, dataSets, identityConfig, dashboardStorageStrategy, vizzly;
|
|
75629
|
+
var queryEngine, dataSetsFn, loadAccessTokens, programmaticDashboard, extraCustomFields, loader, _yield$loader$load, queryEngineConfig, dataSets, identityConfig, dashboardStorageStrategy, vizzly;
|
|
75607
75630
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
75608
75631
|
while (1) switch (_context.prev = _context.next) {
|
|
75609
75632
|
case 0:
|
|
@@ -75611,8 +75634,8 @@ var VizzlyServices = /*#__PURE__*/function () {
|
|
|
75611
75634
|
options = DEFAULT_LOADER_OPTIONS;
|
|
75612
75635
|
}
|
|
75613
75636
|
logDebug('Starting load process for the services package.');
|
|
75614
|
-
queryEngine = properties.queryEngine, dataSetsFn = properties.dataSets, loadAccessTokens = properties.identity, programmaticDashboard = properties.programmaticDashboard;
|
|
75615
|
-
loader = new VizzlyLoader(queryEngine, loadAccessTokens, dataSetsFn, options);
|
|
75637
|
+
queryEngine = properties.queryEngine, dataSetsFn = properties.dataSets, loadAccessTokens = properties.identity, programmaticDashboard = properties.programmaticDashboard, extraCustomFields = properties.extraCustomFields;
|
|
75638
|
+
loader = new VizzlyLoader(queryEngine, loadAccessTokens, dataSetsFn, extraCustomFields, options);
|
|
75616
75639
|
_context.next = 6;
|
|
75617
75640
|
return loader.load();
|
|
75618
75641
|
case 6:
|
|
@@ -75702,7 +75725,6 @@ var VizzlyServices = /*#__PURE__*/function () {
|
|
|
75702
75725
|
* Use the dashboard API to create the dashboard, upcast
|
|
75703
75726
|
* and return the dashboard with the data sets.
|
|
75704
75727
|
*/;
|
|
75705
|
-
var _proto = VizzlyServices.prototype;
|
|
75706
75728
|
_proto.createDashboard =
|
|
75707
75729
|
/*#__PURE__*/
|
|
75708
75730
|
function () {
|
|
@@ -78761,7 +78783,8 @@ var useSessionContext = function useSessionContext(params) {
|
|
|
78761
78783
|
queryEngine: params.queryEngine,
|
|
78762
78784
|
identity: params.identityCallback,
|
|
78763
78785
|
dataSets: params.loadDataSetsCallback,
|
|
78764
|
-
programmaticDashboard: params.programmaticDashboard
|
|
78786
|
+
programmaticDashboard: params.programmaticDashboard,
|
|
78787
|
+
extraCustomFields: params.extraCustomFields
|
|
78765
78788
|
}, {
|
|
78766
78789
|
apiHost: params.apiConfig.host,
|
|
78767
78790
|
developerMode: params.developerMode,
|
|
@@ -78892,7 +78915,8 @@ var GlobalProviderContents = function GlobalProviderContents(props) {
|
|
|
78892
78915
|
textOverride: textOverride,
|
|
78893
78916
|
isEditor: props.isEditor,
|
|
78894
78917
|
developerMode: developerMode,
|
|
78895
|
-
textOverrides: props.textOverrides
|
|
78918
|
+
textOverrides: props.textOverrides,
|
|
78919
|
+
extraCustomFields: props.customFields
|
|
78896
78920
|
});
|
|
78897
78921
|
var updateDashboardHash = function updateDashboardHash(dashboard) {
|
|
78898
78922
|
var definition = toSaveableDefinition(dashboard);
|
|
@@ -20,6 +20,7 @@ import { FilterConfig } from '../../shared-logic/src/AdditionalFilter/types';
|
|
|
20
20
|
export type { FilterConfig } from '../../shared-logic/src/AdditionalFilter/types';
|
|
21
21
|
export type { ViewConfiguration } from '../../shared-logic/src/ViewConfiguration/types';
|
|
22
22
|
export { VizzlyInstanceNotLoaded } from './errors/VizzlyInstanceNotLoaded';
|
|
23
|
+
import { CustomField } from '../../shared-logic/src/CustomField/types';
|
|
23
24
|
export declare type Options = {
|
|
24
25
|
apiHost: string;
|
|
25
26
|
};
|
|
@@ -35,6 +36,7 @@ export declare type VizzlyServicesProperties = {
|
|
|
35
36
|
identity: identityCallback;
|
|
36
37
|
programmaticDashboard?: programmaticDashboardCallback;
|
|
37
38
|
dataSets?: loadDataSetsCallback;
|
|
39
|
+
extraCustomFields?: (dataSet: DataSet) => Array<CustomField>;
|
|
38
40
|
};
|
|
39
41
|
declare class VizzlyServices {
|
|
40
42
|
private queryEngineConfig;
|
|
@@ -52,6 +54,7 @@ declare class VizzlyServices {
|
|
|
52
54
|
constructor(identityConfig: IdentityConfig, queryEngineConfig: QueryEngineConfig, dataSets: DataSet[], dashboardStorageStrategy: DashboardStorageStrategy, programmaticDashboard: programmaticDashboardCallback | undefined, options: {
|
|
53
55
|
host: string;
|
|
54
56
|
});
|
|
57
|
+
getDataSets(): DataSet<DataSet.Field>[];
|
|
55
58
|
/**
|
|
56
59
|
* @param properties
|
|
57
60
|
* @param options
|
|
@@ -17,6 +17,7 @@ import { VariablesCallback } from '../../../../shared-logic/src/Variables/types'
|
|
|
17
17
|
import { ClickSettingTypes } from '../../hooks/types';
|
|
18
18
|
import { VizzlyComponents } from '../../types';
|
|
19
19
|
import { UseVariableState } from '../Variables/types';
|
|
20
|
+
import { CustomField } from '../../../../shared-logic/src/CustomField/types';
|
|
20
21
|
declare type OverrideDeveloperInfo = {
|
|
21
22
|
overrideKey: string;
|
|
22
23
|
componentProps: any;
|
|
@@ -130,6 +131,7 @@ export declare type DashboardBehaviour = {
|
|
|
130
131
|
hasUnsavedChanges: boolean;
|
|
131
132
|
}) => void;
|
|
132
133
|
updateDashboardHash?: (dashboard: Dashboard) => void;
|
|
134
|
+
customFields?: (dataSet: DataSet) => Array<CustomField>;
|
|
133
135
|
};
|
|
134
136
|
export declare type TextOverride = (key: string, defaultValue: string, options?: TranslationOptions) => string;
|
|
135
137
|
export declare type FilterLibrary = (data: Component[]) => Component[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizzly/dashboard",
|
|
3
3
|
"author": "james@vizzly.co",
|
|
4
|
-
"version": "0.15.0-dev-
|
|
4
|
+
"version": "0.15.0-dev-7ff9d1595e60e37497596000c80eee55ff192ba9",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"types": "./dist/dashboard/src/index.d.ts",
|
|
7
7
|
"module": "./dist/dashboard.esm.js",
|