@g1cloud/bluesea 5.0.0-alpha.3 → 5.0.0-alpha.4
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/css/variable.scss +23 -17
- package/dist/bluesea.js +221 -127
- package/dist/bluesea.umd.cjs +220 -126
- package/dist/component/basic/BSButton.vue.d.ts +39 -0
- package/dist/component/input/BSPriceInput.vue.d.ts +55 -0
- package/dist/component/input/BSRadioButton.vue.d.ts +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/model/CommonTypes.d.ts +5 -0
- package/dist/style.css +285 -68
- package/dist/util/formatUtil.d.ts +8 -0
- package/package.json +1 -1
- package/dist/component/BSButton.vue.d.ts +0 -15
package/css/variable.scss
CHANGED
|
@@ -16,29 +16,35 @@ textarea {
|
|
|
16
16
|
font-size: var(--font-size-input);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
$color-text: #555;
|
|
20
|
-
$color-text-light: #B0B1BA;
|
|
19
|
+
$color-text: #555 !default;
|
|
20
|
+
$color-text-light: #B0B1BA !default;
|
|
21
21
|
|
|
22
|
-
$color-gray: #8993A4;
|
|
23
|
-
$color-gray-border: #BCC6D3;
|
|
22
|
+
$color-gray: #8993A4 !default;
|
|
23
|
+
$color-gray-border: #BCC6D3 !default;
|
|
24
24
|
|
|
25
|
-
$color-blue: #
|
|
26
|
-
$color-blue-border: #C1CBE4;
|
|
27
|
-
$color-blue-bg: #
|
|
25
|
+
$color-blue: #5672EF !default;
|
|
26
|
+
$color-blue-border: #C1CBE4 !default;
|
|
27
|
+
$color-blue-bg: #DDEEFF !default;
|
|
28
28
|
|
|
29
|
-
$color-darkblue: #00234D;
|
|
29
|
+
$color-darkblue: #00234D !default;
|
|
30
30
|
|
|
31
|
-
$color-red: #E72F34;
|
|
32
|
-
$color-red-border: #FA9A9E;
|
|
33
|
-
$color-red-bg: #FFE8E8;
|
|
31
|
+
$color-red: #E72F34 !default;
|
|
32
|
+
$color-red-border: #FA9A9E !default;
|
|
33
|
+
$color-red-bg: #FFE8E8 !default;
|
|
34
34
|
|
|
35
|
-
$color-
|
|
36
|
-
$color-
|
|
37
|
-
$color-
|
|
35
|
+
$color-orange: #F99341 !default;
|
|
36
|
+
$color-orange-border: #F99341 !default;
|
|
37
|
+
$color-orange-bg: #F99341 !default;
|
|
38
38
|
|
|
39
|
-
$color-
|
|
40
|
-
$color-border
|
|
41
|
-
$color-
|
|
39
|
+
$color-green: #4FA348 !default;
|
|
40
|
+
$color-green-border: #7ECE78 !default;
|
|
41
|
+
$color-green-bg: #E9FEE7 !default;
|
|
42
|
+
|
|
43
|
+
$color-icon-light: #D5D5D5 !default;
|
|
44
|
+
$color-border: #E5E5E5 !default;
|
|
45
|
+
$color-border-light: #DBE0EF !default;
|
|
46
|
+
$color-border-dark: #444 !default;
|
|
47
|
+
$color-hover: #E8EEFC !default;
|
|
42
48
|
|
|
43
49
|
$border-input: 0.8px solid $color-border-light;
|
|
44
50
|
|
package/dist/bluesea.js
CHANGED
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { defineComponent, openBlock, createElementBlock, toDisplayString,
|
|
7
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, withDirectives, createElementVNode, unref, ref, watch, normalizeStyle, mergeProps, isRef, toHandlers, vModelText, Fragment, renderList, computed, createVNode, useSlots, renderSlot, createBlock, Transition, withCtx, onMounted, onBeforeUnmount, withModifiers, withKeys, createTextVNode, reactive, nextTick, vShow, inject, resolveComponent, markRaw, provide, resolveDynamicComponent, shallowReactive } from "vue";
|
|
8
8
|
import dayjs from "dayjs";
|
|
9
9
|
import { useRouter, useRoute } from "vue-router";
|
|
10
10
|
class BlueseaConfig {
|
|
@@ -25,18 +25,136 @@ const blueseaConfig = new BlueseaConfig();
|
|
|
25
25
|
const configureBluesea = (options) => {
|
|
26
26
|
blueseaConfig.configure(options);
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
class I18NTexts {
|
|
29
|
+
constructor() {
|
|
30
|
+
__publicField(this, "localeTexts", {});
|
|
31
|
+
__publicField(this, "defaultLocale");
|
|
32
|
+
}
|
|
33
|
+
setDefaultLocale(locale) {
|
|
34
|
+
this.defaultLocale = locale;
|
|
35
|
+
}
|
|
36
|
+
addTexts(locale, textList) {
|
|
37
|
+
const text = this.ensureAddLocale(locale);
|
|
38
|
+
textList.forEach((t) => text[t.key] = t);
|
|
39
|
+
}
|
|
40
|
+
text(locale, key, args) {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
let text = (_a = this.localeTexts[locale]) == null ? void 0 : _a[key];
|
|
43
|
+
let parentLocale = locale;
|
|
44
|
+
while (parentLocale && !text) {
|
|
45
|
+
parentLocale = parentLocale.substring(0, parentLocale.lastIndexOf("-"));
|
|
46
|
+
text = (_b = this.localeTexts[parentLocale]) == null ? void 0 : _b[key];
|
|
47
|
+
}
|
|
48
|
+
const defLocale = this.ensureGetDefaultLocale();
|
|
49
|
+
if (!text && defLocale && defLocale !== locale) {
|
|
50
|
+
text = (_c = this.localeTexts[defLocale]) == null ? void 0 : _c[key];
|
|
51
|
+
}
|
|
52
|
+
const resolved = text ? this.resolveText(text, args) : key;
|
|
53
|
+
const html = text ? !!text.html : false;
|
|
54
|
+
return { key, text: resolved, html };
|
|
55
|
+
}
|
|
56
|
+
// {0} {1} 등의 변수를 args 로 대치한다.
|
|
57
|
+
resolveText(text, args) {
|
|
58
|
+
let result = text.text;
|
|
59
|
+
const re = /\{\s*(\d+)\s*}/g;
|
|
60
|
+
const slots = [];
|
|
61
|
+
let exec;
|
|
62
|
+
while (exec = re.exec(result)) {
|
|
63
|
+
slots.push(exec);
|
|
64
|
+
}
|
|
65
|
+
slots.reverse();
|
|
66
|
+
for (const slot of slots) {
|
|
67
|
+
if (result.charAt(slot.index - 1) === "\\") {
|
|
68
|
+
result = result.substring(0, slot.index - 1) + result.substring(slot.index);
|
|
69
|
+
} else {
|
|
70
|
+
const index = Number(slot[1]);
|
|
71
|
+
if ((args == null ? void 0 : args[index]) !== void 0) {
|
|
72
|
+
result = result.substring(0, slot.index) + args[index] + result.substring(slot.index + slot[0].length);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
ensureAddLocale(locale) {
|
|
79
|
+
return this.localeTexts[locale] = this.localeTexts[locale] || {};
|
|
80
|
+
}
|
|
81
|
+
ensureGetDefaultLocale() {
|
|
82
|
+
if (!this.defaultLocale) {
|
|
83
|
+
this.defaultLocale = blueseaConfig.defaultLocale;
|
|
84
|
+
}
|
|
85
|
+
return this.defaultLocale;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const getCurrentLocale = () => {
|
|
89
|
+
return document.documentElement.lang || navigator.language;
|
|
90
|
+
};
|
|
91
|
+
const i18n = new I18NTexts();
|
|
92
|
+
const parseBinding = (binding) => {
|
|
93
|
+
const type = binding.modifiers.html ? "HTML" : "TEXT";
|
|
94
|
+
if (typeof binding.value === "string") {
|
|
95
|
+
return { key: binding.value, type, multiLang: false };
|
|
96
|
+
} else if (Array.isArray(binding.value)) {
|
|
97
|
+
const key = String(binding.value[0]);
|
|
98
|
+
const args = binding.value.toSpliced(0, 1);
|
|
99
|
+
return { key, args, type, multiLang: true };
|
|
100
|
+
} else if (typeof binding.value === "object") {
|
|
101
|
+
const key = binding.value.key || "";
|
|
102
|
+
const args = Array.isArray(binding.value.args) ? binding.value.args : void 0;
|
|
103
|
+
return { key, args, type, multiLang: true };
|
|
104
|
+
} else {
|
|
105
|
+
return { multiLang: false };
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const vT = {
|
|
109
|
+
mounted: (el, binding) => {
|
|
110
|
+
const { multiLang, key, args, type } = parseBinding(binding);
|
|
111
|
+
if (key) {
|
|
112
|
+
if (multiLang) {
|
|
113
|
+
const locale = getCurrentLocale();
|
|
114
|
+
const text = i18n.text(locale, key, args);
|
|
115
|
+
el[type === "HTML" ? "innerHTML" : "innerText"] = text.text;
|
|
116
|
+
el.setAttribute("data-bs-text-key", key);
|
|
117
|
+
} else {
|
|
118
|
+
el[type === "HTML" ? "innerHTML" : "innerText"] = key;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const _hoisted_1$G = ["disabled"];
|
|
124
|
+
const _hoisted_2$v = {
|
|
125
|
+
key: 0,
|
|
126
|
+
class: "font-icon"
|
|
127
|
+
};
|
|
128
|
+
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
30
129
|
__name: "BSButton",
|
|
31
130
|
props: {
|
|
32
|
-
caption: {}
|
|
131
|
+
caption: {},
|
|
132
|
+
buttonColor: { default: "default" },
|
|
133
|
+
leftIcon: {},
|
|
134
|
+
disabled: { type: Boolean, default: false }
|
|
33
135
|
},
|
|
34
136
|
setup(__props) {
|
|
35
137
|
return (_ctx, _cache) => {
|
|
36
|
-
return openBlock(), createElementBlock("button",
|
|
138
|
+
return openBlock(), createElementBlock("button", {
|
|
139
|
+
class: normalizeClass([[_ctx.buttonColor], "bs-button inline-flex items-center justify-center"]),
|
|
140
|
+
disabled: _ctx.disabled
|
|
141
|
+
}, [
|
|
142
|
+
_ctx.leftIcon ? (openBlock(), createElementBlock("span", _hoisted_2$v, toDisplayString(_ctx.leftIcon), 1)) : createCommentVNode("", true),
|
|
143
|
+
withDirectives(createElementVNode("span", null, null, 512), [
|
|
144
|
+
[unref(vT), _ctx.caption]
|
|
145
|
+
])
|
|
146
|
+
], 10, _hoisted_1$G);
|
|
37
147
|
};
|
|
38
148
|
}
|
|
39
149
|
});
|
|
150
|
+
const _export_sfc = (sfc, props) => {
|
|
151
|
+
const target = sfc.__vccOpts || sfc;
|
|
152
|
+
for (const [key, val] of props) {
|
|
153
|
+
target[key] = val;
|
|
154
|
+
}
|
|
155
|
+
return target;
|
|
156
|
+
};
|
|
157
|
+
const BSButton = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-6d6c76d8"]]);
|
|
40
158
|
const fieldValidator = (option) => {
|
|
41
159
|
const value = ref(option.initialValue);
|
|
42
160
|
const valid = ref(false);
|
|
@@ -111,11 +229,11 @@ const componentUtil = {
|
|
|
111
229
|
}
|
|
112
230
|
}
|
|
113
231
|
};
|
|
114
|
-
const _hoisted_1$
|
|
115
|
-
const _hoisted_2$
|
|
116
|
-
const _hoisted_3$
|
|
232
|
+
const _hoisted_1$F = { class: "input-area" };
|
|
233
|
+
const _hoisted_2$u = ["id", "autocomplete", "disabled", "maxlength", "name", "placeholder", "tabindex"];
|
|
234
|
+
const _hoisted_3$j = { key: 0 };
|
|
117
235
|
const _hoisted_4$c = ["textContent"];
|
|
118
|
-
const _sfc_main$
|
|
236
|
+
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
119
237
|
__name: "BSTextInput",
|
|
120
238
|
props: {
|
|
121
239
|
id: {},
|
|
@@ -165,7 +283,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
165
283
|
class: normalizeClass([{ required: _ctx.required }, "bs-text-input"]),
|
|
166
284
|
style: normalizeStyle({ width: _ctx.width })
|
|
167
285
|
}, [
|
|
168
|
-
createElementVNode("div", _hoisted_1$
|
|
286
|
+
createElementVNode("div", _hoisted_1$F, [
|
|
169
287
|
withDirectives(createElementVNode("input", mergeProps({
|
|
170
288
|
id: _ctx.id,
|
|
171
289
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(value) ? value.value = $event : null),
|
|
@@ -176,11 +294,11 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
176
294
|
placeholder: _ctx.placeholder,
|
|
177
295
|
tabindex: _ctx.tabindex,
|
|
178
296
|
type: "text"
|
|
179
|
-
}, toHandlers(handlers, true)), null, 16, _hoisted_2$
|
|
297
|
+
}, toHandlers(handlers, true)), null, 16, _hoisted_2$u), [
|
|
180
298
|
[vModelText, unref(value)]
|
|
181
299
|
])
|
|
182
300
|
]),
|
|
183
|
-
unref(errors).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
301
|
+
unref(errors).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$j, [
|
|
184
302
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(errors), (error) => {
|
|
185
303
|
return openBlock(), createElementBlock("div", {
|
|
186
304
|
key: error.code,
|
|
@@ -193,10 +311,10 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
193
311
|
};
|
|
194
312
|
}
|
|
195
313
|
});
|
|
196
|
-
const _hoisted_1$
|
|
197
|
-
const _hoisted_2$
|
|
198
|
-
const _hoisted_3$
|
|
199
|
-
const _sfc_main$
|
|
314
|
+
const _hoisted_1$E = { class: "input-area" };
|
|
315
|
+
const _hoisted_2$t = ["id", "autocomplete", "disabled", "maxlength", "name", "placeholder", "tabindex"];
|
|
316
|
+
const _hoisted_3$i = /* @__PURE__ */ createElementVNode("div", { class: "message-area" }, null, -1);
|
|
317
|
+
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
200
318
|
__name: "BSNumberInput",
|
|
201
319
|
props: {
|
|
202
320
|
id: {},
|
|
@@ -223,7 +341,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
223
341
|
style: normalizeStyle({ width: _ctx.width }),
|
|
224
342
|
class: "bs-number-input"
|
|
225
343
|
}, [
|
|
226
|
-
createElementVNode("div", _hoisted_1$
|
|
344
|
+
createElementVNode("div", _hoisted_1$E, [
|
|
227
345
|
withDirectives(createElementVNode("input", mergeProps({
|
|
228
346
|
id: _ctx.id,
|
|
229
347
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
@@ -235,10 +353,64 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
235
353
|
tabindex: _ctx.tabindex,
|
|
236
354
|
pattern: "\\d*",
|
|
237
355
|
type: "text"
|
|
238
|
-
}, toHandlers(handlers, true)), null, 16, _hoisted_2$
|
|
356
|
+
}, toHandlers(handlers, true)), null, 16, _hoisted_2$t), [
|
|
239
357
|
[vModelText, value.value]
|
|
240
358
|
])
|
|
241
359
|
]),
|
|
360
|
+
_hoisted_3$i
|
|
361
|
+
], 4);
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
const _hoisted_1$D = { class: "input-area" };
|
|
366
|
+
const _hoisted_2$s = ["id", "name", "value"];
|
|
367
|
+
const _hoisted_3$h = /* @__PURE__ */ createElementVNode("div", { class: "message-area" }, null, -1);
|
|
368
|
+
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
369
|
+
__name: "BSPriceInput",
|
|
370
|
+
props: {
|
|
371
|
+
id: {},
|
|
372
|
+
name: {},
|
|
373
|
+
modelValue: {},
|
|
374
|
+
prefix: { type: Boolean },
|
|
375
|
+
maxlength: {},
|
|
376
|
+
disabled: { type: Boolean },
|
|
377
|
+
required: { type: Boolean },
|
|
378
|
+
width: { default: "200px" },
|
|
379
|
+
autocomplete: {},
|
|
380
|
+
tabindex: { default: 0 }
|
|
381
|
+
},
|
|
382
|
+
emits: ["update:modelValue"],
|
|
383
|
+
setup(__props, { emit: __emit }) {
|
|
384
|
+
const props = __props;
|
|
385
|
+
const locale = window.navigator.language;
|
|
386
|
+
console.log("locale ", locale);
|
|
387
|
+
const moneyRef = ref(props.modelValue);
|
|
388
|
+
const formattedValue = computed(() => moneyRef.value.value ? Number(moneyRef.value.value).toLocaleString(locale) : "");
|
|
389
|
+
const emitValue = (event) => {
|
|
390
|
+
const inputValue = event.target.value;
|
|
391
|
+
moneyRef.value.displayValue = Number(inputValue).toLocaleString(locale, {
|
|
392
|
+
style: "currency",
|
|
393
|
+
currency: moneyRef.value.currenyCode
|
|
394
|
+
});
|
|
395
|
+
moneyRef.value.value = Number(inputValue);
|
|
396
|
+
emit("update:modelValue", moneyRef.value);
|
|
397
|
+
};
|
|
398
|
+
const emit = __emit;
|
|
399
|
+
return (_ctx, _cache) => {
|
|
400
|
+
return openBlock(), createElementBlock("div", {
|
|
401
|
+
style: normalizeStyle({ width: _ctx.width }),
|
|
402
|
+
class: "bs-number-input"
|
|
403
|
+
}, [
|
|
404
|
+
createElementVNode("div", _hoisted_1$D, [
|
|
405
|
+
createElementVNode("input", {
|
|
406
|
+
id: _ctx.id,
|
|
407
|
+
name: _ctx.name,
|
|
408
|
+
value: formattedValue.value,
|
|
409
|
+
pattern: "\\d*",
|
|
410
|
+
type: "text",
|
|
411
|
+
onChange: emitValue
|
|
412
|
+
}, null, 40, _hoisted_2$s)
|
|
413
|
+
]),
|
|
242
414
|
_hoisted_3$h
|
|
243
415
|
], 4);
|
|
244
416
|
};
|
|
@@ -578,13 +750,6 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
578
750
|
};
|
|
579
751
|
}
|
|
580
752
|
});
|
|
581
|
-
const _export_sfc = (sfc, props) => {
|
|
582
|
-
const target = sfc.__vccOpts || sfc;
|
|
583
|
-
for (const [key, val] of props) {
|
|
584
|
-
target[key] = val;
|
|
585
|
-
}
|
|
586
|
-
return target;
|
|
587
|
-
};
|
|
588
753
|
const _sfc_main$A = {};
|
|
589
754
|
const _hoisted_1$w = { class: "bs-popup" };
|
|
590
755
|
function _sfc_render(_ctx, _cache) {
|
|
@@ -1134,9 +1299,32 @@ const formatUtil = {
|
|
|
1134
1299
|
* @return
|
|
1135
1300
|
*/
|
|
1136
1301
|
formatNumber(value) {
|
|
1302
|
+
const regexp = /\B(?=(\d{3})+(?!\d))/g;
|
|
1303
|
+
if (value || typeof value === "number") {
|
|
1304
|
+
const splitValue = value.toString().split(".");
|
|
1305
|
+
return splitValue[0].replace(regexp, ",").concat(".", splitValue[1]);
|
|
1306
|
+
}
|
|
1307
|
+
return null;
|
|
1308
|
+
},
|
|
1309
|
+
formatNumberByCode(value, locale) {
|
|
1310
|
+
if (typeof value === "undefined") {
|
|
1311
|
+
return null;
|
|
1312
|
+
}
|
|
1137
1313
|
if (value || typeof value === "number") {
|
|
1138
|
-
|
|
1139
|
-
|
|
1314
|
+
return value.toLocaleString(locale);
|
|
1315
|
+
}
|
|
1316
|
+
return null;
|
|
1317
|
+
},
|
|
1318
|
+
/**
|
|
1319
|
+
* 통화단위와 표시위치를 받아 출력한다
|
|
1320
|
+
* @param value 값
|
|
1321
|
+
* @param withUnit 통화단위
|
|
1322
|
+
* @param prefix true 이면 withUnit을 앞에 붙이고, false 이면 뒤에 붙인다.
|
|
1323
|
+
*/
|
|
1324
|
+
formatPrice(value, withUnit, prefix = false) {
|
|
1325
|
+
if (value || typeof value === "number") {
|
|
1326
|
+
const formattedValue = this.formatNumber(value);
|
|
1327
|
+
return prefix ? `${withUnit}${formattedValue}` : `${formattedValue}${withUnit}`;
|
|
1140
1328
|
}
|
|
1141
1329
|
return null;
|
|
1142
1330
|
},
|
|
@@ -1933,7 +2121,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
1933
2121
|
"date-filter": _ctx.config.dateFilter
|
|
1934
2122
|
}, null, 8, ["modelValue", "date-filter"])) : createCommentVNode("", true),
|
|
1935
2123
|
createElementVNode("div", null, [
|
|
1936
|
-
createVNode(
|
|
2124
|
+
createVNode(BSButton, {
|
|
1937
2125
|
caption: "Search",
|
|
1938
2126
|
onClick: emitSearch
|
|
1939
2127
|
})
|
|
@@ -2373,7 +2561,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2373
2561
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.locales, (locale) => {
|
|
2374
2562
|
return openBlock(), createElementBlock(Fragment, { key: locale }, [
|
|
2375
2563
|
_ctx.expandLocale || locale === unref(blueseaConfig).defaultLocale ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
2376
|
-
createVNode(_sfc_main$
|
|
2564
|
+
createVNode(_sfc_main$J, {
|
|
2377
2565
|
id: _ctx.id ? `${_ctx.id}_${locale}` : void 0,
|
|
2378
2566
|
autocomplete: _ctx.autocomplete,
|
|
2379
2567
|
disabled: _ctx.disabled,
|
|
@@ -2624,101 +2812,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2624
2812
|
};
|
|
2625
2813
|
}
|
|
2626
2814
|
});
|
|
2627
|
-
class I18NTexts {
|
|
2628
|
-
constructor() {
|
|
2629
|
-
__publicField(this, "localeTexts", {});
|
|
2630
|
-
__publicField(this, "defaultLocale");
|
|
2631
|
-
}
|
|
2632
|
-
setDefaultLocale(locale) {
|
|
2633
|
-
this.defaultLocale = locale;
|
|
2634
|
-
}
|
|
2635
|
-
addTexts(locale, textList) {
|
|
2636
|
-
const text = this.ensureAddLocale(locale);
|
|
2637
|
-
textList.forEach((t) => text[t.key] = t);
|
|
2638
|
-
}
|
|
2639
|
-
text(locale, key, args) {
|
|
2640
|
-
var _a, _b, _c;
|
|
2641
|
-
let text = (_a = this.localeTexts[locale]) == null ? void 0 : _a[key];
|
|
2642
|
-
let parentLocale = locale;
|
|
2643
|
-
while (parentLocale && !text) {
|
|
2644
|
-
parentLocale = parentLocale.substring(0, parentLocale.lastIndexOf("-"));
|
|
2645
|
-
text = (_b = this.localeTexts[parentLocale]) == null ? void 0 : _b[key];
|
|
2646
|
-
}
|
|
2647
|
-
const defLocale = this.ensureGetDefaultLocale();
|
|
2648
|
-
if (!text && defLocale && defLocale !== locale) {
|
|
2649
|
-
text = (_c = this.localeTexts[defLocale]) == null ? void 0 : _c[key];
|
|
2650
|
-
}
|
|
2651
|
-
const resolved = text ? this.resolveText(text, args) : key;
|
|
2652
|
-
const html = text ? !!text.html : false;
|
|
2653
|
-
return { key, text: resolved, html };
|
|
2654
|
-
}
|
|
2655
|
-
// {0} {1} 등의 변수를 args 로 대치한다.
|
|
2656
|
-
resolveText(text, args) {
|
|
2657
|
-
let result = text.text;
|
|
2658
|
-
const re = /\{\s*(\d+)\s*}/g;
|
|
2659
|
-
const slots = [];
|
|
2660
|
-
let exec;
|
|
2661
|
-
while (exec = re.exec(result)) {
|
|
2662
|
-
slots.push(exec);
|
|
2663
|
-
}
|
|
2664
|
-
slots.reverse();
|
|
2665
|
-
for (const slot of slots) {
|
|
2666
|
-
if (result.charAt(slot.index - 1) === "\\") {
|
|
2667
|
-
result = result.substring(0, slot.index - 1) + result.substring(slot.index);
|
|
2668
|
-
} else {
|
|
2669
|
-
const index = Number(slot[1]);
|
|
2670
|
-
if ((args == null ? void 0 : args[index]) !== void 0) {
|
|
2671
|
-
result = result.substring(0, slot.index) + args[index] + result.substring(slot.index + slot[0].length);
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
return result;
|
|
2676
|
-
}
|
|
2677
|
-
ensureAddLocale(locale) {
|
|
2678
|
-
return this.localeTexts[locale] = this.localeTexts[locale] || {};
|
|
2679
|
-
}
|
|
2680
|
-
ensureGetDefaultLocale() {
|
|
2681
|
-
if (!this.defaultLocale) {
|
|
2682
|
-
this.defaultLocale = blueseaConfig.defaultLocale;
|
|
2683
|
-
}
|
|
2684
|
-
return this.defaultLocale;
|
|
2685
|
-
}
|
|
2686
|
-
}
|
|
2687
|
-
const getCurrentLocale = () => {
|
|
2688
|
-
return document.documentElement.lang || navigator.language;
|
|
2689
|
-
};
|
|
2690
|
-
const i18n = new I18NTexts();
|
|
2691
|
-
const parseBinding = (binding) => {
|
|
2692
|
-
const type = binding.modifiers.html ? "HTML" : "TEXT";
|
|
2693
|
-
if (typeof binding.value === "string") {
|
|
2694
|
-
return { key: binding.value, type, multiLang: false };
|
|
2695
|
-
} else if (Array.isArray(binding.value)) {
|
|
2696
|
-
const key = String(binding.value[0]);
|
|
2697
|
-
const args = binding.value.toSpliced(0, 1);
|
|
2698
|
-
return { key, args, type, multiLang: true };
|
|
2699
|
-
} else if (typeof binding.value === "object") {
|
|
2700
|
-
const key = binding.value.key || "";
|
|
2701
|
-
const args = Array.isArray(binding.value.args) ? binding.value.args : void 0;
|
|
2702
|
-
return { key, args, type, multiLang: true };
|
|
2703
|
-
} else {
|
|
2704
|
-
return { multiLang: false };
|
|
2705
|
-
}
|
|
2706
|
-
};
|
|
2707
|
-
const vT = {
|
|
2708
|
-
mounted: (el, binding) => {
|
|
2709
|
-
const { multiLang, key, args, type } = parseBinding(binding);
|
|
2710
|
-
if (key) {
|
|
2711
|
-
if (multiLang) {
|
|
2712
|
-
const locale = getCurrentLocale();
|
|
2713
|
-
const text = i18n.text(locale, key, args);
|
|
2714
|
-
el[type === "HTML" ? "innerHTML" : "innerText"] = text.text;
|
|
2715
|
-
el.setAttribute("data-bs-text-key", key);
|
|
2716
|
-
} else {
|
|
2717
|
-
el[type === "HTML" ? "innerHTML" : "innerText"] = key;
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2721
|
-
};
|
|
2722
2815
|
const _hoisted_1$7 = {
|
|
2723
2816
|
key: 0,
|
|
2724
2817
|
class: "menu separator"
|
|
@@ -3170,7 +3263,7 @@ const parsePathParam = (route) => {
|
|
|
3170
3263
|
const BLUESEA_VERSION = "5.0.0";
|
|
3171
3264
|
export {
|
|
3172
3265
|
BLUESEA_VERSION,
|
|
3173
|
-
|
|
3266
|
+
BSButton,
|
|
3174
3267
|
_sfc_main$E as BSCheckbox,
|
|
3175
3268
|
_sfc_main$D as BSCheckboxGroup,
|
|
3176
3269
|
_sfc_main$8 as BSContextMenuContainer,
|
|
@@ -3187,14 +3280,15 @@ export {
|
|
|
3187
3280
|
_sfc_main$d as BSMultiLangTextArea,
|
|
3188
3281
|
_sfc_main$e as BSMultiLangTextInput,
|
|
3189
3282
|
_sfc_main$x as BSMultiSelect,
|
|
3190
|
-
_sfc_main$
|
|
3283
|
+
_sfc_main$I as BSNumberInput,
|
|
3284
|
+
_sfc_main$H as BSPriceInput,
|
|
3191
3285
|
_sfc_main$C as BSRadioButton,
|
|
3192
3286
|
_sfc_main$B as BSRadioButtonGroup,
|
|
3193
3287
|
_sfc_main$y as BSSelect,
|
|
3194
3288
|
_sfc_main$j as BSTabSheet,
|
|
3195
3289
|
_sfc_main$v as BSTextArea,
|
|
3196
3290
|
_sfc_main$o as BSTextFilter,
|
|
3197
|
-
_sfc_main$
|
|
3291
|
+
_sfc_main$J as BSTextInput,
|
|
3198
3292
|
_sfc_main$f as BSTree,
|
|
3199
3293
|
_sfc_main$w as BSTreeSelect,
|
|
3200
3294
|
_sfc_main as DefaultBody,
|