From 2525fc22a0d9ca1a804343d9d9be104399c20db0 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Thu, 4 Jul 2024 15:00:51 +0800 Subject: [PATCH] add --- package-lock.json | 10 +- package.json | 2 +- .../formCreate/component-elm-checkbox/LICENSE | 21 + .../component-elm-checkbox/README.md | 6 + .../component-elm-checkbox/dist/index.esm.js | 228 + .../dist/index.esm.min.js | 7 + .../component-elm-checkbox/dist/index.js | 236 + .../component-elm-checkbox/dist/index.min.js | 7 + .../component-elm-checkbox/package.json | 51 + .../component-elm-checkbox/src/component.jsx | 84 + .../component-elm-checkbox/src/index.js | 3 + .../formCreate/component-elm-frame/LICENSE | 21 + .../formCreate/component-elm-frame/README.md | 6 + .../component-elm-frame/dist/index.esm.js | 742 ++ .../component-elm-frame/dist/index.esm.min.js | 7 + .../component-elm-frame/dist/index.js | 750 ++ .../component-elm-frame/dist/index.min.js | 7 + .../component-elm-frame/package.json | 51 + .../src/IconCircleClose.vue | 14 + .../component-elm-frame/src/IconDelete.vue | 12 + .../component-elm-frame/src/IconDocument.vue | 12 + .../src/IconFolderOpened.vue | 12 + .../component-elm-frame/src/IconView.vue | 12 + .../component-elm-frame/src/component.jsx | 349 + .../component-elm-frame/src/index.js | 3 + .../component-elm-frame/src/style.css | 66 + .../formCreate/component-elm-group/LICENSE | 21 + .../formCreate/component-elm-group/README.md | 6 + .../component-elm-group/dist/index.esm.js | 667 ++ .../component-elm-group/dist/index.esm.min.js | 7 + .../component-elm-group/dist/index.js | 675 ++ .../component-elm-group/dist/index.min.js | 7 + .../component-elm-group/package.json | 51 + .../component-elm-group/src/component.jsx | 310 + .../component-elm-group/src/index.js | 3 + .../component-elm-group/src/style.css | 125 + .../formCreate/component-elm-radio/LICENSE | 21 + .../formCreate/component-elm-radio/README.md | 6 + .../component-elm-radio/dist/index.esm.js | 183 + .../component-elm-radio/dist/index.esm.min.js | 7 + .../component-elm-radio/dist/index.js | 191 + .../component-elm-radio/dist/index.min.js | 7 + .../component-elm-radio/package.json | 51 + .../component-elm-radio/src/component.jsx | 81 + .../component-elm-radio/src/index.js | 3 + .../formCreate/component-elm-select/LICENSE | 21 + .../formCreate/component-elm-select/README.md | 6 + .../component-elm-select/dist/index.esm.js | 200 + .../dist/index.esm.min.js | 7 + .../component-elm-select/dist/index.js | 208 + .../component-elm-select/dist/index.min.js | 7 + .../component-elm-select/package.json | 51 + .../component-elm-select/src/component.jsx | 52 + .../component-elm-select/src/index.js | 3 + .../formCreate/component-elm-tree/LICENSE | 21 + .../formCreate/component-elm-tree/README.md | 6 + .../component-elm-tree/dist/index.esm.js | 78 + .../component-elm-tree/dist/index.esm.min.js | 7 + .../component-elm-tree/dist/index.js | 86 + .../component-elm-tree/dist/index.min.js | 7 + .../component-elm-tree/package.json | 51 + .../component-elm-tree/src/component.jsx | 62 + .../component-elm-tree/src/index.js | 3 + .../formCreate/component-elm-upload/LICENSE | 21 + .../formCreate/component-elm-upload/README.md | 6 + .../component-elm-upload/dist/index.esm.js | 252 + .../dist/index.esm.min.js | 7 + .../component-elm-upload/dist/index.js | 260 + .../component-elm-upload/dist/index.min.js | 7 + .../component-elm-upload/package.json | 51 + .../component-elm-upload/src/IconUpload.vue | 12 + .../component-elm-upload/src/component.jsx | 106 + .../component-elm-upload/src/index.js | 3 + .../component-elm-upload/src/style.css | 7 + .../formCreate/component-subform/LICENSE | 21 + .../formCreate/component-subform/README.md | 6 + .../component-subform/dist/index.esm.js | 92 + .../component-subform/dist/index.esm.min.js | 7 + .../component-subform/dist/index.js | 100 + .../component-subform/dist/index.min.js | 7 + .../formCreate/component-subform/package.json | 48 + .../component-subform/src/component.jsx | 76 + .../formCreate/component-subform/src/index.js | 3 + src/components/formCreate/core/LICENSE | 21 + src/components/formCreate/core/README.md | 25 + .../formCreate/core/dist/index.esm.js | 4951 +++++++++++ .../formCreate/core/dist/index.esm.min.js | 7 + src/components/formCreate/core/package.json | 61 + .../core/src/components/formCreate.js | 214 + .../core/src/components/fragment.js | 12 + .../formCreate/core/src/factory/context.js | 274 + .../formCreate/core/src/factory/creator.js | 63 + .../formCreate/core/src/factory/maker.js | 17 + .../formCreate/core/src/factory/manager.js | 77 + .../formCreate/core/src/factory/node.js | 85 + .../formCreate/core/src/factory/parser.js | 22 + .../formCreate/core/src/frame/api.js | 498 ++ .../formCreate/core/src/frame/attrs.js | 12 + .../formCreate/core/src/frame/fetch.js | 104 + .../formCreate/core/src/frame/index.js | 448 + .../formCreate/core/src/frame/provider.js | 200 + .../formCreate/core/src/frame/util.js | 220 + .../formCreate/core/src/handler/context.js | 265 + .../formCreate/core/src/handler/effect.js | 122 + .../formCreate/core/src/handler/index.js | 101 + .../formCreate/core/src/handler/inject.js | 103 + .../formCreate/core/src/handler/input.js | 143 + .../formCreate/core/src/handler/lifecycle.js | 33 + .../formCreate/core/src/handler/loader.js | 364 + .../formCreate/core/src/handler/page.js | 46 + .../formCreate/core/src/handler/render.js | 29 + src/components/formCreate/core/src/index.js | 12 + .../formCreate/core/src/parser/html.js | 17 + .../formCreate/core/src/render/cache.js | 47 + .../formCreate/core/src/render/index.js | 31 + .../formCreate/core/src/render/render.js | 363 + .../formCreate/core/types/index.d.ts | 699 ++ src/components/formCreate/element-ui/LICENSE | 21 + .../formCreate/element-ui/README.md | 30 + .../formCreate/element-ui/auto-import.d.ts | 5 + .../formCreate/element-ui/auto-import.js | 92 + .../element-ui/dist/form-create.esm.js | 7529 ++++++++++++++++ .../element-ui/dist/form-create.esm.min.js | 7 + .../formCreate/element-ui/dist/form-create.js | 7538 +++++++++++++++++ .../element-ui/dist/form-create.min.js | 7 + .../formCreate/element-ui/package.json | 91 + .../src/components/icon/IconWarning.vue | 12 + .../element-ui/src/components/index.js | 22 + .../formCreate/element-ui/src/core/alias.js | 33 + .../formCreate/element-ui/src/core/api.js | 131 + .../formCreate/element-ui/src/core/config.js | 33 + .../formCreate/element-ui/src/core/index.js | 49 + .../formCreate/element-ui/src/core/maker.js | 76 + .../formCreate/element-ui/src/core/manager.js | 285 + .../element-ui/src/core/provider.js | 48 + .../formCreate/element-ui/src/index.js | 13 + .../element-ui/src/parsers/datePicker.js | 30 + .../element-ui/src/parsers/hidden.js | 12 + .../element-ui/src/parsers/index.js | 17 + .../element-ui/src/parsers/input.js | 21 + .../formCreate/element-ui/src/parsers/row.js | 10 + .../element-ui/src/parsers/select.js | 15 + .../element-ui/src/parsers/slider.js | 21 + .../element-ui/src/parsers/timePicker.js | 17 + .../formCreate/element-ui/src/style/index.css | 11 + .../formCreate/element-ui/types/config.d.ts | 145 + .../formCreate/element-ui/types/index.d.ts | 28 + .../formCreate/element-ui/types/maker.d.ts | 14 + src/components/formCreate/utils/LICENSE | 21 + src/components/formCreate/utils/README.md | 24 + .../formCreate/utils/lib/console.js | 16 + .../formCreate/utils/lib/debounce.js | 9 + .../formCreate/utils/lib/deepextend.js | 51 + .../formCreate/utils/lib/deepset.js | 14 + src/components/formCreate/utils/lib/extend.js | 20 + src/components/formCreate/utils/lib/index.js | 13 + src/components/formCreate/utils/lib/json.js | 85 + .../formCreate/utils/lib/mergeprops.js | 62 + src/components/formCreate/utils/lib/mitt.js | 43 + src/components/formCreate/utils/lib/modify.js | 8 + src/components/formCreate/utils/lib/slot.js | 8 + .../formCreate/utils/lib/toarray.js | 5 + src/components/formCreate/utils/lib/tocase.js | 11 + src/components/formCreate/utils/lib/todate.js | 10 + src/components/formCreate/utils/lib/toline.js | 10 + .../formCreate/utils/lib/tostring.js | 7 + src/components/formCreate/utils/lib/type.js | 45 + src/components/formCreate/utils/lib/unique.js | 6 + src/components/formCreate/utils/package.json | 32 + src/main.ts | 7 + src/views/workbench/index1.vue | 43 + src/views/workbench/index3.vue | 220 - 172 files changed, 33702 insertions(+), 226 deletions(-) create mode 100644 src/components/formCreate/component-elm-checkbox/LICENSE create mode 100644 src/components/formCreate/component-elm-checkbox/README.md create mode 100644 src/components/formCreate/component-elm-checkbox/dist/index.esm.js create mode 100644 src/components/formCreate/component-elm-checkbox/dist/index.esm.min.js create mode 100644 src/components/formCreate/component-elm-checkbox/dist/index.js create mode 100644 src/components/formCreate/component-elm-checkbox/dist/index.min.js create mode 100644 src/components/formCreate/component-elm-checkbox/package.json create mode 100644 src/components/formCreate/component-elm-checkbox/src/component.jsx create mode 100644 src/components/formCreate/component-elm-checkbox/src/index.js create mode 100644 src/components/formCreate/component-elm-frame/LICENSE create mode 100644 src/components/formCreate/component-elm-frame/README.md create mode 100644 src/components/formCreate/component-elm-frame/dist/index.esm.js create mode 100644 src/components/formCreate/component-elm-frame/dist/index.esm.min.js create mode 100644 src/components/formCreate/component-elm-frame/dist/index.js create mode 100644 src/components/formCreate/component-elm-frame/dist/index.min.js create mode 100644 src/components/formCreate/component-elm-frame/package.json create mode 100644 src/components/formCreate/component-elm-frame/src/IconCircleClose.vue create mode 100644 src/components/formCreate/component-elm-frame/src/IconDelete.vue create mode 100644 src/components/formCreate/component-elm-frame/src/IconDocument.vue create mode 100644 src/components/formCreate/component-elm-frame/src/IconFolderOpened.vue create mode 100644 src/components/formCreate/component-elm-frame/src/IconView.vue create mode 100644 src/components/formCreate/component-elm-frame/src/component.jsx create mode 100644 src/components/formCreate/component-elm-frame/src/index.js create mode 100644 src/components/formCreate/component-elm-frame/src/style.css create mode 100644 src/components/formCreate/component-elm-group/LICENSE create mode 100644 src/components/formCreate/component-elm-group/README.md create mode 100644 src/components/formCreate/component-elm-group/dist/index.esm.js create mode 100644 src/components/formCreate/component-elm-group/dist/index.esm.min.js create mode 100644 src/components/formCreate/component-elm-group/dist/index.js create mode 100644 src/components/formCreate/component-elm-group/dist/index.min.js create mode 100644 src/components/formCreate/component-elm-group/package.json create mode 100644 src/components/formCreate/component-elm-group/src/component.jsx create mode 100644 src/components/formCreate/component-elm-group/src/index.js create mode 100644 src/components/formCreate/component-elm-group/src/style.css create mode 100644 src/components/formCreate/component-elm-radio/LICENSE create mode 100644 src/components/formCreate/component-elm-radio/README.md create mode 100644 src/components/formCreate/component-elm-radio/dist/index.esm.js create mode 100644 src/components/formCreate/component-elm-radio/dist/index.esm.min.js create mode 100644 src/components/formCreate/component-elm-radio/dist/index.js create mode 100644 src/components/formCreate/component-elm-radio/dist/index.min.js create mode 100644 src/components/formCreate/component-elm-radio/package.json create mode 100644 src/components/formCreate/component-elm-radio/src/component.jsx create mode 100644 src/components/formCreate/component-elm-radio/src/index.js create mode 100644 src/components/formCreate/component-elm-select/LICENSE create mode 100644 src/components/formCreate/component-elm-select/README.md create mode 100644 src/components/formCreate/component-elm-select/dist/index.esm.js create mode 100644 src/components/formCreate/component-elm-select/dist/index.esm.min.js create mode 100644 src/components/formCreate/component-elm-select/dist/index.js create mode 100644 src/components/formCreate/component-elm-select/dist/index.min.js create mode 100644 src/components/formCreate/component-elm-select/package.json create mode 100644 src/components/formCreate/component-elm-select/src/component.jsx create mode 100644 src/components/formCreate/component-elm-select/src/index.js create mode 100644 src/components/formCreate/component-elm-tree/LICENSE create mode 100644 src/components/formCreate/component-elm-tree/README.md create mode 100644 src/components/formCreate/component-elm-tree/dist/index.esm.js create mode 100644 src/components/formCreate/component-elm-tree/dist/index.esm.min.js create mode 100644 src/components/formCreate/component-elm-tree/dist/index.js create mode 100644 src/components/formCreate/component-elm-tree/dist/index.min.js create mode 100644 src/components/formCreate/component-elm-tree/package.json create mode 100644 src/components/formCreate/component-elm-tree/src/component.jsx create mode 100644 src/components/formCreate/component-elm-tree/src/index.js create mode 100644 src/components/formCreate/component-elm-upload/LICENSE create mode 100644 src/components/formCreate/component-elm-upload/README.md create mode 100644 src/components/formCreate/component-elm-upload/dist/index.esm.js create mode 100644 src/components/formCreate/component-elm-upload/dist/index.esm.min.js create mode 100644 src/components/formCreate/component-elm-upload/dist/index.js create mode 100644 src/components/formCreate/component-elm-upload/dist/index.min.js create mode 100644 src/components/formCreate/component-elm-upload/package.json create mode 100644 src/components/formCreate/component-elm-upload/src/IconUpload.vue create mode 100644 src/components/formCreate/component-elm-upload/src/component.jsx create mode 100644 src/components/formCreate/component-elm-upload/src/index.js create mode 100644 src/components/formCreate/component-elm-upload/src/style.css create mode 100644 src/components/formCreate/component-subform/LICENSE create mode 100644 src/components/formCreate/component-subform/README.md create mode 100644 src/components/formCreate/component-subform/dist/index.esm.js create mode 100644 src/components/formCreate/component-subform/dist/index.esm.min.js create mode 100644 src/components/formCreate/component-subform/dist/index.js create mode 100644 src/components/formCreate/component-subform/dist/index.min.js create mode 100644 src/components/formCreate/component-subform/package.json create mode 100644 src/components/formCreate/component-subform/src/component.jsx create mode 100644 src/components/formCreate/component-subform/src/index.js create mode 100644 src/components/formCreate/core/LICENSE create mode 100644 src/components/formCreate/core/README.md create mode 100644 src/components/formCreate/core/dist/index.esm.js create mode 100644 src/components/formCreate/core/dist/index.esm.min.js create mode 100644 src/components/formCreate/core/package.json create mode 100644 src/components/formCreate/core/src/components/formCreate.js create mode 100644 src/components/formCreate/core/src/components/fragment.js create mode 100644 src/components/formCreate/core/src/factory/context.js create mode 100644 src/components/formCreate/core/src/factory/creator.js create mode 100644 src/components/formCreate/core/src/factory/maker.js create mode 100644 src/components/formCreate/core/src/factory/manager.js create mode 100644 src/components/formCreate/core/src/factory/node.js create mode 100644 src/components/formCreate/core/src/factory/parser.js create mode 100644 src/components/formCreate/core/src/frame/api.js create mode 100644 src/components/formCreate/core/src/frame/attrs.js create mode 100644 src/components/formCreate/core/src/frame/fetch.js create mode 100644 src/components/formCreate/core/src/frame/index.js create mode 100644 src/components/formCreate/core/src/frame/provider.js create mode 100644 src/components/formCreate/core/src/frame/util.js create mode 100644 src/components/formCreate/core/src/handler/context.js create mode 100644 src/components/formCreate/core/src/handler/effect.js create mode 100644 src/components/formCreate/core/src/handler/index.js create mode 100644 src/components/formCreate/core/src/handler/inject.js create mode 100644 src/components/formCreate/core/src/handler/input.js create mode 100644 src/components/formCreate/core/src/handler/lifecycle.js create mode 100644 src/components/formCreate/core/src/handler/loader.js create mode 100644 src/components/formCreate/core/src/handler/page.js create mode 100644 src/components/formCreate/core/src/handler/render.js create mode 100644 src/components/formCreate/core/src/index.js create mode 100644 src/components/formCreate/core/src/parser/html.js create mode 100644 src/components/formCreate/core/src/render/cache.js create mode 100644 src/components/formCreate/core/src/render/index.js create mode 100644 src/components/formCreate/core/src/render/render.js create mode 100644 src/components/formCreate/core/types/index.d.ts create mode 100644 src/components/formCreate/element-ui/LICENSE create mode 100644 src/components/formCreate/element-ui/README.md create mode 100644 src/components/formCreate/element-ui/auto-import.d.ts create mode 100644 src/components/formCreate/element-ui/auto-import.js create mode 100644 src/components/formCreate/element-ui/dist/form-create.esm.js create mode 100644 src/components/formCreate/element-ui/dist/form-create.esm.min.js create mode 100644 src/components/formCreate/element-ui/dist/form-create.js create mode 100644 src/components/formCreate/element-ui/dist/form-create.min.js create mode 100644 src/components/formCreate/element-ui/package.json create mode 100644 src/components/formCreate/element-ui/src/components/icon/IconWarning.vue create mode 100644 src/components/formCreate/element-ui/src/components/index.js create mode 100644 src/components/formCreate/element-ui/src/core/alias.js create mode 100644 src/components/formCreate/element-ui/src/core/api.js create mode 100644 src/components/formCreate/element-ui/src/core/config.js create mode 100644 src/components/formCreate/element-ui/src/core/index.js create mode 100644 src/components/formCreate/element-ui/src/core/maker.js create mode 100644 src/components/formCreate/element-ui/src/core/manager.js create mode 100644 src/components/formCreate/element-ui/src/core/provider.js create mode 100644 src/components/formCreate/element-ui/src/index.js create mode 100644 src/components/formCreate/element-ui/src/parsers/datePicker.js create mode 100644 src/components/formCreate/element-ui/src/parsers/hidden.js create mode 100644 src/components/formCreate/element-ui/src/parsers/index.js create mode 100644 src/components/formCreate/element-ui/src/parsers/input.js create mode 100644 src/components/formCreate/element-ui/src/parsers/row.js create mode 100644 src/components/formCreate/element-ui/src/parsers/select.js create mode 100644 src/components/formCreate/element-ui/src/parsers/slider.js create mode 100644 src/components/formCreate/element-ui/src/parsers/timePicker.js create mode 100644 src/components/formCreate/element-ui/src/style/index.css create mode 100644 src/components/formCreate/element-ui/types/config.d.ts create mode 100644 src/components/formCreate/element-ui/types/index.d.ts create mode 100644 src/components/formCreate/element-ui/types/maker.d.ts create mode 100644 src/components/formCreate/utils/LICENSE create mode 100644 src/components/formCreate/utils/README.md create mode 100644 src/components/formCreate/utils/lib/console.js create mode 100644 src/components/formCreate/utils/lib/debounce.js create mode 100644 src/components/formCreate/utils/lib/deepextend.js create mode 100644 src/components/formCreate/utils/lib/deepset.js create mode 100644 src/components/formCreate/utils/lib/extend.js create mode 100644 src/components/formCreate/utils/lib/index.js create mode 100644 src/components/formCreate/utils/lib/json.js create mode 100644 src/components/formCreate/utils/lib/mergeprops.js create mode 100644 src/components/formCreate/utils/lib/mitt.js create mode 100644 src/components/formCreate/utils/lib/modify.js create mode 100644 src/components/formCreate/utils/lib/slot.js create mode 100644 src/components/formCreate/utils/lib/toarray.js create mode 100644 src/components/formCreate/utils/lib/tocase.js create mode 100644 src/components/formCreate/utils/lib/todate.js create mode 100644 src/components/formCreate/utils/lib/toline.js create mode 100644 src/components/formCreate/utils/lib/tostring.js create mode 100644 src/components/formCreate/utils/lib/type.js create mode 100644 src/components/formCreate/utils/lib/unique.js create mode 100644 src/components/formCreate/utils/package.json create mode 100644 src/views/workbench/index1.vue delete mode 100644 src/views/workbench/index3.vue diff --git a/package-lock.json b/package-lock.json index ef8d5fd..e9d1849 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "axios": "^0.27.2", "css-color-function": "^1.3.3", "echarts": "^5.3.3", - "element-plus": "2.2.27", + "element-plus": "^2.7.6", "highlight.js": "^11.6.0", "moment": "^2.30.1", "nprogress": "^0.2.0", @@ -3097,12 +3097,12 @@ "dev": true }, "node_modules/element-plus": { - "version": "2.2.27", - "resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.2.27.tgz", - "integrity": "sha512-P04HDOZBYDdvlYuleuCZRULzAc5xJVOBfLDK9xWxVo0vyo8ntdaXS5sTU+/76vrNzuO3FhLn9kvrsbiJEVa1jg==", + "version": "2.7.6", + "resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.7.6.tgz", + "integrity": "sha512-36sw1K23hYjgeooR10U6CiCaCp2wvOqwoFurADZVlekeQ9v5U1FhJCFGEXO6i/kZBBMwsE1c9fxjLs9LENw2Rg==", "dependencies": { "@ctrl/tinycolor": "^3.4.1", - "@element-plus/icons-vue": "^2.0.6", + "@element-plus/icons-vue": "^2.3.1", "@floating-ui/dom": "^1.0.1", "@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7", "@types/lodash": "^4.14.182", diff --git a/package.json b/package.json index 9a01b37..659ca46 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "axios": "^0.27.2", "css-color-function": "^1.3.3", "echarts": "^5.3.3", - "element-plus": "2.2.27", + "element-plus": "^2.7.6", "highlight.js": "^11.6.0", "moment": "^2.30.1", "nprogress": "^0.2.0", diff --git a/src/components/formCreate/component-elm-checkbox/LICENSE b/src/components/formCreate/component-elm-checkbox/LICENSE new file mode 100644 index 0000000..210009a --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 xaboy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/components/formCreate/component-elm-checkbox/README.md b/src/components/formCreate/component-elm-checkbox/README.md new file mode 100644 index 0000000..adb49d0 --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/README.md @@ -0,0 +1,6 @@ +# @form-create/component-elm-checkbox + +@form-create/element-ui 内置组件 + +[GitHub](https://github.com/xaboy/form-create) | [文档](http://form-create.com/v3/) | [Document](http://form-create.com/v3/) + diff --git a/src/components/formCreate/component-elm-checkbox/dist/index.esm.js b/src/components/formCreate/component-elm-checkbox/dist/index.esm.js new file mode 100644 index 0000000..b9ba01e --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/dist/index.esm.js @@ -0,0 +1,228 @@ +/*! + * @form-create/component-elm-checkbox v3.2.0 + * (c) 2018-2024 xaboy + * Github https://github.com/xaboy/form-create with checkbox + * Released under the MIT License. + */ +import { defineComponent, toRef, ref, watch, createVNode, resolveComponent, mergeProps } from 'vue'; + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + + if (enumerableOnly) { + symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + + keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); +} + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); +} + +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; +} + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +function getSlot(slots, exclude) { + return Object.keys(slots).reduce(function (lst, name) { + if (!exclude || exclude.indexOf(name) === -1) { + lst.push(slots[name]); + } + + return lst; + }, []); +} + +function toArray(value) { + return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value]; +} + +var NAME = 'fcCheckbox'; +var Checkbox = defineComponent({ + name: NAME, + inheritAttrs: false, + props: { + formCreateInject: Object, + modelValue: { + type: Array, + "default": function _default() { + return []; + } + }, + type: String, + input: Boolean, + inputValue: String + }, + emits: ['update:modelValue', 'fc.el'], + setup: function setup(props, _) { + var options = toRef(props.formCreateInject, 'options', []); + var value = toRef(props, 'modelValue'); + var inputValue = toRef(props, 'inputValue', ''); + var customValue = ref(inputValue.value); + var input = toRef(props, 'input', false); + + var updateCustomValue = function updateCustomValue(n) { + var _value = _toConsumableArray(toArray(value.value)); + + var idx = _value.indexOf(customValue.value); + + customValue.value = n; + + if (idx > -1) { + _value.splice(idx, 1); + + _value.push(n); + + onInput(_value); + } + }; + + watch(inputValue, function (n) { + if (!input.value) { + customValue.value = n; + return undefined; + } + + updateCustomValue(n); + }); + + var _options = function _options() { + return Array.isArray(options.value) ? options.value : []; + }; + + var onInput = function onInput(n) { + _.emit('update:modelValue', n); + }; + + return { + options: _options, + value: value, + onInput: onInput, + updateCustomValue: updateCustomValue, + makeInput: function makeInput(Type) { + if (!input.value) { + return undefined; + } + + return createVNode(Type, { + "value": customValue.value, + "label": customValue.value + }, { + "default": function _default() { + return [createVNode(resolveComponent("ElInput"), { + "modelValue": customValue.value, + "onUpdate:modelValue": updateCustomValue + }, null)]; + } + }); + } + }; + }, + render: function render() { + var _this$$slots$default, + _this$$slots, + _this = this; + + var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox'; + var Type = resolveComponent(name); + return createVNode(resolveComponent("ElCheckboxGroup"), mergeProps(this.$attrs, { + "modelValue": this.value, + "onUpdate:modelValue": this.onInput, + "ref": "el" + }), _objectSpread2({ + "default": function _default() { + return [_this.options().map(function (opt, index) { + var props = _objectSpread2({}, opt); + + var value = props.value; + var label = props.label; + delete props.value; + delete props.label; + return createVNode(Type, mergeProps(props, { + "label": value, + "value": value, + "key": name + index + '-' + value + }), { + "default": function _default() { + return [label || value || '']; + } + }); + }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots), _this.makeInput(Type)]; + } + }, getSlot(this.$slots, ['default']))); + }, + mounted: function mounted() { + this.$emit('fc.el', this.$refs.el); + } +}); + +export { Checkbox as default }; diff --git a/src/components/formCreate/component-elm-checkbox/dist/index.esm.min.js b/src/components/formCreate/component-elm-checkbox/dist/index.esm.min.js new file mode 100644 index 0000000..259692f --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/dist/index.esm.min.js @@ -0,0 +1,7 @@ +/*! + * @form-create/component-elm-checkbox v3.2.0 + * (c) 2018-2024 xaboy + * Github https://github.com/xaboy/form-create with checkbox + * Released under the MIT License. + */ +import{defineComponent as e,toRef as t,ref as r,watch as n,createVNode as u,resolveComponent as o,mergeProps as l}from"vue";function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1?[]:[e]}(i.value)),r=t.indexOf(p.value);p.value=e,r>-1&&(t.splice(r,1),t.push(e),b(t))};n(c,(function(e){s.value?d(e):p.value=e}));var b=function(e){l.emit("update:modelValue",e)};return{options:function(){return Array.isArray(a.value)?a.value:[]},value:i,onInput:b,updateCustomValue:d,makeInput:function(e){if(s.value)return u(e,{value:p.value,label:p.value},{default:function(){return[u(o("ElInput"),{modelValue:p.value,"onUpdate:modelValue":d},null)]}})}}},render:function(){var e,t,r,n,a=this,c="button"===this.type?"ElCheckboxButton":"ElCheckbox",f=o(c);return u(o("ElCheckboxGroup"),l(this.$attrs,{modelValue:this.value,"onUpdate:modelValue":this.onInput,ref:"el"}),i({default:function(){return[a.options().map((function(e,t){var r=i({},e),n=r.value,o=r.label;return delete r.value,delete r.label,u(f,l(r,{label:n,value:n,key:c+t+"-"+n}),{default:function(){return[o||n||""]}})})),null===(e=(t=a.$slots).default)||void 0===e?void 0:e.call(t),a.makeInput(f)]}},(r=this.$slots,n=["default"],Object.keys(r).reduce((function(e,t){return n&&-1!==n.indexOf(t)||e.push(r[t]),e}),[]))))},mounted:function(){this.$emit("fc.el",this.$refs.el)}});export{s as default}; diff --git a/src/components/formCreate/component-elm-checkbox/dist/index.js b/src/components/formCreate/component-elm-checkbox/dist/index.js new file mode 100644 index 0000000..706a648 --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/dist/index.js @@ -0,0 +1,236 @@ +/*! + * @form-create/component-elm-checkbox v3.2.0 + * (c) 2018-2024 xaboy + * Github https://github.com/xaboy/form-create with checkbox + * Released under the MIT License. + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) : + typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FcCheckbox = {}, global.Vue)); +})(this, (function (exports, vue) { 'use strict'; + + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + + if (enumerableOnly) { + symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + + keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; + } + + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function getSlot(slots, exclude) { + return Object.keys(slots).reduce(function (lst, name) { + if (!exclude || exclude.indexOf(name) === -1) { + lst.push(slots[name]); + } + + return lst; + }, []); + } + + function toArray(value) { + return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value]; + } + + var NAME = 'fcCheckbox'; + var Checkbox = vue.defineComponent({ + name: NAME, + inheritAttrs: false, + props: { + formCreateInject: Object, + modelValue: { + type: Array, + "default": function _default() { + return []; + } + }, + type: String, + input: Boolean, + inputValue: String + }, + emits: ['update:modelValue', 'fc.el'], + setup: function setup(props, _) { + var options = vue.toRef(props.formCreateInject, 'options', []); + var value = vue.toRef(props, 'modelValue'); + var inputValue = vue.toRef(props, 'inputValue', ''); + var customValue = vue.ref(inputValue.value); + var input = vue.toRef(props, 'input', false); + + var updateCustomValue = function updateCustomValue(n) { + var _value = _toConsumableArray(toArray(value.value)); + + var idx = _value.indexOf(customValue.value); + + customValue.value = n; + + if (idx > -1) { + _value.splice(idx, 1); + + _value.push(n); + + onInput(_value); + } + }; + + vue.watch(inputValue, function (n) { + if (!input.value) { + customValue.value = n; + return undefined; + } + + updateCustomValue(n); + }); + + var _options = function _options() { + return Array.isArray(options.value) ? options.value : []; + }; + + var onInput = function onInput(n) { + _.emit('update:modelValue', n); + }; + + return { + options: _options, + value: value, + onInput: onInput, + updateCustomValue: updateCustomValue, + makeInput: function makeInput(Type) { + if (!input.value) { + return undefined; + } + + return vue.createVNode(Type, { + "value": customValue.value, + "label": customValue.value + }, { + "default": function _default() { + return [vue.createVNode(vue.resolveComponent("ElInput"), { + "modelValue": customValue.value, + "onUpdate:modelValue": updateCustomValue + }, null)]; + } + }); + } + }; + }, + render: function render() { + var _this$$slots$default, + _this$$slots, + _this = this; + + var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox'; + var Type = vue.resolveComponent(name); + return vue.createVNode(vue.resolveComponent("ElCheckboxGroup"), vue.mergeProps(this.$attrs, { + "modelValue": this.value, + "onUpdate:modelValue": this.onInput, + "ref": "el" + }), _objectSpread2({ + "default": function _default() { + return [_this.options().map(function (opt, index) { + var props = _objectSpread2({}, opt); + + var value = props.value; + var label = props.label; + delete props.value; + delete props.label; + return vue.createVNode(Type, vue.mergeProps(props, { + "label": value, + "value": value, + "key": name + index + '-' + value + }), { + "default": function _default() { + return [label || value || '']; + } + }); + }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots), _this.makeInput(Type)]; + } + }, getSlot(this.$slots, ['default']))); + }, + mounted: function mounted() { + this.$emit('fc.el', this.$refs.el); + } + }); + + exports["default"] = Checkbox; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); diff --git a/src/components/formCreate/component-elm-checkbox/dist/index.min.js b/src/components/formCreate/component-elm-checkbox/dist/index.min.js new file mode 100644 index 0000000..912dffa --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/dist/index.min.js @@ -0,0 +1,7 @@ +/*! + * @form-create/component-elm-checkbox v3.2.0 + * (c) 2018-2024 xaboy + * Github https://github.com/xaboy/form-create with checkbox + * Released under the MIT License. + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FcCheckbox={},e.Vue)}(this,(function(e,t){"use strict";function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1?[]:[e]}(o.value)),r=t.indexOf(a.value);a.value=e,r>-1&&(t.splice(r,1),t.push(e),c(t))};t.watch(l,(function(e){i.value?f(e):a.value=e}));var c=function(e){r.emit("update:modelValue",e)};return{options:function(){return Array.isArray(n.value)?n.value:[]},value:o,onInput:c,updateCustomValue:f,makeInput:function(e){if(i.value)return t.createVNode(e,{value:a.value,label:a.value},{default:function(){return[t.createVNode(t.resolveComponent("ElInput"),{modelValue:a.value,"onUpdate:modelValue":f},null)]}})}}},render:function(){var e,r,o,u,l=this,a="button"===this.type?"ElCheckboxButton":"ElCheckbox",i=t.resolveComponent(a);return t.createVNode(t.resolveComponent("ElCheckboxGroup"),t.mergeProps(this.$attrs,{modelValue:this.value,"onUpdate:modelValue":this.onInput,ref:"el"}),n({default:function(){return[l.options().map((function(e,r){var o=n({},e),u=o.value,l=o.label;return delete o.value,delete o.label,t.createVNode(i,t.mergeProps(o,{label:u,value:u,key:a+r+"-"+u}),{default:function(){return[l||u||""]}})})),null===(e=(r=l.$slots).default)||void 0===e?void 0:e.call(r),l.makeInput(i)]}},(o=this.$slots,u=["default"],Object.keys(o).reduce((function(e,t){return u&&-1!==u.indexOf(t)||e.push(o[t]),e}),[]))))},mounted:function(){this.$emit("fc.el",this.$refs.el)}});e.default=a,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/src/components/formCreate/component-elm-checkbox/package.json b/src/components/formCreate/component-elm-checkbox/package.json new file mode 100644 index 0000000..04f0134 --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/package.json @@ -0,0 +1,51 @@ +{ + "name": "@form-create/component-elm-checkbox", + "version": "3.2.0", + "description": "@form-create/element-ui 内置组件", + "main": "./dist/index.min.js", + "module": "./dist/index.esm.js", + "unpkg": "./dist/index.min.js", + "jsdelivr": "./dist/index.min.js", + "scripts": { + "clean": "rimraf dist/", + "bili": "cross-env bili", + "build": "npm-run-all clean bili" + }, + "files": [ + "README.md", + "package.json", + "LICENSE", + "src", + "dist" + ], + "keywords": [ + "@form-create", + "form-create-component", + "element-ui" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/xaboy/form-create.git" + }, + "author": "xaboy", + "license": "MIT", + "bugs": { + "url": "https://github.com/xaboy/form-create/issues" + }, + "homepage": "http://www.form-create.com", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@form-create/utils": "^3.2.0" + }, + "buildFormCreateOptions": { + "name": "@form-create/component-elm-checkbox", + "exportName": "FcCheckbox", + "formats": [ + "umd", + "esm" + ] + }, + "gitHead": "551b0e9acfcfd4e9a583880dc4fb5f96fe65d6a5" +} diff --git a/src/components/formCreate/component-elm-checkbox/src/component.jsx b/src/components/formCreate/component-elm-checkbox/src/component.jsx new file mode 100644 index 0000000..5583e6b --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/src/component.jsx @@ -0,0 +1,84 @@ +import {defineComponent, ref, resolveComponent, toRef, watch} from 'vue'; +import getSlot from '@form-create/utils/lib/slot'; +import toArray from '@form-create/utils/lib/toarray'; + +const NAME = 'fcCheckbox'; + +export default defineComponent({ + name: NAME, + inheritAttrs: false, + props: { + formCreateInject: Object, + modelValue: { + type: Array, + default: () => [] + }, + type: String, + input: Boolean, + inputValue: String, + }, + emits: ['update:modelValue', 'fc.el'], + setup(props, _) { + const options = toRef(props.formCreateInject, 'options', []); + const value = toRef(props, 'modelValue'); + const inputValue = toRef(props, 'inputValue', ''); + const customValue = ref(inputValue.value); + const input = toRef(props, 'input', false); + const updateCustomValue = (n) => { + const _value = [...toArray(value.value)]; + const idx = _value.indexOf(customValue.value); + customValue.value = n; + if (idx > -1) { + _value.splice(idx, 1); + _value.push(n); + onInput(_value); + } + } + watch(inputValue, (n) => { + if (!input.value) { + customValue.value = n; + return undefined; + } + updateCustomValue(n); + }) + const _options = () => { + return Array.isArray(options.value) ? options.value : [] + } + const onInput = (n) => { + _.emit('update:modelValue', n); + }; + + return { + options: _options, + value, + onInput, + updateCustomValue, + makeInput(Type) { + if (!input.value) { + return undefined; + } + return + + + }, + } + }, + render() { + const name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox'; + const Type = resolveComponent(name); + return {this.options().map((opt, index) => { + const props = {...opt}; + const value = props.value; + const label = props.label; + delete props.value; + delete props.label; + return {label || value || ''} + })}{this.$slots.default?.()}{this.makeInput(Type)} + }, + mounted() { + this.$emit('fc.el', this.$refs.el); + } +}); diff --git a/src/components/formCreate/component-elm-checkbox/src/index.js b/src/components/formCreate/component-elm-checkbox/src/index.js new file mode 100644 index 0000000..12e92a5 --- /dev/null +++ b/src/components/formCreate/component-elm-checkbox/src/index.js @@ -0,0 +1,3 @@ +import Checkbox from './component'; + +export default Checkbox; diff --git a/src/components/formCreate/component-elm-frame/LICENSE b/src/components/formCreate/component-elm-frame/LICENSE new file mode 100644 index 0000000..210009a --- /dev/null +++ b/src/components/formCreate/component-elm-frame/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 xaboy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/components/formCreate/component-elm-frame/README.md b/src/components/formCreate/component-elm-frame/README.md new file mode 100644 index 0000000..2321e3d --- /dev/null +++ b/src/components/formCreate/component-elm-frame/README.md @@ -0,0 +1,6 @@ +# @form-create/component-elm-frame + +@form-create/element-ui 内置组件 + +[GitHub](https://github.com/xaboy/form-create) | [文档](http://form-create.com/v3/) | [Document](http://form-create.com/v3/) + diff --git a/src/components/formCreate/component-elm-frame/dist/index.esm.js b/src/components/formCreate/component-elm-frame/dist/index.esm.js new file mode 100644 index 0000000..8facb2b --- /dev/null +++ b/src/components/formCreate/component-elm-frame/dist/index.esm.js @@ -0,0 +1,742 @@ +/*! + * @form-create/component-elm-frame v3.2.0 + * (c) 2018-2024 xaboy + * Github https://github.com/xaboy/form-create with frame + * Released under the MIT License. + */ +import { openBlock, createElementBlock, createElementVNode, defineComponent, createVNode, resolveComponent, mergeProps, isVNode, nextTick } from 'vue'; + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + + if (enumerableOnly) { + symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + + keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function toArray(value) { + return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value]; +} + +// https://github.com/developit/mitt +function Mitt(all) { + all = all || new Map(); + var mitt = { + $on: function $on(type, handler) { + var handlers = all.get(type); + var added = handlers && handlers.push(handler); + + if (!added) { + all.set(type, [handler]); + } + }, + $once: function $once(type, handler) { + handler._once = true; + mitt.$on(type, handler); + }, + $off: function $off(type, handler) { + var handlers = all.get(type); + + if (handlers) { + handlers.splice(handlers.indexOf(handler) >>> 0, 1); + } + }, + $emit: function $emit(type) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + (all.get(type) || []).slice().map(function (handler) { + if (handler._once) { + mitt.$off(type, handler); + delete handler._once; + } + + handler.apply(void 0, args); + }); + (all.get('*') || []).slice().map(function (handler) { + handler(type, args); + }); + } + }; + return mitt; +} + +function styleInject(css, ref) { + if ( ref === void 0 ) ref = {}; + var insertAt = ref.insertAt; + + if (!css || typeof document === 'undefined') { return; } + + var head = document.head || document.getElementsByTagName('head')[0]; + var style = document.createElement('style'); + style.type = 'text/css'; + + if (insertAt === 'top') { + if (head.firstChild) { + head.insertBefore(style, head.firstChild); + } else { + head.appendChild(style); + } + } else { + head.appendChild(style); + } + + if (style.styleSheet) { + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + } +} + +var css_248z = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame._fc-disabled ._fc-upload-btn,._fc-frame._fc-disabled .el-button{color:#999;cursor:not-allowed!important}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}"; +styleInject(css_248z); + +var script$4 = { + name: 'IconCircleClose' +}; + +var _hoisted_1$4 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" +}; + +var _hoisted_2$4 = /*#__PURE__*/createElementVNode("path", { + fill: "currentColor", + d: "M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z" +}, null, -1); + +var _hoisted_3$4 = /*#__PURE__*/createElementVNode("path", { + fill: "currentColor", + d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z" +}, null, -1); + +var _hoisted_4 = [_hoisted_2$4, _hoisted_3$4]; +function render$4(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_4); +} + +script$4.render = render$4; + +var script$3 = { + name: 'IconDocument' +}; + +var _hoisted_1$3 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" +}; + +var _hoisted_2$3 = /*#__PURE__*/createElementVNode("path", { + fill: "currentColor", + d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z" +}, null, -1); + +var _hoisted_3$3 = [_hoisted_2$3]; +function render$3(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", _hoisted_1$3, _hoisted_3$3); +} + +script$3.render = render$3; + +var script$2 = { + name: 'IconDelete' +}; + +var _hoisted_1$2 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" +}; + +var _hoisted_2$2 = /*#__PURE__*/createElementVNode("path", { + fill: "currentColor", + d: "M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z" +}, null, -1); + +var _hoisted_3$2 = [_hoisted_2$2]; +function render$2(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_3$2); +} + +script$2.render = render$2; + +var script$1 = { + name: 'IconView' +}; + +var _hoisted_1$1 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" +}; + +var _hoisted_2$1 = /*#__PURE__*/createElementVNode("path", { + fill: "currentColor", + d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z" +}, null, -1); + +var _hoisted_3$1 = [_hoisted_2$1]; +function render$1(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_3$1); +} + +script$1.render = render$1; + +var script = { + name: 'IconFolderOpened' +}; + +var _hoisted_1 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" +}; + +var _hoisted_2 = /*#__PURE__*/createElementVNode("path", { + fill: "currentColor", + d: "M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z" +}, null, -1); + +var _hoisted_3 = [_hoisted_2]; +function render(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_3); +} + +script.render = render; + +function _isSlot(s) { + return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s); +} + +var NAME = 'fcFrame'; +var Frame = defineComponent({ + name: NAME, + props: { + type: { + type: String, + "default": 'input' + }, + field: String, + helper: { + type: Boolean, + "default": true + }, + disabled: { + type: Boolean, + "default": false + }, + src: { + type: String, + required: true + }, + icon: { + type: String, + "default": 'IconFolderOpened' + }, + width: { + type: String, + "default": '500px' + }, + height: { + type: String, + "default": '370px' + }, + maxLength: { + type: Number, + "default": 0 + }, + okBtnText: { + type: String, + "default": '确定' + }, + closeBtnText: { + type: String, + "default": '关闭' + }, + modalTitle: String, + handleIcon: { + type: [String, Boolean], + "default": undefined + }, + title: String, + allowRemove: { + type: Boolean, + "default": true + }, + onOpen: { + type: Function, + "default": function _default() {} + }, + onOk: { + type: Function, + "default": function _default() {} + }, + onCancel: { + type: Function, + "default": function _default() {} + }, + onLoad: { + type: Function, + "default": function _default() {} + }, + onBeforeRemove: { + type: Function, + "default": function _default() {} + }, + onRemove: { + type: Function, + "default": function _default() {} + }, + onHandle: Function, + modal: { + type: Object, + "default": function _default() { + return {}; + } + }, + srcKey: [String, Number], + modelValue: [Array, String, Number, Object], + previewMask: undefined, + footer: { + type: Boolean, + "default": true + }, + reload: { + type: Boolean, + "default": true + }, + closeBtn: { + type: Boolean, + "default": true + }, + okBtn: { + type: Boolean, + "default": true + }, + formCreateInject: Object + }, + emits: ['update:modelValue', 'change'], + components: { + IconFolderOpened: script, + IconView: script$1 + }, + data: function data() { + return { + fileList: toArray(this.modelValue), + previewVisible: false, + frameVisible: false, + previewImage: '', + bus: new Mitt() + }; + }, + watch: { + modelValue: function modelValue(n) { + this.fileList = toArray(n); + } + }, + methods: { + close: function close() { + this.closeModel(true); + }, + closeModel: function closeModel(close) { + this.bus.$emit(close ? '$close' : '$ok'); + + if (this.reload) { + this.bus.$off('$ok'); + this.bus.$off('$close'); + } + + this.frameVisible = false; + }, + handleCancel: function handleCancel() { + this.previewVisible = false; + }, + showModel: function showModel() { + if (this.disabled || false === this.onOpen()) { + return; + } + + this.frameVisible = true; + }, + input: function input() { + var n = this.fileList; + var val = this.maxLength === 1 ? n[0] || '' : n; + this.$emit('update:modelValue', val); + this.$emit('change', val); + }, + makeInput: function makeInput() { + var _this = this; + + return createVNode(resolveComponent("ElInput"), mergeProps({ + type: 'text', + modelValue: this.fileList.map(function (v) { + return _this.getSrc(v); + }).toString(), + readonly: true + }, { + "key": 1 + }), { + append: function append() { + return createVNode(resolveComponent("ElButton"), { + "icon": resolveComponent(_this.icon), + "onClick": function onClick() { + return _this.showModel(); + } + }, null); + }, + suffix: function suffix() { + return _this.fileList.length && !_this.disabled ? createVNode(resolveComponent("ElIcon"), { + "class": "el-input__icon _fc-upload-icon", + "onClick": function onClick() { + _this.fileList = []; + + _this.input(); + } + }, { + "default": function _default() { + return [createVNode(script$4, null, null)]; + } + }) : null; + } + }); + }, + makeGroup: function makeGroup(children) { + if (!this.maxLength || this.fileList.length < this.maxLength) { + children.push(this.makeBtn()); + } + + return createVNode("div", { + "key": 2 + }, [children]); + }, + makeItem: function makeItem(index, children) { + return createVNode("div", { + "class": "_fc-files", + "key": '3' + index + }, [children]); + }, + valid: function valid(f) { + var field = this.formCreateInject.field || this.field; + + if (field && f !== field) { + throw new Error('[frame]无效的字段值'); + } + }, + makeIcons: function makeIcons(val, index) { + if (this.handleIcon !== false || this.allowRemove === true) { + var icons = []; + + if (this.type !== 'file' && this.handleIcon !== false || this.type === 'file' && this.handleIcon) { + icons.push(this.makeHandleIcon(val, index)); + } + + if (this.allowRemove) { + icons.push(this.makeRemoveIcon(val, index)); + } + + return createVNode("div", { + "class": "_fc-upload-cover", + "key": 4 + }, [icons]); + } + }, + makeHandleIcon: function makeHandleIcon(val, index) { + var _this2 = this; + + var Type = resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'icon-view' : this.handleIcon); + return createVNode(resolveComponent("ElIcon"), { + "onClick": function onClick() { + return _this2.handleClick(val); + }, + "key": '5' + index + }, { + "default": function _default() { + return [createVNode(Type, null, null)]; + } + }); + }, + makeRemoveIcon: function makeRemoveIcon(val, index) { + var _this3 = this; + + return createVNode(resolveComponent("ElIcon"), { + "onClick": function onClick() { + return _this3.handleRemove(val); + }, + "key": '6' + index + }, { + "default": function _default() { + return [createVNode(script$2, null, null)]; + } + }); + }, + makeFiles: function makeFiles() { + var _this4 = this; + + return this.makeGroup(this.fileList.map(function (src, index) { + return _this4.makeItem(index, [createVNode(resolveComponent("ElIcon"), { + "onClick": function onClick() { + return _this4.handleClick(src); + } + }, { + "default": function _default() { + return [createVNode(script$3, null, null)]; + } + }), _this4.makeIcons(src, index)]); + })); + }, + makeImages: function makeImages() { + var _this5 = this; + + return this.makeGroup(this.fileList.map(function (src, index) { + return _this5.makeItem(index, [createVNode("img", { + "src": _this5.getSrc(src) + }, null), _this5.makeIcons(src, index)]); + })); + }, + makeBtn: function makeBtn() { + var _this6 = this; + + var Type = resolveComponent(this.icon); + return createVNode("div", { + "class": "_fc-upload-btn", + "onClick": function onClick() { + return _this6.showModel(); + }, + "key": 7 + }, [createVNode(resolveComponent("ElIcon"), null, { + "default": function _default() { + return [createVNode(Type, null, null)]; + } + })]); + }, + handleClick: function handleClick(src) { + if (this.onHandle) { + return this.onHandle(src); + } else { + this.previewImage = this.getSrc(src); + this.previewVisible = true; + } + }, + handleRemove: function handleRemove(src) { + if (this.disabled) { + return; + } + + if (false !== this.onBeforeRemove(src)) { + this.fileList.splice(this.fileList.indexOf(src), 1); + this.input(); + this.onRemove(src); + } + }, + getSrc: function getSrc(src) { + return !this.srcKey ? src : src[this.srcKey]; + }, + frameLoad: function frameLoad(iframe) { + var _this7 = this; + + this.onLoad(iframe); + + try { + if (this.helper === true) { + iframe['form_create_helper'] = { + api: this.formCreateInject.api, + close: function close(field) { + _this7.valid(field); + + _this7.closeModel(); + }, + set: function set(field, value) { + _this7.valid(field); + + !_this7.disabled && _this7.$emit('update:modelValue', value); + }, + get: function get(field) { + _this7.valid(field); + + return _this7.modelValue; + }, + onOk: function onOk(fn) { + return _this7.bus.$on('$ok', fn); + }, + onClose: function onClose(fn) { + return _this7.bus.$on('$close', fn); + } + }; + } + } catch (e) { + console.error(e); + } + }, + makeFooter: function makeFooter() { + var _this8 = this; + + var _this$$props = this.$props, + okBtnText = _this$$props.okBtnText, + closeBtnText = _this$$props.closeBtnText, + closeBtn = _this$$props.closeBtn, + okBtn = _this$$props.okBtn, + footer = _this$$props.footer; + + if (!footer) { + return; + } + + return createVNode("div", null, [closeBtn ? createVNode(resolveComponent("ElButton"), { + "onClick": function onClick() { + return _this8.onCancel() !== false && (_this8.frameVisible = false); + } + }, _isSlot(closeBtnText) ? closeBtnText : { + "default": function _default() { + return [closeBtnText]; + } + }) : null, okBtn ? createVNode(resolveComponent("ElButton"), { + "type": "primary", + "onClick": function onClick() { + return _this8.onOk() !== false && _this8.closeModel(); + } + }, _isSlot(okBtnText) ? okBtnText : { + "default": function _default() { + return [okBtnText]; + } + }) : null]); + } + }, + render: function render() { + var _this9 = this; + + var type = this.type; + var node; + + if (type === 'input') { + node = this.makeInput(); + } else if (type === 'image') { + node = this.makeImages(); + } else { + node = this.makeFiles(); + } + + var _this$$props2 = this.$props, + _this$$props2$width = _this$$props2.width, + width = _this$$props2$width === void 0 ? '30%' : _this$$props2$width, + height = _this$$props2.height, + src = _this$$props2.src, + title = _this$$props2.title, + modalTitle = _this$$props2.modalTitle; + nextTick(function () { + if (_this9.$refs.frame) { + _this9.frameLoad(_this9.$refs.frame.contentWindow || {}); + } + }); + return createVNode("div", { + "class": { + '_fc-frame': true, + '_fc-disabled': this.disabled + } + }, [node, createVNode(resolveComponent("ElDialog"), { + "appendToBody": true, + "modal": this.previewMask, + "title": modalTitle, + "modelValue": this.previewVisible, + "onClose": this.handleCancel + }, { + "default": function _default() { + return [createVNode("img", { + "style": "width: 100%", + "src": _this9.previewImage + }, null)]; + } + }), createVNode(resolveComponent("ElDialog"), mergeProps({ + "appendToBody": true + }, _objectSpread2({ + width: width, + title: title + }, this.modal), { + "modelValue": this.frameVisible, + "onClose": function onClose() { + return _this9.closeModel(true); + } + }), { + "default": function _default() { + return [_this9.frameVisible || !_this9.reload ? createVNode("iframe", { + "ref": "frame", + "src": src, + "frameBorder": "0", + "style": { + height: height, + 'border': '0 none', + 'width': '100%' + } + }, null) : null]; + }, + footer: function footer() { + return _this9.makeFooter(); + } + })]); + }, + beforeMount: function beforeMount() { + var _this$formCreateInjec = this.formCreateInject, + name = _this$formCreateInjec.name, + field = _this$formCreateInjec.field, + api = _this$formCreateInjec.api; + name && api.on('fc:closeModal:' + name, this.close); + field && api.on('fc:closeModal:' + field, this.close); + }, + beforeUnmount: function beforeUnmount() { + var _this$formCreateInjec2 = this.formCreateInject, + name = _this$formCreateInjec2.name, + field = _this$formCreateInjec2.field, + api = _this$formCreateInjec2.api; + name && api.off('fc:closeModal:' + name, this.close); + field && api.off('fc:closeModal:' + field, this.close); + } +}); + +export { Frame as default }; diff --git a/src/components/formCreate/component-elm-frame/dist/index.esm.min.js b/src/components/formCreate/component-elm-frame/dist/index.esm.min.js new file mode 100644 index 0000000..af4aa2f --- /dev/null +++ b/src/components/formCreate/component-elm-frame/dist/index.esm.min.js @@ -0,0 +1,7 @@ +/*! + * @form-create/component-elm-frame v3.2.0 + * (c) 2018-2024 xaboy + * Github https://github.com/xaboy/form-create with frame + * Released under the MIT License. + */ +import{openBlock as e,createElementBlock as t,createElementVNode as n,defineComponent as o,createVNode as i,resolveComponent as r,mergeProps as l,isVNode as a,nextTick as c}from"vue";function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var t=1;t-1?[]:[e]}function h(e){e=e||new Map;var t={$on:function(t,n){var o=e.get(t);o&&o.push(n)||e.set(t,[n])},$once:function(e,n){n._once=!0,t.$on(e,n)},$off:function(t,n){var o=e.get(t);o&&o.splice(o.indexOf(n)>>>0,1)},$emit:function(n){for(var o=arguments.length,i=new Array(o>1?o-1:0),r=1;r -1 ? [] : [value]; + } + + // https://github.com/developit/mitt + function Mitt(all) { + all = all || new Map(); + var mitt = { + $on: function $on(type, handler) { + var handlers = all.get(type); + var added = handlers && handlers.push(handler); + + if (!added) { + all.set(type, [handler]); + } + }, + $once: function $once(type, handler) { + handler._once = true; + mitt.$on(type, handler); + }, + $off: function $off(type, handler) { + var handlers = all.get(type); + + if (handlers) { + handlers.splice(handlers.indexOf(handler) >>> 0, 1); + } + }, + $emit: function $emit(type) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + (all.get(type) || []).slice().map(function (handler) { + if (handler._once) { + mitt.$off(type, handler); + delete handler._once; + } + + handler.apply(void 0, args); + }); + (all.get('*') || []).slice().map(function (handler) { + handler(type, args); + }); + } + }; + return mitt; + } + + function styleInject(css, ref) { + if ( ref === void 0 ) ref = {}; + var insertAt = ref.insertAt; + + if (!css || typeof document === 'undefined') { return; } + + var head = document.head || document.getElementsByTagName('head')[0]; + var style = document.createElement('style'); + style.type = 'text/css'; + + if (insertAt === 'top') { + if (head.firstChild) { + head.insertBefore(style, head.firstChild); + } else { + head.appendChild(style); + } + } else { + head.appendChild(style); + } + + if (style.styleSheet) { + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + } + } + + var css_248z = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame._fc-disabled ._fc-upload-btn,._fc-frame._fc-disabled .el-button{color:#999;cursor:not-allowed!important}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}"; + styleInject(css_248z); + + var script$4 = { + name: 'IconCircleClose' + }; + + var _hoisted_1$4 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" + }; + + var _hoisted_2$4 = /*#__PURE__*/vue.createElementVNode("path", { + fill: "currentColor", + d: "M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z" + }, null, -1); + + var _hoisted_3$4 = /*#__PURE__*/vue.createElementVNode("path", { + fill: "currentColor", + d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z" + }, null, -1); + + var _hoisted_4 = [_hoisted_2$4, _hoisted_3$4]; + function render$4(_ctx, _cache, $props, $setup, $data, $options) { + return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$4, _hoisted_4); + } + + script$4.render = render$4; + + var script$3 = { + name: 'IconDocument' + }; + + var _hoisted_1$3 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" + }; + + var _hoisted_2$3 = /*#__PURE__*/vue.createElementVNode("path", { + fill: "currentColor", + d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z" + }, null, -1); + + var _hoisted_3$3 = [_hoisted_2$3]; + function render$3(_ctx, _cache, $props, $setup, $data, $options) { + return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$3, _hoisted_3$3); + } + + script$3.render = render$3; + + var script$2 = { + name: 'IconDelete' + }; + + var _hoisted_1$2 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" + }; + + var _hoisted_2$2 = /*#__PURE__*/vue.createElementVNode("path", { + fill: "currentColor", + d: "M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z" + }, null, -1); + + var _hoisted_3$2 = [_hoisted_2$2]; + function render$2(_ctx, _cache, $props, $setup, $data, $options) { + return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, _hoisted_3$2); + } + + script$2.render = render$2; + + var script$1 = { + name: 'IconView' + }; + + var _hoisted_1$1 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" + }; + + var _hoisted_2$1 = /*#__PURE__*/vue.createElementVNode("path", { + fill: "currentColor", + d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z" + }, null, -1); + + var _hoisted_3$1 = [_hoisted_2$1]; + function render$1(_ctx, _cache, $props, $setup, $data, $options) { + return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, _hoisted_3$1); + } + + script$1.render = render$1; + + var script = { + name: 'IconFolderOpened' + }; + + var _hoisted_1 = { + "class": "icon", + viewBox: "0 0 1024 1024", + xmlns: "http://www.w3.org/2000/svg" + }; + + var _hoisted_2 = /*#__PURE__*/vue.createElementVNode("path", { + fill: "currentColor", + d: "M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z" + }, null, -1); + + var _hoisted_3 = [_hoisted_2]; + function render(_ctx, _cache, $props, $setup, $data, $options) { + return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1, _hoisted_3); + } + + script.render = render; + + function _isSlot(s) { + return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s); + } + + var NAME = 'fcFrame'; + var Frame = vue.defineComponent({ + name: NAME, + props: { + type: { + type: String, + "default": 'input' + }, + field: String, + helper: { + type: Boolean, + "default": true + }, + disabled: { + type: Boolean, + "default": false + }, + src: { + type: String, + required: true + }, + icon: { + type: String, + "default": 'IconFolderOpened' + }, + width: { + type: String, + "default": '500px' + }, + height: { + type: String, + "default": '370px' + }, + maxLength: { + type: Number, + "default": 0 + }, + okBtnText: { + type: String, + "default": '确定' + }, + closeBtnText: { + type: String, + "default": '关闭' + }, + modalTitle: String, + handleIcon: { + type: [String, Boolean], + "default": undefined + }, + title: String, + allowRemove: { + type: Boolean, + "default": true + }, + onOpen: { + type: Function, + "default": function _default() {} + }, + onOk: { + type: Function, + "default": function _default() {} + }, + onCancel: { + type: Function, + "default": function _default() {} + }, + onLoad: { + type: Function, + "default": function _default() {} + }, + onBeforeRemove: { + type: Function, + "default": function _default() {} + }, + onRemove: { + type: Function, + "default": function _default() {} + }, + onHandle: Function, + modal: { + type: Object, + "default": function _default() { + return {}; + } + }, + srcKey: [String, Number], + modelValue: [Array, String, Number, Object], + previewMask: undefined, + footer: { + type: Boolean, + "default": true + }, + reload: { + type: Boolean, + "default": true + }, + closeBtn: { + type: Boolean, + "default": true + }, + okBtn: { + type: Boolean, + "default": true + }, + formCreateInject: Object + }, + emits: ['update:modelValue', 'change'], + components: { + IconFolderOpened: script, + IconView: script$1 + }, + data: function data() { + return { + fileList: toArray(this.modelValue), + previewVisible: false, + frameVisible: false, + previewImage: '', + bus: new Mitt() + }; + }, + watch: { + modelValue: function modelValue(n) { + this.fileList = toArray(n); + } + }, + methods: { + close: function close() { + this.closeModel(true); + }, + closeModel: function closeModel(close) { + this.bus.$emit(close ? '$close' : '$ok'); + + if (this.reload) { + this.bus.$off('$ok'); + this.bus.$off('$close'); + } + + this.frameVisible = false; + }, + handleCancel: function handleCancel() { + this.previewVisible = false; + }, + showModel: function showModel() { + if (this.disabled || false === this.onOpen()) { + return; + } + + this.frameVisible = true; + }, + input: function input() { + var n = this.fileList; + var val = this.maxLength === 1 ? n[0] || '' : n; + this.$emit('update:modelValue', val); + this.$emit('change', val); + }, + makeInput: function makeInput() { + var _this = this; + + return vue.createVNode(vue.resolveComponent("ElInput"), vue.mergeProps({ + type: 'text', + modelValue: this.fileList.map(function (v) { + return _this.getSrc(v); + }).toString(), + readonly: true + }, { + "key": 1 + }), { + append: function append() { + return vue.createVNode(vue.resolveComponent("ElButton"), { + "icon": vue.resolveComponent(_this.icon), + "onClick": function onClick() { + return _this.showModel(); + } + }, null); + }, + suffix: function suffix() { + return _this.fileList.length && !_this.disabled ? vue.createVNode(vue.resolveComponent("ElIcon"), { + "class": "el-input__icon _fc-upload-icon", + "onClick": function onClick() { + _this.fileList = []; + + _this.input(); + } + }, { + "default": function _default() { + return [vue.createVNode(script$4, null, null)]; + } + }) : null; + } + }); + }, + makeGroup: function makeGroup(children) { + if (!this.maxLength || this.fileList.length < this.maxLength) { + children.push(this.makeBtn()); + } + + return vue.createVNode("div", { + "key": 2 + }, [children]); + }, + makeItem: function makeItem(index, children) { + return vue.createVNode("div", { + "class": "_fc-files", + "key": '3' + index + }, [children]); + }, + valid: function valid(f) { + var field = this.formCreateInject.field || this.field; + + if (field && f !== field) { + throw new Error('[frame]无效的字段值'); + } + }, + makeIcons: function makeIcons(val, index) { + if (this.handleIcon !== false || this.allowRemove === true) { + var icons = []; + + if (this.type !== 'file' && this.handleIcon !== false || this.type === 'file' && this.handleIcon) { + icons.push(this.makeHandleIcon(val, index)); + } + + if (this.allowRemove) { + icons.push(this.makeRemoveIcon(val, index)); + } + + return vue.createVNode("div", { + "class": "_fc-upload-cover", + "key": 4 + }, [icons]); + } + }, + makeHandleIcon: function makeHandleIcon(val, index) { + var _this2 = this; + + var Type = vue.resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'icon-view' : this.handleIcon); + return vue.createVNode(vue.resolveComponent("ElIcon"), { + "onClick": function onClick() { + return _this2.handleClick(val); + }, + "key": '5' + index + }, { + "default": function _default() { + return [vue.createVNode(Type, null, null)]; + } + }); + }, + makeRemoveIcon: function makeRemoveIcon(val, index) { + var _this3 = this; + + return vue.createVNode(vue.resolveComponent("ElIcon"), { + "onClick": function onClick() { + return _this3.handleRemove(val); + }, + "key": '6' + index + }, { + "default": function _default() { + return [vue.createVNode(script$2, null, null)]; + } + }); + }, + makeFiles: function makeFiles() { + var _this4 = this; + + return this.makeGroup(this.fileList.map(function (src, index) { + return _this4.makeItem(index, [vue.createVNode(vue.resolveComponent("ElIcon"), { + "onClick": function onClick() { + return _this4.handleClick(src); + } + }, { + "default": function _default() { + return [vue.createVNode(script$3, null, null)]; + } + }), _this4.makeIcons(src, index)]); + })); + }, + makeImages: function makeImages() { + var _this5 = this; + + return this.makeGroup(this.fileList.map(function (src, index) { + return _this5.makeItem(index, [vue.createVNode("img", { + "src": _this5.getSrc(src) + }, null), _this5.makeIcons(src, index)]); + })); + }, + makeBtn: function makeBtn() { + var _this6 = this; + + var Type = vue.resolveComponent(this.icon); + return vue.createVNode("div", { + "class": "_fc-upload-btn", + "onClick": function onClick() { + return _this6.showModel(); + }, + "key": 7 + }, [vue.createVNode(vue.resolveComponent("ElIcon"), null, { + "default": function _default() { + return [vue.createVNode(Type, null, null)]; + } + })]); + }, + handleClick: function handleClick(src) { + if (this.onHandle) { + return this.onHandle(src); + } else { + this.previewImage = this.getSrc(src); + this.previewVisible = true; + } + }, + handleRemove: function handleRemove(src) { + if (this.disabled) { + return; + } + + if (false !== this.onBeforeRemove(src)) { + this.fileList.splice(this.fileList.indexOf(src), 1); + this.input(); + this.onRemove(src); + } + }, + getSrc: function getSrc(src) { + return !this.srcKey ? src : src[this.srcKey]; + }, + frameLoad: function frameLoad(iframe) { + var _this7 = this; + + this.onLoad(iframe); + + try { + if (this.helper === true) { + iframe['form_create_helper'] = { + api: this.formCreateInject.api, + close: function close(field) { + _this7.valid(field); + + _this7.closeModel(); + }, + set: function set(field, value) { + _this7.valid(field); + + !_this7.disabled && _this7.$emit('update:modelValue', value); + }, + get: function get(field) { + _this7.valid(field); + + return _this7.modelValue; + }, + onOk: function onOk(fn) { + return _this7.bus.$on('$ok', fn); + }, + onClose: function onClose(fn) { + return _this7.bus.$on('$close', fn); + } + }; + } + } catch (e) { + console.error(e); + } + }, + makeFooter: function makeFooter() { + var _this8 = this; + + var _this$$props = this.$props, + okBtnText = _this$$props.okBtnText, + closeBtnText = _this$$props.closeBtnText, + closeBtn = _this$$props.closeBtn, + okBtn = _this$$props.okBtn, + footer = _this$$props.footer; + + if (!footer) { + return; + } + + return vue.createVNode("div", null, [closeBtn ? vue.createVNode(vue.resolveComponent("ElButton"), { + "onClick": function onClick() { + return _this8.onCancel() !== false && (_this8.frameVisible = false); + } + }, _isSlot(closeBtnText) ? closeBtnText : { + "default": function _default() { + return [closeBtnText]; + } + }) : null, okBtn ? vue.createVNode(vue.resolveComponent("ElButton"), { + "type": "primary", + "onClick": function onClick() { + return _this8.onOk() !== false && _this8.closeModel(); + } + }, _isSlot(okBtnText) ? okBtnText : { + "default": function _default() { + return [okBtnText]; + } + }) : null]); + } + }, + render: function render() { + var _this9 = this; + + var type = this.type; + var node; + + if (type === 'input') { + node = this.makeInput(); + } else if (type === 'image') { + node = this.makeImages(); + } else { + node = this.makeFiles(); + } + + var _this$$props2 = this.$props, + _this$$props2$width = _this$$props2.width, + width = _this$$props2$width === void 0 ? '30%' : _this$$props2$width, + height = _this$$props2.height, + src = _this$$props2.src, + title = _this$$props2.title, + modalTitle = _this$$props2.modalTitle; + vue.nextTick(function () { + if (_this9.$refs.frame) { + _this9.frameLoad(_this9.$refs.frame.contentWindow || {}); + } + }); + return vue.createVNode("div", { + "class": { + '_fc-frame': true, + '_fc-disabled': this.disabled + } + }, [node, vue.createVNode(vue.resolveComponent("ElDialog"), { + "appendToBody": true, + "modal": this.previewMask, + "title": modalTitle, + "modelValue": this.previewVisible, + "onClose": this.handleCancel + }, { + "default": function _default() { + return [vue.createVNode("img", { + "style": "width: 100%", + "src": _this9.previewImage + }, null)]; + } + }), vue.createVNode(vue.resolveComponent("ElDialog"), vue.mergeProps({ + "appendToBody": true + }, _objectSpread2({ + width: width, + title: title + }, this.modal), { + "modelValue": this.frameVisible, + "onClose": function onClose() { + return _this9.closeModel(true); + } + }), { + "default": function _default() { + return [_this9.frameVisible || !_this9.reload ? vue.createVNode("iframe", { + "ref": "frame", + "src": src, + "frameBorder": "0", + "style": { + height: height, + 'border': '0 none', + 'width': '100%' + } + }, null) : null]; + }, + footer: function footer() { + return _this9.makeFooter(); + } + })]); + }, + beforeMount: function beforeMount() { + var _this$formCreateInjec = this.formCreateInject, + name = _this$formCreateInjec.name, + field = _this$formCreateInjec.field, + api = _this$formCreateInjec.api; + name && api.on('fc:closeModal:' + name, this.close); + field && api.on('fc:closeModal:' + field, this.close); + }, + beforeUnmount: function beforeUnmount() { + var _this$formCreateInjec2 = this.formCreateInject, + name = _this$formCreateInjec2.name, + field = _this$formCreateInjec2.field, + api = _this$formCreateInjec2.api; + name && api.off('fc:closeModal:' + name, this.close); + field && api.off('fc:closeModal:' + field, this.close); + } + }); + + exports["default"] = Frame; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); diff --git a/src/components/formCreate/component-elm-frame/dist/index.min.js b/src/components/formCreate/component-elm-frame/dist/index.min.js new file mode 100644 index 0000000..240ca0a --- /dev/null +++ b/src/components/formCreate/component-elm-frame/dist/index.min.js @@ -0,0 +1,7 @@ +/*! + * @form-create/component-elm-frame v3.2.0 + * (c) 2018-2024 xaboy + * Github https://github.com/xaboy/form-create with frame + * Released under the MIT License. + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FcFrame={},e.Vue)}(this,(function(e,t){"use strict";function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function o(e){for(var t=1;t-1?[]:[e]}function l(e){e=e||new Map;var t={$on:function(t,n){var o=e.get(t);o&&o.push(n)||e.set(t,[n])},$once:function(e,n){n._once=!0,t.$on(e,n)},$off:function(t,n){var o=e.get(t);o&&o.splice(o.indexOf(n)>>>0,1)},$emit:function(n){for(var o=arguments.length,i=new Array(o>1?o-1:0),r=1;r + + + + + + + diff --git a/src/components/formCreate/component-elm-frame/src/IconDelete.vue b/src/components/formCreate/component-elm-frame/src/IconDelete.vue new file mode 100644 index 0000000..64c8c2f --- /dev/null +++ b/src/components/formCreate/component-elm-frame/src/IconDelete.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/formCreate/component-elm-frame/src/IconDocument.vue b/src/components/formCreate/component-elm-frame/src/IconDocument.vue new file mode 100644 index 0000000..bf304c8 --- /dev/null +++ b/src/components/formCreate/component-elm-frame/src/IconDocument.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/formCreate/component-elm-frame/src/IconFolderOpened.vue b/src/components/formCreate/component-elm-frame/src/IconFolderOpened.vue new file mode 100644 index 0000000..eff806a --- /dev/null +++ b/src/components/formCreate/component-elm-frame/src/IconFolderOpened.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/formCreate/component-elm-frame/src/IconView.vue b/src/components/formCreate/component-elm-frame/src/IconView.vue new file mode 100644 index 0000000..0d0d8af --- /dev/null +++ b/src/components/formCreate/component-elm-frame/src/IconView.vue @@ -0,0 +1,12 @@ + + + diff --git a/src/components/formCreate/component-elm-frame/src/component.jsx b/src/components/formCreate/component-elm-frame/src/component.jsx new file mode 100644 index 0000000..3515719 --- /dev/null +++ b/src/components/formCreate/component-elm-frame/src/component.jsx @@ -0,0 +1,349 @@ +import toArray from '@form-create/utils/lib/toarray'; +import Mitt from '@form-create/utils/lib/mitt'; +import {defineComponent, nextTick, resolveComponent} from 'vue'; +import './style.css'; +import IconCircleClose from './IconCircleClose.vue'; +import IconDocument from './IconDocument.vue'; +import IconDelete from './IconDelete.vue'; +import IconView from './IconView.vue'; +import IconFolderOpened from './IconFolderOpened.vue'; + +const NAME = 'fcFrame'; + +export default defineComponent({ + name: NAME, + props: { + type: { + type: String, + default: 'input' + }, + field: String, + helper: { + type: Boolean, + default: true + }, + disabled: { + type: Boolean, + default: false + }, + src: { + type: String, + required: true + }, + icon: { + type: String, + default: 'IconFolderOpened' + }, + width: { + type: String, + default: '500px' + }, + height: { + type: String, + default: '370px' + }, + maxLength: { + type: Number, + default: 0 + }, + okBtnText: { + type: String, + default: '确定' + }, + closeBtnText: { + type: String, + default: '关闭' + }, + modalTitle: String, + handleIcon: { + type: [String, Boolean], + default: undefined, + }, + title: String, + allowRemove: { + type: Boolean, + default: true + }, + onOpen: { + type: Function, + default: () => { + } + }, + onOk: { + type: Function, + default: () => { + } + }, + onCancel: { + type: Function, + default: () => { + } + }, + onLoad: { + type: Function, + default: () => { + } + }, + onBeforeRemove: { + type: Function, + default: () => { + } + }, + onRemove: { + type: Function, + default: () => { + } + }, + onHandle: Function, + modal: { + type: Object, + default: () => ({}) + }, + srcKey: [String, Number], + modelValue: [Array, String, Number, Object], + previewMask: undefined, + footer: { + type: Boolean, + default: true + }, + reload: { + type: Boolean, + default: true + }, + closeBtn: { + type: Boolean, + default: true + }, + okBtn: { + type: Boolean, + default: true + }, + formCreateInject: Object, + }, + emits: ['update:modelValue', 'change'], + components: { + IconFolderOpened, + IconView, + }, + data() { + return { + fileList: toArray(this.modelValue), + previewVisible: false, + frameVisible: false, + previewImage: '', + bus: new Mitt() + } + }, + watch: { + modelValue(n) { + this.fileList = toArray(n); + } + }, + methods: { + close() { + this.closeModel(true); + }, + closeModel(close) { + this.bus.$emit(close ? '$close' : '$ok'); + if (this.reload) { + this.bus.$off('$ok'); + this.bus.$off('$close'); + } + this.frameVisible = false; + }, + handleCancel() { + this.previewVisible = false; + }, + + showModel() { + if (this.disabled || false === this.onOpen()) { + return; + } + this.frameVisible = true; + }, + input() { + const n = this.fileList; + const val = this.maxLength === 1 ? (n[0] || '') : n; + this.$emit('update:modelValue', val); + this.$emit('change', val); + }, + makeInput() { + return this.getSrc(v))).toString(), + readonly: true + }} key={1} v-slots={{ + append: () => this.showModel()}/>, + suffix: () => this.fileList.length && !this.disabled ? + { + this.fileList = []; + this.input(); + }}> + + : null + }}/> + }, + makeGroup(children) { + if (!this.maxLength || this.fileList.length < this.maxLength) { + children.push(this.makeBtn()); + } + return
{children}
+ }, + + makeItem(index, children) { + return
{children}
; + }, + valid(f) { + const field = this.formCreateInject.field || this.field; + if (field && f !== field) { + throw new Error('[frame]无效的字段值'); + } + }, + makeIcons(val, index) { + if (this.handleIcon !== false || this.allowRemove === true) { + const icons = []; + if ((this.type !== 'file' && this.handleIcon !== false) || (this.type === 'file' && this.handleIcon)) { + icons.push(this.makeHandleIcon(val, index)); + } + if (this.allowRemove) { + icons.push(this.makeRemoveIcon(val, index)); + } + return
{icons}
+ } + }, + makeHandleIcon(val, index) { + const Type = resolveComponent((this.handleIcon === true || this.handleIcon === undefined) ? 'icon-view' : this.handleIcon); + return this.handleClick(val)} key={'5' + index}> + }, + + makeRemoveIcon(val, index) { + return this.handleRemove(val)} key={'6' + index}> + + + }, + + makeFiles() { + return this.makeGroup(this.fileList.map((src, index) => { + return this.makeItem(index, [ this.handleClick(src)}> + + , this.makeIcons(src, index)]) + })) + }, + makeImages() { + return this.makeGroup(this.fileList.map((src, index) => { + return this.makeItem(index, [, this.makeIcons(src, index)]) + })) + }, + makeBtn() { + const Type = resolveComponent(this.icon); + return
this.showModel()} key={7}> + +
+ }, + handleClick(src) { + if (this.onHandle) { + return this.onHandle(src); + } else { + this.previewImage = this.getSrc(src); + this.previewVisible = true; + } + }, + handleRemove(src) { + if (this.disabled) { + return; + } + if (false !== this.onBeforeRemove(src)) { + this.fileList.splice(this.fileList.indexOf(src), 1); + this.input(); + this.onRemove(src); + } + }, + getSrc(src) { + return !this.srcKey ? src : src[this.srcKey]; + }, + frameLoad(iframe) { + this.onLoad(iframe); + try { + if (this.helper === true) { + iframe['form_create_helper'] = { + api: this.formCreateInject.api, + close: (field) => { + this.valid(field); + this.closeModel(); + }, + set: (field, value) => { + this.valid(field); + !this.disabled && this.$emit('update:modelValue', value); + }, + get: (field) => { + this.valid(field); + return this.modelValue; + }, + onOk: fn => this.bus.$on('$ok', fn), + onClose: fn => this.bus.$on('$close', fn) + }; + + } + } catch (e) { + console.error(e); + } + }, + makeFooter() { + const {okBtnText, closeBtnText, closeBtn, okBtn, footer} = this.$props; + + if (!footer) { + return; + } + return
+ {closeBtn ? (this.onCancel() !== false && (this.frameVisible = false))}>{closeBtnText} : null} + {okBtn ? (this.onOk() !== false && this.closeModel())}>{okBtnText} : null} +
+ } + }, + render() { + const type = this.type; + + let node; + if (type === 'input') { + node = this.makeInput(); + } else if (type === 'image') { + node = this.makeImages(); + } else { + node = this.makeFiles(); + } + + const {width = '30%', height, src, title, modalTitle} = this.$props; + nextTick(() => { + if (this.$refs.frame) { + this.frameLoad(this.$refs.frame.contentWindow || {}); + } + }); + return
{node} + + + + (this.closeModel(true))} v-slots={{ + footer: () => this.makeFooter() + }}> + {(this.frameVisible || !this.reload) ?