@nutui/nutui-react 3.0.1 → 3.0.3-beta.0

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 (75) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/hooks/use-client-rect.js +1 -0
  3. package/dist/cjs/packages/datepicker/style/style.css +70 -0
  4. package/dist/cjs/packages/datepickerview/style/index.js +1 -0
  5. package/dist/cjs/packages/datepickerview/style/style.css +70 -0
  6. package/dist/cjs/packages/fixednav/fixednav.js +20 -14
  7. package/dist/cjs/packages/fixednav/style/fixednav.scss +0 -15
  8. package/dist/cjs/packages/fixednav/style/index.js +1 -0
  9. package/dist/cjs/packages/fixednav/style/style.css +97 -14
  10. package/dist/cjs/packages/form/__tests__/merge.spec.d.ts +1 -0
  11. package/dist/cjs/packages/form/__tests__/merge.spec.js +545 -0
  12. package/dist/cjs/packages/form/form.d.ts +2 -0
  13. package/dist/cjs/packages/form/form.js +9 -2
  14. package/dist/cjs/packages/form/index.d.ts +2 -1
  15. package/dist/cjs/packages/form/index.js +1 -0
  16. package/dist/cjs/packages/form/style/form.scss +0 -66
  17. package/dist/cjs/packages/form/style/style.css +31 -21
  18. package/dist/cjs/packages/form/types.d.ts +2 -1
  19. package/dist/cjs/packages/form/useform.d.ts +2 -1
  20. package/dist/cjs/packages/form/useform.js +342 -278
  21. package/dist/cjs/packages/formitem/formitem.d.ts +1 -0
  22. package/dist/cjs/packages/formitem/formitem.js +55 -44
  23. package/dist/cjs/packages/formitem/style/formitem.scss +101 -21
  24. package/dist/cjs/packages/formitem/style/style.css +89 -12
  25. package/dist/cjs/packages/picker/style/index.js +1 -0
  26. package/dist/cjs/packages/picker/style/style.css +70 -0
  27. package/dist/cjs/packages/swipe/style/style.css +3 -3
  28. package/dist/cjs/packages/swipe/style/swipe.scss +7 -3
  29. package/dist/cjs/utils/get-rect-by-taro.d.ts +1 -1
  30. package/dist/cjs/utils/get-rect-by-taro.js +4 -1
  31. package/dist/cjs/utils/get-system-info.js +4 -5
  32. package/dist/cjs/utils/merge.d.ts +14 -0
  33. package/dist/cjs/utils/merge.js +98 -0
  34. package/dist/cjs/utils/platform-taro.js +4 -5
  35. package/dist/cjs/utils/to-array.d.ts +1 -0
  36. package/dist/cjs/utils/to-array.js +18 -0
  37. package/dist/es/hooks/use-client-rect.js +1 -0
  38. package/dist/es/packages/datepicker/style/style.css +70 -0
  39. package/dist/es/packages/datepickerview/style/index.js +1 -0
  40. package/dist/es/packages/datepickerview/style/style.css +70 -0
  41. package/dist/es/packages/fixednav/fixednav.js +20 -14
  42. package/dist/es/packages/fixednav/style/fixednav.scss +0 -15
  43. package/dist/es/packages/fixednav/style/index.js +1 -0
  44. package/dist/es/packages/fixednav/style/style.css +97 -14
  45. package/dist/es/packages/form/__tests__/merge.spec.d.ts +1 -0
  46. package/dist/es/packages/form/__tests__/merge.spec.js +541 -0
  47. package/dist/es/packages/form/form.d.ts +10 -0
  48. package/dist/es/packages/form/form.js +9 -2
  49. package/dist/es/packages/form/index.d.ts +2 -1
  50. package/dist/es/packages/form/index.js +2 -1
  51. package/dist/es/packages/form/style/form.scss +0 -66
  52. package/dist/es/packages/form/style/style.css +31 -21
  53. package/dist/es/packages/form/types.d.ts +2 -1
  54. package/dist/es/packages/form/useform.d.ts +2 -1
  55. package/dist/es/packages/form/useform.js +340 -279
  56. package/dist/es/packages/formitem/formitem.d.ts +1 -0
  57. package/dist/es/packages/formitem/formitem.js +55 -44
  58. package/dist/es/packages/formitem/style/formitem.scss +101 -21
  59. package/dist/es/packages/formitem/style/style.css +89 -12
  60. package/dist/es/packages/picker/style/index.js +1 -0
  61. package/dist/es/packages/picker/style/style.css +70 -0
  62. package/dist/es/packages/swipe/style/style.css +3 -3
  63. package/dist/es/packages/swipe/style/swipe.scss +7 -3
  64. package/dist/es/utils/get-rect-by-taro.d.ts +1 -1
  65. package/dist/es/utils/get-rect-by-taro.js +4 -1
  66. package/dist/es/utils/get-system-info.js +4 -4
  67. package/dist/es/utils/merge.d.ts +14 -0
  68. package/dist/es/utils/merge.js +68 -0
  69. package/dist/es/utils/platform-taro.js +4 -4
  70. package/dist/es/utils/to-array.d.ts +1 -0
  71. package/dist/es/utils/to-array.js +8 -0
  72. package/dist/nutui.react.umd.js +555 -422
  73. package/dist/style.css +1 -1
  74. package/dist/style.scss +41 -41
  75. package/package.json +1 -1
