@vipl520/dk-ui 1.0.16 → 1.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.js +908 -428
  3. package/dist/index.min.js +7 -7
  4. package/dist/index.min.js.map +1 -1
  5. package/dist/index.min.mjs +7 -7
  6. package/dist/index.min.mjs.map +1 -1
  7. package/dist/index.mjs +908 -428
  8. package/dist/web-types.json +1 -1
  9. package/es/api/diy.d.ts +8 -0
  10. package/es/api/diy.mjs +64 -0
  11. package/es/api/diy.mjs.map +1 -0
  12. package/es/form/src/form.vue2.mjs +9 -0
  13. package/es/form/src/form.vue2.mjs.map +1 -1
  14. package/es/page-diy/index.d.ts +2 -0
  15. package/es/page-diy/src/components/DiyCloud.vue.d.ts +51 -0
  16. package/es/page-diy/src/components/DiyCloud.vue.mjs +414 -0
  17. package/es/page-diy/src/components/DiyCloud.vue.mjs.map +1 -0
  18. package/es/page-diy/src/page-diy.vue.d.ts +2 -0
  19. package/es/page-diy/src/page-diy.vue.mjs +28 -10
  20. package/es/page-diy/src/page-diy.vue.mjs.map +1 -1
  21. package/es/page-diy/style/cloud.css +1 -0
  22. package/es/page-diy/style/cloud.scss +100 -0
  23. package/es/page-diy/style/index.css +1 -1
  24. package/es/page-diy/style/index.scss +1 -0
  25. package/lib/api/diy.d.ts +8 -0
  26. package/lib/api/diy.js +73 -0
  27. package/lib/api/diy.js.map +1 -0
  28. package/lib/form/src/form.vue2.js +9 -0
  29. package/lib/form/src/form.vue2.js.map +1 -1
  30. package/lib/page-diy/index.d.ts +2 -0
  31. package/lib/page-diy/src/components/DiyCloud.vue.d.ts +51 -0
  32. package/lib/page-diy/src/components/DiyCloud.vue.js +418 -0
  33. package/lib/page-diy/src/components/DiyCloud.vue.js.map +1 -0
  34. package/lib/page-diy/src/page-diy.vue.d.ts +2 -0
  35. package/lib/page-diy/src/page-diy.vue.js +28 -10
  36. package/lib/page-diy/src/page-diy.vue.js.map +1 -1
  37. package/lib/page-diy/style/cloud.css +1 -0
  38. package/lib/page-diy/style/cloud.scss +100 -0
  39. package/lib/page-diy/style/index.css +1 -1
  40. package/lib/page-diy/style/index.scss +1 -0
  41. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "dk",
