@xxmachina/components 0.0.0-PLACEHOLDER

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 (195) hide show
  1. package/extras/flow/index.d.ts +183 -0
  2. package/features/command/index.d.ts +67 -0
  3. package/features/query/index.d.ts +162 -0
  4. package/fesm2022/xxmachina-components-extras-flow.mjs +397 -0
  5. package/fesm2022/xxmachina-components-extras-flow.mjs.map +1 -0
  6. package/fesm2022/xxmachina-components-features-command.mjs +93 -0
  7. package/fesm2022/xxmachina-components-features-command.mjs.map +1 -0
  8. package/fesm2022/xxmachina-components-features-query.mjs +256 -0
  9. package/fesm2022/xxmachina-components-features-query.mjs.map +1 -0
  10. package/fesm2022/xxmachina-components-groups-command-form.mjs +73 -0
  11. package/fesm2022/xxmachina-components-groups-command-form.mjs.map +1 -0
  12. package/fesm2022/xxmachina-components-groups-query-form.mjs +215 -0
  13. package/fesm2022/xxmachina-components-groups-query-form.mjs.map +1 -0
  14. package/fesm2022/xxmachina-components-molecules-calendar-paginator.mjs +51 -0
  15. package/fesm2022/xxmachina-components-molecules-calendar-paginator.mjs.map +1 -0
  16. package/fesm2022/xxmachina-components-molecules-daily-cell.mjs +158 -0
  17. package/fesm2022/xxmachina-components-molecules-daily-cell.mjs.map +1 -0
  18. package/fesm2022/xxmachina-components-molecules-weekly-header.mjs +33 -0
  19. package/fesm2022/xxmachina-components-molecules-weekly-header.mjs.map +1 -0
  20. package/fesm2022/xxmachina-components-organisms-calendar-section.mjs +123 -0
  21. package/fesm2022/xxmachina-components-organisms-calendar-section.mjs.map +1 -0
  22. package/fesm2022/xxmachina-components-organisms-event-input-section.mjs +150 -0
  23. package/fesm2022/xxmachina-components-organisms-event-input-section.mjs.map +1 -0
  24. package/fesm2022/xxmachina-components-organisms-terminal-input-section.mjs +123 -0
  25. package/fesm2022/xxmachina-components-organisms-terminal-input-section.mjs.map +1 -0
  26. package/fesm2022/xxmachina-components-organisms-video-trimmer-section.mjs +93 -0
  27. package/fesm2022/xxmachina-components-organisms-video-trimmer-section.mjs.map +1 -0
  28. package/fesm2022/xxmachina-components-organisms-xterm.mjs +94 -0
  29. package/fesm2022/xxmachina-components-organisms-xterm.mjs.map +1 -0
  30. package/fesm2022/xxmachina-components-pages-command.mjs +482 -0
  31. package/fesm2022/xxmachina-components-pages-command.mjs.map +1 -0
  32. package/fesm2022/xxmachina-components-pages-query-v2.mjs +198 -0
  33. package/fesm2022/xxmachina-components-pages-query-v2.mjs.map +1 -0
  34. package/fesm2022/xxmachina-components-pages-query.mjs +782 -0
  35. package/fesm2022/xxmachina-components-pages-query.mjs.map +1 -0
  36. package/fesm2022/xxmachina-components-pages-thread.mjs +176 -0
  37. package/fesm2022/xxmachina-components-pages-thread.mjs.map +1 -0
  38. package/fesm2022/xxmachina-components-routes-commands-command.routes-CSwIdXZg.mjs +19 -0
  39. package/fesm2022/xxmachina-components-routes-commands-command.routes-CSwIdXZg.mjs.map +1 -0
  40. package/fesm2022/xxmachina-components-routes-commands-pages.routes-j2xVop4W.mjs +10 -0
  41. package/fesm2022/xxmachina-components-routes-commands-pages.routes-j2xVop4W.mjs.map +1 -0
  42. package/fesm2022/xxmachina-components-routes-commands.mjs +104 -0
  43. package/fesm2022/xxmachina-components-routes-commands.mjs.map +1 -0
  44. package/fesm2022/xxmachina-components-routes-pages.mjs +62 -0
  45. package/fesm2022/xxmachina-components-routes-pages.mjs.map +1 -0
  46. package/fesm2022/xxmachina-components-routes-preloading.mjs +22 -0
  47. package/fesm2022/xxmachina-components-routes-preloading.mjs.map +1 -0
  48. package/fesm2022/xxmachina-components-routes-queries-pages.routes-CfrglCIL.mjs +9 -0
  49. package/fesm2022/xxmachina-components-routes-queries-pages.routes-CfrglCIL.mjs.map +1 -0
  50. package/fesm2022/xxmachina-components-routes-queries.mjs +147 -0
  51. package/fesm2022/xxmachina-components-routes-queries.mjs.map +1 -0
  52. package/fesm2022/xxmachina-components-routes-query-pages.routes-CxTbOJDQ.mjs +17 -0
  53. package/fesm2022/xxmachina-components-routes-query-pages.routes-CxTbOJDQ.mjs.map +1 -0
  54. package/fesm2022/xxmachina-components-routes-query.mjs +42 -0
  55. package/fesm2022/xxmachina-components-routes-query.mjs.map +1 -0
  56. package/fesm2022/xxmachina-components-routes-resources-pages.routes-CzjQOxwT.mjs +9 -0
  57. package/fesm2022/xxmachina-components-routes-resources-pages.routes-CzjQOxwT.mjs.map +1 -0
  58. package/fesm2022/xxmachina-components-routes-resources-resource.routes-C5KpB3KM.mjs +131 -0
  59. package/fesm2022/xxmachina-components-routes-resources-resource.routes-C5KpB3KM.mjs.map +1 -0
  60. package/fesm2022/xxmachina-components-routes-resources.mjs +130 -0
  61. package/fesm2022/xxmachina-components-routes-resources.mjs.map +1 -0
  62. package/fesm2022/xxmachina-components-routes-side-chat.mjs +19 -0
  63. package/fesm2022/xxmachina-components-routes-side-chat.mjs.map +1 -0
  64. package/fesm2022/xxmachina-components-routes-side.mjs +18 -0
  65. package/fesm2022/xxmachina-components-routes-side.mjs.map +1 -0
  66. package/fesm2022/xxmachina-components-routes-transformer.mjs +99 -0
  67. package/fesm2022/xxmachina-components-routes-transformer.mjs.map +1 -0
  68. package/fesm2022/xxmachina-components-routes-transformers-pages.routes-02pVsNas.mjs +9 -0
  69. package/fesm2022/xxmachina-components-routes-transformers-pages.routes-02pVsNas.mjs.map +1 -0
  70. package/fesm2022/xxmachina-components-routes-transformers.mjs +75 -0
  71. package/fesm2022/xxmachina-components-routes-transformers.mjs.map +1 -0
  72. package/fesm2022/xxmachina-components-routes.mjs +35 -0
  73. package/fesm2022/xxmachina-components-routes.mjs.map +1 -0
  74. package/fesm2022/xxmachina-components-services-app.mjs +30 -0
  75. package/fesm2022/xxmachina-components-services-app.mjs.map +1 -0
  76. package/fesm2022/xxmachina-components-services-assistant.mjs +43 -0
  77. package/fesm2022/xxmachina-components-services-assistant.mjs.map +1 -0
  78. package/fesm2022/xxmachina-components-services-calendar.mjs +27 -0
  79. package/fesm2022/xxmachina-components-services-calendar.mjs.map +1 -0
  80. package/fesm2022/xxmachina-components-services-command.mjs +138 -0
  81. package/fesm2022/xxmachina-components-services-command.mjs.map +1 -0
  82. package/fesm2022/xxmachina-components-services-context.mjs +23 -0
  83. package/fesm2022/xxmachina-components-services-context.mjs.map +1 -0
  84. package/fesm2022/xxmachina-components-services-contract.mjs +29 -0
  85. package/fesm2022/xxmachina-components-services-contract.mjs.map +1 -0
  86. package/fesm2022/xxmachina-components-services-debug.mjs +48 -0
  87. package/fesm2022/xxmachina-components-services-debug.mjs.map +1 -0
  88. package/fesm2022/xxmachina-components-services-forms-query.mjs +70 -0
  89. package/fesm2022/xxmachina-components-services-forms-query.mjs.map +1 -0
  90. package/fesm2022/xxmachina-components-services-forms-schedule.mjs +78 -0
  91. package/fesm2022/xxmachina-components-services-forms-schedule.mjs.map +1 -0
  92. package/fesm2022/xxmachina-components-services-forms-variables.mjs +34 -0
  93. package/fesm2022/xxmachina-components-services-forms-variables.mjs.map +1 -0
  94. package/fesm2022/xxmachina-components-services-graphql.mjs +34 -0
  95. package/fesm2022/xxmachina-components-services-graphql.mjs.map +1 -0
  96. package/fesm2022/xxmachina-components-services-invoice.mjs +130 -0
  97. package/fesm2022/xxmachina-components-services-invoice.mjs.map +1 -0
  98. package/fesm2022/xxmachina-components-services-json-schema.mjs +61 -0
  99. package/fesm2022/xxmachina-components-services-json-schema.mjs.map +1 -0
  100. package/fesm2022/xxmachina-components-services-link.mjs +31 -0
  101. package/fesm2022/xxmachina-components-services-link.mjs.map +1 -0
  102. package/fesm2022/xxmachina-components-services-message.mjs +50 -0
  103. package/fesm2022/xxmachina-components-services-message.mjs.map +1 -0
  104. package/fesm2022/xxmachina-components-services-openai.mjs +113 -0
  105. package/fesm2022/xxmachina-components-services-openai.mjs.map +1 -0
  106. package/fesm2022/xxmachina-components-services-openapi.mjs +40 -0
  107. package/fesm2022/xxmachina-components-services-openapi.mjs.map +1 -0
  108. package/fesm2022/xxmachina-components-services-order.mjs +37 -0
  109. package/fesm2022/xxmachina-components-services-order.mjs.map +1 -0
  110. package/fesm2022/xxmachina-components-services-partner.mjs +42 -0
  111. package/fesm2022/xxmachina-components-services-partner.mjs.map +1 -0
  112. package/fesm2022/xxmachina-components-services-query.mjs +66 -0
  113. package/fesm2022/xxmachina-components-services-query.mjs.map +1 -0
  114. package/fesm2022/xxmachina-components-services-recording.mjs +71 -0
  115. package/fesm2022/xxmachina-components-services-recording.mjs.map +1 -0
  116. package/fesm2022/xxmachina-components-services-schedule.mjs +53 -0
  117. package/fesm2022/xxmachina-components-services-schedule.mjs.map +1 -0
  118. package/fesm2022/xxmachina-components-services-thread.mjs +125 -0
  119. package/fesm2022/xxmachina-components-services-thread.mjs.map +1 -0
  120. package/fesm2022/xxmachina-components-services-transformer.mjs +31 -0
  121. package/fesm2022/xxmachina-components-services-transformer.mjs.map +1 -0
  122. package/fesm2022/xxmachina-components-services-youtube.mjs +28 -0
  123. package/fesm2022/xxmachina-components-services-youtube.mjs.map +1 -0
  124. package/fesm2022/xxmachina-components-templates-agent.mjs +549 -0
  125. package/fesm2022/xxmachina-components-templates-agent.mjs.map +1 -0
  126. package/fesm2022/xxmachina-components-templates-background.mjs +309 -0
  127. package/fesm2022/xxmachina-components-templates-background.mjs.map +1 -0
  128. package/fesm2022/xxmachina-components-templates-invoice-iframe.mjs +48 -0
  129. package/fesm2022/xxmachina-components-templates-invoice-iframe.mjs.map +1 -0
  130. package/fesm2022/xxmachina-components-templates-scheduler.mjs +178 -0
  131. package/fesm2022/xxmachina-components-templates-scheduler.mjs.map +1 -0
  132. package/fesm2022/xxmachina-components-templates-video.mjs +101 -0
  133. package/fesm2022/xxmachina-components-templates-video.mjs.map +1 -0
  134. package/fesm2022/xxmachina-components-validators-query.mjs +38 -0
  135. package/fesm2022/xxmachina-components-validators-query.mjs.map +1 -0
  136. package/fesm2022/xxmachina-components.mjs +278 -0
  137. package/fesm2022/xxmachina-components.mjs.map +1 -0
  138. package/groups/command-form/index.d.ts +13 -0
  139. package/groups/query-form/index.d.ts +56 -0
  140. package/index.d.ts +71 -0
  141. package/molecules/calendar-paginator/index.d.ts +14 -0
  142. package/molecules/daily-cell/index.d.ts +35 -0
  143. package/molecules/weekly-header/index.d.ts +11 -0
  144. package/organisms/calendar-section/index.d.ts +25 -0
  145. package/organisms/event-input-section/index.d.ts +45 -0
  146. package/organisms/terminal-input-section/index.d.ts +37 -0
  147. package/organisms/video-trimmer-section/index.d.ts +30 -0
  148. package/organisms/xterm/index.d.ts +23 -0
  149. package/package.json +258 -0
  150. package/pages/command/index.d.ts +217 -0
  151. package/pages/query/index.d.ts +292 -0
  152. package/pages/query-v2/index.d.ts +68 -0
  153. package/pages/thread/index.d.ts +109 -0
  154. package/routes/commands/index.d.ts +5 -0
  155. package/routes/index.d.ts +5 -0
  156. package/routes/pages/index.d.ts +5 -0
  157. package/routes/preloading/index.d.ts +11 -0
  158. package/routes/queries/index.d.ts +5 -0
  159. package/routes/query/index.d.ts +5 -0
  160. package/routes/resources/index.d.ts +5 -0
  161. package/routes/side/chat/index.d.ts +5 -0
  162. package/routes/side/index.d.ts +5 -0
  163. package/routes/transformer/index.d.ts +5 -0
  164. package/routes/transformers/index.d.ts +5 -0
  165. package/services/app/index.d.ts +17 -0
  166. package/services/assistant/index.d.ts +20 -0
  167. package/services/calendar/index.d.ts +13 -0
  168. package/services/command/index.d.ts +54 -0
  169. package/services/context/index.d.ts +10 -0
  170. package/services/contract/index.d.ts +11 -0
  171. package/services/debug/index.d.ts +14 -0
  172. package/services/forms/query/index.d.ts +46 -0
  173. package/services/forms/schedule/index.d.ts +42 -0
  174. package/services/forms/variables/index.d.ts +12 -0
  175. package/services/graphql/index.d.ts +20 -0
  176. package/services/invoice/index.d.ts +19 -0
  177. package/services/json-schema/index.d.ts +15 -0
  178. package/services/link/index.d.ts +13 -0
  179. package/services/message/index.d.ts +23 -0
  180. package/services/openai/index.d.ts +35 -0
  181. package/services/openapi/index.d.ts +17 -0
  182. package/services/order/index.d.ts +13 -0
  183. package/services/partner/index.d.ts +11 -0
  184. package/services/query/index.d.ts +42 -0
  185. package/services/recording/index.d.ts +20 -0
  186. package/services/schedule/index.d.ts +26 -0
  187. package/services/thread/index.d.ts +30 -0
  188. package/services/transformer/index.d.ts +19 -0
  189. package/services/youtube/index.d.ts +10 -0
  190. package/templates/agent/index.d.ts +54 -0
  191. package/templates/background/index.d.ts +44 -0
  192. package/templates/invoice-iframe/index.d.ts +13 -0
  193. package/templates/scheduler/index.d.ts +31 -0
  194. package/templates/video/index.d.ts +36 -0
  195. package/validators/query/index.d.ts +7 -0
