|
|
@@ -404,27 +404,33 @@
|
|
|
|
|
|
};
|
|
|
|
|
|
- //按钮 [id,pos,title,label,className]
|
|
|
- wd.display.wdButtons = [
|
|
|
- ["wdHelp", 3, "帮助", "帮助", "icon-help"],
|
|
|
- ["CMS_download", 3, "下载", "下载", "icon-download"],
|
|
|
- ["wdShare", 3, "收藏", "收藏", "icon-favorite"],
|
|
|
- ["wdShared", 3, "已收藏", "已收藏", "icon-favoriteOn"],
|
|
|
- ["editWdHelp", 3, "编辑帮助", "编辑帮助", "icon-setHelp"],
|
|
|
- ["editWdHelp_save", 3, "编辑帮助保存", "编辑帮助保存", "invertIcon-save"],
|
|
|
- ["wdTab", 3, "编辑选项卡", "编辑选项卡", "icon-set"],
|
|
|
- ["wdTab_save", 3, "保存选项卡", "保存选项卡", "invertIcon-save"],
|
|
|
- ["wdRecord", 3, "个人选值", "个人选值", "icon-setValue"],
|
|
|
- ["wdRecord_save", 3, "个人选值保存", "个人选值保存", "invertIcon-save"],
|
|
|
- ["CMS_fullscreen", 3, "全屏", "全屏", "dialog-restoreButton"],
|
|
|
- ["CMS_nrProperty", 3, "内容属性", "内容属性", "icon-property"],
|
|
|
- ["change_on", 3, "变动查看-开", "变动查看-开", "dialog-changeOnButton"],
|
|
|
- ["change_off", 3, "变动查看-关", "变动查看-关", "dialog-changeButton"],
|
|
|
- ["lockScreen", 3, "锁定", "锁定", "icon-lock"],
|
|
|
- ["wdPrint", 3, "打印", "打印", "icon-print"],
|
|
|
- ["wdBatchPrint", 3, "批量打印", "批量打印", "icon-print"],
|
|
|
- ["wdHelpCopyhexcode", 3, "复制帮助代码", "复制帮助代码", "icon-key"]
|
|
|
- ];
|
|
|
+ //按钮 [id,pos,title,label,className]
|
|
|
+ wd.display.wdButtons = [
|
|
|
+ //功能: 旧UI弹窗右上角按钮图标升级为 icon-base(先改 help/lock/close)by xu 20251223
|
|
|
+ ["wdHelp", 3, "帮助", "帮助", "dialog-toolbar-icon icon-help"],
|
|
|
+ ["CMS_download", 3, "下载", "下载", "icon-download"],
|
|
|
+ ["wdShare", 3, "收藏", "收藏", "icon-favorite"],
|
|
|
+ ["wdShared", 3, "已收藏", "已收藏", "icon-favoriteOn"],
|
|
|
+ ["editWdHelp", 3, "编辑帮助", "编辑帮助", "icon-setHelp"],
|
|
|
+ ["editWdHelp_save", 3, "编辑帮助保存", "编辑帮助保存", "invertIcon-save"],
|
|
|
+ //功能: icon-base 图标名调整:编辑选项卡 icon-ptab(弹窗顶部用细体)by xu 20251224
|
|
|
+ ["wdTab", 3, "编辑选项卡", "编辑选项卡", "dialog-toolbar-icon icon-ptab"],
|
|
|
+ //功能: icon-base 图标名调整:保存选项卡使用 icon-save(不再用 invertIcon-save)by xu 20251225
|
|
|
+ ["wdTab_save", 3, "保存选项卡", "保存选项卡", "invertIcon-save dialog-toolbar-icon icon-save"],
|
|
|
+ //功能: icon-base 图标名调整:个人选值 icon-pval(弹窗顶部用细体)by xu 20251224
|
|
|
+ ["wdRecord", 3, "个人选值", "个人选值", "dialog-toolbar-icon icon-pval"],
|
|
|
+ //功能: icon-base 图标名调整:个人选值保存使用 icon-save(不再用 invertIcon-save)by xu 20251225
|
|
|
+ ["wdRecord_save", 3, "个人选值保存", "个人选值保存", "invertIcon-save dialog-toolbar-icon icon-save"],
|
|
|
+ ["CMS_fullscreen", 3, "全屏", "全屏", "dialog-restoreButton"],
|
|
|
+ ["CMS_nrProperty", 3, "内容属性", "内容属性", "icon-property"],
|
|
|
+ ["change_on", 3, "变动查看-开", "变动查看-开", "dialog-changeOnButton"],
|
|
|
+ ["change_off", 3, "变动查看-关", "变动查看-关", "dialog-changeButton"],
|
|
|
+ ["lockScreen", 3, "锁定", "锁定", "dialog-toolbar-icon icon-lock"],
|
|
|
+ ["wdPrint", 3, "打印", "打印", "icon-print"],
|
|
|
+ ["wdBatchPrint", 3, "批量打印", "批量打印", "icon-print"],
|
|
|
+ ["wdHelpCopyhexcode", 3, "复制帮助代码", "复制帮助代码", "icon-key"]
|
|
|
+ //功能: SsSubTab 菜单模式切换按钮改为按需创建,避免所有弹窗都出现 by xu 20251224
|
|
|
+ ];
|
|
|
|
|
|
wd.display.initStyleWdButtons = function () {
|
|
|
|
|
|
@@ -433,11 +439,12 @@
|
|
|
wd.topWindow.$("div.dhtmlx_button_" + wd.display.wdButtons[i][0] + "_default").addClass(wd.display.wdButtons[i][4]);
|
|
|
}
|
|
|
|
|
|
- // 特殊处理close,因为如果close和dhtmlx的close冲突,会隐藏原生,新增一个按钮
|
|
|
- var className = "dhtmlx_button_close_default";
|
|
|
- wd.topWindow.$("div.dhtmlx_button_close_default").removeClass(className).addClass("largeIcon-close");
|
|
|
+ // 特殊处理close,因为如果close和dhtmlx的close冲突,会隐藏原生,新增一个按钮
|
|
|
+ var className = "dhtmlx_button_close_default";
|
|
|
+ //功能: 弹窗关闭按钮使用 icon-base(避免依赖 svg/png)by xu 20251223
|
|
|
+ wd.topWindow.$("div.dhtmlx_button_close_default").removeClass(className).addClass("dialog-toolbar-close-icon icon-close");
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 添加隐藏按钮
|
|
|
@@ -584,6 +591,204 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //功能: SsSubTab 菜单模式切换按钮启用(由页面主动调用)by xu 20251223
|
|
|
+ wd.display.enableSsSubTabMenuModeButton = function () {
|
|
|
+ try {
|
|
|
+ var wdDialogId = wd.display.getwdDialogId();
|
|
|
+ if (!wdDialogId) return false;
|
|
|
+ if (!wd.topWindow || !wd.topWindow.dhxWins) return false;
|
|
|
+ var w = wd.topWindow.dhxWins.window(wdDialogId);
|
|
|
+ if (!w) return false;
|
|
|
+ //功能: 打印调试信息(定位点击无反应问题)by xu 20251224
|
|
|
+ try { console.log("[SsSubTabMenuMode] enable start, wdDialogId=", wdDialogId); } catch (e) { }
|
|
|
+
|
|
|
+ //功能: 获取当前弹窗的 DOM 容器(用于精准定位按钮,避免多弹窗 querySelector 选错)by xu 20251224
|
|
|
+ var iframeEl = null;
|
|
|
+ //功能: 优先通过 wdDialogId 精确定位 iframe(避免误拿到 SsSubTab 内部 iframe)by xu 20251224
|
|
|
+ try {
|
|
|
+ var ifs = wd.topWindow.document.getElementsByTagName("IFRAME");
|
|
|
+ for (var ii = 0; ii < ifs.length; ii++) {
|
|
|
+ var iframeObj = ifs[ii];
|
|
|
+ var tempId = iframeObj.getAttribute("wdDialogId");
|
|
|
+ if (!tempId && iframeObj.dataset) {
|
|
|
+ tempId = iframeObj.dataset["wdDialogId"];
|
|
|
+ }
|
|
|
+ if (tempId && (tempId + "") === (wdDialogId + "")) {
|
|
|
+ iframeEl = iframeObj;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e) { }
|
|
|
+ if (!iframeEl) {
|
|
|
+ try { iframeEl = w.getFrame && w.getFrame(); } catch (e) { }
|
|
|
+ }
|
|
|
+ if (!iframeEl) {
|
|
|
+ try { console.log("[SsSubTabMenuMode] fail: no iframeEl"); } catch (e) { }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ var winEl = null;
|
|
|
+ try { winEl = iframeEl.closest && iframeEl.closest("div.dhtmlx_window_active,div.dhtmlx_window_inactive"); } catch (e) { }
|
|
|
+ if (!winEl) {
|
|
|
+ try { console.log("[SsSubTabMenuMode] fail: no winEl"); } catch (e) { }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //功能: 精准获取当前弹窗的按钮 DOM(dhtmlx 会切换 _default/_over_default 等)by xu 20251224
|
|
|
+ var btnEl = null;
|
|
|
+ try { btnEl = winEl.querySelector("div[class*='dhtmlx_button_ssSubTabMenuMode_']"); } catch (e) { }
|
|
|
+ if (!btnEl) {
|
|
|
+ //功能: 仅在使用 SsSubTab 的页面按需创建按钮,避免所有弹窗默认带出 by xu 20251224
|
|
|
+ //功能: icon-base 图标名调整:弹窗顶部菜单模式按钮使用细体 icon-autoTxt / icon-fix by xu 20251224
|
|
|
+ try { w.addUserButton("ssSubTabMenuMode", 3, "菜单模式", "菜单模式", "dialog-toolbar-icon icon-autoTxt"); } catch (e) { }
|
|
|
+ try { wd.display.initStyleWdButtons && wd.display.initStyleWdButtons(); } catch (e) { }
|
|
|
+ try { btnEl = winEl.querySelector("div[class*='dhtmlx_button_ssSubTabMenuMode_']"); } catch (e) { }
|
|
|
+ if (!btnEl) {
|
|
|
+ // 页面可能还没创建完成,交给调用方重试 by xu 20251224
|
|
|
+ try { console.log("[SsSubTabMenuMode] fail: button dom not found"); } catch (e) { }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //功能: 打印调试信息(按钮按需创建成功)by xu 20251224
|
|
|
+ try { console.log("[SsSubTabMenuMode] button created"); } catch (e) { }
|
|
|
+ }
|
|
|
+ var btn = null;
|
|
|
+ try { btn = w.button && w.button("ssSubTabMenuMode"); } catch (e) { }
|
|
|
+
|
|
|
+ //功能: 弹窗右上角切换按钮放到最左边(flex 顺序)by xu 20251223
|
|
|
+ try {
|
|
|
+ var btnContainer = btnEl.parentNode;
|
|
|
+ if (btnContainer && btnContainer.firstElementChild && btnContainer.firstElementChild !== btnEl) {
|
|
|
+ btnContainer.insertBefore(btnEl, btnContainer.firstElementChild);
|
|
|
+ }
|
|
|
+ } catch (e) { }
|
|
|
+
|
|
|
+ //功能: 旧UI弹窗中使用顶部按钮控制 SsSubTab,隐藏组件内置切换按钮 by xu 20251223
|
|
|
+ try { document.documentElement && document.documentElement.classList && document.documentElement.classList.add("ss-sub-tab-dialog"); } catch (e) { }
|
|
|
+
|
|
|
+ // 确保组类存在 by xu 20251223
|
|
|
+ try { btnEl.classList && btnEl.classList.add("dialog-toolbar-icon"); } catch (e) { }
|
|
|
+
|
|
|
+ //功能: 获取 iframeWindow(用于 click 时动态拿 API,避免 enable 时机问题)by xu 20251224
|
|
|
+ var iframeWindow = null;
|
|
|
+ try { iframeWindow = iframeEl && iframeEl.contentWindow; } catch (e) { }
|
|
|
+ if (!iframeWindow) {
|
|
|
+ try { console.log("[SsSubTabMenuMode] fail: no iframeWindow"); } catch (e) { }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //功能: 递归在多层 iframe 中查找 SsSubTab API(objPlay -> objInfo -> ss-sub-tab)by xu 20251224
|
|
|
+ var findSsSubTabCtx = function (win, depth) { //功能 by xu 20251224
|
|
|
+ if (!win) return null;
|
|
|
+ if (depth > 6) return null;
|
|
|
+ try {
|
|
|
+ var api =
|
|
|
+ (win.SS && win.SS.dom && win.SS.dom.ssSubTabApi) ||
|
|
|
+ (win.ss && win.ss.dom && win.ss.dom.ssSubTabApi);
|
|
|
+ var left = win.document && win.document.querySelector && win.document.querySelector(".project-edit-container .left-side");
|
|
|
+ if (api && api.toggleMenuMode && left) {
|
|
|
+ return { win: win, api: api, leftSide: left };
|
|
|
+ }
|
|
|
+ } catch (e) { }
|
|
|
+ try {
|
|
|
+ var ifs = win.document && win.document.getElementsByTagName ? win.document.getElementsByTagName("IFRAME") : [];
|
|
|
+ if (!ifs || !ifs.length) return null;
|
|
|
+ // 限制扫描数量,避免极端页面卡顿 by xu 20251224
|
|
|
+ var maxScan = Math.min(ifs.length, 30);
|
|
|
+ for (var i = 0; i < maxScan; i++) {
|
|
|
+ var cw = null;
|
|
|
+ try { cw = ifs[i].contentWindow; } catch (e) { cw = null; }
|
|
|
+ if (!cw) continue;
|
|
|
+ var r = findSsSubTabCtx(cw, depth + 1);
|
|
|
+ if (r) return r;
|
|
|
+ }
|
|
|
+ } catch (e) { }
|
|
|
+ return null;
|
|
|
+ };
|
|
|
+
|
|
|
+ var updateIcon = function () { //功能 by xu 20251224
|
|
|
+ // dhtmlx hover/active 会切换 class(_default/_over_default 等),这里每次取当前节点 by xu 20251224
|
|
|
+ var currentBtnEl = null;
|
|
|
+ try { currentBtnEl = winEl.querySelector("div[class*='dhtmlx_button_ssSubTabMenuMode_']"); } catch (e) { }
|
|
|
+ if (!currentBtnEl || !currentBtnEl.classList) return;
|
|
|
+ //功能: 优先从 topWindow 的 apiMap 取(解决 objPlay->objInfo 这种多层iframe拿不到 SS 的问题)by xu 20251224
|
|
|
+ var ctx = null;
|
|
|
+ try {
|
|
|
+ var apiFromTop = wd.topWindow && wd.topWindow.__ssSubTabApiMap && wd.topWindow.__ssSubTabApiMap[wdDialogId];
|
|
|
+ if (apiFromTop && apiFromTop.toggleMenuMode) {
|
|
|
+ ctx = { api: apiFromTop, leftSide: null };
|
|
|
+ }
|
|
|
+ } catch (e) { }
|
|
|
+ if (!ctx) {
|
|
|
+ ctx = findSsSubTabCtx(iframeWindow, 0);
|
|
|
+ }
|
|
|
+ var mode = "collapse";
|
|
|
+ try {
|
|
|
+ mode = (ctx && ctx.api && ctx.api.getMenuMode && ctx.api.getMenuMode()) || (ctx && ctx.leftSide && ctx.leftSide.getAttribute("data-mode")) || "collapse";
|
|
|
+ } catch (e) { }
|
|
|
+ currentBtnEl.classList.add("dialog-toolbar-icon");
|
|
|
+ //功能: icon-base 图标名调整:弹窗顶部菜单模式按钮 icon-autoTxt / icon-fix by xu 20251224
|
|
|
+ currentBtnEl.classList.remove("icon-autoTxt", "icon-fix");
|
|
|
+ if (mode === "fixed") {
|
|
|
+ currentBtnEl.classList.add("icon-fix");
|
|
|
+ currentBtnEl.setAttribute("title", "固定菜单");
|
|
|
+ } else {
|
|
|
+ currentBtnEl.classList.add("icon-autoTxt");
|
|
|
+ currentBtnEl.setAttribute("title", "悬浮菜单");
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ //功能: 用事件委托绑定点击(避免 dhtmlx 切换 class/替换节点导致点击失效)by xu 20251224
|
|
|
+ try {
|
|
|
+ var btnsEl = winEl.querySelector("div.dhtmlx_wins_btns");
|
|
|
+ if (btnsEl && btnsEl.getAttribute("data-ss-sub-tab-menu-bound") !== "1") {
|
|
|
+ btnsEl.setAttribute("data-ss-sub-tab-menu-bound", "1");
|
|
|
+ btnsEl.addEventListener("click", function (e) {
|
|
|
+ try {
|
|
|
+ var t = e && e.target;
|
|
|
+ var hit = t && t.closest ? t.closest("div[class*='dhtmlx_button_ssSubTabMenuMode_']") : null;
|
|
|
+ if (!hit) return;
|
|
|
+ //功能: 优先从 topWindow 的 apiMap 取(解决 objPlay->objInfo)by xu 20251224
|
|
|
+ var ctx = null;
|
|
|
+ var ssSubTabApi = null;
|
|
|
+ try {
|
|
|
+ ssSubTabApi = wd.topWindow && wd.topWindow.__ssSubTabApiMap && wd.topWindow.__ssSubTabApiMap[wdDialogId];
|
|
|
+ } catch (ee) { ssSubTabApi = null; }
|
|
|
+ if (ssSubTabApi && ssSubTabApi.toggleMenuMode) {
|
|
|
+ ctx = { api: ssSubTabApi };
|
|
|
+ } else {
|
|
|
+ ctx = findSsSubTabCtx(iframeWindow, 0);
|
|
|
+ ssSubTabApi = ctx && ctx.api;
|
|
|
+ }
|
|
|
+ if (!ssSubTabApi || !ssSubTabApi.toggleMenuMode) {
|
|
|
+ try {
|
|
|
+ console.log(
|
|
|
+ "[SsSubTabMenuMode] click but api not ready",
|
|
|
+ "href=", iframeWindow.location && iframeWindow.location.href,
|
|
|
+ "foundCtx=", !!ctx
|
|
|
+ );
|
|
|
+ } catch (ee) { }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //功能: 打印调试信息(点击事件触发)by xu 20251224
|
|
|
+ try { console.log("[SsSubTabMenuMode] click, before=", ssSubTabApi.getMenuMode && ssSubTabApi.getMenuMode()); } catch (ee) { }
|
|
|
+ try { ssSubTabApi.toggleMenuMode(); } catch (ee) { console.log(ee); }
|
|
|
+ try { console.log("[SsSubTabMenuMode] click, after=", ssSubTabApi.getMenuMode && ssSubTabApi.getMenuMode()); } catch (ee) { }
|
|
|
+ setTimeout(updateIcon, 0);
|
|
|
+ } catch (ee) {
|
|
|
+ console.log(ee);
|
|
|
+ }
|
|
|
+ }, false);
|
|
|
+ }
|
|
|
+ } catch (e) { }
|
|
|
+
|
|
|
+ updateIcon();
|
|
|
+ try { btn && btn.show && btn.show(); } catch (e) { }
|
|
|
+ return true;
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* 将url中的动态参数替换成指定的值
|
|
|
* 如果param为空,则参数的值在html元素中寻找,如果param的值不为空,则在param中获取
|