@ebscn/ui 1.0.3-beta.10 → 1.0.3-beta.12

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 (51) hide show
  1. package/cjs/components/date-range-picker/date-range-picker.js +2 -1
  2. package/cjs/components/icons/down-icon.d.ts +4 -0
  3. package/cjs/components/icons/down-icon.js +26 -0
  4. package/cjs/components/icons/dustbin-icon.d.ts +4 -0
  5. package/cjs/components/icons/dustbin-icon.js +26 -0
  6. package/cjs/components/icons/index.d.ts +3 -0
  7. package/cjs/components/icons/index.js +21 -0
  8. package/cjs/components/icons/notice-icon.js +3 -4
  9. package/cjs/components/icons/up-icon.d.ts +4 -0
  10. package/cjs/components/icons/up-icon.js +26 -0
  11. package/cjs/components/icons/warning-icon.js +2 -1
  12. package/cjs/components/infinite-scroll/infinite-scroll.css +5 -1
  13. package/cjs/components/infinite-scroll/infinite-scroll.d.ts +3 -1
  14. package/cjs/components/infinite-scroll/infinite-scroll.js +16 -11
  15. package/cjs/components/stock-keyboard/stock-keyboard.css +7 -4
  16. package/cjs/components/toast/index.d.ts +9 -0
  17. package/cjs/components/toast/index.js +14 -0
  18. package/cjs/components/toast/methods.d.ts +8 -0
  19. package/cjs/components/toast/methods.js +72 -0
  20. package/cjs/components/toast/toast.css +45 -0
  21. package/cjs/components/toast/toast.d.ts +18 -0
  22. package/cjs/components/toast/toast.js +85 -0
  23. package/cjs/components/toast/toast.patch.css +11 -0
  24. package/cjs/index.d.ts +1 -0
  25. package/cjs/index.js +9 -1
  26. package/es/components/date-range-picker/date-range-picker.js +2 -1
  27. package/es/components/icons/down-icon.d.ts +4 -0
  28. package/es/components/icons/down-icon.js +18 -0
  29. package/es/components/icons/dustbin-icon.d.ts +4 -0
  30. package/es/components/icons/dustbin-icon.js +18 -0
  31. package/es/components/icons/index.d.ts +3 -0
  32. package/es/components/icons/index.js +3 -0
  33. package/es/components/icons/notice-icon.js +3 -4
  34. package/es/components/icons/up-icon.d.ts +4 -0
  35. package/es/components/icons/up-icon.js +18 -0
  36. package/es/components/icons/warning-icon.js +2 -1
  37. package/es/components/infinite-scroll/infinite-scroll.css +5 -1
  38. package/es/components/infinite-scroll/infinite-scroll.d.ts +3 -1
  39. package/es/components/infinite-scroll/infinite-scroll.js +16 -11
  40. package/es/components/stock-keyboard/stock-keyboard.css +7 -4
  41. package/es/components/toast/index.d.ts +9 -0
  42. package/es/components/toast/index.js +8 -0
  43. package/es/components/toast/methods.d.ts +8 -0
  44. package/es/components/toast/methods.js +63 -0
  45. package/es/components/toast/toast.css +45 -0
  46. package/es/components/toast/toast.d.ts +18 -0
  47. package/es/components/toast/toast.js +75 -0
  48. package/es/components/toast/toast.patch.css +11 -0
  49. package/es/index.d.ts +1 -0
  50. package/es/index.js +1 -0
  51. package/package.json +1 -1
