@kine-design/core 0.0.1-beta.10 → 0.0.1-beta.12
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/.vlaude/last-session-id +1 -1
- package/components/base/autoComplete/api.ts +1 -1
- package/components/base/cascader/api.ts +1 -1
- package/components/base/datePicker/__tests__/useDatePicker.test.ts +8 -17
- package/components/base/datePicker/api.ts +1 -1
- package/components/base/datePicker/index.ts +1 -1
- package/components/base/datePicker/useDatePicker.ts +1 -18
- package/components/base/empty/api.ts +1 -1
- package/components/base/select/api.ts +1 -1
- package/components/base/timePicker/__tests__/useTimePicker.test.ts +5 -4
- package/components/base/timePicker/api.ts +1 -1
- package/components/base/timePicker/useTimePicker.ts +1 -1
- package/components/base/transfer/api.ts +2 -2
- package/components/message/confirm/api.ts +2 -2
- package/compositions/common/useLocale.ts +53 -0
- package/dist/components/base/datePicker/index.d.ts +1 -1
- package/dist/components/base/datePicker/useDatePicker.d.ts +0 -7
- package/dist/compositions/common/useLocale.d.ts +14 -0
- package/dist/core.js +467 -57
- package/dist/index.d.ts +2 -0
- package/dist/locale/en.d.ts +3 -0
- package/dist/locale/index.d.ts +9 -0
- package/dist/locale/types.d.ts +222 -0
- package/dist/locale/zh.d.ts +3 -0
- package/index.ts +10 -0
- package/locale/.vlaude/last-session-id +1 -0
- package/locale/en.ts +187 -0
- package/locale/index.ts +29 -0
- package/locale/types.ts +214 -0
- package/locale/zh.ts +190 -0
- package/package.json +18 -20
- package/.vlaude/session-switch.signal +0 -1
package/dist/core.js
CHANGED
|
@@ -245,7 +245,7 @@ var props$47 = {
|
|
|
245
245
|
},
|
|
246
246
|
placeholder: {
|
|
247
247
|
type: String,
|
|
248
|
-
default:
|
|
248
|
+
default: void 0
|
|
249
249
|
},
|
|
250
250
|
toMatch: {
|
|
251
251
|
type: Function,
|
|
@@ -2244,11 +2244,11 @@ var ConfirmCore = { props: {
|
|
|
2244
2244
|
},
|
|
2245
2245
|
confirmText: {
|
|
2246
2246
|
type: String,
|
|
2247
|
-
default:
|
|
2247
|
+
default: void 0
|
|
2248
2248
|
},
|
|
2249
2249
|
cancelText: {
|
|
2250
2250
|
type: String,
|
|
2251
|
-
default:
|
|
2251
|
+
default: void 0
|
|
2252
2252
|
},
|
|
2253
2253
|
title: {
|
|
2254
2254
|
type: String,
|
|
@@ -2787,7 +2787,7 @@ var props$25 = {
|
|
|
2787
2787
|
},
|
|
2788
2788
|
placeholder: {
|
|
2789
2789
|
type: String,
|
|
2790
|
-
default:
|
|
2790
|
+
default: void 0
|
|
2791
2791
|
},
|
|
2792
2792
|
format: {
|
|
2793
2793
|
type: String,
|
|
@@ -2831,52 +2831,6 @@ var props$25 = {
|
|
|
2831
2831
|
* 从 lib/useDatePicker 移植,去掉 usePopover / useBorder 依赖。
|
|
2832
2832
|
* 纯日历数据管理,不含任何 popover 逻辑。
|
|
2833
2833
|
*/
|
|
2834
|
-
/** 基础星期头(汉字显示) */
|
|
2835
|
-
var BASE_WEEK_NAME = [
|
|
2836
|
-
{
|
|
2837
|
-
day: "日",
|
|
2838
|
-
isCurrentMonth: true
|
|
2839
|
-
},
|
|
2840
|
-
{
|
|
2841
|
-
day: "壹",
|
|
2842
|
-
isCurrentMonth: true
|
|
2843
|
-
},
|
|
2844
|
-
{
|
|
2845
|
-
day: "贰",
|
|
2846
|
-
isCurrentMonth: true
|
|
2847
|
-
},
|
|
2848
|
-
{
|
|
2849
|
-
day: "叁",
|
|
2850
|
-
isCurrentMonth: true
|
|
2851
|
-
},
|
|
2852
|
-
{
|
|
2853
|
-
day: "肆",
|
|
2854
|
-
isCurrentMonth: true
|
|
2855
|
-
},
|
|
2856
|
-
{
|
|
2857
|
-
day: "伍",
|
|
2858
|
-
isCurrentMonth: true
|
|
2859
|
-
},
|
|
2860
|
-
{
|
|
2861
|
-
day: "陆",
|
|
2862
|
-
isCurrentMonth: true
|
|
2863
|
-
}
|
|
2864
|
-
];
|
|
2865
|
-
/** 月份名称 */
|
|
2866
|
-
var BASE_MONTH_NAME = [
|
|
2867
|
-
"1月",
|
|
2868
|
-
"2月",
|
|
2869
|
-
"3月",
|
|
2870
|
-
"4月",
|
|
2871
|
-
"5月",
|
|
2872
|
-
"6月",
|
|
2873
|
-
"7月",
|
|
2874
|
-
"8月",
|
|
2875
|
-
"9月",
|
|
2876
|
-
"10月",
|
|
2877
|
-
"11月",
|
|
2878
|
-
"12月"
|
|
2879
|
-
];
|
|
2880
2834
|
/**
|
|
2881
2835
|
* 将 string | Date 转换为 dayjs 对象。
|
|
2882
2836
|
* headless 组件需要用此函数更新 currentRef。
|
|
@@ -2939,7 +2893,7 @@ function useDatePicker(props) {
|
|
|
2939
2893
|
*/
|
|
2940
2894
|
const updateDateRef = (value) => {
|
|
2941
2895
|
if (isEmpty(value)) {
|
|
2942
|
-
displayValue.value =
|
|
2896
|
+
displayValue.value = "";
|
|
2943
2897
|
needPlaceholder = true;
|
|
2944
2898
|
} else {
|
|
2945
2899
|
needPlaceholder = false;
|
|
@@ -5002,7 +4956,7 @@ var BadgeCore = { props: {
|
|
|
5002
4956
|
var EmptyCore = { props: {
|
|
5003
4957
|
description: {
|
|
5004
4958
|
type: String,
|
|
5005
|
-
default:
|
|
4959
|
+
default: void 0
|
|
5006
4960
|
},
|
|
5007
4961
|
image: {
|
|
5008
4962
|
type: String,
|
|
@@ -5046,7 +5000,7 @@ var props$10 = {
|
|
|
5046
5000
|
},
|
|
5047
5001
|
placeholder: {
|
|
5048
5002
|
type: String,
|
|
5049
|
-
default:
|
|
5003
|
+
default: void 0
|
|
5050
5004
|
},
|
|
5051
5005
|
disabled: {
|
|
5052
5006
|
type: Boolean,
|
|
@@ -5574,7 +5528,7 @@ var props$6 = {
|
|
|
5574
5528
|
},
|
|
5575
5529
|
placeholder: {
|
|
5576
5530
|
type: String,
|
|
5577
|
-
default:
|
|
5531
|
+
default: void 0
|
|
5578
5532
|
},
|
|
5579
5533
|
disabled: {
|
|
5580
5534
|
type: Boolean,
|
|
@@ -5864,7 +5818,7 @@ var props$5 = {
|
|
|
5864
5818
|
},
|
|
5865
5819
|
titles: {
|
|
5866
5820
|
type: Array,
|
|
5867
|
-
default:
|
|
5821
|
+
default: void 0
|
|
5868
5822
|
},
|
|
5869
5823
|
filterable: {
|
|
5870
5824
|
type: Boolean,
|
|
@@ -5872,7 +5826,7 @@ var props$5 = {
|
|
|
5872
5826
|
},
|
|
5873
5827
|
filterPlaceholder: {
|
|
5874
5828
|
type: String,
|
|
5875
|
-
default:
|
|
5829
|
+
default: void 0
|
|
5876
5830
|
}
|
|
5877
5831
|
};
|
|
5878
5832
|
//#endregion
|
|
@@ -7129,4 +7083,460 @@ function useOverlayItem(type) {
|
|
|
7129
7083
|
};
|
|
7130
7084
|
}
|
|
7131
7085
|
//#endregion
|
|
7132
|
-
|
|
7086
|
+
//#region locale/zh.ts
|
|
7087
|
+
var zh = {
|
|
7088
|
+
common: {
|
|
7089
|
+
confirm: "确定",
|
|
7090
|
+
cancel: "取消",
|
|
7091
|
+
close: "关闭",
|
|
7092
|
+
search: "搜索",
|
|
7093
|
+
reset: "重置",
|
|
7094
|
+
all: "全部",
|
|
7095
|
+
noData: "暂无数据",
|
|
7096
|
+
loading: "加载中...",
|
|
7097
|
+
save: "保存"
|
|
7098
|
+
},
|
|
7099
|
+
pagination: {
|
|
7100
|
+
totalPrefix: "共 ",
|
|
7101
|
+
totalSuffix: " 条"
|
|
7102
|
+
},
|
|
7103
|
+
datePicker: {
|
|
7104
|
+
placeholder: "请选择日期...",
|
|
7105
|
+
year: (year) => `${year}年`,
|
|
7106
|
+
month: (month) => `${month}月`,
|
|
7107
|
+
hour: "时",
|
|
7108
|
+
minute: "分",
|
|
7109
|
+
second: "秒",
|
|
7110
|
+
confirm: "确定",
|
|
7111
|
+
weekNames: [
|
|
7112
|
+
"日",
|
|
7113
|
+
"一",
|
|
7114
|
+
"二",
|
|
7115
|
+
"三",
|
|
7116
|
+
"四",
|
|
7117
|
+
"五",
|
|
7118
|
+
"六"
|
|
7119
|
+
],
|
|
7120
|
+
monthNames: [
|
|
7121
|
+
"1月",
|
|
7122
|
+
"2月",
|
|
7123
|
+
"3月",
|
|
7124
|
+
"4月",
|
|
7125
|
+
"5月",
|
|
7126
|
+
"6月",
|
|
7127
|
+
"7月",
|
|
7128
|
+
"8月",
|
|
7129
|
+
"9月",
|
|
7130
|
+
"10月",
|
|
7131
|
+
"11月",
|
|
7132
|
+
"12月"
|
|
7133
|
+
]
|
|
7134
|
+
},
|
|
7135
|
+
timePicker: {
|
|
7136
|
+
placeholder: "请选择时间...",
|
|
7137
|
+
hour: "时",
|
|
7138
|
+
minute: "分",
|
|
7139
|
+
second: "秒"
|
|
7140
|
+
},
|
|
7141
|
+
select: {
|
|
7142
|
+
placeholder: "请选择...",
|
|
7143
|
+
clear: "清空",
|
|
7144
|
+
noData: "暂无数据",
|
|
7145
|
+
loading: "加载中..."
|
|
7146
|
+
},
|
|
7147
|
+
autoComplete: {
|
|
7148
|
+
placeholder: "请输入...",
|
|
7149
|
+
loading: "加载中",
|
|
7150
|
+
clear: "清空",
|
|
7151
|
+
noData: "暂无建议"
|
|
7152
|
+
},
|
|
7153
|
+
cascader: {
|
|
7154
|
+
placeholder: "请选择",
|
|
7155
|
+
noMatch: "暂无匹配数据"
|
|
7156
|
+
},
|
|
7157
|
+
image: {
|
|
7158
|
+
loadError: "加载失败",
|
|
7159
|
+
zoomOut: "缩小",
|
|
7160
|
+
zoomIn: "放大",
|
|
7161
|
+
rotate: "旋转",
|
|
7162
|
+
close: "关闭"
|
|
7163
|
+
},
|
|
7164
|
+
transfer: {
|
|
7165
|
+
sourceTitle: "源列表",
|
|
7166
|
+
targetTitle: "目标列表",
|
|
7167
|
+
noData: "暂无数据",
|
|
7168
|
+
filterPlaceholder: "请输入搜索内容"
|
|
7169
|
+
},
|
|
7170
|
+
empty: { description: "暂无数据" },
|
|
7171
|
+
a11y: {
|
|
7172
|
+
rate: "评分",
|
|
7173
|
+
tagClose: "关闭",
|
|
7174
|
+
anchorNav: "锚点导航",
|
|
7175
|
+
backTop: "回到顶部",
|
|
7176
|
+
carouselPrev: "上一张",
|
|
7177
|
+
carouselNext: "下一张",
|
|
7178
|
+
toLightMode: "切换到亮色模式",
|
|
7179
|
+
toDarkMode: "切换到暗色模式",
|
|
7180
|
+
expandSider: "展开侧边栏",
|
|
7181
|
+
collapseSider: "折叠侧边栏"
|
|
7182
|
+
},
|
|
7183
|
+
upload: {
|
|
7184
|
+
trigger: "点击或拖拽文件到此处上传",
|
|
7185
|
+
triggerSimple: "点击上传文件",
|
|
7186
|
+
oversize: (name, max) => max ? `文件 "${name}" 超过大小限制(最大 ${max})` : `文件 "${name}" 超过大小限制`,
|
|
7187
|
+
uploadFailed: "上传失败",
|
|
7188
|
+
statusWaiting: "等待中",
|
|
7189
|
+
statusUploading: "上传中",
|
|
7190
|
+
statusDone: "已完成",
|
|
7191
|
+
statusFailed: "上传失败"
|
|
7192
|
+
},
|
|
7193
|
+
searchTable: {
|
|
7194
|
+
search: "搜索",
|
|
7195
|
+
reset: "重置"
|
|
7196
|
+
},
|
|
7197
|
+
editableTable: {
|
|
7198
|
+
summary: "合计",
|
|
7199
|
+
addRow: "+ 添加行",
|
|
7200
|
+
addFirstRow: "添加第一行",
|
|
7201
|
+
confirmDelete: "确定删除这一行?",
|
|
7202
|
+
delete: "删除",
|
|
7203
|
+
cancel: "取消",
|
|
7204
|
+
noData: "暂无数据"
|
|
7205
|
+
},
|
|
7206
|
+
formPage: {
|
|
7207
|
+
loading: "加载中...",
|
|
7208
|
+
cancel: "取消",
|
|
7209
|
+
saveDraft: "保存草稿",
|
|
7210
|
+
save: "保存",
|
|
7211
|
+
saving: "保存中...",
|
|
7212
|
+
submit: "提交",
|
|
7213
|
+
submitting: "提交中...",
|
|
7214
|
+
basicInfo: "基本信息",
|
|
7215
|
+
editTitle: (title) => `编辑${title}`,
|
|
7216
|
+
createTitle: (title) => `新建${title}`
|
|
7217
|
+
},
|
|
7218
|
+
approvalDialog: {
|
|
7219
|
+
submitTitle: "提交审批",
|
|
7220
|
+
submitConfirm: "确认提交",
|
|
7221
|
+
approveTitle: "审批通过",
|
|
7222
|
+
approveConfirm: "确认通过",
|
|
7223
|
+
rejectTitle: "驳回申请",
|
|
7224
|
+
rejectConfirm: "确认驳回",
|
|
7225
|
+
rejectPlaceholder: "请输入驳回原因...",
|
|
7226
|
+
remarkPlaceholder: "添加备注(可选)...",
|
|
7227
|
+
required: "* 必填",
|
|
7228
|
+
cancel: "取消",
|
|
7229
|
+
processing: "处理中..."
|
|
7230
|
+
},
|
|
7231
|
+
crudPage: {
|
|
7232
|
+
all: "全部",
|
|
7233
|
+
fieldPlaceholder: (label) => `请输入${label}`
|
|
7234
|
+
},
|
|
7235
|
+
login: {
|
|
7236
|
+
username: "用户名",
|
|
7237
|
+
usernamePlaceholder: "请输入用户名",
|
|
7238
|
+
password: "密码",
|
|
7239
|
+
passwordPlaceholder: "请输入密码",
|
|
7240
|
+
remember: "记住我",
|
|
7241
|
+
login: "登 录",
|
|
7242
|
+
loggingIn: "登录中..."
|
|
7243
|
+
},
|
|
7244
|
+
form: {
|
|
7245
|
+
inputPlaceholder: (label) => `请输入${label}`,
|
|
7246
|
+
selectPlaceholder: (label) => `请选择${label}`
|
|
7247
|
+
},
|
|
7248
|
+
routes: {
|
|
7249
|
+
createSuffix: " - 新建",
|
|
7250
|
+
editSuffix: " - 编辑",
|
|
7251
|
+
detailSuffix: " - 详情"
|
|
7252
|
+
},
|
|
7253
|
+
request: {
|
|
7254
|
+
success: "操作成功",
|
|
7255
|
+
opFailed: "操作失败",
|
|
7256
|
+
failed: "请求失败",
|
|
7257
|
+
failedWithStatus: (status) => `请求失败(${status})`,
|
|
7258
|
+
failedWithMsg: (msg) => `请求失败: ${msg}`,
|
|
7259
|
+
timeout: "请求超时",
|
|
7260
|
+
timeoutRetry: "请求超时,请稍后重试",
|
|
7261
|
+
canceled: "请求已取消",
|
|
7262
|
+
permissionDenied: "权限不足,无法执行此操作",
|
|
7263
|
+
invalidUrl: (url) => `无效的请求地址: ${url}`,
|
|
7264
|
+
decodeFailed: (reason) => `解码失败: ${reason}`,
|
|
7265
|
+
parseFailed: "数据解析失败",
|
|
7266
|
+
networkError: "网络错误",
|
|
7267
|
+
networkException: "网络异常,请检查网络连接",
|
|
7268
|
+
unknownError: (error) => `未知错误: ${error}`,
|
|
7269
|
+
unknown: "发生了未知错误",
|
|
7270
|
+
uploadFailed: "上传失败",
|
|
7271
|
+
uploadCanceled: "上传已取消"
|
|
7272
|
+
},
|
|
7273
|
+
aiChat: {
|
|
7274
|
+
inputPlaceholder: "输入消息…",
|
|
7275
|
+
send: "发送",
|
|
7276
|
+
defaultTitle: (n) => `对话 ${n}`,
|
|
7277
|
+
phaseTyping: "正在输入…",
|
|
7278
|
+
phaseThinking: "思考中…",
|
|
7279
|
+
phaseReplying: "回复中…",
|
|
7280
|
+
phaseSending: "发送中…"
|
|
7281
|
+
}
|
|
7282
|
+
};
|
|
7283
|
+
//#endregion
|
|
7284
|
+
//#region locale/en.ts
|
|
7285
|
+
var en = {
|
|
7286
|
+
common: {
|
|
7287
|
+
confirm: "OK",
|
|
7288
|
+
cancel: "Cancel",
|
|
7289
|
+
close: "Close",
|
|
7290
|
+
search: "Search",
|
|
7291
|
+
reset: "Reset",
|
|
7292
|
+
all: "All",
|
|
7293
|
+
noData: "No data",
|
|
7294
|
+
loading: "Loading...",
|
|
7295
|
+
save: "Save"
|
|
7296
|
+
},
|
|
7297
|
+
pagination: {
|
|
7298
|
+
totalPrefix: "",
|
|
7299
|
+
totalSuffix: " items"
|
|
7300
|
+
},
|
|
7301
|
+
datePicker: {
|
|
7302
|
+
placeholder: "Select date...",
|
|
7303
|
+
year: (year) => `${year}`,
|
|
7304
|
+
month: (month) => `${month}`,
|
|
7305
|
+
hour: "Hour",
|
|
7306
|
+
minute: "Min",
|
|
7307
|
+
second: "Sec",
|
|
7308
|
+
confirm: "OK",
|
|
7309
|
+
weekNames: [
|
|
7310
|
+
"Sun",
|
|
7311
|
+
"Mon",
|
|
7312
|
+
"Tue",
|
|
7313
|
+
"Wed",
|
|
7314
|
+
"Thu",
|
|
7315
|
+
"Fri",
|
|
7316
|
+
"Sat"
|
|
7317
|
+
],
|
|
7318
|
+
monthNames: [
|
|
7319
|
+
"Jan",
|
|
7320
|
+
"Feb",
|
|
7321
|
+
"Mar",
|
|
7322
|
+
"Apr",
|
|
7323
|
+
"May",
|
|
7324
|
+
"Jun",
|
|
7325
|
+
"Jul",
|
|
7326
|
+
"Aug",
|
|
7327
|
+
"Sep",
|
|
7328
|
+
"Oct",
|
|
7329
|
+
"Nov",
|
|
7330
|
+
"Dec"
|
|
7331
|
+
]
|
|
7332
|
+
},
|
|
7333
|
+
timePicker: {
|
|
7334
|
+
placeholder: "Select time...",
|
|
7335
|
+
hour: "Hour",
|
|
7336
|
+
minute: "Min",
|
|
7337
|
+
second: "Sec"
|
|
7338
|
+
},
|
|
7339
|
+
select: {
|
|
7340
|
+
placeholder: "Select...",
|
|
7341
|
+
clear: "Clear",
|
|
7342
|
+
noData: "No data",
|
|
7343
|
+
loading: "Loading..."
|
|
7344
|
+
},
|
|
7345
|
+
autoComplete: {
|
|
7346
|
+
placeholder: "Enter...",
|
|
7347
|
+
loading: "Loading",
|
|
7348
|
+
clear: "Clear",
|
|
7349
|
+
noData: "No suggestions"
|
|
7350
|
+
},
|
|
7351
|
+
cascader: {
|
|
7352
|
+
placeholder: "Select",
|
|
7353
|
+
noMatch: "No matching data"
|
|
7354
|
+
},
|
|
7355
|
+
image: {
|
|
7356
|
+
loadError: "Load failed",
|
|
7357
|
+
zoomOut: "Zoom out",
|
|
7358
|
+
zoomIn: "Zoom in",
|
|
7359
|
+
rotate: "Rotate",
|
|
7360
|
+
close: "Close"
|
|
7361
|
+
},
|
|
7362
|
+
transfer: {
|
|
7363
|
+
sourceTitle: "Source",
|
|
7364
|
+
targetTitle: "Target",
|
|
7365
|
+
noData: "No data",
|
|
7366
|
+
filterPlaceholder: "Search..."
|
|
7367
|
+
},
|
|
7368
|
+
empty: { description: "No data" },
|
|
7369
|
+
a11y: {
|
|
7370
|
+
rate: "Rating",
|
|
7371
|
+
tagClose: "Close",
|
|
7372
|
+
anchorNav: "Anchor navigation",
|
|
7373
|
+
backTop: "Back to top",
|
|
7374
|
+
carouselPrev: "Previous",
|
|
7375
|
+
carouselNext: "Next",
|
|
7376
|
+
toLightMode: "Switch to light mode",
|
|
7377
|
+
toDarkMode: "Switch to dark mode",
|
|
7378
|
+
expandSider: "Expand sidebar",
|
|
7379
|
+
collapseSider: "Collapse sidebar"
|
|
7380
|
+
},
|
|
7381
|
+
upload: {
|
|
7382
|
+
trigger: "Click or drag file here to upload",
|
|
7383
|
+
triggerSimple: "Click to upload",
|
|
7384
|
+
oversize: (name, max) => max ? `File "${name}" exceeds size limit (max ${max})` : `File "${name}" exceeds size limit`,
|
|
7385
|
+
uploadFailed: "Upload failed",
|
|
7386
|
+
statusWaiting: "Waiting",
|
|
7387
|
+
statusUploading: "Uploading",
|
|
7388
|
+
statusDone: "Done",
|
|
7389
|
+
statusFailed: "Failed"
|
|
7390
|
+
},
|
|
7391
|
+
searchTable: {
|
|
7392
|
+
search: "Search",
|
|
7393
|
+
reset: "Reset"
|
|
7394
|
+
},
|
|
7395
|
+
editableTable: {
|
|
7396
|
+
summary: "Total",
|
|
7397
|
+
addRow: "+ Add row",
|
|
7398
|
+
addFirstRow: "Add first row",
|
|
7399
|
+
confirmDelete: "Delete this row?",
|
|
7400
|
+
delete: "Delete",
|
|
7401
|
+
cancel: "Cancel",
|
|
7402
|
+
noData: "No data"
|
|
7403
|
+
},
|
|
7404
|
+
formPage: {
|
|
7405
|
+
loading: "Loading...",
|
|
7406
|
+
cancel: "Cancel",
|
|
7407
|
+
saveDraft: "Save draft",
|
|
7408
|
+
save: "Save",
|
|
7409
|
+
saving: "Saving...",
|
|
7410
|
+
submit: "Submit",
|
|
7411
|
+
submitting: "Submitting...",
|
|
7412
|
+
basicInfo: "Basic info",
|
|
7413
|
+
editTitle: (title) => `Edit ${title}`,
|
|
7414
|
+
createTitle: (title) => `New ${title}`
|
|
7415
|
+
},
|
|
7416
|
+
approvalDialog: {
|
|
7417
|
+
submitTitle: "Submit for approval",
|
|
7418
|
+
submitConfirm: "Confirm submission",
|
|
7419
|
+
approveTitle: "Approve",
|
|
7420
|
+
approveConfirm: "Confirm approval",
|
|
7421
|
+
rejectTitle: "Reject",
|
|
7422
|
+
rejectConfirm: "Confirm rejection",
|
|
7423
|
+
rejectPlaceholder: "Enter rejection reason...",
|
|
7424
|
+
remarkPlaceholder: "Add remark (optional)...",
|
|
7425
|
+
required: "* Required",
|
|
7426
|
+
cancel: "Cancel",
|
|
7427
|
+
processing: "Processing..."
|
|
7428
|
+
},
|
|
7429
|
+
crudPage: {
|
|
7430
|
+
all: "All",
|
|
7431
|
+
fieldPlaceholder: (label) => `Enter ${label}`
|
|
7432
|
+
},
|
|
7433
|
+
login: {
|
|
7434
|
+
username: "Username",
|
|
7435
|
+
usernamePlaceholder: "Enter username",
|
|
7436
|
+
password: "Password",
|
|
7437
|
+
passwordPlaceholder: "Enter password",
|
|
7438
|
+
remember: "Remember me",
|
|
7439
|
+
login: "Log in",
|
|
7440
|
+
loggingIn: "Logging in..."
|
|
7441
|
+
},
|
|
7442
|
+
form: {
|
|
7443
|
+
inputPlaceholder: (label) => `Enter ${label}`,
|
|
7444
|
+
selectPlaceholder: (label) => `Select ${label}`
|
|
7445
|
+
},
|
|
7446
|
+
routes: {
|
|
7447
|
+
createSuffix: " - New",
|
|
7448
|
+
editSuffix: " - Edit",
|
|
7449
|
+
detailSuffix: " - Details"
|
|
7450
|
+
},
|
|
7451
|
+
request: {
|
|
7452
|
+
success: "Success",
|
|
7453
|
+
opFailed: "Operation failed",
|
|
7454
|
+
failed: "Request failed",
|
|
7455
|
+
failedWithStatus: (status) => `Request failed (${status})`,
|
|
7456
|
+
failedWithMsg: (msg) => `Request failed: ${msg}`,
|
|
7457
|
+
timeout: "Request timed out",
|
|
7458
|
+
timeoutRetry: "Request timed out, please try again",
|
|
7459
|
+
canceled: "Request canceled",
|
|
7460
|
+
permissionDenied: "Permission denied",
|
|
7461
|
+
invalidUrl: (url) => `Invalid request URL: ${url}`,
|
|
7462
|
+
decodeFailed: (reason) => `Decode failed: ${reason}`,
|
|
7463
|
+
parseFailed: "Failed to parse data",
|
|
7464
|
+
networkError: "Network error",
|
|
7465
|
+
networkException: "Network error, please check your connection",
|
|
7466
|
+
unknownError: (error) => `Unknown error: ${error}`,
|
|
7467
|
+
unknown: "An unknown error occurred",
|
|
7468
|
+
uploadFailed: "Upload failed",
|
|
7469
|
+
uploadCanceled: "Upload canceled"
|
|
7470
|
+
},
|
|
7471
|
+
aiChat: {
|
|
7472
|
+
inputPlaceholder: "Type a message…",
|
|
7473
|
+
send: "Send",
|
|
7474
|
+
defaultTitle: (n) => `Chat ${n}`,
|
|
7475
|
+
phaseTyping: "Typing…",
|
|
7476
|
+
phaseThinking: "Thinking…",
|
|
7477
|
+
phaseReplying: "Replying…",
|
|
7478
|
+
phaseSending: "Sending…"
|
|
7479
|
+
}
|
|
7480
|
+
};
|
|
7481
|
+
//#endregion
|
|
7482
|
+
//#region locale/index.ts
|
|
7483
|
+
/**
|
|
7484
|
+
* @description kine-design locale entry — built-in language packs + types.
|
|
7485
|
+
*
|
|
7486
|
+
* The library ships only the two general languages (zh / en). To use another
|
|
7487
|
+
* language, build a full dictionary that satisfies `KineLocaleMessages` in the
|
|
7488
|
+
* consuming app and pass it straight to the provider:
|
|
7489
|
+
*
|
|
7490
|
+
* import type { KineLocaleMessages } from '@kine-design/core';
|
|
7491
|
+
* const bn: KineLocaleMessages = { ...full Bengali dictionary... };
|
|
7492
|
+
* // <KConfigProvider :locale="bn"> ... </KConfigProvider>
|
|
7493
|
+
*
|
|
7494
|
+
* TypeScript enforces full key coverage, so a partial/forgotten key is a
|
|
7495
|
+
* compile error in the app — the same guarantee the built-in packs enjoy.
|
|
7496
|
+
* @author kine-design
|
|
7497
|
+
* @version v1.0.0
|
|
7498
|
+
*/
|
|
7499
|
+
/** Built-in language packs, keyed by locale name. */
|
|
7500
|
+
var locales = {
|
|
7501
|
+
zh,
|
|
7502
|
+
en
|
|
7503
|
+
};
|
|
7504
|
+
/** Fallback locale used when none is provided / an unknown name is passed. */
|
|
7505
|
+
var DEFAULT_LOCALE = "zh";
|
|
7506
|
+
//#endregion
|
|
7507
|
+
//#region compositions/common/useLocale.ts
|
|
7508
|
+
/**
|
|
7509
|
+
* @description composable for unified component locale with global injection
|
|
7510
|
+
* support — the i18n counterpart of `useComponentSize`. Components call
|
|
7511
|
+
* `useLocale()` to get the active message dictionary (a computed ref) and read
|
|
7512
|
+
* their user-facing strings from it instead of hardcoding text.
|
|
7513
|
+
* @author kine-design
|
|
7514
|
+
* @version v1.0.0
|
|
7515
|
+
*
|
|
7516
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
7517
|
+
*/
|
|
7518
|
+
var KINE_LOCALE_KEY = Symbol("kine-locale");
|
|
7519
|
+
function resolveMessages(config) {
|
|
7520
|
+
if (!config) return locales["zh"];
|
|
7521
|
+
if (typeof config === "string") return locales[config] ?? locales["zh"];
|
|
7522
|
+
return config;
|
|
7523
|
+
}
|
|
7524
|
+
/**
|
|
7525
|
+
* Resolve the active message dictionary from the nearest `KConfigProvider`.
|
|
7526
|
+
* Falls back to the default (zh) pack when no provider is present.
|
|
7527
|
+
*/
|
|
7528
|
+
function useLocale() {
|
|
7529
|
+
const injected = inject(KINE_LOCALE_KEY, void 0);
|
|
7530
|
+
return computed(() => resolveMessages(injected?.value));
|
|
7531
|
+
}
|
|
7532
|
+
var activeLocaleMessages = locales["zh"];
|
|
7533
|
+
/** Set the global active dictionary. Called by KConfigProvider on locale change. */
|
|
7534
|
+
function setActiveLocaleMessages(config) {
|
|
7535
|
+
activeLocaleMessages = resolveMessages(config);
|
|
7536
|
+
}
|
|
7537
|
+
/** Read the global active dictionary from non-component (pure-function) code. */
|
|
7538
|
+
function getActiveLocaleMessages() {
|
|
7539
|
+
return activeLocaleMessages;
|
|
7540
|
+
}
|
|
7541
|
+
//#endregion
|
|
7542
|
+
export { AffixCore, AlertCore, AnchorCore, AutoCompleteCore, AvatarCore, BackTopCore, BadgeCore, BorderCore, BreadcrumbCore, ButtonCore, CardCore, CarouselCore, CascaderCore, CheckboxCore, CollapseCore, ConfirmCore, DEFAULT_LOCALE, DEFAULT_MENU_CONFIG, DEFAULT_TREE_CONFIG, DarkModeCore, DatePickerCore, DescriptionsCore, DialogCore, DividerCore, DrawerCore, DropdownCore, EmptyCore, FormCore, GridCore, ImageCore, InputCore, InputNumberCore, KINE_LOCALE_KEY, LiCore, ListCore, LoadingCore, MenuCore, MessageCore, MessagePopoverCore, NotificationCore, PaginationCore, PopoverCore, ProgressCore, RadioCore, RateCore, ResultCore, SelectCore, SkeletonCore, SliderCore, SpaceCore, StepsCore, SwitchCore, TableColumnCore, TableCore, TabsCore, TagCore, TimelineCore, TooltipCore, TransferCore, Tree, TreeCore, VirtualListCore, createRadioId, en, fixKey, generateTimeColumn, getActiveLocaleMessages, getNewModelValue, initChecked, locales, setActiveLocaleMessages, toDayjs, treeNodeProps, props as treeProps, useDatePicker, useLocale, useMessageQueue, useNotificationQueue, useOverlayItem, useOverlayStack, useOverlayStackStore, usePagination, useTable, useTree, zh };
|
package/dist/index.d.ts
CHANGED
|
@@ -64,3 +64,5 @@ export * from './components/base/backTop';
|
|
|
64
64
|
export * from './components/base/affix';
|
|
65
65
|
export * from './components/base/anchor';
|
|
66
66
|
export * from './compositions/overlay';
|
|
67
|
+
export * from './locale';
|
|
68
|
+
export { useLocale, KINE_LOCALE_KEY, setActiveLocaleMessages, getActiveLocaleMessages, type KineLocaleConfig, } from './compositions/common/useLocale';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as zh } from './zh';
|
|
2
|
+
import { default as en } from './en';
|
|
3
|
+
import { KineLocaleName, KineLocaleMessages } from './types';
|
|
4
|
+
export type { KineLocaleName, KineLocaleMessages };
|
|
5
|
+
/** Built-in language packs, keyed by locale name. */
|
|
6
|
+
export declare const locales: Record<KineLocaleName, KineLocaleMessages>;
|
|
7
|
+
/** Fallback locale used when none is provided / an unknown name is passed. */
|
|
8
|
+
export declare const DEFAULT_LOCALE: KineLocaleName;
|
|
9
|
+
export { zh, en };
|