Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update hint styles (#1859)

boojack706aa79db16f
diff --git a/frontend/public/demo/schema-migration-history/hint.json b/frontend/public/demo/schema-migration-history/hint.json
index 9775f922d3..8bfdbaedfd 100644
--- a/frontend/public/demo/schema-migration-history/hint.json
+++ b/frontend/public/demo/schema-migration-history/hint.json
@@ -14,9 +14,24 @@
"type": "shield",
"url": ".+/db/"
},
+ {
+ "selector": "[data-label='bb-migration-history-establish-baseline-alert'] [data-label='bb-alert-ok-button']",
+ "type": "shield",
+ "url": ".+?/db/.+?#migration-history$",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Since this is a read-only DEMO, you can contact [email protected] to request a full DEMO.",
+ "zh-CN": "但由于这是个只读 DEMO,您可以联系 [email protected] 来申请完整的 DEMO 进行尝试。"
+ },
+ "alwaysShow": true
+ },
+ "additionStyle": {
+ "backdropFilter": "unset"
+ }
+ },
{
"selector": "[data-label='bb-dashboard-header-database-entry']",
- "type": "hint",
"url": "^(?!.+/db)",
"cover": true,
"dialog": {
@@ -26,67 +41,53 @@
"zh-CN": "我们来查看数据库模块"
},
"alwaysShow": true
- },
- "additionStyle": {
- "z-index": "10"
}
},
{
"selector": "[data-label='bb-database-table']",
- "type": "hint",
"url": ".+?/db",
"cover": true,
"dialog": {
"title": "",
"description": {
- "en-US": "Let's focus on the target database",
- "zh-CN": "让我们专注在目标数据库"
+ "en-US": "Choose the target database",
+ "zh-CN": "选择一个目标数据库"
},
"alwaysShow": true,
"position": "top"
- },
- "additionStyle": {
- "z-index": "10"
}
},
{
"selector": "[data-label='bb-database-detail-tab'] button:nth-child(2)",
- "type": "hint",
"url": ".+?/db/.+?(?<!#migration-history)$",
- "highlight": true,
+ "type": "tooltip",
"dialog": {
"title": "",
"description": {
"en-US": "Let's focus on the database schema change management",
"zh-CN": "让我们专注在数据库变更管理场景"
},
- "alwaysShow": true,
"position": "right"
- },
- "additionStyle": {
- "z-index": "10"
}
},
{
"selector": "[data-label='bb-establish-baseline-button']",
- "type": "hint",
"url": ".+?/db/.+?#migration-history$",
- "highlight": true,
+ "type": "tooltip",
"dialog": {
"title": "",
"description": {
- "en-US": "Creating a new BASELINE can start a new Schema life cycle, but since this is a read-only DEMO, you can contact [email protected] to request a full DEMO to try.",
- "zh-CN": "新建一个 BASELINE 可以开始一个新的 Schema 生命周期,但由于这是个只读 DEMO,您可以联系 [email protected] 来申请完整的 DEMO 进行尝试。"
+ "en-US": "Creating a new BASELINE can start a new Schema life cycle",
+ "zh-CN": "新建一个 BASELINE 可以开始一个新的 Schema 生命周期"
},
"position": "right"
},
"additionStyle": {
- "z-index": "10"
+ "marginLeft": "8px"
}
},
{
"selector": "[data-label='bb-database-overview-description-list']",
- "type": "hint",
"url": ".+?/db/.+?#overview$",
"dialog": {
"title": "",
@@ -96,66 +97,91 @@
},
"alwaysShow": true,
"position": "topright"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-table'] tr:nth-child(2) > td:nth-child(1)",
+ "url": ".+?/db/.+?#migration-history$",
+ "type": "tooltip",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "Every change will generate a new Schema version",
+ "zh-CN": "每次变更都将产生一个新的 Schema 版本,点我看看"
+ },
+ "alwaysShow": true,
+ "position": "right"
},
"additionStyle": {
- "z-index": "10"
+ "marginLeft": "-16px",
+ "marginTop": "8px"
}
},
{
- "selector": "[data-label='bb-migration-history-table']",
- "type": "hint",
+ "selector": "[data-label='bb-migration-history-table'] tr:nth-child(3) > td:nth-child(5)",
"url": ".+?/db/.+?#migration-history$",
+ "type": "tooltip",
+ "position": "left",
"dialog": {
"title": "",
"description": {
- "en-US": "Here are all the migration records, where BASELINE records the initial state of the database schema, and every other change will generate a new schema version.",
- "zh-CN": "这里是所有的迁移记录,其中 BASELINE 记录了数据库 Schema 的初始状态,其余每一次变更都将产生一个新的 Schema 版本。"
+ "en-US": "Hover the SQL, you can get the full of them",
+ "zh-CN": "让我们专注在数据库变更管理场景"
},
- "alwaysShow": true,
- "position": "bottom"
+ "position": "left"
},
"additionStyle": {
- "z-index": "10"
+ "marginTop": "8px"
+ }
+ },
+ {
+ "selector": "[data-label='bb-migration-history-table'] tr:nth-child(4) > td:nth-child(3)",
+ "url": ".+?/db/.+?#migration-history$",
+ "type": "tooltip",
+ "position": "left",
+ "dialog": {
+ "title": "",
+ "description": {
+ "en-US": "BASELINE records the initial state of the database schema",
+ "zh-CN": "BASELINE 记录了数据库 Schema 的初始状态,点我看看"
+ },
+ "position": "right"
}
},
{
"selector": "[data-label='bb-migration-history-diff-switch']",
- "type": "hint",
"url": ".+?/db/.+?/history/.+",
"dialog": {
"title": "",
"description": {
- "en-US": "Let's focus on the Database",
+ "en-US": "You can also view the full Schema snapshot after the change",
"zh-CN": "也可以查看变更后的完整 Schema 快照"
},
"position": "right",
- "showOnce": true
+ "showOnce": "true"
},
"additionStyle": {
- "z-index": "10"
+ "boxShadow": "rgb(78 70 211) 0px 0px 1px 2px"
}
},
{
"selector": "[data-label='bb-migration-history-view-drift-button']",
- "type": "hint",
"url": ".+?/db/.+?/history/.+",
- "highlight": true,
+ "type": "tooltip",
"dialog": {
"title": "",
"description": {
"en-US": "A schema drift was detected in this change, indicating that a change beyond the control of the Bytebase platform occurred prior to this change.",
"zh-CN": "这次变更检查到了 Schema 偏差,说明这次变更之前发生了脱离 Bytebase 平台管控的变更"
},
- "position": "right",
- "showOnce": true
+ "position": "right"
},
"additionStyle": {
- "z-index": "10"
+ "marginLeft": "8px"
}
},
{
"selector": "[data-label='bb-migration-history-code-diff-block']",
- "type": "hint",
"url": ".+?/db/.+?/history/.+",
"dialog": {
"title": "",
@@ -165,14 +191,10 @@
},
"alwaysShow": true,
"position": "topright"
- },
- "additionStyle": {
- "z-index": "10"
}
},
{
"selector": "[data-label='bb-migration-history-code-block']",
- "type": "hint",
"url": ".+?/db/.+?/history/.+",
"dialog": {
"title": "",
@@ -182,9 +204,6 @@
},
"alwaysShow": true,
"position": "topright"
- },
- "additionStyle": {
- "z-index": "10"
}
}
]
diff --git a/frontend/src/bbkit/BBAlert.vue b/frontend/src/bbkit/BBAlert.vue
index 39a000e97c..85efe8545a 100644
--- a/frontend/src/bbkit/BBAlert.vue
+++ b/frontend/src/bbkit/BBAlert.vue
@@ -96,6 +96,7 @@
<button
type="button"
class="btn-normal mt-3 px-4 py-2 sm:mt-0 sm:w-auto"
+ data-label="bb-alert-cancel-button"
:disabled="inProgress"
@click.prevent="cancel"
>
@@ -104,6 +105,7 @@
<button
type="button"
class="sm:ml-3 inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-error text-base font-medium text-white focus:outline-none focus-visible:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:w-auto sm:text-sm"
+ data-label="bb-alert-ok-button"
:class="okButtonStyle"
:disabled="inProgress"
@click.prevent="$emit('ok', payload)"
diff --git a/frontend/src/components/DatabaseMigrationHistoryPanel.vue b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
index 7c8ebadc63..0b7c844442 100644
--- a/frontend/src/components/DatabaseMigrationHistoryPanel.vue
+++ b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
@@ -50,6 +50,7 @@
<BBAlert
v-if="state.showBaselineModal"
+ data-label="bb-migration-history-establish-baseline-alert"
:style="'INFO'"
:ok-text="$t('migration-history.establish-baseline')"
:cancel-text="$t('common.cancel')"
diff --git a/frontend/src/plugins/demo/hint.ts b/frontend/src/plugins/demo/hint.ts
index 4de07d2688..18a4d112ca 100644
--- a/frontend/src/plugins/demo/hint.ts
+++ b/frontend/src/plugins/demo/hint.ts
@@ -1,6 +1,6 @@
import { indexOf, isUndefined } from "lodash-es";
import { getStringFromI18NText } from "./i18n";
-import { DialogPosition, HintData } from "./types";
+import { Position, HintData } from "./types";
import {
checkUrlMatched,
getElementBounding,
@@ -17,17 +17,17 @@ export const showHints = async (hintDataList: HintData[]) => {
const findTargetPromiseList = hintDataList.map(async (hintData) => {
const index = indexOf(hintDataList, hintData);
- if (closedHintIndexSet.has(index) || !checkUrlMatched(hintData.url)) {
+ if (
+ shownHintIndexSet.has(index) ||
+ closedHintIndexSet.has(index) ||
+ !checkUrlMatched(hintData.url)
+ ) {
return;
}
const targetElement = await waitForTargetElement([[hintData.selector]]);
if (targetElement) {
- if (shownHintIndexSet.has(index)) {
- return;
- }
renderHint(targetElement, hintData, index);
- updateHintPosition(targetElement, hintData, index);
shownHintIndexSet.add(index);
} else {
removeHint(index);
@@ -43,19 +43,25 @@ const renderHint = (
hintData: HintData,
hintIndex: number
) => {
+ if (hintData.type === "tooltip") {
+ renderTooltip(targetElement, hintData, hintIndex);
+ return;
+ }
+
const hintWrapper = document.createElement("div");
hintWrapper.className = `bb-hint-wrapper bb-hint-${hintIndex}`;
- if (hintData.highlight) {
- hintWrapper.classList.add("highlight");
- }
if (hintData.type === "shield") {
hintWrapper.classList.add("shield");
}
document.body.appendChild(hintWrapper);
+ if (hintData.cover) {
+ hintWrapper.classList.add("covered");
+ renderCover(targetElement, hintIndex);
+ }
+
const maxZIndex = getElementMaxZIndex(targetElement);
hintWrapper.style.zIndex = `${maxZIndex}`;
-
if (hintData.additionStyle) {
for (const key in hintData.additionStyle) {
hintWrapper.style[key] = hintData.additionStyle[key];
@@ -67,24 +73,21 @@ const renderHint = (
hintWrapper.style.left = `${bounding.left}px`;
hintWrapper.style.width = `${bounding.width}px`;
hintWrapper.style.height = `${bounding.height}px`;
+ hintWrapper.style.pointerEvents = "none";
- if (isUndefined(hintData.dialog)) {
- hintWrapper.style.pointerEvents = "none";
- } else {
+ if (hintData.dialog) {
if (hintData.dialog.alwaysShow) {
renderHintDialog(targetElement, hintData, hintIndex);
- hintWrapper.style.pointerEvents = "none";
} else {
+ hintWrapper.style.pointerEvents = "auto";
hintWrapper.addEventListener(
"click",
(e) => {
e.stopPropagation();
hintWrapper.style.pointerEvents = "none";
- if (!isUndefined(hintData.dialog)) {
- if (hintData.dialog.showOnce) {
- closedHintIndexSet.add(hintIndex);
- }
- renderHintDialog(targetElement, hintData, hintIndex);
+ renderHintDialog(targetElement, hintData, hintIndex);
+ if (hintData.dialog?.showOnce) {
+ closedHintIndexSet.add(hintIndex);
}
},
{
@@ -94,15 +97,7 @@ const renderHint = (
}
}
- if (hintData.cover) {
- const maxZIndex = getElementMaxZIndex(targetElement);
- hintWrapper.classList.add("covered");
- const coverElement = document.createElement("div");
- coverElement.className = `bb-hint-cover-wrapper bb-hint-${hintIndex}`;
- coverElement.style.zIndex = `${Math.max(maxZIndex - 1, 0)}`;
- document.body.appendChild(coverElement);
- targetElement.classList.add("bb-hint-target-element");
- }
+ updateHintPosition(targetElement, hintData, hintIndex);
};
const renderHintDialog = (
@@ -110,7 +105,7 @@ const renderHintDialog = (
hintData: HintData,
hintIndex: number
) => {
- if (isUndefined(hintData.dialog)) {
+ if (isUndefined(hintData.dialog) || closedHintIndexSet.has(hintIndex)) {
return;
}
@@ -118,17 +113,15 @@ const renderHintDialog = (
dialog: { title, description, position, alwaysShow },
} = hintData;
const hintDialogDiv = document.createElement("div");
- hintDialogDiv.className = `bb-hint-dialog bb-hint-dialog-${hintIndex}`;
+ hintDialogDiv.className = `bb-hint-dialog bb-hint-${hintIndex}`;
+
+ if (hintData.type === "tooltip") {
+ hintDialogDiv.classList.add("tooltip-dialog");
+ }
const maxZIndex = getElementMaxZIndex(targetElement);
hintDialogDiv.style.zIndex = `${maxZIndex}`;
- if (hintData.additionStyle) {
- for (const key in hintData.additionStyle) {
- hintDialogDiv.style[key] = hintData.additionStyle[key];
- }
- }
-
if (!alwaysShow) {
const closeButton = document.createElement("button");
closeButton.className = "bb-hint-close-button";
@@ -155,16 +148,23 @@ const renderHintDialog = (
document.body.appendChild(hintDialogDiv);
adjustHintDialogPosition(targetElement, hintDialogDiv, position);
+
+ return hintDialogDiv;
};
const adjustHintDialogPosition = (
targetElement: HTMLElement,
hintDialogDiv: HTMLElement,
- position: DialogPosition = "bottom"
+ position: Position = "bottom"
) => {
const bounding = getElementBounding(targetElement);
const hintDialogBounding = getElementBounding(hintDialogDiv);
+ if (bounding.width === 0 && bounding.height === 0) {
+ hintDialogDiv.remove();
+ return;
+ }
+
if (position === "bottom") {
hintDialogDiv.style.top = `${bounding.top + bounding.height}px`;
hintDialogDiv.style.left = `${bounding.left - 4}px`;
@@ -221,6 +221,95 @@ const updateHintPosition = (
);
};
+const renderTooltip = (
+ targetElement: HTMLElement,
+ hintData: HintData,
+ hintIndex: number
+) => {
+ const tooltipWrapper = document.createElement("div");
+ tooltipWrapper.className = `bb-hint-tooltip-wrapper bb-hint-${hintIndex}`;
+ tooltipWrapper.style.zIndex = `${getElementMaxZIndex(targetElement)}`;
+ tooltipWrapper.textContent = "!";
+ if (hintData.additionStyle) {
+ for (const key in hintData.additionStyle) {
+ tooltipWrapper.style[key] = `${hintData.additionStyle[key]}`;
+ }
+ }
+ document.body.appendChild(tooltipWrapper);
+
+ tooltipWrapper.addEventListener("mouseenter", () => {
+ const dialogElement = renderHintDialog(tooltipWrapper, hintData, hintIndex);
+ tooltipWrapper.addEventListener(
+ "mouseleave",
+ () => {
+ dialogElement?.remove();
+ },
+ {
+ once: true,
+ }
+ );
+ });
+
+ tooltipWrapper.addEventListener("click", () => {
+ closedHintIndexSet.add(hintIndex);
+ removeHint(hintIndex);
+ });
+
+ targetElement.addEventListener(
+ "click",
+ () => {
+ closedHintIndexSet.add(hintIndex);
+ removeHint(hintIndex);
+ },
+ {
+ once: true,
+ }
+ );
+
+ requestAnimationFrame(() =>
+ updateTooltipPosition(targetElement, hintData, hintIndex)
+ );
+};
+
+const updateTooltipPosition = (
+ targetElement: HTMLElement,
+ hintData: HintData,
+ hintIndex: number
+) => {
+ const hintWrapper = document.body.querySelector(
+ `.bb-hint-tooltip-wrapper.bb-hint-${hintIndex}`
+ ) as HTMLElement;
+
+ if (!targetElement || !hintWrapper) {
+ removeHint(hintIndex);
+ return;
+ }
+
+ const position = hintData.position;
+ const bounding = getElementBounding(targetElement);
+
+ if (!position || position === "right") {
+ hintWrapper.style.top = `${bounding.top}px`;
+ hintWrapper.style.left = `${bounding.left + bounding.width}px`;
+ } else if (position === "left") {
+ hintWrapper.style.top = `${bounding.top}px`;
+ hintWrapper.style.left = `${bounding.left}px`;
+ }
+
+ requestAnimationFrame(() =>
+ updateTooltipPosition(targetElement, hintData, hintIndex)
+ );
+};
+
+const renderCover = (targetElement: HTMLElement, hintIndex: number) => {
+ const coverElement = document.createElement("div");
+ coverElement.className = `bb-hint-cover-wrapper bb-hint-${hintIndex}`;
+ const maxZIndex = getElementMaxZIndex(targetElement);
+ coverElement.style.zIndex = `${Math.max(maxZIndex - 1, 0)}`;
+ document.body.appendChild(coverElement);
+ targetElement.classList.add("bb-hint-target-element");
+};
+
export const removeHint = (hintIndex?: number) => {
if (isUndefined(hintIndex)) {
const hintWrappers = document.querySelectorAll(".bb-hint-wrapper");
@@ -229,18 +318,27 @@ export const removeHint = (hintIndex?: number) => {
hintWrapper.remove();
});
}
+
const hintDialogs = document.querySelectorAll(".bb-hint-dialog");
if (hintDialogs) {
hintDialogs.forEach((hintDialog) => {
hintDialog.remove();
});
}
+
const hintCovers = document.querySelectorAll(".bb-hint-cover-wrapper");
if (hintCovers) {
hintCovers.forEach((item) => {
item.remove();
});
}
+
+ const hintTooltips = document.querySelectorAll(".bb-hint-tooltip-wrapper");
+ if (hintTooltips) {
+ hintTooltips.forEach((item) => {
+ item.remove();
+ });
+ }
} else {
const hintWrapper = document.querySelector(
`.bb-hint-wrapper.bb-hint-${hintIndex}`
@@ -250,7 +348,7 @@ export const removeHint = (hintIndex?: number) => {
}
const hintDialog = document.querySelector(
- `.bb-hint-dialog.bb-hint-dialog-${hintIndex}`
+ `.bb-hint-dialog.bb-hint-${hintIndex}`
);
if (hintDialog) {
hintDialog.remove();
@@ -262,5 +360,12 @@ export const removeHint = (hintIndex?: number) => {
if (hintCover) {
hintCover.remove();
}
+
+ const hintTooltip = document.querySelector(
+ `.bb-hint-tooltip-wrapper.bb-hint-${hintIndex}`
+ );
+ if (hintTooltip) {
+ hintTooltip.remove();
+ }
}
};
diff --git a/frontend/src/plugins/demo/listener.ts b/frontend/src/plugins/demo/listener.ts
index 41f693d9e8..67ee4ea322 100644
--- a/frontend/src/plugins/demo/listener.ts
+++ b/frontend/src/plugins/demo/listener.ts
@@ -84,6 +84,7 @@ const initLocationListenerForGuide = () => {
// initMutationListenerForHint using mutation observer to detect DOM changes.
const initMutationListenerForHint = () => {
+ let flag: any = -1;
const observer = new MutationObserver(async (mutations: MutationRecord[]) => {
for (const mutation of mutations) {
const changedNodes = [...mutation.addedNodes, ...mutation.removedNodes];
@@ -92,9 +93,15 @@ const initMutationListenerForHint = () => {
changedNode instanceof HTMLElement &&
!changedNode.matches(".bb-hint-wrapper") &&
!changedNode.matches(".bb-hint-cover-wrapper") &&
- !changedNode.matches(".bb-hint-dialog")
+ !changedNode.matches(".bb-hint-dialog") &&
+ !changedNode.matches(".bb-hint-tooltip-wrapper")
) {
- tryToShowHints();
+ if (flag) {
+ clearTimeout(flag);
+ }
+ flag = setTimeout(() => {
+ tryToShowHints();
+ }, 100);
return;
}
}
diff --git a/frontend/src/plugins/demo/style.css b/frontend/src/plugins/demo/style.css
index 4e7bfbff16..eb2ba2079a 100644
--- a/frontend/src/plugins/demo/style.css
+++ b/frontend/src/plugins/demo/style.css
@@ -1,6 +1,6 @@
.bb-guide-cover-wrapper,
.bb-hint-cover-wrapper {
- @apply fixed inset-0;
+ @apply fixed inset-0 overflow-hidden;
z-index: 999998;
}
@@ -22,14 +22,18 @@
.bb-guide-dialog,
.bb-hint-dialog {
- @apply absolute bg-white w-72 m-1 text-black p-2 py-3 px-3 rounded-lg text-left -top-full -left-full;
+ @apply fixed bg-white w-72 m-1 text-black p-3 px-4 rounded-lg text-left -top-full -left-full overflow-hidden;
box-shadow: 0 3px 30px rgb(33 33 33 / 30%);
z-index: 1000000;
}
+.bb-hint-dialog.tooltip-dialog {
+ @apply mx-2;
+}
+
.bb-guide-close-button,
.bb-hint-close-button {
- @apply absolute top-0 right-0.5 px-1 font-thin rounded cursor-pointer opacity-60 hover:opacity-50;
+ @apply fixed top-0 right-0.5 px-1 font-thin rounded cursor-pointer opacity-60 hover:opacity-50;
font-size: 24px;
}
@@ -52,9 +56,9 @@
}
.bb-hint-wrapper {
- @apply absolute rounded cursor-pointer;
+ @apply fixed rounded cursor-pointer overflow-hidden;
z-index: 999999;
- box-shadow: rgb(33 33 33 / 80%) 0px 0px 1px 2px;
+ box-shadow: rgb(33 33 33 / 30%) 0px 0px 1px 2px;
}
.bb-hint-wrapper.covered {
@@ -62,17 +66,18 @@
rgb(33 33 33 / 60%) 0px 0px 0px 5000px !important;
}
-.bb-hint-wrapper.highlight {
- box-shadow: rgb(78 70 211 / 80%) 0px 0px 1px 2px;
- animation: 0.5s linear 0.5s infinite alternate breathing;
-}
-
.bb-hint-wrapper.shield {
- @apply border-none rounded-none;
- background: rgb(33 33 33 / 50%);
- box-shadow: none;
- cursor: not-allowed;
+ @apply border-none rounded-none overflow-hidden bg-transparent shadow-none cursor-not-allowed;
pointer-events: auto !important;
+ backdrop-filter: blur(2px);
+ background: rgba(255, 255, 255, 0.4);
+}
+
+.bb-hint-tooltip-wrapper {
+ @apply fixed w-4 h-4 text-xs text-center leading-4 shadow-none rounded-full m-0 bg-white cursor-default;
+ animation: 2s linear 2s infinite breathing;
+ box-shadow: rgb(78 70 211) 0px 0px 1px 2px;
+ color: rgb(78 70 211);
}
@keyframes breathing {
@@ -83,8 +88,15 @@
box-shadow: rgb(78 70 211) 0px 0px 1px 2px,
rgb(78 70 211 / 40%) 0px 0px 0px 4px;
}
- 100% {
+ 60% {
box-shadow: rgb(78 70 211) 0px 0px 1px 2px,
rgb(78 70 211 / 40%) 0px 0px 0px 12px;
}
+ 70% {
+ box-shadow: rgb(78 70 211) 0px 0px 1px 2px,
+ rgb(78 70 211 / 40%) 0px 0px 0px 8px;
+ }
+ 100% {
+ box-shadow: rgb(78 70 211) 0px 0px 1px 2px;
+ }
}
diff --git a/frontend/src/plugins/demo/types.ts b/frontend/src/plugins/demo/types.ts
index 6437287d9a..ce989a1c39 100644
--- a/frontend/src/plugins/demo/types.ts
+++ b/frontend/src/plugins/demo/types.ts
@@ -1,6 +1,6 @@
type StepType = "click" | "change";
-export type DialogPosition = "bottom" | "top" | "left" | "right" | "topright";
+export type Position = "bottom" | "top" | "left" | "right" | "topright";
export type I18NText = {
[key: string]: string;
@@ -16,7 +16,7 @@ export interface StepData {
// value is the regex-like string using for check the target content value
value?: string;
// position is the position of the guide dialog (default is bottom)
- position?: DialogPosition;
+ position?: Position;
// cover is the flag that cover should be shown
cover?: boolean;
// hideNextButton is the flag that next button should be hidden
@@ -28,7 +28,7 @@ export interface GuideData {
steps: StepData[];
}
-export type HintType = "hint" | "shield";
+export type HintType = "tooltip" | "shield";
// Hint is a special guide that has no Next button and is always shown.
export interface HintData {
@@ -41,15 +41,17 @@ export interface HintData {
highlight?: boolean;
// cover is the flag that cover should be shown
cover?: boolean;
+ // position is the position of the hint espectially for tooltip (default is right)
+ position?: Position;
+ // addStyle for customizing the actual style
// dialog is a data of dialog info. If it's undefined, then the dialog will not be shown.
dialog?: {
title: string | I18NText;
description: string | I18NText;
// position is the position of the guide dialog (default is bottom)
- position?: DialogPosition;
+ position?: Position;
alwaysShow?: boolean;
showOnce?: boolean;
};
- // addtionClass is the class name that should be added to the hint element
additionStyle?: CSSStyleDeclaration;
}