@gravitee/ui-components 3.25.3-typescript-8a53edf → 3.25.3-typescript-e7256ca

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 (370) hide show
  1. package/package.json +3 -4
  2. package/src/atoms/gv-autocomplete.d.ts +104 -0
  3. package/src/atoms/gv-autocomplete.js +1 -461
  4. package/src/atoms/gv-button.d.ts +109 -0
  5. package/src/atoms/gv-button.js +1 -410
  6. package/src/atoms/gv-checkbox.d.ts +114 -0
  7. package/src/atoms/gv-checkbox.js +1 -187
  8. package/src/atoms/gv-date-picker-calendar.d.ts +190 -0
  9. package/src/atoms/gv-date-picker-calendar.js +1 -894
  10. package/src/atoms/gv-date-picker-cell.d.ts +80 -0
  11. package/src/atoms/gv-date-picker-cell.js +1 -190
  12. package/src/atoms/gv-date-picker.d.ts +194 -0
  13. package/src/atoms/gv-date-picker.js +1 -671
  14. package/src/atoms/gv-file-upload.d.ts +64 -0
  15. package/src/atoms/gv-file-upload.js +1 -367
  16. package/src/atoms/gv-icon.d.ts +26 -0
  17. package/src/atoms/gv-icon.js +1 -103
  18. package/src/atoms/gv-image.d.ts +45 -0
  19. package/src/atoms/gv-image.js +1 -144
  20. package/src/atoms/gv-input-message.d.ts +20 -0
  21. package/src/atoms/gv-input-message.js +1 -84
  22. package/src/atoms/gv-input.d.ts +246 -0
  23. package/src/atoms/gv-input.js +1 -561
  24. package/src/atoms/gv-link.d.ts +67 -0
  25. package/src/atoms/gv-link.js +1 -210
  26. package/src/atoms/gv-message.d.ts +23 -0
  27. package/src/atoms/gv-message.js +1 -128
  28. package/src/atoms/gv-metric.d.ts +32 -0
  29. package/src/atoms/gv-metric.js +1 -117
  30. package/src/atoms/gv-relative-time.d.ts +45 -0
  31. package/src/atoms/gv-relative-time.js +1 -156
  32. package/src/atoms/gv-select-native.d.ts +174 -0
  33. package/src/atoms/gv-select-native.js +1 -388
  34. package/src/atoms/gv-select.d.ts +71 -0
  35. package/src/atoms/gv-select.js +1 -437
  36. package/src/atoms/gv-spinner.d.ts +10 -0
  37. package/src/atoms/gv-spinner.js +1 -57
  38. package/src/atoms/gv-state.d.ts +50 -0
  39. package/src/atoms/gv-state.js +1 -130
  40. package/src/atoms/gv-switch.d.ts +60 -0
  41. package/src/atoms/gv-switch.js +1 -243
  42. package/src/atoms/gv-tag.d.ts +69 -0
  43. package/src/atoms/gv-tag.js +1 -168
  44. package/src/atoms/gv-text.d.ts +110 -0
  45. package/src/atoms/gv-text.js +1 -168
  46. package/src/charts/gv-chart-bar.d.ts +50 -0
  47. package/src/charts/gv-chart-bar.js +1 -103
  48. package/src/charts/gv-chart-gauge.d.ts +58 -0
  49. package/src/charts/gv-chart-gauge.js +1 -100
  50. package/src/charts/gv-chart-histogram.d.ts +48 -0
  51. package/src/charts/gv-chart-histogram.js +1 -83
  52. package/src/charts/gv-chart-line.d.ts +52 -0
  53. package/src/charts/gv-chart-line.js +1 -224
  54. package/src/charts/gv-chart-map.d.ts +50 -0
  55. package/src/charts/gv-chart-map.js +1 -112
  56. package/src/charts/gv-chart-pie.d.ts +50 -0
  57. package/src/charts/gv-chart-pie.js +1 -91
  58. package/src/index.d.ts +77 -0
  59. package/src/index.js +1 -77
  60. package/src/lib/cron-expression.d.ts +1 -0
  61. package/src/lib/cron-expression.js +1 -205
  62. package/src/lib/date.d.ts +1 -0
  63. package/src/lib/date.js +1 -44
  64. package/src/lib/events.d.ts +1 -0
  65. package/src/lib/events.js +1 -26
  66. package/src/lib/http-client-schema-form.d.ts +68 -0
  67. package/src/lib/http-client-schema-form.js +1 -67
  68. package/src/lib/http.d.ts +222 -0
  69. package/src/lib/http.js +1 -237
  70. package/src/lib/i18n.d.ts +30 -0
  71. package/src/lib/i18n.js +1 -103
  72. package/src/lib/item.d.ts +12 -0
  73. package/src/lib/item.js +1 -118
  74. package/src/lib/properties.d.ts +42 -0
  75. package/src/lib/properties.js +1 -189
  76. package/src/lib/schema-form.d.ts +5 -0
  77. package/src/lib/schema-form.js +1 -44
  78. package/src/lib/studio.d.ts +2 -0
  79. package/src/lib/studio.js +1 -141
  80. package/src/lib/style.d.ts +6 -0
  81. package/src/lib/style.js +1 -41
  82. package/src/lib/text-format.d.ts +6 -0
  83. package/src/lib/text-format.js +1 -69
  84. package/src/lib/theme.d.ts +4 -0
  85. package/src/lib/theme.js +1 -63
  86. package/src/lib/utils.d.ts +9 -0
  87. package/src/lib/utils.js +1 -111
  88. package/src/mixins/chart-element.d.ts +39 -0
  89. package/src/mixins/chart-element.js +1 -165
  90. package/src/mixins/input-element.d.ts +64 -0
  91. package/src/mixins/input-element.js +1 -144
  92. package/src/mixins/item-resource.d.ts +56 -0
  93. package/src/mixins/item-resource.js +1 -120
  94. package/src/mixins/keyboard-element.d.ts +25 -0
  95. package/src/mixins/keyboard-element.js +1 -69
  96. package/src/mixins/update-after-browser.d.ts +11 -0
  97. package/src/mixins/update-after-browser.js +1 -30
  98. package/src/mixins/with-resize-observer.d.ts +12 -0
  99. package/src/mixins/with-resize-observer.js +1 -68
  100. package/src/mixins/with-skeleton-attribute.d.ts +35 -0
  101. package/src/mixins/with-skeleton-attribute.js +1 -112
  102. package/src/molecules/gv-card-full.d.ts +78 -0
  103. package/src/molecules/gv-card-full.js +1 -218
  104. package/src/molecules/gv-card-list.d.ts +33 -0
  105. package/src/molecules/gv-card-list.js +1 -113
  106. package/src/molecules/gv-card.d.ts +65 -0
  107. package/src/molecules/gv-card.js +1 -133
  108. package/src/molecules/gv-category-list.d.ts +17 -0
  109. package/src/molecules/gv-category-list.js +1 -60
  110. package/src/molecules/gv-category.d.ts +64 -0
  111. package/src/molecules/gv-category.js +1 -170
  112. package/src/molecules/gv-code.d.ts +192 -0
  113. package/src/molecules/gv-code.js +1 -359
  114. package/src/molecules/gv-confirm.d.ts +60 -0
  115. package/src/molecules/gv-confirm.js +1 -188
  116. package/src/molecules/gv-cron-editor.d.ts +115 -0
  117. package/src/molecules/gv-cron-editor.js +1 -710
  118. package/src/molecules/gv-dropdown-menu.d.ts +28 -0
  119. package/src/molecules/gv-dropdown-menu.js +1 -116
  120. package/src/molecules/gv-expandable.d.ts +37 -0
  121. package/src/molecules/gv-expandable.js +1 -122
  122. package/src/molecules/gv-expression-language.d.ts +150 -0
  123. package/src/molecules/gv-expression-language.js +1 -270
  124. package/src/molecules/gv-identity-picture.d.ts +44 -0
  125. package/src/molecules/gv-identity-picture.js +1 -148
  126. package/src/molecules/gv-list.d.ts +123 -0
  127. package/src/molecules/gv-list.js +1 -227
  128. package/src/molecules/gv-metrics.d.ts +65 -0
  129. package/src/molecules/gv-metrics.js +1 -162
  130. package/src/molecules/gv-modal.d.ts +64 -0
  131. package/src/molecules/gv-modal.js +1 -213
  132. package/src/molecules/gv-nav.d.ts +41 -0
  133. package/src/molecules/gv-nav.js +1 -196
  134. package/src/molecules/gv-option.d.ts +65 -0
  135. package/src/molecules/gv-option.js +1 -242
  136. package/src/molecules/gv-plans.d.ts +73 -0
  137. package/src/molecules/gv-plans.js +1 -429
  138. package/src/molecules/gv-popover.d.ts +91 -0
  139. package/src/molecules/gv-popover.js +1 -351
  140. package/src/molecules/gv-promote.d.ts +108 -0
  141. package/src/molecules/gv-promote.js +1 -209
  142. package/src/molecules/gv-rating-list.d.ts +77 -0
  143. package/src/molecules/gv-rating-list.js +1 -365
  144. package/src/molecules/gv-rating.d.ts +55 -0
  145. package/src/molecules/gv-rating.js +1 -253
  146. package/src/molecules/gv-row-expandable.d.ts +8 -0
  147. package/src/molecules/gv-row-expandable.js +1 -45
  148. package/src/molecules/gv-row.d.ts +37 -0
  149. package/src/molecules/gv-row.js +1 -210
  150. package/src/molecules/gv-stats.d.ts +53 -0
  151. package/src/molecules/gv-stats.js +1 -121
  152. package/src/molecules/gv-stepper.d.ts +46 -0
  153. package/src/molecules/gv-stepper.js +1 -288
  154. package/src/molecules/gv-table.d.ts +159 -0
  155. package/src/molecules/gv-table.js +1 -685
  156. package/src/molecules/gv-tree.d.ts +44 -0
  157. package/src/molecules/gv-tree.js +1 -250
  158. package/src/organisms/gv-documentation.d.ts +52 -0
  159. package/src/organisms/gv-documentation.js +1 -215
  160. package/src/organisms/gv-header.d.ts +60 -0
  161. package/src/organisms/gv-header.js +1 -288
  162. package/src/organisms/gv-http-client.d.ts +57 -0
  163. package/src/organisms/gv-http-client.js +1 -275
  164. package/src/organisms/gv-menu.d.ts +74 -0
  165. package/src/organisms/gv-menu.js +1 -263
  166. package/src/organisms/gv-newsletter-subscription.d.ts +82 -0
  167. package/src/organisms/gv-newsletter-subscription.js +1 -271
  168. package/src/organisms/gv-pagination.d.ts +63 -0
  169. package/src/organisms/gv-pagination.js +1 -198
  170. package/src/organisms/gv-properties.d.ts +229 -0
  171. package/src/organisms/gv-properties.js +1 -920
  172. package/src/organisms/gv-resizable-views.d.ts +33 -0
  173. package/src/organisms/gv-resizable-views.js +1 -396
  174. package/src/organisms/gv-resources.d.ts +125 -0
  175. package/src/organisms/gv-resources.js +1 -535
  176. package/src/organisms/gv-schema-form-array.d.ts +55 -0
  177. package/src/organisms/gv-schema-form-array.js +1 -250
  178. package/src/organisms/gv-schema-form-control-object.d.ts +64 -0
  179. package/src/organisms/gv-schema-form-control-object.js +1 -154
  180. package/src/organisms/gv-schema-form-control.d.ts +90 -0
  181. package/src/organisms/gv-schema-form-control.js +1 -443
  182. package/src/organisms/gv-schema-form.d.ts +156 -0
  183. package/src/organisms/gv-schema-form.js +1 -751
  184. package/src/organisms/gv-tabs.d.ts +56 -0
  185. package/src/organisms/gv-tabs.js +1 -210
  186. package/src/organisms/gv-user-menu.d.ts +56 -0
  187. package/src/organisms/gv-user-menu.js +1 -314
  188. package/src/organisms/gv-vertical-menu.d.ts +28 -0
  189. package/src/organisms/gv-vertical-menu.js +1 -123
  190. package/src/policy-studio/gv-flow-step.d.ts +142 -0
  191. package/src/policy-studio/gv-flow-step.js +1 -464
  192. package/src/policy-studio/gv-flow.d.ts +89 -0
  193. package/src/policy-studio/gv-flow.js +1 -621
  194. package/src/policy-studio/gv-policy-studio-menu.d.ts +94 -0
  195. package/src/policy-studio/gv-policy-studio-menu.js +1 -750
  196. package/src/policy-studio/gv-policy-studio.d.ts +464 -0
  197. package/src/policy-studio/gv-policy-studio.js +1 -1842
  198. package/src/styles/empty.d.ts +1 -0
  199. package/src/styles/empty.js +1 -36
  200. package/src/styles/input.d.ts +1 -0
  201. package/src/styles/input.js +1 -263
  202. package/src/styles/link.d.ts +1 -0
  203. package/src/styles/link.js +1 -32
  204. package/src/styles/shapes.d.ts +2 -0
  205. package/src/styles/shapes.js +1 -17
  206. package/src/styles/skeleton.d.ts +1 -0
  207. package/src/styles/skeleton.js +1 -53
  208. package/src/styles/zoom.d.ts +1 -0
  209. package/src/styles/zoom.js +1 -40
  210. package/src/theme/gv-theme.d.ts +81 -0
  211. package/src/theme/gv-theme.js +1 -203
  212. package/wc/gv-autocomplete.d.ts +1 -0
  213. package/wc/gv-autocomplete.js +1 -1
  214. package/wc/gv-button.d.ts +1 -0
  215. package/wc/gv-button.js +1 -1
  216. package/wc/gv-card-full.d.ts +1 -0
  217. package/wc/gv-card-full.js +1 -1
  218. package/wc/gv-card-list.d.ts +1 -0
  219. package/wc/gv-card-list.js +1 -1
  220. package/wc/gv-card.d.ts +1 -0
  221. package/wc/gv-card.js +1 -1
  222. package/wc/gv-category-list.d.ts +1 -0
  223. package/wc/gv-category-list.js +1 -1
  224. package/wc/gv-category.d.ts +1 -0
  225. package/wc/gv-category.js +1 -1
  226. package/wc/gv-chart-bar.d.ts +1 -0
  227. package/wc/gv-chart-bar.js +1 -1
  228. package/wc/gv-chart-gauge.d.ts +1 -0
  229. package/wc/gv-chart-gauge.js +1 -1
  230. package/wc/gv-chart-histogram.d.ts +1 -0
  231. package/wc/gv-chart-histogram.js +1 -1
  232. package/wc/gv-chart-line.d.ts +1 -0
  233. package/wc/gv-chart-line.js +1 -1
  234. package/wc/gv-chart-map.d.ts +1 -0
  235. package/wc/gv-chart-map.js +1 -1
  236. package/wc/gv-chart-pie.d.ts +1 -0
  237. package/wc/gv-chart-pie.js +1 -1
  238. package/wc/gv-checkbox.d.ts +1 -0
  239. package/wc/gv-checkbox.js +1 -1
  240. package/wc/gv-code.d.ts +1 -0
  241. package/wc/gv-code.js +1 -1
  242. package/wc/gv-confirm.d.ts +1 -0
  243. package/wc/gv-confirm.js +1 -1
  244. package/wc/gv-cron-editor.d.ts +1 -0
  245. package/wc/gv-cron-editor.js +1 -1
  246. package/wc/gv-date-picker-calendar.d.ts +1 -0
  247. package/wc/gv-date-picker-calendar.js +1 -1
  248. package/wc/gv-date-picker-cell.d.ts +1 -0
  249. package/wc/gv-date-picker-cell.js +1 -1
  250. package/wc/gv-date-picker.d.ts +1 -0
  251. package/wc/gv-date-picker.js +1 -1
  252. package/wc/gv-documentation.d.ts +1 -0
  253. package/wc/gv-documentation.js +1 -1
  254. package/wc/gv-dropdown-menu.d.ts +1 -0
  255. package/wc/gv-dropdown-menu.js +1 -1
  256. package/wc/gv-expandable.d.ts +1 -0
  257. package/wc/gv-expandable.js +1 -1
  258. package/wc/gv-expression-language.d.ts +1 -0
  259. package/wc/gv-expression-language.js +1 -1
  260. package/wc/gv-file-upload.d.ts +1 -0
  261. package/wc/gv-file-upload.js +1 -1
  262. package/wc/gv-flow-step.d.ts +1 -0
  263. package/wc/gv-flow-step.js +1 -1
  264. package/wc/gv-flow.d.ts +1 -0
  265. package/wc/gv-flow.js +1 -1
  266. package/wc/gv-header.d.ts +1 -0
  267. package/wc/gv-header.js +1 -1
  268. package/wc/gv-http-client.d.ts +1 -0
  269. package/wc/gv-http-client.js +1 -1
  270. package/wc/gv-icon.d.ts +1 -0
  271. package/wc/gv-icon.js +1 -1
  272. package/wc/gv-identity-picture.d.ts +1 -0
  273. package/wc/gv-identity-picture.js +1 -1
  274. package/wc/gv-image.d.ts +1 -0
  275. package/wc/gv-image.js +1 -1
  276. package/wc/gv-input-message.d.ts +1 -0
  277. package/wc/gv-input-message.js +1 -1
  278. package/wc/gv-input.d.ts +1 -0
  279. package/wc/gv-input.js +1 -1
  280. package/wc/gv-link.d.ts +1 -0
  281. package/wc/gv-link.js +1 -1
  282. package/wc/gv-list.d.ts +1 -0
  283. package/wc/gv-list.js +1 -1
  284. package/wc/gv-menu.d.ts +1 -0
  285. package/wc/gv-menu.js +1 -1
  286. package/wc/gv-message.d.ts +1 -0
  287. package/wc/gv-message.js +1 -1
  288. package/wc/gv-metric.d.ts +1 -0
  289. package/wc/gv-metric.js +1 -1
  290. package/wc/gv-metrics.d.ts +1 -0
  291. package/wc/gv-metrics.js +1 -1
  292. package/wc/gv-modal.d.ts +1 -0
  293. package/wc/gv-modal.js +1 -1
  294. package/wc/gv-nav.d.ts +1 -0
  295. package/wc/gv-nav.js +1 -1
  296. package/wc/gv-newsletter-subscription.d.ts +1 -0
  297. package/wc/gv-newsletter-subscription.js +1 -1
  298. package/wc/gv-option.d.ts +1 -0
  299. package/wc/gv-option.js +1 -1
  300. package/wc/gv-pagination.d.ts +1 -0
  301. package/wc/gv-pagination.js +1 -1
  302. package/wc/gv-plans.d.ts +1 -0
  303. package/wc/gv-plans.js +1 -1
  304. package/wc/gv-policy-studio-menu.d.ts +1 -0
  305. package/wc/gv-policy-studio-menu.js +1 -1
  306. package/wc/gv-policy-studio.d.ts +1 -0
  307. package/wc/gv-policy-studio.js +1 -1
  308. package/wc/gv-popover.d.ts +1 -0
  309. package/wc/gv-popover.js +1 -1
  310. package/wc/gv-promote.d.ts +1 -0
  311. package/wc/gv-promote.js +1 -1
  312. package/wc/gv-properties.d.ts +1 -0
  313. package/wc/gv-properties.js +1 -1
  314. package/wc/gv-rating-list.d.ts +1 -0
  315. package/wc/gv-rating-list.js +1 -1
  316. package/wc/gv-rating.d.ts +1 -0
  317. package/wc/gv-rating.js +1 -1
  318. package/wc/gv-relative-time.d.ts +1 -0
  319. package/wc/gv-relative-time.js +1 -1
  320. package/wc/gv-resizable-views.d.ts +1 -0
  321. package/wc/gv-resizable-views.js +1 -1
  322. package/wc/gv-resources.d.ts +1 -0
  323. package/wc/gv-resources.js +1 -1
  324. package/wc/gv-row-expandable.d.ts +1 -0
  325. package/wc/gv-row-expandable.js +1 -1
  326. package/wc/gv-row.d.ts +1 -0
  327. package/wc/gv-row.js +1 -1
  328. package/wc/gv-schema-form-array.d.ts +1 -0
  329. package/wc/gv-schema-form-array.js +1 -1
  330. package/wc/gv-schema-form-control-object.d.ts +1 -0
  331. package/wc/gv-schema-form-control-object.js +1 -1
  332. package/wc/gv-schema-form-control.d.ts +1 -0
  333. package/wc/gv-schema-form-control.js +1 -1
  334. package/wc/gv-schema-form.d.ts +1 -0
  335. package/wc/gv-schema-form.js +1 -1
  336. package/wc/gv-select-native.d.ts +1 -0
  337. package/wc/gv-select-native.js +1 -1
  338. package/wc/gv-select.d.ts +1 -0
  339. package/wc/gv-select.js +1 -1
  340. package/wc/gv-spinner.d.ts +1 -0
  341. package/wc/gv-spinner.js +1 -1
  342. package/wc/gv-state.d.ts +1 -0
  343. package/wc/gv-state.js +1 -1
  344. package/wc/gv-stats.d.ts +1 -0
  345. package/wc/gv-stats.js +1 -1
  346. package/wc/gv-stepper.d.ts +1 -0
  347. package/wc/gv-stepper.js +1 -1
  348. package/wc/gv-switch.d.ts +1 -0
  349. package/wc/gv-switch.js +1 -1
  350. package/wc/gv-table.d.ts +1 -0
  351. package/wc/gv-table.js +1 -1
  352. package/wc/gv-tabs.d.ts +1 -0
  353. package/wc/gv-tabs.js +1 -1
  354. package/wc/gv-tag.d.ts +1 -0
  355. package/wc/gv-tag.js +1 -1
  356. package/wc/gv-text.d.ts +1 -0
  357. package/wc/gv-text.js +1 -1
  358. package/wc/gv-theme.d.ts +1 -0
  359. package/wc/gv-theme.js +1 -1
  360. package/wc/gv-tree.d.ts +1 -0
  361. package/wc/gv-tree.js +1 -1
  362. package/wc/gv-user-menu.d.ts +1 -0
  363. package/wc/gv-user-menu.js +1 -1
  364. package/wc/gv-vertical-menu.d.ts +1 -0
  365. package/wc/gv-vertical-menu.js +1 -1
  366. package/CHANGELOG.md +0 -1292
  367. package/LICENSE.txt +0 -202
  368. package/README.md +0 -195
  369. package/src/.eslintrc.js +0 -19
  370. package/src/theme/definition.json +0 -1762
