@wibetter/json-utils 5.0.7 → 5.0.8

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 CHANGED
@@ -591,6 +591,24 @@ var initIMGData = {
591
591
  imgRatioReadOnly: true, // 图片宽高比例是否可调整
592
592
  };
593
593
 
594
+ /* input类型字段
595
+ * 【字段属性说明】
596
+ * title:字段项的label值
597
+ * type:用于标识字段项的展示类型(input、date、data-time、url、textarea 等)
598
+ * isRequired:是否是必填项
599
+ * default:默认值
600
+ * description:字段说明&描述
601
+ * readOnly:字段项可设置是否可编辑
602
+ * */
603
+ var initInputImageData = {
604
+ title: '图片地址',
605
+ type: 'input-image',
606
+ description: '',
607
+ // 字段项的说明和描述
608
+ accept: '.jpeg,.jpg,.png',
609
+ multiple: true,
610
+ };
611
+
594
612
  /* array类型字段
595
613
  * 【字段属性说明】
596
614
  * title:字段项的label值
@@ -1603,6 +1621,7 @@ var TypeDataList = {
1603
1621
  color: initColorData,
1604
1622
  image: initIMGData,
1605
1623
  number: initNumberData,
1624
+ 'input-image': initInputImageData,
1606
1625
  json: initJsonData,
1607
1626
  codearea: initCodeAreaData,
1608
1627
  htmlarea: initHtmlAreaData,
@@ -6682,6 +6701,7 @@ var valExpectType =
6682
6701
  input: 'string',
6683
6702
  json: 'string',
6684
6703
  number: 'number',
6704
+ 'input-image': 'string',
6685
6705
  object: 'object',
6686
6706
  quantity: 'object',
6687
6707
  radio: 'string',
@@ -345,6 +345,13 @@ var d,
345
345
  maximum: 1e3,
346
346
  description: '',
347
347
  },
348
+ 'input-image': {
349
+ title: '图片地址',
350
+ type: 'input-image',
351
+ description: '',
352
+ accept: '.jpeg,.jpg,.png',
353
+ multiple: !0,
354
+ },
348
355
  json: { title: 'json数据', type: 'json', default: '{}', description: '' },
349
356
  codearea: {
350
357
  type: 'codearea',
@@ -918,13 +925,13 @@ function _(e) {
918
925
  function w(e) {
919
926
  return /^\d{4}-\d{2}-\d{2}$/.test(e);
920
927
  }
921
- function x(e) {
928
+ function j(e) {
922
929
  return (
923
930
  /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.test(e) ||
924
931
  /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/.test(e)
925
932
  );
926
933
  }
927
- function j(e) {
934
+ function x(e) {
928
935
  return /^\d{2}:\d{2}:\d{2}$/.test(e) || /^\d{2}:\d{2}$/.test(e);
929
936
  }
930
937
  function S(e) {
@@ -1008,8 +1015,8 @@ function k(e) {
1008
1015
  else if (N(e)) t = n(b.number);
1009
1016
  else if (O(e)) t = n(b.url);
1010
1017
  else if (w(e)) t = n(b.date);
1011
- else if (x(e)) t = n(b['date-time']);
1012
- else if (j(e)) t = n(b.time);
1018
+ else if (j(e)) t = n(b['date-time']);
1019
+ else if (x(e)) t = n(b.time);
1013
1020
  else if (C(e)) t = n(b.color);
1014
1021
  else
1015
1022
  try {
@@ -1529,8 +1536,8 @@ function we(e) {
1529
1536
  return e;
1530
1537
  }
1531
1538
  Object.freeze(Ne);
1532
- var xe = Ee(ge),
1533
- je = Ee(function (e, t, r) {
1539
+ var je = Ee(ge),
1540
+ xe = Ee(function (e, t, r) {
1534
1541
  return null == e || fr(e) || Qt(e) || nr(e) || ar(e)
1535
1542
  ? e
1536
1543
  : Array.isArray(e)
@@ -1612,13 +1619,13 @@ var Ve = {
1612
1619
  return kt(i, e, t, o), i;
1613
1620
  },
1614
1621
  ref: Se,
1615
- shallow: je,
1616
- deep: xe,
1622
+ shallow: xe,
1623
+ deep: je,
1617
1624
  struct: De,
1618
1625
  },
1619
1626
  Ce = function (e, t, r) {
1620
1627
  if ('string' == typeof arguments[1] || 'symbol' == typeof arguments[1])
1621
- return xe.apply(null, arguments);
1628
+ return je.apply(null, arguments);
1622
1629
  if (It(e)) return e;
1623
1630
  var n = J(e)
1624
1631
  ? Ce.object(e, t, r)
@@ -1838,7 +1845,7 @@ function Ze(e, t, r) {
1838
1845
  var i = (r && r.length) || 0,
1839
1846
  a = new Array(i);
1840
1847
  if (i > 0) for (var s = 0; s < i; s++) a[s] = r[s];
1841
- xt({ type: 'action', name: e, object: t, arguments: a });
1848
+ jt({ type: 'action', name: e, object: t, arguments: a });
1842
1849
  }
1843
1850
  var u = Fe();
1844
1851
  dt();
@@ -1931,7 +1938,7 @@ var tt = (function (e) {
1931
1938
  var r = _t();
1932
1939
  r &&
1933
1940
  'production' !== process.env.NODE_ENV &&
1934
- xt({ type: 'update', name: this.name, newValue: e, oldValue: t }),
1941
+ jt({ type: 'update', name: this.name, newValue: e, oldValue: t }),
1935
1942
  this.setNewValue(e),
1936
1943
  r && 'production' !== process.env.NODE_ENV && St();
1937
1944
  }
@@ -2428,7 +2435,7 @@ var bt = (function () {
2428
2435
  r = _t();
2429
2436
  r &&
2430
2437
  'production' !== process.env.NODE_ENV &&
2431
- ((t = Date.now()), xt({ name: this.name, type: 'reaction' })),
2438
+ ((t = Date.now()), jt({ name: this.name, type: 'reaction' })),
2432
2439
  (this._isRunning = !0);
2433
2440
  var n = qe(this, e, void 0);
2434
2441
  (this._isRunning = !1),
@@ -2536,14 +2543,14 @@ function wt(e) {
2536
2543
  if ('production' !== process.env.NODE_ENV && ut.spyListeners.length)
2537
2544
  for (var t = ut.spyListeners, r = 0, n = t.length; r < n; r++) t[r](e);
2538
2545
  }
2539
- function xt(e) {
2546
+ function jt(e) {
2540
2547
  'production' !== process.env.NODE_ENV &&
2541
2548
  wt(ue(ue({}, e), { spyReportStart: !0 }));
2542
2549
  }
2543
- var jt = { spyReportEnd: !0 };
2550
+ var xt = { spyReportEnd: !0 };
2544
2551
  function St(e) {
2545
2552
  'production' !== process.env.NODE_ENV &&
2546
- wt(e ? ue(ue({}, e), { spyReportEnd: !0 }) : jt);
2553
+ wt(e ? ue(ue({}, e), { spyReportEnd: !0 }) : xt);
2547
2554
  }
2548
2555
  var Dt = function (e) {
2549
2556
  return e();
@@ -2586,7 +2593,7 @@ function Ct(e, t, r, n) {
2586
2593
  return ye(e), ur(e, n.name, o.enhancer), t && kt(e, t, r, o), e;
2587
2594
  }
2588
2595
  function Tt(e) {
2589
- return e.defaultDecorator || (!1 === e.deep ? Se : xe);
2596
+ return e.defaultDecorator || (!1 === e.deep ? Se : je);
2590
2597
  }
2591
2598
  function kt(e, t, r, n) {
2592
2599
  var o, i, a, s;
@@ -2996,7 +3003,7 @@ var $t = (function () {
2996
3003
  : null;
2997
3004
  n &&
2998
3005
  'production' !== process.env.NODE_ENV &&
2999
- xt(ue(ue({}, i), { name: this.atom.name })),
3006
+ jt(ue(ue({}, i), { name: this.atom.name })),
3000
3007
  this.atom.reportChanged(),
3001
3008
  o && Ht(this, i),
3002
3009
  n && 'production' !== process.env.NODE_ENV && St();
@@ -3018,7 +3025,7 @@ var $t = (function () {
3018
3025
  : null;
3019
3026
  n &&
3020
3027
  'production' !== process.env.NODE_ENV &&
3021
- xt(ue(ue({}, i), { name: this.atom.name })),
3028
+ jt(ue(ue({}, i), { name: this.atom.name })),
3022
3029
  this.atom.reportChanged(),
3023
3030
  o && Ht(this, i),
3024
3031
  n && 'production' !== process.env.NODE_ENV && St();
@@ -3281,7 +3288,7 @@ var er,
3281
3288
  return (
3282
3289
  r &&
3283
3290
  'production' !== process.env.NODE_ENV &&
3284
- xt(ue(ue({}, o), { name: this.name, key: e })),
3291
+ jt(ue(ue({}, o), { name: this.name, key: e })),
3285
3292
  Lt(function () {
3286
3293
  t._keysAtom.reportChanged(),
3287
3294
  t._updateHasMapEntry(e, !1),
@@ -3316,7 +3323,7 @@ var er,
3316
3323
  : null;
3317
3324
  n &&
3318
3325
  'production' !== process.env.NODE_ENV &&
3319
- xt(ue(ue({}, i), { name: this.name, key: e })),
3326
+ jt(ue(ue({}, i), { name: this.name, key: e })),
3320
3327
  r.setNewValue(t),
3321
3328
  o && Ht(this, i),
3322
3329
  n && 'production' !== process.env.NODE_ENV && St();
@@ -3338,7 +3345,7 @@ var er,
3338
3345
  o || n ? { type: 'add', object: this, name: e, newValue: t } : null;
3339
3346
  n &&
3340
3347
  'production' !== process.env.NODE_ENV &&
3341
- xt(ue(ue({}, i), { name: this.name, key: e })),
3348
+ jt(ue(ue({}, i), { name: this.name, key: e })),
3342
3349
  o && Ht(this, i),
3343
3350
  n && 'production' !== process.env.NODE_ENV && St();
3344
3351
  }),
@@ -3697,7 +3704,7 @@ var er,
3697
3704
  var r = _t(),
3698
3705
  n = zt(this),
3699
3706
  o = n || r ? { type: 'add', object: this, newValue: e } : null;
3700
- r && 'production' !== process.env.NODE_ENV && xt(o),
3707
+ r && 'production' !== process.env.NODE_ENV && jt(o),
3701
3708
  n && Ht(this, o),
3702
3709
  r && 'production' !== process.env.NODE_ENV && St();
3703
3710
  }
@@ -3717,7 +3724,7 @@ var er,
3717
3724
  return (
3718
3725
  r &&
3719
3726
  'production' !== process.env.NODE_ENV &&
3720
- xt(ue(ue({}, o), { name: this.name })),
3727
+ jt(ue(ue({}, o), { name: this.name })),
3721
3728
  Lt(function () {
3722
3729
  t._atom.reportChanged(), t._data.delete(e);
3723
3730
  }),
@@ -3854,7 +3861,7 @@ var er,
3854
3861
  : null;
3855
3862
  i &&
3856
3863
  'production' !== process.env.NODE_ENV &&
3857
- xt(ue(ue({}, a), { name: this.name, key: e })),
3864
+ jt(ue(ue({}, a), { name: this.name, key: e })),
3858
3865
  n.setNewValue(t),
3859
3866
  o && Ht(this, a),
3860
3867
  i && 'production' !== process.env.NODE_ENV && St();
@@ -3986,7 +3993,7 @@ var er,
3986
3993
  : null;
3987
3994
  n &&
3988
3995
  'production' !== process.env.NODE_ENV &&
3989
- xt(ue(ue({}, s), { name: this.name, key: e })),
3996
+ jt(ue(ue({}, s), { name: this.name, key: e })),
3990
3997
  r && Ht(this, s),
3991
3998
  n && 'production' !== process.env.NODE_ENV && St();
3992
3999
  } finally {
@@ -4031,7 +4038,7 @@ var er,
4031
4038
  if (
4032
4039
  (n &&
4033
4040
  'production' !== process.env.NODE_ENV &&
4034
- xt(ue(ue({}, o), { name: this.name, key: e })),
4041
+ jt(ue(ue({}, o), { name: this.name, key: e })),
4035
4042
  r && Ht(this, o),
4036
4043
  n && 'production' !== process.env.NODE_ENV && St(),
4037
4044
  this.pendingKeys)
@@ -4250,8 +4257,8 @@ if ('undefined' == typeof Proxy || 'undefined' == typeof Symbol)
4250
4257
  try {
4251
4258
  process.env.NODE_ENV;
4252
4259
  } catch (e) {
4253
- var xr = at();
4254
- 'undefined' == typeof process && (xr.process = {}), (xr.process.env = {});
4260
+ var jr = at();
4261
+ 'undefined' == typeof process && (jr.process = {}), (jr.process.env = {});
4255
4262
  }
4256
4263
  !(function () {
4257
4264
  if (
@@ -4284,7 +4291,7 @@ try {
4284
4291
  extras: { getDebugName: yr },
4285
4292
  $mobx: re,
4286
4293
  });
4287
- var jr =
4294
+ var xr =
4288
4295
  (((br = {
4289
4296
  array: 'array',
4290
4297
  boolean: 'boolean',
@@ -4302,6 +4309,7 @@ var jr =
4302
4309
  input: 'string',
4303
4310
  json: 'string',
4304
4311
  number: 'number',
4312
+ 'input-image': 'string',
4305
4313
  object: 'object',
4306
4314
  quantity: 'object',
4307
4315
  radio: 'string',
@@ -4316,12 +4324,12 @@ var jr =
4316
4324
  (br['sohu-event'] = 'object'),
4317
4325
  br);
4318
4326
  function Sr(e) {
4319
- return jr[e] || e;
4327
+ return xr[e] || e;
4320
4328
  }
4321
4329
  function Dr(e, t) {
4322
- jr[e]
4323
- ? console.warn('当前已经存在' + e + '(' + jr[e] + '),暂时不支持覆盖。')
4324
- : (jr[e] = t);
4330
+ xr[e]
4331
+ ? console.warn('当前已经存在' + e + '(' + xr[e] + '),暂时不支持覆盖。')
4332
+ : (xr[e] = t);
4325
4333
  }
4326
4334
  function Ar(e) {
4327
4335
  var t = !0;
@@ -4683,7 +4691,7 @@ export {
4683
4691
  C as isColor,
4684
4692
  Cr as isContainerSchema,
4685
4693
  w as isDateStr,
4686
- x as isDateTimeStr,
4694
+ j as isDateTimeStr,
4687
4695
  Ar as isEmptySchema,
4688
4696
  o as isEqual,
4689
4697
  T as isFunction,
@@ -4695,7 +4703,7 @@ export {
4695
4703
  D as isSelect,
4696
4704
  E as isString,
4697
4705
  Tr as isStructuredSchema,
4698
- j as isTimeStr,
4706
+ x as isTimeStr,
4699
4707
  O as isURL,
4700
4708
  k as json2schema,
4701
4709
  Wr as json2treeData,
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@
46
46
  return oe;
47
47
  },
48
48
  dynamicDataAnalyzer: function () {
49
- return ne;
49
+ return ae;
50
50
  },
51
51
  getCurPosition: function () {
52
52
  return Y;
@@ -82,7 +82,7 @@
82
82
  return u;
83
83
  },
84
84
  hasProperties: function () {
85
- return n;
85
+ return a;
86
86
  },
87
87
  indexRoute2keyRoute: function () {
88
88
  return c;
@@ -109,7 +109,7 @@
109
109
  return V;
110
110
  },
111
111
  isEqual: function () {
112
- return a;
112
+ return n;
113
113
  },
114
114
  isFunction: function () {
115
115
  return F;
@@ -178,7 +178,7 @@
178
178
  return ie;
179
179
  },
180
180
  schemaMetaList: function () {
181
- return ae;
181
+ return ne;
182
182
  },
183
183
  truncate: function () {
184
184
  return o;
@@ -188,10 +188,10 @@
188
188
  function i(e) {
189
189
  return (0, r.cloneDeep)(e);
190
190
  }
191
- function a(e, t) {
191
+ function n(e, t) {
192
192
  return (0, r.isEqual)(e, t);
193
193
  }
194
- function n(e) {
194
+ function a(e) {
195
195
  var t = !1;
196
196
  return null != e && (t = !0), t;
197
197
  }
@@ -199,54 +199,54 @@
199
199
  return (0, r.truncate)(e, t);
200
200
  }
201
201
  function l(e, t, r) {
202
- var a = t;
203
- if ((r && (a = i(t)), e))
204
- for (var n = e.split('-'), o = 0, l = n.length; o < l; o++) {
205
- var p = n[o];
206
- p && (a = a && a[p]);
202
+ var n = t;
203
+ if ((r && (n = i(t)), e))
204
+ for (var a = e.split('-'), o = 0, l = a.length; o < l; o++) {
205
+ var p = a[o];
206
+ p && (n = n && n[p]);
207
207
  }
208
- return a;
208
+ return n;
209
209
  }
210
210
  function p(e, t, r) {
211
- var a = t;
212
- if ((r && (a = i(t)), e))
213
- for (var n = e.split('-'), o = 0, l = n.length; o < l; o++) {
214
- var p = n[o];
211
+ var n = t;
212
+ if ((r && (n = i(t)), e))
213
+ for (var a = e.split('-'), o = 0, l = a.length; o < l; o++) {
214
+ var p = a[o];
215
215
  if (
216
216
  '0' !== p ||
217
- ('array' !== a.type &&
218
- 'radio' !== a.type &&
219
- 'select' !== a.type &&
220
- 'checkboxes' !== a.type) ||
221
- (!a.options && !a.items)
217
+ ('array' !== n.type &&
218
+ 'radio' !== n.type &&
219
+ 'select' !== n.type &&
220
+ 'checkboxes' !== n.type) ||
221
+ (!n.options && !n.items)
222
222
  ) {
223
223
  if (p) {
224
224
  var u = '0';
225
- a.propertyOrder
226
- ? (u = a.propertyOrder[p])
227
- : a.properties && (u = Object.keys(a.properties)[p]),
228
- (a = a.properties[u]);
225
+ n.propertyOrder
226
+ ? (u = n.propertyOrder[p])
227
+ : n.properties && (u = Object.keys(n.properties)[p]),
228
+ (n = n.properties[u]);
229
229
  }
230
- } else a = a.options || a.items;
230
+ } else n = n.options || n.items;
231
231
  }
232
- return a;
232
+ return n;
233
233
  }
234
234
  function u(e, t, r) {
235
- var a = t;
236
- if ((r && (a = i(t)), e && a))
237
- for (var n = e.split('-'), o = 0, l = n.length; o < l; o++) {
238
- var p = n[o];
239
- p && a.properties && (a = a.properties[p]);
235
+ var n = t;
236
+ if ((r && (n = i(t)), e && n))
237
+ for (var a = e.split('-'), o = 0, l = a.length; o < l; o++) {
238
+ var p = a[o];
239
+ p && n.properties && (n = n.properties[p]);
240
240
  }
241
- return a;
241
+ return n;
242
242
  }
243
243
  function c(e, t) {
244
244
  for (
245
- var r = t, i = '', a = e.split('-'), n = 0, o = a.length;
246
- n < o;
247
- n++
245
+ var r = t, i = '', n = e.split('-'), a = 0, o = n.length;
246
+ a < o;
247
+ a++
248
248
  ) {
249
- var l = a[n];
249
+ var l = n[a];
250
250
  if ('0' === l && r.items)
251
251
  (r = r.items), (i = i ? i + '-items' : 'items');
252
252
  else if ('0' === l && r.options)
@@ -264,11 +264,11 @@
264
264
  }
265
265
  function s(e, t) {
266
266
  for (
267
- var r = t, i = '', a = e.split('-'), n = 0, o = a.length;
268
- n < o;
269
- n++
267
+ var r = t, i = '', n = e.split('-'), a = 0, o = n.length;
268
+ a < o;
269
+ a++
270
270
  ) {
271
- var l = a[n];
271
+ var l = n[a];
272
272
  if (l) {
273
273
  var p = -1;
274
274
  r.propertyOrder
@@ -544,6 +544,13 @@
544
544
  maximum: 1e3,
545
545
  description: '',
546
546
  },
547
+ 'input-image': {
548
+ title: '图片地址',
549
+ type: 'input-image',
550
+ description: '',
551
+ accept: '.jpeg,.jpg,.png',
552
+ multiple: !0,
553
+ },
547
554
  json: {
548
555
  title: 'json数据',
549
556
  type: 'json',
@@ -1209,10 +1216,10 @@
1209
1216
  if (E(e)) {
1210
1217
  (t = i(v.select)).items.enum = e;
1211
1218
  var r = t.items.enumextra.length,
1212
- a = e.length;
1213
- if (a > r)
1214
- for (var n = r, o = a; n < o; n++)
1215
- t.items.enumextra.push('选项' + e(n));
1219
+ n = e.length;
1220
+ if (n > r)
1221
+ for (var a = r, o = n; a < o; a++)
1222
+ t.items.enumextra.push('选项' + e(a));
1216
1223
  } else {
1217
1224
  t = i(v['empty-array']);
1218
1225
  var l = w(e[0]);
@@ -1259,16 +1266,16 @@
1259
1266
  var r = !t,
1260
1267
  i = t || {};
1261
1268
  if (e && '{}' !== JSON.stringify(e)) {
1262
- var a = e.type;
1263
- 'object' === a || 'func' === a || 'style' === a || 'data' === a
1269
+ var n = e.type;
1270
+ 'object' === n || 'func' === n || 'style' === n || 'data' === n
1264
1271
  ? (!r && i.object ? (i.object += 1) : r || (i.object = 1),
1265
1272
  (i = I(e, i)))
1266
- : 'array' === a
1273
+ : 'array' === n
1267
1274
  ? (!r && i.array ? (i.array += 1) : r || (i.array = 1),
1268
1275
  (i = I((e = e.items), i)))
1269
- : !r && i[a]
1270
- ? (i[a] += 1)
1271
- : r || (i[a] = 1);
1276
+ : !r && i[n]
1277
+ ? (i[n] += 1)
1278
+ : r || (i[n] = 1);
1272
1279
  }
1273
1280
  return i;
1274
1281
  }
@@ -1282,7 +1289,7 @@
1282
1289
  'datasource' !== t.type &&
1283
1290
  'event' !== t.type &&
1284
1291
  'object' !== t.type) ||
1285
- !n(t.default) ||
1292
+ !a(t.default) ||
1286
1293
  delete t.default,
1287
1294
  'radio' === t.type &&
1288
1295
  ((t.type = 'string'),
@@ -1298,12 +1305,12 @@
1298
1305
  'quantity' === t.type)
1299
1306
  ) {
1300
1307
  var r = t.properties,
1301
- a = i(v.quantity);
1308
+ n = i(v.quantity);
1302
1309
  if (r.quantity && R(r.quantity) && r.quantity.default) {
1303
1310
  var o = r.quantity.default;
1304
- a.properties.quantity.default = 'percent' === o ? '%' : o;
1311
+ n.properties.quantity.default = 'percent' === o ? '%' : o;
1305
1312
  }
1306
- t = a;
1313
+ t = n;
1307
1314
  }
1308
1315
  if ('datasource' === t.type) {
1309
1316
  var l = t.properties,
@@ -1354,7 +1361,7 @@
1354
1361
  'datasource' !== t.type &&
1355
1362
  'event' !== t.type &&
1356
1363
  'object' !== t.type) ||
1357
- !n(t.default) ||
1364
+ !a(t.default) ||
1358
1365
  delete t.default,
1359
1366
  ('radio' !== t.type &&
1360
1367
  'checkboxes' !== t.type &&
@@ -1396,6 +1403,7 @@
1396
1403
  input: 'string',
1397
1404
  json: 'string',
1398
1405
  number: 'number',
1406
+ 'input-image': 'string',
1399
1407
  object: 'object',
1400
1408
  quantity: 'object',
1401
1409
  radio: 'string',
@@ -1471,14 +1479,14 @@
1471
1479
  for (
1472
1480
  var r = e.split('-'),
1473
1481
  i = t.split('-'),
1474
- a = 'before',
1475
- n = 0,
1482
+ n = 'before',
1483
+ a = 0,
1476
1484
  o = (r.length > i.length ? i : r).length;
1477
- n < o;
1478
- n += 1
1485
+ a < o;
1486
+ a += 1
1479
1487
  )
1480
- Number(r[n]) > Number(i[n]) && (a = 'after');
1481
- return a;
1488
+ Number(r[a]) > Number(i[a]) && (n = 'after');
1489
+ return n;
1482
1490
  }
1483
1491
  function W(e) {
1484
1492
  var t = e.split('-');
@@ -1517,33 +1525,33 @@
1517
1525
  function ee(e, t) {
1518
1526
  var r = '',
1519
1527
  i = t;
1520
- n(i) && n(e.default) && typeof i != typeof e.default && (i = void 0);
1521
- var a = n(i) ? i : e.default;
1528
+ a(i) && a(e.default) && typeof i != typeof e.default && (i = void 0);
1529
+ var n = a(i) ? i : e.default;
1522
1530
  switch (e.type) {
1523
1531
  case 'select':
1524
1532
  case 'radio':
1525
- r = a || G(e);
1533
+ r = n || G(e);
1526
1534
  break;
1527
1535
  case 'checkboxes':
1528
- r = a || G(e, !0);
1536
+ r = n || G(e, !0);
1529
1537
  break;
1530
1538
  case 'color':
1531
- ('#fff' !== a && '#FFF' !== a) || (a = '#ffffff'),
1532
- (r = n(a) ? a : '#ffffff');
1539
+ ('#fff' !== n && '#FFF' !== n) || (n = '#ffffff'),
1540
+ (r = a(n) ? n : '#ffffff');
1533
1541
  break;
1534
1542
  case 'boolean':
1535
- r = !!n(a) && a;
1543
+ r = !!a(n) && n;
1536
1544
  break;
1537
1545
  case 'number':
1538
- r = n(a) ? a : void 0;
1546
+ r = a(n) ? n : void 0;
1539
1547
  break;
1540
1548
  case 'json':
1541
1549
  var o = '';
1542
- if (R(a) || D(a)) o = a;
1543
- else if (F(a) || '' === a) o = {};
1550
+ if (R(n) || D(n)) o = n;
1551
+ else if (F(n) || '' === n) o = {};
1544
1552
  else
1545
1553
  try {
1546
- o = JSON.parse(a);
1554
+ o = JSON.parse(n);
1547
1555
  } catch (e) {
1548
1556
  o = {};
1549
1557
  }
@@ -1552,28 +1560,28 @@
1552
1560
  default:
1553
1561
  r =
1554
1562
  'input' === e.type && '0' === e.default
1555
- ? a || e.default
1556
- : n(a)
1557
- ? a
1563
+ ? n || e.default
1564
+ : a(n)
1565
+ ? n
1558
1566
  : void 0;
1559
1567
  }
1560
1568
  return r;
1561
1569
  }
1562
1570
  function te(e, t) {
1563
1571
  var r = {},
1564
- a = e.type;
1572
+ n = e.type;
1565
1573
  if (R(e) && 'object' === L(e.type)) {
1566
1574
  var o = e,
1567
1575
  l = t;
1568
- n(l) && n(o.default) && typeof l != typeof o.default && (l = void 0);
1569
- var p = n(l) ? l : o.default;
1570
- 'dynamic-data' === a
1576
+ a(l) && a(o.default) && typeof l != typeof o.default && (l = void 0);
1577
+ var p = a(l) ? l : o.default;
1578
+ 'dynamic-data' === n
1571
1579
  ? ((r = i(b)),
1572
1580
  p &&
1573
1581
  R(p) &&
1574
1582
  '{}' !== JSON.stringify(p) &&
1575
1583
  (r = Object.assign(r, p)))
1576
- : 'datasource' === a
1584
+ : 'datasource' === n
1577
1585
  ? o.properties &&
1578
1586
  o.properties.type &&
1579
1587
  o.properties.type.default &&
@@ -1586,7 +1594,7 @@
1586
1594
  p && p.data && (r.data = p.data),
1587
1595
  p && p.filter && (r.filter = p.filter),
1588
1596
  '{}' === r.data && (r.data = 'http://xxx'))
1589
- : 'event' === a
1597
+ : 'event' === n
1590
1598
  ? o.properties &&
1591
1599
  o.properties.type &&
1592
1600
  o.properties.type.default &&
@@ -1614,17 +1622,17 @@
1614
1622
  ? e.propertyOrder
1615
1623
  : Object.keys(e.properties)
1616
1624
  ).map(function (i) {
1617
- var a = e.properties[i],
1618
- n = t && t[i];
1619
- switch (L(a.type)) {
1625
+ var n = e.properties[i],
1626
+ a = t && t[i];
1627
+ switch (L(n.type)) {
1620
1628
  case 'array':
1621
- r[i] = re(a, n);
1629
+ r[i] = re(n, a);
1622
1630
  break;
1623
1631
  case 'object':
1624
- r[i] = te(a, n);
1632
+ r[i] = te(n, a);
1625
1633
  break;
1626
1634
  default:
1627
- r[i] = ee(a, n);
1635
+ r[i] = ee(n, a);
1628
1636
  }
1629
1637
  });
1630
1638
  }
@@ -1634,19 +1642,19 @@
1634
1642
  var r = [];
1635
1643
  if (e && 'array' === L(e.type)) {
1636
1644
  var i = t;
1637
- n(i) && n(e.default) && typeof i != typeof e.default && (i = void 0);
1638
- var a = n(i) ? i : e.default;
1645
+ a(i) && a(e.default) && typeof i != typeof e.default && (i = void 0);
1646
+ var n = a(i) ? i : e.default;
1639
1647
  if ('array' === L(e.type))
1640
- if (D(a))
1641
- a.map(function (t) {
1648
+ if (D(n))
1649
+ n.map(function (t) {
1642
1650
  r.push(te(e.items, t));
1643
1651
  });
1644
- else if (a) r = a;
1652
+ else if (n) r = n;
1645
1653
  else {
1646
- var o = te(e.items, a);
1654
+ var o = te(e.items, n);
1647
1655
  r.push(o);
1648
1656
  }
1649
- else r = n(a) ? a : [];
1657
+ else r = a(n) ? n : [];
1650
1658
  }
1651
1659
  return r;
1652
1660
  }
@@ -1657,8 +1665,8 @@
1657
1665
  ? re(e, t)
1658
1666
  : ee(e, t);
1659
1667
  }
1660
- var ae = v;
1661
- function ne(e, t) {
1668
+ var ne = v;
1669
+ function ae(e, t) {
1662
1670
  var r = t || [];
1663
1671
  if (e && '{}' !== JSON.stringify(e))
1664
1672
  if (R(e))
@@ -1668,8 +1676,8 @@
1668
1676
  e.config &&
1669
1677
  R(e.config) &&
1670
1678
  e.config.dataName &&
1671
- n(e.localFilter) &&
1672
- n(e.data)
1679
+ a(e.localFilter) &&
1680
+ a(e.data)
1673
1681
  ) {
1674
1682
  var i = e.config.body;
1675
1683
  if (i && !R(i))
@@ -1681,12 +1689,12 @@
1681
1689
  r.push({ id: e.config.id, dataName: e.config.dataName, body: i });
1682
1690
  } else
1683
1691
  Object.keys(e).map(function (t) {
1684
- ne(e[t], r);
1692
+ ae(e[t], r);
1685
1693
  });
1686
1694
  else
1687
1695
  D(e) &&
1688
1696
  e.map(function (e) {
1689
- ne(e, r);
1697
+ ae(e, r);
1690
1698
  });
1691
1699
  return r;
1692
1700
  }
@@ -1704,19 +1712,19 @@
1704
1712
  return (
1705
1713
  R(e)
1706
1714
  ? Object.keys(e).map(function (i) {
1707
- var a = e[i],
1708
- n = t ? t + '-' + i : i;
1709
- R(a) || D(a)
1710
- ? r.push({ title: i, value: n, key: n, children: le(a, n) })
1711
- : r.push({ title: i, value: n, key: n });
1715
+ var n = e[i],
1716
+ a = t ? t + '-' + i : i;
1717
+ R(n) || D(n)
1718
+ ? r.push({ title: i, value: a, key: a, children: le(n, a) })
1719
+ : r.push({ title: i, value: a, key: a });
1712
1720
  })
1713
1721
  : D(e) &&
1714
1722
  e.map(function (e, i) {
1715
- var a = i.toString(),
1716
- n = t ? t + '-' + i : a;
1723
+ var n = i.toString(),
1724
+ a = t ? t + '-' + i : n;
1717
1725
  R(e) || D(e)
1718
- ? r.push({ title: a, value: n, key: n, children: le(e, n) })
1719
- : r.push({ title: a, value: n, key: n });
1726
+ ? r.push({ title: n, value: a, key: a, children: le(e, a) })
1727
+ : r.push({ title: n, value: a, key: a });
1720
1728
  }),
1721
1729
  r
1722
1730
  );
@@ -2,6 +2,6 @@
2
2
  * @wibetter/json-utils v5.0.7
3
3
  * author: wibetter
4
4
  * build tool: AKFun
5
- * build time: Mon Dec 23 2024 18:08:12 GMT+0800 (中国标准时间)
5
+ * build time: Tue Dec 24 2024 14:45:02 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.7",
3
+ "version": "5.0.8",
4
4
  "description": "提供JSON相关的各类工具方法,比如schema转json、json转schema、json元数据分析等",
5
5
  "keywords": [
6
6
  "json工具包",