ztxkutils 20.0.2 → 20.0.3

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.
@@ -0,0 +1,26 @@
1
+ import instance from './i18next.js';
2
+
3
+ /**
4
+ * @description 数据模型创建
5
+ */
6
+ function createSuccessModel(data, message) {
7
+ return {
8
+ data: data,
9
+ message: message || instance.t('数据请求成功'),
10
+ success: true,
11
+ };
12
+ }
13
+ function createErrorModel(message) {
14
+ return {
15
+ message: message || instance.t('数据请求失败'),
16
+ success: false,
17
+ };
18
+ }
19
+
20
+ var dataModel = /*#__PURE__*/Object.freeze({
21
+ __proto__: null,
22
+ createSuccessModel: createSuccessModel,
23
+ createErrorModel: createErrorModel
24
+ });
25
+
26
+ export { createErrorModel as a, createSuccessModel as c, dataModel as d };
package/dist/dataModel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  import './i18next.js';
2
- export { a as createErrorModel, c as createSuccessModel } from './dataModel-b3629ef3.js';
2
+ export { a as createErrorModel, c as createSuccessModel } from './dataModel-f1ef06bc.js';
package/dist/i18next.js CHANGED
@@ -2377,13 +2377,25 @@ instance.hasLoadedNamespace;
2377
2377
  instance.loadNamespaces;
2378
2378
  instance.loadLanguages;
2379
2379
 
2380
- var originalT = (function () {
2380
+ var originalT = instance.t;
2381
+ var getSourceKey = function (key, params) {
2382
+ if (params) {
2383
+ var keys = Object.keys(params);
2384
+ if (keys.length) {
2385
+ return keys.reduce(function (pre, cur) {
2386
+ return pre.replace("{{" + cur + "}}", params[cur]);
2387
+ }, key);
2388
+ }
2389
+ }
2390
+ return key;
2391
+ };
2392
+ var t = (function () {
2381
2393
  var args = [];
2382
2394
  for (var _i = 0; _i < arguments.length; _i++) {
2383
2395
  args[_i] = arguments[_i];
2384
2396
  }
2385
- return originalT.apply(void 0, args) || args[0];
2397
+ return originalT.apply(void 0, args) || getSourceKey(args === null || args === void 0 ? void 0 : args[0], args === null || args === void 0 ? void 0 : args[1]);
2386
2398
  });
2387
- instance.t = originalT;
2399
+ instance.t = t;
2388
2400
 
2389
2401
  export default instance;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { d as authority } from './authority-7a91cb9f.js';
2
- export { d as dataModel } from './dataModel-b3629ef3.js';
2
+ export { d as dataModel } from './dataModel-f1ef06bc.js';
3
3
  export { t as tools } from './tools-390e3466.js';
4
- export { v as validate } from './validate-21b58a69.js';
5
- export { r as request } from './request-d1972b41.js';
4
+ export { v as validate } from './validate-ab47ebe9.js';
5
+ export { r as request } from './request-80d1ac80.js';
6
6
  export { r as reqUrl } from './reqUrl-ea7ef876.js';
7
7
  import './i18next.js';
8
8
  import './tslib.es6-35653116.js';