@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.
Files changed (398) hide show
  1. package/docs/components/AccountIcon.md +16 -0
  2. package/docs/components/Ahref.md +35 -0
  3. package/docs/components/Alert.md +72 -0
  4. package/docs/components/ArrayList.md +39 -0
  5. package/docs/components/Article.md +28 -0
  6. package/docs/components/BarChart.md +81 -0
  7. package/docs/components/Block.md +23 -0
  8. package/docs/components/Box.md +15 -0
  9. package/docs/components/Button.md +68 -0
  10. package/docs/components/Card.md +67 -0
  11. package/docs/components/Carousel.md +70 -0
  12. package/docs/components/Cart.md +20 -0
  13. package/docs/components/CartIcon.md +29 -0
  14. package/docs/components/Chart.md +53 -0
  15. package/docs/components/ChartBar.md +34 -0
  16. package/docs/components/ChatTyping.md +21 -0
  17. package/docs/components/Checkbox.md +63 -0
  18. package/docs/components/CodeEditor.md +25 -0
  19. package/docs/components/CollapsiblePanel.md +41 -0
  20. package/docs/components/ColorPicker.md +52 -0
  21. package/docs/components/Confirm.md +62 -0
  22. package/docs/components/ContextMenu.md +76 -0
  23. package/docs/components/ContextMenuItem.md +29 -0
  24. package/docs/components/CopyToClipboard.md +43 -0
  25. package/docs/components/Countdown.md +47 -0
  26. package/docs/components/Datepicker.md +61 -0
  27. package/docs/components/Datetimepicker.md +57 -0
  28. package/docs/components/DayTimeRange.md +20 -0
  29. package/docs/components/Dropdown.md +65 -0
  30. package/docs/components/ErrorText.md +15 -0
  31. package/docs/components/FBLogin.md +21 -0
  32. package/docs/components/Flex.md +44 -0
  33. package/docs/components/GHeatMaps.md +16 -0
  34. package/docs/components/GSignIn.md +21 -0
  35. package/docs/components/Gmaps.md +16 -0
  36. package/docs/components/GmapsDirection.md +20 -0
  37. package/docs/components/Grid.md +36 -0
  38. package/docs/components/HTMLEditor.md +26 -0
  39. package/docs/components/IconMenu.md +20 -0
  40. package/docs/components/Image.md +78 -0
  41. package/docs/components/Link.md +33 -0
  42. package/docs/components/MultiDropdown.md +46 -0
  43. package/docs/components/Radio.md +55 -0
  44. package/docs/components/Slider.md +47 -0
  45. package/docs/components/Switch.md +43 -0
  46. package/docs/components/Table.md +31 -0
  47. package/docs/components/Tabs.md +65 -0
  48. package/docs/components/Text.md +30 -0
  49. package/docs/components/Textarea.md +66 -0
  50. package/docs/components/Textbox.md +97 -0
  51. package/docs/components/Timepicker.md +62 -0
  52. package/docs/components/Toast.md +59 -0
  53. package/docs/components/Uploader.md +51 -0
  54. package/docs/components/Video.md +54 -0
  55. package/package.json +65 -2
  56. package/docs/components/Dashboard.md +0 -56
  57. package/docs/components/Header2.md +0 -16
  58. package/log.txt +0 -7
  59. package/public/assets/dashboard/bar.png +0 -0
  60. package/public/assets/dashboard/doughnut.png +0 -0
  61. package/public/assets/dashboard/metric.png +0 -0
  62. package/public/assets/dashboard/pie.png +0 -0
  63. package/public/assets/dashboard/polar-area.png +0 -0
  64. package/public/assets/dashboard/virtual-table.png +0 -0
  65. package/public/static/dashboard/bar.png +0 -0
  66. package/public/static/dashboard/doughnut.png +0 -0
  67. package/public/static/dashboard/metric.png +0 -0
  68. package/public/static/dashboard/pie.png +0 -0
  69. package/public/static/dashboard/polar-area.png +0 -0
  70. package/public/static/dashboard/virtual-table.png +0 -0
  71. package/src/components/404.vue +0 -61
  72. package/src/components/AccountIcon.vue +0 -19
  73. package/src/components/Ahref.vue +0 -200
  74. package/src/components/Alert.vue +0 -257
  75. package/src/components/ArrayList.vue +0 -49
  76. package/src/components/Article.vue +0 -387
  77. package/src/components/Block.vue +0 -31
  78. package/src/components/Box.vue +0 -34
  79. package/src/components/Button.vue +0 -258
  80. package/src/components/Card.vue +0 -257
  81. package/src/components/Carousel.vue +0 -364
  82. package/src/components/Cart.vue +0 -192
  83. package/src/components/CartIcon.vue +0 -89
  84. package/src/components/Chart.vue +0 -485
  85. package/src/components/ChartBar.vue +0 -192
  86. package/src/components/ChatTyping.vue +0 -69
  87. package/src/components/Checkbox.vue +0 -200
  88. package/src/components/Checkout.vue +0 -373
  89. package/src/components/CheckoutDelivery.vue +0 -267
  90. package/src/components/CodeEditor.vue +0 -50
  91. package/src/components/CollapsiblePanel.vue +0 -70
  92. package/src/components/ColorPicker.vue +0 -165
  93. package/src/components/ColorPicker2.vue +0 -186
  94. package/src/components/ColorPicker3.vue +0 -100
  95. package/src/components/Confirm.vue +0 -180
  96. package/src/components/ContextMenu.vue +0 -265
  97. package/src/components/ContextMenuItem.vue +0 -53
  98. package/src/components/ConversationBuilder.vue +0 -161
  99. package/src/components/CopyToClipboard.vue +0 -34
  100. package/src/components/Countdown.vue +0 -264
  101. package/src/components/DGrid.vue +0 -21
  102. package/src/components/DGridItem.vue +0 -263
  103. package/src/components/Dashboard.vue +0 -243
  104. package/src/components/Dashboard2.vue +0 -118
  105. package/src/components/DashboardComponentSelector.vue +0 -96
  106. package/src/components/DashboardConfigs.vue +0 -202
  107. package/src/components/DataList.vue +0 -92
  108. package/src/components/Datepicker.vue +0 -399
  109. package/src/components/DayTimeRange.vue +0 -126
  110. package/src/components/Dropdown.vue +0 -224
  111. package/src/components/ErrorText.vue +0 -57
  112. package/src/components/FBLogin.vue +0 -194
  113. package/src/components/Feed.vue +0 -118
  114. package/src/components/Flex.vue +0 -44
  115. package/src/components/GHeatMaps.vue +0 -317
  116. package/src/components/GSignIn.vue +0 -166
  117. package/src/components/Gmaps.vue +0 -251
  118. package/src/components/GmapsDirection.vue +0 -191
  119. package/src/components/Grid.vue +0 -35
  120. package/src/components/HTMLEditor.vue +0 -588
  121. package/src/components/IconMenu.vue +0 -95
  122. package/src/components/IconMenu2.vue +0 -89
  123. package/src/components/IconPlus.vue +0 -89
  124. package/src/components/Image.vue +0 -263
  125. package/src/components/Image360.vue +0 -140
  126. package/src/components/ImageFullScreen.vue +0 -101
  127. package/src/components/ImagePreview.vue +0 -93
  128. package/src/components/ImageUploader.vue +0 -114
  129. package/src/components/ImportModal.vue +0 -260
  130. package/src/components/Link.vue +0 -95
  131. package/src/components/List.vue +0 -1381
  132. package/src/components/ListContextMenu.vue +0 -88
  133. package/src/components/ListItem.vue +0 -160
  134. package/src/components/ListPage1.vue +0 -1401
  135. package/src/components/ListPage1Filter.vue +0 -170
  136. package/src/components/ListView.vue +0 -961
  137. package/src/components/ListViewBarSummary.vue +0 -81
  138. package/src/components/ListViewLineSummary.vue +0 -75
  139. package/src/components/ListViewLiveBarSummary.vue +0 -52
  140. package/src/components/ListViewMapSummary.vue +0 -56
  141. package/src/components/ListViewSettings.vue +0 -514
  142. package/src/components/ListViewTableSummary.vue +0 -77
  143. package/src/components/LogViewerItem.vue +0 -116
  144. package/src/components/MarkdownEdit.vue +0 -128
  145. package/src/components/MarkdownPreview.vue +0 -102
  146. package/src/components/MenuItem1.vue +0 -36
  147. package/src/components/Modal.vue +0 -456
  148. package/src/components/MultiDropdown.vue +0 -124
  149. package/src/components/MultilineText.vue +0 -174
  150. package/src/components/OTPField.vue +0 -139
  151. package/src/components/ObjectTree.vue +0 -105
  152. package/src/components/PageBuilder.vue +0 -449
  153. package/src/components/Paragraph.vue +0 -40
  154. package/src/components/PresetSelectorFilterItem.vue +0 -203
  155. package/src/components/Radio.vue +0 -109
  156. package/src/components/SearchModal.vue +0 -153
  157. package/src/components/Slider.vue +0 -317
  158. package/src/components/SplitPane.vue +0 -129
  159. package/src/components/Svg.vue +0 -33
  160. package/src/components/SvgEditor.vue +0 -173
  161. package/src/components/Switch.vue +0 -101
  162. package/src/components/TabView.vue +0 -105
  163. package/src/components/Table.vue +0 -56
  164. package/src/components/TableView.vue +0 -200
  165. package/src/components/TableViewHead.vue +0 -159
  166. package/src/components/Tabs.vue +0 -131
  167. package/src/components/Test.vue +0 -23
  168. package/src/components/Testimonial.vue +0 -86
  169. package/src/components/Text.vue +0 -34
  170. package/src/components/TextBlock.vue +0 -50
  171. package/src/components/TextEditor.vue +0 -85
  172. package/src/components/TextWithTag.vue +0 -298
  173. package/src/components/Textarea.vue +0 -184
  174. package/src/components/Textbox.vue +0 -216
  175. package/src/components/Thumbnail.vue +0 -27
  176. package/src/components/Timepicker.vue +0 -125
  177. package/src/components/Toast.vue +0 -117
  178. package/src/components/TreeMenu.vue +0 -122
  179. package/src/components/TreeView.vue +0 -106
  180. package/src/components/TreeView2.vue +0 -38
  181. package/src/components/TreeViewItem.vue +0 -453
  182. package/src/components/TreeViewItem1.vue +0 -282
  183. package/src/components/TreeViewItem2.vue +0 -55
  184. package/src/components/Uploader.vue +0 -45
  185. package/src/components/Video.vue +0 -119
  186. package/src/components/VirtualGrid.vue +0 -297
  187. package/src/components/VirtualScroll.vue +0 -282
  188. package/src/components/VirtualTable.vue +0 -956
  189. package/src/components/YoutubeVideo.vue +0 -196
  190. package/src/configs/dashboard/bar.js +0 -10
  191. package/src/configs/dashboard/collection-1.js +0 -5
  192. package/src/configs/dashboard/data-table.js +0 -9
  193. package/src/configs/dashboard/doughnut.js +0 -7
  194. package/src/configs/dashboard/gheatmaps.js +0 -9
  195. package/src/configs/dashboard/grid-2.js +0 -34
  196. package/src/configs/dashboard/grid-3.js +0 -34
  197. package/src/configs/dashboard/grid-4.js +0 -34
  198. package/src/configs/dashboard/grid.js +0 -15
  199. package/src/configs/dashboard/metric.js +0 -10
  200. package/src/configs/dashboard/pie.js +0 -7
  201. package/src/configs/dashboard/polar-area.js +0 -7
  202. package/src/configs/dashboard/virtual-table.js +0 -9
  203. package/src/configs/icons-fa.json +0 -12
  204. package/src/configs/web-page-builder.js +0 -118
  205. package/src/defs/dashboard-preset.js +0 -22
  206. package/src/directives/intersect.js +0 -26
  207. package/src/hooks/device.js +0 -14
  208. package/src/index.css +0 -3
  209. package/src/index.js +0 -648
  210. package/src/middleware/http/trim-string.js +0 -20
  211. package/src/mixin/component.js +0 -306
  212. package/src/mixin/ready-state.js +0 -37
  213. package/src/stores/components.js +0 -36
  214. package/src/stores/datasource.js +0 -11
  215. package/src/themes/default/index.js +0 -303
  216. package/src/utils/dashboard.js +0 -140
  217. package/src/utils/event-bus.js +0 -8
  218. package/src/utils/helpers.cjs +0 -635
  219. package/src/utils/helpers.js +0 -635
  220. package/src/utils/helpers.mjs +0 -722
  221. package/src/utils/importer.js +0 -209
  222. package/src/utils/list.mjs +0 -1509
  223. package/src/utils/listpage1.js +0 -1507
  224. package/src/utils/listview.js +0 -1287
  225. package/src/utils/preset-selector.cjs +0 -1455
  226. package/src/utils/preset-selector.js +0 -1452
  227. package/src/utils/preset-selector.mjs +0 -234
  228. package/src/utils/queue.js +0 -63
  229. package/src/utils/selection.js +0 -43
  230. package/src/utils/web.js +0 -50
  231. package/src/utils/web.mjs +0 -120
  232. package/src/utils/wss.js +0 -296
  233. package/src/utils/wss.mjs +0 -285
  234. package/src/widgets/AhrefSetting.vue +0 -97
  235. package/src/widgets/ArticleSetting.vue +0 -457
  236. package/src/widgets/BackgroundColorSetting.vue +0 -153
  237. package/src/widgets/BackgroundSetting.vue +0 -132
  238. package/src/widgets/BlockSetting.vue +0 -49
  239. package/src/widgets/BorderColorSetting.vue +0 -57
  240. package/src/widgets/BorderSetting.vue +0 -201
  241. package/src/widgets/BotEditor/BotEditorActions.vue +0 -163
  242. package/src/widgets/BotEditor/BotEditorSettings.vue +0 -21
  243. package/src/widgets/BotEditor.vue +0 -248
  244. package/src/widgets/BoxSetting.vue +0 -53
  245. package/src/widgets/ButtonSetting.vue +0 -113
  246. package/src/widgets/CarouselSetting.vue +0 -181
  247. package/src/widgets/CartSetting.vue +0 -46
  248. package/src/widgets/CheckoutSetting.vue +0 -46
  249. package/src/widgets/CollapsiblePanelSetting.vue +0 -46
  250. package/src/widgets/ColumnSelector.vue +0 -104
  251. package/src/widgets/ComponentPropertyLabel.vue +0 -35
  252. package/src/widgets/ComponentPropertySelector.vue +0 -115
  253. package/src/widgets/ComponentSetting.vue +0 -2220
  254. package/src/widgets/ComponentSetting2.vue +0 -927
  255. package/src/widgets/ComponentSetting3.vue +0 -231
  256. package/src/widgets/ContactForm.vue +0 -193
  257. package/src/widgets/ContactFormSetting.vue +0 -395
  258. package/src/widgets/CountdownSetting.vue +0 -76
  259. package/src/widgets/Dashboard/BarChart.vue +0 -366
  260. package/src/widgets/Dashboard/BarChartSetting.vue +0 -317
  261. package/src/widgets/Dashboard/DataTable.vue +0 -125
  262. package/src/widgets/Dashboard/DataTableSetting.vue +0 -243
  263. package/src/widgets/Dashboard/DatasourceFilterSharing.vue +0 -93
  264. package/src/widgets/Dashboard/DatasourcePreview.vue +0 -93
  265. package/src/widgets/Dashboard/DatasourceSelector.vue +0 -122
  266. package/src/widgets/Dashboard/Doughnut.vue +0 -199
  267. package/src/widgets/Dashboard/DoughnutSetting.vue +0 -196
  268. package/src/widgets/Dashboard/GHeatMapsSetting.vue +0 -108
  269. package/src/widgets/Dashboard/InteractionEdit.vue +0 -228
  270. package/src/widgets/Dashboard/Metric.vue +0 -135
  271. package/src/widgets/Dashboard/MetricSetting.vue +0 -227
  272. package/src/widgets/Dashboard/Pie.vue +0 -188
  273. package/src/widgets/Dashboard/PieSetting.vue +0 -247
  274. package/src/widgets/Dashboard/PolarArea.vue +0 -201
  275. package/src/widgets/Dashboard/PolarAreaSetting.vue +0 -195
  276. package/src/widgets/Dashboard/SharingModal.vue +0 -115
  277. package/src/widgets/Dashboard/ViewSelector.vue +0 -183
  278. package/src/widgets/Dashboard/VirtualColumnEdit.vue +0 -97
  279. package/src/widgets/Dashboard/VirtualTableSetting.vue +0 -171
  280. package/src/widgets/Dashboard0.vue +0 -1856
  281. package/src/widgets/DataListSetting.vue +0 -102
  282. package/src/widgets/EffectSetting.vue +0 -94
  283. package/src/widgets/EmbeddedVideo.vue +0 -60
  284. package/src/widgets/EmbeddedVideoSetting.vue +0 -50
  285. package/src/widgets/FAQ.vue +0 -98
  286. package/src/widgets/FAQSetting.vue +0 -94
  287. package/src/widgets/FeatureList.vue +0 -131
  288. package/src/widgets/FeatureListSetting.vue +0 -233
  289. package/src/widgets/FiltersSetting.vue +0 -88
  290. package/src/widgets/FlexSetting.vue +0 -174
  291. package/src/widgets/GridSetting.vue +0 -165
  292. package/src/widgets/Header.vue +0 -15
  293. package/src/widgets/Header0.vue +0 -41
  294. package/src/widgets/Header0Setting.vue +0 -75
  295. package/src/widgets/Header2.vue +0 -65
  296. package/src/widgets/Header2Setting.vue +0 -193
  297. package/src/widgets/HeaderSetting.vue +0 -102
  298. package/src/widgets/IconList.vue +0 -51
  299. package/src/widgets/IconListSetting.vue +0 -188
  300. package/src/widgets/ImageSetting.vue +0 -119
  301. package/src/widgets/LayoutSetting.vue +0 -251
  302. package/src/widgets/LinkSetting.vue +0 -209
  303. package/src/widgets/LinkSettingModal.vue +0 -173
  304. package/src/widgets/LogViewer.vue +0 -85
  305. package/src/widgets/MarginPaddingSetting.vue +0 -58
  306. package/src/widgets/MarginSetting.vue +0 -142
  307. package/src/widgets/MenuEditor.vue +0 -256
  308. package/src/widgets/MenuItem1Setting.vue +0 -78
  309. package/src/widgets/ModalSetting.vue +0 -94
  310. package/src/widgets/MultiValueSetting.vue +0 -121
  311. package/src/widgets/MultiValueSetting2.vue +0 -147
  312. package/src/widgets/OGSettingModal.vue +0 -103
  313. package/src/widgets/PaddingSetting.vue +0 -142
  314. package/src/widgets/ParagraphSetting.vue +0 -89
  315. package/src/widgets/PositionSetting.vue +0 -209
  316. package/src/widgets/PresetBar.vue +0 -990
  317. package/src/widgets/PresetBarPivot.vue +0 -198
  318. package/src/widgets/PresetBarPivotColumnEdit.vue +0 -197
  319. package/src/widgets/PresetSelector.vue +0 -685
  320. package/src/widgets/Review.vue +0 -131
  321. package/src/widgets/ReviewSetting.vue +0 -201
  322. package/src/widgets/SearchModalSetting.vue +0 -70
  323. package/src/widgets/Share.vue +0 -164
  324. package/src/widgets/ShareSetting.vue +0 -99
  325. package/src/widgets/SizingSetting.vue +0 -306
  326. package/src/widgets/SpacingSetting.vue +0 -77
  327. package/src/widgets/StyleSetting.vue +0 -543
  328. package/src/widgets/StyleSetting2.vue +0 -90
  329. package/src/widgets/SvgSetting.vue +0 -133
  330. package/src/widgets/TableSetting.vue +0 -172
  331. package/src/widgets/TestimonialSetting.vue +0 -161
  332. package/src/widgets/TextBlockSetting.vue +0 -81
  333. package/src/widgets/ThumbnailSetting.vue +0 -49
  334. package/src/widgets/TransitionSetting.vue +0 -64
  335. package/src/widgets/TypographySetting.vue +0 -334
  336. package/src/widgets/UserActionBuilder/UserActionCondition.vue +0 -99
  337. package/src/widgets/UserActionBuilder/UserActionConsole.vue +0 -97
  338. package/src/widgets/UserActionBuilder/UserActionItem.vue +0 -273
  339. package/src/widgets/UserActionBuilder/UserActionOutput.vue +0 -152
  340. package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +0 -27
  341. package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +0 -28
  342. package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +0 -112
  343. package/src/widgets/UserActionBuilder/UserActionProps.vue +0 -213
  344. package/src/widgets/UserActionBuilder.vue +0 -314
  345. package/src/widgets/WebComponentSelector.vue +0 -205
  346. package/src/widgets/WebDatasourceSelector.vue +0 -153
  347. package/src/widgets/WebLayoutSelector.vue +0 -147
  348. package/src/widgets/WebPageBuilder.vue +0 -2161
  349. package/src/widgets/WebPageBuilder2.vue +0 -1091
  350. package/src/widgets/WebPageBuilder3.vue +0 -411
  351. package/src/widgets/WebPageBuilder4/BackgroundColorSetting.vue +0 -54
  352. package/src/widgets/WebPageBuilder4/BackgroundPositionSetting.vue +0 -75
  353. package/src/widgets/WebPageBuilder4/BackgroundRepeatSetting.vue +0 -72
  354. package/src/widgets/WebPageBuilder4/BackgroundSizeSetting.vue +0 -72
  355. package/src/widgets/WebPageBuilder4/BlurSetting.vue +0 -72
  356. package/src/widgets/WebPageBuilder4/BorderColorSetting.vue +0 -64
  357. package/src/widgets/WebPageBuilder4/BorderRadiusSetting.vue +0 -75
  358. package/src/widgets/WebPageBuilder4/BorderSizeSetting.vue +0 -69
  359. package/src/widgets/WebPageBuilder4/BorderStyleSetting.vue +0 -72
  360. package/src/widgets/WebPageBuilder4/BoxShadowSetting.vue +0 -73
  361. package/src/widgets/WebPageBuilder4/ButtonSetting.vue +0 -65
  362. package/src/widgets/WebPageBuilder4/CarouselSetting.vue +0 -178
  363. package/src/widgets/WebPageBuilder4/DisplaySetting.vue +0 -76
  364. package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +0 -71
  365. package/src/widgets/WebPageBuilder4/FlexDirectionSetting.vue +0 -70
  366. package/src/widgets/WebPageBuilder4/FlexJustifySetting.vue +0 -74
  367. package/src/widgets/WebPageBuilder4/FlexPropertySetting.vue +0 -71
  368. package/src/widgets/WebPageBuilder4/FlexSetting.vue +0 -96
  369. package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +0 -69
  370. package/src/widgets/WebPageBuilder4/GapSetting.vue +0 -75
  371. package/src/widgets/WebPageBuilder4/GrayscaleSetting.vue +0 -68
  372. package/src/widgets/WebPageBuilder4/GridSetting.vue +0 -216
  373. package/src/widgets/WebPageBuilder4/HeightSetting.vue +0 -98
  374. package/src/widgets/WebPageBuilder4/ImageSetting.vue +0 -102
  375. package/src/widgets/WebPageBuilder4/MarginSetting.vue +0 -73
  376. package/src/widgets/WebPageBuilder4/MaxHeightSetting.vue +0 -82
  377. package/src/widgets/WebPageBuilder4/MaxWidthSetting.vue +0 -90
  378. package/src/widgets/WebPageBuilder4/MinHeightSetting.vue +0 -81
  379. package/src/widgets/WebPageBuilder4/MinWidthSetting.vue +0 -101
  380. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +0 -163
  381. package/src/widgets/WebPageBuilder4/OpacitySetting.vue +0 -77
  382. package/src/widgets/WebPageBuilder4/OverflowSetting.vue +0 -81
  383. package/src/widgets/WebPageBuilder4/PaddingSetting.vue +0 -57
  384. package/src/widgets/WebPageBuilder4/PositionSetting.vue +0 -191
  385. package/src/widgets/WebPageBuilder4/PropertySetting.vue +0 -176
  386. package/src/widgets/WebPageBuilder4/TextSetting.vue +0 -72
  387. package/src/widgets/WebPageBuilder4/TreeView.vue +0 -46
  388. package/src/widgets/WebPageBuilder4/TreeViewItem.vue +0 -303
  389. package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +0 -141
  390. package/src/widgets/WebPageBuilder4/WebPagePropertySelector.vue +0 -172
  391. package/src/widgets/WebPageBuilder4/WidthSetting.vue +0 -105
  392. package/src/widgets/WebPageBuilder4/ZIndexSetting.vue +0 -72
  393. package/src/widgets/WebPageBuilder4.vue +0 -798
  394. package/src/widgets/WebPagePreview.vue +0 -295
  395. package/src/widgets/WebPageSelector.vue +0 -173
  396. package/src/widgets/WebTemplateCreator.vue +0 -156
  397. package/src/widgets/YoutubeVideoSetting.vue +0 -68
  398. package/tailwind.config.js +0 -481
