star-horse-lowcode 2.7.62 → 2.7.65

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 (221) hide show
  1. package/.env.development +3 -0
  2. package/.env.production +3 -0
  3. package/.eslintrc-auto-import.json +77 -0
  4. package/.gitignore +27 -0
  5. package/.idea/.gitignore +5 -0
  6. package/.idea/MarsCodeWorkspaceAppSettings.xml +6 -0
  7. package/.idea/inspectionProfiles/Project_Default.xml +7 -0
  8. package/.idea/modules.xml +8 -0
  9. package/.idea/testcode.iml +12 -0
  10. package/.idea/vcs.xml +6 -0
  11. package/.idea/watcherTasks.xml +4 -0
  12. package/.idea/workspace.xml +207 -0
  13. package/.npmignore +21 -0
  14. package/.prettierignore +26 -0
  15. package/README.md +2 -0
  16. package/auto-imports.d.ts +137 -0
  17. package/components.d.ts +189 -0
  18. package/dist/assets/index.css +1 -1
  19. package/dist/index.es.js +941 -720
  20. package/dist/types/index.d.ts +8 -8
  21. package/eslint.config.js +37 -0
  22. package/index.html +14 -0
  23. package/package-lock.json +8276 -0
  24. package/package.json +6 -6
  25. package/prettier.config.js +20 -0
  26. package/public/logo.svg +660 -0
  27. package/src/App.vue +11 -0
  28. package/src/api/date_utils.ts +219 -0
  29. package/src/api/finger_utils.ts +71 -0
  30. package/src/api/form_utils.ts +281 -0
  31. package/src/api/jquery.min.js +2 -0
  32. package/src/api/pcas-code.json +1 -0
  33. package/src/api/settings.ts +81 -0
  34. package/src/api/star_horse_apis.ts +196 -0
  35. package/src/api/star_horse_utils.ts +797 -0
  36. package/src/api/system.ts +351 -0
  37. package/src/api/user_func.ts +147 -0
  38. package/src/api/valid_utils.ts +165 -0
  39. package/src/assets/css/index.scss +908 -0
  40. package/src/assets/icons.css +574 -0
  41. package/src/assets/star-horse-icons.woff +0 -0
  42. package/src/components/comp/ShDynamicForm.vue +160 -0
  43. package/src/components/comp/ShForm.vue +30 -0
  44. package/src/components/comp/ShTableListColumn.vue +61 -0
  45. package/src/components/comp/StarHorseDataSelector.vue +139 -0
  46. package/src/components/comp/StarHorseDataView.vue +110 -0
  47. package/src/components/comp/StarHorseDataViewItems.vue +61 -0
  48. package/src/components/comp/StarHorseDataViewTable.vue +102 -0
  49. package/src/components/comp/StarHorseDialog.vue +383 -0
  50. package/src/components/comp/StarHorseDraggable.vue +401 -0
  51. package/src/components/comp/StarHorseForm.vue +458 -0
  52. package/src/components/comp/StarHorseFormItem.vue +82 -0
  53. package/src/components/comp/StarHorseFormList.vue +516 -0
  54. package/src/components/comp/StarHorseFormTable.vue +56 -0
  55. package/src/components/comp/StarHorseIcon.vue +76 -0
  56. package/src/components/comp/StarHorseItem.vue +302 -0
  57. package/src/components/comp/StarHorseJsonEditor.vue +115 -0
  58. package/src/components/comp/StarHorsePopover.vue +66 -0
  59. package/src/components/comp/StarHorseSearchComp.vue +253 -0
  60. package/src/components/comp/StarHorseStaticTable.vue +395 -0
  61. package/src/components/comp/StarHorseTableColumn.vue +249 -0
  62. package/src/components/comp/StarHorseTableComp.vue +1193 -0
  63. package/src/components/comp/StarHorseTableViewColumn.vue +61 -0
  64. package/src/components/comp/StarHorseTree.vue +494 -0
  65. package/src/components/comp/index.ts +22 -0
  66. package/src/components/comp/items/UTableColumn.vue +65 -0
  67. package/src/components/comp/items/boxItem.vue +98 -0
  68. package/src/components/comp/items/callitem.ts +9 -0
  69. package/src/components/comp/items/cardItem.vue +152 -0
  70. package/src/components/comp/items/collapseItem.vue +134 -0
  71. package/src/components/comp/items/dytableItem.vue +135 -0
  72. package/src/components/comp/items/otherItem.vue +65 -0
  73. package/src/components/comp/items/tabItem.vue +155 -0
  74. package/src/components/comp/items/tabPanelItem.vue +110 -0
  75. package/src/components/comp/items/tableColumn.vue +129 -0
  76. package/src/components/comp/items/tableItem.vue +97 -0
  77. package/src/components/comp/items/tablebtn.vue +158 -0
  78. package/src/components/comp/items/viewBoxItem.vue +55 -0
  79. package/src/components/comp/items/viewCardItem.vue +47 -0
  80. package/src/components/comp/items/viewCollapseItem.vue +71 -0
  81. package/src/components/comp/items/viewDytableItem.vue +77 -0
  82. package/src/components/comp/items/viewOtherItem.vue +55 -0
  83. package/src/components/comp/items/viewTabItem.vue +77 -0
  84. package/src/components/comp/items/viewTabPanelItem.vue +54 -0
  85. package/src/components/comp/items/viewTableItem.vue +74 -0
  86. package/src/components/comp/selfcomp.ts +9 -0
  87. package/src/components/comp/utils/DataPicker.vue +302 -0
  88. package/src/components/comp/utils/DataTag.vue +51 -0
  89. package/src/components/cron/Crontab-Day.vue +230 -0
  90. package/src/components/cron/Crontab-Hour.vue +165 -0
  91. package/src/components/cron/Crontab-Min.vue +166 -0
  92. package/src/components/cron/Crontab-Month.vue +166 -0
  93. package/src/components/cron/Crontab-Result.vue +615 -0
  94. package/src/components/cron/Crontab-Second.vue +185 -0
  95. package/src/components/cron/Crontab-Week.vue +208 -0
  96. package/src/components/cron/Crontab-Year.vue +183 -0
  97. package/src/components/cron/Crontab.vue +474 -0
  98. package/src/components/enums/ModuleEnums.ts +10 -0
  99. package/src/components/enums/ServiceEnums.ts +18 -0
  100. package/src/components/formcomp/container/box-container.vue +162 -0
  101. package/src/components/formcomp/container/callitem.ts +9 -0
  102. package/src/components/formcomp/container/card-container.vue +170 -0
  103. package/src/components/formcomp/container/collapse-container.vue +133 -0
  104. package/src/components/formcomp/container/dytable-col.vue +448 -0
  105. package/src/components/formcomp/container/dytable-container.vue +57 -0
  106. package/src/components/formcomp/container/dytableUtils.ts +358 -0
  107. package/src/components/formcomp/container/group-box-container.vue +331 -0
  108. package/src/components/formcomp/container/index.ts +6 -0
  109. package/src/components/formcomp/container/tab-container.vue +153 -0
  110. package/src/components/formcomp/container/table-container.vue +249 -0
  111. package/src/components/formcomp/items/allitem.ts +9 -0
  112. package/src/components/formcomp/items/area-item.vue +116 -0
  113. package/src/components/formcomp/items/audio-item.vue +163 -0
  114. package/src/components/formcomp/items/autocomplete-item.vue +118 -0
  115. package/src/components/formcomp/items/barcode-item.vue +87 -0
  116. package/src/components/formcomp/items/base-json-item.vue +207 -0
  117. package/src/components/formcomp/items/button-item.vue +228 -0
  118. package/src/components/formcomp/items/cascade-item.vue +113 -0
  119. package/src/components/formcomp/items/checkbox-item.vue +97 -0
  120. package/src/components/formcomp/items/color-item.vue +70 -0
  121. package/src/components/formcomp/items/cron-item.vue +115 -0
  122. package/src/components/formcomp/items/datetime-item.vue +99 -0
  123. package/src/components/formcomp/items/depart-item.vue +51 -0
  124. package/src/components/formcomp/items/dialog-input-item.vue +207 -0
  125. package/src/components/formcomp/items/divider-item.vue +66 -0
  126. package/src/components/formcomp/items/html-item.vue +65 -0
  127. package/src/components/formcomp/items/htmleditor-item.vue +104 -0
  128. package/src/components/formcomp/items/icon-item.vue +195 -0
  129. package/src/components/formcomp/items/image-item.vue +247 -0
  130. package/src/components/formcomp/items/index.ts +44 -0
  131. package/src/components/formcomp/items/input-item.vue +150 -0
  132. package/src/components/formcomp/items/json-array-item.vue +67 -0
  133. package/src/components/formcomp/items/json-item.vue +66 -0
  134. package/src/components/formcomp/items/markdown-item.vue +77 -0
  135. package/src/components/formcomp/items/number-item.vue +94 -0
  136. package/src/components/formcomp/items/number-range-item.vue +278 -0
  137. package/src/components/formcomp/items/page-select-item.vue +407 -0
  138. package/src/components/formcomp/items/password-item.vue +71 -0
  139. package/src/components/formcomp/items/qrcode-item.vue +84 -0
  140. package/src/components/formcomp/items/radio-item.vue +112 -0
  141. package/src/components/formcomp/items/rate-item.vue +68 -0
  142. package/src/components/formcomp/items/select-item.vue +133 -0
  143. package/src/components/formcomp/items/signature-item.vue +216 -0
  144. package/src/components/formcomp/items/slider-item.vue +68 -0
  145. package/src/components/formcomp/items/starhorse-form-item.vue +334 -0
  146. package/src/components/formcomp/items/switch-item.vue +77 -0
  147. package/src/components/formcomp/items/tag-item.vue +77 -0
  148. package/src/components/formcomp/items/text-item.vue +75 -0
  149. package/src/components/formcomp/items/textarea-item.vue +85 -0
  150. package/src/components/formcomp/items/time-item.vue +77 -0
  151. package/src/components/formcomp/items/time-picker-item.vue +74 -0
  152. package/src/components/formcomp/items/transfer-item.vue +93 -0
  153. package/src/components/formcomp/items/tselect-item.vue +121 -0
  154. package/src/components/formcomp/items/unknown-item.vue +51 -0
  155. package/src/components/formcomp/items/upload-item.vue +189 -0
  156. package/src/components/formcomp/items/user-item.vue +177 -0
  157. package/src/components/formcomp/items/usercomp-item.vue +85 -0
  158. package/src/components/formcomp/items/view-markdown-item.vue +77 -0
  159. package/src/components/formcomp/utils/EditDataDialog.vue +67 -0
  160. package/src/components/formcomp/utils/FieldList.vue +125 -0
  161. package/src/components/formcomp/utils/ItemRelationEventUtils.ts +284 -0
  162. package/src/components/help.vue +31 -0
  163. package/src/components/menu/MenuItem.vue +95 -0
  164. package/src/components/menu/SubMenu.vue +68 -0
  165. package/src/components/menu/SubSystemMenu.vue +142 -0
  166. package/src/components/register.ts +24 -0
  167. package/src/components/system/ContentMenu.vue +260 -0
  168. package/src/components/system/StarHorseButtonList.vue +344 -0
  169. package/src/components/system/StarHorseMenu.vue +97 -0
  170. package/src/components/system/StarHorseSvg.vue +62 -0
  171. package/src/components/system/SystemComp.ts +9 -0
  172. package/src/components/system/index.ts +4 -0
  173. package/src/components/types/ApiUrls.ts +168 -0
  174. package/src/components/types/BtnAction.ts +51 -0
  175. package/src/components/types/BtnAuth.ts +43 -0
  176. package/src/components/types/CompInfo.ts +81 -0
  177. package/src/components/types/DialogProps.ts +55 -0
  178. package/src/components/types/DyCompField.ts +23 -0
  179. package/src/components/types/DynamicNode.ts +42 -0
  180. package/src/components/types/MenusInfo.ts +45 -0
  181. package/src/components/types/PageFieldInfo.ts +530 -0
  182. package/src/components/types/PageProps.ts +25 -0
  183. package/src/components/types/Params.ts +93 -0
  184. package/src/components/types/RuleType.ts +10 -0
  185. package/src/components/types/SearchProps.ts +42 -0
  186. package/src/components/types/ShortKey.ts +30 -0
  187. package/src/components/types/StarHorseType.ts +18 -0
  188. package/src/components/types/index.ts +15 -0
  189. package/src/config/element.ts +15 -0
  190. package/src/config/styles.ts +4 -0
  191. package/src/index.ts +98 -0
  192. package/src/install.ts +33 -0
  193. package/src/lang/en_US.ts +81 -0
  194. package/src/lang/index.ts +35 -0
  195. package/src/lang/zh_CN.ts +84 -0
  196. package/src/main.ts +57 -0
  197. package/src/plugins/AblesPlugin.ts +618 -0
  198. package/src/plugins/registerCompPlugin.ts +15 -0
  199. package/src/sample/test.vue +9 -0
  200. package/src/store/ButtonPermission.ts +101 -0
  201. package/src/store/ConsumerView.ts +52 -0
  202. package/src/store/ContinusConfig.ts +78 -0
  203. package/src/store/CopyerOperation.ts +74 -0
  204. package/src/store/DesignForm.ts +481 -0
  205. package/src/store/DesignPage.ts +59 -0
  206. package/src/store/DynamicForm.ts +241 -0
  207. package/src/store/GlobalConfig.ts +90 -0
  208. package/src/store/SelfOperation.ts +95 -0
  209. package/src/store/UserInfo.ts +88 -0
  210. package/src/store/index.ts +6 -0
  211. package/src/theme/localStorge.ts +16 -0
  212. package/src/theme/theme.ts +27 -0
  213. package/src/utils/FieldOperationUtils.ts +91 -0
  214. package/src/utils/auth.ts +83 -0
  215. package/src/utils/message.ts +69 -0
  216. package/src/utils/preview.ts +125 -0
  217. package/tsconfig.json +39 -0
  218. package/tsconfig.node.json +10 -0
  219. package/vite-env.d.ts +16 -0
  220. package/vite.config.ts +162 -0
  221. package/yarn.lock +4627 -0
