@kp-ui/lowcode 2.16.1 → 2.16.3
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/package.json +1 -1
- package/src/components/form-designer/form-widget/field-widget/useField.js +24 -24
- package/src/components/form-designer/form-widget/field-widget/useField.js.map +1 -1
- package/src/components/form-render/dynamic-dialog.vue.js +11 -11
- package/src/components/form-render/dynamic-dialog.vue.js.map +1 -1
- package/src/components/public/ActionButtonListRender.vue.js +1 -1
- package/src/components/public/ActionButtonListRender.vue.js.map +1 -1
- package/src/components/public/ActionButtonListRender.vue2.js +45 -39
- package/src/components/public/ActionButtonListRender.vue2.js.map +1 -1
- package/stats.html +1 -1
- package/styles/style.css +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as b, computed as o } from "vue";
|
|
2
|
-
import { SvgIcon as x, useExecFunction as
|
|
3
|
-
import { ButtonPositionEnum as
|
|
4
|
-
const
|
|
2
|
+
import { SvgIcon as x, useExecFunction as h } from "tmgc2-share";
|
|
3
|
+
import { ButtonPositionEnum as B } from "../../constants/index.js";
|
|
4
|
+
const p = b({
|
|
5
5
|
name: "ActionButtonListRender",
|
|
6
6
|
components: { SvgIcon: x },
|
|
7
7
|
props: {
|
|
@@ -42,56 +42,62 @@ const C = b({
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
emits: ["on-click"],
|
|
45
|
-
setup(
|
|
45
|
+
setup(e, { emit: r }) {
|
|
46
46
|
const l = o(() => ({
|
|
47
|
-
"--flex":
|
|
48
|
-
})), { executeFunction:
|
|
47
|
+
"--flex": e.flex
|
|
48
|
+
})), { executeFunction: c, asyncExecuteFunction: i } = h(), a = o(
|
|
49
49
|
() => {
|
|
50
|
-
var
|
|
51
|
-
return ((
|
|
50
|
+
var t;
|
|
51
|
+
return ((t = e.options) == null ? void 0 : t.buttonPosition) !== B.DIY || e.designState;
|
|
52
52
|
}
|
|
53
53
|
), s = o(
|
|
54
54
|
() => {
|
|
55
|
-
var
|
|
56
|
-
return
|
|
55
|
+
var t;
|
|
56
|
+
return a.value ? null : (t = e.options) == null ? void 0 : t.getContainer;
|
|
57
57
|
}
|
|
58
58
|
), u = o(
|
|
59
|
-
() =>
|
|
60
|
-
), d = async (
|
|
61
|
-
if (!
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
() => e.buttonList.filter((t) => t.hidden !== 1).filter((t) => !y(t))
|
|
60
|
+
), d = async (t) => {
|
|
61
|
+
if (!e.designState) {
|
|
62
|
+
if (!t.onClick) {
|
|
63
|
+
r("on-click", { item: t, result: !0 });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!t.loading) {
|
|
67
|
+
t.loading = !0;
|
|
68
|
+
try {
|
|
69
|
+
const n = await i({
|
|
70
|
+
functionBody: t.onClick,
|
|
71
|
+
context: e.ctx,
|
|
72
|
+
params: e.scope
|
|
73
|
+
});
|
|
74
|
+
r("on-click", { item: t, result: n });
|
|
75
|
+
} catch (n) {
|
|
76
|
+
console.error("Button click handler error:", n);
|
|
77
|
+
} finally {
|
|
78
|
+
t.loading = !1;
|
|
79
|
+
}
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
|
-
}, f = (
|
|
77
|
-
if (!
|
|
82
|
+
}, f = (t) => {
|
|
83
|
+
if (!t.onDisabled) return !1;
|
|
78
84
|
try {
|
|
79
|
-
const n =
|
|
80
|
-
functionBody:
|
|
81
|
-
context:
|
|
82
|
-
params:
|
|
85
|
+
const n = c({
|
|
86
|
+
functionBody: t.onDisabled,
|
|
87
|
+
context: e.ctx,
|
|
88
|
+
params: e.scope
|
|
83
89
|
});
|
|
84
90
|
return typeof n == "boolean" ? n : !1;
|
|
85
91
|
} catch (n) {
|
|
86
92
|
return console.error("Button disabled handler error:", n), !1;
|
|
87
93
|
}
|
|
88
|
-
}, y = (
|
|
89
|
-
if (!
|
|
94
|
+
}, y = (t) => {
|
|
95
|
+
if (!t.onHidden) return !1;
|
|
90
96
|
try {
|
|
91
|
-
return
|
|
92
|
-
functionBody:
|
|
93
|
-
context:
|
|
94
|
-
params:
|
|
97
|
+
return c({
|
|
98
|
+
functionBody: t.onHidden,
|
|
99
|
+
context: e.ctx,
|
|
100
|
+
params: e.scope
|
|
95
101
|
});
|
|
96
102
|
} catch (n) {
|
|
97
103
|
return console.error("Button hidden handler error:", n), !1;
|
|
@@ -99,7 +105,7 @@ const C = b({
|
|
|
99
105
|
};
|
|
100
106
|
return {
|
|
101
107
|
getContainer: s,
|
|
102
|
-
isDisabled:
|
|
108
|
+
isDisabled: a,
|
|
103
109
|
containerStyle: l,
|
|
104
110
|
visibleButtons: u,
|
|
105
111
|
handleClick: d,
|
|
@@ -108,6 +114,6 @@ const C = b({
|
|
|
108
114
|
}
|
|
109
115
|
});
|
|
110
116
|
export {
|
|
111
|
-
|
|
117
|
+
p as default
|
|
112
118
|
};
|
|
113
119
|
//# sourceMappingURL=ActionButtonListRender.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButtonListRender.vue2.js","sources":["../../../../src/components/public/ActionButtonListRender.vue"],"sourcesContent":["<template>\n <div\n ref=\"fieldEditor\"\n :class=\"['button-list-container', ...customClass]\"\n :style=\"containerStyle\"\n >\n <Teleport :disabled=\"isDisabled\" :to=\"getContainer\">\n <a-space :size=\"8\">\n <a-button\n v-for=\"item in visibleButtons\"\n :key=\"item.key\"\n :type=\"item.type\"\n :size=\"item.size\"\n :danger=\"!!item.danger\"\n :ghost=\"!!item.ghost\"\n class=\"tpf-button\"\n :loading=\"item.loading\"\n :disabled=\"handleDisabled(item) || disabled || !!item.disabled\"\n @click=\"handleClick(item)\"\n >\n <template v-if=\"item.icon\">\n <SvgIcon :icon-class=\"item.icon\" class=\"button-icon\" />\n </template>\n {{ item.label }}\n </a-button>\n </a-space>\n </Teleport>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, computed, PropType } from 'vue';\n import { SvgIcon, useExecFunction } from 'tmgc2-share';\n import type { ActionButton } from '@/types/button';\n import { ButtonPositionEnum } from '@/constants';\n\n export default defineComponent({\n name: 'ActionButtonListRender',\n components: { SvgIcon },\n props: {\n options: {\n type: Object,\n default: () => {}\n },\n disabled: {\n type: Boolean,\n default: false\n },\n scope: {\n type: Object,\n default: () => {}\n },\n ctx: {\n type: Object,\n default: () => {}\n },\n buttonList: {\n type: Array as PropType<ActionButton[]>,\n default: () => []\n },\n customClass: {\n type: Array as PropType<string[]>,\n default: () => []\n },\n flex: {\n type: String,\n default: 'center'\n },\n designState: {\n type: Boolean,\n default: false\n }\n },\n emits: ['on-click'],\n setup(props, { emit }) {\n const containerStyle = computed(() => ({\n '--flex': props.flex\n }));\n\n const { executeFunction, asyncExecuteFunction } = useExecFunction();\n\n const isDisabled = computed(\n () => props.options?.buttonPosition !== ButtonPositionEnum.DIY || props.designState\n );\n\n const getContainer = computed(() =>\n isDisabled.value ? null : props.options?.getContainer\n );\n\n const visibleButtons = computed(() =>\n props.buttonList\n .filter(item => item.hidden !== 1)\n .filter(item => !handleHidden(item))\n );\n\n const handleClick = async (item: ActionButton) => {\n if (props.designState) return; // 在设计状态下不处理点击事件\n if (!item.onClick) return;\n if (item.loading) return;\n item.loading = true;\n try {\n const result = await asyncExecuteFunction({\n functionBody: item.onClick,\n context: props.ctx,\n params: props.scope\n });\n
|
|
1
|
+
{"version":3,"file":"ActionButtonListRender.vue2.js","sources":["../../../../src/components/public/ActionButtonListRender.vue"],"sourcesContent":["<template>\n <div\n ref=\"fieldEditor\"\n :class=\"['button-list-container', ...customClass]\"\n :style=\"containerStyle\"\n >\n <Teleport :disabled=\"isDisabled\" :to=\"getContainer\">\n <a-space :size=\"8\">\n <a-button\n v-for=\"item in visibleButtons\"\n :key=\"item.key\"\n :type=\"item.type\"\n :size=\"item.size\"\n :danger=\"!!item.danger\"\n :ghost=\"!!item.ghost\"\n class=\"tpf-button\"\n :loading=\"item.loading\"\n :disabled=\"handleDisabled(item) || disabled || !!item.disabled\"\n @click=\"handleClick(item)\"\n >\n <template v-if=\"item.icon\">\n <SvgIcon :icon-class=\"item.icon\" class=\"button-icon\" />\n </template>\n {{ item.label }}\n </a-button>\n </a-space>\n </Teleport>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, computed, PropType } from 'vue';\n import { SvgIcon, useExecFunction } from 'tmgc2-share';\n import type { ActionButton } from '@/types/button';\n import { ButtonPositionEnum } from '@/constants';\n\n export default defineComponent({\n name: 'ActionButtonListRender',\n components: { SvgIcon },\n props: {\n options: {\n type: Object,\n default: () => {}\n },\n disabled: {\n type: Boolean,\n default: false\n },\n scope: {\n type: Object,\n default: () => {}\n },\n ctx: {\n type: Object,\n default: () => {}\n },\n buttonList: {\n type: Array as PropType<ActionButton[]>,\n default: () => []\n },\n customClass: {\n type: Array as PropType<string[]>,\n default: () => []\n },\n flex: {\n type: String,\n default: 'center'\n },\n designState: {\n type: Boolean,\n default: false\n }\n },\n emits: ['on-click'],\n setup(props, { emit }) {\n const containerStyle = computed(() => ({\n '--flex': props.flex\n }));\n\n const { executeFunction, asyncExecuteFunction } = useExecFunction();\n\n const isDisabled = computed(\n () => props.options?.buttonPosition !== ButtonPositionEnum.DIY || props.designState\n );\n\n const getContainer = computed(() =>\n isDisabled.value ? null : props.options?.getContainer\n );\n\n const visibleButtons = computed(() =>\n props.buttonList\n .filter(item => item.hidden !== 1)\n .filter(item => !handleHidden(item))\n );\n\n const handleClick = async (item: ActionButton) => {\n if (props.designState) return; // 在设计状态下不处理点击事件\n if (!item.onClick) {\n emit('on-click', { item, result: true });\n return;\n }\n if (item.loading) return;\n item.loading = true;\n try {\n const result = await asyncExecuteFunction({\n functionBody: item.onClick,\n context: props.ctx,\n params: props.scope\n });\n emit('on-click', { item, result });\n } catch (error) {\n console.error('Button click handler error:', error);\n } finally {\n item.loading = false;\n }\n };\n\n const handleDisabled = (item: ActionButton): boolean => {\n if (!item.onDisabled) return false;\n\n try {\n const result = executeFunction({\n functionBody: item.onDisabled,\n context: props.ctx,\n params: props.scope\n });\n if (typeof result === 'boolean') {\n return result;\n } else {\n return false;\n }\n } catch (error) {\n console.error('Button disabled handler error:', error);\n return false;\n }\n };\n\n const handleHidden = (item: ActionButton): boolean => {\n if (!item.onHidden) return false;\n\n try {\n return executeFunction({\n functionBody: item.onHidden,\n context: props.ctx,\n params: props.scope\n });\n } catch (error) {\n console.error('Button hidden handler error:', error);\n return false;\n }\n };\n\n return {\n getContainer,\n isDisabled,\n containerStyle,\n visibleButtons,\n handleClick,\n handleDisabled\n };\n }\n });\n</script>\n\n<style lang=\"scss\" scoped>\n .button-list-container {\n flex: 1;\n display: flex;\n justify-content: var(--flex);\n\n .button-icon {\n margin-right: 4px;\n }\n }\n</style>\n"],"names":["_sfc_main","defineComponent","SvgIcon","props","emit","containerStyle","computed","executeFunction","asyncExecuteFunction","useExecFunction","isDisabled","_a","ButtonPositionEnum","getContainer","visibleButtons","item","handleHidden","handleClick","result","error","handleDisabled"],"mappings":";;;AAoCI,MAAAA,IAAeC,EAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,YAAY,EAAE,SAAAC,EAAA;AAAA,EACd,OAAO;AAAA,IACH,SAAS;AAAA,MACL,MAAM;AAAA,MACN,SAAS,MAAM;AAAA,MAAC;AAAA,IAAA;AAAA,IAEpB,UAAU;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,IAEb,OAAO;AAAA,MACH,MAAM;AAAA,MACN,SAAS,MAAM;AAAA,MAAC;AAAA,IAAA;AAAA,IAEpB,KAAK;AAAA,MACD,MAAM;AAAA,MACN,SAAS,MAAM;AAAA,MAAC;AAAA,IAAA;AAAA,IAEpB,YAAY;AAAA,MACR,MAAM;AAAA,MACN,SAAS,MAAM,CAAA;AAAA,IAAC;AAAA,IAEp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