@schukai/monster 3.65.0 → 3.65.20
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +82 -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 +12 -5
- package/source/components/datatable/columnbar.mjs +10 -1
- package/source/components/datatable/constants.mjs +11 -4
- package/source/components/datatable/dataset.mjs +10 -1
- 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 +757 -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 +11 -3
- package/source/components/datatable/pagination.mjs +14 -5
- package/source/components/datatable/save-button.mjs +279 -270
- package/source/components/datatable/status.mjs +10 -1
- 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 +10 -3
- 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 +10 -3
- 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 -3
- 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,293 @@ 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 document = getDocument();
|
515
|
+
const host = document.querySelector("monster-host");
|
516
|
+
|
517
|
+
if (!(host && this.id)) {
|
518
|
+
return Promise.resolve({});
|
519
|
+
}
|
520
|
+
|
521
|
+
if (!host || !isFunction(host?.getConfig)) {
|
522
|
+
throw new TypeError("the host must be a monster-host");
|
523
|
+
}
|
524
|
+
|
525
|
+
const configKey = callback.call(this);
|
526
|
+
return host.hasConfig(configKey).then((hasConfig) => {
|
527
|
+
if (hasConfig) {
|
528
|
+
return host.getConfig(configKey);
|
529
|
+
} else {
|
530
|
+
return {};
|
531
|
+
}
|
532
|
+
});
|
521
533
|
}
|
522
534
|
|
523
535
|
/**
|
524
536
|
* @private
|
525
537
|
*/
|
526
538
|
function updateColumnBar() {
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
539
|
+
if (!this[columnBarElementSymbol]) {
|
540
|
+
return;
|
541
|
+
}
|
542
|
+
|
543
|
+
const columns = [];
|
544
|
+
for (const header of this.getOption("headers")) {
|
545
|
+
const mode = header.getInternal("mode");
|
546
|
+
|
547
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_FIXED) {
|
548
|
+
continue;
|
549
|
+
}
|
550
|
+
|
551
|
+
columns.push({
|
552
|
+
visible: mode !== ATTRIBUTE_DATATABLE_MODE_HIDDEN,
|
553
|
+
name: header.label,
|
554
|
+
index: header.index,
|
555
|
+
});
|
556
|
+
}
|
557
|
+
|
558
|
+
this[columnBarElementSymbol].setOption("columns", columns);
|
547
559
|
}
|
548
560
|
|
549
561
|
/**
|
550
562
|
* @private
|
551
563
|
*/
|
552
564
|
function updateHeaderFromColumnBar() {
|
553
|
-
|
554
|
-
|
555
|
-
|
565
|
+
if (!this[columnBarElementSymbol]) {
|
566
|
+
return;
|
567
|
+
}
|
556
568
|
|
557
|
-
|
558
|
-
|
569
|
+
const options = this[columnBarElementSymbol].getOption("columns");
|
570
|
+
if (!isArray(options)) return;
|
559
571
|
|
560
|
-
|
572
|
+
const invisibleMap = {};
|
561
573
|
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
574
|
+
for (let i = 0; i < options.length; i++) {
|
575
|
+
const option = options[i];
|
576
|
+
invisibleMap[option.index] = option.visible;
|
577
|
+
}
|
566
578
|
|
567
|
-
|
568
|
-
|
579
|
+
for (const header of this.getOption("headers")) {
|
580
|
+
const mode = header.getInternal("mode");
|
569
581
|
|
570
|
-
|
571
|
-
|
572
|
-
|
582
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_FIXED) {
|
583
|
+
continue;
|
584
|
+
}
|
573
585
|
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
586
|
+
if (invisibleMap[header.index] === false) {
|
587
|
+
header.setInternal("mode", ATTRIBUTE_DATATABLE_MODE_HIDDEN);
|
588
|
+
} else {
|
589
|
+
header.setInternal("mode", ATTRIBUTE_DATATABLE_MODE_VISIBLE);
|
590
|
+
}
|
591
|
+
}
|
580
592
|
}
|
581
593
|
|
582
594
|
/**
|
583
595
|
* @private
|
584
596
|
*/
|
585
597
|
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
|
-
|
598
|
+
if (!this[columnBarElementSymbol]) {
|
599
|
+
return;
|
600
|
+
}
|
601
|
+
|
602
|
+
const options = this[columnBarElementSymbol].getOption("columns");
|
603
|
+
if (!isArray(options)) return;
|
604
|
+
|
605
|
+
const map = {};
|
606
|
+
for (let i = 0; i < options.length; i++) {
|
607
|
+
const option = options[i];
|
608
|
+
map[option.name] = option.visible;
|
609
|
+
}
|
610
|
+
|
611
|
+
const document = getDocument();
|
612
|
+
const host = document.querySelector("monster-host");
|
613
|
+
if (!(host && this.id)) {
|
614
|
+
return;
|
615
|
+
}
|
616
|
+
const configKey = getColumnVisibilityConfigKey.call(this);
|
617
|
+
|
618
|
+
try {
|
619
|
+
host.setConfig(configKey, map);
|
620
|
+
} catch (error) {
|
621
|
+
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, String(error));
|
622
|
+
}
|
611
623
|
}
|
612
624
|
|
613
625
|
/**
|
614
626
|
* @private
|
615
627
|
*/
|
616
628
|
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
|
-
|
629
|
+
const self = this;
|
630
|
+
|
631
|
+
getWindow().addEventListener("resize", (event) => {
|
632
|
+
updateGrid.call(self);
|
633
|
+
});
|
634
|
+
|
635
|
+
self[columnBarElementSymbol].attachObserver(
|
636
|
+
new Observer((e) => {
|
637
|
+
updateHeaderFromColumnBar.call(self);
|
638
|
+
updateGrid.call(self);
|
639
|
+
updateConfigColumnBar.call(self);
|
640
|
+
}),
|
641
|
+
);
|
642
|
+
|
643
|
+
self[gridHeadersElementSymbol].addEventListener("click", function (event) {
|
644
|
+
let element = null;
|
645
|
+
const datasource = self[datasourceLinkedElementSymbol];
|
646
|
+
if (!datasource) {
|
647
|
+
return;
|
648
|
+
}
|
649
|
+
|
650
|
+
element = findTargetElementFromEvent(event, ATTRIBUTE_DATATABLE_SORTABLE);
|
651
|
+
if (element) {
|
652
|
+
const index = element.parentNode.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
|
653
|
+
const headers = self.getOption("headers");
|
654
|
+
|
655
|
+
event.preventDefault();
|
656
|
+
|
657
|
+
headers[index].changeDirection();
|
658
|
+
|
659
|
+
setTimeout(function () {
|
660
|
+
/** hotfix, normally this should be done via the updater, no idea why this is not possible. */
|
661
|
+
element.setAttribute(
|
662
|
+
ATTRIBUTE_DATATABLE_SORTABLE,
|
663
|
+
`${headers[index].field} ${headers[index].direction}`,
|
664
|
+
);
|
665
|
+
|
666
|
+
storeOrderStatement.call(self, true);
|
667
|
+
}, 0);
|
668
|
+
}
|
669
|
+
});
|
658
670
|
}
|
659
671
|
|
660
672
|
/**
|
661
673
|
* @private
|
662
674
|
*/
|
663
675
|
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
|
-
|
676
|
+
const rowID = this.getOption("templateMapping.row-key");
|
677
|
+
|
678
|
+
if (!this[gridElementSymbol]) {
|
679
|
+
throw new Error("no grid element is defined");
|
680
|
+
}
|
681
|
+
|
682
|
+
let template;
|
683
|
+
getSlottedElements.call(this).forEach((e) => {
|
684
|
+
if (e instanceof HTMLTemplateElement && e.id === rowID) {
|
685
|
+
template = e;
|
686
|
+
}
|
687
|
+
});
|
688
|
+
|
689
|
+
if (!template) {
|
690
|
+
throw new Error("no template is defined");
|
691
|
+
}
|
692
|
+
|
693
|
+
const rowCount = template.content.children.length;
|
694
|
+
|
695
|
+
const headers = [];
|
696
|
+
|
697
|
+
for (let i = 0; i < rowCount; i++) {
|
698
|
+
let hClass = "";
|
699
|
+
const row = template.content.children[i];
|
700
|
+
|
701
|
+
let mode = "";
|
702
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_MODE)) {
|
703
|
+
mode = row.getAttribute(ATTRIBUTE_DATATABLE_MODE);
|
704
|
+
}
|
705
|
+
|
706
|
+
let grid = row.getAttribute(ATTRIBUTE_DATATABLE_GRID_TEMPLATE);
|
707
|
+
if (!grid || grid === "" || grid === "auto") {
|
708
|
+
grid = "minmax(0, 1fr)";
|
709
|
+
}
|
710
|
+
|
711
|
+
let label = "";
|
712
|
+
let labelKey = "";
|
713
|
+
|
714
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_HEAD)) {
|
715
|
+
label = row.getAttribute(ATTRIBUTE_DATATABLE_HEAD);
|
716
|
+
labelKey = label;
|
717
|
+
|
718
|
+
try {
|
719
|
+
if (label.startsWith("i18n:")) {
|
720
|
+
label = label.substring(5, label.length);
|
721
|
+
label = getDocumentTranslations().getText(label, label);
|
722
|
+
}
|
723
|
+
} catch (e) {
|
724
|
+
label = "i18n error " + label;
|
725
|
+
}
|
726
|
+
}
|
727
|
+
|
728
|
+
if (!label) {
|
729
|
+
label = i + 1 + "";
|
730
|
+
mode = ATTRIBUTE_DATATABLE_MODE_FIXED;
|
731
|
+
labelKey = label;
|
732
|
+
}
|
733
|
+
|
734
|
+
if (isObject(hostConfig) && hostConfig.hasOwnProperty(label)) {
|
735
|
+
if (hostConfig[label] === false) {
|
736
|
+
mode = ATTRIBUTE_DATATABLE_MODE_HIDDEN;
|
737
|
+
} else {
|
738
|
+
mode = ATTRIBUTE_DATATABLE_MODE_VISIBLE;
|
739
|
+
}
|
740
|
+
}
|
741
|
+
|
742
|
+
let align = "";
|
743
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_ALIGN)) {
|
744
|
+
align = row.getAttribute(ATTRIBUTE_DATATABLE_ALIGN);
|
745
|
+
}
|
746
|
+
|
747
|
+
switch (align) {
|
748
|
+
case "center":
|
749
|
+
hClass = "flex-center";
|
750
|
+
break;
|
751
|
+
case "end":
|
752
|
+
hClass = "flex-end";
|
753
|
+
break;
|
754
|
+
case "start":
|
755
|
+
hClass = "flex-start";
|
756
|
+
break;
|
757
|
+
default:
|
758
|
+
hClass = "flex-start";
|
759
|
+
}
|
760
|
+
|
761
|
+
let field = "";
|
762
|
+
let direction = DIRECTION_NONE;
|
763
|
+
if (row.hasAttribute(ATTRIBUTE_DATATABLE_SORTABLE)) {
|
764
|
+
field = row.getAttribute(ATTRIBUTE_DATATABLE_SORTABLE).trim();
|
765
|
+
const parts = field.split(" ").map((item) => item.trim());
|
766
|
+
field = parts[0];
|
767
|
+
|
768
|
+
if (headerOrderMap.has(field)) {
|
769
|
+
direction = headerOrderMap.get(field);
|
770
|
+
} else if (
|
771
|
+
parts.length === 2 &&
|
772
|
+
[DIRECTION_ASC, DIRECTION_DESC].indexOf(parts[1]) !== -1
|
773
|
+
) {
|
774
|
+
direction = parts[1];
|
775
|
+
}
|
776
|
+
}
|
777
|
+
|
778
|
+
if (mode === ATTRIBUTE_DATATABLE_MODE_HIDDEN) {
|
779
|
+
hClass += " hidden";
|
780
|
+
}
|
781
|
+
|
782
|
+
const header = new Header();
|
783
|
+
header.setInternals({
|
784
|
+
field: field,
|
785
|
+
label: label,
|
786
|
+
classes: hClass,
|
787
|
+
index: i,
|
788
|
+
mode: mode,
|
789
|
+
grid: grid,
|
790
|
+
labelKey: labelKey,
|
791
|
+
direction: direction,
|
792
|
+
});
|
793
|
+
|
794
|
+
headers.push(header);
|
795
|
+
}
|
796
|
+
|
797
|
+
this.setOption("headers", headers);
|
798
|
+
setTimeout(() => {
|
799
|
+
storeOrderStatement.call(this, this.getOption("features.autoInit"));
|
800
|
+
}, 0);
|
789
801
|
}
|
790
802
|
|
791
803
|
/**
|
@@ -793,78 +805,76 @@ function initGridAndStructs(hostConfig, headerOrderMap) {
|
|
793
805
|
* @returns {string}
|
794
806
|
*/
|
795
807
|
export function getStoredOrderConfigKey() {
|
796
|
-
|
808
|
+
return generateUniqueConfigKey("datatable", this?.id, "stored-order");
|
797
809
|
}
|
798
810
|
|
799
811
|
/**
|
800
812
|
* @private
|
801
813
|
*/
|
802
814
|
function storeOrderStatement(doFetch) {
|
803
|
-
|
804
|
-
|
805
|
-
|
815
|
+
const headers = this.getOption("headers");
|
816
|
+
const statement = createOrderStatement(headers);
|
817
|
+
setDataSource.call(this, { orderBy: statement }, doFetch);
|
806
818
|
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
819
|
+
const document = getDocument();
|
820
|
+
const host = document.querySelector("monster-host");
|
821
|
+
if (!(host && this.id)) {
|
822
|
+
return;
|
823
|
+
}
|
812
824
|
|
813
|
-
|
825
|
+
const configKey = getStoredOrderConfigKey.call(this);
|
814
826
|
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
827
|
+
// statement explode with , and remove all empty
|
828
|
+
const list = statement.split(",").filter((item) => item.trim() !== "");
|
829
|
+
if (list.length === 0) {
|
830
|
+
return;
|
831
|
+
}
|
820
832
|
|
821
|
-
|
833
|
+
host.setConfig(configKey, list);
|
822
834
|
}
|
823
835
|
|
824
836
|
/**
|
825
837
|
* @private
|
826
838
|
*/
|
827
839
|
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
|
-
}
|
840
|
+
if (!this[gridElementSymbol]) {
|
841
|
+
throw new Error("no grid element is defined");
|
842
|
+
}
|
843
|
+
|
844
|
+
let gridTemplateColumns = "";
|
845
|
+
|
846
|
+
const headers = this.getOption("headers");
|
847
|
+
|
848
|
+
let styles = "";
|
849
|
+
|
850
|
+
for (let i = 0; i < headers.length; i++) {
|
851
|
+
const header = headers[i];
|
852
|
+
|
853
|
+
if (header.mode === ATTRIBUTE_DATATABLE_MODE_HIDDEN) {
|
854
|
+
styles += `[data-monster-role=datatable]>[data-monster-head="${header.labelKey}"] { display: none; }\n`;
|
855
|
+
styles += `[data-monster-role=datatable-headers]>[data-monster-index="${header.index}"] { display: none; }\n`;
|
856
|
+
} else {
|
857
|
+
gridTemplateColumns += `${header.grid} `;
|
858
|
+
}
|
859
|
+
}
|
860
|
+
|
861
|
+
const sheet = new CSSStyleSheet();
|
862
|
+
if (styles !== "") sheet.replaceSync(styles);
|
863
|
+
this.shadowRoot.adoptedStyleSheets = [...DataTable.getCSSStyleSheet(), sheet];
|
864
|
+
|
865
|
+
const bodyWidth = getDocument().body.getBoundingClientRect().width;
|
866
|
+
|
867
|
+
const breakpoint = this.getOption("responsive.breakpoint");
|
868
|
+
|
869
|
+
if (bodyWidth > breakpoint) {
|
870
|
+
this[gridElementSymbol].style.gridTemplateColumns =
|
871
|
+
`${gridTemplateColumns}`;
|
872
|
+
this[gridHeadersElementSymbol].style.gridTemplateColumns =
|
873
|
+
`${gridTemplateColumns}`;
|
874
|
+
} else {
|
875
|
+
this[gridElementSymbol].style.gridTemplateColumns = "auto";
|
876
|
+
this[gridHeadersElementSymbol].style.gridTemplateColumns = "auto";
|
877
|
+
}
|
868
878
|
}
|
869
879
|
|
870
880
|
/**
|
@@ -872,20 +882,20 @@ function updateGrid() {
|
|
872
882
|
* @param {Monster.Components.Datatable.Header[]} headers
|
873
883
|
* @param {bool} doFetch
|
874
884
|
*/
|
875
|
-
function setDataSource({orderBy}, doFetch) {
|
876
|
-
|
885
|
+
function setDataSource({ orderBy }, doFetch) {
|
886
|
+
const datasource = this[datasourceLinkedElementSymbol];
|
877
887
|
|
878
|
-
|
879
|
-
|
880
|
-
|
888
|
+
if (!datasource) {
|
889
|
+
return;
|
890
|
+
}
|
881
891
|
|
882
|
-
|
883
|
-
|
884
|
-
|
892
|
+
if (isFunction(datasource?.setParameters)) {
|
893
|
+
datasource.setParameters({ orderBy });
|
894
|
+
}
|
885
895
|
|
886
|
-
|
887
|
-
|
888
|
-
|
896
|
+
if (doFetch !== false && isFunction(datasource?.fetch)) {
|
897
|
+
datasource.fetch();
|
898
|
+
}
|
889
899
|
}
|
890
900
|
|
891
901
|
/**
|
@@ -893,20 +903,20 @@ function setDataSource({orderBy}, doFetch) {
|
|
893
903
|
* @return {Monster.Components.Datatable.Form}
|
894
904
|
*/
|
895
905
|
function initControlReferences() {
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
906
|
+
if (!this.shadowRoot) {
|
907
|
+
throw new Error("no shadow-root is defined");
|
908
|
+
}
|
909
|
+
|
910
|
+
this[gridElementSymbol] = this.shadowRoot.querySelector(
|
911
|
+
"[data-monster-role=datatable]",
|
912
|
+
);
|
913
|
+
this[gridHeadersElementSymbol] = this.shadowRoot.querySelector(
|
914
|
+
"[data-monster-role=datatable-headers]",
|
915
|
+
);
|
916
|
+
this[columnBarElementSymbol] =
|
917
|
+
this.shadowRoot.querySelector("monster-column-bar");
|
918
|
+
|
919
|
+
return this;
|
910
920
|
}
|
911
921
|
|
912
922
|
/**
|
@@ -916,22 +926,22 @@ function initControlReferences() {
|
|
916
926
|
* @throws {Error} the datasource could not be initialized
|
917
927
|
*/
|
918
928
|
function initOptionsFromArguments() {
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
929
|
+
const options = {};
|
930
|
+
const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR);
|
931
|
+
|
932
|
+
if (selector) {
|
933
|
+
options.datasource = { selector: selector };
|
934
|
+
}
|
935
|
+
|
936
|
+
const breakpoint = this.getAttribute(
|
937
|
+
ATTRIBUTE_DATATABLE_RESPONSIVE_BREAKPOINT,
|
938
|
+
);
|
939
|
+
if (breakpoint) {
|
940
|
+
options.responsive = {};
|
941
|
+
options.responsive.breakpoint = parseInt(breakpoint);
|
942
|
+
}
|
943
|
+
|
944
|
+
return options;
|
935
945
|
}
|
936
946
|
|
937
947
|
/**
|
@@ -939,14 +949,9 @@ function initOptionsFromArguments() {
|
|
939
949
|
* @return {string}
|
940
950
|
*/
|
941
951
|
function getEmptyTemplate() {
|
942
|
-
|
952
|
+
return `<monster-state data-monster-role="empty-without-action">
|
943
953
|
<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">
|
954
|
+
<svg width="4rem" height="4rem" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
950
955
|
<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
956
|
<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
957
|
</svg>
|
@@ -962,8 +967,8 @@ function getEmptyTemplate() {
|
|
962
967
|
* @return {string}
|
963
968
|
*/
|
964
969
|
function getTemplate() {
|
965
|
-
|
966
|
-
|
970
|
+
// language=HTML
|
971
|
+
return `
|
967
972
|
<div data-monster-role="control" part="control" data-monster-attributes="class path:classes.control">
|
968
973
|
<template id="headers-row">
|
969
974
|
<div data-monster-attributes="class path:headers-row.classes,
|