@maketribe/ms-app 3.0.21 → 3.0.23
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/dist/cjs/components/json-editor/index.d.ts +2 -2
- package/dist/cjs/components/json-editor/json-editor-options.d.ts +1 -1
- package/dist/cjs/components/json-editor/json-editor-options.js +1 -1
- package/dist/cjs/components/json-editor/json-editor-options.js.map +1 -1
- package/dist/cjs/components/json-editor/json-editor.d.ts +2 -2
- package/dist/cjs/components/json-editor/json-editor.js +3 -2
- package/dist/cjs/components/json-editor/json-editor.js.map +1 -1
- package/dist/cjs/components/material-select/material-select.js +3 -5
- package/dist/cjs/components/material-select/material-select.js.map +1 -1
- package/dist/cjs/core/component/ConfigComponents.js +8 -0
- package/dist/cjs/core/component/ConfigComponents.js.map +1 -1
- package/dist/cjs/dataview/config/ConfigForm.d.ts +2 -2
- package/dist/cjs/dataview/config/ConfigForm.js +27 -5
- package/dist/cjs/dataview/config/ConfigForm.js.map +1 -1
- package/dist/cjs/page/index/material/index.vue2.js +5 -3
- package/dist/cjs/page/index/material/index.vue2.js.map +1 -1
- package/dist/esm/components/json-editor/index.d.ts +2 -2
- package/dist/esm/components/json-editor/json-editor-options.d.ts +1 -1
- package/dist/esm/components/json-editor/json-editor-options.js +1 -1
- package/dist/esm/components/json-editor/json-editor-options.js.map +1 -1
- package/dist/esm/components/json-editor/json-editor.d.ts +2 -2
- package/dist/esm/components/json-editor/json-editor.js +3 -2
- package/dist/esm/components/json-editor/json-editor.js.map +1 -1
- package/dist/esm/components/material-select/material-select.js +3 -5
- package/dist/esm/components/material-select/material-select.js.map +1 -1
- package/dist/esm/core/component/ConfigComponents.js +8 -0
- package/dist/esm/core/component/ConfigComponents.js.map +1 -1
- package/dist/esm/dataview/config/ConfigForm.d.ts +2 -2
- package/dist/esm/dataview/config/ConfigForm.js +27 -5
- package/dist/esm/dataview/config/ConfigForm.js.map +1 -1
- package/dist/esm/page/index/material/index.vue2.js +5 -3
- package/dist/esm/page/index/material/index.vue2.js.map +1 -1
- package/dist/style/components/index.css +1 -1
- package/dist/style/components/json-editor.css +1 -0
- package/dist/style/index.css +1 -1
- package/dist/style/src/components/index.scss +1 -0
- package/dist/style/src/components/json-editor.scss +7 -0
- package/dist/style/src/page/dv/index.scss +1 -1
- package/package.json +3 -3
- package/src/components/json-editor/json-editor-options.ts +1 -1
- package/src/components/json-editor/json-editor.tsx +3 -2
- package/src/components/material-select/material-select.tsx +2 -3
- package/src/core/component/ConfigComponents.ts +9 -0
- package/src/dataview/config/ConfigForm.ts +27 -4
- package/src/page/index/material/index.vue +5 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const MKJsonEditor: import("@maketribe/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
2
2
|
readonly modelValue: {
|
|
3
|
-
readonly type: import("vue").PropType<
|
|
3
|
+
readonly type: import("vue").PropType<any>;
|
|
4
4
|
readonly required: true;
|
|
5
5
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
6
6
|
__mkPropKey: true;
|
|
@@ -10,7 +10,7 @@ export declare const MKJsonEditor: import("@maketribe/utils").SFCWithInstall<imp
|
|
|
10
10
|
"update:model-value": (modelValue: string) => boolean;
|
|
11
11
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
12
|
readonly modelValue: {
|
|
13
|
-
readonly type: import("vue").PropType<
|
|
13
|
+
readonly type: import("vue").PropType<any>;
|
|
14
14
|
readonly required: true;
|
|
15
15
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
16
16
|
__mkPropKey: true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtractPropTypes } from "vue";
|
|
2
2
|
export declare const jsonEditorProps: {
|
|
3
3
|
readonly modelValue: {
|
|
4
|
-
readonly type: import("vue").PropType<
|
|
4
|
+
readonly type: import("vue").PropType<any>;
|
|
5
5
|
readonly required: true;
|
|
6
6
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
7
7
|
__mkPropKey: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor-options.js","sources":["../../../../src/components/json-editor/json-editor-options.ts"],"sourcesContent":["import { ExtractPropTypes } from \"vue\";\nimport { buildProps } from \"@maketribe/utils\";\n\nexport const jsonEditorProps = buildProps({\n modelValue: {\n type:
|
|
1
|
+
{"version":3,"file":"json-editor-options.js","sources":["../../../../src/components/json-editor/json-editor-options.ts"],"sourcesContent":["import { ExtractPropTypes } from \"vue\";\nimport { buildProps } from \"@maketribe/utils\";\n\nexport const jsonEditorProps = buildProps({\n modelValue: {\n type: null,\n required: true,\n },\n disabled: {\n type: Boolean,\n default: false,\n },\n} as const);\n\nexport type JsonEditorProps = ExtractPropTypes<typeof jsonEditorProps>;\n\nexport const jsonEditorEmits = {\n \"update:model-value\": (modelValue: string) => true,\n};\n\nexport type jsonEditorEmits = typeof jsonEditorEmits;\n"],"names":["buildProps"],"mappings":";;;;AAGO,MAAM,kBAAkBA,gBAAW,CAAA;AAAA,EACxC,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,IAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EACA,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AACF,CAAU,EAAA;AAIH,MAAM,eAAkB,GAAA;AAAA,EAC7B,oBAAA,EAAsB,CAAC,UAAuB,KAAA,IAAA;AAChD;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{
|
|
2
2
|
readonly modelValue: {
|
|
3
|
-
readonly type: import("vue").PropType<
|
|
3
|
+
readonly type: import("vue").PropType<any>;
|
|
4
4
|
readonly required: true;
|
|
5
5
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
6
6
|
__mkPropKey: true;
|
|
@@ -10,7 +10,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
10
10
|
"update:model-value": (modelValue: string) => boolean;
|
|
11
11
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
12
|
readonly modelValue: {
|
|
13
|
-
readonly type: import("vue").PropType<
|
|
13
|
+
readonly type: import("vue").PropType<any>;
|
|
14
14
|
readonly required: true;
|
|
15
15
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
16
16
|
__mkPropKey: true;
|
|
@@ -6,18 +6,19 @@ var index = require('../../node_modules/.pnpm/@codemirror_lang-json@6.0.1/node_m
|
|
|
6
6
|
var jsonEditorOptions = require('./json-editor-options.js');
|
|
7
7
|
|
|
8
8
|
var jsonEditor = /* @__PURE__ */ vue.defineComponent({
|
|
9
|
-
name: "
|
|
9
|
+
name: "MKJsonEditor",
|
|
10
10
|
props: jsonEditorOptions.jsonEditorProps,
|
|
11
11
|
emits: jsonEditorOptions.jsonEditorEmits,
|
|
12
12
|
setup(props, {
|
|
13
13
|
emit
|
|
14
14
|
}) {
|
|
15
15
|
const modelValue = vue.computed({
|
|
16
|
-
get: () => props.modelValue,
|
|
16
|
+
get: () => props.modelValue || "",
|
|
17
17
|
set: (v) => emit("update:model-value", v)
|
|
18
18
|
});
|
|
19
19
|
return () => {
|
|
20
20
|
return vue.createVNode(vueCodemirror_esm.Codemirror, {
|
|
21
|
+
"class": "mk-json-editor",
|
|
21
22
|
"modelValue": vue.unref(modelValue),
|
|
22
23
|
"onUpdate:modelValue": (v) => modelValue.value = v,
|
|
23
24
|
"disabled": props.disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor.js","sources":["../../../../src/components/json-editor/json-editor.tsx"],"sourcesContent":["import { computed, defineComponent, unref } from \"vue\";\nimport { Codemirror } from \"vue-codemirror\";\nimport { json } from \"@codemirror/lang-json\";\nimport { jsonEditorEmits, jsonEditorProps } from \"./json-editor-options\";\n\nexport default defineComponent({\n name: \"
|
|
1
|
+
{"version":3,"file":"json-editor.js","sources":["../../../../src/components/json-editor/json-editor.tsx"],"sourcesContent":["import { computed, defineComponent, unref } from \"vue\";\nimport { Codemirror } from \"vue-codemirror\";\nimport { json } from \"@codemirror/lang-json\";\nimport { jsonEditorEmits, jsonEditorProps } from \"./json-editor-options\";\n\nexport default defineComponent({\n name: \"MKJsonEditor\",\n props: jsonEditorProps,\n emits: jsonEditorEmits,\n setup(props, { emit }) {\n const modelValue = computed({\n get: () => (props.modelValue as string) || \"\",\n set: (v: string) => emit(\"update:model-value\", v),\n });\n\n return () => {\n return (\n <Codemirror\n class=\"mk-json-editor\"\n modelValue={unref(modelValue)}\n onUpdate:modelValue={(v: string) => (modelValue.value = v)}\n disabled={props.disabled}\n extensions={[json()]}\n />\n );\n };\n },\n});\n"],"names":["defineComponent","name","props","jsonEditorProps","emits","jsonEditorEmits","setup","emit","modelValue","computed","get","set","v","_createVNode","Codemirror","unref","value","disabled","json"],"mappings":";;;;;;;AAKA,iCAA+BA,mBAAA,CAAA;AAAA,EAC7BC,IAAM,EAAA,cAAA;AAAA,EACNC,KAAOC,EAAAA,iCAAAA;AAAAA,EACPC,KAAOC,EAAAA,iCAAAA;AAAAA,EACPC,MAAMJ,KAAO,EAAA;AAAA,IAAEK,IAAAA;AAAAA,GAAQ,EAAA;AACrB,IAAA,MAAMC,aAAaC,YAAS,CAAA;AAAA,MAC1BC,GAAAA,EAAKA,MAAOR,KAAAA,CAAMM,UAAyB,IAAA,EAAA;AAAA,MAC3CG,GAAMC,EAAAA,CAAAA,CAAAA,KAAcL,IAAK,CAAA,oBAAA,EAAsBK,CAAC,CAAA;AAAA,KACjD,CAAA,CAAA;AAED,IAAA,OAAO,MAAM;AACX,MAAA,OAAAC,gBAAAC,4BAAA,EAAA;AAAA,QAAA,OAAA,EAAA,gBAAA;AAAA,QAAA,YAAA,EAGgBC,UAAMP,UAAU,CAAA;AAAA,QAAC,qBAAA,EACPI,CAAeJ,CAAAA,KAAAA,UAAAA,CAAWQ,KAAQJ,GAAAA,CAAAA;AAAAA,QAAE,YAChDV,KAAMe,CAAAA,QAAAA;AAAAA,QAAQ,YAAA,EACZ,CAACC,UAAAA,EAAM,CAAA;AAAA,SAAC,IAAA,CAAA,CAAA;AAAA,KAG1B,CAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -8,9 +8,7 @@ require('@maketribe/dm');
|
|
|
8
8
|
var MaterialComponents = require('../../core/component/MaterialComponents.js');
|
|
9
9
|
require('@maketribe/utils');
|
|
10
10
|
require('../../core/DataModelDefines.js');
|
|
11
|
-
require('
|
|
12
|
-
require('@maketribe/request');
|
|
13
|
-
require('@maketribe/locale');
|
|
11
|
+
var MSAppClient = require('../../core/MSAppClient.js');
|
|
14
12
|
require('../../dataview/department/DepartmentForm.js');
|
|
15
13
|
require('../../dataview/department/DepartmentTable.js');
|
|
16
14
|
require('../../dataview/department/DepartmentTree.js');
|
|
@@ -21,6 +19,7 @@ require('../../dataview/menu/MenuTable.js');
|
|
|
21
19
|
require('../../dataview/menu/MenuTree.js');
|
|
22
20
|
require('../../dataview/role/RoleForm.js');
|
|
23
21
|
require('../../dataview/role/RoleTable.js');
|
|
22
|
+
require('@maketribe/request');
|
|
24
23
|
require('../../dataview/route/RouteForm.js');
|
|
25
24
|
require('../../dataview/route/RouteTable.js');
|
|
26
25
|
require('../../dataview/config/ConfigForm.js');
|
|
@@ -38,7 +37,6 @@ require('../../dataview/log/operate-log/OperateLogTable.js');
|
|
|
38
37
|
require('../../dataview/log/login-log/LoginLogTable.js');
|
|
39
38
|
require('../../dataview/log/request-log/RequestLogTable.js');
|
|
40
39
|
require('../../dataview/log/local-log/LocalLogTree.js');
|
|
41
|
-
var useHttpRequest = require('../../composables/use-http-request.js');
|
|
42
40
|
|
|
43
41
|
var MaterialSelectConstructor = /* @__PURE__ */ vue.defineComponent({
|
|
44
42
|
name: "MKMaterialSelect",
|
|
@@ -49,7 +47,7 @@ var MaterialSelectConstructor = /* @__PURE__ */ vue.defineComponent({
|
|
|
49
47
|
}) {
|
|
50
48
|
const materialMan = props.materialMan ?? vue.reactive(new MaterialMan.MaterialMan({
|
|
51
49
|
components: new MaterialComponents.MaterialComponents(),
|
|
52
|
-
httpRequest:
|
|
50
|
+
httpRequest: MSAppClient.MSAppClient.instance.httpRequest
|
|
53
51
|
}));
|
|
54
52
|
const selectedPath = vue.ref("");
|
|
55
53
|
const selectedMaterial = vue.ref(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material-select.js","sources":["../../../../src/components/material-select/material-select.tsx"],"sourcesContent":["import {\n Ref,\n computed,\n defineComponent,\n reactive,\n ref,\n unref,\n watch,\n} from \"vue\";\nimport { ElDialog, ElButton } from \"element-plus\";\nimport MaterialList from \"../material-list/material-list.vue\";\nimport {\n materialSelectEmits,\n materialSelectProps,\n} from \"./material-select-options\";\nimport { MaterialComponents } from \"../../core\";\nimport { Material, MaterialMan } from \"../../dataview\";\
|
|
1
|
+
{"version":3,"file":"material-select.js","sources":["../../../../src/components/material-select/material-select.tsx"],"sourcesContent":["import {\n Ref,\n computed,\n defineComponent,\n reactive,\n ref,\n unref,\n watch,\n} from \"vue\";\nimport { ElDialog, ElButton } from \"element-plus\";\nimport MaterialList from \"../material-list/material-list.vue\";\nimport {\n materialSelectEmits,\n materialSelectProps,\n} from \"./material-select-options\";\nimport { MSAppClient, MaterialComponents } from \"../../core\";\nimport { Material, MaterialMan } from \"../../dataview\";\n\nexport default defineComponent({\n name: \"MKMaterialSelect\",\n props: materialSelectProps,\n emits: materialSelectEmits,\n setup(props, { emit }) {\n const materialMan =\n props.materialMan ??\n (reactive(\n new MaterialMan({\n components: new MaterialComponents(),\n httpRequest: MSAppClient.instance!.httpRequest,\n })\n ) as MaterialMan);\n\n const selectedPath = ref(\"\");\n const selectedMaterial: Ref<Material | null> = ref(null);\n const visible: Ref<boolean> = ref(true);\n\n watch(\n computed(() => props.modelValue),\n (modelValue) => {\n selectedPath.value = modelValue || \"\";\n },\n { immediate: true }\n );\n\n watch(\n computed(() => props.allowMaterialTypeValues),\n (allowMaterialTypeValues) => {\n materialMan.setAllowAccessMaterialTypeValues(\n allowMaterialTypeValues ?? []\n );\n },\n { immediate: true }\n );\n\n const handleConfirmClick = () => {\n visible.value = false;\n emit(\"update:model-value\", unref(selectedPath));\n emit(\"select\", unref(selectedPath));\n emit(\"materialChange\", unref(selectedMaterial)!);\n };\n\n const handleCancelClick = () => {\n visible.value = false;\n emit(\"cancel\");\n };\n\n return () => {\n return (\n <ElDialog\n width=\"70%\"\n modelValue={unref(visible)}\n onUpdate:modelValue={(v: boolean) => {\n visible.value = v;\n }}\n destroyOnClose\n appendToBody\n showClose={false}\n modal-class=\"mk-material-select\"\n v-slots={{\n footer: () => {\n return (\n <span class=\"mk-material-select__footer\">\n <ElButton type=\"primary\" onClick={handleConfirmClick}>\n 确定\n </ElButton>\n <ElButton onClick={handleCancelClick}>取消</ElButton>\n </span>\n );\n },\n }}\n >\n <MaterialList\n selectedPath={unref(selectedPath)}\n onSelectedChange={(material: Material) => {\n selectedPath.value = material.path;\n selectedMaterial.value = material;\n }}\n class=\"mk-material-select__list\"\n materialMan={materialMan}\n selectable={true}\n />\n </ElDialog>\n );\n };\n },\n});\n"],"names":["defineComponent","name","props","materialSelectProps","emits","materialSelectEmits","setup","emit","materialMan","reactive","MaterialMan","components","MaterialComponents","httpRequest","MSAppClient","instance","selectedPath","ref","selectedMaterial","visible","watch","computed","modelValue","value","immediate","allowMaterialTypeValues","setAllowAccessMaterialTypeValues","handleConfirmClick","unref","handleCancelClick","_createVNode","ElDialog","v","default","MaterialList","material","path","footer","ElButton","_createTextVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,gDAA+BA,mBAAA,CAAA;AAAA,EAC7BC,IAAM,EAAA,kBAAA;AAAA,EACNC,KAAOC,EAAAA,yCAAAA;AAAAA,EACPC,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A,EAAA;AAAA,YAAA,MAAA,EAAA,SAAA;AAAA,YAAA,SAEsCX,EAAAA,kBAAAA;AAAAA,WAAkB,EAAA;AAAA,YAAAM,OAAAA,EAAAA,MAAA,CAAAM,mBAAAA,CAAA,cAAA,CAAA,CAAA;AAAA,WAAAT,CAAAA,EAAAA,eAAAA,CAAAQ,oBAAA,EAAA;AAAA,YAAA,SAGjCT,EAAAA,iBAAAA;AAAAA,WAAiB,EAAA;AAAA,YAAAI,OAAAA,EAAAA,MAAA,CAAAM,mBAAAA,CAAA,cAAA,CAAA,CAAA;AAAA,WAAA,CAAA,CAAA,CAAA,CAAA;AAAA,SAG1C;AAAA,OAAC,CAAA,CAAA;AAAA,KAeT,CAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var vue = require('vue');
|
|
3
4
|
var elementPlus = require('element-plus');
|
|
4
5
|
var dm = require('@maketribe/dm');
|
|
5
6
|
|
|
@@ -19,6 +20,13 @@ class ConfigComponents extends dm.Components {
|
|
|
19
20
|
title: "\u6570\u503C\u8F93\u5165\u6846",
|
|
20
21
|
component: elementPlus.ElInputNumber
|
|
21
22
|
});
|
|
23
|
+
this.registerComponent({
|
|
24
|
+
name: "MKConfigJsonEditor",
|
|
25
|
+
title: "JSON",
|
|
26
|
+
component: vue.defineAsyncComponent(
|
|
27
|
+
() => Promise.resolve().then(function () { return require('../../components/json-editor/index.js'); })
|
|
28
|
+
)
|
|
29
|
+
});
|
|
22
30
|
}
|
|
23
31
|
}
|
|
24
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigComponents.js","sources":["../../../../src/core/component/ConfigComponents.ts"],"sourcesContent":["import { ElInput, ElInputNumber } from \"element-plus\";\nimport { Components } from \"@maketribe/dm\";\n\nexport class ConfigComponents extends Components {\n constructor() {\n super();\n\n this.registerComponent({\n name: \"MKConfigInput\",\n title: \"输入框\",\n component: ElInput,\n defaultProps: {\n type: \"textarea\",\n },\n });\n\n this.registerComponent({\n name: \"MKConfigInputNumber\",\n title: \"数值输入框\",\n component: ElInputNumber,\n });\n }\n}\n"],"names":["Components","ElInput","ElInputNumber"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfigComponents.js","sources":["../../../../src/core/component/ConfigComponents.ts"],"sourcesContent":["import { defineAsyncComponent } from \"vue\";\nimport { ElInput, ElInputNumber } from \"element-plus\";\nimport { Components } from \"@maketribe/dm\";\n\nexport class ConfigComponents extends Components {\n constructor() {\n super();\n\n this.registerComponent({\n name: \"MKConfigInput\",\n title: \"输入框\",\n component: ElInput,\n defaultProps: {\n type: \"textarea\",\n },\n });\n\n this.registerComponent({\n name: \"MKConfigInputNumber\",\n title: \"数值输入框\",\n component: ElInputNumber,\n });\n\n this.registerComponent({\n name: \"MKConfigJsonEditor\",\n title: \"JSON\",\n component: defineAsyncComponent(\n () => import(\"../../components/json-editor\")\n ),\n });\n }\n}\n"],"names":["Components","ElInput","ElInputNumber","defineAsyncComponent"],"mappings":";;;;;;AAIO,MAAM,yBAAyBA,aAAW,CAAA;AAAA,EAC/C,WAAc,GAAA;AACZ,IAAM,KAAA,EAAA,CAAA;AAEN,IAAA,IAAA,CAAK,iBAAkB,CAAA;AAAA,MACrB,IAAM,EAAA,eAAA;AAAA,MACN,KAAO,EAAA,oBAAA;AAAA,MACP,SAAW,EAAAC,mBAAA;AAAA,MACX,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,UAAA;AAAA,OACR;AAAA,KACD,CAAA,CAAA;AAED,IAAA,IAAA,CAAK,iBAAkB,CAAA;AAAA,MACrB,IAAM,EAAA,qBAAA;AAAA,MACN,KAAO,EAAA,gCAAA;AAAA,MACP,SAAW,EAAAC,yBAAA;AAAA,KACZ,CAAA,CAAA;AAED,IAAA,IAAA,CAAK,iBAAkB,CAAA;AAAA,MACrB,IAAM,EAAA,oBAAA;AAAA,MACN,KAAO,EAAA,MAAA;AAAA,MACP,SAAW,EAAAC,wBAAA;AAAA,QACT,MAAM,oDAAO,uCAA8B,KAAA;AAAA,OAC7C;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -17,6 +17,6 @@ export declare class ConfigForm extends DataForm<Config> implements ITypeResolve
|
|
|
17
17
|
handleTypeChange(data: Config | null): void;
|
|
18
18
|
formatItem(item: Config): Config;
|
|
19
19
|
formatSubmitData(data: any): any;
|
|
20
|
-
resolveType(type: string): "MKConfigInputNumber" | "MKConfigInput";
|
|
21
|
-
resolveItemType(config: Config): "MKConfigInputNumber" | "MKConfigInput";
|
|
20
|
+
resolveType(type: string): "MKConfigInputNumber" | "MKConfigJsonEditor" | "MKConfigInput";
|
|
21
|
+
resolveItemType(config: Config): "MKConfigInputNumber" | "MKConfigJsonEditor" | "MKConfigInput";
|
|
22
22
|
}
|
|
@@ -32,7 +32,8 @@ class ConfigForm extends dm.DataForm {
|
|
|
32
32
|
componentProps: {
|
|
33
33
|
options: [
|
|
34
34
|
{ value: "string", label: "\u5B57\u7B26\u4E32" },
|
|
35
|
-
{ value: "int", label: "\u6574\u6570" }
|
|
35
|
+
{ value: "int", label: "\u6574\u6570" },
|
|
36
|
+
{ value: "json", label: "JSON" }
|
|
36
37
|
],
|
|
37
38
|
onChange: () => {
|
|
38
39
|
this.handleTypeChange(this.data);
|
|
@@ -47,6 +48,20 @@ class ConfigForm extends dm.DataForm {
|
|
|
47
48
|
label: "\u914D\u7F6E\u503C",
|
|
48
49
|
required: true,
|
|
49
50
|
defaultValue: null,
|
|
51
|
+
rules: [
|
|
52
|
+
{
|
|
53
|
+
validator: (rule, value, callback) => {
|
|
54
|
+
if (this.data?.type === "json") {
|
|
55
|
+
try {
|
|
56
|
+
JSON.parse(value);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
callback(new Error("JSON\u683C\u5F0F\u9519\u8BEF"));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
callback();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
],
|
|
50
65
|
componentInfo: this.resolveType(defaultType)
|
|
51
66
|
})
|
|
52
67
|
]);
|
|
@@ -63,19 +78,26 @@ class ConfigForm extends dm.DataForm {
|
|
|
63
78
|
}
|
|
64
79
|
formatItem(item) {
|
|
65
80
|
let value = item.value;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
if (item.type !== "json") {
|
|
82
|
+
try {
|
|
83
|
+
value = JSON.parse(item.value);
|
|
84
|
+
} catch (e) {
|
|
85
|
+
}
|
|
69
86
|
}
|
|
70
87
|
return { ...item, value };
|
|
71
88
|
}
|
|
72
89
|
formatSubmitData(data) {
|
|
73
|
-
return {
|
|
90
|
+
return {
|
|
91
|
+
...data,
|
|
92
|
+
value: data.type === "json" ? data.value : JSON.stringify(data.value)
|
|
93
|
+
};
|
|
74
94
|
}
|
|
75
95
|
resolveType(type) {
|
|
76
96
|
switch (type) {
|
|
77
97
|
case "int":
|
|
78
98
|
return "MKConfigInputNumber";
|
|
99
|
+
case "json":
|
|
100
|
+
return "MKConfigJsonEditor";
|
|
79
101
|
default:
|
|
80
102
|
return "MKConfigInput";
|
|
81
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigForm.js","sources":["../../../../src/dataview/config/ConfigForm.ts"],"sourcesContent":["import {\n DataForm,\n DataFormOptions,\n FormColumn,\n IComponents,\n} from \"@maketribe/dm\";\nimport { defineDataForm } from \"../../define-data-form\";\nimport { ConfigComponents, ITypeResolver } from \"../../core\";\n\nexport type Config<T = any> = {\n id: string;\n key: string;\n type: string;\n value: T;\n};\n\nexport type ConfigFormOptions = DataFormOptions & {\n typeResolver?: ITypeResolver<Config>;\n configComponent?: IComponents;\n};\n\nexport class ConfigForm\n extends DataForm<Config>\n implements ITypeResolver<Config>\n{\n configComponent: IComponents;\n\n constructor(options: ConfigFormOptions = {}) {\n super({ name: \"ms-cfg\", ...options });\n\n this.configComponent = options.configComponent ?? new ConfigComponents();\n }\n\n protected async initialize() {\n await super.initialize();\n\n const defaultType = \"string\";\n this.setColumns([\n new FormColumn({ name: \"id\", label: \"编号\" }),\n new FormColumn({ name: \"key\", label: \"配置键\", required: true }),\n new FormColumn({\n name: \"type\",\n label: \"类型\",\n componentInfo: \"MKFormDataSelect\",\n defaultValue: defaultType,\n required: true,\n componentProps: {\n options: [\n { value: \"string\", label: \"字符串\" },\n { value: \"int\", label: \"整数\" },\n ],\n onChange: () => {\n this.handleTypeChange(this.data);\n\n if (this.data) {\n this.data.value = null;\n }\n },\n },\n }),\n new FormColumn({\n name: \"value\",\n label: \"配置值\",\n required: true,\n defaultValue: null,\n componentInfo: this.resolveType(defaultType),\n }),\n ]);\n\n this.dataChangeEvent.on(({ data }) => {\n this.handleTypeChange(data);\n });\n }\n\n handleTypeChange(data: Config | null) {\n if (!data) {\n return;\n }\n\n const valueFormColumn = this.getColumn(\"value\")!;\n valueFormColumn.componentInfo =\n this.configComponent.resolveComponent(this.resolveItemType(data!)) ||\n this.configComponent.resolveComponent(\"MKFormInput\")!;\n }\n\n formatItem(item: Config): Config {\n let value = item.value;\n\n try {\n
|
|
1
|
+
{"version":3,"file":"ConfigForm.js","sources":["../../../../src/dataview/config/ConfigForm.ts"],"sourcesContent":["import {\n DataForm,\n DataFormOptions,\n FormColumn,\n IComponents,\n} from \"@maketribe/dm\";\nimport { defineDataForm } from \"../../define-data-form\";\nimport { ConfigComponents, ITypeResolver } from \"../../core\";\n\nexport type Config<T = any> = {\n id: string;\n key: string;\n type: string;\n value: T;\n};\n\nexport type ConfigFormOptions = DataFormOptions & {\n typeResolver?: ITypeResolver<Config>;\n configComponent?: IComponents;\n};\n\nexport class ConfigForm\n extends DataForm<Config>\n implements ITypeResolver<Config>\n{\n configComponent: IComponents;\n\n constructor(options: ConfigFormOptions = {}) {\n super({ name: \"ms-cfg\", ...options });\n\n this.configComponent = options.configComponent ?? new ConfigComponents();\n }\n\n protected async initialize() {\n await super.initialize();\n\n const defaultType = \"string\";\n this.setColumns([\n new FormColumn({ name: \"id\", label: \"编号\" }),\n new FormColumn({ name: \"key\", label: \"配置键\", required: true }),\n new FormColumn({\n name: \"type\",\n label: \"类型\",\n componentInfo: \"MKFormDataSelect\",\n defaultValue: defaultType,\n required: true,\n componentProps: {\n options: [\n { value: \"string\", label: \"字符串\" },\n { value: \"int\", label: \"整数\" },\n { value: \"json\", label: \"JSON\" },\n ],\n onChange: () => {\n this.handleTypeChange(this.data);\n\n if (this.data) {\n this.data.value = null;\n }\n },\n },\n }),\n new FormColumn({\n name: \"value\",\n label: \"配置值\",\n required: true,\n defaultValue: null,\n rules: [\n {\n validator: (rule, value, callback) => {\n if (this.data?.type === \"json\") {\n try {\n JSON.parse(value);\n } catch (e) {\n callback(new Error(\"JSON格式错误\"));\n }\n }\n\n callback();\n },\n },\n ],\n componentInfo: this.resolveType(defaultType),\n }),\n ]);\n\n this.dataChangeEvent.on(({ data }) => {\n this.handleTypeChange(data);\n });\n }\n\n handleTypeChange(data: Config | null) {\n if (!data) {\n return;\n }\n\n const valueFormColumn = this.getColumn(\"value\")!;\n valueFormColumn.componentInfo =\n this.configComponent.resolveComponent(this.resolveItemType(data!)) ||\n this.configComponent.resolveComponent(\"MKFormInput\")!;\n }\n\n formatItem(item: Config): Config {\n let value = item.value;\n\n if (item.type !== \"json\") {\n try {\n value = JSON.parse(item.value);\n } catch (e) {}\n }\n\n return { ...item, value };\n }\n\n formatSubmitData(data: any) {\n return {\n ...data,\n value: data.type === \"json\" ? data.value : JSON.stringify(data.value),\n };\n }\n\n resolveType(type: string) {\n switch (type) {\n case \"int\":\n return \"MKConfigInputNumber\";\n case \"json\":\n return \"MKConfigJsonEditor\";\n default:\n return \"MKConfigInput\";\n }\n }\n\n resolveItemType(config: Config) {\n return this.resolveType(config.type);\n }\n}\n\ndefineDataForm(ConfigForm);\n"],"names":["DataForm","ConfigComponents","FormColumn","defineDataForm"],"mappings":";;;;;;;;;;;;;AAqBO,MAAM,mB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AAA,EAEA,WAAW,IAAsB,EAAA;AAC/B,IAAA,IAAI,QAAQ,IAAK,CAAA,KAAA,CAAA;AAEjB,IAAI,IAAA,IAAA,CAAK,SAAS,MAAQ,EAAA;AACxB,MAAI,IAAA;AACF,QAAQ,KAAA,GAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAK,KAAK,CAAA,CAAA;AAAA,eACtB,CAAG,EAAA;AAAA,OAAC;AAAA,KACf;AAEA,IAAO,OAAA,EAAE,GAAG,IAAA,EAAM,KAAM,EAAA,CAAA;AAAA,GAC1B;AAAA,EAEA,iBAAiB,IAAW,EAAA;AAC1B,IAAO,OAAA;AAAA,MACL,GAAG,IAAA;AAAA,MACH,KAAA,EAAO,KAAK,IAAS,KAAA,MAAA,GAAS,KAAK,KAAQ,GAAA,IAAA,CAAK,SAAU,CAAA,IAAA,CAAK,KAAK,CAAA;AAAA,KACtE,CAAA;AAAA,GACF;AAAA,EAEA,YAAY,IAAc,EAAA;AACxB,IAAA,QAAQ,IAAM;AAAA,MACZ,KAAK,KAAA;AACH,QAAO,OAAA,qBAAA,CAAA;AAAA,MACT,KAAK,MAAA;AACH,QAAO,OAAA,oBAAA,CAAA;AAAA,MACT;AACE,QAAO,OAAA,eAAA,CAAA;AAAA,KACX;AAAA,GACF;AAAA,EAEA,gBAAgB,MAAgB,EAAA;AAC9B,IAAO,OAAA,IAAA,CAAK,WAAY,CAAA,MAAA,CAAO,IAAI,CAAA,CAAA;AAAA,GACrC;AACF,CAAA;AAEAC,6BAAA,CAAe,UAAU,CAAA;;;;"}
|
|
@@ -85,8 +85,7 @@ require('../../../components/json-editor/index.js');
|
|
|
85
85
|
require('../../../components/upload-file/upload-file.js');
|
|
86
86
|
var MaterialComponents = require('../../../core/component/MaterialComponents.js');
|
|
87
87
|
require('../../../core/DataModelDefines.js');
|
|
88
|
-
require('
|
|
89
|
-
require('@maketribe/locale');
|
|
88
|
+
var MSAppClient = require('../../../core/MSAppClient.js');
|
|
90
89
|
require('../../../components/upload-file/context/material-upload-context.js');
|
|
91
90
|
require('../../../components/upload-file/context/material-upload-context-options.js');
|
|
92
91
|
require('../../../components/upload-file/context/web-file-upload-context.js');
|
|
@@ -98,7 +97,10 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
98
97
|
__name: "index",
|
|
99
98
|
setup(__props) {
|
|
100
99
|
const materialMan = vue.reactive(
|
|
101
|
-
new MaterialMan.MaterialMan({
|
|
100
|
+
new MaterialMan.MaterialMan({
|
|
101
|
+
components: new MaterialComponents.MaterialComponents(),
|
|
102
|
+
httpRequest: MSAppClient.MSAppClient.instance.httpRequest
|
|
103
|
+
})
|
|
102
104
|
);
|
|
103
105
|
return (_ctx, _cache) => {
|
|
104
106
|
return vue.openBlock(), vue.createBlock(vue.unref(index.MKMaterialList), { "material-man": materialMan }, null, 8, ["material-man"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue2.js","sources":["../../../../../src/page/index/material/index.vue"],"sourcesContent":["<template>\n <MKMaterialList :material-man=\"materialMan\" />\n</template>\n<script setup lang=\"ts\">\nimport { reactive } from \"vue\";\nimport { MaterialMan } from \"../../../dataview\";\nimport { MKMaterialList } from \"../../../components\";\nimport { MaterialComponents } from \"../../../core\";\n\nconst materialMan = reactive(\n new MaterialMan({
|
|
1
|
+
{"version":3,"file":"index.vue2.js","sources":["../../../../../src/page/index/material/index.vue"],"sourcesContent":["<template>\n <MKMaterialList :material-man=\"materialMan\" />\n</template>\n<script setup lang=\"ts\">\nimport { reactive } from \"vue\";\nimport { MaterialMan } from \"../../../dataview\";\nimport { MKMaterialList } from \"../../../components\";\nimport { MSAppClient, MaterialComponents } from \"../../../core\";\n\nconst materialMan = reactive(\n new MaterialMan({\n components: new MaterialComponents(),\n httpRequest: MSAppClient.instance!.httpRequest,\n })\n) as MaterialMan;\n</script>\n"],"names":["reactive","MaterialMan","MaterialComponents","MSAppClient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAA,MAAM,WAAc,GAAAA,YAAA;AAAA,MAClB,IAAIC,uBAAY,CAAA;AAAA,QACd,UAAA,EAAY,IAAIC,qCAAmB,EAAA;AAAA,QACnC,WAAA,EAAaC,wBAAY,QAAU,CAAA,WAAA;AAAA,OACpC,CAAA;AAAA,KACH,CAAA;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const MKJsonEditor: import("@maketribe/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
2
2
|
readonly modelValue: {
|
|
3
|
-
readonly type: import("vue").PropType<
|
|
3
|
+
readonly type: import("vue").PropType<any>;
|
|
4
4
|
readonly required: true;
|
|
5
5
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
6
6
|
__mkPropKey: true;
|
|
@@ -10,7 +10,7 @@ export declare const MKJsonEditor: import("@maketribe/utils").SFCWithInstall<imp
|
|
|
10
10
|
"update:model-value": (modelValue: string) => boolean;
|
|
11
11
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
12
|
readonly modelValue: {
|
|
13
|
-
readonly type: import("vue").PropType<
|
|
13
|
+
readonly type: import("vue").PropType<any>;
|
|
14
14
|
readonly required: true;
|
|
15
15
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
16
16
|
__mkPropKey: true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtractPropTypes } from "vue";
|
|
2
2
|
export declare const jsonEditorProps: {
|
|
3
3
|
readonly modelValue: {
|
|
4
|
-
readonly type: import("vue").PropType<
|
|
4
|
+
readonly type: import("vue").PropType<any>;
|
|
5
5
|
readonly required: true;
|
|
6
6
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
7
7
|
__mkPropKey: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor-options.js","sources":["../../../../src/components/json-editor/json-editor-options.ts"],"sourcesContent":["import { ExtractPropTypes } from \"vue\";\nimport { buildProps } from \"@maketribe/utils\";\n\nexport const jsonEditorProps = buildProps({\n modelValue: {\n type:
|
|
1
|
+
{"version":3,"file":"json-editor-options.js","sources":["../../../../src/components/json-editor/json-editor-options.ts"],"sourcesContent":["import { ExtractPropTypes } from \"vue\";\nimport { buildProps } from \"@maketribe/utils\";\n\nexport const jsonEditorProps = buildProps({\n modelValue: {\n type: null,\n required: true,\n },\n disabled: {\n type: Boolean,\n default: false,\n },\n} as const);\n\nexport type JsonEditorProps = ExtractPropTypes<typeof jsonEditorProps>;\n\nexport const jsonEditorEmits = {\n \"update:model-value\": (modelValue: string) => true,\n};\n\nexport type jsonEditorEmits = typeof jsonEditorEmits;\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,UAAW,CAAA;AAAA,EACxC,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,IAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EACA,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AACF,CAAU,EAAA;AAIH,MAAM,eAAkB,GAAA;AAAA,EAC7B,oBAAA,EAAsB,CAAC,UAAuB,KAAA,IAAA;AAChD;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{
|
|
2
2
|
readonly modelValue: {
|
|
3
|
-
readonly type: import("vue").PropType<
|
|
3
|
+
readonly type: import("vue").PropType<any>;
|
|
4
4
|
readonly required: true;
|
|
5
5
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
6
6
|
__mkPropKey: true;
|
|
@@ -10,7 +10,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
10
10
|
"update:model-value": (modelValue: string) => boolean;
|
|
11
11
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
12
|
readonly modelValue: {
|
|
13
|
-
readonly type: import("vue").PropType<
|
|
13
|
+
readonly type: import("vue").PropType<any>;
|
|
14
14
|
readonly required: true;
|
|
15
15
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
16
16
|
__mkPropKey: true;
|
|
@@ -4,18 +4,19 @@ import { json } from '../../node_modules/.pnpm/@codemirror_lang-json@6.0.1/node_
|
|
|
4
4
|
import { jsonEditorProps, jsonEditorEmits } from './json-editor-options.js';
|
|
5
5
|
|
|
6
6
|
var jsonEditor = /* @__PURE__ */ defineComponent({
|
|
7
|
-
name: "
|
|
7
|
+
name: "MKJsonEditor",
|
|
8
8
|
props: jsonEditorProps,
|
|
9
9
|
emits: jsonEditorEmits,
|
|
10
10
|
setup(props, {
|
|
11
11
|
emit
|
|
12
12
|
}) {
|
|
13
13
|
const modelValue = computed({
|
|
14
|
-
get: () => props.modelValue,
|
|
14
|
+
get: () => props.modelValue || "",
|
|
15
15
|
set: (v) => emit("update:model-value", v)
|
|
16
16
|
});
|
|
17
17
|
return () => {
|
|
18
18
|
return createVNode(T, {
|
|
19
|
+
"class": "mk-json-editor",
|
|
19
20
|
"modelValue": unref(modelValue),
|
|
20
21
|
"onUpdate:modelValue": (v) => modelValue.value = v,
|
|
21
22
|
"disabled": props.disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor.js","sources":["../../../../src/components/json-editor/json-editor.tsx"],"sourcesContent":["import { computed, defineComponent, unref } from \"vue\";\nimport { Codemirror } from \"vue-codemirror\";\nimport { json } from \"@codemirror/lang-json\";\nimport { jsonEditorEmits, jsonEditorProps } from \"./json-editor-options\";\n\nexport default defineComponent({\n name: \"
|
|
1
|
+
{"version":3,"file":"json-editor.js","sources":["../../../../src/components/json-editor/json-editor.tsx"],"sourcesContent":["import { computed, defineComponent, unref } from \"vue\";\nimport { Codemirror } from \"vue-codemirror\";\nimport { json } from \"@codemirror/lang-json\";\nimport { jsonEditorEmits, jsonEditorProps } from \"./json-editor-options\";\n\nexport default defineComponent({\n name: \"MKJsonEditor\",\n props: jsonEditorProps,\n emits: jsonEditorEmits,\n setup(props, { emit }) {\n const modelValue = computed({\n get: () => (props.modelValue as string) || \"\",\n set: (v: string) => emit(\"update:model-value\", v),\n });\n\n return () => {\n return (\n <Codemirror\n class=\"mk-json-editor\"\n modelValue={unref(modelValue)}\n onUpdate:modelValue={(v: string) => (modelValue.value = v)}\n disabled={props.disabled}\n extensions={[json()]}\n />\n );\n };\n },\n});\n"],"names":["name","props","jsonEditorProps","emits","jsonEditorEmits","setup","emit","modelValue","computed","get","set","v","_createVNode","Codemirror","unref","value","disabled","json"],"mappings":";;;;;AAKA,iCAA+B,eAAA,CAAA;AAAA,EAC7BA,IAAM,EAAA,cAAA;AAAA,EACNC,KAAOC,EAAAA,eAAAA;AAAAA,EACPC,KAAOC,EAAAA,eAAAA;AAAAA,EACPC,MAAMJ,KAAO,EAAA;AAAA,IAAEK,IAAAA;AAAAA,GAAQ,EAAA;AACrB,IAAA,MAAMC,aAAaC,QAAS,CAAA;AAAA,MAC1BC,GAAAA,EAAKA,MAAOR,KAAAA,CAAMM,UAAyB,IAAA,EAAA;AAAA,MAC3CG,GAAMC,EAAAA,CAAAA,CAAAA,KAAcL,IAAK,CAAA,oBAAA,EAAsBK,CAAC,CAAA;AAAA,KACjD,CAAA,CAAA;AAED,IAAA,OAAO,MAAM;AACX,MAAA,OAAAC,YAAAC,CAAA,EAAA;AAAA,QAAA,OAAA,EAAA,gBAAA;AAAA,QAAA,YAAA,EAGgBC,MAAMP,UAAU,CAAA;AAAA,QAAC,qBAAA,EACPI,CAAeJ,CAAAA,KAAAA,UAAAA,CAAWQ,KAAQJ,GAAAA,CAAAA;AAAAA,QAAE,YAChDV,KAAMe,CAAAA,QAAAA;AAAAA,QAAQ,YAAA,EACZ,CAACC,IAAAA,EAAM,CAAA;AAAA,SAAC,IAAA,CAAA,CAAA;AAAA,KAG1B,CAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -6,9 +6,7 @@ import '@maketribe/dm';
|
|
|
6
6
|
import { MaterialComponents } from '../../core/component/MaterialComponents.js';
|
|
7
7
|
import '@maketribe/utils';
|
|
8
8
|
import '../../core/DataModelDefines.js';
|
|
9
|
-
import '
|
|
10
|
-
import '@maketribe/request';
|
|
11
|
-
import '@maketribe/locale';
|
|
9
|
+
import { MSAppClient } from '../../core/MSAppClient.js';
|
|
12
10
|
import '../../dataview/department/DepartmentForm.js';
|
|
13
11
|
import '../../dataview/department/DepartmentTable.js';
|
|
14
12
|
import '../../dataview/department/DepartmentTree.js';
|
|
@@ -19,6 +17,7 @@ import '../../dataview/menu/MenuTable.js';
|
|
|
19
17
|
import '../../dataview/menu/MenuTree.js';
|
|
20
18
|
import '../../dataview/role/RoleForm.js';
|
|
21
19
|
import '../../dataview/role/RoleTable.js';
|
|
20
|
+
import '@maketribe/request';
|
|
22
21
|
import '../../dataview/route/RouteForm.js';
|
|
23
22
|
import '../../dataview/route/RouteTable.js';
|
|
24
23
|
import '../../dataview/config/ConfigForm.js';
|
|
@@ -36,7 +35,6 @@ import '../../dataview/log/operate-log/OperateLogTable.js';
|
|
|
36
35
|
import '../../dataview/log/login-log/LoginLogTable.js';
|
|
37
36
|
import '../../dataview/log/request-log/RequestLogTable.js';
|
|
38
37
|
import '../../dataview/log/local-log/LocalLogTree.js';
|
|
39
|
-
import { useHttpRequest } from '../../composables/use-http-request.js';
|
|
40
38
|
|
|
41
39
|
var MaterialSelectConstructor = /* @__PURE__ */ defineComponent({
|
|
42
40
|
name: "MKMaterialSelect",
|
|
@@ -47,7 +45,7 @@ var MaterialSelectConstructor = /* @__PURE__ */ defineComponent({
|
|
|
47
45
|
}) {
|
|
48
46
|
const materialMan = props.materialMan ?? reactive(new MaterialMan({
|
|
49
47
|
components: new MaterialComponents(),
|
|
50
|
-
httpRequest:
|
|
48
|
+
httpRequest: MSAppClient.instance.httpRequest
|
|
51
49
|
}));
|
|
52
50
|
const selectedPath = ref("");
|
|
53
51
|
const selectedMaterial = ref(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material-select.js","sources":["../../../../src/components/material-select/material-select.tsx"],"sourcesContent":["import {\n Ref,\n computed,\n defineComponent,\n reactive,\n ref,\n unref,\n watch,\n} from \"vue\";\nimport { ElDialog, ElButton } from \"element-plus\";\nimport MaterialList from \"../material-list/material-list.vue\";\nimport {\n materialSelectEmits,\n materialSelectProps,\n} from \"./material-select-options\";\nimport { MaterialComponents } from \"../../core\";\nimport { Material, MaterialMan } from \"../../dataview\";\
|
|
1
|
+
{"version":3,"file":"material-select.js","sources":["../../../../src/components/material-select/material-select.tsx"],"sourcesContent":["import {\n Ref,\n computed,\n defineComponent,\n reactive,\n ref,\n unref,\n watch,\n} from \"vue\";\nimport { ElDialog, ElButton } from \"element-plus\";\nimport MaterialList from \"../material-list/material-list.vue\";\nimport {\n materialSelectEmits,\n materialSelectProps,\n} from \"./material-select-options\";\nimport { MSAppClient, MaterialComponents } from \"../../core\";\nimport { Material, MaterialMan } from \"../../dataview\";\n\nexport default defineComponent({\n name: \"MKMaterialSelect\",\n props: materialSelectProps,\n emits: materialSelectEmits,\n setup(props, { emit }) {\n const materialMan =\n props.materialMan ??\n (reactive(\n new MaterialMan({\n components: new MaterialComponents(),\n httpRequest: MSAppClient.instance!.httpRequest,\n })\n ) as MaterialMan);\n\n const selectedPath = ref(\"\");\n const selectedMaterial: Ref<Material | null> = ref(null);\n const visible: Ref<boolean> = ref(true);\n\n watch(\n computed(() => props.modelValue),\n (modelValue) => {\n selectedPath.value = modelValue || \"\";\n },\n { immediate: true }\n );\n\n watch(\n computed(() => props.allowMaterialTypeValues),\n (allowMaterialTypeValues) => {\n materialMan.setAllowAccessMaterialTypeValues(\n allowMaterialTypeValues ?? []\n );\n },\n { immediate: true }\n );\n\n const handleConfirmClick = () => {\n visible.value = false;\n emit(\"update:model-value\", unref(selectedPath));\n emit(\"select\", unref(selectedPath));\n emit(\"materialChange\", unref(selectedMaterial)!);\n };\n\n const handleCancelClick = () => {\n visible.value = false;\n emit(\"cancel\");\n };\n\n return () => {\n return (\n <ElDialog\n width=\"70%\"\n modelValue={unref(visible)}\n onUpdate:modelValue={(v: boolean) => {\n visible.value = v;\n }}\n destroyOnClose\n appendToBody\n showClose={false}\n modal-class=\"mk-material-select\"\n v-slots={{\n footer: () => {\n return (\n <span class=\"mk-material-select__footer\">\n <ElButton type=\"primary\" onClick={handleConfirmClick}>\n 确定\n </ElButton>\n <ElButton onClick={handleCancelClick}>取消</ElButton>\n </span>\n );\n },\n }}\n >\n <MaterialList\n selectedPath={unref(selectedPath)}\n onSelectedChange={(material: Material) => {\n selectedPath.value = material.path;\n selectedMaterial.value = material;\n }}\n class=\"mk-material-select__list\"\n materialMan={materialMan}\n selectable={true}\n />\n </ElDialog>\n );\n };\n },\n});\n"],"names":["name","props","materialSelectProps","emits","materialSelectEmits","setup","emit","materialMan","reactive","MaterialMan","components","MaterialComponents","httpRequest","MSAppClient","instance","selectedPath","ref","selectedMaterial","visible","watch","computed","modelValue","value","immediate","allowMaterialTypeValues","setAllowAccessMaterialTypeValues","handleConfirmClick","unref","handleCancelClick","_createVNode","ElDialog","v","default","MaterialList","material","path","footer","ElButton","_createTextVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,gDAA+B,eAAA,CAAA;AAAA,EAC7BA,IAAM,EAAA,kBAAA;AAAA,EACNC,KAAOC,EAAAA,mBAAAA;AAAAA,EACPC,KAAOC,EAAAA,mBAAAA;AAAAA,EACPC,MAAMJ,KAAO,EAAA;AAAA,IAAEK,IAAAA;AAAAA,GAAQ,EAAA;AACrB,IAAA,MAAMC,WACJN,GAAAA,KAAAA,CAAMM,WACLC,IAAAA,QAAAA,CACC,IAAIC,WAAY,CAAA;AAAA,MACdC,UAAAA,EAAY,IAAIC,k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AAA,SAGjCT,EAAAA,iBAAAA;AAAAA,WAAiB,EAAA;AAAA,YAAAI,OAAAA,EAAAA,MAAA,CAAAM,eAAAA,CAAA,cAAA,CAAA,CAAA;AAAA,WAAA,CAAA,CAAA,CAAA,CAAA;AAAA,SAG1C;AAAA,OAAC,CAAA,CAAA;AAAA,KAeT,CAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defineAsyncComponent } from 'vue';
|
|
1
2
|
import { ElInput, ElInputNumber } from 'element-plus';
|
|
2
3
|
import { Components } from '@maketribe/dm';
|
|
3
4
|
|
|
@@ -17,6 +18,13 @@ class ConfigComponents extends Components {
|
|
|
17
18
|
title: "\u6570\u503C\u8F93\u5165\u6846",
|
|
18
19
|
component: ElInputNumber
|
|
19
20
|
});
|
|
21
|
+
this.registerComponent({
|
|
22
|
+
name: "MKConfigJsonEditor",
|
|
23
|
+
title: "JSON",
|
|
24
|
+
component: defineAsyncComponent(
|
|
25
|
+
() => import('../../components/json-editor/index.js')
|
|
26
|
+
)
|
|
27
|
+
});
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigComponents.js","sources":["../../../../src/core/component/ConfigComponents.ts"],"sourcesContent":["import { ElInput, ElInputNumber } from \"element-plus\";\nimport { Components } from \"@maketribe/dm\";\n\nexport class ConfigComponents extends Components {\n constructor() {\n super();\n\n this.registerComponent({\n name: \"MKConfigInput\",\n title: \"输入框\",\n component: ElInput,\n defaultProps: {\n type: \"textarea\",\n },\n });\n\n this.registerComponent({\n name: \"MKConfigInputNumber\",\n title: \"数值输入框\",\n component: ElInputNumber,\n });\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfigComponents.js","sources":["../../../../src/core/component/ConfigComponents.ts"],"sourcesContent":["import { defineAsyncComponent } from \"vue\";\nimport { ElInput, ElInputNumber } from \"element-plus\";\nimport { Components } from \"@maketribe/dm\";\n\nexport class ConfigComponents extends Components {\n constructor() {\n super();\n\n this.registerComponent({\n name: \"MKConfigInput\",\n title: \"输入框\",\n component: ElInput,\n defaultProps: {\n type: \"textarea\",\n },\n });\n\n this.registerComponent({\n name: \"MKConfigInputNumber\",\n title: \"数值输入框\",\n component: ElInputNumber,\n });\n\n this.registerComponent({\n name: \"MKConfigJsonEditor\",\n title: \"JSON\",\n component: defineAsyncComponent(\n () => import(\"../../components/json-editor\")\n ),\n });\n }\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,yBAAyB,UAAW,CAAA;AAAA,EAC/C,WAAc,GAAA;AACZ,IAAM,KAAA,EAAA,CAAA;AAEN,IAAA,IAAA,CAAK,iBAAkB,CAAA;AAAA,MACrB,IAAM,EAAA,eAAA;AAAA,MACN,KAAO,EAAA,oBAAA;AAAA,MACP,SAAW,EAAA,OAAA;AAAA,MACX,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,UAAA;AAAA,OACR;AAAA,KACD,CAAA,CAAA;AAED,IAAA,IAAA,CAAK,iBAAkB,CAAA;AAAA,MACrB,IAAM,EAAA,qBAAA;AAAA,MACN,KAAO,EAAA,gCAAA;AAAA,MACP,SAAW,EAAA,aAAA;AAAA,KACZ,CAAA,CAAA;AAED,IAAA,IAAA,CAAK,iBAAkB,CAAA;AAAA,MACrB,IAAM,EAAA,oBAAA;AAAA,MACN,KAAO,EAAA,MAAA;AAAA,MACP,SAAW,EAAA,oBAAA;AAAA,QACT,MAAM,OAAO,uCAA8B,CAAA;AAAA,OAC7C;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -17,6 +17,6 @@ export declare class ConfigForm extends DataForm<Config> implements ITypeResolve
|
|
|
17
17
|
handleTypeChange(data: Config | null): void;
|
|
18
18
|
formatItem(item: Config): Config;
|
|
19
19
|
formatSubmitData(data: any): any;
|
|
20
|
-
resolveType(type: string): "MKConfigInputNumber" | "MKConfigInput";
|
|
21
|
-
resolveItemType(config: Config): "MKConfigInputNumber" | "MKConfigInput";
|
|
20
|
+
resolveType(type: string): "MKConfigInputNumber" | "MKConfigJsonEditor" | "MKConfigInput";
|
|
21
|
+
resolveItemType(config: Config): "MKConfigInputNumber" | "MKConfigJsonEditor" | "MKConfigInput";
|
|
22
22
|
}
|
|
@@ -30,7 +30,8 @@ class ConfigForm extends DataForm {
|
|
|
30
30
|
componentProps: {
|
|
31
31
|
options: [
|
|
32
32
|
{ value: "string", label: "\u5B57\u7B26\u4E32" },
|
|
33
|
-
{ value: "int", label: "\u6574\u6570" }
|
|
33
|
+
{ value: "int", label: "\u6574\u6570" },
|
|
34
|
+
{ value: "json", label: "JSON" }
|
|
34
35
|
],
|
|
35
36
|
onChange: () => {
|
|
36
37
|
this.handleTypeChange(this.data);
|
|
@@ -45,6 +46,20 @@ class ConfigForm extends DataForm {
|
|
|
45
46
|
label: "\u914D\u7F6E\u503C",
|
|
46
47
|
required: true,
|
|
47
48
|
defaultValue: null,
|
|
49
|
+
rules: [
|
|
50
|
+
{
|
|
51
|
+
validator: (rule, value, callback) => {
|
|
52
|
+
if (this.data?.type === "json") {
|
|
53
|
+
try {
|
|
54
|
+
JSON.parse(value);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
callback(new Error("JSON\u683C\u5F0F\u9519\u8BEF"));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
callback();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
],
|
|
48
63
|
componentInfo: this.resolveType(defaultType)
|
|
49
64
|
})
|
|
50
65
|
]);
|
|
@@ -61,19 +76,26 @@ class ConfigForm extends DataForm {
|
|
|
61
76
|
}
|
|
62
77
|
formatItem(item) {
|
|
63
78
|
let value = item.value;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
if (item.type !== "json") {
|
|
80
|
+
try {
|
|
81
|
+
value = JSON.parse(item.value);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
}
|
|
67
84
|
}
|
|
68
85
|
return { ...item, value };
|
|
69
86
|
}
|
|
70
87
|
formatSubmitData(data) {
|
|
71
|
-
return {
|
|
88
|
+
return {
|
|
89
|
+
...data,
|
|
90
|
+
value: data.type === "json" ? data.value : JSON.stringify(data.value)
|
|
91
|
+
};
|
|
72
92
|
}
|
|
73
93
|
resolveType(type) {
|
|
74
94
|
switch (type) {
|
|
75
95
|
case "int":
|
|
76
96
|
return "MKConfigInputNumber";
|
|
97
|
+
case "json":
|
|
98
|
+
return "MKConfigJsonEditor";
|
|
77
99
|
default:
|
|
78
100
|
return "MKConfigInput";
|
|
79
101
|
}
|