@kp-ui/lowcode-pc 1.0.2 → 1.0.4

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 (33) hide show
  1. package/assets/styles/style.css +50 -48
  2. package/core/src/hooks/useField.js +1 -0
  3. package/core/src/hooks/useField.js.map +1 -1
  4. package/core/src/store/useTableColumnStore.js +42 -0
  5. package/core/src/store/useTableColumnStore.js.map +1 -0
  6. package/package.json +1 -1
  7. package/src/components/desginer/form-widget/container-widget/useTableWidget.js +60 -4
  8. package/src/components/desginer/form-widget/container-widget/useTableWidget.js.map +1 -1
  9. package/src/components/desginer/form-widget/container-widget/vf-dialog-widget.vue2.js +1 -1
  10. package/src/components/desginer/widget-panel/advanced/data-table.js +1 -1
  11. package/src/components/desginer/widget-panel/advanced/data-table.js.map +1 -1
  12. package/src/components/field-widget/button-list-widget.vue2.js +1 -1
  13. package/src/components/field-widget/diy-compontent-widget.vue2.js +1 -1
  14. package/src/components/field-widget/diy-compontent-widget.vue2.js.map +1 -1
  15. package/src/components/form-render/container-items/data-table-widget.vue.js +1 -1
  16. package/src/components/form-render/container-items/data-table-widget.vue2.js +23 -62
  17. package/src/components/form-render/container-items/data-table-widget.vue2.js.map +1 -1
  18. package/src/components/form-render/container-items/grid-sub-form-widget.vue.js +1 -1
  19. package/src/components/form-render/container-items/grid-sub-form-widget.vue2.js +9 -8
  20. package/src/components/form-render/container-items/grid-sub-form-widget.vue2.js.map +1 -1
  21. package/src/components/public/ActionButtonListRender.vue.js +50 -127
  22. package/src/components/public/ActionButtonListRender.vue.js.map +1 -1
  23. package/src/components/public/ActionButtonListRender.vue2.js +130 -0
  24. package/src/components/public/{ActionButtonListRender.vue3.js.map → ActionButtonListRender.vue2.js.map} +1 -1
  25. package/src/components/public/ConfigView/CustomPageRender.vue.js +1 -1
  26. package/src/components/public/CustomerModal/CustomerModal.vue2.js +1 -1
  27. package/src/components/public/DataTableColumnDialog.vue.js +1 -1
  28. package/src/components/public/DataTableColumnDialog.vue2.js +103 -32
  29. package/src/components/public/DataTableColumnDialog.vue2.js.map +1 -1
  30. package/src/components/public/DynamicDialog.vue.js +1 -1
  31. package/src/components/render/index.vue2.js +1 -1
  32. package/stats.html +1 -1
  33. package/src/components/public/ActionButtonListRender.vue3.js +0 -53
