@blocklet/launcher-workflow 1.5.68 → 1.5.69

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,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
+ var _lodash = _interopRequireDefault(require("lodash.get"));
13
+
12
14
  var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
13
15
 
14
16
  var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
@@ -33,6 +35,17 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
33
35
 
34
36
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
37
 
38
+ const translations = {
39
+ en: {
40
+ confirm: 'Confirm',
41
+ cancel: 'Cancel'
42
+ },
43
+ zh: {
44
+ confirm: '同意',
45
+ cancel: '取消'
46
+ }
47
+ };
48
+
36
49
  function ConfirmDialog(_ref) {
37
50
  let {
38
51
  title,
@@ -42,11 +55,14 @@ function ConfirmDialog(_ref) {
42
55
  color,
43
56
  params: initialParams,
44
57
  onCancel,
45
- onConfirm
58
+ onConfirm,
59
+ locale
46
60
  } = _ref;
47
61
  const {
48
- t
49
- } = (0, _react.useContext)(_locale.LocaleContext);
62
+ locale: innerLocale
63
+ } = (0, _react.useContext)(_locale.LocaleContext) || {
64
+ locale
65
+ };
50
66
  const [params, setParams] = (0, _react.useState)(initialParams);
51
67
  const theme = (0, _useTheme.default)();
52
68
  const isBreakpointsDownSm = (0, _useMediaQuery.default)(theme.breakpoints.down('sm'));
@@ -68,13 +84,13 @@ function ConfirmDialog(_ref) {
68
84
  onClick: () => onCallback(onCancel),
69
85
  color: "default",
70
86
  rounded: true
71
- }, cancel || t('common.cancel')), /*#__PURE__*/_react.default.createElement(_Button.default, {
87
+ }, cancel || (0, _lodash.default)(translations, "".concat(innerLocale, ".cancel"))), /*#__PURE__*/_react.default.createElement(_Button.default, {
72
88
  onClick: () => onCallback(onConfirm),
73
89
  color: color,
74
90
  variant: "outlined",
75
91
  autoFocus: true,
76
92
  rounded: true
77
- }, confirm || t('common.confirm'))));
93
+ }, confirm || (0, _lodash.default)(translations, "".concat(innerLocale, ".confirm")))));
78
94
  }
79
95
 
80
96
  ConfirmDialog.propTypes = {
@@ -87,12 +103,14 @@ ConfirmDialog.propTypes = {
87
103
  params: _propTypes.default.object,
88
104
  // This object holds states managed in the dialog
89
105
  onCancel: _propTypes.default.func,
90
- onConfirm: _propTypes.default.func.isRequired
106
+ onConfirm: _propTypes.default.func.isRequired,
107
+ locale: _propTypes.default.oneOf(['en', 'zh'])
91
108
  };
92
109
  ConfirmDialog.defaultProps = {
93
110
  onCancel: () => {},
94
111
  cancel: '',
95
112
  confirm: '',
96
113
  color: 'danger',
97
- params: {}
114
+ params: {},
115
+ locale: 'en'
98
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/launcher-workflow",
3
- "version": "1.5.68",
3
+ "version": "1.5.69",
4
4
  "description": "Purchase components for Launcher UI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -41,8 +41,8 @@
41
41
  "@arcblock/icons": "^1.16.49",
42
42
  "@arcblock/license": "^1.16.49",
43
43
  "@arcblock/ux": "^1.16.49",
44
- "@blocklet/launcher-constant": "1.5.68",
45
- "@blocklet/launcher-layout": "1.5.68",
44
+ "@blocklet/launcher-constant": "1.5.69",
45
+ "@blocklet/launcher-layout": "1.5.69",
46
46
  "@material-ui/core": "^4.12.3",
47
47
  "@material-ui/icons": "^4.11.2",
48
48
  "@material-ui/lab": "^4.0.0-alpha.60",
@@ -69,5 +69,5 @@
69
69
  "babel-plugin-inline-react-svg": "^2.0.1",
70
70
  "babel-plugin-styled-components": "^1.10.7"
71
71
  },
72
- "gitHead": "70a65ca42b47efb86e93b8495ce6db35d4360cff"
72
+ "gitHead": "f61a739613c0d36042a6cbb0c06b77b817147ca7"
73
73
  }