@zero-bits/taro-components 1.0.6 → 1.1.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.
- package/es/components/Permission/PermissionProvider.js +35 -1
- package/es/components/Permission/index.js +2 -1
- package/es/components/Permission/store.js +158 -1
- package/es/components/Text/index.js +136 -1
- package/es/components/View/index.d.ts +10 -0
- package/es/components/View/index.js +220 -1
- package/es/components/index.js +3 -1
- package/es/context/index.js +6 -1
- package/es/hooks/index.js +2 -1
- package/es/hooks/usePermission.js +18 -1
- package/es/hooks/useWeappUpdate.js +33 -1
- package/es/index.js +3 -1
- package/es/styles/index.css +1 -120
- package/es/types/index.js +1 -1
- package/lib/components/Permission/PermissionProvider.js +41 -1
- package/lib/components/Permission/index.js +20 -1
- package/lib/components/Permission/store.js +164 -1
- package/lib/components/Text/index.js +145 -1
- package/lib/components/View/index.d.ts +10 -0
- package/lib/components/View/index.js +227 -1
- package/lib/components/index.js +36 -1
- package/lib/context/index.js +12 -1
- package/lib/hooks/index.js +19 -1
- package/lib/hooks/usePermission.js +24 -1
- package/lib/hooks/useWeappUpdate.js +38 -1
- package/lib/index.js +63 -1
- package/lib/styles/index.css +1 -120
- package/lib/types/index.js +5 -1
- package/package.json +24 -1
|
@@ -1 +1,164 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createPermissionStore = createPermissionStore;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
/**
|
|
17
|
+
* Store 完整接口,包含 React useSyncExternalStore 所需的 getSnapshot / subscribe
|
|
18
|
+
* 业务侧若不希望在 IDE 补全中看到 React 内部方法,可将变量显式声明为 PermissionStorePublic
|
|
19
|
+
*
|
|
20
|
+
* @template P - 权限对象类型
|
|
21
|
+
* @template U - 用户对象类型
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* 业务侧(axios 拦截器等非 React 环境)使用的 Store 公共接口
|
|
25
|
+
* 只暴露权限操作方法和销毁能力,屏蔽 React 内部机制
|
|
26
|
+
*
|
|
27
|
+
* @template P - 权限对象类型
|
|
28
|
+
* @template U - 用户对象类型
|
|
29
|
+
*/
|
|
30
|
+
var PermissionStore = /*#__PURE__*/function () {
|
|
31
|
+
/**
|
|
32
|
+
* @param adapter - 权限数据持久化适配器
|
|
33
|
+
* 类字段初始化先于构造函数体,此处 this.granted 等已绑定完毕
|
|
34
|
+
*/
|
|
35
|
+
function PermissionStore(adapter) {
|
|
36
|
+
var _this = this;
|
|
37
|
+
_classCallCheck(this, PermissionStore);
|
|
38
|
+
_defineProperty(this, "state", void 0);
|
|
39
|
+
_defineProperty(this, "listeners", new Set());
|
|
40
|
+
/**
|
|
41
|
+
* 缓存 actions 对象以保证引用稳定
|
|
42
|
+
* 注意:类字段箭头函数(granted/denied 等)在构造函数体执行前已完成初始化
|
|
43
|
+
* 因此在构造函数体中赋值 cachedActions 时,this.granted 等引用已可用
|
|
44
|
+
*/
|
|
45
|
+
_defineProperty(this, "cachedActions", void 0);
|
|
46
|
+
/**
|
|
47
|
+
* 获取当前状态快照(供 React 及内部使用)
|
|
48
|
+
* @returns {PermissionContextValue<P, U>} 权限上下文值
|
|
49
|
+
*/
|
|
50
|
+
_defineProperty(this, "getSnapshot", function () {
|
|
51
|
+
return _this.state;
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* 同步获取当前状态(供业务侧非 React 环境使用)
|
|
55
|
+
* @returns {PermissionContextValue<P, U>} 权限上下文值
|
|
56
|
+
*/
|
|
57
|
+
_defineProperty(this, "getState", function () {
|
|
58
|
+
return _this.state;
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* 订阅状态变更,返回取消订阅函数(供 useSyncExternalStore 使用)
|
|
62
|
+
* @param {() => void} listener - 状态变更时的回调
|
|
63
|
+
* @returns {() => void} 取消订阅函数
|
|
64
|
+
*/
|
|
65
|
+
_defineProperty(this, "subscribe", function (listener) {
|
|
66
|
+
_this.listeners.add(listener);
|
|
67
|
+
return function () {
|
|
68
|
+
return _this.listeners.delete(listener);
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* 通知所有订阅者状态已变更
|
|
73
|
+
*/
|
|
74
|
+
_defineProperty(this, "emitChange", function () {
|
|
75
|
+
_this.listeners.forEach(function (l) {
|
|
76
|
+
return l();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* 授权方法,登录成功后调用
|
|
81
|
+
* @param {P} permission - 权限数据
|
|
82
|
+
* @param {U} [user] - 用户信息(可选,后续可通过 updateUser 补充)
|
|
83
|
+
*/
|
|
84
|
+
_defineProperty(this, "granted", function (permission, user) {
|
|
85
|
+
_this.adapter.savePermission(permission);
|
|
86
|
+
if (user !== undefined) {
|
|
87
|
+
_this.adapter.saveUser(user);
|
|
88
|
+
}
|
|
89
|
+
_this.state = _this.buildState(permission, user);
|
|
90
|
+
_this.emitChange();
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* 取消授权,清空所有持久化数据并通知订阅者
|
|
94
|
+
*/
|
|
95
|
+
_defineProperty(this, "denied", function () {
|
|
96
|
+
_this.adapter.clear();
|
|
97
|
+
_this.state = _this.buildState();
|
|
98
|
+
_this.emitChange();
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* 更新用户信息(部分字段覆盖,不影响权限数据)
|
|
102
|
+
* @param {Partial<U>} userInfo - 需要更新的字段
|
|
103
|
+
*/
|
|
104
|
+
_defineProperty(this, "updateUser", function (userInfo) {
|
|
105
|
+
var nextUser = _objectSpread(_objectSpread({}, _this.state.user), userInfo);
|
|
106
|
+
_this.adapter.saveUser(nextUser);
|
|
107
|
+
_this.state = _this.buildState(_this.state.permission, nextUser);
|
|
108
|
+
_this.emitChange();
|
|
109
|
+
});
|
|
110
|
+
/**
|
|
111
|
+
* 更新权限数据(部分字段覆盖,例如无感刷新 token 后调用)
|
|
112
|
+
* @param {Partial<P>} permissionInfo - 需要更新的权限字段
|
|
113
|
+
*/
|
|
114
|
+
_defineProperty(this, "updatePermission", function (permissionInfo) {
|
|
115
|
+
var nextPermission = _objectSpread(_objectSpread({}, _this.state.permission), permissionInfo);
|
|
116
|
+
_this.adapter.savePermission(nextPermission);
|
|
117
|
+
_this.state = _this.buildState(nextPermission, _this.state.user);
|
|
118
|
+
_this.emitChange();
|
|
119
|
+
});
|
|
120
|
+
/** 销毁 Store,清除所有订阅者 */
|
|
121
|
+
_defineProperty(this, "destroy", function () {
|
|
122
|
+
_this.listeners.clear();
|
|
123
|
+
});
|
|
124
|
+
this.adapter = adapter;
|
|
125
|
+
this.cachedActions = {
|
|
126
|
+
granted: this.granted,
|
|
127
|
+
denied: this.denied,
|
|
128
|
+
updateUser: this.updateUser,
|
|
129
|
+
updatePermission: this.updatePermission
|
|
130
|
+
};
|
|
131
|
+
var _permission = adapter.loadPermission();
|
|
132
|
+
var _user = adapter.loadUser();
|
|
133
|
+
this.state = this.buildState(_permission instanceof Promise ? undefined : _permission, _user instanceof Promise ? undefined : _user);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 构建状态快照,复用 cachedActions 保证方法引用稳定性
|
|
138
|
+
* @param permission - 权限数据
|
|
139
|
+
* @param user - 用户信息
|
|
140
|
+
*/
|
|
141
|
+
_createClass(PermissionStore, [{
|
|
142
|
+
key: "buildState",
|
|
143
|
+
value: function buildState(permission, user) {
|
|
144
|
+
return _objectSpread(_objectSpread({}, this.cachedActions), {}, {
|
|
145
|
+
permission: permission,
|
|
146
|
+
user: user,
|
|
147
|
+
isGranted: !!permission
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}]);
|
|
151
|
+
return PermissionStore;
|
|
152
|
+
}();
|
|
153
|
+
/**
|
|
154
|
+
* 创建权限 Store 实例
|
|
155
|
+
* 返回 PermissionStoreInternal 类型(包含完整接口)
|
|
156
|
+
* 若业务侧不希望在 IDE 中看到 React 内部方法,可将变量显式声明为 PermissionStorePublic:
|
|
157
|
+
* const store: PermissionStorePublic<P, U> = createPermissionStore(adapter)
|
|
158
|
+
*
|
|
159
|
+
* @param {PermissionAdapter<P, U>} adapter - 权限数据持久化适配器
|
|
160
|
+
* @returns {PermissionStoreInternal<P, U>} 权限 Store 实例
|
|
161
|
+
*/
|
|
162
|
+
function createPermissionStore(adapter) {
|
|
163
|
+
return new PermissionStore(adapter);
|
|
164
|
+
}
|
|
@@ -1 +1,145 @@
|
|
|
1
|
-
'use strict';var _0x2e324c=_0x344c;(function(_0x4f974a,_0xe74285){var _0xa59630=_0x344c,_0x29b49a=_0x4f974a();while(!![]){try{var _0x3b0769=parseInt(_0xa59630(0x21b))/0x1+-parseInt(_0xa59630(0x21d))/0x2*(-parseInt(_0xa59630(0x1ed))/0x3)+-parseInt(_0xa59630(0x1ef))/0x4*(-parseInt(_0xa59630(0x1e5))/0x5)+-parseInt(_0xa59630(0x1fe))/0x6*(parseInt(_0xa59630(0x20d))/0x7)+parseInt(_0xa59630(0x200))/0x8+parseInt(_0xa59630(0x20b))/0x9*(parseInt(_0xa59630(0x1d5))/0xa)+-parseInt(_0xa59630(0x1d8))/0xb;if(_0x3b0769===_0xe74285)break;else _0x29b49a['push'](_0x29b49a['shift']());}catch(_0x551fe7){_0x29b49a['push'](_0x29b49a['shift']());}}}(_0x5d81,0x40f0a));Object[_0x2e324c(0x1e3)](exports,_0x2e324c(0x1dd),{'value':!![]}),exports[_0x2e324c(0x215)]=void 0x0;var _react=_interopRequireWildcard(require(_0x2e324c(0x216))),_components=require('@tarojs/components'),_classnames=_interopRequireDefault(require('classnames'));function _0x5d81(){var _0x1b9f88=['boolean','transparent','2307LasJqs','Text','40zbaikS','length','margin','getOwnPropertySymbols','lineHeight','filter','color','defineProperties','number','skeleton','constructor','mVertical','enumerable','selectable','children','138bIIQXS','decoration','2018000gUmsNz','pBottom','bold','mRight','mTop','getOwnPropertyDescriptors','textAlign','height','style','fontSize','padding','135FkPpZu','width','55867pkwNdZ','hasOwnProperty','get','react/jsx-runtime','pHorizontal','string','symbol','indexOf','default','react','mBottom','className','toPrimitive','call','180162emaNNd','jsx','584QdDbnj','127130isCZEv','pTop','has','8205538rDHxYf','function','iterator','propertyIsEnumerable','prototype','__esModule','pRight','mLeft','keys','pVertical','@@toPrimitive\x20must\x20return\x20a\x20primitive\x20value.','defineProperty','clamp','173930DrQxdT','bgColor','getOwnPropertyDescriptor','object','mHorizontal','concat'];_0x5d81=function(){return _0x1b9f88;};return _0x5d81();}require('../../styles/index.css');var _jsxRuntime=require(_0x2e324c(0x210)),_excluded=[_0x2e324c(0x1fd),'clamp',_0x2e324c(0x20c),_0x2e324c(0x207),'lineHeight',_0x2e324c(0x202),_0x2e324c(0x209),_0x2e324c(0x1f5),_0x2e324c(0x1f1),_0x2e324c(0x20a),'style',_0x2e324c(0x1e6),_0x2e324c(0x1e9),_0x2e324c(0x1fa),_0x2e324c(0x211),_0x2e324c(0x1e1),_0x2e324c(0x204),_0x2e324c(0x217),_0x2e324c(0x1df),_0x2e324c(0x203),_0x2e324c(0x1d6),'pBottom','pLeft',_0x2e324c(0x1de),'className',_0x2e324c(0x206),_0x2e324c(0x1ff),_0x2e324c(0x1fc),_0x2e324c(0x1f8)];function _interopRequireDefault(_0x5561d3){var _0x10e270=_0x2e324c;return _0x5561d3&&_0x5561d3[_0x10e270(0x1dd)]?_0x5561d3:{'default':_0x5561d3};}function _0x344c(_0x1843de,_0x546b3a){_0x1843de=_0x1843de-0x1d5;var _0x5d814d=_0x5d81();var _0x344c34=_0x5d814d[_0x1843de];return _0x344c34;}function _getRequireWildcardCache(_0x33dd59){var _0x5243d9=_0x2e324c;if(_0x5243d9(0x1d9)!=typeof WeakMap)return null;var _0x4d042d=new WeakMap(),_0x401970=new WeakMap();return(_getRequireWildcardCache=function _0xb8a850(_0x162fb1){return _0x162fb1?_0x401970:_0x4d042d;})(_0x33dd59);}function _interopRequireWildcard(_0x53e6a9,_0x3266a8){var _0xe2c1d3=_0x2e324c;if(!_0x3266a8&&_0x53e6a9&&_0x53e6a9[_0xe2c1d3(0x1dd)])return _0x53e6a9;if(null===_0x53e6a9||'object'!=_typeof(_0x53e6a9)&&_0xe2c1d3(0x1d9)!=typeof _0x53e6a9)return{'default':_0x53e6a9};var _0x3e7d9d=_getRequireWildcardCache(_0x3266a8);if(_0x3e7d9d&&_0x3e7d9d[_0xe2c1d3(0x1d7)](_0x53e6a9))return _0x3e7d9d[_0xe2c1d3(0x20f)](_0x53e6a9);var _0x21cb5e={'__proto__':null},_0x23849b=Object[_0xe2c1d3(0x1e3)]&&Object['getOwnPropertyDescriptor'];for(var _0x3b1b58 in _0x53e6a9)if(_0xe2c1d3(0x215)!==_0x3b1b58&&Object[_0xe2c1d3(0x1dc)][_0xe2c1d3(0x20e)][_0xe2c1d3(0x21a)](_0x53e6a9,_0x3b1b58)){var _0x2b7e88=_0x23849b?Object[_0xe2c1d3(0x1e7)](_0x53e6a9,_0x3b1b58):null;_0x2b7e88&&(_0x2b7e88['get']||_0x2b7e88['set'])?Object[_0xe2c1d3(0x1e3)](_0x21cb5e,_0x3b1b58,_0x2b7e88):_0x21cb5e[_0x3b1b58]=_0x53e6a9[_0x3b1b58];}return _0x21cb5e[_0xe2c1d3(0x215)]=_0x53e6a9,_0x3e7d9d&&_0x3e7d9d['set'](_0x53e6a9,_0x21cb5e),_0x21cb5e;}function _typeof(_0x7a3ce3){'@babel/helpers - typeof';var _0x5dca73=_0x2e324c;return _typeof=_0x5dca73(0x1d9)==typeof Symbol&&_0x5dca73(0x213)==typeof Symbol[_0x5dca73(0x1da)]?function(_0x5d5716){return typeof _0x5d5716;}:function(_0x2fddc5){var _0x2a61ec=_0x5dca73;return _0x2fddc5&&_0x2a61ec(0x1d9)==typeof Symbol&&_0x2fddc5[_0x2a61ec(0x1f9)]===Symbol&&_0x2fddc5!==Symbol[_0x2a61ec(0x1dc)]?_0x2a61ec(0x213):typeof _0x2fddc5;},_typeof(_0x7a3ce3);}function ownKeys(_0x416781,_0x11e329){var _0x18ae15=_0x2e324c,_0x1df8da=Object[_0x18ae15(0x1e0)](_0x416781);if(Object[_0x18ae15(0x1f2)]){var _0x301583=Object[_0x18ae15(0x1f2)](_0x416781);_0x11e329&&(_0x301583=_0x301583[_0x18ae15(0x1f4)](function(_0x37dd1b){var _0x40ac0a=_0x18ae15;return Object[_0x40ac0a(0x1e7)](_0x416781,_0x37dd1b)[_0x40ac0a(0x1fb)];})),_0x1df8da['push']['apply'](_0x1df8da,_0x301583);}return _0x1df8da;}function _objectSpread(_0xc45c0d){var _0x5b8adb=_0x2e324c;for(var _0x317ba8=0x1;_0x317ba8<arguments[_0x5b8adb(0x1f0)];_0x317ba8++){var _0x221cab=null!=arguments[_0x317ba8]?arguments[_0x317ba8]:{};_0x317ba8%0x2?ownKeys(Object(_0x221cab),!0x0)['forEach'](function(_0x1f5c58){_defineProperty(_0xc45c0d,_0x1f5c58,_0x221cab[_0x1f5c58]);}):Object[_0x5b8adb(0x205)]?Object[_0x5b8adb(0x1f6)](_0xc45c0d,Object[_0x5b8adb(0x205)](_0x221cab)):ownKeys(Object(_0x221cab))['forEach'](function(_0xb6ec95){var _0x2afca8=_0x5b8adb;Object[_0x2afca8(0x1e3)](_0xc45c0d,_0xb6ec95,Object[_0x2afca8(0x1e7)](_0x221cab,_0xb6ec95));});}return _0xc45c0d;}function _defineProperty(_0x3d7231,_0xeb599f,_0x5720dc){return _0xeb599f=_toPropertyKey(_0xeb599f),_0xeb599f in _0x3d7231?Object['defineProperty'](_0x3d7231,_0xeb599f,{'value':_0x5720dc,'enumerable':!![],'configurable':!![],'writable':!![]}):_0x3d7231[_0xeb599f]=_0x5720dc,_0x3d7231;}function _toPropertyKey(_0x417b4e){var _0x4f0906=_0x2e324c,_0x50f0f4=_toPrimitive(_0x417b4e,_0x4f0906(0x212));return _0x4f0906(0x213)==_typeof(_0x50f0f4)?_0x50f0f4:String(_0x50f0f4);}function _toPrimitive(_0x29118a,_0xae9b69){var _0x2f4915=_0x2e324c;if(_0x2f4915(0x1e8)!=_typeof(_0x29118a)||!_0x29118a)return _0x29118a;var _0x1e73a9=_0x29118a[Symbol[_0x2f4915(0x219)]];if(void 0x0!==_0x1e73a9){var _0x3b2c0b=_0x1e73a9['call'](_0x29118a,_0xae9b69||_0x2f4915(0x215));if('object'!=_typeof(_0x3b2c0b))return _0x3b2c0b;throw new TypeError(_0x2f4915(0x1e2));}return(_0x2f4915(0x212)===_0xae9b69?String:Number)(_0x29118a);}function _objectWithoutProperties(_0x5ca624,_0x55af97){var _0x31cba4=_0x2e324c;if(_0x5ca624==null)return{};var _0x12fa09=_objectWithoutPropertiesLoose(_0x5ca624,_0x55af97),_0x473e63,_0x55292c;if(Object[_0x31cba4(0x1f2)]){var _0x12ed8a=Object[_0x31cba4(0x1f2)](_0x5ca624);for(_0x55292c=0x0;_0x55292c<_0x12ed8a[_0x31cba4(0x1f0)];_0x55292c++){_0x473e63=_0x12ed8a[_0x55292c];if(_0x55af97[_0x31cba4(0x214)](_0x473e63)>=0x0)continue;if(!Object['prototype'][_0x31cba4(0x1db)][_0x31cba4(0x21a)](_0x5ca624,_0x473e63))continue;_0x12fa09[_0x473e63]=_0x5ca624[_0x473e63];}}return _0x12fa09;}function _objectWithoutPropertiesLoose(_0x4ce3c6,_0x2f1507){var _0x4fa028=_0x2e324c;if(_0x4ce3c6==null)return{};var _0x1f8555={},_0xb35a49=Object[_0x4fa028(0x1e0)](_0x4ce3c6),_0x2b32e4,_0x349297;for(_0x349297=0x0;_0x349297<_0xb35a49[_0x4fa028(0x1f0)];_0x349297++){_0x2b32e4=_0xb35a49[_0x349297];if(_0x2f1507[_0x4fa028(0x214)](_0x2b32e4)>=0x0)continue;_0x1f8555[_0x2b32e4]=_0x4ce3c6[_0x2b32e4];}return _0x1f8555;}var px=function px(_0x10aee3){var _0xbe5b1d=_0x2e324c;if(_0x10aee3===undefined||_0x10aee3===null||_0x10aee3==='')return undefined;return typeof _0x10aee3===_0xbe5b1d(0x1f7)||!isNaN(Number(_0x10aee3))?''[_0xbe5b1d(0x1ea)](_0x10aee3,'px'):String(_0x10aee3);},Text=(0x0,_react['forwardRef'])(function(_0x1ba0c6,_0x1a2575){var _0x1115b9=_0x2e324c,_0x8cd00f=_0x1ba0c6['children'],_0x529204=_0x1ba0c6[_0x1115b9(0x1e4)],_0x6d30a3=_0x1ba0c6[_0x1115b9(0x20c)],_0x395e94=_0x1ba0c6['height'],_0x3ef3c5=_0x1ba0c6[_0x1115b9(0x1f3)],_0x51feb4=_0x1ba0c6[_0x1115b9(0x202)],_0xef287c=_0x1ba0c6[_0x1115b9(0x209)],_0x1cab39=_0x1ba0c6['color'],_0x17ef5e=_0x1ba0c6[_0x1115b9(0x1f1)],_0xb2e02b=_0x1ba0c6['padding'],_0x52b8ee=_0x1ba0c6[_0x1115b9(0x208)],_0x3ed77d=_0x52b8ee===void 0x0?{}:_0x52b8ee,_0x4052f6=_0x1ba0c6[_0x1115b9(0x1e6)],_0xf520c0=_0x1ba0c6[_0x1115b9(0x1e9)],_0x4a749d=_0x1ba0c6[_0x1115b9(0x1fa)],_0x3e02a0=_0x1ba0c6[_0x1115b9(0x211)],_0x4ca3bf=_0x1ba0c6['pVertical'],_0x4346fa=_0x1ba0c6[_0x1115b9(0x204)],_0x40c72b=_0x1ba0c6['mBottom'],_0x4cb54e=_0x1ba0c6['mLeft'],_0x3e9f30=_0x1ba0c6[_0x1115b9(0x203)],_0x1262e2=_0x1ba0c6[_0x1115b9(0x1d6)],_0x2977f4=_0x1ba0c6[_0x1115b9(0x201)],_0x2e96f9=_0x1ba0c6['pLeft'],_0x18b452=_0x1ba0c6[_0x1115b9(0x1de)],_0x96a4cf=_0x1ba0c6[_0x1115b9(0x218)],_0x3c1ad8=_0x1ba0c6[_0x1115b9(0x206)],_0x3afd4b=_0x1ba0c6['decoration'],_0x3336f2=_0x1ba0c6['selectable'],_0x1dafa5=_0x1ba0c6[_0x1115b9(0x1f8)],_0xe6545e=_objectWithoutProperties(_0x1ba0c6,_excluded),_0x4611a4=(0x0,_classnames[_0x1115b9(0x215)])(_0x96a4cf,{'zero-line-clamp-1':_0x529204===0x1,'zero-line-clamp-2':_0x529204===0x2,'zero-line-clamp-3':_0x529204===0x3,'zero-line-clamp-4':_0x529204===0x4,'zero-line-clamp-5':_0x529204===0x5,'zero-line-clamp-6':_0x529204===0x6,'zero-animate-pulse\x20zero-bg-gray-200\x20zero-text-transparent':_0x1dafa5}),_0x45f9ca=_objectSpread({'width':px(_0x6d30a3),'height':px(_0x395e94),'margin':px(_0x17ef5e),'marginTop':px(_0x4346fa!==null&&_0x4346fa!==void 0x0?_0x4346fa:_0x4a749d),'marginBottom':px(_0x40c72b!==null&&_0x40c72b!==void 0x0?_0x40c72b:_0x4a749d),'marginLeft':px(_0x4cb54e!==null&&_0x4cb54e!==void 0x0?_0x4cb54e:_0xf520c0),'marginRight':px(_0x3e9f30!==null&&_0x3e9f30!==void 0x0?_0x3e9f30:_0xf520c0),'padding':px(_0xb2e02b),'paddingTop':px(_0x1262e2!==null&&_0x1262e2!==void 0x0?_0x1262e2:_0x4ca3bf),'paddingBottom':px(_0x2977f4!==null&&_0x2977f4!==void 0x0?_0x2977f4:_0x4ca3bf),'paddingLeft':px(_0x2e96f9!==null&&_0x2e96f9!==void 0x0?_0x2e96f9:_0x3e02a0),'paddingRight':px(_0x18b452!==null&&_0x18b452!==void 0x0?_0x18b452:_0x3e02a0),'fontSize':px(_0xef287c),'color':_0x1dafa5?_0x1115b9(0x1ec):_0x1cab39,'backgroundColor':_0x4052f6,'lineHeight':px(_0x3ef3c5),'fontWeight':typeof _0x51feb4===_0x1115b9(0x1eb)?_0x51feb4?_0x1115b9(0x202):'normal':_0x51feb4,'textAlign':_0x3c1ad8,'textDecoration':_0x3afd4b},_typeof(_0x3ed77d)==='object'?_0x3ed77d:{}),_0x5ee2cd={};for(var _0x1aea73 in _0x45f9ca){_0x45f9ca[_0x1aea73]!==undefined&&_0x45f9ca[_0x1aea73]!==null&&(_0x5ee2cd[_0x1aea73]=_0x45f9ca[_0x1aea73]);}return(0x0,_jsxRuntime[_0x1115b9(0x21c)])(_components[_0x1115b9(0x1ee)],_objectSpread(_objectSpread({'ref':_0x1a2575,'style':_0x5ee2cd,'className':_0x4611a4,'selectable':_0x3336f2},_0xe6545e),{},{'children':_0x8cd00f}));});Text['displayName']=_0x2e324c(0x1ee);var _default=exports[_0x2e324c(0x215)]=Text;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _components = require("@tarojs/components");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
require("../../styles/index.css");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
var _excluded = ["children", "clamp", "width", "height", "lineHeight", "bold", "fontSize", "color", "margin", "padding", "style", "bgColor", "mHorizontal", "mVertical", "pHorizontal", "pVertical", "mTop", "mBottom", "mLeft", "mRight", "pTop", "pBottom", "pLeft", "pRight", "className", "textAlign", "decoration", "selectable", "skeleton"];
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
24
|
+
/**
|
|
25
|
+
* 处理 px 转换
|
|
26
|
+
* @param val px|string|undefined
|
|
27
|
+
* @returns px|string|undefined
|
|
28
|
+
*/
|
|
29
|
+
var px = function px(val) {
|
|
30
|
+
if (val === undefined || val === null || val === '') return undefined;
|
|
31
|
+
return typeof val === 'number' || !isNaN(Number(val)) ? "".concat(val, "px") : String(val);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* taro weapp Text Component (Tailwind 版)
|
|
36
|
+
* - clamp: number|undefined 溢出显示行数
|
|
37
|
+
* - width: px|string|undefined 宽度
|
|
38
|
+
* - height: px|string|undefined 高度
|
|
39
|
+
* - fontSize: px|string|undefined 字体大小
|
|
40
|
+
* - lineHeight: px|string|undefined 行高
|
|
41
|
+
* - bold: boolean|number|string 字体粗细
|
|
42
|
+
* - color: string 字体颜色
|
|
43
|
+
* - bgColor: string 背景颜色
|
|
44
|
+
* - textAlign: 'left' | 'center' | 'right' | 'justify' 文本对齐方式
|
|
45
|
+
* - decoration: 'underline' | 'line-through' | 'none' 文本装饰
|
|
46
|
+
* - selectable: boolean 是否可选择
|
|
47
|
+
* - skeleton: boolean 是否为骨架屏
|
|
48
|
+
* - style: CSSProperties 自定义样式
|
|
49
|
+
* - children: ReactNode 子元素
|
|
50
|
+
* - margin: px|string|undefined 外边距
|
|
51
|
+
* - mTop: px|string|undefined 上外边距
|
|
52
|
+
* - mBottom: px|string|undefined 下外边距
|
|
53
|
+
* - mLeft: px|string|undefined 左外边距
|
|
54
|
+
* - mRight: px|string|undefined 右外边距
|
|
55
|
+
* - mHorizontal: px|string|undefined 水平外边距
|
|
56
|
+
* - mVertical: px|string|undefined 垂直外边距
|
|
57
|
+
* - padding: px|string|undefined 内边距
|
|
58
|
+
* - pTop: px|string|undefined 上内边距
|
|
59
|
+
* - pBottom: px|string|undefined 下内边距
|
|
60
|
+
* - pLeft: px|string|undefined 左内边距
|
|
61
|
+
* - pRight: px|string|undefined 右内边距
|
|
62
|
+
* - pHorizontal: px|string|undefined 水平内边距
|
|
63
|
+
* - pVertical: px|string|undefined 垂直内边距
|
|
64
|
+
* - rest: Text组件的其他属性
|
|
65
|
+
*/
|
|
66
|
+
var Text = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
67
|
+
var children = props.children,
|
|
68
|
+
clamp = props.clamp,
|
|
69
|
+
width = props.width,
|
|
70
|
+
height = props.height,
|
|
71
|
+
lineHeight = props.lineHeight,
|
|
72
|
+
bold = props.bold,
|
|
73
|
+
fontSize = props.fontSize,
|
|
74
|
+
color = props.color,
|
|
75
|
+
margin = props.margin,
|
|
76
|
+
padding = props.padding,
|
|
77
|
+
_props$style = props.style,
|
|
78
|
+
style = _props$style === void 0 ? {} : _props$style,
|
|
79
|
+
bgColor = props.bgColor,
|
|
80
|
+
mHorizontal = props.mHorizontal,
|
|
81
|
+
mVertical = props.mVertical,
|
|
82
|
+
pHorizontal = props.pHorizontal,
|
|
83
|
+
pVertical = props.pVertical,
|
|
84
|
+
mTop = props.mTop,
|
|
85
|
+
mBottom = props.mBottom,
|
|
86
|
+
mLeft = props.mLeft,
|
|
87
|
+
mRight = props.mRight,
|
|
88
|
+
pTop = props.pTop,
|
|
89
|
+
pBottom = props.pBottom,
|
|
90
|
+
pLeft = props.pLeft,
|
|
91
|
+
pRight = props.pRight,
|
|
92
|
+
className = props.className,
|
|
93
|
+
textAlign = props.textAlign,
|
|
94
|
+
decoration = props.decoration,
|
|
95
|
+
selectable = props.selectable,
|
|
96
|
+
skeleton = props.skeleton,
|
|
97
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
98
|
+
var textClassNames = (0, _classnames.default)(className, {
|
|
99
|
+
'zero-line-clamp-1': clamp === 1,
|
|
100
|
+
'zero-line-clamp-2': clamp === 2,
|
|
101
|
+
'zero-line-clamp-3': clamp === 3,
|
|
102
|
+
'zero-line-clamp-4': clamp === 4,
|
|
103
|
+
'zero-line-clamp-5': clamp === 5,
|
|
104
|
+
'zero-line-clamp-6': clamp === 6,
|
|
105
|
+
'zero-animate-pulse zero-bg-gray-200 zero-text-transparent': skeleton
|
|
106
|
+
});
|
|
107
|
+
var textStyle = _objectSpread({
|
|
108
|
+
width: px(width),
|
|
109
|
+
height: px(height),
|
|
110
|
+
margin: px(margin),
|
|
111
|
+
marginTop: px(mTop !== null && mTop !== void 0 ? mTop : mVertical),
|
|
112
|
+
marginBottom: px(mBottom !== null && mBottom !== void 0 ? mBottom : mVertical),
|
|
113
|
+
marginLeft: px(mLeft !== null && mLeft !== void 0 ? mLeft : mHorizontal),
|
|
114
|
+
marginRight: px(mRight !== null && mRight !== void 0 ? mRight : mHorizontal),
|
|
115
|
+
padding: px(padding),
|
|
116
|
+
paddingTop: px(pTop !== null && pTop !== void 0 ? pTop : pVertical),
|
|
117
|
+
paddingBottom: px(pBottom !== null && pBottom !== void 0 ? pBottom : pVertical),
|
|
118
|
+
paddingLeft: px(pLeft !== null && pLeft !== void 0 ? pLeft : pHorizontal),
|
|
119
|
+
paddingRight: px(pRight !== null && pRight !== void 0 ? pRight : pHorizontal),
|
|
120
|
+
fontSize: px(fontSize),
|
|
121
|
+
color: skeleton ? 'transparent' : color,
|
|
122
|
+
backgroundColor: bgColor,
|
|
123
|
+
lineHeight: px(lineHeight),
|
|
124
|
+
fontWeight: typeof bold === 'boolean' ? bold ? 'bold' : 'normal' : bold,
|
|
125
|
+
textAlign: textAlign,
|
|
126
|
+
textDecoration: decoration
|
|
127
|
+
}, _typeof(style) === 'object' ? style : {});
|
|
128
|
+
var cleanStyle = {};
|
|
129
|
+
for (var key in textStyle) {
|
|
130
|
+
if (textStyle[key] !== undefined && textStyle[key] !== null) {
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
cleanStyle[key] = textStyle[key];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Text, _objectSpread(_objectSpread({
|
|
136
|
+
ref: ref,
|
|
137
|
+
style: cleanStyle,
|
|
138
|
+
className: textClassNames,
|
|
139
|
+
selectable: selectable
|
|
140
|
+
}, rest), {}, {
|
|
141
|
+
children: children
|
|
142
|
+
}));
|
|
143
|
+
});
|
|
144
|
+
Text.displayName = 'Text';
|
|
145
|
+
var _default = exports.default = Text;
|
|
@@ -31,7 +31,12 @@ export interface UIViewProps {
|
|
|
31
31
|
hidden?: boolean;
|
|
32
32
|
width?: string | number;
|
|
33
33
|
height?: string | number;
|
|
34
|
+
minWidth?: string | number;
|
|
35
|
+
minHeight?: string | number;
|
|
36
|
+
maxWidth?: string | number;
|
|
37
|
+
maxHeight?: string | number;
|
|
34
38
|
bgColor?: string;
|
|
39
|
+
background?: string;
|
|
35
40
|
safeArea?: 'top' | 'bottom' | 'both';
|
|
36
41
|
hover?: boolean;
|
|
37
42
|
skeleton?: boolean;
|
|
@@ -42,6 +47,8 @@ export interface UIViewProps {
|
|
|
42
47
|
top?: number | string;
|
|
43
48
|
bottom?: number | string;
|
|
44
49
|
overflow?: OverflowValue;
|
|
50
|
+
overflowX?: OverflowValue;
|
|
51
|
+
overflowY?: OverflowValue;
|
|
45
52
|
radius?: string | number;
|
|
46
53
|
border?: boolean;
|
|
47
54
|
borderColor?: string;
|
|
@@ -74,6 +81,7 @@ type Props = UIViewProps & Partial<PaddingType> & Partial<MarginType> & ViewProp
|
|
|
74
81
|
* - width: width 宽度
|
|
75
82
|
* - height: height 高度
|
|
76
83
|
* - bgColor: background-color 背景颜色
|
|
84
|
+
* - background: background 背景图片等复杂背景
|
|
77
85
|
* - safeArea: safe-area-inset 安全区域
|
|
78
86
|
* - hover: hover 悬停状态
|
|
79
87
|
* - skeleton: skeleton 骨架屏
|
|
@@ -84,6 +92,8 @@ type Props = UIViewProps & Partial<PaddingType> & Partial<MarginType> & ViewProp
|
|
|
84
92
|
* - top: top 定位上侧
|
|
85
93
|
* - bottom: bottom 定位下侧
|
|
86
94
|
* - overflow: overflow 显示
|
|
95
|
+
* - overflowX: overflow-x 显示
|
|
96
|
+
* - overflowY: overflow-y 显示
|
|
87
97
|
* - radius: border-radius 圆角
|
|
88
98
|
* - border: boolean 边框
|
|
89
99
|
* - borderColor: border-color 边框颜色
|
|
@@ -1 +1,227 @@
|
|
|
1
|
-
'use strict';var _0x263676=_0x9aef;(function(_0xa22dbd,_0x122307){var _0xe28dd=_0x9aef,_0x4c8a65=_0xa22dbd();while(!![]){try{var _0x4424f6=parseInt(_0xe28dd(0x144))/0x1*(parseInt(_0xe28dd(0x10b))/0x2)+-parseInt(_0xe28dd(0x157))/0x3*(-parseInt(_0xe28dd(0x118))/0x4)+-parseInt(_0xe28dd(0x156))/0x5+parseInt(_0xe28dd(0x128))/0x6*(-parseInt(_0xe28dd(0x112))/0x7)+-parseInt(_0xe28dd(0x163))/0x8+-parseInt(_0xe28dd(0x137))/0x9+parseInt(_0xe28dd(0x109))/0xa*(parseInt(_0xe28dd(0x10e))/0xb);if(_0x4424f6===_0x122307)break;else _0x4c8a65['push'](_0x4c8a65['shift']());}catch(_0x89f6d1){_0x4c8a65['push'](_0x4c8a65['shift']());}}}(_0x6832,0x67285));Object[_0x263676(0x160)](exports,_0x263676(0x149),{'value':!![]}),exports[_0x263676(0x12f)]=void 0x0;var _react=require(_0x263676(0x134)),_components=require(_0x263676(0x145)),_classnames=_interopRequireDefault(require('classnames'));require(_0x263676(0x12b));var _jsxRuntime=require(_0x263676(0x129)),_excluded=[_0x263676(0x135),_0x263676(0x11b),_0x263676(0x15a),'wrap','flex',_0x263676(0x158),'between','className',_0x263676(0x10c),_0x263676(0x165),_0x263676(0x159),_0x263676(0x13a),'rowGap',_0x263676(0x117),'flexShrink',_0x263676(0x139),'flexBasis',_0x263676(0x162),_0x263676(0x14a),_0x263676(0x154),_0x263676(0x115),_0x263676(0x13b),_0x263676(0x142),_0x263676(0x131),_0x263676(0x15f),_0x263676(0x13c),'mBottom',_0x263676(0x113),'mRight',_0x263676(0x11d),'mVertical',_0x263676(0x14e),_0x263676(0x147),'pBottom','pLeft',_0x263676(0x107),_0x263676(0x123),_0x263676(0x11c),'safeArea','hover','skeleton',_0x263676(0x102),_0x263676(0x121),'left',_0x263676(0x11e),_0x263676(0x146),'bottom',_0x263676(0x108),_0x263676(0x104),_0x263676(0x136),_0x263676(0x15e),_0x263676(0x116),_0x263676(0x111)];function _interopRequireDefault(_0x5304bb){var _0x15d3df=_0x263676;return _0x5304bb&&_0x5304bb[_0x15d3df(0x149)]?_0x5304bb:{'default':_0x5304bb};}function _typeof(_0x1ecab0){'@babel/helpers - typeof';var _0x367f4f=_0x263676;return _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol[_0x367f4f(0x125)]?function(_0x59dad1){return typeof _0x59dad1;}:function(_0x2a7512){var _0x5e9a51=_0x367f4f;return _0x2a7512&&_0x5e9a51(0x150)==typeof Symbol&&_0x2a7512[_0x5e9a51(0x14c)]===Symbol&&_0x2a7512!==Symbol[_0x5e9a51(0x148)]?_0x5e9a51(0x126):typeof _0x2a7512;},_typeof(_0x1ecab0);}function ownKeys(_0x1fc1d9,_0x1e4d13){var _0x43934e=_0x263676,_0x10ae99=Object['keys'](_0x1fc1d9);if(Object[_0x43934e(0x12d)]){var _0x261b16=Object[_0x43934e(0x12d)](_0x1fc1d9);_0x1e4d13&&(_0x261b16=_0x261b16['filter'](function(_0xc9a6da){var _0x5bd9f7=_0x43934e;return Object[_0x5bd9f7(0x119)](_0x1fc1d9,_0xc9a6da)[_0x5bd9f7(0x124)];})),_0x10ae99[_0x43934e(0x103)]['apply'](_0x10ae99,_0x261b16);}return _0x10ae99;}function _objectSpread(_0x4d9a3a){var _0x5a8e0d=_0x263676;for(var _0x392cd3=0x1;_0x392cd3<arguments[_0x5a8e0d(0x114)];_0x392cd3++){var _0x38b221=null!=arguments[_0x392cd3]?arguments[_0x392cd3]:{};_0x392cd3%0x2?ownKeys(Object(_0x38b221),!0x0)['forEach'](function(_0x1ea349){_defineProperty(_0x4d9a3a,_0x1ea349,_0x38b221[_0x1ea349]);}):Object[_0x5a8e0d(0x13e)]?Object[_0x5a8e0d(0x12c)](_0x4d9a3a,Object[_0x5a8e0d(0x13e)](_0x38b221)):ownKeys(Object(_0x38b221))[_0x5a8e0d(0x120)](function(_0x61606e){var _0x4e3f6a=_0x5a8e0d;Object[_0x4e3f6a(0x160)](_0x4d9a3a,_0x61606e,Object[_0x4e3f6a(0x119)](_0x38b221,_0x61606e));});}return _0x4d9a3a;}function _defineProperty(_0xeba7e,_0x4d72b0,_0x291bf0){return _0x4d72b0=_toPropertyKey(_0x4d72b0),_0x4d72b0 in _0xeba7e?Object['defineProperty'](_0xeba7e,_0x4d72b0,{'value':_0x291bf0,'enumerable':!![],'configurable':!![],'writable':!![]}):_0xeba7e[_0x4d72b0]=_0x291bf0,_0xeba7e;}function _toPropertyKey(_0x207365){var _0x23b64b=_0x263676,_0x295235=_toPrimitive(_0x207365,_0x23b64b(0x10a));return _0x23b64b(0x126)==_typeof(_0x295235)?_0x295235:String(_0x295235);}function _toPrimitive(_0x113c70,_0x50e68f){var _0x261477=_0x263676;if(_0x261477(0x15d)!=_typeof(_0x113c70)||!_0x113c70)return _0x113c70;var _0x43470e=_0x113c70[Symbol['toPrimitive']];if(void 0x0!==_0x43470e){var _0xed6d0a=_0x43470e['call'](_0x113c70,_0x50e68f||_0x261477(0x12f));if('object'!=_typeof(_0xed6d0a))return _0xed6d0a;throw new TypeError(_0x261477(0x15c));}return(_0x261477(0x10a)===_0x50e68f?String:Number)(_0x113c70);}function _objectWithoutProperties(_0x12ded5,_0x2cec16){var _0x412974=_0x263676;if(_0x12ded5==null)return{};var _0x3f784b=_objectWithoutPropertiesLoose(_0x12ded5,_0x2cec16),_0x53d15e,_0xcea67d;if(Object[_0x412974(0x12d)]){var _0xadf502=Object[_0x412974(0x12d)](_0x12ded5);for(_0xcea67d=0x0;_0xcea67d<_0xadf502[_0x412974(0x114)];_0xcea67d++){_0x53d15e=_0xadf502[_0xcea67d];if(_0x2cec16[_0x412974(0x164)](_0x53d15e)>=0x0)continue;if(!Object[_0x412974(0x148)][_0x412974(0x105)]['call'](_0x12ded5,_0x53d15e))continue;_0x3f784b[_0x53d15e]=_0x12ded5[_0x53d15e];}}return _0x3f784b;}function _0x9aef(_0x1ff8de,_0x4b91e2){_0x1ff8de=_0x1ff8de-0x102;var _0x683298=_0x6832();var _0x9aef8f=_0x683298[_0x1ff8de];return _0x9aef8f;}function _objectWithoutPropertiesLoose(_0x587266,_0x427156){var _0x3fd96e=_0x263676;if(_0x587266==null)return{};var _0x118eff={},_0x4da15f=Object[_0x3fd96e(0x151)](_0x587266),_0x1a3a14,_0x278dba;for(_0x278dba=0x0;_0x278dba<_0x4da15f[_0x3fd96e(0x114)];_0x278dba++){_0x1a3a14=_0x4da15f[_0x278dba];if(_0x427156[_0x3fd96e(0x164)](_0x1a3a14)>=0x0)continue;_0x118eff[_0x1a3a14]=_0x587266[_0x1a3a14];}return _0x118eff;}var px=function px(_0x26cfa5){var _0x8b79d=_0x263676;if(_0x26cfa5===undefined||_0x26cfa5===null||_0x26cfa5==='')return undefined;return typeof _0x26cfa5===_0x8b79d(0x122)||!isNaN(Number(_0x26cfa5))?''[_0x8b79d(0x10f)](_0x26cfa5,'px'):String(_0x26cfa5);},View=(0x0,_react[_0x263676(0x166)])(function(_0x200134,_0x41ec55){var _0x577273=_0x263676,_0x2d8c53=_0x200134[_0x577273(0x135)],_0x81242f=_0x200134['row'],_0x25f523=_0x200134[_0x577273(0x15a)],_0x4da70a=_0x200134[_0x577273(0x140)],_0x263594=_0x200134[_0x577273(0x169)],_0x44cae6=_0x200134['around'],_0x3337a1=_0x200134[_0x577273(0x11f)],_0x2df4a8=_0x200134[_0x577273(0x132)],_0x2db63f=_0x200134['justifyItems'],_0x134e55=_0x200134['alignItems'],_0x1d6b7e=_0x200134[_0x577273(0x159)],_0x5787e0=_0x200134[_0x577273(0x13a)],_0xeb6877=_0x200134[_0x577273(0x13d)],_0x59f645=_0x200134[_0x577273(0x117)],_0x3f59a5=_0x200134[_0x577273(0x152)],_0x214814=_0x200134[_0x577273(0x139)],_0x1fcd3c=_0x200134['flexBasis'],_0x451479=_0x200134[_0x577273(0x162)],_0xbc0583=_0x200134[_0x577273(0x14a)],_0x1803d4=_0x200134['width'],_0x382fee=_0x200134['height'],_0x459973=_0x200134['bgColor'],_0x13cbc3=_0x200134[_0x577273(0x142)],_0x1d082f=_0x13cbc3===void 0x0?{}:_0x13cbc3,_0x57ba9f=_0x200134[_0x577273(0x131)],_0x373996=_0x200134[_0x577273(0x15f)],_0x400fb5=_0x200134['mTop'],_0x539baf=_0x200134[_0x577273(0x141)],_0x745830=_0x200134[_0x577273(0x113)],_0x2ed38b=_0x200134[_0x577273(0x153)],_0x4c0ba6=_0x200134[_0x577273(0x11d)],_0x4d5463=_0x200134['mVertical'],_0x2b5835=_0x200134[_0x577273(0x14e)],_0x5a6a3d=_0x200134[_0x577273(0x147)],_0x57150d=_0x200134['pBottom'],_0x473bb5=_0x200134['pLeft'],_0x38cef3=_0x200134[_0x577273(0x107)],_0x2d350b=_0x200134['pHorizontal'],_0x975804=_0x200134[_0x577273(0x11c)],_0x650f2f=_0x200134[_0x577273(0x127)],_0x3ba7dc=_0x200134[_0x577273(0x14f)],_0x371757=_0x200134[_0x577273(0x15b)],_0x22738e=_0x200134[_0x577273(0x102)],_0x55ac75=_0x200134['zIndex'],_0x239e85=_0x200134[_0x577273(0x167)],_0x8595fc=_0x200134[_0x577273(0x11e)],_0x10d966=_0x200134['top'],_0x40b38d=_0x200134[_0x577273(0x138)],_0x6d1788=_0x200134[_0x577273(0x108)],_0x1f11b6=_0x200134['radius'],_0x3ecca2=_0x200134['border'],_0xbb5c50=_0x200134[_0x577273(0x15e)],_0x292977=_0x200134[_0x577273(0x116)],_0x8cf5fe=_0x200134[_0x577273(0x111)],_0x51577a=_objectWithoutProperties(_0x200134,_excluded),_0x2f1293=(0x0,_classnames[_0x577273(0x12f)])(_0x2df4a8,{'zero-flex':!![],'zero-flex-1':_0x263594,'zero-flex-col':_0x25f523,'zero-flex-row':_0x81242f,'zero-flex-wrap':_0x4da70a,'zero-items-start':_0x134e55===_0x577273(0x12a),'zero-items-end':_0x134e55===_0x577273(0x155),'zero-items-center':_0x134e55===_0x577273(0x110),'zero-justify-start':_0x2db63f==='flex-start','zero-justify-end':_0x2db63f===_0x577273(0x155),'zero-justify-center':_0x2db63f===_0x577273(0x110),'zero-place-content-around':_0x44cae6===_0x577273(0x10d),'zero-justify-around':_0x44cae6===_0x577273(0x106),'zero-justify-between':_0x3337a1,'zero-hidden':_0xbc0583,'zero-animate-pulse\x20zero-bg-gray-200':_0x371757}),_0x15b932=function _0x2d727f(_0x1f26bd,_0x228453,_0x32ec){var _0x21bfc5=_0x577273,_0x988720=_0x228453===_0x1f26bd||_0x228453==='both';if(!_0x988720)return px(_0x32ec);return _0x32ec?_0x21bfc5(0x14d)['concat'](_0x1f26bd,_0x21bfc5(0x143))[_0x21bfc5(0x10f)](px(_0x32ec),')'):_0x21bfc5(0x161)[_0x21bfc5(0x10f)](_0x1f26bd,')');},_0x58aa40=_0x3ecca2||_0xbb5c50!==undefined||_0x292977!==undefined,_0x3686e1=_objectSpread({'width':px(_0x2d8c53?_0x577273(0x11a):_0x1803d4),'height':px(_0x2d8c53?_0x577273(0x11a):_0x382fee),'backgroundColor':_0x459973,'margin':px(_0x373996),'marginTop':px(_0x400fb5!==null&&_0x400fb5!==void 0x0?_0x400fb5:_0x4d5463),'marginBottom':px(_0x539baf!==null&&_0x539baf!==void 0x0?_0x539baf:_0x4d5463),'marginLeft':px(_0x745830!==null&&_0x745830!==void 0x0?_0x745830:_0x4c0ba6),'marginRight':px(_0x2ed38b!==null&&_0x2ed38b!==void 0x0?_0x2ed38b:_0x4c0ba6),'padding':px(_0x2b5835),'paddingTop':_0x15b932(_0x577273(0x146),_0x650f2f,_0x5a6a3d!==null&&_0x5a6a3d!==void 0x0?_0x5a6a3d:_0x975804),'paddingBottom':_0x15b932(_0x577273(0x138),_0x650f2f,_0x57150d!==null&&_0x57150d!==void 0x0?_0x57150d:_0x975804),'paddingLeft':px(_0x473bb5!==null&&_0x473bb5!==void 0x0?_0x473bb5:_0x2d350b),'paddingRight':px(_0x38cef3!==null&&_0x38cef3!==void 0x0?_0x38cef3:_0x2d350b),'position':_0x22738e,'zIndex':_0x55ac75,'left':px(_0x239e85),'right':px(_0x8595fc),'top':px(_0x10d966),'bottom':px(_0x40b38d),'overflow':_0x6d1788,'borderRadius':px(_0x1f11b6),'borderWidth':_0x58aa40?px(_0x292977!==null&&_0x292977!==void 0x0?_0x292977:0x1):undefined,'borderStyle':_0x58aa40?_0x8cf5fe!==null&&_0x8cf5fe!==void 0x0?_0x8cf5fe:_0x577273(0x133):undefined,'borderColor':_0xbb5c50,'gap':px(_0x5787e0),'rowGap':px(_0xeb6877),'columnGap':px(_0x59f645),'alignSelf':_0x1d6b7e,'flexShrink':_0x3f59a5,'flexGrow':_0x214814,'flexBasis':px(_0x1fcd3c),'opacity':_0x451479,'display':_0xbc0583?_0x577273(0x12e):undefined,'color':_0x371757?_0x577273(0x13f):undefined},_typeof(_0x1d082f)==='object'?_0x1d082f:{}),_0x563686={};for(var _0x4af4de in _0x3686e1){_0x3686e1[_0x4af4de]!==undefined&&_0x3686e1[_0x4af4de]!==null&&(_0x563686[_0x4af4de]=_0x3686e1[_0x4af4de]);}return(0x0,_jsxRuntime[_0x577273(0x130)])(_components[_0x577273(0x14b)],_objectSpread(_objectSpread({'ref':_0x41ec55,'className':_0x2f1293,'style':_0x563686,'hoverClass':_0x3ba7dc?'zero:opacity-70':_0x577273(0x12e),'hoverStayTime':0xc8},_0x51577a),{},{'children':_0x57ba9f}));});View[_0x263676(0x168)]=_0x263676(0x14b);function _0x6832(){var _0x3ddb9a=['mHorizontal','right','between','forEach','zIndex','number','pHorizontal','enumerable','iterator','symbol','safeArea','1812erqjFL','react/jsx-runtime','flex-start','../../styles/index.css','defineProperties','getOwnPropertySymbols','none','default','jsx','children','className','solid','react','full','border','4916628eDLymY','bottom','flexGrow','gap','bgColor','mTop','rowGap','getOwnPropertyDescriptors','transparent','wrap','mBottom','style',')\x20+\x20','5068zIYnDf','@tarojs/components','top','pTop','prototype','__esModule','hidden','View','constructor','calc(env(safe-area-inset-','padding','hover','function','keys','flexShrink','mRight','width','flex-end','2259295EcqqJc','1723149ChZell','around','alignSelf','column','skeleton','@@toPrimitive\x20must\x20return\x20a\x20primitive\x20value.','object','borderColor','margin','defineProperty','env(safe-area-inset-','opacity','2603952lJdkKi','indexOf','alignItems','forwardRef','left','displayName','flex','position','push','radius','propertyIsEnumerable','justify-around','pRight','overflow','27510xpgCOS','string','212AodlLQ','justifyItems','content-around','4961DgzaEQ','concat','center','borderStyle','14049IcqyKX','mLeft','length','height','borderWidth','columnGap','4ImIwUF','getOwnPropertyDescriptor','100%','row','pVertical'];_0x6832=function(){return _0x3ddb9a;};return _0x6832();}var _default=exports[_0x263676(0x12f)]=View;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _components = require("@tarojs/components");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
require("../../styles/index.css");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
var _excluded = ["full", "row", "column", "wrap", "flex", "around", "between", "className", "justifyItems", "alignItems", "alignSelf", "gap", "rowGap", "columnGap", "flexShrink", "flexGrow", "flexBasis", "opacity", "hidden", "width", "height", "bgColor", "background", "style", "children", "margin", "mTop", "mBottom", "mLeft", "mRight", "mHorizontal", "mVertical", "padding", "pTop", "pBottom", "pLeft", "pRight", "pHorizontal", "pVertical", "safeArea", "hover", "skeleton", "position", "zIndex", "left", "right", "top", "bottom", "overflow", "radius", "border", "borderColor", "borderWidth", "borderStyle"];
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
|
+
/**
|
|
23
|
+
* 处理 px 转换
|
|
24
|
+
* @param val px|string|undefined
|
|
25
|
+
* @returns px|string|undefined
|
|
26
|
+
*/
|
|
27
|
+
var px = function px(val) {
|
|
28
|
+
if (val === undefined || val === null || val === '') return undefined;
|
|
29
|
+
return typeof val === 'number' || !isNaN(Number(val)) ? "".concat(val, "px") : String(val);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* taro weapp View Component (Tailwind 版)
|
|
34
|
+
* - full: 100% 100% 宽度、高度100%
|
|
35
|
+
* - flex: flex: 1 自动适应
|
|
36
|
+
* - row: flex-direction: row 主轴水平
|
|
37
|
+
* - column: flex-direction: column 主轴垂直
|
|
38
|
+
* - wrap: flex-wrap: wrap 换行
|
|
39
|
+
* - around: flex-direction: row justify-content: space-around 主轴平均分布
|
|
40
|
+
* - between: flex-direction: row justify-content: space-between 主轴两端对齐
|
|
41
|
+
* - justifyItems: justify-content 主轴对齐方式
|
|
42
|
+
* - alignItems: align-items 交叉轴对齐方式
|
|
43
|
+
* - alignSelf: align-self 自身对齐方式
|
|
44
|
+
* - gap: gap 间距
|
|
45
|
+
* - rowGap: row-gap 行间距
|
|
46
|
+
* - columnGap: column-gap 列间距
|
|
47
|
+
* - flexShrink: flex-shrink 剩余空间不足时
|
|
48
|
+
* - flexGrow: flex-grow 剩余空间
|
|
49
|
+
* - flexBasis: flex-basis 初始大小
|
|
50
|
+
* - opacity: opacity 透明度
|
|
51
|
+
* - hidden: hidden 隐藏
|
|
52
|
+
* - width: width 宽度
|
|
53
|
+
* - height: height 高度
|
|
54
|
+
* - bgColor: background-color 背景颜色
|
|
55
|
+
* - background: background 背景图片等复杂背景
|
|
56
|
+
* - safeArea: safe-area-inset 安全区域
|
|
57
|
+
* - hover: hover 悬停状态
|
|
58
|
+
* - skeleton: skeleton 骨架屏
|
|
59
|
+
* - position: position 定位
|
|
60
|
+
* - zIndex: z-index 层级
|
|
61
|
+
* - left: left 定位左侧
|
|
62
|
+
* - right: right 定位右侧
|
|
63
|
+
* - top: top 定位上侧
|
|
64
|
+
* - bottom: bottom 定位下侧
|
|
65
|
+
* - overflow: overflow 显示
|
|
66
|
+
* - overflowX: overflow-x 显示
|
|
67
|
+
* - overflowY: overflow-y 显示
|
|
68
|
+
* - radius: border-radius 圆角
|
|
69
|
+
* - border: boolean 边框
|
|
70
|
+
* - borderColor: border-color 边框颜色
|
|
71
|
+
* - borderWidth: border-width 边框宽度
|
|
72
|
+
* - borderStyle: border-style 边框样式
|
|
73
|
+
* - style: style 自定义样式
|
|
74
|
+
* - children: children 子元素
|
|
75
|
+
* - margin: margin 外边距
|
|
76
|
+
* - mTop: margin-top 上外边距
|
|
77
|
+
* - mBottom: margin-bottom 下外边距
|
|
78
|
+
* - mLeft: margin-left 左外边距
|
|
79
|
+
* - mRight: margin-right 右外边距
|
|
80
|
+
* - mHorizontal: margin-horizontal 水平外边距
|
|
81
|
+
* - mVertical: margin-vertical 垂直外边距
|
|
82
|
+
* - padding: padding 内边距
|
|
83
|
+
* - pTop: padding-top 上内边距
|
|
84
|
+
* - pBottom: padding-bottom 下内边距
|
|
85
|
+
* - pLeft: padding-left 左内边距
|
|
86
|
+
* - pRight: padding-right 右内边距
|
|
87
|
+
* - pHorizontal: padding-horizontal 水平内边距
|
|
88
|
+
* - pVertical: padding-vertical 垂直内边距
|
|
89
|
+
* - rest: View组件其他属性
|
|
90
|
+
*/
|
|
91
|
+
var View = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
92
|
+
var full = props.full,
|
|
93
|
+
row = props.row,
|
|
94
|
+
column = props.column,
|
|
95
|
+
wrap = props.wrap,
|
|
96
|
+
flex = props.flex,
|
|
97
|
+
around = props.around,
|
|
98
|
+
between = props.between,
|
|
99
|
+
className = props.className,
|
|
100
|
+
justifyItems = props.justifyItems,
|
|
101
|
+
alignItems = props.alignItems,
|
|
102
|
+
alignSelf = props.alignSelf,
|
|
103
|
+
gap = props.gap,
|
|
104
|
+
rowGap = props.rowGap,
|
|
105
|
+
columnGap = props.columnGap,
|
|
106
|
+
flexShrink = props.flexShrink,
|
|
107
|
+
flexGrow = props.flexGrow,
|
|
108
|
+
flexBasis = props.flexBasis,
|
|
109
|
+
opacity = props.opacity,
|
|
110
|
+
hidden = props.hidden,
|
|
111
|
+
width = props.width,
|
|
112
|
+
height = props.height,
|
|
113
|
+
bgColor = props.bgColor,
|
|
114
|
+
background = props.background,
|
|
115
|
+
_props$style = props.style,
|
|
116
|
+
style = _props$style === void 0 ? {} : _props$style,
|
|
117
|
+
children = props.children,
|
|
118
|
+
margin = props.margin,
|
|
119
|
+
mTop = props.mTop,
|
|
120
|
+
mBottom = props.mBottom,
|
|
121
|
+
mLeft = props.mLeft,
|
|
122
|
+
mRight = props.mRight,
|
|
123
|
+
mHorizontal = props.mHorizontal,
|
|
124
|
+
mVertical = props.mVertical,
|
|
125
|
+
padding = props.padding,
|
|
126
|
+
pTop = props.pTop,
|
|
127
|
+
pBottom = props.pBottom,
|
|
128
|
+
pLeft = props.pLeft,
|
|
129
|
+
pRight = props.pRight,
|
|
130
|
+
pHorizontal = props.pHorizontal,
|
|
131
|
+
pVertical = props.pVertical,
|
|
132
|
+
safeArea = props.safeArea,
|
|
133
|
+
hover = props.hover,
|
|
134
|
+
skeleton = props.skeleton,
|
|
135
|
+
position = props.position,
|
|
136
|
+
zIndex = props.zIndex,
|
|
137
|
+
left = props.left,
|
|
138
|
+
right = props.right,
|
|
139
|
+
top = props.top,
|
|
140
|
+
bottom = props.bottom,
|
|
141
|
+
overflow = props.overflow,
|
|
142
|
+
radius = props.radius,
|
|
143
|
+
border = props.border,
|
|
144
|
+
borderColor = props.borderColor,
|
|
145
|
+
borderWidth = props.borderWidth,
|
|
146
|
+
borderStyle = props.borderStyle,
|
|
147
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
148
|
+
var viewClass = (0, _classnames.default)(className, {
|
|
149
|
+
'zero-flex': true,
|
|
150
|
+
'zero-flex-1': flex,
|
|
151
|
+
'zero-flex-col': column,
|
|
152
|
+
'zero-flex-row': row,
|
|
153
|
+
'zero-flex-wrap': wrap,
|
|
154
|
+
'zero-items-start': alignItems === 'flex-start',
|
|
155
|
+
'zero-items-end': alignItems === 'flex-end',
|
|
156
|
+
'zero-items-center': alignItems === 'center',
|
|
157
|
+
'zero-justify-start': justifyItems === 'flex-start',
|
|
158
|
+
'zero-justify-end': justifyItems === 'flex-end',
|
|
159
|
+
'zero-justify-center': justifyItems === 'center',
|
|
160
|
+
'zero-place-content-around': around === 'content-around',
|
|
161
|
+
'zero-justify-around': around === 'justify-around',
|
|
162
|
+
'zero-justify-between': between,
|
|
163
|
+
'zero-hidden': hidden,
|
|
164
|
+
'zero-animate-pulse zero-bg-gray-200': skeleton
|
|
165
|
+
});
|
|
166
|
+
var getSafeAreaPadding = function getSafeAreaPadding(type, safeAreaVal, userPadding) {
|
|
167
|
+
var isSafe = safeAreaVal === type || safeAreaVal === 'both';
|
|
168
|
+
if (!isSafe) return px(userPadding);
|
|
169
|
+
return userPadding ? "calc(env(safe-area-inset-".concat(type, ") + ").concat(px(userPadding), ")") : "env(safe-area-inset-".concat(type, ")");
|
|
170
|
+
};
|
|
171
|
+
var hasBorder = border || borderColor !== undefined || borderWidth !== undefined;
|
|
172
|
+
var customStyle = _objectSpread({
|
|
173
|
+
width: px(full ? '100%' : width),
|
|
174
|
+
height: px(full ? '100%' : height),
|
|
175
|
+
backgroundColor: bgColor,
|
|
176
|
+
background: background,
|
|
177
|
+
margin: px(margin),
|
|
178
|
+
marginTop: px(mTop !== null && mTop !== void 0 ? mTop : mVertical),
|
|
179
|
+
marginBottom: px(mBottom !== null && mBottom !== void 0 ? mBottom : mVertical),
|
|
180
|
+
marginLeft: px(mLeft !== null && mLeft !== void 0 ? mLeft : mHorizontal),
|
|
181
|
+
marginRight: px(mRight !== null && mRight !== void 0 ? mRight : mHorizontal),
|
|
182
|
+
padding: px(padding),
|
|
183
|
+
paddingTop: getSafeAreaPadding('top', safeArea, pTop !== null && pTop !== void 0 ? pTop : pVertical),
|
|
184
|
+
paddingBottom: getSafeAreaPadding('bottom', safeArea, pBottom !== null && pBottom !== void 0 ? pBottom : pVertical),
|
|
185
|
+
paddingLeft: px(pLeft !== null && pLeft !== void 0 ? pLeft : pHorizontal),
|
|
186
|
+
paddingRight: px(pRight !== null && pRight !== void 0 ? pRight : pHorizontal),
|
|
187
|
+
position: position,
|
|
188
|
+
zIndex: zIndex,
|
|
189
|
+
left: px(left),
|
|
190
|
+
right: px(right),
|
|
191
|
+
top: px(top),
|
|
192
|
+
bottom: px(bottom),
|
|
193
|
+
overflow: overflow,
|
|
194
|
+
borderRadius: px(radius),
|
|
195
|
+
borderWidth: hasBorder ? px(borderWidth !== null && borderWidth !== void 0 ? borderWidth : 1) : undefined,
|
|
196
|
+
borderStyle: hasBorder ? borderStyle !== null && borderStyle !== void 0 ? borderStyle : 'solid' : undefined,
|
|
197
|
+
borderColor: borderColor,
|
|
198
|
+
gap: px(gap),
|
|
199
|
+
rowGap: px(rowGap),
|
|
200
|
+
columnGap: px(columnGap),
|
|
201
|
+
alignSelf: alignSelf,
|
|
202
|
+
flexShrink: flexShrink,
|
|
203
|
+
flexGrow: flexGrow,
|
|
204
|
+
flexBasis: px(flexBasis),
|
|
205
|
+
opacity: opacity,
|
|
206
|
+
display: hidden ? 'none' : undefined,
|
|
207
|
+
color: skeleton ? 'transparent' : undefined
|
|
208
|
+
}, _typeof(style) === 'object' ? style : {});
|
|
209
|
+
var cleanStyle = {};
|
|
210
|
+
for (var key in customStyle) {
|
|
211
|
+
if (customStyle[key] !== undefined && customStyle[key] !== null) {
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
cleanStyle[key] = customStyle[key];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.View, _objectSpread(_objectSpread({
|
|
217
|
+
ref: ref,
|
|
218
|
+
className: viewClass,
|
|
219
|
+
style: cleanStyle,
|
|
220
|
+
hoverClass: hover ? 'zero:opacity-70' : 'none',
|
|
221
|
+
hoverStayTime: 200
|
|
222
|
+
}, rest), {}, {
|
|
223
|
+
children: children
|
|
224
|
+
}));
|
|
225
|
+
});
|
|
226
|
+
View.displayName = 'View';
|
|
227
|
+
var _default = exports.default = View;
|