@gct-paas/design-web 0.1.4-dev.11 → 0.1.4-dev.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/index.min.css +2 -1
  2. package/dist/loader.esm.min.js +778 -0
  3. package/es/_virtual/_plugin-vue_export-helper.mjs +7 -8
  4. package/es/components/I18nSelect/index.mjs +7 -0
  5. package/es/components/I18nSelect/src/i18n-modal.vue.mjs +5 -151
  6. package/es/components/I18nSelect/src/i18n-modal.vue_vue_type_script_setup_true_lang.mjs +128 -0
  7. package/es/components/I18nSelect/src/i18n-select-btn.vue.mjs +7 -7
  8. package/es/components/I18nSelect/src/i18n-select-btn.vue_vue_type_script_setup_true_name_i18n-select-btn_lang.mjs +116 -0
  9. package/es/components/I18nSelect/src/i18n-select-container.vue.mjs +7 -7
  10. package/es/components/I18nSelect/src/i18n-select-container.vue_vue_type_script_setup_true_name_i18n-select-container_lang.mjs +217 -0
  11. package/es/components/I18nSelect/src/i18n-select-input-form.vue.mjs +5 -57
  12. package/es/components/I18nSelect/src/i18n-select-input-form.vue_vue_type_script_setup_true_name_i18n-select-input-form_lang.mjs +56 -0
  13. package/es/components/I18nSelect/src/i18n-select-input.vue.mjs +7 -7
  14. package/es/components/I18nSelect/src/i18n-select-input.vue_vue_type_script_setup_true_name_i18n-select-input_lang.mjs +125 -0
  15. package/es/components/I18nSelect/src/i18n-select-modal.vue.mjs +5 -21
  16. package/es/components/I18nSelect/src/i18n-select-modal.vue_vue_type_script_setup_true_lang.mjs +19 -0
  17. package/es/components/I18nSelect/src/i18n-select-textarea-form.vue.mjs +5 -57
  18. package/es/components/I18nSelect/src/i18n-select-textarea-form.vue_vue_type_script_setup_true_name_i18n-select-input-form_lang.mjs +56 -0
  19. package/es/components/I18nSelect/src/i18n-select-textarea.vue.mjs +7 -7
  20. package/es/components/I18nSelect/src/i18n-select-textarea.vue_vue_type_script_setup_true_name_i18n-select-input_lang.mjs +86 -0
  21. package/es/components/I18nSelect/src/useI18nSelect.mjs +43 -48
  22. package/es/components/index.mjs +8 -0
  23. package/es/index.mjs +14 -15
  24. package/es/loader.d.ts +1 -0
  25. package/package.json +9 -9
  26. package/dist/index.esm.min.mjs +0 -836
  27. package/dist/index.min.cjs +0 -1
  28. package/dist/index.system.min.js +0 -1
  29. package/es/components/I18nSelect/src/i18n-modal.vue2.mjs +0 -5
  30. package/es/components/I18nSelect/src/i18n-select-btn.vue2.mjs +0 -138
  31. package/es/components/I18nSelect/src/i18n-select-container.vue2.mjs +0 -250
  32. package/es/components/I18nSelect/src/i18n-select-input-form.vue2.mjs +0 -5
  33. package/es/components/I18nSelect/src/i18n-select-input.vue2.mjs +0 -129
  34. package/es/components/I18nSelect/src/i18n-select-modal.vue2.mjs +0 -5
  35. package/es/components/I18nSelect/src/i18n-select-textarea-form.vue2.mjs +0 -5
  36. package/es/components/I18nSelect/src/i18n-select-textarea.vue2.mjs +0 -93
  37. /package/es/components/I18nSelect/src/{i18n-select-btn.css → i18n-select-btn.vue_vue_type_style_index_0_scoped_dc8ffb2c_lang.css} +0 -0
  38. /package/es/components/I18nSelect/src/{i18n-select-container.css → i18n-select-container.vue_vue_type_style_index_0_scoped_0160ed5e_lang.css} +0 -0
  39. /package/es/components/I18nSelect/src/{i18n-select-input.css → i18n-select-input.vue_vue_type_style_index_0_scoped_412e1309_lang.css} +0 -0
  40. /package/es/components/I18nSelect/src/{i18n-select-textarea.css → i18n-select-textarea.vue_vue_type_style_index_0_scoped_cd95c416_lang.css} +0 -0
