@kp-ui/lowcode 1.0.32 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/_virtual/virtual_svg-icons-register.js +2 -2
  2. package/package.json +27 -26
  3. package/render.js +44 -18
  4. package/src/api/useFilesystemApi/filesystem/index.js +1 -1
  5. package/src/components/CustomRender/components/AttachmentRender.vue.js +1 -1
  6. package/src/components/CustomRender/components/AttachmentRender.vue2.js +38 -55
  7. package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue.js +103 -234
  8. package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue2.js +236 -0
  9. package/src/components/form-designer/form-widget/container-widget/{grid-widget.vue2.js → grid-widget.vue.js} +1 -1
  10. package/src/components/form-designer/form-widget/container-widget/index.js +4 -4
  11. package/src/components/form-designer/form-widget/container-widget/{table-widget.vue2.js → table-widget.vue.js} +1 -1
  12. package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue.js +156 -126
  13. package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue2.js +128 -0
  14. package/src/components/form-designer/form-widget/field-widget/fieldMixin.js +8 -1
  15. package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue.js +1 -1
  16. package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue2.js +19 -29
  17. package/src/components/form-designer/form-widget/index.vue.js +4 -4
  18. package/src/components/form-designer/toolbar-panel/index.vue.js +3 -2
  19. package/src/components/form-designer/widget-panel/advanced/attachment-render.js +1 -1
  20. package/src/components/form-designer/widget-panel/advanced/bpmn-editor.js +1 -1
  21. package/src/components/form-designer/widget-panel/advanced/cascader.js +1 -1
  22. package/src/components/form-designer/widget-panel/advanced/code-editor.js +1 -1
  23. package/src/components/form-designer/widget-panel/advanced/diy-compontent.js +1 -1
  24. package/src/components/form-designer/widget-panel/advanced/slot.js +1 -1
  25. package/src/components/form-designer/widget-panel/advanced/tree-select.js +1 -1
  26. package/src/components/form-designer/widget-panel/basicFields/button.js +1 -1
  27. package/src/components/form-designer/widget-panel/basicFields/checkbox.js +1 -1
  28. package/src/components/form-designer/widget-panel/basicFields/color.js +1 -1
  29. package/src/components/form-designer/widget-panel/basicFields/date.js +1 -1
  30. package/src/components/form-designer/widget-panel/basicFields/dateRange.js +1 -1
  31. package/src/components/form-designer/widget-panel/basicFields/divider.js +1 -1
  32. package/src/components/form-designer/widget-panel/basicFields/dropdown.js +1 -1
  33. package/src/components/form-designer/widget-panel/basicFields/htmlText.js +1 -1
  34. package/src/components/form-designer/widget-panel/basicFields/input.js +1 -1
  35. package/src/components/form-designer/widget-panel/basicFields/number.js +1 -1
  36. package/src/components/form-designer/widget-panel/basicFields/radio.js +1 -1
  37. package/src/components/form-designer/widget-panel/basicFields/rate.js +1 -1
  38. package/src/components/form-designer/widget-panel/basicFields/select.js +1 -1
  39. package/src/components/form-designer/widget-panel/basicFields/slider.js +1 -1
  40. package/src/components/form-designer/widget-panel/basicFields/staticText.js +1 -1
  41. package/src/components/form-designer/widget-panel/basicFields/switch.js +1 -1
  42. package/src/components/form-designer/widget-panel/basicFields/textarea.js +1 -1
  43. package/src/components/form-designer/widget-panel/basicFields/time.js +1 -1
  44. package/src/components/form-designer/widget-panel/basicFields/timeRange.js +1 -1
  45. package/src/components/form-designer/widget-panel/business/department-select.js +1 -1
  46. package/src/components/form-designer/widget-panel/business/material-select.js +1 -1
  47. package/src/components/form-designer/widget-panel/business/operation-select.js +1 -1
  48. package/src/components/form-designer/widget-panel/business/post-select.js +1 -1
  49. package/src/components/form-designer/widget-panel/business/project-group-select.js +1 -1
  50. package/src/components/form-designer/widget-panel/business/project-select.js +1 -1
  51. package/src/components/form-designer/widget-panel/business/user-select.js +1 -1
  52. package/src/components/form-designer/widget-panel/containers/data-table.js +1 -1
  53. package/src/components/form-designer/widget-panel/containers/grid-col.js +1 -1
  54. package/src/components/form-designer/widget-panel/containers/grid-sub-form.js +1 -1
  55. package/src/components/form-designer/widget-panel/containers/grid.js +1 -1
  56. package/src/components/form-designer/widget-panel/containers/tab-pane.js +1 -1
  57. package/src/components/form-designer/widget-panel/containers/tab.js +1 -1
  58. package/src/components/form-designer/widget-panel/containers/vf-box.js +1 -1
  59. package/src/components/form-designer/widget-panel/containers/vf-collapse.js +1 -1
  60. package/src/components/form-designer/widget-panel/containers/vf-dialog.js +1 -1
  61. package/src/components/http-editor/index.vue.js +1 -1
  62. package/src/components/http-editor/index.vue2.js +1 -2
  63. package/src/hooks/useFilePreview.js +16 -6
  64. package/src/utils/request/fmtHttpParams.js +21 -7
  65. package/src/utils/sfc-generator.js +1 -0
  66. package/src/utils/util.js +1 -21
  67. package/styles/style.css +1 -1
  68. package/types/src/components/CustomRender/components/AttachmentRender.d.ts.map +1 -1
  69. package/types/src/components/form-render/index.d.ts.map +1 -1
  70. package/types/src/hooks/useFilePreview.d.ts +4 -0
  71. package/types/src/hooks/useFilePreview.d.ts.map +1 -1
  72. package/types/src/utils/request/http.d.ts +2 -3
  73. package/types/src/utils/request/http.d.ts.map +1 -1
  74. package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue3.js +0 -105
  75. package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue4.js +0 -158
  76. package/src/utils/request/handleAxiosError.js +0 -31
  77. package/src/utils/request/http.js +0 -88
  78. package/src/utils/request/useGetUseInfo.js +0 -9
  79. package/types/src/utils/request/useGetUseInfo.d.ts +0 -23
  80. package/types/src/utils/request/useGetUseInfo.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const treeSelect = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const button = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const checkbox = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const color = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const date = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const dateRange = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const divider = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const dropdown = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const htmlText = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const input = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const number = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const radio = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const rate = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const select = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const slider = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const staticText = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const switchCom = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const textarea = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const time = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const timeRange = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const departmentSelect = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const materialSelect = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const operationSelect = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const postSelect = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const projectGroupSelect = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const projectSelect = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const userSelect = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const dataTable = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const gridCol = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const gridSubForm = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const grid = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const tabPane = () => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const tab = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const vfBox = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const vfCollapse = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -1,4 +1,4 @@
