@seniorsistemas/exclusion-process-component 0.0.1-c049d10c-e93a-4d63-9c2a-b17bca40c324 → 0.6.0-44030ff3-2eeb-49f7-8927-0920cc01a805

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 (200) hide show
  1. package/.editorconfig +19 -0
  2. package/.gitlab-ci.yml +74 -0
  3. package/.prettierrc +8 -0
  4. package/.senior-ci-extensions.sh +21 -0
  5. package/.vscode/settings.json +6 -0
  6. package/CHANGELOG.md +22 -0
  7. package/README.md +16 -0
  8. package/angular.json +144 -0
  9. package/archive.tar.gz +0 -0
  10. package/e2e/app.e2e-spec.ts +14 -0
  11. package/e2e/app.po.ts +11 -0
  12. package/e2e/tsconfig.e2e.json +14 -0
  13. package/karma.conf.js +53 -0
  14. package/lib/.browserslistrc +5 -0
  15. package/lib/package.json +19 -0
  16. package/{enums/enum-exclusion-process-status.d.ts → lib/src/enums/enum-exclusion-process-status.ts} +1 -1
  17. package/lib/src/exclusion-details/exclusion-details.component.html +84 -0
  18. package/lib/src/exclusion-details/exclusion-details.component.scss +47 -0
  19. package/lib/src/exclusion-details/exclusion-details.component.spec.ts +171 -0
  20. package/lib/src/exclusion-details/exclusion-details.component.ts +235 -0
  21. package/lib/src/exclusion-details/exclusion-details.module.ts +23 -0
  22. package/{exclusion-details/protocols/exclusion-details.d.ts → lib/src/exclusion-details/protocols/exclusion-details.ts} +1 -0
  23. package/{exclusion-details/protocols/show-details-information.d.ts → lib/src/exclusion-details/protocols/show-details-information.ts} +1 -1
  24. package/lib/src/exclusions-list/exclusions-list.component.html +157 -0
  25. package/lib/src/exclusions-list/exclusions-list.component.spec.ts +526 -0
  26. package/lib/src/exclusions-list/exclusions-list.component.ts +335 -0
  27. package/lib/src/exclusions-list/exclusions-list.module.ts +52 -0
  28. package/lib/src/exclusions-list/exclusions-list.routing.ts +89 -0
  29. package/lib/src/exclusions-list/index.ts +2 -0
  30. package/lib/src/logical-delete.module.ts +22 -0
  31. package/{models/exclusion-process-step-group.d.ts → lib/src/models/exclusion-process-step-group.ts} +1 -0
  32. package/{models/exclusion-process-step.d.ts → lib/src/models/exclusion-process-step.ts} +1 -0
  33. package/{models/exclusion-process.d.ts → lib/src/models/exclusion-process.ts} +1 -0
  34. package/{models/list-params.d.ts → lib/src/models/list-params.ts} +1 -0
  35. package/{models/project-config.d.ts → lib/src/models/project-config.ts} +3 -1
  36. package/lib/src/services/filter.service.spec.ts +290 -0
  37. package/lib/src/services/filter.service.ts +109 -0
  38. package/lib/src/services/index.ts +1 -0
  39. package/lib/src/services/logical-delete-config.service.spec.ts +59 -0
  40. package/lib/src/services/logical-delete-config.service.ts +25 -0
  41. package/lib/src/services/logical-delete.service.spec.ts +322 -0
  42. package/lib/src/services/logical-delete.service.ts +122 -0
  43. package/lib/test.ts +14 -0
  44. package/lib/tsconfig.lib.json +19 -0
  45. package/lib/tsconfig.lib.prod.json +6 -0
  46. package/lib/tsconfig.spec.json +12 -0
  47. package/lib/tslint.json +19 -0
  48. package/package.json +59 -18
  49. package/protractor.conf.js +28 -0
  50. package/senior-ci/.devcontainer/Dockerfile +27 -0
  51. package/senior-ci/.devcontainer/devcontainer.json +71 -0
  52. package/senior-ci/.editorconfig +14 -0
  53. package/senior-ci/.gitattributes +5 -0
  54. package/senior-ci/.gitlab-ci.yml +53 -0
  55. package/senior-ci/.pylintrc +562 -0
  56. package/senior-ci/.vscode/launch.json +102 -0
  57. package/senior-ci/CHANGELOG.md +1564 -0
  58. package/senior-ci/CONTRIBUTING.md +31 -0
  59. package/senior-ci/README.md +26 -0
  60. package/senior-ci/ci/ci.sh +74 -0
  61. package/senior-ci/ci/sonar_scanner.py +48 -0
  62. package/senior-ci/common/__init__.py +250 -0
  63. package/senior-ci/common/default-files/pom.xml +10 -0
  64. package/senior-ci/common/docker-helpers.sh +57 -0
  65. package/senior-ci/common/extensions.py +88 -0
  66. package/senior-ci/common/flutter-helpers.sh +3 -0
  67. package/senior-ci/common/getopt_helper.py +168 -0
  68. package/senior-ci/common/graphql_client.py +40 -0
  69. package/senior-ci/common/helm_helpers.py +40 -0
  70. package/senior-ci/common/notification-helpers.sh +15 -0
  71. package/senior-ci/common/npm-helper.sh +4 -0
  72. package/senior-ci/common/parallel-helper.sh +8 -0
  73. package/senior-ci/common/release-helpers.sh +196 -0
  74. package/senior-ci/common/s3cache-helpers.sh +47 -0
  75. package/senior-ci/common/senior-ci-extensions-helpers.sh +15 -0
  76. package/senior-ci/common/sonar_helper.py +203 -0
  77. package/senior-ci/common/validations/buildable_project.py +61 -0
  78. package/senior-ci/common/validations/check_deprecated_primitives.py +49 -0
  79. package/senior-ci/common/validations/check_project_path.py +40 -0
  80. package/senior-ci/common/validations/check_sonar_config_files.py +41 -0
  81. package/senior-ci/common/validations/check_tags.py +41 -0
  82. package/senior-ci/common/validations/validate_changelog.py +151 -0
  83. package/senior-ci/common/validations/validate_issues.py +320 -0
  84. package/senior-ci/docker/build.sh +18 -0
  85. package/senior-ci/docker/config-host.sh +29 -0
  86. package/senior-ci/docker/deploy-service.sh +79 -0
  87. package/senior-ci/docker/push.sh +22 -0
  88. package/senior-ci/frontend/npm/bibliotecas/ci.sh +149 -0
  89. package/senior-ci/frontend/npm/ci.sh +370 -0
  90. package/senior-ci/frontend/npm/release-translations.sh +164 -0
  91. package/senior-ci/helm/deploy.py +56 -0
  92. package/senior-ci/helm/publish.py +41 -0
  93. package/senior-ci/hook/release_notification.sh +88 -0
  94. package/senior-ci/hook/text_notification.sh +10 -0
  95. package/senior-ci/java/bibliotecas/ci.sh +215 -0
  96. package/senior-ci/java/sdl/ci.sh +372 -0
  97. package/senior-ci/java/sdl/scripts/hotfix.sh +78 -0
  98. package/senior-ci/mobile/flutter/apps/__main__.py +5 -0
  99. package/senior-ci/mobile/flutter/apps/ci.py +193 -0
  100. package/senior-ci/mobile/flutter/libs/__main__.py +5 -0
  101. package/senior-ci/mobile/flutter/libs/ci.py +178 -0
  102. package/senior-ci/mobile/flutter/scripts/release.sh +54 -0
  103. package/senior-ci/release-candidate/backend/get_version.sh +64 -0
  104. package/senior-ci/release-candidate/close_branch.sh +113 -0
  105. package/senior-ci/release-candidate/common/create_hotfix.sh +28 -0
  106. package/senior-ci/release-candidate/common/create_release.sh +30 -0
  107. package/senior-ci/release-candidate/create_branch.sh +64 -0
  108. package/senior-ci/release-candidate/frontend/get_version.sh +43 -0
  109. package/senior-ci/requirements-dev.txt +5 -0
  110. package/senior-ci/requirements.txt +5 -0
  111. package/senior-ci/scripts/apply_yamls.py +229 -0
  112. package/senior-ci/scripts/create_sre_issue/__main__.py +7 -0
  113. package/senior-ci/scripts/create_sre_issue/create_sre_issue.py +267 -0
  114. package/senior-ci/scripts/create_sre_issue/helpers.py +166 -0
  115. package/senior-ci/scripts/create_sre_issue/jira_manager.py +37 -0
  116. package/senior-ci/scripts/validate_changelog.sh +3 -0
  117. package/senior-ci/sonar-project.properties +1 -0
  118. package/server.js +5 -0
  119. package/sonar-project.properties +10 -0
  120. package/src/app/app.component.html +43 -0
  121. package/src/app/app.component.scss +36 -0
  122. package/src/app/app.component.ts +56 -0
  123. package/src/app/app.module.ts +64 -0
  124. package/src/app/shared/shared.module.ts +28 -0
  125. package/src/environments/environment.default.ts +3 -0
  126. package/src/environments/environment.prod.ts +6 -0
  127. package/src/environments/environment.ts +7 -0
  128. package/src/favicon.ico +0 -0
  129. package/src/index.html +17 -0
  130. package/src/locale/en-US.json +3 -0
  131. package/src/locale/es-ES.json +3 -0
  132. package/src/locale/pt-BR.json +3 -0
  133. package/src/main.ts +13 -0
  134. package/src/polyfills.ts +58 -0
  135. package/src/styles.scss +11 -0
  136. package/src/tsconfig.app.json +21 -0
  137. package/src/typings.d.ts +15 -0
  138. package/tsconfig.json +39 -0
  139. package/tslint.json +80 -0
  140. package/bundles/seniorsistemas-exclusion-process-component.umd.js +0 -747
  141. package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +0 -1
  142. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +0 -16
  143. package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +0 -1
  144. package/esm2015/enums/enum-exclusion-process-status.js +0 -8
  145. package/esm2015/exclusion-details/exclusion-details.component.js +0 -216
  146. package/esm2015/exclusion-details/exclusion-details.module.js +0 -28
  147. package/esm2015/exclusion-details/index.js +0 -3
  148. package/esm2015/exclusion-details/protocols/exclusion-details.js +0 -1
  149. package/esm2015/exclusion-details/protocols/index.js +0 -2
  150. package/esm2015/exclusion-details/protocols/show-details-information.js +0 -3
  151. package/esm2015/logical-delete.module.js +0 -27
  152. package/esm2015/models/exclusion-process-step-group.js +0 -1
  153. package/esm2015/models/exclusion-process-step.js +0 -1
  154. package/esm2015/models/exclusion-process.js +0 -1
  155. package/esm2015/models/index.js +0 -1
  156. package/esm2015/models/list-params.js +0 -1
  157. package/esm2015/models/list-result.js +0 -1
  158. package/esm2015/models/project-config.js +0 -3
  159. package/esm2015/public-api.js +0 -3
  160. package/esm2015/seniorsistemas-exclusion-process-component.js +0 -9
  161. package/esm2015/services/filter.service.js +0 -104
  162. package/esm2015/services/logical-delete-config.service.js +0 -29
  163. package/esm2015/services/logical-delete.service.js +0 -109
  164. package/esm5/enums/enum-exclusion-process-status.js +0 -8
  165. package/esm5/exclusion-details/exclusion-details.component.js +0 -235
  166. package/esm5/exclusion-details/exclusion-details.module.js +0 -31
  167. package/esm5/exclusion-details/index.js +0 -3
  168. package/esm5/exclusion-details/protocols/exclusion-details.js +0 -1
  169. package/esm5/exclusion-details/protocols/index.js +0 -2
  170. package/esm5/exclusion-details/protocols/show-details-information.js +0 -7
  171. package/esm5/logical-delete.module.js +0 -31
  172. package/esm5/models/exclusion-process-step-group.js +0 -1
  173. package/esm5/models/exclusion-process-step.js +0 -1
  174. package/esm5/models/exclusion-process.js +0 -1
  175. package/esm5/models/index.js +0 -1
  176. package/esm5/models/list-params.js +0 -1
  177. package/esm5/models/list-result.js +0 -1
  178. package/esm5/models/project-config.js +0 -3
  179. package/esm5/public-api.js +0 -3
  180. package/esm5/seniorsistemas-exclusion-process-component.js +0 -9
  181. package/esm5/services/filter.service.js +0 -109
  182. package/esm5/services/logical-delete-config.service.js +0 -30
  183. package/esm5/services/logical-delete.service.js +0 -112
  184. package/exclusion-details/exclusion-details.component.d.ts +0 -49
  185. package/exclusion-details/exclusion-details.module.d.ts +0 -2
  186. package/fesm2015/seniorsistemas-exclusion-process-component.js +0 -495
  187. package/fesm2015/seniorsistemas-exclusion-process-component.js.map +0 -1
  188. package/fesm5/seniorsistemas-exclusion-process-component.js +0 -530
  189. package/fesm5/seniorsistemas-exclusion-process-component.js.map +0 -1
  190. package/logical-delete.module.d.ts +0 -5
  191. package/seniorsistemas-exclusion-process-component.d.ts +0 -8
  192. package/seniorsistemas-exclusion-process-component.metadata.json +0 -1
  193. package/services/filter.service.d.ts +0 -19
  194. package/services/logical-delete-config.service.d.ts +0 -8
  195. package/services/logical-delete.service.d.ts +0 -20
  196. /package/{exclusion-details/index.d.ts → lib/src/exclusion-details/index.ts} +0 -0
  197. /package/{exclusion-details/protocols/index.d.ts → lib/src/exclusion-details/protocols/index.ts} +0 -0
  198. /package/{models/index.d.ts → lib/src/models/index.ts} +0 -0
  199. /package/{models/list-result.d.ts → lib/src/models/list-result.ts} +0 -0
  200. /package/{public-api.d.ts → lib/src/public-api.ts} +0 -0
