@trackunit/custom-field-components 0.0.109 → 0.0.110

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.
Files changed (2) hide show
  1. package/index.js +10 -2
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -2447,7 +2447,7 @@ const getPhoneNumberValidationRules = definition => {
2447
2447
  };
2448
2448
 
2449
2449
  const useCustomFieldResolver = (field, validation, unitPreference = "SI", fieldId) => {
2450
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
2450
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
2451
2451
 
2452
2452
  if ((field === null || field === void 0 ? void 0 : field.definition) === undefined || ((_a = field === null || field === void 0 ? void 0 : field.definition) === null || _a === void 0 ? void 0 : _a.type) === undefined) {
2453
2453
  return null;
@@ -2600,10 +2600,18 @@ const useCustomFieldResolver = (field, validation, unitPreference = "SI", fieldI
2600
2600
  const typedDefinition = field.definition;
2601
2601
  const typedValue = field.value;
2602
2602
  const rules = getDateValidationRules();
2603
+ let defaultValue;
2604
+
2605
+ if (typedValue.dateValue !== undefined && typedValue.dateValue !== null && typedValue.dateValue !== "") {
2606
+ defaultValue = new Date(typedValue.dateValue);
2607
+ } else if (typedDefinition.defaultDateValue !== undefined && typedDefinition.defaultDateValue !== null && typedDefinition.defaultDateValue !== "") {
2608
+ defaultValue = new Date(typedDefinition.defaultDateValue);
2609
+ }
2610
+
2603
2611
  return jsx(DateCustomField, {
2604
2612
  dataTestId: "dateField",
2605
2613
  id: key || "date-field",
2606
- defaultValue: (_3 = (_2 = typedValue.dateValue) !== null && _2 !== void 0 ? _2 : typedDefinition.defaultDateValue) !== null && _3 !== void 0 ? _3 : undefined,
2614
+ defaultValue: defaultValue,
2607
2615
  readOnly: !typedDefinition.uiEditable,
2608
2616
  register: validation.register,
2609
2617
  label: typedDefinition.title || "",
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@trackunit/custom-field-components",
3
- "version": "0.0.109",
3
+ "version": "0.0.110",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
7
- "@trackunit/react-core-contexts-test": "0.0.32",
7
+ "@trackunit/react-core-contexts-test": "0.0.33",
8
8
  "@trackunit/react-components": "0.0.124",
9
9
  "react": "17.0.1",
10
10
  "react-hook-form": "^7.29.0",
11
- "@trackunit/iris-app-runtime-core": "0.0.62",
12
- "@trackunit/iris-app-runtime-core-api": "0.0.60",
11
+ "@trackunit/iris-app-runtime-core": "0.0.63",
12
+ "@trackunit/iris-app-runtime-core-api": "0.0.61",
13
13
  "react-select": "^5.4.0",
14
14
  "libphonenumber-js": "^1.10.7"
15
15
  },