@arcblock/ux 1.15.20 → 1.15.25

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.
@@ -9,9 +9,20 @@ var _styles = require("@material-ui/core/styles");
9
9
 
10
10
  var _responsiveFontSizes = _interopRequireDefault(require("./responsiveFontSizes"));
11
11
 
12
+ const _excluded = ["mode", "pageWidth", "palette", "typography", "overrides"];
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
14
- // https://app.zeplin.io/styleguide/5d1436f1e97c2156f49c0725/colors
16
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
+
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
+
20
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
+
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
+
24
+ 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; }
25
+
15
26
  const colors = {
16
27
  white: '#FFFFFF',
17
28
  dark: '#4A707C',
@@ -36,14 +47,17 @@ const colors = {
36
47
  exports.colors = colors;
37
48
 
38
49
  const create = function create() {
39
- let {
50
+ let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
51
+ {
40
52
  mode = 'light',
41
53
  pageWidth = 'md',
42
54
  palette,
43
55
  typography,
44
56
  overrides
45
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
46
- const theme = (0, _styles.createTheme)({
57
+ } = _ref,
58
+ rest = _objectWithoutProperties(_ref, _excluded);
59
+
60
+ const theme = (0, _styles.createTheme)(_objectSpread({
47
61
  themeName: 'ArcBlock',
48
62
  palette: Object.assign({
49
63
  primary: {
@@ -141,7 +155,7 @@ const create = function create() {
141
155
  pageWidth,
142
156
  colors,
143
157
  mode
144
- });
158
+ }, rest));
145
159
  const enhanced = (0, _responsiveFontSizes.default)(theme, {
146
160
  breakpoints: ['xs', 'sm', 'md', 'lg'],
147
161
  disableAlign: false,
package/lib/Util/index.js CHANGED
@@ -11,6 +11,7 @@ exports.setDateTool = setDateTool;
11
11
  exports.getDateTool = getDateTool;
12
12
  exports.formatToDate = formatToDate;
13
13
  exports.formatToDatetime = formatToDatetime;
14
+ exports.openWebWallet = openWebWallet;
14
15
  exports.formatUptime = exports.str2color = exports.getTimezone = exports.getBackground = exports.getColor = void 0;
15
16
 
16
17
  var _padStart = _interopRequireDefault(require("lodash/padStart"));
@@ -31,6 +32,13 @@ function parseQuery(str) {
31
32
  return memo;
32
33
  }, {});
33
34
  }
35
+ /**
36
+ * @param {number} opts.expireInDays
37
+ * @param {string} opts.path
38
+ * @param {domain} opts.domain
39
+ * @param {boolean} opts.returnDomain if === false, opts.domain will be skipped
40
+ */
41
+
34
42
 
35
43
  function getCookieOptions() {
36
44
  let expireInDays = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
@@ -56,7 +64,11 @@ function getCookieOptions() {
56
64
  domain: opts.domain || ''
57
65
  };
58
66
 
59
- if (typeof window === 'undefined' || opts.domain) {
67
+ if (typeof window === 'undefined' || opts.domain || opts.returnDomain === false) {
68
+ if (opts.returnDomain === false) {
69
+ delete options.domain;
70
+ }
71
+
60
72
  return options;
61
73
  }
62
74
 
@@ -266,4 +278,46 @@ function formatToDatetime(date) {
266
278
  locale,
267
279
  tz
268
280
  });
281
+ }
282
+
283
+ function openWebWallet(_ref3) {
284
+ let {
285
+ webWalletUrl,
286
+ action = 'login',
287
+ locale = 'en',
288
+ url,
289
+ windowFeatures
290
+ } = _ref3;
291
+ const defaultWindowFeatures = {
292
+ toolbar: 'no',
293
+ location: 'no',
294
+ status: 'no',
295
+ menubar: 'no',
296
+ scrollbars: 'yes',
297
+ resizable: 'yes',
298
+ // iphone 8plus size
299
+ width: 414,
300
+ height: 736
301
+ };
302
+ const windowUrl = "".concat(webWalletUrl, "?action=").concat(action, "&locale=").concat(locale, "&url=").concat(encodeURIComponent(url));
303
+ const mergedWindowFeatures = Object.assign({}, defaultWindowFeatures, windowFeatures);
304
+
305
+ const getWindowWidth = win => {
306
+ return win.innerWidth || win.document.documentElement.clientWidth || win.document.body.clientWidth;
307
+ }; // 默认在浏览器右上角弹出窗口
308
+
309
+
310
+ if (!('left' in mergedWindowFeatures)) {
311
+ const winWidth = getWindowWidth(window.top || window);
312
+ const winLeft = window.screenLeft || window.screenX;
313
+ mergedWindowFeatures.left = winWidth + winLeft - mergedWindowFeatures.width;
314
+ }
315
+
316
+ if (!('top' in mergedWindowFeatures)) {
317
+ const winTop = window.screenTop || window.screenY;
318
+ mergedWindowFeatures.top = winTop;
319
+ }
320
+
321
+ const strWindowFeatures = Object.keys(mergedWindowFeatures).map(key => "".concat(key, "=").concat(mergedWindowFeatures[key])).join(',');
322
+ window.open(windowUrl, 'targetWindow', strWindowFeatures);
269
323
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "1.15.20",
3
+ "version": "1.15.25",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -52,10 +52,10 @@
52
52
  "react": ">=16.12.0",
53
53
  "react-ga": "^2.7.0"
54
54
  },
55
- "gitHead": "0c4c81779f27921b7cd0c3621482050aedfd594c",
55
+ "gitHead": "2ed5c5f32f4d1065109e18a3ccfc04a559595835",
56
56
  "dependencies": {
57
- "@arcblock/icons": "^1.15.20",
58
- "@arcblock/react-hooks": "^1.15.20",
57
+ "@arcblock/icons": "^1.15.25",
58
+ "@arcblock/react-hooks": "^1.15.25",
59
59
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
60
60
  "@material-ui/core": "^4.12.3",
61
61
  "@material-ui/icons": "4.11.2",