@@ -0,0 +1,166 @@
1
+ import json
2
+ import re
3
+ from configparser import ConfigParser
4
+ from pathlib import Path
5
+ from typing import List
6
+
7
+ from jira.resources import Issue
8
+ from jira_manager import JiraManager
9
+
10
+ from common import (
11
+ exec_command_and_return,
12
+ get_commit_tag_as_semver,
13
+ get_env_variable_required,
14
+ print_message,
15
+ unshallow_repo,
16
+ )
17
+
18
+
19
+ class Repository:
20
+ _name: str
21
+
22
+ version: str
23
+ deployment: str
24
+ deploy_info: str
25
+ deploy_name_custom_field: str
26
+ translations_path: str
27
+
28
+ def __init__(self, tag: str, name: str):
29
+ self._name = name
30
+
31
+ self.version = tag
32
+ self.deployment = self.get_deployment_name()
33
+
34
+ self.deploy_info = f"{self.deployment}:{self.version}"
35
+
36
+ def get_deployment_name(self) -> str:
37
+ return self._name
38
+
39
+
40
+ class Backend(Repository):
41
+ def __init__(self, tag: str, name: str):
42
+ self.deploy_name_custom_field = "customfield_12001"
43
+ self.translations_path = "java/impl/src/main/resources/translation"
44
+
45
+ super().__init__(tag, name)
46
+
47
+ def get_deployment_name(self) -> str:
48
+ sdl_properties_path = Path("sdl.properties")
49
+
50
+ if sdl_properties_path.is_file():
51
+ with sdl_properties_path.open("r", encoding="utf-8") as properties_data:
52
+ config_string = "[DEFAULT]\n" + properties_data.read()
53
+
54
+ config = ConfigParser()
55
+ config.read_string(config_string)
56
+
57
+ app_name = config["DEFAULT"]["generator.app.name"]
58
+
59
+ return app_name
60
+
61
+ return super().get_deployment_name()
62
+
63
+
64
+ class Frontend(Repository):
65
+ def __init__(self, tag: str, name: str):
66
+ self.deploy_name_custom_field = "customfield_12002"
67
+ self.translations_path = "src/locale"
68
+
69
+ super().__init__(tag, name)
70
+
71
+ def get_deployment_name(self) -> str:
72
+ package_json_path = Path("package.json")
73
+
74
+ if package_json_path.is_file():
75
+ with package_json_path.open("r", encoding="utf-8") as package_data:
76
+ json_data = json.load(package_data)
77
+
78
+ app = json_data["project"]["app"]
79
+ domain = json_data["project"]["domain"]
80
+
81
+ return f"{app}/{domain}/{self._name}"
82
+
83
+ return super().get_deployment_name()
84
+
85
+
86
+ class ChangelogReader(object):
87
+ def __init__(self, changelog_base_path: str, jira_manager: JiraManager):
88
+ self.jira_manager = jira_manager
89
+
90
+ self.issue_pattern = re.compile(
91
+ r"\*?\s*?\[#?(?P<key>\w+-\d+)\](?P<link>\(http[s]?:\/\/[^)]*\))?\s*-?\s*(?P<summary>.*)",
92
+ re.MULTILINE,
93
+ )
94
+
95
+ self.changelog_path = f"{changelog_base_path}/CHANGELOG.md"
96
+
97
+ tag = get_env_variable_required("CI_COMMIT_TAG")
98
+ project_url = get_env_variable_required("CI_PROJECT_URL")
99
+
100
+ self.version = get_commit_tag_as_semver()
101
+
102
+ self.changelog_url = (
103
+ f"{project_url}/-/blob/{tag}{self.changelog_path.replace('.','', 1)}"
104
+ )
105
+
106
+ def read_issues(self) -> List[Issue]:
107
+ issues: List[Issue] = []
108
+
109
+ tag_section_pattern = re.compile(r"^# [0-9\.]+")
110
+
111
+ with open(self.changelog_path, "r", encoding="utf-8") as changelog:
112
+ line = changelog.readline()
113
+ is_in_tag_section = False
114
+ while line:
115
+ if self.version in line:
116
+ is_in_tag_section = True
117
+ line = changelog.readline()
118
+ continue
119
+
120
+ started_other_section = is_in_tag_section and tag_section_pattern.match(
121
+ line
122
+ )
123
+ if started_other_section:
124
+ break
125
+
126
+ if is_in_tag_section and self.issue_pattern.match(line):
127
+ issue_key = self._issue_key_from(line)
128
+ issue = self.jira_manager.get_issue(issue_key)
129
+ issues.append(issue)
130
+
131
+ line = changelog.readline()
132
+
133
+ changelog.close()
134
+
135
+ return issues
136
+
137
+ def _issue_key_from(self, line: str):
138
+ matches = self.issue_pattern.search(line)
139
+ return matches.group("key")
140
+
141
+
142
+ def find_changed_files(path) -> List[str]:
143
+ path = Path(path)
144
+
145
+ if path.exists():
146
+ unshallow_repo()
147
+
148
+ previous_tag_command = exec_command_and_return(
149
+ "git tag --sort=-creatordate | head -n 2 | tail -n 1"
150
+ )
151
+ previous_tag = previous_tag_command.output.strip()
152
+ tag_or_first_commit = (
153
+ previous_tag
154
+ if previous_tag
155
+ else exec_command_and_return("git rev-list HEAD | tail -n 1").output
156
+ )
157
+
158
+ command_return = exec_command_and_return(
159
+ f"git diff --name-only {tag_or_first_commit} | grep {path}"
160
+ )
161
+
162
+ print_message(f"Arquivos atualizados: \n{command_return.output}")
163
+
164
+ return command_return.output.split("\n")
165
+
166
+ return []
@@ -0,0 +1,37 @@
1
+ from typing import Any, Dict, Union
2
+
3
+ from jira import JIRA
4
+ from jira.resources import Issue, IssueLinkType
5
+ from requests import Response
6
+
7
+ from common import get_env_variable_required
8
+
9
+
10
+ class JiraManager:
11
+ def __init__(self):
12
+ user = get_env_variable_required("SCI_JIRA_USER")
13
+ password = get_env_variable_required("SCI_JIRA_PASSWORD")
14
+
15
+ self.jira = JIRA("https://jira.senior.com.br", basic_auth=(user, password))
16
+
17
+ def create_issue(self, fields: Dict[str, Any] or None) -> Issue:
18
+ return self.jira.create_issue(fields)
19
+
20
+ def create_link(
21
+ self,
22
+ link_type: Union[str, IssueLinkType],
23
+ inward_issue: Issue,
24
+ outward_issue: Issue,
25
+ ) -> bool:
26
+ remote_link: Response = self.jira.create_issue_link(
27
+ link_type, inward_issue, outward_issue
28
+ )
29
+
30
+ return remote_link.ok
31
+
32
+ def get_issue(self, key: str) -> Issue:
33
+ return self.jira.issue(key)
34
+
35
+ @staticmethod
36
+ def get_issue_url(key: str) -> str:
37
+ return f"https://jira.senior.com.br/browse/{key}"
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ python3 senior-ci/common/validations/validate_changelog.py
@@ -0,0 +1 @@
1
+ sonar.sources=ci,common,docker,frontend,helm,hook,java,mobile,release-candidate,scripts
package/server.js ADDED
@@ -0,0 +1,5 @@
1
+ const os = require("os");
2
+ const cli = require("@angular/cli").default;
3
+
4
+ const HOST = `${os.hostname().toLowerCase()}.interno.senior.com.br`;
5
+ cli({ cliArgs: ["serve", "--open", "--host", HOST, "--port", "0", ...process.argv.slice(2)] });
@@ -0,0 +1,10 @@
1
+ sonar.projectKey=exclusion-process-component
2
+ sonar.projectName=Exclusion process - Components
3
+ sonar.sourceEncoding=UTF-8
4
+
5
+ sonar.sources=./lib
6
+ sonar.sourceEncoding=UTF-8
7
+ sonar.exclusions=**/node_modules/**,**/*.spec.ts
8
+ sonar.ts.tslintconfigpath=tslint.json
9
+
10
+ sonar.host.url=http://sonar.senior.com.br/
@@ -0,0 +1,43 @@
1
+ <s-product-header header="Exclusion Process Components">
2
+ <s-button
3
+ (onClick)="sidebarVisibleChange(true)"
4
+ priority="default"
5
+ iconClass="fa fa-fw fa-list"
6
+ label="Components"
7
+ [auxiliary]="true"
8
+ ></s-button>
9
+ </s-product-header>
10
+
11
+ <s-sidebar header="Componentes" [visible]="sidebarVisible" (visibleChange)="sidebarVisibleChange($event)">
12
+ <div class="ui-fluid">
13
+ <div class="ui-g">
14
+ <div class="ui-g-12">
15
+ <input type="text" id="search" name="search" placeholder="Search..." pInputText (input)="filter($event.target.value)" />
16
+ </div>
17
+ </div>
18
+
19
+ <div *ngFor="let section of filteredSections" class="section">
20
+ <div class="ui-g">
21
+ <div class="section-title ui-g-12">{{ section.label }}</div>
22
+
23
+ <div
24
+ *ngFor="let item of section.items"
25
+ class="menu-item ui-sm-12 ui-md-6 ui-xl-3"
26
+ [routerLink]="item.routerLink"
27
+ routerLinkActive="active"
28
+ (click)="sidebarVisible = false"
29
+ >
30
+ {{ item.label }}
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </s-sidebar>
36
+
37
+ <s-loading-state [loading]="pageLoading" [blockWindow]="true">
38
+ <div class="sds-container">
39
+ <p-toast></p-toast>
40
+ <s-breadcrumb></s-breadcrumb>
41
+ <router-outlet></router-outlet>
42
+ </div>
43
+ </s-loading-state>
@@ -0,0 +1,36 @@
1
+ @import "~@seniorsistemas/primeng-theme/dist/scss/_colors";
2
+
3
+ .section {
4
+ padding-top: 15px;
5
+ }
6
+
7
+ .section + .section {
8
+ border-top: 1px dashed #eee;
9
+ margin-top: 15px;
10
+ }
11
+
12
+ .section-title {
13
+ font-weight: bold;
14
+ margin-bottom: 5px;
15
+ text-transform: uppercase;
16
+ font-size: 8pt;
17
+ }
18
+
19
+ .menu-item {
20
+ cursor: pointer;
21
+ border-radius: 4px;
22
+
23
+ &.active {
24
+ font-weight: bold;
25
+ color: $primary-color;
26
+ }
27
+
28
+ &:focus {
29
+ outline: none;
30
+ background-color: #eee;
31
+ }
32
+
33
+ &:hover {
34
+ color: $primary-color;
35
+ }
36
+ }
@@ -0,0 +1,56 @@
1
+ import { Component, OnInit } from "@angular/core";
2
+ import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router, RouterEvent } from "@angular/router";
3
+ import { MenuItem } from "primeng/api";
4
+
5
+ @Component({
6
+ selector: "app-root",
7
+ templateUrl: "./app.component.html",
8
+ styleUrls: ["./app.component.scss"],
9
+ })
10
+ export class AppComponent implements OnInit {
11
+ public pageLoading = true;
12
+ public search: string;
13
+ public sidebarVisible: boolean;
14
+
15
+ public sections: MenuItem[] = [
16
+ {
17
+ label: "Navegação",
18
+ icon: "fa fa",
19
+ items: [
20
+ { label: "Lookups", routerLink: "lookup" }
21
+ ],
22
+ }
23
+ ];
24
+
25
+ public filteredSections: MenuItem[] = this.sections;
26
+
27
+ constructor(private router: Router) {}
28
+
29
+ public ngOnInit() {
30
+ this.router.events.subscribe((event: RouterEvent) => {
31
+ if (event instanceof NavigationStart) {
32
+ this.pageLoading = true;
33
+ } else if (event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError) {
34
+ this.pageLoading = false;
35
+ }
36
+ });
37
+ }
38
+
39
+ public filter(search: string) {
40
+ if (!search) void (this.filteredSections = this.sections);
41
+
42
+ const sections = this.sections as any[];
43
+
44
+ this.filteredSections = sections
45
+ .map(section => ({
46
+ ...section,
47
+ items: section.items.filter((item: MenuItem) => item.label.toLowerCase().includes(search.toLowerCase())),
48
+ }))
49
+ .filter(section => section.items && section.items.length);
50
+ }
51
+
52
+ public sidebarVisibleChange(visible: boolean) {
53
+ if (visible) document.getElementById("search").focus();
54
+ this.sidebarVisible = visible;
55
+ }
56
+ }
@@ -0,0 +1,64 @@
1
+ import { NgModule } from "@angular/core";
2
+ import { FormsModule } from "@angular/forms";
3
+ import { BrowserModule } from "@angular/platform-browser";
4
+ import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
5
+ import { HttpClientModule } from "@angular/common/http";
6
+ import { TranslateModule } from "@ngx-translate/core";
7
+ import { RouterModule } from "@angular/router";
8
+ import {
9
+ ProductHeaderModule,
10
+ ButtonModule,
11
+ SidebarModule,
12
+ LoadingStateModule,
13
+ LocaleModule,
14
+ BreadcrumbModule,
15
+ TableModule as SeniorTableModule,
16
+ DynamicFormModule,
17
+ AngularComponentsModule
18
+ } from "@seniorsistemas/angular-components";
19
+ import {
20
+ TranslationsModule
21
+ } from "@seniorsistemas/platform-components";
22
+ import { HotkeyModule } from "angular2-hotkeys";
23
+ import { ConfirmationService, MessageService } from "primeng/api";
24
+ import { InputTextModule } from "primeng/inputtext";
25
+ import { MenuModule } from "primeng/menu";
26
+ import { ToastModule } from "primeng/toast";
27
+ import { TableModule } from "primeng/table";
28
+ import { AppComponent } from "./app.component";
29
+ import fallback from "../locale/pt-BR.json";
30
+
31
+ @NgModule({
32
+ declarations: [AppComponent],
33
+ imports: [
34
+ BrowserModule,
35
+ BrowserAnimationsModule,
36
+ RouterModule.forRoot([]),
37
+ HttpClientModule,
38
+ TranslateModule.forRoot(),
39
+ TranslationsModule.forRoot([
40
+ { domain: "platform", service: "exclusion-process", fallback }
41
+ ]),
42
+ LocaleModule.forRoot(),
43
+ FormsModule,
44
+ MenuModule,
45
+ ToastModule,
46
+ InputTextModule,
47
+ ProductHeaderModule,
48
+ ButtonModule,
49
+ SidebarModule,
50
+ LoadingStateModule,
51
+ HotkeyModule.forRoot(),
52
+ BreadcrumbModule,
53
+ TableModule,
54
+ SeniorTableModule,
55
+ DynamicFormModule,
56
+ AngularComponentsModule.forRoot({
57
+ domain: "platform",
58
+ service: "exclusion-process"
59
+ })
60
+ ],
61
+ providers: [MessageService, ConfirmationService],
62
+ bootstrap: [AppComponent]
63
+ })
64
+ export class AppModule {}
@@ -0,0 +1,28 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { NgModule } from '@angular/core';
3
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
+ import { ButtonModule, LoadingStateModule, StatsCardModule, EmptyStateModule, SidebarModule } from '@seniorsistemas/angular-components';
5
+ import { ConfirmDialogModule } from 'primeng/confirmdialog';
6
+ import { PanelModule } from 'primeng/panel';
7
+ import { TabViewModule } from 'primeng/tabview';
8
+ import { MessagesModule } from 'primeng/messages';
9
+ import { TableModule } from 'primeng/table';
10
+
11
+ @NgModule({
12
+ exports: [
13
+ CommonModule,
14
+ PanelModule,
15
+ TabViewModule,
16
+ ConfirmDialogModule,
17
+ FormsModule,
18
+ ReactiveFormsModule,
19
+ StatsCardModule,
20
+ EmptyStateModule,
21
+ TableModule,
22
+ ButtonModule,
23
+ LoadingStateModule,
24
+ MessagesModule,
25
+ SidebarModule
26
+ ],
27
+ })
28
+ export class SharedModule { }
@@ -0,0 +1,3 @@
1
+ export const environment: any = {
2
+ production: false,
3
+ };
@@ -0,0 +1,6 @@
1
+ import { environment as def } from '~env/environment.default';
2
+
3
+ export const environment: any = {
4
+ ...def,
5
+ production: true,
6
+ };
@@ -0,0 +1,7 @@
1
+ import { environment as def } from "~env/environment.default";
2
+
3
+ export const environment: any = {
4
+ ...def,
5
+ };
6
+
7
+ import "zone.js/dist/zone-error";
Binary file
package/src/index.html ADDED
@@ -0,0 +1,17 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>Senior Components</title>
7
+ <base href="/">
8
+
9
+ <meta name="viewport" content="width=device-width, initial-scale=1">
10
+ <link rel="icon" type="image/x-icon" href="./assets/favicon.png">
11
+ </head>
12
+
13
+ <body>
14
+ <app-root></app-root>
15
+ </body>
16
+
17
+ </html>
@@ -0,0 +1,3 @@
1
+ {
2
+
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+
3
+ }
package/src/main.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { enableProdMode } from "@angular/core";
2
+ import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
3
+
4
+ import { AppModule } from "./app/app.module";
5
+ import { environment } from "~env/environment";
6
+
7
+ if (environment.production) {
8
+ enableProdMode();
9
+ }
10
+
11
+ platformBrowserDynamic()
12
+ .bootstrapModule(AppModule)
13
+ .catch(err => console.log(err));
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This file includes polyfills needed by Angular and is loaded before the app.
3
+ * You can add your own extra polyfills to this file.
4
+ *
5
+ * This file is divided into 2 sections:
6
+ * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7
+ * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8
+ * file.
9
+ *
10
+ * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11
+ * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12
+ * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13
+ *
14
+ * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15
+ */
16
+
17
+ /***************************************************************************************************
18
+ * BROWSER POLYFILLS
19
+ */
20
+
21
+ /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22
+ import "core-js/es/symbol";
23
+ import "core-js/es/object";
24
+ import "core-js/es/function";
25
+ import "core-js/es/parse-int";
26
+ import "core-js/es/parse-float";
27
+ import "core-js/es/number";
28
+ import "core-js/es/math";
29
+ import "core-js/es/string";
30
+ import "core-js/es/date";
31
+ import "core-js/es/array";
32
+ import "core-js/es/regexp";
33
+ import "core-js/es/map";
34
+ import "core-js/es/weak-map";
35
+ import "core-js/es/set";
36
+ import "core-js/es/reflect";
37
+
38
+ /** IE10 and IE11 requires the following for NgClass support on SVG elements */
39
+ // import 'classlist.js'; // Run `npm install --save classlist.js`.
40
+
41
+ /** Evergreen, IE10 and IE11 requires the following for the Reflect API. */
42
+ // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
43
+ import "core-js/es/reflect";
44
+
45
+ /**
46
+ * Required to support Web Animations `@angular/platform-browser/animations`.
47
+ * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
48
+ **/
49
+ import "web-animations-js"; // Run `npm install --save web-animations-js`.
50
+
51
+ /***************************************************************************************************
52
+ * Zone JS is required by default for Angular itself.
53
+ */
54
+ import "zone.js/dist/zone"; // Included with Angular CLI.
55
+
56
+ /***************************************************************************************************
57
+ * APPLICATION IMPORTS
58
+ */
@@ -0,0 +1,11 @@
1
+ @import url("https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600,600i,700,700i");
2
+ @import "~primeng/resources/primeng.min.css";
3
+ @import "~@seniorsistemas/primeng-theme/dist/theme.min.css";
4
+
5
+ .favorite * {
6
+ color: #fcbf10 !important;
7
+ }
8
+
9
+ .sds-container {
10
+ position: relative;
11
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../out-tsc/app",
5
+ "types": ["node"],
6
+ "noImplicitAny": false,
7
+ "resolveJsonModule": true,
8
+ "allowSyntheticDefaultImports": true
9
+ },
10
+ "angularCompilerOptions": {
11
+ "enableIvy": true,
12
+ "allowEmptyCodegenFiles": true
13
+ },
14
+ "files": [
15
+ "main.ts",
16
+ "polyfills.ts"
17
+ ],
18
+ "include": [
19
+ "src/**/*.d.ts"
20
+ ]
21
+ }
@@ -0,0 +1,15 @@
1
+ /* SystemJS module definition */
2
+ declare var module: NodeModule;
3
+ interface NodeModule {
4
+ id: string;
5
+ }
6
+
7
+ declare module "json-cycle" {
8
+ function retrocycle(json: any): any;
9
+ function decycle(json: any): any;
10
+ }
11
+
12
+ declare module "*.json" {
13
+ export const content: any;
14
+ export default content;
15
+ }