1
- import { getUuidKey } from "../../../../utils/util.js";
1
+ import { getUuidKey } from "@kp-ui/tool";
2
2
  const vfDialog = (ops = {}) => {
3
3
  return {
4
4
  key: getUuidKey(),
@@ -448,7 +448,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
448
448
  }, null, 8, ["modelValue", "event-header"])
449
449
  ], 64);
450
450
  }
451
- const HttpEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-64609521"]]);
451
+ const HttpEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-f0ab404c"]]);
452
452
  export {
453
453
  HttpEditor as default
454
454
  };
@@ -1,9 +1,8 @@
1
1
  import i18n from "../../utils/i18n.js";
2
2
  import CodeEditor from "../code-editor/index.vue.js";
3
3
  import { isArray } from "lodash-es";
4
- import { getHttp } from "../../utils/request/http.js";
4
+ import { getHttp, getLocat, replaceVars } from "@kp-ui/tool";
5
5
  import CodeModalEditor from "../code-editor/code-modal-editor.vue.js";
6
- import { getLocat, replaceVars } from "../../utils/util.js";
7
6
  const _sfc_main = {
8
7
  name: "http-editor",
9
8
  inheritAttrs: false,
@@ -1,12 +1,15 @@
1
1
  import { useFilesystemApi } from "../api/useFilesystemApi/filesystem/index.js";
2
2
  import { ref } from "vue";
3
- import { getUserInfo } from "../utils/request/useGetUseInfo.js";
3
+ import { getUserInfo } from "@kp-ui/tool";
4
4
  import queryString from "query-string";
5
5
  const getDoMain = () => {
6
6
  return window.location.origin;
7
7
  };
8
8
  function useFilePreview() {
9
9
  const fileUrlCache = ref(/* @__PURE__ */ new Map());
10
+ const previewVisible = ref(false);
11
+ const previewTitle = ref("");
12
+ const previewImage = ref("");
10
13
  const filesystemApi = useFilesystemApi();
11
14
  const getPreviewFileUrl = async (fileCode) => {
12
15
  if (fileUrlCache.value.has(fileCode)) {
@@ -26,11 +29,8 @@ function useFilePreview() {
26
29
  return Promise.all(res);
27
30
  };
28
31
  const handlePreview = async (file) => {
29
- var _a, _b;
30
32
  if (![".png", ".jpg", ".jpeg", ".gif"].includes(file.fileType || "")) {
31
- const localUserInfo = getUserInfo();
32
- const employeeId = (_a = localUserInfo == null ? void 0 : localUserInfo.loginInfo) == null ? void 0 : _a.employeeId;
33
- const { tokenId, tenantId } = (_b = localUserInfo == null ? void 0 : localUserInfo.loginInfo) == null ? void 0 : _b.userToken;
33
+ const { tokenId, tenantId, employeeId } = getUserInfo();
34
34
  const doMain = getDoMain();
35
35
  const obj = {
36
36
  tenantId,
@@ -38,8 +38,11 @@ function useFilePreview() {
38
38
  employeeId,
39
39
  fileCode: file.fileCode
40
40
  };
41
- console.log({ doMain });
42
41
  window.open(`${doMain}/view-file/preview?${queryString.stringify(obj)}`);
42
+ } else {
43
+ previewTitle.value = file.fileName;
44
+ previewImage.value = await getPreviewFileUrl(file.fileCode);
45
+ previewVisible.value = true;
43
46
  }
44
47
  };
45
48
  const handleDownload = async (file) => {
@@ -49,8 +52,15 @@ function useFilePreview() {
49
52
  console.error("下载文件失败:", error);
50
53
  }
51
54
  };
55
+ const handleCancel = () => {
56
+ previewVisible.value = false;
57
+ };
52
58
  return {
59
+ previewVisible,
60
+ previewTitle,
53
61
  fileUrlCache,
62
+ previewImage,
63
+ handleCancel,
54
64
  handleDownload,
55
65
  handlePreview,
56
66
  getPreviewData,
@@ -1,5 +1,16 @@
1
- import { getLocat, replaceVars } from "../util.js";
2
- import { getHttp } from "./http.js";
1
+ import { getHttp, getLocat } from "@kp-ui/tool";
2
+ const replaceVars = (sendParams, paramsMap) => {
3
+ Object.entries(sendParams).forEach(([key, value]) => {
4
+ if (key) {
5
+ Object.keys(value).forEach((field) => {
6
+ if (paramsMap[field] !== void 0) {
7
+ sendParams[key][field] = paramsMap[field];
8
+ }
9
+ });
10
+ }
11
+ });
12
+ return sendParams;
13
+ };
3
14
  async function fmtHttpParams(req, params = {}) {
4
15
  const request = getHttp();
5
16
  const { data, vfCtx, ...args } = params;
@@ -7,13 +18,16 @@ async function fmtHttpParams(req, params = {}) {
7
18
  if (!http.url) return;
8
19
  const paramsMap = { ...getLocat(), ...data, ...vfCtx, ...args };
9
20
  const method = http.method || "get";
10
- const sendParams = JSON.stringify({
11
- ...http,
12
- method,
21
+ let sendParams = {
13
22
  params: http.method === "get" ? { ...http.params, ...data } : { ...http.params },
14
23
  data: http.method === "post" ? { ...http.data, ...data } : { ...http.data }
15
- });
16
- let p = JSON.parse(replaceVars(sendParams, paramsMap));
24
+ };
25
+ sendParams = replaceVars(sendParams, paramsMap);
26
+ let p = {
27
+ ...http,
28
+ method,
29
+ ...sendParams
30
+ };
17
31
  if (dataReqHandlerCode) {
18
32
  const dataReqHandlerCodeFn = new Function("data", dataReqHandlerCode);
19
33
  p = dataReqHandlerCodeFn.call(this, p);
@@ -1,4 +1,5 @@
1
1
  import "clipboard";
2
+ import "@kp-ui/tool";
2
3
  import "lodash-es";
3
4
  import "../components/form-designer/widget-panel/widgetsConfig.js";
4
5
  import "./i18n.js";
package/src/utils/util.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import Clipboard from "clipboard";
2
+ import { getLocat } from "@kp-ui/tool";
2
3
  import { cloneDeep } from "lodash-es";
3
4
  import "../components/form-designer/widget-panel/widgetsConfig.js";
4
5
  function isNull(value) {
@@ -451,24 +452,6 @@ function getDSByName(formConfig, dsName) {
451
452
  }
452
453
  return resultDS;
453
454
  }
454
- function replaceVars(str, vars) {
455
- return str.replace(/\$\{([^}]+)\}/g, (match, varName) => vars[varName] || null);
456
- }
457
- function getLocat(url) {
458
- url = url || window.location.search;
459
- const theRequest = {};
460
- if (url.indexOf("?") !== -1) {
461
- const str = url.substr(1);
462
- const strs = str.split("&");
463
- for (let i = 0; i < strs.length; i++) {
464
- theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
465
- }
466
- }
467
- return theRequest;
468
- }
469
- const getUuidKey = () => {
470
- return "k" + Math.random().toString(36).slice(2, 8);
471
- };
472
455
  export {
473
456
  addWindowResizeHandler,
474
457
  assembleAxiosConfig,
@@ -483,15 +466,12 @@ export {
483
466
  getDSByName,
484
467
  getDefaultFormConfig,
485
468
  getFieldWidgetByName,
486
- getLocat,
487
469
  getQueryParam,
488
- getUuidKey,
489
470
  insertCustomCssToHead,
490
471
  insertGlobalFunctionsToHtml,
491
472
  isEmptyStr,
492
473
  isNull,
493
474
  overwriteObj,
494
- replaceVars,
495
475
  runDataSourceRequest,
496
476
  translateOptionItems,
497
477
  traverseAllWidgets,