@gravitee/ui-components 3.27.3 → 3.28.0

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 (235) hide show
  1. package/assets/i18n/en.json +3 -1
  2. package/assets/i18n/fr.json +3 -1
  3. package/package.json +19 -18
  4. package/src/atoms/gv-button/gv-button.d.ts +22 -5
  5. package/src/atoms/gv-button/gv-button.js +5 -8
  6. package/src/atoms/gv-button/gv-button.js.map +1 -1
  7. package/src/atoms/gv-button/gv-button.stories.js +11 -14
  8. package/src/atoms/gv-button/gv-button.stories.js.map +1 -1
  9. package/src/atoms/gv-checkbox/gv-checkbox.d.ts +3 -3
  10. package/src/atoms/gv-checkbox/gv-checkbox.stories.js +2 -2
  11. package/src/atoms/gv-checkbox/gv-checkbox.stories.js.map +1 -1
  12. package/src/atoms/gv-date-picker/gv-date-picker.js +32 -19
  13. package/src/atoms/gv-date-picker/gv-date-picker.js.map +1 -1
  14. package/src/atoms/gv-date-picker/gv-date-picker.stories.js +2 -2
  15. package/src/atoms/gv-date-picker/gv-date-picker.stories.js.map +1 -1
  16. package/src/atoms/gv-date-picker-calendar/gv-date-picker-calendar.d.ts +4 -4
  17. package/src/atoms/gv-icon/gv-icon.stories.js +1 -4
  18. package/src/atoms/gv-icon/gv-icon.stories.js.map +1 -1
  19. package/src/atoms/gv-input/gv-input.d.ts +5 -5
  20. package/src/atoms/gv-input/gv-input.js +1 -20
  21. package/src/atoms/gv-input/gv-input.js.map +1 -1
  22. package/src/atoms/gv-input/gv-input.stories.js +13 -13
  23. package/src/atoms/gv-input/gv-input.stories.js.map +1 -1
  24. package/src/atoms/gv-link/gv-link.js +19 -8
  25. package/src/atoms/gv-link/gv-link.js.map +1 -1
  26. package/src/atoms/gv-link/gv-link.stories.js +2 -2
  27. package/src/atoms/gv-link/gv-link.stories.js.map +1 -1
  28. package/src/atoms/gv-message/gv-message.d.ts +1 -1
  29. package/src/atoms/gv-message/gv-message.stories.js +7 -7
  30. package/src/atoms/gv-message/gv-message.stories.js.map +1 -1
  31. package/src/atoms/gv-metric/gv-metric.stories.js +1 -1
  32. package/src/atoms/gv-metric/gv-metric.stories.js.map +1 -1
  33. package/src/atoms/gv-relative-time/gv-relative-time.js +54 -41
  34. package/src/atoms/gv-relative-time/gv-relative-time.js.map +1 -1
  35. package/src/atoms/gv-relative-time/gv-relative-time.stories.js +1 -4
  36. package/src/atoms/gv-relative-time/gv-relative-time.stories.js.map +1 -1
  37. package/src/atoms/gv-select/gv-select.d.ts +2 -2
  38. package/src/atoms/gv-select/gv-select.js +1 -16
  39. package/src/atoms/gv-select/gv-select.js.map +1 -1
  40. package/src/atoms/gv-select/gv-select.stories.js +10 -10
  41. package/src/atoms/gv-select/gv-select.stories.js.map +1 -1
  42. package/src/atoms/gv-select-native/gv-select-native.d.ts +7 -6
  43. package/src/atoms/gv-select-native/gv-select-native.js +28 -28
  44. package/src/atoms/gv-select-native/gv-select-native.js.map +1 -1
  45. package/src/atoms/gv-select-native/gv-select-native.stories.js +10 -10
  46. package/src/atoms/gv-select-native/gv-select-native.stories.js.map +1 -1
  47. package/src/atoms/gv-state/gv-state.stories.js +1 -1
  48. package/src/atoms/gv-state/gv-state.stories.js.map +1 -1
  49. package/src/atoms/gv-switch/gv-switch.stories.js +3 -3
  50. package/src/atoms/gv-switch/gv-switch.stories.js.map +1 -1
  51. package/src/atoms/gv-switch/gv-switch.test.js +21 -12
  52. package/src/atoms/gv-switch/gv-switch.test.js.map +1 -1
  53. package/src/atoms/gv-tag/gv-tag.stories.js +2 -2
  54. package/src/atoms/gv-tag/gv-tag.stories.js.map +1 -1
  55. package/src/atoms/gv-text/gv-text.d.ts +2 -2
  56. package/src/atoms/gv-text/gv-text.stories.js +6 -6
  57. package/src/atoms/gv-text/gv-text.stories.js.map +1 -1
  58. package/src/charts/gv-chart-bar/gv-chart-bar.d.ts +1 -1
  59. package/src/charts/gv-chart-bar/gv-chart-bar.js +68 -57
  60. package/src/charts/gv-chart-bar/gv-chart-bar.js.map +1 -1
  61. package/src/charts/gv-chart-gauge/gv-chart-gauge.d.ts +1 -1
  62. package/src/charts/gv-chart-gauge/gv-chart-gauge.js +42 -39
  63. package/src/charts/gv-chart-gauge/gv-chart-gauge.js.map +1 -1
  64. package/src/charts/gv-chart-histogram/gv-chart-histogram.d.ts +1 -1
  65. package/src/charts/gv-chart-histogram/gv-chart-histogram.js +56 -45
  66. package/src/charts/gv-chart-histogram/gv-chart-histogram.js.map +1 -1
  67. package/src/charts/gv-chart-line/gv-chart-line.d.ts +1 -1
  68. package/src/charts/gv-chart-line/gv-chart-line.js +115 -111
  69. package/src/charts/gv-chart-line/gv-chart-line.js.map +1 -1
  70. package/src/charts/gv-chart-map/gv-chart-map.d.ts +1 -1
  71. package/src/charts/gv-chart-map/gv-chart-map.js +78 -67
  72. package/src/charts/gv-chart-map/gv-chart-map.js.map +1 -1
  73. package/src/charts/gv-chart-map/gv-chart-map.stories.js +2 -2
  74. package/src/charts/gv-chart-map/gv-chart-map.stories.js.map +1 -1
  75. package/src/charts/gv-chart-pie/gv-chart-pie.d.ts +1 -1
  76. package/src/charts/gv-chart-pie/gv-chart-pie.js +58 -47
  77. package/src/charts/gv-chart-pie/gv-chart-pie.js.map +1 -1
  78. package/src/charts/gv-chart-pie/gv-chart-pie.stories.js +15 -6
  79. package/src/charts/gv-chart-pie/gv-chart-pie.stories.js.map +1 -1
  80. package/src/lib/cron-expression.js +1 -1
  81. package/src/lib/cron-expression.js.map +1 -1
  82. package/src/lib/events.js +1 -6
  83. package/src/lib/events.js.map +1 -1
  84. package/src/lib/i18n.d.ts +1 -1
  85. package/src/lib/i18n.js +2 -2
  86. package/src/lib/i18n.js.map +1 -1
  87. package/src/mixins/chart-element.d.ts +1 -1
  88. package/src/mixins/chart-element.js +26 -18
  89. package/src/mixins/chart-element.js.map +1 -1
  90. package/src/mixins/input-element.d.ts +1 -1
  91. package/src/mixins/item-resource.d.ts +3 -3
  92. package/src/mixins/item-resource.js +2 -7
  93. package/src/mixins/item-resource.js.map +1 -1
  94. package/src/mixins/keyboard-element.d.ts +3 -1
  95. package/src/mixins/keyboard-element.js +10 -6
  96. package/src/mixins/keyboard-element.js.map +1 -1
  97. package/src/mixins/update-after-browser.js +17 -3
  98. package/src/mixins/update-after-browser.js.map +1 -1
  99. package/src/mixins/with-resize-observer.js +29 -15
  100. package/src/mixins/with-resize-observer.js.map +1 -1
  101. package/src/molecules/gv-card/gv-card.d.ts +4 -4
  102. package/src/molecules/gv-card-full/gv-card-full.d.ts +4 -4
  103. package/src/molecules/gv-card-list/gv-card-list.d.ts +2 -2
  104. package/src/molecules/gv-category/gv-category.d.ts +1 -1
  105. package/src/molecules/gv-code/gv-code.js +66 -53
  106. package/src/molecules/gv-code/gv-code.js.map +1 -1
  107. package/src/molecules/gv-code/gv-code.stories.js +4 -4
  108. package/src/molecules/gv-code/gv-code.stories.js.map +1 -1
  109. package/src/molecules/gv-code/gv-code.test.js +29 -20
  110. package/src/molecules/gv-code/gv-code.test.js.map +1 -1
  111. package/src/molecules/gv-cron-editor/gv-cron-editor.d.ts +3 -3
  112. package/src/molecules/gv-cron-editor/gv-cron-editor.js +19 -15
  113. package/src/molecules/gv-cron-editor/gv-cron-editor.js.map +1 -1
  114. package/src/molecules/gv-expandable/gv-expandable.stories.js +1 -4
  115. package/src/molecules/gv-expandable/gv-expandable.stories.js.map +1 -1
  116. package/src/molecules/gv-expression-language/gv-expression-language.js +1 -4
  117. package/src/molecules/gv-expression-language/gv-expression-language.js.map +1 -1
  118. package/src/molecules/gv-expression-language/gv-expression-language.stories.js +4 -4
  119. package/src/molecules/gv-expression-language/gv-expression-language.stories.js.map +1 -1
  120. package/src/molecules/gv-expression-language/gv-expression-language.test.js +24 -15
  121. package/src/molecules/gv-expression-language/gv-expression-language.test.js.map +1 -1
  122. package/src/molecules/gv-list/gv-list.d.ts +5 -5
  123. package/src/molecules/gv-list/gv-list.js +1 -7
  124. package/src/molecules/gv-list/gv-list.js.map +1 -1
  125. package/src/molecules/gv-metrics/gv-metrics.d.ts +2 -2
  126. package/src/molecules/gv-metrics/gv-metrics.stories.js +4 -7
  127. package/src/molecules/gv-metrics/gv-metrics.stories.js.map +1 -1
  128. package/src/molecules/gv-modal/gv-modal.stories.d.ts +1 -1
  129. package/src/molecules/gv-modal/gv-modal.stories.js +1 -4
  130. package/src/molecules/gv-modal/gv-modal.stories.js.map +1 -1
  131. package/src/molecules/gv-nav/gv-nav.d.ts +1 -1
  132. package/src/molecules/gv-option/gv-option.d.ts +1 -1
  133. package/src/molecules/gv-option/gv-option.js +17 -3
  134. package/src/molecules/gv-option/gv-option.js.map +1 -1
  135. package/src/molecules/gv-option/gv-option.stories.js +3 -3
  136. package/src/molecules/gv-option/gv-option.stories.js.map +1 -1
  137. package/src/molecules/gv-plans/gv-plans.d.ts +1 -1
  138. package/src/molecules/gv-popover/gv-popover.d.ts +1 -1
  139. package/src/molecules/gv-promote/gv-promote.d.ts +4 -4
  140. package/src/molecules/gv-promote/gv-promote.js +1 -4
  141. package/src/molecules/gv-promote/gv-promote.js.map +1 -1
  142. package/src/molecules/gv-rating/gv-rating.d.ts +1 -1
  143. package/src/molecules/gv-rating/gv-rating.stories.js +2 -2
  144. package/src/molecules/gv-rating/gv-rating.stories.js.map +1 -1
  145. package/src/molecules/gv-rating-list/gv-rating-list.d.ts +2 -2
  146. package/src/molecules/gv-row/gv-row.d.ts +1 -1
  147. package/src/molecules/gv-row/gv-row.js +2 -4
  148. package/src/molecules/gv-row/gv-row.js.map +1 -1
  149. package/src/molecules/gv-row/gv-row.stories.js +1 -1
  150. package/src/molecules/gv-row/gv-row.stories.js.map +1 -1
  151. package/src/molecules/gv-row-expandable/gv-row-expandable.stories.js +1 -4
  152. package/src/molecules/gv-row-expandable/gv-row-expandable.stories.js.map +1 -1
  153. package/src/molecules/gv-stats/gv-stats.d.ts +2 -2
  154. package/src/molecules/gv-stepper/gv-stepper.d.ts +2 -2
  155. package/src/molecules/gv-stepper/gv-stepper.js +27 -13
  156. package/src/molecules/gv-stepper/gv-stepper.js.map +1 -1
  157. package/src/molecules/gv-stepper/gv-stepper.stories.js +2 -8
  158. package/src/molecules/gv-stepper/gv-stepper.stories.js.map +1 -1
  159. package/src/molecules/gv-table/gv-table.d.ts +8 -8
  160. package/src/molecules/gv-table/gv-table.js +11 -17
  161. package/src/molecules/gv-table/gv-table.js.map +1 -1
  162. package/src/molecules/gv-table/gv-table.stories.js +2 -2
  163. package/src/molecules/gv-table/gv-table.stories.js.map +1 -1
  164. package/src/molecules/gv-tree/gv-tree.d.ts +1 -1
  165. package/src/organisms/gv-documentation/gv-documentation.d.ts +1 -1
  166. package/src/organisms/gv-header/gv-header.d.ts +3 -3
  167. package/src/organisms/gv-header/gv-header.stories.js +2 -2
  168. package/src/organisms/gv-header/gv-header.stories.js.map +1 -1
  169. package/src/organisms/gv-http-client/gv-http-client.d.ts +6 -22
  170. package/src/organisms/gv-http-client/gv-http-client.js +1 -2
  171. package/src/organisms/gv-http-client/gv-http-client.js.map +1 -1
  172. package/src/organisms/gv-http-client/gv-http-client.stories.d.ts +1 -1
  173. package/src/organisms/gv-http-client/gv-http-client.stories.js +4 -10
  174. package/src/organisms/gv-http-client/gv-http-client.stories.js.map +1 -1
  175. package/src/organisms/gv-menu/gv-menu.d.ts +1 -1
  176. package/src/organisms/gv-pagination/gv-pagination.d.ts +37 -47
  177. package/src/organisms/gv-pagination/gv-pagination.js +218 -71
  178. package/src/organisms/gv-pagination/gv-pagination.js.map +1 -1
  179. package/src/organisms/gv-pagination/gv-pagination.stories.d.ts +85 -8
  180. package/src/organisms/gv-pagination/gv-pagination.stories.js +36 -2
  181. package/src/organisms/gv-pagination/gv-pagination.stories.js.map +1 -1
  182. package/src/organisms/gv-pagination/index.d.ts +1 -0
  183. package/src/organisms/gv-pagination/index.js +1 -0
  184. package/src/organisms/gv-pagination/index.js.map +1 -1
  185. package/src/organisms/gv-pagination/model/index.d.ts +2 -0
  186. package/src/organisms/gv-pagination/model/index.js +18 -0
  187. package/src/organisms/gv-pagination/model/index.js.map +1 -0
  188. package/src/organisms/gv-pagination/model/paginate-detail.d.ts +4 -0
  189. package/src/organisms/gv-pagination/model/paginate-detail.js +2 -0
  190. package/src/organisms/gv-pagination/model/paginate-detail.js.map +1 -0
  191. package/src/organisms/gv-pagination/model/pagination.d.ts +9 -0
  192. package/src/organisms/gv-pagination/model/pagination.js +2 -0
  193. package/src/organisms/gv-pagination/model/pagination.js.map +1 -0
  194. package/src/organisms/gv-properties/gv-properties.d.ts +11 -11
  195. package/src/organisms/gv-properties/gv-properties.js +7 -13
  196. package/src/organisms/gv-properties/gv-properties.js.map +1 -1
  197. package/src/organisms/gv-resources/gv-resources.d.ts +6 -5
  198. package/src/organisms/gv-resources/gv-resources.js +20 -6
  199. package/src/organisms/gv-resources/gv-resources.js.map +1 -1
  200. package/src/organisms/gv-resources/gv-resources.test.js +4 -4
  201. package/src/organisms/gv-resources/gv-resources.test.js.map +1 -1
  202. package/src/organisms/gv-schema-form/gv-schema-form.d.ts +1 -1
  203. package/src/organisms/gv-schema-form/gv-schema-form.js +43 -25
  204. package/src/organisms/gv-schema-form/gv-schema-form.js.map +1 -1
  205. package/src/organisms/gv-schema-form/gv-schema-form.stories.js +100 -90
  206. package/src/organisms/gv-schema-form/gv-schema-form.stories.js.map +1 -1
  207. package/src/organisms/gv-schema-form/gv-schema-form.test.js +27 -18
  208. package/src/organisms/gv-schema-form/gv-schema-form.test.js.map +1 -1
  209. package/src/organisms/gv-schema-form-array/gv-schema-form-array.d.ts +2 -2
  210. package/src/organisms/gv-schema-form-array/gv-schema-form-array.js +18 -4
  211. package/src/organisms/gv-schema-form-array/gv-schema-form-array.js.map +1 -1
  212. package/src/organisms/gv-schema-form-control/gv-schema-form-control.d.ts +2 -2
  213. package/src/organisms/gv-schema-form-control/gv-schema-form-control.js +25 -9
  214. package/src/organisms/gv-schema-form-control/gv-schema-form-control.js.map +1 -1
  215. package/src/organisms/gv-schema-form-control-object/gv-schema-form-control-object.d.ts +2 -2
  216. package/src/organisms/gv-schema-form-control-object/gv-schema-form-control-object.js +18 -4
  217. package/src/organisms/gv-schema-form-control-object/gv-schema-form-control-object.js.map +1 -1
  218. package/src/organisms/gv-tabs/gv-tabs.js +1 -1
  219. package/src/organisms/gv-tabs/gv-tabs.js.map +1 -1
  220. package/src/organisms/gv-user-menu/gv-user-menu.d.ts +1 -1
  221. package/src/policy-studio/gv-flow/gv-flow.d.ts +2 -2
  222. package/src/policy-studio/gv-flow/gv-flow.js +28 -9
  223. package/src/policy-studio/gv-flow/gv-flow.js.map +1 -1
  224. package/src/policy-studio/gv-flow-step/gv-flow-step.d.ts +2 -2
  225. package/src/policy-studio/gv-policy-studio/gv-policy-studio.d.ts +11 -10
  226. package/src/policy-studio/gv-policy-studio/gv-policy-studio.js +405 -349
  227. package/src/policy-studio/gv-policy-studio/gv-policy-studio.js.map +1 -1
  228. package/src/policy-studio/gv-policy-studio/gv-policy-studio.stories.js +3 -3
  229. package/src/policy-studio/gv-policy-studio/gv-policy-studio.stories.js.map +1 -1
  230. package/src/policy-studio/gv-policy-studio/gv-policy-studio.test.js +32 -33
  231. package/src/policy-studio/gv-policy-studio/gv-policy-studio.test.js.map +1 -1
  232. package/src/policy-studio/gv-policy-studio-menu/gv-policy-studio-menu.d.ts +3 -3
  233. package/wc/gv-pagination.d.ts +1 -1
  234. package/wc/gv-pagination.js +1 -1
  235. package/wc/gv-pagination.js.map +1 -1
