@digital-ai/dot-components 3.13.1 → 3.13.3
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/index.esm.js +33 -40
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -7966,7 +7966,7 @@ const formatListForTooltip = words => {
|
|
|
7966
7966
|
words.forEach(word => {
|
|
7967
7967
|
elements.push(jsx("div", {
|
|
7968
7968
|
children: word
|
|
7969
|
-
}));
|
|
7969
|
+
}, word));
|
|
7970
7970
|
});
|
|
7971
7971
|
return jsx("div", {
|
|
7972
7972
|
children: elements
|
|
@@ -8017,7 +8017,7 @@ function DotChipList({
|
|
|
8017
8017
|
children: jsxs(DotTypography, {
|
|
8018
8018
|
children: ["+", extraItems.length]
|
|
8019
8019
|
})
|
|
8020
|
-
}));
|
|
8020
|
+
}, "extra-items-tooltip"));
|
|
8021
8021
|
}
|
|
8022
8022
|
} else {
|
|
8023
8023
|
itemElements = items === null || items === void 0 ? void 0 : items.map(item => jsx(DotChip, {
|
|
@@ -9538,6 +9538,7 @@ const DotMetadataApiProvider = ({
|
|
|
9538
9538
|
const MOCK_API_URL = 'https://demo-mock-api';
|
|
9539
9539
|
const retrieveMetadata = useCallback((appType, isPublishedOnly) => {
|
|
9540
9540
|
setMetadataLoading(true);
|
|
9541
|
+
setAccountIdHeader(accountId);
|
|
9541
9542
|
return cancelablePromise(DashboardsService.getDashboardsMetadata(undefined, appType, undefined, undefined, isPublishedOnly ? 'PUBLISHED' : undefined)).then(response => {
|
|
9542
9543
|
setMetadataLoading(false);
|
|
9543
9544
|
setDashboardsError(null);
|
|
@@ -9555,7 +9556,7 @@ const DotMetadataApiProvider = ({
|
|
|
9555
9556
|
setDashboardsError(error);
|
|
9556
9557
|
return null;
|
|
9557
9558
|
});
|
|
9558
|
-
}, []);
|
|
9559
|
+
}, [accountId]);
|
|
9559
9560
|
const memoizedValues = useMemo(() => ({
|
|
9560
9561
|
metadataLoading,
|
|
9561
9562
|
dashboardsError,
|
|
@@ -9611,6 +9612,7 @@ const DotMetadataApiProvider = ({
|
|
|
9611
9612
|
setAccountIdHeader(accountId);
|
|
9612
9613
|
return cancelablePromise(DashboardsService.postDashboardsService1(dashboardId, dashboard)).then(response => {
|
|
9613
9614
|
setDashboardsError(null);
|
|
9615
|
+
setMetadata(null);
|
|
9614
9616
|
if (dashboards) {
|
|
9615
9617
|
dashboards.push(response);
|
|
9616
9618
|
setDashboards(dashboards.slice());
|
|
@@ -9649,6 +9651,7 @@ const DotMetadataApiProvider = ({
|
|
|
9649
9651
|
setAccountIdHeader(accountId);
|
|
9650
9652
|
return cancelablePromise(DashboardsService.patchDashboardsService(dashboardId, dashboard, isSync)).then(response => {
|
|
9651
9653
|
setDashboardsError(null);
|
|
9654
|
+
setMetadata(null);
|
|
9652
9655
|
setDashboards(orig => handleUpdateDashboard(orig, response));
|
|
9653
9656
|
return response;
|
|
9654
9657
|
}).catch(error => setDashboardsError(error));
|
|
@@ -9664,7 +9667,7 @@ const DotMetadataApiProvider = ({
|
|
|
9664
9667
|
} else if (OpenAPI.BASE === MOCK_API_URL) {
|
|
9665
9668
|
setDashboardsError(null);
|
|
9666
9669
|
setMetadataLoading(false);
|
|
9667
|
-
return Promise.resolve(appType
|
|
9670
|
+
return Promise.resolve(appType === 'AGILITY' ? getAuthorsMock : []);
|
|
9668
9671
|
}
|
|
9669
9672
|
return cancelablePromise(retrieveMetadata(appType, isPublishedOnly)).then(response => {
|
|
9670
9673
|
response.authors.sort(authorSort);
|
|
@@ -9683,28 +9686,6 @@ const DotMetadataApiProvider = ({
|
|
|
9683
9686
|
setDashboardsError(null);
|
|
9684
9687
|
setMetadataLoading(false);
|
|
9685
9688
|
const categories = getCategoriesMock.categories[appType];
|
|
9686
|
-
setMetadata(orig => {
|
|
9687
|
-
if (orig && appType in orig) {
|
|
9688
|
-
const appTypeCategories = orig[appType];
|
|
9689
|
-
appTypeCategories[key]['categories'] = categories;
|
|
9690
|
-
return Object.assign(Object.assign({}, orig), {
|
|
9691
|
-
[appType]: appTypeCategories
|
|
9692
|
-
});
|
|
9693
|
-
}
|
|
9694
|
-
return orig ? Object.assign(Object.assign({}, orig), {
|
|
9695
|
-
[appType]: {
|
|
9696
|
-
[key]: {
|
|
9697
|
-
categories
|
|
9698
|
-
}
|
|
9699
|
-
}
|
|
9700
|
-
}) : {
|
|
9701
|
-
[appType]: {
|
|
9702
|
-
[key]: {
|
|
9703
|
-
categories
|
|
9704
|
-
}
|
|
9705
|
-
}
|
|
9706
|
-
};
|
|
9707
|
-
});
|
|
9708
9689
|
return Promise.resolve(categories);
|
|
9709
9690
|
}
|
|
9710
9691
|
return cancelablePromise(retrieveMetadata(appType, isPublishedOnly)).then(response => {
|
|
@@ -9729,7 +9710,7 @@ const DotMetadataApiProvider = ({
|
|
|
9729
9710
|
});
|
|
9730
9711
|
}
|
|
9731
9712
|
})
|
|
9732
|
-
}), [metadata, metadataLoading, dashboardsError, dashboardsLoading, openedDashboardDetails, platformConsoleUrl]);
|
|
9713
|
+
}), [accountId, metadata, metadataLoading, dashboardsError, dashboardsLoading, openedDashboardDetails, platformConsoleUrl, retrieveMetadata]);
|
|
9733
9714
|
if (apiUrl && OpenAPI.BASE !== apiUrl) {
|
|
9734
9715
|
OpenAPI.BASE = apiUrl;
|
|
9735
9716
|
}
|
|
@@ -10310,6 +10291,14 @@ const DotDashboardDetails = _a => {
|
|
|
10310
10291
|
return null;
|
|
10311
10292
|
};
|
|
10312
10293
|
|
|
10294
|
+
const getActionItemNode = value => {
|
|
10295
|
+
return value ? jsxs("span", {
|
|
10296
|
+
children: ["Create new ", jsx("strong", {
|
|
10297
|
+
children: value
|
|
10298
|
+
}), " category"]
|
|
10299
|
+
}) : 'Enter a label to create new category';
|
|
10300
|
+
};
|
|
10301
|
+
const MINIMUM_LABEL_LENGTH = 3;
|
|
10313
10302
|
function DashboardCategoriesAutoComplete(_a) {
|
|
10314
10303
|
var {
|
|
10315
10304
|
freesolo: _freesolo,
|
|
@@ -10318,30 +10307,34 @@ function DashboardCategoriesAutoComplete(_a) {
|
|
|
10318
10307
|
onNewCategory
|
|
10319
10308
|
} = _a,
|
|
10320
10309
|
args = __rest(_a, ["freesolo", "actionItem", "onInputChange", "onNewCategory"]);
|
|
10321
|
-
const getActionItemNode = value => {
|
|
10322
|
-
return value ? jsxs("span", {
|
|
10323
|
-
children: ["Create new ", jsx("strong", {
|
|
10324
|
-
children: value
|
|
10325
|
-
}), " category"]
|
|
10326
|
-
}) : 'Enter a label to create new category';
|
|
10327
|
-
};
|
|
10328
10310
|
const [actionItemText, setActionItemText] = useState(getActionItemNode(''));
|
|
10311
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
10329
10312
|
const handleActionItemClick = newItem => {
|
|
10330
|
-
if (newItem
|
|
10331
|
-
onNewCategory
|
|
10313
|
+
if ((newItem === null || newItem === void 0 ? void 0 : newItem.length) >= MINIMUM_LABEL_LENGTH) {
|
|
10314
|
+
if (onNewCategory) {
|
|
10315
|
+
onNewCategory(newItem);
|
|
10316
|
+
}
|
|
10317
|
+
} else if (newItem) {
|
|
10318
|
+
setErrorMessage('Length of a category label must be 3 or more characters.');
|
|
10332
10319
|
}
|
|
10333
10320
|
};
|
|
10334
10321
|
const customActionItem = {
|
|
10335
10322
|
text: actionItemText,
|
|
10336
10323
|
onClick: handleActionItemClick
|
|
10337
10324
|
};
|
|
10325
|
+
const handleInputChange = useCallback((event, value, reason) => {
|
|
10326
|
+
setActionItemText(getActionItemNode(value));
|
|
10327
|
+
if ((value === null || value === void 0 ? void 0 : value.length) >= MINIMUM_LABEL_LENGTH && errorMessage) {
|
|
10328
|
+
setErrorMessage(null);
|
|
10329
|
+
}
|
|
10330
|
+
onInputChange && onInputChange(event, value, reason);
|
|
10331
|
+
}, [errorMessage]);
|
|
10338
10332
|
return jsx(DotAutoComplete, Object.assign({}, args, {
|
|
10339
10333
|
freesolo: false,
|
|
10340
10334
|
actionItem: customActionItem,
|
|
10341
|
-
onInputChange:
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
}
|
|
10335
|
+
onInputChange: handleInputChange,
|
|
10336
|
+
error: !!errorMessage,
|
|
10337
|
+
helperText: errorMessage
|
|
10345
10338
|
}));
|
|
10346
10339
|
}
|
|
10347
10340
|
|