@magic-xpa/cli 4.1300.0-dev4130.26 → 4.1300.0-dev4130.260

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 (70) hide show
  1. package/package.json +1 -1
  2. package/src/schematics/magic-utils/Util.js +2 -1
  3. package/src/schematics/magic-utils/Util.js.map +1 -1
  4. package/src/schematics/magic-utils/config.js +2 -2
  5. package/src/schematics/magic-utils/config.js.map +1 -1
  6. package/src/schematics/magic-utils/config.ts +2 -2
  7. package/src/schematics/magic-utils/env.js +12 -11
  8. package/src/schematics/magic-utils/env.js.map +1 -1
  9. package/src/schematics/magic-utils/env.ts +16 -15
  10. package/src/schematics/magic-utils/metadata.class.js +1 -1
  11. package/src/schematics/magic-utils/metadata.class.js.map +1 -1
  12. package/src/schematics/magic-utils/metadata.class.ts +1 -1
  13. package/src/schematics/magic-utils/rules/build-control.rule.js +3 -2
  14. package/src/schematics/magic-utils/rules/build-control.rule.js.map +1 -1
  15. package/src/schematics/magic-utils/rules/component-list.rule.js +3 -2
  16. package/src/schematics/magic-utils/rules/component-list.rule.js.map +1 -1
  17. package/src/schematics/magic-utils/rules/generate.rule.js +3 -2
  18. package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
  19. package/src/schematics/mg-add/files/src/app/app.routes.ts +2 -1
  20. package/src/schematics/mg-add/files/src/app/custom.routes.ts +23 -0
  21. package/src/schematics/mg-add/files/src/app/magic/magic.gen.lib.module.ts +6 -7
  22. package/src/schematics/mg-add/index.js +129 -10
  23. package/src/schematics/mg-add/index.js.map +1 -1
  24. package/src/schematics/mg-add/index.ts +149 -10
  25. package/src/schematics/mg-add/webModule/app.routes.ts +2 -1
  26. package/src/schematics/mg-add/webModule/custom.routes.ts +23 -0
  27. package/src/schematics/mg-routes/index.js +13 -4
  28. package/src/schematics/mg-routes/index.js.map +1 -1
  29. package/src/schematics/mg-routes/index.ts +16 -5
  30. package/src/schematics/utils/ast.js +2 -1
  31. package/src/schematics/utils/ast.js.map +1 -1
  32. package/src/schematics/utils/devkit-utils/ast-utils.js +2 -1
  33. package/src/schematics/utils/devkit-utils/ast-utils.js.map +1 -1
  34. package/src/schematics/utils/devkit-utils/ast-utils_old.js +2 -1
  35. package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
  36. package/src/schematics/utils/devkit-utils/component.js +2 -1
  37. package/src/schematics/utils/devkit-utils/component.js.map +1 -1
  38. package/src/schematics/utils/devkit-utils/ng-ast-utils.js +2 -1
  39. package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
  40. package/src/schematics/utils/devkit-utils/route-utils.js +2 -1
  41. package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
  42. package/src/schematics/utils/html.js +2 -1
  43. package/src/schematics/utils/html.js.map +1 -1
  44. package/templates/angular/src/{app.module.ts → app-module.ts} +3 -3
  45. package/templates/angular/src/app.routes.ts +2 -0
  46. package/templates/angular/src/{app.component.ts → app.ts} +1 -1
  47. package/templates/angular/src/custom.routes.ts +23 -0
  48. package/templates/attributes/common/row_editing_button_attributes.ejs +2 -2
  49. package/templates/component/view.component.ts +5 -56
  50. package/templates/themes/basicHTML/combobox.ejs +10 -7
  51. package/templates/themes/basicHTML/edit.ejs +20 -10
  52. package/templates/themes/basicHTML/image.ejs +3 -2
  53. package/templates/themes/basicHTML/listbox.ejs +3 -4
  54. package/templates/themes/basicHTML/push-button.ejs +0 -1
  55. package/templates/themes/basicHTML/radio.ejs +24 -3
  56. package/templates/themes/basicHTML/tab.ejs +3 -1
  57. package/templates/themes/basicHiddenHTML/radio.ejs +3 -2
  58. package/templates/themes/basicHiddenHTML/table.ejs +7 -3
  59. package/templates/themes/container.ejs +12 -1
  60. package/templates/themes/material/combobox.ejs +12 -7
  61. package/templates/themes/material/edit.ejs +32 -28
  62. package/templates/themes/material/listbox.ejs +3 -4
  63. package/templates/themes/material/push-button.ejs +0 -1
  64. package/templates/themes/material/radio.ejs +29 -12
  65. package/templates/themes/material/tab.ejs +3 -1
  66. package/templates/themes/table/HTMLTable/table.ejs +7 -3
  67. package/templates/themes/table/repeatable/table.ejs +7 -3
  68. package/tsconfig.json +2 -0
  69. /package/src/schematics/mg-add/files/src/app/{app.component.html → app.html} +0 -0
  70. /package/templates/angular/src/app/{app.component.html.ejs → app.html.ejs} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"route-utils.js","sourceRoot":"","sources":["route-utils.ts"],"names":[],"mappings":";;AAuBA,sCAwEC;AAGD,oCAmEC;AArKD;;;;;;GAMG;AACH,iCAAiC;AACjC,2CAA6E;AAC7E,qCAA4D;AAC5D,2DAAqE;AAGrE;;;;;;;;EAQE;AAEF,SAAgB,aAAa,CAC3B,MAA2B,EAC3B,UAAoB,EACpB,UAAoB,EACpB,YAAoB,EACpB,QAAoB,EACpB,SAAS,GAAG,KAAK;IACjB,MAAM,QAAQ,GAAG,MAAM,CAAC;IACxB,MAAM,UAAU,GAAG,IAAA,qBAAS,EAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAExE,iEAAiE;IACjE,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC/C,qFAAqF;QACrF,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE;aACnC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC;aAC3D,GAAG,CAAC,CAAC,CAAC,EAAE,CAAE,CAAsB,CAAC,IAAI,CAAC,CAAC;QAE1C,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,IAAI,eAAe,GAAG,KAAK,CAAC;QAC5B,2BA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AAI,GAAG,UAAU,GAAG,KAAK,EAAE;QAChE,UAAU,QAAQ,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAEzD,OAAO,IAAA,qCAAyB,EAC9B,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,EAAE,CAAC,UAAU,CAAC,aAAa,CAC5B,CAAC;AACJ,CAAC;AAID,SAAS,aAAa,CAAC,IAAU,EAAE,IAAY;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,gCAAmB,CAAC,kBAAkB,IAAI,GAAG,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEhF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport * as ts from 'typescript';\nimport { findNode, findNodes, insertAfterLastOccurrence } from \"./ast-utils\";\nimport { Change, InsertChange, NoopChange } from \"./change\";\nimport {SchematicsException, Tree} from \"@angular-devkit/schematics\";\n\n\n/**\n* Add Import `import { symbolName } from fileName` if the import doesn't exit\n* already. Assumes fileToEdit can be resolved and accessed.\n* @param fileToEdit (file we want to add import to)\n* @param symbolName (item to import)\n* @param fileName (path to the file)\n* @param isDefault (if true, import follows style for importing default exports)\n* @return Change\n*/\n\nexport function insertImport2(\n source : ts.SourceFile,\n fileToEdit : string,\n symbolName : string,\n asSymbolName: string,\n fileName : string,\n isDefault = false): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter(node => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node.getChildren()\n .filter(child => child.kind === ts.SyntaxKind.StringLiteral)\n .map(n => (n as ts.StringLiteral).text);\n\n return importFiles.filter(file => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach(n => {\n Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(n => (n as ts.Identifier).text === symbolName);\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(imports, `, ${symbolName} as ${asSymbolName}`, fileToEdit, fallbackPos);\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral)\n .filter((n: ts.StringLiteral) => n.text === 'use strict');\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert = `${separator}import ${open}${symbolName} as ${asSymbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral,\n );\n}\n\n\nexport function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string,\n fileName: string, isDefault = false): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter(node => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node.getChildren()\n .filter(child => child.kind === ts.SyntaxKind.StringLiteral)\n .map(n => (n as ts.StringLiteral).text);\n\n return importFiles.filter(file => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach(n => {\n Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(n => (n as ts.Identifier).text === symbolName);\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(imports, `, ${symbolName}`, fileToEdit, fallbackPos);\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral)\n .filter((n: ts.StringLiteral) => n.text === 'use strict');\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert = `${separator}import ${open}${symbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral,\n );\n}\n\n\n\nfunction getSourceFile(host: Tree, path: string): ts.SourceFile {\n const buffer = host.read(path);\n if (!buffer) {\n throw new SchematicsException(`Could not find ${path}.`);\n }\n const content = buffer.toString();\n const source = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n\n return source;\n}\n\n"]}
