@zfqh/uview-x 0.0.0-stage → 0.0.2

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 (93) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +127 -3
  4. package/components/uv-badge/props.ts +83 -0
  5. package/components/uv-badge/uv-badge.vue +186 -0
  6. package/components/uv-button/props.ts +148 -0
  7. package/components/uv-button/uv-button.vue +565 -0
  8. package/components/uv-checkbox/props.ts +83 -0
  9. package/components/uv-checkbox/uv-checkbox.vue +403 -0
  10. package/components/uv-checkbox-group/props.ts +97 -0
  11. package/components/uv-checkbox-group/uv-checkbox-group.vue +163 -0
  12. package/components/uv-code/props.ts +48 -0
  13. package/components/uv-code/uv-code.vue +156 -0
  14. package/components/uv-dialog/props.ts +56 -0
  15. package/components/uv-dialog/uv-dialog.vue +492 -0
  16. package/components/uv-form/props.ts +59 -0
  17. package/components/uv-form/uv-form.vue +256 -0
  18. package/components/uv-form/valid.ts +1344 -0
  19. package/components/uv-form-item/props.ts +62 -0
  20. package/components/uv-form-item/uv-form-item.vue +335 -0
  21. package/components/uv-icon/icons.ts +161 -0
  22. package/components/uv-icon/props.ts +91 -0
  23. package/components/uv-icon/uv-icon.vue +208 -0
  24. package/components/uv-icon/uvicons.ttf +0 -0
  25. package/components/uv-input/props.ts +185 -0
  26. package/components/uv-input/uv-input.vue +431 -0
  27. package/components/uv-line/props.ts +42 -0
  28. package/components/uv-line/uv-line.vue +75 -0
  29. package/components/uv-line-progress/props.ts +43 -0
  30. package/components/uv-line-progress/uv-line-progress.vue +166 -0
  31. package/components/uv-loading-icon/props.ts +78 -0
  32. package/components/uv-loading-icon/uv-loading-icon.vue +226 -0
  33. package/components/uv-overlay/props.ts +38 -0
  34. package/components/uv-overlay/uv-overlay.vue +120 -0
  35. package/components/uv-popup/props.ts +101 -0
  36. package/components/uv-popup/uv-popup.vue +371 -0
  37. package/components/uv-safe-bottom/props.ts +18 -0
  38. package/components/uv-safe-bottom/uv-safe-bottom.vue +120 -0
  39. package/components/uv-status-bar/props.ts +22 -0
  40. package/components/uv-status-bar/uv-status-bar.vue +121 -0
  41. package/components/uv-tabs/props.ts +84 -0
  42. package/components/uv-tabs/uv-tabs.vue +432 -0
  43. package/components/uv-transition/props.ts +38 -0
  44. package/components/uv-transition/uv-transition.vue +170 -0
  45. package/hooks/index.ts +5 -0
  46. package/hooks/useDebounce.ts +35 -0
  47. package/hooks/useI18n.ts +95 -0
  48. package/hooks/useThrottle.ts +38 -0
  49. package/index.ts +23 -0
  50. package/libs/dayjs/index.ts +217 -0
  51. package/libs/index.ts +4 -0
  52. package/libs/luch-request/adapters/index.ts +133 -0
  53. package/libs/luch-request/core/InterceptorManager.ts +52 -0
  54. package/libs/luch-request/core/Request.ts +202 -0
  55. package/libs/luch-request/core/buildFullPath.ts +21 -0
  56. package/libs/luch-request/core/defaults.ts +34 -0
  57. package/libs/luch-request/core/dispatchRequest.ts +7 -0
  58. package/libs/luch-request/core/mergeConfig.ts +127 -0
  59. package/libs/luch-request/core/settle.ts +17 -0
  60. package/libs/luch-request/helpers/buildURL.ts +65 -0
  61. package/libs/luch-request/helpers/combineURLs.ts +15 -0
  62. package/libs/luch-request/helpers/isAbsoluteURL.ts +15 -0
  63. package/libs/luch-request/index.d.ts +197 -0
  64. package/libs/luch-request/index.ts +3 -0
  65. package/libs/luch-request/utils/clone.ts +265 -0
  66. package/libs/luch-request/utils.ts +136 -0
  67. package/locales/en.ts +78 -0
  68. package/locales/index.ts +169 -0
  69. package/locales/zh-Hans.ts +78 -0
  70. package/package.json +42 -4
  71. package/styles/color.scss +33 -0
  72. package/styles/common.scss +134 -0
  73. package/styles/components.scss +19 -0
  74. package/styles/index.scss +7 -0
  75. package/styles/theme.scss +44 -0
  76. package/styles/var.module.scss +32 -0
  77. package/styles/vue.scss +39 -0
  78. package/theme.scss +2 -0
  79. package/types/index.d.ts +66 -0
  80. package/utils/colorGradient.ts +139 -0
  81. package/utils/compat.ts +165 -0
  82. package/utils/compress.ts +34 -0
  83. package/utils/config.ts +95 -0
  84. package/utils/debounce.ts +7 -0
  85. package/utils/digit.ts +157 -0
  86. package/utils/function.ts +771 -0
  87. package/utils/http.ts +5 -0
  88. package/utils/index.ts +57 -0
  89. package/utils/locale.ts +296 -0
  90. package/utils/platform.ts +71 -0
  91. package/utils/route.ts +142 -0
  92. package/utils/test.ts +256 -0
  93. package/utils/throttle.ts +7 -0
