@sd-angular/core 19.0.0-beta.7 → 19.0.0-beta.70

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 (232) hide show
  1. package/README.md +686 -33
  2. package/assets/scss/ckeditor5.scss +60 -2
  3. package/assets/scss/core/bootstrap.scss +17 -0
  4. package/assets/scss/core/form.scss +32 -6
  5. package/assets/scss/core/grid.scss +40 -0
  6. package/assets/scss/sd-core.scss +1 -0
  7. package/assets/scss/themes/material-theme.scss +82 -40
  8. package/components/anchor-v2/src/components/anchor-item-v2/anchor-item-v2.component.d.ts +5 -5
  9. package/components/anchor-v2/src/models/sd-anchor-v2.model.d.ts +3 -3
  10. package/components/avatar/index.d.ts +1 -0
  11. package/components/avatar/src/avatar.component.d.ts +19 -0
  12. package/components/badge/src/badge.component.d.ts +77 -19
  13. package/components/button/src/button.component.d.ts +30 -28
  14. package/components/code-editor/index.d.ts +1 -0
  15. package/components/code-editor/src/code-editor.component.d.ts +25 -0
  16. package/components/document-builder/index.d.ts +1 -0
  17. package/components/document-builder/src/document-builder.component.d.ts +12 -41
  18. package/components/document-builder/src/document-builder.model.d.ts +14 -11
  19. package/components/document-builder/src/plugins/block-space/block-space.plugin.d.ts +9 -0
  20. package/components/document-builder/src/plugins/ck-comment/ck-comment.plugin.d.ts +44 -0
  21. package/components/document-builder/src/plugins/ck-comment/ck-comment.plugin.model.d.ts +57 -0
  22. package/components/document-builder/src/plugins/heading/heading.plugin.d.ts +1 -0
  23. package/components/document-builder/src/plugins/highlight-range/highlight-range.plugin.d.ts +4 -0
  24. package/components/document-builder/src/plugins/image-custom/image-custom.plugin.d.ts +31 -0
  25. package/components/document-builder/src/plugins/index.d.ts +7 -2
  26. package/components/document-builder/src/plugins/page-orientation/page-orientation.plugin.d.ts +2 -2
  27. package/components/document-builder/src/plugins/paste-handler/filters/bookmark.d.ts +14 -0
  28. package/components/document-builder/src/plugins/paste-handler/filters/br.d.ts +15 -0
  29. package/components/document-builder/src/plugins/paste-handler/filters/image.d.ts +25 -0
  30. package/components/document-builder/src/plugins/paste-handler/filters/list.d.ts +29 -0
  31. package/components/document-builder/src/plugins/paste-handler/filters/parse.d.ts +35 -0
  32. package/components/document-builder/src/plugins/paste-handler/filters/removeboldwrapper.d.ts +15 -0
  33. package/components/document-builder/src/plugins/paste-handler/filters/removegooglesheetstag.d.ts +15 -0
  34. package/components/document-builder/src/plugins/paste-handler/filters/removeinvalidtablewidth.d.ts +15 -0
  35. package/components/document-builder/src/plugins/paste-handler/filters/removemsattributes.d.ts +15 -0
  36. package/components/document-builder/src/plugins/paste-handler/filters/removestyleblock.d.ts +15 -0
  37. package/components/document-builder/src/plugins/paste-handler/filters/removexmlns.d.ts +15 -0
  38. package/components/document-builder/src/plugins/paste-handler/filters/replacemsfootnotes.d.ts +54 -0
  39. package/components/document-builder/src/plugins/paste-handler/filters/replacetabswithinprewithspaces.d.ts +24 -0
  40. package/components/document-builder/src/plugins/paste-handler/filters/space.d.ts +27 -0
  41. package/components/document-builder/src/plugins/paste-handler/filters/table.d.ts +16 -0
  42. package/components/document-builder/src/plugins/paste-handler/filters/utils.d.ts +25 -0
  43. package/components/document-builder/src/plugins/paste-handler/index.d.ts +35 -0
  44. package/components/document-builder/src/plugins/paste-handler/normalizers/googledocsnormalizer.d.ts +31 -0
  45. package/components/document-builder/src/plugins/paste-handler/normalizers/googlesheetsnormalizer.d.ts +31 -0
  46. package/components/document-builder/src/plugins/paste-handler/normalizers/mswordnormalizer.d.ts +29 -0
  47. package/components/document-builder/src/plugins/paste-handler/types.d.ts +30 -0
  48. package/components/document-builder/src/plugins/table-custom/index.d.ts +34 -0
  49. package/components/document-builder/src/plugins/variable/variable.plugin.d.ts +39 -0
  50. package/components/index.d.ts +4 -0
  51. package/components/mini-editor/index.d.ts +2 -0
  52. package/components/mini-editor/src/mini-editor.component.d.ts +90 -0
  53. package/components/mini-editor/src/mini-editor.model.d.ts +44 -0
  54. package/components/section/index.d.ts +1 -0
  55. package/components/section/src/section-item/section-item.component.d.ts +7 -0
  56. package/components/section/src/section.component.d.ts +11 -11
  57. package/components/side-drawer/src/side-drawer.component.d.ts +11 -24
  58. package/components/tab-router/src/components/tab-router-item/tab-router-item.component.d.ts +4 -1
  59. package/components/tab-router/src/components/tab-router-outlet/tab-router-outlet.component.d.ts +3 -15
  60. package/components/table/src/components/column-filter/column-filter.component.d.ts +3 -3
  61. package/components/table/src/components/desktop-cell/desktop-cell.component.d.ts +21 -9
  62. package/components/table/src/components/desktop-cell-view/desktop-cell-view.component.d.ts +21 -7
  63. package/components/table/src/components/external-filter/external-filter.component.d.ts +1 -1
  64. package/components/table/src/components/selector-action/action-filter.pipe.d.ts +11 -10
  65. package/components/table/src/components/selector-action/selector-action.component.d.ts +5 -3
  66. package/components/table/src/directives/index.d.ts +2 -0
  67. package/components/table/src/directives/sd-table-column-filter-def.directive.d.ts +9 -0
  68. package/components/table/src/directives/sticky-shadow.directive.d.ts +17 -0
  69. package/components/table/src/models/table-column.model.d.ts +38 -34
  70. package/components/table/src/models/table-command.model.d.ts +7 -3
  71. package/components/table/src/models/table-item.model.d.ts +5 -4
  72. package/components/table/src/models/table-option-config.model.d.ts +5 -0
  73. package/components/table/src/models/table-option-export.model.d.ts +3 -2
  74. package/components/table/src/models/table-option-selector.model.d.ts +11 -10
  75. package/components/table/src/models/table-option.model.d.ts +9 -8
  76. package/components/table/src/services/index.d.ts +3 -0
  77. package/components/table/src/services/table-export/table-export.service.d.ts +26 -0
  78. package/components/table/src/services/table-filter/table-filter.model.d.ts +6 -5
  79. package/components/table/src/services/table-format/table-format.service.d.ts +16 -0
  80. package/components/table/src/table.component.d.ts +39 -53
  81. package/components/upload-file/src/configurations/upload-file.configuration.d.ts +1 -1
  82. package/components/upload-file/src/services/upload-file.service.d.ts +0 -1
  83. package/components/upload-file/src/upload-file.component.d.ts +49 -54
  84. package/components/view/index.d.ts +1 -0
  85. package/components/view/src/view.component.d.ts +16 -0
  86. package/components/workflow/src/models/form-generic-component.model.d.ts +5 -4
  87. package/components/workflow/src/models/index.d.ts +1 -0
  88. package/directives/index.d.ts +2 -0
  89. package/directives/src/sd-href.directive.d.ts +9 -0
  90. package/directives/src/sd-tooltip.directive.d.ts +26 -0
  91. package/fesm2022/sd-angular-core-components-anchor-v2.mjs +15 -15
  92. package/fesm2022/sd-angular-core-components-anchor-v2.mjs.map +1 -1
  93. package/fesm2022/sd-angular-core-components-avatar.mjs +103 -0
  94. package/fesm2022/sd-angular-core-components-avatar.mjs.map +1 -0
  95. package/fesm2022/sd-angular-core-components-badge.mjs +101 -91
  96. package/fesm2022/sd-angular-core-components-badge.mjs.map +1 -1
  97. package/fesm2022/sd-angular-core-components-button.mjs +70 -96
  98. package/fesm2022/sd-angular-core-components-button.mjs.map +1 -1
  99. package/fesm2022/sd-angular-core-components-code-editor.mjs +127 -0
  100. package/fesm2022/sd-angular-core-components-code-editor.mjs.map +1 -0
  101. package/fesm2022/sd-angular-core-components-document-builder.mjs +4006 -611
  102. package/fesm2022/sd-angular-core-components-document-builder.mjs.map +1 -1
  103. package/fesm2022/sd-angular-core-components-history.mjs +1 -1
  104. package/fesm2022/sd-angular-core-components-history.mjs.map +1 -1
  105. package/fesm2022/sd-angular-core-components-import-excel.mjs +1 -1
  106. package/fesm2022/sd-angular-core-components-import-excel.mjs.map +1 -1
  107. package/fesm2022/sd-angular-core-components-mini-editor.mjs +326 -0
  108. package/fesm2022/sd-angular-core-components-mini-editor.mjs.map +1 -0
  109. package/fesm2022/sd-angular-core-components-preview.mjs +1 -1
  110. package/fesm2022/sd-angular-core-components-preview.mjs.map +1 -1
  111. package/fesm2022/sd-angular-core-components-quick-action.mjs +2 -2
  112. package/fesm2022/sd-angular-core-components-quick-action.mjs.map +1 -1
  113. package/fesm2022/sd-angular-core-components-section.mjs +41 -43
  114. package/fesm2022/sd-angular-core-components-section.mjs.map +1 -1
  115. package/fesm2022/sd-angular-core-components-side-drawer.mjs +78 -84
  116. package/fesm2022/sd-angular-core-components-side-drawer.mjs.map +1 -1
  117. package/fesm2022/sd-angular-core-components-tab-router.mjs +152 -226
  118. package/fesm2022/sd-angular-core-components-tab-router.mjs.map +1 -1
  119. package/fesm2022/sd-angular-core-components-table.mjs +1188 -1185
  120. package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
  121. package/fesm2022/sd-angular-core-components-upload-file.mjs +339 -444
  122. package/fesm2022/sd-angular-core-components-upload-file.mjs.map +1 -1
  123. package/fesm2022/sd-angular-core-components-view.mjs +45 -0
  124. package/fesm2022/sd-angular-core-components-view.mjs.map +1 -0
  125. package/fesm2022/sd-angular-core-components-workflow.mjs +47 -57
  126. package/fesm2022/sd-angular-core-components-workflow.mjs.map +1 -1
  127. package/fesm2022/sd-angular-core-components.mjs +4 -0
  128. package/fesm2022/sd-angular-core-components.mjs.map +1 -1
  129. package/fesm2022/sd-angular-core-directives.mjs +286 -27
  130. package/fesm2022/sd-angular-core-directives.mjs.map +1 -1
  131. package/fesm2022/sd-angular-core-forms-autocomplete.mjs +289 -363
  132. package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
  133. package/fesm2022/sd-angular-core-forms-chip-calendar.mjs +26 -6
  134. package/fesm2022/sd-angular-core-forms-chip-calendar.mjs.map +1 -1
  135. package/fesm2022/sd-angular-core-forms-chip.mjs +24 -4
  136. package/fesm2022/sd-angular-core-forms-chip.mjs.map +1 -1
  137. package/fesm2022/sd-angular-core-forms-date-range.mjs +180 -242
  138. package/fesm2022/sd-angular-core-forms-date-range.mjs.map +1 -1
  139. package/fesm2022/sd-angular-core-forms-date.mjs +178 -270
  140. package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
  141. package/fesm2022/sd-angular-core-forms-datetime.mjs +177 -285
  142. package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
  143. package/fesm2022/sd-angular-core-forms-input-number.mjs +210 -337
  144. package/fesm2022/sd-angular-core-forms-input-number.mjs.map +1 -1
  145. package/fesm2022/sd-angular-core-forms-input.mjs +169 -286
  146. package/fesm2022/sd-angular-core-forms-input.mjs.map +1 -1
  147. package/fesm2022/sd-angular-core-forms-radio.mjs +3 -2
  148. package/fesm2022/sd-angular-core-forms-radio.mjs.map +1 -1
  149. package/fesm2022/sd-angular-core-forms-select.mjs +390 -447
  150. package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
  151. package/fesm2022/sd-angular-core-forms-textarea.mjs +167 -226
  152. package/fesm2022/sd-angular-core-forms-textarea.mjs.map +1 -1
  153. package/fesm2022/sd-angular-core-modules-keycloak.mjs +126 -0
  154. package/fesm2022/sd-angular-core-modules-keycloak.mjs.map +1 -0
  155. package/fesm2022/sd-angular-core-modules-layout.mjs +454 -453
  156. package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
  157. package/fesm2022/sd-angular-core-modules.mjs +1 -1
  158. package/fesm2022/sd-angular-core-services-api.mjs +5 -10
  159. package/fesm2022/sd-angular-core-services-api.mjs.map +1 -1
  160. package/fesm2022/sd-angular-core-services-confirm.mjs +5 -7
  161. package/fesm2022/sd-angular-core-services-confirm.mjs.map +1 -1
  162. package/fesm2022/sd-angular-core-services-docx.mjs +173 -0
  163. package/fesm2022/sd-angular-core-services-docx.mjs.map +1 -0
  164. package/fesm2022/sd-angular-core-services-notify.mjs +2 -2
  165. package/fesm2022/sd-angular-core-services-notify.mjs.map +1 -1
  166. package/fesm2022/sd-angular-core-services.mjs +1 -0
  167. package/fesm2022/sd-angular-core-services.mjs.map +1 -1
  168. package/fesm2022/sd-angular-core-utilities-extensions.mjs +21 -45
  169. package/fesm2022/sd-angular-core-utilities-extensions.mjs.map +1 -1
  170. package/fesm2022/sd-angular-core-utilities-models.mjs +15 -1
  171. package/fesm2022/sd-angular-core-utilities-models.mjs.map +1 -1
  172. package/forms/autocomplete/src/autocomplete.component.d.ts +55 -55
  173. package/forms/chip/src/chip.component.d.ts +8 -2
  174. package/forms/chip-calendar/src/chip-calendar.component.d.ts +8 -2
  175. package/forms/date/src/date.component.d.ts +48 -46
  176. package/forms/date-range/src/date-range.component.d.ts +35 -34
  177. package/forms/datetime/src/datetime.component.d.ts +48 -49
  178. package/forms/input/src/input.component.d.ts +54 -57
  179. package/forms/input-number/src/input-number.component.d.ts +53 -54
  180. package/forms/select/src/select.component.d.ts +67 -64
  181. package/forms/textarea/src/textarea.component.d.ts +40 -43
  182. package/modules/index.d.ts +1 -1
  183. package/modules/keycloak/index.d.ts +4 -0
  184. package/modules/keycloak/keycloak.configuration.d.ts +11 -0
  185. package/modules/keycloak/keycloak.interceptor.d.ts +2 -0
  186. package/modules/keycloak/keycloak.module.d.ts +18 -0
  187. package/modules/keycloak/keycloak.service.d.ts +14 -0
  188. package/modules/layout/components/layout-main/layout-main.component.d.ts +7 -12
  189. package/modules/layout/components/page/page.component.d.ts +5 -7
  190. package/modules/layout/components/sidebar-v1/components/sidebar/sidebar.component.d.ts +22 -29
  191. package/modules/layout/components/sidebar-v1/components/user/user.component.d.ts +11 -17
  192. package/modules/layout/components/sidebar-v1/main.component.d.ts +14 -14
  193. package/modules/layout/configurations/layout.configuration.d.ts +46 -3
  194. package/modules/layout/modules/forbidden/pages/root/root.component.d.ts +3 -8
  195. package/modules/layout/modules/home/components/home-page/home-page.component.d.ts +2 -5
  196. package/modules/layout/modules/not-found/pages/root/root.component.d.ts +3 -8
  197. package/modules/layout/pipes/high-light-search.pipe.d.ts +1 -1
  198. package/modules/layout/services/index.d.ts +1 -0
  199. package/modules/layout/services/layout.service.d.ts +10 -0
  200. package/modules/layout/services/menu/menu.model.d.ts +2 -0
  201. package/modules/layout/services/storage/storage.service.d.ts +0 -3
  202. package/package.json +66 -43
  203. package/sd-angular-core-19.0.0-beta.70.tgz +0 -0
  204. package/services/api/src/api.model.d.ts +6 -1
  205. package/services/confirm/src/lib/confirm.service.d.ts +1 -0
  206. package/services/docx/index.d.ts +1 -0
  207. package/services/docx/src/lib/docx.model.d.ts +9 -0
  208. package/services/docx/src/lib/docx.service.d.ts +13 -0
  209. package/services/docx/src/public-api.d.ts +2 -0
  210. package/services/index.d.ts +1 -0
  211. package/services/notify/index.d.ts +1 -0
  212. package/services/notify/src/notify.model.d.ts +1 -1
  213. package/services/notify/src/notify.service.d.ts +5 -5
  214. package/utilities/extensions/src/string.extension.d.ts +2 -0
  215. package/utilities/extensions/src/utility.extension.d.ts +1 -0
  216. package/utilities/models/index.d.ts +3 -0
  217. package/utilities/models/src/filter.model.d.ts +17 -4
  218. package/utilities/models/src/icon.model.d.ts +2 -0
  219. package/utilities/models/src/nested-key-of.model.d.ts +5 -0
  220. package/utilities/models/src/order.model.d.ts +2 -1
  221. package/utilities/models/src/paging.model.d.ts +2 -1
  222. package/utilities/models/src/pattern.model.d.ts +1 -1
  223. package/utilities/models/src/unwrap-signal.model.d.ts +6 -0
  224. package/components/document-builder/src/plugins/comment/comment.plugin.d.ts +0 -4
  225. package/components/document-builder/src/plugins/table-fit/table-fit.plugin.d.ts +0 -4
  226. package/fesm2022/sd-angular-core-modules-oidc.mjs +0 -127
  227. package/fesm2022/sd-angular-core-modules-oidc.mjs.map +0 -1
  228. package/modules/oidc/dynamic-sts.loader.d.ts +0 -11
  229. package/modules/oidc/index.d.ts +0 -2
  230. package/modules/oidc/oidc.configuration.d.ts +0 -11
  231. package/modules/oidc/oidc.module.d.ts +0 -14
  232. package/sd-angular-core-19.0.0-beta.7.tgz +0 -0
