@vipl520/dk-ui 1.0.51 → 1.0.52

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -1455,7 +1455,7 @@ var _sfc_main$1b = /* @__PURE__ */ defineComponent({
1455
1455
  images_upload_handler: handleImageUpload,
1456
1456
  initialContent: "Loading editor..."
1457
1457
  });
1458
- const tinymceSrc = ref("https://registry.npmmirror.com/dk-tinymce/1.0.0/files/tinymce.min.js");
1458
+ const tinymceSrc = ref("https://unpkg.com/dk-tinymce@latest/tinymce.min.js");
1459
1459
  const attachmentRef = ref();
1460
1460
  const editorRef = ref();
1461
1461
  const showDialog = computed(() => {
@@ -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.50",
5
+ "version": "1.0.52",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {
@@ -37,7 +37,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
37
37
  images_upload_handler: handleImageUpload,
38
38
  initialContent: "Loading editor..."
39
39
  });
40
- const tinymceSrc = ref("https://registry.npmmirror.com/dk-tinymce/1.0.0/files/tinymce.min.js");
40
+ const tinymceSrc = ref("https://unpkg.com/dk-tinymce@latest/tinymce.min.js");
41
41
  const attachmentRef = ref();
42
42
  const editorRef = ref();
43
43
  const showDialog = computed(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"tiny-editor.vue2.mjs","sources":["../../../src/tiny-editor/src/tiny-editor.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkTinyEditor',\n});\n</script>\n<template>\n <div ref=\"el\" class=\"dk-tiny-editor\">\n <div v-if=\"showDialog\">\n <Editor ref=\"editorRef\" v-model=\"content\" :init=\"init\" :tinymce-script-src=\"tinymceSrc\" @dblclick=\"ondblclick\" />\n </div>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"showEditor = true\">{{ props.buttonText }}</el-button>\n <dk-dialog v-model=\"showEditor\" title=\"编辑\" width=\"900px\" :z-index=\"1298\">\n <Editor\n ref=\"editorRef\"\n v-model=\"content\"\n :init=\"init\"\n :tinymce-script-src=\"tinymceSrc\"\n @dblclick=\"ondblclick\"\n />\n <template #footer>\n <div class=\"text-center\">\n <el-button type=\"primary\" style=\"width: 200px\" @click=\"showEditor = false\">确定</el-button>\n </div>\n </template>\n </dk-dialog>\n </div>\n <dk-attachment-dialog ref=\"attachmentRef\" :type=\"1\" @confirm=\"onSubmit\" />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport config from './config'\nimport Editor from '@tinymce/tinymce-vue'\nimport { nextTick, onMounted, ref, watch, computed } from 'vue'\nimport { UploadAttachment } from '../../api'\nimport { tinyEditorProps } from './props'\nimport { useElementSize } from '@vueuse/core'\nconst el: any = ref(null)\nconst { width } = useElementSize(el) // 当前组件宽度\n\n\nconst props = defineProps(tinyEditorProps)\nconst content = ref(props.modelValue)\nconst showEditor = ref(false)\n// 上传的地址\nconst handleImageUpload = (blobInfo: any, progress: any) =>\n new Promise((resolve, reject) => {\n UploadAttachment(blobInfo.blob())\n .then((res) => {\n progress(100)\n resolve(res.data.url)\n })\n .catch((err) => {\n reject(err)\n })\n })\n\nconst init = ref({\n ...config,\n height: props.height,\n content_css: props.document ? 'document' : '',\n images_upload_handler: handleImageUpload,\n initialContent: 'Loading editor...',\n})\n\nconst tinymceSrc = ref('https://registry.npmmirror.com/dk-tinymce/1.0.0/files/tinymce.min.js')\nconst attachmentRef = ref()\nconst editorRef = ref()\nconst emit = defineEmits(['input', 'update:modelValue', 'change'])\n\nconst showDialog = computed(() => {\n return width.value >= props.showDialogWidth\n})\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n content.value = newValue\n }\n)\n\nwatch(\n () => content.value,\n (newValue) => {\n emit('update:modelValue', newValue)\n emit('input', newValue)\n emit('change', newValue)\n }\n)\n\nonMounted(() => {\n nextTick(() => {\n initShowImage()\n })\n})\n\nwatch(\n () => editorRef.value,\n () => {\n if (editorRef.value?.getEditor()) {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n }\n)\n\nconst initShowImage = () => {\n if (!editorRef.value?.getEditor()) {\n setTimeout(() => {\n initShowImage()\n }, 1000)\n } else {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n}\n\nconst onSubmit = (chooseFileList: any) => {\n const editor = editorRef.value.getEditor()\n let html = ''\n chooseFileList.forEach((item: any) => {\n html += '<img src=\"' + item.url + '\" alt=\"\" width=\"100%\">'\n })\n editor.insertContent(html)\n}\n\nconst ondblclick = (editor: any) => {\n console.log(editor)\n}\n</script>\n"],"names":["__MACROS_defineComponent","init","config"],"mappings":";;;;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,cAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAmCD,IAAM,MAAA,EAAA,GAAU,IAAI,IAAI,CAAA,CAAA;AACxB,IAAA,MAAM,EAAE,KAAA,EAAU,GAAA,cAAA,CAAe,EAAE,CAAA,CAAA;AAInC,IAAM,MAAA,OAAA,GAAU,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACpC,IAAM,MAAA,UAAA,GAAa,IAAI,KAAK,CAAA,CAAA;AAE5B,IAAM,MAAA,iBAAA,GAAoB,CAAC,QAAe,EAAA,QAAA,KACxC,IAAI,OAAQ,CAAA,CAAC,SAAS,MAAW,KAAA;AAC/B,MAAA,gBAAA,CAAiB,SAAS,IAAK,EAAC,CAC7B,CAAA,IAAA,CAAK,CAAC,GAAQ,KAAA;AACb,QAAA,QAAA,CAAS,GAAG,CAAA,CAAA;AACZ,QAAQ,OAAA,CAAA,GAAA,CAAI,KAAK,GAAG,CAAA,CAAA;AAAA,OACrB,CAAA,CACA,KAAM,CAAA,CAAC,GAAQ,KAAA;AAC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;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"tiny-editor.vue2.mjs","sources":["../../../src/tiny-editor/src/tiny-editor.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkTinyEditor',\n});\n</script>\n<template>\n <div ref=\"el\" class=\"dk-tiny-editor\">\n <div v-if=\"showDialog\">\n <Editor ref=\"editorRef\" v-model=\"content\" :init=\"init\" :tinymce-script-src=\"tinymceSrc\" @dblclick=\"ondblclick\" />\n </div>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"showEditor = true\">{{ props.buttonText }}</el-button>\n <dk-dialog v-model=\"showEditor\" title=\"编辑\" width=\"900px\" :z-index=\"1298\">\n <Editor\n ref=\"editorRef\"\n v-model=\"content\"\n :init=\"init\"\n :tinymce-script-src=\"tinymceSrc\"\n @dblclick=\"ondblclick\"\n />\n <template #footer>\n <div class=\"text-center\">\n <el-button type=\"primary\" style=\"width: 200px\" @click=\"showEditor = false\">确定</el-button>\n </div>\n </template>\n </dk-dialog>\n </div>\n <dk-attachment-dialog ref=\"attachmentRef\" :type=\"1\" @confirm=\"onSubmit\" />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport config from './config'\nimport Editor from '@tinymce/tinymce-vue'\nimport { nextTick, onMounted, ref, watch, computed } from 'vue'\nimport { UploadAttachment } from '../../api'\nimport { tinyEditorProps } from './props'\nimport { useElementSize } from '@vueuse/core'\nconst el: any = ref(null)\nconst { width } = useElementSize(el) // 当前组件宽度\n\n\nconst props = defineProps(tinyEditorProps)\nconst content = ref(props.modelValue)\nconst showEditor = ref(false)\n// 上传的地址\nconst handleImageUpload = (blobInfo: any, progress: any) =>\n new Promise((resolve, reject) => {\n UploadAttachment(blobInfo.blob())\n .then((res) => {\n progress(100)\n resolve(res.data.url)\n })\n .catch((err) => {\n reject(err)\n })\n })\n\nconst init = ref({\n ...config,\n height: props.height,\n content_css: props.document ? 'document' : '',\n images_upload_handler: handleImageUpload,\n initialContent: 'Loading editor...',\n})\n\nconst tinymceSrc = ref('https://unpkg.com/dk-tinymce@latest/tinymce.min.js')\nconst attachmentRef = ref()\nconst editorRef = ref()\nconst emit = defineEmits(['input', 'update:modelValue', 'change'])\n\nconst showDialog = computed(() => {\n return width.value >= props.showDialogWidth\n})\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n content.value = newValue\n }\n)\n\nwatch(\n () => content.value,\n (newValue) => {\n emit('update:modelValue', newValue)\n emit('input', newValue)\n emit('change', newValue)\n }\n)\n\nonMounted(() => {\n nextTick(() => {\n initShowImage()\n })\n})\n\nwatch(\n () => editorRef.value,\n () => {\n if (editorRef.value?.getEditor()) {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n }\n)\n\nconst initShowImage = () => {\n if (!editorRef.value?.getEditor()) {\n setTimeout(() => {\n initShowImage()\n }, 1000)\n } else {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n}\n\nconst onSubmit = (chooseFileList: any) => {\n const editor = editorRef.value.getEditor()\n let html = ''\n chooseFileList.forEach((item: any) => {\n html += '<img src=\"' + item.url + '\" alt=\"\" width=\"100%\">'\n })\n editor.insertContent(html)\n}\n\nconst ondblclick = (editor: any) => {\n console.log(editor)\n}\n</script>\n"],"names":["__MACROS_defineComponent","init","config"],"mappings":";;;;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,cAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAmCD,IAAM,MAAA,EAAA,GAAU,IAAI,IAAI,CAAA,CAAA;AACxB,IAAA,MAAM,EAAE,KAAA,EAAU,GAAA,cAAA,CAAe,EAAE,CAAA,CAAA;AAInC,IAAM,MAAA,OAAA,GAAU,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACpC,IAAM,MAAA,UAAA,GAAa,IAAI,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AACpC,QAAQ,IAAA,IAAA,YAAA,GAAe,KAAK,GAAM,GAAA,wBAAA,CAAA;AAAA,OACnC,CAAA,CAAA;AACD,MAAA,MAAA,CAAO,cAAc,IAAI,CAAA,CAAA;AAAA,KAC3B,CAAA;AAEA,IAAM,MAAA,UAAA,GAAa,CAAC,MAAgB,KAAA;AAClC,MAAA,OAAA,CAAQ,IAAI,MAAM,CAAA,CAAA;AAAA,KACpB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -41,7 +41,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
41
41
  images_upload_handler: handleImageUpload,
42
42
  initialContent: "Loading editor..."
43
43
  });
