@genesislcap/blank-app-seed 3.30.0-prerelease.49 → 3.30.0-prerelease.50

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.30.0-prerelease.49",
4
+ "version": "3.30.0-prerelease.50",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
@@ -23,13 +23,12 @@ import { gridOptions } from './{{kebabCase tile.title}}.gridOptions';
23
23
  {{/if}}
24
24
 
25
25
  {{#ifAny tile.metadata.comment tile.metadata.todo}}
26
- /*
27
- {{#if tile.metadata.comment}}{{{ tile.metadata.comment }}}{{/if}}
28
- {{~#if tile.metadata.todo}}{{#if tile.metadata.comment}}
29
-
30
- {{/if}}
31
- TODO: {{{ tile.metadata.todo }}}{{/if}}
32
- */
26
+ /**
27
+ {{~#if tile.metadata.comment}}{{{ tile.metadata.comment }}}{{/if}}
28
+ {{~#if tile.metadata.todo}}{{#if tile.metadata.comment}}
29
+ *{{/if}}
30
+ * TODO: {{{ tile.metadata.todo }}}{{/if}}
31
+ */
33
32
  {{/ifAny}}
34
33
 
35
34
  @Component({
@@ -26,13 +26,12 @@ import { gridOptions as gridOptionsTile } from './{{pascalCase tile.title}}GridO
26
26
  import './{{pascalCase tile.title}}Component.css';
27
27
 
28
28
  {{#ifAny tile.metadata.comment tile.metadata.todo}}
29
- /*
30
- {{#if tile.metadata.comment}}{{{ tile.metadata.comment }}}{{/if}}
31
- {{~#if tile.metadata.todo}}{{#if tile.metadata.comment}}
32
-
33
- {{/if}}
34
- TODO: {{{ tile.metadata.todo }}}{{/if}}
35
- */
29
+ /**
30
+ {{~#if tile.metadata.comment}}{{{ tile.metadata.comment }}}{{/if}}
31
+ {{~#if tile.metadata.todo}}{{#if tile.metadata.comment}}
32
+ *{{/if}}
33
+ * TODO: {{{ tile.metadata.todo }}}{{/if}}
34
+ */
36
35
  {{/ifAny}}
37
36
 
38
37
  export const {{pascalCase tile.componentName}}: React.FC = () => {
@@ -4,13 +4,12 @@ import { {{pascalCase tile.title}}Styles as styles } from './{{kebabCase tile.ti
4
4
  import { {{pascalCase tile.title}}Template as template } from './{{kebabCase tile.title}}.template';
5
5
 
6
6
  {{#ifAny tile.metadata.comment tile.metadata.todo}}
7
- /*
8
- {{#if tile.metadata.comment}}{{{ tile.metadata.comment }}}{{/if}}
9
- {{~#if tile.metadata.todo}}{{#if tile.metadata.comment}}
10
-
11
- {{/if}}
12
- TODO: {{{ tile.metadata.todo }}}{{/if}}
13
- */
7
+ /**
8
+ {{~#if tile.metadata.comment}}{{{ tile.metadata.comment }}}{{/if}}
9
+ {{~#if tile.metadata.todo}}{{#if tile.metadata.comment}}
10
+ *{{/if}}
11
+ * TODO: {{{ tile.metadata.todo }}}{{/if}}
12
+ */
14
13
  {{/ifAny}}
15
14
 
16
15
  @customElement({
@@ -3,6 +3,7 @@ const {
3
3
  gridColumnsSerializer,
4
4
  } = require('./gridSerializers');
5
5
  const formatJSONValue = require('./formatJSONValue');
6
+ const { getFormattedComment, getFormattedTodo } = require('./getTodosAndComments')
6
7
  const getLayoutType = require('./getLayoutType');
7
8
  const { COMPONENT_TYPE, FRAMEWORK_ANGULAR_ALIAS } = require('../static');
8
9
 
@@ -19,8 +20,12 @@ const formatRouteData = (framework, route) => {
19
20
  );
20
21
  const tiles = route.tiles?.map((tile, index) => {
21
22
  const config = tile.config || {};
23
+ const metadata = tile.metadata || {};
22
24
  const componentType = COMPONENT_TYPE[tile.type];
23
25
  const componentName = `${route.name}-${tile.title.replace(/[^0-9a-z]/gi, '')}-${componentType}`;
26
+ const todo = metadata?.todo && getFormattedTodo(metadata.todo);
27
+ const comment = metadata?.comment && getFormattedComment(metadata.comment);
28
+
24
29
  const {
25
30
  gridOptions,
26
31
  createFormUiSchema,
@@ -43,6 +48,11 @@ const formatRouteData = (framework, route) => {
43
48
  uischema: formatJSONValue(uischema),
44
49
  columns: gridColumnsSerializer(columns),
45
50
  },
51
+ metadata: {
52
+ ...metadata,
53
+ todo,
54
+ comment
55
+ }
46
56
  };
47
57
  });
48
58
 
@@ -0,0 +1,28 @@
1
+ const MAX_LINE_LENGTH = 100;
2
+
3
+ const wrapText = (text, pad = " ") => {
4
+ let currentLength = 0;
5
+ const formattedText = text.split(" ").map((singleWord) => {
6
+ const lineLength = currentLength + singleWord.length + 1;
7
+ if(lineLength <= MAX_LINE_LENGTH) {
8
+ currentLength = lineLength;
9
+ return singleWord
10
+ } else {
11
+ currentLength = 0;
12
+ return `\n *${pad}${singleWord}`
13
+ }
14
+ }).join(" ")
15
+
16
+ return formattedText;
17
+ }
18
+
19
+ const getFormattedTodo = (todo) =>
20
+ todo.split(/\r?\n/).map((x, index)=> `${index > 0 ? '\n * ' : ''}${wrapText(x.trim())}`).join('');
21
+
22
+ const getFormattedComment = (comment) =>
23
+ comment.split(/\r?\n/).map(x => `\n * ${wrapText(x.trim(), " ")}`).join('');
24
+
25
+ module.exports = {
26
+ getFormattedComment,
27
+ getFormattedTodo
28
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.30.0-prerelease.50](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.30.0-prerelease.49...v3.30.0-prerelease.50) (2024-11-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * align UI todo/comment code generation output with server code GENC-898 (#394) 7b4b3fa
9
+
3
10
  ## [3.30.0-prerelease.49](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.30.0-prerelease.48...v3.30.0-prerelease.49) (2024-11-27)
4
11
 
5
12
 
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.30.0-prerelease.49",
4
+ "version": "3.30.0-prerelease.50",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"