@@ -1,11 +1,24 @@
1
+ import { SdNestedKeyOf } from './nested-key-of.model';
1
2
  import { SdOperatorHasData, SdOperatorNoData } from './operator.model';
2
- export type SdFilter<T = any> = SdFilterHasData<T> | SdFilterNoData<T>;
3
+ export type SdFilter<T = any> = SdFilterHasData<T> | SdFilterBetween<T> | SdFilterNoData<T> | SdFilterAndOr<T>;
3
4
  export interface SdFilterHasData<T = any> {
4
- field: Extract<keyof T, string>;
5
- operator: SdOperatorHasData;
5
+ field: SdNestedKeyOf<T>;
6
+ operator: Exclude<SdOperatorHasData, 'BETWEEN'>;
6
7
  data: any;
7
8
  }
9
+ export interface SdFilterBetween<T = any> {
10
+ field: SdNestedKeyOf<T>;
11
+ operator: 'BETWEEN';
12
+ data: {
13
+ from: string | number;
14
+ to: string | number;
15
+ };
16
+ }
8
17
  export interface SdFilterNoData<T = any> {
9
- field: Extract<keyof T, string>;
18
+ field: SdNestedKeyOf<T>;
10
19
  operator: SdOperatorNoData;
11
20
  }
21
+ export interface SdFilterAndOr<T = any> {
22
+ operator: 'AND' | 'OR';
23
+ data: SdFilter<T>[];
24
+ }
@@ -0,0 +1,2 @@
1
+ export type MaterialIconFontSet = 'material-icons' | 'material-icons-outlined' | 'material-icons-round' | 'material-icons-sharp' | 'material-symbols-outlined';
2
+ export declare const DefaultMaterialIconFontSet: MaterialIconFontSet;
@@ -0,0 +1,5 @@
1
+ type Primitive = string | number | boolean | null | undefined | Date | Function;
2
+ export type SdNestedKeyOf<ObjectType, Depth extends number[] = []> = Depth['length'] extends 4 ? never : ObjectType extends object ? {
3
+ [Key in keyof ObjectType & string]: ObjectType[Key] extends Primitive ? Key : ObjectType[Key] extends Array<any> ? Key : ObjectType[Key] extends object ? Key | `${Key}.${SdNestedKeyOf<ObjectType[Key], [...Depth, 1]>}` : Key;
4
+ }[keyof ObjectType & string] : string;
5
+ export {};
@@ -1,4 +1,5 @@
1
+ import { SdNestedKeyOf } from "./nested-key-of.model";
1
2
  export interface SdOrder<T = any> {
2
- field: Extract<keyof T, string>;
3
+ field: SdNestedKeyOf<T>;
3
4
  direction: 'ASC' | 'DESC';
4
5
  }
