@gravitee/ui-components 3.25.3-typescript-8a53edf → 3.25.3-typescript-9a4271f
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/package.json +1 -1
- package/src/atoms/gv-autocomplete.js +1 -461
- package/src/atoms/gv-button.js +1 -410
- package/src/atoms/gv-checkbox.js +1 -187
- package/src/atoms/gv-date-picker-calendar.js +1 -894
- package/src/atoms/gv-date-picker-cell.js +1 -190
- package/src/atoms/gv-date-picker.js +1 -671
- package/src/atoms/gv-file-upload.js +1 -367
- package/src/atoms/gv-icon.js +1 -103
- package/src/atoms/gv-image.js +1 -144
- package/src/atoms/gv-input-message.js +1 -84
- package/src/atoms/gv-input.js +1 -561
- package/src/atoms/gv-link.js +1 -210
- package/src/atoms/gv-message.js +1 -128
- package/src/atoms/gv-metric.js +1 -117
- package/src/atoms/gv-relative-time.js +1 -156
- package/src/atoms/gv-select-native.js +1 -388
- package/src/atoms/gv-select.js +1 -437
- package/src/atoms/gv-spinner.js +1 -57
- package/src/atoms/gv-state.js +1 -130
- package/src/atoms/gv-switch.js +1 -243
- package/src/atoms/gv-tag.js +1 -168
- package/src/atoms/gv-text.js +1 -168
- package/src/charts/gv-chart-bar.js +1 -103
- package/src/charts/gv-chart-gauge.js +1 -100
- package/src/charts/gv-chart-histogram.js +1 -83
- package/src/charts/gv-chart-line.js +1 -224
- package/src/charts/gv-chart-map.js +1 -112
- package/src/charts/gv-chart-pie.js +1 -91
- package/src/index.js +1 -77
- package/src/lib/cron-expression.js +1 -205
- package/src/lib/date.js +1 -44
- package/src/lib/events.js +1 -26
- package/src/lib/http-client-schema-form.js +1 -67
- package/src/lib/http.js +1 -237
- package/src/lib/i18n.js +1 -103
- package/src/lib/item.js +1 -118
- package/src/lib/properties.js +1 -189
- package/src/lib/schema-form.js +1 -44
- package/src/lib/studio.js +1 -141
- package/src/lib/style.js +1 -41
- package/src/lib/text-format.js +1 -69
- package/src/lib/theme.js +1 -63
- package/src/lib/utils.js +1 -111
- package/src/mixins/chart-element.js +1 -165
- package/src/mixins/input-element.js +1 -144
- package/src/mixins/item-resource.js +1 -120
- package/src/mixins/keyboard-element.js +1 -69
- package/src/mixins/update-after-browser.js +1 -30
- package/src/mixins/with-resize-observer.js +1 -68
- package/src/mixins/with-skeleton-attribute.js +1 -112
- package/src/molecules/gv-card-full.js +1 -218
- package/src/molecules/gv-card-list.js +1 -113
- package/src/molecules/gv-card.js +1 -133
- package/src/molecules/gv-category-list.js +1 -60
- package/src/molecules/gv-category.js +1 -170
- package/src/molecules/gv-code.js +1 -359
- package/src/molecules/gv-confirm.js +1 -188
- package/src/molecules/gv-cron-editor.js +1 -710
- package/src/molecules/gv-dropdown-menu.js +1 -116
- package/src/molecules/gv-expandable.js +1 -122
- package/src/molecules/gv-expression-language.js +1 -270
- package/src/molecules/gv-identity-picture.js +1 -148
- package/src/molecules/gv-list.js +1 -227
- package/src/molecules/gv-metrics.js +1 -162
- package/src/molecules/gv-modal.js +1 -213
- package/src/molecules/gv-nav.js +1 -196
- package/src/molecules/gv-option.js +1 -242
- package/src/molecules/gv-plans.js +1 -429
- package/src/molecules/gv-popover.js +1 -351
- package/src/molecules/gv-promote.js +1 -209
- package/src/molecules/gv-rating-list.js +1 -365
- package/src/molecules/gv-rating.js +1 -253
- package/src/molecules/gv-row-expandable.js +1 -45
- package/src/molecules/gv-row.js +1 -210
- package/src/molecules/gv-stats.js +1 -121
- package/src/molecules/gv-stepper.js +1 -288
- package/src/molecules/gv-table.js +1 -685
- package/src/molecules/gv-tree.js +1 -250
- package/src/organisms/gv-documentation.js +1 -215
- package/src/organisms/gv-header.js +1 -288
- package/src/organisms/gv-http-client.js +1 -275
- package/src/organisms/gv-menu.js +1 -263
- package/src/organisms/gv-newsletter-subscription.js +1 -271
- package/src/organisms/gv-pagination.js +1 -198
- package/src/organisms/gv-properties.js +1 -920
- package/src/organisms/gv-resizable-views.js +1 -396
- package/src/organisms/gv-resources.js +1 -535
- package/src/organisms/gv-schema-form-array.js +1 -250
- package/src/organisms/gv-schema-form-control-object.js +1 -154
- package/src/organisms/gv-schema-form-control.js +1 -443
- package/src/organisms/gv-schema-form.js +1 -751
- package/src/organisms/gv-tabs.js +1 -210
- package/src/organisms/gv-user-menu.js +1 -314
- package/src/organisms/gv-vertical-menu.js +1 -123
- package/src/policy-studio/gv-flow-step.js +1 -464
- package/src/policy-studio/gv-flow.js +1 -621
- package/src/policy-studio/gv-policy-studio-menu.js +1 -750
- package/src/policy-studio/gv-policy-studio.js +1 -1842
- package/src/styles/empty.js +1 -36
- package/src/styles/input.js +1 -263
- package/src/styles/link.js +1 -32
- package/src/styles/shapes.js +1 -17
- package/src/styles/skeleton.js +1 -53
- package/src/styles/zoom.js +1 -40
- package/src/theme/gv-theme.js +1 -203
- package/wc/gv-autocomplete.js +1 -1
- package/wc/gv-button.js +1 -1
- package/wc/gv-card-full.js +1 -1
- package/wc/gv-card-list.js +1 -1
- package/wc/gv-card.js +1 -1
- package/wc/gv-category-list.js +1 -1
- package/wc/gv-category.js +1 -1
- package/wc/gv-chart-bar.js +1 -1
- package/wc/gv-chart-gauge.js +1 -1
- package/wc/gv-chart-histogram.js +1 -1
- package/wc/gv-chart-line.js +1 -1
- package/wc/gv-chart-map.js +1 -1
- package/wc/gv-chart-pie.js +1 -1
- package/wc/gv-checkbox.js +1 -1
- package/wc/gv-code.js +1 -1
- package/wc/gv-confirm.js +1 -1
- package/wc/gv-cron-editor.js +1 -1
- package/wc/gv-date-picker-calendar.js +1 -1
- package/wc/gv-date-picker-cell.js +1 -1
- package/wc/gv-date-picker.js +1 -1
- package/wc/gv-documentation.js +1 -1
- package/wc/gv-dropdown-menu.js +1 -1
- package/wc/gv-expandable.js +1 -1
- package/wc/gv-expression-language.js +1 -1
- package/wc/gv-file-upload.js +1 -1
- package/wc/gv-flow-step.js +1 -1
- package/wc/gv-flow.js +1 -1
- package/wc/gv-header.js +1 -1
- package/wc/gv-http-client.js +1 -1
- package/wc/gv-icon.js +1 -1
- package/wc/gv-identity-picture.js +1 -1
- package/wc/gv-image.js +1 -1
- package/wc/gv-input-message.js +1 -1
- package/wc/gv-input.js +1 -1
- package/wc/gv-link.js +1 -1
- package/wc/gv-list.js +1 -1
- package/wc/gv-menu.js +1 -1
- package/wc/gv-message.js +1 -1
- package/wc/gv-metric.js +1 -1
- package/wc/gv-metrics.js +1 -1
- package/wc/gv-modal.js +1 -1
- package/wc/gv-nav.js +1 -1
- package/wc/gv-newsletter-subscription.js +1 -1
- package/wc/gv-option.js +1 -1
- package/wc/gv-pagination.js +1 -1
- package/wc/gv-plans.js +1 -1
- package/wc/gv-policy-studio-menu.js +1 -1
- package/wc/gv-policy-studio.js +1 -1
- package/wc/gv-popover.js +1 -1
- package/wc/gv-promote.js +1 -1
- package/wc/gv-properties.js +1 -1
- package/wc/gv-rating-list.js +1 -1
- package/wc/gv-rating.js +1 -1
- package/wc/gv-relative-time.js +1 -1
- package/wc/gv-resizable-views.js +1 -1
- package/wc/gv-resources.js +1 -1
- package/wc/gv-row-expandable.js +1 -1
- package/wc/gv-row.js +1 -1
- package/wc/gv-schema-form-array.js +1 -1
- package/wc/gv-schema-form-control-object.js +1 -1
- package/wc/gv-schema-form-control.js +1 -1
- package/wc/gv-schema-form.js +1 -1
- package/wc/gv-select-native.js +1 -1
- package/wc/gv-select.js +1 -1
- package/wc/gv-spinner.js +1 -1
- package/wc/gv-state.js +1 -1
- package/wc/gv-stats.js +1 -1
- package/wc/gv-stepper.js +1 -1
- package/wc/gv-switch.js +1 -1
- package/wc/gv-table.js +1 -1
- package/wc/gv-tabs.js +1 -1
- package/wc/gv-tag.js +1 -1
- package/wc/gv-text.js +1 -1
- package/wc/gv-theme.js +1 -1
- package/wc/gv-tree.js +1 -1
- package/wc/gv-user-menu.js +1 -1
- package/wc/gv-vertical-menu.js +1 -1
- package/CHANGELOG.md +0 -1292
- package/LICENSE.txt +0 -202
- package/README.md +0 -195
- package/src/.eslintrc.js +0 -19
- package/src/theme/definition.json +0 -1762
|
@@ -1,144 +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 { css, html } from 'lit';
|
|
17
|
-
|
|
18
|
-
export function InputElement(ParentClass) {
|
|
19
|
-
/**
|
|
20
|
-
* @mixinClass
|
|
21
|
-
*/
|
|
22
|
-
return class extends ParentClass {
|
|
23
|
-
static get properties() {
|
|
24
|
-
return {
|
|
25
|
-
disabled: { type: Boolean, reflect: true },
|
|
26
|
-
required: { type: Boolean, reflect: true },
|
|
27
|
-
readonly: { type: Boolean, reflect: true },
|
|
28
|
-
skeleton: { type: Boolean },
|
|
29
|
-
value: { type: String, reflect: true },
|
|
30
|
-
label: { type: String },
|
|
31
|
-
title: { type: String },
|
|
32
|
-
name: { type: String },
|
|
33
|
-
placeholder: { type: String },
|
|
34
|
-
description: { type: String },
|
|
35
|
-
autofocus: { type: Boolean },
|
|
36
|
-
invalid: { type: Boolean, reflect: true },
|
|
37
|
-
valid: { type: Boolean, reflect: true },
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static get styles() {
|
|
42
|
-
return [
|
|
43
|
-
// language=CSS
|
|
44
|
-
css`
|
|
45
|
-
:host {
|
|
46
|
-
box-sizing: border-box;
|
|
47
|
-
margin: 0.2rem;
|
|
48
|
-
display: block;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
:host([invalid]) :not(.clipboard) input,
|
|
52
|
-
:host([invalid]) :not(.clipboard) ::slotted(.input),
|
|
53
|
-
:host([invalid]) :not(.clipboard) .box-icon-left,
|
|
54
|
-
:host([invalid]) :not(.clipboard) textarea,
|
|
55
|
-
:host([invalid]) :not(.clipboard) select,
|
|
56
|
-
:host([invalid]) :not(.clipboard) .input {
|
|
57
|
-
box-shadow: inset 3px 0 0 var(--gv-input-invalid--bxshc, var(--gv-theme-color-error, #da1a1b));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
:host([readonly]) :not(.clipboard) input,
|
|
61
|
-
:host([readonly]) :not(.clipboard) ::slotted(.input),
|
|
62
|
-
:host([readonly]) .textarea,
|
|
63
|
-
:host([readonly]) :not(.clipboard) select,
|
|
64
|
-
:host([readonly]) .input {
|
|
65
|
-
border-left: 1px solid var(--gv-input--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:host([readonly]) input::placeholder {
|
|
69
|
-
color: transparent;
|
|
70
|
-
}
|
|
71
|
-
`,
|
|
72
|
-
];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
constructor() {
|
|
76
|
-
super();
|
|
77
|
-
this._id = `gv-input-${new Date().getTime()}`;
|
|
78
|
-
this.valid = true;
|
|
79
|
-
this.invalid = false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
updateState(value) {
|
|
83
|
-
if (this.required && !this.readonly) {
|
|
84
|
-
this.setValidity(value == null || value.length === 0 || (typeof value === 'string' && value.trim() === ''), 'field is required');
|
|
85
|
-
} else {
|
|
86
|
-
this.setValidity();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
setValidity(isInvalid = false, violation = '') {
|
|
91
|
-
const element = this.getInputElement();
|
|
92
|
-
if (element && element.setCustomValidity) {
|
|
93
|
-
if (isInvalid) {
|
|
94
|
-
if (violation == null || violation.trim() === '') {
|
|
95
|
-
violation = 'field is not valid';
|
|
96
|
-
}
|
|
97
|
-
element.setCustomValidity(violation);
|
|
98
|
-
} else {
|
|
99
|
-
element.setCustomValidity('');
|
|
100
|
-
}
|
|
101
|
-
element.reportValidity();
|
|
102
|
-
}
|
|
103
|
-
this.invalid = isInvalid;
|
|
104
|
-
this.valid = !this.invalid;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
firstUpdated() {
|
|
108
|
-
if (this.autofocus) {
|
|
109
|
-
const input = this.getInputElement();
|
|
110
|
-
if (input != null) {
|
|
111
|
-
this.getInputElement().focus();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
this.updateState(this.value);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
updated(changedProperties) {
|
|
118
|
-
if (changedProperties.has('value')) {
|
|
119
|
-
this.updateState(this.value);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
getInputElement() {
|
|
124
|
-
return this.shadowRoot ? this.shadowRoot.querySelector('input') : null;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
get offsetHeight() {
|
|
128
|
-
if (this.description != null) {
|
|
129
|
-
const element = this.shadowRoot.querySelector('.description');
|
|
130
|
-
if (element != null) {
|
|
131
|
-
return super.offsetHeight - element.offsetHeight;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return super.offsetHeight;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
renderLabel() {
|
|
138
|
-
if (this.label) {
|
|
139
|
-
return html`<label for=${this.id} title="${this.label}">${this.label}</label>`;
|
|
140
|
-
}
|
|
141
|
-
return '';
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
}
|
|
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,120 +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 { 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
|
-
/**
|
|
23
|
-
* This is a mixin for ItemResource
|
|
24
|
-
* @mixinFunction
|
|
25
|
-
*/
|
|
26
|
-
export function ItemResource(ParentClass) {
|
|
27
|
-
/**
|
|
28
|
-
* @mixinClass
|
|
29
|
-
*/
|
|
30
|
-
return class extends withSkeletonAttribute(ParentClass) {
|
|
31
|
-
static get properties() {
|
|
32
|
-
return {
|
|
33
|
-
...super.properties,
|
|
34
|
-
/** @required */
|
|
35
|
-
item: { type: Object },
|
|
36
|
-
href: { type: String },
|
|
37
|
-
metrics: { type: Object },
|
|
38
|
-
_item: { type: Object, attribute: false },
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
constructor() {
|
|
43
|
-
super();
|
|
44
|
-
this._skeletonAttribute = 'item';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_onImageLoaded() {
|
|
48
|
-
if (this._item) {
|
|
49
|
-
this._skeleton = false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
_renderImage() {
|
|
54
|
-
if (this._item && !this._empty) {
|
|
55
|
-
return html`<gv-identity-picture
|
|
56
|
-
.skeleton="${this._skeleton}"
|
|
57
|
-
.display_name="${getPictureDisplayName(this._item)}"
|
|
58
|
-
.picture="${getPicture(this._item)}"
|
|
59
|
-
@load="${this._onImageLoaded}"
|
|
60
|
-
></gv-identity-picture>`;
|
|
61
|
-
}
|
|
62
|
-
return '';
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
_onTagClick(tagValue, event) {
|
|
66
|
-
event.detail.tagValue = tagValue;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
_renderLabels(clickable) {
|
|
70
|
-
const labels = getLabels(this._item);
|
|
71
|
-
if (labels) {
|
|
72
|
-
return repeat(
|
|
73
|
-
labels,
|
|
74
|
-
(label) => label,
|
|
75
|
-
(label) =>
|
|
76
|
-
html`<gv-tag ?clickable="${clickable}" @gv-tag:click="${this._onTagClick.bind(this, label)}" ?skeleton="${this._skeleton}" major
|
|
77
|
-
>${label}</gv-tag
|
|
78
|
-
>`,
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
return '';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
_renderStates() {
|
|
85
|
-
const states = getStates(this._item);
|
|
86
|
-
if (states) {
|
|
87
|
-
return repeat(
|
|
88
|
-
states,
|
|
89
|
-
(state) => state,
|
|
90
|
-
({ value, major, minor }) => html`
|
|
91
|
-
<gv-state ?skeleton="${this._skeleton}" ?major="${major === true}" ?minor="${minor === true}">${value}</gv-state>
|
|
92
|
-
`,
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
return '';
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_onClickToMetrics(event) {
|
|
99
|
-
event.detail.item = this._item;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
_renderMetricsWithRating() {
|
|
103
|
-
if (this.metrics) {
|
|
104
|
-
return html`
|
|
105
|
-
<gv-metrics .metrics="${this.metrics}" @gv-metrics:click="${this._onClickToMetrics}"> ${this._renderInfoRating()} </gv-metrics>
|
|
106
|
-
`;
|
|
107
|
-
} else {
|
|
108
|
-
return this._renderInfoRating();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
_renderInfoRating() {
|
|
113
|
-
const rating = getRating(this._item);
|
|
114
|
-
if (rating && rating.count) {
|
|
115
|
-
return html`<gv-rating readonly .skeleton="${this._skeleton}" .value="${rating.average}" .count="${rating.count}"></gv-rating>`;
|
|
116
|
-
}
|
|
117
|
-
return '';
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
}
|
|
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,69 +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
|
-
export const KEYS = {
|
|
17
|
-
ArrowDown: '40',
|
|
18
|
-
ArrowLeft: '37',
|
|
19
|
-
ArrowRight: '39',
|
|
20
|
-
ArrowUp: '38',
|
|
21
|
-
Ctrl: '17',
|
|
22
|
-
Esc: '27',
|
|
23
|
-
Shift: '16',
|
|
24
|
-
Space: '32',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export function KeyboardElement(ParentClass) {
|
|
28
|
-
/**
|
|
29
|
-
* @mixinClass
|
|
30
|
-
*/
|
|
31
|
-
return class extends ParentClass {
|
|
32
|
-
constructor() {
|
|
33
|
-
super();
|
|
34
|
-
this._controller = {};
|
|
35
|
-
this._handleKeyDown = this._onKeyDown.bind(this);
|
|
36
|
-
this._handleKeyUp = this._onKeyUp.bind(this);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
connectedCallback() {
|
|
40
|
-
super.connectedCallback();
|
|
41
|
-
window.addEventListener('keydown', this._handleKeyDown);
|
|
42
|
-
window.addEventListener('keyup', this._handleKeyUp);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
disconnectedCallback() {
|
|
46
|
-
window.removeEventListener('keydown', this._handleKeyDown);
|
|
47
|
-
window.removeEventListener('keyup', this._handleKeyUp);
|
|
48
|
-
super.disconnectedCallback();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_onKeyDown(e) {
|
|
52
|
-
this._controller[e.keyCode] = true;
|
|
53
|
-
this.onKeyboard(this._controller);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
_onKeyUp(e) {
|
|
57
|
-
if (this._controller[e.keyCode]) {
|
|
58
|
-
this._controller[e.keyCode] = null;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
isPressed(...keys) {
|
|
63
|
-
return keys.find((key) => this._controller[key] == null) == null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// abstract
|
|
67
|
-
onKeyboard(controller) {}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.KeyboardElement=exports.KEYS=void 0,exports.KEYS={ArrowDown:"40",ArrowLeft:"37",ArrowRight:"39",ArrowUp:"38",Ctrl:"17",Esc:"27",Shift:"16",Space:"32"},exports.KeyboardElement=function(e){return class extends e{constructor(){super(),this._controller={},this._handleKeyDown=this._onKeyDown.bind(this),this._handleKeyUp=this._onKeyUp.bind(this)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._handleKeyDown),window.addEventListener("keyup",this._handleKeyUp)}disconnectedCallback(){window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("keyup",this._handleKeyUp),super.disconnectedCallback()}_onKeyDown(e){this._controller[e.keyCode]=!0,this.onKeyboard(this._controller)}_onKeyUp(e){this._controller[e.keyCode]&&(this._controller[e.keyCode]=null)}isPressed(...e){return null==e.find((e=>null==this._controller[e]))}onKeyboard(e){}}};
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (C) 2021 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
|
-
/**
|
|
17
|
-
* This is a mixin for update component after browser
|
|
18
|
-
* @mixinFunction
|
|
19
|
-
*/
|
|
20
|
-
export function UpdateAfterBrowser(ParentClass) {
|
|
21
|
-
/**
|
|
22
|
-
* @mixinClass
|
|
23
|
-
*/
|
|
24
|
-
return class extends ParentClass {
|
|
25
|
-
async performUpdate() {
|
|
26
|
-
await new Promise((resolve) => requestAnimationFrame(() => resolve()));
|
|
27
|
-
super.performUpdate();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.UpdateAfterBrowser=void 0,exports.UpdateAfterBrowser=function(e){return class extends e{async performUpdate(){await new Promise((e=>requestAnimationFrame((()=>e())))),super.performUpdate()}}};
|
|
@@ -1,68 +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
|
-
export function withResizeObserver(ParentClass) {
|
|
17
|
-
// Load native impl or polyfill (without poluting global scope)
|
|
18
|
-
const ResizeObserverPromise =
|
|
19
|
-
'ResizeObserver' in window
|
|
20
|
-
? Promise.resolve(window.ResizeObserver)
|
|
21
|
-
: import('resize-observer-polyfill/dist/ResizeObserver.es.js').then((mod) => mod.default);
|
|
22
|
-
|
|
23
|
-
return class extends ParentClass {
|
|
24
|
-
_onResize({ width }) {
|
|
25
|
-
if (this.onResize != null) {
|
|
26
|
-
this.onResize({ width });
|
|
27
|
-
}
|
|
28
|
-
if (this.breakpoints != null) {
|
|
29
|
-
this.breakpoints.width.forEach((breakpoint) => {
|
|
30
|
-
const gteAttr = 'w-gte-' + breakpoint;
|
|
31
|
-
breakpoint <= width ? this.setAttribute(gteAttr, '') : this.removeAttribute(gteAttr);
|
|
32
|
-
|
|
33
|
-
const ltAttr = 'w-lt-' + breakpoint;
|
|
34
|
-
width < breakpoint ? this.setAttribute(ltAttr, '') : this.removeAttribute(ltAttr);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async connectedCallback() {
|
|
40
|
-
if (super.connectedCallback != null) {
|
|
41
|
-
super.connectedCallback();
|
|
42
|
-
}
|
|
43
|
-
const ResizeObserver = await ResizeObserverPromise;
|
|
44
|
-
const ro = new ResizeObserver((entries) => {
|
|
45
|
-
// We wrap it in requestAnimationFrame to avoid this error - ResizeObserver loop limit exceeded
|
|
46
|
-
window.requestAnimationFrame(() => {
|
|
47
|
-
if (!Array.isArray(entries) || !entries.length) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const { width } = this.getBoundingClientRect();
|
|
51
|
-
this._onResize({ width });
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
ro.observe(this);
|
|
56
|
-
this._unobserveResize = () => ro.unobserve(this);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
disconnectedCallback() {
|
|
60
|
-
if (super.connectedCallback != null) {
|
|
61
|
-
super.disconnectedCallback();
|
|
62
|
-
}
|
|
63
|
-
if (this._unobserveResize) {
|
|
64
|
-
this._unobserveResize();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
1
|
+
var e=Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]},t=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},i=function(i){if(i&&i.__esModule)return i;var n={};if(null!=i)for(var r in i)"default"!==r&&Object.prototype.hasOwnProperty.call(i,r)&&e(n,i,r);return t(n,i),n};Object.defineProperty(exports,"__esModule",{value:!0}),exports.withResizeObserver=void 0,exports.withResizeObserver=function(e){const t="ResizeObserver"in window?Promise.resolve(window.ResizeObserver):Promise.resolve().then((()=>i(require("resize-observer-polyfill/dist/ResizeObserver.es.js")))).then((e=>e.default));return class extends e{_onResize({width:e}){null!=this.onResize&&this.onResize({width:e}),null!=this.breakpoints&&this.breakpoints.width.forEach((t=>{const i="w-gte-"+t;t<=e?this.setAttribute(i,""):this.removeAttribute(i);const n="w-lt-"+t;e<t?this.setAttribute(n,""):this.removeAttribute(n)}))}async connectedCallback(){null!=super.connectedCallback&&super.connectedCallback();const e=new(await t)((e=>{window.requestAnimationFrame((()=>{if(!Array.isArray(e)||!e.length)return;const{width:t}=this.getBoundingClientRect();this._onResize({width:t})}))}));e.observe(this),this._unobserveResize=()=>e.unobserve(this)}disconnectedCallback(){null!=super.connectedCallback&&super.disconnectedCallback(),this._unobserveResize&&this._unobserveResize()}}};
|
|
@@ -1,112 +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 { css } from 'lit';
|
|
17
|
-
import { skeleton } from '../styles/skeleton';
|
|
18
|
-
import { empty } from '../styles/empty';
|
|
19
|
-
|
|
20
|
-
const timeBeforeSkeleton = 500;
|
|
21
|
-
const minimumTimeOfSkeleton = 1000;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* This is a mixin for withSkeletonStates
|
|
25
|
-
* @mixinFunction
|
|
26
|
-
*/
|
|
27
|
-
export function withSkeletonAttribute(ParentClass) {
|
|
28
|
-
/**
|
|
29
|
-
* @mixinClass
|
|
30
|
-
*/
|
|
31
|
-
return class extends ParentClass {
|
|
32
|
-
static get properties() {
|
|
33
|
-
return {
|
|
34
|
-
/** @required */
|
|
35
|
-
_invisible: { type: Boolean, reflect: true },
|
|
36
|
-
_skeleton: { type: Boolean, attribute: false },
|
|
37
|
-
_error: { type: Boolean, attribute: false },
|
|
38
|
-
_empty: { type: Boolean, attribute: false },
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
static get styles() {
|
|
43
|
-
return [
|
|
44
|
-
skeleton,
|
|
45
|
-
empty,
|
|
46
|
-
// language=CSS
|
|
47
|
-
css`
|
|
48
|
-
:host([_invisible]) {
|
|
49
|
-
visibility: hidden;
|
|
50
|
-
}
|
|
51
|
-
`,
|
|
52
|
-
];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
constructor() {
|
|
56
|
-
super();
|
|
57
|
-
this._invisible = true;
|
|
58
|
-
this._skeleton = false;
|
|
59
|
-
this._error = false;
|
|
60
|
-
this._empty = false;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
updated(changedProperties) {
|
|
64
|
-
if (this._skeletonAttribute != null && changedProperties.has(this._skeletonAttribute)) {
|
|
65
|
-
this._error = false;
|
|
66
|
-
this._empty = false;
|
|
67
|
-
const start = new Date().getTime();
|
|
68
|
-
let end = null;
|
|
69
|
-
const timer = setTimeout(() => {
|
|
70
|
-
this._invisible = false;
|
|
71
|
-
this._skeleton = true;
|
|
72
|
-
end = new Date().getTime();
|
|
73
|
-
}, timeBeforeSkeleton);
|
|
74
|
-
|
|
75
|
-
const attribute = this[this._skeletonAttribute];
|
|
76
|
-
Promise.resolve(attribute)
|
|
77
|
-
.then((value) => {
|
|
78
|
-
clearTimeout(timer);
|
|
79
|
-
if (end && end - start < minimumTimeOfSkeleton) {
|
|
80
|
-
setTimeout(() => {
|
|
81
|
-
this[this._skeletonAttribute] = value;
|
|
82
|
-
}, minimumTimeOfSkeleton - (end - start));
|
|
83
|
-
} else {
|
|
84
|
-
this._invisible = value === undefined;
|
|
85
|
-
this._skeleton = value === null;
|
|
86
|
-
if (value) {
|
|
87
|
-
if (Array.isArray(value)) {
|
|
88
|
-
this._empty = value.length === 0;
|
|
89
|
-
} else {
|
|
90
|
-
this._empty = Object.keys(value).length === 0;
|
|
91
|
-
}
|
|
92
|
-
this[`_${this._skeletonAttribute}`] = value;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
.catch((err) => {
|
|
97
|
-
clearTimeout(timer);
|
|
98
|
-
if (end && end - start < minimumTimeOfSkeleton) {
|
|
99
|
-
setTimeout(() => {
|
|
100
|
-
this[this._skeletonAttribute] = Promise.reject(err);
|
|
101
|
-
}, minimumTimeOfSkeleton - (end - start));
|
|
102
|
-
} else {
|
|
103
|
-
this._error = true;
|
|
104
|
-
this._skeleton = false;
|
|
105
|
-
this._empty = false;
|
|
106
|
-
this._invisible = false;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.withSkeletonAttribute=void 0;const t=require("lit"),e=require("../styles/skeleton"),i=require("../styles/empty");exports.withSkeletonAttribute=function(s){return class extends s{static get properties(){return{_invisible:{type:Boolean,reflect:!0},_skeleton:{type:Boolean,attribute:!1},_error:{type:Boolean,attribute:!1},_empty:{type:Boolean,attribute:!1}}}static get styles(){return[e.skeleton,i.empty,t.css`:host([_invisible]){visibility:hidden}`]}constructor(){super(),this._invisible=!0,this._skeleton=!1,this._error=!1,this._empty=!1}updated(t){if(null!=this._skeletonAttribute&&t.has(this._skeletonAttribute)){this._error=!1,this._empty=!1;const t=(new Date).getTime();let e=null;const i=setTimeout((()=>{this._invisible=!1,this._skeleton=!0,e=(new Date).getTime()}),500),s=this[this._skeletonAttribute];Promise.resolve(s).then((s=>{clearTimeout(i),e&&e-t<1e3?setTimeout((()=>{this[this._skeletonAttribute]=s}),1e3-(e-t)):(this._invisible=void 0===s,this._skeleton=null===s,s&&(Array.isArray(s)?this._empty=0===s.length:this._empty=0===Object.keys(s).length,this[`_${this._skeletonAttribute}`]=s))})).catch((s=>{clearTimeout(i),e&&e-t<1e3?setTimeout((()=>{this[this._skeletonAttribute]=Promise.reject(s)}),1e3-(e-t)):(this._error=!0,this._skeleton=!1,this._empty=!1,this._invisible=!1)}))}}}};
|