@fctc/interface-logic 1.5.8 → 1.6.0

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/utils.d.ts CHANGED
@@ -12,7 +12,7 @@ declare function handleError(error: Error, env: {
12
12
 
13
13
  declare const formatCurrency: (amount: number, currency?: string) => string;
14
14
  declare const formatDate: (date: string | Date, locale?: string) => string;
15
- declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string;
15
+ declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
16
16
 
17
17
  type AST = {
18
18
  type: number;
@@ -87,7 +87,7 @@ declare const useField: (props: any) => {
87
87
  invisible: boolean;
88
88
  required: boolean;
89
89
  readonly: boolean;
90
- nameField: string;
90
+ nameField: string | null;
91
91
  };
92
92
 
93
93
  export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
package/dist/utils.js CHANGED
@@ -1,24 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __pow = Math.pow;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
8
  var __export = (target, all) => {
23
9
  for (var name in all)
24
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -40,26 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
26
  mod
41
27
  ));
42
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
43
- var __async = (__this, __arguments, generator) => {
44
- return new Promise((resolve, reject) => {
45
- var fulfilled = (value) => {
46
- try {
47
- step(generator.next(value));
48
- } catch (e) {
49
- reject(e);
50
- }
51
- };
52
- var rejected = (value) => {
53
- try {
54
- step(generator.throw(value));
55
- } catch (e) {
56
- reject(e);
57
- }
58
- };
59
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
60
- step((generator = generator.apply(__this, __arguments)).next());
61
- });
62
- };
63
29
 
64
30
  // src/utils.ts
65
31
  var utils_exports = {};
@@ -99,6 +65,7 @@ module.exports = __toCommonJS(utils_exports);
99
65
 
100
66
  // src/utils/error-handler.ts
101
67
  var WesapError = class extends Error {
68
+ code;
102
69
  constructor(message, code) {
103
70
  super(message);
104
71
  this.code = code;
@@ -1485,6 +1452,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
1485
1452
  this.microsecond = params.microsecond;
1486
1453
  this.weekday = params.weekday;
1487
1454
  }
1455
+ years;
1456
+ months;
1457
+ days;
1458
+ hours;
1459
+ minutes;
1460
+ seconds;
1461
+ microseconds;
1462
+ leapDays;
1463
+ year;
1464
+ month;
1465
+ day;
1466
+ hour;
1467
+ minute;
1468
+ second;
1469
+ microsecond;
1470
+ weekday;
1488
1471
  negate() {
1489
1472
  return new _PyRelativeDelta(this, -1);
1490
1473
  }
@@ -1599,7 +1582,7 @@ function execOnIterable(iterable, func) {
1599
1582
  if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
1600
1583
  iterable = Object.keys(iterable);
1601
1584
  }
1602
- if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
1585
+ if (typeof iterable?.[Symbol.iterator] !== "function") {
1603
1586
  throw new EvaluationError("value not iterable");
1604
1587
  }
1605
1588
  return func(iterable);
@@ -1922,7 +1905,7 @@ function applyBinaryOp(ast, context) {
1922
1905
  }
1923
1906
  return Math.floor(left / right);
1924
1907
  case "**":
1925
- return __pow(left, right);
1908
+ return left ** right;
1926
1909
  case "==":
1927
1910
  return isEqual(left, right);
1928
1911
  case "<>":
@@ -2044,7 +2027,7 @@ function evaluate(ast, context = {}) {
2044
2027
  const dicts = /* @__PURE__ */ new Set();
2045
2028
  let pyContext;
2046
2029
  const evalContext = Object.create(context);
2047
- if (!(evalContext == null ? void 0 : evalContext.context)) {
2030
+ if (!evalContext?.context) {
2048
2031
  Object.defineProperty(evalContext, "context", {
2049
2032
  get() {
2050
2033
  if (!pyContext) {
@@ -2055,18 +2038,17 @@ function evaluate(ast, context = {}) {
2055
2038
  });
2056
2039
  }
2057
2040
  function _innerEvaluate(ast2) {
2058
- var _a, _b, _c;
2059
- switch (ast2 == null ? void 0 : ast2.type) {
2041
+ switch (ast2?.type) {
2060
2042
  case 0:
2061
2043
  // Number
2062
2044
  case 1:
2063
2045
  return ast2.value;
2064
2046
  case 5:
2065
2047
  if (ast2.value in evalContext) {
2066
- if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
2067
- return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
2048
+ if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
2049
+ return evalContext[ast2.value]?.id;
2068
2050
  }
2069
- return (_c = evalContext[ast2.value]) != null ? _c : false;
2051
+ return evalContext[ast2.value] ?? false;
2070
2052
  } else if (ast2.value in BUILTINS) {
2071
2053
  return BUILTINS[ast2.value];
2072
2054
  } else {
@@ -2103,7 +2085,7 @@ function evaluate(ast, context = {}) {
2103
2085
  const args = ast2.args.map(_evaluate);
2104
2086
  const kwargs = {};
2105
2087
  for (const kwarg in ast2.kwargs) {
2106
- kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
2088
+ kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
2107
2089
  }
2108
2090
  if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
2109
2091
  return fnValue.create(...args, kwargs);
@@ -2196,7 +2178,7 @@ function evalPartialContext(_context, evaluationContext = {}) {
2196
2178
  const value = ast.value[key];
2197
2179
  try {
2198
2180
  context[key] = evaluate(value, evaluationContext);
2199
- } catch (e) {
2181
+ } catch {
2200
2182
  }
2201
2183
  }
2202
2184
  return context;
@@ -2224,25 +2206,9 @@ function escapeRegExp(str) {
2224
2206
  var InvalidDomainError = class extends Error {
2225
2207
  };
2226
2208
  var Domain = class _Domain {
2227
- constructor(descr = []) {
2228
- this.ast = { type: -1, value: null };
2229
- if (descr instanceof _Domain) {
2230
- return new _Domain(descr.toString());
2231
- } else {
2232
- let rawAST;
2233
- try {
2234
- rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2235
- } catch (error) {
2236
- throw new InvalidDomainError(
2237
- `Invalid domain representation: ${descr}`,
2238
- {
2239
- cause: error
2240
- }
2241
- );
2242
- }
2243
- this.ast = normalizeDomainAST(rawAST);
2244
- }
2245
- }
2209
+ ast = { type: -1, value: null };
2210
+ static TRUE;
2211
+ static FALSE;
2246
2212
  static combine(domains, operator) {
2247
2213
  if (domains.length === 0) {
2248
2214
  return new _Domain([]);
@@ -2321,6 +2287,24 @@ var Domain = class _Domain {
2321
2287
  processLeaf(d.ast.value, 0, "&", newDomain);
2322
2288
  return newDomain;
2323
2289
  }
2290
+ constructor(descr = []) {
2291
+ if (descr instanceof _Domain) {
2292
+ return new _Domain(descr.toString());
2293
+ } else {
2294
+ let rawAST;
2295
+ try {
2296
+ rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2297
+ } catch (error) {
2298
+ throw new InvalidDomainError(
2299
+ `Invalid domain representation: ${descr}`,
2300
+ {
2301
+ cause: error
2302
+ }
2303
+ );
2304
+ }
2305
+ this.ast = normalizeDomainAST(rawAST);
2306
+ }
2307
+ }
2324
2308
  contains(record) {
2325
2309
  const expr = evaluate(this.ast, record);
2326
2310
  return matchDomain(record, expr);
@@ -2339,7 +2323,7 @@ var Domain = class _Domain {
2339
2323
  return evaluatedAsList;
2340
2324
  }
2341
2325
  return this.toString();
2342
- } catch (e) {
2326
+ } catch {
2343
2327
  return this.toString();
2344
2328
  }
2345
2329
  }
@@ -2563,7 +2547,7 @@ var checkDomain = (context, domain) => {
2563
2547
  };
2564
2548
  var matchDomains = (context, domains) => {
2565
2549
  if (Array.isArray(domains)) {
2566
- if ((domains == null ? void 0 : domains.length) > 0) {
2550
+ if (domains?.length > 0) {
2567
2551
  return domains && domains.some((domain) => checkDomain(context, domain));
2568
2552
  }
2569
2553
  } else return checkDomain(context, domains);
@@ -2580,17 +2564,15 @@ var evalJSONContext = (_context, context = {}) => {
2580
2564
  }
2581
2565
  };
2582
2566
  var evalJSONDomain = (domain, context) => {
2583
- var _a;
2584
2567
  try {
2585
2568
  if (context) {
2586
- (_a = Object.keys(context)) == null ? void 0 : _a.forEach((key) => {
2587
- var _a2, _b;
2569
+ Object.keys(context)?.forEach((key) => {
2588
2570
  if (Array.isArray(context[key])) {
2589
- const isTypeObject = (_a2 = context[key]) == null ? void 0 : _a2.every(
2590
- (item) => typeof item === "object" && item !== null && (item == null ? void 0 : item.id) !== void 0
2571
+ const isTypeObject = context[key]?.every(
2572
+ (item) => typeof item === "object" && item !== null && item?.id !== void 0
2591
2573
  );
2592
2574
  if (isTypeObject) {
2593
- context[key] = (_b = context[key]) == null ? void 0 : _b.map((item) => item == null ? void 0 : item.id);
2575
+ context[key] = context[key]?.map((item) => item?.id);
2594
2576
  }
2595
2577
  }
2596
2578
  });
@@ -2610,7 +2592,7 @@ var formatSortingString = (input) => {
2610
2592
  if (!input) return null;
2611
2593
  return input.split(",").map((field) => {
2612
2594
  const [key, order] = field.trim().split(/\s+/);
2613
- const sortOrder = (order == null ? void 0 : order.toUpperCase()) === "DESC" ? "DESC" : "ASC";
2595
+ const sortOrder = order?.toUpperCase() === "DESC" ? "DESC" : "ASC";
2614
2596
  return `${key} ${sortOrder}`;
2615
2597
  }).join(", ");
2616
2598
  };
@@ -2654,11 +2636,11 @@ var getFieldsOnChange = (fields) => {
2654
2636
  function traverse(items) {
2655
2637
  for (const item of items) {
2656
2638
  if (item) {
2657
- if ((item == null ? void 0 : item.type_co) === "field" && matchDomains(fields, item == null ? void 0 : item.on_change)) {
2639
+ if (item?.type_co === "field" && matchDomains(fields, item?.on_change)) {
2658
2640
  result.push(item.name);
2659
2641
  }
2660
- if ((item == null ? void 0 : item.fields) && Array.isArray(item == null ? void 0 : item.fields)) {
2661
- traverse(item == null ? void 0 : item.fields);
2642
+ if (item?.fields && Array.isArray(item?.fields)) {
2643
+ traverse(item?.fields);
2662
2644
  }
2663
2645
  }
2664
2646
  }
@@ -2674,42 +2656,39 @@ var filterFieldDirty = ({
2674
2656
  model,
2675
2657
  defaultData
2676
2658
  }) => {
2677
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2678
- const data = id ? __spreadValues({}, dirtyFields) : __spreadValues({}, formValues);
2659
+ const data = id ? { ...dirtyFields } : { ...formValues };
2679
2660
  for (const key in data) {
2680
- if (((_c = (_b = (_a = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a[model]) == null ? void 0 : _b[key]) == null ? void 0 : _c.type) === "one2many" /* ONE2MANY */) {
2661
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */) {
2681
2662
  const lineData = [];
2682
- ((_d = formValues[key]) != null ? _d : []).forEach((itemData, index) => {
2683
- var _a2, _b2, _c2, _d2;
2684
- if (typeof (itemData == null ? void 0 : itemData.id) === "string" && (itemData == null ? void 0 : itemData.id.includes("virtual"))) {
2685
- itemData == null ? true : delete itemData.id;
2663
+ (formValues[key] ?? []).forEach((itemData, index) => {
2664
+ if (typeof itemData?.id === "string" && itemData?.id.includes("virtual")) {
2665
+ delete itemData?.id;
2686
2666
  }
2687
- if (!(itemData == null ? void 0 : itemData.id)) {
2667
+ if (!itemData?.id) {
2688
2668
  lineData.push([
2689
2669
  0 /* CREATE */,
2690
2670
  `virtual_${index}`,
2691
2671
  filterFieldDirty({
2692
- id: itemData == null ? void 0 : itemData.id,
2672
+ id: itemData?.id,
2693
2673
  viewData,
2694
2674
  formValues: itemData,
2695
2675
  dirtyFields: {},
2696
- model: (_c2 = (_b2 = (_a2 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a2[model]) == null ? void 0 : _b2[key]) == null ? void 0 : _c2.relation,
2676
+ model: viewData?.models?.[model]?.[key]?.relation,
2697
2677
  defaultData
2698
2678
  })
2699
2679
  ]);
2700
- } else if ((_d2 = dirtyFields[key]) == null ? void 0 : _d2.length) {
2680
+ } else if (dirtyFields[key]?.length) {
2701
2681
  dirtyFields[key].forEach((itemDirty, indexDirty) => {
2702
- var _a3, _b3, _c3;
2703
2682
  if (Object.values(itemDirty).includes(true) && indexDirty === index) {
2704
2683
  lineData.push([
2705
2684
  1 /* UPDATE */,
2706
- itemData == null ? void 0 : itemData.id,
2685
+ itemData?.id,
2707
2686
  filterFieldDirty({
2708
- id: itemData == null ? void 0 : itemData.id,
2687
+ id: itemData?.id,
2709
2688
  viewData,
2710
2689
  formValues: itemData,
2711
2690
  dirtyFields: itemDirty,
2712
- model: (_c3 = (_b3 = (_a3 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a3[model]) == null ? void 0 : _b3[key]) == null ? void 0 : _c3.relation,
2691
+ model: viewData?.models?.[model]?.[key]?.relation,
2713
2692
  defaultData: {}
2714
2693
  })
2715
2694
  ]);
@@ -2717,39 +2696,37 @@ var filterFieldDirty = ({
2717
2696
  });
2718
2697
  }
2719
2698
  });
2720
- ((_e = defaultData[key]) != null ? _e : []).forEach((item) => {
2721
- var _a2;
2722
- if (!((_a2 = formValues[key]) != null ? _a2 : []).find(
2723
- (itemData) => (itemData == null ? void 0 : itemData.id) === (item == null ? void 0 : item.id)
2699
+ (defaultData[key] ?? []).forEach((item) => {
2700
+ if (!(formValues[key] ?? []).find(
2701
+ (itemData) => itemData?.id === item?.id
2724
2702
  )) {
2725
- lineData.push([2 /* DELETE */, item == null ? void 0 : item.id, item]);
2703
+ lineData.push([2 /* DELETE */, item?.id, item]);
2726
2704
  }
2727
2705
  });
2728
2706
  data[key] = lineData;
2729
- } else if (((_h = (_g = (_f = viewData == null ? void 0 : viewData.models) == null ? void 0 : _f[model]) == null ? void 0 : _g[key]) == null ? void 0 : _h.type) === "many2many" /* MANY2MANY */) {
2707
+ } else if (viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
2730
2708
  const lineData = [];
2731
2709
  (formValues[key] || []).forEach((itemData) => {
2732
- if (itemData == null ? void 0 : itemData.id) {
2733
- lineData.push([4 /* NO_CHANGE */, itemData == null ? void 0 : itemData.id]);
2710
+ if (itemData?.id) {
2711
+ lineData.push([4 /* NO_CHANGE */, itemData?.id]);
2734
2712
  }
2735
2713
  });
2736
- ((_i = defaultData[key]) != null ? _i : []).forEach((item) => {
2737
- var _a2;
2738
- if (!((_a2 = formValues[key]) != null ? _a2 : []).find(
2739
- (itemData) => (itemData == null ? void 0 : itemData.id) === (item == null ? void 0 : item.id)
2714
+ (defaultData[key] ?? []).forEach((item) => {
2715
+ if (!(formValues[key] ?? []).find(
2716
+ (itemData) => itemData?.id === item?.id
2740
2717
  )) {
2741
- lineData.push([3 /* UNLINK */, item == null ? void 0 : item.id]);
2718
+ lineData.push([3 /* UNLINK */, item?.id]);
2742
2719
  }
2743
2720
  });
2744
2721
  data[key] = lineData;
2745
2722
  } else {
2746
- if (id && (typeof (dirtyFields == null ? void 0 : dirtyFields[key]) === "object" && !((_j = dirtyFields == null ? void 0 : dirtyFields[key]) == null ? void 0 : _j.id) || typeof dirtyFields[key] !== "object" && !dirtyFields[key])) {
2723
+ if (id && (typeof dirtyFields?.[key] === "object" && !dirtyFields?.[key]?.id || typeof dirtyFields[key] !== "object" && !dirtyFields[key])) {
2747
2724
  delete data[key];
2748
2725
  } else {
2749
2726
  if (!data[key]) {
2750
2727
  delete data[key];
2751
2728
  } else {
2752
- data[key] = ((_k = formValues == null ? void 0 : formValues[key]) == null ? void 0 : _k.display_name) ? (_l = formValues == null ? void 0 : formValues[key]) == null ? void 0 : _l.id : formValues == null ? void 0 : formValues[key];
2729
+ data[key] = formValues?.[key]?.display_name ? formValues?.[key]?.id : formValues?.[key];
2753
2730
  }
2754
2731
  }
2755
2732
  }
@@ -2758,12 +2735,15 @@ var filterFieldDirty = ({
2758
2735
  };
2759
2736
  var mergeObjects = (object1, object2) => {
2760
2737
  if (!object1 || !object2) return void 0;
2761
- const mergedObject = __spreadValues({}, object2);
2738
+ const mergedObject = { ...object2 };
2762
2739
  Object.keys(object1).forEach((key) => {
2763
2740
  if (Array.isArray(object1[key]) && Array.isArray(object2[key])) {
2764
2741
  mergedObject[key] = object2[key].map((item, index) => {
2765
2742
  if (object1[key][index]) {
2766
- return __spreadValues(__spreadValues({}, item), object1[key][index]);
2743
+ return {
2744
+ ...item,
2745
+ ...object1[key][index]
2746
+ };
2767
2747
  }
2768
2748
  return item;
2769
2749
  });
@@ -2805,15 +2785,14 @@ var removeUndefinedFields = (obj) => {
2805
2785
  return newObj;
2806
2786
  };
2807
2787
  var useTabModel = (viewData, onchangeData) => {
2808
- var _a, _b, _c;
2809
- const tabsData = ((_c = (_b = (_a = viewData == null ? void 0 : viewData.views) == null ? void 0 : _a.form) == null ? void 0 : _b.tabs) == null ? void 0 : _c.filter((val) => {
2788
+ const tabsData = viewData?.views?.form?.tabs?.filter((val) => {
2810
2789
  if (!val) return null;
2811
2790
  const hide = checkDomain(onchangeData, val.invisible);
2812
2791
  if (!hide) {
2813
2792
  return val;
2814
2793
  }
2815
2794
  return false;
2816
- })) || [];
2795
+ }) || [];
2817
2796
  return tabsData;
2818
2797
  };
2819
2798
  var isBase64File = (str) => {
@@ -2854,7 +2833,7 @@ var formatFileSize = (size) => {
2854
2833
  return `${(size / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`;
2855
2834
  };
2856
2835
  var getSubdomain = (url = window.location.href) => {
2857
- const parts = url == null ? void 0 : url.split(".");
2836
+ const parts = url?.split(".");
2858
2837
  if (parts.length > 2) {
2859
2838
  return parts[0].replace("https://", "").replace("http://", "");
2860
2839
  }
@@ -2877,9 +2856,9 @@ var getOffSet = (arr, start, end) => {
2877
2856
  }
2878
2857
  return arr.slice(0, start).length;
2879
2858
  };
2880
- var copyTextToClipboard = (text) => __async(null, null, function* () {
2859
+ var copyTextToClipboard = async (text) => {
2881
2860
  if ("clipboard" in navigator) {
2882
- return yield navigator.clipboard.writeText(text);
2861
+ return await navigator.clipboard.writeText(text);
2883
2862
  } else {
2884
2863
  const textArea = document.createElement("textarea");
2885
2864
  textArea.value = text;
@@ -2893,7 +2872,7 @@ var copyTextToClipboard = (text) => __async(null, null, function* () {
2893
2872
  document.body.removeChild(textArea);
2894
2873
  }
2895
2874
  }
2896
- });
2875
+ };
2897
2876
  var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2898
2877
  if (!originalRequest.data) return originalRequest.data;
2899
2878
  if (typeof originalRequest.data === "string") {
@@ -2929,7 +2908,7 @@ var useField = (props) => {
2929
2908
  index,
2930
2909
  name
2931
2910
  } = props;
2932
- const nameField = rootField ? `${rootField == null ? void 0 : rootField.name}.${index}.${name}` : null;
2911
+ const nameField = rootField ? `${rootField?.name}.${index}.${name}` : null;
2933
2912
  (0, import_react.useEffect)(() => {
2934
2913
  if (onchangeData && Object.keys(onchangeData).length > 0) {
2935
2914
  setRequired(