el-plus 0.0.57 → 0.0.59

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 (48) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.full.js +93 -279
  3. package/dist/index.full.min.js +2 -1
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +2 -1
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +93 -279
  8. package/es/components/buttons/index.d.ts +6 -6
  9. package/es/components/buttons/src/buttons-vue.d.ts +2 -2
  10. package/es/components/date-picker-range/index.d.ts +3 -3
  11. package/es/components/date-picker-range/src/date-picker-range.vue.d.ts +1 -1
  12. package/es/components/input/index.d.ts +3 -3
  13. package/es/components/input/src/input.vue.d.ts +1 -1
  14. package/es/components/search-list-page/index.d.ts +30 -30
  15. package/es/components/search-list-page/src/search-list-page.vue.d.ts +10 -10
  16. package/es/components/search-list-page/src/use-search-list-page.d.ts +10 -10
  17. package/es/components/table/index.d.ts +6 -6
  18. package/es/components/table/src/table.vue.d.ts +2 -2
  19. package/es/components/table/src/use-table.d.ts +2 -2
  20. package/es/components/uni-vue/src/use-uni-vue.mjs +66 -20
  21. package/es/components/uni-vue/src/use-uni-vue.mjs.map +1 -1
  22. package/es/hooks/use-locale.mjs +20 -50
  23. package/es/hooks/use-locale.mjs.map +1 -1
  24. package/es/hooks/use-navigation.mjs +6 -6
  25. package/es/hooks/use-navigation.mjs.map +1 -1
  26. package/es/package.json.mjs +1 -1
  27. package/es/types/global.d.ts +1 -0
  28. package/lib/components/buttons/index.d.ts +6 -6
  29. package/lib/components/buttons/src/buttons-vue.d.ts +2 -2
  30. package/lib/components/date-picker-range/index.d.ts +3 -3
  31. package/lib/components/date-picker-range/src/date-picker-range.vue.d.ts +1 -1
  32. package/lib/components/input/index.d.ts +3 -3
  33. package/lib/components/input/src/input.vue.d.ts +1 -1
  34. package/lib/components/search-list-page/index.d.ts +30 -30
  35. package/lib/components/search-list-page/src/search-list-page.vue.d.ts +10 -10
  36. package/lib/components/search-list-page/src/use-search-list-page.d.ts +10 -10
  37. package/lib/components/table/index.d.ts +6 -6
  38. package/lib/components/table/src/table.vue.d.ts +2 -2
  39. package/lib/components/table/src/use-table.d.ts +2 -2
  40. package/lib/components/uni-vue/src/use-uni-vue.js +65 -19
  41. package/lib/components/uni-vue/src/use-uni-vue.js.map +1 -1
  42. package/lib/hooks/use-locale.js +20 -50
  43. package/lib/hooks/use-locale.js.map +1 -1
  44. package/lib/hooks/use-navigation.js +6 -6
  45. package/lib/hooks/use-navigation.js.map +1 -1
  46. package/lib/package.json.js +1 -1
  47. package/lib/types/global.d.ts +1 -0
  48. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # el-plus
2
2
 
3
+ ## 0.0.59
4
+
5
+ ### Patch Changes
6
+
7
+ - 1
8
+
9
+ ## 0.0.58
10
+
11
+ ### Patch Changes
12
+
13
+ - 1
14
+
3
15
  ## 0.0.57
4
16
 