@@ -1,750 +1 @@
1
- /*
2
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { LitElement, html, css } from 'lit';
17
- import { link } from '../styles/link';
18
- import { dispatchCustomEvent } from '../lib/events';
19
- import { classMap } from 'lit/directives/class-map';
20
- import '../atoms/gv-image';
21
- import '../atoms/gv-state';
22
- import '../molecules/gv-popover';
23
- import './gv-flow-step';
24
- import { getFlowName, methods } from '../lib/studio';
25
- import { repeat } from 'lit/directives/repeat';
26
- import { appendDraggableImage, uuid } from '../lib/utils';
27
-
28
- /**
29
- * Policy studio menu component
30
- */
31
- export class GvPolicyStudioMenu extends LitElement {
32
- static get properties() {
33
- return {
34
- policies: { type: Array },
35
- flows: { type: Object },
36
- plans: { type: Object },
37
- selectedIds: { type: Array },
38
- sortable: { type: Boolean },
39
- disabled: { type: Boolean, reflect: true },
40
- query: { type: String },
41
- flowsTitle: { type: String, attribute: 'flows-title' },
42
- hasPolicyFilter: { type: Boolean, attribute: 'has-policy-filter' },
43
- canAdd: { type: Boolean, attribute: 'can-add' },
44
- readonly: { type: Boolean },
45
- readonlyPlans: { type: Boolean },
46
- };
47
- }
48
-
49
- constructor() {
50
- super();
51
- this.selectedIds = [];
52
- this.flowsTitle = 'Flows';
53
- }
54
-
55
- static get styles() {
56
- return [
57
- link,
58
- methods,
59
- // language=CSS
60
- css`
61
- :host {
62
- box-sizing: border-box;
63
- min-width: 250px;
64
- display: flex;
65
- flex-direction: column;
66
- }
67
-
68
- :host([disabled]) {
69
- opacity: 0.5;
70
- }
71
-
72
- :host([disabled]) * {
73
- cursor: not-allowed;
74
- }
75
-
76
- .box {
77
- flex: 1;
78
- overflow: auto;
79
- }
80
-
81
- .type {
82
- background-color: #f5f5f5;
83
- text-transform: capitalize;
84
- text-decoration: none;
85
- padding: 0.2rem;
86
- color: #262626;
87
- border-width: 1px 0 1px 0;
88
- border-style: solid;
89
- border-color: #bfbfbf;
90
- font-size: 15px;
91
- display: flex;
92
- align-items: center;
93
- box-sizing: border-box;
94
- height: 42px;
95
- }
96
-
97
- .type .type-name {
98
- flex: 1;
99
- }
100
-
101
- .type .type-name,
102
- .entry .entry-name {
103
- display: flex;
104
- align-items: center;
105
- white-space: nowrap;
106
- overflow: hidden;
107
- min-width: 150px;
108
- height: 100%;
109
- }
110
-
111
- .expandable {
112
- background: #fff;
113
- overflow: hidden;
114
- transition: height, opacity, width, padding, color 0.25s ease-in-out;
115
- line-height: 0;
116
- color: transparent;
117
- box-sizing: border-box;
118
- font-size: 14px;
119
- --gv-icon--s: 0;
120
- visibility: hidden;
121
- }
122
-
123
- .expandable.open {
124
- line-height: 1.5;
125
- padding-top: 0.5rem;
126
- padding-bottom: 0.5rem;
127
- color: #262626;
128
- overflow: auto;
129
- visibility: visible;
130
- }
131
-
132
- .entry {
133
- display: flex;
134
- align-items: center;
135
- user-select: none;
136
- position: relative;
137
- }
138
-
139
- .entry.disabled {
140
- text-decoration: line-through;
141
- font-style: italic;
142
- }
143
-
144
- .entry gv-image {
145
- height: 0px;
146
- width: 0px;
147
- transition: height 75ms ease-in-out;
148
- visibility: hidden;
149
- }
150
-
151
- .entry gv-tag {
152
- display: none;
153
- }
154
-
155
- .expandable-icon {
156
- margin-right: 2px;
157
- --gv-icon--s: 22px;
158
- --gv-icon--c: #5a7684;
159
- --gv-icon-opacity--c: #5a7684;
160
- }
161
-
162
- .policy-icon {
163
- --gv-icon--s: 40px;
164
- margin-right: 2px;
165
- --gv-icon--c: #5a7684;
166
- --gv-icon-opacity--c: #5a7684;
167
- }
168
-
169
- .expandable.open .entry gv-tag {
170
- display: block;
171
- }
172
-
173
- .expandable.open .entry gv-image {
174
- height: 40px;
175
- width: 40px;
176
- margin-right: 5px;
177
- visibility: visible;
178
- }
179
-
180
- .expandable.open .entry:focus-within {
181
- --gv-icon--c: #28444f;
182
- color: #28444f;
183
- }
184
-
185
- .expandable.open .entry:focus-within .actions {
186
- visibility: visible;
187
- opacity: 1;
188
- height: 25px;
189
- }
190
-
191
- .flow-path {
192
- max-width: 200px;
193
- }
194
-
195
- .entry .actions {
196
- background-color: white;
197
- transition: all 250ms ease-in-out;
198
- align-items: center;
199
- display: flex;
200
- position: absolute;
201
- right: 0;
202
- padding: 0.1rem;
203
- }
204
-
205
- gv-button {
206
- --gv-icon--c: #28444f;
207
- }
208
-
209
- .entry .actions > * {
210
- margin: 1px;
211
- opacity: 0;
212
- visibility: hidden;
213
- display: none;
214
- }
215
-
216
- .entry:focus-within .actions > * {
217
- opacity: 1;
218
- visibility: visible;
219
- display: block;
220
- }
221
-
222
- .flow-path {
223
- text-overflow: ellipsis;
224
- overflow: hidden;
225
- white-space: nowrap;
226
- }
227
-
228
- .expandable.open .entry {
229
- border: 1px dotted transparent;
230
- padding: 0.2rem;
231
- line-height: 25px;
232
- min-height: 32px;
233
- }
234
-
235
- .expandable.open .entry {
236
- --gv-icon--s: 16px;
237
- }
238
-
239
- .expandable.open .entry.selected,
240
- .expandable.open .entry.selected .actions {
241
- background-color: #f5f5f5;
242
- }
243
-
244
- .expandable.open .entry.selected {
245
- border-top: 1px dotted #bfbfbf;
246
- border-bottom: 1px dotted #bfbfbf;
247
- border-right: 1px dotted #bfbfbf;
248
- }
249
-
250
- .dragging {
251
- cursor: grabbing;
252
- opacity: 1;
253
- background-color: #f5f5f5;
254
- box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
255
- transform: none;
256
- }
257
-
258
- .flow {
259
- margin-left: 0.2rem;
260
- }
261
-
262
- .flow.sortable {
263
- margin: 0;
264
- }
265
-
266
- .policy.draggable gv-icon,
267
- .policy.draggable gv-image,
268
- .sortable,
269
- .sortable gv-icon {
270
- cursor: grab;
271
- }
272
-
273
- .policy.draggable:active,
274
- .sortable:active,
275
- .sortable gv-icon:active {
276
- cursor: grabbing;
277
- }
278
-
279
- .policy-name {
280
- flex: 1;
281
- display: flex;
282
- align-items: center;
283
- }
284
-
285
- .policy .draggable-icon {
286
- opacity: 0;
287
- visibility: hidden;
288
- transition: all 350ms ease-in-out;
289
- }
290
-
291
- .policy:hover .draggable-icon {
292
- opacity: 1;
293
- visibility: visible;
294
- }
295
-
296
- gv-tag,
297
- gv-state {
298
- --gv-tag--p: 1px 3px;
299
- --gv-state--p: 4px 6px;
300
- --gv-state--fz: 10px;
301
- --gv-state--c: #28444f;
302
- --gv-state--bgc: #ffffff;
303
- margin: 0 1px;
304
- }
305
-
306
- .error-icon {
307
- --gv-icon--c: var(--gv-theme-color-warning, #ff9800);
308
- }
309
- `,
310
- ];
311
- }
312
-
313
- _onExpand(anchor, e) {
314
- if (!this.disabled) {
315
- e.preventDefault();
316
- e.stopPropagation();
317
- this.shadowRoot.querySelector(anchor).classList.toggle('open');
318
- }
319
- }
320
-
321
- _onDragStartPolicy(policy, e) {
322
- e.dataTransfer.setData('text/plain', JSON.stringify({ policy }));
323
- const size = 100;
324
- this._draggablePolicyImage = appendDraggableImage(policy.icon, size);
325
- e.dataTransfer.setDragImage(this._draggablePolicyImage, size / 2, size / 2);
326
- dispatchCustomEvent(this, 'dragstart-policy', { dataTransfer: e.dataTransfer });
327
- }
328
-
329
- _onDragEndPolicy() {
330
- if (this._draggablePolicyImage) {
331
- this._draggablePolicyImage.remove();
332
- this._draggablePolicyImage = null;
333
- }
334
- dispatchCustomEvent(this, 'dragend-policy');
335
- }
336
-
337
- _onClickFlow(flow, e) {
338
- if (!this.disabled) {
339
- if (e.shiftKey) {
340
- this._compareFlow(flow);
341
- } else {
342
- this._selectFlow(flow);
343
- }
344
- }
345
- }
346
-
347
- _selectFlow(flow) {
348
- this.selectedIds = [flow._id];
349
- dispatchCustomEvent(this, 'select-flows', { flows: this.selectedIds });
350
- }
351
-
352
- _compareFlow(flow) {
353
- if (this.selectedIds.length > 0) {
354
- this.selectedIds = [...new Set([this.selectedIds[0], flow._id])];
355
- dispatchCustomEvent(this, 'select-flows', { flows: this.selectedIds });
356
- } else {
357
- this._selectFlow(flow);
358
- }
359
- }
360
-
361
- _onMouseEnterPolicy(policy) {
362
- dispatchCustomEvent(this, 'target-policy', { policy });
363
- }
364
-
365
- _onMouseLeavePolicy() {
366
- dispatchCustomEvent(this, 'target-policy', null);
367
- }
368
-
369
- _onMouseEnterFlow(e) {
370
- if (this._draggingFlow == null) {
371
- e.target.focus();
372
- }
373
- }
374
-
375
- _onMouseLeaveFlow(e) {
376
- if (this._draggingFlow == null) {
377
- e.target.blur();
378
- }
379
- }
380
-
381
- _filter(content) {
382
- if (this.query) {
383
- return content.name.toLowerCase().includes(this.query.toLowerCase());
384
- }
385
- return true;
386
- }
387
-
388
- hasCompare() {
389
- return this.selectedIds.length > 1;
390
- }
391
-
392
- _onChangeFlowState(content, { detail }) {
393
- dispatchCustomEvent(this, 'change-flow-state', { content, enabled: detail });
394
- }
395
-
396
- _onDuplicateFlow(content) {
397
- dispatchCustomEvent(this, 'duplicate-flow', { content });
398
- }
399
-
400
- _onDeleteFlow(content) {
401
- dispatchCustomEvent(this, 'delete-flow', { content });
402
- }
403
-
404
- _renderFlowActions(content, readonlyMode) {
405
- if (this.disabled) {
406
- return html``;
407
- }
408
- const enabled = content.enabled !== false;
409
- const stateLabel = enabled ? 'Disable flow ?' : 'Enable flow ?';
410
- return html`<div class="actions">
411
- ${this.hasCompare() || this.selectedIds.includes(content._id)
412
- ? ''
413
- : html`<gv-button
414
- tabindex="0"
415
- link
416
- small
417
- icon="navigation:route"
418
- @gv-button:click="${this._compareFlow.bind(this, content)}"
419
- title="Compare"
420
- ></gv-button>`}
421
- ${this.canAdd && readonlyMode !== true
422
- ? html`<gv-button
423
- tabindex="0"
424
- link
425
- small
426
- icon="general:duplicate"
427
- @gv-button:click="${this._onDuplicateFlow.bind(this, content)}"
428
- title="Duplicate"
429
- ></gv-button>
430
- <gv-button
431
- tabindex="0"
432
- link
433
- small
434
- icon="home:trash"
435
- @gv-button:click="${this._onDeleteFlow.bind(this, content)}"
436
- title="Delete"
437
- ></gv-button>`
438
- : ''}
439
- ${readonlyMode !== true
440
- ? html`<gv-switch
441
- tabindex="0"
442
- small
443
- title="${stateLabel}"
444
- .value="${enabled}"
445
- @gv-switch:input="${this._onChangeFlowState.bind(this, content)}"
446
- ></gv-switch>`
447
- : ''}
448
- </div>`;
449
- }
450
-
451
- _onDragStartFlow(flow, index, event) {
452
- const classList = event.target.classList;
453
- if (classList && classList.contains('flow')) {
454
- classList.remove('hover');
455
- classList.add('dragging');
456
- this._draggingFlow = { target: event.target, flow, index };
457
- }
458
- }
459
-
460
- _onDragEnterFlow(event) {
461
- if (
462
- event.target.classList &&
463
- event.target.classList.contains('flow') &&
464
- this._draggingFlow.target.parentElement === event.target.parentElement
465
- ) {
466
- if (event.target.previousSibling !== this._draggingFlow.target) {
467
- event.target.parentElement.insertBefore(this._draggingFlow.target, event.target);
468
- } else if (event.target.nextSibling) {
469
- event.target.parentElement.insertBefore(this._draggingFlow.target, event.target.nextSibling);
470
- } else {
471
- event.target.parentElement.appendChild(this._draggingFlow.target);
472
- }
473
- this._draggingFlow.target.classList.remove('dragging');
474
- }
475
- }
476
-
477
- _findFlowCollection(flowId) {
478
- const plan = this.plans.find((plan) => plan.flows.find((flow) => flow._id === flowId) != null);
479
- return { plan, flows: plan != null ? plan.flows : this.flows };
480
- }
481
-
482
- _onDragEndFlow() {
483
- this._draggingFlow.target.classList.remove('dragging');
484
- const index = [...this._draggingFlow.target.parentElement.querySelectorAll('.flow[draggable="true"]')].indexOf(
485
- this._draggingFlow.target,
486
- );
487
- if (index !== this._draggingFlow.index) {
488
- const { plan, flows } = this._findFlowCollection(this._draggingFlow.flow._id);
489
- const flowToReorder = flows.splice(this._draggingFlow.index, 1)[0];
490
- flows.splice(index, 0, flowToReorder);
491
- const min = Math.min(this._draggingFlow.index, index);
492
- const max = Math.max(this._draggingFlow.index, index);
493
- flows.forEach((flow, i) => {
494
- if (i >= min && i <= max) {
495
- flow._dirty = true;
496
- }
497
- });
498
-
499
- dispatchCustomEvent(this, 'reorder-flows', { plan });
500
- setTimeout(() => {
501
- this._draggingFlow = null;
502
- }, 0);
503
- this._draggingFlow.target.focus();
504
- }
505
- }
506
-
507
- _onDragOverFlow(e) {
508
- e.preventDefault();
509
- }
510
-
511
- _onKeyDownFlow(index, e) {
512
- if (e.target.classList.contains('flow') && e.keyCode === 32) {
513
- e.preventDefault();
514
- this._selectFlow(index);
515
- }
516
- }
517
-
518
- _onClickPolicy(policy) {
519
- if (!this.disabled) {
520
- this.selectedIds = [policy.id];
521
- dispatchCustomEvent(this, 'fetch-documentation', { policy });
522
- }
523
- }
524
-
525
- _isSelected(id) {
526
- return this.selectedIds != null && this.selectedIds.includes(id);
527
- }
528
-
529
- _renderFlows(filteredData, type, isChild, id, open) {
530
- const readonlyForFlow = isChild && this.readonlyPlans;
531
- return html`<div class="${classMap({ content: true, expandable: true, open })}" id="${id}">
532
- ${repeat(
533
- filteredData,
534
- () => uuid(),
535
- (content, index) => html`
536
- <div
537
- draggable="${this.sortable && !this.disabled && !readonlyForFlow}"
538
- tabindex="0"
539
- @dragstart="${this._onDragStartFlow.bind(this, content, index)}"
540
- @dragenter="${this._onDragEnterFlow}"
541
- @dragend="${this._onDragEndFlow}"
542
- @dragover="${this._onDragOverFlow}"
543
- @keydown="${this._onKeyDownFlow.bind(this, index)}"
544
- @mouseenter="${this._onMouseEnterFlow}"
545
- @mouseleave="${this._onMouseLeaveFlow}"
546
- class="${classMap({
547
- entry: true,
548
- flow: true,
549
- sortable: this.sortable && !this.disabled && !readonlyForFlow,
550
- selected: this.selectedIds.includes(content._id),
551
- child: isChild,
552
- disabled: content.enabled === false,
553
- })}"
554
- >
555
- <div
556
- title="${content.name} | Compare with current selection (Shift + click)"
557
- @click="${this._onClickFlow.bind(this, content)}"
558
- class="entry-name link"
559
- >
560
- ${getFlowName(content, null, true, this.sortable && !readonlyForFlow, true)}
561
- </div>
562
- ${this._renderFlowActions(content, this.readonly || readonlyForFlow)}
563
- </div>
564
- `,
565
- )}
566
- </div> `;
567
- }
568
-
569
- _isDraggable(policy) {
570
- return !this.disabled && (this.hasPolicyFilter !== true || policy.onRequest === true || policy.onResponse === true);
571
- }
572
-
573
- _renderPolicies(filteredData, type, isChild, id, group) {
574
- return html`<div
575
- id="${id}"
576
- class="${classMap({
577
- content: true,
578
- expandable: true,
579
- open: true,
580
- child: isChild,
581
- })}"
582
- >
583
- ${filteredData.map((content) => {
584
- const draggable = this._isDraggable(content);
585
- return html`<div
586
- class="${classMap({
587
- entry: true,
588
- link: true,
589
- policy: true,
590
- selected: this._isSelected(content.id),
591
- draggable,
592
- })}"
593
- draggable="${draggable}"
594
- @mouseenter="${this._onMouseEnterPolicy.bind(this, content)}"
595
- @mouseleave="${this._onMouseLeavePolicy.bind(this, content)}"
596
- @dragstart="${this._onDragStartPolicy.bind(this, content)}"
597
- @dragend="${this._onDragEndPolicy}"
598
- @click="${this._onClickPolicy.bind(this, content)}"
599
- title="Show documentation of ${content.name}"
600
- >
601
- ${content.icon == null && group != null
602
- ? html`<gv-icon class="policy-icon" shape="${this._getGroupShape(group)}"></gv-icon>`
603
- : html`<gv-image src="${content.icon}"></gv-image>`}
604
- <div class="policy-name">${content.name}</div>
605
- ${draggable ? html`<gv-icon class="draggable-icon" shape="design:arrows"></gv-icon>` : html``}
606
- </div>`;
607
- })}
608
- </div>`;
609
- }
610
-
611
- _getGroupShape(groupName) {
612
- if (groupName === 'security') {
613
- return 'general:shield-protected';
614
- } else if (groupName === 'transformation') {
615
- return 'tools:roller';
616
- } else if (groupName === 'performance') {
617
- return 'general:thunder-move';
618
- } else {
619
- return 'communication:shield-thunder';
620
- }
621
- }
622
-
623
- _renderPart(type, title, icon, data = [], hideIfEmpty, addHandler, groupKey = null, isOpen = true, isChild = false, listId) {
624
- let list;
625
- const filteredData = data.filter((content) => this._filter(content));
626
- if ((hideIfEmpty && data.length > 0) || !hideIfEmpty) {
627
- if (groupKey && !isChild) {
628
- const groups = [...new Set(filteredData.map((content) => content[groupKey]))];
629
-
630
- return html`${groups.map((group, index) => {
631
- let groupData = filteredData.filter((data) => data[groupKey] === group);
632
- const listId = group ? group.replace(/\s+/g, '-').toLowerCase() : `group-${index}`;
633
- const anchor = `#${listId}`;
634
- let right = html`<gv-state>${groupData.length}</gv-state>`;
635
- if (addHandler) {
636
- right = html`<gv-button
637
- small
638
- outlined
639
- icon="code:plus"
640
- title="Add new flow"
641
- @click="${addHandler.bind(this, index, listId)}"
642
- ></gv-button>`;
643
- }
644
- if (type === 'flows') {
645
- groupData = groupData[0].flows;
646
- }
647
- return html`<div class="type" @click="${this._onExpand.bind(this, anchor)}">
648
- <gv-icon class="expandable-icon" shape="${this._getGroupShape(group)}"></gv-icon>
649
- <div class="link type-name">${group || 'No category'}</div>
650
- ${right}
651
- </div>
652
- ${this._renderPart(type, group, icon, groupData, hideIfEmpty, addHandler, groupKey, isOpen, true, listId)}`;
653
- })}`;
654
- } else {
655
- if (listId == null) {
656
- listId = type.replace(/\s+/g, '-').toLowerCase();
657
- }
658
- if (type === 'flows') {
659
- list = this._renderFlows(filteredData, type, isChild, listId, isOpen);
660
- } else {
661
- list = this._renderPolicies(filteredData, type, isChild, listId, title);
662
- }
663
- }
664
-
665
- if (isChild) {
666
- return html`${list}`;
667
- } else {
668
- const anchor = `#${listId}`;
669
- let action = '';
670
- if (addHandler) {
671
- action = html`<gv-button
672
- small
673
- outlined
674
- icon="code:plus"
675
- title="Add new flow"
676
- @click="${addHandler.bind(this, listId)}"
677
- ></gv-button>`;
678
- }
679
- return html`<div class="type" draggable="false">
680
- ${icon ? html`<gv-icon class="expandable-icon" shape="${icon}"></gv-icon>` : ''}
681
- <div class="type-name link" @click="${this._onExpand.bind(this, anchor)}">${title}</div>
682
- ${action}
683
- </div>
684
- ${list}`;
685
- }
686
- }
687
- return html``;
688
- }
689
-
690
- _getListElement(id) {
691
- return this.shadowRoot.querySelector(`#${id}`);
692
- }
693
-
694
- _onAddFlowToPlan(index, listId, e) {
695
- const list = this._getListElement(listId);
696
- list.classList.add('open');
697
- e.preventDefault();
698
- e.stopPropagation();
699
- dispatchCustomEvent(this, 'add-flow-plan', { planIndex: index });
700
- }
701
-
702
- _onAddFlow(listId, e) {
703
- const list = this._getListElement(listId);
704
- list.classList.add('open');
705
- e.preventDefault();
706
- e.stopPropagation();
707
- dispatchCustomEvent(this, 'add-flow');
708
- }
709
-
710
- render() {
711
- return html` <slot name="header"></slot>
712
- <div class="box">
713
- ${this.plans != null
714
- ? this._renderPart(
715
- 'flows',
716
- '',
717
- 'shopping:sale#2',
718
- this.plans,
719
- false,
720
- this.canAdd && !this.disabled && !this.readonlyPlans ? this._onAddFlowToPlan : null,
721
- 'name',
722
- )
723
- : ``}
724
- ${this.flows != null
725
- ? this._renderPart(
726
- 'flows',
727
- this.flowsTitle,
728
- 'shopping:box#3',
729
- this.flows,
730
- false,
731
- this.canAdd && !this.disabled ? this._onAddFlow : null,
732
- )
733
- : ``}
734
- ${this.policies != null
735
- ? this._renderPart(
736
- 'policies',
737
- 'Policies',
738
- 'communication:shield-thunder',
739
- this.policies,
740
- true,
741
- null,
742
- this.policies.length > 0 && this.policies[0].category != null ? 'category' : null,
743
- )
744
- : ''}
745
- </div>
746
- <slot name="footer"></slot>`;
747
- }
748
- }
749
-
750
- window.customElements.define('gv-policy-studio-menu', GvPolicyStudioMenu);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvPolicyStudioMenu=void 0;const e=require("lit"),t=require("../styles/link"),i=require("../lib/events"),o=require("lit/directives/class-map");require("../atoms/gv-image"),require("../atoms/gv-state"),require("../molecules/gv-popover"),require("./gv-flow-step");const l=require("../lib/studio"),s=require("lit/directives/repeat"),n=require("../lib/utils");class a extends e.LitElement{static get properties(){return{policies:{type:Array},flows:{type:Object},plans:{type:Object},selectedIds:{type:Array},sortable:{type:Boolean},disabled:{type:Boolean,reflect:!0},query:{type:String},flowsTitle:{type:String,attribute:"flows-title"},hasPolicyFilter:{type:Boolean,attribute:"has-policy-filter"},canAdd:{type:Boolean,attribute:"can-add"},readonly:{type:Boolean},readonlyPlans:{type:Boolean}}}constructor(){super(),this.selectedIds=[],this.flowsTitle="Flows"}static get styles(){return[t.link,l.methods,e.css`:host{box-sizing:border-box;min-width:250px;display:flex;flex-direction:column}:host([disabled]){opacity:.5}:host([disabled]) *{cursor:not-allowed}.box{flex:1;overflow:auto}.type{background-color:#f5f5f5;text-transform:capitalize;text-decoration:none;padding:.2rem;color:#262626;border-width:1px 0 1px 0;border-style:solid;border-color:#bfbfbf;font-size:15px;display:flex;align-items:center;box-sizing:border-box;height:42px}.type .type-name{flex:1}.entry .entry-name,.type .type-name{display:flex;align-items:center;white-space:nowrap;overflow:hidden;min-width:150px;height:100%}.expandable{background:#fff;overflow:hidden;transition:height,opacity,width,padding,color .25s ease-in-out;line-height:0;color:transparent;box-sizing:border-box;font-size:14px;--gv-icon--s:0;visibility:hidden}.expandable.open{line-height:1.5;padding-top:.5rem;padding-bottom:.5rem;color:#262626;overflow:auto;visibility:visible}.entry{display:flex;align-items:center;user-select:none;position:relative}.entry.disabled{text-decoration:line-through;font-style:italic}.entry gv-image{height:0;width:0;transition:height 75ms ease-in-out;visibility:hidden}.entry gv-tag{display:none}.expandable-icon{margin-right:2px;--gv-icon--s:22px;--gv-icon--c:#5a7684;--gv-icon-opacity--c:#5a7684}.policy-icon{--gv-icon--s:40px;margin-right:2px;--gv-icon--c:#5a7684;--gv-icon-opacity--c:#5a7684}.expandable.open .entry gv-tag{display:block}.expandable.open .entry gv-image{height:40px;width:40px;margin-right:5px;visibility:visible}.expandable.open .entry:focus-within{--gv-icon--c:#28444f;color:#28444f}.expandable.open .entry:focus-within .actions{visibility:visible;opacity:1;height:25px}.flow-path{max-width:200px}.entry .actions{background-color:#fff;transition:all 250ms ease-in-out;align-items:center;display:flex;position:absolute;right:0;padding:.1rem}gv-button{--gv-icon--c:#28444f}.entry .actions>*{margin:1px;opacity:0;visibility:hidden;display:none}.entry:focus-within .actions>*{opacity:1;visibility:visible;display:block}.flow-path{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.expandable.open .entry{border:1px dotted transparent;padding:.2rem;line-height:25px;min-height:32px}.expandable.open .entry{--gv-icon--s:16px}.expandable.open .entry.selected,.expandable.open .entry.selected .actions{background-color:#f5f5f5}.expandable.open .entry.selected{border-top:1px dotted #bfbfbf;border-bottom:1px dotted #bfbfbf;border-right:1px dotted #bfbfbf}.dragging{cursor:grabbing;opacity:1;background-color:#f5f5f5;box-shadow:0 0 5px rgba(0,0,0,.1);transform:none}.flow{margin-left:.2rem}.flow.sortable{margin:0}.policy.draggable gv-icon,.policy.draggable gv-image,.sortable,.sortable gv-icon{cursor:grab}.policy.draggable:active,.sortable gv-icon:active,.sortable:active{cursor:grabbing}.policy-name{flex:1;display:flex;align-items:center}.policy .draggable-icon{opacity:0;visibility:hidden;transition:all 350ms ease-in-out}.policy:hover .draggable-icon{opacity:1;visibility:visible}gv-state,gv-tag{--gv-tag--p:1px 3px;--gv-state--p:4px 6px;--gv-state--fz:10px;--gv-state--c:#28444f;--gv-state--bgc:#ffffff;margin:0 1px}.error-icon{--gv-icon--c:var(--gv-theme-color-warning, #ff9800)}`]}_onExpand(e,t){this.disabled||(t.preventDefault(),t.stopPropagation(),this.shadowRoot.querySelector(e).classList.toggle("open"))}_onDragStartPolicy(e,t){t.dataTransfer.setData("text/plain",JSON.stringify({policy:e}));this._draggablePolicyImage=(0,n.appendDraggableImage)(e.icon,100),t.dataTransfer.setDragImage(this._draggablePolicyImage,50,50),(0,i.dispatchCustomEvent)(this,"dragstart-policy",{dataTransfer:t.dataTransfer})}_onDragEndPolicy(){this._draggablePolicyImage&&(this._draggablePolicyImage.remove(),this._draggablePolicyImage=null),(0,i.dispatchCustomEvent)(this,"dragend-policy")}_onClickFlow(e,t){this.disabled||(t.shiftKey?this._compareFlow(e):this._selectFlow(e))}_selectFlow(e){this.selectedIds=[e._id],(0,i.dispatchCustomEvent)(this,"select-flows",{flows:this.selectedIds})}_compareFlow(e){this.selectedIds.length>0?(this.selectedIds=[...new Set([this.selectedIds[0],e._id])],(0,i.dispatchCustomEvent)(this,"select-flows",{flows:this.selectedIds})):this._selectFlow(e)}_onMouseEnterPolicy(e){(0,i.dispatchCustomEvent)(this,"target-policy",{policy:e})}_onMouseLeavePolicy(){(0,i.dispatchCustomEvent)(this,"target-policy",null)}_onMouseEnterFlow(e){null==this._draggingFlow&&e.target.focus()}_onMouseLeaveFlow(e){null==this._draggingFlow&&e.target.blur()}_filter(e){return!this.query||e.name.toLowerCase().includes(this.query.toLowerCase())}hasCompare(){return this.selectedIds.length>1}_onChangeFlowState(e,{detail:t}){(0,i.dispatchCustomEvent)(this,"change-flow-state",{content:e,enabled:t})}_onDuplicateFlow(e){(0,i.dispatchCustomEvent)(this,"duplicate-flow",{content:e})}_onDeleteFlow(e){(0,i.dispatchCustomEvent)(this,"delete-flow",{content:e})}_renderFlowActions(t,i){if(this.disabled)return e.html``;const o=!1!==t.enabled,l=o?"Disable flow ?":"Enable flow ?";return e.html`<div class="actions">${this.hasCompare()||this.selectedIds.includes(t._id)?"":e.html`<gv-button tabindex="0" link small icon="navigation:route" @gv-button:click="${this._compareFlow.bind(this,t)}" title="Compare"></gv-button>`} ${this.canAdd&&!0!==i?e.html`<gv-button tabindex="0" link small icon="general:duplicate" @gv-button:click="${this._onDuplicateFlow.bind(this,t)}" title="Duplicate"></gv-button><gv-button tabindex="0" link small icon="home:trash" @gv-button:click="${this._onDeleteFlow.bind(this,t)}" title="Delete"></gv-button>`:""} ${!0!==i?e.html`<gv-switch tabindex="0" small title="${l}" .value="${o}" @gv-switch:input="${this._onChangeFlowState.bind(this,t)}"></gv-switch>`:""}</div>`}_onDragStartFlow(e,t,i){const o=i.target.classList;o&&o.contains("flow")&&(o.remove("hover"),o.add("dragging"),this._draggingFlow={target:i.target,flow:e,index:t})}_onDragEnterFlow(e){e.target.classList&&e.target.classList.contains("flow")&&this._draggingFlow.target.parentElement===e.target.parentElement&&(e.target.previousSibling!==this._draggingFlow.target?e.target.parentElement.insertBefore(this._draggingFlow.target,e.target):e.target.nextSibling?e.target.parentElement.insertBefore(this._draggingFlow.target,e.target.nextSibling):e.target.parentElement.appendChild(this._draggingFlow.target),this._draggingFlow.target.classList.remove("dragging"))}_findFlowCollection(e){const t=this.plans.find((t=>null!=t.flows.find((t=>t._id===e))));return{plan:t,flows:null!=t?t.flows:this.flows}}_onDragEndFlow(){this._draggingFlow.target.classList.remove("dragging");const e=[...this._draggingFlow.target.parentElement.querySelectorAll('.flow[draggable="true"]')].indexOf(this._draggingFlow.target);if(e!==this._draggingFlow.index){const{plan:t,flows:o}=this._findFlowCollection(this._draggingFlow.flow._id),l=o.splice(this._draggingFlow.index,1)[0];o.splice(e,0,l);const s=Math.min(this._draggingFlow.index,e),n=Math.max(this._draggingFlow.index,e);o.forEach(((e,t)=>{t>=s&&t<=n&&(e._dirty=!0)})),(0,i.dispatchCustomEvent)(this,"reorder-flows",{plan:t}),setTimeout((()=>{this._draggingFlow=null}),0),this._draggingFlow.target.focus()}}_onDragOverFlow(e){e.preventDefault()}_onKeyDownFlow(e,t){t.target.classList.contains("flow")&&32===t.keyCode&&(t.preventDefault(),this._selectFlow(e))}_onClickPolicy(e){this.disabled||(this.selectedIds=[e.id],(0,i.dispatchCustomEvent)(this,"fetch-documentation",{policy:e}))}_isSelected(e){return null!=this.selectedIds&&this.selectedIds.includes(e)}_renderFlows(t,i,a,r,d){const c=a&&this.readonlyPlans;return e.html`<div class="${(0,o.classMap)({content:!0,expandable:!0,open:d})}" id="${r}">${(0,s.repeat)(t,(()=>(0,n.uuid)()),((t,i)=>e.html`<div draggable="${this.sortable&&!this.disabled&&!c}" tabindex="0" @dragstart="${this._onDragStartFlow.bind(this,t,i)}" @dragenter="${this._onDragEnterFlow}" @dragend="${this._onDragEndFlow}" @dragover="${this._onDragOverFlow}" @keydown="${this._onKeyDownFlow.bind(this,i)}" @mouseenter="${this._onMouseEnterFlow}" @mouseleave="${this._onMouseLeaveFlow}" class="${(0,o.classMap)({entry:!0,flow:!0,sortable:this.sortable&&!this.disabled&&!c,selected:this.selectedIds.includes(t._id),child:a,disabled:!1===t.enabled})}"><div title="${t.name} | Compare with current selection (Shift + click)" @click="${this._onClickFlow.bind(this,t)}" class="entry-name link">${(0,l.getFlowName)(t,null,!0,this.sortable&&!c,!0)}</div>${this._renderFlowActions(t,this.readonly||c)}</div>`))}</div>`}_isDraggable(e){return!this.disabled&&(!0!==this.hasPolicyFilter||!0===e.onRequest||!0===e.onResponse)}_renderPolicies(t,i,l,s,n){return e.html`<div id="${s}" class="${(0,o.classMap)({content:!0,expandable:!0,open:!0,child:l})}">${t.map((t=>{const i=this._isDraggable(t);return e.html`<div class="${(0,o.classMap)({entry:!0,link:!0,policy:!0,selected:this._isSelected(t.id),draggable:i})}" draggable="${i}" @mouseenter="${this._onMouseEnterPolicy.bind(this,t)}" @mouseleave="${this._onMouseLeavePolicy.bind(this,t)}" @dragstart="${this._onDragStartPolicy.bind(this,t)}" @dragend="${this._onDragEndPolicy}" @click="${this._onClickPolicy.bind(this,t)}" title="Show documentation of ${t.name}">${null==t.icon&&null!=n?e.html`<gv-icon class="policy-icon" shape="${this._getGroupShape(n)}"></gv-icon>`:e.html`<gv-image src="${t.icon}"></gv-image>`}<div class="policy-name">${t.name}</div>${i?e.html`<gv-icon class="draggable-icon" shape="design:arrows"></gv-icon>`:e.html``}</div>`}))}</div>`}_getGroupShape(e){return"security"===e?"general:shield-protected":"transformation"===e?"tools:roller":"performance"===e?"general:thunder-move":"communication:shield-thunder"}_renderPart(t,i,o,l=[],s,n,a=null,r=!0,d=!1,c){let g;const h=l.filter((e=>this._filter(e)));if(s&&l.length>0||!s){if(a&&!d){const i=[...new Set(h.map((e=>e[a])))];return e.html`${i.map(((i,l)=>{let d=h.filter((e=>e[a]===i));const c=i?i.replace(/\s+/g,"-").toLowerCase():`group-${l}`,g=`#${c}`;let p=e.html`<gv-state>${d.length}</gv-state>`;return n&&(p=e.html`<gv-button small outlined icon="code:plus" title="Add new flow" @click="${n.bind(this,l,c)}"></gv-button>`),"flows"===t&&(d=d[0].flows),e.html`<div class="type" @click="${this._onExpand.bind(this,g)}"><gv-icon class="expandable-icon" shape="${this._getGroupShape(i)}"></gv-icon><div class="link type-name">${i||"No category"}</div>${p}</div>${this._renderPart(t,i,o,d,s,n,a,r,!0,c)}`}))}`}if(null==c&&(c=t.replace(/\s+/g,"-").toLowerCase()),g="flows"===t?this._renderFlows(h,t,d,c,r):this._renderPolicies(h,t,d,c,i),d)return e.html`${g}`;{const t=`#${c}`;let l="";return n&&(l=e.html`<gv-button small outlined icon="code:plus" title="Add new flow" @click="${n.bind(this,c)}"></gv-button>`),e.html`<div class="type" draggable="false">${o?e.html`<gv-icon class="expandable-icon" shape="${o}"></gv-icon>`:""}<div class="type-name link" @click="${this._onExpand.bind(this,t)}">${i}</div>${l}</div>${g}`}}return e.html``}_getListElement(e){return this.shadowRoot.querySelector(`#${e}`)}_onAddFlowToPlan(e,t,o){this._getListElement(t).classList.add("open"),o.preventDefault(),o.stopPropagation(),(0,i.dispatchCustomEvent)(this,"add-flow-plan",{planIndex:e})}_onAddFlow(e,t){this._getListElement(e).classList.add("open"),t.preventDefault(),t.stopPropagation(),(0,i.dispatchCustomEvent)(this,"add-flow")}render(){return e.html`<slot name="header"></slot><div class="box">${null!=this.plans?this._renderPart("flows","","shopping:sale#2",this.plans,!1,!this.canAdd||this.disabled||this.readonlyPlans?null:this._onAddFlowToPlan,"name"):""} ${null!=this.flows?this._renderPart("flows",this.flowsTitle,"shopping:box#3",this.flows,!1,this.canAdd&&!this.disabled?this._onAddFlow:null):""} ${null!=this.policies?this._renderPart("policies","Policies","communication:shield-thunder",this.policies,!0,null,this.policies.length>0&&null!=this.policies[0].category?"category":null):""}</div><slot name="footer"></slot>`}}exports.GvPolicyStudioMenu=a,window.customElements.define("gv-policy-studio-menu",a);