systemrobotassistant 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of systemrobotassistant might be problematic. Click here for more details.
- package/.eslintignore +6 -0
- package/.eslintrc +45 -0
- package/.gitlab-ci.yml +52 -0
- package/.lecprc.ts +76 -0
- package/.yarnrc +1 -0
- package/CHANGELOG.md +114 -0
- package/README.md +14 -0
- package/custom-amd-plugin.ts +46 -0
- package/es/component/answer-itme/index.d.ts +20 -0
- package/es/component/answer-itme/index.d.ts.map +1 -0
- package/es/component/answer-itme/index.js +41 -0
- package/es/component/answer-itme/style.css +35 -0
- package/es/component/data-container/index.d.ts +19 -0
- package/es/component/data-container/index.d.ts.map +1 -0
- package/es/component/data-container/index.js +37 -0
- package/es/component/data-container/style.css +26 -0
- package/es/component/days-tab/index.d.ts +6 -0
- package/es/component/days-tab/index.d.ts.map +1 -0
- package/es/component/days-tab/index.js +119 -0
- package/es/component/days-tab/style.css +43 -0
- package/es/component/days-tab/utils.d.ts +32 -0
- package/es/component/days-tab/utils.d.ts.map +1 -0
- package/es/component/days-tab/utils.js +98 -0
- package/es/component/error-boundary/index.d.ts +2 -0
- package/es/component/error-boundary/index.d.ts.map +1 -0
- package/es/component/error-boundary/index.js +33 -0
- package/es/component/it-notice-modal/columns.d.ts +11 -0
- package/es/component/it-notice-modal/columns.d.ts.map +1 -0
- package/es/component/it-notice-modal/columns.js +108 -0
- package/es/component/it-notice-modal/double-tab.d.ts +6 -0
- package/es/component/it-notice-modal/double-tab.d.ts.map +1 -0
- package/es/component/it-notice-modal/double-tab.js +94 -0
- package/es/component/it-notice-modal/index.d.ts +6 -0
- package/es/component/it-notice-modal/index.d.ts.map +1 -0
- package/es/component/it-notice-modal/index.js +488 -0
- package/es/component/it-notice-modal/server.d.ts +8 -0
- package/es/component/it-notice-modal/server.d.ts.map +1 -0
- package/es/component/it-notice-modal/server.js +43 -0
- package/es/component/it-notice-modal/single-tab.d.ts +6 -0
- package/es/component/it-notice-modal/single-tab.d.ts.map +1 -0
- package/es/component/it-notice-modal/single-tab.js +82 -0
- package/es/component/it-notice-modal/style.css +301 -0
- package/es/component/it-notice-modal/utils.d.ts +2 -0
- package/es/component/it-notice-modal/utils.d.ts.map +1 -0
- package/es/component/it-notice-modal/utils.js +8 -0
- package/es/component/it-notice-tab/index.d.ts +6 -0
- package/es/component/it-notice-tab/index.d.ts.map +1 -0
- package/es/component/it-notice-tab/index.js +206 -0
- package/es/component/it-notice-tab/server.d.ts +3 -0
- package/es/component/it-notice-tab/server.d.ts.map +1 -0
- package/es/component/it-notice-tab/server.js +13 -0
- package/es/component/it-notice-tab/style.css +103 -0
- package/es/component/mail-list-modal/index.d.ts +2 -0
- package/es/component/mail-list-modal/index.d.ts.map +1 -0
- package/es/component/mail-list-modal/index.js +306 -0
- package/es/component/mail-list-modal/server.d.ts +7 -0
- package/es/component/mail-list-modal/server.d.ts.map +1 -0
- package/es/component/mail-list-modal/server.js +38 -0
- package/es/component/mail-list-modal/style.css +132 -0
- package/es/component/myself-chat-card/index.d.ts +15 -0
- package/es/component/myself-chat-card/index.d.ts.map +1 -0
- package/es/component/myself-chat-card/index.js +25 -0
- package/es/component/myself-chat-card/style.css +22 -0
- package/es/component/need-answer/index.d.ts +15 -0
- package/es/component/need-answer/index.d.ts.map +1 -0
- package/es/component/need-answer/index.js +60 -0
- package/es/component/need-answer/style.css +19 -0
- package/es/component/opppsition-chat-card/index.d.ts +11 -0
- package/es/component/opppsition-chat-card/index.d.ts.map +1 -0
- package/es/component/opppsition-chat-card/index.js +25 -0
- package/es/component/opppsition-chat-card/style.css +23 -0
- package/es/component/question-library/index.d.ts +10 -0
- package/es/component/question-library/index.d.ts.map +1 -0
- package/es/component/question-library/index.js +291 -0
- package/es/component/question-library/server.d.ts +4 -0
- package/es/component/question-library/server.d.ts.map +1 -0
- package/es/component/question-library/server.js +19 -0
- package/es/component/question-library/style.css +75 -0
- package/es/component/question-tag/index.d.ts +11 -0
- package/es/component/question-tag/index.d.ts.map +1 -0
- package/es/component/question-tag/index.js +23 -0
- package/es/component/question-tag/style.css +12 -0
- package/es/component/recommend-questions-card/index.d.ts +10 -0
- package/es/component/recommend-questions-card/index.d.ts.map +1 -0
- package/es/component/recommend-questions-card/index.js +104 -0
- package/es/component/recommend-questions-card/style.css +54 -0
- package/es/component/scroll-view/index.d.ts +3 -0
- package/es/component/scroll-view/index.d.ts.map +1 -0
- package/es/component/scroll-view/index.js +2 -0
- package/es/component/scroll-view/scroll-view.d.ts +18 -0
- package/es/component/scroll-view/scroll-view.d.ts.map +1 -0
- package/es/component/scroll-view/scroll-view.js +66 -0
- package/es/component/scroll-view/style.css +34 -0
- package/es/component/tab/index.d.ts +2 -0
- package/es/component/tab/index.d.ts.map +1 -0
- package/es/component/tab/index.js +18 -0
- package/es/component/tab/style.css +26 -0
- package/es/component/tips-answer/index.d.ts +15 -0
- package/es/component/tips-answer/index.d.ts.map +1 -0
- package/es/component/tips-answer/index.js +28 -0
- package/es/component/tips-answer/style.css +10 -0
- package/es/images/expire-robot.svg +16 -0
- package/es/images/pc-invalid.svg +11 -0
- package/es/images/screenshot-5.png +0 -0
- package/es/index.d.ts +92 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +506 -0
- package/es/js/const.d.ts +41 -0
- package/es/js/const.d.ts.map +1 -0
- package/es/js/const.js +46 -0
- package/es/js/gen-render-promise.d.ts +9 -0
- package/es/js/gen-render-promise.d.ts.map +1 -0
- package/es/js/gen-render-promise.js +30 -0
- package/es/js/get-time.d.ts +15 -0
- package/es/js/get-time.d.ts.map +1 -0
- package/es/js/get-time.js +35 -0
- package/es/js/hfc-space.d.ts +16 -0
- package/es/js/hfc-space.d.ts.map +1 -0
- package/es/js/hfc-space.js +71 -0
- package/es/js/render-special.d.ts +16 -0
- package/es/js/render-special.d.ts.map +1 -0
- package/es/js/render-special.js +53 -0
- package/es/js/request/fetch.d.ts +10 -0
- package/es/js/request/fetch.d.ts.map +1 -0
- package/es/js/request/fetch.js +81 -0
- package/es/js/request/request.d.ts +3 -0
- package/es/js/request/request.d.ts.map +1 -0
- package/es/js/request/request.js +63 -0
- package/es/js/showMessage.d.ts +15 -0
- package/es/js/showMessage.d.ts.map +1 -0
- package/es/js/showMessage.js +75 -0
- package/es/js/state-immer.d.ts +3 -0
- package/es/js/state-immer.d.ts.map +1 -0
- package/es/js/state-immer.js +19 -0
- package/es/js/timer-executor.d.ts +3 -0
- package/es/js/timer-executor.d.ts.map +1 -0
- package/es/js/timer-executor.js +83 -0
- package/es/js/to-hfc.d.ts +2 -0
- package/es/js/to-hfc.d.ts.map +1 -0
- package/es/js/to-hfc.js +8 -0
- package/es/js/utils.d.ts +3 -0
- package/es/js/utils.d.ts.map +1 -0
- package/es/js/utils.js +11 -0
- package/es/jsx/chat-modal.d.ts +16 -0
- package/es/jsx/chat-modal.d.ts.map +1 -0
- package/es/jsx/chat-modal.js +268 -0
- package/es/server.d.ts +8 -0
- package/es/server.d.ts.map +1 -0
- package/es/server.js +44 -0
- package/es/style.css +174 -0
- package/lib/component/answer-itme/index.d.ts +20 -0
- package/lib/component/answer-itme/index.d.ts.map +1 -0
- package/lib/component/answer-itme/index.js +51 -0
- package/lib/component/answer-itme/style.css +35 -0
- package/lib/component/data-container/index.d.ts +19 -0
- package/lib/component/data-container/index.d.ts.map +1 -0
- package/lib/component/data-container/index.js +45 -0
- package/lib/component/data-container/style.css +26 -0
- package/lib/component/days-tab/index.d.ts +6 -0
- package/lib/component/days-tab/index.d.ts.map +1 -0
- package/lib/component/days-tab/index.js +129 -0
- package/lib/component/days-tab/style.css +43 -0
- package/lib/component/days-tab/utils.d.ts +32 -0
- package/lib/component/days-tab/utils.d.ts.map +1 -0
- package/lib/component/days-tab/utils.js +110 -0
- package/lib/component/error-boundary/index.d.ts +2 -0
- package/lib/component/error-boundary/index.d.ts.map +1 -0
- package/lib/component/error-boundary/index.js +40 -0
- package/lib/component/it-notice-modal/columns.d.ts +11 -0
- package/lib/component/it-notice-modal/columns.d.ts.map +1 -0
- package/lib/component/it-notice-modal/columns.js +116 -0
- package/lib/component/it-notice-modal/double-tab.d.ts +6 -0
- package/lib/component/it-notice-modal/double-tab.d.ts.map +1 -0
- package/lib/component/it-notice-modal/double-tab.js +104 -0
- package/lib/component/it-notice-modal/index.d.ts +6 -0
- package/lib/component/it-notice-modal/index.d.ts.map +1 -0
- package/lib/component/it-notice-modal/index.js +499 -0
- package/lib/component/it-notice-modal/server.d.ts +8 -0
- package/lib/component/it-notice-modal/server.d.ts.map +1 -0
- package/lib/component/it-notice-modal/server.js +55 -0
- package/lib/component/it-notice-modal/single-tab.d.ts +6 -0
- package/lib/component/it-notice-modal/single-tab.d.ts.map +1 -0
- package/lib/component/it-notice-modal/single-tab.js +92 -0
- package/lib/component/it-notice-modal/style.css +301 -0
- package/lib/component/it-notice-modal/utils.d.ts +2 -0
- package/lib/component/it-notice-modal/utils.d.ts.map +1 -0
- package/lib/component/it-notice-modal/utils.js +15 -0
- package/lib/component/it-notice-tab/index.d.ts +6 -0
- package/lib/component/it-notice-tab/index.d.ts.map +1 -0
- package/lib/component/it-notice-tab/index.js +216 -0
- package/lib/component/it-notice-tab/server.d.ts +3 -0
- package/lib/component/it-notice-tab/server.d.ts.map +1 -0
- package/lib/component/it-notice-tab/server.js +20 -0
- package/lib/component/it-notice-tab/style.css +103 -0
- package/lib/component/mail-list-modal/index.d.ts +2 -0
- package/lib/component/mail-list-modal/index.d.ts.map +1 -0
- package/lib/component/mail-list-modal/index.js +316 -0
- package/lib/component/mail-list-modal/server.d.ts +7 -0
- package/lib/component/mail-list-modal/server.d.ts.map +1 -0
- package/lib/component/mail-list-modal/server.js +50 -0
- package/lib/component/mail-list-modal/style.css +132 -0
- package/lib/component/myself-chat-card/index.d.ts +15 -0
- package/lib/component/myself-chat-card/index.d.ts.map +1 -0
- package/lib/component/myself-chat-card/index.js +35 -0
- package/lib/component/myself-chat-card/style.css +22 -0
- package/lib/component/need-answer/index.d.ts +15 -0
- package/lib/component/need-answer/index.d.ts.map +1 -0
- package/lib/component/need-answer/index.js +70 -0
- package/lib/component/need-answer/style.css +19 -0
- package/lib/component/opppsition-chat-card/index.d.ts +11 -0
- package/lib/component/opppsition-chat-card/index.d.ts.map +1 -0
- package/lib/component/opppsition-chat-card/index.js +35 -0
- package/lib/component/opppsition-chat-card/style.css +23 -0
- package/lib/component/question-library/index.d.ts +10 -0
- package/lib/component/question-library/index.d.ts.map +1 -0
- package/lib/component/question-library/index.js +301 -0
- package/lib/component/question-library/server.d.ts +4 -0
- package/lib/component/question-library/server.d.ts.map +1 -0
- package/lib/component/question-library/server.js +27 -0
- package/lib/component/question-library/style.css +75 -0
- package/lib/component/question-tag/index.d.ts +11 -0
- package/lib/component/question-tag/index.d.ts.map +1 -0
- package/lib/component/question-tag/index.js +33 -0
- package/lib/component/question-tag/style.css +12 -0
- package/lib/component/recommend-questions-card/index.d.ts +10 -0
- package/lib/component/recommend-questions-card/index.d.ts.map +1 -0
- package/lib/component/recommend-questions-card/index.js +114 -0
- package/lib/component/recommend-questions-card/style.css +54 -0
- package/lib/component/scroll-view/index.d.ts +3 -0
- package/lib/component/scroll-view/index.d.ts.map +1 -0
- package/lib/component/scroll-view/index.js +10 -0
- package/lib/component/scroll-view/scroll-view.d.ts +18 -0
- package/lib/component/scroll-view/scroll-view.d.ts.map +1 -0
- package/lib/component/scroll-view/scroll-view.js +76 -0
- package/lib/component/scroll-view/style.css +34 -0
- package/lib/component/tab/index.d.ts +2 -0
- package/lib/component/tab/index.d.ts.map +1 -0
- package/lib/component/tab/index.js +28 -0
- package/lib/component/tab/style.css +26 -0
- package/lib/component/tips-answer/index.d.ts +15 -0
- package/lib/component/tips-answer/index.d.ts.map +1 -0
- package/lib/component/tips-answer/index.js +38 -0
- package/lib/component/tips-answer/style.css +10 -0
- package/lib/images/expire-robot.svg +16 -0
- package/lib/images/pc-invalid.svg +11 -0
- package/lib/images/screenshot-5.png +0 -0
- package/lib/index.d.ts +92 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +516 -0
- package/lib/js/const.d.ts +41 -0
- package/lib/js/const.d.ts.map +1 -0
- package/lib/js/const.js +55 -0
- package/lib/js/gen-render-promise.d.ts +9 -0
- package/lib/js/gen-render-promise.d.ts.map +1 -0
- package/lib/js/gen-render-promise.js +37 -0
- package/lib/js/get-time.d.ts +15 -0
- package/lib/js/get-time.d.ts.map +1 -0
- package/lib/js/get-time.js +43 -0
- package/lib/js/hfc-space.d.ts +16 -0
- package/lib/js/hfc-space.d.ts.map +1 -0
- package/lib/js/hfc-space.js +91 -0
- package/lib/js/render-special.d.ts +16 -0
- package/lib/js/render-special.d.ts.map +1 -0
- package/lib/js/render-special.js +61 -0
- package/lib/js/request/fetch.d.ts +10 -0
- package/lib/js/request/fetch.d.ts.map +1 -0
- package/lib/js/request/fetch.js +88 -0
- package/lib/js/request/request.d.ts +3 -0
- package/lib/js/request/request.d.ts.map +1 -0
- package/lib/js/request/request.js +71 -0
- package/lib/js/showMessage.d.ts +15 -0
- package/lib/js/showMessage.d.ts.map +1 -0
- package/lib/js/showMessage.js +83 -0
- package/lib/js/state-immer.d.ts +3 -0
- package/lib/js/state-immer.d.ts.map +1 -0
- package/lib/js/state-immer.js +27 -0
- package/lib/js/timer-executor.d.ts +3 -0
- package/lib/js/timer-executor.d.ts.map +1 -0
- package/lib/js/timer-executor.js +91 -0
- package/lib/js/to-hfc.d.ts +2 -0
- package/lib/js/to-hfc.d.ts.map +1 -0
- package/lib/js/to-hfc.js +14 -0
- package/lib/js/utils.d.ts +3 -0
- package/lib/js/utils.d.ts.map +1 -0
- package/lib/js/utils.js +19 -0
- package/lib/jsx/chat-modal.d.ts +16 -0
- package/lib/jsx/chat-modal.d.ts.map +1 -0
- package/lib/jsx/chat-modal.js +278 -0
- package/lib/server.d.ts +8 -0
- package/lib/server.d.ts.map +1 -0
- package/lib/server.js +58 -0
- package/lib/style.css +174 -0
- package/package.json +57 -0
- package/rct.config.js +8 -0
- package/src/component/answer-itme/index.jsx +64 -0
- package/src/component/answer-itme/style.less +37 -0
- package/src/component/data-container/index.jsx +45 -0
- package/src/component/data-container/style.less +27 -0
- package/src/component/days-tab/index.jsx +114 -0
- package/src/component/days-tab/style.less +55 -0
- package/src/component/days-tab/utils.js +87 -0
- package/src/component/error-boundary/index.jsx +39 -0
- package/src/component/it-notice-modal/columns.js +102 -0
- package/src/component/it-notice-modal/double-tab.jsx +83 -0
- package/src/component/it-notice-modal/index.jsx +404 -0
- package/src/component/it-notice-modal/server.js +43 -0
- package/src/component/it-notice-modal/single-tab.jsx +70 -0
- package/src/component/it-notice-modal/style.less +367 -0
- package/src/component/it-notice-modal/utils.js +8 -0
- package/src/component/it-notice-tab/index.jsx +196 -0
- package/src/component/it-notice-tab/server.js +14 -0
- package/src/component/it-notice-tab/style.less +120 -0
- package/src/component/mail-list-modal/index.jsx +270 -0
- package/src/component/mail-list-modal/server.js +38 -0
- package/src/component/mail-list-modal/style.less +154 -0
- package/src/component/myself-chat-card/index.jsx +27 -0
- package/src/component/myself-chat-card/style.less +30 -0
- package/src/component/need-answer/index.jsx +56 -0
- package/src/component/need-answer/style.less +21 -0
- package/src/component/opppsition-chat-card/index.jsx +25 -0
- package/src/component/opppsition-chat-card/style.less +33 -0
- package/src/component/question-library/index.jsx +316 -0
- package/src/component/question-library/server.js +19 -0
- package/src/component/question-library/style.less +102 -0
- package/src/component/question-tag/index.jsx +27 -0
- package/src/component/question-tag/style.less +15 -0
- package/src/component/recommend-questions-card/index.jsx +111 -0
- package/src/component/recommend-questions-card/style.less +66 -0
- package/src/component/scroll-view/index.js +3 -0
- package/src/component/scroll-view/scroll-view.jsx +74 -0
- package/src/component/scroll-view/style.less +37 -0
- package/src/component/tab/index.jsx +17 -0
- package/src/component/tab/style.less +26 -0
- package/src/component/tips-answer/index.jsx +38 -0
- package/src/component/tips-answer/style.less +11 -0
- package/src/images/expire-robot.svg +16 -0
- package/src/images/pc-invalid.svg +11 -0
- package/src/images/screenshot-5.png +0 -0
- package/src/index.jsx +554 -0
- package/src/js/const.js +48 -0
- package/src/js/gen-render-promise.js +32 -0
- package/src/js/get-time.js +35 -0
- package/src/js/hfc-space.js +91 -0
- package/src/js/render-special.js +64 -0
- package/src/js/request/fetch.js +87 -0
- package/src/js/request/request.js +74 -0
- package/src/js/showMessage.js +81 -0
- package/src/js/state-immer.js +12 -0
- package/src/js/timer-executor.js +37 -0
- package/src/js/to-hfc.js +9 -0
- package/src/js/utils.js +13 -0
- package/src/jsx/chat-modal.jsx +254 -0
- package/src/main.js +1 -0
- package/src/server.js +45 -0
- package/src/style.less +229 -0
- package/test/cases/case-01.assert.js +6 -0
- package/test/cases/case-01.source.jsx +17 -0
- package/test/cases/case-02.assert.js +6 -0
- package/test/cases/case-02.source.jsx +25 -0
- package/test/cases/case-02.style.less +15 -0
- package/test/cases/case-03.source.jsx +69 -0
- package/test/cases/case-03.style.less +3 -0
- package/tsconfig.json +48 -0
- package/typings.d.ts +5 -0
- package/umd/b415d90208c277ba3703.png +0 -0
- package/umd/index.css +1753 -0
- package/umd/index.js +36258 -0
- package/umd/index.min.css +1 -0
- package/umd/index.min.js +657 -0
package/.eslintignore
ADDED
package/.eslintrc
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"parser": "@typescript-eslint/parser",
|
3
|
+
"extends": [
|
4
|
+
"@shein/eslint-config/without-semi",
|
5
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
6
|
+
"plugin:@typescript-eslint/recommended"
|
7
|
+
],
|
8
|
+
"settings": {
|
9
|
+
"import/resolver": {
|
10
|
+
"node": {
|
11
|
+
"paths": [
|
12
|
+
"src"
|
13
|
+
],
|
14
|
+
"extensions": [
|
15
|
+
".js",
|
16
|
+
".ts",
|
17
|
+
".jsx",
|
18
|
+
".tsx"
|
19
|
+
]
|
20
|
+
},
|
21
|
+
"alias": [
|
22
|
+
[
|
23
|
+
"@shein-components/SystemRobotAssistant",
|
24
|
+
"./es"
|
25
|
+
]
|
26
|
+
]
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"rules": {
|
30
|
+
"import/extensions": [
|
31
|
+
"error",
|
32
|
+
"ignorePackages",
|
33
|
+
{
|
34
|
+
"js": "never",
|
35
|
+
"mjs": "never",
|
36
|
+
"jsx": "never",
|
37
|
+
"ts": "never",
|
38
|
+
"tsx": "never"
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"max-len": ["error", { "code": 150 }],
|
42
|
+
"react/jsx-one-expression-per-line": "off",
|
43
|
+
"@typescript-eslint/no-explicit-any": "off"
|
44
|
+
}
|
45
|
+
}
|
package/.gitlab-ci.yml
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
image: shein/nodejs-svn
|
2
|
+
before_script:
|
3
|
+
- export COMP_NAME=SystemRobotAssistant
|
4
|
+
stages:
|
5
|
+
- test
|
6
|
+
- build
|
7
|
+
- deploy
|
8
|
+
ut:
|
9
|
+
stage: test
|
10
|
+
script:
|
11
|
+
- yarn
|
12
|
+
- yarn build
|
13
|
+
only:
|
14
|
+
- master
|
15
|
+
tags:
|
16
|
+
- web
|
17
|
+
variables:
|
18
|
+
NODE_VERSION: 18
|
19
|
+
cache:
|
20
|
+
key: "$CI_PROJECT_NAME"
|
21
|
+
paths:
|
22
|
+
- node_modules/
|
23
|
+
doc:
|
24
|
+
stage: build
|
25
|
+
variables:
|
26
|
+
NODE_VERSION: 18
|
27
|
+
script:
|
28
|
+
- echo ${DOC_PUB_URL}project/$COMP_NAME
|
29
|
+
- export GIT_REPO=$(echo $CI_PROJECT_URL | sed -e "s|$GIT_ADDR_INNER|$GIT_ADDR_OUTER|g")
|
30
|
+
- echo $GIT_REPO
|
31
|
+
- yarn
|
32
|
+
- yarn doc
|
33
|
+
- npx rct doc:publish --DOC_PUB_URL=${DOC_PUB_URL} --DOC_PUB_TOKEN=${DOC_PUB_TOKEN}
|
34
|
+
only:
|
35
|
+
- /^doc_v.*$/
|
36
|
+
tags:
|
37
|
+
- web
|
38
|
+
publish:
|
39
|
+
stage: deploy
|
40
|
+
script:
|
41
|
+
- yarn
|
42
|
+
- yarn build
|
43
|
+
only:
|
44
|
+
- /^release_v.*$/
|
45
|
+
variables:
|
46
|
+
NODE_VERSION: 18
|
47
|
+
tags:
|
48
|
+
- web
|
49
|
+
cache:
|
50
|
+
key: "$CI_PROJECT_NAME"
|
51
|
+
paths:
|
52
|
+
- node_modules/
|
package/.lecprc.ts
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
import { defineConfig } from '@shein/react-component-tool'
|
2
|
+
import { name, version } from './package.json'
|
3
|
+
import CustomAMDPlugin from './custom-amd-plugin'
|
4
|
+
|
5
|
+
const externals = {
|
6
|
+
'prop-types': {
|
7
|
+
root: 'PropTypes',
|
8
|
+
amd: 'prop-types',
|
9
|
+
commonjs: 'prop-types',
|
10
|
+
commonjs2: 'prop-types'
|
11
|
+
},
|
12
|
+
react: {
|
13
|
+
root: 'React',
|
14
|
+
amd: 'react',
|
15
|
+
commonjs: 'react',
|
16
|
+
commonjs2: 'react'
|
17
|
+
},
|
18
|
+
'react-dom': {
|
19
|
+
root: 'ReactDOM',
|
20
|
+
amd: 'react-dom',
|
21
|
+
commonjs: 'react-dom',
|
22
|
+
commonjs2: 'react-dom'
|
23
|
+
},
|
24
|
+
shineout: {
|
25
|
+
root: 'Shineout',
|
26
|
+
amd: 'shineout',
|
27
|
+
commonjs: 'shineout',
|
28
|
+
commonjs2: 'shineout'
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
export default defineConfig({
|
33
|
+
dts: true,
|
34
|
+
esm: {
|
35
|
+
type: 'babel',
|
36
|
+
outDir: 'es',
|
37
|
+
},
|
38
|
+
cjs: {
|
39
|
+
type: 'babel',
|
40
|
+
outDir: 'lib',
|
41
|
+
},
|
42
|
+
umd: {
|
43
|
+
type: 'webpack',
|
44
|
+
outDir: 'umd',
|
45
|
+
name: name.replace('@shein-components/', ''),
|
46
|
+
externals,
|
47
|
+
// 为静态资源添加 cdn 前缀,防止 publicPath auto 的情况
|
48
|
+
modifyWebpackConfig: (config) => {
|
49
|
+
if (config.mode !== 'production') {
|
50
|
+
return config
|
51
|
+
}
|
52
|
+
// @ts-ignore
|
53
|
+
config.output.library.umdNamedDefine = true
|
54
|
+
// 定制了 amd 加载器,HFC-robot 组件内部自定义了 amd 加载器
|
55
|
+
// @ts-ignore
|
56
|
+
config.plugins.push(new CustomAMDPlugin(Object.keys(externals)))
|
57
|
+
config.output.publicPath = `https://assets.dotfashion.cn/unpkg/${name}@${version}/umd/`
|
58
|
+
config?.module?.rules?.forEach((r) => {
|
59
|
+
// @ts-ignore
|
60
|
+
if (r.oneOf) {
|
61
|
+
// @ts-ignore
|
62
|
+
r.oneOf.forEach((rule) => {
|
63
|
+
if (rule?.test && /svg|png/.test(rule?.test.toString() ?? '')) {
|
64
|
+
rule.generator = {
|
65
|
+
publicPath: `https://assets.dotfashion.cn/unpkg/${name}@${version}/umd/`,
|
66
|
+
}
|
67
|
+
}
|
68
|
+
})
|
69
|
+
}
|
70
|
+
})
|
71
|
+
return config
|
72
|
+
}
|
73
|
+
},
|
74
|
+
cssModules: name.replace('@', '').replace('/', '_').toLocaleLowerCase() + '_[local]',
|
75
|
+
sourcemap: false
|
76
|
+
})
|
package/.yarnrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
registry "https://npmjs.sheincorp.cn"
|
package/CHANGELOG.md
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# 0.0.1
|
2
|
+
`2020-02-20`
|
3
|
+
|
4
|
+
- 🌟 完成基本功能
|
5
|
+
# 1.0.16
|
6
|
+
- 样式修改(主要是ui改版)
|
7
|
+
|
8
|
+
# 1.0.17
|
9
|
+
- 交互修改,可以点击外层关闭,到边距缩小图标
|
10
|
+
|
11
|
+
# 1.0.18
|
12
|
+
`2023-04-14`
|
13
|
+
- 阻止了事件冒泡的问题修复
|
14
|
+
|
15
|
+
# 1.0.23
|
16
|
+
`2023-04-14`
|
17
|
+
- 增加有事找他分组的功能
|
18
|
+
|
19
|
+
# 1.0.24
|
20
|
+
`2023-04-18`
|
21
|
+
- 报障按钮的样式调整
|
22
|
+
|
23
|
+
# 2.0.0
|
24
|
+
`2023-04-25`
|
25
|
+
- 增加属性以调整初始图标的位置和大小
|
26
|
+
|
27
|
+
# 2.0.1
|
28
|
+
`2023-05-08`
|
29
|
+
- 有事找他-搜索实时交互
|
30
|
+
|
31
|
+
# 2.1.0
|
32
|
+
`2023-05-12`
|
33
|
+
- 新增IT信息功能
|
34
|
+
|
35
|
+
# 2.2.0
|
36
|
+
`2023-05-15`
|
37
|
+
- 新增renderIcon、draggable属性
|
38
|
+
|
39
|
+
# 2.3.2
|
40
|
+
`2023-05-15`
|
41
|
+
- 整合了2.1.0和2.2.0的版本,增加登录失效提示功能
|
42
|
+
|
43
|
+
# 2.3.3(有问题)
|
44
|
+
`2023-06-12`
|
45
|
+
- 修复it通告周末弹出问题,menusTitle是非必填
|
46
|
+
|
47
|
+
# 2.3.4(有问题)
|
48
|
+
`2023-06-14`
|
49
|
+
- 点击企微找ta功能刷新埋点数据
|
50
|
+
|
51
|
+
# 2.3.5
|
52
|
+
`2023-06-30`
|
53
|
+
- it通告改版
|
54
|
+
|
55
|
+
# 2.3.5-rc.5
|
56
|
+
`2023-07-05`
|
57
|
+
- 版本计划交互和样式优化
|
58
|
+
|
59
|
+
# 2.3.5-rc.7
|
60
|
+
`2023-07-05`
|
61
|
+
- 新增chatgpt入口(点击企微联系人根据(userType)类型字段判断,1是企微,2是跳转chatgpt),新增chatgptUse属性,默认开启
|
62
|
+
|
63
|
+
# 2.3.5-rc.10
|
64
|
+
`2023-07-28`
|
65
|
+
- 优化交互
|
66
|
+
|
67
|
+
# 2.3.5-rc.11
|
68
|
+
`2023-07-28`
|
69
|
+
- 写法优化
|
70
|
+
|
71
|
+
# 2.3.5-rc.13
|
72
|
+
`2023-07-28`
|
73
|
+
- 样式优化、对接人的入参修改
|
74
|
+
|
75
|
+
# 3.0.0-rc.1
|
76
|
+
`2023-07-31`
|
77
|
+
- 大改版,对版本升级方式进行修改,此版本之后只需要安装@shein-components/HFCRobot,这个组件的版本配置请在hfc后台配置,否则不可用
|
78
|
+
|
79
|
+
# 3.0.0-rc.3
|
80
|
+
`2023-08-01`
|
81
|
+
- 去掉无用的api注释,下掉“进入帮助中心”入口
|
82
|
+
|
83
|
+
# 3.0.0-rc.4
|
84
|
+
`2023-08-03`
|
85
|
+
- 合并了2.3.5-rc.13的内容
|
86
|
+
|
87
|
+
# 3.0.0-rc.5
|
88
|
+
`2023-08-03`
|
89
|
+
- fix对接人问题(<3.0.0-rc.4)
|
90
|
+
|
91
|
+
# 3.0.1
|
92
|
+
`2023-08-10`
|
93
|
+
- it通告弹窗优化,优化renderIcon
|
94
|
+
|
95
|
+
# 3.0.2
|
96
|
+
`2023-08-22`
|
97
|
+
- 将静态资源放到cdn上,解决 alita build 时静态资源路径问题
|
98
|
+
- 升级构建工具 rct 到 2.1.21
|
99
|
+
|
100
|
+
# 3.0.4
|
101
|
+
`2023-08-28`
|
102
|
+
- 加上“进入帮助中心”入口
|
103
|
+
|
104
|
+
# 3.0.5
|
105
|
+
`2023-08-28`
|
106
|
+
- 修复没有请求通告问题
|
107
|
+
|
108
|
+
# 3.0.6
|
109
|
+
`2023-08-31`
|
110
|
+
- 接入多语言
|
111
|
+
|
112
|
+
# 3.0.7
|
113
|
+
`2023-09-08`
|
114
|
+
- 版本通告弹窗-去掉“下一条”的逻辑
|
package/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# SystemRobotAssistant
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
```bash
|
6
|
+
yarn build # build target library
|
7
|
+
yarn test # run test
|
8
|
+
yarn doc:dev # run dev server of document
|
9
|
+
yarn doc # generate document site
|
10
|
+
```
|
11
|
+
|
12
|
+
## Dependencies
|
13
|
+
|
14
|
+
[react-component-tool](https://gitlab.sheincorp.cn/div/so/react-component-tool)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
2
|
+
import webpack, { Compiler } from 'webpack'
|
3
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
4
|
+
import { OriginalSource } from 'webpack-sources'
|
5
|
+
|
6
|
+
class CustomAMDPlugin {
|
7
|
+
constructor(public externals: string[]) {
|
8
|
+
this.externals = externals
|
9
|
+
}
|
10
|
+
|
11
|
+
apply(compiler: Compiler) {
|
12
|
+
compiler.hooks.compilation.tap('CustomAMDPlugin', (compilation) => {
|
13
|
+
compilation.hooks.processAssets.tap({
|
14
|
+
name: 'CustomAMDPlugin',
|
15
|
+
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
|
16
|
+
}, (assets) => {
|
17
|
+
Object.keys(assets).forEach((filename) => {
|
18
|
+
if (filename.endsWith('.js')) { // 只对 JS 文件进行操作
|
19
|
+
const asset = assets[filename]
|
20
|
+
const content = asset.source().toString()
|
21
|
+
|
22
|
+
// 判断需要替换的位置是否存在
|
23
|
+
if (content.includes('typeof define === \'function\' && define.amd')) {
|
24
|
+
let newContent = content.replace(
|
25
|
+
'typeof define === \'function\' && define.amd',
|
26
|
+
'window.hfcDefine && window.hfcDefine.define',
|
27
|
+
)
|
28
|
+
newContent = newContent.replace(
|
29
|
+
`define("SystemRobotAssistant", ${JSON.stringify(this.externals).replaceAll('",', '", ')}, factory);`,
|
30
|
+
`window.hfcDefine.define("SystemRobotAssistant", ${JSON.stringify(this.externals)}, factory);\n`
|
31
|
+
+ ' else if(typeof define === \'function\' && define.amd)\n'
|
32
|
+
+ ` define("SystemRobotAssistant", ${JSON.stringify(this.externals)}, factory);`,
|
33
|
+
)
|
34
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
35
|
+
// @ts-ignore
|
36
|
+
// eslint-disable-next-line no-param-reassign
|
37
|
+
assets[filename] = new OriginalSource(newContent, filename)
|
38
|
+
}
|
39
|
+
}
|
40
|
+
})
|
41
|
+
})
|
42
|
+
})
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
export default CustomAMDPlugin
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
|
3
|
+
export interface AnswerItmeItem {
|
4
|
+
isHaveAnswer?: number;
|
5
|
+
problem?: string;
|
6
|
+
answer?: string;
|
7
|
+
answerList?: {
|
8
|
+
isHaveAnswer?: string;
|
9
|
+
problemTitle?: string;
|
10
|
+
}[];
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface AnswerItmeProps {
|
14
|
+
item?: AnswerItmeItem;
|
15
|
+
}
|
16
|
+
|
17
|
+
declare const AnswerItme: React.FC<AnswerItmeProps>;
|
18
|
+
|
19
|
+
export default AnswerItme;
|
20
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/component/answer-itme/index.jsx"],"names":[],"mappings":";AAKA,6DA0CE"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import React, { memo } from 'react';
|
2
|
+
import Proptypes from 'prop-types';
|
3
|
+
import { toHfc } from "../../js/to-hfc";
|
4
|
+
import "./style.css";
|
5
|
+
var styles = {
|
6
|
+
"answerTitle": "shein-components_systemrobotassistant_answerTitle",
|
7
|
+
"answerContent": "shein-components_systemrobotassistant_answerContent",
|
8
|
+
"otherAnswer": "shein-components_systemrobotassistant_otherAnswer",
|
9
|
+
"toHfc": "shein-components_systemrobotassistant_toHfc",
|
10
|
+
"onSeekHlep": "shein-components_systemrobotassistant_onSeekHlep",
|
11
|
+
"onDisabled": "shein-components_systemrobotassistant_onDisabled"
|
12
|
+
};
|
13
|
+
var AnswerItme = /*#__PURE__*/memo(props => {
|
14
|
+
var item = props.item,
|
15
|
+
t = props.t;
|
16
|
+
return /*#__PURE__*/React.createElement("div", null, item.isHaveAnswer === 0 ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
17
|
+
className: styles.otherAnswer
|
18
|
+
}, item.answer), t('找对接人'), t('寻求帮助')) : /*#__PURE__*/React.createElement("div", {
|
19
|
+
className: styles.answerTitle
|
20
|
+
}, t('你问的“{0}?”,找到以下问题:', item.problem)), item.isHaveAnswer !== 0 && item.answerList && item.answerList.map(vo => /*#__PURE__*/React.createElement("div", {
|
21
|
+
key: vo.problemId,
|
22
|
+
className: styles.answerContent,
|
23
|
+
onClick: () => {
|
24
|
+
var url = '/question/answer/';
|
25
|
+
var problemId = vo.problemId;
|
26
|
+
toHfc(url + problemId);
|
27
|
+
}
|
28
|
+
}, vo.problemTitle)));
|
29
|
+
});
|
30
|
+
AnswerItme.propTypes = {
|
31
|
+
item: Proptypes.shape({
|
32
|
+
isHaveAnswer: Proptypes.number,
|
33
|
+
problem: Proptypes.string,
|
34
|
+
answer: Proptypes.string,
|
35
|
+
answerList: Proptypes.arrayOf(Proptypes.shape({
|
36
|
+
isHaveAnswer: Proptypes.string,
|
37
|
+
problemTitle: Proptypes.string
|
38
|
+
}))
|
39
|
+
})
|
40
|
+
};
|
41
|
+
export default AnswerItme;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
.shein-components_systemrobotassistant_answerTitle {
|
2
|
+
font-size: 14px;
|
3
|
+
font-weight: 400;
|
4
|
+
}
|
5
|
+
.shein-components_systemrobotassistant_answerContent {
|
6
|
+
font-size: 14px;
|
7
|
+
font-weight: 400;
|
8
|
+
color: #1890FF;
|
9
|
+
color: var(--primary-color, #1890FF);
|
10
|
+
margin-top: 7px;
|
11
|
+
cursor: pointer;
|
12
|
+
}
|
13
|
+
.shein-components_systemrobotassistant_answerContent:hover {
|
14
|
+
color: #005AAD;
|
15
|
+
color: var(--primary-color, #005AAD);
|
16
|
+
}
|
17
|
+
.shein-components_systemrobotassistant_otherAnswer {
|
18
|
+
font-size: 14px;
|
19
|
+
font-weight: 400;
|
20
|
+
color: #35383D;
|
21
|
+
}
|
22
|
+
.shein-components_systemrobotassistant_toHfc {
|
23
|
+
color: #1890FF;
|
24
|
+
color: var(--primary-color, #1890FF);
|
25
|
+
cursor: pointer;
|
26
|
+
}
|
27
|
+
.shein-components_systemrobotassistant_onSeekHlep {
|
28
|
+
color: #1890FF;
|
29
|
+
color: var(--primary-color, #1890FF);
|
30
|
+
cursor: pointer;
|
31
|
+
}
|
32
|
+
.shein-components_systemrobotassistant_onDisabled {
|
33
|
+
color: #A5ACB8;
|
34
|
+
cursor: not-allowed;
|
35
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
|
3
|
+
export type DataContainerEmptyText = React.ReactNode | string | React.ReactElement<any>;
|
4
|
+
|
5
|
+
export type DataContainerChildren = React.ReactNode | React.ReactElement<any>;
|
6
|
+
|
7
|
+
export type DataContainerClassName = string | any[];
|
8
|
+
|
9
|
+
export interface DataContainerProps {
|
10
|
+
loading?: boolean;
|
11
|
+
emptyText?: DataContainerEmptyText;
|
12
|
+
children?: DataContainerChildren;
|
13
|
+
className?: DataContainerClassName;
|
14
|
+
}
|
15
|
+
|
16
|
+
declare const DataContainer: React.FC<DataContainerProps>;
|
17
|
+
|
18
|
+
export default DataContainer;
|
19
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/component/data-container/index.jsx"],"names":[],"mappings":";AASA,oFA0BC"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import classnames from 'classnames';
|
4
|
+
import { Spin } from 'shineout';
|
5
|
+
import Icon from '@shein-components/Icon';
|
6
|
+
import "./style.css";
|
7
|
+
var styles = {
|
8
|
+
"dataContainer": "shein-components_systemrobotassistant_dataContainer",
|
9
|
+
"emptyCon": "shein-components_systemrobotassistant_emptyCon",
|
10
|
+
"loadingMask": "shein-components_systemrobotassistant_loadingMask"
|
11
|
+
};
|
12
|
+
var cs = classnames.bind(styles);
|
13
|
+
var DataContainer = props => {
|
14
|
+
var loading = props.loading,
|
15
|
+
emptyText = props.emptyText,
|
16
|
+
className = props.className,
|
17
|
+
children = props.children;
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
19
|
+
className: cs(styles.dataContainer, className)
|
20
|
+
}, !children || Array.isArray(children) && !(children !== null && children !== void 0 && children.length) ? /*#__PURE__*/React.createElement("div", {
|
21
|
+
className: styles.emptyCon
|
22
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
23
|
+
name: "dataemptying_icon",
|
24
|
+
fontSize: 200
|
25
|
+
}), /*#__PURE__*/React.createElement("div", null, emptyText)) : children, loading ? /*#__PURE__*/React.createElement("div", {
|
26
|
+
className: cs(styles.loadingMask)
|
27
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
28
|
+
size: "48px"
|
29
|
+
})) : null);
|
30
|
+
};
|
31
|
+
DataContainer.propTypes = {
|
32
|
+
loading: PropTypes.bool,
|
33
|
+
emptyText: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.element]),
|
34
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.element]),
|
35
|
+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.array])
|
36
|
+
};
|
37
|
+
export default DataContainer;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
.shein-components_systemrobotassistant_dataContainer {
|
2
|
+
flex: 1;
|
3
|
+
}
|
4
|
+
.shein-components_systemrobotassistant_dataContainer .shein-components_systemrobotassistant_emptyCon {
|
5
|
+
height: 100%;
|
6
|
+
width: 100%;
|
7
|
+
display: flex;
|
8
|
+
align-items: center;
|
9
|
+
justify-content: center;
|
10
|
+
flex-direction: column;
|
11
|
+
flex: 1;
|
12
|
+
color: #1890ff;
|
13
|
+
color: var(--primary-color, #1890ff);
|
14
|
+
}
|
15
|
+
.shein-components_systemrobotassistant_loadingMask {
|
16
|
+
position: absolute;
|
17
|
+
top: 0;
|
18
|
+
left: 0;
|
19
|
+
width: 100%;
|
20
|
+
height: 100%;
|
21
|
+
display: flex;
|
22
|
+
align-items: center;
|
23
|
+
justify-content: center;
|
24
|
+
background-color: rgba(0, 0, 0, 0.04);
|
25
|
+
z-index: 100;
|
26
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/component/days-tab/index.jsx"],"names":[],"mappings":";AA6CA,8EAkEC"}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
8
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
10
|
+
import React, { useEffect } from 'react';
|
11
|
+
import moment from 'moment';
|
12
|
+
import classnames from 'classnames';
|
13
|
+
import Icon from '@shein-components/Icon';
|
14
|
+
import useImmer from "../../js/state-immer";
|
15
|
+
import "./style.css";
|
16
|
+
var styles = {
|
17
|
+
"daysTab": "shein-components_systemrobotassistant_daysTab",
|
18
|
+
"arrowIcon": "shein-components_systemrobotassistant_arrowIcon",
|
19
|
+
"disabledIcon": "shein-components_systemrobotassistant_disabledIcon",
|
20
|
+
"itemWrapper": "shein-components_systemrobotassistant_itemWrapper",
|
21
|
+
"dateItem": "shein-components_systemrobotassistant_dateItem",
|
22
|
+
"active": "shein-components_systemrobotassistant_active"
|
23
|
+
};
|
24
|
+
var cs = classnames.bind(styles);
|
25
|
+
var defaultState = {
|
26
|
+
showData: [],
|
27
|
+
// activeDay: '',
|
28
|
+
curDate: moment(),
|
29
|
+
splitIndex: 0
|
30
|
+
};
|
31
|
+
var getNextDays = (sourceData, splitIndex) => {
|
32
|
+
var _result;
|
33
|
+
var index = splitIndex + 3;
|
34
|
+
var result = sourceData === null || sourceData === void 0 ? void 0 : sourceData.slice(index, index + 3);
|
35
|
+
var len = sourceData === null || sourceData === void 0 ? void 0 : sourceData.length;
|
36
|
+
if (((_result = result) === null || _result === void 0 ? void 0 : _result.length) < 3 && len > 3) {
|
37
|
+
result = sourceData === null || sourceData === void 0 ? void 0 : sourceData.slice(len - 3, len);
|
38
|
+
index = len - 3;
|
39
|
+
}
|
40
|
+
return {
|
41
|
+
data: result,
|
42
|
+
index
|
43
|
+
};
|
44
|
+
};
|
45
|
+
var getPrevDays = (sourceData, splitIndex) => {
|
46
|
+
var index = splitIndex - 3;
|
47
|
+
var result = [];
|
48
|
+
if (index <= 0) {
|
49
|
+
index = 0;
|
50
|
+
result = sourceData === null || sourceData === void 0 ? void 0 : sourceData.slice(0, 3);
|
51
|
+
} else {
|
52
|
+
result = sourceData === null || sourceData === void 0 ? void 0 : sourceData.slice(index, splitIndex);
|
53
|
+
}
|
54
|
+
return {
|
55
|
+
data: result,
|
56
|
+
index
|
57
|
+
};
|
58
|
+
};
|
59
|
+
var DaysTab = props => {
|
60
|
+
var activeDay = props.activeDay,
|
61
|
+
data = props.data,
|
62
|
+
t = props.t,
|
63
|
+
onChange = props.onChange;
|
64
|
+
var _useImmer = useImmer(defaultState),
|
65
|
+
_useImmer2 = _slicedToArray(_useImmer, 2),
|
66
|
+
state = _useImmer2[0],
|
67
|
+
setState = _useImmer2[1];
|
68
|
+
var curDate = state.curDate,
|
69
|
+
showData = state.showData,
|
70
|
+
splitIndex = state.splitIndex;
|
71
|
+
useEffect(() => {
|
72
|
+
var now = moment();
|
73
|
+
setState({
|
74
|
+
// activeDay: now.format('YYYY-MM-DD'),
|
75
|
+
showData: data === null || data === void 0 ? void 0 : data.slice(0, 3),
|
76
|
+
curDate: now
|
77
|
+
});
|
78
|
+
}, [data]);
|
79
|
+
return /*#__PURE__*/React.createElement("div", {
|
80
|
+
className: styles.daysTab
|
81
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
82
|
+
name: "arrow-left",
|
83
|
+
className: cs(styles.arrowIcon, splitIndex <= 0 && styles.disabledIcon),
|
84
|
+
onClick: () => {
|
85
|
+
if (splitIndex <= 0) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
var obj = getPrevDays(data, splitIndex);
|
89
|
+
setState({
|
90
|
+
showData: obj.data,
|
91
|
+
splitIndex: obj.index
|
92
|
+
});
|
93
|
+
}
|
94
|
+
}), /*#__PURE__*/React.createElement("div", {
|
95
|
+
className: styles.itemWrapper
|
96
|
+
}, showData === null || showData === void 0 ? void 0 : showData.map(item => /*#__PURE__*/React.createElement("div", {
|
97
|
+
className: [styles.dateItem, activeDay === item.date && styles.active].join(' '),
|
98
|
+
onClick: () => {
|
99
|
+
setState({
|
100
|
+
activeDay: item.date
|
101
|
+
});
|
102
|
+
onChange(_objectSpread({}, item));
|
103
|
+
}
|
104
|
+
}, item.dateStr, item.today ? t('(今天)') : null))), /*#__PURE__*/React.createElement(Icon, {
|
105
|
+
name: "arrow-right",
|
106
|
+
className: cs(styles.arrowIcon, splitIndex + 3 >= (data === null || data === void 0 ? void 0 : data.length) && styles.disabledIcon),
|
107
|
+
onClick: () => {
|
108
|
+
if (splitIndex + 3 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
var obj = getNextDays(data, splitIndex);
|
112
|
+
setState({
|
113
|
+
showData: obj.data,
|
114
|
+
splitIndex: obj.index
|
115
|
+
});
|
116
|
+
}
|
117
|
+
}));
|
118
|
+
};
|
119
|
+
export default DaysTab;
|