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.
- package/.env.development +3 -0
- package/.env.production +3 -0
- package/.eslintrc-auto-import.json +77 -0
- package/.gitignore +27 -0
- package/.idea/.gitignore +5 -0
- package/.idea/MarsCodeWorkspaceAppSettings.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/testcode.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/watcherTasks.xml +4 -0
- package/.idea/workspace.xml +207 -0
- package/.npmignore +21 -0
- package/.prettierignore +26 -0
- package/README.md +2 -0
- package/auto-imports.d.ts +137 -0
- package/components.d.ts +189 -0
- package/dist/assets/index.css +1 -1
- package/dist/index.es.js +941 -720
- package/dist/types/index.d.ts +8 -8
- package/eslint.config.js +37 -0
- package/index.html +14 -0
- package/package-lock.json +8276 -0
- package/package.json +6 -6
- package/prettier.config.js +20 -0
- package/public/logo.svg +660 -0
- package/src/App.vue +11 -0
- package/src/api/date_utils.ts +219 -0
- package/src/api/finger_utils.ts +71 -0
- package/src/api/form_utils.ts +281 -0
- package/src/api/jquery.min.js +2 -0
- package/src/api/pcas-code.json +1 -0
- package/src/api/settings.ts +81 -0
- package/src/api/star_horse_apis.ts +196 -0
- package/src/api/star_horse_utils.ts +797 -0
- package/src/api/system.ts +351 -0
- package/src/api/user_func.ts +147 -0
- package/src/api/valid_utils.ts +165 -0
- package/src/assets/css/index.scss +908 -0
- package/src/assets/icons.css +574 -0
- package/src/assets/star-horse-icons.woff +0 -0
- package/src/components/comp/ShDynamicForm.vue +160 -0
- package/src/components/comp/ShForm.vue +30 -0
- package/src/components/comp/ShTableListColumn.vue +61 -0
- package/src/components/comp/StarHorseDataSelector.vue +139 -0
- package/src/components/comp/StarHorseDataView.vue +110 -0
- package/src/components/comp/StarHorseDataViewItems.vue +61 -0
- package/src/components/comp/StarHorseDataViewTable.vue +102 -0
- package/src/components/comp/StarHorseDialog.vue +383 -0
- package/src/components/comp/StarHorseDraggable.vue +401 -0
- package/src/components/comp/StarHorseForm.vue +458 -0
- package/src/components/comp/StarHorseFormItem.vue +82 -0
- package/src/components/comp/StarHorseFormList.vue +516 -0
- package/src/components/comp/StarHorseFormTable.vue +56 -0
- package/src/components/comp/StarHorseIcon.vue +76 -0
- package/src/components/comp/StarHorseItem.vue +302 -0
- package/src/components/comp/StarHorseJsonEditor.vue +115 -0
- package/src/components/comp/StarHorsePopover.vue +66 -0
- package/src/components/comp/StarHorseSearchComp.vue +253 -0
- package/src/components/comp/StarHorseStaticTable.vue +395 -0
- package/src/components/comp/StarHorseTableColumn.vue +249 -0
- package/src/components/comp/StarHorseTableComp.vue +1193 -0
- package/src/components/comp/StarHorseTableViewColumn.vue +61 -0
- package/src/components/comp/StarHorseTree.vue +494 -0
- package/src/components/comp/index.ts +22 -0
- package/src/components/comp/items/UTableColumn.vue +65 -0
- package/src/components/comp/items/boxItem.vue +98 -0
- package/src/components/comp/items/callitem.ts +9 -0
- package/src/components/comp/items/cardItem.vue +152 -0
- package/src/components/comp/items/collapseItem.vue +134 -0
- package/src/components/comp/items/dytableItem.vue +135 -0
- package/src/components/comp/items/otherItem.vue +65 -0
- package/src/components/comp/items/tabItem.vue +155 -0
- package/src/components/comp/items/tabPanelItem.vue +110 -0
- package/src/components/comp/items/tableColumn.vue +129 -0
- package/src/components/comp/items/tableItem.vue +97 -0
- package/src/components/comp/items/tablebtn.vue +158 -0
- package/src/components/comp/items/viewBoxItem.vue +55 -0
- package/src/components/comp/items/viewCardItem.vue +47 -0
- package/src/components/comp/items/viewCollapseItem.vue +71 -0
- package/src/components/comp/items/viewDytableItem.vue +77 -0
- package/src/components/comp/items/viewOtherItem.vue +55 -0
- package/src/components/comp/items/viewTabItem.vue +77 -0
- package/src/components/comp/items/viewTabPanelItem.vue +54 -0
- package/src/components/comp/items/viewTableItem.vue +74 -0
- package/src/components/comp/selfcomp.ts +9 -0
- package/src/components/comp/utils/DataPicker.vue +302 -0
- package/src/components/comp/utils/DataTag.vue +51 -0
- package/src/components/cron/Crontab-Day.vue +230 -0
- package/src/components/cron/Crontab-Hour.vue +165 -0
- package/src/components/cron/Crontab-Min.vue +166 -0
- package/src/components/cron/Crontab-Month.vue +166 -0
- package/src/components/cron/Crontab-Result.vue +615 -0
- package/src/components/cron/Crontab-Second.vue +185 -0
- package/src/components/cron/Crontab-Week.vue +208 -0
- package/src/components/cron/Crontab-Year.vue +183 -0
- package/src/components/cron/Crontab.vue +474 -0
- package/src/components/enums/ModuleEnums.ts +10 -0
- package/src/components/enums/ServiceEnums.ts +18 -0
- package/src/components/formcomp/container/box-container.vue +162 -0
- package/src/components/formcomp/container/callitem.ts +9 -0
- package/src/components/formcomp/container/card-container.vue +170 -0
- package/src/components/formcomp/container/collapse-container.vue +133 -0
- package/src/components/formcomp/container/dytable-col.vue +448 -0
- package/src/components/formcomp/container/dytable-container.vue +57 -0
- package/src/components/formcomp/container/dytableUtils.ts +358 -0
- package/src/components/formcomp/container/group-box-container.vue +331 -0
- package/src/components/formcomp/container/index.ts +6 -0
- package/src/components/formcomp/container/tab-container.vue +153 -0
- package/src/components/formcomp/container/table-container.vue +249 -0
- package/src/components/formcomp/items/allitem.ts +9 -0
- package/src/components/formcomp/items/area-item.vue +116 -0
- package/src/components/formcomp/items/audio-item.vue +163 -0
- package/src/components/formcomp/items/autocomplete-item.vue +118 -0
- package/src/components/formcomp/items/barcode-item.vue +87 -0
- package/src/components/formcomp/items/base-json-item.vue +207 -0
- package/src/components/formcomp/items/button-item.vue +228 -0
- package/src/components/formcomp/items/cascade-item.vue +113 -0
- package/src/components/formcomp/items/checkbox-item.vue +97 -0
- package/src/components/formcomp/items/color-item.vue +70 -0
- package/src/components/formcomp/items/cron-item.vue +115 -0
- package/src/components/formcomp/items/datetime-item.vue +99 -0
- package/src/components/formcomp/items/depart-item.vue +51 -0
- package/src/components/formcomp/items/dialog-input-item.vue +207 -0
- package/src/components/formcomp/items/divider-item.vue +66 -0
- package/src/components/formcomp/items/html-item.vue +65 -0
- package/src/components/formcomp/items/htmleditor-item.vue +104 -0
- package/src/components/formcomp/items/icon-item.vue +195 -0
- package/src/components/formcomp/items/image-item.vue +247 -0
- package/src/components/formcomp/items/index.ts +44 -0
- package/src/components/formcomp/items/input-item.vue +150 -0
- package/src/components/formcomp/items/json-array-item.vue +67 -0
- package/src/components/formcomp/items/json-item.vue +66 -0
- package/src/components/formcomp/items/markdown-item.vue +77 -0
- package/src/components/formcomp/items/number-item.vue +94 -0
- package/src/components/formcomp/items/number-range-item.vue +278 -0
- package/src/components/formcomp/items/page-select-item.vue +407 -0
- package/src/components/formcomp/items/password-item.vue +71 -0
- package/src/components/formcomp/items/qrcode-item.vue +84 -0
- package/src/components/formcomp/items/radio-item.vue +112 -0
- package/src/components/formcomp/items/rate-item.vue +68 -0
- package/src/components/formcomp/items/select-item.vue +133 -0
- package/src/components/formcomp/items/signature-item.vue +216 -0
- package/src/components/formcomp/items/slider-item.vue +68 -0
- package/src/components/formcomp/items/starhorse-form-item.vue +334 -0
- package/src/components/formcomp/items/switch-item.vue +77 -0
- package/src/components/formcomp/items/tag-item.vue +77 -0
- package/src/components/formcomp/items/text-item.vue +75 -0
- package/src/components/formcomp/items/textarea-item.vue +85 -0
- package/src/components/formcomp/items/time-item.vue +77 -0
- package/src/components/formcomp/items/time-picker-item.vue +74 -0
- package/src/components/formcomp/items/transfer-item.vue +93 -0
- package/src/components/formcomp/items/tselect-item.vue +121 -0
- package/src/components/formcomp/items/unknown-item.vue +51 -0
- package/src/components/formcomp/items/upload-item.vue +189 -0
- package/src/components/formcomp/items/user-item.vue +177 -0
- package/src/components/formcomp/items/usercomp-item.vue +85 -0
- package/src/components/formcomp/items/view-markdown-item.vue +77 -0
- package/src/components/formcomp/utils/EditDataDialog.vue +67 -0
- package/src/components/formcomp/utils/FieldList.vue +125 -0
- package/src/components/formcomp/utils/ItemRelationEventUtils.ts +284 -0
- package/src/components/help.vue +31 -0
- package/src/components/menu/MenuItem.vue +95 -0
- package/src/components/menu/SubMenu.vue +68 -0
- package/src/components/menu/SubSystemMenu.vue +142 -0
- package/src/components/register.ts +24 -0
- package/src/components/system/ContentMenu.vue +260 -0
- package/src/components/system/StarHorseButtonList.vue +344 -0
- package/src/components/system/StarHorseMenu.vue +97 -0
- package/src/components/system/StarHorseSvg.vue +62 -0
- package/src/components/system/SystemComp.ts +9 -0
- package/src/components/system/index.ts +4 -0
- package/src/components/types/ApiUrls.ts +168 -0
- package/src/components/types/BtnAction.ts +51 -0
- package/src/components/types/BtnAuth.ts +43 -0
- package/src/components/types/CompInfo.ts +81 -0
- package/src/components/types/DialogProps.ts +55 -0
- package/src/components/types/DyCompField.ts +23 -0
- package/src/components/types/DynamicNode.ts +42 -0
- package/src/components/types/MenusInfo.ts +45 -0
- package/src/components/types/PageFieldInfo.ts +530 -0
- package/src/components/types/PageProps.ts +25 -0
- package/src/components/types/Params.ts +93 -0
- package/src/components/types/RuleType.ts +10 -0
- package/src/components/types/SearchProps.ts +42 -0
- package/src/components/types/ShortKey.ts +30 -0
- package/src/components/types/StarHorseType.ts +18 -0
- package/src/components/types/index.ts +15 -0
- package/src/config/element.ts +15 -0
- package/src/config/styles.ts +4 -0
- package/src/index.ts +98 -0
- package/src/install.ts +33 -0
- package/src/lang/en_US.ts +81 -0
- package/src/lang/index.ts +35 -0
- package/src/lang/zh_CN.ts +84 -0
- package/src/main.ts +57 -0
- package/src/plugins/AblesPlugin.ts +618 -0
- package/src/plugins/registerCompPlugin.ts +15 -0
- package/src/sample/test.vue +9 -0
- package/src/store/ButtonPermission.ts +101 -0
- package/src/store/ConsumerView.ts +52 -0
- package/src/store/ContinusConfig.ts +78 -0
- package/src/store/CopyerOperation.ts +74 -0
- package/src/store/DesignForm.ts +481 -0
- package/src/store/DesignPage.ts +59 -0
- package/src/store/DynamicForm.ts +241 -0
- package/src/store/GlobalConfig.ts +90 -0
- package/src/store/SelfOperation.ts +95 -0
- package/src/store/UserInfo.ts +88 -0
- package/src/store/index.ts +6 -0
- package/src/theme/localStorge.ts +16 -0
- package/src/theme/theme.ts +27 -0
- package/src/utils/FieldOperationUtils.ts +91 -0
- package/src/utils/auth.ts +83 -0
- package/src/utils/message.ts +69 -0
- package/src/utils/preview.ts +125 -0
- package/tsconfig.json +39 -0
- package/tsconfig.node.json +10 -0
- package/vite-env.d.ts +16 -0
- package/vite.config.ts +162 -0
- package/yarn.lock +4627 -0
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
import { useCopyerOperationStore } from "@/store/CopyerOperation";
|
|
2
|
+
import piniaInstance from "@/store";
|
|
3
|
+
import { computed, reactive, ref } from "vue";
|
|
4
|
+
import { useDesignFormStore } from "@/store/DesignForm";
|
|
5
|
+
import { uuid } from "@/api/system";
|
|
6
|
+
import { DynamicNode } from "@/components/types/DynamicNode";
|
|
7
|
+
import { useDesignPageStore } from "@/store/DesignPage";
|
|
8
|
+
|
|
9
|
+
const copyerAction = useCopyerOperationStore(piniaInstance);
|
|
10
|
+
const designForm = useDesignFormStore(piniaInstance);
|
|
11
|
+
const designPage = useDesignPageStore(piniaInstance);
|
|
12
|
+
const compList = computed(() => designForm.compList);
|
|
13
|
+
const currentItemId = computed(() => designForm.currentItemId);
|
|
14
|
+
const pasteDisplay = computed(() => {
|
|
15
|
+
const action = copyerAction.action;
|
|
16
|
+
return !!action;
|
|
17
|
+
});
|
|
18
|
+
export function getParentComp(parentField: any) {
|
|
19
|
+
return parentField &&
|
|
20
|
+
(parentField.itemType == "box" ||
|
|
21
|
+
parentField.itemType == "tab" ||
|
|
22
|
+
parentField.itemType == "dytable" ||
|
|
23
|
+
parentField.itemType == "table")
|
|
24
|
+
? "container"
|
|
25
|
+
: "item";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 选中组件
|
|
30
|
+
* @param index
|
|
31
|
+
* @param currentItems
|
|
32
|
+
* @param elements
|
|
33
|
+
* @param parentType
|
|
34
|
+
*/
|
|
35
|
+
const selectItem = (
|
|
36
|
+
index: number,
|
|
37
|
+
currentItems: Array<any>,
|
|
38
|
+
elements: Array<any>,
|
|
39
|
+
parentType: string,
|
|
40
|
+
) => {
|
|
41
|
+
let item: any = {};
|
|
42
|
+
if (currentItems.length > 0) {
|
|
43
|
+
item = currentItems[currentItems.length - 1];
|
|
44
|
+
} else {
|
|
45
|
+
const element = elements[index - 1] || elements[0];
|
|
46
|
+
item = element?.items[element.items?.length - 1];
|
|
47
|
+
}
|
|
48
|
+
if (item && Object.keys(item).length > 0) {
|
|
49
|
+
designForm.selectItem(item, item.itemType, parentType);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 从舞台删除组件
|
|
55
|
+
* @param isEdit
|
|
56
|
+
* @param formItem
|
|
57
|
+
* @param parentField
|
|
58
|
+
*/
|
|
59
|
+
export function removeItem(isEdit: boolean, formItem: any, parentField: any) {
|
|
60
|
+
if (!isEdit) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const parentItemType = parentField?.itemType;
|
|
64
|
+
const dataList = compList.value;
|
|
65
|
+
if (
|
|
66
|
+
parentItemType == "tab" ||
|
|
67
|
+
parentItemType == "table" ||
|
|
68
|
+
parentItemType == "card" ||
|
|
69
|
+
parentItemType == "collapse"
|
|
70
|
+
) {
|
|
71
|
+
const elements = parentField!.preps.elements;
|
|
72
|
+
for (let i = 0; i < elements.length; i++) {
|
|
73
|
+
const items = elements[i].items;
|
|
74
|
+
for (let j = 0; j < items.length; j++) {
|
|
75
|
+
if (formItem.id === items[j]?.id) {
|
|
76
|
+
items.splice(j, 1);
|
|
77
|
+
selectItem(i, items, elements, parentItemType);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} else if (parentItemType == "box" || parentItemType == "dytable") {
|
|
83
|
+
const elements = parentField!.preps.elements;
|
|
84
|
+
for (const index in elements) {
|
|
85
|
+
const sdataTemp = elements[index];
|
|
86
|
+
if (sdataTemp.columns.length > 0) {
|
|
87
|
+
for (let i = 0; i < sdataTemp.columns.length; i++) {
|
|
88
|
+
const items = sdataTemp.columns[i].items;
|
|
89
|
+
for (let j = 0; j < items.length; j++) {
|
|
90
|
+
if (formItem.id === items[j].id) {
|
|
91
|
+
items.splice(j, 1);
|
|
92
|
+
selectItem(i, items, sdataTemp.columns, parentItemType);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
for (let i = 0; i < dataList.length; i++) {
|
|
101
|
+
if (formItem.id === dataList[i].id) {
|
|
102
|
+
const item = dataList[i - 1] || dataList[0];
|
|
103
|
+
dataList.splice(i, 1);
|
|
104
|
+
if (item && Object.keys(item).length > 0) {
|
|
105
|
+
designForm.selectItem(item, item.itemType, parentItemType);
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 上移组件
|
|
115
|
+
* @param formItem
|
|
116
|
+
* @param parentField
|
|
117
|
+
*/
|
|
118
|
+
export function moveUpItem(isEdit: boolean, formItem: any, parentField: any) {
|
|
119
|
+
if (!isEdit) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
//这个数据解析好麻烦
|
|
123
|
+
const dataList = compList.value;
|
|
124
|
+
if (parentField?.itemType == "tab") {
|
|
125
|
+
const elements = parentField!.preps.elements;
|
|
126
|
+
for (let i = 0; i < elements.length; i++) {
|
|
127
|
+
const items = elements[i].items;
|
|
128
|
+
for (let j = 0; j < items.length; j++) {
|
|
129
|
+
if (formItem.id === items[j]?.id && j > 0) {
|
|
130
|
+
const temp = items[j];
|
|
131
|
+
items[j] = items[j - 1];
|
|
132
|
+
items[j - 1] = temp;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} else if (parentField?.itemType == "box") {
|
|
138
|
+
}
|
|
139
|
+
const compType = getParentComp(parentField);
|
|
140
|
+
if (compType === "item") {
|
|
141
|
+
for (let i = 0; i < dataList.length; i++) {
|
|
142
|
+
if (formItem.id === dataList[i].id && i > 0) {
|
|
143
|
+
const temp = dataList[i];
|
|
144
|
+
dataList[i] = dataList[i - 1];
|
|
145
|
+
dataList[i - 1] = temp;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
for (let i = 0; i < dataList.length; i++) {
|
|
151
|
+
const dataTemp = dataList[i];
|
|
152
|
+
if (dataTemp.compType !== "container") {
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
const elements = dataTemp.preps.elements;
|
|
156
|
+
for (const index in elements) {
|
|
157
|
+
const sdataTemp = elements[index];
|
|
158
|
+
if (sdataTemp.columns.length > 0) {
|
|
159
|
+
for (let i = 0; i < sdataTemp.columns.length; i++) {
|
|
160
|
+
const items = sdataTemp.columns[i].items;
|
|
161
|
+
for (let j = 0; j < items.length; j++) {
|
|
162
|
+
if (formItem.id === items[j].id && j > 0) {
|
|
163
|
+
const temp = items[j];
|
|
164
|
+
items[j] = items[j - 1];
|
|
165
|
+
items[j - 1] = temp;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function moveDownItem(isEdit: boolean, formItem: any, parentField: any) {
|
|
177
|
+
if (!isEdit) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const dataList = compList.value;
|
|
181
|
+
if (parentField?.itemType == "tab") {
|
|
182
|
+
const elements = parentField!.preps.elements;
|
|
183
|
+
for (let i = 0; i < elements.length; i++) {
|
|
184
|
+
const items = elements[i].items;
|
|
185
|
+
for (let j = 0; j < items.length; j++) {
|
|
186
|
+
if (formItem.id === items[j]?.id && j < items.length - 1) {
|
|
187
|
+
const temp = items[j];
|
|
188
|
+
items[j] = items[j + 1];
|
|
189
|
+
items[j + 1] = temp;
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
} else if (parentField?.itemType == "box") {
|
|
195
|
+
}
|
|
196
|
+
const compType = getParentComp(parentField);
|
|
197
|
+
if (compType === "item") {
|
|
198
|
+
for (let i = 0; i < dataList.length; i++) {
|
|
199
|
+
if (formItem.id === dataList[i].id && i < dataList.length - 1) {
|
|
200
|
+
const temp = dataList[i];
|
|
201
|
+
dataList[i] = dataList[i + 1];
|
|
202
|
+
dataList[i + 1] = temp;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
for (let i = 0; i < dataList.length; i++) {
|
|
208
|
+
const dataTemp = dataList[i];
|
|
209
|
+
if (dataTemp.compType !== "container") {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
const elements = dataTemp.preps.elements;
|
|
213
|
+
for (const index in elements) {
|
|
214
|
+
const sdataTemp = elements[index];
|
|
215
|
+
if (sdataTemp.columns.length > 0) {
|
|
216
|
+
for (let i = 0; i < sdataTemp.columns.length; i++) {
|
|
217
|
+
const items = sdataTemp.columns[i].items;
|
|
218
|
+
for (let j = 0; j < items.length; j++) {
|
|
219
|
+
if (formItem.id === items[j].id && j < items.length - 1) {
|
|
220
|
+
const temp = items[j];
|
|
221
|
+
items[j] = items[j + 1];
|
|
222
|
+
items[j + 1] = temp;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const fieldIndex = ref<number>(200);
|
|
234
|
+
const complexFields = (items: Array<any>, isCut: boolean = false) => {
|
|
235
|
+
for (const index in items) {
|
|
236
|
+
const item = items[index];
|
|
237
|
+
if (item.compType == "container") {
|
|
238
|
+
const sitems = item.preps.elements;
|
|
239
|
+
for (const sindex in sitems) {
|
|
240
|
+
complexFields(sitems[sindex].items);
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
item.id = uuid();
|
|
244
|
+
item["preps"]["id"] = item.id;
|
|
245
|
+
if (!isCut) {
|
|
246
|
+
fieldIndex.value++;
|
|
247
|
+
item.preps.name = item.preps.name + fieldIndex.value;
|
|
248
|
+
item.preps.label = item.preps.label + "(复制)";
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* 拷贝容器
|
|
255
|
+
* @param parentComp
|
|
256
|
+
* @param currentContainer
|
|
257
|
+
* @param isCut
|
|
258
|
+
*/
|
|
259
|
+
export const copyContainer = (
|
|
260
|
+
parentComp: Array<any>,
|
|
261
|
+
currentContainer: any,
|
|
262
|
+
isCut: boolean = false,
|
|
263
|
+
) => {
|
|
264
|
+
if (!currentContainer) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const containerType = currentContainer.itemType;
|
|
268
|
+
const container = JSON.parse(JSON.stringify(currentContainer));
|
|
269
|
+
container.id = uuid();
|
|
270
|
+
//box和dytable 有列属性
|
|
271
|
+
if (containerType == "box" || containerType == "dytable") {
|
|
272
|
+
const rows = container.preps.elements;
|
|
273
|
+
for (const index in rows) {
|
|
274
|
+
const row = rows[index];
|
|
275
|
+
for (const cIndex in row.columns) {
|
|
276
|
+
const col = row.columns[cIndex];
|
|
277
|
+
col._uuid = uuid();
|
|
278
|
+
col.id = col._uuid;
|
|
279
|
+
complexFields(col.items, isCut);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
} else {
|
|
283
|
+
const rows = container.preps.elements;
|
|
284
|
+
for (const index in rows) {
|
|
285
|
+
complexFields(rows[index].items, isCut);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
parentComp.push(container);
|
|
289
|
+
designForm.selectItem(container, containerType, "");
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* 操作接口
|
|
294
|
+
* @param act
|
|
295
|
+
* @param item
|
|
296
|
+
* @param parentItem
|
|
297
|
+
*/
|
|
298
|
+
export function contextOperation(act: string, item: any, parentItem: any) {
|
|
299
|
+
console.log(act, item, parentItem);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function cut(item: any, parentItem: any) {
|
|
303
|
+
copyerAction.operation("cut", parentItem, item);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export function copy(item: any, parentItem: any) {
|
|
307
|
+
copyerAction.operation("copy", parentItem, item);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export function paste(parentItem: any) {
|
|
311
|
+
let copyerData = copyerAction.copyerData;
|
|
312
|
+
if (!copyerData || Object.keys(copyerData).length == 0) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
if (parentItem && Object.keys(parentItem).length > 0) {
|
|
316
|
+
// let action = copyerAction.action;
|
|
317
|
+
copyContainer(parentItem!.preps?.elements, copyerData);
|
|
318
|
+
} else {
|
|
319
|
+
//拷贝容器
|
|
320
|
+
if (getParentComp(copyerData) == "container") {
|
|
321
|
+
const parentContainer = copyerAction.parentContainer;
|
|
322
|
+
copyContainer(
|
|
323
|
+
parentContainer ? parentContainer!.preps?.elements : compList.value,
|
|
324
|
+
copyerData,
|
|
325
|
+
);
|
|
326
|
+
} else {
|
|
327
|
+
copyerData = JSON.parse(JSON.stringify(copyerData));
|
|
328
|
+
copyerData.id = uuid();
|
|
329
|
+
copyerData.preps.id = copyerData.id;
|
|
330
|
+
compList.value.push(copyerData);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
*
|
|
337
|
+
* @param item
|
|
338
|
+
* @param parentItem
|
|
339
|
+
* @param flag scene 场景 container 容器 item 组件
|
|
340
|
+
* @param recall
|
|
341
|
+
*/
|
|
342
|
+
export function dynamicFormContextMenuData(
|
|
343
|
+
item: any,
|
|
344
|
+
parentItem: any,
|
|
345
|
+
flag: string = "scene",
|
|
346
|
+
recall?: Function,
|
|
347
|
+
) {
|
|
348
|
+
const menus = reactive<Array<any>>([]);
|
|
349
|
+
if (flag == "scene") {
|
|
350
|
+
menus.push({
|
|
351
|
+
type: "button",
|
|
352
|
+
text: "新建",
|
|
353
|
+
icon: "new",
|
|
354
|
+
display: true,
|
|
355
|
+
handler: () => {
|
|
356
|
+
if (recall) {
|
|
357
|
+
recall("new");
|
|
358
|
+
} else {
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
menus.push(
|
|
364
|
+
{
|
|
365
|
+
type: "button",
|
|
366
|
+
text: "剪切",
|
|
367
|
+
icon: "cut",
|
|
368
|
+
display: true,
|
|
369
|
+
handler: () => {
|
|
370
|
+
if (recall) {
|
|
371
|
+
recall("cut");
|
|
372
|
+
} else {
|
|
373
|
+
cut(item, parentItem);
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
type: "button",
|
|
379
|
+
text: "复制",
|
|
380
|
+
icon: "copy",
|
|
381
|
+
display: true,
|
|
382
|
+
handler: () => {
|
|
383
|
+
if (recall) {
|
|
384
|
+
recall("copy");
|
|
385
|
+
} else {
|
|
386
|
+
copy(item, parentItem);
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
type: "button",
|
|
392
|
+
text: "粘贴",
|
|
393
|
+
icon: "paste",
|
|
394
|
+
display: pasteDisplay,
|
|
395
|
+
handler: () => {
|
|
396
|
+
if (recall) {
|
|
397
|
+
recall("paste");
|
|
398
|
+
} else {
|
|
399
|
+
paste(parentItem);
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
type: "divider",
|
|
405
|
+
direction: "horizontal",
|
|
406
|
+
display: () => true,
|
|
407
|
+
},
|
|
408
|
+
);
|
|
409
|
+
if (flag == "scene") {
|
|
410
|
+
menus.push(
|
|
411
|
+
{
|
|
412
|
+
type: "button",
|
|
413
|
+
text: "全选",
|
|
414
|
+
icon: "select-all",
|
|
415
|
+
display: true,
|
|
416
|
+
handler: () => {
|
|
417
|
+
if (recall) {
|
|
418
|
+
recall("select-all");
|
|
419
|
+
} else {
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
type: "button",
|
|
425
|
+
text: "清空",
|
|
426
|
+
icon: "dustbin",
|
|
427
|
+
display: true,
|
|
428
|
+
handler: () => {
|
|
429
|
+
if (recall) {
|
|
430
|
+
recall("dustbin");
|
|
431
|
+
} else {
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
type: "divider",
|
|
437
|
+
direction: "horizontal",
|
|
438
|
+
display: true,
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
type: "button",
|
|
442
|
+
text: "预览",
|
|
443
|
+
icon: "preview",
|
|
444
|
+
display: true,
|
|
445
|
+
handler: () => {
|
|
446
|
+
if (recall) {
|
|
447
|
+
recall("preview");
|
|
448
|
+
} else {
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
if (flag == "container") {
|
|
455
|
+
menus.push({
|
|
456
|
+
type: "button",
|
|
457
|
+
text: "添加组件",
|
|
458
|
+
icon: "new",
|
|
459
|
+
display: true,
|
|
460
|
+
handler: () => {
|
|
461
|
+
designForm.setComponentVisible(true);
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
menus.push({
|
|
465
|
+
type: "button",
|
|
466
|
+
text: "选中容器",
|
|
467
|
+
icon: "select-parent",
|
|
468
|
+
display: currentItemId.value != item.id,
|
|
469
|
+
handler: () => {
|
|
470
|
+
designForm.selectItem(item, item?.itemType, "");
|
|
471
|
+
},
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
menus.push(
|
|
475
|
+
{
|
|
476
|
+
type: "button",
|
|
477
|
+
text: "撤销",
|
|
478
|
+
icon: "undo",
|
|
479
|
+
display: true,
|
|
480
|
+
handler: () => {
|
|
481
|
+
if (recall) {
|
|
482
|
+
recall("undo");
|
|
483
|
+
} else {
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
type: "divider",
|
|
489
|
+
direction: "horizontal",
|
|
490
|
+
display: true,
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
type: "button",
|
|
494
|
+
text: "删除",
|
|
495
|
+
icon: "delete",
|
|
496
|
+
display: () => true,
|
|
497
|
+
handler: () => {
|
|
498
|
+
if (recall) {
|
|
499
|
+
recall("delete");
|
|
500
|
+
} else {
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
type: "divider",
|
|
506
|
+
direction: "horizontal",
|
|
507
|
+
display: true,
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
type: "button",
|
|
511
|
+
text: "属性",
|
|
512
|
+
icon: "prep",
|
|
513
|
+
display: true,
|
|
514
|
+
handler: () => {
|
|
515
|
+
if (recall) {
|
|
516
|
+
recall("prep");
|
|
517
|
+
} else {
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
},
|
|
521
|
+
);
|
|
522
|
+
|
|
523
|
+
return menus;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
export function dynamicPageContextMenuData(node: DynamicNode) {
|
|
527
|
+
let contentMenuData: Array<any> = [];
|
|
528
|
+
contentMenuData = [
|
|
529
|
+
{
|
|
530
|
+
type: "button",
|
|
531
|
+
text: "水平居中",
|
|
532
|
+
icon: "center",
|
|
533
|
+
display: true,
|
|
534
|
+
handler: () => {},
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
type: "button",
|
|
538
|
+
text: "复制",
|
|
539
|
+
icon: "copy",
|
|
540
|
+
display: true,
|
|
541
|
+
handler: () => {
|
|
542
|
+
const temp = JSON.parse(JSON.stringify(node));
|
|
543
|
+
temp.id = uuid();
|
|
544
|
+
temp.name = temp.name + "复制";
|
|
545
|
+
designPage.addNode(temp);
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
type: "divider",
|
|
550
|
+
direction: "horizontal",
|
|
551
|
+
display: true,
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
type: "button",
|
|
555
|
+
text: "上移一层",
|
|
556
|
+
icon: "up-layer",
|
|
557
|
+
display: true,
|
|
558
|
+
handler: () => {
|
|
559
|
+
node.zIndex = (node.zIndex || 100) + 1;
|
|
560
|
+
},
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
type: "button",
|
|
564
|
+
text: "下移一层",
|
|
565
|
+
icon: "down-layer",
|
|
566
|
+
display: node.zIndex && node.zIndex > 100,
|
|
567
|
+
handler: () => {
|
|
568
|
+
node.zIndex = node.zIndex && node.zIndex > 100 ? node.zIndex - 1 : 100;
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
type: "button",
|
|
573
|
+
text: "置顶",
|
|
574
|
+
icon: "to-top",
|
|
575
|
+
display: true,
|
|
576
|
+
handler: () => {
|
|
577
|
+
node.zIndex = designPage.maxZIndex() + 1;
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
type: "button",
|
|
582
|
+
text: "置底",
|
|
583
|
+
icon: "to-bottom",
|
|
584
|
+
display: node.zIndex && node.zIndex > 100,
|
|
585
|
+
handler: () => {
|
|
586
|
+
node.zIndex = 100;
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
|
|
590
|
+
{
|
|
591
|
+
type: "divider",
|
|
592
|
+
direction: "horizontal",
|
|
593
|
+
display: true,
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
type: "button",
|
|
597
|
+
text: "删除",
|
|
598
|
+
icon: "delete",
|
|
599
|
+
display: true,
|
|
600
|
+
handler: () => {
|
|
601
|
+
designPage.removeNode(node.id);
|
|
602
|
+
},
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
type: "divider",
|
|
606
|
+
direction: "horizontal",
|
|
607
|
+
display: true,
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
type: "button",
|
|
611
|
+
icon: "empty_setting",
|
|
612
|
+
text: "清空参考线",
|
|
613
|
+
display: true,
|
|
614
|
+
handler: () => {},
|
|
615
|
+
},
|
|
616
|
+
];
|
|
617
|
+
return contentMenuData;
|
|
618
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineAsyncComponent } from "vue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 注册组件
|
|
5
|
+
* @param app app
|
|
6
|
+
* @param moduleName 模块名称
|
|
7
|
+
*/
|
|
8
|
+
const register = ({ app, moduleName }) => {
|
|
9
|
+
const items = import.meta.glob(`${moduleName}/*.vue`);
|
|
10
|
+
for (const [key, value] of Object.entries(items)) {
|
|
11
|
+
const name = key.slice(key.lastIndexOf("/") + 1, key.lastIndexOf("."));
|
|
12
|
+
app.component(name, defineAsyncComponent(value as any));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export { register };
|