@mixd-id/web-scaffold 0.2.250801010 → 0.2.250801012
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/docs/components/AccountIcon.md +16 -0
- package/docs/components/Ahref.md +35 -0
- package/docs/components/Alert.md +72 -0
- package/docs/components/ArrayList.md +39 -0
- package/docs/components/Article.md +28 -0
- package/docs/components/BarChart.md +81 -0
- package/docs/components/Block.md +23 -0
- package/docs/components/Box.md +15 -0
- package/docs/components/Button.md +68 -0
- package/docs/components/Card.md +67 -0
- package/docs/components/Carousel.md +70 -0
- package/docs/components/Cart.md +20 -0
- package/docs/components/CartIcon.md +29 -0
- package/docs/components/Chart.md +53 -0
- package/docs/components/ChartBar.md +34 -0
- package/docs/components/ChatTyping.md +21 -0
- package/docs/components/Checkbox.md +63 -0
- package/docs/components/CodeEditor.md +25 -0
- package/docs/components/CollapsiblePanel.md +41 -0
- package/docs/components/ColorPicker.md +52 -0
- package/docs/components/Confirm.md +62 -0
- package/docs/components/ContextMenu.md +76 -0
- package/docs/components/ContextMenuItem.md +29 -0
- package/docs/components/CopyToClipboard.md +43 -0
- package/docs/components/Countdown.md +47 -0
- package/docs/components/Datepicker.md +61 -0
- package/docs/components/Datetimepicker.md +57 -0
- package/docs/components/DayTimeRange.md +20 -0
- package/docs/components/Dropdown.md +65 -0
- package/docs/components/ErrorText.md +15 -0
- package/docs/components/FBLogin.md +21 -0
- package/docs/components/Flex.md +44 -0
- package/docs/components/GHeatMaps.md +16 -0
- package/docs/components/GSignIn.md +21 -0
- package/docs/components/Gmaps.md +16 -0
- package/docs/components/GmapsDirection.md +20 -0
- package/docs/components/Grid.md +36 -0
- package/docs/components/HTMLEditor.md +26 -0
- package/docs/components/IconMenu.md +20 -0
- package/docs/components/Image.md +78 -0
- package/docs/components/Link.md +33 -0
- package/docs/components/MultiDropdown.md +46 -0
- package/docs/components/Radio.md +55 -0
- package/docs/components/Slider.md +47 -0
- package/docs/components/Switch.md +43 -0
- package/docs/components/Table.md +31 -0
- package/docs/components/Tabs.md +65 -0
- package/docs/components/Text.md +30 -0
- package/docs/components/Textarea.md +66 -0
- package/docs/components/Textbox.md +97 -0
- package/docs/components/Timepicker.md +62 -0
- package/docs/components/Toast.md +59 -0
- package/docs/components/Uploader.md +51 -0
- package/docs/components/Video.md +54 -0
- package/package.json +65 -2
- package/docs/components/Dashboard.md +0 -56
- package/docs/components/Header2.md +0 -16
- package/log.txt +0 -7
- package/public/assets/dashboard/bar.png +0 -0
- package/public/assets/dashboard/doughnut.png +0 -0
- package/public/assets/dashboard/metric.png +0 -0
- package/public/assets/dashboard/pie.png +0 -0
- package/public/assets/dashboard/polar-area.png +0 -0
- package/public/assets/dashboard/virtual-table.png +0 -0
- package/public/static/dashboard/bar.png +0 -0
- package/public/static/dashboard/doughnut.png +0 -0
- package/public/static/dashboard/metric.png +0 -0
- package/public/static/dashboard/pie.png +0 -0
- package/public/static/dashboard/polar-area.png +0 -0
- package/public/static/dashboard/virtual-table.png +0 -0
- package/src/components/404.vue +0 -61
- package/src/components/AccountIcon.vue +0 -19
- package/src/components/Ahref.vue +0 -200
- package/src/components/Alert.vue +0 -257
- package/src/components/ArrayList.vue +0 -49
- package/src/components/Article.vue +0 -387
- package/src/components/Block.vue +0 -31
- package/src/components/Box.vue +0 -34
- package/src/components/Button.vue +0 -258
- package/src/components/Card.vue +0 -257
- package/src/components/Carousel.vue +0 -364
- package/src/components/Cart.vue +0 -192
- package/src/components/CartIcon.vue +0 -89
- package/src/components/Chart.vue +0 -485
- package/src/components/ChartBar.vue +0 -192
- package/src/components/ChatTyping.vue +0 -69
- package/src/components/Checkbox.vue +0 -200
- package/src/components/Checkout.vue +0 -373
- package/src/components/CheckoutDelivery.vue +0 -267
- package/src/components/CodeEditor.vue +0 -50
- package/src/components/CollapsiblePanel.vue +0 -70
- package/src/components/ColorPicker.vue +0 -165
- package/src/components/ColorPicker2.vue +0 -186
- package/src/components/ColorPicker3.vue +0 -100
- package/src/components/Confirm.vue +0 -180
- package/src/components/ContextMenu.vue +0 -265
- package/src/components/ContextMenuItem.vue +0 -53
- package/src/components/ConversationBuilder.vue +0 -161
- package/src/components/CopyToClipboard.vue +0 -34
- package/src/components/Countdown.vue +0 -264
- package/src/components/DGrid.vue +0 -21
- package/src/components/DGridItem.vue +0 -263
- package/src/components/Dashboard.vue +0 -243
- package/src/components/Dashboard2.vue +0 -118
- package/src/components/DashboardComponentSelector.vue +0 -96
- package/src/components/DashboardConfigs.vue +0 -202
- package/src/components/DataList.vue +0 -92
- package/src/components/Datepicker.vue +0 -399
- package/src/components/DayTimeRange.vue +0 -126
- package/src/components/Dropdown.vue +0 -224
- package/src/components/ErrorText.vue +0 -57
- package/src/components/FBLogin.vue +0 -194
- package/src/components/Feed.vue +0 -118
- package/src/components/Flex.vue +0 -44
- package/src/components/GHeatMaps.vue +0 -317
- package/src/components/GSignIn.vue +0 -166
- package/src/components/Gmaps.vue +0 -251
- package/src/components/GmapsDirection.vue +0 -191
- package/src/components/Grid.vue +0 -35
- package/src/components/HTMLEditor.vue +0 -588
- package/src/components/IconMenu.vue +0 -95
- package/src/components/IconMenu2.vue +0 -89
- package/src/components/IconPlus.vue +0 -89
- package/src/components/Image.vue +0 -263
- package/src/components/Image360.vue +0 -140
- package/src/components/ImageFullScreen.vue +0 -101
- package/src/components/ImagePreview.vue +0 -93
- package/src/components/ImageUploader.vue +0 -114
- package/src/components/ImportModal.vue +0 -260
- package/src/components/Link.vue +0 -95
- package/src/components/List.vue +0 -1381
- package/src/components/ListContextMenu.vue +0 -88
- package/src/components/ListItem.vue +0 -160
- package/src/components/ListPage1.vue +0 -1401
- package/src/components/ListPage1Filter.vue +0 -170
- package/src/components/ListView.vue +0 -961
- package/src/components/ListViewBarSummary.vue +0 -81
- package/src/components/ListViewLineSummary.vue +0 -75
- package/src/components/ListViewLiveBarSummary.vue +0 -52
- package/src/components/ListViewMapSummary.vue +0 -56
- package/src/components/ListViewSettings.vue +0 -514
- package/src/components/ListViewTableSummary.vue +0 -77
- package/src/components/LogViewerItem.vue +0 -116
- package/src/components/MarkdownEdit.vue +0 -128
- package/src/components/MarkdownPreview.vue +0 -102
- package/src/components/MenuItem1.vue +0 -36
- package/src/components/Modal.vue +0 -456
- package/src/components/MultiDropdown.vue +0 -124
- package/src/components/MultilineText.vue +0 -174
- package/src/components/OTPField.vue +0 -139
- package/src/components/ObjectTree.vue +0 -105
- package/src/components/PageBuilder.vue +0 -449
- package/src/components/Paragraph.vue +0 -40
- package/src/components/PresetSelectorFilterItem.vue +0 -203
- package/src/components/Radio.vue +0 -109
- package/src/components/SearchModal.vue +0 -153
- package/src/components/Slider.vue +0 -317
- package/src/components/SplitPane.vue +0 -129
- package/src/components/Svg.vue +0 -33
- package/src/components/SvgEditor.vue +0 -173
- package/src/components/Switch.vue +0 -101
- package/src/components/TabView.vue +0 -105
- package/src/components/Table.vue +0 -56
- package/src/components/TableView.vue +0 -200
- package/src/components/TableViewHead.vue +0 -159
- package/src/components/Tabs.vue +0 -131
- package/src/components/Test.vue +0 -23
- package/src/components/Testimonial.vue +0 -86
- package/src/components/Text.vue +0 -34
- package/src/components/TextBlock.vue +0 -50
- package/src/components/TextEditor.vue +0 -85
- package/src/components/TextWithTag.vue +0 -298
- package/src/components/Textarea.vue +0 -184
- package/src/components/Textbox.vue +0 -216
- package/src/components/Thumbnail.vue +0 -27
- package/src/components/Timepicker.vue +0 -125
- package/src/components/Toast.vue +0 -117
- package/src/components/TreeMenu.vue +0 -122
- package/src/components/TreeView.vue +0 -106
- package/src/components/TreeView2.vue +0 -38
- package/src/components/TreeViewItem.vue +0 -453
- package/src/components/TreeViewItem1.vue +0 -282
- package/src/components/TreeViewItem2.vue +0 -55
- package/src/components/Uploader.vue +0 -45
- package/src/components/Video.vue +0 -119
- package/src/components/VirtualGrid.vue +0 -297
- package/src/components/VirtualScroll.vue +0 -282
- package/src/components/VirtualTable.vue +0 -956
- package/src/components/YoutubeVideo.vue +0 -196
- package/src/configs/dashboard/bar.js +0 -10
- package/src/configs/dashboard/collection-1.js +0 -5
- package/src/configs/dashboard/data-table.js +0 -9
- package/src/configs/dashboard/doughnut.js +0 -7
- package/src/configs/dashboard/gheatmaps.js +0 -9
- package/src/configs/dashboard/grid-2.js +0 -34
- package/src/configs/dashboard/grid-3.js +0 -34
- package/src/configs/dashboard/grid-4.js +0 -34
- package/src/configs/dashboard/grid.js +0 -15
- package/src/configs/dashboard/metric.js +0 -10
- package/src/configs/dashboard/pie.js +0 -7
- package/src/configs/dashboard/polar-area.js +0 -7
- package/src/configs/dashboard/virtual-table.js +0 -9
- package/src/configs/icons-fa.json +0 -12
- package/src/configs/web-page-builder.js +0 -118
- package/src/defs/dashboard-preset.js +0 -22
- package/src/directives/intersect.js +0 -26
- package/src/hooks/device.js +0 -14
- package/src/index.css +0 -3
- package/src/index.js +0 -648
- package/src/middleware/http/trim-string.js +0 -20
- package/src/mixin/component.js +0 -306
- package/src/mixin/ready-state.js +0 -37
- package/src/stores/components.js +0 -36
- package/src/stores/datasource.js +0 -11
- package/src/themes/default/index.js +0 -303
- package/src/utils/dashboard.js +0 -140
- package/src/utils/event-bus.js +0 -8
- package/src/utils/helpers.cjs +0 -635
- package/src/utils/helpers.js +0 -635
- package/src/utils/helpers.mjs +0 -722
- package/src/utils/importer.js +0 -209
- package/src/utils/list.mjs +0 -1509
- package/src/utils/listpage1.js +0 -1507
- package/src/utils/listview.js +0 -1287
- package/src/utils/preset-selector.cjs +0 -1455
- package/src/utils/preset-selector.js +0 -1452
- package/src/utils/preset-selector.mjs +0 -234
- package/src/utils/queue.js +0 -63
- package/src/utils/selection.js +0 -43
- package/src/utils/web.js +0 -50
- package/src/utils/web.mjs +0 -120
- package/src/utils/wss.js +0 -296
- package/src/utils/wss.mjs +0 -285
- package/src/widgets/AhrefSetting.vue +0 -97
- package/src/widgets/ArticleSetting.vue +0 -457
- package/src/widgets/BackgroundColorSetting.vue +0 -153
- package/src/widgets/BackgroundSetting.vue +0 -132
- package/src/widgets/BlockSetting.vue +0 -49
- package/src/widgets/BorderColorSetting.vue +0 -57
- package/src/widgets/BorderSetting.vue +0 -201
- package/src/widgets/BotEditor/BotEditorActions.vue +0 -163
- package/src/widgets/BotEditor/BotEditorSettings.vue +0 -21
- package/src/widgets/BotEditor.vue +0 -248
- package/src/widgets/BoxSetting.vue +0 -53
- package/src/widgets/ButtonSetting.vue +0 -113
- package/src/widgets/CarouselSetting.vue +0 -181
- package/src/widgets/CartSetting.vue +0 -46
- package/src/widgets/CheckoutSetting.vue +0 -46
- package/src/widgets/CollapsiblePanelSetting.vue +0 -46
- package/src/widgets/ColumnSelector.vue +0 -104
- package/src/widgets/ComponentPropertyLabel.vue +0 -35
- package/src/widgets/ComponentPropertySelector.vue +0 -115
- package/src/widgets/ComponentSetting.vue +0 -2220
- package/src/widgets/ComponentSetting2.vue +0 -927
- package/src/widgets/ComponentSetting3.vue +0 -231
- package/src/widgets/ContactForm.vue +0 -193
- package/src/widgets/ContactFormSetting.vue +0 -395
- package/src/widgets/CountdownSetting.vue +0 -76
- package/src/widgets/Dashboard/BarChart.vue +0 -366
- package/src/widgets/Dashboard/BarChartSetting.vue +0 -317
- package/src/widgets/Dashboard/DataTable.vue +0 -125
- package/src/widgets/Dashboard/DataTableSetting.vue +0 -243
- package/src/widgets/Dashboard/DatasourceFilterSharing.vue +0 -93
- package/src/widgets/Dashboard/DatasourcePreview.vue +0 -93
- package/src/widgets/Dashboard/DatasourceSelector.vue +0 -122
- package/src/widgets/Dashboard/Doughnut.vue +0 -199
- package/src/widgets/Dashboard/DoughnutSetting.vue +0 -196
- package/src/widgets/Dashboard/GHeatMapsSetting.vue +0 -108
- package/src/widgets/Dashboard/InteractionEdit.vue +0 -228
- package/src/widgets/Dashboard/Metric.vue +0 -135
- package/src/widgets/Dashboard/MetricSetting.vue +0 -227
- package/src/widgets/Dashboard/Pie.vue +0 -188
- package/src/widgets/Dashboard/PieSetting.vue +0 -247
- package/src/widgets/Dashboard/PolarArea.vue +0 -201
- package/src/widgets/Dashboard/PolarAreaSetting.vue +0 -195
- package/src/widgets/Dashboard/SharingModal.vue +0 -115
- package/src/widgets/Dashboard/ViewSelector.vue +0 -183
- package/src/widgets/Dashboard/VirtualColumnEdit.vue +0 -97
- package/src/widgets/Dashboard/VirtualTableSetting.vue +0 -171
- package/src/widgets/Dashboard0.vue +0 -1856
- package/src/widgets/DataListSetting.vue +0 -102
- package/src/widgets/EffectSetting.vue +0 -94
- package/src/widgets/EmbeddedVideo.vue +0 -60
- package/src/widgets/EmbeddedVideoSetting.vue +0 -50
- package/src/widgets/FAQ.vue +0 -98
- package/src/widgets/FAQSetting.vue +0 -94
- package/src/widgets/FeatureList.vue +0 -131
- package/src/widgets/FeatureListSetting.vue +0 -233
- package/src/widgets/FiltersSetting.vue +0 -88
- package/src/widgets/FlexSetting.vue +0 -174
- package/src/widgets/GridSetting.vue +0 -165
- package/src/widgets/Header.vue +0 -15
- package/src/widgets/Header0.vue +0 -41
- package/src/widgets/Header0Setting.vue +0 -75
- package/src/widgets/Header2.vue +0 -65
- package/src/widgets/Header2Setting.vue +0 -193
- package/src/widgets/HeaderSetting.vue +0 -102
- package/src/widgets/IconList.vue +0 -51
- package/src/widgets/IconListSetting.vue +0 -188
- package/src/widgets/ImageSetting.vue +0 -119
- package/src/widgets/LayoutSetting.vue +0 -251
- package/src/widgets/LinkSetting.vue +0 -209
- package/src/widgets/LinkSettingModal.vue +0 -173
- package/src/widgets/LogViewer.vue +0 -85
- package/src/widgets/MarginPaddingSetting.vue +0 -58
- package/src/widgets/MarginSetting.vue +0 -142
- package/src/widgets/MenuEditor.vue +0 -256
- package/src/widgets/MenuItem1Setting.vue +0 -78
- package/src/widgets/ModalSetting.vue +0 -94
- package/src/widgets/MultiValueSetting.vue +0 -121
- package/src/widgets/MultiValueSetting2.vue +0 -147
- package/src/widgets/OGSettingModal.vue +0 -103
- package/src/widgets/PaddingSetting.vue +0 -142
- package/src/widgets/ParagraphSetting.vue +0 -89
- package/src/widgets/PositionSetting.vue +0 -209
- package/src/widgets/PresetBar.vue +0 -990
- package/src/widgets/PresetBarPivot.vue +0 -198
- package/src/widgets/PresetBarPivotColumnEdit.vue +0 -197
- package/src/widgets/PresetSelector.vue +0 -685
- package/src/widgets/Review.vue +0 -131
- package/src/widgets/ReviewSetting.vue +0 -201
- package/src/widgets/SearchModalSetting.vue +0 -70
- package/src/widgets/Share.vue +0 -164
- package/src/widgets/ShareSetting.vue +0 -99
- package/src/widgets/SizingSetting.vue +0 -306
- package/src/widgets/SpacingSetting.vue +0 -77
- package/src/widgets/StyleSetting.vue +0 -543
- package/src/widgets/StyleSetting2.vue +0 -90
- package/src/widgets/SvgSetting.vue +0 -133
- package/src/widgets/TableSetting.vue +0 -172
- package/src/widgets/TestimonialSetting.vue +0 -161
- package/src/widgets/TextBlockSetting.vue +0 -81
- package/src/widgets/ThumbnailSetting.vue +0 -49
- package/src/widgets/TransitionSetting.vue +0 -64
- package/src/widgets/TypographySetting.vue +0 -334
- package/src/widgets/UserActionBuilder/UserActionCondition.vue +0 -99
- package/src/widgets/UserActionBuilder/UserActionConsole.vue +0 -97
- package/src/widgets/UserActionBuilder/UserActionItem.vue +0 -273
- package/src/widgets/UserActionBuilder/UserActionOutput.vue +0 -152
- package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +0 -27
- package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +0 -28
- package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +0 -112
- package/src/widgets/UserActionBuilder/UserActionProps.vue +0 -213
- package/src/widgets/UserActionBuilder.vue +0 -314
- package/src/widgets/WebComponentSelector.vue +0 -205
- package/src/widgets/WebDatasourceSelector.vue +0 -153
- package/src/widgets/WebLayoutSelector.vue +0 -147
- package/src/widgets/WebPageBuilder.vue +0 -2161
- package/src/widgets/WebPageBuilder2.vue +0 -1091
- package/src/widgets/WebPageBuilder3.vue +0 -411
- package/src/widgets/WebPageBuilder4/BackgroundColorSetting.vue +0 -54
- package/src/widgets/WebPageBuilder4/BackgroundPositionSetting.vue +0 -75
- package/src/widgets/WebPageBuilder4/BackgroundRepeatSetting.vue +0 -72
- package/src/widgets/WebPageBuilder4/BackgroundSizeSetting.vue +0 -72
- package/src/widgets/WebPageBuilder4/BlurSetting.vue +0 -72
- package/src/widgets/WebPageBuilder4/BorderColorSetting.vue +0 -64
- package/src/widgets/WebPageBuilder4/BorderRadiusSetting.vue +0 -75
- package/src/widgets/WebPageBuilder4/BorderSizeSetting.vue +0 -69
- package/src/widgets/WebPageBuilder4/BorderStyleSetting.vue +0 -72
- package/src/widgets/WebPageBuilder4/BoxShadowSetting.vue +0 -73
- package/src/widgets/WebPageBuilder4/ButtonSetting.vue +0 -65
- package/src/widgets/WebPageBuilder4/CarouselSetting.vue +0 -178
- package/src/widgets/WebPageBuilder4/DisplaySetting.vue +0 -76
- package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +0 -71
- package/src/widgets/WebPageBuilder4/FlexDirectionSetting.vue +0 -70
- package/src/widgets/WebPageBuilder4/FlexJustifySetting.vue +0 -74
- package/src/widgets/WebPageBuilder4/FlexPropertySetting.vue +0 -71
- package/src/widgets/WebPageBuilder4/FlexSetting.vue +0 -96
- package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +0 -69
- package/src/widgets/WebPageBuilder4/GapSetting.vue +0 -75
- package/src/widgets/WebPageBuilder4/GrayscaleSetting.vue +0 -68
- package/src/widgets/WebPageBuilder4/GridSetting.vue +0 -216
- package/src/widgets/WebPageBuilder4/HeightSetting.vue +0 -98
- package/src/widgets/WebPageBuilder4/ImageSetting.vue +0 -102
- package/src/widgets/WebPageBuilder4/MarginSetting.vue +0 -73
- package/src/widgets/WebPageBuilder4/MaxHeightSetting.vue +0 -82
- package/src/widgets/WebPageBuilder4/MaxWidthSetting.vue +0 -90
- package/src/widgets/WebPageBuilder4/MinHeightSetting.vue +0 -81
- package/src/widgets/WebPageBuilder4/MinWidthSetting.vue +0 -101
- package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +0 -163
- package/src/widgets/WebPageBuilder4/OpacitySetting.vue +0 -77
- package/src/widgets/WebPageBuilder4/OverflowSetting.vue +0 -81
- package/src/widgets/WebPageBuilder4/PaddingSetting.vue +0 -57
- package/src/widgets/WebPageBuilder4/PositionSetting.vue +0 -191
- package/src/widgets/WebPageBuilder4/PropertySetting.vue +0 -176
- package/src/widgets/WebPageBuilder4/TextSetting.vue +0 -72
- package/src/widgets/WebPageBuilder4/TreeView.vue +0 -46
- package/src/widgets/WebPageBuilder4/TreeViewItem.vue +0 -303
- package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +0 -141
- package/src/widgets/WebPageBuilder4/WebPagePropertySelector.vue +0 -172
- package/src/widgets/WebPageBuilder4/WidthSetting.vue +0 -105
- package/src/widgets/WebPageBuilder4/ZIndexSetting.vue +0 -72
- package/src/widgets/WebPageBuilder4.vue +0 -798
- package/src/widgets/WebPagePreview.vue +0 -295
- package/src/widgets/WebPageSelector.vue +0 -173
- package/src/widgets/WebTemplateCreator.vue +0 -156
- package/src/widgets/YoutubeVideoSetting.vue +0 -68
- package/tailwind.config.js +0 -481
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="$style.comp" @click="log(modelValue)">
|
|
3
|
-
|
|
4
|
-
<div class="flex flex-row items-start">
|
|
5
|
-
<span :contenteditable="!readonly" spellcheck="false"
|
|
6
|
-
ref="html"
|
|
7
|
-
v-html="html"
|
|
8
|
-
:class="`${$style.content}${itemClass ? ' ' + itemClass : ''}`"
|
|
9
|
-
@blur="onBlur"
|
|
10
|
-
@paste="onPaste"
|
|
11
|
-
@input="onInput"></span>
|
|
12
|
-
|
|
13
|
-
<slot name="end" :comp="this">
|
|
14
|
-
<button v-if="variant === 'minimal' && !readonly" type="button" class="p-3" @click="$refs.modal.open()">
|
|
15
|
-
<svg width="14" height="14" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg>
|
|
16
|
-
</button>
|
|
17
|
-
</slot>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<div v-if="variant !== 'minimal' && !readonly" class="flex flex-row bg-base-300" @dblclick.alt="log(JSON.stringify(modelValue))">
|
|
21
|
-
<div class="flex-1 flex flex-row gap-2 overflow-x-auto p-1" :class="$style.noScrollbar">
|
|
22
|
-
<button type="button" v-for="item in viewedItems" :class="$style.tag2" class="text-xs" @click="add(item)">{{ item.text ?? item.value }}</button>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="p-1 flex items-center justify-center" v-if="viewedItems.length > 4">
|
|
25
|
-
<button type="button" class="p-1" @click="$refs.modal.open()">
|
|
26
|
-
<svg width="14" height="14" class="fill-text-300 hover:fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"/></svg>
|
|
27
|
-
</button>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<Modal ref="modal" width="360" height="360">
|
|
32
|
-
<template v-slot:head>
|
|
33
|
-
<div class="relative p-5 pb-0">
|
|
34
|
-
<h3>Select Tag</h3>
|
|
35
|
-
<div class="absolute top-0 right-0 p-2">
|
|
36
|
-
<button type="button" class="p-2" @click="$refs.modal.close()">
|
|
37
|
-
<svg width="24" height="24" viewBox="0 0 24 24" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg">
|
|
38
|
-
<path d="M6.53034 5.46965C6.23745 5.17676 5.76257 5.17676 5.46968 5.46965C5.17679 5.76255 5.17679 6.23742 5.46968 6.53031L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0606L17.4697 18.5303C17.7626 18.8232 18.2375 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53032C18.8232 6.23743 18.8232 5.76256 18.5303 5.46966C18.2374 5.17677 17.7626 5.17677 17.4697 5.46966L12 10.9393L6.53034 5.46965Z"/>
|
|
39
|
-
</svg>
|
|
40
|
-
</button>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</template>
|
|
44
|
-
<div class="flex-1 p-5 flex flex-col gap-6">
|
|
45
|
-
|
|
46
|
-
<div v-for="(group, key) in groupedItems">
|
|
47
|
-
<div>
|
|
48
|
-
<label>{{ key }}</label>
|
|
49
|
-
</div>
|
|
50
|
-
<div class="flex flex-row flex-wrap gap-2">
|
|
51
|
-
<button v-for="item in group"
|
|
52
|
-
type="button"
|
|
53
|
-
:class="$style.tag2"
|
|
54
|
-
@click="add(item)" class="p-3">
|
|
55
|
-
{{ item.text ?? item.value }}
|
|
56
|
-
</button>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
</div>
|
|
61
|
-
</Modal>
|
|
62
|
-
</div>
|
|
63
|
-
</template>
|
|
64
|
-
|
|
65
|
-
<script>
|
|
66
|
-
|
|
67
|
-
import {restoreSelection, saveSelection} from "../utils/selection";
|
|
68
|
-
|
|
69
|
-
export default{
|
|
70
|
-
|
|
71
|
-
emits: [ 'blur', 'update:modelValue' ],
|
|
72
|
-
|
|
73
|
-
props:{
|
|
74
|
-
|
|
75
|
-
addFn: Function,
|
|
76
|
-
|
|
77
|
-
itemFn: Function,
|
|
78
|
-
|
|
79
|
-
modelValue: String,
|
|
80
|
-
|
|
81
|
-
items: {
|
|
82
|
-
type: Array,
|
|
83
|
-
default: () => []
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
readonly: Boolean,
|
|
87
|
-
|
|
88
|
-
variant: String,
|
|
89
|
-
|
|
90
|
-
itemClass: String,
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
computed:{
|
|
95
|
-
|
|
96
|
-
groupedItems(){
|
|
97
|
-
return this.items.reduce((acc, item) => {
|
|
98
|
-
const key = item.group ?? ''
|
|
99
|
-
if(!acc[key]) acc[key] = []
|
|
100
|
-
acc[key].push(item)
|
|
101
|
-
return acc
|
|
102
|
-
}, {})
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
viewedItems(){
|
|
106
|
-
return (this.items ?? []).slice(0, 6)
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
data(){
|
|
112
|
-
return {
|
|
113
|
-
html: '',
|
|
114
|
-
isInternal: false
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
methods: {
|
|
119
|
-
restoreSelection,
|
|
120
|
-
saveSelection,
|
|
121
|
-
|
|
122
|
-
insertElement(newNode){
|
|
123
|
-
let selection = window.getSelection();
|
|
124
|
-
if (selection.rangeCount === 0) return;
|
|
125
|
-
|
|
126
|
-
let range = selection.getRangeAt(0);
|
|
127
|
-
if(range.commonAncestorContainer.parentNode !== this.$refs.html &&
|
|
128
|
-
range.commonAncestorContainer !== this.$refs.html) return
|
|
129
|
-
|
|
130
|
-
let currentNode = range.startContainer;
|
|
131
|
-
|
|
132
|
-
if (currentNode.nodeType === Node.TEXT_NODE) {
|
|
133
|
-
let offset = range.startOffset;
|
|
134
|
-
currentNode = currentNode.splitText(offset);
|
|
135
|
-
range.setStart(currentNode, 0);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
range.insertNode(newNode);
|
|
139
|
-
range.setStartAfter(newNode);
|
|
140
|
-
range.setEndAfter(newNode);
|
|
141
|
-
selection.removeAllRanges();
|
|
142
|
-
selection.addRange(range);
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
addItem(item){
|
|
146
|
-
this.restoreSelection()
|
|
147
|
-
|
|
148
|
-
const el = document.createElement('span')
|
|
149
|
-
el.setAttribute('contenteditable', 'false')
|
|
150
|
-
el.setAttribute('class', this.$style.tag)
|
|
151
|
-
el.setAttribute('data-value', item.value)
|
|
152
|
-
el.textContent = item.text ?? item.value
|
|
153
|
-
|
|
154
|
-
this.insertElement(el)
|
|
155
|
-
this.onInput()
|
|
156
|
-
|
|
157
|
-
const itemExists = this.items.find(_ => _.value === item.value)
|
|
158
|
-
if(!itemExists)
|
|
159
|
-
this.items.push(item)
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
add(item){
|
|
163
|
-
this.$refs.modal.close()
|
|
164
|
-
|
|
165
|
-
if(typeof this.addFn === 'function'){
|
|
166
|
-
|
|
167
|
-
if(this.addFn.constructor.name === 'AsyncFunction'){
|
|
168
|
-
this.addFn(item).then(newItem => {
|
|
169
|
-
if(newItem === false) return
|
|
170
|
-
item = newItem ? newItem : item
|
|
171
|
-
this.addItem(item)
|
|
172
|
-
})
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const newItem = this.addFn(item)
|
|
177
|
-
if(newItem === false) return
|
|
178
|
-
item = newItem ? newItem : item
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
this.addItem(item)
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
remove(e){
|
|
185
|
-
e.target.parentNode.removeChild(e.target)
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
onBlur(){
|
|
189
|
-
this.saveSelection(this.$refs.html)
|
|
190
|
-
this.$emit('blur')
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
onPaste(e){
|
|
194
|
-
e.preventDefault()
|
|
195
|
-
const text = e.clipboardData.getData('text/plain')
|
|
196
|
-
document.execCommand('insertText', false, text)
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
onInput(){
|
|
200
|
-
|
|
201
|
-
const arr = []
|
|
202
|
-
for(let i = 0 ; i < this.$refs.html.childNodes.length ; i++){
|
|
203
|
-
if(this.$refs.html.childNodes[i].nodeType === 3){
|
|
204
|
-
arr.push(this.$refs.html.childNodes[i].nodeValue)
|
|
205
|
-
}
|
|
206
|
-
else if(this.$refs.html.childNodes[i].nodeType === 1 && this.$refs.html.childNodes[i].classList.contains(this.$style.tag)){
|
|
207
|
-
arr.push(this.$refs.html.childNodes[i].getAttribute('data-value'))
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const text = arr.filter(_ => _).join('')
|
|
212
|
-
|
|
213
|
-
this.$emit('update:modelValue', text)
|
|
214
|
-
|
|
215
|
-
this.isInternal = true
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
watch: {
|
|
221
|
-
|
|
222
|
-
modelValue: {
|
|
223
|
-
immediate: true,
|
|
224
|
-
handler(val) {
|
|
225
|
-
if (this.isInternal) {
|
|
226
|
-
this.isInternal = false
|
|
227
|
-
return
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
let html = val ?? ''
|
|
231
|
-
|
|
232
|
-
let customItems = []
|
|
233
|
-
if (typeof this.itemFn === 'function') {
|
|
234
|
-
customItems = this.itemFn(html)
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const items = [
|
|
238
|
-
...Array.isArray(this.items) ? this.items : [],
|
|
239
|
-
...customItems
|
|
240
|
-
]
|
|
241
|
-
|
|
242
|
-
if(items.length === 0){
|
|
243
|
-
const match = html.match(/{{(.*?)}}/g)
|
|
244
|
-
|
|
245
|
-
if(match){
|
|
246
|
-
for(let tag of match){
|
|
247
|
-
items.push({
|
|
248
|
-
text: tag.replace(/{{(.*?)}}/, '$1').trim(),
|
|
249
|
-
value: tag
|
|
250
|
-
})
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
for (let item of items) {
|
|
256
|
-
html = html.replaceAll(item.value, `<span title="${item.value.replaceAll('"', '')}" ` +
|
|
257
|
-
`class="${this.$style.tag}" contenteditable="false" data-value="${item.value}">` +
|
|
258
|
-
`${item.text ?? item.value}</span>`, 'gi')
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
this.html = html
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
</script>
|
|
270
|
-
|
|
271
|
-
<style module>
|
|
272
|
-
|
|
273
|
-
.comp {
|
|
274
|
-
@apply border-[1px] border-border-200 bg-base-300 rounded-lg min-w-[100px];
|
|
275
|
-
@apply flex flex-col gap-2;
|
|
276
|
-
@apply overflow-hidden;
|
|
277
|
-
@apply divide-y divide-text-100;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.content {
|
|
281
|
-
@apply flex-1 whitespace-pre-line outline-none p-2;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.comp .tag {
|
|
285
|
-
@apply bg-text-100 p-1 rounded-lg whitespace-nowrap relative top-[-1px];
|
|
286
|
-
@apply font-mono text-sm;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.tag2 {
|
|
290
|
-
@apply bg-text-50 p-1 rounded-lg px-2 cursor-pointer whitespace-nowrap;
|
|
291
|
-
@apply hover:bg-text-100 hover:text-white;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.noScrollbar::-webkit-scrollbar {
|
|
295
|
-
display: none;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
</style>
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="computedClass">
|
|
3
|
-
<slot name="start"></slot>
|
|
4
|
-
<textarea :maxlength="maxlength" :class="itemClass"
|
|
5
|
-
:placeholder="placeholder" :rows="rows" ref="input" @focus="isActive = true" @blur="onBlur" @input="onInput"
|
|
6
|
-
:value="modelValue" :readonly="Boolean(readonly)" />
|
|
7
|
-
<div v-if="state === -2 && !!(errors)">
|
|
8
|
-
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
9
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 13.75C12.4142 13.75 12.75 13.4142 12.75 13V8.00001C12.75 7.5858 12.4142 7.25001 12 7.25001C11.5858 7.25001 11.25 7.5858 11.25 8.00001V13C11.25 13.4142 11.5858 13.75 12 13.75Z"/>
|
|
10
|
-
<path d="M13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16Z"/>
|
|
11
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 7.30558 16.6944 3.5 12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"/>
|
|
12
|
-
</svg>
|
|
13
|
-
</div>
|
|
14
|
-
<slot name="end"></slot>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
|
|
20
|
-
export default{
|
|
21
|
-
|
|
22
|
-
name: 'Textarea',
|
|
23
|
-
|
|
24
|
-
props: {
|
|
25
|
-
|
|
26
|
-
align: {
|
|
27
|
-
type: String
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
customClass: String,
|
|
31
|
-
|
|
32
|
-
itemClass: String,
|
|
33
|
-
|
|
34
|
-
state: {
|
|
35
|
-
type: Number,
|
|
36
|
-
default: 1 // 1:normal, -1:disabled, -2:error
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
variant: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: ''
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
size: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: ''
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
errors:{
|
|
50
|
-
type: [ String, Array ],
|
|
51
|
-
default: ''
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
modelValue: [ String, Number ],
|
|
55
|
-
|
|
56
|
-
placeholder: String,
|
|
57
|
-
|
|
58
|
-
readonly: undefined,
|
|
59
|
-
|
|
60
|
-
rows: String,
|
|
61
|
-
|
|
62
|
-
maxlength: undefined,
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
watch:{
|
|
67
|
-
|
|
68
|
-
modelValue(to, from){
|
|
69
|
-
this.$emit('update:modelValue', to)
|
|
70
|
-
this.$emit('change', to)
|
|
71
|
-
|
|
72
|
-
this.$nextTick(() => {
|
|
73
|
-
this.$refs.input.style.height = '';
|
|
74
|
-
this.$refs.input.style.height = this.$refs.input.scrollHeight + 'px'
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
emits: [ 'update:modelValue', 'change', 'submit', 'blur' ],
|
|
81
|
-
|
|
82
|
-
computed: {
|
|
83
|
-
|
|
84
|
-
computedState(){
|
|
85
|
-
if(this.errors){
|
|
86
|
-
return -2
|
|
87
|
-
}
|
|
88
|
-
else{
|
|
89
|
-
return this.state
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
computedClass(){
|
|
94
|
-
return this.customClass ?? [
|
|
95
|
-
this.$style.textarea,
|
|
96
|
-
this.$style['state-' + this.computedState],
|
|
97
|
-
this.isActive && !this.readonly ? this.$style.active : '',
|
|
98
|
-
this.align ? this.$style['align-' + this.align] : '',
|
|
99
|
-
this.readonly ? this.$style.readonly : '',
|
|
100
|
-
this.size ? this.$style['size-' + this.size] : ''
|
|
101
|
-
].join(' ')
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
isDisabled(){
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
data(){
|
|
111
|
-
return {
|
|
112
|
-
isActive: false
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
mounted() {
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
methods:{
|
|
120
|
-
|
|
121
|
-
focus(){
|
|
122
|
-
this.$refs.input.focus()
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
select(){
|
|
126
|
-
this.$refs.input.select()
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
onInput(e){
|
|
130
|
-
this.$emit('update:modelValue', e.target.value)
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
onBlur(){
|
|
134
|
-
this.isActive = false
|
|
135
|
-
this.$emit('blur')
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
</script>
|
|
143
|
-
|
|
144
|
-
<style module>
|
|
145
|
-
|
|
146
|
-
.textarea{
|
|
147
|
-
@apply flex flex-row items-start border-[1px] border-border-200 bg-base-400;
|
|
148
|
-
@apply rounded-lg overflow-hidden ;
|
|
149
|
-
}
|
|
150
|
-
.textarea textarea{
|
|
151
|
-
@apply flex-1 outline-none p-2 bg-transparent resize-none min-h-[2.6rem];
|
|
152
|
-
scrollbar-width: none;
|
|
153
|
-
}
|
|
154
|
-
.textarea>textarea::-webkit-scrollbar{
|
|
155
|
-
display: none;
|
|
156
|
-
}
|
|
157
|
-
.textarea.readonly{
|
|
158
|
-
@apply bg-text-50;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.active{
|
|
162
|
-
@apply border-primary
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.state--2{
|
|
166
|
-
@apply border-red-500
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.align-left>input{
|
|
170
|
-
@apply text-left
|
|
171
|
-
}
|
|
172
|
-
.align-center>input{
|
|
173
|
-
@apply text-center
|
|
174
|
-
}
|
|
175
|
-
.align-right>input{
|
|
176
|
-
@apply text-right
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.size-sm textarea{ @apply text-sm; }
|
|
180
|
-
|
|
181
|
-
.size-lg{ @apply min-h-[var(--h-cp-lg)]; }
|
|
182
|
-
.size-lg textarea{ @apply text-lg p-2; }
|
|
183
|
-
|
|
184
|
-
</style>
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="computedClass">
|
|
3
|
-
<slot name="start"></slot>
|
|
4
|
-
<input :type="computedType" :disabled="isDisabled" @focus="isActive = true"
|
|
5
|
-
@input="onInput"
|
|
6
|
-
@blur="onBlur"
|
|
7
|
-
@keyup="(e) => $emit('keyup', e)"
|
|
8
|
-
:placeholder="placeholder" :maxlength="maxlength" ref="input" autocomplete="new-password"
|
|
9
|
-
:value="displayedValue" :readonly="Boolean(readonly)" @paste="onPaste"
|
|
10
|
-
:class="itemClass" @click="$emit('input-click')"
|
|
11
|
-
@keydown="onKeyDown"/>
|
|
12
|
-
<button class="mr-2" v-show="Boolean(clearable) && !Boolean(readonly) && state >= 1 && modelValue" type="button" @click="$emit('clear')">
|
|
13
|
-
<svg :class="$style.svg" width="19" height="19" viewBox="0 0 24 24" class="fill-text-200 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg">
|
|
14
|
-
<path d="M6.53034 5.46965C6.23745 5.17676 5.76257 5.17676 5.46968 5.46965C5.17679 5.76255 5.17679 6.23742 5.46968 6.53031L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0606L17.4697 18.5303C17.7626 18.8232 18.2375 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53032C18.8232 6.23743 18.8232 5.76256 18.5303 5.46966C18.2374 5.17677 17.7626 5.17677 17.4697 5.46966L12 10.9393L6.53034 5.46965Z"/>
|
|
15
|
-
</svg>
|
|
16
|
-
</button>
|
|
17
|
-
<slot name="end"></slot>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
|
|
23
|
-
export default{
|
|
24
|
-
|
|
25
|
-
emits: [ 'update:modelValue', 'clear', 'keyup', 'blur', 'input-click', 'input' ],
|
|
26
|
-
|
|
27
|
-
props: {
|
|
28
|
-
|
|
29
|
-
align: {
|
|
30
|
-
type: String
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
clearable: [ Boolean, String, Number ],
|
|
34
|
-
|
|
35
|
-
state: {
|
|
36
|
-
type: Number,
|
|
37
|
-
default: 1 // 1:normal, -1:disabled, -2:error
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
variant: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: ''
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
size: {
|
|
46
|
-
type: String,
|
|
47
|
-
default: ''
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
modelValue: undefined,
|
|
51
|
-
|
|
52
|
-
value: undefined,
|
|
53
|
-
|
|
54
|
-
placeholder: String,
|
|
55
|
-
readonly: undefined,
|
|
56
|
-
disabled: undefined,
|
|
57
|
-
maxlength: {
|
|
58
|
-
type: [ String, Number ],
|
|
59
|
-
default: 255
|
|
60
|
-
},
|
|
61
|
-
type: String, // text, tel, password, number,
|
|
62
|
-
|
|
63
|
-
itemClass: String
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
computed: {
|
|
68
|
-
|
|
69
|
-
computedState(){
|
|
70
|
-
return this.state
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
computedClass(){
|
|
74
|
-
return [
|
|
75
|
-
this.$style.textbox,
|
|
76
|
-
this.$style['state-' + this.computedState],
|
|
77
|
-
this.readonly ? this.$style.readonly : '',
|
|
78
|
-
this.disabled ? this.$style.disabled : '',
|
|
79
|
-
this.isActive && !this.readonly ? this.$style.active : '',
|
|
80
|
-
this.align ? this.$style['align-' + this.align] : '',
|
|
81
|
-
this.size ? this.$style['size-' + this.size] : ''
|
|
82
|
-
].join(' ')
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
isDisabled(){
|
|
86
|
-
return this.state === 2
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
displayedValue(){
|
|
90
|
-
if(this.isActive){
|
|
91
|
-
return this.modelValue ?? this.value
|
|
92
|
-
}
|
|
93
|
-
else{
|
|
94
|
-
switch(this.type){
|
|
95
|
-
|
|
96
|
-
case 'number':
|
|
97
|
-
const val = parseFloat(this.modelValue)
|
|
98
|
-
return isNaN(val) ? '' : val.toLocaleString()
|
|
99
|
-
|
|
100
|
-
default:
|
|
101
|
-
return this.modelValue ?? this.value
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
computedType(){
|
|
108
|
-
|
|
109
|
-
switch(this.type){
|
|
110
|
-
|
|
111
|
-
case 'number':
|
|
112
|
-
return 'text'
|
|
113
|
-
|
|
114
|
-
default:
|
|
115
|
-
return this.type
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
data(){
|
|
122
|
-
return {
|
|
123
|
-
isActive: false
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
methods:{
|
|
128
|
-
|
|
129
|
-
focus(){
|
|
130
|
-
this.$refs.input.focus()
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
select(){
|
|
134
|
-
this.$refs.input.select()
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
onInput(e){
|
|
138
|
-
this.$emit('update:modelValue', e.target.value)
|
|
139
|
-
this.$emit('input', e)
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
onBlur(e){
|
|
143
|
-
this.isActive = false
|
|
144
|
-
this.$emit('blur', e)
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
onPaste(e){
|
|
148
|
-
e.preventDefault()
|
|
149
|
-
|
|
150
|
-
let text = (e.clipboardData || window.clipboardData).getData("text");
|
|
151
|
-
switch(this.type){
|
|
152
|
-
case 'tel':
|
|
153
|
-
text = text.replace(/[^0-9]/g, '')
|
|
154
|
-
break
|
|
155
|
-
}
|
|
156
|
-
if(parseInt(this.maxlength) > 0){
|
|
157
|
-
text = text.substring(0, parseInt(this.maxlength))
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
document.execCommand('insertText', false, text)
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
onKeyDown(e){
|
|
164
|
-
if([ 'number', 'tel' ].includes(this.type)){
|
|
165
|
-
if(((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105) ||
|
|
166
|
-
[ 8, 9, 13, 27, 37, 38, 39, 40, 46 ].includes(e.keyCode)) && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey);
|
|
167
|
-
else if(e.keyCode === 65 && (e.ctrlKey || e.metaKey));
|
|
168
|
-
else if(e.keyCode === 82 && (e.ctrlKey || e.metaKey));
|
|
169
|
-
else if(e.keyCode === 86 && (e.ctrlKey || e.metaKey)); // ctrl-v
|
|
170
|
-
else{
|
|
171
|
-
e.preventDefault()
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
</script>
|
|
181
|
-
|
|
182
|
-
<style module>
|
|
183
|
-
|
|
184
|
-
.textbox{
|
|
185
|
-
@apply flex items-center;
|
|
186
|
-
@apply border-[1px] border-border-200 bg-base-400 hover:border-border-300 rounded-lg;
|
|
187
|
-
@apply overflow-hidden;
|
|
188
|
-
}
|
|
189
|
-
.textbox.active{
|
|
190
|
-
@apply !border-primary-600
|
|
191
|
-
}
|
|
192
|
-
.textbox>input{
|
|
193
|
-
@apply flex-1 outline-none p-2 bg-transparent;
|
|
194
|
-
font-size: inherit;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.size-sm input{ @apply text-sm; }
|
|
198
|
-
|
|
199
|
-
.state--2{
|
|
200
|
-
@apply border-red-500
|
|
201
|
-
}
|
|
202
|
-
.state--2 .svg{
|
|
203
|
-
@apply fill-red-500
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.align-left>input{
|
|
207
|
-
@apply text-left
|
|
208
|
-
}
|
|
209
|
-
.align-center>input{
|
|
210
|
-
@apply text-center
|
|
211
|
-
}
|
|
212
|
-
.align-right>input{
|
|
213
|
-
@apply text-right
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
</style>
|