@kp-ui/lowcode-pc-v2 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_virtual/_plugin-vue_export-helper.js +8 -0
- package/assets/styles/style.css +471 -0
- package/core/src/components/common/render/Debugger.js +7 -0
- package/core/src/components/common/render/Debugger.vue_vue_type_script_setup_true_lang.js +43 -0
- package/core/src/components/common/render/LowcodeRenderProvider.js +5 -0
- package/core/src/components/common/render/LowcodeRenderProvider.vue_vue_type_script_setup_true_lang.js +49 -0
- package/core/src/components/common/render/RenderWidgetList.js +5 -0
- package/core/src/components/common/render/RenderWidgetList.vue_vue_type_script_setup_true_lang.js +52 -0
- package/core/src/components/common/render/usePageContext.js +238 -0
- package/core/src/components/property-editor/propertyRegister.js +29 -0
- package/core/src/constants/EditorTypeEnum.js +9 -0
- package/core/src/constants/WidgetTypeEnum.js +15 -0
- package/core/src/constants/index.js +10 -0
- package/core/src/hooks/useAppRef.js +46 -0
- package/core/src/hooks/useFactoryRender.js +60 -0
- package/core/src/hooks/useField.js +430 -0
- package/core/src/hooks/useFieldRules.js +66 -0
- package/core/src/hooks/useLowcode.js +144 -0
- package/core/src/hooks/usePagination.js +23 -0
- package/core/src/hooks/useRemoteData.js +113 -0
- package/core/src/hooks/useSelect.js +137 -0
- package/core/src/hooks/useWebMCP.js +50 -0
- package/core/src/lang/en-US.js +658 -0
- package/core/src/lang/en-US_extension.js +23 -0
- package/core/src/lang/en-US_render.js +36 -0
- package/core/src/lang/zh-CN.js +717 -0
- package/core/src/lang/zh-CN_extension.js +18 -0
- package/core/src/lang/zh-CN_render.js +36 -0
- package/core/src/store/useTableColumnStore.js +37 -0
- package/core/src/utils/format.js +40 -0
- package/core/src/utils/getWidgetCompontent.js +27 -0
- package/core/src/utils/i18n.js +38 -0
- package/core/src/utils/smart-vue-i18n/index.js +79 -0
- package/core/src/utils/transformPx.js +9 -0
- package/core/src/utils/useEmitter.js +24 -0
- package/core/src/utils/util.js +61 -0
- package/install.js +16 -0
- package/package.json +39 -0
- package/src/components/public/ActionButtonListRender.js +51 -0
- package/src/components/public/ActionButtonListRender.vue_vue_type_script_lang.js +126 -0
- package/src/components/public/ConfigView/CustomPageRender.js +5 -0
- package/src/components/public/ConfigView/CustomPageRender.vue_vue_type_script_setup_true_lang.js +38 -0
- package/src/components/public/CustomerModal/CustomerModal.js +5 -0
- package/src/components/public/CustomerModal/CustomerModal.vue_vue_type_script_setup_true_lang.js +138 -0
- package/src/components/public/CustomerModal/useCustomerModal.js +23 -0
- package/src/components/public/DataTableColumnDialog.js +7 -0
- package/src/components/public/DataTableColumnDialog.vue_vue_type_script_setup_true_name_DataTableColumnDialog_lang.js +330 -0
- package/src/hooks/useTableWidget.js +317 -0
- package/src/render/index.js +7 -0
- package/src/render/index.vue_vue_type_script_setup_true_lang.js +69 -0
- package/src/schemas/defaults/field.js +72 -0
- package/src/widgets/advanced/code-editor/index.js +7 -0
- package/src/widgets/advanced/code-editor/index.vue_vue_type_script_setup_true_lang.js +45 -0
- package/src/widgets/advanced/code-editor/schema.js +26 -0
- package/src/widgets/advanced/custom-render/index.js +5 -0
- package/src/widgets/advanced/custom-render/index.vue_vue_type_script_setup_true_lang.js +54 -0
- package/src/widgets/advanced/custom-render/schema.js +19 -0
- package/src/widgets/advanced/data-table/index.js +7 -0
- package/src/widgets/advanced/data-table/index.vue_vue_type_script_setup_true_lang.js +132 -0
- package/src/widgets/advanced/data-table/schema.js +108 -0
- package/src/widgets/advanced/file-upload/index.js +7 -0
- package/src/widgets/advanced/file-upload/index.vue_vue_type_script_setup_true_lang.js +166 -0
- package/src/widgets/advanced/file-upload/schema.js +35 -0
- package/src/widgets/advanced/rich-editor/index.js +7 -0
- package/src/widgets/advanced/rich-editor/index.vue_vue_type_script_setup_true_lang.js +56 -0
- package/src/widgets/advanced/rich-editor/schema.js +28 -0
- package/src/widgets/advanced/tree/index.js +7 -0
- package/src/widgets/advanced/tree/index.vue_vue_type_script_setup_true_lang.js +74 -0
- package/src/widgets/advanced/tree/schema.js +28 -0
- package/src/widgets/advanced/tree-select/index.js +5 -0
- package/src/widgets/advanced/tree-select/index.vue_vue_type_script_setup_true_lang.js +100 -0
- package/src/widgets/advanced/tree-select/schema.js +34 -0
- package/src/widgets/base/button/index.js +5 -0
- package/src/widgets/base/button/index.vue_vue_type_script_setup_true_lang.js +42 -0
- package/src/widgets/base/button/schema.js +33 -0
- package/src/widgets/base/button-list/index.js +7 -0
- package/src/widgets/base/button-list/index.vue_vue_type_script_setup_true_lang.js +41 -0
- package/src/widgets/base/button-list/schema.js +29 -0
- package/src/widgets/base/cascader/index.js +5 -0
- package/src/widgets/base/cascader/index.vue_vue_type_script_setup_true_lang.js +65 -0
- package/src/widgets/base/cascader/schema.js +31 -0
- package/src/widgets/base/checkbox/index.js +5 -0
- package/src/widgets/base/checkbox/index.vue_vue_type_script_setup_true_lang.js +61 -0
- package/src/widgets/base/checkbox/schema.js +25 -0
- package/src/widgets/base/color/index.js +7 -0
- package/src/widgets/base/color/index.vue_vue_type_script_setup_true_lang.js +50 -0
- package/src/widgets/base/color/schema.js +22 -0
- package/src/widgets/base/date/index.js +5 -0
- package/src/widgets/base/date/index.vue_vue_type_script_setup_true_lang.js +43 -0
- package/src/widgets/base/date/schema.js +32 -0
- package/src/widgets/base/date-range/index.js +5 -0
- package/src/widgets/base/date-range/index.vue_vue_type_script_setup_true_lang.js +44 -0
- package/src/widgets/base/date-range/schema.js +32 -0
- package/src/widgets/base/divider/index.js +5 -0
- package/src/widgets/base/divider/index.vue_vue_type_script_setup_true_lang.js +40 -0
- package/src/widgets/base/divider/schema.js +26 -0
- package/src/widgets/base/html/index.js +7 -0
- package/src/widgets/base/html/index.vue_vue_type_script_setup_true_lang.js +33 -0
- package/src/widgets/base/html/schema.js +25 -0
- package/src/widgets/base/input/index.js +5 -0
- package/src/widgets/base/input/index.vue_vue_type_script_setup_true_lang.js +78 -0
- package/src/widgets/base/input/schema.js +37 -0
- package/src/widgets/base/number/index.js +5 -0
- package/src/widgets/base/number/index.vue_vue_type_script_setup_true_lang.js +52 -0
- package/src/widgets/base/number/schema.js +31 -0
- package/src/widgets/base/radio/index.js +5 -0
- package/src/widgets/base/radio/index.vue_vue_type_script_setup_true_lang.js +61 -0
- package/src/widgets/base/radio/schema.js +26 -0
- package/src/widgets/base/rate/index.js +5 -0
- package/src/widgets/base/rate/index.vue_vue_type_script_setup_true_lang.js +52 -0
- package/src/widgets/base/rate/schema.js +24 -0
- package/src/widgets/base/select/index.js +7 -0
- package/src/widgets/base/select/index.vue_vue_type_script_setup_true_lang.js +94 -0
- package/src/widgets/base/select/schema.js +34 -0
- package/src/widgets/base/slider/index.js +5 -0
- package/src/widgets/base/slider/index.vue_vue_type_script_setup_true_lang.js +37 -0
- package/src/widgets/base/slider/schema.js +26 -0
- package/src/widgets/base/static-text/index.js +7 -0
- package/src/widgets/base/static-text/index.vue_vue_type_script_setup_true_lang.js +24 -0
- package/src/widgets/base/static-text/schema.js +28 -0
- package/src/widgets/base/switch/index.js +5 -0
- package/src/widgets/base/switch/index.vue_vue_type_script_setup_true_lang.js +40 -0
- package/src/widgets/base/switch/schema.js +25 -0
- package/src/widgets/base/textarea/index.js +7 -0
- package/src/widgets/base/textarea/index.vue_vue_type_script_setup_true_lang.js +50 -0
- package/src/widgets/base/textarea/schema.js +30 -0
- package/src/widgets/base/time/index.js +7 -0
- package/src/widgets/base/time/index.vue_vue_type_script_setup_true_lang.js +47 -0
- package/src/widgets/base/time/schema.js +33 -0
- package/src/widgets/base/time-range/index.js +7 -0
- package/src/widgets/base/time-range/index.vue_vue_type_script_setup_true_lang.js +48 -0
- package/src/widgets/base/time-range/schema.js +31 -0
- package/src/widgets/containers/box/index-render.js +7 -0
- package/src/widgets/containers/box/index-render.vue_vue_type_script_setup_true_lang.js +39 -0
- package/src/widgets/containers/box/schema.js +29 -0
- package/src/widgets/containers/collapse/index-render.js +8 -0
- package/src/widgets/containers/collapse/index-render.vue_vue_type_script_setup_true_lang.js +49 -0
- package/src/widgets/containers/collapse/schema.js +25 -0
- package/src/widgets/containers/dialog/index-render.js +5 -0
- package/src/widgets/containers/dialog/index-render.vue_vue_type_script_setup_true_lang.js +107 -0
- package/src/widgets/containers/dialog/schema.js +38 -0
- package/src/widgets/containers/form/index-render.js +7 -0
- package/src/widgets/containers/form/index-render.vue_vue_type_script_setup_true_lang.js +46 -0
- package/src/widgets/containers/form/schema.js +33 -0
- package/src/widgets/containers/grid/index-render.js +7 -0
- package/src/widgets/containers/grid/index-render.vue_vue_type_script_setup_true_lang.js +56 -0
- package/src/widgets/containers/grid/schema.js +22 -0
- package/src/widgets/containers/grid-col/index-render.js +7 -0
- package/src/widgets/containers/grid-col/index-render.vue_vue_type_script_setup_true_lang.js +46 -0
- package/src/widgets/containers/grid-col/schema.js +27 -0
- package/src/widgets/containers/list/index-render.js +7 -0
- package/src/widgets/containers/list/index-render.vue_vue_type_script_setup_true_lang.js +189 -0
- package/src/widgets/containers/list/schema.js +46 -0
- package/src/widgets/containers/space/index-render.js +7 -0
- package/src/widgets/containers/space/index-render.vue_vue_type_script_setup_true_lang.js +57 -0
- package/src/widgets/containers/space/schema.js +25 -0
- package/src/widgets/containers/tab/index-render.js +5 -0
- package/src/widgets/containers/tab/index-render.vue_vue_type_script_setup_true_lang.js +81 -0
- package/src/widgets/containers/tab/schema.js +32 -0
- package/src/widgets/containers/tab-pane/index-render.js +5 -0
- package/src/widgets/containers/tab-pane/index-render.vue_vue_type_script_setup_true_lang.js +37 -0
- package/src/widgets/containers/tab-pane/schema.js +31 -0
- package/src/widgets/render.js +165 -0
- package/src/widgets/template/SecondaryPage/index-render.js +7 -0
- package/src/widgets/template/SecondaryPage/index-render.vue_vue_type_script_setup_true_lang.js +63 -0
- package/src/widgets/template/SecondaryPage/schema.js +68 -0
- package/src/widgets/widgetTypes.js +52 -0
- package/src/widgets/wrapper/form-item-wrapper.js +7 -0
- package/src/widgets/wrapper/form-item-wrapper.vue_vue_type_script_setup_true_lang.js +90 -0
- package/stats.html +4949 -0
- package/types/pc/install.d.ts +11 -0
package/src/components/public/CustomerModal/CustomerModal.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { useI18n } from "../../../../core/src/utils/i18n.js";
|
|
2
|
+
import { useLowcode } from "../../../../core/src/hooks/useLowcode.js";
|
|
3
|
+
import ActionButtonListRender_default from "../ActionButtonListRender.js";
|
|
4
|
+
import render_default from "../../../render/index.js";
|
|
5
|
+
import { computed, createBlock, createVNode, defineComponent, mergeProps, nextTick, onMounted, openBlock, ref, unref, useAttrs, withCtx } from "vue";
|
|
6
|
+
import _objectSpread from "@oxc-project/runtime/helpers/objectSpread2";
|
|
7
|
+
import { Skeleton } from "ant-design-vue";
|
|
8
|
+
import { TpfConfigProvider, TpfModal } from "tmgc2-share";
|
|
9
|
+
import _asyncToGenerator from "@oxc-project/runtime/helpers/asyncToGenerator";
|
|
10
|
+
//#region src/components/public/CustomerModal/CustomerModal.vue?vue&type=script&setup=true&lang.tsx
|
|
11
|
+
var CustomerModal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "CustomerModal",
|
|
13
|
+
props: {
|
|
14
|
+
title: {},
|
|
15
|
+
type: {},
|
|
16
|
+
formCode: {},
|
|
17
|
+
width: { default: "800px" },
|
|
18
|
+
height: { default: "500px" },
|
|
19
|
+
mask: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
emits: ["cancel"],
|
|
25
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
26
|
+
const { i18nt } = useI18n();
|
|
27
|
+
const attrs = useAttrs() || {};
|
|
28
|
+
const visible = ref(false);
|
|
29
|
+
const props = __props;
|
|
30
|
+
const emit = __emit;
|
|
31
|
+
const vfCtx = computed(() => {
|
|
32
|
+
var _attrs$row;
|
|
33
|
+
return _objectSpread({
|
|
34
|
+
_id: (attrs === null || attrs === void 0 || (_attrs$row = attrs.row) === null || _attrs$row === void 0 || (_attrs$row = _attrs$row.record) === null || _attrs$row === void 0 ? void 0 : _attrs$row._id) || null,
|
|
35
|
+
type: props.type
|
|
36
|
+
}, attrs);
|
|
37
|
+
});
|
|
38
|
+
const isDisabled = ref(false);
|
|
39
|
+
const { vfdRef, formConfig, getPageJson, isLoading } = useLowcode();
|
|
40
|
+
const leftNum = ref(null);
|
|
41
|
+
const modalTitle = computed(() => {
|
|
42
|
+
if (props.title) return props.title;
|
|
43
|
+
if (props.type === "add") return "新增";
|
|
44
|
+
if (props.type === "edit") return "编辑";
|
|
45
|
+
if (props.type === "view") return "查看";
|
|
46
|
+
return "新增";
|
|
47
|
+
});
|
|
48
|
+
const show = function() {
|
|
49
|
+
var _ref = _asyncToGenerator(function* () {
|
|
50
|
+
visible.value = true;
|
|
51
|
+
yield nextTick();
|
|
52
|
+
yield getPageJson(props.formCode);
|
|
53
|
+
});
|
|
54
|
+
return function show() {
|
|
55
|
+
return _ref.apply(this, arguments);
|
|
56
|
+
};
|
|
57
|
+
}();
|
|
58
|
+
const setleftText = (number) => {
|
|
59
|
+
leftNum.value = number;
|
|
60
|
+
};
|
|
61
|
+
const setDisabled = (status) => {
|
|
62
|
+
isDisabled.value = status;
|
|
63
|
+
};
|
|
64
|
+
onMounted(() => {
|
|
65
|
+
show();
|
|
66
|
+
});
|
|
67
|
+
const handleCloseDialog = () => {
|
|
68
|
+
visible.value = false;
|
|
69
|
+
emit("cancel");
|
|
70
|
+
};
|
|
71
|
+
const handleButtonClick = function() {
|
|
72
|
+
var _ref2 = _asyncToGenerator(function* ({ item, result }) {
|
|
73
|
+
if (item.name === "cancelButton") return handleCloseDialog();
|
|
74
|
+
if (result !== false) handleCloseDialog();
|
|
75
|
+
});
|
|
76
|
+
return function handleButtonClick(_x) {
|
|
77
|
+
return _ref2.apply(this, arguments);
|
|
78
|
+
};
|
|
79
|
+
}();
|
|
80
|
+
__expose({
|
|
81
|
+
handleCloseDialog,
|
|
82
|
+
i18nt,
|
|
83
|
+
setDisabled,
|
|
84
|
+
setleftText
|
|
85
|
+
});
|
|
86
|
+
return (_ctx, _cache) => {
|
|
87
|
+
return openBlock(), createBlock(unref(TpfConfigProvider), null, {
|
|
88
|
+
default: withCtx(() => [createVNode(unref(TpfModal), mergeProps({
|
|
89
|
+
visible: visible.value,
|
|
90
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => visible.value = $event)
|
|
91
|
+
}, _ctx.$attrs, {
|
|
92
|
+
title: modalTitle.value,
|
|
93
|
+
"left-num": leftNum.value,
|
|
94
|
+
width: _ctx.width,
|
|
95
|
+
height: _ctx.height,
|
|
96
|
+
mask: _ctx.mask,
|
|
97
|
+
onCancel: handleCloseDialog
|
|
98
|
+
}), {
|
|
99
|
+
footerRight: withCtx(() => {
|
|
100
|
+
var _unref2, _unref3;
|
|
101
|
+
return [createVNode(ActionButtonListRender_default, {
|
|
102
|
+
buttonList: ((_unref2 = unref(formConfig)) === null || _unref2 === void 0 ? void 0 : _unref2.buttonList) || [],
|
|
103
|
+
ctx: (_unref3 = unref(vfdRef)) === null || _unref3 === void 0 ? void 0 : _unref3.context,
|
|
104
|
+
onOnClick: handleButtonClick,
|
|
105
|
+
disabled: isDisabled.value
|
|
106
|
+
}, null, 8, [
|
|
107
|
+
"buttonList",
|
|
108
|
+
"ctx",
|
|
109
|
+
"disabled"
|
|
110
|
+
])];
|
|
111
|
+
}),
|
|
112
|
+
default: withCtx(() => [createVNode(unref(Skeleton), {
|
|
113
|
+
active: "",
|
|
114
|
+
loading: unref(isLoading)
|
|
115
|
+
}, {
|
|
116
|
+
default: withCtx(() => [createVNode(render_default, {
|
|
117
|
+
vfCtx: vfCtx.value,
|
|
118
|
+
ref_key: "vfdRef",
|
|
119
|
+
ref: vfdRef
|
|
120
|
+
}, null, 8, ["vfCtx"])]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["loading"])]),
|
|
123
|
+
_: 1
|
|
124
|
+
}, 16, [
|
|
125
|
+
"visible",
|
|
126
|
+
"title",
|
|
127
|
+
"left-num",
|
|
128
|
+
"width",
|
|
129
|
+
"height",
|
|
130
|
+
"mask"
|
|
131
|
+
])]),
|
|
132
|
+
_: 1
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
//#endregion
|
|
138
|
+
export { CustomerModal_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createVNode, defineAsyncComponent, render } from "vue";
|
|
2
|
+
import _objectSpread from "@oxc-project/runtime/helpers/objectSpread2";
|
|
3
|
+
import _objectWithoutProperties from "@oxc-project/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
//#region src/components/public/CustomerModal/useCustomerModal.tsx
|
|
5
|
+
var _excluded = ["type", "formCode"];
|
|
6
|
+
var openCustomerModal = (ops, app) => {
|
|
7
|
+
const { type, formCode } = ops, args = _objectWithoutProperties(ops, _excluded);
|
|
8
|
+
const div = document.createElement("div");
|
|
9
|
+
document.body.appendChild(div);
|
|
10
|
+
const Com = defineAsyncComponent(() => import("./CustomerModal.js"));
|
|
11
|
+
const hide = () => {
|
|
12
|
+
render(null, div);
|
|
13
|
+
div.remove();
|
|
14
|
+
};
|
|
15
|
+
const vnode = createVNode(Com, _objectSpread(_objectSpread({
|
|
16
|
+
type,
|
|
17
|
+
formCode
|
|
18
|
+
}, args), {}, { onCancel: hide }));
|
|
19
|
+
vnode.appContext = app._context;
|
|
20
|
+
render(vnode, div);
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { openCustomerModal };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import DataTableColumnDialog_vue_vue_type_script_setup_true_name_DataTableColumnDialog_lang_default from "./DataTableColumnDialog.vue_vue_type_script_setup_true_name_DataTableColumnDialog_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/public/DataTableColumnDialog.vue
|
|
5
|
+
var DataTableColumnDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(DataTableColumnDialog_vue_vue_type_script_setup_true_name_DataTableColumnDialog_lang_default, [["__scopeId", "data-v-30a82eb1"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { DataTableColumnDialog_default as default };
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { useTableColumnStore } from "../../../core/src/store/useTableColumnStore.js";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, normalizeClass, normalizeStyle, openBlock, ref, renderList, resolveComponent, toDisplayString, unref, useModel, watch, withCtx } from "vue";
|
|
3
|
+
import _objectSpread from "@oxc-project/runtime/helpers/objectSpread2";
|
|
4
|
+
import { message } from "ant-design-vue";
|
|
5
|
+
import { SvgIcon, TpfModal } from "tmgc2-share";
|
|
6
|
+
import draggable from "vuedraggable";
|
|
7
|
+
import { cloneDeep } from "lodash-es";
|
|
8
|
+
import _asyncToGenerator from "@oxc-project/runtime/helpers/asyncToGenerator";
|
|
9
|
+
import { useI18n } from "@kp-ui/i18n";
|
|
10
|
+
import { SearchOutlined } from "@ant-design/icons-vue";
|
|
11
|
+
import TpfDelConfirm$1 from "tmgc2-share/src/components/TpfModal/TpfDelConfirm";
|
|
12
|
+
//#region src/components/public/DataTableColumnDialog.vue?vue&type=script&setup=true&name=DataTableColumnDialog&lang.ts
|
|
13
|
+
var _hoisted_1 = { class: "col-left-title" };
|
|
14
|
+
var _hoisted_2 = { class: "title" };
|
|
15
|
+
var _hoisted_3 = { class: "search" };
|
|
16
|
+
var _hoisted_4 = { class: "col-left-content" };
|
|
17
|
+
var _hoisted_5 = { class: "col-right-title" };
|
|
18
|
+
var _hoisted_6 = { class: "title" };
|
|
19
|
+
var _hoisted_7 = { class: "col-right-content-item-left" };
|
|
20
|
+
var _hoisted_8 = { class: "title" };
|
|
21
|
+
var _hoisted_9 = { class: "col-right-content-item-right" };
|
|
22
|
+
var DataTableColumnDialog_vue_vue_type_script_setup_true_name_DataTableColumnDialog_lang_default = /* @__PURE__ */ defineComponent({
|
|
23
|
+
__name: "DataTableColumnDialog",
|
|
24
|
+
props: /* @__PURE__ */ mergeModels({
|
|
25
|
+
columns: { default: () => [] },
|
|
26
|
+
pageCode: { default: "" },
|
|
27
|
+
tableId: { default: "" }
|
|
28
|
+
}, {
|
|
29
|
+
"visible": _objectSpread({ type: Boolean }, { default: false }),
|
|
30
|
+
"visibleModifiers": {}
|
|
31
|
+
}),
|
|
32
|
+
emits: /* @__PURE__ */ mergeModels(["update"], ["update:visible"]),
|
|
33
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
34
|
+
const { t } = useI18n();
|
|
35
|
+
const tableColumnStore = useTableColumnStore();
|
|
36
|
+
const props = __props;
|
|
37
|
+
const emit = __emit;
|
|
38
|
+
const visible = useModel(__props, "visible");
|
|
39
|
+
const searchKey = ref("");
|
|
40
|
+
const tableColumns = ref([]);
|
|
41
|
+
const rightShowColumns = ref([]);
|
|
42
|
+
const initColumn = ref([]);
|
|
43
|
+
const saveColumnConfig = () => {
|
|
44
|
+
const storageKey = props.pageCode || props.tableId;
|
|
45
|
+
if (!storageKey) return;
|
|
46
|
+
const columnList = mergeColumns();
|
|
47
|
+
tableColumnStore.saveColumnList(storageKey, columnList);
|
|
48
|
+
};
|
|
49
|
+
const leftShowColumns = computed(() => {
|
|
50
|
+
if (!searchKey.value) return tableColumns.value;
|
|
51
|
+
return tableColumns.value.filter((item) => {
|
|
52
|
+
return item.title && item.title.toLowerCase().includes(searchKey.value.toLowerCase());
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
const checkAll = ref(false);
|
|
56
|
+
const indeterminate = ref(false);
|
|
57
|
+
const updateCheckAll = () => {
|
|
58
|
+
const visibleColumns = leftShowColumns.value.filter((item) => item.visible);
|
|
59
|
+
checkAll.value = visibleColumns.length === leftShowColumns.value.length && leftShowColumns.value.length > 0;
|
|
60
|
+
indeterminate.value = visibleColumns.length > 0 && visibleColumns.length < leftShowColumns.value.length;
|
|
61
|
+
};
|
|
62
|
+
const getRightShowColumns = () => {
|
|
63
|
+
rightShowColumns.value = [];
|
|
64
|
+
tableColumns.value.forEach((item) => {
|
|
65
|
+
if (item.visible) rightShowColumns.value.push(item);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const sortRightColumns = () => {
|
|
69
|
+
rightShowColumns.value.sort((a, b) => {
|
|
70
|
+
if (a.fixed === "left" && b.fixed !== "left") return -1;
|
|
71
|
+
if (a.fixed !== "left" && b.fixed === "left") return 1;
|
|
72
|
+
return 0;
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const mergeColumns = () => {
|
|
76
|
+
const selectList = unref(rightShowColumns);
|
|
77
|
+
const unSelectList = [];
|
|
78
|
+
unref(initColumn).forEach((item) => {
|
|
79
|
+
if (!unref(selectList).some((it) => it.dataIndex === item.dataIndex)) unSelectList.push(_objectSpread(_objectSpread({}, item), {}, { visible: false }));
|
|
80
|
+
});
|
|
81
|
+
return [...selectList, ...unSelectList].map((item, index) => _objectSpread(_objectSpread({}, item), {}, { displayOrdinal: index }));
|
|
82
|
+
};
|
|
83
|
+
const restColum = () => {
|
|
84
|
+
tableColumns.value = cloneDeep(unref(initColumn));
|
|
85
|
+
getRightShowColumns();
|
|
86
|
+
updateCheckAll();
|
|
87
|
+
};
|
|
88
|
+
const restPageJson = function() {
|
|
89
|
+
var _ref = _asyncToGenerator(function* () {
|
|
90
|
+
const storageKey = props.pageCode || props.tableId;
|
|
91
|
+
if (!storageKey) {
|
|
92
|
+
message.warning(t("lang.未配置 pageCode 或 tableId"));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
yield TpfDelConfirm$1({ content: t("lang.确定清除缓存记录吗") });
|
|
96
|
+
tableColumnStore.clearTableConfig(storageKey);
|
|
97
|
+
message.success(t("lang.清除成功"));
|
|
98
|
+
window.location.reload();
|
|
99
|
+
});
|
|
100
|
+
return function restPageJson() {
|
|
101
|
+
return _ref.apply(this, arguments);
|
|
102
|
+
};
|
|
103
|
+
}();
|
|
104
|
+
const onCancel = () => {
|
|
105
|
+
visible.value = false;
|
|
106
|
+
};
|
|
107
|
+
const handleOk = () => {
|
|
108
|
+
saveColumnConfig();
|
|
109
|
+
emit("update", mergeColumns());
|
|
110
|
+
visible.value = false;
|
|
111
|
+
};
|
|
112
|
+
const changeCheckAll = (e) => {
|
|
113
|
+
const checked = e.target.checked;
|
|
114
|
+
checkAll.value = checked;
|
|
115
|
+
indeterminate.value = false;
|
|
116
|
+
tableColumns.value.forEach((item) => {
|
|
117
|
+
item.visible = checked;
|
|
118
|
+
});
|
|
119
|
+
getRightShowColumns();
|
|
120
|
+
};
|
|
121
|
+
const onchangeCheck = (row) => {
|
|
122
|
+
const index = rightShowColumns.value.findIndex((item) => item.dataIndex === row.dataIndex);
|
|
123
|
+
if (row.visible) {
|
|
124
|
+
if (index === -1) rightShowColumns.value.push(row);
|
|
125
|
+
} else if (index > -1) rightShowColumns.value.splice(index, 1);
|
|
126
|
+
updateCheckAll();
|
|
127
|
+
};
|
|
128
|
+
const removeColumn = (row, index) => {
|
|
129
|
+
row.visible = false;
|
|
130
|
+
delete row.fixed;
|
|
131
|
+
rightShowColumns.value.splice(index, 1);
|
|
132
|
+
updateCheckAll();
|
|
133
|
+
};
|
|
134
|
+
const toggleFixed = (row) => {
|
|
135
|
+
if (row.fixed === "left") delete row.fixed;
|
|
136
|
+
else {
|
|
137
|
+
if (rightShowColumns.value.filter((item) => item.fixed === "left").length >= 2) return;
|
|
138
|
+
row.fixed = "left";
|
|
139
|
+
}
|
|
140
|
+
sortRightColumns();
|
|
141
|
+
};
|
|
142
|
+
const open = () => {
|
|
143
|
+
visible.value = true;
|
|
144
|
+
};
|
|
145
|
+
const restoreColumnFromStorage = () => {
|
|
146
|
+
const storageKey = props.pageCode || props.tableId;
|
|
147
|
+
if (!storageKey || !tableColumnStore.hasTableConfig(storageKey)) return cloneDeep(props.columns);
|
|
148
|
+
const storedColumnList = tableColumnStore.getColumnList(storageKey);
|
|
149
|
+
if (storedColumnList.length === 0) return cloneDeep(props.columns);
|
|
150
|
+
return cloneDeep(props.columns).map((col) => {
|
|
151
|
+
const stored = storedColumnList.find((item) => item.dataIndex === col.dataIndex);
|
|
152
|
+
if (stored) return _objectSpread(_objectSpread({}, col), {}, {
|
|
153
|
+
visible: stored.visible !== false,
|
|
154
|
+
fixed: stored.fixed,
|
|
155
|
+
displayOrdinal: stored.displayOrdinal
|
|
156
|
+
});
|
|
157
|
+
return col;
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
watch(() => visible.value, function() {
|
|
161
|
+
var _ref2 = _asyncToGenerator(function* (val) {
|
|
162
|
+
if (val) {
|
|
163
|
+
const columnsConfig = restoreColumnFromStorage();
|
|
164
|
+
tableColumns.value = columnsConfig;
|
|
165
|
+
initColumn.value = columnsConfig;
|
|
166
|
+
getRightShowColumns();
|
|
167
|
+
sortRightColumns();
|
|
168
|
+
updateCheckAll();
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
return function(_x) {
|
|
172
|
+
return _ref2.apply(this, arguments);
|
|
173
|
+
};
|
|
174
|
+
}(), { immediate: true });
|
|
175
|
+
__expose({
|
|
176
|
+
open,
|
|
177
|
+
restColum
|
|
178
|
+
});
|
|
179
|
+
return (_ctx, _cache) => {
|
|
180
|
+
const _component_a_input = resolveComponent("a-input");
|
|
181
|
+
const _component_a_checkbox = resolveComponent("a-checkbox");
|
|
182
|
+
const _component_a_tooltip = resolveComponent("a-tooltip");
|
|
183
|
+
const _component_a_col = resolveComponent("a-col");
|
|
184
|
+
const _component_a_row = resolveComponent("a-row");
|
|
185
|
+
const _component_a_button = resolveComponent("a-button");
|
|
186
|
+
return openBlock(), createBlock(unref(TpfModal), {
|
|
187
|
+
visible: visible.value,
|
|
188
|
+
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => visible.value = $event),
|
|
189
|
+
title: unref(t)("lang.列管理"),
|
|
190
|
+
width: "800px",
|
|
191
|
+
destroyOnClose: ""
|
|
192
|
+
}, {
|
|
193
|
+
footerLeft: withCtx(() => [createVNode(_component_a_button, {
|
|
194
|
+
class: "tpf-button",
|
|
195
|
+
onClick: restColum
|
|
196
|
+
}, {
|
|
197
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("lang.重置")), 1)]),
|
|
198
|
+
_: 1
|
|
199
|
+
}), createVNode(_component_a_button, {
|
|
200
|
+
class: "tpf-button",
|
|
201
|
+
onClick: restPageJson
|
|
202
|
+
}, {
|
|
203
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("lang.清除缓存记录")), 1)]),
|
|
204
|
+
_: 1
|
|
205
|
+
})]),
|
|
206
|
+
footerRight: withCtx(() => [createVNode(_component_a_button, {
|
|
207
|
+
class: "tpf-button",
|
|
208
|
+
onClick: onCancel
|
|
209
|
+
}, {
|
|
210
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("lang.取消")), 1)]),
|
|
211
|
+
_: 1
|
|
212
|
+
}), createVNode(_component_a_button, {
|
|
213
|
+
class: "tpf-button",
|
|
214
|
+
type: "primary",
|
|
215
|
+
onClick: handleOk
|
|
216
|
+
}, {
|
|
217
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("lang.保存")), 1)]),
|
|
218
|
+
_: 1
|
|
219
|
+
})]),
|
|
220
|
+
default: withCtx(() => [createVNode(_component_a_row, {
|
|
221
|
+
gutter: 10,
|
|
222
|
+
class: "column-row"
|
|
223
|
+
}, {
|
|
224
|
+
default: withCtx(() => [createVNode(_component_a_col, {
|
|
225
|
+
span: 17,
|
|
226
|
+
class: "col-left"
|
|
227
|
+
}, {
|
|
228
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("span", null, toDisplayString(unref(t)("lang.可选字段")), 1), createElementVNode("span", null, "(" + toDisplayString(leftShowColumns.value.length) + toDisplayString(unref(t)("lang.个")) + ") ", 1)]), createElementVNode("div", _hoisted_3, [createVNode(_component_a_input, {
|
|
229
|
+
placeholder: unref(t)("lang.请搜索"),
|
|
230
|
+
size: "small",
|
|
231
|
+
"allow-clear": "",
|
|
232
|
+
value: searchKey.value,
|
|
233
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchKey.value = $event)
|
|
234
|
+
}, {
|
|
235
|
+
prefix: withCtx(() => [createVNode(unref(SearchOutlined))]),
|
|
236
|
+
_: 1
|
|
237
|
+
}, 8, ["placeholder", "value"])])]), createElementVNode("div", _hoisted_4, [!!tableColumns.value.length ? (openBlock(), createBlock(_component_a_checkbox, {
|
|
238
|
+
key: 0,
|
|
239
|
+
checked: checkAll.value,
|
|
240
|
+
"onUpdate:checked": _cache[1] || (_cache[1] = ($event) => checkAll.value = $event),
|
|
241
|
+
onChange: changeCheckAll,
|
|
242
|
+
indeterminate: indeterminate.value
|
|
243
|
+
}, {
|
|
244
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("lang.全选")), 1)]),
|
|
245
|
+
_: 1
|
|
246
|
+
}, 8, ["checked", "indeterminate"])) : createCommentVNode("", true), createVNode(_component_a_row, {
|
|
247
|
+
gutter: [10, 10],
|
|
248
|
+
class: "checkbox-row"
|
|
249
|
+
}, {
|
|
250
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(leftShowColumns.value, (item) => {
|
|
251
|
+
return openBlock(), createBlock(_component_a_col, {
|
|
252
|
+
key: item.dataIndex,
|
|
253
|
+
span: 6
|
|
254
|
+
}, {
|
|
255
|
+
default: withCtx(() => [createVNode(_component_a_checkbox, {
|
|
256
|
+
checked: item.visible,
|
|
257
|
+
"onUpdate:checked": ($event) => item.visible = $event,
|
|
258
|
+
onChange: ($event) => onchangeCheck(item)
|
|
259
|
+
}, {
|
|
260
|
+
default: withCtx(() => [createVNode(_component_a_tooltip, { title: item.title }, {
|
|
261
|
+
default: withCtx(() => [createTextVNode(toDisplayString(item.title), 1)]),
|
|
262
|
+
_: 2
|
|
263
|
+
}, 1032, ["title"])]),
|
|
264
|
+
_: 2
|
|
265
|
+
}, 1032, [
|
|
266
|
+
"checked",
|
|
267
|
+
"onUpdate:checked",
|
|
268
|
+
"onChange"
|
|
269
|
+
])]),
|
|
270
|
+
_: 2
|
|
271
|
+
}, 1024);
|
|
272
|
+
}), 128))]),
|
|
273
|
+
_: 1
|
|
274
|
+
})])]),
|
|
275
|
+
_: 1
|
|
276
|
+
}), createVNode(_component_a_col, {
|
|
277
|
+
span: 7,
|
|
278
|
+
class: "col-right"
|
|
279
|
+
}, {
|
|
280
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_5, [createElementVNode("div", _hoisted_6, [createElementVNode("span", null, toDisplayString(unref(t)("lang.已选字段")), 1), createElementVNode("span", null, "(" + toDisplayString(rightShowColumns.value.length) + toDisplayString(unref(t)("lang.个")) + ") ", 1)])]), createVNode(unref(draggable), {
|
|
281
|
+
tag: "div",
|
|
282
|
+
list: rightShowColumns.value,
|
|
283
|
+
class: "col-right-content",
|
|
284
|
+
"item-key": "dataIndex",
|
|
285
|
+
handle: ".drag-handle",
|
|
286
|
+
animation: "150"
|
|
287
|
+
}, {
|
|
288
|
+
item: withCtx(({ element: item, index }) => [(openBlock(), createElementBlock("div", {
|
|
289
|
+
class: "col-right-content-item",
|
|
290
|
+
key: item.dataIndex
|
|
291
|
+
}, [createElementVNode("div", _hoisted_7, [createVNode(unref(SvgIcon), {
|
|
292
|
+
size: "24",
|
|
293
|
+
type: "icon-move1",
|
|
294
|
+
class: "drag-handle icon-move1",
|
|
295
|
+
move: "",
|
|
296
|
+
shadow: ""
|
|
297
|
+
}), createElementVNode("span", _hoisted_8, toDisplayString(item.title), 1)]), createElementVNode("div", _hoisted_9, [createVNode(unref(SvgIcon), {
|
|
298
|
+
size: "24",
|
|
299
|
+
type: "icon-ding",
|
|
300
|
+
class: normalizeClass(["icon-ding", item.fixed === "left" && "showIcon"]),
|
|
301
|
+
cursor: "",
|
|
302
|
+
shadow: "",
|
|
303
|
+
activeBackGround: item.fixed === "left" ? "" : "#e8e9e9",
|
|
304
|
+
style: normalizeStyle(`color:${item.fixed === "left" ? "var(--ant-primary-color)" : "#b0b4b7"}`),
|
|
305
|
+
onClick: ($event) => toggleFixed(item)
|
|
306
|
+
}, null, 8, [
|
|
307
|
+
"class",
|
|
308
|
+
"activeBackGround",
|
|
309
|
+
"style",
|
|
310
|
+
"onClick"
|
|
311
|
+
]), createVNode(unref(SvgIcon), {
|
|
312
|
+
size: "24",
|
|
313
|
+
type: "icon-guanbi",
|
|
314
|
+
cursor: "",
|
|
315
|
+
shadow: "",
|
|
316
|
+
onClick: ($event) => removeColumn(item, index)
|
|
317
|
+
}, null, 8, ["onClick"])])]))]),
|
|
318
|
+
_: 1
|
|
319
|
+
}, 8, ["list"])]),
|
|
320
|
+
_: 1
|
|
321
|
+
})]),
|
|
322
|
+
_: 1
|
|
323
|
+
})]),
|
|
324
|
+
_: 1
|
|
325
|
+
}, 8, ["visible", "title"]);
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
//#endregion
|
|
330
|
+
export { DataTableColumnDialog_vue_vue_type_script_setup_true_name_DataTableColumnDialog_lang_default as default };
|