@@ -1,8 +1,9 @@
1
1
  import { SdFilter } from './filter.model';
2
+ import { SdNestedKeyOf } from './nested-key-of.model';
2
3
  import { SdOrder } from './order.model';
3
4
  export interface SdQueryReq<T = any> {
4
5
  filters?: SdFilter<T>[];
5
- fields?: Extract<keyof T, string>[];
6
+ fields?: SdNestedKeyOf<T>[];
6
7
  }
7
8
  export interface SdPagingReq<T = any> extends SdQueryReq<T> {
8
9
  pageSize?: number;
@@ -1,4 +1,4 @@
1
- export type SdPatternType = 'EMAIL' | 'PHONE' | 'PHONE_VN';
1
+ export type SdPatternType = 'EMAIL' | 'PHONE' | 'PHONE_VN' | 'IDVN_OR_PASSPORT' | 'TIME';
2
2
  export interface SdPatternCommon {
3
3
  type: SdPatternType;
4
4
  name: string;
@@ -0,0 +1,6 @@
1
+ import { InputSignal, InputSignalWithTransform, ModelSignal } from '@angular/core';
2
+ /**
3
+ * Utility Type: Bóc tách kiểu dữ liệu gốc từ Angular Signal Inputs & Models
4
+ */
5
+ export type SdUnwrapSignal<T> = T extends InputSignalWithTransform<any, infer WriteT> ? WriteT : T extends InputSignal<infer ReadT> ? ReadT : T extends ModelSignal<infer ModelT> ? ModelT : T;
6
+ export type SdUnwrapSafe<T> = SdUnwrapSignal<NonNullable<T>>;
@@ -1,4 +0,0 @@
1
- import { Plugin } from 'ckeditor5';
2
- export declare class CommentPlugin extends Plugin {
3
- init(): void;
4
- }
@@ -1,4 +0,0 @@
1
- import { Plugin } from 'ckeditor5';
2
- export declare class TableFitPlugin extends Plugin {
3
- init(): void;
4
- }
@@ -1,127 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Inject, Injectable, NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { StsConfigLoader, LogLevel, provideAuth, authInterceptor } from 'angular-auth-oidc-client';
5
- import { from, map } from 'rxjs';
6
- import { provideHttpClient, withInterceptors } from '@angular/common/http';
7
-
8
- const SD_OIDC_CONFIGURATION = new InjectionToken('sd-oidc.configuration');
9
-
10
- class DynamicStsLoader extends StsConfigLoader {
11
- oidcConfiguration;
12
- constructor(oidcConfiguration) {
13
- super();
14
- this.oidcConfiguration = oidcConfiguration;
15
- }
16
- // SỬA LỖI TYPE: Trả về Observable<OpenIdConfiguration[]>
17
- loadConfigs() {
18
- const loaderPromise = this.oidcConfiguration.loadTenantConfig();
19
- // Dùng 'from' chuyển Promise -> Observable
20
- return from(loaderPromise).pipe(map(tenantConfig => {
21
- const authority = `${tenantConfig.url}/realms/${tenantConfig.realm}`;
22
- console.log('Authority:', authority);
23
- console.log('SecureRoutes:', tenantConfig.secureRoutes);
24
- const config = {
25
- authority,
26
- redirectUrl: window.location.origin,
27
- postLogoutRedirectUri: window.location.origin,
28
- clientId: tenantConfig.clientId,
29
- scope: 'openid profile email offline_access',
30
- responseType: 'code',
31
- silentRenew: true, // Tự động Refresh Token
32
- useRefreshToken: true,
33
- ignoreNonceAfterRefresh: true,
34
- renewTimeBeforeTokenExpiresInSeconds: 10,
35
- logLevel: LogLevel.Warn,
36
- // Cập nhật domain API của bạn vào đây để Interceptor tự đính Token
37
- secureRoutes: tenantConfig.secureRoutes?.filter(route => !!route)?.map(route => route.trim()),
38
- };
39
- // Trả về mảng (bắt buộc với bản mới)
40
- return [config];
41
- }));
42
- }
43
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DynamicStsLoader, deps: [{ token: SD_OIDC_CONFIGURATION }], target: i0.ɵɵFactoryTarget.Injectable });
44
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DynamicStsLoader });
45
- }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DynamicStsLoader, decorators: [{
47
- type: Injectable
48
- }], ctorParameters: () => [{ type: undefined, decorators: [{
49
- type: Inject,
50
- args: [SD_OIDC_CONFIGURATION]
51
- }] }] });
52
-
53
- // 5. Module Wrapper
54
- class SdOidcModule {
55
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
- static forRoot(options) {
57
- if (options.useFactory) {
58
- return {
59
- ngModule: SdOidcModule,
60
- providers: [
61
- {
62
- provide: SD_OIDC_CONFIGURATION,
63
- useFactory: options.useFactory,
64
- deps: options.deps,
65
- },
66
- // B. Provide Auth Logic (Dùng cú pháp provideAuth mới ngay trong NgModule)
67
- provideAuth({
68
- loader: {
69
- provide: StsConfigLoader,
70
- useClass: DynamicStsLoader,
71
- },
72
- }),
73
- provideHttpClient(withInterceptors([authInterceptor()])),
74
- ],
75
- };
76
- }
77
- if (options.useClass) {
78
- return {
79
- ngModule: SdOidcModule,
80
- providers: [
81
- {
82
- provide: SD_OIDC_CONFIGURATION,
83
- useClass: options.useClass,
84
- },
85
- // B. Provide Auth Logic (Dùng cú pháp provideAuth mới ngay trong NgModule)
86
- provideAuth({
87
- loader: {
88
- provide: StsConfigLoader,
89
- useClass: DynamicStsLoader,
90
- },
91
- }),
92
- provideHttpClient(withInterceptors([authInterceptor()])),
93
- ],
94
- };
95
- }
96
- return {
97
- ngModule: SdOidcModule,
98
- providers: [
99
- // B. Provide Auth Logic (Dùng cú pháp provideAuth mới ngay trong NgModule)
100
- provideAuth({
101
- loader: {
102
- provide: StsConfigLoader,
103
- useClass: DynamicStsLoader,
104
- },
105
- }),
106
- provideHttpClient(withInterceptors([authInterceptor()])),
107
- ],
108
- };
109
- }
110
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdOidcModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
111
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: SdOidcModule, imports: [CommonModule] });
112
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdOidcModule, imports: [CommonModule] });
113
- }
114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdOidcModule, decorators: [{
115
- type: NgModule,
116
- args: [{
117
- imports: [CommonModule],
118
- exports: [],
119
- }]
120
- }] });
121
-
122
- /**
123
- * Generated bundle index. Do not edit.
124
- */
125
-
126
- export { SD_OIDC_CONFIGURATION, SdOidcModule };
127
- //# sourceMappingURL=sd-angular-core-modules-oidc.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sd-angular-core-modules-oidc.mjs","sources":["../../../projects/sd-angular/modules/oidc/oidc.configuration.ts","../../../projects/sd-angular/modules/oidc/dynamic-sts.loader.ts","../../../projects/sd-angular/modules/oidc/oidc.module.ts","../../../projects/sd-angular/modules/oidc/sd-angular-core-modules-oidc.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\n\r\nexport interface SdOidcTenantConfig {\r\n url: string;\r\n realm: string;\r\n clientId: string;\r\n // Cập nhật domain API của bạn vào đây để Interceptor tự đính Token, ví dụ: ['https://dev.api.com']\r\n secureRoutes: string[];\r\n}\r\n\r\nexport interface ISdOidcConfiguration {\r\n loadTenantConfig: () => Promise<SdOidcTenantConfig>;\r\n}\r\n\r\nexport const SD_OIDC_CONFIGURATION = new InjectionToken<ISdOidcConfiguration>('sd-oidc.configuration');","import { Inject, Injectable } from '@angular/core';\r\nimport { LogLevel, OpenIdConfiguration, StsConfigLoader } from 'angular-auth-oidc-client';\r\nimport { from, map, Observable } from 'rxjs';\r\nimport { ISdOidcConfiguration, SD_OIDC_CONFIGURATION } from './oidc.configuration';\r\n\r\n@Injectable()\r\nexport class DynamicStsLoader extends StsConfigLoader {\r\n constructor(@Inject(SD_OIDC_CONFIGURATION) private oidcConfiguration: ISdOidcConfiguration) {\r\n super();\r\n }\r\n\r\n // SỬA LỖI TYPE: Trả về Observable<OpenIdConfiguration[]>\r\n override loadConfigs(): Observable<OpenIdConfiguration[]> {\r\n const loaderPromise = this.oidcConfiguration.loadTenantConfig();\r\n\r\n // Dùng 'from' chuyển Promise -> Observable\r\n return from(loaderPromise).pipe(\r\n map(tenantConfig => {\r\n const authority = `${tenantConfig.url}/realms/${tenantConfig.realm}`;\r\n console.log('Authority:', authority);\r\n console.log('SecureRoutes:', tenantConfig.secureRoutes);\r\n const config: OpenIdConfiguration = {\r\n authority,\r\n redirectUrl: window.location.origin,\r\n postLogoutRedirectUri: window.location.origin,\r\n clientId: tenantConfig.clientId,\r\n scope: 'openid profile email offline_access',\r\n responseType: 'code',\r\n silentRenew: true, // Tự động Refresh Token\r\n useRefreshToken: true,\r\n ignoreNonceAfterRefresh: true,\r\n renewTimeBeforeTokenExpiresInSeconds: 10,\r\n logLevel: LogLevel.Warn,\r\n // Cập nhật domain API của bạn vào đây để Interceptor tự đính Token\r\n secureRoutes: tenantConfig.secureRoutes?.filter(route => !!route)?.map(route => route.trim()),\r\n };\r\n // Trả về mảng (bắt buộc với bản mới)\r\n return [config];\r\n })\r\n );\r\n }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { ModuleWithProviders, NgModule, Type } from '@angular/core';\r\nimport { authInterceptor, provideAuth, StsConfigLoader } from 'angular-auth-oidc-client';\r\nimport { DynamicStsLoader } from './dynamic-sts.loader';\r\nimport { provideHttpClient, withInterceptors } from '@angular/common/http';\r\nimport { ISdOidcConfiguration, SD_OIDC_CONFIGURATION } from './oidc.configuration';\r\n\r\n// 5. Module Wrapper\r\n@NgModule({\r\n imports: [CommonModule],\r\n exports: [],\r\n})\r\nexport class SdOidcModule {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n static forRoot(options: {\r\n useClass?: Type<ISdOidcConfiguration>;\r\n useFactory?: (...args: any[]) => ISdOidcConfiguration;\r\n deps?: any[];\r\n }): ModuleWithProviders<SdOidcModule> {\r\n if (options.useFactory) {\r\n return {\r\n ngModule: SdOidcModule,\r\n providers: [\r\n {\r\n provide: SD_OIDC_CONFIGURATION,\r\n useFactory: options.useFactory,\r\n deps: options.deps,\r\n },\r\n // B. Provide Auth Logic (Dùng cú pháp provideAuth mới ngay trong NgModule)\r\n provideAuth({\r\n loader: {\r\n provide: StsConfigLoader,\r\n useClass: DynamicStsLoader,\r\n },\r\n }),\r\n provideHttpClient(withInterceptors([authInterceptor()])),\r\n ],\r\n };\r\n }\r\n if (options.useClass) {\r\n return {\r\n ngModule: SdOidcModule,\r\n providers: [\r\n {\r\n provide: SD_OIDC_CONFIGURATION,\r\n useClass: options.useClass,\r\n },\r\n // B. Provide Auth Logic (Dùng cú pháp provideAuth mới ngay trong NgModule)\r\n provideAuth({\r\n loader: {\r\n provide: StsConfigLoader,\r\n useClass: DynamicStsLoader,\r\n },\r\n }),\r\n provideHttpClient(withInterceptors([authInterceptor()])),\r\n ],\r\n };\r\n }\r\n return {\r\n ngModule: SdOidcModule,\r\n providers: [\r\n // B. Provide Auth Logic (Dùng cú pháp provideAuth mới ngay trong NgModule)\r\n provideAuth({\r\n loader: {\r\n provide: StsConfigLoader,\r\n useClass: DynamicStsLoader,\r\n },\r\n }),\r\n provideHttpClient(withInterceptors([authInterceptor()])),\r\n ],\r\n };\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAca,qBAAqB,GAAG,IAAI,cAAc,CAAuB,uBAAuB;;ACR/F,MAAO,gBAAiB,SAAQ,eAAe,CAAA;AACA,IAAA,iBAAA;AAAnD,IAAA,WAAA,CAAmD,iBAAuC,EAAA;AACxF,QAAA,KAAK,EAAE;QAD0C,IAAA,CAAA,iBAAiB,GAAjB,iBAAiB;IAEpE;;IAGS,WAAW,GAAA;QAClB,MAAM,aAAa,GAAG,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE;;QAG/D,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAC7B,GAAG,CAAC,YAAY,IAAG;YACjB,MAAM,SAAS,GAAG,CAAA,EAAG,YAAY,CAAC,GAAG,CAAA,QAAA,EAAW,YAAY,CAAC,KAAK,CAAA,CAAE;AACpE,YAAA,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC;YACpC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,YAAY,CAAC,YAAY,CAAC;AACvD,YAAA,MAAM,MAAM,GAAwB;gBAClC,SAAS;AACT,gBAAA,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;AACnC,gBAAA,qBAAqB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;gBAC7C,QAAQ,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EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,YAHb,YAAY,CAAA,EAAA,CAAA;;4FAGX,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC;AACvB,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -1,11 +0,0 @@
1
- import { OpenIdConfiguration, StsConfigLoader } from 'angular-auth-oidc-client';
2
- import { Observable } from 'rxjs';
3
- import { ISdOidcConfiguration } from './oidc.configuration';
4
- import * as i0 from "@angular/core";
5
- export declare class DynamicStsLoader extends StsConfigLoader {
6
- private oidcConfiguration;
7
- constructor(oidcConfiguration: ISdOidcConfiguration);
8
- loadConfigs(): Observable<OpenIdConfiguration[]>;
9
- static ɵfac: i0.ɵɵFactoryDeclaration<DynamicStsLoader, never>;
10
- static ɵprov: i0.ɵɵInjectableDeclaration<DynamicStsLoader>;
11
- }
@@ -1,2 +0,0 @@
1
- export * from './oidc.configuration';
2
- export * from './oidc.module';
@@ -1,11 +0,0 @@
1
- import { InjectionToken } from "@angular/core";
2
- export interface SdOidcTenantConfig {
3
- url: string;
4
- realm: string;
5
- clientId: string;
6
- secureRoutes: string[];
7
- }
8
- export interface ISdOidcConfiguration {
9
- loadTenantConfig: () => Promise<SdOidcTenantConfig>;
10
- }
11
- export declare const SD_OIDC_CONFIGURATION: InjectionToken<ISdOidcConfiguration>;
@@ -1,14 +0,0 @@
1
- import { ModuleWithProviders, Type } from '@angular/core';
2
- import { ISdOidcConfiguration } from './oidc.configuration';
3
- import * as i0 from "@angular/core";
4
- import * as i1 from "@angular/common";
5
- export declare class SdOidcModule {
6
- static forRoot(options: {
7
- useClass?: Type<ISdOidcConfiguration>;
8
- useFactory?: (...args: any[]) => ISdOidcConfiguration;
9
- deps?: any[];
10
- }): ModuleWithProviders<SdOidcModule>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<SdOidcModule, never>;
12
- static ɵmod: i0.ɵɵNgModuleDeclaration<SdOidcModule, never, [typeof i1.CommonModule], never>;
13
- static ɵinj: i0.ɵɵInjectorDeclaration<SdOidcModule>;
14
- }
Binary file