@@ -1,9 +1,8 @@
1
- const _export_sfc = (sfc, props) => {
2
- const target = sfc.__vccOpts || sfc;
3
- for (const [key, val] of props) {
4
- target[key] = val;
5
- }
6
- return target;
1
+ //#region \0plugin-vue:export-helper
2
+ var _plugin_vue_export_helper_default = (sfc, props) => {
3
+ const target = sfc.__vccOpts || sfc;
4
+ for (const [key, val] of props) target[key] = val;
5
+ return target;
7
6
  };
8
-
9
- export { _export_sfc as default };
7
+ //#endregion
8
+ export { _plugin_vue_export_helper_default as default };
@@ -0,0 +1,7 @@
1
+ import "./src/i18n-modal.vue.mjs";
2
+ import "./src/useI18nSelect.mjs";
3
+ import "./src/i18n-select-btn.vue.mjs";
4
+ import "./src/i18n-select-input.vue.mjs";
5
+ import "./src/i18n-select-input-form.vue.mjs";
6
+ import "./src/i18n-select-textarea.vue.mjs";
7
+ import "./src/i18n-select-textarea-form.vue.mjs";
@@ -1,151 +1,5 @@
1
- import { defineComponent, ref, reactive, resolveComponent, openBlock, createBlock, mergeProps, unref, withCtx, createVNode, createElementBlock, Fragment, renderList, toRaw } from 'vue';
2
- import { t } from '@gct-paas/core';
3
- import { useModalInner } from '@gct-paas/core-web';
4
-
5
- const _sfc_main = /* @__PURE__ */ defineComponent({
6
- __name: "i18n-modal",
7
- props: {
8
- lang: {},
9
- getContainer: { type: Function }
10
- },
11
- emits: ["ok", "register"],
12
- setup(__props, { emit: __emit }) {
13
- const props = __props;
14
- const emit = __emit;
15
- const formRef = ref();
16
- const i18nState = reactive({
17
- id: ""
18
- });
19
- const isEdit = ref(false);
20
- const handleShow = (visible) => {
21
- if (visible) {
22
- isEdit.value = false;
23
- }
24
- };
25
- const [registerInner, { closeModal }] = useModalInner((data) => {
26
- data && onDataReceive(data);
27
- });
28
- const onDataReceive = (data) => {
29
- isEdit.value = true;
30
- i18nState.id = data.key;
31
- const { lang } = props;
32
- console.log(lang, "lang========");
33
- for (const item of lang) {
34
- const key = item.dataIndex;
35
- i18nState[key] = data[key];
36
- }
37
- };
38
- const validateSpecialCharacters = (_, value, callback) => {
39
- const reg = /^[a-zA-Z_.]*$/;
40
- if (!reg.test(value)) {
41
- callback(t("sys.i18n.validated18nKeyErrorMsg"));
42
- }
43
- callback();
44
- };
45
- const validateLang = async (_rule, value) => {
46
- const reg = /^\s*$/g;
47
- if (reg.test(value)) {
48
- return Promise.reject(t("sys.notEmptySth", { sth: t("sys.i18n") }));
49
- } else {
50
- return Promise.resolve();
51
- }
52
- };
53
- const handleOk = () => {
54
- formRef.value?.validate().then(() => {
55
- emit("ok", { ...toRaw(i18nState) }, isEdit.value);
56
- closeModal();
57
- });
58
- };
59
- const handleClose = () => {
60
- formRef.value?.resetFields();
61
- return void 0;
62
- };
63
- return (_ctx, _cache) => {
64
- const _component_a_input = resolveComponent("a-input");
65
- const _component_a_form_item = resolveComponent("a-form-item");
66
- const _component_a_form = resolveComponent("a-form");
67
- const _component_BasicModal = resolveComponent("BasicModal");
68
- return openBlock(), createBlock(_component_BasicModal, mergeProps(_ctx.$attrs, {
69
- title: isEdit.value ? unref(t)("sys.edit") : unref(t)("sys.new"),
70
- centered: "",
71
- width: "640px",
72
- "min-height": 100,
73
- "mask-closable": false,
74
- "after-close": handleClose,
75
- "get-container": __props.getContainer,
76
- onRegister: unref(registerInner),
77
- onOk: handleOk,
78
- onVisibleChange: handleShow
79
- }), {
80
- default: withCtx(() => [
81
- createVNode(_component_a_form, {
82
- ref_key: "formRef",
83
- ref: formRef,
84
- model: i18nState,
85
- "label-col": { span: 6 },
86
- "wrapper-col": { span: 16 },
87
- autocomplete: "off",
88
- layout: "horizontal"
89
- }, {
90
- default: withCtx(() => [
91
- createVNode(_component_a_form_item, {
92
- label: unref(t)("sys.i18n.resourceIdentification"),
93
- name: "id",
94
- rules: [
95
- {
96
- required: true,
97
- message: unref(t)("sys.pleaseInputSth", {
98
- sth: unref(t)("sys.i18n.resourceIdentification")
99
- })
100
- },
101
- { validator: validateSpecialCharacters }
102
- ]
103
- }, {
104
- default: withCtx(() => [
105
- createVNode(_component_a_input, {
106
- value: i18nState.id,
107
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => i18nState.id = $event),
108
- "show-count": "",
109
- maxlength: 128,
110
- disabled: isEdit.value
111
- }, null, 8, ["value", "disabled"])
112
- ]),
113
- _: 1
114
- }, 8, ["label", "rules"]),
115
- (openBlock(true), createElementBlock(Fragment, null, renderList(props.lang, (item) => {
116
- return openBlock(), createBlock(_component_a_form_item, {
117
- key: item.dataIndex,
118
- label: item.title,
119
- name: item.dataIndex,
120
- rules: [
121
- {
122
- required: true,
123
- message: unref(t)("sys.pleaseInputSth", { sth: item.title })
124
- },
125
- {
126
- validator: validateLang
127
- }
128
- ]
129
- }, {
130
- default: withCtx(() => [
131
- createVNode(_component_a_input, {
132
- value: i18nState[item.dataIndex],
133
- "onUpdate:value": ($event) => i18nState[item.dataIndex] = $event,
134
- "show-count": "",
135
- maxlength: 300
136
- }, null, 8, ["value", "onUpdate:value"])
137
- ]),
138
- _: 2
139
- }, 1032, ["label", "name", "rules"]);
140
- }), 128))
141
- ]),
142
- _: 1
143
- }, 8, ["model"])
144
- ]),
145
- _: 1
146
- }, 16, ["title", "get-container", "onRegister"]);
147
- };
148
- }
149
- });
150
-
151
- export { _sfc_main as default };
1
+ import i18n_modal_vue_vue_type_script_setup_true_lang_default from "./i18n-modal.vue_vue_type_script_setup_true_lang.mjs";
2
+ //#region src/components/I18nSelect/src/i18n-modal.vue
3
+ var i18n_modal_default = i18n_modal_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { i18n_modal_default as default };
@@ -0,0 +1,128 @@
1
+ import { Fragment, createBlock, createElementBlock, createVNode, defineComponent, mergeProps, openBlock, reactive, ref, renderList, resolveComponent, toRaw, unref, withCtx } from "vue";
2
+ import { useModalInner } from "@gct-paas/core-web";
3
+ import { t } from "@gct-paas/core";
4
+ //#region src/components/I18nSelect/src/i18n-modal.vue?vue&type=script&setup=true&lang.ts
5
+ var i18n_modal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6
+ __name: "i18n-modal",
7
+ props: {
8
+ lang: {},
9
+ getContainer: { type: Function }
10
+ },
11
+ emits: ["ok", "register"],
12
+ setup(__props, { emit: __emit }) {
13
+ const props = __props;
14
+ const emit = __emit;
15
+ const formRef = ref();
16
+ const i18nState = reactive({ id: "" });
17
+ const isEdit = ref(false);
18
+ const handleShow = (visible) => {
19
+ if (visible) isEdit.value = false;
20
+ };
21
+ const [registerInner, { closeModal }] = useModalInner((data) => {
22
+ data && onDataReceive(data);
23
+ });
24
+ const onDataReceive = (data) => {
25
+ isEdit.value = true;
26
+ i18nState.id = data.key;
27
+ const { lang } = props;
28
+ console.log(lang, "lang========");
29
+ for (const item of lang) {
30
+ const key = item.dataIndex;
31
+ i18nState[key] = data[key];
32
+ }
33
+ };
34
+ const validateSpecialCharacters = (_, value, callback) => {
35
+ if (!/^[a-zA-Z_.]*$/.test(value)) callback(t("sys.i18n.validated18nKeyErrorMsg"));
36
+ callback();
37
+ };
38
+ const validateLang = async (_rule, value) => {
39
+ if (/^\s*$/g.test(value)) return Promise.reject(t("sys.notEmptySth", { sth: t("sys.i18n") }));
40
+ else return Promise.resolve();
41
+ };
42
+ const handleOk = () => {
43
+ formRef.value?.validate().then(() => {
44
+ emit("ok", { ...toRaw(i18nState) }, isEdit.value);
45
+ closeModal();
46
+ });
47
+ };
48
+ const handleClose = () => {
49
+ formRef.value?.resetFields();
50
+ };
51
+ return (_ctx, _cache) => {
52
+ const _component_a_input = resolveComponent("a-input");
53
+ const _component_a_form_item = resolveComponent("a-form-item");
54
+ const _component_a_form = resolveComponent("a-form");
55
+ const _component_BasicModal = resolveComponent("BasicModal");
56
+ return openBlock(), createBlock(_component_BasicModal, mergeProps(_ctx.$attrs, {
57
+ title: isEdit.value ? unref(t)("sys.edit") : unref(t)("sys.new"),
58
+ centered: "",
59
+ width: "640px",
60
+ "min-height": 100,
61
+ "mask-closable": false,
62
+ "after-close": handleClose,
63
+ "get-container": __props.getContainer,
64
+ onRegister: unref(registerInner),
65
+ onOk: handleOk,
66
+ onVisibleChange: handleShow
67
+ }), {
68
+ default: withCtx(() => [createVNode(_component_a_form, {
69
+ ref_key: "formRef",
70
+ ref: formRef,
71
+ model: i18nState,
72
+ "label-col": { span: 6 },
73
+ "wrapper-col": { span: 16 },
74
+ autocomplete: "off",
75
+ layout: "horizontal"
76
+ }, {
77
+ default: withCtx(() => [createVNode(_component_a_form_item, {
78
+ label: unref(t)("sys.i18n.resourceIdentification"),
79
+ name: "id",
80
+ rules: [{
81
+ required: true,
82
+ message: unref(t)("sys.pleaseInputSth", { sth: unref(t)("sys.i18n.resourceIdentification") })
83
+ }, { validator: validateSpecialCharacters }]
84
+ }, {
85
+ default: withCtx(() => [createVNode(_component_a_input, {
86
+ value: i18nState.id,
87
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => i18nState.id = $event),
88
+ "show-count": "",
89
+ maxlength: 128,
90
+ disabled: isEdit.value
91
+ }, null, 8, ["value", "disabled"])]),
92
+ _: 1
93
+ }, 8, ["label", "rules"]), (openBlock(true), createElementBlock(Fragment, null, renderList(props.lang, (item) => {
94
+ return openBlock(), createBlock(_component_a_form_item, {
95
+ key: item.dataIndex,
96
+ label: item.title,
97
+ name: item.dataIndex,
98
+ rules: [{
99
+ required: true,
100
+ message: unref(t)("sys.pleaseInputSth", { sth: item.title })
101
+ }, { validator: validateLang }]
102
+ }, {
103
+ default: withCtx(() => [createVNode(_component_a_input, {
104
+ value: i18nState[item.dataIndex],
105
+ "onUpdate:value": ($event) => i18nState[item.dataIndex] = $event,
106
+ "show-count": "",
107
+ maxlength: 300
108
+ }, null, 8, ["value", "onUpdate:value"])]),
109
+ _: 2
110
+ }, 1032, [
111
+ "label",
112
+ "name",
113
+ "rules"
114
+ ]);
115
+ }), 128))]),
116
+ _: 1
117
+ }, 8, ["model"])]),
118
+ _: 1
119
+ }, 16, [
120
+ "title",
121
+ "get-container",
122
+ "onRegister"
123
+ ]);
124
+ };
125
+ }
126
+ });
127
+ //#endregion
128
+ export { i18n_modal_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,7 +1,7 @@
1
- import _sfc_main from './i18n-select-btn.vue2.mjs';
2
- import './i18n-select-btn.css';/* empty css */
3
- import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
4
-
5
- const I18nSelectBtn = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dc8ffb2c"]]);
6
-
7
- export { I18nSelectBtn as default };
1
+ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.mjs";
2
+ import i18n_select_btn_vue_vue_type_script_setup_true_name_i18n_select_btn_lang_default from "./i18n-select-btn.vue_vue_type_script_setup_true_name_i18n-select-btn_lang.mjs";
3
+ import './i18n-select-btn.vue_vue_type_style_index_0_scoped_dc8ffb2c_lang.css';/* empty css */
4
+ //#region src/components/I18nSelect/src/i18n-select-btn.vue
5
+ var i18n_select_btn_default = /* @__PURE__ */ _plugin_vue_export_helper_default(i18n_select_btn_vue_vue_type_script_setup_true_name_i18n_select_btn_lang_default, [["__scopeId", "data-v-dc8ffb2c"]]);
6
+ //#endregion
7
+ export { i18n_select_btn_default as default };
@@ -0,0 +1,116 @@
1
+ import { useI18nSelect } from "./useI18nSelect.mjs";
2
+ import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, reactive, ref, renderList, resolveComponent, toDisplayString, watch, withCtx } from "vue";
3
+ import { isEmpty } from "lodash-es";
4
+ //#region src/components/I18nSelect/src/i18n-select-btn.vue?vue&type=script&setup=true&name=i18n-select-btn&lang.ts
5
+ var _hoisted_1 = { class: "i18n-tooltip-title" };
6
+ var _hoisted_2 = { style: { "margin-left": "4px" } };
7
+ var i18n_select_btn_vue_vue_type_script_setup_true_name_i18n_select_btn_lang_default = /* @__PURE__ */ defineComponent({
8
+ __name: "i18n-select-btn",
9
+ props: {
10
+ i18nValue: {},
11
+ buttonExtraProps: {},
12
+ size: {},
13
+ i18nModalKey: {},
14
+ simpleBtn: { type: Boolean },
15
+ btnHeight: {},
16
+ btnWidth: {}
17
+ },
18
+ emits: ["on-select-i18n", "closed"],
19
+ setup(__props, { emit: __emit }) {
20
+ const getEnableLocaleList = ref();
21
+ const i18nInstance = useI18nSelect();
22
+ const props = __props;
23
+ const emit = __emit;
24
+ const i18nMap = reactive({});
25
+ const isHighlight = computed(() => {
26
+ return !isEmpty(props.i18nValue);
27
+ });
28
+ const getTableData = async (keyword) => {
29
+ const result = await _api.apaas.i18NInfo.getPageList({
30
+ pageNo: 1,
31
+ pageSize: 20,
32
+ searchKey: keyword
33
+ });
34
+ if (result && result.data) {
35
+ const row = result.data.find((item) => item.key === props.i18nValue);
36
+ if (row) Object.assign(i18nMap, Object.fromEntries(Object.entries(JSON.parse(row.info)).map(([_, item]) => [item.locale, item.info])));
37
+ }
38
+ };
39
+ watch(() => props.i18nValue, () => {
40
+ if (!isEmpty(props.i18nValue)) getTableData(props.i18nValue);
41
+ }, { immediate: true });
42
+ const handleOpenI18nSelectModal = () => {
43
+ i18nInstance.open({
44
+ i18nModalKey: props.i18nModalKey,
45
+ saveCallback: (params) => {
46
+ emit("on-select-i18n", { ...params });
47
+ },
48
+ destroyCallback: () => {
49
+ emit("closed");
50
+ }
51
+ });
52
+ };
53
+ return (_ctx, _cache) => {
54
+ const _component_Icon = resolveComponent("Icon");
55
+ const _component_a_button = resolveComponent("a-button");
56
+ const _component_a_tooltip = resolveComponent("a-tooltip");
57
+ return __props.simpleBtn ? (openBlock(), createBlock(_component_Icon, {
58
+ key: 0,
59
+ class: normalizeClass(["i18n-icon simple-btn", { "is-highlight": isHighlight.value }]),
60
+ icon: "ion:language",
61
+ onClick: handleOpenI18nSelectModal
62
+ }, null, 8, ["class"])) : isHighlight.value ? (openBlock(), createBlock(_component_a_tooltip, {
63
+ key: 1,
64
+ color: "#fff",
65
+ placement: "topRight"
66
+ }, {
67
+ title: withCtx(() => [createElementVNode("div", _hoisted_1, "语言标识:" + toDisplayString(__props.i18nValue), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(getEnableLocaleList.value, (item) => {
68
+ return openBlock(), createElementBlock("div", {
69
+ key: item.id,
70
+ class: "i18n-tooltip-item"
71
+ }, [createElementVNode("strong", null, toDisplayString(item.language) + ": ", 1), createElementVNode("span", _hoisted_2, toDisplayString(i18nMap[item.languageTag]), 1)]);
72
+ }), 128))]),
73
+ default: withCtx(() => [createVNode(_component_a_button, mergeProps(__props.buttonExtraProps, {
74
+ class: { "is-highlight": isHighlight.value },
75
+ style: {
76
+ "--btn-width": __props.btnWidth,
77
+ "--btn-height": __props.btnHeight
78
+ },
79
+ size: __props.size,
80
+ onClick: handleOpenI18nSelectModal
81
+ }), {
82
+ icon: withCtx(() => [createVNode(_component_Icon, {
83
+ class: "i18n-icon",
84
+ icon: "ion:language"
85
+ })]),
86
+ _: 1
87
+ }, 16, [
88
+ "class",
89
+ "style",
90
+ "size"
91
+ ])]),
92
+ _: 1
93
+ })) : (openBlock(), createBlock(_component_a_button, mergeProps({ key: 2 }, __props.buttonExtraProps, {
94
+ class: { "is-highlight": isHighlight.value },
95
+ style: {
96
+ "--btn-width": __props.btnWidth,
97
+ "--btn-height": __props.btnHeight
98
+ },
99
+ size: __props.size,
100
+ onClick: handleOpenI18nSelectModal
101
+ }), {
102
+ icon: withCtx(() => [createVNode(_component_Icon, {
103
+ class: "i18n-icon",
104
+ icon: "ion:language"
105
+ })]),
106
+ _: 1
107
+ }, 16, [
108
+ "class",
109
+ "style",
110
+ "size"
111
+ ]));
112
+ };
113
+ }
114
+ });
115
+ //#endregion
116
+ export { i18n_select_btn_vue_vue_type_script_setup_true_name_i18n_select_btn_lang_default as default };
@@ -1,7 +1,7 @@
1
- import _sfc_main from './i18n-select-container.vue2.mjs';
2
- import './i18n-select-container.css';/* empty css */
3
- import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
4
-
5
- const I18nSelectContainer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0160ed5e"]]);
6
-
7
- export { I18nSelectContainer as default };
1
+ import i18n_select_container_vue_vue_type_script_setup_true_name_i18n_select_container_lang_default from "./i18n-select-container.vue_vue_type_script_setup_true_name_i18n-select-container_lang.mjs";
2
+ import './i18n-select-container.vue_vue_type_style_index_0_scoped_0160ed5e_lang.css';/* empty css */
3
+ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
+ //#region src/components/I18nSelect/src/i18n-select-container.vue
5
+ var i18n_select_container_default = /* @__PURE__ */ _plugin_vue_export_helper_default(i18n_select_container_vue_vue_type_script_setup_true_name_i18n_select_container_lang_default, [["__scopeId", "data-v-0160ed5e"]]);
6
+ //#endregion
7
+ export { i18n_select_container_default as default };
@@ -0,0 +1,217 @@
1
+ import i18n_modal_default from "./i18n-modal.vue.mjs";
2
+ import { computed, createBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, onMounted, openBlock, reactive, ref, resolveComponent, toDisplayString, unref, withCtx } from "vue";
3
+ import { useModal, useModalInner } from "@gct-paas/core-web";
4
+ import { SearchOutlined } from "@ant-design/icons-vue";
5
+ import { t } from "@gct-paas/core";
6
+ //#region src/components/I18nSelect/src/i18n-select-container.vue?vue&type=script&setup=true&name=i18n-select-container&lang.ts
7
+ var _hoisted_1 = { class: "i18n-select-container" };
8
+ var _hoisted_2 = { class: "table-wrap" };
9
+ var i18n_select_container_vue_vue_type_script_setup_true_name_i18n_select_container_lang_default = /* @__PURE__ */ defineComponent({
10
+ __name: "i18n-select-container",
11
+ props: {
12
+ i18nModalKey: {},
13
+ destroyCallback: { type: Function },
14
+ saveCallback: { type: Function }
15
+ },
16
+ setup(__props) {
17
+ const [registerInner, { closeModal }] = useModalInner();
18
+ const [userRegister, { openModal }] = useModal();
19
+ const props = __props;
20
+ const getContainer = () => document.querySelector(`#${props.i18nModalKey}`);
21
+ const formRef = ref();
22
+ const formState = reactive({ keywords: "" });
23
+ const pagination = reactive({
24
+ current: 1,
25
+ pageSize: 5,
26
+ total: 0,
27
+ size: "small",
28
+ showTotal: (total) => t("sys.component.table.total", { total })
29
+ });
30
+ const tableData = ref([]);
31
+ const selectRows = ref();
32
+ const rowSelection = ref({
33
+ type: "radio",
34
+ hideSelectAll: true,
35
+ selectedRowKeys: [],
36
+ onChange: handleRowChange
37
+ });
38
+ const loading = ref(false);
39
+ const columns = computed(() => {
40
+ return [];
41
+ });
42
+ const getTableData = async (keyword, current) => {
43
+ loading.value = true;
44
+ const result = await _api.apaas.i18NInfo.getPageList({
45
+ pageNo: current ?? pagination.current,
46
+ pageSize: pagination.pageSize,
47
+ searchKey: keyword
48
+ });
49
+ loading.value = false;
50
+ if (result && result.data) {
51
+ const rows = result.data.map((item) => {
52
+ const infos = JSON.parse(item?.info);
53
+ return {
54
+ key: item.key,
55
+ type: item.type,
56
+ ...Object.fromEntries(infos.map((i) => [i.locale, i.info]))
57
+ };
58
+ });
59
+ pagination.total = result.totalCount;
60
+ tableData.value = rows;
61
+ }
62
+ };
63
+ onMounted(getTableData);
64
+ const handleSearch = () => {
65
+ formRef.value?.validate().then(async () => {
66
+ await getTableData(formState.keywords, 1);
67
+ });
68
+ };
69
+ const handleTableChange = (paginationInfo) => {
70
+ const { current, total, pageSize } = paginationInfo;
71
+ pagination.current = current;
72
+ pagination.total = total;
73
+ pagination.pageSize = pageSize;
74
+ getTableData();
75
+ };
76
+ const handleAddI18n = () => {
77
+ openModal();
78
+ };
79
+ const handleModalOk = async (data, isEdit) => {
80
+ const langInfos = columns.value.map((item) => {
81
+ return {
82
+ locale: item.dataIndex,
83
+ info: data[item.dataIndex]
84
+ };
85
+ });
86
+ loading.value = true;
87
+ try {
88
+ if (isEdit) await _api.apaas.i18NInfo.putKey({ key: data.id }, { info: JSON.stringify(langInfos) });
89
+ else await _api.apaas.i18NInfo.post({
90
+ info: JSON.stringify(langInfos),
91
+ key: data.id
92
+ });
93
+ getTableData();
94
+ handleRowChange([data.id], [reactive(data)]);
95
+ } catch (error) {
96
+ loading.value = false;
97
+ }
98
+ };
99
+ function handleRowChange(selectedRowKeys, selectedRows) {
100
+ rowSelection.value.selectedRowKeys = selectedRowKeys;
101
+ selectRows.value = selectedRows;
102
+ }
103
+ const handleClose = () => {
104
+ if (props.destroyCallback && typeof props.destroyCallback === "function") props.destroyCallback();
105
+ };
106
+ const handleOk = async () => {
107
+ if (props.saveCallback && typeof props.saveCallback === "function") {
108
+ const selectRowKey = rowSelection.value.selectedRowKeys;
109
+ const params = {};
110
+ if (selectRowKey && selectRowKey[0]) {
111
+ const selectRow = selectRows.value?.[0];
112
+ console.log("selectRow", selectRow);
113
+ Object.assign(params, { i18nKey: selectRowKey[0] });
114
+ }
115
+ props.saveCallback(params);
116
+ }
117
+ closeModal();
118
+ };
119
+ return (_ctx, _cache) => {
120
+ const _component_a_input = resolveComponent("a-input");
121
+ const _component_a_form_item = resolveComponent("a-form-item");
122
+ const _component_a_col = resolveComponent("a-col");
123
+ const _component_a_button = resolveComponent("a-button");
124
+ const _component_plus_outlined = resolveComponent("plus-outlined");
125
+ const _component_a_row = resolveComponent("a-row");
126
+ const _component_a_form = resolveComponent("a-form");
127
+ const _component_a_table = resolveComponent("a-table");
128
+ const _component_basic_modal = resolveComponent("basic-modal");
129
+ return openBlock(), createBlock(_component_basic_modal, mergeProps(_ctx.$attrs, {
130
+ "min-height": 40,
131
+ title: unref(t)("sys.i18n.i18nConfig"),
132
+ centered: "",
133
+ width: "640px",
134
+ "can-fullscreen": false,
135
+ "mask-closable": false,
136
+ "after-close": handleClose,
137
+ "get-container": getContainer,
138
+ onRegister: unref(registerInner),
139
+ onOk: handleOk
140
+ }), {
141
+ default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(_component_a_form, {
142
+ ref_key: "formRef",
143
+ ref: formRef,
144
+ model: formState,
145
+ autocomplete: "off",
146
+ layout: "horizontal"
147
+ }, {
148
+ default: withCtx(() => [createVNode(_component_a_row, null, {
149
+ default: withCtx(() => [createVNode(_component_a_col, { span: 12 }, {
150
+ default: withCtx(() => [createVNode(_component_a_form_item, {
151
+ name: "keywords",
152
+ label: unref(t)("sys.keywords")
153
+ }, {
154
+ default: withCtx(() => [createVNode(_component_a_input, {
155
+ value: formState.keywords,
156
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => formState.keywords = $event),
157
+ placeholder: unref(t)("sys.keywordsPlaceholder"),
158
+ style: { "display": "inline-flex" }
159
+ }, null, 8, ["value", "placeholder"])]),
160
+ _: 1
161
+ }, 8, ["label"])]),
162
+ _: 1
163
+ }), createVNode(_component_a_col, {
164
+ span: 12,
165
+ style: { "text-align": "right" }
166
+ }, {
167
+ default: withCtx(() => [createVNode(_component_a_button, {
168
+ type: "primary",
169
+ onClick: handleSearch
170
+ }, {
171
+ icon: withCtx(() => [createVNode(unref(SearchOutlined))]),
172
+ default: withCtx(() => [createTextVNode(" " + toDisplayString(unref(t)("sys.queryText")), 1)]),
173
+ _: 1
174
+ }), createVNode(_component_a_button, {
175
+ style: { "margin": "0 8px" },
176
+ type: "primary",
177
+ onClick: handleAddI18n
178
+ }, {
179
+ icon: withCtx(() => [createVNode(_component_plus_outlined)]),
180
+ default: withCtx(() => [createTextVNode(" " + toDisplayString(unref(t)("sys.new")), 1)]),
181
+ _: 1
182
+ })]),
183
+ _: 1
184
+ })]),
185
+ _: 1
186
+ })]),
187
+ _: 1
188
+ }, 8, ["model"]), createElementVNode("div", _hoisted_2, [createVNode(_component_a_table, {
189
+ ref: "tableRef",
190
+ "data-source": tableData.value,
191
+ columns: columns.value,
192
+ "show-index-column": false,
193
+ pagination,
194
+ striped: false,
195
+ bordered: true,
196
+ "row-selection": rowSelection.value,
197
+ loading: loading.value,
198
+ onChange: handleTableChange
199
+ }, null, 8, [
200
+ "data-source",
201
+ "columns",
202
+ "pagination",
203
+ "row-selection",
204
+ "loading"
205
+ ]), createVNode(i18n_modal_default, {
206
+ lang: columns.value,
207
+ "get-container": getContainer,
208
+ onRegister: unref(userRegister),
209
+ onOk: handleModalOk
210
+ }, null, 8, ["lang", "onRegister"])])])]),
211
+ _: 1
212
+ }, 16, ["title", "onRegister"]);
213
+ };
214
+ }
215
+ });
216
+ //#endregion
217
+ export { i18n_select_container_vue_vue_type_script_setup_true_name_i18n_select_container_lang_default as default };