@fangzhongya/fang-ui 0.0.60 → 0.0.61
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/components/array/src/index2.cjs +10 -12
- package/dist/components/array/src/index2.js +10 -12
- package/dist/components/box/index.css +2 -1
- package/dist/components/box-adjust/index.css +2 -1
- package/dist/components/box-adjust/src/data.cjs +2 -3
- package/dist/components/box-adjust/src/data.d.ts +1 -2
- package/dist/components/box-adjust/src/data.js +2 -3
- package/dist/components/box-adjust/src/index2.cjs +27 -22
- package/dist/components/box-adjust/src/index2.js +15 -10
- package/dist/components/box-local/index.css +2 -1
- package/dist/components/box-title/index.css +2 -1
- package/dist/components/box-title/index.scss +2 -1
- package/dist/components/box-title/src/data.cjs +2 -1
- package/dist/components/box-title/src/data.d.ts +1 -0
- package/dist/components/box-title/src/data.js +2 -1
- package/dist/components/box-title/src/index2.cjs +13 -12
- package/dist/components/box-title/src/index2.js +14 -13
- package/dist/components/common/use.cjs +16 -0
- package/dist/components/common/use.d.ts +3 -0
- package/dist/components/common/use.js +16 -0
- package/dist/components/dialogs/src/index2.cjs +8 -9
- package/dist/components/dialogs/src/index2.js +8 -9
- package/dist/components/edit/src/data.cjs +1 -0
- package/dist/components/edit/src/data.d.ts +1 -0
- package/dist/components/edit/src/data.js +1 -0
- package/dist/components/edit/src/index2.cjs +10 -3
- package/dist/components/edit/src/index2.js +10 -3
- package/dist/components/edit-float/index.css +1 -2
- package/dist/components/edit-float/index.scss +1 -2
- package/dist/components/edit-float/src/data.cjs +1 -0
- package/dist/components/edit-float/src/data.d.ts +1 -0
- package/dist/components/edit-float/src/data.js +1 -0
- package/dist/components/edit-float/src/index2.cjs +21 -19
- package/dist/components/edit-float/src/index2.js +16 -14
- package/dist/components/index.scss +1 -1
- package/dist/components/index2.scss +1 -1
- package/dist/components/no-data/src/index2.cjs +6 -6
- package/dist/components/no-data/src/index2.js +6 -6
- package/dist/components/popup/index.css +2 -1
- package/dist/components/popup/src/data.cjs +2 -3
- package/dist/components/popup/src/data.d.ts +1 -2
- package/dist/components/popup/src/data.js +2 -3
- package/dist/components/popup/src/index2.cjs +15 -9
- package/dist/components/popup/src/index2.js +16 -10
- package/dist/components/window/index.css +2 -1
- package/dist/components/window/src/data.cjs +2 -3
- package/dist/components/window/src/data.d.ts +1 -2
- package/dist/components/window/src/data.js +2 -3
- package/dist/components/window/src/index2.cjs +15 -9
- package/dist/components/window/src/index2.js +15 -9
- package/dist/css/box-adjust.css +2 -1
- package/dist/css/box-local.css +2 -1
- package/dist/css/box-title.css +2 -1
- package/dist/css/box.css +2 -1
- package/dist/css/edit-float.css +1 -2
- package/dist/css/index.css +3 -25
- package/dist/css/popup.css +2 -1
- package/dist/css/window.css +2 -1
- package/dist/directives/drag/index.cjs +3 -2
- package/dist/directives/drag/index.js +3 -2
- package/dist/hooks/index.cjs +0 -1
- package/dist/hooks/index.js +1 -2
- package/dist/hooks/locale/index.cjs +5 -45
- package/dist/hooks/locale/index.d.ts +0 -9
- package/dist/hooks/locale/index.js +5 -45
- package/dist/icons/index.css +33 -33
- package/dist/icons/index.json +11 -11
- package/dist/index.css +3 -25
- package/dist/locale/en.cjs +1 -0
- package/dist/locale/en.d.ts +1 -0
- package/dist/locale/en.js +1 -0
- package/dist/locale/zh-cn.cjs +1 -0
- package/dist/locale/zh-cn.d.ts +1 -0
- package/dist/locale/zh-cn.js +1 -0
- package/package.json +7 -7
- /package/dist/components/{keep-com → transfer}/index.css +0 -0
- /package/dist/css/{keep-com.css → transfer.css} +0 -0
|
@@ -16,6 +16,7 @@ const index$3 = require("../../box-mask/index.cjs");
|
|
|
16
16
|
const index$2 = require("../../box-teleport/index.cjs");
|
|
17
17
|
const setClassName = require("@fangzhongya/utils/css/setClassName");
|
|
18
18
|
const index$6 = require("../../../directives/drag/index.cjs");
|
|
19
|
+
const use = require("../../common/use.cjs");
|
|
19
20
|
const _hoisted_1 = ["title"];
|
|
20
21
|
const _hoisted_2 = ["title"];
|
|
21
22
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -27,7 +28,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
27
28
|
const refBody = vue.shallowRef();
|
|
28
29
|
const { getLocale } = index.useLocale();
|
|
29
30
|
const cs = index$1.useCssName("window");
|
|
30
|
-
const
|
|
31
|
+
const prs = __props;
|
|
32
|
+
const props = use.uesPropsDefault(prs, {
|
|
33
|
+
drag() {
|
|
34
|
+
return "." + cs.name + "box-title-name";
|
|
35
|
+
}
|
|
36
|
+
});
|
|
31
37
|
const emit = __emit;
|
|
32
38
|
const isMax = vue.shallowRef(props.max);
|
|
33
39
|
const isMin = vue.shallowRef(false);
|
|
@@ -189,8 +195,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
189
195
|
});
|
|
190
196
|
return (_ctx, _cache) => {
|
|
191
197
|
return vue.openBlock(), vue.createBlock(vue.unref(index$2.BoxTeleport), {
|
|
192
|
-
disabled: props.disabled,
|
|
193
|
-
to: props.to
|
|
198
|
+
disabled: vue.unref(props).disabled,
|
|
199
|
+
to: vue.unref(props).to
|
|
194
200
|
}, {
|
|
195
201
|
default: vue.withCtx(() => [
|
|
196
202
|
!isClose.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -199,10 +205,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
199
205
|
ref: refBox,
|
|
200
206
|
class: vue.normalizeClass(vue.unref(cs).z())
|
|
201
207
|
}, [
|
|
202
|
-
props.mask ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.BoxMask), {
|
|
208
|
+
vue.unref(props).mask ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.BoxMask), {
|
|
203
209
|
key: 0,
|
|
204
210
|
onClick: onMaskClose,
|
|
205
|
-
cssprefix: props.cssprefix || vue.unref(cs).z()
|
|
211
|
+
cssprefix: vue.unref(props).cssprefix || vue.unref(cs).z()
|
|
206
212
|
}, null, 8, ["cssprefix"])) : vue.createCommentVNode("", true),
|
|
207
213
|
vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
208
214
|
ref_key: "refBody",
|
|
@@ -212,10 +218,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
212
218
|
vue.renderSlot(_ctx.$slots, vue.unref(data.dataSlot).title, {}, () => [
|
|
213
219
|
vue.createVNode(vue.unref(index$4.BoxTitle), {
|
|
214
220
|
onClose,
|
|
215
|
-
title: props.title
|
|
221
|
+
title: vue.unref(props).title
|
|
216
222
|
}, {
|
|
217
223
|
icon: vue.withCtx(() => [
|
|
218
|
-
!props.noMin ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
224
|
+
!vue.unref(props).noMin ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
219
225
|
key: 0,
|
|
220
226
|
title: vue.unref(getLocale)("minh"),
|
|
221
227
|
onClick: onMin,
|
|
@@ -264,11 +270,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
264
270
|
vue.renderSlot(_ctx.$slots, vue.unref(data.dataSlot).footer)
|
|
265
271
|
], 2)), [
|
|
266
272
|
[vue.unref(index$6.default), {
|
|
267
|
-
dom: props.drag,
|
|
273
|
+
dom: vue.unref(props).drag,
|
|
268
274
|
onMousedown
|
|
269
275
|
}],
|
|
270
276
|
[vue.unref(index$7.default), {
|
|
271
|
-
often: props.often,
|
|
277
|
+
often: vue.unref(props).often,
|
|
272
278
|
onChange: onChangeAdjust,
|
|
273
279
|
all: { position: true, getDisabled }
|
|
274
280
|
}]
|
|
@@ -14,6 +14,7 @@ import { BoxMask } from "../../box-mask/index.js";
|
|
|
14
14
|
import { BoxTeleport } from "../../box-teleport/index.js";
|
|
15
15
|
import { setClassName } from "@fangzhongya/utils/css/setClassName";
|
|
16
16
|
import vDrag from "../../../directives/drag/index.js";
|
|
17
|
+
import { uesPropsDefault } from "../../common/use.js";
|
|
17
18
|
const _hoisted_1 = ["title"];
|
|
18
19
|
const _hoisted_2 = ["title"];
|
|
19
20
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -25,7 +26,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
25
26
|
const refBody = shallowRef();
|
|
26
27
|
const { getLocale } = useLocale();
|
|
27
28
|
const cs = useCssName("window");
|
|
28
|
-
const
|
|
29
|
+
const prs = __props;
|
|
30
|
+
const props = uesPropsDefault(prs, {
|
|
31
|
+
drag() {
|
|
32
|
+
return "." + cs.name + "box-title-name";
|
|
33
|
+
}
|
|
34
|
+
});
|
|
29
35
|
const emit = __emit;
|
|
30
36
|
const isMax = shallowRef(props.max);
|
|
31
37
|
const isMin = shallowRef(false);
|
|
@@ -187,8 +193,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
187
193
|
});
|
|
188
194
|
return (_ctx, _cache) => {
|
|
189
195
|
return openBlock(), createBlock(unref(BoxTeleport), {
|
|
190
|
-
disabled: props.disabled,
|
|
191
|
-
to: props.to
|
|
196
|
+
disabled: unref(props).disabled,
|
|
197
|
+
to: unref(props).to
|
|
192
198
|
}, {
|
|
193
199
|
default: withCtx(() => [
|
|
194
200
|
!isClose.value ? (openBlock(), createElementBlock("div", {
|
|
@@ -197,10 +203,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
197
203
|
ref: refBox,
|
|
198
204
|
class: normalizeClass(unref(cs).z())
|
|
199
205
|
}, [
|
|
200
|
-
props.mask ? (openBlock(), createBlock(unref(BoxMask), {
|
|
206
|
+
unref(props).mask ? (openBlock(), createBlock(unref(BoxMask), {
|
|
201
207
|
key: 0,
|
|
202
208
|
onClick: onMaskClose,
|
|
203
|
-
cssprefix: props.cssprefix || unref(cs).z()
|
|
209
|
+
cssprefix: unref(props).cssprefix || unref(cs).z()
|
|
204
210
|
}, null, 8, ["cssprefix"])) : createCommentVNode("", true),
|
|
205
211
|
withDirectives((openBlock(), createElementBlock("div", {
|
|
206
212
|
ref_key: "refBody",
|
|
@@ -210,10 +216,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
210
216
|
renderSlot(_ctx.$slots, unref(dataSlot).title, {}, () => [
|
|
211
217
|
createVNode(unref(BoxTitle), {
|
|
212
218
|
onClose,
|
|
213
|
-
title: props.title
|
|
219
|
+
title: unref(props).title
|
|
214
220
|
}, {
|
|
215
221
|
icon: withCtx(() => [
|
|
216
|
-
!props.noMin ? (openBlock(), createElementBlock("span", {
|
|
222
|
+
!unref(props).noMin ? (openBlock(), createElementBlock("span", {
|
|
217
223
|
key: 0,
|
|
218
224
|
title: unref(getLocale)("minh"),
|
|
219
225
|
onClick: onMin,
|
|
@@ -262,11 +268,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
262
268
|
renderSlot(_ctx.$slots, unref(dataSlot).footer)
|
|
263
269
|
], 2)), [
|
|
264
270
|
[unref(vDrag), {
|
|
265
|
-
dom: props.drag,
|
|
271
|
+
dom: unref(props).drag,
|
|
266
272
|
onMousedown
|
|
267
273
|
}],
|
|
268
274
|
[unref(vAdjust), {
|
|
269
|
-
often: props.often,
|
|
275
|
+
often: unref(props).often,
|
|
270
276
|
onChange: onChangeAdjust,
|
|
271
277
|
all: { position: true, getDisabled }
|
|
272
278
|
}]
|
package/dist/css/box-adjust.css
CHANGED
|
@@ -38,14 +38,15 @@
|
|
|
38
38
|
.box-title-close {
|
|
39
39
|
right: 10px;
|
|
40
40
|
font-size: 18px;
|
|
41
|
+
height: 100%;
|
|
41
42
|
display: flex;
|
|
42
43
|
align-items: center;
|
|
44
|
+
cursor: pointer;
|
|
43
45
|
}
|
|
44
46
|
.box-title-close-icon {
|
|
45
47
|
width: 20px;
|
|
46
48
|
height: 20px;
|
|
47
49
|
margin: 0 4px;
|
|
48
|
-
cursor: pointer;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
.box-adjust {
|
package/dist/css/box-local.css
CHANGED
|
@@ -38,14 +38,15 @@
|
|
|
38
38
|
.box-title-close {
|
|
39
39
|
right: 10px;
|
|
40
40
|
font-size: 18px;
|
|
41
|
+
height: 100%;
|
|
41
42
|
display: flex;
|
|
42
43
|
align-items: center;
|
|
44
|
+
cursor: pointer;
|
|
43
45
|
}
|
|
44
46
|
.box-title-close-icon {
|
|
45
47
|
width: 20px;
|
|
46
48
|
height: 20px;
|
|
47
49
|
margin: 0 4px;
|
|
48
|
-
cursor: pointer;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
.box {
|
package/dist/css/box-title.css
CHANGED
|
@@ -26,12 +26,13 @@
|
|
|
26
26
|
.box-title-close {
|
|
27
27
|
right: 10px;
|
|
28
28
|
font-size: 18px;
|
|
29
|
+
height: 100%;
|
|
29
30
|
display: flex;
|
|
30
31
|
align-items: center;
|
|
32
|
+
cursor: pointer;
|
|
31
33
|
}
|
|
32
34
|
.box-title-close-icon {
|
|
33
35
|
width: 20px;
|
|
34
36
|
height: 20px;
|
|
35
37
|
margin: 0 4px;
|
|
36
|
-
cursor: pointer;
|
|
37
38
|
}
|
package/dist/css/box.css
CHANGED
|
@@ -38,14 +38,15 @@
|
|
|
38
38
|
.box-title-close {
|
|
39
39
|
right: 10px;
|
|
40
40
|
font-size: 18px;
|
|
41
|
+
height: 100%;
|
|
41
42
|
display: flex;
|
|
42
43
|
align-items: center;
|
|
44
|
+
cursor: pointer;
|
|
43
45
|
}
|
|
44
46
|
.box-title-close-icon {
|
|
45
47
|
width: 20px;
|
|
46
48
|
height: 20px;
|
|
47
49
|
margin: 0 4px;
|
|
48
|
-
cursor: pointer;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
.box {
|
package/dist/css/edit-float.css
CHANGED
package/dist/css/index.css
CHANGED
|
@@ -132,14 +132,15 @@
|
|
|
132
132
|
.box-title-close {
|
|
133
133
|
right: 10px;
|
|
134
134
|
font-size: 18px;
|
|
135
|
+
height: 100%;
|
|
135
136
|
display: flex;
|
|
136
137
|
align-items: center;
|
|
138
|
+
cursor: pointer;
|
|
137
139
|
}
|
|
138
140
|
.box-title-close-icon {
|
|
139
141
|
width: 20px;
|
|
140
142
|
height: 20px;
|
|
141
143
|
margin: 0 4px;
|
|
142
|
-
cursor: pointer;
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
.box-adjust {
|
|
@@ -866,8 +867,7 @@
|
|
|
866
867
|
padding: 10px 0;
|
|
867
868
|
}
|
|
868
869
|
.edit-float-but {
|
|
869
|
-
|
|
870
|
-
flex-direction: row-reverse;
|
|
870
|
+
text-align: right;
|
|
871
871
|
}
|
|
872
872
|
|
|
873
873
|
.edit {
|
|
@@ -1324,26 +1324,4 @@
|
|
|
1324
1324
|
left: 0;
|
|
1325
1325
|
z-index: 1;
|
|
1326
1326
|
opacity: 0;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
.tablesvp {
|
|
1330
|
-
width: 100%;
|
|
1331
|
-
height: var(--tablesvp-height);
|
|
1332
|
-
display: flex;
|
|
1333
|
-
flex-direction: column;
|
|
1334
|
-
}
|
|
1335
|
-
.tablesvp-main {
|
|
1336
|
-
display: flex;
|
|
1337
|
-
flex-direction: column;
|
|
1338
|
-
flex: 1;
|
|
1339
|
-
width: 100%;
|
|
1340
|
-
}
|
|
1341
|
-
.tablesvp-main.is-radio .el-table__header .el-table-column--selection .el-checkbox {
|
|
1342
|
-
display: none;
|
|
1343
|
-
}
|
|
1344
|
-
.tablesvp-paginat {
|
|
1345
|
-
overflow: hidden;
|
|
1346
|
-
}
|
|
1347
|
-
.tablesvp-paginat .el-pagination {
|
|
1348
|
-
justify-content: flex-end;
|
|
1349
1327
|
}
|
package/dist/css/popup.css
CHANGED
|
@@ -38,14 +38,15 @@
|
|
|
38
38
|
.box-title-close {
|
|
39
39
|
right: 10px;
|
|
40
40
|
font-size: 18px;
|
|
41
|
+
height: 100%;
|
|
41
42
|
display: flex;
|
|
42
43
|
align-items: center;
|
|
44
|
+
cursor: pointer;
|
|
43
45
|
}
|
|
44
46
|
.box-title-close-icon {
|
|
45
47
|
width: 20px;
|
|
46
48
|
height: 20px;
|
|
47
49
|
margin: 0 4px;
|
|
48
|
-
cursor: pointer;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
.popup {
|
package/dist/css/window.css
CHANGED
|
@@ -38,14 +38,15 @@
|
|
|
38
38
|
.box-title-close {
|
|
39
39
|
right: 10px;
|
|
40
40
|
font-size: 18px;
|
|
41
|
+
height: 100%;
|
|
41
42
|
display: flex;
|
|
42
43
|
align-items: center;
|
|
44
|
+
cursor: pointer;
|
|
43
45
|
}
|
|
44
46
|
.box-title-close-icon {
|
|
45
47
|
width: 20px;
|
|
46
48
|
height: 20px;
|
|
47
49
|
margin: 0 4px;
|
|
48
|
-
cursor: pointer;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
.window {
|
|
@@ -43,6 +43,7 @@ function setDom(dom, el, value) {
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
bodyStyle.cursor = cursor;
|
|
46
|
+
dom.style.cursor = "grab";
|
|
46
47
|
};
|
|
47
48
|
const mousedown = (e) => {
|
|
48
49
|
const eps = dom.getBoundingClientRect();
|
|
@@ -57,11 +58,11 @@ function setDom(dom, el, value) {
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
mousedownEvent = e;
|
|
60
|
-
|
|
61
|
+
dom.style.cursor = "grabbing";
|
|
61
62
|
return true;
|
|
62
63
|
};
|
|
63
64
|
getShiftEvent.pressEvent(dom, mousedown, handleMouseMove, handleMouseUp);
|
|
64
|
-
setCss.setCss(dom, "cursor", "
|
|
65
|
+
setCss.setCss(dom, "cursor", "grab");
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
const vDrag = {
|
|
@@ -41,6 +41,7 @@ function setDom(dom, el, value) {
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
bodyStyle.cursor = cursor;
|
|
44
|
+
dom.style.cursor = "grab";
|
|
44
45
|
};
|
|
45
46
|
const mousedown = (e) => {
|
|
46
47
|
const eps = dom.getBoundingClientRect();
|
|
@@ -55,11 +56,11 @@ function setDom(dom, el, value) {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
mousedownEvent = e;
|
|
58
|
-
|
|
59
|
+
dom.style.cursor = "grabbing";
|
|
59
60
|
return true;
|
|
60
61
|
};
|
|
61
62
|
pressEvent(dom, mousedown, handleMouseMove, handleMouseUp);
|
|
62
|
-
setCss(dom, "cursor", "
|
|
63
|
+
setCss(dom, "cursor", "grab");
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
const vDrag = {
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -13,7 +13,6 @@ exports.setGlobalConfig = index$2.setGlobalConfig;
|
|
|
13
13
|
exports.useGlobalConfig = index$2.useGlobalConfig;
|
|
14
14
|
exports.buildLocaleAdd = index$3.buildLocaleAdd;
|
|
15
15
|
exports.buildLocaleContext = index$3.buildLocaleContext;
|
|
16
|
-
exports.buildPropsDefault = index$3.buildPropsDefault;
|
|
17
16
|
exports.buildTranslator = index$3.buildTranslator;
|
|
18
17
|
exports.useLocale = index$3.useLocale;
|
|
19
18
|
exports.useAttrValue = index$4.useAttrValue;
|
package/dist/hooks/index.js
CHANGED
|
@@ -2,12 +2,11 @@ import { useCssName } from "./cssname/index.js";
|
|
|
2
2
|
import "./default-config/index.js";
|
|
3
3
|
import { eventAliass } from "./event-aliass/index.js";
|
|
4
4
|
import { provideGlobalConfig, setGlobalConfig, useGlobalConfig } from "./global-config/index.js";
|
|
5
|
-
import { buildLocaleAdd, buildLocaleContext,
|
|
5
|
+
import { buildLocaleAdd, buildLocaleContext, buildTranslator, useLocale } from "./locale/index.js";
|
|
6
6
|
import { useAttrValue, useInherit } from "./inherit/index.js";
|
|
7
7
|
export {
|
|
8
8
|
buildLocaleAdd,
|
|
9
9
|
buildLocaleContext,
|
|
10
|
-
buildPropsDefault,
|
|
11
10
|
buildTranslator,
|
|
12
11
|
eventAliass,
|
|
13
12
|
provideGlobalConfig,
|
|
@@ -4,21 +4,11 @@ const index = require("../global-config/index.cjs");
|
|
|
4
4
|
const zhCn = require("../../locale/zh-cn.cjs");
|
|
5
5
|
const en = require("../../locale/en.cjs");
|
|
6
6
|
const vue = require("vue");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let obj = locale;
|
|
10
|
-
for (let index2 = 0; index2 < arr.length; index2++) {
|
|
11
|
-
const v = arr[index2];
|
|
12
|
-
obj = obj[v];
|
|
13
|
-
if (typeof obj === "undefined") {
|
|
14
|
-
break;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return obj;
|
|
18
|
-
}
|
|
7
|
+
require("../../utils/util.cjs");
|
|
8
|
+
const objValue = require("@fangzhongya/utils/basic/object/objValue");
|
|
19
9
|
function buildTranslator(locale) {
|
|
20
10
|
return (path, ...values) => {
|
|
21
|
-
let v =
|
|
11
|
+
let v = objValue.getObjValue(path, vue.unref(locale).value) || "";
|
|
22
12
|
if (values.length > 0) {
|
|
23
13
|
values.forEach((z, i) => {
|
|
24
14
|
v = v.replaceAll("$" + (i + 1), z);
|
|
@@ -27,40 +17,12 @@ function buildTranslator(locale) {
|
|
|
27
17
|
return v;
|
|
28
18
|
};
|
|
29
19
|
}
|
|
30
|
-
function getPropsDefault(props, arr, getLocale) {
|
|
31
|
-
const keys = [];
|
|
32
|
-
const keyObj = {};
|
|
33
|
-
arr.forEach((v) => {
|
|
34
|
-
keys.push(v.prop);
|
|
35
|
-
keyObj[v.prop] = v;
|
|
36
|
-
});
|
|
37
|
-
return new Proxy(props, {
|
|
38
|
-
get(_target, k) {
|
|
39
|
-
if (typeof k === "string" && keys.includes(k)) {
|
|
40
|
-
const v = _target[k];
|
|
41
|
-
if (v === void 0) {
|
|
42
|
-
const o = keyObj[k];
|
|
43
|
-
const l = getLocale(o.locale);
|
|
44
|
-
if (o.filter) {
|
|
45
|
-
return o.filter(l);
|
|
46
|
-
}
|
|
47
|
-
return l;
|
|
48
|
-
}
|
|
49
|
-
return v;
|
|
50
|
-
}
|
|
51
|
-
return _target[k];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function buildPropsDefault(getLocale) {
|
|
56
|
-
return (props, arr) => getPropsDefault(props, arr, getLocale);
|
|
57
|
-
}
|
|
58
20
|
function buildLocaleAdd(locale, lang) {
|
|
59
21
|
return (...arr) => {
|
|
60
22
|
if (lang.value == "zh-cn") {
|
|
61
|
-
return arr.map((o) =>
|
|
23
|
+
return arr.map((o) => objValue.getObjValue(o, vue.unref(locale).value)).join("");
|
|
62
24
|
} else {
|
|
63
|
-
return arr.map((o) =>
|
|
25
|
+
return arr.map((o) => objValue.getObjValue(o, vue.unref(locale).value)).join(" ");
|
|
64
26
|
}
|
|
65
27
|
};
|
|
66
28
|
}
|
|
@@ -70,7 +32,6 @@ function buildLocaleContext(locale) {
|
|
|
70
32
|
return {
|
|
71
33
|
lang,
|
|
72
34
|
locale: localeRef,
|
|
73
|
-
getPropsDefault: buildPropsDefault(buildTranslator(locale)),
|
|
74
35
|
getLocale: buildTranslator(locale),
|
|
75
36
|
getLocaleAdd: buildLocaleAdd(locale, lang)
|
|
76
37
|
};
|
|
@@ -92,6 +53,5 @@ function useLocale() {
|
|
|
92
53
|
}
|
|
93
54
|
exports.buildLocaleAdd = buildLocaleAdd;
|
|
94
55
|
exports.buildLocaleContext = buildLocaleContext;
|
|
95
|
-
exports.buildPropsDefault = buildPropsDefault;
|
|
96
56
|
exports.buildTranslator = buildTranslator;
|
|
97
57
|
exports.useLocale = useLocale;
|
|
@@ -2,12 +2,6 @@ import { Locale, Translator } from '../../types/locale';
|
|
|
2
2
|
import { MaybeRef } from '../../types/hooks';
|
|
3
3
|
import { ComputedRef, Ref } from 'vue';
|
|
4
4
|
export declare function buildTranslator(locale: MaybeRef<Locale>): Translator;
|
|
5
|
-
type PropsDefault = {
|
|
6
|
-
prop: string;
|
|
7
|
-
locale: string;
|
|
8
|
-
filter?: (locale: string) => string;
|
|
9
|
-
};
|
|
10
|
-
export declare function buildPropsDefault(getLocale: Translator): (props: any, arr: Array<PropsDefault>) => any;
|
|
11
5
|
export declare function buildLocaleAdd(locale: MaybeRef<Locale>, lang: ComputedRef<string>): (...arr: string[]) => string;
|
|
12
6
|
export declare function buildLocaleContext(locale: MaybeRef<Locale>): {
|
|
13
7
|
lang: ComputedRef<string>;
|
|
@@ -32,7 +26,6 @@ export declare function buildLocaleContext(locale: MaybeRef<Locale>): {
|
|
|
32
26
|
[key: string]: any;
|
|
33
27
|
};
|
|
34
28
|
}>;
|
|
35
|
-
getPropsDefault: (props: any, arr: Array<PropsDefault>) => any;
|
|
36
29
|
getLocale: Translator;
|
|
37
30
|
getLocaleAdd: (...arr: string[]) => string;
|
|
38
31
|
};
|
|
@@ -59,8 +52,6 @@ export declare function useLocale(): {
|
|
|
59
52
|
[key: string]: any;
|
|
60
53
|
};
|
|
61
54
|
}>;
|
|
62
|
-
getPropsDefault: (props: any, arr: Array<PropsDefault>) => any;
|
|
63
55
|
getLocale: Translator;
|
|
64
56
|
getLocaleAdd: (...arr: string[]) => string;
|
|
65
57
|
};
|
|
66
|
-
export {};
|
|
@@ -2,21 +2,11 @@ import { useGlobalConfig } from "../global-config/index.js";
|
|
|
2
2
|
import ZhCn from "../../locale/zh-cn.js";
|
|
3
3
|
import En from "../../locale/en.js";
|
|
4
4
|
import { unref, computed, isRef, ref } from "vue";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
let obj = locale;
|
|
8
|
-
for (let index = 0; index < arr.length; index++) {
|
|
9
|
-
const v = arr[index];
|
|
10
|
-
obj = obj[v];
|
|
11
|
-
if (typeof obj === "undefined") {
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return obj;
|
|
16
|
-
}
|
|
5
|
+
import "../../utils/util.js";
|
|
6
|
+
import { getObjValue } from "@fangzhongya/utils/basic/object/objValue";
|
|
17
7
|
function buildTranslator(locale) {
|
|
18
8
|
return (path, ...values) => {
|
|
19
|
-
let v =
|
|
9
|
+
let v = getObjValue(path, unref(locale).value) || "";
|
|
20
10
|
if (values.length > 0) {
|
|
21
11
|
values.forEach((z, i) => {
|
|
22
12
|
v = v.replaceAll("$" + (i + 1), z);
|
|
@@ -25,40 +15,12 @@ function buildTranslator(locale) {
|
|
|
25
15
|
return v;
|
|
26
16
|
};
|
|
27
17
|
}
|
|
28
|
-
function getPropsDefault(props, arr, getLocale) {
|
|
29
|
-
const keys = [];
|
|
30
|
-
const keyObj = {};
|
|
31
|
-
arr.forEach((v) => {
|
|
32
|
-
keys.push(v.prop);
|
|
33
|
-
keyObj[v.prop] = v;
|
|
34
|
-
});
|
|
35
|
-
return new Proxy(props, {
|
|
36
|
-
get(_target, k) {
|
|
37
|
-
if (typeof k === "string" && keys.includes(k)) {
|
|
38
|
-
const v = _target[k];
|
|
39
|
-
if (v === void 0) {
|
|
40
|
-
const o = keyObj[k];
|
|
41
|
-
const l = getLocale(o.locale);
|
|
42
|
-
if (o.filter) {
|
|
43
|
-
return o.filter(l);
|
|
44
|
-
}
|
|
45
|
-
return l;
|
|
46
|
-
}
|
|
47
|
-
return v;
|
|
48
|
-
}
|
|
49
|
-
return _target[k];
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function buildPropsDefault(getLocale) {
|
|
54
|
-
return (props, arr) => getPropsDefault(props, arr, getLocale);
|
|
55
|
-
}
|
|
56
18
|
function buildLocaleAdd(locale, lang) {
|
|
57
19
|
return (...arr) => {
|
|
58
20
|
if (lang.value == "zh-cn") {
|
|
59
|
-
return arr.map((o) =>
|
|
21
|
+
return arr.map((o) => getObjValue(o, unref(locale).value)).join("");
|
|
60
22
|
} else {
|
|
61
|
-
return arr.map((o) =>
|
|
23
|
+
return arr.map((o) => getObjValue(o, unref(locale).value)).join(" ");
|
|
62
24
|
}
|
|
63
25
|
};
|
|
64
26
|
}
|
|
@@ -68,7 +30,6 @@ function buildLocaleContext(locale) {
|
|
|
68
30
|
return {
|
|
69
31
|
lang,
|
|
70
32
|
locale: localeRef,
|
|
71
|
-
getPropsDefault: buildPropsDefault(buildTranslator(locale)),
|
|
72
33
|
getLocale: buildTranslator(locale),
|
|
73
34
|
getLocaleAdd: buildLocaleAdd(locale, lang)
|
|
74
35
|
};
|
|
@@ -91,7 +52,6 @@ function useLocale() {
|
|
|
91
52
|
export {
|
|
92
53
|
buildLocaleAdd,
|
|
93
54
|
buildLocaleContext,
|
|
94
|
-
buildPropsDefault,
|
|
95
55
|
buildTranslator,
|
|
96
56
|
useLocale
|
|
97
57
|
};
|