@ebscn/ui 1.0.3-beta.3 → 1.0.3-beta.30
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/assets/images/delete_dark.png +0 -0
- package/assets/images/keybord_keybord_dark.png +0 -0
- package/assets/images/keybord_shift2.png +0 -0
- package/assets/images/keybord_shift2_dark.png +0 -0
- package/assets/images/keybord_shift_dark.png +0 -0
- package/assets/images/loading.gif +0 -0
- package/cjs/assets/images/delete_dark.png +0 -0
- package/cjs/assets/images/keybord_keybord_dark.png +0 -0
- package/cjs/assets/images/keybord_shift2.png +0 -0
- package/cjs/assets/images/keybord_shift2_dark.png +0 -0
- package/cjs/assets/images/keybord_shift_dark.png +0 -0
- package/cjs/assets/images/loading.gif +0 -0
- package/cjs/components/alphabet-keyboard/alphabet-keyboard.css +108 -43
- package/cjs/components/alphabet-keyboard/alphabet-keyboard.js +1 -2
- package/cjs/components/button/selectorButton.css +2 -0
- package/cjs/components/button/selectorButton.js +1 -5
- package/cjs/components/card/card.css +1 -1
- package/cjs/components/card/card.js +2 -2
- package/cjs/components/checkbox/checkbox.css +8 -2
- package/cjs/components/date-range-picker/date-range-picker.css +31 -7
- package/cjs/components/date-range-picker/date-range-picker.d.ts +1 -0
- package/cjs/components/date-range-picker/date-range-picker.js +18 -9
- package/cjs/components/divider/divider.css +4 -3
- package/cjs/components/header/header.css +7 -1
- package/cjs/components/header/header.js +4 -2
- package/cjs/components/icons/back-icon.js +1 -0
- package/cjs/components/icons/clear-icon.js +1 -0
- package/cjs/components/icons/close-icon.js +2 -1
- package/cjs/components/icons/down-icon.d.ts +4 -0
- package/cjs/components/icons/down-icon.js +26 -0
- package/cjs/components/icons/dustbin-icon.d.ts +4 -0
- package/cjs/components/icons/dustbin-icon.js +26 -0
- package/cjs/components/icons/index.d.ts +3 -0
- package/cjs/components/icons/index.js +21 -0
- package/cjs/components/icons/notice-icon.js +2 -2
- package/cjs/components/icons/right-icon.js +1 -0
- package/cjs/components/icons/search-icon.js +2 -1
- package/cjs/components/icons/up-icon.d.ts +4 -0
- package/cjs/components/icons/up-icon.js +26 -0
- package/cjs/components/icons/warning-icon.js +2 -1
- package/cjs/components/infinite-scroll/index.d.ts +4 -0
- package/cjs/components/infinite-scroll/index.js +9 -0
- package/cjs/components/infinite-scroll/infinite-scroll.css +27 -0
- package/cjs/components/infinite-scroll/infinite-scroll.d.ts +11 -0
- package/cjs/components/infinite-scroll/infinite-scroll.js +278 -0
- package/cjs/components/input/input.css +27 -27
- package/cjs/components/input/input.js +1 -1
- package/cjs/components/list/index.d.ts +16 -0
- package/cjs/components/list/index.js +13 -0
- package/cjs/components/list/list-item.d.ts +15 -0
- package/cjs/components/list/list-item.js +38 -0
- package/cjs/components/list/list.css +101 -0
- package/cjs/components/list/list.d.ts +20 -0
- package/cjs/components/list/list.js +38 -0
- package/cjs/components/number-keyboard/number-keyboard.css +55 -42
- package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -0
- package/cjs/components/number-keyboard/number-keyboard.js +2 -1
- package/cjs/components/picker/picker.css +3 -0
- package/cjs/components/picker-view/picker-view.css +11 -2
- package/cjs/components/popover/arrow.d.ts +3 -0
- package/cjs/components/popover/arrow.js +19 -0
- package/cjs/components/popover/index.d.ts +31 -0
- package/cjs/components/popover/index.js +14 -0
- package/cjs/components/popover/normalize-placement.d.ts +2 -0
- package/cjs/components/popover/normalize-placement.js +20 -0
- package/cjs/components/popover/popover-menu.css +65 -0
- package/cjs/components/popover/popover-menu.d.ts +20 -0
- package/cjs/components/popover/popover-menu.js +74 -0
- package/cjs/components/popover/popover.css +68 -0
- package/cjs/components/popover/popover.d.ts +41 -0
- package/cjs/components/popover/popover.js +280 -0
- package/cjs/components/popover/wrapper.d.ts +10 -0
- package/cjs/components/popover/wrapper.js +53 -0
- package/cjs/components/popup/popup.css +4 -16
- package/cjs/components/protocol/protocol.js +1 -2
- package/cjs/components/pull-to-refresh/pull-to-refresh.css +10 -1
- package/cjs/components/pull-to-refresh/pull-to-refresh.d.ts +1 -1
- package/cjs/components/pull-to-refresh/pull-to-refresh.js +5 -5
- package/cjs/components/radio/radio.css +5 -0
- package/cjs/components/selector/selector.css +1 -1
- package/cjs/components/skeleton/skeleton.css +4 -4
- package/cjs/components/squared-grid/squared-grid.css +1 -2
- package/cjs/components/squared-grid/squared-grid.d.ts +2 -1
- package/cjs/components/squared-grid/squared-grid.js +11 -2
- package/cjs/components/stock-count-keyboard/stock-count-keyboard.css +48 -41
- package/cjs/components/stock-count-keyboard/stock-count-keyboard.js +1 -1
- package/cjs/components/stock-keyboard/alphabet-keyboard.css +186 -0
- package/cjs/components/stock-keyboard/alphabet-keyboard.d.ts +11 -0
- package/cjs/components/stock-keyboard/alphabet-keyboard.js +106 -0
- package/cjs/components/stock-keyboard/index.d.ts +1 -0
- package/cjs/components/stock-keyboard/index.js +1 -0
- package/cjs/components/stock-keyboard/stock-keyboard.css +135 -76
- package/cjs/components/stock-keyboard/stock-keyboard.d.ts +2 -2
- package/cjs/components/stock-keyboard/stock-keyboard.js +42 -10
- package/cjs/components/switch/switch.css +2 -3
- package/cjs/components/tabs/tabs.css +6 -4
- package/cjs/components/tabs/tabs.js +5 -5
- package/cjs/components/tabs/tabs.patch.css +1 -0
- package/cjs/components/toast/index.d.ts +9 -0
- package/cjs/components/toast/index.js +14 -0
- package/cjs/components/toast/methods.d.ts +8 -0
- package/cjs/components/toast/methods.js +72 -0
- package/cjs/components/toast/toast.css +45 -0
- package/cjs/components/toast/toast.d.ts +18 -0
- package/cjs/components/toast/toast.js +85 -0
- package/cjs/components/toast/toast.patch.css +11 -0
- package/cjs/global/global.css +20 -5
- package/cjs/global/theme-dark.css +11 -3
- package/cjs/global/theme-default.css +9 -2
- package/cjs/index.d.ts +4 -0
- package/cjs/index.js +33 -1
- package/es/assets/images/delete_dark.png +0 -0
- package/es/assets/images/keybord_keybord_dark.png +0 -0
- package/es/assets/images/keybord_shift2.png +0 -0
- package/es/assets/images/keybord_shift2_dark.png +0 -0
- package/es/assets/images/keybord_shift_dark.png +0 -0
- package/es/assets/images/loading.gif +0 -0
- package/es/components/alphabet-keyboard/alphabet-keyboard.css +108 -43
- package/es/components/alphabet-keyboard/alphabet-keyboard.js +2 -4
- package/es/components/button/selectorButton.css +2 -0
- package/es/components/button/selectorButton.js +1 -5
- package/es/components/card/card.css +1 -1
- package/es/components/card/card.js +2 -2
- package/es/components/checkbox/checkbox.css +8 -2
- package/es/components/date-range-picker/date-range-picker.css +31 -7
- package/es/components/date-range-picker/date-range-picker.d.ts +1 -0
- package/es/components/date-range-picker/date-range-picker.js +17 -9
- package/es/components/divider/divider.css +4 -3
- package/es/components/header/header.css +7 -1
- package/es/components/header/header.js +4 -2
- package/es/components/icons/back-icon.js +1 -0
- package/es/components/icons/clear-icon.js +1 -0
- package/es/components/icons/close-icon.js +2 -1
- package/es/components/icons/down-icon.d.ts +4 -0
- package/es/components/icons/down-icon.js +18 -0
- package/es/components/icons/dustbin-icon.d.ts +4 -0
- package/es/components/icons/dustbin-icon.js +18 -0
- package/es/components/icons/index.d.ts +3 -0
- package/es/components/icons/index.js +3 -0
- package/es/components/icons/notice-icon.js +2 -2
- package/es/components/icons/right-icon.js +1 -0
- package/es/components/icons/search-icon.js +2 -1
- package/es/components/icons/up-icon.d.ts +4 -0
- package/es/components/icons/up-icon.js +18 -0
- package/es/components/icons/warning-icon.js +2 -1
- package/es/components/infinite-scroll/index.d.ts +4 -0
- package/es/components/infinite-scroll/index.js +3 -0
- package/es/components/infinite-scroll/infinite-scroll.css +27 -0
- package/es/components/infinite-scroll/infinite-scroll.d.ts +11 -0
- package/es/components/infinite-scroll/infinite-scroll.js +268 -0
- package/es/components/input/input.css +27 -27
- package/es/components/input/input.js +1 -1
- package/es/components/list/index.d.ts +16 -0
- package/es/components/list/index.js +7 -0
- package/es/components/list/list-item.d.ts +15 -0
- package/es/components/list/list-item.js +30 -0
- package/es/components/list/list.css +101 -0
- package/es/components/list/list.d.ts +20 -0
- package/es/components/list/list.js +29 -0
- package/es/components/number-keyboard/number-keyboard.css +55 -42
- package/es/components/number-keyboard/number-keyboard.d.ts +1 -0
- package/es/components/number-keyboard/number-keyboard.js +2 -1
- package/es/components/picker/picker.css +3 -0
- package/es/components/picker-view/picker-view.css +11 -2
- package/es/components/popover/arrow.d.ts +3 -0
- package/es/components/popover/arrow.js +11 -0
- package/es/components/popover/index.d.ts +31 -0
- package/es/components/popover/index.js +8 -0
- package/es/components/popover/normalize-placement.d.ts +2 -0
- package/es/components/popover/normalize-placement.js +14 -0
- package/es/components/popover/popover-menu.css +65 -0
- package/es/components/popover/popover-menu.d.ts +20 -0
- package/es/components/popover/popover-menu.js +65 -0
- package/es/components/popover/popover.css +68 -0
- package/es/components/popover/popover.d.ts +41 -0
- package/es/components/popover/popover.js +271 -0
- package/es/components/popover/wrapper.d.ts +10 -0
- package/es/components/popover/wrapper.js +47 -0
- package/es/components/popup/popup.css +4 -16
- package/es/components/protocol/protocol.js +1 -2
- package/es/components/pull-to-refresh/pull-to-refresh.css +10 -1
- package/es/components/pull-to-refresh/pull-to-refresh.d.ts +1 -1
- package/es/components/pull-to-refresh/pull-to-refresh.js +5 -5
- package/es/components/radio/radio.css +5 -0
- package/es/components/selector/selector.css +1 -1
- package/es/components/skeleton/skeleton.css +4 -4
- package/es/components/squared-grid/squared-grid.css +1 -2
- package/es/components/squared-grid/squared-grid.d.ts +2 -1
- package/es/components/squared-grid/squared-grid.js +11 -2
- package/es/components/stock-count-keyboard/stock-count-keyboard.css +48 -41
- package/es/components/stock-count-keyboard/stock-count-keyboard.js +1 -1
- package/es/components/stock-keyboard/alphabet-keyboard.css +186 -0
- package/es/components/stock-keyboard/alphabet-keyboard.d.ts +11 -0
- package/es/components/stock-keyboard/alphabet-keyboard.js +98 -0
- package/es/components/stock-keyboard/index.d.ts +1 -0
- package/es/components/stock-keyboard/index.js +1 -0
- package/es/components/stock-keyboard/stock-keyboard.css +135 -76
- package/es/components/stock-keyboard/stock-keyboard.d.ts +2 -2
- package/es/components/stock-keyboard/stock-keyboard.js +44 -13
- package/es/components/switch/switch.css +2 -3
- package/es/components/tabs/tabs.css +6 -4
- package/es/components/tabs/tabs.js +5 -5
- package/es/components/tabs/tabs.patch.css +1 -0
- package/es/components/toast/index.d.ts +9 -0
- package/es/components/toast/index.js +8 -0
- package/es/components/toast/methods.d.ts +8 -0
- package/es/components/toast/methods.js +63 -0
- package/es/components/toast/toast.css +45 -0
- package/es/components/toast/toast.d.ts +18 -0
- package/es/components/toast/toast.js +75 -0
- package/es/components/toast/toast.patch.css +11 -0
- package/es/global/global.css +20 -5
- package/es/global/theme-dark.css +11 -3
- package/es/global/theme-default.css +9 -2
- package/es/index.d.ts +4 -0
- package/es/index.js +8 -4
- package/package.json +6 -12
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) {
|
|
9
|
+
try {
|
|
10
|
+
step(generator.next(value));
|
|
11
|
+
} catch (e) {
|
|
12
|
+
reject(e);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function rejected(value) {
|
|
16
|
+
try {
|
|
17
|
+
step(generator["throw"](value));
|
|
18
|
+
} catch (e) {
|
|
19
|
+
reject(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function step(result) {
|
|
23
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
24
|
+
}
|
|
25
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
29
|
+
var _ = {
|
|
30
|
+
label: 0,
|
|
31
|
+
sent: function () {
|
|
32
|
+
if (t[0] & 1) throw t[1];
|
|
33
|
+
return t[1];
|
|
34
|
+
},
|
|
35
|
+
trys: [],
|
|
36
|
+
ops: []
|
|
37
|
+
},
|
|
38
|
+
f,
|
|
39
|
+
y,
|
|
40
|
+
t,
|
|
41
|
+
g;
|
|
42
|
+
return g = {
|
|
43
|
+
next: verb(0),
|
|
44
|
+
"throw": verb(1),
|
|
45
|
+
"return": verb(2)
|
|
46
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
47
|
+
return this;
|
|
48
|
+
}), g;
|
|
49
|
+
function verb(n) {
|
|
50
|
+
return function (v) {
|
|
51
|
+
return step([n, v]);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function step(op) {
|
|
55
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
56
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
57
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
58
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
59
|
+
switch (op[0]) {
|
|
60
|
+
case 0:
|
|
61
|
+
case 1:
|
|
62
|
+
t = op;
|
|
63
|
+
break;
|
|
64
|
+
case 4:
|
|
65
|
+
_.label++;
|
|
66
|
+
return {
|
|
67
|
+
value: op[1],
|
|
68
|
+
done: false
|
|
69
|
+
};
|
|
70
|
+
case 5:
|
|
71
|
+
_.label++;
|
|
72
|
+
y = op[1];
|
|
73
|
+
op = [0];
|
|
74
|
+
continue;
|
|
75
|
+
case 7:
|
|
76
|
+
op = _.ops.pop();
|
|
77
|
+
_.trys.pop();
|
|
78
|
+
continue;
|
|
79
|
+
default:
|
|
80
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
81
|
+
_ = 0;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
85
|
+
_.label = op[1];
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
89
|
+
_.label = t[1];
|
|
90
|
+
t = op;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
if (t && _.label < t[2]) {
|
|
94
|
+
_.label = t[2];
|
|
95
|
+
_.ops.push(op);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (t[2]) _.ops.pop();
|
|
99
|
+
_.trys.pop();
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
op = body.call(thisArg, _);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
op = [6, e];
|
|
105
|
+
y = 0;
|
|
106
|
+
} finally {
|
|
107
|
+
f = t = 0;
|
|
108
|
+
}
|
|
109
|
+
if (op[0] & 5) throw op[1];
|
|
110
|
+
return {
|
|
111
|
+
value: op[0] ? op[1] : void 0,
|
|
112
|
+
done: true
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
import { useLockFn, useThrottleFn } from 'ahooks';
|
|
117
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
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
|
+
function isWindow(element) {
|
|
123
|
+
return element === window;
|
|
124
|
+
}
|
|
125
|
+
var classPrefix = "ebscn-infinite-scroll";
|
|
126
|
+
var defaultProps = {
|
|
127
|
+
threshold: 250,
|
|
128
|
+
children: function (hasMore, failed, retry, NoMoreContent, FailContent) {
|
|
129
|
+
return React.createElement(InfiniteScrollContent, {
|
|
130
|
+
hasMore: hasMore,
|
|
131
|
+
failed: failed,
|
|
132
|
+
retry: retry,
|
|
133
|
+
NoMoreContent: NoMoreContent,
|
|
134
|
+
FailContent: FailContent
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
export var InfiniteScroll = function (p) {
|
|
139
|
+
var props = mergeProps(defaultProps, p);
|
|
140
|
+
var _a = useState(false),
|
|
141
|
+
failed = _a[0],
|
|
142
|
+
setFailed = _a[1];
|
|
143
|
+
var doloadMore = useLockFn(function (isRetry) {
|
|
144
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
145
|
+
var e_1;
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
switch (_a.label) {
|
|
148
|
+
case 0:
|
|
149
|
+
_a.trys.push([0, 2,, 3]);
|
|
150
|
+
return [4 /*yield*/, props.loadMore(isRetry)];
|
|
151
|
+
case 1:
|
|
152
|
+
_a.sent();
|
|
153
|
+
return [3 /*break*/, 3];
|
|
154
|
+
case 2:
|
|
155
|
+
e_1 = _a.sent();
|
|
156
|
+
setFailed(true);
|
|
157
|
+
throw e_1;
|
|
158
|
+
case 3:
|
|
159
|
+
return [2 /*return*/];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
var elementRef = useRef(null);
|
|
165
|
+
// Prevent duplicated trigger of `check` function
|
|
166
|
+
var _b = useState({}),
|
|
167
|
+
flag = _b[0],
|
|
168
|
+
setFlag = _b[1];
|
|
169
|
+
var nextFlagRef = useRef(flag);
|
|
170
|
+
var _c = useState(),
|
|
171
|
+
scrollParent = _c[0],
|
|
172
|
+
setScrollParent = _c[1];
|
|
173
|
+
var check = useThrottleFn(function () {
|
|
174
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
175
|
+
var element, parent, rect, elementTop, current, nextFlag;
|
|
176
|
+
return __generator(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0:
|
|
179
|
+
if (nextFlagRef.current !== flag) return [2 /*return*/];
|
|
180
|
+
if (!props.hasMore) return [2 /*return*/];
|
|
181
|
+
element = elementRef.current;
|
|
182
|
+
if (!element) return [2 /*return*/];
|
|
183
|
+
if (!element.offsetParent) return [2 /*return*/];
|
|
184
|
+
parent = getScrollParent(element);
|
|
185
|
+
setScrollParent(parent);
|
|
186
|
+
if (!parent) return [2 /*return*/];
|
|
187
|
+
rect = element.getBoundingClientRect();
|
|
188
|
+
elementTop = rect.top;
|
|
189
|
+
current = isWindow(parent) ? window.innerHeight : parent.getBoundingClientRect().bottom;
|
|
190
|
+
if (!(current >= elementTop - props.threshold)) return [3 /*break*/, 2];
|
|
191
|
+
nextFlag = {};
|
|
192
|
+
nextFlagRef.current = nextFlag;
|
|
193
|
+
return [4 /*yield*/, doloadMore(false)];
|
|
194
|
+
case 1:
|
|
195
|
+
_a.sent();
|
|
196
|
+
setFlag(nextFlag);
|
|
197
|
+
_a.label = 2;
|
|
198
|
+
case 2:
|
|
199
|
+
return [2 /*return*/];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}, {
|
|
204
|
+
wait: 100,
|
|
205
|
+
leading: true,
|
|
206
|
+
trailing: true
|
|
207
|
+
}).run;
|
|
208
|
+
// Make sure to trigger `loadMore` when content changes
|
|
209
|
+
useEffect(function () {
|
|
210
|
+
check();
|
|
211
|
+
});
|
|
212
|
+
useEffect(function () {
|
|
213
|
+
var element = elementRef.current;
|
|
214
|
+
if (!element) return;
|
|
215
|
+
if (!scrollParent) return;
|
|
216
|
+
function onScroll() {
|
|
217
|
+
check();
|
|
218
|
+
}
|
|
219
|
+
scrollParent.addEventListener('scroll', onScroll);
|
|
220
|
+
return function () {
|
|
221
|
+
scrollParent.removeEventListener('scroll', onScroll);
|
|
222
|
+
};
|
|
223
|
+
}, [scrollParent]);
|
|
224
|
+
function retry() {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
226
|
+
return __generator(this, function (_a) {
|
|
227
|
+
switch (_a.label) {
|
|
228
|
+
case 0:
|
|
229
|
+
setFailed(false);
|
|
230
|
+
return [4 /*yield*/, doloadMore(true)];
|
|
231
|
+
case 1:
|
|
232
|
+
_a.sent();
|
|
233
|
+
setFlag(nextFlagRef.current);
|
|
234
|
+
return [2 /*return*/];
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
return withNativeProps(props, React.createElement("div", {
|
|
240
|
+
className: classPrefix,
|
|
241
|
+
ref: elementRef
|
|
242
|
+
}, typeof props.children === 'function' ? props.children(props.hasMore, failed, retry, props.NoMoreContent) : props.children));
|
|
243
|
+
};
|
|
244
|
+
var InfiniteScrollContent = function (props) {
|
|
245
|
+
var _a, _b;
|
|
246
|
+
if (!props.hasMore) {
|
|
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");
|
|
250
|
+
}
|
|
251
|
+
if (props.failed) {
|
|
252
|
+
return (_b = props.FailContent) !== null && _b !== void 0 ? _b : React.createElement("span", {
|
|
253
|
+
onClick: function () {
|
|
254
|
+
props.retry();
|
|
255
|
+
}
|
|
256
|
+
}, React.createElement("span", {
|
|
257
|
+
className: "".concat(classPrefix, "-failed-text")
|
|
258
|
+
}, '加载失败,请重试'));
|
|
259
|
+
}
|
|
260
|
+
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
261
|
+
className: "".concat(classPrefix, "-loading-wrap")
|
|
262
|
+
}, React.createElement("img", {
|
|
263
|
+
className: "".concat(classPrefix, "-loading-img"),
|
|
264
|
+
src: Loading
|
|
265
|
+
}), React.createElement("span", {
|
|
266
|
+
className: "".concat(classPrefix, "-loading-text")
|
|
267
|
+
}, "\u52A0\u8F7D\u4E2D...")));
|
|
268
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.
|
|
2
|
-
--font-size: var(--
|
|
3
|
-
--color: var(--
|
|
4
|
-
--placeholder-color: var(--
|
|
1
|
+
.ebscn-input {
|
|
2
|
+
--font-size: var(--ebscn-font-size-9);
|
|
3
|
+
--color: var(--ebscn-color-text);
|
|
4
|
+
--placeholder-color: var(--ebscn-color-light);
|
|
5
5
|
--text-align: left;
|
|
6
6
|
--background-color: transparent;
|
|
7
7
|
display: flex;
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
min-height: 24px;
|
|
14
14
|
background-color: var(--background-color);
|
|
15
15
|
}
|
|
16
|
-
.
|
|
16
|
+
.ebscn-input-disabled {
|
|
17
17
|
opacity: 0.4;
|
|
18
18
|
cursor: not-allowed;
|
|
19
19
|
}
|
|
20
|
-
.
|
|
20
|
+
.ebscn-input-element {
|
|
21
21
|
flex: auto;
|
|
22
22
|
display: inline-block;
|
|
23
23
|
box-sizing: border-box;
|
|
@@ -37,60 +37,60 @@
|
|
|
37
37
|
min-height: 1.5em;
|
|
38
38
|
text-align: var(--text-align);
|
|
39
39
|
}
|
|
40
|
-
.
|
|
40
|
+
.ebscn-input-element::-webkit-input-placeholder {
|
|
41
41
|
color: var(--placeholder-color);
|
|
42
42
|
font-family: inherit;
|
|
43
43
|
}
|
|
44
|
-
.
|
|
44
|
+
.ebscn-input-element::placeholder {
|
|
45
45
|
color: var(--placeholder-color);
|
|
46
46
|
font-family: inherit;
|
|
47
47
|
}
|
|
48
|
-
.
|
|
48
|
+
.ebscn-input-element:-webkit-autofill {
|
|
49
49
|
background-color: transparent;
|
|
50
50
|
}
|
|
51
|
-
.
|
|
51
|
+
.ebscn-input-element:read-only {
|
|
52
52
|
cursor: default;
|
|
53
53
|
}
|
|
54
|
-
.
|
|
54
|
+
.ebscn-input-element:invalid {
|
|
55
55
|
box-shadow: none;
|
|
56
56
|
}
|
|
57
|
-
.
|
|
57
|
+
.ebscn-input-element::-ms-clear {
|
|
58
58
|
display: none;
|
|
59
59
|
}
|
|
60
|
-
.
|
|
60
|
+
.ebscn-input-element::-ms-reveal {
|
|
61
61
|
display: none;
|
|
62
62
|
}
|
|
63
|
-
.
|
|
63
|
+
.ebscn-input-element::-webkit-search-cancel-button {
|
|
64
64
|
display: none;
|
|
65
65
|
}
|
|
66
|
-
.
|
|
66
|
+
.ebscn-input-element::-webkit-search-decoration {
|
|
67
67
|
display: none;
|
|
68
68
|
}
|
|
69
|
-
.
|
|
69
|
+
.ebscn-input-element:disabled {
|
|
70
70
|
opacity: 1;
|
|
71
71
|
}
|
|
72
|
-
.
|
|
73
|
-
.
|
|
74
|
-
.
|
|
72
|
+
.ebscn-input-element[type='date'],
|
|
73
|
+
.ebscn-input-element[type='time'],
|
|
74
|
+
.ebscn-input-element[type='datetime-local'] {
|
|
75
75
|
min-height: 1.5em;
|
|
76
76
|
}
|
|
77
|
-
.
|
|
77
|
+
.ebscn-input-element[type='search'] {
|
|
78
78
|
-webkit-appearance: none;
|
|
79
79
|
}
|
|
80
|
-
.
|
|
80
|
+
.ebscn-input-element[readonly] {
|
|
81
81
|
pointer-events: none;
|
|
82
82
|
}
|
|
83
|
-
.
|
|
83
|
+
.ebscn-input-clear {
|
|
84
84
|
flex: none;
|
|
85
85
|
margin-left: 8px;
|
|
86
|
-
color: var(--
|
|
86
|
+
color: var(--ebscn-color-light);
|
|
87
87
|
padding: 4px;
|
|
88
88
|
cursor: pointer;
|
|
89
89
|
}
|
|
90
|
-
.
|
|
91
|
-
color: var(--
|
|
90
|
+
.ebscn-input-clear:active {
|
|
91
|
+
color: var(--ebscn-color-weak);
|
|
92
92
|
}
|
|
93
|
-
.
|
|
93
|
+
.ebscn-input-clear .antd-mobile-icon {
|
|
94
94
|
display: block;
|
|
95
|
-
font-size: var(--
|
|
95
|
+
font-size: var(--ebscn-font-size-7);
|
|
96
96
|
}
|
|
@@ -7,7 +7,7 @@ import classNames from 'classnames';
|
|
|
7
7
|
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
8
8
|
import { bound } from '../../utils/bound';
|
|
9
9
|
import { isIOS } from '../../utils/validate';
|
|
10
|
-
var classPrefix = "
|
|
10
|
+
var classPrefix = "ebscn-input";
|
|
11
11
|
var defaultProps = {
|
|
12
12
|
defaultValue: '',
|
|
13
13
|
onlyShowClearWhenFocus: true
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './list.less';
|
|
3
|
+
export type { ListProps, ListRef } from './list';
|
|
4
|
+
export type { ListItemProps } from './list-item';
|
|
5
|
+
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
6
|
+
header?: import("react").ReactNode;
|
|
7
|
+
mode?: "default" | "card" | undefined;
|
|
8
|
+
children?: import("react").ReactNode;
|
|
9
|
+
} & {
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
style?: (import("react").CSSProperties & Partial<Record<"--font-size" | "--border-bottom" | "--active-background-color" | "--align-items" | "--border-inner" | "--border-top" | "--extra-max-width" | "--header-font-size" | "--padding-left" | "--padding-right" | "--prefix-padding-right" | "--prefix-width", string>>) | undefined;
|
|
12
|
+
tabIndex?: number | undefined;
|
|
13
|
+
} & import("react").AriaAttributes & import("react").RefAttributes<import("./list").ListRef>> & {
|
|
14
|
+
Item: import("react").FC<import("./list-item").ListItemProps>;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FC, ReactNode } from 'react';
|
|
3
|
+
import { NativeProps } from '../../utils/native-props';
|
|
4
|
+
export type ListItemProps = {
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
prefix?: ReactNode;
|
|
9
|
+
extra?: ReactNode;
|
|
10
|
+
clickable?: boolean;
|
|
11
|
+
arrow?: boolean | ReactNode;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
14
|
+
} & NativeProps<'--prefix-width' | '--align-items' | '--active-background-color'>;
|
|
15
|
+
export declare const ListItem: FC<ListItemProps>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
3
|
+
import { RightOutline } from 'antd-mobile-icons';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { isNodeWithContent } from '../../utils/is-node-with-content';
|
|
6
|
+
var classPrefix = "ebscn-list-item";
|
|
7
|
+
export var ListItem = function (props) {
|
|
8
|
+
var _a;
|
|
9
|
+
var clickable = (_a = props.clickable) !== null && _a !== void 0 ? _a : !!props.onClick;
|
|
10
|
+
var arrow = props.arrow === undefined ? clickable : props.arrow;
|
|
11
|
+
var content = React.createElement("div", {
|
|
12
|
+
className: "".concat(classPrefix, "-content")
|
|
13
|
+
}, isNodeWithContent(props.prefix) && React.createElement("div", {
|
|
14
|
+
className: "".concat(classPrefix, "-content-prefix")
|
|
15
|
+
}, props.prefix), React.createElement("div", {
|
|
16
|
+
className: "".concat(classPrefix, "-content-main")
|
|
17
|
+
}, isNodeWithContent(props.title) && React.createElement("div", {
|
|
18
|
+
className: "".concat(classPrefix, "-title")
|
|
19
|
+
}, props.title), props.children, isNodeWithContent(props.description) && React.createElement("div", {
|
|
20
|
+
className: "".concat(classPrefix, "-description")
|
|
21
|
+
}, props.description)), isNodeWithContent(props.extra) && React.createElement("div", {
|
|
22
|
+
className: "".concat(classPrefix, "-content-extra")
|
|
23
|
+
}, props.extra), isNodeWithContent(arrow) && React.createElement("div", {
|
|
24
|
+
className: "".concat(classPrefix, "-content-arrow")
|
|
25
|
+
}, arrow === true ? React.createElement(RightOutline, null) : arrow));
|
|
26
|
+
return withNativeProps(props, React.createElement(clickable ? 'a' : 'div', {
|
|
27
|
+
className: classNames("".concat(classPrefix), clickable ? ['ebscn-plain-anchor'] : [], props.disabled && "".concat(classPrefix, "-disabled")),
|
|
28
|
+
onClick: props.disabled ? undefined : props.onClick
|
|
29
|
+
}, content));
|
|
30
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
.ebscn-list {
|
|
2
|
+
--header-font-size: var(--ebscn-font-size-7);
|
|
3
|
+
--prefix-width: 'auto';
|
|
4
|
+
--prefix-padding-right: 12px;
|
|
5
|
+
--align-items: center;
|
|
6
|
+
--active-background-color: var(--ebscn-color-border);
|
|
7
|
+
--border-inner: solid 1px var(--ebscn-color-border);
|
|
8
|
+
--border-top: solid 1px var(--ebscn-color-border);
|
|
9
|
+
--border-bottom: solid 1px var(--ebscn-color-border);
|
|
10
|
+
--padding-left: 12px;
|
|
11
|
+
--padding-right: 12px;
|
|
12
|
+
--font-size: var(--ebscn-font-size-9);
|
|
13
|
+
--extra-max-width: 70%;
|
|
14
|
+
}
|
|
15
|
+
.ebscn-list-header {
|
|
16
|
+
color: var(--ebscn-color-weak);
|
|
17
|
+
font-size: var(--header-font-size);
|
|
18
|
+
padding: 8px var(--padding-right) 8px var(--padding-left);
|
|
19
|
+
}
|
|
20
|
+
.ebscn-list-body {
|
|
21
|
+
background-color: var(--ebscn-color-background);
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
font-size: var(--font-size);
|
|
24
|
+
}
|
|
25
|
+
.ebscn-list-body-inner {
|
|
26
|
+
margin-top: -1px;
|
|
27
|
+
}
|
|
28
|
+
.ebscn-list-default .ebscn-list-body {
|
|
29
|
+
border-bottom: var(--border-bottom);
|
|
30
|
+
}
|
|
31
|
+
.ebscn-list-card {
|
|
32
|
+
margin: 12px;
|
|
33
|
+
}
|
|
34
|
+
.ebscn-list-card .ebscn-list-body {
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
}
|
|
37
|
+
.ebscn-list-card .ebscn-list-header {
|
|
38
|
+
padding-left: 0;
|
|
39
|
+
}
|
|
40
|
+
.ebscn-list-item {
|
|
41
|
+
display: block;
|
|
42
|
+
padding-left: var(--padding-left);
|
|
43
|
+
position: relative;
|
|
44
|
+
background-color: var(--ebscn-color-background);
|
|
45
|
+
line-height: 1.5;
|
|
46
|
+
}
|
|
47
|
+
.ebscn-list-item-title,
|
|
48
|
+
.ebscn-list-item-description {
|
|
49
|
+
color: var(--ebscn-color-weak);
|
|
50
|
+
font-size: var(--ebscn-font-size-main);
|
|
51
|
+
}
|
|
52
|
+
.ebscn-list-item-content {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: var(--align-items);
|
|
55
|
+
justify-content: flex-start;
|
|
56
|
+
border-top: var(--border-inner);
|
|
57
|
+
padding-right: var(--padding-right);
|
|
58
|
+
}
|
|
59
|
+
.ebscn-list-item-content-prefix {
|
|
60
|
+
width: var(--prefix-width);
|
|
61
|
+
flex: none;
|
|
62
|
+
padding-right: var(--prefix-padding-right);
|
|
63
|
+
}
|
|
64
|
+
.ebscn-list-item-content-main {
|
|
65
|
+
flex: auto;
|
|
66
|
+
padding: 12px 0;
|
|
67
|
+
}
|
|
68
|
+
.ebscn-list-item-content-extra {
|
|
69
|
+
flex: none;
|
|
70
|
+
padding-left: 12px;
|
|
71
|
+
font-size: var(--ebscn-font-size-7);
|
|
72
|
+
color: var(--ebscn-color-weak);
|
|
73
|
+
max-width: var(--extra-max-width);
|
|
74
|
+
}
|
|
75
|
+
.ebscn-list-item-content-arrow {
|
|
76
|
+
flex: none;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
margin-left: 4px;
|
|
80
|
+
color: var(--ebscn-color-light);
|
|
81
|
+
font-size: 19px;
|
|
82
|
+
}
|
|
83
|
+
.ebscn-list-item-disabled {
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
}
|
|
86
|
+
.ebscn-list-item-disabled.ebscn-list-item-disabled > .ebscn-list-item-content > * {
|
|
87
|
+
opacity: 0.4;
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
}
|
|
90
|
+
a.ebscn-list-item:active:not(.ebscn-list-item-disabled) {
|
|
91
|
+
background-color: var(--active-background-color);
|
|
92
|
+
}
|
|
93
|
+
a.ebscn-list-item:active:not(.ebscn-list-item-disabled)::after {
|
|
94
|
+
content: ' ';
|
|
95
|
+
display: block;
|
|
96
|
+
position: absolute;
|
|
97
|
+
width: 100%;
|
|
98
|
+
bottom: -1px;
|
|
99
|
+
left: 0;
|
|
100
|
+
border-bottom: var(--border-inner);
|
|
101
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { NativeProps } from '../../utils/native-props';
|
|
4
|
+
export type ListProps = {
|
|
5
|
+
header?: ReactNode;
|
|
6
|
+
mode?: 'default' | 'card';
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
} & NativeProps<'--active-background-color' | '--align-items' | '--border-bottom' | '--border-inner' | '--border-top' | '--extra-max-width' | '--font-size' | '--header-font-size' | '--padding-left' | '--padding-right' | '--prefix-padding-right' | '--prefix-width'>;
|
|
9
|
+
export type ListRef = {
|
|
10
|
+
nativeElement: HTMLDivElement | null;
|
|
11
|
+
};
|
|
12
|
+
export declare const List: React.ForwardRefExoticComponent<{
|
|
13
|
+
header?: ReactNode;
|
|
14
|
+
mode?: "default" | "card" | undefined;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
} & {
|
|
17
|
+
className?: string | undefined;
|
|
18
|
+
style?: (React.CSSProperties & Partial<Record<"--font-size" | "--border-bottom" | "--active-background-color" | "--align-items" | "--border-inner" | "--border-top" | "--extra-max-width" | "--header-font-size" | "--padding-left" | "--padding-right" | "--prefix-padding-right" | "--prefix-width", string>>) | undefined;
|
|
19
|
+
tabIndex?: number | undefined;
|
|
20
|
+
} & React.AriaAttributes & React.RefAttributes<ListRef>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
4
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
5
|
+
var classPrefix = "ebscn-list";
|
|
6
|
+
var defaultProps = {
|
|
7
|
+
mode: 'default'
|
|
8
|
+
};
|
|
9
|
+
export var List = forwardRef(function (p, ref) {
|
|
10
|
+
var props = mergeProps(defaultProps, p);
|
|
11
|
+
var nativeElementRef = useRef(null);
|
|
12
|
+
useImperativeHandle(ref, function () {
|
|
13
|
+
return {
|
|
14
|
+
get nativeElement() {
|
|
15
|
+
return nativeElementRef.current;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return withNativeProps(props, React.createElement("div", {
|
|
20
|
+
className: classNames(classPrefix, "".concat(classPrefix, "-").concat(props.mode)),
|
|
21
|
+
ref: nativeElementRef
|
|
22
|
+
}, props.header && React.createElement("div", {
|
|
23
|
+
className: "".concat(classPrefix, "-header")
|
|
24
|
+
}, props.header), React.createElement("div", {
|
|
25
|
+
className: "".concat(classPrefix, "-body")
|
|
26
|
+
}, React.createElement("div", {
|
|
27
|
+
className: "".concat(classPrefix, "-body-inner")
|
|
28
|
+
}, props.children))));
|
|
29
|
+
});
|