1
+ {"version":3,"file":"route-utils.js","sourceRoot":"","sources":["route-utils.ts"],"names":[],"mappings":";;AAuBA,sCAwEC;AAGD,oCAmEC;;AArKD;;;;;;GAMG;AACH,uDAAiC;AACjC,2CAA6E;AAC7E,qCAA4D;AAC5D,2DAAqE;AAGrE;;;;;;;;EAQE;AAEF,SAAgB,aAAa,CAC3B,MAA2B,EAC3B,UAAoB,EACpB,UAAoB,EACpB,YAAoB,EACpB,QAAoB,EACpB,SAAS,GAAG,KAAK;IACjB,MAAM,QAAQ,GAAG,MAAM,CAAC;IACxB,MAAM,UAAU,GAAG,IAAA,qBAAS,EAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAExE,iEAAiE;IACjE,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC/C,qFAAqF;QACrF,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE;aACnC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC;aAC3D,GAAG,CAAC,CAAC,CAAC,EAAE,CAAE,CAAsB,CAAC,IAAI,CAAC,CAAC;QAE1C,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,IAAI,eAAe,CAAC,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AE,CAAC,CAAC,CAAC,KAAK,CAAC;IACjD,MAAM,QAAQ,GAAG,GAAG,SAAS,UAAU,IAAI,GAAG,UAAU,GAAG,KAAK,EAAE;QAChE,UAAU,QAAQ,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAEzD,OAAO,IAAA,qCAAyB,EAC9B,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,EAAE,CAAC,UAAU,CAAC,aAAa,CAC5B,CAAC;AACJ,CAAC;AAID,SAAS,aAAa,CAAC,IAAU,EAAE,IAAY;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,gCAAmB,CAAC,kBAAkB,IAAI,GAAG,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEhF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport * as ts from 'typescript';\nimport { findNode, findNodes, insertAfterLastOccurrence } from \"./ast-utils\";\nimport { Change, InsertChange, NoopChange } from \"./change\";\nimport {SchematicsException, Tree} from \"@angular-devkit/schematics\";\n\n\n/**\n* Add Import `import { symbolName } from fileName` if the import doesn't exit\n* already. Assumes fileToEdit can be resolved and accessed.\n* @param fileToEdit (file we want to add import to)\n* @param symbolName (item to import)\n* @param fileName (path to the file)\n* @param isDefault (if true, import follows style for importing default exports)\n* @return Change\n*/\n\nexport function insertImport2(\n source : ts.SourceFile,\n fileToEdit : string,\n symbolName : string,\n asSymbolName: string,\n fileName : string,\n isDefault = false): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter(node => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node.getChildren()\n .filter(child => child.kind === ts.SyntaxKind.StringLiteral)\n .map(n => (n as ts.StringLiteral).text);\n\n return importFiles.filter(file => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach(n => {\n Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(n => (n as ts.Identifier).text === symbolName);\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(imports, `, ${symbolName} as ${asSymbolName}`, fileToEdit, fallbackPos);\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral)\n .filter((n: ts.StringLiteral) => n.text === 'use strict');\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert = `${separator}import ${open}${symbolName} as ${asSymbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral,\n );\n}\n\n\nexport function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string,\n fileName: string, isDefault = false): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter(node => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node.getChildren()\n .filter(child => child.kind === ts.SyntaxKind.StringLiteral)\n .map(n => (n as ts.StringLiteral).text);\n\n return importFiles.filter(file => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach(n => {\n Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(n => (n as ts.Identifier).text === symbolName);\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(imports, `, ${symbolName}`, fileToEdit, fallbackPos);\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral)\n .filter((n: ts.StringLiteral) => n.text === 'use strict');\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert = `${separator}import ${open}${symbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral,\n );\n}\n\n\n\nfunction getSourceFile(host: Tree, path: string): ts.SourceFile {\n const buffer = host.read(path);\n if (!buffer) {\n throw new SchematicsException(`Could not find ${path}.`);\n }\n const content = buffer.toString();\n const source = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n\n return source;\n}\n\n"]}
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getHeadTag = getHeadTag;
4
4
  exports.addHeadLink = addHeadLink;
