@wibetter/json-utils 5.0.14 → 5.0.16
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.esm.js +11 -5
- package/dist/index.esm.min.js +4 -3
- package/dist/index.js +31 -27
- package/dist/index.js.LICENSE.txt +2 -2
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
isEqual as isEqual$1,
|
|
4
4
|
truncate as truncate$1,
|
|
5
5
|
} from 'lodash';
|
|
6
|
-
import
|
|
6
|
+
import qs from 'qs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 获取 URL 上的所有参数
|
|
@@ -12,7 +12,7 @@ import queryString from 'query-string';
|
|
|
12
12
|
function urlParse() {
|
|
13
13
|
var urlParams = {};
|
|
14
14
|
if (location.search) {
|
|
15
|
-
urlParams =
|
|
15
|
+
urlParams = qs.parse(location.search.substring(1));
|
|
16
16
|
}
|
|
17
17
|
return urlParams;
|
|
18
18
|
}
|
|
@@ -25,7 +25,7 @@ function urlParse() {
|
|
|
25
25
|
function urlStringify(urlParams) {
|
|
26
26
|
var urlStr = '';
|
|
27
27
|
if (url) {
|
|
28
|
-
urlStr =
|
|
28
|
+
urlStr = qs.stringify(urlParams);
|
|
29
29
|
}
|
|
30
30
|
return urlStr;
|
|
31
31
|
}
|
|
@@ -66,7 +66,7 @@ function truncate(str, paramConfig) {
|
|
|
66
66
|
/**
|
|
67
67
|
* 支持属性表达式
|
|
68
68
|
*/
|
|
69
|
-
function
|
|
69
|
+
function evalExpression(expressionStr, data) {
|
|
70
70
|
var curData = data || {};
|
|
71
71
|
if (!expressionStr) return false;
|
|
72
72
|
var expressionFunc = new Function(
|
|
@@ -7831,6 +7831,12 @@ function objectSchema2JsonData(jsonSchema, jsonData) {
|
|
|
7831
7831
|
JSON.stringify(curValue) !== '{}'
|
|
7832
7832
|
) {
|
|
7833
7833
|
curJsonData = Object.assign(curJsonData, curValue);
|
|
7834
|
+
} else if (
|
|
7835
|
+
oldValue === undefined &&
|
|
7836
|
+
jsonItem.default &&
|
|
7837
|
+
isObject$1(jsonItem.default)
|
|
7838
|
+
) {
|
|
7839
|
+
curJsonData = jsonItem.default;
|
|
7834
7840
|
} else if (jsonSchema.properties) {
|
|
7835
7841
|
var curPropertyOrder = [];
|
|
7836
7842
|
if (jsonSchema.propertyOrder) {
|
|
@@ -8240,7 +8246,7 @@ export {
|
|
|
8240
8246
|
TypeDataList,
|
|
8241
8247
|
dataRoute2dataPath,
|
|
8242
8248
|
dynamicDataAnalyzer,
|
|
8243
|
-
|
|
8249
|
+
evalExpression,
|
|
8244
8250
|
getCurPosition,
|
|
8245
8251
|
getDefaultOptionVal,
|
|
8246
8252
|
getExpectType$1 as getExpectType,
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cloneDeep as e, isEqual as t, truncate as r } from 'lodash';
|
|
2
|
-
import n from '
|
|
2
|
+
import n from 'qs';
|
|
3
3
|
function o() {
|
|
4
4
|
var e = {};
|
|
5
|
-
return location.search && (e = n.parse(location.search)), e;
|
|
5
|
+
return location.search && (e = n.parse(location.search.substring(1))), e;
|
|
6
6
|
}
|
|
7
7
|
function i(e) {
|
|
8
8
|
var t = '';
|
|
@@ -4829,6 +4829,7 @@ function Jr(e, t) {
|
|
|
4829
4829
|
s && s.actionFunc && (r.actionFunc = s.actionFunc));
|
|
4830
4830
|
else if (!1 === e.isContainer && s && k(s) && '{}' !== JSON.stringify(s))
|
|
4831
4831
|
r = Object.assign(r, s);
|
|
4832
|
+
else if (void 0 === i && o.default && k(o.default)) r = o.default;
|
|
4832
4833
|
else if (e.properties) {
|
|
4833
4834
|
(e.propertyOrder ? e.propertyOrder : Object.keys(e.properties)).map(
|
|
4834
4835
|
function (n) {
|
|
@@ -5003,7 +5004,7 @@ export {
|
|
|
5003
5004
|
E as TypeDataList,
|
|
5004
5005
|
Yr as dataRoute2dataPath,
|
|
5005
5006
|
Xr as dynamicDataAnalyzer,
|
|
5006
|
-
c as
|
|
5007
|
+
c as evalExpression,
|
|
5007
5008
|
Lr as getCurPosition,
|
|
5008
5009
|
Kr as getDefaultOptionVal,
|
|
5009
5010
|
Vr as getExpectType,
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
dynamicDataAnalyzer: function () {
|
|
60
60
|
return ce;
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
evalExpression: function () {
|
|
63
63
|
return s;
|
|
64
64
|
},
|
|
65
65
|
getCurPosition: function () {
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
return R;
|
|
118
118
|
},
|
|
119
119
|
isDateTimeStr: function () {
|
|
120
|
-
return
|
|
120
|
+
return E;
|
|
121
121
|
},
|
|
122
122
|
isEmptySchema: function () {
|
|
123
123
|
return Y;
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
return z;
|
|
154
154
|
},
|
|
155
155
|
isTimeStr: function () {
|
|
156
|
-
return
|
|
156
|
+
return q;
|
|
157
157
|
},
|
|
158
158
|
isURL: function () {
|
|
159
159
|
return T;
|
|
@@ -208,11 +208,13 @@
|
|
|
208
208
|
},
|
|
209
209
|
});
|
|
210
210
|
var r = require('lodash'),
|
|
211
|
-
a = require('
|
|
211
|
+
a = require('qs'),
|
|
212
212
|
i = e.n(a);
|
|
213
213
|
function l() {
|
|
214
214
|
var e = {};
|
|
215
|
-
return
|
|
215
|
+
return (
|
|
216
|
+
location.search && (e = i().parse(location.search.substring(1))), e
|
|
217
|
+
);
|
|
216
218
|
}
|
|
217
219
|
function n(e) {
|
|
218
220
|
var t = '';
|
|
@@ -1477,13 +1479,13 @@
|
|
|
1477
1479
|
function R(e) {
|
|
1478
1480
|
return /^\d{4}-\d{2}-\d{2}$/.test(e);
|
|
1479
1481
|
}
|
|
1480
|
-
function
|
|
1482
|
+
function E(e) {
|
|
1481
1483
|
return (
|
|
1482
1484
|
/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.test(e) ||
|
|
1483
1485
|
/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/.test(e)
|
|
1484
1486
|
);
|
|
1485
1487
|
}
|
|
1486
|
-
function
|
|
1488
|
+
function q(e) {
|
|
1487
1489
|
return /^\d{2}:\d{2}:\d{2}$/.test(e) || /^\d{2}:\d{2}$/.test(e);
|
|
1488
1490
|
}
|
|
1489
1491
|
function k(e) {
|
|
@@ -1569,8 +1571,8 @@
|
|
|
1569
1571
|
else if (N(e)) t = o(C.number);
|
|
1570
1572
|
else if (T(e)) t = o(C.url);
|
|
1571
1573
|
else if (R(e)) t = o(C.date);
|
|
1572
|
-
else if (
|
|
1573
|
-
else if (
|
|
1574
|
+
else if (E(e)) t = o(C['date-time']);
|
|
1575
|
+
else if (q(e)) t = o(C.time);
|
|
1574
1576
|
else if (M(e)) t = o(C.color);
|
|
1575
1577
|
else
|
|
1576
1578
|
try {
|
|
@@ -1955,24 +1957,26 @@
|
|
|
1955
1957
|
n && n.actionFunc && (r.actionFunc = n.actionFunc))
|
|
1956
1958
|
: !1 === e.isContainer && n && P(n) && '{}' !== JSON.stringify(n)
|
|
1957
1959
|
? (r = Object.assign(r, n))
|
|
1958
|
-
:
|
|
1959
|
-
(
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1960
|
+
: void 0 === l && i.default && P(i.default)
|
|
1961
|
+
? (r = i.default)
|
|
1962
|
+
: e.properties &&
|
|
1963
|
+
(e.propertyOrder
|
|
1964
|
+
? e.propertyOrder
|
|
1965
|
+
: Object.keys(e.properties)
|
|
1966
|
+
).map(function (a) {
|
|
1967
|
+
var i = e.properties[a],
|
|
1968
|
+
l = t && t[a];
|
|
1969
|
+
switch (U(i.type)) {
|
|
1970
|
+
case 'array':
|
|
1971
|
+
r[a] = oe(i, l);
|
|
1972
|
+
break;
|
|
1973
|
+
case 'object':
|
|
1974
|
+
r[a] = ne(i, l);
|
|
1975
|
+
break;
|
|
1976
|
+
default:
|
|
1977
|
+
r[a] = le(i, l);
|
|
1978
|
+
}
|
|
1979
|
+
});
|
|
1976
1980
|
}
|
|
1977
1981
|
return r;
|
|
1978
1982
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wibetter/json-utils v5.0.
|
|
2
|
+
* @wibetter/json-utils v5.0.16
|
|
3
3
|
* author: wibetter
|
|
4
4
|
* build tool: AKFun
|
|
5
|
-
* build time:
|
|
5
|
+
* build time: Sun Dec 29 2024 02:45:04 GMT+0800 (中国标准时间)
|
|
6
6
|
* build tool info: https://github.com/wibetter/akfun
|
|
7
7
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wibetter/json-utils",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.16",
|
|
4
4
|
"description": "提供JSON相关的各类工具方法,比如schema转json、json转schema、json元数据分析等",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"json工具包",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"lodash": "^4.17.21",
|
|
33
|
-
"
|
|
33
|
+
"qs": "^6.13.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"akfun": "^5.0.1"
|