isdata-customer-sdk 0.2.25 → 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.
@@ -29613,12 +29613,14 @@ __webpack_require__.d(__webpack_exports__, {
29613
29613
  hasListener: function() { return /* reexport */ hasListener; },
29614
29614
  i18n: function() { return /* reexport */ i18n; },
29615
29615
  initDomNodeI18NObserver: function() { return /* reexport */ initDomNodeI18NObserver; },
29616
+ initDomNodeViewObserver: function() { return /* reexport */ initDomNodeViewObserver; },
29616
29617
  initEventCenter: function() { return /* reexport */ initEventCenter; },
29617
29618
  initFrameWindowListener: function() { return /* reexport */ initFrameWindowListener; },
29618
29619
  loadi18nTexts: function() { return /* reexport */ loadi18nTexts; },
29619
29620
  loginAccount: function() { return /* reexport */ loginAccount; },
29620
29621
  logoutAccount: function() { return /* reexport */ logoutAccount; },
29621
29622
  processElement: function() { return /* reexport */ processElement; },
29623
+ processViewElement: function() { return /* reexport */ processViewElement; },
29622
29624
  queryAndStoreAppVariable: function() { return /* reexport */ queryAndStoreAppVariable; },
29623
29625
  queryAppVariable: function() { return /* reexport */ queryAppVariable; },
29624
29626
  queryAssetById: function() { return /* reexport */ queryAssetById; },
@@ -33939,6 +33941,56 @@ const dialog_i18n_check = element => {
33939
33941
  }
33940
33942
  return checkResult;
33941
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
+ }
33942
33994
  ;// ./src/api/i18n/i18n.js
33943
33995
 
33944
33996
 
@@ -33952,6 +34004,7 @@ const dialog_i18n_check = element => {
33952
34004
 
33953
34005
 
33954
34006
 
34007
+
33955
34008
  const getLanguages = async appID => {
33956
34009
  let queryData = {
33957
34010
  param: {
@@ -34006,7 +34059,7 @@ function checkTextFormat(text) {
34006
34059
  }
34007
34060
  return null;
34008
34061
  }
34009
- function generateUniqueId() {
34062
+ function i18n_generateUniqueId() {
34010
34063
  window.idCounter = window.idCounter || 0;
34011
34064
  return `i18n_${Date.now()}_${window.idCounter++}`;
34012
34065
  }
@@ -34041,7 +34094,7 @@ function processElement(element) {
34041
34094
  return false;
34042
34095
  }
34043
34096
 
34044
- // 如果元素有子元素,则不处理innerHTML
34097
+ // 如果元素有子元素,递归处理子元素
34045
34098
  const hasChildren = hasChildElements(element);
34046
34099
  if (hasChildren) {
34047
34100
  let children = element.children;
@@ -34097,7 +34150,7 @@ function processElement(element) {
34097
34150
  }
34098
34151
  let elementId = element.getAttribute("localDomID");
34099
34152
  if (!elementId) {
34100
- elementId = generateUniqueId();
34153
+ elementId = i18n_generateUniqueId();
34101
34154
  } else {
34102
34155
  // 已经处理过的元素跳过
34103
34156
  return false;
@@ -34266,6 +34319,71 @@ const initDomNodeI18NObserver = () => {
34266
34319
  processElement(targetNode);
34267
34320
  observer.observe(targetNode, config);
34268
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
+ }
34269
34387
  ;// ./src/main.js
34270
34388
 
34271
34389