@gct-paas/core-web 0.1.4-dev.7 → 0.1.4-dev.9

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 (262) hide show
  1. package/dist/index-BghCpvxN.js +76 -0
  2. package/dist/index-PLrMc0gl.cjs +76 -0
  3. package/dist/index-oVPMi6Ep.js +29160 -0
  4. package/dist/index.esm.min.mjs +34 -7924
  5. package/dist/index.min.cjs +1 -20
  6. package/dist/index.min.css +1 -0
  7. package/dist/index.system.min.js +1 -20
  8. package/dist/monaco-editor-B8X-ou0h.js +20245 -0
  9. package/dist/monaco-editor-Bdgpd_KL.cjs +19 -0
  10. package/dist/monaco-editor-NIWDtQNB.js +19 -0
  11. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  12. package/es/components/app-modal/app-modal-component.css +149 -0
  13. package/es/components/app-modal/app-modal-component.d.ts +26 -0
  14. package/es/components/app-modal/app-modal-component.mjs +140 -0
  15. package/es/components/assets-svg-icon/assets-svg-icon.css +188 -0
  16. package/es/components/assets-svg-icon/assets-svg-icon.d.ts +134 -0
  17. package/es/components/assets-svg-icon/assets-svg-icon.mjs +238 -0
  18. package/es/components/assets-svg-icon/request.d.ts +2 -0
  19. package/es/components/assets-svg-icon/request.mjs +51 -0
  20. package/es/components/assets-svg-icon/utils.d.ts +9 -0
  21. package/es/components/assets-svg-icon/utils.mjs +21 -0
  22. package/es/components/assets-svg-icon/validate.d.ts +4 -0
  23. package/es/components/assets-svg-icon/validate.mjs +43 -0
  24. package/es/components/base-button/base-button.css +74 -0
  25. package/es/components/base-button/base-button.vue.d.ts +173 -0
  26. package/es/components/base-button/base-button.vue.mjs +7 -0
  27. package/es/components/base-button/base-button.vue3.mjs +179 -0
  28. package/es/components/basic-button/basic-button.css +25 -0
  29. package/es/components/basic-button/basic-button.vue.d.ts +100 -0
  30. package/es/components/basic-button/basic-button.vue.mjs +7 -0
  31. package/es/components/basic-button/basic-button.vue3.mjs +130 -0
  32. package/es/components/code-editor/code-editor.css +67 -0
  33. package/es/components/code-editor/code-editor.d.ts +1 -1
  34. package/es/components/code-editor/code-editor.mjs +9 -10
  35. package/es/components/index.d.ts +10 -0
  36. package/es/components/index.mjs +21 -6
  37. package/es/components/layout/flex-container/flex-container.css +67 -0
  38. package/es/components/layout/flex-container/flex-container.mjs +13 -9
  39. package/es/components/layout/flex-item/flex-item.mjs +11 -9
  40. package/es/components/layout/grid-container/grid-container.mjs +11 -7
  41. package/es/components/layout/view-container/view-container.css +83 -0
  42. package/es/components/layout/view-container/view-container.mjs +6 -7
  43. package/es/components/svg-icon/svg-icon.css +73 -0
  44. package/es/components/svg-icon/svg-icon.vue.d.ts +40 -0
  45. package/es/components/svg-icon/svg-icon.vue.mjs +50 -0
  46. package/es/components/svg-icon/svg-icon.vue3.mjs +6 -0
  47. package/es/create-app-vue.d.ts +9 -0
  48. package/es/create-app-vue.mjs +17 -0
  49. package/es/directives/drag-resize.d.ts +4 -0
  50. package/es/directives/drag-resize.mjs +42 -0
  51. package/es/directives/index.d.ts +8 -0
  52. package/es/directives/index.mjs +9 -0
  53. package/es/directives/target-loading.d.ts +4 -0
  54. package/es/directives/target-loading.mjs +40 -0
  55. package/es/editor/gct-form-check-switch/gct-form-check-switch.d.ts +1 -1
  56. package/es/editor/gct-form-i18n/gct-form-i18n.d.ts +1 -1
  57. package/es/editor/gct-form-info/gct-form-info.d.ts +1 -1
  58. package/es/editor/gct-form-length-unit/gct-form-length-unit.d.ts +1 -1
  59. package/es/editor/gct-form-number/gct-form-number.d.ts +1 -1
  60. package/es/editor/gct-form-radio/gct-form-radio.d.ts +1 -1
  61. package/es/editor/gct-form-select/gct-form-select.d.ts +1 -1
  62. package/es/editor/gct-form-switch/gct-form-switch.d.ts +1 -1
  63. package/es/editor/gct-form-textarea/gct-form-textarea.d.ts +1 -1
  64. package/es/hooks/index.d.ts +3 -0
  65. package/es/hooks/useDragLine.d.ts +6 -0
  66. package/es/hooks/useDragLine.mjs +79 -0
  67. package/es/hooks/useLocale.d.ts +4 -0
  68. package/es/hooks/useLocale.mjs +32 -0
  69. package/es/hooks/useTheme.d.ts +8 -0
  70. package/es/hooks/useTheme.mjs +20 -0
  71. package/es/index.d.ts +7 -7
  72. package/es/index.mjs +35 -24
  73. package/es/modules/code-editor/index.d.ts +163 -0
  74. package/es/modules/code-editor/index.mjs +8 -0
  75. package/es/modules/code-editor/monaco-editor.css +49 -0
  76. package/es/modules/code-editor/monaco-editor.vue.d.ts +143 -0
  77. package/es/modules/code-editor/monaco-editor.vue.mjs +7 -0
  78. package/es/modules/code-editor/monaco-editor.vue2.mjs +440 -0
  79. package/es/modules/code-editor/useEditorConsole.d.ts +54 -0
  80. package/es/modules/code-editor/useEditorConsole.mjs +194 -0
  81. package/es/modules/code-editor/useMonacoEditor.d.ts +26 -0
  82. package/es/modules/code-editor/useMonacoEditor.mjs +26 -0
  83. package/es/modules/color-picker/index.d.ts +2 -0
  84. package/es/modules/color-picker/src/ColorPicker.css +16 -0
  85. package/es/modules/color-picker/src/ColorPicker.vue.d.ts +49 -0
  86. package/es/modules/color-picker/src/ColorPicker.vue.mjs +8 -0
  87. package/es/modules/color-picker/src/ColorPicker.vue2.mjs +545 -0
  88. package/es/modules/color-picker/src/ColorPicker2.css +156 -0
  89. package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.css +72 -0
  90. package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.d.ts +37 -0
  91. package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.mjs +195 -0
  92. package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.css +79 -0
  93. package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.d.ts +29 -0
  94. package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.mjs +98 -0
  95. package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.css +70 -0
  96. package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.d.ts +50 -0
  97. package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.mjs +239 -0
  98. package/es/modules/gct-dnd/constants/index.d.ts +22 -0
  99. package/es/modules/gct-dnd/constants/index.mjs +20 -0
  100. package/es/modules/gct-dnd/index.d.ts +5 -0
  101. package/es/modules/gct-dnd/interface/i-gct-dnd-config.d.ts +101 -0
  102. package/es/modules/gct-dnd/interface/i-gct-dnd-data.d.ts +14 -0
  103. package/es/modules/gct-dnd/interface/i-gct-dnd-render-item-options.d.ts +28 -0
  104. package/es/modules/gct-dnd/interface/i-gct-drag-collect.d.ts +24 -0
  105. package/es/modules/gct-dnd/interface/i-gct-drag-dnd-data.d.ts +51 -0
  106. package/es/modules/gct-dnd/interface/i-gct-drop-collect.d.ts +32 -0
  107. package/es/modules/gct-dnd/interface/i-gct-drop-result.d.ts +47 -0
  108. package/es/modules/gct-dnd/interface/index.d.ts +7 -0
  109. package/es/modules/global-modal/index.d.ts +5 -0
  110. package/es/modules/global-modal/index.mjs +16 -0
  111. package/es/modules/global-modal/src/BasicModal.vue.d.ts +518 -0
  112. package/es/modules/global-modal/src/BasicModal.vue.mjs +221 -0
  113. package/es/modules/global-modal/src/BasicModal.vue2.mjs +5 -0
  114. package/es/modules/global-modal/src/components/GlboalModal.d.ts +251 -0
  115. package/es/modules/global-modal/src/components/GlboalModal.mjs +40 -0
  116. package/es/modules/global-modal/src/components/ModalClose.css +95 -0
  117. package/es/modules/global-modal/src/components/ModalClose.vue.d.ts +27 -0
  118. package/es/modules/global-modal/src/components/ModalClose.vue.mjs +79 -0
  119. package/es/modules/global-modal/src/components/ModalClose.vue3.mjs +6 -0
  120. package/es/modules/global-modal/src/components/ModalFooter.vue.d.ts +270 -0
  121. package/es/modules/global-modal/src/components/ModalFooter.vue.mjs +44 -0
  122. package/es/modules/global-modal/src/components/ModalFooter.vue2.mjs +5 -0
  123. package/es/modules/global-modal/src/components/ModalHeader.vue.d.ts +17 -0
  124. package/es/modules/global-modal/src/components/ModalHeader.vue.mjs +11 -0
  125. package/es/modules/global-modal/src/components/ModalHeader.vue2.mjs +13 -0
  126. package/es/modules/global-modal/src/components/ModalWrapper.vue.d.ts +95 -0
  127. package/es/modules/global-modal/src/components/ModalWrapper.vue.mjs +26 -0
  128. package/es/modules/global-modal/src/components/ModalWrapper.vue2.mjs +136 -0
  129. package/es/modules/global-modal/src/hooks/useModal.d.ts +6 -0
  130. package/es/modules/global-modal/src/hooks/useModal.mjs +120 -0
  131. package/es/modules/global-modal/src/hooks/useModalContext.d.ts +5 -0
  132. package/es/modules/global-modal/src/hooks/useModalContext.mjs +11 -0
  133. package/es/modules/global-modal/src/hooks/useModalDrag.d.ts +7 -0
  134. package/es/modules/global-modal/src/hooks/useModalDrag.mjs +82 -0
  135. package/es/modules/global-modal/src/hooks/useModalFullScreen.d.ts +11 -0
  136. package/es/modules/global-modal/src/hooks/useModalFullScreen.mjs +16 -0
  137. package/es/modules/global-modal/src/index.css +153 -0
  138. package/es/modules/global-modal/src/props.d.ts +156 -0
  139. package/es/modules/global-modal/src/props.mjs +57 -0
  140. package/es/modules/global-modal/src/typing.d.ts +174 -0
  141. package/es/modules/target-loading/index.d.ts +4 -0
  142. package/es/modules/target-loading/src/createLoading.d.ts +13 -0
  143. package/es/modules/target-loading/src/createLoading.mjs +57 -0
  144. package/es/modules/target-loading/src/target-loading.css +18 -0
  145. package/es/modules/target-loading/src/target-loading.vue.d.ts +57 -0
  146. package/es/modules/target-loading/src/target-loading.vue.mjs +52 -0
  147. package/es/modules/target-loading/src/target-loading.vue3.mjs +7 -0
  148. package/es/modules/target-loading/src/typing.d.ts +9 -0
  149. package/es/modules/target-loading/src/useLoading.d.ts +9 -0
  150. package/es/setup-app.d.ts +1 -0
  151. package/es/setup-app.mjs +4 -0
  152. package/es/types/index.d.ts +190 -0
  153. package/es/utils/index.d.ts +4 -1
  154. package/es/utils/message-util/message-util.d.ts +7 -0
  155. package/es/utils/message-util/message-util.mjs +26 -0
  156. package/es/utils/monaco-loader/monaco-loader.d.ts +59 -0
  157. package/es/utils/monaco-loader/monaco-loader.mjs +88 -0
  158. package/es/utils/overlay-controller/overlay-controller.d.ts +18 -0
  159. package/es/utils/overlay-controller/overlay-controller.mjs +23 -0
  160. package/es/utils/with-install.mjs +0 -1
  161. package/es/widgets/gct-edit-form/gct-edit-form.d.ts +1 -1
  162. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.d.ts +1 -1
  163. package/package.json +19 -8
  164. package/dist/index.min.css.css +0 -1
  165. package/es/components/code-editor/code-editor.scss +0 -3
  166. package/es/components/layout/flex-container/flex-container.scss +0 -3
  167. package/es/components/layout/flex-item/flex-item.scss +0 -17
  168. package/es/components/layout/view-container/view-container.scss +0 -19
  169. package/es/editor/gct-form-check-switch/gct-form-check-switch.mjs +0 -53
  170. package/es/editor/gct-form-check-switch/gct-form-check-switch.provider.mjs +0 -6
  171. package/es/editor/gct-form-check-switch/gct-form-check-switch.scss +0 -10
  172. package/es/editor/gct-form-check-switch/index.mjs +0 -12
  173. package/es/editor/gct-form-checkbox/gct-form-checkbox.mjs +0 -70
  174. package/es/editor/gct-form-checkbox/gct-form-checkbox.scss +0 -56
  175. package/es/editor/gct-form-checkbox/index.mjs +0 -19
  176. package/es/editor/gct-form-color/gct-form-color.mjs +0 -45
  177. package/es/editor/gct-form-color/gct-form-color.provider.mjs +0 -6
  178. package/es/editor/gct-form-color/gct-form-color.scss +0 -3
  179. package/es/editor/gct-form-color/index.mjs +0 -17
  180. package/es/editor/gct-form-field-select/gct-form-field-select.mjs +0 -48
  181. package/es/editor/gct-form-field-select/gct-form-field-select.provider.mjs +0 -6
  182. package/es/editor/gct-form-field-select/gct-form-field-select.scss +0 -7
  183. package/es/editor/gct-form-field-select/gct-model-select.vue +0 -70
  184. package/es/editor/gct-form-field-select/index.mjs +0 -12
  185. package/es/editor/gct-form-i18n/gct-form-i18n.mjs +0 -62
  186. package/es/editor/gct-form-i18n/gct-form-i18n.provider.mjs +0 -6
  187. package/es/editor/gct-form-i18n/index.mjs +0 -12
  188. package/es/editor/gct-form-icon-select/gct-form-icon-select.mjs +0 -74
  189. package/es/editor/gct-form-icon-select/gct-form-icon-select.scss +0 -14
  190. package/es/editor/gct-form-icon-select/index.mjs +0 -14
  191. package/es/editor/gct-form-info/gct-form-info.mjs +0 -40
  192. package/es/editor/gct-form-info/gct-form-info.scss +0 -8
  193. package/es/editor/gct-form-info/index.mjs +0 -14
  194. package/es/editor/gct-form-length-unit/gct-form-length-unit.mjs +0 -43
  195. package/es/editor/gct-form-length-unit/gct-form-length-unit.provider.mjs +0 -6
  196. package/es/editor/gct-form-length-unit/index.mjs +0 -12
  197. package/es/editor/gct-form-modal-select/gct-form-modal-select.mjs +0 -99
  198. package/es/editor/gct-form-modal-select/gct-form-modal-select.provider.mjs +0 -6
  199. package/es/editor/gct-form-modal-select/gct-form-modal-select.scss +0 -7
  200. package/es/editor/gct-form-modal-select/index.mjs +0 -12
  201. package/es/editor/gct-form-number/gct-form-number.mjs +0 -44
  202. package/es/editor/gct-form-number/gct-form-number.provider.mjs +0 -6
  203. package/es/editor/gct-form-number/gct-form-number.scss +0 -3
  204. package/es/editor/gct-form-number/index.mjs +0 -17
  205. package/es/editor/gct-form-picker/gct-form-picker.mjs +0 -92
  206. package/es/editor/gct-form-picker/gct-form-picker.provider.mjs +0 -6
  207. package/es/editor/gct-form-picker/index.mjs +0 -12
  208. package/es/editor/gct-form-radio/gct-form-radio.mjs +0 -70
  209. package/es/editor/gct-form-radio/gct-form-radio.scss +0 -68
  210. package/es/editor/gct-form-radio/index.mjs +0 -19
  211. package/es/editor/gct-form-select/gct-form-select.mjs +0 -50
  212. package/es/editor/gct-form-select/gct-form-select.provider.mjs +0 -6
  213. package/es/editor/gct-form-select/index.mjs +0 -12
  214. package/es/editor/gct-form-span/gct-form-span.mjs +0 -89
  215. package/es/editor/gct-form-span/gct-form-span.provider.mjs +0 -6
  216. package/es/editor/gct-form-span/gct-form-span.scss +0 -10
  217. package/es/editor/gct-form-span/index.mjs +0 -12
  218. package/es/editor/gct-form-switch/gct-form-switch.mjs +0 -35
  219. package/es/editor/gct-form-switch/gct-form-switch.provider.mjs +0 -6
  220. package/es/editor/gct-form-switch/index.mjs +0 -17
  221. package/es/editor/gct-form-text/gct-form-text.mjs +0 -45
  222. package/es/editor/gct-form-text/gct-form-text.provider.mjs +0 -6
  223. package/es/editor/gct-form-text/index.mjs +0 -17
  224. package/es/editor/gct-form-textarea/gct-form-textarea.mjs +0 -40
  225. package/es/editor/gct-form-textarea/gct-form-textarea.provider.mjs +0 -6
  226. package/es/editor/gct-form-textarea/index.mjs +0 -12
  227. package/es/editor/index.mjs +0 -51
  228. package/es/utils/index.mjs +0 -3
  229. package/es/vite-env.d.ts +0 -1
  230. package/es/widgets/gct-edit-form/gct-edit-form.mjs +0 -126
  231. package/es/widgets/gct-edit-form/index.mjs +0 -10
  232. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.mjs +0 -73
  233. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.provider.mjs +0 -11
  234. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.scss +0 -62
  235. package/es/widgets/gct-form/gct-form-collapse/index.mjs +0 -15
  236. package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.mjs +0 -71
  237. package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.provider.mjs +0 -13
  238. package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.scss +0 -23
  239. package/es/widgets/gct-form/gct-form-collapse-pane/index.mjs +0 -15
  240. package/es/widgets/gct-form/gct-form-group/gct-form-group.mjs +0 -88
  241. package/es/widgets/gct-form/gct-form-group/gct-form-group.provider.mjs +0 -11
  242. package/es/widgets/gct-form/gct-form-group/gct-form-group.scss +0 -28
  243. package/es/widgets/gct-form/gct-form-group/index.mjs +0 -15
  244. package/es/widgets/gct-form/gct-form-hidden-item/gct-form-hidden-item.provider.mjs +0 -13
  245. package/es/widgets/gct-form/gct-form-item/gct-form-item.mjs +0 -141
  246. package/es/widgets/gct-form/gct-form-item/gct-form-item.provider.mjs +0 -11
  247. package/es/widgets/gct-form/gct-form-item/gct-form-item.scss +0 -115
  248. package/es/widgets/gct-form/gct-form-tab/gct-form-tab.mjs +0 -53
  249. package/es/widgets/gct-form/gct-form-tab/gct-form-tab.provider.mjs +0 -11
  250. package/es/widgets/gct-form/gct-form-tab/gct-form-tab.scss +0 -63
  251. package/es/widgets/gct-form/gct-form-tab/index.mjs +0 -12
  252. package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.mjs +0 -65
  253. package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.provider.mjs +0 -11
  254. package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.scss +0 -16
  255. package/es/widgets/gct-form/gct-form-tab-pane/index.mjs +0 -15
  256. package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.mjs +0 -71
  257. package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.provider.mjs +0 -11
  258. package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.scss +0 -25
  259. package/es/widgets/gct-form/gct-form-title-group/index.mjs +0 -16
  260. package/es/widgets/gct-form/gct-form.mjs +0 -112
  261. package/es/widgets/gct-form/gct-form.scss +0 -11
  262. package/es/widgets/gct-form/index.mjs +0 -31