@@ -1,130 +1,53 @@
1
- import { defineComponent, computed } from "vue";
2
- import { SvgIcon, useExecFunction } from "tmgc2-share";
3
- import { ButtonPositionEnum } from "../../../core/src/constants/index.js";
4
- const _sfc_main = defineComponent({
5
- name: "ActionButtonListRender",
6
- components: { SvgIcon },
7
- props: {
8
- options: {
9
- type: Object,
10
- default: () => {
11
- }
12
- },
13
- disabled: {
14
- type: Boolean,
15
- default: false
16
- },
17
- scope: {
18
- type: Object,
19
- default: () => {
20
- }
21
- },
22
- ctx: {
23
- type: Object,
24
- default: () => {
25
- }
26
- },
27
- buttonList: {
28
- type: Array,
29
- default: () => []
30
- },
31
- customClass: {
32
- type: Array,
33
- default: () => []
34
- },
35
- flex: {
36
- type: String,
37
- default: "center"
38
- },
39
- designState: {
40
- type: Boolean,
41
- default: false
42
- }
43
- },
44
- emits: ["on-click"],
45
- setup(props, { emit }) {
46
- const containerStyle = computed(() => ({
47
- "--flex": props.flex
48
- }));
49
- const { executeFunction, asyncExecuteFunction } = useExecFunction();
50
- const isDisabled = computed(
51
- () => {
52
- var _a;
53
- return ((_a = props.options) == null ? void 0 : _a.buttonPosition) !== ButtonPositionEnum.DIY || props.designState;
54
- }
55
- );
56
- const getContainer = computed(
57
- () => {
58
- var _a;
59
- return isDisabled.value ? "body" : ((_a = props.options) == null ? void 0 : _a.getContainer) || "body";
60
- }
61
- );
62
- const visibleButtons = computed(
63
- () => props.buttonList.filter((item) => item.hidden !== 1).filter((item) => !handleHidden(item))
64
- );
65
- const handleClick = async (item) => {
66
- if (props.designState) return;
67
- if (!item.onClick) {
68
- emit("on-click", { item, result: true });
69
- return;
70
- }
71
- if (item.loading) return;
72
- item.loading = true;
73
- try {
74
- const result = await asyncExecuteFunction({
75
- functionBody: item.onClick,
76
- context: props.ctx,
77
- params: props.scope
78
- });
79
- emit("on-click", { item, result });
80
- } catch (error) {
81
- console.error("Button click handler error:", error);
82
- } finally {
83
- item.loading = false;
84
- }
85
- };
86
- const handleDisabled = (item) => {
87
- if (!item.onDisabled) return false;
88
- try {
89
- const result = executeFunction({
90
- functionBody: item.onDisabled,
91
- context: props.ctx,
92
- params: props.scope
93
- });
94
- if (typeof result === "boolean") {
95
- return result;
96
- } else {
97
- return false;
98
- }
99
- } catch (error) {
100
- console.error("Button disabled handler error:", error);
101
- return false;
102
- }
103
- };
104
- const handleHidden = (item) => {
105
- if (!item.onHidden) return false;
106
- try {
107
- return executeFunction({
108
- functionBody: item.onHidden,
109
- context: props.ctx,
110
- params: props.scope
111
- });
112
- } catch (error) {
113
- console.error("Button hidden handler error:", error);
114
- return false;
115
- }
116
- };
117
- return {
118
- getContainer,
119
- isDisabled,
120
- containerStyle,
121
- visibleButtons,
122
- handleClick,
123
- handleDisabled
124
- };
125
- }
126
- });
1
+ import _sfc_main from "./ActionButtonListRender.vue2.js";
2
+ import { resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createBlock, Teleport, createVNode, withCtx, Fragment, renderList, createCommentVNode, createTextVNode, toDisplayString } from "vue";
3
+ /* empty css */
4
+ import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.js";
5
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
6
+ const _component_SvgIcon = resolveComponent("SvgIcon");
7
+ const _component_a_button = resolveComponent("a-button");
8
+ const _component_a_space = resolveComponent("a-space");
9
+ return openBlock(), createElementBlock("div", {
10
+ ref: "fieldEditor",
11
+ class: normalizeClass(["button-list-container", ..._ctx.customClass]),
12
+ style: normalizeStyle(_ctx.containerStyle)
13
+ }, [
14
+ (openBlock(), createBlock(Teleport, {
15
+ disabled: _ctx.isDisabled,
16
+ to: _ctx.getContainer
17
+ }, [
18
+ createVNode(_component_a_space, { size: 8 }, {
19
+ default: withCtx(() => [
20
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleButtons, (item) => {
21
+ return openBlock(), createBlock(_component_a_button, {
22
+ key: item.key,
23
+ type: item.type,
24
+ size: item.size,
25
+ danger: !!item.danger,
26
+ ghost: !!item.ghost,
27
+ class: "tpf-button",
28
+ loading: item.loading,
29
+ disabled: _ctx.handleDisabled(item) || _ctx.disabled || !!item.disabled,
30
+ onClick: ($event) => _ctx.handleClick(item)
31
+ }, {
32
+ default: withCtx(() => [
33
+ item.icon ? (openBlock(), createBlock(_component_SvgIcon, {
34
+ key: 0,
35
+ "icon-class": item.icon,
36
+ class: "button-icon"
37
+ }, null, 8, ["icon-class"])) : createCommentVNode("", true),
38
+ createTextVNode(" " + toDisplayString(item.label), 1)
39
+ ]),
40
+ _: 2
41
+ }, 1032, ["type", "size", "danger", "ghost", "loading", "disabled", "onClick"]);
42
+ }), 128))
43
+ ]),
44
+ _: 1
45
+ })
46
+ ], 8, ["disabled", "to"]))
47
+ ], 6);
48
+ }
49
+ const ActionButtonListRender = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-37429548"]]);
127
50
  export {
128
- _sfc_main as default
51
+ ActionButtonListRender as default
129
52
  };