@@ -1,19 +1,19 @@
1
- import Taro from "@tarojs/taro";
1
+ import { canIUse, getAppBaseInfo as taroGetAppBaseInfo, getDeviceInfo as taroGetDeviceInfo, getSystemInfoSync, getWindowInfo as taroGetWindowInfo } from "@tarojs/taro";
2
2
  /**
3
3
  * 获取设备基础信息,兼容新旧 API
4
4
  * @returns {IDeviceInfo} 设备基础信息
5
5
  */ export var getDeviceInfo = function() {
6
- return Taro.canIUse('getDeviceInfo') ? Taro.getDeviceInfo() : Taro.getSystemInfoSync();
6
+ return canIUse('getDeviceInfo') ? taroGetDeviceInfo() : getSystemInfoSync();
7
7
  };
8
8
  /**
9
9
  * 获取窗口信息,兼容新旧 API
10
10
  * @returns {Taro.getWindowInfo.Result} 窗口信息
11
11
  */ export var getWindowInfo = function() {
12
- return Taro.canIUse('getWindowInfo') ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
12
+ return canIUse('getWindowInfo') ? taroGetWindowInfo() : getSystemInfoSync();
13
13
  };
14
14
  /**
15
15
  * 获取应用基础信息,兼容新旧 API
16
16
  * @returns {Taro.getAppBaseInfo.Result} 应用基础信息
17
17
  */ export var getAppBaseInfo = function() {
18
- return Taro.canIUse('getAppBaseInfo') ? Taro.getAppBaseInfo() : Taro.getSystemInfoSync();
18
+ return canIUse('getAppBaseInfo') ? taroGetAppBaseInfo() : getSystemInfoSync();
19
19
  };
