@schukai/monster 3.65.0 → 3.65.21
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +48 -327
- package/README.md +44 -40
- package/package.json +1 -48
- package/source/components/constants.mjs +10 -3
- package/source/components/datatable/change-button.mjs +18 -11
- package/source/components/datatable/columnbar.mjs +10 -1
- package/source/components/datatable/constants.mjs +11 -4
- package/source/components/datatable/dataset.mjs +212 -203
- package/source/components/datatable/datasource/dom.mjs +14 -1
- package/source/components/datatable/datasource/rest.mjs +10 -1
- package/source/components/datatable/datasource.mjs +10 -1
- package/source/components/datatable/datatable/header.mjs +220 -218
- package/source/components/datatable/datatable.mjs +754 -752
- package/source/components/datatable/embedded-pagination.mjs +10 -1
- package/source/components/datatable/filter/abstract-base.mjs +10 -1
- package/source/components/datatable/filter/date-range.mjs +10 -1
- package/source/components/datatable/filter/input.mjs +10 -1
- package/source/components/datatable/filter/range.mjs +10 -1
- package/source/components/datatable/filter/select.mjs +11 -4
- package/source/components/datatable/filter/settings.mjs +14 -0
- package/source/components/datatable/filter/util.mjs +14 -0
- package/source/components/datatable/filter-button.mjs +10 -1
- package/source/components/datatable/filter.mjs +15 -11
- package/source/components/datatable/pagination.mjs +18 -9
- package/source/components/datatable/save-button.mjs +280 -270
- package/source/components/datatable/status.mjs +15 -5
- package/source/components/datatable/stylesheet/change-button.mjs +16 -7
- package/source/components/datatable/stylesheet/column-bar.mjs +16 -7
- package/source/components/datatable/stylesheet/dataset.mjs +16 -7
- package/source/components/datatable/stylesheet/datasource.mjs +16 -7
- package/source/components/datatable/stylesheet/datatable.mjs +16 -7
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +16 -7
- package/source/components/datatable/stylesheet/filter-button.mjs +16 -7
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +16 -7
- package/source/components/datatable/stylesheet/filter-date-range.mjs +16 -7
- package/source/components/datatable/stylesheet/filter-range.mjs +16 -7
- package/source/components/datatable/stylesheet/filter.mjs +16 -7
- package/source/components/datatable/stylesheet/pagination.mjs +16 -7
- package/source/components/datatable/stylesheet/save-button.mjs +16 -7
- package/source/components/datatable/stylesheet/select-filter.mjs +16 -7
- package/source/components/datatable/stylesheet/status.mjs +16 -7
- package/source/components/datatable/util.mjs +16 -8
- package/source/components/form/action-button.mjs +11 -3
- package/source/components/form/api-button.mjs +11 -3
- package/source/components/form/button-bar.mjs +11 -3
- package/source/components/form/button.mjs +254 -249
- package/source/components/form/confirm-button.mjs +11 -3
- package/source/components/form/constants.mjs +10 -3
- package/source/components/form/context-error.mjs +69 -52
- package/source/components/form/context-help.mjs +11 -3
- package/source/components/form/field-set.mjs +10 -15
- package/source/components/form/form.mjs +12 -4
- package/source/components/form/message-state-button.mjs +11 -3
- package/source/components/form/popper-button.mjs +11 -3
- package/source/components/form/popper.mjs +6 -6
- package/source/components/form/reload.mjs +12 -4
- package/source/components/form/select.mjs +44 -33
- package/source/components/form/shadow-reload.mjs +11 -3
- package/source/components/form/state-button.mjs +11 -3
- package/source/components/form/stylesheet/action-button.mjs +16 -7
- package/source/components/form/stylesheet/api-button.mjs +16 -7
- package/source/components/form/stylesheet/button-bar.mjs +16 -7
- package/source/components/form/stylesheet/button.mjs +16 -7
- package/source/components/form/stylesheet/confirm-button.mjs +16 -7
- package/source/components/form/stylesheet/context-error.mjs +16 -7
- package/source/components/form/stylesheet/context-help.mjs +16 -7
- package/source/components/form/stylesheet/field-set.mjs +16 -7
- package/source/components/form/stylesheet/form.mjs +16 -7
- package/source/components/form/stylesheet/message-state-button.mjs +16 -7
- package/source/components/form/stylesheet/popper-button.mjs +16 -7
- package/source/components/form/stylesheet/select.mjs +16 -7
- package/source/components/form/stylesheet/state-button.mjs +16 -7
- package/source/components/form/stylesheet/toggle-switch.mjs +16 -7
- package/source/components/form/stylesheet/tree-select.mjs +16 -7
- package/source/components/form/tabs.mjs +12 -8
- package/source/components/form/template.mjs +11 -3
- package/source/components/form/toggle-switch.mjs +12 -8
- package/source/components/form/tree-select.mjs +10 -3
- package/source/components/form/types/state.mjs +10 -3
- package/source/components/form/util/fetch.mjs +10 -3
- package/source/components/form/util/floating-ui.mjs +10 -3
- package/source/components/form/util/popper.mjs +10 -3
- package/source/components/host/call-button.mjs +10 -1
- package/source/components/host/collapse.mjs +4 -6
- package/source/components/host/config-manager.mjs +2 -0
- package/source/components/host/constants.mjs +2 -0
- package/source/components/host/details.mjs +5 -8
- package/source/components/host/host.mjs +10 -1
- package/source/components/host/overlay.mjs +10 -1
- package/source/components/host/stylesheet/call-button.mjs +16 -7
- package/source/components/host/stylesheet/config-manager.mjs +16 -7
- package/source/components/host/stylesheet/host.mjs +16 -7
- package/source/components/host/stylesheet/overlay.mjs +16 -7
- package/source/components/host/stylesheet/toggle-button.mjs +16 -7
- package/source/components/host/stylesheet/viewer.mjs +16 -7
- package/source/components/host/toggle-button.mjs +10 -1
- package/source/components/host/util.mjs +14 -0
- package/source/components/host/viewer.mjs +10 -1
- package/source/components/layout/collapse.mjs +4 -3
- package/source/components/layout/details.mjs +2 -0
- package/source/components/layout/panel.mjs +179 -169
- package/source/components/layout/popper.mjs +324 -320
- package/source/components/layout/split-panel.mjs +329 -303
- package/source/components/layout/stylesheet/collapse.mjs +16 -7
- package/source/components/layout/stylesheet/details.mjs +16 -7
- package/source/components/layout/stylesheet/panel.mjs +16 -7
- package/source/components/layout/stylesheet/popper.mjs +16 -7
- package/source/components/layout/stylesheet/split-panel.mjs +16 -7
- package/source/components/layout/stylesheet/tabs.mjs +16 -7
- package/source/components/layout/stylesheet/width-toggle.mjs +16 -7
- package/source/components/layout/tabs.mjs +39 -24
- package/source/components/layout/width-toggle.mjs +148 -138
- package/source/components/navigation/style/table-of-content.pcss +20 -5
- package/source/components/navigation/stylesheet/table-of-content.mjs +17 -8
- package/source/components/navigation/table-of-content.mjs +394 -266
- package/source/components/notify/constants.mjs +10 -3
- package/source/components/notify/message.mjs +16 -9
- package/source/components/notify/notify.mjs +11 -4
- package/source/components/notify/stylesheet/message.mjs +16 -7
- package/source/components/notify/stylesheet/notify.mjs +16 -7
- package/source/components/state/log/entry.mjs +10 -1
- package/source/components/state/log.mjs +10 -1
- package/source/components/state/state.mjs +10 -1
- package/source/components/state/stylesheet/log.mjs +16 -7
- package/source/components/state/stylesheet/state.mjs +16 -7
- package/source/components/style/mixin/form.pcss +0 -1
- package/source/components/stylesheet/badge.mjs +16 -7
- package/source/components/stylesheet/border.mjs +16 -7
- package/source/components/stylesheet/button.mjs +16 -7
- package/source/components/stylesheet/card.mjs +16 -7
- package/source/components/stylesheet/color.mjs +16 -7
- package/source/components/stylesheet/common.mjs +16 -7
- package/source/components/stylesheet/control.mjs +16 -7
- package/source/components/stylesheet/data-grid.mjs +16 -7
- package/source/components/stylesheet/display.mjs +16 -7
- package/source/components/stylesheet/floating-ui.mjs +16 -7
- package/source/components/stylesheet/form.mjs +16 -7
- package/source/components/stylesheet/host.mjs +16 -7
- package/source/components/stylesheet/icons.mjs +16 -7
- package/source/components/stylesheet/link.mjs +16 -7
- package/source/components/stylesheet/mixin/badge.mjs +16 -7
- package/source/components/stylesheet/mixin/button.mjs +16 -7
- package/source/components/stylesheet/mixin/form.mjs +16 -7
- package/source/components/stylesheet/mixin/hover.mjs +16 -7
- package/source/components/stylesheet/mixin/icon.mjs +16 -7
- package/source/components/stylesheet/mixin/media.mjs +16 -7
- package/source/components/stylesheet/mixin/property.mjs +16 -7
- package/source/components/stylesheet/mixin/skeleton.mjs +16 -7
- package/source/components/stylesheet/mixin/spinner.mjs +16 -7
- package/source/components/stylesheet/mixin/typography.mjs +16 -7
- package/source/components/stylesheet/normalize.mjs +16 -7
- package/source/components/stylesheet/popper.mjs +16 -7
- package/source/components/stylesheet/property.mjs +16 -7
- package/source/components/stylesheet/ripple.mjs +16 -7
- package/source/components/stylesheet/skeleton.mjs +16 -7
- package/source/components/stylesheet/space.mjs +16 -7
- package/source/components/stylesheet/spinner.mjs +16 -7
- package/source/components/stylesheet/table.mjs +16 -7
- package/source/components/stylesheet/theme.mjs +16 -7
- package/source/components/stylesheet/tree-menu.mjs +10 -3
- package/source/components/stylesheet/typography.mjs +16 -7
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +16 -7
- package/source/components/tree-menu/tree-menu.mjs +19 -8
- package/source/constants.mjs +10 -6
- package/source/constraints/abstract.mjs +10 -3
- package/source/constraints/abstractoperator.mjs +10 -3
- package/source/constraints/andoperator.mjs +10 -3
- package/source/constraints/invalid.mjs +10 -3
- package/source/constraints/isarray.mjs +10 -3
- package/source/constraints/isobject.mjs +10 -3
- package/source/constraints/oroperator.mjs +10 -3
- package/source/constraints/valid.mjs +10 -3
- package/source/data/buildmap.mjs +10 -3
- package/source/data/buildtree.mjs +10 -3
- package/source/data/datasource/dom.mjs +95 -87
- package/source/data/datasource/server/restapi/data-fetch-error.mjs +10 -3
- package/source/data/datasource/server/restapi/writeerror.mjs +10 -3
- package/source/data/datasource/server/restapi.mjs +10 -3
- package/source/data/datasource/server/webconnect.mjs +10 -3
- package/source/data/datasource/server.mjs +10 -3
- package/source/data/datasource/storage/localstorage.mjs +10 -3
- package/source/data/datasource/storage/sessionstorage.mjs +10 -3
- package/source/data/datasource/storage.mjs +10 -3
- package/source/data/datasource.mjs +10 -3
- package/source/data/diff.mjs +10 -3
- package/source/data/extend.mjs +10 -3
- package/source/data/pathfinder.mjs +10 -3
- package/source/data/pipe.mjs +10 -3
- package/source/data/transformer.mjs +34 -10
- package/source/dom/assembler.mjs +10 -3
- package/source/dom/attributes.mjs +10 -3
- package/source/dom/constants.mjs +10 -3
- package/source/dom/customcontrol.mjs +11 -4
- package/source/dom/customelement.mjs +31 -17
- package/source/dom/dimension.mjs +10 -3
- package/source/dom/events.mjs +10 -3
- package/source/dom/focusmanager.mjs +10 -3
- package/source/dom/locale.mjs +10 -3
- package/source/dom/ready.mjs +2 -1
- package/source/dom/resource/data.mjs +133 -123
- package/source/dom/resource/link/stylesheet.mjs +10 -3
- package/source/dom/resource/link.mjs +10 -3
- package/source/dom/resource/script.mjs +10 -3
- package/source/dom/resource.mjs +10 -4
- package/source/dom/resourcemanager.mjs +10 -3
- package/source/dom/slotted.mjs +14 -0
- package/source/dom/template.mjs +124 -136
- package/source/dom/theme.mjs +10 -3
- package/source/dom/updater.mjs +10 -3
- package/source/dom/util/extract-keys.mjs +10 -3
- package/source/dom/util/init-options-from-attributes.mjs +68 -61
- package/source/dom/util/set-option-from-attribute.mjs +10 -3
- package/source/dom/util.mjs +11 -4
- package/source/dom/worker/factory.mjs +10 -3
- package/source/i18n/formatter.mjs +10 -3
- package/source/i18n/locale.mjs +10 -3
- package/source/i18n/provider.mjs +10 -3
- package/source/i18n/providers/embed.mjs +10 -3
- package/source/i18n/providers/fetch.mjs +10 -3
- package/source/i18n/translations.mjs +10 -3
- package/source/logging/handler/console.mjs +10 -3
- package/source/logging/handler.mjs +10 -3
- package/source/logging/logentry.mjs +10 -3
- package/source/logging/logger.mjs +10 -3
- package/source/math/random.mjs +10 -3
- package/source/monster.mjs +3 -9
- package/source/net/webconnect/message.mjs +10 -3
- package/source/net/webconnect.mjs +20 -5
- package/source/text/bracketed-key-value-hash.mjs +10 -3
- package/source/text/formatter.mjs +10 -3
- package/source/text/generate-range-comparison-expression.mjs +10 -3
- package/source/text/util.mjs +14 -0
- package/source/types/base.mjs +10 -3
- package/source/types/basewithoptions.mjs +10 -3
- package/source/types/binary.mjs +10 -3
- package/source/types/dataurl.mjs +10 -3
- package/source/types/global.mjs +14 -7
- package/source/types/id.mjs +10 -3
- package/source/types/internal.mjs +11 -3
- package/source/types/is.mjs +10 -3
- package/source/types/mediatype.mjs +10 -3
- package/source/types/node.mjs +10 -3
- package/source/types/nodelist.mjs +10 -3
- package/source/types/noderecursiveiterator.mjs +10 -3
- package/source/types/observablequeue.mjs +10 -3
- package/source/types/observer.mjs +10 -3
- package/source/types/observerlist.mjs +10 -3
- package/source/types/proxyobserver.mjs +10 -3
- package/source/types/queue.mjs +10 -3
- package/source/types/randomid.mjs +10 -3
- package/source/types/regex.mjs +10 -3
- package/source/types/stack.mjs +10 -3
- package/source/types/tokenlist.mjs +10 -3
- package/source/types/typeof.mjs +10 -3
- package/source/types/uniquequeue.mjs +10 -3
- package/source/types/uuid.mjs +10 -3
- package/source/types/validate.mjs +10 -3
- package/source/types/version.mjs +10 -3
- package/source/util/clone.mjs +10 -3
- package/source/util/comparator.mjs +10 -3
- package/source/util/deadmansswitch.mjs +10 -3
- package/source/util/freeze.mjs +10 -3
- package/source/util/processing.mjs +10 -3
- package/source/util/runtime.mjs +10 -7
- package/source/util/sleep.mjs +10 -10
- package/source/util/trimspaces.mjs +10 -3
- package/test/cases/data/datasource/server/websocket.mjs +7 -9
- package/test/cases/data/transformer.mjs +47 -15
- package/test/cases/dom/customcontrol.mjs +0 -1
- package/test/cases/dom/customelement.mjs +1 -3
- package/test/cases/dom/template.mjs +3 -1
- package/test/util/jsdom.mjs +8 -7
- package/test/util/websocket.mjs +5 -1
- package/test/web/import.js +2 -1
- package/test/web/puppeteer.mjs +111 -0
- package/test/web/test.html +2 -2
- package/test/web/tests.js +2036 -1189
- package/example/components/form/button.mjs +0 -10
- package/example/components/form/field-set.mjs +0 -4
- package/example/components/form/select.mjs +0 -25
- package/example/components/form/toggle-switch.mjs +0 -7
- package/example/components/form/tree-select.mjs +0 -27
- package/example/components/host/host.mjs +0 -0
- package/example/components/notify/message.mjs +0 -4
- package/example/components/notify/notify.mjs +0 -4
- package/example/components/state/log.mjs +0 -0
- package/example/components/state/state.mjs +0 -0
- package/example/constraints/andoperator.mjs +0 -17
- package/example/constraints/invalid.mjs +0 -6
- package/example/constraints/isarray.mjs +0 -11
- package/example/constraints/isobject.mjs +0 -12
- package/example/constraints/oroperator.mjs +0 -15
- package/example/constraints/valid.mjs +0 -6
- package/example/data/buildmap.mjs +0 -67
- package/example/data/datasource/server/restapi.mjs +0 -20
- package/example/data/datasource/server/webconnect.mjs +0 -9
- package/example/data/datasource.mjs +0 -7
- package/example/data/diff.mjs +0 -39
- package/example/data/pathfinder-1.mjs +0 -23
- package/example/data/pathfinder-2.mjs +0 -19
- package/example/data/pipe.mjs +0 -14
- package/example/data/transformer.mjs +0 -9
- package/example/dom/customelement.mjs +0 -14
- package/example/dom/theme.mjs +0 -5
- package/example/dom/updater.mjs +0 -23
- package/example/i18n/formatter.mjs +0 -10
- package/example/i18n/providers/embed.mjs +0 -5
- package/example/i18n/providers/fetch.mjs +0 -5
- package/example/i18n/translations.mjs +0 -20
- package/example/net/webconnect.mjs +0 -16
- package/example/types/basewithoptions.mjs +0 -10
- package/example/types/is-1.mjs +0 -5
- package/example/types/is-10.mjs +0 -6
- package/example/types/is-2.mjs +0 -4
- package/example/types/is-3.mjs +0 -4
- package/example/types/is-4.mjs +0 -5
- package/example/types/is-5.mjs +0 -4
- package/example/types/is-6.mjs +0 -4
- package/example/types/is-7.mjs +0 -4
- package/example/types/is-8.mjs +0 -4
- package/example/types/is-9.mjs +0 -6
- package/example/types/noderecursiveiterator.mjs +0 -32
- package/example/types/observer.mjs +0 -9
- package/example/types/proxyobserver.mjs +0 -25
- package/example/types/queue.mjs +0 -20
- package/example/types/tokenlist-1.mjs +0 -4
- package/example/types/tokenlist-2.mjs +0 -7
- package/example/types/tokenlist-3.mjs +0 -5
- package/example/types/tokenlist-4.mjs +0 -5
- package/example/types/tokenlist-5.mjs +0 -5
- package/example/types/typeof.mjs +0 -9
- package/example/types/version-1.mjs +0 -6
- package/example/types/version-2.mjs +0 -3
- package/example/util/comparator.mjs +0 -10
- package/example/util/deadmansswitch.mjs +0 -9
- package/example/util/processing.mjs +0 -17
- package/source/components/datatable/datasource/namespace.mjs +0 -13
- package/source/components/datatable/datatable/namespace.mjs +0 -13
- package/source/components/datatable/events.mjs +0 -24
- package/source/components/datatable/filter/namespace.mjs +0 -13
- package/source/components/datatable/namespace.mjs +0 -11
- package/source/components/datatable/stylesheet/namespace.mjs +0 -13
- package/source/components/events.mjs +0 -17
- package/source/components/form/events.mjs +0 -108
- package/source/components/form/namespace.mjs +0 -13
- package/source/components/form/stylesheet/namespace.mjs +0 -13
- package/source/components/form/types/namespace.mjs +0 -13
- package/source/components/form/util/namespace.mjs +0 -13
- package/source/components/host/events.mjs +0 -131
- package/source/components/host/namespace.mjs +0 -13
- package/source/components/host/stylesheet/namespace.mjs +0 -13
- package/source/components/layout/events.mjs +0 -30
- package/source/components/layout/namespace.mjs +0 -13
- package/source/components/namespace.mjs +0 -14
- package/source/components/notify/events.mjs +0 -15
- package/source/components/notify/namespace.mjs +0 -15
- package/source/components/notify/stylesheet/namespace.mjs +0 -15
- package/source/components/state/log/namespace.mjs +0 -13
- package/source/components/state/namespace.mjs +0 -13
- package/source/components/stylesheet/namespace.mjs +0 -13
- package/source/components/tree-menu/namespace.mjs +0 -13
- package/source/components/tree-menu/stylesheet/namespace.mjs +0 -13
- package/source/constraints/namespace.mjs +0 -13
- package/source/data/datasource/namespace.mjs +0 -13
- package/source/data/datasource/server/namespace.mjs +0 -13
- package/source/data/datasource/server/restapi/namespace.mjs +0 -13
- package/source/data/datasource/storage/namespace.mjs +0 -13
- package/source/data/namespace.mjs +0 -13
- package/source/dom/namespace.mjs +0 -13
- package/source/dom/resource/link/namespace.mjs +0 -13
- package/source/dom/resource/namespace.mjs +0 -13
- package/source/dom/util/namespace.mjs +0 -13
- package/source/dom/worker/namespace.mjs +0 -13
- package/source/i18n/namespace.mjs +0 -13
- package/source/i18n/providers/namespace.mjs +0 -13
- package/source/logging/handler/namespace.mjs +0 -11
- package/source/logging/namespace.mjs +0 -13
- package/source/math/namespace.mjs +0 -13
- package/source/net/namespace.mjs +0 -13
- package/source/net/webconnect/namespace.mjs +0 -13
- package/source/text/namespace.mjs +0 -13
- package/source/types/namespace.mjs +0 -13
- package/source/util/namespace.mjs +0 -13
@@ -1,66 +1,82 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, {{copyRightYear}}. All rights reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
*
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
7
|
+
*
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
11
|
+
*
|
3
12
|
* SPDX-License-Identifier: AGPL-3.0
|
4
13
|
*/
|
5
14
|
|
6
|
-
import {Datasource} from "./datasource.mjs";
|
15
|
+
import { Datasource } from "./datasource.mjs";
|
7
16
|
import {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
17
|
+
assembleMethodSymbol,
|
18
|
+
CustomElement,
|
19
|
+
registerCustomElement,
|
20
|
+
getSlottedElements,
|
12
21
|
} from "../../dom/customelement.mjs";
|
13
|
-
import {findTargetElementFromEvent, fireCustomEvent} from "../../dom/events.mjs";
|
14
|
-
import {clone} from "../../util/clone.mjs";
|
15
22
|
import {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
findTargetElementFromEvent,
|
24
|
+
fireCustomEvent,
|
25
|
+
} from "../../dom/events.mjs";
|
26
|
+
import { clone } from "../../util/clone.mjs";
|
27
|
+
import {
|
28
|
+
isString,
|
29
|
+
isFunction,
|
30
|
+
isInstance,
|
31
|
+
isObject,
|
32
|
+
isArray,
|
21
33
|
} from "../../types/is.mjs";
|
22
|
-
import {validateArray, validateInteger, validateObject} from "../../types/validate.mjs";
|
23
|
-
import {Observer} from "../../types/observer.mjs";
|
24
34
|
import {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
validateArray,
|
36
|
+
validateInteger,
|
37
|
+
validateObject,
|
38
|
+
} from "../../types/validate.mjs";
|
39
|
+
import { Observer } from "../../types/observer.mjs";
|
40
|
+
import {
|
41
|
+
ATTRIBUTE_DATATABLE_HEAD,
|
42
|
+
ATTRIBUTE_DATATABLE_GRID_TEMPLATE,
|
43
|
+
ATTRIBUTE_DATASOURCE_SELECTOR,
|
44
|
+
ATTRIBUTE_DATATABLE_ALIGN,
|
45
|
+
ATTRIBUTE_DATATABLE_SORTABLE,
|
46
|
+
ATTRIBUTE_DATATABLE_MODE,
|
47
|
+
ATTRIBUTE_DATATABLE_INDEX,
|
48
|
+
ATTRIBUTE_DATATABLE_MODE_HIDDEN,
|
49
|
+
ATTRIBUTE_DATATABLE_MODE_VISIBLE,
|
50
|
+
ATTRIBUTE_DATATABLE_RESPONSIVE_BREAKPOINT,
|
51
|
+
ATTRIBUTE_DATATABLE_MODE_FIXED,
|
36
52
|
} from "./constants.mjs";
|
37
|
-
import {instanceSymbol} from "../../constants.mjs";
|
53
|
+
import { instanceSymbol } from "../../constants.mjs";
|
38
54
|
import {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
55
|
+
Header,
|
56
|
+
createOrderStatement,
|
57
|
+
DIRECTION_ASC,
|
58
|
+
DIRECTION_DESC,
|
59
|
+
DIRECTION_NONE,
|
44
60
|
} from "./datatable/header.mjs";
|
45
|
-
import {DatatableStyleSheet} from "./stylesheet/datatable.mjs";
|
61
|
+
import { DatatableStyleSheet } from "./stylesheet/datatable.mjs";
|
46
62
|
import {
|
47
|
-
|
48
|
-
|
63
|
+
handleDataSourceChanges,
|
64
|
+
datasourceLinkedElementSymbol,
|
49
65
|
} from "./util.mjs";
|
50
66
|
import "./columnbar.mjs";
|
51
67
|
import "./filter-button.mjs";
|
52
|
-
import {getDocument, getWindow} from "../../dom/util.mjs";
|
53
|
-
import {addAttributeToken} from "../../dom/attributes.mjs";
|
54
|
-
import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
|
55
|
-
import {getDocumentTranslations} from "../../i18n/translations.mjs";
|
68
|
+
import {findElementWithSelectorUpwards, getDocument, getWindow} from "../../dom/util.mjs";
|
69
|
+
import { addAttributeToken } from "../../dom/attributes.mjs";
|
70
|
+
import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
|
71
|
+
import { getDocumentTranslations } from "../../i18n/translations.mjs";
|
56
72
|
import "../state/state.mjs";
|
57
73
|
import "../host/collapse.mjs";
|
58
|
-
import {generateUniqueConfigKey} from "../host/util.mjs";
|
74
|
+
import { generateUniqueConfigKey } from "../host/util.mjs";
|
59
75
|
|
60
76
|
import "./datasource/dom.mjs";
|
61
77
|
import "./datasource/rest.mjs";
|
62
78
|
|
63
|
-
export {DataTable};
|
79
|
+
export { DataTable };
|
64
80
|
|
65
81
|
/**
|
66
82
|
* @private
|
@@ -124,358 +140,354 @@ const columnBarElementSymbol = Symbol("columnBarElement");
|
|
124
140
|
* @fire Monster.Components.Datatable.event:monster-datatable-row-added
|
125
141
|
*/
|
126
142
|
class DataTable extends CustomElement {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
return this;
|
477
|
-
}
|
478
|
-
|
143
|
+
/**
|
144
|
+
* This method is called by the `instanceof` operator.
|
145
|
+
* @returns {symbol}
|
146
|
+
*/
|
147
|
+
static get [instanceSymbol]() {
|
148
|
+
return Symbol.for("@schukai/monster/components/datatable@@instance");
|
149
|
+
}
|
150
|
+
|
151
|
+
/**
|
152
|
+
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
153
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
154
|
+
*
|
155
|
+
* The individual configuration values can be found in the table.
|
156
|
+
*
|
157
|
+
* @property {Object} templates Template definitions
|
158
|
+
* @property {string} templates.main Main template
|
159
|
+
* @property {Object} datasource Datasource configuration
|
160
|
+
* @property {string} datasource.selector Selector for the datasource
|
161
|
+
* @property {Object} mapping Mapping configuration
|
162
|
+
* @property {string} mapping.data Data mapping
|
163
|
+
* @property {Array} data Data
|
164
|
+
* @property {Array} headers Headers
|
165
|
+
* @property {Object} responsive Responsive configuration
|
166
|
+
* @property {number} responsive.breakpoint Breakpoint for responsive mode
|
167
|
+
* @property {Object} labels Labels
|
168
|
+
* @property {string} labels.theListContainsNoEntries Label for empty state
|
169
|
+
* @property {Object} classes Classes
|
170
|
+
* @property {string} classes.container Container class
|
171
|
+
* @property {Object} features Features
|
172
|
+
* @property {boolean} features.settings Settings feature
|
173
|
+
* @property {boolean} features.footer Footer feature
|
174
|
+
* @property {boolean} features.autoInit Auto init feature (init datasource automatically)
|
175
|
+
* @property {Object} templateMapping Template mapping
|
176
|
+
* @property {string} templateMapping.row-key Row key
|
177
|
+
* @property {string} templateMapping.filter-id Filter id
|
178
|
+
**/
|
179
|
+
get defaults() {
|
180
|
+
return Object.assign(
|
181
|
+
{},
|
182
|
+
super.defaults,
|
183
|
+
{
|
184
|
+
templates: {
|
185
|
+
main: getTemplate(),
|
186
|
+
emptyState: getEmptyTemplate(),
|
187
|
+
},
|
188
|
+
|
189
|
+
datasource: {
|
190
|
+
selector: null,
|
191
|
+
},
|
192
|
+
|
193
|
+
mapping: {
|
194
|
+
data: "dataset",
|
195
|
+
},
|
196
|
+
|
197
|
+
data: [],
|
198
|
+
headers: [],
|
199
|
+
|
200
|
+
responsive: {
|
201
|
+
breakpoint: 800,
|
202
|
+
},
|
203
|
+
|
204
|
+
labels: {
|
205
|
+
theListContainsNoEntries: "The list contains no entries",
|
206
|
+
},
|
207
|
+
|
208
|
+
classes: {
|
209
|
+
control: "monster-theme-control-container-1",
|
210
|
+
container: "monster-theme-control-container-1",
|
211
|
+
row: "monster-theme-control-row-1",
|
212
|
+
},
|
213
|
+
|
214
|
+
features: {
|
215
|
+
settings: true,
|
216
|
+
footer: true,
|
217
|
+
autoInit: true,
|
218
|
+
},
|
219
|
+
|
220
|
+
templateMapping: {
|
221
|
+
"row-key": null,
|
222
|
+
"filter-id": null,
|
223
|
+
},
|
224
|
+
},
|
225
|
+
initOptionsFromArguments.call(this),
|
226
|
+
);
|
227
|
+
}
|
228
|
+
|
229
|
+
/**
|
230
|
+
*
|
231
|
+
* @param {string} selector
|
232
|
+
* @returns {NodeListOf<*>}
|
233
|
+
*/
|
234
|
+
getGridElements(selector) {
|
235
|
+
return this[gridElementSymbol].querySelectorAll(selector);
|
236
|
+
}
|
237
|
+
|
238
|
+
/**
|
239
|
+
*
|
240
|
+
* @return {string}
|
241
|
+
*/
|
242
|
+
static getTag() {
|
243
|
+
return "monster-datatable";
|
244
|
+
}
|
245
|
+
|
246
|
+
/**
|
247
|
+
*
|
248
|
+
* @return {Monster.Components.Form.Form}
|
249
|
+
*/
|
250
|
+
[assembleMethodSymbol]() {
|
251
|
+
const rawKey = this.getOption("templateMapping.row-key");
|
252
|
+
|
253
|
+
if (rawKey === null) {
|
254
|
+
if (this.id !== null && this.id !== "") {
|
255
|
+
const rawKey = this.getOption("templateMapping.row-key");
|
256
|
+
if (rawKey === null) {
|
257
|
+
this.setOption("templateMapping.row-key", this.id + "-row");
|
258
|
+
}
|
259
|
+
} else {
|
260
|
+
this.setOption("templateMapping.row-key", "row");
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
if (this.id !== null && this.id !== "") {
|
265
|
+
this.setOption("templateMapping.filter-id", "" + this.id + "-filter");
|
266
|
+
} else {
|
267
|
+
this.setOption("templateMapping.filter-id", "filter");
|
268
|
+
}
|
269
|
+
|
270
|
+
super[assembleMethodSymbol]();
|
271
|
+
|
272
|
+
initControlReferences.call(this);
|
273
|
+
initEventHandler.call(this);
|
274
|
+
|
275
|
+
const selector = this.getOption("datasource.selector");
|
276
|
+
|
277
|
+
if (isString(selector)) {
|
278
|
+
const element = findElementWithSelectorUpwards( this,selector);
|
279
|
+
if (element===null) {
|
280
|
+
throw new Error("the selector must match exactly one element");
|
281
|
+
}
|
282
|
+
|
283
|
+
if (!isInstance(element, Datasource)) {
|
284
|
+
throw new TypeError("the element must be a datasource");
|
285
|
+
}
|
286
|
+
|
287
|
+
this[datasourceLinkedElementSymbol] = element;
|
288
|
+
|
289
|
+
setTimeout(() => {
|
290
|
+
handleDataSourceChanges.call(this);
|
291
|
+
element.datasource.attachObserver(
|
292
|
+
new Observer(handleDataSourceChanges.bind(this)),
|
293
|
+
);
|
294
|
+
}, 0);
|
295
|
+
}
|
296
|
+
|
297
|
+
getHostConfig
|
298
|
+
.call(this, getColumnVisibilityConfigKey)
|
299
|
+
.then((config) => {
|
300
|
+
const headerOrderMap = new Map();
|
301
|
+
|
302
|
+
getHostConfig
|
303
|
+
.call(this, getStoredOrderConfigKey)
|
304
|
+
.then((orderConfig) => {
|
305
|
+
if (isArray(orderConfig) || orderConfig.length > 0) {
|
306
|
+
for (let i = 0; i < orderConfig.length; i++) {
|
307
|
+
const item = orderConfig[i];
|
308
|
+
const parts = item.split(" ");
|
309
|
+
const field = parts[0];
|
310
|
+
const direction = parts[1] || DIRECTION_ASC;
|
311
|
+
headerOrderMap.set(field, direction);
|
312
|
+
}
|
313
|
+
}
|
314
|
+
})
|
315
|
+
.then(() => {
|
316
|
+
try {
|
317
|
+
initGridAndStructs.call(this, config, headerOrderMap);
|
318
|
+
} catch (error) {
|
319
|
+
addAttributeToken(
|
320
|
+
this,
|
321
|
+
ATTRIBUTE_ERRORMESSAGE,
|
322
|
+
error?.message || error.toString(),
|
323
|
+
);
|
324
|
+
}
|
325
|
+
|
326
|
+
updateColumnBar.call(this);
|
327
|
+
})
|
328
|
+
.catch((error) => {
|
329
|
+
addAttributeToken(
|
330
|
+
this,
|
331
|
+
ATTRIBUTE_ERRORMESSAGE,
|
332
|
+
error?.message || error.toString(),
|
333
|
+
);
|
334
|
+
});
|
335
|
+
})
|
336
|
+
.catch((error) => {
|
337
|
+
addAttributeToken(
|
338
|
+
this,
|
339
|
+
ATTRIBUTE_ERRORMESSAGE,
|
340
|
+
error?.message || error.toString(),
|
341
|
+
);
|
342
|
+
});
|
343
|
+
}
|
344
|
+
|
345
|
+
/**
|
346
|
+
*
|
347
|
+
* @return {CSSStyleSheet[]}
|
348
|
+
*/
|
349
|
+
static getCSSStyleSheet() {
|
350
|
+
return [DatatableStyleSheet];
|
351
|
+
}
|
352
|
+
|
353
|
+
/**
|
354
|
+
* Copy a row from the datatable
|
355
|
+
* @param {number} fromIndex
|
356
|
+
* @param {number} toIndex
|
357
|
+
* @returns {Monster.Components.Datatable.DataTable}
|
358
|
+
* @fire Monster.Components.Datatable.event:monster-datatable-row-copied
|
359
|
+
*/
|
360
|
+
copyRow(fromIndex, toIndex) {
|
361
|
+
const datasource = this[datasourceLinkedElementSymbol];
|
362
|
+
if (!datasource) {
|
363
|
+
return this;
|
364
|
+
}
|
365
|
+
let d = datasource.data;
|
366
|
+
let c = clone(d);
|
367
|
+
|
368
|
+
let rows = c;
|
369
|
+
const mapping = this.getOption("mapping.data");
|
370
|
+
|
371
|
+
if (mapping) {
|
372
|
+
rows = c?.[mapping];
|
373
|
+
}
|
374
|
+
|
375
|
+
if (rows === undefined || rows === null) {
|
376
|
+
rows = [];
|
377
|
+
}
|
378
|
+
|
379
|
+
if (toIndex === undefined) {
|
380
|
+
toIndex = rows.length;
|
381
|
+
}
|
382
|
+
|
383
|
+
fromIndex = parseInt(fromIndex);
|
384
|
+
toIndex = parseInt(toIndex);
|
385
|
+
|
386
|
+
if (toIndex < 0 || toIndex > rows.length) {
|
387
|
+
throw new RangeError("index out of bounds");
|
388
|
+
}
|
389
|
+
|
390
|
+
validateArray(rows);
|
391
|
+
validateInteger(fromIndex);
|
392
|
+
validateInteger(toIndex);
|
393
|
+
|
394
|
+
if (fromIndex < 0 || fromIndex >= rows.length) {
|
395
|
+
throw new RangeError("index out of bounds");
|
396
|
+
}
|
397
|
+
|
398
|
+
rows.splice(toIndex, 0, clone(rows[fromIndex]));
|
399
|
+
datasource.data = c;
|
400
|
+
|
401
|
+
fireCustomEvent(this, "monster-datatable-row-copied", {
|
402
|
+
index: toIndex,
|
403
|
+
});
|
404
|
+
|
405
|
+
return this;
|
406
|
+
}
|
407
|
+
|
408
|
+
/**
|
409
|
+
* Remove a row from the datatable
|
410
|
+
* @param index
|
411
|
+
* @returns {Monster.Components.Datatable.DataTable}
|
412
|
+
* @fire Monster.Components.Datatable.event:monster-datatable-row-removed
|
413
|
+
*/
|
414
|
+
removeRow(index) {
|
415
|
+
const datasource = this[datasourceLinkedElementSymbol];
|
416
|
+
if (!datasource) {
|
417
|
+
return this;
|
418
|
+
}
|
419
|
+
let d = datasource.data;
|
420
|
+
let c = clone(d);
|
421
|
+
|
422
|
+
let rows = c;
|
423
|
+
const mapping = this.getOption("mapping.data");
|
424
|
+
|
425
|
+
if (mapping) {
|
426
|
+
rows = c?.[mapping];
|
427
|
+
}
|
428
|
+
|
429
|
+
if (rows === undefined || rows === null) {
|
430
|
+
rows = [];
|
431
|
+
}
|
432
|
+
|
433
|
+
index = parseInt(index);
|
434
|
+
|
435
|
+
validateArray(rows);
|
436
|
+
validateInteger(index);
|
437
|
+
if (index < 0 || index >= rows.length) {
|
438
|
+
throw new RangeError("index out of bounds");
|
439
|
+
}
|
440
|
+
if (mapping) {
|
441
|
+
rows = c?.[mapping];
|
442
|
+
}
|
443
|
+
|
444
|
+
rows.splice(index, 1);
|
445
|
+
datasource.data = c;
|
446
|
+
|
447
|
+
fireCustomEvent(this, "monster-datatable-row-removed", {
|
448
|
+
index: index,
|
449
|
+
});
|
450
|
+
|
451
|
+
return this;
|
452
|
+
}
|
453
|
+
|
454
|
+
/**
|
455
|
+
* Add a row to the datatable
|
456
|
+
* @param {Object} data
|
457
|
+
* @returns {Monster.Components.Datatable.DataTable}
|
458
|
+
* @fire Monster.Components.Datatable.event:monster-datatable-row-added
|
459
|
+
**/
|
460
|
+
addRow(data) {
|
461
|
+
const datasource = this[datasourceLinkedElementSymbol];
|
462
|
+
if (!datasource) {
|
463
|
+
return this;
|
464
|
+
}
|
465
|
+
let d = datasource.data;
|
466
|
+
let c = clone(d);
|
467
|
+
|
468
|
+
let rows = c;
|
469
|
+
|
470
|
+
const mapping = this.getOption("mapping.data");
|
471
|
+
if (mapping) {
|
472
|
+
rows = c?.[mapping];
|
473
|
+
}
|
474
|
+
|
475
|
+
if (rows === undefined || rows === null) {
|
476
|
+
rows = [];
|
477
|
+
}
|
478
|
+
|
479
|
+
validateArray(rows);
|
480
|
+
validateObject(data);
|
481
|
+
|
482
|
+
rows.push(data);
|
483
|
+
datasource.data = c;
|
484
|
+
|
485
|
+
fireCustomEvent(this, "monster-datatable-row-added", {
|
486
|
+
index: rows.length - 1,
|
487
|
+
});
|
488
|
+
|
489
|
+
return this;
|
490
|
+
}
|
479
491
|
}
|
480
492
|
|
481
493
|
/**
|
@@ -483,7 +495,7 @@ class DataTable extends CustomElement {
|
|
483
495
|
* @returns {string}
|
484
496
|
*/
|
485
497
|
function getColumnVisibilityConfigKey() {
|
486
|
-
|
498
|
+
return generateUniqueConfigKey("datatable", this?.id, "columns-visibility");
|
487
499
|
}
|
488
500
|
|
489
501
|
/**
|
@@ -491,7 +503,7 @@ function getColumnVisibilityConfigKey() {
|
|
491
503
|
* @returns {string}
|
492
504
|
*/
|
493
505
|
function getFilterConfigKey() {
|
494
|
-
|
506
|
+
return generateUniqueConfigKey("datatable", this?.id, "filter");
|
495
507
|
}
|
496
508
|
|
497
509
|
/**
|
@@ -499,293 +511,291 @@ function getFilterConfigKey() {
|
|
499
511
|
* @returns {Promise}
|
500
512
|
*/
|
501
513
|
function getHostConfig(callback) {
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
});
|
514
|
+
const host = findElementWithSelectorUpwards( this,"monster-host");
|
515
|
+
|
516
|
+
if (!(host && this.id)) {
|
517
|
+
return Promise.resolve({});
|
518
|
+
}
|
519
|
+
|
520
|
+
if (!host || !isFunction(host?.getConfig)) {
|
521
|
+
throw new TypeError("the host must be a monster-host");
|
522
|
+
}
|
523
|
+
|
524
|
+
const configKey = callback.call(this);
|
525
|
+
return host.hasConfig(configKey).then((hasConfig) => {
|
526
|
+
if (hasConfig) {
|
527
|
+
return host.getConfig(configKey);
|
528
|
+
} else {
|
529
|
+
return {};
|
530
|
+
}
|
531
|
+
});
|
521
532
|
}
|
522
533
|
|
523
534
|
/**
|
524
535
|
* @private
|
525
536
|
*/
|
526
537
|
function updateColumnBar() {
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
538
|
+
if (!this[columnBarElementSymbol]) {
|
539
|
+
return;
|
540
|
+
}
|
541
|
+
|
542
|
+
const columns = [];
|
543
|
+
for (const header of this.getOption("headers")) {
|
544
|
+
const mode = header.getInternal("mode");
|
545
|
+
|
546
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_FIXED) {
|
547
|
+
continue;
|
548
|
+
}
|
549
|
+
|
550
|
+
columns.push({
|
551
|
+
visible: mode !== ATTRIBUTE_DATATABLE_MODE_HIDDEN,
|
552
|
+
name: header.label,
|
553
|
+
index: header.index,
|
554
|
+
});
|
555
|
+
}
|
556
|
+
|
557
|
+
this[columnBarElementSymbol].setOption("columns", columns);
|
547
558
|
}
|
548
559
|
|
549
560
|
/**
|
550
561
|
* @private
|
551
562
|
*/
|
552
563
|
function updateHeaderFromColumnBar() {
|
553
|
-
|
554
|
-
|
555
|
-
|
564
|
+
if (!this[columnBarElementSymbol]) {
|
565
|
+
return;
|
566
|
+
}
|
556
567
|
|
557
|
-
|
558
|
-
|
568
|
+
const options = this[columnBarElementSymbol].getOption("columns");
|
569
|
+
if (!isArray(options)) return;
|
559
570
|
|
560
|
-
|
571
|
+
const invisibleMap = {};
|
561
572
|
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
573
|
+
for (let i = 0; i < options.length; i++) {
|
574
|
+
const option = options[i];
|
575
|
+
invisibleMap[option.index] = option.visible;
|
576
|
+
}
|
566
577
|
|
567
|
-
|
568
|
-
|
578
|
+
for (const header of this.getOption("headers")) {
|
579
|
+
const mode = header.getInternal("mode");
|
569
580
|
|
570
|
-
|
571
|
-
|
572
|
-
|
581
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_FIXED) {
|
582
|
+
continue;
|
583
|
+
}
|
573
584
|
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
585
|
+
if (invisibleMap[header.index] === false) {
|
586
|
+
header.setInternal("mode", ATTRIBUTE_DATATABLE_MODE_HIDDEN);
|
587
|
+
} else {
|
588
|
+
header.setInternal("mode", ATTRIBUTE_DATATABLE_MODE_VISIBLE);
|
589
|
+
}
|
590
|
+
}
|
580
591
|
}
|
581
592
|
|
582
593
|
/**
|
583
594
|
* @private
|
584
595
|
*/
|
585
596
|
function updateConfigColumnBar() {
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
}
|
597
|
+
if (!this[columnBarElementSymbol]) {
|
598
|
+
return;
|
599
|
+
}
|
600
|
+
|
601
|
+
const options = this[columnBarElementSymbol].getOption("columns");
|
602
|
+
if (!isArray(options)) return;
|
603
|
+
|
604
|
+
const map = {};
|
605
|
+
for (let i = 0; i < options.length; i++) {
|
606
|
+
const option = options[i];
|
607
|
+
map[option.name] = option.visible;
|
608
|
+
}
|
609
|
+
|
610
|
+
const host = findElementWithSelectorUpwards( this,"monster-host");
|
611
|
+
if (!(host && this.id)) {
|
612
|
+
return;
|
613
|
+
}
|
614
|
+
const configKey = getColumnVisibilityConfigKey.call(this);
|
615
|
+
|
616
|
+
try {
|
617
|
+
host.setConfig(configKey, map);
|
618
|
+
} catch (error) {
|
619
|
+
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, String(error));
|
620
|
+
}
|
611
621
|
}
|
612
622
|
|
613
623
|
/**
|
614
624
|
* @private
|
615
625
|
*/
|
616
626
|
function initEventHandler() {
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
627
|
+
const self = this;
|
628
|
+
|
629
|
+
getWindow().addEventListener("resize", (event) => {
|
630
|
+
updateGrid.call(self);
|
631
|
+
});
|
632
|
+
|
633
|
+
self[columnBarElementSymbol].attachObserver(
|
634
|
+
new Observer((e) => {
|
635
|
+
updateHeaderFromColumnBar.call(self);
|
636
|
+
updateGrid.call(self);
|
637
|
+
updateConfigColumnBar.call(self);
|
638
|
+
}),
|
639
|
+
);
|
640
|
+
|
641
|
+
self[gridHeadersElementSymbol].addEventListener("click", function (event) {
|
642
|
+
let element = null;
|
643
|
+
const datasource = self[datasourceLinkedElementSymbol];
|
644
|
+
if (!datasource) {
|
645
|
+
return;
|
646
|
+
}
|
647
|
+
|
648
|
+
element = findTargetElementFromEvent(event, ATTRIBUTE_DATATABLE_SORTABLE);
|
649
|
+
if (element) {
|
650
|
+
const index = element.parentNode.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
|
651
|
+
const headers = self.getOption("headers");
|
652
|
+
|
653
|
+
event.preventDefault();
|
654
|
+
|
655
|
+
headers[index].changeDirection();
|
656
|
+
|
657
|
+
setTimeout(function () {
|
658
|
+
/** hotfix, normally this should be done via the updater, no idea why this is not possible. */
|
659
|
+
element.setAttribute(
|
660
|
+
ATTRIBUTE_DATATABLE_SORTABLE,
|
661
|
+
`${headers[index].field} ${headers[index].direction}`,
|
662
|
+
);
|
663
|
+
|
664
|
+
storeOrderStatement.call(self, true);
|
665
|
+
}, 0);
|
666
|
+
}
|
667
|
+
});
|
658
668
|
}
|
659
669
|
|
660
670
|
/**
|
661
671
|
* @private
|
662
672
|
*/
|
663
673
|
function initGridAndStructs(hostConfig, headerOrderMap) {
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
674
|
+
const rowID = this.getOption("templateMapping.row-key");
|
675
|
+
|
676
|
+
if (!this[gridElementSymbol]) {
|
677
|
+
throw new Error("no grid element is defined");
|
678
|
+
}
|
679
|
+
|
680
|
+
let template;
|
681
|
+
getSlottedElements.call(this).forEach((e) => {
|
682
|
+
if (e instanceof HTMLTemplateElement && e.id === rowID) {
|
683
|
+
template = e;
|
684
|
+
}
|
685
|
+
});
|
686
|
+
|
687
|
+
if (!template) {
|
688
|
+
throw new Error("no template is defined");
|
689
|
+
}
|
690
|
+
|
691
|
+
const rowCount = template.content.children.length;
|
692
|
+
|
693
|
+
const headers = [];
|
694
|
+
|
695
|
+
for (let i = 0; i < rowCount; i++) {
|
696
|
+
let hClass = "";
|
697
|
+
const row = template.content.children[i];
|
698
|
+
|
699
|
+
let mode = "";
|
700
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_MODE)) {
|
701
|
+
mode = row.getAttribute(ATTRIBUTE_DATATABLE_MODE);
|
702
|
+
}
|
703
|
+
|
704
|
+
let grid = row.getAttribute(ATTRIBUTE_DATATABLE_GRID_TEMPLATE);
|
705
|
+
if (!grid || grid === "" || grid === "auto") {
|
706
|
+
grid = "minmax(0, 1fr)";
|
707
|
+
}
|
708
|
+
|
709
|
+
let label = "";
|
710
|
+
let labelKey = "";
|
711
|
+
|
712
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_HEAD)) {
|
713
|
+
label = row.getAttribute(ATTRIBUTE_DATATABLE_HEAD);
|
714
|
+
labelKey = label;
|
715
|
+
|
716
|
+
try {
|
717
|
+
if (label.startsWith("i18n:")) {
|
718
|
+
label = label.substring(5, label.length);
|
719
|
+
label = getDocumentTranslations().getText(label, label);
|
720
|
+
}
|
721
|
+
} catch (e) {
|
722
|
+
label = "i18n error " + label;
|
723
|
+
}
|
724
|
+
}
|
725
|
+
|
726
|
+
if (!label) {
|
727
|
+
label = i + 1 + "";
|
728
|
+
mode = ATTRIBUTE_DATATABLE_MODE_FIXED;
|
729
|
+
labelKey = label;
|
730
|
+
}
|
731
|
+
|
732
|
+
if (isObject(hostConfig) && hostConfig.hasOwnProperty(label)) {
|
733
|
+
if (hostConfig[label] === false) {
|
734
|
+
mode = ATTRIBUTE_DATATABLE_MODE_HIDDEN;
|
735
|
+
} else {
|
736
|
+
mode = ATTRIBUTE_DATATABLE_MODE_VISIBLE;
|
737
|
+
}
|
738
|
+
}
|
739
|
+
|
740
|
+
let align = "";
|
741
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_ALIGN)) {
|
742
|
+
align = row.getAttribute(ATTRIBUTE_DATATABLE_ALIGN);
|
743
|
+
}
|
744
|
+
|
745
|
+
switch (align) {
|
746
|
+
case "center":
|
747
|
+
hClass = "flex-center";
|
748
|
+
break;
|
749
|
+
case "end":
|
750
|
+
hClass = "flex-end";
|
751
|
+
break;
|
752
|
+
case "start":
|
753
|
+
hClass = "flex-start";
|
754
|
+
break;
|
755
|
+
default:
|
756
|
+
hClass = "flex-start";
|
757
|
+
}
|
758
|
+
|
759
|
+
let field = "";
|
760
|
+
let direction = DIRECTION_NONE;
|
761
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_SORTABLE)) {
|
762
|
+
field = row.getAttribute(ATTRIBUTE_DATATABLE_SORTABLE).trim();
|
763
|
+
const parts = field.split(" ").map((item) => item.trim());
|
764
|
+
field = parts[0];
|
765
|
+
|
766
|
+
if (headerOrderMap.has(field)) {
|
767
|
+
direction = headerOrderMap.get(field);
|
768
|
+
} else if (
|
769
|
+
parts.length === 2 &&
|
770
|
+
[DIRECTION_ASC, DIRECTION_DESC].indexOf(parts[1]) !== -1
|
771
|
+
) {
|
772
|
+
direction = parts[1];
|
773
|
+
}
|
774
|
+
}
|
775
|
+
|
776
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_HIDDEN) {
|
777
|
+
hClass += " hidden";
|
778
|
+
}
|
779
|
+
|
780
|
+
const header = new Header();
|
781
|
+
header.setInternals({
|
782
|
+
field: field,
|
783
|
+
label: label,
|
784
|
+
classes: hClass,
|
785
|
+
index: i,
|
786
|
+
mode: mode,
|
787
|
+
grid: grid,
|
788
|
+
labelKey: labelKey,
|
789
|
+
direction: direction,
|
790
|
+
});
|
791
|
+
|
792
|
+
headers.push(header);
|
793
|
+
}
|
794
|
+
|
795
|
+
this.setOption("headers", headers);
|
796
|
+
setTimeout(() => {
|
797
|
+
storeOrderStatement.call(this, this.getOption("features.autoInit"));
|
798
|
+
}, 0);
|
789
799
|
}
|
790
800
|
|
791
801
|
/**
|
@@ -793,78 +803,75 @@ function initGridAndStructs(hostConfig, headerOrderMap) {
|
|
793
803
|
* @returns {string}
|
794
804
|
*/
|
795
805
|
export function getStoredOrderConfigKey() {
|
796
|
-
|
806
|
+
return generateUniqueConfigKey("datatable", this?.id, "stored-order");
|
797
807
|
}
|
798
808
|
|
799
809
|
/**
|
800
810
|
* @private
|
801
811
|
*/
|
802
812
|
function storeOrderStatement(doFetch) {
|
803
|
-
|
804
|
-
|
805
|
-
|
813
|
+
const headers = this.getOption("headers");
|
814
|
+
const statement = createOrderStatement(headers);
|
815
|
+
setDataSource.call(this, { orderBy: statement }, doFetch);
|
806
816
|
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
}
|
817
|
+
const host = findElementWithSelectorUpwards( this,"monster-host");
|
818
|
+
if (!(host && this.id)) {
|
819
|
+
return;
|
820
|
+
}
|
812
821
|
|
813
|
-
|
822
|
+
const configKey = getStoredOrderConfigKey.call(this);
|
814
823
|
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
824
|
+
// statement explode with , and remove all empty
|
825
|
+
const list = statement.split(",").filter((item) => item.trim() !== "");
|
826
|
+
if (list.length === 0) {
|
827
|
+
return;
|
828
|
+
}
|
820
829
|
|
821
|
-
|
830
|
+
host.setConfig(configKey, list);
|
822
831
|
}
|
823
832
|
|
824
833
|
/**
|
825
834
|
* @private
|
826
835
|
*/
|
827
836
|
function updateGrid() {
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
this[gridHeadersElementSymbol].style.gridTemplateColumns = "auto";
|
867
|
-
}
|
837
|
+
if (!this[gridElementSymbol]) {
|
838
|
+
throw new Error("no grid element is defined");
|
839
|
+
}
|
840
|
+
|
841
|
+
let gridTemplateColumns = "";
|
842
|
+
|
843
|
+
const headers = this.getOption("headers");
|
844
|
+
|
845
|
+
let styles = "";
|
846
|
+
|
847
|
+
for (let i = 0; i < headers.length; i++) {
|
848
|
+
const header = headers[i];
|
849
|
+
|
850
|
+
if (header.mode === ATTRIBUTE_DATATABLE_MODE_HIDDEN) {
|
851
|
+
styles += `[data-monster-role=datatable]>[data-monster-head="${header.labelKey}"] { display: none; }\n`;
|
852
|
+
styles += `[data-monster-role=datatable-headers]>[data-monster-index="${header.index}"] { display: none; }\n`;
|
853
|
+
} else {
|
854
|
+
gridTemplateColumns += `${header.grid} `;
|
855
|
+
}
|
856
|
+
}
|
857
|
+
|
858
|
+
const sheet = new CSSStyleSheet();
|
859
|
+
if (styles !== "") sheet.replaceSync(styles);
|
860
|
+
this.shadowRoot.adoptedStyleSheets = [...DataTable.getCSSStyleSheet(), sheet];
|
861
|
+
|
862
|
+
const bodyWidth = getDocument().body.getBoundingClientRect().width;
|
863
|
+
|
864
|
+
const breakpoint = this.getOption("responsive.breakpoint");
|
865
|
+
|
866
|
+
if (bodyWidth > breakpoint) {
|
867
|
+
this[gridElementSymbol].style.gridTemplateColumns =
|
868
|
+
`${gridTemplateColumns}`;
|
869
|
+
this[gridHeadersElementSymbol].style.gridTemplateColumns =
|
870
|
+
`${gridTemplateColumns}`;
|
871
|
+
} else {
|
872
|
+
this[gridElementSymbol].style.gridTemplateColumns = "auto";
|
873
|
+
this[gridHeadersElementSymbol].style.gridTemplateColumns = "auto";
|
874
|
+
}
|
868
875
|
}
|
869
876
|
|
870
877
|
/**
|
@@ -872,20 +879,20 @@ function updateGrid() {
|
|
872
879
|
* @param {Monster.Components.Datatable.Header[]} headers
|
873
880
|
* @param {bool} doFetch
|
874
881
|
*/
|
875
|
-
function setDataSource({orderBy}, doFetch) {
|
876
|
-
|
882
|
+
function setDataSource({ orderBy }, doFetch) {
|
883
|
+
const datasource = this[datasourceLinkedElementSymbol];
|
877
884
|
|
878
|
-
|
879
|
-
|
880
|
-
|
885
|
+
if (!datasource) {
|
886
|
+
return;
|
887
|
+
}
|
881
888
|
|
882
|
-
|
883
|
-
|
884
|
-
|
889
|
+
if (isFunction(datasource?.setParameters)) {
|
890
|
+
datasource.setParameters({ orderBy });
|
891
|
+
}
|
885
892
|
|
886
|
-
|
887
|
-
|
888
|
-
|
893
|
+
if (doFetch !== false && isFunction(datasource?.fetch)) {
|
894
|
+
datasource.fetch();
|
895
|
+
}
|
889
896
|
}
|
890
897
|
|
891
898
|
/**
|
@@ -893,20 +900,20 @@ function setDataSource({orderBy}, doFetch) {
|
|
893
900
|
* @return {Monster.Components.Datatable.Form}
|
894
901
|
*/
|
895
902
|
function initControlReferences() {
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
903
|
+
if (!this.shadowRoot) {
|
904
|
+
throw new Error("no shadow-root is defined");
|
905
|
+
}
|
906
|
+
|
907
|
+
this[gridElementSymbol] = this.shadowRoot.querySelector(
|
908
|
+
"[data-monster-role=datatable]",
|
909
|
+
);
|
910
|
+
this[gridHeadersElementSymbol] = this.shadowRoot.querySelector(
|
911
|
+
"[data-monster-role=datatable-headers]",
|
912
|
+
);
|
913
|
+
this[columnBarElementSymbol] =
|
914
|
+
this.shadowRoot.querySelector("monster-column-bar");
|
915
|
+
|
916
|
+
return this;
|
910
917
|
}
|
911
918
|
|
912
919
|
/**
|
@@ -916,22 +923,22 @@ function initControlReferences() {
|
|
916
923
|
* @throws {Error} the datasource could not be initialized
|
917
924
|
*/
|
918
925
|
function initOptionsFromArguments() {
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
926
|
+
const options = {};
|
927
|
+
const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
|
928
|
+
|
929
|
+
if (selector) {
|
930
|
+
options.datasource = { selector: selector };
|
931
|
+
}
|
932
|
+
|
933
|
+
const breakpoint = this.getAttribute(
|
934
|
+
ATTRIBUTE_DATATABLE_RESPONSIVE_BREAKPOINT,
|
935
|
+
);
|
936
|
+
if (breakpoint) {
|
937
|
+
options.responsive = {};
|
938
|
+
options.responsive.breakpoint = parseInt(breakpoint);
|
939
|
+
}
|
940
|
+
|
941
|
+
return options;
|
935
942
|
}
|
936
943
|
|
937
944
|
/**
|
@@ -939,14 +946,9 @@ function initOptionsFromArguments() {
|
|
939
946
|
* @return {string}
|
940
947
|
*/
|
941
948
|
function getEmptyTemplate() {
|
942
|
-
|
949
|
+
return `<monster-state data-monster-role="empty-without-action">
|
943
950
|
<div part="visual">
|
944
|
-
|
945
|
-
path {
|
946
|
-
fill: var(--monster-bg-color-primary-4);
|
947
|
-
}
|
948
|
-
</style>
|
949
|
-
<svg width="4rem" height="4rem" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
951
|
+
<svg width="4rem" height="4rem" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
950
952
|
<path d="m21.5 22h-19c-1.378 0-2.5-1.121-2.5-2.5v-7c0-.07.015-.141.044-.205l3.969-8.82c.404-.896 1.299-1.475 2.28-1.475h11.414c.981 0 1.876.579 2.28 1.475l3.969 8.82c.029.064.044.135.044.205v7c0 1.379-1.122 2.5-2.5 2.5zm-20.5-9.393v6.893c0 .827.673 1.5 1.5 1.5h19c.827 0 1.5-.673 1.5-1.5v-6.893l-3.925-8.723c-.242-.536-.779-.884-1.368-.884h-11.414c-.589 0-1.126.348-1.368.885z"/>
|
951
953
|
<path d="m16.807 17h-9.614c-.622 0-1.186-.391-1.404-.973l-1.014-2.703c-.072-.194-.26-.324-.468-.324h-3.557c-.276 0-.5-.224-.5-.5s.224-.5.5-.5h3.557c.622 0 1.186.391 1.405.973l1.013 2.703c.073.194.261.324.468.324h9.613c.208 0 .396-.13.468-.324l1.013-2.703c.22-.582.784-.973 1.406-.973h3.807c.276 0 .5.224.5.5s-.224.5-.5.5h-3.807c-.208 0-.396.13-.468.324l-1.013 2.703c-.219.582-.784.973-1.405.973z"/>
|
952
954
|
</svg>
|
@@ -962,8 +964,8 @@ function getEmptyTemplate() {
|
|
962
964
|
* @return {string}
|
963
965
|
*/
|
964
966
|
function getTemplate() {
|
965
|
-
|
966
|
-
|
967
|
+
// language=HTML
|
968
|
+
return `
|
967
969
|
<div data-monster-role="control" part="control" data-monster-attributes="class path:classes.control">
|
968
970
|
<template id="headers-row">
|
969
971
|
<div data-monster-attributes="class path:headers-row.classes,
|