130
53
  //# sourceMappingURL=ActionButtonListRender.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButtonListRender.vue.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 '@kp-ui/lowcode-core';\n import { ButtonPositionEnum } from '@kp-ui/lowcode-core';\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 ? 'body' : props.options?.getContainer || 'body'\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":[],"mappings":";;;AAoCI,MAAA,YAAe,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,YAAY,EAAE,QAAA;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,IAEpB,aAAa;AAAA,MACT,MAAM;AAAA,MACN,SAAS,MAAM,CAAA;AAAA,IAAC;AAAA,IAEpB,MAAM;AAAA,MACF,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,IAEb,aAAa;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,EACb;AAAA,EAEJ,OAAO,C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O,WAAW,WAAW;AAC7B,iBAAO;AAAA,QACX,OAAO;AACH,iBAAO;AAAA,QACX;AAAA,MACJ,SAAS,OAAO;AACZ,gBAAQ,MAAM,kCAAkC,KAAK;AACrD,eAAO;AAAA,MACX;AAAA,IACJ;AAEA,UAAM,eAAe,CAAC,SAAgC;AAClD,UAAI,CAAC,KAAK,SAAU,QAAO;AAE3B,UAAI;AACA,eAAO,gBAAgB;AAAA,UACnB,cAAc,KAAK;AAAA,UACnB,SAAS,MAAM;AAAA,UACf,QAAQ,MAAM;AAAA,QAAA,CACjB;AAAA,MACL,SAAS,OAAO;AACZ,gBAAQ,MAAM,gCAAgC,KAAK;AACnD,eAAO;AAAA,MACX;AAAA,IACJ;AAEA,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAER;AACJ,CAAC;"}
