@genesislcap/blank-app-seed 3.0.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.
- package/.genx/package.json +1 -1
- package/.genx/templates/entityManager.hbs +2 -0
- package/.genx/templates/grid.hbs +4 -1
- package/.genx/templates/route.template.hbs +1 -3
- package/.genx/utils.js +18 -2
- package/CHANGELOG.md +14 -0
- package/client/package.json +1 -0
- package/client/src/utils/formatters.ts +14 -0
- package/client/src/utils/index.ts +1 -0
- package/package.json +1 -1
package/.genx/package.json
CHANGED
package/.genx/templates/grid.hbs
CHANGED
|
@@ -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 (
|
|
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:
|
|
109
|
+
columns: gridColumnsSerializer(tile.config?.columns)
|
|
94
110
|
}
|
|
95
111
|
}));
|
|
96
112
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
10
|
+
## [3.1.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.0.0...v3.1.0) (2024-04-22)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* enable cell/row flashing in grids GENC-311 (#188) 9cce9df
|
|
16
|
+
|
|
3
17
|
## [3.0.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.11.1...v3.0.0) (2024-04-22)
|
|
4
18
|
|
|
5
19
|
|
package/client/package.json
CHANGED
|
@@ -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
|
+
}
|