@@ -1,1287 +0,0 @@
1
- const { Op } = require('sequelize')
2
- const Sequelize = require('sequelize')
3
- const dayjs = require("dayjs");
4
- const Exceljs = require("exceljs");
5
- const { getPresetSortWhereParams, ftWildcard } = require("./helpers");
6
-
7
- let ListView = {
8
-
9
- presetName: 'listview1',
10
- itemsPerPage: 24,
11
- model: '',
12
- channel: '',
13
- conn: null,
14
-
15
- async load(params){
16
-
17
- this.columns = params.columns
18
-
19
- const { items, hasNext, count, derivedSql, where, replacements } = await this._load(params)
20
-
21
- const summary = await this.loadSummary(params, {
22
- derivedSql,
23
- where,
24
- replacements
25
- })
26
-
27
- if(this.name){
28
- if(!this.socket.loadParams){
29
- this.socket.loadParams = {}
30
- }
31
- this.socket.loadParams[this.name] = params
32
- }
33
-
34
- const extra = typeof this.postLoad === 'function' ? await this.postLoad() : undefined
35
-
36
- return {
37
- items,
38
- hasNext,
39
- count,
40
- summary,
41
- ...(extra ?? {})
42
- }
43
- },
44
-
45
- async loadSummary(params, loadResults){
46
-
47
- if(!this.conn){
48
- return
49
- }
50
-
51
- if(!params || !params.preset){
52
- return
53
- }
54
-
55
- const summary = (params.preset.summaries ?? []).filter((_) => _.enabled).pop()
56
- if(!summary) return
57
-
58
- const { derivedSql, where, replacements } = loadResults
59
-
60
- switch(summary.mode){
61
-
62
- case 'bar':
63
- return await this.loadBarSummary(summary, derivedSql)
64
-
65
- case 'line':
66
- return await this.loadLineSummary(summary, derivedSql)
67
-
68
- case 'table':
69
- return await this.loadTableSummary(summary, derivedSql)
70
-
71
- case 'map':
72
- if(this.loadMapSummary){
73
- return await this.loadMapSummary(params.preset, {
74
- derivedSql,
75
- where,
76
- replacements
77
- })
78
- }
79
- break
80
- }
81
- },
82
-
83
- async subscribe(params, socket){
84
- const { name } = params
85
- if(name){
86
- socket.join(name)
87
- }
88
- },
89
-
90
- async unsubscribe(params, socket){
91
- const { name } = params
92
- if(name){
93
- socket.leave(name)
94
- }
95
- },
96
-
97
- async downloadRows(params, socket){
98
-
99
- const { preset } = params
100
-
101
- const columns = []
102
- preset.columns.forEach((column) => {
103
- if(column.visible){
104
- columns.push({ header: column.label, key: column.key, width: 15 })
105
- }
106
- })
107
-
108
- const workbook = new Exceljs.Workbook();
109
- const sheet = workbook.addWorksheet('Export ' + this.name);
110
- sheet.columns = columns
111
-
112
- let where = []
113
- let replacements = []
114
- let order = [
115
- [ 'updatedAt', 'desc' ],
116
- [ 'id', 'desc' ],
117
- ]
118
-
119
- let attributeIncludes
120
- if(this.getAttributeIncludes){
121
- attributeIncludes = this.getAttributeIncludes(preset)
122
- }
123
-
124
- let attributes = { id:1, updatedAt:1 }
125
- if(preset.columns){
126
- let modelAttributes = this.model.getAttributes();
127
- preset.columns.forEach((column) => {
128
- if(column.visible && modelAttributes[column.key]){
129
- attributes[column.key] = 1
130
- }
131
- else if(column.virtual){
132
- switch(column.virtual.type){
133
-
134
- case 'sql':
135
- if(!Array.isArray(attributeIncludes)){
136
- attributeIncludes = []
137
- }
138
-
139
- attributeIncludes.push([
140
- Sequelize.literal(`(${column.virtual.value})`), column.key
141
- ])
142
- break
143
- }
144
- }
145
- })
146
- }
147
- attributes = Object.keys(attributes)
148
-
149
- if(preset.search && typeof this.searchFn === 'function'){
150
- const { where:presetWhere, replacements:presetReplacements } = await this.searchFn(preset) ?? {}
151
- if(presetWhere){
152
- where.push(presetWhere)
153
- replacements = replacements.concat(presetReplacements ?? [])
154
- }
155
- }
156
- else if(preset.filters){
157
- const { where:presetWhere } = this.getPresetFilterParams(preset)
158
- where.push(presetWhere)
159
- }
160
-
161
- if(typeof this.filterFn === 'function'){
162
- const { where:filterWhere, replacements:filterReplacements } = await this.filterFn(preset) ?? {}
163
- if(filterWhere){
164
- where.push(filterWhere)
165
- replacements = replacements.concat(filterReplacements ?? [])
166
- }
167
- }
168
-
169
- if(preset.sorts){
170
- const { order:presetOrder } = this.getPresetSortParams(preset)
171
- if(presetOrder){
172
- order = presetOrder
173
- }
174
- }
175
-
176
- const rows = await this.model.findAll({
177
- where: {
178
- [Op.and]: where
179
- },
180
- attributes: {
181
- ...attributes,
182
- include: attributeIncludes
183
- },
184
- order,
185
- replacements,
186
- include: this.getModelIncludes ? this.getModelIncludes(preset) : undefined
187
- })
188
-
189
- rows.forEach((row) => {
190
-
191
- const obj = {}
192
- preset.columns.forEach((column) => {
193
- if(column.visible){
194
- switch(column.type){
195
-
196
- case 'enum':
197
- const enumValue = row[column.key]
198
- const enumObj = column.typeParams.filter((_) => _.value === enumValue).pop()
199
- const enumText = (enumObj ?? {}).text ?? enumValue
200
- obj[column.key] = enumText
201
- break
202
-
203
- default:
204
- obj[column.key] = row[column.key]
205
- break
206
- }
207
- }
208
- })
209
- sheet.addRow(obj)
210
- })
211
-
212
- const filename = 'data-konsumen-' + dayjs().format('YYYYMMDDHHmm') + '.xlsx'
213
- await workbook.xlsx.writeFile(process.env.ROOT_PATH + '/storage/files/downloads/' + filename);
214
- return {
215
- url: '/downloads/' + filename
216
- }
217
- },
218
-
219
-
220
-
221
- async _load(params){
222
-
223
- const { afterItem, itemsPerPage = this.itemsPerPage ?? 24 } = params
224
-
225
- const { preset = {} } = params
226
- let where = []
227
- let replacements = []
228
- let order = [
229
- [ 'updatedAt', 'desc' ],
230
- [ 'id', 'desc' ],
231
- ]
232
-
233
- let attributeIncludes = []
234
- if(this.getAttributeIncludes){
235
- attributeIncludes = this.getAttributeIncludes(preset)
236
- }
237
-
238
- let includes
239
- if(this.getModelIncludes){
240
- includes = await this.getModelIncludes(preset)
241
- }
242
-
243
- let attributes = { id:1, updatedAt:1 }
244
- let modelAttributes = this.model.getAttributes();
245
- if(preset.columns){
246
- preset.columns.forEach((column) => {
247
- if(column.visible && modelAttributes[column.key]){
248
- attributes[column.key] = 1
249
- }
250
- else if(column.virtual){
251
- switch(column.virtual.type){
252
-
253
- case 'sql':
254
- attributeIncludes.push([
255
- Sequelize.literal(`(${column.virtual.value})`), column.key
256
- ])
257
- break
258
- }
259
- }
260
- })
261
- }
262
- if(typeof this.extraAttributes === 'function'){
263
- attributes = {
264
- ...attributes,
265
- ...((await this.extraAttributes(preset)) ?? {})
266
- }
267
- }
268
- attributes = Object.keys(attributes)
269
-
270
- if(preset.search && typeof this.searchFn === 'function'){
271
- const { where:presetWhere, replacements:presetReplacements } = await this.searchFn(preset) ?? {}
272
- if(presetWhere){
273
- where.push(presetWhere)
274
- replacements = replacements.concat(presetReplacements ?? [])
275
- }
276
- }
277
- else if(preset.filters){
278
- const { where:presetWhere } = this.getPresetFilterParams(preset, includes)
279
- where.push(presetWhere)
280
- }
281
-
282
- if(typeof this.filterFn === 'function'){
283
- const { where:filterWhere, replacements:filterReplacements } = await this.filterFn(preset) ?? {}
284
- if(filterWhere){
285
- where.push(filterWhere)
286
- replacements = replacements.concat(filterReplacements ?? [])
287
- }
288
- }
289
-
290
- if(preset.sorts){
291
- const { order:presetOrder } = this.getPresetSortParams(preset, includes)
292
- if(presetOrder){
293
- order = presetOrder
294
- }
295
- }
296
-
297
- if(afterItem){
298
- const sortWhere = getPresetSortWhereParams(order, afterItem)
299
- where.push(sortWhere)
300
- }
301
-
302
- let derivedSql
303
- let { rows:items, count } = await this.model.findAndCountAll({
304
- where: {
305
- [Op.and]: where
306
- },
307
- attributes: [
308
- ...attributes,
309
- ...attributeIncludes
310
- ],
311
- order,
312
- limit: itemsPerPage + 1,
313
- replacements,
314
- include: includes,
315
- logging: (sql, queryObject, p) => {
316
- derivedSql = sql
317
- }
318
- })
319
- derivedSql = derivedSql.replace('Executing (default): ', '').replace('LIMIT ' + (this.itemsPerPage + 1), '').slice(0, -1)
320
-
321
- const hasNext = items.length > itemsPerPage
322
- if(hasNext){
323
- items.splice(items.length - 1, 1)
324
- }
325
-
326
- /*let summary
327
- if(!afterItem && preset.summary && preset.summary.enabled){
328
- if(preset.summary.mode === 'map' && this.loadMapSummary){
329
- summary = await this.loadMapSummary(preset, {
330
- where,
331
- replacements
332
- })
333
- }
334
- else{
335
- derivedSql = derivedSql.replace('Executing (default): ', '').replace('LIMIT ' + (this.itemsPerPage + 1), '').slice(0, -1)
336
- summary = await this.loadSummary(preset, {
337
- where,
338
- replacements
339
- }, derivedSql)
340
- }
341
- }*/
342
-
343
- if(this.postLoadItems){
344
- const postLoadItems = await this.postLoadItems(params, { where, attributes, order, include:includes, replacements })
345
- if(Array.isArray(postLoadItems)){
346
- items = postLoadItems.concat(items)
347
- }
348
- }
349
-
350
- return {
351
- items,
352
- hasNext,
353
- count,
354
- derivedSql,
355
- where,
356
- replacements
357
- }
358
- },
359
-
360
- async loadBarSummary(summary, derivedSql){
361
-
362
- if(!summary.bar && !this.columns) return
363
-
364
- const { columns, rows, values } = summary.bar
365
-
366
- if(!Array.isArray(columns) || columns.length !== 1 || !columns[0].key) return
367
- if(!Array.isArray(rows) || rows.length !== 1 || !rows[0].key) return
368
- if(!Array.isArray(values) || values.length !== 1 || !values[0].aggregrate) return
369
-
370
- const col = columns[0]
371
- let columnValues = []
372
- let colKey
373
- if(col.key !== '(none)'){
374
- colKey = col.key
375
- const [ _columnValues ] = await this.conn.query(`
376
- SELECT
377
- DISTINCT(${colKey}) AS cols
378
- FROM (${derivedSql}) AS derived
379
- ORDER BY cols ASC
380
- `)
381
-
382
- columnValues = _columnValues
383
- }
384
- if(columnValues.length > 100){
385
- throw new Error('Too many columns')
386
- }
387
-
388
- const attributes = []
389
- const group = []
390
- const summaryColumns = [
391
- /*{ key:"dfDate", label:"Date", width:"200px", visible:true },
392
- { key:"type-1", label:"Type 1", type:"number", visible:true },
393
- { key:"type-2", label:"Type 2", type:"number", visible:true },
394
- { key:"type-3", label:"Type 3", type:"number", visible:true },
395
- { key:"type-4", label:"Type 4", type:"number", visible:true },
396
- { key:"type-8", label:"Type 8", type:"number", visible:true },*/
397
- ]
398
-
399
- const row = rows[0]
400
- const rowKey = row.key
401
- const rowLabel = this.columns.find((_) => _.key === row.key).label
402
- switch(row.format){
403
- case 'minute':
404
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y-%m-%d %H:%i:00') as dfDate`)
405
- group.push(`DATE_FORMAT(${rowKey}, '%Y-%m-%d %H:%i:00')`)
406
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"HH:mm" })
407
- break
408
-
409
- case 'date':
410
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y-%m-%d') as dfDate`)
411
- group.push(`DATE_FORMAT(${rowKey}, '%Y-%m-%d')`)
412
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"D MMM" })
413
- break
414
-
415
- case 'month':
416
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y-%m') as dfDate`)
417
- group.push(`DATE_FORMAT(${rowKey}, '%Y-%m')`)
418
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"MMM YYYY" })
419
- break
420
-
421
- case 'quarter':
422
- attributes.push(`CONCAT(YEAR(${rowKey}), ' Q', QUARTER(${rowKey})) as dfDate`)
423
- group.push(`CONCAT(YEAR(${rowKey}), ' Q', QUARTER(${rowKey}))`)
424
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"MMM YYYY" })
425
- break
426
-
427
- case 'year':
428
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y') as dfDate`)
429
- group.push(`DATE_FORMAT(${rowKey}, '%Y')`)
430
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"YYYY" })
431
- break
432
-
433
- default:
434
- attributes.push(`${rowKey} as dfDate`)
435
- group.push(`${rowKey}`)
436
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true })
437
- break
438
- }
439
-
440
- const value = values[0]
441
- if(columnValues.length > 0){
442
- columnValues.forEach((obj) => {
443
- const columnValue = obj.cols
444
-
445
- let columnLabel = (columnValue ?? '').toString()
446
- const baseColumn = this.columns.find((_) => _.key === colKey)
447
- switch(baseColumn.type){
448
-
449
- case 'enum':
450
- const enumValue = baseColumn.typeParams.filter((_) => _.value === columnValue).pop()
451
- if(enumValue) columnLabel = enumValue.text
452
- break
453
- }
454
-
455
- switch(value.aggregrate){
456
- case 'count':
457
- const fn = columnValue === null ? `${colKey} is null` : `${colKey} = '${columnValue}'`
458
- attributes.push(`SUM(IF(${fn}, 1, 0)) as \`${colKey}-${columnValue}\``)
459
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
460
- break
461
-
462
- case 'min':
463
- attributes.push(`MIN(${colKey}) as \`${colKey}-${columnValue}\``)
464
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
465
- break
466
-
467
- case 'max':
468
- attributes.push(`MAX(${colKey}) as \`${colKey}-${columnValue}\``)
469
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
470
- break
471
-
472
- case 'avg':
473
- attributes.push(`AVG(${colKey}) as \`${colKey}-${columnValue}\``)
474
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
475
- break
476
- }
477
- })
478
- }
479
- else{
480
- switch(value.aggregrate) {
481
- case 'count':
482
- default:
483
- attributes.push(`COUNT(*) as \`Count\``)
484
- summaryColumns.push({ key:'Count', label:'Count', type:"number", visible:true, aggregrate:"count" })
485
- }
486
- }
487
-
488
- let [ summaryItems ] = await this.conn.query(`
489
- SELECT
490
- ${attributes.join(', ')}
491
- FROM (
492
- ${derivedSql}
493
- ) as t1
494
- GROUP BY ${group[0]}
495
- ORDER BY dfDate ASC
496
- `)
497
-
498
- if(this.columns[rowKey] && this.columns[rowKey].type === 'enum'){
499
- summaryItems = summaryItems.map((_) => {
500
-
501
- const typeParam = this.columns[rowKey].typeParams.filter((__) => __.value === _.dfDate).pop()
502
- if(typeParam){
503
- _.dfDate = typeParam.text
504
- }
505
-
506
- return _
507
- })
508
- }
509
-
510
- const result = {
511
- mode: "bar",
512
- columns: summaryColumns,
513
- items: summaryItems
514
- /*items: [
515
- { date:"21 Jan 23", "type-1":12, "type-2":11, "type-3":16, "type-4":2, "type-8":8 },
516
- { date:"22 Jan 23", "type-1":51, "type-2":87, "type-3":86, "type-4":3, "type-8":9 },
517
- { date:"23 Jan 23", "type-1":14, "type-2":66, "type-3":77, "type-4":4, "type-8":18 },
518
- { date:"24 Jan 23", "type-1":7, "type-2":3, "type-3":63, "type-4":5, "type-8":28 },
519
- { date:"25 Jan 23", "type-1":88, "type-2":55, "type-3":68, "type-4":6, "type-8":38 },
520
- { date:"26 Jan 23", "type-1":172, "type-2":13, "type-3":6, "type-4":7, "type-8":48 }
521
- ]*/
522
- }
523
-
524
- return result
525
- },
526
-
527
- async loadLineSummary(summary, derivedSql){
528
-
529
- if(!summary.line) return
530
-
531
- const { columns, rows, values } = summary.line
532
-
533
- if(!Array.isArray(columns) || columns.length !== 1 || !columns[0].key) return
534
- if(!Array.isArray(rows) || rows.length !== 1 || !rows[0].key) return
535
- if(!Array.isArray(values) || values.length !== 1 || !values[0].aggregrate) return
536
-
537
- const col = columns[0]
538
- let columnValues = []
539
- let colKey
540
- if(col.key !== '(none)'){
541
- colKey = col.key
542
- const [ _columnValues ] = await this.conn.query(`
543
- SELECT
544
- DISTINCT(${colKey}) AS cols
545
- FROM (${derivedSql}) AS derived
546
- ORDER BY cols ASC
547
- `)
548
-
549
- columnValues = _columnValues
550
- }
551
- if(columnValues.length > 100){
552
- throw new Error('Too many columns')
553
- }
554
-
555
- const attributes = []
556
- const group = []
557
- const summaryColumns = [
558
- /*{ key:"dfDate", label:"Date", width:"200px", visible:true },
559
- { key:"type-1", label:"Type 1", type:"number", visible:true },
560
- { key:"type-2", label:"Type 2", type:"number", visible:true },
561
- { key:"type-3", label:"Type 3", type:"number", visible:true },
562
- { key:"type-4", label:"Type 4", type:"number", visible:true },
563
- { key:"type-8", label:"Type 8", type:"number", visible:true },*/
564
- ]
565
-
566
- const row = rows[0]
567
- const rowKey = row.key
568
- const rowLabel = this.columns.find((_) => _.key === row.key).label
569
- switch(row.format){
570
- case 'date':
571
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y-%m-%d') as dfDate`)
572
- group.push(`DATE_FORMAT(${rowKey}, '%Y-%m-%d')`)
573
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"D MMM" })
574
- break
575
-
576
- case 'month':
577
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y-%m') as dfDate`)
578
- group.push(`DATE_FORMAT(${rowKey}, '%Y-%m')`)
579
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"MMM YYYY" })
580
- break
581
-
582
- case 'quarter':
583
- attributes.push(`CONCAT(YEAR(${rowKey}), ' Q', QUARTER(${rowKey})) as dfDate`)
584
- group.push(`CONCAT(YEAR(${rowKey}), ' Q', QUARTER(${rowKey}))`)
585
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"MMM YYYY" })
586
- break
587
-
588
- case 'year':
589
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y') as dfDate`)
590
- group.push(`DATE_FORMAT(${rowKey}, '%Y')`)
591
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"YYYY" })
592
- break
593
-
594
- default:
595
- attributes.push(`${rowKey} as dfDate`)
596
- group.push(`${rowKey}`)
597
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true })
598
- break
599
- }
600
-
601
- const value = values[0]
602
- if(columnValues.length > 0){
603
- columnValues.forEach((obj) => {
604
- const columnValue = obj.cols
605
-
606
- let columnLabel = (columnValue ?? '').toString()
607
- const baseColumn = this.columns.find((_) => _.key === colKey)
608
- switch(baseColumn.type){
609
-
610
- case 'enum':
611
- const enumValue = baseColumn.typeParams.filter((_) => _.value === columnValue).pop()
612
- if(enumValue) columnLabel = enumValue.text
613
- break
614
- }
615
-
616
- switch(value.aggregrate){
617
- case 'count':
618
- const fn = columnValue === null ? `${colKey} is null` : `${colKey} = '${columnValue}'`
619
- attributes.push(`SUM(IF(${fn}, 1, 0)) as \`${colKey}-${columnValue}\``)
620
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
621
- break
622
-
623
- case 'min':
624
- attributes.push(`MIN(${colKey}) as \`${colKey}-${columnValue}\``)
625
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
626
- break
627
-
628
- case 'max':
629
- attributes.push(`MAX(${colKey}) as \`${colKey}-${columnValue}\``)
630
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
631
- break
632
-
633
- case 'avg':
634
- attributes.push(`AVG(${colKey}) as \`${colKey}-${columnValue}\``)
635
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
636
- break
637
- }
638
- })
639
- }
640
- else{
641
- switch(value.aggregrate) {
642
- case 'count':
643
- default:
644
- attributes.push(`COUNT(*) as \`Count\``)
645
- summaryColumns.push({ key:'Count', label:'Count', type:"number", visible:true, aggregrate:"count" })
646
- }
647
- }
648
-
649
- let [ summaryItems ] = await this.conn.query(`
650
- SELECT
651
- ${attributes.join(', ')}
652
- FROM (
653
- ${derivedSql}
654
- ) as t1
655
- GROUP BY ${group[0]}
656
- ORDER BY dfDate ASC
657
- `)
658
-
659
- if(this.columns[rowKey] && this.columns[rowKey].type === 'enum'){
660
- summaryItems = summaryItems.map((_) => {
661
-
662
- const typeParam = this.columns[rowKey].typeParams.filter((__) => __.value === _.dfDate).pop()
663
- if(typeParam){
664
- _.dfDate = typeParam.text
665
- }
666
-
667
- return _
668
- })
669
- }
670
-
671
- const result = {
672
- mode: "line",
673
- columns: summaryColumns,
674
- items: summaryItems
675
- /*items: [
676
- { date:"21 Jan 23", "type-1":12, "type-2":11, "type-3":16, "type-4":2, "type-8":8 },
677
- { date:"22 Jan 23", "type-1":51, "type-2":87, "type-3":86, "type-4":3, "type-8":9 },
678
- { date:"23 Jan 23", "type-1":14, "type-2":66, "type-3":77, "type-4":4, "type-8":18 },
679
- { date:"24 Jan 23", "type-1":7, "type-2":3, "type-3":63, "type-4":5, "type-8":28 },
680
- { date:"25 Jan 23", "type-1":88, "type-2":55, "type-3":68, "type-4":6, "type-8":38 },
681
- { date:"26 Jan 23", "type-1":172, "type-2":13, "type-3":6, "type-4":7, "type-8":48 }
682
- ]*/
683
- }
684
-
685
- return result
686
- },
687
-
688
- async loadTableSummary(summary, derivedSql){
689
-
690
- if(!summary.table) return
691
-
692
- const { columns, rows, values } = summary.table
693
-
694
- if(!Array.isArray(columns) || columns.length !== 1 || !columns[0].key) return
695
- if(!Array.isArray(rows) || rows.length !== 1 || !rows[0].key) return
696
- if(!Array.isArray(values) || values.length !== 1 || !values[0].aggregrate) return
697
-
698
- const col = columns[0]
699
- let columnValues = []
700
- let colKey
701
- if(col.key !== '(none)'){
702
- colKey = col.key
703
- const [ _columnValues ] = await this.conn.query(`
704
- SELECT
705
- DISTINCT(${colKey}) AS cols
706
- FROM (${derivedSql}) AS derived
707
- ORDER BY cols ASC
708
- `)
709
-
710
- columnValues = _columnValues
711
- }
712
- if(columnValues.length > 100){
713
- throw new Error('Too many columns')
714
- }
715
-
716
- const attributes = []
717
- const group = []
718
- const summaryColumns = [
719
- /*{ key:"dfDate", label:"Date", width:"200px", visible:true },
720
- { key:"type-1", label:"Type 1", type:"number", visible:true },
721
- { key:"type-2", label:"Type 2", type:"number", visible:true },
722
- { key:"type-3", label:"Type 3", type:"number", visible:true },
723
- { key:"type-4", label:"Type 4", type:"number", visible:true },
724
- { key:"type-8", label:"Type 8", type:"number", visible:true },*/
725
- ]
726
-
727
- const row = rows[0]
728
- const rowKey = row.key
729
- const rowLabel = this.columns.find((_) => _.key === row.key).label
730
- switch(row.format){
731
- case 'date':
732
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y-%m-%d') as dfDate`)
733
- group.push(`DATE_FORMAT(${rowKey}, '%Y-%m-%d')`)
734
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"D MMM" })
735
- break
736
-
737
- case 'month':
738
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y-%m') as dfDate`)
739
- group.push(`DATE_FORMAT(${rowKey}, '%Y-%m')`)
740
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"MMM YYYY" })
741
- break
742
-
743
- case 'quarter':
744
- attributes.push(`CONCAT(YEAR(${rowKey}), ' Q', QUARTER(${rowKey})) as dfDate`)
745
- group.push(`CONCAT(YEAR(${rowKey}), ' Q', QUARTER(${rowKey}))`)
746
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"MMM YYYY" })
747
- break
748
-
749
- case 'year':
750
- attributes.push(`DATE_FORMAT(${rowKey}, '%Y') as dfDate`)
751
- group.push(`DATE_FORMAT(${rowKey}, '%Y')`)
752
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true, type:"date", format:"YYYY" })
753
- break
754
-
755
- default:
756
- attributes.push(`${rowKey} as dfDate`)
757
- group.push(`${rowKey}`)
758
- summaryColumns.push({ key:"dfDate", label:rowLabel, width:"200px", visible:true })
759
- break
760
- }
761
-
762
- const value = values[0]
763
- if(columnValues.length > 0){
764
- columnValues.forEach((obj) => {
765
- const columnValue = obj.cols
766
-
767
- let columnLabel = (columnValue ?? '').toString()
768
- const baseColumn = this.columns.find((_) => _.key === colKey)
769
- switch(baseColumn.type){
770
-
771
- case 'enum':
772
- const enumValue = baseColumn.typeParams.filter((_) => _.value === columnValue).pop()
773
- if(enumValue) columnLabel = enumValue.text
774
- break
775
- }
776
-
777
- switch(value.aggregrate){
778
- case 'count':
779
- const fn = columnValue === null ? `${colKey} is null` : `${colKey} = '${columnValue}'`
780
- attributes.push(`SUM(IF(${fn}, 1, 0)) as \`${colKey}-${columnValue}\``)
781
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
782
- break
783
-
784
- case 'min':
785
- attributes.push(`MIN(${colKey}) as \`${colKey}-${columnValue}\``)
786
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
787
- break
788
-
789
- case 'max':
790
- attributes.push(`MAX(${colKey}) as \`${colKey}-${columnValue}\``)
791
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
792
- break
793
-
794
- case 'avg':
795
- attributes.push(`AVG(${colKey}) as \`${colKey}-${columnValue}\``)
796
- summaryColumns.push({ key:colKey + "-" + columnValue, label:columnLabel, visible:true, aggregrate:"count" })
797
- break
798
- }
799
- })
800
- }
801
- else{
802
- switch(value.aggregrate) {
803
- case 'count':
804
- default:
805
- attributes.push(`COUNT(*) as \`Count\``)
806
- summaryColumns.push({ key:'Count', label:'Count', type:"number", visible:true, aggregrate:"count" })
807
- }
808
- }
809
-
810
- let [ summaryItems ] = await this.conn.query(`
811
- SELECT
812
- ${attributes.join(', ')}
813
- FROM (
814
- ${derivedSql}
815
- ) as t1
816
- GROUP BY ${group[0]}
817
- ORDER BY dfDate ASC
818
- `)
819
-
820
- if(this.columns[rowKey] && this.columns[rowKey].type === 'enum'){
821
- summaryItems = summaryItems.map((_) => {
822
-
823
- const typeParam = this.columns[rowKey].typeParams.filter((__) => __.value === _.dfDate).pop()
824
- if(typeParam){
825
- _.dfDate = typeParam.text
826
- }
827
-
828
- return _
829
- })
830
- }
831
-
832
- const result = {
833
- mode: "table",
834
- columns: summaryColumns,
835
- items: summaryItems
836
- /*items: [
837
- { date:"21 Jan 23", "type-1":12, "type-2":11, "type-3":16, "type-4":2, "type-8":8 },
838
- { date:"22 Jan 23", "type-1":51, "type-2":87, "type-3":86, "type-4":3, "type-8":9 },
839
- { date:"23 Jan 23", "type-1":14, "type-2":66, "type-3":77, "type-4":4, "type-8":18 },
840
- { date:"24 Jan 23", "type-1":7, "type-2":3, "type-3":63, "type-4":5, "type-8":28 },
841
- { date:"25 Jan 23", "type-1":88, "type-2":55, "type-3":68, "type-4":6, "type-8":38 },
842
- { date:"26 Jan 23", "type-1":172, "type-2":13, "type-3":6, "type-4":7, "type-8":48 }
843
- ]*/
844
- }
845
-
846
- return result
847
- },
848
-
849
-
850
-
851
- getPresetFilterParams(preset, includes){
852
-
853
- let where = {}
854
- let replacements = []
855
-
856
- if(preset.filters){
857
-
858
- preset.filters.forEach((filter) => {
859
-
860
- if(!filter.enabled) return
861
-
862
- const key = filter.key
863
-
864
- const whereValue = this.getWhereValue(filter)
865
- const operand = filter.operand === 'or' ? 'or' : 'and'
866
-
867
- // Nested filter attribute
868
- if(key.indexOf('.') > -1){
869
-
870
- const inclKeys = key.split('.')
871
- if(inclKeys.length !== 2){
872
- console.warn('Filter key not handled', key)
873
- }
874
- else{
875
- const inclAs = inclKeys[0]
876
- const inclKey = inclKeys[1]
877
- const inclIndex = (includes ?? []).findIndex((_) => _.as === inclAs)
878
- if(inclIndex > -1){
879
-
880
- let includeWhere = includes[inclIndex].where ?? {}
881
-
882
- switch(operand){
883
-
884
- case 'or':
885
- includeWhere = {
886
- ...includeWhere,
887
- [inclKey]: {
888
- [Op.or]: whereValue
889
- }
890
- }
891
- break
892
-
893
- default:
894
- includeWhere = {
895
- ...where,
896
- [inclKey]: {
897
- [Op.and]: whereValue
898
- }
899
- }
900
- break
901
- }
902
-
903
- includes[inclIndex].where = includeWhere
904
- }
905
- else{
906
- console.warn('Unsupported filter key', key)
907
- }
908
- }
909
- }
910
-
911
- // Unnested filter attribute
912
- else{
913
- switch(operand){
914
-
915
- case 'or':
916
- where = {
917
- ...where,
918
- [key]: {
919
- [Op.or]: whereValue
920
- }
921
- }
922
- break
923
-
924
- default:
925
- where = {
926
- ...where,
927
- [key]: {
928
- [Op.and]: whereValue
929
- }
930
- }
931
- break
932
- }
933
- }
934
- })
935
- }
936
-
937
- return {
938
- where,
939
- replacements
940
- }
941
- },
942
-
943
- getWhereValue(filter){
944
-
945
- let whereValue = []
946
- const type = filter.type
947
- const items = filter.filters ?? []
948
- switch(type){
949
-
950
- case 'date':
951
- items.forEach((item) => {
952
- if(!('operator' in item) || (item.operator === 'between' && !('value' in item))) return
953
-
954
- const operator = item.operator
955
- const value = item.value
956
-
957
- switch(operator){
958
-
959
- case 'today':
960
- whereValue = {
961
- ...whereValue,
962
- [Op.eq]: dayjs().format('YYYY-MM-DD'),
963
- }
964
- break
965
-
966
- case 'thisWeek':
967
- whereValue = {
968
- ...whereValue,
969
- [Op.gte]: dayjs().startOf('week').format('YYYY-MM-DD 00:00:00'),
970
- [Op.lt]: dayjs().endOf('week').format('YYYY-MM-DD 23:59:59'),
971
- }
972
- break
973
-
974
- case 'weekAgo':
975
- whereValue = {
976
- ...whereValue,
977
- [Op.gte]: dayjs().add(-1, 'week').format('YYYY-MM-DD 00:00:00'),
978
- [Op.lt]: dayjs().format('YYYY-MM-DD 23:59:59'),
979
- }
980
- break
981
-
982
- case 'thisMonth':
983
- whereValue = {
984
- ...whereValue,
985
- [Op.gte]: dayjs().format('YYYY-MM-01 00:00:00'),
986
- [Op.lt]: dayjs().endOf('month').format('YYYY-MM-DD 23:59:59'),
987
- }
988
- break
989
-
990
- case 'monthAgo':
991
- whereValue = {
992
- ...whereValue,
993
- [Op.gte]: dayjs().add(-1, 'month').format('YYYY-MM-DD 00:00:00'),
994
- [Op.lt]: dayjs().format('YYYY-MM-DD 23:59:59'),
995
- }
996
- break
997
-
998
- case 'lastMonth':
999
- whereValue = {
1000
- [Op.gte]: dayjs().add(-1, 'month').format('YYYY-MM-01 00:00:00'),
1001
- [Op.lte]: dayjs().add(-1, 'month').endOf('month').format('YYYY-MM-DD 23:59:59'),
1002
- }
1003
- break
1004
-
1005
- case 'thisYear':
1006
- whereValue = {
1007
- ...whereValue,
1008
- [Op.gte]: dayjs().startOf('year').format('YYYY-MM-DD 00:00:00'),
1009
- [Op.lt]: dayjs().endOf('year').format('YYYY-MM-DD 23:59:59'),
1010
- }
1011
- break
1012
-
1013
- case 'lastYear':
1014
- whereValue = {
1015
- ...whereValue,
1016
- [Op.gte]: dayjs().add(-1, 'year').startOf('year').format('YYYY-MM-DD 00:00:00'),
1017
- [Op.lt]: dayjs().add(-1, 'year').endOf('year').format('YYYY-MM-DD 23:59:59'),
1018
- }
1019
- break
1020
-
1021
- case 'between':
1022
- whereValue = {
1023
- ...whereValue,
1024
- [Op.gte]: dayjs(value[0]).format('YYYY-MM-DD 00:00:00'),
1025
- [Op.lt]: dayjs(value[1]).format('YYYY-MM-DD 23:59:59'),
1026
- }
1027
- break
1028
- }
1029
- })
1030
- break
1031
-
1032
- case 'enum':
1033
- items.forEach((item) => {
1034
- if(!('value' in item)) return
1035
-
1036
- const value = item.value ?? []
1037
- whereValue = {
1038
- ...whereValue,
1039
- [Op.in]: value
1040
- }
1041
- })
1042
- break
1043
-
1044
- case 'number':
1045
- case 'currency':
1046
- items.forEach((item) => {
1047
- if(!('operator' in item) || !('value' in item)) return
1048
-
1049
- const operator = item.operator
1050
- const value = item.value
1051
-
1052
- switch(operator){
1053
-
1054
- case '>':
1055
- whereValue = {
1056
- ...whereValue,
1057
- [Op.gt]: parseFloat(value)
1058
- }
1059
- break
1060
-
1061
- case '>=':
1062
- whereValue = {
1063
- ...whereValue,
1064
- [Op.gte]: parseFloat(value)
1065
- }
1066
- break
1067
-
1068
- case '=':
1069
- whereValue = {
1070
- ...whereValue,
1071
- [Op.eq]: parseFloat(value)
1072
- }
1073
- break
1074
-
1075
- case '<':
1076
- whereValue = {
1077
- ...whereValue,
1078
- [Op.lt]: parseFloat(value)
1079
- }
1080
- break
1081
-
1082
- case '<=':
1083
- whereValue = {
1084
- ...whereValue,
1085
- [Op.lte]: parseFloat(value)
1086
- }
1087
- break
1088
-
1089
- case '<>':
1090
- case '!=':
1091
- whereValue = {
1092
- ...whereValue,
1093
- [Op.ne]: parseFloat(value)
1094
- }
1095
- break
1096
-
1097
- case 'in':
1098
- whereValue = {
1099
- ...whereValue,
1100
- [Op.in]: Array.isArray(value) ? value : (value.toString().split(','))
1101
- }
1102
- break
1103
- }
1104
- })
1105
- break
1106
-
1107
- default:
1108
- items.forEach((item) => {
1109
- if(!('operator' in item) ||
1110
- ([ 'startsWith', 'endsWith', 'contains', '=' ].includes(item.operator) && !'value' in item))
1111
- return
1112
-
1113
- const operator = item.operator
1114
- const value = item.value
1115
-
1116
- switch(operator){
1117
-
1118
- case 'startsWith':
1119
- whereValue.push({
1120
- [Op.like]: `${value}%`
1121
- })
1122
- break
1123
-
1124
- case 'endsWith':
1125
- whereValue.push({
1126
- [Op.like]: `%${value}`
1127
- })
1128
- break
1129
-
1130
- case 'contains':
1131
- whereValue.push({
1132
- [Op.like]: `%${value}%`
1133
- })
1134
- break
1135
-
1136
- case '=':
1137
- whereValue.push({
1138
- [Op.eq]: value
1139
- })
1140
- break
1141
-
1142
- case '<>':
1143
- case '!=':
1144
- whereValue.push({
1145
- [Op.ne]: value
1146
- })
1147
- break
1148
-
1149
- case 'empty':
1150
- whereValue.push({
1151
- [Op.or]: [
1152
- { [Op.eq]: null },
1153
- { [Op.eq]: '' },
1154
- ]
1155
- })
1156
- break
1157
-
1158
- case 'notEmpty':
1159
- whereValue.push({
1160
- [Op.and]: [
1161
- { [Op.ne]: null },
1162
- { [Op.ne]: '' },
1163
- ]
1164
- })
1165
- break
1166
-
1167
- case 'length':
1168
- break
1169
-
1170
- case 'regex':
1171
- whereValue.push({
1172
- [Op.regexp]: value
1173
- })
1174
- break
1175
-
1176
- case 'in':
1177
- whereValue = {
1178
- ...whereValue,
1179
- [Op.in]: Array.isArray(value) ? value : (value.toString().split(','))
1180
- }
1181
- break
1182
- }
1183
- })
1184
- break
1185
- }
1186
-
1187
- return whereValue
1188
- },
1189
-
1190
- getPresetSortParams(preset, includes){
1191
-
1192
- if(preset.sorts && preset.sorts.length > 0){
1193
- let order = []
1194
- preset.sorts.forEach((sort) => {
1195
- const key = sort.key
1196
- const type = sort.type === 'desc' ? 'desc' : 'asc'
1197
- if(key.indexOf('.') > -1){
1198
-
1199
- const inclKeys = key.split('.')
1200
- if(inclKeys.length !== 2){
1201
- console.warn('Filter key not handled', key)
1202
- }
1203
- else {
1204
- const inclAs = inclKeys[0]
1205
- const inclKey = inclKeys[1]
1206
- const inclIndex = (includes ?? []).findIndex((_) => _.as === inclAs)
1207
-
1208
- if(inclIndex > -1){
1209
- order.push([
1210
- {
1211
- model: includes[inclIndex].model,
1212
- as: inclAs
1213
- },
1214
- inclKey,
1215
- type
1216
- ])
1217
- }
1218
- else{
1219
- console.warn('Unsupported sort key', key)
1220
- }
1221
- }
1222
- }
1223
- else{
1224
- order.push([ key, type ])
1225
- }
1226
- })
1227
-
1228
- if(order.filter((_) => _[0] === 'id').length === 0){
1229
- order.push([ 'id', 'desc' ])
1230
- }
1231
-
1232
- return {
1233
- order
1234
- }
1235
- }
1236
- return {}
1237
- },
1238
-
1239
-
1240
-
1241
- async onHooks(model, event, items, socket){
1242
-
1243
- if(socket.loadParams && socket.loadParams[this.name] && [ 'create', 'update' ].includes(event)){
1244
- const loadParams = { ...socket.loadParams[this.name] }
1245
-
1246
- if(!loadParams.preset.filters)
1247
- loadParams.preset.filters = []
1248
- const filterIndex = loadParams.preset.filters.findIndex(filter => filter.key === 'id')
1249
- if(filterIndex > -1){
1250
- loadParams.preset.filters[filterIndex] = {
1251
- enabled: true,
1252
- type: "number",
1253
- key: "id",
1254
- filters: [
1255
- {
1256
- operator: "in",
1257
- value: items.map((_) => _.id)
1258
- }
1259
- ]
1260
- }
1261
- }
1262
- else{
1263
- loadParams.preset.filters.push({
1264
- enabled: true,
1265
- type: "number",
1266
- key: "id",
1267
- filters: [
1268
- {
1269
- operator: "in",
1270
- value: items.map((_) => _.id)
1271
- }
1272
- ]
1273
- })
1274
- }
1275
-
1276
- const res = await this.load(loadParams)
1277
- items = res.items
1278
- }
1279
-
1280
- socket.emit(model, event, items)
1281
- }
1282
-
1283
-
1284
-
1285
- }
1286
-
1287
- module.exports = ListView