5
+ const tslib_1 = require("tslib");
5
6
  const schematics_1 = require("@angular-devkit/schematics");
6
- const parse5 = require("parse5");
7
+ const parse5 = tslib_1.__importStar(require("parse5"));
7
8
  const ast_1 = require("./ast");
8
9
  const change_1 = require("./devkit-utils/change");
9
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["html.ts"],"names":[],"mappings":";;AAWA,gCA2BC;AASD,kCAeC;AA9DD,2DAAqE;AACrE,iCAAiC;AACjC,+BAAuC;AACvC,kDAAmD;AAGnD;;;;GAIG;AACH,SAAgB,UAAU,CAAC,IAAU,EAAE,GAAW;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAC/B,EAAC,YAAY,EAAE,IAAI,EAAC,CAAgC,CAAC;IAEvD,IAAI,IAAI,CAAC;IACT,MAAM,KAAK,GAAG,CAAC,KAAgC,EAAE,EAAE;QACjD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,MAAM,OAAO,GAA+B,IAAI,CAAC;YACjD,IAAI,OAAO,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;gBAC/B,IAAI,GAAG,OAAO,CAAC;YACjB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AAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["import {Tree, SchematicsException} from '@angular-devkit/schematics';\nimport * as parse5 from 'parse5';\nimport {getIndexHtmlPath} from './ast';\nimport {InsertChange} from './devkit-utils/change';\nimport {Project} from './devkit-utils/config';\n\n/**\n * Parses the index.html file to get the HEAD tag position.\n * @param host the tree we are traversing\n * @param src the src path of the html file to parse\n */\nexport function getHeadTag(host: Tree, src: string) {\n const document = parse5.parse(src,\n {locationInfo: true}) as parse5.AST.Default.Document;\n\n let head;\n const visit = (nodes: parse5.AST.Default.Node[]) => {\n nodes.forEach(node => {\n const element = <parse5.AST.Default.Element>node;\n if (element.tagName === 'head') {\n head = element;\n } else {\n if (element.childNodes) {\n visit(element.childNodes);\n }\n }\n });\n };\n\n visit(document.childNodes);\n\n if (!head) {\n throw new SchematicsException('Head element not found!');\n }\n\n return {\n position: head.__location.startTag.endOffset\n };\n}\n\n/**\n * Adds a link to the index.html head tag Example:\n * `<link href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500\" rel=\"stylesheet\">`\n * @param host The tree we are updating\n * @param project The project we're targeting.\n * @param link html element string we are inserting.\n */\nexport function addHeadLink(host: Tree, project: Project, link: string) {\n const indexPath = getIndexHtmlPath(host, project);\n const buffer = host.read(indexPath);\n if (!buffer) {\n throw new SchematicsException(`Could not find file for path: ${indexPath}`);\n }\n\n const src = buffer.toString();\n if (src.indexOf(link) === -1) {\n const node = getHeadTag(host, src);\n const insertion = new InsertChange(indexPath, node.position, link);\n const recorder = host.beginUpdate(indexPath);\n recorder.insertLeft(insertion.pos, insertion.toAdd);\n host.commitUpdate(recorder);\n }\n}\n"]}
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["html.ts"],"names":[],"mappings":";;AAWA,gCA2BC;AASD,kCAeC;;AA9DD,2DAAqE;AACrE,uDAAiC;AACjC,+BAAuC;AACvC,kDAAmD;AAGnD;;;;GAIG;AACH,SAAgB,UAAU,CAAC,IAAU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CAAC,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACnC,MAAM,SAAS,GAAG,IAAI,qBAAY,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC7C,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["import {Tree, SchematicsException} from '@angular-devkit/schematics';\nimport * as parse5 from 'parse5';\nimport {getIndexHtmlPath} from './ast';\nimport {InsertChange} from './devkit-utils/change';\nimport {Project} from './devkit-utils/config';\n\n/**\n * Parses the index.html file to get the HEAD tag position.\n * @param host the tree we are traversing\n * @param src the src path of the html file to parse\n */\nexport function getHeadTag(host: Tree, src: string) {\n const document = parse5.parse(src,\n {locationInfo: true}) as parse5.AST.Default.Document;\n\n let head;\n const visit = (nodes: parse5.AST.Default.Node[]) => {\n nodes.forEach(node => {\n const element = <parse5.AST.Default.Element>node;\n if (element.tagName === 'head') {\n head = element;\n } else {\n if (element.childNodes) {\n visit(element.childNodes);\n }\n }\n });\n };\n\n visit(document.childNodes);\n\n if (!head) {\n throw new SchematicsException('Head element not found!');\n }\n\n return {\n position: head.__location.startTag.endOffset\n };\n}\n\n/**\n * Adds a link to the index.html head tag Example:\n * `<link href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500\" rel=\"stylesheet\">`\n * @param host The tree we are updating\n * @param project The project we're targeting.\n * @param link html element string we are inserting.\n */\nexport function addHeadLink(host: Tree, project: Project, link: string) {\n const indexPath = getIndexHtmlPath(host, project);\n const buffer = host.read(indexPath);\n if (!buffer) {\n throw new SchematicsException(`Could not find file for path: ${indexPath}`);\n }\n\n const src = buffer.toString();\n if (src.indexOf(link) === -1) {\n const node = getHeadTag(host, src);\n const insertion = new InsertChange(indexPath, node.position, link);\n const recorder = host.beginUpdate(indexPath);\n recorder.insertLeft(insertion.pos, insertion.toAdd);\n host.commitUpdate(recorder);\n }\n}\n"]}
@@ -2,7 +2,7 @@ import {BrowserModule} from '@angular/platform-browser';
2
2
  import {NgModule} from '@angular/core';
