@gravitee/ui-components 3.25.3-typescript-fdacf14 → 3.25.3-typescript-493e1dd

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 (183) hide show
  1. package/package.json +5 -13
  2. package/src/atoms/gv-autocomplete.js +422 -1
  3. package/src/atoms/gv-button.js +397 -1
  4. package/src/atoms/gv-checkbox.js +178 -1
  5. package/src/atoms/gv-date-picker-calendar.js +812 -1
  6. package/src/atoms/gv-date-picker-cell.js +174 -1
  7. package/src/atoms/gv-date-picker.js +638 -1
  8. package/src/atoms/gv-file-upload.js +348 -1
  9. package/src/atoms/gv-icon.js +93 -1
  10. package/src/atoms/gv-image.js +135 -1
  11. package/src/atoms/gv-input-message.js +78 -1
  12. package/src/atoms/gv-input.js +508 -1
  13. package/src/atoms/gv-link.js +204 -1
  14. package/src/atoms/gv-message.js +133 -1
  15. package/src/atoms/gv-metric.js +112 -1
  16. package/src/atoms/gv-relative-time.js +143 -1
  17. package/src/atoms/gv-select-native.js +363 -1
  18. package/src/atoms/gv-select.js +413 -1
  19. package/src/atoms/gv-spinner.js +54 -1
  20. package/src/atoms/gv-state.js +125 -1
  21. package/src/atoms/gv-switch.js +235 -1
  22. package/src/atoms/gv-tag.js +162 -1
  23. package/src/atoms/gv-text.js +160 -1
  24. package/src/charts/gv-chart-bar.js +101 -1
  25. package/src/charts/gv-chart-gauge.js +92 -1
  26. package/src/charts/gv-chart-histogram.js +78 -1
  27. package/src/charts/gv-chart-line.js +218 -1
  28. package/src/charts/gv-chart-map.js +111 -1
  29. package/src/charts/gv-chart-pie.js +89 -1
  30. package/src/index.js +77 -1
  31. package/src/lib/cron-expression.js +176 -1
  32. package/src/lib/date.js +43 -1
  33. package/src/lib/events.js +26 -1
  34. package/src/lib/http-client-schema-form.js +67 -1
  35. package/src/lib/http.js +237 -1
  36. package/src/lib/i18n.js +93 -1
  37. package/src/lib/item.js +110 -1
  38. package/src/lib/properties.js +171 -1
  39. package/src/lib/schema-form.js +39 -1
  40. package/src/lib/studio.js +144 -1
  41. package/src/lib/style.js +39 -1
  42. package/src/lib/text-format.js +65 -1
  43. package/src/lib/theme.js +60 -1
  44. package/src/lib/utils.js +106 -1
  45. package/src/mixins/chart-element.js +153 -1
  46. package/src/mixins/input-element.js +136 -1
  47. package/src/mixins/item-resource.js +102 -1
  48. package/src/mixins/keyboard-element.js +62 -1
  49. package/src/mixins/update-after-browser.js +30 -1
  50. package/src/mixins/with-resize-observer.js +62 -1
  51. package/src/mixins/with-skeleton-attribute.js +109 -1
  52. package/src/molecules/gv-card-full.js +209 -1
  53. package/src/molecules/gv-card-list.js +101 -1
  54. package/src/molecules/gv-card.js +130 -1
  55. package/src/molecules/gv-category-list.js +56 -1
  56. package/src/molecules/gv-category.js +163 -1
  57. package/src/molecules/gv-code.js +334 -1
  58. package/src/molecules/gv-confirm.js +175 -1
  59. package/src/molecules/gv-cron-editor.js +685 -1
  60. package/src/molecules/gv-dropdown-menu.js +108 -1
  61. package/src/molecules/gv-expandable.js +116 -1
  62. package/src/molecules/gv-expression-language.js +263 -1
  63. package/src/molecules/gv-identity-picture.js +139 -1
  64. package/src/molecules/gv-list.js +214 -1
  65. package/src/molecules/gv-metrics.js +147 -1
  66. package/src/molecules/gv-modal.js +203 -1
  67. package/src/molecules/gv-nav.js +180 -1
  68. package/src/molecules/gv-option.js +230 -1
  69. package/src/molecules/gv-plans.js +400 -1
  70. package/src/molecules/gv-popover.js +323 -1
  71. package/src/molecules/gv-promote.js +203 -1
  72. package/src/molecules/gv-rating-list.js +341 -1
  73. package/src/molecules/gv-rating.js +234 -1
  74. package/src/molecules/gv-row-expandable.js +42 -1
  75. package/src/molecules/gv-row.js +205 -1
  76. package/src/molecules/gv-stats.js +110 -1
  77. package/src/molecules/gv-stepper.js +274 -1
  78. package/src/molecules/gv-table.js +644 -1
  79. package/src/molecules/gv-tree.js +238 -1
  80. package/src/organisms/gv-documentation.js +205 -1
  81. package/src/organisms/gv-header.js +276 -1
  82. package/src/organisms/gv-http-client.js +258 -1
  83. package/src/organisms/gv-menu.js +258 -1
  84. package/src/organisms/gv-newsletter-subscription.js +258 -1
  85. package/src/organisms/gv-pagination.js +179 -1
  86. package/src/organisms/gv-properties.js +860 -1
  87. package/src/organisms/gv-resizable-views.js +371 -1
  88. package/src/organisms/gv-resources.js +496 -1
  89. package/src/organisms/gv-schema-form-array.js +237 -1
  90. package/src/organisms/gv-schema-form-control-object.js +141 -1
  91. package/src/organisms/gv-schema-form-control.js +419 -1
  92. package/src/organisms/gv-schema-form.js +700 -1
  93. package/src/organisms/gv-tabs.js +201 -1
  94. package/src/organisms/gv-user-menu.js +298 -1
  95. package/src/organisms/gv-vertical-menu.js +119 -1
  96. package/src/policy-studio/gv-flow-step.js +443 -1
  97. package/src/policy-studio/gv-flow.js +595 -1
  98. package/src/policy-studio/gv-policy-studio-menu.js +689 -1
  99. package/src/policy-studio/gv-policy-studio.js +1712 -1
  100. package/src/styles/empty.js +35 -1
  101. package/src/styles/input.js +262 -1
  102. package/src/styles/link.js +31 -1
  103. package/src/styles/shapes.js +17 -1
  104. package/src/styles/skeleton.js +52 -1
  105. package/src/styles/zoom.js +39 -1
  106. package/src/theme/gv-theme.js +197 -1
  107. package/wc/gv-autocomplete.js +1 -1
  108. package/wc/gv-button.js +1 -1
  109. package/wc/gv-card-full.js +1 -1
  110. package/wc/gv-card-list.js +1 -1
  111. package/wc/gv-card.js +1 -1
  112. package/wc/gv-category-list.js +1 -1
  113. package/wc/gv-category.js +1 -1
  114. package/wc/gv-chart-bar.js +1 -1
  115. package/wc/gv-chart-gauge.js +1 -1
  116. package/wc/gv-chart-histogram.js +1 -1
  117. package/wc/gv-chart-line.js +1 -1
  118. package/wc/gv-chart-map.js +1 -1
  119. package/wc/gv-chart-pie.js +1 -1
  120. package/wc/gv-checkbox.js +1 -1
  121. package/wc/gv-code.js +1 -1
  122. package/wc/gv-confirm.js +1 -1
  123. package/wc/gv-cron-editor.js +1 -1
  124. package/wc/gv-date-picker-calendar.js +1 -1
  125. package/wc/gv-date-picker-cell.js +1 -1
  126. package/wc/gv-date-picker.js +1 -1
  127. package/wc/gv-documentation.js +1 -1
  128. package/wc/gv-dropdown-menu.js +1 -1
  129. package/wc/gv-expandable.js +1 -1
  130. package/wc/gv-expression-language.js +1 -1
  131. package/wc/gv-file-upload.js +1 -1
  132. package/wc/gv-flow-step.js +1 -1
  133. package/wc/gv-flow.js +1 -1
  134. package/wc/gv-header.js +1 -1
  135. package/wc/gv-http-client.js +1 -1
  136. package/wc/gv-icon.js +1 -1
  137. package/wc/gv-identity-picture.js +1 -1
  138. package/wc/gv-image.js +1 -1
  139. package/wc/gv-input-message.js +1 -1
  140. package/wc/gv-input.js +1 -1
  141. package/wc/gv-link.js +1 -1
  142. package/wc/gv-list.js +1 -1
  143. package/wc/gv-menu.js +1 -1
  144. package/wc/gv-message.js +1 -1
  145. package/wc/gv-metric.js +1 -1
  146. package/wc/gv-metrics.js +1 -1
  147. package/wc/gv-modal.js +1 -1
  148. package/wc/gv-nav.js +1 -1
  149. package/wc/gv-newsletter-subscription.js +1 -1
  150. package/wc/gv-option.js +1 -1
  151. package/wc/gv-pagination.js +1 -1
  152. package/wc/gv-plans.js +1 -1
  153. package/wc/gv-policy-studio-menu.js +1 -1
  154. package/wc/gv-policy-studio.js +1 -1
  155. package/wc/gv-popover.js +1 -1
  156. package/wc/gv-promote.js +1 -1
  157. package/wc/gv-properties.js +1 -1
  158. package/wc/gv-rating-list.js +1 -1
  159. package/wc/gv-rating.js +1 -1
  160. package/wc/gv-relative-time.js +1 -1
  161. package/wc/gv-resizable-views.js +1 -1
  162. package/wc/gv-resources.js +1 -1
  163. package/wc/gv-row-expandable.js +1 -1
  164. package/wc/gv-row.js +1 -1
  165. package/wc/gv-schema-form-array.js +1 -1
  166. package/wc/gv-schema-form-control-object.js +1 -1
  167. package/wc/gv-schema-form-control.js +1 -1
  168. package/wc/gv-schema-form.js +1 -1
  169. package/wc/gv-select-native.js +1 -1
  170. package/wc/gv-select.js +1 -1
  171. package/wc/gv-spinner.js +1 -1
  172. package/wc/gv-state.js +1 -1
  173. package/wc/gv-stats.js +1 -1
  174. package/wc/gv-stepper.js +1 -1
  175. package/wc/gv-switch.js +1 -1
  176. package/wc/gv-table.js +1 -1
  177. package/wc/gv-tabs.js +1 -1
  178. package/wc/gv-tag.js +1 -1
  179. package/wc/gv-text.js +1 -1
  180. package/wc/gv-theme.js +1 -1
  181. package/wc/gv-tree.js +1 -1
  182. package/wc/gv-user-menu.js +1 -1
  183. package/wc/gv-vertical-menu.js +1 -1
