@gct-paas/design 0.1.6-dev.2 → 0.1.6-dev.20
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/index.min.css +1 -1
- package/dist/loader.esm.min.js +2 -1
- package/es/components/index.d.ts +0 -4
- package/es/components/index.mjs +0 -4
- package/es/components/user-occupy/useUserOccupy.mjs +2 -2
- package/es/constant/page-designer.d.ts +9 -36
- package/es/constant/page-designer.mjs +2 -32
- package/es/create-app-vue.d.ts +1 -1
- package/es/create-app-vue.mjs +1 -1
- package/es/hooks/design-view/designer/useDesignPreview.mjs +6 -4
- package/es/hooks/design-view/layout/useToolkit.mjs +4 -1
- package/es/hooks/index.d.ts +0 -1
- package/es/hooks/index.mjs +0 -1
- package/es/index.mjs +6 -9
- package/es/interface/index.d.ts +0 -1
- package/es/locale/sys/component.d.ts +4 -4
- package/es/locale/sys/pageDesigner.d.ts +5 -5
- package/es/props/design-plugin-props.d.ts +64 -0
- package/es/props/{index.mjs → design-plugin-props.mjs} +1 -1
- package/es/props/index.d.ts +1 -64
- package/es/register/index.d.ts +1 -0
- package/es/register/index.mjs +1 -0
- package/es/register/props-editor/props-editor.register.d.ts +24 -0
- package/es/register/props-editor/props-editor.register.mjs +30 -0
- package/es/types/index.d.ts +2 -1
- package/package.json +11 -11
- package/es/components/design-save-tip/design-save-tip.css +0 -107
- package/es/components/design-save-tip/design-save-tip.d.ts +0 -44
- package/es/components/design-save-tip/design-save-tip.mjs +0 -81
- package/es/components/design-step-check/design-step-check.css +0 -133
- package/es/components/design-step-check/design-step-check.d.ts +0 -30
- package/es/components/design-step-check/design-step-check.mjs +0 -96
- package/es/components/design-view-layout/design-view-layout.css +0 -157
- package/es/components/design-view-layout/design-view-layout.d.ts +0 -1
- package/es/components/design-view-layout/design-view-layout.mjs +0 -139
- package/es/components/modal-name-editor/modal-name-editor.css +0 -117
- package/es/components/modal-name-editor/modal-name-editor.d.ts +0 -34
- package/es/components/modal-name-editor/modal-name-editor.mjs +0 -124
- package/es/hooks/develop/useKeyParser.d.ts +0 -16
- package/es/hooks/develop/useKeyParser.mjs +0 -79
- package/es/interface/i-view-step/i-view-step.d.ts +0 -32
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { DesignStepCheck } from "../design-step-check/design-step-check.mjs";
|
|
2
|
-
import { ModalNameEditor } from "../modal-name-editor/modal-name-editor.mjs";
|
|
3
|
-
import './design-view-layout.css';/* empty css */
|
|
4
|
-
import { t, useNamespace } from "@gct-paas/core";
|
|
5
|
-
import { Fragment, computed, createVNode, defineComponent, isVNode, mergeProps, ref, resolveComponent, toRefs } from "vue";
|
|
6
|
-
//#region src/components/design-view-layout/design-view-layout.tsx
|
|
7
|
-
function _isSlot(s) {
|
|
8
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
9
|
-
}
|
|
10
|
-
var DesignViewLayout = /* @__PURE__ */ defineComponent({
|
|
11
|
-
name: "DesignViewLayout",
|
|
12
|
-
props: {
|
|
13
|
-
name: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: "未命名"
|
|
16
|
-
},
|
|
17
|
-
defaultName: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: "未命名卡片名称"
|
|
20
|
-
},
|
|
21
|
-
editName: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: true
|
|
24
|
-
},
|
|
25
|
-
subTitle: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: ""
|
|
28
|
-
},
|
|
29
|
-
step: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: ""
|
|
32
|
-
},
|
|
33
|
-
steps: {
|
|
34
|
-
type: Array,
|
|
35
|
-
default: () => []
|
|
36
|
-
},
|
|
37
|
-
actions: {
|
|
38
|
-
type: Array,
|
|
39
|
-
default: () => []
|
|
40
|
-
},
|
|
41
|
-
save: { type: Function },
|
|
42
|
-
next: { type: Function }
|
|
43
|
-
},
|
|
44
|
-
emits: [
|
|
45
|
-
"changeName",
|
|
46
|
-
"back",
|
|
47
|
-
"stepChange"
|
|
48
|
-
],
|
|
49
|
-
setup(props, { slots, emit, expose }) {
|
|
50
|
-
const ns = useNamespace("design-view-layout");
|
|
51
|
-
const stepCheckRef = ref();
|
|
52
|
-
const { name, subTitle, step, steps } = toRefs(props);
|
|
53
|
-
const isLoading = ref(false);
|
|
54
|
-
const val = computed({
|
|
55
|
-
get() {
|
|
56
|
-
return name.value;
|
|
57
|
-
},
|
|
58
|
-
set(val) {
|
|
59
|
-
if (name.value !== val) {
|
|
60
|
-
name.value = val;
|
|
61
|
-
emit("changeName", val);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const isBack = computed(() => {
|
|
66
|
-
return history.length > 1 || !!window.$wujie;
|
|
67
|
-
});
|
|
68
|
-
const isLastStep = computed(() => {
|
|
69
|
-
return steps.value.length === 0 || steps.value[steps.value.length - 1]?.tag === step.value;
|
|
70
|
-
});
|
|
71
|
-
function onBack(e) {
|
|
72
|
-
e.stopPropagation();
|
|
73
|
-
emit("back", e);
|
|
74
|
-
}
|
|
75
|
-
async function onNext() {
|
|
76
|
-
if (props.next) try {
|
|
77
|
-
isLoading.value = true;
|
|
78
|
-
await props.next();
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error("DesignViewLayout: next function error", error);
|
|
81
|
-
} finally {
|
|
82
|
-
isLoading.value = false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
async function onSave() {
|
|
86
|
-
if (props.save) try {
|
|
87
|
-
isLoading.value = true;
|
|
88
|
-
await props.save();
|
|
89
|
-
} catch (error) {
|
|
90
|
-
console.error("DesignViewLayout: save function error", error);
|
|
91
|
-
} finally {
|
|
92
|
-
isLoading.value = false;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function setStep(stepId) {
|
|
96
|
-
if (stepCheckRef.value) stepCheckRef.value.setStep(stepId);
|
|
97
|
-
}
|
|
98
|
-
expose({ setStep });
|
|
99
|
-
return () => {
|
|
100
|
-
let _slot, _slot2;
|
|
101
|
-
return createVNode("div", { "class": ns.b() }, [createVNode("div", { "class": ns.e("header") }, [
|
|
102
|
-
createVNode("div", { "class": ns.e("header-left") }, [isBack.value ? createVNode("div", {
|
|
103
|
-
"class": ns.e("header-back"),
|
|
104
|
-
"onClick": onBack
|
|
105
|
-
}, [createVNode(resolveComponent("assets-svg-icon"), { "src": "/extras-assets/card-design/arrow_back.svg" }, null)]) : null, props.editName ? createVNode("div", { "class": ns.e("header-info") }, [createVNode("div", { "class": ns.e("header-sub-title") }, [subTitle.value]), createVNode("div", { "class": ns.e("header-title") }, [createVNode(ModalNameEditor, {
|
|
106
|
-
"value": val.value,
|
|
107
|
-
"onUpdate:value": ($event) => val.value = $event,
|
|
108
|
-
"defaultName": props.defaultName
|
|
109
|
-
}, null)])]) : null]),
|
|
110
|
-
createVNode("div", { "class": ns.e("header-center") }, [steps.value.length > 0 ? createVNode(DesignStepCheck, {
|
|
111
|
-
"ref": (ref) => stepCheckRef.value = ref,
|
|
112
|
-
"steps": steps.value,
|
|
113
|
-
"currentStep": step.value,
|
|
114
|
-
"onStepChange": (stepId, stepData) => {
|
|
115
|
-
emit("stepChange", stepId, stepData);
|
|
116
|
-
}
|
|
117
|
-
}, null) : null]),
|
|
118
|
-
createVNode("div", { "class": ns.e("header-right") }, [slots.headerRight ? slots.headerRight() : null, createVNode("div", { "class": ns.e("header-actions") }, [props.steps.length > 0 ? isLastStep.value ? createVNode(Fragment, null, [
|
|
119
|
-
slots.headerActions ? slots.headerActions() : null,
|
|
120
|
-
props.actions.map((actionProps) => {
|
|
121
|
-
createVNode(resolveComponent("a-button"), mergeProps({ "class": ns.e("header-action-btn") }, actionProps), { default: () => [actionProps.title] });
|
|
122
|
-
}),
|
|
123
|
-
createVNode(resolveComponent("a-button"), {
|
|
124
|
-
"class": ns.e("header-action-btn"),
|
|
125
|
-
"type": "primary",
|
|
126
|
-
"loading": isLoading.value,
|
|
127
|
-
"onClick": onSave,
|
|
128
|
-
"icon": createVNode("i", { "class": "gct-iconfont icon-icon_baocun_btn" }, null)
|
|
129
|
-
}, _isSlot(_slot = t("sys.saveText")) ? _slot : { default: () => [_slot] })
|
|
130
|
-
]) : createVNode(resolveComponent("a-button"), {
|
|
131
|
-
"type": "primary",
|
|
132
|
-
"onClick": onNext
|
|
133
|
-
}, _isSlot(_slot2 = t("sys.nextStep")) ? _slot2 : { default: () => [_slot2] }) : null])])
|
|
134
|
-
]), createVNode("div", { "class": ns.e("content") }, [slots.default ? slots.default() : null])]);
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
//#endregion
|
|
139
|
-
export { DesignViewLayout };
|
|
@@ -1,117 +0,0 @@
|
|
|
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
|
-
display: flex;
|
|
78
|
-
position: relative;
|
|
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
|
-
z-index: 10000;
|
|
100
|
-
top: 24px;
|
|
101
|
-
padding: var(--gct-padding-2);
|
|
102
|
-
border-radius: var(--gct-border-radius-s);
|
|
103
|
-
background-color: var(--gct-color-danger-light-hover);
|
|
104
|
-
color: var(--gct-color-danger-hover);
|
|
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
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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>;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import './modal-name-editor.css';/* empty css */
|
|
2
|
-
import { useNamespace } from "@gct-paas/core";
|
|
3
|
-
import { computed, createVNode, defineComponent, nextTick, ref, resolveComponent, watch } from "vue";
|
|
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 };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
/**
|
|
3
|
-
* key值转换器
|
|
4
|
-
* @param prefix 前缀
|
|
5
|
-
* @param suffix 后缀 仅空字符串代表不需要后缀
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare function useKeyParser(prefix: Ref<string | undefined> | string, suffix?: Ref<string | undefined> | string): {
|
|
9
|
-
keyPrefix: Ref<string, string>;
|
|
10
|
-
keySuffix: Ref<string, string>;
|
|
11
|
-
keyReset: () => void;
|
|
12
|
-
keyPad: (key: string) => string | undefined;
|
|
13
|
-
keyClip: (formKey: string) => string;
|
|
14
|
-
keyPrePad: (key: string) => string | undefined;
|
|
15
|
-
keyPreClip: (formKey: string) => string;
|
|
16
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ProjectName } from "@gct-paas/core";
|
|
2
|
-
import { isRef, ref, unref, watch } from "vue";
|
|
3
|
-
//#region src/hooks/develop/useKeyParser.ts
|
|
4
|
-
var SourceTypeEnum = /* @__PURE__ */ function(SourceTypeEnum) {
|
|
5
|
-
SourceTypeEnum["SELF_BUILT"] = "SELF_BUILT";
|
|
6
|
-
SourceTypeEnum["IMPORT"] = "IMPORT";
|
|
7
|
-
return SourceTypeEnum;
|
|
8
|
-
}(SourceTypeEnum || {});
|
|
9
|
-
/**
|
|
10
|
-
* key值转换器
|
|
11
|
-
* @param prefix 前缀
|
|
12
|
-
* @param suffix 后缀 仅空字符串代表不需要后缀
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
function useKeyParser(prefix, suffix) {
|
|
16
|
-
const hasDollar = ref(false);
|
|
17
|
-
const upperCase = ref(false);
|
|
18
|
-
const keyPrefix = ref("");
|
|
19
|
-
const keySuffix = ref("");
|
|
20
|
-
const branchId = _gct.store.context.bid || "";
|
|
21
|
-
function keyReset() {
|
|
22
|
-
const prefixString = unref(prefix);
|
|
23
|
-
const suffixString = unref(suffix);
|
|
24
|
-
if (!prefixString) return;
|
|
25
|
-
hasDollar.value = prefixString.startsWith("$");
|
|
26
|
-
upperCase.value = /\$?[A-Z]+_/.test(prefixString);
|
|
27
|
-
keyPrefix.value = (hasDollar.value ? "$" : "") + (_gct.store.appInfo.sourceType === SourceTypeEnum.IMPORT ? upperCase.value ? "I" : "i" : "") + (hasDollar.value ? prefixString.substring(1) : prefixString) + (prefixString.endsWith("_") ? "" : "_");
|
|
28
|
-
keySuffix.value = suffixString === "" ? "" : _gct.store.projectName === ProjectName.WEB_RENDER ? "" : branchId ? "_" + (upperCase.value ? branchId.toUpperCase() : branchId) : "";
|
|
29
|
-
}
|
|
30
|
-
keyReset();
|
|
31
|
-
if (isRef(prefix)) watch(prefix, () => {
|
|
32
|
-
keyReset();
|
|
33
|
-
});
|
|
34
|
-
if (isRef(suffix)) watch(suffix, () => {
|
|
35
|
-
keyReset();
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* 补全key信息 包含 导入信息 模块信息 分支信息
|
|
39
|
-
* @param key
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
function keyPad(key) {
|
|
43
|
-
if (!key) return;
|
|
44
|
-
return `${keyPrefix.value}${key}${keySuffix.value}`;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* 裁剪key
|
|
48
|
-
* @param key
|
|
49
|
-
*/
|
|
50
|
-
function keyClip(formKey) {
|
|
51
|
-
const id = unref(prefix).match(/\$?(([a-zA-Z]+_)*[a-zA-Z]+)_?/)[1];
|
|
52
|
-
const prefixPos = formKey.indexOf(id) + id.length;
|
|
53
|
-
const suffixPos = !keySuffix.value || unref(suffix) === "" ? formKey.length : formKey.lastIndexOf("_");
|
|
54
|
-
keyPrefix.value = formKey.substring(0, prefixPos + 1);
|
|
55
|
-
keySuffix.value = formKey.substring(suffixPos);
|
|
56
|
-
return formKey.substring(prefixPos + 1, suffixPos);
|
|
57
|
-
}
|
|
58
|
-
function keyPreClip(formKey) {
|
|
59
|
-
const id = unref(prefix).match(/\$?(([a-zA-Z]+_)*[a-zA-Z]+)_?/)[1];
|
|
60
|
-
const prefixPos = formKey.indexOf(id) + id.length;
|
|
61
|
-
keyPrefix.value = formKey.substring(0, prefixPos + 1);
|
|
62
|
-
return formKey.substring(prefixPos + 1);
|
|
63
|
-
}
|
|
64
|
-
function keyPrePad(key) {
|
|
65
|
-
if (!key) return;
|
|
66
|
-
return `${keyPrefix.value}${key}`;
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
keyPrefix,
|
|
70
|
-
keySuffix,
|
|
71
|
-
keyReset,
|
|
72
|
-
keyPad,
|
|
73
|
-
keyClip,
|
|
74
|
-
keyPrePad,
|
|
75
|
-
keyPreClip
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
79
|
-
export { useKeyParser };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 设计视图步骤接口
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @interface IViewStep
|
|
6
|
-
*/
|
|
7
|
-
export interface IViewStep {
|
|
8
|
-
/**
|
|
9
|
-
* 步骤标识符
|
|
10
|
-
*
|
|
11
|
-
* @type {string}
|
|
12
|
-
*/
|
|
13
|
-
tag: string;
|
|
14
|
-
/**
|
|
15
|
-
* 步骤名称
|
|
16
|
-
*
|
|
17
|
-
* @type {string}
|
|
18
|
-
*/
|
|
19
|
-
name: string;
|
|
20
|
-
/**
|
|
21
|
-
* 步骤图标(只支持 svg)
|
|
22
|
-
*
|
|
23
|
-
* @type {string}
|
|
24
|
-
*/
|
|
25
|
-
icon?: string;
|
|
26
|
-
/**
|
|
27
|
-
* 步骤描述
|
|
28
|
-
*
|
|
29
|
-
* @type {string}
|
|
30
|
-
*/
|
|
31
|
-
description?: string;
|
|
32
|
-
}
|