@@ -0,0 +1,14 @@
1
+ export default main;
2
+ export declare function main(clone: boolean, ...items: any[]): any;
3
+ export declare function main(...items: any[]): any;
4
+ export declare namespace main {
5
+ var clone: typeof import("./merge").clone;
6
+ var isPlainObject: typeof import("./merge").isPlainObject;
7
+ var recursive: typeof import("./merge").recursive;
8
+ }
9
+ export declare function merge(clone: boolean, ...items: any[]): any;
10
+ export declare function merge(...items: any[]): any;
11
+ export declare function recursive(clone: boolean, ...items: any[]): any;
12
+ export declare function recursive(...items: any[]): any;
13
+ export declare function clone<T>(input: T): T;
14
+ export declare function isPlainObject(input: unknown): input is NonNullable<any>;
@@ -0,0 +1,68 @@
1
+ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
2
+ import { _ as _type_of } from "@swc/helpers/_/_type_of";
3
+ export default main;
4
+ export function main() {
5
+ for(var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++){
6
+ items[_key] = arguments[_key];
7
+ }
8
+ return merge.apply(void 0, _to_consumable_array(items));
9
+ }
10
+ main.clone = clone;
11
+ main.isPlainObject = isPlainObject;
12
+ main.recursive = recursive;
13
+ export function merge() {
14
+ for(var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++){
15
+ items[_key] = arguments[_key];
16
+ }
17
+ return _merge(items[0] === true, false, items);
18
+ }
19
+ export function recursive() {
20
+ for(var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++){
21
+ items[_key] = arguments[_key];
22
+ }
23
+ return _merge(items[0] === true, true, items);
24
+ }
25
+ export function clone(input) {
26
+ if (Array.isArray(input)) {
27
+ var output = [];
28
+ for(var index = 0; index < input.length; ++index)output.push(clone(input[index]));
29
+ return output;
30
+ }
31
+ if (isPlainObject(input)) {
32
+ var output1 = {};
33
+ // eslint-disable-next-line guard-for-in
34
+ for(var index1 in input)output1[index1] = clone(input[index1]);
35
+ return output1;
36
+ }
37
+ return input;
38
+ }
39
+ export function isPlainObject(input) {
40
+ if (input === null || (typeof input === "undefined" ? "undefined" : _type_of(input)) !== 'object') return false;
41
+ if (Object.getPrototypeOf(input) === null) return true;
42
+ var ref = input;
43
+ while(Object.getPrototypeOf(ref) !== null)ref = Object.getPrototypeOf(ref);
44
+ return Object.getPrototypeOf(input) === ref;
45
+ }
46
+ function _recursiveMerge(base, extend) {
47
+ if (!isPlainObject(base) || !isPlainObject(extend)) return extend;
48
+ for(var key in extend){
49
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') continue;
50
+ base[key] = isPlainObject(base[key]) && isPlainObject(extend[key]) ? _recursiveMerge(base[key], extend[key]) : extend[key];
51
+ }
52
+ return base;
53
+ }
54
+ function _merge(isClone, isRecursive, items) {
55
+ var result;
56
+ if (isClone || !isPlainObject(result = items.shift())) result = {};
57
+ for(var index = 0; index < items.length; ++index){
58
+ var item = items[index];
59
+ // eslint-disable-next-line no-continue
60
+ if (!isPlainObject(item)) continue;
61
+ for(var key in item){
62
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') continue;
63
+ var value = isClone ? clone(item[key]) : item[key];
64
+ result[key] = isRecursive ? _recursiveMerge(result[key], value) : value;
65
+ }
66
+ }
67
+ return result;
68
+ }
@@ -1,18 +1,18 @@
1
- import Taro from "@tarojs/taro";
1
+ import { getEnv } from "@tarojs/taro";
2
2
  export var harmony = function() {
3
3
  return [
4
4
  'harmony',
5
5
  'harmonyhybrid',
6
6
  'jdharmony'
7
- ].includes(Taro.getEnv().toLowerCase());
7
+ ].includes(getEnv().toLowerCase());
8
8
  };
9
9
  export var web = function() {
10
10
  return [
11
11
  'web'
12
- ].includes(Taro.getEnv().toLowerCase());
12
+ ].includes(getEnv().toLowerCase());
13
13
  };
14
14
  export var miniprogram = function() {
15
15
  return [
16
16
  'mini'
17
- ].includes(Taro.getEnv().toLowerCase());
17
+ ].includes(getEnv().toLowerCase());
18
18
  };
@@ -0,0 +1 @@
1
+ export declare function toArray<T>(value?: T | T[] | null): T[];
@@ -0,0 +1,8 @@
1
+ export function toArray(value) {
2
+ if (value === undefined || value === null) {
3
+ return [];
4
+ }
5
+ return Array.isArray(value) ? value : [
6
+ value
7
+ ];
8
+ }