@mixd-id/web-scaffold 0.2.250801012 → 0.2.250801013

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.
Files changed (283) hide show
  1. package/package.json +2 -1
  2. package/src/components/AccountIcon.vue +19 -0
  3. package/src/components/Ahref.vue +200 -0
  4. package/src/components/Alert.vue +257 -0
  5. package/src/components/ArrayList.vue +49 -0
  6. package/src/components/Article.vue +387 -0
  7. package/src/components/BarChart.vue +87 -0
  8. package/src/components/Block.vue +31 -0
  9. package/src/components/Box.vue +34 -0
  10. package/src/components/Button.vue +258 -0
  11. package/src/components/Card.vue +253 -0
  12. package/src/components/Carousel.vue +404 -0
  13. package/src/components/Cart.vue +192 -0
  14. package/src/components/CartIcon.vue +89 -0
  15. package/src/components/Chart.vue +485 -0
  16. package/src/components/ChartBar.vue +192 -0
  17. package/src/components/ChatTyping.vue +69 -0
  18. package/src/components/Checkbox.vue +200 -0
  19. package/src/components/CodeEditor.vue +50 -0
  20. package/src/components/CollapsiblePanel.vue +70 -0
  21. package/src/components/ColorPicker.vue +649 -0
  22. package/src/components/Confirm.vue +180 -0
  23. package/src/components/ContextMenu.vue +265 -0
  24. package/src/components/ContextMenuItem.vue +53 -0
  25. package/src/components/CopyToClipboard.vue +34 -0
  26. package/src/components/Countdown.vue +264 -0
  27. package/src/components/Dashboard.vue +870 -0
  28. package/src/components/Datepicker.vue +412 -0
  29. package/src/components/Datetimepicker.vue +355 -0
  30. package/src/components/DayTimeRange.vue +126 -0
  31. package/src/components/DoughnutChart.vue +68 -0
  32. package/src/components/Dropdown.vue +315 -0
  33. package/src/components/ErrorText.vue +57 -0
  34. package/src/components/FBLogin.vue +194 -0
  35. package/src/components/FilterCard.vue +177 -0
  36. package/src/components/Flex.vue +44 -0
  37. package/src/components/GHeatMaps.vue +317 -0
  38. package/src/components/GSignIn.vue +166 -0
  39. package/src/components/Gmaps.vue +251 -0
  40. package/src/components/GmapsDirection.vue +191 -0
  41. package/src/components/Grid.vue +35 -0
  42. package/src/components/HTMLEditor.vue +778 -0
  43. package/src/components/IconMenu.vue +95 -0
  44. package/src/components/IconMenu2.vue +89 -0
  45. package/src/components/IconPlus.vue +89 -0
  46. package/src/components/Image.vue +311 -0
  47. package/src/components/Image360.vue +140 -0
  48. package/src/components/ImageFullScreen.vue +101 -0
  49. package/src/components/ImagePreview.vue +93 -0
  50. package/src/components/ImageUploader.vue +111 -0
  51. package/src/components/ImportModal.vue +260 -0
  52. package/src/components/LineChart.vue +104 -0
  53. package/src/components/Link.vue +95 -0
  54. package/src/components/List.vue +1381 -0
  55. package/src/components/ListContextMenu.vue +88 -0
  56. package/src/components/ListItem.vue +160 -0
  57. package/src/components/LogViewerItem.vue +116 -0
  58. package/src/components/MarkdownEdit.vue +227 -0
  59. package/src/components/MarkdownPreview.vue +102 -0
  60. package/src/components/MenuItem1.vue +36 -0
  61. package/src/components/Metric.vue +105 -0
  62. package/src/components/MultiDropdown.vue +124 -0
  63. package/src/components/MultilineText.vue +174 -0
  64. package/src/components/OTPField.vue +139 -0
  65. package/src/components/PageBuilder.vue +449 -0
  66. package/src/components/Paragraph.vue +40 -0
  67. package/src/components/PieChart.vue +67 -0
  68. package/src/components/PresetSelectorFilterItem.vue +203 -0
  69. package/src/components/Radio.vue +109 -0
  70. package/src/components/SearchModal.vue +153 -0
  71. package/src/components/Slider.vue +407 -0
  72. package/src/components/SplitPane.vue +129 -0
  73. package/src/components/Svg.vue +33 -0
  74. package/src/components/SvgEditor.vue +173 -0
  75. package/src/components/Switch.vue +101 -0
  76. package/src/components/TabView.vue +105 -0
  77. package/src/components/Table.vue +56 -0
  78. package/src/components/TableView.vue +200 -0
  79. package/src/components/TableViewHead.vue +159 -0
  80. package/src/components/Tabs.vue +131 -0
  81. package/src/components/Test.vue +23 -0
  82. package/src/components/Testimonial.vue +86 -0
  83. package/src/components/Text.vue +34 -0
  84. package/src/components/TextBlock.vue +50 -0
  85. package/src/components/TextEditor.vue +85 -0
  86. package/src/components/TextWithTag.vue +298 -0
  87. package/src/components/Textarea.vue +195 -0
  88. package/src/components/Textbox.vue +216 -0
  89. package/src/components/Thumbnail.vue +27 -0
  90. package/src/components/Timepicker.vue +223 -0
  91. package/src/components/Toast.vue +117 -0
  92. package/src/components/Tooltip.vue +143 -0
  93. package/src/components/TreeMenu.vue +122 -0
  94. package/src/components/TreeView.vue +107 -0
  95. package/src/components/TreeViewItem.vue +452 -0
  96. package/src/components/TreeViewItem1.vue +282 -0
  97. package/src/components/Uploader.vue +45 -0
  98. package/src/components/Video.vue +119 -0
  99. package/src/components/VirtualGrid.vue +296 -0
  100. package/src/components/VirtualScroll.vue +282 -0
  101. package/src/components/VirtualTable.vue +956 -0
  102. package/src/components/YoutubeVideo.vue +196 -0
  103. package/src/configs/dashboard/bar.js +10 -0
  104. package/src/configs/dashboard/collection-1.js +5 -0
  105. package/src/configs/dashboard/data-table.js +9 -0
  106. package/src/configs/dashboard/doughnut.js +7 -0
  107. package/src/configs/dashboard/gheatmaps.js +9 -0
  108. package/src/configs/dashboard/grid-2.js +34 -0
  109. package/src/configs/dashboard/grid-3.js +34 -0
  110. package/src/configs/dashboard/grid-4.js +34 -0
  111. package/src/configs/dashboard/grid.js +15 -0
  112. package/src/configs/dashboard/metric.js +10 -0
  113. package/src/configs/dashboard/pie.js +7 -0
  114. package/src/configs/dashboard/polar-area.js +7 -0
  115. package/src/configs/dashboard/virtual-table.js +9 -0
  116. package/src/configs/icons-fa.json +12 -0
  117. package/src/configs/web-page-builder.js +118 -0
  118. package/src/directives/intersect.js +26 -0
  119. package/src/hooks/device.js +14 -0
  120. package/src/index.css +3 -0
  121. package/src/index.js +687 -0
  122. package/src/middleware/http/trim-string.js +20 -0
  123. package/src/mixin/component.js +306 -0
  124. package/src/mixin/ready-state.js +37 -0
  125. package/src/stores/components.js +36 -0
  126. package/src/stores/datasource.js +11 -0
  127. package/src/themes/default/index.js +303 -0
  128. package/src/utils/dashboard.js +304 -0
  129. package/src/utils/event-bus.js +8 -0
  130. package/src/utils/helpers.cjs +635 -0
  131. package/src/utils/helpers.js +635 -0
  132. package/src/utils/helpers.mjs +722 -0
  133. package/src/utils/importer.js +209 -0
  134. package/src/utils/list.mjs +1509 -0
  135. package/src/utils/listview.js +1287 -0
  136. package/src/utils/preset-selector.cjs +1455 -0
  137. package/src/utils/preset-selector.js +1452 -0
  138. package/src/utils/preset-selector.mjs +234 -0
  139. package/src/utils/queue.js +63 -0
  140. package/src/utils/selection.js +43 -0
  141. package/src/utils/web.js +50 -0
  142. package/src/utils/web.mjs +120 -0
  143. package/src/utils/wss.js +313 -0
  144. package/src/utils/wss.mjs +286 -0
  145. package/src/widgets/AhrefSetting.vue +97 -0
  146. package/src/widgets/ArticleSetting.vue +457 -0
  147. package/src/widgets/BackgroundColorSetting.vue +149 -0
  148. package/src/widgets/BackgroundSetting.vue +132 -0
  149. package/src/widgets/BlockSetting.vue +49 -0
  150. package/src/widgets/BorderColorSetting.vue +53 -0
  151. package/src/widgets/BorderSetting.vue +201 -0
  152. package/src/widgets/BotEditor/BotEditorActions.vue +163 -0
  153. package/src/widgets/BotEditor/BotEditorSettings.vue +21 -0
  154. package/src/widgets/BotEditor.vue +248 -0
  155. package/src/widgets/BoxSetting.vue +53 -0
  156. package/src/widgets/ButtonSetting.vue +113 -0
  157. package/src/widgets/CarouselSetting.vue +181 -0
  158. package/src/widgets/CartSetting.vue +46 -0
  159. package/src/widgets/CheckoutSetting.vue +46 -0
  160. package/src/widgets/CollapsiblePanelSetting.vue +46 -0
  161. package/src/widgets/ColumnSelector.vue +104 -0
  162. package/src/widgets/ComponentPropertyLabel.vue +35 -0
  163. package/src/widgets/ComponentPropertySelector.vue +115 -0
  164. package/src/widgets/ComponentSetting.vue +2220 -0
  165. package/src/widgets/ComponentSetting2.vue +927 -0
  166. package/src/widgets/ComponentSetting3.vue +231 -0
  167. package/src/widgets/ContactForm.vue +193 -0
  168. package/src/widgets/ContactFormSetting.vue +395 -0
  169. package/src/widgets/CountdownSetting.vue +76 -0
  170. package/src/widgets/DataListSetting.vue +102 -0
  171. package/src/widgets/EffectSetting.vue +94 -0
  172. package/src/widgets/EmbeddedVideo.vue +60 -0
  173. package/src/widgets/EmbeddedVideoSetting.vue +50 -0
  174. package/src/widgets/FAQ.vue +98 -0
  175. package/src/widgets/FAQSetting.vue +94 -0
  176. package/src/widgets/FeatureList.vue +131 -0
  177. package/src/widgets/FeatureListSetting.vue +233 -0
  178. package/src/widgets/FiltersSetting.vue +88 -0
  179. package/src/widgets/FlexSetting.vue +174 -0
  180. package/src/widgets/GridSetting.vue +165 -0
  181. package/src/widgets/Header.vue +15 -0
  182. package/src/widgets/Header0.vue +41 -0
  183. package/src/widgets/Header0Setting.vue +75 -0
  184. package/src/widgets/Header2.vue +65 -0
  185. package/src/widgets/Header2Setting.vue +193 -0
  186. package/src/widgets/HeaderSetting.vue +102 -0
  187. package/src/widgets/IconList.vue +51 -0
  188. package/src/widgets/IconListSetting.vue +188 -0
  189. package/src/widgets/ImageSetting.vue +119 -0
  190. package/src/widgets/LayoutSetting.vue +251 -0
  191. package/src/widgets/LinkSetting.vue +209 -0
  192. package/src/widgets/LinkSettingModal.vue +173 -0
  193. package/src/widgets/LogViewer.vue +85 -0
  194. package/src/widgets/MarginPaddingSetting.vue +58 -0
  195. package/src/widgets/MarginSetting.vue +142 -0
  196. package/src/widgets/MenuEditor.vue +251 -0
  197. package/src/widgets/MenuItem1Setting.vue +78 -0
  198. package/src/widgets/ModalSetting.vue +94 -0
  199. package/src/widgets/MultiValueSetting.vue +121 -0
  200. package/src/widgets/MultiValueSetting2.vue +147 -0
  201. package/src/widgets/OGSettingModal.vue +103 -0
  202. package/src/widgets/PaddingSetting.vue +142 -0
  203. package/src/widgets/ParagraphSetting.vue +89 -0
  204. package/src/widgets/PositionSetting.vue +209 -0
  205. package/src/widgets/PresetBar.vue +988 -0
  206. package/src/widgets/PresetBarPivot.vue +198 -0
  207. package/src/widgets/PresetBarPivotColumnEdit.vue +197 -0
  208. package/src/widgets/PresetSelector.vue +709 -0
  209. package/src/widgets/Review.vue +131 -0
  210. package/src/widgets/ReviewSetting.vue +201 -0
  211. package/src/widgets/SearchModalSetting.vue +70 -0
  212. package/src/widgets/Share.vue +164 -0
  213. package/src/widgets/ShareSetting.vue +99 -0
  214. package/src/widgets/SizingSetting.vue +306 -0
  215. package/src/widgets/SpacingSetting.vue +77 -0
  216. package/src/widgets/StyleSetting.vue +543 -0
  217. package/src/widgets/StyleSetting2.vue +90 -0
  218. package/src/widgets/SvgSetting.vue +133 -0
  219. package/src/widgets/TableSetting.vue +172 -0
  220. package/src/widgets/TestimonialSetting.vue +161 -0
  221. package/src/widgets/TextBlockSetting.vue +81 -0
  222. package/src/widgets/ThumbnailSetting.vue +49 -0
  223. package/src/widgets/TransitionSetting.vue +64 -0
  224. package/src/widgets/TypographySetting.vue +334 -0
  225. package/src/widgets/UserActionBuilder/UserActionCondition.vue +99 -0
  226. package/src/widgets/UserActionBuilder/UserActionConsole.vue +97 -0
  227. package/src/widgets/UserActionBuilder/UserActionItem.vue +273 -0
  228. package/src/widgets/UserActionBuilder/UserActionOutput.vue +150 -0
  229. package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +27 -0
  230. package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +28 -0
  231. package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +112 -0
  232. package/src/widgets/UserActionBuilder/UserActionProps.vue +213 -0
  233. package/src/widgets/UserActionBuilder.vue +314 -0
  234. package/src/widgets/WebComponentSelector.vue +205 -0
  235. package/src/widgets/WebDatasourceSelector.vue +153 -0
  236. package/src/widgets/WebLayoutSelector.vue +139 -0
  237. package/src/widgets/WebPageBuilder.vue +2161 -0
  238. package/src/widgets/WebPageBuilder4/BackgroundColorSetting.vue +54 -0
  239. package/src/widgets/WebPageBuilder4/BackgroundPositionSetting.vue +75 -0
  240. package/src/widgets/WebPageBuilder4/BackgroundRepeatSetting.vue +72 -0
  241. package/src/widgets/WebPageBuilder4/BackgroundSizeSetting.vue +72 -0
  242. package/src/widgets/WebPageBuilder4/BlurSetting.vue +72 -0
  243. package/src/widgets/WebPageBuilder4/BorderColorSetting.vue +54 -0
  244. package/src/widgets/WebPageBuilder4/BorderRadiusSetting.vue +75 -0
  245. package/src/widgets/WebPageBuilder4/BorderSizeSetting.vue +69 -0
  246. package/src/widgets/WebPageBuilder4/BorderStyleSetting.vue +72 -0
  247. package/src/widgets/WebPageBuilder4/BoxShadowSetting.vue +73 -0
  248. package/src/widgets/WebPageBuilder4/ButtonSetting.vue +65 -0
  249. package/src/widgets/WebPageBuilder4/CarouselSetting.vue +178 -0
  250. package/src/widgets/WebPageBuilder4/DisplaySetting.vue +76 -0
  251. package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +71 -0
  252. package/src/widgets/WebPageBuilder4/FlexDirectionSetting.vue +70 -0
  253. package/src/widgets/WebPageBuilder4/FlexJustifySetting.vue +74 -0
  254. package/src/widgets/WebPageBuilder4/FlexPropertySetting.vue +71 -0
  255. package/src/widgets/WebPageBuilder4/FlexSetting.vue +96 -0
  256. package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +69 -0
  257. package/src/widgets/WebPageBuilder4/GapSetting.vue +75 -0
  258. package/src/widgets/WebPageBuilder4/GrayscaleSetting.vue +68 -0
  259. package/src/widgets/WebPageBuilder4/GridSetting.vue +216 -0
  260. package/src/widgets/WebPageBuilder4/HeightSetting.vue +98 -0
  261. package/src/widgets/WebPageBuilder4/ImageSetting.vue +102 -0
  262. package/src/widgets/WebPageBuilder4/MarginSetting.vue +73 -0
  263. package/src/widgets/WebPageBuilder4/MaxHeightSetting.vue +82 -0
  264. package/src/widgets/WebPageBuilder4/MaxWidthSetting.vue +90 -0
  265. package/src/widgets/WebPageBuilder4/MinHeightSetting.vue +81 -0
  266. package/src/widgets/WebPageBuilder4/MinWidthSetting.vue +101 -0
  267. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +163 -0
  268. package/src/widgets/WebPageBuilder4/OpacitySetting.vue +77 -0
  269. package/src/widgets/WebPageBuilder4/OverflowSetting.vue +81 -0
  270. package/src/widgets/WebPageBuilder4/PaddingSetting.vue +57 -0
  271. package/src/widgets/WebPageBuilder4/PositionSetting.vue +191 -0
  272. package/src/widgets/WebPageBuilder4/PropertySetting.vue +176 -0
  273. package/src/widgets/WebPageBuilder4/TextSetting.vue +72 -0
  274. package/src/widgets/WebPageBuilder4/TreeView.vue +46 -0
  275. package/src/widgets/WebPageBuilder4/TreeViewItem.vue +303 -0
  276. package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +141 -0
  277. package/src/widgets/WebPageBuilder4/WebPagePropertySelector.vue +168 -0
  278. package/src/widgets/WebPageBuilder4/WidthSetting.vue +105 -0
  279. package/src/widgets/WebPageBuilder4/ZIndexSetting.vue +72 -0
  280. package/src/widgets/WebPagePreview.vue +295 -0
  281. package/src/widgets/WebPageSelector.vue +173 -0
  282. package/src/widgets/WebTemplateCreator.vue +156 -0
  283. package/src/widgets/YoutubeVideoSetting.vue +68 -0
