@bytenew/bn-applet-ui 1.1.68 → 1.1.70
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.
|
@@ -12009,6 +12009,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
12009
12009
|
insertText: () => (/* reexport */ insertText),
|
|
12010
12010
|
mainAppRouterPush: () => (/* reexport */ mainAppRouterPush),
|
|
12011
12011
|
recordApiLog: () => (/* reexport */ recordApiLog),
|
|
12012
|
+
rewriteAttachmentUrls: () => (/* reexport */ rewriteAttachmentUrls),
|
|
12012
12013
|
searchValueToJson: () => (/* reexport */ searchValueToJson),
|
|
12013
12014
|
tidyComponents: () => (/* reexport */ tidyComponents),
|
|
12014
12015
|
tidyJumpSearchData: () => (/* reexport */ tidyJumpSearchData),
|
|
@@ -29657,6 +29658,51 @@ function addressParse(address, sourceData) {
|
|
|
29657
29658
|
var cleanAddress = preprocessAddress(address);
|
|
29658
29659
|
return parseAddressDetail(cleanAddress, sourceData || {}, address);
|
|
29659
29660
|
}
|
|
29661
|
+
;// ../../packages/utils/rewriteAttachmentUrl.js
|
|
29662
|
+
|
|
29663
|
+
|
|
29664
|
+
|
|
29665
|
+
|
|
29666
|
+
|
|
29667
|
+
|
|
29668
|
+
|
|
29669
|
+
|
|
29670
|
+
|
|
29671
|
+
|
|
29672
|
+
|
|
29673
|
+
|
|
29674
|
+
// 匹配任意域名的 stream 绝对地址, 捕获组1 = 去域名后的路径
|
|
29675
|
+
var STREAM_URL_RE = /https?:\/\/[^/"']+?(\/v2\/attachment\/stream\/[A-Za-z0-9._-]+)/g;
|
|
29676
|
+
|
|
29677
|
+
/**
|
|
29678
|
+
* 开发环境: 把接口数据中的附件流式地址改写为本地代理路径
|
|
29679
|
+
* 生产环境: 原样返回
|
|
29680
|
+
*/
|
|
29681
|
+
var DEV_PROXY_PREFIX = '/proxyWay';
|
|
29682
|
+
function rewriteStreamUrls(data) {
|
|
29683
|
+
if (data == null) return data;
|
|
29684
|
+
// 全文序列化替换: 附件 url 可能散落在任意层级的字段里, 逐字段遍历不可靠, 全文替换最稳
|
|
29685
|
+
var raw = typeof data === 'string' ? data : JSON.stringify(data);
|
|
29686
|
+
var rewritten = raw.replace(STREAM_URL_RE, "".concat(DEV_PROXY_PREFIX, "$1"));
|
|
29687
|
+
return typeof data === 'string' ? rewritten : JSON.parse(rewritten);
|
|
29688
|
+
}
|
|
29689
|
+
var warned = false;
|
|
29690
|
+
|
|
29691
|
+
/**
|
|
29692
|
+
* 把接口数据中的附件流式地址改写为本地代理路径
|
|
29693
|
+
* @param {*} data 接口数据, 支持字符串或对象, 返回同类型结果
|
|
29694
|
+
* @param {String} env 当前环境, 由调用方传入 process.env?.NODE_ENV, 不传则不启用改写
|
|
29695
|
+
*/
|
|
29696
|
+
function rewriteAttachmentUrls(data, env) {
|
|
29697
|
+
if (env !== 'development') {
|
|
29698
|
+
if (!warned && env === undefined) {
|
|
29699
|
+
warned = true;
|
|
29700
|
+
console.warn('[bn] rewriteAttachmentUrls 未传入环境参数, 不会启用附件地址改写');
|
|
29701
|
+
}
|
|
29702
|
+
return data;
|
|
29703
|
+
}
|
|
29704
|
+
return rewriteStreamUrls(data);
|
|
29705
|
+
}
|
|
29660
29706
|
;// ../../packages/utils/index.js
|
|
29661
29707
|
|
|
29662
29708
|
|
|
@@ -31475,6 +31521,11 @@ var bnTableWrapBind = {
|
|
|
31475
31521
|
* 地址自动识别
|
|
31476
31522
|
* */
|
|
31477
31523
|
|
|
31524
|
+
|
|
31525
|
+
/**
|
|
31526
|
+
* 附件流式地址改写(仅开发环境生效)
|
|
31527
|
+
* */
|
|
31528
|
+
|
|
31478
31529
|
;// ./install.js
|
|
31479
31530
|
// install.js - BnAppletUi 组件库入口
|
|
31480
31531
|
|
|
@@ -31538,6 +31589,7 @@ const BnAppletUi = {
|
|
|
31538
31589
|
addressParse: addressParse,
|
|
31539
31590
|
bnTableBind: bnTableBind,
|
|
31540
31591
|
bnTableWrapBind: bnTableWrapBind,
|
|
31592
|
+
rewriteAttachmentUrls: rewriteAttachmentUrls,
|
|
31541
31593
|
};
|
|
31542
31594
|
|
|
31543
31595
|
// 支持通过 CDN 方式引入时自动注册
|