@ -1,9 +1,21 @@
import { each , isFunction , isNull , isObject , isPlainObject , keys , leftPad , parseDateTime , values , isArray } from "../2.base" ;
import {
each ,
get ,
isFunction ,
isNull ,
isObject ,
isPlainObject ,
keys ,
leftPad ,
parseDateTime ,
values ,
isArray
} from "../2.base" ;
import { replaceAll } from "./string" ;
import { replaceAll } from "./string" ;
import { getFullDayName , getMonthName , getTimezone } from "./date" ;
import { getFullDayName , getMonthName , getTimezone } from "./date" ;
import { _global } from "../0.foundation" ;
import { _global } from "../0.foundation" ;
export const specialCharsMap = { } ;
const getSpecialCharsMap = ( ) => ( get ( _global , [ "BI" , "specialCharsMap" ] ) || { } ) ;
function isEmpty ( value ) {
function isEmpty ( value ) {
// 判断是否为空值
// 判断是否为空值
@ -624,6 +636,7 @@ export const getEncodeURL = function (urlTemplate, param) {
} ;
} ;
export const encodeURIComponent = function ( url ) {
export const encodeURIComponent = function ( url ) {
const specialCharsMap = getSpecialCharsMap ( ) ;
url = url || "" ;
url = url || "" ;
url = replaceAll ( ` ${ url } ` , keys ( specialCharsMap || [ ] ) . join ( "|" ) , str => {
url = replaceAll ( ` ${ url } ` , keys ( specialCharsMap || [ ] ) . join ( "|" ) , str => {
switch ( str ) {
switch ( str ) {
@ -638,6 +651,7 @@ export const encodeURIComponent = function (url) {
} ;
} ;
export const decodeURIComponent = function ( url ) {
export const decodeURIComponent = function ( url ) {
const specialCharsMap = getSpecialCharsMap ( ) ;
const reserveSpecialCharsMap = { } ;
const reserveSpecialCharsMap = { } ;
each ( specialCharsMap , ( initialChar , encodeChar ) => {
each ( specialCharsMap , ( initialChar , encodeChar ) => {
reserveSpecialCharsMap [ encodeChar ] = initialChar === "\\\\" ? "\\" : initialChar ;
reserveSpecialCharsMap [ encodeChar ] = initialChar === "\\\\" ? "\\" : initialChar ;