isdata-customer-sdk 0.1.99 → 0.2.1
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 +140 -130
- package/dist/index.common.js.map +1 -1
- package/dist/index.umd.js +273 -255
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +4 -4
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +2 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
2
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
3
|
+
module.exports = factory(require("vue"));
|
|
4
4
|
else if(typeof define === 'function' && define.amd)
|
|
5
5
|
define([], factory);
|
|
6
6
|
else if(typeof exports === 'object')
|
|
7
|
-
exports["index"] = factory();
|
|
7
|
+
exports["index"] = factory(require("vue"));
|
|
8
8
|
else
|
|
9
|
-
root["index"] = factory();
|
|
10
|
-
})((typeof self !== 'undefined' ? self : this), function() {
|
|
9
|
+
root["index"] = factory(root["Vue"]);
|
|
10
|
+
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__9274__) {
|
|
11
11
|
return /******/ (function() { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
@@ -22358,126 +22358,6 @@ module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
|
22358
22358
|
};
|
|
22359
22359
|
|
|
22360
22360
|
|
|
22361
|
-
/***/ }),
|
|
22362
|
-
|
|
22363
|
-
/***/ 5128:
|
|
22364
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
22365
|
-
|
|
22366
|
-
"use strict";
|
|
22367
|
-
/* unused harmony export EventBus */
|
|
22368
|
-
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4114);
|
|
22369
|
-
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
22370
|
-
/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8111);
|
|
22371
|
-
/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
22372
|
-
/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7588);
|
|
22373
|
-
/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
22374
|
-
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2543);
|
|
22375
|
-
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
class EventBus {
|
|
22381
|
-
/**
|
|
22382
|
-
* @constructor
|
|
22383
|
-
*/
|
|
22384
|
-
constructor() {
|
|
22385
|
-
this.__listeners = {};
|
|
22386
|
-
}
|
|
22387
|
-
|
|
22388
|
-
/**
|
|
22389
|
-
* register a Event
|
|
22390
|
-
* @param id 可选 唯一标识,通常传入config.json中的id字段
|
|
22391
|
-
* @param eventName 事件名
|
|
22392
|
-
* @param callback 事件回调
|
|
22393
|
-
*/
|
|
22394
|
-
register(...args) {
|
|
22395
|
-
let eventName, callback;
|
|
22396
|
-
if (args.length == 3) {
|
|
22397
|
-
eventName = `${args[0]}-${args[1]}`;
|
|
22398
|
-
callback = args[2];
|
|
22399
|
-
} else {
|
|
22400
|
-
eventName = args[0];
|
|
22401
|
-
callback = args[1];
|
|
22402
|
-
}
|
|
22403
|
-
this.__listeners[eventName] = this.__listeners[eventName] || [];
|
|
22404
|
-
this.__listeners[eventName].push({
|
|
22405
|
-
callback
|
|
22406
|
-
});
|
|
22407
|
-
}
|
|
22408
|
-
|
|
22409
|
-
/**
|
|
22410
|
-
* trigger a Event
|
|
22411
|
-
* @param id 可选 唯一标识,通常传入config.json中的id字段
|
|
22412
|
-
* @param eventName 事件名
|
|
22413
|
-
* @param context 事件传递参数
|
|
22414
|
-
*/
|
|
22415
|
-
fireEvent(...args) {
|
|
22416
|
-
let eventName, context;
|
|
22417
|
-
if (args.length == 3) {
|
|
22418
|
-
eventName = `${args[0]}-${args[1]}`;
|
|
22419
|
-
context = args[2];
|
|
22420
|
-
} else {
|
|
22421
|
-
eventName = args[0];
|
|
22422
|
-
context = args[1];
|
|
22423
|
-
}
|
|
22424
|
-
let listeners = this.__listeners[eventName] || [];
|
|
22425
|
-
let result = true;
|
|
22426
|
-
lodash__WEBPACK_IMPORTED_MODULE_3___default().forEach(listeners, l => {
|
|
22427
|
-
let callback = l.callback;
|
|
22428
|
-
let r = callback.call(null, context);
|
|
22429
|
-
if (r === false) {
|
|
22430
|
-
result = false;
|
|
22431
|
-
return false;
|
|
22432
|
-
}
|
|
22433
|
-
});
|
|
22434
|
-
return result;
|
|
22435
|
-
}
|
|
22436
|
-
|
|
22437
|
-
/**
|
|
22438
|
-
* 注销一个事件
|
|
22439
|
-
* @param id 可选 唯一标识,通常传入config.json中的id字段
|
|
22440
|
-
* @param eventName 事件名
|
|
22441
|
-
* @param callback 事件回调
|
|
22442
|
-
*/
|
|
22443
|
-
unregister(...args) {
|
|
22444
|
-
let eventName, callback;
|
|
22445
|
-
if (args.length == 3) {
|
|
22446
|
-
eventName = `${args[0]}-${args[1]}`;
|
|
22447
|
-
callback = args[2];
|
|
22448
|
-
} else {
|
|
22449
|
-
eventName = args[0];
|
|
22450
|
-
callback = args[1];
|
|
22451
|
-
}
|
|
22452
|
-
if (!lodash__WEBPACK_IMPORTED_MODULE_3___default().isString(eventName) || lodash__WEBPACK_IMPORTED_MODULE_3___default().isEmpty(this.__listeners[eventName])) {
|
|
22453
|
-
return;
|
|
22454
|
-
}
|
|
22455
|
-
lodash__WEBPACK_IMPORTED_MODULE_3___default().remove(this.__listeners[eventName], k => {
|
|
22456
|
-
return k.callback === callback || callback === undefined;
|
|
22457
|
-
});
|
|
22458
|
-
}
|
|
22459
|
-
|
|
22460
|
-
/**
|
|
22461
|
-
* 检查是否有事件监听器
|
|
22462
|
-
* @param id 可选 唯一标识,通常传入config.json中的
|
|
22463
|
-
* @param {} eventName
|
|
22464
|
-
* @returns
|
|
22465
|
-
*/
|
|
22466
|
-
hasListener(eventName) {
|
|
22467
|
-
return lodash__WEBPACK_IMPORTED_MODULE_3___default().isString(eventName) && !lodash__WEBPACK_IMPORTED_MODULE_3___default().isEmpty(this.__listeners[eventName]);
|
|
22468
|
-
}
|
|
22469
|
-
|
|
22470
|
-
/**
|
|
22471
|
-
* 清除所有事件
|
|
22472
|
-
*/
|
|
22473
|
-
clearAll() {
|
|
22474
|
-
this.__listeners = {};
|
|
22475
|
-
}
|
|
22476
|
-
}
|
|
22477
|
-
const eventBus = new EventBus();
|
|
22478
|
-
|
|
22479
|
-
/* harmony default export */ __webpack_exports__.A = (eventBus);
|
|
22480
|
-
|
|
22481
22361
|
/***/ }),
|
|
22482
22362
|
|
|
22483
22363
|
/***/ 5155:
|
|
@@ -28549,6 +28429,134 @@ module.exports = function isAbsoluteURL(url) {
|
|
|
28549
28429
|
};
|
|
28550
28430
|
|
|
28551
28431
|
|
|
28432
|
+
/***/ }),
|
|
28433
|
+
|
|
28434
|
+
/***/ 9218:
|
|
28435
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
28436
|
+
|
|
28437
|
+
"use strict";
|
|
28438
|
+
/* unused harmony export EventBus */
|
|
28439
|
+
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4114);
|
|
28440
|
+
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
28441
|
+
/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8111);
|
|
28442
|
+
/* harmony import */ var core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
28443
|
+
/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7588);
|
|
28444
|
+
/* harmony import */ var core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
28445
|
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2543);
|
|
28446
|
+
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
|
|
28447
|
+
|
|
28448
|
+
|
|
28449
|
+
|
|
28450
|
+
|
|
28451
|
+
class EventBus {
|
|
28452
|
+
/**
|
|
28453
|
+
* @constructor
|
|
28454
|
+
*/
|
|
28455
|
+
constructor() {
|
|
28456
|
+
this.__listeners = {};
|
|
28457
|
+
}
|
|
28458
|
+
|
|
28459
|
+
/**
|
|
28460
|
+
* register a Event
|
|
28461
|
+
* @param id 可选 唯一标识,通常传入config.json中的id字段
|
|
28462
|
+
* @param eventName 事件名
|
|
28463
|
+
* @param callback 事件回调
|
|
28464
|
+
*/
|
|
28465
|
+
register(...args) {
|
|
28466
|
+
let eventName, callback;
|
|
28467
|
+
if (args.length == 3) {
|
|
28468
|
+
eventName = `${args[0]}-${args[1]}`;
|
|
28469
|
+
callback = args[2];
|
|
28470
|
+
} else {
|
|
28471
|
+
eventName = args[0];
|
|
28472
|
+
callback = args[1];
|
|
28473
|
+
}
|
|
28474
|
+
this.__listeners[eventName] = this.__listeners[eventName] || [];
|
|
28475
|
+
this.__listeners[eventName].push({
|
|
28476
|
+
callback
|
|
28477
|
+
});
|
|
28478
|
+
}
|
|
28479
|
+
|
|
28480
|
+
/**
|
|
28481
|
+
* trigger a Event
|
|
28482
|
+
* @param id 可选 唯一标识,通常传入config.json中的id字段
|
|
28483
|
+
* @param eventName 事件名
|
|
28484
|
+
* @param context 事件传递参数
|
|
28485
|
+
*/
|
|
28486
|
+
fireEvent(...args) {
|
|
28487
|
+
let eventName, context;
|
|
28488
|
+
if (args.length == 3) {
|
|
28489
|
+
eventName = `${args[0]}-${args[1]}`;
|
|
28490
|
+
context = args[2];
|
|
28491
|
+
} else {
|
|
28492
|
+
eventName = args[0];
|
|
28493
|
+
context = args[1];
|
|
28494
|
+
}
|
|
28495
|
+
let listeners = this.__listeners[eventName] || [];
|
|
28496
|
+
let result = true;
|
|
28497
|
+
lodash__WEBPACK_IMPORTED_MODULE_3___default().forEach(listeners, l => {
|
|
28498
|
+
let callback = l.callback;
|
|
28499
|
+
let r = callback.call(null, context);
|
|
28500
|
+
if (r === false) {
|
|
28501
|
+
result = false;
|
|
28502
|
+
return false;
|
|
28503
|
+
}
|
|
28504
|
+
});
|
|
28505
|
+
return result;
|
|
28506
|
+
}
|
|
28507
|
+
|
|
28508
|
+
/**
|
|
28509
|
+
* 注销一个事件
|
|
28510
|
+
* @param id 可选 唯一标识,通常传入config.json中的id字段
|
|
28511
|
+
* @param eventName 事件名
|
|
28512
|
+
* @param callback 事件回调
|
|
28513
|
+
*/
|
|
28514
|
+
unregister(...args) {
|
|
28515
|
+
let eventName, callback;
|
|
28516
|
+
if (args.length == 3) {
|
|
28517
|
+
eventName = `${args[0]}-${args[1]}`;
|
|
28518
|
+
callback = args[2];
|
|
28519
|
+
} else {
|
|
28520
|
+
eventName = args[0];
|
|
28521
|
+
callback = args[1];
|
|
28522
|
+
}
|
|
28523
|
+
if (!lodash__WEBPACK_IMPORTED_MODULE_3___default().isString(eventName) || lodash__WEBPACK_IMPORTED_MODULE_3___default().isEmpty(this.__listeners[eventName])) {
|
|
28524
|
+
return;
|
|
28525
|
+
}
|
|
28526
|
+
lodash__WEBPACK_IMPORTED_MODULE_3___default().remove(this.__listeners[eventName], k => {
|
|
28527
|
+
return k.callback === callback || callback === undefined;
|
|
28528
|
+
});
|
|
28529
|
+
}
|
|
28530
|
+
|
|
28531
|
+
/**
|
|
28532
|
+
* 检查是否有事件监听器
|
|
28533
|
+
* @param id 可选 唯一标识,通常传入config.json中的
|
|
28534
|
+
* @param {} eventName
|
|
28535
|
+
* @returns
|
|
28536
|
+
*/
|
|
28537
|
+
hasListener(eventName) {
|
|
28538
|
+
return lodash__WEBPACK_IMPORTED_MODULE_3___default().isString(eventName) && !lodash__WEBPACK_IMPORTED_MODULE_3___default().isEmpty(this.__listeners[eventName]);
|
|
28539
|
+
}
|
|
28540
|
+
|
|
28541
|
+
/**
|
|
28542
|
+
* 清除所有事件
|
|
28543
|
+
*/
|
|
28544
|
+
clearAll() {
|
|
28545
|
+
this.__listeners = {};
|
|
28546
|
+
}
|
|
28547
|
+
}
|
|
28548
|
+
const eventBus = new EventBus();
|
|
28549
|
+
|
|
28550
|
+
/* harmony default export */ __webpack_exports__.A = (eventBus);
|
|
28551
|
+
|
|
28552
|
+
/***/ }),
|
|
28553
|
+
|
|
28554
|
+
/***/ 9274:
|
|
28555
|
+
/***/ (function(module) {
|
|
28556
|
+
|
|
28557
|
+
"use strict";
|
|
28558
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__9274__;
|
|
28559
|
+
|
|
28552
28560
|
/***/ }),
|
|
28553
28561
|
|
|
28554
28562
|
/***/ 9297:
|
|
@@ -29684,7 +29692,7 @@ const registerEventListener = (eventName, actionFun) => {
|
|
|
29684
29692
|
const initEventCenter = () => {
|
|
29685
29693
|
if (!window.rjEventCenter) {
|
|
29686
29694
|
console.log(`初始化事件中心:时间戳: ${new Date().toLocaleString()}`);
|
|
29687
|
-
let eventBus = (__webpack_require__(
|
|
29695
|
+
let eventBus = (__webpack_require__(9218)/* ["default"] */ .A);
|
|
29688
29696
|
window.rjEventCenter = eventBus;
|
|
29689
29697
|
} else {
|
|
29690
29698
|
console.log(`事件中心已经初始化,不需要重新初始化:时间戳: ${new Date().toLocaleString()}`);
|
|
@@ -33097,7 +33105,9 @@ const dify_extractFilenameFromUrl = url => {
|
|
|
33097
33105
|
return "downloaded_file"; // URL 解析失败时的默认文件名
|
|
33098
33106
|
}
|
|
33099
33107
|
};
|
|
33100
|
-
|
|
33108
|
+
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
|
33109
|
+
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(9274);
|
|
33110
|
+
;// ./src/api/i18n/smardaten_i18n/table_i18n.js
|
|
33101
33111
|
|
|
33102
33112
|
const check = element => {
|
|
33103
33113
|
const checkResult = {
|
|
@@ -33168,7 +33178,7 @@ const check = element => {
|
|
|
33168
33178
|
}
|
|
33169
33179
|
};
|
|
33170
33180
|
let tempHTMLMatch = {
|
|
33171
|
-
|
|
33181
|
+
isScriptAction: true,
|
|
33172
33182
|
scriptFunction: scriptFunction
|
|
33173
33183
|
};
|
|
33174
33184
|
checkResult.result = true;
|
|
@@ -33217,7 +33227,7 @@ const check = element => {
|
|
|
33217
33227
|
}
|
|
33218
33228
|
};
|
|
33219
33229
|
let tempHTMLMatch = {
|
|
33220
|
-
|
|
33230
|
+
isScriptAction: true,
|
|
33221
33231
|
scriptFunction: scriptFunction
|
|
33222
33232
|
};
|
|
33223
33233
|
checkResult.result = true;
|
|
@@ -33285,7 +33295,7 @@ const check = element => {
|
|
|
33285
33295
|
}
|
|
33286
33296
|
return checkResult;
|
|
33287
33297
|
};
|
|
33288
|
-
;// ./src/api/smardaten_i18n/catalog_i18n.js
|
|
33298
|
+
;// ./src/api/i18n/smardaten_i18n/catalog_i18n.js
|
|
33289
33299
|
|
|
33290
33300
|
const catalog_i18n_check = element => {
|
|
33291
33301
|
const checkResult = {
|
|
@@ -33319,7 +33329,49 @@ const catalog_i18n_check = element => {
|
|
|
33319
33329
|
};
|
|
33320
33330
|
let tempHTMLMatch = {
|
|
33321
33331
|
oldValue: oldValue,
|
|
33322
|
-
|
|
33332
|
+
isScriptAction: true,
|
|
33333
|
+
scriptFunction: scriptFunction
|
|
33334
|
+
};
|
|
33335
|
+
checkResult.result = true;
|
|
33336
|
+
checkResult.innerHTMLMatch = tempHTMLMatch;
|
|
33337
|
+
return checkResult;
|
|
33338
|
+
}
|
|
33339
|
+
return checkResult;
|
|
33340
|
+
};
|
|
33341
|
+
;// ./src/api/i18n/commom_i18n/common_i18n.js
|
|
33342
|
+
|
|
33343
|
+
const common_i18n_check = element => {
|
|
33344
|
+
const checkResult = {
|
|
33345
|
+
result: false,
|
|
33346
|
+
innerHTMLMatch: null
|
|
33347
|
+
};
|
|
33348
|
+
// 检查目录列表 名称 列
|
|
33349
|
+
if (element.tagName === 'BUTTON') {
|
|
33350
|
+
let innerHTML = element.innerHTML;
|
|
33351
|
+
let oldValue = innerHTML;
|
|
33352
|
+
console.log("检查 button 元素:", innerHTML);
|
|
33353
|
+
let scriptFunction = (appID, lang) => {
|
|
33354
|
+
for (let i = 0; i < element.childNodes.length; i++) {
|
|
33355
|
+
let scriptNodeItem = element.childNodes[i];
|
|
33356
|
+
if (scriptNodeItem.nodeType === Node.TEXT_NODE) {
|
|
33357
|
+
let text = element.getAttribute("oldValue");
|
|
33358
|
+
let isTextMatch = checkTextFormat(text);
|
|
33359
|
+
if (!isTextMatch) {
|
|
33360
|
+
element.appendChild(scriptNodeItem);
|
|
33361
|
+
} else {
|
|
33362
|
+
element.removeChild(scriptNodeItem);
|
|
33363
|
+
let key = isTextMatch.key;
|
|
33364
|
+
let textNode = document.createTextNode(i18n(key, appID, lang) || key);
|
|
33365
|
+
element.appendChild(textNode);
|
|
33366
|
+
}
|
|
33367
|
+
} else {
|
|
33368
|
+
element.appendChild(scriptNodeItem);
|
|
33369
|
+
}
|
|
33370
|
+
}
|
|
33371
|
+
};
|
|
33372
|
+
let tempHTMLMatch = {
|
|
33373
|
+
oldValue: oldValue,
|
|
33374
|
+
isScriptAction: true,
|
|
33323
33375
|
scriptFunction: scriptFunction
|
|
33324
33376
|
};
|
|
33325
33377
|
checkResult.result = true;
|
|
@@ -33328,7 +33380,52 @@ const catalog_i18n_check = element => {
|
|
|
33328
33380
|
}
|
|
33329
33381
|
return checkResult;
|
|
33330
33382
|
};
|
|
33331
|
-
;// ./src/api/i18n.js
|
|
33383
|
+
;// ./src/api/i18n/commom_i18n/attribute_i18n.js
|
|
33384
|
+
|
|
33385
|
+
const attribute_i18n_check = element => {
|
|
33386
|
+
const checkResult = {
|
|
33387
|
+
result: false,
|
|
33388
|
+
innerHTMLMatch: null
|
|
33389
|
+
};
|
|
33390
|
+
const checkAttributes = ["placeholder", "title"];
|
|
33391
|
+
for (let i = 0; i < checkAttributes.length; i++) {
|
|
33392
|
+
let attr = checkAttributes[i];
|
|
33393
|
+
let attrValue = element.getAttribute(attr) || element[attr];
|
|
33394
|
+
const attrMatch = attrValue ? checkTextFormat(attrValue) : null;
|
|
33395
|
+
if (attrMatch) {
|
|
33396
|
+
console.log("检查元素属性 i18n 元素:", attr, attrValue);
|
|
33397
|
+
element.setAttribute(`old${attr}Value`, attrValue);
|
|
33398
|
+
checkResult.result = true;
|
|
33399
|
+
}
|
|
33400
|
+
}
|
|
33401
|
+
let scriptFunction = (appID, lang) => {
|
|
33402
|
+
for (let i = 0; i < checkAttributes.length; i++) {
|
|
33403
|
+
let attr = checkAttributes[i];
|
|
33404
|
+
const oldAttrValue = element.getAttribute(`old${attr}Value`);
|
|
33405
|
+
if (oldAttrValue) {
|
|
33406
|
+
// 创建正则表达式匹配所有 $L{...} 格式
|
|
33407
|
+
const regex = /\$L\{([^}]+)\}/g;
|
|
33408
|
+
// 替换所有 $L{...} 占位符为翻译文本
|
|
33409
|
+
let newAttrValue = oldAttrValue;
|
|
33410
|
+
let match;
|
|
33411
|
+
while ((match = regex.exec(oldAttrValue)) !== null) {
|
|
33412
|
+
const fullMatch = match[0];
|
|
33413
|
+
const attrKey = match[1];
|
|
33414
|
+
const translation = i18n(attrKey, appID, lang);
|
|
33415
|
+
newAttrValue = newAttrValue.replace(fullMatch, translation);
|
|
33416
|
+
}
|
|
33417
|
+
// 更新元素的placeholder属性
|
|
33418
|
+
element.setAttribute(attr, newAttrValue);
|
|
33419
|
+
}
|
|
33420
|
+
}
|
|
33421
|
+
};
|
|
33422
|
+
checkResult.scriptFunction = scriptFunction;
|
|
33423
|
+
return checkResult;
|
|
33424
|
+
};
|
|
33425
|
+
;// ./src/api/i18n/i18n.js
|
|
33426
|
+
|
|
33427
|
+
|
|
33428
|
+
|
|
33332
33429
|
|
|
33333
33430
|
|
|
33334
33431
|
|
|
@@ -33400,41 +33497,20 @@ function generateUniqueId() {
|
|
|
33400
33497
|
* @param {*} element
|
|
33401
33498
|
* @returns
|
|
33402
33499
|
*/
|
|
33403
|
-
function
|
|
33404
|
-
const
|
|
33500
|
+
function checkPlatformElementContent(element) {
|
|
33501
|
+
const checkContentResult = {
|
|
33405
33502
|
result: false,
|
|
33406
33503
|
innerHTMLMatch: null
|
|
33407
33504
|
};
|
|
33408
|
-
let checkArr = [check, catalog_i18n_check];
|
|
33505
|
+
let checkArr = [check, catalog_i18n_check, common_i18n_check];
|
|
33409
33506
|
for (let i = 0; i < checkArr.length; i++) {
|
|
33410
33507
|
let checkFunc = checkArr[i];
|
|
33411
|
-
let
|
|
33412
|
-
if (
|
|
33413
|
-
return
|
|
33414
|
-
}
|
|
33415
|
-
}
|
|
33416
|
-
return checkResult;
|
|
33417
|
-
}
|
|
33418
|
-
function checkParantNodeNeedFiller(element) {
|
|
33419
|
-
const filterTags = ["BUTTON"];
|
|
33420
|
-
for (let tag of filterTags) {
|
|
33421
|
-
if (element.tagName === tag) {
|
|
33422
|
-
return false;
|
|
33423
|
-
}
|
|
33424
|
-
}
|
|
33425
|
-
//当为目录列表时catalog_name_content
|
|
33426
|
-
//当为表格单元格时ant-table-cell
|
|
33427
|
-
//当为分页总数时total_pag_num
|
|
33428
|
-
//当为分页每页条数选择时ant-pagination-options-quick-jumper
|
|
33429
|
-
//当为分页下拉选择时ant-select-selection-item
|
|
33430
|
-
//当为分页下拉选项时ant-select-item-option-content
|
|
33431
|
-
const classes = ["catalog_name_content", "ant-table-cell", "total_pag_num", "ant-pagination-options-quick-jumper", "ant-select-selection-item", "ant-select-item-option-content", "catalog_name_content", "catalog_tree_node"];
|
|
33432
|
-
for (let cls of classes) {
|
|
33433
|
-
if (element.classList.contains(cls)) {
|
|
33434
|
-
return false;
|
|
33508
|
+
let checkContentResult = checkFunc(element);
|
|
33509
|
+
if (checkContentResult.result) {
|
|
33510
|
+
return checkContentResult;
|
|
33435
33511
|
}
|
|
33436
33512
|
}
|
|
33437
|
-
return
|
|
33513
|
+
return checkContentResult;
|
|
33438
33514
|
}
|
|
33439
33515
|
|
|
33440
33516
|
// 处理DOM元素的函数
|
|
@@ -33449,33 +33525,32 @@ function processElement(element) {
|
|
|
33449
33525
|
for (let i = 0; i < children.length; i++) {
|
|
33450
33526
|
processElement(children[i]);
|
|
33451
33527
|
}
|
|
33452
|
-
|
|
33453
|
-
// 检查父亲性质节点是否需要被过滤
|
|
33454
|
-
const isParentNodeNeedFilter = checkParantNodeNeedFiller(element);
|
|
33455
|
-
if (isParentNodeNeedFilter) {
|
|
33456
|
-
return false;
|
|
33457
|
-
}
|
|
33458
33528
|
}
|
|
33459
|
-
// element.setAttribute("i18nProcessed", "true"); // 标记元素已被处理
|
|
33460
|
-
// 检查placeholder是否匹配
|
|
33461
|
-
const placeholder = element.getAttribute("placeholder") || element.placeholder;
|
|
33462
|
-
const placeholderMatch = placeholder ? checkTextFormat(placeholder) : null;
|
|
33463
|
-
const title = element.getAttribute("title") || element.title;
|
|
33464
|
-
const titleMatch = title ? checkTextFormat(title) : null;
|
|
33465
33529
|
|
|
33466
33530
|
// 检查innerHTML是否匹配(仅对没有子元素的元素)
|
|
33467
33531
|
let innerHTMLMatch = null;
|
|
33468
|
-
const
|
|
33469
|
-
|
|
33532
|
+
const attrCheckResult = attribute_i18n_check(element);
|
|
33533
|
+
if (attrCheckResult.result) {
|
|
33534
|
+
console.log("检查到属性匹配元素:", element);
|
|
33535
|
+
}
|
|
33470
33536
|
|
|
33471
33537
|
//检查是否是smardaten平台元素
|
|
33472
|
-
const
|
|
33473
|
-
if (
|
|
33474
|
-
innerHTMLMatch =
|
|
33538
|
+
const checkContentResult = checkPlatformElementContent(element);
|
|
33539
|
+
if (checkContentResult.result) {
|
|
33540
|
+
innerHTMLMatch = checkContentResult.innerHTMLMatch;
|
|
33541
|
+
element.setAttribute("oldValue", innerHTMLMatch.oldValue);
|
|
33542
|
+
} else {
|
|
33543
|
+
if (!hasChildren) {
|
|
33544
|
+
const innerHTML = element.innerHTML;
|
|
33545
|
+
innerHTMLMatch = checkTextFormat(innerHTML);
|
|
33546
|
+
if (innerHTMLMatch) {
|
|
33547
|
+
element.setAttribute("oldValue", element.innerHTML);
|
|
33548
|
+
}
|
|
33549
|
+
}
|
|
33475
33550
|
}
|
|
33476
33551
|
|
|
33477
33552
|
// 如果没有匹配的内容,则不处理
|
|
33478
|
-
if (!
|
|
33553
|
+
if (!innerHTMLMatch && !checkContentResult.result && !attrCheckResult.result) {
|
|
33479
33554
|
return false;
|
|
33480
33555
|
}
|
|
33481
33556
|
let elementId = element.getAttribute("localDomID");
|
|
@@ -33484,36 +33559,14 @@ function processElement(element) {
|
|
|
33484
33559
|
}
|
|
33485
33560
|
element.setAttribute("localDomID", elementId);
|
|
33486
33561
|
|
|
33487
|
-
// console.log("处理元素:", element, {
|
|
33488
|
-
// placeholderMatch,
|
|
33489
|
-
// valueMatch,
|
|
33490
|
-
// innerHTMLMatch,
|
|
33491
|
-
// });
|
|
33492
|
-
// 处理placeholder
|
|
33493
|
-
if (placeholderMatch) {
|
|
33494
|
-
element.setAttribute("oldPlaceholderValue", placeholder);
|
|
33495
|
-
}
|
|
33496
|
-
if (titleMatch) {
|
|
33497
|
-
element.setAttribute("oldTitleValue", title);
|
|
33498
|
-
}
|
|
33499
|
-
|
|
33500
|
-
// 处理innerHTML(仅对没有子元素的元素)
|
|
33501
|
-
if (!hasChildren && innerHTMLMatch) {
|
|
33502
|
-
element.setAttribute("oldValue", element.innerHTML);
|
|
33503
|
-
}
|
|
33504
|
-
if (checkResult.result) {
|
|
33505
|
-
element.setAttribute("oldValue", innerHTMLMatch.oldValue);
|
|
33506
|
-
}
|
|
33507
|
-
|
|
33508
33562
|
// 添加到Map缓存
|
|
33509
33563
|
window.i18nElementsMap.set(elementId, {
|
|
33510
33564
|
dom: element,
|
|
33511
33565
|
id: elementId,
|
|
33512
|
-
|
|
33513
|
-
|
|
33514
|
-
|
|
33515
|
-
|
|
33516
|
-
scriptFunction: innerHTMLMatch ? innerHTMLMatch.scriptFunction || null : null
|
|
33566
|
+
isScriptAction: innerHTMLMatch ? innerHTMLMatch.isScriptAction || false : false,
|
|
33567
|
+
scriptFunction: innerHTMLMatch ? innerHTMLMatch.scriptFunction || null : null,
|
|
33568
|
+
isAttibuteAction: attrCheckResult.result,
|
|
33569
|
+
attrFunction: attrCheckResult.scriptFunction || null
|
|
33517
33570
|
});
|
|
33518
33571
|
applyTranslation(element);
|
|
33519
33572
|
return true;
|
|
@@ -33547,66 +33600,31 @@ const applyTranslation = async element => {
|
|
|
33547
33600
|
const elementId = element.getAttribute("localDomID");
|
|
33548
33601
|
const cachedItem = window.i18nElementsMap.get(elementId);
|
|
33549
33602
|
if (!cachedItem) return;
|
|
33550
|
-
//
|
|
33551
|
-
if (cachedItem.
|
|
33552
|
-
|
|
33553
|
-
|
|
33603
|
+
// 处理属性
|
|
33604
|
+
if (cachedItem.isAttibuteAction) {
|
|
33605
|
+
cachedItem.attrFunction(appID, lang);
|
|
33606
|
+
}
|
|
33607
|
+
// 处理innerHTML
|
|
33608
|
+
if (cachedItem.isScriptAction) {
|
|
33609
|
+
cachedItem.scriptFunction(appID, lang);
|
|
33610
|
+
} else {
|
|
33611
|
+
const oldValue = element.getAttribute("oldValue");
|
|
33612
|
+
if (oldValue) {
|
|
33554
33613
|
// 创建正则表达式匹配所有 $L{...} 格式
|
|
33555
33614
|
const regex = /\$L\{([^}]+)\}/g;
|
|
33556
33615
|
// 替换所有 $L{...} 占位符为翻译文本
|
|
33557
|
-
let
|
|
33616
|
+
let newValue = oldValue;
|
|
33558
33617
|
let match;
|
|
33559
|
-
while ((match = regex.exec(
|
|
33618
|
+
while ((match = regex.exec(oldValue)) !== null) {
|
|
33560
33619
|
const fullMatch = match[0];
|
|
33561
33620
|
const placeholderKey = match[1];
|
|
33562
33621
|
const translation = i18n(placeholderKey, appID, lang);
|
|
33563
|
-
|
|
33564
|
-
}
|
|
33565
|
-
// 更新元素的placeholder属性
|
|
33566
|
-
element.setAttribute("placeholder", newPlaceholderValue);
|
|
33567
|
-
}
|
|
33568
|
-
}
|
|
33569
|
-
if (cachedItem.oldTitleValue) {
|
|
33570
|
-
const oldTitleValue = element.getAttribute("oldTitleValue");
|
|
33571
|
-
if (oldTitleValue) {
|
|
33572
|
-
// 创建正则表达式匹配所有 $L{...} 格式
|
|
33573
|
-
const regex = /\$L\{([^}]+)\}/g;
|
|
33574
|
-
// 替换所有 $L{...} 占位符为翻译文本
|
|
33575
|
-
let newTitleValue = oldTitleValue;
|
|
33576
|
-
let match;
|
|
33577
|
-
while ((match = regex.exec(oldTitleValue)) !== null) {
|
|
33578
|
-
const fullMatch = match[0];
|
|
33579
|
-
const titleKey = match[1];
|
|
33580
|
-
const translation = i18n(titleKey, appID, lang);
|
|
33581
|
-
newTitleValue = newTitleValue.replace(fullMatch, translation);
|
|
33582
|
-
// 更新元素的title属性
|
|
33583
|
-
element.setAttribute("title", newTitleValue);
|
|
33584
|
-
}
|
|
33585
|
-
}
|
|
33586
|
-
}
|
|
33587
|
-
// console.log("更新innerHTML翻译:", element);
|
|
33588
|
-
if (cachedItem.isScriptOldValue) {
|
|
33589
|
-
cachedItem.scriptFunction(appID, lang);
|
|
33590
|
-
} else {
|
|
33591
|
-
if (cachedItem.oldValue) {
|
|
33592
|
-
const oldValue = element.getAttribute("oldValue");
|
|
33593
|
-
if (oldValue) {
|
|
33594
|
-
// 创建正则表达式匹配所有 $L{...} 格式
|
|
33595
|
-
const regex = /\$L\{([^}]+)\}/g;
|
|
33596
|
-
// 替换所有 $L{...} 占位符为翻译文本
|
|
33597
|
-
let newValue = oldValue;
|
|
33598
|
-
let match;
|
|
33599
|
-
while ((match = regex.exec(oldValue)) !== null) {
|
|
33600
|
-
const fullMatch = match[0];
|
|
33601
|
-
const placeholderKey = match[1];
|
|
33602
|
-
const translation = i18n(placeholderKey, appID, lang);
|
|
33603
|
-
newValue = newValue.replace(fullMatch, translation);
|
|
33604
|
-
}
|
|
33605
|
-
nextTick(() => {
|
|
33606
|
-
// 更新元素的innerHTML
|
|
33607
|
-
element.innerHTML = newValue;
|
|
33608
|
-
});
|
|
33622
|
+
newValue = newValue.replace(fullMatch, translation);
|
|
33609
33623
|
}
|
|
33624
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
33625
|
+
// 更新元素的innerHTML
|
|
33626
|
+
element.innerHTML = newValue;
|
|
33627
|
+
});
|
|
33610
33628
|
}
|
|
33611
33629
|
}
|
|
33612
33630
|
};
|