@genesislcap/blank-app-seed 3.1.0 → 3.2.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "3.1.0",
4
+ "version": "3.2.0",
5
5
  "license": "Apache-2.0",
6
6
  "genxSeedConfig": {
7
7
  "exclude": [
@@ -1,7 +1,5 @@
1
1
  import { html } from '@microsoft/fast-element';
2
- {{#if route.FDC3EventHandlersEnabled}}
3
- import { sendEventOnChannel } from '../../utils';
4
- {{/if}}
2
+ import { getNumberFormatter{{#if route.FDC3EventHandlersEnabled}}, sendEventOnChannel{{/if}} } from '../../utils';
5
3
  import type { {{pascalCase route.name}} } from './{{kebabCase route.name}}';
6
4
 
7
5
  export const {{pascalCase route.name}}Template = html<{{pascalCase route.name}}>`
package/.genx/utils.js CHANGED
@@ -45,9 +45,13 @@ const gridOptionsSerializer = (options, pad = ' ') => {
45
45
  let output = `{\n`;
46
46
  Object.keys(options).forEach((key) => {
47
47
  const value = options[key];
48
- if (value?.type === 'function') {
48
+ if (key === 'columns') {
49
+ output += `${pad}${'columnDefs'}: ${gridColumnsSerializer(value)},\n`;
50
+ } else if (value?.type === 'function' || value?.type === 'valueFormatter') {
49
51
  const args = value.arguments?.map(JSON.stringify).join(', ');
50
52
  output += `${pad}${key}: ${value.name}(${args}),\n`;
53
+ } else if (key === 'hide') {
54
+ output += `${pad}${key}: ${value},\n`;
51
55
  } else {
52
56
  output += `${pad}${key}: ${formatJSONValue(value)},\n`;
53
57
  }
@@ -59,6 +63,18 @@ const gridOptionsSerializer = (options, pad = ' ') => {
59
63
  }
60
64
  };
61
65
 
66
+ const gridColumnsSerializer = (columns, pad = ' ') => {
67
+ if (!columns) {
68
+ return undefined;
69
+ }
70
+ try {
71
+ const columnsSerialized = columns.map((column) => gridOptionsSerializer(column));
72
+ return `[\n${pad}${columnsSerialized}]`;
73
+ } catch (e) {
74
+ return undefined;
75
+ }
76
+ }
77
+
62
78
  const validateRoute = (route) => {
63
79
  if (!route.name) {
64
80
  console.warn('Invalid route - missing name', route);
@@ -90,7 +106,7 @@ const formatRouteData = (route) => {
90
106
  createFormUiSchema: formatJSONValue(tile.config?.createFormUiSchema),
91
107
  updateFormUiSchema: formatJSONValue(tile.config?.updateFormUiSchema),
92
108
  uischema: formatJSONValue(tile.config?.uischema),
93
- columns: formatJSONValue(tile.config?.columns)
109
+ columns: gridColumnsSerializer(tile.config?.columns)
94
110
  }
95
111
  }));
96
112
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.2.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.1.0...v3.2.0) (2024-04-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * add support for number formatting GENC-265 (#189) cf6aeae
9
+
3
10
  ## [3.1.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.0.0...v3.1.0) (2024-04-22)
4
11
 
5
12
 
@@ -111,6 +111,7 @@
111
111
  "@microsoft/fast-foundation": "^2.33.4",
112
112
  "@microsoft/fast-router": "^0.4.2",
113
113
  "@microsoft/fast-web-utilities": "^5.1.0",
114
+ "numeral": "2.0.6",
114
115
  "rxjs": "^7.5.4",
115
116
  "tslib": "^2.3.1"
116
117
  },
@@ -0,0 +1,14 @@
1
+ import Numeral from 'numeral';
2
+ import 'numeral/locales';
3
+
4
+ export function getNumberFormatter(format: string, locale?: string) {
5
+ return (params) => {
6
+ if (!(params && typeof params.value === 'number')) return '';
7
+
8
+ if (locale) {
9
+ Numeral.locale(locale);
10
+ }
11
+
12
+ return Numeral(params.value).format(format);
13
+ };
14
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './fdc3';
2
+ export * from './formatters';
2
3
  export * from './logger';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "3.1.0",
4
+ "version": "3.2.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"