Title: Generate components · Issue #91 · microsoft/angular-react · GitHub
Open Graph Title: Generate components · Issue #91 · microsoft/angular-react
X Title: Generate components · Issue #91 · microsoft/angular-react
Description: The issue Currently creating @angular-react components is done manually, specially in @angular-react/fabric (but the same holds true for any library implementation). This is fine for a few components, and didn't prove to be worth the eff...
Open Graph Description: The issue Currently creating @angular-react components is done manually, specially in @angular-react/fabric (but the same holds true for any library implementation). This is fine for a few componen...
X Description: The issue Currently creating @angular-react components is done manually, specially in @angular-react/fabric (but the same holds true for any library implementation). This is fine for a few componen...
Opengraph URL: https://github.com/microsoft/angular-react/issues/91
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generate components","articleBody":"### The issue\r\nCurrently creating `@angular-react` components is done manually, specially in `@angular-react/fabric` (but the same holds true for any library implementation).\r\nThis is fine for a few components, and didn't prove to be worth the effort of creating such a tool, but as the library grows, and more components are added - this seems like it would simplify the long-term maintenance, especially in regards to upgrading the underlying React UI framework (e.g. [`office-ui-fabric-react`](https://github.com/OfficeDev/office-ui-fabric-react/), [`Semantic-UI-React`](https://github.com/Semantic-Org/Semantic-UI-React)).\r\n\r\n### Proposed solution\r\nThere are a number of ways to go about this, but the most likely is to use [Angular Schematics](https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2) to generate components, which as part of the inputs will take some sort of identifier for a `*Props` interface (e.g. [`ICheckboxProps`](https://github.com/OfficeDev/office-ui-fabric-react/blob/90deffbfc7ba9aefdb9d10bc54fa1452b6fc9cfa/packages/office-ui-fabric-react/src/components/Checkbox/Checkbox.types.ts#L21)), and together with the [TypeScript compiler API](https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API) (or any of its wrappers) and add the relevant `Input`s and `Output`s for the component, as well as bindings for the template etc.:\r\n1. Props that are of type `string | number | boolean | object` should be added as-is. e.g: `componentRef?: IRefObject\u003cICheckbox>` -> `@Input() componentRef?: ICheckboxProps['componentRef']`\r\n1. Props that conform to `(...args: any[]) => void` should be added as `@Output`s, with the arguments added as an object with properties the same name as the function parameters. e.g.: `onChange?: (ev?: React.FormEvent\u003cHTMLElement | HTMLInputElement>, checked?: boolean) => void` -> `@Output() readonly onChange = new EventEmitter\u003c{ ev?: Event, checked?: boolean }>()`.\r\n 1. Props that confirm to `(...args: any[]) => *non-void*` should be added as-is (see 1. above), also as `@Input`s.\r\n1. Props that are of type `IRenderFunction\u003cT>` should be added as `InputRendererOptions\u003cT>`. If the prop name is prefixed with an `on`, omit it (the Angular doesn't let `Input`s be prefixed with `on`), and camel-cased. e.g.:\r\n`onRenderNavigation?: IRenderFunction\u003cIPanelProps>` -> `@Input() renderNavigation?: InputRendererOptions\u003cIPanelProps>`.\r\n1. (optional) copy the JDoc as-is.\r\n\r\n### Open issues:\r\n* The proposed solution is very specific to `office-ui-fabric-react`, as this is the only actively-maintained package wrapper - I think this is enough to support automating it, for the moment at least.\r\n* There are probably more things that could be automated as far as generation goes, but the above list is a (very) good start.\r\n* For anything that's not defined above, examples and patterns from the existing code-base of `@angular-react/fabric` can be used as reference.","author":{"url":"https://github.com/bengry","@type":"Person","name":"bengry"},"datePublished":"2019-02-17T21:12:20Z","url":"https://github.com/microsoft/angular-react/issues/91"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1caefee2-c0a0-0e51-9291-ae7cf95c8018 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A12E:33444D:AA97F9:E481DA:6B00EFA8 |
| html-safe-nonce | 3271e913def1eb6c357fb01496160bf41a16d0704c0d1a8d27298369a97ed67a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTJFOjMzNDQ0RDpBQTk3Rjk6RTQ4MURBOjZCMDBFRkE4IiwidmlzaXRvcl9pZCI6Ijg1NjQ4ODQ0NzA4OTYzNTI0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 55b1d9bcec5e8b07d03194a121e3e768c8f5b70f947abed99b149af9fe219404 |
| hovercard-subject-tag | issue:411235633 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/angular-react/91/issue_layout |
| twitter:image | https://opengraph.githubassets.com/686cece2e96e7fb5064fbba795036359fd3ba604bcdbf351be0574a6672990e3/microsoft/angular-react/issues/91 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/686cece2e96e7fb5064fbba795036359fd3ba604bcdbf351be0574a6672990e3/microsoft/angular-react/issues/91 |
| og:image:alt | The issue Currently creating @angular-react components is done manually, specially in @angular-react/fabric (but the same holds true for any library implementation). This is fine for a few componen... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bengry |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/angular-react git https://github.com/microsoft/angular-react.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 144321557 |
| octolytics-dimension-repository_nwo | microsoft/angular-react |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 144321557 |
| octolytics-dimension-repository_network_root_nwo | microsoft/angular-react |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width