@simitgroup/simpleapp-generator 1.6.6-y-alpha → 1.6.7-a-alpha
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/ReleaseNote.md +37 -9
- package/dist/framework.js +1 -1
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +4 -4
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/publish.sh +1 -0
- package/src/framework.ts +2 -2
- package/src/generate.ts +4 -4
- package/templates/basic/nuxt/resource-bridge.service.ts.eta +11 -2
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +3 -3
- package/templates/nest/src/simpleapp/services/webhook.service.ts._eta +1 -1
- package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +379 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +3 -3
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormField.vue.eta +100 -0
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormFieldInput.vue.eta +121 -0
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormSection.vue.eta +40 -0
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldMenuItem.vue.eta +37 -0
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldMenuItemBadge.vue.eta +25 -0
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormField.vue.eta +96 -0
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormFieldInput.vue.eta +150 -0
- package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormSection.vue.eta +38 -0
- package/templates/nuxt/simpleapp/generate/features/customField/composables/useCustomFieldDocList.ts.eta +48 -0
- package/templates/nuxt/simpleapp/generate/features/customField/enums/common.ts.eta +4 -0
- package/templates/nuxt/simpleapp/generate/features/customField/services/CustomFieldService.ts.eta +231 -0
- package/templates/nuxt/simpleapp/generate/features/customField/types/common.ts.eta +16 -0
- package/templates/nuxt/simpleapp/generate/features/customField/types/page.ts.eta +5 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppMenuButton.vue.eta +104 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPageIcon.vue.eta +20 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPageIframe.vue.eta +79 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPermissionWrapper.vue.eta +17 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppRestrictedWarning.vue.eta +25 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppSettingLayout.vue.eta +29 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppSettingPage.vue.eta +69 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppWrapper.vue.eta +39 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItem.vue.eta +48 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemBadge.vue.eta +31 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemGroup.vue.eta +34 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationPage.vue.eta +156 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/types/miniApp.ts.eta +25 -0
- package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/services/bridge-resource-accessor.service.ts.eta +3 -1
- package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/services/bridge.service.ts.eta +7 -4
- package/dist/buildinschemas/message.d.ts +0 -3
- package/dist/buildinschemas/message.d.ts.map +0 -1
- package/dist/buildinschemas/message.js +0 -34
- package/dist/buildinschemas/message.js.map +0 -1
- package/dist/buildinschemas/webhookhistory.d.ts +0 -3
- package/dist/buildinschemas/webhookhistory.d.ts.map +0 -1
- package/dist/buildinschemas/webhookhistory.js +0 -44
- package/dist/buildinschemas/webhookhistory.js.map +0 -1
- package/dist/createproject.js +0 -138
- package/dist/createproject.js.map +0 -1
- package/dist/generate-allow-changebackend.js +0 -305
- package/dist/generate-allow-changebackend.js.map +0 -1
- package/dist/index2.js +0 -118
- package/dist/index2.js.map +0 -1
- package/dist/installdependency.js +0 -20
- package/dist/installdependency.js.map +0 -1
- package/dist/installnest.js +0 -2
- package/dist/installnest.js.map +0 -1
- package/dist/installnuxt.js +0 -2
- package/dist/installnuxt.js.map +0 -1
- package/dist/processors/groupsbuilder.js +0 -2
- package/dist/processors/groupsbuilder.js.map +0 -1
- package/dist/schematype/baseschema.js +0 -25
- package/dist/schematype/baseschema.js.map +0 -1
- package/dist/schematype/default.js +0 -2
- package/dist/schematype/default.js.map +0 -1
- package/dist/schematype/index.js +0 -12
- package/dist/schematype/index.js.map +0 -1
- package/dist/schematype/primarymasterdata.js +0 -38
- package/dist/schematype/primarymasterdata.js.map +0 -1
- package/dist/schematype/simple.js +0 -24
- package/dist/schematype/simple.js.map +0 -1
- package/dist/schematype/simplemasterdata.js +0 -31
- package/dist/schematype/simplemasterdata.js.map +0 -1
- package/dist/schematype/transaction.js +0 -74
- package/dist/schematype/transaction.js.map +0 -1
- package/templates/nest/src/simpleapp/types/customfield.ts.eta +0 -14
- package/templates/nuxt/plugins/19.app-plugins.ts.eta +0 -422
- /package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/constants/common.constant.ts.eta +0 -0
- /package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/constants/resource.constant.ts.eta +0 -0
- /package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/types/bridge.type.ts.eta +0 -0
- /package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/types/resource-mapper.type.ts.eta +0 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2025-06-09
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import _ from "lodash";
|
|
8
|
+
import {
|
|
9
|
+
Miniapp,
|
|
10
|
+
MiniAppDetail,
|
|
11
|
+
MiniAppDetailActionAccess,
|
|
12
|
+
MiniappIntegrationPages,
|
|
13
|
+
MINIAPPMANAGERApi,
|
|
14
|
+
} from "~/simpleapp/generate/openapi";
|
|
15
|
+
import {
|
|
16
|
+
MiniAppFormWithMiniAppCode,
|
|
17
|
+
MiniAppFrameworkCompatibility,
|
|
18
|
+
} from "~/simpleapp/generate/features/miniApp/app/types/miniApp";
|
|
19
|
+
|
|
20
|
+
export default defineNuxtPlugin(async () => {
|
|
21
|
+
/**
|
|
22
|
+
* Mini app directory
|
|
23
|
+
*/
|
|
24
|
+
const MINI_APP_PAGE_PATH_PREFIX = "miniapp";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* To totally block mini app. if mini app's framework compability lower than this.
|
|
28
|
+
* To support backward compatibility, with deprecation notice,
|
|
29
|
+
* if mini app's framework compability higher than this, but lower than MIN_FRAMEWORK_COMPATIBLE_VERSION.
|
|
30
|
+
*/
|
|
31
|
+
const MIN_FRAMEWORK_VERSION = "1.0";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The minimum version that is compatible with the current framework.
|
|
35
|
+
*/
|
|
36
|
+
const MIN_FRAMEWORK_COMPATIBLE_VERSION = "1.0";
|
|
37
|
+
|
|
38
|
+
const config = getAxiosConfig();
|
|
39
|
+
|
|
40
|
+
const miniAppManager = new MINIAPPMANAGERApi(config);
|
|
41
|
+
|
|
42
|
+
const MINI_APP_BUILT_IN_SETTING_NAME = "mini-app-setting";
|
|
43
|
+
|
|
44
|
+
const useMiniAppStore = defineStore("mini-app", {
|
|
45
|
+
state: () => ({
|
|
46
|
+
actionAccess: {} as MiniAppDetailActionAccess,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Store all installed miniApps
|
|
50
|
+
*/
|
|
51
|
+
installedMiniApps: [] as MiniAppDetail[],
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Is fetching installed miniApps
|
|
55
|
+
*/
|
|
56
|
+
isFetchingInstalledMiniApps: true,
|
|
57
|
+
}),
|
|
58
|
+
getters: {
|
|
59
|
+
getForm: (state) => (formCode: string) => {
|
|
60
|
+
return state.installedMiniApps.flatMap((miniApp) => {
|
|
61
|
+
return miniApp.integration.forms
|
|
62
|
+
.filter((form) => form.code == formCode)
|
|
63
|
+
.map((form) => {
|
|
64
|
+
return {
|
|
65
|
+
...form,
|
|
66
|
+
miniAppCode: miniApp.code,
|
|
67
|
+
} as MiniAppFormWithMiniAppCode;
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
isHaveMiniAppFeature: (state) => {
|
|
73
|
+
if (state.isFetchingInstalledMiniApps) {
|
|
74
|
+
// if still fetching, return true 1st, else will immediate show restricted warning
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return state.actionAccess.isHaveMiniAppFeature ?? false;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
isShowMiniAppMoreMenuButton: (state) => {
|
|
82
|
+
const filtered = state.installedMiniApps.filter(
|
|
83
|
+
(item) =>
|
|
84
|
+
item.integration?.pages?.length > 0 ||
|
|
85
|
+
(item.integration?.settings?.jsonSchema &&
|
|
86
|
+
Object.keys(item.integration.settings.jsonSchema).length > 0),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return _.isEmpty(filtered) ? false : true;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
isCanInstall: (state) => state.actionAccess.isAllowInstall,
|
|
93
|
+
isCanUninstall: (state) => state.actionAccess.isAllowUninstall,
|
|
94
|
+
isCanUpdateSetting: (state) => state.actionAccess.isAllowUpdateSetting,
|
|
95
|
+
isHasMiniAppFeature: (state) => state.actionAccess.isHaveMiniAppFeature,
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
actions: {
|
|
99
|
+
getMenuItems() {
|
|
100
|
+
return this.installedMiniApps.flatMap((miniApp) => {
|
|
101
|
+
const pages = miniApp.integration.pages.filter((page) => {
|
|
102
|
+
return this.checkIsAllowAccessMiniAppPage(miniApp.code, page.code) && this.isRequiredToShowOnMenu(page);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
if (this.isCanUpdateSetting) {
|
|
106
|
+
if (
|
|
107
|
+
miniApp.integration.settings?.jsonSchema &&
|
|
108
|
+
!_.isEmpty(miniApp.integration.settings.jsonSchema)
|
|
109
|
+
) {
|
|
110
|
+
pages.push({
|
|
111
|
+
code: MINI_APP_BUILT_IN_SETTING_NAME,
|
|
112
|
+
title: t("miniAppLang.setting"),
|
|
113
|
+
description: "",
|
|
114
|
+
sourceType: "",
|
|
115
|
+
sources: {
|
|
116
|
+
development: "",
|
|
117
|
+
production: "",
|
|
118
|
+
},
|
|
119
|
+
requiredPermissions: [],
|
|
120
|
+
iconType: "class",
|
|
121
|
+
icon: "pi pi-cog",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Only return mini app if pages not empty
|
|
127
|
+
if (_.isEmpty(pages)) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
_id: miniApp._id,
|
|
133
|
+
code: miniApp.code,
|
|
134
|
+
name: miniApp.name,
|
|
135
|
+
logo: miniApp.logo,
|
|
136
|
+
pages,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
isRequiredToShowOnMenu(page: MiniappIntegrationPages){
|
|
142
|
+
return page.isHideOnMenu !== true;
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
// ============================ Load Function ============================
|
|
146
|
+
async loadInstalledMiniApps() {
|
|
147
|
+
this.isFetchingInstalledMiniApps = true;
|
|
148
|
+
|
|
149
|
+
const resp = await miniAppManager
|
|
150
|
+
.runGetInstalledMiniApps()
|
|
151
|
+
.then((res) => {
|
|
152
|
+
return res.data;
|
|
153
|
+
})
|
|
154
|
+
.catch((res: any) => {
|
|
155
|
+
return Promise.reject(res);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
this.installedMiniApps = resp.installedMiniApps;
|
|
159
|
+
this.actionAccess = resp.actionAccess;
|
|
160
|
+
|
|
161
|
+
this.isFetchingInstalledMiniApps = false;
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
async loadMiniAppDetail(miniAppCode: string) {
|
|
165
|
+
return await miniAppManager
|
|
166
|
+
.runGetMiniAppDetail(miniAppCode)
|
|
167
|
+
.then((res) => {
|
|
168
|
+
return res.data;
|
|
169
|
+
})
|
|
170
|
+
.catch((res: any) => {
|
|
171
|
+
return Promise.reject(res);
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
async loadCategorizedMiniApps() {
|
|
176
|
+
return await miniAppManager
|
|
177
|
+
.runGetCategorizedMiniApps()
|
|
178
|
+
.then((res) => {
|
|
179
|
+
return res.data;
|
|
180
|
+
})
|
|
181
|
+
.catch((res: any) => {
|
|
182
|
+
return Promise.reject(res);
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
// ================================ Permission ===============================
|
|
187
|
+
|
|
188
|
+
getActionAccess(
|
|
189
|
+
type: "install" | "uninstall" | "updateSetting" | "plan",
|
|
190
|
+
) {
|
|
191
|
+
switch (type) {
|
|
192
|
+
case "install":
|
|
193
|
+
return {
|
|
194
|
+
isAllow: this.isCanInstall,
|
|
195
|
+
reason: "insufficientInstallPermission",
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
case "uninstall":
|
|
199
|
+
return {
|
|
200
|
+
isAllow: this.isCanUninstall,
|
|
201
|
+
reason: "insufficientUninstallPermission",
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
case "updateSetting":
|
|
205
|
+
return {
|
|
206
|
+
isAllow: this.isCanUpdateSetting,
|
|
207
|
+
reason: "insufficientChangeSettingPermission",
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
case "plan":
|
|
211
|
+
return {
|
|
212
|
+
isAllow: this.isHasMiniAppFeature,
|
|
213
|
+
reason: "packageTypeRestricted",
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
// ============================ Path & Navigation ============================
|
|
219
|
+
|
|
220
|
+
getMiniAppSettingPath(miniAppCode: string) {
|
|
221
|
+
return `${MINI_APP_PAGE_PATH_PREFIX}/${miniAppCode}/setting`;
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
getMiniAppPageUrlPath(miniAppCode: string, pageCode: string): string {
|
|
225
|
+
const page = pageCode === "index" ? "" : "/" + pageCode;
|
|
226
|
+
return `${MINI_APP_PAGE_PATH_PREFIX}/${miniAppCode}/app${page}`;
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
getMiniAppPageUrl(
|
|
230
|
+
miniAppCode: string,
|
|
231
|
+
pageCode: string,
|
|
232
|
+
querystr?: string,
|
|
233
|
+
): string {
|
|
234
|
+
const path = this.getMiniAppPageUrlPath(miniAppCode, pageCode);
|
|
235
|
+
return getDocumentUrl(path, "", querystr);
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
getMiniAppSettingPageUrl(miniAppCode: string, querystr?: string): string {
|
|
239
|
+
const path = this.getMiniAppSettingPath(miniAppCode);
|
|
240
|
+
return getDocumentUrl(path, "", querystr);
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
navigateToMiniAppInstall(miniAppCode: string) {
|
|
244
|
+
goTo(`integrations/${miniAppCode}`);
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
navigateToMiniAppPage(miniAppCode: string, pageCode: string) {
|
|
248
|
+
if (pageCode === MINI_APP_BUILT_IN_SETTING_NAME) {
|
|
249
|
+
goTo(this.getMiniAppSettingPath(miniAppCode));
|
|
250
|
+
} else {
|
|
251
|
+
goTo(this.getMiniAppPageUrlPath(miniAppCode, pageCode));
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
// ============================ Validation ============================
|
|
256
|
+
|
|
257
|
+
checkIsMiniAppInstalled(miniAppCode: string) {
|
|
258
|
+
const miniApp = this.installedMiniApps.find(
|
|
259
|
+
(item) => item.code === miniAppCode,
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
return miniApp ? true : false;
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
checkIsAllowAccessMiniAppPage(miniAppCode: string, pageCode: string) {
|
|
266
|
+
const miniApp = this.installedMiniApps.find(
|
|
267
|
+
(item) => item.code === miniAppCode,
|
|
268
|
+
);
|
|
269
|
+
if (!miniApp) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const page = miniApp.integration.pages.find(
|
|
274
|
+
(item) => item.code === pageCode,
|
|
275
|
+
);
|
|
276
|
+
if (!page) {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (checkHasHighPrivilege()) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const userRoles = getUserProfile().roles;
|
|
285
|
+
|
|
286
|
+
if (page.requiredPermissions && !_.isEmpty(page.requiredPermissions)) {
|
|
287
|
+
return page.requiredPermissions.some((permission) =>
|
|
288
|
+
userRoles.includes(permission),
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
return true;
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
getPageInfo(miniApp: Miniapp, pageCode: string) {
|
|
295
|
+
return miniApp.integration.pages.find((item) => item.code === pageCode);
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
checkMiniAppFrameworkCompatibility: (
|
|
299
|
+
miniApp: Miniapp,
|
|
300
|
+
): MiniAppFrameworkCompatibility => {
|
|
301
|
+
if (miniApp.frameworkCompatibility < MIN_FRAMEWORK_VERSION) {
|
|
302
|
+
return MiniAppFrameworkCompatibility.DEPRECATED;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (miniApp.frameworkCompatibility < MIN_FRAMEWORK_COMPATIBLE_VERSION) {
|
|
306
|
+
return MiniAppFrameworkCompatibility.TO_BE_DEPRECATED;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return MiniAppFrameworkCompatibility.COMPATIBLE;
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
// ============================ miniApp Action ============================
|
|
313
|
+
|
|
314
|
+
async installMiniApp(miniAppCode: string) {
|
|
315
|
+
const miniAppInstallation = await miniAppManager
|
|
316
|
+
.runInstallMiniApp(miniAppCode)
|
|
317
|
+
.then((res) => {
|
|
318
|
+
return res.data;
|
|
319
|
+
})
|
|
320
|
+
.catch((res: any) => {
|
|
321
|
+
return Promise.reject(res);
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
this.loadInstalledMiniApps();
|
|
325
|
+
|
|
326
|
+
return miniAppInstallation;
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
async uninstallMiniApp(miniAppCode: string) {
|
|
330
|
+
const miniAppInstallation = await miniAppManager
|
|
331
|
+
.runUninstallMiniApp(miniAppCode)
|
|
332
|
+
.then((res) => {
|
|
333
|
+
return res.data;
|
|
334
|
+
})
|
|
335
|
+
.catch((res: any) => {
|
|
336
|
+
return Promise.reject(res);
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
this.loadInstalledMiniApps();
|
|
340
|
+
|
|
341
|
+
return miniAppInstallation;
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
async updateMiniAppSetting(
|
|
345
|
+
miniAppCode: string,
|
|
346
|
+
data: { [key: string]: any },
|
|
347
|
+
) {
|
|
348
|
+
const miniAppInstallation = await miniAppManager
|
|
349
|
+
.runUpdateMiniAppSetting(miniAppCode, data)
|
|
350
|
+
.then((res) => {
|
|
351
|
+
return res.data;
|
|
352
|
+
``;
|
|
353
|
+
})
|
|
354
|
+
.catch((res: any) => {
|
|
355
|
+
return Promise.reject(res);
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
this.loadInstalledMiniApps();
|
|
359
|
+
|
|
360
|
+
return miniAppInstallation;
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
openMiniAppSetting(miniAppCode: string | undefined) {
|
|
364
|
+
if (miniAppCode && miniAppCode != "") {
|
|
365
|
+
this.navigateToMiniAppPage(
|
|
366
|
+
miniAppCode,
|
|
367
|
+
MINI_APP_BUILT_IN_SETTING_NAME,
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
return {
|
|
375
|
+
provide: {
|
|
376
|
+
miniAppStore: useMiniAppStore(),
|
|
377
|
+
},
|
|
378
|
+
};
|
|
379
|
+
});
|
|
@@ -51,7 +51,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
51
51
|
async loadRemoteUserInfo() {
|
|
52
52
|
// console.log('loadRemoteUserInfo')
|
|
53
53
|
|
|
54
|
-
const { $axios, $
|
|
54
|
+
const { $axios, $miniAppStore, $customFieldStore } = useNuxtApp();
|
|
55
55
|
const route = useRoute();
|
|
56
56
|
let xorg = this.getCurrentXorg();
|
|
57
57
|
|
|
@@ -62,8 +62,8 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
62
62
|
apiurl = `${useRuntimeConfig().public.appUrl}/api/${xorg}`;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
if(xorg !== undefined) {
|
|
66
|
-
await $
|
|
65
|
+
if (xorg !== undefined) {
|
|
66
|
+
await $miniAppStore.loadInstalledMiniApps();
|
|
67
67
|
await $customFieldStore.fetchList();
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="validJsonSchema">
|
|
3
|
+
<template v-if="_.isArray(validJsonSchema)"> </template>
|
|
4
|
+
<template v-else>
|
|
5
|
+
<template v-if="validJsonSchema.type === 'object'">
|
|
6
|
+
<template v-if="validJsonSchema['x-foreignkey']">
|
|
7
|
+
<CustomFieldFormFieldInput
|
|
8
|
+
:jsonSchema="validJsonSchema"
|
|
9
|
+
:hierarchy="hierarchy"
|
|
10
|
+
:schemaSource="schemaSource"
|
|
11
|
+
:handleGetField="handleGetField"
|
|
12
|
+
v-model="data[schemaName]"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
<template v-else>
|
|
16
|
+
<Fieldset class="col-span-2 rounded-xl">
|
|
17
|
+
<template #legend>
|
|
18
|
+
<span
|
|
19
|
+
:class="{
|
|
20
|
+
'mx-2': legendTitle && legendTitle !== '',
|
|
21
|
+
}"
|
|
22
|
+
>
|
|
23
|
+
{{ legendTitle }}
|
|
24
|
+
</span>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<div
|
|
28
|
+
class="grid grid-cols-2 gap-4 p-2"
|
|
29
|
+
:class="{
|
|
30
|
+
'pt-4': legendTitle === undefined || legendTitle === '',
|
|
31
|
+
}"
|
|
32
|
+
>
|
|
33
|
+
<template
|
|
34
|
+
v-if="validJsonSchema.properties"
|
|
35
|
+
v-for="(subSchema, subSchemaName) in validJsonSchema.properties"
|
|
36
|
+
:key="subSchemaName"
|
|
37
|
+
>
|
|
38
|
+
<CustomFieldFormField
|
|
39
|
+
:jsonSchema="subSchema"
|
|
40
|
+
:data="data[schemaName]"
|
|
41
|
+
:schemaSource="schemaSource"
|
|
42
|
+
:schemaName="subSchemaName as string"
|
|
43
|
+
:handleGetField="handleGetField"
|
|
44
|
+
:hierarchy="
|
|
45
|
+
hierarchy === '' || hierarchy === undefined
|
|
46
|
+
? (subSchemaName as string)
|
|
47
|
+
: `${hierarchy}.${subSchemaName}`
|
|
48
|
+
"
|
|
49
|
+
/>
|
|
50
|
+
</template>
|
|
51
|
+
</div>
|
|
52
|
+
</Fieldset>
|
|
53
|
+
</template>
|
|
54
|
+
</template>
|
|
55
|
+
<template v-else>
|
|
56
|
+
<CustomFieldFormFieldInput
|
|
57
|
+
:jsonSchema="validJsonSchema"
|
|
58
|
+
:hierarchy="hierarchy"
|
|
59
|
+
:schemaSource="schemaSource"
|
|
60
|
+
:handleGetField="handleGetField"
|
|
61
|
+
v-model="data[schemaName]"
|
|
62
|
+
/>
|
|
63
|
+
</template>
|
|
64
|
+
</template>
|
|
65
|
+
</template>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script setup lang="ts">
|
|
69
|
+
import _ from "lodash";
|
|
70
|
+
import { SimpleAppJSONSchema7Definition } from "~/types";
|
|
71
|
+
import { SchemaSource } from "~/types/customField.type";
|
|
72
|
+
import CustomFieldFormFieldInput from "./CustomFieldFormFieldInput.vue";
|
|
73
|
+
|
|
74
|
+
const props = defineProps<{
|
|
75
|
+
jsonSchema?: SimpleAppJSONSchema7Definition | undefined;
|
|
76
|
+
data: any;
|
|
77
|
+
hierarchy: string;
|
|
78
|
+
schemaName: string;
|
|
79
|
+
schemaSource: SchemaSource;
|
|
80
|
+
isHideFieldsetLegend?: boolean;
|
|
81
|
+
handleGetField: (path: string) => any;
|
|
82
|
+
}>();
|
|
83
|
+
|
|
84
|
+
const legendTitle = computed(() => {
|
|
85
|
+
if (props.isHideFieldsetLegend) return "";
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
(props.jsonSchema &&
|
|
89
|
+
typeof props.jsonSchema !== "boolean" &&
|
|
90
|
+
props.jsonSchema?.title) ??
|
|
91
|
+
props.schemaName
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
const validJsonSchema = computed(() => {
|
|
95
|
+
if (props.jsonSchema !== undefined && typeof props.jsonSchema === "object") {
|
|
96
|
+
return props.jsonSchema;
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="jsonSchema.type !== 'array'">
|
|
3
|
+
<SimpleAppInput
|
|
4
|
+
v-if="fieldPath"
|
|
5
|
+
:setting="handleGetField(fieldPath)"
|
|
6
|
+
:inputType="inputType"
|
|
7
|
+
:hidelabel="isParentIsArray"
|
|
8
|
+
v-model="model"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
<template
|
|
12
|
+
v-else-if="
|
|
13
|
+
jsonSchema.type === 'array' &&
|
|
14
|
+
jsonSchema.items &&
|
|
15
|
+
_.isObject(jsonSchema.items) &&
|
|
16
|
+
!Array.isArray(jsonSchema.items)
|
|
17
|
+
"
|
|
18
|
+
>
|
|
19
|
+
<template v-if="jsonSchema.items.type === 'object'">
|
|
20
|
+
<div class="col-span-2">
|
|
21
|
+
<SimpleAppInputTable
|
|
22
|
+
:getField="handleGetField"
|
|
23
|
+
class="col-span-4"
|
|
24
|
+
:setting="handleGetField(fieldPath)"
|
|
25
|
+
v-model="model"
|
|
26
|
+
>
|
|
27
|
+
<Column
|
|
28
|
+
v-if="
|
|
29
|
+
jsonSchema.items &&
|
|
30
|
+
typeof jsonSchema.items === 'object' &&
|
|
31
|
+
'properties' in jsonSchema.items
|
|
32
|
+
"
|
|
33
|
+
v-for="(subSchema, subSchemaName) in jsonSchema.items.properties"
|
|
34
|
+
:key="subSchemaName"
|
|
35
|
+
:field="subSchemaName.toString()"
|
|
36
|
+
#body="{ index }"
|
|
37
|
+
:header="camelCaseToWords(subSchemaName.toString())"
|
|
38
|
+
>
|
|
39
|
+
<CustomFieldFormFieldInput
|
|
40
|
+
v-if="typeof subSchema === 'object' && subSchema !== null"
|
|
41
|
+
:jsonSchema="subSchema"
|
|
42
|
+
:hierarchy="
|
|
43
|
+
hierarchy === '' || hierarchy === undefined
|
|
44
|
+
? (subSchemaName as string)
|
|
45
|
+
: `${hierarchy}.*.${subSchemaName}`
|
|
46
|
+
"
|
|
47
|
+
:schemaSource="schemaSource"
|
|
48
|
+
:handleGetField="handleGetField"
|
|
49
|
+
v-model="model[index][subSchemaName]"
|
|
50
|
+
/>
|
|
51
|
+
</Column>
|
|
52
|
+
|
|
53
|
+
<Column #body="{ index }" header="Delete">
|
|
54
|
+
<Button
|
|
55
|
+
class="btn-danger"
|
|
56
|
+
type="button"
|
|
57
|
+
@click="model.splice(index, 1)"
|
|
58
|
+
>
|
|
59
|
+
X
|
|
60
|
+
</Button>
|
|
61
|
+
</Column>
|
|
62
|
+
</SimpleAppInputTable>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
<template v-else-if="jsonSchema.items.type === 'string'">
|
|
66
|
+
<SimpleAppInput
|
|
67
|
+
v-if="fieldPath"
|
|
68
|
+
:setting="handleGetField(fieldPath)"
|
|
69
|
+
:inputType="SimpleAppInputType.chip"
|
|
70
|
+
:hidelabel="isParentIsArray"
|
|
71
|
+
v-model="model"
|
|
72
|
+
/>
|
|
73
|
+
</template>
|
|
74
|
+
</template>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script setup lang="ts">
|
|
78
|
+
import _ from "lodash";
|
|
79
|
+
import { SimpleAppInputType, SimpleAppJSONSchema7 } from "~/types";
|
|
80
|
+
import { SchemaSource } from "~/types/customField.type";
|
|
81
|
+
|
|
82
|
+
const props = defineProps<{
|
|
83
|
+
jsonSchema: SimpleAppJSONSchema7;
|
|
84
|
+
hierarchy: string;
|
|
85
|
+
handleGetField: any;
|
|
86
|
+
schemaSource: SchemaSource;
|
|
87
|
+
}>();
|
|
88
|
+
|
|
89
|
+
const model = defineModel<any>();
|
|
90
|
+
|
|
91
|
+
const fieldPath = computed(() => {
|
|
92
|
+
const hierarchies = props.hierarchy.split(".");
|
|
93
|
+
|
|
94
|
+
const path = (getFieldPathPrefix() + hierarchies.join("/properties/"))
|
|
95
|
+
.replace("properties/*", "items")
|
|
96
|
+
.replace("*", "items");
|
|
97
|
+
|
|
98
|
+
// if (props.schemaSource === "miniAppSetting") {
|
|
99
|
+
// return path.replace("/properties/setting", "");
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
return path;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const inputType = computed(() => {
|
|
106
|
+
return getInputType(props.jsonSchema);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const isParentIsArray = computed(() => {
|
|
110
|
+
const hierarchies = props.hierarchy.split(".");
|
|
111
|
+
return hierarchies[hierarchies.length - 2] == "*";
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
function getFieldPathPrefix() {
|
|
115
|
+
if (props.schemaSource === "customField") {
|
|
116
|
+
return "#/properties/more/properties/";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return "#/properties/";
|
|
120
|
+
}
|
|
121
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section v-if="validProperties" class="space-y-4">
|
|
3
|
+
<template
|
|
4
|
+
v-for="(groupJsonSchema, groupName) in validProperties"
|
|
5
|
+
:key="groupName"
|
|
6
|
+
>
|
|
7
|
+
<CustomFieldFormField
|
|
8
|
+
v-if="isValidSchema(groupJsonSchema)"
|
|
9
|
+
:jsonSchema="groupJsonSchema"
|
|
10
|
+
:data="data"
|
|
11
|
+
:handleGetField="handleGetField"
|
|
12
|
+
:schemaName="groupName.toString()"
|
|
13
|
+
:hierarchy="groupName.toString()"
|
|
14
|
+
schemaSource="customField"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
</section>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import _ from 'lodash';
|
|
22
|
+
import { CustomFieldMoreSchema } from '~/simpleapp/generate/features/customField/types/common';
|
|
23
|
+
import CustomFieldFormField from './CustomFieldFormField.vue';
|
|
24
|
+
|
|
25
|
+
const props = defineProps<{
|
|
26
|
+
customFieldJsonSchema: CustomFieldMoreSchema;
|
|
27
|
+
data: any;
|
|
28
|
+
handleGetField: (path: string) => any;
|
|
29
|
+
}>();
|
|
30
|
+
|
|
31
|
+
const validProperties = computed(() => {
|
|
32
|
+
if (
|
|
33
|
+
props.customFieldJsonSchema.properties !== undefined &&
|
|
34
|
+
typeof props.customFieldJsonSchema.properties === 'object'
|
|
35
|
+
) {
|
|
36
|
+
return props.customFieldJsonSchema.properties;
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="py-2 border-b border-dashed">
|
|
3
|
+
<div
|
|
4
|
+
class="flex flex-col gap-1 px-3 py-1 hover:bg-slate-100 h-full rounded-lg cursor-pointer text-surface-700"
|
|
5
|
+
:class="{
|
|
6
|
+
'bg-slate-100': isActive,
|
|
7
|
+
}"
|
|
8
|
+
@click="goTo(`customfield/${resource.name}`)"
|
|
9
|
+
>
|
|
10
|
+
<div class="text-sm font-medium">{{ t(resource.name) }}</div>
|
|
11
|
+
<div class="flex items-center gap-2">
|
|
12
|
+
<CustomFieldMenuItemBadge
|
|
13
|
+
:isActive="resource.hasCustomFieldFormSetting"
|
|
14
|
+
:title="t('customFieldLang.formSettingBadgeLabel')"
|
|
15
|
+
/>
|
|
16
|
+
<CustomFieldMenuItemBadge
|
|
17
|
+
:isActive="resource.hasCustomFieldListSetting"
|
|
18
|
+
:title="t('customFieldLang.listSettingBadgeLabel')"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import { CustomFieldPageMenuResourceItem } from "../types/page";
|
|
27
|
+
import CustomFieldMenuItemBadge from "./CustomFieldMenuItemBadge.vue";
|
|
28
|
+
|
|
29
|
+
const props = defineProps<{
|
|
30
|
+
activeResource: string;
|
|
31
|
+
resource: CustomFieldPageMenuResourceItem;
|
|
32
|
+
}>();
|
|
33
|
+
|
|
34
|
+
const isActive = computed(() => {
|
|
35
|
+
return props.activeResource === props.resource.name;
|
|
36
|
+
});
|
|
37
|
+
</script>
|