5
- "version": "1.0.15",
5
+ "version": "1.0.17",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {
@@ -0,0 +1,8 @@
1
+ export declare function saveDiyPage(key: any, type: any, diyData: any): import("@vipl520/utils/src/types").ApiPromise;
2
+ export declare function getDiyConfig(key: any, type: any): import("@vipl520/utils/src/types").ApiPromise;
3
+ export declare function getList(page_name: any, page: any, search: any, size: any): import("@vipl520/utils/src/types").ApiPromise;
4
+ export declare function down(id: number): import("@vipl520/utils/src/types").ApiPromise;
5
+ export declare function getDiyForm(id: number, page_name: any, diy_data: any): import("@vipl520/utils/src/types").ApiPromise;
6
+ export declare function getSiteMsg(): import("@vipl520/utils/src/types").ApiPromise;
7
+ export declare function getCheckForm(id: number, state: any): import("@vipl520/utils/src/types").ApiPromise;
8
+ export declare function delDiy(id: number): import("@vipl520/utils/src/types").ApiPromise;
package/es/api/diy.mjs ADDED
@@ -0,0 +1,64 @@
1
+ import { request } from '@vipl520/utils';
2
+
3
+ function saveDiyPage(key, type, diyData) {
4
+ return request({
5
+ url: "/adminapi/addon_diy/save",
6
+ method: "post",
7
+ data: { key, type, diyData }
8
+ });
9
+ }
10
+ function getDiyConfig(key, type) {
11
+ return request({
12
+ url: "/adminapi/addon_diy/get",
13
+ method: "post",
14
+ data: { key, type }
15
+ });
16
+ }
17
+ const cloudDiy = "/adminapi/cloud_diy/";
18
+ function getList(page_name, page, search, size) {
19
+ return request({
20
+ url: cloudDiy + "getList",
21
+ method: "post",
22
+ // eslint-disable-next-line camelcase
23
+ data: { page_name, page, search, size }
24
+ });
25
+ }
26
+ function down(id) {
27
+ return request({
28
+ url: cloudDiy + "down",
29
+ method: "post",
30
+ data: { id }
31
+ });
32
+ }
33
+ function getDiyForm(id, page_name, diy_data) {
34
+ return request({
35
+ url: cloudDiy + "getDiyForm",
36
+ method: "post",
37
+ // eslint-disable-next-line camelcase
38
+ data: { id, page_name, diy_data }
39
+ });
40
+ }
41
+ function getSiteMsg() {
42
+ return request({
43
+ url: cloudDiy + "getSiteMsg",
44
+ method: "post",
45
+ data: {}
46
+ });
47
+ }
48
+ function getCheckForm(id, state) {
49
+ return request({
50
+ url: cloudDiy + "getCheckForm",
51
+ method: "post",
52
+ data: { id, state }
53
+ });
54
+ }
55
+ function delDiy(id) {
56
+ return request({
57
+ url: cloudDiy + "delDiy",
58
+ method: "post",
59
+ data: { id }
60
+ });
61
+ }
62
+
63
+ export { delDiy, down, getCheckForm, getDiyConfig, getDiyForm, getList, getSiteMsg, saveDiyPage };
64
+ //# sourceMappingURL=diy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diy.mjs","sources":["../../src/api/diy.ts"],"sourcesContent":["import { request } from '@vipl520/utils'\n\n// 列表\nexport function saveDiyPage(key: any, type: any, diyData: any) {\n return request({\n url: '/adminapi/addon_diy/save',\n method: 'post',\n data: { key, type, diyData },\n })\n}\n\nexport function getDiyConfig(key: any, type: any) {\n return request({\n url: '/adminapi/addon_diy/get',\n method: 'post',\n data: { key, type },\n })\n}\n\n// 云端\nconst cloudDiy = '/adminapi/cloud_diy/'\n\n// eslint-disable-next-line camelcase\nexport function getList(page_name: any, page: any, search: any, size: any) {\n return request({\n url: cloudDiy + 'getList',\n method: 'post',\n // eslint-disable-next-line camelcase\n data: { page_name, page, search, size },\n })\n}\n\nexport function down(id: number) {\n return request({\n url: cloudDiy + 'down',\n method: 'post',\n data: { id },\n })\n}\n\n// eslint-disable-next-line camelcase\nexport function getDiyForm(id: number, page_name: any, diy_data: any) {\n return request({\n url: cloudDiy + 'getDiyForm',\n method: 'post',\n // eslint-disable-next-line camelcase\n data: { id, page_name, diy_data },\n })\n}\n\nexport function getSiteMsg() {\n return request({\n url: cloudDiy + 'getSiteMsg',\n method: 'post',\n data: {},\n })\n}\n\nexport function getCheckForm(id: number, state: any) {\n return request({\n url: cloudDiy + 'getCheckForm',\n method: 'post',\n data: { id, state },\n })\n}\n\nexport function delDiy(id: number) {\n return request({\n url: cloudDiy + 'delDiy',\n method: 'post',\n data: { id },\n })\n}\n"],"names":[],"mappings":";;AAGgB,SAAA,WAAA,CAAY,GAAU,EAAA,IAAA,EAAW,OAAc,EAAA;AAC7D,EAAA,OAAO,OAAQ,CAAA;AAAA,IACb,GAAK,EAAA,0BAAA;AAAA,IACL,MAAQ,EAAA,MAAA;AAAA,IACR,IAAM,EAAA,EAAE,GAAK,EAAA,IAAA,EAAM,OAAQ,EAAA;AAAA,GAC5B,CAAA,CAAA;AACH,CAAA;AAEgB,SAAA,YAAA,CAAa,KAAU,IAAW,EAAA;AAChD,EAAA,OAAO,OAAQ,CAAA;AAAA,IACb,GAAK,EAAA,yBAAA;AAAA,IACL,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,EAAE,GAAA,EAAK,IAAK,EAAA;AAAA,GACnB,CAAA,CAAA;AACH,CAAA;AAGA,MAAM,QAAW,GAAA,sBAAA,CAAA;AAGV,SAAS,OAAQ,CAAA,SAAA,EAAgB,IAAW,EAAA,MAAA,EAAa,IAAW,EAAA;AACzE,EAAA,OAAO,OAAQ,CAAA;AAAA,IACb,KAAK,QAAW,GAAA,SAAA;AAAA,IAChB,MAAQ,EAAA,MAAA;AAAA;AAAA,IAER,IAAM,EAAA,EAAE,SAAW,EAAA,IAAA,EAAM,QAAQ,IAAK,EAAA;AAAA,GACvC,CAAA,CAAA;AACH,CAAA;AAEO,SAAS,KAAK,EAAY,EAAA;AAC/B,EAAA,OAAO,OAAQ,CAAA;AAAA,IACb,KAAK,QAAW,GAAA,MAAA;AAAA,IAChB,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,EAAE,EAAG,EAAA;AAAA,GACZ,CAAA,CAAA;AACH,CAAA;AAGgB,SAAA,UAAA,CAAW,EAAY,EAAA,SAAA,EAAgB,QAAe,EAAA;AACpE,EAAA,OAAO,OAAQ,CAAA;AAAA,IACb,KAAK,QAAW,GAAA,YAAA;AAAA,IAChB,MAAQ,EAAA,MAAA;AAAA;AAAA,IAER,IAAM,EAAA,EAAE,EAAI,EAAA,SAAA,EAAW,QAAS,EAAA;AAAA,GACjC,CAAA,CAAA;AACH,CAAA;AAEO,SAAS,UAAa,GAAA;AAC3B,EAAA,OAAO,OAAQ,CAAA;AAAA,IACb,KAAK,QAAW,GAAA,YAAA;AAAA,IAChB,MAAQ,EAAA,MAAA;AAAA,IACR,MAAM,EAAC;AAAA,GACR,CAAA,CAAA;AACH,CAAA;AAEgB,SAAA,YAAA,CAAa,IAAY,KAAY,EAAA;AACnD,EAAA,OAAO,OAAQ,CAAA;AAAA,IACb,KAAK,QAAW,GAAA,cAAA;AAAA,IAChB,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,EAAE,EAAA,EAAI,KAAM,EAAA;AAAA,GACnB,CAAA,CAAA;AACH,CAAA;AAEO,SAAS,OAAO,EAAY,EAAA;AACjC,EAAA,OAAO,OAAQ,CAAA;AAAA,IACb,KAAK,QAAW,GAAA,QAAA;AAAA,IAChB,MAAQ,EAAA,MAAA;AAAA,IACR,IAAA,EAAM,EAAE,EAAG,EAAA;AAAA,GACZ,CAAA,CAAA;AACH;;;;"}
@@ -40,6 +40,15 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
40
40
  const { width } = useWindowSize();
41
41
  const value = ref(null);
42
42
  const _formData = ref(props.formData || {});
43
+ watch(
44
+ () => props.formData,
45
+ () => {
46
+ _formData.value = props.formData;
47
+ },
48
+ {
49
+ deep: true
50
+ }
51
+ );
43
52
  watch(
44
53
  () => value.value,
45
54
  (val) => {
@@ -1 +1 @@
1
- {"version":3,"file":"form.vue2.mjs","sources":["../../../src/form/src/form.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkForm',\n});\n</script>\n<template>\n <DkDialog\n v-if=\"props.isDialog\"\n v-model=\"showDialog\"\n :title=\"_formData?.title ? _formData?.title : '表单'\"\n :width=\"dialogWidth\"\n :default-fullscreen=\"isFullscreen\"\n min-height=\"200px\"\n v-bind=\"dialogProps\"\n append-to-body\n >\n <div :style=\"dialogStyle\" class=\"dk-form\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n </DkDialog>\n <div v-else>\n <div :style=\"{ minHeight }\" class=\"dk-form\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n <!-- <div v-else :style=\"{ minHeight }\"></div>-->\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { createNamespace, isArray, isObject, request } from '@vipl520/utils'\nimport formCreate from '@form-create/element-ui'\nimport { formProps } from './props'\nimport { computed, onMounted, reactive, ref, watch } from 'vue'\nimport _config from './config'\nimport { ElButton, ElMessage } from 'element-plus'\nimport { useWindowSize } from '@vueuse/core'\n\nconst [_, bem] = createNamespace('form')\n\nformCreate.register({\n name: 'help',\n init({ value }, rule) {\n // 判断value是字符串还是数组,如果是字符串则转换为数组,如果是数组则不变\n if (!isArray(value)) {\n value = [value]\n }\n rule.suffix = {\n type: 'p',\n children: value,\n class: 'form-help',\n }\n },\n})\n\n\nconst FormCreate = formCreate.$form()\n\nconst props = defineProps(formProps)\n\nconst config = reactive(_config)\nconst fApi = ref()\nconst loading = ref(true)\nconst buttonLoading = ref(false)\n\nconst showDialog = ref(false)\nconst formConfig = computed(() => ({ ...config, ...props.extraConfig }))\nconst { width } = useWindowSize()\nconst value = ref(null)\nconst _formData = ref(props.formData || {})\nconst emit = defineEmits(['submit', 'fail', 'update:modelValue'])\nwatch(\n () => value.value,\n (val) => {\n emit('update:modelValue', val || {})\n }\n)\n// 弹窗宽度\nconst dialogWidth = computed(() => {\n let defaultWidth = '800px'\n const config = _formData.value?.config || {}\n if (config?.width) {\n return config?.width\n }\n if (props.dialog?.width) {\n defaultWidth = props.dialog?.width\n }\n if (config?.defaultWidth) {\n defaultWidth = config?.defaultWidth\n }\n let minWidth = 768\n // 判断是否为百分比\n if (!defaultWidth.endsWith('%')) {\n minWidth = parseInt(defaultWidth)\n }\n return width.value < minWidth ? '100%' : defaultWidth\n})\n// 弹窗内样式\nconst dialogStyle = computed(() => {\n if (_formData.value?.config?.style) {\n return _formData.value?.config?.style\n }\n if (props.dialog?.style) {\n return props.dialog?.style\n }\n return {}\n})\n// const draggable = computed(() => {\n// let draggable = false\n// if (props.dialog?.draggable) {\n// draggable = props.dialog?.draggable\n// }\n// if (_formData.value?.config?.draggable !== undefined) {\n// draggable = _formData.value?.config?.draggable\n// }\n// return draggable\n// })\n// 是否全屏\nconst isFullscreen = computed(() => {\n let defaultFullscreen = false\n const autoFullscreen = _formData.value?.config?.autoFullscreen !== false\n if (props.dialog?.width) {\n defaultFullscreen = props.dialog?.fullscreen\n }\n if (_formData.value?.config?.fullscreen) {\n defaultFullscreen = _formData.value?.config?.fullscreen\n }\n\n if (width.value < 768 && autoFullscreen) {\n defaultFullscreen = true\n }\n\n return defaultFullscreen\n})\n\nconst dialogProps = computed(() => {\n return Object.assign(props.dialog, _formData.value?.config?.dialog)\n})\nconst setFormData = (formData: any) => {\n value.value = null\n _formData.value = formData\n}\n\nconst initFormData = (formUrl?: string | object) => {\n if (!formUrl) {\n formUrl = props.formUrl\n }\n\n if (props.formData) {\n loading.value = false\n } else if (formUrl) {\n let data: {}\n if (isObject(formUrl)) {\n data = formUrl\n } else {\n data = {\n url: formUrl,\n method: 'post',\n }\n }\n request(data)\n .then((res) => {\n _formData.value = res.data\n loading.value = false\n })\n .catch((res) => {\n loading.value = false\n })\n }\n}\n\nconst checkForm = () => {\n fApi.value\n .validate()\n .then(() => {\n fApi.value\n .submit((data: any) => {\n onSubmit(data)\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n}\n\nconst onSubmit = (data: any) => {\n if (props.isLoading) {\n buttonLoading.value = true\n }\n if (props.isSubmit) {\n request({\n url: props.path + _formData.value.action,\n method: _formData.value.method,\n data: { formData: data },\n })\n .then((res) => {\n ElMessage.success(res.msg)\n emit('submit', data, res)\n buttonLoading.value = false\n })\n .catch((res) => {\n ElMessage.error(res.msg)\n emit('fail', data, res)\n buttonLoading.value = false\n })\n } else {\n emit('submit', data)\n buttonLoading.value = false\n }\n showDialog.value = false\n}\n\nconst show = () => {\n showDialog.value = true\n}\nonMounted(() => {\n initFormData()\n})\n// 导出\ndefineExpose({\n showDialog,\n buttonLoading,\n fApi,\n value,\n show,\n checkForm,\n onSubmit,\n initFormData,\n setFormData,\n})\n</script>\n"],"names":["__MACROS_defineComponent","value","config","_config"],"mappings":";;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,QAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AA4DD,IAAA,MAAM,CAAC,CAAA,EAAG,GAAG,CAAA,GAAI,gBAAgB,MAAM,CAAA,CAA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KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"form.vue2.mjs","sources":["../../../src/form/src/form.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkForm',\n});\n</script>\n<template>\n <DkDialog\n v-if=\"props.isDialog\"\n v-model=\"showDialog\"\n :title=\"_formData?.title ? _formData?.title : '表单'\"\n :width=\"dialogWidth\"\n :default-fullscreen=\"isFullscreen\"\n min-height=\"200px\"\n v-bind=\"dialogProps\"\n append-to-body\n >\n <div :style=\"dialogStyle\" class=\"dk-form\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n </DkDialog>\n <div v-else>\n <div :style=\"{ minHeight }\" class=\"dk-form\">\n <FormCreate\n v-model=\"value\"\n :option=\"formConfig\"\n :rule=\"_formData.rules\"\n :handle-icon=\"false\"\n class=\"formBox\"\n @update:api=\"fApi = $event\"\n @update:value=\"value = $event\"\n />\n <div :style=\"{ marginLeft: config.form.labelWidth }\" class=\"m-t-10px\">\n <slot name=\"buttons\">\n <el-button type=\"primary\" :loading=\"buttonLoading\" @click=\"checkForm\"> 提交</el-button>\n </slot>\n </div>\n </div>\n <!-- <div v-else :style=\"{ minHeight }\"></div>-->\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { createNamespace, isArray, isObject, request } from '@vipl520/utils'\nimport formCreate from '@form-create/element-ui'\nimport { formProps } from './props'\nimport { computed, onMounted, reactive, ref, watch } from 'vue'\nimport _config from './config'\nimport { ElButton, ElMessage } from 'element-plus'\nimport { useWindowSize } from '@vueuse/core'\n\nconst [_, bem] = createNamespace('form')\n\nformCreate.register({\n name: 'help',\n init({ value }, rule) {\n // 判断value是字符串还是数组,如果是字符串则转换为数组,如果是数组则不变\n if (!isArray(value)) {\n value = [value]\n }\n rule.suffix = {\n type: 'p',\n children: value,\n class: 'form-help',\n }\n },\n})\n\n\nconst FormCreate = formCreate.$form()\n\nconst props = defineProps(formProps)\n\nconst config = reactive(_config)\nconst fApi = ref()\nconst loading = ref(true)\nconst buttonLoading = ref(false)\n\nconst showDialog = ref(false)\nconst formConfig = computed(() => ({ ...config, ...props.extraConfig }))\nconst { width } = useWindowSize()\nconst value = ref(null)\nconst _formData = ref(props.formData || {})\n\nconst emit = defineEmits(['submit', 'fail', 'update:modelValue'])\nwatch(\n () => props.formData,\n () => {\n _formData.value = props.formData\n },\n {\n deep: true,\n }\n)\nwatch(\n () => value.value,\n (val) => {\n emit('update:modelValue', val || {})\n }\n)\n// 弹窗宽度\nconst dialogWidth = computed(() => {\n let defaultWidth = '800px'\n const config = _formData.value?.config || {}\n if (config?.width) {\n return config?.width\n }\n if (props.dialog?.width) {\n defaultWidth = props.dialog?.width\n }\n if (config?.defaultWidth) {\n defaultWidth = config?.defaultWidth\n }\n let minWidth = 768\n // 判断是否为百分比\n if (!defaultWidth.endsWith('%')) {\n minWidth = parseInt(defaultWidth)\n }\n return width.value < minWidth ? '100%' : defaultWidth\n})\n// 弹窗内样式\nconst dialogStyle = computed(() => {\n if (_formData.value?.config?.style) {\n return _formData.value?.config?.style\n }\n if (props.dialog?.style) {\n return props.dialog?.style\n }\n return {}\n})\n// const draggable = computed(() => {\n// let draggable = false\n// if (props.dialog?.draggable) {\n// draggable = props.dialog?.draggable\n// }\n// if (_formData.value?.config?.draggable !== undefined) {\n// draggable = _formData.value?.config?.draggable\n// }\n// return draggable\n// })\n// 是否全屏\nconst isFullscreen = computed(() => {\n let defaultFullscreen = false\n const autoFullscreen = _formData.value?.config?.autoFullscreen !== false\n if (props.dialog?.width) {\n defaultFullscreen = props.dialog?.fullscreen\n }\n if (_formData.value?.config?.fullscreen) {\n defaultFullscreen = _formData.value?.config?.fullscreen\n }\n\n if (width.value < 768 && autoFullscreen) {\n defaultFullscreen = true\n }\n\n return defaultFullscreen\n})\n\nconst dialogProps = computed(() => {\n return Object.assign(props.dialog, _formData.value?.config?.dialog)\n})\nconst setFormData = (formData: any) => {\n value.value = null\n _formData.value = formData\n}\n\nconst initFormData = (formUrl?: string | object) => {\n if (!formUrl) {\n formUrl = props.formUrl\n }\n\n if (props.formData) {\n loading.value = false\n } else if (formUrl) {\n let data: {}\n if (isObject(formUrl)) {\n data = formUrl\n } else {\n data = {\n url: formUrl,\n method: 'post',\n }\n }\n request(data)\n .then((res) => {\n _formData.value = res.data\n loading.value = false\n })\n .catch((res) => {\n loading.value = false\n })\n }\n}\n\nconst checkForm = () => {\n fApi.value\n .validate()\n .then(() => {\n fApi.value\n .submit((data: any) => {\n onSubmit(data)\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n })\n .catch((fail: object) => {\n ElMessage.warning(Object.values(fail)[0][0].message)\n })\n}\n\nconst onSubmit = (data: any) => {\n if (props.isLoading) {\n buttonLoading.value = true\n }\n if (props.isSubmit) {\n request({\n url: props.path + _formData.value.action,\n method: _formData.value.method,\n data: { formData: data },\n })\n .then((res) => {\n ElMessage.success(res.msg)\n emit('submit', data, res)\n buttonLoading.value = false\n })\n .catch((res) => {\n ElMessage.error(res.msg)\n emit('fail', data, res)\n buttonLoading.value = false\n })\n } else {\n emit('submit', data)\n buttonLoading.value = false\n }\n showDialog.value = false\n}\n\nconst show = () => {\n showDialog.value = true\n}\nonMounted(() => {\n initFormData()\n})\n// 导出\ndefineExpose({\n showDialog,\n buttonLoading,\n fApi,\n value,\n show,\n checkForm,\n onSubmit,\n initFormData,\n setFormData,\n})\n</script>\n"],"names":["__MACROS_defineComponent","value","config","_config"],"mappings":";;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,QAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AA4DD,IAAA,MAAM,CAAC,CAAA,EAAG,GAAG,CAAA,GAAI,gBAAgB,MAAM,CAAA,CAAA;AAEvC,IAAA,UAAA,CAAW,QAAS,CAAA;AAAA,MAClB,IAAM,EAAA,MAAA;AAAA,MACN,IAAK,CAAA,EAAE,KAAAC,EAAAA,MAAAA,IAAS,IAAM,EAAA;AAEpB,QAAI,IAAA,CAAC,OAAQA,CAAAA,MAAK,CAAG,EAAA;AACnB,UAAAA,MAAAA,GAAQ,CAACA,MAAK,CAAA,CAAA;AAAA,SAChB;AACA,QAAA,IAAA,CAAK,MAAS,GAAA;AAAA,UACZ,IAAM,EAAA,GAAA;AAAA,UACN,QAAUA,EAAAA,MAAAA;AAAA,UACV,KAAO,EAAA,WAAA;AAAA,SACT,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAGD,IAAM,MAAA,UAAA,GAAa,WAAW,KAAM,EAAA,CAAA;AAIpC,IAAM,MAAAC,QAAA,GAAS,SAASC,MAAO,CAAA,CAAA;AAC/B,IAAA,MAAM,OAAO,GAAI,EAAA,CAAA;AACjB,IAAM,MAAA,OAAA,GAAU,IAAI,IAAI,CAAA,CAAA;AACxB,IAAM,MAAA,aAAA,GAAgB,IAAI,KAAK,CAAA,CAAA;AAE/B,IAAM,MAAA,UAAA,GAAa,IAAI,KAAK,CAAA,CAAA;AAC5B,IAAM,MAAA,UAAA,GAAa,SAAS,OAAO,EAAE,GAAGD,QAAQ,EAAA,GAAG,KAAM,CAAA,WAAA,EAAc,CAAA,CAAA,CAAA;AACvE,IAAM,MAAA,EAAE,KAAM,EAAA,GAAI,aAAc,EAAA,CAAA;AAChC,IAAM,MAA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A;AACnB,QAAA,aAAA,CAAc,KAAQ,GAAA,KAAA,CAAA;AAAA,OACxB;AACA,MAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA;AAAA,KACrB,CAAA;AAEA,IAAA,MAAM,OAAO,MAAM;AACjB,MAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,KACrB,CAAA;AACA,IAAA,SAAA,CAAU,MAAM;AACd,MAAa,YAAA,EAAA,CAAA;AAAA,KACd,CAAA,CAAA;AAED,IAAa,QAAA,CAAA;AAAA,MACX,UAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,WAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -83,6 +83,8 @@ export declare const PageDiy: import("@vipl520/utils").WithInstall<import("vue")
83
83
  previewFc(): void;
84
84
  getPageConfig(): {};
85
85
  setPageConfig(pageConfig: any): void;
86
+ showDiyCloud(pageName: any): void;
87
+ downCloudConfig(config: any): void;
86
88
  getRule(): any;
87
89
  getJson(): string;
88
90
  setRule(rules: any): void;
@@ -0,0 +1,51 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ pageName: {
3
+ default: string;
4
+ type: StringConstructor;
5
+ };
6
+ diyData: {
7
+ default: () => {};
8
+ type: ObjectConstructor;
9
+ };
10
+ }, any, {
11
+ total: number;
12
+ pageSize: number;
13
+ keyword: string;
14
+ search: {
15
+ state: string;
16
+ look: string;
17
+ };
18
+ chooseDiy: {};
19
+ page: number;
20
+ formData: null;
21
+ site: {};
22
+ width: string;
23
+ list: never[];
24
+ loading: boolean;
25
+ errMsg: string;
26
+ errCode: number;
27
+ }, {}, {
28
+ submit(): void;
29
+ onChooseDiy(item: any): void;
30
+ getDiyList(page: any): void;
31
+ getSiteMsg(): void;
32
+ getDiyForm(id?: number): void;
33
+ getCheckForm(): void;
34
+ delDiy(): void;
35
+ onSubmit(): void;
36
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "submit"[], "submit", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
37
+ pageName: {
38
+ default: string;
39
+ type: StringConstructor;
40
+ };
41
+ diyData: {
42
+ default: () => {};
43
+ type: ObjectConstructor;
44
+ };
45
+ }>> & {
46
+ onSubmit?: ((...args: any[]) => any) | undefined;
47
+ }, {
48
+ pageName: string;
49
+ diyData: Record<string, any>;
50
+ }, {}>;
51
+ export default _default;
@@ -0,0 +1,414 @@
1
+ import { down, getList, getSiteMsg, getDiyForm, getCheckForm, delDiy } from '../../../api/diy.mjs';
2
+ import { resolveComponent, resolveDirective, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, createBlock, createCommentVNode, createTextVNode, withDirectives, Fragment, renderList, normalizeClass, toDisplayString } from 'vue';
3
+ import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
4
+
5
+ const _sfc_main = {
6
+ name: 'DiyCloud',
7
+ props: {
8
+ pageName: {
9
+ default: '',
10
+ type: String,
11
+ },
12
+ diyData: {
13
+ default: () => {
14
+ return {}
15
+ },
16
+ type: Object,
17
+ },
18
+ },
19
+ emits: ['submit'],
20
+ data() {
21
+ return {
22
+ total: 0,
23
+ pageSize: 12,
24
+ keyword: '',
25
+ search: {
26
+ state: '',
27
+ look: '',
28
+ },
29
+ chooseDiy: {},
30
+ page: 1,
31
+ formData: null,
32
+ site: {},
33
+ width: '800px',
34
+ list: [],
35
+ loading: true,
36
+ errMsg: '',
37
+ errCode: 0,
38
+ }
39
+ },
40
+ computed: {},
41
+ mounted() {
42
+ this.getDiyList();
43
+ this.getSiteMsg();
44
+ },
45
+ methods: {
46
+ submit() {
47
+ this.$confirm('确定选择此diy模板?', '提示', {
48
+ confirmButtonText: '确定',
49
+ cancelButtonText: '取消',
50
+ type: 'warning',
51
+ })
52
+ .then(() => {
53
+ down(this.chooseDiy.id).then((res) => {
54
+ this.$emit('submit', res.data);
55
+ });
56
+ })
57
+ .catch(() => {});
58
+ },
59
+ onChooseDiy(item) {
60
+ this.chooseDiy = item;
61
+ },
62
+ getDiyList(page) {
63
+ this.page = page || this.page;
64
+ this.loading = true;
65
+ getList(this.pageName, this.page, this.search, this.pageSize)
66
+ .then((res) => {
67
+ this.list = res.data;
68
+ this.total = res.msg;
69
+ this.loading = false;
70
+ })
71
+ .catch((res) => {
72
+ this.errMsg = res.msg;
73
+ this.errCode = -1;
74
+ this.loading = false;
75
+ });
76
+ },
77
+ getSiteMsg() {
78
+ getSiteMsg().then((res) => {
79
+ this.site = res.data;
80
+ });
81
+ },
82
+ getDiyForm(id = 0) {
83
+ getDiyForm(id, this.pageName, this.diyData)
84
+ .then((res) => {
85
+ console.log('getDiyForm', res);
86
+ this.formData = res.data;
87
+ this.width = '600px';
88
+ this.$refs.formRef.show();
89
+ })
90
+ .catch((res) => {
91
+ this.$message.error(res.msg);
92
+ });
93
+ },
94
+ getCheckForm() {
95
+ getCheckForm(this.chooseDiy.id, this.chooseDiy.state)
96
+ .then((res) => {
97
+ this.formData = res.data;
98
+ this.width = '400px';
99
+ this.$refs.formRef.show();
100
+ })
101
+ .catch((res) => {
102
+ this.$message.error(res.msg);
103
+ });
104
+ },
105
+ delDiy() {
106
+ this.$confirm('确定要删除当前模板,删除后不可恢复?', '提示', {
107
+ confirmButtonText: '确定',
108
+ cancelButtonText: '取消',
109
+ type: 'warning',
110
+ })
111
+ .then(() => {
112
+ delDiy(this.chooseDiy.id)
113
+ .then((res) => {
114
+ this.$message.success(res.msg);
115
+ this.getDiyList(1);
116
+ })
117
+ .catch((res) => {
118
+ this.$message.error(res.msg);
119
+ });
120
+ })
121
+ .catch(() => {});
122
+ },
123
+ onSubmit() {
124
+ this.getDiyList(0);
125
+ },
126
+ },
127
+ };
128
+
129
+ const _hoisted_1 = { class: "diy-cloud" };
130
+ const _hoisted_2 = { class: "diy-header" };
131
+ const _hoisted_3 = { class: "diy-search" };
132
+ const _hoisted_4 = { class: "diy-content" };
133
+ const _hoisted_5 = {
134
+ key: 0,
135
+ class: "cl"
136
+ };
137
+ const _hoisted_6 = ["onClick"];
138
+ const _hoisted_7 = {
139
+ key: 0,
140
+ class: "mask"
141
+ };
142
+ const _hoisted_8 = { class: "type" };
143
+ const _hoisted_9 = {
144
+ key: 1,
145
+ class: "tag-list"
146
+ };
147
+ const _hoisted_10 = {
148
+ key: 0,
149
+ class: "tag"
150
+ };
151
+ const _hoisted_11 = {
152
+ key: 1,
153
+ class: "tag"
154
+ };
155
+ const _hoisted_12 = { class: "title over" };
156
+ const _hoisted_13 = {
157
+ key: 1,
158
+ style: {"height":"500px","display":"flex","align-items":"center","justify-content":"center"}
159
+ };
160
+ const _hoisted_14 = { class: "diy-footer" };
161
+
162
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
163
+ const _component_el_option = resolveComponent("el-option");
164
+ const _component_el_select = resolveComponent("el-select");
165
+ const _component_el_button = resolveComponent("el-button");
166
+ const _component_el_input = resolveComponent("el-input");
167
+ const _component_el_image = resolveComponent("el-image");
168
+ const _component_el_tag = resolveComponent("el-tag");
169
+ const _component_van_icon = resolveComponent("van-icon");
170
+ const _component_el_empty = resolveComponent("el-empty");
171
+ const _component_el_pagination = resolveComponent("el-pagination");
172
+ const _component_dk_form = resolveComponent("dk-form");
173
+ const _directive_loading = resolveDirective("loading");
174
+
175
+ return (openBlock(), createElementBlock("div", _hoisted_1, [
176
+ createElementVNode("div", _hoisted_2, [
177
+ createElementVNode("div", _hoisted_3, [
178
+ createVNode(_component_el_select, {
179
+ modelValue: $data.search.state,
180
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($data.search.state) = $event)),
181
+ placeholder: "状态"
182
+ }, {
183
+ default: withCtx(() => [
184
+ createVNode(_component_el_option, {
185
+ label: "全部状态",
186
+ value: ""
187
+ }),
188
+ ($data.site.level > 0)
189
+ ? (openBlock(), createBlock(_component_el_option, {
190
+ key: 0,
191
+ label: "未通过",
192
+ value: "-1"
193
+ }))
194
+ : createCommentVNode("v-if", true),
195
+ ($data.site.level > 0)
196
+ ? (openBlock(), createBlock(_component_el_option, {
197
+ key: 1,
198
+ label: "未审核",
199
+ value: "0"
200
+ }))
201
+ : createCommentVNode("v-if", true),
202
+ createVNode(_component_el_option, {
203
+ label: "已审核",
204
+ value: "1"
205
+ }),
206
+ createVNode(_component_el_option, {
207
+ label: "已推荐",
208
+ value: "2"
209
+ })
210
+ ]),
211
+ _: 1 /* STABLE */
212
+ }, 8 /* PROPS */, ["modelValue"]),
213
+ createVNode(_component_el_select, {
214
+ modelValue: $data.search.look,
215
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.search.look) = $event)),
216
+ placeholder: "查看",
217
+ class: "u-m-l-10"
218
+ }, {
219
+ default: withCtx(() => [
220
+ createVNode(_component_el_option, {
221
+ label: "全部模板",
222
+ value: ""
223
+ }),
224
+ createVNode(_component_el_option, {
225
+ label: "我的模板",
226
+ value: "me"
227
+ }),
228
+ createVNode(_component_el_option, {
229
+ label: "他人模板",
230
+ value: "other"
231
+ })
232
+ ]),
233
+ _: 1 /* STABLE */
234
+ }, 8 /* PROPS */, ["modelValue"]),
235
+ createVNode(_component_el_input, {
236
+ modelValue: $data.search['name like'],
237
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => (($data.search['name like']) = $event)),
238
+ placeholder: "请输入模板名称",
239
+ clearable: "",
240
+ onClear: _cache[4] || (_cache[4] = $event => ($options.getDiyList(0)))
241
+ }, {
242
+ append: withCtx(() => [
243
+ createVNode(_component_el_button, {
244
+ icon: "Search",
245
+ onClick: _cache[2] || (_cache[2] = $event => ($options.getDiyList(1)))
246
+ })
247
+ ]),
248
+ _: 1 /* STABLE */
249
+ }, 8 /* PROPS */, ["modelValue"])
250
+ ]),
251
+ createElementVNode("div", null, [
252
+ ($data.site.level > 0)
253
+ ? (openBlock(), createBlock(_component_el_button, {
254
+ key: 0,
255
+ type: "warning",
256
+ disabled: !$data.chooseDiy.id,
257
+ onClick: $options.getCheckForm
258
+ }, {
259
+ default: withCtx(() => [
260
+ createTextVNode("审核 ")
261
+ ]),
262
+ _: 1 /* STABLE */
263
+ }, 8 /* PROPS */, ["disabled", "onClick"]))
264
+ : createCommentVNode("v-if", true),
265
+ ($data.site.level > 1)
266
+ ? (openBlock(), createBlock(_component_el_button, {
267
+ key: 1,
268
+ type: "danger",
269
+ disabled: !$data.chooseDiy.id,
270
+ onClick: $options.delDiy
271
+ }, {
272
+ default: withCtx(() => [
273
+ createTextVNode("删除")
274
+ ]),
275
+ _: 1 /* STABLE */
276
+ }, 8 /* PROPS */, ["disabled", "onClick"]))
277
+ : createCommentVNode("v-if", true),
278
+ ($data.site.level > 0 || $data.site.site_id === $data.chooseDiy.site_id)
279
+ ? (openBlock(), createBlock(_component_el_button, {
280
+ key: 2,
281
+ type: "info",
282
+ disabled: !$data.chooseDiy.id,
283
+ onClick: _cache[5] || (_cache[5] = $event => ($options.getDiyForm($data.chooseDiy.id)))
284
+ }, {
285
+ default: withCtx(() => [
286
+ createTextVNode("编辑 ")
287
+ ]),
288
+ _: 1 /* STABLE */
289
+ }, 8 /* PROPS */, ["disabled"]))
290
+ : createCommentVNode("v-if", true),
291
+ createVNode(_component_el_button, {
292
+ type: "primary",
293
+ icon: "Upload",
294
+ onClick: _cache[6] || (_cache[6] = $event => ($options.getDiyForm()))
295
+ }, {
296
+ default: withCtx(() => [
297
+ createTextVNode("上传新模板")
298
+ ]),
299
+ _: 1 /* STABLE */
300
+ })
301
+ ])
302
+ ]),
303
+ createCommentVNode("-------------模板列表------------------------"),
304
+ withDirectives((openBlock(), createElementBlock("div", _hoisted_4, [
305
+ (!$data.loading && $data.list.length > 0)
306
+ ? (openBlock(), createElementBlock("ul", _hoisted_5, [
307
+ (openBlock(true), createElementBlock(Fragment, null, renderList($data.list, (item, key) => {
308
+ return (openBlock(), createElementBlock("li", {
309
+ key: key,
310
+ class: normalizeClass({ choose: $data.chooseDiy.id === item.id }),
311
+ onClick: $event => ($options.onChooseDiy(item))
312
+ }, [
313
+ createVNode(_component_el_image, {
314
+ src: item.cover_image,
315
+ class: "cover",
316
+ fit: "contain"
317
+ }, null, 8 /* PROPS */, ["src"]),
318
+ (item.state <= 0)
319
+ ? (openBlock(), createElementBlock("div", _hoisted_7))
320
+ : createCommentVNode("v-if", true),
321
+ createElementVNode("div", _hoisted_8, [
322
+ (item.state === '0')
323
+ ? (openBlock(), createBlock(_component_el_tag, {
324
+ key: 0,
325
+ type: "primary",
326
+ effect: "dark"
327
+ }, {
328
+ default: withCtx(() => [
329
+ createTextVNode("审核中")
330
+ ]),
331
+ _: 1 /* STABLE */
332
+ }))
333
+ : createCommentVNode("v-if", true),
334
+ (item.state === '-1')
335
+ ? (openBlock(), createBlock(_component_el_tag, {
336
+ key: 1,
337
+ type: "danger",
338
+ effect: "dark"
339
+ }, {
340
+ default: withCtx(() => [
341
+ createTextVNode("审核未通过")
342
+ ]),
343
+ _: 1 /* STABLE */
344
+ }))
345
+ : createCommentVNode("v-if", true)
346
+ ]),
347
+ (item.state > 0)
348
+ ? (openBlock(), createElementBlock("div", _hoisted_9, [
349
+ (item.state >= 2)
350
+ ? (openBlock(), createElementBlock("span", _hoisted_10, [
351
+ createVNode(_component_van_icon, { name: "good-job" }),
352
+ createTextVNode("推荐")
353
+ ]))
354
+ : createCommentVNode("v-if", true),
355
+ (item.down_count > 100)
356
+ ? (openBlock(), createElementBlock("span", _hoisted_11, [
357
+ createVNode(_component_van_icon, { name: "fire" }),
358
+ createTextVNode("热门")
359
+ ]))
360
+ : createCommentVNode("v-if", true)
361
+ ]))
362
+ : createCommentVNode("v-if", true),
363
+ createElementVNode("div", _hoisted_12, toDisplayString(item.name), 1 /* TEXT */)
364
+ ], 10 /* CLASS, PROPS */, _hoisted_6))
365
+ }), 128 /* KEYED_FRAGMENT */))
366
+ ]))
367
+ : (openBlock(), createElementBlock("div", _hoisted_13, [
368
+ ($data.errCode === 0)
369
+ ? (openBlock(), createBlock(_component_el_empty, {
370
+ key: 0,
371
+ description: "当前还没模板,点击右上角上传自己的模板吧"
372
+ }))
373
+ : (openBlock(), createBlock(_component_el_empty, {
374
+ key: 1,
375
+ description: $data.errMsg
376
+ }, null, 8 /* PROPS */, ["description"]))
377
+ ])),
378
+ createVNode(_component_el_pagination, {
379
+ background: "",
380
+ layout: "total,prev, pager, next",
381
+ total: $data.total,
382
+ "current-page": $data.page,
383
+ "page-size": $data.pageSize,
384
+ "hide-on-single-page": "",
385
+ onCurrentChange: $options.getDiyList
386
+ }, null, 8 /* PROPS */, ["total", "current-page", "page-size", "onCurrentChange"])
387
+ ])), [
388
+ [_directive_loading, $data.loading]
389
+ ]),
390
+ createElementVNode("div", _hoisted_14, [
391
+ createVNode(_component_el_button, {
392
+ type: "primary",
393
+ style: {"width":"300px"},
394
+ disabled: !$data.chooseDiy.id,
395
+ onClick: $options.submit
396
+ }, {
397
+ default: withCtx(() => [
398
+ createTextVNode("确定")
399
+ ]),
400
+ _: 1 /* STABLE */
401
+ }, 8 /* PROPS */, ["disabled", "onClick"])
402
+ ]),
403
+ createVNode(_component_dk_form, {
404
+ ref: "formRef",
405
+ "is-dialog": true,
406
+ "form-data": $data.formData,
407
+ onSubmit: $options.onSubmit
408
+ }, null, 8 /* PROPS */, ["form-data", "onSubmit"])
409
+ ]))
410
+ }
411
+ var DiyCloud = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"E:\\project\\monster-admin\\system\\dkgs-ui-back\\packages\\dk-ui\\src\\page-diy\\src\\components\\DiyCloud.vue"]]);
412
+
413
+ export { DiyCloud as default };
414
+ //# sourceMappingURL=DiyCloud.vue.mjs.map