1
+ {"version":3,"file":"ActionButtonListRender.vue.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 '@kp-ui/lowcode-core';\n import { ButtonPositionEnum } from '@kp-ui/lowcode-core';\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 ? 'body' : props.options?.getContainer || 'body'\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":["_createElementBlock","_normalizeClass","_normalizeStyle","_createBlock","_Teleport","_createVNode","_withCtx","_openBlock","_Fragment","_renderList","_createCommentVNode","_toDisplayString"],"mappings":";;;;;;;;sBACIA,mBA0BM,OAAA;AAAA,IAzBF,KAAI;AAAA,IACH,OAAKC,4CAA+B,KAAA,WAAW,CAAA;AAAA,IAC/C,OAAKC,eAAE,KAAA,cAAc;AAAA,EAAA,GAAA;AAAA,kBAEtBC,YAoBWC,UAAA;AAAA,MApBA,UAAU,KAAA;AAAA,MAAa,IAAI,KAAA;AAAA,IAAA,GAAA;AAAA,MAClCC,YAkBU,oBAAA,EAlBA,MAAM,EAAA,GAAC;AAAA,QAAA,SAAAC,QAET,MAA8B;AAAA,WAAAC,UAAA,IAAA,GADlCP,mBAgBWQ,UAAA,MAAAC,WAfQ,KAAA,gBAAc,CAAtB,SAAI;gCADfN,YAgBW,qBAAA;AAAA,cAdN,KAAK,KAAK;AAAA,cACV,MAAM,KAAK;AAAA,cACX,MAAM,KAAK;AAAA,cACX,QAAM,EAAI,KAAK;AAAA,cACf,OAAK,EAAI,KAAK;AAAA,cACf,OAAM;AAAA,cACL,SAAS,KAAK;AAAA,cACd,UAAU,KAAA,eAAe,IAAI,KAAK,KAAA,YAAQ,EAAM,KAAK;AAAA,cACrD,SAAK,CAAA,WAAE,KAAA,YAAY,IAAI;AAAA,YAAA,GAAA;AAAA,+BAExB,MAEW;AAAA,gBAFK,KAAK,qBACjBA,YAAuD,oBAAA;AAAA,kBAAA,KAAA;AAAA,kBAA7C,cAAY,KAAK;AAAA,kBAAM,OAAM;AAAA,gBAAA,GAAA,MAAA,GAAA,CAAA,YAAA,CAAA,KAAAO,mBAAA,IAAA,IAAA;AAAA,gCAChC,MACXC,gBAAG,KAAK,KAAK,GAAA,CAAA;AAAA,cAAA,CAAA;AAAA;;;;;;;;;;"}
@@ -0,0 +1,130 @@
1
+ import { defineComponent, computed } from "vue";
2
+ import { SvgIcon, useExecFunction } from "tmgc2-share";
3
+ import { ButtonPositionEnum } from "../../../core/src/constants/index.js";
4
+ const _sfc_main = defineComponent({
5
+ name: "ActionButtonListRender",
6
+ components: { SvgIcon },
7
+ props: {
8
+ options: {
9
+ type: Object,
10
+ default: () => {
11
+ }
12
+ },
13
+ disabled: {
14
+ type: Boolean,
15
+ default: false
16
+ },
17
+ scope: {
18
+ type: Object,
19
+ default: () => {
20
+ }
21
+ },
22
+ ctx: {
23
+ type: Object,
24
+ default: () => {
25
+ }
26
+ },
27
+ buttonList: {
28
+ type: Array,
29
+ default: () => []
30
+ },
31
+ customClass: {
32
+ type: Array,
33
+ default: () => []
34
+ },
35
+ flex: {
36
+ type: String,
37
+ default: "center"
38
+ },
39
+ designState: {
40
+ type: Boolean,
41
+ default: false
42
+ }
43
+ },
44
+ emits: ["on-click"],
45
+ setup(props, { emit }) {
46
+ const containerStyle = computed(() => ({
47
+ "--flex": props.flex
48
+ }));
49
+ const { executeFunction, asyncExecuteFunction } = useExecFunction();
50
+ const isDisabled = computed(
51
+ () => {
52
+ var _a;
53
+ return ((_a = props.options) == null ? void 0 : _a.buttonPosition) !== ButtonPositionEnum.DIY || props.designState;
54
+ }
55
+ );
56
+ const getContainer = computed(
57
+ () => {
58
+ var _a;
59
+ return isDisabled.value ? "body" : ((_a = props.options) == null ? void 0 : _a.getContainer) || "body";
60
+ }
61
+ );
62
+ const visibleButtons = computed(
63
+ () => props.buttonList.filter((item) => item.hidden !== 1).filter((item) => !handleHidden(item))
64
+ );
65
+ const handleClick = async (item) => {
66
+ if (props.designState) return;
67
+ if (!item.onClick) {
68
+ emit("on-click", { item, result: true });
69
+ return;
70
+ }
71
+ if (item.loading) return;
72
+ item.loading = true;
73
+ try {
74
+ const result = await asyncExecuteFunction({
75
+ functionBody: item.onClick,
76
+ context: props.ctx,
77
+ params: props.scope
78
+ });
79
+ emit("on-click", { item, result });
80
+ } catch (error) {
81
+ console.error("Button click handler error:", error);
82
+ } finally {
83
+ item.loading = false;
84
+ }
85
+ };
86
+ const handleDisabled = (item) => {
87
+ if (!item.onDisabled) return false;
88
+ try {
89
+ const result = executeFunction({
90
+ functionBody: item.onDisabled,
91
+ context: props.ctx,
92
+ params: props.scope
93
+ });
94
+ if (typeof result === "boolean") {
95
+ return result;
96
+ } else {
97
+ return false;
98
+ }
99
+ } catch (error) {
100
+ console.error("Button disabled handler error:", error);
101
+ return false;
102
+ }
103
+ };
104
+ const handleHidden = (item) => {
105
+ if (!item.onHidden) return false;
106
+ try {
107
+ return executeFunction({
108
+ functionBody: item.onHidden,
109
+ context: props.ctx,
110
+ params: props.scope
111
+ });
112
+ } catch (error) {
113
+ console.error("Button hidden handler error:", error);
114
+ return false;
115
+ }
116
+ };
117
+ return {
118
+ getContainer,
119
+ isDisabled,
120
+ containerStyle,
121
+ visibleButtons,
122
+ handleClick,
123
+ handleDisabled
124
+ };
125
+ }
126
+ });
127
+ export {
128
+ _sfc_main as default
129
+ };
130
+ //# sourceMappingURL=ActionButtonListRender.vue2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButtonListRender.vue3.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 '@kp-ui/lowcode-core';\n import { ButtonPositionEnum } from '@kp-ui/lowcode-core';\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 ? 'body' : props.options?.getContainer || 'body'\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":["_createElementBlock","_normalizeClass","_normalizeStyle","_createBlock","_Teleport","_createVNode","_withCtx","_openBlock","_Fragment","_renderList","_createCommentVNode","_toDisplayString"],"mappings":";;;;;;;;sBACIA,mBA0BM,OAAA;AAAA,IAzBF,KAAI;AAAA,IACH,OAAKC,4CAA+B,KAAA,WAAW,CAAA;AAAA,IAC/C,OAAKC,eAAE,KAAA,cAAc;AAAA,EAAA,GAAA;AAAA,kBAEtBC,YAoBWC,UAAA;AAAA,MApBA,UAAU,KAAA;AAAA,MAAa,IAAI,KAAA;AAAA,IAAA,GAAA;AAAA,MAClCC,YAkBU,oBAAA,EAlBA,MAAM,EAAA,GAAC;AAAA,QAAA,SAAAC,QAET,MAA8B;AAAA,WAAAC,UAAA,IAAA,GADlCP,mBAgBWQ,UAAA,MAAAC,WAfQ,KAAA,gBAAc,CAAtB,SAAI;gCADfN,YAgBW,qBAAA;AAAA,cAdN,KAAK,KAAK;AAAA,cACV,MAAM,KAAK;AAAA,cACX,MAAM,KAAK;AAAA,cACX,QAAM,EAAI,KAAK;AAAA,cACf,OAAK,EAAI,KAAK;AAAA,cACf,OAAM;AAAA,cACL,SAAS,KAAK;AAAA,cACd,UAAU,KAAA,eAAe,IAAI,KAAK,KAAA,YAAQ,EAAM,KAAK;AAAA,cACrD,SAAK,CAAA,WAAE,KAAA,YAAY,IAAI;AAAA,YAAA,GAAA;AAAA,+BAExB,MAEW;AAAA,gBAFK,KAAK,qBACjBA,YAAuD,oBAAA;AAAA,kBAAA,KAAA;AAAA,kBAA7C,cAAY,KAAK;AAAA,kBAAM,OAAM;AAAA,gBAAA,GAAA,MAAA,GAAA,CAAA,YAAA,CAAA,KAAAO,mBAAA,IAAA,IAAA;AAAA,gCAChC,MACXC,gBAAG,KAAK,KAAK,GAAA,CAAA;AAAA,cAAA,CAAA;AAAA;;;;;;;;;;"}
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 '@kp-ui/lowcode-core';\n import { ButtonPositionEnum } from '@kp-ui/lowcode-core';\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 ? 'body' : props.options?.getContainer || 'body'\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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;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAER;AACJ,CAAC;"}
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, onMounted, createElementBlock, openBlock, createVNode, unref, withCtx, createElementVNode } from "vue";
2
2
  import { getLocat } from "@kp-ui/tool";
