@gct-paas/design-web 0.1.4-dev.9 → 0.1.5-dev.0
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 +2 -1
- package/dist/loader.esm.min.js +1 -0
- package/es/_virtual/_plugin-vue_export-helper.mjs +7 -8
- package/es/components/form-component/FieldCheckbox.d.ts +38 -0
- package/es/components/form-component/FieldCheckbox.mjs +71 -0
- package/es/components/form-component/FieldRadio.d.ts +38 -0
- package/es/components/form-component/FieldRadio.mjs +64 -0
- package/es/components/form-component/FieldSelect.d.ts +82 -0
- package/es/components/form-component/FieldSelect.mjs +174 -0
- package/es/components/form-component/field-emptyValue.d.ts +6 -0
- package/es/components/form-component/field-label/ref-card-label-design.vue.d.ts +17 -0
- package/es/components/form-component/field-label/ref-card-label-design.vue.mjs +6 -0
- package/es/components/form-component/field-label/ref-card-label-design.vue_vue_type_script_setup_true_lang.mjs +122 -0
- package/es/components/form-component/field-label/ref-card-label-design.vue_vue_type_style_index_0_lang.css +9 -0
- package/es/components/form-component/field-label/selectTag.vue.d.ts +10 -0
- package/es/components/form-component/field-label/selectTag.vue.mjs +5 -0
- package/es/components/form-component/field-label/selectTag.vue_vue_type_script_setup_true_lang.mjs +22 -0
- package/es/components/form-component/field-label/tag-label.vue.d.ts +36 -0
- package/es/components/form-component/field-label/tag-label.vue.mjs +7 -0
- package/es/components/form-component/field-label/tag-label.vue_vue_type_script_setup_true_lang.mjs +143 -0
- package/es/components/form-component/field-label/tag-label.vue_vue_type_style_index_0_scoped_a1ded441_lang.css +15 -0
- package/es/components/form-component/field-label/tag-layout.vue.d.ts +21 -0
- package/es/components/form-component/field-label/tag-layout.vue.mjs +7 -0
- package/es/components/form-component/field-label/tag-layout.vue_vue_type_script_setup_true_lang.mjs +16 -0
- package/es/components/form-component/field-label/tag-layout.vue_vue_type_style_index_0_scoped_85e6a8f5_lang.css +12 -0
- package/es/components/form-component/field-label/tag-span.vue.d.ts +21 -0
- package/es/components/form-component/field-label/tag-span.vue.mjs +7 -0
- package/es/components/form-component/field-label/tag-span.vue_vue_type_script_setup_true_lang.mjs +25 -0
- package/es/components/form-component/field-label/tag-span.vue_vue_type_style_index_0_scoped_3bf855f6_lang.css +31 -0
- package/es/components/form-component/field-readonly.vue.d.ts +22 -0
- package/es/components/form-component/field-readonly.vue.mjs +5 -0
- package/es/components/form-component/field-readonly.vue_vue_type_script_setup_true_lang.mjs +81 -0
- package/es/components/form-component/index.css +40 -0
- package/es/components/form-component/index.d.ts +8 -0
- package/es/components/form-component/index.mjs +7 -0
- package/es/components/index.d.ts +1 -1
- package/es/components/index.mjs +8 -0
- package/es/index.mjs +14 -15
- package/es/loader.d.ts +1 -0
- package/package.json +23 -18
- package/dist/index.esm.min.mjs +0 -1606
- package/dist/index.min.cjs +0 -57
- package/dist/index.system.min.js +0 -57
- package/es/components/I18nSelect/index.d.ts +0 -7
- package/es/components/I18nSelect/src/i18n-modal.vue.d.ts +0 -21
- package/es/components/I18nSelect/src/i18n-modal.vue.mjs +0 -151
- package/es/components/I18nSelect/src/i18n-modal.vue2.mjs +0 -5
- package/es/components/I18nSelect/src/i18n-select-btn.css +0 -58
- package/es/components/I18nSelect/src/i18n-select-btn.vue.d.ts +0 -18
- package/es/components/I18nSelect/src/i18n-select-btn.vue.mjs +0 -7
- package/es/components/I18nSelect/src/i18n-select-btn.vue2.mjs +0 -138
- package/es/components/I18nSelect/src/i18n-select-container.css +0 -6
- package/es/components/I18nSelect/src/i18n-select-container.vue.d.ts +0 -10
- package/es/components/I18nSelect/src/i18n-select-container.vue.mjs +0 -7
- package/es/components/I18nSelect/src/i18n-select-container.vue2.mjs +0 -250
- package/es/components/I18nSelect/src/i18n-select-input-form.vue.d.ts +0 -15
- package/es/components/I18nSelect/src/i18n-select-input-form.vue.mjs +0 -57
- package/es/components/I18nSelect/src/i18n-select-input-form.vue2.mjs +0 -5
- package/es/components/I18nSelect/src/i18n-select-input.css +0 -3
- package/es/components/I18nSelect/src/i18n-select-input.vue.d.ts +0 -51
- package/es/components/I18nSelect/src/i18n-select-input.vue.mjs +0 -7
- package/es/components/I18nSelect/src/i18n-select-input.vue2.mjs +0 -129
- package/es/components/I18nSelect/src/i18n-select-modal.vue.d.ts +0 -4
- package/es/components/I18nSelect/src/i18n-select-modal.vue.mjs +0 -21
- package/es/components/I18nSelect/src/i18n-select-modal.vue2.mjs +0 -5
- package/es/components/I18nSelect/src/i18n-select-textarea-form.vue.d.ts +0 -15
- package/es/components/I18nSelect/src/i18n-select-textarea-form.vue.mjs +0 -57
- package/es/components/I18nSelect/src/i18n-select-textarea-form.vue2.mjs +0 -5
- package/es/components/I18nSelect/src/i18n-select-textarea.css +0 -17
- package/es/components/I18nSelect/src/i18n-select-textarea.vue.d.ts +0 -26
- package/es/components/I18nSelect/src/i18n-select-textarea.vue.mjs +0 -7
- package/es/components/I18nSelect/src/i18n-select-textarea.vue2.mjs +0 -93
- package/es/components/I18nSelect/src/useI18nSelect.d.ts +0 -13
- package/es/components/I18nSelect/src/useI18nSelect.mjs +0 -51
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, resolveComponent, openBlock, createBlock, withCtx, renderSlot, createVNode, mergeProps, unref, createCommentVNode } from 'vue';
|
|
2
|
-
import I18nSelectBtn from './i18n-select-btn.vue.mjs';
|
|
3
|
-
import { isEmpty, omit } from 'lodash-es';
|
|
4
|
-
import { onClickOutside } from '@vueuse/core';
|
|
5
|
-
import { ButtonSize } from '@gct-paas/core';
|
|
6
|
-
|
|
7
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
-
__name: "i18n-select-input",
|
|
9
|
-
props: {
|
|
10
|
-
attr: {},
|
|
11
|
-
inputExtraProps: {},
|
|
12
|
-
i18nConfig: {},
|
|
13
|
-
i18nText: {},
|
|
14
|
-
placeholderText: {},
|
|
15
|
-
size: {},
|
|
16
|
-
i18nModalKey: {},
|
|
17
|
-
forceUpdate: { type: Boolean },
|
|
18
|
-
btnHeight: {},
|
|
19
|
-
btnWidth: {}
|
|
20
|
-
},
|
|
21
|
-
emits: [
|
|
22
|
-
"update:i18nText",
|
|
23
|
-
"update:i18nConfig",
|
|
24
|
-
"on-i18n-select",
|
|
25
|
-
"clickOutside",
|
|
26
|
-
"focus",
|
|
27
|
-
"blur"
|
|
28
|
-
],
|
|
29
|
-
setup(__props, { emit: __emit }) {
|
|
30
|
-
const isApp = computed(() => {
|
|
31
|
-
return !!_gct.store.appInfo.id;
|
|
32
|
-
});
|
|
33
|
-
const props = __props;
|
|
34
|
-
const emit = __emit;
|
|
35
|
-
const inputValue = computed({
|
|
36
|
-
get() {
|
|
37
|
-
return props.i18nText ?? "";
|
|
38
|
-
},
|
|
39
|
-
set(value) {
|
|
40
|
-
if (value !== props.i18nText) {
|
|
41
|
-
emit("update:i18nText", value);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const i18nConfigState = computed(() => {
|
|
46
|
-
if (isEmpty(props.i18nConfig)) {
|
|
47
|
-
return {};
|
|
48
|
-
}
|
|
49
|
-
if (typeof props.i18nConfig === "string") {
|
|
50
|
-
return JSON.parse(props.i18nConfig) ?? {};
|
|
51
|
-
}
|
|
52
|
-
return props.i18nConfig ?? {};
|
|
53
|
-
});
|
|
54
|
-
const i18nValue = computed(() => {
|
|
55
|
-
return i18nConfigState.value?.[props.attr];
|
|
56
|
-
});
|
|
57
|
-
const handleSelectI18n = (params) => {
|
|
58
|
-
console.log("emit", params);
|
|
59
|
-
if (params) {
|
|
60
|
-
if (isEmpty(inputValue.value) || props.forceUpdate === true) {
|
|
61
|
-
emit("update:i18nText", params.i18nTitle);
|
|
62
|
-
}
|
|
63
|
-
emit(
|
|
64
|
-
"update:i18nConfig",
|
|
65
|
-
JSON.stringify(
|
|
66
|
-
isEmpty(params) ? omit(i18nConfigState.value, props.attr) : { ...i18nConfigState.value, [props.attr]: params.i18nKey }
|
|
67
|
-
)
|
|
68
|
-
);
|
|
69
|
-
emit("on-i18n-select", params);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const inputRef = ref();
|
|
73
|
-
const handleFocus = () => {
|
|
74
|
-
emit("focus", inputRef.value);
|
|
75
|
-
};
|
|
76
|
-
const handleBlur = () => {
|
|
77
|
-
emit("blur", inputRef.value);
|
|
78
|
-
};
|
|
79
|
-
const i18nInputGroup = ref();
|
|
80
|
-
onClickOutside(i18nInputGroup, () => {
|
|
81
|
-
emit("clickOutside");
|
|
82
|
-
});
|
|
83
|
-
return (_ctx, _cache) => {
|
|
84
|
-
const _component_a_input = resolveComponent("a-input");
|
|
85
|
-
const _component_a_input_group = resolveComponent("a-input-group");
|
|
86
|
-
return openBlock(), createBlock(_component_a_input_group, {
|
|
87
|
-
id: "i18nInputGroup",
|
|
88
|
-
ref_key: "i18nInputGroup",
|
|
89
|
-
ref: i18nInputGroup,
|
|
90
|
-
compact: ""
|
|
91
|
-
}, {
|
|
92
|
-
default: withCtx(() => [
|
|
93
|
-
renderSlot(_ctx.$slots, "i18n-input", {}, () => [
|
|
94
|
-
createVNode(_component_a_input, mergeProps({
|
|
95
|
-
ref_key: "inputRef",
|
|
96
|
-
ref: inputRef
|
|
97
|
-
}, __props.inputExtraProps, {
|
|
98
|
-
value: inputValue.value,
|
|
99
|
-
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
|
|
100
|
-
valueModifiers: { trim: true },
|
|
101
|
-
style: {
|
|
102
|
-
height: __props.btnHeight ? __props.btnHeight : __props.size === unref(ButtonSize).SMALL ? "26px" : "32px",
|
|
103
|
-
width: !isApp.value ? "100%" : `calc(100% - ${__props.btnWidth ? __props.btnWidth : __props.size === unref(ButtonSize).SMALL ? "26px" : "32px"}`
|
|
104
|
-
},
|
|
105
|
-
placeholder: __props.placeholderText,
|
|
106
|
-
size: __props.size,
|
|
107
|
-
"allow-clear": "",
|
|
108
|
-
onFocus: handleFocus,
|
|
109
|
-
onBlur: handleBlur
|
|
110
|
-
}), null, 16, ["value", "style", "placeholder", "size"])
|
|
111
|
-
], true),
|
|
112
|
-
isApp.value ? (openBlock(), createBlock(I18nSelectBtn, {
|
|
113
|
-
key: 0,
|
|
114
|
-
"btn-height": __props.btnHeight,
|
|
115
|
-
"btn-width": __props.btnWidth,
|
|
116
|
-
"i18n-value": i18nValue.value,
|
|
117
|
-
size: __props.size,
|
|
118
|
-
"i18n-modal-key": __props.i18nModalKey,
|
|
119
|
-
onOnSelectI18n: handleSelectI18n,
|
|
120
|
-
onClosed: _cache[1] || (_cache[1] = ($event) => emit("clickOutside"))
|
|
121
|
-
}, null, 8, ["btn-height", "btn-width", "i18n-value", "size", "i18n-modal-key"])) : createCommentVNode("", true)
|
|
122
|
-
]),
|
|
123
|
-
_: 3
|
|
124
|
-
}, 512);
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
export { _sfc_main as default };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {
|
|
2
|
-
open: () => void;
|
|
3
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
4
|
-
export default _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createBlock, unref } from 'vue';
|
|
2
|
-
import { useModal } from '@gct-paas/core-web';
|
|
3
|
-
import I18nSelectContainer from './i18n-select-container.vue.mjs';
|
|
4
|
-
|
|
5
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
-
__name: "i18n-select-modal",
|
|
7
|
-
setup(__props, { expose: __expose }) {
|
|
8
|
-
const [register, { openModal }] = useModal();
|
|
9
|
-
const open = () => {
|
|
10
|
-
openModal();
|
|
11
|
-
};
|
|
12
|
-
__expose({
|
|
13
|
-
open
|
|
14
|
-
});
|
|
15
|
-
return (_ctx, _cache) => {
|
|
16
|
-
return openBlock(), createBlock(I18nSelectContainer, { onRegister: unref(register) }, null, 8, ["onRegister"]);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export { _sfc_main as default };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FormInstance, FormItemProps, InputProps } from 'ant-design-vue';
|
|
2
|
-
interface Props {
|
|
3
|
-
formItemName: string | string[];
|
|
4
|
-
fromItemExtraProps?: FormItemProps;
|
|
5
|
-
inputExtraProps?: InputProps;
|
|
6
|
-
i18nConfig?: string;
|
|
7
|
-
text?: string;
|
|
8
|
-
formRef?: FormInstance;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
|
-
"update:text": (...args: any[]) => void;
|
|
12
|
-
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
13
|
-
"onUpdate:text"?: ((...args: any[]) => any) | undefined;
|
|
14
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
15
|
-
export default _default;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, mergeProps, withCtx, createElementVNode, toDisplayString } from 'vue';
|
|
2
|
-
import I18nSelectTextarea from './i18n-select-textarea.vue.mjs';
|
|
3
|
-
|
|
4
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
-
__name: "i18n-select-textarea-form",
|
|
6
|
-
props: {
|
|
7
|
-
formItemName: {},
|
|
8
|
-
fromItemExtraProps: {},
|
|
9
|
-
inputExtraProps: {},
|
|
10
|
-
i18nConfig: {},
|
|
11
|
-
text: {},
|
|
12
|
-
formRef: {}
|
|
13
|
-
},
|
|
14
|
-
emits: ["update:text"],
|
|
15
|
-
setup(__props, { emit: __emit }) {
|
|
16
|
-
const props = __props;
|
|
17
|
-
const emit = __emit;
|
|
18
|
-
const i18nText = computed({
|
|
19
|
-
get() {
|
|
20
|
-
return props.text ?? "";
|
|
21
|
-
},
|
|
22
|
-
set(value) {
|
|
23
|
-
emit("update:text", value);
|
|
24
|
-
props.formRef?.validateFields([props.formItemName]);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return (_ctx, _cache) => {
|
|
28
|
-
const _component_a_form_item = resolveComponent("a-form-item");
|
|
29
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
30
|
-
createVNode(_component_a_form_item, mergeProps({ name: __props.formItemName }, __props.fromItemExtraProps), {
|
|
31
|
-
default: withCtx(() => [
|
|
32
|
-
createVNode(I18nSelectTextarea, mergeProps(_ctx.$attrs, {
|
|
33
|
-
"i18n-text": i18nText.value,
|
|
34
|
-
"onUpdate:i18nText": _cache[0] || (_cache[0] = ($event) => i18nText.value = $event),
|
|
35
|
-
"placeholder-text": _ctx.$t("sys.inputText"),
|
|
36
|
-
"input-extra-props": __props.inputExtraProps,
|
|
37
|
-
"i18n-config": __props.i18nConfig,
|
|
38
|
-
attr: Array.isArray(__props.formItemName) ? __props.formItemName.join(".") : __props.formItemName
|
|
39
|
-
}), null, 16, ["i18n-text", "placeholder-text", "input-extra-props", "i18n-config", "attr"])
|
|
40
|
-
]),
|
|
41
|
-
_: 1
|
|
42
|
-
}, 16, ["name"]),
|
|
43
|
-
createVNode(_component_a_form_item, {
|
|
44
|
-
name: "i18nConfig",
|
|
45
|
-
hidden: ""
|
|
46
|
-
}, {
|
|
47
|
-
default: withCtx(() => [
|
|
48
|
-
createElementVNode("span", null, toDisplayString(__props.i18nConfig), 1)
|
|
49
|
-
]),
|
|
50
|
-
_: 1
|
|
51
|
-
})
|
|
52
|
-
], 64);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export { _sfc_main as default };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[data-v-cd95c416] .i18n-icon {
|
|
2
|
-
position: absolute;
|
|
3
|
-
right: 16px;
|
|
4
|
-
bottom: 12px;
|
|
5
|
-
color: #212528;
|
|
6
|
-
font-size: 16px;
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
}
|
|
9
|
-
[data-v-cd95c416]
|
|
10
|
-
div.ant-input-textarea.ant-input-textarea-show-count.ant-input-textarea-show-count::after
|
|
11
|
-
{
|
|
12
|
-
right: 33px;
|
|
13
|
-
}
|
|
14
|
-
[data-v-cd95c416] .ant-input {
|
|
15
|
-
border: 2px dashed #dbdbdb;
|
|
16
|
-
background: transparent;
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { InputProps, TextAreaProps } from 'ant-design-vue';
|
|
2
|
-
interface Props {
|
|
3
|
-
attr: string;
|
|
4
|
-
inputExtraProps?: InputProps | TextAreaProps;
|
|
5
|
-
i18nConfig?: string | Record<string, string>;
|
|
6
|
-
i18nText?: string;
|
|
7
|
-
placeholderText?: string;
|
|
8
|
-
rows?: number;
|
|
9
|
-
style?: object;
|
|
10
|
-
}
|
|
11
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
12
|
-
"update:i18nText": (...args: any[]) => void;
|
|
13
|
-
"update:i18nConfig": (...args: any[]) => void;
|
|
14
|
-
"on-i18n-select": (...args: any[]) => void;
|
|
15
|
-
clickOutside: (...args: any[]) => void;
|
|
16
|
-
focus: (...args: any[]) => void;
|
|
17
|
-
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
18
|
-
"onUpdate:i18nText"?: ((...args: any[]) => any) | undefined;
|
|
19
|
-
"onUpdate:i18nConfig"?: ((...args: any[]) => any) | undefined;
|
|
20
|
-
"onOn-i18n-select"?: ((...args: any[]) => any) | undefined;
|
|
21
|
-
onClickOutside?: ((...args: any[]) => any) | undefined;
|
|
22
|
-
onFocus?: ((...args: any[]) => any) | undefined;
|
|
23
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
24
|
-
inputRef: unknown;
|
|
25
|
-
}, HTMLDivElement>;
|
|
26
|
-
export default _default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import _sfc_main from './i18n-select-textarea.vue2.mjs';
|
|
2
|
-
import './i18n-select-textarea.css';/* empty css */
|
|
3
|
-
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
|
|
4
|
-
|
|
5
|
-
const I18nSelectTextarea = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cd95c416"]]);
|
|
6
|
-
|
|
7
|
-
export { I18nSelectTextarea as default };
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, resolveComponent, openBlock, createElementBlock, createVNode, mergeProps } from 'vue';
|
|
2
|
-
import I18nSelectBtn from './i18n-select-btn.vue.mjs';
|
|
3
|
-
import { isEmpty, omit } from 'lodash-es';
|
|
4
|
-
|
|
5
|
-
const _hoisted_1 = { class: "inline-block w100% relative" };
|
|
6
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
-
__name: "i18n-select-textarea",
|
|
8
|
-
props: {
|
|
9
|
-
attr: {},
|
|
10
|
-
inputExtraProps: {},
|
|
11
|
-
i18nConfig: {},
|
|
12
|
-
i18nText: {},
|
|
13
|
-
placeholderText: {},
|
|
14
|
-
rows: {},
|
|
15
|
-
style: {}
|
|
16
|
-
},
|
|
17
|
-
emits: [
|
|
18
|
-
"update:i18nText",
|
|
19
|
-
"update:i18nConfig",
|
|
20
|
-
"on-i18n-select",
|
|
21
|
-
"clickOutside",
|
|
22
|
-
"focus"
|
|
23
|
-
],
|
|
24
|
-
setup(__props, { emit: __emit }) {
|
|
25
|
-
const props = __props;
|
|
26
|
-
const emit = __emit;
|
|
27
|
-
const inputValue = computed({
|
|
28
|
-
get() {
|
|
29
|
-
return props.i18nText ?? "";
|
|
30
|
-
},
|
|
31
|
-
set(value) {
|
|
32
|
-
emit("update:i18nText", value);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const i18nConfigState = computed(() => {
|
|
36
|
-
if (isEmpty(props.i18nConfig)) {
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
if (typeof props.i18nConfig === "string") {
|
|
40
|
-
return JSON.parse(props.i18nConfig) ?? {};
|
|
41
|
-
}
|
|
42
|
-
return props.i18nConfig ?? {};
|
|
43
|
-
});
|
|
44
|
-
const i18nValue = computed(() => {
|
|
45
|
-
return i18nConfigState.value?.[props.attr];
|
|
46
|
-
});
|
|
47
|
-
const handleSelectI18n = (params) => {
|
|
48
|
-
if (params) {
|
|
49
|
-
if (isEmpty(inputValue.value)) {
|
|
50
|
-
emit("update:i18nText", params.i18nTitle);
|
|
51
|
-
}
|
|
52
|
-
emit(
|
|
53
|
-
"update:i18nConfig",
|
|
54
|
-
JSON.stringify(
|
|
55
|
-
isEmpty(params) ? omit(i18nConfigState.value, props.attr) : { ...i18nConfigState.value, [props.attr]: params.i18nKey }
|
|
56
|
-
)
|
|
57
|
-
);
|
|
58
|
-
emit("on-i18n-select", params);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const inputRef = ref();
|
|
62
|
-
const handleFocus = () => {
|
|
63
|
-
emit("focus", inputRef.value);
|
|
64
|
-
};
|
|
65
|
-
return (_ctx, _cache) => {
|
|
66
|
-
const _component_a_textarea = resolveComponent("a-textarea");
|
|
67
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
68
|
-
createVNode(_component_a_textarea, mergeProps({
|
|
69
|
-
ref_key: "inputRef",
|
|
70
|
-
ref: inputRef,
|
|
71
|
-
value: inputValue.value,
|
|
72
|
-
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
|
|
73
|
-
placeholder: __props.placeholderText
|
|
74
|
-
}, __props.inputExtraProps, {
|
|
75
|
-
style: {
|
|
76
|
-
resize: "none",
|
|
77
|
-
...__props.style
|
|
78
|
-
},
|
|
79
|
-
onFocus: handleFocus
|
|
80
|
-
}), null, 16, ["value", "placeholder", "style"]),
|
|
81
|
-
createVNode(I18nSelectBtn, {
|
|
82
|
-
"i18n-value": i18nValue.value,
|
|
83
|
-
"simple-btn": true,
|
|
84
|
-
type: "text",
|
|
85
|
-
onOnSelectI18n: handleSelectI18n,
|
|
86
|
-
onClosed: _cache[1] || (_cache[1] = ($event) => emit("clickOutside"))
|
|
87
|
-
}, null, 8, ["i18n-value"])
|
|
88
|
-
]);
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
export { _sfc_main as default };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface I18nSelectProps {
|
|
2
|
-
i18nModalKey?: string;
|
|
3
|
-
saveCallback?: (params: IObject) => void;
|
|
4
|
-
destroyCallback?: (params: IObject) => void;
|
|
5
|
-
}
|
|
6
|
-
export interface IUseI18nSelectOptions {
|
|
7
|
-
target?: HTMLElement;
|
|
8
|
-
props?: Partial<I18nSelectProps>;
|
|
9
|
-
}
|
|
10
|
-
export declare function useI18nSelect(): {
|
|
11
|
-
open: (params: Partial<I18nSelectProps> | Partial<IUseI18nSelectOptions>) => void;
|
|
12
|
-
close: (callback: unknown) => void;
|
|
13
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ref, unref, createApp } from 'vue';
|
|
2
|
-
import { has } from 'lodash-es';
|
|
3
|
-
import _sfc_main from './i18n-select-modal.vue.mjs';
|
|
4
|
-
|
|
5
|
-
function useI18nSelect() {
|
|
6
|
-
let app = null;
|
|
7
|
-
let instance = null;
|
|
8
|
-
const i18nModalKey = ref("");
|
|
9
|
-
function open(params) {
|
|
10
|
-
let props;
|
|
11
|
-
let target = document.body;
|
|
12
|
-
if (has(params, "target") || has(params, "props")) {
|
|
13
|
-
const options = params;
|
|
14
|
-
props = options.props || {};
|
|
15
|
-
target = options.target || document.body;
|
|
16
|
-
} else {
|
|
17
|
-
props = params;
|
|
18
|
-
}
|
|
19
|
-
i18nModalKey.value = props.i18nModalKey || `i18n-select-modal-${Math.random().toString(16).substring(8)}`;
|
|
20
|
-
const propsData = {
|
|
21
|
-
...props,
|
|
22
|
-
destroyCallback: () => close(props?.destroyCallback),
|
|
23
|
-
i18nModalKey: unref(i18nModalKey)
|
|
24
|
-
};
|
|
25
|
-
if (!app) {
|
|
26
|
-
const container = document.createElement("div");
|
|
27
|
-
container.id = unref(i18nModalKey);
|
|
28
|
-
const t = unref(target);
|
|
29
|
-
t?.appendChild(container);
|
|
30
|
-
app = createApp(_sfc_main, propsData);
|
|
31
|
-
instance = app.mount(container);
|
|
32
|
-
}
|
|
33
|
-
instance?.open();
|
|
34
|
-
}
|
|
35
|
-
function close(callback) {
|
|
36
|
-
if (typeof callback === "function") {
|
|
37
|
-
callback();
|
|
38
|
-
}
|
|
39
|
-
document.querySelector(`#${unref(i18nModalKey)}`).remove();
|
|
40
|
-
if (app) {
|
|
41
|
-
app.unmount();
|
|
42
|
-
app = null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
open,
|
|
47
|
-
close
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { useI18nSelect };
|