@gravitee/ui-components 3.25.3-typescript-ad6021f → 3.25.3-typescript-bfd8f67

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 (188) hide show
  1. package/package.json +5 -8
  2. package/src/atoms/gv-autocomplete.js +1 -461
  3. package/src/atoms/gv-button.js +1 -410
  4. package/src/atoms/gv-checkbox.js +1 -187
  5. package/src/atoms/gv-date-picker-calendar.js +1 -894
  6. package/src/atoms/gv-date-picker-cell.js +1 -190
  7. package/src/atoms/gv-date-picker.js +1 -671
  8. package/src/atoms/gv-file-upload.js +1 -367
  9. package/src/atoms/gv-icon.js +1 -103
  10. package/src/atoms/gv-image.js +1 -144
  11. package/src/atoms/gv-input-message.js +1 -84
  12. package/src/atoms/gv-input.js +1 -561
  13. package/src/atoms/gv-link.js +1 -210
  14. package/src/atoms/gv-message.js +1 -128
  15. package/src/atoms/gv-metric.js +1 -117
  16. package/src/atoms/gv-relative-time.js +1 -156
  17. package/src/atoms/gv-select-native.js +1 -388
  18. package/src/atoms/gv-select.js +1 -437
  19. package/src/atoms/gv-spinner.js +1 -57
  20. package/src/atoms/gv-state.js +1 -130
  21. package/src/atoms/gv-switch.js +1 -243
  22. package/src/atoms/gv-tag.js +1 -168
  23. package/src/atoms/gv-text.js +1 -168
  24. package/src/charts/gv-chart-bar.js +1 -103
  25. package/src/charts/gv-chart-gauge.js +1 -100
  26. package/src/charts/gv-chart-histogram.js +1 -83
  27. package/src/charts/gv-chart-line.js +1 -224
  28. package/src/charts/gv-chart-map.js +1 -112
  29. package/src/charts/gv-chart-pie.js +1 -91
  30. package/src/index.js +1 -77
  31. package/src/lib/cron-expression.js +1 -205
  32. package/src/lib/date.js +1 -44
  33. package/src/lib/events.js +1 -26
  34. package/src/lib/http-client-schema-form.js +1 -67
  35. package/src/lib/http.js +1 -237
  36. package/src/lib/i18n.js +1 -103
  37. package/src/lib/item.js +1 -118
  38. package/src/lib/properties.js +1 -189
  39. package/src/lib/schema-form.js +1 -44
  40. package/src/lib/studio.js +1 -141
  41. package/src/lib/style.js +1 -41
  42. package/src/lib/text-format.js +1 -69
  43. package/src/lib/theme.js +1 -63
  44. package/src/lib/utils.js +1 -111
  45. package/src/mixins/chart-element.js +1 -165
  46. package/src/mixins/input-element.js +1 -144
  47. package/src/mixins/item-resource.js +1 -120
  48. package/src/mixins/keyboard-element.js +1 -69
  49. package/src/mixins/update-after-browser.js +1 -30
  50. package/src/mixins/with-resize-observer.js +1 -68
  51. package/src/mixins/with-skeleton-attribute.js +1 -112
  52. package/src/molecules/gv-card-full.js +1 -218
  53. package/src/molecules/gv-card-list.js +1 -113
  54. package/src/molecules/gv-card.js +1 -133
  55. package/src/molecules/gv-category-list.js +1 -60
  56. package/src/molecules/gv-category.js +1 -170
  57. package/src/molecules/gv-code.js +1 -359
  58. package/src/molecules/gv-confirm.js +1 -188
  59. package/src/molecules/gv-cron-editor.js +1 -710
  60. package/src/molecules/gv-dropdown-menu.js +1 -116
  61. package/src/molecules/gv-expandable.js +1 -122
  62. package/src/molecules/gv-expression-language.js +1 -270
  63. package/src/molecules/gv-identity-picture.js +1 -148
  64. package/src/molecules/gv-list.js +1 -227
  65. package/src/molecules/gv-metrics.js +1 -162
  66. package/src/molecules/gv-modal.js +1 -213
  67. package/src/molecules/gv-nav.js +1 -196
  68. package/src/molecules/gv-option.js +1 -242
  69. package/src/molecules/gv-plans.js +1 -429
  70. package/src/molecules/gv-popover.js +1 -351
  71. package/src/molecules/gv-promote.js +1 -209
  72. package/src/molecules/gv-rating-list.js +1 -365
  73. package/src/molecules/gv-rating.js +1 -253
  74. package/src/molecules/gv-row-expandable.js +1 -45
  75. package/src/molecules/gv-row.js +1 -210
  76. package/src/molecules/gv-stats.js +1 -121
  77. package/src/molecules/gv-stepper.js +1 -288
  78. package/src/molecules/gv-table.js +1 -685
  79. package/src/molecules/gv-tree.js +1 -250
  80. package/src/organisms/gv-documentation.js +1 -215
  81. package/src/organisms/gv-header.js +1 -288
  82. package/src/organisms/gv-http-client.js +1 -275
  83. package/src/organisms/gv-menu.js +1 -263
  84. package/src/organisms/gv-newsletter-subscription.js +1 -271
  85. package/src/organisms/gv-pagination.js +1 -198
  86. package/src/organisms/gv-properties.js +1 -920
  87. package/src/organisms/gv-resizable-views.js +1 -396
  88. package/src/organisms/gv-resources.js +1 -535
  89. package/src/organisms/gv-schema-form-array.js +1 -250
  90. package/src/organisms/gv-schema-form-control-object.js +1 -154
  91. package/src/organisms/gv-schema-form-control.js +1 -443
  92. package/src/organisms/gv-schema-form.js +1 -751
  93. package/src/organisms/gv-tabs.js +1 -210
  94. package/src/organisms/gv-user-menu.js +1 -314
  95. package/src/organisms/gv-vertical-menu.js +1 -123
  96. package/src/policy-studio/gv-flow-step.js +1 -464
  97. package/src/policy-studio/gv-flow.js +1 -621
  98. package/src/policy-studio/gv-policy-studio-menu.js +1 -750
  99. package/src/policy-studio/gv-policy-studio.js +1 -1842
  100. package/src/styles/empty.js +1 -36
  101. package/src/styles/input.js +1 -263
  102. package/src/styles/link.js +1 -32
  103. package/src/styles/shapes.js +1 -17
  104. package/src/styles/skeleton.js +1 -53
  105. package/src/styles/zoom.js +1 -40
  106. package/src/theme/gv-theme.js +1 -203
  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
  184. package/CHANGELOG.md +0 -1292
  185. package/LICENSE.txt +0 -202
  186. package/README.md +0 -195
  187. package/src/.eslintrc.js +0 -19
  188. package/src/theme/definition.json +0 -1762
