@kp-ui/lowcode 2.16.2 → 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-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
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as J, computed as
|
|
1
|
+
import { defineComponent as J, computed as c, ref as u, onBeforeUnmount as P, createBlock as A, openBlock as U, unref as i, mergeProps as z, withCtx as x, createElementVNode as I, createVNode as C, nextTick as q } from "vue";
|
|
2
2
|
import { useExecFunction as G, TpfModal as K } from "tmgc2-share";
|
|
3
3
|
import { useLowcode as Q } from "../../hooks/useLowcode.js";
|
|
4
4
|
import { formatSize as h } from "../../utils/format.js";
|
|
@@ -47,14 +47,14 @@ const Y = { class: "dialog-content" }, ae = /* @__PURE__ */ J({
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
setup(n, { expose: O }) {
|
|
50
|
-
const t = n, R =
|
|
50
|
+
const t = n, R = c(() => h(t.options.height, "500px")), f = u(null), p = u(!1), s = u(!1), { context: r, asyncExecuteFunction: m, executeFunction: Z } = G(), { vfdRef: l, isLoading: v, getComponentJson: F } = Q({
|
|
51
51
|
formCode: t.options.formCode,
|
|
52
52
|
...t.vfCtx
|
|
53
|
-
}), D =
|
|
53
|
+
}), D = c(() => ({
|
|
54
54
|
...t.parentFormRef,
|
|
55
55
|
parentDom: r.value,
|
|
56
|
-
getParentFormRef:
|
|
57
|
-
})), k =
|
|
56
|
+
getParentFormRef: y
|
|
57
|
+
})), k = c(() => t.options.cancelButtonHidden && t.options.okButtonHidden ? { footer: null } : {});
|
|
58
58
|
P(() => {
|
|
59
59
|
var e, o;
|
|
60
60
|
console.log(t.parentFormRef), (o = (e = t.parentFormRef) == null ? void 0 : e.setChildFormRef) == null || o.call(e, null);
|
|
@@ -66,11 +66,11 @@ const Y = { class: "dialog-content" }, ae = /* @__PURE__ */ J({
|
|
|
66
66
|
}, j = () => {
|
|
67
67
|
s.value = !0;
|
|
68
68
|
}, E = async ({ result: e }) => {
|
|
69
|
-
e
|
|
69
|
+
console.log({ result: e }), e != !1 && await d();
|
|
70
70
|
}, L = () => {
|
|
71
71
|
s.value = !0, q(async () => {
|
|
72
72
|
var e, o, a;
|
|
73
|
-
(e = t.options) != null && e.readMode && ((o = l.value) == null || o.setReadMode(!0)), await F([], t.options.formCode), (a = l.value) == null || a.setDialogOrDrawerRef(r.value), t.parentFormRef && t.parentFormRef.setChildFormRef(l.value),
|
|
73
|
+
(e = t.options) != null && e.readMode && ((o = l.value) == null || o.setReadMode(!0)), await F([], t.options.formCode), (a = l.value) == null || a.setDialogOrDrawerRef(r.value), t.parentFormRef && t.parentFormRef.setChildFormRef(l.value), g();
|
|
74
74
|
});
|
|
75
75
|
}, b = async () => {
|
|
76
76
|
if (t.options.onDialogBeforeClose)
|
|
@@ -80,12 +80,12 @@ const Y = { class: "dialog-content" }, ae = /* @__PURE__ */ J({
|
|
|
80
80
|
s.value = !1;
|
|
81
81
|
}, d = () => {
|
|
82
82
|
b();
|
|
83
|
-
},
|
|
83
|
+
}, g = async () => {
|
|
84
84
|
if (t.options.onDialogOpened)
|
|
85
85
|
return await m({
|
|
86
86
|
functionBody: t.options.onDialogOpened
|
|
87
87
|
});
|
|
88
|
-
},
|
|
88
|
+
}, y = () => t.parentFormRef, T = () => {
|
|
89
89
|
var e, o, a;
|
|
90
90
|
(a = (o = (e = t.vfCtx) == null ? void 0 : e.parent) == null ? void 0 : o.exposed) != null && a.updateTable && t.vfCtx.parent.exposed.updateTable();
|
|
91
91
|
}, M = () => t.extraData, S = (e) => {
|
|
@@ -97,7 +97,7 @@ const Y = { class: "dialog-content" }, ae = /* @__PURE__ */ J({
|
|
|
97
97
|
return (e = l.value) == null ? void 0 : e.context;
|
|
98
98
|
};
|
|
99
99
|
return O({
|
|
100
|
-
getParentFormRef:
|
|
100
|
+
getParentFormRef: y,
|
|
101
101
|
getFormRef: V,
|
|
102
102
|
setDisabled: N,
|
|
103
103
|
setleftText: S,
|
|
@@ -107,7 +107,7 @@ const Y = { class: "dialog-content" }, ae = /* @__PURE__ */ J({
|
|
|
107
107
|
show: L,
|
|
108
108
|
close: b,
|
|
109
109
|
handleCloseEvent: d,
|
|
110
|
-
handleOpenedEvent:
|
|
110
|
+
handleOpenedEvent: g,
|
|
111
111
|
updateTable: T,
|
|
112
112
|
getExtraData: M
|
|
113
113
|
}), (e, o) => (U(), A(i(K), z({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-dialog.vue.js","sources":["../../../../src/components/form-render/dynamic-dialog.vue"],"sourcesContent":["<template>\n <TpfModal\n class=\"tpf-model design-model\"\n :destroyOnClose=\"true\"\n :title=\"options.title\"\n :bodyStyle=\"{\n height: dialogHeight,\n overflow: 'auto',\n ...JSON.parse(options.bodyStyle || '{}')\n }\"\n :centered=\"true\"\n v-model:visible=\"dialogVisible\"\n :width=\"formatSize(options.width)\"\n :mask=\"options.showModal\"\n :maskClosable=\"options.closeOnClickModal\"\n :keyboard=\"options.closeOnPressEscape\"\n @cancel=\"handleCloseEvent\"\n :left-num=\"leftNum\"\n v-bind=\"otherAttrs\"\n >\n <div class=\"dialog-content\">\n <VFormRender\n ref=\"vfdRef\"\n :loading=\"isLoading\"\n :vfCtx=\"{\n ...vfCtx,\n instance: context\n }\"\n :parent-form=\"parentForm\"\n :disabled-mode=\"options.disabledMode\"\n :dynamic-creation=\"true\"\n />\n </div>\n <template #footerRight>\n <ActionButtonListRender\n :buttonList=\"options.buttonList || []\"\n :ctx=\"getFormContext()\"\n @on-click=\"handleBtnClick\"\n :disabled=\"isDisabled\"\n />\n </template>\n </TpfModal>\n</template>\n\n<script lang=\"ts\" setup>\n import { ref, computed, nextTick, onBeforeUnmount } from 'vue';\n import { TpfModal, useExecFunction } from 'tmgc2-share';\n import { useLowcode } from '@/hooks/useLowcode';\n import { formatSize } from '@/utils/format';\n import VFormRender from '../FormRender/index.vue';\n import ActionButtonListRender from '@/components/public/ActionButtonListRender.vue';\n defineOptions({\n name: 'dynamic-dialog'\n });\n\n const props = defineProps({\n options: {\n type: Object,\n default: () => ({})\n },\n formJson: {\n type: Object\n },\n formData: {\n type: Object,\n default: () => ({})\n },\n vfCtx: {\n type: Object,\n default: () => ({})\n },\n optionData: {\n //prop传入的选项数据\n type: Object,\n default: () => ({})\n },\n globalDsv: {\n // 全局数据源变量\n type: Object,\n default: () => ({})\n },\n parentFormRef: {\n type: Object,\n default: null\n },\n extraData: {\n type: Object,\n default: () => ({})\n },\n wrapperId: {\n type: String,\n default: null\n }\n });\n\n const dialogHeight = computed(() => {\n return formatSize(props.options.height, '500px');\n });\n const leftNum = ref(null);\n\n const isDisabled = ref(false);\n const dialogVisible = ref(false);\n\n const { context, asyncExecuteFunction, executeFunction } = useExecFunction();\n const { vfdRef, isLoading, getComponentJson } = useLowcode({\n formCode: props.options.formCode,\n ...props.vfCtx\n });\n // 计算属性\n const parentForm = computed(() => {\n return {\n ...props.parentFormRef,\n parentDom: context.value,\n getParentFormRef\n };\n });\n\n const otherAttrs = computed(() => {\n if (props.options.cancelButtonHidden && props.options.okButtonHidden) {\n return { footer: null };\n }\n return {};\n });\n\n // 生命周期钩子\n onBeforeUnmount(() => {\n console.log(props.parentFormRef);\n props.parentFormRef?.setChildFormRef?.(null);\n });\n\n const setLoading = status => {\n isLoading.value = status;\n };\n\n const setTitle = title => {\n props.options.title = title;\n };\n\n const beforeOpen = () => {\n dialogVisible.value = true;\n };\n\n const handleBtnClick = async ({ result }: any) => {\n if (result !== false) {\n await handleCloseEvent();\n }\n };\n\n const show = () => {\n dialogVisible.value = true;\n\n //设置readMode模式\n nextTick(async () => {\n if (props.options?.readMode) {\n vfdRef.value?.setReadMode(true);\n }\n await getComponentJson([], props.options.formCode);\n vfdRef.value?.setDialogOrDrawerRef(context.value);\n if (props.parentFormRef) {\n props.parentFormRef.setChildFormRef(vfdRef.value);\n }\n handleOpenedEvent();\n });\n };\n\n const close = async () => {\n if (props.options.onDialogBeforeClose) {\n return await asyncExecuteFunction({\n functionBody: props.options.onDialogBeforeClose\n });\n }\n\n dialogVisible.value = false;\n };\n\n const handleCloseEvent = () => {\n close();\n };\n\n const handleOpenedEvent = async () => {\n if (props.options.onDialogOpened) {\n return await asyncExecuteFunction({\n functionBody: props.options.onDialogOpened\n });\n }\n };\n\n const getParentFormRef = () => {\n return props.parentFormRef;\n };\n\n const updateTable = () => {\n if (props.vfCtx?.parent?.exposed?.updateTable) {\n props.vfCtx.parent.exposed.updateTable();\n }\n };\n\n const getExtraData = () => {\n return props.extraData;\n };\n\n const setleftText = number => {\n leftNum.value = number;\n };\n\n const setDisabled = status => {\n isDisabled.value = status;\n };\n\n const getFormRef = () => {\n return vfdRef.value;\n };\n\n const getFormContext = () => {\n return vfdRef.value?.context;\n };\n\n // 暴露方法给父组件\n defineExpose({\n getParentFormRef,\n getFormRef,\n setDisabled,\n setleftText,\n setLoading,\n setTitle,\n beforeOpen,\n show,\n close,\n handleCloseEvent,\n handleOpenedEvent,\n updateTable,\n getExtraData\n });\n</script>\n\n<style lang=\"less\">\n .dialog-content {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 300px;\n }\n</style>\n"],"names":["props","__props","dialogHeight","computed","formatSize","leftNum","ref","isDisabled","dialogVisible","context","asyncExecuteFunction","executeFunction","useExecFunction","vfdRef","isLoading","getComponentJson","useLowcode","parentForm","getParentFormRef","otherAttrs","onBeforeUnmount","_b","_a","setLoading","status","setTitle","title","beforeOpen","handleBtnClick","result","handleCloseEvent","show","nextTick","_c","handleOpenedEvent","close","updateTable","getExtraData","setleftText","number","setDisabled","getFormRef","getFormContext","__expose","_openBlock","_createBlock","_unref","_mergeProps","$event","_createVNode","ActionButtonListRender","_createElementVNode","_hoisted_1","VFormRender"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDI,UAAMA,IAAQC,GAwCRC,IAAeC,EAAS,MACnBC,EAAWJ,EAAM,QAAQ,QAAQ,OAAO,CAClD,GACKK,IAAUC,EAAI,IAAI,GAElBC,IAAaD,EAAI,EAAK,GACtBE,IAAgBF,EAAI,EAAK,GAEzB,EAAE,SAAAG,GAAS,sBAAAC,GAAsB,iBAAAC,EAAA,IAAoBC,EAAA,GACrD,EAAE,QAAAC,GAAQ,WAAAC,GAAW,kBAAAC,EAAA,IAAqBC,EAAW;AAAA,MACvD,UAAUhB,EAAM,QAAQ;AAAA,MACxB,GAAGA,EAAM;AAAA,IAAA,CACZ,GAEKiB,IAAad,EAAS,OACjB;AAAA,MACH,GAAGH,EAAM;AAAA,MACT,WAAWS,EAAQ;AAAA,MACnB,kBAAAS;AAAA,IAAA,EAEP,GAEKC,IAAahB,EAAS,MACpBH,EAAM,QAAQ,sBAAsBA,EAAM,QAAQ,iBAC3C,EAAE,QAAQ,KAAA,IAEd,CAAA,CACV;AAGD,IAAAoB,EAAgB,MAAM;;AAClB,cAAQ,IAAIpB,EAAM,aAAa,IAC/BqB,KAAAC,IAAAtB,EAAM,kBAAN,gBAAAsB,EAAqB,oBAArB,QAAAD,EAAA,KAAAC,GAAuC;AAAA,IAC3C,CAAC;AAED,UAAMC,IAAa,CAAAC,MAAU;AACzB,MAAAV,EAAU,QAAQU;AAAA,IACtB,GAEMC,IAAW,CAAAC,MAAS;AACtB,MAAA1B,EAAM,QAAQ,QAAQ0B;AAAA,IAC1B,GAEMC,IAAa,MAAM;AACrB,MAAAnB,EAAc,QAAQ;AAAA,IAC1B,GAEMoB,IAAiB,OAAO,EAAE,QAAAC,QAAkB;AAC9C,MAAI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;AAAA,YAAA;AAAA,YAIrE,eAAaQ,EAAA;AAAA,YACb,iBAAehB,EAAA,QAAQ;AAAA,YACvB,oBAAkB;AAAA,UAAA;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"dynamic-dialog.vue.js","sources":["../../../../src/components/form-render/dynamic-dialog.vue"],"sourcesContent":["<template>\n <TpfModal\n class=\"tpf-model design-model\"\n :destroyOnClose=\"true\"\n :title=\"options.title\"\n :bodyStyle=\"{\n height: dialogHeight,\n overflow: 'auto',\n ...JSON.parse(options.bodyStyle || '{}')\n }\"\n :centered=\"true\"\n v-model:visible=\"dialogVisible\"\n :width=\"formatSize(options.width)\"\n :mask=\"options.showModal\"\n :maskClosable=\"options.closeOnClickModal\"\n :keyboard=\"options.closeOnPressEscape\"\n @cancel=\"handleCloseEvent\"\n :left-num=\"leftNum\"\n v-bind=\"otherAttrs\"\n >\n <div class=\"dialog-content\">\n <VFormRender\n ref=\"vfdRef\"\n :loading=\"isLoading\"\n :vfCtx=\"{\n ...vfCtx,\n instance: context\n }\"\n :parent-form=\"parentForm\"\n :disabled-mode=\"options.disabledMode\"\n :dynamic-creation=\"true\"\n />\n </div>\n <template #footerRight>\n <ActionButtonListRender\n :buttonList=\"options.buttonList || []\"\n :ctx=\"getFormContext()\"\n @on-click=\"handleBtnClick\"\n :disabled=\"isDisabled\"\n />\n </template>\n </TpfModal>\n</template>\n\n<script lang=\"ts\" setup>\n import { ref, computed, nextTick, onBeforeUnmount } from 'vue';\n import { TpfModal, useExecFunction } from 'tmgc2-share';\n import { useLowcode } from '@/hooks/useLowcode';\n import { formatSize } from '@/utils/format';\n import VFormRender from '../FormRender/index.vue';\n import ActionButtonListRender from '@/components/public/ActionButtonListRender.vue';\n defineOptions({\n name: 'dynamic-dialog'\n });\n\n const props = defineProps({\n options: {\n type: Object,\n default: () => ({})\n },\n formJson: {\n type: Object\n },\n formData: {\n type: Object,\n default: () => ({})\n },\n vfCtx: {\n type: Object,\n default: () => ({})\n },\n optionData: {\n //prop传入的选项数据\n type: Object,\n default: () => ({})\n },\n globalDsv: {\n // 全局数据源变量\n type: Object,\n default: () => ({})\n },\n parentFormRef: {\n type: Object,\n default: null\n },\n extraData: {\n type: Object,\n default: () => ({})\n },\n wrapperId: {\n type: String,\n default: null\n }\n });\n\n const dialogHeight = computed(() => {\n return formatSize(props.options.height, '500px');\n });\n const leftNum = ref(null);\n\n const isDisabled = ref(false);\n const dialogVisible = ref(false);\n\n const { context, asyncExecuteFunction, executeFunction } = useExecFunction();\n const { vfdRef, isLoading, getComponentJson } = useLowcode({\n formCode: props.options.formCode,\n ...props.vfCtx\n });\n // 计算属性\n const parentForm = computed(() => {\n return {\n ...props.parentFormRef,\n parentDom: context.value,\n getParentFormRef\n };\n });\n\n const otherAttrs = computed(() => {\n if (props.options.cancelButtonHidden && props.options.okButtonHidden) {\n return { footer: null };\n }\n return {};\n });\n\n // 生命周期钩子\n onBeforeUnmount(() => {\n console.log(props.parentFormRef);\n props.parentFormRef?.setChildFormRef?.(null);\n });\n\n const setLoading = status => {\n isLoading.value = status;\n };\n\n const setTitle = title => {\n props.options.title = title;\n };\n\n const beforeOpen = () => {\n dialogVisible.value = true;\n };\n\n const handleBtnClick = async ({ result }: any) => {\n console.log({ result });\n\n if (result == false) {\n return;\n }\n await handleCloseEvent();\n };\n\n const show = () => {\n dialogVisible.value = true;\n\n //设置readMode模式\n nextTick(async () => {\n if (props.options?.readMode) {\n vfdRef.value?.setReadMode(true);\n }\n await getComponentJson([], props.options.formCode);\n vfdRef.value?.setDialogOrDrawerRef(context.value);\n if (props.parentFormRef) {\n props.parentFormRef.setChildFormRef(vfdRef.value);\n }\n handleOpenedEvent();\n });\n };\n\n const close = async () => {\n if (props.options.onDialogBeforeClose) {\n return await asyncExecuteFunction({\n functionBody: props.options.onDialogBeforeClose\n });\n }\n\n dialogVisible.value = false;\n };\n\n const handleCloseEvent = () => {\n close();\n };\n\n const handleOpenedEvent = async () => {\n if (props.options.onDialogOpened) {\n return await asyncExecuteFunction({\n functionBody: props.options.onDialogOpened\n });\n }\n };\n\n const getParentFormRef = () => {\n return props.parentFormRef;\n };\n\n const updateTable = () => {\n if (props.vfCtx?.parent?.exposed?.updateTable) {\n props.vfCtx.parent.exposed.updateTable();\n }\n };\n\n const getExtraData = () => {\n return props.extraData;\n };\n\n const setleftText = number => {\n leftNum.value = number;\n };\n\n const setDisabled = status => {\n isDisabled.value = status;\n };\n\n const getFormRef = () => {\n return vfdRef.value;\n };\n\n const getFormContext = () => {\n return vfdRef.value?.context;\n };\n\n // 暴露方法给父组件\n defineExpose({\n getParentFormRef,\n getFormRef,\n setDisabled,\n setleftText,\n setLoading,\n setTitle,\n beforeOpen,\n show,\n close,\n handleCloseEvent,\n handleOpenedEvent,\n updateTable,\n getExtraData\n });\n</script>\n\n<style lang=\"less\">\n .dialog-content {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 300px;\n }\n</style>\n"],"names":["props","__props","dialogHeight","computed","formatSize","leftNum","ref","isDisabled","dialogVisible","context","asyncExecuteFunction","executeFunction","useExecFunction","vfdRef","isLoading","getComponentJson","useLowcode","parentForm","getParentFormRef","otherAttrs","onBeforeUnmount","_b","_a","setLoading","status","setTitle","title","beforeOpen","handleBtnClick","result","handleCloseEvent","show","nextTick","_c","handleOpenedEvent","close","updateTable","getExtraData","setleftText","number","setDisabled","getFormRef","getFormContext","__expose","_openBlock","_createBlock","_unref","_mergeProps","$event","_createVNode","ActionButtonListRender","_createElementVNode","_hoisted_1","VFormRender"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDI,UAAMA,IAAQC,GAwCRC,IAAeC,EAAS,MACnBC,EAAWJ,EAAM,QAAQ,QAAQ,OAAO,CAClD,GACKK,IAAUC,EAAI,IAAI,GAElBC,IAAaD,EAAI,EAAK,GACtBE,IAAgBF,EAAI,EAAK,GAEzB,EAAE,SAAAG,GAAS,sBAAAC,GAAsB,iBAAAC,EAAA,IAAoBC,E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B;AAAA,MAChB,OAAO9C,EAAA,QAAQ;AAAA,MACf,WAAS;AAAA,gBAAwBC,EAAA;AAAA;QAA2D,GAAA,KAAK,MAAMD,EAAA,QAAQ,aAAS,IAAA;AAAA,MAAA;AAAA,MAKxH,UAAU;AAAA,MACH,SAASO,EAAA;AAAA,iDAAAA,EAAa,QAAAwC;AAAA,MAC7B,OAAOF,EAAA1C,CAAA,EAAWH,EAAA,QAAQ,KAAK;AAAA,MAC/B,MAAMA,EAAA,QAAQ;AAAA,MACd,cAAcA,EAAA,QAAQ;AAAA,MACtB,UAAUA,EAAA,QAAQ;AAAA,MAClB,UAAQ6B;AAAA,MACR,YAAUzB,EAAA;AAAA,IAAA,GACHc,EAAA,KAAU,GAAA;AAAA,MAeP,eACP,MAKE;AAAA,QALF8B,EAKEC,GAAA;AAAA,UAJG,YAAYjD,EAAA,QAAQ,cAAU,CAAA;AAAA,UAC9B,KAAKyC,EAAA;AAAA,UACL,WAAUd;AAAA,UACV,UAAUrB,EAAA;AAAA,QAAA;;iBAlBnB,MAYM;AAAA,QAZN4C,EAYM,OAZNC,GAYM;AAAA,UAXFH,EAUEI,GAAA;AAAA,qBATM;AAAA,YAAJ,KAAIxC;AAAA,YACH,SAASiC,EAAAhC,CAAA;AAAA,YACT,OAAK;AAAA,iBAA2Bb,EAAA;AAAA,wBAAqC6C,EAAArC,CAAA;AAAA,YAAA;AAAA,YAIrE,eAAaQ,EAAA;AAAA,YACb,iBAAehB,EAAA,QAAQ;AAAA,YACvB,oBAAkB;AAAA,UAAA;;;;;;;"}
|
|
@@ -42,7 +42,7 @@ function h(o, v, z, B, S, $) {
|
|
|
42
42
|
], 8, ["disabled", "to"]))
|
|
43
43
|
], 6);
|
|
44
44
|
}
|
|
45
|
-
const L = /* @__PURE__ */ m(c, [["render", h], ["__scopeId", "data-v-
|
|
45
|
+
const L = /* @__PURE__ */ m(c, [["render", h], ["__scopeId", "data-v-ba25e584"]]);
|
|
46
46
|
export {
|
|
47
47
|
L as default
|
|
48
48
|
};
|
|
@@ -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 '@/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.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 '@/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":["_createElementBlock","_normalizeClass","_ctx","_normalizeStyle","_createBlock","_Teleport","_createVNode","_component_a_space","_withCtx","_openBlock","_Fragment","_renderList","item","_component_a_button","$event","_component_SvgIcon","_createCommentVNode","_toDisplayString"],"mappings":";;;;;;cACIA,EA0BM,OAAA;AAAA,IAzBF,KAAI;AAAA,IACH,OAAKC,+BAA+BC,EAAA,WAAW,CAAA;AAAA,IAC/C,OAAKC,EAAED,EAAA,cAAc;AAAA,EAAA,GAAA;AAAA,UAEtBE,EAoBWC,GAAA;AAAA,MApBA,UAAUH,EAAA;AAAA,MAAa,IAAIA,EAAA;AAAA,IAAA,GAAA;AAAA,MAClCI,EAkBUC,GAAA,EAlBA,MAAM,EAAA,GAAC;AAAA,QAAA,SAAAC,EAET,MAA8B;AAAA,WAAAC,EAAA,EAAA,GADlCT,EAgBWU,GAAA,MAAAC,EAfQT,EAAA,gBAAc,CAAtBU,YADXR,EAgBWS,GAAA;AAAA,YAdN,KAAKD,EAAK;AAAA,YACV,MAAMA,EAAK;AAAA,YACX,MAAMA,EAAK;AAAA,YACX,QAAM,EAAIA,EAAK;AAAA,YACf,OAAK,EAAIA,EAAK;AAAA,YACf,OAAM;AAAA,YACL,SAASA,EAAK;AAAA,YACd,UAAUV,EAAA,eAAeU,CAAI,KAAKV,EAAA,YAAQ,EAAMU,EAAK;AAAA,YACrD,SAAK,CAAAE,MAAEZ,EAAA,YAAYU,CAAI;AAAA,UAAA,GAAA;AAAA,uBAExB,MAEW;AAAA,cAFKA,EAAK,aACjBR,EAAuDW,GAAA;AAAA,gBAAA,KAAA;AAAA,gBAA7C,cAAYH,EAAK;AAAA,gBAAM,OAAM;AAAA,cAAA,GAAA,MAAA,GAAA,CAAA,YAAA,CAAA,KAAAI,EAAA,IAAA,EAAA;AAAA,gBAChC,MACXC,EAAGL,EAAK,KAAK,GAAA,CAAA;AAAA,YAAA,CAAA;AAAA;;;;;;;;;"}
|
|
@@ -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,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,CAAC,UAAU;AAAA,EAClB,MAAMC,GAAO,EAAE,MAAAC,KAAQ;AACnB,UAAMC,IAAiBC,EAAS,OAAO;AAAA,MACnC,UAAUH,EAAM;AAAA,IAAA,EAClB,GAEI,EAAE,iBAAAI,GAAiB,sBAAAC,EAAA,IAAyBC,EAAA,GAE5CC,IAAaJ;AAAA,MACf,MAAA;;AAAM,iBAAAK,IAAAR,EAAM,YAAN,gBAAAQ,EAAe,oBAAmBC,EAAmB,OAAOT,EAAM;AAAA;AAAA,IAAA,GAGtEU,IAAeP;AAAA,MAAS,MAAA;;AAC1B,eAAAI,EAAW,QAAQ,QAAOC,IAAAR,EAAM,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