3
3
  import { TpfAddInfoLayout } from "tmgc2-share";
4
- import ActionButtonListRender from "../ActionButtonListRender.vue3.js";
4
+ import ActionButtonListRender from "../ActionButtonListRender.vue.js";
5
5
  import VFormRender from "../../render/index.vue.js";
6
6
  import { useLowcode } from "../../../../core/src/hooks/useLowcode.js";
7
7
  const _hoisted_1 = {
@@ -2,7 +2,7 @@ import { defineComponent, getCurrentInstance, useAttrs, ref, computed, onMounted
2
2
  import VFormRender from "../../render/index.vue.js";
3
3
  import { TpfConfigProvider, TpfModal } from "tmgc2-share";
4
4
  import { Skeleton } from "ant-design-vue";
5
- import ActionButtonListRender from "../ActionButtonListRender.vue3.js";
5
+ import ActionButtonListRender from "../ActionButtonListRender.vue.js";
6
6
  import { useLowcode } from "../../../../core/src/hooks/useLowcode.js";
7
7
  import { useI18n } from "../../../../core/src/utils/i18n.js";
8
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./DataTableColumnDialog.vue2.js";
2
2
  /* empty css */
3
3
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const DataTableColumnDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7ae2c55f"]]);
4
+ const DataTableColumnDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-30a82eb1"]]);
5
5
  export {
6
6
  DataTableColumnDialog as default
7
7
  };