@gravitee/ui-components 3.25.3-typescript-8a53edf → 3.25.3-typescript-e7256ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -4
- package/src/atoms/gv-autocomplete.d.ts +104 -0
- package/src/atoms/gv-autocomplete.js +1 -461
- package/src/atoms/gv-button.d.ts +109 -0
- package/src/atoms/gv-button.js +1 -410
- package/src/atoms/gv-checkbox.d.ts +114 -0
- package/src/atoms/gv-checkbox.js +1 -187
- package/src/atoms/gv-date-picker-calendar.d.ts +190 -0
- package/src/atoms/gv-date-picker-calendar.js +1 -894
- package/src/atoms/gv-date-picker-cell.d.ts +80 -0
- package/src/atoms/gv-date-picker-cell.js +1 -190
- package/src/atoms/gv-date-picker.d.ts +194 -0
- package/src/atoms/gv-date-picker.js +1 -671
- package/src/atoms/gv-file-upload.d.ts +64 -0
- package/src/atoms/gv-file-upload.js +1 -367
- package/src/atoms/gv-icon.d.ts +26 -0
- package/src/atoms/gv-icon.js +1 -103
- package/src/atoms/gv-image.d.ts +45 -0
- package/src/atoms/gv-image.js +1 -144
- package/src/atoms/gv-input-message.d.ts +20 -0
- package/src/atoms/gv-input-message.js +1 -84
- package/src/atoms/gv-input.d.ts +246 -0
- package/src/atoms/gv-input.js +1 -561
- package/src/atoms/gv-link.d.ts +67 -0
- package/src/atoms/gv-link.js +1 -210
- package/src/atoms/gv-message.d.ts +23 -0
- package/src/atoms/gv-message.js +1 -128
- package/src/atoms/gv-metric.d.ts +32 -0
- package/src/atoms/gv-metric.js +1 -117
- package/src/atoms/gv-relative-time.d.ts +45 -0
- package/src/atoms/gv-relative-time.js +1 -156
- package/src/atoms/gv-select-native.d.ts +174 -0
- package/src/atoms/gv-select-native.js +1 -388
- package/src/atoms/gv-select.d.ts +71 -0
- package/src/atoms/gv-select.js +1 -437
- package/src/atoms/gv-spinner.d.ts +10 -0
- package/src/atoms/gv-spinner.js +1 -57
- package/src/atoms/gv-state.d.ts +50 -0
- package/src/atoms/gv-state.js +1 -130
- package/src/atoms/gv-switch.d.ts +60 -0
- package/src/atoms/gv-switch.js +1 -243
- package/src/atoms/gv-tag.d.ts +69 -0
- package/src/atoms/gv-tag.js +1 -168
- package/src/atoms/gv-text.d.ts +110 -0
- package/src/atoms/gv-text.js +1 -168
- package/src/charts/gv-chart-bar.d.ts +50 -0
- package/src/charts/gv-chart-bar.js +1 -103
- package/src/charts/gv-chart-gauge.d.ts +58 -0
- package/src/charts/gv-chart-gauge.js +1 -100
- package/src/charts/gv-chart-histogram.d.ts +48 -0
- package/src/charts/gv-chart-histogram.js +1 -83
- package/src/charts/gv-chart-line.d.ts +52 -0
- package/src/charts/gv-chart-line.js +1 -224
- package/src/charts/gv-chart-map.d.ts +50 -0
- package/src/charts/gv-chart-map.js +1 -112
- package/src/charts/gv-chart-pie.d.ts +50 -0
- package/src/charts/gv-chart-pie.js +1 -91
- package/src/index.d.ts +77 -0
- package/src/index.js +1 -77
- package/src/lib/cron-expression.d.ts +1 -0
- package/src/lib/cron-expression.js +1 -205
- package/src/lib/date.d.ts +1 -0
- package/src/lib/date.js +1 -44
- package/src/lib/events.d.ts +1 -0
- package/src/lib/events.js +1 -26
- package/src/lib/http-client-schema-form.d.ts +68 -0
- package/src/lib/http-client-schema-form.js +1 -67
- package/src/lib/http.d.ts +222 -0
- package/src/lib/http.js +1 -237
- package/src/lib/i18n.d.ts +30 -0
- package/src/lib/i18n.js +1 -103
- package/src/lib/item.d.ts +12 -0
- package/src/lib/item.js +1 -118
- package/src/lib/properties.d.ts +42 -0
- package/src/lib/properties.js +1 -189
- package/src/lib/schema-form.d.ts +5 -0
- package/src/lib/schema-form.js +1 -44
- package/src/lib/studio.d.ts +2 -0
- package/src/lib/studio.js +1 -141
- package/src/lib/style.d.ts +6 -0
- package/src/lib/style.js +1 -41
- package/src/lib/text-format.d.ts +6 -0
- package/src/lib/text-format.js +1 -69
- package/src/lib/theme.d.ts +4 -0
- package/src/lib/theme.js +1 -63
- package/src/lib/utils.d.ts +9 -0
- package/src/lib/utils.js +1 -111
- package/src/mixins/chart-element.d.ts +39 -0
- package/src/mixins/chart-element.js +1 -165
- package/src/mixins/input-element.d.ts +64 -0
- package/src/mixins/input-element.js +1 -144
- package/src/mixins/item-resource.d.ts +56 -0
- package/src/mixins/item-resource.js +1 -120
- package/src/mixins/keyboard-element.d.ts +25 -0
- package/src/mixins/keyboard-element.js +1 -69
- package/src/mixins/update-after-browser.d.ts +11 -0
- package/src/mixins/update-after-browser.js +1 -30
- package/src/mixins/with-resize-observer.d.ts +12 -0
- package/src/mixins/with-resize-observer.js +1 -68
- package/src/mixins/with-skeleton-attribute.d.ts +35 -0
- package/src/mixins/with-skeleton-attribute.js +1 -112
- package/src/molecules/gv-card-full.d.ts +78 -0
- package/src/molecules/gv-card-full.js +1 -218
- package/src/molecules/gv-card-list.d.ts +33 -0
- package/src/molecules/gv-card-list.js +1 -113
- package/src/molecules/gv-card.d.ts +65 -0
- package/src/molecules/gv-card.js +1 -133
- package/src/molecules/gv-category-list.d.ts +17 -0
- package/src/molecules/gv-category-list.js +1 -60
- package/src/molecules/gv-category.d.ts +64 -0
- package/src/molecules/gv-category.js +1 -170
- package/src/molecules/gv-code.d.ts +192 -0
- package/src/molecules/gv-code.js +1 -359
- package/src/molecules/gv-confirm.d.ts +60 -0
- package/src/molecules/gv-confirm.js +1 -188
- package/src/molecules/gv-cron-editor.d.ts +115 -0
- package/src/molecules/gv-cron-editor.js +1 -710
- package/src/molecules/gv-dropdown-menu.d.ts +28 -0
- package/src/molecules/gv-dropdown-menu.js +1 -116
- package/src/molecules/gv-expandable.d.ts +37 -0
- package/src/molecules/gv-expandable.js +1 -122
- package/src/molecules/gv-expression-language.d.ts +150 -0
- package/src/molecules/gv-expression-language.js +1 -270
- package/src/molecules/gv-identity-picture.d.ts +44 -0
- package/src/molecules/gv-identity-picture.js +1 -148
- package/src/molecules/gv-list.d.ts +123 -0
- package/src/molecules/gv-list.js +1 -227
- package/src/molecules/gv-metrics.d.ts +65 -0
- package/src/molecules/gv-metrics.js +1 -162
- package/src/molecules/gv-modal.d.ts +64 -0
- package/src/molecules/gv-modal.js +1 -213
- package/src/molecules/gv-nav.d.ts +41 -0
- package/src/molecules/gv-nav.js +1 -196
- package/src/molecules/gv-option.d.ts +65 -0
- package/src/molecules/gv-option.js +1 -242
- package/src/molecules/gv-plans.d.ts +73 -0
- package/src/molecules/gv-plans.js +1 -429
- package/src/molecules/gv-popover.d.ts +91 -0
- package/src/molecules/gv-popover.js +1 -351
- package/src/molecules/gv-promote.d.ts +108 -0
- package/src/molecules/gv-promote.js +1 -209
- package/src/molecules/gv-rating-list.d.ts +77 -0
- package/src/molecules/gv-rating-list.js +1 -365
- package/src/molecules/gv-rating.d.ts +55 -0
- package/src/molecules/gv-rating.js +1 -253
- package/src/molecules/gv-row-expandable.d.ts +8 -0
- package/src/molecules/gv-row-expandable.js +1 -45
- package/src/molecules/gv-row.d.ts +37 -0
- package/src/molecules/gv-row.js +1 -210
- package/src/molecules/gv-stats.d.ts +53 -0
- package/src/molecules/gv-stats.js +1 -121
- package/src/molecules/gv-stepper.d.ts +46 -0
- package/src/molecules/gv-stepper.js +1 -288
- package/src/molecules/gv-table.d.ts +159 -0
- package/src/molecules/gv-table.js +1 -685
- package/src/molecules/gv-tree.d.ts +44 -0
- package/src/molecules/gv-tree.js +1 -250
- package/src/organisms/gv-documentation.d.ts +52 -0
- package/src/organisms/gv-documentation.js +1 -215
- package/src/organisms/gv-header.d.ts +60 -0
- package/src/organisms/gv-header.js +1 -288
- package/src/organisms/gv-http-client.d.ts +57 -0
- package/src/organisms/gv-http-client.js +1 -275
- package/src/organisms/gv-menu.d.ts +74 -0
- package/src/organisms/gv-menu.js +1 -263
- package/src/organisms/gv-newsletter-subscription.d.ts +82 -0
- package/src/organisms/gv-newsletter-subscription.js +1 -271
- package/src/organisms/gv-pagination.d.ts +63 -0
- package/src/organisms/gv-pagination.js +1 -198
- package/src/organisms/gv-properties.d.ts +229 -0
- package/src/organisms/gv-properties.js +1 -920
- package/src/organisms/gv-resizable-views.d.ts +33 -0
- package/src/organisms/gv-resizable-views.js +1 -396
- package/src/organisms/gv-resources.d.ts +125 -0
- package/src/organisms/gv-resources.js +1 -535
- package/src/organisms/gv-schema-form-array.d.ts +55 -0
- package/src/organisms/gv-schema-form-array.js +1 -250
- package/src/organisms/gv-schema-form-control-object.d.ts +64 -0
- package/src/organisms/gv-schema-form-control-object.js +1 -154
- package/src/organisms/gv-schema-form-control.d.ts +90 -0
- package/src/organisms/gv-schema-form-control.js +1 -443
- package/src/organisms/gv-schema-form.d.ts +156 -0
- package/src/organisms/gv-schema-form.js +1 -751
- package/src/organisms/gv-tabs.d.ts +56 -0
- package/src/organisms/gv-tabs.js +1 -210
- package/src/organisms/gv-user-menu.d.ts +56 -0
- package/src/organisms/gv-user-menu.js +1 -314
- package/src/organisms/gv-vertical-menu.d.ts +28 -0
- package/src/organisms/gv-vertical-menu.js +1 -123
- package/src/policy-studio/gv-flow-step.d.ts +142 -0
- package/src/policy-studio/gv-flow-step.js +1 -464
- package/src/policy-studio/gv-flow.d.ts +89 -0
- package/src/policy-studio/gv-flow.js +1 -621
- package/src/policy-studio/gv-policy-studio-menu.d.ts +94 -0
- package/src/policy-studio/gv-policy-studio-menu.js +1 -750
- package/src/policy-studio/gv-policy-studio.d.ts +464 -0
- package/src/policy-studio/gv-policy-studio.js +1 -1842
- package/src/styles/empty.d.ts +1 -0
- package/src/styles/empty.js +1 -36
- package/src/styles/input.d.ts +1 -0
- package/src/styles/input.js +1 -263
- package/src/styles/link.d.ts +1 -0
- package/src/styles/link.js +1 -32
- package/src/styles/shapes.d.ts +2 -0
- package/src/styles/shapes.js +1 -17
- package/src/styles/skeleton.d.ts +1 -0
- package/src/styles/skeleton.js +1 -53
- package/src/styles/zoom.d.ts +1 -0
- package/src/styles/zoom.js +1 -40
- package/src/theme/gv-theme.d.ts +81 -0
- package/src/theme/gv-theme.js +1 -203
- package/wc/gv-autocomplete.d.ts +1 -0
- package/wc/gv-autocomplete.js +1 -1
- package/wc/gv-button.d.ts +1 -0
- package/wc/gv-button.js +1 -1
- package/wc/gv-card-full.d.ts +1 -0
- package/wc/gv-card-full.js +1 -1
- package/wc/gv-card-list.d.ts +1 -0
- package/wc/gv-card-list.js +1 -1
- package/wc/gv-card.d.ts +1 -0
- package/wc/gv-card.js +1 -1
- package/wc/gv-category-list.d.ts +1 -0
- package/wc/gv-category-list.js +1 -1
- package/wc/gv-category.d.ts +1 -0
- package/wc/gv-category.js +1 -1
- package/wc/gv-chart-bar.d.ts +1 -0
- package/wc/gv-chart-bar.js +1 -1
- package/wc/gv-chart-gauge.d.ts +1 -0
- package/wc/gv-chart-gauge.js +1 -1
- package/wc/gv-chart-histogram.d.ts +1 -0
- package/wc/gv-chart-histogram.js +1 -1
- package/wc/gv-chart-line.d.ts +1 -0
- package/wc/gv-chart-line.js +1 -1
- package/wc/gv-chart-map.d.ts +1 -0
- package/wc/gv-chart-map.js +1 -1
- package/wc/gv-chart-pie.d.ts +1 -0
- package/wc/gv-chart-pie.js +1 -1
- package/wc/gv-checkbox.d.ts +1 -0
- package/wc/gv-checkbox.js +1 -1
- package/wc/gv-code.d.ts +1 -0
- package/wc/gv-code.js +1 -1
- package/wc/gv-confirm.d.ts +1 -0
- package/wc/gv-confirm.js +1 -1
- package/wc/gv-cron-editor.d.ts +1 -0
- package/wc/gv-cron-editor.js +1 -1
- package/wc/gv-date-picker-calendar.d.ts +1 -0
- package/wc/gv-date-picker-calendar.js +1 -1
- package/wc/gv-date-picker-cell.d.ts +1 -0
- package/wc/gv-date-picker-cell.js +1 -1
- package/wc/gv-date-picker.d.ts +1 -0
- package/wc/gv-date-picker.js +1 -1
- package/wc/gv-documentation.d.ts +1 -0
- package/wc/gv-documentation.js +1 -1
- package/wc/gv-dropdown-menu.d.ts +1 -0
- package/wc/gv-dropdown-menu.js +1 -1
- package/wc/gv-expandable.d.ts +1 -0
- package/wc/gv-expandable.js +1 -1
- package/wc/gv-expression-language.d.ts +1 -0
- package/wc/gv-expression-language.js +1 -1
- package/wc/gv-file-upload.d.ts +1 -0
- package/wc/gv-file-upload.js +1 -1
- package/wc/gv-flow-step.d.ts +1 -0
- package/wc/gv-flow-step.js +1 -1
- package/wc/gv-flow.d.ts +1 -0
- package/wc/gv-flow.js +1 -1
- package/wc/gv-header.d.ts +1 -0
- package/wc/gv-header.js +1 -1
- package/wc/gv-http-client.d.ts +1 -0
- package/wc/gv-http-client.js +1 -1
- package/wc/gv-icon.d.ts +1 -0
- package/wc/gv-icon.js +1 -1
- package/wc/gv-identity-picture.d.ts +1 -0
- package/wc/gv-identity-picture.js +1 -1
- package/wc/gv-image.d.ts +1 -0
- package/wc/gv-image.js +1 -1
- package/wc/gv-input-message.d.ts +1 -0
- package/wc/gv-input-message.js +1 -1
- package/wc/gv-input.d.ts +1 -0
- package/wc/gv-input.js +1 -1
- package/wc/gv-link.d.ts +1 -0
- package/wc/gv-link.js +1 -1
- package/wc/gv-list.d.ts +1 -0
- package/wc/gv-list.js +1 -1
- package/wc/gv-menu.d.ts +1 -0
- package/wc/gv-menu.js +1 -1
- package/wc/gv-message.d.ts +1 -0
- package/wc/gv-message.js +1 -1
- package/wc/gv-metric.d.ts +1 -0
- package/wc/gv-metric.js +1 -1
- package/wc/gv-metrics.d.ts +1 -0
- package/wc/gv-metrics.js +1 -1
- package/wc/gv-modal.d.ts +1 -0
- package/wc/gv-modal.js +1 -1
- package/wc/gv-nav.d.ts +1 -0
- package/wc/gv-nav.js +1 -1
- package/wc/gv-newsletter-subscription.d.ts +1 -0
- package/wc/gv-newsletter-subscription.js +1 -1
- package/wc/gv-option.d.ts +1 -0
- package/wc/gv-option.js +1 -1
- package/wc/gv-pagination.d.ts +1 -0
- package/wc/gv-pagination.js +1 -1
- package/wc/gv-plans.d.ts +1 -0
- package/wc/gv-plans.js +1 -1
- package/wc/gv-policy-studio-menu.d.ts +1 -0
- package/wc/gv-policy-studio-menu.js +1 -1
- package/wc/gv-policy-studio.d.ts +1 -0
- package/wc/gv-policy-studio.js +1 -1
- package/wc/gv-popover.d.ts +1 -0
- package/wc/gv-popover.js +1 -1
- package/wc/gv-promote.d.ts +1 -0
- package/wc/gv-promote.js +1 -1
- package/wc/gv-properties.d.ts +1 -0
- package/wc/gv-properties.js +1 -1
- package/wc/gv-rating-list.d.ts +1 -0
- package/wc/gv-rating-list.js +1 -1
- package/wc/gv-rating.d.ts +1 -0
- package/wc/gv-rating.js +1 -1
- package/wc/gv-relative-time.d.ts +1 -0
- package/wc/gv-relative-time.js +1 -1
- package/wc/gv-resizable-views.d.ts +1 -0
- package/wc/gv-resizable-views.js +1 -1
- package/wc/gv-resources.d.ts +1 -0
- package/wc/gv-resources.js +1 -1
- package/wc/gv-row-expandable.d.ts +1 -0
- package/wc/gv-row-expandable.js +1 -1
- package/wc/gv-row.d.ts +1 -0
- package/wc/gv-row.js +1 -1
- package/wc/gv-schema-form-array.d.ts +1 -0
- package/wc/gv-schema-form-array.js +1 -1
- package/wc/gv-schema-form-control-object.d.ts +1 -0
- package/wc/gv-schema-form-control-object.js +1 -1
- package/wc/gv-schema-form-control.d.ts +1 -0
- package/wc/gv-schema-form-control.js +1 -1
- package/wc/gv-schema-form.d.ts +1 -0
- package/wc/gv-schema-form.js +1 -1
- package/wc/gv-select-native.d.ts +1 -0
- package/wc/gv-select-native.js +1 -1
- package/wc/gv-select.d.ts +1 -0
- package/wc/gv-select.js +1 -1
- package/wc/gv-spinner.d.ts +1 -0
- package/wc/gv-spinner.js +1 -1
- package/wc/gv-state.d.ts +1 -0
- package/wc/gv-state.js +1 -1
- package/wc/gv-stats.d.ts +1 -0
- package/wc/gv-stats.js +1 -1
- package/wc/gv-stepper.d.ts +1 -0
- package/wc/gv-stepper.js +1 -1
- package/wc/gv-switch.d.ts +1 -0
- package/wc/gv-switch.js +1 -1
- package/wc/gv-table.d.ts +1 -0
- package/wc/gv-table.js +1 -1
- package/wc/gv-tabs.d.ts +1 -0
- package/wc/gv-tabs.js +1 -1
- package/wc/gv-tag.d.ts +1 -0
- package/wc/gv-tag.js +1 -1
- package/wc/gv-text.d.ts +1 -0
- package/wc/gv-text.js +1 -1
- package/wc/gv-theme.d.ts +1 -0
- package/wc/gv-theme.js +1 -1
- package/wc/gv-tree.d.ts +1 -0
- package/wc/gv-tree.js +1 -1
- package/wc/gv-user-menu.d.ts +1 -0
- package/wc/gv-user-menu.js +1 -1
- package/wc/gv-vertical-menu.d.ts +1 -0
- 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>`:""}}};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a mixin for ItemResource
|
|
3
|
+
* @mixinFunction
|
|
4
|
+
*/
|
|
5
|
+
export function ItemResource(ParentClass: any): {
|
|
6
|
+
new (): {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
_skeletonAttribute: string;
|
|
9
|
+
_onImageLoaded(): void;
|
|
10
|
+
_skeleton: boolean;
|
|
11
|
+
_renderImage(): "" | import("lit-html").TemplateResult<1>;
|
|
12
|
+
_onTagClick(tagValue: any, event: any): void;
|
|
13
|
+
_renderLabels(clickable: any): unknown;
|
|
14
|
+
_renderStates(): unknown;
|
|
15
|
+
_onClickToMetrics(event: any): void;
|
|
16
|
+
_renderMetricsWithRating(): "" | import("lit-html").TemplateResult<1>;
|
|
17
|
+
_renderInfoRating(): "" | import("lit-html").TemplateResult<1>;
|
|
18
|
+
_invisible: boolean;
|
|
19
|
+
_error: boolean;
|
|
20
|
+
_empty: boolean;
|
|
21
|
+
updated(changedProperties: any): void;
|
|
22
|
+
};
|
|
23
|
+
readonly properties: {
|
|
24
|
+
/** @required */
|
|
25
|
+
item: {
|
|
26
|
+
type: ObjectConstructor;
|
|
27
|
+
};
|
|
28
|
+
href: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
};
|
|
31
|
+
metrics: {
|
|
32
|
+
type: ObjectConstructor;
|
|
33
|
+
};
|
|
34
|
+
_item: {
|
|
35
|
+
type: ObjectConstructor;
|
|
36
|
+
attribute: boolean;
|
|
37
|
+
};
|
|
38
|
+
_invisible: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
reflect: boolean;
|
|
41
|
+
};
|
|
42
|
+
_skeleton: {
|
|
43
|
+
type: BooleanConstructor;
|
|
44
|
+
attribute: boolean;
|
|
45
|
+
};
|
|
46
|
+
_error: {
|
|
47
|
+
type: BooleanConstructor;
|
|
48
|
+
attribute: boolean;
|
|
49
|
+
};
|
|
50
|
+
_empty: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
attribute: boolean;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readonly styles: import("lit").CSSResult[];
|
|
56
|
+
};
|
|
@@ -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>`:""}}};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function KeyboardElement(ParentClass: any): {
|
|
2
|
+
new (): {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
_controller: {};
|
|
5
|
+
_handleKeyDown: (e: any) => void;
|
|
6
|
+
_handleKeyUp: (e: any) => void;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
disconnectedCallback(): void;
|
|
9
|
+
_onKeyDown(e: any): void;
|
|
10
|
+
_onKeyUp(e: any): void;
|
|
11
|
+
isPressed(...keys: any[]): boolean;
|
|
12
|
+
onKeyboard(controller: any): void;
|
|
13
|
+
};
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
};
|
|
16
|
+
export namespace KEYS {
|
|
17
|
+
const ArrowDown: string;
|
|
18
|
+
const ArrowLeft: string;
|
|
19
|
+
const ArrowRight: string;
|
|
20
|
+
const ArrowUp: string;
|
|
21
|
+
const Ctrl: string;
|
|
22
|
+
const Esc: string;
|
|
23
|
+
const Shift: string;
|
|
24
|
+
const Space: string;
|
|
25
|
+
}
|
|
@@ -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()}}};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function withResizeObserver(ParentClass: any): {
|
|
2
|
+
new (): {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
_onResize({ width }: {
|
|
5
|
+
width: any;
|
|
6
|
+
}): void;
|
|
7
|
+
connectedCallback(): Promise<void>;
|
|
8
|
+
_unobserveResize: (() => any) | undefined;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
};
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
};
|
|
@@ -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()}}};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a mixin for withSkeletonStates
|
|
3
|
+
* @mixinFunction
|
|
4
|
+
*/
|
|
5
|
+
export function withSkeletonAttribute(ParentClass: any): {
|
|
6
|
+
new (): {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
_invisible: boolean;
|
|
9
|
+
_skeleton: boolean;
|
|
10
|
+
_error: boolean;
|
|
11
|
+
_empty: boolean;
|
|
12
|
+
updated(changedProperties: any): void;
|
|
13
|
+
};
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
readonly properties: {
|
|
16
|
+
/** @required */
|
|
17
|
+
_invisible: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
reflect: boolean;
|
|
20
|
+
};
|
|
21
|
+
_skeleton: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
attribute: boolean;
|
|
24
|
+
};
|
|
25
|
+
_error: {
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
attribute: boolean;
|
|
28
|
+
};
|
|
29
|
+
_empty: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
attribute: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly styles: import("lit").CSSResult[];
|
|
35
|
+
};
|