@@ -1,3 +1,23 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
1
21
  /*
2
22
  * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
23
  *
@@ -350,31 +370,33 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
350
370
  this._policyFilter = [];
351
371
  this._flowFilter = [];
352
372
  }
353
- async willUpdate(changedProperties) {
354
- if (changedProperties.has('configurationSchema') && this.configurationSchema) {
355
- this._tabs.splice(1, 0, { id: 'settings', title: 'Configuration', icon: 'general:settings#2' });
356
- }
357
- if (changedProperties.has('hasPolicyFilter') && this.hasPolicyFilter === true) {
358
- this._policyFilterOptions = [
359
- { id: 'onRequest', title: 'Request', icon: 'navigation:arrow-from-left' },
360
- { id: 'onResponse', title: 'Response', icon: 'navigation:arrow-from-right' },
361
- ];
362
- }
363
- if (changedProperties.has('canDebug') && this.canDebug === true) {
364
- this._tabs = [...this._tabs, { id: 'debug', title: 'Try it', icon: 'content:send' }];
365
- }
366
- const tabsImport = [];
367
- if (changedProperties.has('hasProperties') && this.hasProperties === true) {
368
- tabsImport.push(import('../../organisms/gv-properties').then(() => ({ id: 'properties', title: 'Properties', icon: 'general:settings#1' })));
369
- }
370
- if (changedProperties.has('hasResources') && this.hasProperties === true) {
371
- tabsImport.push(import('../../organisms/gv-resources').then(() => ({ id: 'resources', title: 'Resources', icon: 'general:settings#5' })));
372
- }
373
- if (tabsImport.length > 0) {
374
- const [...tabs] = await Promise.all(tabsImport);
375
- this._tabs = [...this._tabs, ...tabs];
376
- this.requestUpdate();
377
- }
373
+ willUpdate(changedProperties) {
374
+ return __awaiter(this, void 0, void 0, function* () {
375
+ if (changedProperties.has('configurationSchema') && this.configurationSchema) {
376
+ this._tabs.splice(1, 0, { id: 'settings', title: 'Configuration', icon: 'general:settings#2' });
377
+ }
378
+ if (changedProperties.has('hasPolicyFilter') && this.hasPolicyFilter === true) {
379
+ this._policyFilterOptions = [
380
+ { id: 'onRequest', title: 'Request', icon: 'navigation:arrow-from-left' },
381
+ { id: 'onResponse', title: 'Response', icon: 'navigation:arrow-from-right' },
382
+ ];
383
+ }
384
+ if (changedProperties.has('canDebug') && this.canDebug === true) {
385
+ this._tabs = [...this._tabs, { id: 'debug', title: 'Try it', icon: 'content:send' }];
386
+ }
387
+ const tabsImport = [];
388
+ if (changedProperties.has('hasProperties') && this.hasProperties === true) {
389
+ tabsImport.push(import('../../organisms/gv-properties').then(() => ({ id: 'properties', title: 'Properties', icon: 'general:settings#1' })));
390
+ }
391
+ if (changedProperties.has('hasResources') && this.hasProperties === true) {
392
+ tabsImport.push(import('../../organisms/gv-resources').then(() => ({ id: 'resources', title: 'Resources', icon: 'general:settings#5' })));
393
+ }
394
+ if (tabsImport.length > 0) {
395
+ const [...tabs] = yield Promise.all(tabsImport);
396
+ this._tabs = [...this._tabs, ...tabs];
397
+ this.requestUpdate();
398
+ }
399
+ });
378
400
  }
379
401
  get _flowFilterOptions() {
380
402
  if (this.definedPlans.length > 0) {
@@ -384,6 +406,9 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
384
406
  ];
385
407
  }
386
408
  }
409
+ get keyboardTarget() {
410
+ return window;
411
+ }
387
412
  onKeyboard() {
388
413
  if (this._currentAskConfirmation == null) {
389
414
  if (this.isPressed(KEYS.Shift, KEYS.Ctrl, KEYS.Space)) {
@@ -418,9 +443,9 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
418
443
  const plans = definition.plans == null
419
444
  ? []
420
445
  : definition.plans.map((plan) => {
421
- return { ...plan, flows: this._generatePlanFlowsId(plan) };
446
+ return Object.assign(Object.assign({}, plan), { flows: this._generatePlanFlowsId(plan) });
422
447
  });
423
- this._initialDefinition = { ...definition, flows, resources, plans };
448
+ this._initialDefinition = Object.assign(Object.assign({}, definition), { flows, resources, plans });
424
449
  this._definition = deepClone(this._initialDefinition);
425
450
  this.isDirty = false;
426
451
  this._selectFirstFlow();
@@ -472,90 +497,92 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
472
497
  _onDragEndPolicy() {
473
498
  this.shadowRoot.querySelectorAll('gv-flow').forEach((e) => e.onDragEnd());
474
499
  }
475
- async _onDropPolicy({ detail }) {
476
- try {
477
- await this._askToValidateForms();
478
- const policy = detail.policy;
479
- const targetFlow = this._findFlowById(detail.flowId);
480
- let name = policy.name;
481
- let description = '';
482
- let condition = '';
483
- let configuration = {};
484
- let _id;
485
- let _new = false;
486
- if (detail.flowStep) {
487
- _id = detail.flowStep._id;
488
- name = detail.flowStep.name;
489
- description = detail.flowStep.description || '';
490
- condition = detail.flowStep.condition || '';
491
- configuration = detail.flowStep.configuration;
492
- }
493
- else {
494
- _id = this._generateFlowStepId(targetFlow._id, detail.flowKey, detail.position);
495
- _new = true;
496
- }
497
- const flowStep = { _id, _new, name, policy: policy.id, description, condition, enabled: true, configuration };
498
- const sourceFlow = detail.sourceFlowId != null ? this._findFlowById(detail.sourceFlowId) : targetFlow;
499
- if (detail.sourcePosition != null) {
500
- if (detail.sourceFlowKey && detail.sourceFlowKey !== detail.flowKey) {
501
- sourceFlow[detail.sourceFlowKey].splice(detail.sourcePosition, 1);
502
- targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
503
- if (this._currentFlowStep != null && this._currentFlowStep.step._id === _id) {
504
- this._currentFlowStep.group = detail.flowKey;
505
- // Special case for update schema after change request to response or inverse
506
- const schema = this.buildSchema(this._currentFlowStep.policy);
507
- await this._setCurrentFlowStep(this._currentFlowStep, schema, true);
508
- this._getFlowElement(targetFlow._id).requestUpdate();
509
- }
500
+ _onDropPolicy({ detail }) {
501
+ return __awaiter(this, void 0, void 0, function* () {
502
+ try {
503
+ yield this._askToValidateForms();
504
+ const policy = detail.policy;
505
+ const targetFlow = this._findFlowById(detail.flowId);
506
+ let name = policy.name;
507
+ let description = '';
508
+ let condition = '';
509
+ let configuration = {};
510
+ let _id;
511
+ let _new = false;
512
+ if (detail.flowStep) {
513
+ _id = detail.flowStep._id;
514
+ name = detail.flowStep.name;
515
+ description = detail.flowStep.description || '';
516
+ condition = detail.flowStep.condition || '';
517
+ configuration = detail.flowStep.configuration;
510
518
  }
511
519
  else {
512
- if (detail.position > detail.sourcePosition) {
520
+ _id = this._generateFlowStepId(targetFlow._id, detail.flowKey, detail.position);
521
+ _new = true;
522
+ }
523
+ const flowStep = { _id, _new, name, policy: policy.id, description, condition, enabled: true, configuration };
524
+ const sourceFlow = detail.sourceFlowId != null ? this._findFlowById(detail.sourceFlowId) : targetFlow;
525
+ if (detail.sourcePosition != null) {
526
+ if (detail.sourceFlowKey && detail.sourceFlowKey !== detail.flowKey) {
527
+ sourceFlow[detail.sourceFlowKey].splice(detail.sourcePosition, 1);
513
528
  targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
514
- sourceFlow[detail.flowKey].splice(detail.sourcePosition, 1);
529
+ if (this._currentFlowStep != null && this._currentFlowStep.step._id === _id) {
530
+ this._currentFlowStep.group = detail.flowKey;
531
+ // Special case for update schema after change request to response or inverse
532
+ const schema = this.buildSchema(this._currentFlowStep.policy);
533
+ yield this._setCurrentFlowStep(this._currentFlowStep, schema, true);
534
+ this._getFlowElement(targetFlow._id).requestUpdate();
535
+ }
515
536
  }
516
537
  else {
517
- sourceFlow[detail.flowKey].splice(detail.sourcePosition, 1);
518
- targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
538
+ if (detail.position > detail.sourcePosition) {
539
+ targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
540
+ sourceFlow[detail.flowKey].splice(detail.sourcePosition, 1);
541
+ }
542
+ else {
543
+ sourceFlow[detail.flowKey].splice(detail.sourcePosition, 1);
544
+ targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
545
+ }
519
546
  }
520
- }
521
- // Force Refresh source flow element when move to other flow
522
- if (targetFlow._id !== sourceFlow._id) {
523
- this._getFlowElement(targetFlow._id).requestUpdate();
524
- }
525
- }
526
- else {
527
- targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
528
- const currentFlowForm = this._getFlowStepForm();
529
- if (currentFlowForm == null || currentFlowForm.dirty !== true) {
530
- let step = targetFlow[detail.flowKey][detail.position];
531
- if (step == null) {
532
- // When confirm lose change after drop policy
533
- step = targetFlow[detail.flowKey][detail.position - 1];
547
+ // Force Refresh source flow element when move to other flow
548
+ if (targetFlow._id !== sourceFlow._id) {
549
+ this._getFlowElement(targetFlow._id).requestUpdate();
534
550
  }
535
- if (detail.cancelEdit !== true) {
536
- setTimeout(async () => {
537
- await this._editFlowStep({ step, policy, flow: targetFlow, group: detail.flowKey });
538
- this.updateComplete.then(() => {
539
- const flowElement = this._getFlowElement(targetFlow._id);
540
- flowElement.selectedStepId = step._id;
541
- flowElement.requestUpdate();
542
- });
543
- });
551
+ }
552
+ else {
553
+ targetFlow[detail.flowKey].splice(detail.position, 0, flowStep);
554
+ const currentFlowForm = this._getFlowStepForm();
555
+ if (currentFlowForm == null || currentFlowForm.dirty !== true) {
556
+ let step = targetFlow[detail.flowKey][detail.position];
557
+ if (step == null) {
558
+ // When confirm lose change after drop policy
559
+ step = targetFlow[detail.flowKey][detail.position - 1];
560
+ }
561
+ if (detail.cancelEdit !== true) {
562
+ setTimeout(() => __awaiter(this, void 0, void 0, function* () {
563
+ yield this._editFlowStep({ step, policy, flow: targetFlow, group: detail.flowKey });
564
+ this.updateComplete.then(() => {
565
+ const flowElement = this._getFlowElement(targetFlow._id);
566
+ flowElement.selectedStepId = step._id;
567
+ flowElement.requestUpdate();
568
+ });
569
+ }));
570
+ }
544
571
  }
545
572
  }
573
+ targetFlow._dirty = true;
574
+ sourceFlow._dirty = true;
575
+ this.isDirty = true;
576
+ this.shadowRoot.querySelectorAll('gv-flow').forEach((gvFlow) => gvFlow.removeCandidate());
577
+ setTimeout(() => {
578
+ this._dragPolicy = null;
579
+ this._dropPolicy = null;
580
+ }, 0);
546
581
  }
547
- targetFlow._dirty = true;
548
- sourceFlow._dirty = true;
549
- this.isDirty = true;
550
- this.shadowRoot.querySelectorAll('gv-flow').forEach((gvFlow) => gvFlow.removeCandidate());
551
- setTimeout(() => {
552
- this._dragPolicy = null;
553
- this._dropPolicy = null;
554
- }, 0);
555
- }
556
- catch (e) {
557
- this._currentAskConfirmation = null;
558
- }
582
+ catch (e) {
583
+ this._currentAskConfirmation = null;
584
+ }
585
+ });
559
586
  }
560
587
  _onDeletePolicy({ detail }) {
561
588
  const targetFlow = this._findFlowById(detail.flowId);
@@ -587,35 +614,39 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
587
614
  };
588
615
  if (schema) {
589
616
  const jsonSchema = typeof schema === 'string' ? JSON.parse(schema) : schema;
590
- const properties = { commonDescription, ...(this.hasConditionalSteps ? { commonCondition } : {}), ...jsonSchema.properties };
591
- return { ...jsonSchema, properties };
617
+ const properties = Object.assign(Object.assign({ commonDescription }, (this.hasConditionalSteps ? { commonCondition } : {})), jsonSchema.properties);
618
+ return Object.assign(Object.assign({}, jsonSchema), { properties });
592
619
  }
593
- return { properties: { commonDescription, ...(this.hasConditionalSteps ? { commonCondition } : {}) } };
620
+ return { properties: Object.assign({ commonDescription }, (this.hasConditionalSteps ? { commonCondition } : {})) };
594
621
  }
595
- async _editFlowStep({ step, flow, policy, group }) {
596
- if (step) {
597
- this._currentPolicyId = policy.id;
598
- const currentFlowStep = { flow, step, policy, group };
599
- const schema = this.buildSchema(policy);
600
- try {
601
- await this._setCurrentFlowStep(currentFlowStep, schema);
602
- this._updateSelectedFlows([flow._id]);
603
- this._splitMainViews();
604
- if (localStorage.getItem('gv-policy-studio:keep-documentation-close') == null) {
605
- this._onOpenDocumentation();
622
+ _editFlowStep({ step, flow, policy, group }) {
623
+ return __awaiter(this, void 0, void 0, function* () {
624
+ if (step) {
625
+ this._currentPolicyId = policy.id;
626
+ const currentFlowStep = { flow, step, policy, group };
627
+ const schema = this.buildSchema(policy);
628
+ try {
629
+ yield this._setCurrentFlowStep(currentFlowStep, schema);
630
+ this._updateSelectedFlows([flow._id]);
631
+ this._splitMainViews();
632
+ if (localStorage.getItem('gv-policy-studio:keep-documentation-close') == null) {
633
+ this._onOpenDocumentation();
634
+ }
635
+ }
636
+ catch (e) {
637
+ this._currentAskConfirmation = null;
606
638
  }
607
639
  }
608
- catch (e) {
609
- this._currentAskConfirmation = null;
640
+ else {
641
+ yield this._closeFlowStepForm();
642
+ this._maximizeTopView();
610
643
  }
611
- }
612
- else {
613
- await this._closeFlowStepForm();
614
- this._maximizeTopView();
615
- }
644
+ });
616
645
  }
617
- async _onEditFlowStep({ detail: { step, flow, policy, group } }) {
618
- return this._editFlowStep({ step, flow, policy, group });
646
+ _onEditFlowStep({ detail: { step, flow, policy, group } }) {
647
+ return __awaiter(this, void 0, void 0, function* () {
648
+ return this._editFlowStep({ step, flow, policy, group });
649
+ });
619
650
  }
620
651
  _getResizableViews() {
621
652
  return this.shadowRoot.querySelector('gv-resizable-views');
@@ -638,78 +669,82 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
638
669
  targetFlow._dirty = true;
639
670
  this.isDirty = true;
640
671
  }
641
- async _onCloseFlowStepForm() {
642
- try {
643
- await this._closeFlowStepForm();
644
- }
645
- catch (err) {
646
- this._currentAskConfirmation = null;
647
- }
672
+ _onCloseFlowStepForm() {
673
+ return __awaiter(this, void 0, void 0, function* () {
674
+ try {
675
+ yield this._closeFlowStepForm();
676
+ }
677
+ catch (err) {
678
+ this._currentAskConfirmation = null;
679
+ }
680
+ });
648
681
  }
649
- async _closeFlowStepForm(force = false) {
650
- await this._setCurrentFlowStep(null, null, force);
682
+ _closeFlowStepForm(force = false) {
683
+ return __awaiter(this, void 0, void 0, function* () {
684
+ yield this._setCurrentFlowStep(null, null, force);
685
+ });
651
686
  }
652
- async _askToValidateForms() {
653
- if (this._currentAskConfirmation == null) {
654
- this._currentAskConfirmation = true;
655
- return Promise.all(this._submitOrConfirmForms()).then((forms) => {
656
- if (forms.filter((r) => r != null).length > 0) {
657
- this._definition = this._buildDefinitionToSave();
658
- this.getChildren().forEach((e) => e.requestUpdate());
659
- // Refresh if lose changes lost current step selection
660
- return this._checkCurrentFlowStep().then(() => {
687
+ _askToValidateForms() {
688
+ return __awaiter(this, void 0, void 0, function* () {
689
+ if (this._currentAskConfirmation == null) {
690
+ this._currentAskConfirmation = true;
691
+ return Promise.all(this._submitOrConfirmForms()).then((forms) => {
692
+ if (forms.filter((r) => r != null).length > 0) {
693
+ this._definition = this._buildDefinitionToSave();
661
694
  this.getChildren().forEach((e) => e.requestUpdate());
662
- return this.updateComplete.then(() => {
663
- this._currentAskConfirmation = null;
664
- return forms;
695
+ // Refresh if lose changes lost current step selection
696
+ return this._checkCurrentFlowStep().then(() => {
697
+ this.getChildren().forEach((e) => e.requestUpdate());
698
+ return this.updateComplete.then(() => {
699
+ this._currentAskConfirmation = null;
700
+ return forms;
701
+ });
665
702
  });
666
- });
667
- }
668
- else {
669
- this._currentAskConfirmation = null;
670
- return forms;
671
- }
672
- });
673
- }
674
- throw new Error('ask already waiting');
675
- }
676
- async _setCurrentFlowStep(currentFlowStep, flowStepSchema, force = false) {
677
- if (!force) {
678
- await this._askToValidateForms();
679
- }
680
- const schema = deepClone(flowStepSchema);
681
- if (currentFlowStep != null) {
682
- const configuration = typeof currentFlowStep.step.configuration === 'string'
683
- ? JSON.parse(currentFlowStep.step.configuration)
684
- : currentFlowStep.step.configuration;
685
- const step = { ...currentFlowStep.step, configuration };
686
- const _initialValues = {
687
- ...step.configuration,
688
- commonDescription: step.description,
689
- commonCondition: step.condition,
690
- };
691
- this._currentFlowStep = { ...currentFlowStep, step, _initialValues };
692
- if (flowStepSchema && flowStepSchema.properties.scope) {
693
- const _enum = schema.properties.scope.enum;
694
- if (_enum.find((scope) => ['REQUEST', 'REQUEST_CONTENT', 'RESPONSE', 'RESPONSE_CONTENT'].includes(scope)) != null) {
695
- const filtered = this._currentFlowStep.group === 'pre' ? ['REQUEST', 'REQUEST_CONTENT'] : ['RESPONSE', 'RESPONSE_CONTENT'];
696
- schema.properties.scope.enum = _enum.filter((scope) => filtered.includes(scope));
697
- const scope = this._currentFlowStep.step.configuration.scope;
698
- if (scope == null || !schema.properties.scope.enum.includes(scope)) {
699
- schema.properties.scope.default = schema.properties.scope.enum[0];
700
- this._currentFlowStep.step.configuration.scope = schema.properties.scope.enum[0];
701
- this._currentFlowStep._initialValues.scope = schema.properties.scope.enum[0];
702
- if (this._currentFlowStep._values) {
703
- this._currentFlowStep._values.scope = schema.properties.scope.enum[0];
703
+ }
704
+ else {
705
+ this._currentAskConfirmation = null;
706
+ return forms;
707
+ }
708
+ });
709
+ }
710
+ throw new Error('ask already waiting');
711
+ });
712
+ }
713
+ _setCurrentFlowStep(currentFlowStep, flowStepSchema, force = false) {
714
+ return __awaiter(this, void 0, void 0, function* () {
715
+ if (!force) {
716
+ yield this._askToValidateForms();
717
+ }
718
+ const schema = deepClone(flowStepSchema);
719
+ if (currentFlowStep != null) {
720
+ const configuration = typeof currentFlowStep.step.configuration === 'string'
721
+ ? JSON.parse(currentFlowStep.step.configuration)
722
+ : currentFlowStep.step.configuration;
723
+ const step = Object.assign(Object.assign({}, currentFlowStep.step), { configuration });
724
+ const _initialValues = Object.assign(Object.assign({}, step.configuration), { commonDescription: step.description, commonCondition: step.condition });
725
+ this._currentFlowStep = Object.assign(Object.assign({}, currentFlowStep), { step, _initialValues });
726
+ if (flowStepSchema && flowStepSchema.properties.scope) {
727
+ const _enum = schema.properties.scope.enum;
728
+ if (_enum.find((scope) => ['REQUEST', 'REQUEST_CONTENT', 'RESPONSE', 'RESPONSE_CONTENT'].includes(scope)) != null) {
729
+ const filtered = this._currentFlowStep.group === 'pre' ? ['REQUEST', 'REQUEST_CONTENT'] : ['RESPONSE', 'RESPONSE_CONTENT'];
730
+ schema.properties.scope.enum = _enum.filter((scope) => filtered.includes(scope));
731
+ const scope = this._currentFlowStep.step.configuration.scope;
732
+ if (scope == null || !schema.properties.scope.enum.includes(scope)) {
733
+ schema.properties.scope.default = schema.properties.scope.enum[0];
734
+ this._currentFlowStep.step.configuration.scope = schema.properties.scope.enum[0];
735
+ this._currentFlowStep._initialValues.scope = schema.properties.scope.enum[0];
736
+ if (this._currentFlowStep._values) {
737
+ this._currentFlowStep._values.scope = schema.properties.scope.enum[0];
738
+ }
704
739
  }
705
740
  }
706
741
  }
707
742
  }
708
- }
709
- else {
710
- this._currentFlowStep = null;
711
- }
712
- this._flowStepSchema = schema;
743
+ else {
744
+ this._currentFlowStep = null;
745
+ }
746
+ this._flowStepSchema = schema;
747
+ });
713
748
  }
714
749
  _refresh(closeStepForm = true) {
715
750
  if (closeStepForm) {
@@ -717,32 +752,36 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
717
752
  }
718
753
  this._definition = deepClone(this._definition);
719
754
  }
720
- async _onSelectFlows({ detail }) {
721
- try {
722
- await this._closeFlowStepForm();
723
- this._onCloseDocumentation();
724
- this._updateSelectedFlows(detail.flows);
725
- this._onDesign();
726
- }
727
- catch (e) {
728
- this._currentAskConfirmation = null;
729
- }
755
+ _onSelectFlows({ detail }) {
756
+ return __awaiter(this, void 0, void 0, function* () {
757
+ try {
758
+ yield this._closeFlowStepForm();
759
+ this._onCloseDocumentation();
760
+ this._updateSelectedFlows(detail.flows);
761
+ this._onDesign();
762
+ }
763
+ catch (e) {
764
+ this._currentAskConfirmation = null;
765
+ }
766
+ });
730
767
  }
731
- async _onOpenDocumentationFromMenu({ detail: { policy } }) {
732
- try {
733
- if (this.documentation == null || this.documentation.id !== policy.id) {
734
- await this._closeFlowStepForm();
735
- this._currentPolicyId = policy.id;
736
- if (this.getSelectedFlow()) {
737
- this._splitMainViews();
738
- }
739
- else {
740
- this._maximizeBottomView();
768
+ _onOpenDocumentationFromMenu({ detail: { policy } }) {
769
+ return __awaiter(this, void 0, void 0, function* () {
770
+ try {
771
+ if (this.documentation == null || this.documentation.id !== policy.id) {
772
+ yield this._closeFlowStepForm();
773
+ this._currentPolicyId = policy.id;
774
+ if (this.getSelectedFlow()) {
775
+ this._splitMainViews();
776
+ }
777
+ else {
778
+ this._maximizeBottomView();
779
+ }
780
+ dispatchCustomEvent(this, 'fetch-documentation', { policy });
741
781
  }
742
- dispatchCustomEvent(this, 'fetch-documentation', { policy });
743
782
  }
744
- }
745
- catch (e) { }
783
+ catch (e) { }
784
+ });
746
785
  }
747
786
  _fetchDocumentation(policy) {
748
787
  if (this.documentation == null || this.documentation.id !== policy.id) {
@@ -783,7 +822,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
783
822
  this._currentFlowStep._values = detail.values;
784
823
  }
785
824
  _writeFlowStep(values) {
786
- const { commonDescription, commonCondition, ...configuration } = values;
825
+ const { commonDescription, commonCondition } = values, configuration = __rest(values, ["commonDescription", "commonCondition"]);
787
826
  if (this._currentFlowStep.step._new ||
788
827
  this._currentFlowStep.step.description !== commonDescription ||
789
828
  this._currentFlowStep.step.condition !== commonCondition ||
@@ -801,10 +840,12 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
801
840
  this._currentFlowStep.step = flow[this._currentFlowStep.group][position];
802
841
  }
803
842
  }
804
- async _onSubmitFlowStep({ detail }) {
805
- this._writeFlowStep(detail.values);
806
- await this.requestUpdate('_definition');
807
- this.getChildren().forEach((c) => c.requestUpdate());
843
+ _onSubmitFlowStep({ detail }) {
844
+ return __awaiter(this, void 0, void 0, function* () {
845
+ this._writeFlowStep(detail.values);
846
+ yield this.requestUpdate('_definition');
847
+ this.getChildren().forEach((c) => c.requestUpdate());
848
+ });
808
849
  }
809
850
  _onCancelFlow() {
810
851
  this._onDesign();
@@ -830,29 +871,31 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
830
871
  _onChangeTab({ detail }) {
831
872
  this._changeTab(detail.value);
832
873
  }
833
- async _changeTabValidator({ from, to }) {
834
- if (from === 'properties') {
835
- const component = this.shadowRoot.querySelector('gv-properties');
836
- if (component.dirty) {
837
- return component.confirm();
838
- }
839
- }
840
- else if (from === 'resources') {
841
- const component = this.shadowRoot.querySelector('gv-resources');
842
- if (component.dirty) {
843
- return component.confirm();
874
+ _changeTabValidator({ from, to }) {
875
+ return __awaiter(this, void 0, void 0, function* () {
876
+ if (from === 'properties') {
877
+ const component = this.shadowRoot.querySelector('gv-properties');
878
+ if (component.dirty) {
879
+ return component.confirm();
880
+ }
844
881
  }
845
- }
846
- else {
847
- try {
848
- return await this._askToValidateForms();
882
+ else if (from === 'resources') {
883
+ const component = this.shadowRoot.querySelector('gv-resources');
884
+ if (component.dirty) {
885
+ return component.confirm();
886
+ }
849
887
  }
850
- catch (e) {
851
- this._currentAskConfirmation = null;
852
- throw e;
888
+ else {
889
+ try {
890
+ return yield this._askToValidateForms();
891
+ }
892
+ catch (e) {
893
+ this._currentAskConfirmation = null;
894
+ throw e;
895
+ }
853
896
  }
854
- }
855
- return Promise.resolve();
897
+ return Promise.resolve();
898
+ });
856
899
  }
857
900
  _changeTab(tabId) {
858
901
  if (this._currentAskConfirmation == null) {
@@ -982,7 +1025,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
982
1025
  }
983
1026
  }
984
1027
  if (force || e._id == null) {
985
- return { ...e, _id };
1028
+ return Object.assign(Object.assign({}, e), { _id });
986
1029
  }
987
1030
  return e;
988
1031
  });
@@ -995,9 +1038,14 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
995
1038
  ...Array.from(this.shadowRoot.querySelectorAll('gv-resizable-views')),
996
1039
  ];
997
1040
  }
998
- async getUpdateComplete() {
999
- await super.getUpdateComplete();
1000
- await Promise.all(this.getChildren().map((e) => e.updateComplete));
1041
+ getUpdateComplete() {
1042
+ const _super = Object.create(null, {
1043
+ getUpdateComplete: { get: () => super.getUpdateComplete }
1044
+ });
1045
+ return __awaiter(this, void 0, void 0, function* () {
1046
+ yield _super.getUpdateComplete.call(this);
1047
+ yield Promise.all(this.getChildren().map((e) => e.updateComplete));
1048
+ });
1001
1049
  }
1002
1050
  shouldUpdate(changedProperties) {
1003
1051
  // Just refresh gv-flow components
@@ -1094,33 +1142,35 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1094
1142
  get definedProperties() {
1095
1143
  return this._definition && this._definition.properties ? this._definition.properties : [];
1096
1144
  }
1097
- async _onDuplicateFlow({ detail }) {
1098
- try {
1099
- await this._askToValidateForms();
1100
- const flowId = detail.content._id;
1101
- const { plan, flows } = this._findFlowCollection(flowId);
1102
- this._addFlow(flows, this._findFlowById(flowId));
1103
- if (plan != null) {
1104
- let planIndex = null;
1105
- this.definedPlans.find((p, i) => {
1106
- if (p.id === plan.id) {
1107
- planIndex = i;
1108
- return true;
1109
- }
1110
- return false;
1111
- });
1112
- plan.flows = flows;
1113
- this.definedPlans[planIndex].flows = this._generatePlanFlowsId(plan, true);
1114
- this._updateSelectedFlows([this.definedPlans[planIndex].flows[flows.length - 1]._id]);
1145
+ _onDuplicateFlow({ detail }) {
1146
+ return __awaiter(this, void 0, void 0, function* () {
1147
+ try {
1148
+ yield this._askToValidateForms();
1149
+ const flowId = detail.content._id;
1150
+ const { plan, flows } = this._findFlowCollection(flowId);
1151
+ this._addFlow(flows, this._findFlowById(flowId));
1152
+ if (plan != null) {
1153
+ let planIndex = null;
1154
+ this.definedPlans.find((p, i) => {
1155
+ if (p.id === plan.id) {
1156
+ planIndex = i;
1157
+ return true;
1158
+ }
1159
+ return false;
1160
+ });
1161
+ plan.flows = flows;
1162
+ this.definedPlans[planIndex].flows = this._generatePlanFlowsId(plan, true);
1163
+ this._updateSelectedFlows([this.definedPlans[planIndex].flows[flows.length - 1]._id]);
1164
+ }
1165
+ else {
1166
+ this._definition.flows = this._generateFlowsId(this._definition.flows);
1167
+ this._updateSelectedFlows([this._definition.flows[this._definition.flows.length - 1]._id]);
1168
+ }
1115
1169
  }
1116
- else {
1117
- this._definition.flows = this._generateFlowsId(this._definition.flows);
1118
- this._updateSelectedFlows([this._definition.flows[this._definition.flows.length - 1]._id]);
1170
+ catch (err) {
1171
+ this._currentAskConfirmation = null;
1119
1172
  }
1120
- }
1121
- catch (err) {
1122
- this._currentAskConfirmation = null;
1123
- }
1173
+ });
1124
1174
  }
1125
1175
  _onChangeFlowState({ detail }) {
1126
1176
  const flow = this._findFlowById(detail.content._id);
@@ -1128,38 +1178,38 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1128
1178
  flow._dirty = true;
1129
1179
  this.isDirty = true;
1130
1180
  }
1131
- async _onAddFlowPlan({ detail }) {
1132
- try {
1133
- await this._askToValidateForms();
1134
- this._addFlow(this.definedPlans[detail.planIndex].flows);
1135
- this.definedPlans[detail.planIndex].flows = this._generatePlanFlowsId(this.definedPlans[detail.planIndex]);
1136
- this._updateSelectedFlows([this.definedPlans[detail.planIndex].flows[this.definedPlans[detail.planIndex].flows.length - 1]._id]);
1137
- }
1138
- catch (err) {
1139
- this._currentAskConfirmation = null;
1140
- }
1181
+ _onAddFlowPlan({ detail }) {
1182
+ return __awaiter(this, void 0, void 0, function* () {
1183
+ try {
1184
+ yield this._askToValidateForms();
1185
+ this._addFlow(this.definedPlans[detail.planIndex].flows);
1186
+ this.definedPlans[detail.planIndex].flows = this._generatePlanFlowsId(this.definedPlans[detail.planIndex]);
1187
+ this._updateSelectedFlows([this.definedPlans[detail.planIndex].flows[this.definedPlans[detail.planIndex].flows.length - 1]._id]);
1188
+ }
1189
+ catch (err) {
1190
+ this._currentAskConfirmation = null;
1191
+ }
1192
+ });
1141
1193
  }
1142
- async _onAddFlow() {
1143
- try {
1144
- await this._askToValidateForms();
1145
- this._addFlow(this._definition.flows);
1146
- this._definition.flows = this._generateFlowsId(this._definition.flows);
1147
- this._updateSelectedFlows([this._definition.flows[this._definition.flows.length - 1]._id]);
1148
- }
1149
- catch (err) {
1150
- this._currentAskConfirmation = null;
1151
- }
1194
+ _onAddFlow() {
1195
+ return __awaiter(this, void 0, void 0, function* () {
1196
+ try {
1197
+ yield this._askToValidateForms();
1198
+ this._addFlow(this._definition.flows);
1199
+ this._definition.flows = this._generateFlowsId(this._definition.flows);
1200
+ this._updateSelectedFlows([this._definition.flows[this._definition.flows.length - 1]._id]);
1201
+ }
1202
+ catch (err) {
1203
+ this._currentAskConfirmation = null;
1204
+ }
1205
+ });
1152
1206
  }
1153
1207
  _addFlow(collection, duplicate = null) {
1154
1208
  const flow = duplicate == null
1155
1209
  ? this._createFlowFromSchema()
1156
- : {
1157
- ...duplicate,
1158
- _id: null,
1210
+ : Object.assign(Object.assign({}, duplicate), { _id: null,
1159
1211
  // reset the id to avoid issue with AM that persists the ID
1160
- id: null,
1161
- _dirty: true,
1162
- };
1212
+ id: null, _dirty: true });
1163
1213
  collection.push(flow);
1164
1214
  this.isDirty = true;
1165
1215
  return collection;
@@ -1174,7 +1224,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1174
1224
  return this._instantiate(this.flowSchema.properties, newFlow);
1175
1225
  }
1176
1226
  _instantiate(propertiesDefinition, initiator = {}) {
1177
- const property = { ...initiator };
1227
+ const property = Object.assign({}, initiator);
1178
1228
  if (propertiesDefinition) {
1179
1229
  for (const key of Object.keys(propertiesDefinition)) {
1180
1230
  const entry = propertiesDefinition[key];
@@ -1216,34 +1266,36 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1216
1266
  });
1217
1267
  return index;
1218
1268
  }
1219
- async _onReorderFlows({ detail: { plan } }) {
1220
- try {
1221
- await this._askToValidateForms();
1222
- this.isDirty = true;
1223
- if (plan != null) {
1224
- const newOrder = this._generatePlanFlowsId(plan, true);
1225
- if (this.selectedFlowsId) {
1226
- this._updateSelectedFlows(this.selectedFlowsId.map((flowId) => {
1227
- const index = this._findFlowIndex(plan.flows, flowId);
1228
- return index != null ? newOrder[index]._id : flowId;
1229
- }));
1269
+ _onReorderFlows({ detail: { plan } }) {
1270
+ return __awaiter(this, void 0, void 0, function* () {
1271
+ try {
1272
+ yield this._askToValidateForms();
1273
+ this.isDirty = true;
1274
+ if (plan != null) {
1275
+ const newOrder = this._generatePlanFlowsId(plan, true);
1276
+ if (this.selectedFlowsId) {
1277
+ this._updateSelectedFlows(this.selectedFlowsId.map((flowId) => {
1278
+ const index = this._findFlowIndex(plan.flows, flowId);
1279
+ return index != null ? newOrder[index]._id : flowId;
1280
+ }));
1281
+ }
1282
+ plan.flows = newOrder;
1230
1283
  }
1231
- plan.flows = newOrder;
1232
- }
1233
- else {
1234
- const newOrder = this._generateFlowsId(this._definition.flows, true);
1235
- if (this.selectedFlowsId) {
1236
- this._updateSelectedFlows(this.selectedFlowsId.map((flowId) => {
1237
- const index = this._findFlowIndex(this._definition.flows, flowId);
1238
- return index != null ? newOrder[index]._id : flowId;
1239
- }));
1284
+ else {
1285
+ const newOrder = this._generateFlowsId(this._definition.flows, true);
1286
+ if (this.selectedFlowsId) {
1287
+ this._updateSelectedFlows(this.selectedFlowsId.map((flowId) => {
1288
+ const index = this._findFlowIndex(this._definition.flows, flowId);
1289
+ return index != null ? newOrder[index]._id : flowId;
1290
+ }));
1291
+ }
1292
+ this._definition.flows = newOrder;
1240
1293
  }
1241
- this._definition.flows = newOrder;
1242
1294
  }
1243
- }
1244
- catch (err) {
1245
- this._currentAskConfirmation = false;
1246
- }
1295
+ catch (err) {
1296
+ this._currentAskConfirmation = false;
1297
+ }
1298
+ });
1247
1299
  }
1248
1300
  _onSearchPolicy({ detail }) {
1249
1301
  this._searchPolicyQuery = detail;
@@ -1257,20 +1309,22 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1257
1309
  _onClearFlows() {
1258
1310
  this._searchFlowQuery = null;
1259
1311
  }
1260
- async _onResetAll() {
1261
- try {
1262
- await this._closeFlowStepForm();
1263
- this.definition = deepClone(this._initialDefinition);
1264
- }
1265
- catch (e) {
1266
- this._currentAskConfirmation = null;
1267
- }
1312
+ _onResetAll() {
1313
+ return __awaiter(this, void 0, void 0, function* () {
1314
+ try {
1315
+ yield this._closeFlowStepForm();
1316
+ this.definition = deepClone(this._initialDefinition);
1317
+ }
1318
+ catch (e) {
1319
+ this._currentAskConfirmation = null;
1320
+ }
1321
+ });
1268
1322
  }
1269
1323
  _filterNotValidStep(step) {
1270
1324
  return step._new !== true;
1271
1325
  }
1272
1326
  _removePrivateProperties(o) {
1273
- const copy = { ...o };
1327
+ const copy = Object.assign({}, o);
1274
1328
  Object.keys(o)
1275
1329
  .filter((key) => key.startsWith('_'))
1276
1330
  .forEach((key) => {
@@ -1295,21 +1349,23 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1295
1349
  getPropertiesElement() {
1296
1350
  return this.shadowRoot.querySelector('gv-properties');
1297
1351
  }
1298
- async _checkCurrentFlowStep() {
1299
- if (this._currentFlowStep && this.selectedFlowsId) {
1300
- const closePromises = this.selectedFlowsId
1301
- .map((flowId) => {
1302
- const flow = this._findFlowById(flowId);
1303
- const currentStep = [...flow.pre, ...flow.post].find((step) => step._id === this._currentFlowStep.step._id);
1304
- if (currentStep == null) {
1305
- return this._closeFlowStepForm(true);
1306
- }
1307
- return null;
1308
- })
1309
- .filter((p) => p !== null);
1310
- return Promise.all(closePromises);
1311
- }
1312
- return Promise.resolve();
1352
+ _checkCurrentFlowStep() {
1353
+ return __awaiter(this, void 0, void 0, function* () {
1354
+ if (this._currentFlowStep && this.selectedFlowsId) {
1355
+ const closePromises = this.selectedFlowsId
1356
+ .map((flowId) => {
1357
+ const flow = this._findFlowById(flowId);
1358
+ const currentStep = [...flow.pre, ...flow.post].find((step) => step._id === this._currentFlowStep.step._id);
1359
+ if (currentStep == null) {
1360
+ return this._closeFlowStepForm(true);
1361
+ }
1362
+ return null;
1363
+ })
1364
+ .filter((p) => p !== null);
1365
+ return Promise.all(closePromises);
1366
+ }
1367
+ return Promise.resolve();
1368
+ });
1313
1369
  }
1314
1370
  saved() {
1315
1371
  if (this.isDirty) {
@@ -1333,7 +1389,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1333
1389
  flow.post = flow.post.filter(this._filterNotValidStep);
1334
1390
  return flow;
1335
1391
  });
1336
- let definition = { ...this._definition, flows };
1392
+ let definition = Object.assign(Object.assign({}, this._definition), { flows });
1337
1393
  if (this._definition.plans != null) {
1338
1394
  const plans = this._definition.plans.map((plan) => {
1339
1395
  const flows = plan.flows.map((flow) => {
@@ -1341,9 +1397,9 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1341
1397
  flow.post = flow.post.filter(this._filterNotValidStep);
1342
1398
  return flow;
1343
1399
  });
1344
- return { ...plan, flows };
1400
+ return Object.assign(Object.assign({}, plan), { flows });
1345
1401
  });
1346
- definition = { ...definition, plans };
1402
+ definition = Object.assign(Object.assign({}, definition), { plans });
1347
1403
  }
1348
1404
  return definition;
1349
1405
  }
@@ -1355,7 +1411,7 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1355
1411
  flow.post = flow.post.map(this._removePrivateProperties);
1356
1412
  return flow;
1357
1413
  });
1358
- let definition = { ...this._definition, flows };
1414
+ let definition = Object.assign(Object.assign({}, this._definition), { flows });
1359
1415
  if (this._definition.plans != null) {
1360
1416
  const plans = definitionToSave.plans.map((plan) => {
1361
1417
  const flows = plan.flows.map((f) => {
@@ -1364,17 +1420,17 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
1364
1420
  flow.post = flow.post.map(this._removePrivateProperties);
1365
1421
  return flow;
1366
1422
  });
1367
- return { ...plan, flows };
1423
+ return Object.assign(Object.assign({}, plan), { flows });
1368
1424
  });
1369
- definition = { ...definition, plans };
1425
+ definition = Object.assign(Object.assign({}, definition), { plans });
1370
1426
  }
1371
1427
  if (this._definition.properties != null) {
1372
1428
  const properties = this._definition.properties.map(this._removePrivateProperties);
1373
- definition = { ...definition, properties };
1429
+ definition = Object.assign(Object.assign({}, definition), { properties });
1374
1430
  }
1375
1431
  if (this._definition.resources != null) {
1376
1432
  const resources = this._definition.resources.map(this._removePrivateProperties);
1377
- definition = { ...definition, resources };
1433
+ definition = Object.assign(Object.assign({}, definition), { resources });
1378
1434
  }
1379
1435
  return definition;
1380
1436
  }