@schukai/monster 3.54.0 → 3.55.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +25 -0
- package/package.json +1 -1
- package/source/components/datatable/datasource/rest.mjs +93 -57
- package/source/components/datatable/datatable/header.mjs +8 -0
- package/source/components/datatable/datatable.mjs +88 -44
- package/source/components/datatable/embedded-pagination.mjs +24 -43
- package/source/components/datatable/filter/util.mjs +138 -0
- package/source/components/datatable/filter.mjs +418 -174
- package/source/components/datatable/pagination.mjs +26 -2
- package/source/components/datatable/status.mjs +226 -0
- package/source/components/datatable/style/datatable.pcss +1 -0
- package/source/components/datatable/style/embedded-pagination.pcss +59 -2
- package/source/components/datatable/style/filter.pcss +4 -0
- package/source/components/datatable/style/pagination.pcss +28 -4
- package/source/components/datatable/style/status.pcss +42 -0
- package/source/components/datatable/stylesheet/column-bar.mjs +15 -9
- package/source/components/datatable/stylesheet/dataset.mjs +14 -8
- package/source/components/datatable/stylesheet/datasource.mjs +14 -8
- package/source/components/datatable/stylesheet/datatable.mjs +15 -9
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-button.mjs +15 -9
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-date-range.mjs +14 -8
- package/source/components/datatable/stylesheet/filter-range.mjs +14 -8
- package/source/components/datatable/stylesheet/filter.mjs +15 -9
- package/source/components/datatable/stylesheet/pagination.mjs +15 -9
- package/source/components/datatable/stylesheet/select-filter.mjs +14 -8
- package/source/components/datatable/stylesheet/status.mjs +33 -0
- package/source/components/form/action-button.mjs +3 -1
- package/source/components/form/api-button.mjs +1 -1
- package/source/components/form/button-bar.mjs +1 -1
- package/source/components/form/button.mjs +1 -1
- package/source/components/form/confirm-button.mjs +3 -1
- package/source/components/form/context-error.mjs +272 -0
- package/source/components/form/context-help.mjs +7 -5
- package/source/components/form/form.mjs +4 -2
- package/source/components/form/message-state-button.mjs +4 -2
- package/source/components/form/popper-button.mjs +9 -4
- package/source/components/form/popper.mjs +11 -3
- package/source/components/form/reload.mjs +1 -1
- package/source/components/form/select.mjs +3 -3
- package/source/components/form/shadow-reload.mjs +1 -1
- package/source/components/form/state-button.mjs +4 -1
- package/source/components/form/style/context-error.pcss +32 -0
- package/source/components/form/style/context-help.pcss +22 -5
- package/source/components/form/stylesheet/action-button.mjs +14 -8
- package/source/components/form/stylesheet/api-button.mjs +14 -8
- package/source/components/form/stylesheet/button-bar.mjs +14 -8
- package/source/components/form/stylesheet/button.mjs +14 -8
- package/source/components/form/stylesheet/confirm-button.mjs +14 -8
- package/source/components/form/stylesheet/context-error.mjs +33 -0
- package/source/components/form/stylesheet/context-help.mjs +15 -9
- package/source/components/form/stylesheet/form.mjs +14 -8
- package/source/components/form/stylesheet/message-state-button.mjs +14 -8
- package/source/components/form/stylesheet/popper-button.mjs +14 -8
- package/source/components/form/stylesheet/popper.mjs +14 -8
- package/source/components/form/stylesheet/select.mjs +15 -9
- package/source/components/form/stylesheet/state-button.mjs +14 -8
- package/source/components/form/stylesheet/tabs.mjs +15 -9
- package/source/components/form/stylesheet/tree-select.mjs +14 -8
- package/source/components/form/tabs.mjs +53 -7
- package/source/components/form/template.mjs +1 -1
- package/source/components/form/tree-select.mjs +1 -1
- package/source/components/host/collapse.mjs +20 -5
- package/source/components/host/config-manager.mjs +41 -2
- package/source/components/host/host.mjs +14 -0
- package/source/components/host/stylesheet/call-button.mjs +15 -9
- package/source/components/host/stylesheet/collapse.mjs +14 -8
- package/source/components/host/stylesheet/config-manager.mjs +14 -8
- package/source/components/host/stylesheet/details.mjs +14 -8
- package/source/components/host/stylesheet/host.mjs +14 -8
- package/source/components/host/stylesheet/overlay.mjs +15 -9
- package/source/components/host/stylesheet/toggle-button.mjs +15 -9
- package/source/components/host/stylesheet/viewer.mjs +14 -8
- package/source/components/host/util.mjs +6 -1
- package/source/components/notify/stylesheet/message.mjs +15 -9
- package/source/components/notify/stylesheet/notify.mjs +14 -8
- package/source/components/state/stylesheet/log.mjs +14 -8
- package/source/components/state/stylesheet/state.mjs +14 -8
- package/source/components/stylesheet/badge.mjs +14 -8
- package/source/components/stylesheet/border.mjs +14 -8
- package/source/components/stylesheet/button.mjs +14 -8
- package/source/components/stylesheet/card.mjs +14 -8
- package/source/components/stylesheet/color.mjs +14 -8
- package/source/components/stylesheet/common.mjs +14 -8
- package/source/components/stylesheet/control.mjs +14 -8
- package/source/components/stylesheet/data-grid.mjs +14 -8
- package/source/components/stylesheet/display.mjs +14 -8
- package/source/components/stylesheet/floating-ui.mjs +14 -8
- package/source/components/stylesheet/form.mjs +14 -8
- package/source/components/stylesheet/host.mjs +14 -8
- package/source/components/stylesheet/icons.mjs +15 -9
- package/source/components/stylesheet/link.mjs +14 -8
- package/source/components/stylesheet/normalize.mjs +14 -8
- package/source/components/stylesheet/popper.mjs +14 -8
- package/source/components/stylesheet/property.mjs +14 -8
- package/source/components/stylesheet/ripple.mjs +14 -8
- package/source/components/stylesheet/skeleton.mjs +14 -8
- package/source/components/stylesheet/space.mjs +14 -8
- package/source/components/stylesheet/spinner.mjs +14 -8
- package/source/components/stylesheet/table.mjs +14 -8
- package/source/components/stylesheet/theme.mjs +14 -8
- package/source/components/stylesheet/typography.mjs +14 -8
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +14 -8
- package/source/data/transformer.mjs +38 -43
- package/source/dom/attributes.mjs +5 -5
- package/source/dom/customelement.mjs +1 -1
- package/source/dom/updater.mjs +14 -5
- package/source/dom/util.mjs +42 -0
- package/source/i18n/providers/embed.mjs +3 -3
- package/source/monster.mjs +5 -0
- package/source/text/formatter.mjs +2 -2
- package/source/types/noderecursiveiterator.mjs +9 -7
- package/source/types/observer.mjs +1 -1
- package/source/types/version.mjs +1 -1
- package/source/util/sleep.mjs +17 -0
- package/test/cases/components/form/button.mjs +2 -1
- package/test/cases/components/form/select.mjs +1 -1
- package/test/cases/components/form/tree-select.mjs +1 -1
- package/test/cases/data/transformer.mjs +2 -2
- package/test/cases/dom/updater.mjs +67 -46
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +18 -13
@@ -0,0 +1,33 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright schukai GmbH and contributors 2024. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { addAttributeToken } from "../../../dom/attributes.mjs";
|
9
|
+
import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";
|
10
|
+
|
11
|
+
export { StatusStyleSheet };
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @private
|
15
|
+
* @type {CSSStyleSheet}
|
16
|
+
*/
|
17
|
+
const StatusStyleSheet = new CSSStyleSheet();
|
18
|
+
|
19
|
+
try {
|
20
|
+
StatusStyleSheet.insertRule(
|
21
|
+
`
|
22
|
+
@layer status {
|
23
|
+
:where(html){line-height:1.15}:where(h1){font-size:2em;margin-block-end:.67em;margin-block-start:.67em}:where(dl,ol,ul) :where(dl,ol,ul){margin-block-end:0;margin-block-start:0}:where(hr){box-sizing:content-box;color:inherit;height:0}:where(pre){font-family:monospace,monospace;font-size:1em}:where(abbr[title]){text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}:where(b,strong){font-weight:bolder}:where(code,kbd,samp){font-family:monospace,monospace;font-size:1em}:where(small){font-size:80%}:where(table){border-color:currentColor;text-indent:0}:where(button,input,select){margin:0}:where(button){text-transform:none}:where(button,input:is([type=button i],[type=reset i],[type=submit i])){-webkit-appearance:button}:where(progress){vertical-align:baseline}:where(select){text-transform:none}:where(textarea){margin:0}:where(input[type=search i]){-webkit-appearance:textfield;outline-offset:-2px}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}:where(button,input:is([type=button i],[type=color i],[type=reset i],[type=submit i]))::-moz-focus-inner{border-style:none;padding:0}:where(button,input:is([type=button i],[type=color i],[type=reset i],[type=submit i]))::-moz-focusring{outline:1px dotted ButtonText}:where(:-moz-ui-invalid){box-shadow:none}:where(dialog){background-color:#fff;border:solid;color:#000;height:-moz-fit-content;height:fit-content;left:0;margin:auto;padding:1em;position:absolute;right:0;width:-moz-fit-content;width:fit-content}:where(dialog:not([open])){display:none}:where(summary){display:list-item}html{height:100%;min-height:100%}body{box-sizing:border-box;margin:0;min-height:99%;padding:0;word-break:break-word}.block{display:block}.inline{display:inline}.inline-block{display:inline-block}.grid{display:grid}.inline-grid{display:inline-grid}.flex{display:flex}.inline-flex{display:inline-flex}.hidden,.hide,.none{display:none}.visible{visibility:visible}.invisible{visibility:hidden}.monster-button-primary,button{align-items:center;background-position:50%;border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);cursor:pointer;display:flex;font-family:var(--monster-font-family);font-size:1rem;font-weight:400;gap:.4rem;justify-content:center;line-height:1.5;outline:none;overflow:hidden;padding:.375rem .75rem;position:relative;text-align:center;text-decoration:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:-webkit-fill-available;width:-moz-available;width:stretch}.monster-button-primary{background-color:var(--monster-bg-color-primary-4);border-color:var(--monster-bg-color-primary-4);color:var(--monster-color-primary-4)}.monster-button-secondary{background-color:var(--monster-bg-color-secondary-4);border-color:var(--monster-bg-color-secondary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);color:var(--monster-color-secondary-4)}.monster-button-secondary,.monster-button-tertiary{align-items:center;background-position:50%;box-shadow:var(--monster-box-shadow-1);cursor:pointer;display:flex;font-family:var(--monster-font-family);font-size:1rem;font-weight:400;gap:.4rem;justify-content:center;line-height:1.5;outline:none;overflow:hidden;padding:.375rem .75rem;position:relative;text-align:center;text-decoration:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:-webkit-fill-available;width:-moz-available;width:stretch}.monster-button-tertiary{background-color:var(--monster-bg-color-tertiary-4);border-color:var(--monster-bg-color-tertiary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);color:var(--monster-color-tertiary-4)}.monster-button-outline-primary{background-color:var(--monster-color-primary-4);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);color:var(--monster-bg-color-primary-4)}.monster-button-outline-primary,.monster-button-outline-secondary{align-items:center;background-position:50%;box-shadow:var(--monster-box-shadow-1);cursor:pointer;display:flex;font-family:var(--monster-font-family);font-size:1rem;font-weight:400;gap:.4rem;justify-content:center;line-height:1.5;outline:none;overflow:hidden;padding:.375rem .75rem;position:relative;text-align:center;text-decoration:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:-webkit-fill-available;width:-moz-available;width:stretch}.monster-button-outline-secondary{background-color:var(--monster-color-secondary-4);border-color:var(--monster-bg-color-secondary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);color:var(--monster-bg-color-secondary-4)}.monster-button-outline-tertiary{align-items:center;background-color:var(--monster-color-tertiary-4);background-position:50%;border-color:var(--monster-bg-color-tertiary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);color:var(--monster-bg-color-tertiary-4);cursor:pointer;display:flex;font-family:var(--monster-font-family);font-size:1rem;font-weight:400;gap:.4rem;justify-content:center;line-height:1.5;outline:none;overflow:hidden;padding:.375rem .75rem;position:relative;text-align:center;text-decoration:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:-webkit-fill-available;width:-moz-available;width:stretch}button:active,button:hover{box-shadow:var(--monster-box-shadow-2);transition:background .8s,color .25s .0833333333s}button:active{z-index:var(--monster-z-index-outline)}.monster-button-bar,.monster-button-group{align-content:center;align-items:stretch;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.monster-button-group{box-sizing:border-box;gap:0;margin:1rem 0}.monster-button-group>:not(:last-child){margin-right:calc(var(--monster-border-width)*-1)}.monster-button-group :hover{box-shadow:none}button:focus{outline:1px dashed var(--monster-color-selection-4);outline-offset:2px;z-index:var(--monster-z-index-outline)}@media (prefers-color-scheme:light){button:focus{outline:1px dashed var(--monster-color-selection-3);outline-offset:2px;z-index:var(--monster-z-index-outline)}}[data-monster-role=control]{outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}:after,:before,:root{--monster-font-family:-apple-system,BlinkMacSystemFont,\"Quicksand\",\"Segoe UI\",\"Roboto\",\"Oxygen\",\"Ubuntu\",\"Cantarell\",\"Fira Sans\",\"Droid Sans\",\"Helvetica Neue\",Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";--monster-color-primary-1:var(--monster-color-gray-6);--monster-color-primary-2:var(--monster-color-gray-6);--monster-color-primary-3:var(--monster-color-gray-1);--monster-color-primary-4:var(--monster-color-gray-1);--monster-bg-color-primary-1:var(--monster-color-gray-1);--monster-bg-color-primary-2:var(--monster-color-gray-2);--monster-bg-color-primary-3:var(--monster-color-gray-3);--monster-bg-color-primary-4:var(--monster-color-gray-6);--monster-color-secondary-1:var(--monster-color-red-4);--monster-color-secondary-2:var(--monster-color-red-4);--monster-color-secondary-3:var(--monster-color-red-1);--monster-color-secondary-4:var(--monster-color-red-1);--monster-bg-color-secondary-1:var(--monster-color-gray-1);--monster-bg-color-secondary-2:var(--monster-color-red-2);--monster-bg-color-secondary-3:var(--monster-color-red-3);--monster-bg-color-secondary-4:var(--monster-color-red-6);--monster-color-tertiary-1:var(--monster-color-magenta-4);--monster-color-tertiary-2:var(--monster-color-magenta-4);--monster-color-tertiary-3:var(--monster-color-magenta-6);--monster-color-tertiary-4:var(--monster-color-magenta-1);--monster-bg-color-tertiary-1:var(--monster-color-gray-1);--monster-bg-color-tertiary-2:var(--monster-color-magenta-1);--monster-bg-color-tertiary-3:var(--monster-color-magenta-2);--monster-bg-color-tertiary-4:var(--monster-color-magenta-6);--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-4);--monster-color-destructive-3:var(--monster-color-red-6);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-4);--monster-bg-color-destructive-2:var(--monster-color-gray-1);--monster-bg-color-destructive-3:var(--monster-color-red-2);--monster-bg-color-destructive-4:var(--monster-color-red-5);--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-4);--monster-color-success-3:var(--monster-color-green-6);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-3);--monster-bg-color-success-2:var(--monster-color-gray-1);--monster-bg-color-success-3:var(--monster-color-green-2);--monster-bg-color-success-4:var(--monster-color-green-5);--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-4);--monster-color-warning-3:var(--monster-color-orange-6);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-3);--monster-bg-color-warning-2:var(--monster-color-gray-1);--monster-bg-color-warning-3:var(--monster-color-orange-2);--monster-bg-color-warning-4:var(--monster-color-orange-5);--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-4);--monster-color-error-3:var(--monster-color-red-6);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-4);--monster-bg-color-error-2:var(--monster-color-gray-1);--monster-bg-color-error-3:var(--monster-color-red-2);--monster-bg-color-error-4:var(--monster-color-red-5);--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6);--monster-color-primary-disabled-1:var(--monster-color-gray-3);--monster-color-primary-disabled-2:var(--monster-color-gray-1);--monster-color-primary-disabled-3:var(--monster-color-gray-4);--monster-color-primary-disabled-4:var(--monster-color-gray-4);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-1);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-6);--monster-color-gradient-1:#833ab4;--monster-color-gradient-2:#fd1d1d;--monster-color-gradient-3:#fcb045;--monster-box-shadow-1:none;--monster-box-shadow-2:-1px 1px 10px 1px hsla(0,0%,76%,.61);--monster-text-shadow:none;--monster-border-style:solid;--monster-border-width:2px;--monster-border-radius:0;--monster-popper-witharrrow-distance:-4px;--monster-z-index-default:0;--monster-z-index-outline:10;--monster-z-index-dropdown:200;--monster-z-index-dropdown-overlay:210;--monster-z-index-sticky:300;--monster-z-index-sticky-overlay:310;--monster-z-index-fixed:400;--monster-z-index-fixed-overlay:410;--monster-z-index-modal-backdrop:500;--monster-z-index-modal-backdrop-overlay:510;--monster-z-index-offcanvas:600;--monster-z-index-offcanvas-overlay:610;--monster-z-index-modal:700;--monster-z-index-modal-overlay:710;--monster-z-index-popover:800;--monster-z-index-popover-overlay:810;--monster-z-index-tooltip:800;--monster-z-index-tooltip-overlay:910;--monster-space-0:0;--monster-space-1:2px;--monster-space-2:4px;--monster-space-3:6px;--monster-space-4:10px;--monster-space-5:16px;--monster-space-6:26px;--monster-space-7:42px;--monster-breakpoint-0:480px;--monster-breakpoint-4:480px;--monster-breakpoint-7:768px;--monster-breakpoint-9:992px;--monster-breakpoint-12:1200px}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-1:var(--monster-color-gray-1);--monster-color-primary-2:var(--monster-color-gray-1);--monster-color-primary-3:var(--monster-color-gray-6);--monster-color-primary-4:var(--monster-color-gray-6);--monster-bg-color-primary-1:var(--monster-color-gray-6);--monster-bg-color-primary-2:var(--monster-color-gray-3);--monster-bg-color-primary-3:var(--monster-color-gray-2);--monster-bg-color-primary-4:var(--monster-color-gray-1);--monster-color-secondary-1:var(--monster-color-red-1);--monster-color-secondary-2:var(--monster-color-red-1);--monster-color-secondary-3:var(--monster-color-red-6);--monster-color-secondary-4:var(--monster-color-red-4);--monster-bg-color-secondary-1:var(--monster-color-gray-6);--monster-bg-color-secondary-2:var(--monster-color-red-3);--monster-bg-color-secondary-3:var(--monster-color-red-2);--monster-bg-color-secondary-4:var(--monster-color-red-1);--monster-color-tertiary-1:var(--monster-color-magenta-1);--monster-color-tertiary-2:var(--monster-color-magenta-6);--monster-color-tertiary-3:var(--monster-color-magenta-4);--monster-color-tertiary-4:var(--monster-color-magenta-4);--monster-bg-color-tertiary-1:var(--monster-color-gray-6);--monster-bg-color-tertiary-2:var(--monster-color-magenta-2);--monster-bg-color-tertiary-3:var(--monster-color-magenta-1);--monster-bg-color-tertiary-4:var(--monster-color-magenta-1);--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-3);--monster-color-destructive-3:var(--monster-color-red-4);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-5);--monster-bg-color-destructive-2:var(--monster-color-gray-6);--monster-bg-color-destructive-3:var(--monster-color-red-1);--monster-bg-color-destructive-4:var(--monster-color-red-4);--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-2);--monster-color-success-3:var(--monster-color-green-4);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-5);--monster-bg-color-success-2:var(--monster-color-gray-6);--monster-bg-color-success-3:var(--monster-color-green-1);--monster-bg-color-success-4:var(--monster-color-green-3);--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-3);--monster-color-warning-3:var(--monster-color-orange-4);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-5);--monster-bg-color-warning-2:var(--monster-color-gray-6);--monster-bg-color-warning-3:var(--monster-color-orange-1);--monster-bg-color-warning-4:var(--monster-color-orange-3);--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-3);--monster-color-error-3:var(--monster-color-red-4);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-5);--monster-bg-color-error-2:var(--monster-color-gray-6);--monster-bg-color-error-3:var(--monster-color-red-1);--monster-bg-color-error-4:var(--monster-color-red-4);--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6);--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-3);--monster-color-primary-disabled-4:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-6);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-1)}}span.monster-fx-ripple{animation:monster-fx-ripple .6s linear;background-color:hsla(0,0%,100%,.7);border-radius:50%;position:absolute;transform:scale(0)}@keyframes monster-fx-ripple{to{opacity:0;transform:scale(4)}}[data-monster-role=control]{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:center;width:-moz-fit-content;width:fit-content}[data-monster-role=control] .monster-spinner{height:1.5rem!important;visibility:hidden;width:1.5rem!important}[data-monster-role=control] [data-monster-state-loader=show]{visibility:visible}:host{align-items:center;align-self:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:center;width:-moz-fit-content;width:fit-content}
|
24
|
+
}`,
|
25
|
+
0,
|
26
|
+
);
|
27
|
+
} catch (e) {
|
28
|
+
addAttributeToken(
|
29
|
+
document.getRootNode().querySelector("html"),
|
30
|
+
ATTRIBUTE_ERRORMESSAGE,
|
31
|
+
e + "",
|
32
|
+
);
|
33
|
+
}
|
@@ -72,7 +72,9 @@ class ActionButton extends PopperButton {
|
|
72
72
|
* @returns {symbol}
|
73
73
|
*/
|
74
74
|
static get [instanceSymbol]() {
|
75
|
-
return Symbol.for(
|
75
|
+
return Symbol.for(
|
76
|
+
"@schukai/monster/components/form/action-button@@instance",
|
77
|
+
);
|
76
78
|
}
|
77
79
|
|
78
80
|
/**
|
@@ -81,7 +81,7 @@ class ApiButton extends ActionButton {
|
|
81
81
|
* @returns {symbol}
|
82
82
|
*/
|
83
83
|
static get [instanceSymbol]() {
|
84
|
-
return Symbol.for("@schukai/
|
84
|
+
return Symbol.for("@schukai/monster/components/form/api-button@@instance");
|
85
85
|
}
|
86
86
|
|
87
87
|
/**
|
@@ -153,7 +153,7 @@ class ButtonBar extends CustomElement {
|
|
153
153
|
* @returns {symbol}
|
154
154
|
*/
|
155
155
|
static get [instanceSymbol]() {
|
156
|
-
return Symbol.for("@schukai/
|
156
|
+
return Symbol.for("@schukai/monster/components/form/button-bar@@instance");
|
157
157
|
}
|
158
158
|
|
159
159
|
/**
|
@@ -89,7 +89,9 @@ class ConfirmButton extends PopperButton {
|
|
89
89
|
* @since 2.1.0
|
90
90
|
*/
|
91
91
|
static get [instanceSymbol]() {
|
92
|
-
return Symbol.for(
|
92
|
+
return Symbol.for(
|
93
|
+
"@schukai/monster/components/form/confirm-button@@instance",
|
94
|
+
);
|
93
95
|
}
|
94
96
|
|
95
97
|
/**
|
@@ -0,0 +1,272 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright schukai GmbH and contributors 2023. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
|
+
*/
|
7
|
+
import { instanceSymbol } from "../../constants.mjs";
|
8
|
+
import {
|
9
|
+
assembleMethodSymbol,
|
10
|
+
registerCustomElement,
|
11
|
+
} from "../../dom/customelement.mjs";
|
12
|
+
import { CustomControl } from "../../dom/customcontrol.mjs";
|
13
|
+
import { ContextErrorStyleSheet } from "./stylesheet/context-error.mjs";
|
14
|
+
import { ThemeStyleSheet } from "../stylesheet/theme.mjs";
|
15
|
+
import { Popper } from "./popper.mjs";
|
16
|
+
import {
|
17
|
+
ATTRIBUTE_ERRORMESSAGE,
|
18
|
+
ATTRIBUTE_ROLE,
|
19
|
+
} from "../../dom/constants.mjs";
|
20
|
+
|
21
|
+
export { ContextError };
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @private
|
25
|
+
* @type {symbol}
|
26
|
+
*/
|
27
|
+
const controlElementSymbol = Symbol("controlElement");
|
28
|
+
|
29
|
+
/**
|
30
|
+
* @private
|
31
|
+
* @type {symbol}
|
32
|
+
*/
|
33
|
+
const buttonElementSymbol = Symbol("buttonElement");
|
34
|
+
|
35
|
+
/**
|
36
|
+
* local symbol
|
37
|
+
* @private
|
38
|
+
* @type {symbol}
|
39
|
+
*/
|
40
|
+
const popperElementSymbol = Symbol("popperElement");
|
41
|
+
|
42
|
+
/**
|
43
|
+
* local symbol
|
44
|
+
* @private
|
45
|
+
* @type {symbol}
|
46
|
+
*/
|
47
|
+
const iconElementSymbol = Symbol("iconElement");
|
48
|
+
|
49
|
+
/**
|
50
|
+
* The ContextError control creates an element with a variety of options.
|
51
|
+
*
|
52
|
+
* <img src="./images/context-error.png">
|
53
|
+
*
|
54
|
+
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
|
55
|
+
* as well as [pooperjs](https://popper.js.org/docs/v2/).
|
56
|
+
*
|
57
|
+
* You can create this control either by specifying the HTML tag <monster-context-help-button />` directly in the HTML or using
|
58
|
+
* Javascript via the `document.createElement('monster-context-help');` method.
|
59
|
+
*
|
60
|
+
* ```html
|
61
|
+
* <monster-context-help></monster-context-help>
|
62
|
+
* ```
|
63
|
+
*
|
64
|
+
* Or you can create this CustomControl directly in Javascript:
|
65
|
+
*
|
66
|
+
* ```js
|
67
|
+
* import {Popper} from '@schukai/component-form/source/popper.js';
|
68
|
+
* document.createElement('monster-context-help');
|
69
|
+
* ```
|
70
|
+
*
|
71
|
+
* @startuml context-error.png
|
72
|
+
* skinparam monochrome true
|
73
|
+
* skinparam shadowing false
|
74
|
+
* HTMLElement <|-- CustomElement
|
75
|
+
* CustomElement <|-- CustomControl
|
76
|
+
* CustomControl <|-- Popper
|
77
|
+
* Popper <|-- ContextError
|
78
|
+
* @enduml
|
79
|
+
*
|
80
|
+
* @since 3.55.0
|
81
|
+
* @copyright schukai GmbH
|
82
|
+
* @memberOf Monster.Components.Form
|
83
|
+
* @summary A control that can be used to display a tooltip or a popover with an error message.
|
84
|
+
*/
|
85
|
+
class ContextError extends Popper {
|
86
|
+
/**
|
87
|
+
* This method is called by the `instanceof` operator.
|
88
|
+
* @returns {symbol}
|
89
|
+
* @since 2.1.0
|
90
|
+
*/
|
91
|
+
static get [instanceSymbol]() {
|
92
|
+
return Symbol.for(
|
93
|
+
"@schukai/monster/components/form/context-error@@instance",
|
94
|
+
);
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
*
|
99
|
+
* @return {Monster.Components.Form.PopperButton}
|
100
|
+
*/
|
101
|
+
[assembleMethodSymbol]() {
|
102
|
+
super[assembleMethodSymbol]();
|
103
|
+
initControlReferences.call(this);
|
104
|
+
|
105
|
+
if (this.hasErrorMessage()) {
|
106
|
+
this[iconElementSymbol].classList.remove("hidden");
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
112
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
113
|
+
*
|
114
|
+
* The individual configuration values can be found in the table.
|
115
|
+
*
|
116
|
+
* @property {Object} templates - The templates for the control.
|
117
|
+
* @property {string} templates.main - The main template.
|
118
|
+
* @property {string} mode - The mode of the popper. Possible values are `click`, `enter` and `hover`.
|
119
|
+
* @property {string} content - The content of the popper.
|
120
|
+
* @property {object} popper - The popper options.
|
121
|
+
* @property {string} popper.placement - The placement of the popper. Possible values are `top`, `bottom`, `left`, `right`, `auto`, `auto-start`, `auto-end`, `top-start`, `top-end`, `bottom-start`, `bottom-end`, `right-start`, `right-end`, `left-start`, `left-end`.
|
122
|
+
* @extends {CustomControl}
|
123
|
+
*/
|
124
|
+
get defaults() {
|
125
|
+
return Object.assign({}, super.defaults, {
|
126
|
+
templates: {
|
127
|
+
main: getTemplate(),
|
128
|
+
},
|
129
|
+
mode: "auto",
|
130
|
+
|
131
|
+
content: "",
|
132
|
+
|
133
|
+
classes: {
|
134
|
+
button: "monster-theme-error-2",
|
135
|
+
},
|
136
|
+
});
|
137
|
+
}
|
138
|
+
|
139
|
+
/**
|
140
|
+
*
|
141
|
+
* @return {Monster.Components.Form.Popper}
|
142
|
+
*/
|
143
|
+
showDialog() {
|
144
|
+
if (!this.hasErrorMessage()) {
|
145
|
+
return this;
|
146
|
+
}
|
147
|
+
|
148
|
+
super.showDialog();
|
149
|
+
return this;
|
150
|
+
}
|
151
|
+
|
152
|
+
/**
|
153
|
+
*
|
154
|
+
* @return {Monster.Components.Form.Popper}
|
155
|
+
*/
|
156
|
+
hideDialog() {
|
157
|
+
super.hideDialog();
|
158
|
+
return this;
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
*
|
163
|
+
* @param message
|
164
|
+
* @param show {boolean|number} - If true the dialog is shown immediately. If false the dialog is hidden by default. If a number is specified the dialog is shown for the specified time in milliseconds.
|
165
|
+
* @returns {Monster.Components.Form.ContextError}
|
166
|
+
*/
|
167
|
+
setErrorMessage(message, show = false) {
|
168
|
+
message = message.trim();
|
169
|
+
|
170
|
+
if (message === "") {
|
171
|
+
return this.resetErrorMessage();
|
172
|
+
}
|
173
|
+
|
174
|
+
this.setOption("content", message);
|
175
|
+
this[iconElementSymbol].classList.remove("hidden");
|
176
|
+
|
177
|
+
if (show === true || show === 1 || show === "true") {
|
178
|
+
this.showDialog();
|
179
|
+
return this;
|
180
|
+
}
|
181
|
+
|
182
|
+
if (show === false || show === 0 || show === "false") {
|
183
|
+
return this;
|
184
|
+
}
|
185
|
+
|
186
|
+
try {
|
187
|
+
const interval = parseInt(show);
|
188
|
+
this.showDialog();
|
189
|
+
setTimeout(() => {
|
190
|
+
this.hideDialog();
|
191
|
+
}, interval);
|
192
|
+
} catch (e) {}
|
193
|
+
|
194
|
+
return this;
|
195
|
+
}
|
196
|
+
|
197
|
+
resetErrorMessage() {
|
198
|
+
this.hideDialog();
|
199
|
+
this.setOption("content", "");
|
200
|
+
this[iconElementSymbol].classList.add("hidden");
|
201
|
+
return this;
|
202
|
+
}
|
203
|
+
|
204
|
+
hasErrorMessage() {
|
205
|
+
return this.getOption("content", "") !== "";
|
206
|
+
}
|
207
|
+
|
208
|
+
/**
|
209
|
+
* @return {string}
|
210
|
+
*/
|
211
|
+
static getTag() {
|
212
|
+
return "monster-context-error";
|
213
|
+
}
|
214
|
+
|
215
|
+
/**
|
216
|
+
* @return {Array<CSSStyleSheet>}
|
217
|
+
*/
|
218
|
+
static getCSSStyleSheet() {
|
219
|
+
return [ContextErrorStyleSheet, ThemeStyleSheet];
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
/**
|
224
|
+
* @private
|
225
|
+
* @return {Select}
|
226
|
+
*/
|
227
|
+
function initControlReferences() {
|
228
|
+
this[controlElementSymbol] = this.shadowRoot.querySelector(
|
229
|
+
`[${ATTRIBUTE_ROLE}=control]`,
|
230
|
+
);
|
231
|
+
this[buttonElementSymbol] = this.shadowRoot.querySelector(
|
232
|
+
`[${ATTRIBUTE_ROLE}=button]`,
|
233
|
+
);
|
234
|
+
this[popperElementSymbol] = this.shadowRoot.querySelector(
|
235
|
+
`[${ATTRIBUTE_ROLE}=popper]`,
|
236
|
+
);
|
237
|
+
this[iconElementSymbol] = this.shadowRoot.querySelector(
|
238
|
+
"[data-monster-role=button] svg",
|
239
|
+
);
|
240
|
+
}
|
241
|
+
|
242
|
+
/**
|
243
|
+
* @private
|
244
|
+
* @return {string}
|
245
|
+
*/
|
246
|
+
function getTemplate() {
|
247
|
+
// language=HTML
|
248
|
+
return `
|
249
|
+
<div data-monster-role="control" part="control">
|
250
|
+
|
251
|
+
<div data-monster-role="button"
|
252
|
+
data-monster-attributes="class path:classes.button"
|
253
|
+
part="button">
|
254
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" fill="currentColor" class="hidden"
|
255
|
+
viewBox="0 0 16 16">
|
256
|
+
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
|
257
|
+
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/>
|
258
|
+
</svg>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
<div data-monster-role="popper" part="popper" tabindex="-1" class="monster-color-primary-1">
|
262
|
+
<div data-monster-role="arrow"></div>
|
263
|
+
<div part="content" class="flex">
|
264
|
+
<div data-monster-replace="path:content | i18n::value"></div>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
</div>
|
269
|
+
`;
|
270
|
+
}
|
271
|
+
|
272
|
+
registerCustomElement(ContextError);
|
@@ -30,11 +30,11 @@ export { ContextHelp };
|
|
30
30
|
* Or you can create this CustomControl directly in Javascript:
|
31
31
|
*
|
32
32
|
* ```js
|
33
|
-
* import {Popper} from '@schukai/
|
33
|
+
* import {Popper} from '@schukai/monster/components/form/context-help.mjs';
|
34
34
|
* document.createElement('monster-context-help');
|
35
35
|
* ```
|
36
36
|
*
|
37
|
-
* @startuml context-
|
37
|
+
* @startuml context-help.png
|
38
38
|
* skinparam monochrome true
|
39
39
|
* skinparam shadowing false
|
40
40
|
* HTMLElement <|-- CustomElement
|
@@ -55,7 +55,9 @@ class ContextHelp extends Popper {
|
|
55
55
|
* @since 2.1.0
|
56
56
|
*/
|
57
57
|
static get [instanceSymbol]() {
|
58
|
-
return Symbol.for(
|
58
|
+
return Symbol.for(
|
59
|
+
"@schukai/monster/components/form/context-help@@instance",
|
60
|
+
);
|
59
61
|
}
|
60
62
|
|
61
63
|
/**
|
@@ -77,7 +79,7 @@ class ContextHelp extends Popper {
|
|
77
79
|
templates: {
|
78
80
|
main: getTemplate(),
|
79
81
|
},
|
80
|
-
mode: "
|
82
|
+
mode: "auto",
|
81
83
|
});
|
82
84
|
}
|
83
85
|
|
@@ -105,7 +107,7 @@ function getTemplate() {
|
|
105
107
|
return `
|
106
108
|
<div data-monster-role="control" part="control">
|
107
109
|
|
108
|
-
<div data-monster-role="button" part="button"><svg xmlns="http://www.w3.org/2000/svg" width="
|
110
|
+
<div data-monster-role="button" part="button"><svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" fill="currentColor" class="bi bi-question-circle-fill" viewBox="0 0 16 16">
|
109
111
|
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.496 6.033h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286a.237.237 0 0 0 .241.247zm2.325 6.443c.61 0 1.029-.394 1.029-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94 0 .533.425.927 1.01.927z"/>
|
110
112
|
</svg></div>
|
111
113
|
|
@@ -56,7 +56,9 @@ const ATTRIBUTE_FORM_DATASOURCE_ACTION = `${ATTRIBUTE_PREFIX}datasource-action`;
|
|
56
56
|
* @type {symbol}
|
57
57
|
* @since 1.7.0
|
58
58
|
*/
|
59
|
-
const formDataSymbol = Symbol.for(
|
59
|
+
const formDataSymbol = Symbol.for(
|
60
|
+
"@schukai/monster/components/form/form@@formdata",
|
61
|
+
);
|
60
62
|
|
61
63
|
/**
|
62
64
|
* @private
|
@@ -141,7 +143,7 @@ class Form extends CustomElement {
|
|
141
143
|
* @since 2.1.0
|
142
144
|
*/
|
143
145
|
static get [instanceSymbol]() {
|
144
|
-
return Symbol.for("@schukai/
|
146
|
+
return Symbol.for("@schukai/monster/components/form/form");
|
145
147
|
}
|
146
148
|
|
147
149
|
/**
|
@@ -43,7 +43,7 @@ const buttonElementSymbol = Symbol("buttonElement");
|
|
43
43
|
* Or you can create this CustomControl directly in Javascript:
|
44
44
|
*
|
45
45
|
* ```js
|
46
|
-
* import
|
46
|
+
* import from '@schukai/monster/source/components/form/message-state-button.mjs';
|
47
47
|
* document.createElement('monster-state-button');
|
48
48
|
* ```
|
49
49
|
*
|
@@ -68,7 +68,9 @@ class MessageStateButton extends Popper {
|
|
68
68
|
* @since 2.1.0
|
69
69
|
*/
|
70
70
|
static get [instanceSymbol]() {
|
71
|
-
return Symbol.for(
|
71
|
+
return Symbol.for(
|
72
|
+
"@schukai/monster/components/form/message-state-button@@instance",
|
73
|
+
);
|
72
74
|
}
|
73
75
|
|
74
76
|
/**
|
@@ -125,7 +125,9 @@ class PopperButton extends Popper {
|
|
125
125
|
* @since 2.1.0
|
126
126
|
*/
|
127
127
|
static get [instanceSymbol]() {
|
128
|
-
return Symbol.for(
|
128
|
+
return Symbol.for(
|
129
|
+
"@schukai/monster/components/form/popper-button@@instance",
|
130
|
+
);
|
129
131
|
}
|
130
132
|
|
131
133
|
/**
|
@@ -170,7 +172,7 @@ class PopperButton extends Popper {
|
|
170
172
|
[assembleMethodSymbol]() {
|
171
173
|
super[assembleMethodSymbol]();
|
172
174
|
initControlReferences.call(this);
|
173
|
-
|
175
|
+
initEventHandler.call(this);
|
174
176
|
|
175
177
|
return this;
|
176
178
|
}
|
@@ -321,9 +323,9 @@ class PopperButton extends Popper {
|
|
321
323
|
|
322
324
|
/**
|
323
325
|
* @private
|
324
|
-
* @return {
|
326
|
+
* @return {initEventHandler}
|
325
327
|
*/
|
326
|
-
function
|
328
|
+
function initEventHandler() {
|
327
329
|
this[closeEventHandler] = (event) => {
|
328
330
|
const path = event.composedPath();
|
329
331
|
|
@@ -395,12 +397,15 @@ function initControlReferences() {
|
|
395
397
|
this[controlElementSymbol] = this.shadowRoot.querySelector(
|
396
398
|
`[${ATTRIBUTE_ROLE}=control]`,
|
397
399
|
);
|
400
|
+
|
398
401
|
this[buttonElementSymbol] = this.shadowRoot.querySelector(
|
399
402
|
`[${ATTRIBUTE_ROLE}=button]`,
|
400
403
|
);
|
404
|
+
|
401
405
|
this[popperElementSymbol] = this.shadowRoot.querySelector(
|
402
406
|
`[${ATTRIBUTE_ROLE}=popper]`,
|
403
407
|
);
|
408
|
+
|
404
409
|
this[arrowElementSymbol] = this.shadowRoot.querySelector(
|
405
410
|
`[${ATTRIBUTE_ROLE}=arrow]`,
|
406
411
|
);
|
@@ -121,7 +121,7 @@ class Popper extends CustomControl {
|
|
121
121
|
* @returns {symbol}
|
122
122
|
*/
|
123
123
|
static get [instanceSymbol]() {
|
124
|
-
return Symbol.for("@schukai/
|
124
|
+
return Symbol.for("@schukai/monster/components/form/popper@@instance");
|
125
125
|
}
|
126
126
|
|
127
127
|
/**
|
@@ -166,7 +166,7 @@ class Popper extends CustomControl {
|
|
166
166
|
[assembleMethodSymbol]() {
|
167
167
|
super[assembleMethodSymbol]();
|
168
168
|
initControlReferences.call(this);
|
169
|
-
|
169
|
+
initEventHandler.call(this);
|
170
170
|
|
171
171
|
return this;
|
172
172
|
}
|
@@ -252,7 +252,7 @@ class Popper extends CustomControl {
|
|
252
252
|
* @private
|
253
253
|
* @return {Monster.Components.Form.Popper}
|
254
254
|
*/
|
255
|
-
function
|
255
|
+
function initEventHandler() {
|
256
256
|
this[closeEventHandler] = (event) => {
|
257
257
|
const path = event.composedPath();
|
258
258
|
|
@@ -286,6 +286,12 @@ function initEventhandler() {
|
|
286
286
|
return this;
|
287
287
|
}
|
288
288
|
|
289
|
+
/**
|
290
|
+
* @private
|
291
|
+
* @param mode
|
292
|
+
* @return {Monster.Components.Form.Popper}
|
293
|
+
* @throws Error
|
294
|
+
*/
|
289
295
|
function initEventHandlerByMode(mode) {
|
290
296
|
switch (mode) {
|
291
297
|
case "manual":
|
@@ -337,6 +343,8 @@ function initEventHandlerByMode(mode) {
|
|
337
343
|
this.hideDialog();
|
338
344
|
});
|
339
345
|
break;
|
346
|
+
default:
|
347
|
+
throw new Error(`Unknown mode ${mode}`);
|
340
348
|
}
|
341
349
|
}
|
342
350
|
|
@@ -310,7 +310,7 @@ class Select extends CustomControl {
|
|
310
310
|
* @since 2.1.0
|
311
311
|
*/
|
312
312
|
static get [instanceSymbol]() {
|
313
|
-
return Symbol.for("@schukai/
|
313
|
+
return Symbol.for("@schukai/monster/components/form/select@@instance");
|
314
314
|
}
|
315
315
|
|
316
316
|
/**
|
@@ -721,7 +721,7 @@ class Select extends CustomControl {
|
|
721
721
|
fireCustomEvent(this, "monster-options-set", {
|
722
722
|
options,
|
723
723
|
});
|
724
|
-
|
724
|
+
|
725
725
|
return this;
|
726
726
|
}
|
727
727
|
|
@@ -1534,7 +1534,7 @@ function gatherState() {
|
|
1534
1534
|
.catch((e) => {
|
1535
1535
|
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, `${e}`);
|
1536
1536
|
});
|
1537
|
-
|
1537
|
+
|
1538
1538
|
if (this.getOption("features.closeOnSelect") === true) {
|
1539
1539
|
toggle.call(this);
|
1540
1540
|
}
|
@@ -58,7 +58,9 @@ class StateButton extends Button {
|
|
58
58
|
* @since 2.1.0
|
59
59
|
*/
|
60
60
|
static get [instanceSymbol]() {
|
61
|
-
return Symbol.for(
|
61
|
+
return Symbol.for(
|
62
|
+
"@schukai/monster/components/form/state-button@@instance",
|
63
|
+
);
|
62
64
|
}
|
63
65
|
|
64
66
|
/**
|
@@ -169,6 +171,7 @@ class StateButton extends Button {
|
|
169
171
|
* @return {string}
|
170
172
|
*/
|
171
173
|
function getTemplate() {
|
174
|
+
// language=HTML
|
172
175
|
return `<div data-monster-role="control" part="control">
|
173
176
|
<button data-monster-attributes="disabled path:disabled | if:true, class path:classes.button"
|
174
177
|
data-monster-role="button"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
@import "../../style/control.pcss";
|
2
|
+
@import "../../style/floating-ui.pcss";
|
3
|
+
|
4
|
+
[data-monster-role=control] {
|
5
|
+
position: relative;
|
6
|
+
margin: 0;
|
7
|
+
padding: 0;
|
8
|
+
line-height: 1em;
|
9
|
+
|
10
|
+
& [data-monster-role="button"] {
|
11
|
+
display: inline-block;
|
12
|
+
position: relative;
|
13
|
+
|
14
|
+
& svg {
|
15
|
+
cursor: pointer;
|
16
|
+
}
|
17
|
+
|
18
|
+
& svg.hidden {
|
19
|
+
visibility: hidden;
|
20
|
+
cursor: default;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
:host {
|
26
|
+
display: inline-block;
|
27
|
+
position: relative;
|
28
|
+
margin: 0 0.2em;
|
29
|
+
padding: 0;
|
30
|
+
vertical-align: bottom;
|
31
|
+
transform: translateY(0.15em);
|
32
|
+
}
|