@@ -0,0 +1,358 @@
1
+ import { uuid } from "@/api/system";
2
+
3
+ /**
4
+ * 定义td 数据
5
+ */
6
+ export const colDataInfo = () => {
7
+ return { _uuid: uuid(), colspan: 1, rowspan: 1, items: [] };
8
+ };
9
+ /**
10
+ * 左方插入列
11
+ */
12
+ const insertLeftCol = (props: any) => {
13
+ const rows = props.parentField.preps.elements;
14
+ const position = props.isFirstCol ? 0 : props.colIndex - 1;
15
+ for (let index = 0; index < rows.length; index++) {
16
+ const cols = rows[index].columns;
17
+ cols.splice(position, 0, colDataInfo());
18
+ }
19
+ };
20
+ const insertRightCol = (props: any) => {
21
+ const rows = props.parentField.preps.elements;
22
+ const position = props.isLastCol ? props.colIndex : props.colIndex + 1;
23
+ for (let index = 0; index < rows.length; index++) {
24
+ const cols = rows[index].columns;
25
+ cols.splice(position, 0, colDataInfo());
26
+ }
27
+ };
28
+ const insertAboveRow = (props: any) => {
29
+ const rows = props.parentField.preps.elements;
30
+ let len = 1;
31
+ const cols: Array<any> = [];
32
+ for (let index = 0; index < rows.length; index++) {
33
+ const colLen = rows[index].columns.length;
34
+ if (colLen > len) {
35
+ len = colLen;
36
+ }
37
+ }
38
+ for (let i = 0; i < len; i++) {
39
+ cols.push(colDataInfo());
40
+ }
41
+ const position = props.isFirstRow ? 0 : props.rowIndex - 1;
42
+ rows.splice(position, 0, cols);
43
+ };
44
+ const insertBelowRow = (props: any) => {
45
+ const rows = props.parentField.preps.elements;
46
+ let len = 1;
47
+ const cols: Array<any> = [];
48
+ for (let index = 0; index < rows.length; index++) {
49
+ const colLen = rows[index].columns.length;
50
+ if (colLen > len) {
51
+ len = colLen;
52
+ }
53
+ }
54
+ for (let i = 0; i < len; i++) {
55
+ cols.push(colDataInfo());
56
+ }
57
+ const position = props.isLastRow ? props.rowIndex : props.rowIndex + 1;
58
+ rows.splice(position, 0, cols);
59
+ };
60
+ const tableCellInfo = (props: any) => {
61
+ const rows = props.parentField.preps.elements;
62
+ const row = rows[props.rowIndex];
63
+ const col = row.columns[props.colIndex];
64
+ return { rows, row, col };
65
+ };
66
+ const mergeLeftCol = (props: any) => {
67
+ const { row, col } = tableCellInfo(props);
68
+ col.colspan = col.colspan + 1;
69
+ row.columns.splice(props.colIndex - 1, 1);
70
+ };
71
+ const mergeRightCol = (props: any) => {
72
+ const { row, col } = tableCellInfo(props);
73
+ col.colspan = col.colspan + 1;
74
+ row.columns.splice(props.colIndex + 1, 1);
75
+ };
76
+ const mergeWholeCol = (props: any) => {
77
+ const { rows, col } = tableCellInfo(props);
78
+ // let currentCol: any = {};
79
+ for (const index in rows) {
80
+ const row1 = rows[index];
81
+ const cols = row1.columns;
82
+ for (const cIndex in cols) {
83
+ if (cIndex == props.colIndex) {
84
+ cols.splice(cIndex, 1);
85
+ }
86
+ }
87
+ }
88
+ col.rowspan = rows.length;
89
+ rows[0].columns.splice(props.colIndex, 0, col);
90
+ };
91
+ const mergeAboveRow = (props: any) => {
92
+ const { rows, row, col } = tableCellInfo(props);
93
+ const aboveRow = rows[props.rowIndex - 1];
94
+ col.rowspan = col.rowspan + 1;
95
+ for (const index in aboveRow.columns) {
96
+ if (index == props.colIndex) {
97
+ aboveRow.columns.splice(index, 1, col);
98
+ break;
99
+ }
100
+ }
101
+ for (const index in row.columns) {
102
+ if (index == props.colIndex) {
103
+ row.columns.splice(index, 1);
104
+ break;
105
+ }
106
+ }
107
+ };
108
+ const mergeBelowRow = (props: any) => {
109
+ const { rows, col } = tableCellInfo(props);
110
+ col.rowspan = col.rowspan + 1;
111
+ const belowRow = rows[props.rowIndex + 1];
112
+ for (const index in belowRow.columns) {
113
+ if (index == props.colIndex) {
114
+ belowRow.columns.splice(index, 1);
115
+ break;
116
+ }
117
+ }
118
+ };
119
+ const mergeWholeRow = (props: any) => {
120
+ const { row, col } = tableCellInfo(props);
121
+ let totalCols: number = 0;
122
+ for (const index in row.columns) {
123
+ const col = row.columns[index];
124
+ totalCols += col.colspan;
125
+ }
126
+ col.colspan = totalCols;
127
+ row.columns = [col];
128
+ };
129
+ /**
130
+ * 需要判断需要还原的周边数据
131
+ * @param props
132
+ */
133
+ const undoMergeRow = (props: any) => {
134
+ const { rows, row, col } = tableCellInfo(props);
135
+ if (row.columns.length == 1) {
136
+ //说明是合并了整行
137
+ col.colspan = col.colspan - 1;
138
+ row.columns.splice(props.colIndex, 0, colDataInfo());
139
+ } else {
140
+ col.rowspan = col.rowspan - 1;
141
+ row.columns.splice(props.colIndex, 1, colDataInfo());
142
+ rows[props.rowIndex + 1].columns.splice(props.colIndex, 0, col);
143
+ }
144
+ };
145
+ /**
146
+ * 需要判断要还原的周边数据
147
+ * @param props
148
+ */
149
+ const undoMergeCol = (props: any) => {
150
+ const { rows, row, col } = tableCellInfo(props);
151
+ //如果 列的行合并和整个表格的行相同,则表示已合并的整列
152
+ if (col.rowspan == rows.length) {
153
+ col.rowspan = col.rowspan - 1;
154
+ //在当前位置插入新的单元格
155
+ row.columns.splice(props.colIndex, 1, colDataInfo());
156
+ //将数据移入下一行
157
+ rows[props.rowIndex + 1].columns.splice(props.colIndex, 0, col);
158
+ } else {
159
+ //在同一行合并了单元格
160
+ col.colspan = col.colspan - 1;
161
+ row.columns.splice(props.colIndex, 0, colDataInfo());
162
+ }
163
+ };
164
+ /**
165
+ * 删除整列,在删除列的同时需要,考虑合并的情况,否则有可能导致整行被删除
166
+ * @param props
167
+ */
168
+ const deleteWholeCol = (props: any) => {
169
+ const rows = props.parentField.preps.elements;
170
+ for (const index in rows) {
171
+ const cols = rows[index].columns;
172
+ for (const sIndex in cols) {
173
+ if (props.colIndex == sIndex) {
174
+ cols.splice(sIndex, 1);
175
+ }
176
+ }
177
+ }
178
+ };
179
+ const deleteWholeRow = (props: any) => {
180
+ props.parentField.preps.elements.splice(props.rowIndex, 1);
181
+ };
182
+
183
+ /**
184
+ * 单元格操作方法
185
+ * @param command
186
+ * @param props
187
+ */
188
+ export const tableCellOperation = (command: string, props: any) => {
189
+ switch (command) {
190
+ case "insertLeftCol":
191
+ insertLeftCol(props);
192
+ break;
193
+ case "insertRightCol":
194
+ insertRightCol(props);
195
+ break;
196
+ case "insertAboveRow":
197
+ insertAboveRow(props);
198
+ break;
199
+ case "insertBelowRow":
200
+ insertBelowRow(props);
201
+ break;
202
+ case "mergeLeftCol":
203
+ mergeLeftCol(props);
204
+ break;
205
+ case "mergeRightCol":
206
+ mergeRightCol(props);
207
+ break;
208
+ case "mergeWholeCol":
209
+ mergeWholeCol(props);
210
+ break;
211
+ case "mergeAboveRow":
212
+ mergeAboveRow(props);
213
+ break;
214
+ case "mergeBelowRow":
215
+ mergeBelowRow(props);
216
+ break;
217
+ case "mergeWholeRow":
218
+ mergeWholeRow(props);
219
+ break;
220
+ case "undoMergeRow":
221
+ undoMergeRow(props);
222
+ break;
223
+ case "undoMergeCol":
224
+ undoMergeCol(props);
225
+ break;
226
+ case "deleteWholeCol":
227
+ deleteWholeCol(props);
228
+ break;
229
+ case "deleteWholeRow":
230
+ deleteWholeRow(props);
231
+ break;
232
+ case "colConfig":
233
+ console.log();
234
+ }
235
+ //操作单元格后再次调用控制按钮函数
236
+ // tableAction(props, buttonControl);
237
+ };
238
+ const mergeLeftColAction = (props: any) => {
239
+ const { row, col } = tableCellInfo(props);
240
+ if (!row || !row.columns?.length) {
241
+ return true;
242
+ }
243
+ const leftCol = row.columns[props.colIndex - 1];
244
+ return col.rowspan > 1 && leftCol
245
+ ? leftCol.rowspan != col.rowspan
246
+ : props.isFirstCol;
247
+ };
248
+ const mergeRightColAction = (props: any) => {
249
+ const { row, col } = tableCellInfo(props);
250
+ if (!row || !row.columns?.length) {
251
+ return true;
252
+ }
253
+ const rightCol = row.columns[props.colIndex + 1];
254
+ return col.rowspan > 1 && rightCol
255
+ ? rightCol.rowspan != col.rowspan
256
+ : props.isLastCol;
257
+ };
258
+ const mergeWholeColAction = (props: any) => {
259
+ return colCommonAction(props);
260
+ };
261
+ const mergeAboveRowAction = (props: any) => {
262
+ const { rows, col } = tableCellInfo(props);
263
+ const aboveRow = rows[props.rowIndex - 1];
264
+ if (!aboveRow || !aboveRow.columns.length) {
265
+ return true;
266
+ }
267
+ const aboveCol = aboveRow?.columns[props.colIndex];
268
+ if (!aboveCol || col.colspan != aboveCol.colspan) {
269
+ return true;
270
+ }
271
+ return props.isFirstRow;
272
+ };
273
+ const mergeBelowRowAction = (props: any) => {
274
+ const { rows, col } = tableCellInfo(props);
275
+ const belowRow = rows[props.rowIndex + 1];
276
+ if (!belowRow || !belowRow.columns?.length) {
277
+ return true;
278
+ }
279
+ const belowCol = belowRow?.columns[props.colIndex];
280
+ if (!belowCol || col.colspan != belowCol.colspan) {
281
+ return true;
282
+ }
283
+ return props.isLastRow;
284
+ };
285
+ const mergeWholeRowAction = (props: any) => {
286
+ return rowCommonAction(props);
287
+ };
288
+ const colCommonAction = (props: any) => {
289
+ const { rows, col } = tableCellInfo(props);
290
+ for (const index in rows) {
291
+ const tempRow = rows[index];
292
+ if (!tempRow || !tempRow.columns?.length) {
293
+ return true;
294
+ }
295
+ const tempCol = tempRow.columns[props.colIndex];
296
+ if (!tempCol || tempCol.colspan != col.colspan) {
297
+ // console.log(tempCol, col);
298
+ return true;
299
+ }
300
+ }
301
+ return false;
302
+ };
303
+ const rowCommonAction = (props: any) => {
304
+ const { row, col } = tableCellInfo(props);
305
+
306
+ for (const index in row.columns) {
307
+ const tempCol = row.columns[index];
308
+ if (col.rowspan != tempCol.rowspan) {
309
+ return true;
310
+ }
311
+ }
312
+ return false;
313
+ };
314
+ const deleteWholeColAction = (props: any) => {
315
+ return colCommonAction(props);
316
+ };
317
+ const deleteWholeRowAction = (props: any) => {
318
+ return rowCommonAction(props);
319
+ };
320
+ const undoMergeRowAction = (props: any) => {
321
+ const { rows, col } = tableCellInfo(props);
322
+ let columns: number = 0;
323
+ for (const index in rows) {
324
+ const len = rows[index].columns?.length;
325
+ if (columns < len) {
326
+ columns = len;
327
+ }
328
+ }
329
+ if (columns == col.colspan && col.colspan > 1) {
330
+ return false;
331
+ }
332
+ return props.field.rowspan == 1;
333
+ };
334
+ const undoMergeColAction = (props: any) => {
335
+ const { rows, col } = tableCellInfo(props);
336
+ // console.log(rows.length, col);
337
+ if (rows.length == col.rowspan && col.rowspan > 1) {
338
+ return false;
339
+ }
340
+ return props.field.colspan == 1;
341
+ };
342
+ /**
343
+ * 单元格按钮是否可点击控制
344
+ * @param props
345
+ * @param buttonControl 按钮控制
346
+ */
347
+ export const tableAction = (props: any, buttonControl: any) => {
348
+ buttonControl.mergeLeftColDisabled = mergeLeftColAction(props);
349
+ buttonControl.mergeRightColDisabled = mergeRightColAction(props);
350
+ buttonControl.mergeWholeColDisabled = mergeWholeColAction(props);
351
+ buttonControl.mergeAboveRowDisabled = mergeAboveRowAction(props);
352
+ buttonControl.mergeBelowRowDisabled = mergeBelowRowAction(props);
353
+ buttonControl.mergeWholeRowDisabled = mergeWholeRowAction(props);
354
+ buttonControl.deleteWholeColDisabled = deleteWholeColAction(props);
355
+ buttonControl.deleteWholeRowDisabled = deleteWholeRowAction(props);
356
+ buttonControl.undoMergeRowDisabled = undoMergeRowAction(props);
357
+ buttonControl.undoMergeColDisabled = undoMergeColAction(props);
358
+ };
@@ -0,0 +1,331 @@
1
+ <script setup lang="ts" name="GroupBoxContainer">
2
+ import { operationConfirm, warning } from "@/utils/message";
3
+ import piniaInstance from "@/store/index";
4
+ import { useDesignFormStore } from "@/store/DesignForm";
5
+ import { computed, ref } from "vue";
6
+ import { colDataInfo } from "@/components/formcomp/container/dytableUtils";
7
+ import { dynamicFormContextMenuData } from "@/plugins/AblesPlugin";
8
+ import FieldList from "@/components/formcomp/utils/FieldList.vue";
9
+ import StarHorseDialog from "@/components/comp/StarHorseDialog.vue";
10
+ import { fieldCopy } from "@/utils/FieldOperationUtils";
11
+
12
+ const props = defineProps({
13
+ isDesign: { type: Boolean, default: false },
14
+ disabled: { type: Boolean, default: false },
15
+ parentField: { type: Object },
16
+ formItem: { type: Object, required: true },
17
+ });
18
+ let designForm = useDesignFormStore(piniaInstance);
19
+ let compList = computed(() => designForm.compList);
20
+ let currentItemId = computed(() => designForm.currentItemId);
21
+ let componentVisible = computed(() => {
22
+ return (
23
+ designForm.componentVisible &&
24
+ currentItemId.value == props.formItem?.preps.id
25
+ );
26
+ });
27
+ let isEdit = computed(() => props.isDesign);
28
+ const selectData = () => {
29
+ let container = props.formItem;
30
+ designForm.selectItem(container, container?.itemType, "");
31
+ };
32
+ const removeData = () => {
33
+ operationConfirm("删除容器,容器内的所有元素都会被删除").then((res) => {
34
+ if (res) {
35
+ let id = props.formItem.preps?.id || props.formItem.id;
36
+ if (props.parentField?.itemType == "tab") {
37
+ let elements = props.parentField!.preps.elements;
38
+ for (let i = 0; i < elements.length; i++) {
39
+ let items = elements[i].items;
40
+ for (let j = 0; j < items.length; j++) {
41
+ if (id === items[j]?.id) {
42
+ items.splice(j, 1);
43
+ return;
44
+ }
45
+ }
46
+ }
47
+ } else if (props.parentField?.itemType == "box") {
48
+ } else {
49
+ let dataList = compList.value;
50
+ for (let i = 0; i < dataList.length; i++) {
51
+ if (id === dataList[i].id) {
52
+ dataList.splice(i, 1);
53
+ }
54
+ }
55
+ }
56
+ }
57
+ });
58
+ };
59
+ const containerContextMenuRef = ref();
60
+ const containerContextMenu = (evt: MouseEvent | any) => {
61
+ if (!isEdit.value) return;
62
+ evt.stopPropagation();
63
+ evt.preventDefault();
64
+ evt.props = props;
65
+ containerContextMenuRef.value?.show(evt);
66
+ };
67
+ const close = () => {
68
+ designForm.setComponentVisible(false);
69
+ };
70
+ const addItem = (item: any) => {
71
+ let type = item.category == 2 ? "container" : "formItem";
72
+ let data = fieldCopy(item, type);
73
+ let itemType = props.formItem.itemType;
74
+ let activeItemName = props.formItem.activeItemName;
75
+ let elements = props.formItem.preps.elements;
76
+ for (let index in elements) {
77
+ let element = elements[index];
78
+ if (activeItemName && activeItemName != element.tabName) {
79
+ continue;
80
+ }
81
+ let columns = element.columns;
82
+ if (!columns) {
83
+ let items = element.items;
84
+ if (itemType == "table") {
85
+ if (items.length == 0) {
86
+ items.push(data);
87
+ return;
88
+ }
89
+ } else {
90
+ items.push(data);
91
+ return;
92
+ }
93
+ }
94
+ for (let colIndex in columns) {
95
+ let col = columns[colIndex];
96
+ if (col.items.length == 0) {
97
+ col.items.push(data);
98
+ return;
99
+ }
100
+ }
101
+ }
102
+ };
103
+ const tableOperation = (actonName: string, _preps: any) => {
104
+ let preps = props.formItem.preps;
105
+ if (!preps.elements) {
106
+ preps["elements"] = [];
107
+ }
108
+ let isBox = props.formItem.itemType == "box";
109
+ if (actonName == "insertRow") {
110
+ //获取最大的数字
111
+ let rows: Array<any> = preps.elements;
112
+ if (rows.length > 0) {
113
+ let columns: Array<any> = [];
114
+ let len: number = 1;
115
+ for (let index in rows) {
116
+ let colLen = rows[index]?.columns?.length;
117
+ if (colLen > len) {
118
+ len = colLen;
119
+ }
120
+ }
121
+ for (let i = 0; i < len; i++) {
122
+ let col = colDataInfo();
123
+ if (isBox) {
124
+ col.colspan = 24 / len;
125
+ }
126
+ columns.push(col);
127
+ }
128
+ preps.elements.push({
129
+ columns: columns,
130
+ });
131
+ } else {
132
+ let col = colDataInfo();
133
+ if (isBox) {
134
+ col.colspan = 24;
135
+ }
136
+ preps.elements.push({
137
+ columns: [],
138
+ });
139
+ }
140
+ } else if (actonName == "insertCol") {
141
+ if (props.formItem.itemType == "table") {
142
+ preps.columns = (preps.columns || 1) + 1;
143
+ return;
144
+ }
145
+ for (let index in preps.elements) {
146
+ let row: any = preps.elements[index];
147
+ if (!row.columns) {
148
+ row["columns"] = [];
149
+ }
150
+ let col = colDataInfo();
151
+ if (isBox) {
152
+ col.colspan = 24 / (row.columns.length + 1);
153
+ row.columns.forEach((item: any) => {
154
+ item.colspan = col.colspan;
155
+ });
156
+ }
157
+ row.columns.push(col);
158
+ }
159
+ } else if (actonName == "copy") {
160
+ //拷贝容器
161
+ warning("功能开发中");
162
+ }
163
+ };
164
+ </script>
165
+ <template>
166
+ <star-horse-dialog
167
+ box-width="450px"
168
+ :is-view="true"
169
+ :full-screen="false"
170
+ title="添加组件"
171
+ :self-func="true"
172
+ :dialog-visible="componentVisible"
173
+ @closeAction="close"
174
+ >
175
+ <template #footer>
176
+ <el-button type="primary" size="default" @click="close">确定</el-button>
177
+ </template>
178
+ <field-list @selectData="addItem" />
179
+ </star-horse-dialog>
180
+ <div
181
+ class="field-item"
182
+ v-if="isEdit && isDesign"
183
+ @contextmenu="containerContextMenu"
184
+ >
185
+ <slot></slot>
186
+ <div
187
+ class="drag-handler"
188
+ v-if="isEdit && isDesign && currentItemId == formItem.id"
189
+ >
190
+ <el-tooltip content="拖动">
191
+ <star-horse-icon
192
+ icon-class="drag"
193
+ size="18px"
194
+ style="color: var(--star-horse-white)"
195
+ />
196
+ </el-tooltip>
197
+ <el-tooltip content="选中容器">
198
+ <star-horse-icon
199
+ cursor="pointer"
200
+ @click.stop="selectData"
201
+ icon-class="select-parent"
202
+ style="color: var(--star-horse-white)"
203
+ />
204
+ </el-tooltip>
205
+ <el-tooltip content="删除容器">
206
+ <star-horse-icon
207
+ cursor="pointer"
208
+ @click.stop="removeData"
209
+ icon-class="clear-all"
210
+ style="color: var(--star-horse-white)"
211
+ />
212
+ </el-tooltip>
213
+ </div>
214
+ <div
215
+ class="field-action"
216
+ v-if="isEdit && isDesign && currentItemId == formItem.id"
217
+ >
218
+ <template
219
+ v-if="formItem.itemType == 'dytable' || formItem.itemType == 'box'"
220
+ >
221
+ <el-tooltip content="插入行">
222
+ <star-horse-icon
223
+ @click.stop="tableOperation('insertRow', formItem?.preps)"
224
+ icon-class="insert_row"
225
+ cursor="pointer"
226
+ style="color: var(--star-horse-white)"
227
+ />
228
+ </el-tooltip>
229
+ </template>
230
+ <template
231
+ v-if="
232
+ formItem.itemType == 'dytable' ||
233
+ formItem.itemType == 'box' ||
234
+ formItem.itemType == 'table'
235
+ "
236
+ >
237
+ <el-tooltip content="插入列">
238
+ <star-horse-icon
239
+ @click.stop="tableOperation('insertCol', formItem?.preps)"
240
+ icon-class="insert_col"
241
+ cursor="pointer"
242
+ style="color: var(--star-horse-white)"
243
+ />
244
+ </el-tooltip>
245
+ </template>
246
+ <el-tooltip content="复制容器">
247
+ <star-horse-icon
248
+ @click.stop="tableOperation('copy', formItem?.preps)"
249
+ icon-class="copy"
250
+ style="color: var(--star-horse-white)"
251
+ />
252
+ </el-tooltip>
253
+ </div>
254
+ <Teleport to="body">
255
+ <ContentMenu
256
+ ref="containerContextMenuRef"
257
+ :menu-data="
258
+ dynamicFormContextMenuData(formItem, parentField, 'container')
259
+ "
260
+ />
261
+ </Teleport>
262
+ </div>
263
+ <div class="field-item" style="border: unset" v-else>
264
+ <slot></slot>
265
+ </div>
266
+ </template>
267
+ <style lang="scss" scoped>
268
+ .field-item {
269
+ border: 1px dashed #e6a23c;
270
+ }
271
+
272
+ .el-form-item {
273
+ position: relative;
274
+
275
+ :deep(.el-form-item__label) {
276
+ white-space: nowrap;
277
+ text-overflow: ellipsis;
278
+ }
279
+
280
+ span.custom-label .icon-cls {
281
+ margin: 0 3px;
282
+ }
283
+
284
+ :deep(.hide-spin-button) input::-webkit-outer-spin-button,
285
+ :deep(.hide-spin-button) input::-webkit-inner-spin-button {
286
+ -webkit-appearance: none !important;
287
+ }
288
+
289
+ :deep(.hide-spin-button) input[type="number"] {
290
+ -moz-appearance: textfield;
291
+ }
292
+ }
293
+
294
+ .required :deep(.el-form-item__label)::before {
295
+ content: "*";
296
+ color: #f56c6c;
297
+ margin-right: 4px;
298
+ }
299
+
300
+ .static-content-item {
301
+ min-height: 20px;
302
+ display: flex;
303
+ /* 垂直居中 */
304
+ align-items: center;
305
+
306
+ /* 垂直居中 */
307
+ :deep(.el-divider--horizontal) {
308
+ margin: 0;
309
+ }
310
+ }
311
+
312
+ .el-form-item.selected,
313
+ .static-content-item.selected {
314
+ outline: 2px solid var(--star-horse-style);
315
+ }
316
+
317
+ :deep(.label-left-align) .el-form-item__label {
318
+ text-align: left;
319
+ justify-content: flex-start !important;
320
+ }
321
+
322
+ :deep(.label-center-align) .el-form-item__label {
323
+ text-align: center;
324
+ justify-content: center !important;
325
+ }
326
+
327
+ :deep(.label-right-align) .el-form-item__label {
328
+ text-align: right;
329
+ justify-content: flex-end !important;
330
+ }
331
+ </style>
@@ -0,0 +1,6 @@
1
+ export { default as boxContainer } from "./box-container.vue";
2
+ export { default as cardContainer } from "./card-container.vue";
3
+ export { default as collapseContainer } from "./collapse-container.vue";
4
+ export { default as dytableContainer } from "./dytable-container.vue";
5
+ export { default as tabContainer } from "./tab-container.vue";
6
+ export { default as tableContainer } from "./table-container.vue";