@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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabs component
|
|
3
|
+
*
|
|
4
|
+
* * ## Details
|
|
5
|
+
* * This component use gv-option component to generate tabs.
|
|
6
|
+
*
|
|
7
|
+
* @attr {Array<id: string | {id, title?, icon?, active?, description?, label?}>} options - An array of options for gv-option sub component
|
|
8
|
+
* @slot content - List of elements for tabs content. Should have an id related to options.
|
|
9
|
+
*
|
|
10
|
+
* @attr {String} value - the opened tab id
|
|
11
|
+
* @attr {Boolean} disabled - true if disabled
|
|
12
|
+
* @attr {Boolean} small - true if you want display tabs below of title
|
|
13
|
+
* @attr {Boolean} truncate - true if you want truncate tabs title
|
|
14
|
+
* @attr {Function} validator - a function that's calls when user change tab, this is useful to validate tab change.
|
|
15
|
+
*
|
|
16
|
+
* @cssprop {Length} [--gv-tabs-options--m=0] - Tabs options margin
|
|
17
|
+
*/
|
|
18
|
+
export class GvTabs extends LitElement {
|
|
19
|
+
static get properties(): {
|
|
20
|
+
options: {
|
|
21
|
+
type: ArrayConstructor;
|
|
22
|
+
};
|
|
23
|
+
_options: {
|
|
24
|
+
type: ArrayConstructor;
|
|
25
|
+
attribute: boolean;
|
|
26
|
+
};
|
|
27
|
+
value: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
reflect: boolean;
|
|
30
|
+
};
|
|
31
|
+
validator: {
|
|
32
|
+
type: FunctionConstructor;
|
|
33
|
+
};
|
|
34
|
+
disabled: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
};
|
|
37
|
+
small: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
};
|
|
40
|
+
truncate: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
static get styles(): import("lit").CSSResult[];
|
|
45
|
+
_getContent(): any;
|
|
46
|
+
value: any;
|
|
47
|
+
set options(arg: any);
|
|
48
|
+
get options(): any;
|
|
49
|
+
_options: any;
|
|
50
|
+
_changeTab(from: any, content: any, value: any): void;
|
|
51
|
+
_onClick({ detail }: {
|
|
52
|
+
detail: any;
|
|
53
|
+
}): void;
|
|
54
|
+
get _contextualOptions(): any;
|
|
55
|
+
}
|
|
56
|
+
import { LitElement } from "lit-element/lit-element";
|
package/src/organisms/gv-tabs.js
CHANGED
|
@@ -1,210 +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, LitElement, html } from 'lit';
|
|
17
|
-
import '../molecules/gv-option';
|
|
18
|
-
import { dispatchCustomEvent } from '../lib/events';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Tabs component
|
|
22
|
-
*
|
|
23
|
-
* * ## Details
|
|
24
|
-
* * This component use gv-option component to generate tabs.
|
|
25
|
-
*
|
|
26
|
-
* @attr {Array<id: string | {id, title?, icon?, active?, description?, label?}>} options - An array of options for gv-option sub component
|
|
27
|
-
* @slot content - List of elements for tabs content. Should have an id related to options.
|
|
28
|
-
*
|
|
29
|
-
* @attr {String} value - the opened tab id
|
|
30
|
-
* @attr {Boolean} disabled - true if disabled
|
|
31
|
-
* @attr {Boolean} small - true if you want display tabs below of title
|
|
32
|
-
* @attr {Boolean} truncate - true if you want truncate tabs title
|
|
33
|
-
* @attr {Function} validator - a function that's calls when user change tab, this is useful to validate tab change.
|
|
34
|
-
*
|
|
35
|
-
* @cssprop {Length} [--gv-tabs-options--m=0] - Tabs options margin
|
|
36
|
-
*/
|
|
37
|
-
export class GvTabs extends LitElement {
|
|
38
|
-
static get properties() {
|
|
39
|
-
return {
|
|
40
|
-
options: { type: Array },
|
|
41
|
-
_options: { type: Array, attribute: false },
|
|
42
|
-
value: { type: String, reflect: true },
|
|
43
|
-
validator: { type: Function },
|
|
44
|
-
disabled: { type: Boolean },
|
|
45
|
-
small: { type: Boolean },
|
|
46
|
-
truncate: { type: Boolean },
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
static get styles() {
|
|
51
|
-
return [
|
|
52
|
-
// language=css
|
|
53
|
-
css`
|
|
54
|
-
:host {
|
|
55
|
-
box-sizing: border-box;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
::slotted([slot='content']) {
|
|
59
|
-
opacity: 0;
|
|
60
|
-
box-sizing: border-box;
|
|
61
|
-
transition: opacity 350ms ease-in-out;
|
|
62
|
-
visibility: hidden;
|
|
63
|
-
position: absolute;
|
|
64
|
-
left: -9999px;
|
|
65
|
-
top: -9999px;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
::slotted([slot='content'].current) {
|
|
69
|
-
opacity: 1;
|
|
70
|
-
visibility: visible;
|
|
71
|
-
position: relative;
|
|
72
|
-
left: auto;
|
|
73
|
-
top: auto;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.header {
|
|
77
|
-
display: flex;
|
|
78
|
-
border-bottom: 1px solid #d9d9d9;
|
|
79
|
-
box-sizing: border-box;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.title {
|
|
83
|
-
flex: 1;
|
|
84
|
-
display: flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.actions {
|
|
89
|
-
display: flex;
|
|
90
|
-
align-items: center;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.tabs {
|
|
94
|
-
flex: 1;
|
|
95
|
-
display: flex;
|
|
96
|
-
justify-content: flex-end;
|
|
97
|
-
--gv-option--bdrs: 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
:host([small]) .tabs {
|
|
101
|
-
flex-direction: column;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
:host([small]) gv-option {
|
|
105
|
-
align-self: flex-end;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
gv-option {
|
|
109
|
-
margin: var(--gv-tabs-options--m, 0);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
::slotted(gv-button) {
|
|
113
|
-
padding-bottom: 2px;
|
|
114
|
-
}
|
|
115
|
-
`,
|
|
116
|
-
];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
_getContent() {
|
|
120
|
-
const content = this.shadowRoot.querySelector('slot[name="content"]');
|
|
121
|
-
return content.assignedNodes();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
firstUpdated() {
|
|
125
|
-
if (this.value == null && this.options != null && this.options.length > 0) {
|
|
126
|
-
this.value = this.options[0].id;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
set options(options) {
|
|
131
|
-
if (options && Array.isArray(options)) {
|
|
132
|
-
this._options = options.map((option) => {
|
|
133
|
-
if (typeof option === 'string') {
|
|
134
|
-
return { id: option, title: option };
|
|
135
|
-
} else if (typeof option === 'object' && option.title == null) {
|
|
136
|
-
return { id: option.id, title: option.id };
|
|
137
|
-
}
|
|
138
|
-
return option;
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
get options() {
|
|
144
|
-
return this._options;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
updated() {
|
|
148
|
-
const content = this._getContent();
|
|
149
|
-
content.forEach((c) => c.classList.remove('current'));
|
|
150
|
-
if (this.value) {
|
|
151
|
-
const target = this.querySelector(`#${this.value}`);
|
|
152
|
-
if (target) {
|
|
153
|
-
target.classList.add('current');
|
|
154
|
-
}
|
|
155
|
-
} else {
|
|
156
|
-
content[0].classList.add('current');
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
_changeTab(from, content, value) {
|
|
161
|
-
from.classList.remove('current');
|
|
162
|
-
content.classList.add('current');
|
|
163
|
-
this.value = value;
|
|
164
|
-
dispatchCustomEvent(this, 'change', { value, from: from.id, to: content.id });
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
_onClick({ detail }) {
|
|
168
|
-
if (!this.disabled) {
|
|
169
|
-
const from = this._getContent().find((e) => e.classList.contains('current'));
|
|
170
|
-
const content = this.querySelector(`#${detail.id}`);
|
|
171
|
-
this.shadowRoot.querySelector('gv-option').value = from.id;
|
|
172
|
-
if (this.validator) {
|
|
173
|
-
this.validator({ from: from.id, to: content.id })
|
|
174
|
-
.then(() => {
|
|
175
|
-
this._changeTab(from, content, detail.id);
|
|
176
|
-
})
|
|
177
|
-
.catch(() => {});
|
|
178
|
-
} else {
|
|
179
|
-
this._changeTab(from, content, detail.id);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
get _contextualOptions() {
|
|
185
|
-
if (this.truncate) {
|
|
186
|
-
return this.options.map((option) => {
|
|
187
|
-
if (this.value !== option.id) {
|
|
188
|
-
const label = option.label || option.title;
|
|
189
|
-
return { ...option, label: label.substring(0, 1) };
|
|
190
|
-
}
|
|
191
|
-
return option;
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
return this.options;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
render() {
|
|
198
|
-
return html`<div>
|
|
199
|
-
<div class="header">
|
|
200
|
-
<div class="tabs">
|
|
201
|
-
<slot name="title" class="title"></slot>
|
|
202
|
-
<gv-option small .options="${this._contextualOptions}" @gv-option:select="${this._onClick}" .value="${this.value}"></gv-option>
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
<slot name="content"></slot>
|
|
206
|
-
</div>`;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
window.customElements.define('gv-tabs', GvTabs);
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvTabs=void 0;const t=require("lit");require("../molecules/gv-option");const e=require("../lib/events");class i extends t.LitElement{static get properties(){return{options:{type:Array},_options:{type:Array,attribute:!1},value:{type:String,reflect:!0},validator:{type:Function},disabled:{type:Boolean},small:{type:Boolean},truncate:{type:Boolean}}}static get styles(){return[t.css`:host{box-sizing:border-box}::slotted([slot=content]){opacity:0;box-sizing:border-box;transition:opacity 350ms ease-in-out;visibility:hidden;position:absolute;left:-9999px;top:-9999px}::slotted([slot=content].current){opacity:1;visibility:visible;position:relative;left:auto;top:auto}.header{display:flex;border-bottom:1px solid #d9d9d9;box-sizing:border-box}.title{flex:1;display:flex;align-items:center}.actions{display:flex;align-items:center}.tabs{flex:1;display:flex;justify-content:flex-end;--gv-option--bdrs:0}:host([small]) .tabs{flex-direction:column}:host([small]) gv-option{align-self:flex-end}gv-option{margin:var(--gv-tabs-options--m,0)}::slotted(gv-button){padding-bottom:2px}`]}_getContent(){return this.shadowRoot.querySelector('slot[name="content"]').assignedNodes()}firstUpdated(){null==this.value&&null!=this.options&&this.options.length>0&&(this.value=this.options[0].id)}set options(t){t&&Array.isArray(t)&&(this._options=t.map((t=>"string"==typeof t?{id:t,title:t}:"object"==typeof t&&null==t.title?{id:t.id,title:t.id}:t)))}get options(){return this._options}updated(){const t=this._getContent();if(t.forEach((t=>t.classList.remove("current"))),this.value){const t=this.querySelector(`#${this.value}`);t&&t.classList.add("current")}else t[0].classList.add("current")}_changeTab(t,i,s){t.classList.remove("current"),i.classList.add("current"),this.value=s,(0,e.dispatchCustomEvent)(this,"change",{value:s,from:t.id,to:i.id})}_onClick({detail:t}){if(!this.disabled){const e=this._getContent().find((t=>t.classList.contains("current"))),i=this.querySelector(`#${t.id}`);this.shadowRoot.querySelector("gv-option").value=e.id,this.validator?this.validator({from:e.id,to:i.id}).then((()=>{this._changeTab(e,i,t.id)})).catch((()=>{})):this._changeTab(e,i,t.id)}}get _contextualOptions(){return this.truncate?this.options.map((t=>{if(this.value!==t.id){const e=t.label||t.title;return{...t,label:e.substring(0,1)}}return t})):this.options}render(){return t.html`<div><div class="header"><div class="tabs"><slot name="title" class="title"></slot><gv-option small .options="${this._contextualOptions}" @gv-option:select="${this._onClick}" .value="${this.value}"></gv-option></div></div><slot name="content"></slot></div>`}}exports.GvTabs=i,window.customElements.define("gv-tabs",i);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User menu
|
|
3
|
+
*
|
|
4
|
+
* ## Details
|
|
5
|
+
* * has @theme facet
|
|
6
|
+
*
|
|
7
|
+
* @fires gv-link:click - Custom event when nav link click
|
|
8
|
+
*
|
|
9
|
+
* @attr {Array} routes - definition of user routes [{icon: String, path: String, title: Promise<String>, active: Boolean, routes: Array<any>]
|
|
10
|
+
* @attr {String} username - name of the user
|
|
11
|
+
* @attr {String} avatar - url of the user avatar
|
|
12
|
+
*
|
|
13
|
+
* @cssprop {Color} [--gv-user-menu--c=var(--gv-theme-font-color-dark, #262626)] - Color
|
|
14
|
+
* @cssprop {Color} [--gv-user-menu-hover--c=var(--gv-theme-color-dark, #28444f)] - Hover color
|
|
15
|
+
* @cssprop {Color} [--gv-user-menu--bgc=transparent] - Background color
|
|
16
|
+
* @cssprop {Color} [--gv-user-menu-list--bgc=var(--gv-theme-neutral-color-lightest, #ffffff)] - List background color
|
|
17
|
+
* @cssprop {Color} [--gv-user-menu-hover--bgc=var(--gv-theme-color-light, #86c3d0)] - Hover background color
|
|
18
|
+
* @cssprop {Color} [--gv-user-menu--bdc=lightgrey] - Border color
|
|
19
|
+
* @cssprop {String} [--gv-user-menu--tsh=none] - Text shadow
|
|
20
|
+
* @cssprop {Color} [--gv-user-menu-icon--c=var(--gv-theme-neutral-color-darkest, #000000)] - Icon color
|
|
21
|
+
* @cssprop {Length} [--gv-user-menu-icon--s=16px] - Height and icon width
|
|
22
|
+
* @cssprop {Length} [--gv-user-menu-link-a--ph=0px] - Link horizontal padding
|
|
23
|
+
* @cssprop {String} [--gv-user-menu-link--ta=right] - Text align
|
|
24
|
+
*/
|
|
25
|
+
export class GvUserMenu extends LitElement {
|
|
26
|
+
static get properties(): {
|
|
27
|
+
avatar: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
};
|
|
30
|
+
routes: {
|
|
31
|
+
type: ArrayConstructor;
|
|
32
|
+
};
|
|
33
|
+
_routes: {
|
|
34
|
+
type: ArrayConstructor;
|
|
35
|
+
attribute: boolean;
|
|
36
|
+
};
|
|
37
|
+
_isClosed: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
attribute: boolean;
|
|
40
|
+
};
|
|
41
|
+
username: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
static get styles(): import("lit").CSSResult[];
|
|
46
|
+
_isClosed: boolean;
|
|
47
|
+
_onClick(e: any): void;
|
|
48
|
+
_onMouseLeave(): void;
|
|
49
|
+
_onSelect(): void;
|
|
50
|
+
_hasOneItem(): boolean | null | undefined;
|
|
51
|
+
set routes(arg: any);
|
|
52
|
+
_routes: any[] | null | undefined;
|
|
53
|
+
_renderFirstItem(): import("lit-html").TemplateResult<1>;
|
|
54
|
+
_renderItem(route: any): any;
|
|
55
|
+
}
|
|
56
|
+
import { LitElement } from "lit-element/lit-element";
|
|
@@ -1,314 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { LitElement, html, css } from 'lit';
|
|
17
|
-
import '../molecules/gv-nav';
|
|
18
|
-
import { repeat } from 'lit/directives/repeat';
|
|
19
|
-
import { classMap } from 'lit/directives/class-map';
|
|
20
|
-
import { isSameRoutes } from '../lib/utils';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* User menu
|
|
24
|
-
*
|
|
25
|
-
* ## Details
|
|
26
|
-
* * has @theme facet
|
|
27
|
-
*
|
|
28
|
-
* @fires gv-link:click - Custom event when nav link click
|
|
29
|
-
*
|
|
30
|
-
* @attr {Array} routes - definition of user routes [{icon: String, path: String, title: Promise<String>, active: Boolean, routes: Array<any>]
|
|
31
|
-
* @attr {String} username - name of the user
|
|
32
|
-
* @attr {String} avatar - url of the user avatar
|
|
33
|
-
*
|
|
34
|
-
* @cssprop {Color} [--gv-user-menu--c=var(--gv-theme-font-color-dark, #262626)] - Color
|
|
35
|
-
* @cssprop {Color} [--gv-user-menu-hover--c=var(--gv-theme-color-dark, #28444f)] - Hover color
|
|
36
|
-
* @cssprop {Color} [--gv-user-menu--bgc=transparent] - Background color
|
|
37
|
-
* @cssprop {Color} [--gv-user-menu-list--bgc=var(--gv-theme-neutral-color-lightest, #ffffff)] - List background color
|
|
38
|
-
* @cssprop {Color} [--gv-user-menu-hover--bgc=var(--gv-theme-color-light, #86c3d0)] - Hover background color
|
|
39
|
-
* @cssprop {Color} [--gv-user-menu--bdc=lightgrey] - Border color
|
|
40
|
-
* @cssprop {String} [--gv-user-menu--tsh=none] - Text shadow
|
|
41
|
-
* @cssprop {Color} [--gv-user-menu-icon--c=var(--gv-theme-neutral-color-darkest, #000000)] - Icon color
|
|
42
|
-
* @cssprop {Length} [--gv-user-menu-icon--s=16px] - Height and icon width
|
|
43
|
-
* @cssprop {Length} [--gv-user-menu-link-a--ph=0px] - Link horizontal padding
|
|
44
|
-
* @cssprop {String} [--gv-user-menu-link--ta=right] - Text align
|
|
45
|
-
*/
|
|
46
|
-
export class GvUserMenu extends LitElement {
|
|
47
|
-
static get properties() {
|
|
48
|
-
return {
|
|
49
|
-
avatar: { type: String },
|
|
50
|
-
routes: { type: Array },
|
|
51
|
-
_routes: { type: Array, attribute: false },
|
|
52
|
-
_isClosed: { type: Boolean, attribute: false },
|
|
53
|
-
username: { type: String },
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
static get styles() {
|
|
58
|
-
return [
|
|
59
|
-
// language=css
|
|
60
|
-
css`
|
|
61
|
-
:host {
|
|
62
|
-
--bdc: var(--gv-user-menu--bdc, lightgrey);
|
|
63
|
-
--c: var(--gv-user-menu--c, var(--gv-theme-font-color-dark, #262626));
|
|
64
|
-
--bgc: var(--gv-user-menu--bgc, transparent);
|
|
65
|
-
--list-bgc: var(--gv-user-menu-list--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));
|
|
66
|
-
--hover-bgc: var(--gv-user-menu-hover--bgc, var(--gv-theme-color-light, #86c3d0));
|
|
67
|
-
--gv-link-active--c: var(--gv-user-menu-hover--c, var(--gv-theme-color-dark, #28444f));
|
|
68
|
-
--gv-icon--c: var(--gv-user-menu-icon--c, var(--gv-theme-neutral-color-darkest, #000000));
|
|
69
|
-
--gv-icon--s: var(--gv-user-menu-icon--s, 16px);
|
|
70
|
-
--gv-link-a--ph: var(--gv-user-menu-link-a--ph, 0px);
|
|
71
|
-
--gv-link--ta: var(--gv-user-menu-link--ta, right);
|
|
72
|
-
user-select: none;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.user-menu {
|
|
76
|
-
list-style: none;
|
|
77
|
-
margin: 0;
|
|
78
|
-
padding: 0;
|
|
79
|
-
display: inline-block;
|
|
80
|
-
position: relative;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.user-menu__title {
|
|
84
|
-
background-color: var(--bgc);
|
|
85
|
-
border-left: 1px solid var(--bdc);
|
|
86
|
-
color: var(--c);
|
|
87
|
-
cursor: pointer;
|
|
88
|
-
line-height: 40px;
|
|
89
|
-
padding: 8px 24px;
|
|
90
|
-
display: inline-flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
justify-content: space-between;
|
|
93
|
-
min-width: 175px;
|
|
94
|
-
text-shadow: var(--gv-user-menu--tsh, none);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
::slotted(*) {
|
|
98
|
-
height: 40px;
|
|
99
|
-
width: 40px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.user-menu__title.no-user {
|
|
103
|
-
padding: 5px 24px;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.user-menu__title gv-link {
|
|
107
|
-
--gv-link-a--ph: 0;
|
|
108
|
-
--gv-link-a--pv: 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.user-menu__title span {
|
|
112
|
-
flex: 1;
|
|
113
|
-
text-align: center;
|
|
114
|
-
margin: 0 0.4rem;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.user-menu__title > gv-icon {
|
|
118
|
-
transition: all 0.3s ease 0s;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.user-menu__list {
|
|
122
|
-
position: absolute;
|
|
123
|
-
background-color: var(--list-bgc);
|
|
124
|
-
list-style: none;
|
|
125
|
-
padding: 0;
|
|
126
|
-
transition: all 0.3s ease 0s;
|
|
127
|
-
width: 100%;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.user-menu__list__item {
|
|
131
|
-
border-left: 1px solid var(--bdc);
|
|
132
|
-
display: flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
transition: all 0.5s ease;
|
|
135
|
-
padding: 2px 30px;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.user-menu__list__item:last-child {
|
|
139
|
-
border-bottom: 1px solid var(--bdc);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.user-menu__list__item:hover {
|
|
143
|
-
background-color: var(--hover-bgc);
|
|
144
|
-
border-left: 1px dotted var(--bdc);
|
|
145
|
-
font-weight: 500;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
gv-link {
|
|
149
|
-
margin: 0px;
|
|
150
|
-
display: flex;
|
|
151
|
-
width: 100%;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.separator {
|
|
155
|
-
border-top: 1px solid var(--bdc);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.active {
|
|
159
|
-
background-color: var(--gv-theme-neutral-color-dark, #d9d9d9);
|
|
160
|
-
font-weight: bold;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** for animations */
|
|
164
|
-
.user-menu__list {
|
|
165
|
-
visibility: visible;
|
|
166
|
-
opacity: 1;
|
|
167
|
-
transform: translateY(0%);
|
|
168
|
-
z-index: 100;
|
|
169
|
-
transition-delay: 0s, 0s, 0.2s;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.user-menu__list__group {
|
|
173
|
-
border-top: 1px solid var(--bdc);
|
|
174
|
-
background-color: var(--gv-theme-neutral-color-light, #efefef);
|
|
175
|
-
padding-left: 0;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.user-menu__list__group__title {
|
|
179
|
-
font-size: small;
|
|
180
|
-
color: var(--gv-theme-color-darker, #383e3f);
|
|
181
|
-
border-left: 1px solid var(--bdc);
|
|
182
|
-
padding-left: 10px;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.closed .user-menu__list {
|
|
186
|
-
visibility: hidden;
|
|
187
|
-
opacity: 0;
|
|
188
|
-
transform: translateY(-2em);
|
|
189
|
-
z-index: -1;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
gv-icon {
|
|
193
|
-
transform: rotate(0deg);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.closed gv-icon {
|
|
197
|
-
transform: rotate(-180deg);
|
|
198
|
-
}
|
|
199
|
-
`,
|
|
200
|
-
];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
constructor() {
|
|
204
|
-
super();
|
|
205
|
-
this._isClosed = true;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
_onClick(e) {
|
|
209
|
-
e.preventDefault();
|
|
210
|
-
this._isClosed = !this._isClosed;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
_onMouseLeave() {
|
|
214
|
-
this._isClosed = true;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
_onSelect() {
|
|
218
|
-
this._isClosed = true;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
_hasOneItem() {
|
|
222
|
-
return this.username == null && this._routes && this._routes.length === 1;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
set routes(candidate) {
|
|
226
|
-
if (candidate) {
|
|
227
|
-
Promise.resolve(candidate).then((candidates) => {
|
|
228
|
-
if (candidates) {
|
|
229
|
-
Promise.all(candidates).then((futureRoutes) => {
|
|
230
|
-
if (!isSameRoutes(this._routes, futureRoutes)) {
|
|
231
|
-
this._routes = futureRoutes.filter((r) => r != null);
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
} else {
|
|
235
|
-
this._routes = null;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
} else {
|
|
239
|
-
this._routes = null;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
_renderFirstItem() {
|
|
244
|
-
if (this._routes) {
|
|
245
|
-
if (this.username) {
|
|
246
|
-
return html`<li class="user-menu__title" @click=${this._onClick}>
|
|
247
|
-
<div>
|
|
248
|
-
<slot></slot>
|
|
249
|
-
</div>
|
|
250
|
-
<span>${this.username}</span>
|
|
251
|
-
<gv-icon shape="design:triangle"></gv-icon>
|
|
252
|
-
</li>`;
|
|
253
|
-
} else if (this._hasOneItem()) {
|
|
254
|
-
const firstItem = this._routes[0];
|
|
255
|
-
return html`<li class="user-menu__title no-user" @click=${this._onClick}>
|
|
256
|
-
<gv-link .icon="${firstItem.icon}" .path="${firstItem.path}" .title="${firstItem.title}" @click=${this._onSelect}></gv-link>
|
|
257
|
-
</li>`;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return html``;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
render() {
|
|
264
|
-
const classes = { closed: this._isClosed };
|
|
265
|
-
if (this._routes) {
|
|
266
|
-
return html`
|
|
267
|
-
<nav class="${classMap(classes)}">
|
|
268
|
-
<ul class="user-menu" @mouseleave=${this._onMouseLeave}>
|
|
269
|
-
${this._renderFirstItem()}
|
|
270
|
-
|
|
271
|
-
<li class="user-menu__content">
|
|
272
|
-
<ul class="user-menu__list">
|
|
273
|
-
${repeat(
|
|
274
|
-
this._routes,
|
|
275
|
-
(route) => route,
|
|
276
|
-
(route, index) => html` ${this._hasOneItem() ? html`` : this._renderItem(route)} `,
|
|
277
|
-
)}
|
|
278
|
-
</ul>
|
|
279
|
-
</li>
|
|
280
|
-
</ul>
|
|
281
|
-
</nav>
|
|
282
|
-
`;
|
|
283
|
-
}
|
|
284
|
-
return html``;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
_renderItem(route) {
|
|
288
|
-
if (route.routes) {
|
|
289
|
-
return html`<ul class="user-menu__list__group">
|
|
290
|
-
<span class="user-menu__list__group__title">${route.title}</span>
|
|
291
|
-
${repeat(
|
|
292
|
-
route.routes,
|
|
293
|
-
(childRoute) => childRoute,
|
|
294
|
-
(childRoute, index) => html` ${this._renderItem(childRoute)} `,
|
|
295
|
-
)}
|
|
296
|
-
</ul>`;
|
|
297
|
-
} else {
|
|
298
|
-
return html`<li
|
|
299
|
-
class="user-menu__list__item ${route.separator ? 'separator' : ''} ${route.active ? 'active' : ''}"
|
|
300
|
-
style="${route.style}"
|
|
301
|
-
>
|
|
302
|
-
<gv-link
|
|
303
|
-
.icon="${route.icon}"
|
|
304
|
-
.path="${route.path}"
|
|
305
|
-
.title="${route.title}"
|
|
306
|
-
.target="${route.target}"
|
|
307
|
-
@click=${this._onSelect}
|
|
308
|
-
></gv-link>
|
|
309
|
-
</li>`;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
window.customElements.define('gv-user-menu', GvUserMenu);
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvUserMenu=void 0;const e=require("lit");require("../molecules/gv-nav");const t=require("lit/directives/repeat"),s=require("lit/directives/class-map"),r=require("../lib/utils");class i extends e.LitElement{static get properties(){return{avatar:{type:String},routes:{type:Array},_routes:{type:Array,attribute:!1},_isClosed:{type:Boolean,attribute:!1},username:{type:String}}}static get styles(){return[e.css`:host{--bdc:var(--gv-user-menu--bdc, lightgrey);--c:var(--gv-user-menu--c, var(--gv-theme-font-color-dark, #262626));--bgc:var(--gv-user-menu--bgc, transparent);--list-bgc:var(--gv-user-menu-list--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));--hover-bgc:var(--gv-user-menu-hover--bgc, var(--gv-theme-color-light, #86c3d0));--gv-link-active--c:var(--gv-user-menu-hover--c, var(--gv-theme-color-dark, #28444f));--gv-icon--c:var(--gv-user-menu-icon--c, var(--gv-theme-neutral-color-darkest, #000000));--gv-icon--s:var(--gv-user-menu-icon--s, 16px);--gv-link-a--ph:var(--gv-user-menu-link-a--ph, 0px);--gv-link--ta:var(--gv-user-menu-link--ta, right);user-select:none}.user-menu{list-style:none;margin:0;padding:0;display:inline-block;position:relative}.user-menu__title{background-color:var(--bgc);border-left:1px solid var(--bdc);color:var(--c);cursor:pointer;line-height:40px;padding:8px 24px;display:inline-flex;align-items:center;justify-content:space-between;min-width:175px;text-shadow:var(--gv-user-menu--tsh,none)}::slotted(*){height:40px;width:40px}.user-menu__title.no-user{padding:5px 24px}.user-menu__title gv-link{--gv-link-a--ph:0;--gv-link-a--pv:0}.user-menu__title span{flex:1;text-align:center;margin:0 .4rem}.user-menu__title>gv-icon{transition:all .3s ease 0s}.user-menu__list{position:absolute;background-color:var(--list-bgc);list-style:none;padding:0;transition:all .3s ease 0s;width:100%}.user-menu__list__item{border-left:1px solid var(--bdc);display:flex;align-items:center;transition:all .5s ease;padding:2px 30px}.user-menu__list__item:last-child{border-bottom:1px solid var(--bdc)}.user-menu__list__item:hover{background-color:var(--hover-bgc);border-left:1px dotted var(--bdc);font-weight:500}gv-link{margin:0;display:flex;width:100%}.separator{border-top:1px solid var(--bdc)}.active{background-color:var(--gv-theme-neutral-color-dark,#d9d9d9);font-weight:700}.user-menu__list{visibility:visible;opacity:1;transform:translateY(0);z-index:100;transition-delay:0s,0s,.2s}.user-menu__list__group{border-top:1px solid var(--bdc);background-color:var(--gv-theme-neutral-color-light,#efefef);padding-left:0}.user-menu__list__group__title{font-size:small;color:var(--gv-theme-color-darker,#383e3f);border-left:1px solid var(--bdc);padding-left:10px}.closed .user-menu__list{visibility:hidden;opacity:0;transform:translateY(-2em);z-index:-1}gv-icon{transform:rotate(0)}.closed gv-icon{transform:rotate(-180deg)}`]}constructor(){super(),this._isClosed=!0}_onClick(e){e.preventDefault(),this._isClosed=!this._isClosed}_onMouseLeave(){this._isClosed=!0}_onSelect(){this._isClosed=!0}_hasOneItem(){return null==this.username&&this._routes&&1===this._routes.length}set routes(e){e?Promise.resolve(e).then((e=>{e?Promise.all(e).then((e=>{(0,r.isSameRoutes)(this._routes,e)||(this._routes=e.filter((e=>null!=e)))})):this._routes=null})):this._routes=null}_renderFirstItem(){if(this._routes){if(this.username)return e.html`<li class="user-menu__title" @click="${this._onClick}"><div><slot></slot></div><span>${this.username}</span><gv-icon shape="design:triangle"></gv-icon></li>`;if(this._hasOneItem()){const t=this._routes[0];return e.html`<li class="user-menu__title no-user" @click="${this._onClick}"><gv-link .icon="${t.icon}" .path="${t.path}" .title="${t.title}" @click="${this._onSelect}"></gv-link></li>`}}return e.html``}render(){const r={closed:this._isClosed};return this._routes?e.html`<nav class="${(0,s.classMap)(r)}"><ul class="user-menu" @mouseleave="${this._onMouseLeave}">${this._renderFirstItem()}<li class="user-menu__content"><ul class="user-menu__list">${(0,t.repeat)(this._routes,(e=>e),((t,s)=>e.html`${this._hasOneItem()?e.html``:this._renderItem(t)}`))}</ul></li></ul></nav>`:e.html``}_renderItem(s){return s.routes?e.html`<ul class="user-menu__list__group"><span class="user-menu__list__group__title">${s.title}</span> ${(0,t.repeat)(s.routes,(e=>e),((t,s)=>e.html`${this._renderItem(t)}`))}</ul>`:e.html`<li class="user-menu__list__item ${s.separator?"separator":""} ${s.active?"active":""}" style="${s.style}"><gv-link .icon="${s.icon}" .path="${s.path}" .title="${s.title}" .target="${s.target}" @click="${this._onSelect}"></gv-link></li>`}}exports.GvUserMenu=i,window.customElements.define("gv-user-menu",i);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A vertical menu
|
|
3
|
+
*
|
|
4
|
+
* @fires gv-link:click - Custom event when link click
|
|
5
|
+
*
|
|
6
|
+
* @attr {Array} routes - definition of routes [{active: Boolean, icon: String, path: String, title: Promise<String>]
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export class GvVerticalMenu extends LitElement {
|
|
10
|
+
static get properties(): {
|
|
11
|
+
/** @required **/
|
|
12
|
+
routes: {
|
|
13
|
+
type: ArrayConstructor;
|
|
14
|
+
};
|
|
15
|
+
_routes: {
|
|
16
|
+
type: ArrayConstructor;
|
|
17
|
+
attribute: boolean;
|
|
18
|
+
};
|
|
19
|
+
logo: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
static get styles(): import("lit").CSSResult[];
|
|
24
|
+
/** @protected */
|
|
25
|
+
protected _routes: any[];
|
|
26
|
+
set routes(arg: any);
|
|
27
|
+
}
|
|
28
|
+
import { LitElement } from "lit-element/lit-element";
|