@@ -261,10 +261,11 @@ var DateRangePicker = exports.DateRangePicker = (0, _react.memo)((0, _react.forw
261
261
  "aria-disabled": props.loading
262
262
  }, props.confirmText)), props.quickButtons.length ? _react.default.createElement("div", {
263
263
  className: "".concat(classPrefix, "-buttons-wrap")
264
- }, props.quickButtons.map(function (_a) {
264
+ }, props.quickButtons.map(function (_a, index) {
265
265
  var label = _a.label,
266
266
  value = _a.value;
267
267
  return _react.default.createElement("div", {
268
+ key: index,
268
269
  onClick: function () {
269
270
  return onQuickClick(value);
270
271
  },
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ declare const DownIcon: React.NamedExoticComponent<NativeProps>;
4
+ export default DownIcon;
@@ -0,0 +1,26 @@
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 _nativeProps = require("../../utils/native-props");
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ 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; }
11
+ var DownIcon = (0, _react.memo)(function (props) {
12
+ return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("svg", {
13
+ className: "ebscn-ui-icon",
14
+ viewBox: "0 0 1024 1024",
15
+ version: "1.1",
16
+ xmlns: "http://www.w3.org/2000/svg",
17
+ "p-id": "3136",
18
+ width: "1em",
19
+ height: "1em",
20
+ fill: "currentColor"
21
+ }, _react.default.createElement("path", {
22
+ d: "M121.392 358.656a32 32 0 1 1 45.216-45.312l335.136 334.4c6.096 6.08 15.968 6.064 22.064-0.032l333.536-334.32a32 32 0 1 1 45.312 45.216L569.104 692.912a79.6 79.6 0 0 1-112.56 0.128l-335.152-334.4z",
23
+ "p-id": "3137"
24
+ })));
25
+ });
26
+ var _default = exports.default = DownIcon;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ declare const DustbinIcon: React.NamedExoticComponent<NativeProps>;
4
+ export default DustbinIcon;
@@ -0,0 +1,26 @@
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 _nativeProps = require("../../utils/native-props");
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ 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; }
11
+ var DustbinIcon = (0, _react.memo)(function (props) {
12
+ return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("svg", {
13
+ className: "ebscn-ui-icon",
14
+ viewBox: "0 0 1024 1024",
15
+ version: "1.1",
16
+ xmlns: "http://www.w3.org/2000/svg",
17
+ "p-id": "3293",
18
+ width: "1em",
19
+ height: "1em",
20
+ fill: "currentColor"
21
+ }, _react.default.createElement("path", {
22
+ d: "M544 64a48 48 0 0 1 48 48v16h304a32 32 0 1 1 0 64H256v656a32 32 0 0 0 32 32h448a32 32 0 0 0 32-32V285.488a32 32 0 1 1 64 0V848a96 96 0 0 1-96 96H288a96 96 0 0 1-96-96V192H128a32 32 0 1 1 0-64h336V112a48 48 0 0 1 48-48h32z m-128 208a32 32 0 0 1 32 32v464a32 32 0 1 1-64 0V304a32 32 0 0 1 32-32z m192 0a32 32 0 0 1 32 32v464a32 32 0 1 1-64 0V304a32 32 0 0 1 32-32z",
23
+ "p-id": "3294"
24
+ })));
25
+ });
26
+ var _default = exports.default = DustbinIcon;
@@ -3,6 +3,8 @@ export { default as CheckIcon } from './check-icon';
3
3
  export { default as CheckOnlyIcon } from './check-only-icon';
4
4
  export { default as ClearIcon } from './clear-icon';
5
5
  export { default as CloseIcon } from './close-icon';
6
+ export { default as DownIcon } from './down-icon';
7
+ export { default as DustbinIcon } from './dustbin-icon';
6
8
  export { default as GdlogoIcon } from './gdlogo-icon';
7
9
  export { default as IndeterminateIcon } from './indeterminate-icon';
8
10
  export { default as LoadingIcon } from './loading-icon';
@@ -12,4 +14,5 @@ export { default as SearchIcon } from './search-icon';
12
14
  export { default as SelectorIcon } from './selector-icon';
13
15
  export { default as SpinIcon } from './spin-icon';
14
16
  export { default as UncheckIcon } from './uncheck-icon';
17
+ export { default as UpIcon } from './up-icon';
15
18
  export { default as WarningIcon } from './warning-icon';
@@ -33,6 +33,18 @@ Object.defineProperty(exports, "CloseIcon", {
33
33
  return _closeIcon.default;
34
34
  }
35
35
  });
36
+ Object.defineProperty(exports, "DownIcon", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _downIcon.default;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "DustbinIcon", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _dustbinIcon.default;
46
+ }
47
+ });
36
48
  Object.defineProperty(exports, "GdlogoIcon", {
37
49
  enumerable: true,
38
50
  get: function () {
@@ -87,6 +99,12 @@ Object.defineProperty(exports, "UncheckIcon", {
87
99
  return _uncheckIcon.default;
88
100
  }
89
101
  });
102
+ Object.defineProperty(exports, "UpIcon", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _upIcon.default;
106
+ }
107
+ });
90
108
  Object.defineProperty(exports, "WarningIcon", {
91
109
  enumerable: true,
92
110
  get: function () {
@@ -98,6 +116,8 @@ var _checkIcon = _interopRequireDefault(require("./check-icon"));
98
116
  var _checkOnlyIcon = _interopRequireDefault(require("./check-only-icon"));
99
117
  var _clearIcon = _interopRequireDefault(require("./clear-icon"));
100
118
  var _closeIcon = _interopRequireDefault(require("./close-icon"));
119
+ var _downIcon = _interopRequireDefault(require("./down-icon"));
120
+ var _dustbinIcon = _interopRequireDefault(require("./dustbin-icon"));
101
121
  var _gdlogoIcon = _interopRequireDefault(require("./gdlogo-icon"));
102
122
  var _indeterminateIcon = _interopRequireDefault(require("./indeterminate-icon"));
103
123
  var _loadingIcon = _interopRequireDefault(require("./loading-icon"));
@@ -107,5 +127,6 @@ var _searchIcon = _interopRequireDefault(require("./search-icon"));
107
127
  var _selectorIcon = _interopRequireDefault(require("./selector-icon"));
108
128
  var _spinIcon = _interopRequireDefault(require("./spin-icon"));
109
129
  var _uncheckIcon = _interopRequireDefault(require("./uncheck-icon"));
130
+ var _upIcon = _interopRequireDefault(require("./up-icon"));
110
131
  var _warningIcon = _interopRequireDefault(require("./warning-icon"));
111
132
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -16,15 +16,14 @@ var NoticeIcon = (0, _react.memo)(function (props) {
16
16
  xmlns: "http://www.w3.org/2000/svg",
17
17
  "p-id": "8375",
18
18
  width: "1em",
19
- height: "1em",
20
- fill: "currentColor"
19
+ height: "1em"
21
20
  }, _react.default.createElement("path", {
22
21
  d: "M614.4 268.8a32 32 0 0 1 44.8-6.4C752.128 332.096 800 415.872 800 512c0 96.128-47.872 179.904-140.8 249.6a32 32 0 1 1-38.4-51.2C698.528 652.096 736 586.528 736 512s-37.472-140.096-115.2-198.4a32 32 0 0 1-6.4-44.8zM370.368 108.352A96 96 0 0 1 544 164.8v694.368a96 96 0 0 1-173.632 56.48L249.28 749.168A32 32 0 0 0 223.408 736H176a112 112 0 0 1-112-112V400a112 112 0 0 1 112-112h47.408a32 32 0 0 0 25.888-13.184l121.072-166.464z m96.448 30.576a32 32 0 0 0-44.688 7.056L301.056 312.48A96 96 0 0 1 223.408 352H176a48 48 0 0 0-48 48v224a48 48 0 0 0 48 48h47.408a96 96 0 0 1 77.648 39.536l121.072 166.48A32 32 0 0 0 480 859.184V164.816a32 32 0 0 0-13.184-25.888z",
23
- fill: "#333333",
22
+ fill: "currentColor",
24
23
  "p-id": "8376"
25
24
  }), _react.default.createElement("path", {
26
25
  d: "M745.376 137.376a32 32 0 0 1 45.248 0C903.04 249.792 960 375.088 960 512c0 136.912-56.96 262.208-169.376 374.624a32 32 0 0 1-45.248-45.248C846.288 740.448 896 631.088 896 512c0-119.088-49.712-228.448-150.624-329.376a32 32 0 0 1 0-45.248z",
27
- fill: "#333333",
26
+ fill: "currentColor",
28
27
  "p-id": "8377"
29
28
  })));
30
29
  });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ declare const UpIcon: React.NamedExoticComponent<NativeProps>;
