@simitgroup/simpleapp-generator 1.0.32 → 1.0.35
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/.vscode/settings.json +3 -0
- package/README.md +185 -16
- package/buildinschemas copy/autoincreament.autoinc.jsonschema.json +39 -0
- package/buildinschemas copy/branch.branch.jsonschema.json +41 -0
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +41 -0
- package/buildinschemas copy/organization.org.jsonschema.json +50 -0
- package/buildinschemas copy/permission.perm.jsonschema.json +23 -0
- package/buildinschemas copy/permission.perm.jsonschema.try.json +25 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.json +21 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.try.json +27 -0
- package/buildinschemas copy/user.user.jsonschema.json +31 -0
- package/dist/buildinschemas/autoincreament.d.ts +3 -0
- package/dist/buildinschemas/autoincreament.d.ts.map +1 -0
- package/dist/buildinschemas/autoincreament.js +36 -0
- package/dist/buildinschemas/autoincreament.js.map +1 -0
- package/dist/buildinschemas/branch.d.ts +3 -0
- package/dist/buildinschemas/branch.d.ts.map +1 -0
- package/dist/buildinschemas/branch.js +41 -0
- package/dist/buildinschemas/branch.js.map +1 -0
- package/dist/buildinschemas/docnoformat.d.ts +3 -0
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -0
- package/dist/buildinschemas/docnoformat.js +60 -0
- package/dist/buildinschemas/docnoformat.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +8 -0
- package/dist/buildinschemas/index.d.ts.map +1 -0
- package/dist/buildinschemas/index.js +18 -0
- package/dist/buildinschemas/index.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts +3 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -0
- package/dist/buildinschemas/organization.js +34 -0
- package/dist/buildinschemas/organization.js.map +1 -0
- package/dist/buildinschemas/permission.d.ts +3 -0
- package/dist/buildinschemas/permission.d.ts.map +1 -0
- package/dist/buildinschemas/permission.js +34 -0
- package/dist/buildinschemas/permission.js.map +1 -0
- package/dist/buildinschemas/tenant.d.ts +3 -0
- package/dist/buildinschemas/tenant.d.ts.map +1 -0
- package/dist/buildinschemas/tenant.js +41 -0
- package/dist/buildinschemas/tenant.js.map +1 -0
- package/dist/buildinschemas/user.d.ts +3 -0
- package/dist/buildinschemas/user.d.ts.map +1 -0
- package/dist/buildinschemas/user.js +31 -0
- package/dist/buildinschemas/user.js.map +1 -0
- package/dist/constant.d.ts +4 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +2 -1
- package/dist/constant.js.map +1 -1
- package/dist/framework.d.ts +10 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/framework.js +120 -68
- package/dist/framework.js.map +1 -1
- package/dist/generate-allow-changebackend.js +305 -0
- package/dist/generate-allow-changebackend.js.map +1 -0
- package/dist/generate.d.ts +2 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +310 -230
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -20
- package/dist/index.js.map +1 -1
- package/dist/libs.d.ts +2 -0
- package/dist/libs.d.ts.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/processors/jsonschemabuilder.d.ts +4 -0
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -0
- package/dist/processors/jsonschemabuilder.js +146 -172
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/schematype/baseschema.js +25 -0
- package/dist/schematype/baseschema.js.map +1 -0
- package/dist/schematype/default.js +2 -0
- package/dist/schematype/default.js.map +1 -0
- package/dist/schematype/index.js +12 -0
- package/dist/schematype/index.js.map +1 -0
- package/dist/schematype/primarymasterdata.js +38 -0
- package/dist/schematype/primarymasterdata.js.map +1 -0
- package/dist/schematype/simple.js +24 -0
- package/dist/schematype/simple.js.map +1 -0
- package/dist/schematype/simplemasterdata.js +31 -0
- package/dist/schematype/simplemasterdata.js.map +1 -0
- package/dist/schematype/transaction.js +74 -0
- package/dist/schematype/transaction.js.map +1 -0
- package/dist/storage.d.ts +3 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +2 -2
- package/dist/storage.js.map +1 -1
- package/dist/type.d.ts +164 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +16 -1
- package/dist/type.js.map +1 -1
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -0
- package/documentation/designconcept.bpmn +349 -0
- package/documentation/documentation.png +0 -0
- package/documentation/infra.drawio +141 -0
- package/documentation/infra.png +0 -0
- package/documentation/management.drawio +57 -0
- package/documentation/stack.drawio +106 -0
- package/package.json +3 -1
- package/src/buildinschemas/autoincreament.ts +34 -0
- package/src/buildinschemas/branch.ts +39 -0
- package/src/buildinschemas/docnoformat.ts +58 -0
- package/src/buildinschemas/index.ts +7 -0
- package/src/buildinschemas/organization.ts +31 -0
- package/src/buildinschemas/permission.ts +31 -0
- package/src/buildinschemas/tenant.ts +38 -0
- package/src/buildinschemas/user.ts +28 -0
- package/src/constant.ts +2 -1
- package/src/framework.ts +126 -67
- package/src/generate.ts +327 -266
- package/src/generate.ts.backup +339 -0
- package/src/index.ts +93 -18
- package/src/processors/jsonschemabuilder.ts +199 -226
- package/src/processors/jsonschemabuilder.ts-old +383 -0
- package/src/storage.ts +1 -1
- package/src/type.ts +94 -27
- package/templates/basic/nest/controller.ts.eta +255 -0
- package/templates/basic/nest/default.ts.eta +42 -0
- package/templates/basic/{model.eta → nest/model.ts.eta} +18 -5
- package/templates/basic/nest/processor.ts.eta +129 -0
- package/templates/basic/nest/service.ts.eta +64 -0
- package/templates/basic/{type.eta → nest/type.ts.eta} +3 -3
- package/templates/basic/nuxt/default.ts.eta +42 -0
- package/templates/basic/{pageindex.vue.eta → nuxt/pages.crud.vue.eta} +85 -22
- package/templates/basic/nuxt/simpleapp.doc.ts.eta +11 -0
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +212 -0
- package/templates/nest/.env.eta +31 -0
- package/templates/nest/.gitignore.eta +40 -0
- package/templates/nest/src/app.controller.ts.eta +19 -0
- package/templates/nest/src/app.module.ts.eta +77 -0
- package/templates/nest/src/app.service.ts.eta +9 -0
- package/templates/nest/src/main.ts.eta +58 -0
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +16 -0
- package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +8 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +101 -0
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +39 -0
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +38 -0
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +88 -0
- package/templates/nest/{Workflow.eta → src/simpleapp/generate/commons/providers/workflow.provider.ts.etax} +20 -14
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +28 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +10 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +34 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +391 -0
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +53 -0
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +45 -0
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +57 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +624 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +74 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +110 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +195 -0
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +18 -0
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +89 -0
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +93 -0
- package/templates/nest/src/simpleapp/services/org.service.ts.eta +67 -0
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +102 -0
- package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +69 -0
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +43 -0
- package/templates/nuxt/.env.eta +21 -0
- package/templates/nuxt/.gitignore.eta +28 -0
- package/templates/nuxt/app.vue.eta +5 -2
- package/templates/nuxt/assets/css/tailwind.css.eta +35 -0
- package/templates/nuxt/components/CrudNestedDoc.vue.eta +164 -0
- package/templates/nuxt/components/CrudSimple.vue.eta +179 -0
- package/templates/nuxt/{components.debugdocdata.vue.eta → components/DebugDocumentData.vue.eta} +4 -1
- package/templates/nuxt/{components.eventmonitor.vue.eta → components/EventMonitor.vue.eta} +27 -27
- package/templates/nuxt/components/Invitation.vue.eta +50 -0
- package/templates/nuxt/components/Menus.vue.eta +58 -0
- package/templates/nuxt/components/PermissionInfo.vue.eta +92 -0
- package/templates/nuxt/components/SimpleAppAutocomplete.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppAutocompletemulti.vue.eta +73 -0
- package/templates/nuxt/components/SimpleAppCalendar.vue.eta +55 -0
- package/templates/nuxt/components/SimpleAppCheckbox.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppChip.vue.eta +28 -0
- package/templates/nuxt/components/SimpleAppColor.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +20 -0
- package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +90 -0
- package/templates/nuxt/components/SimpleAppDynamicInput.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppEditor.vue.eta +31 -0
- package/templates/nuxt/components/SimpleAppForm.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppInputTable.vue.eta +104 -0
- package/templates/nuxt/components/SimpleAppList.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppListmulti.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppNumber.vue.eta +32 -0
- package/templates/nuxt/components/SimpleAppPassword.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppRadio.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppRating.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppSelect.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppSelectmulti.vue.eta +39 -0
- package/templates/nuxt/components/SimpleAppSlider.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppSwitch.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppText.vue.eta +50 -0
- package/templates/nuxt/components/SimpleAppTextarea.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppValue.vue.eta +86 -0
- package/templates/nuxt/components/SimpleFieldContainer.vue.eta +102 -0
- package/templates/nuxt/components/XorgPicker.vue.eta +66 -0
- package/templates/nuxt/components/helper.ts.eta +90 -0
- package/templates/nuxt/components/type.ts.eta +32 -0
- package/templates/nuxt/composables/docformat.generate.ts.eta +5 -0
- package/templates/nuxt/{composables.getautocomplete.ts.eta → composables/getAutocomplete.generate.ts.eta} +4 -5
- package/templates/nuxt/{composables.getmenus.ts.eta → composables/getMenus.generate.ts.eta} +22 -7
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +6 -0
- package/templates/nuxt/composables/getTenant.generate.ts.eta +4 -0
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +22 -0
- package/templates/nuxt/composables/logout.generate.ts.eta +22 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +48 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +5 -0
- package/templates/nuxt/{layouts.default.vue.eta → layouts/default.vue.eta} +2 -0
- package/templates/nuxt/middleware/10.acl.global.ts.eta +38 -0
- package/templates/nuxt/nuxt.config.ts.eta +12 -2
- package/templates/nuxt/pages/[xorg]/branch/index.vue.eta +102 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/[id].vue.eta +17 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +269 -0
- package/templates/nuxt/pages/[xorg]/index.vue.eta +36 -0
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +148 -0
- package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +280 -0
- package/templates/nuxt/pages/[xorg]/tenant/index.vue.eta +93 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +468 -0
- package/templates/nuxt/pages/index.vue.eta +191 -0
- package/templates/nuxt/pages/login.vue.eta +21 -0
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +53 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +155 -0
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +23 -0
- package/templates/nuxt/{server.api.ts.eta → server/api/[xorg]/[...].ts.eta} +5 -2
- package/templates/nuxt/server/api/auth/[...].ts.eta +68 -0
- package/templates/nuxt/{server.api.auth.logout.ts.eta → server/api/auth/logout.ts.eta} +1 -3
- package/templates/nuxt/server/api/profile/[...].ts.eta +150 -0
- package/templates/nuxt/server/api/profile/index.ts.eta +103 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +187 -0
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +5 -0
- package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +11 -0
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +21 -0
- package/templates/nuxt/types/index.ts.eta +65 -0
- package/templates/project/README.md +11 -0
- package/templates/project/build.sh.eta +17 -0
- package/templates/project/config.json.eta +2 -0
- package/templates/project/generate.ts.eta +10 -0
- package/templates/project/schemas/category.ts.eta +26 -0
- package/templates/project/schemas/index.ts.eta +5 -0
- package/templates/project/schemas/product.ts.eta +59 -0
- package/templates/project/shares/hello.ts.eta +1 -0
- package/templates/project/shares/index.ts.eta +2 -0
- package/tsconfig.json +9 -2
- package/tsconfig.tsbuildinfo +1 -0
- package/definations/category.cat.jsonschema.json +0 -55
- package/definations/level.lvl.jsonschema.json +0 -48
- package/definations/product.prd.jsonschema.json +0 -46
- package/templates/basic/controller.eta +0 -152
- package/templates/basic/module.eta +0 -22
- package/templates/basic/service.eta +0 -62
- package/templates/basic/simpleappclient.eta +0 -120
- package/templates/nest/SimpleAppController.eta +0 -69
- package/templates/nest/SimpleAppService.eta +0 -366
- package/templates/nest/TenantMiddleware.eta +0 -34
- package/templates/nest/UserProvider.eta +0 -127
- package/templates/nest/app.controller.eta +0 -12
- package/templates/nest/app.module.eta +0 -64
- package/templates/nest/app.service.eta +0 -8
- package/templates/nest/inputvalidation-exception.eta +0 -6
- package/templates/nest/nest.env.eta +0 -28
- package/templates/nest/nest.main.eta +0 -31
- package/templates/nuxt/components.crudsimple.vue.eta +0 -124
- package/templates/nuxt/components.menus.vue.eta +0 -35
- package/templates/nuxt/env.eta +0 -17
- package/templates/nuxt/pages.[xorg].index.vue.eta +0 -20
- package/templates/nuxt/pages.index.vue.eta +0 -72
- package/templates/nuxt/pages.login.vue.eta +0 -20
- package/templates/nuxt/plugins.simpleapp.ts.eta +0 -88
- package/templates/nuxt/server.api.auth[...].ts.eta +0 -233
- package/templates/nuxt/tailwind.css.eta +0 -49
- /package/templates/basic/{apischema.eta → nest/apischema.ts.eta} +0 -0
- /package/templates/basic/{jsonschema.eta → nest/jsonschema.ts.eta} +0 -0
- /package/templates/basic/{pageindexwithid.vue.eta → nuxt/pages.[id].vue.eta} +0 -0
- /package/templates/nest/{oauth2-redirect.eta → public_html/oauth2-redirect.html.eta} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer v-bind="$attrs" :refto="id" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
<Listbox v-model="modelValue"
|
|
5
|
+
class="simpleapp-inputfield"
|
|
6
|
+
:id="slotprops.uuid"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
optionValue="value"
|
|
9
|
+
optionLabel="label"
|
|
10
|
+
:path="setting.instancepath"
|
|
11
|
+
:options="options"
|
|
12
|
+
multiple
|
|
13
|
+
/>
|
|
14
|
+
</FieldContainer>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import {computed,watch,ref} from 'vue'
|
|
18
|
+
import Listbox from 'primevue/listbox';
|
|
19
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
20
|
+
import {prepareList,simpleArrayToObject} from './helper'
|
|
21
|
+
import type {SimpleAppFieldSetting} from './type'
|
|
22
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
23
|
+
const modelValue = defineModel()
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
label?:string,
|
|
26
|
+
id?:string,
|
|
27
|
+
description?:string,
|
|
28
|
+
error?:string,
|
|
29
|
+
setting:SimpleAppFieldSetting,
|
|
30
|
+
optionLabel?:string,
|
|
31
|
+
optionValue?:string,
|
|
32
|
+
instancepath?:string,
|
|
33
|
+
options?:any[],
|
|
34
|
+
}>()
|
|
35
|
+
const optionValue = props.optionValue ?? 'label'
|
|
36
|
+
const optionLabel = props.optionLabel ?? 'value'
|
|
37
|
+
|
|
38
|
+
const options = prepareList('anyOf',props.setting.fieldsetting.items,optionLabel,optionValue,props.options,)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer :hidelabel="hidelabel" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
<InputNumber class="simpleapp-inputfield"
|
|
5
|
+
:inputId="slotprops.uuid"
|
|
6
|
+
v-model="modelValue"
|
|
7
|
+
:path="setting.instancepath"
|
|
8
|
+
:pt="{input:{class:'text-right w-full'}}"
|
|
9
|
+
></InputNumber>
|
|
10
|
+
</FieldContainer>
|
|
11
|
+
</template>
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import {computed,watch,ref} from 'vue'
|
|
14
|
+
import InputNumber from 'primevue/inputnumber';
|
|
15
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
16
|
+
const props = withDefaults(defineProps<{
|
|
17
|
+
label?:string,
|
|
18
|
+
description?:string,
|
|
19
|
+
setting:any
|
|
20
|
+
error?:string,
|
|
21
|
+
instancepath?:string,
|
|
22
|
+
hidelabel?:boolean
|
|
23
|
+
}>(),{
|
|
24
|
+
hidelabel:false
|
|
25
|
+
})
|
|
26
|
+
const emit = defineEmits(['change'])
|
|
27
|
+
const modelValue =defineModel()
|
|
28
|
+
watch(modelValue,()=>{
|
|
29
|
+
// props.setting.document.validateFailed()
|
|
30
|
+
emit('change',modelValue)
|
|
31
|
+
})
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer v-bind="$attrs" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
<Password
|
|
5
|
+
class="simpleapp-inputfield"
|
|
6
|
+
:inputId="slotprops.uuid"
|
|
7
|
+
v-model="modelValue"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
:path="setting.instancepath"
|
|
10
|
+
></Password>
|
|
11
|
+
</FieldContainer>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import {computed,watch,ref} from 'vue'
|
|
15
|
+
import Password from 'primevue/password';
|
|
16
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
17
|
+
const modelValue = defineModel()
|
|
18
|
+
const props = defineProps<{
|
|
19
|
+
label?:string,
|
|
20
|
+
id?:string,
|
|
21
|
+
description?:string,
|
|
22
|
+
error?:string,
|
|
23
|
+
setting:any,
|
|
24
|
+
instancepath?:string,
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
// const modelValue = defineModel<{modelValue?:string}>()
|
|
28
|
+
// console.log(modelValue.value)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// const emits = defineEmits(['update:modelValue'])
|
|
32
|
+
// const onchange=(e:any)=>{
|
|
33
|
+
// emits('update:modelValue',e.target.value)
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// watch(props ,(after,before)=>{
|
|
38
|
+
// // console.log("B4",before,"after",after)
|
|
39
|
+
// inputvalue.value=after.modelValue
|
|
40
|
+
// })
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer v-bind="$attrs"
|
|
4
|
+
v-model="modelValue"
|
|
5
|
+
:label="label"
|
|
6
|
+
:description="description"
|
|
7
|
+
:setting="setting"
|
|
8
|
+
:instancepath="instancepath"
|
|
9
|
+
:error="error"
|
|
10
|
+
#default="slotprops">
|
|
11
|
+
<div v-for="(o, index) in options" :key="index" class="simpleapp-inputradio">
|
|
12
|
+
<RadioButton
|
|
13
|
+
v-model="modelValue"
|
|
14
|
+
:inputId="`${slotprops.uuid}_${index}`"
|
|
15
|
+
:value="o.value" />
|
|
16
|
+
<label :for="`${slotprops.uuid}_${index}`">{{ o.label }}</label>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
</FieldContainer>
|
|
21
|
+
</template>
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import RadioButton from 'primevue/radiobutton';
|
|
24
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
25
|
+
import {prepareList,simpleArrayToObject} from './helper'
|
|
26
|
+
import type {ListOptionType} from './type'
|
|
27
|
+
const modelValue = defineModel()
|
|
28
|
+
const props = defineProps<{
|
|
29
|
+
label?:string,
|
|
30
|
+
description?:string,
|
|
31
|
+
error?:string,
|
|
32
|
+
setting:any,
|
|
33
|
+
optionLabel?:string,
|
|
34
|
+
optionValue?:string,
|
|
35
|
+
instancepath?:string,
|
|
36
|
+
options?:any[],
|
|
37
|
+
}>()
|
|
38
|
+
const optionValue = props.optionValue ?? 'label'
|
|
39
|
+
const optionLabel = props.optionLabel ?? 'value'
|
|
40
|
+
const options = prepareList('oneOf',props.setting.fieldsetting,optionLabel,optionValue,props.options,)
|
|
41
|
+
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer v-bind="$attrs" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
<Rating
|
|
5
|
+
class="simpleapp-inputfield"
|
|
6
|
+
:inputId="slotprops.uuid"
|
|
7
|
+
v-model="modelValue"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
:path="setting.instancepath"
|
|
10
|
+
></Rating>
|
|
11
|
+
</FieldContainer>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import {computed,watch,ref} from 'vue'
|
|
15
|
+
import Rating from 'primevue/rating';
|
|
16
|
+
|
|
17
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
18
|
+
const modelValue = defineModel()
|
|
19
|
+
const props = defineProps<{
|
|
20
|
+
label?:string,
|
|
21
|
+
description?:string,
|
|
22
|
+
error?:string,
|
|
23
|
+
setting:any,
|
|
24
|
+
instancepath?:string,
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
// const modelValue = defineModel<{modelValue?:string}>()
|
|
28
|
+
// console.log(modelValue.value)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// const emits = defineEmits(['update:modelValue'])
|
|
32
|
+
// const onchange=(e:any)=>{
|
|
33
|
+
// emits('update:modelValue',e.target.value)
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// watch(props ,(after,before)=>{
|
|
38
|
+
// // console.log("B4",before,"after",after)
|
|
39
|
+
// inputvalue.value=after.modelValue
|
|
40
|
+
// })
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer v-bind="$attrs" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
<Dropdown v-model="modelValue"
|
|
5
|
+
class="simpleapp-inputfield"
|
|
6
|
+
:inputId="slotprops.uuid"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
optionValue="value"
|
|
9
|
+
optionLabel="label"
|
|
10
|
+
:path="setting.instancepath"
|
|
11
|
+
:options="options"
|
|
12
|
+
/>
|
|
13
|
+
</FieldContainer>
|
|
14
|
+
</template>
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import {computed,watch,ref} from 'vue'
|
|
17
|
+
import Dropdown from 'primevue/dropdown';
|
|
18
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
19
|
+
import {prepareList,simpleArrayToObject} from './helper'
|
|
20
|
+
import type {ListOptionType} from './type'
|
|
21
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
22
|
+
const modelValue = defineModel()
|
|
23
|
+
const props = defineProps<{
|
|
24
|
+
label?:string,
|
|
25
|
+
description?:string,
|
|
26
|
+
error?:string,
|
|
27
|
+
setting:any,
|
|
28
|
+
optionLabel?:string,
|
|
29
|
+
optionValue?:string,
|
|
30
|
+
instancepath?:string,
|
|
31
|
+
options?:any[]
|
|
32
|
+
}>()
|
|
33
|
+
|
|
34
|
+
const optionValue = props.optionValue ?? 'value'
|
|
35
|
+
const optionLabel = props.optionLabel ?? 'label'
|
|
36
|
+
const options = prepareList('oneOf',props.setting.fieldsetting,optionLabel,optionValue,props.options,)
|
|
37
|
+
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer v-bind="$attrs" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
<MultiSelect v-model="modelValue"
|
|
5
|
+
class="simpleapp-inputfield"
|
|
6
|
+
:inputId="slotprops.uuid"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
:optionValue="optionValue"
|
|
9
|
+
:optionLabel="optionLabel"
|
|
10
|
+
:path="setting.instancepath"
|
|
11
|
+
:options="options"
|
|
12
|
+
multiple
|
|
13
|
+
/>
|
|
14
|
+
</FieldContainer>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import {computed,watch,ref} from 'vue'
|
|
18
|
+
import MultiSelect from 'primevue/multiselect';
|
|
19
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
20
|
+
import {prepareList,simpleArrayToObject} from './helper'
|
|
21
|
+
import type {SimpleAppFieldSetting} from './type'
|
|
22
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
23
|
+
const modelValue = defineModel()
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
label?:string,
|
|
26
|
+
description?:string,
|
|
27
|
+
error?:string,
|
|
28
|
+
setting:SimpleAppFieldSetting,
|
|
29
|
+
optionLabel?:string,
|
|
30
|
+
optionValue?:string,
|
|
31
|
+
instancepath?:string,
|
|
32
|
+
options?:any[]
|
|
33
|
+
}>()
|
|
34
|
+
const optionValue = props.optionValue ?? 'label'
|
|
35
|
+
const optionLabel = props.optionLabel ?? 'value'
|
|
36
|
+
// console.log("appselectmulti",props.description, props.setting.fieldsetting)
|
|
37
|
+
const options = prepareList('anyOf',props.setting.fieldsetting.items,optionLabel,optionValue,props.options,)
|
|
38
|
+
// props.setting.fieldsetting.items
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer v-bind="$attrs" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
<Slider
|
|
5
|
+
class="simpleapp-inputfield"
|
|
6
|
+
:inputId="slotprops.uuid"
|
|
7
|
+
v-model="modelValue"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
:path="setting.instancepath"
|
|
10
|
+
></Slider>
|
|
11
|
+
</FieldContainer>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import {computed,watch,ref} from 'vue'
|
|
15
|
+
import Slider from 'primevue/slider';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
19
|
+
const modelValue = defineModel()
|
|
20
|
+
const props = defineProps<{
|
|
21
|
+
label?:string,
|
|
22
|
+
description?:string,
|
|
23
|
+
error?:string,
|
|
24
|
+
setting:any,
|
|
25
|
+
instancepath?:string,
|
|
26
|
+
}>()
|
|
27
|
+
|
|
28
|
+
// const modelValue = defineModel<{modelValue?:string}>()
|
|
29
|
+
// console.log(modelValue.value)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// const emits = defineEmits(['update:modelValue'])
|
|
33
|
+
// const onchange=(e:any)=>{
|
|
34
|
+
// emits('update:modelValue',e.target.value)
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// watch(props ,(after,before)=>{
|
|
39
|
+
// // console.log("B4",before,"after",after)
|
|
40
|
+
// inputvalue.value=after.modelValue
|
|
41
|
+
// })
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<template>
|
|
4
|
+
<FieldContainer v-bind="$attrs" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
5
|
+
<InputSwitch
|
|
6
|
+
class="simpleapp-inputswitch"
|
|
7
|
+
:inputId="slotprops.uuid"
|
|
8
|
+
v-model="modelValue"
|
|
9
|
+
:binary="true"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
:path="setting.instancepath"
|
|
12
|
+
></InputSwitch>
|
|
13
|
+
</FieldContainer>
|
|
14
|
+
</template>
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
// import {Ref} from 'vue'
|
|
17
|
+
import InputSwitch from 'primevue/inputswitch';
|
|
18
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
19
|
+
|
|
20
|
+
const modelValue = defineModel<boolean>()
|
|
21
|
+
const props = defineProps<{
|
|
22
|
+
label?:string,
|
|
23
|
+
id?:string,
|
|
24
|
+
description?:string,
|
|
25
|
+
error?:string,
|
|
26
|
+
setting:any,
|
|
27
|
+
instancepath?:string,
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer :hidelabel="hidelabel" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
<InputText v-if="slotprops.error"
|
|
7
|
+
class="simpleapp-inputfield simpleapp-invalid-input"
|
|
8
|
+
:id="slotprops.uuid"
|
|
9
|
+
v-model="modelValue"
|
|
10
|
+
:path="setting.instancepath"
|
|
11
|
+
:type="type"
|
|
12
|
+
></InputText>
|
|
13
|
+
<InputText v-else
|
|
14
|
+
class="simpleapp-inputfield"
|
|
15
|
+
:id="slotprops.uuid"
|
|
16
|
+
v-model="modelValue"
|
|
17
|
+
:path="setting.instancepath"
|
|
18
|
+
:type="type"
|
|
19
|
+
></InputText>
|
|
20
|
+
</FieldContainer>
|
|
21
|
+
</template>
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import {computed,watch,ref} from 'vue'
|
|
24
|
+
import InputText from 'primevue/inputtext';
|
|
25
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
26
|
+
const modelValue = defineModel()
|
|
27
|
+
const props = withDefaults( defineProps<{
|
|
28
|
+
label?:string,
|
|
29
|
+
description?:string,
|
|
30
|
+
error?:string,
|
|
31
|
+
setting:any,
|
|
32
|
+
type?:string,
|
|
33
|
+
instancepath?:string,
|
|
34
|
+
hidelabel?: boolean
|
|
35
|
+
}>(),{type:'text'})
|
|
36
|
+
|
|
37
|
+
// const modelValue = defineModel<{modelValue?:string}>()
|
|
38
|
+
// console.log(modelValue.value)
|
|
39
|
+
|
|
40
|
+
const emits = defineEmits(['change'])
|
|
41
|
+
// const onchange=(e:any)=>{
|
|
42
|
+
// emits('update:modelValue',e.target.value)
|
|
43
|
+
// }
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
watch(modelValue ,()=>{
|
|
47
|
+
// props.setting.document.validateFailed()
|
|
48
|
+
emits('change',modelValue.value)
|
|
49
|
+
})
|
|
50
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<FieldContainer v-bind="$attrs" v-model="modelValue" :label="label" :description="description" :setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
4
|
+
<Textarea
|
|
5
|
+
class="simpleapp-inputfield"
|
|
6
|
+
:id="slotprops.uuid"
|
|
7
|
+
v-model="modelValue"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
:autoResize="autoResize"
|
|
10
|
+
:path="setting.instancepath"
|
|
11
|
+
></Textarea>
|
|
12
|
+
</FieldContainer>
|
|
13
|
+
</template>
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
import {computed,watch,ref} from 'vue'
|
|
16
|
+
import Textarea from 'primevue/textarea';
|
|
17
|
+
|
|
18
|
+
import FieldContainer from './SimpleFieldContainer.vue'
|
|
19
|
+
const modelValue = defineModel()
|
|
20
|
+
const props = defineProps<{
|
|
21
|
+
label?:string,
|
|
22
|
+
id?:string,
|
|
23
|
+
description?:string,
|
|
24
|
+
error?:string,
|
|
25
|
+
setting:any,
|
|
26
|
+
autoResize?:boolean,
|
|
27
|
+
instancepath?:string,
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="schema" :class="fieldcontainerclass">
|
|
3
|
+
|
|
4
|
+
<div v-if="hidelabel"></div>
|
|
5
|
+
<label v-else :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="input-error">*</span></label>
|
|
6
|
+
|
|
7
|
+
<div :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue }}</div>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<small v-if="error" class="input-desc">{{ error }}</small>
|
|
11
|
+
<small v-else class="input-desc">{{ fielddesc }}</small>
|
|
12
|
+
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
<div v-else class="simpleapp-input-container">
|
|
16
|
+
<label class="input-error">wrong path in getField()</label>
|
|
17
|
+
<div class="input-error">{{ props.setting.path }}</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import {camelCaseToWords} from './helper'
|
|
22
|
+
import {computed,watch} from 'vue'
|
|
23
|
+
import {ref} from 'vue'
|
|
24
|
+
const modelValue = defineModel()
|
|
25
|
+
const uuid = crypto.randomUUID()
|
|
26
|
+
const fieldlabel = ref('')
|
|
27
|
+
const fielddesc = ref('')
|
|
28
|
+
const defaultcssclass='simpleapp-input-container'
|
|
29
|
+
const fieldcontainerclass = ref(defaultcssclass)
|
|
30
|
+
let instancepath = ref('')
|
|
31
|
+
const props = defineProps<{
|
|
32
|
+
label?: string,
|
|
33
|
+
description?: string,
|
|
34
|
+
instancepath?:string,
|
|
35
|
+
hidelabel?:boolean,
|
|
36
|
+
// error?:string,
|
|
37
|
+
setting:any
|
|
38
|
+
}>()
|
|
39
|
+
|
|
40
|
+
// console.log('props.setting',props.setting.fieldsetting)
|
|
41
|
+
let schema:any
|
|
42
|
+
if(props.setting.fieldsetting && props.setting.fieldsetting.type){
|
|
43
|
+
|
|
44
|
+
schema = props.setting.fieldsetting
|
|
45
|
+
// console.log("schema setting",props.setting,schema)
|
|
46
|
+
if(props?.instancepath) instancepath.value =props.instancepath
|
|
47
|
+
else if(props.setting?.instancepath) instancepath.value = props.setting.instancepath
|
|
48
|
+
else instancepath.value='/unknown'
|
|
49
|
+
|
|
50
|
+
const fieldnamearr = instancepath.value.split('/')
|
|
51
|
+
const fieldname = camelCaseToWords(fieldnamearr[fieldnamearr.length-1])
|
|
52
|
+
|
|
53
|
+
if(props.label)fieldlabel.value = props.label
|
|
54
|
+
else if (schema.title ) fieldlabel.value=schema.title
|
|
55
|
+
else fieldlabel.value=fieldname
|
|
56
|
+
|
|
57
|
+
if(props.description)fielddesc.value = props.description
|
|
58
|
+
else if (schema?.description != 'undefined') fielddesc.value=schema.description
|
|
59
|
+
else fielddesc.value=''
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
const errormsg = computed(()=>{
|
|
65
|
+
|
|
66
|
+
props.setting.errors[instancepath.value]
|
|
67
|
+
})
|
|
68
|
+
const error = ref("")
|
|
69
|
+
watch(props.setting.errors,(newvalue,oldvalue)=>{
|
|
70
|
+
//it is array
|
|
71
|
+
error.value=''
|
|
72
|
+
if(newvalue[instancepath.value]){
|
|
73
|
+
const errlist:any[] = newvalue[instancepath.value]
|
|
74
|
+
for(let i=0;i<errlist.length;i++){
|
|
75
|
+
error.value += errlist[i].message +','
|
|
76
|
+
}
|
|
77
|
+
fieldcontainerclass.value=defaultcssclass + ' input-error'
|
|
78
|
+
}else{
|
|
79
|
+
error.value=''
|
|
80
|
+
fieldcontainerclass.value=defaultcssclass
|
|
81
|
+
}
|
|
82
|
+
// console.log("validation result",props.setting.instancepath,)
|
|
83
|
+
// error.value = newvalue[props.setting.instancepath].message
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
</script>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="schema" :class="fieldcontainerclass">
|
|
3
|
+
<div v-if="hidelabel"></div>
|
|
4
|
+
<label v-else-if="error" class="error-text" :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="input-error">*</span></label>
|
|
5
|
+
<label v-else :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="input-error">*</span></label>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
<div v-if="readonly && typeof modelValue =='object' && typeof modelValue['_id']!='undefined' && typeof modelValue['label']!='undefined' " :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue['label'] }}</div>
|
|
9
|
+
<div v-else-if="readonly" :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue }}</div>
|
|
10
|
+
<slot v-else name="default" :uuid="uuid" :error="error"></slot>
|
|
11
|
+
|
|
12
|
+
<small v-if="error" class="error-text">{{ error }}</small>
|
|
13
|
+
<small v-else class="input-desc">{{ fielddesc }}</small>
|
|
14
|
+
</div>
|
|
15
|
+
<div v-else :class="defaultcssclass">
|
|
16
|
+
<label class="error-text ">wrong path in getField()</label>
|
|
17
|
+
<div class="error-text">{{ props.setting.path }}</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import SimpleAppValue from './SimpleAppValue.vue'
|
|
22
|
+
import {camelCaseToWords} from './helper'
|
|
23
|
+
import {computed,setBlockTracking,watch} from 'vue'
|
|
24
|
+
|
|
25
|
+
import {ref} from 'vue'
|
|
26
|
+
const uuid = crypto.randomUUID();
|
|
27
|
+
const fieldlabel = ref('')
|
|
28
|
+
const fielddesc = ref('')
|
|
29
|
+
const defaultcssclass='simpleapp-input-container'
|
|
30
|
+
const fieldcontainerclass = ref(defaultcssclass)
|
|
31
|
+
let instancepath = ref('')
|
|
32
|
+
const props = defineProps<{
|
|
33
|
+
label?: string,
|
|
34
|
+
description?: string,
|
|
35
|
+
instancepath?:string,
|
|
36
|
+
hidelabel?:boolean,
|
|
37
|
+
readonly?:boolean
|
|
38
|
+
// error?:string,
|
|
39
|
+
setting:any
|
|
40
|
+
}>()
|
|
41
|
+
|
|
42
|
+
const readonly = ref(false)
|
|
43
|
+
if(props.readonly !== undefined){
|
|
44
|
+
readonly.value=props.readonly
|
|
45
|
+
}else if(props.setting.readonly !==undefined){
|
|
46
|
+
readonly.value=props.readonly
|
|
47
|
+
}
|
|
48
|
+
// console.log("props.setting.format",props.setting.format)
|
|
49
|
+
const modelValue = defineModel()
|
|
50
|
+
const readonlyclass="simpleapp-value-readonly"
|
|
51
|
+
// console.log('props.setting',modelValue.value,props.setting)
|
|
52
|
+
let schema:any
|
|
53
|
+
if(props.setting.fieldsetting && props.setting.fieldsetting.type){
|
|
54
|
+
|
|
55
|
+
schema = props.setting.fieldsetting
|
|
56
|
+
// console.log("schema setting",props.setting,schema)
|
|
57
|
+
if(props?.instancepath) instancepath.value =props.instancepath
|
|
58
|
+
else if(props.setting?.instancepath) instancepath.value = props.setting.instancepath
|
|
59
|
+
else instancepath.value='/unknown'
|
|
60
|
+
|
|
61
|
+
const fieldnamearr = instancepath.value.split('/')
|
|
62
|
+
const fieldname = camelCaseToWords(fieldnamearr[fieldnamearr.length-1])
|
|
63
|
+
|
|
64
|
+
if(props.label)fieldlabel.value = props.label
|
|
65
|
+
else if (schema.title ) fieldlabel.value=schema.title
|
|
66
|
+
else fieldlabel.value=fieldname
|
|
67
|
+
|
|
68
|
+
if(props.description)fielddesc.value = props.description
|
|
69
|
+
else if (schema?.description != 'undefined') fielddesc.value=schema.description
|
|
70
|
+
else fielddesc.value=''
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
const errormsg = computed(()=>{
|
|
76
|
+
|
|
77
|
+
props.setting.errors[instancepath.value]
|
|
78
|
+
})
|
|
79
|
+
const error = ref("")
|
|
80
|
+
watch(props.setting.errors,(newvalue,oldvalue)=>{
|
|
81
|
+
//it is array
|
|
82
|
+
error.value=''
|
|
83
|
+
if(newvalue[instancepath.value]){
|
|
84
|
+
const errlist:any[] = newvalue[instancepath.value]
|
|
85
|
+
for(let i=0;i<errlist.length;i++){
|
|
86
|
+
error.value += errlist[i].message +','
|
|
87
|
+
}
|
|
88
|
+
fieldcontainerclass.value=defaultcssclass + ' input-error'
|
|
89
|
+
}else{
|
|
90
|
+
error.value=''
|
|
91
|
+
fieldcontainerclass.value=defaultcssclass
|
|
92
|
+
}
|
|
93
|
+
// console.log("validation result",props.setting.instancepath,)
|
|
94
|
+
// error.value = newvalue[props.setting.instancepath].message
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
</script>
|
|
98
|
+
<style scoped>
|
|
99
|
+
.simpleapp-input-container{
|
|
100
|
+
@apply flex flex-col
|
|
101
|
+
}
|
|
102
|
+
</style>
|