@gct-paas/core-web 0.1.4-dev.6 → 0.1.4-dev.8

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 (183) hide show
  1. package/dist/index.esm.min.mjs +24964 -0
  2. package/dist/index.min.cjs +59 -12
  3. package/dist/index.min.css +1 -0
  4. package/dist/index.system.min.js +59 -12
  5. package/es/components/assets-svg-icon/assets-svg-icon.css +188 -0
  6. package/es/components/assets-svg-icon/assets-svg-icon.d.ts +134 -0
  7. package/es/components/assets-svg-icon/assets-svg-icon.mjs +238 -0
  8. package/es/components/assets-svg-icon/request.d.ts +2 -0
  9. package/es/components/assets-svg-icon/request.mjs +51 -0
  10. package/es/components/assets-svg-icon/utils.d.ts +9 -0
  11. package/es/components/assets-svg-icon/utils.mjs +21 -0
  12. package/es/components/assets-svg-icon/validate.d.ts +4 -0
  13. package/es/components/assets-svg-icon/validate.mjs +43 -0
  14. package/es/components/code-editor/code-editor.css +67 -0
  15. package/es/components/code-editor/code-editor.d.ts +35 -0
  16. package/es/components/code-editor/code-editor.mjs +15 -20
  17. package/es/components/index.d.ts +1 -0
  18. package/es/components/layout/flex-container/flex-container.css +67 -0
  19. package/es/components/layout/flex-container/flex-container.d.ts +4 -4
  20. package/es/components/layout/flex-item/flex-item.d.ts +4 -4
  21. package/es/components/layout/grid-container/grid-container.d.ts +4 -4
  22. package/es/components/layout/view-container/view-container.css +83 -0
  23. package/es/components/layout/view-container/view-container.d.ts +4 -4
  24. package/es/editor/gct-form-check-switch/gct-form-check-switch.d.ts +7 -7
  25. package/es/editor/gct-form-checkbox/gct-form-checkbox.d.ts +6 -6
  26. package/es/editor/gct-form-field-select/gct-form-field-select.d.ts +17 -7
  27. package/es/editor/gct-form-field-select/gct-model-select.vue.d.ts +3 -12
  28. package/es/editor/gct-form-i18n/gct-form-i18n.d.ts +8 -8
  29. package/es/editor/gct-form-icon-select/gct-form-icon-select.d.ts +8 -8
  30. package/es/editor/gct-form-info/gct-form-info.d.ts +7 -7
  31. package/es/editor/gct-form-length-unit/gct-form-length-unit.d.ts +6 -6
  32. package/es/editor/gct-form-modal-select/gct-form-modal-select.d.ts +8 -8
  33. package/es/editor/gct-form-number/gct-form-number.d.ts +7 -7
  34. package/es/editor/gct-form-picker/gct-form-picker.d.ts +8 -8
  35. package/es/editor/gct-form-radio/gct-form-radio.d.ts +7 -7
  36. package/es/editor/gct-form-select/gct-form-select.d.ts +7 -7
  37. package/es/editor/gct-form-span/gct-form-span.d.ts +5 -5
  38. package/es/editor/gct-form-switch/gct-form-switch.d.ts +6 -6
  39. package/es/editor/gct-form-text/gct-form-text.d.ts +7 -7
  40. package/es/editor/gct-form-textarea/gct-form-textarea.d.ts +7 -7
  41. package/es/hooks/index.d.ts +2 -0
  42. package/es/hooks/useLocale.d.ts +4 -0
  43. package/es/hooks/useLocale.mjs +32 -0
  44. package/es/hooks/useTheme.d.ts +8 -0
  45. package/es/hooks/useTheme.mjs +20 -0
  46. package/es/index.d.ts +5 -6
  47. package/es/index.mjs +19 -24
  48. package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.css +72 -0
  49. package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.d.ts +37 -0
  50. package/es/modules/gct-dnd/components/gct-dnd-container/gct-dnd-container.mjs +195 -0
  51. package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.css +79 -0
  52. package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.d.ts +29 -0
  53. package/es/modules/gct-dnd/components/gct-dnd-drop-line/gct-dnd-drop-line.mjs +98 -0
  54. package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.css +70 -0
  55. package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.d.ts +50 -0
  56. package/es/modules/gct-dnd/components/gct-dnd-item/gct-dnd-item.mjs +239 -0
  57. package/es/modules/gct-dnd/constants/index.d.ts +24 -0
  58. package/es/modules/gct-dnd/constants/index.mjs +9 -0
  59. package/es/modules/gct-dnd/index.d.ts +5 -0
  60. package/es/modules/gct-dnd/interface/i-gct-dnd-config.d.ts +101 -0
  61. package/es/modules/gct-dnd/interface/i-gct-dnd-data.d.ts +14 -0
  62. package/es/modules/gct-dnd/interface/i-gct-dnd-render-item-options.d.ts +28 -0
  63. package/es/modules/gct-dnd/interface/i-gct-drag-collect.d.ts +24 -0
  64. package/es/modules/gct-dnd/interface/i-gct-drag-dnd-data.d.ts +51 -0
  65. package/es/modules/gct-dnd/interface/i-gct-drop-collect.d.ts +32 -0
  66. package/es/modules/gct-dnd/interface/i-gct-drop-result.d.ts +47 -0
  67. package/es/modules/gct-dnd/interface/index.d.ts +7 -0
  68. package/es/types/index.d.ts +1 -1
  69. package/es/utils/with-install.mjs +0 -1
  70. package/es/widgets/gct-edit-form/gct-edit-form.d.ts +9 -9
  71. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.d.ts +6 -6
  72. package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.d.ts +4 -4
  73. package/es/widgets/gct-form/gct-form-group/gct-form-group.d.ts +5 -5
  74. package/es/widgets/gct-form/gct-form-item/gct-form-item.d.ts +4 -4
  75. package/es/widgets/gct-form/gct-form-tab/gct-form-tab.d.ts +4 -4
  76. package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.d.ts +4 -4
  77. package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.d.ts +5 -5
  78. package/es/widgets/gct-form/gct-form.d.ts +5 -5
  79. package/package.json +15 -13
  80. package/dist/core-web.css +0 -1
  81. package/es/components/code-editor/code-editor.scss +0 -3
  82. package/es/components/index.mjs +0 -7
  83. package/es/components/layout/flex-container/flex-container.mjs +0 -90
  84. package/es/components/layout/flex-container/flex-container.scss +0 -3
  85. package/es/components/layout/flex-item/flex-item.mjs +0 -53
  86. package/es/components/layout/flex-item/flex-item.scss +0 -17
  87. package/es/components/layout/grid-container/grid-container.mjs +0 -47
  88. package/es/components/layout/view-container/view-container.mjs +0 -39
  89. package/es/components/layout/view-container/view-container.scss +0 -19
  90. package/es/editor/gct-form-check-switch/gct-form-check-switch.mjs +0 -53
  91. package/es/editor/gct-form-check-switch/gct-form-check-switch.provider.mjs +0 -6
  92. package/es/editor/gct-form-check-switch/gct-form-check-switch.scss +0 -10
  93. package/es/editor/gct-form-check-switch/index.mjs +0 -12
  94. package/es/editor/gct-form-checkbox/gct-form-checkbox.mjs +0 -70
  95. package/es/editor/gct-form-checkbox/gct-form-checkbox.scss +0 -56
  96. package/es/editor/gct-form-checkbox/index.mjs +0 -19
  97. package/es/editor/gct-form-color/gct-form-color.mjs +0 -45
  98. package/es/editor/gct-form-color/gct-form-color.provider.mjs +0 -6
  99. package/es/editor/gct-form-color/gct-form-color.scss +0 -3
  100. package/es/editor/gct-form-color/index.mjs +0 -17
  101. package/es/editor/gct-form-field-select/gct-form-field-select.mjs +0 -48
  102. package/es/editor/gct-form-field-select/gct-form-field-select.provider.mjs +0 -6
  103. package/es/editor/gct-form-field-select/gct-form-field-select.scss +0 -7
  104. package/es/editor/gct-form-field-select/gct-model-select.vue +0 -70
  105. package/es/editor/gct-form-field-select/index.mjs +0 -12
  106. package/es/editor/gct-form-i18n/gct-form-i18n.mjs +0 -62
  107. package/es/editor/gct-form-i18n/gct-form-i18n.provider.mjs +0 -6
  108. package/es/editor/gct-form-i18n/index.mjs +0 -12
  109. package/es/editor/gct-form-icon-select/gct-form-icon-select.mjs +0 -74
  110. package/es/editor/gct-form-icon-select/gct-form-icon-select.scss +0 -14
  111. package/es/editor/gct-form-icon-select/index.mjs +0 -14
  112. package/es/editor/gct-form-info/gct-form-info.mjs +0 -40
  113. package/es/editor/gct-form-info/gct-form-info.scss +0 -8
  114. package/es/editor/gct-form-info/index.mjs +0 -14
  115. package/es/editor/gct-form-length-unit/gct-form-length-unit.mjs +0 -43
  116. package/es/editor/gct-form-length-unit/gct-form-length-unit.provider.mjs +0 -6
  117. package/es/editor/gct-form-length-unit/index.mjs +0 -12
  118. package/es/editor/gct-form-modal-select/gct-form-modal-select.mjs +0 -99
  119. package/es/editor/gct-form-modal-select/gct-form-modal-select.provider.mjs +0 -6
  120. package/es/editor/gct-form-modal-select/gct-form-modal-select.scss +0 -7
  121. package/es/editor/gct-form-modal-select/index.mjs +0 -12
  122. package/es/editor/gct-form-number/gct-form-number.mjs +0 -44
  123. package/es/editor/gct-form-number/gct-form-number.provider.mjs +0 -6
  124. package/es/editor/gct-form-number/gct-form-number.scss +0 -3
  125. package/es/editor/gct-form-number/index.mjs +0 -17
  126. package/es/editor/gct-form-picker/gct-form-picker.mjs +0 -92
  127. package/es/editor/gct-form-picker/gct-form-picker.provider.mjs +0 -6
  128. package/es/editor/gct-form-picker/index.mjs +0 -12
  129. package/es/editor/gct-form-radio/gct-form-radio.mjs +0 -70
  130. package/es/editor/gct-form-radio/gct-form-radio.scss +0 -68
  131. package/es/editor/gct-form-radio/index.mjs +0 -19
  132. package/es/editor/gct-form-select/gct-form-select.mjs +0 -50
  133. package/es/editor/gct-form-select/gct-form-select.provider.mjs +0 -6
  134. package/es/editor/gct-form-select/index.mjs +0 -12
  135. package/es/editor/gct-form-span/gct-form-span.mjs +0 -89
  136. package/es/editor/gct-form-span/gct-form-span.provider.mjs +0 -6
  137. package/es/editor/gct-form-span/gct-form-span.scss +0 -10
  138. package/es/editor/gct-form-span/index.mjs +0 -12
  139. package/es/editor/gct-form-switch/gct-form-switch.mjs +0 -35
  140. package/es/editor/gct-form-switch/gct-form-switch.provider.mjs +0 -6
  141. package/es/editor/gct-form-switch/index.mjs +0 -17
  142. package/es/editor/gct-form-text/gct-form-text.mjs +0 -45
  143. package/es/editor/gct-form-text/gct-form-text.provider.mjs +0 -6
  144. package/es/editor/gct-form-text/index.mjs +0 -17
  145. package/es/editor/gct-form-textarea/gct-form-textarea.mjs +0 -40
  146. package/es/editor/gct-form-textarea/gct-form-textarea.provider.mjs +0 -6
  147. package/es/editor/gct-form-textarea/index.mjs +0 -12
  148. package/es/editor/index.mjs +0 -51
  149. package/es/utils/index.mjs +0 -3
  150. package/es/vite-env.d.ts +0 -1
  151. package/es/widgets/gct-edit-form/gct-edit-form.mjs +0 -126
  152. package/es/widgets/gct-edit-form/index.mjs +0 -10
  153. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.mjs +0 -73
  154. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.provider.mjs +0 -11
  155. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.scss +0 -62
  156. package/es/widgets/gct-form/gct-form-collapse/index.mjs +0 -15
  157. package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.mjs +0 -71
  158. package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.provider.mjs +0 -13
  159. package/es/widgets/gct-form/gct-form-collapse-pane/gct-form-collapse-pane.scss +0 -23
  160. package/es/widgets/gct-form/gct-form-collapse-pane/index.mjs +0 -15
  161. package/es/widgets/gct-form/gct-form-group/gct-form-group.mjs +0 -88
  162. package/es/widgets/gct-form/gct-form-group/gct-form-group.provider.mjs +0 -11
  163. package/es/widgets/gct-form/gct-form-group/gct-form-group.scss +0 -28
  164. package/es/widgets/gct-form/gct-form-group/index.mjs +0 -15
  165. package/es/widgets/gct-form/gct-form-hidden-item/gct-form-hidden-item.provider.mjs +0 -13
  166. package/es/widgets/gct-form/gct-form-item/gct-form-item.mjs +0 -141
  167. package/es/widgets/gct-form/gct-form-item/gct-form-item.provider.mjs +0 -11
  168. package/es/widgets/gct-form/gct-form-item/gct-form-item.scss +0 -115
  169. package/es/widgets/gct-form/gct-form-tab/gct-form-tab.mjs +0 -53
  170. package/es/widgets/gct-form/gct-form-tab/gct-form-tab.provider.mjs +0 -11
  171. package/es/widgets/gct-form/gct-form-tab/gct-form-tab.scss +0 -63
  172. package/es/widgets/gct-form/gct-form-tab/index.mjs +0 -12
  173. package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.mjs +0 -65
  174. package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.provider.mjs +0 -11
  175. package/es/widgets/gct-form/gct-form-tab-pane/gct-form-tab-pane.scss +0 -16
  176. package/es/widgets/gct-form/gct-form-tab-pane/index.mjs +0 -15
  177. package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.mjs +0 -71
  178. package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.provider.mjs +0 -11
  179. package/es/widgets/gct-form/gct-form-title-group/gct-form-title-group.scss +0 -25
  180. package/es/widgets/gct-form/gct-form-title-group/index.mjs +0 -16
  181. package/es/widgets/gct-form/gct-form.mjs +0 -110
  182. package/es/widgets/gct-form/gct-form.scss +0 -11
  183. package/es/widgets/gct-form/index.mjs +0 -31