@@ -0,0 +1,197 @@
1
+ export type HttpTask = UniApp.RequestTask | UniApp.UploadTask | UniApp.DownloadTask;
2
+
3
+ export type HttpRequestTask = UniApp.RequestTask;
4
+
5
+ export type HttpUploadTask = UniApp.UploadTask;
6
+
7
+ export type HttpDownloadTask = UniApp.DownloadTask;
8
+
9
+ export type HttpMethod =
10
+ "GET"
11
+ | "POST"
12
+ | "PUT"
13
+ | "DELETE"
14
+ | "CONNECT"
15
+ | "HEAD"
16
+ | "OPTIONS"
17
+ | "TRACE"
18
+ | "UPLOAD"
19
+ | "DOWNLOAD";
20
+
21
+ export type HttpRequestHeader = Record<string, string>;
22
+
23
+ export type HttpParams = Record<string, any>;
24
+
25
+ export type HttpData = Record<string, any>;
26
+
27
+ export type HttpResponseType = 'arraybuffer' | 'text';
28
+
29
+ export type HttpCustom = Record<string, any>;
30
+
31
+ export type HttpFileType = 'image' | 'video' | 'audio';
32
+
33
+ export type HttpFormData = Record<string, any>;
34
+
35
+ export type HttpResponseHeader = Record<string, string> & {
36
+ "set-cookie"?: string[]
37
+ };
38
+
39
+ export interface HttpRequestConfig<T = HttpTask> {
40
+ /** @desc 请求服务器接口地址 */
41
+ url?: string;
42
+ /** @desc 请求方式,默认为 GET */
43
+ method?: HttpMethod;
44
+ /** @desc 请求基地址 */
45
+ baseURL?: string;
46
+ /** @desc 请求头信息,不能设置 Referer,App、H5 端会自动带上 cookie,且 H5 端不可手动修改 */
47
+ header?: HttpRequestHeader;
48
+ /** @desc 请求查询参数,自动拼接为查询字符串 */
49
+ params?: HttpParams;
50
+ /** @desc 请求体参数 */
51
+ data?: HttpData;
52
+ /** @desc 超时时间,单位 ms,默认为 60000,仅 H5 (HBuilderX 2.9.9+)、APP (HBuilderX 2.9.9+)、微信小程序 (2.10.0)、支付宝小程序支持 */
53
+ timeout?: number;
54
+ /** @desc 跨域请求时是否携带凭证 (cookies),默认为 false,仅 H5 (HBuilderX 2.6.15+) 支持 */
55
+ withCredentials?: boolean;
56
+ /** @desc 设置响应的数据类型,支付宝小程序不支持 */
57
+ responseType?: HttpResponseType;
58
+ /** @desc 全局自定义验证器 */
59
+ validateStatus?: ((statusCode: number) => boolean) | null;
60
+
61
+
62
+ /** params 参数自定义处理 */
63
+ paramsSerializer?: (params: AnyObject) => string | void;
64
+
65
+ /** @desc 默认为 json,如果设为 json,会尝试对返回的数据做一次 JSON.parse */
66
+ dataType?: string;
67
+ /** @desc DNS 解析时是否优先使用 ipv4,默认为 false,仅 App-Android (HBuilderX 2.8.0+) 支持 */
68
+ firstIpv4?: boolean;
69
+ /** @desc 是否验证 SSL 证书,默认为 true,仅 App-Android (HBuilderX 2.3.3+) 支持 */
70
+ sslVerify?: boolean;
71
+
72
+ /** @desc 开启 http2;微信小程序 */
73
+ enableHttp2?: boolean;
74
+
75
+ /** @desc 开启 quic;微信小程序 */
76
+ enableQuic?: boolean;
77
+ /** @desc 开启 cache;微信小程序、字节跳动小程序 2.31.0+ */
78
+ enableCache?: boolean;
79
+ /** @desc 开启 httpDNS;微信小程序 */
80
+ enableHttpDNS?: boolean;
81
+ /** @desc httpDNS 服务商;微信小程序 */
82
+ httpDNSServiceId?: string;
83
+ /** @desc 开启 transfer-encoding chunked;微信小程序 */
84
+ enableChunked?: boolean;
85
+ /** @desc wifi下使用移动网络发送请求;微信小程序 */
86
+ forceCellularNetwork?: boolean;
87
+ /** @desc 开启后可在headers中编辑cookie;支付宝小程序 10.2.33+ */
88
+ enableCookie?: boolean;
89
+ /** @desc 是否开启云加速;百度小程序 3.310.11+ */
90
+ cloudCache?: boolean | object;
91
+ /** @desc 控制当前请求是否延时至首屏内容渲染后发送;百度小程序 3.310.11+ */
92
+ defer?: boolean;
93
+
94
+ /** @desc 自定义参数 */
95
+ custom?: HttpCustom;
96
+
97
+ /** @desc 返回当前请求的 task 和 options,不要在这里修改 options */
98
+ getTask?: (task: T, options: HttpRequestConfig<T>) => void;
99
+
100
+ /** @desc 需要上传的文件列表,使用 files 时,filePath 和 name 不生效,仅支持 App、H5 (2.6.15+) */
101
+ files?: { name?: string; file?: File; uri: string; }[];
102
+ /** @desc 文件类型,仅支付宝小程序支持且为必填项 */
103
+ fileType?: HttpFileType;
104
+ /** @desc 要上传的文件对象,仅 H5 (2.6.15+) 支持 */
105
+ file?: File;
106
+ /** @desc 要上传文件资源的路径,使用 files 时,filePath 和 name 不生效 */
107
+ filePath?: string;
108
+ /** @desc 文件对应的 key,开发者在服务器端通过这个 key 可以获取到文件二进制内容,使用 files 时,filePath 和 name 不生效 */
109
+ name?: string;
110
+ /** @desc 请求中其他额外的 form data */
111
+ formData?: HttpFormData;
112
+ }
113
+
114
+ export interface HttpResponse<T = any, D = HttpTask> {
115
+ data: T;
116
+ statusCode: number;
117
+ header: HttpResponseHeader;
118
+ config: HttpRequestConfig<D>;
119
+ cookies: string[];
120
+ errMsg: string;
121
+ rawData: any;
122
+ }
123
+
124
+ export interface HttpUploadResponse<T = any, D = HttpTask> {
125
+ data: T;
126
+ statusCode: number;
127
+ config: HttpRequestConfig<D>;
128
+ errMsg: string;
129
+ rawData: any;
130
+ }
131
+
132
+ export interface HttpDownloadResponse extends HttpResponse {
133
+ tempFilePath: string;
134
+ apFilePath?: string;
135
+ filePath?: string;
136
+ fileContent?: string;
137
+ }
138
+
139
+ export interface HttpError<T = any, D = HttpTask> {
140
+ data?: T;
141
+ statusCode?: number;
142
+ header?: HttpResponseHeader;
143
+ config: HttpRequestConfig<D>;
144
+ cookies?: string[];
145
+ errMsg: string;
146
+ }
147
+
148
+ export interface HttpPromise<T = any> extends Promise<HttpResponse<T>> {
149
+ }
150
+
151
+ export interface HttpInterceptorManager<V, E = V> {
152
+ use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: E) => T | Promise<E>): void;
153
+
154
+ eject(id: number): void;
155
+ }
156
+
157
+ export abstract class HttpRequestAbstract {
158
+ constructor(config?: HttpRequestConfig);
159
+
160
+ interceptors: {
161
+ request: HttpInterceptorManager<HttpRequestConfig>;
162
+ response: HttpInterceptorManager<HttpResponse, HttpError>;
163
+ }
164
+
165
+ request<T = any, R = HttpResponse<T>, D = HttpRequestTask>(config: HttpRequestConfig<D>): Promise<R>;
166
+
167
+ get<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, config?: HttpRequestConfig<D>): Promise<R>;
168
+
169
+ delete<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
170
+
171
+ head<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
172
+
173
+ options<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
174
+
175
+ post<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
176
+
177
+ put<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
178
+
179
+ config: HttpRequestConfig;
180
+
181
+ setConfig<D = HttpTask>(onSend: (config: HttpRequestConfig<D>) => HttpRequestConfig<D>): void;
182
+
183
+ connect<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
184
+
185
+ trace<T = any, R = HttpResponse<T>, D = HttpRequestTask>(url: string, data?: HttpData, config?: HttpRequestConfig<D>): Promise<R>;
186
+
187
+ upload<T = any, R = HttpUploadResponse<T>, D = HttpUploadTask>(url: string, config?: HttpRequestConfig<D>): Promise<R>;
188
+
189
+ download<T = any, R = HttpDownloadResponse<T>, D = HttpDownloadTask>(url: string, config?: HttpRequestConfig<D>): Promise<R>;
190
+
191
+ middleware<T = any, R = HttpResponse<T>, D = HttpTask>(config: HttpRequestConfig<D>): Promise<R>;
192
+ }
193
+
194
+ declare class HttpRequest extends HttpRequestAbstract {
195
+ }
196
+
197
+ export default HttpRequest;
@@ -0,0 +1,3 @@
1
+ // @ts-nocheck
2
+ import Request from './core/Request'
3
+ export default Request
@@ -0,0 +1,265 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+ var clone = (function() {
4
+ 'use strict';
5
+
6
+ function _instanceof(obj, type) {
7
+ return type != null && obj instanceof type;
8
+ }
9
+
10
+ var nativeMap;
11
+ try {
12
+ nativeMap = Map;
13
+ } catch(_) {
14
+ // maybe a reference error because no `Map`. Give it a dummy value that no
15
+ // value will ever be an instanceof.
16
+ nativeMap = function() {};
17
+ }
18
+
19
+ var nativeSet;
20
+ try {
21
+ nativeSet = Set;
22
+ } catch(_) {
23
+ nativeSet = function() {};
24
+ }
25
+
26
+ var nativePromise;
27
+ try {
28
+ nativePromise = Promise;
29
+ } catch(_) {
30
+ nativePromise = function() {};
31
+ }
32
+
33
+ /**
34
+ * Clones (copies) an Object using deep copying.
35
+ *
36
+ * This function supports circular references by default, but if you are certain
37
+ * there are no circular references in your object, you can save some CPU time
38
+ * by calling clone(obj, false).
39
+ *
40
+ * Caution: if `circular` is false and `parent` contains circular references,
41
+ * your program may enter an infinite loop and crash.
42
+ *
43
+ * @param `parent` - the object to be cloned
44
+ * @param `circular` - set to true if the object to be cloned may contain
45
+ * circular references. (optional - true by default)
46
+ * @param `depth` - set to a number if the object is only to be cloned to
47
+ * a particular depth. (optional - defaults to Infinity)
48
+ * @param `prototype` - sets the prototype to be used when cloning an object.
49
+ * (optional - defaults to parent prototype).
50
+ * @param `includeNonEnumerable` - set to true if the non-enumerable properties
51
+ * should be cloned as well. Non-enumerable properties on the prototype
52
+ * chain will be ignored. (optional - false by default)
53
+ */
54
+ function clone(parent, circular, depth, prototype, includeNonEnumerable) {
55
+ if (typeof circular === 'object') {
56
+ depth = circular.depth;
57
+ prototype = circular.prototype;
58
+ includeNonEnumerable = circular.includeNonEnumerable;
59
+ circular = circular.circular;
60
+ }
61
+ // maintain two arrays for circular references, where corresponding parents
62
+ // and children have the same index
63
+ var allParents = [];
64
+ var allChildren = [];
65
+
66
+ var useBuffer = typeof Buffer != 'undefined';
67
+
68
+ if (typeof circular == 'undefined')
69
+ circular = true;
70
+
71
+ if (typeof depth == 'undefined')
72
+ depth = Infinity;
73
+
74
+ // recurse this function so we don't reset allParents and allChildren
75
+ function _clone(parent, depth) {
76
+ // cloning null always returns null
77
+ if (parent === null)
78
+ return null;
79
+
80
+ if (depth === 0)
81
+ return parent;
82
+
83
+ var child;
84
+ var proto;
85
+ if (typeof parent != 'object') {
86
+ return parent;
87
+ }
88
+
89
+ if (_instanceof(parent, nativeMap)) {
90
+ child = new nativeMap();
91
+ } else if (_instanceof(parent, nativeSet)) {
92
+ child = new nativeSet();
93
+ } else if (_instanceof(parent, nativePromise)) {
94
+ child = new nativePromise(function (resolve, reject) {
95
+ parent.then(function(value) {
96
+ resolve(_clone(value, depth - 1));
97
+ }, function(err) {
98
+ reject(_clone(err, depth - 1));
99
+ });
100
+ });
101
+ } else if (clone.__isArray(parent)) {
102
+ child = [];
103
+ } else if (clone.__isRegExp(parent)) {
104
+ child = new RegExp(parent.source, __getRegExpFlags(parent));
105
+ if (parent.lastIndex) child.lastIndex = parent.lastIndex;
106
+ } else if (clone.__isDate(parent)) {
107
+ child = new Date(parent.getTime());
108
+ } else if (useBuffer && Buffer.isBuffer(parent)) {
109
+ if (Buffer.from) {
110
+ // Node.js >= 5.10.0
111
+ child = Buffer.from(parent);
112
+ } else {
113
+ // Older Node.js versions
114
+ child = new Buffer(parent.length);
115
+ parent.copy(child);
116
+ }
117
+ return child;
118
+ } else if (_instanceof(parent, Error)) {
119
+ child = Object.create(parent);
120
+ } else {
121
+ if (typeof prototype == 'undefined') {
122
+ proto = Object.getPrototypeOf(parent);
123
+ child = Object.create(proto);
124
+ }
125
+ else {
126
+ child = Object.create(prototype);
127
+ proto = prototype;
128
+ }
129
+ }
130
+
131
+ if (circular) {
132
+ var index = allParents.indexOf(parent);
133
+
134
+ if (index != -1) {
135
+ return allChildren[index];
136
+ }
137
+ allParents.push(parent);
138
+ allChildren.push(child);
139
+ }
140
+
141
+ if (_instanceof(parent, nativeMap)) {
142
+ parent.forEach(function(value, key) {
143
+ var keyChild = _clone(key, depth - 1);
144
+ var valueChild = _clone(value, depth - 1);
145
+ child.set(keyChild, valueChild);
146
+ });
147
+ }
148
+ if (_instanceof(parent, nativeSet)) {
149
+ parent.forEach(function(value) {
150
+ var entryChild = _clone(value, depth - 1);
151
+ child.add(entryChild);
152
+ });
153
+ }
154
+
155
+ for (var i in parent) {
156
+ var attrs = Object.getOwnPropertyDescriptor(parent, i);
157
+ if (attrs) {
158
+ child[i] = _clone(parent[i], depth - 1);
159
+ }
160
+
161
+ try {
162
+ var objProperty = Object.getOwnPropertyDescriptor(parent, i);
163
+ if (objProperty.set === 'undefined') {
164
+ // no setter defined. Skip cloning this property
165
+ continue;
166
+ }
167
+ child[i] = _clone(parent[i], depth - 1);
168
+ } catch(e){
169
+ if (e instanceof TypeError) {
170
+ // when in strict mode, TypeError will be thrown if child[i] property only has a getter
171
+ // we can't do anything about this, other than inform the user that this property cannot be set.
172
+ continue
173
+ } else if (e instanceof ReferenceError) {
174
+ //this may happen in non strict mode
175
+ continue
176
+ }
177
+ }
178
+
179
+ }
180
+
181
+ if (Object.getOwnPropertySymbols) {
182
+ var symbols = Object.getOwnPropertySymbols(parent);
183
+ for (var i = 0; i < symbols.length; i++) {
184
+ // Don't need to worry about cloning a symbol because it is a primitive,
185
+ // like a number or string.
186
+ var symbol = symbols[i];
187
+ var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
188
+ if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
189
+ continue;
190
+ }
191
+ child[symbol] = _clone(parent[symbol], depth - 1);
192
+ Object.defineProperty(child, symbol, descriptor);
193
+ }
194
+ }
195
+
196
+ if (includeNonEnumerable) {
197
+ var allPropertyNames = Object.getOwnPropertyNames(parent);
198
+ for (var i = 0; i < allPropertyNames.length; i++) {
199
+ var propertyName = allPropertyNames[i];
200
+ var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
201
+ if (descriptor && descriptor.enumerable) {
202
+ continue;
203
+ }
204
+ child[propertyName] = _clone(parent[propertyName], depth - 1);
205
+ Object.defineProperty(child, propertyName, descriptor);
206
+ }
207
+ }
208
+
209
+ return child;
210
+ }
211
+
212
+ return _clone(parent, depth);
213
+ }
214
+
215
+ /**
216
+ * Simple flat clone using prototype, accepts only objects, usefull for property
217
+ * override on FLAT configuration object (no nested props).
218
+ *
219
+ * USE WITH CAUTION! This may not behave as you wish if you do not know how this
220
+ * works.
221
+ */
222
+ clone.clonePrototype = function clonePrototype(parent) {
223
+ if (parent === null)
224
+ return null;
225
+
226
+ var c = function () {};
227
+ c.prototype = parent;
228
+ return new c();
229
+ };
230
+
231
+ // private utility functions
232
+
233
+ function __objToStr(o) {
234
+ return Object.prototype.toString.call(o);
235
+ }
236
+ clone.__objToStr = __objToStr;
237
+
238
+ function __isDate(o) {
239
+ return typeof o === 'object' && __objToStr(o) === '[object Date]';
240
+ }
241
+ clone.__isDate = __isDate;
242
+
243
+ function __isArray(o) {
244
+ return typeof o === 'object' && __objToStr(o) === '[object Array]';
245
+ }
246
+ clone.__isArray = __isArray;
247
+
248
+ function __isRegExp(o) {
249
+ return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
250
+ }
251
+ clone.__isRegExp = __isRegExp;
252
+
253
+ function __getRegExpFlags(re) {
254
+ var flags = '';
255
+ if (re.global) flags += 'g';
256
+ if (re.ignoreCase) flags += 'i';
257
+ if (re.multiline) flags += 'm';
258
+ return flags;
259
+ }
260
+ clone.__getRegExpFlags = __getRegExpFlags;
261
+
262
+ return clone;
263
+ })();
264
+
265
+ export default clone
@@ -0,0 +1,136 @@
1
+ // @ts-nocheck
2
+ 'use strict'
3
+
4
+ // utils is a library of generic helper functions non-specific to axios
5
+
6
+ var toString = Object.prototype.toString
7
+
8
+ /**
9
+ * Determine if a value is an Array
10
+ *
11
+ * @param {Object} val The value to test
12
+ * @returns {boolean} True if value is an Array, otherwise false
13
+ */
14
+ export function isArray (val) {
15
+ return toString.call(val) === '[object Array]'
16
+ }
17
+
18
+
19
+ /**
20
+ * Determine if a value is an Object
21
+ *
22
+ * @param {Object} val The value to test
23
+ * @returns {boolean} True if value is an Object, otherwise false
24
+ */
25
+ export function isObject (val) {
26
+ return val !== null && typeof val === 'object'
27
+ }
28
+
29
+ /**
30
+ * Determine if a value is a Date
31
+ *
32
+ * @param {Object} val The value to test
33
+ * @returns {boolean} True if value is a Date, otherwise false
34
+ */
35
+ export function isDate (val) {
36
+ return toString.call(val) === '[object Date]'
37
+ }
38
+
39
+ /**
40
+ * Determine if a value is a URLSearchParams object
41
+ *
42
+ * @param {Object} val The value to test
43
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
44
+ */
45
+ export function isURLSearchParams (val) {
46
+ return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams
47
+ }
48
+
49
+
50
+ /**
51
+ * Iterate over an Array or an Object invoking a function for each item.
52
+ *
53
+ * If `obj` is an Array callback will be called passing
54
+ * the value, index, and complete array for each item.
55
+ *
56
+ * If 'obj' is an Object callback will be called passing
57
+ * the value, key, and complete object for each property.
58
+ *
59
+ * @param {Object|Array} obj The object to iterate
60
+ * @param {Function} fn The callback to invoke for each item
61
+ */
62
+ export function forEach (obj, fn) {
63
+ // Don't bother if no value provided
64
+ if (obj === null || typeof obj === 'undefined') {
65
+ return
66
+ }
67
+
68
+ // Force an array if not already something iterable
69
+ if (typeof obj !== 'object') {
70
+ /*eslint no-param-reassign:0*/
71
+ obj = [obj]
72
+ }
73
+
74
+ if (isArray(obj)) {
75
+ // Iterate over array values
76
+ for (var i = 0, l = obj.length; i < l; i++) {
77
+ fn.call(null, obj[i], i, obj)
78
+ }
79
+ } else {
80
+ // Iterate over object keys
81
+ for (var key in obj) {
82
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
83
+ fn.call(null, obj[key], key, obj)
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
+ /**
90
+ * 是否为boolean 值
91
+ * @param val
92
+ * @returns {boolean}
93
+ */
94
+ export function isBoolean(val) {
95
+ return typeof val === 'boolean'
96
+ }
97
+
98
+ /**
99
+ * 是否为真正的对象{} new Object
100
+ * @param {any} obj - 检测的对象
101
+ * @returns {boolean}
102
+ */
103
+ export function isPlainObject(obj) {
104
+ return Object.prototype.toString.call(obj) === '[object Object]'
105
+ }
106
+
107
+
108
+
109
+ /**
110
+ * Function equal to merge with the difference being that no reference
111
+ * to original objects is kept.
112
+ *
113
+ * @see merge
114
+ * @param {Object} obj1 Object to merge
115
+ * @returns {Object} Result of all merge properties
116
+ */
117
+ export function deepMerge(/* obj1, obj2, obj3, ... */) {
118
+ let result = {}
119
+ function assignValue(val, key) {
120
+ if (typeof result[key] === 'object' && typeof val === 'object') {
121
+ result[key] = deepMerge(result[key], val)
122
+ } else if (typeof val === 'object') {
123
+ result[key] = deepMerge({}, val)
124
+ } else {
125
+ result[key] = val
126
+ }
127
+ }
128
+ for (let i = 0, l = arguments.length; i < l; i++) {
129
+ forEach(arguments[i], assignValue)
130
+ }
131
+ return result
132
+ }
133
+
134
+ export function isUndefined (val) {
135
+ return typeof val === 'undefined'
136
+ }
package/locales/en.ts ADDED
@@ -0,0 +1,78 @@
1
+ /**
2
+ * uview-x 组件内置语言包:英文(en)。
3
+ *
4
+ * 键空间固定为 `uv.*`,用户可通过 `createI18n({ messages })` 传同名 key 覆盖;
5
+ * `uv.form.*` 与 async-validator 默认 messages 完全对齐,`%s` 占位符由校验器替换。
6
+ */
7
+ const en = {
8
+ uv: {
9
+ dialog: {
10
+ title: 'Tips',
11
+ cancel: 'Cancel',
12
+ confirm: 'OK',
13
+ },
14
+ code: {
15
+ start: 'Get code',
16
+ // 组件会把 x / X 替换为剩余秒数
17
+ change: 'X seconds to resend',
18
+ end: 'Resend',
19
+ },
20
+ time: {
21
+ justNow: 'Just now',
22
+ minutesAgo: '{n} minutes ago',
23
+ hoursAgo: '{n} hours ago',
24
+ daysAgo: '{n} days ago',
25
+ monthsAgo: '{n} months ago',
26
+ yearsAgo: '{n} years ago',
27
+ },
28
+ form: {
29
+ default: 'Validation error on field %s',
30
+ required: '%s is required',
31
+ enum: '%s must be one of %s',
32
+ whitespace: '%s cannot be empty',
33
+ date: {
34
+ format: '%s date %s is invalid for format %s',
35
+ parse: '%s date could not be parsed, %s is invalid ',
36
+ invalid: '%s date %s is invalid',
37
+ },
38
+ types: {
39
+ string: '%s is not a %s',
40
+ method: '%s is not a %s (function)',
41
+ array: '%s is not an %s',
42
+ object: '%s is not an %s',
43
+ number: '%s is not a %s',
44
+ date: '%s is not a %s',
45
+ boolean: '%s is not a %s',
46
+ integer: '%s is not an %s',
47
+ float: '%s is not a %s',
48
+ regexp: '%s is not a valid %s',
49
+ email: '%s is not a valid %s',
50
+ url: '%s is not a valid %s',
51
+ hex: '%s is not a valid %s',
52
+ },
53
+ string: {
54
+ len: '%s must be exactly %s characters',
55
+ min: '%s must be at least %s characters',
56
+ max: '%s cannot be longer than %s characters',
57
+ range: '%s must be between %s and %s characters',
58
+ },
59
+ number: {
60
+ len: '%s must equal %s',
61
+ min: '%s cannot be less than %s',
62
+ max: '%s cannot be greater than %s',
63
+ range: '%s must be between %s and %s',
64
+ },
65
+ array: {
66
+ len: '%s must be exactly %s in length',
67
+ min: '%s cannot be less than %s in length',
68
+ max: '%s cannot be greater than %s in length',
69
+ range: '%s must be between %s and %s in length',
70
+ },
71
+ pattern: {
72
+ mismatch: '%s value %s does not match pattern %s',
73
+ },
74
+ },
75
+ },
76
+ };
77
+
78
+ export default en;