@@ -1,464 +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 { withResizeObserver } from '../mixins/with-resize-observer';
18
- import { classMap } from 'lit/directives/class-map';
19
- import { dispatchCustomEvent } from '../lib/events';
20
- import '../atoms/gv-image';
21
- import '../molecules/gv-dropdown-menu';
22
- import '../atoms/gv-switch';
23
-
24
- /**
25
- * Flow area component
26
- *
27
- * @fires gv-flow-step:duplicate - Duplicate event from actions
28
- * @fires gv-flow-step:delete - Delete event from actions
29
- * @fires gv-flow-step:edit - Edit event
30
- * @fires gv-flow-step:copy - Copy event
31
- * @fires gv-flow-step:move - Move event
32
- *
33
- * @attr {Object<{name, icon, configuration:{description, ...}}>} step - the flow step, configuration contains form conf for gv-schema-form component
34
- * @attr {Boolean} editing - true, if edition in progress
35
- * @attr {Boolean} dragging - true, if dragging in progress
36
- * @attr {Boolean} hover - true, if area is hover
37
- * @attr {String} title - title of area, default is "content.configuration.description" if exist
38
- * @attr {Boolean} empty - true, if render empty state
39
- * @attr {Boolean} confirm - true, if render confirm state
40
- * @attr {Boolean} disabled - true for disabled
41
- * @attr {Boolean} readonly - true if readonly
42
- */
43
- export class GvFlowStep extends withResizeObserver(LitElement) {
44
- static get properties() {
45
- return {
46
- id: { type: String, reflect: true },
47
- group: { type: String, reflect: true },
48
- parent: { type: String, reflect: true },
49
- step: { type: Object },
50
- policy: { type: Object },
51
- editing: { type: Boolean, reflect: true },
52
- dragging: { type: Boolean, reflect: true },
53
- hover: { type: Boolean, reflect: true },
54
- title: { type: String, reflect: true },
55
- empty: { type: Boolean, reflect: true },
56
- confirm: { type: Boolean, reflect: true },
57
- disabled: { type: Boolean, reflect: true },
58
- readonly: { type: Boolean, reflect: true },
59
- _small: { type: Boolean, attribute: false },
60
- _confirmDelete: { type: Boolean, reflect: true },
61
- _confirmDuplicate: { type: Boolean, reflect: true },
62
- };
63
- }
64
-
65
- constructor() {
66
- super();
67
- this.empty = true;
68
- this.breakpoints = {
69
- width: [100, 200],
70
- };
71
- }
72
-
73
- onResize({ width }) {
74
- this._small = width <= 200;
75
- }
76
-
77
- _onDuplicate() {
78
- this._confirmDuplicate = true;
79
- }
80
-
81
- _onConfirmDuplicate() {
82
- this._confirmDuplicate = false;
83
- dispatchCustomEvent(this, 'duplicate', { step: this.step, policy: this.policy, target: this });
84
- }
85
-
86
- _onCancelDuplicate() {
87
- this._confirmDuplicate = false;
88
- }
89
-
90
- _onClick(e) {
91
- if (!e.target.classList.contains('action') && !this.editing) {
92
- e.preventDefault();
93
- this._edit();
94
- }
95
- }
96
-
97
- _edit() {
98
- if (this.policy && !this.disabled) {
99
- dispatchCustomEvent(this, 'edit', { step: this.step, policy: this.policy, group: this.group });
100
- }
101
- }
102
-
103
- _onMouseEnter() {
104
- if (!this.disabled) {
105
- this.hover = true;
106
- if (!this.readonly) {
107
- const dropdownMenu = this.shadowRoot.querySelector('gv-dropdown-menu');
108
- dropdownMenu.setAttribute('open', true);
109
- }
110
- }
111
- }
112
-
113
- _onMouseLeave() {
114
- if (!this.disabled) {
115
- this.hover = false;
116
- if (!this.readonly) {
117
- const dropdownMenu = this.shadowRoot.querySelector('gv-dropdown-menu');
118
- dropdownMenu.removeAttribute('open');
119
- }
120
- }
121
- }
122
-
123
- _onDelete() {
124
- this._confirmDelete = true;
125
- }
126
-
127
- _onConfirmDelete() {
128
- this._confirmDelete = false;
129
- dispatchCustomEvent(this, 'delete', { step: this.step });
130
- }
131
-
132
- _onCancelDelete() {
133
- this._confirmDelete = false;
134
- }
135
-
136
- updated(properties) {
137
- if (properties.has('dragging') && this.dragging === true) {
138
- const dropdownMenu = this.shadowRoot.querySelector('gv-dropdown-menu');
139
- dropdownMenu.removeAttribute('open');
140
- }
141
- if (properties.has('step') && this.step != null) {
142
- this.empty = false;
143
- }
144
- }
145
-
146
- _onCancel() {
147
- this.remove();
148
- }
149
-
150
- _onCopy() {
151
- dispatchCustomEvent(this, 'copy');
152
- }
153
-
154
- _onMove() {
155
- dispatchCustomEvent(this, 'move');
156
- }
157
-
158
- _onChangeState({ detail }) {
159
- dispatchCustomEvent(this, 'change-state', { step: this.step, enabled: detail });
160
- }
161
-
162
- _renderDropdownMenu() {
163
- if (this.disabled || this.readonly) {
164
- return html``;
165
- }
166
- const enabled = this.step.enabled !== false;
167
- return html`<gv-dropdown-menu right>
168
- <gv-switch
169
- slot="action"
170
- class="action"
171
- small
172
- label="${enabled ? 'Enabled' : 'Disabled'}"
173
- title="${enabled ? 'Disable policy ?' : 'Enable policy ?'}"
174
- @gv-switch:input="${this._onChangeState}"
175
- .value="${enabled}"
176
- ></gv-switch>
177
- <gv-button slot="action" class="action" link small icon="general:duplicate" @gv-button:click="${this._onDuplicate}"
178
- >Duplicate</gv-button
179
- >
180
- <gv-button slot="action" class="action" link small icon="home:trash" @gv-button:click="${this._onDelete}">Delete</gv-button>
181
- </gv-dropdown-menu>`;
182
- }
183
-
184
- resetConfirm() {
185
- this.confirm = false;
186
- this._confirmDelete = false;
187
- this._confirmDuplicate = false;
188
- }
189
-
190
- render() {
191
- if (this.confirm) {
192
- return html`<div class="drop-area drop-area-confirm">
193
- <gv-button small @gv-button:click="${this._onCopy}">Copy</gv-button>
194
- <gv-button small @gv-button:click="${this._onMove}">Move</gv-button>
195
- <gv-button link small @gv-button:click="${this._onCancel}">Cancel</gv-button>
196
- </div>`;
197
- } else if (this._confirmDelete) {
198
- return html`<div class="drop-area drop-area-confirm">
199
- <gv-button small danger @gv-button:click="${this._onConfirmDelete}">Delete</gv-button>
200
- <gv-button link small @gv-button:click="${this._onCancelDelete}">Cancel</gv-button>
201
- </div>`;
202
- } else if (this._confirmDuplicate) {
203
- return html`<div class="drop-area drop-area-confirm">
204
- <gv-button small @gv-button:click="${this._onConfirmDuplicate}">Duplicate</gv-button>
205
- <gv-button link small @gv-button:click="${this._onCancelDuplicate}">Cancel</gv-button>
206
- </div>`;
207
- } else if (!this.empty) {
208
- const name = this.step ? this.step.name : '';
209
- const description = this.step && this.step.description ? this.step.description : '';
210
- const hasConditionalSteps = this.step && !!this.step.condition;
211
- const icon = this.step ? this.policy && this.policy.icon : null;
212
- const enabled = this.step && this.step.enabled !== false;
213
- const notFound = this.policy == null;
214
- if (notFound) {
215
- this.title = 'Warning: policy not found in plugins folder';
216
- } else {
217
- this.title = description;
218
- }
219
- const classes = {
220
- 'drop-area': true,
221
- 'is-assigned': name !== '',
222
- 'has-icon': icon != null,
223
- disabled: !enabled,
224
- 'not-found': notFound,
225
- };
226
- return html`<div
227
- class="${classMap(classes)}"
228
- @click="${this._onClick}"
229
- @mouseenter="${this._onMouseEnter}"
230
- @mouseleave="${this._onMouseLeave}"
231
- >
232
- ${this._renderDropdownMenu()}
233
- <div class="content">
234
- <div class="content-icon">
235
- ${hasConditionalSteps ? html`<gv-icon class="content-icon-conditional" shape="design:conditional"></gv-icon>` : html``}
236
- ${icon ? html`<gv-image src="${icon}"></gv-image>` : html``}
237
- </div>
238
-
239
- ${icon == null && notFound ? html`<gv-icon class="not-found__icon" shape="finance:folder-error"></gv-icon>` : ''}
240
- <div>
241
- <div class="name">${name}</div>
242
- <div class="description">${description}</div>
243
- </div>
244
- </div>
245
- </div> `;
246
- } else {
247
- return html`<div class="drop-area"></div>`;
248
- }
249
- }
250
-
251
- static get styles() {
252
- return [
253
- // language=CSS
254
- css`
255
- :host {
256
- box-sizing: border-box;
257
- margin: 0.2rem;
258
- display: block;
259
- }
260
-
261
- :host(:active) {
262
- outline: none;
263
- }
264
-
265
- :host([dragging]) {
266
- opacity: 0.5;
267
- }
268
-
269
- gv-dropdown-menu {
270
- position: absolute;
271
- right: 0;
272
- display: flex;
273
- flex-wrap: wrap;
274
- justify-content: right;
275
- top: -1px;
276
- bottom: -1px;
277
- z-index: 10;
278
- --gv-dropdown-menu--bdw: 0 0 0 1px;
279
- --gv-dropdown-menu--p: 0.1rem 0.3rem;
280
- --gv-dropdown-menu--gg: 0;
281
- }
282
-
283
- gv-switch {
284
- margin: 0.2rem 0;
285
- }
286
-
287
- :host([hover]) .drop-area {
288
- transform: translateY(-4px);
289
- box-shadow: 0 0 0 1px #5a7684, 0 1px 3px #5a7684;
290
- border-color: transparent;
291
- }
292
-
293
- :host([dragging]) .drop-area {
294
- transform: translateY(-4px);
295
- }
296
-
297
- :host([editing]) .drop-area {
298
- border-color: #5a7684;
299
- transform: translateY(-4px);
300
- box-shadow: 0 0 0 1px #5a7684, 0 1px 3px #5a7684;
301
- transition: all 0.2s;
302
- }
303
-
304
- :host([w-lt-200]) gv-image {
305
- position: absolute;
306
- opacity: 0.1;
307
- width: 100%;
308
- }
309
-
310
- :host([w-lt-200]) .drop-area:hover gv-image {
311
- opacity: 1;
312
- }
313
-
314
- :host([w-lt-200]) .content-icon {
315
- position: absolute;
316
- width: 100%;
317
- height: 100%;
318
- }
319
-
320
- :host([w-lt-100]) .description {
321
- display: none;
322
- }
323
-
324
- :host([empty]) .drop-area {
325
- position: relative;
326
- background-color: transparent;
327
- border: 2px dashed #bfbfbf;
328
- font-size: 14px;
329
- }
330
-
331
- .description {
332
- line-height: 14px;
333
- font-size: 12px;
334
- max-height: 42px;
335
- overflow: hidden;
336
- }
337
-
338
- .drop-area {
339
- position: relative;
340
- border: 2px dashed #bfbfbf;
341
- border-radius: 4px;
342
- height: 80px;
343
- min-width: 80px;
344
- margin: 4px;
345
- padding: 4px;
346
- word-break: break-word;
347
- display: flex;
348
- align-items: center;
349
- text-align: center;
350
- justify-content: center;
351
- flex-direction: column;
352
- --gv-button--fz: 11px;
353
- flex: 1;
354
- transition: color 150ms ease-in-out, transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out, border 0.3s ease-in-out;
355
- background-color: white;
356
- }
357
-
358
- .drop-area.disabled {
359
- /*opacity: 0.7;*/
360
- /*background-color: #BFBFBF; !* fallback color if gradients are not supported *!*/
361
- /*border-color: white;*/
362
- text-decoration: line-through;
363
- font-style: italic;
364
- }
365
-
366
- .drop-area.not-found {
367
- border-color: var(--gv-theme-color-warning-light, #ffb74d);
368
- }
369
-
370
- .drop-area.has-icon {
371
- padding-left: 0;
372
- text-align: left;
373
- }
374
-
375
- .drop-area.has-icon .content {
376
- justify-content: left;
377
- }
378
-
379
- .drop-area.is-assigned {
380
- border-style: solid;
381
- }
382
-
383
- :host([hover]) .drop-area.is-assigned:not(.not-found) {
384
- cursor: grab;
385
- }
386
-
387
- :host([hover]) .drop-area.is-assigned:not(.not-found):active {
388
- cursor: grabbing;
389
- }
390
-
391
- :host([readonly]) .drop-area.is-assigned:not(.not-found),
392
- :host([readonly]) .drop-area.is-assigned:not(.not-found):active {
393
- cursor: pointer;
394
- }
395
-
396
- .content {
397
- display: flex;
398
- align-items: center;
399
- justify-content: center;
400
- text-align: center;
401
- width: 100%;
402
- }
403
-
404
- .content > div,
405
- .content > mark {
406
- width: 100%;
407
- }
408
-
409
- .content-icon {
410
- flex: 0 1 0%;
411
- display: flex;
412
- margin: 0.2rem;
413
- }
414
- .content-icon-conditional {
415
- position: absolute;
416
- z-index: 10;
417
- margin: 0.2rem;
418
- }
419
-
420
- gv-image {
421
- height: 80px;
422
- width: 80px;
423
- }
424
-
425
- .not-found__icon {
426
- --gv-icon--c: var(--gv-theme-color-warning-light, #ffb74d);
427
- height: 60px;
428
- width: 60px;
429
- margin: 0.2rem;
430
- justify-content: center;
431
- align-items: center;
432
- }
433
-
434
- .drop-area-confirm {
435
- flex-direction: row;
436
- align-items: center;
437
- justify-content: center;
438
- background-color: white;
439
- }
440
- `,
441
- ];
442
- }
443
- }
444
-
445
- export class PolicyDraggable {
446
- static parse(str) {
447
- const data = JSON.parse(str);
448
- return new PolicyDraggable(data.policy, data.sourcePosition, data.sourceFlowKey, data.sourceFlowId, data.flowStep);
449
- }
450
-
451
- constructor(policy, sourcePosition, sourceFlowKey, sourceFlowId, flowStep) {
452
- this.policy = policy;
453
- this.sourcePosition = sourcePosition;
454
- this.sourceFlowKey = sourceFlowKey;
455
- this.sourceFlowId = sourceFlowId;
456
- this.flowStep = flowStep;
457
- }
458
-
459
- toString() {
460
- return JSON.stringify(this);
461
- }
462
- }
463
-
464
- window.customElements.define('gv-flow-step', GvFlowStep);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.PolicyDraggable=exports.GvFlowStep=void 0;const t=require("lit"),e=require("../mixins/with-resize-observer"),o=require("lit/directives/class-map"),i=require("../lib/events");require("../atoms/gv-image"),require("../molecules/gv-dropdown-menu"),require("../atoms/gv-switch");class n extends((0,e.withResizeObserver)(t.LitElement)){static get properties(){return{id:{type:String,reflect:!0},group:{type:String,reflect:!0},parent:{type:String,reflect:!0},step:{type:Object},policy:{type:Object},editing:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0},hover:{type:Boolean,reflect:!0},title:{type:String,reflect:!0},empty:{type:Boolean,reflect:!0},confirm:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},_small:{type:Boolean,attribute:!1},_confirmDelete:{type:Boolean,reflect:!0},_confirmDuplicate:{type:Boolean,reflect:!0}}}constructor(){super(),this.empty=!0,this.breakpoints={width:[100,200]}}onResize({width:t}){this._small=t<=200}_onDuplicate(){this._confirmDuplicate=!0}_onConfirmDuplicate(){this._confirmDuplicate=!1,(0,i.dispatchCustomEvent)(this,"duplicate",{step:this.step,policy:this.policy,target:this})}_onCancelDuplicate(){this._confirmDuplicate=!1}_onClick(t){t.target.classList.contains("action")||this.editing||(t.preventDefault(),this._edit())}_edit(){this.policy&&!this.disabled&&(0,i.dispatchCustomEvent)(this,"edit",{step:this.step,policy:this.policy,group:this.group})}_onMouseEnter(){if(!this.disabled&&(this.hover=!0,!this.readonly)){this.shadowRoot.querySelector("gv-dropdown-menu").setAttribute("open",!0)}}_onMouseLeave(){if(!this.disabled&&(this.hover=!1,!this.readonly)){this.shadowRoot.querySelector("gv-dropdown-menu").removeAttribute("open")}}_onDelete(){this._confirmDelete=!0}_onConfirmDelete(){this._confirmDelete=!1,(0,i.dispatchCustomEvent)(this,"delete",{step:this.step})}_onCancelDelete(){this._confirmDelete=!1}updated(t){if(t.has("dragging")&&!0===this.dragging){this.shadowRoot.querySelector("gv-dropdown-menu").removeAttribute("open")}t.has("step")&&null!=this.step&&(this.empty=!1)}_onCancel(){this.remove()}_onCopy(){(0,i.dispatchCustomEvent)(this,"copy")}_onMove(){(0,i.dispatchCustomEvent)(this,"move")}_onChangeState({detail:t}){(0,i.dispatchCustomEvent)(this,"change-state",{step:this.step,enabled:t})}_renderDropdownMenu(){if(this.disabled||this.readonly)return t.html``;const e=!1!==this.step.enabled;return t.html`<gv-dropdown-menu right><gv-switch slot="action" class="action" small label="${e?"Enabled":"Disabled"}" title="${e?"Disable policy ?":"Enable policy ?"}" @gv-switch:input="${this._onChangeState}" .value="${e}"></gv-switch><gv-button slot="action" class="action" link small icon="general:duplicate" @gv-button:click="${this._onDuplicate}">Duplicate</gv-button><gv-button slot="action" class="action" link small icon="home:trash" @gv-button:click="${this._onDelete}">Delete</gv-button></gv-dropdown-menu>`}resetConfirm(){this.confirm=!1,this._confirmDelete=!1,this._confirmDuplicate=!1}render(){if(this.confirm)return t.html`<div class="drop-area drop-area-confirm"><gv-button small @gv-button:click="${this._onCopy}">Copy</gv-button><gv-button small @gv-button:click="${this._onMove}">Move</gv-button><gv-button link small @gv-button:click="${this._onCancel}">Cancel</gv-button></div>`;if(this._confirmDelete)return t.html`<div class="drop-area drop-area-confirm"><gv-button small danger @gv-button:click="${this._onConfirmDelete}">Delete</gv-button><gv-button link small @gv-button:click="${this._onCancelDelete}">Cancel</gv-button></div>`;if(this._confirmDuplicate)return t.html`<div class="drop-area drop-area-confirm"><gv-button small @gv-button:click="${this._onConfirmDuplicate}">Duplicate</gv-button><gv-button link small @gv-button:click="${this._onCancelDuplicate}">Cancel</gv-button></div>`;if(this.empty)return t.html`<div class="drop-area"></div>`;{const e=this.step?this.step.name:"",i=this.step&&this.step.description?this.step.description:"",n=this.step&&!!this.step.condition,s=this.step?this.policy&&this.policy.icon:null,r=this.step&&!1!==this.step.enabled,a=null==this.policy;this.title=a?"Warning: policy not found in plugins folder":i;const l={"drop-area":!0,"is-assigned":""!==e,"has-icon":null!=s,disabled:!r,"not-found":a};return t.html`<div class="${(0,o.classMap)(l)}" @click="${this._onClick}" @mouseenter="${this._onMouseEnter}" @mouseleave="${this._onMouseLeave}">${this._renderDropdownMenu()}<div class="content"><div class="content-icon">${n?t.html`<gv-icon class="content-icon-conditional" shape="design:conditional"></gv-icon>`:t.html``} ${s?t.html`<gv-image src="${s}"></gv-image>`:t.html``}</div>${null==s&&a?t.html`<gv-icon class="not-found__icon" shape="finance:folder-error"></gv-icon>`:""}<div><div class="name">${e}</div><div class="description">${i}</div></div></div></div>`}}static get styles(){return[t.css`:host{box-sizing:border-box;margin:.2rem;display:block}:host(:active){outline:0}:host([dragging]){opacity:.5}gv-dropdown-menu{position:absolute;right:0;display:flex;flex-wrap:wrap;justify-content:right;top:-1px;bottom:-1px;z-index:10;--gv-dropdown-menu--bdw:0 0 0 1px;--gv-dropdown-menu--p:0.1rem 0.3rem;--gv-dropdown-menu--gg:0}gv-switch{margin:.2rem 0}:host([hover]) .drop-area{transform:translateY(-4px);box-shadow:0 0 0 1px #5a7684,0 1px 3px #5a7684;border-color:transparent}:host([dragging]) .drop-area{transform:translateY(-4px)}:host([editing]) .drop-area{border-color:#5a7684;transform:translateY(-4px);box-shadow:0 0 0 1px #5a7684,0 1px 3px #5a7684;transition:all .2s}:host([w-lt-200]) gv-image{position:absolute;opacity:.1;width:100%}:host([w-lt-200]) .drop-area:hover gv-image{opacity:1}:host([w-lt-200]) .content-icon{position:absolute;width:100%;height:100%}:host([w-lt-100]) .description{display:none}:host([empty]) .drop-area{position:relative;background-color:transparent;border:2px dashed #bfbfbf;font-size:14px}.description{line-height:14px;font-size:12px;max-height:42px;overflow:hidden}.drop-area{position:relative;border:2px dashed #bfbfbf;border-radius:4px;height:80px;min-width:80px;margin:4px;padding:4px;word-break:break-word;display:flex;align-items:center;text-align:center;justify-content:center;flex-direction:column;--gv-button--fz:11px;flex:1;transition:color 150ms ease-in-out,transform .3s ease-in-out,box-shadow .3s ease-in-out,border .3s ease-in-out;background-color:#fff}.drop-area.disabled{text-decoration:line-through;font-style:italic}.drop-area.not-found{border-color:var(--gv-theme-color-warning-light,#ffb74d)}.drop-area.has-icon{padding-left:0;text-align:left}.drop-area.has-icon .content{justify-content:left}.drop-area.is-assigned{border-style:solid}:host([hover]) .drop-area.is-assigned:not(.not-found){cursor:grab}:host([hover]) .drop-area.is-assigned:not(.not-found):active{cursor:grabbing}:host([readonly]) .drop-area.is-assigned:not(.not-found),:host([readonly]) .drop-area.is-assigned:not(.not-found):active{cursor:pointer}.content{display:flex;align-items:center;justify-content:center;text-align:center;width:100%}.content>div,.content>mark{width:100%}.content-icon{flex:0 1 0%;display:flex;margin:.2rem}.content-icon-conditional{position:absolute;z-index:10;margin:.2rem}gv-image{height:80px;width:80px}.not-found__icon{--gv-icon--c:var(--gv-theme-color-warning-light, #ffb74d);height:60px;width:60px;margin:.2rem;justify-content:center;align-items:center}.drop-area-confirm{flex-direction:row;align-items:center;justify-content:center;background-color:#fff}`]}}exports.GvFlowStep=n;class s{static parse(t){const e=JSON.parse(t);return new s(e.policy,e.sourcePosition,e.sourceFlowKey,e.sourceFlowId,e.flowStep)}constructor(t,e,o,i,n){this.policy=t,this.sourcePosition=e,this.sourceFlowKey=o,this.sourceFlowId=i,this.flowStep=n}toString(){return JSON.stringify(this)}}exports.PolicyDraggable=s,window.customElements.define("gv-flow-step",n);