4
+ export default UpIcon;
@@ -0,0 +1,26 @@
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 _nativeProps = require("../../utils/native-props");
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ 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; }
11
+ var UpIcon = (0, _react.memo)(function (props) {
12
+ return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("svg", {
13
+ className: "ebscn-ui-icon",
14
+ viewBox: "0 0 1024 1024",
15
+ version: "1.1",
16
+ xmlns: "http://www.w3.org/2000/svg",
17
+ "p-id": "3450",
18
+ width: "1em",
19
+ height: "1em",
20
+ fill: "currentColor"
21
+ }, _react.default.createElement("path", {
22
+ d: "M902.608 665.344a32 32 0 1 1-45.216 45.312l-335.136-334.4a15.6 15.6 0 0 0-22.064 0.032L166.656 710.608a32 32 0 1 1-45.312-45.216l333.552-334.304a79.6 79.6 0 0 1 112.56-0.128l335.152 334.4z",
23
+ "p-id": "3451"
24
+ })));
25
+ });
26
+ var _default = exports.default = UpIcon;
@@ -16,7 +16,8 @@ var WarningIcon = (0, _react.memo)(function (props) {
16
16
  xmlns: "http://www.w3.org/2000/svg",
17
17
  "p-id": "2315",
18
18
  width: "1em",
19
- height: "1em"
19
+ height: "1em",
20
+ fill: 'currentColor'
20
21
  }, _react.default.createElement("path", {
21
22
  d: "M512 64c247.424 0 448 200.576 448 448S759.424 960 512 960 64 759.424 64 512 264.576 64 512 64z m0 640a48 48 0 1 0 0 96 48 48 0 0 0 0-96z m0-480a40 40 0 0 0-40 40v336a40 40 0 1 0 80 0v-336A40 40 0 0 0 512 224z",
22
23
  "p-id": "2316"
@@ -5,9 +5,10 @@
5
5
  display: flex;
6
6
  justify-content: center;
7
7
  align-items: center;
8
- font-size: var(--ebscn-font-size-main);
8
+ font-size: var(--ebscn-font-size-5);
9
9
  }
10
10
  .ebscn-infinite-scroll-failed-text {
11
+ color: var(--ebscn-color-text);
11
12
  display: inline-block;
12
13
  margin-right: 8px;
13
14
  }
@@ -21,3 +22,6 @@
21
22
  width: 18px;
22
23
  height: 18px;
23
24
  }
25
+ .ebscn-infinite-scroll-nodata-text {
26
+ color: var(--ebscn-color-weak);
27
+ }
@@ -4,6 +4,8 @@ export type InfiniteScrollProps = {
4
4
  loadMore: (isRetry: boolean) => Promise<void>;
5
5
  hasMore: boolean;
6
6
  threshold?: number;
7
- children?: ReactNode | ((hasMore: boolean, failed: boolean, retry: () => void) => ReactNode);
7
+ NoMoreContent?: ReactNode;
8
+ FailContent?: ReactNode;
9
+ children?: ReactNode | ((hasMore: boolean, failed: boolean, retry: () => void, NoMoreContent?: ReactNode, FailContent?: ReactNode) => ReactNode);
8
10
  } & NativeProps;
9
11
  export declare const InfiniteScroll: FC<InfiniteScrollProps>;
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.InfiniteScroll = void 0;
7
- var _withDefaultProps = require("../../utils/with-default-props");
8
- var _react = _interopRequireWildcard(require("react"));
9
7
  var _ahooks = require("ahooks");
10
- var _nativeProps = require("../../utils/native-props");
11
- var _getScrollParent = require("../../utils/get-scroll-parent");
8
+ var _react = _interopRequireWildcard(require("react"));
12
9
  var _loading = _interopRequireDefault(require("../../assets/images/loading.gif"));
10
+ var _getScrollParent = require("../../utils/get-scroll-parent");
11
+ var _nativeProps = require("../../utils/native-props");
12
+ var _withDefaultProps = require("../../utils/with-default-props");
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
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; }
@@ -134,11 +134,13 @@ function isWindow(element) {
134
134
  var classPrefix = "ebscn-infinite-scroll";
135
135
  var defaultProps = {
136
136
  threshold: 250,
137
- children: function (hasMore, failed, retry) {
137
+ children: function (hasMore, failed, retry, NoMoreContent, FailContent) {
138
138
  return _react.default.createElement(InfiniteScrollContent, {
139
139
  hasMore: hasMore,
140
140
  failed: failed,
141
- retry: retry
141
+ retry: retry,
142
+ NoMoreContent: NoMoreContent,
143
+ FailContent: FailContent
142
144
  });
143
145
  }
144
146
  };
@@ -250,17 +252,20 @@ var InfiniteScroll = function (p) {
250
252
  };
251
253
  exports.InfiniteScroll = InfiniteScroll;
252
254
  var InfiniteScrollContent = function (props) {
255
+ var _a, _b;
253
256
  if (!props.hasMore) {
254
- return _react.default.createElement("span", null, '没有更多了');
257
+ return (_a = props.NoMoreContent) !== null && _a !== void 0 ? _a : _react.default.createElement("span", {
258
+ className: "".concat(classPrefix, "-nodata-text")
259
+ }, "\u6211\u662F\u6709\u5E95\u7EBF\u7684");
255
260
  }
256
261
  if (props.failed) {
257
- return _react.default.createElement("span", null, _react.default.createElement("span", {
258
- className: "".concat(classPrefix, "-failed-text")
259
- }, "加载失败"), _react.default.createElement("a", {
262
+ return (_b = props.FailContent) !== null && _b !== void 0 ? _b : _react.default.createElement("span", {
260
263
  onClick: function () {
261
264
  props.retry();
262
265
  }
263
- }, "重新加载"));
266
+ }, _react.default.createElement("span", {
267
+ className: "".concat(classPrefix, "-failed-text")
268
+ }, '加载失败,请重试'));
264
269
  }
265
270
  return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
266
271
  className: "".concat(classPrefix, "-loading-wrap")
@@ -10,12 +10,14 @@ html[data-prefers-color-scheme='dark'] .ebscn-stock-keyboard-bottom .ebscn-stock
10
10
  flex-direction: row;
11
11
  z-index: 999;
12
12
  width: 100%;
13
- height: 267px;
13
+ height: 248px;
14
14
  transition: all 0.5s;
15
15
  align-content: flex-start;
16
+ background-color: #fff;
17
+ background-color: var(--ebscn-color-keyboard-bg);
16
18
  }
17
19
  .ebscn-stock-keyboard-top {
18
- padding: 11px 19px;
20
+ padding: 11px 19px 0 11px;
19
21
  background-color: #fff;
20
22
  background-color: var(--ebscn-color-background);
21
23
  display: flex;
@@ -27,6 +29,7 @@ html[data-prefers-color-scheme='dark'] .ebscn-stock-keyboard-bottom .ebscn-stock
27
29
  margin-right: 24px;
28
30
  color: #666;
29
31
  color: var(--ebscn-color-text-secondary);
32
+ line-height: 21px;
30
33
  }
31
34
  .ebscn-stock-keyboard-top-item-active {
32
35
  color: #e84225;
@@ -141,7 +144,7 @@ html[data-prefers-color-scheme='dark'] .ebscn-stock-keyboard-bottom .ebscn-stock
141
144
  }
142
145
  @supports (bottom: env(safe-area-inset-bottom)) or (constant(safe-area-inset-bottom)) {
143
146
  .ebscn-stock-keyboard {
144
- height: calc(267px + env(safe-area-inset-bottom));
145
- height: calc(267px + constant(safe-area-inset-bottom));
147
+ height: calc(248px + env(safe-area-inset-bottom));
148
+ height: calc(248px + constant(safe-area-inset-bottom));
146
149
  }
147
150
  }
@@ -0,0 +1,9 @@
1
+ import './toast.less';
2
+ import { clear, show, config } from './methods';
3
+ export type { ToastShowProps, ToastHandler } from './methods';
4
+ declare const Toast: {
5
+ show: typeof show;
6
+ clear: typeof clear;
7
+ config: typeof config;
8
+ };
9
+ export default Toast;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("./toast.css");
8
+ var _methods = require("./methods");
9
+ var Toast = {
10
+ show: _methods.show,
11
+ clear: _methods.clear,
12
+ config: _methods.config
13
+ };
14
+ var _default = exports.default = Toast;
@@ -0,0 +1,8 @@
1
+ import { ToastProps } from './toast';
2
+ export type ToastShowProps = Omit<ToastProps, 'visible'>;
3
+ export type ToastHandler = {
4
+ close: () => void;
5
+ };
6
+ export declare function show(p: ToastShowProps | string): ToastHandler;
7
+ export declare function clear(): void;
8
+ export declare function config(val: Pick<ToastProps, 'duration' | 'position' | 'maskClickable'>): void;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clear = clear;
7
+ exports.config = config;
8
+ exports.show = show;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _toast = require("./toast");
11
+ var _withDefaultProps = require("../../utils/with-default-props");
12
+ var _renderImperatively = require("../../utils/render-imperatively");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ var __assign = void 0 && (void 0).__assign || function () {
15
+ __assign = Object.assign || function (t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
19
+ }
20
+ return t;
21
+ };
22
+ return __assign.apply(this, arguments);
23
+ };
24
+ var currentHandler = null;
25
+ var currentTimeout = null;
26
+ var defaultProps = {
27
+ duration: 2000,
28
+ position: 'center',
29
+ maskClickable: true
30
+ };
31
+ var ToastInner = function (props) {
32
+ return _react.default.createElement(_toast.InternalToast, __assign({}, props));
33
+ };
34
+ function show(p) {
35
+ var props = (0, _withDefaultProps.mergeProps)(defaultProps, typeof p === 'string' ? {
36
+ content: p
37
+ } : p);
38
+ var element = _react.default.createElement(ToastInner, __assign({}, props, {
39
+ onClose: function () {
40
+ currentHandler = null;
41
+ }
42
+ }));
43
+ if (currentHandler) {
44
+ currentHandler.replace(element);
45
+ } else {
46
+ currentHandler = (0, _renderImperatively.renderImperatively)(element);
47
+ }
48
+ if (currentTimeout) {
49
+ window.clearTimeout(currentTimeout);
50
+ }
51
+ if (props.duration !== 0) {
52
+ currentTimeout = window.setTimeout(function () {
53
+ clear();
54
+ }, props.duration);
55
+ }
56
+ return currentHandler;
57
+ }
58
+ function clear() {
59
+ currentHandler === null || currentHandler === void 0 ? void 0 : currentHandler.close();
60
+ currentHandler = null;
61
+ }
62
+ function config(val) {
63
+ if (val.duration !== undefined) {
64
+ defaultProps.duration = val.duration;
65
+ }
66
+ if (val.position !== undefined) {
67
+ defaultProps.position = val.position;
68
+ }
69
+ if (val.maskClickable !== undefined) {
70
+ defaultProps.maskClickable = val.maskClickable;
71
+ }
72
+ }
@@ -0,0 +1,45 @@
1
+ .ebscn-toast-mask .ebscn-toast-wrap {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ text-align: center;
8
+ }
9
+ .ebscn-toast-mask .ebscn-toast-main {
10
+ display: inline-block;
11
+ position: relative;
12
+ top: 50%;
13
+ transform: translateY(-50%);
14
+ width: auto;
15
+ max-width: 204px;
16
+ max-height: 70%;
17
+ overflow: auto;
18
+ color: white;
19
+ word-break: break-all;
20
+ background-color: rgba(0, 0, 0, 0.7);
21
+ border-radius: 8px;
22
+ pointer-events: all;
23
+ font-size: var(--ebscn-font-size-7);
24
+ line-height: 1.5;
25
+ box-sizing: border-box;
26
+ text-align: initial;
27
+ }
28
+ .ebscn-toast-mask .ebscn-toast-main-text {
29
+ padding: 12px;
30
+ min-width: 0px;
31
+ }
32
+ .ebscn-toast-mask .ebscn-toast-main-icon {
33
+ padding: 35px 12px;
34
+ min-width: 150px;
35
+ }
36
+ .ebscn-toast-mask .ebscn-toast-main-icon .ebscn-toast-icon {
37
+ text-align: center;
38
+ margin-bottom: 8px;
39
+ font-size: 36px;
40
+ line-height: 1;
41
+ }
42
+ .ebscn-toast-loading {
43
+ --size: 48px;
44
+ margin: 0 auto 8px;
45
+ }
@@ -0,0 +1,18 @@
1
+ import type { FC, ReactNode } from 'react';
2
+ import type { MaskProps } from '../mask';
3
+ import { PropagationEvent } from '../../utils/with-stop-propagation';
4
+ import { GetContainer } from '../../utils/render-to-container';
5
+ export interface ToastProps {
6
+ afterClose?: () => void;
7
+ maskStyle?: MaskProps['style'];
8
+ maskClassName?: string;
9
+ maskClickable?: boolean;
10
+ content?: ReactNode;
11
+ icon?: 'success' | 'fail' | ReactNode;
12
+ duration?: number;
13
+ position?: 'top' | 'bottom' | 'center';
14
+ visible?: boolean;
15
+ getContainer?: GetContainer;
16
+ stopPropagation?: PropagationEvent[];
17
+ }
18
+ export declare const InternalToast: FC<ToastProps>;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.InternalToast = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _icons = require("../icons");
10
+ var _mask = _interopRequireDefault(require("../mask"));
11
+ var _withDefaultProps = require("../../utils/with-default-props");
12
+ var _autoCenter = _interopRequireDefault(require("../auto-center"));
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 (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
+ var __assign = void 0 && (void 0).__assign || function () {
17
+ __assign = Object.assign || function (t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var classPrefix = "ebscn-toast";
27
+ var defaultProps = {
28
+ maskClickable: true,
29
+ stopPropagation: ['click']
30
+ };
31
+ var InternalToast = function (p) {
32
+ var props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
33
+ var maskClickable = props.maskClickable,
34
+ content = props.content,
35
+ icon = props.icon,
36
+ position = props.position;
37
+ var iconElement = (0, _react.useMemo)(function () {
38
+ if (icon === null || icon === undefined) return null;
39
+ switch (icon) {
40
+ case 'success':
41
+ return _react.default.createElement(_icons.CheckOnlyIcon, {
42
+ className: "".concat(classPrefix, "-icon-success")
43
+ });
44
+ case 'fail':
45
+ return _react.default.createElement(_icons.CloseIcon, {
46
+ className: "".concat(classPrefix, "-icon-fail")
47
+ });
48
+ default:
49
+ return icon;
50
+ }
51
+ }, [icon]);
52
+ var top = (0, _react.useMemo)(function () {
53
+ switch (position) {
54
+ case 'top':
55
+ return '20%';
56
+ case 'bottom':
57
+ return '80%';
58
+ default:
59
+ return '50%';
60
+ }
61
+ }, [position]);
62
+ return _react.default.createElement(_mask.default, {
63
+ visible: props.visible,
64
+ destroyOnClose: true,
65
+ opacity: 0,
66
+ disableBodyScroll: !maskClickable,
67
+ getContainer: props.getContainer,
68
+ afterClose: props.afterClose,
69
+ style: __assign({
70
+ pointerEvents: maskClickable ? 'none' : 'auto'
71
+ }, props.maskStyle),
72
+ className: (0, _classnames.default)("".concat(classPrefix, "-mask"), props.maskClassName),
73
+ stopPropagation: props.stopPropagation
74
+ }, _react.default.createElement("div", {
75
+ className: (0, _classnames.default)("".concat(classPrefix, "-wrap"))
76
+ }, _react.default.createElement("div", {
77
+ style: {
78
+ top: top
79
+ },
80
+ className: (0, _classnames.default)("".concat(classPrefix, "-main"), icon ? "".concat(classPrefix, "-main-icon") : "".concat(classPrefix, "-main-text"))
81
+ }, iconElement && _react.default.createElement("div", {
82
+ className: "".concat(classPrefix, "-icon")
83
+ }, iconElement), _react.default.createElement(_autoCenter.default, null, content))));
84
+ };
85
+ exports.InternalToast = InternalToast;
@@ -0,0 +1,11 @@
1
+ .ebscn-toast-mask .ebscn-toast-main {
2
+ font-size: 15px;
3
+ }
4
+ .ebscn-toast-loading.ebscn-toast-loading {
5
+ width: 48px;
6
+ height: 48px;
7
+ margin: 0 auto 8px;
8
+ }
9
+ .ebscn-toast-loading.ebscn-toast-loading .ebscn-spin-loading-fill {
10
+ stroke: #ffffff;
11
+ }
package/cjs/index.d.ts CHANGED
@@ -39,3 +39,4 @@ export { default as ToastLoading } from './components/toastLoading';
39
39
  export { default as Input } from './components/input';
40
40
  export { default as InfiniteScroll } from './components/infinite-scroll';
41
41
  export { default as List } from './components/list';
42
+ export { default as Toast } from './components/toast';
package/cjs/index.js CHANGED
@@ -44,7 +44,8 @@ var _exportNames = {
44
44
  ToastLoading: true,
45
45
  Input: true,
46
46
  InfiniteScroll: true,
47
- List: true
47
+ List: true,
48
+ Toast: true
48
49
  };
49
50
  Object.defineProperty(exports, "AlphabetKeyboard", {
50
51
  enumerable: true,
@@ -286,6 +287,12 @@ Object.defineProperty(exports, "Tip", {
286
287
  return _tip.default;
287
288
  }
288
289
  });
290
+ Object.defineProperty(exports, "Toast", {
291
+ enumerable: true,
292
+ get: function () {
293
+ return _toast.default;
294
+ }
295
+ });
289
296
  Object.defineProperty(exports, "ToastLoading", {
290
297
  enumerable: true,
291
298
  get: function () {
@@ -344,4 +351,5 @@ var _toastLoading = _interopRequireDefault(require("./components/toastLoading"))
344
351
  var _input = _interopRequireDefault(require("./components/input"));
345
352
  var _infiniteScroll = _interopRequireDefault(require("./components/infinite-scroll"));
346
353
  var _list = _interopRequireDefault(require("./components/list"));
354
+ var _toast = _interopRequireDefault(require("./components/toast"));
347
355
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -251,10 +251,11 @@ export var DateRangePicker = memo(forwardRef(function (p, ref) {
251
251
  "aria-disabled": props.loading
252
252
  }, props.confirmText)), props.quickButtons.length ? React.createElement("div", {
253
253
  className: "".concat(classPrefix, "-buttons-wrap")
254
- }, props.quickButtons.map(function (_a) {
254
+ }, props.quickButtons.map(function (_a, index) {
255
255
  var label = _a.label,
256
256
  value = _a.value;
257
257
  return React.createElement("div", {
258
+ key: index,
258
259
  onClick: function () {
259
260
  return onQuickClick(value);
260
261
  },
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ declare const DownIcon: React.NamedExoticComponent<NativeProps>;
4
+ export default DownIcon;
@@ -0,0 +1,18 @@
1
+ import React, { memo } from 'react';
2
+ import { withNativeProps } from '../../utils/native-props';
3
+ var DownIcon = memo(function (props) {
4
+ return withNativeProps(props, React.createElement("svg", {
5
+ className: "ebscn-ui-icon",
6
+ viewBox: "0 0 1024 1024",
7
+ version: "1.1",
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ "p-id": "3136",
10
+ width: "1em",
11
+ height: "1em",
12
+ fill: "currentColor"
13
+ }, React.createElement("path", {
14
+ d: "M121.392 358.656a32 32 0 1 1 45.216-45.312l335.136 334.4c6.096 6.08 15.968 6.064 22.064-0.032l333.536-334.32a32 32 0 1 1 45.312 45.216L569.104 692.912a79.6 79.6 0 0 1-112.56 0.128l-335.152-334.4z",
15
+ "p-id": "3137"
16
+ })));
17
+ });
18
+ export default DownIcon;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ declare const DustbinIcon: React.NamedExoticComponent<NativeProps>;
4
+ export default DustbinIcon;
@@ -0,0 +1,18 @@
1
+ import React, { memo } from 'react';
2
+ import { withNativeProps } from '../../utils/native-props';
3
+ var DustbinIcon = memo(function (props) {
4
+ return withNativeProps(props, React.createElement("svg", {
5
+ className: "ebscn-ui-icon",
6
+ viewBox: "0 0 1024 1024",
7
+ version: "1.1",
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ "p-id": "3293",
10
+ width: "1em",
11
+ height: "1em",
12
+ fill: "currentColor"
13
+ }, React.createElement("path", {
14
+ d: "M544 64a48 48 0 0 1 48 48v16h304a32 32 0 1 1 0 64H256v656a32 32 0 0 0 32 32h448a32 32 0 0 0 32-32V285.488a32 32 0 1 1 64 0V848a96 96 0 0 1-96 96H288a96 96 0 0 1-96-96V192H128a32 32 0 1 1 0-64h336V112a48 48 0 0 1 48-48h32z m-128 208a32 32 0 0 1 32 32v464a32 32 0 1 1-64 0V304a32 32 0 0 1 32-32z m192 0a32 32 0 0 1 32 32v464a32 32 0 1 1-64 0V304a32 32 0 0 1 32-32z",
15
+ "p-id": "3294"
16
+ })));
17
+ });
18
+ export default DustbinIcon;
@@ -3,6 +3,8 @@ export { default as CheckIcon } from './check-icon';
3
3
  export { default as CheckOnlyIcon } from './check-only-icon';
4
4
  export { default as ClearIcon } from './clear-icon';
5
5
  export { default as CloseIcon } from './close-icon';
6
+ export { default as DownIcon } from './down-icon';
7
+ export { default as DustbinIcon } from './dustbin-icon';
6
8
  export { default as GdlogoIcon } from './gdlogo-icon';
7
9
  export { default as IndeterminateIcon } from './indeterminate-icon';
8
10
  export { default as LoadingIcon } from './loading-icon';
@@ -12,4 +14,5 @@ export { default as SearchIcon } from './search-icon';
12
14
  export { default as SelectorIcon } from './selector-icon';
13
15
  export { default as SpinIcon } from './spin-icon';
14
16
  export { default as UncheckIcon } from './uncheck-icon';
17
+ export { default as UpIcon } from './up-icon';
15
18
  export { default as WarningIcon } from './warning-icon';
@@ -3,6 +3,8 @@ export { default as CheckIcon } from './check-icon';
3
3
  export { default as CheckOnlyIcon } from './check-only-icon';
4
4
  export { default as ClearIcon } from './clear-icon';
5
5
  export { default as CloseIcon } from './close-icon';
6
+ export { default as DownIcon } from './down-icon';
7
+ export { default as DustbinIcon } from './dustbin-icon';
6
8
  export { default as GdlogoIcon } from './gdlogo-icon';
7
9
  export { default as IndeterminateIcon } from './indeterminate-icon';
8
10
  export { default as LoadingIcon } from './loading-icon';
@@ -12,4 +14,5 @@ export { default as SearchIcon } from './search-icon';
12
14
  export { default as SelectorIcon } from './selector-icon';
13
15
  export { default as SpinIcon } from './spin-icon';
14
16
  export { default as UncheckIcon } from './uncheck-icon';
17
+ export { default as UpIcon } from './up-icon';
15
18
  export { default as WarningIcon } from './warning-icon';
@@ -8,15 +8,14 @@ var NoticeIcon = memo(function (props) {
8
8
  xmlns: "http://www.w3.org/2000/svg",
9
9
  "p-id": "8375",
10
10
  width: "1em",
11
- height: "1em",
12
- fill: "currentColor"
11
+ height: "1em"
13
12
  }, React.createElement("path", {
14
13
  d: "M614.4 268.8a32 32 0 0 1 44.8-6.4C752.128 332.096 800 415.872 800 512c0 96.128-47.872 179.904-140.8 249.6a32 32 0 1 1-38.4-51.2C698.528 652.096 736 586.528 736 512s-37.472-140.096-115.2-198.4a32 32 0 0 1-6.4-44.8zM370.368 108.352A96 96 0 0 1 544 164.8v694.368a96 96 0 0 1-173.632 56.48L249.28 749.168A32 32 0 0 0 223.408 736H176a112 112 0 0 1-112-112V400a112 112 0 0 1 112-112h47.408a32 32 0 0 0 25.888-13.184l121.072-166.464z m96.448 30.576a32 32 0 0 0-44.688 7.056L301.056 312.48A96 96 0 0 1 223.408 352H176a48 48 0 0 0-48 48v224a48 48 0 0 0 48 48h47.408a96 96 0 0 1 77.648 39.536l121.072 166.48A32 32 0 0 0 480 859.184V164.816a32 32 0 0 0-13.184-25.888z",
15
- fill: "#333333",
14
+ fill: "currentColor",
16
15
  "p-id": "8376"
17
16
  }), React.createElement("path", {
18
17
  d: "M745.376 137.376a32 32 0 0 1 45.248 0C903.04 249.792 960 375.088 960 512c0 136.912-56.96 262.208-169.376 374.624a32 32 0 0 1-45.248-45.248C846.288 740.448 896 631.088 896 512c0-119.088-49.712-228.448-150.624-329.376a32 32 0 0 1 0-45.248z",
19
- fill: "#333333",
18
+ fill: "currentColor",
20
19
  "p-id": "8377"
21
20
  })));
22
21
  });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ declare const UpIcon: React.NamedExoticComponent<NativeProps>;
4
+ export default UpIcon;
@@ -0,0 +1,18 @@
1
+ import React, { memo } from 'react';
2
+ import { withNativeProps } from '../../utils/native-props';
3
+ var UpIcon = memo(function (props) {
4
+ return withNativeProps(props, React.createElement("svg", {
5
+ className: "ebscn-ui-icon",
6
+ viewBox: "0 0 1024 1024",
7
+ version: "1.1",
8
+ xmlns: "http://www.w3.org/2000/svg",
9
+ "p-id": "3450",
10
+ width: "1em",
11
+ height: "1em",
12
+ fill: "currentColor"
13
+ }, React.createElement("path", {
14
+ d: "M902.608 665.344a32 32 0 1 1-45.216 45.312l-335.136-334.4a15.6 15.6 0 0 0-22.064 0.032L166.656 710.608a32 32 0 1 1-45.312-45.216l333.552-334.304a79.6 79.6 0 0 1 112.56-0.128l335.152 334.4z",
15
+ "p-id": "3451"
16
+ })));
17
+ });
18
+ export default UpIcon;
@@ -8,7 +8,8 @@ var WarningIcon = memo(function (props) {
8
8
  xmlns: "http://www.w3.org/2000/svg",
9
9
  "p-id": "2315",
10
10
  width: "1em",
11
- height: "1em"
11
+ height: "1em",
12
+ fill: 'currentColor'
12
13
  }, React.createElement("path", {
13
14
  d: "M512 64c247.424 0 448 200.576 448 448S759.424 960 512 960 64 759.424 64 512 264.576 64 512 64z m0 640a48 48 0 1 0 0 96 48 48 0 0 0 0-96z m0-480a40 40 0 0 0-40 40v336a40 40 0 1 0 80 0v-336A40 40 0 0 0 512 224z",
14
15
  "p-id": "2316"
@@ -5,9 +5,10 @@
5
5
  display: flex;
6
6
  justify-content: center;
7
7
  align-items: center;
8
- font-size: var(--ebscn-font-size-main);
8
+ font-size: var(--ebscn-font-size-5);
9
9
  }
10
10
  .ebscn-infinite-scroll-failed-text {
11
+ color: var(--ebscn-color-text);
11
12
  display: inline-block;
12
13
  margin-right: 8px;
13
14
  }
@@ -21,3 +22,6 @@
21
22
  width: 18px;
22
23
  height: 18px;
23
24
  }
25
+ .ebscn-infinite-scroll-nodata-text {
26
+ color: var(--ebscn-color-weak);
27
+ }
@@ -4,6 +4,8 @@ export type InfiniteScrollProps = {
4
4
  loadMore: (isRetry: boolean) => Promise<void>;
5
5
  hasMore: boolean;
6
6
  threshold?: number;
7
- children?: ReactNode | ((hasMore: boolean, failed: boolean, retry: () => void) => ReactNode);
7
+ NoMoreContent?: ReactNode;
8
+ FailContent?: ReactNode;
9
+ children?: ReactNode | ((hasMore: boolean, failed: boolean, retry: () => void, NoMoreContent?: ReactNode, FailContent?: ReactNode) => ReactNode);
8
10
  } & NativeProps;
9
11
  export declare const InfiniteScroll: FC<InfiniteScrollProps>;
@@ -113,23 +113,25 @@ var __generator = this && this.__generator || function (thisArg, body) {
113
113
  };
114
114
  }
115
115
  };
116
- import { mergeProps } from '../../utils/with-default-props';
117
- import React, { useEffect, useRef, useState } from 'react';
118
116
  import { useLockFn, useThrottleFn } from 'ahooks';
119
- import { withNativeProps } from '../../utils/native-props';
120
- import { getScrollParent } from '../../utils/get-scroll-parent';
117
+ import React, { useEffect, useRef, useState } from 'react';
121
118
  import Loading from '../../assets/images/loading.gif';
119
+ import { getScrollParent } from '../../utils/get-scroll-parent';
120
+ import { withNativeProps } from '../../utils/native-props';
121
+ import { mergeProps } from '../../utils/with-default-props';
122
122
  function isWindow(element) {
123
123
  return element === window;
124
124
  }
125
125
  var classPrefix = "ebscn-infinite-scroll";
126
126
  var defaultProps = {
127
127
  threshold: 250,
128
- children: function (hasMore, failed, retry) {
128
+ children: function (hasMore, failed, retry, NoMoreContent, FailContent) {
129
129
  return React.createElement(InfiniteScrollContent, {
130
130
  hasMore: hasMore,
131
131
  failed: failed,
132
- retry: retry
132
+ retry: retry,
133
+ NoMoreContent: NoMoreContent,
134
+ FailContent: FailContent
133
135
  });
134
136
  }
135
137
  };
@@ -240,17 +242,20 @@ export var InfiniteScroll = function (p) {
240
242
  }, typeof props.children === 'function' ? props.children(props.hasMore, failed, retry) : props.children));
241
243
  };
242
244
  var InfiniteScrollContent = function (props) {
245
+ var _a, _b;
243
246
  if (!props.hasMore) {
244
- return React.createElement("span", null, '没有更多了');
247
+ return (_a = props.NoMoreContent) !== null && _a !== void 0 ? _a : React.createElement("span", {
248
+ className: "".concat(classPrefix, "-nodata-text")
249
+ }, "\u6211\u662F\u6709\u5E95\u7EBF\u7684");
245
250
  }
246
251
  if (props.failed) {
247
- return React.createElement("span", null, React.createElement("span", {
248
- className: "".concat(classPrefix, "-failed-text")
249
- }, "加载失败"), React.createElement("a", {
252
+ return (_b = props.FailContent) !== null && _b !== void 0 ? _b : React.createElement("span", {
250
253
  onClick: function () {
251
254
  props.retry();
252
255
  }
253
- }, "重新加载"));
256
+ }, React.createElement("span", {
257
+ className: "".concat(classPrefix, "-failed-text")
258
+ }, '加载失败,请重试'));
254
259
  }
255
260
  return React.createElement(React.Fragment, null, React.createElement("div", {
256
261
  className: "".concat(classPrefix, "-loading-wrap")
@@ -10,12 +10,14 @@ html[data-prefers-color-scheme='dark'] .ebscn-stock-keyboard-bottom .ebscn-stock
10
10
  flex-direction: row;
11
11
  z-index: 999;
12
12
  width: 100%;
13
- height: 267px;
13
+ height: 248px;
14
14
  transition: all 0.5s;
15
15
  align-content: flex-start;
16
+ background-color: #fff;
17
+ background-color: var(--ebscn-color-keyboard-bg);
16
18
  }
17
19
  .ebscn-stock-keyboard-top {
18
- padding: 11px 19px;
20
+ padding: 11px 19px 0 11px;
19
21
  background-color: #fff;
20
22
  background-color: var(--ebscn-color-background);
21
23
  display: flex;
@@ -27,6 +29,7 @@ html[data-prefers-color-scheme='dark'] .ebscn-stock-keyboard-bottom .ebscn-stock
27
29
  margin-right: 24px;
28
30
  color: #666;
29
31
  color: var(--ebscn-color-text-secondary);
32
+ line-height: 21px;
30
33
  }
31
34
  .ebscn-stock-keyboard-top-item-active {
32
35
  color: #e84225;
@@ -141,7 +144,7 @@ html[data-prefers-color-scheme='dark'] .ebscn-stock-keyboard-bottom .ebscn-stock
141
144
  }
142
145
  @supports (bottom: env(safe-area-inset-bottom)) or (constant(safe-area-inset-bottom)) {
143
146
  .ebscn-stock-keyboard {
144
- height: calc(267px + env(safe-area-inset-bottom));
145
- height: calc(267px + constant(safe-area-inset-bottom));
147
+ height: calc(248px + env(safe-area-inset-bottom));
148
+ height: calc(248px + constant(safe-area-inset-bottom));
146
149
  }
147
150
  }
@@ -0,0 +1,9 @@
1
+ import './toast.less';
2
+ import { clear, show, config } from './methods';
3
+ export type { ToastShowProps, ToastHandler } from './methods';
4
+ declare const Toast: {
5
+ show: typeof show;
6
+ clear: typeof clear;
7
+ config: typeof config;
8
+ };
9
+ export default Toast;
@@ -0,0 +1,8 @@
1
+ import "./toast.css";
2
+ import { clear, show, config } from './methods';
3
+ var Toast = {
4
+ show: show,
5
+ clear: clear,
6
+ config: config
7
+ };
8
+ export default Toast;
@@ -0,0 +1,8 @@
1
+ import { ToastProps } from './toast';
2
+ export type ToastShowProps = Omit<ToastProps, 'visible'>;
3
+ export type ToastHandler = {
4
+ close: () => void;
5
+ };
6
+ export declare function show(p: ToastShowProps | string): ToastHandler;
7
+ export declare function clear(): void;
8
+ export declare function config(val: Pick<ToastProps, 'duration' | 'position' | 'maskClickable'>): void;
@@ -0,0 +1,63 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import React from 'react';
12
+ import { InternalToast } from './toast';
13
+ import { mergeProps } from '../../utils/with-default-props';
14
+ import { renderImperatively } from '../../utils/render-imperatively';
15
+ var currentHandler = null;
16
+ var currentTimeout = null;
17
+ var defaultProps = {
18
+ duration: 2000,
19
+ position: 'center',
20
+ maskClickable: true
21
+ };
22
+ var ToastInner = function (props) {
23
+ return React.createElement(InternalToast, __assign({}, props));
24
+ };
25
+ export function show(p) {
26
+ var props = mergeProps(defaultProps, typeof p === 'string' ? {
27
+ content: p
28
+ } : p);
29
+ var element = React.createElement(ToastInner, __assign({}, props, {
30
+ onClose: function () {
31
+ currentHandler = null;
32
+ }
33
+ }));
34
+ if (currentHandler) {
35
+ currentHandler.replace(element);
36
+ } else {
37
+ currentHandler = renderImperatively(element);
38
+ }
39
+ if (currentTimeout) {
40
+ window.clearTimeout(currentTimeout);
41
+ }
42
+ if (props.duration !== 0) {
43
+ currentTimeout = window.setTimeout(function () {
44
+ clear();
45
+ }, props.duration);
46
+ }
47
+ return currentHandler;
48
+ }
49
+ export function clear() {
50
+ currentHandler === null || currentHandler === void 0 ? void 0 : currentHandler.close();
51
+ currentHandler = null;
52
+ }
53
+ export function config(val) {
54
+ if (val.duration !== undefined) {
55
+ defaultProps.duration = val.duration;
56
+ }
57
+ if (val.position !== undefined) {
58
+ defaultProps.position = val.position;
59
+ }
60
+ if (val.maskClickable !== undefined) {
61
+ defaultProps.maskClickable = val.maskClickable;
62
+ }
63
+ }
@@ -0,0 +1,45 @@
1
+ .ebscn-toast-mask .ebscn-toast-wrap {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ text-align: center;
8
+ }
9
+ .ebscn-toast-mask .ebscn-toast-main {
10
+ display: inline-block;
11
+ position: relative;
12
+ top: 50%;
13
+ transform: translateY(-50%);
14
+ width: auto;
15
+ max-width: 204px;
16
+ max-height: 70%;
17
+ overflow: auto;
18
+ color: white;
19
+ word-break: break-all;
20
+ background-color: rgba(0, 0, 0, 0.7);
21
+ border-radius: 8px;
22
+ pointer-events: all;
23
+ font-size: var(--ebscn-font-size-7);
24
+ line-height: 1.5;
25
+ box-sizing: border-box;
26
+ text-align: initial;
27
+ }
28
+ .ebscn-toast-mask .ebscn-toast-main-text {
29
+ padding: 12px;
30
+ min-width: 0px;
31
+ }
32
+ .ebscn-toast-mask .ebscn-toast-main-icon {
33
+ padding: 35px 12px;
34
+ min-width: 150px;
35
+ }
36
+ .ebscn-toast-mask .ebscn-toast-main-icon .ebscn-toast-icon {
37
+ text-align: center;
38
+ margin-bottom: 8px;
39
+ font-size: 36px;
40
+ line-height: 1;
41
+ }
42
+ .ebscn-toast-loading {
43
+ --size: 48px;
44
+ margin: 0 auto 8px;
45
+ }
@@ -0,0 +1,18 @@
1
+ import type { FC, ReactNode } from 'react';
2
+ import type { MaskProps } from '../mask';
3
+ import { PropagationEvent } from '../../utils/with-stop-propagation';
4
+ import { GetContainer } from '../../utils/render-to-container';
5
+ export interface ToastProps {
6
+ afterClose?: () => void;
7
+ maskStyle?: MaskProps['style'];
8
+ maskClassName?: string;
9
+ maskClickable?: boolean;
10
+ content?: ReactNode;
11
+ icon?: 'success' | 'fail' | ReactNode;
12
+ duration?: number;
13
+ position?: 'top' | 'bottom' | 'center';
14
+ visible?: boolean;
15
+ getContainer?: GetContainer;
16
+ stopPropagation?: PropagationEvent[];
17
+ }
18
+ export declare const InternalToast: FC<ToastProps>;
@@ -0,0 +1,75 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6
+ }
7
+ return t;
8
+ };
9
+ return __assign.apply(this, arguments);
10
+ };
11
+ import React, { useMemo } from 'react';
12
+ import classNames from 'classnames';
13
+ import { CloseIcon as CloseOutline, CheckOnlyIcon as CheckOutline } from '../icons';
14
+ import Mask from '../mask';
15
+ import { mergeProps } from '../../utils/with-default-props';
16
+ import AutoCenter from '../auto-center';
17
+ var classPrefix = "ebscn-toast";
18
+ var defaultProps = {
19
+ maskClickable: true,
20
+ stopPropagation: ['click']
21
+ };
22
+ export var InternalToast = function (p) {
23
+ var props = mergeProps(defaultProps, p);
24
+ var maskClickable = props.maskClickable,
25
+ content = props.content,
26
+ icon = props.icon,
27
+ position = props.position;
28
+ var iconElement = useMemo(function () {
29
+ if (icon === null || icon === undefined) return null;
30
+ switch (icon) {
31
+ case 'success':
32
+ return React.createElement(CheckOutline, {
33
+ className: "".concat(classPrefix, "-icon-success")
34
+ });
35
+ case 'fail':
36
+ return React.createElement(CloseOutline, {
37
+ className: "".concat(classPrefix, "-icon-fail")
38
+ });
39
+ default:
40
+ return icon;
41
+ }
42
+ }, [icon]);
43
+ var top = useMemo(function () {
44
+ switch (position) {
45
+ case 'top':
46
+ return '20%';
47
+ case 'bottom':
48
+ return '80%';
49
+ default:
50
+ return '50%';
51
+ }
52
+ }, [position]);
53
+ return React.createElement(Mask, {
54
+ visible: props.visible,
55
+ destroyOnClose: true,
56
+ opacity: 0,
57
+ disableBodyScroll: !maskClickable,
58
+ getContainer: props.getContainer,
59
+ afterClose: props.afterClose,
60
+ style: __assign({
61
+ pointerEvents: maskClickable ? 'none' : 'auto'
62
+ }, props.maskStyle),
63
+ className: classNames("".concat(classPrefix, "-mask"), props.maskClassName),
64
+ stopPropagation: props.stopPropagation
65
+ }, React.createElement("div", {
66
+ className: classNames("".concat(classPrefix, "-wrap"))
67
+ }, React.createElement("div", {
68
+ style: {
69
+ top: top
70
+ },
71
+ className: classNames("".concat(classPrefix, "-main"), icon ? "".concat(classPrefix, "-main-icon") : "".concat(classPrefix, "-main-text"))
72
+ }, iconElement && React.createElement("div", {
73
+ className: "".concat(classPrefix, "-icon")
74
+ }, iconElement), React.createElement(AutoCenter, null, content))));
75
+ };
@@ -0,0 +1,11 @@
1
+ .ebscn-toast-mask .ebscn-toast-main {
2
+ font-size: 15px;
3
+ }
4
+ .ebscn-toast-loading.ebscn-toast-loading {
5
+ width: 48px;
6
+ height: 48px;
7
+ margin: 0 auto 8px;
8
+ }
9
+ .ebscn-toast-loading.ebscn-toast-loading .ebscn-spin-loading-fill {
10
+ stroke: #ffffff;
11
+ }
package/es/index.d.ts CHANGED
@@ -39,3 +39,4 @@ export { default as ToastLoading } from './components/toastLoading';
39
39
  export { default as Input } from './components/input';
40
40
  export { default as InfiniteScroll } from './components/infinite-scroll';
41
41
  export { default as List } from './components/list';
42
+ export { default as Toast } from './components/toast';
package/es/index.js CHANGED
@@ -41,6 +41,7 @@ export { default as ToastLoading } from './components/toastLoading';
41
41
  export { default as Input } from './components/input';
42
42
  export { default as InfiniteScroll } from './components/infinite-scroll';
43
43
  export { default as List } from './components/list';
44
+ export { default as Toast } from './components/toast';
44
45
  // export { default as PayInput} from './components/pay-input';
45
46
  // export { default as MoneyInput } from './components/money-input';
46
47
  // export { default as FeneInput } from './components/fene-input';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebscn/ui",
3
- "version": "1.0.3-beta.10",
3
+ "version": "1.0.3-beta.12",
4
4
  "description": "ebscn react library",
5
5
  "module": "./es/index.js",
6
6
  "types": "./es/index.d.ts",