@@ -1 +1,65 @@
1
- var e=Object.create?function(e,t,o,r){void 0===r&&(r=o),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]},t=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},o=function(o){if(o&&o.__esModule)return o;var r={};if(null!=o)for(var i in o)"default"!==i&&Object.prototype.hasOwnProperty.call(o,i)&&e(r,o,i);return t(r,o),r};function r(){return null==window._gvAsciidoctor?Promise.all([Promise.resolve().then((()=>o(require("asciidoctor")))),Promise.resolve().then((()=>o(require("asciidoctor-highlight.js"))))]).then((([e,t])=>(window._gvAsciidoctor=e.default(),t.default.register(window._gvAsciidoctor.Extensions),i(e.default,t.default)))):Promise.resolve(window._gvAsciidoctor)}function i(e,t){return null==window._gvAsciidoctor&&(window._gvAsciidoctor=e(),t.register(window._gvAsciidoctor.Extensions)),window._gvAsciidoctor}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toDom=exports.setAsciiDoctorAsGlobal=exports.loadAsciiDoctor=void 0,exports.loadAsciiDoctor=r,exports.setAsciiDoctorAsGlobal=i,exports.toDom=function(e,t="adoc",o=!1){return r().then((r=>{if(e){let i="";if("adoc"!==t)throw new Error(`Library not found for type : '${t}' | ${e}`);i=r.convert(e,{attributes:{showtitle:!0,"source-highlighter":"highlightjs-ext"}});const n=document.createElement("div");n.innerHTML=i,n.style.width="100%",n.style.maxWidth="1000px",n.style.margin="0 auto",n.classList.add("markdown-body"),o&&n.classList.add("small");const s=n.querySelector("h1");let c="";return s&&(c=s.textContent),{title:c,element:n}}}))};
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
+ export function loadAsciiDoctor() {
17
+ if (window._gvAsciidoctor == null) {
18
+ return Promise.all([import('asciidoctor'), import('asciidoctor-highlight.js')]).then(([asciidoctor, highlightJsExt]) => {
19
+ window._gvAsciidoctor = asciidoctor.default();
20
+ highlightJsExt.default.register(window._gvAsciidoctor.Extensions);
21
+ return setAsciiDoctorAsGlobal(asciidoctor.default, highlightJsExt.default);
22
+ });
23
+ }
24
+ return Promise.resolve(window._gvAsciidoctor);
25
+ }
26
+ export function setAsciiDoctorAsGlobal(asciidoctor, highlightJsExt) {
27
+ if (window._gvAsciidoctor == null) {
28
+ window._gvAsciidoctor = asciidoctor();
29
+ highlightJsExt.register(window._gvAsciidoctor.Extensions);
30
+ }
31
+ return window._gvAsciidoctor;
32
+ }
33
+ export function toDom(text, type = 'adoc', small = false) {
34
+ return loadAsciiDoctor().then((asciidoctor) => {
35
+ if (text) {
36
+ let innerHTML = '';
37
+ if (type === 'adoc') {
38
+ innerHTML = asciidoctor.convert(text, {
39
+ attributes: {
40
+ showtitle: true,
41
+ 'source-highlighter': 'highlightjs-ext',
42
+ },
43
+ });
44
+ }
45
+ else {
46
+ throw new Error(`Library not found for type : '${type}' | ${text}`);
47
+ }
48
+ const element = document.createElement('div');
49
+ element.innerHTML = innerHTML;
50
+ element.style.width = '100%';
51
+ element.style.maxWidth = '1000px';
52
+ element.style.margin = '0 auto';
53
+ element.classList.add('markdown-body');
54
+ if (small) {
55
+ element.classList.add('small');
56
+ }
57
+ const titleElement = element.querySelector('h1');
58
+ let title = '';
59
+ if (titleElement) {
60
+ title = titleElement.textContent;
61
+ }
62
+ return { title, element };
63
+ }
64
+ });
65
+ }
package/src/lib/theme.js CHANGED
@@ -1 +1,60 @@
1
- function e(e,o,t){setTimeout((()=>{const t=o?`url(${o})`:"none";document.documentElement.style.setProperty(e,t)}),0)}function o(e,o){let t=document.querySelector("link[rel~='icon']");t||(t=document.createElement("link"),t.rel="icon",document.getElementsByTagName("head")[0].appendChild(t)),t.href=e||o}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getApplicationTypeIcon=exports.updateFavicon=exports.updateImage=exports.applyTheme=void 0,exports.applyTheme=function(t){if(t){const n=t._links?t._links.logo:t.logo,a=t._links?t._links.optionalLogo:t.optionalLogo,i=t._links?t._links.backgroundImage:t.backgroundImage;e("--gv-theme-logo",n),e("--gv-theme-optional-logo",a),e("--gv-theme-homepage-background-image",i);o(t._links?t._links.favicon:t.favicon,"images/gravitee-favicon.png"),t.definition.data.forEach((e=>{e.css.forEach((e=>{document.documentElement.style.setProperty(e.name,e.value)}))}))}},exports.updateImage=e,exports.updateFavicon=o,exports.getApplicationTypeIcon=function(e){switch(e.toLowerCase()){case"browser":case"web":return"devices:laptop";case"native":return"devices:android";case"backend_to_backend":return"devices:server";default:return"layout:layout-top-panel-2"}};
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
+ export function applyTheme(theme) {
17
+ if (theme) {
18
+ const logo = theme._links ? theme._links.logo : theme.logo;
19
+ const optionalLogo = theme._links ? theme._links.optionalLogo : theme.optionalLogo;
20
+ const backgroundImage = theme._links ? theme._links.backgroundImage : theme.backgroundImage;
21
+ updateImage('--gv-theme-logo', logo, `url('/images/gravitee-logo-cyan.svg')`);
22
+ updateImage('--gv-theme-optional-logo', optionalLogo, `url('/images/gravitee-logo-white.svg')`);
23
+ updateImage('--gv-theme-homepage-background-image', backgroundImage, `none`);
24
+ const favicon = theme._links ? theme._links.favicon : theme.favicon;
25
+ updateFavicon(favicon, 'images/gravitee-favicon.png');
26
+ theme.definition.data.forEach((component) => {
27
+ component.css.forEach((cssProperty) => {
28
+ document.documentElement.style.setProperty(cssProperty.name, cssProperty.value);
29
+ });
30
+ });
31
+ }
32
+ }
33
+ export function updateImage(name, value, defaultValue) {
34
+ setTimeout(() => {
35
+ const propertyValue = value ? `url(${value})` : 'none';
36
+ document.documentElement.style.setProperty(name, propertyValue);
37
+ }, 0);
38
+ }
39
+ export function updateFavicon(value, defaultValue) {
40
+ let link = document.querySelector("link[rel~='icon']");
41
+ if (!link) {
42
+ link = document.createElement('link');
43
+ link.rel = 'icon';
44
+ document.getElementsByTagName('head')[0].appendChild(link);
45
+ }
46
+ link.href = value || defaultValue;
47
+ }
48
+ export function getApplicationTypeIcon(type) {
49
+ switch (type.toLowerCase()) {
50
+ case 'browser':
51
+ case 'web':
52
+ return 'devices:laptop';
53
+ case 'native':
54
+ return 'devices:android';
55
+ case 'backend_to_backend':
56
+ return 'devices:server';
57
+ default:
58
+ return 'layout:layout-top-panel-2';
59
+ }
60
+ }
package/src/lib/utils.js CHANGED
@@ -1 +1,106 @@
1
- function e(e){return null!=e&&"object"==typeof e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isObject=exports.deepEqual=exports.uuid=exports.deepClone=exports.flatObject=exports.flatDeep=exports.appendDraggableImage=exports.isSameRoutes=exports.truncate=void 0,exports.truncate=function(e,t=250,r="..."){return e&&e.length>t?`${e.substring(0,t)}${r}`:e},exports.isSameRoutes=function(e,t){return!(!e||!t)&&JSON.stringify(e.map((e=>e.path+e.active)))===JSON.stringify(t.map((e=>e.path+e.active)))},exports.appendDraggableImage=function(e,t=100,r="communication:shield-thunder"){const n=document.createElement("div");if(n.style.position="fixed",n.style.left="-999px",n.style.top="-999px",n.style.zIndex=1e3,null!=e){const r=new Image;r.src=e,r.style=`width:${t}px;height:${t}px`,n.appendChild(r)}else{const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),t=document.createElementNS("http://www.w3.org/2000/svg","use");t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),e.appendChild(t),n.appendChild(e)}return document.body.appendChild(n),n},exports.flatDeep=function e(t){return t.reduce(((t,r)=>t.concat(Array.isArray(r)?e(r):r)),[])},exports.flatObject=function e(t,r=""){return Object.keys(t).reduce(((n,o)=>{const s=r.length?r+".":"";return Array.isArray(t[o])?n[s+o]=t[o]:"object"==typeof t[o]?Object.assign(n,e(t[o],s+o)):n[s+o]=t[o],n}),{})},exports.deepClone=function(e){return e?JSON.parse(JSON.stringify(e)):e},exports.uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},exports.deepEqual=function t(r,n,o=!1){if(Array.isArray(r)&&Array.isArray(n)&&o){if(r.length!==n.length)return!1;const e=new Set([...r,...n]);for(const t of e){if(r.filter((e=>e===t)).length!==n.filter((e=>e===t)).length)return!1}return!0}const s=null!=r?Object.keys(r):[],x=null!=n?Object.keys(n):[];if(s.length!==x.length)return!1;for(const o of s){const s=r[o],x=n[o],i=e(s)&&e(x);if(i&&!t(s,x)||!i&&s!==x)return!1}return!0},exports.isObject=e;
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
+ export function truncate(text, limit = 250, suffix = '...') {
17
+ return text && text.length > limit ? `${text.substring(0, limit)}${suffix}` : text;
18
+ }
19
+ export function isSameRoutes(routes, futureRoutes) {
20
+ if (routes && futureRoutes) {
21
+ return JSON.stringify(routes.map((r) => r.path + r.active)) === JSON.stringify(futureRoutes.map((r) => r.path + r.active));
22
+ }
23
+ return false;
24
+ }
25
+ export function appendDraggableImage(src, size = 100, defaultIcon = 'communication:shield-thunder') {
26
+ // Usefull when image src is svg
27
+ const div = document.createElement('div');
28
+ div.style.position = 'fixed';
29
+ div.style.left = '-999px';
30
+ div.style.top = '-999px';
31
+ div.style.zIndex = 1000;
32
+ if (src != null) {
33
+ const image = new Image();
34
+ image.src = src;
35
+ image.style = `width:${size}px;height:${size}px`;
36
+ div.appendChild(image);
37
+ }
38
+ else {
39
+ const svgElem = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
40
+ const useElem = document.createElementNS('http://www.w3.org/2000/svg', 'use');
41
+ useElem.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', defaultIcon);
42
+ svgElem.appendChild(useElem);
43
+ div.appendChild(svgElem);
44
+ }
45
+ document.body.appendChild(div);
46
+ return div;
47
+ }
48
+ export function flatDeep(arr) {
49
+ return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val) : val), []);
50
+ }
51
+ export function flatObject(obj, prefix = '') {
52
+ return Object.keys(obj).reduce((acc, k) => {
53
+ const pre = prefix.length ? prefix + '.' : '';
54
+ if (Array.isArray(obj[k]))
55
+ acc[pre + k] = obj[k];
56
+ else if (typeof obj[k] === 'object')
57
+ Object.assign(acc, flatObject(obj[k], pre + k));
58
+ else
59
+ acc[pre + k] = obj[k];
60
+ return acc;
61
+ }, {});
62
+ }
63
+ export function deepClone(obj) {
64
+ if (obj) {
65
+ return JSON.parse(JSON.stringify(obj));
66
+ }
67
+ return obj;
68
+ }
69
+ export function uuid() {
70
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
71
+ const r = (Math.random() * 16) | 0;
72
+ const v = c === 'x' ? r : (r & 0x3) | 0x8;
73
+ return v.toString(16);
74
+ });
75
+ }
76
+ export function deepEqual(a, b, withoutOrder = false) {
77
+ if (Array.isArray(a) && Array.isArray(b) && withoutOrder) {
78
+ if (a.length !== b.length)
79
+ return false;
80
+ const uniqueValues = new Set([...a, ...b]);
81
+ for (const v of uniqueValues) {
82
+ const aCount = a.filter((e) => e === v).length;
83
+ const bCount = b.filter((e) => e === v).length;
84
+ if (aCount !== bCount)
85
+ return false;
86
+ }
87
+ return true;
88
+ }
89
+ const keys1 = a != null ? Object.keys(a) : [];
90
+ const keys2 = b != null ? Object.keys(b) : [];
91
+ if (keys1.length !== keys2.length) {
92
+ return false;
93
+ }
94
+ for (const key of keys1) {
95
+ const val1 = a[key];
96
+ const val2 = b[key];
97
+ const areObjects = isObject(val1) && isObject(val2);
98
+ if ((areObjects && !deepEqual(val1, val2)) || (!areObjects && val1 !== val2)) {
99
+ return false;
100
+ }
101
+ }
102
+ return true;
103
+ }
104
+ export function isObject(object) {
105
+ return object != null && typeof object === 'object';
106
+ }
@@ -1 +1,153 @@
1
- var e=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChartElement=void 0;const t=require("lit"),i=require("../lib/i18n"),r=e(require("highcharts")),s=e(require("highcharts/highmaps")),n=require("lit/directives/cache"),a=require("./with-skeleton-attribute");exports.ChartElement=function(e){return class extends((0,a.withSkeletonAttribute)(e)){static get properties(){return{series:{type:Array},options:{type:Array},_additionalOptions:{type:Object,attribute:!1},_series:{type:Array,attribute:!1}}}static get styles(){return[...super.styles,t.css`:host{box-sizing:border-box;display:flex;height:100%;width:100%;flex-direction:column;justify-content:center;align-content:center}.container{flex:1}.tooltip{display:grid}.tooltip-2{grid-template-columns:repeat(2,1fr)}.tooltip-3{grid-template-columns:repeat(3,1fr)}.tooltip-4{grid-template-columns:repeat(4,1fr)}.tooltip-5{grid-template-columns:repeat(5,1fr)}`]}constructor(){super(),this._skeletonAttribute="series",this._eventListener=function(){for(let e=0;e<r.default.charts.length;e++)r.default.charts[e].reflow()}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._eventListener)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._eventListener)}async getOptions(){}updated(e){super.updated(e),e.has("_series")&&this.getOptions().then((e=>{this._additionalOptions=e}))}render(){if(this._error)return t.html`<div class="error">${(0,i.i18n)("gv-chart.error")}</div>`;if(this._empty)return t.html`<div class="empty">${(0,i.i18n)("gv-chart.empty")}</div>`;const e=document.createElement("div");if(e.id="container",e.className=this._skeleton||null==this._additionalOptions?"skeleton":"",e.classList.add("container"),this._additionalOptions){const t={chart:{height:"100%",width:"100%"},credits:{enabled:!1},title:{text:""},time:{useUTC:!1},...this._additionalOptions};this._series&&this._series.values&&this._series.values[0]&&this._series.values[0].data&&(t.series=this._series&&this._series.values),setTimeout((()=>{t.chart.map?s.default.mapChart(e,t):r.default.chart(e,t)}))}return t.html`${(0,n.cache)(e)}`}}};
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 { html, css } from 'lit';
17
+ import { i18n } from '../lib/i18n';
18
+ import Highcharts from 'highcharts';
19
+ import Highmaps from 'highcharts/highmaps';
20
+ import { cache } from 'lit/directives/cache';
21
+ import { withSkeletonAttribute } from './with-skeleton-attribute';
22
+ /**
23
+ * This is a mixin for ChartElement
24
+ * @mixinFunction
25
+ */
26
+ export function ChartElement(ParentClass) {
27
+ /**
28
+ * @mixinClass
29
+ */
30
+ return class extends withSkeletonAttribute(ParentClass) {
31
+ static get properties() {
32
+ return {
33
+ /** @required */
34
+ series: { type: Array },
35
+ options: { type: Array },
36
+ _additionalOptions: { type: Object, attribute: false },
37
+ _series: { type: Array, attribute: false },
38
+ };
39
+ }
40
+ static get styles() {
41
+ return [
42
+ ...super.styles,
43
+ // language=CSS
44
+ css `
45
+ :host {
46
+ box-sizing: border-box;
47
+ display: flex;
48
+ height: 100%;
49
+ width: 100%;
50
+ flex-direction: column;
51
+ justify-content: center;
52
+ align-content: center;
53
+ }
54
+
55
+ .container {
56
+ flex: 1;
57
+ }
58
+
59
+ .tooltip {
60
+ display: grid;
61
+ }
62
+
63
+ .tooltip-2 {
64
+ grid-template-columns: repeat(2, 1fr);
65
+ }
66
+
67
+ .tooltip-3 {
68
+ grid-template-columns: repeat(3, 1fr);
69
+ }
70
+
71
+ .tooltip-4 {
72
+ grid-template-columns: repeat(4, 1fr);
73
+ }
74
+
75
+ .tooltip-5 {
76
+ grid-template-columns: repeat(5, 1fr);
77
+ }
78
+ `,
79
+ ];
80
+ }
81
+ constructor() {
82
+ super();
83
+ this._skeletonAttribute = 'series';
84
+ this._eventListener = function eventListener() {
85
+ for (let i = 0; i < Highcharts.charts.length; i++) {
86
+ Highcharts.charts[i].reflow();
87
+ }
88
+ };
89
+ }
90
+ connectedCallback() {
91
+ super.connectedCallback();
92
+ window.addEventListener('resize', this._eventListener);
93
+ }
94
+ disconnectedCallback() {
95
+ super.disconnectedCallback();
96
+ window.removeEventListener('resize', this._eventListener);
97
+ }
98
+ async getOptions() { }
99
+ updated(changedProperties) {
100
+ super.updated(changedProperties);
101
+ if (changedProperties.has('_series')) {
102
+ this.getOptions().then((options) => {
103
+ this._additionalOptions = options;
104
+ });
105
+ }
106
+ }
107
+ render() {
108
+ if (this._error) {
109
+ return html ` <div class="error">${i18n('gv-chart.error')}</div>`;
110
+ }
111
+ if (this._empty) {
112
+ return html ` <div class="empty">${i18n('gv-chart.empty')}</div>`;
113
+ }
114
+ const container = document.createElement('div');
115
+ container.id = 'container';
116
+ container.className = this._skeleton || this._additionalOptions == null ? 'skeleton' : '';
117
+ container.classList.add('container');
118
+ if (this._additionalOptions) {
119
+ const options = {
120
+ ...{
121
+ chart: {
122
+ height: '100%',
123
+ width: '100%',
124
+ },
125
+ credits: {
126
+ enabled: false,
127
+ },
128
+ title: {
129
+ text: '',
130
+ },
131
+ time: {
132
+ useUTC: false,
133
+ },
134
+ },
135
+ ...this._additionalOptions,
136
+ };
137
+ const hasData = this._series && this._series.values && this._series.values[0] && this._series.values[0].data;
138
+ if (hasData) {
139
+ options.series = this._series && this._series.values;
140
+ }
141
+ setTimeout(() => {
142
+ if (options.chart.map) {
143
+ Highmaps.mapChart(container, options);
144
+ }
145
+ else {
146
+ Highcharts.chart(container, options);
147
+ }
148
+ });
149
+ }
150
+ return html `${cache(container)}`;
151
+ }
152
+ };
153
+ }
@@ -1 +1,136 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.InputElement=void 0;const t=require("lit");exports.InputElement=function(e){return class extends e{static get properties(){return{disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},skeleton:{type:Boolean},value:{type:String,reflect:!0},label:{type:String},title:{type:String},name:{type:String},placeholder:{type:String},description:{type:String},autofocus:{type:Boolean},invalid:{type:Boolean,reflect:!0},valid:{type:Boolean,reflect:!0}}}static get styles(){return[t.css`:host{box-sizing:border-box;margin:.2rem;display:block}:host([invalid]) :not(.clipboard) .box-icon-left,:host([invalid]) :not(.clipboard) .input,:host([invalid]) :not(.clipboard) ::slotted(.input),:host([invalid]) :not(.clipboard) input,:host([invalid]) :not(.clipboard) select,:host([invalid]) :not(.clipboard) textarea{box-shadow:inset 3px 0 0 var(--gv-input-invalid--bxshc,var(--gv-theme-color-error,#da1a1b))}:host([readonly]) .input,:host([readonly]) .textarea,:host([readonly]) :not(.clipboard) ::slotted(.input),:host([readonly]) :not(.clipboard) input,:host([readonly]) :not(.clipboard) select{border-left:1px solid var(--gv-input--bdc,var(--gv-theme-neutral-color-dark,#d9d9d9))}:host([readonly]) input::placeholder{color:transparent}`]}constructor(){super(),this._id=`gv-input-${(new Date).getTime()}`,this.valid=!0,this.invalid=!1}updateState(t){this.required&&!this.readonly?this.setValidity(null==t||0===t.length||"string"==typeof t&&""===t.trim(),"field is required"):this.setValidity()}setValidity(t=!1,e=""){const i=this.getInputElement();i&&i.setCustomValidity&&(t?(null!=e&&""!==e.trim()||(e="field is not valid"),i.setCustomValidity(e)):i.setCustomValidity(""),i.reportValidity()),this.invalid=t,this.valid=!this.invalid}firstUpdated(){if(this.autofocus){null!=this.getInputElement()&&this.getInputElement().focus()}this.updateState(this.value)}updated(t){t.has("value")&&this.updateState(this.value)}getInputElement(){return this.shadowRoot?this.shadowRoot.querySelector("input"):null}get offsetHeight(){if(null!=this.description){const t=this.shadowRoot.querySelector(".description");if(null!=t)return super.offsetHeight-t.offsetHeight}return super.offsetHeight}renderLabel(){return this.label?t.html`<label for="${this.id}" title="${this.label}">${this.label}</label>`:""}}};
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 { css, html } from 'lit';
17
+ export function InputElement(ParentClass) {
18
+ /**
19
+ * @mixinClass
20
+ */
21
+ return class extends ParentClass {
22
+ static get properties() {
23
+ return {
24
+ disabled: { type: Boolean, reflect: true },
25
+ required: { type: Boolean, reflect: true },
26
+ readonly: { type: Boolean, reflect: true },
27
+ skeleton: { type: Boolean },
28
+ value: { type: String, reflect: true },
29
+ label: { type: String },
30
+ title: { type: String },
31
+ name: { type: String },
32
+ placeholder: { type: String },
33
+ description: { type: String },
34
+ autofocus: { type: Boolean },
35
+ invalid: { type: Boolean, reflect: true },
36
+ valid: { type: Boolean, reflect: true },
37
+ };
38
+ }
39
+ static get styles() {
40
+ return [
41
+ // language=CSS
42
+ css `
43
+ :host {
44
+ box-sizing: border-box;
45
+ margin: 0.2rem;
46
+ display: block;
47
+ }
48
+
49
+ :host([invalid]) :not(.clipboard) input,
50
+ :host([invalid]) :not(.clipboard) ::slotted(.input),
51
+ :host([invalid]) :not(.clipboard) .box-icon-left,
52
+ :host([invalid]) :not(.clipboard) textarea,
53
+ :host([invalid]) :not(.clipboard) select,
54
+ :host([invalid]) :not(.clipboard) .input {
55
+ box-shadow: inset 3px 0 0 var(--gv-input-invalid--bxshc, var(--gv-theme-color-error, #da1a1b));
56
+ }
57
+
58
+ :host([readonly]) :not(.clipboard) input,
59
+ :host([readonly]) :not(.clipboard) ::slotted(.input),
60
+ :host([readonly]) .textarea,
61
+ :host([readonly]) :not(.clipboard) select,
62
+ :host([readonly]) .input {
63
+ border-left: 1px solid var(--gv-input--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9));
64
+ }
65
+
66
+ :host([readonly]) input::placeholder {
67
+ color: transparent;
68
+ }
69
+ `,
70
+ ];
71
+ }
72
+ constructor() {
73
+ super();
74
+ this._id = `gv-input-${new Date().getTime()}`;
75
+ this.valid = true;
76
+ this.invalid = false;
77
+ }
78
+ updateState(value) {
79
+ if (this.required && !this.readonly) {
80
+ this.setValidity(value == null || value.length === 0 || (typeof value === 'string' && value.trim() === ''), 'field is required');
81
+ }
82
+ else {
83
+ this.setValidity();
84
+ }
85
+ }
86
+ setValidity(isInvalid = false, violation = '') {
87
+ const element = this.getInputElement();
88
+ if (element && element.setCustomValidity) {
89
+ if (isInvalid) {
90
+ if (violation == null || violation.trim() === '') {
91
+ violation = 'field is not valid';
92
+ }
93
+ element.setCustomValidity(violation);
94
+ }
95
+ else {
96
+ element.setCustomValidity('');
97
+ }
98
+ element.reportValidity();
99
+ }
100
+ this.invalid = isInvalid;
101
+ this.valid = !this.invalid;
102
+ }
103
+ firstUpdated() {
104
+ if (this.autofocus) {
105
+ const input = this.getInputElement();
106
+ if (input != null) {
107
+ this.getInputElement().focus();
108
+ }
109
+ }
110
+ this.updateState(this.value);
111
+ }
112
+ updated(changedProperties) {
113
+ if (changedProperties.has('value')) {
114
+ this.updateState(this.value);
115
+ }
116
+ }
117
+ getInputElement() {
118
+ return this.shadowRoot ? this.shadowRoot.querySelector('input') : null;
119
+ }
120
+ get offsetHeight() {
121
+ if (this.description != null) {
122
+ const element = this.shadowRoot.querySelector('.description');
123
+ if (element != null) {
124
+ return super.offsetHeight - element.offsetHeight;
125
+ }
126
+ }
127
+ return super.offsetHeight;
128
+ }
129
+ renderLabel() {
130
+ if (this.label) {
131
+ return html `<label for=${this.id} title="${this.label}">${this.label}</label>`;
132
+ }
133
+ return '';
134
+ }
135
+ };
136
+ }
@@ -1 +1,102 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.ItemResource=void 0;const e=require("lit"),t=require("lit/directives/repeat");require("../molecules/gv-identity-picture");const i=require("../lib/item"),r=require("./with-skeleton-attribute");exports.ItemResource=function(s){return class extends((0,r.withSkeletonAttribute)(s)){static get properties(){return{...super.properties,item:{type:Object},href:{type:String},metrics:{type:Object},_item:{type:Object,attribute:!1}}}constructor(){super(),this._skeletonAttribute="item"}_onImageLoaded(){this._item&&(this._skeleton=!1)}_renderImage(){return this._item&&!this._empty?e.html`<gv-identity-picture .skeleton="${this._skeleton}" .display_name="${(0,i.getPictureDisplayName)(this._item)}" .picture="${(0,i.getPicture)(this._item)}" @load="${this._onImageLoaded}"></gv-identity-picture>`:""}_onTagClick(e,t){t.detail.tagValue=e}_renderLabels(r){const s=(0,i.getLabels)(this._item);return s?(0,t.repeat)(s,(e=>e),(t=>e.html`<gv-tag ?clickable="${r}" @gv-tag:click="${this._onTagClick.bind(this,t)}" ?skeleton="${this._skeleton}" major>${t}</gv-tag>`)):""}_renderStates(){const r=(0,i.getStates)(this._item);return r?(0,t.repeat)(r,(e=>e),(({value:t,major:i,minor:r})=>e.html`<gv-state ?skeleton="${this._skeleton}" ?major="${!0===i}" ?minor="${!0===r}">${t}</gv-state>`)):""}_onClickToMetrics(e){e.detail.item=this._item}_renderMetricsWithRating(){return this.metrics?e.html`<gv-metrics .metrics="${this.metrics}" @gv-metrics:click="${this._onClickToMetrics}">${this._renderInfoRating()}</gv-metrics>`:this._renderInfoRating()}_renderInfoRating(){const t=(0,i.getRating)(this._item);return t&&t.count?e.html`<gv-rating readonly="readonly" .skeleton="${this._skeleton}" .value="${t.average}" .count="${t.count}"></gv-rating>`:""}}};
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 { html } from 'lit';
17
+ import { repeat } from 'lit/directives/repeat';
18
+ import '../molecules/gv-identity-picture';
19
+ import { getLabels, getPicture, getStates, getRating, getPictureDisplayName } from '../lib/item';
20
+ import { withSkeletonAttribute } from './with-skeleton-attribute';
21
+ /**
22
+ * This is a mixin for ItemResource
23
+ * @mixinFunction
24
+ */
25
+ export function ItemResource(ParentClass) {
26
+ /**
27
+ * @mixinClass
28
+ */
29
+ return class extends withSkeletonAttribute(ParentClass) {
30
+ static get properties() {
31
+ return {
32
+ ...super.properties,
33
+ /** @required */
34
+ item: { type: Object },
35
+ href: { type: String },
36
+ metrics: { type: Object },
37
+ _item: { type: Object, attribute: false },
38
+ };
39
+ }
40
+ constructor() {
41
+ super();
42
+ this._skeletonAttribute = 'item';
43
+ }
44
+ _onImageLoaded() {
45
+ if (this._item) {
46
+ this._skeleton = false;
47
+ }
48
+ }
49
+ _renderImage() {
50
+ if (this._item && !this._empty) {
51
+ return html `<gv-identity-picture
52
+ .skeleton="${this._skeleton}"
53
+ .display_name="${getPictureDisplayName(this._item)}"
54
+ .picture="${getPicture(this._item)}"
55
+ @load="${this._onImageLoaded}"
56
+ ></gv-identity-picture>`;
57
+ }
58
+ return '';
59
+ }
60
+ _onTagClick(tagValue, event) {
61
+ event.detail.tagValue = tagValue;
62
+ }
63
+ _renderLabels(clickable) {
64
+ const labels = getLabels(this._item);
65
+ if (labels) {
66
+ return repeat(labels, (label) => label, (label) => html `<gv-tag ?clickable="${clickable}" @gv-tag:click="${this._onTagClick.bind(this, label)}" ?skeleton="${this._skeleton}" major
67
+ >${label}</gv-tag
68
+ >`);
69
+ }
70
+ return '';
71
+ }
72
+ _renderStates() {
73
+ const states = getStates(this._item);
74
+ if (states) {
75
+ return repeat(states, (state) => state, ({ value, major, minor }) => html `
76
+ <gv-state ?skeleton="${this._skeleton}" ?major="${major === true}" ?minor="${minor === true}">${value}</gv-state>
77
+ `);
78
+ }
79
+ return '';
80
+ }
81
+ _onClickToMetrics(event) {
82
+ event.detail.item = this._item;
83
+ }
84
+ _renderMetricsWithRating() {
85
+ if (this.metrics) {
86
+ return html `
87
+ <gv-metrics .metrics="${this.metrics}" @gv-metrics:click="${this._onClickToMetrics}"> ${this._renderInfoRating()} </gv-metrics>
88
+ `;
89
+ }
90
+ else {
91
+ return this._renderInfoRating();
92
+ }
93
+ }
94
+ _renderInfoRating() {
95
+ const rating = getRating(this._item);
96
+ if (rating && rating.count) {
97
+ return html `<gv-rating readonly .skeleton="${this._skeleton}" .value="${rating.average}" .count="${rating.count}"></gv-rating>`;
98
+ }
99
+ return '';
100
+ }
101
+ };
102
+ }