@uzum-tech/ui 2.3.7 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +63601 -32546
- package/dist/index.mjs +64856 -33810
- package/dist/index.prod.js +3 -3
- package/dist/index.prod.mjs +3 -3
- package/es/_internal/icons/Bold.d.ts +2 -0
- package/es/_internal/icons/Bold.mjs +29 -0
- package/es/_internal/icons/BulletList.d.ts +2 -0
- package/es/_internal/icons/BulletList.mjs +23 -0
- package/es/_internal/icons/HorizontalRule.d.ts +2 -0
- package/es/_internal/icons/HorizontalRule.mjs +14 -0
- package/es/_internal/icons/Italic.d.ts +2 -0
- package/es/_internal/icons/Italic.mjs +19 -0
- package/es/_internal/icons/NumberedList.d.ts +2 -0
- package/es/_internal/icons/NumberedList.mjs +23 -0
- package/es/_internal/icons/Quote.d.ts +2 -0
- package/es/_internal/icons/Quote.mjs +23 -0
- package/es/_internal/icons/SettingsLine.d.ts +2 -0
- package/es/_internal/icons/SettingsLine.mjs +19 -0
- package/es/_internal/icons/Strikethrough.d.ts +2 -0
- package/es/_internal/icons/Strikethrough.mjs +14 -0
- package/es/_internal/icons/index.d.ts +8 -0
- package/es/_internal/icons/index.mjs +8 -0
- package/es/_styles/markdown/markdown-content.cssr.d.ts +6 -0
- package/es/_styles/markdown/markdown-content.cssr.mjs +22 -0
- package/es/_utils/markdown/index.d.ts +3 -2
- package/es/_utils/markdown/index.mjs +2 -1
- package/es/_utils/markdown/render-markdown.d.ts +2 -1
- package/es/_utils/markdown/render-markdown.mjs +1 -1
- package/es/chat/src/Chat.d.ts +261 -24
- package/es/chat/src/Chat.mjs +2 -0
- package/es/chat/src/ChatMainArea.d.ts +81 -8
- package/es/chat/src/ChatMainArea.mjs +111 -355
- package/es/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.d.ts +9084 -0
- package/es/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.mjs +71 -0
- package/es/chat/src/ChatParts/ChatAttachmentButton/interface.d.ts +2645 -0
- package/es/chat/src/ChatParts/ChatAttachmentButton/interface.mjs +19 -0
- package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.d.ts +9070 -0
- package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.mjs +78 -0
- package/es/chat/src/ChatParts/ChatEditingBlock/interface.d.ts +2637 -0
- package/es/chat/src/ChatParts/ChatEditingBlock/interface.mjs +15 -0
- package/es/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.d.ts +89 -0
- package/es/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.mjs +63 -0
- package/es/chat/src/ChatParts/ChatEditorInput/interface.d.ts +42 -0
- package/es/chat/src/ChatParts/ChatEditorInput/interface.mjs +34 -0
- package/es/chat/src/ChatParts/ChatFooter/ChatFooter.d.ts +115 -0
- package/es/chat/src/ChatParts/ChatFooter/ChatFooter.mjs +99 -0
- package/es/chat/src/ChatParts/ChatFooter/interface.d.ts +56 -0
- package/es/chat/src/ChatParts/ChatFooter/interface.mjs +46 -0
- package/es/chat/src/ChatParts/ChatHeader/ChatHeader.d.ts +9205 -0
- package/es/chat/src/ChatParts/ChatHeader/ChatHeader.mjs +219 -0
- package/es/chat/src/ChatParts/ChatHeader/interface.d.ts +2694 -0
- package/es/chat/src/ChatParts/ChatHeader/interface.mjs +67 -0
- package/es/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.d.ts +9142 -0
- package/es/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.mjs +129 -0
- package/es/chat/src/ChatParts/ChatLegacyInput/interface.d.ts +2654 -0
- package/es/chat/src/ChatParts/ChatLegacyInput/interface.mjs +27 -0
- package/es/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.d.ts +148 -0
- package/es/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.mjs +92 -0
- package/es/chat/src/ChatParts/ChatMessagesArea/interface.d.ts +72 -0
- package/es/chat/src/ChatParts/ChatMessagesArea/interface.mjs +58 -0
- package/es/chat/src/interface.d.ts +7 -0
- package/es/chat/src/interface.mjs +4 -0
- package/es/chat/styles/light.d.ts +4 -0
- package/es/chat/styles/light.mjs +18 -0
- package/es/components.d.ts +12933 -32
- package/es/components.mjs +186 -180
- package/es/config-provider/src/internal-interface.d.ts +2 -0
- package/es/data-table/index.d.ts +1 -1
- package/es/data-table/src/ColumnSettings/ColumnSettingsDrawer.d.ts +156 -0
- package/es/data-table/src/ColumnSettings/ColumnSettingsDrawer.mjs +220 -0
- package/es/data-table/src/ColumnSettings/styles.cssr.d.ts +2 -0
- package/es/data-table/src/ColumnSettings/styles.cssr.mjs +25 -0
- package/es/data-table/src/DataTable.d.ts +60 -2
- package/es/data-table/src/DataTable.mjs +99 -23
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +14 -0
- package/es/data-table/src/interface.d.ts +53 -1
- package/es/data-table/src/interface.mjs +18 -1
- package/es/data-table/src/styles/index.cssr.mjs +17 -1
- package/es/data-table/src/use-column-settings.d.ts +2 -0
- package/es/data-table/src/use-column-settings.mjs +124 -0
- package/es/data-table/src/utils/column-utils.d.ts +2 -1
- package/es/data-table/src/utils/column-utils.mjs +6 -0
- package/es/editor/index.d.ts +10 -0
- package/es/editor/index.mjs +5 -0
- package/es/editor/src/Editor.d.ts +3896 -0
- package/es/editor/src/Editor.mjs +220 -0
- package/es/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.d.ts +37 -0
- package/es/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.mjs +63 -0
- package/es/editor/src/EditorParts/BlockTypeSelect/interface.d.ts +21 -0
- package/es/editor/src/EditorParts/BlockTypeSelect/interface.mjs +14 -0
- package/es/editor/src/EditorParts/EditorContent/EditorContent.d.ts +4078 -0
- package/es/editor/src/EditorParts/EditorContent/EditorContent.mjs +154 -0
- package/es/editor/src/EditorParts/EditorContent/index.d.ts +2 -0
- package/es/editor/src/EditorParts/EditorContent/index.mjs +2 -0
- package/es/editor/src/EditorParts/EditorContent/interface.d.ts +1906 -0
- package/es/editor/src/EditorParts/EditorContent/interface.mjs +17 -0
- package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +4582 -0
- package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.mjs +170 -0
- package/es/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.d.ts +11 -0
- package/es/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.mjs +54 -0
- package/es/editor/src/EditorParts/EditorToolbar/index.d.ts +2 -0
- package/es/editor/src/EditorParts/EditorToolbar/index.mjs +2 -0
- package/es/editor/src/EditorParts/EditorToolbar/interface.d.ts +1912 -0
- package/es/editor/src/EditorParts/EditorToolbar/interface.mjs +18 -0
- package/es/editor/src/EditorParts/SendButton/SendButton.d.ts +23 -0
- package/es/editor/src/EditorParts/SendButton/SendButton.mjs +42 -0
- package/es/editor/src/EditorParts/SendButton/interface.d.ts +18 -0
- package/es/editor/src/EditorParts/SendButton/interface.mjs +8 -0
- package/es/editor/src/EditorParts/ToolbarButton/ToolbarButton.d.ts +32 -0
- package/es/editor/src/EditorParts/ToolbarButton/ToolbarButton.mjs +44 -0
- package/es/editor/src/EditorParts/ToolbarButton/interface.d.ts +20 -0
- package/es/editor/src/EditorParts/ToolbarButton/interface.mjs +13 -0
- package/es/editor/src/composables/use-editor-commands.d.ts +8 -0
- package/es/editor/src/composables/use-editor-commands.mjs +69 -0
- package/es/editor/src/composables/use-editor-css-vars.d.ts +4 -0
- package/es/editor/src/composables/use-editor-css-vars.mjs +81 -0
- package/es/editor/src/constants.d.ts +12 -0
- package/es/editor/src/constants.mjs +25 -0
- package/es/editor/src/extensions.d.ts +7 -0
- package/es/editor/src/extensions.mjs +129 -0
- package/es/editor/src/interface.d.ts +2019 -0
- package/es/editor/src/interface.mjs +52 -0
- package/es/editor/src/markdown/constants.d.ts +8 -0
- package/es/editor/src/markdown/constants.mjs +206 -0
- package/es/editor/src/markdown/editor-serializer.d.ts +9 -0
- package/es/editor/src/markdown/editor-serializer.mjs +18 -0
- package/es/editor/src/markdown/escape.d.ts +2 -0
- package/es/editor/src/markdown/escape.mjs +24 -0
- package/es/editor/src/markdown/html.d.ts +1 -0
- package/es/editor/src/markdown/html.mjs +4 -0
- package/es/editor/src/markdown/parser.d.ts +4 -0
- package/es/editor/src/markdown/parser.mjs +36 -0
- package/es/editor/src/markdown/serializer-state.d.ts +10 -0
- package/es/editor/src/markdown/serializer-state.mjs +12 -0
- package/es/editor/src/markdown/serializer.d.ts +3 -0
- package/es/editor/src/markdown/serializer.mjs +8 -0
- package/es/editor/src/styles/index.cssr.d.ts +2 -0
- package/es/editor/src/styles/index.cssr.mjs +119 -0
- package/es/editor/styles/dark.d.ts +630 -0
- package/es/editor/styles/dark.mjs +21 -0
- package/es/editor/styles/index.d.ts +3 -0
- package/es/editor/styles/index.mjs +2 -0
- package/es/editor/styles/light.d.ts +677 -0
- package/es/editor/styles/light.mjs +87 -0
- package/es/editor/tests/fixtures/round-trip.d.ts +12 -0
- package/es/editor/tests/fixtures/round-trip.mjs +98 -0
- package/es/editor/tests/utils.d.ts +7 -0
- package/es/editor/tests/utils.mjs +27 -0
- package/es/locales/common/enUS.d.ts +21 -0
- package/es/locales/common/enUS.mjs +22 -1
- package/es/locales/common/ruRU.mjs +22 -1
- package/es/locales/common/uzUZ.mjs +22 -1
- package/es/locales/common/zhCN.mjs +22 -1
- package/es/message-bubble/src/styles/index.cssr.mjs +4 -17
- package/es/styles.d.ts +1 -0
- package/es/styles.mjs +1 -0
- package/es/themes/dark.mjs +2 -0
- package/es/themes/light.mjs +2 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/_internal/icons/Bold.d.ts +2 -0
- package/lib/_internal/icons/Bold.js +13 -0
- package/lib/_internal/icons/BulletList.d.ts +2 -0
- package/lib/_internal/icons/BulletList.js +13 -0
- package/lib/_internal/icons/HorizontalRule.d.ts +2 -0
- package/lib/_internal/icons/HorizontalRule.js +10 -0
- package/lib/_internal/icons/Italic.d.ts +2 -0
- package/lib/_internal/icons/Italic.js +11 -0
- package/lib/_internal/icons/NumberedList.d.ts +2 -0
- package/lib/_internal/icons/NumberedList.js +13 -0
- package/lib/_internal/icons/Quote.d.ts +2 -0
- package/lib/_internal/icons/Quote.js +13 -0
- package/lib/_internal/icons/SettingsLine.d.ts +2 -0
- package/lib/_internal/icons/SettingsLine.js +11 -0
- package/lib/_internal/icons/Strikethrough.d.ts +2 -0
- package/lib/_internal/icons/Strikethrough.js +10 -0
- package/lib/_internal/icons/index.d.ts +8 -0
- package/lib/_internal/icons/index.js +18 -2
- package/lib/_styles/markdown/markdown-content.cssr.d.ts +6 -0
- package/lib/_styles/markdown/markdown-content.cssr.js +28 -0
- package/lib/_utils/markdown/index.d.ts +3 -2
- package/lib/_utils/markdown/index.js +4 -1
- package/lib/_utils/markdown/render-markdown.d.ts +2 -1
- package/lib/_utils/markdown/render-markdown.js +1 -0
- package/lib/chat/src/Chat.d.ts +261 -24
- package/lib/chat/src/Chat.js +2 -0
- package/lib/chat/src/ChatMainArea.d.ts +81 -8
- package/lib/chat/src/ChatMainArea.js +93 -223
- package/lib/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.d.ts +9084 -0
- package/lib/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.js +52 -0
- package/lib/chat/src/ChatParts/ChatAttachmentButton/interface.d.ts +2645 -0
- package/lib/chat/src/ChatParts/ChatAttachmentButton/interface.js +17 -0
- package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.d.ts +9070 -0
- package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.js +55 -0
- package/lib/chat/src/ChatParts/ChatEditingBlock/interface.d.ts +2637 -0
- package/lib/chat/src/ChatParts/ChatEditingBlock/interface.js +14 -0
- package/lib/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.d.ts +89 -0
- package/lib/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.js +45 -0
- package/lib/chat/src/ChatParts/ChatEditorInput/interface.d.ts +42 -0
- package/lib/chat/src/ChatParts/ChatEditorInput/interface.js +37 -0
- package/lib/chat/src/ChatParts/ChatFooter/ChatFooter.d.ts +115 -0
- package/lib/chat/src/ChatParts/ChatFooter/ChatFooter.js +66 -0
- package/lib/chat/src/ChatParts/ChatFooter/interface.d.ts +56 -0
- package/lib/chat/src/ChatParts/ChatFooter/interface.js +49 -0
- package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.d.ts +9205 -0
- package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.js +164 -0
- package/lib/chat/src/ChatParts/ChatHeader/interface.d.ts +2694 -0
- package/lib/chat/src/ChatParts/ChatHeader/interface.js +53 -0
- package/lib/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.d.ts +9142 -0
- package/lib/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.js +98 -0
- package/lib/chat/src/ChatParts/ChatLegacyInput/interface.d.ts +2654 -0
- package/lib/chat/src/ChatParts/ChatLegacyInput/interface.js +23 -0
- package/lib/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.d.ts +148 -0
- package/lib/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.js +49 -0
- package/lib/chat/src/ChatParts/ChatMessagesArea/interface.d.ts +72 -0
- package/lib/chat/src/ChatParts/ChatMessagesArea/interface.js +61 -0
- package/lib/chat/src/interface.d.ts +7 -0
- package/lib/chat/src/interface.js +3 -0
- package/lib/chat/styles/light.d.ts +4 -0
- package/lib/chat/styles/light.js +19 -0
- package/lib/components.d.ts +12933 -32
- package/lib/components.js +18 -7
- package/lib/config-provider/src/internal-interface.d.ts +2 -0
- package/lib/data-table/index.d.ts +1 -1
- package/lib/data-table/src/ColumnSettings/ColumnSettingsDrawer.d.ts +156 -0
- package/lib/data-table/src/ColumnSettings/ColumnSettingsDrawer.js +181 -0
- package/lib/data-table/src/ColumnSettings/styles.cssr.d.ts +2 -0
- package/lib/data-table/src/ColumnSettings/styles.cssr.js +30 -0
- package/lib/data-table/src/DataTable.d.ts +60 -2
- package/lib/data-table/src/DataTable.js +65 -23
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +14 -0
- package/lib/data-table/src/interface.d.ts +53 -1
- package/lib/data-table/src/interface.js +17 -2
- package/lib/data-table/src/styles/index.cssr.js +17 -1
- package/lib/data-table/src/use-column-settings.d.ts +2 -0
- package/lib/data-table/src/use-column-settings.js +144 -0
- package/lib/data-table/src/utils/column-utils.d.ts +2 -1
- package/lib/data-table/src/utils/column-utils.js +5 -0
- package/lib/editor/index.d.ts +10 -0
- package/lib/editor/index.js +19 -0
- package/lib/editor/src/Editor.d.ts +3896 -0
- package/lib/editor/src/Editor.js +216 -0
- package/lib/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.d.ts +37 -0
- package/lib/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.js +47 -0
- package/lib/editor/src/EditorParts/BlockTypeSelect/interface.d.ts +21 -0
- package/lib/editor/src/EditorParts/BlockTypeSelect/interface.js +17 -0
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.d.ts +4078 -0
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.js +121 -0
- package/lib/editor/src/EditorParts/EditorContent/index.d.ts +2 -0
- package/lib/editor/src/EditorParts/EditorContent/index.js +10 -0
- package/lib/editor/src/EditorParts/EditorContent/interface.d.ts +1906 -0
- package/lib/editor/src/EditorParts/EditorContent/interface.js +8 -0
- package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +4582 -0
- package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.js +126 -0
- package/lib/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.d.ts +11 -0
- package/lib/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.js +52 -0
- package/lib/editor/src/EditorParts/EditorToolbar/index.d.ts +2 -0
- package/lib/editor/src/EditorParts/EditorToolbar/index.js +10 -0
- package/lib/editor/src/EditorParts/EditorToolbar/interface.d.ts +1912 -0
- package/lib/editor/src/EditorParts/EditorToolbar/interface.js +11 -0
- package/lib/editor/src/EditorParts/SendButton/SendButton.d.ts +23 -0
- package/lib/editor/src/EditorParts/SendButton/SendButton.js +31 -0
- package/lib/editor/src/EditorParts/SendButton/interface.d.ts +18 -0
- package/lib/editor/src/EditorParts/SendButton/interface.js +11 -0
- package/lib/editor/src/EditorParts/ToolbarButton/ToolbarButton.d.ts +32 -0
- package/lib/editor/src/EditorParts/ToolbarButton/ToolbarButton.js +34 -0
- package/lib/editor/src/EditorParts/ToolbarButton/interface.d.ts +20 -0
- package/lib/editor/src/EditorParts/ToolbarButton/interface.js +16 -0
- package/lib/editor/src/composables/use-editor-commands.d.ts +8 -0
- package/lib/editor/src/composables/use-editor-commands.js +70 -0
- package/lib/editor/src/composables/use-editor-css-vars.d.ts +4 -0
- package/lib/editor/src/composables/use-editor-css-vars.js +46 -0
- package/lib/editor/src/constants.d.ts +12 -0
- package/lib/editor/src/constants.js +56 -0
- package/lib/editor/src/extensions.d.ts +7 -0
- package/lib/editor/src/extensions.js +136 -0
- package/lib/editor/src/interface.d.ts +2019 -0
- package/lib/editor/src/interface.js +22 -0
- package/lib/editor/src/markdown/constants.d.ts +8 -0
- package/lib/editor/src/markdown/constants.js +201 -0
- package/lib/editor/src/markdown/editor-serializer.d.ts +9 -0
- package/lib/editor/src/markdown/editor-serializer.js +20 -0
- package/lib/editor/src/markdown/escape.d.ts +2 -0
- package/lib/editor/src/markdown/escape.js +31 -0
- package/lib/editor/src/markdown/html.d.ts +1 -0
- package/lib/editor/src/markdown/html.js +9 -0
- package/lib/editor/src/markdown/parser.d.ts +4 -0
- package/lib/editor/src/markdown/parser.js +42 -0
- package/lib/editor/src/markdown/serializer-state.d.ts +10 -0
- package/lib/editor/src/markdown/serializer-state.js +16 -0
- package/lib/editor/src/markdown/serializer.d.ts +3 -0
- package/lib/editor/src/markdown/serializer.js +9 -0
- package/lib/editor/src/styles/index.cssr.d.ts +2 -0
- package/lib/editor/src/styles/index.cssr.js +124 -0
- package/lib/editor/styles/dark.d.ts +630 -0
- package/lib/editor/styles/dark.js +23 -0
- package/lib/editor/styles/index.d.ts +3 -0
- package/lib/editor/styles/index.js +10 -0
- package/lib/editor/styles/light.d.ts +677 -0
- package/lib/editor/styles/light.js +71 -0
- package/lib/editor/tests/fixtures/round-trip.d.ts +12 -0
- package/lib/editor/tests/fixtures/round-trip.js +125 -0
- package/lib/editor/tests/utils.d.ts +7 -0
- package/lib/editor/tests/utils.js +26 -0
- package/lib/locales/common/enUS.d.ts +21 -0
- package/lib/locales/common/enUS.js +22 -1
- package/lib/locales/common/ruRU.js +22 -1
- package/lib/locales/common/uzUZ.js +22 -1
- package/lib/locales/common/zhCN.js +22 -1
- package/lib/message-bubble/src/styles/index.cssr.js +4 -17
- package/lib/styles.d.ts +1 -0
- package/lib/styles.js +127 -125
- package/lib/themes/dark.js +136 -134
- package/lib/themes/light.js +136 -134
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +8 -1
- package/volar.d.ts +3 -0
- package/web-types.json +437 -2
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { computed, defineComponent, h, onMounted, provide, ref, toRef, Transition, useId, watch, watchEffect } from 'vue';
|
|
2
2
|
import { UBaseLoading } from "../../_internal/index.mjs";
|
|
3
|
+
import { UIcon } from "../../_internal/icon/index.mjs";
|
|
4
|
+
import { SettingsLine } from "../../_internal/icons/index.mjs";
|
|
3
5
|
import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
4
|
-
import { createKey, download, resolveSlot, warnOnce } from "../../_utils/index.mjs";
|
|
6
|
+
import { createKey, download, isSlotEmpty, resolveSlot, warnOnce } from "../../_utils/index.mjs";
|
|
7
|
+
import { UButton } from "../../button/index.mjs";
|
|
5
8
|
import { UPagination } from "../../pagination/index.mjs";
|
|
6
9
|
import { dataTableLight } from "../styles/index.mjs";
|
|
10
|
+
import ColumnSettingsDrawer from "./ColumnSettings/ColumnSettingsDrawer.mjs";
|
|
7
11
|
import { dataTableInjectionKey, dataTableProps } from "./interface.mjs";
|
|
8
12
|
import MainTable from "./MainTable.mjs";
|
|
9
13
|
import style from "./styles/index.cssr.mjs";
|
|
10
14
|
import { useCheck } from "./use-check.mjs";
|
|
15
|
+
import { useColumnSettings } from "./use-column-settings.mjs";
|
|
11
16
|
import { useExpand } from "./use-expand.mjs";
|
|
12
17
|
import { useGroupHeader } from "./use-group-header.mjs";
|
|
13
18
|
import { useResizable } from "./use-resizable.mjs";
|
|
@@ -25,6 +30,7 @@ export default defineComponent({
|
|
|
25
30
|
slots,
|
|
26
31
|
emit
|
|
27
32
|
}) {
|
|
33
|
+
var _a;
|
|
28
34
|
const componentId = useId();
|
|
29
35
|
if (process.env.NODE_ENV !== 'production') {
|
|
30
36
|
watchEffect(() => {
|
|
@@ -70,12 +76,38 @@ export default defineComponent({
|
|
|
70
76
|
setResizableWidths,
|
|
71
77
|
resizableWidthsRef
|
|
72
78
|
} = useResizable();
|
|
79
|
+
if (props.localStorageKey && props.resizableStorage !== false) {
|
|
80
|
+
const storedWidths = (_a = loadTableState(props.localStorageKey)) === null || _a === void 0 ? void 0 : _a.columnWidths;
|
|
81
|
+
if (storedWidths && Object.keys(storedWidths).length > 0) {
|
|
82
|
+
resizableWidthsRef.value = Object.assign(Object.assign({}, resizableWidthsRef.value), storedWidths);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const {
|
|
86
|
+
enabledRef: columnSettingsEnabledRef,
|
|
87
|
+
resolvedColumnsRef,
|
|
88
|
+
scrollXRef: columnSettingsScrollXRef,
|
|
89
|
+
columnsConfigRef,
|
|
90
|
+
drawerOpenRef,
|
|
91
|
+
drawerItemsRef,
|
|
92
|
+
defaultDrawerItemsRef,
|
|
93
|
+
openDrawer: openColumnSettings,
|
|
94
|
+
resetConfig: resetColumnSettings,
|
|
95
|
+
applyConfig: applyColumnSettings,
|
|
96
|
+
applyConfigFromKeys: applyColumnSettingsFromKeys
|
|
97
|
+
} = useColumnSettings(props, getResizableWidth);
|
|
98
|
+
const columnsProps = new Proxy(props, {
|
|
99
|
+
get(target, prop, receiver) {
|
|
100
|
+
if (prop === 'columns') return resolvedColumnsRef.value;
|
|
101
|
+
if (prop === 'scrollX') return columnSettingsScrollXRef.value;
|
|
102
|
+
return Reflect.get(target, prop, receiver);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
73
105
|
const {
|
|
74
106
|
rowsRef,
|
|
75
107
|
colsRef,
|
|
76
108
|
dataRelatedColsRef,
|
|
77
109
|
hasEllipsisRef
|
|
78
|
-
} = useGroupHeader(
|
|
110
|
+
} = useGroupHeader(columnsProps, getResizableWidth);
|
|
79
111
|
const {
|
|
80
112
|
treeMateRef,
|
|
81
113
|
mergedCurrentPageRef,
|
|
@@ -100,7 +132,7 @@ export default defineComponent({
|
|
|
100
132
|
clearSorter,
|
|
101
133
|
page,
|
|
102
134
|
sort
|
|
103
|
-
} = useTableData(
|
|
135
|
+
} = useTableData(columnsProps, {
|
|
104
136
|
dataRelatedColsRef
|
|
105
137
|
});
|
|
106
138
|
const downloadCsv = options => {
|
|
@@ -109,7 +141,7 @@ export default defineComponent({
|
|
|
109
141
|
keepOriginalData = false
|
|
110
142
|
} = options || {};
|
|
111
143
|
const data = keepOriginalData ? props.data : rawPaginatedDataRef.value;
|
|
112
|
-
const csvData = generateCsv(
|
|
144
|
+
const csvData = generateCsv(resolvedColumnsRef.value, data, props.getCsvCell, props.getCsvHeader);
|
|
113
145
|
const blob = new Blob([csvData], {
|
|
114
146
|
type: 'text/csv;charset=utf-8'
|
|
115
147
|
});
|
|
@@ -129,7 +161,7 @@ export default defineComponent({
|
|
|
129
161
|
allRowsCheckedRef,
|
|
130
162
|
mergedCheckedRowKeySetRef,
|
|
131
163
|
mergedInderminateRowKeySetRef
|
|
132
|
-
} = useCheck(
|
|
164
|
+
} = useCheck(columnsProps, {
|
|
133
165
|
selectionColumnRef,
|
|
134
166
|
treeMateRef,
|
|
135
167
|
paginatedDataRef
|
|
@@ -140,7 +172,7 @@ export default defineComponent({
|
|
|
140
172
|
renderExpandRef,
|
|
141
173
|
expandableRef,
|
|
142
174
|
doUpdateExpandedRowKeys
|
|
143
|
-
} = useExpand(
|
|
175
|
+
} = useExpand(columnsProps, treeMateRef);
|
|
144
176
|
const {
|
|
145
177
|
draggableColumnRef,
|
|
146
178
|
draggingRowKeySetRef,
|
|
@@ -151,7 +183,7 @@ export default defineComponent({
|
|
|
151
183
|
handleRowDragLeave,
|
|
152
184
|
handleRowDragEnd,
|
|
153
185
|
handleRowDrop
|
|
154
|
-
} = useRowDrag(
|
|
186
|
+
} = useRowDrag(columnsProps, {
|
|
155
187
|
paginatedDataRef,
|
|
156
188
|
mergedCheckedRowKeySetRef,
|
|
157
189
|
mergedClsPrefixRef
|
|
@@ -169,7 +201,7 @@ export default defineComponent({
|
|
|
169
201
|
rightFixedColumnsRef,
|
|
170
202
|
fixedColumnLeftMapRef,
|
|
171
203
|
fixedColumnRightMapRef
|
|
172
|
-
} = useScroll(
|
|
204
|
+
} = useScroll(columnsProps, {
|
|
173
205
|
bodyWidthRef,
|
|
174
206
|
mainTableInstRef,
|
|
175
207
|
mergedCurrentPageRef,
|
|
@@ -181,9 +213,6 @@ export default defineComponent({
|
|
|
181
213
|
if (!key) return;
|
|
182
214
|
const stored = loadTableState(key);
|
|
183
215
|
if (!stored) return;
|
|
184
|
-
if (props.resizableStorage && stored.columnWidths && Object.keys(stored.columnWidths).length > 0) {
|
|
185
|
-
resizableWidthsRef.value = Object.assign(Object.assign({}, resizableWidthsRef.value), stored.columnWidths);
|
|
186
|
-
}
|
|
187
216
|
if (props.pagination && stored.page != null) {
|
|
188
217
|
doUpdatePage(stored.page);
|
|
189
218
|
}
|
|
@@ -209,6 +238,7 @@ export default defineComponent({
|
|
|
209
238
|
return props.localStorageKey ? {
|
|
210
239
|
key: props.localStorageKey,
|
|
211
240
|
columnWidths: resizableWidthsRef.value,
|
|
241
|
+
columnsConfig: columnsConfigRef.value,
|
|
212
242
|
page: (_a = mergedPaginationRef.value) === null || _a === void 0 ? void 0 : _a.page,
|
|
213
243
|
pageSize: (_b = mergedPaginationRef.value) === null || _b === void 0 ? void 0 : _b.pageSize,
|
|
214
244
|
filters: mergedFilterStateRef.value,
|
|
@@ -220,16 +250,17 @@ export default defineComponent({
|
|
|
220
250
|
expandedRowKeys: mergedExpandedRowKeysRef.value
|
|
221
251
|
} : null;
|
|
222
252
|
}, state => {
|
|
223
|
-
var _a, _b;
|
|
253
|
+
var _a, _b, _c;
|
|
224
254
|
if (!(state === null || state === void 0 ? void 0 : state.key)) return;
|
|
225
255
|
saveTableState(state.key, {
|
|
226
256
|
columnWidths: state.columnWidths && Object.keys(state.columnWidths).length ? state.columnWidths : undefined,
|
|
257
|
+
columnsConfig: ((_a = state.columnsConfig) === null || _a === void 0 ? void 0 : _a.length) ? state.columnsConfig : undefined,
|
|
227
258
|
page: state.page,
|
|
228
259
|
pageSize: state.pageSize,
|
|
229
260
|
filters: state.filters,
|
|
230
261
|
sortState: state.sortState.length ? state.sortState : undefined,
|
|
231
|
-
checkedRowKeys: ((
|
|
232
|
-
expandedRowKeys: ((
|
|
262
|
+
checkedRowKeys: ((_b = state.checkedRowKeys) === null || _b === void 0 ? void 0 : _b.length) ? state.checkedRowKeys : undefined,
|
|
263
|
+
expandedRowKeys: ((_c = state.expandedRowKeys) === null || _c === void 0 ? void 0 : _c.length) ? state.expandedRowKeys : undefined
|
|
233
264
|
});
|
|
234
265
|
}, {
|
|
235
266
|
deep: true
|
|
@@ -271,7 +302,7 @@ export default defineComponent({
|
|
|
271
302
|
});
|
|
272
303
|
const containerWidthSignalRef = computed(() => {
|
|
273
304
|
const bodyWidth = bodyWidthRef.value;
|
|
274
|
-
const scrollXWidth = parseLengthToNumber(
|
|
305
|
+
const scrollXWidth = parseLengthToNumber(columnSettingsScrollXRef.value);
|
|
275
306
|
return bodyWidth !== null && bodyWidth > 0 ? bodyWidth : scrollXWidth !== undefined && scrollXWidth > 0 ? scrollXWidth : undefined;
|
|
276
307
|
});
|
|
277
308
|
const widthConstraintSignalRef = computed(() => {
|
|
@@ -425,7 +456,7 @@ export default defineComponent({
|
|
|
425
456
|
}
|
|
426
457
|
};
|
|
427
458
|
const autoSummaryRef = computed(() => {
|
|
428
|
-
const columns =
|
|
459
|
+
const columns = resolvedColumnsRef.value;
|
|
429
460
|
const hasTotalRow = columns.some(col => !('children' in col) && 'totalRow' in col && col.totalRow);
|
|
430
461
|
if (!hasTotalRow) return null;
|
|
431
462
|
return pageData => {
|
|
@@ -506,7 +537,7 @@ export default defineComponent({
|
|
|
506
537
|
emit('edit', value, row, key);
|
|
507
538
|
};
|
|
508
539
|
provide(dataTableInjectionKey, {
|
|
509
|
-
props,
|
|
540
|
+
props: columnsProps,
|
|
510
541
|
sizeRef: toRef(props, 'size'),
|
|
511
542
|
treeMateRef,
|
|
512
543
|
renderExpandIconRef: toRef(props, 'renderExpandIcon'),
|
|
@@ -519,7 +550,7 @@ export default defineComponent({
|
|
|
519
550
|
hoverKeyRef,
|
|
520
551
|
mergedClsPrefixRef,
|
|
521
552
|
mergedThemeRef: themeRef,
|
|
522
|
-
scrollXRef:
|
|
553
|
+
scrollXRef: columnSettingsScrollXRef,
|
|
523
554
|
rowsRef,
|
|
524
555
|
colsRef,
|
|
525
556
|
paginatedDataRef,
|
|
@@ -639,7 +670,10 @@ export default defineComponent({
|
|
|
639
670
|
return summaryResult;
|
|
640
671
|
}
|
|
641
672
|
return null;
|
|
642
|
-
}
|
|
673
|
+
},
|
|
674
|
+
openColumnSettings,
|
|
675
|
+
resetColumnSettings,
|
|
676
|
+
applyColumnSettings
|
|
643
677
|
};
|
|
644
678
|
const cssVarsRef = computed(() => {
|
|
645
679
|
const {
|
|
@@ -773,18 +807,30 @@ export default defineComponent({
|
|
|
773
807
|
mergedShowPagination: mergedShowPaginationRef,
|
|
774
808
|
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
775
809
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
776
|
-
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
810
|
+
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender,
|
|
811
|
+
columnSettingsEnabled: columnSettingsEnabledRef,
|
|
812
|
+
drawerOpen: drawerOpenRef,
|
|
813
|
+
drawerItems: drawerItemsRef,
|
|
814
|
+
defaultDrawerItems: defaultDrawerItemsRef,
|
|
815
|
+
applyColumnSettingsFromKeys,
|
|
816
|
+
locale: localeRef
|
|
777
817
|
}, exposedMethods);
|
|
778
818
|
},
|
|
779
819
|
render() {
|
|
820
|
+
var _a;
|
|
780
821
|
const {
|
|
781
822
|
mergedClsPrefix,
|
|
782
823
|
themeClass,
|
|
783
824
|
onRender,
|
|
784
825
|
$slots,
|
|
785
|
-
spinProps
|
|
826
|
+
spinProps,
|
|
827
|
+
locale,
|
|
828
|
+
mergedTheme,
|
|
829
|
+
columnSettingsTriggerProps
|
|
786
830
|
} = this;
|
|
787
831
|
onRender === null || onRender === void 0 ? void 0 : onRender();
|
|
832
|
+
const hasFilters = !isSlotEmpty($slots.filters);
|
|
833
|
+
const showToolbar = hasFilters || this.columnSettingsEnabled;
|
|
788
834
|
return h("div", {
|
|
789
835
|
class: [`${mergedClsPrefix}-data-table`, themeClass, {
|
|
790
836
|
[`${mergedClsPrefix}-data-table--bordered`]: this.mergedBordered,
|
|
@@ -795,7 +841,23 @@ export default defineComponent({
|
|
|
795
841
|
[`${mergedClsPrefix}-data-table--flex-height`]: this.flexHeight
|
|
796
842
|
}],
|
|
797
843
|
style: this.cssVars
|
|
798
|
-
}, h("div", {
|
|
844
|
+
}, showToolbar ? h("div", {
|
|
845
|
+
class: [`${mergedClsPrefix}-data-table-toolbar`, hasFilters && `${mergedClsPrefix}-data-table-toolbar--with-filters`]
|
|
846
|
+
}, hasFilters ? h("div", {
|
|
847
|
+
class: `${mergedClsPrefix}-data-table-toolbar__filters`
|
|
848
|
+
}, (_a = $slots.filters) === null || _a === void 0 ? void 0 : _a.call($slots)) : null, this.columnSettingsEnabled ? resolveSlot($slots['column-settings-trigger'], () => [h(UButton, Object.assign({
|
|
849
|
+
secondary: true,
|
|
850
|
+
round: true,
|
|
851
|
+
size: "small",
|
|
852
|
+
class: `${mergedClsPrefix}-data-table-toolbar-button`,
|
|
853
|
+
theme: mergedTheme.peers.Button,
|
|
854
|
+
themeOverrides: mergedTheme.peerOverrides.Button,
|
|
855
|
+
renderIcon: () => h(UIcon, null, {
|
|
856
|
+
default: () => h(SettingsLine)
|
|
857
|
+
})
|
|
858
|
+
}, columnSettingsTriggerProps, {
|
|
859
|
+
onClick: this.openColumnSettings
|
|
860
|
+
}), locale.columnSettingsButton)]) : null) : null, h("div", {
|
|
799
861
|
class: `${mergedClsPrefix}-data-table-wrapper`
|
|
800
862
|
}, h(MainTable, {
|
|
801
863
|
ref: "mainTableInstRef",
|
|
@@ -819,6 +881,20 @@ export default defineComponent({
|
|
|
819
881
|
strokeWidth: 20
|
|
820
882
|
}, spinProps))])) : null;
|
|
821
883
|
}
|
|
822
|
-
})
|
|
884
|
+
}), this.columnSettingsEnabled ? h(ColumnSettingsDrawer, {
|
|
885
|
+
show: this.drawerOpen,
|
|
886
|
+
items: this.drawerItems,
|
|
887
|
+
defaultItems: this.defaultDrawerItems,
|
|
888
|
+
title: locale.columnSettingsTitle,
|
|
889
|
+
subtitle: locale.columnSettingsSubtitle,
|
|
890
|
+
selectAllText: locale.columnSettingsSelectAll,
|
|
891
|
+
resetText: locale.columnSettingsReset,
|
|
892
|
+
cancelText: locale.columnSettingsCancel,
|
|
893
|
+
applyText: locale.columnSettingsApply,
|
|
894
|
+
'onUpdate:show': value => {
|
|
895
|
+
this.drawerOpen = value;
|
|
896
|
+
},
|
|
897
|
+
onApply: this.applyColumnSettingsFromKeys
|
|
898
|
+
}) : null);
|
|
823
899
|
}
|
|
824
900
|
});
|
|
@@ -3819,11 +3819,25 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
3819
3819
|
uncheckTableAll: string;
|
|
3820
3820
|
confirm: string;
|
|
3821
3821
|
clear: string;
|
|
3822
|
+
columnSettingsTitle: string;
|
|
3823
|
+
columnSettingsButton: string;
|
|
3824
|
+
columnSettingsSubtitle: string;
|
|
3825
|
+
columnSettingsSelectAll: string;
|
|
3826
|
+
columnSettingsReset: string;
|
|
3827
|
+
columnSettingsCancel: string;
|
|
3828
|
+
columnSettingsApply: string;
|
|
3822
3829
|
}, {
|
|
3823
3830
|
checkTableAll: string;
|
|
3824
3831
|
uncheckTableAll: string;
|
|
3825
3832
|
confirm: string;
|
|
3826
3833
|
clear: string;
|
|
3834
|
+
columnSettingsTitle: string;
|
|
3835
|
+
columnSettingsButton: string;
|
|
3836
|
+
columnSettingsSubtitle: string;
|
|
3837
|
+
columnSettingsSelectAll: string;
|
|
3838
|
+
columnSettingsReset: string;
|
|
3839
|
+
columnSettingsCancel: string;
|
|
3840
|
+
columnSettingsApply: string;
|
|
3827
3841
|
}>;
|
|
3828
3842
|
checkboxGroupValue: import("vue").ComputedRef<FilterOptionValue[] | null>;
|
|
3829
3843
|
radioGroupValue: import("vue").ComputedRef<FilterOptionValue | null>;
|
|
@@ -3,6 +3,7 @@ import type { ComputedRef, CSSProperties, ExtractPropTypes, HTMLAttributes, Prop
|
|
|
3
3
|
import type { BaseLoadingExposedProps } from '../../_internal';
|
|
4
4
|
import type { MergedTheme } from '../../_mixins';
|
|
5
5
|
import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
|
|
6
|
+
import type { ButtonProps } from '../../button';
|
|
6
7
|
import type { EllipsisProps } from '../../ellipsis/src/Ellipsis';
|
|
7
8
|
import type { EmptyProps } from '../../empty';
|
|
8
9
|
import type { ULocale } from '../../locales';
|
|
@@ -11,6 +12,11 @@ import type { ScrollbarProps, ScrollTo } from '../../scrollbar/src/Scrollbar';
|
|
|
11
12
|
import type { DataTableTheme } from '../styles';
|
|
12
13
|
import type { DataTableGetCsvCell, DataTableGetCsvHeader, DataTableSize } from './public-types';
|
|
13
14
|
import type { ColItem, RowItem } from './use-group-header';
|
|
15
|
+
export declare enum TableColumnType {
|
|
16
|
+
SELECTION = "selection",
|
|
17
|
+
EXPAND = "expand",
|
|
18
|
+
DRAGGABLE = "draggable"
|
|
19
|
+
}
|
|
14
20
|
export declare const dataTableProps: {
|
|
15
21
|
readonly onUnstableColumnResize: PropType<(resizedWidth: number, limitedWidth: number, column: TableBaseColumn, getColumnWidth: (key: ColumnKey) => number | undefined) => void>;
|
|
16
22
|
readonly pagination: {
|
|
@@ -106,7 +112,18 @@ export declare const dataTableProps: {
|
|
|
106
112
|
readonly default: "current";
|
|
107
113
|
};
|
|
108
114
|
readonly scrollbarProps: PropType<ScrollbarProps>;
|
|
109
|
-
readonly localStorageKey:
|
|
115
|
+
readonly localStorageKey: {
|
|
116
|
+
readonly type: StringConstructor;
|
|
117
|
+
readonly default: undefined;
|
|
118
|
+
};
|
|
119
|
+
readonly columnSettings: {
|
|
120
|
+
readonly type: BooleanConstructor;
|
|
121
|
+
readonly default: false;
|
|
122
|
+
};
|
|
123
|
+
readonly columnSettingsTriggerProps: {
|
|
124
|
+
readonly type: PropType<Partial<ButtonProps>>;
|
|
125
|
+
readonly default: undefined;
|
|
126
|
+
};
|
|
110
127
|
readonly renderCell: PropType<(value: any, rowData: object, column: TableBaseColumn) => VNodeChild>;
|
|
111
128
|
readonly defaultEmptyValue: PropType<string | (() => VNodeChild) | undefined>;
|
|
112
129
|
readonly renderExpandIcon: PropType<RenderExpandIcon>;
|
|
@@ -3764,6 +3781,8 @@ export interface DataTableSlots {
|
|
|
3764
3781
|
empty?: () => VNode[];
|
|
3765
3782
|
loading?: () => VNode[];
|
|
3766
3783
|
'drag-handle'?: () => VNode[];
|
|
3784
|
+
filters?: () => VNode[];
|
|
3785
|
+
'column-settings-trigger'?: () => VNode[];
|
|
3767
3786
|
}
|
|
3768
3787
|
export type RowData = Record<string, any>;
|
|
3769
3788
|
export type InternalRowData = Record<string, unknown>;
|
|
@@ -3799,6 +3818,7 @@ export interface CommonColumnInfo<T = InternalRowData> {
|
|
|
3799
3818
|
cellProps?: (rowData: T, rowIndex: number) => HTMLAttributes;
|
|
3800
3819
|
allowExport?: boolean;
|
|
3801
3820
|
visible?: boolean;
|
|
3821
|
+
required?: boolean;
|
|
3802
3822
|
}
|
|
3803
3823
|
export interface TableColumnMaskObject {
|
|
3804
3824
|
postProcess: (value: string) => string;
|
|
@@ -4104,8 +4124,37 @@ export interface MainTableInjection {
|
|
|
4104
4124
|
leftActiveFixedColKey: ColumnKey | null;
|
|
4105
4125
|
rightActiveFixedColKey: ColumnKey | null;
|
|
4106
4126
|
}
|
|
4127
|
+
export interface DataTableColumnConfigState {
|
|
4128
|
+
key: string;
|
|
4129
|
+
order: number;
|
|
4130
|
+
hidden: boolean;
|
|
4131
|
+
}
|
|
4132
|
+
export interface DataTableColumnSettingsItem {
|
|
4133
|
+
key: string;
|
|
4134
|
+
title: string;
|
|
4135
|
+
visible: boolean;
|
|
4136
|
+
required: boolean;
|
|
4137
|
+
sortOrder: number;
|
|
4138
|
+
}
|
|
4139
|
+
export type DataTableConfigurableColumn = TableBaseColumn & {
|
|
4140
|
+
key: string | number;
|
|
4141
|
+
};
|
|
4142
|
+
export interface UseColumnSettingsReturn {
|
|
4143
|
+
enabledRef: ComputedRef<boolean>;
|
|
4144
|
+
resolvedColumnsRef: ComputedRef<TableColumns>;
|
|
4145
|
+
scrollXRef: ComputedRef<string | number | undefined>;
|
|
4146
|
+
columnsConfigRef: Ref<DataTableColumnConfigState[] | null>;
|
|
4147
|
+
drawerOpenRef: Ref<boolean>;
|
|
4148
|
+
drawerItemsRef: ComputedRef<DataTableColumnSettingsItem[]>;
|
|
4149
|
+
defaultDrawerItemsRef: ComputedRef<DataTableColumnSettingsItem[]>;
|
|
4150
|
+
openDrawer: () => void;
|
|
4151
|
+
resetConfig: () => void;
|
|
4152
|
+
applyConfig: (config: DataTableColumnConfigState[]) => void;
|
|
4153
|
+
applyConfigFromKeys: (orderedKeys: string[], hiddenKeys: string[]) => void;
|
|
4154
|
+
}
|
|
4107
4155
|
export interface DataTableStorageState {
|
|
4108
4156
|
columnWidths?: Record<string, number>;
|
|
4157
|
+
columnsConfig?: DataTableColumnConfigState[];
|
|
4109
4158
|
page?: number;
|
|
4110
4159
|
pageSize?: number;
|
|
4111
4160
|
filters?: FilterState;
|
|
@@ -4170,6 +4219,9 @@ export interface DataTableInst {
|
|
|
4170
4219
|
totalRows: InternalRowData | null;
|
|
4171
4220
|
};
|
|
4172
4221
|
getTotalRowData: () => InternalRowData | null;
|
|
4222
|
+
openColumnSettings: () => void;
|
|
4223
|
+
resetColumnSettings: () => void;
|
|
4224
|
+
applyColumnSettings: (config: DataTableColumnConfigState[]) => void;
|
|
4173
4225
|
/** @deprecated it but just leave it here, it does no harm */
|
|
4174
4226
|
clearFilter: () => void;
|
|
4175
4227
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { useTheme } from "../../_mixins/index.mjs";
|
|
2
2
|
import { createInjectionKey } from "../../_utils/index.mjs";
|
|
3
|
+
export var TableColumnType;
|
|
4
|
+
(function (TableColumnType) {
|
|
5
|
+
TableColumnType["SELECTION"] = "selection";
|
|
6
|
+
TableColumnType["EXPAND"] = "expand";
|
|
7
|
+
TableColumnType["DRAGGABLE"] = "draggable";
|
|
8
|
+
})(TableColumnType || (TableColumnType = {}));
|
|
3
9
|
export const dataTableProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
4
10
|
onUnstableColumnResize: Function,
|
|
5
11
|
pagination: {
|
|
@@ -96,7 +102,18 @@ export const dataTableProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
|
96
102
|
default: 'current'
|
|
97
103
|
},
|
|
98
104
|
scrollbarProps: Object,
|
|
99
|
-
localStorageKey:
|
|
105
|
+
localStorageKey: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: undefined
|
|
108
|
+
},
|
|
109
|
+
columnSettings: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false
|
|
112
|
+
},
|
|
113
|
+
columnSettingsTriggerProps: {
|
|
114
|
+
type: Object,
|
|
115
|
+
default: undefined
|
|
116
|
+
},
|
|
100
117
|
renderCell: Function,
|
|
101
118
|
defaultEmptyValue: [String, Function],
|
|
102
119
|
renderExpandIcon: Function,
|
|
@@ -59,7 +59,23 @@ export default c([cB('data-table', `
|
|
|
59
59
|
--u-merged-th-color-hover: var(--u-th-color-hover);
|
|
60
60
|
--u-merged-td-color-hover: var(--u-td-color-hover);
|
|
61
61
|
--u-merged-td-color-striped: var(--u-td-color-striped);
|
|
62
|
-
`, [cB('data-table-
|
|
62
|
+
`, [cB('data-table-toolbar', `
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: flex-end;
|
|
66
|
+
gap: 16px;
|
|
67
|
+
margin-bottom: 12px;
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
`, [cM('with-filters', `
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
`), cE('filters', `
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
flex: 1;
|
|
75
|
+
min-width: 0;
|
|
76
|
+
`)]), cB('data-table-toolbar-button', `
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
`), cB('data-table-wrapper', `
|
|
63
79
|
flex-grow: 1;
|
|
64
80
|
display: flex;
|
|
65
81
|
flex-direction: column;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { computed, ref } from 'vue';
|
|
2
|
+
import { TableColumnType } from "./interface.mjs";
|
|
3
|
+
import { loadTableState } from "./use-table-storage.mjs";
|
|
4
|
+
import { getNumberColWidth } from "./utils/index.mjs";
|
|
5
|
+
function isConfigurableColumn(column) {
|
|
6
|
+
if ('children' in column) return false;
|
|
7
|
+
if (column.type === TableColumnType.SELECTION || column.type === TableColumnType.EXPAND || column.type === TableColumnType.DRAGGABLE) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return column.visible !== false;
|
|
11
|
+
}
|
|
12
|
+
function toColumnTitle(column) {
|
|
13
|
+
return typeof column.title === 'string' ? column.title : String(column.key);
|
|
14
|
+
}
|
|
15
|
+
function calcColumnsScrollX(columns, getResizableWidth) {
|
|
16
|
+
let total = 0;
|
|
17
|
+
for (const column of columns) {
|
|
18
|
+
if (!('key' in column)) return undefined;
|
|
19
|
+
const resized = getResizableWidth === null || getResizableWidth === void 0 ? void 0 : getResizableWidth(column.key);
|
|
20
|
+
const width = resized !== null && resized !== void 0 ? resized : getNumberColWidth(column);
|
|
21
|
+
if (width === undefined) return undefined;
|
|
22
|
+
total += width;
|
|
23
|
+
}
|
|
24
|
+
return total;
|
|
25
|
+
}
|
|
26
|
+
export function useColumnSettings(props, getResizableWidth) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const enabledRef = computed(() => !!props.columnSettings && !!props.localStorageKey);
|
|
29
|
+
const columnsConfigRef = ref(props.localStorageKey ? (_b = (_a = loadTableState(props.localStorageKey)) === null || _a === void 0 ? void 0 : _a.columnsConfig) !== null && _b !== void 0 ? _b : null : null);
|
|
30
|
+
const drawerOpenRef = ref(false);
|
|
31
|
+
const configurableColumnsRef = computed(() => {
|
|
32
|
+
return props.columns.filter(isConfigurableColumn);
|
|
33
|
+
});
|
|
34
|
+
const visibleColumnsRef = computed(() => {
|
|
35
|
+
const cols = configurableColumnsRef.value;
|
|
36
|
+
const config = columnsConfigRef.value;
|
|
37
|
+
if (!enabledRef.value || !config) return props.columns;
|
|
38
|
+
const stateMap = new Map(config.map(state => [state.key, state]));
|
|
39
|
+
const specialColumns = props.columns.filter(column => {
|
|
40
|
+
if ('children' in column) return true;
|
|
41
|
+
return column.type === TableColumnType.SELECTION || column.type === TableColumnType.EXPAND || column.type === TableColumnType.DRAGGABLE;
|
|
42
|
+
});
|
|
43
|
+
const ordered = [...cols].filter(col => {
|
|
44
|
+
var _a;
|
|
45
|
+
return !((_a = stateMap.get(String(col.key))) === null || _a === void 0 ? void 0 : _a.hidden);
|
|
46
|
+
}).sort((left, right) => {
|
|
47
|
+
var _a, _b, _c, _d;
|
|
48
|
+
const leftOrder = (_b = (_a = stateMap.get(String(left.key))) === null || _a === void 0 ? void 0 : _a.order) !== null && _b !== void 0 ? _b : config.length;
|
|
49
|
+
const rightOrder = (_d = (_c = stateMap.get(String(right.key))) === null || _c === void 0 ? void 0 : _c.order) !== null && _d !== void 0 ? _d : config.length;
|
|
50
|
+
return leftOrder - rightOrder;
|
|
51
|
+
});
|
|
52
|
+
return [...specialColumns, ...ordered];
|
|
53
|
+
});
|
|
54
|
+
function openDrawer() {
|
|
55
|
+
drawerOpenRef.value = true;
|
|
56
|
+
}
|
|
57
|
+
function resetConfig() {
|
|
58
|
+
columnsConfigRef.value = null;
|
|
59
|
+
}
|
|
60
|
+
function applyConfig(config) {
|
|
61
|
+
columnsConfigRef.value = config.map((item, index) => {
|
|
62
|
+
var _a;
|
|
63
|
+
return {
|
|
64
|
+
key: item.key,
|
|
65
|
+
order: (_a = item.order) !== null && _a !== void 0 ? _a : index,
|
|
66
|
+
hidden: !!item.hidden
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function applyConfigFromKeys(orderedKeys, hiddenKeys) {
|
|
71
|
+
const hiddenSet = new Set(hiddenKeys);
|
|
72
|
+
applyConfig(orderedKeys.map((key, index) => ({
|
|
73
|
+
key,
|
|
74
|
+
order: index,
|
|
75
|
+
hidden: hiddenSet.has(key)
|
|
76
|
+
})));
|
|
77
|
+
}
|
|
78
|
+
const resolvedColumnsRef = computed(() => {
|
|
79
|
+
if (!enabledRef.value) return props.columns;
|
|
80
|
+
return visibleColumnsRef.value;
|
|
81
|
+
});
|
|
82
|
+
const scrollXRef = computed(() => {
|
|
83
|
+
if (!enabledRef.value) return props.scrollX;
|
|
84
|
+
if (props.scrollX !== undefined) return props.scrollX;
|
|
85
|
+
return calcColumnsScrollX(visibleColumnsRef.value, getResizableWidth);
|
|
86
|
+
});
|
|
87
|
+
const defaultDrawerItemsRef = computed(() => configurableColumnsRef.value.map((col, index) => ({
|
|
88
|
+
key: String(col.key),
|
|
89
|
+
title: toColumnTitle(col),
|
|
90
|
+
visible: true,
|
|
91
|
+
required: !!col.required,
|
|
92
|
+
sortOrder: index
|
|
93
|
+
})));
|
|
94
|
+
const drawerItemsRef = computed(() => {
|
|
95
|
+
const cols = configurableColumnsRef.value;
|
|
96
|
+
const config = columnsConfigRef.value;
|
|
97
|
+
const stateMap = config ? new Map(config.map(state => [state.key, state])) : new Map();
|
|
98
|
+
return cols.map((col, defaultIndex) => {
|
|
99
|
+
var _a;
|
|
100
|
+
const key = String(col.key);
|
|
101
|
+
const state = stateMap.get(key);
|
|
102
|
+
return {
|
|
103
|
+
key,
|
|
104
|
+
title: toColumnTitle(col),
|
|
105
|
+
visible: state ? !state.hidden : true,
|
|
106
|
+
required: !!col.required,
|
|
107
|
+
sortOrder: (_a = state === null || state === void 0 ? void 0 : state.order) !== null && _a !== void 0 ? _a : defaultIndex
|
|
108
|
+
};
|
|
109
|
+
}).sort((left, right) => left.sortOrder - right.sortOrder);
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
enabledRef,
|
|
113
|
+
resolvedColumnsRef,
|
|
114
|
+
scrollXRef,
|
|
115
|
+
columnsConfigRef,
|
|
116
|
+
drawerOpenRef,
|
|
117
|
+
drawerItemsRef,
|
|
118
|
+
defaultDrawerItemsRef,
|
|
119
|
+
openDrawer,
|
|
120
|
+
resetConfig,
|
|
121
|
+
applyConfig,
|
|
122
|
+
applyConfigFromKeys
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'vue';
|
|
2
|
-
import type { CreateRowClassName, DataRelatedColumn, InternalRowData, TableColumn } from '../interface';
|
|
2
|
+
import type { CreateRowClassName, DataRelatedColumn, DataTableColumnSettingsItem, InternalRowData, TableColumn } from '../interface';
|
|
3
3
|
export declare const SELECTION_COL_WIDTH = 40;
|
|
4
4
|
export declare const EXPAND_COL_WIDTH = 40;
|
|
5
5
|
export declare const DRAGGABLE_COL_WIDTH = 40;
|
|
@@ -12,3 +12,4 @@ export declare function isColumnSortable(column: TableColumn): boolean;
|
|
|
12
12
|
export declare function isColumnEllipsisEnabled(column: Pick<TableColumn, 'ellipsis'>): boolean;
|
|
13
13
|
export declare function isColumnResizable(column: TableColumn): boolean;
|
|
14
14
|
export declare function isColumnFilterable(column: TableColumn): boolean;
|
|
15
|
+
export declare function withSortSteps(items: DataTableColumnSettingsItem[]): DataTableColumnSettingsItem[];
|
|
@@ -89,4 +89,10 @@ export function isColumnResizable(column) {
|
|
|
89
89
|
export function isColumnFilterable(column) {
|
|
90
90
|
if ('children' in column) return false;
|
|
91
91
|
return !!column.filter && (!!column.filterOptions || !!column.renderFilterMenu);
|
|
92
|
+
}
|
|
93
|
+
const SORT_ORDER_STEP = 1000;
|
|
94
|
+
export function withSortSteps(items) {
|
|
95
|
+
return items.map((item, index) => Object.assign(Object.assign({}, item), {
|
|
96
|
+
sortOrder: index * SORT_ORDER_STEP
|
|
97
|
+
}));
|
|
92
98
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as UEditor } from './src/Editor';
|
|
2
|
+
export type { BlockTypeSelectProps } from './src/EditorParts/BlockTypeSelect/interface';
|
|
3
|
+
export { editorContentProps, type EditorContentProps, UEditorContent } from './src/EditorParts/EditorContent';
|
|
4
|
+
export { type EditorToolbarProps, editorToolbarProps, UEditorToolbar } from './src/EditorParts/EditorToolbar';
|
|
5
|
+
export type { SendButtonProps } from './src/EditorParts/SendButton/interface';
|
|
6
|
+
export type { ToolbarButtonProps } from './src/EditorParts/ToolbarButton/interface';
|
|
7
|
+
export { createEditorExtensions } from './src/extensions';
|
|
8
|
+
export { editorInjectionKey, editorProps } from './src/interface';
|
|
9
|
+
export type { EditorInst, EditorProps, EditorSlots, EditorToolbar, EditorToolbarItemKey } from './src/interface';
|
|
10
|
+
export type { Editor } from '@tiptap/vue-3';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as UEditor } from "./src/Editor.mjs";
|
|
2
|
+
export { editorContentProps, UEditorContent } from "./src/EditorParts/EditorContent/index.mjs";
|
|
3
|
+
export { editorToolbarProps, UEditorToolbar } from "./src/EditorParts/EditorToolbar/index.mjs";
|
|
4
|
+
export { createEditorExtensions } from "./src/extensions.mjs";
|
|
5
|
+
export { editorInjectionKey, editorProps } from "./src/interface.mjs";
|