@@ -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,24 @@
1
+ /**
2
+ * 拖拽放置时的插入位置
3
+ *
4
+ * @export
5
+ * @enum {number}
6
+ */
7
+ export declare enum GCT_DND_INSERT_POS {
8
+ /**
9
+ * 插入第一个
10
+ */
11
+ FIRST = "first",
12
+ /**
13
+ * 插入前
14
+ */
15
+ BEFORE = "before",
16
+ /**
17
+ * 插入后
18
+ */
19
+ AFTER = "after",
20
+ /**
21
+ * 插入最后
22
+ */
23
+ LAST = "last"
24
+ }
@@ -0,0 +1,9 @@
1
+ var GCT_DND_INSERT_POS = /* @__PURE__ */ ((GCT_DND_INSERT_POS2) => {
2
+ GCT_DND_INSERT_POS2["FIRST"] = "first";
3
+ GCT_DND_INSERT_POS2["BEFORE"] = "before";
4
+ GCT_DND_INSERT_POS2["AFTER"] = "after";
5
+ GCT_DND_INSERT_POS2["LAST"] = "last";
6
+ return GCT_DND_INSERT_POS2;
7
+ })(GCT_DND_INSERT_POS || {});
8
+
9
+ 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
+ }
@@ -0,0 +1,47 @@
1
+ import { IGctDndConfig } from './i-gct-dnd-config';
2
+ import { IGctDndData } from './i-gct-dnd-data';
3
+ /**
4
+ * 放置返回值数据
5
+ *
6
+ * @export
7
+ * @interface IGctDropResultData
8
+ */
9
+ export interface IGctDropResultData {
10
+ /**
11
+ * 放置分组标识
12
+ *
13
+ * @type {string}
14
+ */
15
+ group: string;
16
+ /**
17
+ * 是否成功放置
18
+ *
19
+ * @type {boolean}
20
+ */
21
+ success: boolean;
22
+ /**
23
+ * 放置数据
24
+ *
25
+ * @type {IGctDndData}
26
+ */
27
+ data?: IGctDndData;
28
+ /**
29
+ * 额外携带放置配置,用于优化放置对比
30
+ *
31
+ * @type {IGctDndConfig}
32
+ */
33
+ cfg: IGctDndConfig;
34
+ }
35
+ /**
36
+ * 放置返回值
37
+ *
38
+ * @export
39
+ * @interface IGctDropResult
40
+ */
41
+ export interface IGctDropResult {
42
+ /**
43
+ * 放置数据异步钩子
44
+ *
45
+ */
46
+ asyncDrop: () => Promise<IGctDropResultData>;
47
+ }
@@ -0,0 +1,7 @@
1
+ export type { IGctDndConfig } from './i-gct-dnd-config';
2
+ export type { IGctDndData } from './i-gct-dnd-data';
3
+ export type { IGctDndRenderItemOptions } from './i-gct-dnd-render-item-options';
4
+ export type { IGctDragCollect } from './i-gct-drag-collect';
5
+ export type { IGctDropCollect } from './i-gct-drop-collect';
6
+ export type { IGctDragDndData } from './i-gct-drag-dnd-data';
7
+ export type { IGctDropResult, IGctDropResultData } from './i-gct-drop-result';
@@ -1 +1 @@
1
- import '@gct-paas/core/es/types';
1
+ import '@gct-paas/core/types';
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  const withInstall = (component, alias) => {
3
2
  component.install = (app) => {
4
3
  const compName = component.name || component.displayName;
@@ -3,7 +3,7 @@ import { IEditForm, IEditFormController } from '@gct-paas/core';
3
3
  /**
4
4
  * 编辑表单组件
5
5
  */
6
- export declare const GctEditForm: import('vue').DefineComponent<{
6
+ export declare const GctEditForm: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
7
7
  embed: {
8
8
  type: BooleanConstructor;
9
9
  default: boolean;
@@ -26,11 +26,11 @@ export declare const GctEditForm: import('vue').DefineComponent<{
26
26
  data: {
27
27
  type: PropType<IData>;
28
28
  };
29
- }, {
29
+ }>, {
30
30
  ns: import('@gct-paas/core').Namespace;
31
31
  c: IEditFormController;
32
- formRef: any;
33
- }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "update:data"[], "update:data", import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<{
32
+ formRef: import('vue').Ref<any, any>;
33
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "update:data"[], "update:data", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
34
34
  embed: {
35
35
  type: BooleanConstructor;
36
36
  default: boolean;
@@ -53,10 +53,10 @@ export declare const GctEditForm: import('vue').DefineComponent<{
53
53
  data: {
54
54
  type: PropType<IData>;
55
55
  };
56
- }>> & {
56
+ }>> & Readonly<{
57
57
  "onUpdate:data"?: ((...args: any[]) => any) | undefined;
58
- }, {
58
+ }>, {
59
59
  embed: boolean;
60
- context: any;
61
- params: any;
62
- }, {}>;
60
+ context: IParams;
61
+ params: IParams;
62
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -3,7 +3,7 @@ import { IFormCollapse, IFormCollapseController } from '@gct-paas/core';
3
3
  /**
4
4
  * 表单折叠面板
5
5
  */
6
- export declare const GctFormCollapse: import('vue').DefineComponent<{
6
+ export declare const GctFormCollapse: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
7
7
  c: {
8
8
  type: PropType<IFormCollapseController>;
9
9
  required: true;
@@ -12,13 +12,13 @@ export declare const GctFormCollapse: import('vue').DefineComponent<{
12
12
  type: PropType<IFormCollapse>;
13
13
  required: true;
14
14
  };
15
- }, {
15
+ }>, {
16
16
  ns: import('@gct-paas/core').Namespace;
17
- keys: import('vue').Ref<number[]>;
17
+ keys: import('vue').Ref<number[], number[]>;
18
18
  style: IParams;
19
- activeKeys: import('vue').Ref<string[]>;
19
+ activeKeys: import('vue').Ref<string[], string[]>;
20
20
  expandIconPosition: import('vue').ComputedRef<"left" | "right">;
21
- }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<{
21
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
22
22
  c: {
23
23
  type: PropType<IFormCollapseController>;
24
24
  required: true;
@@ -27,5 +27,5 @@ export declare const GctFormCollapse: import('vue').DefineComponent<{
27
27
  type: PropType<IFormCollapse>;
28
28
  required: true;
29
29
  };
30
- }>>, {}, {}>;
30
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
31
31
  export default GctFormCollapse;