5
17
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- /*! ElPlus v0.0.57 */
1
+ /*! ElPlus v0.0.59 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus'), require('@vue/shared'), require('axios'), require('js-cookie'), require('defu'), require('qs'), require('element-plus/es/components/table/src/table/defaults'), require('@element-plus/icons-vue'), require('mitt'), require('lodash-unified'), require('@vueuse/core'), require('vue-router'), require('js-base64'), require('vue2'), require('vue-router3')) :
@@ -204,107 +204,10 @@
204
204
  }
205
205
  };
206
206
 
207
- var zhCn = {
208
- name: "zh-cn",
209
- ep: {
210
- dialog: {
211
- cancel: "\u53D6\u6D88",
212
- confirm: "\u786E\u5B9A",
213
- title: "\u63D0\u793A"
214
- },
215
- buttons: {
216
- cancel: "\u53D6\u6D88",
217
- confirm: "\u786E\u5B9A",
218
- secondConfirm: "\u786E\u5B9A\u8981",
219
- secondConfirmEnd: "\u5417",
220
- prompt: "\u63D0\u793A"
221
- },
222
- input: {
223
- placeholder: "\u8BF7\u8F93\u5165"
224
- },
225
- datePickerRange: {
226
- lastWeek: "\u6700\u8FD1\u4E00\u5468",
227
- lastMonth: "\u6700\u8FD1\u4E00\u4E2A\u6708",
228
- lastThreeMonth: "\u6700\u8FD1\u4E09\u4E2A\u6708",
229
- startTime: "\u5F00\u59CB\u65F6\u95F4",
230
- endTime: "\u7ED3\u675F\u65F6\u95F4"
231
- },
232
- formItem: {
233
- required: "\u4E0D\u80FD\u4E3A\u7A7A"
234
- },
235
- form: {
236
- more: "\u66F4\u591A",
237
- collapse: "\u6536\u8D77"
238
- },
239
- header: {
240
- save: "\u4FDD\u5B58",
241
- edit: "\u4FEE\u6539",
242
- cancel: "\u53D6\u6D88",
243
- refresh: "\u5237\u65B0",
244
- approvalLog: "\u5BA1\u6279\u65E5\u5FD7"
245
- },
246
- searchListPage: {
247
- add: "\u65B0\u589E",
248
- templateDownload: "\u6A21\u7248\u4E0B\u8F7D",
249
- import: "\u5BFC\u5165",
250
- export: "\u5BFC\u51FA",
251
- search: "\u641C\u7D22",
252
- clear: "\u6E05\u7A7A"
253
- },
254
- table: {
255
- select: "\u9009\u62E9",
256
- serialNumber: "\u5E8F\u53F7",
257
- operation: "\u64CD\u4F5C"
258
- },
259
- title: {
260
- collapse: "\u6298\u53E0",
261
- expand: "\u5C55\u5F00"
262
- },
263
- chooseDialog: {
264
- selected: "\u5DF2\u9009\u4E2D",
265
- unit: "\u4E2A"
266
- },
267
- customColumn: {
268
- columnSettings: "\u81EA\u5B9A\u4E49\u5217\u8BBE\u7F6E",
269
- defineColumn: "\u81EA\u5B9A\u4E49\u5217",
270
- hiddenField: "\u9690\u85CF\u5B57\u6BB5",
271
- visibleField: "\u663E\u793A\u5B57\u6BB5",
272
- moveLeft: "\u5DE6\u79FB",
273
- moveRight: "\u53F3\u79FB",
274
- moveUp: "\u4E0A\u79FB",
275
- moveDown: "\u4E0B\u79FB"
276
- },
277
- bpm: {
278
- approvalLog: "\u5BA1\u6279\u65E5\u5FD7"
279
- },
280
- loading: {
281
- loading: "\u6B63\u5728\u52A0\u8F7D\u4E2D..."
282
- },
283
- http: {
284
- networkError: "\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u540E\u91CD\u8BD5",
285
- timeout: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",
286
- requestError: "\u8BF7\u6C42\u9519\u8BEF\u3002\u8BF7\u68C0\u67E5\u60A8\u7684\u8F93\u5165\u5E76\u91CD\u8BD5",
287
- authExpired: "\u767B\u5F55\u8BA4\u8BC1\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55\u540E\u7EE7\u7EED",
288
- forbidden: "\u7981\u6B62\u8BBF\u95EE, \u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u6B64\u8D44\u6E90",
289
- notFound: "\u672A\u627E\u5230, \u8BF7\u6C42\u7684\u8D44\u6E90\u4E0D\u5B58\u5728",
290
- //
291
- serverError: "\u5185\u90E8\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"
292
- },
293
- attachment: {
294
- addAttachment: "\u6DFB\u52A0\u9644\u4EF6",
295
- manageAttachment: "\u9644\u4EF6\u7BA1\u7406",
296
- operation: "\u64CD\u4F5C",
297
- download: "\u4E0B\u8F7D",
298
- delete: "\u5220\u9664",
299
- attachmentType: "\u9644\u4EF6\u7C7B\u578B",
300
- fileName: "\u6587\u4EF6\u540D\u79F0",
301
- creator: "\u521B\u5EFA\u4EBA",
302
- createTime: "\u521B\u5EFA\u65F6\u95F4",
303
- description: "\u8BF4\u660E"
304
- }
305
- }
306
- };
307
-
207
+ const elLocaleModules = undefined(
208
+ "/node_modules/element-plus/es/locale/lang/*.mjs"
209
+ );
210
+ const localeModules = undefined("../locale/lang/*.{mjs,ts}");
308
211
  const TRANSLATER_KEY = /* @__PURE__ */ Symbol("TRANSLATER_KEY");
