isdata-customer-sdk 0.2.24 → 0.2.26
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/index.common.js +143 -9
- package/dist/index.common.js.map +1 -1
- package/dist/index.umd.js +143 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +3 -3
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -29563,6 +29563,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29563
29563
|
encrypt: function() { return /* reexport */ encrypt; },
|
|
29564
29564
|
extractFilenameFromUrl: function() { return /* reexport */ extractFilenameFromUrl; },
|
|
29565
29565
|
extractNewItems: function() { return /* reexport */ extractNewItems; },
|
|
29566
|
+
findClosestAncestorByClass: function() { return /* reexport */ findClosestAncestorByClass; },
|
|
29566
29567
|
fireEvent: function() { return /* reexport */ fireEvent; },
|
|
29567
29568
|
getAIRobotInfos: function() { return /* reexport */ getAIRobotInfos; },
|
|
29568
29569
|
getAPPInfosByID: function() { return /* reexport */ getAPPInfosByID; },
|
|
@@ -29612,12 +29613,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29612
29613
|
hasListener: function() { return /* reexport */ hasListener; },
|
|
29613
29614
|
i18n: function() { return /* reexport */ i18n; },
|
|
29614
29615
|
initDomNodeI18NObserver: function() { return /* reexport */ initDomNodeI18NObserver; },
|
|
29616
|
+
initDomNodeViewObserver: function() { return /* reexport */ initDomNodeViewObserver; },
|
|
29615
29617
|
initEventCenter: function() { return /* reexport */ initEventCenter; },
|
|
29616
29618
|
initFrameWindowListener: function() { return /* reexport */ initFrameWindowListener; },
|
|
29617
29619
|
loadi18nTexts: function() { return /* reexport */ loadi18nTexts; },
|
|
29618
29620
|
loginAccount: function() { return /* reexport */ loginAccount; },
|
|
29619
29621
|
logoutAccount: function() { return /* reexport */ logoutAccount; },
|
|
29620
29622
|
processElement: function() { return /* reexport */ processElement; },
|
|
29623
|
+
processViewElement: function() { return /* reexport */ processViewElement; },
|
|
29621
29624
|
queryAndStoreAppVariable: function() { return /* reexport */ queryAndStoreAppVariable; },
|
|
29622
29625
|
queryAppVariable: function() { return /* reexport */ queryAppVariable; },
|
|
29623
29626
|
queryAssetById: function() { return /* reexport */ queryAssetById; },
|
|
@@ -32592,7 +32595,7 @@ const extractFilenameFromUrl = url => {
|
|
|
32592
32595
|
* 提取数组中不在另一个数组中的元素
|
|
32593
32596
|
* @param {*} oldItems 基础比较数组
|
|
32594
32597
|
* @param {*} newItems 被提取检测的数组
|
|
32595
|
-
* @returns
|
|
32598
|
+
* @returns
|
|
32596
32599
|
*/
|
|
32597
32600
|
const extractNewItems = (oldItems, newItems) => {
|
|
32598
32601
|
return oldItems.filter(item => !newItems.includes(item));
|
|
@@ -32607,17 +32610,17 @@ const getFileSize = async url => {
|
|
|
32607
32610
|
try {
|
|
32608
32611
|
// 发送HEAD请求(不下载文件内容)
|
|
32609
32612
|
const response = await fetch(url, {
|
|
32610
|
-
method:
|
|
32613
|
+
method: "GET",
|
|
32611
32614
|
headers: {
|
|
32612
|
-
|
|
32615
|
+
Range: "bytes=0-0"
|
|
32613
32616
|
} // 仅请求第 1 个字节
|
|
32614
32617
|
});
|
|
32615
|
-
if (response.status !== 206) throw new Error(
|
|
32616
|
-
const contentRange = response.headers.get(
|
|
32618
|
+
if (response.status !== 206) throw new Error("不支持 Range 请求");
|
|
32619
|
+
const contentRange = response.headers.get("Content-Range");
|
|
32617
32620
|
const totalSize = contentRange?.match(/\/(\d+)$/)?.[1]; // 解析总大小(如 "bytes 0-0/1000" → 1000)
|
|
32618
32621
|
return totalSize ? parseInt(totalSize, 10) : -1;
|
|
32619
32622
|
} catch (error) {
|
|
32620
|
-
console.error(
|
|
32623
|
+
console.error("获取文件大小失败:", error);
|
|
32621
32624
|
return -1; // 返回-1表示失败
|
|
32622
32625
|
}
|
|
32623
32626
|
};
|
|
@@ -32630,6 +32633,21 @@ const getI18nKey = text => {
|
|
|
32630
32633
|
let key = match[1];
|
|
32631
32634
|
return key;
|
|
32632
32635
|
};
|
|
32636
|
+
|
|
32637
|
+
// 查找最近的具有指定 class 的祖先节点
|
|
32638
|
+
const findClosestAncestorByClass = (element, className) => {
|
|
32639
|
+
let currentElement = element;
|
|
32640
|
+
while (currentElement) {
|
|
32641
|
+
// 检查当前元素是否包含目标 class
|
|
32642
|
+
if (currentElement.classList && currentElement.classList.contains(className)) {
|
|
32643
|
+
return currentElement;
|
|
32644
|
+
}
|
|
32645
|
+
// 向上遍历父节点
|
|
32646
|
+
currentElement = currentElement.parentElement;
|
|
32647
|
+
}
|
|
32648
|
+
// 未找到匹配的祖先节点
|
|
32649
|
+
return null;
|
|
32650
|
+
};
|
|
32633
32651
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
32634
32652
|
var es_iterator_some = __webpack_require__(3579);
|
|
32635
32653
|
;// ./src/api/iframe.js
|
|
@@ -33923,6 +33941,56 @@ const dialog_i18n_check = element => {
|
|
|
33923
33941
|
}
|
|
33924
33942
|
return checkResult;
|
|
33925
33943
|
};
|
|
33944
|
+
;// ./src/api/i18n/commom_view.js
|
|
33945
|
+
const commom_view_check = element => {
|
|
33946
|
+
const checkResult = {
|
|
33947
|
+
result: false
|
|
33948
|
+
};
|
|
33949
|
+
const classes = element.classList;
|
|
33950
|
+
if (!classes) {
|
|
33951
|
+
return checkResult;
|
|
33952
|
+
}
|
|
33953
|
+
// 处理容器节点
|
|
33954
|
+
if (element.tagName === "DIV" && classes.contains("template-block")) {
|
|
33955
|
+
let scriptFunction = (appID, lang) => {
|
|
33956
|
+
let divDom = element.parentNode;
|
|
33957
|
+
let divDom2;
|
|
33958
|
+
let appBlockDom;
|
|
33959
|
+
let comDom;
|
|
33960
|
+
let renderDom;
|
|
33961
|
+
if (divDom && divDom.tagName === "DIV") {
|
|
33962
|
+
divDom2 = divDom.parentNode;
|
|
33963
|
+
if (divDom2 && divDom2.tagName === "DIV") {
|
|
33964
|
+
appBlockDom = divDom2.parentNode;
|
|
33965
|
+
if (appBlockDom && appBlockDom.tagName === "DIV" && appBlockDom.classList.contains("application-block")) {
|
|
33966
|
+
comDom = appBlockDom.parentNode;
|
|
33967
|
+
if (comDom && comDom.tagName === "DIV" && comDom.classList.contains("componentDiv")) {
|
|
33968
|
+
renderDom = comDom.parentNode;
|
|
33969
|
+
if (renderDom && renderDom.tagName === "DIV" && renderDom.classList.contains("render-all-blocks")) {
|
|
33970
|
+
//隐藏整个组件
|
|
33971
|
+
renderDom.style.height = "100%";
|
|
33972
|
+
comDom.style.height = "100%";
|
|
33973
|
+
appBlockDom.style.height = "100%";
|
|
33974
|
+
divDom2.style.height = "100%";
|
|
33975
|
+
divDom.style.height = "100%";
|
|
33976
|
+
element.style.height = "100%";
|
|
33977
|
+
//标记已经处理过
|
|
33978
|
+
element.setAttribute("viewDomID", generateUniqueId());
|
|
33979
|
+
}
|
|
33980
|
+
}
|
|
33981
|
+
}
|
|
33982
|
+
}
|
|
33983
|
+
}
|
|
33984
|
+
};
|
|
33985
|
+
checkResult.result = true;
|
|
33986
|
+
checkResult.scriptFunction = scriptFunction;
|
|
33987
|
+
return checkResult;
|
|
33988
|
+
}
|
|
33989
|
+
return checkResult;
|
|
33990
|
+
};
|
|
33991
|
+
function generateUniqueId() {
|
|
33992
|
+
return `rjview_${Date.now()}`;
|
|
33993
|
+
}
|
|
33926
33994
|
;// ./src/api/i18n/i18n.js
|
|
33927
33995
|
|
|
33928
33996
|
|
|
@@ -33936,6 +34004,7 @@ const dialog_i18n_check = element => {
|
|
|
33936
34004
|
|
|
33937
34005
|
|
|
33938
34006
|
|
|
34007
|
+
|
|
33939
34008
|
const getLanguages = async appID => {
|
|
33940
34009
|
let queryData = {
|
|
33941
34010
|
param: {
|
|
@@ -33990,7 +34059,7 @@ function checkTextFormat(text) {
|
|
|
33990
34059
|
}
|
|
33991
34060
|
return null;
|
|
33992
34061
|
}
|
|
33993
|
-
function
|
|
34062
|
+
function i18n_generateUniqueId() {
|
|
33994
34063
|
window.idCounter = window.idCounter || 0;
|
|
33995
34064
|
return `i18n_${Date.now()}_${window.idCounter++}`;
|
|
33996
34065
|
}
|
|
@@ -34025,7 +34094,7 @@ function processElement(element) {
|
|
|
34025
34094
|
return false;
|
|
34026
34095
|
}
|
|
34027
34096
|
|
|
34028
|
-
//
|
|
34097
|
+
// 如果元素有子元素,递归处理子元素
|
|
34029
34098
|
const hasChildren = hasChildElements(element);
|
|
34030
34099
|
if (hasChildren) {
|
|
34031
34100
|
let children = element.children;
|
|
@@ -34081,7 +34150,7 @@ function processElement(element) {
|
|
|
34081
34150
|
}
|
|
34082
34151
|
let elementId = element.getAttribute("localDomID");
|
|
34083
34152
|
if (!elementId) {
|
|
34084
|
-
elementId =
|
|
34153
|
+
elementId = i18n_generateUniqueId();
|
|
34085
34154
|
} else {
|
|
34086
34155
|
// 已经处理过的元素跳过
|
|
34087
34156
|
return false;
|
|
@@ -34250,6 +34319,71 @@ const initDomNodeI18NObserver = () => {
|
|
|
34250
34319
|
processElement(targetNode);
|
|
34251
34320
|
observer.observe(targetNode, config);
|
|
34252
34321
|
};
|
|
34322
|
+
const initDomNodeViewObserver = () => {
|
|
34323
|
+
// 创建观察器实例
|
|
34324
|
+
const observer = new MutationObserver(mutations => {
|
|
34325
|
+
mutations.forEach(mutation => {
|
|
34326
|
+
if (mutation.type === 'childList') {
|
|
34327
|
+
// 节点添加
|
|
34328
|
+
if (mutation.addedNodes.length > 0) {
|
|
34329
|
+
for (let i = 0; i < mutation.addedNodes.length; i++) {
|
|
34330
|
+
let node = mutation.addedNodes[i];
|
|
34331
|
+
processViewElement(node);
|
|
34332
|
+
}
|
|
34333
|
+
}
|
|
34334
|
+
}
|
|
34335
|
+
});
|
|
34336
|
+
});
|
|
34337
|
+
|
|
34338
|
+
// 配置观察选项
|
|
34339
|
+
const config = {
|
|
34340
|
+
childList: true,
|
|
34341
|
+
// 观察子节点变化
|
|
34342
|
+
subtree: true,
|
|
34343
|
+
// 观察所有后代节点
|
|
34344
|
+
attributes: false,
|
|
34345
|
+
// 不观察属性变化
|
|
34346
|
+
characterData: true,
|
|
34347
|
+
// 不观察文本内容变化
|
|
34348
|
+
characterDataOldValue: true
|
|
34349
|
+
};
|
|
34350
|
+
// 开始观察目标节点
|
|
34351
|
+
const targetNode = document.body;
|
|
34352
|
+
processViewElement(targetNode);
|
|
34353
|
+
observer.observe(targetNode, config);
|
|
34354
|
+
};
|
|
34355
|
+
|
|
34356
|
+
// 处理单个DOM元素的函数
|
|
34357
|
+
function processViewElement(element) {
|
|
34358
|
+
if (!element) {
|
|
34359
|
+
return false;
|
|
34360
|
+
}
|
|
34361
|
+
// 仅处理元素节点
|
|
34362
|
+
if (element && element.nodeType !== Node.ELEMENT_NODE) {
|
|
34363
|
+
return false;
|
|
34364
|
+
}
|
|
34365
|
+
// 如果元素有子元素,则不处理innerHTML
|
|
34366
|
+
const hasChildren = hasChildElements(element);
|
|
34367
|
+
if (hasChildren) {
|
|
34368
|
+
let children = element.children;
|
|
34369
|
+
for (let i = 0; i < children.length; i++) {
|
|
34370
|
+
let child = children[i];
|
|
34371
|
+
processViewElement(child);
|
|
34372
|
+
}
|
|
34373
|
+
}
|
|
34374
|
+
let checkState = element.getAttribute("viewDomID");
|
|
34375
|
+
// 已经处理过的元素跳过
|
|
34376
|
+
if (checkState) {
|
|
34377
|
+
return false;
|
|
34378
|
+
}
|
|
34379
|
+
const viewCheckResult = commom_view_check(element);
|
|
34380
|
+
// 如果没有匹配的内容,则不处理
|
|
34381
|
+
if (!viewCheckResult.result) {
|
|
34382
|
+
return false;
|
|
34383
|
+
}
|
|
34384
|
+
viewCheckResult.scriptFunction();
|
|
34385
|
+
return true;
|
|
34386
|
+
}
|
|
34253
34387
|
;// ./src/main.js
|
|
34254
34388
|
|
|
34255
34389
|
|