@genexus/genexus-ide-ui 1.1.61 → 1.1.63
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.
- package/dist/cjs/{common-f2540d3e.js → common-51d68918.js} +1 -31
- package/dist/cjs/common-51d68918.js.map +1 -0
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-edit-module-server.cjs.entry.js +111 -49
- package/dist/cjs/gx-ide-edit-module-server.cjs.entry.js.map +1 -1
- package/dist/cjs/gx-ide-empty-state.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-empty-state.cjs.entry.js.map +1 -1
- package/dist/cjs/gx-ide-manage-module-references.cjs.entry.js +358 -266
- package/dist/cjs/gx-ide-manage-module-references.cjs.entry.js.map +1 -1
- package/dist/cjs/gx-ide-new-environment.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-new-kb.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-progress-bar.cjs.entry.js +141 -0
- package/dist/cjs/gx-ide-progress-bar.cjs.entry.js.map +1 -0
- package/dist/cjs/gx-ide-splash.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-team-dev-preview.cjs.entry.js +2 -2
- package/dist/cjs/gx-ide-team-dev-preview.cjs.entry.js.map +1 -1
- package/dist/cjs/gx-ide-ww-images.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/common/common.js +0 -21
- package/dist/collection/common/common.js.map +1 -1
- package/dist/collection/components/_helpers/empty-state/gx-ide-empty-state.css +1 -1
- package/dist/collection/components/_helpers/progress-bar/gx-ide-assets/progress-bar/langs/progress-bar.lang.en.json +5 -0
- package/dist/collection/components/_helpers/progress-bar/gx-ide-assets/progress-bar/langs/progress-bar.lang.ja.json +5 -0
- package/dist/collection/components/_helpers/progress-bar/gx-ide-assets/progress-bar/langs/progress-bar.lang.zh.json +5 -0
- package/dist/collection/components/_helpers/progress-bar/progress-bar.css +210 -0
- package/dist/collection/components/_helpers/progress-bar/progress-bar.js +320 -0
- package/dist/collection/components/_helpers/progress-bar/progress-bar.js.map +1 -0
- package/dist/collection/components/modules/edit-module-server/edit-module-server.css +30 -639
- package/dist/collection/components/modules/edit-module-server/edit-module-server.js +179 -110
- package/dist/collection/components/modules/edit-module-server/edit-module-server.js.map +1 -1
- package/dist/collection/components/modules/edit-module-server/gx-ide-assets/edit-module-server/shortcuts.json +15 -0
- package/dist/collection/components/modules/edit-module-server/helpers.js +12 -0
- package/dist/collection/components/modules/edit-module-server/helpers.js.map +1 -0
- package/dist/collection/components/modules/manage-module-references/gx-ide-assets/manage-module-references/langs/manage-module-references.lang.en.json +6 -2
- package/dist/collection/components/modules/manage-module-references/gx-ide-assets/manage-module-references/langs/manage-module-references.lang.ja.json +6 -2
- package/dist/collection/components/modules/manage-module-references/gx-ide-assets/manage-module-references/langs/manage-module-references.lang.zh.json +6 -2
- package/dist/collection/components/modules/manage-module-references/helpers.js +32 -0
- package/dist/collection/components/modules/manage-module-references/helpers.js.map +1 -0
- package/dist/collection/components/modules/manage-module-references/manage-module-references.css +116 -789
- package/dist/collection/components/modules/manage-module-references/manage-module-references.js +378 -373
- package/dist/collection/components/modules/manage-module-references/manage-module-references.js.map +1 -1
- package/dist/collection/components/team-dev/preview/team-dev-preview.css +1 -1
- package/dist/collection/components/team-dev/preview/team-dev-preview.js +1 -1
- package/dist/collection/components/team-dev/preview/team-dev-preview.js.map +1 -1
- package/dist/collection/testing/locale.e2e.js +1 -0
- package/dist/collection/testing/locale.e2e.js.map +1 -1
- package/dist/components/common.js +1 -30
- package/dist/components/common.js.map +1 -1
- package/dist/components/gx-ide-edit-module-server.js +118 -68
- package/dist/components/gx-ide-edit-module-server.js.map +1 -1
- package/dist/components/gx-ide-empty-state2.js +1 -1
- package/dist/components/gx-ide-empty-state2.js.map +1 -1
- package/dist/components/gx-ide-manage-module-references.js +384 -291
- package/dist/components/gx-ide-manage-module-references.js.map +1 -1
- package/dist/components/gx-ide-progress-bar.d.ts +11 -0
- package/dist/components/gx-ide-progress-bar.js +8 -0
- package/dist/components/gx-ide-progress-bar.js.map +1 -0
- package/dist/components/gx-ide-team-dev-preview.js +2 -2
- package/dist/components/gx-ide-team-dev-preview.js.map +1 -1
- package/dist/components/gx-ide-ww-images.js +1 -1
- package/dist/components/progress-bar.js +166 -0
- package/dist/components/progress-bar.js.map +1 -0
- package/dist/esm/{common-b811a822.js → common-dc966e64.js} +2 -31
- package/dist/esm/common-dc966e64.js.map +1 -0
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-edit-module-server.entry.js +112 -50
- package/dist/esm/gx-ide-edit-module-server.entry.js.map +1 -1
- package/dist/esm/gx-ide-empty-state.entry.js +1 -1
- package/dist/esm/gx-ide-empty-state.entry.js.map +1 -1
- package/dist/esm/gx-ide-manage-module-references.entry.js +359 -267
- package/dist/esm/gx-ide-manage-module-references.entry.js.map +1 -1
- package/dist/esm/gx-ide-new-environment.entry.js +1 -1
- package/dist/esm/gx-ide-new-kb.entry.js +1 -1
- package/dist/esm/gx-ide-progress-bar.entry.js +137 -0
- package/dist/esm/gx-ide-progress-bar.entry.js.map +1 -0
- package/dist/esm/gx-ide-splash.entry.js +1 -1
- package/dist/esm/gx-ide-team-dev-preview.entry.js +2 -2
- package/dist/esm/gx-ide-team-dev-preview.entry.js.map +1 -1
- package/dist/esm/gx-ide-ww-images.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js.map +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/edit-module-server/shortcuts.json +15 -0
- package/dist/genexus-ide-ui/gx-ide-assets/manage-module-references/langs/manage-module-references.lang.en.json +6 -2
- package/dist/genexus-ide-ui/gx-ide-assets/manage-module-references/langs/manage-module-references.lang.ja.json +6 -2
- package/dist/genexus-ide-ui/gx-ide-assets/manage-module-references/langs/manage-module-references.lang.zh.json +6 -2
- package/dist/genexus-ide-ui/gx-ide-assets/progress-bar/langs/progress-bar.lang.en.json +5 -0
- package/dist/genexus-ide-ui/gx-ide-assets/progress-bar/langs/progress-bar.lang.ja.json +5 -0
- package/dist/genexus-ide-ui/gx-ide-assets/progress-bar/langs/progress-bar.lang.zh.json +5 -0
- package/dist/genexus-ide-ui/p-29ac6b13.entry.js +582 -0
- package/dist/genexus-ide-ui/p-29ac6b13.entry.js.map +1 -0
- package/dist/genexus-ide-ui/p-3a22af5d.entry.js +249 -0
- package/dist/genexus-ide-ui/p-3a22af5d.entry.js.map +1 -0
- package/dist/genexus-ide-ui/p-45d9dcbc.entry.js +166 -0
- package/dist/genexus-ide-ui/p-45d9dcbc.entry.js.map +1 -0
- package/dist/genexus-ide-ui/{p-84d39fc6.entry.js → p-5f7de718.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-84d39fc6.entry.js.map → p-5f7de718.entry.js.map} +1 -1
- package/dist/genexus-ide-ui/{p-f5734cc7.entry.js → p-630581df.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-d41d52f6.entry.js → p-70038e09.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-b5aadc8d.entry.js → p-8f2f8995.entry.js} +2 -2
- package/dist/genexus-ide-ui/{p-ae33da9a.entry.js → p-9606ebed.entry.js} +19 -19
- package/dist/genexus-ide-ui/{p-ef6a6401.entry.js → p-966f80c1.entry.js} +15 -14
- package/dist/genexus-ide-ui/p-966f80c1.entry.js.map +1 -0
- package/dist/genexus-ide-ui/p-97bbd54c.js +132 -0
- package/dist/genexus-ide-ui/p-97bbd54c.js.map +1 -0
- package/dist/types/common/common.d.ts +0 -2
- package/dist/types/components/_helpers/progress-bar/progress-bar.d.ts +61 -0
- package/dist/types/components/modules/edit-module-server/edit-module-server.d.ts +15 -30
- package/dist/types/components/modules/edit-module-server/helpers.d.ts +3 -0
- package/dist/types/components/modules/manage-module-references/helpers.d.ts +5 -0
- package/dist/types/components/modules/manage-module-references/manage-module-references.d.ts +43 -88
- package/dist/types/components.d.ts +109 -42
- package/package.json +1 -1
- package/dist/cjs/common-f2540d3e.js.map +0 -1
- package/dist/esm/common-b811a822.js.map +0 -1
- package/dist/genexus-ide-ui/p-67e3486a.entry.js +0 -498
- package/dist/genexus-ide-ui/p-67e3486a.entry.js.map +0 -1
- package/dist/genexus-ide-ui/p-714b37c0.js +0 -159
- package/dist/genexus-ide-ui/p-714b37c0.js.map +0 -1
- package/dist/genexus-ide-ui/p-e13998a5.entry.js +0 -141
- package/dist/genexus-ide-ui/p-e13998a5.entry.js.map +0 -1
- package/dist/genexus-ide-ui/p-ef6a6401.entry.js.map +0 -1
- /package/dist/genexus-ide-ui/{p-f5734cc7.entry.js.map → p-630581df.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-d41d52f6.entry.js.map → p-70038e09.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-b5aadc8d.entry.js.map → p-8f2f8995.entry.js.map} +0 -0
- /package/dist/genexus-ide-ui/{p-ae33da9a.entry.js.map → p-9606ebed.entry.js.map} +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--top-bar-progress: 0%;
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-rows: 0fr;
|
|
5
|
+
transition: var(--mer-timing--fast) grid-template-rows;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
--ds-icon-size-box--small: var(--mer-font__size--2xs);
|
|
8
|
+
--ds-icon-size--small: 100%;
|
|
9
|
+
}
|
|
10
|
+
:host > * {
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host(.disable-transition) {
|
|
15
|
+
--progress-bar-transition-speed: 0 !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host(.visible) {
|
|
19
|
+
grid-template-rows: 1fr;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.top-state-bar {
|
|
23
|
+
position: relative;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: var(--mer-spacing--sm);
|
|
27
|
+
border-radius: var(--mer-border__width--lg);
|
|
28
|
+
list-style: var(--mer-font__size--2xs);
|
|
29
|
+
display: flex;
|
|
30
|
+
/*states*/
|
|
31
|
+
}
|
|
32
|
+
.top-state-bar > * {
|
|
33
|
+
position: relative;
|
|
34
|
+
z-index: 1;
|
|
35
|
+
}
|
|
36
|
+
.top-state-bar__outer-wrapper {
|
|
37
|
+
position: relative;
|
|
38
|
+
flex: 1;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: var(--mer-spacing--sm);
|
|
42
|
+
padding: var(--mer-spacing--sm) var(--mer-spacing--sm);
|
|
43
|
+
}
|
|
44
|
+
.top-state-bar__outer-wrapper::after, .top-state-bar__outer-wrapper::before {
|
|
45
|
+
border-radius: var(--mer-border__width--lg);
|
|
46
|
+
}
|
|
47
|
+
.top-state-bar__outer-wrapper::before {
|
|
48
|
+
content: "";
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
left: 0;
|
|
52
|
+
top: 0;
|
|
53
|
+
position: absolute;
|
|
54
|
+
background-color: var(--mer-border-color__dim);
|
|
55
|
+
z-index: 0;
|
|
56
|
+
}
|
|
57
|
+
.top-state-bar__outer-wrapper::after {
|
|
58
|
+
content: "";
|
|
59
|
+
left: var(--mer-border__width--sm);
|
|
60
|
+
top: var(--mer-border__width--sm);
|
|
61
|
+
width: calc(100% - var(--mer-border__width--sm) * 2);
|
|
62
|
+
height: calc(100% - var(--mer-border__width--sm) * 2);
|
|
63
|
+
position: absolute;
|
|
64
|
+
background-color: var(--mer-surface);
|
|
65
|
+
z-index: 1;
|
|
66
|
+
}
|
|
67
|
+
.top-state-bar__inner-wrapper {
|
|
68
|
+
flex: 1;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
justify-content: space-between;
|
|
72
|
+
gap: var(--mer-spacing--xs);
|
|
73
|
+
position: relative;
|
|
74
|
+
z-index: 2;
|
|
75
|
+
}
|
|
76
|
+
.top-state-bar__caption {
|
|
77
|
+
color: var(--mer-text__on-surface);
|
|
78
|
+
font-size: var(--mer-font__size--2xs);
|
|
79
|
+
line-height: var(--mer-font__size--2xs);
|
|
80
|
+
font-weight: var(--mer-font__weight--regular);
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
font-style: italic;
|
|
84
|
+
}
|
|
85
|
+
.top-state-bar__progress-wrapper {
|
|
86
|
+
height: var(--mer-spacing--2xs);
|
|
87
|
+
background-color: var(--mer-surface__elevation--01);
|
|
88
|
+
position: relative;
|
|
89
|
+
z-index: 2;
|
|
90
|
+
}
|
|
91
|
+
.top-state-bar__close {
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
transition: var(--mer-timing--fast) background-color;
|
|
94
|
+
}
|
|
95
|
+
.top-state-bar__inner-wrapper, .top-state-bar__progress-wrapper, .top-state-bar__close {
|
|
96
|
+
opacity: 0;
|
|
97
|
+
transition: 150ms opacity;
|
|
98
|
+
}
|
|
99
|
+
.top-state-bar--accent .progress-bar {
|
|
100
|
+
background-color: var(--mer-accent__primary);
|
|
101
|
+
}
|
|
102
|
+
.top-state-bar--success .progress-bar {
|
|
103
|
+
background-color: var(--mer-color__message-green--100);
|
|
104
|
+
}
|
|
105
|
+
.top-state-bar--warning .progress-bar {
|
|
106
|
+
background-color: var(--mer-color__message-yellow--100);
|
|
107
|
+
}
|
|
108
|
+
.top-state-bar--error .progress-bar {
|
|
109
|
+
background-color: var(--mer-color__message-red--100);
|
|
110
|
+
}
|
|
111
|
+
.top-state-bar--in-progress .top-state-bar__outer-wrapper:before {
|
|
112
|
+
height: 0;
|
|
113
|
+
width: 120%;
|
|
114
|
+
padding-top: 60%;
|
|
115
|
+
padding-bottom: 60%;
|
|
116
|
+
background: linear-gradient(90deg, rgba(91, 167, 255, 0.4) 0%, rgba(63, 168, 155, 0.4) 100%);
|
|
117
|
+
top: 50%;
|
|
118
|
+
left: 50%;
|
|
119
|
+
transform: translate(-50%, -50%);
|
|
120
|
+
-webkit-animation: inProgressBackgroundColor 1s linear infinite;
|
|
121
|
+
animation: inProgressBackgroundColor 1s linear infinite;
|
|
122
|
+
}
|
|
123
|
+
.top-state-bar--in-progress .progress-bar {
|
|
124
|
+
position: relative;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
z-index: 1;
|
|
127
|
+
}
|
|
128
|
+
.top-state-bar--in-progress .progress-bar:after {
|
|
129
|
+
content: "";
|
|
130
|
+
position: absolute;
|
|
131
|
+
z-index: 0;
|
|
132
|
+
width: 300%;
|
|
133
|
+
height: 100%;
|
|
134
|
+
left: 0;
|
|
135
|
+
background: linear-gradient(90deg, #93f5eb 0%, #1aa3ff 33%, #93f5eb 66%, #1aa3ff 100%);
|
|
136
|
+
animation-name: inProgressBar;
|
|
137
|
+
animation-duration: 2s;
|
|
138
|
+
animation-iteration-count: infinite;
|
|
139
|
+
}
|
|
140
|
+
.top-state-bar--visible .top-state-bar__inner-wrapper,
|
|
141
|
+
.top-state-bar--visible .top-state-bar__progress-wrapper,
|
|
142
|
+
.top-state-bar--visible .top-state-bar__close {
|
|
143
|
+
opacity: 1;
|
|
144
|
+
}
|
|
145
|
+
.top-state-bar--visible .top-state-bar__close:hover {
|
|
146
|
+
opacity: 0.75;
|
|
147
|
+
}
|
|
148
|
+
.top-state-bar--visible .top-state-bar__close:active {
|
|
149
|
+
opacity: 0.5;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:host(.with-close-button) .top-state-bar__outer-wrapper {
|
|
153
|
+
padding-top: var(--mer-spacing--2xs);
|
|
154
|
+
gap: var(--mer-spacing--2xs);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/*in progress animation*/
|
|
158
|
+
@-webkit-keyframes inProgressBackgroundColor {
|
|
159
|
+
0% {
|
|
160
|
+
transform: translate(-50%, -50%) rotate(0);
|
|
161
|
+
}
|
|
162
|
+
100% {
|
|
163
|
+
transform: translate(-50%, -50%) rotate(1turn);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
@-webkit-keyframes inProgressBar {
|
|
167
|
+
0% {
|
|
168
|
+
left: 0%;
|
|
169
|
+
}
|
|
170
|
+
100% {
|
|
171
|
+
left: -200%;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
@-moz-keyframes inProgressBar {
|
|
175
|
+
0% {
|
|
176
|
+
left: 0%;
|
|
177
|
+
}
|
|
178
|
+
100% {
|
|
179
|
+
left: 200%;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
@keyframes inProgressBar {
|
|
183
|
+
0% {
|
|
184
|
+
left: 0%;
|
|
185
|
+
}
|
|
186
|
+
100% {
|
|
187
|
+
left: -200%;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
.progress-bar {
|
|
191
|
+
display: block;
|
|
192
|
+
transition: all var(--progress-bar-transition-speed);
|
|
193
|
+
width: var(--top-bar-progress);
|
|
194
|
+
border-radius: calc(var(--mer-spacing--2xs) / 2);
|
|
195
|
+
height: 100%;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
:host(.no-border) .top-state-bar__outer-wrapper:before,
|
|
199
|
+
:host(.border-block-start) .top-state-bar__outer-wrapper:before,
|
|
200
|
+
:host(.border-block-end) .top-state-bar__outer-wrapper:before {
|
|
201
|
+
display: none;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
:host(.border-block-start) .top-state-bar__outer-wrapper {
|
|
205
|
+
border-block-start: var(--mer-border__width--sm) solid var(--mer-border-color__on-elevation--01);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
:host(.border-block-end) .top-state-bar__outer-wrapper {
|
|
209
|
+
border-block-start: var(--mer-border__width--sm) solid var(--mer-border-color__on-elevation--01);
|
|
210
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { getIconPath } from "@genexus/mercury";
|
|
3
|
+
const CSS_BUNDLES = [
|
|
4
|
+
"resets/box-sizing",
|
|
5
|
+
"utils/form",
|
|
6
|
+
"utils/layout",
|
|
7
|
+
"utils/typography",
|
|
8
|
+
"components/button",
|
|
9
|
+
"components/icon",
|
|
10
|
+
"components/combo-box",
|
|
11
|
+
"components/edit",
|
|
12
|
+
"components/tabular-grid"
|
|
13
|
+
];
|
|
14
|
+
const CLOSE_ICON = getIconPath({
|
|
15
|
+
category: "system",
|
|
16
|
+
name: "close",
|
|
17
|
+
colorType: "primary"
|
|
18
|
+
});
|
|
19
|
+
const PROGRESS_TRANSITION_SPEED = 200;
|
|
20
|
+
export class GxIdeProgressBar {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.evaluateInitialProgress = () => {
|
|
23
|
+
if (this.progress === undefined &&
|
|
24
|
+
(this.stateType === "error" ||
|
|
25
|
+
this.stateType === "warning" ||
|
|
26
|
+
this.stateType === "success")) {
|
|
27
|
+
this.progress = 100;
|
|
28
|
+
}
|
|
29
|
+
else if (this.progress === undefined &&
|
|
30
|
+
this.stateType === "in-progress") {
|
|
31
|
+
this.progress = 0;
|
|
32
|
+
}
|
|
33
|
+
this.el.style.setProperty("--top-bar-progress", `${this.progress}%`);
|
|
34
|
+
};
|
|
35
|
+
this.closeClickHandler = () => {
|
|
36
|
+
this.active = false;
|
|
37
|
+
this.closedCallback();
|
|
38
|
+
};
|
|
39
|
+
this.renderClose = () => {
|
|
40
|
+
return (this.closeType === "button" && (h("button", { class: "button-tertiary button-icon-only", "aria-label": "close", onClick: this.closeClickHandler, role: "button", tabIndex: this.visible ? 0 : -1 }, h("ch-image", { src: CLOSE_ICON, class: "icon-md" }))));
|
|
41
|
+
};
|
|
42
|
+
this.topStateBarVisible = false;
|
|
43
|
+
this.disableTransition = false;
|
|
44
|
+
this.visible = false;
|
|
45
|
+
this.caption = undefined;
|
|
46
|
+
this.minimal = false;
|
|
47
|
+
this.active = false;
|
|
48
|
+
this.stateType = "in-progress";
|
|
49
|
+
this.progress = undefined;
|
|
50
|
+
this.closeType = "button";
|
|
51
|
+
this.closedCallback = () => { };
|
|
52
|
+
}
|
|
53
|
+
watchActiveHandler(active) {
|
|
54
|
+
if (active) {
|
|
55
|
+
this.visible = true;
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
this.topStateBarVisible = true;
|
|
58
|
+
}, 300);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.topStateBarVisible = false;
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
this.visible = false;
|
|
64
|
+
this.el.style.setProperty("--top-bar-progress", `0%`);
|
|
65
|
+
this.progressBarClosed.emit();
|
|
66
|
+
}, 300);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
watchProgressHandler(progress) {
|
|
70
|
+
if (progress >= 0 && progress <= 100) {
|
|
71
|
+
this.el.style.setProperty("--top-bar-progress", `${progress}%`);
|
|
72
|
+
}
|
|
73
|
+
if (progress === 100 && this.closeType === "auto-close") {
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
this.active = false;
|
|
76
|
+
}, 200);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
componentWillLoad() {
|
|
80
|
+
this.evaluateInitialProgress();
|
|
81
|
+
if (this.active) {
|
|
82
|
+
this.visible = true;
|
|
83
|
+
this.topStateBarVisible = true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Sets the progress bar to zero instantly (no transition) and changes the type
|
|
88
|
+
* to 'accent'. Useful when reusing the progress bar for a new process.
|
|
89
|
+
*/
|
|
90
|
+
async reset() {
|
|
91
|
+
// Resetting involves setting the progress to zero. In this case it is preferable
|
|
92
|
+
// to disable the transition.
|
|
93
|
+
this.disableTransition = true;
|
|
94
|
+
this.progress = 0;
|
|
95
|
+
this.stateType = "accent";
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
this.disableTransition = false; // enable transition for the nex process.
|
|
98
|
+
}, PROGRESS_TRANSITION_SPEED);
|
|
99
|
+
}
|
|
100
|
+
render() {
|
|
101
|
+
return (h(Host, { class: {
|
|
102
|
+
"visible": this.visible,
|
|
103
|
+
"with-close-button": this.closeType === "button",
|
|
104
|
+
"disable-transition": this.disableTransition
|
|
105
|
+
}, "aria-hidden": !this.active, style: {
|
|
106
|
+
"--progress-bar-transition-speed": `${PROGRESS_TRANSITION_SPEED}ms`
|
|
107
|
+
} }, h("ch-theme", { model: CSS_BUNDLES }), h("div", { role: "status", "aria-labelledby": "label", "aria-hidden": !this.active, class: {
|
|
108
|
+
"top-state-bar": true,
|
|
109
|
+
[`top-state-bar--${this.stateType}`]: true,
|
|
110
|
+
"top-state-bar--visible": this.topStateBarVisible
|
|
111
|
+
} }, h("div", { class: "top-state-bar__outer-wrapper" }, !this.minimal ? (h("div", { class: "top-state-bar__inner-wrapper" }, h("label", { id: "label", class: {
|
|
112
|
+
"top-state-bar__caption": true
|
|
113
|
+
}, part: "label" }, this.caption), this.renderClose())) : null, h("div", { class: {
|
|
114
|
+
"top-state-bar__progress-wrapper": true
|
|
115
|
+
}, part: "progress-wrapper" }, h("span", { class: "progress-bar" }))))));
|
|
116
|
+
}
|
|
117
|
+
static get is() { return "gx-ide-progress-bar"; }
|
|
118
|
+
static get encapsulation() { return "shadow"; }
|
|
119
|
+
static get originalStyleUrls() {
|
|
120
|
+
return {
|
|
121
|
+
"$": ["progress-bar.scss"]
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
static get styleUrls() {
|
|
125
|
+
return {
|
|
126
|
+
"$": ["progress-bar.css"]
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
static get assetsDirs() { return ["gx-ide-assets/progress-bar"]; }
|
|
130
|
+
static get properties() {
|
|
131
|
+
return {
|
|
132
|
+
"caption": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"mutable": false,
|
|
135
|
+
"complexType": {
|
|
136
|
+
"original": "string",
|
|
137
|
+
"resolved": "string",
|
|
138
|
+
"references": {}
|
|
139
|
+
},
|
|
140
|
+
"required": false,
|
|
141
|
+
"optional": false,
|
|
142
|
+
"docs": {
|
|
143
|
+
"tags": [],
|
|
144
|
+
"text": "The top-bar title"
|
|
145
|
+
},
|
|
146
|
+
"attribute": "caption",
|
|
147
|
+
"reflect": false
|
|
148
|
+
},
|
|
149
|
+
"minimal": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"mutable": false,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "boolean",
|
|
154
|
+
"resolved": "boolean",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": "It will only display the bar (no title, no close button)"
|
|
162
|
+
},
|
|
163
|
+
"attribute": "minimal",
|
|
164
|
+
"reflect": true,
|
|
165
|
+
"defaultValue": "false"
|
|
166
|
+
},
|
|
167
|
+
"active": {
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"mutable": true,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "boolean",
|
|
172
|
+
"resolved": "boolean",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": false,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": "The top-bar active state. If false it will be hidden"
|
|
180
|
+
},
|
|
181
|
+
"attribute": "active",
|
|
182
|
+
"reflect": false,
|
|
183
|
+
"defaultValue": "false"
|
|
184
|
+
},
|
|
185
|
+
"stateType": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"mutable": true,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "TopStateBarType",
|
|
190
|
+
"resolved": "\"accent\" | \"error\" | \"in-progress\" | \"success\" | \"warning\"",
|
|
191
|
+
"references": {
|
|
192
|
+
"TopStateBarType": {
|
|
193
|
+
"location": "local",
|
|
194
|
+
"path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/_helpers/progress-bar/progress-bar.tsx",
|
|
195
|
+
"id": "src/components/_helpers/progress-bar/progress-bar.tsx::TopStateBarType"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"required": false,
|
|
200
|
+
"optional": false,
|
|
201
|
+
"docs": {
|
|
202
|
+
"tags": [],
|
|
203
|
+
"text": "The top-bar state"
|
|
204
|
+
},
|
|
205
|
+
"attribute": "state-type",
|
|
206
|
+
"reflect": false,
|
|
207
|
+
"defaultValue": "\"in-progress\""
|
|
208
|
+
},
|
|
209
|
+
"progress": {
|
|
210
|
+
"type": "number",
|
|
211
|
+
"mutable": true,
|
|
212
|
+
"complexType": {
|
|
213
|
+
"original": "number",
|
|
214
|
+
"resolved": "number",
|
|
215
|
+
"references": {}
|
|
216
|
+
},
|
|
217
|
+
"required": false,
|
|
218
|
+
"optional": false,
|
|
219
|
+
"docs": {
|
|
220
|
+
"tags": [],
|
|
221
|
+
"text": "The progress bar progress"
|
|
222
|
+
},
|
|
223
|
+
"attribute": "progress",
|
|
224
|
+
"reflect": false,
|
|
225
|
+
"defaultValue": "undefined"
|
|
226
|
+
},
|
|
227
|
+
"closeType": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"mutable": false,
|
|
230
|
+
"complexType": {
|
|
231
|
+
"original": "\"auto-close\" | \"button\"",
|
|
232
|
+
"resolved": "\"auto-close\" | \"button\"",
|
|
233
|
+
"references": {}
|
|
234
|
+
},
|
|
235
|
+
"required": false,
|
|
236
|
+
"optional": false,
|
|
237
|
+
"docs": {
|
|
238
|
+
"tags": [],
|
|
239
|
+
"text": "How to display the close button"
|
|
240
|
+
},
|
|
241
|
+
"attribute": "close-type",
|
|
242
|
+
"reflect": false,
|
|
243
|
+
"defaultValue": "\"button\""
|
|
244
|
+
},
|
|
245
|
+
"closedCallback": {
|
|
246
|
+
"type": "unknown",
|
|
247
|
+
"mutable": false,
|
|
248
|
+
"complexType": {
|
|
249
|
+
"original": "() => void",
|
|
250
|
+
"resolved": "() => void",
|
|
251
|
+
"references": {}
|
|
252
|
+
},
|
|
253
|
+
"required": false,
|
|
254
|
+
"optional": false,
|
|
255
|
+
"docs": {
|
|
256
|
+
"tags": [],
|
|
257
|
+
"text": "A callback that gets called when the top-state-bar is closed"
|
|
258
|
+
},
|
|
259
|
+
"defaultValue": "() => {}"
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
static get states() {
|
|
264
|
+
return {
|
|
265
|
+
"topStateBarVisible": {},
|
|
266
|
+
"disableTransition": {},
|
|
267
|
+
"visible": {}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
static get events() {
|
|
271
|
+
return [{
|
|
272
|
+
"method": "progressBarClosed",
|
|
273
|
+
"name": "progressBarClosed",
|
|
274
|
+
"bubbles": true,
|
|
275
|
+
"cancelable": true,
|
|
276
|
+
"composed": true,
|
|
277
|
+
"docs": {
|
|
278
|
+
"tags": [],
|
|
279
|
+
"text": "Emitted every time the progress bar is closed."
|
|
280
|
+
},
|
|
281
|
+
"complexType": {
|
|
282
|
+
"original": "any",
|
|
283
|
+
"resolved": "any",
|
|
284
|
+
"references": {}
|
|
285
|
+
}
|
|
286
|
+
}];
|
|
287
|
+
}
|
|
288
|
+
static get methods() {
|
|
289
|
+
return {
|
|
290
|
+
"reset": {
|
|
291
|
+
"complexType": {
|
|
292
|
+
"signature": "() => Promise<void>",
|
|
293
|
+
"parameters": [],
|
|
294
|
+
"references": {
|
|
295
|
+
"Promise": {
|
|
296
|
+
"location": "global",
|
|
297
|
+
"id": "global::Promise"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"return": "Promise<void>"
|
|
301
|
+
},
|
|
302
|
+
"docs": {
|
|
303
|
+
"text": "Sets the progress bar to zero instantly (no transition) and changes the type\nto 'accent'. Useful when reusing the progress bar for a new process.",
|
|
304
|
+
"tags": []
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
static get elementRef() { return "el"; }
|
|
310
|
+
static get watchers() {
|
|
311
|
+
return [{
|
|
312
|
+
"propName": "active",
|
|
313
|
+
"methodName": "watchActiveHandler"
|
|
314
|
+
}, {
|
|
315
|
+
"propName": "progress",
|
|
316
|
+
"methodName": "watchProgressHandler"
|
|
317
|
+
}];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=progress-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-bar.js","sourceRoot":"","sources":["../../../../src/components/_helpers/progress-bar/progress-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,KAAK,EAEL,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAkB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,GAAmB;IAClC,mBAAmB;IACnB,YAAY;IACZ,cAAc;IACd,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,sBAAsB;IACtB,iBAAiB;IACjB,yBAAyB;CAC1B,CAAC;AAEF,MAAM,UAAU,GAAG,WAAW,CAAC;IAC7B,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;AACH,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAQtC,MAAM,OAAO,gBAAgB;;QA6GnB,4BAAuB,GAAG,GAAG,EAAE;YACrC,IACE,IAAI,CAAC,QAAQ,KAAK,SAAS;gBAC3B,CAAC,IAAI,CAAC,SAAS,KAAK,OAAO;oBACzB,IAAI,CAAC,SAAS,KAAK,SAAS;oBAC5B,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,EAC/B;gBACA,IA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ent":["import {\n Component,\n Host,\n h,\n Prop,\n State,\n Watch,\n Element,\n Event,\n EventEmitter,\n Method\n} from \"@stencil/core\";\nimport { MercuryBundles, getIconPath } from \"@genexus/mercury\";\n\nconst CSS_BUNDLES: MercuryBundles = [\n \"resets/box-sizing\",\n \"utils/form\",\n \"utils/layout\",\n \"utils/typography\",\n \"components/button\",\n \"components/icon\",\n \"components/combo-box\",\n \"components/edit\",\n \"components/tabular-grid\"\n];\n\nconst CLOSE_ICON = getIconPath({\n category: \"system\",\n name: \"close\",\n colorType: \"primary\"\n});\nconst PROGRESS_TRANSITION_SPEED = 200;\n\n@Component({\n tag: \"gx-ide-progress-bar\",\n styleUrl: \"progress-bar.scss\",\n shadow: true,\n assetsDirs: [\"gx-ide-assets/progress-bar\"]\n})\nexport class GxIdeProgressBar {\n @Element() el: HTMLGxIdeProgressBarElement;\n\n /**\n * If true it will display the caption\n */\n @State() topStateBarVisible: boolean = false;\n\n /**\n * If true the progress will be updated instantly, without transition. This is required when the host user is calling the \"reset\" method.\n */\n @State() disableTransition: boolean = false;\n\n /**\n * If true it will display bar\n */\n @State() visible: boolean = false;\n\n /**\n * The top-bar title\n */\n @Prop() readonly caption: string;\n\n /**\n * It will only display the bar (no title, no close button)\n */\n @Prop({ reflect: true }) readonly minimal: boolean = false;\n\n /**\n * The top-bar active state. If false it will be hidden\n */\n @Prop({ mutable: true }) active: boolean = false;\n @Watch(\"active\")\n watchActiveHandler(active: boolean) {\n if (active) {\n this.visible = true;\n setTimeout(() => {\n this.topStateBarVisible = true;\n }, 300);\n } else {\n this.topStateBarVisible = false;\n setTimeout(() => {\n this.visible = false;\n this.el.style.setProperty(\"--top-bar-progress\", `0%`);\n this.progressBarClosed.emit();\n }, 300);\n }\n }\n\n /**\n * The top-bar state\n */\n @Prop({ mutable: true }) stateType: TopStateBarType = \"in-progress\";\n\n /**\n * The progress bar progress\n */\n @Prop({ mutable: true }) progress: number = undefined;\n @Watch(\"progress\")\n watchProgressHandler(progress: number) {\n if (progress >= 0 && progress <= 100) {\n this.el.style.setProperty(\"--top-bar-progress\", `${progress}%`);\n }\n if (progress === 100 && this.closeType === \"auto-close\") {\n setTimeout(() => {\n this.active = false;\n }, 200);\n }\n }\n\n /**\n * How to display the close button\n */\n @Prop() readonly closeType: \"auto-close\" | \"button\" = \"button\";\n\n /**\n * A callback that gets called when the top-state-bar is closed\n */\n @Prop() readonly closedCallback: () => void = () => {};\n\n /**\n * Emitted every time the progress bar is closed.\n */\n @Event() progressBarClosed: EventEmitter;\n\n componentWillLoad() {\n this.evaluateInitialProgress();\n if (this.active) {\n this.visible = true;\n this.topStateBarVisible = true;\n }\n }\n\n /**\n * Sets the progress bar to zero instantly (no transition) and changes the type\n * to 'accent'. Useful when reusing the progress bar for a new process.\n */\n @Method()\n async reset() {\n // Resetting involves setting the progress to zero. In this case it is preferable\n // to disable the transition.\n this.disableTransition = true;\n this.progress = 0;\n this.stateType = \"accent\";\n setTimeout(() => {\n this.disableTransition = false; // enable transition for the nex process.\n }, PROGRESS_TRANSITION_SPEED);\n }\n\n private evaluateInitialProgress = () => {\n if (\n this.progress === undefined &&\n (this.stateType === \"error\" ||\n this.stateType === \"warning\" ||\n this.stateType === \"success\")\n ) {\n this.progress = 100;\n } else if (\n this.progress === undefined &&\n this.stateType === \"in-progress\"\n ) {\n this.progress = 0;\n }\n this.el.style.setProperty(\"--top-bar-progress\", `${this.progress}%`);\n };\n\n private closeClickHandler = () => {\n this.active = false;\n this.closedCallback();\n };\n\n private renderClose = () => {\n return (\n this.closeType === \"button\" && (\n <button\n class=\"button-tertiary button-icon-only\"\n aria-label=\"close\"\n onClick={this.closeClickHandler}\n role=\"button\"\n tabIndex={this.visible ? 0 : -1}\n >\n <ch-image src={CLOSE_ICON} class=\"icon-md\"></ch-image>\n </button>\n )\n );\n };\n\n render() {\n return (\n <Host\n class={{\n \"visible\": this.visible,\n \"with-close-button\": this.closeType === \"button\",\n \"disable-transition\": this.disableTransition\n }}\n aria-hidden={!this.active}\n style={{\n \"--progress-bar-transition-speed\": `${PROGRESS_TRANSITION_SPEED}ms`\n }}\n >\n <ch-theme model={CSS_BUNDLES}></ch-theme>\n <div\n role=\"status\"\n aria-labelledby=\"label\"\n aria-hidden={!this.active}\n class={{\n \"top-state-bar\": true,\n [`top-state-bar--${this.stateType}`]: true,\n \"top-state-bar--visible\": this.topStateBarVisible\n }}\n >\n <div class=\"top-state-bar__outer-wrapper\">\n {!this.minimal ? (\n <div class=\"top-state-bar__inner-wrapper\">\n <label\n id=\"label\"\n class={{\n \"top-state-bar__caption\": true\n }}\n part=\"label\"\n >\n {this.caption}\n </label>\n\n {this.renderClose()}\n </div>\n ) : null}\n <div\n class={{\n \"top-state-bar__progress-wrapper\": true\n }}\n part=\"progress-wrapper\"\n >\n <span class=\"progress-bar\"></span>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n\nexport type TopStateBarType =\n | \"accent\"\n | \"success\"\n | \"warning\"\n | \"error\"\n | \"in-progress\";\n"]}
|