@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,535 +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, LitElement } from 'lit';
|
|
17
|
-
|
|
18
|
-
import './gv-schema-form';
|
|
19
|
-
import './gv-resizable-views';
|
|
20
|
-
import './gv-documentation';
|
|
21
|
-
import '../molecules/gv-table';
|
|
22
|
-
import '../atoms/gv-button';
|
|
23
|
-
import '../molecules/gv-option';
|
|
24
|
-
import '../atoms/gv-switch';
|
|
25
|
-
import '../atoms/gv-icon';
|
|
26
|
-
import { dispatchCustomEvent } from '../lib/events';
|
|
27
|
-
import { uuid } from '../lib/utils';
|
|
28
|
-
import { KeyboardElement, KEYS } from '../mixins/keyboard-element';
|
|
29
|
-
import { empty } from '../styles/empty';
|
|
30
|
-
|
|
31
|
-
export class GvResources extends KeyboardElement(LitElement) {
|
|
32
|
-
static get properties() {
|
|
33
|
-
return {
|
|
34
|
-
resources: { type: Array },
|
|
35
|
-
_resources: { type: Array, attribute: false },
|
|
36
|
-
types: { type: Array },
|
|
37
|
-
documentation: { type: Object },
|
|
38
|
-
_currentResource: { type: Object, attribute: false },
|
|
39
|
-
_currentResourceLoading: { type: Boolean, attribute: false },
|
|
40
|
-
_filter: { type: String },
|
|
41
|
-
readonly: { type: Boolean, reflect: true },
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
constructor() {
|
|
46
|
-
super();
|
|
47
|
-
this.resources = [];
|
|
48
|
-
this.types = [];
|
|
49
|
-
this._currentResource = null;
|
|
50
|
-
this._emptymessage = 'No resource';
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
onKeyboard() {
|
|
54
|
-
if (this.isPressed(KEYS.Esc)) {
|
|
55
|
-
this._onCancelResourceForm();
|
|
56
|
-
}
|
|
57
|
-
if (this.isPressed(KEYS.Shift, KEYS.Ctrl, KEYS.Space)) {
|
|
58
|
-
const search = this.shadowRoot.querySelector('#search-resource');
|
|
59
|
-
if (search) {
|
|
60
|
-
search.focus();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
firstUpdated() {
|
|
66
|
-
const views = this.shadowRoot.querySelector('gv-resizable-views');
|
|
67
|
-
if (views != null) {
|
|
68
|
-
views.updateComplete.then(() => {
|
|
69
|
-
this._maximizeTopView();
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
set resources(resources) {
|
|
75
|
-
this._resources = this._generateId(resources);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
get resources() {
|
|
79
|
-
return this._resources;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
_generateId(list) {
|
|
83
|
-
if (list) {
|
|
84
|
-
return list.map((e) => {
|
|
85
|
-
if (e._id == null) {
|
|
86
|
-
e._id = uuid();
|
|
87
|
-
}
|
|
88
|
-
return e;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return list;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
_getResizableViews() {
|
|
95
|
-
return this.shadowRoot.querySelector('gv-resizable-views');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_maximizeTopView() {
|
|
99
|
-
this._getResizableViews().resize(60, 40);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
_maximizeBottomView() {
|
|
103
|
-
this._getResizableViews().maximizeBottom();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
_splitMainViews() {
|
|
107
|
-
this._getResizableViews().split();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
_onCancelResourceForm() {
|
|
111
|
-
this._currentResource = null;
|
|
112
|
-
this.documentation = null;
|
|
113
|
-
this._maximizeTopView();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
_removeResource(item) {
|
|
117
|
-
this.resources = this.resources.filter((resource) => resource._id !== item._id);
|
|
118
|
-
this._onCancelResourceForm();
|
|
119
|
-
dispatchCustomEvent(this, 'change', { resources: this.resources });
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
_buildResourceSchema(resourceType) {
|
|
123
|
-
const defaultSchema = {
|
|
124
|
-
properties: {
|
|
125
|
-
name: {
|
|
126
|
-
type: 'string',
|
|
127
|
-
title: 'Resource name',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
required: ['name'],
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const schema = typeof resourceType.schema === 'string' ? JSON.parse(resourceType.schema) : resourceType.schema;
|
|
134
|
-
|
|
135
|
-
return {
|
|
136
|
-
properties: { ...defaultSchema.properties, ...schema.properties },
|
|
137
|
-
required: [...defaultSchema.required, ...schema.required],
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
_onCreateResource({ detail }) {
|
|
142
|
-
this._currentResourceLoading = true;
|
|
143
|
-
const defaultResourceType = this.types.find((type) => type.id === detail.id);
|
|
144
|
-
const schema = this._buildResourceSchema(defaultResourceType);
|
|
145
|
-
this._currentResource = {
|
|
146
|
-
type: defaultResourceType.id,
|
|
147
|
-
title: 'Create resource',
|
|
148
|
-
icon: 'code:plus',
|
|
149
|
-
schema,
|
|
150
|
-
values: {},
|
|
151
|
-
submitLabel: 'Add',
|
|
152
|
-
dirty: true,
|
|
153
|
-
};
|
|
154
|
-
this._maximizeBottomView();
|
|
155
|
-
this._onFetchDocumentation();
|
|
156
|
-
setTimeout(() => (this._currentResourceLoading = false), 600);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
_onSubmitResourceForm({ detail }) {
|
|
160
|
-
delete this._currentResource._values;
|
|
161
|
-
const { type } = this._currentResource;
|
|
162
|
-
const { _id, name, ...configuration } = detail.values;
|
|
163
|
-
|
|
164
|
-
const resource = {
|
|
165
|
-
_id,
|
|
166
|
-
type,
|
|
167
|
-
name,
|
|
168
|
-
configuration,
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
if (detail.values._id != null) {
|
|
172
|
-
const index = this.resources.findIndex((r) => r._id === resource._id);
|
|
173
|
-
this.resources[index] = { ...this.resources[index], ...resource };
|
|
174
|
-
} else {
|
|
175
|
-
if (this.resources == null) {
|
|
176
|
-
this.resources = [];
|
|
177
|
-
}
|
|
178
|
-
resource._id = uuid();
|
|
179
|
-
resource.enabled = true;
|
|
180
|
-
this.resources.push(resource);
|
|
181
|
-
}
|
|
182
|
-
this._onCancelResourceForm();
|
|
183
|
-
dispatchCustomEvent(this, 'change', { resources: this.resources });
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
_onChangeResourceForm({ detail }) {
|
|
187
|
-
this._currentResource._values = detail.values;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
_onResetResourceForm() {
|
|
191
|
-
delete this._currentResource._values;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
_findResourceById(id) {
|
|
195
|
-
return this.types.find((resource) => resource.id === id);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// For readonly mode
|
|
199
|
-
_onSelectResource({ detail: { items } }) {
|
|
200
|
-
if (items.length > 0) {
|
|
201
|
-
this._onEditResource(items[0]);
|
|
202
|
-
} else {
|
|
203
|
-
this._onCancelResourceForm();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
_onEditResource(resource) {
|
|
208
|
-
const values = { ...resource, ...resource.configuration };
|
|
209
|
-
delete values.configuration;
|
|
210
|
-
const resourceType = this._findResourceById(resource.type);
|
|
211
|
-
this._currentResource = {
|
|
212
|
-
_id: resource._id,
|
|
213
|
-
title: 'Resource configuration',
|
|
214
|
-
type: resource.type,
|
|
215
|
-
icon: 'design:edit',
|
|
216
|
-
schema: this._buildResourceSchema(resourceType),
|
|
217
|
-
values,
|
|
218
|
-
submitLabel: 'Update',
|
|
219
|
-
};
|
|
220
|
-
this._splitMainViews();
|
|
221
|
-
this._onFetchDocumentation();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
_onCloseDocumentation() {
|
|
225
|
-
this.documentation = null;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
_getCurrentResourceType() {
|
|
229
|
-
return this._currentResource ? this._findResourceById(this._currentResource.type) : null;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
_onFetchDocumentation() {
|
|
233
|
-
dispatchCustomEvent(this, 'fetch-documentation', { target: this, resourceType: this._getCurrentResourceType() });
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
get dirty() {
|
|
237
|
-
const form = this.shadowRoot.querySelector('gv-schema-form');
|
|
238
|
-
return form && form.dirty;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
confirm() {
|
|
242
|
-
const form = this.shadowRoot.querySelector('gv-schema-form');
|
|
243
|
-
if (form) {
|
|
244
|
-
return form.confirm().then(() => this._onCancelResourceForm());
|
|
245
|
-
}
|
|
246
|
-
return Promise.resolve();
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
_onChangeResourceState(item, event) {
|
|
250
|
-
const index = this.resources.find((r) => r._id === item._id);
|
|
251
|
-
this.resources[index] = { ...this.resources[index], enabled: item.enabled };
|
|
252
|
-
dispatchCustomEvent(this, 'change', { resources: this.resources });
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
_renderForm() {
|
|
256
|
-
const values = { ...this._currentResource.values, ...this._currentResource._values };
|
|
257
|
-
return html`<gv-schema-form
|
|
258
|
-
scrollable
|
|
259
|
-
.schema="${this._currentResource.schema}"
|
|
260
|
-
.values="${values}"
|
|
261
|
-
submitLabel="${this._currentResource.submitLabel}"
|
|
262
|
-
has-header
|
|
263
|
-
.icon="${this._currentResource.icon}"
|
|
264
|
-
validate-on-render
|
|
265
|
-
.dirty="${this._currentResource.dirty || this._currentResource._values != null}"
|
|
266
|
-
?readonly="${this.readonly}"
|
|
267
|
-
@gv-schema-form:change="${this._onChangeResourceForm}"
|
|
268
|
-
@gv-schema-form:reset="${this._onResetResourceForm}"
|
|
269
|
-
@gv-schema-form:submit="${this._onSubmitResourceForm}"
|
|
270
|
-
>
|
|
271
|
-
<div slot="title" class="form-title">${this._currentResource.title}</div>
|
|
272
|
-
<gv-button
|
|
273
|
-
slot="header-left"
|
|
274
|
-
icon="general:close"
|
|
275
|
-
outlined
|
|
276
|
-
small
|
|
277
|
-
@gv-button:click="${this._onCancelResourceForm}"
|
|
278
|
-
title="Close (esc)"
|
|
279
|
-
></gv-button>
|
|
280
|
-
<gv-button
|
|
281
|
-
slot="header-left"
|
|
282
|
-
icon="home:book"
|
|
283
|
-
?disabled="${this.documentation != null}"
|
|
284
|
-
outlined
|
|
285
|
-
small
|
|
286
|
-
@gv-button:click="${this._onFetchDocumentation}"
|
|
287
|
-
title="Open documentation"
|
|
288
|
-
></gv-button>
|
|
289
|
-
</gv-schema-form>`;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
_renderDoc() {
|
|
293
|
-
return html`<gv-documentation
|
|
294
|
-
.text="${this.documentation.content}"
|
|
295
|
-
.image="${this.documentation.image}"
|
|
296
|
-
@gv-documentation:close="${this._onCloseDocumentation}"
|
|
297
|
-
></gv-documentation>`;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
_renderBottom() {
|
|
301
|
-
if (this.documentation && this._currentResource) {
|
|
302
|
-
return html` <gv-resizable-views direction="horizontal" no-overflow>
|
|
303
|
-
<div slot="top">${this._renderForm()}</div>
|
|
304
|
-
<div slot="bottom">${this._renderDoc()}</div>
|
|
305
|
-
</gv-resizable-views>`;
|
|
306
|
-
} else if (this._currentResource) {
|
|
307
|
-
return this._renderForm();
|
|
308
|
-
} else if (this.documentation) {
|
|
309
|
-
return this._renderDoc();
|
|
310
|
-
} else if (this.readonly !== true) {
|
|
311
|
-
const resourceOpts = this.types.map((resource) => {
|
|
312
|
-
return { id: resource.id, title: resource.name, description: resource.description, image: resource.icon };
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
return html`<div class="resources-bottom-container">
|
|
316
|
-
<gv-option class="resource__option" .options="${resourceOpts}" @gv-option:select="${this._onCreateResource}">
|
|
317
|
-
</div>`;
|
|
318
|
-
} else if (this.readonly && this.resources.length > 0) {
|
|
319
|
-
return html`<div class="resources-bottom-container empty">You can see the resource configuration by clicking on it</div>`;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
_onSearchResource({ detail }) {
|
|
324
|
-
this._filter = detail;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
_onClearResource() {
|
|
328
|
-
this._filter = null;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
render() {
|
|
332
|
-
const options = {
|
|
333
|
-
selectable: true,
|
|
334
|
-
data: [
|
|
335
|
-
{ field: 'name', label: 'Name' },
|
|
336
|
-
{
|
|
337
|
-
field: 'type',
|
|
338
|
-
width: '50px',
|
|
339
|
-
type: 'gv-image',
|
|
340
|
-
attributes: {
|
|
341
|
-
src: (item) => {
|
|
342
|
-
const resourceType = this._findResourceById(item.type);
|
|
343
|
-
return resourceType ? resourceType.icon : null;
|
|
344
|
-
},
|
|
345
|
-
style: 'width:40px;height:40px;',
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
{ field: 'type', label: 'Type' },
|
|
349
|
-
{
|
|
350
|
-
field: 'enabled',
|
|
351
|
-
type: 'gv-switch',
|
|
352
|
-
title: (item) => (item.enabled ? 'Click to disable' : 'Click to enable'),
|
|
353
|
-
width: '50px',
|
|
354
|
-
attributes: {
|
|
355
|
-
readonly: this.readonly,
|
|
356
|
-
'ongv-switch:input': (item, event) => this._onChangeResourceState(item, event),
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
],
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
if (this.readonly !== true) {
|
|
363
|
-
options.data.push({
|
|
364
|
-
type: 'gv-button',
|
|
365
|
-
width: '50px',
|
|
366
|
-
attributes: {
|
|
367
|
-
onClick: (item) => this._removeResource(item),
|
|
368
|
-
title: 'remove',
|
|
369
|
-
danger: true,
|
|
370
|
-
outlined: true,
|
|
371
|
-
icon: 'home:trash',
|
|
372
|
-
},
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
const filteredResources =
|
|
377
|
-
this._filter != null
|
|
378
|
-
? this.resources.filter((resource) => {
|
|
379
|
-
return (resource.name.toLowerCase() + resource.type.toLowerCase()).includes(this._filter);
|
|
380
|
-
})
|
|
381
|
-
: this.resources;
|
|
382
|
-
|
|
383
|
-
return html`<div class="resources">
|
|
384
|
-
<gv-resizable-views no-overflow>
|
|
385
|
-
<div slot="top" class="box">
|
|
386
|
-
<div class="container">
|
|
387
|
-
<div class="header">
|
|
388
|
-
<div class="title">Manage global resources <span>(${this.resources.length})</span></div>
|
|
389
|
-
<gv-input
|
|
390
|
-
id="search-resource"
|
|
391
|
-
class="search-input"
|
|
392
|
-
placeholder="Filter resources (Shift + Ctrl + Space)"
|
|
393
|
-
type="search"
|
|
394
|
-
small
|
|
395
|
-
@gv-input:input="${this._onSearchResource}"
|
|
396
|
-
@gv-input:clear="${this._onClearResource}"
|
|
397
|
-
></gv-input>
|
|
398
|
-
</div>
|
|
399
|
-
<div class="content">
|
|
400
|
-
<div class="table-container">
|
|
401
|
-
<gv-table
|
|
402
|
-
.options="${options}"
|
|
403
|
-
.items="${filteredResources}"
|
|
404
|
-
emptymessage="${this._emptymessage}"
|
|
405
|
-
@gv-table:select="${this._onSelectResource}"
|
|
406
|
-
order="name"
|
|
407
|
-
rowheight="50px"
|
|
408
|
-
></gv-table>
|
|
409
|
-
</div>
|
|
410
|
-
</div>
|
|
411
|
-
</div>
|
|
412
|
-
</div>
|
|
413
|
-
<div slot="bottom">${this._renderBottom()}</div>
|
|
414
|
-
</gv-resizable-views>
|
|
415
|
-
</div>`;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
static get styles() {
|
|
419
|
-
return [
|
|
420
|
-
empty,
|
|
421
|
-
// language=CSS
|
|
422
|
-
css`
|
|
423
|
-
:host {
|
|
424
|
-
box-sizing: border-box;
|
|
425
|
-
height: 100%;
|
|
426
|
-
width: 100%;
|
|
427
|
-
display: block;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
.resources {
|
|
431
|
-
display: flex;
|
|
432
|
-
height: 100%;
|
|
433
|
-
width: 100%;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
gv-resizable-views {
|
|
437
|
-
height: 100%;
|
|
438
|
-
width: 100%;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
gv-table {
|
|
442
|
-
--gv-table-rows--ov: none;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
.header {
|
|
446
|
-
border-bottom: 1px solid #d9d9d9;
|
|
447
|
-
display: flex;
|
|
448
|
-
min-height: 45px;
|
|
449
|
-
align-items: center;
|
|
450
|
-
margin-bottom: 0.5rem;
|
|
451
|
-
padding: 0 0.5rem;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
.header .title {
|
|
455
|
-
color: #28444f;
|
|
456
|
-
font-size: 18px;
|
|
457
|
-
display: flex;
|
|
458
|
-
align-items: flex-end;
|
|
459
|
-
flex: 1;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.header .title span {
|
|
463
|
-
font-size: 12px;
|
|
464
|
-
margin-left: 8px;
|
|
465
|
-
opacity: 0.7;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
.box {
|
|
469
|
-
position: absolute;
|
|
470
|
-
display: flex;
|
|
471
|
-
flex-direction: column;
|
|
472
|
-
width: 100%;
|
|
473
|
-
top: 0;
|
|
474
|
-
bottom: 0;
|
|
475
|
-
left: 0;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
.container {
|
|
479
|
-
flex-grow: 1;
|
|
480
|
-
|
|
481
|
-
display: flex;
|
|
482
|
-
flex-direction: column;
|
|
483
|
-
|
|
484
|
-
/* for Firefox */
|
|
485
|
-
min-height: 0;
|
|
486
|
-
height: 100%;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
.content {
|
|
490
|
-
background: white;
|
|
491
|
-
flex-grow: 1;
|
|
492
|
-
|
|
493
|
-
overflow: auto;
|
|
494
|
-
|
|
495
|
-
/* for Firefox */
|
|
496
|
-
min-height: 0;
|
|
497
|
-
padding: 0.5rem;
|
|
498
|
-
|
|
499
|
-
display: flex;
|
|
500
|
-
flex-direction: column;
|
|
501
|
-
align-items: center;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
.form-title {
|
|
505
|
-
text-transform: uppercase;
|
|
506
|
-
letter-spacing: 0.2rem;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
.resources-bottom-container {
|
|
510
|
-
display: flex;
|
|
511
|
-
justify-content: center;
|
|
512
|
-
align-items: center;
|
|
513
|
-
height: 100%;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
.table-container {
|
|
517
|
-
max-width: 1200px;
|
|
518
|
-
display: flex;
|
|
519
|
-
flex-direction: column;
|
|
520
|
-
width: 100%;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
.search-input {
|
|
524
|
-
width: 300px;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.resource__option {
|
|
528
|
-
--gv-option-button--maw: 175px;
|
|
529
|
-
}
|
|
530
|
-
`,
|
|
531
|
-
];
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
window.customElements.define('gv-resources', GvResources);
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvResources=void 0;const e=require("lit");require("./gv-schema-form"),require("./gv-resizable-views"),require("./gv-documentation"),require("../molecules/gv-table"),require("../atoms/gv-button"),require("../molecules/gv-option"),require("../atoms/gv-switch"),require("../atoms/gv-icon");const t=require("../lib/events"),s=require("../lib/utils"),i=require("../mixins/keyboard-element"),r=require("../styles/empty");class o extends((0,i.KeyboardElement)(e.LitElement)){static get properties(){return{resources:{type:Array},_resources:{type:Array,attribute:!1},types:{type:Array},documentation:{type:Object},_currentResource:{type:Object,attribute:!1},_currentResourceLoading:{type:Boolean,attribute:!1},_filter:{type:String},readonly:{type:Boolean,reflect:!0}}}constructor(){super(),this.resources=[],this.types=[],this._currentResource=null,this._emptymessage="No resource"}onKeyboard(){if(this.isPressed(i.KEYS.Esc)&&this._onCancelResourceForm(),this.isPressed(i.KEYS.Shift,i.KEYS.Ctrl,i.KEYS.Space)){const e=this.shadowRoot.querySelector("#search-resource");e&&e.focus()}}firstUpdated(){const e=this.shadowRoot.querySelector("gv-resizable-views");null!=e&&e.updateComplete.then((()=>{this._maximizeTopView()}))}set resources(e){this._resources=this._generateId(e)}get resources(){return this._resources}_generateId(e){return e?e.map((e=>(null==e._id&&(e._id=(0,s.uuid)()),e))):e}_getResizableViews(){return this.shadowRoot.querySelector("gv-resizable-views")}_maximizeTopView(){this._getResizableViews().resize(60,40)}_maximizeBottomView(){this._getResizableViews().maximizeBottom()}_splitMainViews(){this._getResizableViews().split()}_onCancelResourceForm(){this._currentResource=null,this.documentation=null,this._maximizeTopView()}_removeResource(e){this.resources=this.resources.filter((t=>t._id!==e._id)),this._onCancelResourceForm(),(0,t.dispatchCustomEvent)(this,"change",{resources:this.resources})}_buildResourceSchema(e){const t={properties:{name:{type:"string",title:"Resource name"}},required:["name"]},s="string"==typeof e.schema?JSON.parse(e.schema):e.schema;return{properties:{...t.properties,...s.properties},required:[...t.required,...s.required]}}_onCreateResource({detail:e}){this._currentResourceLoading=!0;const t=this.types.find((t=>t.id===e.id)),s=this._buildResourceSchema(t);this._currentResource={type:t.id,title:"Create resource",icon:"code:plus",schema:s,values:{},submitLabel:"Add",dirty:!0},this._maximizeBottomView(),this._onFetchDocumentation(),setTimeout((()=>this._currentResourceLoading=!1),600)}_onSubmitResourceForm({detail:e}){delete this._currentResource._values;const{type:i}=this._currentResource,{_id:r,name:o,...n}=e.values,c={_id:r,type:i,name:o,configuration:n};if(null!=e.values._id){const e=this.resources.findIndex((e=>e._id===c._id));this.resources[e]={...this.resources[e],...c}}else null==this.resources&&(this.resources=[]),c._id=(0,s.uuid)(),c.enabled=!0,this.resources.push(c);this._onCancelResourceForm(),(0,t.dispatchCustomEvent)(this,"change",{resources:this.resources})}_onChangeResourceForm({detail:e}){this._currentResource._values=e.values}_onResetResourceForm(){delete this._currentResource._values}_findResourceById(e){return this.types.find((t=>t.id===e))}_onSelectResource({detail:{items:e}}){e.length>0?this._onEditResource(e[0]):this._onCancelResourceForm()}_onEditResource(e){const t={...e,...e.configuration};delete t.configuration;const s=this._findResourceById(e.type);this._currentResource={_id:e._id,title:"Resource configuration",type:e.type,icon:"design:edit",schema:this._buildResourceSchema(s),values:t,submitLabel:"Update"},this._splitMainViews(),this._onFetchDocumentation()}_onCloseDocumentation(){this.documentation=null}_getCurrentResourceType(){return this._currentResource?this._findResourceById(this._currentResource.type):null}_onFetchDocumentation(){(0,t.dispatchCustomEvent)(this,"fetch-documentation",{target:this,resourceType:this._getCurrentResourceType()})}get dirty(){const e=this.shadowRoot.querySelector("gv-schema-form");return e&&e.dirty}confirm(){const e=this.shadowRoot.querySelector("gv-schema-form");return e?e.confirm().then((()=>this._onCancelResourceForm())):Promise.resolve()}_onChangeResourceState(e,s){const i=this.resources.find((t=>t._id===e._id));this.resources[i]={...this.resources[i],enabled:e.enabled},(0,t.dispatchCustomEvent)(this,"change",{resources:this.resources})}_renderForm(){const t={...this._currentResource.values,...this._currentResource._values};return e.html`<gv-schema-form scrollable .schema="${this._currentResource.schema}" .values="${t}" submitLabel="${this._currentResource.submitLabel}" has-header .icon="${this._currentResource.icon}" validate-on-render .dirty="${this._currentResource.dirty||null!=this._currentResource._values}" ?readonly="${this.readonly}" @gv-schema-form:change="${this._onChangeResourceForm}" @gv-schema-form:reset="${this._onResetResourceForm}" @gv-schema-form:submit="${this._onSubmitResourceForm}"><div slot="title" class="form-title">${this._currentResource.title}</div><gv-button slot="header-left" icon="general:close" outlined small @gv-button:click="${this._onCancelResourceForm}" title="Close (esc)"></gv-button><gv-button slot="header-left" icon="home:book" ?disabled="${null!=this.documentation}" outlined small @gv-button:click="${this._onFetchDocumentation}" title="Open documentation"></gv-button></gv-schema-form>`}_renderDoc(){return e.html`<gv-documentation .text="${this.documentation.content}" .image="${this.documentation.image}" @gv-documentation:close="${this._onCloseDocumentation}"></gv-documentation>`}_renderBottom(){if(this.documentation&&this._currentResource)return e.html`<gv-resizable-views direction="horizontal" no-overflow><div slot="top">${this._renderForm()}</div><div slot="bottom">${this._renderDoc()}</div></gv-resizable-views>`;if(this._currentResource)return this._renderForm();if(this.documentation)return this._renderDoc();if(!0!==this.readonly){const t=this.types.map((e=>({id:e.id,title:e.name,description:e.description,image:e.icon})));return e.html`<div class="resources-bottom-container"><gv-option class="resource__option" .options="${t}" @gv-option:select="${this._onCreateResource}"></gv-option></div>`}return this.readonly&&this.resources.length>0?e.html`<div class="resources-bottom-container empty">You can see the resource configuration by clicking on it</div>`:void 0}_onSearchResource({detail:e}){this._filter=e}_onClearResource(){this._filter=null}render(){const t={selectable:!0,data:[{field:"name",label:"Name"},{field:"type",width:"50px",type:"gv-image",attributes:{src:e=>{const t=this._findResourceById(e.type);return t?t.icon:null},style:"width:40px;height:40px;"}},{field:"type",label:"Type"},{field:"enabled",type:"gv-switch",title:e=>e.enabled?"Click to disable":"Click to enable",width:"50px",attributes:{readonly:this.readonly,"ongv-switch:input":(e,t)=>this._onChangeResourceState(e,t)}}]};!0!==this.readonly&&t.data.push({type:"gv-button",width:"50px",attributes:{onClick:e=>this._removeResource(e),title:"remove",danger:!0,outlined:!0,icon:"home:trash"}});const s=null!=this._filter?this.resources.filter((e=>(e.name.toLowerCase()+e.type.toLowerCase()).includes(this._filter))):this.resources;return e.html`<div class="resources"><gv-resizable-views no-overflow><div slot="top" class="box"><div class="container"><div class="header"><div class="title">Manage global resources <span>(${this.resources.length})</span></div><gv-input id="search-resource" class="search-input" placeholder="Filter resources (Shift + Ctrl + Space)" type="search" small @gv-input:input="${this._onSearchResource}" @gv-input:clear="${this._onClearResource}"></gv-input></div><div class="content"><div class="table-container"><gv-table .options="${t}" .items="${s}" emptymessage="${this._emptymessage}" @gv-table:select="${this._onSelectResource}" order="name" rowheight="50px"></gv-table></div></div></div></div><div slot="bottom">${this._renderBottom()}</div></gv-resizable-views></div>`}static get styles(){return[r.empty,e.css`:host{box-sizing:border-box;height:100%;width:100%;display:block}.resources{display:flex;height:100%;width:100%}gv-resizable-views{height:100%;width:100%}gv-table{--gv-table-rows--ov:none}.header{border-bottom:1px solid #d9d9d9;display:flex;min-height:45px;align-items:center;margin-bottom:.5rem;padding:0 .5rem}.header .title{color:#28444f;font-size:18px;display:flex;align-items:flex-end;flex:1}.header .title span{font-size:12px;margin-left:8px;opacity:.7}.box{position:absolute;display:flex;flex-direction:column;width:100%;top:0;bottom:0;left:0}.container{flex-grow:1;display:flex;flex-direction:column;min-height:0;height:100%}.content{background:#fff;flex-grow:1;overflow:auto;min-height:0;padding:.5rem;display:flex;flex-direction:column;align-items:center}.form-title{text-transform:uppercase;letter-spacing:.2rem}.resources-bottom-container{display:flex;justify-content:center;align-items:center;height:100%}.table-container{max-width:1200px;display:flex;flex-direction:column;width:100%}.search-input{width:300px}.resource__option{--gv-option-button--maw:175px}`]}}exports.GvResources=o,window.customElements.define("gv-resources",o);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
declare const GvSchemaFormArray_base: {
|
|
2
|
+
new (): {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
performUpdate(): Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Schema form array component
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export class GvSchemaFormArray extends GvSchemaFormArray_base {
|
|
13
|
+
static get properties(): {
|
|
14
|
+
schema: {
|
|
15
|
+
type: ObjectConstructor;
|
|
16
|
+
};
|
|
17
|
+
value: {
|
|
18
|
+
type: ArrayConstructor;
|
|
19
|
+
};
|
|
20
|
+
id: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
reflect: boolean;
|
|
23
|
+
};
|
|
24
|
+
title: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
reflect: boolean;
|
|
27
|
+
};
|
|
28
|
+
description: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
};
|
|
31
|
+
skeleton: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
reflect: boolean;
|
|
34
|
+
};
|
|
35
|
+
errors: {
|
|
36
|
+
type: ArrayConstructor;
|
|
37
|
+
};
|
|
38
|
+
readonly: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
reflect: boolean;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
static get styles(): import("lit").CSSResult[];
|
|
44
|
+
value: any[];
|
|
45
|
+
_onNew(): void;
|
|
46
|
+
_onRemove(index: any): void;
|
|
47
|
+
_renderValue(value: any, index: any): import("lit-html").TemplateResult<1>;
|
|
48
|
+
_onMouseLeave(): void;
|
|
49
|
+
getControls(): any[];
|
|
50
|
+
getControl(id: any): any;
|
|
51
|
+
getUpdateComplete(): Promise<void>;
|
|
52
|
+
shouldUpdate(changedProperties: any): any;
|
|
53
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|