309
212
  let cachedTranslater = null;
310
213
  const useLocale = () => {
@@ -332,26 +235,15 @@
332
235
  const provideFn = inSetup2 ? vue.provide : app.provide;
333
236
  return new Promise(async (resolve) => {
334
237
  try {
335
- let locale = zhCn;
336
- try {
337
- const epLocalePath = `../locale/lang/${localeLang}`;
338
- const { default: lang } = await import(
339
- /* @vite-ignore */
340
- epLocalePath
341
- );
342
- locale = lang;
343
- } catch (e) {
344
- try {
345
- const { default: en } = await Promise.resolve().then(function () { return en$1; });
346
- locale = en;
347
- } catch (enError) {
348
- console.error(
349
- "Failed to load both specified locale and English locale, using Chinese locale as fallback:",
350
- enError
351
- );
352
- }
238
+ const basePath = "../locale/lang/";
239
+ const ext = process.env.NODE_ENV === "production" ? ".mjs" : ".ts";
240
+ const modulePath = basePath + localeLang + ext;
241
+ let loader = localeModules[modulePath];
242
+ if (!loader) {
243
+ loader = localeModules[basePath + "en" + ext];
353
244
  }
354
- const { t } = elementPlus.useLocale(vue.ref(locale));
245
+ const module = await loader();
246
+ const { t } = elementPlus.useLocale(vue.ref(module.default));
355
247
  provideFn(TRANSLATER_KEY, t);
356
248
  resolve();
357
249
  addLangClass(window.hxlang);
@@ -361,34 +253,15 @@
361
253
  });
362
254
  };
363
255
  const loadElLocale = async () => {
364
- try {
365
- let elLocale = zhCn;
366
- try {
367
- const elLocalePath = `element-plus/es/locale/lang/${localeLang}`;
368
- const { default: lang } = await import(
369
- /* @vite-ignore */
370
- elLocalePath
371
- );
372
- elLocale = lang;
373
- } catch (e) {
374
- try {
375
- const { default: en } = await import(
376
- /* @vite-ignore */
377
- 'element-plus/es/locale/lang/en'
378
- );
379
- elLocale = en;
380
- } catch (enError) {
381
- console.error(
382
- "Failed to load both specified locale and English locale, using Chinese locale as fallback:",
383
- enError
384
- );
385
- }
386
- }
387
- return elLocale;
388
- } catch (error) {
389
- console.error(error);
390
- return zhCn;
256
+ const basePath = "/node_modules/element-plus/es/locale/lang/";
257
+ const ext = ".mjs";
258
+ const modulePath = basePath + localeLang + ext;
259
+ let loader = elLocaleModules[modulePath];
260
+ if (!loader) {
261
+ loader = elLocaleModules[basePath + "en" + ext];
391
262
  }
263
+ const module = await loader();
264
+ return module.default;
392
265
  };
393
266
  return {
394
267
  loadLocale,
@@ -3261,6 +3134,7 @@
3261
3134
 
3262
3135
  const useNavigation = () => {
3263
3136
  const router = vueRouter.useRouter();
3137
+ const route = vueRouter.useRoute();
3264
3138
  const $goto = (r) => {
3265
3139
  const item = {
3266
3140
  id: Date.now(),
@@ -3292,11 +3166,11 @@
3292
3166
  }
3293
3167
  }
3294
3168
  };
3295
- const route = findRoute(routes, r);
3296
- if (route) {
3169
+ const route2 = findRoute(routes, r);
3170
+ if (route2) {
3297
3171
  item.id = r.id || item.id;
3298
- item.name = r.title || (window.$hxt ? window.$hxt(route.meta.title) : route.meta.title);
3299
- item.url = `${projectRootPath}#${route.path}${qs__namespace.stringify(r.query, { encode: false })}`;
3172
+ item.name = r.title || (window.$hxt ? window.$hxt(route2.meta.title) : route2.meta.title);
3173
+ item.url = `${projectRootPath}#${route2.path}${qs__namespace.stringify(r.query, { encode: false })}`;
3300
3174
  if (openTab) {
3301
3175
  openTab(item);
3302
3176
  } else {
@@ -3318,8 +3192,7 @@
3318
3192
  window.parent?.openMenuSelect?.(preTag);
3319
3193
  };
3320
3194
  const mode = vue.computed(() => {
3321
- const { query } = vueRouter.useRoute();
3322
- return query.mode;
3195
+ return route.query.mode;
3323
3196
  });
3324
3197
  const isBrowse = vue.computed(() => mode.value === "browse");
3325
3198
  const isEdit = vue.computed(() => mode.value === "edit");
@@ -4069,8 +3942,12 @@
4069
3942
  Object.keys(attrs).forEach((key) => {
4070
3943
  if (key.startsWith("on")) {
4071
3944
  let eventName = key.slice(2);
4072
- eventName = eventName.replace(/([A-Z])/g, "-$1").toLowerCase();
4073
- eventName = eventName.slice(1);
3945
+ if (eventName.startsWith("Update:")) {
3946
+ eventName = "update:" + eventName.slice(7);
3947
+ } else {
3948
+ eventName = eventName.replace(/([A-Z])/g, "-$1").toLowerCase();
3949
+ eventName = eventName.slice(1);
3950
+ }
4074
3951
  events[eventName] = attrs[key];
4075
3952
  } else {
4076
3953
  _props[key] = attrs[key];
@@ -4102,7 +3979,17 @@
4102
3979
  return "";
4103
3980
  }
4104
3981
  };
4105
- const hasLoadStaticJsResource = () => {
3982
+ const loadStaticJsResource = async () => {
3983
+ const promises = [];
3984
+ if (!isBpm && !window.ElementUIComponents) {
3985
+ await new Promise((resolve, reject) => {
3986
+ const script = document.createElement("script");
3987
+ script.src = "/element-ui.js";
3988
+ script.onload = resolve;
3989
+ script.onerror = reject;
3990
+ document.body.appendChild(script);
3991
+ });
3992
+ }
4106
3993
  let globalName;
4107
3994
  if (isAddress) {
4108
3995
  globalName = "hxAddress";
@@ -4110,24 +3997,39 @@
4110
3997
  if (isBpm) {
4111
3998
  globalName = "index";
4112
3999
  }
4113
- if (window[globalName]) return true;
4114
- return false;
4115
- };
4116
- const loadStaticJsResource = async () => {
4117
- return new Promise((resolve, reject) => {
4118
- if (hasLoadStaticJsResource()) return resolve("");
4119
- const script = document.createElement("script");
4120
- script.src = getStaticJsUrl();
4121
- script.onload = resolve;
4122
- script.onerror = reject;
4123
- document.body.appendChild(script);
4124
- });
4000
+ if (globalName && !window[globalName]) {
4001
+ promises.push(
4002
+ new Promise((resolve, reject) => {
4003
+ const script = document.createElement("script");
4004
+ script.src = getStaticJsUrl();
4005
+ script.onload = () => resolve();
4006
+ script.onerror = reject;
4007
+ document.body.appendChild(script);
4008
+ })
4009
+ );
4010
+ }
4011
+ return Promise.all(promises);
4125
4012
  };
4126
4013
  const loadStaticCssResource = async () => {
4127
- const { data: css } = await http.request(getStaticCssUrl(), {
4128
- responseReturn: "raw"
4129
- });
4130
- return css;
4014
+ const cssPromises = [];
4015
+ if (!isBpm) {
4016
+ cssPromises.push(
4017
+ http.request("/element-ui.css", {
4018
+ responseReturn: "raw",
4019
+ baseURL: ""
4020
+ }).then((res) => res.data)
4021
+ );
4022
+ }
4023
+ const staticCssUrl = getStaticCssUrl();
4024
+ if (staticCssUrl) {
4025
+ cssPromises.push(
4026
+ http.request(staticCssUrl, {
4027
+ responseReturn: "raw"
4028
+ }).then((res) => res.data)
4029
+ );
4030
+ }
4031
+ const cssContents = await Promise.all(cssPromises);
4032
+ return cssContents.join("\n");
4131
4033
  };
4132
4034
  let instance;
4133
4035
  const setupInstance = async () => {
@@ -4161,6 +4063,23 @@
4161
4063
  render: (h) => h(props.name, prepareVueAttributes())
4162
4064
  });
4163
4065
  };
4066
+ vue.watch(
4067
+ () => attrs,
4068
+ () => {
4069
+ if (instance) {
4070
+ const { props: newProps, on: newEvents } = prepareVueAttributes();
4071
+ Object.keys(newProps).forEach((key) => {
4072
+ instance.$props[key] = newProps[key];
4073
+ });
4074
+ Object.keys(newEvents).forEach((eventName) => {
4075
+ instance.$off(eventName);
4076
+ instance.$on(eventName, newEvents[eventName]);
4077
+ });
4078
+ instance.$forceUpdate();
4079
+ }
4080
+ },
4081
+ { deep: true }
4082
+ );
4164
4083
  vue.onMounted(() => {
4165
4084
  setupInstance();
4166
4085
  });
@@ -4218,7 +4137,7 @@
4218
4137
  EpUniVue
4219
4138
  ];
4220
4139
 
4221
- var version = "0.0.57";
4140
+ var version = "0.0.59";
4222
4141
 
4223
4142
  var globalProperties = {
4224
4143
  install(app) {
@@ -4359,111 +4278,6 @@
4359
4278
  version
4360
4279
  };
4361
4280
 
4362
- var en = {
4363
- name: "en",
4364
- ep: {
4365
- dialog: {
4366
- cancel: "Cancel",
4367
- confirm: "OK",
4368
- title: "Prompt"
4369
- },
4370
- buttons: {
4371
- cancel: "Cancel",
4372
- confirm: "Confirm",
4373
- secondConfirm: "Are you sure to",
4374
- secondConfirmEnd: "",
4375
- prompt: "prompt"
4376
- },
4377
- input: {
4378
- placeholder: "Please enter"
4379
- },
4380
- datePickerRange: {
4381
- lastWeek: "Last week",
4382
- lastMonth: "Last month",
4383
- lastThreeMonth: "Last three months",
4384
- startTime: "Start time",
4385
- endTime: "End time"
4386
- },
4387
- formItem: {
4388
- required: "Cannot be empty"
4389
- },
4390
- form: {
4391
- more: "More",
4392
- collapse: "Collapse"
4393
- },
4394
- header: {
4395
- save: "Save",
4396
- edit: "Edit",
4397
- cancel: "Cancel",
4398
- refresh: "Refresh",
4399
- approvalLog: "Approval log"
4400
- },
4401
- searchListPage: {
4402
- add: "Add",
4403
- templateDownload: "Template download",
4404
- import: "Import",
4405
- export: "Export",
4406
- search: "Search",
4407
- clear: "Clear"
4408
- },
4409
- table: {
4410
- select: "Select",
4411
- serialNumber: "No.",
4412
- operation: "Operation"
4413
- },
4414
- title: {
4415
- collapse: "Collapse",
4416
- expand: "Expand"
4417
- },
4418
- chooseDialog: {
4419
- selected: "Selected",
4420
- unit: ""
4421
- },
4422
- customColumn: {
4423
- columnSettings: "Column settings",
4424
- defineColumn: "Define column",
4425
- hiddenField: "Hidden field",
4426
- visibleField: "Display field",
4427
- moveLeft: "Move left",
4428
- moveRight: "Move right",
4429
- moveUp: "Move up",
4430
- moveDown: "Move down"
4431
- },
4432
- bpm: {
4433
- approvalLog: "Approval log"
4434
- },
4435
- loading: {
4436
- loading: "Loading..."
4437
- },
4438
- http: {
4439
- networkError: "Network error, please check your connection and try again",
4440
- timeout: "Request timeout, please try again later",
4441
- requestError: "Request error. Please check your input and try again",
4442
- authExpired: "Login authentication expired, please log in again",
4443
- forbidden: "Access forbidden, you do not have permission to access this resource",
4444
- notFound: "Not found, the requested resource does not exist",
4445
- serverError: "Internal server error, please try again later"
4446
- },
4447
- attachment: {
4448
- addAttachment: "Add attachment",
4449
- manageAttachment: "Attachment management",
4450
- operation: "Operation",
4451
- download: "Download",
4452
- delete: "Delete",
4453
- attachmentType: "Attachment type",
4454
- fileName: "File name",
4455
- creator: "Creator",
4456
- createTime: "Create time",
4457
- description: "Description"
4458
- }
4459
- }
4460
- };
4461
-
4462
- var en$1 = /*#__PURE__*/Object.freeze({
4463
- __proto__: null,
4464
- default: en
4465
- });
4466
-
4467
4281
  exports.EpAttachment = EpAttachment;
4468
4282
  exports.EpButtons = EpButtons;
4469
4283
  exports.EpCustomColumn = EpCustomColumn;