@@ -0,0 +1,70 @@
1
+ @charset "UTF-8";
2
+ /* stylelint-disable scss/no-global-function-names */
3
+ /* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
4
+ /**
5
+ * 定义 Block 块
6
+ * @param {String} $block - Block 块名称
7
+ * @example
8
+ * @include b('button') {
9
+ * padding: 10px;
10
+ * }
11
+ */
12
+ /**
13
+ * 定义 Element 元素
14
+ * @param {String|List} $element - Element 元素名称,支持单个或多个
15
+ * @example
16
+ * @include b('button') {
17
+ * @include e('text') {
18
+ * color: #000;
19
+ * }
20
+ * }
21
+ * // 或传入多个元素
22
+ * @include b('button') {
23
+ * @include e(('text', 'icon')) {
24
+ * margin: 5px;
25
+ * }
26
+ * }
27
+ */
28
+ /**
29
+ * 定义 Modifier 修饰符
30
+ * @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
31
+ * @example
32
+ * @include b('button') {
33
+ * @include m('primary') {
34
+ * background: blue;
35
+ * }
36
+ * }
37
+ * // 或传入多个修饰符
38
+ * @include b('button') {
39
+ * @include m(('primary', 'large')) {
40
+ * background: blue;
41
+ * font-size: 16px;
42
+ * }
43
+ * }
44
+ */
45
+ /**
46
+ * 定义状态选择器
47
+ * @param {String} $state - 状态名称
48
+ * @example
49
+ * @include b('button') {
50
+ * @include when('disabled') {
51
+ * opacity: 0.5;
52
+ * }
53
+ * }
54
+ */
55
+ /**
56
+ * 深色主题样式
57
+ * @param {String} $block - Block 块名称
58
+ * @example
59
+ * @include dark('button') {
60
+ * background: #333;
61
+ * color: #fff;
62
+ * }
63
+ */
64
+ /* stylelint-disable scss/no-global-function-names */
65
+ .gct-dnd-item {
66
+ background-color: rgb(var(--gct-gray-2));
67
+ }
68
+ .gct-dnd-item.is-dragging {
69
+ background-color: var(--gct-color-bg-3) !important;
70
+ }
@@ -0,0 +1,50 @@
1
+ import { PropType } from 'vue';
2
+ import { IGctDragCollect, IGctDndData, IGctDndConfig } from '../../interface';
3
+ import { GCT_DND_INSERT_POS } from '../../constants';
4
+ export declare const GctDndItem: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
5
+ config: {
6
+ type: PropType<IGctDndConfig>;
7
+ required: true;
8
+ };
9
+ index: {
10
+ type: NumberConstructor;
11
+ required: true;
12
+ };
13
+ data: {
14
+ type: PropType<IGctDndData>;
15
+ required: true;
16
+ };
17
+ last: {
18
+ type: BooleanConstructor;
19
+ default: boolean;
20
+ };
21
+ }>, {
22
+ ns: import('@gct-paas/core').Namespace;
23
+ rootRef: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
24
+ posState: import('vue').Ref<0 | 1 | -1, 0 | 1 | -1>;
25
+ collect: import('vue').Ref<IGctDragCollect, IGctDragCollect>;
26
+ onDrop: (insertPos: GCT_DND_INSERT_POS, data: IGctDndData) => void;
27
+ drag: import('vue3-dnd').ConnectDragSource<import('vue3-dnd').DragSourceOptions>;
28
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "drop"[], "drop", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
29
+ config: {
30
+ type: PropType<IGctDndConfig>;
31
+ required: true;
32
+ };
33
+ index: {
34
+ type: NumberConstructor;
35
+ required: true;
36
+ };
37
+ data: {
38
+ type: PropType<IGctDndData>;
39
+ required: true;
40
+ };
41
+ last: {
42
+ type: BooleanConstructor;
43
+ default: boolean;
44
+ };
45
+ }>> & Readonly<{
46
+ onDrop?: ((...args: any[]) => any) | undefined;
47
+ }>, {
48
+ last: boolean;
49
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
50
+ export default GctDndItem;
@@ -0,0 +1,239 @@
1
+ import { defineComponent, createVNode, ref, inject } from 'vue';
2
+ import { useNamespace } from '@gct-paas/core';
3
+ import { useDrag, useDrop } from 'vue3-dnd';
4
+ import { cloneDeep } from 'lodash-es';
5
+ import { GCT_DND_INSERT_POS } from '../../constants/index.mjs';
6
+ import './gct-dnd-item.css';/* empty css */
7
+
8
+ const GctDndItem = /* @__PURE__ */ defineComponent({
9
+ name: 'GctDndItem',
10
+ props: {
11
+ config: {
12
+ type: Object,
13
+ required: true
14
+ },
15
+ // 数据所在位置下标
16
+ index: {
17
+ type: Number,
18
+ required: true
19
+ },
20
+ // 当前项数据
21
+ data: {
22
+ type: Object,
23
+ required: true
24
+ },
25
+ last: {
26
+ type: Boolean,
27
+ default: false
28
+ }
29
+ },
30
+ emits: ['drop'],
31
+ setup(props, {
32
+ emit
33
+ }) {
34
+ const {
35
+ config
36
+ } = props;
37
+ const ns = useNamespace('dnd-item');
38
+ const rootRef = ref(null);
39
+ const isBeforeHover = ref(false);
40
+ const dropLineState = inject('vue3-dnd-drop-line-state');
41
+ // 通过悬浮时计算,放置的位置
42
+ const posState = ref(-1);
43
+ // 拖放配置,暂时无用,主要利用内部机制,避免悬浮时容器触发了放置
44
+ // 拖拽配置
45
+ const [collect, drag, preview] = useDrag({
46
+ type: config.group,
47
+ item: () => {
48
+ return {
49
+ index: props.index,
50
+ id: props.data.id,
51
+ data: props.data,
52
+ group: config.group,
53
+ mode: config.mode ?? 'move',
54
+ tagMap: config.tagMap ?? {},
55
+ types: []
56
+ };
57
+ },
58
+ collect: monitor => {
59
+ return {
60
+ canDrag: monitor.canDrag(),
61
+ isDragging: monitor.isDragging()
62
+ };
63
+ },
64
+ canDrag() {
65
+ if (config.isDrag === false) {
66
+ return false;
67
+ }
68
+ if (config.canDrag) {
69
+ return config.canDrag(props.data);
70
+ }
71
+ return true;
72
+ },
73
+ end: async (_, monitor) => {
74
+ const result = monitor.getDropResult();
75
+ if (result && result.asyncDrop) {
76
+ const res = await result.asyncDrop();
77
+ if (res.success === true && res.data) {
78
+ if (config.end) {
79
+ config.end(_, res);
80
+ }
81
+ if (config.add) {
82
+ config.add(res.data);
83
+ }
84
+ console.debug('drop success');
85
+ }
86
+ }
87
+ }
88
+ });
89
+ if (props.config.isDrop !== true) {
90
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
91
+ const [_, drop] = useDrop({
92
+ accept: config.group,
93
+ canDrop() {
94
+ return false;
95
+ }
96
+ });
97
+ drop(rootRef);
98
+ } else {
99
+ const [dropCollect, drop] = useDrop({
100
+ accept: config.group,
101
+ collect(monitor) {
102
+ return {
103
+ handlerId: monitor.getHandlerId(),
104
+ isOver: monitor.isOver(),
105
+ canDrop: monitor.canDrop(),
106
+ isShallowOver: monitor.isOver({
107
+ shallow: true
108
+ })
109
+ };
110
+ },
111
+ canDrop(item, monitor) {
112
+ if (collect.value.isDragging === true) {
113
+ return false;
114
+ }
115
+ return item.id !== props.data.id && monitor.isOver({
116
+ shallow: true
117
+ });
118
+ },
119
+ hover(_item, monitor) {
120
+ if (monitor.canDrop() === false) {
121
+ return;
122
+ }
123
+ const isOver = monitor.isOver({
124
+ shallow: true
125
+ });
126
+ if (isOver) {
127
+ const rect = rootRef.value.getBoundingClientRect();
128
+ const offset = monitor.getClientOffset();
129
+ // 放置线计算偏移量
130
+ const dropOffset = config.offset ?? 0;
131
+ let difference = 0;
132
+ if (config.direction === 'vertical') {
133
+ const {
134
+ top,
135
+ height
136
+ } = rect;
137
+ const {
138
+ y
139
+ } = offset;
140
+ const half = height / 2;
141
+ difference = y - top - half;
142
+ // 小于偏移量,则不处理
143
+ if (Math.abs(difference) < dropOffset) {
144
+ return;
145
+ }
146
+ if (difference < 0) {
147
+ isBeforeHover.value = true;
148
+ } else {
149
+ isBeforeHover.value = false;
150
+ }
151
+ } else if (config.direction === 'horizontal') {
152
+ const {
153
+ left,
154
+ width
155
+ } = rect;
156
+ const {
157
+ x
158
+ } = offset;
159
+ const half = width / 2;
160
+ difference = x - left - half;
161
+ // 小于偏移量,则不处理
162
+ if (Math.abs(difference) < dropOffset) {
163
+ return;
164
+ }
165
+ if (difference < 0) {
166
+ isBeforeHover.value = true;
167
+ } else {
168
+ isBeforeHover.value = false;
169
+ }
170
+ }
171
+ dropLineState.activeKey = props.data.id;
172
+ dropLineState.isBeforeHover = isBeforeHover.value;
173
+ } else {
174
+ dropLineState.activeKey = '';
175
+ }
176
+ },
177
+ drop: (item, monitor) => {
178
+ // 一旦放置,操控线的激活项就置空
179
+ dropLineState.activeKey = '';
180
+ if (dropCollect.value.isShallowOver !== true || monitor.canDrop() === false) {
181
+ return;
182
+ }
183
+ const callback = async () => {
184
+ let data = item.data;
185
+ if (config.drop) {
186
+ data = await config.drop(item);
187
+ if (!data) {
188
+ return {
189
+ group: config.group,
190
+ cfg: cloneDeep(props.config),
191
+ success: false
192
+ };
193
+ }
194
+ }
195
+ onDrop(isBeforeHover.value ? GCT_DND_INSERT_POS.BEFORE : GCT_DND_INSERT_POS.AFTER, data);
196
+ return {
197
+ group: config.group,
198
+ success: true,
199
+ cfg: cloneDeep(props.config),
200
+ data
201
+ };
202
+ };
203
+ return {
204
+ asyncDrop: callback
205
+ };
206
+ }
207
+ });
208
+ drop(rootRef);
209
+ }
210
+ if (!config.handle && config.isDrag !== false) {
211
+ drag(rootRef);
212
+ }
213
+ preview(rootRef);
214
+ function onDrop(insertPos, data) {
215
+ emit('drop', insertPos, data);
216
+ }
217
+ return {
218
+ ns,
219
+ rootRef,
220
+ posState,
221
+ collect,
222
+ onDrop,
223
+ drag
224
+ };
225
+ },
226
+ render() {
227
+ const itemProps = {
228
+ index: this.index,
229
+ data: this.data,
230
+ drag: this.drag
231
+ };
232
+ return createVNode("div", {
233
+ "ref": "rootRef",
234
+ "class": [this.ns.b(), this.ns.is('dragging', this.collect.isDragging), this.ns.is('not-drag', this.collect.canDrag === false)]
235
+ }, [this.$slots.default?.(itemProps)]);
236
+ }
237
+ });
238
+
239
+ export { GctDndItem };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 拖拽放置时的插入位置
3
+ */
4
+ export declare const GCT_DND_INSERT_POS: {
5
+ /**
6
+ * 插入第一个
7
+ */
8
+ readonly FIRST: "first";
9
+ /**
10
+ * 插入前
11
+ */
12
+ readonly BEFORE: "before";
13
+ /**
14
+ * 插入后
15
+ */
16
+ readonly AFTER: "after";
17
+ /**
18
+ * 插入最后
19
+ */
20
+ readonly LAST: "last";
21
+ };
22
+ export type GCT_DND_INSERT_POS = (typeof GCT_DND_INSERT_POS)[keyof typeof GCT_DND_INSERT_POS];
@@ -0,0 +1,20 @@
1
+ const GCT_DND_INSERT_POS = {
2
+ /**
3
+ * 插入第一个
4
+ */
5
+ FIRST: "first",
6
+ /**
7
+ * 插入前
8
+ */
9
+ BEFORE: "before",
10
+ /**
11
+ * 插入后
12
+ */
13
+ AFTER: "after",
14
+ /**
15
+ * 插入最后
16
+ */
17
+ LAST: "last"
18
+ };
19
+
20
+ export { GCT_DND_INSERT_POS };
@@ -0,0 +1,5 @@
1
+ export { GctDndContainer } from './components/gct-dnd-container/gct-dnd-container';
2
+ export { GctDndDropLine } from './components/gct-dnd-drop-line/gct-dnd-drop-line';
3
+ export { GctDndItem } from './components/gct-dnd-item/gct-dnd-item';
4
+ export { GCT_DND_INSERT_POS } from './constants';
5
+ export type * from './interface';
@@ -0,0 +1,101 @@
1
+ import { GCT_DND_INSERT_POS } from '../constants';
2
+ import { IGctDndData } from './i-gct-dnd-data';
3
+ import { IGctDragDndData } from './i-gct-drag-dnd-data';
4
+ import { IGctDropResultData } from './i-gct-drop-result';
5
+ /**
6
+ * 拖拽配置
7
+ *
8
+ * @export
9
+ * @interface IGctDndConfig
10
+ */
11
+ export interface IGctDndConfig {
12
+ /**
13
+ * 拖拽分组标识
14
+ *
15
+ * @type {string}
16
+ */
17
+ group: string;
18
+ /**
19
+ * 拖拽时额外携带的标签,可以用于做特殊区分
20
+ *
21
+ * @type {IObject}
22
+ */
23
+ tagMap?: IObject;
24
+ /**
25
+ * 拖拽模式,默认移动
26
+ *
27
+ * @default 'move'
28
+ * @type {('copy' | 'move' | string)}
29
+ */
30
+ mode?: 'copy' | 'move' | string;
31
+ /**
32
+ * 自定义拖拽标识
33
+ *
34
+ * @type {string}
35
+ */
36
+ handle?: string;
37
+ /**
38
+ * 是否开启放置功能,默认 开启
39
+ *
40
+ * @default true
41
+ * @type {boolean}
42
+ */
43
+ isDrop?: boolean;
44
+ /**
45
+ * 是否开启拖拽功能,默认 开启
46
+ *
47
+ * @default true
48
+ * @type {boolean}
49
+ */
50
+ isDrag?: boolean;
51
+ /**
52
+ * 拖拽方向,默认水平方向
53
+ *
54
+ * @default 'horizontal'
55
+ * @type {('vertical' | 'horizontal')}
56
+ */
57
+ direction?: 'vertical' | 'horizontal';
58
+ /**
59
+ * 拖拽放置偏移量,用于控制放置区移动鼠标的交互优化
60
+ *
61
+ * @type {number}
62
+ */
63
+ offset?: number;
64
+ /**
65
+ * 拖入容器时,默认插入位置
66
+ *
67
+ * @default 'after'
68
+ * @type {('first' | 'last')}
69
+ */
70
+ insertPos?: GCT_DND_INSERT_POS;
71
+ /**
72
+ * 是否允许放置
73
+ *
74
+ */
75
+ canDrop?: (data: IGctDragDndData) => boolean;
76
+ /**
77
+ * 是否允许拖拽
78
+ *
79
+ */
80
+ canDrag?: (data: IGctDndData) => boolean;
81
+ /**
82
+ * 放置数据处理
83
+ *
84
+ */
85
+ drop?: (data: IGctDragDndData) => IGctDndData | null;
86
+ /**
87
+ * 放置数据处理
88
+ *
89
+ */
90
+ end?: (data: IGctDragDndData, res: IGctDropResultData) => void;
91
+ /**
92
+ * 新增
93
+ *
94
+ */
95
+ add?: (data: IGctDndData) => void;
96
+ /**
97
+ * 删除项
98
+ *
99
+ */
100
+ remove?: (data: IGctDndData) => void;
101
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 拖拽数据
3
+ *
4
+ * @export
5
+ * @interface IGctDndData
6
+ */
7
+ export interface IGctDndData extends IObject {
8
+ /**
9
+ * 必须要有主键标识
10
+ *
11
+ * @type {string}
12
+ */
13
+ id: string;
14
+ }
@@ -0,0 +1,28 @@
1
+ import { ConnectDragSource, DragSourceOptions } from 'vue3-dnd';
2
+ /**
3
+ * 拖拽项绘制 props 参数
4
+ *
5
+ * @export
6
+ * @interface IGctDndRenderItemOptions
7
+ * @template T
8
+ */
9
+ export interface IGctDndRenderItemOptions<T = IObject> {
10
+ /**
11
+ * 当前拖拽项开始拖拽时的索引
12
+ *
13
+ * @type {number}
14
+ */
15
+ index: number;
16
+ /**
17
+ * 拖拽数据
18
+ *
19
+ * @type {T}
20
+ */
21
+ data: T;
22
+ /**
23
+ * 设置拖拽项的 DOM 元素
24
+ *
25
+ * @type {ConnectDragSource<DragSourceOptions>}
26
+ */
27
+ drag: ConnectDragSource<DragSourceOptions>;
28
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 拖拽时状态
3
+ *
4
+ * @export
5
+ * @interface IGctDragCollect
6
+ */
7
+ export interface IGctDragCollect {
8
+ /**
9
+ * 是否可以拖拽
10
+ *
11
+ * @author zhanghanrui
12
+ * @date 2024-07-05 15:07:20
13
+ * @type {boolean}
14
+ */
15
+ canDrag: boolean;
16
+ /**
17
+ * 是否正在拖拽
18
+ *
19
+ * @author zhanghanrui
20
+ * @date 2024-07-05 15:07:26
21
+ * @type {boolean}
22
+ */
23
+ isDragging: boolean;
24
+ }
@@ -0,0 +1,51 @@
1
+ import { IGctDndData } from './i-gct-dnd-data';
2
+ /**
3
+ * 拖拽数据
4
+ *
5
+ * @export
6
+ * @interface IGctDragDndData
7
+ */
8
+ export interface IGctDragDndData<T = IGctDndData> {
9
+ /**
10
+ * 当前数据标识,如果是新数据则主键为空
11
+ *
12
+ * @type {string}
13
+ */
14
+ id: string;
15
+ /**
16
+ * 拖拽分组实例标识
17
+ *
18
+ * @type {string}
19
+ */
20
+ group: string;
21
+ /**
22
+ * 拖拽项原位置索引
23
+ *
24
+ * @type {number}
25
+ */
26
+ index: number;
27
+ /**
28
+ * 当前拖拽数据
29
+ *
30
+ * @type {T}
31
+ */
32
+ data: T;
33
+ /**
34
+ * 数据模式
35
+ *
36
+ * @type {('create' | 'move' | string)} 新建 | 移动
37
+ */
38
+ mode: 'create' | 'move' | string;
39
+ /**
40
+ * 额外拖拽标识
41
+ *
42
+ * @type {IObject}
43
+ */
44
+ tagMap: IObject;
45
+ /**
46
+ * 包含自身 + 所有子的类型,目前主要用于拖拽限制
47
+ *
48
+ * @type {string[]}
49
+ */
50
+ types: string[];
51
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * 放置时状态
3
+ *
4
+ * @export
5
+ * @interface IGctDropCollect
6
+ */
7
+ export interface IGctDropCollect {
8
+ /**
9
+ * 拖拽元素标识
10
+ *
11
+ * @type {string}
12
+ */
13
+ handlerId: string;
14
+ /**
15
+ * 是否可以放置
16
+ *
17
+ * @type {boolean}
18
+ */
19
+ canDrop: boolean;
20
+ /**
21
+ * 是否只在单一元素放置
22
+ *
23
+ * @type {boolean}
24
+ */
25
+ isShallowOver: boolean;
26
+ /**
27
+ * 是否放置中
28
+ *
29
+ * @type {boolean}
30
+ */
31
+ isOver: boolean;
32
+ }