@gct-paas/core-web 0.1.6-dev.17 → 0.1.6-dev.19
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/dist/{JsBarcode-hbJ0aUTj.js → JsBarcode-nqhcZPvn.js} +2 -2
- package/dist/{_plugin-vue_export-helper-B8JDTS5A.js → _plugin-vue_export-helper-CyelNe0I.js} +2 -2
- package/dist/{chunk-FrdinjiM.js → chunk-C9ZKDnvz.js} +1 -1
- package/dist/components-DtFY5KCF.js +2 -0
- package/dist/{cropper-kXOaEuXy.js → cropper-BuY_n52N.js} +2 -2
- package/dist/{de_DE-CMOqPpMk.js → de_DE-B3kLT_zG.js} +2 -2
- package/dist/{defineProperty-DAxeR2uH.js → defineProperty-DiReHMuo.js} +1 -1
- package/dist/{diagram-config-item-DUh3mUtV.js → diagram-config-item-DYCiDqAy.js} +2 -2
- package/dist/{diagram-config-item-reverse-C-lK_M8W.js → diagram-config-item-reverse-BKf_yXvB.js} +2 -2
- package/dist/{diagram-config-item-virtual-2m1EFdOj.js → diagram-config-item-virtual-Dw36zOeJ.js} +2 -2
- package/dist/{en_US-DW_aBniN.js → en_US-tZ7NgN80.js} +2 -2
- package/dist/{es_ES-Bog1JAla.js → es_ES-DY2QXYwT.js} +2 -2
- package/dist/{fr_FR-B88CF-a2.js → fr_FR-DbN-1gO0.js} +2 -2
- package/dist/{hooks-xq807tVG.js → hooks-BuOffqGU.js} +2 -2
- package/dist/{icon-next-picker-COelGwZZ.js → icon-next-picker-BmnIn29K.js} +1 -1
- package/dist/index.min.css +1 -1
- package/dist/{ja_JP-DQorABU8.js → ja_JP-BRcXbHEH.js} +2 -2
- package/dist/loader.esm.min.js +2 -2
- package/dist/{monaco-editor-C9gHdPuf.js → monaco-editor-CHnBEX6V.js} +2 -2
- package/dist/{objectSpread2-DPfqyX1h.js → objectSpread2-BHKS0stT.js} +1 -1
- package/dist/{overlayscrollbars-vue-DMDFLsJ4.js → overlayscrollbars-vue-Cc8URtSg.js} +1 -1
- package/dist/{pt_PT-fO3ABuZp.js → pt_PT-DjiZFPmH.js} +2 -2
- package/dist/{relationship-diagram-config-D7HC1Hk4.js → relationship-diagram-config-BwVOMUAb.js} +2 -2
- package/dist/{rich-editor-BYF_B5mz.js → rich-editor-DfsJmv_B.js} +2 -2
- package/dist/{ru_RU-DqC5EhBW.js → ru_RU-Dw9N99Ox.js} +2 -2
- package/dist/template-D-UpvSne.js +2 -0
- package/dist/{tr_TR-Dau_nW2e.js → tr_TR-DCCv6rhK.js} +2 -2
- package/dist/{useMonacoEditor-Zk3dJDl-.js → useMonacoEditor-C3S2BSui.js} +2 -2
- package/dist/{vi_VN-BWVyxMZC.js → vi_VN-BNMXRAom.js} +2 -2
- package/dist/{zh_CN-CwWZ2JFL.js → zh_CN-ywcxTWfr.js} +2 -2
- package/dist/{zh_TW-NtzRUp8G.js → zh_TW-DL4FRJVy.js} +2 -2
- package/es/components/UserPick/src/user-pick.vue_vue_type_script_setup_true_lang.mjs +3 -3
- package/es/components/app-drawer/app-drawer-component.css +82 -0
- package/es/components/app-drawer/app-drawer-component.d.ts +26 -0
- package/es/components/app-drawer/app-drawer-component.mjs +84 -0
- package/es/components/batch-select-list/batch-select-list.css +119 -0
- package/es/components/batch-select-list/batch-select-list.d.ts +158 -0
- package/es/components/batch-select-list/batch-select-list.mjs +133 -0
- package/es/components/data-rules-modal/data-rules-modal.d.ts +67 -0
- package/es/components/data-rules-modal/data-rules-modal.mjs +99 -0
- package/es/components/design-save-tip/design-save-tip.css +107 -0
- package/es/components/design-save-tip/design-save-tip.d.ts +44 -0
- package/es/components/design-save-tip/design-save-tip.mjs +81 -0
- package/es/components/design-step-check/design-step-check.css +133 -0
- package/es/components/design-step-check/design-step-check.d.ts +30 -0
- package/es/components/design-step-check/design-step-check.mjs +96 -0
- package/es/components/design-view-layout/design-view-layout.css +157 -0
- package/es/components/design-view-layout/design-view-layout.d.ts +1 -0
- package/es/components/design-view-layout/design-view-layout.mjs +140 -0
- package/es/components/field-cascader/index.d.ts +2 -1
- package/es/components/index.d.ts +10 -2
- package/es/components/index.mjs +26 -0
- package/es/components/label-design/designer.vue.d.ts +2 -0
- package/es/components/label-design/designer.vue.mjs +7 -0
- package/es/components/label-design/designer.vue_vue_type_script_setup_true_lang.mjs +32 -0
- package/es/components/label-design/designer.vue_vue_type_style_index_0_scoped_260222c9_lang.css +32 -0
- package/es/components/label-design/header/header.vue.d.ts +6 -0
- package/es/components/label-design/header/header.vue.mjs +7 -0
- package/es/components/label-design/header/header.vue_vue_type_script_setup_true_lang.mjs +232 -0
- package/es/components/label-design/header/header.vue_vue_type_style_index_0_scoped_aa2b4235_lang.css +39 -0
- package/es/components/label-design/header/test-var-modal.vue.d.ts +204 -0
- package/es/components/label-design/header/test-var-modal.vue.mjs +7 -0
- package/es/components/label-design/header/test-var-modal.vue_vue_type_script_setup_true_lang.mjs +202 -0
- package/es/components/label-design/header/test-var-modal.vue_vue_type_style_index_0_scoped_972496bb_lang.css +69 -0
- package/es/components/label-design/index.d.ts +11 -1
- package/es/components/label-design/index.mjs +9 -0
- package/es/components/label-design/modal/template.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/es/components/label-design/panels/panel.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/es/components/label-design/panels/widget/components/label-params-select.vue.d.ts +35 -0
- package/es/components/label-design/panels/widget/controls/VariableSelect.vue_vue_type_script_setup_true_name_variable-select_lang.mjs +1 -1
- package/es/components/label-design/stage/stage.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/es/components/label-design/type/index.d.ts +15 -0
- package/es/components/label-design/type/index.mjs +11 -0
- package/es/components/modal-name-editor/modal-name-editor.css +117 -0
- package/es/components/modal-name-editor/modal-name-editor.d.ts +34 -0
- package/es/components/modal-name-editor/modal-name-editor.mjs +124 -0
- package/es/components/shrink-panel/shrink-panel.css +130 -0
- package/es/components/shrink-panel/shrink-panel.d.ts +23 -0
- package/es/components/shrink-panel/shrink-panel.mjs +41 -0
- package/es/components/ui/basic-grid/basic-grid.vue.d.ts +81 -0
- package/es/components/ui/basic-grid/basic-grid.vue.mjs +7 -0
- package/es/components/ui/basic-grid/basic-grid.vue_vue_type_script_setup_true_name_basic-grid_lang.mjs +134 -0
- package/es/components/ui/basic-grid/basic-grid.vue_vue_type_style_index_0_scoped_e9d09c1d_lang.css +90 -0
- package/es/components/ui/basic-grid/index.d.ts +3 -0
- package/es/components/ui/basic-grid/index.mjs +1 -0
- package/es/components/ui/basic-grid/types.d.ts +6 -0
- package/es/components/ui/embed-grid/embed-grid.vue.d.ts +62 -0
- package/es/components/ui/embed-grid/embed-grid.vue.mjs +7 -0
- package/es/components/ui/embed-grid/embed-grid.vue_vue_type_script_setup_true_name_embed-grid_lang.mjs +73 -0
- package/es/components/ui/embed-grid/index.d.ts +3 -0
- package/es/components/ui/embed-grid/index.mjs +1 -0
- package/es/components/ui/embed-grid/types.d.ts +5 -0
- package/es/components/ui/form-alert/form-alert.vue.d.ts +10 -0
- package/es/components/ui/form-alert/form-alert.vue.mjs +7 -0
- package/es/components/ui/form-alert/form-alert.vue_vue_type_script_setup_true_name_form-alert_lang.mjs +31 -0
- package/es/components/ui/form-alert/form-alert.vue_vue_type_style_index_0_scoped_a6bdad9c_lang.css +64 -0
- package/es/components/ui/grid-btns/grid-btns.vue.d.ts +2 -0
- package/es/components/ui/grid-btns/grid-btns.vue.mjs +7 -0
- package/es/components/ui/grid-btns/grid-btns.vue_vue_type_script_setup_true_name_grid-btns_lang.mjs +15 -0
- package/es/components/ui/grid-btns/grid-btns.vue_vue_type_style_index_0_scoped_e3385a9e_lang.css +70 -0
- package/es/components/ui/grid-pagination/grid-pagination.vue.d.ts +12 -0
- package/es/components/ui/grid-pagination/grid-pagination.vue.mjs +7 -0
- package/es/components/ui/grid-pagination/grid-pagination.vue_vue_type_script_setup_true_name_grid-pagination_lang.mjs +57 -0
- package/es/components/ui/grid-pagination/grid-pagination.vue_vue_type_style_index_0_scoped_4905eabf_lang.css +68 -0
- package/es/components/ui/grid-pagination/index.d.ts +3 -0
- package/es/components/ui/grid-pagination/index.mjs +1 -0
- package/es/components/ui/grid-pagination/types.d.ts +24 -0
- package/es/components/ui/highlight/highlight.vue.d.ts +6 -0
- package/es/components/ui/highlight/highlight.vue.mjs +7 -0
- package/es/components/ui/highlight/highlight.vue_vue_type_script_setup_true_name_highlight_lang.mjs +30 -0
- package/es/components/ui/highlight/highlight.vue_vue_type_style_index_0_scoped_e17c6606_lang.css +6 -0
- package/es/components/ui/icon-tooltip/icon-tooltip.vue.d.ts +10 -0
- package/es/components/ui/icon-tooltip/icon-tooltip.vue.mjs +7 -0
- package/es/components/ui/icon-tooltip/icon-tooltip.vue_vue_type_script_setup_true_name_icon-tooltip_lang.mjs +27 -0
- package/es/components/ui/icon-tooltip/icon-tooltip.vue_vue_type_style_index_0_scoped_a35580e4_lang.css +68 -0
- package/es/components/ui/index.d.ts +10 -0
- package/es/components/ui/index.mjs +12 -0
- package/es/components/ui/modal-wrapper/modal-wrapper.vue.d.ts +26 -0
- package/es/components/ui/modal-wrapper/modal-wrapper.vue.mjs +7 -0
- package/es/components/ui/modal-wrapper/modal-wrapper.vue_vue_type_script_setup_true_name_modal-wrapper_lang.mjs +78 -0
- package/es/components/ui/modal-wrapper/modal-wrapper.vue_vue_type_style_index_0_scoped_6b8a9609_lang.css +28 -0
- package/es/components/ui/notice/index.d.ts +8 -0
- package/es/components/ui/notice/index.mjs +31 -0
- package/es/create-app-vue.mjs +1 -1
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.mjs +1 -0
- package/es/hooks/usePrinter.d.ts +19 -0
- package/es/hooks/usePrinter.mjs +50 -0
- package/es/index.mjs +30 -3
- package/es/interface/i-view-step/i-view-step.d.ts +32 -0
- package/es/interface/index.d.ts +1 -0
- package/es/modules/category/category-sider.vue.d.ts +1 -1
- package/es/modules/category/category-sider.vue.mjs +2 -2
- package/es/modules/category/{category-sider.vue_vue_type_style_index_0_scoped_5b8c3a8d_lang.css → category-sider.vue_vue_type_style_index_0_scoped_2ad0d132_lang.css} +33 -33
- package/es/modules/color-picker/index.mjs +1 -1
- package/es/modules/gct-form/controller/editor-item/editor-item.controller.d.ts +1 -0
- package/es/modules/gct-form/controller/editor-item/editor-item.controller.mjs +11 -0
- package/es/modules/gct-form/editor/gct-form-date-range/form-date-range.css +67 -0
- package/es/modules/gct-form/editor/gct-form-date-range/form-date-range.d.ts +50 -0
- package/es/modules/gct-form/editor/gct-form-date-range/form-date-range.mjs +61 -0
- package/es/modules/gct-form/editor/gct-form-date-range/form-date-range.provider.d.ts +13 -0
- package/es/modules/gct-form/editor/gct-form-date-range/form-date-range.provider.mjs +15 -0
- package/es/modules/gct-form/editor/gct-form-date-range/index.d.ts +4 -0
- package/es/modules/gct-form/editor/gct-form-date-range/index.mjs +8 -0
- package/es/modules/gct-form/editor/gct-form-select/gct-form-select.mjs +1 -1
- package/es/modules/gct-form/editor/index.mjs +2 -1
- package/es/modules/gct-form/hooks/index.d.ts +1 -0
- package/es/modules/gct-form/hooks/index.mjs +1 -0
- package/es/modules/gct-form/hooks/use-form-value/use-form-value.d.ts +11 -0
- package/es/modules/gct-form/hooks/use-form-value/use-form-value.mjs +27 -0
- package/es/modules/gct-form/index.mjs +3 -0
- package/es/modules/gct-form/widgets/gct-search-form/form/app-form.css +70 -0
- package/es/modules/gct-form/widgets/gct-search-form/form/app-form.d.ts +22 -0
- package/es/modules/gct-form/widgets/gct-search-form/form/app-form.mjs +106 -0
- package/es/modules/gct-form/widgets/gct-search-form/form-item/form-item.css +73 -0
- package/es/modules/gct-form/widgets/gct-search-form/form-item/form-item.d.ts +15 -0
- package/es/modules/gct-form/widgets/gct-search-form/form-item/form-item.mjs +22 -0
- package/es/modules/gct-form/widgets/gct-search-form/form.controller.d.ts +46 -0
- package/es/modules/gct-form/widgets/gct-search-form/form.controller.mjs +69 -0
- package/es/modules/gct-form/widgets/gct-search-form/form.state.d.ts +10 -0
- package/es/modules/gct-form/widgets/gct-search-form/form.state.mjs +13 -0
- package/es/modules/gct-form/widgets/gct-search-form/gct-search-form.css +83 -0
- package/es/modules/gct-form/widgets/gct-search-form/gct-search-form.d.ts +33 -0
- package/es/modules/gct-form/widgets/gct-search-form/gct-search-form.mjs +56 -0
- package/es/modules/global-modal/src/components/ModalWrapper.vue_vue_type_script_lang.mjs +1 -1
- package/es/types/index.d.ts +1 -1
- package/es/utils/overlay-controller/overlay-controller.d.ts +3 -1
- package/es/utils/overlay-controller/overlay-controller.mjs +9 -0
- package/package.json +12 -8
- package/dist/ColorPicker-BGXmyt7q.js +0 -2
- package/dist/template-DwBghb9z.js +0 -2
package/es/components/label-design/header/test-var-modal.vue_vue_type_script_setup_true_lang.mjs
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { useDesigner } from "../hooks/useDesigner.mjs";
|
|
2
|
+
import { GctOverlayScrollbars } from "../../overlay-scrollbars/gct-overlay-scrollbars.mjs";
|
|
3
|
+
import stage_canvas_default from "../stage/stage-canvas.vue.mjs";
|
|
4
|
+
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, resolveComponent, toDisplayString, unref, withCtx } from "vue";
|
|
5
|
+
import { cloneDeep } from "lodash-es";
|
|
6
|
+
import { t, useModal } from "@gct-paas/core";
|
|
7
|
+
//#region src/components/label-design/header/test-var-modal.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var _hoisted_1 = { class: "flex h100% w100% print" };
|
|
9
|
+
var _hoisted_2 = { class: "left flex flex-col" };
|
|
10
|
+
var _hoisted_3 = { class: "left-title" };
|
|
11
|
+
var _hoisted_4 = { class: "right" };
|
|
12
|
+
var _hoisted_5 = { class: "right-title" };
|
|
13
|
+
var test_var_modal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
14
|
+
__name: "test-var-modal",
|
|
15
|
+
props: {
|
|
16
|
+
modal: {},
|
|
17
|
+
fieldConfig: {},
|
|
18
|
+
data: {}
|
|
19
|
+
},
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const { hoveredElements, updateEgglement } = useDesigner();
|
|
22
|
+
const selectItem = ref([]);
|
|
23
|
+
const hoverItem = ref([]);
|
|
24
|
+
const containerRef = ref(null);
|
|
25
|
+
const canvasRef = ref(null);
|
|
26
|
+
const canvasSize = ref({
|
|
27
|
+
width: 0,
|
|
28
|
+
height: 0
|
|
29
|
+
});
|
|
30
|
+
const containerSize = ref({
|
|
31
|
+
width: 0,
|
|
32
|
+
height: 0
|
|
33
|
+
});
|
|
34
|
+
const FormRef = ref();
|
|
35
|
+
const varMap = ref({});
|
|
36
|
+
const defProps = __props;
|
|
37
|
+
const schema = ref();
|
|
38
|
+
const handleOk = async () => {
|
|
39
|
+
try {
|
|
40
|
+
await FormRef.value?.validate();
|
|
41
|
+
return {
|
|
42
|
+
ok: true,
|
|
43
|
+
data: { ...varMap.value }
|
|
44
|
+
};
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.warn(err);
|
|
47
|
+
}
|
|
48
|
+
return { ok: false };
|
|
49
|
+
};
|
|
50
|
+
const changeMap = async (value, id) => {
|
|
51
|
+
schema.value?.forEach((i) => {
|
|
52
|
+
if (i.type === "TEXT" && i.id === id) {
|
|
53
|
+
i.attrs.text.label = value;
|
|
54
|
+
i.attrs.text.value = value;
|
|
55
|
+
} else if (i.id === id) i.attrs.content.value = value;
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const updatePBarcodeWidth = (payload) => {
|
|
59
|
+
const egglement = schema.value?.find((d) => d.id === payload.elId);
|
|
60
|
+
if (!egglement) return;
|
|
61
|
+
if (egglement.rotate === 90) if (payload.height !== egglement.height) updateEgglement({
|
|
62
|
+
egglement,
|
|
63
|
+
width: payload.rotateWidth,
|
|
64
|
+
height: payload.width
|
|
65
|
+
});
|
|
66
|
+
else console.log("高度不变");
|
|
67
|
+
else if (payload.width !== egglement.width) updateEgglement({
|
|
68
|
+
egglement,
|
|
69
|
+
width: payload.width
|
|
70
|
+
});
|
|
71
|
+
else console.log("长度不变");
|
|
72
|
+
};
|
|
73
|
+
const updatePQrCodeWidthAndHeight = (payload) => {
|
|
74
|
+
const egglement = schema.value?.find((d) => d.id === payload.elId);
|
|
75
|
+
if (!egglement) return;
|
|
76
|
+
if (egglement.rotate === 90) if (payload.height !== egglement.height || payload.width !== egglement.width) updateEgglement({
|
|
77
|
+
egglement,
|
|
78
|
+
width: payload.rotateWidth,
|
|
79
|
+
height: payload.rotateHeight
|
|
80
|
+
});
|
|
81
|
+
else console.log("高度不变");
|
|
82
|
+
else if (payload.width !== egglement.width || payload.height !== egglement.height) updateEgglement({
|
|
83
|
+
egglement,
|
|
84
|
+
width: payload.width,
|
|
85
|
+
height: payload.height
|
|
86
|
+
});
|
|
87
|
+
else console.log("长度不变");
|
|
88
|
+
};
|
|
89
|
+
const focus = (id) => {
|
|
90
|
+
selectItem.value = schema.value?.filter((i) => i.id === id) ?? [];
|
|
91
|
+
hoveredElements.value = [...selectItem.value, ...hoverItem.value];
|
|
92
|
+
};
|
|
93
|
+
const blur = () => {
|
|
94
|
+
selectItem.value = [];
|
|
95
|
+
hoveredElements.value = [...hoverItem.value];
|
|
96
|
+
};
|
|
97
|
+
const mouseenter = (id) => {
|
|
98
|
+
hoverItem.value = schema.value?.filter((i) => i.id === id) ?? [];
|
|
99
|
+
hoveredElements.value = [...selectItem.value, ...hoverItem.value];
|
|
100
|
+
};
|
|
101
|
+
const mouseleave = () => {
|
|
102
|
+
hoverItem.value = [];
|
|
103
|
+
hoveredElements.value = [...selectItem.value];
|
|
104
|
+
};
|
|
105
|
+
useModal(handleOk);
|
|
106
|
+
const canvasStyle = computed(() => {
|
|
107
|
+
if (!canvasSize.value.width || !canvasSize.value.height || !containerSize.value.width || !containerSize.value.height) return {};
|
|
108
|
+
const scaleX = containerSize.value.width / canvasSize.value.width;
|
|
109
|
+
const scaleY = containerSize.value.height / canvasSize.value.height;
|
|
110
|
+
const scale = Math.min(scaleX, scaleY);
|
|
111
|
+
return {
|
|
112
|
+
transform: `translate(${(containerSize.value.width - canvasSize.value.width * scale) / 2}px, ${(containerSize.value.height - canvasSize.value.height * scale) / 2}px) scale(${scale})`,
|
|
113
|
+
transformOrigin: "top left",
|
|
114
|
+
width: `${canvasSize.value.width}px`,
|
|
115
|
+
height: `${canvasSize.value.height}px`
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
onMounted(() => {
|
|
119
|
+
schema.value = cloneDeep(defProps.data);
|
|
120
|
+
if (canvasRef.value) canvasSize.value = {
|
|
121
|
+
width: canvasRef.value.$el?.offsetWidth || 0,
|
|
122
|
+
height: canvasRef.value.$el?.offsetHeight || 0
|
|
123
|
+
};
|
|
124
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
125
|
+
for (const entry of entries) {
|
|
126
|
+
const { width, height } = entry.contentRect;
|
|
127
|
+
containerSize.value.width = width;
|
|
128
|
+
containerSize.value.height = height;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
if (containerRef.value) resizeObserver.observe(containerRef.value);
|
|
132
|
+
onUnmounted(() => {
|
|
133
|
+
resizeObserver.disconnect();
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
return (_ctx, _cache) => {
|
|
137
|
+
const _component_a_input = resolveComponent("a-input");
|
|
138
|
+
const _component_a_form_item = resolveComponent("a-form-item");
|
|
139
|
+
const _component_a_form = resolveComponent("a-form");
|
|
140
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, toDisplayString(unref(t)("sys.inputVar")), 1), createVNode(unref(GctOverlayScrollbars), null, {
|
|
141
|
+
default: withCtx(() => [createVNode(_component_a_form, {
|
|
142
|
+
ref_key: "FormRef",
|
|
143
|
+
ref: FormRef,
|
|
144
|
+
model: varMap.value,
|
|
145
|
+
autocomplete: "off",
|
|
146
|
+
layout: "vertical"
|
|
147
|
+
}, {
|
|
148
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(defProps.fieldConfig, (item) => {
|
|
149
|
+
return openBlock(), createBlock(_component_a_form_item, {
|
|
150
|
+
key: item.key,
|
|
151
|
+
label: unref(t)(item.label),
|
|
152
|
+
name: item.key,
|
|
153
|
+
class: normalizeClass(["var-item", { selected: selectItem.value[0]?.id === item.key }]),
|
|
154
|
+
required: "",
|
|
155
|
+
onMouseenter: ($event) => mouseenter(item.key),
|
|
156
|
+
onMouseleave: mouseleave
|
|
157
|
+
}, {
|
|
158
|
+
default: withCtx(() => [createVNode(_component_a_input, {
|
|
159
|
+
value: varMap.value[item.key],
|
|
160
|
+
"onUpdate:value": ($event) => varMap.value[item.key] = $event,
|
|
161
|
+
placeholder: unref(t)("sys.inputText"),
|
|
162
|
+
onFocus: ($event) => focus(item.key),
|
|
163
|
+
onBlur: blur,
|
|
164
|
+
onChange: ($event) => changeMap(varMap.value[item.key], item.key)
|
|
165
|
+
}, null, 8, [
|
|
166
|
+
"value",
|
|
167
|
+
"onUpdate:value",
|
|
168
|
+
"placeholder",
|
|
169
|
+
"onFocus",
|
|
170
|
+
"onChange"
|
|
171
|
+
])]),
|
|
172
|
+
_: 2
|
|
173
|
+
}, 1032, [
|
|
174
|
+
"label",
|
|
175
|
+
"name",
|
|
176
|
+
"class",
|
|
177
|
+
"onMouseenter"
|
|
178
|
+
]);
|
|
179
|
+
}), 128))]),
|
|
180
|
+
_: 1
|
|
181
|
+
}, 8, ["model"])]),
|
|
182
|
+
_: 1
|
|
183
|
+
})]), createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, toDisplayString(unref(t)("sys.simulatedPreview")), 1), createElementVNode("div", {
|
|
184
|
+
ref_key: "containerRef",
|
|
185
|
+
ref: containerRef,
|
|
186
|
+
class: "canvas-container"
|
|
187
|
+
}, [createVNode(stage_canvas_default, {
|
|
188
|
+
ref_key: "canvasRef",
|
|
189
|
+
ref: canvasRef,
|
|
190
|
+
schema: schema.value,
|
|
191
|
+
style: normalizeStyle([{
|
|
192
|
+
"pointer-events": "none",
|
|
193
|
+
"user-select": "none"
|
|
194
|
+
}, canvasStyle.value]),
|
|
195
|
+
onUpdatePBarcodeWidth: updatePBarcodeWidth,
|
|
196
|
+
onUpdatePQrCodeWidthAndHeight: updatePQrCodeWidthAndHeight
|
|
197
|
+
}, null, 8, ["schema", "style"])], 512)])]);
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
//#endregion
|
|
202
|
+
export { test_var_modal_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.print[data-v-972496bb] {
|
|
2
|
+
min-width: 0;
|
|
3
|
+
/* 重要:防止 flex 子项溢出 */
|
|
4
|
+
min-height: 0;
|
|
5
|
+
/* 重要:防止 flex 子项溢出 */
|
|
6
|
+
}
|
|
7
|
+
.left[data-v-972496bb] {
|
|
8
|
+
width: 288px;
|
|
9
|
+
min-width: 288px;
|
|
10
|
+
padding: 12px 0 12px 12px;
|
|
11
|
+
border-right: 1px solid #e0e3eb;
|
|
12
|
+
}
|
|
13
|
+
.left .left-title[data-v-972496bb] {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
margin: 12px 0;
|
|
17
|
+
color: #1a1d23;
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
}
|
|
21
|
+
.left .left-title[data-v-972496bb]::before {
|
|
22
|
+
content: '';
|
|
23
|
+
display: inline-block;
|
|
24
|
+
width: 3px;
|
|
25
|
+
height: 14px;
|
|
26
|
+
margin-right: 8px;
|
|
27
|
+
margin-left: 12px;
|
|
28
|
+
background: var(--ant-primary-color);
|
|
29
|
+
color: var(--ant-primary-color);
|
|
30
|
+
}
|
|
31
|
+
.right[data-v-972496bb] {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex: 1;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
min-width: 0;
|
|
36
|
+
/* 重要:防止内容撑开 */
|
|
37
|
+
padding: 24px;
|
|
38
|
+
background: #f6f8fa;
|
|
39
|
+
}
|
|
40
|
+
.right .canvas-container[data-v-972496bb] {
|
|
41
|
+
height: calc(100% - 48px);
|
|
42
|
+
}
|
|
43
|
+
.right .right-title[data-v-972496bb] {
|
|
44
|
+
margin-bottom: 24px;
|
|
45
|
+
color: #1a1d23;
|
|
46
|
+
font-size: 14px;
|
|
47
|
+
font-weight: 600;
|
|
48
|
+
text-align: center;
|
|
49
|
+
}
|
|
50
|
+
.var-item[data-v-972496bb] {
|
|
51
|
+
margin-right: 12px;
|
|
52
|
+
padding: 12px;
|
|
53
|
+
}
|
|
54
|
+
.var-item[data-v-972496bb]:hover {
|
|
55
|
+
border: 1px solid rgb(from var(--ant-primary-color) r g b / 30%);
|
|
56
|
+
border-radius: 4px;
|
|
57
|
+
background: rgb(from var(--ant-primary-color) r g b / 8%);
|
|
58
|
+
}
|
|
59
|
+
.var-item.selected[data-v-972496bb] {
|
|
60
|
+
border: 1px solid rgb(from var(--ant-primary-color) r g b / 30%);
|
|
61
|
+
border-radius: 4px;
|
|
62
|
+
background: rgb(from var(--ant-primary-color) r g b / 8%);
|
|
63
|
+
}
|
|
64
|
+
[data-v-972496bb] .ant-form .ant-form-item {
|
|
65
|
+
margin-bottom: 0;
|
|
66
|
+
}
|
|
67
|
+
[data-v-972496bb] .ant-input-affix-wrapper-focused {
|
|
68
|
+
border-color: var(--ant-primary-color);
|
|
69
|
+
}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { default as LabelParamsSelect } from './panels/widget/components/label-params-select.vue';
|
|
2
|
+
import { ActionsType, ButtonTextEnum } from './type';
|
|
1
3
|
export { default as StageView } from './stage/stage-view.vue';
|
|
2
|
-
export { useModalPicker } from './modal/index';
|
|
4
|
+
export { useModalPicker as useLabelModalPicker } from './modal/index';
|
|
5
|
+
export { default as LabelDesigner } from './designer.vue';
|
|
3
6
|
export type { ProjectType } from './hooks/usePage';
|
|
7
|
+
export { useProp } from './hooks/useProp';
|
|
4
8
|
export { setIdentify } from './identify-config';
|
|
9
|
+
export { loadLabelInfo, usePage } from './hooks/usePage';
|
|
10
|
+
export { default as StageCanvas } from './stage/stage-canvas.vue';
|
|
11
|
+
export * from './constants/size';
|
|
12
|
+
export * from './constants/CommonPrintElems';
|
|
13
|
+
export { default as LabelDesignControlComps } from './panels/widget/controls';
|
|
14
|
+
export { LabelParamsSelect, type ActionsType, ButtonTextEnum };
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import "./constants/CommonPrintElems.mjs";
|
|
2
|
+
import "./constants/size.mjs";
|
|
3
|
+
import "./hooks/usePage.mjs";
|
|
4
|
+
import "./hooks/useProp.mjs";
|
|
1
5
|
import "./stage/stage-view.vue.mjs";
|
|
2
6
|
import "./modal/index.mjs";
|
|
7
|
+
import "./stage/stage-canvas.vue.mjs";
|
|
3
8
|
import "./identify-config.mjs";
|
|
9
|
+
import "./panels/widget/components/label-params-select.vue.mjs";
|
|
10
|
+
import "./panels/widget/controls/index.mjs";
|
|
11
|
+
import "./designer.vue.mjs";
|
|
12
|
+
import "./type/index.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getSpecificationsForSize } from "../constants/size.mjs";
|
|
2
2
|
import { usePage } from "../hooks/usePage.mjs";
|
|
3
3
|
import { useDesigner } from "../hooks/useDesigner.mjs";
|
|
4
|
+
import toolkit_default from "../toolkits/toolkit.vue.mjs";
|
|
4
5
|
import { useModal } from "../../../modules/global-modal/src/hooks/useModal.mjs";
|
|
5
6
|
import { BasicModal } from "../../../modules/global-modal/index.mjs";
|
|
6
|
-
import toolkit_default from "../toolkits/toolkit.vue.mjs";
|
|
7
7
|
import stage_default from "../stage/stage.vue.mjs";
|
|
8
8
|
import { createBlock, createElementVNode, createVNode, defineComponent, openBlock, reactive, ref, unref, withCtx } from "vue";
|
|
9
9
|
//#region src/components/label-design/modal/template.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useDesigner } from "../hooks/useDesigner.mjs";
|
|
2
|
+
import panelComps from "./index.mjs";
|
|
2
3
|
import { useModal } from "../../../modules/global-modal/src/hooks/useModal.mjs";
|
|
3
4
|
import "../../../modules/global-modal/index.mjs";
|
|
4
|
-
import panelComps from "./index.mjs";
|
|
5
5
|
import diff_modal_default from "./modals/diff-modal.vue.mjs";
|
|
6
6
|
import { computed, createBlock, createElementBlock, createVNode, defineComponent, openBlock, provide, resolveDynamicComponent, unref } from "vue";
|
|
7
7
|
//#region src/components/label-design/panels/panel.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
modelValue?: string;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
5
|
+
/**
|
|
6
|
+
* 获取选项数据(如果为空则重新加载)
|
|
7
|
+
*/
|
|
8
|
+
getOptions: () => Promise<{
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
_item: IObject;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}[]>;
|
|
16
|
+
/**
|
|
17
|
+
* 直接获取 paramsData 的当前值
|
|
18
|
+
* @returns 标签参数模型的数据数组
|
|
19
|
+
*/
|
|
20
|
+
getParamsData: () => {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
_item: IObject;
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
type: string;
|
|
27
|
+
}[];
|
|
28
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
29
|
+
change: (...args: any[]) => void;
|
|
30
|
+
"update:modelValue": (...args: any[]) => void;
|
|
31
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
32
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
33
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
34
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
export default _default;
|
|
@@ -4,8 +4,8 @@ import FieldCascader_default from "../../../../field-cascader/src/FieldCascader.
|
|
|
4
4
|
import { CONTENT_TYPE } from "../../../constants/CommonPrintElems.mjs";
|
|
5
5
|
import { usePage } from "../../../hooks/usePage.mjs";
|
|
6
6
|
import { identify } from "../../../identify-config.mjs";
|
|
7
|
-
import "../../../../index.mjs";
|
|
8
7
|
import label_params_select_default from "../components/label-params-select.vue.mjs";
|
|
8
|
+
import "../../../../index.mjs";
|
|
9
9
|
import { computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, nextTick, openBlock, ref, resolveComponent, toDisplayString, unref, withCtx } from "vue";
|
|
10
10
|
import { ExpressionModeEnum, ExpressionTabEnum, FIELD_TYPE, t } from "@gct-paas/core";
|
|
11
11
|
//#region src/components/label-design/panels/widget/controls/VariableSelect.vue?vue&type=script&setup=true&name=variable-select&lang.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { loadLabelInfo } from "../hooks/usePage.mjs";
|
|
2
2
|
import { PanelEnum, useDesigner } from "../hooks/useDesigner.mjs";
|
|
3
|
+
import stage_canvas_default from "./stage-canvas.vue.mjs";
|
|
3
4
|
import { ActionBar } from "../components/action-bar/action-bar.mjs";
|
|
4
5
|
import panel_default from "../panels/panel.vue.mjs";
|
|
5
|
-
import stage_canvas_default from "./stage-canvas.vue.mjs";
|
|
6
6
|
import stage_header_default from "./stage-header.vue.mjs";
|
|
7
7
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, unref, watch, withCtx, withModifiers } from "vue";
|
|
8
8
|
import { useDebounceFn, useResizeObserver } from "@vueuse/core";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ButtonType = 'primary' | 'default' | 'ghost' | 'dashed' | 'link' | 'text' | 'error';
|
|
2
|
+
export declare enum ButtonTextEnum {
|
|
3
|
+
DETAIL = "viewDetails",
|
|
4
|
+
PREVIEW = "preview",
|
|
5
|
+
DELETE = "delete",
|
|
6
|
+
EDIT = "edit",
|
|
7
|
+
DESIGN = "design"
|
|
8
|
+
}
|
|
9
|
+
export interface ActionsType {
|
|
10
|
+
type?: ButtonType;
|
|
11
|
+
text: ButtonTextEnum;
|
|
12
|
+
icon: string;
|
|
13
|
+
ghost?: boolean;
|
|
14
|
+
danger?: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/components/label-design/type/index.ts
|
|
2
|
+
var ButtonTextEnum = /* @__PURE__ */ function(ButtonTextEnum) {
|
|
3
|
+
ButtonTextEnum["DETAIL"] = "viewDetails";
|
|
4
|
+
ButtonTextEnum["PREVIEW"] = "preview";
|
|
5
|
+
ButtonTextEnum["DELETE"] = "delete";
|
|
6
|
+
ButtonTextEnum["EDIT"] = "edit";
|
|
7
|
+
ButtonTextEnum["DESIGN"] = "design";
|
|
8
|
+
return ButtonTextEnum;
|
|
9
|
+
}({});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ButtonTextEnum };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
3
|
+
/* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
|
|
4
|
+
/**
|
|
5
|
+
* 定义 Block 块
|
|
6
|
+
* @param {String} $block - Block 块名称
|
|
7
|
+
* @example
|
|
8
|
+
* @include b('button') {
|
|
9
|
+
* padding: 10px;
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 定义 Element 元素
|
|
14
|
+
* @param {String|List} $element - Element 元素名称,支持单个或多个
|
|
15
|
+
* @example
|
|
16
|
+
* @include b('button') {
|
|
17
|
+
* @include e('text') {
|
|
18
|
+
* color: #000;
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* // 或传入多个元素
|
|
22
|
+
* @include b('button') {
|
|
23
|
+
* @include e(('text', 'icon')) {
|
|
24
|
+
* margin: 5px;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* 定义 Modifier 修饰符
|
|
30
|
+
* @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
|
|
31
|
+
* @example
|
|
32
|
+
* @include b('button') {
|
|
33
|
+
* @include m('primary') {
|
|
34
|
+
* background: blue;
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* // 或传入多个修饰符
|
|
38
|
+
* @include b('button') {
|
|
39
|
+
* @include m(('primary', 'large')) {
|
|
40
|
+
* background: blue;
|
|
41
|
+
* font-size: 16px;
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* 定义状态选择器
|
|
47
|
+
* @param {String} $state - 状态名称
|
|
48
|
+
* @example
|
|
49
|
+
* @include b('button') {
|
|
50
|
+
* @include when('disabled') {
|
|
51
|
+
* opacity: 0.5;
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* 深色主题样式
|
|
57
|
+
* @param {String} $block - Block 块名称
|
|
58
|
+
* @example
|
|
59
|
+
* @include dark('button') {
|
|
60
|
+
* background: #333;
|
|
61
|
+
* color: #fff;
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
64
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
65
|
+
.gct-modal-name-editor__name {
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
max-width: 300px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.gct-modal-name-editor.is-edit {
|
|
73
|
+
cursor: default;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.gct-modal-name-editor__input {
|
|
77
|
+
position: relative;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
}
|
|
81
|
+
.gct-modal-name-editor__input .anticon-loading {
|
|
82
|
+
margin-right: var(--gct-spacing-4);
|
|
83
|
+
}
|
|
84
|
+
.gct-modal-name-editor__input .ant-input.ant-input-sm {
|
|
85
|
+
padding: 0;
|
|
86
|
+
color: rgb(var(--gct-color-text-1));
|
|
87
|
+
}
|
|
88
|
+
.gct-modal-name-editor__input .ant-input.ant-input-sm.ant-input-disabled {
|
|
89
|
+
background-color: transparent;
|
|
90
|
+
}
|
|
91
|
+
.gct-modal-name-editor__input .ant-input[disabled] {
|
|
92
|
+
color: rgb(var(--gct-color-text-1));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.gct-modal-name-editor__error-info {
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
line-height: 16px;
|
|
98
|
+
position: absolute;
|
|
99
|
+
top: 24px;
|
|
100
|
+
z-index: 10000;
|
|
101
|
+
padding: var(--gct-padding-2);
|
|
102
|
+
color: var(--gct-color-danger-hover);
|
|
103
|
+
background-color: var(--gct-color-danger-light-hover);
|
|
104
|
+
border-radius: var(--gct-border-radius-s);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.gct-modal-name-editor__edit {
|
|
108
|
+
margin-left: var(--gct-spacing-4);
|
|
109
|
+
color: rgb(var(--gct-colo-text-1));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.gct-modal-name-editor {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
height: 22px;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const ModalNameEditor: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
value: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
defaultName: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
max: {
|
|
11
|
+
type: NumberConstructor;
|
|
12
|
+
default: number;
|
|
13
|
+
};
|
|
14
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("change" | "update:value")[], "change" | "update:value", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
15
|
+
value: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
defaultName: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
max: {
|
|
24
|
+
type: NumberConstructor;
|
|
25
|
+
default: number;
|
|
26
|
+
};
|
|
27
|
+
}>> & Readonly<{
|
|
28
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
29
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
30
|
+
}>, {
|
|
31
|
+
value: string;
|
|
32
|
+
defaultName: string;
|
|
33
|
+
max: number;
|
|
34
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import './modal-name-editor.css';/* empty css */
|
|
2
|
+
import { computed, createVNode, defineComponent, nextTick, ref, resolveComponent, watch } from "vue";
|
|
3
|
+
import { useNamespace } from "@gct-paas/core";
|
|
4
|
+
import { onClickOutside } from "@vueuse/core";
|
|
5
|
+
//#region src/components/modal-name-editor/modal-name-editor.tsx
|
|
6
|
+
var ModalNameEditor = /* @__PURE__ */ defineComponent({
|
|
7
|
+
name: "ModalNameEditor",
|
|
8
|
+
props: {
|
|
9
|
+
value: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "未命名"
|
|
12
|
+
},
|
|
13
|
+
defaultName: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: "未命名名称"
|
|
16
|
+
},
|
|
17
|
+
max: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 100
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
emits: ["update:value", "change"],
|
|
23
|
+
setup(props, { emit }) {
|
|
24
|
+
const ns = useNamespace("modal-name-editor");
|
|
25
|
+
const isEdit = ref(false);
|
|
26
|
+
const nameInputRef = ref();
|
|
27
|
+
const name = ref(props.value);
|
|
28
|
+
const displayName = computed(() => {
|
|
29
|
+
return name.value || props.defaultName;
|
|
30
|
+
});
|
|
31
|
+
const isError = computed(() => {
|
|
32
|
+
if (displayName.value.length > props.max) return true;
|
|
33
|
+
return false;
|
|
34
|
+
});
|
|
35
|
+
watch(() => props.value, () => {
|
|
36
|
+
if (name.value !== props.value) name.value = props.value;
|
|
37
|
+
});
|
|
38
|
+
const isSaving = ref(false);
|
|
39
|
+
const hasUserModified = ref(false);
|
|
40
|
+
const val = computed({
|
|
41
|
+
get() {
|
|
42
|
+
if (isEdit.value && hasUserModified.value) return name.value;
|
|
43
|
+
return displayName.value;
|
|
44
|
+
},
|
|
45
|
+
set(val) {
|
|
46
|
+
hasUserModified.value = true;
|
|
47
|
+
const trimmedVal = val.trim();
|
|
48
|
+
if (name.value !== trimmedVal) {
|
|
49
|
+
name.value = trimmedVal;
|
|
50
|
+
emit("update:value", trimmedVal);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const onEditName = () => {
|
|
55
|
+
isEdit.value = true;
|
|
56
|
+
hasUserModified.value = false;
|
|
57
|
+
nextTick(() => {
|
|
58
|
+
nameInputRef.value.focus();
|
|
59
|
+
nameInputRef.value.select();
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const onSaveName = async () => {
|
|
63
|
+
if (name.value && name.value.trim()) {
|
|
64
|
+
isSaving.value = true;
|
|
65
|
+
try {
|
|
66
|
+
emit("update:value", name.value);
|
|
67
|
+
} finally {
|
|
68
|
+
isSaving.value = false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
isEdit.value = false;
|
|
72
|
+
hasUserModified.value = false;
|
|
73
|
+
};
|
|
74
|
+
const onBlurOrEnter = () => {
|
|
75
|
+
if (isEdit.value) {
|
|
76
|
+
if (isError.value === true) {
|
|
77
|
+
nextTick(() => {
|
|
78
|
+
nameInputRef.value.focus();
|
|
79
|
+
nameInputRef.value.select();
|
|
80
|
+
});
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
onSaveName();
|
|
84
|
+
isEdit.value = false;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
onClickOutside(nameInputRef, async () => {
|
|
88
|
+
onBlurOrEnter();
|
|
89
|
+
});
|
|
90
|
+
const onChange = () => {
|
|
91
|
+
emit("change");
|
|
92
|
+
};
|
|
93
|
+
return () => {
|
|
94
|
+
return createVNode("div", { "class": ns.b() }, [
|
|
95
|
+
createVNode("div", {
|
|
96
|
+
"class": [ns.e("name"), ns.is("hidden", isEdit.value)],
|
|
97
|
+
"title": val.value,
|
|
98
|
+
"onDblclick": onEditName
|
|
99
|
+
}, [val.value]),
|
|
100
|
+
createVNode("div", { "class": [ns.e("input"), ns.is("hidden", !isEdit.value)] }, [
|
|
101
|
+
isSaving.value ? createVNode(resolveComponent("loading-outlined"), null, null) : null,
|
|
102
|
+
createVNode(resolveComponent("a-input"), {
|
|
103
|
+
"value": val.value,
|
|
104
|
+
"onUpdate:value": ($event) => val.value = $event,
|
|
105
|
+
"ref": nameInputRef,
|
|
106
|
+
"size": "small",
|
|
107
|
+
"bordered": false,
|
|
108
|
+
"onBlur": onBlurOrEnter,
|
|
109
|
+
"onPressEnter": onBlurOrEnter,
|
|
110
|
+
"disabled": isSaving.value,
|
|
111
|
+
"onChange": onChange
|
|
112
|
+
}, null),
|
|
113
|
+
createVNode("div", { "class": [ns.e("error-info"), ns.is("hidden", !isError.value)] }, [`最大${props.max}字`])
|
|
114
|
+
]),
|
|
115
|
+
createVNode("div", {
|
|
116
|
+
"class": [ns.e("edit"), ns.is("hidden", isEdit.value)],
|
|
117
|
+
"onClick": onEditName
|
|
118
|
+
}, [createVNode("i", { "class": "iconfont icon-bianji" }, null)])
|
|
119
|
+
]);
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
//#endregion
|
|
124
|
+
export { ModalNameEditor };
|