@gravitee/ui-components 3.25.3-typescript-fdacf14 → 3.25.3-typescript-94e8113
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/CHANGELOG.md +1292 -0
- package/LICENSE.txt +202 -0
- package/README.md +195 -0
- package/{src → dist/src}/atoms/gv-autocomplete.d.ts +0 -0
- package/dist/src/atoms/gv-autocomplete.js +422 -0
- package/{src → dist/src}/atoms/gv-button.d.ts +0 -0
- package/dist/src/atoms/gv-button.js +397 -0
- package/{src → dist/src}/atoms/gv-checkbox.d.ts +0 -0
- package/dist/src/atoms/gv-checkbox.js +178 -0
- package/{src → dist/src}/atoms/gv-date-picker-calendar.d.ts +0 -0
- package/dist/src/atoms/gv-date-picker-calendar.js +812 -0
- package/{src → dist/src}/atoms/gv-date-picker-cell.d.ts +0 -0
- package/dist/src/atoms/gv-date-picker-cell.js +174 -0
- package/{src → dist/src}/atoms/gv-date-picker.d.ts +0 -0
- package/dist/src/atoms/gv-date-picker.js +638 -0
- package/{src → dist/src}/atoms/gv-file-upload.d.ts +0 -0
- package/dist/src/atoms/gv-file-upload.js +348 -0
- package/{src → dist/src}/atoms/gv-icon.d.ts +0 -0
- package/dist/src/atoms/gv-icon.js +93 -0
- package/{src → dist/src}/atoms/gv-image.d.ts +0 -0
- package/dist/src/atoms/gv-image.js +135 -0
- package/{src → dist/src}/atoms/gv-input-message.d.ts +0 -0
- package/dist/src/atoms/gv-input-message.js +78 -0
- package/{src → dist/src}/atoms/gv-input.d.ts +0 -0
- package/dist/src/atoms/gv-input.js +508 -0
- package/{src → dist/src}/atoms/gv-link.d.ts +0 -0
- package/dist/src/atoms/gv-link.js +204 -0
- package/{src → dist/src}/atoms/gv-message.d.ts +0 -0
- package/dist/src/atoms/gv-message.js +133 -0
- package/{src → dist/src}/atoms/gv-metric.d.ts +0 -0
- package/dist/src/atoms/gv-metric.js +112 -0
- package/{src → dist/src}/atoms/gv-relative-time.d.ts +0 -0
- package/dist/src/atoms/gv-relative-time.js +143 -0
- package/{src → dist/src}/atoms/gv-select-native.d.ts +0 -0
- package/dist/src/atoms/gv-select-native.js +363 -0
- package/{src → dist/src}/atoms/gv-select.d.ts +0 -0
- package/dist/src/atoms/gv-select.js +413 -0
- package/{src → dist/src}/atoms/gv-spinner.d.ts +0 -0
- package/dist/src/atoms/gv-spinner.js +54 -0
- package/{src → dist/src}/atoms/gv-state.d.ts +0 -0
- package/dist/src/atoms/gv-state.js +125 -0
- package/{src → dist/src}/atoms/gv-switch.d.ts +0 -0
- package/dist/src/atoms/gv-switch.js +235 -0
- package/{src → dist/src}/atoms/gv-tag.d.ts +0 -0
- package/dist/src/atoms/gv-tag.js +162 -0
- package/{src → dist/src}/atoms/gv-text.d.ts +0 -0
- package/dist/src/atoms/gv-text.js +160 -0
- package/{src → dist/src}/charts/gv-chart-bar.d.ts +0 -0
- package/dist/src/charts/gv-chart-bar.js +101 -0
- package/{src → dist/src}/charts/gv-chart-gauge.d.ts +0 -0
- package/dist/src/charts/gv-chart-gauge.js +92 -0
- package/{src → dist/src}/charts/gv-chart-histogram.d.ts +0 -0
- package/dist/src/charts/gv-chart-histogram.js +78 -0
- package/{src → dist/src}/charts/gv-chart-line.d.ts +0 -0
- package/dist/src/charts/gv-chart-line.js +218 -0
- package/{src → dist/src}/charts/gv-chart-map.d.ts +0 -0
- package/dist/src/charts/gv-chart-map.js +111 -0
- package/{src → dist/src}/charts/gv-chart-pie.d.ts +0 -0
- package/dist/src/charts/gv-chart-pie.js +89 -0
- package/{src → dist/src}/index.d.ts +0 -0
- package/dist/src/index.js +77 -0
- package/{src → dist/src}/lib/cron-expression.d.ts +0 -0
- package/dist/src/lib/cron-expression.js +176 -0
- package/{src → dist/src}/lib/date.d.ts +0 -0
- package/dist/src/lib/date.js +43 -0
- package/{src → dist/src}/lib/events.d.ts +0 -0
- package/dist/src/lib/events.js +26 -0
- package/{src → dist/src}/lib/http-client-schema-form.d.ts +0 -0
- package/dist/src/lib/http-client-schema-form.js +67 -0
- package/{src → dist/src}/lib/http.d.ts +0 -0
- package/dist/src/lib/http.js +237 -0
- package/{src → dist/src}/lib/i18n.d.ts +0 -0
- package/dist/src/lib/i18n.js +93 -0
- package/{src → dist/src}/lib/item.d.ts +0 -0
- package/dist/src/lib/item.js +110 -0
- package/{src → dist/src}/lib/properties.d.ts +0 -0
- package/dist/src/lib/properties.js +171 -0
- package/{src → dist/src}/lib/schema-form.d.ts +0 -0
- package/dist/src/lib/schema-form.js +39 -0
- package/{src → dist/src}/lib/studio.d.ts +0 -0
- package/dist/src/lib/studio.js +144 -0
- package/{src → dist/src}/lib/style.d.ts +0 -0
- package/dist/src/lib/style.js +39 -0
- package/{src → dist/src}/lib/text-format.d.ts +0 -0
- package/dist/src/lib/text-format.js +65 -0
- package/{src → dist/src}/lib/theme.d.ts +0 -0
- package/dist/src/lib/theme.js +60 -0
- package/{src → dist/src}/lib/utils.d.ts +0 -0
- package/dist/src/lib/utils.js +106 -0
- package/{src → dist/src}/mixins/chart-element.d.ts +0 -0
- package/dist/src/mixins/chart-element.js +153 -0
- package/{src → dist/src}/mixins/input-element.d.ts +0 -0
- package/dist/src/mixins/input-element.js +136 -0
- package/{src → dist/src}/mixins/item-resource.d.ts +0 -0
- package/dist/src/mixins/item-resource.js +102 -0
- package/{src → dist/src}/mixins/keyboard-element.d.ts +0 -0
- package/dist/src/mixins/keyboard-element.js +62 -0
- package/{src → dist/src}/mixins/update-after-browser.d.ts +0 -0
- package/dist/src/mixins/update-after-browser.js +30 -0
- package/{src → dist/src}/mixins/with-resize-observer.d.ts +0 -0
- package/dist/src/mixins/with-resize-observer.js +62 -0
- package/{src → dist/src}/mixins/with-skeleton-attribute.d.ts +0 -0
- package/dist/src/mixins/with-skeleton-attribute.js +109 -0
- package/{src → dist/src}/molecules/gv-card-full.d.ts +0 -0
- package/dist/src/molecules/gv-card-full.js +209 -0
- package/{src → dist/src}/molecules/gv-card-list.d.ts +0 -0
- package/dist/src/molecules/gv-card-list.js +101 -0
- package/{src → dist/src}/molecules/gv-card.d.ts +0 -0
- package/dist/src/molecules/gv-card.js +130 -0
- package/{src → dist/src}/molecules/gv-category-list.d.ts +0 -0
- package/dist/src/molecules/gv-category-list.js +56 -0
- package/{src → dist/src}/molecules/gv-category.d.ts +0 -0
- package/dist/src/molecules/gv-category.js +163 -0
- package/{src → dist/src}/molecules/gv-code.d.ts +0 -0
- package/dist/src/molecules/gv-code.js +334 -0
- package/{src → dist/src}/molecules/gv-confirm.d.ts +0 -0
- package/dist/src/molecules/gv-confirm.js +175 -0
- package/{src → dist/src}/molecules/gv-cron-editor.d.ts +0 -0
- package/dist/src/molecules/gv-cron-editor.js +685 -0
- package/{src → dist/src}/molecules/gv-dropdown-menu.d.ts +0 -0
- package/dist/src/molecules/gv-dropdown-menu.js +108 -0
- package/{src → dist/src}/molecules/gv-expandable.d.ts +0 -0
- package/dist/src/molecules/gv-expandable.js +116 -0
- package/{src → dist/src}/molecules/gv-expression-language.d.ts +0 -0
- package/dist/src/molecules/gv-expression-language.js +263 -0
- package/{src → dist/src}/molecules/gv-identity-picture.d.ts +0 -0
- package/dist/src/molecules/gv-identity-picture.js +139 -0
- package/{src → dist/src}/molecules/gv-list.d.ts +0 -0
- package/dist/src/molecules/gv-list.js +214 -0
- package/{src → dist/src}/molecules/gv-metrics.d.ts +0 -0
- package/dist/src/molecules/gv-metrics.js +147 -0
- package/{src → dist/src}/molecules/gv-modal.d.ts +0 -0
- package/dist/src/molecules/gv-modal.js +203 -0
- package/{src → dist/src}/molecules/gv-nav.d.ts +0 -0
- package/dist/src/molecules/gv-nav.js +180 -0
- package/{src → dist/src}/molecules/gv-option.d.ts +0 -0
- package/dist/src/molecules/gv-option.js +230 -0
- package/{src → dist/src}/molecules/gv-plans.d.ts +0 -0
- package/dist/src/molecules/gv-plans.js +400 -0
- package/{src → dist/src}/molecules/gv-popover.d.ts +0 -0
- package/dist/src/molecules/gv-popover.js +323 -0
- package/{src → dist/src}/molecules/gv-promote.d.ts +0 -0
- package/dist/src/molecules/gv-promote.js +203 -0
- package/{src → dist/src}/molecules/gv-rating-list.d.ts +0 -0
- package/dist/src/molecules/gv-rating-list.js +341 -0
- package/{src → dist/src}/molecules/gv-rating.d.ts +0 -0
- package/dist/src/molecules/gv-rating.js +234 -0
- package/{src → dist/src}/molecules/gv-row-expandable.d.ts +0 -0
- package/dist/src/molecules/gv-row-expandable.js +42 -0
- package/{src → dist/src}/molecules/gv-row.d.ts +0 -0
- package/dist/src/molecules/gv-row.js +205 -0
- package/{src → dist/src}/molecules/gv-stats.d.ts +0 -0
- package/dist/src/molecules/gv-stats.js +110 -0
- package/{src → dist/src}/molecules/gv-stepper.d.ts +0 -0
- package/dist/src/molecules/gv-stepper.js +274 -0
- package/{src → dist/src}/molecules/gv-table.d.ts +0 -0
- package/dist/src/molecules/gv-table.js +644 -0
- package/{src → dist/src}/molecules/gv-tree.d.ts +0 -0
- package/dist/src/molecules/gv-tree.js +238 -0
- package/{src → dist/src}/organisms/gv-documentation.d.ts +0 -0
- package/dist/src/organisms/gv-documentation.js +205 -0
- package/{src → dist/src}/organisms/gv-header.d.ts +0 -0
- package/dist/src/organisms/gv-header.js +276 -0
- package/{src → dist/src}/organisms/gv-http-client.d.ts +0 -0
- package/dist/src/organisms/gv-http-client.js +258 -0
- package/{src → dist/src}/organisms/gv-menu.d.ts +0 -0
- package/dist/src/organisms/gv-menu.js +258 -0
- package/{src → dist/src}/organisms/gv-newsletter-subscription.d.ts +0 -0
- package/dist/src/organisms/gv-newsletter-subscription.js +258 -0
- package/{src → dist/src}/organisms/gv-pagination.d.ts +0 -0
- package/dist/src/organisms/gv-pagination.js +179 -0
- package/{src → dist/src}/organisms/gv-properties.d.ts +0 -0
- package/dist/src/organisms/gv-properties.js +860 -0
- package/{src → dist/src}/organisms/gv-resizable-views.d.ts +0 -0
- package/dist/src/organisms/gv-resizable-views.js +371 -0
- package/{src → dist/src}/organisms/gv-resources.d.ts +0 -0
- package/dist/src/organisms/gv-resources.js +496 -0
- package/{src → dist/src}/organisms/gv-schema-form-array.d.ts +0 -0
- package/dist/src/organisms/gv-schema-form-array.js +237 -0
- package/{src → dist/src}/organisms/gv-schema-form-control-object.d.ts +0 -0
- package/dist/src/organisms/gv-schema-form-control-object.js +141 -0
- package/{src → dist/src}/organisms/gv-schema-form-control.d.ts +0 -0
- package/dist/src/organisms/gv-schema-form-control.js +419 -0
- package/{src → dist/src}/organisms/gv-schema-form.d.ts +0 -0
- package/dist/src/organisms/gv-schema-form.js +700 -0
- package/{src → dist/src}/organisms/gv-tabs.d.ts +0 -0
- package/dist/src/organisms/gv-tabs.js +201 -0
- package/{src → dist/src}/organisms/gv-user-menu.d.ts +0 -0
- package/dist/src/organisms/gv-user-menu.js +298 -0
- package/{src → dist/src}/organisms/gv-vertical-menu.d.ts +0 -0
- package/dist/src/organisms/gv-vertical-menu.js +119 -0
- package/{src → dist/src}/policy-studio/gv-flow-step.d.ts +0 -0
- package/dist/src/policy-studio/gv-flow-step.js +443 -0
- package/{src → dist/src}/policy-studio/gv-flow.d.ts +0 -0
- package/dist/src/policy-studio/gv-flow.js +595 -0
- package/{src → dist/src}/policy-studio/gv-policy-studio-menu.d.ts +0 -0
- package/dist/src/policy-studio/gv-policy-studio-menu.js +689 -0
- package/{src → dist/src}/policy-studio/gv-policy-studio.d.ts +0 -0
- package/dist/src/policy-studio/gv-policy-studio.js +1712 -0
- package/{src → dist/src}/styles/empty.d.ts +0 -0
- package/dist/src/styles/empty.js +35 -0
- package/{src → dist/src}/styles/input.d.ts +0 -0
- package/dist/src/styles/input.js +262 -0
- package/{src → dist/src}/styles/link.d.ts +0 -0
- package/dist/src/styles/link.js +31 -0
- package/{src → dist/src}/styles/shapes.d.ts +0 -0
- package/dist/src/styles/shapes.js +17 -0
- package/{src → dist/src}/styles/skeleton.d.ts +0 -0
- package/dist/src/styles/skeleton.js +52 -0
- package/{src → dist/src}/styles/zoom.d.ts +0 -0
- package/dist/src/styles/zoom.js +39 -0
- package/{src → dist/src}/theme/gv-theme.d.ts +0 -0
- package/dist/src/theme/gv-theme.js +197 -0
- package/{wc → dist/wc}/gv-autocomplete.d.ts +0 -0
- package/dist/wc/gv-autocomplete.js +1 -0
- package/{wc → dist/wc}/gv-button.d.ts +0 -0
- package/dist/wc/gv-button.js +1 -0
- package/{wc → dist/wc}/gv-card-full.d.ts +0 -0
- package/dist/wc/gv-card-full.js +1 -0
- package/{wc → dist/wc}/gv-card-list.d.ts +0 -0
- package/dist/wc/gv-card-list.js +1 -0
- package/{wc → dist/wc}/gv-card.d.ts +0 -0
- package/dist/wc/gv-card.js +1 -0
- package/{wc → dist/wc}/gv-category-list.d.ts +0 -0
- package/dist/wc/gv-category-list.js +1 -0
- package/{wc → dist/wc}/gv-category.d.ts +0 -0
- package/dist/wc/gv-category.js +1 -0
- package/{wc → dist/wc}/gv-chart-bar.d.ts +0 -0
- package/dist/wc/gv-chart-bar.js +1 -0
- package/{wc → dist/wc}/gv-chart-gauge.d.ts +0 -0
- package/dist/wc/gv-chart-gauge.js +1 -0
- package/{wc → dist/wc}/gv-chart-histogram.d.ts +0 -0
- package/dist/wc/gv-chart-histogram.js +1 -0
- package/{wc → dist/wc}/gv-chart-line.d.ts +0 -0
- package/dist/wc/gv-chart-line.js +1 -0
- package/{wc → dist/wc}/gv-chart-map.d.ts +0 -0
- package/dist/wc/gv-chart-map.js +1 -0
- package/{wc → dist/wc}/gv-chart-pie.d.ts +0 -0
- package/dist/wc/gv-chart-pie.js +1 -0
- package/{wc → dist/wc}/gv-checkbox.d.ts +0 -0
- package/dist/wc/gv-checkbox.js +1 -0
- package/{wc → dist/wc}/gv-code.d.ts +0 -0
- package/dist/wc/gv-code.js +1 -0
- package/{wc → dist/wc}/gv-confirm.d.ts +0 -0
- package/dist/wc/gv-confirm.js +1 -0
- package/{wc → dist/wc}/gv-cron-editor.d.ts +0 -0
- package/dist/wc/gv-cron-editor.js +1 -0
- package/{wc → dist/wc}/gv-date-picker-calendar.d.ts +0 -0
- package/dist/wc/gv-date-picker-calendar.js +1 -0
- package/{wc → dist/wc}/gv-date-picker-cell.d.ts +0 -0
- package/dist/wc/gv-date-picker-cell.js +1 -0
- package/{wc → dist/wc}/gv-date-picker.d.ts +0 -0
- package/dist/wc/gv-date-picker.js +1 -0
- package/{wc → dist/wc}/gv-documentation.d.ts +0 -0
- package/dist/wc/gv-documentation.js +1 -0
- package/{wc → dist/wc}/gv-dropdown-menu.d.ts +0 -0
- package/dist/wc/gv-dropdown-menu.js +1 -0
- package/{wc → dist/wc}/gv-expandable.d.ts +0 -0
- package/dist/wc/gv-expandable.js +1 -0
- package/{wc → dist/wc}/gv-expression-language.d.ts +0 -0
- package/dist/wc/gv-expression-language.js +1 -0
- package/{wc → dist/wc}/gv-file-upload.d.ts +0 -0
- package/dist/wc/gv-file-upload.js +1 -0
- package/{wc → dist/wc}/gv-flow-step.d.ts +0 -0
- package/dist/wc/gv-flow-step.js +1 -0
- package/{wc → dist/wc}/gv-flow.d.ts +0 -0
- package/dist/wc/gv-flow.js +1 -0
- package/{wc → dist/wc}/gv-header.d.ts +0 -0
- package/dist/wc/gv-header.js +1 -0
- package/{wc → dist/wc}/gv-http-client.d.ts +0 -0
- package/dist/wc/gv-http-client.js +1 -0
- package/{wc → dist/wc}/gv-icon.d.ts +0 -0
- package/dist/wc/gv-icon.js +1 -0
- package/{wc → dist/wc}/gv-identity-picture.d.ts +0 -0
- package/dist/wc/gv-identity-picture.js +1 -0
- package/{wc → dist/wc}/gv-image.d.ts +0 -0
- package/dist/wc/gv-image.js +1 -0
- package/{wc → dist/wc}/gv-input-message.d.ts +0 -0
- package/dist/wc/gv-input-message.js +1 -0
- package/{wc → dist/wc}/gv-input.d.ts +0 -0
- package/dist/wc/gv-input.js +1 -0
- package/{wc → dist/wc}/gv-link.d.ts +0 -0
- package/dist/wc/gv-link.js +1 -0
- package/{wc → dist/wc}/gv-list.d.ts +0 -0
- package/dist/wc/gv-list.js +1 -0
- package/{wc → dist/wc}/gv-menu.d.ts +0 -0
- package/dist/wc/gv-menu.js +1 -0
- package/{wc → dist/wc}/gv-message.d.ts +0 -0
- package/dist/wc/gv-message.js +1 -0
- package/{wc → dist/wc}/gv-metric.d.ts +0 -0
- package/dist/wc/gv-metric.js +1 -0
- package/{wc → dist/wc}/gv-metrics.d.ts +0 -0
- package/dist/wc/gv-metrics.js +1 -0
- package/{wc → dist/wc}/gv-modal.d.ts +0 -0
- package/dist/wc/gv-modal.js +1 -0
- package/{wc → dist/wc}/gv-nav.d.ts +0 -0
- package/dist/wc/gv-nav.js +1 -0
- package/{wc → dist/wc}/gv-newsletter-subscription.d.ts +0 -0
- package/dist/wc/gv-newsletter-subscription.js +1 -0
- package/{wc → dist/wc}/gv-option.d.ts +0 -0
- package/dist/wc/gv-option.js +1 -0
- package/{wc → dist/wc}/gv-pagination.d.ts +0 -0
- package/dist/wc/gv-pagination.js +1 -0
- package/{wc → dist/wc}/gv-plans.d.ts +0 -0
- package/dist/wc/gv-plans.js +1 -0
- package/{wc → dist/wc}/gv-policy-studio-menu.d.ts +0 -0
- package/dist/wc/gv-policy-studio-menu.js +1 -0
- package/{wc → dist/wc}/gv-policy-studio.d.ts +0 -0
- package/dist/wc/gv-policy-studio.js +1 -0
- package/{wc → dist/wc}/gv-popover.d.ts +0 -0
- package/dist/wc/gv-popover.js +1 -0
- package/{wc → dist/wc}/gv-promote.d.ts +0 -0
- package/dist/wc/gv-promote.js +1 -0
- package/{wc → dist/wc}/gv-properties.d.ts +0 -0
- package/dist/wc/gv-properties.js +1 -0
- package/{wc → dist/wc}/gv-rating-list.d.ts +0 -0
- package/dist/wc/gv-rating-list.js +1 -0
- package/{wc → dist/wc}/gv-rating.d.ts +0 -0
- package/dist/wc/gv-rating.js +1 -0
- package/{wc → dist/wc}/gv-relative-time.d.ts +0 -0
- package/dist/wc/gv-relative-time.js +1 -0
- package/{wc → dist/wc}/gv-resizable-views.d.ts +0 -0
- package/dist/wc/gv-resizable-views.js +1 -0
- package/{wc → dist/wc}/gv-resources.d.ts +0 -0
- package/dist/wc/gv-resources.js +1 -0
- package/{wc → dist/wc}/gv-row-expandable.d.ts +0 -0
- package/dist/wc/gv-row-expandable.js +1 -0
- package/{wc → dist/wc}/gv-row.d.ts +0 -0
- package/dist/wc/gv-row.js +1 -0
- package/{wc → dist/wc}/gv-schema-form-array.d.ts +0 -0
- package/dist/wc/gv-schema-form-array.js +1 -0
- package/{wc → dist/wc}/gv-schema-form-control-object.d.ts +0 -0
- package/dist/wc/gv-schema-form-control-object.js +1 -0
- package/{wc → dist/wc}/gv-schema-form-control.d.ts +0 -0
- package/dist/wc/gv-schema-form-control.js +1 -0
- package/{wc → dist/wc}/gv-schema-form.d.ts +0 -0
- package/dist/wc/gv-schema-form.js +1 -0
- package/{wc → dist/wc}/gv-select-native.d.ts +0 -0
- package/dist/wc/gv-select-native.js +1 -0
- package/{wc → dist/wc}/gv-select.d.ts +0 -0
- package/dist/wc/gv-select.js +1 -0
- package/{wc → dist/wc}/gv-spinner.d.ts +0 -0
- package/dist/wc/gv-spinner.js +1 -0
- package/{wc → dist/wc}/gv-state.d.ts +0 -0
- package/dist/wc/gv-state.js +1 -0
- package/{wc → dist/wc}/gv-stats.d.ts +0 -0
- package/dist/wc/gv-stats.js +1 -0
- package/{wc → dist/wc}/gv-stepper.d.ts +0 -0
- package/dist/wc/gv-stepper.js +1 -0
- package/{wc → dist/wc}/gv-switch.d.ts +0 -0
- package/dist/wc/gv-switch.js +1 -0
- package/{wc → dist/wc}/gv-table.d.ts +0 -0
- package/dist/wc/gv-table.js +1 -0
- package/{wc → dist/wc}/gv-tabs.d.ts +0 -0
- package/dist/wc/gv-tabs.js +1 -0
- package/{wc → dist/wc}/gv-tag.d.ts +0 -0
- package/dist/wc/gv-tag.js +1 -0
- package/{wc → dist/wc}/gv-text.d.ts +0 -0
- package/dist/wc/gv-text.js +1 -0
- package/{wc → dist/wc}/gv-theme.d.ts +0 -0
- package/dist/wc/gv-theme.js +1 -0
- package/{wc → dist/wc}/gv-tree.d.ts +0 -0
- package/dist/wc/gv-tree.js +1 -0
- package/{wc → dist/wc}/gv-user-menu.d.ts +0 -0
- package/dist/wc/gv-user-menu.js +1 -0
- package/{wc → dist/wc}/gv-vertical-menu.d.ts +0 -0
- package/dist/wc/gv-vertical-menu.js +1 -0
- package/package.json +8 -17
- package/src/atoms/gv-autocomplete.js +0 -1
- package/src/atoms/gv-button.js +0 -1
- package/src/atoms/gv-checkbox.js +0 -1
- package/src/atoms/gv-date-picker-calendar.js +0 -1
- package/src/atoms/gv-date-picker-cell.js +0 -1
- package/src/atoms/gv-date-picker.js +0 -1
- package/src/atoms/gv-file-upload.js +0 -1
- package/src/atoms/gv-icon.js +0 -1
- package/src/atoms/gv-image.js +0 -1
- package/src/atoms/gv-input-message.js +0 -1
- package/src/atoms/gv-input.js +0 -1
- package/src/atoms/gv-link.js +0 -1
- package/src/atoms/gv-message.js +0 -1
- package/src/atoms/gv-metric.js +0 -1
- package/src/atoms/gv-relative-time.js +0 -1
- package/src/atoms/gv-select-native.js +0 -1
- package/src/atoms/gv-select.js +0 -1
- package/src/atoms/gv-spinner.js +0 -1
- package/src/atoms/gv-state.js +0 -1
- package/src/atoms/gv-switch.js +0 -1
- package/src/atoms/gv-tag.js +0 -1
- package/src/atoms/gv-text.js +0 -1
- package/src/charts/gv-chart-bar.js +0 -1
- package/src/charts/gv-chart-gauge.js +0 -1
- package/src/charts/gv-chart-histogram.js +0 -1
- package/src/charts/gv-chart-line.js +0 -1
- package/src/charts/gv-chart-map.js +0 -1
- package/src/charts/gv-chart-pie.js +0 -1
- package/src/index.js +0 -1
- package/src/lib/cron-expression.js +0 -1
- package/src/lib/date.js +0 -1
- package/src/lib/events.js +0 -1
- package/src/lib/http-client-schema-form.js +0 -1
- package/src/lib/http.js +0 -1
- package/src/lib/i18n.js +0 -1
- package/src/lib/item.js +0 -1
- package/src/lib/properties.js +0 -1
- package/src/lib/schema-form.js +0 -1
- package/src/lib/studio.js +0 -1
- package/src/lib/style.js +0 -1
- package/src/lib/text-format.js +0 -1
- package/src/lib/theme.js +0 -1
- package/src/lib/utils.js +0 -1
- package/src/mixins/chart-element.js +0 -1
- package/src/mixins/input-element.js +0 -1
- package/src/mixins/item-resource.js +0 -1
- package/src/mixins/keyboard-element.js +0 -1
- package/src/mixins/update-after-browser.js +0 -1
- package/src/mixins/with-resize-observer.js +0 -1
- package/src/mixins/with-skeleton-attribute.js +0 -1
- package/src/molecules/gv-card-full.js +0 -1
- package/src/molecules/gv-card-list.js +0 -1
- package/src/molecules/gv-card.js +0 -1
- package/src/molecules/gv-category-list.js +0 -1
- package/src/molecules/gv-category.js +0 -1
- package/src/molecules/gv-code.js +0 -1
- package/src/molecules/gv-confirm.js +0 -1
- package/src/molecules/gv-cron-editor.js +0 -1
- package/src/molecules/gv-dropdown-menu.js +0 -1
- package/src/molecules/gv-expandable.js +0 -1
- package/src/molecules/gv-expression-language.js +0 -1
- package/src/molecules/gv-identity-picture.js +0 -1
- package/src/molecules/gv-list.js +0 -1
- package/src/molecules/gv-metrics.js +0 -1
- package/src/molecules/gv-modal.js +0 -1
- package/src/molecules/gv-nav.js +0 -1
- package/src/molecules/gv-option.js +0 -1
- package/src/molecules/gv-plans.js +0 -1
- package/src/molecules/gv-popover.js +0 -1
- package/src/molecules/gv-promote.js +0 -1
- package/src/molecules/gv-rating-list.js +0 -1
- package/src/molecules/gv-rating.js +0 -1
- package/src/molecules/gv-row-expandable.js +0 -1
- package/src/molecules/gv-row.js +0 -1
- package/src/molecules/gv-stats.js +0 -1
- package/src/molecules/gv-stepper.js +0 -1
- package/src/molecules/gv-table.js +0 -1
- package/src/molecules/gv-tree.js +0 -1
- package/src/organisms/gv-documentation.js +0 -1
- package/src/organisms/gv-header.js +0 -1
- package/src/organisms/gv-http-client.js +0 -1
- package/src/organisms/gv-menu.js +0 -1
- package/src/organisms/gv-newsletter-subscription.js +0 -1
- package/src/organisms/gv-pagination.js +0 -1
- package/src/organisms/gv-properties.js +0 -1
- package/src/organisms/gv-resizable-views.js +0 -1
- package/src/organisms/gv-resources.js +0 -1
- package/src/organisms/gv-schema-form-array.js +0 -1
- package/src/organisms/gv-schema-form-control-object.js +0 -1
- package/src/organisms/gv-schema-form-control.js +0 -1
- package/src/organisms/gv-schema-form.js +0 -1
- package/src/organisms/gv-tabs.js +0 -1
- package/src/organisms/gv-user-menu.js +0 -1
- package/src/organisms/gv-vertical-menu.js +0 -1
- package/src/policy-studio/gv-flow-step.js +0 -1
- package/src/policy-studio/gv-flow.js +0 -1
- package/src/policy-studio/gv-policy-studio-menu.js +0 -1
- package/src/policy-studio/gv-policy-studio.js +0 -1
- package/src/styles/empty.js +0 -1
- package/src/styles/input.js +0 -1
- package/src/styles/link.js +0 -1
- package/src/styles/shapes.js +0 -1
- package/src/styles/skeleton.js +0 -1
- package/src/styles/zoom.js +0 -1
- package/src/theme/gv-theme.js +0 -1
- package/wc/gv-autocomplete.js +0 -1
- package/wc/gv-button.js +0 -1
- package/wc/gv-card-full.js +0 -1
- package/wc/gv-card-list.js +0 -1
- package/wc/gv-card.js +0 -1
- package/wc/gv-category-list.js +0 -1
- package/wc/gv-category.js +0 -1
- package/wc/gv-chart-bar.js +0 -1
- package/wc/gv-chart-gauge.js +0 -1
- package/wc/gv-chart-histogram.js +0 -1
- package/wc/gv-chart-line.js +0 -1
- package/wc/gv-chart-map.js +0 -1
- package/wc/gv-chart-pie.js +0 -1
- package/wc/gv-checkbox.js +0 -1
- package/wc/gv-code.js +0 -1
- package/wc/gv-confirm.js +0 -1
- package/wc/gv-cron-editor.js +0 -1
- package/wc/gv-date-picker-calendar.js +0 -1
- package/wc/gv-date-picker-cell.js +0 -1
- package/wc/gv-date-picker.js +0 -1
- package/wc/gv-documentation.js +0 -1
- package/wc/gv-dropdown-menu.js +0 -1
- package/wc/gv-expandable.js +0 -1
- package/wc/gv-expression-language.js +0 -1
- package/wc/gv-file-upload.js +0 -1
- package/wc/gv-flow-step.js +0 -1
- package/wc/gv-flow.js +0 -1
- package/wc/gv-header.js +0 -1
- package/wc/gv-http-client.js +0 -1
- package/wc/gv-icon.js +0 -1
- package/wc/gv-identity-picture.js +0 -1
- package/wc/gv-image.js +0 -1
- package/wc/gv-input-message.js +0 -1
- package/wc/gv-input.js +0 -1
- package/wc/gv-link.js +0 -1
- package/wc/gv-list.js +0 -1
- package/wc/gv-menu.js +0 -1
- package/wc/gv-message.js +0 -1
- package/wc/gv-metric.js +0 -1
- package/wc/gv-metrics.js +0 -1
- package/wc/gv-modal.js +0 -1
- package/wc/gv-nav.js +0 -1
- package/wc/gv-newsletter-subscription.js +0 -1
- package/wc/gv-option.js +0 -1
- package/wc/gv-pagination.js +0 -1
- package/wc/gv-plans.js +0 -1
- package/wc/gv-policy-studio-menu.js +0 -1
- package/wc/gv-policy-studio.js +0 -1
- package/wc/gv-popover.js +0 -1
- package/wc/gv-promote.js +0 -1
- package/wc/gv-properties.js +0 -1
- package/wc/gv-rating-list.js +0 -1
- package/wc/gv-rating.js +0 -1
- package/wc/gv-relative-time.js +0 -1
- package/wc/gv-resizable-views.js +0 -1
- package/wc/gv-resources.js +0 -1
- package/wc/gv-row-expandable.js +0 -1
- package/wc/gv-row.js +0 -1
- package/wc/gv-schema-form-array.js +0 -1
- package/wc/gv-schema-form-control-object.js +0 -1
- package/wc/gv-schema-form-control.js +0 -1
- package/wc/gv-schema-form.js +0 -1
- package/wc/gv-select-native.js +0 -1
- package/wc/gv-select.js +0 -1
- package/wc/gv-spinner.js +0 -1
- package/wc/gv-state.js +0 -1
- package/wc/gv-stats.js +0 -1
- package/wc/gv-stepper.js +0 -1
- package/wc/gv-switch.js +0 -1
- package/wc/gv-table.js +0 -1
- package/wc/gv-tabs.js +0 -1
- package/wc/gv-tag.js +0 -1
- package/wc/gv-text.js +0 -1
- package/wc/gv-theme.js +0 -1
- package/wc/gv-tree.js +0 -1
- package/wc/gv-user-menu.js +0 -1
- package/wc/gv-vertical-menu.js +0 -1
package/src/molecules/gv-code.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]},t=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},r=function(r){if(r&&r.__esModule)return r;var i={};if(null!=r)for(var o in r)"default"!==o&&Object.prototype.hasOwnProperty.call(r,o)&&e(i,r,o);return t(i,r),i};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvCode=void 0;const i=require("lit"),o=require("@codemirror/basic-setup"),s=require("@codemirror/state"),a=require("@codemirror/autocomplete"),n=require("@codemirror/lang-json"),d=require("@codemirror/language-data"),l=require("@codemirror/view"),c=require("../styles/shapes"),u=require("../lib/events"),p=require("../lib/utils"),h=require("lit/directives/class-map"),m=require("../atoms/gv-input"),g=require("../styles/skeleton"),v=require("../styles/empty"),f=require("../styles/input");class b extends m.GvInput{static get properties(){return{...super.properties,options:{type:Object},rows:{type:Number},_error:{type:String,attribute:!1}}}constructor(){super(),this._id=`gv-code-${(0,p.uuid)()}`,this.value="",this.readonly=!1,this.autofocus=!1,this.clipboard=!1,this._clipboardIcon=c.shapeClipboard,this.languageCompartment=new s.Compartment,this.readonlyCompartment=new s.Compartment,this.placeholderCompartment=new s.Compartment}render(){const e={box:!0,"box-invisible":this.skeleton,large:this.large,medium:this.medium||!this.large&&!this.small,small:this.small,copied:this.hasClipboard&&this._copied},t={content:!0,code:!this.hasInputStyle,input:this.hasInputStyle};return i.html`<div class="${(0,h.classMap)(e)}">${this.label?i.html`<label for="code">${this.label}</label>`:""}<div id="${this._id}" class="${(0,h.classMap)(t)}">${this.renderIcon()}</div></div>${null!=this.description?i.html`<div class="description" .innerHTML="${this.description}"></div>`:""}`}bindInputEvents(){(0,u.dispatchCustomEvent)(this,"ready",{currentTarget:this})}get hasInputStyle(){return 1===this.rows}_autocomplete(e){const{handler:t,match:r}=this.findBestAutocompleteHandler(e);return t.run.call(this,e,r)}findBestAutocompleteHandler(e){return{handler:this.defaultCompletionHandler,match:!0}}get defaultCompletionHandler(){return{run(e){const t=e.state.languageDataAt("autocomplete",e.pos);return t.length>0?t[0](e):{from:e.pos,options:[]}}}}_getExtensions(){return[o.basicSetup,b.codemirrorTheme,this.languageCompartment.of((0,n.json)()),this.placeholderCompartment.of((0,l.placeholder)(this.placeholder||"")),s.EditorState.transactionFilter.of((e=>this.hasInputStyle&&e.newDoc.lines>1?[]:e)),this.readonlyCompartment.of(o.EditorView.editable.of(!this.readonly&&!this.disabled)),o.EditorView.updateListener.of((e=>{e.docChanged&&(this.value=this._editorView.state.doc.toString(),(0,u.dispatchCustomEvent)(this,"input",this.value))})),(0,a.autocompletion)({activateOnTyping:!0,override:[this._autocomplete.bind(this)]}),...this.getExtensions()]}getExtensions(){return[]}getInputElement(){return this.shadowRoot.querySelector(`[id=${this._id}]`)}firstUpdated(){super.firstUpdated(),this._editorState=s.EditorState.create({doc:this.value,extensions:this._getExtensions()});const e=this.getInputElement();this._editorView=new o.EditorView({root:this.shadowRoot,parent:e,state:this._editorState,dispatch:e=>{try{this._editorView.update([e])}catch(e){}}}),e.appendChild(this._editorView.dom)}async updated(e){super.updated(e),e.has("placeholder")&&this._reflectPlaceholder(),e.has("value")&&this._reflectValue(),(e.has("readonly")||e.has("disabled"))&&this._reflectReadonlyDisabled(),e.has("options")&&this.options&&await this._reflectOptions()}_reflectPlaceholder(){this._editorView.dispatch({effects:this.placeholderCompartment.reconfigure((0,l.placeholder)(this.placeholder))})}_reflectValue(){const e=this._editorState.update({changes:{from:0,to:this._editorState.doc.length,insert:this.value}});this._editorState=e.state}_reflectReadonlyDisabled(){this._editorView.dispatch({effects:this.readonlyCompartment.reconfigure(o.EditorView.editable.of(!this.readonly&&!this.disabled))})}static async findLanguage(e){if(e){const t=e.split("/").pop();if("asciidoc"===t){const[{asciidoc:e},{StreamLanguage:t}]=await Promise.all([Promise.resolve().then((()=>r(require("codemirror-asciidoc/lib/asciidoc")))),Promise.resolve().then((()=>r(require("@codemirror/stream-parser"))))]);return{name:"asciidoc",support:{extension:t.define(e)}}}{const r=d.languages.find((e=>e.name.toUpperCase()===t.toUpperCase()||e.alias.includes(t)));return null==r&&console.warn(`Cannot find language ${e}, please use language supported by CodeMirror 6`,d.languages.map((e=>e.name))),r}}return null}async _reflectOptions(){const e=await b.findLanguage(this.options.mode);null!=e&&(null==e.support&&await e.load(),this._editorView.dispatch({effects:this.languageCompartment.reconfigure(e.support.extension)}))}static get codemirrorTheme(){return o.EditorView.theme({"&.cm-editor.cm-focused":{outline:"none"},".cm-gutters":{backgroundColor:"var(--gv-input-icon--bgc, var(--gv-theme-neutral-color, #f5f5f5))",color:"var(--gv-theme-font-color-dark, #262626)",borderLeft:"5px solid",borderColor:"var(--gv-input--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9))"}})}static get styles(){return[...super.styles,g.skeleton,v.empty,f.input,i.css`:host{box-sizing:border-box;display:block;margin:0 .2rem .2rem .2rem}.content{position:relative;border:var(--gv-input--bdw,1px) var(--gv-input--bds,solid) var(--gv-input--bdc,var(--gv-theme-neutral-color-dark,#d9d9d9));box-sizing:border-box;border-radius:4px}.box-icon{bottom:-1px;right:-1px;z-index:1}.code .box-icon{border-radius:3px}.code .cm-content,.code .cm-gutters{height:var(--input-medium--h)}.large .code .cm-content,.large .code .cm-gutters{height:var(--input-large--h)}.small .code .cm-content,.small .code .cm-gutters{height:var(--input-small--h)}.input .cm-gutters{display:none}.input .cm-scroller{overflow:hidden}.input .cm-activeLine,:host([readonly]) .cm-activeLine{background-color:transparent}.input .cm-content{padding:0}:host([invalid]) .cm-gutters{border-color:var(--gv-theme-color-error,#da1a1b)}`]}}exports.GvCode=b,window.customElements.define("gv-code",b);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvConfirm=void 0;const e=require("lit");require("../atoms/gv-button"),require("../atoms/gv-icon");const t=require("../lib/i18n"),s=require("./gv-popover"),i=require("../lib/events");class o extends s.GvPopover{static get properties(){return{cancelLabel:{type:String},okLabel:{type:String},message:{type:String},icon:{type:String},danger:{type:Boolean,reflect:!0},disabled:{type:Boolean},_disabled:{type:Boolean}}}static get styles(){return[s.GvPopover.styles,e.css`:host{--gv-icon--s:24px;margin:.2rem;box-sizing:border-box}:host([danger]) .message gv-icon{--gv-icon--c:var(--gv-theme-color-danger, #ff5722)}.popover{--bgc:var(--gv-confirm--bgc, var(--gv-theme-neutral-color-lighter, #fafafa));--maw:var(--gv-confirm--maw, 350px)}.message{display:flex;align-items:center;margin:1rem .5rem}.message gv-icon{margin-right:.5rem}.text{text-align:center;line-height:24px;width:100%}.actions{text-align:right}::slotted(*){margin:0;width:100%}`]}constructor(){super(),this.event="click",this.arrow=!0,this.auto=!0,this.icon="code:info",this.cancelLabel=(0,t.i18n)("gv-confirm.cancel"),this.okLabel=(0,t.i18n)("gv-confirm.ok")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._closeHandler),window.addEventListener("scroll",this._closeHandler)}disconnectedCallback(){window.removeEventListener("resize",this._closeHandler),window.removeEventListener("scroll",this._closeHandler),super.disconnectedCallback()}_onCancel(){this.close(),(0,i.dispatchCustomEvent)(this,"cancel")}_onOk(){this.close(),(0,i.dispatchCustomEvent)(this,"ok")}_open(e){this._disabled||super._open(e)}renderContent(){return e.html`<div class="message">${this.icon?e.html`<gv-icon shape="${this.icon}"></gv-icon>`:""}<div class="text" .innerHTML="${this.message}"></div></div><div class="actions"><gv-button primary small outlined @click="${this._onCancel}">${this.cancelLabel}</gv-button><gv-button primary small @click="${this._onOk}">${this.okLabel}</gv-button></div>`}firstUpdated(e){super.firstUpdated(e),this.danger&&this.shadowRoot.querySelectorAll("gv-button").forEach((e=>e.setAttribute("danger",""))),this._disabled=this._calculateIsDisabled(),this.disabled&&this._reflectDisabledOnSlot()}_reflectDisabledOnSlot(){this.shadowRoot.querySelector("slot").assignedNodes({flatten:!0}).forEach((e=>{e.disabled=!0}))}_calculateIsDisabled(){const e=this.shadowRoot.querySelector("slot").assignedNodes({flatten:!0}).filter((e=>e.nodeType===Node.ELEMENT_NODE)).some((e=>!0===Boolean(e.getAttribute("disabled"))));return this.disabled||e}}exports.GvConfirm=o,window.customElements.define("gv-confirm",o);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvCronEditor=void 0,require("../atoms/gv-date-picker"),require("../organisms/gv-tabs"),require("../atoms/gv-input"),require("../atoms/gv-tag");const e=require("lit"),t=require("../styles/skeleton"),s=require("../mixins/input-element"),a=require("object-path"),i=require("lit/directives/repeat"),n=require("../mixins/with-resize-observer"),l=require("../lib/cron-expression"),o=require("../lib/events");class r extends((0,n.withResizeObserver)((0,s.InputElement)(e.LitElement))){static get properties(){return{...super.properties,mode:{type:String},_value:{type:String,attribute:!1},_currentDocumentationId:{type:String,attribute:!1},_small:{type:Boolean},_truncateTabs:{type:Boolean}}}constructor(){super(),this._value="",this.readonly=!1,this.autofocus=!1,this.clipboard=!1,this._modes=["seconds","minutes","hourly","daily","weekly","monthly","yearly","pro"],this._timeRange=[...Array(60).keys()],this._days=[{value:"MON",label:"Monday"},{value:"TUE",label:"Tuesday"},{value:"WED",label:"Wednesday"},{value:"THU",label:"Thursday"},{value:"FRI",label:"Friday"},{value:"SAT",label:"Saturday"},{value:"SUN",label:"Sunday"}],this._months=["January","February","March","April","May","June","July","August","September","October","November","December"],this._state={seconds:{seconds:1},minutes:{minutes:1,seconds:0},hourly:{hours:1,minutes:0,seconds:0},daily:{days:1,time:0,weekdays:!1},weekly:{days:[],time:0},monthly:{day:1,month:1,time:0},yearly:{day:1,month:1,time:0},pro:{value:"",displayDetails:!1}},this._docs=[{id:"second",label:"Second"},{id:"minute",label:"Minute"},{id:"hour",label:"Hour"},{id:"day-month",label:"Day (month)"},{id:"month",label:"Month"},{id:"day-week",label:"Day (week)"}],this._currentDocumentationId=this._docs[0].id,this._handleChange=this._onChange.bind(this),this._small=!1}tryToComputeAndInitModeFromValue(){if(!this.value||this.mode)return void(this.mode=this.mode||"pro");const[e,t,s]=this.value.split(" ");/\d+ \d+ \*\/\d+ \* \* \*/.test(this.value)?(this.mode="hourly",this._state.hourly.hours=Number(s.replace("*/","")),this._state.hourly.minutes=Number(t),this._state.hourly.seconds=Number(e)):/\d+ \*\/\d+ \* \* \* \*/.test(this.value)?(this.mode="minutes",this._state.minutes.minutes=Number(t.replace("*/","")),this._state.minutes.seconds=Number(e)):/\*\/\d+ \* \* \* \* \*/.test(this.value)?(this.mode="seconds",this._state.seconds.seconds=Number(e.replace("*/",""))):this.mode="pro"}onResize({width:e}){this._truncateTabs=e<750,this._small=e<449}set value(e){(0,l.isValidCron)(e,{seconds:!0,alias:!0})&&(this._value=e,""===this._state.pro.value&&(this._state.pro.value=e))}get value(){return"pro"===this.mode?this._state.pro.value:this._value}async firstUpdated(){this.tryToComputeAndInitModeFromValue(),await new Promise((e=>setTimeout(e,0))),this.shadowRoot.querySelectorAll("gv-input, gv-date-picker, gv-checkbox, gv-select").forEach((e=>{e.addEventListener(`${e.tagName.toLowerCase()}:input`,this._handleChange)}))}_onOpenDocumentation(e){this._currentDocumentationId=e}_onChange({target:e,detail:t}){if("cron-input"===e.id&&"pro"!==this.mode&&(this.mode="pro"),e.valid){if(null==e.name)throw new Error("Field target must have a name to update the state");let s=t;"gv-date-picker"===e.tagName.toLowerCase()?s=new Date(t):"number"===e.type&&(s=Number(t).valueOf()),(0,a.set)(this._state,e.name,s),this.generate(),e.classList.contains("request-update")&&this.requestUpdate()}}_onChangeTab(e){e.preventDefault(),e.stopPropagation();const{detail:{to:t}}=e;"pro"===t&&(this._state.pro.value=this.value),this.mode=t,this.generate(),"pro"===this.mode&&this.shadowRoot.querySelector("#cron-input").focus()}_getTimeExpression(e){return e?`${e.getSeconds()} ${e.getMinutes()} ${e.getHours()}`:"* * *"}generate(){let e="";switch(this.mode){case"seconds":e=this._state.seconds.seconds?`*/${this._state.seconds.seconds} * * * * *`:"* * * * * *";break;case"minutes":e=this._state.minutes.minutes?`${this._state.minutes.seconds} */${this._state.minutes.minutes} * * * *`:`${this._state.minutes.seconds} * * * * *`;break;case"hourly":e=this._state.hourly.hours?`${this._state.hourly.seconds} ${this._state.hourly.minutes} */${this._state.hourly.hours} * * *`:`${this._state.minutes.seconds} ${this._state.hourly.minutes} * * * *`;break;case"daily":e=!1===this._state.daily.weekdays?`${this._getTimeExpression(this._state.daily.time)} ${this._state.daily.days} * *`:`${this._getTimeExpression(this._state.daily.time)} * * MON-FRI`;break;case"weekly":e=0===this._state.weekly.days.length?`${this._getTimeExpression(this._state.weekly.time)} * * *`:`${this._getTimeExpression(this._state.weekly.time)} * * ${this._state.weekly.days.join(",")}`;break;case"monthly":e=`${this._getTimeExpression(this._state.monthly.time)} ${this._state.monthly.day} ${this._state.monthly.month} *`;break;case"yearly":e=`${this._getTimeExpression(this._state.yearly.time)} ${this._state.yearly.day} */${this._months.indexOf(this._state.yearly.month)+1} *`;break;case"pro":e=this._state.pro.value;break;default:throw new Error("Invalid cron active tab selection")}this.updateState(e),this.valid&&(this._value=e,this.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),(0,o.dispatchCustomEvent)(this,"input",this.value))}updateState(e){super.updateState(e),this.valid&&((0,l.isValidCron)(e,{seconds:!0,alias:!0})?this.setValidity():this.setValidity(!0,"field is not valid cron expression"))}renderLabel(){return this.label?e.html`<label for="${this.id}" title="${this.label}">${this.label}</label>`:""}displayProDetails(){this._state.pro.displayDetails=!this._state.pro.displayDetails,this.requestUpdate()}renderProDetails(){return this._state.pro.displayDetails?e.html`<div class="tab-content_pro-pane_container"><div class="tab-content_pro-pane"><div>Rules for:</div><div>${(0,i.repeat)(this._docs,(e=>e.id),(t=>{const s=t.id===this._currentDocumentationId;return e.html`<gv-tag @gv-tag:click="${this._onOpenDocumentation.bind(this,t.id)}" ?clickable="${!s}" ?major="${s}" ?minor="${!s}">${t.label}</gv-tag>`}))}</div><ul class="help"><li><small>Allowed characters: <code>${this.allowedChar}</code></small></li><li><small>Allowed values: <code>${this.allowedValues}</code></small></li></ul></div><div class="tab-content_pro-pane"><div>Examples:</div><ul class="help"><li><small><code>*</code>: for each unit (0, 1, 2, 3...)</small></li><li><small><code>5,8</code>: units 5 and 8</small></li><li><small><code>2-5</code>: units from 2 to 5 (2, 3, 4, 5)</small></li><li><small><code>*/3</code>: every 3 units (0, 3, 6, 9...)</small></li><li><small><code>10-20/3</code>: every 3 units, between the tenth and the twentieth (10, 13, 16, 19)</small></li></ul></div></div>`:""}render(){return e.html`<div>${this.renderLabel()}<div class="box"><gv-tabs .value="${this.mode}" .options="${this._modes}" .disabled="${this.disabled}" ?small="${this._small}" ?truncate="${this._truncateTabs}" @gv-tabs:change="${this._onChangeTab.bind(this)}"><div slot="title" class="generated-expression"><gv-input name="pro.value" .autofocus="${this.autofocus}" .value="${this.value}" id="cron-input" placeholder="* */30 * * * * (Every 30 min)"></gv-input></div><div slot="content" id="seconds" class="tab-content"><span>Every</span><gv-input small type="number" min="1" name="seconds.seconds" .value="${this._state.seconds.seconds}"></gv-input><span>second(s)</span></div><div slot="content" id="minutes" class="tab-content"><span>Every</span><gv-input small type="number" min="1" name="minutes.minutes" .value="${this._state.minutes.minutes}"></gv-input><span>minute(s) on second</span><gv-input small type="number" min="0" max="59" name="minutes.seconds" .value="${this._state.minutes.seconds}"></gv-input></div><div slot="content" id="hourly" class="tab-content"><span>Every</span><gv-input small type="number" min="1" name="hourly.hours" .value="${this._state.hourly.hours}"></gv-input><span>hour(s) on minute</span><gv-input small type="number" min="0" max="59" name="hourly.minutes" .value="${this._state.hourly.minutes}"></gv-input><span>and second</span><gv-input small type="number" min="0" max="59" name="hourly.seconds" .value="${this._state.hourly.seconds}"></gv-input></div><div slot="content" id="daily" class="tab-content"><span>Every</span><gv-input small type="number" min="1" max="31" name="daily.days" ?disabled="${this._state.daily.weekdays}" .value="${this._state.daily.days}"></gv-input><span class="line">day(s)<gv-checkbox class="request-update" label="of week" name="daily.weekdays" ?checked="${this._state.daily.weekdays}"></gv-checkbox>at</span><gv-date-picker small time strict name="daily.time" .value="${this._state.daily.time}"></gv-date-picker></div><div slot="content" id="weekly" class="tab-content tab-content_weekly"><span>Every</span><gv-select small multiple="multiple" name="weekly.days" .options="${this._days}" .value="${this._state.weekly.days}"></gv-select><span>day(s) at</span><gv-date-picker small time strict name="weekly.time" .value="${this._state.weekly.time}"></gv-date-picker></div><div slot="content" id="monthly" class="tab-content"><span>On the</span><gv-input small type="number" min="1" max="31" name="monthly.day" class="request-update" .value="${this._state.monthly.day}"></gv-input><span><sup>${this._getDaySuffix(this._state.monthly.day)}</sup> </span><span>day of every</span><gv-input small type="number" min="1" max="12" name="monthly.month" .value="${this._state.monthly.month}"></gv-input><span>month(s) at</span><gv-date-picker small time strict name="monthly.time" .value="${this._state.monthly.time}"></gv-date-picker></div><div slot="content" id="yearly" class="tab-content"><span>Every</span><gv-select small name="yearly.month" .options="${this._months}" .value="${this._state.yearly.month}"></gv-select><span>on the</span><gv-input small type="number" min="1" max="31" name="yearly.day" class="request-update" .value="${this._state.yearly.day}"></gv-input><span><sup>${this._getDaySuffix(this._state.yearly.day)}</sup></span> <span>day</span><gv-date-picker small time strict name="yearly.time" .value="${this._state.yearly.time}"></gv-date-picker></div><div slot="content" id="pro" class="tab-content tab-content_pro"><gv-button link small class="tab-content_pro-details_btn" @click="${this.displayProDetails}">${this._state.pro.displayDetails?"Hide information about cron rules and examples":"Display information about cron rules and examples"}</gv-button>${this.renderProDetails()}</div></gv-tabs></div></div>`}get allowedValues(){if("pro"===this.mode)switch(this._currentDocumentationId){case"hour":return"0-23";case"day-month":return"1-31";case"month":return"1-12 or JAN-DEC";case"day-week":return"1-7 or SUN-SAT";default:return"0-59"}return""}get allowedChar(){return"pro"===this.mode?",-*/":""}_getDaySuffix(e=1){return e?e.toString().endsWith("1")?"st":e.toString().endsWith("2")?"nd":e.toString().endsWith("3")?"rd":"th":""}static get styles(){return[t.skeleton,e.css`:host{box-sizing:border-box;display:block;margin:.2rem}:host([invalid]) .box{border-left-color:var(--gv-theme-color-error-dark,#d32f2f);border-left-width:3px}.box{border:1px solid var(--gv-theme-neutral-color-dark,#bfbfbf);border-radius:4px}.generated-expression{display:flex;align-items:center;flex:1}.generated-expression>code,.generated-expression>span{margin:.4rem}.generated-expression code,.generated-expression gv-input{--input-small--fz:16px;font-size:16px}.generated-expression gv-input{--gv-input--bdc:transparent;margin:0;min-width:190px}.tab-content{display:flex;align-items:center;background-color:var(--gv-theme-neutral-color,#f5f5f5);font-style:italic;font-size:var(--gv-theme-font-size-s,12px);padding:.2rem}.tab-content>*{margin:.2rem}.tab-content gv-input[type=number]{width:50px}.tab-content_weekly gv-select{width:auto}.tab-content_pro code{font-size:14px;font-weight:700;font-style:normal}.tab-content_pro{display:flex;flex-direction:column;align-items:normal;--gv-icon--s:18px;padding:.2rem}.tab-content_pro-details_btn{--gv-button--fz:12px}.tab-content_pro-pane_container{display:flex;flex-direction:row}.tab-content_pro-pane{flex:auto}.tab-content_pro>*{margin:.2rem}.tab-content_pro gv-icon,.tab-content_pro small{margin:0 .2rem}gv-tabs{--gv-tabs-options--m:auto 0.2rem auto 0}gv-tabs[small]{--gv-tabs-options--m:auto 0}gv-tabs[small] .tab-content{padding:0}.line{display:flex;align-items:center;margin:0}.line>*{margin:0 .3rem}gv-checkbox{text-decoration:line-through;font-weight:400}gv-checkbox[checked]{text-decoration:none}sup{display:inline-block;font-size:var(--gv-theme-font-size-s,12px)}ul{list-style:none;margin:.5rem 1rem;padding:0}ul.help{padding-left:.2rem;margin-left:.4rem;border-left:2px dotted var(--gv-theme-neutral-color-dark,#bfbfbf)}small{font-size:var(--gv-theme-font-size-s,12px)}`]}}exports.GvCronEditor=r,window.customElements.define("gv-cron-editor",r);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvDropdownMenu=void 0;const e=require("lit");class t extends e.LitElement{static get properties(){return{open:{type:Boolean,reflect:!0},right:{type:Boolean,reflect:!0}}}static get styles(){return[e.css`:host{box-sizing:border-box;display:block}.actions{position:absolute;background-color:#fff;transition:all .3s ease-in-out;border-style:solid;border-color:#bfbfbf;border-width:var(--gv-dropdown-menu--bdw,1px 1px 1px 1px);z-index:201;padding:var(--gv-dropdown-menu--p,.5rem);visibility:hidden;opacity:0;display:grid;grid-gap:var(--gv-dropdown-menu--gg,.2rem);bottom:0;top:0}:host([open]) .actions{opacity:1;visibility:visible;cursor:pointer}:host([right]) .actions{right:0}`]}constructor(){super(),this.open=!1,this.right=!1,this._handleDocumentClick=this._onDocumentClick.bind(this)}connectedCallback(){super.connectedCallback()}disconnectedCallback(){window.removeEventListener("click",this._handleDocumentClick),super.disconnectedCallback()}_onDocumentClick(){this.open=!1,window.removeEventListener("click",this._handleDocumentClick)}toggle(){this.open=!this.open,setTimeout((()=>{this.open?window.addEventListener("click",this._handleDocumentClick):window.removeEventListener("click",this._handleDocumentClick)}),0)}render(){return e.html`<div class="box"><slot @click="${this.toggle}"></slot><div class="actions"><slot name="action" class="action"></slot></div></div>`}}exports.GvDropdownMenu=t,window.customElements.define("gv-dropdown-menu",t);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvExpandable=void 0;const e=require("lit"),i=require("../styles/link"),t=require("lit/directives/class-map"),s=require("../lib/events");class n extends e.LitElement{constructor(){super(),this.open=!1,this.icon="navigation:angle-left",this.iconOpened="navigation:angle-down",this.clickable=!1}static get properties(){return{open:{type:Boolean,reflect:!0},icon:{type:String},iconOpened:{type:String,attribute:"icon-opened"},clickable:{type:Boolean}}}static get styles(){return[i.link,e.css`:host{box-sizing:border-box}.box{padding:.2rem;line-height:23px;border-bottom:var(--gv-expandable--bdb,thin solid var(--gv-theme-color,#5a7684))}:host([open]) .details{visibility:visible;opacity:1;height:auto;overflow:visible}.details{display:block;overflow:hidden;opacity:0;visibility:hidden;transition:all 150ms ease-in-out;height:0}.summary{display:flex;flex-direction:row;align-content:center;justify-content:space-between}.expand{align-self:center;margin-left:5px;--gv-icon--s:16px}`]}_onClick(e){if(!this.clickable){if(!this.shadowRoot.querySelector(".summary").contains(e.target)&&"summary"!==e.target.slot)return}this.open=!this.open,(0,s.dispatchCustomEvent)(this,"toggle",{open:this.open})}render(){const i=this.open?this.iconOpened:this.icon;return e.html`<div class="${(0,t.classMap)({box:!0,link:this.clickable})}" @click="${this._onClick}"><div class="${(0,t.classMap)({summary:!0,link:!this.clickable})}"><slot name="summary"></slot><gv-icon shape="${i}" class="expand"></gv-icon></div><slot name="details" class="details"></slot></div>`}}exports.GvExpandable=n,window.customElements.define("gv-expandable",n);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvExpressionLanguage=void 0;const e=require("../molecules/gv-code"),t=require("../lib/events"),r=require("@codemirror/autocomplete"),a=require("@codemirror/view"),s=require("@codemirror/state"),n=require("object-path");class p extends e.GvCode{static get properties(){return{...super.properties,grammar:{type:Object}}}firstUpdated(){super.firstUpdated(),(0,t.dispatchCustomEvent)(this,"ready",{currentTarget:this})}getExtensions(){return[s.Prec.high(this.insertELKeymap())]}insertELKeymap(){return a.keymap.of([{key:"Ctrl-Shift-e",mac:"Cmd-Shift-e",run:e=>(e.dispatch(e.state.changeByRange((e=>({changes:[{from:e.from,to:e.to,insert:"{#}"}],range:s.EditorSelection.range(e.from+2,e.from+2)})))),(0,r.startCompletion)(e),!0)}])}buildMethods(e){return this.getModelType(e).methods.map((({name:e,params:t=[],returnType:a})=>{const s=`${e}()`,n=t.map((e=>`${e.type} ${e.name}`));return{type:"method",command:s,apply:(t,a,s,n)=>{const p=s+e.length+1;t.dispatch({changes:{from:s,to:n,insert:a.command},selection:{anchor:p},userEvent:"input.complete",annotations:r.pickedCompletion.of(t)})},label:`${e}(${n.join(", ")})`,detail:`return ${a}`}}))}findBestAutocompleteHandler(e){return this.expressionLanguageCompletionHandlers.filter((e=>null!=this.grammar&&!0===e.supportEL||!0!==e.supportEL)).map((t=>({handler:t,match:!t.expr||e.matchBefore(t.expr)}))).find((({match:e,expr:t})=>e))}getModelType(e){return null!=this.grammar?(0,n.get)(this.grammar,`_types.${e}`):null}isMap(e){return["Map","HttpHeaders","MultiValueMap"].includes(e)}getEnum(e){return null!=this.grammar?(0,n.get)(this.grammar,`_enums.${e}`):[""]}convertType(e){if(e){const t=e.toLowerCase();if("string"===t)return"text";if("httpheaders"===t||"multivaluemap"===t)return"type";if("int"===t||"long"===t)return"variable";if(t.includes("[]"))return"enum"}return"variable"}get expressionLanguageCompletionHandlers(){return[{expr:/{#[a-z]*/,supportEL:!0,run(e,t){const r=t.text.replaceAll("{#","");return{from:e.pos-r.length,options:Object.keys(this.grammar).filter((e=>!e.startsWith("_")&&e.startsWith(r))).map((e=>({type:"variable",command:e,apply:e,label:e})))}}},{expr:/{#[a-z]*.[a-zA-Z]*/,supportEL:!0,run(e,t){const r=t.text.split("."),a=r[0].replaceAll("{#",""),s=r[1];let n=this.grammar[a][s],p=[],i=e.pos;return n?this.isMap(n._type)&&(p=this.getEnum(n._type).map((e=>{const t=`['${e}'][0]`;return{type:this.convertType(n._type),command:t,apply:t,label:e}}))):(i-=s.length,n=this.grammar[a],p=n._type?this.buildMethods(n._type):Object.keys(n).filter((e=>!e.startsWith("_")&&e.startsWith(s))).map((e=>({type:this.convertType(n[e]._type),command:e,apply:e,label:e})))),{from:i,options:p}}},{expr:/{#[a-z]*.[a-zA-Z]*.[a-zA-Z]*/,supportEL:!0,run(e,t){const a=t.text.split("."),s=a[0].replaceAll("{#",""),n=a[1],p=a[2],i=this.grammar[s][n];let o=[],l=e.pos;return i&&(this.isMap(i._type)?o=this.getEnum(i._type).filter((e=>!e.startsWith("_")&&e.startsWith(p))).map((e=>({type:this.convertType(i._type),command:`['${e}'][0]`,apply(e,t,a,s){l=a-p.length-1,e.dispatch({changes:{from:l,to:s,insert:t.command},selection:{anchor:l+t.command.length},userEvent:"input.complete",annotations:r.pickedCompletion.of(e)})},label:e}))):i._type?o=this.buildMethods(i._type):(l-=p.length,o=Object.keys(i).filter((e=>e.startsWith(p))).map((e=>({type:this.convertType(i[e]._type),command:e,apply:e,label:e}))))),{from:l,options:o}}},this.defaultCompletionHandler]}}exports.GvExpressionLanguage=p,window.customElements.define("gv-expression-language",p);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvIdentityPicture=void 0;const e=require("lit"),t=require("jdenticon"),i=require("../styles/skeleton"),r=require("lit/directives/style-map");require("../atoms/gv-image");class o extends e.LitElement{static get properties(){return{picture:{type:String},display_name:{type:String},_error:{type:Boolean,attribute:!1},notification:{type:Boolean},rounded:{type:Boolean,reflect:!0},skeleton:{type:Boolean}}}static get styles(){return[i.skeleton,e.css`:host{display:block;position:relative}div{text-align:center}.skeleton,svg{width:auto;height:auto;max-width:100%;max-height:100%}gv-image{width:100%;height:100%;--gv-image--of:contain}:host([rounded]) gv-image,:host([rounded]) svg{border:2px solid var(--gv-theme-neutral-color-lighter,#fafafa);border-radius:50%;box-sizing:border-box;--gv-image--of:cover}.notification{position:absolute;width:8px;height:8px;background-clip:padding-box;border-radius:50%;background-color:var(--gv-identity-picture-notification--bgc,var(--gv-theme-color-light,#86c3d0))}`]}_onError(){this._error=!0}_toNumber(e){return parseInt(e.replace("px",""),10)}_onLoaded(){this._error=!1}_getMaxSize(e,t){return Math.min(this._toNumber(e),this._toNumber(t))}updated(e){e.has("picture")&&(this._error=!1)}render(){const{width:i,height:o}=window.getComputedStyle(this);if((!this.picture||this._error)&&i&&o){const r=this._getMaxSize(i,o),n=document.createElement("div");if(this.skeleton&&n.classList.add("skeleton"),n.title=this.display_name,n.innerHTML=(0,t.toSvg)(this.display_name,r,{backColor:"#FFF"}),this.notification){const e=document.createElement("span");e.className="notification",e.style.left=i,n.appendChild(e)}return e.html`${n}`}return e.html`<gv-image src="${this.picture}" alt="${this.display_name}" title="${this.display_name}" @error="${this._onError}" @gv-image:loaded="${this._onLoaded}"></gv-image>${this.notification?e.html`<span class="notification" style="${(0,r.styleMap)({left:i})}"></span>`:""}`}}exports.GvIdentityPicture=o,window.customElements.define("gv-identity-picture",o);
|
package/src/molecules/gv-list.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvList=void 0;const e=require("lit"),t=require("lit/directives/repeat"),i=require("lit/directives/class-map"),s=require("../lib/i18n"),r=require("../styles/link");require("../molecules/gv-identity-picture");const l=require("../lib/events"),n=require("../lib/item"),a=require("../mixins/with-skeleton-attribute");class o extends((0,a.withSkeletonAttribute)(e.LitElement)){static get properties(){return{...super.styles,items:{type:Object},title:{type:String},clickable:{type:Boolean},_items:{type:Object,attribute:!1}}}static get styles(){return[...super.styles,r.link,e.css`:host{box-sizing:border-box;display:inline-block;width:280px;border-radius:4px;background-color:var(--gv-list--bgc,var(--gv-theme-neutral-color-lightest,#fff));--gv-icon--s:var(--gv-list-icon--s, 20px)}gv-identity-picture{width:var(--gv-list-image--w,40px);height:var(--gv-list-image--h,40px)}.list{list-style:none;margin:0;padding:0}h3{padding:24px;font-size:var(--gv-theme-font-size-m);line-height:var(--gv-theme-font-size-m);opacity:.6;letter-spacing:.05rem;border-bottom:1px solid var(--gv-theme-neutral-color);margin:0}h4{font-size:var(--gv-theme-font-size-m);line-height:var(--gv-theme-font-size-m);opacity:.9;letter-spacing:.05rem}h4 span{font-size:var(--gv-theme-font-size-s,12px);margin-left:8px}.item{display:flex;margin:24px}.item__image{align-self:center;margin-right:4px}.item__content{display:flex;flex-direction:column;justify-content:space-evenly}.item__title{margin:0}.item__description{font-size:var(--gv-theme-font-size-m,14px);line-height:22px;opacity:.5;display:-webkit-box;max-width:200px;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}.scrollable-container{max-height:400px;overflow:auto}`]}constructor(){super(),this._skeletonAttribute="items"}_onClick(e){(0,l.dispatchCustomEvent)(this,"click",e)}_renderImage(t){return e.html`<gv-identity-picture .picture="${(0,n.getPicture)(t)}" .display_name="${(0,n.getPictureDisplayName)(t)}"></gv-identity-picture>`}_renderStatus(t){if(t){if(t.filter((e=>"PAUSED"===e.status.toUpperCase())).length>0)return e.html`<gv-icon title="${(0,s.i18n)("gv-list.paused")}" shape="media:pause"></gv-icon>`;if(t.filter((e=>"PENDING"===e.status.toUpperCase())).length>0)return e.html`<gv-icon title="${(0,s.i18n)("gv-list.pending")}" shape="home:timer"></gv-icon>`}return""}_renderItem(t){return t?e.html`<div class="item__image">${this._renderImage(t.item)}</div><div class="item__content"><h4 class="item__title">${this._renderStatus(t.subscriptions)}${t.item.name} <span>${(0,n.getVersion)(t.item)}</span></h4><div class="item__description">${t.item.description}</div></div>`:e.html`<p>xxxx-xxxx-xxxx-xxxx</p>`}_renderItems(){return this._empty&&!this._skeleton?"":this._skeleton?e.html`<ul class="list"><h4 class="skeleton">xxxx-xxxx-xxxx-xxxx</h4><div class="scrollable-container"><li class="item skeleton">${this._renderItem()}</li><li class="item skeleton">${this._renderItem()}</li></div></ul>`:e.html`<ul class="list"><h3>${this.title?this.title:""} ${this._items&&this._items.length>0?e.html`<span>(${this._items.length})</span>`:""}</h3><div class="scrollable-container">${this._items?(0,t.repeat)(this._items,(e=>e),(t=>this.clickable?e.html`<li class="${(0,i.classMap)({item:!0,link:!0})}" @click="${this._onClick.bind(this,t)}">${this._renderItem(t)}</li>`:e.html`<li class="${(0,i.classMap)({item:!0})}">${this._renderItem(t)}</li>`)):""}</div></ul>`}render(){return e.html`<div>${this._error?e.html`<div class="error">${(0,s.i18n)("gv-list.error")}</div>`:this._renderItems()}</div>`}}exports.GvList=o,window.customElements.define("gv-list",o);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvMetrics=void 0;const t=require("lit");require("../atoms/gv-metric");const e=require("../lib/i18n"),i=require("../styles/link"),s=require("../mixins/with-skeleton-attribute"),r=require("lit/directives/class-map"),c=require("../lib/events"),l=require("lit/directives/if-defined");class n extends((0,s.withSkeletonAttribute)(t.LitElement)){static get properties(){return{metrics:{type:Object},_metrics:{type:Object,attribute:!1}}}static get styles(){return[...super.styles,i.link,t.css`:host{box-sizing:border-box;margin:.2rem;width:100%;height:100%;min-height:25px;min-width:25px;display:flex;width:100%}:host>*{flex:1 1 auto}`]}constructor(){super(),this._skeletonAttribute="metrics",this.skeleton=!1,this._error=!1,this._empty=!1}_isClickable(t){return!(!this._metrics||"object"!=typeof this._metrics[t])&&this._metrics[t].clickable}_getValue(t){return"object"==typeof t?t.value:t}_getSubscribers(){return this._metrics?this._getValue(this._metrics.subscribers):null}_getHits(){return this._metrics?this._getValue(this._metrics.hits):null}_getHealth(){if(this._metrics){const t=this._getValue(this._metrics.health);return isNaN(t)?"":Intl.NumberFormat.call(this,navigator.language,{style:"percent",maximumFractionDigits:2}).format(t)}return null}_getTitle(t){return this._metrics&&"object"==typeof this._metrics[t]?this._metrics[t].title:null}_onClick(t){(0,c.dispatchCustomEvent)(this,"click",{key:t})}_renderMetric(e,i,s,c){const n=this._isClickable(e);return c||this._skeleton?t.html`<gv-metric @click="${n?this._onClick.bind(this,e):null}" .skeleton="${this._skeleton}" icon="${i}" name="${s}" value="${c}" class="${(0,r.classMap)({link:n})}" title="${(0,l.ifDefined)(this._getTitle(e))}"></gv-metric>`:t.html``}render(){if(this._error)return t.html`<div class="error">${(0,e.i18n)("gv-metrics.error")}</div>`;const i=this._getSubscribers(),s=this._getHits(),r=this._getHealth();return t.html`${this._renderMetric("subscribers","communication:group",(0,e.i18n)("gv-metrics.subscribers",{count:i}),i)} ${this._renderMetric("hits","general:cursor",(0,e.i18n)("gv-metrics.hits",{count:s}),s)} ${this._renderMetric("health","general:heart",(0,e.i18n)("gv-metrics.health"),r)}<slot></slot>`}}exports.GvMetrics=n,window.customElements.define("gv-metrics",n);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvModal=void 0;const t=require("lit");require("../atoms/gv-icon");const e=require("../lib/events");class o extends t.LitElement{static get properties(){return{_toChange:{type:Boolean},opened:{type:Boolean},showCloseIcon:{type:Boolean},modalTitle:{type:String},blocking:{type:Boolean}}}constructor(){super(),this._toChange=!1,this.opened=!1,this.showCloseIcon=!1,this.blocking=!1}static get styles(){return[t.css`*{box-sizing:border-box}:host{display:block}section{position:fixed;left:0;top:0;height:100vh;width:100vw;display:none;transition:opacity var(--gv-modal--anim-duration,.3s) ease-in;-webkit-transition:opacity var(--gv-modal--anim-duration,.3s) ease-in;align-items:center;justify-content:center;z-index:var(--gv-modal--z,100);background-color:var(--gv-modal--bgc,rgba(30,30,30,.6))}.content{display:block;position:relative;z-index:var(--gv-modal-content--z,101);width:var(--gv-modal--w,280px);min-width:var(--gv-modal--miw,250px);max-width:var(--gv-modal--maw,100vw);height:var(--gv-modal--h,auto);min-height:var(--gv-modal--mih,auto);max-height:var(--gv-modal--mah,100vh);background-color:var(--gv-modal-content--bgc,var(--gv-theme-neutral-color-light,#efefef));box-shadow:var(--gv-modal--bxsh,0 0 16px #383e3f);border-radius:var(--gv-modal--bdrs,4px);padding:var(--gv-modal--p,1em)}article{overflow:auto;max-height:100%;height:100%}.transparent{opacity:0}.opaque{opacity:1;display:flex!important}.opened{display:flex!important}.header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-bottom:10px}.title{font-weight:700;font-size:large}gv-icon{--gv-icon--s:var(--gv-modal-close-icon--s, 24px);display:inline-block;z-index:1002;cursor:pointer}`]}render(){return t.html`<section class="${this.getModalClass(this.opened,this._toChange)}" @click="${this._backgroundModalClick}" @transitionend="${this.animationEnd}"><div class="content" @click="${this.contentClick}"><div class="header"><span class="title">${this.modalTitle}</span> ${this.showCloseIcon?t.html`<gv-icon shape="general:close" @click="${this.close}"></gv-icon>`:""}</div><article><slot></slot></article></div></section>`}getModalClass(t,e){return t||e?t&&e?"transparent opened":t&&!e?"opaque":!t&&e?"transparent opened":void 0:"transparent"}open(){this.opened=!0,this._toChange=!0,setTimeout((()=>{this._toChange=!1}),50)}_backgroundModalClick(t){this.blocking||(this.close(),(0,e.dispatchCustomEvent)(this,"closed"))}close(){this.opened=!1,this._toChange=!0,(0,e.dispatchCustomEvent)(this,"closed")}animationEnd(){this._toChange=!1}contentClick(t){t.stopPropagation()}}exports.GvModal=o,window.customElements.define("gv-modal",o);
|
package/src/molecules/gv-nav.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvNav=void 0;const t=require("lit"),e=require("lit/directives/repeat");require("../atoms/gv-link");const i=require("lit/directives/until"),s=require("../lib/utils"),o=require("../lib/events"),l=require("lit/directives/class-map");class r extends t.LitElement{static get properties(){return{routes:{type:Array},_routes:{type:Array},small:{type:Boolean},_compact:{type:Boolean,attribute:!1},vertical:{type:Boolean,reflect:!0}}}static get styles(){return[t.css`nav{position:relative;transition:all 150ms ease-in-out}gv-link{--gv-link--ta:end}.vertical{display:flex;flex-direction:column}.vertical gv-link{width:100%}.compact{--gv-link-a--ph:10px}#shadowLink{position:absolute;display:inline-flex;opacity:.5;top:0;left:0;transition:transform 250ms ease-in-out,width 250ms}`]}_onClick(t){t.stopPropagation();const{detail:e}=t,{title:i,target:s}=e;if("_blank"===s)(0,o.dispatchCustomEvent)(this,"click",e);else if(!this._isLocked){this._isLocked=!0;let t=0;this._routes.forEach(((e,s)=>(e.title===i?(e.active=!0,t=s):delete e.active,e)));const s=this.shadowRoot.querySelector("gv-link[active]"),l=this.shadowRoot.querySelectorAll("gv-link")[t];if(s){const t=s.cloneNode(!0),{height:i,width:r}=s.getBoundingClientRect();t.id="shadowLink",t.style.top=`${s.offsetTop}px`,t.style.left=`${s.offsetLeft}px`,t.style.width=`${r}px`,t.style.height=`${i}px`,s.removeAttribute("active"),s.style.height=`${i}px`,this.shadowRoot.querySelector("nav").prepend(t);const a=l.offsetLeft-s.offsetLeft,n=l.offsetTop-s.offsetTop;t.style.transform=`translate(${a}px,${n}px)`,setTimeout((()=>{l.setAttribute("active",!0),this.shadowRoot.querySelector("nav").removeChild(t),this._isLocked=!1,(0,o.dispatchCustomEvent)(this,"click",e)}),250)}else l.setAttribute("active",!0),this._isLocked=!1,(0,o.dispatchCustomEvent)(this,"click",e)}}constructor(){super(),this._routes=[],this.vertical=!1}set routes(t){t&&Promise.resolve(t).then((t=>{(0,s.isSameRoutes)(this._routes,t)||(this._routes=t)}))}_getLink(e,s){return Promise.resolve(e).then((e=>t.html`<gv-link @gv-link:click="${this._onClick}" .active="${e.active}" .icon="${e.icon}" .path="${e.path}" .target="${e.target}" ?small="${this.small}" .title="${e.title}" .help="${(0,i.until)(e.help,null)}" ?vertical="${this.vertical}"></gv-link>`)).catch((()=>{delete this._routes[s]}))}updated(t){t.has("_routes")&&(this._compact=this._routes&&this._routes.length>5)}render(){return this._routes?t.html`<nav class="${(0,l.classMap)({compact:this._compact,vertical:this.vertical})}">${(0,e.repeat)(this._routes,(t=>t),((e,s)=>(0,i.until)(this._getLink(e,s),t.html`<gv-link skeleton .vertical="${this.vertical}"></gv-link>`)))}</nav>`:t.html``}}exports.GvNav=r,window.customElements.define("gv-nav",r);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvOption=void 0;const t=require("lit");require("../atoms/gv-button");const e=require("lit/directives/repeat"),i=require("lit/directives/class-map"),s=require("../lib/events"),n=require("lit/directives/if-defined"),r=require("lit/directives/style-map");class o extends t.LitElement{static get properties(){return{options:{type:Array},_options:{type:Array,attribute:!1},_hasDescription:{type:Array,attribute:!1},value:{type:String,reflect:!0},multiple:{type:Boolean},reverse:{type:Boolean},small:{type:Boolean},outlined:{type:Boolean},disabled:{type:Boolean,reflect:!0}}}static get styles(){return[t.css`:host{box-sizing:border-box;display:inline-block;--gv-button--p:5px;margin:.2rem;--bdrs:var(--gv-option--bdrs, 0.15rem);--maw:var(--gv-option-button--maw, 200px)}.box.description{display:grid;grid-gap:.5rem}gv-button{margin:0}gv-button.description{flex:1 1 var(--maw);max-width:var(--maw)}gv-button:not(.description){margin:0;--gv-button--bdrs:0;--gv-button--bgc:var(--gv-option--bgc, var(--gv-theme-neutral-color-dark, #bfbfbf))}gv-button:not(.description).entry{--gv-button--bdrs:var(--bdrs) 0 0 var(--bdrs)}gv-button:not(.description).exit{--gv-button--bdrs:0 var(--bdrs) var(--bdrs) 0}.content{white-space:pre-line;--gv-icon--s:var(--gv-option-icon--s, 64px);display:flex;flex-direction:column;align-items:center;height:100%;text-transform:none}gv-image{height:64px;width:64px;--gv-image--of:fill;display:inline-flex}.reverse .content{flex-direction:column-reverse}.title{font-size:var(--gv-theme-font-size-l,18px);font-weight:700;margin:.5rem 0}gv-button.description{margin:.5rem}`]}constructor(){super(),this.multiple=!1,this.reverse=!1}_onClick(t){this.setValue(t),(0,s.dispatchCustomEvent)(this,"select",t),this.dispatchEvent(new Event("input"),{bubbles:!0,cancelable:!0})}async performUpdate(){return this.shadowRoot.querySelectorAll("gv-button").forEach((t=>t.performUpdate())),super.performUpdate()}setValue(t){t&&(this.multiple?this.value.includes(t.id)?this.value=this.value.filter((e=>e!==t.id)):this.value=[...this.value,t.id]:this.value=t.id)}set options(t){t&&Promise.all(t).then((t=>{this._options=t,this._hasDescription=null!=this._options.find((t=>null!=t.description))}))}isActive(t){return!!this.value&&(this.multiple?this.value.includes(t.id):this.value===t.id)}_renderOption(e,s){const r=this.isActive(e),o=this.outlined||!r&&this._hasDescription;return t.html`<gv-button .icon="${(0,n.ifDefined)(this._hasDescription?null:e.icon)}" .iconRight="${(0,n.ifDefined)(!e.icon&&e.iconRight?e.iconRight:null)}" .title="${(0,n.ifDefined)(e.title)}" .primary="${r}" .small="${this.small}" .disabled="${e.disabled||this.disabled}" @click="${this._onClick.bind(this,e)}" .outlined="${o}" class="${(0,i.classMap)({active:r,entry:0===s,exit:s===this._options.length-1,description:null!=e.description})}">${this._hasDescription?t.html`<div class="content">${e.icon?t.html`<gv-icon shape="${e.icon}"></gv-icon>`:e.image?t.html`<gv-image src="${e.image}"></gv-image>`:""}<div class="title">${e.title}</div><div class="description-content" .innerHTML="${e.description}"></div></div>`:null!=e.title?e.label||e.title:""}</gv-button>`}render(){if(this._options){const s={box:!0,description:this._hasDescription,reverse:this.reverse};return t.html`<div class="${(0,i.classMap)(s)}" style="${(0,r.styleMap)({"grid-template-columns":`repeat(${this._options.length}, auto)`})}">${(0,e.repeat)(this._options,(t=>t),((e,i)=>t.html`${this._renderOption(e,i)}`))}</div>`}return t.html``}}exports.GvOption=o,window.customElements.define("gv-option",o);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvPlans=void 0;const e=require("lit/directives/class-map"),t=require("lit"),i=require("../lib/events"),s=require("../lib/style"),r=require("../lib/i18n"),n=require("../styles/link"),a=require("lit/directives/repeat"),l=require("../styles/skeleton"),c=require("../styles/empty"),h=require("lit/directives/style-map");require("./../atoms/gv-icon");class o extends t.LitElement{static get properties(){return{plans:{type:Array},current:{type:Number},value:{type:String,reflect:!0},skeleton:{type:Boolean},size:{type:Number},_empty:{type:Boolean},_plans:{type:Array}}}static get styles(){return[c.empty,n.link,t.css`:host{display:block;box-sizing:border-box;margin:.2rem;--bgc:var(--gv-plans--bgc, var(--gv-theme-color, #5a7684));--fc:var(--gv-plans-font--c, var(--gv-theme-font-color-light, #ffffff));--gv-icon--c:var(--bgc)}.plans{display:flex;list-style-type:none;border-radius:2px;padding:0;margin:0;height:80px}.plan{flex:1;padding:16px;line-height:24px;cursor:pointer}.plan.active{background-color:var(--bgc);color:var(--fc);transition:all .2s ease-in}.name{font-size:var(--gv-theme-font-size-l,16px);font-weight:700}.description{font-size:var(--gv-theme-font-size-s,12px);--lh:var(--gv-theme-font-size-s, 12px);line-height:var(--lh);--max-lines:2;max-height:calc(var(--lh) * var(--max-lines));overflow:hidden}.selectors{display:flex}.selector{position:relative;flex:1;display:flex;justify-content:center}.active .triangle{width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-top:9px solid var(--bgc)}.characteristics{margin-top:34px;border:1px solid var(--gv-plans-characteristics--bdc,var(--gv-theme-neutral-color,#f5f5f5));border-radius:4px;display:flex;padding:34px;text-align:center;justify-content:center;user-select:none}.characteristic{font-size:var(--gv-theme-font-size-m,14px);line-height:22px;font-weight:700;flex:1;margin:20px;display:flex;flex-direction:column;align-items:center}.circle{background-color:var(--gv-plans-characteristic--bgc,var(--gv-theme-color-light,#86c3d0));border-radius:50%;width:32px;height:32px;margin:10px;display:flex;justify-content:center;align-items:center}gv-icon{--gv-icon--s:var(--gv-plans-icon--s, 24px)}.skeleton{min-height:400px;margin:0 .2rem;opacity:.5}.link{text-decoration:underline}.pagination{display:flex;height:0}`,l.skeleton]}constructor(){super(),this.current=1,this.size=4,this._plans=[],this._empty=!0}get _characteristics(){if(this._plans.length>=this.current){const e=this._plans[this.current-1];if(e.characteristics&&e.characteristics.length>0)return e.characteristics;let t=[];if(e.validation)switch(e.validation.toUpperCase()){case"AUTO":t.push((0,r.i18n)("gv-plans.validation.auto"));break;case"MANUAL":t.push((0,r.i18n)("gv-plans.validation.manual"))}if(e.security)switch(e.security.toUpperCase()){case"API_KEY":t.push((0,r.i18n)("gv-plans.security.apiKey"));break;case"JWT":t.push((0,r.i18n)("gv-plans.security.jwt"));break;case"OAUTH2":t.push((0,r.i18n)("gv-plans.security.oauth2"));break;case"KEY_LESS":t=[],t.push((0,r.i18n)("gv-plans.security.keyLess"))}return 0===t.length&&t.push((0,r.i18n)("gv-plans.characteristics.empty")),t}return[]}set plans(e){this.skeleton=!0,Promise.resolve(e).then((e=>{if(e){if(this._empty=0===e.length,this._plans=e,!this._empty){const e=this._plans.find((e=>e.active));null==e?(this._plans[0].active=!0,this.value=this._plans[0].id):this.value=e.id}this.skeleton=!1}})).catch((e=>{this._error=!0,this._plans=[],this.skeleton=!1}))}to(e){e&&(this.value=e.id,this._plans=this._plans.map(((t,i)=>(JSON.stringify(t)===JSON.stringify(e)?(t.active=!0,this.current=i+1):t.active=!1,t))),this.dispatchEvent(new Event("input"),{bubbles:!0,cancelable:!0}))}_getPlanTitle(e){let t=e.name;return e.description&&(t+=`: ${e.description}`),t}_onRedirect(){(0,i.dispatchCustomEvent)(this,"redirect")}get hasPagination(){return this.size<this._plans.length}get hasLeft(){return this.hasPagination&&this.current>1}get hasRight(){return this.hasPagination&&this.current<this._plans.length}get plans(){if(this.hasPagination){const e=this._plans.slice(0,this.current),t=this._plans.slice(this.current),i=[e.pop()];return new Array(this.size-1).fill("").forEach(((s,r)=>{if(r%2==0&&e.length>0||0===t.length){const t=e.pop();i.unshift(t)}else if(t.length>0){const e=t.shift();i.push(e)}})),i}return this._plans}_renderHeader(i){return i.map(((i,s)=>t.html`<li @click="${this.to.bind(this,i)}" title="${this._getPlanTitle(i)}" class="${(0,e.classMap)({plan:!0,active:i.active})}"><div class="name">${i.name}</div><div class="description">${i.description}</div></li>`))}_renderTriangles(i){return i.map(((i,s)=>t.html`<div class="${(0,e.classMap)({selector:!0,active:i.active})}"><div class="triangle"></div></div>`))}_renderPagination(){return this.hasPagination?t.html`<div class="pagination">${this.hasLeft?t.html`<gv-icon @click="${this.toLeft}" shape="navigation:angle-left" class="link"></gv-icon>`:""}<div style="flex:1"></div>${this.hasRight?t.html`<gv-icon @click="${this.toRight}" shape="navigation:angle-right" class="link"></gv-icon>`:""}</div>`:""}render(){const i=(0,s.getCssVar)(this,"--gv-plans--bgc","#5A7684"),{r:n,g:l,b:c}=(0,s.hexToRGB)(i),o={backgroundColor:`rgba(${n}, ${l}, ${c}, 0.1)`,color:`rgba(${n}, ${l}, ${c}, 0.5)`};if(!this.skeleton){if(this._error)return t.html`<div class="error"><p>${(0,r.i18n)("gv-plans.error")}</p></div>`;if(this._empty)return t.html`<div class="empty"><p>${(0,r.i18n)("gv-plans.empty.title")}</p><a class="link" @click="${this._onRedirect}">${(0,r.i18n)("gv-plans.empty.redirect")}</a></div>`}const p={skeleton:this.skeleton},g=this.plans;return t.html`<div class="${(0,e.classMap)(p)}"><ul class="plans" style="${(0,h.styleMap)(o)}">${this._renderHeader(g)}</ul><div class="selectors">${this._renderTriangles(g)}</div>${this._renderPagination()} ${this.skeleton?"":t.html`<div class="characteristics">${(0,a.repeat)(this._characteristics,(e=>e),((e,i)=>t.html`<div class="characteristic"><div class="circle"><gv-icon shape="home:flower#2"></gv-icon></div><div>${e}</div></div>`))}</div>`}</div>`}toLeft(){this.to(this._plans[this.current-2])}toRight(){this.to(this._plans[this.current])}}exports.GvPlans=o,window.customElements.define("gv-plans",o);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvPopover=void 0;const t=require("lit"),e=require("lit/directives/class-map");class o extends t.LitElement{static get properties(){return{event:{type:String},delay:{type:Number},arrow:{type:Boolean,reflect:!0},small:{type:Boolean,reflect:!0},medium:{type:Boolean,reflect:!0},large:{type:Boolean,reflect:!0},width:{type:String},position:{type:String,reflect:!0},auto:{type:Boolean},_opened:{type:Boolean,attribute:!1}}}static get styles(){return[t.css`:host{cursor:pointer;box-sizing:border-box;display:inline-block;position:relative}.popover{--bgc:var(--gv-popover--bgc, var(--gv-theme-neutral-color-lighter, #fafafa));color:var(--gv-popover--c,var(--gv-theme-font-color-dark,#262626));position:absolute;background-color:var(--bgc);padding:var(--gv-popover--p,.5rem);border-radius:4px;z-index:1000;margin:0 auto;text-align:center;width:auto;box-sizing:content-box}:host([position=bottom]) .popover{top:calc(100% + .4rem);transform:translateX(-50%);left:50%;box-shadow:1px 0 0 0 var(--gv-theme-neutral-color,#f5f5f5),0 2px 3px var(--gv-theme-neutral-color-dark,#bfbfbf)}:host([position=bottom][arrow]) .popover{top:calc(100% + .4rem + 10px)}:host([position=bottom][arrow]) .arrow{top:calc(100% - 8px);transform:translateX(-50%);left:50%}:host([position=top]) .popover{bottom:calc(100% + .4rem);transform:translateX(-50%);left:50%;box-shadow:1px 0 0 0 var(--gv-theme-neutral-color,#f5f5f5),0 -2px 3px var(--gv-theme-neutral-color-dark,#bfbfbf)}:host([position=top][arrow]) .popover{bottom:calc(100% + .4rem + 10px)}:host([position=top][arrow]) .arrow{bottom:calc(100% - 8px);transform:translateX(-50%) rotate(180deg);left:50%}:host([position=left]) .popover{top:50%;transform:translateY(-50%);right:calc(100% + .4rem);box-shadow:-1px 0 0 0 var(--gv-theme-neutral-color,#f5f5f5),-1px 2px 3px var(--gv-theme-neutral-color-dark,#bfbfbf)}:host([position=left][arrow]) .popover{right:calc(100% + .4rem + 10px)}:host([position=left][arrow]) .arrow{top:50%;transform:translateY(-50%) rotate(90deg);right:calc(100% - 8px)}:host([position=right]) .popover{top:50%;transform:translateY(-50%);left:calc(100% + .4rem);box-shadow:1px 0 0 1px var(--gv-theme-neutral-color,#f5f5f5),1px 1px 1px var(--gv-theme-neutral-color-dark,#bfbfbf)}:host([position=right][arrow]) .popover{left:calc(100% + .4rem + 10px)}:host([position=right][arrow]) .arrow{left:calc(100% - 8px);top:50%;transform:translateY(-50%) rotate(-90deg)}.inline .popover{white-space:nowrap}:host([small]) .popover{width:200px}:host([medium]) .popover{width:350px}:host([large]) .popover{width:500px}.content{width:100%}.arrow,.popover{opacity:0;visibility:hidden;transition:opacity .3s ease-in-out}.open .arrow,.open .popover{display:block;opacity:1;visibility:visible}.arrow{width:25px;height:25px;z-index:101;position:absolute;overflow:hidden}.arrow:after{content:'';position:absolute;width:12px;height:12px;background:var(--gv-popover--bgc,var(--gv-theme-neutral-color-lighter,#fafafa));transform:rotate(45deg);top:19px;left:6px;border:1px solid var(--gv-popover--bdc,var(--gv-theme-neutral-color,#f5f5f5))}`]}constructor(){super(),this.event="mouseover",this._closeHandler=this._close.bind(this),this.delay=0,this.arrow=!1,this.position="bottom",this.auto=!1}_open(t){"click"===this.event&&window.removeEventListener(this.event,this._closeHandler),this._opened=!0,"click"===this.event&&setTimeout((()=>window.addEventListener(this.event,this._closeHandler))),this.delay>0&&setTimeout((()=>this._close({})),this.delay)}close(){this._close({})}_close(t){if(this._opened&&(t.target!==this.firstElementChild||"click"!==this.event)){const t=this.shadowRoot.querySelector(".open");t.classList.add("close"),setTimeout((()=>{t.classList.remove("close"),this._opened=!1}),200)}}render(){const o=null==this.width&&!this.small&&!this.medium&&!this.large,i={open:this._opened,content:!0,inline:o};return t.html`<div class="${(0,e.classMap)(i)}"><slot></slot>${this.arrow?t.html`<div class="arrow"></div>`:""}<div class="popover">${this.renderContent()}</div></div>`}renderContent(){return t.html`<slot name="popover"></slot>`}firstUpdated(t){setTimeout((()=>{this.addEventListener(this.event,this._open.bind(this)),this.event.startsWith("mouse")&&0===this.delay&&this.addEventListener("mouseleave",this._close.bind(this))}))}_getContentSize(){const t=this.shadowRoot.querySelector(".popover");return{width:t.offsetWidth,height:t.offsetHeight}}_getPositionPadding(){return 10}_getCenterPosition(){return{x:this.target.x+this.target.width/2+window.scrollX,y:this.target.y+this.target.height/2+window.scrollY}}_updatePosition(){if(null!=this.position&&this.auto){if(this.shadowRoot.querySelector(".popover")&&(this.target=this.firstElementChild.getBoundingClientRect(),"top"===this.position&&!this._hasTopSpace()||"bottom"===this.position&&!this._hasBottomSpace()||"left"===this.position&&!this._hasLeftSpace()||"right"===this.position&&!this._hasRightSpace())){const t=[this._hasTopSpace(),this._hasRightSpace(),this._hasBottomSpace(),this._hasLeftSpace()].indexOf(!0);t>-1&&(this.position=["top","right","bottom","left"][t])}}}_getMaxX(){return window.innerWidth-this._getPositionPadding()}_getMaxY(){return window.innerHeight-this._getPositionPadding()}_hasBottomSpace(){return this.target.y+this.target.height+this._getContentSize().height+this._getPositionPadding()<=this._getMaxY()}_hasRightSpace(){return this.target.x+this.target.width+this._getContentSize().width+this._getPositionPadding()<=this._getMaxX()}_hasTopSpace(){return this.target.y-this._getContentSize().height-this._getPositionPadding()>=this._getPositionPadding()}_hasLeftSpace(){return this.target.x-this._getContentSize().width-this._getPositionPadding()>=this._getPositionPadding()}updated(t){t.has("width")&&this.shadowRoot.querySelector(".popover").style.setProperty("width",this.width),this._updatePosition()}}exports.GvPopover=o,window.customElements.define("gv-popover",o);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvPromote=void 0;const e=require("lit"),t=require("lit/directives/class-map"),i=require("../lib/events"),r=require("../lib/i18n"),s=require("../mixins/item-resource"),o=require("../lib/item"),n=require("../lib/utils");require("../atoms/gv-image"),require("../atoms/gv-button"),require("../molecules/gv-rating"),require("../molecules/gv-metrics");class l extends((0,s.ItemResource)(e.LitElement)){static get properties(){return{...super.properties,limit:{type:Number}}}static get styles(){return[...super.styles,e.css`:host{box-sizing:border-box;display:inline-block;margin:.2rem;vertical-align:middle;--gv-button--p:var(--gv-promote-button--p, 19px 80px);--gv-button--fz:var(--gv-promote-button--fz, var(--gv-theme-font-size-l, 16px));--gv-preview-button:'none';width:100%;--gv-icon--s:20px;--gv-rating--s:20px}gv-identity-picture{height:var(--gv-promote-image--h,300px);width:var(--gv-promote-image--w,300px);--gv-image--of:contain}.container{display:flex;min-height:420px;max-height:420px}.image{background-color:var(--gv-promote-image--bgc,var(--gv-theme-color-light,#86c3d0));min-height:0;min-width:0;width:480px;display:flex;align-items:center;justify-content:center;border-radius:4px 0 0 4px}.title{text-transform:capitalize;min-height:32px;display:flex;align-items:center}.title h2{font-size:var(--gv-theme-font-size-xl,26px);flex:1}.title .version{font-size:var(--gv-theme-font-size-s,12px);color:var(--gv-theme-neutral-color-dark,#d9d9d9)}.owner{--gv-icon--c:var(--gv-theme-neutral-color-dark, #bfbfbf);--gv-icon--s:16px;color:var(--gv-theme-neutral-color-dark,#bfbfbf);display:flex;padding-bottom:2px;margin-top:-8px;line-height:initial}.content{flex:1;padding:1.5rem;background-color:var(--gv-promote--bgc,var(--gv-theme-neutral-color-lightest,#fff));color:var(--gv-theme-font-color-dark,#262626);font-size:var(--gv-theme-font-size-l,16px);line-height:24px;border-radius:0 4px 4px 0;display:flex;flex-direction:column}.description{margin:24px 0;flex-grow:1}.description-large{text-align:justify}.infos{display:flex;justify-content:flex-end;margin:.5rem .2rem;align-items:center}gv-metrics{display:flex;height:100%;justify-content:flex-end;align-items:stretch}.labels{text-align:right}`]}_onClick(){(0,i.dispatchCustomEvent)(this,"click",{data:this._item,href:this.href})}render(){if(this._invisible)return"";const i=(0,o.getOwner)(this._item);return e.html`<div class="container"><div class="${(0,t.classMap)({skeleton:this._skeleton,image:!0})}">${this._renderImage()}</div><div class="content">${this._error&&!this._skeleton?e.html`<p class="description error">${(0,r.i18n)("gv-promote.error")}</p>`:e.html`${this._empty&&!this._skeleton?e.html`<p class="description empty">${(0,r.i18n)("gv-promote.empty")}</p>`:e.html`<div class="${(0,t.classMap)({skeleton:this._skeleton,title:!0})}"><h2>${(0,o.getTitle)(this._item)}</h2><span class="version">${(0,o.getVersion)(this._item)}</span></div>${null!=i&&i.trim().length>0?e.html`<div class="owner"><gv-icon shape="general:user" size="8px"></gv-icon>${i}</div>`:""}<p class="${(0,t.classMap)({skeleton:this._skeleton,description:!0,"description-large":(0,o.getDescription)(this._item).split(" ").length>10})}">${(0,n.truncate)((0,o.getDescription)(this._item),this.limit)}</p><div class="${(0,t.classMap)({skeleton:this._skeleton,infos:!0})}">${this._renderMetricsWithRating()}</div><div class="labels">${this._renderLabels(!0)}</div><gv-button ?skeleton="${this._skeleton}" .href="${this.href}" @click="${this._onClick}">${(0,r.i18n)("gv-promote.view")}</gv-button>`}`}</div></div>`}}exports.GvPromote=l,window.customElements.define("gv-promote",l);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvRatingList=void 0;const e=require("lit"),t=require("lit/directives/repeat");require("./../atoms/gv-relative-time"),require("./gv-identity-picture"),require("./gv-rating"),require("./gv-confirm");const i=require("../styles/skeleton"),s=require("../styles/link"),r=require("../lib/i18n"),n=require("lit/directives/class-map"),a=require("../lib/events");class l extends e.LitElement{static get properties(){return{ratings:{type:Array},user:{type:Object},permissions:{type:Object},required:{type:Boolean,attribute:"required"},_permissions:{type:Object,attribute:!1},_ratings:{type:Array,attribute:!1}}}static get styles(){return[i.skeleton,s.link,e.css`:host{--s:var(--gv-rating-list--s, 18px);--gv-icon--s:var(--s);--gv-rating--s:var(--s);margin:.2rem;box-sizing:border-box}.rating-list{background-color:var(--gv-rating-list--bgc,var(--gv-theme-neutral-color-lightest,#fff))}.rating.parent{border-bottom:1px solid var(--gv-rating-list--bdc,var(--gv-theme-neutral-color,#f5f5f5))}.rating{display:flex;padding:1rem 0}.answer .rating{padding:1rem 0 0 0}.sub-title{color:grey;display:flex;line-height:20px}gv-confirm{align-self:center}.sub-title a.link{text-decoration:underline}gv-identity-picture{margin:0 1rem;height:60px;width:60px}.title{display:flex;line-height:20px}.rating-content,.title b{flex:1}.link-answer{display:inline-block;padding:1rem 0}.link-answer gv-icon{margin-right:.2rem;--gv-icon--s:var(--s)}.delete-answer,.delete-rating,.fake-icon{--gv-icon--s:var(--s);min-width:var(--s);display:inline-flex}.delete-rating{padding-right:1rem}.answer{padding:1rem;margin-top:1rem;background-color:var(--gv-rating-list-answer--bgc,var(--gv-theme-neutral-color-lighter,#fafafa))}.answer-form{display:flex;flex-direction:column}.display-name:after{content:'|';margin:2px}.actions{text-align:right}`]}constructor(){super(),this._ratings=[],this._permissions={update:!1,delete:!1,addAnswer:!1,deleteAnswer:!1}}set ratings(e){Promise.resolve(e).then((e=>{e?(this._skeleton=!1,this._ratings=e):this._skeleton=!0})).catch((()=>{this._skeleton=!1}))}set permissions(e){e&&"object"==typeof e&&(this._permissions=Object.assign({},this._permissions,e))}render(){return e.html`<div class="rating-list">${(0,t.repeat)(this._ratings,(e=>this._render(e)))}</div>`}_editAnswer(e,t){t.stopPropagation(),this._ratings.forEach((e=>e._edit=!1)),e._edit=!0,this.performUpdate()}_getAnswerValue(){const e=this.shadowRoot.querySelector("gv-text");return e?e.value:""}_onAnswer(e){const t=this._getAnswerValue();t.trim().length>0&&(0,a.dispatchCustomEvent)(this,"add-answer",{rating:e,answer:t})}_hasValidAnswer(){return this._getAnswerValue().trim().length>0}_onClose(e){delete e._edit,this.performUpdate()}_renderAnswer(t,i){return e.html`<div class="answer">${this._render(i,t)}</div>`}_renderAnswers(i){return e.html`${i.answers?e.html`${this._canAddAnswer()?e.html`<a class="link link-answer" @click="${this._editAnswer.bind(this,i)}"><gv-icon class="link" shape="communication:chat#5"></gv-icon>${(0,r.i18n)("gv-rating-list.reply")}</a>`:""} ${i._edit?e.html`<div class="answer answer-form"><gv-text rows="4" label="${(0,r.i18n)("gv-rating-list.answerLabel")}" required @input="${this.performUpdate}"></gv-text><div class="actions"><gv-button primary outlined @click="${this._onClose.bind(this,i)}">${(0,r.i18n)("gv-rating-list.cancel")}</gv-button><gv-button primary @click="${this._onAnswer.bind(this,i)}" .disabled="${!this._hasValidAnswer()}">${(0,r.i18n)("gv-rating-list.send")}</gv-button></div></div>`:""}<div>${(0,t.repeat)(i.answers,(e=>this._renderAnswer(i,e)))}</div>`:""}`}_onDelete(e){(0,a.dispatchCustomEvent)(this,"delete",{rating:e})}_onDeleteAnswer(e,t){(0,a.dispatchCustomEvent)(this,"delete-answer",{rating:e,answer:t})}_renderActions(t,i){return i?e.html`${this._canDeleteAnswer()?e.html`<gv-confirm danger icon="home:trash" @gv-confirm:ok="${this._onDeleteAnswer.bind(this,i,t)}" message="${(0,r.i18n)("gv-rating-list.confirmAnswerDelete")}"><gv-icon title="${(0,r.i18n)("gv-rating-list.deleteAnswer")}" class="link delete-answer" shape="home:trash"></gv-icon></gv-confirm>`:""}`:e.html`${this._canDelete(t.id)?e.html`<gv-confirm danger icon="home:trash" @gv-confirm:ok="${this._onDelete.bind(this,t)}" message="${(0,r.i18n)("gv-rating-list.confirmRatingDelete")}"><gv-icon title="${(0,r.i18n)("gv-rating-list.deleteRating")}" class="link delete-rating" shape="home:trash"></gv-icon></gv-confirm>`:e.html`<div class="fake-icon"></div>`}`}_render(t,i){const s={rating:!0,skeleton:this._skeleton,parent:null==i},r=t.author&&t.author.display_name?t.author.display_name:null,a=t.author&&t.author._links&&t.author._links.avatar?t.author._links.avatar:null;return e.html`<div class="${(0,n.classMap)(s)}"><gv-identity-picture rounded .display_name="${r}" .picture="${a}"></gv-identity-picture><div class="rating-content"><div class="title"><b>${t.title?t.title:t.author.display_name}</b>${i?"":e.html`<gv-rating .readonly="${!this._canUpdate(t.id)}" @input="${this._onUpdateRating.bind(this,t)}" value="${t.value}"></gv-rating>`}${this._renderActions(t,i)}</div><div class="sub-title">${this._getDisplayName(t)}<gv-relative-time datetime="${t.date}" noFuture></gv-relative-time></div><p class="comment">${t.comment}</p>${i?"":this._renderAnswers(t)}</div></div>`}_onUpdateRating(e,t){e.value=t.target.value,(0,a.dispatchCustomEvent)(this,"update",{rating:e})}_canAddAnswer(){return!0===this._permissions.addAnswer}_canDeleteAnswer(){return!0===this._permissions.deleteAnswer}_canUpdate(e){return Array.isArray(this._permissions.update)?this._permissions.update.includes(e):!0===this._permissions.update}_canDelete(e){return Array.isArray(this._permissions.delete)?this._permissions.delete.includes(e):!0===this._permissions.delete}_getDisplayName(t){return t.title?e.html`<span class="display-name">${t.author.display_name}</span>`:""}}exports.GvRatingList=l,window.customElements.define("gv-rating-list",l);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvRating=void 0;const t=require("lit"),e=require("lit/directives/repeat");require("../atoms/gv-icon");const i=require("../styles/skeleton"),s=require("lit/directives/class-map"),n=require("../lib/i18n");class r extends t.LitElement{static get properties(){return{value:{type:Number,reflect:!0},count:{type:String},skeleton:{type:Boolean},readonly:{type:Boolean},_candidate:{type:Number,attribute:!1},withDescription:{type:Boolean,attribute:"with-description"}}}static get styles(){return[t.css`:host{--gv-icon--c:var(--gv-rating--c, var(--gv-theme-color, #5a7684));--size:var(--gv-rating--s, 13px);--gv-icon--s:var(--size);font-size:var(--gv-theme-font-size-m,14px);cursor:default}.content,.rate{justify-content:space-evenly;display:inline-flex;align-items:flex-end;vertical-align:middle;height:100%}.info-title{font-size:var(--gv-theme-font-size-m,14px);line-height:16px;align-self:center;min-width:35px;text-align:center}.info-subtitle{font-size:var(--gv-theme-font-size-xs,10px);line-height:10px;opacity:.5;text-align:center}.icon{display:inline-flex;align-self:center;margin-right:calc(var(--size)/ 4);align-items:center}.edit{cursor:pointer}.edit gv-icon:hover{transform:translateY(-.5px)}gv-input{flex:1}.icon{min-height:30px}.description{min-width:100px;line-height:calc(var(--size) + 4px);margin:auto 4px}`,i.skeleton]}constructor(){super(),this.value=0,this.count=0,this.readonly=!1,this._candidate=-1,this.isSelected=!1}_getTitle(){return`${this._getAverage()}/5`}_onMouseEnter(t){if(this._candidate=t+1,this.withDescription)switch(this._candidate){case 1:this.description=(0,n.i18n)("gv-rating.description-1");break;case 2:this.description=(0,n.i18n)("gv-rating.description-2");break;case 3:this.description=(0,n.i18n)("gv-rating.description-3");break;case 4:this.description=(0,n.i18n)("gv-rating.description-4");break;case 5:this.description=(0,n.i18n)("gv-rating.description-5")}}_onMouseOut(){this._candidate=-1,this.withDescription&&!this.isSelected&&(this.description=null)}_onClick(t){this._candidate=-1,this.isSelected=!0,this.value=t+1,this.dispatchEvent(new Event("input"),{bubbles:!0,cancelable:!0})}_getAverage(){const t=parseFloat(this.value);return t>=0&&t<=5?t:0}_renderStar(e,i){return this.readonly?t.html`<gv-icon shape="general:${e}"></gv-icon>`:t.html`<gv-icon @mouseenter="${this._onMouseEnter.bind(this,i)}" @click="${this._onClick.bind(this,i)}" shape="general:${e}"></gv-icon>`}render(){const i=this._getAverage();let n=1*i;this.readonly||(n=this._candidate>-1?this._candidate:i);const r=[];for(let t=1;t<=5;t+=1)n>=t?r.push("star"):n>=t-.7?r.push("half-star"):r.push("no-star");return t.html`<div class="${(0,s.classMap)({skeleton:this.skeleton,edit:!this.readonly,content:!0})}"><div class="${(0,s.classMap)({content:!0})}"><div class="${(0,s.classMap)({rate:!0})}"><div class="icon" title="${this._getTitle()}">${this.withDescription?t.html`<div class="description">${this.description}</div>`:""} ${(0,e.repeat)(r,(t=>t),((e,i)=>t.html`${this._renderStar(e,i)}`))}</div>${this.count?t.html`<div><div class="info-title">${this.count||""}</div><div class="info-subtitle">${this._getCountTitle()}</div></div>`:""}</div></div></div>`}firstUpdated(){this.readonly||this.shadowRoot.querySelector(".edit").addEventListener("mouseout",this._onMouseOut.bind(this))}_getCountTitle(){return this.count?this.count>1?(0,n.i18n)("gv-rating.notes"):(0,n.i18n)("gv-rating.note"):""}}exports.GvRating=r,window.customElements.define("gv-rating",r);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvRowExpandable=void 0;const e=require("lit"),r=require("./gv-expandable");class o extends r.GvExpandable{constructor(){super(),this.icon="general:other#2",this.iconOpened="general:other#2",this.clickable=!0}static get styles(){return[...super.styles,e.css`.box:hover{background-color:var(--gv-theme-neutral-color,#f5f5f5)}`]}}exports.GvRowExpandable=o,window.customElements.define("gv-row-expandable",o);
|
package/src/molecules/gv-row.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvRow=void 0;const e=require("lit"),r=require("../styles/skeleton"),t=require("../styles/link"),i=require("lit/directives/class-map"),s=require("../lib/i18n"),o=require("../mixins/item-resource"),l=require("../mixins/with-resize-observer"),a=require("../lib/item");class n extends((0,l.withResizeObserver)((0,o.ItemResource)(e.LitElement))){static get styles(){return[...super.styles,e.css`:host{box-sizing:border-box;cursor:pointer;--hover-bgc:var(--gv-row-hover--bgc, var(--gv-theme-neutral-color-lighter, #fafafa));--trf-ty:var(--gv-row-hover--trf-ty, 0px);display:block}:host([_invisible]){display:none}.row{padding:12px}.row:hover{-webkit-transform:-webkit-translateY(var(--trf-ty));transform:translateY(var(--trf-ty));background-color:var(--hover-bgc)}.row:not(.error){display:grid;grid-template-columns:calc(var(--gv-row-image--w,35px) + 5px) auto fit-content(20%);grid-gap:10px;align-items:center}:host([w-lt-450]) .meta{display:none}.row .name{margin-right:15px}.row .meta__owner,.row .name{margin-bottom:5px}.row .version{color:var(--gv-theme-neutral-color-dark,#d9d9d9)}.row .description{--lh:1.4rem;--max-lines:2;max-height:calc(var(--lh) * var(--max-lines));line-height:var(--lh);overflow:hidden;text-overflow:ellipsis;text-after-overflow:'...'}.row .meta{display:flex;flex-direction:column;align-items:flex-end}.row .meta__owner{--gv-icon--c:var(--gv-theme-neutral-color-dark, #d9d9d9);--gv-icon--s:16px;color:var(--gv-theme-neutral-color-dark,#d9d9d9);display:flex}.row .meta__tags{display:flex;flex-direction:row;flex-wrap:wrap}.skeleton{transition:.5s;min-height:30px;align-self:start}.error{cursor:default;text-align:center}gv-identity-picture{height:var(--gv-row-image--h,35px);width:var(--gv-row-image--w,35px);border-radius:20px;--gv-image--of:contain;align-self:baseline}h3{margin:0}.row>.group{display:flex;flex-direction:column;margin:0 5px;width:100%;flex:1}.title{display:flex;flex-direction:row}`,t.link,r.skeleton]}static get properties(){return{...super.properties,small:{type:Boolean}}}constructor(){super(),this.breakpoints={width:[450]},this.small=!1}render(){const r={row:!0,link:!0,error:!this._skeleton&&(this._error||this._empty)},t=(0,a.getOwner)(this._item);return e.html`<div class="${(0,i.classMap)(r)}">${this._skeleton||!this._error&&!this._empty?e.html`<div class="${(0,i.classMap)({skeleton:this._skeleton})}">${this._renderImage()}</div><div class="${(0,i.classMap)({group:!0,skeleton:this._skeleton})}"><div class="title"><h3 class="name">${(0,a.getTitle)(this._item)}</h3><div class="version">${(0,a.getVersion)(this._item)}</div></div><div class="description">${(0,a.getDescription)(this._item)}</div></div><div class="${(0,i.classMap)({meta:!0,skeleton:this._skeleton})}"><div class="meta__owner">${null!=t&&t.trim().length>0?e.html`<gv-icon shape="general:user" size="8px"></gv-icon>${t}`:""}</div>${!0!==this.small?e.html`<div class="meta__tags">${this._renderLabels()}</div>`:""}</div>`:e.html`<div class="message">${this._error?(0,s.i18n)("gv-row.error"):(0,s.i18n)("gv-row.empty")}</div>`}</div>`}}exports.GvRow=n,window.customElements.define("gv-row",n);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvStats=void 0;const t=require("lit");require("../atoms/gv-button"),require("../atoms/gv-tag");const e=require("lit/directives/repeat"),s=require("lit/directives/class-map"),i=require("../lib/i18n"),r=require("../mixins/with-skeleton-attribute");class a extends((0,r.withSkeletonAttribute)(t.LitElement)){static get properties(){return{stats:{type:Object},options:{type:Array}}}static get styles(){return[...super.styles,t.css`.stats{align-content:center;justify-content:center;display:flex;flex-wrap:wrap;height:100%}.stats-container{border:1px solid;border-radius:8px;margin:15px;padding:15px}.stats-value{font-size:30px;text-align:center}.stats-label{font-size:15px;text-align:center}`]}constructor(){super(),this._skeletonAttribute="stats"}_getStat(e){if(!this.stats)return"<div></div>";let s=Math.round(this.stats[e.key]);if(isNaN(s)&&(s=0),0===s&&e.fallback){const t=e.fallback.find((t=>Math.round(this.stats[t.key])>0));t&&(e.key=t.key,e.label=t.label,s=Math.round(this.stats[e.key]))}return t.html`<div class="stats-container" style="color:${e.color}"><div class="stats-value">${s}${e.unit}</div><div class="stats-label">${e.label||e.key}</div></div>`}render(){return this._error?t.html`<div class="error">${(0,i.i18n)("gv-stats.error")}</div>`:this._empty?t.html`<div class="empty">${(0,i.i18n)("gv-stats.empty")}</div>`:t.html`<div class="${(0,s.classMap)({stats:!0,skeleton:this._skeleton})}">${(0,e.repeat)(this.options,(t=>t),(t=>this._getStat(t)))}</div>`}}exports.GvStats=a,window.customElements.define("gv-stats",a);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvStepper=void 0;const e=require("lit"),t=require("lit/directives/repeat"),r=require("lit/directives/class-map"),i=require("../styles/link"),s=require("../lib/events"),a=require("../lib/i18n");class d extends e.LitElement{static get properties(){return{current:{type:Number,reflect:!0},steps:{type:Array},disabled:{type:Boolean},_error:{type:Boolean}}}static get styles(){return[i.link,e.css`:host{box-sizing:border-box;--passed--bgc:var(--gv-stepper-valid--bgc, var(--gv-theme-color, #5a7684));--passed--bdc:var(--gv-stepper-passed--bdc, var(--gv-theme-color-light, #86c3d0));--bdc:var(--gv-stepper--bdc, var(--gv-theme-neutral-color-dark, #bfbfbf));--bgc:var(--gv-stepper--bgc, var(--gv-theme-neutral-color-dark, #bfbfbf));--passed--c:var(--gv-stepper-passed--c, #595959);--c:var(--gv-stepper--c, var(--gv-theme-neutral-color-dark, #bfbfbf))}.stepper{display:flex;justify-content:center}.disabled .step{cursor:not-allowed}.step{display:flex;flex-direction:column;cursor:pointer}.graph{display:flex;flex-direction:row;min-height:22px;min-width:250px}.round{min-width:6px;width:6px;min-height:6px;height:6px;border-radius:50%;margin:2px 7px 2px 7px}.border{margin-top:4px;min-width:100px;width:100%;height:2px;clear:both}.round{background-color:var(--bgc);transition:all .2s ease-in}.border{background-color:var(--bdc);margin-bottom:5px;transition:all .2s ease-in}.passed .round{background-color:var(--passed--bgc)}.passed .border{background-color:var(--passed--bdc)}.passed .round{height:10px;width:10px;min-height:10px;min-width:10px;margin:0 5px 0 5px}.first .border:first-of-type{visibility:hidden}.end .border:last-of-type{visibility:hidden}.content{display:flex;flex-direction:column;align-items:center;padding:5px;line-height:24px;font-size:var(--gv-theme-font-size-l,16px);color:var(--c)}.passed .content{color:var(--passed--c)}.title{font-weight:700}.description{font-size:var(--gv-theme-font-size-m,14px)}.error{text-align:center}.circle{border:1px solid var(--passed--bgc);margin-top:-12px;border-radius:50%;animation:validate .2s ease-in}gv-icon{--gv-icon--c:var(--passed--bgc);--gv-icon--s:var(--gv-stepper-icon--s, 32px)}.invalid gv-icon{--gv-icon--c:var(--gv-theme-color-danger)}@keyframes validate{from{opacity:0}to{opacity:1}}`]}constructor(){super(),this.current=0,this._steps=[],this._error=!1,this._empty=!0}_onClick(e){!0!==this.disabled&&(this.current=e+1,(0,s.dispatchCustomEvent)(this,"change",{current:this.current}))}async performUpdate(){await Promise.all([this.steps,this.current]).then((([e,t])=>{this._steps=e.map(((e,r)=>(e.passed=!0===e.valid||t>0&&r+1<=t,e))),this._error=!1,this._empty=!(this._steps&&this._steps.length>0)})).catch((()=>{this._error=!0,this._empty=!1})),super.performUpdate()}_getIcon(t){return t.invalid?e.html`<div class="circle invalid"><gv-icon shape="code:error"></gv-icon></div>`:t.valid?e.html`<div class="circle"><gv-icon shape="code:check"></gv-icon></div>`:e.html`<div class="round"></div>`}_getStep(t,i){const s={passed:t.passed,valid:t.valid,step:!0,first:0===i,end:i===this._steps.length-1},a={content:!0,link:!this.disabled};return e.html`<div class="${(0,r.classMap)(s)}" @click="${this._onClick.bind(this,i)}" title="${t.title}"><div class="graph"><div class="border"></div>${this._getIcon(t)}<div class="border"></div></div><div class="${(0,r.classMap)(a)}"><div class="title">${t.title}</div><div class="description">${t.description}</div></div></div>`}render(){if(this._error)return e.html`<div class="error">${(0,a.i18n)("gv-stepper.error")}</div>`;if(this._empty)return e.html`<div></div>`;const i={stepper:!0,disabled:this.disabled};return e.html`<div class="${(0,r.classMap)(i)}">${(0,t.repeat)(this._steps,(e=>e),((e,t)=>this._getStep(e,t)))}</div>`}}exports.GvStepper=d,window.customElements.define("gv-stepper",d);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvTable=void 0;const t=require("lit"),e=require("../styles/skeleton"),i=require("../styles/empty"),s=require("../styles/link"),r=require("lit/directives/class-map"),o=require("lit/directives/repeat"),n=require("../lib/events"),a=require("../lib/i18n"),l=require("lit/directives/until"),h=require("lit/directives/style-map"),d=require("../mixins/with-resize-observer"),g=require("lit/directives/if-defined");require("../atoms/gv-image"),require("../organisms/gv-pagination");const c=require("../lib/style");class p extends((0,d.withResizeObserver)(t.LitElement)){static get properties(){return{items:{type:Array},title:{type:String},order:{type:String},options:{type:Array},noheader:{type:Boolean},nosort:{type:Boolean},rowsheight:{type:String},rowheight:{type:String},emptymessage:{type:String},format:{type:Function},compareFn:{type:Function},selected:{type:Array,reflect:!0},total:{type:String},skeleton:{type:Boolean},_items:{type:Array,attribute:!1},_skeleton:{type:Boolean,attribute:!1},_error:{type:Boolean,attribute:!1},_empty:{type:Boolean,attribute:!1},_itemsProvider:{type:Array,attribute:!1},_page:{type:Number,attribute:!1}}}static get styles(){return[s.link,e.skeleton,i.empty,t.css`:host{--selected--bgc:var(--gv-table-selected--bgc, var(--gv-theme-color, #5a7684));--hover-bgc:var(--gv-table-hover--bgc, var(--gv-theme-neutral-color-lighter, #fafafa));--bgc:var(--gv-table--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));--bdc:var(--gv-table--bdc, var(--gv-theme-neutral-color-dark, #d9d9d9));display:block;height:100%;margin:.2rem;box-sizing:border-box}.table{background-color:var(--bgc);flex-direction:column;height:100%;display:flex;width:100%}.rows{-ms-overflow-style:none;scrollbar-width:none;overflow:var(--gv-table-rows--ov,auto);flex:1;height:100%;transition:height 250ms ease-in-out}.rows::-webkit-scrollbar{display:none}:host([w-lt-768]) .row{height:70px}:host([w-lt-580]) .row{height:60px}:host([w-lt-400]) .row{height:50px}.theader{background-color:var(--gv-theme-neutral-color-lighter);font-weight:700;padding:0 .2rem}.row,.theader{align-items:var(--gv-table-row--ai,center);align-content:var(--gv-table-row--ac,center);border-right:solid thick transparent;display:grid}div{box-sizing:border-box}.cell{height:100%;display:var(--gv-table-cell--d,flex);align-items:center}.row:not(:last-child){box-shadow:0 5px 3px -6px var(--bdc)}.row.selected,.row:hover{background-color:var(--hover-bgc)}.row.selected{border-color:var(--selected--bgc);box-sizing:border-box}.header{border-bottom:1px solid var(--bdc);padding:var(--gv-table-header--p,2rem 4rem)}.title{margin:0;text-transform:uppercase;font-size:var(--gv-table-header--fz,var(--gv-theme-font-size-l,20px));line-height:var(--gv-table-header--fz,var(--gv-theme-font-size-l,20px));opacity:.6}.title span{font-weight:600;font-size:var(--gv-theme-font-size-s);line-height:var(--gv-theme-font-size-s);margin-left:8px;opacity:.7}gv-identity-picture{height:35px;width:35px;--gv-image--of:contain;margin-left:20px}gv-icon{transform:rotate(0);--gv-icon--s:18px}gv-icon.desc{transform:rotate(180deg)}gv-pagination{align-self:flex-end}.cell>:not(gv-tag){margin:auto;width:100%}`]}constructor(){super(),this._id=(new Date).getTime(),this.breakpoints={width:[400,580,768]},this._empty=!1,this.order="",this._page=1,this._itemsProvider=[],this.selected=[],this.compareFn=(t,e,i)=>{const s=this._getDataFromField(t,i)&&this._getDataFromField(t,i).toLowerCase?this._getDataFromField(t,i).toLowerCase():"",r=this._getDataFromField(e,i)&&this._getDataFromField(e,i).toLowerCase?this._getDataFromField(e,i).toLowerCase():"";return this.order.startsWith("-")?r.localeCompare(s):s.localeCompare(r)},this.addEventListener("gv-pagination:paginate",(t=>{this._page=t.detail.page}))}set items(t){this._skeleton=!0,Promise.resolve(t).then((t=>{t&&(this._itemsProvider=t.map(((t,e)=>(t._id=null==t.id?e:t.id,t))),this._onSortChanged(),this._empty=0===this._itemsProvider.length,this._skeleton=!1)})).catch((t=>{console.error(t),this._error=!0,this._skeleton=!1,this._itemsProvider=[]}))}get items(){return this._itemsProvider}_onSortChanged(t,e){if(e&&e.preventDefault(),this._itemsProvider&&this.order){const e=this.order.startsWith("-"),i=e?this.order.substring(1):this.order,s=t||i;t&&(this.order=i===s?e?s:"-"+s:s),this._itemsProvider=this._itemsProvider.sort(((t,e)=>this.compareFn(t,e,s))),t&&(0,n.dispatchCustomEvent)(this,"sort",{order:this.order})}}get _items(){if(this._itemsProvider){if(this.options&&this.options.paging&&this.options.paging<this._itemsProvider.length){const t=(this._page-1)*this.options.paging;return[...this._itemsProvider].splice(t,this.options.paging)}return this._itemsProvider}return[]}_getItemId(t){return null==t.id?t._id:t.id}_onSelect(t,e){if(!this._skeleton&&!e.target.dataset.preventSelect)if(this.options.selectable){const e=this._getItemId(t);this._isSelected(t)?this.selected=this.selected.filter((t=>e!==t)):"multi"===this.options.selectable?this.selected=[...this.selected,e]:this.selected=[e],(0,n.dispatchCustomEvent)(this,"select",{items:this.selectedItems,options:this.options})}else(0,n.dispatchCustomEvent)(this,"select",{items:[t]})}get selectedItems(){return this.selected&&this._itemsProvider?this._itemsProvider.filter((t=>this.selected&&this.selected.includes(this._getItemId(t)))):[]}_onMouseEnter(t){this.selected&&this.selected.length>0||this._skeleton||(0,n.dispatchCustomEvent)(this,"mouseenter",{item:t})}_onMouseLeave(){this.selected&&this.selected.length>0||this._skeleton||(0,n.dispatchCustomEvent)(this,"mouseleave")}_renderHeader(e){if(this.noheader)return"";{const i={...e,height:this.rowheight,"grid-auto-rows":this.rowheight?null:"minmax(80px, auto)"};return t.html`<div class="${(0,r.classMap)({theader:!0})}" style="${(0,h.styleMap)(i)}">${this.options&&this.options.data&&this._items&&this._items.length?(0,o.repeat)(this.options.data,(t=>t),(e=>{const i=this.order&&this.order.startsWith("-")?this.order.substring(1):this.order,s=this.format&&e.label?this.format(e.label):e.label,o="function"==typeof e.headerStyle?e.headerStyle(s):e.headerStyle;return t.html`<div style="${o||""}">${this.order&&!this.nosort?t.html`<gv-button link @click="${this._onSortChanged.bind(this,e.field||e.tag)}">${(0,l.until)(s)}</gv-button>${i===e.tag||i===e.field&&"image"!==e.type?t.html`<gv-icon class="${(0,r.classMap)({desc:this.order.startsWith("-")})}" shape="design:triangle"></gv-icon>`:""}`:(0,l.until)(s)}</div>`})):""}</div>`}}_renderIcon(e,i,s){const r="function"==typeof s.icon?s.icon(e):s.icon,o="function"==typeof s.iconTitle?s.iconTitle(e):s.iconTitle;return r?t.html`<gv-icon shape="${r}" title="${o}"></gv-icon>`:""}_renderComponent(t,e,i,s,r){if(i.condition&&!i.condition(t))return"";const o=document.createElement(r);o.value=s,i.attributes&&Object.keys(i.attributes).forEach((e=>{if(e.startsWith("on")){const s=e.replace("on","").toLowerCase();"click"===s&&o.classList.add("link"),o.dataset.preventSelect=!0,o.addEventListener(s,(s=>{s.stopPropagation();null==("function"==typeof i.confirm?i.confirm(t):i.confirm)&&setTimeout((()=>{i.attributes[e](t,s,o,this)}),0)}))}else if("function"==typeof i.attributes[e]){const s=i.attributes[e](t);null!=s&&(o[e]=s)}else this.format&&"string"==typeof i.attributes[e]?this.format(i.attributes[e]).then((t=>{o[e]=t})):o[e]=i.attributes[e]})),o.addEventListener("input",(t=>{this._items[e][i.field]=t.target.value}));const n="function"==typeof i.confirm?i.confirm(t):i.confirm;if(n){const e=document.createElement("gv-confirm");return this.format?this.format(n.msg).then((t=>e.message=t)):e.message=n.msg,n.danger&&(e.danger=!0),e.addEventListener("click",(t=>t.stopPropagation())),e.addEventListener("gv-confirm:ok",(e=>{e.stopPropagation(),i.attributes.onClick(t,e,o)})),e.appendChild(o),e}return o}_renderCell(t,e,i,s){if(e.type){if("image"===e.type){let s="";return e.alt&&(s="function"==typeof e.alt?e.alt(i):this._getDataFromField(i,e.alt)),this._renderImage(t,s)}if("function"==typeof e.type)return this._renderComponent(i,s,e,t,e.type(i));if(e.type.startsWith("gv-"))return this._renderComponent(i,s,e,t,e.type)}return(0,l.until)(t)}_getFormattedCellValue(t,e){let i=t.field?this._getDataFromField(e,t.field):"";return i&&("date"===t.type?i=new Date(i).toLocaleDateString((0,a.getLanguage)()):"datetime"===t.type?i=new Date(i).toLocaleString((0,a.getLanguage)()):"time"===t.type&&(i=new Date(i).toLocaleTimeString((0,a.getLanguage)()))),t.format&&(i=t.format(i)),i}_isSelected(t){return this.selected&&this.selected.includes(this._getItemId(t))}_renderRows(e){return t.html`<div class="rows" style="${(0,h.styleMap)({height:this.rowsheight,"user-select":this.options.selectable?"none":""})}" @mouseleave="${this._onMouseLeave.bind(this)}">${this._items&&this._items.length?(0,o.repeat)(this._items,(t=>t),((i,s)=>t.html`<div class="${(0,r.classMap)({row:!0,skeleton:this._skeleton,selected:this._isSelected(i)})}" style="${(0,h.styleMap)({...e,height:this.rowheight,"grid-auto-rows":this.rowheight?null:"minmax(80px, auto)",cursor:this.options.selectable?"pointer":"","border-color":this.options.selectable&&this._isSelected(i)?"var(--selected--bgc)":"","column-gap":"var(--gv-table--colmg, 0.2rem)"})}" @click="${this._onSelect.bind(this,i)}" @mouseenter="${this._onMouseEnter.bind(this,i)}">${this.options&&this.options.data?(0,o.repeat)(this.options.data,(t=>t),(e=>{const r="function"==typeof e.style?e.style(i):e.style,o=this._getFormattedCellValue(e,i);return t.html`<div class="cell" style="${(0,g.ifDefined)(r)}" title="${o}">${this._renderCell(o,e,i,s)}${this._renderTag(e,i)}${e.icon?this._renderIcon(i,s,e):""}</div>`})):""}</div>`)):""}</div>`}_renderItems(){let e=this.options.data.map((t=>t.width?t.width:"image"===t.type?"80px":"icon"===t.type?"40px":null));const i=e.filter((t=>null!==t)),s=i.reduce(((t,e)=>t+parseInt(e.replace("px",""),10)),0);e=e.map((t=>{if(null==t){const t=(0,c.getCssVar)(this,"--gv-table--colmg","0.2rem");return`calc((100% - ( ${s}px + ${this.options.data.length-1} * ${t} ) ) / ${this.options.data.length-i.length})`}return t}));const r={"grid-template-columns":e.join(" ")};return t.html`${this._renderHeader(r)} ${this._renderRows(r)} ${this._renderPagination()}`}_renderPagination(){if(this.options&&this.options.paging&&this._itemsProvider){const e={first:1,last:this._itemsProvider.length/this.options.paging,total:this._itemsProvider.length,current_page:this._page,total_pages:this._itemsProvider.length/this.options.paging};return t.html`<gv-pagination .data="${e}" widget="true"></gv-pagination>`}}_getDataFromField(t,e){return"function"==typeof e?e(t):e.split(".").reduce(((t,e)=>t&&t[e]),t)}_renderTag(e,i){if(e.tag){let s;if(s="function"==typeof e.tag?e.tag(i):e.format?e.format(this._getDataFromField(i,e.tag)):this._getDataFromField(i,e.tag),s)return t.html`<gv-tag ?skeleton="${this._skeleton}">${s}</gv-tag>`}return""}_onImageLoaded(){this._skeleton=!1}_renderImage(e,i){return t.html`<gv-identity-picture .picture="${e}" .display_name="${i}"></gv-identity-picture>`}updated(t){this._onSortChanged()}render(){if(this._error)return t.html`<div class="error">${(0,a.i18n)("gv-table.error")}</div>`;const e={table:!0,skeleton:this._skeleton||this.skeleton},i={height:this.rowsheight?this.rowsheight:""};return t.html`<div class="${(0,r.classMap)(e)}" style="${(0,h.styleMap)({display:this.rowsheight?"block":"flex"})}">${this.title?t.html`<div class="header"><h3 class="title">${this.title} ${this._empty?"":t.html`<span>(${this.total||this._items&&this._items.length})</span>`}</h3></div>`:""} ${!this._empty&&this.options&&this.options.data?this._renderItems():t.html`<div class="empty" style="${(0,h.styleMap)(i)}">${this.emptymessage?this.emptymessage:(0,a.i18n)("gv-table.empty")}</div>`}</div>`}}exports.GvTable=p,window.customElements.define("gv-table",p);
|
package/src/molecules/gv-tree.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvTree=void 0;const e=require("lit"),t=require("lit/directives/repeat");require("../atoms/gv-button"),require("../atoms/gv-icon");const r=require("../lib/events"),i=require("lit/directives/class-map");class o extends e.LitElement{static get properties(){return{items:{type:Array},closed:{type:Boolean,reflect:!0},selectedItem:{type:Object}}}static get styles(){return[e.css`:host{--c:var(--gv-tree--c, var(--gv-theme-font-color-dark, #262626));--bgc:var(--gv-tree--bgc, var(--gv-theme-neutral-color-lightest, #ffffff));--active-bdc:var(--gv-tree-active--bdc, var(--gv-theme-color, #5a7684));--active-bgc:var(--gv-tree-active--bgc, var(--gv-theme-neutral-color-dark, #d9d9d9));--gv-icon--s:var(--gv-tree-icon--s, 20px);--gv-icon--c:var(--c);background-color:var(--bgc);color:var(--c);display:flex;flex-direction:row;height:100%}.tree{padding-top:10px;transition:all 350ms ease-in-out;width:300px}.tree.closed{width:42px}.main-tree-menu{user-select:none;overflow-y:auto;overflow-x:hidden;height:calc(100% - 20px);direction:rtl}.main-tree-menu>ul{position:relative}ul{display:block;line-height:2;list-style:none;margin:0;padding:0}ul li{display:block;padding:.5em .5em .5em 1em}ul li ul{margin-bottom:-.5em;margin-top:.5em}ul li:hover:not(.folder):not(.selected)>label::before{border-right-width:4px;border-right-style:solid;border-right-color:var(--active-bgc);box-sizing:border-box}ul label{cursor:pointer;display:flex;flex-direction:row;justify-content:space-between;align-items:center;direction:ltr}ul label::before{-moz-box-sizing:border-box;box-sizing:border-box;content:'';height:3em;left:0;position:absolute;right:0}.selected>label::before{border-right-width:4px;border-right-style:solid;border-right-color:var(--active-bdc);box-sizing:border-box}.folder>label{font-weight:700}.tree-arrow{transform:rotate(90deg);cursor:pointer;opacity:.5;width:20px;height:20px}.closed .tree-arrow{transform:rotate(0)}.closed .tree-menu{height:0;transition:height .8s;display:none}.switch{cursor:pointer;opacity:.7;position:sticky;margin:0 11px 0 11px;display:flex;justify-content:flex-end}`]}constructor(){super(),this.closed=!1}_onSelect(e,t){t.stopPropagation(),this.selectedItem=e,(0,r.dispatchCustomEvent)(this,"select",e)}_onClick(e,t){t&&t.stopPropagation(),e.expanded=!e.expanded,this.requestUpdate()}_getMenuItemPage(t){return e.html`<label @click="${this._onSelect.bind(this,t)}">${t.name}</label>`}_getMenuItemFolder(t){return e.html`<label @click="${this._onClick.bind(this,t)}" class="${(0,i.classMap)({closed:!t.expanded})}">${t.name}<gv-icon class="tree-arrow" shape="code:right-circle"></gv-icon></label> <span class="${(0,i.classMap)({closed:!t.expanded})}">${this._getMenu(t.children)}</span>`}_getMenu(r){return r?e.html`<ul class="${(0,i.classMap)({"tree-menu":!0,closed:this.closed})}">${(0,t.repeat)(r,(e=>this._getMenuItem(e)))}</ul>`:""}_getMenuItem(t){return e.html`${t.children&&t.children.length>0?e.html`<li class="tree-menu__item folder">${this._getMenuItemFolder(t)}</li>`:e.html`<li class="tree-menu__item page ${t===this.selectedItem?"selected":""}">${this._getMenuItemPage(t)}</li>`}`}_toggleMenu(){this.closed=!this.closed,(0,r.dispatchCustomEvent)(this,"toggle",{closed:this.closed})}render(){const t={tree:!0,closed:this.closed};return e.html`<div class="${(0,i.classMap)(t)}"><div class="switch"><gv-icon shape="${this.closed?"text:menu":"navigation:angle-double-left"}" @click="${this._toggleMenu}"></gv-icon></div>${e.html`<div class="main-tree-menu">${this._getMenu(this.items)}</div>`}</div>`}}exports.GvTree=o,window.customElements.define("gv-tree",o);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvDocumentation=void 0;const e=require("lit"),t=require("../lib/events"),i=require("../lib/text-format"),o=require("../styles/empty"),s=require("lit/directives/class-map");class n extends e.LitElement{static get properties(){return{text:{type:String},type:{type:String},image:{type:String},_dom:{type:Object,attribute:!1},disabled:{type:Boolean},withoutHeader:{type:Boolean,attribute:"without-header"},_cssLoaded:{type:Boolean,attribute:!1}}}static get styles(){return[o.empty,e.css`:host{box-sizing:border-box;position:relative}.header{display:flex;border-bottom:1px solid #d9d9d9;box-sizing:border-box;min-height:45px;--gv-icon--s:26px;align-items:center;padding:0 1rem;position:relative}.header .left,.header .right{display:flex;flex:1;z-index:10}.header .right{justify-content:flex-end}.header .title{color:#28444f;font-size:18px;display:flex;position:absolute;text-transform:uppercase;letter-spacing:.2rem;justify-content:center;width:100%;top:0;left:0;bottom:0;align-items:center;text-transform:capitalize}.header gv-image{height:35px;width:35px}.container{flex-grow:1;display:flex;flex-direction:column;min-height:0;height:100%}.doc-content{background:#fff;display:none;flex-grow:1;overflow:auto;min-height:0;padding:.5rem}.hljs-string{white-space:pre-wrap}.empty{display:none}.show{display:block}`]}constructor(){super(),this.type="adoc"}_onCloseDocumentation(){(0,t.dispatchCustomEvent)(this,"close")}_renderIcon(){return this.image?e.html`<gv-image src="${this.image}"></gv-image>`:e.html`<gv-icon shape="code:question"></gv-icon>`}shouldUpdate(e){return e.has("text")?((0,i.toDom)(this.text,this.type,!0).then((e=>{if(this._dom=e,this._dom){const e=this._dom.element.querySelector("h1");e&&!this.withoutHeader&&e.remove(),this._dom.element.querySelectorAll("a").forEach((e=>e.target="_blank"))}})),!1):super.shouldUpdate(e)}_onLoad(){this._cssLoaded=!0}render(){let t,i="";return this._dom&&(i=this._dom.title,t=this._dom.element),e.html`<link @load="${this._onLoad}" rel="stylesheet" href="css/documentation.css"><div class="container">${this.withoutHeader?e.html``:e.html`<div class="header"><div class="left">${this.disabled?e.html``:e.html`<gv-button icon="general:close" outlined small @gv-button:click="${this._onCloseDocumentation}" title="Close"></gv-button>`}</div><div class="title">${i}</div><div class="right">${this._renderIcon()}</div></div>`}<div class="${(0,s.classMap)({"doc-content":!0,show:this._cssLoaded})}">${t}<slot name="empty" class="${(0,s.classMap)({empty:!0,show:null==t})}"><div>Sorry,the documentation was not found.</div><div>See the documentation about plugins.</div></slot></div></div>`}}exports.GvDocumentation=n,window.customElements.define("gv-documentation",n);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvHeader=void 0;const e=require("lit");require("../atoms/gv-button"),require("../atoms/gv-tag");const t=require("../lib/i18n"),i=require("../lib/utils"),r=require("lit/directives/repeat"),s=require("lit/directives/until"),n=require("../lib/events"),a=require("lit/directives/class-map"),l=require("../mixins/with-resize-observer"),o=require("../mixins/item-resource"),c=require("../lib/item"),h=require("lit/directives/style-map");class v extends((0,l.withResizeObserver)((0,o.ItemResource)(e.LitElement))){static get properties(){return{breadcrumbs:{type:Array},sticky:{type:Boolean,reflect:!0},_breadcrumbs:{type:Array,attribute:!1},canSubscribe:{type:Boolean,attribute:"can-subscribe"}}}static get styles(){return[...super.styles,e.css`:host{--img-w:120px;--img-h:120px;--gv-button--fz:var(--gv-header-button--fz, var(--gv-theme-font-size-l, 16px));--gv-button--p:var(--gv-header-button--p, 10px 24px);--gv-link--bgc:transparent;--gv-link-active-bgc:transparent;--c:var(--gv-header--c, var(--gv-theme-font-color-dark, #262626));--gv-link--c:var(--c);--gv-link-active--c:var(--c);--gv-link-a--ph:5px;--gv-link--td:underline;--bgc:var(--gv-header--bgc, var(--gv-theme-color-light, #86c3d0));box-sizing:border-box;display:block}:host([w-lt-768]){--img--w:calc(var(--img-w) / 2);--img--h:calc(var(--img-h) / 2);--gv-button--fz:var(--gv-theme-font-size-s, 12px);font-size:var(--gv-theme-font-size-s,12px)}:host([w-lt-580]){--gv-button--p:3px 9px;--gv-link-a--ph:0px}:host([w-lt-580]) .actions{display:flex;flex-direction:column}:host([w-lt-580]) .version{font-size:var(--gv-theme-font-size-s,12px);line-height:var(--gv-theme-font-size-s,12px)}:host([w-lt-580]) .image gv-image{top:-5px}:host([w-lt-580]) h1{font-size:calc(var(--gv-theme-font-size-xl,26px) - 4px);line-height:calc(var(--gv-theme-font-size-xl,26px) - 4px)}:host([w-lt-400]) h1{font-size:calc(var(--gv-theme-font-size-xl,26px) - 8px)}.header{display:flex;background-color:var(--bgc);flex-direction:row;color:var(--c);transition:all 350ms ease-in-out;padding:.5rem var(--gv-theme-layout--pr,4rem) .5rem var(--gv-theme-layout--pl,4rem);position:relative}.title{flex:1;margin:.5rem 0 .5rem var(--img-w);padding-left:2rem}:host([sticky]) .title{margin-left:calc(var(--img-w)/ 2);transition:all 250ms ease-in-out}.actions,.title{align-self:flex-end}gv-link:last-child{--gv-link--td:none}gv-link::after{content:'>';color:var(--gv-theme-font-color-dark,#262626);align-self:center}gv-link:last-child::after{content:''}.error{text-align:center;margin-right:125px}.version{letter-spacing:.05em;opacity:.5;font-size:var(--gv-theme-font-size-l,16px);line-height:var(--gv-theme-font-size-l,16px);font-weight:500}gv-identity-picture{height:var(--img-h);width:var(--img-w);position:absolute;--gv-image--of:contain;transition:all 150ms ease-in-out}:host([sticky]) gv-identity-picture{height:calc(var(--img-h)/ 2);width:calc(var(--img-w)/ 2);transition:all 150ms ease;top:20%}h1{margin:0;font-size:var(--gv-theme-font-size-xl,26px);font-weight:500;line-height:var(--gv-theme-font-size-xl,26px);letter-spacing:.05em}h1 span{opacity:.5;font-size:var(--gv-theme-font-size-l,16px)}.skeleton .error,.skeleton gv-button{visibility:hidden}`]}constructor(){super(),this.breakpoints={width:[400,580,768]},this._breadcrumbs=[],this.canSubscribe=!1}set breadcrumbs(e){e?Promise.resolve(e).then((e=>{e?Promise.all(e).then((e=>{(0,i.isSameRoutes)(this._breadcrumbs,e)||(this._breadcrumbs=e.filter((e=>null!=e)))})):this._breadcrumbs=null})):this._breadcrumbs=null}_getLink(t,i){return Promise.resolve(t).then((t=>{const r=i===this._breadcrumbs.length-1?(0,c.getTitle)(this._item):t.title;return e.html`<gv-link @gv-link:click="${this._onClick}" .active="${t.active}" .icon="${t.icon}" .path="${t.path}" .title="${r}" .help="${(0,s.until)(t.help,null)}"></gv-link>`})).catch((()=>{delete this._routes[i]}))}_renderBreadcrumbs(){return e.html`<nav>${(0,r.repeat)(this._breadcrumbs,(e=>e),((t,i)=>(0,s.until)(this._getLink(t,i),e.html`<gv-link skeleton></gv-link>`)))}</nav>`}_onSubscribe(e){e.stopPropagation(),(0,n.dispatchCustomEvent)(this,"subscribe",this._item)}render(){const i=(0,c.getNbApisInView)(this._item);return e.html`<div class="${(0,a.classMap)({header:!0,skeleton:this._skeleton})}" style="${(0,h.styleMap)({background:'url("'+(0,c.getBackground)(this._item)+'") var(--bgc) center center no-repeat'})}">${this._renderImage()}<div class="title">${this._error||this._empty||this.sticky?"":e.html`<div class="version">${(0,c.getVersion)(this._item)}</div>`} ${this._error||this._empty?e.html`<div class="error">${this._error?(0,t.i18n)("gv-header.error"):(0,t.i18n)("gv-header.empty")}</div>`:e.html`<h1>${(0,c.getTitle)(this._item)} ${null!==i?e.html`<span>(${i})</span>`:""}</h1>`}</div>${this._error||this._empty||!this.canSubscribe?"":e.html`<div class="actions"><gv-button primary @click="${this._onSubscribe}">${(0,t.i18n)("gv-header.subscribe")}</gv-button></div>`}</div>`}}exports.GvHeader=v,window.customElements.define("gv-header",v);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvHttpClient=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 s=require("../mixins/keyboard-element"),t=require("../styles/empty"),i=require("../lib/http-client-schema-form"),o=require("../lib/events"),r=require("../lib/http"),n=require("lit-html/directives/repeat");class d extends((0,s.KeyboardElement)(e.LitElement)){static get properties(){return{response:{type:Object},path:{type:String},method:{type:String},loading:{type:Boolean}}}constructor(){super(),this.response=void 0,this.loading=!1,this.path=void 0,this.method=void 0,this.request={method:"GET",path:"/"}}_sendRequest(){(0,o.dispatchCustomEvent)(this,"send",{request:this.request})}_updateRequest(e){this.isFormValid=e.detail.validation.valid,this.request=e.detail.values,this.requestUpdate()}render(){return e.html`<div class="container"><div class="request"><div class="top-bar">Request</div><div class="request-form"><gv-schema-form .schema="${i.httpClientSchemaForm}" id="request-form" @gv-schema-form:change="${this._updateRequest}"></gv-schema-form><gv-button class="request-form-button" icon-right="content:send" .disabled="${!1===this.isFormValid||!0===this.loading}" @gv-button:click="${this._sendRequest}">Send</gv-button></div></div><div class="response">${this.loading||this.response?"":this._renderEmptyResponse()} ${this.loading?this._renderLoading():""} ${this.response?this._renderDebugResponse():""}</div></div>`}_renderEmptyResponse(){return e.html`<div class="empty-response"><gv-icon class="empty-response-icon" shape="editor:format_align_left"></gv-icon><div>Define and run the request you want to test!</div></div>`}_renderLoading(){return e.html`<div class="loading"><gv-icon class="loading-icon" shape="communication:sending"></gv-icon><div>Request in progress!</div></div>`}_renderDebugResponse(){let s=this.response.body,t="text";if(this.response.headers){const e=Object.entries(this.response.headers).find((([e,s])=>"content-type"===e.toLowerCase())),i=e?e[1].split(";")[0]:void 0;"text/html"===i?(t="htmlmixed",s=this.response.body):"application/json"===i&&(t="application/json",s=JSON.stringify(JSON.parse(this.response.body),null,2))}const i={lineNumbers:!0,mode:t};return e.html`${this._renderResponseHeader()}<div class="response-headers">Headers</div><div class="response-headers-content">${(0,n.repeat)(Object.keys(this.response.headers),(s=>e.html`<div><code>${s}: ${this.response.headers[s]}</code></div>`))}</div><div class="response-body">Body</div><div class="code-container"><gv-code .value="${s}" .options="${i}" readonly="readonly"></gv-code></div>`}_renderResponseHeader(){const s=200<=this.response.statusCode&&this.response.statusCode<300,t=400<=this.response.statusCode&&this.response.statusCode<600;return e.html`<div class="top-bar"><div class="response-row-item">Response</div>${this.method?e.html`<div class="response-row-item-method">${this.method}</div>`:""} ${this.path?e.html`<div class="response-row-item">${this.path}</div>`:""} ${this.response.statusCode?e.html`<div class="response-row-item"><gv-state ?success="${s}" ?error="${t}">${this.response.statusCode} - ${r.statusCode[this.response.statusCode].description}</gv-state></div>`:""}</div>`}static get styles(){return[t.empty,e.css`:host{box-sizing:border-box;height:100%;width:100%;display:block}.container{display:flex;flex-direction:row;height:100%}.request{width:40%;height:100%}.request-form{padding:8px;display:flex;flex-direction:column}.request-form-button{margin-top:16px}.response{border-left:1px solid #d9d9d9;border-right:1px solid #d9d9d9;height:100%;width:60%;overflow:hidden}.top-bar{background-color:#f5f5f5}.response-row-item{margin-right:16px}.response-row-item-method{margin-right:4px;font-weight:700}.response-body,.response-headers,.status-code,.top-bar{font-size:16px;height:40px;display:flex;flex-direction:row;align-items:center;padding:0 16px;border-bottom:1px solid #d9d9d9}.response-headers-content{padding:16px;border-bottom:1px solid #d9d9d9;max-height:40%}.empty-response,.loading{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;font-size:16px}.empty-response-icon,.loading-icon{--gv-icon--s:128px;--gv-icon--c:var(--gv-theme-color-dark)}.code-container{height:100%;overflow:auto}`]}}exports.GvHttpClient=d,window.customElements.define("gv-http-client",d);
|
package/src/organisms/gv-menu.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvMenu=void 0;const t=require("lit");require("../molecules/gv-nav");const e=require("../lib/utils"),i=require("lit/directives/class-map"),s=require("../mixins/with-resize-observer");class r extends((0,s.withResizeObserver)(t.LitElement)){static get properties(){return{routes:{type:Array},sticky:{type:Boolean,reflect:!0},_small:{type:Boolean,attribute:!1},_routes:{type:Array,attribute:!1},_hasHeader:{type:Boolean,attribute:!1}}}static get styles(){return[t.css`:host{--gv-link--c:var(--gv-menu--c, var(--gv-theme-font-color-light, #ffffff));--gv-link-active--c:var(--gv-menu--c, var(--gv-theme-font-color-light, #ffffff));--gv-link--bgc:var(--gv-menu-link--bgc, transparent);--gv-link-active--bgc:var(--gv-menu-link-active--bgc, transparent);--gv-link-active--bdc:var(--gv-menu-link-active--bdc, var(--gv-theme-color-light, #86c3d0));--gv-link-active--bds:var(--gv-menu-link-active--bds, solid);--gv-link-active--bdw:var(--gv-menu-link-active--bdw, 0 0 3px 0);--pr:var(--gv-theme-layout--pr, 4rem);--pl:var(--gv-theme-layout--pl, 4rem);box-sizing:border-box;display:block;font-size:var(--gv-theme-font-size-s,12px)}:host([sticky]) gv-nav{line-height:14px;--gv-link-icon--s:20px}:host([sticky]) .has-header gv-nav{line-height:34px}:host([sticky]) ::slotted([slot=top]){transition:height 250ms ease-in-out}:host([w-lt-1024]){--pr:5px;--pl:5px}:host([w-lt-768]) .nav-container{width:100%;padding-left:var(--pl);--gv-link-a--pv:var(--gv-menu-link-a--pv, 0px)}:host([w-lt-580]) .nav-container{flex:auto;padding-left:0}:host([w-lt-580]) gv-nav{flex:auto}:host([w-lt-580]) .right{flex:auto}:host([w-lt-380]) .nav-container{display:flex;flex-direction:column-reverse}:host([w-lt-380]) gv-nav{align-self:flex-start;flex:1}:host([w-lt-380]) .right{align-self:flex-end;flex:1;width:100%;padding-right:0}gv-nav{display:table-cell;line-height:50px;vertical-align:middle}.nav-container{display:grid;grid-template-columns:auto auto;background-color:var(--gv-menu--bgc,var(--gv-theme-color-dark,#28444f));color:var(--gv-menu--c,var(--gv-theme-font-color-light,#fff))}.has-header .nav-container{width:calc(100% - 10rem);padding-left:10rem;--gv-link-a--pv:0}:host([sticky]) .has-header .nav-container{width:calc(100% - 5rem);padding-left:5rem;transition:all 250ms ease-in-out}.right{display:flex;padding-right:var(--pr);justify-content:center;flex-direction:column}gv-nav{padding-left:var(--pl);transition:width 250ms ease-in-out}slot[name=right-transition],slot[name=right]{display:flex;justify-content:flex-end;width:100%}.right ::slotted([slot=right-transition]),.right ::slotted([slot=right]){align-self:center}.right ::slotted([slot=right-transition]){transition:width 250ms ease 250ms;width:70%}.right:focus-within ::slotted([slot=right-transition]){animation:slide 250ms 250ms;transition:width 250ms ease-in-out 250ms;width:100%}.right ::slotted([slot=right]){--gv-button--p:7px 16px;--gv-button--fz:15px}`]}constructor(){super(),this._routes=[],this.sticky=!1,this.breakpoints={width:[380,580,768,1024]}}set routes(t){t?Promise.resolve(t).then((t=>{t?Promise.all(t).then((t=>{(0,e.isSameRoutes)(this._routes,t)||(this._routes=t)})):this._routes=[]})):this._routes=[]}onResize({width:t}){this._small=t<=1024}render(){return t.html`<div class="${(0,i.classMap)({"has-header":this._hasHeader})}"><slot name="top"></slot><div class="nav-container"><gv-nav .routes="${this._routes}" ?small="${this._small}"></gv-nav><div class="right"><slot name="right-transition"></slot><slot name="right"></slot></div></div></div>`}updated(t){super.updated(t);let e=!1;for(const t of this.childNodes)if(1===t.nodeType){const i="gv-header"===t.nodeName.toLowerCase()?t:t.querySelector("gv-header");if(i){i.sticky=this.sticky,e=!0;break}}this._hasHeader=e}}exports.GvMenu=r,window.customElements.define("gv-menu",r);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvNewsletterSubscription=void 0;const t=require("lit"),e=require("../lib/events");class i extends t.LitElement{static get properties(){return{title:{type:String},header:{type:String},placeholder:{type:String},subscribeLabel:{type:String,attribute:"subscribe-label"},skipLabel:{type:String,attribute:"skip-label"},taglines:{type:Array},email:{type:String},disabled:{type:Boolean},githubUrl:{type:String,attribute:"github-url"},twitterUrl:{type:String,attribute:"twitter-url"},linkedinUrl:{type:String,attribute:"linkedin-url"},_invalid:{type:Boolean,attribute:!1}}}static get styles(){return[t.css`:host{box-sizing:border-box;margin:.2rem}.newsletter-container{display:flex;flex-direction:column;align-items:center;justify-content:space-between;max-width:680px;box-shadow:0 0 20px 0 rgba(0,0,0,.2),0 5px 5px 0 rgba(0,0,0,.24);padding:25px 20px 5px 20px}.newsletter__header{text-transform:uppercase;font-style:oblique;text-align:center;font-size:16px;font-weight:700;padding:5px 35px;color:var(--gv-theme-neutral-color-lightest,#fff);background-color:var(--gv-theme-color-light,#86c3d0)}.newsletter__title{display:flex;flex-direction:column;align-items:center;font-size:20px;text-transform:uppercase;padding:20px;color:var(--gv-theme-color-light,#86c3d0)}.newsletter__title-highlight{font-size:30px}.newsletter__email{display:flex;flex-direction:column;width:50%}.newsletter__taglines{display:flex;flex-direction:row;justify-content:space-between;align-items:center;text-align:center;text-transform:uppercase;font-size:14px;height:20%;margin-top:20px;padding:10px 0;color:var(--gv-theme-color-darker,#383e3f);border-bottom:solid 1px var(--gv-theme-color-darker,#383e3f)}.newsletter__tagline{display:flex;flex-basis:100%;flex-direction:column;justify-content:center;align-items:center;height:100%;font-weight:700;padding:0 15px;border-right:solid 1px var(--gv-theme-color-darker,#383e3f)}.newsletter__tagline.last{border-right:none}.newsletter__tagline-text{width:100%}.newsletter__skip{margin-top:20px}.social{width:100%;display:flex;flex-direction:row;justify-content:flex-end}.social-link{--gv-icon--c:var(--gv-theme-color-light, #86c3d0);--gv-icon--s:32px}`]}constructor(){super(),this.header="Customers process over 1 billion requests through the gravitee.io gateway in just one week",this.title="Community of api masters",this.placeholder="Enter your email",this.subscribeLabel="Become an API master now",this.taglines=["New release monthly updates","Free trial of Gravitee.IO enterprise","Share your experiences with other members"],this.skipLabel="Skip",this.email="",this.disabled=!1,this._invalid=!0,this.githubUrl="https://github.com/gravitee-io",this.twitterUrl="https://twitter.com/GraviteeIO",this.linkedinUrl="https://www.linkedin.com/company/gravitee-io/"}render(){return t.html`<div class="newsletter-container"><div class="newsletter__header">${this.header}</div><div class="newsletter__title"><span>Join the</span> <span class="newsletter__title-highlight">${this.title}</span> <span>Today</span></div><div class="newsletter__email"><gv-input id="email" name="email" @gv-input:submit="${this._onSubscribe}" @gv-input:input="${this._onInputChange}" type="email" required .value="${this.email}" .disabled="${this.disabled}" placeholder="${this.placeholder}"></gv-input><gv-button @click="${this._onSubscribe}" id="email-submit" provider="graviteeio_am" icon-right="navigation:angle-right" .disabled="${!this.disabled&&this._invalid}">${this.subscribeLabel}</gv-button></div>${this.taglines.length>0?t.html`<div class="newsletter__taglines">${this.taglines.map(((e,i,s)=>t.html`<div class="newsletter__tagline ${i===s.length-1?"last":""}"><div class="newsletter__tagline-text">${e}</div></div>`))}</div>`:""}<div class="newsletter__skip"><gv-button @click="${this._onSkip}" provider="graviteeio_am" icon-right="navigation:angle-right" small outlined>${this.skipLabel}</gv-button></div><div class="social"><gv-button class="social-link" link icon="thirdparty:github" .href="${this.githubUrl}" @gv-button:click="${this._navigateSocial.bind(this,this.githubUrl)}"></gv-button><gv-button class="social-link" link icon="thirdparty:twitter" .href="${this.twitterUrl}" @gv-button:click="${this._navigateSocial.bind(this,this.twitterUrl)}"></gv-button><gv-button class="social-link" link icon="thirdparty:linkedin" .href="${this.linkedinUrl}" @gv-button:click="${this._navigateSocial.bind(this,this.linkedinUrl)}"></gv-button></div></div>`}_onSubscribe(){(0,e.dispatchCustomEvent)(this,"subscribe",this.email)}_onSkip(){(0,e.dispatchCustomEvent)(this,"skip")}_navigateSocial(t){window.open(t,"_blank")}_onInputChange(t){this._invalid=t.target.invalid,this.email=t.detail}}exports.GvNewsletterSubscription=i,window.customElements.define("gv-newsletter-subscription",i);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvPagination=void 0;const t=require("lit"),i=require("../lib/events");require("../atoms/gv-button");const e=require("../lib/i18n");class s extends t.LitElement{static get properties(){return{data:{type:Object},hideEmpty:{type:Boolean,attribute:"hide-empty"},widget:{type:Boolean},disabled:{type:Boolean},_first:{type:Number},_last:{type:Number},_current:{type:Number},_total:{type:Number}}}static get styles(){return[t.css`.pagination{--font-size:var(--gv-pagination--fz, var(--gv-theme-font-size-s, 12px));font-size:var(--fz);--gv-button--fz:var(--fz);display:flex;align-items:center}gv-button{--gv-icon--s:var(--gv-pagination-icon--s, 18px);min-width:29px}gv-input{width:50px}`]}constructor(){super(),this.hideEmpty=!1,this.hasInput=!1,this.max=10,this.center=this.max/2-1,this.sizes=[],this.links={}}set data(t){t&&(this._last=t.last,this._current=parseInt(t.current_page),this._pages=t.total_pages,this._pages<this.max&&(this.max=this._pages))}_goToPage(t){this._current=parseInt(t),(0,i.dispatchCustomEvent)(this,"paginate",{page:t})}_onSubmit(t){const i=t.target.value;this._goToPage(i)}_onClickToSearch(){const t=this.shadowRoot.querySelector("gv-input").value;t&&this._goToPage(t)}_renderPagination(){const i=[];for(let t=0;t<this._pages;t++)i.push(t+1);let s=i.slice(0,this._current-1),n=i.slice(this._current);if(i.length>this.max){let t=s.length-this.center-1,i=this.max-this._current>this.center?this.max-this._current:this.center;if(t>0){i=this.center;const e=this._last-this._current-i;e<0&&(t+=e),s=s.slice(t)}n=n.slice(0,i)}const a=s.map((i=>t.html`<gv-button small outlined @click="${this._goToPage.bind(this,i)}">${i}</gv-button>`)),h=n.map((i=>t.html`<gv-button small outlined @click="${this._goToPage.bind(this,i)}">${i}</gv-button>`));return a.unshift(t.html`<gv-button small .disabled="${this.disabled||0===a.length}" .icon="${this.widget?"navigation:angle-left":null}" .title="${(0,e.i18n)("gv-pagination.previous")}" outlined @click="${0===a.length?()=>{}:this._goToPage.bind(this,this._current-1)}">${this.widget?"":(0,e.i18n)("gv-pagination.previous")}</gv-button>`),h.push(t.html`<gv-button small .disabled="${this.disabled||0===h.length}" .icon="${this.widget?"navigation:angle-right":null}" .title="${(0,e.i18n)("gv-pagination.next")}" outlined @click="${0===h.length?()=>{}:this._goToPage.bind(this,this._current+1)}">${this.widget?"":(0,e.i18n)("gv-pagination.next")}</gv-button>`),t.html`${this.widget?a.slice(0,1):a} ${t.html`<gv-button .disabled="${this.disabled}" small primary>${this.widget?this._current+" / "+i.length:this._current}</gv-button>`} ${this.widget?h.slice(h.length-1,h.length):h}`}_hasData(){return this._pages&&this._last&&this._current}_hideEmpty(){return this._hasData()&&this.hideEmpty&&this._pages<2}render(){return this._hasData()&&!this._hideEmpty()?t.html`<div class="pagination">${this.hasInput?t.html`<gv-input class="goto" @gv-input:submit="${this._onSubmit}" type="number" min="1" max="${this._pages}" placeholder="Page" small></gv-input><gv-button small outlined @click="${this._onClickToSearch}" icon="general:search"></gv-button>`:""} ${this._renderPagination()}</div>`:t.html``}}exports.GvPagination=s,window.customElements.define("gv-pagination",s);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvProperties=void 0;const e=require("lit");require("./gv-schema-form"),require("./gv-resizable-views"),require("../molecules/gv-table"),require("../atoms/gv-button"),require("../atoms/gv-input"),require("../atoms/gv-icon"),require("../atoms/gv-text"),require("../atoms/gv-input-message"),require("../atoms/gv-select");const t=require("../lib/events"),i=require("../lib/properties"),r=require("../lib/i18n"),o=require("lit/directives/class-map"),s=require("../mixins/keyboard-element"),n=require("../styles/empty");class a extends((0,s.KeyboardElement)(e.LitElement)){static get properties(){return{dynamicPropertySchema:{type:Object},properties:{type:Array},_properties:{type:Array,attribute:!1},provider:{type:Object},providers:{type:Array},_propertySchemaForm:{type:Object,attribute:!1},expert:{type:Boolean},_formattedErrors:{type:Array,attributes:!1},_filter:{type:String},_paginationData:{type:Object,attribute:!1},_pageSize:{type:Number,attribute:!1},_newItem:{type:Object,attribute:!1},_providerDocumentation:{type:Boolean,attribute:!1},_showDocumentation:{type:Boolean,attribute:!1},_textRows:{type:Number,attribute:!1},readonly:{type:Boolean,reflect:!0},encryptable:{type:Boolean,reflect:!0}}}constructor(){super(),this.properties=[],this.types=[],this.provider={},this._currentResource=null,this._formattedErrors=[],this._showDocumentation=!0,this._newItem={key:"",value:"",_new:!0},this._pageSize=10,this._textRows=10,this._pageSizes=[5,10,25,50,100],this._errors=[]}onKeyboard(){if(this.isPressed(s.KEYS.Esc)&&this._onClosePropertySchemaForm(),this.isPressed(s.KEYS.Shift,s.KEYS.Ctrl,s.KEYS.Space)){const e=this.shadowRoot.querySelector("#search-property");e&&e.focus()}}set properties(e){this._properties=e.sort(((e,t)=>e.key.localeCompare(t.key))).map((e=>(e.encrypted&&(e.encryptable=!0),e)))}get properties(){return this._properties}_getResizableViews(){return this.shadowRoot.querySelector("gv-resizable-views")}_maximizeTopView(){const e=this._getResizableViews();e&&e.maximizeTop(95,5)}_maximizeBottomView(){const e=this._getResizableViews();e&&e.resize(30,70)}_splitMainViews(){const e=this._getResizableViews();e&&e.split()}_isNewLineTable(e){return!0===e._new}_onInputNew(e,t){const r=t.target;this._newItem[e]=t.detail;const{errors:o}=(0,i.parseRaw)((0,i.toNameEqualsValueString)([...this.properties,this._newItem]));this._errors=o,setTimeout((()=>{const t=this.shadowRoot.querySelector("gv-button#add-property");o.length>0||this._disabledNewLine(this._newItem)?t.setAttribute("disabled",!0):t.removeAttribute("disabled"),"key"===e&&(0===o.length?(r.removeAttribute("invalid"),r.setAttribute("valid",!0)):(r.removeAttribute("valid"),r.setAttribute("invalid",!0)))}),0)}_onInput(){(0,t.dispatchCustomEvent)(this,"change",{properties:this.properties})}_onSwitchEncrypted(e){!0===e.encrypted&&(e.value="",e.encrypted=!1,e.encryptionWarning=(0,r.i18n)("gv-properties.infos.overwrite-encryption"),this.requestUpdate()),(0,t.dispatchCustomEvent)(this,"switch-encrypted",{properties:this.properties})}_addProperty(e){delete e._new,this.properties=[e,...this._properties],this._newItem={key:"",value:"",_new:!0,encryptable:!1,encrypted:!1},(0,t.dispatchCustomEvent)(this,"change",{properties:this.properties})}_removeProperty(e){this._properties=this._properties.filter((t=>t.key!==e.key)),(0,t.dispatchCustomEvent)(this,"change",{properties:this.properties})}_disabledNewLine(e){return null==e.key||null==e.value||""===e.key.trim()||""===e.value.trim()}_submitExpertMode(){this.expert&&(this.properties=this._handleExpertModeInput(this.shadowRoot.querySelector("#expert-input").value))}_onExpertModeTextInput({detail:e}){this._handleExpertModeInput(e)}_handleExpertModeInput(e){let r=this._properties;const o=this.provider&&this.provider.enabled,s=r.filter((e=>o&&e.dynamic)),n=r.filter((e=>e.encrypted)),a=`${e}\n${(0,i.toNameEqualsValueString)(s)}\n${(0,i.toNameEqualsValueString)(n)}`,{errors:p}=(0,i.parseRaw)(a);if(this._errors=p,0===p.length){const{variables:o}=(0,i.parseRaw)(e);r=[...o,...s,...n],(0,t.dispatchCustomEvent)(this,"change",{properties:r})}return r}_onSubmitPropertyForm({detail:e}){const i=e.values;(0,t.dispatchCustomEvent)(this,"save-provider",{provider:i}),this.requestUpdate()}submit(){this.expert?this._submitExpertMode():this._onSubmit()}_onSubmit(){null==[...this.shadowRoot.querySelectorAll("form .control")].find((e=>e.invalid))&&this._addProperty(this._newItem)}_onConfigureDynamicProperties(){if(null==this.dynamicPropertySchema){const e=this.providers.reduce(((e,t)=>(e[t.id]=t.key,e)),{}),t=Object.keys(e);this.dynamicPropertySchema={properties:{enabled:{type:"boolean",title:"Enabled",description:" This service is requiring an API deployment. Do not forget to deploy API to start dynamic-properties service."},schedule:{type:"string",title:"Schedule","x-schema-form":{"cron-expression":!0}},provider:{type:"string",title:"Provider type",enum:t,default:t[0],"x-schema-form":{titleMap:e}}},required:["schedule","provider"]}}const e=this.providers[0];this._propertySchemaForm={properties:{...this.dynamicPropertySchema.properties,configuration:e.schema},required:this.dynamicPropertySchema.required},this._providerDocumentation=e.documentation,this._maximizeBottomView()}_onClosePropertySchemaForm(){this._propertySchemaForm=null,this._maximizeTopView()}_onSearchProperty({detail:e}){this._filter=e,this._onClosePropertySchemaForm()}_onClearProperty(){this._filter=null,this._onClosePropertySchemaForm()}get _errors(){return this._formattedErrors}set _errors(e){this._formattedErrors=e.map((({type:e,key:t,pos:o})=>e===i.ERROR_TYPES.INVALID_NAME?{line:o.line,msg:(0,r.i18n)("gv-properties.errors.invalid-key",{key:t})}:e===i.ERROR_TYPES.DUPLICATED_NAME?{line:o.line,msg:(0,r.i18n)("gv-properties.errors.duplicated-key",{key:t})}:e===i.ERROR_TYPES.INVALID_LINE?{line:o.line,msg:(0,r.i18n)("gv-properties.errors.invalid-line")}:e===i.ERROR_TYPES.INVALID_VALUE?{line:o.line,msg:(0,r.i18n)("gv-properties.errors.invalid-value")}:{line:"?",msg:(0,r.i18n)("gv-properties.errors.unknown")}))}_renderErrors(t=!1){return this._formattedErrors.length>0?e.html`<div class="${(0,o.classMap)({"add-form-error":!0,"add-form-error_expert":this.expert})}"><div></div><div class="error-list">${this._formattedErrors.map((({line:i,msg:o})=>e.html`<gv-input-message>${t?e.html`<strong .innerHTML="${(0,r.i18n)("gv-properties.errors.line")} ${i}: "></strong>`:""} <span .innerHTML="${o}"></span></gv-input-message>`))}</div></div>`:e.html``}_renderTable(){const t=this.provider&&this.provider.enabled;if(this.expert){this._computeTextRows();const i=(t?this._properties.filter((e=>!(t&&e.dynamic))):this._properties).filter((e=>!e.encrypted)).map((e=>`${e.key}="${e.value}"`)).join("\n");return e.html`<gv-text id="expert-input" placeholder="${(0,r.i18n)("gv-properties.placeholder.input")}" @gv-text:input="${this._onExpertModeTextInput}" .value="${i}" ?readonly="${this.readonly}" .rows="${this._textRows}"></gv-text>${this._renderErrors(!0)}`}{const i={data:[{field:"dynamic",label:"Dynamic",width:"40px",type:e=>e.dynamic&&t?"gv-icon":"div",attributes:{shape:e=>e.dynamic&&t?"code:time-schedule":"",title:e=>e.dynamic&&t?"Dynamic properties service is actually in running":"",style:"justify-content: center; align-items: center; height: 100%;"}},{field:"key",label:"Key",type:"gv-input",attributes:{clipboard:!0,placeholder:(0,r.i18n)("gv-properties.placeholder.key"),name:"key",required:!0,readonly:this.readonly}},{field:"value",label:"Value",type:"gv-input",attributes:{name:"value",placeholder:"Property value",required:!0,readonly:this.readonly,disabled:e=>e.dynamic&&t||e.encrypted,type:e=>e.encrypted?"password":"text",title:e=>e.encrypted?(0,r.i18n)("gv-properties.infos.encrypted-value"):"",description:e=>e.encryptionWarning,icon:null,"ongv-input:input":this._onInput.bind(this)}}]};!0===this.encryptable&&i.data.push({field:"encryptable",type:"gv-switch",style:"--gv-switch--ta: right;",width:"105px",attributes:{description:(0,r.i18n)("gv-properties.encrypted-toggle"),required:!0,readonly:this.readonly,disabled:e=>e.dynamic&&t,"ongv-switch:input":this._onSwitchEncrypted.bind(this),style:"display: inline-flex; font-size: 12px; height: 40px;"}}),!0!==this.readonly&&i.data.push({type:"gv-button",width:"40px",attributes:{"ongv-button:click":(e,t,i)=>this._removeProperty(e,i),title:"Remove",disabled:e=>e.dynamic&&t,danger:!0,outlined:!0,icon:"home:trash"}});const o=null!=this._filter?this._properties.filter((e=>(e.key.toLowerCase()+e.value.toLowerCase()).includes(this._filter))):this._properties;let s=[...o];if(this._paginationData){this._paginationData.last=Math.ceil(o.length/this._pageSize),this._paginationData.total=o.length,this._paginationData.total_pages=Math.ceil(o.length/this._pageSize);const e=(this._paginationData.current_page-1)*this._pageSize;s=[...o].splice(e,this._pageSize)}const n=this.encryptable?"add-form-grid-with-encrypted-toggle":"add-form-grid",a=!0!==this.readonly?e.html`<form id="add-property-form" class="add-form ${n}" @submit="${this._onSubmit}"><div></div><gv-input class="control" placeholder="${(0,r.i18n)("gv-properties.placeholder.key")}" required @gv-input:input="${this._onInputNew.bind(this,"key")}" value="${this._newItem.key}"></gv-input><gv-input class="control" placeholder="${(0,r.i18n)("gv-properties.placeholder.value")}" required @gv-input:input="${this._onInputNew.bind(this,"value")}" .value="${this._newItem.value}"></gv-input>${this.encryptable?e.html`<gv-switch class="control" required description="${(0,r.i18n)("gv-properties.encrypted-toggle")}" @gv-switch:input="${this._onInputNew.bind(this,"encryptable")}" .value="${this._newItem.encryptable}"></gv-switch>`:""}<gv-button id="add-property" icon="code:plus" outlined disabled="disabled" @gv-button:click="${this._addProperty.bind(this,this._newItem)}" title="${(0,r.i18n)("gv-properties.add")}"></gv-button></form>${this._renderErrors()}<hr>`:"";return e.html`${a}<gv-table .options="${i}" .items="${s}" noheader nosort order="key" rowheight="57px"></gv-table>`}}_onChangeMode({detail:e}){this._submitExpertMode(),this.expert=e,this._errors=[],this._newItem={key:"",value:"",_new:!0},this._onClosePropertySchemaForm()}_onPaginate({detail:e}){this._paginationData.current_page=e.page,this._onClosePropertySchemaForm(),this.requestUpdate()}updated(e){(e.has("_properties")||e.has("_pageSize"))&&(this._paginationData={first:1,last:Math.ceil(this._properties.length/this._pageSize),total:this._properties.length,current_page:1,total_pages:Math.ceil(this._properties.length/this._pageSize)})}_onChangePageSize({detail:e}){this._pageSize=Number(e).valueOf(),this._onClosePropertySchemaForm()}_renderTableForm(){return e.html`<div class="container"><div class="header"><div class="title">Manage global properties <span>(${this._properties?this._properties.length:0})</span></div><gv-switch small .description="${this.expert?"Expert":"Simple"}" .value="${this.expert}" @gv-switch:input="${this._onChangeMode}"></gv-switch><gv-input id="search-property" placeholder="Filter properties (Shift + Ctrl + Space)" type="search" small class="search-input" .disabled="${this.expert}" @gv-input:input="${this._onSearchProperty}" @gv-input:clear="${this._onClearProperty}"></gv-input><gv-select class="page-size__select" @gv-select:input="${this._onChangePageSize}" small .options="${this._pageSizes}" .value="${this._pageSize}" .disabled="${this.expert||null==this._paginationData}"></gv-select><gv-pagination @gv-pagination:paginate="${this._onPaginate}" .disabled="${this.expert||null==this._paginationData}" .data="${this._paginationData}" widget></gv-pagination></div><div class="content"><div class="form-content">${this._renderTable()}</div></div></div>`}_fetchDocumentation(){this._showDocumentation=!0}_hideDocumentation(){this._showDocumentation=!1}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._onClosePropertySchemaForm())):Promise.resolve()}_renderForm(){return e.html`<gv-schema-form slot="top" scrollable .schema="${this._propertySchemaForm}" .values="${this.provider}" .icon="design:edit" has-header ?readonly="${this.readonly}" @gv-schema-form:submit="${this._onSubmitPropertyForm}"><div slot="title" class="properties-title">Configure dynamic properties</div><gv-button slot="header-left" icon="general:close" outlined small @gv-button:click="${this._onClosePropertySchemaForm}" title="Close (esc)"></gv-button><gv-button slot="header-left" icon="home:book" ?disabled="${this._showDocumentation}" outlined small @gv-button:click="${this._fetchDocumentation}" title="Open documentation"></gv-button></gv-schema-form>`}_renderBottom(){return this._propertySchemaForm&&this._showDocumentation?e.html`<gv-resizable-views no-overflow direction="horizontal">${this._renderForm()}<gv-documentation slot="bottom" .text="${this._providerDocumentation}" @gv-documentation:close="${this._hideDocumentation}"></gv-documentation></gv-resizable-views>`:this._propertySchemaForm?this._renderForm():e.html`<div class="properties-bottom-container">${this._renderDynamicConfiguration()}</div>`}_renderDynamicConfiguration(){const t=this.provider&&this.provider.enabled;let i="";return(t||!0!==this.readonly)&&(i=e.html`<gv-button icon="tools:tools" @gv-button:click="${this._onConfigureDynamicProperties}" outlined .disabled="${this.expert}">Configure dynamic properties</gv-button>`),t?e.html`<div class="properties-message">Dynamic properties service is actually in <code>running</code> state and run with cron expression <code>${this.provider.schedule}</code> using <code>${this.provider.provider}</code> provider.</div>${i}`:this.readonly?e.html`<div class="empty">No dynamic properties service configured</div>`:i}_onMove(){this._computeTextRows()}_computeTextRows(){const e=this.shadowRoot.querySelector(".content");if(e){const{height:t}=e.getBoundingClientRect();this._textRows=Math.round(Math.round(t-20)/30)-2}}render(){return this.providers&&this.providers.length>0?e.html`<div class="properties"><gv-resizable-views no-overflow @gv-resizable-views:move="${this._onMove}" @gv-resizable-views:resize="${this._onMove}"><div slot="top" class="box">${this._renderTableForm()}</div><div slot="bottom">${this._renderBottom()}</div></gv-resizable-views></div>`:e.html`<div class="properties"><div class="table-box">${this._renderTableForm()}</div></div>`}static get styles(){return[n.empty,e.css`:host{box-sizing:border-box;height:100%;width:100%;display:block}.properties{display:flex;height:100%;width:100%}gv-resizable-views{height:100%;width:100%}gv-schema-form{margin:0}.table-box{width:100%;border-left:1px solid #bfbfbf;display:flex}gv-table{height:auto;flex:1;margin-top:10px;margin-right:50px;--gv-table-rows--ov:none;--gv-table--colmg:var(--gv-properties-table--colmg, 0.2rem);--gv-table-cell--d:inline;--gv-table-row--ai:flex-start;--gv-table-row--ac:flex-start;--gv-table-hover--bgc:var(--gv-theme-neutral-color-lightest)}.properties-title{text-transform:uppercase;letter-spacing:.2rem}.properties-bottom-container{display:flex;justify-content:center;align-items:center;height:100%;flex-direction:column}.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}gv-text{--gv-text--fz:20px;--gv-text--lh:25px}gv-switch{--gv-switch--ta:right}.header gv-input{margin:0 1rem}.add-form,.add-form-error{display:grid;margin:auto 50px auto 0;box-sizing:border-box}.add-form{column-gap:var(--gv-properties-table--colmg,.2rem);border-right:solid thick transparent;height:50px}.add-form gv-input,gv-button,gv-switch{margin:auto 0}.add-form gv-switch{font-size:12px}.add-form-grid{grid-template-columns:40px auto auto 40px}.add-form-grid-with-encrypted-toggle{grid-template-columns:40px auto auto 105px 40px}.add-form-error_expert{display:flex}.add-form-error{grid-template-columns:40px 1fr}code{color:var(--gv-theme-color-warning-dark,#f57c00)}.form-content{display:flex;flex-direction:column;width:100%}.properties-message{margin-bottom:.5rem;font-size:14px}.page-size__select{max-width:50px}.search-input{width:300px}hr{background-color:var(--gv-theme-neutral-color);border:0;width:100%;height:2px}`]}}exports.GvProperties=a,window.customElements.define("gv-properties",a);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvResizableViews=void 0;const t=require("lit"),e=require("lit/directives/class-map"),o=require("../lib/events");class i extends t.LitElement{static get properties(){return{direction:{type:String,reflect:!0},noOverflow:{type:Boolean,attribute:"no-overflow"}}}constructor(){super(),this.direction="vertical"}split(){this.resize()}maximizeTop(){this.resize(85,15)}maximizeBottom(){this.resize(20,80)}resize(t=50,e=50){this.shadowRoot.querySelector(".top").style.height=`${t}%`,this.shadowRoot.querySelector(".bottom").style.height=`${e}%`,setTimeout((()=>{(0,o.dispatchCustomEvent)(this,"resize",{top:t,bottom:e})}),350)}resizable(t){const e=t.getAttribute("data-direction")||"horizontal",i=t.previousElementSibling,r=t.nextElementSibling;let s=0,n=0,l=0,a=0;const c=this.shadowRoot,d=this,h=function(c){const h=c.clientX-s,v=c.clientY-n;if((0,o.dispatchCustomEvent)(d,"move",{direction:e}),"vertical"===e)i.style.height=100*(l+v)/t.parentNode.getBoundingClientRect().height+"%",r.style.height=100-100*(l+v)/t.parentNode.getBoundingClientRect().height+"%";else i.style.width=100*(a+h)/t.parentNode.getBoundingClientRect().width+"%";const u="horizontal"===e?"col-resize":"row-resize";t.style.cursor=u,t.classList.add("drag"),document.body.style.cursor=u,i.style.userSelect="none",i.style.pointerEvents="none",r.style.userSelect="none",r.style.pointerEvents="none"},v=function(){t.style.removeProperty("cursor"),t.classList.remove("drag"),document.body.style.removeProperty("cursor"),i.style.removeProperty("user-select"),i.style.removeProperty("pointer-events"),r.style.removeProperty("user-select"),r.style.removeProperty("pointer-events"),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",v),c.querySelector(".box").classList.add("transition")};t.addEventListener("mousedown",(function(t){if(!t.target.classList.contains("action")){c.querySelector(".box").classList.remove("transition"),s=t.clientX,n=t.clientY;const e=i.getBoundingClientRect();l=e.height,a=e.width,document.addEventListener("mousemove",h),document.addEventListener("mouseup",v)}}))}firstUpdated(){this.shadowRoot.querySelectorAll(".resizer").forEach((t=>this.resizable(t)))}get shape(){return"horizontal"===this.direction?"design:vertical":"design:horizontal"}render(){return t.html`<div class="${(0,e.classMap)({box:!0,transition:!0,"no-overflow":this.noOverflow})}"><div class="top"><slot name="top"></slot></div><div class="resizer" data-direction="${this.direction}"><gv-icon shape="${this.shape}"></gv-icon><div class="actions"><gv-icon class="layout-icon" shape="layout:layout-right-panel-2"></gv-icon><gv-button small link class="action" icon="layout:layout-bottom-panel" title="Maximize top" @gv-button:click="${this.maximizeTop}"></gv-button><gv-button small link class="action" icon="layout:layout-horizontal-2" title="Split screen" @gv-button:click="${this.split}"></gv-button><gv-button small link class="action" icon="layout:layout-top-panel-6" title="Maximize bottom" @gv-button:click="${this.maximizeBottom}"></gv-button></div></div><div class="bottom"><slot name="bottom"></slot></div></div>`}static get styles(){return[t.css`.box{display:flex;height:100%;flex:1 1 0;flex-direction:column}:host([direction=horizontal]) .box{flex-direction:row}:host([direction=horizontal]) .layout-icon{display:none}*{box-sizing:border-box}::slotted(*){display:inline-block;width:100%}.no-overflow ::slotted(*){height:100%;position:relative}.bottom,.top{position:relative}.no-overflow .bottom,.no-overflow .top{overflow:hidden}.bottom{display:flex;flex-grow:1}.left{width:70%}.left,.right{padding:.2rem;overflow:auto}.bottom,.top{border-left:1px solid #bfbfbf;border-right:1px solid #bfbfbf;height:100%}:host([direction=horizontal]) .top{border-right:0}:host([direction=horizontal]) .bottom{border-left:0}.transition .bottom,.transition .top{transition:height 350ms ease-in-out}.top{overflow-y:auto;overflow-x:hidden;height:50%}.bottom{overflow-y:auto;overflow-x:hidden;height:50%}:host([direction=horizontal]) .bottom,:host([direction=horizontal]) .top{height:100%;width:50%}.resizer{z-index:10;background-color:#d9d9d9;--gv-icon--s:20px;display:flex;align-items:center;justify-content:flex-end;--gv-icon--c:#28444f;transition:all .2s ease-in-out;position:relative}.resizer.drag{border-width:4px 0;border-style:double;border-color:#d9d9d9;background-color:#fff}.resizer .actions,.resizer gv-icon{transition:all .2s ease-in-out}.resizer.drag .actions,.resizer.drag gv-icon{visibility:hidden;opacity:0}:host([direction=horizontal]) .resizer.drag{border-width:0 4px}.resizer>gv-icon{position:absolute}:host([direction=horizontal]) .resizer{align-items:flex-start}:host([direction=vertical]) .resizer gv-icon{right:45px}:host([direction=horizontal]) .resizer gv-icon{left:-9px;top:45px}.resizer[data-direction=vertical]{cursor:ns-resize;height:2px;width:100%}.resizer[data-direction=horizontal]{cursor:ew-resize;height:100%;width:2px}.actions{margin-top:-22px;margin-right:15px;padding:0 .2rem;border-radius:4px 4px 0 0;background-color:#d9d9d9}.actions gv-button{margin:.2rem .1rem;visibility:hidden;opacity:0;display:none;transition:all 250ms ease-in-out}.actions:focus-within,.actions:hover{padding:.2rem;margin-top:-66px}.actions:focus-within gv-button,.actions:hover gv-button{display:block;opacity:1;visibility:visible}.actions:focus-within gv-icon,.actions:hover gv-icon{display:none;opacity:0;visibility:hidden}`]}}exports.GvResizableViews=i,window.customElements.define("gv-resizable-views",i);
|
|
@@ -1 +0,0 @@
|
|
|
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);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvSchemaFormArray=void 0;const e=require("lit"),t=require("../lib/schema-form"),r=require("../lib/events"),o=require("lit/directives/class-map"),s=require("../styles/skeleton"),i=require("../mixins/update-after-browser");class l extends((0,i.UpdateAfterBrowser)(e.LitElement)){static get properties(){return{schema:{type:Object},value:{type:Array},id:{type:String,reflect:!0},title:{type:String,reflect:!0},description:{type:String},skeleton:{type:Boolean,reflect:!0},errors:{type:Array},readonly:{type:Boolean,reflect:!0}}}constructor(){super(),this.value=[]}_onNew(){const e="object"===this.schema.type?{}:"";this.value=[...this.value,e],(0,r.dispatchCustomEvent)(this,"input",this.value)}_onRemove(e){this.value.splice(e,1,null),this.value=this.value.filter((e=>null!=e)),(0,r.dispatchCustomEvent)(this,"input",this.value)}_renderValue(r,s){const i=this.schema.required,l=this.schema.disabled,a=`${this.id}.${s}`,n={...this.schema,title:null},m=(0,t.canInline)(this.schema),c={form__item:!0,form__item_cards:!m};return e.html`<div class="${(0,o.classMap)(c)}" @mouseleave="${this._onMouseLeave}">${m?"":e.html`<div class="${(0,o.classMap)({"form__item-label":!0,skeleton:this.skeleton})}"><label>${this.schema.title}</label> ${!0!==this.readonly?e.html`<gv-button link small @gv-button:click="${this._onRemove.bind(this,s)}" icon="general:close" title="Remove"></gv-button>`:""}</div>`}<div class="form__item_entry"><gv-schema-form-control .id="${a}" .skeleton="${this.skeleton}" .control="${n}" .value="${r}" ?required="${i}" ?disabled="${l}" ?readonly="${this.readonly}" compact="compact"></gv-schema-form-control>${m?e.html`<gv-button link small @gv-button:click="${this._onRemove.bind(this,s)}" icon="general:close" title="Remove"></gv-button>`:""}</div></div>`}_onMouseLeave(){this.shadowRoot.querySelectorAll("gv-select").forEach((e=>e.close()))}getControls(){return[...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control")),...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control-array")),...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control-object"))]}getControl(e){return this.shadowRoot.querySelector(`[id="${e}"]`)}async getUpdateComplete(){await super.getUpdateComplete(),await Promise.all(this.getControls().map((e=>e.updateComplete)))}shouldUpdate(e){return e.has("errors")&&this.getControls().forEach((e=>{e.errors=this.errors})),super.shouldUpdate(e)}render(){if(null==this.schema)return e.html``;const t=null==this.schema["x-schema-form"]||!1!==this.schema["x-schema-form"].open;return e.html`<gv-expandable class="form__control-array" ?open="${t}"><div slot="summary" class="form__item-group-header"><div class="form__item-group-title"><label><span>${this.title||this.id}</span><span class="form__item-length">(${this.value.length})</span></label> ${this.description?e.html`<div class="description">${this.description}</div>`:""}</div>${!0!==this.readonly?e.html`<gv-button outlined small icon="code:plus" @gv-button:click="${this._onNew}">New ${this.schema.title}</gv-button>`:""}</div><div class="form__item-group" id="${this.id}" slot="details">${null!=this.value&&Array.isArray(this.value)?this.value.map(((e,t)=>this._renderValue(e,t))):""}</div></gv-expandable>`}static get styles(){return[s.skeleton,e.css`.form__item-length{font-size:12px;color:#bfbfbf;margin:0 .2rem}.form__item-group{position:relative;transition:all .3s ease-in-out}.form__item_cards form__item-group:hover{background-color:#efefef}.form__item-group-header{display:flex;flex:1;align-items:center;transition:all .3s ease-in-out;background-color:var(--gv-schema-form--bgc,#fff)}.form__item-group-header label{flex:1;margin:0}.form__item-group-title{display:flex;flex-direction:column;flex:1}.description{opacity:.6;font-size:var(--gv-theme-font-size-s,12px)}.form__item_cards{border:1px solid #d9d9d9;border-radius:4px;margin:.5rem;background-color:#fff;transition:all .3s ease-in-out;z-index:50}.form__item_cards:hover{transform:translateY(-2px);box-shadow:0 10px 20px -10px #bfbfbf;z-index:60}.form__item_entry{display:flex}.form__item_entry gv-schema-form-control{flex:1}.form__item-label{font-style:italic;display:flex;flex-direction:row;border-bottom:1px solid #d9d9d9;padding:.5rem}.form__item-label>label{flex:1}.form__item .form_control-inline>*{margin-left:0}.form__item .form_control-inline>:first-child{margin-left:.5rem}`]}}exports.GvSchemaFormArray=l,window.customElements.define("gv-schema-form-array",l);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvSchemaFormControlObject=void 0;const e=require("lit"),t=require("../lib/schema-form"),r=require("lit/directives/class-map"),o=require("../styles/skeleton");require("../molecules/gv-expandable");const s=require("../mixins/update-after-browser");class l extends((0,s.UpdateAfterBrowser)(e.LitElement)){static get properties(){return{schema:{type:Object},value:{type:Object,reflect:!0},id:{type:String,reflect:!0},title:{type:String,reflect:!0},errors:{type:Array},skeleton:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},hidden:{type:Boolean,reflect:!0},compact:{type:Boolean}}}constructor(){super(),this.value=[]}_renderPart(t){const r=this.required||this.schema.required&&this.schema.required.includes(t),o=this.disabled||this.schema.disabled&&this.schema.disabled.includes(t),s=null!=this.id?`${this.id}.${t}`:t,l={...this.schema.properties[t]},i=null!=this.value?this.value[t]:null;return e.html`<gv-schema-form-control .id="${s}" .control="${l}" .value="${i}" .skeleton="${this.skeleton}" ?required="${r}" ?disabled="${o}" ?readonly="${this.readonly}" ?hidden="${this.hidden}" class="control" ?compact="${this.compact}"></gv-schema-form-control>`}getControls(){return[...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control")),...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control-array")),...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control-object"))]}getControl(e){return this.shadowRoot.querySelector(`[id="${e}"]`)}async getUpdateComplete(){await super.getUpdateComplete(),await Promise.all(this.getControls().map((e=>e.updateComplete)))}shouldUpdate(e){return e.has("errors")&&this.getControls().forEach((e=>{e.errors=this.errors})),super.shouldUpdate(e)}render(){const o=Object.keys(this.schema.properties),s=(0,t.canGrid)(this.schema),l={"form_control-inline":(0,t.canInline)(this.schema),"form_control-grid":s,"form_control-grid-odd":s&&o.length%2!=0},i={"form__control-group-title":!0,skeleton:this.skeleton},a=o.map((e=>this._renderPart(e)));if(this.title){const t=null==this.schema["x-schema-form"]||!1!==this.schema["x-schema-form"].open;return e.html`<gv-expandable ?open="${t}"><div slot="summary" class="${(0,r.classMap)(i)}" title="${this.title}">${this.title}</div><div slot="details" class="${(0,r.classMap)(l)}">${a}</div></gv-expandable>`}return e.html`<div class="${(0,r.classMap)(l)}">${a}</div>`}static get styles(){return[o.skeleton,e.css`.form__control-group-title{padding:.5rem 0}.form_control-grid,.form_control-inline{display:grid;grid-template-columns:repeat(2,1fr)}.form_control-grid-odd :first-child{grid-column:1/3}.form_control-inline>*{--gv-schema-form-control--m:0 0.2rem 0 0;overflow:auto}.form_control-inline>:last-child{--gv-schema-form-control--m:0 0 0 0.2rem}`]}}exports.GvSchemaFormControlObject=l,window.customElements.define("gv-schema-form-control-object",l);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvSchemaFormControl=void 0;const e=require("lit"),t=require("../lib/events");require("../atoms/gv-input"),require("../atoms/gv-input-message"),require("../atoms/gv-text"),require("../atoms/gv-select"),require("../atoms/gv-select-native"),require("../atoms/gv-switch"),require("../molecules/gv-code"),require("../molecules/gv-expression-language"),require("../molecules/gv-cron-editor"),require("../atoms/gv-autocomplete"),require("../organisms/gv-schema-form-array"),require("../organisms/gv-schema-form-control-object");const r=require("../lib/schema-form"),o=require("../mixins/update-after-browser");class s extends((0,o.UpdateAfterBrowser)(e.LitElement)){static get properties(){return{type:{type:String},id:{type:String,reflect:!0},name:{type:String,reflect:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},title:{type:String,reflect:!0},pattern:{type:String},control:{type:Object},errors:{type:Array},value:{type:Object,reflect:!0},skeleton:{type:Boolean,reflect:!0},hidden:{type:Boolean,reflect:!0},writeOnly:{type:Boolean,reflect:!0},compact:{type:Boolean}}}constructor(){super(),this._observedProperties=["disabled","readonly","required"]}isExpressionLanguage(){return this.control["x-schema-form"]&&null!=this.control["x-schema-form"]["expression-language"]}isCronExpression(){return this.control["x-schema-form"]&&!0===this.control["x-schema-form"]["cron-expression"]}isPassword(){return!0===this.control.writeOnly||this.control["x-schema-form"]&&null!=this.control["x-schema-form"].type&&"password"===this.control["x-schema-form"].type}getPlaceholder(){return this.control["x-schema-form"]&&this.control["x-schema-form"].placeholder?this.control["x-schema-form"].placeholder:null}isCodemirror(){return(0,r.isCodemirror)(this.control)}isObject(){return(0,r.isObject)(this.control)}isAutocomplete(){return this.control["x-schema-form"]&&null!=this.control["x-schema-form"].event&&"string"===this.control.type}isText(){return this.control["x-schema-form"]&&"text"===this.control["x-schema-form"].type&&"string"===this.control.type}getElementName(){return this.isObject()?"gv-schema-form-control-object":(this.control.enum||this.control.items&&this.control.items.enum)&&!this.isAutocomplete()?"array"===this.control.type?"gv-select":"gv-select-native":(0,r.isComplexArray)(this.control)?"gv-schema-form-array":"array"===this.control.type?"gv-button":"boolean"===this.control.type?"gv-switch":this.isExpressionLanguage()?"gv-expression-language":this.isCodemirror()?"gv-code":this.isCronExpression()?"gv-cron-editor":this.isText()?"gv-text":"gv-input"}_updateProperties(e){null!=e&&this._observedProperties.forEach((t=>{null!=this[t]&&(e[t]=this[t])}))}_renderControl(){const e=this.getElementName(),o=document.createElement(e);if(o.id=this.id,o.name=this.id,o.skeleton=this.skeleton,o.classList.add("form__control"),null==this.value&&null!=this.control.default&&(this.value=this.control.default,(0,t.dispatchCustomEvent)(this,"default-value",{value:this.value,currentTarget:o,control:this.control})),null!=this.value&&this._setValue(o),"object"===this.control.type?o.schema=this.control:(0,r.isComplexArray)(this.control)&&(o.schema=this.control.items),this._updateProperties(o),this.control.title)o.label=this.control.title,o.title=this.control.title;else{const e=this.id.split("."),t=e[e.length-1];isNaN(parseInt(t,10))&&(o.label=t,o.title=t)}this.control.pattern&&(o.pattern=this.control.pattern),"integer"===this.control.type&&(o.type="number"),this.isText()&&(o.rows=3,o.autosize=!0,o.placeholder=this.control.description);const s=this.getPlaceholder();if(this.control.enum||this.control.items&&this.control.items.enum){const e=this.control.enum||this.control.items.enum;this.control["x-schema-form"]&&this.control["x-schema-form"].titleMap?o.options=e.map((e=>({value:e,label:this.control["x-schema-form"].titleMap[e]||e}))):o.options=e,"array"===this.control.type&&(o.multiple=!0)}else this.isCodemirror()?(o.options=this.control["x-schema-form"].codemirrorOptions,null!=this.control.default&&null==o.options.value&&(o.options.value=this.control.default)):this.isExpressionLanguage()?(o.options={},o.rows=1):this.isPassword()&&(o.type="password");let i;if(this.control.description&&(o.description=this.control.description),this.compact&&(o.placeholder=o.description||o.label,o.label=null,o.description=null,o.compact=this.compact),null!=s&&(this.isExpressionLanguage()||this.isCodemirror()?o.options.placeholder=s:o.placeholder=s),o.addEventListener(`${e}:input`,this._onInput.bind(this)),this.isAutocomplete()){const e=document.createElement("gv-autocomplete");e.minChars=0,e.filter=!0,o.clearable=!0,e.id=this.id,e.appendChild(o),e.addEventListener("gv-autocomplete:select",this._onInput.bind(this)),o.addEventListener("gv-input:clear",this._onInput.bind(this)),i=e}else i=o;return null!=this.control["x-schema-form"]&&(0,t.dispatchCustomEvent)(this,"control-ready",{currentTarget:i,control:this}),i}_onInput(e){e.preventDefault(),e.stopPropagation();let r=null;r="GV-AUTOCOMPLETE"===e.target.tagName?e.detail.value:e.detail,(0,t.dispatchCustomEvent)(this,"change",{value:r,currentTarget:e.target,control:this.control})}getControls(){return[...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control")),...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control-array")),...Array.from(this.shadowRoot.querySelectorAll("gv-schema-form-control-object"))]}getControl(e){return null==e&&(e=this.id),this.shadowRoot.querySelector(`[id="${e}"]`)}_setValue(e){return null!=this.value&&null!=e&&("boolean"===this.control.type||"array"===this.control.type||"object"===this.control.type?e.value=this.value:e.value=this.value.toString?this.value.toString():this.value),e}async updated(e){e.has("value")&&Promise.all(this.getControls().map((e=>e.updateComplete))).then((()=>{this._setValue(this.getControl())}))}async getUpdateComplete(){await super.getUpdateComplete(),await Promise.all(this.getControls().map((e=>e.updateComplete)))}formatErrorMessage(e){let t;return t=null!=this.control.properties&&null!=this.control.properties[e.argument]?this.control.properties[e.argument].title:this.control.title,t?`<span>${e.message.replace(e.argument,t)}</span>`:`<span>${e.message}</span>`}shouldUpdate(e){if(null!=this._observedProperties.find((t=>e.has(t)))&&this._updateProperties(this.getControl()),e.has("errors")&&null!=this.errors){this.getControls().forEach((e=>{e.errors=this.errors}));return this.shadowRoot.querySelectorAll(".form__control-error").forEach((e=>e.innerHTML="")),this.errors.forEach((e=>{const t="instance"===e.property?e.argument:e.property.replace("instance.",""),r=this.shadowRoot.querySelector(`[id="${t}-error"]`);if(r){const t=document.createElement("gv-input-message");t.innerHTML=this.formatErrorMessage(e),t.level="warn",r.appendChild(t)}})),!1}return super.shouldUpdate(e)}render(){return e.html`${this._renderControl()}<div class="form__control-error" id="${this.id+"-error"}"></div>`}static get styles(){return[e.css`:host{box-sizing:border-box;margin:var(--gv-schema-form-control--m,.4rem);display:block}:host([hidden]){visibility:hidden;height:0;margin:0;padding:0;overflow:hidden}.form__control-description,.form__control-error{font-size:12px}.form__control-description{opacity:.8}.form__control-label{display:flex;flex-direction:row;border-bottom:1px solid #d9d9d9}label{margin:.2rem}.form__control-label label{flex:1;text-transform:capitalize}.form__control-array,.form__control-object{display:flex;flex-direction:column}.form__control-enum{display:flex}.form__control-array gv-button{align-self:flex-end}.form__control{position:relative}gv-code,gv-expression-language,gv-input,gv-select,gv-select-native,gv-switch{width:100%;margin:.2rem 0}gv-autocomplete:hover,gv-select-native:hover,gv-select:hover{z-index:70}.error{color:var(--gv-theme-color-error,#f44336)}.warning{color:var(--gv-theme-color-warning,#ff9800)}`]}}exports.GvSchemaFormControl=s,window.customElements.define("gv-schema-form-control",s);
|