@@ -0,0 +1,387 @@
1
+ <template>
2
+ <article :class="$style.article"
3
+ v-html="computedHtml"
4
+ :style="computedStyle"
5
+ @input="onInput"
6
+ @click="onClick"
7
+ @paste="onPaste" />
8
+ </template>
9
+
10
+ <script>
11
+
12
+ import {componentMixin} from '../mixin/component';
13
+ import {getSelection, restoreSelection, saveSelection} from "../utils/selection";
14
+
15
+ export default{
16
+
17
+ mixins: [ componentMixin ],
18
+
19
+ props: {
20
+
21
+ htmlText: String
22
+
23
+ },
24
+
25
+ methods: {
26
+
27
+ getSelection(){
28
+ const { text = '', href = '', target = '' } = saveSelection(this.$el)
29
+ return {
30
+ text,
31
+ href,
32
+ target
33
+ }
34
+ },
35
+
36
+ addLink(link){
37
+
38
+ restoreSelection()
39
+
40
+ document.execCommand("insertHTML", false,
41
+ "<a style='font-size:inherit;font-family:inherit;background-color:inherit' " +
42
+ "href=\"" + link.href + "\" " +
43
+ "target=\"" + link.target + "\">" +
44
+ link.text +
45
+ "</a>");
46
+ },
47
+
48
+ onInput(){
49
+ if(this.editMode){
50
+ this.triggerUpdate()
51
+ }
52
+ },
53
+
54
+ onClick(){
55
+ if(this.editMode){
56
+ let { element } = getSelection(this.$el)
57
+
58
+ const table = this.closest(element, 'table')
59
+
60
+ window.parent.postMessage({
61
+ uid: this.uid,
62
+ type: 'setSubAction',
63
+ value: table ? 'table' : ''
64
+ }, '*')
65
+ }
66
+ },
67
+
68
+ onPaste(e) {
69
+ e.preventDefault()
70
+ let text = (e.clipboardData || window.clipboardData).getData("text");
71
+ const el = document.createElement('div')
72
+ el.innerHTML = text
73
+ text = el.innerText
74
+ document.execCommand("insertText", false, text);
75
+ },
76
+
77
+ triggerUpdate(){
78
+ window.parent.postMessage({
79
+ uid: this.uid,
80
+ type: 'setProp',
81
+ value: {
82
+ htmlText: this.$el.innerHTML
83
+ }
84
+ }, '*')
85
+ },
86
+
87
+ closest(el, selector){
88
+ let parent = el.parentNode
89
+ while(parent){
90
+ if(parent === document) break
91
+
92
+ if(parent.matches(selector)){
93
+ return parent
94
+ }
95
+ parent = parent.parentNode
96
+ }
97
+ },
98
+
99
+ addTableColumn(){
100
+
101
+ let { element } = getSelection(this.$el)
102
+ if(element.nodeType !== 1)
103
+ element = element.parentNode
104
+ const table = this.closest(element, 'table')
105
+
106
+ if(table){
107
+ const thead = table.querySelector('thead')
108
+ const tbody = table.querySelector('tbody')
109
+ const tr = this.closest(element, 'tr')
110
+ const index = Array.from(tr.children).indexOf(element)
111
+
112
+ thead.querySelectorAll('tr').forEach(tr => {
113
+ const th = document.createElement('th')
114
+ th.innerHTML = "<i>insert header...</i>"
115
+ tr.insertBefore(th, tr.children[index + 1])
116
+ })
117
+
118
+ tbody.querySelectorAll('tr').forEach(tr => {
119
+ const td = document.createElement('td')
120
+ td.innerHTML = 'Content'
121
+ tr.insertBefore(td, tr.children[index + 1])
122
+ })
123
+
124
+ this.triggerUpdate()
125
+ }
126
+ },
127
+
128
+ addTableRow(){
129
+
130
+ let { element } = getSelection(this.$el)
131
+ if(element.nodeType !== 1)
132
+ element = element.parentNode
133
+ const table = this.closest(element, 'table')
134
+
135
+ if(table){
136
+ const tbody = table.querySelector('tbody')
137
+ const tr = this.closest(element, 'tr')
138
+ const index = Array.from(tbody.children).indexOf(tr)
139
+ if(index >= 0){
140
+ const nTr = document.createElement('tr')
141
+ for(let i = 0 ; i < tr.children.length ; i++){
142
+ const nTd = document.createElement('td')
143
+ nTd.innerHTML = 'Content'
144
+ nTr.appendChild(nTd)
145
+ }
146
+ tbody.insertBefore(nTr, tbody.children[index + 1])
147
+ this.triggerUpdate()
148
+ }
149
+ }
150
+ },
151
+
152
+ removeTableRow(){
153
+
154
+ let { element } = getSelection(this.$el)
155
+ if(element.nodeType !== 1)
156
+ element = element.parentNode
157
+ const table = this.closest(element, 'table')
158
+
159
+ if(table){
160
+ const tbody = table.querySelector('tbody')
161
+ const tr = this.closest(element, 'tr')
162
+ if(tr){
163
+ tbody.removeChild(tr)
164
+ this.triggerUpdate()
165
+ }
166
+ }
167
+ },
168
+
169
+ removeTableColumn(){
170
+
171
+ let { element } = getSelection(this.$el)
172
+ if(element.nodeType !== 1)
173
+ element = element.parentNode
174
+ const table = this.closest(element, 'table')
175
+
176
+ if(table) {
177
+ const thead = table.querySelector('thead')
178
+ const tbody = table.querySelector('tbody')
179
+ const tr = this.closest(element, 'tr')
180
+ const index = Array.from(tr.children).indexOf(element)
181
+
182
+ thead.querySelectorAll('tr').forEach(tr => {
183
+ tr.removeChild(tr.children[index])
184
+ })
185
+
186
+ tbody.querySelectorAll('tr').forEach(tr => {
187
+ tr.removeChild(tr.children[index])
188
+ })
189
+
190
+ this.triggerUpdate()
191
+ }
192
+ },
193
+
194
+ insertTable(){
195
+ document.execCommand('insertHTML', false,
196
+ `<table>
197
+ <thead>
198
+ <tr>
199
+ <th>Header</th>
200
+ <th>Header</th>
201
+ </tr>
202
+ </thead>
203
+ <tbody>
204
+ <tr>
205
+ <td>Content</td>
206
+ <td>Content</td>
207
+ </tr>
208
+ </tbody>
209
+ </table>`)
210
+ }
211
+
212
+ },
213
+
214
+ mounted() {
215
+ if(this.editMode){
216
+ window.addEventListener('message', (e) => {
217
+
218
+ const { data, source } = e
219
+
220
+ if(!data || !source) return
221
+
222
+ if(data.uid === this.uid){
223
+
224
+ const { action, type, value } = data.data ?? {}
225
+
226
+ let result
227
+
228
+ switch(action){
229
+
230
+ case 'saveSelection':
231
+ case 'getSelection':
232
+ const sel = saveSelection(this.$el)
233
+ const { text, target, href } = sel
234
+ result = {
235
+ text,
236
+ target,
237
+ href
238
+ }
239
+ break
240
+
241
+ case 'restoreSelection':
242
+ restoreSelection()
243
+ break
244
+
245
+ case 'insertLink':
246
+ restoreSelection()
247
+
248
+ document.execCommand("insertHTML", false,
249
+ "<a style='font-size:inherit;font-family:inherit;background-color:inherit' " +
250
+ "href=\"" + value.href + "\" " +
251
+ "target=\"" + value.target + "\">" +
252
+ value.text +
253
+ "</a>");
254
+ break
255
+
256
+ case 'removeLink':
257
+ const { element } = getSelection(this.$el)
258
+
259
+ let a = element
260
+ while(a && a.tagName !== 'A'){
261
+ a = a.parentNode
262
+ }
263
+ if(a){
264
+ a.parentNode.replaceChild(element, a)
265
+ }
266
+ break
267
+
268
+ case 'insertImage':
269
+ const props = {}
270
+ if(value.width)
271
+ props.width = parseInt(value.width) + 'px'
272
+ if(value.height)
273
+ props.height = parseInt(value.height) + 'px'
274
+
275
+ let propHtml = []
276
+ for(let key in props){
277
+ propHtml.push(`${key}='${props[key]}'`)
278
+ }
279
+
280
+ document.execCommand("insertHTML", false,
281
+ "<img src=\"" + value.url + "\" " + propHtml.join(' ') + "/>");
282
+ break
283
+
284
+ case 'insertTable':
285
+ this.insertTable()
286
+ break
287
+
288
+ case 'removeFormat':
289
+ document.execCommand('removeFormat', false);
290
+ break
291
+
292
+ case 'addTableColumn':
293
+ this.addTableColumn()
294
+ break
295
+
296
+ case 'addTableRow':
297
+ this.addTableRow()
298
+ break
299
+
300
+ case 'removeTableColumn':
301
+ this.removeTableColumn()
302
+ break
303
+
304
+ case 'removeTableRow':
305
+ this.removeTableRow()
306
+ break
307
+
308
+ case 'format':
309
+ switch(type){
310
+ case 'bold':
311
+ case 'italic':
312
+ default:
313
+ document.execCommand(type, false, value);
314
+ break
315
+ }
316
+ this.$el.focus()
317
+ break
318
+
319
+ }
320
+
321
+ source.postMessage(result, '*')
322
+ }
323
+
324
+ })
325
+
326
+ this.$el.setAttribute('contenteditable', 'true')
327
+ }
328
+ },
329
+
330
+ computed: {
331
+
332
+ computedHtml(){
333
+ return this.htmlText
334
+ }
335
+
336
+ },
337
+
338
+ data(){
339
+ return {
340
+ data: {},
341
+ }
342
+ }
343
+
344
+ }
345
+
346
+ </script>
347
+
348
+ <style module>
349
+
350
+ .article{
351
+ @apply relative;
352
+ }
353
+ .article *{
354
+ }
355
+ .article[contenteditable]{
356
+ @apply outline-none;
357
+ }
358
+
359
+ .article a{
360
+ @apply text-primary underline;
361
+ }
362
+
363
+ .article ul li{
364
+ @apply list-disc list-inside;
365
+ }
366
+ .article ol li{
367
+ @apply list-decimal list-inside;
368
+ }
369
+
370
+ .article font[size='1']{ @apply text-xs; }
371
+ .article font[size='2']{ @apply text-sm; }
372
+ .article font[size='3']{ @apply text-lg; }
373
+ .article font[size='4']{ @apply text-xl; }
374
+ .article font[size='5']{ @apply text-2xl; }
375
+ .article font[size='6']{ @apply text-3xl; }
376
+ .article font[size='7']{ @apply text-4xl; }
377
+
378
+ .article table{
379
+ @apply border-[1px] border-border-200 border-collapse w-full;
380
+ table-layout: fixed;
381
+ }
382
+ .article table th, .article table td{
383
+ @apply border-[1px] border-border-200 p-3 text-left;
384
+ @apply break-words;
385
+ }
386
+
387
+ </style>
@@ -0,0 +1,87 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <Bar :data="modelValue ?? emptyData"
4
+ :options="mergedOptions"
5
+ :plugins="plugins"
6
+ :dataset-id-key="datasetIdKey"
7
+ :update-mode="updateMode"
8
+ :style="barStyles" />
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+
14
+ import { Bar } from 'vue-chartjs'
15
+ import { Chart as ChartJS, CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend } from 'chart.js'
16
+
17
+ ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend)
18
+
19
+ export default {
20
+
21
+ components: { Bar },
22
+
23
+ inheritAttrs: false,
24
+
25
+ props: {
26
+ modelValue: { type: Object, default: null },
27
+ options: { type: Object, default: () => ({}) },
28
+ plugins: { type: Array, default: () => [] },
29
+ datasetIdKey: { type: String, default: 'label' },
30
+ updateMode: { type: String, default: undefined },
31
+ height: { type: Number, default: 200 },
32
+ },
33
+
34
+ computed: {
35
+
36
+ emptyData() {
37
+ return { labels: [], datasets: [] }
38
+ },
39
+
40
+ barStyles() {
41
+ return { position: 'relative', height: `${this.height}px` }
42
+ },
43
+
44
+ mergedOptions() {
45
+ return {
46
+ responsive: true,
47
+ maintainAspectRatio: false,
48
+ borderRadius: 4,
49
+ plugins: {
50
+ legend: { display: false },
51
+ },
52
+ scales: {
53
+ x: {
54
+ grid: { display: true, color: () => 'rgba(255,255,255,.1)' },
55
+ ticks: {
56
+ callback: function (value) {
57
+ const label = this.getLabelForValue(value) ?? ''
58
+ return label.length > 30 ? label.slice(0, 30) + '...' : label
59
+ },
60
+ minRotation: 0,
61
+ maxRotation: 0,
62
+ font: { size: 11 },
63
+ },
64
+ },
65
+ y: {
66
+ beginAtZero: true,
67
+ grid: { display: true, color: () => 'rgba(255,255,255,.1)' },
68
+ ticks: { font: { size: 11 } },
69
+ },
70
+ },
71
+ ...this.options,
72
+ }
73
+ },
74
+
75
+ },
76
+
77
+ }
78
+ </script>
79
+
80
+ <style module>
81
+
82
+ .comp {
83
+ @apply border-[1px] border-border-50 bg-base-500 rounded-lg;
84
+ @apply p-3;
85
+ }
86
+
87
+ </style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div :class="$style.comp" :style="computedStyle">
3
+ <component v-for="item in items"
4
+ :is="item.type"
5
+ :="item" />
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+
11
+ import {componentMixin} from "../mixin/component";
12
+
13
+ export default{
14
+
15
+ mixins: [ componentMixin ],
16
+
17
+ props:{
18
+ items: Array,
19
+ }
20
+
21
+ }
22
+
23
+ </script>
24
+
25
+ <style module>
26
+
27
+ .comp{
28
+ @apply block;
29
+ }
30
+
31
+ </style>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <br />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ import { componentMixin } from '../mixin/component';
10
+
11
+ export default{
12
+
13
+ mixins: [ componentMixin ],
14
+
15
+ props: {
16
+
17
+ title: {
18
+ type: String,
19
+ default: 'Box'
20
+ }
21
+
22
+ }
23
+
24
+ }
25
+
26
+ </script>
27
+
28
+ <style module>
29
+
30
+ .comp{
31
+ @apply flex items-center justify-center;
32
+ }
33
+
34
+ </style>