@k-int/stripes-kint-components 3.0.1 → 3.0.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.0.2 2022-09-29
2
+ * Fixed inconsistency between CustomPropertiesEditCtx and CustomPropertiesViewCtx labelOverrides
3
+
1
4
  ## 3.0.1 2022-09-22
2
5
  * Removed unnecessary validate prop on CustomPropertyField, fixed broken out of range validator
3
6
 
@@ -50,17 +50,19 @@ var CustomPropertiesViewCtx = function CustomPropertiesViewCtx(_ref) {
50
50
  id: 'customProperties',
51
51
  overrideValue: labelOverrides.noContext
52
52
  });
53
- } // Label overrides for specific contexts
54
-
55
-
56
- if (labelOverrides[ctx]) {
57
- return labelOverrides[ctx];
58
- } // Label override for default title or finally built in default
53
+ } // Chain formatKintMessages together using provided fallbackMessage to
54
+ // allow for "If override or translation exists, use it, else use default"
59
55
 
60
56
 
61
57
  return kintIntl.formatKintMessage({
62
- id: 'customProperties.defaultTitle',
63
- overrideValue: labelOverrides.defaultTitle
58
+ id: "customProperties.ctx.".concat(ctx),
59
+ overrideValue: labelOverrides[ctx],
60
+ fallbackMessage: kintIntl.formatKintMessage({
61
+ id: 'customProperties.defaultTitle',
62
+ overrideValue: labelOverrides.defaultTitle
63
+ }, {
64
+ ctx: ctx
65
+ })
64
66
  }, {
65
67
  ctx: ctx
66
68
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k-int/stripes-kint-components",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Stripes Component library for K-Int specific applications",
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -28,16 +28,16 @@ const CustomPropertiesViewCtx = ({
28
28
  );
29
29
  }
30
30
 
31
- // Label overrides for specific contexts
32
- if (labelOverrides[ctx]) {
33
- return labelOverrides[ctx];
34
- }
35
-
36
- // Label override for default title or finally built in default
31
+ // Chain formatKintMessages together using provided fallbackMessage to
32
+ // allow for "If override or translation exists, use it, else use default"
37
33
  return (
38
34
  kintIntl.formatKintMessage({
39
- id: 'customProperties.defaultTitle',
40
- overrideValue: labelOverrides.defaultTitle
35
+ id: `customProperties.ctx.${ctx}`,
36
+ overrideValue: labelOverrides[ctx],
37
+ fallbackMessage: kintIntl.formatKintMessage({
38
+ id: 'customProperties.defaultTitle',
39
+ overrideValue: labelOverrides.defaultTitle
40
+ }, { ctx })
41
41
  }, { ctx })
42
42
  );
43
43
  };