@@ -0,0 +1,482 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, effect, computed, untracked, input, Directive, Component } from '@angular/core';
4
+ import { FormGroup, FormArray, FormControl } from '@angular/forms';
5
+ import { RouterOutletFrame } from '@ng-atomic/components/frames/router-outlet';
6
+ import { CommandService } from '@xxmachina/components/services/command';
7
+ import { InjectableComponent, applyToInput, provideEffect, _computed, TokenizedType, NgAtomicComponent, Effect } from '@ng-atomic/core';
8
+ import { ActivatedRoute } from '@angular/router';
9
+ import { FormTemplateStore, FormTemplate } from '@ng-atomic/components/templates/form';
10
+ import { injectRouteParam, injectRouteData, injectRouteParam$, injectUnflattenRouteParam$, injectRouteData$, injectRouteParamMap, getValue$, injectUnflattenRouteParam, getInvalid$, injectRouteSkip } from '@ng-atomic/common/utils';
11
+ import { combineLatest, filter, map, tap, shareReplay, of } from 'rxjs';
12
+ import { AppService } from '@ng-atomic/common/services/app';
13
+ import { makeDI, injectNavStartActionsV2 } from '@ng-atomic/common/services/ui';
14
+ import { Query, QueryHelper, EndpointHelper } from '@xxmachina/common/domain/models';
15
+ import { pick, merge } from 'lodash-es';
16
+ import { injectOne$ } from '@ng-atomic/common/stores/entities';
17
+ import { MachinaDevService } from '@xxmachina/components/services/debug';
18
+ import { derivedAsync } from 'ngxtension/derived-async';
19
+ import { CommandFeature } from '@xxmachina/components/features/command';
20
+ import { TabsFrame } from '@ng-atomic/components/frames/tabs';
21
+ import { QueryFormGroup } from '@xxmachina/components/groups/query-form';
22
+ import { CommandFormGroup } from '@xxmachina/components/groups/command-form';
23
+ import { QueryFeature, QueryGraphqlSchemaFeature } from '@xxmachina/components/features/query';
24
+ import { CloudStorageService } from '@nx-ddd/common/infrastructure/externals/cloud-storage';
25
+ import { injectErrorMessageResolver } from '@ng-atomic/common/pipes/error';
26
+
27
+ var CommandPageStore_1;
28
+ var ActionId;
29
+ (function (ActionId) {
30
+ ActionId["EXECUTE_COMMAND"] = "execute-command";
31
+ ActionId["FILE_SELECTED"] = "file-selected";
32
+ })(ActionId || (ActionId = {}));
33
+ function buildFormData(form, formData = new FormData(), parentKey = '') {
34
+ Object.keys(form.controls).forEach(key => {
35
+ const control = form.get(key);
36
+ const formKey = parentKey ? `${parentKey}.${key}` : key;
37
+ if (control instanceof FormGroup || control instanceof FormArray) {
38
+ // 子のFormGroupやFormArrayを再帰的に処理
39
+ buildFormData(control, formData, formKey);
40
+ }
41
+ else if (control instanceof FormControl) {
42
+ // フォームの値を追加
43
+ const value = control.value;
44
+ if (value !== null && value !== undefined) {
45
+ formData.append(formKey, value);
46
+ }
47
+ }
48
+ });
49
+ return formData;
50
+ }
51
+ function buildData(form, contentType) {
52
+ if (contentType === 'multipart/form-data') {
53
+ return buildFormData(form);
54
+ }
55
+ else {
56
+ return form.getRawValue();
57
+ }
58
+ }
59
+ function buildActions(hasPermission, invalid) {
60
+ return hasPermission
61
+ ? [{ id: ActionId.EXECUTE_COMMAND, name: '実行', disabled: invalid }]
62
+ : [{ id: ActionId.EXECUTE_COMMAND, name: '実行権限がありません', disabled: true }];
63
+ }
64
+ let CommandPageStore = class CommandPageStore extends InjectableComponent {
65
+ static { CommandPageStore_1 = this; }
66
+ static { this.ActionId = ActionId; }
67
+ static { this.DI = makeDI(CommandPageStore_1, () => {
68
+ const dev = inject(MachinaDevService);
69
+ return () => ({
70
+ style: {
71
+ width: 'var(--page-width-lv1)',
72
+ },
73
+ baseUrls: [],
74
+ command: {
75
+ id: '1',
76
+ webApiRequest: {
77
+ serverUrl: null,
78
+ apiJsonUrl: null,
79
+ path: '/users',
80
+ method: 'GET',
81
+ bodySchema: null,
82
+ },
83
+ },
84
+ navEndActions: [],
85
+ additionalFormFieldMap: (dev.isDevMode() ? {} : {
86
+ 'id': { type: 'hidden' },
87
+ '__typename': { type: 'hidden' },
88
+ 'kind': { type: 'hidden' },
89
+ }),
90
+ });
91
+ }, ['@xxmachina/components', 'pages', 'command']); }
92
+ static { this.Config = CommandPageStore_1.DI.Config; }
93
+ static { this.Initializer = CommandPageStore_1.DI.Initializer; }
94
+ static provideDefault() {
95
+ return [
96
+ CommandPageStore_1.DI.provideConfig(),
97
+ CommandPageStore_1.provideDefaultInitializer(),
98
+ CommandPageStore_1.provideDefaultEffects(),
99
+ ];
100
+ }
101
+ static provideCustom() {
102
+ return [
103
+ CommandPageStore_1.provideDefault(),
104
+ CommandPageStore_1.provideCommandIdFromRouteDataInitializer(),
105
+ CommandPageStore_1.provideSetupInitializeQueryInitializer(),
106
+ ];
107
+ }
108
+ static provideDefaultV2() {
109
+ return [
110
+ CommandPageStore_1.Config.provide(),
111
+ CommandPageStore_1.provideDefaultInitializer(),
112
+ CommandPageStore_1.provideDefaultEffects(),
113
+ CommandPageStore_1.provideCommandIdFromRouteDataInitializer(),
114
+ CommandPageStore_1.provideSetupInitializeQueryInitializer(),
115
+ CommandPageStore_1.provideInitialFormValueFromQueryResult(),
116
+ CommandPageStore_1.provideQueryFromRouteData(),
117
+ ];
118
+ }
119
+ static provideDefaultInitializer() {
120
+ return [
121
+ CommandPageStore_1.providePatchFormFromRouteParamInitializer(),
122
+ CommandPageStore_1.providePatchCommandFormValueFromCommandInitializer(),
123
+ CommandPageStore_1.provideInitialFormValueFromQueryResult()
124
+ ];
125
+ }
126
+ static provideDefaultEffects() {
127
+ return [
128
+ CommandPageStore_1.provideExecuteCommandEffect(),
129
+ CommandPageStore_1.provideBackEffect(),
130
+ QueryFeature.provideDefaultEffects(),
131
+ ];
132
+ }
133
+ static provideCommandFromRouteParamInitializer(paramName = 'commandId') {
134
+ return CommandPageStore_1.Initializer.provide((store) => {
135
+ const commandId = injectRouteParam(paramName);
136
+ const service = inject(CommandService);
137
+ effect(() => applyToInput(store, 'command', service.getCommand(commandId())));
138
+ });
139
+ }
140
+ static provideCommandIdFromRouteDataInitializer() {
141
+ return CommandPageStore_1.Initializer.provide((store) => {
142
+ const commandId = injectRouteData('commandId');
143
+ const service = inject(CommandService);
144
+ effect(() => applyToInput(store, 'command', service.getCommand(commandId())));
145
+ });
146
+ }
147
+ static providePatchFormFromRouteParamInitializer() {
148
+ return [
149
+ CommandPageStore_1.Initializer.provide(store => {
150
+ effect(() => store.form().patchValue(store.data()));
151
+ }),
152
+ ];
153
+ }
154
+ static providePatchCommandFormValueFromCommandInitializer() {
155
+ return [
156
+ CommandPageStore_1.Initializer.provide(store => {
157
+ effect(() => {
158
+ if (!store.command())
159
+ return;
160
+ store.feature.commandForm().patchValue({ ...store.command() });
161
+ });
162
+ })
163
+ ];
164
+ }
165
+ static provideQueryIdFromRouteParam(key = 'queryId') {
166
+ return CommandPageStore_1.Initializer.provide((store) => {
167
+ const queryId$ = injectRouteParam$(key);
168
+ const params$ = injectUnflattenRouteParam$('data');
169
+ const query$ = injectOne$(Query, { id: queryId$ });
170
+ const setupQuery = derivedAsync(() => combineLatest({
171
+ query: query$,
172
+ params: params$,
173
+ }).pipe(filter(({ query, params }) => !!query && !!params), map(({ query, params }) => QueryHelper.setup(query, params)), tap((query) => console.debug('[CommandPage] query:', query)), shareReplay(1)));
174
+ effect(() => {
175
+ console.debug('[CommandPage] setupQuery:', setupQuery());
176
+ store.queryFeature.form.patchValue(setupQuery());
177
+ });
178
+ });
179
+ }
180
+ static provideQueryFromRouteData(key = 'query') {
181
+ return CommandPageStore_1.Initializer.provide((store) => {
182
+ const params$ = injectUnflattenRouteParam$('data');
183
+ const query$ = injectRouteData$(key);
184
+ const setupQuery = derivedAsync(() => combineLatest({
185
+ query: query$,
186
+ params: params$,
187
+ }).pipe(filter(({ query, params }) => !!query), map(({ query, params }) => QueryHelper.setup(query, params)), shareReplay(1)));
188
+ effect(() => { store.queryFeature.form.patchValue(setupQuery()); });
189
+ });
190
+ }
191
+ static provideRouteParamsToDataInitializer(projector) {
192
+ return CommandPageStore_1.Initializer.provide((store) => {
193
+ const route = inject(ActivatedRoute);
194
+ const data = derivedAsync(() => route.params.pipe(map(params => projector(params))));
195
+ effect(() => applyToInput(store, 'data', data()));
196
+ });
197
+ }
198
+ static provideRouteParamMapToDataInitializer(projector) {
199
+ return CommandPageStore_1.Initializer.provide((store) => {
200
+ const paramMap = injectRouteParamMap({ merge: true });
201
+ const data = computed(() => projector(paramMap()));
202
+ effect(() => applyToInput(store, 'data', data()));
203
+ });
204
+ }
205
+ static provideSetupInitializeQueryInitializer() {
206
+ return CommandPageStore_1.Initializer.provide((store) => {
207
+ const initializeQuery = derivedAsync(() => combineLatest({
208
+ initializeQuery: of(store.initializeQuery()),
209
+ data: of(store.data())
210
+ }).pipe(filter(({ initializeQuery, data }) => !!initializeQuery && !!data), map(({ initializeQuery, data }) => QueryHelper.setup(initializeQuery, data)), filter((initializeQuery) => !!initializeQuery), shareReplay(1)));
211
+ effect(() => store.queryFeature.form.patchValue(initializeQuery()));
212
+ });
213
+ }
214
+ static provideInitialFormValueFromQueryResult() {
215
+ return CommandPageStore_1.Initializer.provide((store) => {
216
+ effect(() => store.form().patchValue(store.queryFeature.result()));
217
+ store.queryFeature.refresh();
218
+ });
219
+ }
220
+ static provideExecuteCommandEffect() {
221
+ return provideEffect(ActionId.EXECUTE_COMMAND, () => {
222
+ const store = inject(CommandPageStore_1);
223
+ const app = inject(AppService);
224
+ const paramKeys = computed(() => EndpointHelper.extract(store.feature.path()));
225
+ const resolvedParams = computed(() => pick(store.data(), paramKeys()));
226
+ return () => {
227
+ const resolvedEndpoint = EndpointHelper.resolve(store.feature.path(), resolvedParams());
228
+ const data = buildData(store.form(), store.command()?.webApiRequest?.contentType);
229
+ const command = merge(store.command(), store.feature.commandForm().getRawValue(), { webApiRequest: { path: resolvedEndpoint } });
230
+ app.loading.await(() => {
231
+ return store.feature.execute(command, data).then(() => {
232
+ app.snackBar.open('成功しました。');
233
+ // history.back();
234
+ }).catch((error) => {
235
+ console.error(error);
236
+ app.snackBar.openError(error);
237
+ });
238
+ });
239
+ };
240
+ });
241
+ }
242
+ static provideBackEffect() {
243
+ return provideEffect(FormTemplateStore.ActionId.BACK, () => {
244
+ return () => history.back();
245
+ });
246
+ }
247
+ static provideFileSelectedEffect() {
248
+ return provideEffect(CommandPageStore_1.ActionId.FILE_SELECTED, () => {
249
+ const store = inject(CommandPageStore_1);
250
+ return (payload) => {
251
+ store.form().patchValue({ file: payload.files?.[0] });
252
+ };
253
+ });
254
+ }
255
+ static provideDebugFormInitializer() {
256
+ return CommandPageStore_1.Initializer.provide(() => {
257
+ const store = inject(CommandPageStore_1);
258
+ // FormGroupを再帰的に調べる関数(invalidなコントロールのみ)
259
+ const getInvalidControls = (formGroup, path = '') => {
260
+ let invalidControls = [];
261
+ Object.keys(formGroup.controls).forEach(key => {
262
+ const control = formGroup.controls[key];
263
+ const currentPath = path ? `${path}.${key}` : key;
264
+ // invalidなコントロールを記録
265
+ if (control.invalid) {
266
+ invalidControls.push({
267
+ path: currentPath,
268
+ errors: control.errors,
269
+ value: control.value,
270
+ status: control.status,
271
+ valid: control.valid,
272
+ invalid: control.invalid,
273
+ dirty: control.dirty,
274
+ touched: control.touched
275
+ });
276
+ }
277
+ // FormGroupの場合は再帰的に調べる
278
+ if (control.controls) {
279
+ invalidControls = invalidControls.concat(getInvalidControls(control, currentPath));
280
+ }
281
+ });
282
+ return invalidControls;
283
+ };
284
+ const formValue_ = derivedAsync(() => getValue$(store.form()));
285
+ effect(() => {
286
+ const formValue = formValue_();
287
+ const form = untracked(() => store.form());
288
+ console.log('[CommandPage] Form value changed:', formValue);
289
+ console.log('[CommandPage] CommandForm valid:', form?.valid);
290
+ console.log('[CommandPage] CommandForm status:', form?.status);
291
+ if (form) {
292
+ const invalidControls = getInvalidControls(form);
293
+ const invalidPaths = invalidControls.map(control => control.path);
294
+ console.log(`[CommandPage] Found ${invalidControls.length} INVALID controls:`);
295
+ console.log('[CommandPage] INVALID PATHS:', invalidPaths);
296
+ }
297
+ });
298
+ });
299
+ }
300
+ static provideSelectedFileUploadEffect(callbackFactory, { validator = () => null, getPath, }) {
301
+ return provideEffect(CommandPageStore_1.ActionId.FILE_SELECTED, () => {
302
+ const storage = inject(CloudStorageService);
303
+ const app = inject(AppService);
304
+ const callback = callbackFactory();
305
+ const errorMessageResolver = injectErrorMessageResolver();
306
+ return (payload) => {
307
+ const file = payload.files?.[0];
308
+ const errors = validator(file);
309
+ if (errors && Object.keys(errors).length > 0) {
310
+ app.snackBar.open(errorMessageResolver(errors));
311
+ return;
312
+ }
313
+ return app.loading.await(() => {
314
+ const path = getPath();
315
+ return storage.upload(path, file).then(() => {
316
+ app.snackBar.open('ファイルをアップロードしました');
317
+ return storage.getDownloadUrl(path).then((imageUrl) => {
318
+ return callback({ file, path, url: imageUrl });
319
+ });
320
+ }).catch((error) => {
321
+ console.error(error);
322
+ app.snackBar.open('ファイルのアップロードに失敗しました');
323
+ });
324
+ });
325
+ };
326
+ });
327
+ }
328
+ #navStartActions;
329
+ constructor() {
330
+ super();
331
+ this.feature = inject(CommandFeature);
332
+ this.config = CommandPageStore_1.Config.inject();
333
+ this.queryFeature = inject(QueryFeature);
334
+ this.style = input(_computed(() => this.config().style));
335
+ this.#navStartActions = injectNavStartActionsV2();
336
+ this.navStartActions = input(_computed(() => this.#navStartActions()));
337
+ this.navEndActions = input(_computed(() => this.config().navEndActions));
338
+ this.command = input(_computed(() => this.config().command));
339
+ this.form = input(_computed(() => this.feature.form()));
340
+ this.extractedFormFieldMap = input(_computed(() => this.feature.extractedFormFieldMap()));
341
+ this.additionalFormFieldMap = input(_computed(() => this.config().additionalFormFieldMap));
342
+ this.formFieldMap = input(_computed(() => ({
343
+ ...this.extractedFormFieldMap(),
344
+ ...this.additionalFormFieldMap()
345
+ })));
346
+ this.formFieldKeys = input(_computed(() => []));
347
+ this.formFlatExcludes = input(_computed(() => []));
348
+ this._initializeQuery = injectRouteData('query');
349
+ this.initializeQuery = input(_computed(() => this._initializeQuery()));
350
+ this._data = injectUnflattenRouteParam('data');
351
+ this.data = input(_computed(() => this._data()));
352
+ this.formInvalid = derivedAsync(() => getInvalid$(this.form()));
353
+ this.title = input(_computed(() => this.feature.title()));
354
+ this.actions = derivedAsync(() => buildActions(this.feature.hasPermission(this.command()), this.formInvalid()));
355
+ this.skip = injectRouteSkip();
356
+ CommandPageStore_1.Initializer.initializeStore(this);
357
+ }
358
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: CommandPageStore, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
359
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.5", type: CommandPageStore, isStandalone: true, inputs: { style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, navStartActions: { classPropertyName: "navStartActions", publicName: "navStartActions", isSignal: true, isRequired: false, transformFunction: null }, navEndActions: { classPropertyName: "navEndActions", publicName: "navEndActions", isSignal: true, isRequired: false, transformFunction: null }, command: { classPropertyName: "command", publicName: "command", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, extractedFormFieldMap: { classPropertyName: "extractedFormFieldMap", publicName: "extractedFormFieldMap", isSignal: true, isRequired: false, transformFunction: null }, additionalFormFieldMap: { classPropertyName: "additionalFormFieldMap", publicName: "additionalFormFieldMap", isSignal: true, isRequired: false, transformFunction: null }, formFieldMap: { classPropertyName: "formFieldMap", publicName: "formFieldMap", isSignal: true, isRequired: false, transformFunction: null }, formFieldKeys: { classPropertyName: "formFieldKeys", publicName: "formFieldKeys", isSignal: true, isRequired: false, transformFunction: null }, formFlatExcludes: { classPropertyName: "formFlatExcludes", publicName: "formFlatExcludes", isSignal: true, isRequired: false, transformFunction: null }, initializeQuery: { classPropertyName: "initializeQuery", publicName: "initializeQuery", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
360
+ };
361
+ CommandPageStore = CommandPageStore_1 = __decorate([
362
+ TokenizedType(),
363
+ __metadata("design:paramtypes", [])
364
+ ], CommandPageStore);
365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: CommandPageStore, decorators: [{
366
+ type: Directive,
367
+ args: [{ standalone: true }]
368
+ }], ctorParameters: () => [] });
369
+ class CommandPage extends NgAtomicComponent {
370
+ constructor() {
371
+ super(...arguments);
372
+ this.store = inject(CommandPageStore);
373
+ this.route = inject(ActivatedRoute);
374
+ this.app = inject(AppService);
375
+ this.parentRouterOutletFrame = inject(RouterOutletFrame, { optional: true });
376
+ }
377
+ onFileSelected(payload) {
378
+ this.dispatch({ id: ActionId.FILE_SELECTED, payload });
379
+ }
380
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: CommandPage, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
381
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.5", type: CommandPage, isStandalone: true, selector: "pages-command", providers: [
382
+ CommandFeature,
383
+ QueryFeature,
384
+ QueryGraphqlSchemaFeature
385
+ ], usesInheritance: true, hostDirectives: [{ directive: CommandPageStore, inputs: ["style", "style", "navEndActions", "navEndActions", "command", "command", "form", "form", "additionalFormFieldMap", "additionalFormFieldMap", "formFieldMap", "formFieldMap", "formFlatExcludes", "formFlatExcludes", "initializeQuery", "initializeQuery", "data", "data"] }], ngImport: i0, template: `
386
+ <frames-router-outlet [skip]="store.skip()" (action)="dispatch($event)">
387
+ <templates-form
388
+ [form]="store.form()"
389
+ [style]="store.style()"
390
+ [fieldMap]="store.formFieldMap()"
391
+ [fieldKeys]="store.formFieldKeys()"
392
+ [formFlatExcludes]="store.formFlatExcludes()"
393
+ [title]="store.title()"
394
+ [navStartActions]="store.navStartActions()"
395
+ [navEndActions]="store.navEndActions()"
396
+ [actions]="store.actions()"
397
+ (action)="dispatch($event)"
398
+ >
399
+ <frames-tabs [labels]="['Command', 'InitializeQuery']" dashboard>
400
+ <ng-template #tab>
401
+ <groups-command-form (action)="dispatch($event)"/>
402
+ </ng-template>
403
+ <ng-template #tab>
404
+ <groups-query-form
405
+ [form]="store.queryFeature.form"
406
+ (action)="dispatch($event)"
407
+ />
408
+ </ng-template>
409
+ </frames-tabs>
410
+ </templates-form>
411
+ </frames-router-outlet>
412
+ `, isInline: true, styles: [":host{width:100%;height:100%;display:block;--page-width-lv1-SCOPED-IN-command-fWwl: var(--page-width-lv1)}:host .template{--first-content-height: 0px;width:var(--page-width-lv1-SCOPED-IN-command-fWwl)}:host .template div[dashboard]{padding:0;box-sizing:border-box}\n"], dependencies: [{ kind: "component", type: RouterOutletFrame, selector: "frames-router-outlet", outputs: ["events"] }, { kind: "component", type: FormTemplate, selector: "templates-form" }, { kind: "component", type: TabsFrame, selector: "frames-tabs", inputs: ["labels"], outputs: ["selectedTabIndexChange"] }, { kind: "component", type: CommandFormGroup, selector: "groups-command-form", inputs: ["apiJsonUrls"] }, { kind: "component", type: QueryFormGroup, selector: "groups-query-form", inputs: ["form", "keyActions"] }] }); }
413
+ }
414
+ __decorate([
415
+ Effect(FormTemplateStore.ActionId.FILE_SELECTED),
416
+ __metadata("design:type", Function),
417
+ __metadata("design:paramtypes", [Object]),
418
+ __metadata("design:returntype", void 0)
419
+ ], CommandPage.prototype, "onFileSelected", null);
420
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: CommandPage, decorators: [{
421
+ type: Component,
422
+ args: [{ selector: 'pages-command', imports: [
423
+ RouterOutletFrame,
424
+ FormTemplate,
425
+ TabsFrame,
426
+ CommandFormGroup,
427
+ QueryFormGroup
428
+ ], providers: [
429
+ CommandFeature,
430
+ QueryFeature,
431
+ QueryGraphqlSchemaFeature
432
+ ], template: `
433
+ <frames-router-outlet [skip]="store.skip()" (action)="dispatch($event)">
434
+ <templates-form
435
+ [form]="store.form()"
436
+ [style]="store.style()"
437
+ [fieldMap]="store.formFieldMap()"
438
+ [fieldKeys]="store.formFieldKeys()"
439
+ [formFlatExcludes]="store.formFlatExcludes()"
440
+ [title]="store.title()"
441
+ [navStartActions]="store.navStartActions()"
442
+ [navEndActions]="store.navEndActions()"
443
+ [actions]="store.actions()"
444
+ (action)="dispatch($event)"
445
+ >
446
+ <frames-tabs [labels]="['Command', 'InitializeQuery']" dashboard>
447
+ <ng-template #tab>
448
+ <groups-command-form (action)="dispatch($event)"/>
449
+ </ng-template>
450
+ <ng-template #tab>
451
+ <groups-query-form
452
+ [form]="store.queryFeature.form"
453
+ (action)="dispatch($event)"
454
+ />
455
+ </ng-template>
456
+ </frames-tabs>
457
+ </templates-form>
458
+ </frames-router-outlet>
459
+ `, hostDirectives: [
460
+ {
461
+ directive: CommandPageStore,
462
+ inputs: [
463
+ 'style',
464
+ 'navEndActions',
465
+ 'command',
466
+ 'form',
467
+ 'additionalFormFieldMap',
468
+ 'formFieldMap',
469
+ 'formFlatExcludes',
470
+ 'initializeQuery',
471
+ 'data',
472
+ ]
473
+ },
474
+ ], styles: [":host{width:100%;height:100%;display:block;--page-width-lv1-SCOPED-IN-command-fWwl: var(--page-width-lv1)}:host .template{--first-content-height: 0px;width:var(--page-width-lv1-SCOPED-IN-command-fWwl)}:host .template div[dashboard]{padding:0;box-sizing:border-box}\n"] }]
475
+ }], propDecorators: { onFileSelected: [] } });
476
+
477
+ /**
478
+ * Generated bundle index. Do not edit.
479
+ */
480
+
481
+ export { CommandPage, CommandPageStore, buildActions };
482
+ //# sourceMappingURL=xxmachina-components-pages-command.mjs.map