44
- const tinymceSrc = vue.ref("https://registry.npmmirror.com/dk-tinymce/1.0.0/files/tinymce.min.js");
44
+ const tinymceSrc = vue.ref("https://unpkg.com/dk-tinymce@latest/tinymce.min.js");
45
45
  const attachmentRef = vue.ref();
46
46
  const editorRef = vue.ref();
47
47
  const showDialog = vue.computed(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"tiny-editor.vue2.js","sources":["../../../src/tiny-editor/src/tiny-editor.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkTinyEditor',\n});\n</script>\n<template>\n <div ref=\"el\" class=\"dk-tiny-editor\">\n <div v-if=\"showDialog\">\n <Editor ref=\"editorRef\" v-model=\"content\" :init=\"init\" :tinymce-script-src=\"tinymceSrc\" @dblclick=\"ondblclick\" />\n </div>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"showEditor = true\">{{ props.buttonText }}</el-button>\n <dk-dialog v-model=\"showEditor\" title=\"编辑\" width=\"900px\" :z-index=\"1298\">\n <Editor\n ref=\"editorRef\"\n v-model=\"content\"\n :init=\"init\"\n :tinymce-script-src=\"tinymceSrc\"\n @dblclick=\"ondblclick\"\n />\n <template #footer>\n <div class=\"text-center\">\n <el-button type=\"primary\" style=\"width: 200px\" @click=\"showEditor = false\">确定</el-button>\n </div>\n </template>\n </dk-dialog>\n </div>\n <dk-attachment-dialog ref=\"attachmentRef\" :type=\"1\" @confirm=\"onSubmit\" />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport config from './config'\nimport Editor from '@tinymce/tinymce-vue'\nimport { nextTick, onMounted, ref, watch, computed } from 'vue'\nimport { UploadAttachment } from '../../api'\nimport { tinyEditorProps } from './props'\nimport { useElementSize } from '@vueuse/core'\nconst el: any = ref(null)\nconst { width } = useElementSize(el) // 当前组件宽度\n\n\nconst props = defineProps(tinyEditorProps)\nconst content = ref(props.modelValue)\nconst showEditor = ref(false)\n// 上传的地址\nconst handleImageUpload = (blobInfo: any, progress: any) =>\n new Promise((resolve, reject) => {\n UploadAttachment(blobInfo.blob())\n .then((res) => {\n progress(100)\n resolve(res.data.url)\n })\n .catch((err) => {\n reject(err)\n })\n })\n\nconst init = ref({\n ...config,\n height: props.height,\n content_css: props.document ? 'document' : '',\n images_upload_handler: handleImageUpload,\n initialContent: 'Loading editor...',\n})\n\nconst tinymceSrc = ref('https://registry.npmmirror.com/dk-tinymce/1.0.0/files/tinymce.min.js')\nconst attachmentRef = ref()\nconst editorRef = ref()\nconst emit = defineEmits(['input', 'update:modelValue', 'change'])\n\nconst showDialog = computed(() => {\n return width.value >= props.showDialogWidth\n})\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n content.value = newValue\n }\n)\n\nwatch(\n () => content.value,\n (newValue) => {\n emit('update:modelValue', newValue)\n emit('input', newValue)\n emit('change', newValue)\n }\n)\n\nonMounted(() => {\n nextTick(() => {\n initShowImage()\n })\n})\n\nwatch(\n () => editorRef.value,\n () => {\n if (editorRef.value?.getEditor()) {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n }\n)\n\nconst initShowImage = () => {\n if (!editorRef.value?.getEditor()) {\n setTimeout(() => {\n initShowImage()\n }, 1000)\n } else {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n}\n\nconst onSubmit = (chooseFileList: any) => {\n const editor = editorRef.value.getEditor()\n let html = ''\n chooseFileList.forEach((item: any) => {\n html += '<img src=\"' + item.url + '\" alt=\"\" width=\"100%\">'\n })\n editor.insertContent(html)\n}\n\nconst ondblclick = (editor: any) => {\n console.log(editor)\n}\n</script>\n"],"names":["__MACROS_defineComponent","ref","useElementSize","UploadAttachment","config","computed","watch","onMounted","nextTick"],"mappings":";;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,cAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAmCD,IAAM,MAAA,EAAA,GAAUC,QAAI,IAAI,CAAA,CAAA;AACxB,IAAA,MAAM,EAAE,KAAA,EAAU,GAAAC,mBAAA,CAAe,EAAE,CAAA,CAAA;AAInC,IAAM,MAAA,OAAA,GAAUD,OAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACpC,IAAM,MAAA,UAAA,GAAaA,QAAI,KAAK,CAAA,CAAA;AAE5B,IAAM,MAAA,iBAAA,GAAoB,CAAC,QAAe,EAAA,QAAA,KACxC,IAAI,OAAQ,CAAA,CAAC,SAAS,MAAW,KAAA;AAC/B,MAAAE,2BAAA,CAAiB,SAAS,IAAK,EAAC,CAC7B,CAAA,IAAA,CAAK,CAAC,GAAQ,KAAA;AACb,QAAA,QAAA,CAAS,GAAG,CAAA,CAAA;AACZ,QAAQ,OAAA,CAAA,GAAA,CAAI,KAAK,GAAG,CAAA,CAAA;AAAA,OACrB,CAAA,CACA,KAAM,CAAA,CAAC,GAAQ,KAAA;AACd,QAAA,MAAA,CAAO,GAAG,CAAA,CAAA;AAAA,OACX,CAAA,CAAA;AAAA,KACJ,CAAA,CAAA;AAEH,IAAA,MAA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"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkTinyEditor',\n});\n</script>\n<template>\n <div ref=\"el\" class=\"dk-tiny-editor\">\n <div v-if=\"showDialog\">\n <Editor ref=\"editorRef\" v-model=\"content\" :init=\"init\" :tinymce-script-src=\"tinymceSrc\" @dblclick=\"ondblclick\" />\n </div>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"showEditor = true\">{{ props.buttonText }}</el-button>\n <dk-dialog v-model=\"showEditor\" title=\"编辑\" width=\"900px\" :z-index=\"1298\">\n <Editor\n ref=\"editorRef\"\n v-model=\"content\"\n :init=\"init\"\n :tinymce-script-src=\"tinymceSrc\"\n @dblclick=\"ondblclick\"\n />\n <template #footer>\n <div class=\"text-center\">\n <el-button type=\"primary\" style=\"width: 200px\" @click=\"showEditor = false\">确定</el-button>\n </div>\n </template>\n </dk-dialog>\n </div>\n <dk-attachment-dialog ref=\"attachmentRef\" :type=\"1\" @confirm=\"onSubmit\" />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport config from './config'\nimport Editor from '@tinymce/tinymce-vue'\nimport { nextTick, onMounted, ref, watch, computed } from 'vue'\nimport { UploadAttachment } from '../../api'\nimport { tinyEditorProps } from './props'\nimport { useElementSize } from '@vueuse/core'\nconst el: any = ref(null)\nconst { width } = useElementSize(el) // 当前组件宽度\n\n\nconst props = defineProps(tinyEditorProps)\nconst content = ref(props.modelValue)\nconst showEditor = ref(false)\n// 上传的地址\nconst handleImageUpload = (blobInfo: any, progress: any) =>\n new Promise((resolve, reject) => {\n UploadAttachment(blobInfo.blob())\n .then((res) => {\n progress(100)\n resolve(res.data.url)\n })\n .catch((err) => {\n reject(err)\n })\n })\n\nconst init = ref({\n ...config,\n height: props.height,\n content_css: props.document ? 'document' : '',\n images_upload_handler: handleImageUpload,\n initialContent: 'Loading editor...',\n})\n\nconst tinymceSrc = ref('https://unpkg.com/dk-tinymce@latest/tinymce.min.js')\nconst attachmentRef = ref()\nconst editorRef = ref()\nconst emit = defineEmits(['input', 'update:modelValue', 'change'])\n\nconst showDialog = computed(() => {\n return width.value >= props.showDialogWidth\n})\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n content.value = newValue\n }\n)\n\nwatch(\n () => content.value,\n (newValue) => {\n emit('update:modelValue', newValue)\n emit('input', newValue)\n emit('change', newValue)\n }\n)\n\nonMounted(() => {\n nextTick(() => {\n initShowImage()\n })\n})\n\nwatch(\n () => editorRef.value,\n () => {\n if (editorRef.value?.getEditor()) {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n }\n)\n\nconst initShowImage = () => {\n if (!editorRef.value?.getEditor()) {\n setTimeout(() => {\n initShowImage()\n }, 1000)\n } else {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n}\n\nconst onSubmit = (chooseFileList: any) => {\n const editor = editorRef.value.getEditor()\n let html = ''\n chooseFileList.forEach((item: any) => {\n html += '<img src=\"' + item.url + '\" alt=\"\" width=\"100%\">'\n })\n editor.insertContent(html)\n}\n\nconst ondblclick = (editor: any) => {\n console.log(editor)\n}\n</script>\n"],"names":["__MACROS_defineComponent","ref","useElementSize","UploadAttachment","config","computed","watch","onMounted","nextTick"],"mappings":";;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,cAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAmCD,IAAM,MAAA,EAAA,GAAUC,QAAI,IAAI,CAAA,CAAA;AACxB,IAAA,MAAM,EAAE,KAAA,EAAU,GAAAC,mBAAA,CAAe,EAAE,CAAA,CAAA;AAInC,IAAM,MAAA,OAAA,GAAUD,OAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACpC,IAAM,MAAA,UAAA,GAAaA,QAAI,KAAK,CAAA,CAAA;AAE5B,IAAM,MAAA,iBAAA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GAAe,KAAK,GAAM,GAAA,wBAAA,CAAA;AAAA,OACnC,CAAA,CAAA;AACD,MAAA,MAAA,CAAO,cAAc,IAAI,CAAA,CAAA;AAAA,KAC3B,CAAA;AAEA,IAAM,MAAA,UAAA,GAAa,CAAC,MAAgB,KAAA;AAClC,MAAA,OAAA,CAAQ,IAAI,MAAM,CAAA,CAAA;AAAA,KACpB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vipl520/dk-ui",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "多客怪兽框架核心组件,支持diy、crud动态表格、上传组件等",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.mjs",