3
3
  import {ReactiveFormsModule} from '@angular/forms';
4
4
 
5
- import {AppComponent} from './app.component';
5
+ import {App} from './app';
6
6
  import {DynamicModule} from 'ng-dynamic-component';
7
7
  import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
8
8
  import {ComponentArray, compHash, title} from './component-list.g';
@@ -30,7 +30,7 @@ import {MagicModule,ComponentListMagicService} from '@magic-xpa/angular';
30
30
 
31
31
 
32
32
  @NgModule({
33
- declarations: [AppComponent, ...ComponentArray],
33
+ declarations: [App, ...ComponentArray],
34
34
  imports: [
35
35
  // Angular modules
36
36
  BrowserModule,
@@ -59,7 +59,7 @@ import {MagicModule,ComponentListMagicService} from '@magic-xpa/angular';
59
59
  InfiniteScrollDirective,
60
60
  DynamicModule.withComponents(ComponentArray)
61
61
  ],
62
- bootstrap: [AppComponent],
62
+ bootstrap: [App],
63
63
  })
64
64
  export class AppModule {
65
65
  constructor(componentList:ComponentListMagicService) {
@@ -1,10 +1,12 @@
1
1
  import {Routes, RouterModule} from '@angular/router';
2
2
  import {RouterContainerMagicComponent} from "@magic-xpa/angular";
3
+ import {customRoutes} from './custom.routes';
3
4
 
4
5
  import { CommonModule } from "@angular/common";
5
6
  import { NgModule } from '@angular/core';
6
7
 
7
8
  export const routes: Routes = [
9
+ ...customRoutes,
8
10
  <%- startRanderForRootModule (createRootRoute); -%>
9
11
  <%- renderRoutes (routesArray, createRootRoute); -%>
10
12
  <%- endRanderForRootModule (createRootRoute); -%>
@@ -12,5 +12,5 @@ declare let myExtObject: any;
12
12
  `,
13
13
  standalone: false,
14
14
  })
15
- export class AppComponent {
15
+ export class App {
16
16
  }
@@ -0,0 +1,23 @@
1
+ import { Routes } from '@angular/router';
2
+ import { RouterContainerMagicComponent } from "@magic-xpa/angular";
3
+
4
+ /**
5
+ * Custom Routes
6
+ * =============
7
+ * Add your custom/manual routes in this file.
8
+ *
9
+ * IMPORTANT: This file is NOT affected by CLI route regeneration.
10
+ * The generated app.routes.ts automatically imports these routes.
11
+ *
12
+ * Custom routes are placed BEFORE generated routes in the final
13
+ * routes array, so they take PRIORITY when paths conflict.
14
+ *
15
+ * Example:
16
+ * {
17
+ * path: 'callPublic/:name',
18
+ * component: RouterContainerMagicComponent,
19
+ * },
20
+ */
21
+ export const customRoutes: Routes = [
22
+
23
+ ];
@@ -1,10 +1,10 @@
1
1
  <% if (ctrl.props.is_table_child && ctrl.controlType === MgControlType.CTRL_TYPE_BUTTON) {%>
2
2
  <% if ( ctrl.props.row_editing_type && ctrl.props.row_editing_type !== RowEditingTypes.NoneRowEditing) {%>
3
3
  <% if ( ctrl.props.row_editing_type === RowEditingTypes.EnterRowEditing) {%>
4
- *ngIf="!mg.isRowInRowEditing(row)"
4
+ [hidden]="mg.isRowInRowEditing(row)"
5
5
  <%}%>
6
6
  <% if ( ctrl.props.row_editing_type === RowEditingTypes.SaveRowEditing || ctrl.props.row_editing_type === RowEditingTypes.CancelRowEditing) {%>
7
- *ngIf="mg.isRowInRowEditing(row)"
7
+ [hidden]="!mg.isRowInRowEditing(row)"
8
8
  <%}%>
9
9
  <%}%>
10
10
  <%}%>
@@ -25,9 +25,8 @@ import { MgDisplayedColumns} from "./<%- id %>.mg.controls.g";
25
25
  <% } else {%>
26
26
  import {TaskBaseMagicComponent, magicProviders} from "@magic-xpa/angular";
27
27
  <%}%>
28
- <% if(isModal) { %>
29
- import {MagicModalInterface} from "@magic-xpa/angular";
30
- <%}%>
28
+ import {MagicModalProperties} from "@magic-xpa/angular";
29
+ <%= '\n' %>
31
30
 
32
31
  @Component({
33
32
  selector: '<%= selector %>',
@@ -36,9 +35,11 @@ import { MgDisplayedColumns} from "./<%- id %>.mg.controls.g";
36
35
  templateUrl: './<%- id %>.component.html'
37
36
  })
38
37
 
39
- export class <%- id %> extends <% if(useMatGrid) { %> BaseMatTableMagicComponent <% } else {%> TaskBaseMagicComponent <%}%> <% if(isModal) { %> implements MagicModalInterface <% }%>
38
+ export class <%- id %> extends <% if(useMatGrid) { %> BaseMatTableMagicComponent <% } else {%> TaskBaseMagicComponent <%}%>
40
39
 
41
40
  {
41
+ magicModalProperties: MagicModalProperties = new MagicModalProperties("<%- id %>", true, 0, 0, "300px", "300px", true, true, true, true);
42
+
42
43
  <% if(!magicConfig.no_controls_accessor) { %>
43
44
  mgc = MgControlName;
44
45
  mgcp = MgCustomProperties;
@@ -55,58 +56,6 @@ export class <%- id %> extends <% if(useMatGrid) { %> BaseMatTableMagicComponen
55
56
  }
56
57
  <%}-%>
57
58
 
58
- <% if(isModal) { -%>
59
- private static readonly formName: string = "<%- id %>";
60
- private static readonly showTitleBar: boolean = true;
61
- private static readonly x: number = 0;
62
- private static readonly y: number = 0;
63
- private static readonly width: string = "300px";
64
- private static readonly height: string = "300px";
65
- private static readonly isCenteredToWindow: boolean = true;
66
- private static readonly shouldCloseOnBackgroundClick: boolean = true;
67
- private static readonly isResizable: boolean = true;
68
- private static readonly isMovable: boolean = true;
69
-
70
- X() {
71
- return <%- id %>.x;
72
- }
73
-
74
- Y() {
75
- return <%- id %>.y;
76
- }
77
-
78
- Width(): string {
79
- return <%- id %>.width;
80
- }
81
-
82
- Height(): string {
83
- return <%- id %>.height;
84
- }
85
-
86
- IsCenteredToWindow() {
87
- return <%- id %>.isCenteredToWindow;
88
- }
89
-
90
- FormName() {
91
- return <%- id %>.formName;
92
- }
93
-
94
- ShowTitleBar() {
95
- return <%- id %>.showTitleBar;
96
- }
97
-
98
- ShouldCloseOnBackgroundClick() {
99
- return <%- id %>.shouldCloseOnBackgroundClick;
100
- }
101
-
102
- IsResizable() {
103
- return <%- id %>.isResizable;
104
- }
105
-
106
- IsMovable() {
107
- return <%- id %>.isMovable;
108
- }
109
- <%}-%>
110
59
  <% if(useMatGrid) { -%>
111
60
  override displayedColumns = this.mgdp;
112
61
  <%}-%>
@@ -6,32 +6,35 @@
6
6
 
7
7
  <%# show combo box in table only while we on row edit %>
8
8
  <% if (ctrl.props.is_table_child) { %>
9
- <div *ngIf="mg.isRowInRowEditing(row)">
9
+ @if (mg.isRowInRowEditing(row)) {
10
+ <div>
10
11
  <%}%>
11
12
  <select
12
13
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>
13
14
  <%- include('../../attributes/common/base/formControlName', {ctrl : ctrl}) %>
14
15
  <% if (ctrl.props.must_input && !ctrl.props.must_input.has_exp) { %> required <%}%>
15
16
  >
16
- <option
17
- *ngFor="let o of mg.getItemListValues(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>);"
18
- [selected]="o.index == mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)"
19
- [value] = "o.index"
20
- >
17
+ @for (o of mg.getItemListValues(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>); track $index) {
18
+ <option [selected]="o.index == mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)"
19
+ [value] = "o.index">
21
20
  {{o.displayValue}}
22
21
  </option>
22
+ }
23
23
  </select>
24
24
  <% if (ctrl.props.must_input || ctrl.props.validator != null) {%>
25
25
  <mgError [magic]=<%- ctrl.props.directive_id %>> </mgError>
26
26
  <%}%>
27
27
  <% if (ctrl.props.is_table_child) { %>
28
28
  </div>
29
+ }
29
30
 
30
31
  <%# show lable in table only while we on row read only %>
31
- <div *ngIf="!mg.isRowInRowEditing(row)">
32
+ @if (!mg.isRowInRowEditing(row)) {
33
+ <div>
32
34
  <label <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
33
35
  {{ mg.getDisplayValue(<%- ctrl.props.enum_id %>, row.rowId) }}
34
36
  </label>
35
37
  </div>
38
+ }
36
39
  <%}%>
37
40
  </div>
@@ -8,7 +8,8 @@
8
8
  <div >
9
9
  <% if (ctrl.style && ctrl.style.multiline_edit ){ %>
10
10
 
11
- <textarea *ngIf="mg.isRowInRowEditing(row)"
11
+ @if (mg.isRowInRowEditing(row)) {
12
+ <textarea
12
13
  type="text"
13
14
  <%- include('../../attributes/common/base/formControlName', {ctrl : ctrl}) %>
14
15
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>
@@ -20,20 +21,21 @@
20
21
  <% if (ctrl.props.validator) { %><%- ctrl.props.validator %><%}%>
21
22
  >
22
23
  </textarea>
24
+ }
23
25
 
24
26
  <% } else { %>
27
+ <% if(ctrl.props.is_table_child){ %>
28
+ @if (mg.isRowInRowEditing(row)) {
29
+ <%}%>
25
30
  <input
26
31
  <% if (ctrl.props.show_zoom_button ){ %>
27
32
  style="width: 70%"
28
33
  <% } %>
29
34
  <%- include('../../attributes/common/base/formControlName', {ctrl : ctrl}) %>
30
- <% if(ctrl.props.is_table_child){ %>
31
- *ngIf="mg.isRowInRowEditing(row)"
32
- <%}%>
33
35
 
34
36
  <% if (ctrl.props.attribute == StorageAttributeType.Numeric) { %>
35
37
  <% if (ctrl.props.currency) { %>
36
- currencyMask [options]="mg.getNumericPicture(mg.getPicture(<%- ctrl.props.enum_id %>))"
38
+ [currencyMask]="mg.getNumericPicture(mg.getPicture(<%- ctrl.props.enum_id %>))"
37
39
  <% } else { %>
38
40
  type='number'
39
41
  <% } %>
@@ -52,13 +54,16 @@
52
54
  <%- ' '%>
53
55
  <% if (ctrl.props.validator) { %><%- ctrl.props.validator %><%}%>
54
56
  />
57
+ <% if(ctrl.props.is_table_child){ %>
58
+ }
59
+ <%}%>
55
60
  <% } %>
56
61
  <%- include(`../../attributes/common/input/validation`, {ctrl : ctrl}) %>
57
62
 
58
63
  <% if(ctrl.props.is_table_child){ %>
59
64
 
65
+ @if (!mg.isRowInRowEditing(row)) {
60
66
  <label
61
- *ngIf="!mg.isRowInRowEditing(row)"
62
67
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
63
68
  <% if (ctrl.props.currency ) { %>
64
69
  {{mg.getFormattedValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)
@@ -71,6 +76,7 @@
71
76
 
72
77
 
73
78
  </label>
79
+ }
74
80
  <%}%>
75
81
  <%- include('./zoom-button.ejs', {ctrl : ctrl}) %>
76
82
  </div>
@@ -78,8 +84,8 @@
78
84
  case StorageAttributeType.Date: %>
79
85
 
80
86
  <% if(ctrl.props.is_table_child){ %>
87
+ @if (mg.isRowInRowEditing(row)) {
81
88
  <div
82
- *ngIf="mg.isRowInRowEditing(row)"
83
89
  style="display: flex; flex-direction: row">
84
90
  <%}%>
85
91
 
@@ -102,24 +108,26 @@
102
108
 
103
109
  <% if(ctrl.props.is_table_child){ %>
104
110
  </div>
111
+ }
105
112
  <%}%>
106
113
 
107
114
 
108
115
  <% if(ctrl.props.is_table_child){ %>
116
+ @if (!mg.isRowInRowEditing(row)) {
109
117
  <label
110
- *ngIf="!mg.isRowInRowEditing(row)"
111
118
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
112
119
  {{mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)
113
120
  <% if (ctrl.props.formatter) { %>| <%- ctrl.props.formatter %> : <%- ctrl.props.enum_id %><%}%>}}
114
121
  </label>
122
+ }
115
123
  <%}%>
116
124
  <%- include('./zoom-button.ejs', {ctrl : ctrl}) %>
117
125
  <% break;
118
126
 
119
127
  case StorageAttributeType.Time: %>
120
128
  <% if(ctrl.props.is_table_child){ %>
129
+ @if (mg.isRowInRowEditing(row)) {
121
130
  <div
122
- *ngIf="mg.isRowInRowEditing(row)"
123
131
  style="display: flex; flex-direction: row">
124
132
  <%}%>
125
133
 
@@ -141,15 +149,17 @@
141
149
 
142
150
  <% if(ctrl.props.is_table_child){ %>
143
151
  </div>
152
+ }
144
153
  <%}%>
145
154
 
146
155
  <% if(ctrl.props.is_table_child){ %>
156
+ @if (!mg.isRowInRowEditing(row)) {
147
157
  <label
148
- *ngIf="!mg.isRowInRowEditing(row)"
149
158
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
150
159
  {{mg.getValue(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)
151
160
  <% if (ctrl.props.formatter) { %>| <%- ctrl.props.formatter %> : <%- ctrl.props.enum_id %><%}%>}}
152
161
  </label>
162
+ }
153
163
  <%}%>
154
164
  <%- include('./zoom-button.ejs', {ctrl : ctrl}) %>
155
165
  <% break;
@@ -1,6 +1,7 @@
1
-
2
- <div *ngIf="mg.isImageExists(<%- ctrl.props.enum_id %>)">
1
+ @if (mg.isImageExists(<%- ctrl.props.enum_id %>)) {
2
+ <div>
3
3
  <img <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>
4
4
  <%- include('../../attributes/common/base/enabled', {ctrl : ctrl}) %>
5
5
  [src]="mg.getImage(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)" />
6
6
  </div>
7
+ }
@@ -8,12 +8,11 @@
8
8
  <% if (ctrl.props.must_input && !ctrl.props.must_input.has_exp) { %> required <%}%>
9
9
  >
10
10
  <%# build of items in listbox %>
11
- <option
12
- *ngFor="let o of mg.getItemListValues(<%-ctrl.props.enum_id%>);"
13
- [value] = "o.index"
14
- >
11
+ @for (o of mg.getItemListValues(<%-ctrl.props.enum_id%>); track $index) {
12
+ <option [value] = "o.index">
15
13
  {{o.displayValue}}
16
14
  </option>
15
+ }
17
16
  </select>
18
17
  <% if (ctrl.props.must_input || ctrl.props.validator != null) {%>
19
18
  <mgError [magic]=<%- ctrl.props.directive_id %>> </mgError>
@@ -25,4 +25,3 @@ case CtrlButtonTypeGui.Hypertext : %>
25
25
  <%- include('../../attributes/common/format.ejs', {ctrl : ctrl}) %>
26
26
  </button>
27
27
  <% } %> %>
28
-
@@ -1,9 +1,20 @@
1
+ <%# Wrap in a row-specific formGroup if this radio control is child of a table %>
1
2
  <div
3
+ <% if (ctrl.props.is_table_child && (typeof ctrl.props.web_style === "undefined" || ctrl.props.web_style === TableWebStyle.MatGrid)) { %>
4
+ [formGroup]="mg.getFormGroupByRow(row.rowId)"
5
+ <%}%>
6
+ >
7
+ <%# Render radio buttons group if in edit mode, otherwise render a static display label %>
8
+ <% if (ctrl.props.is_table_child) { %>
9
+ @if (mg.isRowInRowEditing(row)) {
10
+ <% } %>
11
+ <div
2
12
  <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>
3
- (change)="task.mgOnRadioSelectionChanged(<%-ctrl.props.enum_id%>)"
13
+ (change)="task.mgOnRadioSelectionChanged(<%-ctrl.props.enum_id%><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>)"
4
14
  >
5
- <div
6
- *ngFor="let o of mg.getItemListValues(<%-ctrl.props.enum_id%>);">
15
+ <%# Get the options and display values, passing the row.rowId if it is a table control %>
16
+ @for (o of mg.getItemListValues(<%-ctrl.props.enum_id%><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>); track $index) {
17
+ <div>
7
18
  <label>
8
19
  <input
9
20
  type="radio"
@@ -14,7 +25,17 @@
14
25
  {{o.displayValue}}
15
26
  </label>
16
27
  </div>
28
+ }
17
29
  <% if (ctrl.props.must_input || ctrl.props.validator != null) {%>
18
30
  <mgError [magic]=<%- ctrl.props.directive_id %>> </mgError>
19
31
  <%}%>
32
+ </div>
33
+ <% if (ctrl.props.is_table_child) { %>
34
+ }
35
+ @if (!mg.isRowInRowEditing(row)) {
36
+ <label <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
37
+ {{ mg.getDisplayValue(<%- ctrl.props.enum_id %>, row.rowId) }}
38
+ </label>
39
+ }
40
+ <% } %>
20
41
  </div>
@@ -12,7 +12,8 @@
12
12
  <% }%>
13
13
 
14
14
  <%# add buttons for each tab page%>
15
- <div *ngFor="let o of mg.getItemListValues(<%-ctrl.props.enum_id%>)">
15
+ @for (o of mg.getItemListValues(<%-ctrl.props.enum_id%>); track $index) {
16
+ <div>
16
17
  <button class="tab_button"
17
18
  <%- include('../../attributes/common/base/enabled', {ctrl : ctrl}) %>
18
19
  (click)="task.mgOnTabSelectionChanged(<%-ctrl.props.enum_id%>, o.index)"
@@ -21,6 +22,7 @@
21
22
  {{mg.getTabpageText(<%- ctrl.props.enum_id %>, o.index)}}
22
23
  </button>
23
24
  </div>
25
+ }
24
26
 
25
27
  <% if ( tab_side == SideType.Top) { %>
26
28
  <%# add tab pages after adding the buttons, so the buttons are at the top%>
@@ -2,8 +2,8 @@
2
2
  <%- include('../../attributes/common/no_control_base_attributes', {ctrl : ctrl}) %>
3
3
  magicMark="magicRadio"
4
4
  >
5
- <div
6
- *ngFor="let o of mgGetListboxValues(<%-ctrl.props.enum_id%>);">
5
+ @for (o of mgGetListboxValues(<%-ctrl.props.enum_id%>); track $index) {
6
+ <div>
7
7
  <label>
8
8
  <input
9
9
  type="radio"
@@ -14,4 +14,5 @@
14
14
  {{o.displayValue}}
15
15
  </label>
16
16
  </div>
17
+ }
17
18
  </div>
@@ -7,12 +7,16 @@
7
7
  (scrolled)="tableService.onScrollDown()"
8
8
  [scrollWindow]="false"
9
9
  >
10
- <div *ngFor="let row of task.Records.list">
11
- <div *ngIf="mg.ifRowCreated(row)" id="row">
10
+ @for (row of task.Records.list; track $index) {
11
+ <div>
12
+ @if (mg.ifRowCreated(row)) {
13
+ <div id="row">
12
14
  <form [formGroup]="mg.getFormGroupByRow(row.rowId)" class="table_row"
13
15
  [ngClass]="{ 'selected': mg.isRowSelected(<%= ctrl.props.enum_id %>, row.rowId)}">
14
16
  <%- include(`../container`, {ctrl: ctrl}) %>
15
17
  </form>
16
18
  </div>
17
- </div>
19
+ }
20
+ </div>
21
+ }
18
22
  </div>
@@ -6,6 +6,9 @@
6
6
  <% if (line_id !== null) {%>
7
7
  <% if( typeof child.props.common_line_id === "undefined" || child.props.common_line_id !== line_id) {%>
8
8
  </div>
9
+ <% if (ctrl.props.web_style === TableWebStyle.MatGrid) { %>
10
+ }
11
+ <% } %>
9
12
  <% line_id = null;%>
10
13
  <%}}%>
11
14
 
@@ -13,7 +16,12 @@
13
16
  <% if (line_id === null && typeof child.props.common_line_id !== "undefined" &&
14
17
  child.controlType !== MgControlType.CTRL_TYPE_TAB) { %>
15
18
  <% line_id = child.props.common_line_id; %>
16
- <div style="display: flex; flex-direction: row" <% if ( ctrl.props.web_style === TableWebStyle.MatGrid) { %>*ngIf="mg.ifRowCreated(row)" <%}%> >
19
+ <% if (ctrl.props.web_style === TableWebStyle.MatGrid) { %>
20
+ @if (mg.ifRowCreated(row)) {
21
+ <div style="display: flex; flex-direction: row">
22
+ <% } else { %>
23
+ <div style="display: flex; flex-direction: row">
24
+ <% } %>
17
25
  <%}%>
18
26
 
19
27
  <%- include(`./control`, {child: child}) %>
@@ -23,4 +31,7 @@
23
31
  <%# close the line-wrapping div, in case it was left open %>
24
32
  <%if (line_id !== null) {%>
25
33
  </div>
34
+ <% if (ctrl.props.web_style === TableWebStyle.MatGrid) { %>
35
+ }
36
+ <% } %>
26
37
  <%}} %>
@@ -6,11 +6,14 @@
6
6
 
7
7
  <%# show combo box in table only while we on row edit %>
8
8
  <% if (ctrl.props.is_table_child) { %>
9
- <div *ngIf="mg.isRowInRowEditing(row)">
9
+ @if (mg.isRowInRowEditing(row)) {
10
+ <div>
10
11
  <%}%>
11
12
 
12
13
  <% if (ctrl.props.editable) { %>
14
+ <mat-form-field <%- include('../../attributes/common/container_attributes', {ctrl : ctrl}) %>>
13
15
  <editable-combo
16
+ <%- include('../../attributes/common/base/visible', {ctrl : ctrl})%>
14
17
  <%- include(`../../attributes/common/control_attributes`, {ctrl : ctrl})%>
15
18
  <%- include('../../attributes/common/base/formControlName', {ctrl : ctrl}) %>
16
19
  <% if (ctrl.props.must_input && !ctrl.props.must_input.has_exp) { %>
@@ -19,6 +22,7 @@
19
22
  placeholder="Type/Select an option"
20
23
  >
21
24
  </editable-combo>
25
+ </mat-form-field>
22
26
  <% }else { %>
23
27
 
24
28
  <mat-form-field <%- include('../../attributes/common/container_attributes', {ctrl : ctrl}) %>>
@@ -29,13 +33,11 @@
29
33
  required
30
34
  <% } %>
31
35
  >
32
- <mat-option
33
- *ngFor="let o of mg.getItemListValues(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>);"
34
-
35
- [value]="o.index"
36
- >
36
+ @for (o of mg.getItemListValues(<%- ctrl.props.enum_id %><% if(ctrl.props.is_table_child){ %>, row.rowId<%}%>); track $index) {
37
+ <mat-option [value]="o.index">
37
38
  {{o.displayValue}}
38
39
  </mat-option>
40
+ }
39
41
  </mat-select>
40
42
  </mat-form-field>
41
43
 
@@ -47,12 +49,15 @@
47
49
 
48
50
  <% if (ctrl.props.is_table_child) { %>
49
51
  </div>
52
+ }
50
53
  <%# show lable in table only while we on row read only %>
51
- <div *ngIf="!mg.isRowInRowEditing(row)">
54
+ @if (!mg.isRowInRowEditing(row)) {
55
+ <div>
52
56
  <label <%- include('../../attributes/common/base_attributes', {ctrl : ctrl}) %>>
53
57
  {{ mg.getDisplayValue(<%- ctrl.props.enum_id %>, row.rowId) }}
54
58
  </label>
55
59
  </div>
60
+ }
56
61
  <%}%>
57
62
 
58
63
  </div>